diff --git a/about.po b/about.po index 9fa76130c..f4b4dd855 100644 --- a/about.po +++ b/about.po @@ -18,25 +18,25 @@ msgstr "" "Last-Translator: Inada Naoki , 2025\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../about.rst:3 msgid "About this documentation" msgstr "このドキュメントについて" -#: ../../about.rst:6 msgid "" "Python's documentation is generated from `reStructuredText`_ sources using " "`Sphinx`_, a documentation generator originally created for Python and now " "maintained as an independent project." msgstr "" -"Pythonのドキュメントは、`Sphinx`_ を使って、`reStructuredText`_ のソースから" -"生成されています。 Sphinx はもともとPythonのために作られ、現在は独立したプロ" -"ジェクトとして保守されています。" +"Python のドキュメントは、`Sphinx`_ を使って `reStructuredText`_ のソースから" +"生成されています。\n" +"Sphinx はもともと Python のために作られたドキュメント生成ツールで、現在は独立" +"したプロジェクトとして保守されています。" #: ../../about.rst:16 msgid "" diff --git a/bugs.po b/bugs.po index 7de00269a..f1ebd985d 100644 --- a/bugs.po +++ b/bugs.po @@ -20,10 +20,10 @@ msgstr "" "Last-Translator: Taichi Haradaguchi, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../bugs.rst:5 @@ -60,6 +60,9 @@ msgid "" "the-tracker>`. If you have a suggestion on how to fix it, include that as " "well." msgstr "" +"このドキュメントの不備を発見したとき、または、改善を提案したいときは、問題点" +"を :ref:`issue tracker ` に報告してください。修正方法の案" +"があるならば、それも含めて。" #: ../../bugs.rst:22 msgid "" @@ -75,6 +78,9 @@ msgid "" "documentation, please submit a bug report on the `python-doc-theme issue " "tracker `_." msgstr "" +"ドキュメントのテーマ (HTML / CSS / JavaScript) に不備を見つけたときは、 " +"`python-doc-theme issue tracker `_ に報告してください。" #: ../../bugs.rst:31 msgid "`Documentation bugs`_" @@ -179,13 +185,13 @@ msgid "The submission form has two fields, \"Title\" and \"Comment\"." msgstr "" "報告のフォームには、「Title」と「Comment」の2つのフィールドがあります。" -#: ../../bugs.rst:71 msgid "" "For the \"Title\" field, enter a *very* short description of the problem; " "fewer than ten words is good." msgstr "" "「Title」フィールドには、問題の *とても* 短い説明を(訳注: 英語で)入力してく" -"ださい。10語以内が望ましいです。" +"ださい。\n" +"10 語未満が望ましいです。" #: ../../bugs.rst:74 msgid "" @@ -224,13 +230,12 @@ msgstr "" "有益なバグ報告について詳しく説明した記事です。どんな情報が、なぜ有益なのかを" "説明しています。" -#: ../../bugs.rst:90 msgid "" "`Bug Writing Guidelines `_" msgstr "" -"`Bug Writing Guidelines `_" +"`Bug Writing Guidelines `_" #: ../../bugs.rst:91 msgid "" diff --git a/c-api/abstract.po b/c-api/abstract.po index f7754dbe6..afc90f98e 100644 --- a/c-api/abstract.po +++ b/c-api/abstract.po @@ -17,10 +17,10 @@ msgstr "" "Last-Translator: Taichi Haradaguchi, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../c-api/abstract.rst:7 diff --git a/c-api/allocation.po b/c-api/allocation.po index 270c704f4..3bf577dc9 100644 --- a/c-api/allocation.po +++ b/c-api/allocation.po @@ -16,17 +16,16 @@ msgstr "" "Last-Translator: tomo, 2025\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../c-api/allocation.rst:6 msgid "Allocating Objects on the Heap" msgstr "オブジェクトをヒープ上にメモリ確保する" -#: ../../c-api/allocation.rst:17 msgid "" "Initialize a newly allocated object *op* with its type and initial " "reference. Returns the initialized object. Other fields of the object are " @@ -35,20 +34,32 @@ msgid "" "slot). Specifically, this function does **not** call the object's :meth:`!" "__init__` method." msgstr "" +"新しく割り当てたオブジェクト *op* の型と初期の参照を設定し、初期化したオブ" +"ジェクトを返します。\n" +"オブジェクトの他のフィールドは初期化しません。\n" +"名前に反して、この関数はオブジェクトの :meth:`~object.__init__` メソッド (:c:" +"member:`~PyTypeObject.tp_init` スロット) とは無関係です。\n" +"特に、この関数はオブジェクトの :meth:`!__init__` メソッドを呼び出し **ません" +"**。" -#: ../../c-api/allocation.rst:24 msgid "" "In general, consider this function to be a low-level routine. Use :c:member:" "`~PyTypeObject.tp_alloc` where possible. For implementing :c:member:`!" "tp_alloc` for your type, prefer :c:func:`PyType_GenericAlloc` or :c:func:" "`PyObject_New`." msgstr "" +"一般に、この関数は低レベルのルーチンとして扱ってください。\n" +"可能な場合は :c:member:`~PyTypeObject.tp_alloc` を使ってください。\n" +"自分の型の :c:member:`!tp_alloc` を実装する場合は、:c:func:" +"`PyType_GenericAlloc` または :c:func:`PyObject_New` を優先してください。" -#: ../../c-api/allocation.rst:31 msgid "" "This function only initializes the object's memory corresponding to the " "initial :c:type:`PyObject` structure. It does not zero the rest." msgstr "" +"この関数が初期化するのは、オブジェクトのメモリのうち先頭の :c:type:" +"`PyObject` 構造体に対応する部分だけです。\n" +"残りの部分をゼロで埋めることはありません。" #: ../../c-api/allocation.rst:37 msgid "" @@ -58,13 +69,13 @@ msgstr "" ":c:func:`PyObject_Init` の全ての処理を行い、可変サイズオブジェクトの場合には" "長さ情報も初期化します。" -#: ../../c-api/allocation.rst:42 msgid "" "This function only initializes some of the object's memory. It does not " "zero the rest." msgstr "" +"この関数が初期化するのは、オブジェクトのメモリの一部だけです。\n" +"残りの部分をゼロで埋めることはありません。" -#: ../../c-api/allocation.rst:48 msgid "" "Allocates a new Python object using the C structure type *TYPE* and the " "Python type object *typeobj* (``PyTypeObject*``) by calling :c:func:" @@ -72,116 +83,139 @@ msgid "" "`PyObject_Init`. The caller will own the only reference to the object (i.e. " "its reference count will be one)." msgstr "" +"C の構造体型 *TYPE* と Python の型オブジェクト *typeobj* (``PyTypeObject*``) " +"を使って、新しい Python オブジェクトを割り当てます。\n" +":c:func:`PyObject_Malloc` を呼び出してメモリを割り当て、:c:func:" +"`PyObject_Init` と同じように初期化します。\n" +"呼び出し側がオブジェクトへの唯一の参照を所有します (つまり参照カウントは 1 に" +"なります)。" -#: ../../c-api/allocation.rst:54 ../../c-api/allocation.rst:107 msgid "" "Avoid calling this directly to allocate memory for an object; call the " "type's :c:member:`~PyTypeObject.tp_alloc` slot instead." msgstr "" +"オブジェクトのメモリを割り当てるためにこれを直接呼び出すのは避け、代わりに型" +"の :c:member:`~PyTypeObject.tp_alloc` スロットを呼び出してください。" -#: ../../c-api/allocation.rst:57 ../../c-api/allocation.rst:110 msgid "" "When populating a type's :c:member:`~PyTypeObject.tp_alloc` slot, :c:func:" "`PyType_GenericAlloc` is preferred over a custom function that simply calls " "this macro." msgstr "" +"型の :c:member:`~PyTypeObject.tp_alloc` スロットには、このマクロを呼び出すだ" +"けの独自の関数よりも :c:func:`PyType_GenericAlloc` を設定することが推奨されま" +"す。" -#: ../../c-api/allocation.rst:61 msgid "" "This macro does not call :c:member:`~PyTypeObject.tp_alloc`, :c:member:" "`~PyTypeObject.tp_new` (:meth:`~object.__new__`), or :c:member:" "`~PyTypeObject.tp_init` (:meth:`~object.__init__`)." msgstr "" +"このマクロは :c:member:`~PyTypeObject.tp_alloc`、:c:member:`~PyTypeObject." +"tp_new` (:meth:`~object.__new__`)、:c:member:`~PyTypeObject.tp_init` (:meth:" +"`~object.__init__`) を呼び出しません。" -#: ../../c-api/allocation.rst:65 msgid "" "This cannot be used for objects with :c:macro:`Py_TPFLAGS_HAVE_GC` set in :c:" "member:`~PyTypeObject.tp_flags`; use :c:macro:`PyObject_GC_New` instead." msgstr "" +":c:member:`~PyTypeObject.tp_flags` に :c:macro:`Py_TPFLAGS_HAVE_GC` が設定さ" +"れたオブジェクトには使えません。\n" +"代わりに :c:macro:`PyObject_GC_New` を使ってください。" -#: ../../c-api/allocation.rst:68 msgid "" "Memory allocated by this macro must be freed with :c:func:`PyObject_Free` " "(usually called via the object's :c:member:`~PyTypeObject.tp_free` slot)." msgstr "" +"このマクロで割り当てたメモリは :c:func:`PyObject_Free` で解放しなければなりま" +"せん (通常はオブジェクトの :c:member:`~PyTypeObject.tp_free` スロットを介して" +"呼び出します)。" -#: ../../c-api/allocation.rst:73 ../../c-api/allocation.rst:123 msgid "" "The returned memory is not guaranteed to have been completely zeroed before " "it was initialized." -msgstr "" +msgstr "返されるメモリが初期化前にすべてゼロで埋められているとは限りません。" -#: ../../c-api/allocation.rst:78 ../../c-api/allocation.rst:128 msgid "" "This macro does not construct a fully initialized object of the given type; " "it merely allocates memory and prepares it for further initialization by :c:" "member:`~PyTypeObject.tp_init`. To construct a fully initialized object, " "call *typeobj* instead. For example::" msgstr "" +"このマクロは指定された型の完全に初期化されたオブジェクトを構築するものではあ" +"りません。\n" +"メモリを割り当て、:c:member:`~PyTypeObject.tp_init` によるさらなる初期化の準" +"備をするだけです。\n" +"完全に初期化されたオブジェクトを構築するには、代わりに *typeobj* を呼び出して" +"ください。\n" +"例えば次のようにします。 ::" -#: ../../c-api/allocation.rst:83 msgid "PyObject *foo = PyObject_CallNoArgs((PyObject *)&PyFoo_Type);" -msgstr "" +msgstr "PyObject *foo = PyObject_CallNoArgs((PyObject *)&PyFoo_Type);" #: ../../c-api/allocation.rst:87 ../../c-api/allocation.rst:137 msgid ":c:func:`PyObject_Free`" msgstr ":c:func:`PyObject_Free`" -#: ../../c-api/allocation.rst:88 msgid ":c:macro:`PyObject_GC_New`" -msgstr "" +msgstr ":c:macro:`PyObject_GC_New`" -#: ../../c-api/allocation.rst:89 ../../c-api/allocation.rst:139 msgid ":c:func:`PyType_GenericAlloc`" -msgstr "" +msgstr ":c:func:`PyType_GenericAlloc`" #: ../../c-api/allocation.rst:90 ../../c-api/allocation.rst:140 msgid ":c:member:`~PyTypeObject.tp_alloc`" msgstr ":c:member:`~PyTypeObject.tp_alloc`" -#: ../../c-api/allocation.rst:95 msgid "Like :c:macro:`PyObject_New` except:" -msgstr "" +msgstr ":c:macro:`PyObject_New` と同じですが、次の点が異なります。" -#: ../../c-api/allocation.rst:97 msgid "" "It allocates enough memory for the *TYPE* structure plus *size* " "(``Py_ssize_t``) fields of the size given by the :c:member:`~PyTypeObject." "tp_itemsize` field of *typeobj*." msgstr "" +"*TYPE* 構造体に加え、*typeobj* の :c:member:`~PyTypeObject.tp_itemsize` " +"フィールドが指定するサイズのフィールド *size* 個分 (``Py_ssize_t``) のメモリ" +"を割り当てます。" -#: ../../c-api/allocation.rst:100 msgid "The memory is initialized like :c:func:`PyObject_InitVar`." -msgstr "" +msgstr "メモリは :c:func:`PyObject_InitVar` と同じように初期化されます。" -#: ../../c-api/allocation.rst:102 msgid "" "This is useful for implementing objects like tuples, which are able to " "determine their size at construction time. Embedding the array of fields " "into the same allocation decreases the number of allocations, improving the " "memory management efficiency." msgstr "" +"これはタプルのように構築時にサイズを決定できるオブジェクトの実装に役立ちま" +"す。\n" +"フィールドの配列を同じ割り当て領域に埋め込むことで、割り当て回数を減らし、メ" +"モリ管理の効率を高められます。" -#: ../../c-api/allocation.rst:114 msgid "" "This cannot be used for objects with :c:macro:`Py_TPFLAGS_HAVE_GC` set in :c:" "member:`~PyTypeObject.tp_flags`; use :c:macro:`PyObject_GC_NewVar` instead." msgstr "" +":c:member:`~PyTypeObject.tp_flags` に :c:macro:`Py_TPFLAGS_HAVE_GC` が設定さ" +"れたオブジェクトには使えません。\n" +"代わりに :c:macro:`PyObject_GC_NewVar` を使ってください。" -#: ../../c-api/allocation.rst:118 msgid "" "Memory allocated by this function must be freed with :c:func:`PyObject_Free` " "(usually called via the object's :c:member:`~PyTypeObject.tp_free` slot)." msgstr "" +"この関数で割り当てたメモリは :c:func:`PyObject_Free` で解放しなければなりませ" +"ん (通常はオブジェクトの :c:member:`~PyTypeObject.tp_free` スロットを介して呼" +"び出します)。" -#: ../../c-api/allocation.rst:133 msgid "" "PyObject *list_instance = PyObject_CallNoArgs((PyObject *)&PyList_Type);" msgstr "" +"PyObject *list_instance = PyObject_CallNoArgs((PyObject *)&PyList_Type);" -#: ../../c-api/allocation.rst:138 msgid ":c:macro:`PyObject_GC_NewVar`" -msgstr "" +msgstr ":c:macro:`PyObject_GC_NewVar`" #: ../../c-api/allocation.rst:145 msgid "Same as :c:func:`PyObject_Free`." diff --git a/c-api/apiabiversion.po b/c-api/apiabiversion.po index 85debddcc..cf30e5a99 100644 --- a/c-api/apiabiversion.po +++ b/c-api/apiabiversion.po @@ -17,26 +17,27 @@ msgstr "" "Last-Translator: tomo, 2025\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../c-api/apiabiversion.rst:7 msgid "API and ABI Versioning" msgstr "API と ABI のバージョニング" -#: ../../c-api/apiabiversion.rst:11 msgid "Build-time version constants" -msgstr "" +msgstr "ビルド時のバージョン定数" -#: ../../c-api/apiabiversion.rst:13 msgid "" "CPython exposes its version number in the following macros. Note that these " "correspond to the version code is **built** with. See :c:var:`Py_Version` " "for the version used at **run time**." msgstr "" +"CPython は以下のマクロでバージョン番号を公開しています。\n" +"これらはコードの **ビルド時** のバージョンに対応します。\n" +"**実行時** のバージョンについては :c:var:`Py_Version` を参照してください。" #: ../../c-api/apiabiversion.rst:17 msgid "" @@ -69,99 +70,89 @@ msgstr "" msgid "The ``2`` in ``3.4.1a2``. Zero for final releases." msgstr "``3.4.1a2`` の ``2`` 。最終リリースでは 0 になります。" -#: ../../c-api/apiabiversion.rst:43 msgid "" "The Python version number encoded in a single integer. See :c:func:" "`Py_PACK_FULL_VERSION` for the encoding details." msgstr "" +"Python のバージョン番号を一つの整数にエンコードした値です。\n" +"エンコードの詳細は :c:func:`Py_PACK_FULL_VERSION` を参照してください。" -#: ../../c-api/apiabiversion.rst:46 msgid "" "Use this for numeric comparisons, for example, ``#if PY_VERSION_HEX >= ...``." msgstr "" +"``#if PY_VERSION_HEX >= ...`` のように、数値として比較するときに使います。" -#: ../../c-api/apiabiversion.rst:51 msgid "Run-time version" -msgstr "" +msgstr "実行時のバージョン" -#: ../../c-api/apiabiversion.rst:55 msgid "" "The Python runtime version number encoded in a single constant integer. See :" "c:func:`Py_PACK_FULL_VERSION` for the encoding details. This contains the " "Python version used at run time." msgstr "" +"Python ランタイムのバージョン番号を一つの整数定数にエンコードした値です。\n" +"エンコードの詳細は :c:func:`Py_PACK_FULL_VERSION` を参照してください。\n" +"実行時に使われている Python のバージョンを表します。" -#: ../../c-api/apiabiversion.rst:59 msgid "" "Use this for numeric comparisons, for example, ``if (Py_Version >= ...)``." msgstr "" +"``if (Py_Version >= ...)`` のように、数値として比較するときに使います。" -#: ../../c-api/apiabiversion.rst:65 msgid "Bit-packing macros" -msgstr "" +msgstr "ビットを詰め合わせるマクロ" -#: ../../c-api/apiabiversion.rst:69 msgid "" "Return the given version, encoded as a single 32-bit integer with the " "following structure:" msgstr "" +"指定されたバージョンを、以下の構造を持つ一つの 32 ビット整数にエンコードして" +"返します。" -#: ../../c-api/apiabiversion.rst:75 msgid "Argument" -msgstr "" +msgstr "引数" -#: ../../c-api/apiabiversion.rst:73 msgid "No. of bits" -msgstr "" +msgstr "ビット数" -#: ../../c-api/apiabiversion.rst:75 msgid "Bit mask" -msgstr "" +msgstr "ビットマスク" -#: ../../c-api/apiabiversion.rst:75 msgid "Bit shift" -msgstr "" +msgstr "ビットシフト" -#: ../../c-api/apiabiversion.rst:73 msgid "Example values" -msgstr "" +msgstr "値の例" -#: ../../c-api/apiabiversion.rst:75 ../../c-api/apiabiversion.rst:93 msgid "``3.4.1a2``" -msgstr "" +msgstr "``3.4.1a2``" -#: ../../c-api/apiabiversion.rst:75 ../../c-api/apiabiversion.rst:95 msgid "``3.10.0``" -msgstr "" +msgstr "``3.10.0``" -#: ../../c-api/apiabiversion.rst:77 msgid "*major*" -msgstr "" +msgstr "*major*" #: ../../c-api/apiabiversion.rst:77 ../../c-api/apiabiversion.rst:79 #: ../../c-api/apiabiversion.rst:81 msgid "8" msgstr "8" -#: ../../c-api/apiabiversion.rst:77 msgid "``0xFF000000``" -msgstr "" +msgstr "``0xFF000000``" -#: ../../c-api/apiabiversion.rst:77 msgid "24" -msgstr "" +msgstr "24" #: ../../c-api/apiabiversion.rst:77 msgid "``0x03``" msgstr "``0x03``" -#: ../../c-api/apiabiversion.rst:79 msgid "*minor*" -msgstr "" +msgstr "*minor*" -#: ../../c-api/apiabiversion.rst:79 msgid "``0x00FF0000``" -msgstr "" +msgstr "``0x00FF0000``" #: ../../c-api/apiabiversion.rst:79 msgid "16" @@ -171,53 +162,44 @@ msgstr "16" msgid "``0x04``" msgstr "``0x04``" -#: ../../c-api/apiabiversion.rst:79 msgid "``0x0A``" -msgstr "" +msgstr "``0x0A``" -#: ../../c-api/apiabiversion.rst:81 msgid "*micro*" -msgstr "" +msgstr "*micro*" -#: ../../c-api/apiabiversion.rst:81 msgid "``0x0000FF00``" -msgstr "" +msgstr "``0x0000FF00``" #: ../../c-api/apiabiversion.rst:81 msgid "``0x01``" msgstr "``0x01``" -#: ../../c-api/apiabiversion.rst:81 msgid "``0x00``" -msgstr "" +msgstr "``0x00``" -#: ../../c-api/apiabiversion.rst:83 msgid "*release_level*" -msgstr "" +msgstr "*release_level*" #: ../../c-api/apiabiversion.rst:83 ../../c-api/apiabiversion.rst:85 msgid "4" msgstr "4" -#: ../../c-api/apiabiversion.rst:83 msgid "``0x000000F0``" -msgstr "" +msgstr "``0x000000F0``" #: ../../c-api/apiabiversion.rst:83 msgid "``0xA``" msgstr "``0xA``" -#: ../../c-api/apiabiversion.rst:83 msgid "``0xF``" -msgstr "" +msgstr "``0xF``" -#: ../../c-api/apiabiversion.rst:85 msgid "*release_serial*" -msgstr "" +msgstr "*release_serial*" -#: ../../c-api/apiabiversion.rst:85 msgid "``0x0000000F``" -msgstr "" +msgstr "``0x0000000F``" #: ../../c-api/apiabiversion.rst:85 msgid "0" @@ -227,9 +209,8 @@ msgstr "0" msgid "``0x2``" msgstr "``0x2``" -#: ../../c-api/apiabiversion.rst:85 msgid "``0x0``" -msgstr "" +msgstr "``0x0``" #: ../../c-api/apiabiversion.rst:88 msgid "For example:" @@ -239,37 +220,31 @@ msgstr "例えば:" msgid "Version" msgstr "Version" -#: ../../c-api/apiabiversion.rst:91 msgid "``Py_PACK_FULL_VERSION`` arguments" -msgstr "" +msgstr "``Py_PACK_FULL_VERSION`` の引数" -#: ../../c-api/apiabiversion.rst:91 msgid "Encoded version" -msgstr "" +msgstr "エンコードされたバージョン" -#: ../../c-api/apiabiversion.rst:93 msgid "``(3, 4, 1, 0xA, 2)``" -msgstr "" +msgstr "``(3, 4, 1, 0xA, 2)``" -#: ../../c-api/apiabiversion.rst:93 msgid "``0x030401a2``" -msgstr "" +msgstr "``0x030401a2``" -#: ../../c-api/apiabiversion.rst:95 msgid "``(3, 10, 0, 0xF, 0)``" -msgstr "" +msgstr "``(3, 10, 0, 0xF, 0)``" -#: ../../c-api/apiabiversion.rst:95 msgid "``0x030a00f0``" -msgstr "" +msgstr "``0x030a00f0``" -#: ../../c-api/apiabiversion.rst:98 msgid "" "Out-of range bits in the arguments are ignored. That is, the macro can be " "defined as:" msgstr "" +"引数の範囲外のビットは無視します。\n" +"つまり、このマクロは次のように定義できます。" -#: ../../c-api/apiabiversion.rst:101 msgid "" "#ifndef Py_PACK_FULL_VERSION\n" "#define Py_PACK_FULL_VERSION(X, Y, Z, LEVEL, SERIAL) ( \\\n" @@ -280,16 +255,26 @@ msgid "" " (((SERIAL) & 0xf) << 0))\n" "#endif" msgstr "" +"#ifndef Py_PACK_FULL_VERSION\n" +"#define Py_PACK_FULL_VERSION(X, Y, Z, LEVEL, SERIAL) ( \\\n" +" (((X) & 0xff) << 24) | \\\n" +" (((Y) & 0xff) << 16) | \\\n" +" (((Z) & 0xff) << 8) | \\\n" +" (((LEVEL) & 0xf) << 4) | \\\n" +" (((SERIAL) & 0xf) << 0))\n" +"#endif" -#: ../../c-api/apiabiversion.rst:112 msgid "" "``Py_PACK_FULL_VERSION`` is primarily a macro, intended for use in ``#if`` " "directives, but it is also available as an exported function." msgstr "" +"``Py_PACK_FULL_VERSION`` は主に ``#if`` ディレクティブで使うためのマクロです" +"が、エクスポートされた関数としても利用できます。" -#: ../../c-api/apiabiversion.rst:119 msgid "" "Equivalent to ``Py_PACK_FULL_VERSION(major, minor, 0, 0, 0)``. The result " "does not correspond to any Python release, but is useful in numeric " "comparisons." msgstr "" +"``Py_PACK_FULL_VERSION(major, minor, 0, 0, 0)`` と同等です。\n" +"結果は実際の Python リリースには対応しませんが、数値による比較に便利です。" diff --git a/c-api/arg.po b/c-api/arg.po index f7ba191bf..48676fb98 100644 --- a/c-api/arg.po +++ b/c-api/arg.po @@ -19,22 +19,23 @@ msgstr "" "Last-Translator: Taichi Haradaguchi, 2025\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../c-api/arg.rst:6 msgid "Parsing arguments and building values" msgstr "引数の解釈と値の構築" -#: ../../c-api/arg.rst:8 msgid "" "These functions are useful when creating your own extension functions and " "methods. Additional information and examples are available in :ref:" "`extending-index`." msgstr "" +"これらの関数は、独自の拡張関数やメソッドを作成するときに便利です。\n" +"追加の情報や例は :ref:`extending-index` を参照してください。" #: ../../c-api/arg.rst:12 msgid "" @@ -54,7 +55,6 @@ msgstr "" msgid "Parsing arguments" msgstr "引数を解析する" -#: ../../c-api/arg.rst:21 msgid "" "A format string consists of zero or more \"format units.\" A format unit " "describes one Python object; it is usually a single character or a " @@ -65,13 +65,13 @@ msgid "" "Python object type that matches the format unit; and the entry in [square] " "brackets is the type of the C variable(s) whose address should be passed." msgstr "" -"書式文字列は、ゼロ個またはそれ以上の \"書式単位 (format unit)\" から成り立ち" -"ます。 1つの書式単位は1つの Python オブジェクトを表します; 通常は単一の文字" -"か、書式単位からなる文字列を括弧で囲ったものになります。例外として、括弧で囲" -"われていない書式単位文字列が単一のアドレス引数に対応する場合がいくつかありま" -"す。以下の説明では、引用符のついた形式は書式単位です; (丸)括弧で囲った部分は" -"書式単位に対応する Python のオブジェクト型です; [角] 括弧は値をアドレス渡しす" -"る際に使う C の変数型です。" +"書式文字列は、0 個以上の「書式単位 (format unit)」からなります。\n" +"書式単位は一つの Python オブジェクトを記述し、通常は単一の文字か、複数の書式" +"単位を丸括弧で囲んだものです。\n" +"丸括弧で囲まれた並びでない書式単位は、一部の例外を除き、これらの関数に渡す一" +"つのアドレス引数に対応します。\n" +"以下の説明では、引用符で囲んだものが書式単位、丸括弧内が対応する Python オブ" +"ジェクトの型、角括弧内がアドレスを渡す C 変数の型です。" #: ../../c-api/arg.rst:33 msgid "Strings and buffers" @@ -104,9 +104,8 @@ msgstr "特に言及されていない場合、バッファーは NUL 終端さ #: ../../c-api/arg.rst:48 msgid "There are three ways strings and buffers can be converted to C:" -msgstr "" +msgstr "文字列とバッファをCに変換する方法は3つあります:" -#: ../../c-api/arg.rst:50 msgid "" "Formats such as ``y*`` and ``s*`` fill a :c:type:`Py_buffer` structure. This " "locks the underlying buffer so that the caller can subsequently use the " @@ -115,15 +114,24 @@ msgid "" "call** :c:func:`PyBuffer_Release` after you have finished processing the " "data (or in any early abort case)." msgstr "" +"``y*`` や ``s*`` などの形式は :c:type:`Py_buffer` 構造体に情報を設定しま" +"す。\n" +"これによって内部バッファがロックされるので、呼び出し側は :c:type:" +"`Py_BEGIN_ALLOW_THREADS` ブロック内でも、可変データのサイズ変更や破棄の危険な" +"しにバッファを使えます。\n" +"そのため、データの処理が完了したときや途中で中止したときは、:c:func:" +"`PyBuffer_Release` を **必ず呼び出す必要があります**。" -#: ../../c-api/arg.rst:57 msgid "" "The ``es``, ``es#``, ``et`` and ``et#`` formats allocate the result buffer. " "**You have to call** :c:func:`PyMem_Free` after you have finished processing " "the data (or in any early abort case)." msgstr "" +"``es``、``es#``、``et``、``et#`` 形式は、結果を格納するバッファを割り当てま" +"す。\n" +"データの処理が完了したときや途中で中止したときは、:c:func:`PyMem_Free` を **" +"必ず呼び出す必要があります**。" -#: ../../c-api/arg.rst:63 msgid "" "Other formats take a :class:`str` or a read-only :term:`bytes-like object`, " "such as :class:`bytes`, and provide a ``const char *`` pointer to its " @@ -131,21 +139,35 @@ msgid "" "corresponding Python object, and shares the lifetime of this object. You " "won't have to release any memory yourself." msgstr "" +"ほかの形式は :class:`str` または :class:`bytes` などの読み取り専用の :term:" +"`bytes-like オブジェクト ` を受け取り、そのバッファへの " +"``const char *`` ポインタを提供します。\n" +"この場合、バッファは「借用」されます。\n" +"対応する Python オブジェクトが管理し、そのオブジェクトと寿命を共有します。\n" +"メモリを自分で解放する必要はありません。" -#: ../../c-api/arg.rst:70 msgid "" "To ensure that the underlying buffer may be safely borrowed, the object's :c:" "member:`PyBufferProcs.bf_releasebuffer` field must be ``NULL``. This " "disallows common mutable objects such as :class:`bytearray`, but also some " "read-only objects such as :class:`memoryview` of :class:`bytes`." msgstr "" +"内部バッファを安全に借用できるように、オブジェクトの :c:member:" +"`PyBufferProcs.bf_releasebuffer` フィールドは ``NULL`` でなければなりませ" +"ん。\n" +"この条件により、:class:`bytearray` のような一般的な可変オブジェクトだけでな" +"く、:class:`bytes` の :class:`memoryview` のような一部の読み取り専用オブジェ" +"クトも受け付けません。" -#: ../../c-api/arg.rst:76 msgid "" "Besides this ``bf_releasebuffer`` requirement, there is no check to verify " "whether the input object is immutable (e.g. whether it would honor a request " "for a writable buffer, or whether another thread can mutate the data)." msgstr "" +"この ``bf_releasebuffer`` の要件以外に、入力オブジェクトが不変かどうかを確認" +"するチェックはありません。\n" +"例えば、書き込み可能なバッファの要求に応じるかどうかや、別のスレッドがデータ" +"を変更できるかどうかは確認しません。" #: ../../c-api/arg.rst:80 msgid "``s`` (:class:`str`) [const char \\*]" @@ -214,7 +236,6 @@ msgstr "" "``s#`` (:class:`str`, 読み取り専用の :term:`bytes-like object`) [const char " "\\*, :c:type:`Py_ssize_t`]" -#: ../../c-api/arg.rst:107 msgid "" "Like ``s*``, except that it provides a :ref:`borrowed buffer `. The result is stored into two C variables, the first one a pointer " @@ -222,6 +243,13 @@ msgid "" "null bytes. Unicode objects are converted to C strings using ``'utf-8'`` " "encoding." msgstr "" +"``s*`` と同様ですが、:ref:`借用バッファ ` を提供しま" +"す。\n" +"結果は二つの C 変数に格納され、一つ目は C 文字列へのポインタ、二つ目はその長" +"さです。\n" +"文字列にはヌルバイトが埋め込まれていても構いません。\n" +"Unicode オブジェクトは ``'utf-8'`` エンコーディングで C 文字列に変換されま" +"す。" #: ../../c-api/arg.rst:113 ../../c-api/arg.rst:629 msgid "``z`` (:class:`str` or ``None``) [const char \\*]" @@ -267,13 +295,17 @@ msgstr "" msgid "``y`` (read-only :term:`bytes-like object`) [const char \\*]" msgstr "``y`` (読み出し専用の :term:`bytes-like object`) [const char \\*]" -#: ../../c-api/arg.rst:130 msgid "" "This format converts a bytes-like object to a C pointer to a :ref:`borrowed " "` character string; it does not accept Unicode " "objects. The bytes buffer must not contain embedded null bytes; if it does, " "a :exc:`ValueError` exception is raised." msgstr "" +"bytes-like オブジェクトを、:ref:`借用した ` 文字列へ" +"の C ポインタに変換します。\n" +"Unicode オブジェクトは受け付けません。\n" +"バイトバッファにはヌルバイトを埋め込めません。\n" +"含まれている場合は :exc:`ValueError` 例外を送出します。" #: ../../c-api/arg.rst:136 msgid "" @@ -441,15 +473,13 @@ msgstr "" "``es#`` (:class:`str`) [const char \\*encoding, char \\*\\*buffer, :c:type:" "`Py_ssize_t` \\*buffer_length]" -#: ../../c-api/arg.rst:193 msgid "" "This variant on ``s#`` is used for encoding Unicode into a character buffer. " "Unlike the ``es`` format, this variant allows input data which contains NUL " "characters." msgstr "" -"``s#`` の変化形で、Unicode をキャラクタ型バッファにエンコードするために用いら" -"れます。``es`` 書式違って、この変化形はバイトが埋め込まれていてもかまいませ" -"ん。" +"``s#`` の変種で、Unicode を文字バッファにエンコードするために使います。\n" +"``es`` 形式と異なり、NUL 文字を含む入力データを受け付けます。" #: ../../c-api/arg.rst:197 msgid "" @@ -530,17 +560,17 @@ msgstr "" "します。その代わり、実装ではバイト文字列オブジェクトがパラメタに渡したエン" "コードを使っているものと仮定します。" -#: ../../c-api/arg.rst:228 msgid "" "``u``, ``u#``, ``Z``, and ``Z#`` are removed because they used a legacy " "``Py_UNICODE*`` representation." msgstr "" +"従来の ``Py_UNICODE*`` 表現を使っていたため、``u``、``u#``、``Z``、``Z#`` を" +"削除しました。" #: ../../c-api/arg.rst:234 msgid "Numbers" msgstr "数" -#: ../../c-api/arg.rst:236 msgid "" "These formats allow representing Python numbers or single characters as C " "numbers. Formats that require :class:`int`, :class:`float` or :class:" @@ -548,6 +578,12 @@ msgid "" "__index__`, :meth:`~object.__float__` or :meth:`~object.__complex__` to " "convert the Python object to the required type." msgstr "" +"これらの形式は、Python の数値や単一の文字を C の数値として表すためのもので" +"す。\n" +":class:`int`、:class:`float`、:class:`complex` を必要とする形式では、対応する" +"特殊メソッド :meth:`~object.__index__`、:meth:`~object.__float__`、:meth:" +"`~object.__complex__` で Python オブジェクトを必要な型に変換することもできま" +"す。" #: ../../c-api/arg.rst:242 msgid "" @@ -561,11 +597,12 @@ msgstr "" msgid "``b`` (:class:`int`) [unsigned char]" msgstr "``b`` (:class:`int`) [unsigned char]" -#: ../../c-api/arg.rst:249 msgid "" "Convert a nonnegative Python integer to an unsigned tiny integer, stored in " "a C :c:expr:`unsigned char`." msgstr "" +"負でない Python 整数を小さい符号なし整数に変換し、C の :c:expr:`unsigned " +"char` に格納します。" #: ../../c-api/arg.rst:252 ../../c-api/arg.rst:663 msgid "``B`` (:class:`int`) [unsigned char]" @@ -701,17 +738,15 @@ msgstr "" msgid "``f`` (:class:`float`) [float]" msgstr "``f`` (:class:`float`) [float]" -#: ../../c-api/arg.rst:305 msgid "Convert a Python floating-point number to a C :c:expr:`float`." -msgstr "" +msgstr "Python の浮動小数点数を C の :c:expr:`float` に変換します。" #: ../../c-api/arg.rst:307 ../../c-api/arg.rst:698 msgid "``d`` (:class:`float`) [double]" msgstr "``d`` (:class:`float`) [double]" -#: ../../c-api/arg.rst:308 msgid "Convert a Python floating-point number to a C :c:expr:`double`." -msgstr "" +msgstr "Python の浮動小数点数を C の :c:expr:`double` に変換します。" #: ../../c-api/arg.rst:310 msgid "``D`` (:class:`complex`) [Py_complex]" @@ -736,6 +771,10 @@ msgid "" "`strong reference` to the object is not created (i.e. its reference count is " "not increased). The pointer stored is not ``NULL``." msgstr "" +"Python オブジェクトを変換せずに C オブジェクトのポインタに格納します。これに" +"より、C プログラムは渡されたオブジェクトそのものを受け取ります。オブジェクト" +"への新しい :term:`強参照 ` は作成されません(つまり、参照カ" +"ウントは増加しません)。格納されるポインタは ``NULL`` ではありません。" #: ../../c-api/arg.rst:323 msgid "``O!`` (object) [*typeobject*, PyObject \\*]" @@ -755,9 +794,8 @@ msgstr "" "c:expr:`PyObject*` の) C の変数へのアドレスです。Python オブジェクトが指定し" "た型ではない場合、 :exc:`TypeError` を送出します。" -#: ../../c-api/arg.rst:332 msgid "``O&`` (object) [*converter*, *address*]" -msgstr "" +msgstr "``O&`` (オブジェクト) [*converter*, *address*]" #: ../../c-api/arg.rst:333 msgid "" @@ -771,9 +809,8 @@ msgstr "" "expr:`void *` 型に変換したものです。 *converter* は以下のようにして呼び出され" "ます::" -#: ../../c-api/arg.rst:338 msgid "status = converter(object, address);" -msgstr "" +msgstr "status = converter(object, address);" #: ../../c-api/arg.rst:340 msgid "" @@ -790,7 +827,6 @@ msgstr "" "合、 *converter* 関数は *address* の内容を変更せずに例外を送出しなくてはなり" "ません。" -#: ../../c-api/arg.rst:349 msgid "" "If the *converter* returns :c:macro:`!Py_CLEANUP_SUPPORTED`, it may get " "called a second time if the argument parsing eventually fails, giving the " @@ -798,16 +834,21 @@ msgid "" "this second call, the *object* parameter will be ``NULL``; *address* will " "have the same value as in the original call." msgstr "" +"``converter`` が :c:macro:`!Py_CLEANUP_SUPPORTED` を返した場合、後で引数の解" +"析に失敗すると、すでに割り当てたメモリを解放できるように再び呼び出されること" +"があります。\n" +"この 2 回目の呼び出しでは、``object`` 引数は ``NULL``、``address`` は最初の呼" +"び出しと同じ値になります。" -#: ../../c-api/arg.rst:355 msgid "" "Examples of converters: :c:func:`PyUnicode_FSConverter` and :c:func:" "`PyUnicode_FSDecoder`." msgstr "" +"変換関数の例: :c:func:`PyUnicode_FSConverter` と :c:func:" +"`PyUnicode_FSDecoder`。" -#: ../../c-api/arg.rst:358 msgid ":c:macro:`!Py_CLEANUP_SUPPORTED` was added." -msgstr "" +msgstr ":c:macro:`!Py_CLEANUP_SUPPORTED` を追加しました。" #: ../../c-api/arg.rst:361 ../../c-api/arg.rst:686 msgid "``p`` (:class:`bool`) [int]" @@ -828,19 +869,21 @@ msgstr "" "Pythonが値の真偽をどのように判定するかを知りたければ、 :ref:`truth` を参照し" "てください。" -#: ../../c-api/arg.rst:370 msgid "``(items)`` (sequence) [*matching-items*]" -msgstr "" +msgstr "``(items)`` (シーケンス) [*matching-items*]" -#: ../../c-api/arg.rst:371 msgid "" "The object must be a Python sequence (except :class:`str`, :class:`bytes` " "or :class:`bytearray`) whose length is the number of format units in " "*items*. The C arguments must correspond to the individual format units in " "*items*. Format units for sequences may be nested." msgstr "" +"オブジェクトは、長さが ``items`` 内の書式単位の数と等しい Python のシーケンス" +"でなければなりません (:class:`str`、:class:`bytes`、:class:`bytearray` は除き" +"ます)。\n" +"C の引数は ``items`` 内の各書式単位に対応している必要があります。\n" +"シーケンスの書式単位はネストできます。" -#: ../../c-api/arg.rst:376 msgid "" "If *items* contains format units which store a :ref:`borrowed buffer ` (``s``, ``s#``, ``z``, ``z#``, ``y``, or ``y#``) or a :" @@ -848,17 +891,25 @@ msgid "" "object must be a Python tuple. The *converter* for the ``O&`` format unit in " "*items* must not store a borrowed buffer or a borrowed reference." msgstr "" +"``items`` に :ref:`借用バッファ ` (``s``、``s#``、" +"``z``、``z#``、``y``、``y#``) または :term:`借用参照 ` " +"(``S``、``Y``、``U``、``O``、``O!``) を格納する書式単位が含まれる場合、オブ" +"ジェクトは Python のタプルでなければなりません。\n" +"``items`` 内の ``O&`` 書式単位の ``converter`` は、借用バッファや借用参照を格" +"納してはいけません。" -#: ../../c-api/arg.rst:383 msgid "" ":class:`str` and :class:`bytearray` objects no longer accepted as a sequence." msgstr "" +":class:`str` と :class:`bytearray` オブジェクトをシーケンスとして受け付けなく" +"なりました。" -#: ../../c-api/arg.rst:386 msgid "" "Non-tuple sequences are deprecated if *items* contains format units which " "store a borrowed buffer or a borrowed reference." msgstr "" +"``items`` に借用バッファまたは借用参照を格納する書式単位が含まれる場合、タプ" +"ル以外のシーケンスは非推奨になりました。" #: ../../c-api/arg.rst:390 msgid "``unit?`` (anything or ``None``) [*matching-variable(s)*]" @@ -948,6 +999,9 @@ msgid "" "*borrowed* references; do not release them (i.e. do not decrement their " "reference count)!" msgstr "" +"注意:呼び出し元に渡されるPythonオブジェクトの参照はすべて*借用*された参照で" +"す。これらを解放しないでください(つまり、参照カウントを減らさないでくださ" +"い)!" #: ../../c-api/arg.rst:434 msgid "" @@ -1001,7 +1055,6 @@ msgstr "" ":c:func:`PyArg_ParseTuple` と同じですが、可変長の引数ではなく *va_list* を引" "数にとります。" -#: ../../c-api/arg.rst:466 msgid "" "Parse the parameters of a function that takes both positional and keyword " "parameters into local variables. The *keywords* argument is a ``NULL``-" @@ -1010,13 +1063,21 @@ msgid "" "parameters `. Returns true on success; on " "failure, it returns false and raises the appropriate exception." msgstr "" +"位置引数とキーワード引数を受け取る関数の引数を解析し、ローカル変数に格納しま" +"す。\n" +"``keywords`` 引数は、ヌル終端の ASCII または UTF-8 エンコード C 文字列で指定" +"された仮引数名の配列で、``NULL`` で終端する必要があります。\n" +"空の名前は :ref:`位置専用仮引数 ` を表します。\n" +"成功した場合は真を返し、失敗した場合は適切な例外を送出して偽を返します。" -#: ../../c-api/arg.rst:477 msgid "" "The *keywords* parameter declaration is :c:expr:`char * const *` in C and :c:" "expr:`const char * const *` in C++. This can be overridden with the :c:macro:" "`PY_CXX_CONST` macro." msgstr "" +"``keywords`` 引数の宣言は、C では :c:expr:`char * const *`、C++ では :c:expr:" +"`const char * const *` です。\n" +":c:macro:`PY_CXX_CONST` マクロで変更できます。" #: ../../c-api/arg.rst:481 msgid "" @@ -1024,12 +1085,14 @@ msgid "" "only_parameter>`." msgstr ":ref:`位置専用引数 ` を追加した。" -#: ../../c-api/arg.rst:485 msgid "" "The *keywords* parameter has now type :c:expr:`char * const *` in C and :c:" "expr:`const char * const *` in C++, instead of :c:expr:`char **`. Added " "support for non-ASCII keyword parameter names." msgstr "" +"``keywords`` 引数の型は :c:expr:`char **` ではなく、C では :c:expr:`char * " +"const *`、C++ では :c:expr:`const char * const *` になりました。\n" +"非 ASCII のキーワード仮引数名をサポートするようになりました。" #: ../../c-api/arg.rst:494 msgid "" @@ -1049,18 +1112,18 @@ msgstr "" "は :c:func:`PyArg_ParseTupleAndKeywords` を使用しないときにのみ必要で、その理" "由は後者の関数は同様のチェックを実施するためです。" -#: ../../c-api/arg.rst:509 msgid "" "Parse the parameter of a function that takes a single positional parameter " "into a local variable. Returns true on success; on failure, it returns " "false and raises the appropriate exception." msgstr "" +"一つの位置引数を受け取る関数の引数を解析し、ローカル変数に格納します。\n" +"成功した場合は真を返し、失敗した場合は適切な例外を送出して偽を返します。" #: ../../c-api/arg.rst:513 msgid "Example::" msgstr "以下はプログラム例です::" -#: ../../c-api/arg.rst:515 msgid "" "// Function using METH_O calling convention\n" "static PyObject*\n" @@ -1073,8 +1136,17 @@ msgid "" " // ... use value ...\n" "}" msgstr "" +"// METH_O 呼び出し規約を使う関数\n" +"static PyObject*\n" +"my_function(PyObject *module, PyObject *arg)\n" +"{\n" +" int value;\n" +" if (!PyArg_Parse(arg, \"i:my_function\", &value)) {\n" +" return NULL;\n" +" }\n" +" // ... value を使う ...\n" +"}" -#: ../../c-api/arg.rst:529 msgid "" "A simpler form of parameter retrieval which does not use a format string to " "specify the types of the arguments. Functions which use this method to " @@ -1091,14 +1163,30 @@ msgid "" "a tuple or contains the wrong number of elements; an exception will be set " "if there was a failure." msgstr "" +"引数の型を指定する書式文字列を使わない、より単純な引数の取得方法です。\n" +"この方法で引数を取得する関数は、関数テーブルやメソッドテーブルで :c:macro:" +"`METH_VARARGS` として宣言してください。\n" +"引数を含むタプルを ``args`` として渡します。\n" +"これは必ずタプルでなければなりません。\n" +"タプルの長さは ``min`` 以上 ``max`` 以下で、``min`` と ``max`` は等しくても構" +"いません。\n" +"追加の引数は、それぞれ :c:expr:`PyObject*` 変数へのポインタとして渡す必要があ" +"ります。\n" +"これらの変数には ``args`` からの値が :term:`借用参照 ` と" +"して格納されます。\n" +"省略可能な引数が ``args`` にない場合、対応する変数は変更されないので、呼び出" +"し側で初期化しておいてください。\n" +"成功した場合は真を返します。\n" +"``args`` がタプルでないか、要素数が正しくない場合は、例外を設定して偽を返しま" +"す。" -#: ../../c-api/arg.rst:544 msgid "" "This is an example of the use of this function, taken from the sources for " "the :mod:`!_weakref` helper module for weak references::" msgstr "" +"弱参照用の補助モジュール :mod:`!_weakref` のソースから抜粋した、この関数の使" +"用例です。 ::" -#: ../../c-api/arg.rst:547 msgid "" "static PyObject *\n" "weakref_ref(PyObject *self, PyObject *args)\n" @@ -1113,6 +1201,18 @@ msgid "" " return result;\n" "}" msgstr "" +"static PyObject *\n" +"weakref_ref(PyObject *self, PyObject *args)\n" +"{\n" +" PyObject *object;\n" +" PyObject *callback = NULL;\n" +" PyObject *result = NULL;\n" +"\n" +" if (PyArg_UnpackTuple(args, \"ref\", 1, 2, &object, &callback)) {\n" +" result = PyWeakref_NewRef(object, callback);\n" +" }\n" +" return result;\n" +"}" #: ../../c-api/arg.rst:560 msgid "" @@ -1122,11 +1222,9 @@ msgstr "" "この例における :c:func:`PyArg_UnpackTuple` 呼び出しは、 :c:func:" "`PyArg_ParseTuple` を使った以下の呼び出しと全く等価です::" -#: ../../c-api/arg.rst:563 msgid "PyArg_ParseTuple(args, \"O|O:ref\", &object, &callback)" -msgstr "" +msgstr "PyArg_ParseTuple(args, \"O|O:ref\", &object, &callback)" -#: ../../c-api/arg.rst:567 msgid "" "The value to be inserted, if any, before :c:expr:`char * const *` in the " "*keywords* parameter declaration of :c:func:`PyArg_ParseTupleAndKeywords` " @@ -1134,6 +1232,13 @@ msgid "" "``const`` for C++ (:c:expr:`const char * const *`). To override, define it " "to the desired value before including :file:`Python.h`." msgstr "" +":c:func:`PyArg_ParseTupleAndKeywords` と :c:func:" +"`PyArg_VaParseTupleAndKeywords` の ``keywords`` 引数の宣言で、:c:expr:`char " +"* const *` の前に挿入する値を指定します。\n" +"デフォルトは C では空、C++ では ``const`` です (:c:expr:`const char * const " +"*`)。\n" +"変更するには :file:`Python.h` をインクルードする前に、必要な値を定義してくだ" +"さい。" #: ../../c-api/arg.rst:581 msgid "Building values" @@ -1220,6 +1325,7 @@ msgstr "" msgid "" "``s#`` (:class:`str` or ``None``) [const char \\*, :c:type:`Py_ssize_t`]" msgstr "" +"``s#`` (:class:`str` or ``None``) [const char \\*, :c:type:`Py_ssize_t`]" #: ../../c-api/arg.rst:617 msgid "" @@ -1245,7 +1351,7 @@ msgstr "" #: ../../c-api/arg.rst:625 msgid "``y#`` (:class:`bytes`) [const char \\*, :c:type:`Py_ssize_t`]" -msgstr "" +msgstr "``y#`` (:class:`bytes`) [const char \\*, :c:type:`Py_ssize_t`]" #: ../../c-api/arg.rst:626 msgid "" @@ -1385,13 +1491,11 @@ msgstr "" "文字を表す通常の C の :c:expr:`int` を、長さ 1 の Python の :class:`str` オブ" "ジェクトに変換します。" -#: ../../c-api/arg.rst:699 msgid "Convert a C :c:expr:`double` to a Python floating-point number." -msgstr "" +msgstr "C の :c:expr:`double` を Python の浮動小数点数に変換します。" -#: ../../c-api/arg.rst:702 msgid "Convert a C :c:expr:`float` to a Python floating-point number." -msgstr "" +msgstr "C の :c:expr:`float` を Python の浮動小数点数に変換します。" #: ../../c-api/arg.rst:704 msgid "``D`` (:class:`complex`) [Py_complex \\*]" @@ -1401,7 +1505,6 @@ msgstr "``D`` (:class:`complex`) [Py_complex \\*]" msgid "Convert a C :c:type:`Py_complex` structure to a Python complex number." msgstr "C の :c:type:`Py_complex` 構造体を Python の複素数型に変換します。" -#: ../../c-api/arg.rst:708 msgid "" "Pass a Python object untouched but create a new :term:`strong reference` to " "it (i.e. its reference count is incremented by one). If the object passed in " @@ -1410,6 +1513,13 @@ msgid "" "func:`Py_BuildValue` will return ``NULL`` but won't raise an exception. If " "no exception has been raised yet, :exc:`SystemError` is set." msgstr "" +"Python オブジェクトをそのまま渡し、そのオブジェクトへの新しい :term:`強参照 " +"` を作成します (つまり参照カウントを 1 増やします)。\n" +"渡されたオブジェクトが ``NULL`` ポインタなら、引数を生成した呼び出しがエラー" +"を検出して例外を設定したものとみなします。\n" +"この場合、:c:func:`Py_BuildValue` は ``NULL`` を返しますが、新しい例外は送出" +"しません。\n" +"まだ例外が設定されていなければ :exc:`SystemError` を設定します。" #: ../../c-api/arg.rst:717 msgid "``S`` (object) [PyObject \\*]" @@ -1429,6 +1539,9 @@ msgid "" "Useful when the object is created by a call to an object constructor in the " "argument list." msgstr "" +"同じです ``O``, ただし、新しい :term:`強参照 ` を作成しませ" +"ん。オブジェクトが引数リスト内のオブジェクトコンストラクターの呼び出しによっ" +"て作成される場合に便利です。" #: ../../c-api/arg.rst:725 msgid "``O&`` (object) [*converter*, *anything*]" @@ -1450,34 +1563,31 @@ msgstr "" msgid "``(items)`` (:class:`tuple`) [*matching-items*]" msgstr "``(items)`` (:class:`tuple`) [*matching-items*]" -#: ../../c-api/arg.rst:732 msgid "" "Convert a sequence of C values to a Python tuple with the same number of " "items." -msgstr "C の値からなる配列を、同じ要素数を持つ Python のタプルに変換します。" +msgstr "C の値の並びを、同じ要素数の Python のタプルに変換します。" #: ../../c-api/arg.rst:734 msgid "``[items]`` (:class:`list`) [*matching-items*]" msgstr "``[items]`` (:class:`list`) [*matching-items*]" -#: ../../c-api/arg.rst:735 msgid "" "Convert a sequence of C values to a Python list with the same number of " "items." -msgstr "C の値からなる配列を、同じ要素数を持つ Python のリストに変換します。" +msgstr "C の値の並びを、同じ要素数の Python のリストに変換します。" #: ../../c-api/arg.rst:737 msgid "``{items}`` (:class:`dict`) [*matching-items*]" msgstr "``{items}`` (:class:`dict`) [*matching-items*]" -#: ../../c-api/arg.rst:738 msgid "" "Convert a sequence of C values to a Python dictionary. Each pair of " "consecutive C values adds one item to the dictionary, serving as key and " "value, respectively." msgstr "" -"C の値からなる配列を Python の辞書に変換します。一連のペアからなる C の値が、" -"それぞれキーおよび値となって辞書に追加されます。" +"C の値の並びを Python の辞書に変換します。\n" +"連続する二つの C の値をそれぞれキーと値として、辞書に一つの要素を追加します。" #: ../../c-api/arg.rst:742 msgid "" diff --git a/c-api/bool.po b/c-api/bool.po index c9a7290fa..c02b2ef13 100644 --- a/c-api/bool.po +++ b/c-api/bool.po @@ -19,10 +19,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../c-api/bool.rst:6 diff --git a/c-api/buffer.po b/c-api/buffer.po index c8874d0c3..8b653007d 100644 --- a/c-api/buffer.po +++ b/c-api/buffer.po @@ -22,10 +22,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../c-api/buffer.rst:11 @@ -57,26 +57,33 @@ msgstr "" "ファからなるという共通の特徴を共有します。いくつかの状況では仲介するコピーを" "行うことなく直接バッファにアクセスすることが望まれます。" -#: ../../c-api/buffer.rst:29 msgid "" "Python provides such a facility at the C and Python level in the form of " "the :ref:`buffer protocol `. This protocol has two sides:" msgstr "" +"Python は :ref:`バッファプロトコル ` によって、C レベルと " +"Python レベルでこの機能を提供します。\n" +"このプロトコルには二つの側面があります。" -#: ../../c-api/buffer.rst:34 msgid "" "on the producer side, a type can export a \"buffer interface\" which allows " "objects of that type to expose information about their underlying buffer. " "This interface is described in the section :ref:`buffer-structs`; for Python " "see :ref:`python-buffer-protocol`." msgstr "" +"提供する側では、型は「バッファインターフェース」を公開し、その型のオブジェク" +"トが内部バッファの情報を公開できるようにします。\n" +"このインターフェースは :ref:`buffer-structs` で説明します。\n" +"Python 側については :ref:`python-buffer-protocol` を参照してください。" -#: ../../c-api/buffer.rst:39 msgid "" "on the consumer side, several means are available to obtain a pointer to the " "raw underlying data of an object (for example a method parameter). For " "Python see :class:`memoryview`." msgstr "" +"利用する側には、例えばメソッドの引数として受け取ったオブジェクトの内部の生" +"データへのポインタを取得する方法がいくつかあります。\n" +"Python 側については :class:`memoryview` を参照してください。" #: ../../c-api/buffer.rst:43 msgid "" @@ -140,11 +147,12 @@ msgstr "" "呼び出さなければなりません。これを怠ると、リソースリークのような様々な問題に" "つながる恐れがあります。" -#: ../../c-api/buffer.rst:69 msgid "" "The buffer protocol is now accessible in Python, see :ref:`python-buffer-" "protocol` and :class:`memoryview`." msgstr "" +"バッファプロトコルを Python から利用できるようになりました。\n" +":ref:`python-buffer-protocol` と :class:`memoryview` を参照してください。" #: ../../c-api/buffer.rst:75 msgid "Buffer structure" @@ -212,13 +220,16 @@ msgid "" msgstr "" ":term:`連続 ` 配列の場合この値はメモリブロックの先頭を指します。" -#: ../../c-api/buffer.rst:110 msgid "" "A new reference to the exporting object. The reference is owned by the " "consumer and automatically released (i.e. reference count decremented) and " "set to ``NULL`` by :c:func:`PyBuffer_Release`. The field is the equivalent " "of the return value of any standard C-API function." msgstr "" +"バッファを提供するオブジェクトへの新しい参照です。\n" +"この参照は利用側が所有し、:c:func:`PyBuffer_Release` によって自動的に解放 (参" +"照カウントを減少) され、``NULL`` に設定されます。\n" +"このフィールドは、通常の C API 関数の戻り値に相当します。" #: ../../c-api/buffer.rst:117 msgid "" @@ -272,17 +283,15 @@ msgstr "" ":func:`struct.calcsize` を非 ``NULL`` の :c:member:`~Py_buffer.format` 値に対" "して呼び出した結果と同じです。" -#: ../../c-api/buffer.rst:143 msgid "" "Important exception: If a consumer requests a buffer without the :c:macro:" "`PyBUF_FORMAT` flag, :c:member:`~Py_buffer.format` will be set to " "``NULL``, but :c:member:`~Py_buffer.itemsize` still has the value for the " "original format." msgstr "" -"重要な例外: 消費者が :c:macro:`PyBUF_FORMAT` フラグを設定することなくバッファ" -"を要求した場合、 :c:member:`~Py_Buffer.format` は ``NULL`` に設定されます。\n" -"しかし :c:member:`~Py_buffer.itemsize` は元のフォーマットに従った値を保持しま" -"す。" +"重要な例外: 利用側が :c:macro:`PyBUF_FORMAT` フラグなしでバッファを要求した場" +"合、:c:member:`~Py_buffer.format` は ``NULL`` に設定されますが、:c:member:" +"`~Py_buffer.itemsize` は元の形式に対応する値を保持します。" #: ../../c-api/buffer.rst:148 msgid "" @@ -305,18 +314,19 @@ msgstr "" "`~Py_buffer.itemsize` を無視して ``itemsize == 1`` と見なさなければなりませ" "ん。" -#: ../../c-api/buffer.rst:158 msgid "" "A *NULL* terminated string in :mod:`struct` module style syntax describing " "the contents of a single item. If this is ``NULL``, ``\"B\"`` (unsigned " "bytes) is assumed." msgstr "" +"単一の要素の内容を :mod:`struct` モジュール形式の構文で記述した、ヌル終端文字" +"列です。\n" +"``NULL`` の場合は ``\"B\"`` (符号なしバイト) とみなします。" #: ../../c-api/buffer.rst:162 msgid "This field is controlled by the :c:macro:`PyBUF_FORMAT` flag." msgstr "このフィールドは :c:macro:`PyBUF_FORMAT` フラグによって制御されます。" -#: ../../c-api/buffer.rst:166 msgid "" "The number of dimensions the memory represents as an n-dimensional array. If " "it is ``0``, :c:member:`~Py_buffer.buf` points to a single item representing " @@ -324,6 +334,12 @@ msgid "" "strides` and :c:member:`~Py_buffer.suboffsets` MUST be ``NULL``. The maximum " "number of dimensions is given by :c:macro:`PyBUF_MAX_NDIM`." msgstr "" +"メモリを n 次元配列として表すときの次元数です。\n" +"``0`` の場合、:c:member:`~Py_buffer.buf` はスカラを表す単一の要素を指しま" +"す。\n" +"この場合、:c:member:`~Py_buffer.shape`、:c:member:`~Py_buffer.strides`、:c:" +"member:`~Py_buffer.suboffsets` は ``NULL`` でなければなりません。\n" +"次元数の上限は :c:macro:`PyBUF_MAX_NDIM` で定義されています。" #: ../../c-api/buffer.rst:174 msgid "" @@ -346,9 +362,8 @@ msgstr "" "に注意が必要です。\n" "詳細は `complex arrays`_ を参照してください。" -#: ../../c-api/buffer.rst:183 msgid "The shape array is read-only for the consumer." -msgstr "shepe (形状) 配列は利用者からは読み出し専用です。" +msgstr "``shape`` 配列は利用側にとって読み取り専用です。" #: ../../c-api/buffer.rst:187 msgid "" @@ -358,15 +373,15 @@ msgstr "" "各次元において新しい値を得るためにスキップするバイト数を示す、長さ :c:member:" "`~Py_buffer.ndim` の :c:type:`Py_ssize_t` の配列。" -#: ../../c-api/buffer.rst:191 msgid "" "Stride values can be any integer. For regular arrays, strides are usually " "positive, but a consumer MUST be able to handle the case ``strides[n] <= " "0``. See `complex arrays`_ for further information." msgstr "" -"ストライド値は、任意の整数を指定できます。規定の配列では、ストライドは通常で" -"いけば有効です。しかし利用者は、``strides[n] <= 0`` のケースを処理することが" -"できる必要があります。詳細については `complex arrays`_ を参照してください。" +"ストライドの値は任意の整数です。\n" +"通常の配列ではストライドは一般に正ですが、利用側は ``strides[n] <= 0`` の場合" +"も扱えなければなりません。\n" +"詳細は `complex arrays`_ を参照してください。" #: ../../c-api/buffer.rst:195 msgid "The strides array is read-only for the consumer." @@ -423,16 +438,19 @@ msgstr "" "ことができるでしょう。バッファを受け取る側は、この値を決して変更してはなりま" "せん。" -#: ../../c-api/buffer.rst:224 msgid "Constants:" -msgstr "" +msgstr "定数。" -#: ../../c-api/buffer.rst:228 msgid "" "The maximum number of dimensions the memory represents. Exporters MUST " "respect this limit, consumers of multi-dimensional buffers SHOULD be able to " "handle up to :c:macro:`!PyBUF_MAX_NDIM` dimensions. Currently set to 64." msgstr "" +"メモリを表す次元数の上限です。\n" +"バッファの提供側はこの上限を守らなければなりません。\n" +"多次元バッファの利用側は :c:macro:`!PyBUF_MAX_NDIM` 次元まで扱えるべきで" +"す。\n" +"現在は 64 に設定されています。" #: ../../c-api/buffer.rst:237 msgid "Buffer request types" @@ -476,7 +494,6 @@ msgstr "" msgid "readonly, format" msgstr "readonly, format" -#: ../../c-api/buffer.rst:258 msgid "" "Controls the :c:member:`~Py_buffer.readonly` field. If set, the exporter " "MUST provide a writable buffer or else report failure. Otherwise, the " @@ -484,6 +501,13 @@ msgid "" "MUST be consistent for all consumers. For example, :c:expr:`PyBUF_SIMPLE | " "PyBUF_WRITABLE` can be used to request a simple writable buffer." msgstr "" +":c:member:`~Py_buffer.readonly` フィールドを制御します。\n" +"設定されている場合、提供側は書き込み可能なバッファを提供するか、失敗を報告し" +"なければなりません。\n" +"設定されていない場合は、読み取り専用でも書き込み可能でも構いませんが、すべて" +"の利用側に対して一貫した選択をする必要があります。\n" +"例えば :c:expr:`PyBUF_SIMPLE | PyBUF_WRITABLE` で、単純な書き込み可能バッファ" +"を要求できます。" #: ../../c-api/buffer.rst:266 msgid "" @@ -507,12 +531,15 @@ msgstr "" "`PyBUF_WRITABLE` は単純な書き込み可能なバッファを要求する単独のフラグとして使" "えます。" -#: ../../c-api/buffer.rst:274 msgid "" ":c:macro:`PyBUF_FORMAT` must be \\|'d to any of the flags except :c:macro:" "`PyBUF_SIMPLE`, because the latter already implies format ``B`` (unsigned " "bytes). :c:macro:`!PyBUF_FORMAT` cannot be used on its own." msgstr "" +":c:macro:`PyBUF_FORMAT` は、:c:macro:`PyBUF_SIMPLE` 以外のいずれかのフラグと" +"ビット OR で組み合わせる必要があります。\n" +"``PyBUF_SIMPLE`` はすでに形式 ``B`` (符号なしバイト) を意味するためです。\n" +":c:macro:`!PyBUF_FORMAT` を単独で使うことはできません。" #: ../../c-api/buffer.rst:280 msgid "shape, strides, suboffsets" @@ -578,15 +605,15 @@ msgstr "NULL" msgid "contiguity requests" msgstr "隣接性のリクエスト" -#: ../../c-api/buffer.rst:306 msgid "" "C or Fortran :term:`contiguity ` can be explicitly requested, " "with and without stride information. Without stride information, the buffer " "must be C-contiguous." msgstr "" -"ストライドの情報があってもなくても、C または Fortran の :term:`連続性 " -"` が明確に要求される可能性があります。\n" -"ストライド情報なしに、バッファーは C と隣接している必要があります。" +"C スタイルまたは Fortran スタイルの :term:`連続性 ` は、ストライ" +"ド情報の有無にかかわらず明示的に要求できます。\n" +"ストライド情報がない場合、バッファは C スタイルで連続していなければなりませ" +"ん。" #: ../../c-api/buffer.rst:313 ../../c-api/buffer.rst:338 msgid "contig" @@ -698,12 +725,14 @@ msgstr "" "そうでない場合は、利用者は次のように n 次元配列にアクセスしなければなりませ" "ん:" -#: ../../c-api/buffer.rst:375 msgid "" "ptr = (char *)buf + indices[0] * strides[0] + ... + indices[n-1] * " "strides[n-1];\n" "item = *((typeof(item) *)ptr);" msgstr "" +"ptr = (char *)buf + indices[0] * strides[0] + ... + indices[n-1] * " +"strides[n-1];\n" +"item = *((typeof(item) *)ptr);" #: ../../c-api/buffer.rst:381 msgid "" @@ -715,7 +744,6 @@ msgstr "" "すことが可能です。エクスポーターはこの関数を使用することによってバッファの妥" "当性を確認出来ます。" -#: ../../c-api/buffer.rst:385 msgid "" "def verify_structure(memlen, itemsize, ndim, shape, strides, offset):\n" " \"\"\"Verify that the parameters represent a valid array within\n" @@ -743,6 +771,31 @@ msgid "" "\n" " return 0 <= offset+imin and offset+imax+itemsize <= memlen" msgstr "" +"def verify_structure(memlen, itemsize, ndim, shape, strides, offset):\n" +" \"\"\"引数が、割り当てたメモリの範囲内の有効な配列を\n" +" 表しているかどうかを検証する:\n" +" char *mem: 物理メモリブロックの先頭\n" +" memlen: 物理メモリブロックの長さ\n" +" offset: (char *)buf - mem\n" +" \"\"\"\n" +" if offset % itemsize:\n" +" return False\n" +" if offset < 0 or offset+itemsize > memlen:\n" +" return False\n" +" if any(v % itemsize for v in strides):\n" +" return False\n" +"\n" +" if ndim <= 0:\n" +" return ndim == 0 and not shape and not strides\n" +" if 0 in shape:\n" +" return True\n" +"\n" +" imin = sum(strides[j]*(shape[j]-1) for j in range(ndim)\n" +" if strides[j] <= 0)\n" +" imax = sum(strides[j]*(shape[j]-1) for j in range(ndim)\n" +" if strides[j] > 0)\n" +"\n" +" return 0 <= offset+imin and offset+imax+itemsize <= memlen" #: ../../c-api/buffer.rst:415 msgid "PIL-style: shape, strides and suboffsets" @@ -775,7 +828,6 @@ msgstr "" "次の例は、 strides も suboffsets も ``NULL`` でない場合の、N 次元インデックス" "によって指されている N 次元配列内の要素へのポインタを返す関数です::" -#: ../../c-api/buffer.rst:430 msgid "" "void *get_item_pointer(int ndim, void *buf, Py_ssize_t *strides,\n" " Py_ssize_t *suboffsets, Py_ssize_t *indices) {\n" @@ -790,6 +842,18 @@ msgid "" " return (void*)pointer;\n" "}" msgstr "" +"void *get_item_pointer(int ndim, void *buf, Py_ssize_t *strides,\n" +" Py_ssize_t *suboffsets, Py_ssize_t *indices) {\n" +" char *pointer = (char*)buf;\n" +" int i;\n" +" for (i = 0; i < ndim; i++) {\n" +" pointer += strides[i] * indices[i];\n" +" if (suboffsets[i] >=0 ) {\n" +" pointer = *((char**)pointer) + suboffsets[i];\n" +" }\n" +" }\n" +" return (void*)pointer;\n" +"}" #: ../../c-api/buffer.rst:445 msgid "Buffer-related functions" @@ -818,18 +882,17 @@ msgstr "" "`BufferError` を送出し、 ``view->obj`` を ``NULL`` に設定した上で、 ``-1`` を" "返さなければなりません。" -#: ../../c-api/buffer.rst:461 msgid "" "On success, fill in *view*, set ``view->obj`` to a new reference to " "*exporter* and return 0. In the case of chained buffer providers that " "redirect requests to a single object, ``view->obj`` MAY refer to this object " "instead of *exporter* (See :ref:`Buffer Object Structures `)." msgstr "" -"成功したときは、 *view* を埋め、 ``view->obj`` に *exporter* への新しい参照を" -"設定し、0を返します。チェイン状のバッファプロバイダがリクエストを単一のオブ" -"ジェクトにリダイレクトするケースでは、 ``view->obj`` は *exporter* の代わりに" -"このオブジェクトを参照します (:ref:`バッファオブジェクト構造体 ` を参照してください)。" +"成功した場合は ``view`` に情報を設定し、``view->obj`` を ``exporter`` への新" +"しい参照にして 0 を返します。\n" +"複数のバッファ提供側が連鎖し、要求を一つのオブジェクトに転送する場合は、" +"``view->obj`` が ``exporter`` の代わりにそのオブジェクトを参照しても構いませ" +"ん (:ref:`バッファオブジェクト構造体 ` を参照)。" #: ../../c-api/buffer.rst:466 msgid "" @@ -844,13 +907,17 @@ msgstr "" "従って、バッファの利用が済んだら :c:func:`PyBuffer_Release` が厳密に1回だけ呼" "び出されなければなりません。" -#: ../../c-api/buffer.rst:474 msgid "" "Release the buffer *view* and release the :term:`strong reference` (i.e. " "decrement the reference count) to the view's supporting object, ``view-" ">obj``. This function MUST be called when the buffer is no longer being " "used, otherwise reference leaks may occur." msgstr "" +"バッファ ``view`` を解放し、ビューを支えるオブジェクト ``view->obj`` への :" +"term:`強参照 ` も解放します (つまり参照カウントを減らしま" +"す)。\n" +"バッファを使わなくなったときは必ず呼び出してください。\n" +"呼び出さないと参照がリークする可能性があります。" #: ../../c-api/buffer.rst:479 msgid "" @@ -860,11 +927,13 @@ msgstr "" ":c:func:`PyObject_GetBuffer` を通して取得していないバッファに対してこの関数を" "呼び出すのは間違いです。" -#: ../../c-api/buffer.rst:485 msgid "" "Return the implied :c:member:`~Py_buffer.itemsize` from :c:member:" "`~Py_buffer.format`. On error, raise an exception and return -1." msgstr "" +":c:member:`~Py_buffer.format` が表す :c:member:`~Py_buffer.itemsize` を返しま" +"す。\n" +"エラーの場合は例外を送出し、-1 を返します。" #: ../../c-api/buffer.rst:493 msgid "" @@ -898,40 +967,39 @@ msgstr "" "``'C'`` か ``'F'`` を指定できます(それぞれC言語スタイルとFortranスタイルの順" "序を表します)。成功時には ``0``、エラー時には ``-1`` を返します。" -#: ../../c-api/buffer.rst:513 msgid "" "Copy *len* bytes from *src* to its contiguous representation in *buf*. " "*order* can be ``'C'`` or ``'F'`` or ``'A'`` (for C-style or Fortran-style " "ordering or either one). ``0`` is returned on success, ``-1`` on error." msgstr "" -"*src* から *len* バイトを連続表現で *buf* 上にコピーします。\n" -"*order* は ``'C'`` または ``'F'`` または ``'A'`` (C スタイル順序または " -"Fortran スタイル順序またはそれ以外) が指定できます。\n" -"成功したら ``0`` が返り、エラーなら ``-1`` が返ります。" +"``src`` の ``len`` バイトを、``buf`` 内の連続した表現にコピーします。\n" +"``order`` は ``'C'``、``'F'``、``'A'`` のいずれかで、それぞれ C スタイル、" +"Fortran スタイル、どちらでもよいことを表します。\n" +"成功した場合は ``0`` を返し、エラーの場合は ``-1`` を返します。" #: ../../c-api/buffer.rst:517 msgid "This function fails if *len* != *src->len*." msgstr "*len* != *src->len* の場合、この関数は失敗します。" -#: ../../c-api/buffer.rst:522 msgid "" "Copy data from *src* to *dest* buffer. Can convert between C-style and or " "Fortran-style buffers." msgstr "" +"``src`` から ``dest`` バッファにデータをコピーします。\n" +"C スタイルと Fortran スタイルのバッファ間で変換できます。" #: ../../c-api/buffer.rst:525 msgid "``0`` is returned on success, ``-1`` on error." msgstr "成功したら ``0`` が、エラー時には ``-1`` が返されます。" -#: ../../c-api/buffer.rst:529 msgid "" "Fill the *strides* array with byte-strides of a :term:`contiguous` (C-style " "if *order* is ``'C'`` or Fortran-style if *order* is ``'F'``) array of the " "given shape with the given number of bytes per element." msgstr "" -"*strides* 配列を、 *itemsize* の大きさの要素がバイト単位の、 *shape* の形をし" -"た :term:`連続な ` (*order* が ``'C'`` なら C-style 、 ``'F'`` な" -"ら Fortran-style の) 多次元配列として埋める。" +"指定された形状と要素あたりのバイト数を持つ :term:`連続した ` 配列" +"の、バイト単位のストライドを ``strides`` 配列に設定します。\n" +"``order`` が ``'C'`` なら C スタイル、``'F'`` なら Fortran スタイルです。" #: ../../c-api/buffer.rst:536 msgid "" @@ -943,23 +1011,25 @@ msgstr "" "バッファリクエストを処理します。\n" "*buf* は符号無しバイトの列として解釈されます。" -#: ../../c-api/buffer.rst:540 msgid "" "The *flags* argument indicates the request type. This function always fills " "in *view* as specified by flags, unless *buf* has been designated as read-" "only and :c:macro:`PyBUF_WRITABLE` is set in *flags*." msgstr "" -"*flags* 引数はリクエストのタイプを示します。\n" -"この関数は、 *buf* が読み出し専用と指定されていて、 *flags* に :c:macro:" -"`PyBUF_WRITABLE` が設定されていない限り、常にフラグに指定された通りに *view* " -"を埋めます。" +"``flags`` 引数は要求の種類を示します。\n" +"``buf`` が読み取り専用なのに ``flags`` に :c:macro:`PyBUF_WRITABLE` が設定さ" +"れている場合を除き、この関数は常に ``flags`` の指定どおりに ``view`` に情報を" +"設定します。" -#: ../../c-api/buffer.rst:544 msgid "" "On success, set ``view->obj`` to a new reference to *exporter* and return 0. " "Otherwise, raise :exc:`BufferError`, set ``view->obj`` to ``NULL`` and " "return ``-1``;" msgstr "" +"成功した場合は ``view->obj`` を ``exporter`` への新しい参照に設定し、0 を返し" +"ます。\n" +"それ以外の場合は :exc:`BufferError` を送出し、``view->obj`` を ``NULL`` に設" +"定して ``-1`` を返します。" #: ../../c-api/buffer.rst:548 msgid "" @@ -976,30 +1046,24 @@ msgstr "" msgid "buffer protocol" msgstr "buffer protocol" -#: ../../c-api/buffer.rst:3 msgid "buffer interface" -msgstr "" +msgstr "バッファインターフェース" -#: ../../c-api/buffer.rst:3 msgid "(see buffer protocol)" -msgstr "" +msgstr "(バッファプロトコルを参照)" -#: ../../c-api/buffer.rst:3 msgid "buffer object" -msgstr "" +msgstr "バッファオブジェクト" -#: ../../c-api/buffer.rst:32 msgid "PyBufferProcs (C type)" -msgstr "" +msgstr "PyBufferProcs (C の型)" #: ../../c-api/buffer.rst:301 msgid "contiguous" msgstr "contiguous" -#: ../../c-api/buffer.rst:301 msgid "C-contiguous" -msgstr "" +msgstr "C-contiguous" -#: ../../c-api/buffer.rst:301 msgid "Fortran contiguous" -msgstr "" +msgstr "Fortran contiguous" diff --git a/c-api/bytearray.po b/c-api/bytearray.po index 42de00ecc..b090d1b8b 100644 --- a/c-api/bytearray.po +++ b/c-api/bytearray.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: tomo, 2023\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../c-api/bytearray.rst:6 @@ -75,14 +75,12 @@ msgstr "" ":ref:`buffer protocol ` を実装した任意のオブジェクト *o* か" "ら、新しいbytearrayオブジェクトを作成し、返します。" -#: ../../c-api/bytearray.rst:45 ../../c-api/bytearray.rst:52 -#: ../../c-api/bytearray.rst:59 msgid "On failure, return ``NULL`` with an exception set." -msgstr "" +msgstr "失敗すると例外を設定して ``NULL`` を返します。" -#: ../../c-api/bytearray.rst:50 msgid "Create a new bytearray object from *string* and its length, *len*." msgstr "" +"``string`` とその長さ ``len`` から新しい bytearray オブジェクトを作成します。" #: ../../c-api/bytearray.rst:57 msgid "" @@ -102,16 +100,16 @@ msgstr "" "す。\n" "返される配列には、常に余分な null バイトが追加されます。" -#: ../../c-api/bytearray.rst:76 msgid "" "Resize the internal buffer of *bytearray* to *len*. Failure is a ``-1`` " "return with an exception set." msgstr "" +"``bytearray`` の内部バッファのサイズを ``len`` に変更します。\n" +"失敗した場合は、例外を設定して ``-1`` を返します。" -#: ../../c-api/bytearray.rst:79 msgid "" "A negative *len* will now result in an exception being set and -1 returned." -msgstr "" +msgstr "``len`` が負の場合は、例外を設定して -1 を返すようになりました。" #: ../../c-api/bytearray.rst:84 msgid "Macros" diff --git a/c-api/bytes.po b/c-api/bytes.po index b0c0a4656..2410a701b 100644 --- a/c-api/bytes.po +++ b/c-api/bytes.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: Taichi Haradaguchi, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../c-api/bytes.rst:6 @@ -289,7 +289,6 @@ msgstr "バイトオブジェクト *o* のバイト単位の長さを返しま msgid "Similar to :c:func:`PyBytes_Size`, but without error checking." msgstr ":c:func:`PyBytes_Size` に似ていますが、エラーチェックを行いません。" -#: ../../c-api/bytes.rst:139 msgid "" "Return a pointer to the contents of *o*. The pointer refers to the internal " "buffer of *o*, which consists of ``len(o) + 1`` bytes. The last byte in the " @@ -299,38 +298,39 @@ msgid "" "deallocated. If *o* is not a bytes object at all, :c:func:" "`PyBytes_AsString` returns ``NULL`` and raises :exc:`TypeError`." msgstr "" -"*o* の中身へのポインタを返します。\n" -"ポインタは、 ``len(o) + 1`` バイトからなる *o* の内部バッファを参照します。\n" -"他に null のバイトがあるかどうかにかかわらず、バッファの最後のバイトは必ず " -"null になります。\n" -"``PyBytes_FromStringAndSize(NULL, size)`` で生成された場合を除いて、データを" -"修正してはなりません。\n" -"またポインタを解放(deallocated)してはなりません。\n" -"もし、 *o* が bytes オブジェクトでなければ、 :c:func:`PyBytes_AsString` は " -"``NULL`` を返し :exc:`TypeError` を送出します。" +"*o* の内容へのポインタを返します。\n" +"このポインタは ``len(o) + 1`` バイトからなる *o* の内部バッファを参照しま" +"す。\n" +"内部に他の null バイトがあるかどうかにかかわらず、バッファの最後のバイトは常" +"に null です。\n" +"``PyBytes_FromStringAndSize(NULL, size)`` で作成したばかりのオブジェクトでな" +"い限り、データを変更してはいけません。\n" +"このバッファを解放してはいけません。\n" +"*o* が bytes オブジェクトでなければ、:c:func:`PyBytes_AsString` は ``NULL`` " +"を返し、:exc:`TypeError` を送出します。" #: ../../c-api/bytes.rst:151 msgid "Similar to :c:func:`PyBytes_AsString`, but without error checking." msgstr "" ":c:func:`PyBytes_AsString` に似ていますが、エラーチェックを行いません。" -#: ../../c-api/bytes.rst:156 msgid "" "Return the null-terminated contents of the object *obj* through the output " "variables *buffer* and *length*. Returns ``0`` on success." msgstr "" +"出力変数 *buffer* と *length* を通じて、オブジェクト *obj* の null 終端された" +"内容を返します。\n" +"成功すると ``0`` を返します。" -#: ../../c-api/bytes.rst:160 msgid "" "If *length* is ``NULL``, the bytes object may not contain embedded null " "bytes; if it does, the function returns ``-1`` and a :exc:`ValueError` is " "raised." msgstr "" -"*length* の値が ``NULL`` の場合、バイトオブジェクトが null バイトを含まない" -"可能性があります。その場合、関数は ``-1`` を返し、 :exc:`ValueError` を送出し" -"ます。" +"*length* が ``NULL`` の場合、bytes オブジェクトの内部に null バイトが含まれて" +"いてはいけません。\n" +"含まれている場合は ``-1`` を返し、:exc:`ValueError` を送出します。" -#: ../../c-api/bytes.rst:164 msgid "" "The buffer refers to an internal buffer of *obj*, which includes an " "additional null byte at the end (not counted in *length*). The data must " @@ -339,13 +339,14 @@ msgid "" "*obj* is not a bytes object at all, :c:func:`PyBytes_AsStringAndSize` " "returns ``-1`` and raises :exc:`TypeError`." msgstr "" -"buffer は *obj* の内部バッファを参照していて、これには末尾の null バイトも含" -"んでいます (これは *length* には数えられません)。\n" -"オブジェクトが ``PyBytes_FromStringAndSize(NULL, size)`` で生成された場合を除" -"いて、何があってもデータを改変してはいけません。\n" -"オブジェクトを解放 (deallocate) してもいけません。\n" -"*obj* が bytes オブジェクトでなかった場合は、 :c:func:" -"`PyBytes_AsStringAndSize` は ``-1`` を返し :exc:`TypeError` を送出します。" +"``buffer`` は *obj* の内部バッファを参照します。\n" +"このバッファには末尾に追加の null バイトが含まれます (*length* には数えませ" +"ん)。\n" +"``PyBytes_FromStringAndSize(NULL, size)`` で作成したばかりのオブジェクトでな" +"い限り、データを変更してはいけません。\n" +"このバッファを解放してはいけません。\n" +"*obj* が bytes オブジェクトでなければ、:c:func:`PyBytes_AsStringAndSize` は " +"``-1`` を返し、:exc:`TypeError` を送出します。" #: ../../c-api/bytes.rst:171 msgid "" @@ -369,37 +370,43 @@ msgstr "" "もし新しいオブジェクトが生成できない場合、古い *bytes* の参照は放棄され、 " "*\\*bytes* の値は ``NULL`` に設定されます; 適切な例外が設定されます。" -#: ../../c-api/bytes.rst:187 msgid "" "Create a new bytes object in *\\*bytes* containing the contents of *newpart* " "appended to *bytes*. This version releases the :term:`strong reference` to " "*newpart* (i.e. decrements its reference count)." msgstr "" +"*bytes* の内容に *newpart* の内容を追加した新しい bytes オブジェクトを " +"*\\*bytes* に作成します。\n" +"この関数は *newpart* への :term:`強参照 ` を解放します (つ" +"まり参照カウントを減らします)。" -#: ../../c-api/bytes.rst:194 msgid "Similar to ``sep.join(iterable)`` in Python." -msgstr "" +msgstr "Python の ``sep.join(iterable)`` と同様です。" -#: ../../c-api/bytes.rst:196 msgid "" "*sep* must be Python :class:`bytes` object. (Note that :c:func:" "`PyUnicode_Join` accepts ``NULL`` separator and treats it as a space, " "whereas :c:func:`PyBytes_Join` doesn't accept ``NULL`` separator.)" msgstr "" +"*sep* は Python の :class:`bytes` オブジェクトでなければなりません。\n" +"(:c:func:`PyUnicode_Join` は区切り文字として ``NULL`` を受け取り、空白として" +"扱いますが、:c:func:`PyBytes_Join` は区切り文字に ``NULL`` を受け付けませ" +"ん。)" -#: ../../c-api/bytes.rst:201 msgid "" "*iterable* must be an iterable object yielding objects that implement the :" "ref:`buffer protocol `." msgstr "" +"*iterable* は :ref:`バッファプロトコル ` を実装するオブジェク" +"トを生成するイテラブルオブジェクトでなければなりません。" -#: ../../c-api/bytes.rst:204 msgid "" "On success, return a new :class:`bytes` object. On error, set an exception " "and return ``NULL``." msgstr "" +"成功すると新しい :class:`bytes` オブジェクトを返します。\n" +"エラー時には例外を設定して ``NULL`` を返します。" -#: ../../c-api/bytes.rst:212 msgid "" "Resize a bytes object. *newsize* will be the new length of the bytes object. " "You can think of it as creating a new bytes object and destroying the old " @@ -410,6 +417,18 @@ msgid "" "the original bytes object at *\\*bytes* is deallocated, *\\*bytes* is set to " "``NULL``, :exc:`MemoryError` is set, and ``-1`` is returned." msgstr "" +"bytes オブジェクトのサイズを変更します。\n" +"*newsize* が bytes オブジェクトの新しい長さになります。\n" +"新しい bytes オブジェクトを作成して古いものを破棄する操作を、より効率よく行う" +"ものと考えることができます。\n" +"既存の bytes オブジェクトのアドレスを左辺値 (書き込みが行われる可能性がありま" +"す) として渡し、希望する新しいサイズを指定します。\n" +"成功すると *\\*bytes* はサイズ変更後の bytes オブジェクトを保持し、``0`` を返" +"します。\n" +"*\\*bytes* のアドレスは入力時の値と異なる場合があります。\n" +"再割り当てに失敗すると、*\\*bytes* の元の bytes オブジェクトを解放し、" +"*\\*bytes* に ``NULL`` を設定し、:exc:`MemoryError` を設定して ``-1`` を返し" +"ます。" #: ../../c-api/bytes.rst:11 msgid "object" diff --git a/c-api/call.po b/c-api/call.po index 327957d7e..4cc9d6297 100644 --- a/c-api/call.po +++ b/c-api/call.po @@ -21,67 +21,74 @@ msgstr "" "Last-Translator: Taichi Haradaguchi, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../c-api/call.rst:6 msgid "Call Protocol" msgstr "Call プロトコル" -#: ../../c-api/call.rst:8 msgid "" "CPython supports two different calling protocols: *tp_call* and vectorcall." msgstr "" +"CPython は *tp_call* と vectorcall の二つの呼び出しプロトコルをサポートしてい" +"ます。" -#: ../../c-api/call.rst:12 msgid "The *tp_call* Protocol" -msgstr "" +msgstr "*tp_call* プロトコル" -#: ../../c-api/call.rst:14 msgid "" "Instances of classes that set :c:member:`~PyTypeObject.tp_call` are " "callable. The signature of the slot is::" msgstr "" +":c:member:`~PyTypeObject.tp_call` を設定したクラスのインスタンスは呼び出し可" +"能です。\n" +"このスロットのシグネチャは次のとおりです。 ::" -#: ../../c-api/call.rst:17 msgid "" "PyObject *tp_call(PyObject *callable, PyObject *args, PyObject *kwargs);" msgstr "" +"PyObject *tp_call(PyObject *callable, PyObject *args, PyObject *kwargs);" -#: ../../c-api/call.rst:19 msgid "" "A call is made using a tuple for the positional arguments and a dict for the " "keyword arguments, similarly to ``callable(*args, **kwargs)`` in Python " "code. *args* must be non-NULL (use an empty tuple if there are no arguments) " "but *kwargs* may be *NULL* if there are no keyword arguments." msgstr "" +"Python コードの ``callable(*args, **kwargs)`` と同様に、位置引数のタプルと" +"キーワード引数の辞書を使って呼び出します。\n" +"``args`` は NULL であってはいけません (引数がなければ空のタプルを使いま" +"す)。\n" +"ただし、キーワード引数がなければ ``kwargs`` は ``NULL`` で構いません。" -#: ../../c-api/call.rst:25 msgid "" "This convention is not only used by *tp_call*: :c:member:`~PyTypeObject." "tp_new` and :c:member:`~PyTypeObject.tp_init` also pass arguments this way." msgstr "" +"この規約は *tp_call* だけでなく、:c:member:`~PyTypeObject.tp_new` と :c:" +"member:`~PyTypeObject.tp_init` で引数を渡すときにも使います。" -#: ../../c-api/call.rst:29 msgid "" "To call an object, use :c:func:`PyObject_Call` or another :ref:`call API " "`." msgstr "" +"オブジェクトを呼び出すには :c:func:`PyObject_Call` または別の :ref:`呼び出し " +"API ` を使ってください。" -#: ../../c-api/call.rst:36 msgid "The Vectorcall Protocol" -msgstr "" +msgstr "vectorcall プロトコル" -#: ../../c-api/call.rst:40 msgid "" "The vectorcall protocol was introduced in :pep:`590` as an additional " "protocol for making calls more efficient." msgstr "" +"vectorcall プロトコルは、呼び出しを効率化するための追加のプロトコルとして :" +"pep:`590` で導入されました。" -#: ../../c-api/call.rst:43 msgid "" "As rule of thumb, CPython will prefer the vectorcall for internal calls if " "the callable supports it. However, this is not a hard rule. Additionally, " @@ -92,14 +99,25 @@ msgid "" "achieve this is by setting :c:member:`~PyTypeObject.tp_call` to :c:func:" "`PyVectorcall_Call`. This bears repeating:" msgstr "" +"目安として、呼び出し可能オブジェクトが vectorcall をサポートしていれば、" +"CPython は内部の呼び出しでそれを優先します。\n" +"ただし、厳密な規則ではありません。\n" +"また、サードパーティの拡張の中には :c:func:`PyObject_Call` を使わずに " +"*tp_call* を直接使うものもあります。\n" +"そのため、vectorcall をサポートするクラスは :c:member:`~PyTypeObject." +"tp_call` も実装する必要があります。\n" +"さらに、どちらのプロトコルでも同じ動作をしなければなりません。\n" +"これを実現するために推奨される方法は、:c:member:`~PyTypeObject.tp_call` を :" +"c:func:`PyVectorcall_Call` に設定することです。\n" +"繰り返しますが、次の点が重要です。" -#: ../../c-api/call.rst:57 msgid "" "A class supporting vectorcall **must** also implement :c:member:" "`~PyTypeObject.tp_call` with the same semantics." msgstr "" +"vectorcall をサポートするクラスは、同じ意味を持つ :c:member:`~PyTypeObject." +"tp_call` も **必ず** 実装しなければなりません。" -#: ../../c-api/call.rst:62 msgid "" "The :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` flag is now removed from a class " "when the class's :py:meth:`~object.__call__` method is reassigned. (This " @@ -108,16 +126,24 @@ msgid "" "versions, vectorcall should only be used with :c:macro:`immutable " "` or static types." msgstr "" +"クラスの :py:meth:`~object.__call__` メソッドが再代入されると、そのクラスか" +"ら :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` フラグを取り除くようになりました。\n" +"(この再代入は内部で :c:member:`~PyTypeObject.tp_call` だけを設定するため、" +"vectorcall 関数と動作が異なる可能性があります。)\n" +"以前の Python では、vectorcall は :c:macro:`不変な型 " +"` または静的な型でのみ使うべきです。" -#: ../../c-api/call.rst:69 msgid "" "A class should not implement vectorcall if that would be slower than " "*tp_call*. For example, if the callee needs to convert the arguments to an " "args tuple and kwargs dict anyway, then there is no point in implementing " "vectorcall." msgstr "" +"*tp_call* より遅くなる場合、クラスは vectorcall を実装すべきではありませ" +"ん。\n" +"例えば、呼び出される側が結局引数を args タプルと kwargs 辞書に変換する必要が" +"あるなら、vectorcall を実装する意味はありません。" -#: ../../c-api/call.rst:74 msgid "" "Classes can implement the vectorcall protocol by enabling the :c:macro:" "`Py_TPFLAGS_HAVE_VECTORCALL` flag and setting :c:member:`~PyTypeObject." @@ -125,10 +151,14 @@ msgid "" "*vectorcallfunc* appears. This is a pointer to a function with the following " "signature:" msgstr "" +"クラスは :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` フラグを有効にし、:c:member:" +"`~PyTypeObject.tp_vectorcall_offset` をオブジェクト構造体内の " +"*vectorcallfunc* の位置のオフセットに設定することで、vectorcall プロトコルを" +"実装できます。\n" +"これは次のシグネチャを持つ関数へのポインタです。" -#: ../../c-api/call.rst:82 msgid "*callable* is the object being called." -msgstr "" +msgstr "``callable`` は呼び出されるオブジェクトです。" #: ../../c-api/call.rst:83 msgid "" @@ -151,129 +181,157 @@ msgid "" "positional arguments from *nargsf*, use :c:func:`PyVectorcall_NARGS`." msgstr "" -#: ../../c-api/call.rst:90 msgid "*kwnames* is a tuple containing the names of the keyword arguments;" -msgstr "" +msgstr "``kwnames`` はキーワード引数の名前を含むタプルです。" -#: ../../c-api/call.rst:91 msgid "" "in other words, the keys of the kwargs dict. These names must be strings " "(instances of ``str`` or a subclass) and they must be unique. If there are " "no keyword arguments, then *kwnames* can instead be *NULL*." msgstr "" +"言い換えると、kwargs 辞書のキーです。\n" +"名前は文字列 (``str`` またはそのサブクラスのインスタンス) で、重複してはいけ" +"ません。\n" +"キーワード引数がない場合、``kwnames`` は ``NULL`` でも構いません。" -#: ../../c-api/call.rst:98 msgid "" "If this flag is set in a vectorcall *nargsf* argument, the callee is allowed " "to temporarily change ``args[-1]``. In other words, *args* points to " "argument 1 (not 0) in the allocated vector. The callee must restore the " "value of ``args[-1]`` before returning." msgstr "" +"vectorcall の ``nargsf`` 引数にこのフラグが設定されている場合、呼び出される側" +"は一時的に ``args[-1]`` を変更できます。\n" +"つまり、``args`` は割り当てられたベクトル内の引数 0 ではなく引数 1 を指しま" +"す。\n" +"呼び出される側は、戻る前に ``args[-1]`` の値を元に戻す必要があります。" -#: ../../c-api/call.rst:103 msgid "" "For :c:func:`PyObject_VectorcallMethod`, this flag means instead that " "``args[0]`` may be changed." msgstr "" +":c:func:`PyObject_VectorcallMethod` の場合、このフラグは代わりに ``args[0]`` " +"を変更してよいことを意味します。" -#: ../../c-api/call.rst:106 msgid "" "Whenever they can do so cheaply (without additional allocation), callers are " "encouraged to use :c:macro:`PY_VECTORCALL_ARGUMENTS_OFFSET`. Doing so will " "allow callables such as bound methods to make their onward calls (which " "include a prepended *self* argument) very efficiently." msgstr "" +"追加の割り当てなしに低コストで設定できる場合、呼び出し側は :c:macro:" +"`PY_VECTORCALL_ARGUMENTS_OFFSET` を使うことが推奨されます。\n" +"これにより、束縛メソッドなどの呼び出し可能オブジェクトは、先頭に ``self`` 引" +"数を追加して次の呼び出しを行う処理を非常に効率的に実行できます。" -#: ../../c-api/call.rst:113 msgid "" "To call an object that implements vectorcall, use a :ref:`call API ` function as with any other callable. :c:func:`PyObject_Vectorcall` " "will usually be most efficient." msgstr "" +"vectorcall を実装するオブジェクトを呼び出すには、ほかの呼び出し可能オブジェク" +"トと同様に :ref:`呼び出し API ` の関数を使ってください。\n" +"通常は :c:func:`PyObject_Vectorcall` が最も効率的です。" #: ../../c-api/call.rst:119 msgid "Recursion Control" msgstr "再帰の管理" -#: ../../c-api/call.rst:121 msgid "" "When using *tp_call*, callees do not need to worry about :ref:`recursion " "`: CPython uses :c:func:`Py_EnterRecursiveCall` and :c:func:" "`Py_LeaveRecursiveCall` for calls made using *tp_call*." msgstr "" +"*tp_call* を使う場合、呼び出される側は :ref:`再帰 ` を管理する必要" +"はありません。\n" +"CPython は *tp_call* による呼び出しで :c:func:`Py_EnterRecursiveCall` と :c:" +"func:`Py_LeaveRecursiveCall` を使います。" -#: ../../c-api/call.rst:126 msgid "" "For efficiency, this is not the case for calls done using vectorcall: the " "callee should use *Py_EnterRecursiveCall* and *Py_LeaveRecursiveCall* if " "needed." msgstr "" +"効率のため、vectorcall による呼び出しではこの管理を行いません。\n" +"必要に応じて、呼び出される側が ``Py_EnterRecursiveCall()`` と " +"``Py_LeaveRecursiveCall()`` を使ってください。" -#: ../../c-api/call.rst:132 msgid "Vectorcall Support API" -msgstr "" +msgstr "vectorcall サポート API" -#: ../../c-api/call.rst:136 msgid "" "Given a vectorcall *nargsf* argument, return the actual number of arguments. " "Currently equivalent to::" msgstr "" +"vectorcall の ``nargsf`` 引数から、実際の引数の数を返します。\n" +"現在は次と同等です。 ::" -#: ../../c-api/call.rst:140 msgid "(Py_ssize_t)(nargsf & ~PY_VECTORCALL_ARGUMENTS_OFFSET)" -msgstr "" +msgstr "(Py_ssize_t)(nargsf & ~PY_VECTORCALL_ARGUMENTS_OFFSET)" -#: ../../c-api/call.rst:142 msgid "" "However, the function ``PyVectorcall_NARGS`` should be used to allow for " "future extensions." msgstr "" +"ただし、将来の拡張に対応するため、関数 ``PyVectorcall_NARGS`` を使ってくださ" +"い。" -#: ../../c-api/call.rst:149 msgid "" "If *op* does not support the vectorcall protocol (either because the type " "does not or because the specific instance does not), return *NULL*. " "Otherwise, return the vectorcall function pointer stored in *op*. This " "function never raises an exception." msgstr "" +"``op`` が vectorcall プロトコルをサポートしていなければ (型がサポートしていな" +"い場合も、そのインスタンスがサポートしていない場合も) ``NULL`` を返します。\n" +"それ以外の場合は、``op`` に格納された vectorcall 関数ポインタを返します。\n" +"この関数が例外を送出することはありません。" -#: ../../c-api/call.rst:154 msgid "" "This is mostly useful to check whether or not *op* supports vectorcall, " "which can be done by checking ``PyVectorcall_Function(op) != NULL``." msgstr "" +"主に、``op`` が vectorcall をサポートするかどうかを確認するのに便利です。\n" +"``PyVectorcall_Function(op) != NULL`` で確認できます。" -#: ../../c-api/call.rst:161 msgid "" "Call *callable*'s :c:type:`vectorcallfunc` with positional and keyword " "arguments given in a tuple and dict, respectively." msgstr "" +"それぞれタプルと辞書で与えられた位置引数とキーワード引数を使い、``callable`` " +"の :c:type:`vectorcallfunc` を呼び出します。" -#: ../../c-api/call.rst:164 msgid "" "This is a specialized function, intended to be put in the :c:member:" "`~PyTypeObject.tp_call` slot or be used in an implementation of ``tp_call``. " "It does not check the :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` flag and it does " "not fall back to ``tp_call``." msgstr "" +"この特殊用途の関数は、:c:member:`~PyTypeObject.tp_call` スロットに設定する" +"か、``tp_call`` の実装内で使うためのものです。\n" +":c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` フラグを確認せず、``tp_call`` への" +"フォールバックも行いません。" -#: ../../c-api/call.rst:175 msgid "Object Calling API" -msgstr "" +msgstr "オブジェクト呼び出し API" -#: ../../c-api/call.rst:177 msgid "" "Various functions are available for calling a Python object. Each converts " "its arguments to a convention supported by the called object – either " "*tp_call* or vectorcall. In order to do as little conversion as possible, " "pick one that best fits the format of data you have available." msgstr "" +"Python オブジェクトを呼び出すためのさまざまな関数があります。\n" +"各関数は、呼び出すオブジェクトがサポートする *tp_call* または vectorcall の規" +"約に引数を変換します。\n" +"変換を最小限にするため、手元のデータの形式に最も合う関数を選んでください。" -#: ../../c-api/call.rst:183 msgid "" "The following table summarizes the available functions; please see " "individual documentation for details." msgstr "" +"利用できる関数を以下の表にまとめます。\n" +"詳細は個別の説明を参照してください。" #: ../../c-api/call.rst:187 msgid "Function" @@ -305,9 +363,8 @@ msgstr "``PyObject *``" msgid "tuple" msgstr "tuple" -#: ../../c-api/call.rst:189 ../../c-api/call.rst:211 msgid "dict/``NULL``" -msgstr "" +msgstr "dict/``NULL``" #: ../../c-api/call.rst:191 msgid ":c:func:`PyObject_CallNoArgs`" @@ -323,17 +380,15 @@ msgstr "---" msgid ":c:func:`PyObject_CallOneArg`" msgstr ":c:func:`PyObject_CallOneArg`" -#: ../../c-api/call.rst:193 ../../c-api/call.rst:207 msgid "1 object" -msgstr "" +msgstr "1 個のオブジェクト" #: ../../c-api/call.rst:195 msgid ":c:func:`PyObject_CallObject`" msgstr ":c:func:`PyObject_CallObject`" -#: ../../c-api/call.rst:195 msgid "tuple/``NULL``" -msgstr "" +msgstr "tuple/``NULL``" #: ../../c-api/call.rst:197 msgid ":c:func:`PyObject_CallFunction`" @@ -347,25 +402,22 @@ msgstr "format" msgid ":c:func:`PyObject_CallMethod`" msgstr ":c:func:`PyObject_CallMethod`" -#: ../../c-api/call.rst:199 msgid "obj + ``char*``" -msgstr "" +msgstr "obj + ``char*``" #: ../../c-api/call.rst:201 msgid ":c:func:`PyObject_CallFunctionObjArgs`" msgstr ":c:func:`PyObject_CallFunctionObjArgs`" -#: ../../c-api/call.rst:201 ../../c-api/call.rst:203 msgid "variadic" -msgstr "" +msgstr "可変長引数" #: ../../c-api/call.rst:203 msgid ":c:func:`PyObject_CallMethodObjArgs`" msgstr ":c:func:`PyObject_CallMethodObjArgs`" -#: ../../c-api/call.rst:203 ../../c-api/call.rst:205 ../../c-api/call.rst:207 msgid "obj + name" -msgstr "" +msgstr "obj + 名前" #: ../../c-api/call.rst:205 msgid ":c:func:`PyObject_CallMethodNoArgs`" @@ -379,9 +431,8 @@ msgstr ":c:func:`PyObject_CallMethodOneArg`" msgid ":c:func:`PyObject_Vectorcall`" msgstr ":c:func:`PyObject_Vectorcall`" -#: ../../c-api/call.rst:209 ../../c-api/call.rst:211 ../../c-api/call.rst:213 msgid "vectorcall" -msgstr "" +msgstr "vectorcall" #: ../../c-api/call.rst:211 msgid ":c:func:`PyObject_VectorcallDict`" @@ -391,9 +442,8 @@ msgstr ":c:func:`PyObject_VectorcallDict`" msgid ":c:func:`PyObject_VectorcallMethod`" msgstr ":c:func:`PyObject_VectorcallMethod`" -#: ../../c-api/call.rst:213 msgid "arg + name" -msgstr "" +msgstr "arg + 名前" #: ../../c-api/call.rst:219 msgid "" @@ -403,14 +453,13 @@ msgstr "" "呼び出し可能な Python のオブジェクト *callable* を、タプル *args* として与え" "られる引数と辞書 *kwargs* として与えられる名前付き引数とともに呼び出します。" -#: ../../c-api/call.rst:222 msgid "" "*args* must not be *NULL*; use an empty tuple if no arguments are needed. If " "no named arguments are needed, *kwargs* can be *NULL*." msgstr "" -"*args* は *NULL* であってはならず、引数を必要としない場合は空のタプルを使って" -"ください。\n" -"*kwargs* は *NULL* でも構いません。" +"``args`` は ``NULL`` であってはいけません。\n" +"引数が不要な場合は空のタプルを使ってください。\n" +"キーワード引数が不要な場合は ``kwargs`` を ``NULL`` にできます。" #: ../../c-api/call.rst:225 ../../c-api/call.rst:237 ../../c-api/call.rst:248 #: ../../c-api/call.rst:259 ../../c-api/call.rst:271 ../../c-api/call.rst:291 @@ -428,26 +477,27 @@ msgid "" "**kwargs)``." msgstr "これは次の Python の式と同等です: ``callable(*args, **kwargs)`` 。" -#: ../../c-api/call.rst:234 msgid "" "Call a callable Python object *callable* without any arguments. It is the " "most efficient way to call a callable Python object without any argument." msgstr "" +"呼び出し可能な Python オブジェクト ``callable`` を引数なしで呼び出します。\n" +"引数なしで呼び出すには最も効率的な方法です。" -#: ../../c-api/call.rst:245 msgid "" "Call a callable Python object *callable* with exactly 1 positional argument " "*arg* and no keyword arguments." msgstr "" +"呼び出し可能な Python オブジェクト ``callable`` を、位置引数 ``arg`` だけを渡" +"し、キーワード引数なしで呼び出します。" -#: ../../c-api/call.rst:256 msgid "" "Call a callable Python object *callable*, with arguments given by the tuple " "*args*. If no arguments are needed, then *args* can be *NULL*." msgstr "" -"呼び出し可能な Python のオブジェクト *callable* を、タプル *args* として与え" -"られる引数とともに呼び出します。\n" -"引数が必要な場合は、 *args* は *NULL* で構いません。" +"呼び出し可能な Python オブジェクト ``callable`` を、タプル ``args`` で与えら" +"れた引数で呼び出します。\n" +"引数が不要な場合は ``args`` を ``NULL`` にできます。" #: ../../c-api/call.rst:262 ../../c-api/call.rst:274 msgid "This is the equivalent of the Python expression: ``callable(*args)``." @@ -466,14 +516,13 @@ msgstr "" "す。\n" "*format* は *NULL* かもしれず、与える引数がないことを表します。" -#: ../../c-api/call.rst:276 msgid "" "Note that if you only pass :c:expr:`PyObject *` args, :c:func:" "`PyObject_CallFunctionObjArgs` is a faster alternative." msgstr "" ":c:expr:`PyObject *` args だけを引数に渡す場合は、 :c:func:" "`PyObject_CallFunctionObjArgs` がより速い方法であることを覚えておいてくださ" -"い。 " +"い。" #: ../../c-api/call.rst:279 msgid "The type of *format* was changed from ``char *``." @@ -490,9 +539,8 @@ msgstr "" "C 引数はタプルを生成する :c:func:`Py_BuildValue` 形式のフォーマット文字列で記" "述されています。" -#: ../../c-api/call.rst:289 msgid "The format can be *NULL*, indicating that no arguments are provided." -msgstr "*format* は *NULL* でもよく、引数が与えられないことを表します。 " +msgstr "*format* は *NULL* でもよく、引数が与えられないことを表します。" #: ../../c-api/call.rst:294 msgid "" @@ -500,14 +548,12 @@ msgid "" "arg2, ...)``." msgstr "これは次の Python の式と同等です: ``obj.name(arg1, arg2, ...)`` 。" -#: ../../c-api/call.rst:297 msgid "" "Note that if you only pass :c:expr:`PyObject *` args, :c:func:" "`PyObject_CallMethodObjArgs` is a faster alternative." msgstr "" ":c:expr:`PyObject *` args だけを引数に渡す場合は、 :c:func:" -"`PyObject_CallMethodObjArgs` がより速い方法であることを覚えておいてくださ" -"い。 " +"`PyObject_CallMethodObjArgs` がより速い方法であることを覚えておいてください。" #: ../../c-api/call.rst:300 msgid "The types of *name* and *format* were changed from ``char *``." @@ -541,42 +587,51 @@ msgstr "" "呼び出されます. 引数列は末尾に *NULL* がついた可変数個のパラメタとして与えま" "す。" -#: ../../c-api/call.rst:330 msgid "" "Call a method of the Python object *obj* without arguments, where the name " "of the method is given as a Python string object in *name*." msgstr "" +"Python オブジェクト ``obj`` のメソッドを引数なしで呼び出します。\n" +"メソッド名は Python 文字列オブジェクト ``name`` で指定します。" -#: ../../c-api/call.rst:341 msgid "" "Call a method of the Python object *obj* with a single positional argument " "*arg*, where the name of the method is given as a Python string object in " "*name*." msgstr "" +"Python オブジェクト ``obj`` のメソッドを、一つの位置引数 ``arg`` を渡して呼び" +"出します。\n" +"メソッド名は Python 文字列オブジェクト ``name`` で指定します。" -#: ../../c-api/call.rst:353 msgid "" "Call a callable Python object *callable*. The arguments are the same as for :" "c:type:`vectorcallfunc`. If *callable* supports vectorcall_, this directly " "calls the vectorcall function stored in *callable*." msgstr "" +"呼び出し可能な Python オブジェクト ``callable`` を呼び出します。\n" +"引数は :c:type:`vectorcallfunc` と同じです。\n" +"``callable`` が vectorcall_ をサポートしている場合は、``callable`` に格納され" +"た vectorcall 関数を直接呼び出します。" -#: ../../c-api/call.rst:365 msgid "" "Call *callable* with positional arguments passed exactly as in the " "vectorcall_ protocol, but with keyword arguments passed as a dictionary " "*kwdict*. The *args* array contains only the positional arguments." msgstr "" +"位置引数は vectorcall_ プロトコルとまったく同じ方法で渡し、キーワード引数は辞" +"書 ``kwdict`` で渡して ``callable`` を呼び出します。\n" +"``args`` 配列には位置引数だけを含めます。" -#: ../../c-api/call.rst:369 msgid "" "Regardless of which protocol is used internally, a conversion of arguments " "needs to be done. Therefore, this function should only be used if the caller " "already has a dictionary ready to use for the keyword arguments, but not a " "tuple for the positional arguments." msgstr "" +"内部でどちらのプロトコルを使っても、引数の変換が必要です。\n" +"そのため、この関数は呼び出し側がキーワード引数の辞書をすでに用意していて、位" +"置引数のタプルは持っていない場合だけに使ってください。" -#: ../../c-api/call.rst:379 msgid "" "Call a method using the vectorcall calling convention. The name of the " "method is given as a Python string *name*. The object whose method is called " @@ -587,16 +642,24 @@ msgid "" "temporarily be changed. Keyword arguments can be passed just like in :c:func:" "`PyObject_Vectorcall`." msgstr "" +"vectorcall の呼び出し規約でメソッドを呼び出します。\n" +"メソッド名は Python 文字列 ``name`` で指定します。\n" +"メソッドを呼び出す対象のオブジェクトは ``args[0]`` で、``args[1]`` から始ま" +"る ``args`` 配列が呼び出しの引数を表します。\n" +"位置引数は少なくとも一つ必要です。\n" +"``nargsf`` は ``args[0]`` を含む位置引数の数で、``args[0]`` の値を一時的に変" +"更してよい場合は :c:macro:`PY_VECTORCALL_ARGUMENTS_OFFSET` を加えます。\n" +"キーワード引数は :c:func:`PyObject_Vectorcall` と同じ方法で渡せます。" -#: ../../c-api/call.rst:388 msgid "" "If the object has the :c:macro:`Py_TPFLAGS_METHOD_DESCRIPTOR` feature, this " "will call the unbound method object with the full *args* vector as arguments." msgstr "" +"オブジェクトが :c:macro:`Py_TPFLAGS_METHOD_DESCRIPTOR` の機能を持つ場合、" +"``args`` ベクトル全体を引数として非束縛メソッドオブジェクトを呼び出します。" -#: ../../c-api/call.rst:399 msgid "Call Support API" -msgstr "" +msgstr "呼び出しサポート API" #: ../../c-api/call.rst:403 msgid "" diff --git a/c-api/capsule.po b/c-api/capsule.po index 7ec040524..8da659a00 100644 --- a/c-api/capsule.po +++ b/c-api/capsule.po @@ -18,22 +18,21 @@ msgstr "" "Last-Translator: tomo, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../c-api/capsule.rst:6 msgid "Capsules" msgstr "カプセル" -#: ../../c-api/capsule.rst:10 msgid "" "Refer to :ref:`using-capsules` for more information on using these objects." msgstr "" -"`using-capsules` 以下のオブジェクトを使う方法については :ref:`using-" -"capsules` を参照してください。" +"これらのオブジェクトの使い方については :ref:`using-capsules` を参照してくださ" +"い。" #: ../../c-api/capsule.rst:17 msgid "" @@ -55,9 +54,8 @@ msgstr "" msgid "The type of a destructor callback for a capsule. Defined as::" msgstr "カプセルに対するデストラクタコールバック型. 次のように定義されます::" -#: ../../c-api/capsule.rst:29 msgid "typedef void (*PyCapsule_Destructor)(PyObject *);" -msgstr "" +msgstr "typedef void (*PyCapsule_Destructor)(PyObject *);" #: ../../c-api/capsule.rst:31 msgid "" @@ -122,13 +120,17 @@ msgstr "" "カプセルに保存されている *pointer* を取り出します。失敗した場合は例外を設定し" "て ``NULL`` を返します。" -#: ../../c-api/capsule.rst:65 msgid "" "The *name* parameter must compare exactly to the name stored in the capsule. " "If the name stored in the capsule is ``NULL``, the *name* passed in must " "also be ``NULL``. Python uses the C function :c:func:`!strcmp` to compare " "capsule names." msgstr "" +"*name* 引数は、カプセルに格納されている名前と完全に一致しなければなりませ" +"ん。\n" +"カプセルに格納されている名前が ``NULL`` なら、渡す *name* も ``NULL`` でなけ" +"ればなりません。\n" +"Python はカプセル名の比較に C 関数 :c:func:`!strcmp` を使います。" #: ../../c-api/capsule.rst:73 msgid "" @@ -184,25 +186,28 @@ msgstr "" "``NULL`` がエラーを指してない可能性があります。 :c:func:`PyCapsule_IsValid` " "か :c:func:`PyErr_Occurred` を利用して確認してください。" -#: ../../c-api/capsule.rst:103 msgid "" "Import a pointer to a C object from a capsule attribute in a module. The " "*name* parameter should specify the full name to the attribute, as in " "``module.attribute``. The *name* stored in the capsule must match this " "string exactly." msgstr "" +"モジュールのカプセル属性から、C オブジェクトへのポインタをインポートしま" +"す。\n" +"*name* 引数には ``module.attribute`` のような属性の完全名を指定してくださ" +"い。\n" +"カプセルに格納されている *name* は、この文字列と完全に一致する必要がありま" +"す。" -#: ../../c-api/capsule.rst:108 msgid "" "Return the capsule's internal *pointer* on success. On failure, set an " "exception and return ``NULL``." msgstr "" -"成功した場合、カプセルの内部 *ポインタ* を返します。失敗した場合、例外を設定" -"して ``NULL`` を返します。" +"成功すると、カプセル内部の *pointer* を返します。\n" +"失敗すると例外を設定して ``NULL`` を返します。" -#: ../../c-api/capsule.rst:111 msgid "*no_block* has no effect anymore." -msgstr "" +msgstr "*no_block* は効果を持たなくなりました。" #: ../../c-api/capsule.rst:117 msgid "" @@ -217,12 +222,13 @@ msgstr "" "ポインタを格納していて、内部の name が引数 *name* とマッチします。 (name の比" "較方法については :c:func:`PyCapsule_GetPointer` を参照)" -#: ../../c-api/capsule.rst:123 msgid "" "In other words, if :c:func:`PyCapsule_IsValid` returns a true value, calls " "to any of the accessors (any function starting with ``PyCapsule_Get``) are " "guaranteed to succeed." msgstr "" +"言い換えると、:c:func:`PyCapsule_IsValid` が真を返した場合、どのアクセサ " +"(``PyCapsule_Get`` で始まる関数) を呼び出しても成功することが保証されます。" #: ../../c-api/capsule.rst:127 msgid "" @@ -266,7 +272,7 @@ msgstr "" #: ../../c-api/capsule.rst:8 msgid "object" -msgstr "オブジェクト" +msgstr "object" #: ../../c-api/capsule.rst:8 msgid "Capsule" diff --git a/c-api/cell.po b/c-api/cell.po index 9f6944b99..a639a0994 100644 --- a/c-api/cell.po +++ b/c-api/cell.po @@ -17,10 +17,10 @@ msgstr "" "Last-Translator: tomo, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../c-api/cell.rst:6 @@ -72,11 +72,13 @@ msgstr "" "値 *ob* の入った新たなセルオブジェクトを生成して返します。\n" "引数を ``NULL`` にしてもかまいません。" -#: ../../c-api/cell.rst:42 msgid "" "Return the contents of the cell *cell*, which can be ``NULL``. If *cell* is " "not a cell object, returns ``NULL`` with an exception set." msgstr "" +"セル *cell* の内容を返します。\n" +"内容は ``NULL`` の場合もあります。\n" +"*cell* がセルオブジェクトでなければ、例外を設定して ``NULL`` を返します。" #: ../../c-api/cell.rst:48 msgid "" @@ -86,18 +88,22 @@ msgstr "" "*cell* の内容を返しますが、*cell* が非 ``NULL`` かつセルオブジェクトであるか" "どうかはチェックしません。" -#: ../../c-api/cell.rst:54 msgid "" "Set the contents of the cell object *cell* to *value*. This releases the " "reference to any current content of the cell. *value* may be ``NULL``. " "*cell* must be non-``NULL``." msgstr "" +"セルオブジェクト *cell* の内容を *value* に設定します。\n" +"セルに現在格納されている内容への参照は解放します。\n" +"*value* は ``NULL`` でも構いません。\n" +"*cell* は ``NULL`` であってはなりません。" -#: ../../c-api/cell.rst:58 msgid "" "On success, return ``0``. If *cell* is not a cell object, set an exception " "and return ``-1``." msgstr "" +"成功すると ``0`` を返します。\n" +"*cell* がセルオブジェクトでなければ、例外を設定して ``-1`` を返します。" #: ../../c-api/cell.rst:64 msgid "" diff --git a/c-api/code.po b/c-api/code.po index fc6a1c6bd..5cf2b8851 100644 --- a/c-api/code.po +++ b/c-api/code.po @@ -19,10 +19,10 @@ msgstr "" "Last-Translator: Taichi Haradaguchi, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../c-api/code.rst:8 @@ -46,93 +46,107 @@ msgstr "" "コードオブジェクトを表現するために利用されるC構造体。この型のフィールドは何時" "でも変更され得ます。" -#: ../../c-api/code.rst:24 msgid "" "This is an instance of :c:type:`PyTypeObject` representing the Python :ref:" "`code object `." msgstr "" +"Python の :ref:`コードオブジェクト ` を表す :c:type:" +"`PyTypeObject` のインスタンスです。" -#: ../../c-api/code.rst:30 msgid "" "Return true if *co* is a :ref:`code object `. This function " "always succeeds." msgstr "" +"``co`` が :ref:`コードオブジェクト ` の場合に真を返します。\n" +"この関数は常に成功します。" -#: ../../c-api/code.rst:35 msgid "" "Return the number of :term:`free (closure) variables ` in " "a code object." msgstr "" +"コードオブジェクト内の :term:`自由変数 (クロージャ変数) ` " +"の数を返します。" -#: ../../c-api/code.rst:40 msgid "" "Return the position of the first :term:`free (closure) variable ` in a code object." msgstr "" +"コードオブジェクト内の最初の :term:`自由変数 (クロージャ変数) ` の位置を返します。" -#: ../../c-api/code.rst:45 msgid "" "Renamed from ``PyCode_GetFirstFree`` as part of :ref:`unstable-c-api`. The " "old name is deprecated, but will remain available until the signature " "changes again." msgstr "" +":ref:`unstable-c-api` の一部として ``PyCode_GetFirstFree`` から名前を変更しま" +"した。\n" +"古い名前は非推奨ですが、シグネチャが再び変更されるまでは利用できます。" -#: ../../c-api/code.rst:51 msgid "" "Return a new code object. If you need a dummy code object to create a " "frame, use :c:func:`PyCode_NewEmpty` instead." msgstr "" +"新しいコードオブジェクトを返します。\n" +"フレームの作成にダミーのコードオブジェクトが必要な場合は、代わりに :c:func:" +"`PyCode_NewEmpty` を使ってください。" -#: ../../c-api/code.rst:54 msgid "" "Since the definition of the bytecode changes often, calling :c:func:" "`PyUnstable_Code_New` directly can bind you to a precise Python version." msgstr "" +"バイトコードの定義は頻繁に変わるため、:c:func:`PyUnstable_Code_New` を直接呼" +"び出すと、特定の Python バージョンに依存することがあります。" -#: ../../c-api/code.rst:57 msgid "" "The many arguments of this function are inter-dependent in complex ways, " "meaning that subtle changes to values are likely to result in incorrect " "execution or VM crashes. Use this function only with extreme care." msgstr "" +"この関数の多数の引数は複雑に依存し合っているため、値を少し変えるだけで誤った" +"実行や VM のクラッシュにつながりやすくなっています。\n" +"十分に注意して使ってください。" -#: ../../c-api/code.rst:61 msgid "Added ``qualname`` and ``exceptiontable`` parameters." -msgstr "" +msgstr "``qualname`` と ``exceptiontable`` 引数を追加しました。" -#: ../../c-api/code.rst:68 msgid "" "Renamed from ``PyCode_New`` as part of :ref:`unstable-c-api`. The old name " "is deprecated, but will remain available until the signature changes again." msgstr "" +":ref:`unstable-c-api` の一部として ``PyCode_New`` から名前を変更しました。\n" +"古い名前は非推奨ですが、シグネチャが再び変更されるまでは利用できます。" -#: ../../c-api/code.rst:74 msgid "" "Similar to :c:func:`PyUnstable_Code_New`, but with an extra " "\"posonlyargcount\" for positional-only arguments. The same caveats that " "apply to ``PyUnstable_Code_New`` also apply to this function." msgstr "" +":c:func:`PyUnstable_Code_New` と同様ですが、位置専用引数のための " +"``posonlyargcount`` 引数が追加されています。\n" +"``PyUnstable_Code_New`` と同じ注意事項が当てはまります。" -#: ../../c-api/code.rst:79 msgid "as ``PyCode_NewWithPosOnlyArgs``" -msgstr "" +msgstr "``PyCode_NewWithPosOnlyArgs`` として追加。" -#: ../../c-api/code.rst:81 msgid "Added ``qualname`` and ``exceptiontable`` parameters." -msgstr "" +msgstr "``qualname`` と ``exceptiontable`` 引数を追加しました。" -#: ../../c-api/code.rst:86 msgid "" "Renamed to ``PyUnstable_Code_NewWithPosOnlyArgs``. The old name is " "deprecated, but will remain available until the signature changes again." msgstr "" +"``PyUnstable_Code_NewWithPosOnlyArgs`` に名前を変更しました。\n" +"古い名前は非推奨ですが、シグネチャが再び変更されるまでは利用できます。" -#: ../../c-api/code.rst:92 msgid "" "Return a new empty code object with the specified filename, function name, " "and first line number. The resulting code object will raise an ``Exception`` " "if executed." msgstr "" +"指定されたファイル名、関数名、開始行番号を持つ新しい空のコードオブジェクトを" +"返します。\n" +"このコードオブジェクトを実行すると ``Exception`` を送出します。" #: ../../c-api/code.rst:98 msgid "" @@ -147,79 +161,101 @@ msgid "" "`the API described in PEP 626 <0626#out-of-process-debuggers-and-profilers>`." msgstr "" -#: ../../c-api/code.rst:106 msgid "" "Sets the passed ``int`` pointers to the source code line and column numbers " "for the instruction at ``byte_offset``. Sets the value to ``0`` when " "information is not available for any particular element." msgstr "" +"渡された ``int`` ポインタの参照先に、``byte_offset`` にある命令のソースコード" +"上の行番号と列番号を設定します。\n" +"情報がない項目には ``0`` を設定します。" -#: ../../c-api/code.rst:110 msgid "Returns ``1`` if the function succeeds and 0 otherwise." -msgstr "" +msgstr "成功した場合は ``1`` を返し、それ以外の場合は 0 を返します。" -#: ../../c-api/code.rst:116 msgid "" "Equivalent to the Python code ``getattr(co, 'co_code')``. Returns a strong " "reference to a :c:type:`PyBytesObject` representing the bytecode in a code " "object. On error, ``NULL`` is returned and an exception is raised." msgstr "" +"Python コード ``getattr(co, 'co_code')`` と同等です。\n" +"コードオブジェクト内のバイトコードを表す :c:type:`PyBytesObject` への強参照を" +"返します。\n" +"エラーの場合は例外を送出し、``NULL`` を返します。" -#: ../../c-api/code.rst:121 msgid "" "This ``PyBytesObject`` may be created on-demand by the interpreter and does " "not necessarily represent the bytecode actually executed by CPython. The " "primary use case for this function is debuggers and profilers." msgstr "" +"この ``PyBytesObject`` は、インタープリタが必要に応じて作成する場合があり、" +"CPython が実際に実行するバイトコードを表すとは限りません。\n" +"この関数の主な用途はデバッガとプロファイラです。" -#: ../../c-api/code.rst:129 msgid "" "Equivalent to the Python code ``getattr(co, 'co_varnames')``. Returns a new " "reference to a :c:type:`PyTupleObject` containing the names of the local " "variables. On error, ``NULL`` is returned and an exception is raised." msgstr "" +"Python コード ``getattr(co, 'co_varnames')`` と同等です。\n" +"ローカル変数の名前を含む :c:type:`PyTupleObject` への新しい参照を返します。\n" +"エラーの場合は例外を送出し、``NULL`` を返します。" -#: ../../c-api/code.rst:138 msgid "" "Equivalent to the Python code ``getattr(co, 'co_cellvars')``. Returns a new " "reference to a :c:type:`PyTupleObject` containing the names of the local " "variables that are referenced by nested functions. On error, ``NULL`` is " "returned and an exception is raised." msgstr "" +"Python コード ``getattr(co, 'co_cellvars')`` と同等です。\n" +"ネストした関数から参照されるローカル変数の名前を含む :c:type:`PyTupleObject` " +"への新しい参照を返します。\n" +"エラーの場合は例外を送出し、``NULL`` を返します。" -#: ../../c-api/code.rst:147 msgid "" "Equivalent to the Python code ``getattr(co, 'co_freevars')``. Returns a new " "reference to a :c:type:`PyTupleObject` containing the names of the :term:" "`free (closure) variables `. On error, ``NULL`` is " "returned and an exception is raised." msgstr "" +"Python コード ``getattr(co, 'co_freevars')`` と同等です。\n" +":term:`自由変数 (クロージャ変数) ` の名前を含む :c:type:" +"`PyTupleObject` への新しい参照を返します。\n" +"エラーの場合は例外を送出し、``NULL`` を返します。" -#: ../../c-api/code.rst:156 msgid "" "Register *callback* as a code object watcher for the current interpreter. " "Return an ID which may be passed to :c:func:`PyCode_ClearWatcher`. In case " "of error (e.g. no more watcher IDs available), return ``-1`` and set an " "exception." msgstr "" +"現在のインタープリタのコードオブジェクトウォッチャーとして ``callback`` を登" +"録します。\n" +":c:func:`PyCode_ClearWatcher` に渡せる ID を返します。\n" +"エラーの場合 (例えば利用可能なウォッチャー ID がない場合) は、例外を設定して " +"``-1`` を返します。" -#: ../../c-api/code.rst:165 msgid "" "Clear watcher identified by *watcher_id* previously returned from :c:func:" "`PyCode_AddWatcher` for the current interpreter. Return ``0`` on success, or " "``-1`` and set an exception on error (e.g. if the given *watcher_id* was " "never registered.)" msgstr "" +"現在のインタープリタについて、:c:func:`PyCode_AddWatcher` が以前返した " +"``watcher_id`` で識別されるウォッチャーを解除します。\n" +"成功した場合は ``0`` を返します。\n" +"エラーの場合 (例えば指定した ``watcher_id`` が登録されていない場合) は、例外" +"を設定して ``-1`` を返します。" -#: ../../c-api/code.rst:174 msgid "" "Enumeration of possible code object watcher events: - " "``PY_CODE_EVENT_CREATE`` - ``PY_CODE_EVENT_DESTROY``" msgstr "" +"コードオブジェクトウォッチャーで発生し得るイベントの列挙型: - " +"``PY_CODE_EVENT_CREATE`` - ``PY_CODE_EVENT_DESTROY``" -#: ../../c-api/code.rst:182 msgid "Type of a code object watcher callback function." -msgstr "" +msgstr "コードオブジェクトウォッチャーのコールバック関数の型。" #: ../../c-api/code.rst:184 msgid "" @@ -229,15 +265,18 @@ msgid "" "inspected." msgstr "" -#: ../../c-api/code.rst:189 msgid "" "If *event* is ``PY_CODE_EVENT_DESTROY``, taking a reference in the callback " "to the about-to-be-destroyed code object will resurrect it and prevent it " "from being freed at this time. When the resurrected object is destroyed " "later, any watcher callbacks active at that time will be called again." msgstr "" +"``event`` が ``PY_CODE_EVENT_DESTROY`` の場合、コールバック内で破棄されようと" +"しているコードオブジェクトへの参照を取得すると、そのオブジェクトが復活し、こ" +"の時点での解放を防ぎます。\n" +"復活したオブジェクトが後で破棄されるときは、その時点で有効なウォッチャーの" +"コールバックが再び呼び出されます。" -#: ../../c-api/code.rst:194 msgid "" "Users of this API should not rely on internal runtime implementation " "details. Such details may include, but are not limited to, the exact order " @@ -246,15 +285,23 @@ msgid "" "whether a callback is invoked or not), it does not change the semantics of " "the Python code being executed." msgstr "" +"この API の利用者は、ランタイム内部の実装の詳細に依存してはいけません。\n" +"例えばコードオブジェクトの作成や破棄の正確な順序とタイミングなどが該当します" +"が、これらに限りません。\n" +"こうした詳細の変更によって、コールバックが呼び出されるかどうかも含めてウォッ" +"チャーから観測できる違いが生じることはありますが、実行される Python コードの" +"意味は変わりません。" -#: ../../c-api/code.rst:201 msgid "" "If the callback sets an exception, it must return ``-1``; this exception " "will be printed as an unraisable exception using :c:func:" "`PyErr_WriteUnraisable`. Otherwise it should return ``0``." msgstr "" +"コールバックが例外を設定した場合は ``-1`` を返す必要があります。\n" +"その例外は、:c:func:`PyErr_WriteUnraisable` を使って送出できない例外として表" +"示されます。\n" +"それ以外の場合は ``0`` を返してください。" -#: ../../c-api/code.rst:205 msgid "" "There may already be a pending exception set on entry to the callback. In " "this case, the callback should return ``0`` with the same exception still " @@ -262,24 +309,31 @@ msgid "" "exception unless it saves and clears the exception state first, and restores " "it before returning." msgstr "" +"コールバックに入る時点で、すでに処理待ちの例外が設定されている場合がありま" +"す。\n" +"その場合、コールバックは同じ例外を設定したまま ``0`` を返すべきです。\n" +"そのため、例外を設定し得る別の API を呼び出す場合は、まず例外の状態を保存して" +"クリアし、戻る前に復元する必要があります。" -#: ../../c-api/code.rst:215 msgid "Extra information" -msgstr "" +msgstr "追加情報" -#: ../../c-api/code.rst:217 msgid "" "To support low-level extensions to frame evaluation, such as external just-" "in-time compilers, it is possible to attach arbitrary extra data to code " "objects." msgstr "" +"外部の JIT コンパイラなど、フレーム評価の低レベルな拡張をサポートするため、" +"コードオブジェクトには任意の追加データを付加できます。" -#: ../../c-api/code.rst:221 msgid "" "These functions are part of the unstable C API tier: this functionality is a " "CPython implementation detail, and the API may change without deprecation " "warnings." msgstr "" +"これらの関数は不安定な C API の階層に属します。\n" +"この機能は CPython の実装の詳細であり、API は非推奨の警告なしに変更される可能" +"性があります。" #: ../../c-api/code.rst:227 msgid "Return a new an opaque index value used to adding data to code objects." @@ -292,64 +346,72 @@ msgid "" "individual code objects." msgstr "" -#: ../../c-api/code.rst:233 msgid "" "If *free* is not ``NULL``: when a code object is deallocated, *free* will be " "called on non-``NULL`` data stored under the new index. Use :c:func:" "`Py_DecRef` when storing :c:type:`PyObject`." msgstr "" +"``free`` が ``NULL`` でない場合、コードオブジェクトの解放時に、その新しいイン" +"デックスに格納されている非 ``NULL`` のデータに対して ``free`` を呼び出しま" +"す。\n" +":c:type:`PyObject` を格納する場合は :c:func:`Py_DecRef` を使ってください。" -#: ../../c-api/code.rst:239 msgid "as ``_PyEval_RequestCodeExtraIndex``" -msgstr "" +msgstr "``_PyEval_RequestCodeExtraIndex`` として追加。" -#: ../../c-api/code.rst:243 msgid "" "Renamed to ``PyUnstable_Eval_RequestCodeExtraIndex``. The old private name " "is deprecated, but will be available until the API changes." msgstr "" +"``PyUnstable_Eval_RequestCodeExtraIndex`` に名前を変更しました。\n" +"古いプライベートな名前は非推奨ですが、API が変更されるまでは利用できます。" -#: ../../c-api/code.rst:249 msgid "" "Set *extra* to the extra data stored under the given index. Return 0 on " "success. Set an exception and return -1 on failure." msgstr "" +"指定されたインデックスに格納された追加データを ``extra`` に設定します。\n" +"成功した場合は 0 を返します。\n" +"失敗した場合は例外を設定して -1 を返します。" -#: ../../c-api/code.rst:252 msgid "" "If no data was set under the index, set *extra* to ``NULL`` and return 0 " "without setting an exception." msgstr "" +"そのインデックスにデータが設定されていない場合は、``extra`` を ``NULL`` に設" +"定し、例外を設定せずに 0 を返します。" -#: ../../c-api/code.rst:257 msgid "as ``_PyCode_GetExtra``" -msgstr "" +msgstr "``_PyCode_GetExtra`` として追加。" -#: ../../c-api/code.rst:261 msgid "" "Renamed to ``PyUnstable_Code_GetExtra``. The old private name is deprecated, " "but will be available until the API changes." msgstr "" +"``PyUnstable_Code_GetExtra`` に名前を変更しました。\n" +"古いプライベートな名前は非推奨ですが、API が変更されるまでは利用できます。" -#: ../../c-api/code.rst:267 msgid "" "Set the extra data stored under the given index to *extra*. Return 0 on " "success. Set an exception and return -1 on failure." msgstr "" +"指定されたインデックスに格納する追加データを ``extra`` に設定します。\n" +"成功した場合は 0 を返します。\n" +"失敗した場合は例外を設定して -1 を返します。" -#: ../../c-api/code.rst:272 msgid "as ``_PyCode_SetExtra``" -msgstr "" +msgstr "``_PyCode_SetExtra`` として追加。" -#: ../../c-api/code.rst:276 msgid "" "Renamed to ``PyUnstable_Code_SetExtra``. The old private name is deprecated, " "but will be available until the API changes." msgstr "" +"``PyUnstable_Code_SetExtra`` に名前を変更しました。\n" +"古いプライベートな名前は非推奨ですが、API が変更されるまでは利用できます。" #: ../../c-api/code.rst:3 msgid "object" -msgstr "オブジェクト" +msgstr "object" #: ../../c-api/code.rst:3 msgid "code" diff --git a/c-api/codec.po b/c-api/codec.po index fd74c9a01..d34aca4f9 100644 --- a/c-api/codec.po +++ b/c-api/codec.po @@ -17,10 +17,10 @@ msgstr "" "Last-Translator: tomo, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../c-api/codec.rst:4 @@ -45,6 +45,9 @@ msgid "" "search function is not registered, do nothing. Return 0 on success. Raise an " "exception and return -1 on error." msgstr "" +"コーデック検索関数の登録を解除し、レジストリのキャッシュをクリアします。 検索" +"関数が登録されていない場合は何もしません。 成功したら0を返します。 エラーの場" +"合は例外を送出させ、-1を返します。" #: ../../c-api/codec.rst:23 msgid "" @@ -93,17 +96,16 @@ msgstr "" msgid "Codec lookup API" msgstr "コーデック検索API" -#: ../../c-api/codec.rst:48 msgid "" "In the following functions, the *encoding* string is looked up converted to " "all lower-case characters, which makes encodings looked up through this " "mechanism effectively case-insensitive. If no codec is found, a :exc:" "`KeyError` is set and ``NULL`` returned." msgstr "" -"次の関数では、文字列 *encoding* は全て小文字に変換することで、効率的に、大文" -"字小文字を無視した検索をします。\n" -"コーデックが見つからない場合、 :exc:`KeyError` を設定して ``NULL`` を返しま" -"す。" +"以下の関数では、文字列 *encoding* をすべて小文字に変換してから検索します。\n" +"このため、この仕組みによるエンコーディングの検索では、実質的に大文字と小文字" +"を区別しません。\n" +"コーデックが見つからなければ :exc:`KeyError` を設定して ``NULL`` を返します。" #: ../../c-api/codec.rst:55 msgid "Get an encoder function for the given *encoding*." diff --git a/c-api/complex.po b/c-api/complex.po index 9d7ceae70..7d19c8c62 100644 --- a/c-api/complex.po +++ b/c-api/complex.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: Taichi Haradaguchi, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../c-api/complex.rst:6 @@ -62,17 +62,19 @@ msgid "" "appropriate." msgstr "" -#: ../../c-api/complex.rst:33 msgid "The structure is defined as::" -msgstr "" +msgstr "構造体は次のように定義されています。 ::" -#: ../../c-api/complex.rst:35 msgid "" "typedef struct {\n" " double real;\n" " double imag;\n" "} Py_complex;" msgstr "" +"typedef struct {\n" +" double real;\n" +" double imag;\n" +"} Py_complex;" #: ../../c-api/complex.rst:43 msgid "" @@ -104,31 +106,28 @@ msgid "" "representation." msgstr "二つの複素数の商を C の :c:type:`Py_complex` 型で返します。" -#: ../../c-api/complex.rst:70 msgid "" "If *divisor* is null, this method returns zero and sets :c:data:`errno` to :" "c:macro:`!EDOM`." msgstr "" -"*divisor* が null の場合は、このメソッドはゼロを返し、 :c:data:`errno` に :c:" -"macro:`!EDOM` をセットします。" +"*divisor* がゼロの場合、この関数はゼロを返し、:c:data:`errno` に :c:macro:`!" +"EDOM` を設定します。" -#: ../../c-api/complex.rst:76 msgid "" "Return the exponentiation of *num* by *exp*, using the C :c:type:" "`Py_complex` representation." -msgstr "指数 *exp* の *num* 乗を C の :c:type:`Py_complex` 型で返します。" +msgstr "*num* の *exp* 乗を、C の :c:type:`Py_complex` 表現で返します。" -#: ../../c-api/complex.rst:79 msgid "" "If *num* is null and *exp* is not a positive real number, this method " "returns zero and sets :c:data:`errno` to :c:macro:`!EDOM`." msgstr "" -"*num* が null で *exp* が正の実数でない場合は、このメソッドはゼロを返し、 :c:" -"data:`errno` に :c:macro:`!EDOM` をセットします。" +"*num* がゼロで、*exp* が正の実数でない場合、この関数はゼロを返し、:c:data:" +"`errno` に :c:macro:`!EDOM` を設定します。" -#: ../../c-api/complex.rst:82 msgid "Set :c:data:`errno` to :c:macro:`!ERANGE` on overflows." msgstr "" +"オーバーフロー時は :c:data:`errno` に :c:macro:`!ERANGE` を設定します。" #: ../../c-api/complex.rst:86 msgid "Complex Numbers as Python Objects" @@ -163,45 +162,53 @@ msgstr "" "引数が :c:type:`PyComplexObject` であるが :c:type:`PyComplexObject` のサブタ" "イプでないときに真を返します。この関数は常に成功します。" -#: ../../c-api/complex.rst:114 msgid "" "Create a new Python complex number object from a C :c:type:`Py_complex` " "value. Return ``NULL`` with an exception set on error." msgstr "" +"C の :c:type:`Py_complex` 値から、新しい Python の複素数オブジェクトを作成し" +"ます。\n" +"エラーの場合は例外を設定して ``NULL`` を返します。" -#: ../../c-api/complex.rst:120 msgid "" "Return a new :c:type:`PyComplexObject` object from *real* and *imag*. Return " "``NULL`` with an exception set on error." msgstr "" +"*real* と *imag* から新しい :c:type:`PyComplexObject` オブジェクトを作成して" +"返します。\n" +"エラーの場合は例外を設定して ``NULL`` を返します。" #: ../../c-api/complex.rst:126 msgid "Return the real part of *op* as a C :c:expr:`double`." msgstr "*op* の実数部分を C の :c:expr:`double` 型で返します。" -#: ../../c-api/complex.rst:128 msgid "" "If *op* is not a Python complex number object but has a :meth:`~object." "__complex__` method, this method will first be called to convert *op* to a " "Python complex number object. If :meth:`!__complex__` is not defined then " "it falls back to call :c:func:`PyFloat_AsDouble` and returns its result." msgstr "" +"*op* が Python の複素数オブジェクトでなく、:meth:`~object.__complex__` メソッ" +"ドを持つ場合は、まずこのメソッドを呼び出し、*op* を Python の複素数オブジェク" +"トに変換します。\n" +":meth:`!__complex__` が定義されていなければ、代わりに :c:func:" +"`PyFloat_AsDouble` を呼び出し、その結果を返します。" -#: ../../c-api/complex.rst:134 ../../c-api/complex.rst:150 msgid "" "Upon failure, this method returns ``-1.0`` with an exception set, so one " "should call :c:func:`PyErr_Occurred` to check for errors." msgstr "" +"失敗すると、例外を設定して ``-1.0`` を返します。\n" +"そのため、エラーの有無を確認するには :c:func:`PyErr_Occurred` を呼び出してく" +"ださい。" -#: ../../c-api/complex.rst:137 ../../c-api/complex.rst:153 msgid "Use :meth:`~object.__complex__` if available." -msgstr "" +msgstr "利用可能なら :meth:`~object.__complex__` を使うようになりました。" #: ../../c-api/complex.rst:142 msgid "Return the imaginary part of *op* as a C :c:expr:`double`." msgstr "*op* の虚数部分を C の :c:expr:`double` 型で返します。" -#: ../../c-api/complex.rst:144 msgid "" "If *op* is not a Python complex number object but has a :meth:`~object." "__complex__` method, this method will first be called to convert *op* to a " @@ -209,12 +216,15 @@ msgid "" "it falls back to call :c:func:`PyFloat_AsDouble` and returns ``0.0`` on " "success." msgstr "" +"*op* が Python の複素数オブジェクトでなく、:meth:`~object.__complex__` メソッ" +"ドを持つ場合は、まずこのメソッドを呼び出し、*op* を Python の複素数オブジェク" +"トに変換します。\n" +":meth:`!__complex__` が定義されていなければ、代わりに :c:func:" +"`PyFloat_AsDouble` を呼び出し、成功時に ``0.0`` を返します。" -#: ../../c-api/complex.rst:158 msgid "Return the :c:type:`Py_complex` value of the complex number *op*." -msgstr "複素数値 *op* から :c:type:`Py_complex` 型を生成します。" +msgstr "複素数 *op* の値を :c:type:`Py_complex` として返します。" -#: ../../c-api/complex.rst:160 msgid "" "If *op* is not a Python complex number object but has a :meth:`~object." "__complex__` method, this method will first be called to convert *op* to a " @@ -222,13 +232,23 @@ msgid "" "it falls back to :meth:`~object.__float__`. If :meth:`!__float__` is not " "defined then it falls back to :meth:`~object.__index__`." msgstr "" +"*op* が Python の複素数オブジェクトでなく、:meth:`~object.__complex__` メソッ" +"ドを持つ場合は、まずこのメソッドを呼び出し、*op* を Python の複素数オブジェク" +"トに変換します。\n" +":meth:`!__complex__` が定義されていなければ、代わりに :meth:`~object." +"__float__` を使います。\n" +":meth:`!__float__` も定義されていなければ、代わりに :meth:`~object." +"__index__` を使います。" -#: ../../c-api/complex.rst:166 msgid "" "Upon failure, this method returns :c:type:`Py_complex` with :c:member:" "`~Py_complex.real` set to ``-1.0`` and with an exception set, so one should " "call :c:func:`PyErr_Occurred` to check for errors." msgstr "" +"失敗すると、例外を設定し、:c:member:`~Py_complex.real` を ``-1.0`` にした :c:" +"type:`Py_complex` を返します。\n" +"そのため、エラーの有無を確認するには :c:func:`PyErr_Occurred` を呼び出してく" +"ださい。" #: ../../c-api/complex.rst:170 msgid "Use :meth:`~object.__index__` if available." diff --git a/c-api/concrete.po b/c-api/concrete.po index d5afb86ae..7e8bd83cd 100644 --- a/c-api/concrete.po +++ b/c-api/concrete.po @@ -17,10 +17,10 @@ msgstr "" "Last-Translator: tomo, 2023\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../c-api/concrete.rst:8 @@ -44,7 +44,6 @@ msgstr "" "ます。この章は Python のオブジェクト型における \"家計図\" に従って構成されて" "います。" -#: ../../c-api/concrete.rst:19 msgid "" "While the functions described in this chapter carefully check the type of " "the objects which are passed in, many of them do not check for ``NULL`` " @@ -52,11 +51,10 @@ msgid "" "can cause memory access violations and immediate termination of the " "interpreter." msgstr "" -"この章で述べている関数は、渡されたオブジェクトの型を注意深くチェックしはする" -"ものの、多くの関数は渡されたオブジェクトが有効な ``NULL`` なのか有効なオブ" -"ジェクトなのかをチェックしません。これらの関数に ``NULL`` を渡させてしまう" -"と、関数はメモリアクセス違反を起こして、インタプリタを即座に終了させてしまう" -"はずです。" +"この章で説明する関数は、渡されたオブジェクトの型を入念に確認しますが、多くは" +"有効なオブジェクトの代わりに ``NULL`` が渡されたかどうかを確認しません。\n" +"``NULL`` を渡してしまうと、メモリアクセス違反が起きたり、インタープリタが直ち" +"に終了したりする可能性があります。" #: ../../c-api/concrete.rst:28 msgid "Fundamental Objects" diff --git a/c-api/contextvars.po b/c-api/contextvars.po index e4b4ab7ee..676d8a62e 100644 --- a/c-api/contextvars.po +++ b/c-api/contextvars.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: Arihiro TAKASE, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../c-api/contextvars.rst:6 @@ -38,7 +38,6 @@ msgstr "" "`PyContext`, :c:type:`PyContextVar`, :c:type:`PyContextToken` の代わりに :c:" "type:`PyObject` ポインタを使うように **変更** されました。例えば::" -#: ../../c-api/contextvars.rst:20 msgid "" "// in 3.7.0:\n" "PyContext *PyContext_New(void);\n" @@ -46,6 +45,11 @@ msgid "" "// in 3.7.1+:\n" "PyObject *PyContext_New(void);" msgstr "" +"// 3.7.0 では:\n" +"PyContext *PyContext_New(void);\n" +"\n" +"// 3.7.1 以降では:\n" +"PyObject *PyContext_New(void);" #: ../../c-api/contextvars.rst:26 msgid "See :issue:`34762` for more details." @@ -162,48 +166,63 @@ msgstr "" "ンテキストに復元します。\n" "成功したら ``0`` を、失敗したら ``-1`` を返します。" -#: ../../c-api/contextvars.rst:106 msgid "" "Register *callback* as a context object watcher for the current interpreter. " "Return an ID which may be passed to :c:func:`PyContext_ClearWatcher`. In " "case of error (e.g. no more watcher IDs available), return ``-1`` and set an " "exception." msgstr "" +"*callback* を現在のインタープリタのコンテキストオブジェクトのウォッチャーとし" +"て登録します。\n" +":c:func:`PyContext_ClearWatcher` に渡せる ID を返します。\n" +"利用できるウォッチャー ID が残っていない場合など、エラーの場合は例外を設定し" +"て ``-1`` を返します。" -#: ../../c-api/contextvars.rst:115 msgid "" "Clear watcher identified by *watcher_id* previously returned from :c:func:" "`PyContext_AddWatcher` for the current interpreter. Return ``0`` on success, " "or ``-1`` and set an exception on error (e.g. if the given *watcher_id* was " "never registered.)" msgstr "" +"現在のインタープリタについて、:c:func:`PyContext_AddWatcher` が以前に返した " +"*watcher_id* で識別されるウォッチャーを解除します。\n" +"成功すると ``0`` を返します。\n" +"指定した *watcher_id* が登録されていない場合など、エラーの場合は例外を設定し" +"て ``-1`` を返します。" -#: ../../c-api/contextvars.rst:124 msgid "Enumeration of possible context object watcher events:" -msgstr "" +msgstr "コンテキストオブジェクトのウォッチャーが受け取るイベントの列挙:" -#: ../../c-api/contextvars.rst:126 msgid "" "``Py_CONTEXT_SWITCHED``: The :term:`current context` has switched to a " "different context. The object passed to the watch callback is the now-" "current :class:`contextvars.Context` object, or None if no context is " "current." msgstr "" +"``Py_CONTEXT_SWITCHED``: :term:`現在のコンテキスト ` が別の" +"コンテキストに切り替わりました。\n" +"ウォッチャーのコールバックに渡されるオブジェクトは、新たに現在のコンテキスト" +"となった :class:`contextvars.Context` オブジェクト、または現在のコンテキスト" +"がなければ ``None`` です。" -#: ../../c-api/contextvars.rst:135 msgid "" "Context object watcher callback function. The object passed to the callback " "is event-specific; see :c:type:`PyContextEvent` for details." msgstr "" +"コンテキストオブジェクトのウォッチャーのコールバック関数です。\n" +"コールバックに渡されるオブジェクトはイベントによって異なります。\n" +"詳しくは :c:type:`PyContextEvent` を参照してください。" -#: ../../c-api/contextvars.rst:138 msgid "" "If the callback returns with an exception set, it must return ``-1``; this " "exception will be printed as an unraisable exception using :c:func:" "`PyErr_FormatUnraisable`. Otherwise it should return ``0``." msgstr "" +"コールバックが例外を設定して戻る場合、``-1`` を返さなければなりません。\n" +"この例外は、送出できない例外として :c:func:`PyErr_FormatUnraisable` で表示さ" +"れます。\n" +"それ以外の場合は ``0`` を返してください。" -#: ../../c-api/contextvars.rst:142 msgid "" "There may already be a pending exception set on entry to the callback. In " "this case, the callback should return ``0`` with the same exception still " @@ -211,6 +230,11 @@ msgid "" "exception unless it saves and clears the exception state first, and restores " "it before returning." msgstr "" +"コールバックに入る時点で、すでに処理待ちの例外が設定されている場合がありま" +"す。\n" +"その場合、コールバックは同じ例外を設定したまま ``0`` を返すべきです。\n" +"そのため、例外を設定し得る別の API を呼び出す場合は、まず例外の状態を保存して" +"クリアし、戻る前に復元する必要があります。" #: ../../c-api/contextvars.rst:151 msgid "Context variable functions:" @@ -264,13 +288,12 @@ msgstr "``NULL``" msgid "Except for ``NULL``, the function returns a new reference." msgstr "``NULL`` を除けば、この関数は新しい参照を返します。" -#: ../../c-api/contextvars.rst:177 msgid "" "Set the value of *var* to *value* in the current context. Returns a new " "token object for this change, or ``NULL`` if an error has occurred." msgstr "" "現在のコンテキストにおいて *var* の値を *value* にセットします。この変更によ" -"る新しいトークンオブジェクトか、エラーが起こった場合は``NULL``を返します。" +"る新しいトークンオブジェクトか、エラーが起こった場合は ``NULL`` を返します。" #: ../../c-api/contextvars.rst:182 msgid "" diff --git a/c-api/conversion.po b/c-api/conversion.po index f525e64b3..4848b2258 100644 --- a/c-api/conversion.po +++ b/c-api/conversion.po @@ -17,10 +17,10 @@ msgstr "" "Last-Translator: Arihiro TAKASE, 2023\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../c-api/conversion.rst:6 @@ -61,7 +61,6 @@ msgstr "" "func:`snprintf` と :c:func:`vsnprintf` 関数をラップします。これらの関数の目的" "は、C標準ライブラリが保証していないコーナーケースでの動作を保証することです。" -#: ../../c-api/conversion.rst:28 msgid "" "The wrappers ensure that ``str[size-1]`` is always ``'\\0'`` upon return. " "They never write more than *size* bytes (including the trailing ``'\\0'``) " @@ -70,6 +69,14 @@ msgid "" "equivalent to the C99 ``n = snprintf(NULL, 0, ...)`` which would determine " "the necessary buffer size." msgstr "" +"これらのラッパーは、戻る時点で ``str[size-1]`` が必ず ``'\\0'`` になることを" +"保証します。\n" +"末尾の ``'\\0'`` を含めて、``size`` バイトを超えて ``str`` に書き込むことはあ" +"りません。\n" +"どちらの関数も ``str != NULL``、``size > 0``、``format != NULL``、``size < " +"INT_MAX`` を必要とします。\n" +"このため、必要なバッファサイズを調べる C99 の ``n = snprintf(NULL, 0, ...)`` " +"に相当する操作はできません。" #: ../../c-api/conversion.rst:34 msgid "" @@ -110,14 +117,16 @@ msgid "" "conversions." msgstr "以下の関数は locale 非依存な文字列から数値への変換を行ないます。" -#: ../../c-api/conversion.rst:53 msgid "" "Convert the initial part of the string in ``str`` to an :c:expr:`unsigned " "long` value according to the given ``base``, which must be between ``2`` and " "``36`` inclusive, or be the special value ``0``." msgstr "" +"文字列 ``str`` の先頭部分を、指定された基数 ``base`` に従って :c:expr:" +"`unsigned long` の値に変換します。\n" +"``base`` は ``2`` 以上 ``36`` 以下、または特別な値 ``0`` でなければなりませ" +"ん。" -#: ../../c-api/conversion.rst:57 msgid "" "Leading white space and case of characters are ignored. If ``base`` is zero " "it looks for a leading ``0b``, ``0o`` or ``0x`` to tell which base. If " @@ -125,35 +134,44 @@ msgid "" "(inclusive). If ``ptr`` is non-``NULL`` it will contain a pointer to the " "end of the scan." msgstr "" +"先頭の空白と文字の大文字・小文字の違いは無視します。\n" +"``base`` がゼロの場合、先頭の ``0b``、``0o``、``0x`` から基数を判定します。\n" +"これらがなければ ``10`` を使います。\n" +"基数は 0、または 2 以上 36 以下でなければなりません。\n" +"``ptr`` が ``NULL`` でなければ、走査が終了した位置へのポインタを格納します。" -#: ../../c-api/conversion.rst:63 msgid "" "If the converted value falls out of range of corresponding return type, " "range error occurs (:c:data:`errno` is set to :c:macro:`!ERANGE`) and :c:" "macro:`!ULONG_MAX` is returned. If no conversion can be performed, ``0`` is " "returned." msgstr "" +"変換した値が戻り値の型の範囲外になった場合、範囲エラーとして :c:data:`errno` " +"を :c:macro:`!ERANGE` に設定し、:c:macro:`!ULONG_MAX` を返します。\n" +"変換できなかった場合は ``0`` を返します。" -#: ../../c-api/conversion.rst:68 msgid "See also the Unix man page :manpage:`strtoul(3)`." -msgstr "" +msgstr "Unix マニュアルページ :manpage:`strtoul(3)` も参照してください。" -#: ../../c-api/conversion.rst:75 msgid "" "Convert the initial part of the string in ``str`` to an :c:expr:`long` value " "according to the given ``base``, which must be between ``2`` and ``36`` " "inclusive, or be the special value ``0``." msgstr "" +"文字列 ``str`` の先頭部分を、指定された基数 ``base`` に従って :c:expr:`long` " +"の値に変換します。\n" +"``base`` は ``2`` 以上 ``36`` 以下、または特別な値 ``0`` でなければなりませ" +"ん。" -#: ../../c-api/conversion.rst:79 msgid "" "Same as :c:func:`PyOS_strtoul`, but return a :c:expr:`long` value instead " "and :c:macro:`LONG_MAX` on overflows." msgstr "" +":c:func:`PyOS_strtoul` と同じですが、戻り値は :c:expr:`long` で、オーバーフ" +"ロー時には :c:macro:`LONG_MAX` を返します。" -#: ../../c-api/conversion.rst:82 msgid "See also the Unix man page :manpage:`strtol(3)`." -msgstr "" +msgstr "Unix マニュアルページ :manpage:`strtol(3)` も参照してください。" #: ../../c-api/conversion.rst:89 msgid "" diff --git a/c-api/coro.po b/c-api/coro.po index c89de45e7..d0e5bde44 100644 --- a/c-api/coro.po +++ b/c-api/coro.po @@ -17,10 +17,10 @@ msgstr "" "Last-Translator: Takanori Suzuki , 2021\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../c-api/coro.rst:6 @@ -43,13 +43,12 @@ msgstr "コルーチンオブジェクトのための C 構造体。" msgid "The type object corresponding to coroutine objects." msgstr "コルーチンオブジェクトに対応する型オブジェクト。" -#: ../../c-api/coro.rst:26 msgid "" "Return true if *ob*'s type is :c:type:`PyCoro_Type`; *ob* must not be " "``NULL``. This function always succeeds." msgstr "" -"*ob* が :c:type:`PyCoro_Type` の場合に真を返します。\n" -"*ob* は ``NULL`` であってはなりません。\n" +"``ob`` の型が :c:type:`PyCoro_Type` の場合に真を返します。\n" +"``ob`` は ``NULL`` であってはいけません。\n" "この関数は常に成功します。" #: ../../c-api/coro.rst:32 diff --git a/c-api/datetime.po b/c-api/datetime.po index 74460520c..f8febb2aa 100644 --- a/c-api/datetime.po +++ b/c-api/datetime.po @@ -19,10 +19,10 @@ msgstr "" "Last-Translator: Taichi Haradaguchi, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../c-api/datetime.rst:6 @@ -335,15 +335,11 @@ msgstr "秒を 0 から 59 の間の整数で返します。" msgid "Return the microsecond, as an int from 0 through 999999." msgstr "マイクロ秒を 0 から 999999 の間の整数で返します。" -#: ../../c-api/datetime.rst:241 ../../c-api/datetime.rst:279 msgid "Return the fold, as an int from 0 through 1." -msgstr "" -"フォールド(訳注: サマータイムによる時間のずれのこと)を 0 から 1 までの整数で" -"返します。" +msgstr "``fold`` を 0 または 1 の整数で返します。" -#: ../../c-api/datetime.rst:248 ../../c-api/datetime.rst:286 msgid "Return the tzinfo (which may be ``None``)." -msgstr "" +msgstr "``tzinfo`` を返します (``None`` の場合もあります)。" #: ../../c-api/datetime.rst:253 msgid "" @@ -381,14 +377,16 @@ msgstr "マイクロ秒を 0 から 999999 の間の整数で返します。" msgid "Macros for the convenience of modules implementing the DB API:" msgstr "以下のマクロは DB API を実装する上での便宜用です:" -#: ../../c-api/datetime.rst:320 msgid "" "Create and return a new :class:`datetime.datetime` object given an argument " "tuple suitable for passing to :meth:`datetime.datetime.fromtimestamp`." msgstr "" +":meth:`datetime.datetime.fromtimestamp` に渡せる引数のタプルから、新しい :" +"class:`datetime.datetime` オブジェクトを作成して返します。" -#: ../../c-api/datetime.rst:326 msgid "" "Create and return a new :class:`datetime.date` object given an argument " "tuple suitable for passing to :meth:`datetime.date.fromtimestamp`." msgstr "" +":meth:`datetime.date.fromtimestamp` に渡せる引数のタプルから、新しい :class:" +"`datetime.date` オブジェクトを作成して返します。" diff --git a/c-api/descriptor.po b/c-api/descriptor.po index ccfca1517..d995b9c04 100644 --- a/c-api/descriptor.po +++ b/c-api/descriptor.po @@ -16,10 +16,10 @@ msgstr "" "Last-Translator: tomo, 2021\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../c-api/descriptor.rst:6 diff --git a/c-api/dict.po b/c-api/dict.po index 99b13adaf..900057e65 100644 --- a/c-api/dict.po +++ b/c-api/dict.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: tomo, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../c-api/dict.rst:6 @@ -90,12 +90,14 @@ msgstr "" "は ``1`` を返し、それ以外の場合には ``0`` を返します。エラーの場合 ``-1`` を" "返します。この関数は Python の式 ``key in p`` と等価です。" -#: ../../c-api/dict.rst:60 msgid "" "This is the same as :c:func:`PyDict_Contains`, but *key* is specified as a :" "c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" "`PyObject*`." msgstr "" +":c:func:`PyDict_Contains` と同様ですが、*key* は :c:expr:`PyObject*` ではな" +"く、UTF-8 でエンコードされた :c:expr:`const char*` のバイト文字列で指定しま" +"す。" #: ../../c-api/dict.rst:69 msgid "Return a new dictionary that contains the same key-value pairs as *p*." @@ -114,12 +116,14 @@ msgstr "" "成功した場合には ``0`` を、失敗した場合には ``-1`` を返します。\n" "この関数は *val* への参照を盗み取り *ません*。" -#: ../../c-api/dict.rst:82 msgid "" "This is the same as :c:func:`PyDict_SetItem`, but *key* is specified as a :c:" "expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" "`PyObject*`." msgstr "" +":c:func:`PyDict_SetItem` と同様ですが、*key* は :c:expr:`PyObject*` ではな" +"く、UTF-8 でエンコードされた :c:expr:`const char*` のバイト文字列で指定しま" +"す。" #: ../../c-api/dict.rst:89 msgid "" @@ -133,56 +137,64 @@ msgstr "" "`TypeError` を送出します。*key* が辞書になければ、:exc:`KeyError` を送出しま" "す。成功した場合には ``0`` を、失敗した場合には ``-1`` を返します。" -#: ../../c-api/dict.rst:97 msgid "" "This is the same as :c:func:`PyDict_DelItem`, but *key* is specified as a :c:" "expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" "`PyObject*`." msgstr "" +":c:func:`PyDict_DelItem` と同様ですが、*key* は :c:expr:`PyObject*` ではな" +"く、UTF-8 でエンコードされた :c:expr:`const char*` のバイト文字列で指定しま" +"す。" -#: ../../c-api/dict.rst:104 msgid "" "Return a new :term:`strong reference` to the object from dictionary *p* " "which has a key *key*:" msgstr "" +"辞書 *p* からキー *key* に対応するオブジェクトへの新しい :term:`強参照 " +"` を返します:" -#: ../../c-api/dict.rst:107 msgid "" "If the key is present, set *\\*result* to a new :term:`strong reference` to " "the value and return ``1``." msgstr "" +"キーがあれば、*\\*result* にその値への新しい :term:`強参照 ` を設定し、``1`` を返します。" -#: ../../c-api/dict.rst:109 msgid "If the key is missing, set *\\*result* to ``NULL`` and return ``0``." -msgstr "" +msgstr "キーがなければ、*\\*result* に ``NULL`` を設定し、``0`` を返します。" #: ../../c-api/dict.rst:110 ../../c-api/dict.rst:207 msgid "On error, raise an exception and return ``-1``." msgstr "エラーの場合例外を送出し ``-1`` を返します。" -#: ../../c-api/dict.rst:114 msgid "See also the :c:func:`PyObject_GetItem` function." -msgstr "" +msgstr ":c:func:`PyObject_GetItem` 関数も参照してください。" -#: ../../c-api/dict.rst:119 msgid "" "Return a :term:`borrowed reference` to the object from dictionary *p* which " "has a key *key*. Return ``NULL`` if the key *key* is missing *without* " "setting an exception." msgstr "" +"辞書 *p* からキー *key* に対応するオブジェクトへの :term:`借用参照 ` を返します。\n" +"キー *key* がなければ、例外を設定 *せずに* ``NULL`` を返します。" -#: ../../c-api/dict.rst:125 msgid "" "Exceptions that occur while this calls :meth:`~object.__hash__` and :meth:" "`~object.__eq__` methods are silently ignored. Prefer the :c:func:" "`PyDict_GetItemWithError` function instead." msgstr "" +"この関数が :meth:`~object.__hash__` メソッドや :meth:`~object.__eq__` メソッ" +"ドを呼び出す際に発生した例外は、通知せずに無視します。\n" +"代わりに :c:func:`PyDict_GetItemWithError` 関数を使うことを推奨します。" -#: ../../c-api/dict.rst:129 msgid "" "Calling this API without an :term:`attached thread state` had been allowed " "for historical reason. It is no longer allowed." msgstr "" +"歴史的な理由により、以前は :term:`アタッチされたスレッド状態 ` なしでこの API を呼び出すことが認められていました。\n" +"現在は認められていません。" #: ../../c-api/dict.rst:136 msgid "" @@ -194,26 +206,34 @@ msgstr "" "例外が発生した場合は、例外をセット **した上で** ``NULL`` を返します。\n" "キーが存在しなかった場合は、例外をセット **せずに** ``NULL`` を返します。" -#: ../../c-api/dict.rst:144 msgid "" "This is the same as :c:func:`PyDict_GetItem`, but *key* is specified as a :c:" "expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" "`PyObject*`." msgstr "" +":c:func:`PyDict_GetItem` と同様ですが、*key* は :c:expr:`PyObject*` ではな" +"く、UTF-8 でエンコードされた :c:expr:`const char*` のバイト文字列で指定しま" +"す。" -#: ../../c-api/dict.rst:150 msgid "" "Exceptions that occur while this calls :meth:`~object.__hash__` and :meth:" "`~object.__eq__` methods or while creating the temporary :class:`str` object " "are silently ignored. Prefer using the :c:func:`PyDict_GetItemWithError` " "function with your own :c:func:`PyUnicode_FromString` *key* instead." msgstr "" +"この関数が :meth:`~object.__hash__` メソッドや :meth:`~object.__eq__` メソッ" +"ドを呼び出す際、または一時的な :class:`str` オブジェクトを作成する際に発生し" +"た例外は、通知せずに無視します。\n" +"代わりに、自分で :c:func:`PyUnicode_FromString` により *key* を作成し、:c:" +"func:`PyDict_GetItemWithError` 関数を使うことを推奨します。" -#: ../../c-api/dict.rst:159 msgid "" "Similar to :c:func:`PyDict_GetItemRef`, but *key* is specified as a :c:expr:" "`const char*` UTF-8 encoded bytes string, rather than a :c:expr:`PyObject*`." msgstr "" +":c:func:`PyDict_GetItemRef` と同様ですが、*key* は :c:expr:`PyObject*` ではな" +"く、UTF-8 でエンコードされた :c:expr:`const char*` のバイト文字列で指定しま" +"す。" #: ../../c-api/dict.rst:168 msgid "" @@ -230,7 +250,6 @@ msgstr "" "この関数は、 *key* のハッシュ値を検索と挿入ごとに別々に評価するのではなく、一" "度だけしか評価しません。" -#: ../../c-api/dict.rst:179 msgid "" "Inserts *default_value* into the dictionary *p* with a key of *key* if the " "key is not already present in the dictionary. If *result* is not ``NULL``, " @@ -241,14 +260,28 @@ msgid "" "and *default_value* was inserted. On failure, returns ``-1``, sets an " "exception, and sets ``*result`` to ``NULL``." msgstr "" +"辞書 *p* にキー *key* がまだなければ、そのキーで *default_value* を挿入しま" +"す。\n" +"*result* が ``NULL`` でなければ、*\\*result* には :term:`強参照 ` を設定します。\n" +"キーがなかった場合は *default_value* への参照、*key* がすでにあった場合は既存" +"の値への参照です。\n" +"キーがすでにあり *default_value* を挿入しなかった場合は ``1``、キーがなく " +"*default_value* を挿入した場合は ``0`` を返します。\n" +"失敗すると ``-1`` を返し、例外を設定し、``*result`` に ``NULL`` を設定しま" +"す。" -#: ../../c-api/dict.rst:189 msgid "" "For clarity: if you have a strong reference to *default_value* before " "calling this function, then after it returns, you hold a strong reference to " "both *default_value* and *\\*result* (if it's not ``NULL``). These may refer " "to the same object: in that case you hold two separate references to it." msgstr "" +"明確にすると、この関数を呼び出す前に *default_value* への強参照を持っていた場" +"合、戻った後には *default_value* と *\\*result* (``NULL`` でない場合) の両方" +"への強参照を持つことになります。\n" +"これらが同じオブジェクトを参照している場合もあり、その場合はそのオブジェクト" +"への別々の参照を 2 つ持つことになります。" #: ../../c-api/dict.rst:200 msgid "" @@ -256,17 +289,19 @@ msgid "" "not raise :exc:`KeyError` if the key missing." msgstr "" -#: ../../c-api/dict.rst:203 msgid "" "If the key is present, set *\\*result* to a new reference to the removed " "value if *result* is not ``NULL``, and return ``1``." msgstr "" +"キーがあれば、*result* が ``NULL`` でない場合には *\\*result* に削除した値へ" +"の新しい参照を設定し、``1`` を返します。" -#: ../../c-api/dict.rst:205 msgid "" "If the key is missing, set *\\*result* to ``NULL`` if *result* is not " "``NULL``, and return ``0``." msgstr "" +"キーがなければ、*result* が ``NULL`` でない場合には *\\*result* に ``NULL`` " +"を設定し、``0`` を返します。" #: ../../c-api/dict.rst:209 msgid "" @@ -274,11 +309,12 @@ msgid "" "exc:`KeyError` if the key missing." msgstr "" -#: ../../c-api/dict.rst:217 msgid "" "Similar to :c:func:`PyDict_Pop`, but *key* is specified as a :c:expr:`const " "char*` UTF-8 encoded bytes string, rather than a :c:expr:`PyObject*`." msgstr "" +":c:func:`PyDict_Pop` と同様ですが、*key* は :c:expr:`PyObject*` ではなく、" +"UTF-8 でエンコードされた :c:expr:`const char*` のバイト文字列で指定します。" #: ../../c-api/dict.rst:226 msgid "" @@ -303,7 +339,6 @@ msgid "" msgstr "" "辞書内の要素の数を返します。辞書に対して ``len(p)`` を実行するのと同じです。" -#: ../../c-api/dict.rst:250 msgid "" "Iterate over all key-value pairs in the dictionary *p*. The :c:type:" "`Py_ssize_t` referred to by *ppos* must be initialized to ``0`` prior to the " @@ -316,24 +351,22 @@ msgid "" "represents offsets within the internal dictionary structure, and since the " "structure is sparse, the offsets are not consecutive." msgstr "" -"辞書 *p* 内の全てのキー/値のペアにわたる反復処理を行います。\n" -"*ppos* が参照している :c:type:`Py_ssize_t` 型は、この関数で反復処理を開始する" -"際に、最初に関数を呼び出すよりも前に ``0`` に初期化しておかなければなりませ" -"ん。この関数は辞書内の各ペアを取り上げるごとに真を返し、全てのペアを取り上げ" -"たことが分かると偽を返します。\n" -"パラメーター *pkey* および *pvalue* には、それぞれ辞書の各々のキーと値が埋め" -"られた :c:expr:`PyObject*` 変数を指すポインタか、または ``NULL`` が入りま" -"す。\n" -"この関数から返される参照はすべて借用参照になります。\n" -"反復処理中に *ppos* を変更してはなりません。\n" -"この値は内部的な辞書構造体のオフセットを表現しており、構造体はスパースなの" -"で、オフセットの値に一貫性がないためです。" +"辞書 *p* のすべてのキーと値のペアを反復処理します。\n" +"反復処理を開始するには、最初の呼び出しより前に *ppos* が指す :c:type:" +"`Py_ssize_t` を ``0`` に初期化する必要があります。\n" +"この関数は辞書内の各ペアについて真を返し、すべてのペアを返し終わると偽を返し" +"ます。\n" +"引数 *pkey* と *pvalue* は、それぞれキーと値の格納先となる :c:expr:" +"`PyObject*` 変数を指すか、``NULL`` である必要があります。\n" +"これらを通じて返される参照は借用参照です。\n" +"反復処理中に *ppos* を変更してはいけません。\n" +"その値は辞書の内部構造内のオフセットを表しており、この構造は疎であるため、オ" +"フセットは連続しません。" #: ../../c-api/dict.rst:261 msgid "For example::" msgstr "例えば::" -#: ../../c-api/dict.rst:263 msgid "" "PyObject *key, *value;\n" "Py_ssize_t pos = 0;\n" @@ -343,6 +376,13 @@ msgid "" " ...\n" "}" msgstr "" +"PyObject *key, *value;\n" +"Py_ssize_t pos = 0;\n" +"\n" +"while (PyDict_Next(self->dict, &pos, &key, &value)) {\n" +" /* 値を使って何らかの処理を行う... */\n" +" ...\n" +"}" #: ../../c-api/dict.rst:271 msgid "" @@ -354,7 +394,6 @@ msgstr "" "応する値を変更しても大丈夫になりましたが、キーの集合を変更しないことが前提で" "す。以下に例を示します::" -#: ../../c-api/dict.rst:275 msgid "" "PyObject *key, *value;\n" "Py_ssize_t pos = 0;\n" @@ -374,6 +413,23 @@ msgid "" " Py_DECREF(o);\n" "}" msgstr "" +"PyObject *key, *value;\n" +"Py_ssize_t pos = 0;\n" +"\n" +"while (PyDict_Next(self->dict, &pos, &key, &value)) {\n" +" long i = PyLong_AsLong(value);\n" +" if (i == -1 && PyErr_Occurred()) {\n" +" return -1;\n" +" }\n" +" PyObject *o = PyLong_FromLong(i + 1);\n" +" if (o == NULL)\n" +" return -1;\n" +" if (PyDict_SetItem(self->dict, key, o) < 0) {\n" +" Py_DECREF(o);\n" +" return -1;\n" +" }\n" +" Py_DECREF(o);\n" +"}" #: ../../c-api/dict.rst:293 msgid "" @@ -382,7 +438,6 @@ msgid "" "`Py_BEGIN_CRITICAL_SECTION` to lock the dictionary while iterating over it::" msgstr "" -#: ../../c-api/dict.rst:298 msgid "" "Py_BEGIN_CRITICAL_SECTION(self->dict);\n" "while (PyDict_Next(self->dict, &pos, &key, &value)) {\n" @@ -390,8 +445,12 @@ msgid "" "}\n" "Py_END_CRITICAL_SECTION();" msgstr "" +"Py_BEGIN_CRITICAL_SECTION(self->dict);\n" +"while (PyDict_Next(self->dict, &pos, &key, &value)) {\n" +" ...\n" +"}\n" +"Py_END_CRITICAL_SECTION();" -#: ../../c-api/dict.rst:307 msgid "" "Iterate over mapping object *b* adding key-value pairs to dictionary *a*. " "*b* may be a dictionary, or any object supporting :c:func:`PyMapping_Keys` " @@ -400,13 +459,14 @@ msgid "" "only be added if there is not a matching key in *a*. Return ``0`` on success " "or ``-1`` if an exception was raised." msgstr "" -"マップ型オブジェクト *b* の全ての要素にわたって、反復的にキー/値のペアを辞書 " -"*a* に追加します。 *b* は辞書か、 :c:func:`PyMapping_Keys` または :c:func:" -"`PyObject_GetItem` をサポートする何らかのオブジェクトにできます。 *override* " -"が真ならば、 *a* のキーと一致するキーが *b* にある際に、既存のペアを置き換え" -"ます。それ以外の場合は、 *b* のキーに一致するキーが *a* にないときのみ追加を" -"行います。成功した場合には ``0`` を返し、例外が送出された場合には ``-1`` を返" -"します。" +"マッピングオブジェクト *b* を反復処理し、キーと値のペアを辞書 *a* に追加しま" +"す。\n" +"*b* は辞書、または :c:func:`PyMapping_Keys` と :c:func:`PyObject_GetItem` の" +"両方をサポートするオブジェクトであれば構いません。\n" +"*override* が真の場合、*b* に一致するキーがあれば *a* の既存のペアを置き換え" +"ます。\n" +"偽の場合は、*a* に一致するキーがないペアだけを追加します。\n" +"成功すると ``0``、例外が送出された場合は ``-1`` を返します。" #: ../../c-api/dict.rst:317 msgid "" @@ -421,7 +481,6 @@ msgstr "" "性を持たない場合にキー/値ペアのシーケンスを反復することはありません。成功した" "場合には ``0`` を返し、例外が送出された場合には ``-1`` を返します。" -#: ../../c-api/dict.rst:326 msgid "" "Update or merge into dictionary *a*, from the key-value pairs in *seq2*. " "*seq2* must be an iterable object producing iterable objects of length 2, " @@ -429,65 +488,83 @@ msgid "" "*override* is true, else the first wins. Return ``0`` on success or ``-1`` " "if an exception was raised. Equivalent Python (except for the return value)::" msgstr "" -"*seq2* 内のキー/値ペアを使って、辞書 *a* の内容を更新したり統合したりします。" -"*seq2* は、キー/値のペアとみなせる長さ 2 の反復可能オブジェクト(iterable " -"object) を生成する反復可能オブジェクトでなければなりません。重複するキーが存" -"在する場合、*override* が真ならば先に出現したキーを使い、そうでない場合は後に" -"出現したキーを使います。成功した場合には ``0`` を返し、例外が送出された場合に" -"は ``-1`` を返します。(戻り値以外は) 等価な Python コードを書くと、以下のよう" -"になります::" +"*seq2* 内のキーと値のペアを使って、辞書 *a* を更新またはマージします。\n" +"*seq2* は、キーと値のペアとみなせる長さ 2 のイテラブルオブジェクトを生成する" +"イテラブルオブジェクトでなければなりません。\n" +"キーが重複する場合、*override* が真なら最後の値を、偽なら最初の値を使いま" +"す。\n" +"成功すると ``0``、例外が送出された場合は ``-1`` を返します。\n" +"戻り値を除いて等価な Python コードを示します。 ::" -#: ../../c-api/dict.rst:333 msgid "" "def PyDict_MergeFromSeq2(a, seq2, override):\n" " for key, value in seq2:\n" " if override or key not in a:\n" " a[key] = value" msgstr "" +"def PyDict_MergeFromSeq2(a, seq2, override):\n" +" for key, value in seq2:\n" +" if override or key not in a:\n" +" a[key] = value" -#: ../../c-api/dict.rst:340 msgid "" "Register *callback* as a dictionary watcher. Return a non-negative integer " "id which must be passed to future calls to :c:func:`PyDict_Watch`. In case " "of error (e.g. no more watcher IDs available), return ``-1`` and set an " "exception." msgstr "" +"*callback* を辞書ウォッチャーとして登録します。\n" +"非負の整数の ID を返します。この ID は以降の :c:func:`PyDict_Watch` 呼び出し" +"に渡す必要があります。\n" +"エラー時 (例えばウォッチャー ID に空きがない場合) には ``-1`` を返し、例外を" +"設定します。" -#: ../../c-api/dict.rst:349 msgid "" "Clear watcher identified by *watcher_id* previously returned from :c:func:" "`PyDict_AddWatcher`. Return ``0`` on success, ``-1`` on error (e.g. if the " "given *watcher_id* was never registered.)" msgstr "" +"以前に :c:func:`PyDict_AddWatcher` が返した *watcher_id* で識別されるウォッ" +"チャーを解除します。\n" +"成功すると ``0``、エラー時 (例えば指定した *watcher_id* が登録されていない場" +"合) には ``-1`` を返します。" -#: ../../c-api/dict.rst:357 msgid "" "Mark dictionary *dict* as watched. The callback granted *watcher_id* by :c:" "func:`PyDict_AddWatcher` will be called when *dict* is modified or " "deallocated. Return ``0`` on success or ``-1`` on error." msgstr "" +"辞書 *dict* を監視対象にします。\n" +"*dict* が変更または解放されると、:c:func:`PyDict_AddWatcher` で *watcher_id* " +"を割り当てられたコールバックを呼び出します。\n" +"成功すると ``0``、エラー時には ``-1`` を返します。" -#: ../../c-api/dict.rst:365 msgid "" "Mark dictionary *dict* as no longer watched. The callback granted " "*watcher_id* by :c:func:`PyDict_AddWatcher` will no longer be called when " "*dict* is modified or deallocated. The dict must previously have been " "watched by this watcher. Return ``0`` on success or ``-1`` on error." msgstr "" +"辞書 *dict* を監視対象から外します。\n" +"*dict* が変更または解放されても、:c:func:`PyDict_AddWatcher` で *watcher_id* " +"を割り当てられたコールバックは呼び出されなくなります。\n" +"この辞書は、それまでこのウォッチャーに監視されている必要があります。\n" +"成功すると ``0``、エラー時には ``-1`` を返します。" -#: ../../c-api/dict.rst:374 msgid "" "Enumeration of possible dictionary watcher events: ``PyDict_EVENT_ADDED``, " "``PyDict_EVENT_MODIFIED``, ``PyDict_EVENT_DELETED``, " "``PyDict_EVENT_CLONED``, ``PyDict_EVENT_CLEARED``, or " "``PyDict_EVENT_DEALLOCATED``." msgstr "" +"辞書ウォッチャーで発生し得るイベントを表す列挙型です: " +"``PyDict_EVENT_ADDED``、``PyDict_EVENT_MODIFIED``、``PyDict_EVENT_DELETED``、" +"``PyDict_EVENT_CLONED``、``PyDict_EVENT_CLEARED``、" +"``PyDict_EVENT_DEALLOCATED``。" -#: ../../c-api/dict.rst:382 msgid "Type of a dict watcher callback function." -msgstr "" +msgstr "辞書ウォッチャーのコールバック関数の型です。" -#: ../../c-api/dict.rst:384 msgid "" "If *event* is ``PyDict_EVENT_CLEARED`` or ``PyDict_EVENT_DEALLOCATED``, both " "*key* and *new_value* will be ``NULL``. If *event* is ``PyDict_EVENT_ADDED`` " @@ -495,23 +572,37 @@ msgid "" "If *event* is ``PyDict_EVENT_DELETED``, *key* is being deleted from the " "dictionary and *new_value* will be ``NULL``." msgstr "" +"*event* が ``PyDict_EVENT_CLEARED`` または ``PyDict_EVENT_DEALLOCATED`` の場" +"合、*key* と *new_value* はどちらも ``NULL`` になります。\n" +"*event* が ``PyDict_EVENT_ADDED`` または ``PyDict_EVENT_MODIFIED`` の場合、" +"*new_value* は *key* に対応する新しい値です。\n" +"*event* が ``PyDict_EVENT_DELETED`` の場合、*key* は辞書から削除されるキーで" +"あり、*new_value* は ``NULL`` になります。" -#: ../../c-api/dict.rst:390 msgid "" "``PyDict_EVENT_CLONED`` occurs when *dict* was previously empty and another " "dict is merged into it. To maintain efficiency of this operation, per-key " "``PyDict_EVENT_ADDED`` events are not issued in this case; instead a single " "``PyDict_EVENT_CLONED`` is issued, and *key* will be the source dictionary." msgstr "" +"``PyDict_EVENT_CLONED`` は、空だった *dict* に別の辞書がマージされるときに発" +"生します。\n" +"この操作の効率を保つため、この場合はキーごとの ``PyDict_EVENT_ADDED`` イベン" +"トは発生しません。\n" +"代わりに ``PyDict_EVENT_CLONED`` が 1 回発生し、*key* はマージ元の辞書になり" +"ます。" -#: ../../c-api/dict.rst:396 msgid "" "The callback may inspect but must not modify *dict*; doing so could have " "unpredictable effects, including infinite recursion. Do not trigger Python " "code execution in the callback, as it could modify the dict as a side effect." msgstr "" +"コールバックは *dict* の内容を調べることはできますが、変更してはいけませ" +"ん。\n" +"変更すると、無限再帰などの予測できない影響が生じる可能性があります。\n" +"副作用で辞書を変更する可能性があるため、コールバック内で Python コードを実行" +"しないでください。" -#: ../../c-api/dict.rst:400 msgid "" "If *event* is ``PyDict_EVENT_DEALLOCATED``, taking a new reference in the " "callback to the about-to-be-destroyed dictionary will resurrect it and " @@ -519,21 +610,29 @@ msgid "" "destroyed later, any watcher callbacks active at that time will be called " "again." msgstr "" +"*event* が ``PyDict_EVENT_DEALLOCATED`` の場合、コールバック内で破棄される直" +"前の辞書への新しい参照を取得すると、その辞書は復活し、その時点では解放されな" +"くなります。\n" +"復活したオブジェクトが後で破棄されると、その時点で有効なウォッチャーのコール" +"バックが再び呼び出されます。" -#: ../../c-api/dict.rst:406 msgid "" "Callbacks occur before the notified modification to *dict* takes place, so " "the prior state of *dict* can be inspected." msgstr "" +"コールバックは、通知対象の *dict* の変更が行われる前に呼び出されるため、変更" +"前の *dict* の状態を調べることができます。" -#: ../../c-api/dict.rst:409 msgid "" "If the callback sets an exception, it must return ``-1``; this exception " "will be printed as an unraisable exception using :c:func:" "`PyErr_WriteUnraisable`. Otherwise it should return ``0``." msgstr "" +"コールバックが例外を設定した場合は ``-1`` を返す必要があります。\n" +"その例外は、:c:func:`PyErr_WriteUnraisable` を使って送出できない例外として表" +"示されます。\n" +"それ以外の場合は ``0`` を返してください。" -#: ../../c-api/dict.rst:413 msgid "" "There may already be a pending exception set on entry to the callback. In " "this case, the callback should return ``0`` with the same exception still " @@ -541,6 +640,11 @@ msgid "" "exception unless it saves and clears the exception state first, and restores " "it before returning." msgstr "" +"コールバックに入る時点で、すでに処理待ちの例外が設定されている場合がありま" +"す。\n" +"その場合、コールバックは同じ例外を設定したまま ``0`` を返すべきです。\n" +"そのため、例外を設定し得る別の API を呼び出す場合は、まず例外の状態を保存して" +"クリアし、戻る前に復元する必要があります。" #: ../../c-api/dict.rst:8 msgid "object" diff --git a/c-api/exceptions.po b/c-api/exceptions.po index 26792fea2..2e0c49cd2 100644 --- a/c-api/exceptions.po +++ b/c-api/exceptions.po @@ -21,10 +21,10 @@ msgstr "" "Last-Translator: 石井明久, 2025\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../c-api/exceptions.rst:8 @@ -67,7 +67,6 @@ msgstr "" "されており、例えば、例外の型が ``NULL`` の場合は、トレースバックは非 " "``NULL`` の値になりません)" -#: ../../c-api/exceptions.rst:26 msgid "" "When a function must fail because some function it called failed, it " "generally doesn't set the error indicator; the function it called already " @@ -79,23 +78,26 @@ msgid "" "error is not handled or carefully propagated, additional calls into the " "Python/C API may not behave as intended and may fail in mysterious ways." msgstr "" -"ある関数が呼び出した関数がいくつか失敗したために、その関数が失敗しなければな" -"らないとき、一般的にエラーインジケータを設定しません。呼び出した関数がすでに" -"設定しています。エラーを処理して例外をクリアするか、あるいは (オブジェクト参" -"照またはメモリ割り当てのような)それが持つどんなリソースも取り除いた後に戻るか" -"のどちらか一方を行う責任があります。エラーを処理する準備をしていなければ、普" -"通に続けるべきでは *ありません*。エラーのために戻る場合は、エラーが設定されて" -"いると呼び出し元に知らせることが大切です。エラーが処理されていない場合または" -"丁寧に伝えられている場合には、Python/C APIのさらなる呼び出しは意図した通りに" -"は動かない可能性があり、不可解な形で失敗するかもしれません。" +"呼び出した関数が失敗したために自分も失敗する必要がある場合、通常はエラーイン" +"ジケータを設定しません。\n" +"呼び出した関数がすでに設定しているためです。\n" +"その関数には、エラーを処理して例外をクリアするか、保持しているリソース (オブ" +"ジェクトへの参照や割り当てたメモリなど) を解放してから戻る責任があります。\n" +"エラーを処理する準備がないなら、通常どおり実行を続けては *いけません*。\n" +"エラーのために戻る場合は、エラーが設定されていることを呼び出し側に通知するこ" +"とが重要です。\n" +"エラーを処理せず、適切に伝播させることもしなければ、その後の Python/C API の" +"呼び出しは意図どおりに動作せず、不可解な形で失敗する可能性があります。" -#: ../../c-api/exceptions.rst:37 msgid "" "The error indicator is **not** the result of :func:`sys.exc_info`. The " "former corresponds to an exception that is not yet caught (and is therefore " "still propagating), while the latter returns an exception after it is caught " "(and has therefore stopped propagating)." msgstr "" +"エラーインジケータは :func:`sys.exc_info` の結果とは **異なります**。\n" +"前者はまだ捕捉されていない例外 (したがって伝播中の例外) に対応し、後者は捕捉" +"された後の例外 (したがって伝播が止まった例外) を返します。" #: ../../c-api/exceptions.rst:44 msgid "Printing and clearing" @@ -131,7 +133,6 @@ msgstr "" "い。\n" "それ以外の場合、致命的なエラーを引き起こすでしょう!" -#: ../../c-api/exceptions.rst:63 msgid "" "If *set_sys_last_vars* is nonzero, the variable :data:`sys.last_exc` is set " "to the printed exception. For backwards compatibility, the deprecated " @@ -139,10 +140,14 @@ msgid "" "last_traceback` are also set to the type, value and traceback of this " "exception, respectively." msgstr "" +"*set_sys_last_vars* がゼロでない場合、表示した例外を変数 :data:`sys." +"last_exc` に設定します。\n" +"後方互換性のため、非推奨の変数 :data:`sys.last_type`、:data:`sys." +"last_value`、:data:`sys.last_traceback` にも、この例外の型、値、トレースバッ" +"クをそれぞれ設定します。" -#: ../../c-api/exceptions.rst:69 msgid "The setting of :data:`sys.last_exc` was added." -msgstr "" +msgstr ":data:`sys.last_exc` の設定が追加されました。" #: ../../c-api/exceptions.rst:75 msgid "Alias for ``PyErr_PrintEx(1)``." @@ -154,35 +159,40 @@ msgid "" "argument." msgstr "現在の例外と *obj* 引数で :func:`sys.unraisablehook` を呼び出します。" -#: ../../c-api/exceptions.rst:83 msgid "" "This utility function prints a warning message to ``sys.stderr`` when an " "exception has been set but it is impossible for the interpreter to actually " "raise the exception. It is used, for example, when an exception occurs in " "an :meth:`~object.__del__` method." msgstr "" +"このユーティリティ関数は、例外が設定されているものの、インタープリタが実際に" +"はその例外を送出できない場合に、``sys.stderr`` に警告メッセージを表示しま" +"す。\n" +"例えば :meth:`~object.__del__` メソッド内で例外が発生した場合に使われます。" -#: ../../c-api/exceptions.rst:88 msgid "" "The function is called with a single argument *obj* that identifies the " "context in which the unraisable exception occurred. If possible, the repr of " "*obj* will be printed in the warning message. If *obj* is ``NULL``, only the " "traceback is printed." msgstr "" +"この関数は、送出できない例外が発生した状況を示す 1 つの引数 *obj* を指定して" +"呼び出します。\n" +"可能であれば、警告メッセージに *obj* の repr を表示します。\n" +"*obj* が ``NULL`` の場合はトレースバックだけを表示します。" #: ../../c-api/exceptions.rst:93 msgid "An exception must be set when calling this function." msgstr "この関数を呼び出すときには、例外がセットされていなければなりません。" -#: ../../c-api/exceptions.rst:95 msgid "Print a traceback. Print only traceback if *obj* is ``NULL``." msgstr "" +"トレースバックを表示するようになりました。\n" +"*obj* が ``NULL`` の場合はトレースバックだけを表示します。" -#: ../../c-api/exceptions.rst:98 msgid "Use :func:`sys.unraisablehook`." -msgstr "" +msgstr ":func:`sys.unraisablehook` を使うようになりました。" -#: ../../c-api/exceptions.rst:104 msgid "" "Similar to :c:func:`PyErr_WriteUnraisable`, but the *format* and subsequent " "parameters help format the warning message; they have the same meaning and " @@ -190,12 +200,19 @@ msgid "" "is roughly equivalent to ``PyErr_FormatUnraisable(\"Exception ignored in: " "%R\", obj)``. If *format* is ``NULL``, only the traceback is printed." msgstr "" +":c:func:`PyErr_WriteUnraisable` と同様ですが、*format* とそれ以降の引数を使っ" +"て警告メッセージを書式化します。\n" +"これらの意味と値は :c:func:`PyUnicode_FromFormat` と同じです。\n" +"``PyErr_WriteUnraisable(obj)`` は、おおよそ " +"``PyErr_FormatUnraisable(\"Exception ignored in: %R\", obj)`` と等価です。\n" +"*format* が ``NULL`` の場合はトレースバックだけを表示します。" -#: ../../c-api/exceptions.rst:116 msgid "" "Print the standard traceback display of ``exc`` to ``sys.stderr``, including " "chained exceptions and notes." msgstr "" +"連鎖した例外と注釈を含め、``exc`` のトレースバックを標準の形式で ``sys." +"stderr`` に表示します。" #: ../../c-api/exceptions.rst:123 msgid "Raising exceptions" @@ -211,7 +228,6 @@ msgstr "" "ため、これらの関数のいくつかは、 ``return`` 文で利用できるように常に " "``NULL`` ポインタを返します。" -#: ../../c-api/exceptions.rst:132 msgid "" "This is the most common way to set the error indicator. The first argument " "specifies the exception type; it is normally one of the standard exceptions, " @@ -219,6 +235,12 @@ msgid "" "reference` to it (e.g. with :c:func:`Py_INCREF`). The second argument is an " "error message; it is decoded from ``'utf-8'``." msgstr "" +"エラーインジケータを設定する最も一般的な方法です。\n" +"最初の引数は例外の型で、通常は :c:data:`PyExc_RuntimeError` などの標準の例外" +"のいずれかです。\n" +"その型への新しい :term:`強参照 ` を作成する必要はありませ" +"ん (例えば :c:func:`Py_INCREF` は不要です)。\n" +"2 番目の引数はエラーメッセージで、``'utf-8'`` からデコードします。" #: ../../c-api/exceptions.rst:141 msgid "" @@ -272,7 +294,6 @@ msgstr "" "ます。したがって、メモリ不足になったとき、オブジェクト割り当て関数は " "``return PyErr_NoMemory();`` と書くことができます。" -#: ../../c-api/exceptions.rst:185 msgid "" "This is a convenience function to raise an exception when a C library " "function has returned an error and set the C variable :c:data:`errno`. It " @@ -285,14 +306,28 @@ msgid "" "returns ``NULL``, so a wrapper function around a system call can write " "``return PyErr_SetFromErrno(type);`` when the system call returns an error." msgstr "" +"C ライブラリ関数がエラーを返し、C の変数 :c:data:`errno` を設定した場合に、例" +"外を送出するための便利関数です。\n" +"最初の要素が :c:data:`errno` の整数値、2 番目の要素が対応するエラーメッセー" +"ジ (:c:func:`!strerror` から取得) であるタプルオブジェクトを作成し、" +"``PyErr_SetObject(type, object)`` を呼び出します。\n" +"Unix で :c:data:`errno` がシステムコールの中断を示す :c:macro:`!EINTR` の場合" +"は、:c:func:`PyErr_CheckSignals` を呼び出します。\n" +"それによってエラーインジケータが設定された場合は、そのままにします。\n" +"この関数は常に ``NULL`` を返すため、システムコールのラッパー関数は、システム" +"コールがエラーを返したときに ``return PyErr_SetFromErrno(type);`` と書けま" +"す。" -#: ../../c-api/exceptions.rst:199 msgid "" "Similar to :c:func:`PyErr_SetFromErrno`, with the additional behavior that " "if *filenameObject* is not ``NULL``, it is passed to the constructor of " "*type* as a third parameter. In the case of :exc:`OSError` exception, this " "is used to define the :attr:`!filename` attribute of the exception instance." msgstr "" +":c:func:`PyErr_SetFromErrno` と同様ですが、*filenameObject* が ``NULL`` でな" +"ければ、*type* のコンストラクタに 3 番目の引数として渡します。\n" +":exc:`OSError` 例外では、これは例外インスタンスの :attr:`!filename` 属性の定" +"義に使われます。" #: ../../c-api/exceptions.rst:208 msgid "" @@ -315,7 +350,6 @@ msgstr "" "*filename* は :term:`ファイルシステムのエンコーディングとエラーハンドラ " "` でデコードされます。" -#: ../../c-api/exceptions.rst:224 msgid "" "This is a convenience function to raise :exc:`OSError`. If called with " "*ierr* of ``0``, the error code returned by a call to :c:func:`!" @@ -328,12 +362,19 @@ msgid "" "``PyErr_SetObject(PyExc_OSError, object)``. This function always returns " "``NULL``." msgstr "" +":exc:`OSError` を送出するための便利関数です。\n" +"*ierr* に ``0`` を指定して呼び出すと、代わりに :c:func:`!GetLastError` の呼び" +"出しで返されたエラーコードを使います。\n" +"Win32 関数 :c:func:`!FormatMessage` を呼び出し、*ierr* または :c:func:`!" +"GetLastError` で指定されたエラーコードの Windows による説明を取得します。\n" +"次に、:attr:`~OSError.winerror` 属性をエラーコード、:attr:`~OSError." +"strerror` 属性を対応するエラーメッセージ (:c:func:`!FormatMessage` から取得) " +"に設定した :exc:`OSError` オブジェクトを作成し、" +"``PyErr_SetObject(PyExc_OSError, object)`` を呼び出します。\n" +"この関数は常に ``NULL`` を返します。" -#: ../../c-api/exceptions.rst:234 ../../c-api/exceptions.rst:242 -#: ../../c-api/exceptions.rst:253 ../../c-api/exceptions.rst:263 -#: ../../c-api/exceptions.rst:271 ../../c-api/exceptions.rst:281 msgid "Availability" -msgstr "" +msgstr "利用可能な環境" #: ../../c-api/exceptions.rst:239 msgid "" @@ -343,7 +384,6 @@ msgstr "" ":c:func:`PyErr_SetFromWindowsErr` に似ていますが、送出する例外の型を指定する" "引数が追加されています。" -#: ../../c-api/exceptions.rst:247 msgid "" "Similar to :c:func:`PyErr_SetFromWindowsErr`, with the additional behavior " "that if *filename* is not ``NULL``, it is decoded from the filesystem " @@ -351,6 +391,10 @@ msgid "" "`OSError` as a third parameter to be used to define the :attr:`!filename` " "attribute of the exception instance." msgstr "" +":c:func:`PyErr_SetFromWindowsErr` と同様ですが、*filename* が ``NULL`` でなけ" +"れば、ファイルシステムのエンコーディング (:func:`os.fsdecode`) でデコード" +"し、:exc:`OSError` のコンストラクタに 3 番目の引数として渡します。\n" +"これは例外インスタンスの :attr:`!filename` 属性の定義に使われます。" #: ../../c-api/exceptions.rst:258 msgid "" @@ -468,7 +512,6 @@ msgstr "" "例外が送出された場合、呼び出し元は通常の例外処理を行います (例えば、保持して" "いた参照に対し :c:func:`Py_DECREF` を行い、エラー値を返します)。" -#: ../../c-api/exceptions.rst:352 msgid "" "Issue a warning message. The *category* argument is a warning category (see " "below) or ``NULL``; the *message* argument is a UTF-8 encoded string. " @@ -477,12 +520,13 @@ msgid "" "stack frame. A *stack_level* of 1 is the function calling :c:func:" "`PyErr_WarnEx`, 2 is the function above that, and so forth." msgstr "" -"警告メッセージを発行します。 *category* 引数は警告カテゴリ(以下を参照) かまた" -"は ``NULL`` で、 *message* 引数は UTF-8 エンコードされた文字列です。 " -"*stacklevel* はスタックフレームの数を示す正の整数です; 警告はそのスタックフ" -"レームの中の実行している行から発行されます。 *stacklevel* が 1 だと :c:func:" -"`PyErr_WarnEx` を呼び出している関数が、2 だとその上の関数が Warning の発行元" -"になります。" +"警告メッセージを発行します。\n" +"*category* 引数は警告カテゴリ (後述) または ``NULL``、*message* 引数は UTF-8 " +"でエンコードされた文字列です。\n" +"*stack_level* はスタックフレーム数を指定する正の値で、そのフレームで現在実行" +"中のコードの行を発行元として警告を発行します。\n" +"*stack_level* が 1 なら :c:func:`PyErr_WarnEx` を呼び出す関数、2 ならその 1 " +"つ上の関数、というようになります。" #: ../../c-api/exceptions.rst:359 msgid "" @@ -541,12 +585,14 @@ msgstr "" "るのに :c:func:`PyUnicode_FromFormat` を使用します。 *format* は ASCII にエン" "コードされた文字列です。" -#: ../../c-api/exceptions.rst:399 msgid "" "Function similar to :c:func:`PyErr_WarnFormat`, but *category* is :exc:" "`ResourceWarning` and it passes *source* to :class:`!warnings." "WarningMessage`." msgstr "" +":c:func:`PyErr_WarnFormat` と同様の関数ですが、*category* は :exc:" +"`ResourceWarning` で、*source* を :class:`!warnings.WarningMessage` に渡しま" +"す。" #: ../../c-api/exceptions.rst:406 msgid "Querying the error indicator" @@ -566,9 +612,10 @@ msgstr "" "します。あなたは戻り値への参照を持っていませんので、それに :c:func:" "`Py_DECREF` する必要はありません。" -#: ../../c-api/exceptions.rst:416 msgid "The caller must have an :term:`attached thread state`." msgstr "" +"呼び出し元には :term:`アタッチされたスレッド状態 ` が" +"必要です。" #: ../../c-api/exceptions.rst:420 msgid "" @@ -643,11 +690,12 @@ msgstr "" " PyErr_SetRaisedException(exc);\n" "}" -#: ../../c-api/exceptions.rst:459 msgid "" ":c:func:`PyErr_GetHandledException`, to save the exception currently being " "handled." msgstr "" +"現在処理中の例外を保存するには :c:func:`PyErr_GetHandledException` を使いま" +"す。" #: ../../c-api/exceptions.rst:467 msgid "" @@ -659,9 +707,8 @@ msgstr "" msgid "This call steals a reference to *exc*, which must be a valid exception." msgstr "" -#: ../../c-api/exceptions.rst:481 msgid "Use :c:func:`PyErr_GetRaisedException` instead." -msgstr "" +msgstr "代わりに :c:func:`PyErr_GetRaisedException` を使ってください。" #: ../../c-api/exceptions.rst:483 msgid "" @@ -677,13 +724,13 @@ msgstr "" "れのオブジェクトへの参照を持つことになります。型オブジェクトが ``NULL`` でな" "いときでさえ、その値とトレースバックオブジェクトは ``NULL`` かもしれません。" -#: ../../c-api/exceptions.rst:490 msgid "" "This function is normally only used by legacy code that needs to catch " "exceptions or save and restore the error indicator temporarily." msgstr "" +"通常、この関数を使うのは、例外の捕捉やエラーインジケータの一時的な保存と復元" +"が必要な従来のコードだけです。" -#: ../../c-api/exceptions.rst:495 msgid "" "{\n" " PyObject *type, *value, *traceback;\n" @@ -694,12 +741,18 @@ msgid "" " PyErr_Restore(type, value, traceback);\n" "}" msgstr "" +"{\n" +" PyObject *type, *value, *traceback;\n" +" PyErr_Fetch(&type, &value, &traceback);\n" +"\n" +" /* ... 他のエラーを発生させる可能性があるコード ... */\n" +"\n" +" PyErr_Restore(type, value, traceback);\n" +"}" -#: ../../c-api/exceptions.rst:509 msgid "Use :c:func:`PyErr_SetRaisedException` instead." -msgstr "" +msgstr "代わりに :c:func:`PyErr_SetRaisedException` を使ってください。" -#: ../../c-api/exceptions.rst:511 msgid "" "Set the error indicator from the three objects, *type*, *value*, and " "*traceback*, clearing the existing exception if one is set. If the objects " @@ -711,19 +764,36 @@ msgid "" "the call you no longer own these references. (If you don't understand this, " "don't use this function. I warned you.)" msgstr "" +"3 つのオブジェクト *type*、*value*、*traceback* からエラーインジケータを設定" +"し、既存の例外が設定されていればクリアします。\n" +"これらのオブジェクトが ``NULL`` の場合はエラーインジケータをクリアします。\n" +"``NULL`` の型と、``NULL`` でない値やトレースバックを組み合わせて渡してはいけ" +"ません。\n" +"例外の型はクラスでなければなりません。\n" +"無効な例外の型や値を渡してはいけません (これらの規則を破ると、後で気づきにく" +"い問題を引き起こします)。\n" +"この呼び出しは各オブジェクトへの参照を奪います。\n" +"呼び出し前には各オブジェクトへの参照を所有している必要があり、呼び出し後には" +"それらの参照を所有しなくなります。\n" +"(この意味が分からない場合は、この関数を使わないでください。\n" +"十分に注意してください。)" -#: ../../c-api/exceptions.rst:525 msgid "" "This function is normally only used by legacy code that needs to save and " "restore the error indicator temporarily. Use :c:func:`PyErr_Fetch` to save " "the current error indicator." msgstr "" +"通常、この関数を使うのは、エラーインジケータの一時的な保存と復元が必要な従来" +"のコードだけです。\n" +"現在のエラーインジケータを保存するには :c:func:`PyErr_Fetch` を使ってくださ" +"い。" -#: ../../c-api/exceptions.rst:534 msgid "" "Use :c:func:`PyErr_GetRaisedException` instead, to avoid any possible de-" "normalization." msgstr "" +"正規化が失われる可能性を避けるため、代わりに :c:func:" +"`PyErr_GetRaisedException` を使ってください。" #: ../../c-api/exceptions.rst:537 msgid "" @@ -741,27 +811,35 @@ msgstr "" "は何も起きません。遅延正規化はパフォーマンスを改善するために実装されていま" "す。" -#: ../../c-api/exceptions.rst:545 msgid "" "This function *does not* implicitly set the :attr:`~BaseException." "__traceback__` attribute on the exception value. If setting the traceback " "appropriately is desired, the following additional snippet is needed::" msgstr "" +"この関数は、例外の値に :attr:`~BaseException.__traceback__` 属性を暗黙に設定" +"することは *ありません*。\n" +"トレースバックを適切に設定するには、次のコードを追加する必要があります。 ::" -#: ../../c-api/exceptions.rst:550 msgid "" "if (tb != NULL) {\n" " PyException_SetTraceback(val, tb);\n" "}" msgstr "" +"if (tb != NULL) {\n" +" PyException_SetTraceback(val, tb);\n" +"}" -#: ../../c-api/exceptions.rst:557 msgid "" "Retrieve the active exception instance, as would be returned by :func:`sys." "exception`. This refers to an exception that was *already caught*, not to an " "exception that was freshly raised. Returns a new reference to the exception " "or ``NULL``. Does not modify the interpreter's exception state." msgstr "" +":func:`sys.exception` が返すような、現在有効な例外インスタンスを取得しま" +"す。\n" +"これは新たに送出された例外ではなく、*すでに捕捉された* 例外を指します。\n" +"例外への新しい参照、または ``NULL`` を返します。\n" +"インタープリタの例外状態は変更しません。" #: ../../c-api/exceptions.rst:564 msgid "" @@ -775,12 +853,14 @@ msgstr "" "例外の状態を元に戻す、もしくはクリアするには :c:func:" "`PyErr_SetHandledException` を使ってください。" -#: ../../c-api/exceptions.rst:573 msgid "" "Set the active exception, as known from ``sys.exception()``. This refers to " "an exception that was *already caught*, not to an exception that was freshly " "raised. To clear the exception state, pass ``NULL``." msgstr "" +"``sys.exception()`` で得られる、現在有効な例外を設定します。\n" +"これは新たに送出された例外ではなく、*すでに捕捉された* 例外を指します。\n" +"例外状態をクリアするには ``NULL`` を渡してください。" #: ../../c-api/exceptions.rst:580 msgid "" @@ -794,7 +874,6 @@ msgstr "" "例外の状態を取得するには :c:func:`PyErr_GetHandledException` を使ってくださ" "い。" -#: ../../c-api/exceptions.rst:589 msgid "" "Retrieve the old-style representation of the exception info, as known from :" "func:`sys.exc_info`. This refers to an exception that was *already caught*, " @@ -803,6 +882,13 @@ msgid "" "info state. This function is kept for backwards compatibility. Prefer " "using :c:func:`PyErr_GetHandledException`." msgstr "" +":func:`sys.exc_info` で得られる、従来の形式の例外情報を取得します。\n" +"これは新たに送出された例外ではなく、*すでに捕捉された* 例外を指します。\n" +"3 つのオブジェクトへの新しい参照を返しますが、いずれも ``NULL`` の場合があり" +"ます。\n" +"例外情報の状態は変更しません。\n" +"この関数は後方互換性のために残されています。\n" +":c:func:`PyErr_GetHandledException` を使うことを推奨します。" #: ../../c-api/exceptions.rst:598 msgid "" @@ -887,17 +973,20 @@ msgid "" "`KeyboardInterrupt` exception." msgstr "" -#: ../../c-api/exceptions.rst:673 msgid "" "Simulate the effect of a :c:macro:`!SIGINT` signal arriving. This is " "equivalent to ``PyErr_SetInterruptEx(SIGINT)``." msgstr "" +":c:macro:`!SIGINT` シグナルが到達したときの効果をシミュレートします。\n" +"``PyErr_SetInterruptEx(SIGINT)`` と等価です。" -#: ../../c-api/exceptions.rst:677 ../../c-api/exceptions.rst:704 msgid "" "This function is async-signal-safe. It can be called without an :term:" "`attached thread state` and from a C signal handler." msgstr "" +"この関数は非同期シグナルセーフです。\n" +":term:`アタッチされたスレッド状態 ` なしでも、C のシグ" +"ナルハンドラからでも呼び出せます。" #: ../../c-api/exceptions.rst:687 msgid "" @@ -909,26 +998,32 @@ msgstr "" "次に :c:func:`PyErr_CheckSignals` が呼ばれたとき、与えられたシグナル番号用の " "Python のシグナルハンドラが呼び出されます。" -#: ../../c-api/exceptions.rst:691 msgid "" "This function can be called by C code that sets up its own signal handling " "and wants Python signal handlers to be invoked as expected when an " "interruption is requested (for example when the user presses Ctrl-C to " "interrupt an operation)." msgstr "" +"この関数は、独自のシグナル処理を設定し、割り込みが要求されたとき (例えばユー" +"ザーが Ctrl-C を押して操作を中断するとき) に、Python のシグナルハンドラを期待" +"どおりに呼び出したい C コードから使えます。" -#: ../../c-api/exceptions.rst:696 msgid "" "If the given signal isn't handled by Python (it was set to :py:const:`signal." "SIG_DFL` or :py:const:`signal.SIG_IGN`), it will be ignored." msgstr "" +"指定されたシグナルを Python が処理しない場合 (:py:const:`signal.SIG_DFL` また" +"は :py:const:`signal.SIG_IGN` が設定されている場合)、そのシグナルは無視しま" +"す。" -#: ../../c-api/exceptions.rst:699 msgid "" "If *signum* is outside of the allowed range of signal numbers, ``-1`` is " "returned. Otherwise, ``0`` is returned. The error indicator is never " "changed by this function." msgstr "" +"*signum* が許されるシグナル番号の範囲外の場合は ``-1`` を返します。\n" +"それ以外の場合は ``0`` を返します。\n" +"この関数がエラーインジケータを変更することはありません。" #: ../../c-api/exceptions.rst:712 msgid "" @@ -962,7 +1057,6 @@ msgstr "Windowsで、この関数はソケットハンドルをサポートす msgid "Exception Classes" msgstr "例外クラス" -#: ../../c-api/exceptions.rst:730 msgid "" "This utility function creates and returns a new exception class. The *name* " "argument must be the name of the new exception, a C string of the form " @@ -970,13 +1064,13 @@ msgid "" "``NULL``. This creates a class object derived from :exc:`Exception` " "(accessible in C as :c:data:`PyExc_Exception`)." msgstr "" -"このユーティリティ関数は新しい例外クラスを作成して返します。 *name* 引数は新" -"しい例外の名前、 ``module.classname`` 形式の C文字列でなければならない。 " -"*base* と *dict* 引数は通常 ``NULL`` です。これはすべての例外のためのルート、" -"組み込み名 :exc:`Exception` (Cでは :c:data:`PyExc_Exception` としてアクセス可" -"能)をルートとして派生したクラスオブジェクトを作成します。" +"このユーティリティ関数は、新しい例外クラスを作成して返します。\n" +"*name* 引数は新しい例外の名前で、``module.classname`` 形式の C 文字列でなけれ" +"ばなりません。\n" +"*base* 引数と *dict* 引数は通常 ``NULL`` です。\n" +"これにより :exc:`Exception` (C では :c:data:`PyExc_Exception` としてアクセス" +"できます) から派生したクラスオブジェクトを作成します。" -#: ../../c-api/exceptions.rst:736 msgid "" "The :attr:`~type.__module__` attribute of the new class is set to the first " "part (up to the last dot) of the *name* argument, and the class name is set " @@ -985,6 +1079,12 @@ msgid "" "of classes. The *dict* argument can be used to specify a dictionary of class " "variables and methods." msgstr "" +"新しいクラスの :attr:`~type.__module__` 属性には *name* 引数の先頭部分 (最後" +"のドットまで) を設定し、クラス名には末尾の部分 (最後のドットの後) を設定しま" +"す。\n" +"*base* 引数を使うと別の基底クラスを指定でき、クラスを 1 つ、またはクラスのタ" +"プルを渡せます。\n" +"*dict* 引数を使うと、クラス変数とメソッドの辞書を指定できます。" #: ../../c-api/exceptions.rst:745 msgid "" @@ -1018,13 +1118,17 @@ msgstr "" "その例外に関する traceback に *tb* をセットします。クリアするには " "``Py_None`` を使用してください。" -#: ../../c-api/exceptions.rst:771 msgid "" "Return the context (another exception instance during whose handling *ex* " "was raised) associated with the exception as a new reference, as accessible " "from Python through the :attr:`~BaseException.__context__` attribute. If " "there is no context associated, this returns ``NULL``." msgstr "" +"例外に関連づけられたコンテキスト (*ex* が送出された時点で処理中だった別の例外" +"インスタンス) への新しい参照を返します。\n" +"Python の :attr:`~BaseException.__context__` 属性からアクセスできるものと同じ" +"です。\n" +"関連づけられたコンテキストがなければ ``NULL`` を返します。" #: ../../c-api/exceptions.rst:779 msgid "" @@ -1051,19 +1155,18 @@ msgid "" "exception instance or ``None``. This steals a reference to *cause*." msgstr "" -#: ../../c-api/exceptions.rst:798 msgid "" "The :attr:`~BaseException.__suppress_context__` attribute is implicitly set " "to ``True`` by this function." msgstr "" +"この関数は :attr:`~BaseException.__suppress_context__` 属性を暗黙に ``True`` " +"に設定します。" -#: ../../c-api/exceptions.rst:804 msgid "Return :attr:`~BaseException.args` of exception *ex*." -msgstr "" +msgstr "例外 *ex* の :attr:`~BaseException.args` を返します。" -#: ../../c-api/exceptions.rst:809 msgid "Set :attr:`~BaseException.args` of exception *ex* to *args*." -msgstr "" +msgstr "例外 *ex* の :attr:`~BaseException.args` を *args* に設定します。" #: ../../c-api/exceptions.rst:813 msgid "" @@ -1116,27 +1219,30 @@ msgstr "" "*start* は ``NULL`` であってはなりません。成功したら ``0`` を、失敗したら " "``-1`` を返します。" -#: ../../c-api/exceptions.rst:856 msgid "" "If the :attr:`UnicodeError.object` is an empty sequence, the resulting " "*start* is ``0``. Otherwise, it is clipped to ``[0, len(object) - 1]``." msgstr "" +":attr:`UnicodeError.object` が空のシーケンスであれば、結果の *start* は " +"``0`` です。\n" +"それ以外の場合は ``[0, len(object) - 1]`` の範囲に収まるように調整します。" -#: ../../c-api/exceptions.rst:859 msgid ":attr:`UnicodeError.start`" -msgstr "" +msgstr ":attr:`UnicodeError.start`" -#: ../../c-api/exceptions.rst:865 msgid "" "Set the *start* attribute of the given exception object to *start*. Return " "``0`` on success, ``-1`` on failure." msgstr "" +"指定された例外オブジェクトの *start* 属性を *start* に設定します。\n" +"成功すると ``0``、失敗すると ``-1`` を返します。" -#: ../../c-api/exceptions.rst:870 msgid "" "While passing a negative *start* does not raise an exception, the " "corresponding getters will not consider it as a relative offset." msgstr "" +"負の *start* を渡しても例外は送出しませんが、対応する取得関数はそれを相対オフ" +"セットとして扱いません。" #: ../../c-api/exceptions.rst:878 msgid "" @@ -1148,11 +1254,13 @@ msgstr "" "*end* は ``NULL`` であってはなりません。成功したら ``0`` を、失敗したら " "``-1`` を返します。" -#: ../../c-api/exceptions.rst:882 msgid "" "If the :attr:`UnicodeError.object` is an empty sequence, the resulting *end* " "is ``0``. Otherwise, it is clipped to ``[1, len(object)]``." msgstr "" +":attr:`UnicodeError.object` が空のシーケンスであれば、結果の *end* は ``0`` " +"です。\n" +"それ以外の場合は ``[1, len(object)]`` の範囲に収まるように調整します。" #: ../../c-api/exceptions.rst:889 msgid "" @@ -1162,9 +1270,8 @@ msgstr "" "渡された例外オブジェクトの *end* 属性を *end* に設定します。成功したら ``0`` " "を、失敗したら ``-1`` を返します。" -#: ../../c-api/exceptions.rst:892 msgid ":attr:`UnicodeError.end`" -msgstr "" +msgstr ":attr:`UnicodeError.end`" #: ../../c-api/exceptions.rst:898 msgid "Return the *reason* attribute of the given exception object." @@ -1182,7 +1289,6 @@ msgstr "" msgid "Recursion Control" msgstr "再帰の管理" -#: ../../c-api/exceptions.rst:913 msgid "" "These two functions provide a way to perform safe recursive calls at the C " "level, both in the core and in extension modules. They are needed if the " @@ -1191,17 +1297,25 @@ msgid "" "implementations because the :ref:`call protocol ` takes care of " "recursion handling." msgstr "" +"次の 2 つの関数は、コアと拡張モジュールの両方で、C レベルの再帰呼び出しを安全" +"に行う方法を提供します。\n" +"再帰するコードが、再帰の深さを自動的に追跡する Python コードを必ずしも呼び出" +"さない場合に必要です。\n" +"また、*tp_call* の実装では :ref:`呼び出しプロトコル ` が再帰を管理する" +"ため、これらの関数は不要です。" #: ../../c-api/exceptions.rst:922 msgid "Marks a point where a recursive C-level call is about to be performed." msgstr "C レベルの再帰呼び出しをしようとしているところに印を付けます。" -#: ../../c-api/exceptions.rst:924 msgid "" "The function then checks if the stack limit is reached. If this is the " "case, a :exc:`RecursionError` is set and a nonzero value is returned. " "Otherwise, zero is returned." msgstr "" +"この関数はスタックの上限に達したか確認します。\n" +"達していれば :exc:`RecursionError` を設定し、ゼロ以外の値を返します。\n" +"それ以外の場合はゼロを返します。" #: ../../c-api/exceptions.rst:928 msgid "" @@ -1213,11 +1327,12 @@ msgstr "" "して、再帰の深さの限界に達したことで送出される :exc:`RecursionError` のメッ" "セージに連結できるようにすべきです。" -#: ../../c-api/exceptions.rst:932 ../../c-api/exceptions.rst:940 msgid "" "This function is now also available in the :ref:`limited API `." msgstr "" +"この関数が :ref:`制限付き API ` でも利用できるようになりまし" +"た。" #: ../../c-api/exceptions.rst:937 msgid "" @@ -1803,9 +1918,8 @@ msgstr ":c:data:`!PyExc_WindowsError`" msgid "[2]_" msgstr "[2]_" -#: ../../c-api/exceptions.rst:1184 msgid "These aliases used to be separate exception types." -msgstr "これらのエイリアスは例外の種類を分けるために使われます。" +msgstr "これらの別名は、以前はそれぞれ独立した例外型でした。" #: ../../c-api/exceptions.rst:1187 ../../c-api/exceptions.rst:1248 msgid "Notes:" @@ -1939,9 +2053,8 @@ msgstr ":c:data:`PyExc_ResourceWarning`." msgid "This is a base class for other standard warning categories." msgstr "これは別の標準警告カテゴリのためのベースクラスです。" -#: ../../c-api/exceptions.rst:183 msgid "strerror (C function)" -msgstr "" +msgstr "strerror (C 関数)" #: ../../c-api/exceptions.rst:637 ../../c-api/exceptions.rst:668 #: ../../c-api/exceptions.rst:683 @@ -1953,9 +2066,8 @@ msgstr "module" msgid "signal" msgstr "signal" -#: ../../c-api/exceptions.rst:637 ../../c-api/exceptions.rst:668 msgid "SIGINT (C macro)" -msgstr "" +msgstr "SIGINT (C マクロ)" #: ../../c-api/exceptions.rst:637 ../../c-api/exceptions.rst:668 #: ../../c-api/exceptions.rst:683 diff --git a/c-api/file.po b/c-api/file.po index a92cf856f..30e24ac38 100644 --- a/c-api/file.po +++ b/c-api/file.po @@ -22,17 +22,16 @@ msgstr "" "Last-Translator: Takanori Suzuki , 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../c-api/file.rst:6 msgid "File Objects" msgstr "ファイルオブジェクト" -#: ../../c-api/file.rst:10 msgid "" "These APIs are a minimal emulation of the Python 2 C API for built-in file " "objects, which used to rely on the buffered I/O (:c:expr:`FILE*`) support " @@ -43,14 +42,16 @@ msgid "" "reporting in the interpreter; third-party code is advised to access the :mod:" "`io` APIs instead." msgstr "" -"これらの API は、 Python 2 の組み込みのファイルオブジェクトの C API を最低限" -"エミュレートするためのものです。それらは、標準 C ライブラリでサポートされてい" -"るバッファ付き I/O (:c:expr:`FILE*`) に頼るために使われます。 Python 3 では、" -"ファイルとストリームは新しい :mod:`io` モジュールを使用され、そこに OS の低レ" -"ベルなバッファ付き I/O の上にいくつかの層が定義されています。下で解説されてい" -"る関数は、それらの新しい API の便利な C ラッパーであり、インタプリタでの内部" -"的なエラー通知に向いています; サードパーティーのコードは代わりに :mod:`io` " -"の API を使うことが推奨されます。" +"これらの API は、C 標準ライブラリのバッファ付き I/O (:c:expr:`FILE*`) に依存" +"していた Python 2 の組み込みファイルオブジェクトの C API を、最小限エミュレー" +"トするものです。\n" +"Python 3 のファイルやストリームは新しい :mod:`io` モジュールを使います。\n" +"このモジュールは、OS の低水準なバッファなし I/O の上に複数の層を定義していま" +"す。\n" +"以下の関数は、これらの新しい API を包む便利な C ラッパーで、主にインタープリ" +"タ内部でのエラー報告を目的としています。\n" +"サードパーティのコードでは、代わりに :mod:`io` の API を使うことを推奨しま" +"す。" #: ../../c-api/file.rst:22 msgid "" @@ -71,15 +72,14 @@ msgstr "" "より包括的な引数の解説は、 :func:`io.open` 関数のドキュメントを参照してくださ" "い。" -#: ../../c-api/file.rst:31 msgid "" "Since Python streams have their own buffering layer, mixing them with OS-" "level file descriptors can produce various issues (such as unexpected " "ordering of data)." msgstr "" -"Python ストリームは自身のバッファリング層を持つため、ファイル記述子のOSレベル" -"のバッファリングと併用すると、様々な問題 (予期せぬデータ順) などを引き起こし" -"ます。" +"Python のストリームは独自のバッファリング層を持つため、OS レベルのファイル" +"ディスクリプタと混在させると、データの順序が予想外になるなどの問題が起きる可" +"能性があります。" #: ../../c-api/file.rst:35 msgid "Ignore *name* attribute." @@ -99,7 +99,6 @@ msgstr "" "は、ファイル記述子の値として返される整数でなければなりません。失敗すると例外" "を設定して ``-1`` を返します。" -#: ../../c-api/file.rst:52 msgid "" "Equivalent to ``p.readline([n])``, this function reads one line from the " "object *p*. *p* may be a file object or any object with a :meth:`~io.IOBase." @@ -111,14 +110,15 @@ msgid "" "regardless of length, but :exc:`EOFError` is raised if the end of the file " "is reached immediately." msgstr "" -"``p.readline([n])`` と同じで、この関数はオブジェクト *p* の各行を読み出しま" -"す。 *p* はファイルオブジェクトか、 :meth:`~io.IOBase.readline` メソッドを持" -"つ何らかのオブジェクトでかまいません。 *n* が ``0`` の場合、行の長さに関係な" -"く正確に 1 行だけ読み出します。 *n* が ``0`` より大きければ、 *n* バイト以上" -"のデータは読み出しません; 従って、行の一部だけが返される場合があります。 どち" -"らの場合でも、読み出し後すぐにファイルの終端に到達した場合には空文字列を 返し" -"ます。 *n* が ``0`` より小さければ、長さに関わらず 1 行だけを 読み出します" -"が、すぐにファイルの終端に到達した場合には :exc:`EOFError` を送出します。" +"``p.readline([n])`` に相当し、オブジェクト *p* から一行を読み込みます。\n" +"*p* はファイルオブジェクトでも、:meth:`~io.IOBase.readline` メソッドを持つ任" +"意のオブジェクトでも構いません。\n" +"*n* が ``0`` なら、長さにかかわらず一行を読み込みます。\n" +"*n* が ``0`` より大きければ、ファイルから読み込むのは最大 *n* バイトで、行の" +"一部だけを返す場合があります。\n" +"いずれの場合も、最初からファイルの終端に達していれば空文字列を返します。\n" +"一方、*n* が ``0`` より小さければ、長さにかかわらず一行を読み込みますが、最初" +"からファイルの終端に達している場合は :exc:`EOFError` を送出します。" #: ../../c-api/file.rst:65 msgid "" @@ -161,27 +161,24 @@ msgstr "" "ことが分かっている場合を除いては、フック関数の実行中に新しいモジュールをイン" "ポートするのは避けてください。" -#: ../../c-api/file.rst:85 msgid "" "Once a hook has been set, it cannot be removed or replaced, and later calls " "to :c:func:`PyFile_SetOpenCodeHook` will fail. On failure, the function " "returns -1 and sets an exception if the interpreter has been initialized." msgstr "" -"いったんフック関数が設定されたら、削除や置き換えもできず、後からの :c:func:" +"いったんフックを設定すると、削除も置き換えもできず、その後の :c:func:" "`PyFile_SetOpenCodeHook` の呼び出しは失敗します。\n" -"この関数が失敗したときは、インタープリタが初期化されていた場合、 -1 を返して" -"例外をセットします。" +"失敗すると -1 を返し、インタープリタが初期化済みの場合は例外も設定します。" #: ../../c-api/file.rst:89 msgid "This function is safe to call before :c:func:`Py_Initialize`." msgstr "この関数は :c:func:`Py_Initialize` より前に呼び出しても安全です。" -#: ../../c-api/file.rst:91 msgid "" "Raises an :ref:`auditing event ` ``setopencodehook`` with no " "arguments." msgstr "" -"引数無しで :ref:`監査イベント ` ``setopencodehook`` を送出します。 " +"引数無しで :ref:`監査イベント ` ``setopencodehook`` を送出します。" #: ../../c-api/file.rst:101 msgid "" diff --git a/c-api/float.po b/c-api/float.po index 176ab81de..3264aa1c3 100644 --- a/c-api/float.po +++ b/c-api/float.po @@ -19,26 +19,28 @@ msgstr "" "Last-Translator: Takeshi Nakazato, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" -#: ../../c-api/float.rst:6 msgid "Floating-Point Objects" -msgstr "" +msgstr "浮動小数点オブジェクト" -#: ../../c-api/float.rst:13 msgid "" "This subtype of :c:type:`PyObject` represents a Python floating-point object." msgstr "" +"この :c:type:`PyObject` のサブタイプは Python の浮動小数点オブジェクトを表し" +"ます。" -#: ../../c-api/float.rst:18 msgid "" "This instance of :c:type:`PyTypeObject` represents the Python floating-point " "type. This is the same object as :class:`float` in the Python layer." msgstr "" +"この :c:type:`PyTypeObject` のインスタンスは Python の浮動小数点型を表しま" +"す。\n" +"Python レベルの :class:`float` と同じオブジェクトです。" #: ../../c-api/float.rst:24 msgid "" @@ -71,7 +73,6 @@ msgstr "" "*v* から :c:type:`PyFloatObject` オブジェクトを生成して返します。\n" "失敗すると ``NULL`` を返します。" -#: ../../c-api/float.rst:47 msgid "" "Return a C :c:expr:`double` representation of the contents of *pyfloat*. If " "*pyfloat* is not a Python floating-point object but has a :meth:`~object." @@ -80,6 +81,14 @@ msgid "" "meth:`~object.__index__`. This method returns ``-1.0`` upon failure, so one " "should call :c:func:`PyErr_Occurred` to check for errors." msgstr "" +"``pyfloat`` の値を C の :c:expr:`double` で返します。\n" +"``pyfloat`` が Python の浮動小数点オブジェクトでなく、:meth:`~object." +"__float__` メソッドを持つ場合は、まずそのメソッドを呼び出して ``pyfloat`` を " +"float に変換します。\n" +":meth:`!__float__` が定義されていなければ :meth:`~object.__index__` を使いま" +"す。\n" +"失敗した場合は ``-1.0`` を返すので、:c:func:`PyErr_Occurred` を呼び出してエ" +"ラーの有無を確認する必要があります。" #: ../../c-api/float.rst:54 msgid "Use :meth:`~object.__index__` if available." @@ -102,13 +111,12 @@ msgstr "" "float の精度、最小値、最大値に関する情報を含む structseq インスタンスを返しま" "す。これは、 :file:`float.h` ファイルの薄いラッパーです。" -#: ../../c-api/float.rst:73 msgid "" "Return the maximum representable finite float *DBL_MAX* as C :c:expr:" "`double`." msgstr "" -"float の表現できる最大限解値 *DBL_MAX* を C の :c:expr:`double` 型で返しま" -"す。" +"表現できる最大の有限の浮動小数点数 *DBL_MAX* を C の :c:expr:`double` として" +"返します。" #: ../../c-api/float.rst:78 msgid "" @@ -117,9 +125,8 @@ msgstr "" "float の正規化された最小の正の値 *DBL_MIN* を C の :c:expr:`double` 型で返し" "ます。" -#: ../../c-api/float.rst:82 msgid "Pack and Unpack functions" -msgstr "" +msgstr "パック関数とアンパック関数" #: ../../c-api/float.rst:84 msgid "" @@ -156,9 +163,8 @@ msgid "" "What happens in such cases is partly accidental (alas)." msgstr "" -#: ../../c-api/float.rst:110 msgid "Pack functions" -msgstr "" +msgstr "パック関数" #: ../../c-api/float.rst:112 msgid "" @@ -170,11 +176,12 @@ msgid "" "to ``1`` on big endian processor, or ``0`` on little endian processor." msgstr "" -#: ../../c-api/float.rst:119 msgid "" "Return value: ``0`` if all is OK, ``-1`` if error (and an exception is set, " "most likely :exc:`OverflowError`)." msgstr "" +"戻り値は、成功した場合は ``0``、エラーの場合は ``-1`` です (例外も設定され、" +"通常は :exc:`OverflowError` です)。" #: ../../c-api/float.rst:122 msgid "There are two problems on non-IEEE platforms:" @@ -188,21 +195,17 @@ msgstr "" msgid "``-0.0`` and ``+0.0`` produce the same bytes string." msgstr "" -#: ../../c-api/float.rst:129 msgid "Pack a C double as the IEEE 754 binary16 half-precision format." -msgstr "" +msgstr "C の double を IEEE 754 binary16 半精度形式にパックします。" -#: ../../c-api/float.rst:133 msgid "Pack a C double as the IEEE 754 binary32 single precision format." -msgstr "" +msgstr "C の double を IEEE 754 binary32 単精度形式にパックします。" -#: ../../c-api/float.rst:137 msgid "Pack a C double as the IEEE 754 binary64 double precision format." -msgstr "" +msgstr "C の double を IEEE 754 binary64 倍精度形式にパックします。" -#: ../../c-api/float.rst:141 msgid "Unpack functions" -msgstr "" +msgstr "アンパック関数" #: ../../c-api/float.rst:143 msgid "" @@ -214,12 +217,14 @@ msgid "" "processor, or ``0`` on little endian processor." msgstr "" -#: ../../c-api/float.rst:150 msgid "" "Return value: The unpacked double. On error, this is ``-1.0`` and :c:func:" "`PyErr_Occurred` is true (and an exception is set, most likely :exc:" "`OverflowError`)." msgstr "" +"戻り値は、アンパックした double です。\n" +"エラーの場合は ``-1.0`` を返し、:c:func:`PyErr_Occurred` が真になります (例外" +"も設定され、通常は :exc:`OverflowError` です)。" #: ../../c-api/float.rst:154 msgid "" @@ -227,17 +232,14 @@ msgid "" "that represents a NaN or infinity." msgstr "" -#: ../../c-api/float.rst:159 msgid "Unpack the IEEE 754 binary16 half-precision format as a C double." -msgstr "" +msgstr "IEEE 754 binary16 半精度形式を C の double にアンパックします。" -#: ../../c-api/float.rst:163 msgid "Unpack the IEEE 754 binary32 single precision format as a C double." -msgstr "" +msgstr "IEEE 754 binary32 単精度形式を C の double にアンパックします。" -#: ../../c-api/float.rst:167 msgid "Unpack the IEEE 754 binary64 double precision format as a C double." -msgstr "" +msgstr "IEEE 754 binary64 倍精度形式を C の double にアンパックします。" #: ../../c-api/float.rst:8 msgid "object" diff --git a/c-api/frame.po b/c-api/frame.po index 9aa28c98b..88e259337 100644 --- a/c-api/frame.po +++ b/c-api/frame.po @@ -17,10 +17,10 @@ msgstr "" "Last-Translator: Arihiro TAKASE, 2023\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../c-api/frame.rst:4 @@ -33,127 +33,123 @@ msgstr "" "フレームオブジェクトを記述する際に用いられる、オブジェクトを表す C 構造体で" "す。" -#: ../../c-api/frame.rst:10 msgid "There are no public members in this structure." -msgstr "" +msgstr "この構造体には公開メンバはありません。" -#: ../../c-api/frame.rst:12 msgid "" "The members of this structure were removed from the public C API. Refer to " "the :ref:`What's New entry ` for details." msgstr "" +"この構造体のメンバは公開 C API から削除されました。\n" +"詳細は :ref:`What's New の該当項目 ` を参照してく" +"ださい。" -#: ../../c-api/frame.rst:17 msgid "" "The :c:func:`PyEval_GetFrame` and :c:func:`PyThreadState_GetFrame` functions " "can be used to get a frame object." msgstr "" +"フレームオブジェクトは :c:func:`PyEval_GetFrame` と :c:func:" +"`PyThreadState_GetFrame` 関数で取得できます。" -#: ../../c-api/frame.rst:20 msgid "See also :ref:`Reflection `." -msgstr "" +msgstr ":ref:`リフレクション ` も参照してください。" -#: ../../c-api/frame.rst:24 msgid "" "The type of frame objects. It is the same object as :py:class:`types." "FrameType` in the Python layer." msgstr "" +"フレームオブジェクトの型です。\n" +"Python レベルの :py:class:`types.FrameType` と同じオブジェクトです。" -#: ../../c-api/frame.rst:29 msgid "" "Previously, this type was only available after including ````." msgstr "" +"以前は、この型を使うには ```` をインクルードする必要がありまし" +"た。" -#: ../../c-api/frame.rst:34 msgid "Return non-zero if *obj* is a frame object." -msgstr "" +msgstr "``obj`` がフレームオブジェクトの場合に非ゼロを返します。" -#: ../../c-api/frame.rst:38 msgid "" "Previously, this function was only available after including ````." msgstr "" +"以前は、この関数を使うには ```` をインクルードする必要がありま" +"した。" -#: ../../c-api/frame.rst:43 msgid "Get the *frame* next outer frame." -msgstr "" +msgstr "``frame`` の一つ外側のフレームを取得します。" #: ../../c-api/frame.rst:45 msgid "" "Return a :term:`strong reference`, or ``NULL`` if *frame* has no outer frame." msgstr "" -#: ../../c-api/frame.rst:53 msgid "Get the *frame*'s :attr:`~frame.f_builtins` attribute." -msgstr "" +msgstr "``frame`` の :attr:`~frame.f_builtins` 属性を取得します。" -#: ../../c-api/frame.rst:55 ../../c-api/frame.rst:86 msgid "Return a :term:`strong reference`. The result cannot be ``NULL``." msgstr "" +":term:`強参照 ` を返します。\n" +"結果が ``NULL`` になることはありません。" -#: ../../c-api/frame.rst:62 msgid "Get the *frame* code." -msgstr "" +msgstr "``frame`` のコードを取得します。" -#: ../../c-api/frame.rst:64 ../../c-api/frame.rst:130 msgid "Return a :term:`strong reference`." -msgstr "" +msgstr ":term:`強参照 ` を返します。" -#: ../../c-api/frame.rst:66 msgid "The result (frame code) cannot be ``NULL``." -msgstr "" +msgstr "結果 (フレームのコード) が ``NULL`` になることはありません。" -#: ../../c-api/frame.rst:73 msgid "" "Get the generator, coroutine, or async generator that owns this frame, or " "``NULL`` if this frame is not owned by a generator. Does not raise an " "exception, even if the return value is ``NULL``." msgstr "" +"このフレームを所有するジェネレータ、コルーチン、非同期ジェネレータを取得しま" +"す。\n" +"ジェネレータに所有されていない場合は ``NULL`` を返します。\n" +"戻り値が ``NULL`` であっても例外は送出しません。" -#: ../../c-api/frame.rst:77 msgid "Return a :term:`strong reference`, or ``NULL``." -msgstr "" +msgstr ":term:`強参照 ` または ``NULL`` を返します。" -#: ../../c-api/frame.rst:84 msgid "Get the *frame*'s :attr:`~frame.f_globals` attribute." -msgstr "" +msgstr "``frame`` の :attr:`~frame.f_globals` 属性を取得します。" -#: ../../c-api/frame.rst:93 msgid "Get the *frame*'s :attr:`~frame.f_lasti` attribute." -msgstr "" +msgstr "``frame`` の :attr:`~frame.f_lasti` 属性を取得します。" #: ../../c-api/frame.rst:95 msgid "Returns -1 if ``frame.f_lasti`` is ``None``." msgstr "" -#: ../../c-api/frame.rst:102 msgid "Get the variable *name* of *frame*." -msgstr "" +msgstr "``frame`` の変数 ``name`` を取得します。" -#: ../../c-api/frame.rst:104 msgid "Return a :term:`strong reference` to the variable value on success." msgstr "" +"成功した場合は、変数の値への :term:`強参照 ` を返します。" -#: ../../c-api/frame.rst:105 msgid "" "Raise :exc:`NameError` and return ``NULL`` if the variable does not exist." msgstr "" +"変数が存在しない場合は :exc:`NameError` を送出し、``NULL`` を返します。" -#: ../../c-api/frame.rst:106 msgid "Raise an exception and return ``NULL`` on error." -msgstr "" +msgstr "エラーの場合は例外を送出し、``NULL`` を返します。" -#: ../../c-api/frame.rst:108 msgid "*name* type must be a :class:`str`." -msgstr "" +msgstr "``name`` の型は :class:`str` でなければなりません。" -#: ../../c-api/frame.rst:115 msgid "" "Similar to :c:func:`PyFrame_GetVar`, but the variable name is a C string " "encoded in UTF-8." msgstr "" +":c:func:`PyFrame_GetVar` と同様ですが、変数名は UTF-8 でエンコードした C 文字" +"列です。" -#: ../../c-api/frame.rst:123 msgid "" "Get the *frame*'s :attr:`~frame.f_locals` attribute. If the frame refers to " "an :term:`optimized scope`, this returns a write-through proxy object that " @@ -161,6 +157,12 @@ msgid "" "`exec`, :func:`eval`) it returns the mapping representing the frame locals " "directly (as described for :func:`locals`)." msgstr "" +"``frame`` の :attr:`~frame.f_locals` 属性を取得します。\n" +"フレームが :term:`最適化されたスコープ ` を参照する場合、" +"ローカル変数の変更を可能にする、書き込みを反映するプロキシオブジェクトを返し" +"ます。\n" +"それ以外の場合 (クラス、モジュール、:func:`exec`、:func:`eval`) は、フレーム" +"のローカル変数を表すマッピングを直接返します (:func:`locals` の説明を参照)。" #: ../../c-api/frame.rst:134 msgid "" @@ -185,39 +187,35 @@ msgid "" "to date with the live local variables in the frame itself." msgstr "" -#: ../../c-api/frame.rst:154 msgid "See :pep:`667` for more information." -msgstr "" +msgstr "詳細は :pep:`667` を参照してください。" -#: ../../c-api/frame.rst:158 msgid "The type of frame :func:`locals` proxy objects." -msgstr "" +msgstr "フレームの :func:`locals` プロキシオブジェクトの型。" -#: ../../c-api/frame.rst:162 msgid "Return non-zero if *obj* is a frame :func:`locals` proxy." -msgstr "" +msgstr "``obj`` がフレームの :func:`locals` プロキシの場合に非ゼロを返します。" #: ../../c-api/frame.rst:165 msgid "Internal Frames" msgstr "" -#: ../../c-api/frame.rst:167 msgid "Unless using :pep:`523`, you will not need this." -msgstr "" +msgstr ":pep:`523` を使わない限り、これは必要ありません。" -#: ../../c-api/frame.rst:171 msgid "The interpreter's internal frame representation." -msgstr "" +msgstr "インタープリタ内部でのフレーム表現。" -#: ../../c-api/frame.rst:177 msgid "Return a :term:`strong reference` to the code object for the frame." msgstr "" +"フレームのコードオブジェクトへの :term:`強参照 ` を返しま" +"す。" -#: ../../c-api/frame.rst:184 msgid "Return the byte offset into the last executed instruction." -msgstr "" +msgstr "最後に実行した命令のバイトオフセットを返します。" -#: ../../c-api/frame.rst:191 msgid "" "Return the currently executing line number, or -1 if there is no line number." msgstr "" +"現在実行している行の番号を返します。\n" +"行番号がない場合は -1 を返します。" diff --git a/c-api/function.po b/c-api/function.po index b64df67ec..23f2c075f 100644 --- a/c-api/function.po +++ b/c-api/function.po @@ -17,10 +17,10 @@ msgstr "" "Last-Translator: Taichi Haradaguchi, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../c-api/function.rst:6 @@ -98,18 +98,21 @@ msgstr "関数オブジェクト *op* に関連付けられたコードオブジ msgid "Return the globals dictionary associated with the function object *op*." msgstr "関数オブジェクト *op* に関連付けられたglobals辞書を返します。" -#: ../../c-api/function.rst:67 msgid "" "Return a :term:`borrowed reference` to the :attr:`~function.__module__` " "attribute of the :ref:`function object ` *op*. It can be " "*NULL*." msgstr "" +":ref:`関数オブジェクト ` ``op`` の :attr:`~function." +"__module__` 属性への :term:`借用参照 ` を返します。\n" +"``NULL`` の場合もあります。" -#: ../../c-api/function.rst:71 msgid "" "This is normally a :class:`string ` containing the module name, but can " "be set to any other object by Python code." msgstr "" +"通常はモジュール名を含む :class:`文字列 ` ですが、Python コードで任意の" +"別のオブジェクトに設定できます。" #: ../../c-api/function.rst:77 msgid "" @@ -132,15 +135,16 @@ msgstr "" msgid "Raises :exc:`SystemError` and returns ``-1`` on failure." msgstr "失敗した時は、 :exc:`SystemError` を発生させ、 ``-1`` を返します。" -#: ../../c-api/function.rst:91 msgid "Set the vectorcall field of a given function object *func*." msgstr "" +"指定された関数オブジェクト ``func`` の vectorcall フィールドを設定します。" -#: ../../c-api/function.rst:93 msgid "" "Warning: extensions using this API must preserve the behavior of the " "unaltered (default) vectorcall function!" msgstr "" +"警告: この API を使う拡張は、変更前の (デフォルトの) vectorcall 関数の動作を" +"維持しなければなりません。" #: ../../c-api/function.rst:100 msgid "" @@ -175,63 +179,67 @@ msgstr "" "関数オブジェクト *op* のアノテーションを設定します。\n" "*annotations* は辞書か、``Py_None`` でなければなりません。" -#: ../../c-api/function.rst:128 msgid "" "Register *callback* as a function watcher for the current interpreter. " "Return an ID which may be passed to :c:func:`PyFunction_ClearWatcher`. In " "case of error (e.g. no more watcher IDs available), return ``-1`` and set an " "exception." msgstr "" +"現在のインタープリタの関数ウォッチャーとして ``callback`` を登録します。\n" +":c:func:`PyFunction_ClearWatcher` に渡せる ID を返します。\n" +"エラーの場合 (例えば利用可能なウォッチャー ID がない場合) は、例外を設定して " +"``-1`` を返します。" -#: ../../c-api/function.rst:138 msgid "" "Clear watcher identified by *watcher_id* previously returned from :c:func:" "`PyFunction_AddWatcher` for the current interpreter. Return ``0`` on " "success, or ``-1`` and set an exception on error (e.g. if the given " "*watcher_id* was never registered.)" msgstr "" +"現在のインタープリタについて、:c:func:`PyFunction_AddWatcher` が以前返した " +"``watcher_id`` で識別されるウォッチャーを解除します。\n" +"成功した場合は ``0`` を返します。\n" +"エラーの場合 (例えば指定した ``watcher_id`` が登録されていない場合) は、例外" +"を設定して ``-1`` を返します。" -#: ../../c-api/function.rst:148 msgid "Enumeration of possible function watcher events:" -msgstr "" +msgstr "関数ウォッチャーで発生し得るイベントの列挙型。" -#: ../../c-api/function.rst:150 msgid "``PyFunction_EVENT_CREATE``" -msgstr "" +msgstr "``PyFunction_EVENT_CREATE``" -#: ../../c-api/function.rst:151 msgid "``PyFunction_EVENT_DESTROY``" -msgstr "" +msgstr "``PyFunction_EVENT_DESTROY``" -#: ../../c-api/function.rst:152 msgid "``PyFunction_EVENT_MODIFY_CODE``" -msgstr "" +msgstr "``PyFunction_EVENT_MODIFY_CODE``" -#: ../../c-api/function.rst:153 msgid "``PyFunction_EVENT_MODIFY_DEFAULTS``" -msgstr "" +msgstr "``PyFunction_EVENT_MODIFY_DEFAULTS``" -#: ../../c-api/function.rst:154 msgid "``PyFunction_EVENT_MODIFY_KWDEFAULTS``" -msgstr "" +msgstr "``PyFunction_EVENT_MODIFY_KWDEFAULTS``" -#: ../../c-api/function.rst:161 msgid "Type of a function watcher callback function." -msgstr "" +msgstr "関数ウォッチャーのコールバック関数の型。" -#: ../../c-api/function.rst:163 msgid "" "If *event* is ``PyFunction_EVENT_CREATE`` or ``PyFunction_EVENT_DESTROY`` " "then *new_value* will be ``NULL``. Otherwise, *new_value* will hold a :term:" "`borrowed reference` to the new value that is about to be stored in *func* " "for the attribute that is being modified." msgstr "" +"``event`` が ``PyFunction_EVENT_CREATE`` または ``PyFunction_EVENT_DESTROY`` " +"の場合、``new_value`` は ``NULL`` です。\n" +"それ以外の場合、``new_value`` は ``func`` の変更対象の属性に格納しようとして" +"いる新しい値への :term:`借用参照 ` です。" -#: ../../c-api/function.rst:168 msgid "" "The callback may inspect but must not modify *func*; doing so could have " "unpredictable effects, including infinite recursion." msgstr "" +"コールバックは ``func`` を調べても構いませんが、変更してはいけません。\n" +"変更すると、無限再帰など予測できない結果を招く可能性があります。" #: ../../c-api/function.rst:171 msgid "" @@ -253,14 +261,16 @@ msgid "" "later, any watcher callbacks active at that time will be called again." msgstr "" -#: ../../c-api/function.rst:185 msgid "" "If the callback sets an exception, it must return ``-1``; this exception " "will be printed as an unraisable exception using :c:func:" "`PyErr_WriteUnraisable`. Otherwise it should return ``0``." msgstr "" +"コールバックが例外を設定した場合は ``-1`` を返す必要があります。\n" +"その例外は、:c:func:`PyErr_WriteUnraisable` を使って送出できない例外として表" +"示されます。\n" +"それ以外の場合は ``0`` を返してください。" -#: ../../c-api/function.rst:189 msgid "" "There may already be a pending exception set on entry to the callback. In " "this case, the callback should return ``0`` with the same exception still " @@ -268,6 +278,11 @@ msgid "" "exception unless it saves and clears the exception state first, and restores " "it before returning." msgstr "" +"コールバックに入る時点で、すでに処理待ちの例外が設定されている場合がありま" +"す。\n" +"その場合、コールバックは同じ例外を設定したまま ``0`` を返すべきです。\n" +"そのため、例外を設定し得る別の API を呼び出す場合は、まず例外の状態を保存して" +"クリアし、戻る前に復元する必要があります。" #: ../../c-api/function.rst:8 msgid "object" diff --git a/c-api/gcsupport.po b/c-api/gcsupport.po index 869f067a2..1527cf60b 100644 --- a/c-api/gcsupport.po +++ b/c-api/gcsupport.po @@ -16,10 +16,10 @@ msgstr "" "Last-Translator: tomo, 2025\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../c-api/gcsupport.rst:6 @@ -42,7 +42,6 @@ msgstr "" "参照だけを記憶するような型では、ガベージコレクションに際して特別これといった" "サポートを提供する必要はありません。" -#: ../../c-api/gcsupport.rst:15 msgid "" "To create a container type, the :c:member:`~PyTypeObject.tp_flags` field of " "the type object must include the :c:macro:`Py_TPFLAGS_HAVE_GC` and provide " @@ -50,10 +49,14 @@ msgid "" "instances of the type are mutable, a :c:member:`~PyTypeObject.tp_clear` " "implementation must also be provided." msgstr "" +"コンテナ型を作成するには、型オブジェクトの :c:member:`~PyTypeObject." +"tp_flags` フィールドに :c:macro:`Py_TPFLAGS_HAVE_GC` を含め、:c:member:" +"`~PyTypeObject.tp_traverse` ハンドラを実装する必要があります。\n" +"型のインスタンスが変更可能な場合は、:c:member:`~PyTypeObject.tp_clear` も実装" +"する必要があります。" -#: ../../c-api/gcsupport.rst:21 msgid ":c:macro:`Py_TPFLAGS_HAVE_GC`" -msgstr "" +msgstr ":c:macro:`Py_TPFLAGS_HAVE_GC`" #: ../../c-api/gcsupport.rst:22 msgid "" @@ -70,11 +73,12 @@ msgid "Constructors for container types must conform to two rules:" msgstr "" "コンテナ型のコンストラクタは以下の二つの規則に適合しなければなりません:" -#: ../../c-api/gcsupport.rst:28 msgid "" "The memory for the object must be allocated using :c:macro:`PyObject_GC_New` " "or :c:macro:`PyObject_GC_NewVar`." msgstr "" +"オブジェクトのメモリは :c:macro:`PyObject_GC_New` または :c:macro:" +"`PyObject_GC_NewVar` で割り当てなければなりません。" #: ../../c-api/gcsupport.rst:31 msgid "" @@ -113,7 +117,6 @@ msgid "" "subclass or subclasses." msgstr "" -#: ../../c-api/gcsupport.rst:47 msgid "" "When calling :c:func:`PyType_Ready` or some of the APIs that indirectly call " "it like :c:func:`PyType_FromSpecWithBases` or :c:func:`PyType_FromSpec` the " @@ -123,87 +126,106 @@ msgid "" "implements the garbage collector protocol and the child class does *not* " "include the :c:macro:`Py_TPFLAGS_HAVE_GC` flag." msgstr "" +":c:func:`PyType_Ready`、または :c:func:`PyType_FromSpecWithBases` や :c:func:" +"`PyType_FromSpec` など間接的にこの関数を呼び出す API を使った際、\n" +"ガベージコレクタのプロトコルを実装するクラスを継承しており、派生クラスに :c:" +"macro:`Py_TPFLAGS_HAVE_GC` フラグが含まれて *いない* 場合は、\n" +"インタープリタが :c:member:`~PyTypeObject.tp_flags`、:c:member:" +"`~PyTypeObject.tp_traverse`、:c:member:`~PyTypeObject.tp_clear` フィールドを" +"自動的に設定します。" -#: ../../c-api/gcsupport.rst:57 msgid "" "Analogous to :c:macro:`PyObject_New` but for container objects with the :c:" "macro:`Py_TPFLAGS_HAVE_GC` flag set." msgstr "" +":c:macro:`PyObject_New` と同様ですが、:c:macro:`Py_TPFLAGS_HAVE_GC` フラグが" +"設定されたコンテナオブジェクト用です。" -#: ../../c-api/gcsupport.rst:60 ../../c-api/gcsupport.rst:84 msgid "" "Do not call this directly to allocate memory for an object; call the type's :" "c:member:`~PyTypeObject.tp_alloc` slot instead." msgstr "" +"オブジェクトのメモリを割り当てるためにこれを直接呼び出してはいけません。\n" +"代わりに型の :c:member:`~PyTypeObject.tp_alloc` スロットを呼び出してくださ" +"い。" -#: ../../c-api/gcsupport.rst:63 ../../c-api/gcsupport.rst:87 msgid "" "When populating a type's :c:member:`~PyTypeObject.tp_alloc` slot, :c:func:" "`PyType_GenericAlloc` is preferred over a custom function that simply calls " "this macro." msgstr "" +"型の :c:member:`~PyTypeObject.tp_alloc` スロットには、このマクロを呼び出すだ" +"けの独自の関数よりも :c:func:`PyType_GenericAlloc` を設定することが推奨されま" +"す。" -#: ../../c-api/gcsupport.rst:67 ../../c-api/gcsupport.rst:91 msgid "" "Memory allocated by this macro must be freed with :c:func:`PyObject_GC_Del` " "(usually called via the object's :c:member:`~PyTypeObject.tp_free` slot)." msgstr "" +"このマクロで割り当てたメモリは :c:func:`PyObject_GC_Del` で解放しなければなり" +"ません (通常はオブジェクトの :c:member:`~PyTypeObject.tp_free` スロットを介し" +"て呼び出します)。" -#: ../../c-api/gcsupport.rst:73 ../../c-api/gcsupport.rst:97 msgid ":c:func:`PyObject_GC_Del`" -msgstr "" +msgstr ":c:func:`PyObject_GC_Del`" -#: ../../c-api/gcsupport.rst:74 msgid ":c:macro:`PyObject_New`" -msgstr "" +msgstr ":c:macro:`PyObject_New`" -#: ../../c-api/gcsupport.rst:75 ../../c-api/gcsupport.rst:99 -#: ../../c-api/gcsupport.rst:193 msgid ":c:func:`PyType_GenericAlloc`" -msgstr "" +msgstr ":c:func:`PyType_GenericAlloc`" #: ../../c-api/gcsupport.rst:76 ../../c-api/gcsupport.rst:100 msgid ":c:member:`~PyTypeObject.tp_alloc`" msgstr ":c:member:`~PyTypeObject.tp_alloc`" -#: ../../c-api/gcsupport.rst:81 msgid "" "Analogous to :c:macro:`PyObject_NewVar` but for container objects with the :" "c:macro:`Py_TPFLAGS_HAVE_GC` flag set." msgstr "" +":c:macro:`PyObject_NewVar` と同様ですが、:c:macro:`Py_TPFLAGS_HAVE_GC` フラグ" +"が設定されたコンテナオブジェクト用です。" -#: ../../c-api/gcsupport.rst:98 msgid ":c:macro:`PyObject_NewVar`" -msgstr "" +msgstr ":c:macro:`PyObject_NewVar`" -#: ../../c-api/gcsupport.rst:105 msgid "" "Analogous to :c:macro:`PyObject_GC_New` but allocates *extra_size* bytes at " "the end of the object (at offset :c:member:`~PyTypeObject.tp_basicsize`). " "The allocated memory is initialized to zeros, except for the :c:type:`Python " "object header `." msgstr "" +":c:macro:`PyObject_GC_New` と同様ですが、オブジェクトの末尾 (オフセット :c:" +"member:`~PyTypeObject.tp_basicsize`) に *extra_size* バイトを割り当てます。\n" +"割り当てたメモリは :c:type:`Python オブジェクトのヘッダー ` を除い" +"てゼロで初期化されます。" -#: ../../c-api/gcsupport.rst:111 msgid "" "The extra data will be deallocated with the object, but otherwise it is not " "managed by Python." msgstr "" +"追加データはオブジェクトとともに解放されますが、それ以外の管理は Python では" +"行いません。" -#: ../../c-api/gcsupport.rst:114 msgid "" "Memory allocated by this function must be freed with :c:func:" "`PyObject_GC_Del` (usually called via the object's :c:member:`~PyTypeObject." "tp_free` slot)." msgstr "" +"この関数で割り当てたメモリは :c:func:`PyObject_GC_Del` で解放しなければなりま" +"せん (通常はオブジェクトの :c:member:`~PyTypeObject.tp_free` スロットを介して" +"呼び出します)。" -#: ../../c-api/gcsupport.rst:119 msgid "" "The function is marked as unstable because the final mechanism for reserving " "extra data after an instance is not yet decided. For allocating a variable " "number of fields, prefer using :c:type:`PyVarObject` and :c:member:" "`~PyTypeObject.tp_itemsize` instead." msgstr "" +"インスタンスの後ろに追加データを確保する最終的な仕組みが未定のため、この関数" +"は不安定とされています。\n" +"可変個数のフィールドを割り当てるには、代わりに :c:type:`PyVarObject` と :c:" +"member:`~PyTypeObject.tp_itemsize` を使うことが推奨されます。" #: ../../c-api/gcsupport.rst:130 msgid "" @@ -212,13 +234,14 @@ msgid "" "failure." msgstr "" -#: ../../c-api/gcsupport.rst:134 msgid "" "*op* must be of type :c:expr:`PyVarObject *` and must not be tracked by the " "collector yet. *newsize* must be of type :c:type:`Py_ssize_t`." msgstr "" +"*op* の型は :c:expr:`PyVarObject *` でなければならず、まだコレクタの追跡対象" +"になっていてはいけません。\n" +"*newsize* の型は :c:type:`Py_ssize_t` でなければなりません。" -#: ../../c-api/gcsupport.rst:141 msgid "" "Adds the object *op* to the set of container objects tracked by the " "collector. The collector can run at unexpected times so objects must be " @@ -226,74 +249,78 @@ msgid "" "followed by the :c:member:`~PyTypeObject.tp_traverse` handler become valid, " "usually near the end of the constructor." msgstr "" -"オブジェクト *op* を、コレクタによって追跡されるオブジェクトの集合に追加しま" -"す。コレクタは何回動くのかは予想できないので、追跡されている間はオブジェクト" -"は正しい状態でいなければなりません。 :c:member:`~PyTypeObject.tp_traverse` の" -"対象となる全てのフィールドが正しい状態になってすぐに、たいていはコンストラク" -"タの末尾付近で、呼び出すべきです。" +"オブジェクト *op* を、コレクタが追跡するコンテナオブジェクトの集合に追加しま" +"す。\n" +"コレクタは予期しないタイミングで実行される可能性があるため、追跡中のオブジェ" +"クトは有効な状態でなければなりません。\n" +":c:member:`~PyTypeObject.tp_traverse` ハンドラがたどるすべてのフィールドが有" +"効になった時点で、通常はコンストラクタの終わり近くで呼び出してください。" -#: ../../c-api/gcsupport.rst:150 msgid "" "Returns non-zero if the object implements the garbage collector protocol, " "otherwise returns 0." msgstr "" +"オブジェクトがガベージコレクタのプロトコルを実装している場合はゼロ以外、そう" +"でなければ 0 を返します。" -#: ../../c-api/gcsupport.rst:153 msgid "" "The object cannot be tracked by the garbage collector if this function " "returns 0." msgstr "" +"この関数が 0 を返す場合、そのオブジェクトをガベージコレクタの追跡対象にはでき" +"ません。" -#: ../../c-api/gcsupport.rst:158 msgid "" "Returns 1 if the object type of *op* implements the GC protocol and *op* is " "being currently tracked by the garbage collector and 0 otherwise." msgstr "" +"*op* の型が GC プロトコルを実装しており、*op* が現在ガベージコレクタに追跡さ" +"れている場合は 1 を、それ以外の場合は 0 を返します。" -#: ../../c-api/gcsupport.rst:161 msgid "This is analogous to the Python function :func:`gc.is_tracked`." -msgstr "" +msgstr "Python の :func:`gc.is_tracked` 関数に相当します。" -#: ../../c-api/gcsupport.rst:168 msgid "" "Returns 1 if the object type of *op* implements the GC protocol and *op* has " "been already finalized by the garbage collector and 0 otherwise." msgstr "" +"*op* の型が GC プロトコルを実装しており、*op* がガベージコレクタによってすで" +"にファイナライズされている場合は 1 を、それ以外の場合は 0 を返します。" -#: ../../c-api/gcsupport.rst:171 msgid "This is analogous to the Python function :func:`gc.is_finalized`." -msgstr "" +msgstr "Python の :func:`gc.is_finalized` 関数に相当します。" -#: ../../c-api/gcsupport.rst:178 msgid "" "Releases memory allocated to an object using :c:macro:`PyObject_GC_New` or :" "c:macro:`PyObject_GC_NewVar`." msgstr "" +":c:macro:`PyObject_GC_New` または :c:macro:`PyObject_GC_NewVar` でオブジェク" +"トに割り当てたメモリを解放します。" -#: ../../c-api/gcsupport.rst:181 msgid "" "Do not call this directly to free an object's memory; call the type's :c:" "member:`~PyTypeObject.tp_free` slot instead." msgstr "" +"オブジェクトのメモリを解放するために直接呼び出さず、代わりに型の :c:member:" +"`~PyTypeObject.tp_free` スロットを呼び出してください。" -#: ../../c-api/gcsupport.rst:184 msgid "" "Do not use this for memory allocated by :c:macro:`PyObject_New`, :c:macro:" "`PyObject_NewVar`, or related allocation functions; use :c:func:" "`PyObject_Free` instead." msgstr "" +":c:macro:`PyObject_New`、:c:macro:`PyObject_NewVar`、または関連する割り当て関" +"数で割り当てたメモリには使わないでください。\n" +"代わりに :c:func:`PyObject_Free` を使ってください。" -#: ../../c-api/gcsupport.rst:190 msgid ":c:func:`PyObject_Free` is the non-GC equivalent of this function." -msgstr "" +msgstr ":c:func:`PyObject_Free` はこの関数の非 GC 版です。" -#: ../../c-api/gcsupport.rst:191 msgid ":c:macro:`PyObject_GC_New`" -msgstr "" +msgstr ":c:macro:`PyObject_GC_New`" -#: ../../c-api/gcsupport.rst:192 msgid ":c:macro:`PyObject_GC_NewVar`" -msgstr "" +msgstr ":c:macro:`PyObject_GC_NewVar`" #: ../../c-api/gcsupport.rst:194 msgid ":c:member:`~PyTypeObject.tp_free`" @@ -315,11 +342,12 @@ msgstr "" "ケータ (:c:member:`~PyTypeObject.tp_dealloc` ハンドラ) はオブジェクトに対し" "て、この関数を呼び出すべきです。" -#: ../../c-api/gcsupport.rst:208 msgid "" "The :c:func:`!_PyObject_GC_TRACK` and :c:func:`!_PyObject_GC_UNTRACK` macros " "have been removed from the public C API." msgstr "" +":c:func:`!_PyObject_GC_TRACK` マクロと :c:func:`!_PyObject_GC_UNTRACK` マクロ" +"は、公開 C API から削除されました。" #: ../../c-api/gcsupport.rst:211 msgid "" @@ -426,78 +454,94 @@ msgstr "" "ください)。ガベージコレクタは、オブジェクトが循環参照を形成していることを検出" "した際にこのメソッドを呼び出します。" -#: ../../c-api/gcsupport.rst:270 msgid "Controlling the Garbage Collector State" -msgstr "" +msgstr "ガベージコレクタの状態を制御する" -#: ../../c-api/gcsupport.rst:272 msgid "" "The C-API provides the following functions for controlling garbage " "collection runs." msgstr "" +"C API は、ガベージコレクションの実行を制御するために次の関数を提供します。" -#: ../../c-api/gcsupport.rst:277 msgid "" "Perform a full garbage collection, if the garbage collector is enabled. " "(Note that :func:`gc.collect` runs it unconditionally.)" msgstr "" +"ガベージコレクタが有効な場合に、完全なガベージコレクションを実行します (:" +"func:`gc.collect` は無条件に実行する点に注意してください)。" -#: ../../c-api/gcsupport.rst:280 msgid "" "Returns the number of collected + unreachable objects which cannot be " "collected. If the garbage collector is disabled or already collecting, " "returns ``0`` immediately. Errors during garbage collection are passed to :" "data:`sys.unraisablehook`. This function does not raise exceptions." msgstr "" +"回収したオブジェクト数と、到達不能なのに回収できないオブジェクト数の合計を返" +"します。\n" +"ガベージコレクタが無効か、すでに回収を実行している場合は、直ちに ``0`` を返し" +"ます。\n" +"ガベージコレクション中のエラーは :data:`sys.unraisablehook` に渡されます。\n" +"この関数は例外を送出しません。" -#: ../../c-api/gcsupport.rst:290 msgid "" "Enable the garbage collector: similar to :func:`gc.enable`. Returns the " "previous state, 0 for disabled and 1 for enabled." msgstr "" +"ガベージコレクタを有効にします。\n" +":func:`gc.enable` に相当します。\n" +"以前の状態を返し、無効だった場合は 0、有効だった場合は 1 です。" -#: ../../c-api/gcsupport.rst:298 msgid "" "Disable the garbage collector: similar to :func:`gc.disable`. Returns the " "previous state, 0 for disabled and 1 for enabled." msgstr "" +"ガベージコレクタを無効にします。\n" +":func:`gc.disable` に相当します。\n" +"以前の状態を返し、無効だった場合は 0、有効だった場合は 1 です。" -#: ../../c-api/gcsupport.rst:306 msgid "" "Query the state of the garbage collector: similar to :func:`gc.isenabled`. " "Returns the current state, 0 for disabled and 1 for enabled." msgstr "" +"ガベージコレクタの状態を問い合わせます。\n" +":func:`gc.isenabled` に相当します。\n" +"現在の状態を返し、無効の場合は 0、有効の場合は 1 です。" -#: ../../c-api/gcsupport.rst:313 msgid "Querying Garbage Collector State" -msgstr "" +msgstr "ガベージコレクタの状態を問い合わせる" -#: ../../c-api/gcsupport.rst:315 msgid "" "The C-API provides the following interface for querying information about " "the garbage collector." msgstr "" +"C API は、ガベージコレクタの情報を問い合わせるために次のインターフェースを提" +"供します。" -#: ../../c-api/gcsupport.rst:320 msgid "" "Run supplied *callback* on all live GC-capable objects. *arg* is passed " "through to all invocations of *callback*." msgstr "" +"生存しているすべての GC 対応オブジェクトに対して、指定された *callback* を実" +"行します。\n" +"*callback* を呼び出すたびに *arg* をそのまま渡します。" -#: ../../c-api/gcsupport.rst:324 msgid "" "If new objects are (de)allocated by the callback it is undefined if they " "will be visited." msgstr "" +"コールバックがオブジェクトを割り当てたり解放したりした場合、それらのオブジェ" +"クトが巡回されるかどうかは未定義です。" -#: ../../c-api/gcsupport.rst:327 msgid "" "Garbage collection is disabled during operation. Explicitly running a " "collection in the callback may lead to undefined behaviour e.g. visiting the " "same objects multiple times or not at all." msgstr "" +"処理中はガベージコレクションが無効になります。\n" +"コールバック内で明示的にコレクションを実行すると、同じオブジェクトを複数回巡" +"回したり、まったく巡回しなかったりするなど、未定義の動作を引き起こす可能性が" +"あります。" -#: ../../c-api/gcsupport.rst:335 msgid "" "Type of the visitor function to be passed to :c:func:" "`PyUnstable_GC_VisitObjects`. *arg* is the same as the *arg* passed to " @@ -505,3 +549,8 @@ msgid "" "``0`` to stop iteration. Other return values are reserved for now so " "behavior on returning anything else is undefined." msgstr "" +":c:func:`PyUnstable_GC_VisitObjects` に渡すビジター関数の型です。\n" +"*arg* は ``PyUnstable_GC_VisitObjects`` に渡された *arg* と同じです。\n" +"反復処理を続けるには ``1``、停止するには ``0`` を返してください。\n" +"その他の戻り値は現在予約されており、これら以外の値を返した場合の動作は未定義" +"です。" diff --git a/c-api/gen.po b/c-api/gen.po index 55a798bec..2ecf27267 100644 --- a/c-api/gen.po +++ b/c-api/gen.po @@ -16,10 +16,10 @@ msgstr "" "Last-Translator: tomo, 2021\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../c-api/gen.rst:6 @@ -54,13 +54,12 @@ msgstr "" "*ob* がジェネレータオブジェクトの場合に真を返ます、 *ob* は ``NULL`` であって" "はなりません。この関数は常に成功します。" -#: ../../c-api/gen.rst:31 msgid "" "Return true if *ob*'s type is :c:type:`PyGen_Type`; *ob* must not be " "``NULL``. This function always succeeds." msgstr "" -"*ob* が :c:type:`PyGen_Type` の場合に真を返します。\n" -"*o* は ``NULL`` であってはなりません。\n" +"*ob* の型が :c:type:`PyGen_Type` なら真を返します。\n" +"*ob* は ``NULL`` であってはなりません。\n" "この関数は常に成功します。" #: ../../c-api/gen.rst:37 diff --git a/c-api/hash.po b/c-api/hash.po index 21bda2972..97edd03fb 100644 --- a/c-api/hash.po +++ b/c-api/hash.po @@ -16,10 +16,10 @@ msgstr "" "Last-Translator: Taichi Haradaguchi, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../c-api/hash.rst:4 @@ -30,99 +30,99 @@ msgstr "PyHash API" msgid "" "See also the :c:member:`PyTypeObject.tp_hash` member and :ref:`numeric-hash`." msgstr "" +":c:member:`PyTypeObject.tp_hash` メンバや :ref:`numeric-hash` も参照してくだ" +"さい。" #: ../../c-api/hash.rst:10 msgid "Hash value type: signed integer." -msgstr "" +msgstr "ハッシュ値型: 符号付き整数。" #: ../../c-api/hash.rst:16 msgid "Hash value type: unsigned integer." -msgstr "" +msgstr "ハッシュ値型: 符号なし整数。" -#: ../../c-api/hash.rst:22 msgid "" "The `Mersenne prime `_ ``P = " "2**n -1``, used for numeric hash scheme." msgstr "" +"数値のハッシュ方式で使う `メルセンヌ素数 `_ ``P = 2**n -1``。" -#: ../../c-api/hash.rst:28 msgid "The exponent ``n`` of ``P`` in :c:macro:`PyHASH_MODULUS`." -msgstr "" +msgstr ":c:macro:`PyHASH_MODULUS` の ``P`` の指数 ``n``。" -#: ../../c-api/hash.rst:34 msgid "Prime multiplier used in string and various other hashes." -msgstr "" +msgstr "文字列などさまざまなハッシュで乗数として使う素数。" -#: ../../c-api/hash.rst:40 msgid "The hash value returned for a positive infinity." -msgstr "" +msgstr "正の無限大に対して返すハッシュ値。" -#: ../../c-api/hash.rst:46 msgid "The multiplier used for the imaginary part of a complex number." -msgstr "" +msgstr "複素数の虚部に使う乗数。" -#: ../../c-api/hash.rst:52 msgid "Hash function definition used by :c:func:`PyHash_GetFuncDef`." -msgstr "" +msgstr ":c:func:`PyHash_GetFuncDef` が使うハッシュ関数の定義。" -#: ../../c-api/hash.rst:60 msgid "Hash function name (UTF-8 encoded string)." -msgstr "" +msgstr "ハッシュ関数の名前 (UTF-8 エンコードの文字列)。" -#: ../../c-api/hash.rst:64 msgid "Internal size of the hash value in bits." -msgstr "" +msgstr "ハッシュ値の内部でのサイズ (ビット単位)。" -#: ../../c-api/hash.rst:68 msgid "Size of seed input in bits." -msgstr "" +msgstr "シード入力のサイズ (ビット単位)。" -#: ../../c-api/hash.rst:75 msgid "Get the hash function definition." -msgstr "" +msgstr "ハッシュ関数の定義を取得します。" -#: ../../c-api/hash.rst:78 msgid ":pep:`456` \"Secure and interchangeable hash algorithm\"." -msgstr "" +msgstr ":pep:`456` 「安全で交換可能なハッシュアルゴリズム」。" -#: ../../c-api/hash.rst:85 msgid "" "Hash a pointer value: process the pointer value as an integer (cast it to " "``uintptr_t`` internally). The pointer is not dereferenced." msgstr "" +"ポインタ値のハッシュを計算します。\n" +"ポインタ値を整数として処理します (内部では ``uintptr_t`` にキャストしま" +"す)。\n" +"ポインタの参照先にはアクセスしません。" -#: ../../c-api/hash.rst:88 msgid "The function cannot fail: it cannot return ``-1``." msgstr "" +"この関数は失敗しません。\n" +"``-1`` を返すことはありません。" -#: ../../c-api/hash.rst:95 msgid "" "Compute and return the hash value of a buffer of *len* bytes starting at " "address *ptr*. The hash is guaranteed to match that of :class:`bytes`, :" "class:`memoryview`, and other built-in objects that implement the :ref:" "`buffer protocol `." msgstr "" +"アドレス ``ptr`` を先頭とする長さ ``len`` バイトのバッファのハッシュ値を計算" +"して返します。\n" +"このハッシュ値は、:class:`bytes`、:class:`memoryview` など :ref:`バッファプロ" +"トコル ` を実装する組み込みオブジェクトのハッシュ値と一致する" +"ことが保証されています。" -#: ../../c-api/hash.rst:100 msgid "" "Use this function to implement hashing for immutable objects whose :c:member:" "`~PyTypeObject.tp_richcompare` function compares to another object's buffer." msgstr "" +":c:member:`~PyTypeObject.tp_richcompare` 関数でほかのオブジェクトのバッファと" +"比較する不変オブジェクトに、ハッシュ計算を実装する場合に使ってください。" -#: ../../c-api/hash.rst:104 msgid "*len* must be greater than or equal to ``0``." -msgstr "" +msgstr "``len`` は ``0`` 以上でなければなりません。" -#: ../../c-api/hash.rst:106 msgid "This function always succeeds." -msgstr "" +msgstr "この関数は常に成功します。" -#: ../../c-api/hash.rst:113 msgid "" "Generic hashing function that is meant to be put into a type object's " "``tp_hash`` slot. Its result only depends on the object's identity." msgstr "" +"型オブジェクトの ``tp_hash`` スロットに設定するための汎用ハッシュ関数です。\n" +"結果はオブジェクトの同一性だけで決まります。" -#: ../../c-api/hash.rst:118 msgid "In CPython, it is equivalent to :c:func:`Py_HashPointer`." -msgstr "" +msgstr "CPython では :c:func:`Py_HashPointer` と同等です。" diff --git a/c-api/import.po b/c-api/import.po index 5c0fd874e..8726b6488 100644 --- a/c-api/import.po +++ b/c-api/import.po @@ -23,21 +23,22 @@ msgstr "" "Last-Translator: Masato HASHIMOTO , 2023\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../c-api/import.rst:6 msgid "Importing Modules" msgstr "モジュールのインポート" -#: ../../c-api/import.rst:16 msgid "" "This is a wrapper around :c:func:`PyImport_Import()` which takes a :c:expr:" "`const char *` as an argument instead of a :c:expr:`PyObject *`." msgstr "" +":c:func:`PyImport_Import()` のラッパーで、引数として :c:expr:`PyObject *` の" +"代わりに :c:expr:`const char *` を受け取ります。" #: ../../c-api/import.rst:21 msgid "This function is a deprecated alias of :c:func:`PyImport_ImportModule`." @@ -111,7 +112,6 @@ msgstr "" msgid "Negative values for *level* are no longer accepted." msgstr "*level* にはもはや負の値は使用できません。" -#: ../../c-api/import.rst:74 msgid "" "This is a higher-level interface that calls the current \"import hook " "function\" (with an explicit *level* of 0, meaning absolute import). It " @@ -119,48 +119,48 @@ msgid "" "current globals. This means that the import is done using whatever import " "hooks are installed in the current environment." msgstr "" -"現在の \"インポートフック関数\" を呼び出すための高水準のインターフェースです " -"(*level* に 0 を明示すると、絶対インポートを意味します)。 この関数は現在のグ" -"ローバル変数辞書内の ``__builtins__`` から :func:`__import__` 関数を呼び出し" -"ます。すなわち、現在の環境にインストールされているインポートフック使ってイン" -"ポートを行います。" +"現在の「インポートフック関数」を呼び出す高水準のインターフェースです " +"(``level`` は明示的に 0、つまり絶対インポートに設定されます)。\n" +"現在のグローバル名前空間の ``__builtins__`` から :func:`__import__` 関数を呼" +"び出します。\n" +"したがって、現在の環境にインストールされたインポートフックを使ってインポート" +"します。" #: ../../c-api/import.rst:80 msgid "This function always uses absolute imports." msgstr "この関数は常に絶対インポートを使用します。" -#: ../../c-api/import.rst:85 msgid "" "Reload a module. Return a new reference to the reloaded module, or ``NULL`` " "with an exception set on failure (the module still exists in this case)." msgstr "" -"モジュールを再ロード (reload) します。戻り値は再ロードしたモジュールかトップ" -"レベルパッケージへの新たな参照になります。\n" -"失敗した場合には例外をセットし、``NULL`` を返します (その場合でも、モジュール" -"は生成されている場合があります)。" +"モジュールを再読み込みします。\n" +"再読み込みしたモジュールへの新しい参照を返します。\n" +"失敗した場合は例外を設定して ``NULL`` を返します (この場合もモジュールは存在" +"します)。" -#: ../../c-api/import.rst:91 msgid "Return the module object corresponding to a module name." -msgstr "" +msgstr "モジュール名に対応するモジュールオブジェクトを返します。" -#: ../../c-api/import.rst:93 msgid "" "The *name* argument may be of the form ``package.module``. First check the " "modules dictionary if there's one there, and if not, create a new one and " "insert it in the modules dictionary." msgstr "" +"``name`` 引数は ``package.module`` という形式でも構いません。\n" +"まずモジュール辞書内を確認し、該当するモジュールがなければ新しく作成してモ" +"ジュール辞書に挿入します。" -#: ../../c-api/import.rst:97 msgid "" "Return a :term:`strong reference` to the module on success. Return ``NULL`` " "with an exception set on failure." msgstr "" +"成功した場合はモジュールへの :term:`強参照 ` を返します。\n" +"失敗した場合は例外を設定して ``NULL`` を返します。" -#: ../../c-api/import.rst:100 msgid "The module name *name* is decoded from UTF-8." -msgstr "" +msgstr "モジュール名 ``name`` は UTF-8 からデコードされます。" -#: ../../c-api/import.rst:102 msgid "" "This function does not load or import the module; if the module wasn't " "already loaded, you will get an empty module object. Use :c:func:" @@ -168,20 +168,28 @@ msgid "" "structures implied by a dotted name for *name* are not created if not " "already present." msgstr "" +"この関数はモジュールを読み込んだりインポートしたりしません。\n" +"モジュールがまだ読み込まれていない場合は、空のモジュールオブジェクトが返され" +"ます。\n" +"モジュールをインポートするには :c:func:`PyImport_ImportModule` またはその変種" +"を使ってください。\n" +"``name`` がドットで区切られた名前であっても、まだ存在しないパッケージ構造は作" +"成されません。" -#: ../../c-api/import.rst:113 msgid "" "Similar to :c:func:`PyImport_AddModuleRef`, but return a :term:`borrowed " "reference` and *name* is a Python :class:`str` object." msgstr "" +":c:func:`PyImport_AddModuleRef` と同様ですが、:term:`借用参照 ` を返し、``name`` は Python の :class:`str` オブジェクトです。" -#: ../../c-api/import.rst:121 msgid "" "Similar to :c:func:`PyImport_AddModuleRef`, but return a :term:`borrowed " "reference`." msgstr "" +":c:func:`PyImport_AddModuleRef` と同様ですが、:term:`借用参照 ` を返します。" -#: ../../c-api/import.rst:129 msgid "" "Given a module name (possibly of the form ``package.module``) and a code " "object read from a Python bytecode file or obtained from the built-in " @@ -194,14 +202,29 @@ msgid "" "know that the module object is an unknown (and probably damaged with respect " "to the module author's intents) state." msgstr "" +"モジュール名 (``package.module`` 形式でも可) と、Python バイトコードファイル" +"から読み込んだか組み込み関数 :func:`compile` で取得したコードオブジェクトを" +"使って、モジュールを読み込みます。\n" +"モジュールオブジェクトへの新しい参照を返し、エラーの場合は例外を設定して " +"``NULL`` を返します。\n" +"エラーの場合、:c:func:`PyImport_ExecCodeModule` の呼び出し時に ``name`` がす" +"でに :data:`sys.modules` に存在していたとしても、:data:`sys.modules` から " +"``name`` を削除します。\n" +"不完全に初期化されたモジュールを :data:`sys.modules` に残すのは危険です。\n" +"そのモジュールをインポートする側には、モジュールオブジェクトが不明な状態 (お" +"そらく作者の意図からすれば壊れた状態) にあると知る手段がないためです。" -#: ../../c-api/import.rst:139 msgid "" "The module's :attr:`~module.__spec__` and :attr:`~module.__loader__` will be " "set, if not set already, with the appropriate values. The spec's loader " "will be set to the module's :attr:`!__loader__` (if set) and to an instance " "of :class:`~importlib.machinery.SourceFileLoader` otherwise." msgstr "" +"モジュールの :attr:`~module.__spec__` と :attr:`~module.__loader__` がまだ設" +"定されていなければ、適切な値を設定します。\n" +"spec のローダーには、モジュールの :attr:`!__loader__` が設定されていればそれ" +"を使い、そうでなければ :class:`~importlib.machinery.SourceFileLoader` のイン" +"スタンスを設定します。" #: ../../c-api/import.rst:144 msgid "" @@ -241,11 +264,13 @@ msgid "" "deprecated. See :class:`~importlib.machinery.ModuleSpec` for alternatives." msgstr "" -#: ../../c-api/import.rst:165 msgid "" "Like :c:func:`PyImport_ExecCodeModule`, but the :attr:`~module.__file__` " "attribute of the module object is set to *pathname* if it is non-``NULL``." msgstr "" +":c:func:`PyImport_ExecCodeModule` と同様ですが、``pathname`` が ``NULL`` でな" +"ければモジュールオブジェクトの :attr:`~module.__file__` 属性をその値に設定し" +"ます。" #: ../../c-api/import.rst:168 msgid "See also :c:func:`PyImport_ExecCodeModuleWithPathnames`." @@ -276,15 +301,15 @@ msgstr "" "す。もし *pathname* が ``NULL`` の場合、*cpathname* から、*pathname* どのよう" "な値になるべきかを知る試みもなされます。" -#: ../../c-api/import.rst:192 msgid "" "Uses :func:`!imp.source_from_cache` in calculating the source path if only " "the bytecode path is provided." msgstr "" +"バイトコードのパスだけが指定された場合、ソースのパスの計算に :func:`!imp." +"source_from_cache` を使います。" -#: ../../c-api/import.rst:195 msgid "No longer uses the removed :mod:`!imp` module." -msgstr "" +msgstr "削除された :mod:`!imp` モジュールを使わなくなりました。" #: ../../c-api/import.rst:201 msgid "" @@ -329,7 +354,6 @@ msgstr "" "はセットしません。\n" "モジュールの検索に失敗した場合は、 ``NULL`` を返し、エラーをセットします。" -#: ../../c-api/import.rst:232 msgid "" "Return a finder object for a :data:`sys.path`/:attr:`!pkg.__path__` item " "*path*, possibly by fetching it from the :data:`sys.path_importer_cache` " @@ -339,6 +363,16 @@ msgid "" "finder for this path item. Cache the result in :data:`sys." "path_importer_cache`. Return a new reference to the finder object." msgstr "" +":data:`sys.path` または :attr:`!pkg.__path__` の要素 ``path`` に対応するファ" +"インダーオブジェクトを返します。\n" +":data:`sys.path_importer_cache` 辞書から取得する場合もあります。\n" +"まだキャッシュされていなければ、そのパス要素を扱えるフックが見つかるまで :" +"data:`sys.path_hooks` を順に調べます。\n" +"どのフックも扱えない場合は ``None`` を返し、:term:`パスベースのファインダー " +"` がこのパス要素のファインダーを見つけられなかったことを呼" +"び出し側に伝えます。\n" +"結果は :data:`sys.path_importer_cache` にキャッシュします。\n" +"ファインダーオブジェクトへの新しい参照を返します。" #: ../../c-api/import.rst:243 msgid "" @@ -359,14 +393,12 @@ msgstr "" msgid "The ``__file__`` attribute is no longer set on the module." msgstr "``__file__`` 属性はもうモジュールにセットされません。" -#: ../../c-api/import.rst:257 msgid "" "Similar to :c:func:`PyImport_ImportFrozenModuleObject`, but the name is a " "UTF-8 encoded string instead of a Unicode object." msgstr "" -":c:func:`PyImport_ImportFrozenModuleObject` と似ていますが、name は UTF-8 で" -"エンコードされた文字列の代わりに、 Unicode オブジェクトを使用する点が異なりま" -"す。" +":c:func:`PyImport_ImportFrozenModuleObject` と同様ですが、名前は Unicode オブ" +"ジェクトではなく UTF-8 エンコードの文字列です。" #: ../../c-api/import.rst:265 msgid "" @@ -390,11 +422,13 @@ msgid "" "};" msgstr "" -#: ../../c-api/import.rst:277 msgid "" "The new ``is_package`` field indicates whether the module is a package or " "not. This replaces setting the ``size`` field to a negative value." msgstr "" +"新しい ``is_package`` フィールドは、モジュールがパッケージかどうかを示しま" +"す。\n" +"``size`` フィールドを負の値に設定する方法に代わるものです。" #: ../../c-api/import.rst:283 msgid "" @@ -425,23 +459,24 @@ msgstr "" "ポートでき、最初にインポートを試みた際に呼び出される関数として *initfunc* を" "使います。 :c:func:`Py_Initialize` よりも前に呼び出さなければなりません。" -#: ../../c-api/import.rst:301 msgid "" "Structure describing a single entry in the list of built-in modules. " "Programs which embed Python may use an array of these structures in " "conjunction with :c:func:`PyImport_ExtendInittab` to provide additional " "built-in modules. The structure consists of two members:" msgstr "" +"組み込みモジュールの一覧の一つのエントリーを記述する構造体です。\n" +"Python を組み込むプログラムは、この構造体の配列を :c:func:" +"`PyImport_ExtendInittab` と併用して、追加の組み込みモジュールを提供できま" +"す。\n" +"構造体は二つのメンバからなります。" -#: ../../c-api/import.rst:309 msgid "The module name, as an ASCII encoded string." -msgstr "" +msgstr "ASCII エンコードの文字列で表したモジュール名。" -#: ../../c-api/import.rst:313 msgid "Initialization function for a module built into the interpreter." -msgstr "" +msgstr "インタープリタに組み込まれたモジュールの初期化関数。" -#: ../../c-api/import.rst:318 msgid "" "Add a collection of modules to the table of built-in modules. The *newtab* " "array must end with a sentinel entry which contains ``NULL`` for the :c:" @@ -451,6 +486,14 @@ msgid "" "failure, no modules are added to the internal table. This must be called " "before :c:func:`Py_Initialize`." msgstr "" +"組み込みモジュールのテーブルに、複数のモジュールを追加します。\n" +"``newtab`` 配列は、:c:member:`~_inittab.name` フィールドが ``NULL`` の番兵エ" +"ントリーで終わる必要があります。\n" +"番兵がないとメモリアクセス違反を引き起こす可能性があります。\n" +"成功した場合は ``0`` を返し、内部テーブルを拡張するためのメモリを十分に割り当" +"てられなければ ``-1`` を返します。\n" +"失敗した場合、内部テーブルにモジュールは一つも追加されません。\n" +":c:func:`Py_Initialize` より前に呼び出す必要があります。" #: ../../c-api/import.rst:325 msgid "" @@ -462,39 +505,40 @@ msgstr "" "func:`PyImport_ExtendInittab` は、それぞれの初期化の前に呼び出される必要があ" "ります。" -#: ../../c-api/import.rst:332 msgid "Import the module *mod_name* and get its attribute *attr_name*." msgstr "" +"モジュール ``mod_name`` をインポートし、その属性 ``attr_name`` を取得します。" -#: ../../c-api/import.rst:334 msgid "Names must be Python :class:`str` objects." -msgstr "" +msgstr "名前は Python の :class:`str` オブジェクトでなければなりません。" -#: ../../c-api/import.rst:336 msgid "" "Helper function combining :c:func:`PyImport_Import` and :c:func:" "`PyObject_GetAttr`. For example, it can raise :exc:`ImportError` if the " "module is not found, and :exc:`AttributeError` if the attribute doesn't " "exist." msgstr "" +":c:func:`PyImport_Import` と :c:func:`PyObject_GetAttr` を組み合わせた補助関" +"数です。\n" +"例えば、モジュールが見つからなければ :exc:`ImportError`、属性が存在しなけれ" +"ば :exc:`AttributeError` を送出することがあります。" -#: ../../c-api/import.rst:345 msgid "" "Similar to :c:func:`PyImport_ImportModuleAttr`, but names are UTF-8 encoded " "strings instead of Python :class:`str` objects." msgstr "" +":c:func:`PyImport_ImportModuleAttr` と同様ですが、名前は Python の :class:" +"`str` オブジェクトではなく UTF-8 エンコードの文字列です。" -#: ../../c-api/import.rst:11 msgid "package variable" -msgstr "" +msgstr "パッケージ変数" #: ../../c-api/import.rst:11 msgid "__all__" msgstr "__all__" -#: ../../c-api/import.rst:11 msgid "__all__ (package variable)" -msgstr "" +msgstr "__all__ (パッケージ変数)" #: ../../c-api/import.rst:11 msgid "modules (in module sys)" diff --git a/c-api/index.po b/c-api/index.po index 35ea1575d..28fef3d33 100644 --- a/c-api/index.po +++ b/c-api/index.po @@ -16,10 +16,10 @@ msgstr "" "Last-Translator: tomo, 2021\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../c-api/index.rst:5 diff --git a/c-api/init.po b/c-api/init.po index 0b2539498..c233bf83b 100644 --- a/c-api/init.po +++ b/c-api/init.po @@ -24,21 +24,22 @@ msgstr "" "Last-Translator: Takanori Suzuki , 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../c-api/init.rst:8 msgid "Initialization, Finalization, and Threads" msgstr "初期化 (initialization)、終了処理 (finalization)、スレッド" -#: ../../c-api/init.rst:10 msgid "" "See :ref:`Python Initialization Configuration ` for details on " "how to configure the interpreter prior to initialization." msgstr "" +"初期化前にインタープリタを設定する方法の詳細は、:ref:`Python の初期化設定 " +"` を参照してください。" #: ../../c-api/init.rst:16 msgid "Before Python Initialization" @@ -60,17 +61,14 @@ msgid "" "The following functions can be safely called before Python is initialized:" msgstr "次の関数は Python の初期化の前でも安全に呼び出せます:" -#: ../../c-api/init.rst:25 msgid "Functions that initialize the interpreter:" -msgstr "" +msgstr "インタープリタを初期化する関数:" -#: ../../c-api/init.rst:27 msgid ":c:func:`Py_Initialize`" -msgstr "" +msgstr ":c:func:`Py_Initialize`" -#: ../../c-api/init.rst:28 msgid ":c:func:`Py_InitializeEx`" -msgstr "" +msgstr ":c:func:`Py_InitializeEx`" #: ../../c-api/init.rst:29 msgid ":c:func:`Py_InitializeFromConfig`" @@ -80,13 +78,11 @@ msgstr ":c:func:`Py_InitializeFromConfig`" msgid ":c:func:`Py_BytesMain`" msgstr ":c:func:`Py_BytesMain`" -#: ../../c-api/init.rst:31 msgid ":c:func:`Py_Main`" -msgstr "" +msgstr ":c:func:`Py_Main`" -#: ../../c-api/init.rst:32 msgid "the runtime pre-initialization functions covered in :ref:`init-config`" -msgstr "" +msgstr ":ref:`init-config` で説明するランタイムの事前初期化関数" #: ../../c-api/init.rst:34 msgid "Configuration functions:" @@ -100,9 +96,8 @@ msgstr ":c:func:`PyImport_AppendInittab`" msgid ":c:func:`PyImport_ExtendInittab`" msgstr ":c:func:`PyImport_ExtendInittab`" -#: ../../c-api/init.rst:38 msgid ":c:func:`!PyInitFrozenExtensions`" -msgstr "" +msgstr ":c:func:`!PyInitFrozenExtensions`" #: ../../c-api/init.rst:39 msgid ":c:func:`PyMem_SetAllocator`" @@ -128,9 +123,8 @@ msgstr ":c:func:`Py_SetPythonHome`" msgid ":c:func:`PySys_ResetWarnOptions`" msgstr ":c:func:`PySys_ResetWarnOptions`" -#: ../../c-api/init.rst:45 msgid "the configuration functions covered in :ref:`init-config`" -msgstr "" +msgstr ":ref:`init-config` で説明する設定関数" #: ../../c-api/init.rst:47 msgid "Informative functions:" @@ -176,10 +170,9 @@ msgstr "ユーティリティ:" msgid ":c:func:`Py_DecodeLocale`" msgstr ":c:func:`Py_DecodeLocale`" -#: ../../c-api/init.rst:62 msgid "" "the status reporting and utility functions covered in :ref:`init-config`" -msgstr "" +msgstr ":ref:`init-config` で説明する状態の報告とユーティリティの関数" #: ../../c-api/init.rst:64 msgid "Memory allocators:" @@ -201,17 +194,14 @@ msgstr ":c:func:`PyMem_RawCalloc`" msgid ":c:func:`PyMem_RawFree`" msgstr ":c:func:`PyMem_RawFree`" -#: ../../c-api/init.rst:71 msgid "Synchronization:" -msgstr "" +msgstr "同期:" -#: ../../c-api/init.rst:73 msgid ":c:func:`PyMutex_Lock`" -msgstr "" +msgstr ":c:func:`PyMutex_Lock`" -#: ../../c-api/init.rst:74 msgid ":c:func:`PyMutex_Unlock`" -msgstr "" +msgstr ":c:func:`PyMutex_Unlock`" #: ../../c-api/init.rst:78 msgid "" @@ -250,12 +240,14 @@ msgstr "" "例えば、 ``-b`` では :c:data:`Py_BytesWarningFlag` が 1 に設定され、 ``-bb`` " "では :c:data:`Py_BytesWarningFlag` が 2 に設定されます。" -#: ../../c-api/init.rst:102 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "bytes_warning` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" +"この API は後方互換性のために残されています。\n" +"代わりに :c:member:`PyConfig.bytes_warning` を設定してください。\n" +":ref:`Python の初期化設定 ` を参照してください。" #: ../../c-api/init.rst:106 msgid "" @@ -271,12 +263,14 @@ msgstr "" msgid "Set by the :option:`-b` option." msgstr ":option:`-b` オプションで設定します。" -#: ../../c-api/init.rst:116 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "parser_debug` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" +"この API は後方互換性のために残されています。\n" +"代わりに :c:member:`PyConfig.parser_debug` を設定してください。\n" +":ref:`Python の初期化設定 ` を参照してください。" #: ../../c-api/init.rst:120 msgid "" @@ -292,12 +286,14 @@ msgid "" "variable." msgstr ":option:`-d` オプションと :envvar:`PYTHONDEBUG` 環境変数で設定します。" -#: ../../c-api/init.rst:130 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "write_bytecode` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" +"この API は後方互換性のために残されています。\n" +"代わりに :c:member:`PyConfig.write_bytecode` を設定してください。\n" +":ref:`Python の初期化設定 ` を参照してください。" #: ../../c-api/init.rst:134 msgid "" @@ -315,12 +311,14 @@ msgstr "" ":option:`-B` オプションと :envvar:`PYTHONDONTWRITEBYTECODE` 環境変数で設定し" "ます。" -#: ../../c-api/init.rst:144 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "pathconfig_warnings` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" +"この API は後方互換性のために残されています。\n" +"代わりに :c:member:`PyConfig.pathconfig_warnings` を設定してください。\n" +":ref:`Python の初期化設定 ` を参照してください。" #: ../../c-api/init.rst:148 msgid "" @@ -336,12 +334,15 @@ msgstr "" "``_freeze_module`` プログラムと ``frozenmain`` プログラムが使用する非公開フラ" "グです。" -#: ../../c-api/init.rst:157 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "hash_seed` and :c:member:`PyConfig.use_hash_seed` should be used instead, " "see :ref:`Python Initialization Configuration `." msgstr "" +"この API は後方互換性のために残されています。\n" +"代わりに :c:member:`PyConfig.hash_seed` と :c:member:`PyConfig." +"use_hash_seed` を設定してください。\n" +":ref:`Python の初期化設定 ` を参照してください。" #: ../../c-api/init.rst:162 msgid "" @@ -359,39 +360,43 @@ msgstr "" "フラグがゼロでない場合、 :envvar:`PYTHONHASHSEED` 環境変数を読みシークレット" "ハッシュシードを初期化します。" -#: ../../c-api/init.rst:172 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "use_environment` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" +"この API は後方互換性のために残されています。\n" +"代わりに :c:member:`PyConfig.use_environment` を設定してください。\n" +":ref:`Python の初期化設定 ` を参照してください。" -#: ../../c-api/init.rst:176 msgid "" "Ignore all :envvar:`!PYTHON*` environment variables, e.g. :envvar:" "`PYTHONPATH` and :envvar:`PYTHONHOME`, that might be set." msgstr "" +":envvar:`PYTHONPATH` や :envvar:`PYTHONHOME` など、設定されているすべての :" +"envvar:`!PYTHON*` 環境変数を無視します。" #: ../../c-api/init.rst:179 msgid "Set by the :option:`-E` and :option:`-I` options." msgstr ":option:`-E` オプションと :option:`-I` オプションで設定します。" -#: ../../c-api/init.rst:185 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "inspect` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" +"この API は後方互換性のために残されています。\n" +"代わりに :c:member:`PyConfig.inspect` を設定してください。\n" +":ref:`Python の初期化設定 ` を参照してください。" -#: ../../c-api/init.rst:189 msgid "" "When a script is passed as first argument or the :option:`-c` option is " "used, enter interactive mode after executing the script or the command, even " "when :data:`sys.stdin` does not appear to be a terminal." msgstr "" -"最初の引数にスクリプトが指定されたときや :option:`-c` オプションが利用された" -"際に、 :data:`sys.stdin` がターミナルに出力されないときであっても、スクリプト" -"かコマンドを実行した後にインタラクティブモードに入ります。" +"最初の引数にスクリプトを指定した場合や :option:`-c` オプションを使った場合" +"は、:data:`sys.stdin` が端末でなくても、スクリプトやコマンドの実行後に対話" +"モードに入ります。" #: ../../c-api/init.rst:193 msgid "" @@ -400,23 +405,27 @@ msgid "" msgstr "" ":option:`-i` オプションと :envvar:`PYTHONINSPECT` 環境変数で設定します。" -#: ../../c-api/init.rst:200 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "interactive` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" +"この API は後方互換性のために残されています。\n" +"代わりに :c:member:`PyConfig.interactive` を設定してください。\n" +":ref:`Python の初期化設定 ` を参照してください。" #: ../../c-api/init.rst:204 msgid "Set by the :option:`-i` option." msgstr ":option:`-i` オプションで設定します。" -#: ../../c-api/init.rst:210 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "isolated` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" +"この API は後方互換性のために残されています。\n" +"代わりに :c:member:`PyConfig.isolated` を設定してください。\n" +":ref:`Python の初期化設定 ` を参照してください。" #: ../../c-api/init.rst:214 msgid "" @@ -431,19 +440,25 @@ msgstr "" msgid "Set by the :option:`-I` option." msgstr ":option:`-I` オプションで設定します。" -#: ../../c-api/init.rst:225 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyPreConfig." "legacy_windows_fs_encoding` should be used instead, see :ref:`Python " "Initialization Configuration `." msgstr "" +"この API は後方互換性のために残されています。\n" +"代わりに :c:member:`PyPreConfig.legacy_windows_fs_encoding` を設定してくださ" +"い。\n" +":ref:`Python の初期化設定 ` を参照してください。" -#: ../../c-api/init.rst:229 msgid "" "If the flag is non-zero, use the ``mbcs`` encoding with ``replace`` error " "handler, instead of the UTF-8 encoding with ``surrogatepass`` error handler, " "for the :term:`filesystem encoding and error handler`." msgstr "" +"フラグがゼロ以外の場合は、:term:`ファイルシステムエンコーディングとエラーハン" +"ドラー ` として、UTF-8 と " +"``surrogatepass`` エラーハンドラーの代わりに、``mbcs`` と ``replace`` エラー" +"ハンドラーを使います。" #: ../../c-api/init.rst:233 msgid "" @@ -457,22 +472,24 @@ msgstr "" msgid "See :pep:`529` for more details." msgstr "より詳しくは :pep:`529` を参照してください。" -#: ../../c-api/init.rst:238 ../../c-api/init.rst:256 msgid "Availability" -msgstr "" +msgstr "利用可能な環境" -#: ../../c-api/init.rst:244 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "legacy_windows_stdio` should be used instead, see :ref:`Python " "Initialization Configuration `." msgstr "" +"この API は後方互換性のために残されています。\n" +"代わりに :c:member:`PyConfig.legacy_windows_stdio` を設定してください。\n" +":ref:`Python の初期化設定 ` を参照してください。" -#: ../../c-api/init.rst:248 msgid "" "If the flag is non-zero, use :class:`io.FileIO` instead of :class:`!io." "_WindowsConsoleIO` for :mod:`sys` standard streams." msgstr "" +"フラグがゼロ以外の場合は、:mod:`sys` の標準ストリームに :class:`!io." +"_WindowsConsoleIO` の代わりに :class:`io.FileIO` を使います。" #: ../../c-api/init.rst:251 msgid "" @@ -486,12 +503,14 @@ msgstr "" msgid "See :pep:`528` for more details." msgstr "より詳しくは :pep:`528` を参照してください。" -#: ../../c-api/init.rst:262 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "site_import` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" +"この API は後方互換性のために残されています。\n" +"代わりに :c:member:`PyConfig.site_import` を設定してください。\n" +":ref:`Python の初期化設定 ` を参照してください。" #: ../../c-api/init.rst:266 msgid "" @@ -509,12 +528,14 @@ msgstr "" msgid "Set by the :option:`-S` option." msgstr ":option:`-S` オプションで設定します。" -#: ../../c-api/init.rst:277 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "user_site_directory` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" +"この API は後方互換性のために残されています。\n" +"代わりに :c:member:`PyConfig.user_site_directory` を設定してください。\n" +":ref:`Python の初期化設定 ` を参照してください。" #: ../../c-api/init.rst:281 msgid "" @@ -532,12 +553,14 @@ msgstr "" ":option:`-s` オプション、 :option:`-I` 、 :envvar:`PYTHONNOUSERSITE` 環境変数" "で設定します。" -#: ../../c-api/init.rst:291 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "optimization_level` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" +"この API は後方互換性のために残されています。\n" +"代わりに :c:member:`PyConfig.optimization_level` を設定してください。\n" +":ref:`Python の初期化設定 ` を参照してください。" #: ../../c-api/init.rst:295 msgid "" @@ -546,12 +569,14 @@ msgid "" msgstr "" ":option:`-O` オプションと :envvar:`PYTHONOPTIMIZE` 環境変数で設定します。" -#: ../../c-api/init.rst:302 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "quiet` should be used instead, see :ref:`Python Initialization Configuration " "`." msgstr "" +"この API は後方互換性のために残されています。\n" +"代わりに :c:member:`PyConfig.quiet` を設定してください。\n" +":ref:`Python の初期化設定 ` を参照してください。" #: ../../c-api/init.rst:306 msgid "" @@ -563,12 +588,14 @@ msgstr "" msgid "Set by the :option:`-q` option." msgstr ":option:`-q` オプションで設定します。" -#: ../../c-api/init.rst:316 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "buffered_stdio` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" +"この API は後方互換性のために残されています。\n" +"代わりに :c:member:`PyConfig.buffered_stdio` を設定してください。\n" +":ref:`Python の初期化設定 ` を参照してください。" #: ../../c-api/init.rst:320 msgid "Force the stdout and stderr streams to be unbuffered." @@ -581,12 +608,14 @@ msgid "" msgstr "" ":option:`-u` オプションと :envvar:`PYTHONUNBUFFERED` 環境変数で設定します。" -#: ../../c-api/init.rst:329 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "verbose` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" +"この API は後方互換性のために残されています。\n" +"代わりに :c:member:`PyConfig.verbose` を設定してください。\n" +":ref:`Python の初期化設定 ` を参照してください。" #: ../../c-api/init.rst:333 msgid "" @@ -634,11 +663,12 @@ msgid "" "it is a fatal error if the initialization fails." msgstr "" -#: ../../c-api/init.rst:372 ../../c-api/init.rst:386 msgid "" "Use :c:func:`Py_InitializeFromConfig` to customize the :ref:`Python " "Initialization Configuration `." msgstr "" +":ref:`Python の初期化設定 ` をカスタマイズするには、:c:func:" +"`Py_InitializeFromConfig` を使ってください。" #: ../../c-api/init.rst:376 msgid "" @@ -649,26 +679,33 @@ msgstr "" "が、これはその C ランタイムを使っているコンソールでの Python 以外の使い勝手に" "も影響を及ぼします。" -#: ../../c-api/init.rst:382 msgid "" "This function works like :c:func:`Py_Initialize` if *initsigs* is ``1``. If " "*initsigs* is ``0``, it skips initialization registration of signal " "handlers, which may be useful when CPython is embedded as part of a larger " "application." msgstr "" +"*initsigs* が ``1`` の場合は :c:func:`Py_Initialize` と同じように動作しま" +"す。\n" +"*initsigs* が ``0`` の場合は、シグナルハンドラーの初期化と登録を省略しま" +"す。\n" +"これは、CPython をより大きなアプリケーションに組み込む場合に有用なことがあり" +"ます。" -#: ../../c-api/init.rst:392 msgid "" "Initialize Python from *config* configuration, as described in :ref:`init-" "from-config`." msgstr "" +":ref:`init-from-config` で説明するように、*config* の設定で Python を初期化し" +"ます。" -#: ../../c-api/init.rst:395 msgid "" "See the :ref:`init-config` section for details on pre-initializing the " "interpreter, populating the runtime configuration structure, and querying " "the returned status structure." msgstr "" +"インタープリタの事前初期化、ランタイム設定構造体への値の設定、返される状態構" +"造体の調べ方については、:ref:`init-config` を参照してください。" #: ../../c-api/init.rst:402 msgid "" @@ -680,13 +717,14 @@ msgstr "" "します。:c:func:`Py_FinalizeEx` を呼び出した後は、:c:func:`Py_Initialize` を" "再び呼び出すまで、この関数は偽を返します。" -#: ../../c-api/init.rst:409 msgid "" "Return true (non-zero) if the main Python interpreter is :term:`shutting " "down `. Return false (zero) otherwise." msgstr "" +"メインの Python インタープリタが :term:`終了処理中 ` な" +"ら真 (ゼロ以外) を返します。\n" +"それ以外の場合は偽 (ゼロ) を返します。" -#: ../../c-api/init.rst:417 msgid "" "Undo all initializations made by :c:func:`Py_Initialize` and subsequent use " "of Python/C API functions, and destroy all sub-interpreters (see :c:func:" @@ -694,20 +732,32 @@ msgid "" "last call to :c:func:`Py_Initialize`. This is a no-op when called for a " "second time (without calling :c:func:`Py_Initialize` again first)." msgstr "" +":c:func:`Py_Initialize` と、その後の Python/C API 関数の使用による初期化をす" +"べて元に戻します。\n" +"さらに、最後に :c:func:`Py_Initialize` を呼び出してから作成され、まだ破棄され" +"ていないサブインタープリタをすべて破棄します (以下の :c:func:" +"`Py_NewInterpreter` を参照)。\n" +"再び :c:func:`Py_Initialize` を呼び出さずにもう一度呼び出しても、何も行いませ" +"ん。" -#: ../../c-api/init.rst:423 msgid "" "Since this is the reverse of :c:func:`Py_Initialize`, it should be called in " "the same thread with the same interpreter active. That means the main " "thread and the main interpreter. This should never be called while :c:func:" "`Py_RunMain` is running." msgstr "" +":c:func:`Py_Initialize` の逆の処理なので、同じスレッドで同じインタープリタが" +"アクティブな状態で呼び出す必要があります。\n" +"つまり、メインスレッドとメインインタープリタです。\n" +":c:func:`Py_RunMain` の実行中には決して呼び出してはなりません。" -#: ../../c-api/init.rst:428 msgid "" "Normally the return value is ``0``. If there were errors during finalization " "(flushing buffered data), ``-1`` is returned." msgstr "" +"通常の戻り値は ``0`` です。\n" +"終了処理中にバッファー内のデータの書き出しでエラーがあった場合は、``-1`` を返" +"します。" #: ../../c-api/init.rst:432 msgid "" @@ -756,13 +806,12 @@ msgid "" "stdout and stderr files." msgstr "" -#: ../../c-api/init.rst:462 msgid "" "Raises an :ref:`auditing event ` ``cpython." "_PySys_ClearAuditHooks`` with no arguments." msgstr "" "引数無しで :ref:`監査イベント ` ``cpython._PySys_ClearAuditHooks`` " -"を送出します。 " +"を送出します。" #: ../../c-api/init.rst:469 msgid "" @@ -772,14 +821,15 @@ msgstr "" "この関数は :c:func:`Py_FinalizeEx` の後方互換性バージョンで、戻り値がありませ" "ん。" -#: ../../c-api/init.rst:475 msgid "" "Similar to :c:func:`Py_Main` but *argv* is an array of bytes strings, " "allowing the calling application to delegate the text decoding step to the " "CPython runtime." msgstr "" +":c:func:`Py_Main` と同様ですが、*argv* はバイト文字列の配列です。\n" +"これにより、呼び出し元のアプリケーションは、テキストのデコードを CPython ラン" +"タイムに任せられます。" -#: ../../c-api/init.rst:484 msgid "" "The main program for the standard interpreter, encapsulating a full " "initialization/finalization cycle, as well as additional behaviour to " @@ -787,15 +837,20 @@ msgid "" "line, and then executing ``__main__`` in accordance with :ref:`using-on-" "cmdline`." msgstr "" +"標準インタープリタのメインプログラムです。\n" +"初期化から終了処理までの一連の処理に加え、環境変数とコマンドラインから設定を" +"読み取り、:ref:`using-on-cmdline` に従って ``__main__`` を実行する処理をまと" +"めて行います。" -#: ../../c-api/init.rst:490 msgid "" "This is made available for programs which wish to support the full CPython " "command line interface, rather than just embedding a Python runtime in a " "larger application." msgstr "" +"より大きなアプリケーションに Python ランタイムを組み込むだけでなく、CPython " +"の完全なコマンドラインインターフェースをサポートしたいプログラムのために提供" +"されています。" -#: ../../c-api/init.rst:494 msgid "" "The *argc* and *argv* parameters are similar to those which are passed to a " "C program's :c:func:`main` function, except that the *argv* entries are " @@ -804,6 +859,12 @@ msgid "" "strings other than those passed in (however, the contents of the strings " "pointed to by the argument list are not modified)." msgstr "" +"*argc* と *argv* 引数は、C プログラムの :c:func:`main` 関数に渡すものに似てい" +"ますが、*argv* の各要素をあらかじめ :c:func:`Py_DecodeLocale` で ``wchar_t`` " +"に変換する点が異なります。\n" +"引数リストの各要素が、渡された文字列とは別の文字列を指すように変更される可能" +"性があることにも注意してください。\n" +"ただし、引数リストが指す文字列の内容は変更されません。" #: ../../c-api/init.rst:501 msgid "" @@ -822,14 +883,15 @@ msgid "" "means of exiting will set the return value as described above." msgstr "" -#: ../../c-api/init.rst:513 msgid "" "In terms of the CPython runtime configuration APIs documented in the :ref:" "`runtime configuration ` section (and without accounting for " "error handling), ``Py_Main`` is approximately equivalent to::" msgstr "" +":ref:`ランタイムの設定 ` の節で説明する CPython ランタイム設定 " +"API を使うと、エラー処理を除いて、``Py_Main`` はおおむね次の処理と等価で" +"す。 ::" -#: ../../c-api/init.rst:517 msgid "" "PyConfig config;\n" "PyConfig_InitPythonConfig(&config);\n" @@ -839,8 +901,14 @@ msgid "" "\n" "Py_RunMain();" msgstr "" +"PyConfig config;\n" +"PyConfig_InitPythonConfig(&config);\n" +"PyConfig_SetArgv(&config, argc, argv);\n" +"Py_InitializeFromConfig(&config);\n" +"PyConfig_Clear(&config);\n" +"\n" +"Py_RunMain();" -#: ../../c-api/init.rst:525 msgid "" "In normal usage, an embedding application will call this function *instead* " "of calling :c:func:`Py_Initialize`, :c:func:`Py_InitializeEx` or :c:func:" @@ -852,12 +920,19 @@ msgid "" "being modified after they have already been set once when the runtime was " "first initialized)." msgstr "" +"通常、Python を組み込むアプリケーションは、:c:func:`Py_Initialize`、:c:func:" +"`Py_InitializeEx`、:c:func:`Py_InitializeFromConfig` を直接呼び出す *代わりに" +"* この関数を呼び出します。\n" +"その場合、すべての設定はこのドキュメントのほかの箇所で説明されているとおりに" +"適用されます。\n" +"先にランタイム初期化 API を呼び出した *後で* この関数を呼び出す場合は、環境変" +"数とコマンドラインのどの設定が更新されるかはバージョンに依存します。\n" +"ランタイムの最初の初期化で一度設定した値を、後から正しく変更できるかどうかが" +"設定によって異なるためです。" -#: ../../c-api/init.rst:538 msgid "Executes the main module in a fully configured CPython runtime." -msgstr "" +msgstr "設定が完了した CPython ランタイムで、メインモジュールを実行します。" -#: ../../c-api/init.rst:540 msgid "" "Executes the command (:c:member:`PyConfig.run_command`), the script (:c:" "member:`PyConfig.run_filename`) or the module (:c:member:`PyConfig." @@ -865,6 +940,11 @@ msgid "" "of these values are set, runs the interactive Python prompt (REPL) using the " "``__main__`` module's global namespace." msgstr "" +"コマンドラインまたは設定で指定された、コマンド (:c:member:`PyConfig." +"run_command`)、スクリプト (:c:member:`PyConfig.run_filename`)、またはモジュー" +"ル (:c:member:`PyConfig.run_module`) を実行します。\n" +"どの値も設定されていなければ、``__main__`` モジュールのグローバル名前空間を" +"使って、Python の対話プロンプト (REPL) を実行します。" #: ../../c-api/init.rst:546 msgid "" @@ -895,34 +975,40 @@ msgid "" "`SystemExit` exception." msgstr "" -#: ../../c-api/init.rst:566 msgid "" "See :ref:`Python Configuration ` for an example of a " "customized Python that always runs in isolated mode using :c:func:" "`Py_RunMain`." msgstr "" +":c:func:`Py_RunMain` を使って常に隔離モードで実行するようカスタマイズした " +"Python の例は、:ref:`Python の設定 ` を参照してください。" -#: ../../c-api/init.rst:572 msgid "" "Register an :mod:`atexit` callback for the target interpreter *interp*. This " "is similar to :c:func:`Py_AtExit`, but takes an explicit interpreter and " "data pointer for the callback." msgstr "" +"対象のインタープリタ *interp* に :mod:`atexit` コールバックを登録します。\n" +":c:func:`Py_AtExit` と似ていますが、インタープリタと、コールバックに渡すデー" +"タポインターを明示的に受け取ります。" -#: ../../c-api/init.rst:576 msgid "There must be an :term:`attached thread state` for *interp*." msgstr "" +"*interp* の :term:`スレッド状態がアタッチされていなければなりません " +"`。" #: ../../c-api/init.rst:581 msgid "Process-wide parameters" msgstr "プロセスワイドのパラメータ" -#: ../../c-api/init.rst:591 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "program_name` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" +"この API は後方互換性のために残されています。\n" +"代わりに :c:member:`PyConfig.program_name` を設定してください。\n" +":ref:`Python の初期化設定 ` を参照してください。" #: ../../c-api/init.rst:595 msgid "" @@ -947,12 +1033,12 @@ msgstr "" "はプログラムの実行中に変更してはなりません。 Python インタプリタ内のコード" "で、この記憶領域の内容を変更するものは一切ありません。" -#: ../../c-api/init.rst:606 ../../c-api/init.rst:854 ../../c-api/init.rst:890 -#: ../../c-api/init.rst:916 msgid "" "Use :c:func:`Py_DecodeLocale` to decode a bytes string to get a :c:expr:" "`wchar_t*` string." msgstr "" +"バイト文字列をデコードして :c:expr:`wchar_t*` 文字列を取得するには、:c:func:" +"`Py_DecodeLocale` を使ってください。" #: ../../c-api/init.rst:614 msgid "" @@ -1110,9 +1196,8 @@ msgstr "" "Python インタプリタのバージョンを返します。バージョンは、次のような形式の文字" "列です ::" -#: ../../c-api/init.rst:757 msgid "\"3.0a5+ (py3k:63103M, May 12 2008, 00:53:55) \\n[GCC 4.2.3]\"" -msgstr "" +msgstr "\"3.0a5+ (py3k:63103M, May 12 2008, 00:53:55) \\n[GCC 4.2.3]\"" #: ../../c-api/init.rst:761 msgid "" @@ -1128,9 +1213,8 @@ msgstr "" "変更できません。この値は Python コードからは :data:`sys.version` として利用で" "きます。" -#: ../../c-api/init.rst:766 msgid "See also the :c:var:`Py_Version` constant." -msgstr "" +msgstr ":c:var:`Py_Version` 定数も参照してください。" #: ../../c-api/init.rst:773 msgid "" @@ -1178,9 +1262,8 @@ msgstr "" "現在使っているバージョンの Python をビルドする際に用いたコンパイラを示す文字" "列を、角括弧で囲った文字列を返します。例えば::" -#: ../../c-api/init.rst:799 msgid "\"[GCC 2.7.2.2]\"" -msgstr "" +msgstr "\"[GCC 2.7.2.2]\"" #: ../../c-api/init.rst:803 ../../c-api/init.rst:817 msgid "" @@ -1200,17 +1283,19 @@ msgstr "" "現在使っている Python インタプリタインスタンスの、シーケンス番号とビルド日時" "に関する情報を返します。例えば ::" -#: ../../c-api/init.rst:813 msgid "\"#67, Aug 1 1997, 22:34:28\"" -msgstr "" +msgstr "\"#67, Aug 1 1997, 22:34:28\"" -#: ../../c-api/init.rst:829 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "argv`, :c:member:`PyConfig.parse_argv` and :c:member:`PyConfig.safe_path` " "should be used instead, see :ref:`Python Initialization Configuration `." msgstr "" +"この API は後方互換性のために残されています。\n" +"代わりに :c:member:`PyConfig.argv` と :c:member:`PyConfig.parse_argv` と :c:" +"member:`PyConfig.safe_path` を設定してください。\n" +":ref:`Python の初期化設定 ` を参照してください。" #: ../../c-api/init.rst:834 msgid "" @@ -1258,18 +1343,22 @@ msgstr "" "指していない場合)、 :data:`sys.path` の先頭に空の文字列を追加します。\n" "これは現在の作業ディレクトリ (``\".\"``) を先頭に追加するのと同じです。" -#: ../../c-api/init.rst:857 ../../c-api/init.rst:893 msgid "" "See also :c:member:`PyConfig.orig_argv` and :c:member:`PyConfig.argv` " "members of the :ref:`Python Initialization Configuration `." msgstr "" +":ref:`Python の初期化設定 ` の :c:member:`PyConfig.orig_argv` " +"と :c:member:`PyConfig.argv` メンバーも参照してください。" -#: ../../c-api/init.rst:861 msgid "" "It is recommended that applications embedding the Python interpreter for " "purposes other than executing a single script pass ``0`` as *updatepath*, " "and update :data:`sys.path` themselves if desired. See :cve:`2008-5983`." msgstr "" +"単一のスクリプトを実行する以外の目的で Python インタープリタを組み込むアプリ" +"ケーションでは、*updatepath* に ``0`` を渡し、必要なら :data:`sys.path` を自" +"分で更新することを推奨します。\n" +":cve:`2008-5983` を参照してください。" #: ../../c-api/init.rst:866 msgid "" @@ -1281,16 +1370,18 @@ msgstr "" "に :data:`sys.path` の先頭の要素を取り出すことで、同じ効果が得られます。例え" "ばこのように使います::" -#: ../../c-api/init.rst:870 msgid "PyRun_SimpleString(\"import sys; sys.path.pop(0)\\n\");" -msgstr "" +msgstr "PyRun_SimpleString(\"import sys; sys.path.pop(0)\\n\");" -#: ../../c-api/init.rst:882 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "argv` and :c:member:`PyConfig.parse_argv` should be used instead, see :ref:" "`Python Initialization Configuration `." msgstr "" +"この API は後方互換性のために残されています。\n" +"代わりに :c:member:`PyConfig.argv` と :c:member:`PyConfig.parse_argv` を設定" +"してください。\n" +":ref:`Python の初期化設定 ` を参照してください。" #: ../../c-api/init.rst:886 msgid "" @@ -1306,12 +1397,14 @@ msgstr "" msgid "The *updatepath* value depends on :option:`-I`." msgstr "*updatepath* の値は :option:`-I` オプションに依存します。" -#: ../../c-api/init.rst:903 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "home` should be used instead, see :ref:`Python Initialization Configuration " "`." msgstr "" +"この API は後方互換性のために残されています。\n" +"代わりに :c:member:`PyConfig.home` を設定してください。\n" +":ref:`Python の初期化設定 ` を参照してください。" #: ../../c-api/init.rst:907 msgid "" @@ -1410,22 +1503,24 @@ msgid "" "``NULL``." msgstr "" -#: ../../c-api/init.rst:988 msgid "Detaching the thread state from extension code" -msgstr "" +msgstr "拡張コードからのスレッド状態のデタッチ" -#: ../../c-api/init.rst:990 msgid "" "Most extension code manipulating the :term:`thread state` has the following " "simple structure::" msgstr "" +":term:`スレッド状態 ` を操作する拡張コードの多くは、次の単純な" +"構造を取ります。 ::" -#: ../../c-api/init.rst:993 msgid "" "Save the thread state in a local variable.\n" "... Do some blocking I/O operation ...\n" "Restore the thread state from the local variable." msgstr "" +"// スレッド状態をローカル変数に保存する。\n" +"// ... ブロッキング I/O 操作を行う ...\n" +"// ローカル変数からスレッド状態を復元する。" #: ../../c-api/init.rst:997 msgid "This is so common that a pair of macros exists to simplify it::" @@ -1433,12 +1528,14 @@ msgstr "" "この構造は非常に一般的なので、作業を単純にするために2つのマクロが用意されてい" "ます::" -#: ../../c-api/init.rst:999 msgid "" "Py_BEGIN_ALLOW_THREADS\n" "... Do some blocking I/O operation ...\n" "Py_END_ALLOW_THREADS" msgstr "" +"Py_BEGIN_ALLOW_THREADS\n" +"... ブロッキング I/O 操作を行う ...\n" +"Py_END_ALLOW_THREADS" #: ../../c-api/init.rst:1007 msgid "" @@ -1453,7 +1550,6 @@ msgstr "" msgid "The block above expands to the following code::" msgstr "上のブロックは次のコードに展開されます::" -#: ../../c-api/init.rst:1013 msgid "" "PyThreadState *_save;\n" "\n" @@ -1461,10 +1557,14 @@ msgid "" "... Do some blocking I/O operation ...\n" "PyEval_RestoreThread(_save);" msgstr "" +"PyThreadState *_save;\n" +"\n" +"_save = PyEval_SaveThread();\n" +"... ブロッキング I/O 操作を行う ...\n" +"PyEval_RestoreThread(_save);" -#: ../../c-api/init.rst:1023 msgid "Here is how these functions work:" -msgstr "" +msgstr "これらの関数は次のように動作します。" #: ../../c-api/init.rst:1025 msgid "" @@ -1598,11 +1698,9 @@ msgid "" "PyThreadState_DeleteCurrent();" msgstr "" -#: ../../c-api/init.rst:1120 msgid "Cautions about fork()" -msgstr "" +msgstr "fork() に関する注意" -#: ../../c-api/init.rst:1122 msgid "" "Another important thing to note about threads is their behaviour in the face " "of the C :c:func:`fork` call. On most systems with :c:func:`fork`, after a " @@ -1610,8 +1708,13 @@ msgid "" "concrete impact both on how locks must be handled and on all stored state in " "CPython's runtime." msgstr "" +"スレッドに関するもう 1 つの重要な注意点は、C の :c:func:`fork` 呼び出し時の動" +"作です。\n" +":c:func:`fork` を備えるほとんどのシステムでは、プロセスを fork した後には、" +"fork を呼び出したスレッドだけが存在します。\n" +"これは、ロックの扱い方と CPython ランタイムに保存されたすべての状態の両方に、" +"具体的な影響を及ぼします。" -#: ../../c-api/init.rst:1128 msgid "" "The fact that only the \"current\" thread remains means any locks held by " "other threads will never be released. Python solves this for :func:`os.fork` " @@ -1627,8 +1730,23 @@ msgid "" "after the fork. :c:func:`PyOS_AfterFork_Child` tries to reset the necessary " "locks, but is not always able to." msgstr "" +"「現在の」スレッドだけが残るため、ほかのスレッドが保持していたロックは解放さ" +"れなくなります。\n" +"Python は :func:`os.fork` で、内部で使うロックを fork の前に取得し、後で解放" +"することで対処します。\n" +"さらに、子プロセスの :ref:`lock-objects` をすべてリセットします。\n" +"Python の拡張や組み込みでは、fork 前の取得や fork 後のリセットが必要な、" +"Python 以外の追加のロックを Python に知らせる方法はありません。\n" +"同じ処理を行うには、:c:func:`!pthread_atfork` などの OS の機能を使う必要があ" +"ります。\n" +"また、Python の拡張や組み込みで :func:`os.fork` を経由せずに :c:func:`fork` " +"を直接呼び出し、その後 Python に戻るか Python を呼び出すと、デッドロックが起" +"こる可能性があります。\n" +"Python 内部のロックを保持していたスレッドが、fork 後には存在しなくなるためで" +"す。\n" +":c:func:`PyOS_AfterFork_Child` は必要なロックのリセットを試みますが、常にでき" +"るとは限りません。" -#: ../../c-api/init.rst:1143 msgid "" "The fact that all other threads go away also means that CPython's runtime " "state there must be cleaned up properly, which :func:`os.fork` does. This " @@ -1640,6 +1758,16 @@ msgid "" "originally initialized. The only exception is if :c:func:`exec` will be " "called immediately after." msgstr "" +"ほかのスレッドがすべて消えるため、それらに対応する CPython ランタイムの状態も" +"適切に後始末する必要があります。\n" +":func:`os.fork` はこの処理を行います。\n" +"具体的には、現在のインタープリタに属するほかのすべての :c:type:" +"`PyThreadState` オブジェクトと、ほかのすべての :c:type:`PyInterpreterState` " +"オブジェクトの終了処理を行います。\n" +"このことと :ref:`メインインタープリタ ` の特殊な性質" +"のため、:c:func:`fork` は、CPython のグローバルなランタイムを最初に初期化し" +"た、そのインタープリタの「メイン」スレッドでのみ呼び出すべきです。\n" +"直後に :c:func:`exec` を呼び出す場合だけは例外です。" #: ../../c-api/init.rst:1157 msgid "Cautions regarding runtime finalization" @@ -1714,28 +1842,25 @@ msgstr "" "いません。GILもまた、スレッドがどのインタプリタに属しているかに関わらずすべて" "のスレッドで共有されています。" -#: ../../c-api/init.rst:1204 msgid "" "This data structure represents the state of a single thread. The only " "public data member is:" msgstr "" +"このデータ構造は、1 つのスレッドの状態を表します。\n" +"公開されているデータメンバーは次のものだけです。" -#: ../../c-api/init.rst:1209 msgid "This thread's interpreter state." -msgstr "" +msgstr "このスレッドのインタープリタ状態。" -#: ../../c-api/init.rst:1220 msgid "Deprecated function which does nothing." -msgstr "" +msgstr "何も行わない非推奨の関数です。" -#: ../../c-api/init.rst:1222 msgid "" "In Python 3.6 and older, this function created the GIL if it didn't exist." -msgstr "" +msgstr "Python 3.6 以前では、GIL が存在しなければ作成していました。" -#: ../../c-api/init.rst:1224 msgid "The function now does nothing." -msgstr "" +msgstr "この関数は何も行わなくなりました。" #: ../../c-api/init.rst:1227 msgid "" @@ -1752,76 +1877,97 @@ msgstr "" "この関数は :c:func:`Py_Initialize()` より前に呼び出すことができなくなりまし" "た。" -#: ../../c-api/init.rst:1241 msgid "" "Detach the :term:`attached thread state` and return it. The thread will have " "no :term:`thread state` upon returning." msgstr "" +":term:`アタッチされたスレッド状態 ` をデタッチして返し" +"ます。\n" +"戻るときには、スレッドに :term:`スレッド状態 ` はアタッチされて" +"いません。" -#: ../../c-api/init.rst:1247 msgid "" "Set the :term:`attached thread state` to *tstate*. The passed :term:`thread " "state` **should not** be :term:`attached `, otherwise " "deadlock ensues. *tstate* will be attached upon returning." msgstr "" +":term:`アタッチされたスレッド状態 ` を *tstate* に設定" +"します。\n" +"渡す :term:`スレッド状態 ` は :term:`アタッチされていてはなりま" +"せん `。\n" +"アタッチ済みの場合はデッドロックします。\n" +"戻るときには *tstate* がアタッチされています。" -#: ../../c-api/init.rst:1252 ../../c-api/init.rst:1623 msgid "" "Calling this function from a thread when the runtime is finalizing will hang " "the thread until the program exits, even if the thread was not created by " "Python. Refer to :ref:`cautions-regarding-runtime-finalization` for more " "details." msgstr "" +"ランタイムの終了処理中にスレッドからこの関数を呼び出すと、そのスレッドはプロ" +"グラムが終了するまで停止したままになります。\n" +"これは Python で作成したスレッドでなくても同じです。\n" +"詳しくは :ref:`cautions-regarding-runtime-finalization` を参照してください。" -#: ../../c-api/init.rst:1257 ../../c-api/init.rst:1328 -#: ../../c-api/init.rst:1633 msgid "" "Hangs the current thread, rather than terminating it, if called while the " "interpreter is finalizing." msgstr "" +"インタープリタの終了処理中に呼び出された場合、現在のスレッドを終了させる代わ" +"りに、停止したままにするようになりました。" -#: ../../c-api/init.rst:1263 msgid "" "Return the :term:`attached thread state`. If the thread has no attached " "thread state, (such as when inside of :c:macro:`Py_BEGIN_ALLOW_THREADS` " "block), then this issues a fatal error (so that the caller needn't check for " "``NULL``)." msgstr "" +":term:`アタッチされたスレッド状態 ` を返します。\n" +":c:macro:`Py_BEGIN_ALLOW_THREADS` ブロック内など、スレッド状態がアタッチされ" +"ていない場合は致命的エラーを発生させます (そのため、呼び出し元は ``NULL`` か" +"どうかを調べる必要がありません)。" -#: ../../c-api/init.rst:1268 msgid "See also :c:func:`PyThreadState_GetUnchecked`." -msgstr "" +msgstr ":c:func:`PyThreadState_GetUnchecked` も参照してください。" -#: ../../c-api/init.rst:1272 msgid "" "Similar to :c:func:`PyThreadState_Get`, but don't kill the process with a " "fatal error if it is NULL. The caller is responsible to check if the result " "is NULL." msgstr "" +":c:func:`PyThreadState_Get` と同様ですが、スレッド状態が NULL でも致命的エ" +"ラーでプロセスを終了させません。\n" +"結果が NULL かどうかは、呼び出し元が調べる必要があります。" -#: ../../c-api/init.rst:1276 msgid "" "In Python 3.5 to 3.12, the function was private and known as " "``_PyThreadState_UncheckedGet()``." msgstr "" +"Python 3.5 から 3.12 では、この関数は非公開で、" +"``_PyThreadState_UncheckedGet()`` という名前でした。" -#: ../../c-api/init.rst:1283 msgid "" "Set the :term:`attached thread state` to *tstate*, and return the :term:" "`thread state` that was attached prior to calling." msgstr "" +":term:`アタッチされたスレッド状態 ` を *tstate* に設定" +"し、呼び出し前にアタッチされていた :term:`スレッド状態 ` を返し" +"ます。" -#: ../../c-api/init.rst:1286 msgid "" "This function is safe to call without an :term:`attached thread state`; it " "will simply return ``NULL`` indicating that there was no prior thread state." msgstr "" +":term:`アタッチされたスレッド状態 ` がなくても安全に呼" +"び出せます。\n" +"その場合は、以前のスレッド状態がなかったことを示す ``NULL`` を返すだけです。" -#: ../../c-api/init.rst:1293 msgid "" "Similar to :c:func:`PyGILState_Ensure`, this function will hang the thread " "if the runtime is finalizing." msgstr "" +":c:func:`PyGILState_Ensure` と同様に、ランタイムの終了処理中にはスレッドが停" +"止したままになります。" #: ../../c-api/init.rst:1297 msgid "" @@ -1831,7 +1977,6 @@ msgstr "" "以下の関数はスレッドローカルストレージを利用していて、サブインタプリタとの互" "換性がありません:" -#: ../../c-api/init.rst:1302 msgid "" "Ensure that the current thread is ready to call the Python C API regardless " "of the current state of Python, or of the :term:`attached thread state`. " @@ -1843,8 +1988,16 @@ msgid "" "c:macro:`Py_BEGIN_ALLOW_THREADS` and :c:macro:`Py_END_ALLOW_THREADS` macros " "is acceptable." msgstr "" +"Python や :term:`アタッチされたスレッド状態 ` の現在の" +"状態にかかわらず、現在のスレッドで Python C API を呼び出せるようにします。\n" +"各呼び出しに対応する :c:func:`PyGILState_Release` を呼び出す限り、スレッドは" +"何度でもこの関数を呼び出せます。\n" +"一般に、:c:func:`PyGILState_Ensure` と :c:func:`PyGILState_Release` の間で" +"は、``Release()`` の前にスレッド状態を元に戻す限り、ほかのスレッド関連の API " +"を使っても構いません。\n" +"例えば、:c:macro:`Py_BEGIN_ALLOW_THREADS` と :c:macro:`Py_END_ALLOW_THREADS` " +"マクロは通常どおり使えます。" -#: ../../c-api/init.rst:1312 msgid "" "The return value is an opaque \"handle\" to the :term:`attached thread " "state` when :c:func:`PyGILState_Ensure` was called, and must be passed to :c:" @@ -1853,6 +2006,14 @@ msgid "" "unique call to :c:func:`PyGILState_Ensure` must save the handle for its call " "to :c:func:`PyGILState_Release`." msgstr "" +"戻り値は、:c:func:`PyGILState_Ensure` を呼び出したときの :term:`アタッチされ" +"たスレッド状態 ` を表す不透明な「ハンドル」です。\n" +"Python を同じ状態に戻すため、:c:func:`PyGILState_Release` に渡さなければなり" +"ません。\n" +"再帰的な呼び出しは許可されていますが、ハンドルを共有することは *できません" +"*。\n" +":c:func:`PyGILState_Ensure` の呼び出しごとにハンドルを保存し、その呼び出しに" +"対応する :c:func:`PyGILState_Release` に渡す必要があります。" #: ../../c-api/init.rst:1319 msgid "" @@ -1944,17 +2105,16 @@ msgstr "" "弧は後で :c:macro:`Py_END_ALLOW_THREADS` マクロと対応させなければなりません。" "マクロについての詳しい議論は上記を参照してください。" -#: ../../c-api/init.rst:1390 msgid "" "This macro expands to ``PyEval_RestoreThread(_save); }``. Note that it " "contains a closing brace; it must be matched with an earlier :c:macro:" "`Py_BEGIN_ALLOW_THREADS` macro. See above for further discussion of this " "macro." msgstr "" -"このマクロを展開すると ``PyEval_RestoreThread(_save); }`` になります。マクロ" -"に開き波括弧が入っていることに注意してください; この波括弧は事前の :c:macro:" -"`Py_BEGIN_ALLOW_THREADS` マクロと対応していなければなりません。マクロについて" -"の詳しい議論は上記を参照してください。" +"このマクロを展開すると ``PyEval_RestoreThread(_save); }`` になります。\n" +"閉じ波括弧を含むため、事前の :c:macro:`Py_BEGIN_ALLOW_THREADS` マクロと対応さ" +"せなければなりません。\n" +"このマクロについては上の説明を参照してください。" #: ../../c-api/init.rst:1398 msgid "" @@ -1983,26 +2143,28 @@ msgid "" msgstr "" "次の全ての関数は :c:func:`Py_Initialize` の後に呼び出さなければなりません。" -#: ../../c-api/init.rst:1414 msgid "" ":c:func:`Py_Initialize()` now initializes the :term:`GIL` and sets an :term:" "`attached thread state`." msgstr "" +":c:func:`Py_Initialize()` が :term:`GIL` を初期化し、:term:`スレッド状態をア" +"タッチ ` するようになりました。" -#: ../../c-api/init.rst:1421 msgid "" "Create a new interpreter state object. An :term:`attached thread state` is " "not needed, but may optionally exist if it is necessary to serialize calls " "to this function." msgstr "" +"新しいインタープリタ状態オブジェクトを作成します。\n" +":term:`アタッチされたスレッド状態 ` は必要ありません" +"が、この関数の呼び出しを直列化する必要があれば、存在しても構いません。" -#: ../../c-api/init.rst:1425 msgid "" "Raises an :ref:`auditing event ` ``cpython." "PyInterpreterState_New`` with no arguments." msgstr "" "引数無しで :ref:`監査イベント ` ``cpython.PyInterpreterState_New`` " -"を送出します。 " +"を送出します。" #: ../../c-api/init.rst:1430 msgid "" @@ -2010,33 +2172,41 @@ msgid "" "term:`attached thread state` for the the interpreter." msgstr "" -#: ../../c-api/init.rst:1433 msgid "" "Raises an :ref:`auditing event ` ``cpython." "PyInterpreterState_Clear`` with no arguments." msgstr "" "引数無しで :ref:`監査イベント ` ``cpython." -"PyInterpreterState_Clear`` を送出します。 " +"PyInterpreterState_Clear`` を送出します。" -#: ../../c-api/init.rst:1438 msgid "" "Destroy an interpreter state object. There **should not** be an :term:" "`attached thread state` for the target interpreter. The interpreter state " "must have been reset with a previous call to :c:func:" "`PyInterpreterState_Clear`." msgstr "" +"インタープリタ状態オブジェクトを破棄します。\n" +"対象のインタープリタの :term:`スレッド状態がアタッチされていてはなりません " +"`。\n" +"インタープリタ状態は、事前に :c:func:`PyInterpreterState_Clear` を呼び出して" +"リセットしておく必要があります。" -#: ../../c-api/init.rst:1445 msgid "" "Create a new thread state object belonging to the given interpreter object. " "An :term:`attached thread state` is not needed." msgstr "" +"指定されたインタープリタオブジェクトに属するスレッド状態オブジェクトを新しく" +"作成します。\n" +":term:`アタッチされたスレッド状態 ` は必要ありません。" -#: ../../c-api/init.rst:1450 msgid "" "Reset all information in a :term:`thread state` object. *tstate* must be :" "term:`attached `" msgstr "" +":term:`スレッド状態 ` オブジェクトのすべての情報をリセットしま" +"す。\n" +"*tstate* は :term:`アタッチされていなければなりません `。" #: ../../c-api/init.rst:1453 msgid "" @@ -2048,78 +2218,85 @@ msgstr "" msgid "The :c:member:`PyThreadState.on_delete` callback was removed." msgstr "" -#: ../../c-api/init.rst:1463 msgid "" "Destroy a :term:`thread state` object. *tstate* should not be :term:" "`attached ` to any thread. *tstate* must have been " "reset with a previous call to :c:func:`PyThreadState_Clear`." msgstr "" +":term:`スレッド状態 ` オブジェクトを破棄します。\n" +"*tstate* はどのスレッドにも :term:`アタッチされていてはなりません `。\n" +"事前に :c:func:`PyThreadState_Clear` を呼び出して *tstate* をリセットしておく" +"必要があります。" -#: ../../c-api/init.rst:1471 msgid "" "Detach the :term:`attached thread state` (which must have been reset with a " "previous call to :c:func:`PyThreadState_Clear`) and then destroy it." msgstr "" +":term:`アタッチされたスレッド状態 ` をデタッチし、破棄" +"します。\n" +"このスレッド状態は、事前に :c:func:`PyThreadState_Clear` を呼び出してリセット" +"しておく必要があります。" -#: ../../c-api/init.rst:1474 msgid "" "No :term:`thread state` will be :term:`attached ` " "upon returning." msgstr "" +"戻るときには、:term:`アタッチされた ` :term:`スレッド" +"状態 ` はありません。" -#: ../../c-api/init.rst:1479 msgid "Get the current frame of the Python thread state *tstate*." -msgstr "" +msgstr "Python のスレッド状態 *tstate* の現在のフレームを取得します。" -#: ../../c-api/init.rst:1481 msgid "" "Return a :term:`strong reference`. Return ``NULL`` if no frame is currently " "executing." msgstr "" +":term:`強参照 ` を返します。\n" +"現在実行中のフレームがなければ ``NULL`` を返します。" -#: ../../c-api/init.rst:1484 msgid "See also :c:func:`PyEval_GetFrame`." -msgstr "" +msgstr ":c:func:`PyEval_GetFrame` も参照してください。" -#: ../../c-api/init.rst:1486 ../../c-api/init.rst:1495 -#: ../../c-api/init.rst:1504 msgid "" "*tstate* must not be ``NULL``, and must be :term:`attached `." msgstr "" +"*tstate* は ``NULL`` であってはならず、:term:`アタッチされていなければなりま" +"せん `。" -#: ../../c-api/init.rst:1493 msgid "" "Get the unique :term:`thread state` identifier of the Python thread state " "*tstate*." msgstr "" +"Python のスレッド状態 *tstate* の、一意な :term:`スレッド状態 ` 識別子を取得します。" -#: ../../c-api/init.rst:1502 msgid "Get the interpreter of the Python thread state *tstate*." -msgstr "" +msgstr "Python のスレッド状態 *tstate* のインタープリタを取得します。" -#: ../../c-api/init.rst:1511 msgid "Suspend tracing and profiling in the Python thread state *tstate*." msgstr "" +"Python のスレッド状態 *tstate* でのトレースとプロファイリングを一時停止しま" +"す。" -#: ../../c-api/init.rst:1513 msgid "Resume them using the :c:func:`PyThreadState_LeaveTracing` function." -msgstr "" +msgstr "再開するには :c:func:`PyThreadState_LeaveTracing` を使います。" -#: ../../c-api/init.rst:1520 msgid "" "Resume tracing and profiling in the Python thread state *tstate* suspended " "by the :c:func:`PyThreadState_EnterTracing` function." msgstr "" +":c:func:`PyThreadState_EnterTracing` によって一時停止した、Python のスレッド" +"状態 *tstate* でのトレースとプロファイリングを再開します。" -#: ../../c-api/init.rst:1523 msgid "" "See also :c:func:`PyEval_SetTrace` and :c:func:`PyEval_SetProfile` functions." msgstr "" +":c:func:`PyEval_SetTrace` と :c:func:`PyEval_SetProfile` も参照してください。" -#: ../../c-api/init.rst:1531 msgid "Get the current interpreter." -msgstr "" +msgstr "現在のインタープリタを取得します。" #: ../../c-api/init.rst:1533 msgid "" @@ -2135,11 +2312,10 @@ msgstr "" "インタプリタの一意な ID を返します。\n" "処理中に何かエラーが起きたら、 ``-1`` が返され、エラーがセットされます。" -#: ../../c-api/init.rst:1544 ../../c-api/init.rst:2131 -#: ../../c-api/init.rst:2138 ../../c-api/init.rst:2157 -#: ../../c-api/init.rst:2164 msgid "The caller must have an :term:`attached thread state`." msgstr "" +"呼び出し元には :term:`アタッチされたスレッド状態 ` が" +"必要です。" #: ../../c-api/init.rst:1551 msgid "" @@ -2151,47 +2327,43 @@ msgstr "" "この関数が ``NULL`` を返した場合は、ここまでで例外は送出されておらず、呼び出" "し側はインタプリタ固有の辞書は利用できないと考えなければなりません。" -#: ../../c-api/init.rst:1555 msgid "" "This is not a replacement for :c:func:`PyModule_GetState()`, which " "extensions should use to store interpreter-specific state information." msgstr "" -"この関数は :c:func:`PyModule_GetState()` を置き換えるものではなく、拡張モ" -"ジュールがインタプリタ固有の状態情報を格納するのに使うべきものです。" +"これは :c:func:`PyModule_GetState()` の代わりにはなりません。\n" +"拡張がインタープリタ固有の状態情報を保存するには、そちらを使うべきです。" -#: ../../c-api/init.rst:1563 msgid "Type of a frame evaluation function." -msgstr "" +msgstr "フレーム評価関数の型。" -#: ../../c-api/init.rst:1565 msgid "" "The *throwflag* parameter is used by the ``throw()`` method of generators: " "if non-zero, handle the current exception." msgstr "" +"*throwflag* 引数は、ジェネレーターの ``throw()`` メソッドが使います。\n" +"ゼロ以外の場合は、現在の例外を処理します。" -#: ../../c-api/init.rst:1568 msgid "The function now takes a *tstate* parameter." -msgstr "" +msgstr "*tstate* 引数を受け取るようになりました。" -#: ../../c-api/init.rst:1571 msgid "" "The *frame* parameter changed from ``PyFrameObject*`` to " "``_PyInterpreterFrame*``." msgstr "" +"*frame* 引数が ``PyFrameObject*`` から ``_PyInterpreterFrame*`` に変わりまし" +"た。" -#: ../../c-api/init.rst:1576 msgid "Get the frame evaluation function." -msgstr "" +msgstr "フレーム評価関数を取得します。" -#: ../../c-api/init.rst:1578 ../../c-api/init.rst:1586 msgid "See the :pep:`523` \"Adding a frame evaluation API to CPython\"." msgstr "" +":pep:`523` 「Adding a frame evaluation API to CPython」を参照してください。" -#: ../../c-api/init.rst:1584 msgid "Set the frame evaluation function." -msgstr "" +msgstr "フレーム評価関数を設定します。" -#: ../../c-api/init.rst:1593 msgid "" "Return a dictionary in which extensions can store thread-specific state " "information. Each extension should use a unique key to use to store state " @@ -2200,6 +2372,12 @@ msgid "" "``NULL``, no exception has been raised and the caller should assume no " "thread state is attached." msgstr "" +"拡張がスレッド固有の状態情報を保存するための辞書を返します。\n" +"各拡張は、一意なキーを使って辞書に状態を保存するべきです。\n" +":term:`スレッド状態 ` が :term:`アタッチされていない ` 場合も呼び出せます。\n" +"``NULL`` が返った場合、例外は送出されておらず、呼び出し元はスレッド状態がア" +"タッチされていないと判断するべきです。" #: ../../c-api/init.rst:1603 msgid "" @@ -2221,23 +2399,29 @@ msgstr "" "*id* 引数の型が :c:expr:`long` から :c:expr:`unsigned long` へ変更されまし" "た。" -#: ../../c-api/init.rst:1617 msgid "" ":term:`Attach ` *tstate* to the current thread, which " "must not be ``NULL`` or already :term:`attached `." msgstr "" +"*tstate* を現在のスレッドに :term:`アタッチ ` しま" +"す。\n" +"*tstate* は ``NULL`` であってはならず、すでに :term:`アタッチされていてもなり" +"ません `。" -#: ../../c-api/init.rst:1620 msgid "" "The calling thread must not already have an :term:`attached thread state`." msgstr "" +"呼び出し元のスレッドに、すでに :term:`アタッチされたスレッド状態 ` があってはなりません。" -#: ../../c-api/init.rst:1628 msgid "" "Updated to be consistent with :c:func:`PyEval_RestoreThread`, :c:func:" "`Py_END_ALLOW_THREADS`, and :c:func:`PyGILState_Ensure`, and terminate the " "current thread if called while the interpreter is finalizing." msgstr "" +":c:func:`PyEval_RestoreThread`、:c:func:`Py_END_ALLOW_THREADS`、:c:func:" +"`PyGILState_Ensure` と動作を揃え、インタープリタの終了処理中に呼び出された場" +"合は、現在のスレッドを終了させるようになりました。" #: ../../c-api/init.rst:1637 msgid "" @@ -2247,12 +2431,16 @@ msgstr "" ":c:func:`PyEval_RestoreThread` はいつでも (スレッドが初期化されたいないときで" "も) 利用可能な高レベル関数です。" -#: ../../c-api/init.rst:1643 msgid "" "Detach the :term:`attached thread state`. The *tstate* argument, which must " "not be ``NULL``, is only used to check that it represents the :term:" "`attached thread state` --- if it isn't, a fatal error is reported." msgstr "" +":term:`アタッチされたスレッド状態 ` をデタッチしま" +"す。\n" +"*tstate* 引数は ``NULL`` であってはならず、:term:`アタッチされたスレッド状態 " +"` を表しているかどうかの確認にのみ使われます。\n" +"一致しなければ致命的エラーを報告します。" #: ../../c-api/init.rst:1648 msgid "" @@ -2278,7 +2466,6 @@ msgstr "" "る必要があります。\n" "これを可能にするのがサブインタプリタです。" -#: ../../c-api/init.rst:1662 msgid "" "The \"main\" interpreter is the first one created when the runtime " "initializes. It is usually the only Python interpreter in a process. Unlike " @@ -2288,14 +2475,14 @@ msgid "" "runtime finalization. The :c:func:`PyInterpreterState_Main` function " "returns a pointer to its state." msgstr "" -"\"メイン\" インタプリタとは、ランタイムが初期化を行ったときに最初に作成された" -"インタプリタのことです。\n" -"サブインタプリタと違い、メインインタプリタにはシグナルハンドリングのような、" -"プロセス全域で唯一な責務があります。\n" -"メインインタプリタにはランタイムの初期化中の処理実行という責務もあり、通常は" -"ランタイムの終了処理中に動いているランタイムでもあります。\n" -":c:func:`PyInterpreterState_Main` 関数は、メインインタプリタの状態へのポイン" -"タを返します。" +"「メイン」インタープリタは、ランタイムの初期化時に最初に作成されるインタープ" +"リタです。\n" +"通常、プロセス内の Python インタープリタはこれだけです。\n" +"サブインタープリタとは異なり、メインインタープリタはシグナル処理などの、プロ" +"セス全体に関わる固有の役割を担います。\n" +"ランタイムの初期化中の実行も担い、通常はランタイムの終了処理中にもアクティブ" +"なインタープリタです。\n" +":c:func:`PyInterpreterState_Main` は、その状態へのポインターを返します。" #: ../../c-api/init.rst:1669 msgid "" @@ -2306,69 +2493,83 @@ msgstr "" "サブインタプリタを切り替えが :c:func:`PyThreadState_Swap` 関数でできます。\n" "次の関数を使ってサブインタプリタの作成と削除が行えます:" -#: ../../c-api/init.rst:1675 msgid "" "Structure containing most parameters to configure a sub-interpreter. Its " "values are used only in :c:func:`Py_NewInterpreterFromConfig` and never " "modified by the runtime." msgstr "" +"サブインタープリタの設定に使うパラメーターの大部分を含む構造体です。\n" +"値は :c:func:`Py_NewInterpreterFromConfig` でのみ使用され、ランタイムによって" +"変更されることはありません。" #: ../../c-api/init.rst:1681 msgid "Structure fields:" msgstr "構造体フィールド:" -#: ../../c-api/init.rst:1685 msgid "" "If this is ``0`` then the sub-interpreter will use its own \"object\" " "allocator state. Otherwise it will use (share) the main interpreter's." msgstr "" +"``0`` の場合、サブインタープリタは独自の「オブジェクト」アロケーターの状態を" +"使います。\n" +"それ以外の場合は、メインインタープリタの状態を共有して使います。" -#: ../../c-api/init.rst:1689 msgid "" "If this is ``0`` then :c:member:`~PyInterpreterConfig." "check_multi_interp_extensions` must be ``1`` (non-zero). If this is ``1`` " "then :c:member:`~PyInterpreterConfig.gil` must not be :c:macro:" "`PyInterpreterConfig_OWN_GIL`." msgstr "" +"``0`` の場合、:c:member:`~PyInterpreterConfig.check_multi_interp_extensions` " +"は ``1`` (ゼロ以外) でなければなりません。\n" +"``1`` の場合、:c:member:`~PyInterpreterConfig.gil` は :c:macro:" +"`PyInterpreterConfig_OWN_GIL` であってはなりません。" -#: ../../c-api/init.rst:1697 msgid "" "If this is ``0`` then the runtime will not support forking the process in " "any thread where the sub-interpreter is currently active. Otherwise fork is " "unrestricted." msgstr "" +"``0`` の場合、このサブインタープリタが現在アクティブなスレッドでは、ランタイ" +"ムはプロセスの fork を許可しません。\n" +"それ以外の場合、fork に制限はありません。" -#: ../../c-api/init.rst:1701 msgid "" "Note that the :mod:`subprocess` module still works when fork is disallowed." -msgstr "" +msgstr "fork を許可しなくても、:mod:`subprocess` モジュールは動作します。" -#: ../../c-api/init.rst:1706 msgid "" "If this is ``0`` then the runtime will not support replacing the current " "process via exec (e.g. :func:`os.execv`) in any thread where the sub-" "interpreter is currently active. Otherwise exec is unrestricted." msgstr "" +"``0`` の場合、このサブインタープリタが現在アクティブなスレッドでは、ランタイ" +"ムは exec (:func:`os.execv` など) による現在のプロセスの置き換えを許可しませ" +"ん。\n" +"それ以外の場合、exec に制限はありません。" -#: ../../c-api/init.rst:1711 msgid "" "Note that the :mod:`subprocess` module still works when exec is disallowed." -msgstr "" +msgstr "exec を許可しなくても、:mod:`subprocess` モジュールは動作します。" -#: ../../c-api/init.rst:1716 msgid "" "If this is ``0`` then the sub-interpreter's :mod:`threading` module won't " "create threads. Otherwise threads are allowed." msgstr "" +"``0`` の場合、このサブインタープリタの :mod:`threading` モジュールはスレッド" +"を作成しません。\n" +"それ以外の場合は、スレッドの作成が許可されます。" -#: ../../c-api/init.rst:1722 msgid "" "If this is ``0`` then the sub-interpreter's :mod:`threading` module won't " "create daemon threads. Otherwise daemon threads are allowed (as long as :c:" "member:`~PyInterpreterConfig.allow_threads` is non-zero)." msgstr "" +"``0`` の場合、このサブインタープリタの :mod:`threading` モジュールはデーモン" +"スレッドを作成しません。\n" +"それ以外の場合は、:c:member:`~PyInterpreterConfig.allow_threads` がゼロでない" +"限り、デーモンスレッドの作成が許可されます。" -#: ../../c-api/init.rst:1729 msgid "" "If this is ``0`` then all extension modules may be imported, including " "legacy (single-phase init) modules, in any thread where the sub-interpreter " @@ -2376,36 +2577,42 @@ msgid "" "pep:`489`) may be imported. (Also see :c:macro:" "`Py_mod_multiple_interpreters`.)" msgstr "" +"``0`` の場合、このサブインタープリタが現在アクティブなスレッドでは、従来の単" +"相初期化モジュールを含め、すべての拡張モジュールをインポートできます。\n" +"それ以外の場合は、多相初期化を使う拡張モジュールのみインポートできます (:pep:" +"`489` を参照)。\n" +":c:macro:`Py_mod_multiple_interpreters` も参照してください。" -#: ../../c-api/init.rst:1736 msgid "" "This must be ``1`` (non-zero) if :c:member:`~PyInterpreterConfig." "use_main_obmalloc` is ``0``." msgstr "" +":c:member:`~PyInterpreterConfig.use_main_obmalloc` が ``0`` の場合は、``1`` " +"(ゼロ以外) でなければなりません。" -#: ../../c-api/init.rst:1741 msgid "" "This determines the operation of the GIL for the sub-interpreter. It may be " "one of the following:" msgstr "" +"サブインタープリタの GIL の動作を指定します。\n" +"次のいずれかの値を取ります。" -#: ../../c-api/init.rst:1748 msgid "Use the default selection (:c:macro:`PyInterpreterConfig_SHARED_GIL`)." msgstr "" +"デフォルトの選択 (:c:macro:`PyInterpreterConfig_SHARED_GIL`) を使います。" -#: ../../c-api/init.rst:1752 msgid "Use (share) the main interpreter's GIL." -msgstr "" +msgstr "メインインタープリタの GIL を共有して使います。" -#: ../../c-api/init.rst:1756 msgid "Use the sub-interpreter's own GIL." -msgstr "" +msgstr "サブインタープリタ独自の GIL を使います。" -#: ../../c-api/init.rst:1758 msgid "" "If this is :c:macro:`PyInterpreterConfig_OWN_GIL` then :c:member:" "`PyInterpreterConfig.use_main_obmalloc` must be ``0``." msgstr "" +":c:macro:`PyInterpreterConfig_OWN_GIL` の場合、:c:member:" +"`PyInterpreterConfig.use_main_obmalloc` は ``0`` でなければなりません。" #: ../../c-api/init.rst:1772 msgid "" @@ -2430,13 +2637,11 @@ msgstr "" "stdout``, ``sys.stderr`` を持ちます (とはいえ、これらのストリームは根底にある" "同じファイル記述子を参照しています)。" -#: ../../c-api/init.rst:1782 msgid "" "The given *config* controls the options with which the interpreter is " "initialized." -msgstr "" +msgstr "*config* は、インタープリタの初期化に使うオプションを指定します。" -#: ../../c-api/init.rst:1785 msgid "" "Upon success, *tstate_p* will be set to the first :term:`thread state` " "created in the new sub-interpreter. This thread state is :term:`attached " @@ -2446,8 +2651,16 @@ msgid "" "exception state is stored in the :term:`attached thread state`, which might " "not exist." msgstr "" +"成功時は、新しいサブインタープリタで最初に作成した :term:`スレッド状態 " +"` が *tstate_p* に設定されます。\n" +"このスレッド状態は :term:`アタッチされています `。\n" +"実際のスレッドは作成しないことに注意してください。\n" +"以下のスレッド状態についての説明を参照してください。\n" +"新しいインタープリタの作成に失敗すると、*tstate_p* は ``NULL`` に設定されま" +"す。\n" +"例外の状態は :term:`アタッチされたスレッド状態 ` に保" +"存されますが、それが存在しない場合もあるため、例外は設定されません。" -#: ../../c-api/init.rst:1794 msgid "" "Like all other Python/C API functions, an :term:`attached thread state` must " "be present before calling this function, but it might be detached upon " @@ -2459,14 +2672,26 @@ msgid "" "current thread and the previous interpreter's :term:`attached thread state` " "will remain detached." msgstr "" +"ほかの Python/C API 関数と同様に、呼び出す前には :term:`アタッチされたスレッ" +"ド状態 ` が必要ですが、戻るときにはデタッチされている" +"場合があります。\n" +"成功時には、返されたスレッド状態が :term:`アタッチされています `。\n" +"独自の :term:`GIL` を持つサブインタープリタを作成した場合は、呼び出し元のイン" +"タープリタの :term:`アタッチされたスレッド状態 ` がデ" +"タッチされます。\n" +"関数が戻るときには、新しいインタープリタの :term:`スレッド状態 ` が現在のスレッドに :term:`アタッチされ `、元の" +"インタープリタの :term:`アタッチされていたスレッド状態 ` はデタッチされたままです。" -#: ../../c-api/init.rst:1805 msgid "" "Sub-interpreters are most effective when isolated from each other, with " "certain functionality restricted::" msgstr "" +"サブインタープリタは、一部の機能を制限して互いに隔離したときに、最も効果を発" +"揮します。 ::" -#: ../../c-api/init.rst:1808 msgid "" "PyInterpreterConfig config = {\n" " .use_main_obmalloc = 0,\n" @@ -2483,26 +2708,48 @@ msgid "" " Py_ExitStatusException(status);\n" "}" msgstr "" +"PyInterpreterConfig config = {\n" +" .use_main_obmalloc = 0,\n" +" .allow_fork = 0,\n" +" .allow_exec = 0,\n" +" .allow_threads = 1,\n" +" .allow_daemon_threads = 0,\n" +" .check_multi_interp_extensions = 1,\n" +" .gil = PyInterpreterConfig_OWN_GIL,\n" +"};\n" +"PyThreadState *tstate = NULL;\n" +"PyStatus status = Py_NewInterpreterFromConfig(&tstate, &config);\n" +"if (PyStatus_Exception(status)) {\n" +" Py_ExitStatusException(status);\n" +"}" -#: ../../c-api/init.rst:1823 msgid "" "Note that the config is used only briefly and does not get modified. During " "initialization the config's values are converted into various :c:type:" "`PyInterpreterState` values. A read-only copy of the config may be stored " "internally on the :c:type:`PyInterpreterState`." msgstr "" +"設定は短時間だけ使われ、変更されることはありません。\n" +"初期化中に、設定の値が :c:type:`PyInterpreterState` の各種の値に変換されま" +"す。\n" +"設定の読み取り専用のコピーが、:c:type:`PyInterpreterState` 内部に保存される場" +"合もあります。" -#: ../../c-api/init.rst:1832 msgid "Extension modules are shared between (sub-)interpreters as follows:" msgstr "" +"拡張モジュールは、インタープリタ間 (サブインタープリタを含む) で次のように共" +"有されます。" -#: ../../c-api/init.rst:1834 msgid "" "For modules using multi-phase initialization, e.g. :c:func:" "`PyModule_FromDefAndSpec`, a separate module object is created and " "initialized for each interpreter. Only C-level static and global variables " "are shared between these module objects." msgstr "" +":c:func:`PyModule_FromDefAndSpec` などの多相初期化を使うモジュールでは、イン" +"タープリタごとに別のモジュールオブジェクトを作成して初期化します。\n" +"これらのモジュールオブジェクトが共有するのは、C レベルの静的変数とグローバル" +"変数だけです。" #: ../../c-api/init.rst:1840 msgid "" @@ -2516,7 +2763,6 @@ msgid "" "might cause unwanted behavior (see `Bugs and caveats`_ below)." msgstr "" -#: ../../c-api/init.rst:1851 msgid "" "Note that this is different from what happens when an extension is imported " "after the interpreter has been completely re-initialized by calling :c:func:" @@ -2525,8 +2771,12 @@ msgid "" "initialization, this means that only C-level static and global variables are " "shared between these modules." msgstr "" +":c:func:`Py_FinalizeEx` と :c:func:`Py_Initialize` を呼び出してインタープリタ" +"を完全に再初期化した後で、拡張をインポートする場合とは異なります。\n" +"その場合は、拡張の ``initmodule`` 関数が再び呼び出され *ます*。\n" +"多相初期化の場合と同様に、これらのモジュール間で共有されるのは、C レベルの静" +"的変数とグローバル変数だけです。" -#: ../../c-api/init.rst:1871 msgid "" "Create a new sub-interpreter. This is essentially just a wrapper around :c:" "func:`Py_NewInterpreterFromConfig` with a config that preserves the existing " @@ -2534,20 +2784,32 @@ msgid "" "interpreter's GIL, allows fork/exec, allows daemon threads, and allows " "single-phase init modules." msgstr "" +"新しいサブインタープリタを作成します。\n" +"基本的には、従来の動作を維持する設定で :c:func:`Py_NewInterpreterFromConfig` " +"を呼び出すラッパーです。\n" +"作成されるサブインタープリタは隔離されておらず、メインインタープリタの GIL を" +"共有し、fork/exec、デーモンスレッド、単相初期化モジュールを許可します。" -#: ../../c-api/init.rst:1883 msgid "" "Destroy the (sub-)interpreter represented by the given :term:`thread state`. " "The given thread state must be :term:`attached `. " "When the call returns, there will be no :term:`attached thread state`. All " "thread states associated with this interpreter are destroyed." msgstr "" +"指定された :term:`スレッド状態 ` が表すインタープリタ (サブイン" +"タープリタを含む) を破棄します。\n" +"指定したスレッド状態は :term:`アタッチされていなければなりません `。\n" +"呼び出しから戻るときには、:term:`アタッチされたスレッド状態 ` はありません。\n" +"このインタープリタに関連付けられたすべてのスレッド状態が破棄されます。" -#: ../../c-api/init.rst:1888 msgid "" ":c:func:`Py_FinalizeEx` will destroy all sub-interpreters that haven't been " "explicitly destroyed at that point." msgstr "" +":c:func:`Py_FinalizeEx` は、その時点で明示的に破棄されていないサブインタープ" +"リタをすべて破棄します。" #: ../../c-api/init.rst:1893 msgid "A Per-Interpreter GIL" @@ -2565,7 +2827,6 @@ msgid "" "just using threads. (See :pep:`554`.)" msgstr "" -#: ../../c-api/init.rst:1905 msgid "" "Using an isolated interpreter requires vigilance in preserving that " "isolation. That especially means not sharing any objects or mutable state " @@ -2578,14 +2839,29 @@ msgid "" "been done for the builtin singletons, small integers, and a number of other " "builtin objects." msgstr "" +"隔離されたインタープリタを使うには、隔離を維持するよう注意しなければなりませ" +"ん。\n" +"特に、スレッドセーフである保証なしにオブジェクトや可変の状態を共有してはいけ" +"ません。\n" +"参照カウントがあるため、``None`` や ``(1, 5)`` のように、それ以外の点では不変" +"なオブジェクトであっても、通常は共有できません。\n" +"単純ですが効率の劣る回避策として、ある状態やオブジェクトを使うすべての操作を" +"グローバルなロックで保護する方法があります。\n" +"また、整数や文字列のように実質的に不変なオブジェクトは、:term:`不死 " +"` にすることで、参照カウントがあっても安全にできます。\n" +"実際に、組み込みのシングルトン、小さい整数、その他多くの組み込みオブジェクト" +"にこの方法が使われています。" -#: ../../c-api/init.rst:1916 msgid "" "If you preserve isolation then you will have access to proper multi-core " "computing without the complications that come with free-threading. Failure " "to preserve isolation will expose you to the full consequences of free-" "threading, including races and hard-to-debug crashes." msgstr "" +"隔離を維持すれば、フリースレッド化に伴う複雑さなしに、複数のコアを使った計算" +"を行えます。\n" +"隔離を維持できなければ、競合状態やデバッグの難しいクラッシュなど、フリース" +"レッド化のあらゆる問題にさらされます。" #: ../../c-api/init.rst:1921 msgid "" @@ -2614,7 +2890,6 @@ msgid "" "should be avoided if possible." msgstr "" -#: ../../c-api/init.rst:1944 msgid "" "Special care should be taken to avoid sharing user-defined functions, " "methods, instances or classes between sub-interpreters, since import " @@ -2622,6 +2897,12 @@ msgid "" "dictionary of loaded modules. It is equally important to avoid sharing " "objects from which the above are reachable." msgstr "" +"サブインタープリタ間で、ユーザー定義の関数、メソッド、インスタンス、クラスを" +"共有しないよう、特に注意するべきです。\n" +"それらが実行するインポート操作によって、誤ったインタープリタのロード済みモ" +"ジュールの辞書に影響する可能性があるためです。\n" +"これらのオブジェクトにたどり着けるオブジェクトの共有を避けることも、同様に重" +"要です。" #: ../../c-api/init.rst:1950 msgid "" @@ -2682,19 +2963,24 @@ msgstr "" msgid "on a :term:`bytecode` boundary;" msgstr ":term:`bytecode` 境界上にいるとき、" -#: ../../c-api/init.rst:1980 msgid "" "with the main thread holding an :term:`attached thread state` (*func* can " "therefore use the full C API)." msgstr "" +"メインスレッドに :term:`スレッド状態がアタッチされている ` こと (したがって *func* はすべての C API を使えます)。" -#: ../../c-api/init.rst:1983 msgid "" "*func* must return ``0`` on success, or ``-1`` on failure with an exception " "set. *func* won't be interrupted to perform another asynchronous " "notification recursively, but it can still be interrupted to switch threads " "if the :term:`thread state ` is detached." msgstr "" +"*func* は成功時に ``0`` を返し、失敗時には例外を設定して ``-1`` を返さなけれ" +"ばなりません。\n" +"別の非同期通知を再帰的に処理するために *func* が中断されることはありません" +"が、:term:`スレッド状態 ` がデタッチされると、スレッド" +"の切り替えのために中断されることはあります。" #: ../../c-api/init.rst:1988 msgid "" @@ -2720,13 +3006,16 @@ msgstr "" "には **向きません** 。これの代わりに、 :ref:`PyGILState API` を使用" "してください。" -#: ../../c-api/init.rst:2002 msgid "" "If this function is called in a subinterpreter, the function *func* is now " "scheduled to be called from the subinterpreter, rather than being called " "from the main interpreter. Each subinterpreter now has its own list of " "scheduled calls." msgstr "" +"サブインタープリタでこの関数を呼び出すと、*func* はメインインタープリタではな" +"く、そのサブインタープリタで呼び出されるようになりました。\n" +"サブインタープリタごとに、呼び出しを予定した関数のリストを持つようになりまし" +"た。" #: ../../c-api/init.rst:2011 msgid "Profiling and Tracing" @@ -2759,7 +3048,6 @@ msgstr "" "ルでき、トレース関数に報告される基本イベント (basic event) は以前のバージョン" "において Python レベルのトレース関数で報告されていたものと同じです。" -#: ../../c-api/init.rst:2030 msgid "" "The type of the trace function registered using :c:func:`PyEval_SetProfile` " "and :c:func:`PyEval_SetTrace`. The first parameter is the object passed to " @@ -2770,6 +3058,14 @@ msgid "" "`PyTrace_C_RETURN`, or :c:data:`PyTrace_OPCODE`, and *arg* depends on the " "value of *what*:" msgstr "" +":c:func:`PyEval_SetProfile` と :c:func:`PyEval_SetTrace` で登録するトレース関" +"数の型です。\n" +"第 1 引数は登録関数に ``obj`` として渡したオブジェクト、``frame`` はイベント" +"の対象のフレームオブジェクトです。\n" +"``what`` は定数 :c:data:`PyTrace_CALL`、:c:data:`PyTrace_EXCEPTION`、:c:data:" +"`PyTrace_LINE`、:c:data:`PyTrace_RETURN`、:c:data:`PyTrace_C_CALL`、:c:data:" +"`PyTrace_C_EXCEPTION`、:c:data:`PyTrace_C_RETURN`、:c:data:`PyTrace_OPCODE` " +"のいずれかで、``arg`` は ``what`` の値によって異なります。" #: ../../c-api/init.rst:2039 msgid "Value of *what*" @@ -2779,30 +3075,26 @@ msgstr "*what* の値" msgid "Meaning of *arg*" msgstr "*arg* の意味" -#: ../../c-api/init.rst:2041 msgid ":c:data:`PyTrace_CALL`" -msgstr "" +msgstr ":c:data:`PyTrace_CALL`" #: ../../c-api/init.rst:2041 ../../c-api/init.rst:2046 #: ../../c-api/init.rst:2057 msgid "Always :c:data:`Py_None`." msgstr "常に :c:data:`Py_None` 。" -#: ../../c-api/init.rst:2043 msgid ":c:data:`PyTrace_EXCEPTION`" -msgstr "" +msgstr ":c:data:`PyTrace_EXCEPTION`" #: ../../c-api/init.rst:2043 msgid "Exception information as returned by :func:`sys.exc_info`." msgstr ":func:`sys.exc_info` の返す例外情報です。" -#: ../../c-api/init.rst:2046 msgid ":c:data:`PyTrace_LINE`" -msgstr "" +msgstr ":c:data:`PyTrace_LINE`" -#: ../../c-api/init.rst:2048 msgid ":c:data:`PyTrace_RETURN`" -msgstr "" +msgstr ":c:data:`PyTrace_RETURN`" #: ../../c-api/init.rst:2048 msgid "" @@ -2811,28 +3103,23 @@ msgstr "" "呼び出し側に返される予定の値か、例外によって関数を抜ける場合は ``NULL`` で" "す。" -#: ../../c-api/init.rst:2051 msgid ":c:data:`PyTrace_C_CALL`" -msgstr "" +msgstr ":c:data:`PyTrace_C_CALL`" #: ../../c-api/init.rst:2051 ../../c-api/init.rst:2053 #: ../../c-api/init.rst:2055 msgid "Function object being called." msgstr "呼び出される関数オブジェクト。" -#: ../../c-api/init.rst:2053 msgid ":c:data:`PyTrace_C_EXCEPTION`" -msgstr "" +msgstr ":c:data:`PyTrace_C_EXCEPTION`" -#: ../../c-api/init.rst:2055 msgid ":c:data:`PyTrace_C_RETURN`" -msgstr "" +msgstr ":c:data:`PyTrace_C_RETURN`" -#: ../../c-api/init.rst:2057 msgid ":c:data:`PyTrace_OPCODE`" -msgstr "" +msgstr ":c:data:`PyTrace_OPCODE`" -#: ../../c-api/init.rst:2062 msgid "" "The value of the *what* parameter to a :c:type:`Py_tracefunc` function when " "a new call to a function or method is being reported, or a new entry into a " @@ -2840,11 +3127,10 @@ msgid "" "is not reported as there is no control transfer to the Python bytecode in " "the corresponding frame." msgstr "" -"関数やメソッドが新たに呼び出されたり、ジェネレータが新たなエントリの処理に" -"入ったことを報告する際の、 :c:type:`Py_tracefunc` の *what* の値です。イテ" -"レータやジェネレータ関数の生成は、対応するフレーム内の Python バイトコードに" -"制御の委譲 (control transfer) が起こらないため報告されないので注意してくださ" -"い。" +"関数やメソッドの新たな呼び出し、またはジェネレータへの新たな進入を報告すると" +"きに、:c:type:`Py_tracefunc` 関数の ``what`` 引数に渡される値です。\n" +"ジェネレータ関数からイテレータを作成する時点では、対応するフレーム内の " +"Python バイトコードに制御が移らないため、このイベントは報告されません。" #: ../../c-api/init.rst:2071 msgid "" @@ -2864,13 +3150,16 @@ msgstr "" "から処理が戻るごとにコールバック関数が呼び出されます。トレース関数だけがこれ" "らのイベントを受け取ります; プロファイラはこの種のイベントを必要としません。" -#: ../../c-api/init.rst:2082 msgid "" "The value passed as the *what* parameter to a :c:type:`Py_tracefunc` " "function (but not a profiling function) when a line-number event is being " "reported. It may be disabled for a frame by setting :attr:`~frame." "f_trace_lines` to *0* on that frame." msgstr "" +"行番号のイベントを報告するときに、:c:type:`Py_tracefunc` 関数 (プロファイリン" +"グ関数を除く) の ``what`` 引数に渡される値です。\n" +"フレームの :attr:`~frame.f_trace_lines` を *0* に設定すると、そのフレームでは" +"無効にできます。" #: ../../c-api/init.rst:2090 msgid "" @@ -2904,15 +3193,18 @@ msgstr "" "C関数から戻るときに :c:type:`Py_tracefunc` 関数の *what* 引数として渡す値で" "す。" -#: ../../c-api/init.rst:2114 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions (but " "not profiling functions) when a new opcode is about to be executed. This " "event is not emitted by default: it must be explicitly requested by setting :" "attr:`~frame.f_trace_opcodes` to *1* on the frame." msgstr "" +"新しいオペコードを実行しようとするときに、:c:type:`Py_tracefunc` 関数 (プロ" +"ファイリング関数を除く) の ``what`` 引数に渡される値です。\n" +"このイベントはデフォルトでは発生しません。\n" +"フレームの :attr:`~frame.f_trace_opcodes` を *1* に設定して明示的に要求する必" +"要があります。" -#: ../../c-api/init.rst:2122 msgid "" "Set the profiler function to *func*. The *obj* parameter is passed to the " "function as its first parameter, and may be any Python object, or ``NULL``. " @@ -2921,25 +3213,33 @@ msgid "" "it. The profile function is called for all monitored events except :c:data:" "`PyTrace_LINE` :c:data:`PyTrace_OPCODE` and :c:data:`PyTrace_EXCEPTION`." msgstr "" +"プロファイラ関数を ``func`` に設定します。\n" +"``obj`` はその関数の第 1 引数として渡され、任意の Python オブジェクトまたは " +"``NULL`` を指定できます。\n" +"プロファイラ関数が状態を保持する必要がある場合は、スレッドごとに異なる " +"``obj`` を使うと、便利でスレッドセーフな保存先になります。\n" +"プロファイラ関数は :c:data:`PyTrace_LINE`、:c:data:`PyTrace_OPCODE`、:c:data:" +"`PyTrace_EXCEPTION` を除くすべての監視対象イベントについて呼び出されます。" #: ../../c-api/init.rst:2129 msgid "See also the :func:`sys.setprofile` function." msgstr ":func:`sys.setprofile` 関数も参照してください。" -#: ../../c-api/init.rst:2135 msgid "" "Like :c:func:`PyEval_SetProfile` but sets the profile function in all " "running threads belonging to the current interpreter instead of the setting " "it only on the current thread." msgstr "" +":c:func:`PyEval_SetProfile` と同様ですが、現在のスレッドだけでなく、現在のイ" +"ンタープリタに属する実行中のすべてのスレッドにプロファイラ関数を設定します。" -#: ../../c-api/init.rst:2140 msgid "" "As :c:func:`PyEval_SetProfile`, this function ignores any exceptions raised " "while setting the profile functions in all threads." msgstr "" +":c:func:`PyEval_SetProfile` と同様に、すべてのスレッドにプロファイラ関数を設" +"定する際に発生した例外を無視します。" -#: ../../c-api/init.rst:2148 msgid "" "Set the tracing function to *func*. This is similar to :c:func:" "`PyEval_SetProfile`, except the tracing function does receive line-number " @@ -2949,29 +3249,36 @@ msgid "" "`PyTrace_C_EXCEPTION` or :c:data:`PyTrace_C_RETURN` as a value for the " "*what* parameter." msgstr "" +"トレース関数を ``func`` に設定します。\n" +":c:func:`PyEval_SetProfile` と同様ですが、トレース関数は行番号のイベントとオ" +"ペコードごとのイベントを受け取り、C 関数オブジェクトの呼び出しに関連するイベ" +"ントは受け取りません。\n" +":c:func:`PyEval_SetTrace` で登録したトレース関数には、``what`` 引数として :c:" +"data:`PyTrace_C_CALL`、:c:data:`PyTrace_C_EXCEPTION`、:c:data:" +"`PyTrace_C_RETURN` が渡されることはありません。" #: ../../c-api/init.rst:2155 msgid "See also the :func:`sys.settrace` function." msgstr ":func:`sys.settrace` 関数も参照してください。" -#: ../../c-api/init.rst:2161 msgid "" "Like :c:func:`PyEval_SetTrace` but sets the tracing function in all running " "threads belonging to the current interpreter instead of the setting it only " "on the current thread." msgstr "" +":c:func:`PyEval_SetTrace` と同様ですが、現在のスレッドだけでなく、現在のイン" +"タープリタに属する実行中のすべてのスレッドにトレース関数を設定します。" -#: ../../c-api/init.rst:2166 msgid "" "As :c:func:`PyEval_SetTrace`, this function ignores any exceptions raised " "while setting the trace functions in all threads." msgstr "" +":c:func:`PyEval_SetTrace` と同様に、すべてのスレッドにトレース関数を設定する" +"際に発生した例外を無視します。" -#: ../../c-api/init.rst:2172 msgid "Reference tracing" -msgstr "" +msgstr "参照のトレース" -#: ../../c-api/init.rst:2178 msgid "" "The type of the trace function registered using :c:func:" "`PyRefTracer_SetTracer`. The first parameter is a Python object that has " @@ -2980,12 +3287,19 @@ msgid "" "`PyRefTracer_DESTROY`). The **data** argument is the opaque pointer that was " "provided when :c:func:`PyRefTracer_SetTracer` was called." msgstr "" +":c:func:`PyRefTracer_SetTracer` で登録するトレース関数の型です。\n" +"第 1 引数は、作成されたばかりの Python オブジェクト (``event`` が :c:data:" +"`PyRefTracer_CREATE` の場合)、またはこれから破棄されるオブジェクト " +"(``event`` が :c:data:`PyRefTracer_DESTROY` の場合) です。\n" +"``data`` 引数は :c:func:`PyRefTracer_SetTracer` の呼び出し時に渡した不透明な" +"ポインタです。" -#: ../../c-api/init.rst:2188 msgid "" "The value for the *event* parameter to :c:type:`PyRefTracer` functions when " "a Python object has been created." msgstr "" +"Python オブジェクトが作成されたときに、:c:type:`PyRefTracer` 関数の " +"``event`` 引数に渡される値です。" #: ../../c-api/init.rst:2193 msgid "" @@ -3010,18 +3324,22 @@ msgid "" "active every time the tracer function is called." msgstr "" -#: ../../c-api/init.rst:2209 ../../c-api/init.rst:2220 msgid "" "There must be an :term:`attached thread state` when calling this function." msgstr "" +"この関数の呼び出し時には :term:`スレッド状態がアタッチされている ` 必要があります。" -#: ../../c-api/init.rst:2215 msgid "" "Get the registered reference tracer function and the value of the opaque " "data pointer that was registered when :c:func:`PyRefTracer_SetTracer` was " "called. If no tracer was registered this function will return NULL and will " "set the **data** pointer to NULL." msgstr "" +"登録された参照トレーサ関数と、:c:func:`PyRefTracer_SetTracer` の呼び出し時に" +"登録された不透明なデータポインタの値を取得します。\n" +"トレーサが登録されていない場合は NULL を返し、``data`` ポインタを NULL に設定" +"します。" #: ../../c-api/init.rst:2227 msgid "Advanced Debugger Support" @@ -3176,43 +3494,51 @@ msgstr "" "ルドされた拡張モジュールで必要になりますが、その実装がビルド時に不透明なため" "に、この型の静的なメモリ確保は不可能です。" -#: ../../c-api/init.rst:2330 msgid "" "Return a value which is the same state as a value initialized with :c:macro:" "`Py_tss_NEEDS_INIT`, or ``NULL`` in the case of dynamic allocation failure." msgstr "" +":c:macro:`Py_tss_NEEDS_INIT` で初期化した値と同じ状態の値を返します。\n" +"動的なメモリ確保に失敗した場合は ``NULL`` を返します。" -#: ../../c-api/init.rst:2337 msgid "" "Free the given *key* allocated by :c:func:`PyThread_tss_alloc`, after first " "calling :c:func:`PyThread_tss_delete` to ensure any associated thread locals " "have been unassigned. This is a no-op if the *key* argument is ``NULL``." msgstr "" +"まず :c:func:`PyThread_tss_delete` を呼んで、関連付けられたスレッドローカルな" +"値との対応を解除してから、\n" +":c:func:`PyThread_tss_alloc` で確保した *key* を解放します。\n" +"*key* 引数が ``NULL`` の場合は何もしません。" -#: ../../c-api/init.rst:2343 msgid "" "A freed key becomes a dangling pointer. You should reset the key to ``NULL``." msgstr "" +"解放したキーはダングリングポインタになります。\n" +"キーを ``NULL`` に設定し直してください。" #: ../../c-api/init.rst:2348 msgid "Methods" msgstr "メソッド" -#: ../../c-api/init.rst:2350 msgid "" "The parameter *key* of these functions must not be ``NULL``. Moreover, the " "behaviors of :c:func:`PyThread_tss_set` and :c:func:`PyThread_tss_get` are " "undefined if the given :c:type:`Py_tss_t` has not been initialized by :c:" "func:`PyThread_tss_create`." msgstr "" +"これらの関数の引数 *key* は ``NULL`` であってはなりません。\n" +"また、指定された :c:type:`Py_tss_t` を :c:func:`PyThread_tss_create` で初期化" +"していなければ、\n" +":c:func:`PyThread_tss_set` と :c:func:`PyThread_tss_get` の動作は未定義です。" -#: ../../c-api/init.rst:2358 msgid "" "Return a non-zero value if the given :c:type:`Py_tss_t` has been initialized " "by :c:func:`PyThread_tss_create`." msgstr "" +"指定された :c:type:`Py_tss_t` が :c:func:`PyThread_tss_create` で初期化されて" +"いれば、0 以外の値を返します。" -#: ../../c-api/init.rst:2364 msgid "" "Return a zero value on successful initialization of a TSS key. The behavior " "is undefined if the value pointed to by the *key* argument is not " @@ -3220,8 +3546,12 @@ msgid "" "repeatedly on the same key -- calling it on an already initialized key is a " "no-op and immediately returns success." msgstr "" +"TSS キーの初期化に成功すると 0 を返します。\n" +"*key* 引数が指す値を :c:macro:`Py_tss_NEEDS_INIT` で初期化していなければ、動" +"作は未定義です。\n" +"同じキーに対して繰り返し呼び出せます。\n" +"初期化済みのキーに対しては何もせず、即座に成功を返します。" -#: ../../c-api/init.rst:2373 msgid "" "Destroy a TSS key to forget the values associated with the key across all " "threads, and change the key's initialization state to uninitialized. A " @@ -3229,20 +3559,29 @@ msgid "" "`PyThread_tss_create`. This function can be called repeatedly on the same " "key -- calling it on an already destroyed key is a no-op." msgstr "" +"TSS キーを破棄し、すべてのスレッドでそのキーに関連付けられた値との対応を解除" +"して、キーを未初期化の状態にします。\n" +"破棄したキーは :c:func:`PyThread_tss_create` で再び初期化できます。\n" +"同じキーに対して繰り返し呼び出せます。\n" +"破棄済みのキーに対しては何もしません。" -#: ../../c-api/init.rst:2382 msgid "" "Return a zero value to indicate successfully associating a :c:expr:`void*` " "value with a TSS key in the current thread. Each thread has a distinct " "mapping of the key to a :c:expr:`void*` value." msgstr "" +"現在のスレッドで :c:expr:`void*` 値を TSS キーに関連付けることに成功すると、" +"0 を返します。\n" +"キーから :c:expr:`void*` 値への対応付けは、スレッドごとに独立しています。" -#: ../../c-api/init.rst:2389 msgid "" "Return the :c:expr:`void*` value associated with a TSS key in the current " "thread. This returns ``NULL`` if no value is associated with the key in the " "current thread." msgstr "" +"現在のスレッドで TSS キーに関連付けられている :c:expr:`void*` 値を返しま" +"す。\n" +"現在のスレッドでそのキーに値が関連付けられていなければ、``NULL`` を返します。" #: ../../c-api/init.rst:2397 msgid "Thread Local Storage (TLS) API" @@ -3254,7 +3593,6 @@ msgid "" "specific-storage-api>`." msgstr "" -#: ../../c-api/init.rst:2404 msgid "" "This version of the API does not support platforms where the native TLS key " "is defined in a way that cannot be safely cast to ``int``. On such " @@ -3262,6 +3600,10 @@ msgid "" "failure status, and the other TLS functions will all be no-ops on such " "platforms." msgstr "" +"このバージョンの API は、ネイティブの TLS キーを安全に ``int`` へキャストでき" +"ないプラットフォームをサポートしません。\n" +"そのようなプラットフォームでは、:c:func:`PyThread_create_key` は即座に失敗を" +"示す値を返し、その他の TLS 関数はすべて何もしません。" #: ../../c-api/init.rst:2409 msgid "" @@ -3275,59 +3617,76 @@ msgstr "" msgid "Synchronization Primitives" msgstr "同期プリミティブ" -#: ../../c-api/init.rst:2422 msgid "The C-API provides a basic mutual exclusion lock." -msgstr "" +msgstr "C API は基本的な相互排他ロックを提供します。" -#: ../../c-api/init.rst:2426 msgid "" "A mutual exclusion lock. The :c:type:`!PyMutex` should be initialized to " "zero to represent the unlocked state. For example::" msgstr "" +"相互排他ロックです。\n" +":c:type:`!PyMutex` は、ロックされていない状態を表すために 0 で初期化する必要" +"があります。\n" +"例えば次のようにします。 ::" -#: ../../c-api/init.rst:2429 msgid "PyMutex mutex = {0};" -msgstr "" +msgstr "PyMutex mutex = {0};" -#: ../../c-api/init.rst:2431 msgid "" "Instances of :c:type:`!PyMutex` should not be copied or moved. Both the " "contents and address of a :c:type:`!PyMutex` are meaningful, and it must " "remain at a fixed, writable location in memory." msgstr "" +":c:type:`!PyMutex` のインスタンスは、コピーしたり移動したりしてはなりませ" +"ん。\n" +":c:type:`!PyMutex` は内容とアドレスの両方が意味を持つため、書き込み可能なメモ" +"リ上の固定された場所に置き続ける必要があります。" -#: ../../c-api/init.rst:2437 msgid "" "A :c:type:`!PyMutex` currently occupies one byte, but the size should be " "considered unstable. The size may change in future Python releases without " "a deprecation period." msgstr "" +":c:type:`!PyMutex` は現在 1 バイトを占めますが、このサイズは安定した仕様では" +"ありません。\n" +"将来の Python リリースでは、非推奨の期間を設けずにサイズを変更する可能性があ" +"ります。" -#: ../../c-api/init.rst:2445 msgid "" "Lock mutex *m*. If another thread has already locked it, the calling thread " "will block until the mutex is unlocked. While blocked, the thread will " "temporarily detach the :term:`thread state ` if one " "exists." msgstr "" +"ミューテックス *m* をロックします。\n" +"別のスレッドがすでにロックしている場合、呼び出し元のスレッドはロックが解除さ" +"れるまでブロックします。\n" +"ブロック中は、:term:`スレッド状態 ` があれば一時的にデ" +"タッチします。" -#: ../../c-api/init.rst:2453 msgid "" "Unlock mutex *m*. The mutex must be locked --- otherwise, the function will " "issue a fatal error." msgstr "" +"ミューテックス *m* のロックを解除します。\n" +"ミューテックスはロックされていなければなりません。\n" +"ロックされていない場合、この関数は致命的なエラーを発生させます。" #: ../../c-api/init.rst:2461 msgid "Python Critical Section API" msgstr "" -#: ../../c-api/init.rst:2463 msgid "" "The critical section API provides a deadlock avoidance layer on top of per-" "object locks for :term:`free-threaded ` CPython. They are " "intended to replace reliance on the :term:`global interpreter lock`, and are " "no-ops in versions of Python with the global interpreter lock." msgstr "" +"クリティカルセクション API は、:term:`フリースレッドの ` " +"CPython のオブジェクトごとのロックに、デッドロックを避ける層を加えます。\n" +":term:`グローバルインタープリタロック ` への依存を置" +"き換えるためのもので、グローバルインタープリタロックを持つバージョンの " +"Python では何もしません。" #: ../../c-api/init.rst:2468 msgid "" @@ -3347,7 +3706,6 @@ msgid "" "future Python versions." msgstr "" -#: ../../c-api/init.rst:2482 msgid "" "Operations that need to lock two objects at once must use :c:macro:" "`Py_BEGIN_CRITICAL_SECTION2`. You *cannot* use nested critical sections to " @@ -3355,12 +3713,17 @@ msgid "" "suspend the outer critical sections. This API does not provide a way to " "lock more than two objects at once." msgstr "" +"2 個のオブジェクトを同時にロックする操作には、:c:macro:" +"`Py_BEGIN_CRITICAL_SECTION2` を使う必要があります。\n" +"複数のオブジェクトを同時にロックするために、クリティカルセクションを入れ子に" +"することは *できません*。\n" +"内側のクリティカルセクションが外側のものを中断する場合があるためです。\n" +"この API は、3 個以上のオブジェクトを同時にロックする方法を提供しません。" #: ../../c-api/init.rst:2488 msgid "Example usage::" msgstr "使用例::" -#: ../../c-api/init.rst:2490 msgid "" "static PyObject *\n" "set_field(MyObject *self, PyObject *value)\n" @@ -3371,8 +3734,15 @@ msgid "" " Py_RETURN_NONE;\n" "}" msgstr "" +"static PyObject *\n" +"set_field(MyObject *self, PyObject *value)\n" +"{\n" +" Py_BEGIN_CRITICAL_SECTION(self);\n" +" Py_SETREF(self->field, Py_XNewRef(value));\n" +" Py_END_CRITICAL_SECTION();\n" +" Py_RETURN_NONE;\n" +"}" -#: ../../c-api/init.rst:2499 msgid "" "In the above example, :c:macro:`Py_SETREF` calls :c:macro:`Py_DECREF`, which " "can call arbitrary code through an object's deallocation function. The " @@ -3381,42 +3751,46 @@ msgid "" "if the code triggered by the finalizer blocks and calls :c:func:" "`PyEval_SaveThread`." msgstr "" +"上の例では、:c:macro:`Py_SETREF` が :c:macro:`Py_DECREF` を呼び出し、オブジェ" +"クトの解放関数を通じて任意のコードが実行される可能性があります。\n" +"ファイナライザが実行するコードがブロックして :c:func:`PyEval_SaveThread` を呼" +"び出した場合、\n" +"クリティカルセクション API はランタイムによるクリティカルセクションの一時的な" +"中断を許すことで、再入やロックの順序に起因するデッドロックを避けます。" -#: ../../c-api/init.rst:2507 msgid "" "Acquires the per-object lock for the object *op* and begins a critical " "section." msgstr "" +"オブジェクト *op* のロックを取得し、クリティカルセクションを開始します。" -#: ../../c-api/init.rst:2510 ../../c-api/init.rst:2524 -#: ../../c-api/init.rst:2539 ../../c-api/init.rst:2553 msgid "In the free-threaded build, this macro expands to::" -msgstr "" +msgstr "フリースレッドビルドでは、このマクロは次のように展開されます。 ::" -#: ../../c-api/init.rst:2512 msgid "" "{\n" " PyCriticalSection _py_cs;\n" " PyCriticalSection_Begin(&_py_cs, (PyObject*)(op))" msgstr "" +"{\n" +" PyCriticalSection _py_cs;\n" +" PyCriticalSection_Begin(&_py_cs, (PyObject*)(op))" -#: ../../c-api/init.rst:2516 ../../c-api/init.rst:2545 msgid "In the default build, this macro expands to ``{``." -msgstr "" +msgstr "デフォルトのビルドでは、このマクロは ``{`` に展開されます。" -#: ../../c-api/init.rst:2522 msgid "Ends the critical section and releases the per-object lock." -msgstr "" +msgstr "クリティカルセクションを終了し、オブジェクトのロックを解放します。" -#: ../../c-api/init.rst:2526 msgid "" " PyCriticalSection_End(&_py_cs);\n" "}" msgstr "" +" PyCriticalSection_End(&_py_cs);\n" +"}" -#: ../../c-api/init.rst:2529 ../../c-api/init.rst:2558 msgid "In the default build, this macro expands to ``}``." -msgstr "" +msgstr "デフォルトのビルドでは、このマクロは ``}`` に展開されます。" #: ../../c-api/init.rst:2535 msgid "" @@ -3425,22 +3799,24 @@ msgid "" "address first) to avoid lock ordering deadlocks." msgstr "" -#: ../../c-api/init.rst:2541 msgid "" "{\n" " PyCriticalSection2 _py_cs2;\n" " PyCriticalSection2_Begin(&_py_cs2, (PyObject*)(a), (PyObject*)(b))" msgstr "" +"{\n" +" PyCriticalSection2 _py_cs2;\n" +" PyCriticalSection2_Begin(&_py_cs2, (PyObject*)(a), (PyObject*)(b))" -#: ../../c-api/init.rst:2551 msgid "Ends the critical section and releases the per-object locks." -msgstr "" +msgstr "クリティカルセクションを終了し、オブジェクトのロックを解放します。" -#: ../../c-api/init.rst:2555 msgid "" " PyCriticalSection2_End(&_py_cs2);\n" "}" msgstr "" +" PyCriticalSection2_End(&_py_cs2);\n" +"}" #: ../../c-api/init.rst:350 msgid "PyEval_InitThreads()" @@ -3479,9 +3855,8 @@ msgstr "検索" msgid "path" msgstr "パス" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:1828 ../../c-api/init.rst:1881 msgid "Py_FinalizeEx (C function)" -msgstr "" +msgstr "Py_FinalizeEx (C 関数)" #: ../../c-api/init.rst:586 msgid "Py_Initialize()" @@ -3531,29 +3906,23 @@ msgstr "interpreter lock" msgid "lock, interpreter" msgstr "lock, interpreter" -#: ../../c-api/init.rst:958 msgid "setswitchinterval (in module sys)" -msgstr "" +msgstr "setswitchinterval (sys モジュール)" -#: ../../c-api/init.rst:967 msgid "PyThreadState (C type)" -msgstr "" +msgstr "PyThreadState (C の型)" -#: ../../c-api/init.rst:1003 msgid "Py_BEGIN_ALLOW_THREADS (C macro)" -msgstr "" +msgstr "Py_BEGIN_ALLOW_THREADS (C のマクロ)" -#: ../../c-api/init.rst:1003 msgid "Py_END_ALLOW_THREADS (C macro)" -msgstr "" +msgstr "Py_END_ALLOW_THREADS (C のマクロ)" -#: ../../c-api/init.rst:1019 msgid "PyEval_RestoreThread (C function)" -msgstr "" +msgstr "PyEval_RestoreThread (C の関数)" -#: ../../c-api/init.rst:1019 msgid "PyEval_SaveThread (C function)" -msgstr "" +msgstr "PyEval_SaveThread (C の関数)" #: ../../c-api/init.rst:1214 msgid "PyEval_AcquireThread()" @@ -3587,10 +3956,8 @@ msgstr "stderr (sys モジュール)" msgid "stdin (in module sys)" msgstr "stdin (sys モジュール)" -#: ../../c-api/init.rst:1828 msgid "Py_Initialize (C function)" -msgstr "" +msgstr "Py_Initialize (C の関数)" -#: ../../c-api/init.rst:1858 msgid "close (in module os)" -msgstr "" +msgstr "close (os モジュール)" diff --git a/c-api/init_config.po b/c-api/init_config.po index 9cab91be1..f9074da7f 100644 --- a/c-api/init_config.po +++ b/c-api/init_config.po @@ -20,29 +20,30 @@ msgstr "" "Last-Translator: tomo, 2025\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" -#: ../../c-api/init_config.rst:7 msgid "Python Initialization Configuration" -msgstr "Python 初期化設定 " +msgstr "Python 初期化設定" #: ../../c-api/init_config.rst:13 msgid "PyInitConfig C API" -msgstr "" +msgstr "PyInitConfig C API" #: ../../c-api/init_config.rst:17 msgid "Python can be initialized with :c:func:`Py_InitializeFromInitConfig`." -msgstr "" +msgstr "Python は :c:func:`Py_InitializeFromInitConfig` で初期化できます。" #: ../../c-api/init_config.rst:19 ../../c-api/init_config.rst:650 msgid "" "The :c:func:`Py_RunMain` function can be used to write a customized Python " "program." msgstr "" +":c:func:`Py_RunMain` 関数は、カスタマイズされた Python プログラムを書くために" +"使用できます。" #: ../../c-api/init_config.rst:22 ../../c-api/init_config.rst:653 msgid "" @@ -53,7 +54,7 @@ msgstr "" #: ../../c-api/init_config.rst:25 msgid ":pep:`741` \"Python Configuration C API\"." -msgstr "" +msgstr ":pep:`741` \"Python Configuration C API\"." #: ../../c-api/init_config.rst:29 ../../c-api/init_config.rst:660 msgid "Example" @@ -64,6 +65,8 @@ msgid "" "Example of customized Python always running with the :ref:`Python " "Development Mode ` enabled; return ``-1`` on error:" msgstr "" +"常に :ref:`Python 開発モード ` が有効化された状態で実行されるカスタ" +"マイズされた Python の例。エラー時は ``-1`` を返します:" #: ../../c-api/init_config.rst:34 msgid "" @@ -101,249 +104,279 @@ msgid "" " }\n" "}" msgstr "" +"int init_python(void)\n" +"{\n" +" PyInitConfig *config = PyInitConfig_Create();\n" +" if (config == NULL) {\n" +" printf(\"PYTHON INIT ERROR: memory allocation failed\\n\");\n" +" return -1;\n" +" }\n" +"\n" +" // Python 開発モードを有効化\n" +" if (PyInitConfig_SetInt(config, \"dev_mode\", 1) < 0) {\n" +" goto error;\n" +" }\n" +"\n" +" // Python を設定付きで初期化\n" +" if (Py_InitializeFromInitConfig(config) < 0) {\n" +" goto error;\n" +" }\n" +" PyInitConfig_Free(config);\n" +" return 0;\n" +"\n" +"error:\n" +" {\n" +" // エラーメッセージを表示する。\n" +" //\n" +" // この稀な括弧スタイルは、変数宣言を指す goto ターゲットを\n" +" // 作ることができないために使用されています。\n" +"\n" +" const char *err_msg;\n" +" (void)PyInitConfig_GetError(config, &err_msg);\n" +" printf(\"PYTHON INIT ERROR: %s\\n\", err_msg);\n" +" PyInitConfig_Free(config);\n" +" return -1;\n" +" }\n" +"}" #: ../../c-api/init_config.rst:71 msgid "Create Config" -msgstr "" +msgstr "設定の作成" #: ../../c-api/init_config.rst:75 msgid "Opaque structure to configure the Python initialization." -msgstr "" +msgstr "Python の初期化を構成するための不透明な構造体です。" -#: ../../c-api/init_config.rst:80 msgid "" "Create a new initialization configuration using :ref:`Isolated Configuration " "` default values." msgstr "" +":ref:`隔離設定 ` のデフォルト値を使って、新しい初期化設定" +"を作成します。" -#: ../../c-api/init_config.rst:83 msgid "It must be freed by :c:func:`PyInitConfig_Free`." -msgstr "" +msgstr ":c:func:`PyInitConfig_Free` で解放しなければなりません。" -#: ../../c-api/init_config.rst:85 msgid "Return ``NULL`` on memory allocation failure." -msgstr "" +msgstr "メモリの確保に失敗した場合は ``NULL`` を返します。" -#: ../../c-api/init_config.rst:90 msgid "Free memory of the initialization configuration *config*." -msgstr "" +msgstr "初期化設定 *config* のメモリを解放します。" -#: ../../c-api/init_config.rst:92 msgid "If *config* is ``NULL``, no operation is performed." -msgstr "" +msgstr "*config* が ``NULL`` の場合は、何も行いません。" #: ../../c-api/init_config.rst:96 msgid "Error Handling" msgstr "エラー処理" -#: ../../c-api/init_config.rst:100 msgid "Get the *config* error message." -msgstr "" +msgstr "*config* のエラーメッセージを取得します。" -#: ../../c-api/init_config.rst:102 msgid "Set *\\*err_msg* and return ``1`` if an error is set." -msgstr "" +msgstr "エラーが設定されていれば、*\\*err_msg* を設定して ``1`` を返します。" -#: ../../c-api/init_config.rst:103 msgid "Set *\\*err_msg* to ``NULL`` and return ``0`` otherwise." msgstr "" +"それ以外の場合は、*\\*err_msg* を ``NULL`` に設定して ``0`` を返します。" #: ../../c-api/init_config.rst:105 msgid "An error message is an UTF-8 encoded string." msgstr "" -#: ../../c-api/init_config.rst:107 msgid "If *config* has an exit code, format the exit code as an error message." msgstr "" +"*config* に終了コードがある場合は、その終了コードをエラーメッセージの形式にし" +"ます。" -#: ../../c-api/init_config.rst:110 msgid "" "The error message remains valid until another ``PyInitConfig`` function is " "called with *config*. The caller doesn't have to free the error message." msgstr "" +"エラーメッセージは、*config* を使って別の ``PyInitConfig`` 関数を呼び出すまで" +"有効です。\n" +"呼び出し元がエラーメッセージを解放する必要はありません。" -#: ../../c-api/init_config.rst:117 msgid "Get the *config* exit code." -msgstr "" +msgstr "*config* の終了コードを取得します。" -#: ../../c-api/init_config.rst:119 msgid "Set *\\*exitcode* and return ``1`` if *config* has an exit code set." msgstr "" +"*config* に終了コードが設定されていれば、*\\*exitcode* を設定して ``1`` を返" +"します。" -#: ../../c-api/init_config.rst:120 msgid "Return ``0`` if *config* has no exit code set." -msgstr "" +msgstr "*config* に終了コードが設定されていなければ ``0`` を返します。" -#: ../../c-api/init_config.rst:122 msgid "" "Only the ``Py_InitializeFromInitConfig()`` function can set an exit code if " "the ``parse_argv`` option is non-zero." msgstr "" +"終了コードを設定できるのは、``parse_argv`` オプションがゼロ以外の場合の " +"``Py_InitializeFromInitConfig()`` 関数だけです。" -#: ../../c-api/init_config.rst:125 msgid "" "An exit code can be set when parsing the command line failed (exit code " "``2``) or when a command line option asks to display the command line help " "(exit code ``0``)." msgstr "" +"コマンドラインの解析に失敗した場合 (終了コード ``2``) や、コマンドラインオプ" +"ションでヘルプの表示が要求された場合 (終了コード ``0``) に、終了コードが設定" +"されることがあります。" -#: ../../c-api/init_config.rst:131 msgid "Get Options" -msgstr "" +msgstr "オプションの取得" -#: ../../c-api/init_config.rst:133 ../../c-api/init_config.rst:187 -#: ../../c-api/init_config.rst:559 msgid "" "The configuration option *name* parameter must be a non-NULL null-terminated " "UTF-8 encoded string. See :ref:`Configuration Options `." msgstr "" +"設定オプションの *name* 引数は、``NULL`` でない、null 終端の UTF-8 エンコード" +"文字列でなければなりません。\n" +":ref:`設定オプション ` を参照してください。" -#: ../../c-api/init_config.rst:138 msgid "Test if the configuration has an option called *name*." -msgstr "" +msgstr "設定に *name* というオプションがあるかを調べます。" -#: ../../c-api/init_config.rst:140 msgid "Return ``1`` if the option exists, or return ``0`` otherwise." -msgstr "" +msgstr "オプションがあれば ``1``、なければ ``0`` を返します。" -#: ../../c-api/init_config.rst:145 msgid "Get an integer configuration option." -msgstr "" +msgstr "整数の設定オプションを取得します。" -#: ../../c-api/init_config.rst:147 ../../c-api/init_config.rst:156 msgid "Set *\\*value*, and return ``0`` on success." -msgstr "" +msgstr "成功時は *\\*value* を設定し、``0`` を返します。" -#: ../../c-api/init_config.rst:148 ../../c-api/init_config.rst:157 -#: ../../c-api/init_config.rst:172 ../../c-api/init_config.rst:200 -#: ../../c-api/init_config.rst:209 ../../c-api/init_config.rst:218 -#: ../../c-api/init_config.rst:233 ../../c-api/init_config.rst:249 msgid "Set an error in *config* and return ``-1`` on error." -msgstr "" +msgstr "エラー時は *config* にエラーを設定し、``-1`` を返します。" -#: ../../c-api/init_config.rst:153 msgid "" "Get a string configuration option as a null-terminated UTF-8 encoded string." msgstr "" +"文字列の設定オプションを、null 終端の UTF-8 エンコード文字列として取得しま" +"す。" -#: ../../c-api/init_config.rst:159 msgid "" "*\\*value* can be set to ``NULL`` if the option is an optional string and " "the option is unset." msgstr "" +"オプションが省略可能な文字列で、設定されていない場合は、*\\*value* が " +"``NULL`` に設定されることがあります。" -#: ../../c-api/init_config.rst:162 msgid "" "On success, the string must be released with ``free(value)`` if it's not " "``NULL``." msgstr "" +"成功時に取得した文字列が ``NULL`` でなければ、呼び出し元で ``free(value)`` を" +"使って解放しなければなりません。" -#: ../../c-api/init_config.rst:168 msgid "" "Get a string list configuration option as an array of null-terminated UTF-8 " "encoded strings." msgstr "" +"文字列リストの設定オプションを、null 終端の UTF-8 エンコード文字列の配列とし" +"て取得します。" #: ../../c-api/init_config.rst:171 msgid "Set *\\*length* and *\\*value*, and return ``0`` on success." msgstr "" -#: ../../c-api/init_config.rst:174 msgid "" "On success, the string list must be released with " "``PyInitConfig_FreeStrList(length, items)``." msgstr "" +"成功時は、``PyInitConfig_FreeStrList(length, items)`` で文字列リストを解放し" +"なければなりません。" -#: ../../c-api/init_config.rst:180 msgid "Free memory of a string list created by ``PyInitConfig_GetStrList()``." msgstr "" +"``PyInitConfig_GetStrList()`` で作成した文字列リストのメモリを解放します。" -#: ../../c-api/init_config.rst:185 msgid "Set Options" -msgstr "" +msgstr "オプションの設定" -#: ../../c-api/init_config.rst:190 msgid "" "Some configuration options have side effects on other options. This logic is " "only implemented when ``Py_InitializeFromInitConfig()`` is called, not by " "the \"Set\" functions below. For example, setting ``dev_mode`` to ``1`` does " "not set ``faulthandler`` to ``1``." msgstr "" +"一部の設定オプションは、ほかのオプションに影響します。\n" +"この処理は ``Py_InitializeFromInitConfig()`` の呼び出し時にのみ行われ、以下の" +"設定関数では行われません。\n" +"例えば、``dev_mode`` を ``1`` に設定しても、``faulthandler`` は ``1`` になり" +"ません。" -#: ../../c-api/init_config.rst:197 msgid "Set an integer configuration option." -msgstr "" +msgstr "整数の設定オプションを設定します。" -#: ../../c-api/init_config.rst:199 ../../c-api/init_config.rst:208 -#: ../../c-api/init_config.rst:217 ../../c-api/init_config.rst:232 -#: ../../c-api/init_config.rst:248 ../../c-api/init_config.rst:591 msgid "Return ``0`` on success." -msgstr "" +msgstr "成功時は ``0`` を返します。" -#: ../../c-api/init_config.rst:205 msgid "" "Set a string configuration option from a null-terminated UTF-8 encoded " "string. The string is copied." msgstr "" +"文字列の設定オプションを、null 終端の UTF-8 エンコード文字列で設定します。\n" +"文字列はコピーされます。" -#: ../../c-api/init_config.rst:214 msgid "" "Set a string list configuration option from an array of null-terminated " "UTF-8 encoded strings. The string list is copied." msgstr "" +"文字列リストの設定オプションを、null 終端の UTF-8 エンコード文字列の配列で設" +"定します。\n" +"文字列リストはコピーされます。" -#: ../../c-api/init_config.rst:222 msgid "Module" -msgstr "" +msgstr "モジュール" -#: ../../c-api/init_config.rst:226 msgid "Add a built-in extension module to the table of built-in modules." -msgstr "" +msgstr "組み込みモジュールのテーブルに、組み込みの拡張モジュールを追加します。" -#: ../../c-api/init_config.rst:228 msgid "" "The new module can be imported by the name *name*, and uses the function " "*initfunc* as the initialization function called on the first attempted " "import." msgstr "" +"新しいモジュールは *name* という名前でインポートでき、最初のインポートの試行" +"時に呼び出す初期化関数として *initfunc* を使います。" -#: ../../c-api/init_config.rst:235 msgid "" "If Python is initialized multiple times, ``PyInitConfig_AddModule()`` must " "be called at each Python initialization." msgstr "" +"Python を複数回初期化する場合は、初期化のたびに ``PyInitConfig_AddModule()`` " +"を呼び出さなければなりません。" -#: ../../c-api/init_config.rst:238 msgid "Similar to the :c:func:`PyImport_AppendInittab` function." -msgstr "" +msgstr ":c:func:`PyImport_AppendInittab` 関数と同様です。" -#: ../../c-api/init_config.rst:242 msgid "Initialize Python" -msgstr "" +msgstr "Python の初期化" -#: ../../c-api/init_config.rst:246 msgid "Initialize Python from the initialization configuration." -msgstr "" +msgstr "初期化設定から Python を初期化します。" -#: ../../c-api/init_config.rst:250 msgid "Set an exit code in *config* and return ``-1`` if Python wants to exit." msgstr "" +"Python が終了を要求する場合は、*config* に終了コードを設定して ``-1`` を返し" +"ます。" -#: ../../c-api/init_config.rst:253 msgid "See ``PyInitConfig_GetExitcode()`` for the exit code case." msgstr "" +"終了コードが設定された場合については、``PyInitConfig_GetExitcode()`` を参照し" +"てください。" -#: ../../c-api/init_config.rst:259 msgid "Configuration Options" -msgstr "" +msgstr "設定オプション" #: ../../c-api/init_config.rst:264 msgid "Option" msgstr "オプション" -#: ../../c-api/init_config.rst:265 msgid "PyConfig/PyPreConfig member" -msgstr "" +msgstr "PyConfig/PyPreConfig のメンバー" #: ../../c-api/init_config.rst:266 msgid "Type" @@ -353,13 +386,11 @@ msgstr "型" msgid "Visibility" msgstr "可視性" -#: ../../c-api/init_config.rst:268 msgid "``\"allocator\"``" -msgstr "" +msgstr "``\"allocator\"``" -#: ../../c-api/init_config.rst:269 msgid ":c:member:`allocator `" -msgstr "" +msgstr ":c:member:`allocator `" #: ../../c-api/init_config.rst:270 ../../c-api/init_config.rst:294 #: ../../c-api/init_config.rst:322 ../../c-api/init_config.rst:358 @@ -395,42 +426,23 @@ msgstr "``int``" msgid "Read-only" msgstr "読み出し専用" -#: ../../c-api/init_config.rst:272 msgid "``\"argv\"``" -msgstr "" +msgstr "``\"argv\"``" -#: ../../c-api/init_config.rst:273 msgid ":c:member:`argv `" -msgstr "" +msgstr ":c:member:`argv `" -#: ../../c-api/init_config.rst:274 ../../c-api/init_config.rst:402 -#: ../../c-api/init_config.rst:410 ../../c-api/init_config.rst:530 -#: ../../c-api/init_config.rst:578 msgid "``list[str]``" -msgstr "" +msgstr "``list[str]``" -#: ../../c-api/init_config.rst:275 ../../c-api/init_config.rst:279 -#: ../../c-api/init_config.rst:283 ../../c-api/init_config.rst:287 -#: ../../c-api/init_config.rst:295 ../../c-api/init_config.rst:323 -#: ../../c-api/init_config.rst:339 ../../c-api/init_config.rst:343 -#: ../../c-api/init_config.rst:371 ../../c-api/init_config.rst:379 -#: ../../c-api/init_config.rst:383 ../../c-api/init_config.rst:403 -#: ../../c-api/init_config.rst:407 ../../c-api/init_config.rst:419 -#: ../../c-api/init_config.rst:431 ../../c-api/init_config.rst:435 -#: ../../c-api/init_config.rst:443 ../../c-api/init_config.rst:447 -#: ../../c-api/init_config.rst:491 ../../c-api/init_config.rst:499 -#: ../../c-api/init_config.rst:523 ../../c-api/init_config.rst:531 -#: ../../c-api/init_config.rst:535 ../../c-api/init_config.rst:539 msgid "Public" -msgstr "" +msgstr "公開" -#: ../../c-api/init_config.rst:276 msgid "``\"base_exec_prefix\"``" -msgstr "" +msgstr "``\"base_exec_prefix\"``" -#: ../../c-api/init_config.rst:277 msgid ":c:member:`base_exec_prefix `" -msgstr "" +msgstr ":c:member:`base_exec_prefix `" #: ../../c-api/init_config.rst:278 ../../c-api/init_config.rst:282 #: ../../c-api/init_config.rst:286 ../../c-api/init_config.rst:298 @@ -446,29 +458,23 @@ msgstr "" msgid "``str``" msgstr "``str``" -#: ../../c-api/init_config.rst:280 msgid "``\"base_executable\"``" -msgstr "" +msgstr "``\"base_executable\"``" -#: ../../c-api/init_config.rst:281 msgid ":c:member:`base_executable `" -msgstr "" +msgstr ":c:member:`base_executable `" -#: ../../c-api/init_config.rst:284 msgid "``\"base_prefix\"``" -msgstr "" +msgstr "``\"base_prefix\"``" -#: ../../c-api/init_config.rst:285 msgid ":c:member:`base_prefix `" -msgstr "" +msgstr ":c:member:`base_prefix `" -#: ../../c-api/init_config.rst:288 msgid "``\"buffered_stdio\"``" -msgstr "" +msgstr "``\"buffered_stdio\"``" -#: ../../c-api/init_config.rst:289 msgid ":c:member:`buffered_stdio `" -msgstr "" +msgstr ":c:member:`buffered_stdio `" #: ../../c-api/init_config.rst:290 ../../c-api/init_config.rst:302 #: ../../c-api/init_config.rst:306 ../../c-api/init_config.rst:310 @@ -491,519 +497,393 @@ msgstr "" msgid "``bool``" msgstr "``bool``" -#: ../../c-api/init_config.rst:292 msgid "``\"bytes_warning\"``" -msgstr "" +msgstr "``\"bytes_warning\"``" -#: ../../c-api/init_config.rst:293 msgid ":c:member:`bytes_warning `" -msgstr "" +msgstr ":c:member:`bytes_warning `" -#: ../../c-api/init_config.rst:296 msgid "``\"check_hash_pycs_mode\"``" -msgstr "" +msgstr "``\"check_hash_pycs_mode\"``" -#: ../../c-api/init_config.rst:297 msgid ":c:member:`check_hash_pycs_mode `" -msgstr "" +msgstr ":c:member:`check_hash_pycs_mode `" -#: ../../c-api/init_config.rst:300 msgid "``\"code_debug_ranges\"``" -msgstr "" +msgstr "``\"code_debug_ranges\"``" -#: ../../c-api/init_config.rst:301 msgid ":c:member:`code_debug_ranges `" -msgstr "" +msgstr ":c:member:`code_debug_ranges `" -#: ../../c-api/init_config.rst:304 msgid "``\"coerce_c_locale\"``" -msgstr "" +msgstr "``\"coerce_c_locale\"``" -#: ../../c-api/init_config.rst:305 msgid ":c:member:`coerce_c_locale `" -msgstr "" +msgstr ":c:member:`coerce_c_locale `" -#: ../../c-api/init_config.rst:308 msgid "``\"coerce_c_locale_warn\"``" -msgstr "" +msgstr "``\"coerce_c_locale_warn\"``" -#: ../../c-api/init_config.rst:309 msgid ":c:member:`coerce_c_locale_warn `" -msgstr "" +msgstr ":c:member:`coerce_c_locale_warn `" -#: ../../c-api/init_config.rst:312 msgid "``\"configure_c_stdio\"``" -msgstr "" +msgstr "``\"configure_c_stdio\"``" -#: ../../c-api/init_config.rst:313 msgid ":c:member:`configure_c_stdio `" -msgstr "" +msgstr ":c:member:`configure_c_stdio `" -#: ../../c-api/init_config.rst:316 msgid "``\"configure_locale\"``" -msgstr "" +msgstr "``\"configure_locale\"``" -#: ../../c-api/init_config.rst:317 msgid ":c:member:`configure_locale `" -msgstr "" +msgstr ":c:member:`configure_locale `" -#: ../../c-api/init_config.rst:320 msgid "``\"cpu_count\"``" -msgstr "" +msgstr "``\"cpu_count\"``" -#: ../../c-api/init_config.rst:321 msgid ":c:member:`cpu_count `" -msgstr "" +msgstr ":c:member:`cpu_count `" -#: ../../c-api/init_config.rst:324 msgid "``\"dev_mode\"``" -msgstr "" +msgstr "``\"dev_mode\"``" -#: ../../c-api/init_config.rst:325 msgid ":c:member:`dev_mode `" -msgstr "" +msgstr ":c:member:`dev_mode `" -#: ../../c-api/init_config.rst:328 msgid "``\"dump_refs\"``" -msgstr "" +msgstr "``\"dump_refs\"``" -#: ../../c-api/init_config.rst:329 msgid ":c:member:`dump_refs `" -msgstr "" +msgstr ":c:member:`dump_refs `" -#: ../../c-api/init_config.rst:332 msgid "``\"dump_refs_file\"``" -msgstr "" +msgstr "``\"dump_refs_file\"``" -#: ../../c-api/init_config.rst:333 msgid ":c:member:`dump_refs_file `" -msgstr "" +msgstr ":c:member:`dump_refs_file `" -#: ../../c-api/init_config.rst:336 msgid "``\"exec_prefix\"``" -msgstr "" +msgstr "``\"exec_prefix\"``" -#: ../../c-api/init_config.rst:337 msgid ":c:member:`exec_prefix `" -msgstr "" +msgstr ":c:member:`exec_prefix `" -#: ../../c-api/init_config.rst:340 msgid "``\"executable\"``" -msgstr "" +msgstr "``\"executable\"``" -#: ../../c-api/init_config.rst:341 msgid ":c:member:`executable `" -msgstr "" +msgstr ":c:member:`executable `" -#: ../../c-api/init_config.rst:344 msgid "``\"faulthandler\"``" -msgstr "" +msgstr "``\"faulthandler\"``" -#: ../../c-api/init_config.rst:345 msgid ":c:member:`faulthandler `" -msgstr "" +msgstr ":c:member:`faulthandler `" -#: ../../c-api/init_config.rst:348 msgid "``\"filesystem_encoding\"``" -msgstr "" +msgstr "``\"filesystem_encoding\"``" -#: ../../c-api/init_config.rst:349 msgid ":c:member:`filesystem_encoding `" -msgstr "" +msgstr ":c:member:`filesystem_encoding `" -#: ../../c-api/init_config.rst:352 msgid "``\"filesystem_errors\"``" -msgstr "" +msgstr "``\"filesystem_errors\"``" -#: ../../c-api/init_config.rst:353 msgid ":c:member:`filesystem_errors `" -msgstr "" +msgstr ":c:member:`filesystem_errors `" -#: ../../c-api/init_config.rst:356 msgid "``\"hash_seed\"``" -msgstr "" +msgstr "``\"hash_seed\"``" -#: ../../c-api/init_config.rst:357 msgid ":c:member:`hash_seed `" -msgstr "" +msgstr ":c:member:`hash_seed `" -#: ../../c-api/init_config.rst:360 msgid "``\"home\"``" -msgstr "" +msgstr "``\"home\"``" -#: ../../c-api/init_config.rst:361 msgid ":c:member:`home `" -msgstr "" +msgstr ":c:member:`home `" -#: ../../c-api/init_config.rst:364 msgid "``\"import_time\"``" -msgstr "" +msgstr "``\"import_time\"``" -#: ../../c-api/init_config.rst:365 msgid ":c:member:`import_time `" -msgstr "" +msgstr ":c:member:`import_time `" -#: ../../c-api/init_config.rst:368 msgid "``\"inspect\"``" -msgstr "" +msgstr "``\"inspect\"``" -#: ../../c-api/init_config.rst:369 msgid ":c:member:`inspect `" -msgstr "" +msgstr ":c:member:`inspect `" -#: ../../c-api/init_config.rst:372 msgid "``\"install_signal_handlers\"``" -msgstr "" +msgstr "``\"install_signal_handlers\"``" -#: ../../c-api/init_config.rst:373 msgid ":c:member:`install_signal_handlers `" -msgstr "" +msgstr ":c:member:`install_signal_handlers `" -#: ../../c-api/init_config.rst:376 msgid "``\"int_max_str_digits\"``" -msgstr "" +msgstr "``\"int_max_str_digits\"``" -#: ../../c-api/init_config.rst:377 msgid ":c:member:`int_max_str_digits `" -msgstr "" +msgstr ":c:member:`int_max_str_digits `" -#: ../../c-api/init_config.rst:380 msgid "``\"interactive\"``" -msgstr "" +msgstr "``\"interactive\"``" -#: ../../c-api/init_config.rst:381 msgid ":c:member:`interactive `" -msgstr "" +msgstr ":c:member:`interactive `" -#: ../../c-api/init_config.rst:384 msgid "``\"isolated\"``" -msgstr "" +msgstr "``\"isolated\"``" -#: ../../c-api/init_config.rst:385 msgid ":c:member:`isolated `" -msgstr "" +msgstr ":c:member:`isolated `" -#: ../../c-api/init_config.rst:388 msgid "``\"legacy_windows_fs_encoding\"``" -msgstr "" +msgstr "``\"legacy_windows_fs_encoding\"``" -#: ../../c-api/init_config.rst:389 msgid "" ":c:member:`legacy_windows_fs_encoding `" msgstr "" +":c:member:`legacy_windows_fs_encoding `" -#: ../../c-api/init_config.rst:392 msgid "``\"legacy_windows_stdio\"``" -msgstr "" +msgstr "``\"legacy_windows_stdio\"``" -#: ../../c-api/init_config.rst:393 msgid ":c:member:`legacy_windows_stdio `" -msgstr "" +msgstr ":c:member:`legacy_windows_stdio `" -#: ../../c-api/init_config.rst:396 msgid "``\"malloc_stats\"``" -msgstr "" +msgstr "``\"malloc_stats\"``" -#: ../../c-api/init_config.rst:397 msgid ":c:member:`malloc_stats `" -msgstr "" +msgstr ":c:member:`malloc_stats `" -#: ../../c-api/init_config.rst:400 msgid "``\"module_search_paths\"``" -msgstr "" +msgstr "``\"module_search_paths\"``" -#: ../../c-api/init_config.rst:401 msgid ":c:member:`module_search_paths `" -msgstr "" +msgstr ":c:member:`module_search_paths `" -#: ../../c-api/init_config.rst:404 msgid "``\"optimization_level\"``" -msgstr "" +msgstr "``\"optimization_level\"``" -#: ../../c-api/init_config.rst:405 msgid ":c:member:`optimization_level `" -msgstr "" +msgstr ":c:member:`optimization_level `" -#: ../../c-api/init_config.rst:408 msgid "``\"orig_argv\"``" -msgstr "" +msgstr "``\"orig_argv\"``" -#: ../../c-api/init_config.rst:409 msgid ":c:member:`orig_argv `" -msgstr "" +msgstr ":c:member:`orig_argv `" -#: ../../c-api/init_config.rst:412 msgid "``\"parse_argv\"``" -msgstr "" +msgstr "``\"parse_argv\"``" -#: ../../c-api/init_config.rst:413 msgid ":c:member:`parse_argv `" -msgstr "" +msgstr ":c:member:`parse_argv `" -#: ../../c-api/init_config.rst:416 msgid "``\"parser_debug\"``" -msgstr "" +msgstr "``\"parser_debug\"``" -#: ../../c-api/init_config.rst:417 msgid ":c:member:`parser_debug `" -msgstr "" +msgstr ":c:member:`parser_debug `" -#: ../../c-api/init_config.rst:420 msgid "``\"pathconfig_warnings\"``" -msgstr "" +msgstr "``\"pathconfig_warnings\"``" -#: ../../c-api/init_config.rst:421 msgid ":c:member:`pathconfig_warnings `" -msgstr "" +msgstr ":c:member:`pathconfig_warnings `" -#: ../../c-api/init_config.rst:424 msgid "``\"perf_profiling\"``" -msgstr "" +msgstr "``\"perf_profiling\"``" -#: ../../c-api/init_config.rst:425 msgid ":c:member:`perf_profiling `" -msgstr "" +msgstr ":c:member:`perf_profiling `" -#: ../../c-api/init_config.rst:428 msgid "``\"platlibdir\"``" -msgstr "" +msgstr "``\"platlibdir\"``" -#: ../../c-api/init_config.rst:429 msgid ":c:member:`platlibdir `" -msgstr "" +msgstr ":c:member:`platlibdir `" -#: ../../c-api/init_config.rst:432 msgid "``\"prefix\"``" -msgstr "" +msgstr "``\"prefix\"``" -#: ../../c-api/init_config.rst:433 msgid ":c:member:`prefix `" -msgstr "" +msgstr ":c:member:`prefix `" -#: ../../c-api/init_config.rst:436 msgid "``\"program_name\"``" -msgstr "" +msgstr "``\"program_name\"``" -#: ../../c-api/init_config.rst:437 msgid ":c:member:`program_name `" -msgstr "" +msgstr ":c:member:`program_name `" -#: ../../c-api/init_config.rst:440 msgid "``\"pycache_prefix\"``" -msgstr "" +msgstr "``\"pycache_prefix\"``" -#: ../../c-api/init_config.rst:441 msgid ":c:member:`pycache_prefix `" -msgstr "" +msgstr ":c:member:`pycache_prefix `" -#: ../../c-api/init_config.rst:444 msgid "``\"quiet\"``" -msgstr "" +msgstr "``\"quiet\"``" -#: ../../c-api/init_config.rst:445 msgid ":c:member:`quiet `" -msgstr "" +msgstr ":c:member:`quiet `" -#: ../../c-api/init_config.rst:448 msgid "``\"run_command\"``" -msgstr "" +msgstr "``\"run_command\"``" -#: ../../c-api/init_config.rst:449 msgid ":c:member:`run_command `" -msgstr "" +msgstr ":c:member:`run_command `" -#: ../../c-api/init_config.rst:452 msgid "``\"run_filename\"``" -msgstr "" +msgstr "``\"run_filename\"``" -#: ../../c-api/init_config.rst:453 msgid ":c:member:`run_filename `" -msgstr "" +msgstr ":c:member:`run_filename `" -#: ../../c-api/init_config.rst:456 msgid "``\"run_module\"``" -msgstr "" +msgstr "``\"run_module\"``" -#: ../../c-api/init_config.rst:457 msgid ":c:member:`run_module `" -msgstr "" +msgstr ":c:member:`run_module `" -#: ../../c-api/init_config.rst:460 msgid "``\"run_presite\"``" -msgstr "" +msgstr "``\"run_presite\"``" -#: ../../c-api/init_config.rst:461 msgid ":c:member:`run_presite `" -msgstr "" +msgstr ":c:member:`run_presite `" -#: ../../c-api/init_config.rst:464 msgid "``\"safe_path\"``" -msgstr "" +msgstr "``\"safe_path\"``" -#: ../../c-api/init_config.rst:465 msgid ":c:member:`safe_path `" -msgstr "" +msgstr ":c:member:`safe_path `" -#: ../../c-api/init_config.rst:468 msgid "``\"show_ref_count\"``" -msgstr "" +msgstr "``\"show_ref_count\"``" -#: ../../c-api/init_config.rst:469 msgid ":c:member:`show_ref_count `" -msgstr "" +msgstr ":c:member:`show_ref_count `" -#: ../../c-api/init_config.rst:472 msgid "``\"site_import\"``" -msgstr "" +msgstr "``\"site_import\"``" -#: ../../c-api/init_config.rst:473 msgid ":c:member:`site_import `" -msgstr "" +msgstr ":c:member:`site_import `" -#: ../../c-api/init_config.rst:476 msgid "``\"skip_source_first_line\"``" -msgstr "" +msgstr "``\"skip_source_first_line\"``" -#: ../../c-api/init_config.rst:477 msgid ":c:member:`skip_source_first_line `" -msgstr "" +msgstr ":c:member:`skip_source_first_line `" -#: ../../c-api/init_config.rst:480 msgid "``\"stdio_encoding\"``" -msgstr "" +msgstr "``\"stdio_encoding\"``" -#: ../../c-api/init_config.rst:481 msgid ":c:member:`stdio_encoding `" -msgstr "" +msgstr ":c:member:`stdio_encoding `" -#: ../../c-api/init_config.rst:484 msgid "``\"stdio_errors\"``" -msgstr "" +msgstr "``\"stdio_errors\"``" -#: ../../c-api/init_config.rst:485 msgid ":c:member:`stdio_errors `" -msgstr "" +msgstr ":c:member:`stdio_errors `" -#: ../../c-api/init_config.rst:488 msgid "``\"stdlib_dir\"``" -msgstr "" +msgstr "``\"stdlib_dir\"``" -#: ../../c-api/init_config.rst:489 msgid ":c:member:`stdlib_dir `" -msgstr "" +msgstr ":c:member:`stdlib_dir `" -#: ../../c-api/init_config.rst:492 msgid "``\"tracemalloc\"``" -msgstr "" +msgstr "``\"tracemalloc\"``" -#: ../../c-api/init_config.rst:493 msgid ":c:member:`tracemalloc `" -msgstr "" +msgstr ":c:member:`tracemalloc `" -#: ../../c-api/init_config.rst:496 msgid "``\"use_environment\"``" -msgstr "" +msgstr "``\"use_environment\"``" -#: ../../c-api/init_config.rst:497 msgid ":c:member:`use_environment `" -msgstr "" +msgstr ":c:member:`use_environment `" -#: ../../c-api/init_config.rst:500 msgid "``\"use_frozen_modules\"``" -msgstr "" +msgstr "``\"use_frozen_modules\"``" -#: ../../c-api/init_config.rst:501 msgid ":c:member:`use_frozen_modules `" -msgstr "" +msgstr ":c:member:`use_frozen_modules `" -#: ../../c-api/init_config.rst:504 msgid "``\"use_hash_seed\"``" -msgstr "" +msgstr "``\"use_hash_seed\"``" -#: ../../c-api/init_config.rst:505 msgid ":c:member:`use_hash_seed `" -msgstr "" +msgstr ":c:member:`use_hash_seed `" -#: ../../c-api/init_config.rst:508 msgid "``\"use_system_logger\"``" -msgstr "" +msgstr "``\"use_system_logger\"``" -#: ../../c-api/init_config.rst:509 msgid ":c:member:`use_system_logger `" -msgstr "" +msgstr ":c:member:`use_system_logger `" -#: ../../c-api/init_config.rst:512 msgid "``\"user_site_directory\"``" -msgstr "" +msgstr "``\"user_site_directory\"``" -#: ../../c-api/init_config.rst:513 msgid ":c:member:`user_site_directory `" -msgstr "" +msgstr ":c:member:`user_site_directory `" -#: ../../c-api/init_config.rst:516 msgid "``\"utf8_mode\"``" -msgstr "" +msgstr "``\"utf8_mode\"``" -#: ../../c-api/init_config.rst:517 msgid ":c:member:`utf8_mode `" -msgstr "" +msgstr ":c:member:`utf8_mode `" -#: ../../c-api/init_config.rst:520 msgid "``\"verbose\"``" -msgstr "" +msgstr "``\"verbose\"``" -#: ../../c-api/init_config.rst:521 msgid ":c:member:`verbose `" -msgstr "" +msgstr ":c:member:`verbose `" -#: ../../c-api/init_config.rst:524 msgid "``\"warn_default_encoding\"``" -msgstr "" +msgstr "``\"warn_default_encoding\"``" -#: ../../c-api/init_config.rst:525 msgid ":c:member:`warn_default_encoding `" -msgstr "" +msgstr ":c:member:`warn_default_encoding `" -#: ../../c-api/init_config.rst:528 msgid "``\"warnoptions\"``" -msgstr "" +msgstr "``\"warnoptions\"``" -#: ../../c-api/init_config.rst:529 msgid ":c:member:`warnoptions `" -msgstr "" +msgstr ":c:member:`warnoptions `" -#: ../../c-api/init_config.rst:532 msgid "``\"write_bytecode\"``" -msgstr "" +msgstr "``\"write_bytecode\"``" -#: ../../c-api/init_config.rst:533 msgid ":c:member:`write_bytecode `" -msgstr "" +msgstr ":c:member:`write_bytecode `" -#: ../../c-api/init_config.rst:536 msgid "``\"xoptions\"``" -msgstr "" +msgstr "``\"xoptions\"``" -#: ../../c-api/init_config.rst:537 msgid ":c:member:`xoptions `" -msgstr "" +msgstr ":c:member:`xoptions `" -#: ../../c-api/init_config.rst:538 ../../c-api/init_config.rst:579 msgid "``dict[str, str]``" -msgstr "" +msgstr "``dict[str, str]``" -#: ../../c-api/init_config.rst:540 msgid "``\"_pystats\"``" -msgstr "" +msgstr "``\"_pystats\"``" -#: ../../c-api/init_config.rst:541 msgid ":c:member:`_pystats `" -msgstr "" +msgstr ":c:member:`_pystats `" -#: ../../c-api/init_config.rst:545 msgid "Visibility:" -msgstr "" +msgstr "可視性:" #: ../../c-api/init_config.rst:547 msgid "" @@ -1017,87 +897,81 @@ msgid "" "func:`PyConfig_Set`." msgstr "" -#: ../../c-api/init_config.rst:554 msgid "Runtime Python configuration API" -msgstr "" +msgstr "実行時の Python 設定 API" -#: ../../c-api/init_config.rst:556 msgid "" "At runtime, it's possible to get and set configuration options using :c:func:" "`PyConfig_Get` and :c:func:`PyConfig_Set` functions." msgstr "" +"実行時には、:c:func:`PyConfig_Get` と :c:func:`PyConfig_Set` を使って設定オプ" +"ションを取得・設定できます。" -#: ../../c-api/init_config.rst:562 msgid "" "Some options are read from the :mod:`sys` attributes. For example, the " "option ``\"argv\"`` is read from :data:`sys.argv`." msgstr "" +"一部のオプションは :mod:`sys` の属性から読み取ります。\n" +"例えば、``\"argv\"`` オプションは :data:`sys.argv` から読み取ります。" -#: ../../c-api/init_config.rst:568 msgid "" "Get the current runtime value of a configuration option as a Python object." msgstr "" +"設定オプションの現在の実行時の値を、Python オブジェクトとして取得します。" -#: ../../c-api/init_config.rst:570 ../../c-api/init_config.rst:601 msgid "Return a new reference on success." -msgstr "" +msgstr "成功時は新しい参照を返します。" -#: ../../c-api/init_config.rst:571 ../../c-api/init_config.rst:602 msgid "Set an exception and return ``NULL`` on error." -msgstr "" +msgstr "エラー時には例外を設定して ``NULL`` を返します。" -#: ../../c-api/init_config.rst:573 msgid "The object type depends on the configuration option. It can be:" msgstr "" +"オブジェクトの型は設定オプションによって異なり、次のいずれかになります。" -#: ../../c-api/init_config.rst:581 ../../c-api/init_config.rst:604 -#: ../../c-api/init_config.rst:619 msgid "" "The caller must have an :term:`attached thread state`. The function cannot " "be called before Python initialization nor after Python finalization." msgstr "" +"呼び出し元には :term:`スレッド状態がアタッチされていなければなりません " +"`。\n" +"Python の初期化前や終了処理後には呼び出せません。" -#: ../../c-api/init_config.rst:589 msgid "Similar to :c:func:`PyConfig_Get`, but get the value as a C int." msgstr "" +":c:func:`PyConfig_Get` と同様ですが、値を C の ``int`` として取得します。" -#: ../../c-api/init_config.rst:592 msgid "Set an exception and return ``-1`` on error." -msgstr "" +msgstr "エラー時は例外を設定して ``-1`` を返します。" -#: ../../c-api/init_config.rst:599 msgid "Get all configuration option names as a ``frozenset``." -msgstr "" +msgstr "すべての設定オプションの名前を ``frozenset`` として取得します。" -#: ../../c-api/init_config.rst:612 msgid "Set the current runtime value of a configuration option." -msgstr "" +msgstr "設定オプションの現在の実行時の値を設定します。" -#: ../../c-api/init_config.rst:614 msgid "Raise a :exc:`ValueError` if there is no option *name*." -msgstr "" +msgstr "*name* というオプションがなければ :exc:`ValueError` を送出します。" -#: ../../c-api/init_config.rst:615 msgid "Raise a :exc:`ValueError` if *value* is an invalid value." -msgstr "" +msgstr "*value* が無効な値の場合は :exc:`ValueError` を送出します。" -#: ../../c-api/init_config.rst:616 msgid "Raise a :exc:`ValueError` if the option is read-only (cannot be set)." msgstr "" +"オプションが読み取り専用で設定できない場合は :exc:`ValueError` を送出します。" -#: ../../c-api/init_config.rst:617 msgid "Raise a :exc:`TypeError` if *value* has not the proper type." -msgstr "" +msgstr "*value* の型が正しくない場合は :exc:`TypeError` を送出します。" -#: ../../c-api/init_config.rst:622 msgid "" "Raises an :ref:`auditing event ` ``cpython.PyConfig_Set`` with " "arguments ``name``, ``value``." msgstr "" +"引数 ``name``、``value`` を指定して、:ref:`監査イベント ` " +"``cpython.PyConfig_Set`` を送出します。" -#: ../../c-api/init_config.rst:630 msgid "PyConfig C API" -msgstr "" +msgstr "PyConfig C API" #: ../../c-api/init_config.rst:634 msgid "" @@ -1124,23 +998,25 @@ msgstr "" "舞いをするカスタマイズされた Python を構築するために使用されます。例えば、環" "境変数やコマンドライン引数がPythonを設定するために使用されます。" -#: ../../c-api/init_config.rst:645 msgid "" "The :ref:`Isolated Configuration ` can be used to embed " "Python into an application. It isolates Python from the system. For example, " "environment variables are ignored, the LC_CTYPE locale is left unchanged and " "no signal handler is registered." msgstr "" +":ref:`隔離設定 ` は、Python をアプリケーションに組み込む" +"ために使えます。\n" +"Python をシステムから隔離します。\n" +"例えば、環境変数を無視し、LC_CTYPE ロケールを変更せず、シグナルハンドラーを登" +"録しません。" #: ../../c-api/init_config.rst:656 msgid ":pep:`587` \"Python Initialization Configuration\"." msgstr ":pep:`587` \"Python 初期化設定\"" -#: ../../c-api/init_config.rst:662 msgid "Example of customized Python always running in isolated mode::" -msgstr "" +msgstr "常に隔離モードで実行するようカスタマイズした Python の例です。 ::" -#: ../../c-api/init_config.rst:664 msgid "" "int main(int argc, char **argv)\n" "{\n" @@ -1175,6 +1051,38 @@ msgid "" " Py_ExitStatusException(status);\n" "}" msgstr "" +"int main(int argc, char **argv)\n" +"{\n" +" PyStatus status;\n" +"\n" +" PyConfig config;\n" +" PyConfig_InitPythonConfig(&config);\n" +" config.isolated = 1;\n" +"\n" +" /* コマンドライン引数をデコードする。\n" +" Python を暗黙に事前初期化する (隔離モード)。 */\n" +" status = PyConfig_SetBytesArgv(&config, argc, argv);\n" +" if (PyStatus_Exception(status)) {\n" +" goto exception;\n" +" }\n" +"\n" +" status = Py_InitializeFromConfig(&config);\n" +" if (PyStatus_Exception(status)) {\n" +" goto exception;\n" +" }\n" +" PyConfig_Clear(&config);\n" +"\n" +" return Py_RunMain();\n" +"\n" +"exception:\n" +" PyConfig_Clear(&config);\n" +" if (PyStatus_IsExit(status)) {\n" +" return status.exitcode;\n" +" }\n" +" /* エラーメッセージを表示し、ゼロ以外の終了コードで\n" +" プロセスを終了する */\n" +" Py_ExitStatusException(status);\n" +"}" #: ../../c-api/init_config.rst:699 msgid "PyWideStringList" @@ -1200,9 +1108,8 @@ msgstr "メソッド:" msgid "Append *item* to *list*." msgstr "*item* を *list* に追加します。" -#: ../../c-api/init_config.rst:716 ../../c-api/init_config.rst:727 msgid "Python must be preinitialized to call this function." -msgstr "" +msgstr "呼び出す前に、Python を事前初期化しておく必要があります。" #: ../../c-api/init_config.rst:720 msgid "Insert *item* into *list* at *index*." @@ -1215,9 +1122,8 @@ msgid "" msgstr "" "*index* が *list* の長さ以上の場合、*item* を *list* の末尾に追加します。" -#: ../../c-api/init_config.rst:725 msgid "*index* must be greater than or equal to ``0``." -msgstr "" +msgstr "*index* は ``0`` 以上でなければなりません。" #: ../../c-api/init_config.rst:731 ../../c-api/init_config.rst:751 #: ../../c-api/init_config.rst:858 ../../c-api/init_config.rst:1177 @@ -1265,13 +1171,11 @@ msgstr "ステータスを生成する関数:" msgid "Success." msgstr "成功。" -#: ../../c-api/init_config.rst:775 msgid "Initialization error with a message." -msgstr "メッセージとともにエラーを初期化します。" +msgstr "メッセージを伴う初期化エラー。" -#: ../../c-api/init_config.rst:777 msgid "*err_msg* must not be ``NULL``." -msgstr "" +msgstr "*err_msg* は ``NULL`` であってはなりません。" #: ../../c-api/init_config.rst:781 msgid "Memory allocation failure (out of memory)." @@ -1285,32 +1189,37 @@ msgstr "指定した終了コードでPythonを終了します。" msgid "Functions to handle a status:" msgstr "ステータスを扱う関数:" -#: ../../c-api/init_config.rst:791 msgid "" "Is the status an error or an exit? If true, the exception must be handled; " "by calling :c:func:`Py_ExitStatusException` for example." msgstr "" +"状態がエラーまたは終了を表すかどうかを調べます。\n" +"真の場合は、:c:func:`Py_ExitStatusException` を呼び出すなどして対処しなければ" +"なりません。" -#: ../../c-api/init_config.rst:796 msgid "Is the result an error?" -msgstr "" +msgstr "結果がエラーかどうかを調べます。" -#: ../../c-api/init_config.rst:800 msgid "Is the result an exit?" -msgstr "" +msgstr "結果が終了かどうかを調べます。" -#: ../../c-api/init_config.rst:804 msgid "" "Call ``exit(exitcode)`` if *status* is an exit. Print the error message and " "exit with a non-zero exit code if *status* is an error. Must only be called " "if ``PyStatus_Exception(status)`` is non-zero." msgstr "" +"*status* が終了を表す場合は、``exit(exitcode)`` を呼び出します。\n" +"*status* がエラーを表す場合は、エラーメッセージを表示し、ゼロ以外の終了コード" +"で終了します。\n" +"``PyStatus_Exception(status)`` がゼロ以外の場合にのみ呼び出さなければなりませ" +"ん。" -#: ../../c-api/init_config.rst:809 msgid "" "Internally, Python uses macros which set ``PyStatus.func``, whereas " "functions to create a status set ``func`` to ``NULL``." msgstr "" +"Python 内部では ``PyStatus.func`` を設定するマクロを使いますが、状態を作成す" +"る関数は ``func`` を ``NULL`` に設定します。" #: ../../c-api/init_config.rst:812 msgid "Example::" @@ -1343,69 +1252,72 @@ msgstr "" msgid "PyPreConfig" msgstr "PyPreConfig" -#: ../../c-api/init_config.rst:840 msgid "Structure used to preinitialize Python." -msgstr "" +msgstr "Python の事前初期化に使う構造体です。" -#: ../../c-api/init_config.rst:844 msgid "Function to initialize a preconfiguration:" -msgstr "" +msgstr "事前設定を初期化する関数:" -#: ../../c-api/init_config.rst:848 msgid "" "Initialize the preconfiguration with :ref:`Python Configuration `." -msgstr "" +msgstr ":ref:`Python 設定 ` で事前設定を初期化します。" -#: ../../c-api/init_config.rst:853 msgid "" "Initialize the preconfiguration with :ref:`Isolated Configuration `." -msgstr "" +msgstr ":ref:`隔離設定 ` で事前設定を初期化します。" -#: ../../c-api/init_config.rst:862 msgid "Name of the Python memory allocators:" -msgstr "" +msgstr "Python のメモリアロケーターの名前:" -#: ../../c-api/init_config.rst:864 msgid "" "``PYMEM_ALLOCATOR_NOT_SET`` (``0``): don't change memory allocators (use " "defaults)." msgstr "" +"``PYMEM_ALLOCATOR_NOT_SET`` (``0``): メモリアロケーターを変更せず、デフォルト" +"を使います。" -#: ../../c-api/init_config.rst:866 msgid "" "``PYMEM_ALLOCATOR_DEFAULT`` (``1``): :ref:`default memory allocators " "`." msgstr "" +"``PYMEM_ALLOCATOR_DEFAULT`` (``1``): :ref:`デフォルトのメモリアロケーター " +"`。" -#: ../../c-api/init_config.rst:868 msgid "" "``PYMEM_ALLOCATOR_DEBUG`` (``2``): :ref:`default memory allocators ` with :ref:`debug hooks `." msgstr "" +"``PYMEM_ALLOCATOR_DEBUG`` (``2``): :ref:`デフォルトのメモリアロケーター " +"` に :ref:`デバッグフック ` を" +"付けます。" -#: ../../c-api/init_config.rst:871 msgid "``PYMEM_ALLOCATOR_MALLOC`` (``3``): use ``malloc()`` of the C library." msgstr "" +"``PYMEM_ALLOCATOR_MALLOC`` (``3``): C ライブラリの ``malloc()`` を使います。" -#: ../../c-api/init_config.rst:872 msgid "" "``PYMEM_ALLOCATOR_MALLOC_DEBUG`` (``4``): force usage of ``malloc()`` with :" "ref:`debug hooks `." msgstr "" +"``PYMEM_ALLOCATOR_MALLOC_DEBUG`` (``4``): :ref:`デバッグフック ` 付きの ``malloc()`` の使用を強制します。" -#: ../../c-api/init_config.rst:874 msgid "" "``PYMEM_ALLOCATOR_PYMALLOC`` (``5``): :ref:`Python pymalloc memory allocator " "`." msgstr "" +"``PYMEM_ALLOCATOR_PYMALLOC`` (``5``): :ref:`Python の pymalloc メモリアロケー" +"ター `。" -#: ../../c-api/init_config.rst:876 msgid "" "``PYMEM_ALLOCATOR_PYMALLOC_DEBUG`` (``6``): :ref:`Python pymalloc memory " "allocator ` with :ref:`debug hooks `." msgstr "" +"``PYMEM_ALLOCATOR_PYMALLOC_DEBUG`` (``6``): :ref:`Python の pymalloc メモリア" +"ロケーター ` に :ref:`デバッグフック ` を付けま" +"す。" #: ../../c-api/init_config.rst:879 msgid "" @@ -1419,149 +1331,140 @@ msgid "" "replacement with :ref:`debug hooks `." msgstr "" -#: ../../c-api/init_config.rst:885 msgid "" "``PYMEM_ALLOCATOR_PYMALLOC`` and ``PYMEM_ALLOCATOR_PYMALLOC_DEBUG`` are not " "supported if Python is :option:`configured using --without-pymalloc <--" "without-pymalloc>`." msgstr "" +"Python を :option:`--without-pymalloc で構成した <--without-pymalloc>` 場合、" +"``PYMEM_ALLOCATOR_PYMALLOC`` と ``PYMEM_ALLOCATOR_PYMALLOC_DEBUG`` はサポート" +"されません。" -#: ../../c-api/init_config.rst:889 msgid "" "``PYMEM_ALLOCATOR_MIMALLOC`` and ``PYMEM_ALLOCATOR_MIMALLOC_DEBUG`` are not " "supported if Python is :option:`configured using --without-mimalloc <--" "without-mimalloc>` or if the underlying atomic support isn't available." msgstr "" +"Python を :option:`--without-mimalloc で構成した <--without-mimalloc>` 場合" +"や、必要なアトミック操作を利用できない場合、``PYMEM_ALLOCATOR_MIMALLOC`` と " +"``PYMEM_ALLOCATOR_MIMALLOC_DEBUG`` はサポートされません。" -#: ../../c-api/init_config.rst:894 msgid "See :ref:`Memory Management `." -msgstr "" +msgstr ":ref:`メモリ管理 ` を参照してください。" -#: ../../c-api/init_config.rst:896 msgid "Default: ``PYMEM_ALLOCATOR_NOT_SET``." -msgstr "" +msgstr "デフォルト: ``PYMEM_ALLOCATOR_NOT_SET``。" -#: ../../c-api/init_config.rst:900 msgid "Set the LC_CTYPE locale to the user preferred locale." -msgstr "" +msgstr "LC_CTYPE ロケールを、ユーザーが選択したロケールに設定します。" -#: ../../c-api/init_config.rst:902 msgid "" "If equals to ``0``, set :c:member:`~PyPreConfig.coerce_c_locale` and :c:" "member:`~PyPreConfig.coerce_c_locale_warn` members to ``0``." msgstr "" +"``0`` の場合、:c:member:`~PyPreConfig.coerce_c_locale` と :c:member:" +"`~PyPreConfig.coerce_c_locale_warn` メンバーを ``0`` に設定します。" -#: ../../c-api/init_config.rst:905 ../../c-api/init_config.rst:916 msgid "See the :term:`locale encoding`." msgstr "" +":term:`ロケールエンコーディング ` を参照してください。" -#: ../../c-api/init_config.rst:907 ../../c-api/init_config.rst:962 -#: ../../c-api/init_config.rst:1333 msgid "Default: ``1`` in Python config, ``0`` in isolated config." -msgstr "" +msgstr "デフォルト: Python 設定では ``1``、隔離設定では ``0``。" -#: ../../c-api/init_config.rst:911 msgid "If equals to ``2``, coerce the C locale." -msgstr "" +msgstr "``2`` の場合、C ロケールを置き換えます。" -#: ../../c-api/init_config.rst:913 msgid "" "If equals to ``1``, read the LC_CTYPE locale to decide if it should be " "coerced." msgstr "" +"``1`` の場合、LC_CTYPE ロケールを調べ、置き換える必要があるかを判断します。" -#: ../../c-api/init_config.rst:918 ../../c-api/init_config.rst:924 msgid "Default: ``-1`` in Python config, ``0`` in isolated config." -msgstr "" +msgstr "デフォルト: Python 設定では ``-1``、隔離設定では ``0``。" -#: ../../c-api/init_config.rst:922 msgid "If non-zero, emit a warning if the C locale is coerced." -msgstr "" +msgstr "ゼロ以外の場合、C ロケールを置き換えたときに警告を出します。" -#: ../../c-api/init_config.rst:928 msgid "" ":ref:`Python Development Mode `: see :c:member:`PyConfig.dev_mode`." msgstr "" +":ref:`Python 開発モード `。\n" +":c:member:`PyConfig.dev_mode` を参照してください。" -#: ../../c-api/init_config.rst:931 ../../c-api/init_config.rst:1342 -#: ../../c-api/init_config.rst:1398 ../../c-api/init_config.rst:1892 msgid "Default: ``-1`` in Python mode, ``0`` in isolated mode." -msgstr "" +msgstr "デフォルト: Python モードでは ``-1``、隔離モードでは ``0``。" -#: ../../c-api/init_config.rst:935 msgid "Isolated mode: see :c:member:`PyConfig.isolated`." msgstr "" +"隔離モード。\n" +":c:member:`PyConfig.isolated` を参照してください。" -#: ../../c-api/init_config.rst:937 ../../c-api/init_config.rst:1569 msgid "Default: ``0`` in Python mode, ``1`` in isolated mode." -msgstr "" +msgstr "デフォルト: Python モードでは ``0``、隔離モードでは ``1``。" -#: ../../c-api/init_config.rst:941 msgid "If non-zero:" -msgstr "" +msgstr "ゼロ以外の場合:" -#: ../../c-api/init_config.rst:943 msgid "Set :c:member:`PyPreConfig.utf8_mode` to ``0``," -msgstr "" +msgstr ":c:member:`PyPreConfig.utf8_mode` を ``0`` に設定します。" -#: ../../c-api/init_config.rst:944 msgid "Set :c:member:`PyConfig.filesystem_encoding` to ``\"mbcs\"``," msgstr "" +":c:member:`PyConfig.filesystem_encoding` を ``\"mbcs\"`` に設定します。" -#: ../../c-api/init_config.rst:945 msgid "Set :c:member:`PyConfig.filesystem_errors` to ``\"replace\"``." msgstr "" +":c:member:`PyConfig.filesystem_errors` を ``\"replace\"`` に設定します。" -#: ../../c-api/init_config.rst:947 msgid "" "Initialized from the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` environment " "variable value." msgstr "" +":envvar:`PYTHONLEGACYWINDOWSFSENCODING` 環境変数の値から初期化されます。" -#: ../../c-api/init_config.rst:950 ../../c-api/init_config.rst:1583 msgid "" "Only available on Windows. ``#ifdef MS_WINDOWS`` macro can be used for " "Windows specific code." msgstr "" +"Windows でのみ利用できます。\n" +"Windows 固有のコードには、``#ifdef MS_WINDOWS`` マクロを使えます。" -#: ../../c-api/init_config.rst:953 ../../c-api/init_config.rst:1281 -#: ../../c-api/init_config.rst:1288 ../../c-api/init_config.rst:1355 -#: ../../c-api/init_config.rst:1487 ../../c-api/init_config.rst:1505 -#: ../../c-api/init_config.rst:1519 ../../c-api/init_config.rst:1586 -#: ../../c-api/init_config.rst:1600 ../../c-api/init_config.rst:1660 -#: ../../c-api/init_config.rst:1712 ../../c-api/init_config.rst:1774 -#: ../../c-api/init_config.rst:1828 ../../c-api/init_config.rst:1857 -#: ../../c-api/init_config.rst:1971 ../../c-api/init_config.rst:2018 msgid "Default: ``0``." -msgstr "" +msgstr "デフォルト: ``0``。" -#: ../../c-api/init_config.rst:957 msgid "" "If non-zero, :c:func:`Py_PreInitializeFromArgs` and :c:func:" "`Py_PreInitializeFromBytesArgs` parse their ``argv`` argument the same way " "the regular Python parses command line arguments: see :ref:`Command Line " "Arguments `." msgstr "" +"ゼロ以外の場合、:c:func:`Py_PreInitializeFromArgs` と :c:func:" +"`Py_PreInitializeFromBytesArgs` は、通常の Python がコマンドライン引数を解析" +"するのと同じように ``argv`` 引数を解析します。\n" +":ref:`コマンドライン引数 ` を参照してください。" -#: ../../c-api/init_config.rst:966 msgid "" "Use :ref:`environment variables `? See :c:member:`PyConfig." "use_environment`." msgstr "" +":ref:`環境変数 ` を使うかどうか。\n" +":c:member:`PyConfig.use_environment` を参照してください。" -#: ../../c-api/init_config.rst:969 ../../c-api/init_config.rst:1933 msgid "Default: ``1`` in Python config and ``0`` in isolated config." -msgstr "" +msgstr "デフォルト: Python 設定では ``1``、隔離設定では ``0``。" -#: ../../c-api/init_config.rst:973 msgid "If non-zero, enable the :ref:`Python UTF-8 Mode `." msgstr "" +"ゼロ以外の場合、:ref:`Python UTF-8 モード ` を有効にします。" -#: ../../c-api/init_config.rst:975 msgid "" "Set to ``0`` or ``1`` by the :option:`-X utf8 <-X>` command line option and " "the :envvar:`PYTHONUTF8` environment variable." msgstr "" +":option:`-X utf8 <-X>` コマンドラインオプションと :envvar:`PYTHONUTF8` 環境変" +"数によって、``0`` または ``1`` に設定されます。" #: ../../c-api/init_config.rst:978 msgid "Also set to ``1`` if the ``LC_CTYPE`` locale is ``C`` or ``POSIX``." @@ -1571,67 +1474,66 @@ msgstr "" msgid "Default: ``-1`` in Python config and ``0`` in isolated config." msgstr "" -#: ../../c-api/init_config.rst:986 msgid "Preinitialize Python with PyPreConfig" -msgstr "" +msgstr "PyPreConfig による Python の事前初期化" -#: ../../c-api/init_config.rst:988 msgid "The preinitialization of Python:" -msgstr "" +msgstr "Python の事前初期化では、次の処理を行います。" -#: ../../c-api/init_config.rst:990 msgid "Set the Python memory allocators (:c:member:`PyPreConfig.allocator`)" msgstr "" +"Python のメモリアロケーターを設定する (:c:member:`PyPreConfig.allocator`)" -#: ../../c-api/init_config.rst:991 msgid "Configure the LC_CTYPE locale (:term:`locale encoding`)" msgstr "" +"LC_CTYPE ロケールを設定する (:term:`ロケールエンコーディング `)" -#: ../../c-api/init_config.rst:992 msgid "" "Set the :ref:`Python UTF-8 Mode ` (:c:member:`PyPreConfig." "utf8_mode`)" msgstr "" +":ref:`Python UTF-8 モード ` を設定する (:c:member:`PyPreConfig." +"utf8_mode`)" -#: ../../c-api/init_config.rst:995 msgid "" "The current preconfiguration (``PyPreConfig`` type) is stored in " "``_PyRuntime.preconfig``." msgstr "" +"現在の事前設定 (``PyPreConfig`` 型) は、``_PyRuntime.preconfig`` に保存されて" +"います。" -#: ../../c-api/init_config.rst:998 msgid "Functions to preinitialize Python:" -msgstr "" +msgstr "Python を事前初期化する関数:" -#: ../../c-api/init_config.rst:1002 ../../c-api/init_config.rst:1008 -#: ../../c-api/init_config.rst:1017 msgid "Preinitialize Python from *preconfig* preconfiguration." -msgstr "" +msgstr "事前設定 *preconfig* から Python を事前初期化します。" -#: ../../c-api/init_config.rst:1004 ../../c-api/init_config.rst:1013 -#: ../../c-api/init_config.rst:1022 msgid "*preconfig* must not be ``NULL``." -msgstr "" +msgstr "*preconfig* は ``NULL`` であってはなりません。" -#: ../../c-api/init_config.rst:1010 msgid "" "Parse *argv* command line arguments (bytes strings) if :c:member:" "`~PyPreConfig.parse_argv` of *preconfig* is non-zero." msgstr "" +"*preconfig* の :c:member:`~PyPreConfig.parse_argv` がゼロ以外の場合、コマンド" +"ライン引数 *argv* (バイト文字列) を解析します。" -#: ../../c-api/init_config.rst:1019 msgid "" "Parse *argv* command line arguments (wide strings) if :c:member:" "`~PyPreConfig.parse_argv` of *preconfig* is non-zero." msgstr "" +"*preconfig* の :c:member:`~PyPreConfig.parse_argv` がゼロ以外の場合、コマンド" +"ライン引数 *argv* (ワイド文字列) を解析します。" -#: ../../c-api/init_config.rst:1024 ../../c-api/init_config.rst:2041 msgid "" "The caller is responsible to handle exceptions (error or exit) using :c:func:" "`PyStatus_Exception` and :c:func:`Py_ExitStatusException`." msgstr "" +"呼び出し元は、:c:func:`PyStatus_Exception` と :c:func:" +"`Py_ExitStatusException` を使って、エラーまたは終了の状態を処理する責任があり" +"ます。" -#: ../../c-api/init_config.rst:1027 msgid "" "For :ref:`Python Configuration ` (:c:func:" "`PyPreConfig_InitPythonConfig`), if Python is initialized with command line " @@ -1640,30 +1542,45 @@ msgid "" "For example, the :option:`-X utf8 <-X>` command line option enables the :ref:" "`Python UTF-8 Mode `." msgstr "" +":ref:`Python 設定 ` (:c:func:" +"`PyPreConfig_InitPythonConfig`) で、コマンドライン引数を使って Python を初期" +"化する場合は、事前初期化にもそのコマンドライン引数を渡さなければなりませ" +"ん。\n" +"エンコーディングなどの事前設定に影響するためです。\n" +"例えば、:option:`-X utf8 <-X>` コマンドラインオプションは :ref:`Python UTF-8 " +"モード ` を有効にします。" -#: ../../c-api/init_config.rst:1034 msgid "" "``PyMem_SetAllocator()`` can be called after :c:func:`Py_PreInitialize` and " "before :c:func:`Py_InitializeFromConfig` to install a custom memory " "allocator. It can be called before :c:func:`Py_PreInitialize` if :c:member:" "`PyPreConfig.allocator` is set to ``PYMEM_ALLOCATOR_NOT_SET``." msgstr "" +"カスタムのメモリアロケーターを設定するには、:c:func:`Py_PreInitialize` の" +"後、:c:func:`Py_InitializeFromConfig` の前に ``PyMem_SetAllocator()`` を呼び" +"出せます。\n" +":c:member:`PyPreConfig.allocator` が ``PYMEM_ALLOCATOR_NOT_SET`` に設定されて" +"いる場合は、:c:func:`Py_PreInitialize` より前にも呼び出せます。" -#: ../../c-api/init_config.rst:1039 msgid "" "Python memory allocation functions like :c:func:`PyMem_RawMalloc` must not " "be used before the Python preinitialization, whereas calling directly " "``malloc()`` and ``free()`` is always safe. :c:func:`Py_DecodeLocale` must " "not be called before the Python preinitialization." msgstr "" +"Python の事前初期化より前に、:c:func:`PyMem_RawMalloc` などの Python のメモリ" +"確保関数を使ってはなりません。\n" +"一方、``malloc()`` と ``free()`` を直接呼び出すのは常に安全です。\n" +":c:func:`Py_DecodeLocale` も、Python の事前初期化より前に呼び出してはなりませ" +"ん。" -#: ../../c-api/init_config.rst:1044 msgid "" "Example using the preinitialization to enable the :ref:`Python UTF-8 Mode " "`::" msgstr "" +"事前初期化を使って :ref:`Python UTF-8 モード ` を有効にする例で" +"す。 ::" -#: ../../c-api/init_config.rst:1047 msgid "" "PyStatus status;\n" "PyPreConfig preconfig;\n" @@ -1682,85 +1599,94 @@ msgid "" "/* ... use Python API here ... */\n" "Py_Finalize();" msgstr "" +"PyStatus status;\n" +"PyPreConfig preconfig;\n" +"PyPreConfig_InitPythonConfig(&preconfig);\n" +"\n" +"preconfig.utf8_mode = 1;\n" +"\n" +"status = Py_PreInitialize(&preconfig);\n" +"if (PyStatus_Exception(status)) {\n" +" Py_ExitStatusException(status);\n" +"}\n" +"\n" +"/* この時点で Python は UTF-8 を使う */\n" +"\n" +"Py_Initialize();\n" +"/* ... ここで Python API を使う ... */\n" +"Py_Finalize();" -#: ../../c-api/init_config.rst:1066 msgid "PyConfig" -msgstr "" +msgstr "PyConfig" -#: ../../c-api/init_config.rst:1070 msgid "Structure containing most parameters to configure Python." -msgstr "" +msgstr "Python の設定に使うパラメーターの大部分を含む構造体です。" -#: ../../c-api/init_config.rst:1072 msgid "" "When done, the :c:func:`PyConfig_Clear` function must be used to release the " "configuration memory." msgstr "" +"使い終わったら、:c:func:`PyConfig_Clear` で設定のメモリを解放しなければなりま" +"せん。" -#: ../../c-api/init_config.rst:1077 msgid "Structure methods:" -msgstr "" +msgstr "構造体のメソッド:" -#: ../../c-api/init_config.rst:1081 msgid "" "Initialize configuration with the :ref:`Python Configuration `." -msgstr "" +msgstr ":ref:`Python 設定 ` で設定を初期化します。" -#: ../../c-api/init_config.rst:1086 msgid "" "Initialize configuration with the :ref:`Isolated Configuration `." -msgstr "" +msgstr ":ref:`隔離設定 ` で設定を初期化します。" -#: ../../c-api/init_config.rst:1091 msgid "Copy the wide character string *str* into ``*config_str``." -msgstr "" +msgstr "ワイド文字列 *str* を ``*config_str`` にコピーします。" -#: ../../c-api/init_config.rst:1093 ../../c-api/init_config.rst:1100 -#: ../../c-api/init_config.rst:1107 ../../c-api/init_config.rst:1115 -#: ../../c-api/init_config.rst:1121 ../../c-api/init_config.rst:1138 msgid ":ref:`Preinitialize Python ` if needed." -msgstr "" +msgstr "必要なら :ref:`Python を事前初期化 ` します。" -#: ../../c-api/init_config.rst:1097 msgid "" "Decode *str* using :c:func:`Py_DecodeLocale` and set the result into " "``*config_str``." msgstr "" +"*str* を :c:func:`Py_DecodeLocale` でデコードし、結果を ``*config_str`` に設" +"定します。" -#: ../../c-api/init_config.rst:1104 msgid "" "Set command line arguments (:c:member:`~PyConfig.argv` member of *config*) " "from the *argv* list of wide character strings." msgstr "" +"ワイド文字列のリスト *argv* から、コマンドライン引数 (*config* の :c:member:" +"`~PyConfig.argv` メンバー) を設定します。" -#: ../../c-api/init_config.rst:1111 msgid "" "Set command line arguments (:c:member:`~PyConfig.argv` member of *config*) " "from the *argv* list of bytes strings. Decode bytes using :c:func:" "`Py_DecodeLocale`." msgstr "" +"バイト文字列のリスト *argv* から、コマンドライン引数 (*config* の :c:member:" +"`~PyConfig.argv` メンバー) を設定します。\n" +"バイト列は :c:func:`Py_DecodeLocale` でデコードします。" -#: ../../c-api/init_config.rst:1119 msgid "Set the list of wide strings *list* to *length* and *items*." -msgstr "" +msgstr "ワイド文字列のリスト *list* を、*length* と *items* から設定します。" -#: ../../c-api/init_config.rst:1125 msgid "Read all Python configuration." -msgstr "" +msgstr "Python の設定をすべて読み込みます。" -#: ../../c-api/init_config.rst:1127 msgid "Fields which are already initialized are left unchanged." -msgstr "" +msgstr "すでに初期化されているフィールドは変更しません。" -#: ../../c-api/init_config.rst:1129 msgid "" "Fields for :ref:`path configuration ` are no longer " "calculated or modified when calling this function, as of Python 3.11." msgstr "" +"Python 3.11 以降、この関数を呼び出しても :ref:`パス設定 ` " +"のフィールドは計算・変更されません。" -#: ../../c-api/init_config.rst:1132 ../../c-api/init_config.rst:1689 msgid "" "The :c:func:`PyConfig_Read` function only parses :c:member:`PyConfig.argv` " "arguments once: :c:member:`PyConfig.parse_argv` is set to ``2`` after " @@ -1768,24 +1694,34 @@ msgid "" "`PyConfig.argv`, parsing arguments twice would parse the application options " "as Python options." msgstr "" +":c:func:`PyConfig_Read` は :c:member:`PyConfig.argv` の引数を一度しか解析しま" +"せん。\n" +"解析後には :c:member:`PyConfig.parse_argv` を ``2`` に設定します。\n" +"Python 自体への引数は :c:member:`PyConfig.argv` から取り除かれるため、二度解" +"析するとアプリケーションのオプションを Python のオプションとして解析してしま" +"います。" -#: ../../c-api/init_config.rst:1140 msgid "" "The :c:member:`PyConfig.argv` arguments are now only parsed once, :c:member:" "`PyConfig.parse_argv` is set to ``2`` after arguments are parsed, and " "arguments are only parsed if :c:member:`PyConfig.parse_argv` equals ``1``." msgstr "" +":c:member:`PyConfig.argv` の引数は一度だけ解析され、解析後は :c:member:" +"`PyConfig.parse_argv` が ``2`` に設定されるようになりました。\n" +"また、:c:member:`PyConfig.parse_argv` が ``1`` の場合にのみ引数を解析するよう" +"になりました。" -#: ../../c-api/init_config.rst:1146 msgid "" ":c:func:`PyConfig_Read` no longer calculates all paths, and so fields listed " "under :ref:`Python Path Configuration ` may no longer be " "updated until :c:func:`Py_InitializeFromConfig` is called." msgstr "" +":c:func:`PyConfig_Read` は、すべてのパスを計算しなくなりました。\n" +"そのため、:ref:`Python のパス設定 ` に挙げたフィールドは、:" +"c:func:`Py_InitializeFromConfig` を呼び出すまで更新されない場合があります。" -#: ../../c-api/init_config.rst:1154 msgid "Release configuration memory." -msgstr "" +msgstr "設定のメモリを解放します。" #: ../../c-api/init_config.rst:1156 msgid "" @@ -1798,35 +1734,39 @@ msgstr "" #: ../../c-api/init_config.rst:1162 msgid ":c:member:`PyConfig.dev_mode`" -msgstr "" +msgstr ":c:member:`PyConfig.dev_mode`" #: ../../c-api/init_config.rst:1163 msgid ":c:member:`PyConfig.isolated`" -msgstr "" +msgstr ":c:member:`PyConfig.isolated`" #: ../../c-api/init_config.rst:1164 msgid ":c:member:`PyConfig.parse_argv`" -msgstr "" +msgstr ":c:member:`PyConfig.parse_argv`" #: ../../c-api/init_config.rst:1165 msgid ":c:member:`PyConfig.use_environment`" -msgstr "" +msgstr ":c:member:`PyConfig.use_environment`" -#: ../../c-api/init_config.rst:1167 msgid "" "Moreover, if :c:func:`PyConfig_SetArgv` or :c:func:`PyConfig_SetBytesArgv` " "is used, this method must be called before other methods, since the " "preinitialization configuration depends on command line arguments (if :c:" "member:`~PyConfig.parse_argv` is non-zero)." msgstr "" +"さらに、:c:func:`PyConfig_SetArgv` または :c:func:`PyConfig_SetBytesArgv` を" +"使う場合は、ほかのメソッドより先に呼び出さなければなりません。\n" +":c:member:`~PyConfig.parse_argv` がゼロ以外の場合、事前初期化設定がコマンドラ" +"イン引数に依存するためです。" -#: ../../c-api/init_config.rst:1172 msgid "" "The caller of these methods is responsible to handle exceptions (error or " "exit) using ``PyStatus_Exception()`` and ``Py_ExitStatusException()``." msgstr "" +"これらのメソッドの呼び出し元は、``PyStatus_Exception()`` と " +"``Py_ExitStatusException()`` を使って、エラーまたは終了の状態を処理する責任が" +"あります。" -#: ../../c-api/init_config.rst:1185 msgid "" "Set :data:`sys.argv` command line arguments based on :c:member:`~PyConfig." "argv`. These parameters are similar to those passed to the program's :c:" @@ -1835,84 +1775,84 @@ msgid "" "Python interpreter. If there isn't a script that will be run, the first " "entry in :c:member:`~PyConfig.argv` can be an empty string." msgstr "" +":c:member:`~PyConfig.argv` に基づいて、:data:`sys.argv` のコマンドライン引数" +"を設定します。\n" +"これらはプログラムの :c:func:`main` 関数に渡す引数と似ていますが、最初の要素" +"は Python インタープリタを組み込む実行ファイルではなく、実行するスクリプト" +"ファイルを指す点が異なります。\n" +"実行するスクリプトがなければ、:c:member:`~PyConfig.argv` の最初の要素は空文字" +"列でも構いません。" -#: ../../c-api/init_config.rst:1193 msgid "" "Set :c:member:`~PyConfig.parse_argv` to ``1`` to parse :c:member:`~PyConfig." "argv` the same way the regular Python parses Python command line arguments " "and then to strip Python arguments from :c:member:`~PyConfig.argv`." msgstr "" +":c:member:`~PyConfig.parse_argv` を ``1`` に設定すると、通常の Python がコマ" +"ンドライン引数を解析するのと同じように :c:member:`~PyConfig.argv` を解析し、" +"Python 自体への引数を :c:member:`~PyConfig.argv` から取り除きます。" -#: ../../c-api/init_config.rst:1198 msgid "" "If :c:member:`~PyConfig.argv` is empty, an empty string is added to ensure " "that :data:`sys.argv` always exists and is never empty." msgstr "" +":c:member:`~PyConfig.argv` が空の場合は、:data:`sys.argv` が常に存在し、空に" +"ならないよう、空文字列を 1 つ追加します。" -#: ../../c-api/init_config.rst:1201 ../../c-api/init_config.rst:1228 -#: ../../c-api/init_config.rst:1242 ../../c-api/init_config.rst:1252 -#: ../../c-api/init_config.rst:1363 ../../c-api/init_config.rst:1372 -#: ../../c-api/init_config.rst:1383 ../../c-api/init_config.rst:1474 -#: ../../c-api/init_config.rst:1630 ../../c-api/init_config.rst:1731 -#: ../../c-api/init_config.rst:1750 ../../c-api/init_config.rst:1765 -#: ../../c-api/init_config.rst:1782 ../../c-api/init_config.rst:1795 -#: ../../c-api/init_config.rst:1803 ../../c-api/init_config.rst:1817 -#: ../../c-api/init_config.rst:1920 msgid "Default: ``NULL``." -msgstr "" +msgstr "デフォルト: ``NULL``。" -#: ../../c-api/init_config.rst:1203 msgid "See also the :c:member:`~PyConfig.orig_argv` member." -msgstr "" +msgstr ":c:member:`~PyConfig.orig_argv` メンバーも参照してください。" -#: ../../c-api/init_config.rst:1207 msgid "" "If equals to zero, ``Py_RunMain()`` prepends a potentially unsafe path to :" "data:`sys.path` at startup:" msgstr "" +"ゼロの場合、``Py_RunMain()`` は起動時に、安全でない可能性があるパスを :data:" +"`sys.path` の先頭に追加します。" -#: ../../c-api/init_config.rst:1210 msgid "" "If :c:member:`argv[0] ` is equal to ``L\"-m\"`` (``python -m " "module``), prepend the current working directory." msgstr "" +":c:member:`argv[0] ` が ``L\"-m\"`` の場合 (``python -m " +"module``)、現在の作業ディレクトリを先頭に追加します。" -#: ../../c-api/init_config.rst:1212 msgid "" "If running a script (``python script.py``), prepend the script's directory. " "If it's a symbolic link, resolve symbolic links." msgstr "" +"スクリプトを実行する場合 (``python script.py``)、スクリプトのディレクトリを先" +"頭に追加します。\n" +"シンボリックリンクの場合は、リンクを解決します。" -#: ../../c-api/init_config.rst:1214 msgid "" "Otherwise (``python -c code`` and ``python``), prepend an empty string, " "which means the current working directory." msgstr "" +"それ以外の場合 (``python -c code`` と ``python``)、現在の作業ディレクトリを意" +"味する空文字列を先頭に追加します。" -#: ../../c-api/init_config.rst:1217 msgid "" "Set to ``1`` by the :option:`-P` command line option and the :envvar:" "`PYTHONSAFEPATH` environment variable." msgstr "" +":option:`-P` コマンドラインオプションと :envvar:`PYTHONSAFEPATH` 環境変数に" +"よって ``1`` に設定されます。" -#: ../../c-api/init_config.rst:1220 msgid "Default: ``0`` in Python config, ``1`` in isolated config." -msgstr "" +msgstr "デフォルト: Python 設定では ``0``、隔離設定では ``1``。" #: ../../c-api/init_config.rst:1226 msgid ":data:`sys.base_exec_prefix`." msgstr ":data:`sys.base_exec_prefix`." -#: ../../c-api/init_config.rst:1230 ../../c-api/init_config.rst:1244 -#: ../../c-api/init_config.rst:1254 ../../c-api/init_config.rst:1374 -#: ../../c-api/init_config.rst:1385 ../../c-api/init_config.rst:1647 -#: ../../c-api/init_config.rst:1733 msgid "Part of the :ref:`Python Path Configuration ` output." -msgstr "" +msgstr ":ref:`Python のパス設定 ` の出力の一部です。" -#: ../../c-api/init_config.rst:1232 msgid "See also :c:member:`PyConfig.exec_prefix`." -msgstr "" +msgstr ":c:member:`PyConfig.exec_prefix` も参照してください。" #: ../../c-api/init_config.rst:1236 msgid "Python base executable: :data:`sys._base_executable`." @@ -1922,393 +1862,392 @@ msgstr "" msgid "Set by the :envvar:`__PYVENV_LAUNCHER__` environment variable." msgstr "" -#: ../../c-api/init_config.rst:1240 msgid "Set from :c:member:`PyConfig.executable` if ``NULL``." -msgstr "" +msgstr "``NULL`` の場合は :c:member:`PyConfig.executable` から設定されます。" -#: ../../c-api/init_config.rst:1246 msgid "See also :c:member:`PyConfig.executable`." -msgstr "" +msgstr ":c:member:`PyConfig.executable` も参照してください。" #: ../../c-api/init_config.rst:1250 msgid ":data:`sys.base_prefix`." msgstr ":data:`sys.base_prefix`." -#: ../../c-api/init_config.rst:1256 msgid "See also :c:member:`PyConfig.prefix`." -msgstr "" +msgstr ":c:member:`PyConfig.prefix` も参照してください。" -#: ../../c-api/init_config.rst:1260 msgid "" "If equals to ``0`` and :c:member:`~PyConfig.configure_c_stdio` is non-zero, " "disable buffering on the C streams stdout and stderr." msgstr "" +"``0`` で、:c:member:`~PyConfig.configure_c_stdio` がゼロ以外の場合、C のスト" +"リーム ``stdout`` と ``stderr`` のバッファリングを無効にします。" -#: ../../c-api/init_config.rst:1263 msgid "" "Set to ``0`` by the :option:`-u` command line option and the :envvar:" "`PYTHONUNBUFFERED` environment variable." msgstr "" +":option:`-u` コマンドラインオプションと :envvar:`PYTHONUNBUFFERED` 環境変数に" +"よって ``0`` に設定されます。" -#: ../../c-api/init_config.rst:1266 msgid "stdin is always opened in buffered mode." -msgstr "" +msgstr "``stdin`` は常にバッファリングモードで開かれます。" -#: ../../c-api/init_config.rst:1268 ../../c-api/init_config.rst:1301 -#: ../../c-api/init_config.rst:1845 ../../c-api/init_config.rst:2003 msgid "Default: ``1``." -msgstr "" +msgstr "デフォルト: ``1``。" -#: ../../c-api/init_config.rst:1272 msgid "" "If equals to ``1``, issue a warning when comparing :class:`bytes` or :class:" "`bytearray` with :class:`str`, or comparing :class:`bytes` with :class:`int`." msgstr "" +"``1`` の場合、:class:`bytes` または :class:`bytearray` と :class:`str` の比" +"較、および :class:`bytes` と :class:`int` の比較で警告を出します。" -#: ../../c-api/init_config.rst:1276 msgid "" "If equal or greater to ``2``, raise a :exc:`BytesWarning` exception in these " "cases." msgstr "" +"``2`` 以上の場合、これらの場合に :exc:`BytesWarning` 例外を送出します。" -#: ../../c-api/init_config.rst:1279 msgid "Incremented by the :option:`-b` command line option." -msgstr "" +msgstr ":option:`-b` コマンドラインオプションで値が増加します。" -#: ../../c-api/init_config.rst:1285 msgid "" "If non-zero, emit a :exc:`EncodingWarning` warning when :class:`io." "TextIOWrapper` uses its default encoding. See :ref:`io-encoding-warning` for " "details." msgstr "" +"ゼロ以外の場合、:class:`io.TextIOWrapper` がデフォルトのエンコーディングを使" +"うときに :exc:`EncodingWarning` を出します。\n" +"詳しくは :ref:`io-encoding-warning` を参照してください。" -#: ../../c-api/init_config.rst:1294 msgid "" "If equals to ``0``, disables the inclusion of the end line and column " "mappings in code objects. Also disables traceback printing carets to " "specific error locations." msgstr "" +"``0`` の場合、コードオブジェクトに終了行と列の対応情報を含めません。\n" +"トレースバックで、エラーの詳しい位置をキャレットで示す表示も無効にします。" -#: ../../c-api/init_config.rst:1298 msgid "" "Set to ``0`` by the :envvar:`PYTHONNODEBUGRANGES` environment variable and " "by the :option:`-X no_debug_ranges <-X>` command line option." msgstr "" +":envvar:`PYTHONNODEBUGRANGES` 環境変数と :option:`-X no_debug_ranges <-X>` コ" +"マンドラインオプションによって ``0`` に設定されます。" -#: ../../c-api/init_config.rst:1307 msgid "" "Control the validation behavior of hash-based ``.pyc`` files: value of the :" "option:`--check-hash-based-pycs` command line option." msgstr "" +"ハッシュベースの ``.pyc`` ファイルの検証方法を制御します。\n" +":option:`--check-hash-based-pycs` コマンドラインオプションの値です。" -#: ../../c-api/init_config.rst:1310 msgid "Valid values:" -msgstr "" +msgstr "有効な値:" -#: ../../c-api/init_config.rst:1312 msgid "" "``L\"always\"``: Hash the source file for invalidation regardless of value " "of the 'check_source' flag." msgstr "" +"``L\"always\"``: ``check_source`` フラグの値にかかわらず、ソースファイルの" +"ハッシュを計算してキャッシュの有効性を確認します。" -#: ../../c-api/init_config.rst:1314 msgid "``L\"never\"``: Assume that hash-based pycs always are valid." -msgstr "" +msgstr "``L\"never\"``: ハッシュベースの pyc は常に有効と見なします。" -#: ../../c-api/init_config.rst:1315 msgid "" "``L\"default\"``: The 'check_source' flag in hash-based pycs determines " "invalidation." msgstr "" +"``L\"default\"``: ハッシュベースの pyc の ``check_source`` フラグに従って、" +"キャッシュの有効性を確認します。" -#: ../../c-api/init_config.rst:1318 msgid "Default: ``L\"default\"``." -msgstr "" +msgstr "デフォルト: ``L\"default\"``。" -#: ../../c-api/init_config.rst:1320 msgid "See also :pep:`552` \"Deterministic pycs\"." -msgstr "" +msgstr ":pep:`552` 「Deterministic pycs」も参照してください。" -#: ../../c-api/init_config.rst:1324 msgid "If non-zero, configure C standard streams:" -msgstr "" +msgstr "ゼロ以外の場合、C の標準ストリームを設定します。" -#: ../../c-api/init_config.rst:1326 msgid "" "On Windows, set the binary mode (``O_BINARY``) on stdin, stdout and stderr." msgstr "" +"Windows では、``stdin``、``stdout``、``stderr`` をバイナリモード " +"(``O_BINARY``) に設定します。" -#: ../../c-api/init_config.rst:1328 msgid "" "If :c:member:`~PyConfig.buffered_stdio` equals zero, disable buffering of " "stdin, stdout and stderr streams." msgstr "" +":c:member:`~PyConfig.buffered_stdio` がゼロの場合、``stdin``、``stdout``、" +"``stderr`` のバッファリングを無効にします。" -#: ../../c-api/init_config.rst:1330 msgid "" "If :c:member:`~PyConfig.interactive` is non-zero, enable stream buffering on " "stdin and stdout (only stdout on Windows)." msgstr "" +":c:member:`~PyConfig.interactive` がゼロ以外の場合、``stdin`` と ``stdout`` " +"(Windows では ``stdout`` のみ) のバッファリングを有効にします。" -#: ../../c-api/init_config.rst:1337 msgid "If non-zero, enable the :ref:`Python Development Mode `." -msgstr "" +msgstr "ゼロ以外の場合、:ref:`Python 開発モード ` を有効にします。" -#: ../../c-api/init_config.rst:1339 msgid "" "Set to ``1`` by the :option:`-X dev <-X>` option and the :envvar:" "`PYTHONDEVMODE` environment variable." msgstr "" +":option:`-X dev <-X>` オプションと :envvar:`PYTHONDEVMODE` 環境変数によって " +"``1`` に設定されます。" -#: ../../c-api/init_config.rst:1346 msgid "Dump Python references?" -msgstr "" +msgstr "Python の参照をダンプするかどうか。" -#: ../../c-api/init_config.rst:1348 msgid "If non-zero, dump all objects which are still alive at exit." msgstr "" +"ゼロ以外の場合、終了時にまだ生存しているすべてのオブジェクトをダンプします。" -#: ../../c-api/init_config.rst:1350 msgid "Set to ``1`` by the :envvar:`PYTHONDUMPREFS` environment variable." -msgstr "" +msgstr ":envvar:`PYTHONDUMPREFS` 環境変数によって ``1`` に設定されます。" -#: ../../c-api/init_config.rst:1352 msgid "" "Needs a special build of Python with the ``Py_TRACE_REFS`` macro defined: " "see the :option:`configure --with-trace-refs option <--with-trace-refs>`." msgstr "" +"``Py_TRACE_REFS`` マクロを定義した特別な Python ビルドが必要です。\n" +":option:`configure の --with-trace-refs オプション <--with-trace-refs>` を参" +"照してください。" -#: ../../c-api/init_config.rst:1359 msgid "Filename where to dump Python references." -msgstr "" +msgstr "Python の参照をダンプする先のファイル名。" -#: ../../c-api/init_config.rst:1361 msgid "Set by the :envvar:`PYTHONDUMPREFSFILE` environment variable." -msgstr "" +msgstr ":envvar:`PYTHONDUMPREFSFILE` 環境変数によって設定されます。" -#: ../../c-api/init_config.rst:1369 msgid "" "The site-specific directory prefix where the platform-dependent Python files " "are installed: :data:`sys.exec_prefix`." msgstr "" +"プラットフォームに依存する Python のファイルをインストールする、サイト固有の" +"ディレクトリのプレフィックス。\n" +":data:`sys.exec_prefix` に対応します。" -#: ../../c-api/init_config.rst:1376 msgid "See also :c:member:`PyConfig.base_exec_prefix`." -msgstr "" +msgstr ":c:member:`PyConfig.base_exec_prefix` も参照してください。" -#: ../../c-api/init_config.rst:1380 msgid "" "The absolute path of the executable binary for the Python interpreter: :data:" "`sys.executable`." msgstr "" +"Python インタープリタの実行ファイルの絶対パス。\n" +":data:`sys.executable` に対応します。" -#: ../../c-api/init_config.rst:1387 msgid "See also :c:member:`PyConfig.base_executable`." -msgstr "" +msgstr ":c:member:`PyConfig.base_executable` も参照してください。" -#: ../../c-api/init_config.rst:1391 msgid "Enable faulthandler?" -msgstr "" +msgstr "faulthandler を有効にするかどうか。" -#: ../../c-api/init_config.rst:1393 msgid "If non-zero, call :func:`faulthandler.enable` at startup." -msgstr "" +msgstr "ゼロ以外の場合、起動時に :func:`faulthandler.enable` を呼び出します。" -#: ../../c-api/init_config.rst:1395 msgid "" "Set to ``1`` by :option:`-X faulthandler <-X>` and the :envvar:" "`PYTHONFAULTHANDLER` environment variable." msgstr "" +":option:`-X faulthandler <-X>` と :envvar:`PYTHONFAULTHANDLER` 環境変数によっ" +"て ``1`` に設定されます。" -#: ../../c-api/init_config.rst:1402 msgid "" ":term:`Filesystem encoding `: :func:" "`sys.getfilesystemencoding`." msgstr "" +":term:`ファイルシステムエンコーディング `。\n" +":func:`sys.getfilesystemencoding` に対応します。" -#: ../../c-api/init_config.rst:1405 msgid "On macOS, Android and VxWorks: use ``\"utf-8\"`` by default." -msgstr "" +msgstr "macOS、Android、VxWorks: デフォルトで ``\"utf-8\"`` を使います。" -#: ../../c-api/init_config.rst:1407 msgid "" "On Windows: use ``\"utf-8\"`` by default, or ``\"mbcs\"`` if :c:member:" "`~PyPreConfig.legacy_windows_fs_encoding` of :c:type:`PyPreConfig` is non-" "zero." msgstr "" +"Windows: デフォルトで ``\"utf-8\"`` を使います。\n" +":c:type:`PyPreConfig` の :c:member:`~PyPreConfig.legacy_windows_fs_encoding` " +"がゼロ以外の場合は、``\"mbcs\"`` を使います。" -#: ../../c-api/init_config.rst:1411 msgid "Default encoding on other platforms:" -msgstr "" +msgstr "ほかのプラットフォームでのデフォルトのエンコーディング:" -#: ../../c-api/init_config.rst:1413 msgid "``\"utf-8\"`` if :c:member:`PyPreConfig.utf8_mode` is non-zero." -msgstr "" +msgstr ":c:member:`PyPreConfig.utf8_mode` がゼロ以外の場合は ``\"utf-8\"``。" -#: ../../c-api/init_config.rst:1414 msgid "" "``\"ascii\"`` if Python detects that ``nl_langinfo(CODESET)`` announces the " "ASCII encoding, whereas the ``mbstowcs()`` function decodes from a different " "encoding (usually Latin1)." msgstr "" +"``nl_langinfo(CODESET)`` が ASCII エンコーディングを返すのに、``mbstowcs()`` " +"が別のエンコーディング (通常は Latin1) からデコードすると Python が検出した場" +"合は ``\"ascii\"``。" -#: ../../c-api/init_config.rst:1417 msgid "``\"utf-8\"`` if ``nl_langinfo(CODESET)`` returns an empty string." -msgstr "" +msgstr "``nl_langinfo(CODESET)`` が空文字列を返す場合は ``\"utf-8\"``。" -#: ../../c-api/init_config.rst:1418 msgid "" "Otherwise, use the :term:`locale encoding`: ``nl_langinfo(CODESET)`` result." msgstr "" +"それ以外の場合は、``nl_langinfo(CODESET)`` の結果である :term:`ロケールエン" +"コーディング ` を使います。" -#: ../../c-api/init_config.rst:1421 msgid "" "At Python startup, the encoding name is normalized to the Python codec name. " "For example, ``\"ANSI_X3.4-1968\"`` is replaced with ``\"ascii\"``." msgstr "" +"Python の起動時に、エンコーディング名は Python のコーデック名に正規化されま" +"す。\n" +"例えば、``\"ANSI_X3.4-1968\"`` は ``\"ascii\"`` に置き換えられます。" -#: ../../c-api/init_config.rst:1424 msgid "See also the :c:member:`~PyConfig.filesystem_errors` member." -msgstr "" +msgstr ":c:member:`~PyConfig.filesystem_errors` メンバーも参照してください。" -#: ../../c-api/init_config.rst:1428 msgid "" ":term:`Filesystem error handler `: :" "func:`sys.getfilesystemencodeerrors`." msgstr "" +":term:`ファイルシステムのエラーハンドラー `。\n" +":func:`sys.getfilesystemencodeerrors` に対応します。" -#: ../../c-api/init_config.rst:1431 msgid "" "On Windows: use ``\"surrogatepass\"`` by default, or ``\"replace\"`` if :c:" "member:`~PyPreConfig.legacy_windows_fs_encoding` of :c:type:`PyPreConfig` is " "non-zero." msgstr "" +"Windows: デフォルトで ``\"surrogatepass\"`` を使います。\n" +":c:type:`PyPreConfig` の :c:member:`~PyPreConfig.legacy_windows_fs_encoding` " +"がゼロ以外の場合は、``\"replace\"`` を使います。" -#: ../../c-api/init_config.rst:1435 msgid "On other platforms: use ``\"surrogateescape\"`` by default." msgstr "" +"ほかのプラットフォーム: デフォルトで ``\"surrogateescape\"`` を使います。" -#: ../../c-api/init_config.rst:1437 msgid "Supported error handlers:" -msgstr "" +msgstr "サポートするエラーハンドラー:" #: ../../c-api/init_config.rst:1439 msgid "``\"strict\"``" -msgstr "" +msgstr "``\"strict\"``" #: ../../c-api/init_config.rst:1440 msgid "``\"surrogateescape\"``" -msgstr "" +msgstr "``\"surrogateescape\"``" -#: ../../c-api/init_config.rst:1441 msgid "``\"surrogatepass\"`` (only supported with the UTF-8 encoding)" -msgstr "" +msgstr "``\"surrogatepass\"`` (UTF-8 エンコーディングでのみサポート)" -#: ../../c-api/init_config.rst:1443 msgid "See also the :c:member:`~PyConfig.filesystem_encoding` member." -msgstr "" +msgstr ":c:member:`~PyConfig.filesystem_encoding` メンバーも参照してください。" -#: ../../c-api/init_config.rst:1447 msgid "If non-zero, use frozen modules." -msgstr "" +msgstr "ゼロ以外の場合、凍結モジュールを使います。" -#: ../../c-api/init_config.rst:1449 msgid "Set by the :envvar:`PYTHON_FROZEN_MODULES` environment variable." -msgstr "" +msgstr ":envvar:`PYTHON_FROZEN_MODULES` 環境変数によって設定されます。" -#: ../../c-api/init_config.rst:1451 msgid "" "Default: ``1`` in a release build, or ``0`` in a :ref:`debug build `." msgstr "" +"デフォルト: リリースビルドでは ``1``、:ref:`デバッグビルド ` で" +"は ``0``。" -#: ../../c-api/init_config.rst:1457 msgid "Randomized hash function seed." -msgstr "" +msgstr "ハッシュ関数のランダム化に使うシード。" -#: ../../c-api/init_config.rst:1459 msgid "" "If :c:member:`~PyConfig.use_hash_seed` is zero, a seed is chosen randomly at " "Python startup, and :c:member:`~PyConfig.hash_seed` is ignored." msgstr "" +":c:member:`~PyConfig.use_hash_seed` がゼロの場合、Python の起動時にシードをラ" +"ンダムに選び、:c:member:`~PyConfig.hash_seed` は無視します。" -#: ../../c-api/init_config.rst:1462 msgid "Set by the :envvar:`PYTHONHASHSEED` environment variable." -msgstr "" +msgstr ":envvar:`PYTHONHASHSEED` 環境変数によって設定されます。" -#: ../../c-api/init_config.rst:1464 msgid "" "Default *use_hash_seed* value: ``-1`` in Python mode, ``0`` in isolated mode." msgstr "" +"*use_hash_seed* のデフォルト値: Python モードでは ``-1``、隔離モードでは " +"``0``。" -#: ../../c-api/init_config.rst:1469 msgid "" "Set the default Python \"home\" directory, that is, the location of the " "standard Python libraries (see :envvar:`PYTHONHOME`)." msgstr "" +"Python の標準ライブラリの場所である、デフォルトの Python「home」ディレクトリ" +"を設定します (:envvar:`PYTHONHOME` を参照)。" -#: ../../c-api/init_config.rst:1472 msgid "Set by the :envvar:`PYTHONHOME` environment variable." -msgstr "" +msgstr ":envvar:`PYTHONHOME` 環境変数によって設定されます。" -#: ../../c-api/init_config.rst:1476 ../../c-api/init_config.rst:1612 -#: ../../c-api/init_config.rst:1632 ../../c-api/init_config.rst:1721 -#: ../../c-api/init_config.rst:1752 msgid "Part of the :ref:`Python Path Configuration ` input." -msgstr "" +msgstr ":ref:`Python のパス設定 ` の入力の一部です。" -#: ../../c-api/init_config.rst:1480 msgid "" "If ``1``, profile import time. If ``2``, include additional output that " "indicates when an imported module has already been loaded." msgstr "" +"``1`` の場合、インポート時間を計測します。\n" +"``2`` の場合、インポートするモジュールがすでにロードされていることを示す出力" +"も含めます。" -#: ../../c-api/init_config.rst:1484 msgid "" "Set by the :option:`-X importtime <-X>` option and the :envvar:" "`PYTHONPROFILEIMPORTTIME` environment variable." msgstr "" +":option:`-X importtime <-X>` オプションと :envvar:`PYTHONPROFILEIMPORTTIME` " +"環境変数によって設定されます。" -#: ../../c-api/init_config.rst:1491 msgid "Added support for ``import_time = 2``" -msgstr "" +msgstr "``import_time = 2`` をサポートするようになりました。" -#: ../../c-api/init_config.rst:1495 msgid "Enter interactive mode after executing a script or a command." -msgstr "" +msgstr "スクリプトまたはコマンドの実行後に、対話モードに入ります。" -#: ../../c-api/init_config.rst:1497 msgid "" "If greater than ``0``, enable inspect: when a script is passed as first " "argument or the -c option is used, enter interactive mode after executing " "the script or the command, even when :data:`sys.stdin` does not appear to be " "a terminal." msgstr "" +"``0`` より大きい場合、実行後の対話モードを有効にします。\n" +"最初の引数にスクリプトを指定した場合や ``-c`` オプションを使った場合、:data:" +"`sys.stdin` が端末でなくても、スクリプトやコマンドの実行後に対話モードに入り" +"ます。" -#: ../../c-api/init_config.rst:1502 msgid "" "Incremented by the :option:`-i` command line option. Set to ``1`` if the :" "envvar:`PYTHONINSPECT` environment variable is non-empty." msgstr "" +":option:`-i` コマンドラインオプションで値が増加します。\n" +":envvar:`PYTHONINSPECT` 環境変数が空でなければ ``1`` に設定されます。" -#: ../../c-api/init_config.rst:1509 msgid "Install Python signal handlers?" -msgstr "" +msgstr "Python のシグナルハンドラーを登録するかどうか。" -#: ../../c-api/init_config.rst:1511 ../../c-api/init_config.rst:1695 -#: ../../c-api/init_config.rst:1719 ../../c-api/init_config.rst:1955 msgid "Default: ``1`` in Python mode, ``0`` in isolated mode." -msgstr "" +msgstr "デフォルト: Python モードでは ``1``、隔離モードでは ``0``。" -#: ../../c-api/init_config.rst:1515 msgid "If greater than ``0``, enable the interactive mode (REPL)." -msgstr "" +msgstr "``0`` より大きい場合、対話モード (REPL) を有効にします。" -#: ../../c-api/init_config.rst:1517 msgid "Incremented by the :option:`-i` command line option." -msgstr "" +msgstr ":option:`-i` コマンドラインオプションで値が増加します。" -#: ../../c-api/init_config.rst:1523 msgid "" "Configures the :ref:`integer string conversion length limitation " "`. An initial value of ``-1`` means the value will be " @@ -2317,81 +2256,98 @@ msgid "" "limitation. Values greater than zero but less than 640 (:data:`sys.int_info." "str_digits_check_threshold`) are unsupported and will produce an error." msgstr "" +":ref:`整数と文字列の変換の長さ制限 ` を設定します。\n" +"初期値が ``-1`` の場合、コマンドラインや環境変数の値を使い、それらの指定がな" +"ければデフォルトの 4300 (:data:`sys.int_info.default_max_str_digits`) を使い" +"ます。\n" +"``0`` は制限を無効にします。\n" +"ゼロより大きく 640 (:data:`sys.int_info.str_digits_check_threshold`) 未満の値" +"はサポートされず、エラーになります。" -#: ../../c-api/init_config.rst:1531 msgid "" "Configured by the :option:`-X int_max_str_digits <-X>` command line flag or " "the :envvar:`PYTHONINTMAXSTRDIGITS` environment variable." msgstr "" +":option:`-X int_max_str_digits <-X>` コマンドラインフラグまたは :envvar:" +"`PYTHONINTMAXSTRDIGITS` 環境変数によって設定されます。" -#: ../../c-api/init_config.rst:1534 msgid "" "Default: ``-1`` in Python mode. 4300 (:data:`sys.int_info." "default_max_str_digits`) in isolated mode." msgstr "" +"デフォルト: Python モードでは ``-1``。\n" +"隔離モードでは 4300 (:data:`sys.int_info.default_max_str_digits`)。" -#: ../../c-api/init_config.rst:1541 msgid "" "If the value of :c:member:`~PyConfig.cpu_count` is not ``-1`` then it will " "override the return values of :func:`os.cpu_count`, :func:`os." "process_cpu_count`, and :func:`multiprocessing.cpu_count`." msgstr "" +":c:member:`~PyConfig.cpu_count` が ``-1`` でなければ、:func:`os.cpu_count`、:" +"func:`os.process_cpu_count`、:func:`multiprocessing.cpu_count` の戻り値を上書" +"きします。" -#: ../../c-api/init_config.rst:1545 msgid "" "Configured by the :samp:`-X cpu_count={n|default}` command line flag or the :" "envvar:`PYTHON_CPU_COUNT` environment variable." msgstr "" +":samp:`-X cpu_count={n|default}` コマンドラインフラグまたは :envvar:" +"`PYTHON_CPU_COUNT` 環境変数によって設定されます。" -#: ../../c-api/init_config.rst:1548 ../../c-api/init_config.rst:1909 msgid "Default: ``-1``." -msgstr "" +msgstr "デフォルト: ``-1``。" -#: ../../c-api/init_config.rst:1554 msgid "If greater than ``0``, enable isolated mode:" -msgstr "" +msgstr "``0`` より大きい場合、隔離モードを有効にします。" -#: ../../c-api/init_config.rst:1556 msgid "" "Set :c:member:`~PyConfig.safe_path` to ``1``: don't prepend a potentially " "unsafe path to :data:`sys.path` at Python startup, such as the current " "directory, the script's directory or an empty string." msgstr "" +":c:member:`~PyConfig.safe_path` を ``1`` に設定します。\n" +"これにより、Python の起動時に、現在のディレクトリ、スクリプトのディレクトリ、" +"空文字列など、安全でない可能性のあるパスを :data:`sys.path` の先頭に追加しま" +"せん。" -#: ../../c-api/init_config.rst:1560 msgid "" "Set :c:member:`~PyConfig.use_environment` to ``0``: ignore ``PYTHON`` " "environment variables." msgstr "" +":c:member:`~PyConfig.use_environment` を ``0`` に設定し、``PYTHON`` 環境変数" +"を無視します。" -#: ../../c-api/init_config.rst:1562 msgid "" "Set :c:member:`~PyConfig.user_site_directory` to ``0``: don't add the user " "site directory to :data:`sys.path`." msgstr "" +":c:member:`~PyConfig.user_site_directory` を ``0`` に設定し、ユーザーのサイト" +"ディレクトリを :data:`sys.path` に追加しません。" -#: ../../c-api/init_config.rst:1564 msgid "" "Python REPL doesn't import :mod:`readline` nor enable default readline " "configuration on interactive prompts." msgstr "" +"Python の REPL は :mod:`readline` をインポートせず、対話プロンプトのデフォル" +"トの readline 設定も有効にしません。" -#: ../../c-api/init_config.rst:1567 msgid "Set to ``1`` by the :option:`-I` command line option." -msgstr "" +msgstr ":option:`-I` コマンドラインオプションによって ``1`` に設定されます。" -#: ../../c-api/init_config.rst:1571 msgid "" "See also the :ref:`Isolated Configuration ` and :c:" "member:`PyPreConfig.isolated`." msgstr "" +":ref:`隔離設定 ` と :c:member:`PyPreConfig.isolated` も参" +"照してください。" -#: ../../c-api/init_config.rst:1576 msgid "" "If non-zero, use :class:`io.FileIO` instead of :class:`!io." "_WindowsConsoleIO` for :data:`sys.stdin`, :data:`sys.stdout` and :data:`sys." "stderr`." msgstr "" +"ゼロ以外の場合、:data:`sys.stdin`、:data:`sys.stdout`、:data:`sys.stderr` " +"に :class:`!io._WindowsConsoleIO` の代わりに :class:`io.FileIO` を使います。" #: ../../c-api/init_config.rst:1580 msgid "" @@ -2401,106 +2357,116 @@ msgstr "" ":envvar:`PYTHONLEGACYWINDOWSSTDIO` 環境変数が空でない文字列に設定された場合" "に、 ``1`` に設定されます。" -#: ../../c-api/init_config.rst:1588 msgid "See also the :pep:`528` (Change Windows console encoding to UTF-8)." msgstr "" +":pep:`528` (Change Windows console encoding to UTF-8) も参照してください。" -#: ../../c-api/init_config.rst:1592 msgid "" "If non-zero, dump statistics on :ref:`Python pymalloc memory allocator " "` at exit." msgstr "" +"ゼロ以外の場合、終了時に :ref:`Python の pymalloc メモリアロケーター " +"` の統計をダンプします。" -#: ../../c-api/init_config.rst:1595 msgid "Set to ``1`` by the :envvar:`PYTHONMALLOCSTATS` environment variable." -msgstr "" +msgstr ":envvar:`PYTHONMALLOCSTATS` 環境変数によって ``1`` に設定されます。" -#: ../../c-api/init_config.rst:1597 msgid "" "The option is ignored if Python is :option:`configured using the --without-" "pymalloc option <--without-pymalloc>`." msgstr "" +"Python を :option:`--without-pymalloc オプションで構成した <--without-" +"pymalloc>` 場合、このオプションは無視されます。" -#: ../../c-api/init_config.rst:1604 msgid "Platform library directory name: :data:`sys.platlibdir`." msgstr "" +"プラットフォーム固有のライブラリディレクトリの名前。\n" +":data:`sys.platlibdir` に対応します。" -#: ../../c-api/init_config.rst:1606 msgid "Set by the :envvar:`PYTHONPLATLIBDIR` environment variable." -msgstr "" +msgstr ":envvar:`PYTHONPLATLIBDIR` 環境変数によって設定されます。" -#: ../../c-api/init_config.rst:1608 msgid "" "Default: value of the ``PLATLIBDIR`` macro which is set by the :option:" "`configure --with-platlibdir option <--with-platlibdir>` (default: " "``\"lib\"``, or ``\"DLLs\"`` on Windows)." msgstr "" +"デフォルト: :option:`configure の --with-platlibdir オプション <--with-" +"platlibdir>` で設定される ``PLATLIBDIR`` マクロの値 (デフォルトは " +"``\"lib\"``、Windows では ``\"DLLs\"``)。" -#: ../../c-api/init_config.rst:1616 msgid "" "This macro is now used on Windows to locate the standard library extension " "modules, typically under ``DLLs``. However, for compatibility, note that " "this value is ignored for any non-standard layouts, including in-tree builds " "and virtual environments." msgstr "" +"このマクロは、Windows で標準ライブラリの拡張モジュールを探すために使われるよ" +"うになりました。\n" +"通常、拡張モジュールは ``DLLs`` にあります。\n" +"ただし、互換性のため、ソースツリー内のビルドや仮想環境など、標準以外のディレ" +"クトリ配置ではこの値を無視します。" -#: ../../c-api/init_config.rst:1625 msgid "" "Module search paths (:data:`sys.path`) as a string separated by ``DELIM`` (:" "data:`os.pathsep`)." msgstr "" +"モジュール検索パス (:data:`sys.path`) を、``DELIM`` (:data:`os.pathsep`) で区" +"切った文字列。" -#: ../../c-api/init_config.rst:1628 msgid "Set by the :envvar:`PYTHONPATH` environment variable." -msgstr "" +msgstr ":envvar:`PYTHONPATH` 環境変数によって設定されます。" -#: ../../c-api/init_config.rst:1637 msgid "Module search paths: :data:`sys.path`." msgstr "" +"モジュール検索パス。\n" +":data:`sys.path` に対応します。" -#: ../../c-api/init_config.rst:1639 msgid "" "If :c:member:`~PyConfig.module_search_paths_set` is equal to ``0``, :c:func:" "`Py_InitializeFromConfig` will replace :c:member:`~PyConfig." "module_search_paths` and sets :c:member:`~PyConfig.module_search_paths_set` " "to ``1``." msgstr "" +":c:member:`~PyConfig.module_search_paths_set` が ``0`` の場合、:c:func:" +"`Py_InitializeFromConfig` は :c:member:`~PyConfig.module_search_paths` を置き" +"換え、:c:member:`~PyConfig.module_search_paths_set` を ``1`` に設定します。" -#: ../../c-api/init_config.rst:1644 msgid "" "Default: empty list (``module_search_paths``) and ``0`` " "(``module_search_paths_set``)." msgstr "" +"デフォルト: ``module_search_paths`` は空のリスト、" +"``module_search_paths_set`` は ``0``。" -#: ../../c-api/init_config.rst:1651 msgid "Compilation optimization level:" -msgstr "" +msgstr "コンパイルの最適化レベル:" -#: ../../c-api/init_config.rst:1653 msgid "``0``: Peephole optimizer, set ``__debug__`` to ``True``." -msgstr "" +msgstr "``0``: のぞき穴最適化を行い、``__debug__`` を ``True`` に設定します。" -#: ../../c-api/init_config.rst:1654 msgid "``1``: Level 0, remove assertions, set ``__debug__`` to ``False``." msgstr "" +"``1``: レベル 0 に加えて、アサーションを削除し、``__debug__`` を ``False`` に" +"設定します。" -#: ../../c-api/init_config.rst:1655 msgid "``2``: Level 1, strip docstrings." -msgstr "" +msgstr "``2``: レベル 1 に加えて、docstring を削除します。" -#: ../../c-api/init_config.rst:1657 msgid "" "Incremented by the :option:`-O` command line option. Set to the :envvar:" "`PYTHONOPTIMIZE` environment variable value." msgstr "" +":option:`-O` コマンドラインオプションで値が増加します。\n" +":envvar:`PYTHONOPTIMIZE` 環境変数の値から設定されます。" -#: ../../c-api/init_config.rst:1664 msgid "" "The list of the original command line arguments passed to the Python " "executable: :data:`sys.orig_argv`." msgstr "" +"Python 実行ファイルに渡された、元のコマンドライン引数のリスト。\n" +":data:`sys.orig_argv` に対応します。" -#: ../../c-api/init_config.rst:1667 msgid "" "If :c:member:`~PyConfig.orig_argv` list is empty and :c:member:`~PyConfig." "argv` is not a list only containing an empty string, :c:func:`PyConfig_Read` " @@ -2508,82 +2474,94 @@ msgid "" "before modifying :c:member:`~PyConfig.argv` (if :c:member:`~PyConfig." "parse_argv` is non-zero)." msgstr "" +":c:member:`~PyConfig.orig_argv` のリストが空で、:c:member:`~PyConfig.argv` が" +"空文字列だけを含むリストでない場合、:c:func:`PyConfig_Read` は :c:member:" +"`~PyConfig.argv` を :c:member:`~PyConfig.orig_argv` にコピーします。\n" +"これは、:c:member:`~PyConfig.parse_argv` がゼロ以外の場合に :c:member:" +"`~PyConfig.argv` を変更する前に行われます。" -#: ../../c-api/init_config.rst:1674 msgid "" "See also the :c:member:`~PyConfig.argv` member and the :c:func:" "`Py_GetArgcArgv` function." msgstr "" +":c:member:`~PyConfig.argv` メンバーと :c:func:`Py_GetArgcArgv` 関数も参照して" +"ください。" -#: ../../c-api/init_config.rst:1677 ../../c-api/init_config.rst:1990 -#: ../../c-api/init_config.rst:2009 msgid "Default: empty list." -msgstr "" +msgstr "デフォルト: 空のリスト。" -#: ../../c-api/init_config.rst:1683 msgid "Parse command line arguments?" -msgstr "" +msgstr "コマンドライン引数を解析するかどうか。" -#: ../../c-api/init_config.rst:1685 msgid "" "If equals to ``1``, parse :c:member:`~PyConfig.argv` the same way the " "regular Python parses :ref:`command line arguments `, and " "strip Python arguments from :c:member:`~PyConfig.argv`." msgstr "" +"``1`` の場合、通常の Python が :ref:`コマンドライン引数 ` " +"を解析するのと同じように :c:member:`~PyConfig.argv` を解析し、Python 自体への" +"引数を :c:member:`~PyConfig.argv` から取り除きます。" -#: ../../c-api/init_config.rst:1697 msgid "" "The :c:member:`PyConfig.argv` arguments are now only parsed if :c:member:" "`PyConfig.parse_argv` equals to ``1``." msgstr "" +":c:member:`PyConfig.argv` の引数は、:c:member:`PyConfig.parse_argv` が ``1`` " +"の場合にのみ解析されるようになりました。" -#: ../../c-api/init_config.rst:1703 msgid "" "Parser debug mode. If greater than ``0``, turn on parser debugging output " "(for expert only, depending on compilation options)." msgstr "" +"パーサーのデバッグモード。\n" +"``0`` より大きい場合、パーサーのデバッグ出力を有効にします (専門家向けで、コ" +"ンパイルオプションに依存します)。" -#: ../../c-api/init_config.rst:1706 msgid "" "Incremented by the :option:`-d` command line option. Set to the :envvar:" "`PYTHONDEBUG` environment variable value." msgstr "" +":option:`-d` コマンドラインオプションで値が増加します。\n" +":envvar:`PYTHONDEBUG` 環境変数の値から設定されます。" -#: ../../c-api/init_config.rst:1709 ../../c-api/init_config.rst:1814 msgid "" "Needs a :ref:`debug build of Python ` (the ``Py_DEBUG`` macro " "must be defined)." msgstr "" +":ref:`Python のデバッグビルド ` が必要です (``Py_DEBUG`` マクロ" +"を定義する必要があります)。" -#: ../../c-api/init_config.rst:1716 msgid "" "If non-zero, calculation of path configuration is allowed to log warnings " "into ``stderr``. If equals to ``0``, suppress these warnings." msgstr "" +"ゼロ以外の場合、パス設定の計算中に ``stderr`` に警告を出せます。\n" +"``0`` の場合は、これらの警告を抑制します。" -#: ../../c-api/init_config.rst:1723 msgid "Now also applies on Windows." -msgstr "" +msgstr "Windows にも適用されるようになりました。" -#: ../../c-api/init_config.rst:1728 msgid "" "The site-specific directory prefix where the platform independent Python " "files are installed: :data:`sys.prefix`." msgstr "" +"プラットフォームに依存しない Python のファイルをインストールする、サイト固有" +"のディレクトリのプレフィックス。\n" +":data:`sys.prefix` に対応します。" -#: ../../c-api/init_config.rst:1735 msgid "See also :c:member:`PyConfig.base_prefix`." -msgstr "" +msgstr ":c:member:`PyConfig.base_prefix` も参照してください。" -#: ../../c-api/init_config.rst:1739 msgid "" "Program name used to initialize :c:member:`~PyConfig.executable` and in " "early error messages during Python initialization." msgstr "" +":c:member:`~PyConfig.executable` の初期化と、Python の初期化の初期段階でのエ" +"ラーメッセージに使うプログラム名。" -#: ../../c-api/init_config.rst:1742 msgid "On macOS, use :envvar:`PYTHONEXECUTABLE` environment variable if set." msgstr "" +"macOS では、設定されていれば :envvar:`PYTHONEXECUTABLE` 環境変数を使います。" #: ../../c-api/init_config.rst:1743 msgid "" @@ -2591,71 +2569,78 @@ msgid "" "`__PYVENV_LAUNCHER__` environment variable if set." msgstr "" -#: ../../c-api/init_config.rst:1745 msgid "" "Use ``argv[0]`` of :c:member:`~PyConfig.argv` if available and non-empty." msgstr "" +":c:member:`~PyConfig.argv` の ``argv[0]`` が存在し空でなければ、それを使いま" +"す。" -#: ../../c-api/init_config.rst:1747 msgid "" "Otherwise, use ``L\"python\"`` on Windows, or ``L\"python3\"`` on other " "platforms." msgstr "" +"それ以外の場合、Windows では ``L\"python\"``、ほかのプラットフォームでは " +"``L\"python3\"`` を使います。" -#: ../../c-api/init_config.rst:1756 msgid "" "Directory where cached ``.pyc`` files are written: :data:`sys." "pycache_prefix`." msgstr "" +"キャッシュされた ``.pyc`` ファイルを書き込むディレクトリ。\n" +":data:`sys.pycache_prefix` に対応します。" -#: ../../c-api/init_config.rst:1759 msgid "" "Set by the :option:`-X pycache_prefix=PATH <-X>` command line option and " "the :envvar:`PYTHONPYCACHEPREFIX` environment variable. The command-line " "option takes precedence." msgstr "" +":option:`-X pycache_prefix=PATH <-X>` コマンドラインオプションと :envvar:" +"`PYTHONPYCACHEPREFIX` 環境変数によって設定されます。\n" +"コマンドラインオプションが優先されます。" -#: ../../c-api/init_config.rst:1763 msgid "If ``NULL``, :data:`sys.pycache_prefix` is set to ``None``." msgstr "" +"``NULL`` の場合、:data:`sys.pycache_prefix` は ``None`` に設定されます。" -#: ../../c-api/init_config.rst:1769 msgid "" "Quiet mode. If greater than ``0``, don't display the copyright and version " "at Python startup in interactive mode." msgstr "" +"静粛モード。\n" +"``0`` より大きい場合、対話モードでの Python の起動時に著作権とバージョンを表" +"示しません。" -#: ../../c-api/init_config.rst:1772 msgid "Incremented by the :option:`-q` command line option." -msgstr "" +msgstr ":option:`-q` コマンドラインオプションで値が増加します。" -#: ../../c-api/init_config.rst:1778 msgid "Value of the :option:`-c` command line option." -msgstr "" +msgstr ":option:`-c` コマンドラインオプションの値。" -#: ../../c-api/init_config.rst:1780 ../../c-api/init_config.rst:1801 msgid "Used by :c:func:`Py_RunMain`." -msgstr "" +msgstr ":c:func:`Py_RunMain` が使います。" -#: ../../c-api/init_config.rst:1786 msgid "" "Filename passed on the command line: trailing command line argument without :" "option:`-c` or :option:`-m`. It is used by the :c:func:`Py_RunMain` function." msgstr "" +"コマンドラインで渡されたファイル名。\n" +":option:`-c` や :option:`-m` がない場合の、オプションの後のコマンドライン引数" +"です。\n" +":c:func:`Py_RunMain` が使います。" -#: ../../c-api/init_config.rst:1790 msgid "" "For example, it is set to ``script.py`` by the ``python3 script.py arg`` " "command line." msgstr "" +"例えば、``python3 script.py arg`` というコマンドラインでは ``script.py`` に設" +"定されます。" -#: ../../c-api/init_config.rst:1793 msgid "See also the :c:member:`PyConfig.skip_source_first_line` option." msgstr "" +":c:member:`PyConfig.skip_source_first_line` オプションも参照してください。" -#: ../../c-api/init_config.rst:1799 msgid "Value of the :option:`-m` command line option." -msgstr "" +msgstr ":option:`-m` コマンドラインオプションの値。" #: ../../c-api/init_config.rst:1807 msgid "" @@ -2670,225 +2655,229 @@ msgid "" "takes precedence." msgstr "" -#: ../../c-api/init_config.rst:1821 msgid "" "Show total reference count at exit (excluding :term:`immortal` objects)?" msgstr "" +"終了時に参照カウントの合計を表示するかどうか (:term:`不死 ` オブ" +"ジェクトを除く)。" -#: ../../c-api/init_config.rst:1823 msgid "Set to ``1`` by :option:`-X showrefcount <-X>` command line option." msgstr "" +":option:`-X showrefcount <-X>` コマンドラインオプションによって ``1`` に設定" +"されます。" -#: ../../c-api/init_config.rst:1825 msgid "" "Needs a :ref:`debug build of Python ` (the ``Py_REF_DEBUG`` " "macro must be defined)." msgstr "" +":ref:`Python のデバッグビルド ` が必要です (``Py_REF_DEBUG`` マ" +"クロを定義する必要があります)。" -#: ../../c-api/init_config.rst:1832 msgid "Import the :mod:`site` module at startup?" -msgstr "" +msgstr "起動時に :mod:`site` モジュールをインポートするかどうか。" -#: ../../c-api/init_config.rst:1834 msgid "" "If equal to zero, disable the import of the module site and the site-" "dependent manipulations of :data:`sys.path` that it entails." msgstr "" +"ゼロの場合、``site`` モジュールのインポートと、それに伴うサイト固有の :data:" +"`sys.path` の操作を無効にします。" -#: ../../c-api/init_config.rst:1837 msgid "" "Also disable these manipulations if the :mod:`site` module is explicitly " "imported later (call :func:`site.main` if you want them to be triggered)." msgstr "" +"後で :mod:`site` モジュールを明示的にインポートしても、これらの操作は行われま" +"せん。\n" +"行いたい場合は :func:`site.main` を呼び出してください。" -#: ../../c-api/init_config.rst:1840 msgid "Set to ``0`` by the :option:`-S` command line option." -msgstr "" +msgstr ":option:`-S` コマンドラインオプションによって ``0`` に設定されます。" -#: ../../c-api/init_config.rst:1842 msgid "" ":data:`sys.flags.no_site ` is set to the inverted value of :c:" "member:`~PyConfig.site_import`." msgstr "" +":data:`sys.flags.no_site ` は、:c:member:`~PyConfig.site_import` " +"の値を反転した値に設定されます。" -#: ../../c-api/init_config.rst:1849 msgid "" "If non-zero, skip the first line of the :c:member:`PyConfig.run_filename` " "source." msgstr "" +"ゼロ以外の場合、:c:member:`PyConfig.run_filename` のソースの先頭行を読み飛ば" +"します。" -#: ../../c-api/init_config.rst:1852 msgid "" "It allows the usage of non-Unix forms of ``#!cmd``. This is intended for a " "DOS specific hack only." msgstr "" +"Unix 以外の形式の ``#!cmd`` を使えるようにします。\n" +"DOS 固有の回避策だけを想定したものです。" -#: ../../c-api/init_config.rst:1855 msgid "Set to ``1`` by the :option:`-x` command line option." -msgstr "" +msgstr ":option:`-x` コマンドラインオプションによって ``1`` に設定されます。" -#: ../../c-api/init_config.rst:1862 msgid "" "Encoding and encoding errors of :data:`sys.stdin`, :data:`sys.stdout` and :" "data:`sys.stderr` (but :data:`sys.stderr` always uses " "``\"backslashreplace\"`` error handler)." msgstr "" +":data:`sys.stdin`、:data:`sys.stdout`、:data:`sys.stderr` のエンコーディング" +"とエラーハンドラー。\n" +"ただし、:data:`sys.stderr` は常に ``\"backslashreplace\"`` エラーハンドラーを" +"使います。" -#: ../../c-api/init_config.rst:1866 msgid "" "Use the :envvar:`PYTHONIOENCODING` environment variable if it is non-empty." -msgstr "" +msgstr ":envvar:`PYTHONIOENCODING` 環境変数が空でなければ、その値を使います。" -#: ../../c-api/init_config.rst:1869 msgid "Default encoding:" -msgstr "" +msgstr "デフォルトのエンコーディング:" -#: ../../c-api/init_config.rst:1871 msgid "``\"UTF-8\"`` if :c:member:`PyPreConfig.utf8_mode` is non-zero." -msgstr "" +msgstr ":c:member:`PyPreConfig.utf8_mode` がゼロ以外の場合は ``\"UTF-8\"``。" -#: ../../c-api/init_config.rst:1872 msgid "Otherwise, use the :term:`locale encoding`." msgstr "" +"それ以外の場合は :term:`ロケールエンコーディング ` を使いま" +"す。" -#: ../../c-api/init_config.rst:1874 msgid "Default error handler:" -msgstr "" +msgstr "デフォルトのエラーハンドラー:" -#: ../../c-api/init_config.rst:1876 msgid "On Windows: use ``\"surrogateescape\"``." -msgstr "" +msgstr "Windows: ``\"surrogateescape\"`` を使います。" -#: ../../c-api/init_config.rst:1877 msgid "" "``\"surrogateescape\"`` if :c:member:`PyPreConfig.utf8_mode` is non-zero, or " "if the LC_CTYPE locale is \"C\" or \"POSIX\"." msgstr "" +":c:member:`PyPreConfig.utf8_mode` がゼロ以外の場合、または LC_CTYPE ロケール" +"が \"C\" か \"POSIX\" の場合は ``\"surrogateescape\"``。" -#: ../../c-api/init_config.rst:1879 msgid "``\"strict\"`` otherwise." -msgstr "" +msgstr "それ以外の場合は ``\"strict\"``。" -#: ../../c-api/init_config.rst:1881 msgid "See also :c:member:`PyConfig.legacy_windows_stdio`." -msgstr "" +msgstr ":c:member:`PyConfig.legacy_windows_stdio` も参照してください。" -#: ../../c-api/init_config.rst:1885 msgid "Enable tracemalloc?" -msgstr "" +msgstr "tracemalloc を有効にするかどうか。" -#: ../../c-api/init_config.rst:1887 msgid "If non-zero, call :func:`tracemalloc.start` at startup." -msgstr "" +msgstr "ゼロ以外の場合、起動時に :func:`tracemalloc.start` を呼び出します。" -#: ../../c-api/init_config.rst:1889 msgid "" "Set by :option:`-X tracemalloc=N <-X>` command line option and by the :" "envvar:`PYTHONTRACEMALLOC` environment variable." msgstr "" +":option:`-X tracemalloc=N <-X>` コマンドラインオプションと :envvar:" +"`PYTHONTRACEMALLOC` 環境変数によって設定されます。" -#: ../../c-api/init_config.rst:1896 msgid "Enable the Linux ``perf`` profiler support?" -msgstr "" +msgstr "Linux の ``perf`` プロファイラーへの対応を有効にするかどうか。" -#: ../../c-api/init_config.rst:1898 msgid "If equals to ``1``, enable support for the Linux ``perf`` profiler." -msgstr "" +msgstr "``1`` の場合、Linux の ``perf`` プロファイラーへの対応を有効にします。" -#: ../../c-api/init_config.rst:1900 msgid "" "If equals to ``2``, enable support for the Linux ``perf`` profiler with " "DWARF JIT support." msgstr "" +"``2`` の場合、DWARF JIT に対応する方式で Linux の ``perf`` プロファイラーへの" +"対応を有効にします。" -#: ../../c-api/init_config.rst:1903 msgid "" "Set to ``1`` by :option:`-X perf <-X>` command-line option and the :envvar:" "`PYTHONPERFSUPPORT` environment variable." msgstr "" +":option:`-X perf <-X>` コマンドラインオプションと :envvar:" +"`PYTHONPERFSUPPORT` 環境変数によって ``1`` に設定されます。" -#: ../../c-api/init_config.rst:1906 msgid "" "Set to ``2`` by the :option:`-X perf_jit <-X>` command-line option and the :" "envvar:`PYTHON_PERF_JIT_SUPPORT` environment variable." msgstr "" +":option:`-X perf_jit <-X>` コマンドラインオプションと :envvar:" +"`PYTHON_PERF_JIT_SUPPORT` 環境変数によって ``2`` に設定されます。" -#: ../../c-api/init_config.rst:1912 msgid "See :ref:`perf_profiling` for more information." -msgstr "" +msgstr "詳しくは :ref:`perf_profiling` を参照してください。" -#: ../../c-api/init_config.rst:1918 msgid "Directory of the Python standard library." -msgstr "" +msgstr "Python の標準ライブラリのディレクトリ。" -#: ../../c-api/init_config.rst:1926 msgid "Use :ref:`environment variables `?" -msgstr "" +msgstr ":ref:`環境変数 ` を使うかどうか。" -#: ../../c-api/init_config.rst:1928 msgid "" "If equals to zero, ignore the :ref:`environment variables `." -msgstr "" +msgstr "ゼロの場合、:ref:`環境変数 ` を無視します。" -#: ../../c-api/init_config.rst:1931 msgid "Set to ``0`` by the :option:`-E` environment variable." -msgstr "" +msgstr ":option:`-E` コマンドラインオプションによって ``0`` に設定されます。" -#: ../../c-api/init_config.rst:1937 msgid "" "If non-zero, ``stdout`` and ``stderr`` will be redirected to the system log." msgstr "" +"ゼロ以外の場合、``stdout`` と ``stderr`` をシステムログにリダイレクトします。" -#: ../../c-api/init_config.rst:1940 msgid "Only available on macOS 10.12 and later, and on iOS." -msgstr "" +msgstr "macOS 10.12 以降と iOS でのみ利用できます。" -#: ../../c-api/init_config.rst:1942 msgid "" "Default: ``0`` (don't use the system log) on macOS; ``1`` on iOS (use the " "system log)." msgstr "" +"デフォルト: macOS では ``0`` (システムログを使わない)、iOS では ``1`` (システ" +"ムログを使う)。" -#: ../../c-api/init_config.rst:1949 msgid "If non-zero, add the user site directory to :data:`sys.path`." msgstr "" +"ゼロ以外の場合、ユーザーのサイトディレクトリを :data:`sys.path` に追加しま" +"す。" -#: ../../c-api/init_config.rst:1951 msgid "Set to ``0`` by the :option:`-s` and :option:`-I` command line options." msgstr "" +":option:`-s` と :option:`-I` コマンドラインオプションによって ``0`` に設定さ" +"れます。" -#: ../../c-api/init_config.rst:1953 msgid "Set to ``0`` by the :envvar:`PYTHONNOUSERSITE` environment variable." -msgstr "" +msgstr ":envvar:`PYTHONNOUSERSITE` 環境変数によって ``0`` に設定されます。" -#: ../../c-api/init_config.rst:1959 msgid "" "Verbose mode. If greater than ``0``, print a message each time a module is " "imported, showing the place (filename or built-in module) from which it is " "loaded." msgstr "" +"詳細表示モード。\n" +"``0`` より大きい場合、モジュールをインポートするたびに、ロード元の場所 (ファ" +"イル名または組み込みモジュール) を示すメッセージを表示します。" -#: ../../c-api/init_config.rst:1963 msgid "" "If greater than or equal to ``2``, print a message for each file that is " "checked for when searching for a module. Also provides information on module " "cleanup at exit." msgstr "" +"``2`` 以上の場合、モジュールを探す際に確認するファイルごとにメッセージを表示" +"します。\n" +"終了時のモジュールの後始末に関する情報も表示します。" -#: ../../c-api/init_config.rst:1967 msgid "Incremented by the :option:`-v` command line option." -msgstr "" +msgstr ":option:`-v` コマンドラインオプションで値が増加します。" -#: ../../c-api/init_config.rst:1969 msgid "Set by the :envvar:`PYTHONVERBOSE` environment variable value." -msgstr "" +msgstr ":envvar:`PYTHONVERBOSE` 環境変数の値から設定されます。" -#: ../../c-api/init_config.rst:1975 msgid "" "Options of the :mod:`warnings` module to build warnings filters, lowest to " "highest priority: :data:`sys.warnoptions`." msgstr "" +":mod:`warnings` モジュールが警告フィルターを作成するためのオプションで、優先" +"度の低いものから高いものの順に並びます。\n" +":data:`sys.warnoptions` に対応します。" #: ../../c-api/init_config.rst:1978 msgid "" @@ -2897,80 +2886,90 @@ msgid "" "of :data:`warnings.filters` which is checked first (highest priority)." msgstr "" -#: ../../c-api/init_config.rst:1983 msgid "" "The :option:`-W` command line options adds its value to :c:member:`~PyConfig." "warnoptions`, it can be used multiple times." msgstr "" +":option:`-W` コマンドラインオプションは、その値を :c:member:`~PyConfig." +"warnoptions` に追加します。\n" +"複数回指定できます。" -#: ../../c-api/init_config.rst:1986 msgid "" "The :envvar:`PYTHONWARNINGS` environment variable can also be used to add " "warning options. Multiple options can be specified, separated by commas (``," "``)." msgstr "" +":envvar:`PYTHONWARNINGS` 環境変数でも警告オプションを追加できます。\n" +"カンマ (``,``) で区切ることで、複数のオプションを指定できます。" -#: ../../c-api/init_config.rst:1994 msgid "" "If equal to ``0``, Python won't try to write ``.pyc`` files on the import of " "source modules." msgstr "" +"``0`` の場合、Python はソースモジュールのインポート時に ``.pyc`` ファイルを書" +"き込もうとしません。" -#: ../../c-api/init_config.rst:1997 msgid "" "Set to ``0`` by the :option:`-B` command line option and the :envvar:" "`PYTHONDONTWRITEBYTECODE` environment variable." msgstr "" +":option:`-B` コマンドラインオプションと :envvar:`PYTHONDONTWRITEBYTECODE` 環" +"境変数によって ``0`` に設定されます。" -#: ../../c-api/init_config.rst:2000 msgid "" ":data:`sys.dont_write_bytecode` is initialized to the inverted value of :c:" "member:`~PyConfig.write_bytecode`." msgstr "" +":data:`sys.dont_write_bytecode` は、:c:member:`~PyConfig.write_bytecode` の値" +"を反転した値で初期化されます。" -#: ../../c-api/init_config.rst:2007 msgid "Values of the :option:`-X` command line options: :data:`sys._xoptions`." msgstr "" +":option:`-X` コマンドラインオプションの値。\n" +":data:`sys._xoptions` に対応します。" -#: ../../c-api/init_config.rst:2013 msgid "If non-zero, write performance statistics at Python exit." -msgstr "" +msgstr "ゼロ以外の場合、Python の終了時に性能統計を書き出します。" -#: ../../c-api/init_config.rst:2015 msgid "" "Need a special build with the ``Py_STATS`` macro: see :option:`--enable-" "pystats`." msgstr "" +"``Py_STATS`` マクロを定義した特別なビルドが必要です。\n" +":option:`--enable-pystats` を参照してください。" -#: ../../c-api/init_config.rst:2020 msgid "" "If :c:member:`~PyConfig.parse_argv` is non-zero, :c:member:`~PyConfig.argv` " "arguments are parsed the same way the regular Python parses :ref:`command " "line arguments `, and Python arguments are stripped from :" "c:member:`~PyConfig.argv`." msgstr "" +":c:member:`~PyConfig.parse_argv` がゼロ以外の場合、通常の Python が :ref:`コ" +"マンドライン引数 ` を解析するのと同じように :c:member:" +"`~PyConfig.argv` の引数を解析し、Python 自体への引数を :c:member:`~PyConfig." +"argv` から取り除きます。" -#: ../../c-api/init_config.rst:2025 msgid "" "The :c:member:`~PyConfig.xoptions` options are parsed to set other options: " "see the :option:`-X` command line option." msgstr "" +":c:member:`~PyConfig.xoptions` のオプションを解析して、ほかのオプションを設定" +"します。\n" +":option:`-X` コマンドラインオプションを参照してください。" -#: ../../c-api/init_config.rst:2030 msgid "The ``show_alloc_count`` field has been removed." -msgstr "" +msgstr "``show_alloc_count`` フィールドが削除されました。" -#: ../../c-api/init_config.rst:2036 msgid "Initialization with PyConfig" -msgstr "" +msgstr "PyConfig による初期化" -#: ../../c-api/init_config.rst:2038 msgid "" "Initializing the interpreter from a populated configuration struct is " "handled by calling :c:func:`Py_InitializeFromConfig`." msgstr "" +"値を設定した構造体からインタープリタを初期化するには、:c:func:" +"`Py_InitializeFromConfig` を呼び出します。" -#: ../../c-api/init_config.rst:2044 msgid "" "If :c:func:`PyImport_FrozenModules`, :c:func:`PyImport_AppendInittab` or :c:" "func:`PyImport_ExtendInittab` are used, they must be set or called after " @@ -2978,18 +2977,23 @@ msgid "" "initialized multiple times, :c:func:`PyImport_AppendInittab` or :c:func:" "`PyImport_ExtendInittab` must be called before each Python initialization." msgstr "" +":c:func:`PyImport_FrozenModules`、:c:func:`PyImport_AppendInittab`、:c:func:" +"`PyImport_ExtendInittab` を使う場合は、Python の事前初期化の後、本初期化の前" +"に設定または呼び出す必要があります。\n" +"Python を複数回初期化する場合は、初期化のたびに、その前に :c:func:" +"`PyImport_AppendInittab` または :c:func:`PyImport_ExtendInittab` を呼び出さな" +"ければなりません。" -#: ../../c-api/init_config.rst:2051 msgid "" "The current configuration (``PyConfig`` type) is stored in " "``PyInterpreterState.config``." msgstr "" +"現在の設定 (``PyConfig`` 型) は、``PyInterpreterState.config`` に保存されま" +"す。" -#: ../../c-api/init_config.rst:2054 msgid "Example setting the program name::" -msgstr "" +msgstr "プログラム名を設定する例です。 ::" -#: ../../c-api/init_config.rst:2056 msgid "" "void init_python(void)\n" "{\n" @@ -3017,8 +3021,33 @@ msgid "" " Py_ExitStatusException(status);\n" "}" msgstr "" +"void init_python(void)\n" +"{\n" +" PyStatus status;\n" +"\n" +" PyConfig config;\n" +" PyConfig_InitPythonConfig(&config);\n" +"\n" +" /* プログラム名を設定する。\n" +" Python を暗黙に事前初期化する。 */\n" +" status = PyConfig_SetString(&config, &config.program_name,\n" +" L\"/path/to/my_program\");\n" +" if (PyStatus_Exception(status)) {\n" +" goto exception;\n" +" }\n" +"\n" +" status = Py_InitializeFromConfig(&config);\n" +" if (PyStatus_Exception(status)) {\n" +" goto exception;\n" +" }\n" +" PyConfig_Clear(&config);\n" +" return;\n" +"\n" +"exception:\n" +" PyConfig_Clear(&config);\n" +" Py_ExitStatusException(status);\n" +"}" -#: ../../c-api/init_config.rst:2082 msgid "" "More complete example modifying the default configuration, read the " "configuration, and then override some parameters. Note that since 3.11, many " @@ -3026,6 +3055,11 @@ msgid "" "read from the configuration structure. Any values set before initialize is " "called will be left unchanged by initialization::" msgstr "" +"デフォルトの設定を変更してから設定を読み込み、さらに一部のパラメーターを上書" +"きする、より完全な例です。\n" +"3.11 以降、多くのパラメーターは初期化するまで計算されないため、設定構造体から" +"値を読み取れないことに注意してください。\n" +"初期化関数の呼び出し前に設定された値は、初期化によって変更されません。 ::" #: ../../c-api/init_config.rst:2089 msgid "" @@ -3082,48 +3116,57 @@ msgid "" "}" msgstr "" -#: ../../c-api/init_config.rst:2145 msgid "Isolated Configuration" -msgstr "" +msgstr "隔離設定" -#: ../../c-api/init_config.rst:2147 msgid "" ":c:func:`PyPreConfig_InitIsolatedConfig` and :c:func:" "`PyConfig_InitIsolatedConfig` functions create a configuration to isolate " "Python from the system. For example, to embed Python into an application." msgstr "" +":c:func:`PyPreConfig_InitIsolatedConfig` と :c:func:" +"`PyConfig_InitIsolatedConfig` は、Python をシステムから隔離する設定を作成しま" +"す。\n" +"例えば、Python をアプリケーションに組み込むために使います。" -#: ../../c-api/init_config.rst:2152 msgid "" "This configuration ignores global configuration variables, environment " "variables, command line arguments (:c:member:`PyConfig.argv` is not parsed) " "and user site directory. The C standard streams (ex: ``stdout``) and the " "LC_CTYPE locale are left unchanged. Signal handlers are not installed." msgstr "" +"この設定は、グローバルな設定変数、環境変数、コマンドライン引数、ユーザーのサ" +"イトディレクトリを無視します (:c:member:`PyConfig.argv` は解析しません)。\n" +"``stdout`` などの C の標準ストリームと LC_CTYPE ロケールは変更しません。\n" +"シグナルハンドラーも登録しません。" -#: ../../c-api/init_config.rst:2157 msgid "" "Configuration files are still used with this configuration to determine " "paths that are unspecified. Ensure :c:member:`PyConfig.home` is specified to " "avoid computing the default path configuration." msgstr "" +"この設定でも、指定されていないパスを決めるために設定ファイルを使います。\n" +"デフォルトのパス設定の計算を避けるには、:c:member:`PyConfig.home` を必ず指定" +"してください。" -#: ../../c-api/init_config.rst:2165 msgid "Python Configuration" -msgstr "" +msgstr "Python 設定" -#: ../../c-api/init_config.rst:2167 msgid "" ":c:func:`PyPreConfig_InitPythonConfig` and :c:func:" "`PyConfig_InitPythonConfig` functions create a configuration to build a " "customized Python which behaves as the regular Python." msgstr "" +":c:func:`PyPreConfig_InitPythonConfig` と :c:func:" +"`PyConfig_InitPythonConfig` は、通常の Python と同じように動作する、カスタマ" +"イズされた Python を作るための設定を作成します。" -#: ../../c-api/init_config.rst:2171 msgid "" "Environments variables and command line arguments are used to configure " "Python, whereas global configuration variables are ignored." msgstr "" +"Python の設定には環境変数とコマンドライン引数を使いますが、グローバルな設定変" +"数は無視します。" #: ../../c-api/init_config.rst:2174 msgid "" @@ -3132,62 +3175,59 @@ msgid "" "`PYTHONUTF8` and :envvar:`PYTHONCOERCECLOCALE` environment variables." msgstr "" -#: ../../c-api/init_config.rst:2183 msgid "Python Path Configuration" -msgstr "" +msgstr "Python のパス設定" -#: ../../c-api/init_config.rst:2185 msgid ":c:type:`PyConfig` contains multiple fields for the path configuration:" -msgstr "" +msgstr ":c:type:`PyConfig` には、パス設定のための複数のフィールドがあります。" -#: ../../c-api/init_config.rst:2187 msgid "Path configuration inputs:" -msgstr "" +msgstr "パス設定の入力:" #: ../../c-api/init_config.rst:2189 msgid ":c:member:`PyConfig.home`" -msgstr "" +msgstr ":c:member:`PyConfig.home`" #: ../../c-api/init_config.rst:2190 msgid ":c:member:`PyConfig.platlibdir`" -msgstr "" +msgstr ":c:member:`PyConfig.platlibdir`" #: ../../c-api/init_config.rst:2191 msgid ":c:member:`PyConfig.pathconfig_warnings`" -msgstr "" +msgstr ":c:member:`PyConfig.pathconfig_warnings`" #: ../../c-api/init_config.rst:2192 msgid ":c:member:`PyConfig.program_name`" -msgstr "" +msgstr ":c:member:`PyConfig.program_name`" #: ../../c-api/init_config.rst:2193 msgid ":c:member:`PyConfig.pythonpath_env`" -msgstr "" +msgstr ":c:member:`PyConfig.pythonpath_env`" -#: ../../c-api/init_config.rst:2194 msgid "current working directory: to get absolute paths" -msgstr "" +msgstr "現在の作業ディレクトリ: 絶対パスの取得に使います。" -#: ../../c-api/init_config.rst:2195 msgid "" "``PATH`` environment variable to get the program full path (from :c:member:" "`PyConfig.program_name`)" msgstr "" +"``PATH`` 環境変数: :c:member:`PyConfig.program_name` からプログラムの完全なパ" +"スを取得するために使います。" -#: ../../c-api/init_config.rst:2197 msgid "``__PYVENV_LAUNCHER__`` environment variable" -msgstr "" +msgstr "``__PYVENV_LAUNCHER__`` 環境変数" -#: ../../c-api/init_config.rst:2198 msgid "" "(Windows only) Application paths in the registry under " "\"Software\\Python\\PythonCore\\X.Y\\PythonPath\" of HKEY_CURRENT_USER and " "HKEY_LOCAL_MACHINE (where X.Y is the Python version)." msgstr "" +"Windows のみ: レジストリの HKEY_CURRENT_USER と HKEY_LOCAL_MACHINE の " +"\"Software\\Python\\PythonCore\\X.Y\\PythonPath\" にあるアプリケーションのパ" +"ス (X.Y は Python のバージョン)。" -#: ../../c-api/init_config.rst:2202 msgid "Path configuration output fields:" -msgstr "" +msgstr "パス設定の出力フィールド:" #: ../../c-api/init_config.rst:2204 msgid ":c:member:`PyConfig.base_exec_prefix`" @@ -3221,7 +3261,6 @@ msgstr "" msgid ":c:member:`PyConfig.prefix`" msgstr ":c:member:`PyConfig.prefix`" -#: ../../c-api/init_config.rst:2213 msgid "" "If at least one \"output field\" is not set, Python calculates the path " "configuration to fill unset fields. If :c:member:`~PyConfig." @@ -3229,6 +3268,11 @@ msgid "" "module_search_paths` is overridden and :c:member:`~PyConfig." "module_search_paths_set` is set to ``1``." msgstr "" +"「出力フィールド」が 1 つでも未設定なら、Python はパス設定を計算して未設定の" +"フィールドを埋めます。\n" +":c:member:`~PyConfig.module_search_paths_set` が ``0`` の場合は、:c:member:" +"`~PyConfig.module_search_paths` を上書きし、:c:member:`~PyConfig." +"module_search_paths_set` を ``1`` に設定します。" #: ../../c-api/init_config.rst:2219 msgid "" @@ -3247,45 +3291,50 @@ msgid "" "warning)." msgstr "" -#: ../../c-api/init_config.rst:2229 msgid "" "If :c:member:`~PyConfig.base_prefix` or :c:member:`~PyConfig." "base_exec_prefix` fields are not set, they inherit their value from :c:" "member:`~PyConfig.prefix` and :c:member:`~PyConfig.exec_prefix` respectively." msgstr "" +":c:member:`~PyConfig.base_prefix` と :c:member:`~PyConfig.base_exec_prefix` " +"は、それぞれ未設定なら :c:member:`~PyConfig.prefix` と :c:member:`~PyConfig." +"exec_prefix` の値を引き継ぎます。" -#: ../../c-api/init_config.rst:2233 msgid ":c:func:`Py_RunMain` and :c:func:`Py_Main` modify :data:`sys.path`:" msgstr "" +":c:func:`Py_RunMain` と :c:func:`Py_Main` は :data:`sys.path` を変更します。" -#: ../../c-api/init_config.rst:2235 msgid "" "If :c:member:`~PyConfig.run_filename` is set and is a directory which " "contains a ``__main__.py`` script, prepend :c:member:`~PyConfig." "run_filename` to :data:`sys.path`." msgstr "" +":c:member:`~PyConfig.run_filename` が設定されており、``__main__.py`` スクリプ" +"トを含むディレクトリである場合は、:c:member:`~PyConfig.run_filename` を :" +"data:`sys.path` の先頭に追加します。" #: ../../c-api/init_config.rst:2238 msgid "If :c:member:`~PyConfig.isolated` is zero:" msgstr "" -#: ../../c-api/init_config.rst:2240 msgid "" "If :c:member:`~PyConfig.run_module` is set, prepend the current directory " "to :data:`sys.path`. Do nothing if the current directory cannot be read." msgstr "" +":c:member:`~PyConfig.run_module` が設定されている場合は、現在のディレクトリ" +"を :data:`sys.path` の先頭に追加します。\n" +"現在のディレクトリを取得できなければ何もしません。" -#: ../../c-api/init_config.rst:2242 msgid "" "If :c:member:`~PyConfig.run_filename` is set, prepend the directory of the " "filename to :data:`sys.path`." msgstr "" +":c:member:`~PyConfig.run_filename` が設定されている場合は、そのファイル名の" +"ディレクトリを :data:`sys.path` の先頭に追加します。" -#: ../../c-api/init_config.rst:2244 msgid "Otherwise, prepend an empty string to :data:`sys.path`." -msgstr "" +msgstr "それ以外の場合は、空文字列を :data:`sys.path` の先頭に追加します。" -#: ../../c-api/init_config.rst:2246 msgid "" "If :c:member:`~PyConfig.site_import` is non-zero, :data:`sys.path` can be " "modified by the :mod:`site` module. If :c:member:`~PyConfig." @@ -3293,44 +3342,40 @@ msgid "" "exists, the :mod:`site` module appends the user's site-package directory to :" "data:`sys.path`." msgstr "" +":c:member:`~PyConfig.site_import` がゼロ以外の場合、:mod:`site` モジュール" +"が :data:`sys.path` を変更することがあります。\n" +":c:member:`~PyConfig.user_site_directory` がゼロ以外で、ユーザーの site-" +"packages ディレクトリが存在する場合は、:mod:`site` モジュールがそのディレクト" +"リを :data:`sys.path` の末尾に追加します。" -#: ../../c-api/init_config.rst:2252 msgid "The following configuration files are used by the path configuration:" -msgstr "" +msgstr "パス設定では、以下の設定ファイルを使います。" #: ../../c-api/init_config.rst:2254 msgid "``pyvenv.cfg``" msgstr "``pyvenv.cfg``" -#: ../../c-api/init_config.rst:2255 msgid "``._pth`` file (ex: ``python._pth``)" -msgstr "" +msgstr "``._pth`` ファイル (例: ``python._pth``)" -#: ../../c-api/init_config.rst:2256 msgid "``pybuilddir.txt`` (Unix only)" -msgstr "" +msgstr "``pybuilddir.txt`` (Unix のみ)" -#: ../../c-api/init_config.rst:2258 msgid "If a ``._pth`` file is present:" -msgstr "" +msgstr "``._pth`` ファイルが存在する場合:" -#: ../../c-api/init_config.rst:2260 msgid "Set :c:member:`~PyConfig.isolated` to ``1``." -msgstr "" +msgstr ":c:member:`~PyConfig.isolated` を ``1`` に設定します。" -#: ../../c-api/init_config.rst:2261 msgid "Set :c:member:`~PyConfig.use_environment` to ``0``." -msgstr "" +msgstr ":c:member:`~PyConfig.use_environment` を ``0`` に設定します。" -#: ../../c-api/init_config.rst:2262 msgid "Set :c:member:`~PyConfig.site_import` to ``0``." -msgstr "" +msgstr ":c:member:`~PyConfig.site_import` を ``0`` に設定します。" -#: ../../c-api/init_config.rst:2263 msgid "Set :c:member:`~PyConfig.safe_path` to ``1``." -msgstr "" +msgstr ":c:member:`~PyConfig.safe_path` を ``1`` に設定します。" -#: ../../c-api/init_config.rst:2265 msgid "" "If :c:member:`~PyConfig.home` is not set and a ``pyvenv.cfg`` file is " "present in the same directory as :c:member:`~PyConfig.executable`, or its " @@ -3340,31 +3385,39 @@ msgid "" "to the base installation. See :ref:`sys-path-init-virtual-environments` for " "more information." msgstr "" +":c:member:`~PyConfig.home` が未設定で、:c:member:`~PyConfig.executable` と同" +"じディレクトリか、その親ディレクトリに ``pyvenv.cfg`` ファイルがある場合、:c:" +"member:`~PyConfig.prefix` と :c:member:`~PyConfig.exec_prefix` はその場所に設" +"定されます。\n" +"この場合も、:c:member:`~PyConfig.base_prefix` と :c:member:`~PyConfig." +"base_exec_prefix` は元の値を保ち、基となるインストール先を指します。\n" +"詳しくは :ref:`sys-path-init-virtual-environments` を参照してください。" -#: ../../c-api/init_config.rst:2273 msgid "" "The ``__PYVENV_LAUNCHER__`` environment variable is used to set :c:member:" "`PyConfig.base_executable`." msgstr "" +"``__PYVENV_LAUNCHER__`` 環境変数は、:c:member:`PyConfig.base_executable` の設" +"定に使います。" -#: ../../c-api/init_config.rst:2278 msgid "" ":c:member:`~PyConfig.prefix`, and :c:member:`~PyConfig.exec_prefix`, are now " "set to the ``pyvenv.cfg`` directory. This was previously done by :mod:" "`site`, therefore affected by :option:`-S`." msgstr "" +":c:member:`~PyConfig.prefix` と :c:member:`~PyConfig.exec_prefix` が、" +"``pyvenv.cfg`` のディレクトリに設定されるようになりました。\n" +"以前は :mod:`site` が設定していたため、:option:`-S` の影響を受けていました。" #: ../../c-api/init_config.rst:2284 msgid "Py_GetArgcArgv()" msgstr "Py_GetArgcArgv()" -#: ../../c-api/init_config.rst:2288 msgid "Get the original command line arguments, before Python modified them." -msgstr "" +msgstr "Python が変更する前の、元のコマンドライン引数を取得します。" -#: ../../c-api/init_config.rst:2290 msgid "See also :c:member:`PyConfig.orig_argv` member." -msgstr "" +msgstr ":c:member:`PyConfig.orig_argv` メンバーも参照してください。" #: ../../c-api/init_config.rst:2293 msgid "Delaying main module execution" diff --git a/c-api/intro.po b/c-api/intro.po index 720c815e0..24c59f12a 100644 --- a/c-api/intro.po +++ b/c-api/intro.po @@ -21,17 +21,16 @@ msgstr "" "Last-Translator: Arihiro TAKASE, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../c-api/intro.rst:8 msgid "Introduction" msgstr "はじめに" -#: ../../c-api/intro.rst:10 msgid "" "The Application Programmer's Interface to Python gives C and C++ programmers " "access to the Python interpreter at a variety of levels. The API is equally " @@ -43,16 +42,18 @@ msgid "" "larger application; this technique is generally referred to as :dfn:" "`embedding` Python in an application." msgstr "" -"Python のアプリケーションプログラマ用インタフェース (Application " -"Programmer's Interface, API) は、 Python インタプリタに対する様々なレベルでの" -"アクセス手段を C や C++ のプログラマに提供しています。この API は通常 C++ か" -"らも全く同じように利用できるのですが、簡潔な呼び名にするために Python/C API " -"と名づけられています。根本的に異なる二つの目的から、 Python/C API が用いられ" -"ます。第一は、特定用途の *拡張モジュール (extension module)* 、すなわち " -"Python インタプリタを拡張する C で書かれたモジュールを記述する、という目的で" -"す。第二は、より大規模なアプリケーション内で Python を構成要素 (component) と" -"して利用するという目的です; このテクニックは、一般的にはアプリケーションへの " -"Python の埋め込み (:dfn:`embedding`) と呼びます。" +"Python のアプリケーションプログラマー向けインターフェース (API) は、C と C++ " +"のプログラマーに、Python インタープリタへのさまざまなレベルのアクセスを提供し" +"ます。\n" +"C++ からも同様に使えますが、簡潔に Python/C API と呼びます。\n" +"Python/C API を使う主な理由は、根本的に異なる 2 つです。\n" +"1 つは、特定の目的のために *拡張モジュール* を書くことです。\n" +"これは Python インタープリタを拡張する C のモジュールで、おそらく最も一般的な" +"用途です。\n" +"もう 1 つは、より大きなアプリケーションの構成要素として Python を使うことで" +"す。\n" +"この技法は一般に、アプリケーションへの Python の 埋め込み (:dfn:`embedding`) " +"と呼ばれます。" #: ../../c-api/intro.rst:20 msgid "" @@ -84,17 +85,20 @@ msgstr "" #: ../../c-api/intro.rst:34 msgid "Language version compatibility" -msgstr "" +msgstr "言語バージョン互換性" #: ../../c-api/intro.rst:36 msgid "Python's C API is compatible with C11 and C++11 versions of C and C++." msgstr "" +"Pythonの C API は C11 や C++11 バージョンの C と C++ に互換性があります。" -#: ../../c-api/intro.rst:38 msgid "" "This is a lower limit: the C API does not require features from later C/C++ " "versions. You do *not* need to enable your compiler's \"c11 mode\"." msgstr "" +"これは最低限のバージョンであり、C API はこれより新しい C/C++ の機能を必要とし" +"ません。\n" +"コンパイラの「c11 モード」を有効にする必要は *ありません*。" #: ../../c-api/intro.rst:44 msgid "Coding standards" @@ -132,6 +136,8 @@ msgid "" "#define PY_SSIZE_T_CLEAN\n" "#include " msgstr "" +"#define PY_SSIZE_T_CLEAN\n" +"#include " #: ../../c-api/intro.rst:64 msgid "" @@ -225,12 +231,15 @@ msgstr "" "ラットフォーム依存のヘッダをインクルードしているので、このような操作を行うと" "複数のプラットフォームでのビルドができなくなります。" -#: ../../c-api/intro.rst:105 msgid "" "C++ users should note that although the API is defined entirely using C, the " "header files properly declare the entry points to be ``extern \"C\"``. As a " "result, there is no need to do anything special to use the API from C++." msgstr "" +"C++ の利用者は、API がすべて C で定義されていても、ヘッダーファイルではエント" +"リーポイントが適切に ``extern \"C\"`` として宣言されていることに注意してくだ" +"さい。\n" +"そのため、C++ から API を使うのに特別な対応は必要ありません。" #: ../../c-api/intro.rst:111 msgid "Useful macros" @@ -284,11 +293,12 @@ msgstr "" msgid "Return the absolute value of ``x``." msgstr "``x`` の絶対値を返します。" -#: ../../c-api/intro.rst:150 msgid "" "Ask the compiler to always inline a static inline function. The compiler can " "ignore it and decide to not inline the function." msgstr "" +"static inline 関数を常にインライン化するよう、コンパイラに要求します。\n" +"コンパイラはこれを無視して、インライン化しないと判断する場合もあります。" #: ../../c-api/intro.rst:153 msgid "" @@ -297,42 +307,48 @@ msgid "" "MSC disables function inlining when building in debug mode." msgstr "" -#: ../../c-api/intro.rst:157 msgid "" "Marking blindly a static inline function with Py_ALWAYS_INLINE can result in " "worse performances (due to increased code size for example). The compiler is " "usually smarter than the developer for the cost/benefit analysis." msgstr "" +"static inline 関数に無条件に ``Py_ALWAYS_INLINE`` を付けると、コードサイズの" +"増加などによって、性能が悪化する場合があります。\n" +"通常、コストと利点の分析は、開発者よりもコンパイラの方が得意です。" -#: ../../c-api/intro.rst:161 msgid "" "If Python is :ref:`built in debug mode ` (if the :c:macro:" "`Py_DEBUG` macro is defined), the :c:macro:`Py_ALWAYS_INLINE` macro does " "nothing." msgstr "" +"Python が :ref:`デバッグモードでビルドされている ` 場合 (:c:" +"macro:`Py_DEBUG` マクロが定義されている場合)、:c:macro:`Py_ALWAYS_INLINE` マ" +"クロは何も行いません。" -#: ../../c-api/intro.rst:164 msgid "It must be specified before the function return type. Usage::" msgstr "" +"関数の戻り値の型の前に指定しなければなりません。\n" +"使用例を示します。 ::" #: ../../c-api/intro.rst:166 msgid "static inline Py_ALWAYS_INLINE int random(void) { return 4; }" -msgstr "" +msgstr "static inline Py_ALWAYS_INLINE int random(void) { return 4; }" -#: ../../c-api/intro.rst:172 msgid "" "Argument must be a character or an integer in the range [-128, 127] or [0, " "255]. This macro returns ``c`` cast to an ``unsigned char``." msgstr "" -"引数は文字か、[-128, 127] あるいは [0, 255] の範囲の整数でなければなりませ" +"引数は、文字か、[-128, 127] または [0, 255] の範囲の整数でなければなりませ" "ん。\n" -"このマクロは ``符号なし文字`` にキャストした ``c`` を返します。" +"このマクロは ``c`` を ``unsigned char`` にキャストして返します。" #: ../../c-api/intro.rst:177 msgid "" "Use this for deprecated declarations. The macro must be placed before the " "symbol name." msgstr "" +"非推奨な宣言に使用してください。このマクロはシンボル名の前に置かれなければな" +"りません。" #: ../../c-api/intro.rst:180 ../../c-api/intro.rst:266 #: ../../c-api/intro.rst:284 @@ -341,7 +357,7 @@ msgstr "以下はプログラム例です::" #: ../../c-api/intro.rst:182 msgid "Py_DEPRECATED(3.8) PyAPI_FUNC(int) Py_OldFunction(void);" -msgstr "" +msgstr "Py_DEPRECATED(3.8) PyAPI_FUNC(int) Py_OldFunction(void);" #: ../../c-api/intro.rst:184 msgid "MSVC support was added." @@ -352,6 +368,8 @@ msgid "" "Like ``getenv(s)``, but returns ``NULL`` if :option:`-E` was passed on the " "command line (see :c:member:`PyConfig.use_environment`)." msgstr "" +"``getenv(s)`` に似ていますが、コマンドラインで :option:`-E` が渡された場合は " +"(:c:member:`PyConfig.use_environment` を参照) ``NULL`` を返します。" #: ../../c-api/intro.rst:194 msgid "Return the maximum value between ``x`` and ``y``." @@ -365,12 +383,14 @@ msgstr "(``type``) 構造体の ``member`` のサイズをバイト単位で返 msgid "Return the minimum value between ``x`` and ``y``." msgstr "``x`` と ``y`` の最小値を返します。" -#: ../../c-api/intro.rst:212 msgid "" "Disable inlining on a function. For example, it reduces the C stack " "consumption: useful on LTO+PGO builds which heavily inline code (see :issue:" "`33720`)." msgstr "" +"関数のインライン化を無効にします。\n" +"例えば、C のスタックの消費量を減らせるため、コードを大幅にインライン化する " +"LTO+PGO ビルドで有用です (:issue:`33720` を参照)。" #: ../../c-api/intro.rst:216 msgid "Usage::" @@ -378,7 +398,7 @@ msgstr "使い方::" #: ../../c-api/intro.rst:218 msgid "Py_NO_INLINE static int random(void) { return 4; }" -msgstr "" +msgstr "Py_NO_INLINE static int random(void) { return 4; }" #: ../../c-api/intro.rst:224 msgid "" @@ -387,20 +407,27 @@ msgstr "" "``x`` を C 文字列へ変換します。\n" "例えば、 ``Py_STRINGIFY(123)`` は ``\"123\"`` を返します。" -#: ../../c-api/intro.rst:231 msgid "" "Use this when you have a code path that cannot be reached by design. For " "example, in the ``default:`` clause in a ``switch`` statement for which all " "possible values are covered in ``case`` statements. Use this in places " "where you might be tempted to put an ``assert(0)`` or ``abort()`` call." msgstr "" +"設計上、到達することのないコードパスで使ってください。\n" +"例えば、可能な値をすべて ``case`` で網羅した ``switch`` 文の ``default:`` 節" +"で使います。\n" +"``assert(0)`` や ``abort()`` の呼び出しを置きたくなるような箇所で使ってくださ" +"い。" -#: ../../c-api/intro.rst:236 msgid "" "In release mode, the macro helps the compiler to optimize the code, and " "avoids a warning about unreachable code. For example, the macro is " "implemented with ``__builtin_unreachable()`` on GCC in release mode." msgstr "" +"リリースモードでは、このマクロはコンパイラによるコードの最適化を助け、到達不" +"能コードに関する警告を防ぎます。\n" +"例えば、GCC のリリースモードでは ``__builtin_unreachable()`` で実装されていま" +"す。" #: ../../c-api/intro.rst:240 msgid "" @@ -408,7 +435,6 @@ msgid "" "returns but that is not declared :c:macro:`_Py_NO_RETURN`." msgstr "" -#: ../../c-api/intro.rst:243 msgid "" "If a code path is very unlikely code but can be reached under exceptional " "case, this macro must not be used. For example, under low memory condition " @@ -416,12 +442,20 @@ msgid "" "case, it's better to report the error to the caller. If the error cannot be " "reported to caller, :c:func:`Py_FatalError` can be used." msgstr "" +"発生する可能性が非常に低くても、例外的な状況で到達しうるコードパスには、この" +"マクロを使ってはなりません。\n" +"例えば、メモリ不足の場合や、システムコールが想定範囲外の値を返した場合で" +"す。\n" +"そのような場合は、呼び出し元にエラーを報告する方が適切です。\n" +"呼び出し元に報告できない場合は、:c:func:`Py_FatalError` を使えます。" #: ../../c-api/intro.rst:253 msgid "" "Use this for unused arguments in a function definition to silence compiler " "warnings. Example: ``int func(int a, int Py_UNUSED(b)) { return a; }``." msgstr "" +"コンパイラ警告を抑えるために関数定義の使用されない引数に使用してください。例" +"えば: ``int func(int a, int Py_UNUSED(b)) { return a; }`` 。" #: ../../c-api/intro.rst:260 msgid "" @@ -445,6 +479,13 @@ msgid "" " // ...\n" "}" msgstr "" +"PyDoc_STRVAR(pop_doc, \"Remove and return the rightmost element.\");\n" +"\n" +"static PyMethodDef deque_methods[] = {\n" +" // ...\n" +" {\"pop\", (PyCFunction)deque_pop, METH_NOARGS, pop_doc},\n" +" // ...\n" +"}" #: ../../c-api/intro.rst:278 msgid "" @@ -466,12 +507,16 @@ msgid "" " {NULL, NULL}\n" "};" msgstr "" +"static PyMethodDef pysqlite_row_methods[] = {\n" +" {\"keys\", (PyCFunction)pysqlite_row_keys, METH_NOARGS,\n" +" PyDoc_STR(\"Returns the keys of the row.\")},\n" +" {NULL, NULL}\n" +"};" #: ../../c-api/intro.rst:296 msgid "Objects, Types and Reference Counts" msgstr "オブジェクト、型および参照カウント" -#: ../../c-api/intro.rst:300 msgid "" "Most Python/C API functions have one or more arguments as well as a return " "value of type :c:expr:`PyObject*`. This type is a pointer to an opaque data " @@ -485,16 +530,19 @@ msgid "" "never be deallocated, they are typically static :c:type:`PyTypeObject` " "objects." msgstr "" -"Python/C API 関数は、 :c:expr:`PyObject*` 型の一つ以上の引数と戻り値を持ちま" -"す。この型は、任意の Python オブジェクトを表現する不透明 (opaque) なデータ型" -"へのポインタです。 Python 言語は、全ての Python オブジェクト型をほとんどの状" -"況 (例えば代入、スコープ規則 (scope rule)、引数渡し) で同様に扱います。ほとん" -"ど全ての Python オブジェクトはヒープ (heap) 上に置かれます: このため、 :c:" -"type:`PyObject` 型のオブジェクトは、自動記憶 (automatic) としても静的記憶 " -"(static) としても宣言できません。 :c:expr:`PyObject*` 型のポインタ変数のみ宣" -"言できます。唯一の例外は、型オブジェクトです; 型オブジェクトはメモリ解放 " -"(deallocate) してはならないので、通常は静的記憶の :c:type:`PyTypeObject` オブ" -"ジェクトにします。" +"Python/C API 関数の多くは、:c:expr:`PyObject*` 型の引数を 1 つ以上受け取り、" +"同じ型の値を返します。\n" +"この型は、任意の Python オブジェクトを表す不透明なデータ型へのポインターで" +"す。\n" +"Python 言語では、代入、スコープの規則、引数渡しなど、ほとんどの状況ですべて" +"の Python オブジェクト型を同じように扱います。\n" +"したがって、単一の C の型で表すのが適切です。\n" +"ほとんどすべての Python オブジェクトはヒープ上に置かれます。\n" +":c:type:`PyObject` 型の自動変数や静的変数を宣言することはなく、宣言するのは :" +"c:expr:`PyObject*` 型のポインター変数だけです。\n" +"唯一の例外は型オブジェクトです。\n" +"型オブジェクトは解放してはならないため、通常は静的な :c:type:`PyTypeObject` " +"オブジェクトです。" #: ../../c-api/intro.rst:311 msgid "" @@ -552,7 +600,6 @@ msgid "" "increment is a simple operation." msgstr "" -#: ../../c-api/intro.rst:357 msgid "" "It is not necessary to hold a :term:`strong reference` (i.e. increment the " "reference count) for every local variable that contains a pointer to an " @@ -569,8 +616,21 @@ msgid "" "that are called from Python; the call mechanism guarantees to hold a " "reference to every argument for the duration of the call." msgstr "" +"オブジェクトへのポインターを格納するローカル変数すべてについて、:term:`強参" +"照 ` を保持する (参照カウントを増やす) 必要はありません。\n" +"理論上は、変数がオブジェクトを指すようになったときに参照カウントを 1 増やし、" +"変数がスコープを外れたときに 1 減らします。\n" +"しかし、この 2 つは相殺されるので、最終的な参照カウントは変わりません。\n" +"参照カウントを使う本当の理由は、変数がオブジェクトを指している間に、オブジェ" +"クトが解放されるのを防ぐことだけです。\n" +"少なくともその変数と同じ期間存続する別の参照があると分かっていれば、一時的に" +"新しい :term:`強参照 ` を取得する (参照カウントを増やす) 必" +"要はありません。\n" +"重要な例は、Python から呼び出す拡張モジュールの C 関数に、引数として渡される" +"オブジェクトです。\n" +"呼び出しの仕組みによって、呼び出し中は各引数への参照が保持されることが保証さ" +"れます。" -#: ../../c-api/intro.rst:373 msgid "" "However, a common pitfall is to extract an object from a list and hold on to " "it for a while without taking a new reference. Some other operation might " @@ -580,8 +640,15 @@ msgid "" "code path which allows control to flow back to the user from a :c:func:" "`Py_DECREF`, so almost any operation is potentially dangerous." msgstr "" +"ただし、よくある落とし穴として、リストから取り出したオブジェクトを、新しい参" +"照を取得せずにしばらく保持することがあります。\n" +"別の操作がそのオブジェクトをリストから取り除いて参照を解放し、オブジェクト自" +"体も解放してしまう可能性があります。\n" +"本当の危険は、無害に見える操作でも任意の Python コードを呼び出し、そのコード" +"がこのような操作を行いうることです。\n" +":c:func:`Py_DECREF` からユーザーのコードに制御が戻る経路があるため、ほとんど" +"どの操作にも危険が潜んでいます。" -#: ../../c-api/intro.rst:381 msgid "" "A safe approach is to always use the generic operations (functions whose " "name begins with ``PyObject_``, ``PyNumber_``, ``PySequence_`` or " @@ -590,12 +657,17 @@ msgid "" "This leaves the caller with the responsibility to call :c:func:`Py_DECREF` " "when they are done with the result; this soon becomes second nature." msgstr "" +"安全な方法は、常に汎用の操作 (名前が ``PyObject_``、``PyNumber_``、" +"``PySequence_``、``PyMapping_`` で始まる関数) を使うことです。\n" +"これらの操作は、返すオブジェクトへの新しい :term:`強参照 ` " +"を必ず作成します (つまり、参照カウントを増やします)。\n" +"そのため、呼び出し元には、結果を使い終えたときに :c:func:`Py_DECREF` を呼び出" +"す責任がありますが、これはすぐに習慣になります。" #: ../../c-api/intro.rst:392 msgid "Reference Count Details" msgstr "参照カウントの詳細" -#: ../../c-api/intro.rst:394 msgid "" "The reference count behavior of functions in the Python/C API is best " "explained in terms of *ownership of references*. Ownership pertains to " @@ -611,6 +683,20 @@ msgid "" "said to *borrow* the reference. Nothing needs to be done for a :term:" "`borrowed reference`." msgstr "" +"Python/C API の関数による参照カウントの扱いは、*参照の所有権* で考えると最も" +"よく説明できます。\n" +"所有権は参照に対するものであり、オブジェクトに対するものではありません (オブ" +"ジェクトは所有されず、常に共有されます)。\n" +"「参照を所有する」とは、その参照が不要になったときに ``Py_DECREF`` を呼び出す" +"責任を持つという意味です。\n" +"所有権は移すこともできます。\n" +"所有権を受け取ったコードには、不要になった参照を :c:func:`Py_DECREF` または :" +"c:func:`Py_XDECREF` で解放する責任、あるいはその責任を通常は呼び出し元に引き" +"継ぐ責任が生じます。\n" +"関数が呼び出し元に参照の所有権を渡すとき、呼び出し元は *新しい* 参照を受け取" +"るといいます。\n" +"所有権を移さない場合は、参照を *借用する* といいます。\n" +":term:`借用参照 ` に対しては、何もする必要はありません。" #: ../../c-api/intro.rst:407 msgid "" @@ -646,7 +732,6 @@ msgstr "" "コードは以下のようになります (とりあえず例外処理のことは忘れておきます; もっ" "とよい書き方を後で示します)::" -#: ../../c-api/intro.rst:425 msgid "" "PyObject *t;\n" "\n" @@ -655,6 +740,12 @@ msgid "" "PyTuple_SetItem(t, 1, PyLong_FromLong(2L));\n" "PyTuple_SetItem(t, 2, PyUnicode_FromString(\"three\"));" msgstr "" +"PyObject *t;\n" +"\n" +"t = PyTuple_New(3);\n" +"PyTuple_SetItem(t, 0, PyLong_FromLong(1L));\n" +"PyTuple_SetItem(t, 1, PyLong_FromLong(2L));\n" +"PyTuple_SetItem(t, 2, PyUnicode_FromString(\"three\"));" #: ../../c-api/intro.rst:432 msgid "" @@ -668,18 +759,17 @@ msgstr "" "い場合は、参照盗む関数を呼び出す前に、 :c:func:`Py_INCREF` を利用してもう一つ" "の参照を取得してください。" -#: ../../c-api/intro.rst:437 msgid "" "Incidentally, :c:func:`PyTuple_SetItem` is the *only* way to set tuple " "items; :c:func:`PySequence_SetItem` and :c:func:`PyObject_SetItem` refuse to " "do this since tuples are an immutable data type. You should only use :c:" "func:`PyTuple_SetItem` for tuples that you are creating yourself." msgstr "" -"ちなみに、 :c:func:`PyTuple_SetItem` はタプルに値をセットするための *唯一の* " -"方法です; タプルは変更不能なデータ型なので、 :c:func:`PySequence_SetItem` " -"や :c:func:`PyObject_SetItem` を使うと上の操作は拒否されてしまいます。自分で" -"タプルの値を入れていくつもりなら、 :c:func:`PyTuple_SetItem` だけしか使えませ" -"ん。" +"ちなみに、:c:func:`PyTuple_SetItem` はタプルの要素を設定する *唯一の* 方法で" +"す。\n" +"タプルは不変のデータ型なので、:c:func:`PySequence_SetItem` と :c:func:" +"`PyObject_SetItem` はこの操作を拒否します。\n" +":c:func:`PyTuple_SetItem` は、自分で作成中のタプルに対してだけ使うべきです。" #: ../../c-api/intro.rst:442 msgid "" @@ -710,8 +800,11 @@ msgid "" "tuple = Py_BuildValue(\"(iis)\", 1, 2, \"three\");\n" "list = Py_BuildValue(\"[iis]\", 1, 2, \"three\");" msgstr "" +"PyObject *tuple, *list;\n" +"\n" +"tuple = Py_BuildValue(\"(iis)\", 1, 2, \"three\");\n" +"list = Py_BuildValue(\"[iis]\", 1, 2, \"three\");" -#: ../../c-api/intro.rst:456 msgid "" "It is much more common to use :c:func:`PyObject_SetItem` and friends with " "items whose references you are only borrowing, like arguments that were " @@ -721,8 +814,13 @@ msgid "" "For example, this function sets all items of a list (actually, any mutable " "sequence) to a given item::" msgstr "" +"実際には、自分の関数に渡された引数のように、参照を借用しているだけの要素に対" +"して、:c:func:`PyObject_SetItem` などを使う方がはるかに一般的です。\n" +"その場合、渡すだけのために新しい参照を取得してから「盗ませる」必要がないた" +"め、参照の扱いがずっと自然になります。\n" +"例えば、次の関数は、リスト (実際には任意の可変シーケンス) のすべての要素を指" +"定した要素に設定します。 ::" -#: ../../c-api/intro.rst:463 msgid "" "int\n" "set_all(PyObject *target, PyObject *item)\n" @@ -745,6 +843,26 @@ msgid "" " return 0;\n" "}" msgstr "" +"int\n" +"set_all(PyObject *target, PyObject *item)\n" +"{\n" +" Py_ssize_t i, n;\n" +"\n" +" n = PyObject_Length(target);\n" +" if (n < 0)\n" +" return -1;\n" +" for (i = 0; i < n; i++) {\n" +" PyObject *index = PyLong_FromSsize_t(i);\n" +" if (!index)\n" +" return -1;\n" +" if (PyObject_SetItem(target, index, item) < 0) {\n" +" Py_DECREF(index);\n" +" return -1;\n" +" }\n" +" Py_DECREF(index);\n" +" }\n" +" return 0;\n" +"}" #: ../../c-api/intro.rst:486 msgid "" @@ -795,7 +913,6 @@ msgstr "" "書けるかを示した例です; 一つは :c:func:`PyList_GetItem` を使っていて、もう一" "つは :c:func:`PySequence_GetItem` を使っています。 ::" -#: ../../c-api/intro.rst:511 msgid "" "long\n" "sum_list(PyObject *list)\n" @@ -819,8 +936,28 @@ msgid "" " return total;\n" "}" msgstr "" +"long\n" +"sum_list(PyObject *list)\n" +"{\n" +" Py_ssize_t i, n;\n" +" long total = 0, value;\n" +" PyObject *item;\n" +"\n" +" n = PyList_Size(list);\n" +" if (n < 0)\n" +" return -1; /* リストではない */\n" +" for (i = 0; i < n; i++) {\n" +" item = PyList_GetItem(list, i); /* 失敗しない */\n" +" if (!PyLong_Check(item)) continue; /* 整数でないものを飛ばす */\n" +" value = PyLong_AsLong(item);\n" +" if (value == -1 && PyErr_Occurred())\n" +" /* 整数が C の long に収まらないので終了する */\n" +" return -1;\n" +" total += value;\n" +" }\n" +" return total;\n" +"}" -#: ../../c-api/intro.rst:537 msgid "" "long\n" "sum_sequence(PyObject *sequence)\n" @@ -850,6 +987,33 @@ msgid "" " return total;\n" "}" msgstr "" +"long\n" +"sum_sequence(PyObject *sequence)\n" +"{\n" +" Py_ssize_t i, n;\n" +" long total = 0, value;\n" +" PyObject *item;\n" +" n = PySequence_Length(sequence);\n" +" if (n < 0)\n" +" return -1; /* 長さを持たない */\n" +" for (i = 0; i < n; i++) {\n" +" item = PySequence_GetItem(sequence, i);\n" +" if (item == NULL)\n" +" return -1; /* シーケンスでないか、別のエラー */\n" +" if (PyLong_Check(item)) {\n" +" value = PyLong_AsLong(item);\n" +" Py_DECREF(item);\n" +" if (value == -1 && PyErr_Occurred())\n" +" /* 整数が C の long に収まらないので終了する */\n" +" return -1;\n" +" total += value;\n" +" }\n" +" else {\n" +" Py_DECREF(item); /* 所有する参照を解放する */\n" +" }\n" +" }\n" +" return total;\n" +"}" #: ../../c-api/intro.rst:571 msgid "Types" @@ -922,7 +1086,6 @@ msgstr "" "で、 :c:func:`PyErr_Occurred` で明示的にエラーテストを行う必要があります。こ" "れらの例外は常に明示的にドキュメント化されます。" -#: ../../c-api/intro.rst:617 msgid "" "Exception state is maintained in per-thread storage (this is equivalent to " "using global storage in an unthreaded application). A thread can be in one " @@ -934,18 +1097,18 @@ msgid "" "general) function to set the exception state, and :c:func:`PyErr_Clear` " "clears the exception state." msgstr "" -"例外時の状態情報 (exception state)は、スレッド単位に用意された記憶領域 (per-" -"thread storage) 内で管理されます (この記憶領域は、スレッドを使わないアプリ" -"ケーションではグローバルな記憶領域と同じです)。一つのスレッドは二つの状態のど" -"ちらか: 例外が発生したか、まだ発生していないか、をとります。関数 :c:func:" -"`PyErr_Occurred` を使うと、この状態を調べられます: この関数は例外が発生した際" -"にはその例外型オブジェクトに対する借用参照 (borrowed reference) を返し、そう" -"でないときには ``NULL`` を返します。例外状態を設定する関数は数多くあります: :" -"c:func:`PyErr_SetString` はもっともよく知られている (が、もっとも汎用性のな" -"い) 例外を設定するための関数で、 :c:func:`PyErr_Clear` は例外状態情報を消し去" -"る関数です。" +"例外状態は、スレッドごとの記憶領域で管理されます。\n" +"スレッドを使わないアプリケーションでは、グローバルな記憶領域を使うことに相当" +"します。\n" +"スレッドは、例外が発生しているか、していないかの 2 つの状態のいずれかを取りま" +"す。\n" +":c:func:`PyErr_Occurred` でこれを調べられます。\n" +"例外が発生していれば、その例外の型オブジェクトへの借用参照を返し、それ以外の" +"場合は ``NULL`` を返します。\n" +"例外状態を設定する関数はいくつかあり、:c:func:`PyErr_SetString` が最もよく使" +"われますが、最も汎用的な関数というわけではありません。\n" +":c:func:`PyErr_Clear` は例外状態を消去します。" -#: ../../c-api/intro.rst:627 msgid "" "The full exception state consists of three objects (all of which can be " "``NULL``): the exception type, the corresponding exception value, and the " @@ -957,17 +1120,16 @@ msgid "" "bytecode interpreter's main loop, which takes care of transferring it to " "``sys.exc_info()`` and friends." msgstr "" -"完全な例外状態情報は、3 つのオブジェクト: 例外の型、例外の値、そしてトレース" -"バック、からなります (どのオブジェクトも ``NULL`` を取り得ます)。これらの情" -"報は、 Python の ``sys.exc_info()`` の結果と同じ意味を持ちます; とはいえ、 C " -"と Python の例外状態情報は全く同じではありません: Python における例外オブジェ" -"クトは、Python の :keyword:`try` ... :keyword:`except` 文で最近処理したオブ" -"ジェクトを表す一方、 C レベルの例外状態情報が存続するのは、渡された例外情報" -"を ``sys.exc_info()`` その他に転送するよう取り計らう Python のバイトコードイ" -"ンタプリタのメインループに到達するまで、例外が関数の間で受け渡しされている間" -"だけです。" +"完全な例外状態は、例外の型、対応する例外の値、トレースバックの 3 つのオブジェ" +"クトからなり、いずれも ``NULL`` になりえます。\n" +"これらは Python の ``sys.exc_info()`` の結果と同じ意味を持ちますが、同じもの" +"ではありません。\n" +"Python 側のオブジェクトは、Python の :keyword:`try` ... :keyword:`except` 文" +"で現在処理している最後の例外を表します。\n" +"一方、C レベルの例外状態が存在するのは、例外が C 関数の間で受け渡され、" +"Python バイトコードインタープリタのメインループに到達するまでの間だけです。\n" +"メインループが、例外を ``sys.exc_info()`` などに移す処理を行います。" -#: ../../c-api/intro.rst:639 msgid "" "Note that starting with Python 1.5, the preferred, thread-safe way to access " "the exception state from Python code is to call the function :func:`sys." @@ -980,18 +1142,17 @@ msgid "" "reduces the often unwanted lifetime extension for objects that are " "referenced by the stack frames in the traceback." msgstr "" -"Python 1.5 からは、Python で書かれたコードから例外状態情報にアクセスする方法" -"として、推奨されていてスレッドセーフな方法は :func:`sys.exc_info` になってい" -"るので注意してください。この関数は Python コードの実行されているスレッドにお" -"ける例外状態情報を返します。また、これらの例外状態情報に対するアクセス手段" -"は、両方とも意味づけ (semantics) が変更され、ある関数が例外を捕捉すると、その" -"関数を実行しているスレッドの例外状態情報を保存して、呼び出し側の例外状態情報" -"を維持するようになりました。この変更によって、無害そうに見える関数が現在扱っ" -"ている例外を上書きすることで引き起こされる、例外処理コードでよくおきていたバ" -"グを抑止しています; また、トレースバック内のスタックフレームで参照されている" -"オブジェクトがしばしば不必要に寿命を永らえていたのをなくしています。" +"Python 1.5 以降、Python コードから例外状態にアクセスするには、スレッドセーフ" +"な :func:`sys.exc_info` の呼び出しを推奨します。\n" +"この関数は、Python コードから使う、スレッドごとの例外状態を返します。\n" +"また、両方の例外状態へのアクセス方法の意味が変更され、例外を捕捉する関数が、" +"呼び出し元の例外状態を保つためにスレッドの例外状態を保存・復元するようになり" +"ました。\n" +"これにより、無害に見える関数が処理中の例外を上書きすることで生じる、例外処理" +"コードのよくあるバグを防ぎます。\n" +"トレースバック内のスタックフレームが参照するオブジェクトの寿命が、不必要に延" +"びることも減らします。" -#: ../../c-api/intro.rst:650 msgid "" "As a general principle, a function that calls another function to perform " "some task should check whether the called function raised an exception, and " @@ -1001,15 +1162,13 @@ msgid "" "that was just raised, and lose important information about the exact cause " "of the error." msgstr "" -"一般的な原理として、ある関数が別の関数を呼び出して何らかの作業をさせるとき、" -"呼び出し先の関数が例外を送出していないか調べなくてはならず、もし送出していれ" -"ば、その例外状態情報は呼び出し側に渡されなければなりません。呼び出し元の関数" -"はオブジェクト参照の所有権をすべて放棄し、エラー指標を返さなくてはなりません" -"が、余計に例外を設定する必要は *ありません* --- そんなことをすれば、たった今" -"送出されたばかりの例外を上書きしてしまい、エラーの原因そのものに関する重要な" -"情報を失うことになります。" +"一般に、何らかの処理を別の関数に任せる関数は、呼び出し先が例外を送出したかを" +"調べ、送出していれば、その例外状態を自身の呼び出し元に伝えるべきです。\n" +"所有しているオブジェクトへの参照を解放し、エラーを示す値を返します。\n" +"ただし、別の例外を設定しては *なりません*。\n" +"そうすると、直前に送出された例外を上書きし、エラーの正確な原因に関する重要な" +"情報を失ってしまいます。" -#: ../../c-api/intro.rst:659 msgid "" "A simple example of detecting exceptions and passing them on is shown in " "the :c:func:`!sum_sequence` example above. It so happens that this example " @@ -1017,8 +1176,14 @@ msgid "" "following example function shows some error cleanup. First, to remind you " "why you like Python, we show the equivalent Python code::" msgstr "" +"例外を検出して呼び出し元に伝える単純な例は、上の :c:func:`!sum_sequence` に示" +"されています。\n" +"この例では、エラーを検出したときに所有する参照の後始末をする必要がありませ" +"ん。\n" +"次の関数では、エラー時の後始末の例を示します。\n" +"まず、Python の良さを思い出せるように、同じ処理を Python で書いたコードを示し" +"ます。 ::" -#: ../../c-api/intro.rst:665 msgid "" "def incr_item(dict, key):\n" " try:\n" @@ -1027,12 +1192,17 @@ msgid "" " item = 0\n" " dict[key] = item + 1" msgstr "" +"def incr_item(dict, key):\n" +" try:\n" +" item = dict[key]\n" +" except KeyError:\n" +" item = 0\n" +" dict[key] = item + 1" #: ../../c-api/intro.rst:674 msgid "Here is the corresponding C code, in all its glory::" msgstr "以下は対応するコードを C で完璧に書いたものです::" -#: ../../c-api/intro.rst:676 msgid "" "int\n" "incr_item(PyObject *dict, PyObject *key)\n" @@ -1077,6 +1247,48 @@ msgid "" " return rv; /* -1 for error, 0 for success */\n" "}" msgstr "" +"int\n" +"incr_item(PyObject *dict, PyObject *key)\n" +"{\n" +" /* Py_XDECREF のため、すべてのオブジェクトを NULL で初期化する */\n" +" PyObject *item = NULL, *const_one = NULL, *incremented_item = NULL;\n" +" int rv = -1; /* 戻り値を -1 (失敗) で初期化する */\n" +"\n" +" item = PyObject_GetItem(dict, key);\n" +" if (item == NULL) {\n" +" /* KeyError のみ処理する: */\n" +" if (!PyErr_ExceptionMatches(PyExc_KeyError))\n" +" goto error;\n" +"\n" +" /* エラーを消去してゼロを使う: */\n" +" PyErr_Clear();\n" +" item = PyLong_FromLong(0L);\n" +" if (item == NULL)\n" +" goto error;\n" +" }\n" +" const_one = PyLong_FromLong(1L);\n" +" if (const_one == NULL)\n" +" goto error;\n" +"\n" +" incremented_item = PyNumber_Add(item, const_one);\n" +" if (incremented_item == NULL)\n" +" goto error;\n" +"\n" +" if (PyObject_SetItem(dict, key, incremented_item) < 0)\n" +" goto error;\n" +" rv = 0; /* 成功 */\n" +" /* 続いて後始末のコードを実行する */\n" +"\n" +" error:\n" +" /* 成功と失敗の両方で使う後始末のコード */\n" +"\n" +" /* NULL 参照を無視するため Py_XDECREF() を使う */\n" +" Py_XDECREF(item);\n" +" Py_XDECREF(const_one);\n" +" Py_XDECREF(incremented_item);\n" +"\n" +" return rv; /* エラーなら -1、成功なら 0 */\n" +"}" #: ../../c-api/intro.rst:726 msgid "" @@ -1289,33 +1501,27 @@ msgstr "object" msgid "type" msgstr "type" -#: ../../c-api/intro.rst:337 msgid "Py_INCREF (C function)" -msgstr "" +msgstr "Py_INCREF (C の関数)" -#: ../../c-api/intro.rst:337 msgid "Py_DECREF (C function)" -msgstr "" +msgstr "Py_DECREF (C の関数)" -#: ../../c-api/intro.rst:413 msgid "PyList_SetItem (C function)" -msgstr "" +msgstr "PyList_SetItem (C の関数)" -#: ../../c-api/intro.rst:413 msgid "PyTuple_SetItem (C function)" -msgstr "" +msgstr "PyTuple_SetItem (C の関数)" #: ../../c-api/intro.rst:484 msgid "set_all()" msgstr "set_all()" -#: ../../c-api/intro.rst:503 msgid "PyList_GetItem (C function)" -msgstr "" +msgstr "PyList_GetItem (C の関数)" -#: ../../c-api/intro.rst:503 msgid "PySequence_GetItem (C function)" -msgstr "" +msgstr "PySequence_GetItem (C の関数)" #: ../../c-api/intro.rst:533 msgid "sum_list()" @@ -1325,17 +1531,14 @@ msgstr "sum_list()" msgid "sum_sequence()" msgstr "sum_sequence()" -#: ../../c-api/intro.rst:600 msgid "PyErr_Occurred (C function)" -msgstr "" +msgstr "PyErr_Occurred (C の関数)" -#: ../../c-api/intro.rst:613 msgid "PyErr_SetString (C function)" -msgstr "" +msgstr "PyErr_SetString (C の関数)" -#: ../../c-api/intro.rst:613 ../../c-api/intro.rst:721 msgid "PyErr_Clear (C function)" -msgstr "" +msgstr "PyErr_Clear (C の関数)" #: ../../c-api/intro.rst:637 msgid "exc_info (in module sys)" @@ -1345,17 +1548,14 @@ msgstr "exc_info (sys モジュール)" msgid "incr_item()" msgstr "incr_item()" -#: ../../c-api/intro.rst:721 msgid "PyErr_ExceptionMatches (C function)" -msgstr "" +msgstr "PyErr_ExceptionMatches (C の関数)" -#: ../../c-api/intro.rst:721 msgid "Py_XDECREF (C function)" -msgstr "" +msgstr "Py_XDECREF (C の関数)" -#: ../../c-api/intro.rst:747 msgid "Py_Initialize (C function)" -msgstr "" +msgstr "Py_Initialize (C の関数)" #: ../../c-api/intro.rst:747 msgid "module" @@ -1401,6 +1601,5 @@ msgstr "" msgid "Py_GetProgramFullPath (C function)" msgstr "" -#: ../../c-api/intro.rst:797 msgid "Py_IsInitialized (C function)" -msgstr "" +msgstr "Py_IsInitialized (C の関数)" diff --git a/c-api/iter.po b/c-api/iter.po index 2fa839ed8..ffc986fd0 100644 --- a/c-api/iter.po +++ b/c-api/iter.po @@ -16,10 +16,10 @@ msgstr "" "Last-Translator: tomo, 2021\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../c-api/iter.rst:6 @@ -30,33 +30,42 @@ msgstr "イテレータプロトコル (iterator protocol)" msgid "There are two functions specifically for working with iterators." msgstr "イテレータを扱うための固有の関数は二つあります。" -#: ../../c-api/iter.rst:12 msgid "" "Return non-zero if the object *o* can be safely passed to :c:func:" "`PyIter_NextItem` and ``0`` otherwise. This function always succeeds." msgstr "" +"オブジェクト *o* を :c:func:`PyIter_NextItem` に安全に渡せる場合はゼロ以外" +"を、そうでなければ ``0`` を返します。\n" +"この関数は常に成功します。" -#: ../../c-api/iter.rst:18 msgid "" "Return non-zero if the object *o* provides the :class:`AsyncIterator` " "protocol, and ``0`` otherwise. This function always succeeds." msgstr "" +"オブジェクト *o* が :class:`AsyncIterator` プロトコルを提供する場合はゼロ以外" +"を、そうでなければ ``0`` を返します。\n" +"この関数は常に成功します。" -#: ../../c-api/iter.rst:25 msgid "" "Return ``1`` and set *item* to a :term:`strong reference` of the next value " "of the iterator *iter* on success. Return ``0`` and set *item* to ``NULL`` " "if there are no remaining values. Return ``-1``, set *item* to ``NULL`` and " "set an exception on error." msgstr "" +"成功すると、*item* にイテレータ *iter* の次の値への :term:`強参照 ` を設定し、``1`` を返します。\n" +"残りの値がなければ、*item* に ``NULL`` を設定し、``0`` を返します。\n" +"エラーの場合は、*item* に ``NULL`` を設定し、例外を設定して ``-1`` を返しま" +"す。" -#: ../../c-api/iter.rst:34 msgid "" "This is an older version of :c:func:`!PyIter_NextItem`, which is retained " "for backwards compatibility. Prefer :c:func:`PyIter_NextItem`." msgstr "" +"これは :c:func:`!PyIter_NextItem` の古い版で、後方互換性のために残されていま" +"す。\n" +":c:func:`PyIter_NextItem` を使ってください。" -#: ../../c-api/iter.rst:38 msgid "" "Return the next value from the iterator *o*. The object must be an iterator " "according to :c:func:`PyIter_Check` (it is up to the caller to check this). " @@ -64,25 +73,32 @@ msgid "" "an error occurs while retrieving the item, returns ``NULL`` and passes along " "the exception." msgstr "" +"イテレータ *o* から次の値を返します。\n" +"このオブジェクトは :c:func:`PyIter_Check` で判定されるイテレータでなければな" +"りません (確認は呼び出し側の責任です)。\n" +"残りの値がなければ、例外を設定せずに ``NULL`` を返します。\n" +"要素の取得中にエラーが起きると、``NULL`` を返して例外を引き継ぎます。" -#: ../../c-api/iter.rst:46 msgid "" "The enum value used to represent different results of :c:func:`PyIter_Send`." -msgstr "" +msgstr ":c:func:`PyIter_Send` の各種の結果を表す列挙値です。" -#: ../../c-api/iter.rst:53 msgid "Sends the *arg* value into the iterator *iter*. Returns:" msgstr "" +"値 *arg* をイテレータ *iter* に送ります。\n" +"戻り値は次のとおりです:" -#: ../../c-api/iter.rst:55 msgid "" "``PYGEN_RETURN`` if iterator returns. Return value is returned via *presult*." msgstr "" +"イテレータが return した場合は ``PYGEN_RETURN``。\n" +"戻り値は *presult* を通じて返します。" -#: ../../c-api/iter.rst:56 msgid "" "``PYGEN_NEXT`` if iterator yields. Yielded value is returned via *presult*." msgstr "" +"イテレータが yield した場合は ``PYGEN_NEXT``。\n" +"yield した値は *presult* を通じて返します。" #: ../../c-api/iter.rst:57 msgid "" diff --git a/c-api/iterator.po b/c-api/iterator.po index c50196264..3ab3715c9 100644 --- a/c-api/iterator.po +++ b/c-api/iterator.po @@ -17,10 +17,10 @@ msgstr "" "Last-Translator: Taichi Haradaguchi, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../c-api/iterator.rst:6 @@ -51,13 +51,12 @@ msgstr "" "関数 :func:`iter` を呼び出したときに返される、イテレータオブジェクトの型オブ" "ジェクトです。" -#: ../../c-api/iterator.rst:24 msgid "" "Return true if the type of *op* is :c:data:`PySeqIter_Type`. This function " "always succeeds." msgstr "" -"*op* の型が :c:data:`PySeqlter_Type` 型の場合に真を返します。この関数は常に成" -"功します。" +"``op`` の型が :c:data:`PySeqIter_Type` の場合に真を返します。\n" +"この関数は常に成功します。" #: ../../c-api/iterator.rst:30 msgid "" diff --git a/c-api/list.po b/c-api/list.po index 281b1575c..9857f3c1a 100644 --- a/c-api/list.po +++ b/c-api/list.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: tomo, 2023\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../c-api/list.rst:6 @@ -64,7 +64,6 @@ msgstr "" "サイズが *len* 新たなリストオブジェクトを返します。\n" "失敗すると ``NULL`` を返します。" -#: ../../c-api/list.rst:40 msgid "" "If *len* is greater than zero, the returned list object's items are set to " "``NULL``. Thus you cannot use abstract API functions such as :c:func:" @@ -74,6 +73,14 @@ msgid "" "fully initialized: :c:func:`PyList_SetItem()` and :c:func:" "`PyList_SET_ITEM()`." msgstr "" +"*len* がゼロより大きい場合、返されたリストの要素は ``NULL`` に設定されていま" +"す。\n" +"そのため、:c:func:`PyList_SetItem` や :c:func:`PyList_SET_ITEM()` ですべての" +"要素に実際のオブジェクトを設定するまでは、:c:func:`PySequence_SetItem` などの" +"抽象 API 関数を使ったり、このオブジェクトを Python コードに公開したりしてはな" +"りません。\n" +"リストを完全に初期化する前でも安全に使える API は :c:func:`PyList_SetItem()` " +"と :c:func:`PyList_SET_ITEM()` です。" #: ../../c-api/list.rst:53 msgid "" @@ -87,34 +94,37 @@ msgstr "" msgid "Similar to :c:func:`PyList_Size`, but without error checking." msgstr ":c:func:`PyList_Size` に似ていますが、エラーチェックを行いません。" -#: ../../c-api/list.rst:64 msgid "" "Return the object at position *index* in the list pointed to by *list*. The " "position must be non-negative; indexing from the end of the list is not " "supported. If *index* is out of bounds (:code:`<0 or >=len(list)`), return " "``NULL`` and set an :exc:`IndexError` exception." msgstr "" +"*list* が指すリストの位置 *index* にあるオブジェクトを返します。\n" +"位置は非負でなければならず、リストの末尾からのインデックス指定はサポートしま" +"せん。\n" +"*index* が範囲外 (:code:`<0 or >=len(list)`) の場合、:exc:`IndexError` を設定" +"して ``NULL`` を返します。" -#: ../../c-api/list.rst:74 msgid "" "Like :c:func:`PyList_GetItemRef`, but returns a :term:`borrowed reference` " "instead of a :term:`strong reference`." msgstr "" +":c:func:`PyList_GetItemRef` と似ていますが、:term:`強参照 ` ではなく :term:`借用参照 ` を返します。" #: ../../c-api/list.rst:80 msgid "Similar to :c:func:`PyList_GetItem`, but without error checking." msgstr ":c:func:`PyList_GetItem` に似ていますが、エラーチェックを行いません。" -#: ../../c-api/list.rst:85 msgid "" "Set the item at index *index* in list to *item*. Return ``0`` on success. " "If *index* is out of bounds, return ``-1`` and set an :exc:`IndexError` " "exception." msgstr "" -"リストオブジェクト内の位置 *index* に、オブジェクト *item* を挿入します。\n" -"成功した場合には ``0`` を返します。\n" -"*index* が範囲を越えている場合、 ``-1`` を返して :exc:`IndexError` をセットし" -"ます。" +"リストのインデックス *index* にある要素を *item* に設定します。\n" +"成功すると ``0`` を返します。\n" +"*index* が範囲外の場合は、:exc:`IndexError` を設定して ``-1`` を返します。" #: ../../c-api/list.rst:91 msgid "" @@ -133,11 +143,13 @@ msgstr "" "のマクロは、新たなリストのまだ要素を入れたことのない位置に要素を入れるときに" "のみ使います。" -#: ../../c-api/list.rst:100 msgid "" "Bounds checking is performed as an assertion if Python is built in :ref:" "`debug mode ` or :option:`with assertions <--with-assertions>`." msgstr "" +"Python を :ref:`デバッグモード ` または :option:`アサーションを" +"有効にして <--with-assertions>` ビルドした場合、アサーションによる境界チェッ" +"クが行われます。" #: ../../c-api/list.rst:106 msgid "" @@ -198,31 +210,39 @@ msgstr "" "成功した場合には ``0`` を、失敗した場合には ``-1`` を返します。\n" "ただし、リストの末尾からのインデックスはサポートされていません。" -#: ../../c-api/list.rst:144 msgid "" "Extend *list* with the contents of *iterable*. This is the same as " "``PyList_SetSlice(list, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, iterable)`` and " "analogous to ``list.extend(iterable)`` or ``list += iterable``." msgstr "" +"*iterable* の内容を *list* の末尾に追加します。\n" +"``PyList_SetSlice(list, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, iterable)`` と同じ" +"で、``list.extend(iterable)`` や ``list += iterable`` に相当します。" -#: ../../c-api/list.rst:148 msgid "" "Raise an exception and return ``-1`` if *list* is not a :class:`list` " "object. Return 0 on success." msgstr "" +"*list* が :class:`list` オブジェクトでなければ、例外を送出して ``-1`` を返し" +"ます。\n" +"成功すると 0 を返します。" -#: ../../c-api/list.rst:156 msgid "" "Remove all items from *list*. This is the same as ``PyList_SetSlice(list, " "0, PY_SSIZE_T_MAX, NULL)`` and analogous to ``list.clear()`` or ``del " "list[:]``." msgstr "" +"*list* のすべての要素を削除します。\n" +"``PyList_SetSlice(list, 0, PY_SSIZE_T_MAX, NULL)`` と同じで、``list." +"clear()`` や ``del list[:]`` に相当します。" -#: ../../c-api/list.rst:160 msgid "" "Raise an exception and return ``-1`` if *list* is not a :class:`list` " "object. Return 0 on success." msgstr "" +"*list* が :class:`list` オブジェクトでなければ、例外を送出して ``-1`` を返し" +"ます。\n" +"成功すると 0 を返します。" #: ../../c-api/list.rst:168 msgid "" diff --git a/c-api/long.po b/c-api/long.po index 92f5b8bb9..6b9a6481d 100644 --- a/c-api/long.po +++ b/c-api/long.po @@ -19,10 +19,10 @@ msgstr "" "Last-Translator: tomo, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../c-api/long.rst:6 @@ -44,9 +44,9 @@ msgstr "" "ますが、これは数値と見分けが付きません。\n" "見分けを付けるためには :c:func:`PyErr_Occurred` を使ってください。" -#: ../../c-api/long.rst:18 msgid "This subtype of :c:type:`PyObject` represents a Python integer object." -msgstr "この :c:type:`PyObject` のサブタイプは整数型を表現します。" +msgstr "" +"この :c:type:`PyObject` のサブタイプは Python の整数オブジェクトを表します。" #: ../../c-api/long.rst:23 msgid "" @@ -121,11 +121,13 @@ msgstr "" "C の :c:expr:`long long` 型から新たな :c:type:`PyLongObject` オブジェクトを生" "成して返します。失敗のときには ``NULL`` を返します。" -#: ../../c-api/long.rst:75 msgid "" "Return a new :c:type:`PyLongObject` object from a signed C :c:expr:`int32_t` " "or :c:expr:`int64_t`, or ``NULL`` with an exception set on failure." msgstr "" +"符号付きの C の :c:expr:`int32_t` または :c:expr:`int64_t` から、新しい :c:" +"type:`PyLongObject` オブジェクトを作成して返します。\n" +"失敗すると例外を設定して ``NULL`` を返します。" #: ../../c-api/long.rst:84 msgid "" @@ -135,12 +137,14 @@ msgstr "" "C の :c:expr:`unsigned long long` 型から新たな :c:type:`PyLongObject` オブ" "ジェクトを生成して返します。失敗のときには ``NULL`` を返します。" -#: ../../c-api/long.rst:91 msgid "" "Return a new :c:type:`PyLongObject` object from an unsigned C :c:expr:" "`uint32_t` or :c:expr:`uint64_t`, or ``NULL`` with an exception set on " "failure." msgstr "" +"符号なしの C の :c:expr:`uint32_t` または :c:expr:`uint64_t` から、新しい :c:" +"type:`PyLongObject` オブジェクトを作成して返します。\n" +"失敗すると例外を設定して ``NULL`` を返します。" #: ../../c-api/long.rst:100 msgid "" @@ -150,7 +154,6 @@ msgstr "" "*v* の整数部から新たな :c:type:`PyLongObject` オブジェクトを生成して返しま" "す。失敗のときには ``NULL`` を返します。" -#: ../../c-api/long.rst:106 msgid "" "Return a new :c:type:`PyLongObject` based on the string value in *str*, " "which is interpreted according to the radix in *base*, or ``NULL`` on " @@ -164,19 +167,32 @@ msgid "" "digits or *str* is not NULL-terminated following the digits and trailing " "whitespace, :exc:`ValueError` will be raised." msgstr "" +"*str* 内の文字列を *base* の基数で解釈し、新しい :c:type:`PyLongObject` を作" +"成して返します。\n" +"失敗すると ``NULL`` を返します。\n" +"*pend* が ``NULL`` でなければ、成功時には *\\*pend* が *str* の末尾を、エラー" +"時には処理できなかった最初の文字を指します。\n" +"*base* が ``0`` の場合、*str* は :ref:`integers` の定義に従って解釈します。\n" +"この場合、ゼロでない 10 進数の先頭にゼロがあると :exc:`ValueError` を送出しま" +"す。\n" +"*base* が ``0`` でない場合は、``2`` 以上 ``36`` 以下でなければなりません。\n" +"先頭と末尾の空白、および基数指定子の後や数字の間にある単独のアンダースコアは" +"無視します。\n" +"数字がない場合や、数字と末尾の空白の後で *str* が NULL 終端されていない場合" +"は、:exc:`ValueError` を送出します。" -#: ../../c-api/long.rst:117 msgid "" ":c:func:`PyLong_AsNativeBytes()` and :c:func:`PyLong_FromNativeBytes()` " "functions can be used to convert a :c:type:`PyLongObject` to/from an array " "of bytes in base ``256``." msgstr "" +":c:func:`PyLong_AsNativeBytes()` と :c:func:`PyLong_FromNativeBytes()` を使う" +"と、:c:type:`PyLongObject` と基数 ``256`` のバイト配列を相互に変換できます。" -#: ../../c-api/long.rst:124 msgid "" "Convert a sequence of Unicode digits in the string *u* to a Python integer " "value." -msgstr "" +msgstr "文字列 *u* 内の Unicode 数字の列を Python の整数値に変換します。" #: ../../c-api/long.rst:132 msgid "" @@ -186,13 +202,13 @@ msgstr "" "ポインタ *p* から Python 整数値を生成します。ポインタの値は :c:func:" "`PyLong_AsVoidPtr` を適用した結果から取得されます。" -#: ../../c-api/long.rst:138 msgid "" "Create a Python integer from the value contained in the first *n_bytes* of " "*buffer*, interpreted as a two's-complement signed number." msgstr "" +"*buffer* の先頭 *n_bytes* バイトに格納された値を、2 の補数表現の符号付き数値" +"として解釈し、Python の整数を作成します。" -#: ../../c-api/long.rst:141 msgid "" "*flags* are as for :c:func:`PyLong_AsNativeBytes`. Passing ``-1`` will " "select the native endian that CPython was compiled with and assume that the " @@ -200,26 +216,39 @@ msgid "" "``Py_ASNATIVEBYTES_UNSIGNED_BUFFER`` will produce the same result as " "calling :c:func:`PyLong_FromUnsignedNativeBytes`. Other flags are ignored." msgstr "" +"*flags* は :c:func:`PyLong_AsNativeBytes` と同じです。\n" +"``-1`` を渡すと、CPython のコンパイル時のネイティブなエンディアンを選び、最上" +"位ビットを符号ビットとみなします。\n" +"``Py_ASNATIVEBYTES_UNSIGNED_BUFFER`` を渡すと、:c:func:" +"`PyLong_FromUnsignedNativeBytes` の呼び出しと同じ結果になります。\n" +"他のフラグは無視します。" -#: ../../c-api/long.rst:152 msgid "" "Create a Python integer from the value contained in the first *n_bytes* of " "*buffer*, interpreted as an unsigned number." msgstr "" +"*buffer* の先頭 *n_bytes* バイトに格納された値を符号なし数値として解釈し、" +"Python の整数を作成します。" -#: ../../c-api/long.rst:155 msgid "" "*flags* are as for :c:func:`PyLong_AsNativeBytes`. Passing ``-1`` will " "select the native endian that CPython was compiled with and assume that the " "most-significant bit is not a sign bit. Flags other than endian are ignored." msgstr "" +"*flags* は :c:func:`PyLong_AsNativeBytes` と同じです。\n" +"``-1`` を渡すと、CPython のコンパイル時のネイティブなエンディアンを選び、最上" +"位ビットを符号ビットではないとみなします。\n" +"エンディアン以外のフラグは無視します。" -#: ../../c-api/long.rst:168 ../../c-api/long.rst:204 msgid "" "Return a C :c:expr:`long` representation of *obj*. If *obj* is not an " "instance of :c:type:`PyLongObject`, first call its :meth:`~object.__index__` " "method (if present) to convert it to a :c:type:`PyLongObject`." msgstr "" +"*obj* を表す C の :c:expr:`long` を返します。\n" +"*obj* が :c:type:`PyLongObject` のインスタンスでない場合、まず :meth:" +"`~object.__index__` メソッド (存在する場合) を呼び出して :c:type:" +"`PyLongObject` に変換します。" #: ../../c-api/long.rst:172 msgid "" @@ -241,10 +270,8 @@ msgstr "" msgid "Use :meth:`~object.__index__` if available." msgstr "可能であれば :meth:`~object.__index__` を使うようになりました。" -#: ../../c-api/long.rst:180 ../../c-api/long.rst:218 ../../c-api/long.rst:239 -#: ../../c-api/long.rst:261 ../../c-api/long.rst:345 ../../c-api/long.rst:365 msgid "This function will no longer use :meth:`~object.__int__`." -msgstr "" +msgstr "この関数は :meth:`~object.__int__` を使わなくなりました。" #: ../../c-api/long.rst:187 msgid "" @@ -257,26 +284,34 @@ msgstr "" msgid "The function is soft deprecated." msgstr "" -#: ../../c-api/long.rst:196 msgid "" "Similar to :c:func:`PyLong_AsLong`, but store the result in a C :c:expr:" "`int` instead of a C :c:expr:`long`." msgstr "" +":c:func:`PyLong_AsLong` と同様ですが、結果を C の :c:expr:`long` ではなく :c:" +"expr:`int` に格納します。" -#: ../../c-api/long.rst:208 msgid "" "If the value of *obj* is greater than :c:macro:`LONG_MAX` or less than :c:" "macro:`LONG_MIN`, set *\\*overflow* to ``1`` or ``-1``, respectively, and " "return ``-1``; otherwise, set *\\*overflow* to ``0``. If any other " "exception occurs set *\\*overflow* to ``0`` and return ``-1`` as usual." msgstr "" +"*obj* の値が :c:macro:`LONG_MAX` より大きい場合は *\\*overflow* に ``1``、:c:" +"macro:`LONG_MIN` より小さい場合は ``-1`` を設定し、``-1`` を返します。\n" +"それ以外の場合は *\\*overflow* に ``0`` を設定します。\n" +"他の例外が発生した場合は、*\\*overflow* に ``0`` を設定し、通常どおり ``-1`` " +"を返します。" -#: ../../c-api/long.rst:227 ../../c-api/long.rst:245 msgid "" "Return a C :c:expr:`long long` representation of *obj*. If *obj* is not an " "instance of :c:type:`PyLongObject`, first call its :meth:`~object.__index__` " "method (if present) to convert it to a :c:type:`PyLongObject`." msgstr "" +"*obj* を表す C の :c:expr:`long long` を返します。\n" +"*obj* が :c:type:`PyLongObject` のインスタンスでない場合、まず :meth:" +"`~object.__index__` メソッド (存在する場合) を呼び出して :c:type:" +"`PyLongObject` に変換します。" #: ../../c-api/long.rst:231 msgid "" @@ -286,13 +321,17 @@ msgstr "" "もし *obj* の値が :c:expr:`long long` の範囲外であれば、 :exc:" "`OverflowError` を送出します。" -#: ../../c-api/long.rst:249 msgid "" "If the value of *obj* is greater than :c:macro:`LLONG_MAX` or less than :c:" "macro:`LLONG_MIN`, set *\\*overflow* to ``1`` or ``-1``, respectively, and " "return ``-1``; otherwise, set *\\*overflow* to ``0``. If any other " "exception occurs set *\\*overflow* to ``0`` and return ``-1`` as usual." msgstr "" +"*obj* の値が :c:macro:`LLONG_MAX` より大きい場合は *\\*overflow* に ``1``、:" +"c:macro:`LLONG_MIN` より小さい場合は ``-1`` を設定し、``-1`` を返します。\n" +"それ以外の場合は *\\*overflow* に ``0`` を設定します。\n" +"他の例外が発生した場合は、*\\*overflow* に ``0`` を設定し、通常どおり ``-1`` " +"を返します。" #: ../../c-api/long.rst:271 msgid "" @@ -389,12 +428,15 @@ msgstr "" "負 *pylong* を指定した際に :exc:`TypeError` ではなく、 :exc:`OverflowError` " "を送出するようになりました。" -#: ../../c-api/long.rst:332 msgid "" "Return a C :c:expr:`unsigned long` representation of *obj*. If *obj* is not " "an instance of :c:type:`PyLongObject`, first call its :meth:`~object." "__index__` method (if present) to convert it to a :c:type:`PyLongObject`." msgstr "" +"*obj* を表す C の :c:expr:`unsigned long` を返します。\n" +"*obj* が :c:type:`PyLongObject` のインスタンスでない場合、まず :meth:" +"`~object.__index__` メソッド (存在する場合) を呼び出して :c:type:" +"`PyLongObject` に変換します。" #: ../../c-api/long.rst:336 msgid "" @@ -412,12 +454,15 @@ msgstr "" "エラーが起きたときに ``(unsigned long)-1`` を返します。\n" "見分けを付けるためには :c:func:`PyErr_Occurred` を使ってください。" -#: ../../c-api/long.rst:351 msgid "" "Return a C :c:expr:`unsigned long long` representation of *obj*. If *obj* " "is not an instance of :c:type:`PyLongObject`, first call its :meth:`~object." "__index__` method (if present) to convert it to a :c:type:`PyLongObject`." msgstr "" +"*obj* を表す C の :c:expr:`unsigned long long` を返します。\n" +"*obj* が :c:type:`PyLongObject` のインスタンスでない場合、まず :meth:" +"`~object.__index__` メソッド (存在する場合) を呼び出して :c:type:" +"`PyLongObject` に変換します。" #: ../../c-api/long.rst:356 msgid "" @@ -435,42 +480,44 @@ msgstr "" "エラーが起きたときに ``(unsigned long long)-1`` を返します。\n" "見分けを付けるためには :c:func:`PyErr_Occurred` を使ってください。" -#: ../../c-api/long.rst:372 msgid "" "Set *\\*value* to a signed C :c:expr:`int32_t` or :c:expr:`int64_t` " "representation of *obj*." msgstr "" +"*\\*value* に、*obj* を表す符号付きの C の :c:expr:`int32_t` または :c:expr:" +"`int64_t` の値を設定します。" -#: ../../c-api/long.rst:375 ../../c-api/long.rst:396 msgid "If the *obj* value is out of range, raise an :exc:`OverflowError`." -msgstr "" +msgstr "*obj* の値が範囲外の場合は :exc:`OverflowError` を送出します。" -#: ../../c-api/long.rst:377 ../../c-api/long.rst:398 msgid "" "Set *\\*value* and return ``0`` on success. Set an exception and return " "``-1`` on error." msgstr "" +"成功すると *\\*value* を設定して ``0`` を返します。\n" +"エラー時には例外を設定して ``-1`` を返します。" -#: ../../c-api/long.rst:380 ../../c-api/long.rst:401 msgid "*value* must not be ``NULL``." -msgstr "" +msgstr "*value* は ``NULL`` であってはなりません。" -#: ../../c-api/long.rst:388 msgid "" "Set *\\*value* to an unsigned C :c:expr:`uint32_t` or :c:expr:`uint64_t` " "representation of *obj*." msgstr "" +"*\\*value* に、*obj* を表す符号なしの C の :c:expr:`uint32_t` または :c:expr:" +"`uint64_t` の値を設定します。" -#: ../../c-api/long.rst:391 msgid "" "If *obj* is not an instance of :c:type:`PyLongObject`, first call its :meth:" "`~object.__index__` method (if present) to convert it to a :c:type:" "`PyLongObject`." msgstr "" +"*obj* が :c:type:`PyLongObject` のインスタンスでない場合、まず :meth:" +"`~object.__index__` メソッド (存在する場合) を呼び出して :c:type:" +"`PyLongObject` に変換します。" -#: ../../c-api/long.rst:395 msgid "If *obj* is negative, raise a :exc:`ValueError`." -msgstr "" +msgstr "*obj* が負の場合は :exc:`ValueError` を送出します。" #: ../../c-api/long.rst:408 msgid "" @@ -495,17 +542,16 @@ msgstr "" "エラーが起きたときに ``-1.0`` を返します。\n" "見分けを付けるためには :c:func:`PyErr_Occurred` を使ってください。" -#: ../../c-api/long.rst:419 msgid "" "Convert a Python integer *pylong* to a C :c:expr:`void` pointer. If *pylong* " "cannot be converted, an :exc:`OverflowError` will be raised. This is only " "assured to produce a usable :c:expr:`void` pointer for values created with :" "c:func:`PyLong_FromVoidPtr`." msgstr "" -"Python の整数型を指す *pylong* を、 C の :c:expr:`void` ポインタに変換しま" -"す。 *pylong* を変換できなければ、 :exc:`OverflowError` を送出します。この関" -"数は :c:func:`PyLong_FromVoidPtr` で値を生成するときに使うような :c:expr:" -"`void` ポインタ型を生成できるだけです。" +"Python の整数 *pylong* を C の :c:expr:`void` ポインタに変換します。\n" +"*pylong* を変換できない場合は :exc:`OverflowError` を送出します。\n" +"利用可能な :c:expr:`void` ポインタが得られることを保証するのは、:c:func:" +"`PyLong_FromVoidPtr` で作成した値に対してだけです。" #: ../../c-api/long.rst:424 msgid "" @@ -514,19 +560,25 @@ msgstr "" "エラーが起きたときに ``NULL`` を返します。\n" "見分けを付けるためには :c:func:`PyErr_Occurred` を使ってください。" -#: ../../c-api/long.rst:429 msgid "" "Copy the Python integer value *pylong* to a native *buffer* of size " "*n_bytes*. The *flags* can be set to ``-1`` to behave similarly to a C cast, " "or to values documented below to control the behavior." msgstr "" +"Python の整数値 *pylong* を、サイズ *n_bytes* のネイティブな *buffer* にコ" +"ピーします。\n" +"*flags* に ``-1`` を指定すると C のキャストと同様に動作し、後述する値を指定す" +"ると動作を制御できます。" -#: ../../c-api/long.rst:433 msgid "" "Returns ``-1`` with an exception raised on error. This may happen if " "*pylong* cannot be interpreted as an integer, or if *pylong* was negative " "and the ``Py_ASNATIVEBYTES_REJECT_NEGATIVE`` flag was set." msgstr "" +"エラー時には例外を送出して ``-1`` を返します。\n" +"*pylong* を整数として解釈できない場合や、" +"``Py_ASNATIVEBYTES_REJECT_NEGATIVE`` フラグが設定されているときに *pylong* が" +"負である場合に、エラーが発生する可能性があります。" #: ../../c-api/long.rst:437 msgid "" @@ -543,25 +595,22 @@ msgid "" "style downcast." msgstr "" -#: ../../c-api/long.rst:449 msgid "" "Overflow is not considered an error. If the returned value is larger than " "*n_bytes*, most significant bits were discarded." msgstr "" +"オーバーフローはエラーとはみなしません。\n" +"戻り値が *n_bytes* より大きい場合、上位ビットは破棄されています。" -#: ../../c-api/long.rst:452 msgid "``0`` will never be returned." -msgstr "" +msgstr "``0`` を返すことはありません。" -#: ../../c-api/long.rst:454 msgid "Values are always copied as two's-complement." -msgstr "" +msgstr "値は常に 2 の補数表現でコピーします。" -#: ../../c-api/long.rst:456 msgid "Usage example::" -msgstr "" +msgstr "使用例です。 ::" -#: ../../c-api/long.rst:458 msgid "" "int32_t value;\n" "Py_ssize_t bytes = PyLong_AsNativeBytes(pylong, &value, sizeof(value), -1);\n" @@ -577,27 +626,43 @@ msgid "" " // lowest bits of pylong.\n" "}" msgstr "" +"int32_t value;\n" +"Py_ssize_t bytes = PyLong_AsNativeBytes(pylong, &value, sizeof(value), -1);\n" +"if (bytes < 0) {\n" +" // 失敗。理由を示す Python の例外が設定されています。\n" +" return NULL;\n" +"}\n" +"else if (bytes <= (Py_ssize_t)sizeof(value)) {\n" +" // 成功。\n" +"}\n" +"else {\n" +" // オーバーフローしましたが、'value' には切り詰めた\n" +" // pylong の下位ビットが格納されています。\n" +"}" -#: ../../c-api/long.rst:472 msgid "" "Passing zero to *n_bytes* will return the size of a buffer that would be " "large enough to hold the value. This may be larger than technically " "necessary, but not unreasonably so. If *n_bytes=0*, *buffer* may be ``NULL``." msgstr "" +"*n_bytes* にゼロを渡すと、値を格納するのに十分なバッファサイズを返します。\n" +"厳密に必要なサイズより大きい場合がありますが、不合理に大きくなることはありま" +"せん。\n" +"*n_bytes=0* の場合、*buffer* は ``NULL`` でも構いません。" -#: ../../c-api/long.rst:479 msgid "" "Passing *n_bytes=0* to this function is not an accurate way to determine the " "bit length of the value." msgstr "" +"この関数に *n_bytes=0* を渡しても、値の正確なビット長は求められません。" -#: ../../c-api/long.rst:482 msgid "" "To get at the entire Python value of an unknown size, the function can be " "called twice: first to determine the buffer size, then to fill it::" msgstr "" +"サイズが不明な Python の値全体を取得するには、この関数を 2 回呼び出せます。\n" +"最初にバッファサイズを調べ、次にバッファを埋めます。 ::" -#: ../../c-api/long.rst:485 msgid "" "// Ask how much space we need.\n" "Py_ssize_t expected = PyLong_AsNativeBytes(pylong, NULL, 0, -1);\n" @@ -627,19 +692,50 @@ msgid "" "// ... use bignum ...\n" "free(bignum);" msgstr "" +"// 必要な領域のサイズを調べます。\n" +"Py_ssize_t expected = PyLong_AsNativeBytes(pylong, NULL, 0, -1);\n" +"if (expected < 0) {\n" +" // 失敗。理由を示す Python の例外が設定されています。\n" +" return NULL;\n" +"}\n" +"assert(expected != 0); // API の定義上、ゼロにはなりません。\n" +"uint8_t *bignum = malloc(expected);\n" +"if (!bignum) {\n" +" PyErr_SetString(PyExc_MemoryError, \"bignum malloc failed.\");\n" +" return NULL;\n" +"}\n" +"// 値全体を安全に取得します。\n" +"Py_ssize_t bytes = PyLong_AsNativeBytes(pylong, bignum, expected, -1);\n" +"if (bytes < 0) { // 例外が設定されています。\n" +" free(bignum);\n" +" return NULL;\n" +"}\n" +"else if (bytes > expected) { // この状況は起きないはずです。\n" +" PyErr_SetString(PyExc_RuntimeError,\n" +" \"Unexpected bignum truncation after a size check.\");\n" +" free(bignum);\n" +" return NULL;\n" +"}\n" +"// 上の事前チェックから期待される成功です。\n" +"// ... bignum を使います ...\n" +"free(bignum);" -#: ../../c-api/long.rst:513 msgid "" "*flags* is either ``-1`` (``Py_ASNATIVEBYTES_DEFAULTS``) to select defaults " "that behave most like a C cast, or a combination of the other flags in the " "table below. Note that ``-1`` cannot be combined with other flags." msgstr "" +"*flags* には、C のキャストに最も近い動作をするデフォルトを選ぶ ``-1`` " +"(``Py_ASNATIVEBYTES_DEFAULTS``)、または以下の表にある他のフラグの組み合わせを" +"指定します。\n" +"``-1`` は他のフラグと組み合わせられないことに注意してください。" -#: ../../c-api/long.rst:518 msgid "" "Currently, ``-1`` corresponds to ``Py_ASNATIVEBYTES_NATIVE_ENDIAN | " "Py_ASNATIVEBYTES_UNSIGNED_BUFFER``." msgstr "" +"現在、``-1`` は ``Py_ASNATIVEBYTES_NATIVE_ENDIAN | " +"Py_ASNATIVEBYTES_UNSIGNED_BUFFER`` に相当します。" #: ../../c-api/long.rst:524 msgid "Flag" @@ -649,9 +745,8 @@ msgstr "Flag" msgid "Value" msgstr "値" -#: ../../c-api/long.rst:526 msgid "``-1``" -msgstr "" +msgstr "``-1``" #: ../../c-api/long.rst:527 msgid "``0``" @@ -673,15 +768,16 @@ msgstr "``4``" msgid "``8``" msgstr "``8``" -#: ../../c-api/long.rst:532 msgid "``16``" -msgstr "" +msgstr "``16``" -#: ../../c-api/long.rst:535 msgid "" "Specifying ``Py_ASNATIVEBYTES_NATIVE_ENDIAN`` will override any other endian " "flags. Passing ``2`` is reserved." msgstr "" +"``Py_ASNATIVEBYTES_NATIVE_ENDIAN`` を指定すると、他のエンディアンのフラグより" +"優先されます。\n" +"値 ``2`` は予約されています。" #: ../../c-api/long.rst:538 msgid "" @@ -690,7 +786,6 @@ msgid "" "(or more) in order to store a zero sign bit." msgstr "" -#: ../../c-api/long.rst:542 msgid "" "If ``Py_ASNATIVEBYTES_UNSIGNED_BUFFER`` is specified, a zero sign bit will " "be omitted from size calculations. This allows, for example, 128 to fit in a " @@ -699,16 +794,26 @@ msgid "" "handling of negative values: for those, space for a sign bit is always " "requested." msgstr "" +"``Py_ASNATIVEBYTES_UNSIGNED_BUFFER`` を指定すると、サイズの計算からゼロの符号" +"ビットを除外します。\n" +"これにより、例えば 128 を 1 バイトのバッファに収めることができます。\n" +"コピー先のバッファを後で符号付きとして扱うと、正の入力値が負になる場合があり" +"ます。\n" +"このフラグは負の値の扱いには影響せず、負の値には常に符号ビットのための領域が" +"要求されることに注意してください。" -#: ../../c-api/long.rst:549 msgid "" "Specifying ``Py_ASNATIVEBYTES_REJECT_NEGATIVE`` causes an exception to be " "set if *pylong* is negative. Without this flag, negative values will be " "copied provided there is enough space for at least one sign bit, regardless " "of whether ``Py_ASNATIVEBYTES_UNSIGNED_BUFFER`` was specified." msgstr "" +"``Py_ASNATIVEBYTES_REJECT_NEGATIVE`` を指定すると、*pylong* が負の場合に例外" +"を設定します。\n" +"このフラグを指定しない場合は、``Py_ASNATIVEBYTES_UNSIGNED_BUFFER`` の指定の有" +"無にかかわらず、少なくとも符号ビット 1 つ分の領域があれば負の値をコピーしま" +"す。" -#: ../../c-api/long.rst:554 msgid "" "If ``Py_ASNATIVEBYTES_ALLOW_INDEX`` is specified and a non-integer value is " "passed, its :meth:`~object.__index__` method will be called first. This may " @@ -717,225 +822,248 @@ msgid "" "``-1``, this option is not set, and non-integer values will raise :exc:" "`TypeError`." msgstr "" +"``Py_ASNATIVEBYTES_ALLOW_INDEX`` を指定して整数以外の値を渡すと、最初にその値" +"の :meth:`~object.__index__` メソッドを呼び出します。\n" +"その結果 Python コードが実行され、他のスレッドも実行できるようになる場合があ" +"り、使用中の他のオブジェクトや値が変化する可能性があります。\n" +"*flags* が ``-1`` の場合、このオプションは設定されず、整数以外の値は :exc:" +"`TypeError` を引き起こします。" -#: ../../c-api/long.rst:563 msgid "" "With the default *flags* (``-1``, or *UNSIGNED_BUFFER* without " "*REJECT_NEGATIVE*), multiple Python integers can map to a single value " "without overflow. For example, both ``255`` and ``-1`` fit a single-byte " "buffer and set all its bits. This matches typical C cast behavior." msgstr "" +"デフォルトの *flags* (``-1``、または *REJECT_NEGATIVE* を指定しない " +"*UNSIGNED_BUFFER*) では、複数の Python の整数が、オーバーフローせずに同じ 1 " +"つの値に対応することがあります。\n" +"例えば ``255`` と ``-1`` はどちらも 1 バイトのバッファに収まり、すべてのビッ" +"トを立てます。\n" +"これは C のキャストの典型的な動作と同じです。" -#: ../../c-api/long.rst:574 msgid "Get the sign of the integer object *obj*." -msgstr "" +msgstr "整数オブジェクト *obj* の符号を取得します。" -#: ../../c-api/long.rst:576 msgid "" "On success, set *\\*sign* to the integer sign (0, -1 or +1 for zero, " "negative or positive integer, respectively) and return 0." msgstr "" +"成功すると *\\*sign* に整数の符号 (ゼロ、負、正の整数に対してそれぞれ " +"0、-1、+1) を設定し、0 を返します。" -#: ../../c-api/long.rst:579 msgid "" "On failure, return -1 with an exception set. This function always succeeds " "if *obj* is a :c:type:`PyLongObject` or its subtype." msgstr "" +"失敗すると例外を設定して -1 を返します。\n" +"*obj* が :c:type:`PyLongObject` またはそのサブタイプであれば、この関数は常に" +"成功します。" -#: ../../c-api/long.rst:587 msgid "Check if the integer object *obj* is positive (``obj > 0``)." -msgstr "" +msgstr "整数オブジェクト *obj* が正かどうか (``obj > 0``) を調べます。" -#: ../../c-api/long.rst:589 msgid "" "If *obj* is an instance of :c:type:`PyLongObject` or its subtype, return " "``1`` when it's positive and ``0`` otherwise. Else set an exception and " "return ``-1``." msgstr "" +"*obj* が :c:type:`PyLongObject` またはそのサブタイプのインスタンスである場" +"合、正なら ``1``、それ以外なら ``0`` を返します。\n" +"それらのインスタンスでない場合は例外を設定して ``-1`` を返します。" -#: ../../c-api/long.rst:598 msgid "Check if the integer object *obj* is negative (``obj < 0``)." -msgstr "" +msgstr "整数オブジェクト *obj* が負かどうか (``obj < 0``) を調べます。" -#: ../../c-api/long.rst:600 msgid "" "If *obj* is an instance of :c:type:`PyLongObject` or its subtype, return " "``1`` when it's negative and ``0`` otherwise. Else set an exception and " "return ``-1``." msgstr "" +"*obj* が :c:type:`PyLongObject` またはそのサブタイプのインスタンスである場" +"合、負なら ``1``、それ以外なら ``0`` を返します。\n" +"それらのインスタンスでない場合は例外を設定して ``-1`` を返します。" -#: ../../c-api/long.rst:609 msgid "Check if the integer object *obj* is zero." -msgstr "" +msgstr "整数オブジェクト *obj* がゼロかどうかを調べます。" -#: ../../c-api/long.rst:611 msgid "" "If *obj* is an instance of :c:type:`PyLongObject` or its subtype, return " "``1`` when it's zero and ``0`` otherwise. Else set an exception and return " "``-1``." msgstr "" +"*obj* が :c:type:`PyLongObject` またはそのサブタイプのインスタンスである場" +"合、ゼロなら ``1``、それ以外なら ``0`` を返します。\n" +"それらのインスタンスでない場合は例外を設定して ``-1`` を返します。" -#: ../../c-api/long.rst:620 msgid "" "On success, return a read only :term:`named tuple`, that holds information " "about Python's internal representation of integers. See :data:`sys.int_info` " "for description of individual fields." msgstr "" +"成功すると、Python の整数の内部表現に関する情報を格納した、読み出し専用の :" +"term:`名前付きタプル ` を返します。\n" +"各フィールドの説明は :data:`sys.int_info` を参照してください。" -#: ../../c-api/long.rst:624 msgid "On failure, return ``NULL`` with an exception set." -msgstr "" +msgstr "失敗すると例外を設定して ``NULL`` を返します。" -#: ../../c-api/long.rst:631 msgid "Return 1 if *op* is compact, 0 otherwise." -msgstr "" +msgstr "*op* がコンパクトであれば 1、それ以外なら 0 を返します。" -#: ../../c-api/long.rst:633 msgid "" "This function makes it possible for performance-critical code to implement a " "“fast path” for small integers. For compact values use :c:func:" "`PyUnstable_Long_CompactValue`; for others fall back to a :c:func:" "`PyLong_As* ` function or :c:func:`PyLong_AsNativeBytes`." msgstr "" +"この関数を使うと、性能が重要なコードで小さい整数向けの「高速な処理経路」を実" +"装できます。\n" +"コンパクトな値には :c:func:`PyUnstable_Long_CompactValue` を使い、それ以外の" +"値には :c:func:`PyLong_As* ` 関数または :c:func:" +"`PyLong_AsNativeBytes` にフォールバックしてください。" -#: ../../c-api/long.rst:639 msgid "The speedup is expected to be negligible for most users." -msgstr "" +msgstr "ほとんどの利用者にとって、速度の向上はごくわずかと考えられます。" -#: ../../c-api/long.rst:641 msgid "" "Exactly what values are considered compact is an implementation detail and " "is subject to change." msgstr "" +"どの値をコンパクトとみなすかは実装の詳細であり、変更される可能性があります。" -#: ../../c-api/long.rst:649 msgid "" "If *op* is compact, as determined by :c:func:`PyUnstable_Long_IsCompact`, " "return its value." msgstr "" +":c:func:`PyUnstable_Long_IsCompact` で判定して *op* がコンパクトであれば、そ" +"の値を返します。" -#: ../../c-api/long.rst:652 msgid "Otherwise, the return value is undefined." -msgstr "" +msgstr "それ以外の場合、戻り値は未定義です。" -#: ../../c-api/long.rst:658 msgid "Export API" -msgstr "" +msgstr "エクスポート API" -#: ../../c-api/long.rst:664 msgid "" "Layout of an array of \"digits\" (\"limbs\" in the GMP terminology), used to " "represent absolute value for arbitrary precision integers." msgstr "" +"任意精度の整数の絶対値を表す「桁」(GMP の用語では「limb」) の配列のレイアウト" +"です。" -#: ../../c-api/long.rst:667 msgid "" "Use :c:func:`PyLong_GetNativeLayout` to get the native layout of Python :" "class:`int` objects, used internally for integers with \"big enough\" " "absolute value." msgstr "" +":c:func:`PyLong_GetNativeLayout` を使うと、Python の :class:`int` オブジェク" +"トのネイティブなレイアウトを取得できます。\n" +"これは、絶対値が「十分に大きい」整数に内部で使われるレイアウトです。" -#: ../../c-api/long.rst:671 msgid "" "See also :data:`sys.int_info` which exposes similar information in Python." msgstr "" +"Python で同様の情報を提供する :data:`sys.int_info` も参照してください。" -#: ../../c-api/long.rst:675 msgid "" "Bits per digit. For example, a 15 bit digit means that bits 0-14 contain " "meaningful information." msgstr "" +"1 桁あたりのビット数です。\n" +"例えば 15 ビットの桁では、ビット 0–14 が意味のある情報を持ちます。" -#: ../../c-api/long.rst:680 msgid "" "Digit size in bytes. For example, a 15 bit digit will require at least 2 " "bytes." msgstr "" +"バイト単位の桁のサイズです。\n" +"例えば 15 ビットの桁には少なくとも 2 バイトが必要です。" -#: ../../c-api/long.rst:685 msgid "Digits order:" -msgstr "" +msgstr "桁の順序:" -#: ../../c-api/long.rst:687 msgid "``1`` for most significant digit first" -msgstr "" +msgstr "最上位の桁が先なら ``1``" -#: ../../c-api/long.rst:688 msgid "``-1`` for least significant digit first" -msgstr "" +msgstr "最下位の桁が先なら ``-1``" -#: ../../c-api/long.rst:692 msgid "Digit endianness:" -msgstr "" +msgstr "桁のエンディアン:" -#: ../../c-api/long.rst:694 msgid "``1`` for most significant byte first (big endian)" -msgstr "" +msgstr "最上位バイトが先 (ビッグエンディアン) なら ``1``" -#: ../../c-api/long.rst:695 msgid "``-1`` for least significant byte first (little endian)" -msgstr "" +msgstr "最下位バイトが先 (リトルエンディアン) なら ``-1``" -#: ../../c-api/long.rst:700 msgid "Get the native layout of Python :class:`int` objects." msgstr "" +"Python の :class:`int` オブジェクトのネイティブなレイアウトを取得します。" #: ../../c-api/long.rst:702 msgid "See the :c:struct:`PyLongLayout` structure." msgstr "" -#: ../../c-api/long.rst:704 msgid "" "The function must not be called before Python initialization nor after " "Python finalization. The returned layout is valid until Python is finalized. " "The layout is the same for all Python sub-interpreters in a process, and so " "it can be cached." msgstr "" +"Python の初期化前や終了処理後にこの関数を呼び出してはいけません。\n" +"返されたレイアウトは Python の終了処理まで有効です。\n" +"レイアウトはプロセス内のすべての Python サブインタープリタで同じなので、" +"キャッシュできます。" -#: ../../c-api/long.rst:712 msgid "Export of a Python :class:`int` object." -msgstr "" +msgstr "Python の :class:`int` オブジェクトのエクスポートです。" -#: ../../c-api/long.rst:714 msgid "There are two cases:" -msgstr "" +msgstr "次の 2 つの場合があります:" -#: ../../c-api/long.rst:716 msgid "" "If :c:member:`digits` is ``NULL``, only use the :c:member:`value` member." msgstr "" +":c:member:`digits` が ``NULL`` の場合は、:c:member:`value` メンバーだけを使っ" +"てください。" -#: ../../c-api/long.rst:717 msgid "" "If :c:member:`digits` is not ``NULL``, use :c:member:`negative`, :c:member:" "`ndigits` and :c:member:`digits` members." msgstr "" +":c:member:`digits` が ``NULL`` でない場合は、:c:member:`negative`、:c:member:" +"`ndigits`、:c:member:`digits` メンバーを使ってください。" -#: ../../c-api/long.rst:722 msgid "" "The native integer value of the exported :class:`int` object. Only valid if :" "c:member:`digits` is ``NULL``." msgstr "" +"エクスポートした :class:`int` オブジェクトのネイティブな整数値です。\n" +":c:member:`digits` が ``NULL`` の場合だけ有効です。" -#: ../../c-api/long.rst:727 msgid "" "``1`` if the number is negative, ``0`` otherwise. Only valid if :c:member:" "`digits` is not ``NULL``." msgstr "" +"負の数なら ``1``、それ以外なら ``0`` です。\n" +":c:member:`digits` が ``NULL`` でない場合だけ有効です。" -#: ../../c-api/long.rst:732 msgid "" "Number of digits in :c:member:`digits` array. Only valid if :c:member:" "`digits` is not ``NULL``." msgstr "" +":c:member:`digits` 配列の桁数です。\n" +":c:member:`digits` が ``NULL`` でない場合だけ有効です。" -#: ../../c-api/long.rst:737 msgid "Read-only array of unsigned digits. Can be ``NULL``." msgstr "" +"符号なしの桁を格納する読み出し専用の配列です。\n" +"``NULL`` の場合もあります。" -#: ../../c-api/long.rst:742 msgid "Export a Python :class:`int` object." -msgstr "" +msgstr "Python の :class:`int` オブジェクトをエクスポートします。" #: ../../c-api/long.rst:744 msgid "" @@ -943,83 +1071,87 @@ msgid "" "by the caller. It must not be ``NULL``." msgstr "" -#: ../../c-api/long.rst:747 msgid "" "On success, fill in *\\*export_long* and return ``0``. On error, set an " "exception and return ``-1``." msgstr "" +"成功すると *\\*export_long* を埋め、``0`` を返します。\n" +"エラー時には例外を設定して ``-1`` を返します。" -#: ../../c-api/long.rst:750 msgid "" ":c:func:`PyLong_FreeExport` must be called when the export is no longer " "needed." msgstr "" +"エクスポートが不要になったら :c:func:`PyLong_FreeExport` を呼び出す必要があり" +"ます。" -#: ../../c-api/long.rst:754 msgid "" "This function always succeeds if *obj* is a Python :class:`int` object or a " "subclass." msgstr "" +"*obj* が Python の :class:`int` オブジェクトまたはそのサブクラスであれば、こ" +"の関数は常に成功します。" -#: ../../c-api/long.rst:760 msgid "Release the export *export_long* created by :c:func:`PyLong_Export`." msgstr "" +":c:func:`PyLong_Export` が作成したエクスポート *export_long* を解放します。" -#: ../../c-api/long.rst:763 msgid "" "Calling :c:func:`PyLong_FreeExport` is optional if *export_long->digits* is " "``NULL``." msgstr "" +"*export_long->digits* が ``NULL`` の場合、:c:func:`PyLong_FreeExport` の呼び" +"出しは省略できます。" -#: ../../c-api/long.rst:768 msgid "PyLongWriter API" -msgstr "" +msgstr "PyLongWriter API" -#: ../../c-api/long.rst:770 msgid "The :c:type:`PyLongWriter` API can be used to import an integer." -msgstr "" +msgstr ":c:type:`PyLongWriter` API を使って整数をインポートできます。" -#: ../../c-api/long.rst:776 msgid "A Python :class:`int` writer instance." -msgstr "" +msgstr "Python の :class:`int` ライターのインスタンスです。" -#: ../../c-api/long.rst:778 msgid "" "The instance must be destroyed by :c:func:`PyLongWriter_Finish` or :c:func:" "`PyLongWriter_Discard`." msgstr "" +"インスタンスは :c:func:`PyLongWriter_Finish` または :c:func:" +"`PyLongWriter_Discard` で破棄する必要があります。" -#: ../../c-api/long.rst:784 msgid "Create a :c:type:`PyLongWriter`." -msgstr "" +msgstr ":c:type:`PyLongWriter` を作成します。" -#: ../../c-api/long.rst:786 msgid "" "On success, allocate *\\*digits* and return a writer. On error, set an " "exception and return ``NULL``." msgstr "" +"成功すると *\\*digits* を割り当て、ライターを返します。\n" +"エラー時には例外を設定して ``NULL`` を返します。" -#: ../../c-api/long.rst:789 msgid "*negative* is ``1`` if the number is negative, or ``0`` otherwise." -msgstr "" +msgstr "*negative* は、負の数なら ``1``、それ以外なら ``0`` とします。" -#: ../../c-api/long.rst:791 msgid "" "*ndigits* is the number of digits in the *digits* array. It must be greater " "than 0." msgstr "" +"*ndigits* は *digits* 配列の桁数です。\n" +"0 より大きくなければなりません。" -#: ../../c-api/long.rst:794 msgid "*digits* must not be NULL." -msgstr "" +msgstr "*digits* は ``NULL`` であってはなりません。" -#: ../../c-api/long.rst:796 msgid "" "After a successful call to this function, the caller should fill in the " "array of digits *digits* and then call :c:func:`PyLongWriter_Finish` to get " "a Python :class:`int`. The layout of *digits* is described by :c:func:" "`PyLong_GetNativeLayout`." msgstr "" +"この関数の呼び出しが成功したら、呼び出し側は桁の配列 *digits* を埋め、:c:" +"func:`PyLongWriter_Finish` を呼び出して Python の :class:`int` を取得する必要" +"があります。\n" +"*digits* のレイアウトは :c:func:`PyLong_GetNativeLayout` で記述されます。" #: ../../c-api/long.rst:801 msgid "" @@ -1028,41 +1160,44 @@ msgid "" "digit). Any unused most significant digits must be set to ``0``." msgstr "" -#: ../../c-api/long.rst:806 msgid "" "Alternately, call :c:func:`PyLongWriter_Discard` to destroy the writer " "instance without creating an :class:`~int` object." msgstr "" +"または、:c:func:`PyLongWriter_Discard` を呼び出して、:class:`~int` オブジェク" +"トを作成せずにライターのインスタンスを破棄します。" -#: ../../c-api/long.rst:812 msgid "" "Finish a :c:type:`PyLongWriter` created by :c:func:`PyLongWriter_Create`." msgstr "" +":c:func:`PyLongWriter_Create` で作成した :c:type:`PyLongWriter` の処理を完了" +"します。" -#: ../../c-api/long.rst:814 msgid "" "On success, return a Python :class:`int` object. On error, set an exception " "and return ``NULL``." msgstr "" +"成功すると Python の :class:`int` オブジェクトを返します。\n" +"エラー時には例外を設定して ``NULL`` を返します。" -#: ../../c-api/long.rst:817 msgid "" "The function takes care of normalizing the digits and converts the object to " "a compact integer if needed." msgstr "" +"この関数は桁の正規化を行い、必要に応じてオブジェクトをコンパクトな整数に変換" +"します。" -#: ../../c-api/long.rst:820 ../../c-api/long.rst:829 msgid "The writer instance and the *digits* array are invalid after the call." -msgstr "" +msgstr "呼び出し後は、ライターのインスタンスと *digits* 配列は無効になります。" -#: ../../c-api/long.rst:825 msgid "" "Discard a :c:type:`PyLongWriter` created by :c:func:`PyLongWriter_Create`." msgstr "" +":c:func:`PyLongWriter_Create` で作成した :c:type:`PyLongWriter` を破棄しま" +"す。" -#: ../../c-api/long.rst:827 msgid "If *writer* is ``NULL``, no operation is performed." -msgstr "" +msgstr "*writer* が ``NULL`` の場合は何もしません。" #: ../../c-api/long.rst:8 msgid "object" @@ -1076,23 +1211,19 @@ msgstr "long integer" msgid "integer" msgstr "整数" -#: ../../c-api/long.rst:164 msgid "LONG_MAX (C macro)" -msgstr "" +msgstr "LONG_MAX (C マクロ)" #: ../../c-api/long.rst:164 ../../c-api/long.rst:224 ../../c-api/long.rst:267 #: ../../c-api/long.rst:282 ../../c-api/long.rst:298 ../../c-api/long.rst:314 msgid "OverflowError (built-in exception)" msgstr "OverflowError (組み込み例外)" -#: ../../c-api/long.rst:267 msgid "PY_SSIZE_T_MAX (C macro)" -msgstr "" +msgstr "PY_SSIZE_T_MAX (C マクロ)" -#: ../../c-api/long.rst:282 msgid "ULONG_MAX (C macro)" -msgstr "" +msgstr "ULONG_MAX (C マクロ)" -#: ../../c-api/long.rst:298 msgid "SIZE_MAX (C macro)" -msgstr "" +msgstr "SIZE_MAX (C マクロ)" diff --git a/c-api/mapping.po b/c-api/mapping.po index 1c5180235..9a88cc0d7 100644 --- a/c-api/mapping.po +++ b/c-api/mapping.po @@ -17,10 +17,10 @@ msgstr "" "Last-Translator: Nozomu Kaneko , 2023\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../c-api/mapping.rst:6 @@ -35,7 +35,6 @@ msgstr "" ":c:func:`PyObject_GetItem`, :c:func:`PyObject_SetItem`, :c:func:" "`PyObject_DelItem` も参照してください。" -#: ../../c-api/mapping.rst:14 msgid "" "Return ``1`` if the object provides the mapping protocol or supports " "slicing, and ``0`` otherwise. Note that it returns ``1`` for Python classes " @@ -43,6 +42,12 @@ msgid "" "to determine what type of keys the class supports. This function always " "succeeds." msgstr "" +"オブジェクトがマッピングプロトコルを提供するかスライスをサポートする場合は " +"``1`` を返し、それ以外の場合は ``0`` を返します。\n" +"クラスがサポートするキーの型を判定することは一般には不可能なため、:meth:" +"`~object.__getitem__` メソッドを持つ Python クラスのオブジェクトに対しても " +"``1`` を返します。\n" +"この関数は常に成功します。" #: ../../c-api/mapping.rst:25 msgid "" @@ -52,20 +57,21 @@ msgstr "" "成功するとオブジェクト *o* 中のキーの数を返し、失敗すると ``-1`` を返します。" "これは、Python の式 ``len(o)`` と同じになります。" -#: ../../c-api/mapping.rst:31 msgid "" "This is the same as :c:func:`PyObject_GetItem`, but *key* is specified as a :" "c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" "`PyObject*`." msgstr "" +":c:func:`PyObject_GetItem` と同じですが、``key`` は :c:expr:`PyObject*` では" +"なく、UTF-8 でエンコードした :c:expr:`const char*` のバイト列で指定します。" -#: ../../c-api/mapping.rst:38 msgid "" "Variant of :c:func:`PyObject_GetItem` which doesn't raise :exc:`KeyError` if " "the key is not found." msgstr "" +"キーが見つからない場合に :exc:`KeyError` を送出しない :c:func:" +"`PyObject_GetItem` の変種です。" -#: ../../c-api/mapping.rst:41 msgid "" "If the key is found, return ``1`` and set *\\*result* to a new :term:`strong " "reference` to the corresponding value. If the key is not found, return ``0`` " @@ -73,45 +79,60 @@ msgid "" "error other than :exc:`KeyError` is raised, return ``-1`` and set " "*\\*result* to ``NULL``." msgstr "" +"キーが見つかった場合は ``1`` を返し、対応する値への新しい :term:`強参照 " +"` を ``*result`` に設定します。\n" +"キーが見つからない場合は ``0`` を返し、``*result`` を ``NULL`` に設定して :" +"exc:`KeyError` を抑制します。\n" +":exc:`KeyError` 以外のエラーが発生した場合は ``-1`` を返し、``*result`` を " +"``NULL`` に設定します。" -#: ../../c-api/mapping.rst:53 msgid "" "This is the same as :c:func:`PyMapping_GetOptionalItem`, but *key* is " "specified as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than " "a :c:expr:`PyObject*`." msgstr "" +":c:func:`PyMapping_GetOptionalItem` と同じですが、``key`` は :c:expr:" +"`PyObject*` ではなく、UTF-8 でエンコードした :c:expr:`const char*` のバイト列" +"で指定します。" -#: ../../c-api/mapping.rst:62 msgid "" "This is the same as :c:func:`PyObject_SetItem`, but *key* is specified as a :" "c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" "`PyObject*`." msgstr "" +":c:func:`PyObject_SetItem` と同じですが、``key`` は :c:expr:`PyObject*` では" +"なく、UTF-8 でエンコードした :c:expr:`const char*` のバイト列で指定します。" -#: ../../c-api/mapping.rst:69 msgid "This is an alias of :c:func:`PyObject_DelItem`." -msgstr "" +msgstr ":c:func:`PyObject_DelItem` の別名です。" -#: ../../c-api/mapping.rst:74 msgid "" "This is the same as :c:func:`PyObject_DelItem`, but *key* is specified as a :" "c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" "`PyObject*`." msgstr "" +":c:func:`PyObject_DelItem` と同じですが、*key* は :c:expr:`PyObject*` ではな" +"く、UTF-8 でエンコードされたバイト文字列を指す :c:expr:`const char*` で指定し" +"ます。" -#: ../../c-api/mapping.rst:81 msgid "" "Return ``1`` if the mapping object has the key *key* and ``0`` otherwise. " "This is equivalent to the Python expression ``key in o``. On failure, return " "``-1``." msgstr "" +"マッピングオブジェクトがキー ``key`` を持つ場合は ``1`` を返し、それ以外の場" +"合は ``0`` を返します。\n" +"Python の式 ``key in o`` と同等です。\n" +"失敗した場合は ``-1`` を返します。" -#: ../../c-api/mapping.rst:90 msgid "" "This is the same as :c:func:`PyMapping_HasKeyWithError`, but *key* is " "specified as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than " "a :c:expr:`PyObject*`." msgstr "" +":c:func:`PyMapping_HasKeyWithError` と同じですが、``key`` は :c:expr:" +"`PyObject*` ではなく、UTF-8 でエンコードした :c:expr:`const char*` のバイト列" +"で指定します。" #: ../../c-api/mapping.rst:99 msgid "" @@ -131,12 +152,13 @@ msgid "" "`PyObject_GetItem()` instead." msgstr "" -#: ../../c-api/mapping.rst:113 msgid "" "This is the same as :c:func:`PyMapping_HasKey`, but *key* is specified as a :" "c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" "`PyObject*`." msgstr "" +":c:func:`PyMapping_HasKey` と同じですが、``key`` は :c:expr:`PyObject*` では" +"なく、UTF-8 でエンコードした :c:expr:`const char*` のバイト列で指定します。" #: ../../c-api/mapping.rst:119 msgid "" diff --git a/c-api/marshal.po b/c-api/marshal.po index 04689e3b6..c91bf4381 100644 --- a/c-api/marshal.po +++ b/c-api/marshal.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: Taichi Haradaguchi, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../c-api/marshal.rst:6 @@ -41,19 +41,21 @@ msgstr "" "加えて、データを読み戻す関数もあります。整列化されたデータを記録するファイル" "はバイナリモードで開かれていなければなりません。" -#: ../../c-api/marshal.rst:14 msgid "Numeric values are stored with the least significant byte first." -msgstr "数値は最小桁が先にくるように記録されます。" +msgstr "数値は最下位バイトから順に格納されます。" -#: ../../c-api/marshal.rst:16 msgid "" "The module supports several versions of the data format; see the :py:mod:" "`Python module documentation ` for details." msgstr "" +"このモジュールは複数のデータ形式のバージョンをサポートしています。\n" +"詳細は :py:mod:`Python モジュールのドキュメント ` を参照してくださ" +"い。" -#: ../../c-api/marshal.rst:21 msgid "The current format version. See :py:data:`marshal.version`." msgstr "" +"現在の形式のバージョン。\n" +":py:data:`marshal.version` を参照してください。" #: ../../c-api/marshal.rst:25 msgid "" diff --git a/c-api/memory.po b/c-api/memory.po index 15dc441c0..59cbcc1d2 100644 --- a/c-api/memory.po +++ b/c-api/memory.po @@ -19,10 +19,10 @@ msgstr "" "Last-Translator: tomo, 2025\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../c-api/memory.rst:8 @@ -110,7 +110,6 @@ msgstr "" "メモリ操作関数を使って安全にメモリを確保したり解放したりできます。例えば、以" "下がそのような例です::" -#: ../../c-api/memory.rst:58 msgid "" "PyObject *res;\n" "char *buf = (char *) malloc(BUFSIZ); /* for I/O */\n" @@ -122,6 +121,15 @@ msgid "" "free(buf); /* malloc'ed */\n" "return res;" msgstr "" +"PyObject *res;\n" +"char *buf = (char *) malloc(BUFSIZ); /* I/O 用 */\n" +"\n" +"if (buf == NULL)\n" +" return PyErr_NoMemory();\n" +"...buf を使って何らかの I/O 操作を行う...\n" +"res = PyBytes_FromString(buf);\n" +"free(buf); /* malloc で割り当て済み */\n" +"return res;" #: ../../c-api/memory.rst:68 msgid "" @@ -182,9 +190,8 @@ msgstr "" "生成される時と、シャットダウン時に :ref:`pymalloc メモリアロケータ " "` の統計情報を表示できます。" -#: ../../c-api/memory.rst:96 msgid "Allocator Domains" -msgstr "" +msgstr "アロケータドメイン" #: ../../c-api/memory.rst:100 msgid "" @@ -199,11 +206,9 @@ msgid "" "memory allocated using :c:func:`PyMem_Malloc`." msgstr "" -#: ../../c-api/memory.rst:109 msgid "The three allocation domains are:" -msgstr "" +msgstr "三つの割り当てドメインは次のとおりです。" -#: ../../c-api/memory.rst:111 msgid "" "Raw domain: intended for allocating memory for general-purpose memory " "buffers where the allocation *must* go to the system allocator or where the " @@ -211,59 +216,80 @@ msgid "" "is requested directly from the system. See :ref:`Raw Memory Interface `." msgstr "" +"Raw ドメイン: システムアロケータによる割り当てが *必要* な場合や、:term:`ア" +"タッチされたスレッド状態 ` なしで動作できるアロケータ" +"が必要な場合に、汎用メモリバッファを割り当てるためのものです。\n" +"メモリはシステムに直接要求します。\n" +":ref:`生メモリインターフェース ` を参照してください。" -#: ../../c-api/memory.rst:116 msgid "" "\"Mem\" domain: intended for allocating memory for Python buffers and " "general-purpose memory buffers where the allocation must be performed with " "an :term:`attached thread state`. The memory is taken from the Python " "private heap. See :ref:`Memory Interface `." msgstr "" +"Mem ドメイン: :term:`スレッド状態がアタッチされた ` 状" +"態で、Python のバッファや汎用メモリバッファを割り当てるためのものです。\n" +"メモリは Python のプライベートヒープから取得します。\n" +":ref:`メモリインターフェース ` を参照してください。" -#: ../../c-api/memory.rst:121 msgid "" "Object domain: intended for allocating memory for Python objects. The memory " "is taken from the Python private heap. See :ref:`Object allocators " "`." msgstr "" +"Object ドメイン: Python オブジェクト用のメモリを割り当てるためのものです。\n" +"メモリは Python のプライベートヒープから取得します。\n" +":ref:`オブジェクトアロケータ ` を参照してください。" -#: ../../c-api/memory.rst:126 msgid "" "The :term:`free-threaded ` build requires that only Python " "objects are allocated using the \"object\" domain and that all Python " "objects are allocated using that domain. This differs from the prior Python " "versions, where this was only a best practice and not a hard requirement." msgstr "" +":term:`フリースレッド ` ビルドでは、object ドメインで割り当て" +"るのは Python オブジェクトだけとし、すべての Python オブジェクトをそのドメイ" +"ンで割り当てる必要があります。\n" +"以前の Python では推奨事項にすぎませんでしたが、フリースレッドビルドでは必須" +"の要件です。" -#: ../../c-api/memory.rst:130 msgid "" "For example, buffers (non-Python objects) should be allocated using :c:func:" "`PyMem_Malloc`, :c:func:`PyMem_RawMalloc`, or :c:func:`malloc`, but not :c:" "func:`PyObject_Malloc`." msgstr "" +"例えば、Python オブジェクトではないバッファは :c:func:`PyObject_Malloc` では" +"なく、:c:func:`PyMem_Malloc`、:c:func:`PyMem_RawMalloc`、:c:func:`malloc` で" +"割り当ててください。" -#: ../../c-api/memory.rst:133 msgid "See :ref:`Memory Allocation APIs `." msgstr "" +":ref:`メモリ割り当て API ` を参照してくださ" +"い。" #: ../../c-api/memory.rst:139 msgid "Raw Memory Interface" msgstr "生メモリインターフェース" -#: ../../c-api/memory.rst:141 msgid "" "The following function sets are wrappers to the system allocator. These " "functions are thread-safe, so a :term:`thread state` does not need to be :" "term:`attached `." msgstr "" +"以下の関数群は、システムアロケータのラッパーです。\n" +"これらはスレッドセーフなので、:term:`スレッド状態 ` が :term:`" +"アタッチされている ` 必要はありません。" -#: ../../c-api/memory.rst:145 msgid "" "The :ref:`default raw memory allocator ` uses the " "following functions: :c:func:`malloc`, :c:func:`calloc`, :c:func:`realloc` " "and :c:func:`!free`; call ``malloc(1)`` (or ``calloc(1, 1)``) when " "requesting zero bytes." msgstr "" +":ref:`デフォルトの生メモリアロケータ ` は :c:func:" +"`malloc`、:c:func:`calloc`、:c:func:`realloc`、:c:func:`!free` を使います。\n" +"0 バイトの要求には ``malloc(1)`` または ``calloc(1, 1)`` を呼び出します。" #: ../../c-api/memory.rst:154 ../../c-api/memory.rst:224 #: ../../c-api/memory.rst:333 @@ -378,10 +404,11 @@ msgid "" "ref:`pymalloc memory allocator `." msgstr "" -#: ../../c-api/memory.rst:216 ../../c-api/memory.rst:329 msgid "" "There must be an :term:`attached thread state` when using these functions." msgstr "" +"これらの関数を使うときは :term:`スレッド状態がアタッチされている ` 必要があります。" #: ../../c-api/memory.rst:220 msgid "" @@ -456,20 +483,26 @@ msgstr "" "以下に挙げる型対象のマクロは利便性のために提供されているものです。*TYPE* は任" "意の C の型を表します。" -#: ../../c-api/memory.rst:276 msgid "" "Same as :c:func:`PyMem_Malloc`, but allocates ``(n * sizeof(TYPE))`` bytes " "of memory. Returns a pointer cast to ``TYPE*``. The memory will not have " "been initialized in any way." msgstr "" +":c:func:`PyMem_Malloc` と同じですが、``(n * sizeof(TYPE))`` バイトのメモリを" +"割り当て、``TYPE*`` にキャストしたポインタを返します。\n" +"メモリはいかなる方法でも初期化されません。" -#: ../../c-api/memory.rst:283 msgid "" "Same as :c:func:`PyMem_Realloc`, but the memory block is resized to ``(n * " "sizeof(TYPE))`` bytes. Returns a pointer cast to ``TYPE*``. On return, *p* " "will be a pointer to the new memory area, or ``NULL`` in the event of " "failure." msgstr "" +":c:func:`PyMem_Realloc` と同じですが、メモリブロックを ``(n * " +"sizeof(TYPE))`` バイトにリサイズし、``TYPE*`` にキャストしたポインタを返しま" +"す。\n" +"戻ったときの ``p`` は、新しいメモリ領域へのポインタ、または失敗した場合は " +"``NULL`` です。" #: ../../c-api/memory.rst:288 msgid "" @@ -523,13 +556,15 @@ msgstr "``PyMem_DEL(ptr)``" msgid "Object allocators" msgstr "オブジェクトアロケータ" -#: ../../c-api/memory.rst:319 msgid "" "There is no guarantee that the memory returned by these allocators can be " "successfully cast to a Python object when intercepting the allocating " "functions in this domain by the methods described in the :ref:`Customize " "Memory Allocators ` section." msgstr "" +":ref:`メモリアロケータのカスタマイズ ` で説明す" +"る方法でこのドメインの割り当て関数を差し替えて処理を挟む場合、返されるメモリ" +"を Python オブジェクトへ安全にキャストできる保証はありません。" #: ../../c-api/memory.rst:324 msgid "" @@ -596,23 +631,27 @@ msgstr "" "`PyObject_Calloc` の返した値でなければなりません。それ以外の場合や " "``PyObject_Free(p)`` を呼び出した後だった場合、未定義の動作になります。" -#: ../../c-api/memory.rst:379 msgid "" "Do not call this directly to free an object's memory; call the type's :c:" "member:`~PyTypeObject.tp_free` slot instead." msgstr "" +"オブジェクトのメモリを解放するために直接呼び出さず、代わりに型の :c:member:" +"`~PyTypeObject.tp_free` スロットを呼び出してください。" -#: ../../c-api/memory.rst:382 msgid "" "Do not use this for memory allocated by :c:macro:`PyObject_GC_New` or :c:" "macro:`PyObject_GC_NewVar`; use :c:func:`PyObject_GC_Del` instead." msgstr "" +":c:macro:`PyObject_GC_New` または :c:macro:`PyObject_GC_NewVar` で割り当てた" +"メモリには使わないでください。\n" +"代わりに :c:func:`PyObject_GC_Del` を使ってください。" -#: ../../c-api/memory.rst:387 msgid "" ":c:func:`PyObject_GC_Del` is the equivalent of this function for memory " "allocated by types that support garbage collection." msgstr "" +"ガベージコレクションをサポートする型が割り当てたメモリに対しては、:c:func:" +"`PyObject_GC_Del` がこの関数に相当します。" #: ../../c-api/memory.rst:389 ../../c-api/memory.rst:486 msgid ":c:func:`PyObject_Malloc`" @@ -626,33 +665,27 @@ msgstr ":c:func:`PyObject_Realloc`" msgid ":c:func:`PyObject_Calloc`" msgstr ":c:func:`PyObject_Calloc`" -#: ../../c-api/memory.rst:392 msgid ":c:macro:`PyObject_New`" -msgstr "" +msgstr ":c:macro:`PyObject_New`" -#: ../../c-api/memory.rst:393 msgid ":c:macro:`PyObject_NewVar`" -msgstr "" +msgstr ":c:macro:`PyObject_NewVar`" -#: ../../c-api/memory.rst:394 msgid ":c:func:`PyType_GenericAlloc`" -msgstr "" +msgstr ":c:func:`PyType_GenericAlloc`" #: ../../c-api/memory.rst:395 msgid ":c:member:`~PyTypeObject.tp_free`" msgstr ":c:member:`~PyTypeObject.tp_free`" -#: ../../c-api/memory.rst:401 msgid "Default Memory Allocators" -msgstr "" +msgstr "デフォルトのメモリアロケータ" -#: ../../c-api/memory.rst:403 msgid "Default memory allocators:" -msgstr "" +msgstr "デフォルトのメモリアロケータは次のとおりです。" -#: ../../c-api/memory.rst:406 msgid "Configuration" -msgstr "Configuration" +msgstr "設定" #: ../../c-api/memory.rst:406 msgid "Name" @@ -722,19 +755,19 @@ msgstr "``\"malloc_debug\"``" msgid "Legend:" msgstr "説明:" -#: ../../c-api/memory.rst:416 msgid "Name: value for :envvar:`PYTHONMALLOC` environment variable." -msgstr "" +msgstr "名前: 環境変数 :envvar:`PYTHONMALLOC` に指定する値。" -#: ../../c-api/memory.rst:417 msgid "" "``malloc``: system allocators from the standard C library, C functions: :c:" "func:`malloc`, :c:func:`calloc`, :c:func:`realloc` and :c:func:`free`." msgstr "" +"``malloc``: 標準 C ライブラリのシステムアロケータ。\n" +"C 関数 :c:func:`malloc`、:c:func:`calloc`、:c:func:`realloc`、:c:func:`free` " +"です。" -#: ../../c-api/memory.rst:419 msgid "``pymalloc``: :ref:`pymalloc memory allocator `." -msgstr "" +msgstr "``pymalloc``: :ref:`pymalloc メモリアロケータ `。" #: ../../c-api/memory.rst:420 msgid "" @@ -742,25 +775,27 @@ msgid "" "allocator will be used if mimalloc support isn't available." msgstr "" -#: ../../c-api/memory.rst:422 msgid "" "\"+ debug\": with :ref:`debug hooks on the Python memory allocators `." msgstr "" +"\"+ debug\": :ref:`Python メモリアロケータのデバッグフック ` 付き。" -#: ../../c-api/memory.rst:424 msgid "\"Debug build\": :ref:`Python build in debug mode `." msgstr "" +"「デバッグビルド」: :ref:`デバッグモードでの Python ビルド `。" #: ../../c-api/memory.rst:429 msgid "Customize Memory Allocators" msgstr "メモリアロケータをカスタマイズする" -#: ../../c-api/memory.rst:435 msgid "" "Structure used to describe a memory block allocator. The structure has the " "following fields:" msgstr "" +"メモリブロックのアロケータを記述する構造体です。\n" +"以下のフィールドを持ちます。" #: ../../c-api/memory.rst:439 ../../c-api/memory.rst:686 msgid "Field" @@ -810,11 +845,12 @@ msgstr "``void free(void *ctx, void *ptr)``" msgid "free a memory block" msgstr "メモリブロックを解放する" -#: ../../c-api/memory.rst:453 msgid "" "The :c:type:`!PyMemAllocator` structure was renamed to :c:type:" "`PyMemAllocatorEx` and a new ``calloc`` field was added." msgstr "" +":c:type:`!PyMemAllocator` 構造体を :c:type:`PyMemAllocatorEx` に改名し、新し" +"い ``calloc`` フィールドを追加しました。" #: ../../c-api/memory.rst:460 msgid "Enum used to identify an allocator domain. Domains:" @@ -877,19 +913,22 @@ msgstr "" "新しいアロケータは、0バイトを要求されたときユニークな ``NULL`` でないポインタ" "を返さなければなりません。" -#: ../../c-api/memory.rst:503 msgid "" "For the :c:macro:`PYMEM_DOMAIN_RAW` domain, the allocator must be thread-" "safe: a :term:`thread state` is not :term:`attached ` " "when the allocator is called." msgstr "" +":c:macro:`PYMEM_DOMAIN_RAW` ドメインでは、:term:`スレッド状態 ` が :term:`アタッチされていない ` 状態で呼び出" +"されるため、アロケータはスレッドセーフでなければなりません。" -#: ../../c-api/memory.rst:507 msgid "" "For the remaining domains, the allocator must also be thread-safe: the " "allocator may be called in different interpreters that do not share a :term:" "`GIL`." msgstr "" +"ほかのドメインでも、:term:`GIL` を共有しない異なるインタープリタから呼び出さ" +"れる場合があるため、アロケータはスレッドセーフでなければなりません。" #: ../../c-api/memory.rst:511 msgid "" @@ -901,17 +940,16 @@ msgstr "" "func:`PyMem_SetupDebugHooks` 関数を呼び出して、新しいアロケータの上にデバッグ" "フックを再度設置しなければなりません。" -#: ../../c-api/memory.rst:515 msgid "" "See also :c:member:`PyPreConfig.allocator` and :ref:`Preinitialize Python " "with PyPreConfig `." msgstr "" +":c:member:`PyPreConfig.allocator` と :ref:`PyPreConfig による Python の事前初" +"期化 ` も参照してください。" -#: ../../c-api/memory.rst:520 msgid ":c:func:`PyMem_SetAllocator` does have the following contract:" -msgstr "" +msgstr ":c:func:`PyMem_SetAllocator` には次の規約があります。" -#: ../../c-api/memory.rst:522 msgid "" "It can be called after :c:func:`Py_PreInitialize` and before :c:func:" "`Py_InitializeFromConfig` to install a custom memory allocator. There are no " @@ -920,50 +958,62 @@ msgid "" "without an :term:`attached thread state`). See :ref:`the section on " "allocator domains ` for more information." msgstr "" +":c:func:`Py_PreInitialize` の後、:c:func:`Py_InitializeFromConfig` の前に呼び" +"出すと、カスタムのメモリアロケータを設定できます。\n" +"設定するアロケータに対しては、ドメインの要件以外の制約はありません。\n" +"例えば Raw ドメインでは、:term:`アタッチされたスレッド状態 ` がなくてもアロケータを呼び出せます。\n" +"詳細は :ref:`アロケータドメインの節 ` を参照してください。" -#: ../../c-api/memory.rst:530 msgid "" "If called after Python has finish initializing (after :c:func:" "`Py_InitializeFromConfig` has been called) the allocator **must** wrap the " "existing allocator. Substituting the current allocator for some other " "arbitrary one is **not supported**." msgstr "" +"Python の初期化完了後 (:c:func:`Py_InitializeFromConfig` の呼び出し後) に呼び" +"出す場合、アロケータは既存のアロケータを **必ず** ラップしなければなりませ" +"ん。\n" +"現在のアロケータを別の任意のアロケータで置き換えることは **サポートされていま" +"せん**。" -#: ../../c-api/memory.rst:535 msgid "All allocators must be thread-safe." -msgstr "" +msgstr "すべてのアロケータがスレッドセーフである必要があります。" -#: ../../c-api/memory.rst:541 msgid "" "Setup :ref:`debug hooks in the Python memory allocators ` " "to detect memory errors." msgstr "" +"メモリエラーを検出するために :ref:`Python メモリアロケータのデバッグフック " +"` を設定します。" -#: ../../c-api/memory.rst:548 msgid "Debug hooks on the Python memory allocators" -msgstr "" +msgstr "Python メモリアロケータのデバッグフック" -#: ../../c-api/memory.rst:550 msgid "" "When :ref:`Python is built in debug mode `, the :c:func:" "`PyMem_SetupDebugHooks` function is called at the :ref:`Python " "preinitialization ` to setup debug hooks on Python memory " "allocators to detect memory errors." msgstr "" +":ref:`デバッグモードで Python をビルドした ` 場合、:ref:`Python " +"の事前初期化 ` で :c:func:`PyMem_SetupDebugHooks` を呼び出し、メモ" +"リエラーを検出するデバッグフックをメモリアロケータに設定します。" -#: ../../c-api/memory.rst:555 msgid "" "The :envvar:`PYTHONMALLOC` environment variable can be used to install debug " "hooks on a Python compiled in release mode (ex: ``PYTHONMALLOC=debug``)." msgstr "" +"リリースモードでコンパイルした Python でも、環境変数 :envvar:`PYTHONMALLOC` " +"でデバッグフックを設定できます (例: ``PYTHONMALLOC=debug``)。" -#: ../../c-api/memory.rst:558 msgid "" "The :c:func:`PyMem_SetupDebugHooks` function can be used to set debug hooks " "after calling :c:func:`PyMem_SetAllocator`." msgstr "" +":c:func:`PyMem_SetAllocator` を呼び出した後で、:c:func:" +"`PyMem_SetupDebugHooks` によってデバッグフックを設定できます。" -#: ../../c-api/memory.rst:561 msgid "" "These debug hooks fill dynamically allocated memory blocks with special, " "recognizable bit patterns. Newly allocated memory is filled with the byte " @@ -972,40 +1022,56 @@ msgid "" "bytes\" filled with the byte ``0xFD`` (``PYMEM_FORBIDDENBYTE``). Strings of " "these bytes are unlikely to be valid addresses, floats, or ASCII strings." msgstr "" +"これらのデバッグフックは、動的に割り当てられたメモリブロックを識別しやすい特" +"別なビットパターンで埋めます。\n" +"新しく割り当てたメモリはバイト ``0xCD`` (``PYMEM_CLEANBYTE``)、解放したメモリ" +"はバイト ``0xDD`` (``PYMEM_DEADBYTE``) で埋めます。\n" +"メモリブロックの前後には、バイト ``0xFD`` (``PYMEM_FORBIDDENBYTE``) で埋めた" +"「禁止バイト」を置きます。\n" +"これらのバイトの並びは、有効なアドレス、浮動小数点数、ASCII 文字列にはなりに" +"くいものです。" #: ../../c-api/memory.rst:568 msgid "Runtime checks:" msgstr "実行時チェック:" -#: ../../c-api/memory.rst:570 msgid "" "Detect API violations. For example, detect if :c:func:`PyObject_Free` is " "called on a memory block allocated by :c:func:`PyMem_Malloc`." msgstr "" +"API の誤用を検出します。\n" +"例えば、:c:func:`PyMem_Malloc` で割り当てたメモリブロックに :c:func:" +"`PyObject_Free` を呼び出した場合を検出します。" -#: ../../c-api/memory.rst:572 msgid "Detect write before the start of the buffer (buffer underflow)." msgstr "" +"バッファの先頭より前への書き込み (バッファアンダーフロー) を検出します。" -#: ../../c-api/memory.rst:573 msgid "Detect write after the end of the buffer (buffer overflow)." msgstr "" +"バッファの末尾より後への書き込み (バッファオーバーフロー) を検出します。" -#: ../../c-api/memory.rst:574 msgid "" "Check that there is an :term:`attached thread state` when allocator " "functions of :c:macro:`PYMEM_DOMAIN_OBJ` (ex: :c:func:`PyObject_Malloc`) " "and :c:macro:`PYMEM_DOMAIN_MEM` (ex: :c:func:`PyMem_Malloc`) domains are " "called." msgstr "" +":c:macro:`PYMEM_DOMAIN_OBJ` (例: :c:func:`PyObject_Malloc`) と :c:macro:" +"`PYMEM_DOMAIN_MEM` (例: :c:func:`PyMem_Malloc`) のアロケータ関数を呼び出すと" +"きに、:term:`スレッド状態がアタッチされている ` ことを" +"確認します。" -#: ../../c-api/memory.rst:579 msgid "" "On error, the debug hooks use the :mod:`tracemalloc` module to get the " "traceback where a memory block was allocated. The traceback is only " "displayed if :mod:`tracemalloc` is tracing Python memory allocations and the " "memory block was traced." msgstr "" +"エラーの場合、デバッグフックは :mod:`tracemalloc` を使って、メモリブロックを" +"割り当てた箇所のトレースバックを取得します。\n" +"表示されるのは、:mod:`tracemalloc` が Python のメモリ割り当てを追跡しており、" +"そのブロックが追跡対象だった場合だけです。" #: ../../c-api/memory.rst:584 msgid "" @@ -1019,47 +1085,44 @@ msgstr "" #: ../../c-api/memory.rst:590 msgid "``p[-2*S:-S]``" -msgstr "" +msgstr "``p[-2*S:-S]``" -#: ../../c-api/memory.rst:591 msgid "" "Number of bytes originally asked for. This is a size_t, big-endian (easier " "to read in a memory dump)." msgstr "" +"元の要求バイト数です。\n" +"メモリダンプで読みやすいように、ビッグエンディアンの size_t で格納します。" #: ../../c-api/memory.rst:593 msgid "``p[-S]``" -msgstr "" +msgstr "``p[-S]``" -#: ../../c-api/memory.rst:594 msgid "API identifier (ASCII character):" -msgstr "" +msgstr "API 識別子 (ASCII 文字)。" -#: ../../c-api/memory.rst:596 msgid "``'r'`` for :c:macro:`PYMEM_DOMAIN_RAW`." -msgstr "" +msgstr ":c:macro:`PYMEM_DOMAIN_RAW` は ``'r'``。" -#: ../../c-api/memory.rst:597 msgid "``'m'`` for :c:macro:`PYMEM_DOMAIN_MEM`." -msgstr "" +msgstr ":c:macro:`PYMEM_DOMAIN_MEM` は ``'m'``。" -#: ../../c-api/memory.rst:598 msgid "``'o'`` for :c:macro:`PYMEM_DOMAIN_OBJ`." -msgstr "" +msgstr ":c:macro:`PYMEM_DOMAIN_OBJ` は ``'o'``。" #: ../../c-api/memory.rst:600 msgid "``p[-S+1:0]``" -msgstr "" +msgstr "``p[-S+1:0]``" -#: ../../c-api/memory.rst:601 msgid "Copies of PYMEM_FORBIDDENBYTE. Used to catch under- writes and reads." msgstr "" +"PYMEM_FORBIDDENBYTE の繰り返しです。\n" +"領域の手前への書き込みや読み取りを検出するために使います。" #: ../../c-api/memory.rst:603 msgid "``p[0:N]``" -msgstr "" +msgstr "``p[0:N]``" -#: ../../c-api/memory.rst:604 msgid "" "The requested memory, filled with copies of PYMEM_CLEANBYTE, used to catch " "reference to uninitialized memory. When a realloc-like function is called " @@ -1069,26 +1132,35 @@ msgid "" "like function is called requesting a smaller memory block, the excess old " "bytes are also filled with PYMEM_DEADBYTE." msgstr "" +"要求されたメモリ領域は、未初期化メモリへのアクセスを検出するために " +"PYMEM_CLEANBYTE で埋めます。\n" +"realloc 系の関数で領域を拡大した場合、追加部分も PYMEM_CLEANBYTE で埋めま" +"す。\n" +"free 系の関数を呼び出すと、解放済みメモリへのアクセスを検出するために " +"PYMEM_DEADBYTE で上書きします。\n" +"realloc 系の関数で領域を縮小した場合も、不要になった元の領域を " +"PYMEM_DEADBYTE で埋めます。" #: ../../c-api/memory.rst:612 msgid "``p[N:N+S]``" -msgstr "" +msgstr "``p[N:N+S]``" -#: ../../c-api/memory.rst:613 msgid "Copies of PYMEM_FORBIDDENBYTE. Used to catch over- writes and reads." msgstr "" +"PYMEM_FORBIDDENBYTE の繰り返しです。\n" +"領域の後ろへの書き込みや読み取りを検出するために使います。" #: ../../c-api/memory.rst:615 msgid "``p[N+S:N+2*S]``" -msgstr "" +msgstr "``p[N+S:N+2*S]``" -#: ../../c-api/memory.rst:616 msgid "" "Only used if the ``PYMEM_DEBUG_SERIALNO`` macro is defined (not defined by " "default)." msgstr "" +"``PYMEM_DEBUG_SERIALNO`` マクロが定義されている場合だけ使います (デフォルトで" +"は未定義)。" -#: ../../c-api/memory.rst:619 msgid "" "A serial number, incremented by 1 on each call to a malloc-like or realloc-" "like function. Big-endian :c:type:`size_t`. If \"bad memory\" is detected " @@ -1097,8 +1169,13 @@ msgid "" "static function bumpserialno() in obmalloc.c is the only place the serial " "number is incremented, and exists so you can set such a breakpoint easily." msgstr "" +"malloc 系または realloc 系の関数の呼び出しごとに 1 増える通し番号です。\n" +"ビッグエンディアンの :c:type:`size_t` で格納します。\n" +"後で「不正なメモリ」を検出した場合、この番号を使って次回の実行でブレークポイ" +"ントを設定すると、そのブロックを渡した瞬間を捉えられます。\n" +"obmalloc.c の静的関数 bumpserialno() だけがこの番号を増やし、そのようなブレー" +"クポイントを簡単に設定できるようになっています。" -#: ../../c-api/memory.rst:626 msgid "" "A realloc-like or free-like function first checks that the " "PYMEM_FORBIDDENBYTE bytes at each end are intact. If they've been altered, " @@ -1110,8 +1187,16 @@ msgid "" "memory is getting used) or PYMEM_CLEANBYTE (meaning uninitialized memory is " "getting used)." msgstr "" +"realloc 系や free 系の関数は、まず領域の前後の PYMEM_FORBIDDENBYTE が変わって" +"いないことを確認します。\n" +"変更されていれば stderr に診断情報を出力し、Py_FatalError() でプログラムを中" +"止します。\n" +"もう一つの主な失敗の形は、プログラムが特別なビットパターンを読み取り、アドレ" +"スとして使おうとしてメモリエラーになることです。\n" +"その時点でデバッガからオブジェクトを調べると、全体が PYMEM_DEADBYTE (解放済み" +"メモリを使用) または PYMEM_CLEANBYTE (未初期化メモリを使用) で埋まっている可" +"能性が高いです。" -#: ../../c-api/memory.rst:635 msgid "" "The :c:func:`PyMem_SetupDebugHooks` function now also works on Python " "compiled in release mode. On error, the debug hooks now use :mod:" @@ -1120,14 +1205,24 @@ msgid "" "functions of :c:macro:`PYMEM_DOMAIN_OBJ` and :c:macro:`PYMEM_DOMAIN_MEM` " "domains are called." msgstr "" +":c:func:`PyMem_SetupDebugHooks` はリリースモードでコンパイルした Python でも" +"動作するようになりました。\n" +"エラーの場合、デバッグフックは :mod:`tracemalloc` を使って割り当て箇所のト" +"レースバックを取得するようになりました。\n" +"また、:c:macro:`PYMEM_DOMAIN_OBJ` と :c:macro:`PYMEM_DOMAIN_MEM` の関数を呼び" +"出すときに、:term:`スレッド状態がアタッチされている ` " +"ことも確認するようになりました。" -#: ../../c-api/memory.rst:643 msgid "" "Byte patterns ``0xCB`` (``PYMEM_CLEANBYTE``), ``0xDB`` (``PYMEM_DEADBYTE``) " "and ``0xFB`` (``PYMEM_FORBIDDENBYTE``) have been replaced with ``0xCD``, " "``0xDD`` and ``0xFD`` to use the same values than Windows CRT debug " "``malloc()`` and ``free()``." msgstr "" +"Windows CRT のデバッグ版 ``malloc()`` と ``free()`` と同じ値を使うため、バイ" +"トパターン ``0xCB`` (``PYMEM_CLEANBYTE``)、``0xDB`` (``PYMEM_DEADBYTE``)、" +"``0xFB`` (``PYMEM_FORBIDDENBYTE``) を、それぞれ ``0xCD``、``0xDD``、``0xFD`` " +"に変更しました。" #: ../../c-api/memory.rst:653 msgid "The pymalloc allocator" @@ -1153,24 +1248,25 @@ msgstr "" msgid "The arena allocator uses the following functions:" msgstr "アリーナアロケータは、次の関数を使います:" -#: ../../c-api/memory.rst:667 msgid ":c:func:`!VirtualAlloc` and :c:func:`!VirtualFree` on Windows," -msgstr "" +msgstr "Windows では :c:func:`!VirtualAlloc` と :c:func:`!VirtualFree`。" -#: ../../c-api/memory.rst:668 msgid ":c:func:`!mmap` and :c:func:`!munmap` if available," -msgstr "" +msgstr "利用可能なら :c:func:`!mmap` と :c:func:`!munmap`。" #: ../../c-api/memory.rst:669 msgid ":c:func:`malloc` and :c:func:`free` otherwise." msgstr "それ以外の場合は :c:func:`malloc` と :c:func:`free`。" -#: ../../c-api/memory.rst:671 msgid "" "This allocator is disabled if Python is configured with the :option:`--" "without-pymalloc` option. It can also be disabled at runtime using the :" "envvar:`PYTHONMALLOC` environment variable (ex: ``PYTHONMALLOC=malloc``)." msgstr "" +":option:`--without-pymalloc` オプションで Python を構成した場合、このアロケー" +"タは無効になります。\n" +"環境変数 :envvar:`PYTHONMALLOC` で実行時に無効にすることもできます (例: " +"``PYTHONMALLOC=malloc``)。" #: ../../c-api/memory.rst:676 msgid "Customize pymalloc Arena Allocator" @@ -1191,9 +1287,8 @@ msgstr "``void* alloc(void *ctx, size_t size)``" msgid "allocate an arena of size bytes" msgstr "size バイトのアリーナを割り当てます" -#: ../../c-api/memory.rst:692 msgid "``void free(void *ctx, void *ptr, size_t size)``" -msgstr "" +msgstr "``void free(void *ctx, void *ptr, size_t size)``" #: ../../c-api/memory.rst:692 msgid "free an arena" @@ -1207,9 +1302,8 @@ msgstr "アリーナアロケータを取得します。" msgid "Set the arena allocator." msgstr "アリーナアロケータを設定します。" -#: ../../c-api/memory.rst:706 msgid "The mimalloc allocator" -msgstr "" +msgstr "mimalloc アロケータ" #: ../../c-api/memory.rst:710 msgid "" @@ -1223,29 +1317,32 @@ msgstr "" msgid "tracemalloc C API" msgstr "tracemalloc C API" -#: ../../c-api/memory.rst:721 msgid "Track an allocated memory block in the :mod:`tracemalloc` module." msgstr "" +"割り当てられたメモリブロックを :mod:`tracemalloc` モジュールで追跡します。" -#: ../../c-api/memory.rst:723 msgid "" "Return ``0`` on success, return ``-1`` on error (failed to allocate memory " "to store the trace). Return ``-2`` if tracemalloc is disabled." msgstr "" +"成功した場合は ``0`` を返し、エラーの場合 (トレースを格納するメモリを割り当て" +"られなかった場合) は ``-1`` を返します。\n" +"tracemalloc が無効なら ``-2`` を返します。" -#: ../../c-api/memory.rst:726 msgid "If memory block is already tracked, update the existing trace." msgstr "" +"そのメモリブロックがすでに追跡されていれば、既存のトレースを更新します。" -#: ../../c-api/memory.rst:730 msgid "" "Untrack an allocated memory block in the :mod:`tracemalloc` module. Do " "nothing if the block was not tracked." msgstr "" +"割り当てられたメモリブロックを :mod:`tracemalloc` モジュールの追跡対象から外" +"します。\n" +"追跡されていなければ何もしません。" -#: ../../c-api/memory.rst:733 msgid "Return ``-2`` if tracemalloc is disabled, otherwise return ``0``." -msgstr "" +msgstr "tracemalloc が無効なら ``-2``、それ以外の場合は ``0`` を返します。" #: ../../c-api/memory.rst:739 msgid "Examples" @@ -1260,7 +1357,6 @@ msgstr "" "最初に述べた関数セットを使って、 :ref:`memoryoverview` 節の例を Python ヒープ" "に I/O バッファをメモリ確保するように書き換えたものを以下に示します::" -#: ../../c-api/memory.rst:744 msgid "" "PyObject *res;\n" "char *buf = (char *) PyMem_Malloc(BUFSIZ); /* for I/O */\n" @@ -1272,12 +1368,20 @@ msgid "" "PyMem_Free(buf); /* allocated with PyMem_Malloc */\n" "return res;" msgstr "" +"PyObject *res;\n" +"char *buf = (char *) PyMem_Malloc(BUFSIZ); /* I/O 用 */\n" +"\n" +"if (buf == NULL)\n" +" return PyErr_NoMemory();\n" +"/* ...buf を使って何らかの I/O 操作を行う... */\n" +"res = PyBytes_FromString(buf);\n" +"PyMem_Free(buf); /* PyMem_Malloc で割り当て済み */\n" +"return res;" #: ../../c-api/memory.rst:754 msgid "The same code using the type-oriented function set::" msgstr "同じコードを型対象の関数セットで書いたものを以下に示します::" -#: ../../c-api/memory.rst:756 msgid "" "PyObject *res;\n" "char *buf = PyMem_New(char, BUFSIZ); /* for I/O */\n" @@ -1289,6 +1393,15 @@ msgid "" "PyMem_Free(buf); /* allocated with PyMem_New */\n" "return res;" msgstr "" +"PyObject *res;\n" +"char *buf = PyMem_New(char, BUFSIZ); /* I/O 用 */\n" +"\n" +"if (buf == NULL)\n" +" return PyErr_NoMemory();\n" +"/* ...buf を使って何らかの I/O 操作を行う... */\n" +"res = PyBytes_FromString(buf);\n" +"PyMem_Free(buf); /* PyMem_New で割り当て済み */\n" +"return res;" #: ../../c-api/memory.rst:766 msgid "" @@ -1317,12 +1430,14 @@ msgid "" "free(buf1); /* Fatal -- should be PyMem_Free() */" msgstr "" -#: ../../c-api/memory.rst:781 msgid "" "In addition to the functions aimed at handling raw memory blocks from the " "Python heap, objects in Python are allocated and released with :c:macro:" "`PyObject_New`, :c:macro:`PyObject_NewVar` and :c:func:`PyObject_Free`." msgstr "" +"Python ヒープの生メモリブロックを扱う関数に加えて、Python オブジェクトの割り" +"当てと解放には :c:macro:`PyObject_New`、:c:macro:`PyObject_NewVar`、:c:func:" +"`PyObject_Free` を使います。" #: ../../c-api/memory.rst:785 msgid "" @@ -1332,18 +1447,14 @@ msgstr "" "これらの関数については、次章の C による新しいオブジェクト型の定義や実装に関す" "る記述の中で説明します。" -#: ../../c-api/memory.rst:43 msgid "malloc (C function)" -msgstr "" +msgstr "malloc (C 関数)" -#: ../../c-api/memory.rst:43 msgid "calloc (C function)" -msgstr "" +msgstr "calloc (C 関数)" -#: ../../c-api/memory.rst:43 msgid "realloc (C function)" -msgstr "" +msgstr "realloc (C 関数)" -#: ../../c-api/memory.rst:43 msgid "free (C function)" -msgstr "" +msgstr "free (C 関数)" diff --git a/c-api/memoryview.po b/c-api/memoryview.po index 1d7144794..a14ed9a6d 100644 --- a/c-api/memoryview.po +++ b/c-api/memoryview.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: Osamu NAKAMURA, 2023\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../c-api/memoryview.rst:9 @@ -50,13 +50,11 @@ msgstr "" "ら、その memoryview オブジェクトは読み書き可能です。そうでなければ読出しのみ" "になるか、エクスポーターの分別にもとづいて読み書きが可能となります。" -#: ../../c-api/memoryview.rst:26 msgid "Flag to request a readonly buffer." -msgstr "" +msgstr "読み取り専用のバッファを要求するフラグ。" -#: ../../c-api/memoryview.rst:31 msgid "Flag to request a writable buffer." -msgstr "" +msgstr "書き込み可能なバッファを要求するフラグ。" #: ../../c-api/memoryview.rst:36 msgid "" @@ -90,10 +88,11 @@ msgstr "" "メモリを参照します。それ以外の場合、メモリはコピーされて、 memoryview オブ" "ジェクトは新しい bytes オブジェクトを参照します。" -#: ../../c-api/memoryview.rst:55 msgid "" "*buffertype* can be one of :c:macro:`PyBUF_READ` or :c:macro:`PyBUF_WRITE`." msgstr "" +"*buffertype* には :c:macro:`PyBUF_READ` または :c:macro:`PyBUF_WRITE` を指定" +"できます。" #: ../../c-api/memoryview.rst:60 msgid "" @@ -105,29 +104,28 @@ msgstr "" "`memoryview` のサブクラスの作成は許可されていません。この関数は常に成功しま" "す。" -#: ../../c-api/memoryview.rst:67 msgid "" "Return a pointer to the memoryview's private copy of the exporter's buffer. " "*mview* **must** be a memoryview instance; this macro doesn't check its " "type, you must do it yourself or you will risk crashes." msgstr "" -"書きだされたバッファーの memoryview のプライベート コピーに、ポインターを返し" -"ます。\n" -"*mview* は memoryview インスタンスでなければなりません;\n" -"このマクロは型をチェックしないので自前で型チェックしなければならず、それを怠" -"るとクラッシュする恐れがあります。" +"memoryview が内部に保持する、エクスポーターのバッファ情報のコピーへのポインタ" +"を返します。\n" +"*mview* は memoryview インスタンスで **なければなりません**。\n" +"このマクロは型を確認しないため、自分で確認しなければクラッシュするおそれがあ" +"ります。" -#: ../../c-api/memoryview.rst:73 msgid "" "Return either a pointer to the exporting object that the memoryview is based " "on or ``NULL`` if the memoryview has been created by one of the functions :c:" "func:`PyMemoryView_FromMemory` or :c:func:`PyMemoryView_FromBuffer`. *mview* " "**must** be a memoryview instance." msgstr "" -"memoryview をエクスポートしているオブジェクトへのポインタを返します。\n" -"memoryview が :c:func:`PyMemoryView_FromMemory` か :c:func:" -"`PyMemoryView_FromBuffer` のどちらかで作成されていた場合、 ``NULL`` を返しま" -"す。" +"memoryview の元になるバッファをエクスポートしているオブジェクトへのポインタを" +"返します。\n" +"memoryview を :c:func:`PyMemoryView_FromMemory` または :c:func:" +"`PyMemoryView_FromBuffer` で作成した場合は、``NULL`` を返します。\n" +"*mview* は memoryview インスタンスで **なければなりません**。" #: ../../c-api/memoryview.rst:5 msgid "object" diff --git a/c-api/method.po b/c-api/method.po index 749aa75b6..205318fe3 100644 --- a/c-api/method.po +++ b/c-api/method.po @@ -17,22 +17,24 @@ msgstr "" "Last-Translator: tomo, 2023\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../c-api/method.rst:6 msgid "Instance Method Objects" msgstr "インスタンスメソッドオブジェクト(Instance Method Objects)" -#: ../../c-api/method.rst:10 msgid "" "An instance method is a wrapper for a :c:type:`PyCFunction` and the new way " "to bind a :c:type:`PyCFunction` to a class object. It replaces the former " "call ``PyMethod_New(func, NULL, class)``." msgstr "" +"インスタンスメソッドは :c:type:`PyCFunction` のラッパーであり、:c:type:" +"`PyCFunction` をクラスオブジェクトに束縛する新しい方法です。\n" +"以前の ``PyMethod_New(func, NULL, class)`` 呼び出しに代わるものです。" #: ../../c-api/method.rst:17 msgid "" @@ -78,15 +80,15 @@ msgstr "" msgid "Method Objects" msgstr "メソッドオブジェクト" -#: ../../c-api/method.rst:52 msgid "" "Methods are bound function objects. Methods are always bound to an instance " "of a user-defined class. Unbound methods (methods bound to a class object) " "are no longer available." msgstr "" -"メソッドは関数オブジェクトに束縛されています。メソッドは常にあるユーザー定義" -"のクラスに束縛されているのです。束縛されていないメソッド(クラスオブジェクトに" -"束縛されたメソッド)は利用することができません。" +"メソッドは、束縛された関数オブジェクトです。\n" +"メソッドは常にユーザー定義クラスのインスタンスに束縛されます。\n" +"非束縛メソッド (クラスオブジェクトに束縛されたメソッド) は、もはや利用できま" +"せん。" #: ../../c-api/method.rst:61 msgid "" diff --git a/c-api/module.po b/c-api/module.po index bc8b76c3b..5d83c9b36 100644 --- a/c-api/module.po +++ b/c-api/module.po @@ -19,10 +19,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../c-api/module.rst:6 @@ -54,7 +54,6 @@ msgstr "" "*p* がモジュールオブジェクトで、かつ :c:data:`PyModule_Type` のサブタイプでな" "いときに真を返します。この関数は常に成功します。" -#: ../../c-api/module.rst:40 msgid "" "Return a new module object with :attr:`module.__name__` set to *name*. The " "module's :attr:`!__name__`, :attr:`~module.__doc__`, :attr:`~module." @@ -62,17 +61,22 @@ msgid "" "but :attr:`!__name__` are set to ``None``). The caller is responsible for " "setting a :attr:`~module.__file__` attribute." msgstr "" +":attr:`module.__name__` に *name* を設定した新しいモジュールオブジェクトを返" +"します。\n" +"モジュールの :attr:`!__name__`、:attr:`~module.__doc__`、:attr:`~module." +"__package__`、:attr:`~module.__loader__` 属性を設定します (:attr:`!__name__` " +"以外はすべて ``None`` に設定します)。\n" +":attr:`~module.__file__` 属性の設定は呼び出し側の責任です。" -#: ../../c-api/module.rst:46 ../../c-api/module.rst:272 -#: ../../c-api/module.rst:474 msgid "Return ``NULL`` with an exception set on error." -msgstr "" +msgstr "エラー時には例外を設定して ``NULL`` を返します。" -#: ../../c-api/module.rst:50 msgid "" ":attr:`~module.__package__` and :attr:`~module.__loader__` are now set to " "``None``." msgstr "" +":attr:`~module.__package__` と :attr:`~module.__loader__` を ``None`` に設定" +"するようになりました。" #: ../../c-api/module.rst:57 msgid "" @@ -104,12 +108,14 @@ msgstr "" "拡張モジュールでは、モジュールの :attr:`~object.__dict__` を直接操作するより" "も、 ``PyModule_*`` および ``PyObject_*`` 関数を使う方が推奨されます。" -#: ../../c-api/module.rst:81 msgid "" "Return *module*'s :attr:`~module.__name__` value. If the module does not " "provide one, or if it is not a string, :exc:`SystemError` is raised and " "``NULL`` is returned." msgstr "" +"*module* の :attr:`~module.__name__` の値を返します。\n" +"この属性がない場合や文字列でない場合は、:exc:`SystemError` を送出して " +"``NULL`` を返します。" #: ../../c-api/module.rst:90 msgid "" @@ -138,13 +144,17 @@ msgstr "" "ます。\n" "モジュールが定義によって作られていなかった場合は ``NULL`` を返します。" -#: ../../c-api/module.rst:112 msgid "" "Return the name of the file from which *module* was loaded using *module*'s :" "attr:`~module.__file__` attribute. If this is not defined, or if it is not " "a string, raise :exc:`SystemError` and return ``NULL``; otherwise return a " "reference to a Unicode object." msgstr "" +"*module* の :attr:`~module.__file__` 属性を使って、*module* をロードしたファ" +"イルの名前を返します。\n" +"この属性が定義されていない場合や文字列でない場合は、:exc:`SystemError` を送出" +"して ``NULL`` を返します。\n" +"それ以外の場合は Unicode オブジェクトへの参照を返します。" #: ../../c-api/module.rst:122 msgid "" @@ -497,15 +507,14 @@ msgstr "" "これは新しいモジュールオブジェクトを返すか、エラーを設定して ``NULL`` を返す" "べきです。" -#: ../../c-api/module.rst:355 msgid "" "This function should be kept minimal. In particular, it should not call " "arbitrary Python code, as trying to import the same module again may result " "in an infinite loop." msgstr "" -"この関数は最小限に留めておくべきです。\n" -"特に任意のPythonコードを呼び出すべきではなく、同じモジュールをインポートしよ" -"うとすると無限ループに陥るでしょう。" +"この関数の処理は最小限に留めてください。\n" +"特に、同じモジュールを再びインポートしようとすると無限ループに陥る可能性があ" +"るため、任意の Python コードを呼び出してはいけません。" #: ../../c-api/module.rst:359 msgid "" @@ -570,27 +579,30 @@ msgstr "" msgid "Specifies one of the following values:" msgstr "" -#: ../../c-api/module.rst:397 msgid "The module does not support being imported in subinterpreters." -msgstr "" +msgstr "モジュールはサブインタープリタでのインポートに対応していません。" -#: ../../c-api/module.rst:401 msgid "" "The module supports being imported in subinterpreters, but only when they " "share the main interpreter's GIL. (See :ref:`isolating-extensions-howto`.)" msgstr "" +"モジュールはサブインタープリタでのインポートに対応していますが、メインイン" +"タープリタの GIL を共有している場合に限ります (:ref:`isolating-extensions-" +"howto` を参照)。" -#: ../../c-api/module.rst:407 msgid "" "The module supports being imported in subinterpreters, even when they have " "their own GIL. (See :ref:`isolating-extensions-howto`.)" msgstr "" +"モジュールは、サブインタープリタが独自の GIL を持つ場合も、サブインタープリタ" +"でのインポートに対応しています (:ref:`isolating-extensions-howto` を参照)。" -#: ../../c-api/module.rst:411 msgid "" "This slot determines whether or not importing this module in a " "subinterpreter will fail." msgstr "" +"このスロットは、このモジュールをサブインタープリタでインポートすると失敗する" +"かどうかを決めます。" #: ../../c-api/module.rst:414 msgid "" @@ -598,40 +610,46 @@ msgid "" "module definition." msgstr "" -#: ../../c-api/module.rst:417 msgid "" "If ``Py_mod_multiple_interpreters`` is not specified, the import machinery " "defaults to ``Py_MOD_MULTIPLE_INTERPRETERS_SUPPORTED``." msgstr "" +"``Py_mod_multiple_interpreters`` を指定しない場合、インポート機構はデフォルト" +"で ``Py_MOD_MULTIPLE_INTERPRETERS_SUPPORTED`` を使います。" -#: ../../c-api/module.rst:430 msgid "" "The module depends on the presence of the global interpreter lock (GIL), and " "may access global state without synchronization." msgstr "" +"モジュールはグローバルインタープリタロック (GIL) の存在に依存し、同期せずにグ" +"ローバルな状態にアクセスする場合があります。" -#: ../../c-api/module.rst:435 msgid "The module is safe to run without an active GIL." -msgstr "" +msgstr "モジュールは GIL が有効でなくても安全に実行できます。" -#: ../../c-api/module.rst:437 msgid "" "This slot is ignored by Python builds not configured with :option:`--disable-" "gil`. Otherwise, it determines whether or not importing this module will " "cause the GIL to be automatically enabled. See :ref:`whatsnew313-free-" "threaded-cpython` for more detail." msgstr "" +":option:`--disable-gil` を指定せずに構成した Python ビルドでは、このスロット" +"は無視されます。\n" +"それ以外のビルドでは、このモジュールのインポートによって GIL が自動的に有効に" +"なるかどうかを決めます。\n" +"詳細は :ref:`whatsnew313-free-threaded-cpython` を参照してください。" #: ../../c-api/module.rst:442 msgid "" "Multiple ``Py_mod_gil`` slots may not be specified in one module definition." msgstr "" -#: ../../c-api/module.rst:444 msgid "" "If ``Py_mod_gil`` is not specified, the import machinery defaults to " "``Py_MOD_GIL_USED``." msgstr "" +"``Py_mod_gil`` を指定しない場合、インポート機構はデフォルトで " +"``Py_MOD_GIL_USED`` を使います。" #: ../../c-api/module.rst:449 msgid "See :PEP:`489` for more details on multi-phase initialization." @@ -767,13 +785,26 @@ msgid "" " return res;\n" " }" msgstr "" +"static int\n" +"add_spam(PyObject *module, int value)\n" +"{\n" +" PyObject *obj = PyLong_FromLong(value);\n" +" if (obj == NULL) {\n" +" return -1;\n" +" }\n" +" int res = PyModule_AddObjectRef(module, \"spam\", obj);\n" +" Py_DECREF(obj);\n" +" return res;\n" +" }" -#: ../../c-api/module.rst:540 msgid "" "To be convenient, the function accepts ``NULL`` *value* with an exception " "set. In this case, return ``-1`` and just leave the raised exception " "unchanged." msgstr "" +"使いやすいように、例外が設定されていれば *value* に ``NULL`` を受け付けま" +"す。\n" +"この場合は ``-1`` を返し、送出された例外はそのままにします。" #: ../../c-api/module.rst:544 msgid "" @@ -794,6 +825,14 @@ msgid "" " return res;\n" " }" msgstr "" +"static int\n" +"add_spam(PyObject *module, int value)\n" +"{\n" +" PyObject *obj = PyLong_FromLong(value);\n" +" int res = PyModule_AddObjectRef(module, \"spam\", obj);\n" +" Py_XDECREF(obj);\n" +" return res;\n" +" }" #: ../../c-api/module.rst:556 msgid "" @@ -803,7 +842,6 @@ msgstr "" "この場合は、 *obj* が ``NULL`` でありうるため、 ``Py_DECREF()`` の代わりに " "``Py_XDECREF()`` を呼び出す必要があることに注意してください。" -#: ../../c-api/module.rst:559 msgid "" "The number of different *name* strings passed to this function should be " "kept small, usually by only using statically allocated strings as *name*. " @@ -812,6 +850,12 @@ msgid "" "details, see :c:func:`PyUnicode_InternFromString`, which may be used " "internally to create a key object." msgstr "" +"この関数に渡す *name* 文字列の種類は少数に抑える必要があります。\n" +"通常は *name* に静的に割り当てた文字列だけを使います。\n" +"コンパイル時に分からない名前には、:c:func:`PyUnicode_FromString` と :c:func:" +"`PyObject_SetAttr` を直接呼び出すことを推奨します。\n" +"詳細は、キーオブジェクトの作成に内部で使われることがある :c:func:" +"`PyUnicode_InternFromString` を参照してください。" #: ../../c-api/module.rst:572 msgid "" @@ -821,12 +865,14 @@ msgid "" "variable." msgstr "" -#: ../../c-api/module.rst:579 msgid "" "if (PyModule_Add(module, \"spam\", PyBytes_FromString(value)) < 0) {\n" " goto error;\n" "}" msgstr "" +"if (PyModule_Add(module, \"spam\", PyBytes_FromString(value)) < 0) {\n" +" goto error;\n" +"}" #: ../../c-api/module.rst:588 msgid "" @@ -834,26 +880,29 @@ msgid "" "*value* on success (if it returns ``0``)." msgstr "" -#: ../../c-api/module.rst:591 msgid "" "The new :c:func:`PyModule_Add` or :c:func:`PyModule_AddObjectRef` functions " "are recommended, since it is easy to introduce reference leaks by misusing " "the :c:func:`PyModule_AddObject` function." msgstr "" +":c:func:`PyModule_AddObject` 関数は誤用により参照のリークを起こしやすいため、" +"新しい :c:func:`PyModule_Add` または :c:func:`PyModule_AddObjectRef` 関数を推" +"奨します。" -#: ../../c-api/module.rst:598 msgid "" "Unlike other functions that steal references, ``PyModule_AddObject()`` only " "releases the reference to *value* **on success**." msgstr "" +"参照を盗む他の関数とは異なり、``PyModule_AddObject()`` が *value* への参照を" +"解放するのは **成功時だけ** です。" -#: ../../c-api/module.rst:601 msgid "" "This means that its return value must be checked, and calling code must :c:" "func:`Py_XDECREF` *value* manually on error." msgstr "" +"そのため、戻り値を確認する必要があり、エラー時には呼び出し側のコードが " +"*value* に対して明示的に :c:func:`Py_XDECREF` を行わなければなりません。" -#: ../../c-api/module.rst:606 msgid "" "PyObject *obj = PyBytes_FromString(value);\n" "if (PyModule_AddObject(module, \"spam\", obj) < 0) {\n" @@ -866,58 +915,86 @@ msgid "" "// PyModule_AddObject() stole a reference to obj:\n" "// Py_XDECREF(obj) is not needed here." msgstr "" +"PyObject *obj = PyBytes_FromString(value);\n" +"if (PyModule_AddObject(module, \"spam\", obj) < 0) {\n" +" // 'obj' が NULL でなく、PyModule_AddObject() が失敗した場合は、\n" +" // Py_XDECREF() で 'obj' への強参照を解放する必要があります。\n" +" // 'obj' が NULL の場合、Py_XDECREF() は何もしません。\n" +" Py_XDECREF(obj);\n" +" goto error;\n" +"}\n" +"// PyModule_AddObject() が obj への参照を盗んだため、\n" +"// ここで Py_XDECREF(obj) は不要です。" #: ../../c-api/module.rst:619 msgid ":c:func:`PyModule_AddObject` is :term:`soft deprecated`." msgstr "" -#: ../../c-api/module.rst:624 msgid "" "Add an integer constant to *module* as *name*. This convenience function " "can be used from the module's initialization function. Return ``-1`` with an " "exception set on error, ``0`` on success." msgstr "" +"整数定数を *name* として *module* に追加します。\n" +"この便利関数はモジュールの初期化関数から使えます。\n" +"エラー時には例外を設定して ``-1``、成功すると ``0`` を返します。" -#: ../../c-api/module.rst:628 msgid "" "This is a convenience function that calls :c:func:`PyLong_FromLong` and :c:" "func:`PyModule_AddObjectRef`; see their documentation for details." msgstr "" +"この便利関数は :c:func:`PyLong_FromLong` と :c:func:`PyModule_AddObjectRef` " +"を呼び出します。\n" +"詳細はそれぞれのドキュメントを参照してください。" -#: ../../c-api/module.rst:634 msgid "" "Add a string constant to *module* as *name*. This convenience function can " "be used from the module's initialization function. The string *value* must " "be ``NULL``-terminated. Return ``-1`` with an exception set on error, ``0`` " "on success." msgstr "" +"文字列定数を *name* として *module* に追加します。\n" +"この便利関数はモジュールの初期化関数から使えます。\n" +"文字列 *value* は ``NULL`` 終端されている必要があります。\n" +"エラー時には例外を設定して ``-1``、成功すると ``0`` を返します。" -#: ../../c-api/module.rst:639 msgid "" "This is a convenience function that calls :c:func:" "`PyUnicode_InternFromString` and :c:func:`PyModule_AddObjectRef`; see their " "documentation for details." msgstr "" +"この便利関数は :c:func:`PyUnicode_InternFromString` と :c:func:" +"`PyModule_AddObjectRef` を呼び出します。\n" +"詳細はそれぞれのドキュメントを参照してください。" -#: ../../c-api/module.rst:646 msgid "" "Add an int constant to *module*. The name and the value are taken from " "*macro*. For example ``PyModule_AddIntMacro(module, AF_INET)`` adds the int " "constant *AF_INET* with the value of *AF_INET* to *module*. Return ``-1`` " "with an exception set on error, ``0`` on success." msgstr "" +"整数定数を *module* に追加します。\n" +"名前と値は *macro* から取得します。\n" +"例えば ``PyModule_AddIntMacro(module, AF_INET)`` は、値が *AF_INET* の整数定" +"数 *AF_INET* を *module* に追加します。\n" +"エラー時には例外を設定して ``-1``、成功すると ``0`` を返します。" #: ../../c-api/module.rst:654 msgid "Add a string constant to *module*." msgstr "文字列定数を *module* に追加します。" -#: ../../c-api/module.rst:658 msgid "" "Add a type object to *module*. The type object is finalized by calling " "internally :c:func:`PyType_Ready`. The name of the type object is taken from " "the last component of :c:member:`~PyTypeObject.tp_name` after dot. Return " "``-1`` with an exception set on error, ``0`` on success." msgstr "" +"型オブジェクトを *module* に追加します。\n" +"内部で :c:func:`PyType_Ready` を呼び出して型オブジェクトの準備を完了しま" +"す。\n" +"型オブジェクトの名前には、:c:member:`~PyTypeObject.tp_name` の最後のドットの" +"後の部分を使います。\n" +"エラー時には例外を設定して ``-1``、成功すると ``0`` を返します。" #: ../../c-api/module.rst:668 msgid "" @@ -993,19 +1070,22 @@ msgid "" "state updates)." msgstr "" -#: ../../c-api/module.rst:712 ../../c-api/module.rst:723 msgid "The caller must have an :term:`attached thread state`." msgstr "" +"呼び出し元には :term:`アタッチされたスレッド状態 ` が" +"必要です。" -#: ../../c-api/module.rst:714 msgid "Return ``-1`` with an exception set on error, ``0`` on success." msgstr "" +"エラーの場合は例外を設定して ``-1`` を返し、成功した場合は ``0`` を返します。" -#: ../../c-api/module.rst:720 msgid "" "Removes the module object created from *def* from the interpreter state. " "Return ``-1`` with an exception set on error, ``0`` on success." msgstr "" +"*def* から作成されたモジュールオブジェクトを、インタープリタの状態から削除し" +"ます。\n" +"エラー時には例外を設定して ``-1``、成功すると ``0`` を返します。" #: ../../c-api/module.rst:8 msgid "object" @@ -1031,13 +1111,11 @@ msgstr "__doc__ (モジュール属性)" msgid "__file__ (module attribute)" msgstr "__file__ (モジュール属性)" -#: ../../c-api/module.rst:33 msgid "__package__ (module attribute)" -msgstr "" +msgstr "__package__ (モジュール属性)" -#: ../../c-api/module.rst:33 msgid "__loader__ (module attribute)" -msgstr "" +msgstr "__loader__ (モジュール属性)" #: ../../c-api/module.rst:63 msgid "__dict__ (module attribute)" diff --git a/c-api/none.po b/c-api/none.po index a9cfc9728..82060e89a 100644 --- a/c-api/none.po +++ b/c-api/none.po @@ -17,10 +17,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../c-api/none.rst:6 @@ -57,7 +57,7 @@ msgstr "関数から :c:data:`Py_None` を返します。" #: ../../c-api/none.rst:8 msgid "object" -msgstr "オブジェクト" +msgstr "object" #: ../../c-api/none.rst:8 msgid "None" diff --git a/c-api/number.po b/c-api/number.po index 5a9834aff..097c72407 100644 --- a/c-api/number.po +++ b/c-api/number.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: tomo, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../c-api/number.rst:6 @@ -73,13 +73,14 @@ msgstr "" "ます。\n" "Python の式 ``o1 @ o2`` と同じです。" -#: ../../c-api/number.rst:46 msgid "" "Return the floor of *o1* divided by *o2*, or ``NULL`` on failure. This is " "the equivalent of the Python expression ``o1 // o2``." msgstr "" +"*o1* を *o2* で割った結果に床関数 (floor) を適用した値を返します。\n" +"失敗すると ``NULL`` を返します。\n" +"Python の式 ``o1 // o2`` と同じです。" -#: ../../c-api/number.rst:52 msgid "" "Return a reasonable approximation for the mathematical value of *o1* divided " "by *o2*, or ``NULL`` on failure. The return value is \"approximate\" " @@ -88,6 +89,12 @@ msgid "" "point value when passed two integers. This is the equivalent of the Python " "expression ``o1 / o2``." msgstr "" +"*o1* を *o2* で割った数学的な値の適切な近似値を返します。\n" +"失敗すると ``NULL`` を返します。\n" +"2 進浮動小数点数ではすべての実数を表せず近似になるため、戻り値も「近似値」で" +"す。\n" +"整数を 2 個渡しても、浮動小数点数を返すことがあります。\n" +"Python の式 ``o1 / o2`` と同じです。" #: ../../c-api/number.rst:61 msgid "" @@ -241,7 +248,6 @@ msgstr "" "ます。*o1* が *in-place* 演算をサポートする場合、in-place 演算を行います。" "Python の文 ``o1 //= o2`` と同じです。" -#: ../../c-api/number.rst:178 msgid "" "Return a reasonable approximation for the mathematical value of *o1* divided " "by *o2*, or ``NULL`` on failure. The return value is \"approximate\" " @@ -251,6 +257,13 @@ msgid "" "*o1* supports it. This is the equivalent of the Python statement ``o1 /= " "o2``." msgstr "" +"*o1* を *o2* で割った数学的な値の適切な近似値を返します。\n" +"失敗すると ``NULL`` を返します。\n" +"2 進浮動小数点数ではすべての実数を表せず近似になるため、戻り値も「近似値」で" +"す。\n" +"整数を 2 個渡しても、浮動小数点数を返すことがあります。\n" +"*o1* がサポートしている場合は、*in-place* で演算します。\n" +"Python の文 ``o1 /= o2`` と同じです。" #: ../../c-api/number.rst:188 msgid "" diff --git a/c-api/objbuffer.po b/c-api/objbuffer.po index fd539e63f..f24e8a3c8 100644 --- a/c-api/objbuffer.po +++ b/c-api/objbuffer.po @@ -17,10 +17,10 @@ msgstr "" "Last-Translator: mollinaca, 2021\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../c-api/objbuffer.rst:4 diff --git a/c-api/object.po b/c-api/object.po index 81747047f..e0fca714d 100644 --- a/c-api/object.po +++ b/c-api/object.po @@ -20,79 +20,69 @@ msgstr "" "Last-Translator: tomo, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../c-api/object.rst:6 msgid "Object Protocol" msgstr "オブジェクトプロトコル (object protocol)" -#: ../../c-api/object.rst:11 msgid "Get a :term:`strong reference` to a constant." -msgstr "" +msgstr "定数への :term:`強参照 ` を取得します。" -#: ../../c-api/object.rst:13 msgid "Set an exception and return ``NULL`` if *constant_id* is invalid." -msgstr "" +msgstr "*constant_id* が無効な場合、例外を設定して ``NULL`` を返します。" -#: ../../c-api/object.rst:15 msgid "*constant_id* must be one of these constant identifiers:" -msgstr "" +msgstr "*constant_id* は次の定数識別子のいずれかでなければなりません。" -#: ../../c-api/object.rst:20 msgid "Constant Identifier" -msgstr "" +msgstr "定数識別子" #: ../../c-api/object.rst:20 msgid "Value" msgstr "値" -#: ../../c-api/object.rst:20 msgid "Returned object" -msgstr "" +msgstr "返されるオブジェクト" #: ../../c-api/object.rst:22 ../../c-api/object.rst:27 msgid "``0``" msgstr "``0``" -#: ../../c-api/object.rst:22 msgid ":py:data:`None`" -msgstr "" +msgstr ":py:data:`None`" #: ../../c-api/object.rst:23 ../../c-api/object.rst:28 msgid "``1``" msgstr "``1``" -#: ../../c-api/object.rst:23 msgid ":py:data:`False`" -msgstr "" +msgstr ":py:data:`False`" #: ../../c-api/object.rst:24 msgid "``2``" msgstr "``2``" -#: ../../c-api/object.rst:24 msgid ":py:data:`True`" -msgstr "" +msgstr ":py:data:`True`" #: ../../c-api/object.rst:25 msgid "``3``" msgstr "``3``" -#: ../../c-api/object.rst:25 msgid ":py:data:`Ellipsis`" -msgstr "" +msgstr ":py:data:`Ellipsis`" #: ../../c-api/object.rst:26 msgid "``4``" msgstr "``4``" -#: ../../c-api/object.rst:26 msgid ":py:data:`NotImplemented`" -msgstr "" +msgstr ":py:data:`NotImplemented`" #: ../../c-api/object.rst:27 msgid "``5``" @@ -106,52 +96,50 @@ msgstr "``6``" msgid "``7``" msgstr "``7``" -#: ../../c-api/object.rst:29 msgid "``''``" -msgstr "" +msgstr "``''``" #: ../../c-api/object.rst:30 msgid "``8``" msgstr "``8``" -#: ../../c-api/object.rst:30 msgid "``b''``" -msgstr "" +msgstr "``b''``" #: ../../c-api/object.rst:31 msgid "``9``" msgstr "``9``" -#: ../../c-api/object.rst:31 msgid "``()``" -msgstr "" +msgstr "``()``" -#: ../../c-api/object.rst:34 msgid "" "Numeric values are only given for projects which cannot use the constant " "identifiers." -msgstr "" +msgstr "数値は、定数識別子を使えないプロジェクトのためにのみ示しています。" -#: ../../c-api/object.rst:42 msgid "In CPython, all of these constants are :term:`immortal`." -msgstr "" +msgstr "CPython では、これらの定数はすべて :term:`不死 ` です。" -#: ../../c-api/object.rst:47 msgid "" "Similar to :c:func:`Py_GetConstant`, but return a :term:`borrowed reference`." msgstr "" +":c:func:`Py_GetConstant` と同様ですが、:term:`借用参照 ` " +"を返します。" -#: ../../c-api/object.rst:50 msgid "" "This function is primarily intended for backwards compatibility: using :c:" "func:`Py_GetConstant` is recommended for new code." msgstr "" +"この関数は主に後方互換性を目的としています。\n" +"新しいコードでは :c:func:`Py_GetConstant` を使うことを推奨します。" -#: ../../c-api/object.rst:53 msgid "" "The reference is borrowed from the interpreter, and is valid until the " "interpreter finalization." msgstr "" +"参照はインタープリタから借用され、インタープリタがファイナライズされるまで有" +"効です。" #: ../../c-api/object.rst:61 msgid "" @@ -161,12 +149,14 @@ msgstr "" "与えられたオブジェクトとメソッドの引数の型の組み合わせの処理が未実装である印" "として使われる、 ``未実装 (NotImplemented)`` シングルトン。" -#: ../../c-api/object.rst:67 msgid "" "Properly handle returning :c:data:`Py_NotImplemented` from within a C " "function (that is, create a new :term:`strong reference` to :const:" "`NotImplemented` and return it)." msgstr "" +"C 関数内から :c:data:`Py_NotImplemented` を返す処理を適切に行います (つまり :" +"const:`NotImplemented` への新しい :term:`強参照 ` を作成し" +"て返します)。" #: ../../c-api/object.rst:74 msgid "" @@ -175,35 +165,43 @@ msgid "" "function would use the :func:`str` of the object instead of the :func:`repr`." msgstr "" -#: ../../c-api/object.rst:82 msgid "" "Print an object *o*, on file *fp*. Returns ``-1`` on error. The flags " "argument is used to enable certain printing options. The only option " "currently supported is :c:macro:`Py_PRINT_RAW`; if given, the :func:`str` of " "the object is written instead of the :func:`repr`." msgstr "" +"オブジェクト *o* をファイル *fp* に出力します。\n" +"エラー時は ``-1`` を返します。\n" +"``flags`` 引数で出力オプションを有効にします。\n" +"現在サポートされるオプションは :c:macro:`Py_PRINT_RAW` のみで、指定するとオブ" +"ジェクトの :func:`repr` 結果の代わりに :func:`str` 結果を書き出します。" -#: ../../c-api/object.rst:90 msgid "" "Returns ``1`` if *o* has the attribute *attr_name*, and ``0`` otherwise. " "This is equivalent to the Python expression ``hasattr(o, attr_name)``. On " "failure, return ``-1``." msgstr "" +"*o* に *attr_name* 属性があれば ``1``、なければ ``0`` を返します。\n" +"Python の式 ``hasattr(o, attr_name)`` と同等です。\n" +"失敗すると ``-1`` を返します。" -#: ../../c-api/object.rst:99 msgid "" "This is the same as :c:func:`PyObject_HasAttrWithError`, but *attr_name* is " "specified as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than " "a :c:expr:`PyObject*`." msgstr "" +":c:func:`PyObject_HasAttrWithError` と同じですが、*attr_name* は :c:expr:" +"`PyObject*` ではなく、UTF-8 でエンコードされたバイト文字列を指す :c:expr:" +"`const char*` で指定します。" -#: ../../c-api/object.rst:108 msgid "" "Returns ``1`` if *o* has the attribute *attr_name*, and ``0`` otherwise. " "This function always succeeds." msgstr "" +"*o* に *attr_name* 属性があれば ``1``、なければ ``0`` を返します。\n" +"この関数は常に成功します。" -#: ../../c-api/object.rst:113 msgid "" "Exceptions that occur when this calls :meth:`~object.__getattr__` and :meth:" "`~object.__getattribute__` methods aren't propagated, but instead given to :" @@ -211,13 +209,21 @@ msgid "" "`PyObject_HasAttrWithError`, :c:func:`PyObject_GetOptionalAttr` or :c:func:" "`PyObject_GetAttr` instead." msgstr "" +":meth:`~object.__getattr__` メソッドや :meth:`~object.__getattribute__` メ" +"ソッドの呼び出し中に発生した例外は伝播せず、:func:`sys.unraisablehook` に渡さ" +"れます。\n" +"適切にエラーを処理するには、代わりに :c:func:`PyObject_HasAttrWithError`、:c:" +"func:`PyObject_GetOptionalAttr`、:c:func:`PyObject_GetAttr` を使ってくださ" +"い。" -#: ../../c-api/object.rst:122 msgid "" "This is the same as :c:func:`PyObject_HasAttr`, but *attr_name* is specified " "as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" "`PyObject*`." msgstr "" +":c:func:`PyObject_HasAttr` と同じですが、*attr_name* は :c:expr:`PyObject*` " +"ではなく、UTF-8 でエンコードされたバイト文字列を指す :c:expr:`const char*` で" +"指定します。" #: ../../c-api/object.rst:128 msgid "" @@ -238,32 +244,36 @@ msgstr "" "を返し失敗すると ``NULL`` を返します。この関数は Python の式 ``o.attr_name`` " "と同じです。" -#: ../../c-api/object.rst:142 msgid "" "If the missing attribute should not be treated as a failure, you can use :c:" "func:`PyObject_GetOptionalAttr` instead." msgstr "" +"属性がない場合を失敗として扱いたくなければ、代わりに :c:func:" +"`PyObject_GetOptionalAttr` を使えます。" -#: ../../c-api/object.rst:148 msgid "" "This is the same as :c:func:`PyObject_GetAttr`, but *attr_name* is specified " "as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" "`PyObject*`." msgstr "" +":c:func:`PyObject_GetAttr` と同じですが、*attr_name* は :c:expr:`PyObject*` " +"ではなく、UTF-8 でエンコードされたバイト文字列を指す :c:expr:`const char*` で" +"指定します。" -#: ../../c-api/object.rst:152 msgid "" "If the missing attribute should not be treated as a failure, you can use :c:" "func:`PyObject_GetOptionalAttrString` instead." msgstr "" +"属性がない場合を失敗として扱いたくなければ、代わりに :c:func:" +"`PyObject_GetOptionalAttrString` を使えます。" -#: ../../c-api/object.rst:158 msgid "" "Variant of :c:func:`PyObject_GetAttr` which doesn't raise :exc:" "`AttributeError` if the attribute is not found." msgstr "" +"属性が見つからなくても :exc:`AttributeError` を送出しない :c:func:" +"`PyObject_GetAttr` の変種です。" -#: ../../c-api/object.rst:161 msgid "" "If the attribute is found, return ``1`` and set *\\*result* to a new :term:" "`strong reference` to the attribute. If the attribute is not found, return " @@ -271,13 +281,21 @@ msgid "" "silenced. If an error other than :exc:`AttributeError` is raised, return " "``-1`` and set *\\*result* to ``NULL``." msgstr "" +"属性が見つかった場合は ``1`` を返し、*\\*result* に属性への新しい :term:`強参" +"照 ` を設定します。\n" +"属性が見つからない場合は ``0`` を返し、*\\*result* に ``NULL`` を設定して、:" +"exc:`AttributeError` を抑制します。\n" +":exc:`AttributeError` 以外のエラーが発生した場合は ``-1`` を返し、" +"*\\*result* に ``NULL`` を設定します。" -#: ../../c-api/object.rst:173 msgid "" "This is the same as :c:func:`PyObject_GetOptionalAttr`, but *attr_name* is " "specified as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than " "a :c:expr:`PyObject*`." msgstr "" +":c:func:`PyObject_GetOptionalAttr` と同じですが、*attr_name* は :c:expr:" +"`PyObject*` ではなく、UTF-8 でエンコードされたバイト文字列を指す :c:expr:" +"`const char*` で指定します。" #: ../../c-api/object.rst:181 msgid "" @@ -315,12 +333,14 @@ msgstr "" "`PyObject_DelAttr` のため、非推奨となっていますが、削除される予定はありませ" "ん。" -#: ../../c-api/object.rst:203 msgid "" "This is the same as :c:func:`PyObject_SetAttr`, but *attr_name* is specified " "as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" "`PyObject*`." msgstr "" +":c:func:`PyObject_SetAttr` と同じですが、*attr_name* は :c:expr:`PyObject*` " +"ではなく、UTF-8 でエンコードされたバイト文字列を指す :c:expr:`const char*` で" +"指定します。" #: ../../c-api/object.rst:207 msgid "" @@ -330,7 +350,6 @@ msgstr "" "*v* が ``NULL`` の場合は属性が削除されますが、この機能は非推奨であり :c:func:" "`PyObject_DelAttrString` を使うのが望ましいです。" -#: ../../c-api/object.rst:210 msgid "" "The number of different attribute names passed to this function should be " "kept small, usually by using a statically allocated string as *attr_name*. " @@ -339,6 +358,12 @@ msgid "" "more details, see :c:func:`PyUnicode_InternFromString`, which may be used " "internally to create a key object." msgstr "" +"この関数に渡す属性名の種類は少数にとどめるべきです。\n" +"通常は、静的に割り当てた文字列を *attr_name* に使うことでそうします。\n" +"コンパイル時に分からない属性名には、:c:func:`PyUnicode_FromString` と :c:" +"func:`PyObject_SetAttr` を直接呼び出すことを推奨します。\n" +"詳細は、キーオブジェクトを作成するために内部で使われる可能性のある :c:func:" +"`PyUnicode_InternFromString` を参照してください。" #: ../../c-api/object.rst:220 msgid "" @@ -368,14 +393,15 @@ msgstr "" "オブジェクト *o* の *attr_name* という名の属性を削除します。失敗すると " "``-1`` を返します。この関数は Python の文 ``del o.attr_name`` と同じです。" -#: ../../c-api/object.rst:238 msgid "" "This is the same as :c:func:`PyObject_DelAttr`, but *attr_name* is specified " "as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" "`PyObject*`." msgstr "" +":c:func:`PyObject_DelAttr` と同じですが、*attr_name* は :c:expr:`PyObject*` " +"ではなく、UTF-8 でエンコードされたバイト文字列を指す :c:expr:`const char*` で" +"指定します。" -#: ../../c-api/object.rst:242 msgid "" "The number of different attribute names passed to this function should be " "kept small, usually by using a statically allocated string as *attr_name*. " @@ -384,6 +410,12 @@ msgid "" "more details, see :c:func:`PyUnicode_InternFromString`, which may be used " "internally to create a key object for lookup." msgstr "" +"この関数に渡す属性名の種類は少数にとどめるべきです。\n" +"通常は、静的に割り当てた文字列を *attr_name* に使うことでそうします。\n" +"コンパイル時に分からない属性名には、:c:func:`PyUnicode_FromString` と :c:" +"func:`PyObject_DelAttr` を直接呼び出すことを推奨します。\n" +"詳細は、検索用のキーオブジェクトを作成するために内部で使われる可能性のある :" +"c:func:`PyUnicode_InternFromString` を参照してください。" #: ../../c-api/object.rst:253 msgid "" @@ -393,7 +425,6 @@ msgstr "" "``__dict__`` デスクリプタの getter の総称的な実装です。必要な場合は、辞書を作" "成します。" -#: ../../c-api/object.rst:256 msgid "" "This function may also be called to get the :py:attr:`~object.__dict__` of " "the object *o*. Pass ``NULL`` for *context* when calling it. Since this " @@ -401,10 +432,15 @@ msgid "" "efficient to call :c:func:`PyObject_GetAttr` when accessing an attribute on " "the object." msgstr "" +"オブジェクト *o* の :py:attr:`~object.__dict__` を取得するためにこの関数を呼" +"び出すこともできます。\n" +"その場合は *context* に ``NULL`` を渡してください。\n" +"この関数は辞書のメモリを割り当てる必要がある場合があるため、オブジェクトの属" +"性にアクセスするなら :c:func:`PyObject_GetAttr` の方が効率的なことがありま" +"す。" -#: ../../c-api/object.rst:262 msgid "On failure, returns ``NULL`` with an exception set." -msgstr "" +msgstr "失敗すると例外を設定して ``NULL`` を返します。" #: ../../c-api/object.rst:269 msgid "" @@ -414,20 +450,22 @@ msgstr "" "``__dict__`` デスクリプタの setter の総称的な実装です。この実装では辞書を削除" "することは許されていません。" -#: ../../c-api/object.rst:277 msgid "" "Return a pointer to :py:attr:`~object.__dict__` of the object *obj*. If " "there is no ``__dict__``, return ``NULL`` without setting an exception." msgstr "" +"オブジェクト *obj* の :py:attr:`~object.__dict__` へのポインタを返します。\n" +"``__dict__`` がない場合は、例外を設定せずに ``NULL`` を返します。" -#: ../../c-api/object.rst:280 msgid "" "This function may need to allocate memory for the dictionary, so it may be " "more efficient to call :c:func:`PyObject_GetAttr` when accessing an " "attribute on the object." msgstr "" +"この関数は辞書のメモリを割り当てる必要がある場合があるため、オブジェクトの属" +"性にアクセスするなら :c:func:`PyObject_GetAttr` の方が効率的なことがありま" +"す。" -#: ../../c-api/object.rst:287 msgid "" "Compare the values of *o1* and *o2* using the operation specified by *opid*, " "which must be one of :c:macro:`Py_LT`, :c:macro:`Py_LE`, :c:macro:`Py_EQ`, :" @@ -437,32 +475,46 @@ msgid "" "operator corresponding to *opid*. Returns the value of the comparison on " "success, or ``NULL`` on failure." msgstr "" +"*opid* で指定された演算を使って *o1* と *o2* の値を比較します。\n" +"*opid* は :c:macro:`Py_LT`、:c:macro:`Py_LE`、:c:macro:`Py_EQ`、:c:macro:" +"`Py_NE`、:c:macro:`Py_GT`、:c:macro:`Py_GE` のいずれかで、それぞれ ``<``、" +"``<=``、``==``、``!=``、``>``、``>=`` に対応します。\n" +"これは、``op`` を *opid* に対応する演算子とした Python の式 ``o1 op o2`` と同" +"等です。\n" +"成功すると比較の結果を返し、失敗すると ``NULL`` を返します。" -#: ../../c-api/object.rst:297 msgid "" "Compare the values of *o1* and *o2* using the operation specified by *opid*, " "like :c:func:`PyObject_RichCompare`, but returns ``-1`` on error, ``0`` if " "the result is false, ``1`` otherwise." msgstr "" +":c:func:`PyObject_RichCompare` と同様に、*opid* で指定された演算を使って " +"*o1* と *o2* の値を比較します。\n" +"ただし、エラー時は ``-1``、結果が偽なら ``0``、それ以外は ``1`` を返します。" -#: ../../c-api/object.rst:302 msgid "" "If *o1* and *o2* are the same object, :c:func:`PyObject_RichCompareBool` " "will always return ``1`` for :c:macro:`Py_EQ` and ``0`` for :c:macro:`Py_NE`." msgstr "" +"*o1* と *o2* が同じオブジェクトの場合、:c:func:`PyObject_RichCompareBool` " +"は :c:macro:`Py_EQ` に対して常に ``1``、:c:macro:`Py_NE` に対して常に ``0`` " +"を返します。" -#: ../../c-api/object.rst:307 msgid "" "Format *obj* using *format_spec*. This is equivalent to the Python " "expression ``format(obj, format_spec)``." msgstr "" +"*format_spec* を使って *obj* を書式化します。\n" +"Python の式 ``format(obj, format_spec)`` と同等です。" -#: ../../c-api/object.rst:310 msgid "" "*format_spec* may be ``NULL``. In this case the call is equivalent to " "``format(obj)``. Returns the formatted string on success, ``NULL`` on " "failure." msgstr "" +"*format_spec* は ``NULL`` にできます。\n" +"その場合は ``format(obj)`` と同等です。\n" +"成功すると書式化された文字列を返し、失敗すると ``NULL`` を返します。" #: ../../c-api/object.rst:318 msgid "" @@ -548,12 +600,15 @@ msgid "" "e. contained in :attr:`cls.__mro__ `." msgstr "" -#: ../../c-api/object.rst:376 msgid "" "Normally only class objects, i.e. instances of :class:`type` or a derived " "class, are considered classes. However, objects can override this by having " "a :attr:`~type.__bases__` attribute (which must be a tuple of base classes)." msgstr "" +"通常はクラスオブジェクト、つまり :class:`type` またはその派生クラスのインスタ" +"ンスだけがクラスとみなされます。\n" +"ただし、オブジェクトに :attr:`~type.__bases__` 属性 (基底クラスのタプルでなけ" +"ればなりません) を持たせることで、この判定を変えられます。" #: ../../c-api/object.rst:383 msgid "" @@ -564,25 +619,31 @@ msgstr "" "``1`` を返し、そうでない場合に ``0`` を返します。\n" "エラーが起きると ``-1`` を返し例外を設定します。" -#: ../../c-api/object.rst:390 msgid "" "If *cls* has a :meth:`~type.__instancecheck__` method, it will be called to " "determine the subclass status as described in :pep:`3119`. Otherwise, " "*inst* is an instance of *cls* if its class is a subclass of *cls*." msgstr "" +"*cls* に :meth:`~type.__instancecheck__` メソッドがある場合、:pep:`3119` に" +"従って判定するためにこのメソッドが呼び出されます。\n" +"そうでなければ、*inst* のクラスが *cls* のサブクラスである場合に、*inst* は " +"*cls* のインスタンスとみなされます。" -#: ../../c-api/object.rst:394 msgid "" "An instance *inst* can override what is considered its class by having a :" "attr:`~object.__class__` attribute." msgstr "" +"インスタンス *inst* は :attr:`~object.__class__` 属性を持つことで、自分のクラ" +"スとみなされるものを変更できます。" -#: ../../c-api/object.rst:397 msgid "" "An object *cls* can override if it is considered a class, and what its base " "classes are, by having a :attr:`~type.__bases__` attribute (which must be a " "tuple of base classes)." msgstr "" +"オブジェクト *cls* は :attr:`~type.__bases__` 属性 (基底クラスのタプルでなけ" +"ればなりません) を持つことで、クラスとみなされるかどうか、および基底クラスを" +"変更できます。" #: ../../c-api/object.rst:406 msgid "" @@ -600,13 +661,16 @@ msgstr "" "返り値の型が Py_hash_t になりました。この型は、 :c:type:`Py_ssize_t` と同じサ" "イズをもつ符号付き整数です。" -#: ../../c-api/object.rst:416 msgid "" "Set a :exc:`TypeError` indicating that ``type(o)`` is not :term:`hashable` " "and return ``-1``. This function receives special treatment when stored in a " "``tp_hash`` slot, allowing a type to explicitly indicate to the interpreter " "that it is not hashable." msgstr "" +"``type(o)`` が :term:`ハッシュ可能 ` でないことを示す :exc:" +"`TypeError` を設定し、``-1`` を返します。\n" +"この関数を ``tp_hash`` スロットに設定すると特別に扱われ、ハッシュ可能でないこ" +"とを型からインタープリタに明示できます。" #: ../../c-api/object.rst:424 msgid "" @@ -626,7 +690,6 @@ msgstr "" "*o* が真を表すとみなせる場合には ``0`` を、そうでないときには ``1`` を返しま" "す。 Python の式 ``not o`` と同じです。失敗すると ``-1`` を返します。" -#: ../../c-api/object.rst:440 msgid "" "When *o* is non-``NULL``, returns a type object corresponding to the object " "type of object *o*. On failure, raises :exc:`SystemError` and returns " @@ -636,12 +699,22 @@ msgid "" "function, which returns a pointer of type :c:expr:`PyTypeObject*`, except " "when a new :term:`strong reference` is needed." msgstr "" +"*o* が ``NULL`` でない場合、オブジェクト *o* の型に対応する型オブジェクトを返" +"します。\n" +"失敗すると :exc:`SystemError` を送出して ``NULL`` を返します。\n" +"Python の式 ``type(o)`` と同等です。\n" +"この関数は戻り値への新しい :term:`強参照 ` を作成します。\n" +"新しい :term:`強参照 ` が必要な場合を除き、:c:expr:" +"`PyTypeObject*` 型のポインタを返す :c:func:`Py_TYPE()` 関数の代わりにこの関数" +"を使う理由はありません。" -#: ../../c-api/object.rst:452 msgid "" "Return non-zero if the object *o* is of type *type* or a subtype of *type*, " "and ``0`` otherwise. Both parameters must be non-``NULL``." msgstr "" +"オブジェクト *o* の型が *type* またはそのサブタイプであればゼロ以外、そうでな" +"ければ ``0`` を返します。\n" +"どちらの引数も ``NULL`` であってはいけません。" #: ../../c-api/object.rst:461 msgid "" @@ -654,7 +727,6 @@ msgstr "" "型プロトコルの両方を提供している場合、シーケンスとしての長さを返します。エ" "ラーが生じると ``-1`` を返します。 Python の式 ``len(o)`` と同じです。" -#: ../../c-api/object.rst:468 msgid "" "Return an estimated length for the object *o*. First try to return its " "actual length, then an estimate using :meth:`~object.__length_hint__`, and " @@ -662,10 +734,11 @@ msgid "" "equivalent to the Python expression ``operator.length_hint(o, " "defaultvalue)``." msgstr "" -"オブジェクト *o* の概算の長さを返します。\n" -"最初に実際の長さを、次に :meth:`~object.__length_hint__` を使って概算の長さ" -"を、そして最後にデフォルトの値を返そうとします。\n" -"この関数は Python の式 ``operator.length_hint(o, defaultvalue)`` と同じです。" +"オブジェクト *o* の推定の長さを返します。\n" +"まず実際の長さを返すことを試み、次に :meth:`~object.__length_hint__` による推" +"定値を試み、最後にデフォルト値を返します。\n" +"エラー時は ``-1`` を返します。\n" +"Python の式 ``operator.length_hint(o, defaultvalue)`` と同等です。" #: ../../c-api/object.rst:478 msgid "" @@ -694,14 +767,15 @@ msgstr "" "オブジェクト *o* から *key* に関する対応付けを削除します。失敗すると ``-1`` " "を返します。Python の文 ``del o[key]`` と同じです。" -#: ../../c-api/object.rst:498 msgid "" "This is the same as :c:func:`PyObject_DelItem`, but *key* is specified as a :" "c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" "`PyObject*`." msgstr "" +":c:func:`PyObject_DelItem` と同じですが、*key* は :c:expr:`PyObject*` ではな" +"く、UTF-8 でエンコードされたバイト文字列を指す :c:expr:`const char*` で指定し" +"ます。" -#: ../../c-api/object.rst:505 msgid "" "This is equivalent to the Python expression ``dir(o)``, returning a " "(possibly empty) list of strings appropriate for the object argument, or " @@ -710,11 +784,13 @@ msgid "" "case, if no execution frame is active then ``NULL`` is returned but :c:func:" "`PyErr_Occurred` will return false." msgstr "" -"この関数は Python の式 ``dir(o)`` と同じで、オブジェクトの変数名に割り当てて" -"いる文字列からなるリスト (空の場合もあります) を返します。エラーの場合には " -"``NULL`` を返します。引数を ``NULL`` にすると、Python における ``dir()`` と同" -"様に、現在のローカルな名前を返します; この場合、アクティブな実行フレームがな" -"ければ ``NULL`` を返しますが、 :c:func:`PyErr_Occurred` は偽を返します。" +"Python の式 ``dir(o)`` と同等で、引数のオブジェクトに応じた名前の文字列のリス" +"ト (空の場合もあります) を返します。\n" +"エラー時は ``NULL`` を返します。\n" +"引数が ``NULL`` の場合は Python の ``dir()`` と同様に、現在のローカルな名前を" +"返します。\n" +"この場合、アクティブな実行フレームがなければ ``NULL`` を返しますが、:c:func:" +"`PyErr_Occurred` は偽を返します。" #: ../../c-api/object.rst:514 msgid "" @@ -728,14 +804,15 @@ msgstr "" "す。オブジェクトが反復処理不可能であった場合には :exc:`TypeError` を送出して " "``NULL`` を返します。" -#: ../../c-api/object.rst:522 msgid "" "This is equivalent to the Python ``__iter__(self): return self`` method. It " "is intended for :term:`iterator` types, to be used in the :c:member:" "`PyTypeObject.tp_iter` slot." msgstr "" +"Python の ``__iter__(self): return self`` メソッドと同等です。\n" +":term:`イテレータ ` 型の :c:member:`PyTypeObject.tp_iter` スロット" +"に使うことを想定しています。" -#: ../../c-api/object.rst:528 msgid "" "This is the equivalent to the Python expression ``aiter(o)``. Takes an :" "class:`AsyncIterable` object and returns an :class:`AsyncIterator` for it. " @@ -743,70 +820,83 @@ msgid "" "`AsyncIterator`, this returns itself. Raises :exc:`TypeError` and returns " "``NULL`` if the object cannot be iterated." msgstr "" +"Python の式 ``aiter(o)`` と同等です。\n" +":class:`AsyncIterable` オブジェクトを受け取り、それに対する :class:" +"`AsyncIterator` を返します。\n" +"通常は新しいイテレータですが、引数が :class:`AsyncIterator` の場合はそれ自身" +"を返します。\n" +"オブジェクトを反復処理できない場合は :exc:`TypeError` を送出して ``NULL`` を" +"返します。" -#: ../../c-api/object.rst:538 msgid "Get a pointer to subclass-specific data reserved for *cls*." -msgstr "" +msgstr "*cls* 用に確保されたサブクラス固有のデータへのポインタを取得します。" -#: ../../c-api/object.rst:540 msgid "" "The object *o* must be an instance of *cls*, and *cls* must have been " "created using negative :c:member:`PyType_Spec.basicsize`. Python does not " "check this." msgstr "" +"オブジェクト *o* は *cls* のインスタンスでなければならず、*cls* は負の :c:" +"member:`PyType_Spec.basicsize` を使って作成されていなければなりません。\n" +"Python はこれを検証しません。" -#: ../../c-api/object.rst:544 msgid "On error, set an exception and return ``NULL``." -msgstr "" +msgstr "エラー時には例外を設定して ``NULL`` を返します。" -#: ../../c-api/object.rst:550 msgid "" "Return the size of the instance memory space reserved for *cls*, i.e. the " "size of the memory :c:func:`PyObject_GetTypeData` returns." msgstr "" +"*cls* 用に確保されたインスタンスのメモリ領域のサイズ、つまり :c:func:" +"`PyObject_GetTypeData` が返すメモリのサイズを返します。" -#: ../../c-api/object.rst:553 msgid "" "This may be larger than requested using :c:member:`-PyType_Spec.basicsize " "`; it is safe to use this larger size (e.g. with :c:" "func:`!memset`)." msgstr "" +"このサイズは :c:member:`-PyType_Spec.basicsize ` で要" +"求したサイズより大きい場合があります。\n" +"その大きいサイズを使っても安全です (例えば :c:func:`!memset` で使えます)。" -#: ../../c-api/object.rst:556 msgid "" "The type *cls* **must** have been created using negative :c:member:" "`PyType_Spec.basicsize`. Python does not check this." msgstr "" +"型 *cls* は負の :c:member:`PyType_Spec.basicsize` を使って作成されて **いなけ" +"ればなりません**。\n" +"Python はこれを検証しません。" -#: ../../c-api/object.rst:560 msgid "On error, set an exception and return a negative value." -msgstr "" +msgstr "エラー時は例外を設定して負の値を返します。" -#: ../../c-api/object.rst:566 msgid "" "Get a pointer to per-item data for a class with :c:macro:" "`Py_TPFLAGS_ITEMS_AT_END`." msgstr "" +":c:macro:`Py_TPFLAGS_ITEMS_AT_END` が設定されたクラスの、要素ごとのデータへの" +"ポインタを取得します。" -#: ../../c-api/object.rst:569 msgid "" "On error, set an exception and return ``NULL``. :py:exc:`TypeError` is " "raised if *o* does not have :c:macro:`Py_TPFLAGS_ITEMS_AT_END` set." msgstr "" +"エラー時は例外を設定して ``NULL`` を返します。\n" +"*o* に :c:macro:`Py_TPFLAGS_ITEMS_AT_END` が設定されていない場合は :py:exc:" +"`TypeError` を送出します。" -#: ../../c-api/object.rst:577 msgid "Visit the managed dictionary of *obj*." -msgstr "" +msgstr "*obj* のマネージド辞書を巡回します。" -#: ../../c-api/object.rst:579 ../../c-api/object.rst:588 msgid "" "This function must only be called in a traverse function of the type which " "has the :c:macro:`Py_TPFLAGS_MANAGED_DICT` flag set." msgstr "" +"この関数は :c:macro:`Py_TPFLAGS_MANAGED_DICT` フラグが設定された型の巡回関数" +"内でのみ呼び出さなければなりません。" -#: ../../c-api/object.rst:586 msgid "Clear the managed dictionary of *obj*." -msgstr "" +msgstr "*obj* のマネージド辞書をクリアします。" #: ../../c-api/object.rst:595 msgid "" @@ -826,13 +916,16 @@ msgid "" "runtime. This function is thread-safe, and cannot fail." msgstr "" -#: ../../c-api/object.rst:606 msgid "" "This function does nothing on builds with the :term:`GIL` enabled, which do " "not support deferred reference counting. This also does nothing if *obj* is " "not an object tracked by the garbage collector (see :func:`gc.is_tracked` " "and :c:func:`PyObject_GC_IsTracked`)." msgstr "" +":term:`GIL` が有効なビルドは遅延参照カウントをサポートしないため、この関数は" +"何もしません。\n" +"*obj* がガベージコレクタの追跡対象でない場合も何もしません (:func:`gc." +"is_tracked` と :c:func:`PyObject_GC_IsTracked` を参照)。" #: ../../c-api/object.rst:611 msgid "" @@ -840,15 +933,17 @@ msgid "" "code that creates it." msgstr "" -#: ../../c-api/object.rst:618 msgid "" "Check if *obj* is a unique temporary object. Returns ``1`` if *obj* is known " "to be a unique temporary object, and ``0`` otherwise. This function cannot " "fail, but the check is conservative, and may return ``0`` in some cases even " "if *obj* is a unique temporary object." msgstr "" +"*obj* が唯一の参照を持つ一時オブジェクトかどうかを調べます。\n" +"そうであると分かる場合は ``1``、それ以外の場合は ``0`` を返します。\n" +"この関数は失敗しませんが、判定は保守的なので、実際に唯一の参照を持つ一時オブ" +"ジェクトでも ``0`` を返すことがあります。" -#: ../../c-api/object.rst:624 msgid "" "If an object is a unique temporary, it is guaranteed that the current code " "has the only reference to the object. For arguments to C functions, this " @@ -859,51 +954,65 @@ msgid "" "a reference count of ``1`` by itself does not guarantee that a function " "argument uniquely referenced." msgstr "" +"オブジェクトが唯一の参照を持つ一時オブジェクトであれば、現在のコードがそのオ" +"ブジェクトへの唯一の参照を持つことが保証されます。\n" +"C 関数の引数については、参照カウントが ``1`` かどうかを調べる代わりにこの関数" +"を使うべきです。\n" +"Python 3.14 以降、インタープリタはオペランドスタックにオブジェクトを読み込む" +"とき、可能であれば参照を :term:`借用 ` して一部の参照カウ" +"ントの変更を省略します。\n" +"このため、参照カウントが ``1`` というだけでは、関数の引数への参照が唯一である" +"ことは保証されません。" -#: ../../c-api/object.rst:633 msgid "" "In the example below, ``my_func`` is called with a unique temporary object " "as its argument::" msgstr "" +"次の例では、``my_func`` に渡される引数は唯一の参照を持つ一時オブジェクトで" +"す。 ::" -#: ../../c-api/object.rst:636 msgid "my_func([1, 2, 3])" -msgstr "" +msgstr "my_func([1, 2, 3])" -#: ../../c-api/object.rst:638 msgid "" "In the example below, ``my_func`` is **not** called with a unique temporary " "object as its argument, even if its refcount is ``1``::" msgstr "" +"次の例では、参照カウントが ``1`` であっても、``my_func`` に渡される引数は唯一" +"の参照を持つ一時オブジェクトでは **ありません**。 ::" -#: ../../c-api/object.rst:641 msgid "" "my_list = [1, 2, 3]\n" "my_func(my_list)" msgstr "" +"my_list = [1, 2, 3]\n" +"my_func(my_list)" -#: ../../c-api/object.rst:644 msgid "See also the function :c:func:`Py_REFCNT`." -msgstr "" +msgstr ":c:func:`Py_REFCNT` 関数も参照してください。" -#: ../../c-api/object.rst:650 msgid "" "This function returns non-zero if *obj* is :term:`immortal`, and zero " "otherwise. This function cannot fail." msgstr "" +"*obj* が :term:`不死 ` の場合はゼロ以外、そうでなければゼロを返しま" +"す。\n" +"この関数は失敗しません。" -#: ../../c-api/object.rst:655 msgid "" "Objects that are immortal in one CPython version are not guaranteed to be " "immortal in another." msgstr "" +"ある CPython バージョンで不死のオブジェクトが、別のバージョンでも不死であると" +"は限りません。" -#: ../../c-api/object.rst:662 msgid "" "Increments the reference count of *obj* if it is not zero. Returns ``1`` if " "the object's reference count was successfully incremented. Otherwise, this " "function returns ``0``." msgstr "" +"*obj* の参照カウントがゼロでなければ、参照カウントを増やします。\n" +"増やすことに成功した場合は ``1``、それ以外の場合は ``0`` を返します。" #: ../../c-api/object.rst:666 msgid "" @@ -918,7 +1027,6 @@ msgid "" "it behaves atomically in the :term:`free threading` build::" msgstr "" -#: ../../c-api/object.rst:673 msgid "" "if (Py_REFCNT(op) > 0) {\n" " Py_INCREF(op);\n" @@ -926,22 +1034,30 @@ msgid "" "}\n" "return 0;" msgstr "" +"if (Py_REFCNT(op) > 0) {\n" +" Py_INCREF(op);\n" +" return 1;\n" +"}\n" +"return 0;" -#: ../../c-api/object.rst:679 msgid "" "This is intended as a building block for managing weak references without " "the overhead of a Python :ref:`weak reference object `." msgstr "" +"これは、Python の :ref:`弱参照オブジェクト ` のオーバーヘッド" +"なしで弱参照を管理するための基礎として使うことを想定しています。" -#: ../../c-api/object.rst:682 msgid "" "Typically, correct use of this function requires support from *obj*'s " "deallocator (:c:member:`~PyTypeObject.tp_dealloc`). For example, the " "following sketch could be adapted to implement a \"weakmap\" that works like " "a :py:class:`~weakref.WeakValueDictionary` for a specific type:" msgstr "" +"通常、この関数を正しく使うには *obj* の解放関数 (:c:member:`~PyTypeObject." +"tp_dealloc`) によるサポートが必要です。\n" +"例えば、次の概略コードを応用すると、特定の型に対して :py:class:`~weakref." +"WeakValueDictionary` のように動作する「weakmap」を実装できます。" -#: ../../c-api/object.rst:688 msgid "" "PyMutex mutex;\n" "\n" @@ -985,22 +1101,65 @@ msgid "" " PyMutex_Unlock(&mutex);\n" "}" msgstr "" +"PyMutex mutex;\n" +"\n" +"PyObject *\n" +"add_entry(weakmap_key_type *key, PyObject *value)\n" +"{\n" +" PyUnstable_EnableTryIncRef(value);\n" +" weakmap_type weakmap = ...;\n" +" PyMutex_Lock(&mutex);\n" +" weakmap_add_entry(weakmap, key, value);\n" +" PyMutex_Unlock(&mutex);\n" +" Py_RETURN_NONE;\n" +"}\n" +"\n" +"PyObject *\n" +"get_value(weakmap_key_type *key)\n" +"{\n" +" weakmap_type weakmap = ...;\n" +" PyMutex_Lock(&mutex);\n" +" PyObject *result = weakmap_find(weakmap, key);\n" +" if (PyUnstable_TryIncRef(result)) {\n" +" // `result` は安全に使える\n" +" PyMutex_Unlock(&mutex);\n" +" return result;\n" +" }\n" +" // ここに到達した場合、`result` のガベージコレクションが始まっている" +"が、\n" +" // まだ weakmap からは削除されていない\n" +" PyMutex_Unlock(&mutex);\n" +" return NULL;\n" +"}\n" +"\n" +"// weakmap の値の tp_dealloc 関数\n" +"void\n" +"value_dealloc(PyObject *value)\n" +"{\n" +" weakmap_type weakmap = ...;\n" +" PyMutex_Lock(&mutex);\n" +" weakmap_remove_value(weakmap, value);\n" +"\n" +" ...\n" +" PyMutex_Unlock(&mutex);\n" +"}" -#: ../../c-api/object.rst:736 msgid "" "Enables subsequent uses of :c:func:`PyUnstable_TryIncRef` on *obj*. The " "caller must hold a :term:`strong reference` to *obj* when calling this." msgstr "" +"*obj* に対して後で :c:func:`PyUnstable_TryIncRef` を使えるようにします。\n" +"呼び出し時に、呼び出し側は *obj* への :term:`強参照 ` を保" +"持していなければなりません。" -#: ../../c-api/object.rst:743 msgid "Determine if *op* only has one reference." -msgstr "" +msgstr "*op* への参照が 1 つだけかどうかを調べます。" -#: ../../c-api/object.rst:745 msgid "" "On GIL-enabled builds, this function is equivalent to :c:expr:`Py_REFCNT(op) " "== 1`." msgstr "" +"GIL が有効なビルドでは、この関数は :c:expr:`Py_REFCNT(op) == 1` と同等です。" #: ../../c-api/object.rst:748 msgid "" @@ -1010,12 +1169,15 @@ msgid "" "safe on free threaded builds; prefer this function." msgstr "" -#: ../../c-api/object.rst:753 msgid "" "The caller must hold an :term:`attached thread state`, despite the fact that " "this function doesn't call into the Python interpreter. This function cannot " "fail." msgstr "" +"この関数は Python インタープリタを呼び出しませんが、呼び出し側は :term:`ア" +"タッチされたスレッド状態 ` を保持していなければなりま" +"せん。\n" +"この関数は失敗しません。" #: ../../c-api/object.rst:316 ../../c-api/object.rst:328 #: ../../c-api/object.rst:353 ../../c-api/object.rst:404 diff --git a/c-api/objimpl.po b/c-api/objimpl.po index aef6c69cd..876877bfe 100644 --- a/c-api/objimpl.po +++ b/c-api/objimpl.po @@ -16,10 +16,10 @@ msgstr "" "Last-Translator: tomo, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../c-api/objimpl.rst:7 diff --git a/c-api/refcounting.po b/c-api/refcounting.po index 1e84199db..805eac979 100644 --- a/c-api/refcounting.po +++ b/c-api/refcounting.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../c-api/refcounting.rst:8 @@ -68,11 +68,12 @@ msgid "" "that instead." msgstr "" -#: ../../c-api/refcounting.rst:33 msgid "" "See also the function :c:func:" "`PyUnstable_Object_IsUniqueReferencedTemporary()`." msgstr "" +":c:func:`PyUnstable_Object_IsUniqueReferencedTemporary()` 関数も参照してくだ" +"さい。" #: ../../c-api/refcounting.rst:35 msgid ":c:func:`Py_REFCNT()` is changed to the inline static function." @@ -113,16 +114,20 @@ msgstr "" "オブジェクト *o* への新しい :term:`強参照 ` を取得し、それ" "が使用中で破棄されてはならないことを示します。" -#: ../../c-api/refcounting.rst:64 msgid "" "This function is usually used to convert a :term:`borrowed reference` to a :" "term:`strong reference` in-place. The :c:func:`Py_NewRef` function can be " "used to create a new :term:`strong reference`." msgstr "" +"この関数は通常、:term:`借用参照 ` をその場で :term:`強参" +"照 ` に変換するために使います。\n" +"新しい :term:`強参照 ` の作成には :c:func:`Py_NewRef` 関数" +"を使えます。" -#: ../../c-api/refcounting.rst:68 msgid "When done using the object, release is by calling :c:func:`Py_DECREF`." msgstr "" +"オブジェクトを使い終わったら、:c:func:`Py_DECREF` を呼び出して参照を解放しま" +"す。" #: ../../c-api/refcounting.rst:70 msgid "" @@ -132,88 +137,99 @@ msgstr "" "オブジェクトが ``NULL`` であってはいけません。それが ``NULL`` ではないと確信" "が持てないならば、 :c:func:`Py_XINCREF` を使ってください。" -#: ../../c-api/refcounting.rst:73 msgid "" "Do not expect this function to actually modify *o* in any way. For at least :" "pep:`some objects <0683>`, this function has no effect." msgstr "" +"この関数が実際に ``o`` を変更するとは限りません。\n" +"少なくとも :pep:`一部のオブジェクト <0683>` に対しては、この関数は何もしませ" +"ん。" -#: ../../c-api/refcounting.rst:83 msgid "" "Similar to :c:func:`Py_INCREF`, but the object *o* can be ``NULL``, in which " "case this has no effect." msgstr "" +":c:func:`Py_INCREF` と同様ですが、オブジェクト ``o`` は ``NULL`` でも構いませ" +"ん。\n" +"その場合は何もしません。" -#: ../../c-api/refcounting.rst:86 msgid "See also :c:func:`Py_XNewRef`." -msgstr "" +msgstr ":c:func:`Py_XNewRef` も参照してください。" -#: ../../c-api/refcounting.rst:91 msgid "" "Create a new :term:`strong reference` to an object: call :c:func:`Py_INCREF` " "on *o* and return the object *o*." msgstr "" +"オブジェクトへの新しい :term:`強参照 ` を作成します。\n" +"``o`` に対して :c:func:`Py_INCREF` を呼び出し、オブジェクト ``o`` を返しま" +"す。" -#: ../../c-api/refcounting.rst:94 msgid "" "When the :term:`strong reference` is no longer needed, :c:func:`Py_DECREF` " "should be called on it to release the reference." msgstr "" +":term:`強参照 ` が不要になったら、:c:func:`Py_DECREF` を呼" +"び出して解放してください。" -#: ../../c-api/refcounting.rst:97 msgid "" "The object *o* must not be ``NULL``; use :c:func:`Py_XNewRef` if *o* can be " "``NULL``." msgstr "" +"オブジェクト ``o`` は ``NULL`` であってはいけません。\n" +"``o`` が ``NULL`` になり得る場合は :c:func:`Py_XNewRef` を使ってください。" #: ../../c-api/refcounting.rst:100 msgid "For example::" msgstr "例えば::" -#: ../../c-api/refcounting.rst:102 msgid "" "Py_INCREF(obj);\n" "self->attr = obj;" msgstr "" +"Py_INCREF(obj);\n" +"self->attr = obj;" -#: ../../c-api/refcounting.rst:105 msgid "can be written as::" -msgstr "" +msgstr "は次のように書けます。 ::" -#: ../../c-api/refcounting.rst:107 msgid "self->attr = Py_NewRef(obj);" -msgstr "" +msgstr "self->attr = Py_NewRef(obj);" -#: ../../c-api/refcounting.rst:109 msgid "See also :c:func:`Py_INCREF`." -msgstr "" +msgstr ":c:func:`Py_INCREF` も参照してください。" -#: ../../c-api/refcounting.rst:116 msgid "Similar to :c:func:`Py_NewRef`, but the object *o* can be NULL." msgstr "" +":c:func:`Py_NewRef` と同様ですが、オブジェクト ``o`` は ``NULL`` でも構いませ" +"ん。" -#: ../../c-api/refcounting.rst:118 msgid "If the object *o* is ``NULL``, the function just returns ``NULL``." msgstr "" +"オブジェクト ``o`` が ``NULL`` の場合、この関数は単に ``NULL`` を返します。" -#: ../../c-api/refcounting.rst:125 msgid "" "Release a :term:`strong reference` to object *o*, indicating the reference " "is no longer used." msgstr "" +"オブジェクト ``o`` への :term:`強参照 ` を解放し、その参照" +"をもう使わないことを示します。" -#: ../../c-api/refcounting.rst:130 msgid "" "Once the last :term:`strong reference` is released (i.e. the object's " "reference count reaches 0), the object's type's deallocation function (which " "must not be ``NULL``) is invoked." msgstr "" +"最後の :term:`強参照 ` が解放されると (つまり、オブジェクト" +"の参照カウントが 0 になると)、そのオブジェクトの型の解放関数が呼び出されま" +"す。\n" +"この関数は ``NULL`` であってはいけません。" -#: ../../c-api/refcounting.rst:135 msgid "" "This function is usually used to delete a :term:`strong reference` before " "exiting its scope." msgstr "" +"この関数は通常、スコープを抜ける前に :term:`強参照 ` を削除" +"するために使います。" #: ../../c-api/refcounting.rst:138 msgid "" @@ -223,13 +239,14 @@ msgstr "" "オブジェクトが ``NULL`` であってはいけません。それが ``NULL`` ではないと確信" "が持てないならば、 :c:func:`Py_XDECREF` を使ってください。" -#: ../../c-api/refcounting.rst:141 msgid "" "Do not expect this function to actually modify *o* in any way. For at least :" "pep:`some objects <683>`, this function has no effect." msgstr "" +"この関数が実際に ``o`` を変更するとは限りません。\n" +"少なくとも :pep:`一部のオブジェクト <683>` に対しては、この関数は何もしませ" +"ん。" -#: ../../c-api/refcounting.rst:147 msgid "" "The deallocation function can cause arbitrary Python code to be invoked (e." "g. when a class instance with a :meth:`~object.__del__` method is " @@ -241,15 +258,26 @@ msgid "" "object in a temporary variable, update the list data structure, and then " "call :c:func:`Py_DECREF` for the temporary variable." msgstr "" +"解放関数は任意の Python コードを呼び出すことがあります (例えば :meth:" +"`~object.__del__` メソッドを持つクラスのインスタンスを解放するとき)。\n" +"そのコード内の例外は伝播しませんが、実行されるコードは Python のすべてのグ" +"ローバル変数に自由にアクセスできます。\n" +"このため、グローバル変数から到達できるオブジェクトは、:c:func:`Py_DECREF` を" +"呼び出す前に整合性の取れた状態にしておく必要があります。\n" +"例えば、リストからオブジェクトを削除するコードでは、そのオブジェクトへの参照" +"を一時変数にコピーしてからリストのデータ構造を更新し、その後で一時変数に対し" +"て :c:func:`Py_DECREF` を呼び出すべきです。" -#: ../../c-api/refcounting.rst:162 msgid "" "Similar to :c:func:`Py_DECREF`, but the object *o* can be ``NULL``, in which " "case this has no effect. The same warning from :c:func:`Py_DECREF` applies " "here as well." msgstr "" +":c:func:`Py_DECREF` と同様ですが、オブジェクト ``o`` は ``NULL`` でも構いませ" +"ん。\n" +"その場合は何もしません。\n" +":c:func:`Py_DECREF` と同じ警告がここにも当てはまります。" -#: ../../c-api/refcounting.rst:169 msgid "" "Release a :term:`strong reference` for object *o*. The object may be " "``NULL``, in which case the macro has no effect; otherwise the effect is the " @@ -258,55 +286,70 @@ msgid "" "to the object passed because the macro carefully uses a temporary variable " "and sets the argument to ``NULL`` before releasing the reference." msgstr "" +"オブジェクト ``o`` への :term:`強参照 ` を解放します。\n" +"オブジェクトは ``NULL`` でもよく、その場合は何もしません。\n" +"それ以外の場合は :c:func:`Py_DECREF` と同じ効果がありますが、引数も ``NULL`` " +"に設定します。\n" +"このマクロは一時変数を使い、参照を解放する前に引数を ``NULL`` に設定するた" +"め、渡したオブジェクトについては :c:func:`Py_DECREF` の警告は当てはまりませ" +"ん。" -#: ../../c-api/refcounting.rst:177 msgid "" "It is a good idea to use this macro whenever releasing a reference to an " "object that might be traversed during garbage collection." msgstr "" +"ガベージコレクション中に走査される可能性のあるオブジェクトへの参照を解放する" +"ときは、このマクロを使うとよいでしょう。" -#: ../../c-api/refcounting.rst:180 msgid "" "The macro argument is now only evaluated once. If the argument has side " "effects, these are no longer duplicated." msgstr "" +"マクロの引数を 1 回だけ評価するようになりました。\n" +"引数に副作用がある場合も、それが重複して発生することはなくなりました。" -#: ../../c-api/refcounting.rst:187 msgid "" "Indicate taking a new :term:`strong reference` to object *o*. A function " "version of :c:func:`Py_XINCREF`. It can be used for runtime dynamic " "embedding of Python." msgstr "" +"オブジェクト ``o`` への新しい :term:`強参照 ` を取得するこ" +"とを示します。\n" +":c:func:`Py_XINCREF` の関数版です。\n" +"実行時に Python を動的に組み込むために使えます。" -#: ../../c-api/refcounting.rst:194 msgid "" "Release a :term:`strong reference` to object *o*. A function version of :c:" "func:`Py_XDECREF`. It can be used for runtime dynamic embedding of Python." msgstr "" +"オブジェクト ``o`` への :term:`強参照 ` を解放します。\n" +":c:func:`Py_XDECREF` の関数版です。\n" +"実行時に Python を動的に組み込むために使えます。" -#: ../../c-api/refcounting.rst:201 msgid "" "Macro safely releasing a :term:`strong reference` to object *dst* and " "setting *dst* to *src*." msgstr "" +"オブジェクト ``dst`` への :term:`強参照 ` を安全に解放し、" +"``dst`` を ``src`` に設定するマクロです。" -#: ../../c-api/refcounting.rst:204 msgid "As in case of :c:func:`Py_CLEAR`, \"the obvious\" code can be deadly::" msgstr "" +":c:func:`Py_CLEAR` の場合と同様に、「当然」と思える次のコードは致命的な結果を" +"招くことがあります。 ::" -#: ../../c-api/refcounting.rst:206 msgid "" "Py_DECREF(dst);\n" "dst = src;" msgstr "" +"Py_DECREF(dst);\n" +"dst = src;" -#: ../../c-api/refcounting.rst:209 msgid "The safe way is::" -msgstr "" +msgstr "安全な書き方は次のとおりです。 ::" -#: ../../c-api/refcounting.rst:211 msgid "Py_SETREF(dst, src);" -msgstr "" +msgstr "Py_SETREF(dst, src);" #: ../../c-api/refcounting.rst:213 msgid "" @@ -315,14 +358,16 @@ msgid "" "getting torn down no longer believes *dst* points to a valid object." msgstr "" -#: ../../c-api/refcounting.rst:220 ../../c-api/refcounting.rst:232 msgid "" "The macro arguments are now only evaluated once. If an argument has side " "effects, these are no longer duplicated." msgstr "" +"マクロの引数をそれぞれ 1 回だけ評価するようになりました。\n" +"引数に副作用がある場合も、それが重複して発生することはなくなりました。" -#: ../../c-api/refcounting.rst:227 msgid "" "Variant of :c:macro:`Py_SETREF` macro that uses :c:func:`Py_XDECREF` instead " "of :c:func:`Py_DECREF`." msgstr "" +":c:func:`Py_DECREF` の代わりに :c:func:`Py_XDECREF` を使う :c:macro:" +"`Py_SETREF` マクロの変種です。" diff --git a/c-api/reflection.po b/c-api/reflection.po index 525672c97..2d9e0fdc3 100644 --- a/c-api/reflection.po +++ b/c-api/reflection.po @@ -16,19 +16,18 @@ msgstr "" "Last-Translator: tomo, 2021\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../c-api/reflection.rst:6 msgid "Reflection" msgstr "リフレクション" -#: ../../c-api/reflection.rst:12 msgid "Use :c:func:`PyEval_GetFrameBuiltins` instead." -msgstr "" +msgstr "代わりに :c:func:`PyEval_GetFrameBuiltins` を使ってください。" #: ../../c-api/reflection.rst:14 ../../c-api/reflection.rst:66 msgid "" @@ -38,27 +37,31 @@ msgstr "" "現在の実行フレーム内のビルトインの辞書か、もし実行中のフレームがなければス" "レッド状態のインタプリタのビルトイン辞書を返します。" -#: ../../c-api/reflection.rst:22 msgid "" "Use either :c:func:`PyEval_GetFrameLocals` to obtain the same behaviour as " "calling :func:`locals` in Python code, or else call :c:func:" "`PyFrame_GetLocals` on the result of :c:func:`PyEval_GetFrame` to access " "the :attr:`~frame.f_locals` attribute of the currently executing frame." msgstr "" +"Python コードで :func:`locals` を呼び出すのと同じ動作を得るには :c:func:" +"`PyEval_GetFrameLocals` を使ってください。\n" +"または、現在実行中のフレームの :attr:`~frame.f_locals` 属性にアクセスするに" +"は、:c:func:`PyEval_GetFrame` の戻り値に対して :c:func:`PyFrame_GetLocals` を" +"呼び出してください。" -#: ../../c-api/reflection.rst:27 msgid "" "Return a mapping providing access to the local variables in the current " "execution frame, or ``NULL`` if no frame is currently executing." msgstr "" +"現在の実行フレームのローカル変数にアクセスするためのマッピングを返します。\n" +"現在実行中のフレームがなければ ``NULL`` を返します。" -#: ../../c-api/reflection.rst:30 msgid "" "Refer to :func:`locals` for details of the mapping returned at different " "scopes." msgstr "" +"スコープごとに返されるマッピングの詳細は :func:`locals` を参照してください。" -#: ../../c-api/reflection.rst:32 msgid "" "As this function returns a :term:`borrowed reference`, the dictionary " "returned for :term:`optimized scopes ` is cached on the " @@ -68,18 +71,27 @@ msgid "" "to reflect changes in the state of the local variables rather than returning " "a new snapshot." msgstr "" +"この関数は :term:`借用参照 ` を返すため、:term:`最適化さ" +"れたスコープ ` に対して返される辞書はフレームオブジェクトに" +"キャッシュされ、フレームオブジェクトが生存する限り生存し続けます。\n" +":c:func:`PyEval_GetFrameLocals` や :func:`locals` と異なり、同じフレームでこ" +"の関数を再度呼び出すと、新しいスナップショットを返す代わりに、ローカル変数の" +"状態の変化を反映するようキャッシュした辞書の内容を更新します。" -#: ../../c-api/reflection.rst:39 msgid "" "As part of :pep:`667`, :c:func:`PyFrame_GetLocals`, :func:`locals`, and :" "attr:`FrameType.f_locals ` no longer make use of the shared " "cache dictionary. Refer to the :ref:`What's New entry ` for additional details." msgstr "" +":pep:`667` の変更の一環として、:c:func:`PyFrame_GetLocals`、:func:`locals`、:" +"attr:`FrameType.f_locals ` は共有キャッシュ辞書を使わなくなり" +"ました。\n" +"詳しくは :ref:`What's New の該当項目 ` を参照し" +"てください。" -#: ../../c-api/reflection.rst:50 msgid "Use :c:func:`PyEval_GetFrameGlobals` instead." -msgstr "" +msgstr "代わりに :c:func:`PyEval_GetFrameGlobals` を使ってください。" #: ../../c-api/reflection.rst:52 msgid "" @@ -89,53 +101,59 @@ msgstr "" "現在の実行フレーム内のグローバル変数の辞書か、実行中のフレームがなければ " "``NULL`` を返します。" -#: ../../c-api/reflection.rst:58 msgid "" "Return the :term:`attached thread state`'s frame, which is ``NULL`` if no " "frame is currently executing." msgstr "" +":term:`アタッチされたスレッド状態 ` のフレームを返しま" +"す。\n" +"現在実行中のフレームがなければ ``NULL`` です。" -#: ../../c-api/reflection.rst:61 msgid "See also :c:func:`PyThreadState_GetFrame`." -msgstr "" +msgstr ":c:func:`PyThreadState_GetFrame` も参照してください。" -#: ../../c-api/reflection.rst:74 msgid "" "Return a dictionary of the local variables in the current execution frame, " "or ``NULL`` if no frame is currently executing. Equivalent to calling :func:" "`locals` in Python code." msgstr "" +"現在の実行フレームのローカル変数の辞書を返します。\n" +"現在実行中のフレームがなければ ``NULL`` を返します。\n" +"Python コードで :func:`locals` を呼び出すことと等価です。" -#: ../../c-api/reflection.rst:78 msgid "" "To access :attr:`~frame.f_locals` on the current frame without making an " "independent snapshot in :term:`optimized scopes `, call :c:" "func:`PyFrame_GetLocals` on the result of :c:func:`PyEval_GetFrame`." msgstr "" +":term:`最適化されたスコープ ` で独立したスナップショットを作" +"らずに、現在のフレームの :attr:`~frame.f_locals` にアクセスするには、:c:func:" +"`PyEval_GetFrame` の戻り値に対して :c:func:`PyFrame_GetLocals` を呼び出してく" +"ださい。" -#: ../../c-api/reflection.rst:87 msgid "" "Return a dictionary of the global variables in the current execution frame, " "or ``NULL`` if no frame is currently executing. Equivalent to calling :func:" "`globals` in Python code." msgstr "" +"現在の実行フレームのグローバル変数の辞書を返します。\n" +"現在実行中のフレームがなければ ``NULL`` を返します。\n" +"Python コードで :func:`globals` を呼び出すことと等価です。" -#: ../../c-api/reflection.rst:96 msgid "" "Return the name of *func* if it is a function, class or instance object, " "else the name of *func*\\s type." msgstr "" -"*func* が関数、クラス、インスタンスオブジェクトであればその名前を、そうでなけ" -"れば *func* の型を返します。" +"*func* が関数、クラス、インスタンスオブジェクトであればその名前を返し、それ以" +"外の場合は *func* の型の名前を返します。" -#: ../../c-api/reflection.rst:102 msgid "" "Return a description string, depending on the type of *func*. Return values " "include \"()\" for functions and methods, \" constructor\", \" instance\", " "and \" object\". Concatenated with the result of :c:func:" "`PyEval_GetFuncName`, the result will be a description of *func*." msgstr "" -"*func* の型に依存する、解説文字列(description string)を返します。戻り値は、関" -"数とメソッドに対しては \"()\", \" constructor\", \" instance\", \" object\" " -"です。 :c:func:`PyEval_GetFuncName` と連結された結果、 *func* の解説になりま" -"す。" +"*func* の型に応じた説明文字列を返します。\n" +"戻り値には、関数とメソッドに対する \"()\" のほか、\" constructor\"、\" " +"instance\"、\" object\" があります。\n" +":c:func:`PyEval_GetFuncName` の戻り値に連結すると、*func* の説明になります。" diff --git a/c-api/sequence.po b/c-api/sequence.po index 81255b0fa..a3fbea75f 100644 --- a/c-api/sequence.po +++ b/c-api/sequence.po @@ -18,17 +18,16 @@ msgstr "" "Last-Translator: Nozomu Kaneko , 2023\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../c-api/sequence.rst:6 msgid "Sequence Protocol" msgstr "シーケンス型プロトコル (sequence protocol)" -#: ../../c-api/sequence.rst:11 msgid "" "Return ``1`` if the object provides the sequence protocol, and ``0`` " "otherwise. Note that it returns ``1`` for Python classes with a :meth:" @@ -36,6 +35,12 @@ msgid "" "since in general it is impossible to determine what type of keys the class " "supports. This function always succeeds." msgstr "" +"オブジェクトがシーケンス型プロトコルを提供していれば ``1``、それ以外なら " +"``0`` を返します。\n" +"一般に、クラスがどの型のキーをサポートするかは判定できないため、\n" +":meth:`~object.__getitem__` メソッドを持つ Python クラスに対しては、:class:" +"`dict` のサブクラスでない限り ``1`` を返します。\n" +"この関数は常に成功します。" #: ../../c-api/sequence.rst:23 msgid "" @@ -111,13 +116,12 @@ msgstr "" "これは Python の文 ``o[i] = v`` と同じです。\n" "この関数は *v* への参照を *盗み取りません* 。" -#: ../../c-api/sequence.rst:72 msgid "" "If *v* is ``NULL``, the element is deleted, but this feature is deprecated " "in favour of using :c:func:`PySequence_DelItem`." msgstr "" -"*v* が ``NULL`` の場合はその要素が削除されますが、この機能は非推奨であり、 :" -"c:func:`PyObject_DelAttr` を使うのが望ましいです。" +"*v* が ``NULL`` の場合は要素を削除しますが、この機能は非推奨です。\n" +"代わりに :c:func:`PySequence_DelItem` を使ってください。" #: ../../c-api/sequence.rst:78 msgid "" @@ -163,9 +167,8 @@ msgstr "" "(equal) ならば ``1`` を返し、それ以外の場合には ``0`` を返します。エラーが発" "生すると ``-1`` を返します。Python の式 ``value in o`` と同じです。" -#: ../../c-api/sequence.rst:110 msgid "Alias for :c:func:`PySequence_Contains`." -msgstr "" +msgstr ":c:func:`PySequence_Contains` の別名です。" #: ../../c-api/sequence.rst:112 msgid "" @@ -277,7 +280,6 @@ msgstr "" "ないことに注意してください。そのため、シーケンスの変更が発生しないコンテキス" "トでのみ背後にあるポインタを使ってください。" -#: ../../c-api/sequence.rst:182 msgid "" "Return the *i*\\ th element of *o* or ``NULL`` on failure. Faster form of :c:" "func:`PySequence_GetItem` but without checking that :c:func:" @@ -286,7 +288,7 @@ msgid "" msgstr "" "*o* の *i* 番目の要素を返し、失敗すると ``NULL`` を返します。 :c:func:" "`PySequence_GetItem` の高速版であり、:c:func:`PySequence_Check` で *o* が真を" -"返すかどうかの検証や、負の添え字の調整を行いません。 " +"返すかどうかの検証や、負の添え字の調整を行いません。" #: ../../c-api/sequence.rst:21 ../../c-api/sequence.rst:132 msgid "built-in function" diff --git a/c-api/set.po b/c-api/set.po index fbf223cd0..f04b2ddb0 100644 --- a/c-api/set.po +++ b/c-api/set.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: Nozomu Kaneko , 2023\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../c-api/set.rst:6 @@ -178,18 +178,20 @@ msgstr "" "以降の関数やマクロは、 :class:`set` と :class:`frozenset` とそのサブタイプの" "インスタンスに対して利用できます。" -#: ../../c-api/set.rst:112 msgid "" "Return the length of a :class:`set` or :class:`frozenset` object. Equivalent " "to ``len(anyset)``. Raises a :exc:`SystemError` if *anyset* is not a :class:" "`set`, :class:`frozenset`, or an instance of a subtype." msgstr "" +":class:`set` または :class:`frozenset` オブジェクトの長さを返します。\n" +"``len(anyset)`` と等価です。\n" +"*anyset* が :class:`set`、:class:`frozenset`、またはそのサブタイプのインスタ" +"ンスでない場合、:exc:`SystemError` を送出します。" #: ../../c-api/set.rst:119 msgid "Macro form of :c:func:`PySet_Size` without error checking." msgstr "エラーチェックを行わない、 :c:func:`PySet_Size` のマクロ形式。" -#: ../../c-api/set.rst:124 msgid "" "Return ``1`` if found, ``0`` if not found, and ``-1`` if an error is " "encountered. Unlike the Python :meth:`~object.__contains__` method, this " @@ -198,6 +200,13 @@ msgid "" "`SystemError` if *anyset* is not a :class:`set`, :class:`frozenset`, or an " "instance of a subtype." msgstr "" +"見付かれば ``1``、見付からなければ ``0``、エラーが起きれば ``-1`` を返しま" +"す。\n" +"Python の :meth:`~object.__contains__` メソッドとは異なり、ハッシュ不可能な集" +"合を一時的な frozenset に自動変換しません。\n" +"*key* がハッシュ不可能な場合、:exc:`TypeError` を送出します。\n" +"*anyset* が :class:`set`、:class:`frozenset`、またはそのサブタイプのインスタ" +"ンスでない場合、:exc:`SystemError` を送出します。" #: ../../c-api/set.rst:133 msgid "" @@ -250,12 +259,15 @@ msgstr "" "*set* が :class:`set` とそのサブタイプのインスタンスでない場合は、 :exc:" "`SystemError` を送出します。" -#: ../../c-api/set.rst:166 msgid "" "Empty an existing set of all elements. Return ``0`` on success. Return " "``-1`` and raise :exc:`SystemError` if *set* is not an instance of :class:" "`set` or its subtype." msgstr "" +"既存の集合のすべての要素を取り除いて空にします。\n" +"成功すると ``0`` を返します。\n" +"*set* が :class:`set` またはそのサブタイプのインスタンスでない場合、:exc:" +"`SystemError` を送出して ``-1`` を返します。" #: ../../c-api/set.rst:11 msgid "object" diff --git a/c-api/slice.po b/c-api/slice.po index 2c4dbdcd2..eb9d0596c 100644 --- a/c-api/slice.po +++ b/c-api/slice.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../c-api/slice.rst:6 @@ -44,19 +44,24 @@ msgstr "" "*ob* がスライスオブジェクトの場合に真を返します; *ob* は ``NULL`` であっては" "なりません。この関数は常に成功します。" -#: ../../c-api/slice.rst:23 msgid "" "Return a new slice object with the given values. The *start*, *stop*, and " "*step* parameters are used as the values of the slice object attributes of " "the same names. Any of the values may be ``NULL``, in which case the " "``None`` will be used for the corresponding attribute." msgstr "" +"指定された値を持つ新しいスライスオブジェクトを返します。\n" +"引数 ``start``、``stop``、``step`` は、スライスオブジェクトの同名の属性の値と" +"して使われます。\n" +"いずれの値も ``NULL`` で構いません。\n" +"その場合、対応する属性には ``None`` が使われます。" -#: ../../c-api/slice.rst:28 msgid "" "Return ``NULL`` with an exception set if the new object could not be " "allocated." msgstr "" +"新しいオブジェクトを割り当てられなかった場合は、例外を設定して ``NULL`` を返" +"します。" #: ../../c-api/slice.rst:34 msgid "" @@ -68,12 +73,15 @@ msgstr "" "クス値を取得します。このときシーケンスの長さを *length* と仮定します。" "*length* よりも大きなインデクスになるとエラーとして扱います。" -#: ../../c-api/slice.rst:38 msgid "" "Returns ``0`` on success and ``-1`` on error with no exception set (unless " "one of the indices was not ``None`` and failed to be converted to an " "integer, in which case ``-1`` is returned with an exception set)." msgstr "" +"成功した場合は ``0`` を返します。\n" +"エラーの場合は例外を設定せずに ``-1`` を返します。\n" +"ただし、いずれかのインデックスが ``None`` ではなく、整数に変換できなかった場" +"合は、例外を設定して ``-1`` を返します。" #: ../../c-api/slice.rst:42 msgid "You probably do not want to use this function." @@ -97,38 +105,46 @@ msgstr "" "*length* 、スライスの長さを *slicelength* に格納します。境界外のインデクスは" "通常のスライスと一貫した方法でクリップされます。" -#: ../../c-api/slice.rst:57 msgid "Return ``0`` on success and ``-1`` on error with an exception set." msgstr "" +"成功した場合は ``0`` を返し、エラーの場合は例外を設定して ``-1`` を返します。" -#: ../../c-api/slice.rst:60 msgid "" "This function is considered not safe for resizable sequences. Its invocation " "should be replaced by a combination of :c:func:`PySlice_Unpack` and :c:func:" "`PySlice_AdjustIndices` where ::" msgstr "" +"この関数は、サイズを変更できるシーケンスに対して安全ではないとされていま" +"す。\n" +":c:func:`PySlice_Unpack` と :c:func:`PySlice_AdjustIndices` の組み合わせに置" +"き換えてください。\n" +"次の呼び出しを、 ::" -#: ../../c-api/slice.rst:64 msgid "" "if (PySlice_GetIndicesEx(slice, length, &start, &stop, &step, &slicelength) " "< 0) {\n" " // return error\n" "}" msgstr "" +"if (PySlice_GetIndicesEx(slice, length, &start, &stop, &step, &slicelength) " +"< 0) {\n" +" // エラーを返す\n" +"}" -#: ../../c-api/slice.rst:68 msgid "is replaced by ::" -msgstr "" +msgstr "次のように置き換えます。 ::" -#: ../../c-api/slice.rst:70 msgid "" "if (PySlice_Unpack(slice, &start, &stop, &step) < 0) {\n" " // return error\n" "}\n" "slicelength = PySlice_AdjustIndices(length, &start, &stop, step);" msgstr "" +"if (PySlice_Unpack(slice, &start, &stop, &step) < 0) {\n" +" // エラーを返す\n" +"}\n" +"slicelength = PySlice_AdjustIndices(length, &start, &stop, step);" -#: ../../c-api/slice.rst:79 msgid "" "If ``Py_LIMITED_API`` is not set or set to the value between ``0x03050400`` " "and ``0x03060000`` (not including) or ``0x03060100`` or higher :c:func:`!" @@ -136,15 +152,21 @@ msgid "" "PySlice_Unpack` and :c:func:`!PySlice_AdjustIndices`. Arguments *start*, " "*stop* and *step* are evaluated more than once." msgstr "" +"``Py_LIMITED_API`` が設定されていない場合、または ``0x03050400`` 以上 " +"``0x03060000`` 未満か ``0x03060100`` 以上に設定されている場合、:c:func:`!" +"PySlice_GetIndicesEx` は :c:func:`!PySlice_Unpack` と :c:func:`!" +"PySlice_AdjustIndices` を使うマクロとして実装されています。\n" +"引数 ``start``、``stop``、``step`` は複数回評価されます。" -#: ../../c-api/slice.rst:86 msgid "" "If ``Py_LIMITED_API`` is set to the value less than ``0x03050400`` or " "between ``0x03060000`` and ``0x03060100`` (not including) :c:func:`!" "PySlice_GetIndicesEx` is a deprecated function." msgstr "" +"``Py_LIMITED_API`` が ``0x03050400`` 未満、または ``0x03060000`` 以上 " +"``0x03060100`` 未満に設定されている場合、:c:func:`!PySlice_GetIndicesEx` は非" +"推奨の関数です。" -#: ../../c-api/slice.rst:94 msgid "" "Extract the start, stop and step data members from a slice object as C " "integers. Silently reduce values larger than ``PY_SSIZE_T_MAX`` to " @@ -152,33 +174,44 @@ msgid "" "``PY_SSIZE_T_MIN`` to ``PY_SSIZE_T_MIN``, and silently boost the step values " "less than ``-PY_SSIZE_T_MAX`` to ``-PY_SSIZE_T_MAX``." msgstr "" +"スライスオブジェクトの start、stop、step データメンバを C の整数として取り出" +"します。\n" +"``PY_SSIZE_T_MAX`` を超える値は ``PY_SSIZE_T_MAX`` に切り下げます。\n" +"``PY_SSIZE_T_MIN`` より小さい start と stop は ``PY_SSIZE_T_MIN`` に切り上" +"げ、``-PY_SSIZE_T_MAX`` より小さい step は ``-PY_SSIZE_T_MAX`` に切り上げま" +"す。\n" +"これらの調整によってエラーにはなりません。" -#: ../../c-api/slice.rst:100 msgid "Return ``-1`` with an exception set on error, ``0`` on success." msgstr "" +"エラーの場合は例外を設定して ``-1`` を返し、成功した場合は ``0`` を返します。" -#: ../../c-api/slice.rst:107 msgid "" "Adjust start/end slice indices assuming a sequence of the specified length. " "Out of bounds indices are clipped in a manner consistent with the handling " "of normal slices." msgstr "" +"指定された長さのシーケンスを仮定し、スライスの開始と終了のインデックスを調整" +"します。\n" +"範囲外のインデックスは、通常のスライスの処理と同じ方法で範囲内に収めます。" -#: ../../c-api/slice.rst:111 msgid "" "Return the length of the slice. Always successful. Doesn't call Python " "code." msgstr "" +"スライスの長さを返します。\n" +"常に成功し、Python コードを呼び出しません。" #: ../../c-api/slice.rst:118 msgid "Ellipsis Object" msgstr "Ellipsis オブジェクト" -#: ../../c-api/slice.rst:123 msgid "" "The type of Python :const:`Ellipsis` object. Same as :class:`types." "EllipsisType` in the Python layer." msgstr "" +"Python の :const:`Ellipsis` オブジェクトの型です。\n" +"Python レベルの :class:`types.EllipsisType` と同じです。" #: ../../c-api/slice.rst:129 msgid "" diff --git a/c-api/stable.po b/c-api/stable.po index 1e71009d2..2297ac83f 100644 --- a/c-api/stable.po +++ b/c-api/stable.po @@ -18,25 +18,29 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../c-api/stable.rst:7 msgid "C API Stability" msgstr "C API の安定性" -#: ../../c-api/stable.rst:9 msgid "" "Unless documented otherwise, Python's C API is covered by the Backwards " "Compatibility Policy, :pep:`387`. Most changes to it are source-compatible " "(typically by only adding new API). Changing existing API or removing API is " "only done after a deprecation period or to fix serious issues." msgstr "" +"特記のない限り、Python の C API には後方互換性ポリシー :pep:`387` が適用され" +"ます。\n" +"変更の大半はソース互換性を保ちます (通常は新しい API の追加だけを行いま" +"す)。\n" +"既存 API の変更や削除は、非推奨の期間を経た後、または重大な問題を修正するため" +"にのみ行います。" -#: ../../c-api/stable.rst:15 msgid "" "CPython's Application Binary Interface (ABI) is forward- and backwards-" "compatible across a minor release (if these are compiled the same way; see :" @@ -44,29 +48,36 @@ msgid "" "work on 3.10.8 and vice versa, but will need to be compiled separately for " "3.9.x and 3.11.x." msgstr "" +"CPython のアプリケーションバイナリインターフェース (ABI) は、同じマイナーリ" +"リース内で前方互換性と後方互換性を持ちます (同じ方法でコンパイルされている場" +"合。下記の :ref:`stable-abi-platform` を参照)。\n" +"したがって、Python 3.10.0 向けにコンパイルしたコードは 3.10.8 で動作し、その" +"逆も同様ですが、3.9.x や 3.11.x 向けには別にコンパイルする必要があります。" -#: ../../c-api/stable.rst:21 msgid "There are two tiers of C API with different stability expectations:" -msgstr "" +msgstr "C API には、期待される安定性が異なる二つの階層があります。" -#: ../../c-api/stable.rst:23 msgid "" ":ref:`Unstable API `, may change in minor versions without a " "deprecation period. It is marked by the ``PyUnstable`` prefix in names." msgstr "" +":ref:`不安定な API ` は、非推奨の期間なしにマイナーバージョン" +"間で変更される可能性があります。\n" +"名前の接頭辞 ``PyUnstable`` で識別できます。" -#: ../../c-api/stable.rst:25 msgid "" ":ref:`Limited API `, is compatible across several minor " "releases. When :c:macro:`Py_LIMITED_API` is defined, only this subset is " "exposed from ``Python.h``." msgstr "" +":ref:`Limited API ` は、複数のマイナーリリースにわたって互換性" +"を持ちます。\n" +":c:macro:`Py_LIMITED_API` を定義すると、``Python.h`` から公開されるのはこの部" +"分集合だけになります。" -#: ../../c-api/stable.rst:29 msgid "These are discussed in more detail below." -msgstr "" +msgstr "以下でそれぞれを詳しく説明します。" -#: ../../c-api/stable.rst:31 msgid "" "Names prefixed by an underscore, such as ``_Py_InternalState``, are private " "API that can change without notice even in patch releases. If you need to " @@ -74,29 +85,36 @@ msgid "" "python.org/c/core-dev/c-api/30>`_ to discuss adding public API for your use " "case." msgstr "" +"``_Py_InternalState`` のようにアンダースコアで始まる名前はプライベート API " +"で、パッチリリースでも予告なく変更される可能性があります。\n" +"この API を使う必要がある場合は、`CPython 開発者 `_ に連絡し、用途に合う公開 API の追加を相談することを検" +"討してください。" -#: ../../c-api/stable.rst:40 msgid "Unstable C API" -msgstr "" +msgstr "不安定な C API" -#: ../../c-api/stable.rst:44 msgid "" "Any API named with the ``PyUnstable`` prefix exposes CPython implementation " "details, and may change in every minor release (e.g. from 3.9 to 3.10) " "without any deprecation warnings. However, it will not change in a bugfix " "release (e.g. from 3.10.0 to 3.10.1)." msgstr "" +"接頭辞 ``PyUnstable`` を持つ API は CPython の実装の詳細を公開しており、マイ" +"ナーリリースごとに (例えば 3.9 から 3.10 で) 非推奨の警告なしに変更される可能" +"性があります。\n" +"ただし、バグ修正リリース (例えば 3.10.0 から 3.10.1) では変更されません。" -#: ../../c-api/stable.rst:49 msgid "" "It is generally intended for specialized, low-level tools like debuggers." -msgstr "" +msgstr "通常はデバッガのような、低レベルの専門的なツールを対象としています。" -#: ../../c-api/stable.rst:51 msgid "" "Projects that use this API are expected to follow CPython development and " "spend extra effort adjusting to changes." msgstr "" +"この API を使うプロジェクトには、CPython の開発を追い、変更への対応に追加の労" +"力をかけることが期待されます。" #: ../../c-api/stable.rst:56 msgid "Stable Application Binary Interface" @@ -371,6 +389,5 @@ msgid "" "items:" msgstr "" -#: ../../c-api/stable.rst:42 msgid "PyUnstable" -msgstr "" +msgstr "PyUnstable" diff --git a/c-api/structures.po b/c-api/structures.po index 30d57a971..1a28a4628 100644 --- a/c-api/structures.po +++ b/c-api/structures.po @@ -20,30 +20,27 @@ msgstr "" "Last-Translator: tomo, 2023\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../c-api/structures.rst:6 msgid "Common Object Structures" msgstr "共通のオブジェクト構造体 (common object structure)" -#: ../../c-api/structures.rst:8 msgid "" "There are a large number of structures which are used in the definition of " "object types for Python. This section describes these structures and how " "they are used." msgstr "" -"Python では、オブジェクト型を定義する上で数多くの構造体が使われます。この節で" -"は三つの構造体とその利用方法について説明します。" +"Python のオブジェクト型の定義には、多数の構造体が使われます。\n" +"この節では、それらの構造体と使い方を説明します。" -#: ../../c-api/structures.rst:14 msgid "Base object types and macros" -msgstr "" +msgstr "基本のオブジェクト型とマクロ" -#: ../../c-api/structures.rst:16 msgid "" "All Python objects ultimately share a small number of fields at the " "beginning of the object's representation in memory. These are represented " @@ -53,6 +50,13 @@ msgid "" "Additional macros can be found under :ref:`reference counting " "`." msgstr "" +"すべての Python オブジェクトは、メモリ上の表現の先頭に少数の共通フィールドを" +"持ちます。\n" +"これらを表すのが :c:type:`PyObject` 型と :c:type:`PyVarObject` 型です。\n" +"これらの型はマクロの展開によって定義され、そのマクロは他のすべての Python オ" +"ブジェクトの定義でも直接的または間接的に使われます。\n" +"その他のマクロについては :ref:`参照カウント ` を参照してくださ" +"い。" #: ../../c-api/structures.rst:26 msgid "" @@ -92,9 +96,8 @@ msgstr "" "です。\n" "PyObject_HEAD マクロは次のように展開されます::" -#: ../../c-api/structures.rst:50 msgid "PyObject ob_base;" -msgstr "" +msgstr "PyObject ob_base;" #: ../../c-api/structures.rst:52 msgid "See documentation of :c:type:`PyObject` above." @@ -110,45 +113,48 @@ msgstr "" "きに使うマクロです。\n" "PyObject_VAR_HEAD マクロは次のように展開されます::" -#: ../../c-api/structures.rst:61 msgid "PyVarObject ob_base;" -msgstr "" +msgstr "PyVarObject ob_base;" #: ../../c-api/structures.rst:63 msgid "See documentation of :c:type:`PyVarObject` above." msgstr "上にある :c:type:`PyVarObject` のドキュメントを参照してください。" -#: ../../c-api/structures.rst:68 msgid "" "The base class of all other objects, the same as :class:`object` in Python." msgstr "" +"他のすべてのオブジェクトの基底クラスで、Python の :class:`object` と同じで" +"す。" -#: ../../c-api/structures.rst:73 msgid "" "Test if the *x* object is the *y* object, the same as ``x is y`` in Python." msgstr "" +"オブジェクト *x* がオブジェクト *y* かどうかを調べます。\n" +"Python の ``x is y`` と同じです。" -#: ../../c-api/structures.rst:80 msgid "" "Test if an object is the ``None`` singleton, the same as ``x is None`` in " "Python." msgstr "" +"オブジェクトが ``None`` シングルトンかどうかを調べます。\n" +"Python の ``x is None`` と同じです。" -#: ../../c-api/structures.rst:88 msgid "" "Test if an object is the ``True`` singleton, the same as ``x is True`` in " "Python." msgstr "" +"オブジェクトが ``True`` シングルトンかどうかを調べます。\n" +"Python の ``x is True`` と同じです。" -#: ../../c-api/structures.rst:96 msgid "" "Test if an object is the ``False`` singleton, the same as ``x is False`` in " "Python." msgstr "" +"オブジェクトが ``False`` シングルトンかどうかを調べます。\n" +"Python の ``x is False`` と同じです。" -#: ../../c-api/structures.rst:104 msgid "Get the type of the Python object *o*." -msgstr "" +msgstr "Python オブジェクト *o* の型を取得します。" #: ../../c-api/structures.rst:106 msgid "Return a :term:`borrowed reference`." @@ -158,17 +164,19 @@ msgstr "" msgid "Use the :c:func:`Py_SET_TYPE` function to set an object type." msgstr "" -#: ../../c-api/structures.rst:110 msgid "" ":c:func:`Py_TYPE()` is changed to an inline static function. The parameter " "type is no longer :c:expr:`const PyObject*`." msgstr "" +":c:func:`Py_TYPE()` が static なインライン関数になりました。\n" +"引数の型は :c:expr:`const PyObject*` ではなくなりました。" -#: ../../c-api/structures.rst:117 msgid "" "Return non-zero if the object *o* type is *type*. Return zero otherwise. " "Equivalent to: ``Py_TYPE(o) == type``." msgstr "" +"オブジェクト *o* の型が *type* ならゼロ以外、それ以外ならゼロを返します。\n" +"``Py_TYPE(o) == type`` と同等です。" #: ../../c-api/structures.rst:125 msgid "Set the object *o* type to *type*." @@ -182,11 +190,12 @@ msgstr "" msgid "Use the :c:func:`Py_SET_SIZE` function to set an object size." msgstr "" -#: ../../c-api/structures.rst:136 msgid "" ":c:func:`Py_SIZE()` is changed to an inline static function. The parameter " "type is no longer :c:expr:`const PyVarObject*`." msgstr "" +":c:func:`Py_SIZE()` が static なインライン関数になりました。\n" +"引数の型は :c:expr:`const PyVarObject*` ではなくなりました。" #: ../../c-api/structures.rst:143 msgid "Set the object *o* size to *size*." @@ -206,12 +215,14 @@ msgid "" "1, type," msgstr "" -#: ../../c-api/structures.rst:159 msgid "" "This is a macro which expands to initialization values for a new :c:type:" "`PyVarObject` type, including the :c:member:`~PyVarObject.ob_size` field. " "This macro expands to::" msgstr "" +":c:member:`~PyVarObject.ob_size` フィールドを含む、新しい :c:type:" +"`PyVarObject` 型の初期値に展開されるマクロです。\n" +"次のように展開されます。 ::" #: ../../c-api/structures.rst:163 msgid "" @@ -219,11 +230,9 @@ msgid "" "1, type, size," msgstr "" -#: ../../c-api/structures.rst:168 msgid "Implementing functions and methods" -msgstr "" +msgstr "関数とメソッドの実装" -#: ../../c-api/structures.rst:172 msgid "" "Type of the functions used to implement most Python callables in C. " "Functions of this type take two :c:expr:`PyObject*` parameters and return " @@ -232,67 +241,90 @@ msgid "" "value of the function as exposed in Python. The function must return a new " "reference." msgstr "" +"Python の呼び出し可能オブジェクトの多くを C で実装するための関数の型です。\n" +"この型の関数は 2 つの :c:expr:`PyObject*` 引数を受け取り、同じ型の値を返しま" +"す。\n" +"戻り値が ``NULL`` の場合、例外が設定されていなければなりません。\n" +"``NULL`` でない場合は、Python に公開された関数の戻り値として扱われます。\n" +"この関数は新しい参照を返さなければなりません。" #: ../../c-api/structures.rst:179 msgid "The function signature is::" msgstr "関数のシグネチャは次のとおりです ::" -#: ../../c-api/structures.rst:181 msgid "" "PyObject *PyCFunction(PyObject *self,\n" " PyObject *args);" msgstr "" +"PyObject *PyCFunction(PyObject *self,\n" +" PyObject *args);" -#: ../../c-api/structures.rst:186 msgid "" "Type of the functions used to implement Python callables in C with " "signature :ref:`METH_VARARGS | METH_KEYWORDS `. " "The function signature is::" msgstr "" +":ref:`METH_VARARGS | METH_KEYWORDS ` のシグネチャ" +"を持つ Python の呼び出し可能オブジェクトを C で実装するための関数の型です。\n" +"シグネチャは次のとおりです。 ::" -#: ../../c-api/structures.rst:190 msgid "" "PyObject *PyCFunctionWithKeywords(PyObject *self,\n" " PyObject *args,\n" " PyObject *kwargs);" msgstr "" +"PyObject *PyCFunctionWithKeywords(PyObject *self,\n" +" PyObject *args,\n" +" PyObject *kwargs);" -#: ../../c-api/structures.rst:197 msgid "" "Type of the functions used to implement Python callables in C with " "signature :c:macro:`METH_FASTCALL`. The function signature is::" msgstr "" +":c:macro:`METH_FASTCALL` のシグネチャを持つ Python の呼び出し可能オブジェクト" +"を C で実装するための関数の型です。\n" +"シグネチャは次のとおりです。 ::" -#: ../../c-api/structures.rst:201 msgid "" "PyObject *PyCFunctionFast(PyObject *self,\n" " PyObject *const *args,\n" " Py_ssize_t nargs);" msgstr "" +"PyObject *PyCFunctionFast(PyObject *self,\n" +" PyObject *const *args,\n" +" Py_ssize_t nargs);" -#: ../../c-api/structures.rst:207 msgid "" "Type of the functions used to implement Python callables in C with " "signature :ref:`METH_FASTCALL | METH_KEYWORDS `. The function signature is::" msgstr "" +":ref:`METH_FASTCALL | METH_KEYWORDS ` のシグネ" +"チャを持つ Python の呼び出し可能オブジェクトを C で実装するための関数の型で" +"す。\n" +"シグネチャは次のとおりです。 ::" -#: ../../c-api/structures.rst:211 msgid "" "PyObject *PyCFunctionFastWithKeywords(PyObject *self,\n" " PyObject *const *args,\n" " Py_ssize_t nargs,\n" " PyObject *kwnames);" msgstr "" +"PyObject *PyCFunctionFastWithKeywords(PyObject *self,\n" +" PyObject *const *args,\n" +" Py_ssize_t nargs,\n" +" PyObject *kwnames);" -#: ../../c-api/structures.rst:218 msgid "" "Type of the functions used to implement Python callables in C with " "signature :ref:`METH_METHOD | METH_FASTCALL | METH_KEYWORDS `. The function signature is::" msgstr "" +":ref:`METH_METHOD | METH_FASTCALL | METH_KEYWORDS ` のシグネチャを持つ Python の呼び出し可能オブジェクトを C で実" +"装するための関数の型です。\n" +"シグネチャは次のとおりです。 ::" -#: ../../c-api/structures.rst:222 msgid "" "PyObject *PyCMethod(PyObject *self,\n" " PyTypeObject *defining_class,\n" @@ -300,6 +332,11 @@ msgid "" " Py_ssize_t nargs,\n" " PyObject *kwnames)" msgstr "" +"PyObject *PyCMethod(PyObject *self,\n" +" PyTypeObject *defining_class,\n" +" PyObject *const *args,\n" +" Py_ssize_t nargs,\n" +" PyObject *kwnames)" #: ../../c-api/structures.rst:233 msgid "" @@ -309,23 +346,18 @@ msgstr "" "拡張型のメソッドを記述する際に用いる構造体です。この構造体には 4 つのフィール" "ドがあります:" -#: ../../c-api/structures.rst:238 msgid "Name of the method." -msgstr "" +msgstr "メソッドの名前。" -#: ../../c-api/structures.rst:242 msgid "Pointer to the C implementation." -msgstr "" +msgstr "C での実装へのポインタ。" -#: ../../c-api/structures.rst:246 msgid "Flags bits indicating how the call should be constructed." -msgstr "" +msgstr "呼び出しの構成方法を示すフラグビット。" -#: ../../c-api/structures.rst:250 msgid "Points to the contents of the docstring." -msgstr "" +msgstr "ドキュメント文字列の内容へのポインタ。" -#: ../../c-api/structures.rst:252 msgid "" "The :c:member:`~PyMethodDef.ml_meth` is a C function pointer. The functions " "may be of different types, but they always return :c:expr:`PyObject*`. If " @@ -334,17 +366,24 @@ msgid "" "first parameter as :c:expr:`PyObject*`, it is common that the method " "implementation uses the specific C type of the *self* object." msgstr "" +":c:member:`~PyMethodDef.ml_meth` は C の関数ポインタです。\n" +"関数の型はさまざまですが、戻り値は常に :c:expr:`PyObject*` です。\n" +"関数が :c:type:`PyCFunction` 型でない場合、メソッドテーブル内でのキャストがコ" +"ンパイラから要求されます。\n" +":c:type:`PyCFunction` では第 1 引数を :c:expr:`PyObject*` と定義しています" +"が、メソッドの実装では *self* オブジェクト固有の C 型を使うのが一般的です。" -#: ../../c-api/structures.rst:260 msgid "" "The :c:member:`~PyMethodDef.ml_flags` field is a bitfield which can include " "the following flags. The individual flags indicate either a calling " "convention or a binding convention." msgstr "" +":c:member:`~PyMethodDef.ml_flags` フィールドは、次のフラグを含められるビット" +"フィールドです。\n" +"各フラグは呼び出し規約または束縛の規約を示します。" -#: ../../c-api/structures.rst:265 msgid "There are these calling conventions:" -msgstr "" +msgstr "次の呼び出し規約があります。" #: ../../c-api/structures.rst:269 msgid "" @@ -362,7 +401,6 @@ msgstr "" "オブジェクトです。パラメタは通常、 :c:func:`PyArg_ParseTuple` や :c:func:" "`PyArg_UnpackTuple` で処理されます。" -#: ../../c-api/structures.rst:279 msgid "" "Can only be used in certain combinations with other flags: :ref:" "`METH_VARARGS | METH_KEYWORDS `, :ref:" @@ -370,12 +408,15 @@ msgid "" "`METH_METHOD | METH_FASTCALL | METH_KEYWORDS `." msgstr "" +"他のフラグとの特定の組み合わせでのみ使えます。\n" +"使えるのは :ref:`METH_VARARGS | METH_KEYWORDS `、:ref:`METH_FASTCALL | METH_KEYWORDS `、:ref:`METH_METHOD | METH_FASTCALL | METH_KEYWORDS " +"` です。" -#: ../../c-api/structures.rst:287 msgid ":c:expr:`METH_VARARGS | METH_KEYWORDS`" -msgstr "" +msgstr ":c:expr:`METH_VARARGS | METH_KEYWORDS`" -#: ../../c-api/structures.rst:288 msgid "" "Methods with these flags must be of type :c:type:`PyCFunctionWithKeywords`. " "The function expects three parameters: *self*, *args*, *kwargs* where " @@ -383,8 +424,13 @@ msgid "" "if there are no keyword arguments. The parameters are typically processed " "using :c:func:`PyArg_ParseTupleAndKeywords`." msgstr "" +"これらのフラグを持つメソッドは :c:type:`PyCFunctionWithKeywords` 型でなければ" +"なりません。\n" +"この関数は *self*、*args*、*kwargs* の 3 引数を受け取ります。\n" +"*kwargs* はすべてのキーワード引数を含む辞書で、キーワード引数がなければ " +"``NULL`` の場合もあります。\n" +"通常は :c:func:`PyArg_ParseTupleAndKeywords` で引数を処理します。" -#: ../../c-api/structures.rst:297 msgid "" "Fast calling convention supporting only positional arguments. The methods " "have the type :c:type:`PyCFunctionFast`. The first parameter is *self*, the " @@ -392,16 +438,18 @@ msgid "" "arguments and the third parameter is the number of arguments (the length of " "the array)." msgstr "" +"位置引数のみをサポートする高速な呼び出し規約です。\n" +"メソッドは :c:type:`PyCFunctionFast` 型です。\n" +"第 1 引数は *self*、第 2 引数は引数を表す :c:expr:`PyObject*` 値の C 配列、" +"第 3 引数は引数の個数 (配列の長さ) です。" -#: ../../c-api/structures.rst:307 msgid "``METH_FASTCALL`` is now part of the :ref:`stable ABI `." msgstr "" +"``METH_FASTCALL`` が :ref:`Stable ABI ` の一部になりました。" -#: ../../c-api/structures.rst:312 msgid ":c:expr:`METH_FASTCALL | METH_KEYWORDS`" -msgstr "" +msgstr ":c:expr:`METH_FASTCALL | METH_KEYWORDS`" -#: ../../c-api/structures.rst:313 msgid "" "Extension of :c:macro:`METH_FASTCALL` supporting also keyword arguments, " "with methods of type :c:type:`PyCFunctionFastWithKeywords`. Keyword " @@ -412,33 +460,45 @@ msgid "" "The values of the keyword arguments are stored in the *args* array, after " "the positional arguments." msgstr "" +":c:macro:`METH_FASTCALL` を拡張してキーワード引数もサポートするもので、メソッ" +"ドは :c:type:`PyCFunctionFastWithKeywords` 型です。\n" +"キーワード引数は :ref:`vectorcall プロトコル ` と同じ方法で渡され" +"ます。\n" +":c:expr:`PyObject*` 型の第 4 引数が追加され、キーワード引数の名前 (文字列であ" +"ることが保証されます) のタプルを渡します。\n" +"キーワード引数がなければ ``NULL`` の場合もあります。\n" +"キーワード引数の値は *args* 配列の位置引数の後に格納されます。" -#: ../../c-api/structures.rst:328 msgid "" "Can only be used in the combination with other flags: :ref:`METH_METHOD | " "METH_FASTCALL | METH_KEYWORDS `." msgstr "" +"他のフラグとの組み合わせ :ref:`METH_METHOD | METH_FASTCALL | METH_KEYWORDS " +"` でのみ使えます。" -#: ../../c-api/structures.rst:334 msgid ":c:expr:`METH_METHOD | METH_FASTCALL | METH_KEYWORDS`" -msgstr "" +msgstr ":c:expr:`METH_METHOD | METH_FASTCALL | METH_KEYWORDS`" -#: ../../c-api/structures.rst:335 msgid "" "Extension of :ref:`METH_FASTCALL | METH_KEYWORDS ` supporting the *defining class*, that is, the class that " "contains the method in question. The defining class might be a superclass of " "``Py_TYPE(self)``." msgstr "" +":ref:`METH_FASTCALL | METH_KEYWORDS ` を拡張し、" +"*定義元のクラス*、つまりそのメソッドを含むクラスを扱えるようにしたもので" +"す。\n" +"定義元のクラスは ``Py_TYPE(self)`` の基底クラスである場合もあります。" -#: ../../c-api/structures.rst:340 msgid "" "The method needs to be of type :c:type:`PyCMethod`, the same as for " "``METH_FASTCALL | METH_KEYWORDS`` with ``defining_class`` argument added " "after ``self``." msgstr "" +"メソッドは :c:type:`PyCMethod` 型でなければなりません。\n" +"これは ``METH_FASTCALL | METH_KEYWORDS`` と同じですが、``self`` の後に " +"``defining_class`` 引数が追加されています。" -#: ../../c-api/structures.rst:349 msgid "" "Methods without parameters don't need to check whether arguments are given " "if they are listed with the :c:macro:`METH_NOARGS` flag. They need to be of " @@ -446,14 +506,21 @@ msgid "" "and will hold a reference to the module or object instance. In all cases " "the second parameter will be ``NULL``." msgstr "" +"引数を取らないメソッドに :c:macro:`METH_NOARGS` フラグを指定すると、引数が渡" +"されたかどうかをメソッド内で確認する必要がなくなります。\n" +"このメソッドは :c:type:`PyCFunction` 型でなければなりません。\n" +"第 1 引数は通常 *self* という名前で、モジュールまたはオブジェクトのインスタン" +"スへの参照を保持します。\n" +"第 2 引数は常に ``NULL`` です。" -#: ../../c-api/structures.rst:355 msgid "" "The function must have 2 parameters. Since the second parameter is unused, :" "c:macro:`Py_UNUSED` can be used to prevent a compiler warning." msgstr "" +"関数には 2 つの引数が必要です。\n" +"第 2 引数は使わないので、:c:macro:`Py_UNUSED` でコンパイラの警告を抑制できま" +"す。" -#: ../../c-api/structures.rst:361 msgid "" "Methods with a single object argument can be listed with the :c:macro:" "`METH_O` flag, instead of invoking :c:func:`PyArg_ParseTuple` with a " @@ -461,6 +528,11 @@ msgid "" "*self* parameter, and a :c:expr:`PyObject*` parameter representing the " "single argument." msgstr "" +"オブジェクトを 1 つ引数に取るメソッドには、``\"O\"`` を指定して :c:func:" +"`PyArg_ParseTuple` を呼び出す代わりに、:c:macro:`METH_O` フラグを指定できま" +"す。\n" +"メソッドは :c:type:`PyCFunction` 型で、*self* 引数と、唯一の引数を表す :c:" +"expr:`PyObject*` 引数を受け取ります。" #: ../../c-api/structures.rst:367 msgid "" @@ -501,7 +573,6 @@ msgstr "" "もう一つの定数は、あるメソッドを同名の別のメソッド定義と置き換えるかどうかを" "制御します。" -#: ../../c-api/structures.rst:397 msgid "" "The method will be loaded in place of existing definitions. Without " "*METH_COEXIST*, the default is to skip repeated definitions. Since slot " @@ -513,93 +584,113 @@ msgid "" "This is helpful because calls to PyCFunctions are optimized more than " "wrapper object calls." msgstr "" +"既存の定義を置き換えてメソッドを登録します。\n" +"*METH_COEXIST* がない場合、デフォルトでは重複する定義をスキップします。\n" +"スロットラッパーはメソッドテーブルより先に登録されるため、例えば " +"*sq_contains* スロットがあると、:meth:`~object.__contains__` という名前のラッ" +"プされたメソッドが生成され、同じ名前に対応する PyCFunction は登録されませ" +"ん。\n" +"このフラグがある場合、ラッパーオブジェクトの代わりに PyCFunction が登録され、" +"スロットと共存します。\n" +"PyCFunction の呼び出しはラッパーオブジェクトの呼び出しより最適化されているの" +"で、この方法が役立ちます。" -#: ../../c-api/structures.rst:409 msgid "" "Turn *ml* into a Python :term:`callable` object. The caller must ensure that " "*ml* outlives the :term:`callable`. Typically, *ml* is defined as a static " "variable." msgstr "" +"*ml* を Python の :term:`呼び出し可能 ` オブジェクトにします。\n" +"呼び出し側は、*ml* がその :term:`呼び出し可能 ` オブジェクトより長" +"く存続するようにしなければなりません。\n" +"通常、*ml* は静的変数として定義します。" -#: ../../c-api/structures.rst:413 msgid "" "The *self* parameter will be passed as the *self* argument to the C function " "in ``ml->ml_meth`` when invoked. *self* can be ``NULL``." msgstr "" +"*self* 引数は、``ml->ml_meth`` の C 関数を呼び出すときに、その関数の *self* " +"引数として渡されます。\n" +"*self* は ``NULL`` にできます。" -#: ../../c-api/structures.rst:417 msgid "" "The :term:`callable` object's ``__module__`` attribute can be set from the " "given *module* argument. *module* should be a Python string, which will be " "used as name of the module the function is defined in. If unavailable, it " "can be set to :const:`None` or ``NULL``." msgstr "" +"渡された *module* 引数から、:term:`呼び出し可能 ` オブジェクトの " +"``__module__`` 属性を設定できます。\n" +"*module* は Python の文字列で、関数の定義元モジュールの名前として使われま" +"す。\n" +"名前が分からない場合は :const:`None` または ``NULL`` にできます。" -#: ../../c-api/structures.rst:423 msgid ":attr:`function.__module__`" -msgstr "" +msgstr ":attr:`function.__module__`" -#: ../../c-api/structures.rst:425 msgid "" "The *cls* parameter will be passed as the *defining_class* argument to the C " "function. Must be set if :c:macro:`METH_METHOD` is set on ``ml->ml_flags``." msgstr "" +"*cls* 引数は C 関数の *defining_class* 引数として渡されます。\n" +"``ml->ml_flags`` に :c:macro:`METH_METHOD` が設定されている場合は、指定する必" +"要があります。" -#: ../../c-api/structures.rst:434 msgid "Equivalent to ``PyCMethod_New(ml, self, module, NULL)``." -msgstr "" +msgstr "``PyCMethod_New(ml, self, module, NULL)`` と同等です。" -#: ../../c-api/structures.rst:439 msgid "Equivalent to ``PyCMethod_New(ml, self, NULL, NULL)``." -msgstr "" +msgstr "``PyCMethod_New(ml, self, NULL, NULL)`` と同等です。" -#: ../../c-api/structures.rst:443 msgid "Accessing attributes of extension types" -msgstr "" +msgstr "拡張型の属性へのアクセス" -#: ../../c-api/structures.rst:447 msgid "" "Structure which describes an attribute of a type which corresponds to a C " "struct member. When defining a class, put a NULL-terminated array of these " "structures in the :c:member:`~PyTypeObject.tp_members` slot." msgstr "" +"C 構造体のメンバーに対応する、型の属性を記述する構造体です。\n" +"クラスを定義するときは、この構造体の NULL で終端した配列を :c:member:" +"`~PyTypeObject.tp_members` スロットに設定します。" -#: ../../c-api/structures.rst:452 msgid "Its fields are, in order:" -msgstr "" +msgstr "フィールドは順に次のとおりです。" -#: ../../c-api/structures.rst:456 msgid "" "Name of the member. A NULL value marks the end of a ``PyMemberDef[]`` array." msgstr "" +"メンバーの名前。\n" +"NULL 値は ``PyMemberDef[]`` 配列の終端を示します。" -#: ../../c-api/structures.rst:459 msgid "The string should be static, no copy is made of it." msgstr "" +"文字列は静的に割り当てられている必要があります。\n" +"コピーは作成されません。" -#: ../../c-api/structures.rst:463 msgid "" "The type of the member in the C struct. See :ref:`PyMemberDef-types` for the " "possible values." msgstr "" +"C 構造体内のメンバーの型。\n" +"使用できる値は :ref:`PyMemberDef-types` を参照してください。" -#: ../../c-api/structures.rst:468 msgid "" "The offset in bytes that the member is located on the type’s object struct." -msgstr "" +msgstr "その型のオブジェクト構造体内での、メンバーのバイト単位のオフセット。" -#: ../../c-api/structures.rst:472 msgid "" "Zero or more of the :ref:`PyMemberDef-flags`, combined using bitwise OR." -msgstr "" +msgstr ":ref:`PyMemberDef-flags` を 0 個以上、ビット OR で組み合わせた値。" -#: ../../c-api/structures.rst:476 msgid "" "The docstring, or NULL. The string should be static, no copy is made of it. " "Typically, it is defined using :c:macro:`PyDoc_STR`." msgstr "" +"ドキュメント文字列、または NULL。\n" +"文字列は静的に割り当てられている必要があり、コピーは作成されません。\n" +"通常は :c:macro:`PyDoc_STR` を使って定義します。" -#: ../../c-api/structures.rst:480 msgid "" "By default (when :c:member:`~PyMemberDef.flags` is ``0``), members allow " "both read and write access. Use the :c:macro:`Py_READONLY` flag for read-" @@ -607,8 +698,14 @@ msgid "" "`Py_READONLY`. Only :c:macro:`Py_T_OBJECT_EX` (and legacy :c:macro:" "`T_OBJECT`) members can be deleted." msgstr "" +"デフォルト (:c:member:`~PyMemberDef.flags` が ``0`` の場合) では、メンバーは" +"読み書きの両方を許可します。\n" +"読み取り専用にするには :c:macro:`Py_READONLY` フラグを使ってください。\n" +":c:macro:`Py_T_STRING` など、一部の型は :c:macro:`Py_READONLY` を暗黙に指定し" +"ます。\n" +"削除できるのは :c:macro:`Py_T_OBJECT_EX` (および従来の :c:macro:`T_OBJECT`) " +"のメンバーだけです。" -#: ../../c-api/structures.rst:489 msgid "" "For heap-allocated types (created using :c:func:`PyType_FromSpec` or " "similar), ``PyMemberDef`` may contain a definition for the special member " @@ -617,8 +714,14 @@ msgid "" "``Py_T_PYSSIZET``, and either ``Py_READONLY`` or ``Py_READONLY | " "Py_RELATIVE_OFFSET``. For example::" msgstr "" +"ヒープに割り当てられた型 (:c:func:`PyType_FromSpec` などで作成したもの) で" +"は、型オブジェクトの :c:member:`~PyTypeObject.tp_vectorcall_offset` に対応す" +"る特殊メンバー ``\"__vectorcalloffset__\"`` の定義を ``PyMemberDef`` に含めら" +"れます。\n" +"このメンバーは ``Py_T_PYSSIZET`` と、``Py_READONLY`` または ``Py_READONLY | " +"Py_RELATIVE_OFFSET`` のいずれかで定義しなければなりません。\n" +"例えば次のようにします。 ::" -#: ../../c-api/structures.rst:496 msgid "" "static PyMemberDef spam_type_members[] = {\n" " {\"__vectorcalloffset__\", Py_T_PYSSIZET,\n" @@ -626,12 +729,17 @@ msgid "" " {NULL} /* Sentinel */\n" "};" msgstr "" +"static PyMemberDef spam_type_members[] = {\n" +" {\"__vectorcalloffset__\", Py_T_PYSSIZET,\n" +" offsetof(Spam_object, vectorcall), Py_READONLY},\n" +" {NULL} /* 終端 */\n" +"};" -#: ../../c-api/structures.rst:502 msgid "(You may need to ``#include `` for :c:func:`!offsetof`.)" msgstr "" +"(:c:func:`!offsetof` を使うには ``#include `` が必要な場合がありま" +"す。)" -#: ../../c-api/structures.rst:504 msgid "" "The legacy offsets :c:member:`~PyTypeObject.tp_dictoffset` and :c:member:" "`~PyTypeObject.tp_weaklistoffset` can be defined similarly using " @@ -639,69 +747,84 @@ msgid "" "extensions are strongly encouraged to use :c:macro:`Py_TPFLAGS_MANAGED_DICT` " "and :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` instead." msgstr "" +"従来のオフセット :c:member:`~PyTypeObject.tp_dictoffset` と :c:member:" +"`~PyTypeObject.tp_weaklistoffset` も、``\"__dictoffset__\"`` メンバーと " +"``\"__weaklistoffset__\"`` メンバーを使って同様に定義できます。\n" +"ただし、拡張モジュールでは代わりに :c:macro:`Py_TPFLAGS_MANAGED_DICT` と :c:" +"macro:`Py_TPFLAGS_MANAGED_WEAKREF` を使うことを強く推奨します。" -#: ../../c-api/structures.rst:512 msgid "" "``PyMemberDef`` is always available. Previously, it required including " "``\"structmember.h\"``." msgstr "" +"``PyMemberDef`` が常に利用可能になりました。\n" +"以前は ``\"structmember.h\"`` のインクルードが必要でした。" -#: ../../c-api/structures.rst:517 msgid "" ":c:macro:`Py_RELATIVE_OFFSET` is now allowed for " "``\"__vectorcalloffset__\"``, ``\"__dictoffset__\"`` and " "``\"__weaklistoffset__\"``." msgstr "" +"``\"__vectorcalloffset__\"``、``\"__dictoffset__\"``、" +"``\"__weaklistoffset__\"`` で :c:macro:`Py_RELATIVE_OFFSET` を使えるようにな" +"りました。" -#: ../../c-api/structures.rst:523 msgid "" "Get an attribute belonging to the object at address *obj_addr*. The " "attribute is described by ``PyMemberDef`` *m*. Returns ``NULL`` on error." msgstr "" +"アドレス *obj_addr* にあるオブジェクトの属性を取得します。\n" +"属性は ``PyMemberDef`` *m* で記述します。\n" +"エラー時は ``NULL`` を返します。" -#: ../../c-api/structures.rst:529 msgid "" "``PyMember_GetOne`` is always available. Previously, it required including " "``\"structmember.h\"``." msgstr "" +"``PyMember_GetOne`` が常に利用可能になりました。\n" +"以前は ``\"structmember.h\"`` のインクルードが必要でした。" -#: ../../c-api/structures.rst:534 msgid "" "Set an attribute belonging to the object at address *obj_addr* to object " "*o*. The attribute to set is described by ``PyMemberDef`` *m*. Returns " "``0`` if successful and a negative value on failure." msgstr "" +"アドレス *obj_addr* にあるオブジェクトの属性を、オブジェクト *o* に設定しま" +"す。\n" +"設定する属性は ``PyMemberDef`` *m* で記述します。\n" +"成功すると ``0``、失敗すると負の値を返します。" -#: ../../c-api/structures.rst:540 msgid "" "``PyMember_SetOne`` is always available. Previously, it required including " "``\"structmember.h\"``." msgstr "" +"``PyMember_SetOne`` が常に利用可能になりました。\n" +"以前は ``\"structmember.h\"`` のインクルードが必要でした。" -#: ../../c-api/structures.rst:546 msgid "Member flags" -msgstr "" +msgstr "メンバーのフラグ" -#: ../../c-api/structures.rst:548 msgid "The following flags can be used with :c:member:`PyMemberDef.flags`:" -msgstr "" +msgstr ":c:member:`PyMemberDef.flags` には次のフラグを使えます。" -#: ../../c-api/structures.rst:552 msgid "Not writable." -msgstr "" +msgstr "書き込み不可。" -#: ../../c-api/structures.rst:556 msgid "" "Emit an ``object.__getattr__`` :ref:`audit event ` before " "reading." msgstr "" +"読み取り前に ``object.__getattr__`` :ref:`監査イベント ` を発行" +"します。" -#: ../../c-api/structures.rst:561 msgid "" "Indicates that the :c:member:`~PyMemberDef.offset` of this ``PyMemberDef`` " "entry indicates an offset from the subclass-specific data, rather than from " "``PyObject``." msgstr "" +"この ``PyMemberDef`` エントリーの :c:member:`~PyMemberDef.offset` が、" +"``PyObject`` からではなく、サブクラス固有のデータからのオフセットであることを" +"示します。" #: ../../c-api/structures.rst:565 msgid "" @@ -717,7 +840,6 @@ msgid "" "c:member:`PyMemberDef.offset` to the offset from the ``PyObject`` struct." msgstr "" -#: ../../c-api/structures.rst:582 msgid "" "The :c:macro:`!RESTRICTED`, :c:macro:`!READ_RESTRICTED` and :c:macro:`!" "WRITE_RESTRICTED` macros available with ``#include \"structmember.h\"`` are " @@ -725,6 +847,10 @@ msgid "" "equivalent to :c:macro:`Py_AUDIT_READ`; :c:macro:`!WRITE_RESTRICTED` does " "nothing." msgstr "" +"``#include \"structmember.h\"`` で利用できる :c:macro:`!RESTRICTED`、:c:" +"macro:`!READ_RESTRICTED`、:c:macro:`!WRITE_RESTRICTED` マクロは非推奨です。\n" +":c:macro:`!READ_RESTRICTED` と :c:macro:`!RESTRICTED` は :c:macro:" +"`Py_AUDIT_READ` と同等で、:c:macro:`!WRITE_RESTRICTED` は何もしません。" #: ../../c-api/structures.rst:593 msgid "" @@ -735,11 +861,9 @@ msgid "" "names." msgstr "" -#: ../../c-api/structures.rst:602 msgid "Member types" -msgstr "" +msgstr "メンバーの型" -#: ../../c-api/structures.rst:604 msgid "" ":c:member:`PyMemberDef.type` can be one of the following macros " "corresponding to various C types. When the member is accessed in Python, it " @@ -747,12 +871,19 @@ msgid "" "it will be converted back to the C type. If that is not possible, an " "exception such as :exc:`TypeError` or :exc:`ValueError` is raised." msgstr "" +":c:member:`PyMemberDef.type` には、各種の C の型に対応する以下のマクロのいず" +"れかを指定できます。\n" +"Python からメンバーにアクセスすると、対応する Python の型に変換されます。\n" +"Python から設定するときは、C の型に変換されます。\n" +"変換できない場合は :exc:`TypeError` や :exc:`ValueError` などの例外が送出され" +"ます。" -#: ../../c-api/structures.rst:612 msgid "" "Unless marked (D), attributes defined this way cannot be deleted using e.g. :" "keyword:`del` or :py:func:`delattr`." msgstr "" +"(D) の印がない限り、この方法で定義した属性は :keyword:`del` や :py:func:" +"`delattr` などで削除できません。" #: ../../c-api/structures.rst:616 msgid "Macro name" @@ -770,14 +901,8 @@ msgstr "Python の型" msgid ":c:expr:`char`" msgstr ":c:expr:`char`" -#: ../../c-api/structures.rst:618 ../../c-api/structures.rst:619 -#: ../../c-api/structures.rst:620 ../../c-api/structures.rst:621 -#: ../../c-api/structures.rst:622 ../../c-api/structures.rst:623 -#: ../../c-api/structures.rst:624 ../../c-api/structures.rst:625 -#: ../../c-api/structures.rst:626 ../../c-api/structures.rst:627 -#: ../../c-api/structures.rst:628 msgid ":py:class:`int`" -msgstr "" +msgstr ":py:class:`int`" #: ../../c-api/structures.rst:619 msgid ":c:expr:`short`" @@ -791,9 +916,8 @@ msgstr ":c:expr:`int`" msgid ":c:expr:`long`" msgstr ":c:expr:`long`" -#: ../../c-api/structures.rst:622 msgid ":c:expr:`long long`" -msgstr "" +msgstr ":c:expr:`long long`" #: ../../c-api/structures.rst:623 msgid ":c:expr:`unsigned char`" @@ -811,105 +935,102 @@ msgstr ":c:expr:`unsigned short`" msgid ":c:expr:`unsigned long`" msgstr ":c:expr:`unsigned long`" -#: ../../c-api/structures.rst:627 msgid ":c:expr:`unsigned long long`" -msgstr "" +msgstr ":c:expr:`unsigned long long`" -#: ../../c-api/structures.rst:628 msgid ":c:expr:`Py_ssize_t`" -msgstr "" +msgstr ":c:expr:`Py_ssize_t`" #: ../../c-api/structures.rst:629 msgid ":c:expr:`float`" msgstr ":c:expr:`float`" -#: ../../c-api/structures.rst:629 ../../c-api/structures.rst:630 msgid ":py:class:`float`" -msgstr "" +msgstr ":py:class:`float`" #: ../../c-api/structures.rst:630 msgid ":c:expr:`double`" msgstr ":c:expr:`double`" -#: ../../c-api/structures.rst:631 msgid ":c:expr:`char` (written as 0 or 1)" -msgstr "" +msgstr ":c:expr:`char` (書き込まれる値は 0 または 1)" -#: ../../c-api/structures.rst:631 msgid ":py:class:`bool`" -msgstr "" +msgstr ":py:class:`bool`" -#: ../../c-api/structures.rst:633 msgid ":c:expr:`const char *` (*)" -msgstr "" +msgstr ":c:expr:`const char *` (*)" -#: ../../c-api/structures.rst:633 ../../c-api/structures.rst:634 msgid ":py:class:`str` (RO)" -msgstr "" +msgstr ":py:class:`str` (RO)" -#: ../../c-api/structures.rst:634 msgid ":c:expr:`const char[]` (*)" -msgstr "" +msgstr ":c:expr:`const char[]` (*)" -#: ../../c-api/structures.rst:635 msgid ":c:expr:`char` (0-127)" -msgstr "" +msgstr ":c:expr:`char` (0-127)" -#: ../../c-api/structures.rst:635 msgid ":py:class:`str` (**)" -msgstr "" +msgstr ":py:class:`str` (**)" -#: ../../c-api/structures.rst:636 msgid ":c:expr:`PyObject *`" -msgstr "" +msgstr ":c:expr:`PyObject *`" -#: ../../c-api/structures.rst:636 msgid ":py:class:`object` (D)" -msgstr "" +msgstr ":py:class:`object` (D)" -#: ../../c-api/structures.rst:639 msgid "" "(*): Zero-terminated, UTF8-encoded C string. With :c:macro:`!Py_T_STRING` " "the C representation is a pointer; with :c:macro:`!Py_T_STRING_INPLACE` the " "string is stored directly in the structure." msgstr "" +"(*): ゼロで終端された UTF-8 エンコードの C 文字列です。\n" +":c:macro:`!Py_T_STRING` では C 側の表現はポインタで、:c:macro:`!" +"Py_T_STRING_INPLACE` では文字列を構造体に直接格納します。" -#: ../../c-api/structures.rst:644 msgid "(**): String of length 1. Only ASCII is accepted." msgstr "" +"(**): 長さ 1 の文字列です。\n" +"ASCII だけを受け付けます。" -#: ../../c-api/structures.rst:646 msgid "(RO): Implies :c:macro:`Py_READONLY`." -msgstr "" +msgstr "(RO): :c:macro:`Py_READONLY` が暗黙に指定されます。" -#: ../../c-api/structures.rst:648 msgid "" "(D): Can be deleted, in which case the pointer is set to ``NULL``. Reading a " "``NULL`` pointer raises :py:exc:`AttributeError`." msgstr "" +"(D): 削除できます。\n" +"削除するとポインタは ``NULL`` になります。\n" +"``NULL`` ポインタを読み取ると :py:exc:`AttributeError` が送出されます。" -#: ../../c-api/structures.rst:674 msgid "" "In previous versions, the macros were only available with ``#include " "\"structmember.h\"`` and were named without the ``Py_`` prefix (e.g. as " "``T_INT``). The header is still available and contains the old names, along " "with the following deprecated types:" msgstr "" +"以前のバージョンでは、これらのマクロは ``#include \"structmember.h\"`` でのみ" +"利用でき、``Py_`` 接頭辞のない名前 (例えば ``T_INT``) が使われていました。\n" +"このヘッダーは引き続き利用でき、従来の名前に加えて、次の非推奨の型も含みま" +"す。" -#: ../../c-api/structures.rst:682 msgid "" "Like ``Py_T_OBJECT_EX``, but ``NULL`` is converted to ``None``. This results " "in surprising behavior in Python: deleting the attribute effectively sets it " "to ``None``." msgstr "" +"``Py_T_OBJECT_EX`` と似ていますが、``NULL`` は ``None`` に変換されます。\n" +"このため Python では、属性を削除すると実質的に ``None`` を設定することになる" +"という、意外な動作になります。" -#: ../../c-api/structures.rst:688 msgid "Always ``None``. Must be used with :c:macro:`Py_READONLY`." msgstr "" +"常に ``None``。\n" +":c:macro:`Py_READONLY` とともに使わなければなりません。" -#: ../../c-api/structures.rst:691 msgid "Defining Getters and Setters" -msgstr "" +msgstr "ゲッターとセッターの定義" #: ../../c-api/structures.rst:695 msgid "" @@ -923,51 +1044,53 @@ msgstr "" msgid "attribute name" msgstr "属性名" -#: ../../c-api/structures.rst:704 msgid "C function to get the attribute." -msgstr "" +msgstr "属性を取得する C 関数。" -#: ../../c-api/structures.rst:708 msgid "" "Optional C function to set or delete the attribute. If ``NULL``, the " "attribute is read-only." msgstr "" +"属性を設定または削除する、省略可能な C 関数。\n" +"``NULL`` なら属性は読み取り専用になります。" #: ../../c-api/structures.rst:713 msgid "optional docstring" msgstr "任意のドキュメンテーション文字列" -#: ../../c-api/structures.rst:717 msgid "" "Optional user data pointer, providing additional data for getter and setter." msgstr "" +"ゲッターとセッターに追加データを提供する、省略可能なユーザーデータポインタ。" -#: ../../c-api/structures.rst:721 msgid "" "The ``get`` function takes one :c:expr:`PyObject*` parameter (the instance) " "and a user data pointer (the associated ``closure``):" msgstr "" +"``get`` 関数は、:c:expr:`PyObject*` 引数 (インスタンス) とユーザーデータポイ" +"ンタ (対応する ``closure``) を受け取ります。" -#: ../../c-api/structures.rst:724 msgid "" "It should return a new reference on success or ``NULL`` with a set exception " "on failure." msgstr "" -"成功または失敗時に ``NULL`` と例外の集合にされたときは新しい参照を返します。" +"成功すると新しい参照を返し、失敗すると例外を設定して ``NULL`` を返す必要があ" +"ります。" -#: ../../c-api/structures.rst:729 msgid "" "``set`` functions take two :c:expr:`PyObject*` parameters (the instance and " "the value to be set) and a user data pointer (the associated ``closure``):" msgstr "" +"``set`` 関数は、2 つの :c:expr:`PyObject*` 引数 (インスタンスと設定する値) と" +"ユーザーデータポインタ (対応する ``closure``) を受け取ります。" -#: ../../c-api/structures.rst:732 msgid "" "In case the attribute should be deleted the second parameter is ``NULL``. " "Should return ``0`` on success or ``-1`` with a set exception on failure." msgstr "" -"属性を削除する場合は、2 番目のパラメータに ``NULL`` を指定します。成功した場" -"合は ``0`` を、失敗した場合は ``-1`` を例外として返します。" +"属性を削除する場合、第 2 引数は ``NULL`` です。\n" +"成功すると ``0`` を返し、失敗すると例外を設定して ``-1`` を返す必要がありま" +"す。" #: ../../c-api/structures.rst:375 ../../c-api/structures.rst:385 msgid "built-in function" @@ -981,94 +1104,71 @@ msgstr "クラスメソッド" msgid "staticmethod" msgstr "静的メソッド" -#: ../../c-api/structures.rst:575 msgid "READ_RESTRICTED (C macro)" -msgstr "" +msgstr "READ_RESTRICTED (C マクロ)" -#: ../../c-api/structures.rst:575 msgid "WRITE_RESTRICTED (C macro)" -msgstr "" +msgstr "WRITE_RESTRICTED (C マクロ)" -#: ../../c-api/structures.rst:575 msgid "RESTRICTED (C macro)" -msgstr "" +msgstr "RESTRICTED (C マクロ)" -#: ../../c-api/structures.rst:588 msgid "READONLY (C macro)" -msgstr "" +msgstr "READONLY (C マクロ)" -#: ../../c-api/structures.rst:651 msgid "T_BYTE (C macro)" -msgstr "" +msgstr "T_BYTE (C マクロ)" -#: ../../c-api/structures.rst:651 msgid "T_SHORT (C macro)" -msgstr "" +msgstr "T_SHORT (C マクロ)" -#: ../../c-api/structures.rst:651 msgid "T_INT (C macro)" -msgstr "" +msgstr "T_INT (C マクロ)" -#: ../../c-api/structures.rst:651 msgid "T_LONG (C macro)" -msgstr "" +msgstr "T_LONG (C マクロ)" -#: ../../c-api/structures.rst:651 msgid "T_LONGLONG (C macro)" -msgstr "" +msgstr "T_LONGLONG (C マクロ)" -#: ../../c-api/structures.rst:651 msgid "T_UBYTE (C macro)" -msgstr "" +msgstr "T_UBYTE (C マクロ)" -#: ../../c-api/structures.rst:651 msgid "T_USHORT (C macro)" -msgstr "" +msgstr "T_USHORT (C マクロ)" -#: ../../c-api/structures.rst:651 msgid "T_UINT (C macro)" -msgstr "" +msgstr "T_UINT (C マクロ)" -#: ../../c-api/structures.rst:651 msgid "T_ULONG (C macro)" -msgstr "" +msgstr "T_ULONG (C マクロ)" -#: ../../c-api/structures.rst:651 msgid "T_ULONGULONG (C macro)" -msgstr "" +msgstr "T_ULONGULONG (C マクロ)" -#: ../../c-api/structures.rst:651 msgid "T_PYSSIZET (C macro)" -msgstr "" +msgstr "T_PYSSIZET (C マクロ)" -#: ../../c-api/structures.rst:651 msgid "T_FLOAT (C macro)" -msgstr "" +msgstr "T_FLOAT (C マクロ)" -#: ../../c-api/structures.rst:651 msgid "T_DOUBLE (C macro)" -msgstr "" +msgstr "T_DOUBLE (C マクロ)" -#: ../../c-api/structures.rst:651 msgid "T_BOOL (C macro)" -msgstr "" +msgstr "T_BOOL (C マクロ)" -#: ../../c-api/structures.rst:651 msgid "T_CHAR (C macro)" -msgstr "" +msgstr "T_CHAR (C マクロ)" -#: ../../c-api/structures.rst:651 msgid "T_STRING (C macro)" -msgstr "" +msgstr "T_STRING (C マクロ)" -#: ../../c-api/structures.rst:651 msgid "T_STRING_INPLACE (C macro)" -msgstr "" +msgstr "T_STRING_INPLACE (C マクロ)" -#: ../../c-api/structures.rst:651 msgid "T_OBJECT_EX (C macro)" -msgstr "" +msgstr "T_OBJECT_EX (C マクロ)" -#: ../../c-api/structures.rst:651 msgid "structmember.h" -msgstr "" +msgstr "structmember.h" diff --git a/c-api/sys.po b/c-api/sys.po index aaa54b511..6c2715d79 100644 --- a/c-api/sys.po +++ b/c-api/sys.po @@ -18,17 +18,16 @@ msgstr "" "Last-Translator: tomo, 2023\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../c-api/sys.rst:6 msgid "Operating System Utilities" msgstr "オペレーティングシステム関連のユーティリティ" -#: ../../c-api/sys.rst:11 msgid "" "Return the file system representation for *path*. If the object is a :class:" "`str` or :class:`bytes` object, then a new :term:`strong reference` is " @@ -37,8 +36,14 @@ msgid "" "or :class:`bytes` object. Otherwise :exc:`TypeError` is raised and ``NULL`` " "is returned." msgstr "" +"``path`` のファイルシステム表現を返します。\n" +"オブジェクトが :class:`str` または :class:`bytes` の場合は、新しい :term:`強" +"参照 ` を返します。\n" +":class:`os.PathLike` インターフェースを実装している場合は、:meth:`~os." +"PathLike.__fspath__` の戻り値が :class:`str` または :class:`bytes` ならそれを" +"返します。\n" +"それ以外の場合は :exc:`TypeError` を送出し、``NULL`` を返します。" -#: ../../c-api/sys.rst:24 msgid "" "Return true (nonzero) if the standard I/O file *fp* with name *filename* is " "deemed interactive. This is the case for files for which " @@ -47,10 +52,14 @@ msgid "" "``NULL`` or if the name is equal to one of the strings ``''`` or " "``'???'``." msgstr "" +"名前が ``filename`` の標準 I/O ファイル ``fp`` が対話的と判定される場合に、" +"真 (非ゼロ) を返します。\n" +"``isatty(fileno(fp))`` が真となるファイルが該当します。\n" +":c:member:`PyConfig.interactive` が非ゼロの場合は、``filename`` ポインタが " +"``NULL``、または名前が ``''`` か ``'???'`` の場合にも真を返します。" -#: ../../c-api/sys.rst:30 msgid "This function must not be called before Python is initialized." -msgstr "" +msgstr "Python が初期化される前に呼び出してはいけません。" #: ../../c-api/sys.rst:35 msgid "" @@ -64,12 +73,15 @@ msgstr "" "数を呼びださなければなりません。:c:func:`fork` が定義されているシステムでのみ" "利用できます。" -#: ../../c-api/sys.rst:41 msgid "" "The C :c:func:`fork` call should only be made from the :ref:`\"main\" thread " "` (of the :ref:`\"main\" interpreter `). The same is true for ``PyOS_BeforeFork()``." msgstr "" +"C の :c:func:`fork` は、:ref:`メインインタープリタ ` の :ref:`メインスレッド ` からだけ呼び出してくだ" +"さい。\n" +"``PyOS_BeforeFork()`` も同様です。" #: ../../c-api/sys.rst:51 msgid "" @@ -84,14 +96,16 @@ msgstr "" "製が成功したかどうかにかかわらず、親プロセスからこの関数を呼び出さなければな" "りません。:c:func:`fork` が定義されているシステムでのみ利用できます。" -#: ../../c-api/sys.rst:58 msgid "" "The C :c:func:`fork` call should only be made from the :ref:`\"main\" thread " "` (of the :ref:`\"main\" interpreter `). The same is true for ``PyOS_AfterFork_Parent()``." msgstr "" +"C の :c:func:`fork` は、:ref:`メインインタープリタ ` の :ref:`メインスレッド ` からだけ呼び出してくだ" +"さい。\n" +"``PyOS_AfterFork_Parent()`` も同様です。" -#: ../../c-api/sys.rst:68 msgid "" "Function to update internal interpreter state after a process fork. This " "must be called from the child process after calling :c:func:`fork`, or any " @@ -99,13 +113,21 @@ msgid "" "process will call back into the Python interpreter. Only available on " "systems where :c:func:`fork` is defined." msgstr "" +"プロセスのフォーク後にインタープリタの内部状態を更新する関数です。\n" +":c:func:`fork` や、現在のプロセスを複製する同様の関数を呼び出した後、そのプロ" +"セスから Python インタープリタを再び呼び出す可能性が少しでもあるなら、子プロ" +"セスからこの関数を呼び出す必要があります。\n" +":c:func:`fork` が定義されているシステムでのみ利用できます。" -#: ../../c-api/sys.rst:75 msgid "" "The C :c:func:`fork` call should only be made from the :ref:`\"main\" thread " "` (of the :ref:`\"main\" interpreter `). The same is true for ``PyOS_AfterFork_Child()``." msgstr "" +"C の :c:func:`fork` は、:ref:`メインインタープリタ ` の :ref:`メインスレッド ` からだけ呼び出してくだ" +"さい。\n" +"``PyOS_AfterFork_Child()`` も同様です。" #: ../../c-api/sys.rst:83 msgid "" @@ -134,7 +156,6 @@ msgid "This function is superseded by :c:func:`PyOS_AfterFork_Child()`." msgstr "" "この関数は :c:func:`PyOS_AfterFork_Child()` によって置き換えられました。" -#: ../../c-api/sys.rst:103 msgid "" "Return true when the interpreter runs out of stack space. This is a " "reliable check, but is only available when :c:macro:`!USE_STACKCHECK` is " @@ -142,34 +163,50 @@ msgid "" "C++ compiler). :c:macro:`!USE_STACKCHECK` will be defined automatically; you " "should never change the definition in your own code." msgstr "" +"インタープリタのスタック領域が足りなくなった場合に真を返します。\n" +"これは信頼できるチェックですが、:c:macro:`!USE_STACKCHECK` が定義されている場" +"合 (現在は Microsoft Visual C++ コンパイラを使う一部の Windows バージョン) だ" +"け利用できます。\n" +":c:macro:`!USE_STACKCHECK` は自動的に定義されます。\n" +"自分のコードで定義を変更してはいけません。" -#: ../../c-api/sys.rst:115 msgid "" "Return the current signal handler for signal *i*. This is a thin wrapper " "around either :c:func:`!sigaction` or :c:func:`!signal`. Do not call those " "functions directly!" msgstr "" +"シグナル ``i`` の現在のシグナルハンドラを返します。\n" +":c:func:`!sigaction` または :c:func:`!signal` の薄いラッパーです。\n" +"それらの関数を直接呼び出してはいけません。" -#: ../../c-api/sys.rst:122 msgid "" "Set the signal handler for signal *i* to be *h*; return the old signal " "handler. This is a thin wrapper around either :c:func:`!sigaction` or :c:" "func:`!signal`. Do not call those functions directly!" msgstr "" +"シグナル ``i`` のシグナルハンドラを ``h`` に設定し、以前のハンドラを返しま" +"す。\n" +":c:func:`!sigaction` または :c:func:`!signal` の薄いラッパーです。\n" +"それらの関数を直接呼び出してはいけません。" -#: ../../c-api/sys.rst:129 msgid "" "This function should not be called directly: use the :c:type:`PyConfig` API " "with the :c:func:`PyConfig_SetBytesString` function which ensures that :ref:" "`Python is preinitialized `." msgstr "" +"この関数は直接呼び出さないでください。\n" +"代わりに :c:type:`PyConfig` API と :c:func:`PyConfig_SetBytesString` 関数を" +"使ってください。\n" +"これにより、:ref:`Python の事前初期化 ` が保証されます。" -#: ../../c-api/sys.rst:133 ../../c-api/sys.rst:200 msgid "" "This function must not be called before :ref:`Python is preinitialized ` and so that the LC_CTYPE locale is properly configured: see the :c:" "func:`Py_PreInitialize` function." msgstr "" +"LC_CTYPE ロケールを適切に設定するため、:ref:`Python が事前初期化される ` 前にこの関数を呼び出してはいけません。\n" +":c:func:`Py_PreInitialize` 関数を参照してください。" #: ../../c-api/sys.rst:137 msgid "" @@ -208,12 +245,15 @@ msgstr "" "*size* が ``NULL`` でない場合は、メモリエラーのときは ``(size_t)-1`` を、デ" "コードでのエラーのときは ``(size_t)-2`` を ``*size`` に設定します。" -#: ../../c-api/sys.rst:152 ../../c-api/sys.rst:192 msgid "" "The :term:`filesystem encoding and error handler` are selected by :c:func:" "`PyConfig_Read`: see :c:member:`~PyConfig.filesystem_encoding` and :c:member:" "`~PyConfig.filesystem_errors` members of :c:type:`PyConfig`." msgstr "" +":term:`ファイルシステムのエンコーディングとエラーハンドラ ` は :c:func:`PyConfig_Read` が選択します。\n" +":c:type:`PyConfig` の :c:member:`~PyConfig.filesystem_encoding` と :c:member:" +"`~PyConfig.filesystem_errors` メンバを参照してください。" #: ../../c-api/sys.rst:156 msgid "" @@ -244,11 +284,12 @@ msgstr "" "この関数は、:ref:`Python UTF-8 Mode ` ではUTF-8エンコーディングを" "利用するようになりました。" -#: ../../c-api/sys.rst:173 msgid "" "The function now uses the UTF-8 encoding on Windows if :c:member:" "`PyPreConfig.legacy_windows_fs_encoding` is zero;" msgstr "" +":c:member:`PyPreConfig.legacy_windows_fs_encoding` がゼロの場合、Windows で" +"は UTF-8 エンコーディングを使うようになりました。" #: ../../c-api/sys.rst:180 msgid "" @@ -273,11 +314,13 @@ msgstr "" "このメモリを解放するのには :c:func:`PyMem_Free` を使ってください。\n" "エンコードエラーかメモリ確保エラーのときは ``NULL`` を返します。" -#: ../../c-api/sys.rst:189 msgid "" "If error_pos is not ``NULL``, ``*error_pos`` is set to ``(size_t)-1`` on " "success, or set to the index of the invalid character on encoding error." msgstr "" +"``error_pos`` が ``NULL`` でなければ、成功した場合は ``*error_pos`` を " +"``(size_t)-1`` に、エンコードエラーの場合は無効な文字のインデックスに設定しま" +"す。" #: ../../c-api/sys.rst:196 msgid "" @@ -295,54 +338,61 @@ msgstr "" ":c:func:`PyUnicode_EncodeFSDefault` および :c:func:`PyUnicode_EncodeLocale` " "関数。" -#: ../../c-api/sys.rst:215 msgid "" "The function now uses the UTF-8 encoding on Windows if :c:member:" "`PyPreConfig.legacy_windows_fs_encoding` is zero." msgstr "" +":c:member:`PyPreConfig.legacy_windows_fs_encoding` がゼロの場合、Windows で" +"は UTF-8 エンコーディングを使うようになりました。" -#: ../../c-api/sys.rst:221 msgid "" "Similar to :c:func:`!fopen`, but *path* is a Python object and an exception " "is set on error." msgstr "" +":c:func:`!fopen` と同様ですが、``path`` は Python オブジェクトで、エラーの場" +"合は例外を設定します。" -#: ../../c-api/sys.rst:224 msgid "" "*path* must be a :class:`str` object, a :class:`bytes` object, or a :term:" "`path-like object`." msgstr "" +"``path`` は :class:`str` オブジェクト、:class:`bytes` オブジェクト、または :" +"term:`パス風オブジェクト ` でなければなりません。" -#: ../../c-api/sys.rst:227 msgid "" "On success, return the new file pointer. On error, set an exception and " "return ``NULL``." msgstr "" +"成功した場合は新しいファイルポインタを返します。\n" +"エラーの場合は例外を設定して ``NULL`` を返します。" -#: ../../c-api/sys.rst:230 msgid "" "The file must be closed by :c:func:`Py_fclose` rather than calling directly :" "c:func:`!fclose`." msgstr "" +"ファイルを閉じるには :c:func:`!fclose` を直接呼び出さず、:c:func:`Py_fclose` " +"を使う必要があります。" -#: ../../c-api/sys.rst:233 msgid "The file descriptor is created non-inheritable (:pep:`446`)." -msgstr "" +msgstr "ファイル記述子は継承不可として作成されます (:pep:`446`)。" -#: ../../c-api/sys.rst:235 msgid "The caller must have an :term:`attached thread state`." msgstr "" +"呼び出し元には :term:`アタッチされたスレッド状態 ` が" +"必要です。" -#: ../../c-api/sys.rst:242 msgid "Close a file that was opened by :c:func:`Py_fopen`." -msgstr "" +msgstr ":c:func:`Py_fopen` で開いたファイルを閉じます。" -#: ../../c-api/sys.rst:244 msgid "" "On success, return ``0``. On error, return ``EOF`` and ``errno`` is set to " "indicate the error. In either case, any further access (including another " "call to :c:func:`Py_fclose`) to the stream results in undefined behavior." msgstr "" +"成功した場合は ``0`` を返します。\n" +"エラーの場合は ``EOF`` を返し、エラーを示す ``errno`` を設定します。\n" +"どちらの場合も、その後ストリームにアクセスすると (:c:func:`Py_fclose` をもう" +"一度呼び出すことも含めて)、動作は未定義です。" #: ../../c-api/sys.rst:255 msgid "System Functions" @@ -454,64 +504,76 @@ msgstr "" ":data:`sys._xoptions` と同様、 :option:`-X` オプションの現在の辞書を返しま" "す。エラーが起きると、 ``NULL`` が返され、例外がセットされます。" -#: ../../c-api/sys.rst:327 msgid "" "Raise an auditing event with any active hooks. Return zero for success and " "non-zero with an exception set on failure." msgstr "" +"有効なフックに監査イベントを通知します。\n" +"成功した場合はゼロを返し、失敗した場合は例外を設定して非ゼロを返します。" -#: ../../c-api/sys.rst:330 msgid "The *event* string argument must not be *NULL*." -msgstr "" +msgstr "文字列引数 ``event`` は ``NULL`` であってはいけません。" -#: ../../c-api/sys.rst:332 msgid "" "If any hooks have been added, *format* and other arguments will be used to " "construct a tuple to pass. Apart from ``N``, the same format characters as " "used in :c:func:`Py_BuildValue` are available. If the built value is not a " "tuple, it will be added into a single-element tuple." msgstr "" +"フックが追加されている場合、``format`` とほかの引数を使って、渡すタプルを作成" +"します。\n" +"``N`` を除き、:c:func:`Py_BuildValue` と同じ書式文字を使えます。\n" +"作成した値がタプルでない場合は、1 要素のタプルに格納します。" -#: ../../c-api/sys.rst:337 msgid "" "The ``N`` format option must not be used. It consumes a reference, but since " "there is no way to know whether arguments to this function will be consumed, " "using it may cause reference leaks." msgstr "" +"書式オプション ``N`` を使ってはいけません。\n" +"このオプションは参照を消費しますが、この関数への引数が消費されるかどうかを知" +"る方法がないため、使うと参照がリークする可能性があります。" -#: ../../c-api/sys.rst:341 msgid "" "Note that ``#`` format characters should always be treated as :c:type:" "`Py_ssize_t`, regardless of whether ``PY_SSIZE_T_CLEAN`` was defined." msgstr "" +"``#`` 書式文字の引数は、``PY_SSIZE_T_CLEAN`` の定義の有無にかかわらず、常に :" +"c:type:`Py_ssize_t` として扱ってください。" -#: ../../c-api/sys.rst:344 msgid ":func:`sys.audit` performs the same function from Python code." -msgstr "" +msgstr ":func:`sys.audit` は Python コードから同じ機能を提供します。" -#: ../../c-api/sys.rst:346 msgid "See also :c:func:`PySys_AuditTuple`." -msgstr "" +msgstr ":c:func:`PySys_AuditTuple` も参照してください。" -#: ../../c-api/sys.rst:352 msgid "" "Require :c:type:`Py_ssize_t` for ``#`` format characters. Previously, an " "unavoidable deprecation warning was raised." msgstr "" +"``#`` 書式文字で :c:type:`Py_ssize_t` が必須になりました。\n" +"以前は、回避できない非推奨の警告が発生していました。" -#: ../../c-api/sys.rst:358 msgid "" "Similar to :c:func:`PySys_Audit`, but pass arguments as a Python object. " "*args* must be a :class:`tuple`. To pass no arguments, *args* can be *NULL*." msgstr "" +":c:func:`PySys_Audit` と同様ですが、引数を Python オブジェクトとして渡しま" +"す。\n" +"``args`` は :class:`tuple` でなければなりません。\n" +"引数を渡さない場合は ``NULL`` でも構いません。" -#: ../../c-api/sys.rst:366 msgid "" "Append the callable *hook* to the list of active auditing hooks. Return zero " "on success and non-zero on failure. If the runtime has been initialized, " "also set an error on failure. Hooks added through this API are called for " "all interpreters created by the runtime." msgstr "" +"有効な監査フックのリストに、呼び出し可能な ``hook`` を追加します。\n" +"成功した場合はゼロを返し、失敗した場合は非ゼロを返します。\n" +"ランタイムが初期化済みなら、失敗時にはエラーも設定します。\n" +"この API で追加したフックは、ランタイムが作成するすべてのインタープリタで呼び" +"出されます。" #: ../../c-api/sys.rst:372 msgid "" @@ -523,28 +585,34 @@ msgstr "" "フック関数は別なランタイムから呼び出されるかもしれないので、このポインタは直" "接 Python の状態を参照すべきではありません。" -#: ../../c-api/sys.rst:376 msgid "" "This function is safe to call before :c:func:`Py_Initialize`. When called " "after runtime initialization, existing audit hooks are notified and may " "silently abort the operation by raising an error subclassed from :class:" "`Exception` (other errors will not be silenced)." msgstr "" +"この関数は :c:func:`Py_Initialize` より前でも安全に呼び出せます。\n" +"ランタイムの初期化後に呼び出すと、既存の監査フックに通知されます。\n" +"フックは :class:`Exception` のサブクラスのエラーを送出して、通知せずにこの操" +"作を中止させることがあります (それ以外のエラーは抑制されません)。" -#: ../../c-api/sys.rst:381 msgid "" "The hook function is always called with an :term:`attached thread state` by " "the Python interpreter that raised the event." msgstr "" +"フック関数は、イベントを発生させた Python インタープリタによって、常に :term:" +"`スレッド状態がアタッチされた ` 状態で呼び出されます。" -#: ../../c-api/sys.rst:384 msgid "" "See :pep:`578` for a detailed description of auditing. Functions in the " "runtime and standard library that raise events are listed in the :ref:`audit " "events table `. Details are in each function's documentation." msgstr "" +"監査の詳しい説明は :pep:`578` を参照してください。\n" +"イベントを発生させるランタイムと標準ライブラリの関数は :ref:`監査イベントの" +"表 ` に一覧されています。\n" +"詳細は各関数のドキュメントを参照してください。" -#: ../../c-api/sys.rst:389 ../../c-api/sys.rst:391 msgid "" "If the interpreter is initialized, this function raises an auditing event " "``sys.addaudithook`` with no arguments. If any existing hooks raise an " @@ -552,20 +620,29 @@ msgid "" "and the exception is cleared. As a result, callers cannot assume that their " "hook has been added unless they control all existing hooks." msgstr "" +"インタープリタが初期化済みの場合、この関数は引数なしの監査イベント ``sys." +"addaudithook`` を発生させます。\n" +"既存のフックが :class:`Exception` の派生例外を送出した場合、新しいフックは追" +"加されず、例外はクリアされます。\n" +"そのため、既存のフックをすべて制御できない限り、呼び出し側は自分のフックが追" +"加されたと仮定できません。" -#: ../../c-api/sys.rst:400 msgid "" "The type of the hook function. *event* is the C string event argument passed " "to :c:func:`PySys_Audit` or :c:func:`PySys_AuditTuple`. *args* is guaranteed " "to be a :c:type:`PyTupleObject`. *userData* is the argument passed to " "PySys_AddAuditHook()." msgstr "" +"フック関数の型です。\n" +"``event`` は :c:func:`PySys_Audit` または :c:func:`PySys_AuditTuple` に渡され" +"た C 文字列のイベント引数です。\n" +"``args`` は :c:type:`PyTupleObject` であることが保証されます。\n" +"``userData`` は ``PySys_AddAuditHook()`` に渡された引数です。" #: ../../c-api/sys.rst:412 msgid "Process Control" msgstr "プロセス制御" -#: ../../c-api/sys.rst:419 msgid "" "Print a fatal error message and kill the process. No cleanup is performed. " "This function should only be invoked when a condition is detected that would " @@ -574,17 +651,23 @@ msgid "" "library function :c:func:`!abort` is called which will attempt to produce a :" "file:`core` file." msgstr "" +"致命的なエラーメッセージを表示してプロセスを終了します。\n" +"後片付けは一切行いません。\n" +"オブジェクトの管理情報が破損した場合など、Python インタープリタを使い続けると" +"危険な状況を検出したときだけ呼び出してください。\n" +"Unix では標準 C ライブラリ関数 :c:func:`!abort` を呼び出し、:file:`core` ファ" +"イルの生成を試みます。" -#: ../../c-api/sys.rst:426 msgid "" "The ``Py_FatalError()`` function is replaced with a macro which logs " "automatically the name of the current function, unless the " "``Py_LIMITED_API`` macro is defined." msgstr "" +"``Py_LIMITED_API`` マクロが定義されていない限り、``Py_FatalError()`` 関数は現" +"在の関数名を自動的に記録するマクロに置き換えられます。" -#: ../../c-api/sys.rst:430 msgid "Log the function name automatically." -msgstr "" +msgstr "関数名を自動的に記録するようになりました。" #: ../../c-api/sys.rst:440 msgid "" @@ -619,26 +702,22 @@ msgstr "" "ん。 Python の内部的な終了処理は後始末処理関数より以前に完了しているので、 " "*func* からはいかなる Python API も呼び出してはなりません。" -#: ../../c-api/sys.rst:464 msgid ":c:func:`PyUnstable_AtExit` for passing a ``void *data`` argument." msgstr "" +"``void *data`` 引数を渡すには :c:func:`PyUnstable_AtExit` を参照してくださ" +"い。" -#: ../../c-api/sys.rst:101 msgid "USE_STACKCHECK (C macro)" -msgstr "" +msgstr "USE_STACKCHECK (C マクロ)" -#: ../../c-api/sys.rst:417 msgid "abort (C function)" -msgstr "" +msgstr "abort (C 関数)" -#: ../../c-api/sys.rst:436 ../../c-api/sys.rst:450 msgid "Py_FinalizeEx (C function)" -msgstr "" +msgstr "Py_FinalizeEx (C 関数)" -#: ../../c-api/sys.rst:436 msgid "exit (C function)" -msgstr "" +msgstr "exit (C 関数)" -#: ../../c-api/sys.rst:450 msgid "cleanup functions" -msgstr "cleanup functions" +msgstr "後始末関数" diff --git a/c-api/tuple.po b/c-api/tuple.po index 416da8958..a01b94d94 100644 --- a/c-api/tuple.po +++ b/c-api/tuple.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: tomo, 2023\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../c-api/tuple.rst:6 @@ -58,19 +58,24 @@ msgstr "" "*p* がタプルオブジェクトだがタプル型のサブタイプのインスタンスでない場合に真" "を返します。この関数は常に成功します。" -#: ../../c-api/tuple.rst:36 msgid "" "Return a new tuple object of size *len*, or ``NULL`` with an exception set " "on failure." msgstr "" +"サイズ ``len`` の新しいタプルオブジェクトを返します。\n" +"失敗した場合は例外を設定して ``NULL`` を返します。" -#: ../../c-api/tuple.rst:42 msgid "" "Return a new tuple object of size *n*, or ``NULL`` with an exception set on " "failure. The tuple values are initialized to the subsequent *n* C arguments " "pointing to Python objects. ``PyTuple_Pack(2, a, b)`` is equivalent to " "``Py_BuildValue(\"(OO)\", a, b)``." msgstr "" +"サイズ ``n`` の新しいタプルオブジェクトを返します。\n" +"失敗した場合は例外を設定して ``NULL`` を返します。\n" +"タプルの各値は、続く ``n`` 個の C 引数が指す Python オブジェクトで初期化され" +"ます。\n" +"``PyTuple_Pack(2, a, b)`` は ``Py_BuildValue(\"(OO)\", a, b)`` と同等です。" #: ../../c-api/tuple.rst:50 msgid "" @@ -78,9 +83,8 @@ msgid "" "error, return ``-1`` and with an exception set." msgstr "" -#: ../../c-api/tuple.rst:56 msgid "Like :c:func:`PyTuple_Size`, but without error checking." -msgstr "" +msgstr ":c:func:`PyTuple_Size` と同様ですが、エラーチェックを行いません。" #: ../../c-api/tuple.rst:61 msgid "" @@ -92,13 +96,17 @@ msgstr "" "*pos* が負であるか範囲を超えている場合、 ``NULL`` を返して :exc:`IndexError` " "例外をセットします。" -#: ../../c-api/tuple.rst:64 msgid "" "The returned reference is borrowed from the tuple *p* (that is: it is only " "valid as long as you hold a reference to *p*). To get a :term:`strong " "reference`, use :c:func:`Py_NewRef(PyTuple_GetItem(...)) ` or :c:" "func:`PySequence_GetItem`." msgstr "" +"返される参照はタプル ``p`` からの借用参照です (つまり、``p`` への参照を保持し" +"ている間だけ有効です)。\n" +":term:`強参照 ` を取得するには、:c:func:" +"`Py_NewRef(PyTuple_GetItem(...)) ` または :c:func:" +"`PySequence_GetItem` を使ってください。" #: ../../c-api/tuple.rst:73 msgid "Like :c:func:`PyTuple_GetItem`, but does no checking of its arguments." @@ -106,17 +114,19 @@ msgstr "" ":c:func:`PyTuple_GetItem` に似ていますが、引数に対するエラーチェックを行いま" "せん。" -#: ../../c-api/tuple.rst:78 msgid "" "Return the slice of the tuple pointed to by *p* between *low* and *high*, or " "``NULL`` with an exception set on failure." msgstr "" +"``p`` が指すタプルの ``low`` から ``high`` までのスライスを返します。\n" +"失敗した場合は例外を設定して ``NULL`` を返します。" -#: ../../c-api/tuple.rst:81 msgid "" "This is the equivalent of the Python expression ``p[low:high]``. Indexing " "from the end of the tuple is not supported." msgstr "" +"Python の式 ``p[low:high]`` と同等です。\n" +"タプルの末尾からのインデックス指定はサポートしていません。" #: ../../c-api/tuple.rst:87 msgid "" @@ -144,12 +154,13 @@ msgstr "" ":c:func:`PyTuple_SetItem` に似ていますが、エラーチェックを行わず、新たなタプ" "ルに値を入れるとき *以外には使ってはなりません* 。" -#: ../../c-api/tuple.rst:102 ../../c-api/tuple.rst:224 -#: ../../c-api/tuple.rst:242 msgid "" "Bounds checking is performed as an assertion if Python is built in :ref:" "`debug mode ` or :option:`with assertions <--with-assertions>`." msgstr "" +"Python を :ref:`デバッグモード ` または :option:`アサーションを" +"有効にして <--with-assertions>` ビルドした場合、アサーションによる境界チェッ" +"クが行われます。" #: ../../c-api/tuple.rst:107 msgid "" @@ -162,14 +173,15 @@ msgstr "" "トへの参照を放棄 *しません* ; その結果、タプル中の位置 *pos* で参照されていた" "オブジェクトがメモリリークを引き起こします。" -#: ../../c-api/tuple.rst:114 msgid "" "This macro should *only* be used on tuples that are newly created. Using " "this macro on a tuple that is already in use (or in other words, has a " "refcount > 1) could lead to undefined behavior." msgstr "" +"このマクロは、新しく作成したタプルに *だけ* 使ってください。\n" +"すでに使われているタプル (つまり参照カウントが 1 より大きいタプル) に使うと、" +"未定義の動作を引き起こす可能性があります。" -#: ../../c-api/tuple.rst:121 msgid "" "Can be used to resize a tuple. *newsize* will be the new length of the " "tuple. Because tuples are *supposed* to be immutable, this should only be " @@ -183,14 +195,20 @@ msgid "" "and sets ``*p`` to ``NULL``, and raises :exc:`MemoryError` or :exc:" "`SystemError`." msgstr "" -"タプルをリサイズする際に使えます。 *newsize* はタプルの新たな長さです。タプル" -"は変更不能なオブジェクト *ということになっている* ので、この関数はこのオブ" -"ジェクトに対してただ一つしか参照がない時以外には使ってはなりません。タプルが" -"コード中の他の部分ですでに参照されている場合には、この関数を *使ってはなりま" -"せん* 。タプルは常に指定サイズの末尾まで伸縮します。成功した場合には ``0`` を" -"返します。クライアントコードは、 ``*p`` の値が呼び出し前と同じになると期待し" -"てはなりません。 ``*p`` が置き換えられた場合、オリジナルの ``*p`` は破壊され" -"ます。失敗すると ``-1`` を返し、 ``*p`` を ``NULL`` に設定して、 :exc:" +"タプルのサイズ変更に使えます。\n" +"``newsize`` はタプルの新しい長さです。\n" +"タプルは *本来* 不変なので、この関数はオブジェクトへの参照が一つだけの場合に" +"限って使ってください。\n" +"ほかのコードがそのタプルをすでに知っている可能性がある場合は、使っては *いけ" +"ません*。\n" +"タプルは常に末尾で伸縮します。\n" +"古いタプルを破棄して新しいタプルを作成する操作を、より効率的に行うものと考え" +"てください。\n" +"成功した場合は ``0`` を返します。\n" +"呼び出し後の ``*p`` が呼び出し前と同じ値であると仮定してはいけません。\n" +"``*p`` が参照するオブジェクトが置き換えられる場合、元の ``*p`` は破棄されま" +"す。\n" +"失敗した場合は ``-1`` を返し、``*p`` を ``NULL`` に設定して :exc:" "`MemoryError` または :exc:`SystemError` を送出します。" #: ../../c-api/tuple.rst:136 @@ -218,44 +236,44 @@ msgstr "" "後述の *desc* 中のデータから新しい struct sequence 型を生成します。返される型" "のインスタンスは :c:func:`PyStructSequence_New` で生成できます。" -#: ../../c-api/tuple.rst:148 ../../c-api/tuple.rst:217 msgid "Return ``NULL`` with an exception set on failure." -msgstr "" +msgstr "失敗した場合は例外を設定して ``NULL`` を返します。" #: ../../c-api/tuple.rst:153 msgid "Initializes a struct sequence type *type* from *desc* in place." msgstr "" "struct sequence 型である *type* を *desc* をもとにその場で初期化します。" -#: ../../c-api/tuple.rst:158 msgid "" "Like :c:func:`PyStructSequence_InitType`, but returns ``0`` on success and " "``-1`` with an exception set on failure." msgstr "" +":c:func:`PyStructSequence_InitType` と同様ですが、成功した場合は ``0`` を返" +"し、失敗した場合は例外を設定して ``-1`` を返します。" #: ../../c-api/tuple.rst:166 msgid "Contains the meta information of a struct sequence type to create." msgstr "生成するstruct sequence 型のメタデータを保持します。" -#: ../../c-api/tuple.rst:170 msgid "" "Fully qualified name of the type; null-terminated UTF-8 encoded. The name " "must contain the module name." msgstr "" +"型の完全修飾名。\n" +"ヌル終端された UTF-8 エンコードの文字列です。\n" +"モジュール名を含む必要があります。" -#: ../../c-api/tuple.rst:175 msgid "Pointer to docstring for the type or ``NULL`` to omit." msgstr "" +"型の docstring へのポインタ。\n" +"省略する場合は ``NULL``。" -#: ../../c-api/tuple.rst:179 msgid "Pointer to ``NULL``-terminated array with field names of the new type." -msgstr "" +msgstr "新しい型のフィールド名を持つ、``NULL`` 終端の配列へのポインタ。" -#: ../../c-api/tuple.rst:183 msgid "Number of fields visible to the Python side (if used as tuple)." -msgstr "" +msgstr "タプルとして使う場合に Python 側から見えるフィールドの数。" -#: ../../c-api/tuple.rst:188 msgid "" "Describes a field of a struct sequence. As a struct sequence is modeled as a " "tuple, all fields are typed as :c:expr:`PyObject*`. The index in the :c:" @@ -263,16 +281,25 @@ msgid "" "`PyStructSequence_Desc` determines which field of the struct sequence is " "described." msgstr "" +"struct sequence のフィールドを記述します。\n" +"struct sequence はタプルをモデルとしているので、すべてのフィールドは :c:expr:" +"`PyObject*` 型です。\n" +":c:type:`PyStructSequence_Desc` の :c:member:`~PyStructSequence_Desc.fields` " +"配列内のインデックスによって、struct sequence のどのフィールドを記述するかが" +"決まります。" -#: ../../c-api/tuple.rst:196 msgid "" "Name for the field or ``NULL`` to end the list of named fields, set to :c:" "data:`PyStructSequence_UnnamedField` to leave unnamed." msgstr "" +"フィールド名。\n" +"名前付きフィールドの一覧を終了するには ``NULL``、名前を付けないフィールドに" +"は :c:data:`PyStructSequence_UnnamedField` を指定します。" -#: ../../c-api/tuple.rst:201 msgid "Field docstring or ``NULL`` to omit." msgstr "" +"フィールドの docstring。\n" +"省略する場合は ``NULL``。" #: ../../c-api/tuple.rst:206 msgid "Special value for a field name to leave it unnamed." @@ -295,13 +322,12 @@ msgid "" "Return the object at position *pos* in the struct sequence pointed to by *p*." msgstr "" -#: ../../c-api/tuple.rst:230 msgid "Alias to :c:func:`PyStructSequence_GetItem`." -msgstr "" +msgstr ":c:func:`PyStructSequence_GetItem` の別名です。" -#: ../../c-api/tuple.rst:232 msgid "Now implemented as an alias to :c:func:`PyStructSequence_GetItem`." msgstr "" +":c:func:`PyStructSequence_GetItem` の別名として実装されるようになりました。" #: ../../c-api/tuple.rst:238 msgid "" @@ -317,13 +343,12 @@ msgstr "" msgid "This function \"steals\" a reference to *o*." msgstr "この関数は *o* への参照を \"盗み取り\" ます。" -#: ../../c-api/tuple.rst:252 msgid "Alias to :c:func:`PyStructSequence_SetItem`." -msgstr "" +msgstr ":c:func:`PyStructSequence_SetItem` の別名です。" -#: ../../c-api/tuple.rst:254 msgid "Now implemented as an alias to :c:func:`PyStructSequence_SetItem`." msgstr "" +":c:func:`PyStructSequence_SetItem` の別名として実装されるようになりました。" #: ../../c-api/tuple.rst:8 msgid "object" diff --git a/c-api/type.po b/c-api/type.po index c081a0516..bf6164727 100644 --- a/c-api/type.po +++ b/c-api/type.po @@ -17,10 +17,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../c-api/type.rst:6 @@ -39,25 +39,30 @@ msgstr "" "型オブジェクト自身の型オブジェクトです。Python レイヤにおける :class:`type` " "と同じオブジェクトです。" -#: ../../c-api/type.rst:24 msgid "" "Return non-zero if the object *o* is a type object, including instances of " "types derived from the standard type object. Return 0 in all other cases. " "This function always succeeds." msgstr "" +"オブジェクト *o* が型オブジェクトであれば、標準の型オブジェクトから派生した型" +"のインスタンスも含めてゼロ以外を返します。\n" +"それ以外の場合は 0 を返します。\n" +"この関数は常に成功します。" -#: ../../c-api/type.rst:31 msgid "" "Return non-zero if the object *o* is a type object, but not a subtype of the " "standard type object. Return 0 in all other cases. This function always " "succeeds." msgstr "" +"オブジェクト *o* が標準の型オブジェクトのインスタンスであり、そのサブタイプの" +"インスタンスではない場合にゼロ以外を返します。\n" +"それ以外の場合は 0 を返します。\n" +"この関数は常に成功します。" #: ../../c-api/type.rst:38 msgid "Clear the internal lookup cache. Return the current version tag." msgstr "内部の検索キャッシュをクリアします。現在のバージョンタグを返します。" -#: ../../c-api/type.rst:42 msgid "" "Return the :c:member:`~PyTypeObject.tp_flags` member of *type*. This " "function is primarily meant for use with ``Py_LIMITED_API``; the individual " @@ -65,31 +70,43 @@ msgid "" "c:member:`~PyTypeObject.tp_flags` itself is not part of the :ref:`limited " "API `." msgstr "" +"*type* の :c:member:`~PyTypeObject.tp_flags` メンバーを返します。\n" +"この関数は主に ``Py_LIMITED_API`` で使うことを想定しています。\n" +"個々のフラグビットは Python のリリース間で安定していることが保証されますが、:" +"c:member:`~PyTypeObject.tp_flags` 自体へのアクセスは :ref:`Limited API " +"` の一部ではありません。" #: ../../c-api/type.rst:49 msgid "The return type is now ``unsigned long`` rather than ``long``." msgstr "返り値の型が ``long`` ではなく ``unsigned long`` になりました。" -#: ../../c-api/type.rst:55 msgid "" "Return the type object's internal namespace, which is otherwise only exposed " "via a read-only proxy (:attr:`cls.__dict__ `). This is a " "replacement for accessing :c:member:`~PyTypeObject.tp_dict` directly. The " "returned dictionary must be treated as read-only." msgstr "" +"型オブジェクトの内部の名前空間を返します。\n" +"通常は読み取り専用のプロキシ (:attr:`cls.__dict__ `) を通じて" +"のみ公開されるものです。\n" +":c:member:`~PyTypeObject.tp_dict` に直接アクセスする代わりに使えます。\n" +"返された辞書は読み取り専用として扱わなければなりません。" -#: ../../c-api/type.rst:61 msgid "" "This function is meant for specific embedding and language-binding cases, " "where direct access to the dict is necessary and indirect access (e.g. via " "the proxy or :c:func:`PyObject_GetAttr`) isn't adequate." msgstr "" +"この関数は、辞書への直接アクセスが必要で、プロキシや :c:func:" +"`PyObject_GetAttr` などによる間接アクセスでは不十分な、特定の埋め込みや言語バ" +"インディングの用途を想定しています。" -#: ../../c-api/type.rst:65 msgid "" "Extension modules should continue to use ``tp_dict``, directly or " "indirectly, when setting up their own types." msgstr "" +"拡張モジュールで独自の型を設定するときは、引き続き直接または間接的に " +"``tp_dict`` を使ってください。" #: ../../c-api/type.rst:73 msgid "" @@ -101,35 +118,45 @@ msgstr "" "この関数は type の属性や基底クラス列を変更したあとに手動で呼び出さなければな" "りません。" -#: ../../c-api/type.rst:80 msgid "" "Register *callback* as a type watcher. Return a non-negative integer ID " "which must be passed to future calls to :c:func:`PyType_Watch`. In case of " "error (e.g. no more watcher IDs available), return ``-1`` and set an " "exception." msgstr "" +"*callback* を型ウォッチャーとして登録します。\n" +"ゼロ以上の整数 ID を返します。\n" +"以後 :c:func:`PyType_Watch` を呼び出すときには、この ID を渡す必要がありま" +"す。\n" +"エラー時 (例えば利用可能なウォッチャー ID が残っていない場合) は、例外を設定" +"して ``-1`` を返します。" -#: ../../c-api/type.rst:85 msgid "" "In free-threaded builds, :c:func:`PyType_AddWatcher` is not thread-safe, so " "it must be called at start up (before spawning the first thread)." msgstr "" +"フリースレッドビルドでは :c:func:`PyType_AddWatcher` はスレッドセーフではない" +"ため、起動時 (最初のスレッドを作成する前) に呼び出さなければなりません。" -#: ../../c-api/type.rst:93 msgid "" "Clear watcher identified by *watcher_id* (previously returned from :c:func:" "`PyType_AddWatcher`). Return ``0`` on success, ``-1`` on error (e.g. if " "*watcher_id* was never registered.)" msgstr "" +"*watcher_id* (:c:func:`PyType_AddWatcher` が以前返した値) で指定したウォッ" +"チャーを解除します。\n" +"成功すると ``0``、エラー時 (例えば *watcher_id* が一度も登録されていない場" +"合) は ``-1`` を返します。" -#: ../../c-api/type.rst:97 msgid "" "An extension should never call ``PyType_ClearWatcher`` with a *watcher_id* " "that was not returned to it by a previous call to :c:func:" "`PyType_AddWatcher`." msgstr "" +"拡張モジュールは、以前 :c:func:`PyType_AddWatcher` の呼び出しで受け取ったもの" +"でない *watcher_id* を渡して ``PyType_ClearWatcher`` を呼び出してはいけませ" +"ん。" -#: ../../c-api/type.rst:106 msgid "" "Mark *type* as watched. The callback granted *watcher_id* by :c:func:" "`PyType_AddWatcher` will be called whenever :c:func:`PyType_Modified` " @@ -138,62 +165,82 @@ msgid "" "is not called on *type* between the modifications; this is an implementation " "detail and subject to change.)" msgstr "" +"*type* を監視対象にします。\n" +":c:func:`PyType_Modified` が *type* の変更を報告するたびに、:c:func:" +"`PyType_AddWatcher` から *watcher_id* を割り当てられたコールバックが呼び出さ" +"れます。\n" +"ただし、*type* に対する一連の変更の間に :c:func:`!_PyType_Lookup` が呼び出さ" +"れなければ、コールバックは 1 度だけ呼び出されることがあります。\n" +"これは実装詳細であり、変更される可能性があります。" -#: ../../c-api/type.rst:113 msgid "" "An extension should never call ``PyType_Watch`` with a *watcher_id* that was " "not returned to it by a previous call to :c:func:`PyType_AddWatcher`." msgstr "" +"拡張モジュールは、以前 :c:func:`PyType_AddWatcher` の呼び出しで受け取ったもの" +"でない *watcher_id* を渡して ``PyType_Watch`` を呼び出してはいけません。" -#: ../../c-api/type.rst:121 msgid "Type of a type-watcher callback function." -msgstr "" +msgstr "型ウォッチャーのコールバック関数の型。" -#: ../../c-api/type.rst:123 msgid "" "The callback must not modify *type* or cause :c:func:`PyType_Modified` to be " "called on *type* or any type in its MRO; violating this rule could cause " "infinite recursion." msgstr "" +"コールバックは *type* を変更したり、*type* またはその MRO 内の型に対して :c:" +"func:`PyType_Modified` が呼び出されるようにしたりしてはいけません。\n" +"この規則に違反すると、無限再帰を引き起こす可能性があります。" -#: ../../c-api/type.rst:132 msgid "" "Return non-zero if the type object *o* sets the feature *feature*. Type " "features are denoted by single bit flags." msgstr "" +"型オブジェクト *o* に機能 *feature* が設定されていれば、ゼロ以外を返しま" +"す。\n" +"型の機能は、それぞれ 1 ビットのフラグで表します。" -#: ../../c-api/type.rst:138 msgid "" "Return true if the type object includes support for the cycle detector; this " "tests the type flag :c:macro:`Py_TPFLAGS_HAVE_GC`." msgstr "" +"型オブジェクトが循環参照の検出をサポートしている場合に真を返します。\n" +"型のフラグ :c:macro:`Py_TPFLAGS_HAVE_GC` を調べます。" #: ../../c-api/type.rst:144 msgid "Return true if *a* is a subtype of *b*." msgstr "*a* が *b* のサブタイプの場合に真を返します。" -#: ../../c-api/type.rst:146 msgid "" "This function only checks for actual subtypes, which means that :meth:`~type." "__subclasscheck__` is not called on *b*. Call :c:func:`PyObject_IsSubclass` " "to do the same check that :func:`issubclass` would do." msgstr "" +"この関数が調べるのは実際のサブタイプ関係だけで、*b* の :meth:`~type." +"__subclasscheck__` は呼び出しません。\n" +":func:`issubclass` と同じ検査を行うには :c:func:`PyObject_IsSubclass` を呼び" +"出してください。" -#: ../../c-api/type.rst:154 msgid "" "Generic handler for the :c:member:`~PyTypeObject.tp_alloc` slot of a type " "object. Uses Python's default memory allocation mechanism to allocate " "memory for a new instance, zeros the memory, then initializes the memory as " "if by calling :c:func:`PyObject_Init` or :c:func:`PyObject_InitVar`." msgstr "" +"型オブジェクトの :c:member:`~PyTypeObject.tp_alloc` スロット用の汎用ハンドラ" +"です。\n" +"Python のデフォルトのメモリ割り当て機構を使って新しいインスタンスのメモリを割" +"り当て、ゼロで埋めてから、:c:func:`PyObject_Init` または :c:func:" +"`PyObject_InitVar` を呼び出すのと同じように初期化します。" -#: ../../c-api/type.rst:159 msgid "" "Do not call this directly to allocate memory for an object; call the type's :" "c:member:`~PyTypeObject.tp_alloc` slot instead." msgstr "" +"オブジェクトのメモリを割り当てるためにこれを直接呼び出してはいけません。\n" +"代わりに型の :c:member:`~PyTypeObject.tp_alloc` スロットを呼び出してくださ" +"い。" -#: ../../c-api/type.rst:162 msgid "" "For types that support garbage collection (i.e., the :c:macro:" "`Py_TPFLAGS_HAVE_GC` flag is set), this function behaves like :c:macro:" @@ -204,27 +251,38 @@ msgid "" "the memory is guaranteed to be zeroed before initialization) and should be " "paired with :c:func:`PyObject_Free` in :c:member:`~PyTypeObject.tp_free`." msgstr "" +"ガベージコレクションをサポートする型 (:c:macro:`Py_TPFLAGS_HAVE_GC` フラグが" +"設定されているもの) では、:c:macro:`PyObject_GC_New` または :c:macro:" +"`PyObject_GC_NewVar` と同様に動作し、:c:member:`~PyTypeObject.tp_free` に設定" +"した :c:func:`PyObject_GC_Del` と組み合わせて使う必要があります。\n" +"それ以外の型では、:c:macro:`PyObject_New` または :c:macro:`PyObject_NewVar` " +"と同様に動作し、:c:member:`~PyTypeObject.tp_free` に設定した :c:func:" +"`PyObject_Free` と組み合わせて使う必要があります。\n" +"いずれの場合も、初期化前にメモリがゼロで埋められることが保証される点が異なり" +"ます。" -#: ../../c-api/type.rst:174 msgid "" "Generic handler for the :c:member:`~PyTypeObject.tp_new` slot of a type " "object. Creates a new instance using the type's :c:member:`~PyTypeObject." "tp_alloc` slot and returns the resulting object." msgstr "" +"型オブジェクトの :c:member:`~PyTypeObject.tp_new` スロット用の汎用ハンドラで" +"す。\n" +"型の :c:member:`~PyTypeObject.tp_alloc` スロットを使って新しいインスタンスを" +"作成し、作成したオブジェクトを返します。" -#: ../../c-api/type.rst:180 msgid "" "Finalize a type object. This should be called on all type objects to finish " "their initialization. This function is responsible for adding inherited " "slots from a type's base class. Return ``0`` on success, or return ``-1`` " "and sets an exception on error." msgstr "" -"型オブジェクトのファイナライズを行います。この関数は全てのオブジェクトで初期" -"化を完了するために呼び出されなくてはなりません。この関数は、基底クラス型から" -"継承したスロットを型オブジェクトに追加する役割があります。成功した場合には " -"``0`` を返し、エラーの場合には ``-1`` を返して例外情報を設定します。" +"型オブジェクトの初期化を完了します。\n" +"すべての型オブジェクトについて、初期化を仕上げるために呼び出す必要がありま" +"す。\n" +"この関数は、型の基底クラスから継承するスロットを追加します。\n" +"成功すると ``0`` を返し、エラー時は例外を設定して ``-1`` を返します。" -#: ../../c-api/type.rst:186 msgid "" "If some of the base classes implements the GC protocol and the provided type " "does not include the :c:macro:`Py_TPFLAGS_HAVE_GC` in its flags, then the GC " @@ -234,31 +292,43 @@ msgid "" "itself by at least implementing the :c:member:`~PyTypeObject.tp_traverse` " "handle." msgstr "" +"基底クラスのいずれかが GC プロトコルを実装しており、指定した型のフラグに :c:" +"macro:`Py_TPFLAGS_HAVE_GC` が含まれていなければ、GC プロトコルの実装が基底ク" +"ラスから自動的に継承されます。\n" +"一方、作成する型のフラグに :c:macro:`Py_TPFLAGS_HAVE_GC` が含まれている場合" +"は、少なくとも :c:member:`~PyTypeObject.tp_traverse` ハンドラを実装して、自分" +"で GC プロトコルを実装 **しなければなりません**。" -#: ../../c-api/type.rst:196 msgid "" "Return the type's name. Equivalent to getting the type's :attr:`~type." "__name__` attribute." msgstr "" +"型の名前を返します。\n" +"型の :attr:`~type.__name__` 属性の取得と同等です。" -#: ../../c-api/type.rst:203 msgid "" "Return the type's qualified name. Equivalent to getting the type's :attr:" "`~type.__qualname__` attribute." msgstr "" +"型の修飾名を返します。\n" +"型の :attr:`~type.__qualname__` 属性の取得と同等です。" -#: ../../c-api/type.rst:210 msgid "" "Return the type's fully qualified name. Equivalent to ``f\"{type.__module__}." "{type.__qualname__}\"``, or :attr:`type.__qualname__` if :attr:`type." "__module__` is not a string or is equal to ``\"builtins\"``." msgstr "" +"型の完全修飾名を返します。\n" +"``f\"{type.__module__}.{type.__qualname__}\"`` と同等ですが、:attr:`type." +"__module__` が文字列でないか ``\"builtins\"`` の場合は :attr:`type." +"__qualname__` と同等です。" -#: ../../c-api/type.rst:218 msgid "" "Return the type's module name. Equivalent to getting the :attr:`type." "__module__` attribute." msgstr "" +"型のモジュール名を返します。\n" +":attr:`type.__module__` 属性の取得と同等です。" #: ../../c-api/type.rst:225 msgid "" @@ -271,28 +341,31 @@ msgstr "" "の場合は、スロットが ``NULL`` か、関数が不正な引数で呼ばれたことを示します。" "通常、呼び出し側は返り値のポインタを適切な関数型にキャストします。" -#: ../../c-api/type.rst:231 msgid "" "See :c:member:`PyType_Slot.slot` for possible values of the *slot* argument." msgstr "" +"*slot* 引数に指定できる値は :c:member:`PyType_Slot.slot` を参照してください。" -#: ../../c-api/type.rst:235 msgid "" ":c:func:`PyType_GetSlot` can now accept all types. Previously, it was " "limited to :ref:`heap types `." msgstr "" +":c:func:`PyType_GetSlot` がすべての型を受け付けるようになりました。\n" +"以前は :ref:`ヒープ型 ` に限られていました。" -#: ../../c-api/type.rst:241 msgid "" "Return the module object associated with the given type when the type was " "created using :c:func:`PyType_FromModuleAndSpec`." msgstr "" +":c:func:`PyType_FromModuleAndSpec` で型を作成したときに、その型に関連付けたモ" +"ジュールオブジェクトを返します。" -#: ../../c-api/type.rst:244 ../../c-api/type.rst:264 msgid "" "If no module is associated with the given type, sets :py:class:`TypeError` " "and returns ``NULL``." msgstr "" +"指定された型にモジュールが関連付けられていない場合は、:py:class:`TypeError` " +"を設定して ``NULL`` を返します。" #: ../../c-api/type.rst:247 msgid "" @@ -305,18 +378,21 @@ msgid "" "type:`!PyCMethod` cannot be used." msgstr "" -#: ../../c-api/type.rst:260 msgid "" "Return the state of the module object associated with the given type. This " "is a shortcut for calling :c:func:`PyModule_GetState()` on the result of :c:" "func:`PyType_GetModule`." msgstr "" +"指定された型に関連付けられたモジュールオブジェクトの状態を返します。\n" +":c:func:`PyType_GetModule` の結果に対して :c:func:`PyModule_GetState()` を呼" +"び出す処理の短縮形です。" -#: ../../c-api/type.rst:267 msgid "" "If the *type* has an associated module but its state is ``NULL``, returns " "``NULL`` without setting an exception." msgstr "" +"*type* にモジュールが関連付けられていても、その状態が ``NULL`` の場合は、例外" +"を設定せずに ``NULL`` を返します。" #: ../../c-api/type.rst:274 msgid "" @@ -324,12 +400,12 @@ msgid "" "`PyModuleDef` *def*, and return that module." msgstr "" -#: ../../c-api/type.rst:277 msgid "" "If no module is found, raises a :py:class:`TypeError` and returns ``NULL``." msgstr "" +"モジュールが見つからない場合は、:py:class:`TypeError` を送出して ``NULL`` を" +"返します。" -#: ../../c-api/type.rst:279 msgid "" "This function is intended to be used together with :c:func:" "`PyModule_GetState()` to get module state from slot methods (such as :c:" @@ -337,6 +413,11 @@ msgid "" "other places where a method's defining class cannot be passed using the :c:" "type:`PyCMethod` calling convention." msgstr "" +"この関数は、:c:member:`~PyTypeObject.tp_init` や :c:member:`~PyNumberMethods." +"nb_add` などのスロットメソッドや、:c:type:`PyCMethod` 呼び出し規約でメソッド" +"の定義元クラスを渡せない場所で、\n" +":c:func:`PyModule_GetState()` と組み合わせてモジュール状態を取得するために使" +"うことを想定しています。" #: ../../c-api/type.rst:289 msgid "" @@ -344,45 +425,49 @@ msgid "" "c:macro:`Py_tp_token` token is equal to the given one." msgstr "" -#: ../../c-api/type.rst:292 msgid "" "If found, set *\\*result* to a new :term:`strong reference` to it and return " "``1``." msgstr "" +"見つかった場合は、*\\*result* にその型への新しい :term:`強参照 ` を設定して ``1`` を返します。" -#: ../../c-api/type.rst:294 msgid "If not found, set *\\*result* to ``NULL`` and return ``0``." msgstr "" +"見つからない場合は、*\\*result* に ``NULL`` を設定して ``0`` を返します。" -#: ../../c-api/type.rst:295 msgid "" "On error, set *\\*result* to ``NULL`` and return ``-1`` with an exception " "set." msgstr "" +"エラー時は *\\*result* に ``NULL`` を設定し、例外を設定して ``-1`` を返しま" +"す。" -#: ../../c-api/type.rst:298 msgid "" "The *result* argument may be ``NULL``, in which case *\\*result* is not set. " "Use this if you need only the return value." msgstr "" +"*result* 引数は ``NULL`` にできます。\n" +"その場合、*\\*result* は設定されません。\n" +"戻り値だけが必要な場合に使ってください。" #: ../../c-api/type.rst:301 msgid "The *token* argument may not be ``NULL``." msgstr "" -#: ../../c-api/type.rst:307 msgid "Attempt to assign a version tag to the given type." -msgstr "" +msgstr "指定された型へのバージョンタグの割り当てを試みます。" -#: ../../c-api/type.rst:309 msgid "" "Returns 1 if the type already had a valid version tag or a new one was " "assigned, or 0 if a new tag could not be assigned." msgstr "" +"型がすでに有効なバージョンタグを持っていたか、新しいタグを割り当てられた場合" +"は 1 を返します。\n" +"新しいタグを割り当てられなかった場合は 0 を返します。" -#: ../../c-api/type.rst:316 msgid "Creating Heap-Allocated Types" -msgstr "" +msgstr "ヒープに割り当てられる型の作成" #: ../../c-api/type.rst:318 msgid "" @@ -390,11 +475,12 @@ msgid "" "`." msgstr "" -#: ../../c-api/type.rst:323 msgid "" "Create and return a :ref:`heap type ` from the *spec* (see :c:" "macro:`Py_TPFLAGS_HEAPTYPE`)." msgstr "" +"*spec* から :ref:`ヒープ型 ` を作成して返します (:c:macro:" +"`Py_TPFLAGS_HEAPTYPE` を参照)。" #: ../../c-api/type.rst:326 msgid "" @@ -403,11 +489,12 @@ msgid "" "*Py_tp_base[s]* slots if *bases* is ``NULL``, see below)." msgstr "" -#: ../../c-api/type.rst:330 msgid "" "Metaclasses that override :c:member:`~PyTypeObject.tp_new` are not " "supported, except if ``tp_new`` is ``NULL``." msgstr "" +":c:member:`~PyTypeObject.tp_new` をオーバーライドするメタクラスは、" +"``tp_new`` が ``NULL`` の場合を除いてサポートされません。" #: ../../c-api/type.rst:333 msgid "" @@ -427,11 +514,9 @@ msgid "" "subclasses; it must be specified for each class individually." msgstr "" -#: ../../c-api/type.rst:346 msgid "This function calls :c:func:`PyType_Ready` on the new type." -msgstr "" +msgstr "この関数は新しい型に対して :c:func:`PyType_Ready` を呼び出します。" -#: ../../c-api/type.rst:348 msgid "" "Note that this function does *not* fully match the behavior of calling :py:" "class:`type() ` or using the :keyword:`class` statement. With user-" @@ -439,6 +524,12 @@ msgid "" "class:`type` (or the metaclass) over ``PyType_From*`` functions. " "Specifically:" msgstr "" +"この関数の動作は、:py:class:`type() ` の呼び出しや :keyword:`class` 文" +"の使用と完全には一致 **しない** 点に注意してください。\n" +"利用者が指定した基底型やメタクラスを使う場合は、``PyType_From*`` 関数よりも :" +"py:class:`type` (またはメタクラス) を :ref:`呼び出す ` 方法を推奨" +"します。\n" +"具体的には、次の違いがあります。" #: ../../c-api/type.rst:355 msgid "" @@ -446,80 +537,85 @@ msgid "" "set to ``type.__new__``)." msgstr "" -#: ../../c-api/type.rst:357 msgid ":py:meth:`~object.__init__` is not called on the new class." -msgstr "" +msgstr "新しいクラスの :py:meth:`~object.__init__` は呼び出されません。" -#: ../../c-api/type.rst:358 msgid ":py:meth:`~object.__init_subclass__` is not called on any bases." msgstr "" +"どの基底クラスの :py:meth:`~object.__init_subclass__` も呼び出されません。" -#: ../../c-api/type.rst:359 msgid ":py:meth:`~object.__set_name__` is not called on new descriptors." msgstr "" +"新しいデスクリプタの :py:meth:`~object.__set_name__` は呼び出されません。" -#: ../../c-api/type.rst:365 msgid "Equivalent to ``PyType_FromMetaclass(NULL, module, spec, bases)``." -msgstr "" +msgstr "``PyType_FromMetaclass(NULL, module, spec, bases)`` と同等です。" -#: ../../c-api/type.rst:371 msgid "" "The function now accepts a single class as the *bases* argument and ``NULL`` " "as the ``tp_doc`` slot." msgstr "" +"*bases* 引数に単一のクラスを、``tp_doc`` スロットに ``NULL`` を指定できるよう" +"になりました。" -#: ../../c-api/type.rst:376 ../../c-api/type.rst:397 msgid "" "The function now finds and uses a metaclass corresponding to the provided " "base classes. Previously, only :class:`type` instances were returned." msgstr "" +"指定された基底クラスに対応するメタクラスを探して使うようになりました。\n" +"以前は :class:`type` のインスタンスだけを返していました。" -#: ../../c-api/type.rst:379 ../../c-api/type.rst:400 ../../c-api/type.rst:420 msgid "" "The :c:member:`~PyTypeObject.tp_new` of the metaclass is *ignored*. which " "may result in incomplete initialization. Creating classes whose metaclass " "overrides :c:member:`~PyTypeObject.tp_new` is deprecated." msgstr "" +"メタクラスの :c:member:`~PyTypeObject.tp_new` は *無視* されるため、初期化が" +"不完全になる可能性があります。\n" +"メタクラスが :c:member:`~PyTypeObject.tp_new` をオーバーライドしているクラス" +"の作成は非推奨です。" -#: ../../c-api/type.rst:386 ../../c-api/type.rst:407 ../../c-api/type.rst:427 msgid "" "Creating classes whose metaclass overrides :c:member:`~PyTypeObject.tp_new` " "is no longer allowed." msgstr "" +"メタクラスが :c:member:`~PyTypeObject.tp_new` をオーバーライドしているクラス" +"は、作成できなくなりました。" -#: ../../c-api/type.rst:391 msgid "Equivalent to ``PyType_FromMetaclass(NULL, NULL, spec, bases)``." -msgstr "" +msgstr "``PyType_FromMetaclass(NULL, NULL, spec, bases)`` と同等です。" -#: ../../c-api/type.rst:412 msgid "Equivalent to ``PyType_FromMetaclass(NULL, NULL, spec, NULL)``." -msgstr "" +msgstr "``PyType_FromMetaclass(NULL, NULL, spec, NULL)`` と同等です。" -#: ../../c-api/type.rst:416 msgid "" "The function now finds and uses a metaclass corresponding to the base " "classes provided in *Py_tp_base[s]* slots. Previously, only :class:`type` " "instances were returned." msgstr "" +"*Py_tp_base[s]* スロットに指定された基底クラスに対応するメタクラスを探して使" +"うようになりました。\n" +"以前は :class:`type` のインスタンスだけを返していました。" -#: ../../c-api/type.rst:432 msgid "" "Make a type immutable: set the :c:macro:`Py_TPFLAGS_IMMUTABLETYPE` flag." msgstr "" +":c:macro:`Py_TPFLAGS_IMMUTABLETYPE` フラグを設定して、型を変更不能にします。" -#: ../../c-api/type.rst:434 msgid "All base classes of *type* must be immutable." -msgstr "" +msgstr "*type* のすべての基底クラスが変更不能でなければなりません。" -#: ../../c-api/type.rst:436 msgid "On success, return ``0``. On error, set an exception and return ``-1``." msgstr "" +"成功すると ``0`` を返します。\n" +"エラー時は例外を設定して ``-1`` を返します。" -#: ../../c-api/type.rst:439 msgid "" "The type must not be used before it's made immutable. For example, type " "instances must not be created before the type is made immutable." msgstr "" +"変更不能にする前に型を使ってはいけません。\n" +"例えば、変更不能にする前にその型のインスタンスを作成してはいけません。" #: ../../c-api/type.rst:455 msgid "Structure defining a type's behavior." @@ -551,9 +647,8 @@ msgid "" "requirements." msgstr "" -#: ../../c-api/type.rst:479 msgid "Previously, this field could not be negative." -msgstr "" +msgstr "以前はこのフィールドを負にできませんでした。" #: ../../c-api/type.rst:483 msgid "" @@ -575,21 +670,22 @@ msgid "" "The base is not variable-sized (its :c:member:`~PyTypeObject.tp_itemsize`)." msgstr "" -#: ../../c-api/type.rst:496 msgid "" "The requested :c:member:`PyType_Spec.basicsize` is positive, suggesting that " "the memory layout of the base class is known." msgstr "" +"要求された :c:member:`PyType_Spec.basicsize` が正で、基底クラスのメモリレイア" +"ウトを把握していると考えられる場合。" -#: ../../c-api/type.rst:498 msgid "" "The requested :c:member:`PyType_Spec.basicsize` is zero, suggesting that the " "subclass does not access the instance's memory directly." msgstr "" +"要求された :c:member:`PyType_Spec.basicsize` がゼロで、サブクラスがインスタン" +"スのメモリに直接アクセスしないと考えられる場合。" -#: ../../c-api/type.rst:501 msgid "With the :c:macro:`Py_TPFLAGS_ITEMS_AT_END` flag." -msgstr "" +msgstr ":c:macro:`Py_TPFLAGS_ITEMS_AT_END` フラグがある場合。" #: ../../c-api/type.rst:505 msgid "Type flags, used to set :c:member:`PyTypeObject.tp_flags`." @@ -647,32 +743,34 @@ msgid "" "PyTypeObject` struct field:" msgstr "" -#: ../../c-api/type.rst:545 msgid ":c:data:`Py_tp_token`" -msgstr "" +msgstr ":c:data:`Py_tp_token`" -#: ../../c-api/type.rst:547 msgid "" "The following “offset” fields cannot be set using :c:type:`PyType_Slot`:" msgstr "" +"次の「オフセット」フィールドは :c:type:`PyType_Slot` では設定できません。" -#: ../../c-api/type.rst:549 msgid "" ":c:member:`~PyTypeObject.tp_weaklistoffset` (use :c:macro:" "`Py_TPFLAGS_MANAGED_WEAKREF` instead if possible)" msgstr "" +":c:member:`~PyTypeObject.tp_weaklistoffset` (可能なら代わりに :c:macro:" +"`Py_TPFLAGS_MANAGED_WEAKREF` を使ってください)" -#: ../../c-api/type.rst:551 msgid "" ":c:member:`~PyTypeObject.tp_dictoffset` (use :c:macro:" "`Py_TPFLAGS_MANAGED_DICT` instead if possible)" msgstr "" +":c:member:`~PyTypeObject.tp_dictoffset` (可能なら代わりに :c:macro:" +"`Py_TPFLAGS_MANAGED_DICT` を使ってください)" -#: ../../c-api/type.rst:553 msgid "" ":c:member:`~PyTypeObject.tp_vectorcall_offset` (use " "``\"__vectorcalloffset__\"`` in :ref:`PyMemberDef `)" msgstr "" +":c:member:`~PyTypeObject.tp_vectorcall_offset` (:ref:`PyMemberDef " +"` で ``\"__vectorcalloffset__\"`` を使ってください)" #: ../../c-api/type.rst:557 msgid "" @@ -682,17 +780,18 @@ msgid "" "documentation ` for details." msgstr "" -#: ../../c-api/type.rst:563 msgid "" "The following internal fields cannot be set at all when creating a heap type:" -msgstr "" +msgstr "次の内部フィールドは、ヒープ型の作成時には一切設定できません。" -#: ../../c-api/type.rst:566 msgid "" ":c:member:`~PyTypeObject.tp_dict`, :c:member:`~PyTypeObject.tp_mro`, :c:" "member:`~PyTypeObject.tp_cache`, :c:member:`~PyTypeObject.tp_subclasses`, " "and :c:member:`~PyTypeObject.tp_weaklist`." msgstr "" +":c:member:`~PyTypeObject.tp_dict`, :c:member:`~PyTypeObject.tp_mro`, :c:" +"member:`~PyTypeObject.tp_cache`, :c:member:`~PyTypeObject.tp_subclasses`, " +"and :c:member:`~PyTypeObject.tp_weaklist`." #: ../../c-api/type.rst:572 msgid "" @@ -701,16 +800,18 @@ msgid "" "`PyType_FromSpecWithBases` instead." msgstr "" -#: ../../c-api/type.rst:577 msgid "Slots in :c:type:`PyBufferProcs` may be set in the unlimited API." msgstr "" +":c:type:`PyBufferProcs` のスロットは、制限のない API では設定できます。" -#: ../../c-api/type.rst:580 msgid "" ":c:member:`~PyBufferProcs.bf_getbuffer` and :c:member:`~PyBufferProcs." "bf_releasebuffer` are now available under the :ref:`limited API `." msgstr "" +":c:member:`~PyBufferProcs.bf_getbuffer` と :c:member:`~PyBufferProcs." +"bf_releasebuffer` が :ref:`Limited API ` でも利用できるように" +"なりました。" #: ../../c-api/type.rst:585 msgid "" @@ -732,11 +833,12 @@ msgstr "" msgid "``Py_tp_doc``" msgstr "" -#: ../../c-api/type.rst:598 msgid "" ":c:data:`Py_tp_token` (for clarity, prefer :c:data:`Py_TP_USE_SPEC` rather " "than ``NULL``)" msgstr "" +":c:data:`Py_tp_token` (明確にするため、``NULL`` より :c:data:" +"`Py_TP_USE_SPEC` を使うことを推奨します)" #: ../../c-api/type.rst:603 msgid "" @@ -750,39 +852,45 @@ msgid "" "can be set to the spec using the special value :c:data:`Py_TP_USE_SPEC`:" msgstr "" -#: ../../c-api/type.rst:610 msgid "" "static PyType_Slot foo_slots[] = {\n" " {Py_tp_token, Py_TP_USE_SPEC}," msgstr "" +"static PyType_Slot foo_slots[] = {\n" +" {Py_tp_token, Py_TP_USE_SPEC}," -#: ../../c-api/type.rst:615 msgid "It can also be set to an arbitrary pointer, but you must ensure that:" msgstr "" +"任意のポインタを設定することもできますが、次の条件を満たす必要があります。" -#: ../../c-api/type.rst:617 msgid "" "The pointer outlives the class, so it's not reused for something else while " "the class exists." msgstr "" +"クラスが存在する間にポインタが他の用途に再利用されないよう、その参照先がクラ" +"スより長く存続すること。" -#: ../../c-api/type.rst:619 msgid "" "It \"belongs\" to the extension module where the class lives, so it will not " "clash with other extensions." msgstr "" +"他の拡張モジュールと競合しないよう、クラスが属する拡張モジュールにそのポイン" +"タが「属する」こと。" -#: ../../c-api/type.rst:622 msgid "" "Use :c:func:`PyType_GetBaseByToken` to check if a class's superclass has a " "given token -- that is, check whether the memory layout is compatible." msgstr "" +"クラスの基底クラスが指定したトークンを持つかどうか、つまりメモリレイアウトに" +"互換性があるかどうかを調べるには :c:func:`PyType_GetBaseByToken` を使ってくだ" +"さい。" -#: ../../c-api/type.rst:625 msgid "" "To get the token for a given class (without considering superclasses), use :" "c:func:`PyType_GetSlot` with ``Py_tp_token``." msgstr "" +"基底クラスを考慮せず、指定したクラスのトークンを取得するには、" +"``Py_tp_token`` を指定して :c:func:`PyType_GetSlot` を使ってください。" #: ../../c-api/type.rst:634 msgid "" diff --git a/c-api/typehints.po b/c-api/typehints.po index 6e15352ed..4b0bad987 100644 --- a/c-api/typehints.po +++ b/c-api/typehints.po @@ -17,22 +17,25 @@ msgstr "" "Last-Translator: Arihiro TAKASE, 2023\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../c-api/typehints.rst:6 msgid "Objects for Type Hinting" msgstr "型ヒントのためのオブジェクト" -#: ../../c-api/typehints.rst:8 msgid "" "Various built-in types for type hinting are provided. Currently, two types " "exist -- :ref:`GenericAlias ` and :ref:`Union `. Only ``GenericAlias`` is exposed to C." msgstr "" +"型ヒント用の組み込み型を提供しています。\n" +"現在は :ref:`GenericAlias ` と :ref:`Union ` の二つがあり、このうち C に公開されているのは ``GenericAlias`` だけで" +"す。" #: ../../c-api/typehints.rst:14 msgid "" @@ -59,9 +62,8 @@ msgstr "" "性は ``__args__`` から必要に応じて遅延生成されます。失敗した場合、例外が送出" "されて ``NULL`` を返します。" -#: ../../c-api/typehints.rst:28 msgid "Here's an example of how to make an extension type generic::" -msgstr "以下は拡張の型をジェネリックにする例です。" +msgstr "拡張型をジェネリックにする例を示します。 ::" #: ../../c-api/typehints.rst:30 msgid "" @@ -75,9 +77,8 @@ msgid "" "}" msgstr "" -#: ../../c-api/typehints.rst:38 msgid "The data model method :meth:`~object.__class_getitem__`." -msgstr "" +msgstr "データモデルのメソッド :meth:`~object.__class_getitem__`。" #: ../../c-api/typehints.rst:44 msgid "" diff --git a/c-api/typeobj.po b/c-api/typeobj.po index f02894596..931c617d6 100644 --- a/c-api/typeobj.po +++ b/c-api/typeobj.po @@ -21,17 +21,15 @@ msgstr "" "Last-Translator: tomo, 2025\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" -#: ../../c-api/typeobj.rst:6 msgid "Type Object Structures" -msgstr "" +msgstr "型オブジェクトの構造体" -#: ../../c-api/typeobj.rst:8 msgid "" "Perhaps one of the most important structures of the Python object system is " "the structure that defines a new type: the :c:type:`PyTypeObject` " @@ -41,12 +39,12 @@ msgid "" "they are very important to the interpreter itself and to any extension " "module that implements new types." msgstr "" -"新スタイルの型を定義する構造体: :c:type:`PyTypeObject` 構造体は、おそらく " -"Python オブジェクトシステムの中で最も重要な構造体の1つでしょう。型オブジェク" -"トは ``PyObject_*`` 系や ``PyType_*`` 系の関数で扱えますが、ほとんどの " -"Python アプリケーションにとって、さして面白みのある機能を提供しません。型オブ" -"ジェクトはオブジェクトがどのように振舞うかを決める基盤ですから、インタプリタ" -"自体や新たな型を定義する拡張モジュールでは非常に重要な存在です。" +"新しい型を定義する :c:type:`PyTypeObject` 構造体は、Python のオブジェクトシス" +"テムで特に重要な構造体の 1 つです。\n" +"型オブジェクトは ``PyObject_*`` 関数や ``PyType_*`` 関数で扱えますが、ほとん" +"どの Python アプリケーションにとって関心のある機能はあまり提供しません。\n" +"これらのオブジェクトはオブジェクトの動作を決める基盤なので、インタープリタ自" +"体や新しい型を実装する拡張モジュールにとっては非常に重要です。" #: ../../c-api/typeobj.rst:16 msgid "" @@ -153,7 +151,7 @@ msgstr ":c:member:`~PyTypeObject.tp_basicsize`" #: ../../c-api/typeobj.rst:99 ../../c-api/typeobj.rst:120 #: ../../c-api/typeobj.rst:417 msgid ":c:type:`Py_ssize_t`" -msgstr "" +msgstr ":c:type:`Py_ssize_t`" #: ../../c-api/typeobj.rst:48 msgid ":c:member:`~PyTypeObject.tp_itemsize`" @@ -369,9 +367,8 @@ msgstr ":c:type:`richcmpfunc`" msgid "__lt__, __le__, __eq__, __ne__, __gt__, __ge__" msgstr "__lt__, __le__, __eq__, __ne__, __gt__, __ge__" -#: ../../c-api/typeobj.rst:99 msgid "(:c:member:`~PyTypeObject.tp_weaklistoffset`)" -msgstr "" +msgstr "(:c:member:`~PyTypeObject.tp_weaklistoffset`)" #: ../../c-api/typeobj.rst:101 msgid ":c:member:`~PyTypeObject.tp_iter`" @@ -480,9 +477,8 @@ msgstr ":c:type:`descrsetfunc`" msgid "__set__, __delete__" msgstr "__set__, __delete__" -#: ../../c-api/typeobj.rst:120 msgid "(:c:member:`~PyTypeObject.tp_dictoffset`)" -msgstr "" +msgstr "(:c:member:`~PyTypeObject.tp_dictoffset`)" #: ../../c-api/typeobj.rst:122 msgid ":c:member:`~PyTypeObject.tp_init`" @@ -597,51 +593,48 @@ msgstr ":c:member:`~PyTypeObject.tp_vectorcall`" msgid ":c:type:`vectorcallfunc`" msgstr ":c:type:`vectorcallfunc`" -#: ../../c-api/typeobj.rst:150 msgid "[:c:member:`~PyTypeObject.tp_watched`]" -msgstr "" +msgstr "[:c:member:`~PyTypeObject.tp_watched`]" #: ../../c-api/typeobj.rst:150 msgid "unsigned char" msgstr "unsigned char" -#: ../../c-api/typeobj.rst:155 msgid "" "**()**: A slot name in parentheses indicates it is (effectively) deprecated." msgstr "" +"**()**: 丸括弧で囲まれたスロット名は、そのスロットが (事実上) 非推奨であるこ" +"とを示します。" -#: ../../c-api/typeobj.rst:157 msgid "" "**<>**: Names in angle brackets should be initially set to ``NULL`` and " "treated as read-only." msgstr "" +"**<>**: 山括弧で囲まれた名前は、最初に ``NULL`` に設定し、読み取り専用として" +"扱うべきものです。" -#: ../../c-api/typeobj.rst:160 msgid "**[]**: Names in square brackets are for internal use only." -msgstr "" +msgstr "**[]**: 角括弧で囲まれた名前は内部使用専用です。" -#: ../../c-api/typeobj.rst:162 msgid "" "**** (as a prefix) means the field is required (must be non-``NULL``)." msgstr "" +"**** (接頭辞) は、そのフィールドが必須 (``NULL`` 不可) であることを示しま" +"す。" #: ../../c-api/typeobj.rst:164 msgid "Columns:" msgstr "列:" -#: ../../c-api/typeobj.rst:166 msgid "**\"O\"**: set on :c:data:`PyBaseObject_Type`" -msgstr "" +msgstr "**\"O\"**: :c:data:`PyBaseObject_Type` に設定されている" -#: ../../c-api/typeobj.rst:168 msgid "**\"T\"**: set on :c:data:`PyType_Type`" -msgstr "" +msgstr "**\"T\"**: :c:data:`PyType_Type` に設定されている" -#: ../../c-api/typeobj.rst:170 msgid "**\"D\"**: default (if slot is set to ``NULL``)" -msgstr "" +msgstr "**\"D\"**: デフォルト (スロットを ``NULL`` に設定した場合)" -#: ../../c-api/typeobj.rst:172 msgid "" "X - PyType_Ready sets this value if it is NULL\n" "~ - PyType_Ready always sets this value (it should be NULL)\n" @@ -649,12 +642,15 @@ msgid "" "\n" "Also see the inheritance column (\"I\")." msgstr "" +"X - NULL の場合、PyType_Ready がこの値を設定する\n" +"~ - PyType_Ready が常にこの値を設定する (NULL にしておくべき)\n" +"? - 他のスロットに応じて PyType_Ready がこの値を設定する場合がある\n" +"\n" +"継承の列 (\"I\") も参照してください。" -#: ../../c-api/typeobj.rst:180 msgid "**\"I\"**: inheritance" -msgstr "" +msgstr "**\"I\"**: 継承" -#: ../../c-api/typeobj.rst:182 msgid "" "X - type slot is inherited via *PyType_Ready* if defined with a *NULL* " "value\n" @@ -663,12 +659,15 @@ msgid "" "description\n" "? - it's complicated; see the slot's description" msgstr "" +"X - *NULL* 値で定義された型のスロットは *PyType_Ready* によって継承される\n" +"% - 下位構造体のスロットが個別に継承される\n" +"G - 他のスロットとの組み合わせでのみ継承される (スロットの説明を参照)\n" +"? - 複雑な規則がある (スロットの説明を参照)" -#: ../../c-api/typeobj.rst:189 msgid "" "Note that some slots are effectively inherited through the normal attribute " "lookup chain." -msgstr "" +msgstr "通常の属性検索の経路を通じて、実質的に継承されるスロットもあります。" #: ../../c-api/typeobj.rst:195 msgid "sub-slots" @@ -717,11 +716,11 @@ msgstr "__anext__" #: ../../c-api/typeobj.rst:210 msgid ":c:member:`~PyAsyncMethods.am_send`" -msgstr "" +msgstr ":c:member:`~PyAsyncMethods.am_send`" #: ../../c-api/typeobj.rst:210 msgid ":c:type:`sendfunc`" -msgstr "" +msgstr ":c:type:`sendfunc`" #: ../../c-api/typeobj.rst:214 msgid ":c:member:`~PyNumberMethods.nb_add`" @@ -769,9 +768,8 @@ msgstr "__sub__ __rsub__" msgid ":c:member:`~PyNumberMethods.nb_inplace_subtract`" msgstr ":c:member:`~PyNumberMethods.nb_inplace_subtract`" -#: ../../c-api/typeobj.rst:222 msgid "__isub__" -msgstr "" +msgstr "__isub__" #: ../../c-api/typeobj.rst:224 msgid ":c:member:`~PyNumberMethods.nb_multiply`" @@ -801,9 +799,8 @@ msgstr "__mod__ __rmod__" msgid ":c:member:`~PyNumberMethods.nb_inplace_remainder`" msgstr ":c:member:`~PyNumberMethods.nb_inplace_remainder`" -#: ../../c-api/typeobj.rst:232 msgid "__imod__" -msgstr "" +msgstr "__imod__" #: ../../c-api/typeobj.rst:234 msgid ":c:member:`~PyNumberMethods.nb_divmod`" @@ -825,9 +822,8 @@ msgstr "__pow__ __rpow__" msgid ":c:member:`~PyNumberMethods.nb_inplace_power`" msgstr ":c:member:`~PyNumberMethods.nb_inplace_power`" -#: ../../c-api/typeobj.rst:240 msgid "__ipow__" -msgstr "" +msgstr "__ipow__" #: ../../c-api/typeobj.rst:242 msgid ":c:member:`~PyNumberMethods.nb_negative`" @@ -881,9 +877,8 @@ msgstr "__lshift__ __rlshift__" msgid ":c:member:`~PyNumberMethods.nb_inplace_lshift`" msgstr ":c:member:`~PyNumberMethods.nb_inplace_lshift`" -#: ../../c-api/typeobj.rst:255 msgid "__ilshift__" -msgstr "" +msgstr "__ilshift__" #: ../../c-api/typeobj.rst:257 msgid ":c:member:`~PyNumberMethods.nb_rshift`" @@ -897,9 +892,8 @@ msgstr "__rshift__ __rrshift__" msgid ":c:member:`~PyNumberMethods.nb_inplace_rshift`" msgstr ":c:member:`~PyNumberMethods.nb_inplace_rshift`" -#: ../../c-api/typeobj.rst:260 msgid "__irshift__" -msgstr "" +msgstr "__irshift__" #: ../../c-api/typeobj.rst:262 msgid ":c:member:`~PyNumberMethods.nb_and`" @@ -913,9 +907,8 @@ msgstr "__and__ __rand__" msgid ":c:member:`~PyNumberMethods.nb_inplace_and`" msgstr ":c:member:`~PyNumberMethods.nb_inplace_and`" -#: ../../c-api/typeobj.rst:265 msgid "__iand__" -msgstr "" +msgstr "__iand__" #: ../../c-api/typeobj.rst:267 msgid ":c:member:`~PyNumberMethods.nb_xor`" @@ -929,9 +922,8 @@ msgstr "__xor__ __rxor__" msgid ":c:member:`~PyNumberMethods.nb_inplace_xor`" msgstr ":c:member:`~PyNumberMethods.nb_inplace_xor`" -#: ../../c-api/typeobj.rst:270 msgid "__ixor__" -msgstr "" +msgstr "__ixor__" #: ../../c-api/typeobj.rst:272 msgid ":c:member:`~PyNumberMethods.nb_or`" @@ -945,9 +937,8 @@ msgstr "__or__ __ror__" msgid ":c:member:`~PyNumberMethods.nb_inplace_or`" msgstr ":c:member:`~PyNumberMethods.nb_inplace_or`" -#: ../../c-api/typeobj.rst:275 msgid "__ior__" -msgstr "" +msgstr "__ior__" #: ../../c-api/typeobj.rst:277 msgid ":c:member:`~PyNumberMethods.nb_int`" @@ -981,9 +972,8 @@ msgstr "__floordiv__" msgid ":c:member:`~PyNumberMethods.nb_inplace_floor_divide`" msgstr ":c:member:`~PyNumberMethods.nb_inplace_floor_divide`" -#: ../../c-api/typeobj.rst:285 msgid "__ifloordiv__" -msgstr "" +msgstr "__ifloordiv__" #: ../../c-api/typeobj.rst:287 msgid ":c:member:`~PyNumberMethods.nb_true_divide`" @@ -997,9 +987,8 @@ msgstr "__truediv__" msgid ":c:member:`~PyNumberMethods.nb_inplace_true_divide`" msgstr ":c:member:`~PyNumberMethods.nb_inplace_true_divide`" -#: ../../c-api/typeobj.rst:289 msgid "__itruediv__" -msgstr "" +msgstr "__itruediv__" #: ../../c-api/typeobj.rst:291 msgid ":c:member:`~PyNumberMethods.nb_index`" @@ -1021,9 +1010,8 @@ msgstr "__matmul__ __rmatmul__" msgid ":c:member:`~PyNumberMethods.nb_inplace_matrix_multiply`" msgstr ":c:member:`~PyNumberMethods.nb_inplace_matrix_multiply`" -#: ../../c-api/typeobj.rst:296 msgid "__imatmul__" -msgstr "" +msgstr "__imatmul__" #: ../../c-api/typeobj.rst:300 msgid ":c:member:`~PyMappingMethods.mp_length`" @@ -1127,9 +1115,8 @@ msgstr ":c:member:`~PyBufferProcs.bf_getbuffer`" msgid ":c:func:`getbufferproc`" msgstr ":c:func:`getbufferproc`" -#: ../../c-api/typeobj.rst:328 msgid "__buffer__" -msgstr "" +msgstr "__buffer__" #: ../../c-api/typeobj.rst:330 msgid ":c:member:`~PyBufferProcs.bf_releasebuffer`" @@ -1139,9 +1126,8 @@ msgstr ":c:member:`~PyBufferProcs.bf_releasebuffer`" msgid ":c:func:`releasebufferproc`" msgstr ":c:func:`releasebufferproc`" -#: ../../c-api/typeobj.rst:330 msgid "__release_\\ buffer\\__" -msgstr "" +msgstr "__release_\\ buffer\\__" #: ../../c-api/typeobj.rst:337 msgid "slot typedefs" @@ -1193,22 +1179,22 @@ msgstr ":c:type:`Py_buffer` *" msgid ":c:type:`releasebufferproc`" msgstr ":c:type:`releasebufferproc`" -#: ../../c-api/typeobj.rst:470 msgid "See :ref:`slot-typedefs` below for more detail." -msgstr "" +msgstr "詳細は後述の :ref:`slot-typedefs` を参照してください。" #: ../../c-api/typeobj.rst:474 msgid "PyTypeObject Definition" msgstr "PyTypeObject 定義" -#: ../../c-api/typeobj.rst:476 msgid "" "The structure definition for :c:type:`PyTypeObject` can be found in :file:" "`Include/cpython/object.h`. For convenience of reference, this repeats the " "definition found there:" msgstr "" +":c:type:`PyTypeObject` の構造体定義は :file:`Include/cpython/object.h` にあり" +"ます。\n" +"参照しやすいように、その定義を以下に再掲します。" -#: ../../c-api/typeobj.rst:482 msgid "" "typedef struct _typeobject {\n" " PyObject_VAR_HEAD\n" @@ -1306,12 +1292,106 @@ msgid "" " uint16_t tp_versions_used;\n" "} PyTypeObject;\n" msgstr "" +"typedef struct _typeobject {\n" +" PyObject_VAR_HEAD\n" +" const char *tp_name; /* 表示用。形式は \".\" */\n" +" Py_ssize_t tp_basicsize, tp_itemsize; /* 割り当て用 */\n" +"\n" +" /* 標準の操作を実装するメソッド */\n" +"\n" +" destructor tp_dealloc;\n" +" Py_ssize_t tp_vectorcall_offset;\n" +" getattrfunc tp_getattr;\n" +" setattrfunc tp_setattr;\n" +" PyAsyncMethods *tp_as_async; /* 以前の名前は tp_compare (Python 2)\n" +" または tp_reserved (Python 3) */\n" +" reprfunc tp_repr;\n" +"\n" +" /* 標準クラス用のメソッド群 */\n" +"\n" +" PyNumberMethods *tp_as_number;\n" +" PySequenceMethods *tp_as_sequence;\n" +" PyMappingMethods *tp_as_mapping;\n" +"\n" +" /* その他の標準の操作 (バイナリ互換性のためこの位置に配置) */\n" +"\n" +" hashfunc tp_hash;\n" +" ternaryfunc tp_call;\n" +" reprfunc tp_str;\n" +" getattrofunc tp_getattro;\n" +" setattrofunc tp_setattro;\n" +"\n" +" /* オブジェクトを入出力バッファとして扱う関数 */\n" +" PyBufferProcs *tp_as_buffer;\n" +"\n" +" /* 任意機能や拡張機能の有無を定義するフラグ */\n" +" unsigned long tp_flags;\n" +"\n" +" const char *tp_doc; /* ドキュメント文字列 */\n" +"\n" +" /* リリース 2.0 で意味を割り当て */\n" +" /* アクセス可能な全オブジェクトについて関数を呼び出す */\n" +" traverseproc tp_traverse;\n" +"\n" +" /* 保持するオブジェクトへの参照を削除する */\n" +" inquiry tp_clear;\n" +"\n" +" /* リリース 2.1 で意味を割り当て */\n" +" /* 拡張比較 */\n" +" richcmpfunc tp_richcompare;\n" +"\n" +" /* 弱参照を有効にする */\n" +" Py_ssize_t tp_weaklistoffset;\n" +"\n" +" /* イテレータ */\n" +" getiterfunc tp_iter;\n" +" iternextfunc tp_iternext;\n" +"\n" +" /* 属性デスクリプタとサブクラス化に関するもの */\n" +" PyMethodDef *tp_methods;\n" +" PyMemberDef *tp_members;\n" +" PyGetSetDef *tp_getset;\n" +" // ヒープ型では強参照、静的な型では借用参照\n" +" PyTypeObject *tp_base;\n" +" PyObject *tp_dict;\n" +" descrgetfunc tp_descr_get;\n" +" descrsetfunc tp_descr_set;\n" +" Py_ssize_t tp_dictoffset;\n" +" initproc tp_init;\n" +" allocfunc tp_alloc;\n" +" newfunc tp_new;\n" +" freefunc tp_free; /* 低レベルのメモリ解放ルーチン */\n" +" inquiry tp_is_gc; /* PyObject_IS_GC 用 */\n" +" PyObject *tp_bases;\n" +" PyObject *tp_mro; /* メソッド解決順序 */\n" +" PyObject *tp_cache; /* 現在は未使用 */\n" +" void *tp_subclasses; /* 静的な組み込み型ではインデックス */\n" +" PyObject *tp_weaklist; /* 静的な組み込み型では未使用 */\n" +" destructor tp_del;\n" +"\n" +" /* 型の属性キャッシュのバージョンタグ。バージョン 2.6 で追加。\n" +" * ゼロならキャッシュは無効であり、初期化が必要。\n" +" */\n" +" unsigned int tp_version_tag;\n" +"\n" +" destructor tp_finalize;\n" +" vectorcallfunc tp_vectorcall;\n" +"\n" +" /* この型に関心を持つ型ウォッチャーを表すビット集合 */\n" +" unsigned char tp_watched;\n" +"\n" +" /* 使用された tp_version_tag 値の数。\n" +" * 属性キャッシュがこの型で無効な場合は、\n" +" * _Py_ATTR_CACHE_UNUSED に設定する (独自の MRO エントリーなどによる)。\n" +" * それ以外の場合は MAX_VERSIONS_PER_CLASS (別の場所で定義) 以下。\n" +" */\n" +" uint16_t tp_versions_used;\n" +"} PyTypeObject;\n" #: ../../c-api/typeobj.rst:486 msgid "PyObject Slots" msgstr "PyObject スロット" -#: ../../c-api/typeobj.rst:488 msgid "" "The type object structure extends the :c:type:`PyVarObject` structure. The :" "c:member:`~PyVarObject.ob_size` field is used for dynamic types (created by :" @@ -1320,6 +1400,12 @@ msgid "" "tp_itemsize`, which means that its instances (i.e. type objects) *must* have " "the :c:member:`~PyVarObject.ob_size` field." msgstr "" +"型オブジェクトの構造体は :c:type:`PyVarObject` 構造体を拡張しています。\n" +":c:member:`~PyVarObject.ob_size` フィールドは動的な型 (:c:func:`!type_new` で" +"作成され、通常はクラス文から呼び出されるもの) に使われます。\n" +":c:data:`PyType_Type` (メタタイプ) は :c:member:`~PyTypeObject.tp_itemsize` " +"を初期化するため、そのインスタンス (型オブジェクト) には :c:member:" +"`~PyVarObject.ob_size` フィールドが **必要です**。" #: ../../c-api/typeobj.rst:497 msgid "" @@ -1394,13 +1480,17 @@ msgstr "" msgid "Foo_Type.ob_type = &PyType_Type;" msgstr "" -#: ../../c-api/typeobj.rst:522 msgid "" "This should be done before any instances of the type are created. :c:func:" "`PyType_Ready` checks if :c:member:`~PyObject.ob_type` is ``NULL``, and if " "so, initializes it to the :c:member:`~PyObject.ob_type` field of the base " "class. :c:func:`PyType_Ready` will not change this field if it is non-zero." msgstr "" +"これは型のインスタンスを作成する前に行うべきです。\n" +":c:func:`PyType_Ready` は :c:member:`~PyObject.ob_type` が ``NULL`` かどうか" +"を調べ、``NULL`` なら基底クラスの :c:member:`~PyObject.ob_type` フィールドの" +"値で初期化します。\n" +"ゼロでない場合、:c:func:`PyType_Ready` はこのフィールドを変更しません。" #: ../../c-api/typeobj.rst:529 ../../c-api/typeobj.rst:790 #: ../../c-api/typeobj.rst:911 ../../c-api/typeobj.rst:1007 @@ -1436,15 +1526,18 @@ msgstr "" msgid "PyTypeObject Slots" msgstr "PyTypeObject スロット" -#: ../../c-api/typeobj.rst:552 msgid "" "Each slot has a section describing inheritance. If :c:func:`PyType_Ready` " "may set a value when the field is set to ``NULL`` then there will also be a " "\"Default\" section. (Note that many fields set on :c:data:" "`PyBaseObject_Type` and :c:data:`PyType_Type` effectively act as defaults.)" msgstr "" +"各スロットには継承についての説明があります。\n" +"フィールドが ``NULL`` のときに :c:func:`PyType_Ready` が値を設定する可能性が" +"ある場合は、「デフォルト」の説明もあります。\n" +":c:data:`PyBaseObject_Type` や :c:data:`PyType_Type` に設定された多くのフィー" +"ルドも、実質的にデフォルトとして働きます。" -#: ../../c-api/typeobj.rst:559 msgid "" "Pointer to a NUL-terminated string containing the name of the type. For " "types that are accessible as module globals, the string should be the full " @@ -1455,6 +1548,15 @@ msgid "" "mod:`!Q` in package :mod:`!P` should have the :c:member:`~PyTypeObject." "tp_name` initializer ``\"P.Q.M.T\"``." msgstr "" +"型の名前を含む NUL 終端文字列へのポインタです。\n" +"モジュールのグローバル変数としてアクセスできる型では、完全なモジュール名、" +"ドット、型名の順で構成するべきです。\n" +"組み込み型では型名だけにします。\n" +"モジュールがパッケージのサブモジュールである場合、完全なモジュール名にはパッ" +"ケージの完全な名前も含まれます。\n" +"例えば、パッケージ :mod:`!P` のサブパッケージ :mod:`!Q` のモジュール :mod:`!" +"M` で定義された :class:`!T` という型では、:c:member:`~PyTypeObject.tp_name` " +"の初期値は ``\"P.Q.M.T\"`` にするべきです。" #: ../../c-api/typeobj.rst:567 msgid "" @@ -1466,13 +1568,16 @@ msgstr "" "ドは単に型の名前になり、モジュール名は型の辞書内でキー ``'__module__'`` に対" "する値として明示的に保存されます。" -#: ../../c-api/typeobj.rst:572 msgid "" "For :ref:`statically allocated type objects `, the *tp_name* " "field should contain a dot. Everything before the last dot is made " "accessible as the :attr:`~type.__module__` attribute, and everything after " "the last dot is made accessible as the :attr:`~type.__name__` attribute." msgstr "" +":ref:`静的に割り当てられた型オブジェクト ` では、*tp_name* " +"フィールドにドットを含めるべきです。\n" +"最後のドットより前の部分が :attr:`~type.__module__` 属性、後の部分が :attr:" +"`~type.__name__` 属性としてアクセス可能になります。" #: ../../c-api/typeobj.rst:578 msgid "" @@ -1484,12 +1589,14 @@ msgid "" "created with pydoc." msgstr "" -#: ../../c-api/typeobj.rst:584 msgid "" "This field must not be ``NULL``. It is the only required field in :c:func:" "`PyTypeObject` (other than potentially :c:member:`~PyTypeObject." "tp_itemsize`)." msgstr "" +"このフィールドは ``NULL`` にできません。\n" +":c:func:`PyTypeObject` で唯一必須のフィールドです (場合によっては :c:member:" +"`~PyTypeObject.tp_itemsize` も必要です)。" #: ../../c-api/typeobj.rst:596 msgid "" @@ -1497,7 +1604,6 @@ msgid "" msgstr "" "これらのフィールドは、型インスタンスのバイトサイズを計算できるようにします。" -#: ../../c-api/typeobj.rst:598 msgid "" "There are two kinds of types: types with fixed-length instances have a zero :" "c:member:`!tp_itemsize` field, types with variable-length instances have a " @@ -1506,14 +1612,24 @@ msgid "" "tp_basicsize`. (Exceptions to this rule can be made using :c:func:" "`PyUnstable_Object_GC_NewWithExtraData`.)" msgstr "" +"型には 2 種類あります。\n" +"インスタンスが固定長の型では :c:member:`!tp_itemsize` フィールドがゼロで、可" +"変長の型では :c:member:`!tp_itemsize` フィールドがゼロ以外です。\n" +"固定長の型では、すべてのインスタンスのサイズは :c:member:`!tp_basicsize` で指" +"定された同じ値になります。\n" +":c:func:`PyUnstable_Object_GC_NewWithExtraData` を使うと、この規則の例外を作" +"れます。" -#: ../../c-api/typeobj.rst:605 msgid "" "For a type with variable-length instances, the instances must have an :c:" "member:`~PyVarObject.ob_size` field, and the instance size is :c:member:`!" "tp_basicsize` plus N times :c:member:`!tp_itemsize`, where N is the " "\"length\" of the object." msgstr "" +"可変長の型のインスタンスには :c:member:`~PyVarObject.ob_size` フィールドが必" +"要です。\n" +"インスタンスのサイズは :c:member:`!tp_basicsize` に :c:member:`!tp_itemsize` " +"の N 倍を加えた値で、N はオブジェクトの「長さ」です。" #: ../../c-api/typeobj.rst:610 msgid "" @@ -1526,13 +1642,13 @@ msgid "" "`PyLong_Export`." msgstr "" -#: ../../c-api/typeobj.rst:620 msgid "" "The :c:member:`~PyVarObject.ob_size` field should be accessed using the :c:" "func:`Py_SIZE()` and :c:func:`Py_SET_SIZE()` macros." msgstr "" +":c:member:`~PyVarObject.ob_size` フィールドには :c:func:`Py_SIZE()` マクロ" +"と :c:func:`Py_SET_SIZE()` マクロでアクセスするべきです。" -#: ../../c-api/typeobj.rst:623 msgid "" "Also, the presence of an :c:member:`~PyVarObject.ob_size` field in the " "instance layout doesn't mean that the instance structure is variable-length. " @@ -1541,14 +1657,20 @@ msgid "" "`int`, avoid reading lists' :c:member:`!ob_size` directly. Call :c:func:" "`PyList_Size` instead.)" msgstr "" +"また、インスタンスのレイアウトに :c:member:`~PyVarObject.ob_size` フィールド" +"があっても、その構造体が可変長であるとは限りません。\n" +"例えば :py:type:`list` 型のインスタンスは固定長ですが、:c:member:" +"`~PyVarObject.ob_size` フィールドを持ちます。\n" +":py:type:`int` と同様に、リストの :c:member:`!ob_size` を直接読むのは避け、代" +"わりに :c:func:`PyList_Size` を呼び出してください。" -#: ../../c-api/typeobj.rst:630 msgid "" "The :c:member:`!tp_basicsize` includes size needed for data of the type's :c:" "member:`~PyTypeObject.tp_base`, plus any extra data needed by each instance." msgstr "" +":c:member:`!tp_basicsize` には、その型の :c:member:`~PyTypeObject.tp_base` の" +"データに必要なサイズと、各インスタンスに必要な追加データのサイズを含めます。" -#: ../../c-api/typeobj.rst:634 msgid "" "The correct way to set :c:member:`!tp_basicsize` is to use the ``sizeof`` " "operator on the struct used to declare the instance layout. This struct must " @@ -1556,8 +1678,12 @@ msgid "" "`!tp_basicsize` must be greater than or equal to the base's :c:member:`!" "tp_basicsize`." msgstr "" +":c:member:`!tp_basicsize` を正しく設定するには、インスタンスのレイアウトを宣" +"言する構造体に ``sizeof`` 演算子を使います。\n" +"この構造体は、基底型を宣言する構造体を含んでいなければなりません。\n" +"つまり :c:member:`!tp_basicsize` は、基底型の :c:member:`!tp_basicsize` 以上" +"でなければなりません。" -#: ../../c-api/typeobj.rst:640 msgid "" "Since every type is a subtype of :py:type:`object`, this struct must " "include :c:type:`PyObject` or :c:type:`PyVarObject` (depending on whether :c:" @@ -1565,24 +1691,29 @@ msgid "" "by the macro :c:macro:`PyObject_HEAD` or :c:macro:`PyObject_VAR_HEAD`, " "respectively." msgstr "" +"すべての型は :py:type:`object` のサブタイプなので、この構造体には :c:type:" +"`PyObject` または :c:type:`PyVarObject` を含める必要があります (:c:member:" +"`~PyVarObject.ob_size` を含めるかどうかによります)。\n" +"通常はそれぞれ :c:macro:`PyObject_HEAD` マクロまたは :c:macro:" +"`PyObject_VAR_HEAD` マクロで定義します。" -#: ../../c-api/typeobj.rst:646 msgid "" "The basic size does not include the GC header size, as that header is not " "part of :c:macro:`PyObject_HEAD`." msgstr "" +"GC ヘッダーは :c:macro:`PyObject_HEAD` の一部ではないため、そのサイズは基本サ" +"イズに含めません。" -#: ../../c-api/typeobj.rst:649 msgid "" "For cases where struct used to declare the base type is unknown, see :c:" "member:`PyType_Spec.basicsize` and :c:func:`PyType_FromMetaclass`." msgstr "" +"基底型を宣言する構造体が不明な場合は、:c:member:`PyType_Spec.basicsize` と :" +"c:func:`PyType_FromMetaclass` を参照してください。" -#: ../../c-api/typeobj.rst:652 msgid "Notes about alignment:" -msgstr "" +msgstr "アラインメントに関する注意事項:" -#: ../../c-api/typeobj.rst:654 msgid "" ":c:member:`!tp_basicsize` must be a multiple of ``_Alignof(PyObject)``. When " "using ``sizeof`` on a ``struct`` that includes :c:macro:`PyObject_HEAD`, as " @@ -1590,103 +1721,137 @@ msgid "" "when using compiler extensions like ``__attribute__((packed))``, it is up to " "you." msgstr "" +":c:member:`!tp_basicsize` は ``_Alignof(PyObject)`` の倍数でなければなりませ" +"ん。\n" +"推奨どおり :c:macro:`PyObject_HEAD` を含む ``struct`` に ``sizeof`` を使え" +"ば、コンパイラがこれを保証します。\n" +"C の ``struct`` を使わない場合や、``__attribute__((packed))`` などのコンパイ" +"ラ拡張を使う場合は、自分で保証する必要があります。" -#: ../../c-api/typeobj.rst:659 msgid "" "If the variable items require a particular alignment, :c:member:`!" "tp_basicsize` and :c:member:`!tp_itemsize` must each be a multiple of that " "alignment. For example, if a type's variable part stores a ``double``, it is " "your responsibility that both fields are a multiple of ``_Alignof(double)``." msgstr "" +"可変部分の要素に特定のアラインメントが必要な場合、:c:member:`!tp_basicsize` " +"と :c:member:`!tp_itemsize` はそれぞれそのアラインメントの倍数でなければなり" +"ません。\n" +"例えば可変部分に ``double`` を格納する型では、両フィールドが " +"``_Alignof(double)`` の倍数になるようにする責任があります。" -#: ../../c-api/typeobj.rst:668 msgid "" "These fields are inherited separately by subtypes. (That is, if the field is " "set to zero, :c:func:`PyType_Ready` will copy the value from the base type, " "indicating that the instances do not need additional storage.)" msgstr "" +"これらのフィールドはサブタイプに個別に継承されます。\n" +"フィールドがゼロに設定されている場合、:c:func:`PyType_Ready` は基底型から値を" +"コピーし、インスタンスに追加の格納領域が不要であることを表します。" -#: ../../c-api/typeobj.rst:673 msgid "" "If the base type has a non-zero :c:member:`~PyTypeObject.tp_itemsize`, it is " "generally not safe to set :c:member:`~PyTypeObject.tp_itemsize` to a " "different non-zero value in a subtype (though this depends on the " "implementation of the base type)." msgstr "" +"基底型の :c:member:`~PyTypeObject.tp_itemsize` がゼロ以外の場合、サブタイプ" +"の :c:member:`~PyTypeObject.tp_itemsize` を別のゼロ以外の値に設定するのは、一" +"般に安全ではありません (ただし、基底型の実装によります)。" -#: ../../c-api/typeobj.rst:680 msgid "" "A pointer to the instance destructor function. The function signature is::" msgstr "" +"インスタンスのデストラクタ関数へのポインタです。\n" +"シグネチャは次のとおりです。 ::" -#: ../../c-api/typeobj.rst:682 msgid "void tp_dealloc(PyObject *self);" -msgstr "" +msgstr "void tp_dealloc(PyObject *self);" -#: ../../c-api/typeobj.rst:684 msgid "" "The destructor function should remove all references which the instance owns " "(e.g., call :c:func:`Py_CLEAR`), free all memory buffers owned by the " "instance, and call the type's :c:member:`~PyTypeObject.tp_free` function to " "free the object itself." msgstr "" +"デストラクタ関数は、インスタンスが所有するすべての参照を取り除き (例えば :c:" +"func:`Py_CLEAR` を呼び出します)、インスタンスが所有するすべてのメモリバッファ" +"を解放し、型の :c:member:`~PyTypeObject.tp_free` 関数を呼び出してオブジェクト" +"自体を解放する必要があります。" -#: ../../c-api/typeobj.rst:689 msgid "No guarantees are made about when an object is destroyed, except:" msgstr "" +"オブジェクトが破棄される時点については、次の事項を除いて保証はありません。" -#: ../../c-api/typeobj.rst:691 msgid "" "Python will destroy an object immediately or some time after the final " "reference to the object is deleted, unless its finalizer (:c:member:" "`~PyTypeObject.tp_finalize`) subsequently resurrects the object." msgstr "" +"Python は、オブジェクトへの最後の参照が削除された直後か、その後のどこかの時点" +"でオブジェクトを破棄します。\n" +"ただし、ファイナライザ (:c:member:`~PyTypeObject.tp_finalize`) がその後オブ" +"ジェクトを復活させる場合は除きます。" -#: ../../c-api/typeobj.rst:695 msgid "" "An object will not be destroyed while it is being automatically finalized (:" "c:member:`~PyTypeObject.tp_finalize`) or automatically cleared (:c:member:" "`~PyTypeObject.tp_clear`)." msgstr "" +"オブジェクトが自動的にファイナライズ (:c:member:`~PyTypeObject.tp_finalize`) " +"またはクリア (:c:member:`~PyTypeObject.tp_clear`) されている間は、そのオブ" +"ジェクトは破棄されません。" -#: ../../c-api/typeobj.rst:699 msgid "" "CPython currently destroys an object immediately from :c:func:`Py_DECREF` " "when the new reference count is zero, but this may change in a future " "version." msgstr "" +"現在の CPython は、:c:func:`Py_DECREF` によって参照カウントがゼロになると、そ" +"の呼び出しから直ちにオブジェクトを破棄します。\n" +"ただし、将来のバージョンでは変更される可能性があります。" -#: ../../c-api/typeobj.rst:703 msgid "" "It is recommended to call :c:func:`PyObject_CallFinalizerFromDealloc` at the " "beginning of :c:member:`!tp_dealloc` to guarantee that the object is always " "finalized before destruction." msgstr "" +"オブジェクトが破棄前に必ずファイナライズされるように、:c:member:`!" +"tp_dealloc` の冒頭で :c:func:`PyObject_CallFinalizerFromDealloc` を呼び出すこ" +"とを推奨します。" -#: ../../c-api/typeobj.rst:707 msgid "" "If the type supports garbage collection (the :c:macro:`Py_TPFLAGS_HAVE_GC` " "flag is set), the destructor should call :c:func:`PyObject_GC_UnTrack` " "before clearing any member fields." msgstr "" +"型がガベージコレクションをサポートする場合 (:c:macro:`Py_TPFLAGS_HAVE_GC` フ" +"ラグが設定されている場合)、デストラクタはメンバーフィールドをクリアする前に :" +"c:func:`PyObject_GC_UnTrack` を呼び出すべきです。" -#: ../../c-api/typeobj.rst:711 msgid "" "It is permissible to call :c:member:`~PyTypeObject.tp_clear` from :c:member:" "`!tp_dealloc` to reduce code duplication and to guarantee that the object is " "always cleared before destruction. Beware that :c:member:`!tp_clear` might " "have already been called." msgstr "" +"コードの重複を減らし、破棄前にオブジェクトが必ずクリアされるようにするため、:" +"c:member:`!tp_dealloc` から :c:member:`~PyTypeObject.tp_clear` を呼び出しても" +"構いません。\n" +":c:member:`!tp_clear` はすでに呼び出されている可能性がある点に注意してくださ" +"い。" -#: ../../c-api/typeobj.rst:716 msgid "" "If the type is heap allocated (:c:macro:`Py_TPFLAGS_HEAPTYPE`), the " "deallocator should release the owned reference to its type object (via :c:" "func:`Py_DECREF`) after calling the type deallocator. See the example code " "below.::" msgstr "" +"型がヒープに割り当てられている場合 (:c:macro:`Py_TPFLAGS_HEAPTYPE`)、解放関数" +"は型の解放関数を呼び出した後、型オブジェクトへの所有する参照を :c:func:" +"`Py_DECREF` で解放するべきです。\n" +"以下のコード例を参照してください。 ::" -#: ../../c-api/typeobj.rst:721 msgid "" "static void\n" "foo_dealloc(PyObject *op)\n" @@ -1697,20 +1862,30 @@ msgid "" " Py_TYPE(self)->tp_free(self);\n" "}" msgstr "" +"static void\n" +"foo_dealloc(PyObject *op)\n" +"{\n" +" foo_object *self = (foo_object *) op;\n" +" PyObject_GC_UnTrack(self);\n" +" Py_CLEAR(self->ref);\n" +" Py_TYPE(self)->tp_free(self);\n" +"}" -#: ../../c-api/typeobj.rst:730 msgid "" ":c:member:`!tp_dealloc` must leave the exception status unchanged. If it " "needs to call something that might raise an exception, the exception state " "must be backed up first and restored later (after logging any exceptions " "with :c:func:`PyErr_WriteUnraisable`)." msgstr "" +":c:member:`!tp_dealloc` は例外の状態を変えてはいけません。\n" +"例外を送出する可能性のある処理を呼び出す必要がある場合は、先に例外の状態を保" +"存し、発生した例外を :c:func:`PyErr_WriteUnraisable` で記録した後に復元しなけ" +"ればなりません。" #: ../../c-api/typeobj.rst:735 msgid "Example::" msgstr "以下はプログラム例です::" -#: ../../c-api/typeobj.rst:737 msgid "" "static void\n" "foo_dealloc(PyObject *self)\n" @@ -1751,8 +1926,45 @@ msgid "" " PyErr_SetRaisedException(exc);\n" "}" msgstr "" +"static void\n" +"foo_dealloc(PyObject *self)\n" +"{\n" +" PyObject *exc = PyErr_GetRaisedException();\n" +"\n" +" if (PyObject_CallFinalizerFromDealloc(self) < 0) {\n" +" // self が復活した。\n" +" goto done;\n" +" }\n" +"\n" +" PyTypeObject *tp = Py_TYPE(self);\n" +"\n" +" if (tp->tp_flags & Py_TPFLAGS_HAVE_GC) {\n" +" PyObject_GC_UnTrack(self);\n" +" }\n" +"\n" +" // 任意だが、コードの重複を避けるのに便利。\n" +" if (tp->tp_clear && tp->tp_clear(self) < 0) {\n" +" PyErr_WriteUnraisable(self);\n" +" }\n" +"\n" +" // 追加の破棄処理をここで行う。\n" +"\n" +" tp->tp_free(self);\n" +" self = NULL; // 後で PyErr_WriteUnraisable() が呼ばれる場合に備える。\n" +"\n" +" if (tp->tp_flags & Py_TPFLAGS_HEAPTYPE) {\n" +" Py_CLEAR(tp);\n" +" }\n" +"\n" +"done:\n" +" // 例外を送出する可能性のある処理を呼び出した場合に、\n" +" // 必要に応じて行う。\n" +" if (PyErr_Occurred()) {\n" +" PyErr_WriteUnraisable(self);\n" +" }\n" +" PyErr_SetRaisedException(exc);\n" +"}" -#: ../../c-api/typeobj.rst:776 msgid "" ":c:member:`!tp_dealloc` may be called from any Python thread, not just the " "thread which created the object (if the object becomes part of a refcount " @@ -1764,49 +1976,71 @@ msgid "" "those objects on the thread which called :c:member:`!tp_dealloc` will not " "violate any assumptions of the library." msgstr "" +":c:member:`!tp_dealloc` は、オブジェクトを作成したスレッドに限らず、どの " +"Python スレッドからも呼び出される可能性があります。\n" +"例えば、オブジェクトが循環参照の一部になった場合、その循環参照はどのスレッド" +"のガベージコレクションでも回収され得ます。\n" +":c:member:`!tp_dealloc` を呼び出すスレッドには :term:`アタッチされたスレッド" +"状態 ` があるため、Python API の呼び出しには問題ありま" +"せん。\n" +"ただし、破棄するオブジェクトが別の C ライブラリのオブジェクトも破棄する場合" +"は、:c:member:`!tp_dealloc` を呼び出したスレッドでの破棄が、そのライブラリの" +"前提を破らないよう注意が必要です。" -#: ../../c-api/typeobj.rst:794 ../../c-api/typeobj.rst:1694 -#: ../../c-api/typeobj.rst:2427 msgid "" ":ref:`life-cycle` for details about how this slot relates to other slots." msgstr "" +"このスロットと他のスロットの関係の詳細は :ref:`life-cycle` を参照してくださ" +"い。" -#: ../../c-api/typeobj.rst:799 msgid "" "An optional offset to a per-instance function that implements calling the " "object using the :ref:`vectorcall protocol `, a more efficient " "alternative of the simpler :c:member:`~PyTypeObject.tp_call`." msgstr "" +"より単純な :c:member:`~PyTypeObject.tp_call` より効率的な :ref:`vectorcall プ" +"ロトコル ` を使ってオブジェクトの呼び出しを実装する、インスタンス" +"ごとの関数への省略可能なオフセットです。" -#: ../../c-api/typeobj.rst:804 msgid "" "This field is only used if the flag :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` is " "set. If so, this must be a positive integer containing the offset in the " "instance of a :c:type:`vectorcallfunc` pointer." msgstr "" +"このフィールドは :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` フラグが設定されている" +"場合にのみ使われます。\n" +"その場合、インスタンス内の :c:type:`vectorcallfunc` ポインタのオフセットを表" +"す正の整数でなければなりません。" -#: ../../c-api/typeobj.rst:808 msgid "" "The *vectorcallfunc* pointer may be ``NULL``, in which case the instance " "behaves as if :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` was not set: calling the " "instance falls back to :c:member:`~PyTypeObject.tp_call`." msgstr "" +"*vectorcallfunc* ポインタは ``NULL`` にできます。\n" +"その場合、インスタンスは :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` が設定されてい" +"ないかのように動作し、呼び出しは :c:member:`~PyTypeObject.tp_call` にフォール" +"バックします。" -#: ../../c-api/typeobj.rst:812 msgid "" "Any class that sets ``Py_TPFLAGS_HAVE_VECTORCALL`` must also set :c:member:" "`~PyTypeObject.tp_call` and make sure its behaviour is consistent with the " "*vectorcallfunc* function. This can be done by setting *tp_call* to :c:func:" "`PyVectorcall_Call`." msgstr "" +"``Py_TPFLAGS_HAVE_VECTORCALL`` を設定するクラスでは、:c:member:" +"`~PyTypeObject.tp_call` も設定し、その動作が *vectorcallfunc* 関数と一致する" +"ようにしなければなりません。\n" +"*tp_call* を :c:func:`PyVectorcall_Call` に設定すれば実現できます。" -#: ../../c-api/typeobj.rst:819 msgid "" "Before version 3.8, this slot was named ``tp_print``. In Python 2.x, it was " "used for printing to a file. In Python 3.0 to 3.7, it was unused." msgstr "" +"バージョン 3.8 より前では、このスロットの名前は ``tp_print`` でした。\n" +"Python 2.x ではファイルへの出力に使われ、Python 3.0 から 3.7 では使われていま" +"せんでした。" -#: ../../c-api/typeobj.rst:825 msgid "" "Before version 3.12, it was not recommended for :ref:`mutable heap types " "` to implement the vectorcall protocol. When a user sets :attr:" @@ -1815,14 +2049,24 @@ msgid "" "``__call__`` will disable vectorcall optimization by clearing the :c:macro:" "`Py_TPFLAGS_HAVE_VECTORCALL` flag." msgstr "" +"バージョン 3.12 より前では、:ref:`変更可能なヒープ型 ` による " +"vectorcall プロトコルの実装は推奨されていませんでした。\n" +"利用者が Python コードで :attr:`~object.__call__` を設定すると *tp_call* だけ" +"が更新され、vectorcall 関数と不整合になる可能性が高いためです。\n" +"3.12 以降は、``__call__`` を設定すると :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` " +"フラグがクリアされ、vectorcall による最適化が無効になります。" -#: ../../c-api/typeobj.rst:835 msgid "" "This field is always inherited. However, the :c:macro:" "`Py_TPFLAGS_HAVE_VECTORCALL` flag is not always inherited. If it's not set, " "then the subclass won't use :ref:`vectorcall `, except when :c:" "func:`PyVectorcall_Call` is explicitly called." msgstr "" +"このフィールドは常に継承されます。\n" +"ただし、:c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` フラグが常に継承されるとは限り" +"ません。\n" +"そのフラグがなければ、:c:func:`PyVectorcall_Call` を明示的に呼び出す場合を除" +"いて、サブクラスは :ref:`vectorcall ` を使いません。" #: ../../c-api/typeobj.rst:844 msgid "An optional pointer to the get-attribute-string function." @@ -1840,11 +2084,12 @@ msgstr "" "同じように動作し、属性名は Python 文字列 オブジェクトではなく C 文字列で指定" "するような関数を指すようにしなければなりません。" -#: ../../c-api/typeobj.rst:852 ../../c-api/typeobj.rst:1048 msgid "" "Group: :c:member:`~PyTypeObject.tp_getattr`, :c:member:`~PyTypeObject." "tp_getattro`" msgstr "" +"グループ: :c:member:`~PyTypeObject.tp_getattr`、:c:member:`~PyTypeObject." +"tp_getattro`" #: ../../c-api/typeobj.rst:854 msgid "" @@ -1877,11 +2122,12 @@ msgstr "" "同じように動作し、属性名は Python 文字列 オブジェクトではなく C 文字列で指定" "するような関数を指すようにしなければなりません。" -#: ../../c-api/typeobj.rst:869 ../../c-api/typeobj.rst:1074 msgid "" "Group: :c:member:`~PyTypeObject.tp_setattr`, :c:member:`~PyTypeObject." "tp_setattro`" msgstr "" +"グループ: :c:member:`~PyTypeObject.tp_setattr`、:c:member:`~PyTypeObject." +"tp_setattro`" #: ../../c-api/typeobj.rst:871 msgid "" @@ -1929,15 +2175,12 @@ msgstr "" "オプションのポインタで、組み込み関数 :func:`repr` を実装している関数を指しま" "す。" -#: ../../c-api/typeobj.rst:898 msgid "The signature is the same as for :c:func:`PyObject_Repr`::" -msgstr "" +msgstr "シグネチャは :c:func:`PyObject_Repr` と同じです。 ::" -#: ../../c-api/typeobj.rst:900 msgid "PyObject *tp_repr(PyObject *self);" -msgstr "" +msgstr "PyObject *tp_repr(PyObject *self);" -#: ../../c-api/typeobj.rst:902 msgid "" "The function must return a string or a Unicode object. Ideally, this " "function should return a string that, when passed to :func:`eval`, given a " @@ -1945,11 +2188,12 @@ msgid "" "feasible, it should return a string starting with ``'<'`` and ending with " "``'>'`` from which both the type and the value of the object can be deduced." msgstr "" -"この関数は文字列オブジェクトか Unicode オブジェクトを返さなければなりません。" -"理想的には、この関数が返す文字列は、適切な環境で :func:`eval` に渡した場合、" -"同じ値を持つオブジェクトになるような文字列でなければなりません。不可能な場合" -"には、オブジェクトの型と値から導出した内容の入った ``'<'`` から始まって " -"``'>'`` で終わる文字列を返さなければなりません。" +"この関数は文字列オブジェクトか Unicode オブジェクトを返さなければなりませ" +"ん。\n" +"理想的には、適切な環境で :func:`eval` に渡すと同じ値のオブジェクトが得られる" +"文字列を返すべきです。\n" +"それが難しい場合は、型と値を読み取れる、``'<'`` で始まり ``'>'`` で終わる文字" +"列を返すべきです。" #: ../../c-api/typeobj.rst:913 ../../c-api/typeobj.rst:992 #: ../../c-api/typeobj.rst:1029 ../../c-api/typeobj.rst:1054 @@ -2031,13 +2275,11 @@ msgstr "" "オプションのポインタで、組み込み関数 :func:`hash` を実装している関数を指しま" "す。" -#: ../../c-api/typeobj.rst:963 msgid "The signature is the same as for :c:func:`PyObject_Hash`::" -msgstr "" +msgstr "シグネチャは :c:func:`PyObject_Hash` と同じです。 ::" -#: ../../c-api/typeobj.rst:965 msgid "Py_hash_t tp_hash(PyObject *);" -msgstr "" +msgstr "Py_hash_t tp_hash(PyObject *);" #: ../../c-api/typeobj.rst:967 msgid "" @@ -2048,13 +2290,16 @@ msgstr "" "通常時には ``-1`` を戻り値にしてはなりません; ハッシュ値の計算中にエラーが生" "じた場合、関数は例外をセットして ``-1`` を返さねばなりません。" -#: ../../c-api/typeobj.rst:971 msgid "" "When this field is not set (*and* :c:member:`~PyTypeObject.tp_richcompare` " "is not set), an attempt to take the hash of the object raises :exc:" "`TypeError`. This is the same as setting it to :c:func:" "`PyObject_HashNotImplemented`." msgstr "" +"このフィールドが設定されておらず、:c:member:`~PyTypeObject.tp_richcompare` *" +"も* 設定されていない場合、オブジェクトのハッシュを求めると :exc:`TypeError` " +"が送出されます。\n" +":c:func:`PyObject_HashNotImplemented` を設定した場合と同じです。" #: ../../c-api/typeobj.rst:975 msgid "" @@ -2074,11 +2319,12 @@ msgstr "" "ことで ``tp_hash`` スロットは :c:func:`PyObject_HashNotImplemented` に設定さ" "れます。" -#: ../../c-api/typeobj.rst:985 ../../c-api/typeobj.rst:1750 msgid "" "Group: :c:member:`~PyTypeObject.tp_hash`, :c:member:`~PyTypeObject." "tp_richcompare`" msgstr "" +"グループ: :c:member:`~PyTypeObject.tp_hash`、:c:member:`~PyTypeObject." +"tp_richcompare`" #: ../../c-api/typeobj.rst:987 msgid "" @@ -2094,23 +2340,22 @@ msgstr "" "のとき、サブタイプは基底タイプから :c:member:`~PyTypeObject.tp_richcompare` " "と :c:member:`~PyTypeObject.tp_hash` を両方とも継承します。" -#: ../../c-api/typeobj.rst:994 msgid ":c:data:`PyBaseObject_Type` uses :c:func:`PyObject_GenericHash`." msgstr "" +":c:data:`PyBaseObject_Type` は :c:func:`PyObject_GenericHash` を使います。" -#: ../../c-api/typeobj.rst:999 msgid "" "An optional pointer to a function that implements calling the object. This " "should be ``NULL`` if the object is not callable. The signature is the same " "as for :c:func:`PyObject_Call`::" msgstr "" -"オプションのポインタで、オブジェクトの呼び出しを実装している関数を指します。" -"オブジェクトが呼び出し可能でない場合には ``NULL`` にしなければなりません。シ" -"グネチャは :c:func:`PyObject_Call` と同じです。" +"オプションのポインタで、オブジェクトの呼び出しを実装している関数を指しま" +"す。\n" +"オブジェクトが呼び出し可能でない場合には ``NULL`` にしなければなりません。\n" +"シグネチャは :c:func:`PyObject_Call` と同じです。 ::" -#: ../../c-api/typeobj.rst:1003 msgid "PyObject *tp_call(PyObject *self, PyObject *args, PyObject *kwargs);" -msgstr "" +msgstr "PyObject *tp_call(PyObject *self, PyObject *args, PyObject *kwargs);" #: ../../c-api/typeobj.rst:1012 msgid "" @@ -2121,18 +2366,16 @@ msgid "" "this handler.)" msgstr "" "オプションのポインタで、組み込みの演算 :func:`str` を実装している関数を指しま" -"す。(:class:`str` が型の一つになったため、 :func:`str` は :class:`str` のコン" -"ストラクタを呼び出すことに注意してください。このコンストラクタは実際の処理を" -"行う上で :c:func:`PyObject_Str` を呼び出し、さらに :c:func:`PyObject_Str` が" -"このハンドラを呼び出すことになります。)" +"す。(:class:`str` が型の一つになったため、 :func:`str` は ``str`` のコンスト" +"ラクタを呼び出すことに注意してください。このコンストラクタは実際の処理を行う" +"上で :c:func:`PyObject_Str` を呼び出し、さらに :c:func:`PyObject_Str` がこの" +"ハンドラを呼び出すことになります。)" -#: ../../c-api/typeobj.rst:1017 msgid "The signature is the same as for :c:func:`PyObject_Str`::" -msgstr "" +msgstr "シグネチャは :c:func:`PyObject_Str` と同じです。 ::" -#: ../../c-api/typeobj.rst:1019 msgid "PyObject *tp_str(PyObject *self);" -msgstr "" +msgstr "PyObject *tp_str(PyObject *self);" #: ../../c-api/typeobj.rst:1021 msgid "" @@ -2158,13 +2401,11 @@ msgstr "" msgid "An optional pointer to the get-attribute function." msgstr "オプションのポインタで、get-attribute を実装している関数を指します。" -#: ../../c-api/typeobj.rst:1039 msgid "The signature is the same as for :c:func:`PyObject_GetAttr`::" -msgstr "" +msgstr "シグネチャは :c:func:`PyObject_GetAttr` と同じです。 ::" -#: ../../c-api/typeobj.rst:1041 msgid "PyObject *tp_getattro(PyObject *self, PyObject *attr);" -msgstr "" +msgstr "PyObject *tp_getattro(PyObject *self, PyObject *attr);" #: ../../c-api/typeobj.rst:1043 msgid "" @@ -2189,17 +2430,15 @@ msgstr "" "基底タイプから :c:member:`~PyTypeObject.tp_getattr` と :c:member:" "`~PyTypeObject.tp_getattro` を両方とも継承します。" -#: ../../c-api/typeobj.rst:1056 msgid ":c:data:`PyBaseObject_Type` uses :c:func:`PyObject_GenericGetAttr`." msgstr "" +":c:data:`PyBaseObject_Type` は :c:func:`PyObject_GenericGetAttr` を使います。" -#: ../../c-api/typeobj.rst:1063 msgid "The signature is the same as for :c:func:`PyObject_SetAttr`::" -msgstr "" +msgstr "シグネチャは :c:func:`PyObject_SetAttr` と同じです。 ::" -#: ../../c-api/typeobj.rst:1065 msgid "int tp_setattro(PyObject *self, PyObject *attr, PyObject *value);" -msgstr "" +msgstr "int tp_setattro(PyObject *self, PyObject *attr, PyObject *value);" #: ../../c-api/typeobj.rst:1067 msgid "" @@ -2227,9 +2466,9 @@ msgstr "" "基底タイプから :c:member:`~PyTypeObject.tp_setattr` と :c:member:" "`~PyTypeObject.tp_setattro` を両方とも継承します。" -#: ../../c-api/typeobj.rst:1082 msgid ":c:data:`PyBaseObject_Type` uses :c:func:`PyObject_GenericSetAttr`." msgstr "" +":c:data:`PyBaseObject_Type` は :c:func:`PyObject_GenericSetAttr` を使います。" #: ../../c-api/typeobj.rst:1087 msgid "" @@ -2270,7 +2509,6 @@ msgstr "" "がクリアされていれば、フラグが保護しているフィールドにはアクセスしない代わり" "に、その値はゼロか ``NULL`` になっているとみなさなければなりません。" -#: ../../c-api/typeobj.rst:1109 msgid "" "Inheritance of this field is complicated. Most flag bits are inherited " "individually, i.e. if the base type has a flag bit set, the subtype inherits " @@ -2284,16 +2522,29 @@ msgid "" "`~PyTypeObject.tp_traverse` and :c:member:`~PyTypeObject.tp_clear` fields in " "the subtype exist and have ``NULL`` values." msgstr "" +"このフィールドの継承規則は複雑です。\n" +"ほとんどのフラグビットは個別に継承されます。\n" +"つまり基底型にフラグビットが設定されていれば、サブタイプにも継承されます。\n" +"拡張構造体に関するフラグビットは、その構造体が継承される場合に限って継承され" +"ます。\n" +"基底型のフラグビットの値が、拡張構造体へのポインタとともにサブタイプにコピー" +"されます。\n" +":c:macro:`Py_TPFLAGS_HAVE_GC` フラグビットは :c:member:`~PyTypeObject." +"tp_traverse` フィールドおよび :c:member:`~PyTypeObject.tp_clear` フィールドと" +"まとめて継承されます。\n" +"これは、サブタイプの :c:macro:`Py_TPFLAGS_HAVE_GC` フラグビットがクリアされて" +"おり、:c:member:`~PyTypeObject.tp_traverse` と :c:member:`~PyTypeObject." +"tp_clear` が存在して、どちらも ``NULL`` の場合です。" -#: ../../c-api/typeobj.rst:1124 msgid "" ":c:data:`PyBaseObject_Type` uses ``Py_TPFLAGS_DEFAULT | " "Py_TPFLAGS_BASETYPE``." msgstr "" +":c:data:`PyBaseObject_Type` は ``Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE`` " +"を使います。" -#: ../../c-api/typeobj.rst:1127 msgid "**Bit Masks:**" -msgstr "" +msgstr "**ビットマスク:**" #: ../../c-api/typeobj.rst:1131 msgid "" @@ -2308,7 +2559,6 @@ msgstr "" "す。 :c:func:`PyType_HasFeature` マクロは型とフラグ値、 *tp* および *f* をと" "り、 ``tp->tp_flags & f`` が非ゼロかどうか調べます。" -#: ../../c-api/typeobj.rst:1138 msgid "" "This bit is set when the type object itself is allocated on the heap, for " "example, types created dynamically using :c:func:`PyType_FromSpec`. In this " @@ -2320,6 +2570,17 @@ msgid "" "`support garbage collection ` as they can form a " "reference cycle with their own module object." msgstr "" +"型オブジェクト自体がヒープに割り当てられた場合に設定されるビットです。\n" +"例えば :c:func:`PyType_FromSpec` で動的に作成された型が該当します。\n" +"この場合、インスタンスの :c:member:`~PyObject.ob_type` フィールドは型への参照" +"とみなされ、新しいインスタンスの作成時に型オブジェクトが INCREF され、インス" +"タンスの破棄時に DECREF されます。\n" +"これはサブタイプのインスタンスには適用されません。\n" +"INCREF や DECREF の対象になるのは、インスタンスの ``ob_type`` が参照する型だ" +"けです。\n" +"ヒープ型は自身のモジュールオブジェクトと循環参照を形成する可能性があるため、:" +"ref:`ガベージコレクションをサポート ` するべきで" +"す。" #: ../../c-api/typeobj.rst:1149 ../../c-api/typeobj.rst:1160 #: ../../c-api/typeobj.rst:1170 ../../c-api/typeobj.rst:1180 @@ -2353,7 +2614,6 @@ msgstr "" ":c:func:`PyType_Ready` による型オブジェクトの初期化処理中にセットされるビット" "です。" -#: ../../c-api/typeobj.rst:1185 msgid "" "This bit is set when the object supports garbage collection. If this bit is " "set, memory for new instances (see :c:member:`~PyTypeObject.tp_alloc`) must " @@ -2362,15 +2622,22 @@ msgid "" "tp_free`) using :c:func:`PyObject_GC_Del`. More information in section :ref:" "`supporting-cycle-detection`." msgstr "" +"オブジェクトがガベージコレクションをサポートする場合に設定されるビットで" +"す。\n" +"設定する場合、新しいインスタンスのメモリ (:c:member:`~PyTypeObject.tp_alloc` " +"を参照) は :c:macro:`PyObject_GC_New` または :c:func:`PyType_GenericAlloc` で" +"割り当て、\n" +":c:func:`PyObject_GC_Del` で解放しなければなりません (:c:member:" +"`~PyTypeObject.tp_free` を参照)。\n" +"詳細は :ref:`supporting-cycle-detection` を参照してください。" -#: ../../c-api/typeobj.rst:1194 ../../c-api/typeobj.rst:1541 -#: ../../c-api/typeobj.rst:1685 msgid "" "Group: :c:macro:`Py_TPFLAGS_HAVE_GC`, :c:member:`~PyTypeObject." "tp_traverse`, :c:member:`~PyTypeObject.tp_clear`" msgstr "" +"グループ: :c:macro:`Py_TPFLAGS_HAVE_GC`、:c:member:`~PyTypeObject." +"tp_traverse`、:c:member:`~PyTypeObject.tp_clear`" -#: ../../c-api/typeobj.rst:1196 msgid "" "The :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit is inherited together with the :c:" "member:`~PyTypeObject.tp_traverse` and :c:member:`~PyTypeObject.tp_clear` " @@ -2379,47 +2646,63 @@ msgid "" "`~PyTypeObject.tp_clear` fields in the subtype exist and have ``NULL`` " "values." msgstr "" +":c:macro:`Py_TPFLAGS_HAVE_GC` フラグビットは :c:member:`~PyTypeObject." +"tp_traverse` フィールドおよび :c:member:`~PyTypeObject.tp_clear` フィールドと" +"まとめて継承されます。\n" +"これは、サブタイプの :c:macro:`Py_TPFLAGS_HAVE_GC` フラグビットがクリアされて" +"おり、:c:member:`~PyTypeObject.tp_traverse` と :c:member:`~PyTypeObject." +"tp_clear` が存在して、どちらも ``NULL`` の場合です。" -#: ../../c-api/typeobj.rst:1206 msgid "" "This is a bitmask of all the bits that pertain to the existence of certain " "fields in the type object and its extension structures. Currently, it " "includes the following bits: :c:macro:`Py_TPFLAGS_HAVE_STACKLESS_EXTENSION`." msgstr "" +"型オブジェクトとその拡張構造体に特定のフィールドが存在するかどうかに関する、" +"すべてのビットをまとめたビットマスクです。\n" +"現在は :c:macro:`Py_TPFLAGS_HAVE_STACKLESS_EXTENSION` ビットを含みます。" -#: ../../c-api/typeobj.rst:1217 msgid "This bit indicates that objects behave like unbound methods." msgstr "" +"このビットは、オブジェクトが未束縛のメソッドとして動作することを示します。" -#: ../../c-api/typeobj.rst:1219 msgid "If this flag is set for ``type(meth)``, then:" msgstr "" +"``type(meth)`` にこのフラグが設定されている場合、次の条件を満たす必要がありま" +"す。" -#: ../../c-api/typeobj.rst:1221 msgid "" "``meth.__get__(obj, cls)(*args, **kwds)`` (with ``obj`` not None) must be " "equivalent to ``meth(obj, *args, **kwds)``." msgstr "" +"``meth.__get__(obj, cls)(*args, **kwds)`` (``obj`` が None でない場合) は " +"``meth(obj, *args, **kwds)`` と同等でなければなりません。" -#: ../../c-api/typeobj.rst:1224 msgid "" "``meth.__get__(None, cls)(*args, **kwds)`` must be equivalent to " "``meth(*args, **kwds)``." msgstr "" +"``meth.__get__(None, cls)(*args, **kwds)`` は ``meth(*args, **kwds)`` と同等" +"でなければなりません。" -#: ../../c-api/typeobj.rst:1227 msgid "" "This flag enables an optimization for typical method calls like ``obj." "meth()``: it avoids creating a temporary \"bound method\" object for ``obj." "meth``." msgstr "" +"このフラグは、``obj.meth()`` のような一般的なメソッド呼び出しで、``obj." +"meth`` の一時的な「束縛済みメソッド」オブジェクトを作成せずに済ませる最適化を" +"有効にします。" -#: ../../c-api/typeobj.rst:1235 msgid "" "This flag is never inherited by types without the :c:macro:" "`Py_TPFLAGS_IMMUTABLETYPE` flag set. For extension types, it is inherited " "whenever :c:member:`~PyTypeObject.tp_descr_get` is inherited." msgstr "" +"このフラグは、:c:macro:`Py_TPFLAGS_IMMUTABLETYPE` フラグが設定されていない型" +"には継承されません。\n" +"拡張型では、:c:member:`~PyTypeObject.tp_descr_get` が継承されるときに継承され" +"ます。" #: ../../c-api/typeobj.rst:1241 msgid "" @@ -2427,56 +2710,65 @@ msgid "" "attribute, and that the space for the dictionary is managed by the VM." msgstr "" -#: ../../c-api/typeobj.rst:1244 msgid "If this flag is set, :c:macro:`Py_TPFLAGS_HAVE_GC` should also be set." msgstr "" +"このフラグを設定する場合は、:c:macro:`Py_TPFLAGS_HAVE_GC` も設定するべきで" +"す。" -#: ../../c-api/typeobj.rst:1246 msgid "" "The type traverse function must call :c:func:`PyObject_VisitManagedDict` and " "its clear function must call :c:func:`PyObject_ClearManagedDict`." msgstr "" +"型の巡回関数は :c:func:`PyObject_VisitManagedDict` を、クリア関数は :c:func:" +"`PyObject_ClearManagedDict` を呼び出さなければなりません。" -#: ../../c-api/typeobj.rst:1253 msgid "" "This flag is inherited unless the :c:member:`~PyTypeObject.tp_dictoffset` " "field is set in a superclass." msgstr "" +"このフラグは、基底クラスに :c:member:`~PyTypeObject.tp_dictoffset` フィールド" +"が設定されていない限り継承されます。" -#: ../../c-api/typeobj.rst:1259 msgid "" "This bit indicates that instances of the class should be weakly " "referenceable." msgstr "" +"このビットは、クラスのインスタンスに弱参照を作成できるようにすることを示しま" +"す。" -#: ../../c-api/typeobj.rst:1266 msgid "" "This flag is inherited unless the :c:member:`~PyTypeObject." "tp_weaklistoffset` field is set in a superclass." msgstr "" +"このフラグは、基底クラスに :c:member:`~PyTypeObject.tp_weaklistoffset` フィー" +"ルドが設定されていない限り継承されます。" -#: ../../c-api/typeobj.rst:1272 msgid "" "Only usable with variable-size types, i.e. ones with non-zero :c:member:" "`~PyTypeObject.tp_itemsize`." msgstr "" +"可変サイズの型、つまり :c:member:`~PyTypeObject.tp_itemsize` がゼロでない型で" +"のみ使えます。" -#: ../../c-api/typeobj.rst:1275 msgid "" "Indicates that the variable-sized portion of an instance of this type is at " "the end of the instance's memory area, at an offset of ``Py_TYPE(obj)-" ">tp_basicsize`` (which may be different in each subclass)." msgstr "" +"この型のインスタンスの可変サイズ部分が、インスタンスのメモリ領域の末尾、オフ" +"セット ``Py_TYPE(obj)->tp_basicsize`` にあることを示します。\n" +"このオフセットはサブクラスごとに異なる場合があります。" -#: ../../c-api/typeobj.rst:1280 msgid "" "When setting this flag, be sure that all superclasses either use this memory " "layout, or are not variable-sized. Python does not check this." msgstr "" +"このフラグを設定する場合、すべての基底クラスがこのメモリレイアウトを使ってい" +"るか、可変サイズでないことを確認してください。\n" +"Python はこれを検証しません。" -#: ../../c-api/typeobj.rst:1288 msgid "This flag is inherited." -msgstr "" +msgstr "このフラグは継承されます。" #: ../../c-api/typeobj.rst:1302 msgid "" @@ -2503,139 +2795,172 @@ msgstr "" "型構造体に :c:member:`~PyTypeObject.tp_finalize` スロットが存在しているときに" "セットされるビットです。" -#: ../../c-api/typeobj.rst:1318 msgid "" "This flag isn't necessary anymore, as the interpreter assumes the :c:member:" "`~PyTypeObject.tp_finalize` slot is always present in the type structure." msgstr "" +"インタープリタは型構造体に :c:member:`~PyTypeObject.tp_finalize` スロットが常" +"に存在すると仮定するため、このフラグはもはや必要ありません。" -#: ../../c-api/typeobj.rst:1326 msgid "" "This bit is set when the class implements the :ref:`vectorcall protocol " "`. See :c:member:`~PyTypeObject.tp_vectorcall_offset` for " "details." msgstr "" +"クラスが :ref:`vectorcall プロトコル ` を実装する場合に設定される" +"ビットです。\n" +"詳細は :c:member:`~PyTypeObject.tp_vectorcall_offset` を参照してください。" -#: ../../c-api/typeobj.rst:1332 msgid "" "This bit is inherited if :c:member:`~PyTypeObject.tp_call` is also inherited." msgstr "" +"このビットは :c:member:`~PyTypeObject.tp_call` も継承される場合に継承されま" +"す。" -#: ../../c-api/typeobj.rst:1339 msgid "" "This flag is now removed from a class when the class's :py:meth:`~object." "__call__` method is reassigned." msgstr "" +"クラスの :py:meth:`~object.__call__` メソッドが再代入されると、このフラグがク" +"リアされるようになりました。" -#: ../../c-api/typeobj.rst:1342 msgid "This flag can now be inherited by mutable classes." -msgstr "" +msgstr "変更可能なクラスもこのフラグを継承できるようになりました。" -#: ../../c-api/typeobj.rst:1346 msgid "" "This bit is set for type objects that are immutable: type attributes cannot " "be set nor deleted." msgstr "" +"変更不能な型オブジェクトに設定されるビットです。\n" +"型の属性を設定したり削除したりできなくなります。" -#: ../../c-api/typeobj.rst:1348 msgid "" ":c:func:`PyType_Ready` automatically applies this flag to :ref:`static types " "`." msgstr "" +":c:func:`PyType_Ready` は :ref:`静的な型 ` にこのフラグを自動的" +"に設定します。" -#: ../../c-api/typeobj.rst:1353 msgid "This flag is not inherited." -msgstr "" +msgstr "このフラグは継承されません。" -#: ../../c-api/typeobj.rst:1359 msgid "" "Disallow creating instances of the type: set :c:member:`~PyTypeObject." "tp_new` to NULL and don't create the ``__new__`` key in the type dictionary." msgstr "" +"この型のインスタンスの作成を禁止します。\n" +":c:member:`~PyTypeObject.tp_new` を NULL に設定し、型の辞書に ``__new__`` " +"キーを作成しません。" -#: ../../c-api/typeobj.rst:1363 msgid "" "The flag must be set before creating the type, not after. For example, it " "must be set before :c:func:`PyType_Ready` is called on the type." msgstr "" +"このフラグは型の作成後ではなく、作成前に設定しなければなりません。\n" +"例えば、型に対して :c:func:`PyType_Ready` を呼び出す前に設定する必要がありま" +"す。" -#: ../../c-api/typeobj.rst:1366 msgid "" "The flag is set automatically on :ref:`static types ` if :c:" "member:`~PyTypeObject.tp_base` is NULL or ``&PyBaseObject_Type`` and :c:" "member:`~PyTypeObject.tp_new` is NULL." msgstr "" +":c:member:`~PyTypeObject.tp_base` が NULL または ``&PyBaseObject_Type`` で、:" +"c:member:`~PyTypeObject.tp_new` が NULL の :ref:`静的な型 ` に" +"は、このフラグが自動的に設定されます。" -#: ../../c-api/typeobj.rst:1372 msgid "" "This flag is not inherited. However, subclasses will not be instantiable " "unless they provide a non-NULL :c:member:`~PyTypeObject.tp_new` (which is " "only possible via the C API)." msgstr "" +"このフラグは継承されません。\n" +"ただし、サブクラスも NULL でない :c:member:`~PyTypeObject.tp_new` を提供しな" +"い限りインスタンス化できません (提供できるのは C API を使う場合だけです)。" -#: ../../c-api/typeobj.rst:1379 msgid "" "To disallow instantiating a class directly but allow instantiating its " "subclasses (e.g. for an :term:`abstract base class`), do not use this flag. " "Instead, make :c:member:`~PyTypeObject.tp_new` only succeed for subclasses." msgstr "" +"クラス自体のインスタンス化は禁止しても、サブクラスのインスタンス化は許可した" +"い場合 (例えば :term:`抽象基底クラス `)、このフラグを" +"使ってはいけません。\n" +"代わりに :c:member:`~PyTypeObject.tp_new` がサブクラスに対してのみ成功するよ" +"うにしてください。" -#: ../../c-api/typeobj.rst:1390 msgid "" "This bit indicates that instances of the class may match mapping patterns " "when used as the subject of a :keyword:`match` block. It is automatically " "set when registering or subclassing :class:`collections.abc.Mapping`, and " "unset when registering :class:`collections.abc.Sequence`." msgstr "" +"このビットは、クラスのインスタンスが :keyword:`match` ブロックの対象となる場" +"合に、マッピングパターンにマッチできることを示します。\n" +":class:`collections.abc.Mapping` に登録するか、そのサブクラスになると自動的に" +"設定され、:class:`collections.abc.Sequence` に登録するとクリアされます。" -#: ../../c-api/typeobj.rst:1397 ../../c-api/typeobj.rst:1419 msgid "" ":c:macro:`Py_TPFLAGS_MAPPING` and :c:macro:`Py_TPFLAGS_SEQUENCE` are " "mutually exclusive; it is an error to enable both flags simultaneously." msgstr "" +":c:macro:`Py_TPFLAGS_MAPPING` と :c:macro:`Py_TPFLAGS_SEQUENCE` は排他的で" +"す。\n" +"両方を同時に有効にするとエラーになります。" -#: ../../c-api/typeobj.rst:1402 msgid "" "This flag is inherited by types that do not already set :c:macro:" "`Py_TPFLAGS_SEQUENCE`." msgstr "" +"このフラグは、:c:macro:`Py_TPFLAGS_SEQUENCE` がまだ設定されていない型に継承さ" +"れます。" #: ../../c-api/typeobj.rst:1405 ../../c-api/typeobj.rst:1427 msgid ":pep:`634` -- Structural Pattern Matching: Specification" msgstr ":pep:`634` -- 構造的パターンマッチ: 仕様" -#: ../../c-api/typeobj.rst:1412 msgid "" "This bit indicates that instances of the class may match sequence patterns " "when used as the subject of a :keyword:`match` block. It is automatically " "set when registering or subclassing :class:`collections.abc.Sequence`, and " "unset when registering :class:`collections.abc.Mapping`." msgstr "" +"このビットは、クラスのインスタンスが :keyword:`match` ブロックの対象となる場" +"合に、シーケンスパターンにマッチできることを示します。\n" +":class:`collections.abc.Sequence` に登録するか、そのサブクラスになると自動的" +"に設定され、:class:`collections.abc.Mapping` に登録するとクリアされます。" -#: ../../c-api/typeobj.rst:1424 msgid "" "This flag is inherited by types that do not already set :c:macro:" "`Py_TPFLAGS_MAPPING`." msgstr "" +"このフラグは、:c:macro:`Py_TPFLAGS_MAPPING` がまだ設定されていない型に継承さ" +"れます。" -#: ../../c-api/typeobj.rst:1434 msgid "" "Internal. Do not set or unset this flag. To indicate that a class has " "changed call :c:func:`PyType_Modified`" msgstr "" +"内部使用専用です。\n" +"このフラグを設定したりクリアしたりしないでください。\n" +"クラスが変更されたことを示すには :c:func:`PyType_Modified` を呼び出してくださ" +"い。" -#: ../../c-api/typeobj.rst:1438 msgid "" "This flag is present in header files, but is not be used. It will be removed " "in a future version of CPython" msgstr "" +"このフラグはヘッダーファイルに存在しますが、使われていません。\n" +"将来の CPython バージョンで削除される予定です。" -#: ../../c-api/typeobj.rst:1444 msgid "" "An optional pointer to a NUL-terminated C string giving the docstring for " "this type object. This is exposed as the :attr:`~type.__doc__` attribute on " "the type and instances of the type." msgstr "" +"この型オブジェクトのドキュメント文字列を表す、NUL 終端の C 文字列への省略可能" +"なポインタです。\n" +"型とそのインスタンスの :attr:`~type.__doc__` 属性として公開されます。" #: ../../c-api/typeobj.rst:1450 msgid "This field is *not* inherited by subtypes." @@ -2694,24 +3019,22 @@ msgstr "" "に注目してください。 ``self->key`` メンバもありますが、それは ``NULL`` か " "Python文字列なので、循環参照の一部になることはありません。" -#: ../../c-api/typeobj.rst:1483 msgid "" "On the other hand, even if you know a member can never be part of a cycle, " "as a debugging aid you may want to visit it anyway just so the :mod:`gc` " "module's :func:`~gc.get_referents` function will include it." msgstr "" -"一方、メンバが循環参照の一部になり得ないと判っていても、デバッグ目的で巡回し" -"たい場合があるかもしれないので、 :mod:`gc` モジュールの :func:`~gc." -"get_referents` 関数は循環参照になり得ないメンバも返します。" +"一方、メンバーが循環参照の一部にならないと分かっていても、デバッグのために巡" +"回しておくと、:mod:`gc` モジュールの :func:`~gc.get_referents` 関数の結果にそ" +"のメンバーを含められます。" #: ../../c-api/typeobj.rst:1487 msgid "" "Heap types (:c:macro:`Py_TPFLAGS_HEAPTYPE`) must visit their type with::" msgstr "" -#: ../../c-api/typeobj.rst:1489 msgid "Py_VISIT(Py_TYPE(self));" -msgstr "" +msgstr "Py_VISIT(Py_TYPE(self));" #: ../../c-api/typeobj.rst:1491 msgid "" @@ -2726,12 +3049,14 @@ msgid "" "#endif" msgstr "" -#: ../../c-api/typeobj.rst:1498 msgid "" "If the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit is set in the :c:member:" "`~PyTypeObject.tp_flags` field, the traverse function must call :c:func:" "`PyObject_VisitManagedDict` like this::" msgstr "" +":c:member:`~PyTypeObject.tp_flags` フィールドに :c:macro:" +"`Py_TPFLAGS_MANAGED_DICT` ビットが設定されている場合、巡回関数は次のように :" +"c:func:`PyObject_VisitManagedDict` を呼び出す必要があります。 ::" #: ../../c-api/typeobj.rst:1502 msgid "PyObject_VisitManagedDict((PyObject*)self, visit, arg);" @@ -2766,44 +3091,55 @@ msgid "" "superclass). If they do not, the type object may not be garbage-collected." msgstr "" -#: ../../c-api/typeobj.rst:1529 msgid "" "The :c:member:`~PyTypeObject.tp_traverse` function can be called from any " "thread." msgstr "" +":c:member:`~PyTypeObject.tp_traverse` 関数は、どのスレッドからも呼び出される" +"可能性があります。" -#: ../../c-api/typeobj.rst:1534 msgid "" "Heap-allocated types are expected to visit ``Py_TYPE(self)`` in " "``tp_traverse``. In earlier versions of Python, due to `bug 40217 `_, doing this may lead to crashes in subclasses." msgstr "" +"ヒープに割り当てられた型は、``tp_traverse`` で ``Py_TYPE(self)`` を巡回するこ" +"とが期待されます。\n" +"以前のバージョンの Python では、`バグ 40217 `_ によって、この処理がサブクラスのクラッシュを引き起こす場合があ" +"ります。" -#: ../../c-api/typeobj.rst:1543 msgid "" "This field is inherited by subtypes together with :c:member:`~PyTypeObject." "tp_clear` and the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit: the flag bit, :c:" "member:`~PyTypeObject.tp_traverse`, and :c:member:`~PyTypeObject.tp_clear` " "are all inherited from the base type if they are all zero in the subtype." msgstr "" +"このフィールドは、:c:member:`~PyTypeObject.tp_clear` および :c:macro:" +"`Py_TPFLAGS_HAVE_GC` フラグビットとまとめてサブタイプに継承されます。\n" +"サブタイプでフラグビット、:c:member:`~PyTypeObject.tp_traverse`、:c:member:" +"`~PyTypeObject.tp_clear` がすべてゼロの場合に、これらすべてを基底型から継承し" +"ます。" -#: ../../c-api/typeobj.rst:1551 msgid "An optional pointer to a clear function. The signature is::" msgstr "" +"クリア関数への省略可能なポインタです。\n" +"シグネチャは次のとおりです。 ::" -#: ../../c-api/typeobj.rst:1553 msgid "int tp_clear(PyObject *);" -msgstr "" +msgstr "int tp_clear(PyObject *);" -#: ../../c-api/typeobj.rst:1555 msgid "" "The purpose of this function is to break reference cycles that are causing " "a :term:`cyclic isolate` so that the objects can be safely destroyed. A " "cleared object is a partially destroyed object; the object is not obligated " "to satisfy design invariants held during normal use." msgstr "" +"この関数の目的は、:term:`孤立した循環参照群 ` を生じさせてい" +"る循環参照を解消し、オブジェクトを安全に破棄できるようにすることです。\n" +"クリア済みのオブジェクトは部分的に破棄されており、通常の使用時に保たれる設計" +"上の不変条件を満たす義務はありません。" -#: ../../c-api/typeobj.rst:1560 msgid "" ":c:member:`!tp_clear` does not need to delete references to objects that " "can't participate in reference cycles, such as Python strings or Python " @@ -2813,45 +3149,59 @@ msgid "" "might have already been called. Prefer calling idempotent functions like :c:" "func:`Py_CLEAR`.)" msgstr "" +":c:member:`!tp_clear` は、Python の文字列や整数など、循環参照に関与できないオ" +"ブジェクトへの参照を削除する必要はありません。\n" +"ただし、すべての参照をクリアし、型の :c:member:`~PyTypeObject.tp_dealloc` 関" +"数から :c:member:`!tp_clear` を呼ぶようにすると、コードの重複を避けられて便利" +"な場合があります。\n" +":c:member:`!tp_clear` がすでに呼び出されている可能性に注意し、:c:func:" +"`Py_CLEAR` のような冪等な関数を使うことを推奨します。" -#: ../../c-api/typeobj.rst:1568 msgid "" "Any non-trivial cleanup should be performed in :c:member:`~PyTypeObject." "tp_finalize` instead of :c:member:`!tp_clear`." msgstr "" +"複雑な後片付けは :c:member:`!tp_clear` ではなく :c:member:`~PyTypeObject." +"tp_finalize` で行うべきです。" -#: ../../c-api/typeobj.rst:1573 msgid "" "If :c:member:`!tp_clear` fails to break a reference cycle then the objects " "in the :term:`cyclic isolate` may remain indefinitely uncollectable " "(\"leak\"). See :data:`gc.garbage`." msgstr "" +":c:member:`!tp_clear` が循環参照を解消できないと、:term:`孤立した循環参照群 " +"` のオブジェクトがいつまでも回収できずに残る (「リーク」す" +"る) 可能性があります。\n" +":data:`gc.garbage` を参照してください。" -#: ../../c-api/typeobj.rst:1579 msgid "" "Referents (direct and indirect) might have already been cleared; they are " "not guaranteed to be in a consistent state." msgstr "" +"直接または間接の参照先は、すでにクリアされている可能性があります。\n" +"整合性のある状態であるとは限りません。" -#: ../../c-api/typeobj.rst:1584 msgid "" "The :c:member:`~PyTypeObject.tp_clear` function can be called from any " "thread." msgstr "" +":c:member:`~PyTypeObject.tp_clear` 関数は、どのスレッドからも呼び出される可能" +"性があります。" -#: ../../c-api/typeobj.rst:1589 msgid "" "An object is not guaranteed to be automatically cleared before its " "destructor (:c:member:`~PyTypeObject.tp_dealloc`) is called." msgstr "" +"デストラクタ (:c:member:`~PyTypeObject.tp_dealloc`) が呼び出される前に、オブ" +"ジェクトが自動的にクリアされるとは限りません。" -#: ../../c-api/typeobj.rst:1592 msgid "" "This function differs from the destructor (:c:member:`~PyTypeObject." "tp_dealloc`) in the following ways:" msgstr "" +"この関数はデストラクタ (:c:member:`~PyTypeObject.tp_dealloc`) と次の点が異な" +"ります。" -#: ../../c-api/typeobj.rst:1595 msgid "" "The purpose of clearing an object is to remove references to other objects " "that might participate in a reference cycle. The purpose of the destructor, " @@ -2860,8 +3210,14 @@ msgid "" "(e.g., integers) as well as the object's own memory (by calling :c:member:" "`~PyTypeObject.tp_free`)." msgstr "" +"オブジェクトのクリアの目的は、循環参照に関与する可能性のある他のオブジェクト" +"への参照を取り除くことです。\n" +"一方、デストラクタの目的はさらに広く、所有する *すべて* のリソースを解放しな" +"ければなりません。\n" +"循環参照に関与できないオブジェクト (例えば整数) への参照も、オブジェクト自体" +"のメモリ (:c:member:`~PyTypeObject.tp_free` を呼び出して解放します) も含みま" +"す。" -#: ../../c-api/typeobj.rst:1601 msgid "" "When :c:member:`!tp_clear` is called, other objects might still hold " "references to the object being cleared. Because of this, :c:member:`!" @@ -2870,65 +3226,89 @@ msgid "" "when no (strong) references exist, and as such, must safely destroy the " "object itself by deallocating it." msgstr "" +":c:member:`!tp_clear` の呼び出し時には、他のオブジェクトがクリア対象のオブ" +"ジェクトへの参照をまだ保持している可能性があります。\n" +"このため :c:member:`!tp_clear` は、オブジェクト自体のメモリを解放 (:c:member:" +"`~PyTypeObject.tp_free`) してはいけません。\n" +"一方、デストラクタは強参照がなくなってから呼び出されるので、メモリを解放して" +"オブジェクト自体を安全に破棄しなければなりません。" -#: ../../c-api/typeobj.rst:1607 msgid "" ":c:member:`!tp_clear` might never be automatically called. An object's " "destructor, on the other hand, will be automatically called some time after " "the object becomes unreachable (i.e., either there are no references to the " "object or the object is a member of a :term:`cyclic isolate`)." msgstr "" +":c:member:`!tp_clear` は、自動では一度も呼び出されない場合があります。\n" +"一方、デストラクタは、オブジェクトが到達不能になってからいずれかの時点で自動" +"的に呼び出されます。\n" +"到達不能とは、参照がないか、:term:`孤立した循環参照群 ` の一" +"部である状態です。" -#: ../../c-api/typeobj.rst:1612 msgid "" "No guarantees are made about when, if, or how often Python automatically " "clears an object, except:" msgstr "" +"Python がオブジェクトを自動的にクリアするかどうか、いつ行うか、何回行うかにつ" +"いては、次の事項を除いて保証はありません。" -#: ../../c-api/typeobj.rst:1615 msgid "" "Python will not automatically clear an object if it is reachable, i.e., " "there is a reference to it and it is not a member of a :term:`cyclic " "isolate`." msgstr "" +"Python は到達可能なオブジェクトを自動的にクリアしません。\n" +"つまり、参照があり、:term:`孤立した循環参照群 ` の一部ではな" +"いオブジェクトは対象になりません。" -#: ../../c-api/typeobj.rst:1618 msgid "" "Python will not automatically clear an object if it has not been " "automatically finalized (see :c:member:`~PyTypeObject.tp_finalize`). (If " "the finalizer resurrected the object, the object may or may not be " "automatically finalized again before it is cleared.)" msgstr "" +"Python は、自動的にファイナライズされていないオブジェクトを自動的にクリアしま" +"せん (:c:member:`~PyTypeObject.tp_finalize` を参照)。\n" +"ファイナライザがオブジェクトを復活させた場合、クリアされる前に再び自動的に" +"ファイナライズされるかどうかは決まっていません。" -#: ../../c-api/typeobj.rst:1622 msgid "" "If an object is a member of a :term:`cyclic isolate`, Python will not " "automatically clear it if any member of the cyclic isolate has not yet been " "automatically finalized (:c:member:`~PyTypeObject.tp_finalize`)." msgstr "" +":term:`孤立した循環参照群 ` のいずれかのオブジェクトがまだ自" +"動的にファイナライズ (:c:member:`~PyTypeObject.tp_finalize`) されていない場" +"合、Python はその群のオブジェクトを自動的にクリアしません。" -#: ../../c-api/typeobj.rst:1625 msgid "" "Python will not destroy an object until after any automatic calls to its :c:" "member:`!tp_clear` function have returned. This ensures that the act of " "breaking a reference cycle does not invalidate the ``self`` pointer while :c:" "member:`!tp_clear` is still executing." msgstr "" +"Python は、オブジェクトの :c:member:`!tp_clear` 関数への自動的な呼び出しがす" +"べて戻るまで、そのオブジェクトを破棄しません。\n" +"これにより、循環参照の解消によって :c:member:`!tp_clear` の実行中に ``self`` " +"ポインタが無効になることを防ぎます。" -#: ../../c-api/typeobj.rst:1629 msgid "" "Python will not automatically call :c:member:`!tp_clear` multiple times " "concurrently." msgstr "" +"Python は :c:member:`!tp_clear` を自動的に複数回、並行して呼び出すことはあり" +"ません。" -#: ../../c-api/typeobj.rst:1632 msgid "" "CPython currently only automatically clears objects as needed to break " "reference cycles in a :term:`cyclic isolate`, but future versions might " "clear objects regularly before their destruction." msgstr "" +"現在の CPython は、:term:`孤立した循環参照群 ` の循環参照の解" +"消に必要な場合にだけ、オブジェクトを自動的にクリアします。\n" +"将来のバージョンでは、破棄前に通常の処理としてクリアするようになるかもしれま" +"せん。" -#: ../../c-api/typeobj.rst:1636 msgid "" "Taken together, all :c:member:`~PyTypeObject.tp_clear` functions in the " "system must combine to break all reference cycles. This is subtle, and if " @@ -2940,6 +3320,16 @@ msgid "" "containing a tuple. This isn't immediately obvious, and there's rarely a " "good reason to avoid implementing :c:member:`~PyTypeObject.tp_clear`." msgstr "" +"システム内のすべての :c:member:`~PyTypeObject.tp_clear` 関数は、全体としてす" +"べての循環参照を解消できなければなりません。\n" +"これは微妙な問題なので、少しでも疑わしければ :c:member:`~PyTypeObject." +"tp_clear` 関数を用意してください。\n" +"例えばタプルだけで循環参照を構成することは不可能だと証明できるため、タプル型" +"には :c:member:`~PyTypeObject.tp_clear` 関数がありません。\n" +"したがって、タプルを含む循環参照の解消は、他の型の :c:member:`~PyTypeObject." +"tp_clear` 関数が担います。\n" +"これはすぐには分からないことですし、:c:member:`~PyTypeObject.tp_clear` を実装" +"しない方がよい理由はほとんどありません。" #: ../../c-api/typeobj.rst:1647 msgid "" @@ -2952,7 +3342,6 @@ msgstr "" "スから Python オブジェクトだと思われるメンバへの参照を外し、それらのメンバへ" "のポインタに ``NULL`` をセットすべきです::" -#: ../../c-api/typeobj.rst:1651 msgid "" "static int\n" "local_clear(PyObject *op)\n" @@ -2965,8 +3354,17 @@ msgid "" " return 0;\n" "}" msgstr "" +"static int\n" +"local_clear(PyObject *op)\n" +"{\n" +" localobject *self = (localobject *) op;\n" +" Py_CLEAR(self->key);\n" +" Py_CLEAR(self->args);\n" +" Py_CLEAR(self->kw);\n" +" Py_CLEAR(self->dict);\n" +" return 0;\n" +"}" -#: ../../c-api/typeobj.rst:1662 msgid "" "The :c:func:`Py_CLEAR` macro should be used, because clearing references is " "delicate: the reference to the contained object must not be released (via :" @@ -2980,6 +3378,17 @@ msgid "" "contained object can no longer be used. The :c:func:`Py_CLEAR` macro " "performs the operations in a safe order." msgstr "" +"参照のクリアは慎重に行う必要があるため、:c:func:`Py_CLEAR` マクロを使うべきで" +"す。\n" +"保持するオブジェクトへのポインタを ``NULL`` に設定するまでは、その参照を :c:" +"func:`Py_DECREF` で解放してはいけません。\n" +"参照を解放すると、参照先が不要になって一連の回収処理が始まり、そのオブジェク" +"トに関連するファイナライザや弱参照コールバックによって任意の Python コードが" +"実行される可能性があるためです。\n" +"そのコードが再び *self* を参照する可能性があるなら、その時点で参照先へのポイ" +"ンタが ``NULL`` になっていることが重要です。\n" +"そうすることで *self* は、その参照先をもう使えないと判断できます。\n" +":c:func:`Py_CLEAR` マクロは、安全な順序でこれらの操作を行います。" #: ../../c-api/typeobj.rst:1674 msgid "" @@ -2988,17 +3397,20 @@ msgid "" "`PyObject_ClearManagedDict` like this::" msgstr "" -#: ../../c-api/typeobj.rst:1678 msgid "PyObject_ClearManagedDict((PyObject*)self);" -msgstr "" +msgstr "PyObject_ClearManagedDict((PyObject*)self);" -#: ../../c-api/typeobj.rst:1687 msgid "" "This field is inherited by subtypes together with :c:member:`~PyTypeObject." "tp_traverse` and the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit: the flag bit, :" "c:member:`~PyTypeObject.tp_traverse`, and :c:member:`~PyTypeObject.tp_clear` " "are all inherited from the base type if they are all zero in the subtype." msgstr "" +"このフィールドは、:c:member:`~PyTypeObject.tp_traverse` および :c:macro:" +"`Py_TPFLAGS_HAVE_GC` フラグビットとまとめてサブタイプに継承されます。\n" +"サブタイプでフラグビット、:c:member:`~PyTypeObject.tp_traverse`、:c:member:" +"`~PyTypeObject.tp_clear` がすべてゼロの場合に、これらすべてを基底型から継承し" +"ます。" #: ../../c-api/typeobj.rst:1699 msgid "" @@ -3006,15 +3418,15 @@ msgid "" msgstr "" "オプションのポインタで、拡張比較関数を指します。シグネチャは次の通りです::" -#: ../../c-api/typeobj.rst:1701 msgid "PyObject *tp_richcompare(PyObject *self, PyObject *other, int op);" -msgstr "" +msgstr "PyObject *tp_richcompare(PyObject *self, PyObject *other, int op);" -#: ../../c-api/typeobj.rst:1703 msgid "" "The first parameter is guaranteed to be an instance of the type that is " "defined by :c:type:`PyTypeObject`." msgstr "" +"第 1 引数は、その :c:type:`PyTypeObject` が定義する型のインスタンスであること" +"が保証されます。" #: ../../c-api/typeobj.rst:1706 msgid "" @@ -3087,9 +3499,8 @@ msgstr "" "ばこれらは C言語の整数か浮動小数点数になるでしょう)。三番目の引数には :c:" "func:`PyObject_RichCompare` と同様に要求された演算を指定します。" -#: ../../c-api/typeobj.rst:1742 msgid "The returned value is a new :term:`strong reference`." -msgstr "" +msgstr "戻り値は新しい :term:`強参照 ` です。" #: ../../c-api/typeobj.rst:1744 msgid "On error, sets an exception and returns ``NULL`` from the function." @@ -3117,11 +3528,12 @@ msgid "" "comparisons." msgstr "" -#: ../../c-api/typeobj.rst:1768 msgid "" "While this field is still supported, :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` " "should be used instead, if at all possible." msgstr "" +"このフィールドは引き続きサポートされていますが、可能であれば代わりに :c:" +"macro:`Py_TPFLAGS_MANAGED_WEAKREF` を使うべきです。" #: ../../c-api/typeobj.rst:1771 msgid "" @@ -3147,11 +3559,12 @@ msgstr "" "このフィールドを :c:member:`~PyTypeObject.tp_weaklist` と混同しないようにして" "ください; これは型オブジェクト自身への弱参照からなるリストの先頭です。" -#: ../../c-api/typeobj.rst:1781 msgid "" "It is an error to set both the :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` bit " "and :c:member:`~PyTypeObject.tp_weaklistoffset`." msgstr "" +":c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` ビットと :c:member:`~PyTypeObject." +"tp_weaklistoffset` の両方を設定するとエラーになります。" #: ../../c-api/typeobj.rst:1786 msgid "" @@ -3167,13 +3580,16 @@ msgstr "" "に :c:member:`~PyTypeObject.tp_weaklistoffset` で分かるはずなので、このことは" "問題にはならないはずです。" -#: ../../c-api/typeobj.rst:1793 msgid "" "If the :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` bit is set in the :c:member:" "`~PyTypeObject.tp_flags` field, then :c:member:`~PyTypeObject." "tp_weaklistoffset` will be set to a negative value, to indicate that it is " "unsafe to use this field." msgstr "" +":c:member:`~PyTypeObject.tp_flags` フィールドに :c:macro:" +"`Py_TPFLAGS_MANAGED_WEAKREF` ビットが設定されている場合、:c:member:" +"`~PyTypeObject.tp_weaklistoffset` は負の値に設定され、このフィールドの使用が" +"安全でないことを示します。" #: ../../c-api/typeobj.rst:1801 msgid "" @@ -3190,9 +3606,8 @@ msgstr "" msgid "This function has the same signature as :c:func:`PyObject_GetIter`::" msgstr "この関数は :c:func:`PyObject_GetIter` と同じシグネチャを持っています::" -#: ../../c-api/typeobj.rst:1807 msgid "PyObject *tp_iter(PyObject *self);" -msgstr "" +msgstr "PyObject *tp_iter(PyObject *self);" #: ../../c-api/typeobj.rst:1816 msgid "" @@ -3202,9 +3617,8 @@ msgstr "" "オプションのポインタで、:term:`イテレーター ` の次の要素を返す関数" "を指します。シグネチャは次の通りです::" -#: ../../c-api/typeobj.rst:1819 msgid "PyObject *tp_iternext(PyObject *self);" -msgstr "" +msgstr "PyObject *tp_iternext(PyObject *self);" #: ../../c-api/typeobj.rst:1821 msgid "" @@ -3321,13 +3735,16 @@ msgstr "" "います; 多重継承はメタタイプの呼び出しによる動的な型オブジェクトの生成を必要" "とします。" -#: ../../c-api/typeobj.rst:1890 msgid "" "Slot initialization is subject to the rules of initializing globals. C99 " "requires the initializers to be \"address constants\". Function designators " "like :c:func:`PyType_GenericNew`, with implicit conversion to a pointer, are " "valid C99 address constants." msgstr "" +"スロットの初期化には、グローバル変数の初期化の規則が適用されます。\n" +"C99 では、初期化子は「アドレス定数」である必要があります。\n" +":c:func:`PyType_GenericNew` などの関数指示子は、暗黙にポインタへ変換され、有" +"効な C99 のアドレス定数になります。" #: ../../c-api/typeobj.rst:1895 msgid "" @@ -3337,11 +3754,12 @@ msgid "" "strictly standard conforming in this particular behavior." msgstr "" -#: ../../c-api/typeobj.rst:1901 msgid "" "Consequently, :c:member:`~PyTypeObject.tp_base` should be set in the " "extension module's init function." msgstr "" +"したがって、:c:member:`~PyTypeObject.tp_base` は拡張モジュールの初期化関数内" +"で設定するべきです。" #: ../../c-api/typeobj.rst:1906 msgid "This field is not inherited by subtypes (obviously)." @@ -3360,7 +3778,6 @@ msgid "The type's dictionary is stored here by :c:func:`PyType_Ready`." msgstr "" "型の辞書は :c:func:`PyType_Ready` によってこのフィールドに収められます。" -#: ../../c-api/typeobj.rst:1918 msgid "" "This field should normally be initialized to ``NULL`` before PyType_Ready is " "called; it may also be initialized to a dictionary containing initial " @@ -3370,19 +3787,27 @@ msgid "" "__add__`). Once initialization for the type has finished, this field should " "be treated as read-only." msgstr "" +"通常、このフィールドは ``PyType_Ready`` を呼び出す前に ``NULL`` に初期化する" +"べきですが、型の初期属性を含む辞書で初期化することもできます。\n" +":c:func:`PyType_Ready` が型を初期化した後は、:meth:`~object.__add__` のような" +"オーバーロードされる演算に対応しない属性だけを、この辞書に追加できます。\n" +"型の初期化が完了した後は、このフィールドを読み取り専用として扱うべきです。" -#: ../../c-api/typeobj.rst:1926 msgid "" "Some types may not store their dictionary in this slot. Use :c:func:" "`PyType_GetDict` to retrieve the dictionary for an arbitrary type." msgstr "" +"このスロットに辞書を格納しない型もあります。\n" +"任意の型の辞書を取得するには :c:func:`PyType_GetDict` を使ってください。" -#: ../../c-api/typeobj.rst:1932 msgid "" "Internals detail: For static builtin types, this is always ``NULL``. " "Instead, the dict for such types is stored on ``PyInterpreterState``. Use :c:" "func:`PyType_GetDict` to get the dict for an arbitrary type." msgstr "" +"実装詳細: 静的な組み込み型では常に ``NULL`` です。\n" +"代わりに、これらの型の辞書は ``PyInterpreterState`` に格納されます。\n" +"任意の型の辞書を取得するには :c:func:`PyType_GetDict` を使ってください。" #: ../../c-api/typeobj.rst:1938 msgid "" @@ -3392,11 +3817,12 @@ msgstr "" "サブタイプはこのフィールドを継承しません (が、この辞書内で定義されている属性" "は異なるメカニズムで継承されます)。" -#: ../../c-api/typeobj.rst:1943 msgid "" "If this field is ``NULL``, :c:func:`PyType_Ready` will assign a new " "dictionary to it." msgstr "" +"このフィールドが ``NULL`` の場合、:c:func:`PyType_Ready` が新しい辞書を割り当" +"てます。" #: ../../c-api/typeobj.rst:1948 msgid "" @@ -3416,9 +3842,9 @@ msgstr "オプションのポインタで、デスクリプタの get 関数を msgid "The function signature is::" msgstr "関数のシグネチャは次のとおりです ::" -#: ../../c-api/typeobj.rst:1958 msgid "PyObject * tp_descr_get(PyObject *self, PyObject *obj, PyObject *type);" msgstr "" +"PyObject * tp_descr_get(PyObject *self, PyObject *obj, PyObject *type);" #: ../../c-api/typeobj.rst:1969 msgid "" @@ -3427,19 +3853,19 @@ msgid "" msgstr "" "オプションのポインタで、デスクリプタの値の設定と削除を行う関数を指します。" -#: ../../c-api/typeobj.rst:1974 msgid "int tp_descr_set(PyObject *self, PyObject *obj, PyObject *value);" -msgstr "" +msgstr "int tp_descr_set(PyObject *self, PyObject *obj, PyObject *value);" #: ../../c-api/typeobj.rst:1976 msgid "The *value* argument is set to ``NULL`` to delete the value." msgstr "値を削除するには、*value* 引数に ``NULL`` を設定します。" -#: ../../c-api/typeobj.rst:1987 msgid "" "While this field is still supported, :c:macro:`Py_TPFLAGS_MANAGED_DICT` " "should be used instead, if at all possible." msgstr "" +"このフィールドは引き続きサポートされていますが、可能であれば代わりに :c:" +"macro:`Py_TPFLAGS_MANAGED_DICT` を使うべきです。" #: ../../c-api/typeobj.rst:1990 msgid "" @@ -3461,13 +3887,11 @@ msgstr "" "このフィールドを :c:member:`~PyTypeObject.tp_dict` と混同しないようにしてくだ" "さい; これは型オブジェクト自身の属性の辞書です。" -#: ../../c-api/typeobj.rst:1998 msgid "" "The value specifies the offset of the dictionary from the start of the " "instance structure." -msgstr "" +msgstr "この値は、インスタンス構造体の先頭からの辞書のオフセットを指定します。" -#: ../../c-api/typeobj.rst:2000 msgid "" "The :c:member:`~PyTypeObject.tp_dictoffset` should be regarded as write-" "only. To get the pointer to the dictionary call :c:func:" @@ -3475,57 +3899,78 @@ msgid "" "need to allocate memory for the dictionary, so it is may be more efficient " "to call :c:func:`PyObject_GetAttr` when accessing an attribute on the object." msgstr "" +":c:member:`~PyTypeObject.tp_dictoffset` は書き込み専用として扱うべきです。\n" +"辞書へのポインタを取得するには :c:func:`PyObject_GenericGetDict` を呼び出して" +"ください。\n" +":c:func:`PyObject_GenericGetDict` は辞書用のメモリを割り当てる必要がある場合" +"があるため、オブジェクトの属性にアクセスするなら :c:func:`PyObject_GetAttr` " +"の方が効率的なことがあります。" -#: ../../c-api/typeobj.rst:2006 msgid "" "It is an error to set both the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit and :c:" "member:`~PyTypeObject.tp_dictoffset`." msgstr "" +":c:macro:`Py_TPFLAGS_MANAGED_DICT` ビットと :c:member:`~PyTypeObject." +"tp_dictoffset` の両方を設定するとエラーになります。" -#: ../../c-api/typeobj.rst:2011 msgid "" "This field is inherited by subtypes. A subtype should not override this " "offset; doing so could be unsafe, if C code tries to access the dictionary " "at the previous offset. To properly support inheritance, use :c:macro:" "`Py_TPFLAGS_MANAGED_DICT`." msgstr "" +"このフィールドはサブタイプに継承されます。\n" +"サブタイプでこのオフセットをオーバーライドするべきではありません。\n" +"C コードが以前のオフセットで辞書にアクセスすると、安全でない可能性がありま" +"す。\n" +"継承を適切にサポートするには :c:macro:`Py_TPFLAGS_MANAGED_DICT` を使ってくだ" +"さい。" -#: ../../c-api/typeobj.rst:2018 msgid "" "This slot has no default. For :ref:`static types `, if the " "field is ``NULL`` then no :attr:`~object.__dict__` gets created for " "instances." msgstr "" +"このスロットにはデフォルト値がありません。\n" +":ref:`静的な型 ` でこのフィールドが ``NULL`` の場合、インスタン" +"スに :attr:`~object.__dict__` は作成されません。" -#: ../../c-api/typeobj.rst:2021 msgid "" "If the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit is set in the :c:member:" "`~PyTypeObject.tp_flags` field, then :c:member:`~PyTypeObject.tp_dictoffset` " "will be set to ``-1``, to indicate that it is unsafe to use this field." msgstr "" +":c:member:`~PyTypeObject.tp_flags` フィールドに :c:macro:" +"`Py_TPFLAGS_MANAGED_DICT` ビットが設定されている場合、:c:member:" +"`~PyTypeObject.tp_dictoffset` は ``-1`` に設定され、このフィールドの使用が安" +"全でないことを示します。" #: ../../c-api/typeobj.rst:2029 msgid "An optional pointer to an instance initialization function." msgstr "オプションのポインタで、インスタンス初期化関数を指します。" -#: ../../c-api/typeobj.rst:2031 msgid "" "This function corresponds to the :meth:`~object.__init__` method of " "classes. Like :meth:`!__init__`, it is possible to create an instance " "without calling :meth:`!__init__`, and it is possible to reinitialize an " "instance by calling its :meth:`!__init__` method again." msgstr "" +"この関数はクラスの :meth:`~object.__init__` メソッドに対応します。\n" +":meth:`!__init__` と同様に、:meth:`!__init__` を呼び出さずにインスタンスを作" +"成することも、:meth:`!__init__` メソッドを再び呼び出してインスタンスを再初期" +"化することもできます。" -#: ../../c-api/typeobj.rst:2038 msgid "int tp_init(PyObject *self, PyObject *args, PyObject *kwds);" -msgstr "" +msgstr "int tp_init(PyObject *self, PyObject *args, PyObject *kwds);" -#: ../../c-api/typeobj.rst:2040 msgid "" "The self argument is the instance to be initialized; the *args* and *kwds* " "arguments represent positional and keyword arguments of the call to :meth:" "`~object.__init__`." msgstr "" +"``self`` 引数は初期化するインスタンスです。\n" +"*args* と *kwds* は :meth:`~object.__init__` の呼び出しの位置引数とキーワード" +"引数を表します。" #: ../../c-api/typeobj.rst:2044 msgid "" @@ -3551,46 +3996,46 @@ msgid "Returns ``0`` on success, ``-1`` and sets an exception on error." msgstr "" "成功のときには ``0`` を、エラー時には例外をセットして ``-1`` を返します。" -#: ../../c-api/typeobj.rst:2059 msgid "" "For :ref:`static types ` this field does not have a default." msgstr "" +":ref:`静的な型 ` では、このフィールドにデフォルト値はありませ" +"ん。" #: ../../c-api/typeobj.rst:2064 msgid "An optional pointer to an instance allocation function." msgstr "オプションのポインタで、インスタンスのメモリ確保関数を指します。" -#: ../../c-api/typeobj.rst:2068 msgid "PyObject *tp_alloc(PyTypeObject *self, Py_ssize_t nitems);" -msgstr "" +msgstr "PyObject *tp_alloc(PyTypeObject *self, Py_ssize_t nitems);" -#: ../../c-api/typeobj.rst:2072 msgid "" "Static subtypes inherit this slot, which will be :c:func:" "`PyType_GenericAlloc` if inherited from :class:`object`." msgstr "" +"静的なサブタイプはこのスロットを継承します。\n" +":class:`object` から継承した場合は :c:func:`PyType_GenericAlloc` になります。" -#: ../../c-api/typeobj.rst:2075 ../../c-api/typeobj.rst:2142 msgid ":ref:`Heap subtypes ` do not inherit this slot." -msgstr "" +msgstr ":ref:`ヒープのサブタイプ ` はこのスロットを継承しません。" -#: ../../c-api/typeobj.rst:2079 msgid "" "For heap subtypes, this field is always set to :c:func:`PyType_GenericAlloc`." msgstr "" +"ヒープのサブタイプでは、このフィールドは常に :c:func:`PyType_GenericAlloc` に" +"設定されます。" -#: ../../c-api/typeobj.rst:2082 ../../c-api/typeobj.rst:2150 msgid "For static subtypes, this slot is inherited (see above)." -msgstr "" +msgstr "静的なサブタイプでは、このスロットは継承されます (前述)。" #: ../../c-api/typeobj.rst:2087 msgid "An optional pointer to an instance creation function." msgstr "オプションのポインタで、インスタンス生成関数を指します。" -#: ../../c-api/typeobj.rst:2091 msgid "" "PyObject *tp_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds);" msgstr "" +"PyObject *tp_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds);" #: ../../c-api/typeobj.rst:2093 msgid "" @@ -3624,11 +4069,12 @@ msgstr "" "tp_new` で行い、一方、変更可能な型ではほとんどの初期化を :c:member:" "`~PyTypeObject.tp_init` に回すべきです。" -#: ../../c-api/typeobj.rst:2107 msgid "" "Set the :c:macro:`Py_TPFLAGS_DISALLOW_INSTANTIATION` flag to disallow " "creating instances of the type in Python." msgstr "" +"Python からこの型のインスタンスを作成することを禁止するには、:c:macro:" +"`Py_TPFLAGS_DISALLOW_INSTANTIATION` フラグを設定してください。" #: ../../c-api/typeobj.rst:2112 msgid "" @@ -3640,13 +4086,18 @@ msgstr "" "`~PyTypeObject.tp_base` が ``NULL`` か ``&PyBaseObject_Type`` になっている :" "ref:`静的な型 ` では継承しません。" -#: ../../c-api/typeobj.rst:2118 msgid "" "For :ref:`static types ` this field has no default. This means " "if the slot is defined as ``NULL``, the type cannot be called to create new " "instances; presumably there is some other way to create instances, like a " "factory function." msgstr "" +":ref:`静的な型 ` では、このフィールドにデフォルト値はありませ" +"ん。\n" +"スロットを ``NULL`` と定義すると、型を呼び出して新しいインスタンスを作成でき" +"なくなります。\n" +"その場合は、ファクトリ関数など別の方法でインスタンスを作成することになりま" +"す。" #: ../../c-api/typeobj.rst:2126 msgid "" @@ -3655,17 +4106,16 @@ msgstr "" "オプションのポインタで、インスタンスのメモリ解放関数を指します。シグネチャは" "以下の通りです::" -#: ../../c-api/typeobj.rst:2128 msgid "void tp_free(void *self);" -msgstr "" +msgstr "void tp_free(void *self);" -#: ../../c-api/typeobj.rst:2130 msgid "" "This function must free the memory allocated by :c:member:`~PyTypeObject." "tp_alloc`." msgstr "" +"この関数は :c:member:`~PyTypeObject.tp_alloc` が割り当てたメモリを解放しなけ" +"ればなりません。" -#: ../../c-api/typeobj.rst:2135 msgid "" "Static subtypes inherit this slot, which will be :c:func:`PyObject_Free` if " "inherited from :class:`object`. Exception: If the type supports garbage " @@ -3673,20 +4123,28 @@ msgid "" "`~PyTypeObject.tp_flags`) and it would inherit :c:func:`PyObject_Free`, then " "this slot is not inherited but instead defaults to :c:func:`PyObject_GC_Del`." msgstr "" +"静的なサブタイプはこのスロットを継承します。\n" +":class:`object` から継承した場合は :c:func:`PyObject_Free` になります。\n" +"ただし、型がガベージコレクションをサポートする (:c:member:`~PyTypeObject." +"tp_flags` に :c:macro:`Py_TPFLAGS_HAVE_GC` フラグが設定されている) 場合は例外" +"です。\n" +":c:func:`PyObject_Free` を継承することになる場合、このスロットは継承されず、" +"代わりに :c:func:`PyObject_GC_Del` がデフォルトになります。" -#: ../../c-api/typeobj.rst:2146 msgid "" "For :ref:`heap subtypes `, this slot defaults to a deallocator " "suitable to match :c:func:`PyType_GenericAlloc` and the value of the :c:" "macro:`Py_TPFLAGS_HAVE_GC` flag." msgstr "" +":ref:`ヒープのサブタイプ ` では、このスロットのデフォルトは :c:" +"func:`PyType_GenericAlloc` と :c:macro:`Py_TPFLAGS_HAVE_GC` フラグの値に対応" +"する適切な解放関数になります。" #: ../../c-api/typeobj.rst:2155 msgid "An optional pointer to a function called by the garbage collector." msgstr "" "オプションのポインタで、ガベージコレクタから呼び出される関数を指します。" -#: ../../c-api/typeobj.rst:2157 msgid "" "The garbage collector needs to know whether a particular object is " "collectible or not. Normally, it is sufficient to look at the object's " @@ -3697,10 +4155,18 @@ msgid "" "return ``1`` for a collectible instance, and ``0`` for a non-collectible " "instance. The signature is::" msgstr "" +"ガベージコレクタは、個々のオブジェクトが回収可能かどうかを知る必要がありま" +"す。\n" +"通常は、オブジェクトの型の :c:member:`~PyTypeObject.tp_flags` フィールドで :" +"c:macro:`Py_TPFLAGS_HAVE_GC` フラグビットを確認すれば十分です。\n" +"ただし、静的に割り当てたインスタンスと動的に割り当てたインスタンスが混在する" +"型もあり、静的なインスタンスは回収できません。\n" +"そうした型ではこの関数を定義し、回収可能なインスタンスなら ``1``、回収不能な" +"ら ``0`` を返すべきです。\n" +"シグネチャは次のとおりです。 ::" -#: ../../c-api/typeobj.rst:2165 msgid "int tp_is_gc(PyObject *self);" -msgstr "" +msgstr "int tp_is_gc(PyObject *self);" #: ../../c-api/typeobj.rst:2167 msgid "" @@ -3712,21 +4178,24 @@ msgstr "" "`PyType_Type` は、型のメモリ確保が静的か :ref:`動的 ` かを区別す" "るためにこの関数を定義しています。)" -#: ../../c-api/typeobj.rst:2177 msgid "" "This slot has no default. If this field is ``NULL``, :c:macro:" "`Py_TPFLAGS_HAVE_GC` is used as the functional equivalent." msgstr "" +"このスロットにはデフォルト値がありません。\n" +"``NULL`` の場合は、代わりに :c:macro:`Py_TPFLAGS_HAVE_GC` が同等の役割を果た" +"します。" #: ../../c-api/typeobj.rst:2183 msgid "Tuple of base types." msgstr "基底型からなるタプルです。" -#: ../../c-api/typeobj.rst:2185 ../../c-api/typeobj.rst:2209 msgid "" "This field should be set to ``NULL`` and treated as read-only. Python will " "fill it in when the type is :c:func:`initialized `." msgstr "" +"このフィールドは ``NULL`` に設定し、読み取り専用として扱うべきです。\n" +"型が :c:func:`初期化 ` されるときに、Python が設定します。" #: ../../c-api/typeobj.rst:2188 msgid "" @@ -3735,12 +4204,14 @@ msgid "" "`PyType_FromSpecWithBases`. The argument form is preferred." msgstr "" -#: ../../c-api/typeobj.rst:2195 msgid "" "Multiple inheritance does not work well for statically defined types. If you " "set ``tp_bases`` to a tuple, Python will not raise an error, but some slots " "will only be inherited from the first base." msgstr "" +"静的に定義された型では、多重継承はうまく動作しません。\n" +"``tp_bases`` にタプルを設定しても Python はエラーを送出しませんが、一部のス" +"ロットは最初の基底クラスからしか継承されません。" #: ../../c-api/typeobj.rst:2201 ../../c-api/typeobj.rst:2224 #: ../../c-api/typeobj.rst:2241 ../../c-api/typeobj.rst:2258 @@ -3769,43 +4240,52 @@ msgstr "" msgid "Unused. Internal use only." msgstr "未使用のフィールドです。内部でのみ利用されます。" -#: ../../c-api/typeobj.rst:2229 msgid "" "A collection of subclasses. Internal use only. May be an invalid pointer." msgstr "" +"サブクラスのコレクションです。\n" +"内部使用専用です。\n" +"無効なポインタの場合があります。" -#: ../../c-api/typeobj.rst:2231 msgid "" "To get a list of subclasses, call the Python method :py:meth:`~type." "__subclasses__`." msgstr "" +"サブクラスのリストを取得するには、Python の :py:meth:`~type.__subclasses__` " +"メソッドを呼び出してください。" -#: ../../c-api/typeobj.rst:2236 msgid "" "For some types, this field does not hold a valid :c:expr:`PyObject*`. The " "type was changed to :c:expr:`void*` to indicate this." msgstr "" +"一部の型では、このフィールドは有効な :c:expr:`PyObject*` を保持しません。\n" +"そのことを示すために、型が :c:expr:`void*` に変更されました。" -#: ../../c-api/typeobj.rst:2246 msgid "" "Weak reference list head, for weak references to this type object. Not " "inherited. Internal use only." -msgstr "この型オブジェクトに対する弱参照からなるリストの先頭です。" +msgstr "" +"この型オブジェクトへの弱参照リストの先頭です。\n" +"継承されません。\n" +"内部使用専用です。" -#: ../../c-api/typeobj.rst:2251 msgid "" "Internals detail: For the static builtin types this is always ``NULL``, even " "if weakrefs are added. Instead, the weakrefs for each are stored on " "``PyInterpreterState``. Use the public C-API or the internal " "``_PyObject_GET_WEAKREFS_LISTPTR()`` macro to avoid the distinction." msgstr "" +"実装詳細: 静的な組み込み型では、弱参照が追加されていても常に ``NULL`` で" +"す。\n" +"代わりに、それぞれの弱参照は ``PyInterpreterState`` に格納されます。\n" +"この違いを意識せずに扱うには、公開 C API または内部マクロ " +"``_PyObject_GET_WEAKREFS_LISTPTR()`` を使ってください。" -#: ../../c-api/typeobj.rst:2263 msgid "" "This field is deprecated. Use :c:member:`~PyTypeObject.tp_finalize` instead." msgstr "" -"このフィールドは廃止されました。:c:member:`~PyTypeObject.tp_finalize` を代わ" -"りに利用してください。" +"このフィールドは非推奨です。\n" +"代わりに :c:member:`~PyTypeObject.tp_finalize` を使ってください。" #: ../../c-api/typeobj.rst:2268 msgid "Used to index into the method cache. Internal use only." @@ -3813,41 +4293,49 @@ msgstr "" "メソッドキャッシュへのインデックスとして使われます。内部使用だけのための関数" "です。" -#: ../../c-api/typeobj.rst:2277 msgid "" "An optional pointer to an instance finalization function. This is the C " "implementation of the :meth:`~object.__del__` special method. Its signature " "is::" msgstr "" +"インスタンスのファイナライズ関数への省略可能なポインタです。\n" +"特殊メソッド :meth:`~object.__del__` の C 実装に相当します。\n" +"シグネチャは次のとおりです。 ::" -#: ../../c-api/typeobj.rst:2281 msgid "void tp_finalize(PyObject *self);" -msgstr "" +msgstr "void tp_finalize(PyObject *self);" -#: ../../c-api/typeobj.rst:2283 msgid "" "The primary purpose of finalization is to perform any non-trivial cleanup " "that must be performed before the object is destroyed, while the object and " "any other objects it directly or indirectly references are still in a " "consistent state. The finalizer is allowed to execute arbitrary Python code." msgstr "" +"ファイナライズの主な目的は、オブジェクトとその直接または間接の参照先がまだ整" +"合性のある状態にある間に、破棄前に必要な複雑な後片付けを行うことです。\n" +"ファイナライザは任意の Python コードを実行できます。" -#: ../../c-api/typeobj.rst:2289 msgid "" "Before Python automatically finalizes an object, some of the object's direct " "or indirect referents might have themselves been automatically finalized. " "However, none of the referents will have been automatically cleared (:c:" "member:`~PyTypeObject.tp_clear`) yet." msgstr "" +"Python がオブジェクトを自動的にファイナライズする前に、その直接または間接の参" +"照先の一部が、すでに自動的にファイナライズされている可能性があります。\n" +"ただし、参照先はまだどれも自動的にクリア (:c:member:`~PyTypeObject." +"tp_clear`) されていません。" -#: ../../c-api/typeobj.rst:2294 msgid "" "Other non-finalized objects might still be using a finalized object, so the " "finalizer must leave the object in a sane state (e.g., invariants are still " "met)." msgstr "" +"他の未ファイナライズのオブジェクトが、ファイナライズ済みのオブジェクトをまだ" +"使っている可能性があります。\n" +"このため、ファイナライザはオブジェクトを正常な状態 (例えば不変条件を満たす状" +"態) に保たなければなりません。" -#: ../../c-api/typeobj.rst:2300 msgid "" "After Python automatically finalizes an object, Python might start " "automatically clearing (:c:member:`~PyTypeObject.tp_clear`) the object and " @@ -3855,8 +4343,12 @@ msgid "" "be in a consistent state; a finalized object must be able to tolerate " "cleared referents." msgstr "" +"Python がオブジェクトを自動的にファイナライズした後は、そのオブジェクトと直接" +"または間接の参照先の自動的なクリア (:c:member:`~PyTypeObject.tp_clear`) を始" +"める可能性があります。\n" +"クリア済みのオブジェクトは整合性のある状態とは限らないので、ファイナライズ済" +"みのオブジェクトは参照先がクリアされても問題なく扱える必要があります。" -#: ../../c-api/typeobj.rst:2308 msgid "" "An object is not guaranteed to be automatically finalized before its " "destructor (:c:member:`~PyTypeObject.tp_dealloc`) is called. It is " @@ -3864,6 +4356,10 @@ msgid "" "beginning of :c:member:`!tp_dealloc` to guarantee that the object is always " "finalized before destruction." msgstr "" +"デストラクタ (:c:member:`~PyTypeObject.tp_dealloc`) の呼び出し前に、オブジェ" +"クトが自動的にファイナライズされるとは限りません。\n" +"破棄前に必ずファイナライズされるようにするため、:c:member:`!tp_dealloc` の冒" +"頭で :c:func:`PyObject_CallFinalizerFromDealloc` を呼び出すことを推奨します。" #: ../../c-api/typeobj.rst:2316 msgid "" @@ -3871,17 +4367,19 @@ msgid "" "thread, although the :term:`GIL` will be held." msgstr "" -#: ../../c-api/typeobj.rst:2321 msgid "" "The :c:member:`!tp_finalize` function can be called during shutdown, after " "some global variables have been deleted. See the documentation of the :meth:" "`~object.__del__` method for details." msgstr "" +":c:member:`!tp_finalize` 関数は、シャットダウン中に一部のグローバル変数が削除" +"された後で呼び出される可能性があります。\n" +"詳細は :meth:`~object.__del__` メソッドの説明を参照してください。" -#: ../../c-api/typeobj.rst:2325 msgid "" "When Python finalizes an object, it behaves like the following algorithm:" msgstr "" +"Python がオブジェクトをファイナライズするときは、次のような手順で動作します。" #: ../../c-api/typeobj.rst:2327 msgid "" @@ -3897,7 +4395,6 @@ msgid "" "finalizer function is non-``NULL``, the finalizer function is called." msgstr "" -#: ../../c-api/typeobj.rst:2335 msgid "" "If the finalizer function was called and the finalizer made the object " "reachable (i.e., there is a reference to the object and it is not a member " @@ -3906,31 +4403,45 @@ msgid "" "resurrect the object by adding a new reference to the object that does not " "make it reachable, i.e., the object is (still) a member of a cyclic isolate." msgstr "" +"ファイナライザ関数が呼び出され、オブジェクトを到達可能にした場合 (参照があ" +"り、:term:`孤立した循環参照群 ` の一部ではなくなった場合)、そ" +"のオブジェクトを *復活させた* といいます。\n" +"到達可能にしない新しい参照を加えた場合、つまりオブジェクトが引き続き孤立した" +"循環参照群の一部である場合にも、ファイナライザが復活させられるかどうかは規定" +"されていません。" -#: ../../c-api/typeobj.rst:2342 msgid "" "If the finalizer resurrected the object, the object's pending destruction is " "canceled and the object's *finalized* mark might be removed if present. " "Currently, Python never removes the *finalized* mark; this might change in a " "future version." msgstr "" +"ファイナライザがオブジェクトを復活させると、予定されていた破棄は取り消され、*" +"ファイナライズ済み* の印があれば取り除かれる可能性があります。\n" +"現在の Python は *ファイナライズ済み* の印を取り除きませんが、将来のバージョ" +"ンで変更される可能性があります。" -#: ../../c-api/typeobj.rst:2347 msgid "" "*Automatic finalization* refers to any finalization performed by Python " "except via calls to :c:func:`PyObject_CallFinalizer` or :c:func:" "`PyObject_CallFinalizerFromDealloc`. No guarantees are made about when, if, " "or how often an object is automatically finalized, except:" msgstr "" +"*自動的なファイナライズ* とは、:c:func:`PyObject_CallFinalizer` または :c:" +"func:`PyObject_CallFinalizerFromDealloc` の呼び出しを介するものを除き、" +"Python が行うすべてのファイナライズを指します。\n" +"自動的にファイナライズするかどうか、いつ行うか、何回行うかについては、次の事" +"項を除いて保証はありません。" -#: ../../c-api/typeobj.rst:2352 msgid "" "Python will not automatically finalize an object if it is reachable, i.e., " "there is a reference to it and it is not a member of a :term:`cyclic " "isolate`." msgstr "" +"Python は到達可能なオブジェクトを自動的にファイナライズしません。\n" +"つまり、参照があり、:term:`孤立した循環参照群 ` の一部ではな" +"いオブジェクトは対象になりません。" -#: ../../c-api/typeobj.rst:2355 msgid "" "Python will not automatically finalize an object if finalizing it would not " "mark the object as *finalized*. Currently, this applies to objects whose " @@ -3939,54 +4450,73 @@ msgid "" "finalized by calling :c:func:`PyObject_CallFinalizer` or :c:func:" "`PyObject_CallFinalizerFromDealloc`." msgstr "" +"ファイナライズしても *ファイナライズ済み* の印が付かないオブジェクトを、" +"Python は自動的にファイナライズしません。\n" +"現在は、ガベージコレクションをサポートしない型 (:c:macro:" +"`Py_TPFLAGS_HAVE_GC` フラグが設定されていないもの) のオブジェクトが該当しま" +"す。\n" +"そうしたオブジェクトでも、:c:func:`PyObject_CallFinalizer` または :c:func:" +"`PyObject_CallFinalizerFromDealloc` を呼び出して手動でファイナライズできま" +"す。" -#: ../../c-api/typeobj.rst:2361 msgid "" "Python will not automatically finalize any two members of a :term:`cyclic " "isolate` concurrently." msgstr "" +"Python は、同じ :term:`孤立した循環参照群 ` に属する 2 つのオ" +"ブジェクトを、自動的に並行してファイナライズすることはありません。" -#: ../../c-api/typeobj.rst:2363 msgid "" "Python will not automatically finalize an object after it has automatically " "cleared (:c:member:`~PyTypeObject.tp_clear`) the object." msgstr "" +"Python は、自動的にクリア (:c:member:`~PyTypeObject.tp_clear`) したオブジェク" +"トを、その後で自動的にファイナライズすることはありません。" -#: ../../c-api/typeobj.rst:2365 msgid "" "If an object is a member of a :term:`cyclic isolate`, Python will not " "automatically finalize it after automatically clearing (see :c:member:" "`~PyTypeObject.tp_clear`) any other member." msgstr "" +":term:`孤立した循環参照群 ` のいずれかのオブジェクトを自動的" +"にクリア (:c:member:`~PyTypeObject.tp_clear` を参照) した後は、Python はその" +"群のオブジェクトを自動的にファイナライズしません。" -#: ../../c-api/typeobj.rst:2368 msgid "" "Python will automatically finalize every member of a :term:`cyclic isolate` " "before it automatically clears (see :c:member:`~PyTypeObject.tp_clear`) any " "of them." msgstr "" +"Python は、:term:`孤立した循環参照群 ` のどのオブジェクトを自" +"動的にクリア (:c:member:`~PyTypeObject.tp_clear` を参照) するよりも前に、すべ" +"てのオブジェクトを自動的にファイナライズします。" -#: ../../c-api/typeobj.rst:2371 msgid "" "If Python is going to automatically clear an object (:c:member:" "`~PyTypeObject.tp_clear`), it will automatically finalize the object first." msgstr "" +"Python がオブジェクトを自動的にクリア (:c:member:`~PyTypeObject.tp_clear`) す" +"る場合は、先にそのオブジェクトを自動的にファイナライズします。" -#: ../../c-api/typeobj.rst:2375 msgid "" "Python currently only automatically finalizes objects that are members of a :" "term:`cyclic isolate`, but future versions might finalize objects regularly " "before their destruction." msgstr "" +"現在の Python は、:term:`孤立した循環参照群 ` に属するオブ" +"ジェクトだけを自動的にファイナライズします。\n" +"将来のバージョンでは、破棄前に通常の処理としてファイナライズするようになるか" +"もしれません。" -#: ../../c-api/typeobj.rst:2379 msgid "" "To manually finalize an object, do not call this function directly; call :c:" "func:`PyObject_CallFinalizer` or :c:func:`PyObject_CallFinalizerFromDealloc` " "instead." msgstr "" +"手動でファイナライズするには、この関数を直接呼び出さず、代わりに :c:func:" +"`PyObject_CallFinalizer` または :c:func:`PyObject_CallFinalizerFromDealloc` " +"を呼び出してください。" -#: ../../c-api/typeobj.rst:2383 msgid "" ":c:member:`~PyTypeObject.tp_finalize` should leave the current exception " "status unchanged. The recommended way to write a non-trivial finalizer is " @@ -3996,8 +4526,15 @@ msgid "" "middle of the finalizer, log and clear it with :c:func:" "`PyErr_WriteUnraisable` or :c:func:`PyErr_FormatUnraisable`. For example::" msgstr "" +":c:member:`~PyTypeObject.tp_finalize` は、現在の例外の状態を変えるべきではあ" +"りません。\n" +"複雑なファイナライザを記述する場合は、冒頭で :c:func:" +"`PyErr_GetRaisedException` を呼び出して例外を保存し、最後に :c:func:" +"`PyErr_SetRaisedException` を呼び出して復元する方法を推奨します。\n" +"途中で例外が発生した場合は、:c:func:`PyErr_WriteUnraisable` または :c:func:" +"`PyErr_FormatUnraisable` で記録してクリアしてください。\n" +"例えば次のようにします。 ::" -#: ../../c-api/typeobj.rst:2392 msgid "" "static void\n" "foo_finalize(PyObject *self)\n" @@ -4019,47 +4556,72 @@ msgid "" " PyErr_SetRaisedException(exc);\n" "}" msgstr "" +"static void\n" +"foo_finalize(PyObject *self)\n" +"{\n" +" // 現在の例外があれば保存する。\n" +" PyObject *exc = PyErr_GetRaisedException();\n" +"\n" +" // ...\n" +"\n" +" if (do_something_that_might_raise() != success_indicator) {\n" +" PyErr_WriteUnraisable(self);\n" +" goto done;\n" +" }\n" +"\n" +"done:\n" +" // 保存した例外を復元する。上で発生した例外は黙って捨てられるので、\n" +" // 必要であれば先に必ず PyErr_WriteUnraisable を呼び出す。\n" +" //\n" +" PyErr_SetRaisedException(exc);\n" +"}" -#: ../../c-api/typeobj.rst:2420 msgid "" "Before version 3.8 it was necessary to set the :c:macro:" "`Py_TPFLAGS_HAVE_FINALIZE` flags bit in order for this field to be used. " "This is no longer required." msgstr "" +"バージョン 3.8 より前は、このフィールドを使うために :c:macro:" +"`Py_TPFLAGS_HAVE_FINALIZE` フラグビットの設定が必要でした。\n" +"現在は不要です。" -#: ../../c-api/typeobj.rst:2426 msgid ":pep:`442`: \"Safe object finalization\"" -msgstr "" +msgstr ":pep:`442`: 「安全なオブジェクトのファイナライズ」" -#: ../../c-api/typeobj.rst:2429 msgid ":c:func:`PyObject_CallFinalizer`" -msgstr "" +msgstr ":c:func:`PyObject_CallFinalizer`" -#: ../../c-api/typeobj.rst:2430 msgid ":c:func:`PyObject_CallFinalizerFromDealloc`" -msgstr "" +msgstr ":c:func:`PyObject_CallFinalizerFromDealloc`" -#: ../../c-api/typeobj.rst:2435 msgid "" "A :ref:`vectorcall function ` to use for calls of this type " "object (rather than instances). In other words, ``tp_vectorcall`` can be " "used to optimize ``type.__call__``, which typically returns a new instance " "of *type*." msgstr "" +"インスタンスではなく、この型オブジェクト自体の呼び出しに使う :ref:" +"`vectorcall 関数 ` です。\n" +"つまり ``tp_vectorcall`` は、通常は *type* の新しいインスタンスを返す ``type." +"__call__`` の最適化に使えます。" -#: ../../c-api/typeobj.rst:2440 msgid "" "As with any vectorcall function, if ``tp_vectorcall`` is ``NULL``, the " "*tp_call* protocol (``Py_TYPE(type)->tp_call``) is used instead." msgstr "" +"他の vectorcall 関数と同様に、``tp_vectorcall`` が ``NULL`` の場合は " +"*tp_call* プロトコル (``Py_TYPE(type)->tp_call``) が代わりに使われます。" -#: ../../c-api/typeobj.rst:2445 msgid "" "The :ref:`vectorcall protocol ` requires that the vectorcall " "function has the same behavior as the corresponding ``tp_call``. This means " "that ``type->tp_vectorcall`` must match the behavior of ``Py_TYPE(type)-" ">tp_call``." msgstr "" +":ref:`vectorcall プロトコル ` では、vectorcall 関数は対応する " +"``tp_call`` と同じように動作しなければなりません。\n" +"つまり ``type->tp_vectorcall`` は ``Py_TYPE(type)->tp_call`` と同じように動作" +"する必要があります。" #: ../../c-api/typeobj.rst:2450 msgid "" @@ -4067,9 +4629,8 @@ msgid "" "must behave the same as :c:expr:`PyType_Type->tp_call`, which:" msgstr "" -#: ../../c-api/typeobj.rst:2454 msgid "calls ``type->tp_new``," -msgstr "" +msgstr "``type->tp_new`` を呼び出します。" #: ../../c-api/typeobj.rst:2456 msgid "" @@ -4077,11 +4638,9 @@ msgid "" "of ``tp_new``, and" msgstr "" -#: ../../c-api/typeobj.rst:2459 msgid "returns the result of ``tp_new``." -msgstr "" +msgstr "``tp_new`` の結果を返します。" -#: ../../c-api/typeobj.rst:2461 msgid "" "Typically, ``tp_vectorcall`` is overridden to optimize this process for " "specific :c:member:`~PyTypeObject.tp_new` and :c:member:`~PyTypeObject." @@ -4089,6 +4648,12 @@ msgid "" "overridden (using :py:func:`~object.__new__` and :py:func:`~object." "__init__`, respectively)." msgstr "" +"通常、特定の :c:member:`~PyTypeObject.tp_new` と :c:member:`~PyTypeObject." +"tp_init` に対してこの処理を最適化するために、``tp_vectorcall`` をオーバーライ" +"ドします。\n" +"利用者がサブクラス化できる型でこれを行う場合、どちらも (それぞれ :py:func:" +"`~object.__new__` と :py:func:`~object.__init__` を使って) オーバーライドされ" +"る可能性があることに注意してください。" #: ../../c-api/typeobj.rst:2472 msgid "This field is never inherited." @@ -4099,70 +4664,80 @@ msgid "(the field exists since 3.8 but it's only used since 3.9)" msgstr "" "(このフィールドは3.8から存在していますが、3.9以降でしか利用できません)" -#: ../../c-api/typeobj.rst:2479 msgid "Internal. Do not use." msgstr "" +"内部使用専用です。\n" +"使わないでください。" -#: ../../c-api/typeobj.rst:2487 msgid "Static Types" -msgstr "" +msgstr "静的な型" -#: ../../c-api/typeobj.rst:2489 msgid "" "Traditionally, types defined in C code are *static*, that is, a static :c:" "type:`PyTypeObject` structure is defined directly in code and initialized " "using :c:func:`PyType_Ready`." msgstr "" +"従来、C コードで定義する型は *静的* なものです。\n" +"つまり、静的な :c:type:`PyTypeObject` 構造体をコード内に直接定義し、:c:func:" +"`PyType_Ready` で初期化します。" -#: ../../c-api/typeobj.rst:2493 msgid "" "This results in types that are limited relative to types defined in Python:" msgstr "" +"この方法で作成される型には、Python で定義する型と比べて次の制約があります。" -#: ../../c-api/typeobj.rst:2495 msgid "" "Static types are limited to one base, i.e. they cannot use multiple " "inheritance." -msgstr "" +msgstr "静的な型の基底クラスは 1 つに限られ、多重継承は使えません。" -#: ../../c-api/typeobj.rst:2497 msgid "" "Static type objects (but not necessarily their instances) are immutable. It " "is not possible to add or modify the type object's attributes from Python." msgstr "" +"静的な型オブジェクトは変更不能です (そのインスタンスが変更不能とは限りませ" +"ん)。\n" +"Python から型オブジェクトの属性を追加したり変更したりすることはできません。" -#: ../../c-api/typeobj.rst:2499 msgid "" "Static type objects are shared across :ref:`sub-interpreters `, so they should not include any subinterpreter-" "specific state." msgstr "" +"静的な型オブジェクトは :ref:`サブインタープリタ ` 間" +"で共有されるため、サブインタープリタ固有の状態を含めるべきではありません。" -#: ../../c-api/typeobj.rst:2503 msgid "" "Also, since :c:type:`PyTypeObject` is only part of the :ref:`Limited API " "` as an opaque struct, any extension modules using static " "types must be compiled for a specific Python minor version." msgstr "" +"また、:c:type:`PyTypeObject` は不透明な構造体としてのみ :ref:`Limited API " +"` に含まれるため、静的な型を使う拡張モジュールは、特定の " +"Python マイナーバージョン向けにコンパイルしなければなりません。" -#: ../../c-api/typeobj.rst:2511 msgid "Heap Types" -msgstr "" +msgstr "ヒープ型" -#: ../../c-api/typeobj.rst:2513 msgid "" "An alternative to :ref:`static types ` is *heap-allocated " "types*, or *heap types* for short, which correspond closely to classes " "created by Python's ``class`` statement. Heap types have the :c:macro:" "`Py_TPFLAGS_HEAPTYPE` flag set." msgstr "" +":ref:`静的な型 ` の代わりに使えるのが、*ヒープに割り当てられた" +"型*、略して *ヒープ型* です。\n" +"Python の ``class`` 文で作成したクラスに近いものです。\n" +"ヒープ型には :c:macro:`Py_TPFLAGS_HEAPTYPE` フラグが設定されます。" -#: ../../c-api/typeobj.rst:2518 msgid "" "This is done by filling a :c:type:`PyType_Spec` structure and calling :c:" "func:`PyType_FromSpec`, :c:func:`PyType_FromSpecWithBases`, :c:func:" "`PyType_FromModuleAndSpec`, or :c:func:`PyType_FromMetaclass`." msgstr "" +":c:type:`PyType_Spec` 構造体に値を設定し、:c:func:`PyType_FromSpec`、:c:func:" +"`PyType_FromSpecWithBases`、:c:func:`PyType_FromModuleAndSpec`、:c:func:" +"`PyType_FromMetaclass` のいずれかを呼び出して作成します。" #: ../../c-api/typeobj.rst:2526 msgid "Number Object Structures" @@ -4183,7 +4758,6 @@ msgstr "" msgid "Here is the structure definition::" msgstr "以下は構造体の定義です::" -#: ../../c-api/typeobj.rst:2541 msgid "" "typedef struct {\n" " binaryfunc nb_add;\n" @@ -4228,6 +4802,48 @@ msgid "" " binaryfunc nb_inplace_matrix_multiply;\n" "} PyNumberMethods;" msgstr "" +"typedef struct {\n" +" binaryfunc nb_add;\n" +" binaryfunc nb_subtract;\n" +" binaryfunc nb_multiply;\n" +" binaryfunc nb_remainder;\n" +" binaryfunc nb_divmod;\n" +" ternaryfunc nb_power;\n" +" unaryfunc nb_negative;\n" +" unaryfunc nb_positive;\n" +" unaryfunc nb_absolute;\n" +" inquiry nb_bool;\n" +" unaryfunc nb_invert;\n" +" binaryfunc nb_lshift;\n" +" binaryfunc nb_rshift;\n" +" binaryfunc nb_and;\n" +" binaryfunc nb_xor;\n" +" binaryfunc nb_or;\n" +" unaryfunc nb_int;\n" +" void *nb_reserved;\n" +" unaryfunc nb_float;\n" +"\n" +" binaryfunc nb_inplace_add;\n" +" binaryfunc nb_inplace_subtract;\n" +" binaryfunc nb_inplace_multiply;\n" +" binaryfunc nb_inplace_remainder;\n" +" ternaryfunc nb_inplace_power;\n" +" binaryfunc nb_inplace_lshift;\n" +" binaryfunc nb_inplace_rshift;\n" +" binaryfunc nb_inplace_and;\n" +" binaryfunc nb_inplace_xor;\n" +" binaryfunc nb_inplace_or;\n" +"\n" +" binaryfunc nb_floor_divide;\n" +" binaryfunc nb_true_divide;\n" +" binaryfunc nb_inplace_floor_divide;\n" +" binaryfunc nb_inplace_true_divide;\n" +"\n" +" unaryfunc nb_index;\n" +"\n" +" binaryfunc nb_matrix_multiply;\n" +" binaryfunc nb_inplace_matrix_multiply;\n" +"} PyNumberMethods;" #: ../../c-api/typeobj.rst:2586 msgid "" @@ -4244,12 +4860,15 @@ msgstr "" "ば、二項関数と三項関数は ``Py_NotImplemented`` を返さなければならず、他のエ" "ラーが起こった場合は、``NULL`` を返して例外を設定しなければなりません。" -#: ../../c-api/typeobj.rst:2595 msgid "" "The :c:member:`~PyNumberMethods.nb_reserved` field should always be " "``NULL``. It was previously called :c:member:`!nb_long`, and was renamed in " "Python 3.0.1." msgstr "" +":c:member:`~PyNumberMethods.nb_reserved` フィールドは常に ``NULL`` にするべき" +"です。\n" +"以前は :c:member:`!nb_long` という名前でしたが、Python 3.0.1 で改名されまし" +"た。" #: ../../c-api/typeobj.rst:2640 msgid "Mapping Object Structures" @@ -4286,7 +4905,6 @@ msgstr "" "スロットは :c:func:`PyMapping_Check` が ``1`` を返すためには必要で、そうでな" "ければ ``NULL`` の場合があります。" -#: ../../c-api/typeobj.rst:2666 msgid "" "This function is used by :c:func:`PyObject_SetItem`, :c:func:" "`PyObject_DelItem`, :c:func:`PySequence_SetSlice` and :c:func:" @@ -4295,6 +4913,12 @@ msgid "" "If this slot is ``NULL``, the object does not support item assignment and " "deletion." msgstr "" +"この関数は :c:func:`PyObject_SetItem`、:c:func:`PyObject_DelItem`、:c:func:" +"`PySequence_SetSlice`、:c:func:`PySequence_DelSlice` で使われます。\n" +"シグネチャは :c:func:`!PyObject_SetItem` と同じですが、要素を削除するために " +"*v* を ``NULL`` にすることもできます。\n" +"このスロットが ``NULL`` の場合、オブジェクトは要素の代入と削除をサポートしま" +"せん。" #: ../../c-api/typeobj.rst:2677 msgid "Sequence Object Structures" @@ -4308,13 +4932,17 @@ msgstr "" "この構造体はシーケンス型プロトコルを実装するために使われる関数群へのポインタ" "を保持しています。" -#: ../../c-api/typeobj.rst:2689 msgid "" "This function is used by :c:func:`PySequence_Size` and :c:func:" "`PyObject_Size`, and has the same signature. It is also used for handling " "negative indices via the :c:member:`~PySequenceMethods.sq_item` and the :c:" "member:`~PySequenceMethods.sq_ass_item` slots." msgstr "" +"この関数は :c:func:`PySequence_Size` と :c:func:`PyObject_Size` で使われ、そ" +"れらと同じシグネチャを持ちます。\n" +":c:member:`~PySequenceMethods.sq_item` スロットや :c:member:" +"`~PySequenceMethods.sq_ass_item` スロットを使う際の、負のインデックスの処理に" +"も使われます。" #: ../../c-api/typeobj.rst:2696 msgid "" @@ -4336,7 +4964,6 @@ msgstr "" "す。また、 ``*`` 演算でも、 :c:member:`~PyNumberMethods.nb_multiply` スロット" "による数値乗算を試したあとに利用されます。" -#: ../../c-api/typeobj.rst:2708 msgid "" "This function is used by :c:func:`PySequence_GetItem` and has the same " "signature. It is also used by :c:func:`PyObject_GetItem`, after trying the " @@ -4344,8 +4971,13 @@ msgid "" "slot must be filled for the :c:func:`PySequence_Check` function to return " "``1``, it can be ``NULL`` otherwise." msgstr "" +"この関数は :c:func:`PySequence_GetItem` で使われ、同じシグネチャを持ちま" +"す。\n" +":c:func:`PyObject_GetItem` でも、:c:member:`~PyMappingMethods.mp_subscript` " +"スロットによる添字指定を試した後で使われます。\n" +":c:func:`PySequence_Check` が ``1`` を返すにはこのスロットの設定が必要です" +"が、それ以外の場合は ``NULL`` にできます。" -#: ../../c-api/typeobj.rst:2714 msgid "" "Negative indexes are handled as follows: if the :c:member:" "`~PySequenceMethods.sq_length` slot is filled, it is called and the sequence " @@ -4353,8 +4985,13 @@ msgid "" "`~PySequenceMethods.sq_item`. If :c:member:`!sq_length` is ``NULL``, the " "index is passed as is to the function." msgstr "" +"負のインデックスは次のように処理されます。\n" +":c:member:`~PySequenceMethods.sq_length` スロットが設定されていれば、それを呼" +"び出してシーケンスの長さを取得し、正のインデックスを計算して :c:member:" +"`~PySequenceMethods.sq_item` に渡します。\n" +":c:member:`!sq_length` が ``NULL`` の場合は、インデックスをそのまま関数に渡し" +"ます。" -#: ../../c-api/typeobj.rst:2721 msgid "" "This function is used by :c:func:`PySequence_SetItem` and has the same " "signature. It is also used by :c:func:`PyObject_SetItem` and :c:func:" @@ -4362,6 +4999,13 @@ msgid "" "member:`~PyMappingMethods.mp_ass_subscript` slot. This slot may be left to " "``NULL`` if the object does not support item assignment and deletion." msgstr "" +"この関数は :c:func:`PySequence_SetItem` で使われ、同じシグネチャを持ちま" +"す。\n" +":c:func:`PyObject_SetItem` と :c:func:`PyObject_DelItem` でも、:c:member:" +"`~PyMappingMethods.mp_ass_subscript` スロットによる要素の代入や削除を試した後" +"で使われます。\n" +"オブジェクトが要素の代入と削除をサポートしない場合、このスロットは ``NULL`` " +"のままにできます。" #: ../../c-api/typeobj.rst:2730 msgid "" @@ -4374,7 +5018,6 @@ msgstr "" "PySequence_Contains` はシンプルにマッチするオブジェクトを見つけるまでシーケン" "スを巡回します。" -#: ../../c-api/typeobj.rst:2737 msgid "" "This function is used by :c:func:`PySequence_InPlaceConcat` and has the same " "signature. It should modify its first operand, and return it. This slot " @@ -4383,8 +5026,15 @@ msgid "" "augmented assignment ``+=``, after trying numeric in-place addition via the :" "c:member:`~PyNumberMethods.nb_inplace_add` slot." msgstr "" +"この関数は :c:func:`PySequence_InPlaceConcat` で使われ、同じシグネチャを持ち" +"ます。\n" +"第 1 オペランドを変更して返すべきです。\n" +"このスロットは ``NULL`` のままにできます。\n" +"その場合 :c:func:`!PySequence_InPlaceConcat` は :c:func:`PySequence_Concat` " +"にフォールバックします。\n" +"累算代入 ``+=`` でも、:c:member:`~PyNumberMethods.nb_inplace_add` スロットに" +"よる数値のインプレース加算を試した後で使われます。" -#: ../../c-api/typeobj.rst:2746 msgid "" "This function is used by :c:func:`PySequence_InPlaceRepeat` and has the same " "signature. It should modify its first operand, and return it. This slot " @@ -4393,6 +5043,14 @@ msgid "" "augmented assignment ``*=``, after trying numeric in-place multiplication " "via the :c:member:`~PyNumberMethods.nb_inplace_multiply` slot." msgstr "" +"この関数は :c:func:`PySequence_InPlaceRepeat` で使われ、同じシグネチャを持ち" +"ます。\n" +"第 1 オペランドを変更して返すべきです。\n" +"このスロットは ``NULL`` のままにできます。\n" +"その場合 :c:func:`!PySequence_InPlaceRepeat` は :c:func:`PySequence_Repeat` " +"にフォールバックします。\n" +"累算代入 ``*=`` でも、:c:member:`~PyNumberMethods.nb_inplace_multiply` スロッ" +"トによる数値のインプレース乗算を試した後で使われます。" #: ../../c-api/typeobj.rst:2757 msgid "Buffer Object Structures" @@ -4415,9 +5073,8 @@ msgstr "" msgid "The signature of this function is::" msgstr "この関数のシグネチャは以下の通りです::" -#: ../../c-api/typeobj.rst:2773 msgid "int (PyObject *exporter, Py_buffer *view, int flags);" -msgstr "" +msgstr "int (PyObject *exporter, Py_buffer *view, int flags);" #: ../../c-api/typeobj.rst:2775 msgid "" @@ -4520,9 +5177,8 @@ msgstr "" ":c:func:`PyObject_GetBuffer` は、この関数をラップするコンシューマ向けのイン" "ターフェースです。" -#: ../../c-api/typeobj.rst:2822 msgid "void (PyObject *exporter, Py_buffer *view);" -msgstr "" +msgstr "void (PyObject *exporter, Py_buffer *view);" #: ../../c-api/typeobj.rst:2824 msgid "" @@ -4545,17 +5201,16 @@ msgid "If the counter is ``0``, free all memory associated with *view*." msgstr "" "カウンタが ``0`` の場合は、*view* に関連付けられた全てのメモリを解放します。" -#: ../../c-api/typeobj.rst:2833 msgid "" "The exporter MUST use the :c:member:`~Py_buffer.internal` field to keep " "track of buffer-specific resources. This field is guaranteed to remain " "constant, while a consumer MAY pass a copy of the original buffer as the " "*view* argument." msgstr "" -"エクスポータは、バッファ固有のリソースを監視し続けるために :c:member:" -"`~Py_buffer.internal` フィールドを使わなければなりません。このフィールドは、" -"コンシューマが *view* 引数としてオリジナルのバッファのコピーを渡しているであ" -"ろう間、変わらないことが保証されています。" +"エクスポータは、バッファ固有のリソースを管理するために :c:member:`~Py_buffer." +"internal` フィールドを使わなければなりません。\n" +"このフィールドの値は変わらないことが保証されますが、コンシューマは元のバッ" +"ファのコピーを *view* 引数として渡しても構いません。" #: ../../c-api/typeobj.rst:2839 msgid "" @@ -4587,7 +5242,6 @@ msgstr "" "この構造体は :term:`awaitable` オブジェクトと :term:`asynchronous iterator` " "オブジェクトを実装するのに必要な関数へのポインタを保持しています。" -#: ../../c-api/typeobj.rst:2865 msgid "" "typedef struct {\n" " unaryfunc am_await;\n" @@ -4596,10 +5250,15 @@ msgid "" " sendfunc am_send;\n" "} PyAsyncMethods;" msgstr "" +"typedef struct {\n" +" unaryfunc am_await;\n" +" unaryfunc am_aiter;\n" +" unaryfunc am_anext;\n" +" sendfunc am_send;\n" +"} PyAsyncMethods;" -#: ../../c-api/typeobj.rst:2876 msgid "PyObject *am_await(PyObject *self);" -msgstr "" +msgstr "PyObject *am_await(PyObject *self);" #: ../../c-api/typeobj.rst:2878 msgid "" @@ -4617,15 +5276,16 @@ msgstr "" "オブジェクトが :term:`awaitable` でない場合、このスロットを ``NULL`` に設定し" "ます。" -#: ../../c-api/typeobj.rst:2887 msgid "PyObject *am_aiter(PyObject *self);" -msgstr "" +msgstr "PyObject *am_aiter(PyObject *self);" -#: ../../c-api/typeobj.rst:2889 msgid "" "Must return an :term:`asynchronous iterator` object. See :meth:`~object." "__anext__` for details." msgstr "" +":term:`非同期イテレータ ` オブジェクトを返さなければな" +"りません。\n" +"詳細は :meth:`~object.__anext__` を参照してください。" #: ../../c-api/typeobj.rst:2892 msgid "" @@ -4635,30 +5295,31 @@ msgstr "" "オブジェクトが非同期反復処理のプロトコルを実装していない場合、このスロットを " "``NULL`` に設定します。" -#: ../../c-api/typeobj.rst:2899 msgid "PyObject *am_anext(PyObject *self);" -msgstr "" +msgstr "PyObject *am_anext(PyObject *self);" -#: ../../c-api/typeobj.rst:2901 msgid "" "Must return an :term:`awaitable` object. See :meth:`~object.__anext__` for " "details. This slot may be set to ``NULL``." msgstr "" +":term:`待機可能 ` オブジェクトを返さなければなりません。\n" +"詳細は :meth:`~object.__anext__` を参照してください。\n" +"このスロットは ``NULL`` にできます。" -#: ../../c-api/typeobj.rst:2909 msgid "PySendResult am_send(PyObject *self, PyObject *arg, PyObject **result);" msgstr "" +"PySendResult am_send(PyObject *self, PyObject *arg, PyObject **result);" -#: ../../c-api/typeobj.rst:2911 msgid "" "See :c:func:`PyIter_Send` for details. This slot may be set to ``NULL``." msgstr "" +"詳細は :c:func:`PyIter_Send` を参照してください。\n" +"このスロットは ``NULL`` にできます。" #: ../../c-api/typeobj.rst:2920 msgid "Slot Type typedefs" msgstr "Slot Type typedefs" -#: ../../c-api/typeobj.rst:2924 msgid "" "The purpose of this function is to separate memory allocation from memory " "initialization. It should return a pointer to a block of memory of adequate " @@ -4671,6 +5332,17 @@ msgid "" "a multiple of ``sizeof(void*)``; otherwise, *nitems* is not used and the " "length of the block should be :c:member:`~PyTypeObject.tp_basicsize`." msgstr "" +"この関数の目的は、メモリの割り当てと初期化を分離することです。\n" +"インスタンスに十分な長さを持ち、適切にアラインメントされ、ゼロで初期化された" +"メモリブロックへのポインタを返すべきです。\n" +"ただし、:c:member:`~PyObject.ob_refcnt` は ``1`` に、:c:member:`~PyObject." +"ob_type` は型引数に設定します。\n" +"型の :c:member:`~PyTypeObject.tp_itemsize` がゼロでなければ、オブジェクトの :" +"c:member:`~PyVarObject.ob_size` フィールドを *nitems* に初期化し、割り当てる" +"メモリブロックの長さは ``tp_basicsize + nitems*tp_itemsize`` を " +"``sizeof(void*)`` の倍数に切り上げた値にするべきです。\n" +"それ以外の場合、*nitems* は使わず、ブロックの長さは :c:member:`~PyTypeObject." +"tp_basicsize` にするべきです。" #: ../../c-api/typeobj.rst:2934 msgid "" @@ -4762,11 +5434,9 @@ msgstr "" "ケースを実演しています。より多くの例や実践的な情報、チュートリアルが必要な" "ら、:ref:`defining-new-types` や :ref:`new-types-topics` を参照してください。" -#: ../../c-api/typeobj.rst:3036 msgid "A basic :ref:`static type `::" -msgstr "" +msgstr "基本的な :ref:`静的な型 `。 ::" -#: ../../c-api/typeobj.rst:3038 msgid "" "typedef struct {\n" " PyObject_HEAD\n" @@ -4783,6 +5453,20 @@ msgid "" " .tp_repr = (reprfunc)myobj_repr,\n" "};" msgstr "" +"typedef struct {\n" +" PyObject_HEAD\n" +" const char *data;\n" +"} MyObject;\n" +"\n" +"static PyTypeObject MyObject_Type = {\n" +" PyVarObject_HEAD_INIT(NULL, 0)\n" +" .tp_name = \"mymod.MyObject\",\n" +" .tp_basicsize = sizeof(MyObject),\n" +" .tp_doc = PyDoc_STR(\"My オブジェクト\"),\n" +" .tp_new = myobj_new,\n" +" .tp_dealloc = (destructor)myobj_dealloc,\n" +" .tp_repr = (reprfunc)myobj_repr,\n" +"};" #: ../../c-api/typeobj.rst:3053 msgid "" @@ -4792,7 +5476,6 @@ msgstr "" "より冗長な初期化子を用いた古いコードを(特にCPythonのコードベース中で)見かけ" "ることがあるかもしれません::" -#: ../../c-api/typeobj.rst:3056 msgid "" "static PyTypeObject MyObject_Type = {\n" " PyVarObject_HEAD_INIT(NULL, 0)\n" @@ -4835,6 +5518,46 @@ msgid "" " myobj_new, /* tp_new */\n" "};" msgstr "" +"static PyTypeObject MyObject_Type = {\n" +" PyVarObject_HEAD_INIT(NULL, 0)\n" +" \"mymod.MyObject\", /* tp_name */\n" +" sizeof(MyObject), /* tp_basicsize */\n" +" 0, /* tp_itemsize */\n" +" (destructor)myobj_dealloc, /* tp_dealloc */\n" +" 0, /* tp_vectorcall_offset */\n" +" 0, /* tp_getattr */\n" +" 0, /* tp_setattr */\n" +" 0, /* tp_as_async */\n" +" (reprfunc)myobj_repr, /* tp_repr */\n" +" 0, /* tp_as_number */\n" +" 0, /* tp_as_sequence */\n" +" 0, /* tp_as_mapping */\n" +" 0, /* tp_hash */\n" +" 0, /* tp_call */\n" +" 0, /* tp_str */\n" +" 0, /* tp_getattro */\n" +" 0, /* tp_setattro */\n" +" 0, /* tp_as_buffer */\n" +" 0, /* tp_flags */\n" +" PyDoc_STR(\"My オブジェクト\"), /* tp_doc */\n" +" 0, /* tp_traverse */\n" +" 0, /* tp_clear */\n" +" 0, /* tp_richcompare */\n" +" 0, /* tp_weaklistoffset */\n" +" 0, /* tp_iter */\n" +" 0, /* tp_iternext */\n" +" 0, /* tp_methods */\n" +" 0, /* tp_members */\n" +" 0, /* tp_getset */\n" +" 0, /* tp_base */\n" +" 0, /* tp_dict */\n" +" 0, /* tp_descr_get */\n" +" 0, /* tp_descr_set */\n" +" 0, /* tp_dictoffset */\n" +" 0, /* tp_init */\n" +" 0, /* tp_alloc */\n" +" myobj_new, /* tp_new */\n" +"};" #: ../../c-api/typeobj.rst:3097 msgid "A type that supports weakrefs, instance dicts, and hashing::" @@ -4866,14 +5589,15 @@ msgid "" "};" msgstr "" -#: ../../c-api/typeobj.rst:3122 msgid "" "A str subclass that cannot be subclassed and cannot be called to create " "instances (e.g. uses a separate factory func) using :c:macro:" "`Py_TPFLAGS_DISALLOW_INSTANTIATION` flag::" msgstr "" +":c:macro:`Py_TPFLAGS_DISALLOW_INSTANTIATION` フラグを使い、サブクラス化も、呼" +"び出しによるインスタンスの作成もできない ``str`` のサブクラスです (例えば別の" +"ファクトリ関数を使います)。 ::" -#: ../../c-api/typeobj.rst:3126 msgid "" "typedef struct {\n" " PyUnicodeObject raw;\n" @@ -4890,13 +5614,26 @@ msgid "" " .tp_repr = (reprfunc)myobj_repr,\n" "};" msgstr "" +"typedef struct {\n" +" PyUnicodeObject raw;\n" +" char *extra;\n" +"} MyStr;\n" +"\n" +"static PyTypeObject MyStr_Type = {\n" +" PyVarObject_HEAD_INIT(NULL, 0)\n" +" .tp_name = \"mymod.MyStr\",\n" +" .tp_basicsize = sizeof(MyStr),\n" +" .tp_base = NULL, // モジュール初期化時に &PyUnicode_Type を設定\n" +" .tp_doc = PyDoc_STR(\"独自の str\"),\n" +" .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_DISALLOW_INSTANTIATION,\n" +" .tp_repr = (reprfunc)myobj_repr,\n" +"};" -#: ../../c-api/typeobj.rst:3141 msgid "" "The simplest :ref:`static type ` with fixed-length instances::" msgstr "" +"固定長のインスタンスを持つ、最も単純な :ref:`静的な型 `。 ::" -#: ../../c-api/typeobj.rst:3143 msgid "" "typedef struct {\n" " PyObject_HEAD\n" @@ -4907,14 +5644,21 @@ msgid "" " .tp_name = \"mymod.MyObject\",\n" "};" msgstr "" +"typedef struct {\n" +" PyObject_HEAD\n" +"} MyObject;\n" +"\n" +"static PyTypeObject MyObject_Type = {\n" +" PyVarObject_HEAD_INIT(NULL, 0)\n" +" .tp_name = \"mymod.MyObject\",\n" +"};" -#: ../../c-api/typeobj.rst:3152 msgid "" "The simplest :ref:`static type ` with variable-length " "instances::" msgstr "" +"可変長のインスタンスを持つ、最も単純な :ref:`静的な型 `。 ::" -#: ../../c-api/typeobj.rst:3154 msgid "" "typedef struct {\n" " PyObject_VAR_HEAD\n" @@ -4928,6 +5672,17 @@ msgid "" " .tp_itemsize = sizeof(char *),\n" "};" msgstr "" +"typedef struct {\n" +" PyObject_VAR_HEAD\n" +" const char *data[1];\n" +"} MyObject;\n" +"\n" +"static PyTypeObject MyObject_Type = {\n" +" PyVarObject_HEAD_INIT(NULL, 0)\n" +" .tp_name = \"mymod.MyObject\",\n" +" .tp_basicsize = sizeof(MyObject) - sizeof(char *),\n" +" .tp_itemsize = sizeof(char *),\n" +"};" #: ../../c-api/typeobj.rst:893 ../../c-api/typeobj.rst:958 msgid "built-in function" diff --git a/c-api/unicode.po b/c-api/unicode.po index f9d683504..dd16a122f 100644 --- a/c-api/unicode.po +++ b/c-api/unicode.po @@ -20,10 +20,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../c-api/unicode.rst:6 @@ -34,7 +34,6 @@ msgstr "Unicode オブジェクトと codec" msgid "Unicode Objects" msgstr "Unicode オブジェクト" -#: ../../c-api/unicode.rst:14 msgid "" "Since the implementation of :pep:`393` in Python 3.3, Unicode objects " "internally use a variety of representations, in order to allow handling the " @@ -43,22 +42,27 @@ msgid "" "65536; otherwise, code points must be below 1114112 (which is the full " "Unicode range)." msgstr "" -"Python3.3 の :pep:`393` 実装から、メモリ効率を維持しながらUnicode文字の完全な" -"範囲を扱えるように、Unicodeオブジェクトは内部的に多様な表現形式を用いていま" -"す。すべてのコードポイントが128、256または65536以下の文字列に対して特別なケー" -"スが存在しますが、それ以外ではコードポイントは1114112以下 (これはすべての" -"Unicode範囲です) でなければなりません。" +"Python 3.3 で :pep:`393` が実装されて以来、Unicode オブジェクトは内部で複数の" +"表現形式を使っています。\n" +"これにより、メモリ効率を維持しながら Unicode 文字の全範囲を扱えます。\n" +"すべてのコードポイントが 128 未満、256 未満、または 65536 未満の文字列は特別" +"に扱います。\n" +"それ以外のコードポイントは 1114112 未満 (Unicode の全範囲) でなければなりませ" +"ん。" -#: ../../c-api/unicode.rst:20 msgid "" "UTF-8 representation is created on demand and cached in the Unicode object." msgstr "" +"UTF-8 表現は必要に応じて作成され、Unicode オブジェクト内にキャッシュされま" +"す。" -#: ../../c-api/unicode.rst:23 msgid "" "The :c:type:`Py_UNICODE` representation has been removed since Python 3.12 " "with deprecated APIs. See :pep:`623` for more information." msgstr "" +":c:type:`Py_UNICODE` 表現は、非推奨の API とともに Python 3.12 で削除されまし" +"た。\n" +"詳細は :pep:`623` を参照してください。" #: ../../c-api/unicode.rst:29 msgid "Unicode Type" @@ -71,17 +75,21 @@ msgid "" msgstr "" "以下は Python の Unicode 実装に用いられている基本 Unicode オブジェクト型です:" -#: ../../c-api/unicode.rst:36 msgid "" "This instance of :c:type:`PyTypeObject` represents the Python Unicode type. " "It is exposed to Python code as :py:class:`str`." msgstr "" +"この :c:type:`PyTypeObject` のインスタンスは Python の Unicode 型を表しま" +"す。\n" +"Python コードには :py:class:`str` として公開されています。" -#: ../../c-api/unicode.rst:42 msgid "" "This instance of :c:type:`PyTypeObject` represents the Python Unicode " "iterator type. It is used to iterate over Unicode string objects." msgstr "" +"この :c:type:`PyTypeObject` のインスタンスは Python の Unicode イテレータ型を" +"表します。\n" +"Unicode 文字列オブジェクトの反復処理に使われます。" #: ../../c-api/unicode.rst:50 msgid "" @@ -105,11 +113,12 @@ msgstr "" "受け取って PyObject へのポインタを返すので、ほとんどの場合、これらの型を直接" "使うべきではありません。" -#: ../../c-api/unicode.rst:68 msgid "" "The following APIs are C macros and static inlined functions for fast checks " "and access to internal read-only data of Unicode objects:" msgstr "" +"以下の API は、Unicode オブジェクトの高速な検査や、内部の読み出し専用データへ" +"のアクセスのための C マクロと静的インライン関数です:" #: ../../c-api/unicode.rst:73 msgid "" @@ -177,12 +186,12 @@ msgstr "" "*unicode* は \"正統な\" 表現形式の Unicode オブジェクトでなければなりません " "(ただしチェックはしません)。" -#: ../../c-api/unicode.rst:135 msgid "" "Write the code point *value* to the given zero-based *index* in a string." msgstr "" +"文字列のゼロから始まる *index* の位置に、コードポイント *value* を書き込みま" +"す。" -#: ../../c-api/unicode.rst:137 msgid "" "The *kind* value and *data* pointer must have been obtained from a string " "using :c:func:`PyUnicode_KIND` and :c:func:`PyUnicode_DATA` respectively. " @@ -190,12 +199,18 @@ msgid "" "PyUnicode_WRITE`. All requirements of :c:func:`PyUnicode_WriteChar` also " "apply." msgstr "" +"*kind* の値と *data* ポインタは、文字列からそれぞれ :c:func:`PyUnicode_KIND` " +"と :c:func:`PyUnicode_DATA` で取得したものでなければなりません。\n" +":c:func:`!PyUnicode_WRITE` の呼び出し中は、その文字列への参照を保持する必要が" +"あります。\n" +":c:func:`PyUnicode_WriteChar` のすべての要件も適用されます。" -#: ../../c-api/unicode.rst:143 msgid "" "The function performs no checks for any of its requirements, and is intended " "for usage in loops." msgstr "" +"この関数は要件が満たされているか一切検査せず、ループ内での使用を想定していま" +"す。" #: ../../c-api/unicode.rst:152 msgid "" @@ -236,17 +251,19 @@ msgstr "" "文字列が、 :ref:`identifiers` 節の言語定義における有効な識別子であれば ``1`` " "を返します。それ以外の場合は ``0`` を返します。" -#: ../../c-api/unicode.rst:181 msgid "" "The function does not call :c:func:`Py_FatalError` anymore if the string is " "not ready." msgstr "" +"文字列が使用可能な状態でなくても、:c:func:`Py_FatalError` を呼び出さなくなり" +"ました。" -#: ../../c-api/unicode.rst:188 msgid "" "Return true if the string only contains ASCII characters. Equivalent to :py:" "meth:`str.isascii`." msgstr "" +"文字列に ASCII 文字しか含まれていなければ真を返します。\n" +":py:meth:`str.isascii` と等価です。" #: ../../c-api/unicode.rst:195 msgid "Unicode Character Properties" @@ -313,11 +330,12 @@ msgid "" "Return ``1`` or ``0`` depending on whether *ch* is an alphanumeric character." msgstr "*ch* が英数文字かどうかに応じて ``1`` または ``0`` を返します。" -#: ../../c-api/unicode.rst:254 msgid "" "Return ``1`` or ``0`` depending on whether *ch* is a printable character, in " "the sense of :meth:`str.isprintable`." msgstr "" +"*ch* が :meth:`str.isprintable` の意味で表示可能な文字かどうかに応じて、" +"``1`` または ``0`` を返します。" #: ../../c-api/unicode.rst:258 msgid "These APIs can be used for fast direct character conversions:" @@ -341,11 +359,13 @@ msgid "" "``-1`` if this is not possible. This function does not raise exceptions." msgstr "" -#: ../../c-api/unicode.rst:284 msgid "" "Return the character *ch* converted to a single digit integer. Return ``-1`` " "if this is not possible. This function does not raise exceptions." msgstr "" +"文字 *ch* を 1 桁の整数に変換して返します。\n" +"変換できなければ ``-1`` を返します。\n" +"この関数は例外を送出しません。" #: ../../c-api/unicode.rst:290 msgid "" @@ -405,11 +425,9 @@ msgstr "" "その値は概算値として 127, 255, 65535, 1114111 の一番近い値に切り上げられま" "す。" -#: ../../c-api/unicode.rst:328 msgid "On error, set an exception and return ``NULL``." -msgstr "" +msgstr "エラー時には例外を設定して ``NULL`` を返します。" -#: ../../c-api/unicode.rst:330 msgid "" "After creation, the string can be filled by :c:func:`PyUnicode_WriteChar`, :" "c:func:`PyUnicode_CopyCharacters`, :c:func:`PyUnicode_Fill`, :c:func:" @@ -417,37 +435,46 @@ msgid "" "take care to not “use” the result while it is being modified. In particular, " "before it's filled with its final contents, a string:" msgstr "" +"作成後の文字列には、:c:func:`PyUnicode_WriteChar`、:c:func:" +"`PyUnicode_CopyCharacters`、:c:func:`PyUnicode_Fill`、:c:func:" +"`PyUnicode_WRITE` などで内容を書き込めます。\n" +"文字列はイミュータブルであることを想定しているため、変更中の結果を「使用」し" +"ないように注意してください。\n" +"特に、最終的な内容を書き込み終える前の文字列に対しては、以下を守る必要があり" +"ます:" -#: ../../c-api/unicode.rst:337 msgid "must not be hashed," -msgstr "" +msgstr "ハッシュ値を計算してはいけません。" -#: ../../c-api/unicode.rst:338 msgid "" "must not be :c:func:`converted to UTF-8 `, or " "another non-\"canonical\" representation," msgstr "" +":c:func:`UTF-8 に変換 ` したり、他の「正統でない」表" +"現形式に変換したりしてはいけません。" -#: ../../c-api/unicode.rst:340 msgid "must not have its reference count changed," -msgstr "" +msgstr "参照カウントを変更してはいけません。" -#: ../../c-api/unicode.rst:341 msgid "must not be shared with code that might do one of the above." -msgstr "" +msgstr "上記のいずれかを行う可能性のあるコードと共有してはいけません。" -#: ../../c-api/unicode.rst:343 msgid "" "This list is not exhaustive. Avoiding these uses is your responsibility; " "Python does not always check these requirements." msgstr "" +"この一覧はすべてを網羅しているわけではありません。\n" +"これらの使用を避けるのは利用側の責任であり、Python が常にこれらの要件を検査す" +"るとは限りません。" -#: ../../c-api/unicode.rst:346 msgid "" "To avoid accidentally exposing a partially-written string object, prefer " "using the :c:type:`PyUnicodeWriter` API, or one of the ``PyUnicode_From*`` " "functions below." msgstr "" +"書き込み途中の文字列オブジェクトを誤って公開しないよう、:c:type:" +"`PyUnicodeWriter` API または以下の ``PyUnicode_From*`` 関数のいずれかを使うこ" +"とを推奨します。" #: ../../c-api/unicode.rst:357 msgid "" @@ -461,37 +488,39 @@ msgstr "" "*buffer* は、与えられた kind に従って1文字あたり 1, 2, 4 バイトのいずれかを単" "位として、長さ *size* の配列へのポインタでなければなりません。" -#: ../../c-api/unicode.rst:362 msgid "" "If necessary, the input *buffer* is copied and transformed into the " "canonical representation. For example, if the *buffer* is a UCS4 string (:c:" "macro:`PyUnicode_4BYTE_KIND`) and it consists only of codepoints in the UCS1 " "range, it will be transformed into UCS1 (:c:macro:`PyUnicode_1BYTE_KIND`)." msgstr "" +"必要に応じて、入力の *buffer* をコピーして正統な表現形式に変換します。\n" +"例えば *buffer* が UCS4 文字列 (:c:macro:`PyUnicode_4BYTE_KIND`) で、UCS1 の" +"範囲内のコードポイントだけで構成されていれば、UCS1 (:c:macro:" +"`PyUnicode_1BYTE_KIND`) に変換します。" -#: ../../c-api/unicode.rst:373 msgid "" "Create a Unicode object from the char buffer *str*. The bytes will be " "interpreted as being UTF-8 encoded. The buffer is copied into the new " "object. The return value might be a shared object, i.e. modification of the " "data is not allowed." msgstr "" +"char 型のバッファ *str* から Unicode オブジェクトを作成します。\n" +"バイト列は UTF-8 でエンコードされているものとして解釈します。\n" +"バッファの内容を新しいオブジェクトにコピーします。\n" +"戻り値は共有オブジェクトの場合があるため、データの変更は許されません。" -#: ../../c-api/unicode.rst:379 msgid "This function raises :exc:`SystemError` when:" -msgstr "" +msgstr "次の場合、この関数は :exc:`SystemError` を送出します:" -#: ../../c-api/unicode.rst:381 msgid "*size* < 0," -msgstr "" +msgstr "*size* < 0 の場合。" -#: ../../c-api/unicode.rst:382 msgid "*str* is ``NULL`` and *size* > 0" -msgstr "" +msgstr "*str* が ``NULL`` で、*size* > 0 の場合。" -#: ../../c-api/unicode.rst:384 msgid "*str* == ``NULL`` with *size* > 0 is not allowed anymore." -msgstr "" +msgstr "*size* > 0 のときに *str* == ``NULL`` を指定できなくなりました。" #: ../../c-api/unicode.rst:390 msgid "" @@ -501,7 +530,6 @@ msgstr "" "UTF-8 エンコードされたnull終端のchar 型バッファ *str* から Unicode オブジェク" "トを生成します。" -#: ../../c-api/unicode.rst:396 msgid "" "Take a C :c:func:`printf`\\ -style *format* string and a variable number of " "arguments, calculate the size of the resulting Python Unicode string and " @@ -509,6 +537,11 @@ msgid "" "must be C types and must correspond exactly to the format characters in the " "*format* ASCII-encoded string." msgstr "" +"C の :c:func:`printf` 形式の書式文字列 *format* と可変個数の引数を受け取り、" +"結果の Python Unicode 文字列のサイズを計算し、値を書式化した文字列を返しま" +"す。\n" +"可変個数の引数は C の型でなければならず、ASCII でエンコードされた *format* 文" +"字列の書式指定文字に厳密に対応していなければなりません。" #: ../../c-api/unicode.rst:402 msgid "" @@ -528,25 +561,31 @@ msgid "" "types." msgstr "変換フラグ (オプション)。一部の変換型の結果に影響します。" -#: ../../c-api/unicode.rst:410 msgid "" "Minimum field width (optional). If specified as an ``'*'`` (asterisk), the " "actual width is given in the next argument, which must be of type :c:expr:" "`int`, and the object to convert comes after the minimum field width and " "optional precision." msgstr "" +"最小フィールド幅 (省略可能)。\n" +"``'*'`` (アスタリスク) を指定した場合は、次の引数に実際の幅を :c:expr:`int` " +"型で渡します。\n" +"変換するオブジェクトは、最小フィールド幅と、省略可能な精度の後に渡します。" -#: ../../c-api/unicode.rst:415 msgid "" "Precision (optional), given as a ``'.'`` (dot) followed by the precision. If " "specified as ``'*'`` (an asterisk), the actual precision is given in the " "next argument, which must be of type :c:expr:`int`, and the value to convert " "comes after the precision." msgstr "" +"精度 (省略可能)。\n" +"``'.'`` (ドット) の後に精度を指定します。\n" +"``'*'`` (アスタリスク) を指定した場合は、次の引数に実際の精度を :c:expr:" +"`int` 型で渡します。\n" +"変換する値は精度の後に渡します。" -#: ../../c-api/unicode.rst:420 msgid "Length modifier (optional)." -msgstr "精度長変換子 (オプション)。" +msgstr "長さ修飾子 (省略可能)。" #: ../../c-api/unicode.rst:422 msgid "Conversion type." @@ -572,22 +611,23 @@ msgstr "``0``" msgid "The conversion will be zero padded for numeric values." msgstr "数値型に対してゼロによるパディングを行います。" -#: ../../c-api/unicode.rst:433 msgid "``-``" -msgstr "" +msgstr "``-``" -#: ../../c-api/unicode.rst:433 msgid "" "The converted value is left adjusted (overrides the ``0`` flag if both are " "given)." msgstr "" +"変換した値を左寄せにします (``0`` フラグも指定されている場合は、こちらが優先" +"されます)。" -#: ../../c-api/unicode.rst:437 msgid "" "The length modifiers for following integer conversions (``d``, ``i``, ``o``, " "``u``, ``x``, or ``X``) specify the type of the argument (:c:expr:`int` by " "default):" msgstr "" +"次の整数変換 (``d``、``i``、``o``、``u``、``x``、``X``) の長さ修飾子は、引数" +"の型 (デフォルトは :c:expr:`int`) を指定します:" #: ../../c-api/unicode.rst:444 msgid "Modifier" @@ -613,21 +653,17 @@ msgstr "``ll``" msgid ":c:expr:`long long` or :c:expr:`unsigned long long`" msgstr ":c:expr:`long long` または :c:expr:`unsigned long long`" -#: ../../c-api/unicode.rst:450 msgid "``j``" -msgstr "" +msgstr "``j``" -#: ../../c-api/unicode.rst:450 msgid ":c:type:`intmax_t` or :c:type:`uintmax_t`" -msgstr "" +msgstr ":c:type:`intmax_t` または :c:type:`uintmax_t`" -#: ../../c-api/unicode.rst:452 msgid "``z``" -msgstr "" +msgstr "``z``" -#: ../../c-api/unicode.rst:452 msgid ":c:type:`size_t` or :c:type:`ssize_t`" -msgstr "" +msgstr ":c:type:`size_t` または :c:type:`ssize_t`" #: ../../c-api/unicode.rst:454 msgid "``t``" @@ -637,19 +673,18 @@ msgstr "``t``" msgid ":c:type:`ptrdiff_t`" msgstr ":c:type:`ptrdiff_t`" -#: ../../c-api/unicode.rst:457 msgid "" "The length modifier ``l`` for following conversions ``s`` or ``V`` specify " "that the type of the argument is :c:expr:`const wchar_t*`." msgstr "" +"変換 ``s`` または ``V`` に付ける長さ修飾子 ``l`` は、引数の型が :c:expr:" +"`const wchar_t*` であることを指定します。" -#: ../../c-api/unicode.rst:460 msgid "The conversion specifiers are:" -msgstr "" +msgstr "変換指定子を以下に示します:" -#: ../../c-api/unicode.rst:466 msgid "Conversion Specifier" -msgstr "" +msgstr "変換指定子" #: ../../c-api/unicode.rst:467 msgid "Type" @@ -667,55 +702,45 @@ msgstr "``%``" msgid "*n/a*" msgstr "*n/a*" -#: ../../c-api/unicode.rst:472 msgid "The literal ``%`` character." -msgstr "" +msgstr "文字 ``%`` そのもの。" -#: ../../c-api/unicode.rst:474 msgid "``d``, ``i``" -msgstr "" +msgstr "``d``, ``i``" -#: ../../c-api/unicode.rst:475 ../../c-api/unicode.rst:479 -#: ../../c-api/unicode.rst:483 ../../c-api/unicode.rst:487 -#: ../../c-api/unicode.rst:491 msgid "Specified by the length modifier" -msgstr "" +msgstr "長さ修飾子で指定" -#: ../../c-api/unicode.rst:476 msgid "The decimal representation of a signed C integer." -msgstr "" +msgstr "符号付き C 整数の 10 進表現。" #: ../../c-api/unicode.rst:478 msgid "``u``" msgstr "``u``" -#: ../../c-api/unicode.rst:480 msgid "The decimal representation of an unsigned C integer." -msgstr "" +msgstr "符号なし C 整数の 10 進表現。" #: ../../c-api/unicode.rst:482 msgid "``o``" msgstr "``o``" -#: ../../c-api/unicode.rst:484 msgid "The octal representation of an unsigned C integer." -msgstr "" +msgstr "符号なし C 整数の 8 進表現。" #: ../../c-api/unicode.rst:486 msgid "``x``" msgstr "``x``" -#: ../../c-api/unicode.rst:488 msgid "The hexadecimal representation of an unsigned C integer (lowercase)." -msgstr "" +msgstr "符号なし C 整数の 16 進表現 (小文字)。" #: ../../c-api/unicode.rst:490 msgid "``X``" msgstr "``X``" -#: ../../c-api/unicode.rst:492 msgid "The hexadecimal representation of an unsigned C integer (uppercase)." -msgstr "" +msgstr "符号なし C 整数の 16 進表現 (大文字)。" #: ../../c-api/unicode.rst:494 msgid "``c``" @@ -725,9 +750,8 @@ msgstr "``c``" msgid ":c:expr:`int`" msgstr ":c:expr:`int`" -#: ../../c-api/unicode.rst:496 msgid "A single character." -msgstr "" +msgstr "1 文字。" #: ../../c-api/unicode.rst:498 msgid "``s``" @@ -785,78 +809,76 @@ msgstr "Unicode オブジェクト。" msgid "``V``" msgstr "``V``" -#: ../../c-api/unicode.rst:518 msgid ":c:expr:`PyObject*`, :c:expr:`const char*` or :c:expr:`const wchar_t*`" msgstr "" +":c:expr:`PyObject*`、:c:expr:`const char*`、または :c:expr:`const wchar_t*`" -#: ../../c-api/unicode.rst:519 msgid "" "A Unicode object (which may be ``NULL``) and a null-terminated C character " "array as a second parameter (which will be used, if the first parameter is " "``NULL``)." msgstr "" +"Unicode オブジェクト (``NULL`` でも構いません) と、2 番目の引数として null 終" +"端の C 文字配列を渡します (最初の引数が ``NULL`` の場合に使われます)。" -#: ../../c-api/unicode.rst:523 msgid "``S``" -msgstr "" +msgstr "``S``" #: ../../c-api/unicode.rst:525 msgid "The result of calling :c:func:`PyObject_Str`." msgstr ":c:func:`PyObject_Str` の戻り値。" -#: ../../c-api/unicode.rst:527 msgid "``R``" -msgstr "" +msgstr "``R``" #: ../../c-api/unicode.rst:529 msgid "The result of calling :c:func:`PyObject_Repr`." msgstr ":c:func:`PyObject_Repr` の戻り値。" -#: ../../c-api/unicode.rst:531 msgid "``T``" -msgstr "" +msgstr "``T``" -#: ../../c-api/unicode.rst:533 msgid "" "Get the fully qualified name of an object type; call :c:func:" "`PyType_GetFullyQualifiedName`." msgstr "" +"オブジェクトの型の完全修飾名を取得します。\n" +":c:func:`PyType_GetFullyQualifiedName` を呼び出します。" -#: ../../c-api/unicode.rst:536 msgid "``#T``" -msgstr "" +msgstr "``#T``" -#: ../../c-api/unicode.rst:538 msgid "" "Similar to ``T`` format, but use a colon (``:``) as separator between the " "module name and the qualified name." msgstr "" +"``T`` 形式と同様ですが、モジュール名と修飾名の区切りにコロン (``:``) を使いま" +"す。" #: ../../c-api/unicode.rst:541 msgid "``N``" msgstr "``N``" -#: ../../c-api/unicode.rst:542 ../../c-api/unicode.rst:547 msgid ":c:expr:`PyTypeObject*`" -msgstr "" +msgstr ":c:expr:`PyTypeObject*`" -#: ../../c-api/unicode.rst:543 msgid "" "Get the fully qualified name of a type; call :c:func:" "`PyType_GetFullyQualifiedName`." msgstr "" +"型の完全修飾名を取得します。\n" +":c:func:`PyType_GetFullyQualifiedName` を呼び出します。" -#: ../../c-api/unicode.rst:546 msgid "``#N``" -msgstr "" +msgstr "``#N``" -#: ../../c-api/unicode.rst:548 msgid "" "Similar to ``N`` format, but use a colon (``:``) as separator between the " "module name and the qualified name." msgstr "" +"``N`` 形式と同様ですが、モジュール名と修飾名の区切りにコロン (``:``) を使いま" +"す。" -#: ../../c-api/unicode.rst:552 msgid "" "The width formatter unit is number of characters rather than bytes. The " "precision formatter unit is number of bytes or :c:type:`wchar_t` items (if " @@ -865,13 +887,20 @@ msgid "" "``\"%A\"``, ``\"%U\"``, ``\"%S\"``, ``\"%R\"`` and ``\"%V\"`` (if the " "``PyObject*`` argument is not ``NULL``)." msgstr "" +"幅の単位はバイト数ではなく文字数です。\n" +"精度の単位は、``\"%s\"`` と ``PyObject*`` 引数が ``NULL`` の場合の " +"``\"%V\"`` では、バイト数または :c:type:`wchar_t` 要素数 (長さ修飾子 ``l`` を" +"使う場合) です。\n" +"``\"%A\"``、``\"%U\"``、``\"%S\"``、``\"%R\"``、および ``PyObject*`` 引数が " +"``NULL`` でない場合の ``\"%V\"`` では、文字数です。" -#: ../../c-api/unicode.rst:560 msgid "" "Unlike to C :c:func:`printf` the ``0`` flag has effect even when a precision " "is given for integer conversions (``d``, ``i``, ``u``, ``o``, ``x``, or " "``X``)." msgstr "" +"C の :c:func:`printf` とは異なり、整数変換 (``d``、``i``、``u``、``o``、" +"``x``、``X``) で精度を指定しても ``0`` フラグは有効です。" #: ../../c-api/unicode.rst:564 msgid "Support for ``\"%lld\"`` and ``\"%llu\"`` added." @@ -889,7 +918,6 @@ msgstr "" "``\"%s\"``, ``\"%A\"``, ``\"%U\"``, ``\"%V\"``, ``\"%S\"``, ``\"%R\"`` での幅" "フォーマッタおよび精度フォーマッタのサポートが追加されました。" -#: ../../c-api/unicode.rst:574 msgid "" "Support for conversion specifiers ``o`` and ``X``. Support for length " "modifiers ``j`` and ``t``. Length modifiers are now applied to all integer " @@ -897,17 +925,23 @@ msgid "" "``s`` and ``V``. Support for variable width and precision ``*``. Support for " "flag ``-``." msgstr "" +"変換指定子 ``o`` と ``X``、長さ修飾子 ``j`` と ``t`` に対応しました。\n" +"長さ修飾子をすべての整数変換に適用するようになりました。\n" +"長さ修飾子 ``l`` を変換指定子 ``s`` と ``V`` に適用するようになりました。\n" +"可変の幅と精度 ``*``、フラグ ``-`` に対応しました。" -#: ../../c-api/unicode.rst:582 msgid "" "An unrecognized format character now sets a :exc:`SystemError`. In previous " "versions it caused all the rest of the format string to be copied as-is to " "the result string, and any extra arguments discarded." msgstr "" +"認識できない書式指定文字があると、:exc:`SystemError` を設定するようになりまし" +"た。\n" +"以前のバージョンでは、書式文字列の残りすべてをそのまま結果の文字列にコピー" +"し、余分な引数を無視していました。" -#: ../../c-api/unicode.rst:586 msgid "Support for ``%T``, ``%#T``, ``%N`` and ``%#N`` formats added." -msgstr "" +msgstr "``%T``、``%#T``、``%N``、``%#N`` 形式のサポートが追加されました。" #: ../../c-api/unicode.rst:592 msgid "" @@ -917,12 +951,15 @@ msgstr "" "ちょうど2つの引数を取ることを除いて、 :c:func:`PyUnicode_FromFormat` と同じ" "です。" -#: ../../c-api/unicode.rst:598 msgid "" "Copy an instance of a Unicode subtype to a new true Unicode object if " "necessary. If *obj* is already a true Unicode object (not a subtype), return " "a new :term:`strong reference` to the object." msgstr "" +"必要に応じて、Unicode のサブタイプのインスタンスを、サブタイプではない新しい " +"Unicode オブジェクトにコピーします。\n" +"*obj* がすでにサブタイプではない Unicode オブジェクトの場合は、そのオブジェク" +"トへの新しい :term:`強参照 ` を返します。" #: ../../c-api/unicode.rst:602 msgid "" @@ -931,15 +968,17 @@ msgstr "" "Unicode やそのサブタイプ以外のオブジェクトでは :exc:`TypeError` が引き起こさ" "れます。" -#: ../../c-api/unicode.rst:607 msgid "Create a Unicode Object from the given Unicode code point *ordinal*." msgstr "" +"指定された Unicode コードポイント *ordinal* から Unicode オブジェクトを作成し" +"ます。" -#: ../../c-api/unicode.rst:609 msgid "" "The ordinal must be in ``range(0x110000)``. A :exc:`ValueError` is raised in " "the case it is not." msgstr "" +"``ordinal`` は ``range(0x110000)`` の範囲内でなければなりません。\n" +"範囲外の場合は :exc:`ValueError` を送出します。" #: ../../c-api/unicode.rst:616 msgid "Decode an encoded object *obj* to a Unicode object." @@ -981,19 +1020,18 @@ msgid "" "releases (\"steals\") this reference." msgstr "" -#: ../../c-api/unicode.rst:637 msgid "On error, set *\\*p_left* to ``NULL`` and set an exception." -msgstr "" +msgstr "エラー時には *\\*p_left* に ``NULL`` を設定し、例外を設定します。" -#: ../../c-api/unicode.rst:639 msgid "On success, set *\\*p_left* to a new strong reference to the result." -msgstr "" +msgstr "成功すると *\\*p_left* に結果への新しい強参照を設定します。" -#: ../../c-api/unicode.rst:644 msgid "" "The function is similar to :c:func:`PyUnicode_Append`, with the only " "difference being that it decrements the reference count of *right* by one." msgstr "" +":c:func:`PyUnicode_Append` と同様ですが、*right* の参照カウントを 1 減らす点" +"だけが異なります。" #: ../../c-api/unicode.rst:650 msgid "" @@ -1004,25 +1042,24 @@ msgid "" "return ``NULL`` on invalid input." msgstr "" -#: ../../c-api/unicode.rst:661 msgid "" "Return the name of the default string encoding, ``\"utf-8\"``. See :func:" "`sys.getdefaultencoding`." msgstr "" +"デフォルトの文字列エンコーディングの名前 ``\"utf-8\"`` を返します。\n" +":func:`sys.getdefaultencoding` を参照してください。" -#: ../../c-api/unicode.rst:664 msgid "" "The returned string does not need to be freed, and is valid until " "interpreter shutdown." -msgstr "" +msgstr "返された文字列を解放する必要はなく、インタープリタの終了まで有効です。" #: ../../c-api/unicode.rst:670 msgid "Return the length of the Unicode object, in code points." msgstr "Unicode オブジェクトの長さをコードポイントで返します。" -#: ../../c-api/unicode.rst:672 msgid "On error, set an exception and return ``-1``." -msgstr "" +msgstr "エラー時には例外を設定して ``-1`` を返します。" #: ../../c-api/unicode.rst:683 msgid "" @@ -1037,36 +1074,41 @@ msgstr "" "失敗のときには ``-1`` を返し、例外を設定します。そうでない場合は、コピーした" "文字数を返します。" -#: ../../c-api/unicode.rst:688 ../../c-api/unicode.rst:718 -#: ../../c-api/unicode.rst:738 msgid "" "The string must not have been “used” yet. See :c:func:`PyUnicode_New` for " "details." msgstr "" +"文字列はまだ「使用」していないものでなければなりません。\n" +"詳細は :c:func:`PyUnicode_New` を参照してください。" -#: ../../c-api/unicode.rst:696 msgid "" "Resize a Unicode object *\\*unicode* to the new *length* in code points." msgstr "" +"Unicode オブジェクト *\\*unicode* のサイズを、コードポイント数で指定した新し" +"い *length* に変更します。" -#: ../../c-api/unicode.rst:698 msgid "" "Try to resize the string in place (which is usually faster than allocating a " "new string and copying characters), or create a new string." msgstr "" +"文字列をその場でサイズ変更しようと試みるか、新しい文字列を作成します。\n" +"その場での変更は通常、新しい文字列を割り当てて文字をコピーするより高速です。" -#: ../../c-api/unicode.rst:701 msgid "" "*\\*unicode* is modified to point to the new (resized) object and ``0`` is " "returned on success. Otherwise, ``-1`` is returned and an exception is set, " "and *\\*unicode* is left untouched." msgstr "" +"成功すると *\\*unicode* が新しい (サイズ変更後の) オブジェクトを指すように変" +"更し、``0`` を返します。\n" +"それ以外の場合は ``-1`` を返して例外を設定し、*\\*unicode* は変更しません。" -#: ../../c-api/unicode.rst:705 msgid "" "The function doesn't check string content, the result may not be a string in " "canonical representation." msgstr "" +"この関数は文字列の内容を検査しないため、結果は正統な表現形式の文字列でない場" +"合があります。" #: ../../c-api/unicode.rst:712 msgid "" @@ -1091,11 +1133,13 @@ msgid "" msgstr "" "書き込んだ文字数を返すか、失敗のときには ``-1`` を返し例外を送出します。" -#: ../../c-api/unicode.rst:730 msgid "" "Write a *character* to the string *unicode* at the zero-based *index*. " "Return ``0`` on success, ``-1`` on error with an exception set." msgstr "" +"文字列 *unicode* のゼロから始まる *index* の位置に *character* を書き込みま" +"す。\n" +"成功すると ``0``、エラー時には例外を設定して ``-1`` を返します。" #: ../../c-api/unicode.rst:733 msgid "" @@ -1116,24 +1160,32 @@ msgstr "" "は *unicode* が Unicode オブジェクトであること、インデックスが範囲内であるこ" "とをチェックします。" -#: ../../c-api/unicode.rst:750 msgid "Return character on success, ``-1`` on error with an exception set." msgstr "" +"成功すると文字を返します。\n" +"エラー時には例外を設定して ``-1`` を返します。" -#: ../../c-api/unicode.rst:758 msgid "" "Return a substring of *unicode*, from character index *start* (included) to " "character index *end* (excluded). Negative indices are not supported. On " "error, set an exception and return ``NULL``." msgstr "" +"文字インデックス *start* (含む) から *end* (含まない) までの *unicode* の部分" +"文字列を返します。\n" +"負のインデックスはサポートしません。\n" +"エラー時には例外を設定して ``NULL`` を返します。" -#: ../../c-api/unicode.rst:768 msgid "" "Copy the string *unicode* into a UCS4 buffer, including a null character, if " "*copy_null* is set. Returns ``NULL`` and sets an exception on error (in " "particular, a :exc:`SystemError` if *buflen* is smaller than the length of " "*unicode*). *buffer* is returned on success." msgstr "" +"文字列 *unicode* を UCS4 バッファにコピーします。\n" +"*copy_null* が設定されている場合は null 文字も含めます。\n" +"エラー時には ``NULL`` を返して例外を設定します (特に *buflen* が *unicode* の" +"長さより小さい場合は :exc:`SystemError` を設定します)。\n" +"成功すると *buffer* を返します。" #: ../../c-api/unicode.rst:778 msgid "" @@ -1159,7 +1211,6 @@ msgstr "" "現在のロケールエンコーディングはオペレーティングシステムのテキストをデコード" "するのに使えます。" -#: ../../c-api/unicode.rst:796 msgid "" "Decode a string from UTF-8 on Android and VxWorks, or from the current " "locale encoding on other platforms. The supported error handlers are " @@ -1167,16 +1218,25 @@ msgid "" "``\"strict\"`` error handler if *errors* is ``NULL``. *str* must end with a " "null character but cannot contain embedded null characters." msgstr "" +"Android と VxWorks では UTF-8、それ以外のプラットフォームでは現在のロケールエ" +"ンコーディングで文字列をデコードします。\n" +"対応するエラーハンドラは ``\"strict\"`` と ``\"surrogateescape\"`` (:pep:" +"`383`) です。\n" +"*errors* が ``NULL`` の場合、デコーダは ``\"strict\"`` エラーハンドラを使いま" +"す。\n" +"*str* は null 文字で終端されている必要がありますが、内部に null 文字を含める" +"ことはできません。" -#: ../../c-api/unicode.rst:803 msgid "" "Use :c:func:`PyUnicode_DecodeFSDefaultAndSize` to decode a string from the :" "term:`filesystem encoding and error handler`." msgstr "" +":term:`ファイルシステムのエンコーディングとエラーハンドラ ` で文字列をデコードするには、:c:func:" +"`PyUnicode_DecodeFSDefaultAndSize` を使ってください。" -#: ../../c-api/unicode.rst:806 ../../c-api/unicode.rst:841 msgid "This function ignores the :ref:`Python UTF-8 Mode `." -msgstr "" +msgstr "この関数は :ref:`Python UTF-8 モード ` を無視します。" #: ../../c-api/unicode.rst:810 ../../c-api/unicode.rst:926 msgid "The :c:func:`Py_DecodeLocale` function." @@ -1194,13 +1254,13 @@ msgstr "" "以前は、 :c:func:`Py_DecodeLocale` が ``surrogateescape`` で使われ、現在のロ" "ケールエンコーディングは ``strict`` で使われていました。" -#: ../../c-api/unicode.rst:823 msgid "" "Similar to :c:func:`PyUnicode_DecodeLocaleAndSize`, but compute the string " "length using :c:func:`!strlen`." msgstr "" +":c:func:`PyUnicode_DecodeLocaleAndSize` と同様ですが、文字列の長さを :c:func:" +"`!strlen` で計算します。" -#: ../../c-api/unicode.rst:831 msgid "" "Encode a Unicode object to UTF-8 on Android and VxWorks, or to the current " "locale encoding on other platforms. The supported error handlers are " @@ -1208,12 +1268,22 @@ msgid "" "``\"strict\"`` error handler if *errors* is ``NULL``. Return a :class:" "`bytes` object. *unicode* cannot contain embedded null characters." msgstr "" +"Android と VxWorks では UTF-8、それ以外のプラットフォームでは現在のロケールエ" +"ンコーディングで Unicode オブジェクトをエンコードします。\n" +"対応するエラーハンドラは ``\"strict\"`` と ``\"surrogateescape\"`` (:pep:" +"`383`) です。\n" +"*errors* が ``NULL`` の場合、エンコーダは ``\"strict\"`` エラーハンドラを使い" +"ます。\n" +":class:`bytes` オブジェクトを返します。\n" +"*unicode* の内部に null 文字を含めることはできません。" -#: ../../c-api/unicode.rst:838 msgid "" "Use :c:func:`PyUnicode_EncodeFSDefault` to encode a string to the :term:" "`filesystem encoding and error handler`." msgstr "" +":term:`ファイルシステムのエンコーディングとエラーハンドラ ` で文字列をエンコードするには、:c:func:" +"`PyUnicode_EncodeFSDefault` を使ってください。" #: ../../c-api/unicode.rst:845 ../../c-api/unicode.rst:957 msgid "The :c:func:`Py_EncodeLocale` function." @@ -1235,20 +1305,23 @@ msgstr "" msgid "File System Encoding" msgstr "ファイルシステムエンコーディング" -#: ../../c-api/unicode.rst:860 msgid "" "Functions encoding to and decoding from the :term:`filesystem encoding and " "error handler` (:pep:`383` and :pep:`529`)." msgstr "" +":term:`ファイルシステムのエンコーディングとエラーハンドラ ` でエンコードとデコードを行う関数です (:pep:" +"`383` と :pep:`529`)。" -#: ../../c-api/unicode.rst:863 msgid "" "To encode file names to :class:`bytes` during argument parsing, the " "``\"O&\"`` converter should be used, passing :c:func:`!" "PyUnicode_FSConverter` as the conversion function:" msgstr "" +"引数の解析中にファイル名を :class:`bytes` にエンコードするには、変換関数に :" +"c:func:`!PyUnicode_FSConverter` を渡して ``\"O&\"`` コンバータを使ってくださ" +"い:" -#: ../../c-api/unicode.rst:869 msgid "" ":ref:`PyArg_Parse\\* converter `: encode :class:`str` objects " "-- obtained directly or through the :class:`os.PathLike` interface -- to :" @@ -1260,25 +1333,39 @@ msgid "" "a non-zero value (:c:macro:`Py_CLEANUP_SUPPORTED`). Embedded null bytes are " "not allowed in the result. On failure, return ``0`` with an exception set." msgstr "" +":ref:`PyArg_Parse\\* コンバータ ` です。\n" +"直接、または :class:`os.PathLike` インターフェースを通じて取得した :class:" +"`str` オブジェクトを、:c:func:`PyUnicode_EncodeFSDefault` で :class:`bytes` " +"にエンコードします。\n" +":class:`bytes` オブジェクトはそのまま出力します。\n" +"*result* は :c:expr:`PyObject*` 型 (または :c:expr:`PyBytesObject*` 型) の C " +"変数のアドレスでなければなりません。\n" +"成功すると、その変数に :ref:`bytes オブジェクト ` への新しい :" +"term:`強参照 ` を設定し、ゼロ以外の値 (:c:macro:" +"`Py_CLEANUP_SUPPORTED`) を返します。\n" +"この参照は使わなくなったら解放する必要があります。\n" +"結果の内部に null バイトを含めることはできません。\n" +"失敗すると例外を設定して ``0`` を返します。" -#: ../../c-api/unicode.rst:881 msgid "" "If *obj* is ``NULL``, the function releases a strong reference stored in the " "variable referred by *result* and returns ``1``." msgstr "" +"*obj* が ``NULL`` の場合、*result* が指す変数に格納された強参照を解放し、" +"``1`` を返します。" #: ../../c-api/unicode.rst:886 ../../c-api/unicode.rst:913 msgid "Accepts a :term:`path-like object`." msgstr ":term:`path-like object` を受け入れるようになりました。" -#: ../../c-api/unicode.rst:889 msgid "" "To decode file names to :class:`str` during argument parsing, the ``\"O&\"`` " "converter should be used, passing :c:func:`!PyUnicode_FSDecoder` as the " "conversion function:" msgstr "" +"引数の解析中にファイル名を :class:`str` にデコードするには、変換関数に :c:" +"func:`!PyUnicode_FSDecoder` を渡して ``\"O&\"`` コンバータを使ってください:" -#: ../../c-api/unicode.rst:895 msgid "" ":ref:`PyArg_Parse\\* converter `: decode :class:`bytes` objects " "-- obtained either directly or indirectly through the :class:`os.PathLike` " @@ -1291,54 +1378,77 @@ msgid "" "`Py_CLEANUP_SUPPORTED`). Embedded null characters are not allowed in the " "result. On failure, return ``0`` with an exception set." msgstr "" +":ref:`PyArg_Parse\\* コンバータ ` です。\n" +"直接、または :class:`os.PathLike` インターフェースを通じて間接的に取得した :" +"class:`bytes` オブジェクトを、:c:func:`PyUnicode_DecodeFSDefaultAndSize` で :" +"class:`str` にデコードします。\n" +":class:`str` オブジェクトはそのまま出力します。\n" +"*result* は :c:expr:`PyObject*` 型 (または :c:expr:`PyUnicodeObject*` 型) の " +"C 変数のアドレスでなければなりません。\n" +"成功すると、その変数に :ref:`Unicode オブジェクト ` への新し" +"い :term:`強参照 ` を設定し、ゼロ以外の値 (:c:macro:" +"`Py_CLEANUP_SUPPORTED`) を返します。\n" +"この参照は使わなくなったら解放する必要があります。\n" +"結果の内部に null 文字を含めることはできません。\n" +"失敗すると例外を設定して ``0`` を返します。" -#: ../../c-api/unicode.rst:908 msgid "" "If *obj* is ``NULL``, release the strong reference to the object referred to " "by *result* and return ``1``." msgstr "" +"*obj* が ``NULL`` の場合、*result* が指すオブジェクトへの強参照を解放し、" +"``1`` を返します。" -#: ../../c-api/unicode.rst:919 msgid "Decode a string from the :term:`filesystem encoding and error handler`." msgstr "" +":term:`ファイルシステムのエンコーディングとエラーハンドラ ` で文字列をデコードします。" -#: ../../c-api/unicode.rst:921 msgid "" "If you need to decode a string from the current locale encoding, use :c:func:" "`PyUnicode_DecodeLocaleAndSize`." msgstr "" +"現在のロケールエンコーディングで文字列をデコードするには、:c:func:" +"`PyUnicode_DecodeLocaleAndSize` を使ってください。" -#: ../../c-api/unicode.rst:928 ../../c-api/unicode.rst:941 -#: ../../c-api/unicode.rst:961 msgid "" "The :term:`filesystem error handler ` " "is now used." msgstr "" +":term:`ファイルシステムのエラーハンドラ ` を使うようになりました。" -#: ../../c-api/unicode.rst:935 msgid "" "Decode a null-terminated string from the :term:`filesystem encoding and " "error handler`." msgstr "" +":term:`ファイルシステムのエンコーディングとエラーハンドラ ` で null 終端の文字列をデコードします。" -#: ../../c-api/unicode.rst:938 msgid "" "If the string length is known, use :c:func:" "`PyUnicode_DecodeFSDefaultAndSize`." msgstr "" +"文字列の長さが分かっている場合は、:c:func:`PyUnicode_DecodeFSDefaultAndSize` " +"を使ってください。" -#: ../../c-api/unicode.rst:948 msgid "" "Encode a Unicode object to the :term:`filesystem encoding and error " "handler`, and return :class:`bytes`. Note that the resulting :class:`bytes` " "object can contain null bytes." msgstr "" +":term:`ファイルシステムのエンコーディングとエラーハンドラ ` で Unicode オブジェクトをエンコードし、:class:" +"`bytes` を返します。\n" +"結果の :class:`bytes` オブジェクトには null バイトが含まれる場合があることに" +"注意してください。" -#: ../../c-api/unicode.rst:952 msgid "" "If you need to encode a string to the current locale encoding, use :c:func:" "`PyUnicode_EncodeLocale`." msgstr "" +"現在のロケールエンコーディングで文字列をエンコードするには、:c:func:" +"`PyUnicode_EncodeLocale` を使ってください。" #: ../../c-api/unicode.rst:966 msgid "wchar_t Support" @@ -1348,29 +1458,37 @@ msgstr "wchar_t サポート" msgid ":c:type:`wchar_t` support for platforms which support it:" msgstr ":c:type:`wchar_t` をサポートするプラットフォームでの wchar_t サポート:" -#: ../../c-api/unicode.rst:972 msgid "" "Create a Unicode object from the :c:type:`wchar_t` buffer *wstr* of the " "given *size*. Passing ``-1`` as the *size* indicates that the function must " "itself compute the length, using :c:func:`!wcslen`. Return ``NULL`` on " "failure." msgstr "" +"指定された *size* の :c:type:`wchar_t` バッファ *wstr* から Unicode オブジェ" +"クトを作成します。\n" +"*size* に ``-1`` を渡すと、この関数自身が :c:func:`!wcslen` を使って長さを計" +"算します。\n" +"失敗すると ``NULL`` を返します。" -#: ../../c-api/unicode.rst:980 msgid "" "Copy the Unicode object contents into the :c:type:`wchar_t` buffer *wstr*. " "At most *size* :c:type:`wchar_t` characters are copied (excluding a possibly " "trailing null termination character). Return the number of :c:type:" "`wchar_t` characters copied or ``-1`` in case of an error." msgstr "" +"Unicode オブジェクトの内容を :c:type:`wchar_t` バッファ *wstr* にコピーしま" +"す。\n" +"最大で *size* 個の :c:type:`wchar_t` 文字をコピーします (末尾に付く場合がある" +"終端の null 文字を除きます)。\n" +"コピーした :c:type:`wchar_t` 文字の数、またはエラー時には ``-1`` を返します。" -#: ../../c-api/unicode.rst:985 msgid "" "When *wstr* is ``NULL``, instead return the *size* that would be required to " "store all of *unicode* including a terminating null." msgstr "" +"*wstr* が ``NULL`` の場合は、代わりに終端の null 文字も含めて *unicode* 全体" +"を格納するのに必要な *size* を返します。" -#: ../../c-api/unicode.rst:988 msgid "" "Note that the resulting :c:expr:`wchar_t*` string may or may not be null-" "terminated. It is the responsibility of the caller to make sure that the :c:" @@ -1379,8 +1497,13 @@ msgid "" "null characters, which would cause the string to be truncated when used with " "most C functions." msgstr "" +"結果の :c:expr:`wchar_t*` 文字列は、null 終端される場合とされない場合があるこ" +"とに注意してください。\n" +"アプリケーションが null 終端を必要とする場合、:c:expr:`wchar_t*` 文字列が " +"null 終端されていることを保証するのは呼び出し側の責任です。\n" +"また、:c:expr:`wchar_t*` 文字列の内部に null 文字が含まれる場合があり、その場" +"合はほとんどの C 関数で文字列が途中で切れてしまうことにも注意してください。" -#: ../../c-api/unicode.rst:998 msgid "" "Convert the Unicode object to a wide character string. The output string " "always ends with a null character. If *size* is not ``NULL``, write the " @@ -1390,19 +1513,31 @@ msgid "" "when used with most C functions. If *size* is ``NULL`` and the :c:expr:" "`wchar_t*` string contains null characters a :exc:`ValueError` is raised." msgstr "" +"Unicode オブジェクトをワイド文字列に変換します。\n" +"出力文字列は常に null 文字で終わります。\n" +"*size* が ``NULL`` でなければ、ワイド文字の数 (末尾の終端 null 文字を除く) " +"を *\\*size* に書き込みます。\n" +"結果の :c:type:`wchar_t` 文字列の内部に null 文字が含まれる場合があり、その場" +"合はほとんどの C 関数で文字列が途中で切れてしまうことに注意してください。\n" +"*size* が ``NULL`` で、:c:expr:`wchar_t*` 文字列の内部に null 文字が含まれて" +"いる場合は、:exc:`ValueError` を送出します。" -#: ../../c-api/unicode.rst:1006 msgid "" "Returns a buffer allocated by :c:macro:`PyMem_New` (use :c:func:`PyMem_Free` " "to free it) on success. On error, returns ``NULL`` and *\\*size* is " "undefined. Raises a :exc:`MemoryError` if memory allocation is failed." msgstr "" +"成功すると、:c:macro:`PyMem_New` で割り当てたバッファを返します (:c:func:" +"`PyMem_Free` で解放してください)。\n" +"エラー時には ``NULL`` を返し、*\\*size* は未定義です。\n" +"メモリの割り当てに失敗すると :exc:`MemoryError` を送出します。" -#: ../../c-api/unicode.rst:1013 msgid "" "Raises a :exc:`ValueError` if *size* is ``NULL`` and the :c:expr:`wchar_t*` " "string contains null characters." msgstr "" +"*size* が ``NULL`` で、:c:expr:`wchar_t*` 文字列の内部に null 文字が含まれて" +"いる場合は、:exc:`ValueError` を送出するようになりました。" #: ../../c-api/unicode.rst:1021 msgid "Built-in Codecs" @@ -1426,13 +1561,18 @@ msgstr "" "らのパラメータは、組み込みの文字列コンストラクタである :func:`str` における同" "名のパラメータと同じ意味を持ちます。" -#: ../../c-api/unicode.rst:1030 msgid "" "Setting encoding to ``NULL`` causes the default encoding to be used which is " "UTF-8. The file system calls should use :c:func:`PyUnicode_FSConverter` for " "encoding file names. This uses the :term:`filesystem encoding and error " "handler` internally." msgstr "" +"``encoding`` に ``NULL`` を設定すると、デフォルトのエンコーディングである " +"UTF-8 を使います。\n" +"ファイルシステムの呼び出しでファイル名をエンコードするには、:c:func:" +"`PyUnicode_FSConverter` を使ってください。\n" +"これは内部で :term:`ファイルシステムのエンコーディングとエラーハンドラ " +"` を使います。" #: ../../c-api/unicode.rst:1035 msgid "" @@ -1458,25 +1598,23 @@ msgstr "" msgid "Generic Codecs" msgstr "汎用 codec" -#: ../../c-api/unicode.rst:1046 msgid "The following macro is provided:" -msgstr "" +msgstr "次のマクロが用意されています:" -#: ../../c-api/unicode.rst:1051 msgid "The Unicode code point ``U+FFFD`` (replacement character)." -msgstr "" +msgstr "Unicode コードポイント ``U+FFFD`` (置換文字)。" -#: ../../c-api/unicode.rst:1053 msgid "" "This Unicode character is used as the replacement character during decoding " "if the *errors* argument is set to \"replace\"." msgstr "" +"*errors* 引数が \"replace\" の場合、この Unicode 文字をデコード時の置換文字と" +"して使います。" #: ../../c-api/unicode.rst:1057 msgid "These are the generic codec APIs:" msgstr "以下は汎用 codec の API です:" -#: ../../c-api/unicode.rst:1063 msgid "" "Create a Unicode object by decoding *size* bytes of the encoded string " "*str*. *encoding* and *errors* have the same meaning as the parameters of " @@ -1484,6 +1622,12 @@ msgid "" "looked up using the Python codec registry. Return ``NULL`` if an exception " "was raised by the codec." msgstr "" +"エンコードされた文字列 *str* の *size* バイトをデコードし、Unicode オブジェク" +"トを作成します。\n" +"*encoding* と *errors* の意味は、組み込み関数 :func:`str` の同名の引数と同じ" +"です。\n" +"使用する codec は Python の codec レジストリで検索します。\n" +"codec が例外を送出した場合は ``NULL`` を返します。" #: ../../c-api/unicode.rst:1073 msgid "" @@ -1538,11 +1682,12 @@ msgstr "" "トとして返します。エラー処理は \"strict\" です。 codec が例外を送出した場合に" "は ``NULL`` を返します。" -#: ../../c-api/unicode.rst:1107 ../../c-api/unicode.rst:1122 msgid "" "The function fails if the string contains surrogate code points (``U+D800`` " "- ``U+DFFF``)." msgstr "" +"文字列にサロゲートコードポイント (``U+D800`` - ``U+DFFF``) が含まれていると、" +"この関数は失敗します。" #: ../../c-api/unicode.rst:1113 msgid "" @@ -1558,13 +1703,13 @@ msgstr "" "返されるバッファには、 null コードポイントがあるかどうかに関わらず、常に " "null バイトが終端に付加されています (これは *size* には勘定されません)。" -#: ../../c-api/unicode.rst:1119 msgid "" "On error, set an exception, set *size* to ``-1`` (if it's not NULL) and " "return ``NULL``." msgstr "" +"エラー時には例外を設定し、*size* が ``NULL`` でなければ ``-1`` を格納して、" +"``NULL`` を返します。" -#: ../../c-api/unicode.rst:1125 msgid "" "This caches the UTF-8 representation of the string in the Unicode object, " "and subsequent calls will return a pointer to the same buffer. The caller " @@ -1572,21 +1717,24 @@ msgid "" "and pointers to it become invalid when the Unicode object is garbage " "collected." msgstr "" +"この関数は Unicode オブジェクト内に文字列の UTF-8 表現をキャッシュし、それ以" +"降の呼び出しでは同じバッファへのポインタを返します。\n" +"呼び出し側がバッファを解放する必要はありません。\n" +"Unicode オブジェクトがガベージコレクションで回収されるとバッファは解放され、" +"それを指すポインタは無効になります。" #: ../../c-api/unicode.rst:1132 ../../c-api/unicode.rst:1154 msgid "The return type is now ``const char *`` rather of ``char *``." msgstr "返り値の型が ``char *`` ではなく ``const char *`` になりました。" -#: ../../c-api/unicode.rst:1135 msgid "This function is a part of the :ref:`limited API `." -msgstr "" +msgstr "この関数が :ref:`制限付き API ` の一部になりました。" #: ../../c-api/unicode.rst:1141 msgid "As :c:func:`PyUnicode_AsUTF8AndSize`, but does not store the size." msgstr "" ":c:func:`PyUnicode_AsUTF8AndSize` とほぼ同じですが、サイズを格納しません。" -#: ../../c-api/unicode.rst:1145 msgid "" "This function does not have any special behavior for `null characters " "`_ embedded within *unicode*. " @@ -1595,6 +1743,12 @@ msgid "" "leading to truncation. If truncation is an issue, it is recommended to use :" "c:func:`PyUnicode_AsUTF8AndSize` instead." msgstr "" +"この関数は、*unicode* の内部に含まれる `null 文字 `_ を特別に扱いません。\n" +"そのため、返された文字列にも null 文字が残り、一部の C 関数はそれを文字列の末" +"尾と解釈するため、途中で切れてしまう場合があります。\n" +"これが問題になる場合は、代わりに :c:func:`PyUnicode_AsUTF8AndSize` を使うこと" +"を推奨します。" #: ../../c-api/unicode.rst:1159 msgid "UTF-32 Codecs" @@ -1622,12 +1776,14 @@ msgstr "" "*byteorder* が ``NULL`` でない時、デコーダは与えられたバイトオーダーでデコー" "ドを開始します。 ::" -#: ../../c-api/unicode.rst:1174 ../../c-api/unicode.rst:1224 msgid "" "*byteorder == -1: little endian\n" "*byteorder == 0: native order\n" "*byteorder == 1: big endian" msgstr "" +"*byteorder == -1: リトルエンディアン\n" +"*byteorder == 0: ネイティブのバイト順\n" +"*byteorder == 1: ビッグエンディアン" #: ../../c-api/unicode.rst:1178 msgid "" @@ -1759,11 +1915,13 @@ msgstr "UTF-7 Codecs" msgid "These are the UTF-7 codec APIs:" msgstr "以下は UTF-7 codec の API です:" -#: ../../c-api/unicode.rst:1267 msgid "" "Create a Unicode object by decoding *size* bytes of the UTF-7 encoded string " "*str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" +"UTF-7 でエンコードされた文字列 *str* の *size* バイトをデコードし、Unicode オ" +"ブジェクトを作成します。\n" +"codec が例外を送出した場合は ``NULL`` を返します。" #: ../../c-api/unicode.rst:1274 msgid "" @@ -1785,12 +1943,14 @@ msgstr "Unicode-Escape Codecs" msgid "These are the \"Unicode Escape\" codec APIs:" msgstr "以下は \"Unicode Escape\" codec の API です:" -#: ../../c-api/unicode.rst:1289 msgid "" "Create a Unicode object by decoding *size* bytes of the Unicode-Escape " "encoded string *str*. Return ``NULL`` if an exception was raised by the " "codec." msgstr "" +"Unicode-Escape でエンコードされた文字列 *str* の *size* バイトをデコードし、" +"Unicode オブジェクトを作成します。\n" +"codec が例外を送出した場合は ``NULL`` を返します。" #: ../../c-api/unicode.rst:1295 msgid "" @@ -1811,12 +1971,14 @@ msgstr "Raw-Unicode-Escape Codecs" msgid "These are the \"Raw Unicode Escape\" codec APIs:" msgstr "以下は \"Raw Unicode Escape\" codec の APIです:" -#: ../../c-api/unicode.rst:1309 msgid "" "Create a Unicode object by decoding *size* bytes of the Raw-Unicode-Escape " "encoded string *str*. Return ``NULL`` if an exception was raised by the " "codec." msgstr "" +"Raw-Unicode-Escape でエンコードされた文字列 *str* の *size* バイトをデコード" +"し、Unicode オブジェクトを作成します。\n" +"codec が例外を送出した場合は ``NULL`` を返します。" #: ../../c-api/unicode.rst:1315 msgid "" @@ -1872,11 +2034,13 @@ msgstr "" "以下は ASCII codec の APIです。 7 ビットの ASCII データだけを受理します。その" "他のコードはエラーになります。" -#: ../../c-api/unicode.rst:1349 msgid "" "Create a Unicode object by decoding *size* bytes of the ASCII encoded string " "*str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" +"ASCII でエンコードされた文字列 *str* の *size* バイトをデコードし、Unicode オ" +"ブジェクトを作成します。\n" +"codec が例外を送出した場合は ``NULL`` を返します。" #: ../../c-api/unicode.rst:1355 msgid "" @@ -1924,7 +2088,6 @@ msgstr "" "字列 *str* をデコードして Unicode オブジェクトを作成します。\n" "codec が例外を発生させたときは ``NULL`` を返します。" -#: ../../c-api/unicode.rst:1378 msgid "" "If *mapping* is ``NULL``, Latin-1 decoding will be applied. Else *mapping* " "must map bytes ordinals (integers in the range from 0 to 255) to Unicode " @@ -1933,6 +2096,13 @@ msgid "" "well as ones which get mapped to ``None``, ``0xFFFE`` or ``'\\ufffe'``, are " "treated as undefined mappings and cause an error." msgstr "" +"*mapping* が ``NULL`` の場合は Latin-1 でデコードします。\n" +"それ以外の場合、*mapping* はバイト値 (0 から 255 の範囲の整数) を、Unicode 文" +"字列、整数 (Unicode の序数として解釈)、または ``None`` に対応づける必要があり" +"ます。\n" +"対応のないバイト、つまり :exc:`LookupError` を引き起こすバイトや、``None``、" +"``0xFFFE``、``'\\ufffe'`` に対応づけられたバイトは、未定義の対応として扱い、" +"エラーになります。" #: ../../c-api/unicode.rst:1389 msgid "" @@ -1944,13 +2114,16 @@ msgstr "" "し、結果を bytes オブジェクトとして返します。エラー処理は \"strict\" です。 " "codec が例外を送出した場合には ``NULL`` を返します。" -#: ../../c-api/unicode.rst:1393 msgid "" "The *mapping* object must map Unicode ordinal integers to bytes objects, " "integers in the range from 0 to 255 or ``None``. Unmapped character " "ordinals (ones which cause a :exc:`LookupError`) as well as mapped to " "``None`` are treated as \"undefined mapping\" and cause an error." msgstr "" +"*mapping* オブジェクトは、Unicode の序数を表す整数を、bytes オブジェクト、0 " +"から 255 の範囲の整数、または ``None`` に対応づける必要があります。\n" +"対応のない文字の序数 (:exc:`LookupError` を引き起こすもの) や、``None`` に対" +"応づけられたものは「未定義の対応」として扱い、エラーになります。" #: ../../c-api/unicode.rst:1399 msgid "The following codec API is special in that maps Unicode to Unicode." @@ -1974,12 +2147,15 @@ msgstr "" "対応表は、Unicode 序数を表す整数を Unicode 序数を表す整数または ``None`` (そ" "の文字を削除する) に対応付けなければなりません。" -#: ../../c-api/unicode.rst:1410 msgid "" "Mapping tables need only provide the :meth:`~object.__getitem__` interface; " "dictionaries and sequences work well. Unmapped character ordinals (ones " "which cause a :exc:`LookupError`) are left untouched and are copied as-is." msgstr "" +"対応表には :meth:`~object.__getitem__` インターフェースだけが必要で、辞書や" +"シーケンスを使えます。\n" +"対応のない文字の序数 (:exc:`LookupError` を引き起こすもの) は変更せず、そのま" +"まコピーします。" #: ../../c-api/unicode.rst:1414 msgid "" @@ -2007,11 +2183,13 @@ msgstr "" "式 (target encoding) は、 codec を動作させているマシン上のユーザ設定で定義さ" "れています。" -#: ../../c-api/unicode.rst:1428 msgid "" "Create a Unicode object by decoding *size* bytes of the MBCS encoded string " "*str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" +"MBCS でエンコードされた文字列 *str* の *size* バイトをデコードし、Unicode オ" +"ブジェクトを作成します。\n" +"codec が例外を送出した場合は ``NULL`` を返します。" #: ../../c-api/unicode.rst:1435 msgid "" @@ -2025,11 +2203,12 @@ msgstr "" "`PyUnicode_DecodeMBCSStateful` は文字列の最後にあるマルチバイト文字の前半バイ" "トをデコードせず、 *consumed* にデコードしたバイト数を格納します。" -#: ../../c-api/unicode.rst:1444 msgid "" "Similar to :c:func:`PyUnicode_DecodeMBCSStateful`, except uses the code page " "specified by *code_page*." msgstr "" +":c:func:`PyUnicode_DecodeMBCSStateful` と同様ですが、*code_page* で指定した" +"コードページを使います。" #: ../../c-api/unicode.rst:1450 msgid "" @@ -2041,12 +2220,16 @@ msgstr "" "トとして返します。エラー処理は \"strict\" です。 codec が例外を送出した場合に" "は ``NULL`` を返します。" -#: ../../c-api/unicode.rst:1457 msgid "" "Encode the Unicode object using the specified code page and return a Python " "bytes object. Return ``NULL`` if an exception was raised by the codec. Use :" "c:macro:`!CP_ACP` code page to get the MBCS encoder." msgstr "" +"指定されたコードページで Unicode オブジェクトをエンコードし、Python の bytes " +"オブジェクトを返します。\n" +"codec が例外を送出した場合は ``NULL`` を返します。\n" +"MBCS エンコーダを使うには、コードページに :c:macro:`!CP_ACP` を指定してくださ" +"い。" #: ../../c-api/unicode.rst:1465 msgid "Methods & Slots" @@ -2076,7 +2259,6 @@ msgstr "" msgid "Concat two strings giving a new Unicode string." msgstr "二つの文字列を結合して、新たな Unicode 文字列を生成します。" -#: ../../c-api/unicode.rst:1487 msgid "" "Split a string giving a list of Unicode strings. If *sep* is ``NULL``, " "splitting will be done at all whitespace substrings. Otherwise, splits " @@ -2084,64 +2266,65 @@ msgid "" "negative, no limit is set. Separators are not included in the resulting " "list." msgstr "" -"Unicode 文字列のリストを分割して、 Unicode 文字列からなるリストを返します。 " -"*sep* が ``NULL`` の場合、全ての空白文字を使って分割を行います。それ以外の場" -"合、指定された文字を使って分割を行います。最大で *maxsplit* 個までの分割を行" -"います。 *maxsplit* が負ならば分割数に制限を設けません。分割結果のリスト内に" -"は分割文字は含みません。" +"文字列を分割し、Unicode 文字列のリストを返します。\n" +"*sep* が ``NULL`` の場合は、すべての空白部分で分割します。\n" +"それ以外の場合は、指定された区切り文字列で分割します。\n" +"分割回数は最大で *maxsplit* 回です。\n" +"負の値なら回数に制限はありません。\n" +"結果のリストには区切り文字列を含めません。" -#: ../../c-api/unicode.rst:1492 ../../c-api/unicode.rst:1502 -#: ../../c-api/unicode.rst:1523 ../../c-api/unicode.rst:1536 msgid "On error, return ``NULL`` with an exception set." -msgstr "" +msgstr "エラー時には例外を設定して ``NULL`` を返します。" -#: ../../c-api/unicode.rst:1494 msgid "Equivalent to :py:meth:`str.split`." -msgstr "" +msgstr ":py:meth:`str.split` と等価です。" -#: ../../c-api/unicode.rst:1499 msgid "" "Similar to :c:func:`PyUnicode_Split`, but splitting will be done beginning " "at the end of the string." -msgstr "" +msgstr ":c:func:`PyUnicode_Split` と同様ですが、文字列の末尾から分割します。" -#: ../../c-api/unicode.rst:1504 msgid "Equivalent to :py:meth:`str.rsplit`." -msgstr "" +msgstr ":py:meth:`str.rsplit` と等価です。" -#: ../../c-api/unicode.rst:1509 msgid "" "Split a Unicode string at line breaks, returning a list of Unicode strings. " "CRLF is considered to be one line break. If *keepends* is ``0``, the Line " "break characters are not included in the resulting strings." msgstr "" +"Unicode 文字列を改行位置で分割し、Unicode 文字列のリストを返します。\n" +"CRLF は 1 つの改行とみなします。\n" +"*keepends* が ``0`` の場合、結果の文字列に改行文字を含めません。" -#: ../../c-api/unicode.rst:1516 msgid "" "Split a Unicode string at the first occurrence of *sep*, and return a 3-" "tuple containing the part before the separator, the separator itself, and " "the part after the separator. If the separator is not found, return a 3-" "tuple containing the string itself, followed by two empty strings." msgstr "" +"Unicode 文字列を *sep* が最初に現れる位置で分割し、区切り文字列より前の部分、" +"区切り文字列自体、その後の部分を含む 3 要素のタプルを返します。\n" +"区切り文字列が見つからなければ、元の文字列と、その後に 2 つの空文字列を含む " +"3 要素のタプルを返します。" -#: ../../c-api/unicode.rst:1521 ../../c-api/unicode.rst:1534 msgid "*sep* must not be empty." -msgstr "" +msgstr "*sep* は空であってはなりません。" -#: ../../c-api/unicode.rst:1525 msgid "Equivalent to :py:meth:`str.partition`." -msgstr "" +msgstr ":py:meth:`str.partition` と等価です。" -#: ../../c-api/unicode.rst:1530 msgid "" "Similar to :c:func:`PyUnicode_Partition`, but split a Unicode string at the " "last occurrence of *sep*. If the separator is not found, return a 3-tuple " "containing two empty strings, followed by the string itself." msgstr "" +":c:func:`PyUnicode_Partition` と同様ですが、Unicode 文字列を *sep* が最後に現" +"れる位置で分割します。\n" +"区切り文字列が見つからなければ、2 つの空文字列と、その後に元の文字列を含む 3 " +"要素のタプルを返します。" -#: ../../c-api/unicode.rst:1538 msgid "Equivalent to :py:meth:`str.rpartition`." -msgstr "" +msgstr ":py:meth:`str.rpartition` と等価です。" #: ../../c-api/unicode.rst:1543 msgid "" @@ -2151,12 +2334,15 @@ msgstr "" "指定した *separator* で文字列からなるシーケンスを連結 (join) し、連結結果を " "Unicode 文字列で返します。" -#: ../../c-api/unicode.rst:1550 msgid "" "Return ``1`` if *substr* matches ``unicode[start:end]`` at the given tail " "end (*direction* == ``-1`` means to do a prefix match, *direction* == ``1`` " "a suffix match), ``0`` otherwise. Return ``-1`` if an error occurred." msgstr "" +"*substr* が ``unicode[start:end]`` の指定された側の端と一致すれば ``1``、それ" +"以外なら ``0`` を返します (*direction* == ``-1`` は前方一致、*direction* == " +"``1`` は後方一致を意味します)。\n" +"エラーが発生した場合は ``-1`` を返します。" #: ../../c-api/unicode.rst:1558 msgid "" @@ -2189,10 +2375,11 @@ msgstr "" "チが見つからなかったことを表し、 ``-2`` はエラーが発生して例外情報が設定され" "ていることを表します。" -#: ../../c-api/unicode.rst:1576 msgid "" "*start* and *end* are now adjusted to behave like ``unicode[start:end]``." msgstr "" +"``unicode[start:end]`` と同じ動作になるよう、*start* と *end* を調整するよう" +"になりました。" #: ../../c-api/unicode.rst:1583 msgid "" @@ -2229,43 +2416,39 @@ msgstr "" "この関数は、失敗したときに ``-1`` を返すので、 :c:func:`PyErr_Occurred` を呼" "び出して、エラーをチェックすべきです。" -#: ../../c-api/unicode.rst:1605 msgid "The :c:func:`PyUnicode_Equal` function." -msgstr "" +msgstr ":c:func:`PyUnicode_Equal` 関数。" -#: ../../c-api/unicode.rst:1610 msgid "Test if two strings are equal:" -msgstr "" +msgstr "2 つの文字列が等しいか調べます:" -#: ../../c-api/unicode.rst:1612 msgid "Return ``1`` if *a* is equal to *b*." -msgstr "" +msgstr "*a* と *b* が等しければ ``1`` を返します。" -#: ../../c-api/unicode.rst:1613 msgid "Return ``0`` if *a* is not equal to *b*." -msgstr "" +msgstr "*a* と *b* が等しくなければ ``0`` を返します。" -#: ../../c-api/unicode.rst:1614 msgid "" "Set a :exc:`TypeError` exception and return ``-1`` if *a* or *b* is not a :" "class:`str` object." msgstr "" +"*a* または *b* が :class:`str` オブジェクトでなければ、:exc:`TypeError` 例外" +"を設定して ``-1`` を返します。" -#: ../../c-api/unicode.rst:1617 msgid "The function always succeeds if *a* and *b* are :class:`str` objects." msgstr "" +"*a* と *b* が :class:`str` オブジェクトであれば、この関数は常に成功します。" -#: ../../c-api/unicode.rst:1619 msgid "" "The function works for :class:`str` subclasses, but does not honor custom " "``__eq__()`` method." msgstr "" +"この関数は :class:`str` のサブクラスにも使えますが、独自の ``__eq__()`` メ" +"ソッドは考慮しません。" -#: ../../c-api/unicode.rst:1624 msgid "The :c:func:`PyUnicode_Compare` function." -msgstr "" +msgstr ":c:func:`PyUnicode_Compare` 関数。" -#: ../../c-api/unicode.rst:1631 msgid "" "Compare a Unicode object with a char buffer which is interpreted as being " "UTF-8 or ASCII encoded and return true (``1``) if they are equal, or false " @@ -2273,17 +2456,25 @@ msgid "" "(``U+D800`` - ``U+DFFF``) or the C string is not valid UTF-8, false (``0``) " "is returned." msgstr "" +"Unicode オブジェクトと、UTF-8 または ASCII でエンコードされていると解釈する " +"char 型バッファを比較し、等しければ真 (``1``)、それ以外なら偽 (``0``) を返し" +"ます。\n" +"Unicode オブジェクトにサロゲートコードポイント (``U+D800`` - ``U+DFFF``) が含" +"まれている場合や、C 文字列が有効な UTF-8 でない場合は、偽 (``0``) を返しま" +"す。" #: ../../c-api/unicode.rst:1638 ../../c-api/unicode.rst:1659 msgid "This function does not raise exceptions." msgstr "この関数は例外を送出しません。" -#: ../../c-api/unicode.rst:1645 msgid "" "Similar to :c:func:`PyUnicode_EqualToUTF8AndSize`, but compute *string* " "length using :c:func:`!strlen`. If the Unicode object contains null " "characters, false (``0``) is returned." msgstr "" +":c:func:`PyUnicode_EqualToUTF8AndSize` と同様ですが、*string* の長さを :c:" +"func:`!strlen` で計算します。\n" +"Unicode オブジェクトに null 文字が含まれている場合は、偽 (``0``) を返します。" #: ../../c-api/unicode.rst:1654 msgid "" @@ -2312,15 +2503,15 @@ msgstr "" ":c:data:`Py_True` もしくは :c:data:`Py_False` を、正しく比較できた時に返しま" "す。" -#: ../../c-api/unicode.rst:1668 msgid ":c:data:`Py_NotImplemented` in case the type combination is unknown" -msgstr "" +msgstr "型の組み合わせが不明な場合は :c:data:`Py_NotImplemented`。" -#: ../../c-api/unicode.rst:1670 msgid "" "Possible values for *op* are :c:macro:`Py_GT`, :c:macro:`Py_GE`, :c:macro:" "`Py_EQ`, :c:macro:`Py_NE`, :c:macro:`Py_LT`, and :c:macro:`Py_LE`." msgstr "" +"*op* に指定できる値は :c:macro:`Py_GT`、:c:macro:`Py_GE`、:c:macro:`Py_EQ`、:" +"c:macro:`Py_NE`、:c:macro:`Py_LT`、:c:macro:`Py_LE` です。" #: ../../c-api/unicode.rst:1676 msgid "" @@ -2345,7 +2536,6 @@ msgstr "" "*substr* は単要素の Unicode 文字に型強制できなければなりません。エラーが生じ" "た場合には ``-1`` を返します。" -#: ../../c-api/unicode.rst:1691 msgid "" "Intern the argument :c:expr:`*p_unicode` in place. The argument must be the " "address of a pointer variable pointing to a Python Unicode string object. " @@ -2355,27 +2545,44 @@ msgid "" "interned string object), otherwise it leaves :c:expr:`*p_unicode` alone and " "interns it." msgstr "" +"引数 :c:expr:`*p_unicode` をその場でインターンします。\n" +"引数は、Python の Unicode 文字列オブジェクトを指すポインタ変数のアドレスでな" +"ければなりません。\n" +":c:expr:`*p_unicode` と同じ文字列がすでにインターンされていれば、:c:expr:" +"`*p_unicode` をその文字列に設定します (元の文字列オブジェクトへの参照を解放" +"し、インターン済み文字列オブジェクトへの新しい :term:`強参照 ` を作成します)。\n" +"それ以外の場合は :c:expr:`*p_unicode` を変更せず、その文字列をインターンしま" +"す。" -#: ../../c-api/unicode.rst:1698 msgid "" "(Clarification: even though there is a lot of talk about references, think " "of this function as reference-neutral. You must own the object you pass in; " "after the call you no longer own the passed-in reference, but you newly own " "the result.)" msgstr "" +"(補足: 参照についての説明が多いですが、この関数は参照の数を変えないと考えてく" +"ださい。\n" +"渡すオブジェクトへの参照を所有している必要があります。\n" +"呼び出し後は渡した参照を所有しなくなり、代わりに結果への参照を新たに所有しま" +"す。)" -#: ../../c-api/unicode.rst:1703 msgid "" "This function never raises an exception. On error, it leaves its argument " "unchanged without interning it." msgstr "" +"この関数は例外を送出しません。\n" +"エラー時には、引数を変更せず、インターンもしません。" -#: ../../c-api/unicode.rst:1706 msgid "" "Instances of subclasses of :py:class:`str` may not be interned, that is, :c:" "expr:`PyUnicode_CheckExact(*p_unicode)` must be true. If it is not, then -- " "as with any other error -- the argument is left unchanged." msgstr "" +":py:class:`str` のサブクラスのインスタンスはインターンできません。\n" +"つまり :c:expr:`PyUnicode_CheckExact(*p_unicode)` が真でなければなりませ" +"ん。\n" +"真でなければ、他のエラーと同様に引数を変更しません。" #: ../../c-api/unicode.rst:1710 msgid "" @@ -2383,20 +2590,22 @@ msgid "" "the result to benefit from interning." msgstr "" -#: ../../c-api/unicode.rst:1716 msgid "" "A combination of :c:func:`PyUnicode_FromString` and :c:func:" "`PyUnicode_InternInPlace`, meant for statically allocated strings." msgstr "" +":c:func:`PyUnicode_FromString` と :c:func:`PyUnicode_InternInPlace` を組み合" +"わせたもので、静的に割り当てられた文字列用です。" -#: ../../c-api/unicode.rst:1719 msgid "" "Return a new (\"owned\") reference to either a new Unicode string object " "that has been interned, or an earlier interned string object with the same " "value." msgstr "" +"新しく作成してインターンした Unicode 文字列オブジェクト、または同じ値を持つ以" +"前にインターン済みの文字列オブジェクトへの、新しい (「所有する」) 参照を返し" +"ます。" -#: ../../c-api/unicode.rst:1723 msgid "" "Python may keep a reference to the result, or make it :term:`immortal`, " "preventing it from being garbage-collected promptly. For interning an " @@ -2404,193 +2613,207 @@ msgid "" "prefer calling :c:func:`PyUnicode_FromString` and :c:func:" "`PyUnicode_InternInPlace` directly." msgstr "" +"Python が結果への参照を保持したり、結果を :term:`不死 ` にしたりす" +"ることで、すぐにはガベージコレクションで回収されない場合があります。\n" +"ユーザー入力など、異なる文字列を上限なくインターンする場合は、:c:func:" +"`PyUnicode_FromString` と :c:func:`PyUnicode_InternInPlace` を直接呼び出すこ" +"とを推奨します。" #: ../../c-api/unicode.rst:1731 msgid "Strings interned this way are made :term:`immortal`." msgstr "" -#: ../../c-api/unicode.rst:1736 msgid "" "Return a non-zero value if *str* is interned, zero if not. The *str* " "argument must be a string; this is not checked. This function always " "succeeds." msgstr "" +"*str* がインターン済みならゼロ以外の値、そうでなければゼロを返します。\n" +"*str* 引数は文字列でなければなりませんが、検査は行いません。\n" +"この関数は常に成功します。" -#: ../../c-api/unicode.rst:1742 msgid "" "A non-zero return value may carry additional information about *how* the " "string is interned. The meaning of such non-zero values, as well as each " "specific string's intern-related details, may change between CPython " "versions." msgstr "" +"ゼロ以外の戻り値には、文字列が *どのように* インターンされているかについての" +"追加情報が含まれる場合があります。\n" +"これらの値の意味や、各文字列のインターンに関する詳細は、CPython のバージョン" +"によって変わる可能性があります。" -#: ../../c-api/unicode.rst:1749 msgid "PyUnicodeWriter" -msgstr "" +msgstr "PyUnicodeWriter" -#: ../../c-api/unicode.rst:1751 msgid "" "The :c:type:`PyUnicodeWriter` API can be used to create a Python :class:" "`str` object." msgstr "" +":c:type:`PyUnicodeWriter` API を使って Python の :class:`str` オブジェクトを" +"作成できます。" -#: ../../c-api/unicode.rst:1758 msgid "A Unicode writer instance." -msgstr "" +msgstr "Unicode ライターのインスタンスです。" -#: ../../c-api/unicode.rst:1760 msgid "" "The instance must be destroyed by :c:func:`PyUnicodeWriter_Finish` on " "success, or :c:func:`PyUnicodeWriter_Discard` on error." msgstr "" +"成功時には :c:func:`PyUnicodeWriter_Finish`、エラー時には :c:func:" +"`PyUnicodeWriter_Discard` でインスタンスを破棄する必要があります。" -#: ../../c-api/unicode.rst:1765 msgid "Create a Unicode writer instance." -msgstr "" +msgstr "Unicode ライターのインスタンスを作成します。" -#: ../../c-api/unicode.rst:1767 msgid "*length* must be greater than or equal to ``0``." -msgstr "" +msgstr "*length* は ``0`` 以上でなければなりません。" -#: ../../c-api/unicode.rst:1769 msgid "" "If *length* is greater than ``0``, preallocate an internal buffer of " "*length* characters." msgstr "" +"*length* が ``0`` より大きければ、*length* 文字分の内部バッファを事前に割り当" +"てます。" -#: ../../c-api/unicode.rst:1772 ../../c-api/unicode.rst:1778 msgid "Set an exception and return ``NULL`` on error." -msgstr "" +msgstr "エラー時には例外を設定して ``NULL`` を返します。" -#: ../../c-api/unicode.rst:1776 msgid "" "Return the final Python :class:`str` object and destroy the writer instance." msgstr "" +"最終的な Python の :class:`str` オブジェクトを返し、ライターのインスタンスを" +"破棄します。" -#: ../../c-api/unicode.rst:1780 ../../c-api/unicode.rst:1788 msgid "The writer instance is invalid after this call." -msgstr "" +msgstr "この呼び出しの後、ライターのインスタンスは無効になります。" -#: ../../c-api/unicode.rst:1784 msgid "Discard the internal Unicode buffer and destroy the writer instance." -msgstr "" +msgstr "内部の Unicode バッファを破棄し、ライターのインスタンスを破棄します。" -#: ../../c-api/unicode.rst:1786 msgid "If *writer* is ``NULL``, no operation is performed." -msgstr "" +msgstr "*writer* が ``NULL`` の場合は何もしません。" -#: ../../c-api/unicode.rst:1792 msgid "Write the single Unicode character *ch* into *writer*." -msgstr "" +msgstr "Unicode 文字 *ch* を 1 文字、*writer* に書き込みます。" -#: ../../c-api/unicode.rst:1794 ../../c-api/unicode.rst:1804 -#: ../../c-api/unicode.rst:1816 ../../c-api/unicode.rst:1825 -#: ../../c-api/unicode.rst:1832 ../../c-api/unicode.rst:1839 -#: ../../c-api/unicode.rst:1850 ../../c-api/unicode.rst:1857 -#: ../../c-api/unicode.rst:1876 msgid "" "On success, return ``0``. On error, set an exception, leave the writer " "unchanged, and return ``-1``." msgstr "" +"成功すると ``0`` を返します。\n" +"エラー時には例外を設定し、ライターは変更せずに ``-1`` を返します。" -#: ../../c-api/unicode.rst:1799 msgid "" "Decode the string *str* from UTF-8 in strict mode and write the output into " "*writer*." msgstr "" +"文字列 *str* を UTF-8 の strict モードでデコードし、結果を *writer* に書き込" +"みます。" -#: ../../c-api/unicode.rst:1801 ../../c-api/unicode.rst:1865 msgid "" "*size* is the string length in bytes. If *size* is equal to ``-1``, call " "``strlen(str)`` to get the string length." msgstr "" +"*size* はバイト単位の文字列の長さです。\n" +"*size* が ``-1`` の場合は ``strlen(str)`` を呼び出して文字列の長さを取得しま" +"す。" -#: ../../c-api/unicode.rst:1807 msgid "See also :c:func:`PyUnicodeWriter_DecodeUTF8Stateful`." -msgstr "" +msgstr ":c:func:`PyUnicodeWriter_DecodeUTF8Stateful` も参照してください。" #: ../../c-api/unicode.rst:1811 msgid "Writer the wide string *str* into *writer*." msgstr "" -#: ../../c-api/unicode.rst:1813 msgid "" "*size* is a number of wide characters. If *size* is equal to ``-1``, call " "``wcslen(str)`` to get the string length." msgstr "" +"*size* はワイド文字の数です。\n" +"*size* が ``-1`` の場合は ``wcslen(str)`` を呼び出して文字列の長さを取得しま" +"す。" #: ../../c-api/unicode.rst:1821 msgid "Writer the UCS4 string *str* into *writer*." msgstr "" -#: ../../c-api/unicode.rst:1823 msgid "*size* is a number of UCS4 characters." -msgstr "" +msgstr "*size* は UCS4 文字の数です。" -#: ../../c-api/unicode.rst:1830 msgid "" "Call :c:func:`PyObject_Str` on *obj* and write the output into *writer*." msgstr "" +"*obj* に対して :c:func:`PyObject_Str` を呼び出し、結果を *writer* に書き込み" +"ます。" -#: ../../c-api/unicode.rst:1837 msgid "" "Call :c:func:`PyObject_Repr` on *obj* and write the output into *writer*." msgstr "" +"*obj* に対して :c:func:`PyObject_Repr` を呼び出し、結果を *writer* に書き込み" +"ます。" -#: ../../c-api/unicode.rst:1844 msgid "Write the substring ``str[start:end]`` into *writer*." -msgstr "" +msgstr "部分文字列 ``str[start:end]`` を *writer* に書き込みます。" -#: ../../c-api/unicode.rst:1846 msgid "" "*str* must be Python :class:`str` object. *start* must be greater than or " "equal to 0, and less than or equal to *end*. *end* must be less than or " "equal to *str* length." msgstr "" +"*str* は Python の :class:`str` オブジェクトでなければなりません。\n" +"*start* は 0 以上かつ *end* 以下、*end* は *str* の長さ以下でなければなりませ" +"ん。" -#: ../../c-api/unicode.rst:1855 msgid "" "Similar to :c:func:`PyUnicode_FromFormat`, but write the output directly " "into *writer*." msgstr "" +":c:func:`PyUnicode_FromFormat` と同様ですが、出力を直接 *writer* に書き込みま" +"す。" -#: ../../c-api/unicode.rst:1862 msgid "" "Decode the string *str* from UTF-8 with *errors* error handler and write the " "output into *writer*." msgstr "" +"エラーハンドラ *errors* を使って文字列 *str* を UTF-8 からデコードし、結果を " +"*writer* に書き込みます。" -#: ../../c-api/unicode.rst:1868 msgid "" "*errors* is an :ref:`error handler ` name, such as " "``\"replace\"``. If *errors* is ``NULL``, use the strict error handler." msgstr "" +"*errors* は ``\"replace\"`` などの :ref:`エラーハンドラ ` の" +"名前です。\n" +"*errors* が ``NULL`` の場合は strict エラーハンドラを使います。" -#: ../../c-api/unicode.rst:1871 msgid "" "If *consumed* is not ``NULL``, set *\\*consumed* to the number of decoded " "bytes on success. If *consumed* is ``NULL``, treat trailing incomplete UTF-8 " "byte sequences as an error." msgstr "" +"*consumed* が ``NULL`` でなければ、成功時に *\\*consumed* にデコードしたバイ" +"ト数を設定します。\n" +"*consumed* が ``NULL`` の場合は、末尾の不完全な UTF-8 バイト列をエラーとして" +"扱います。" -#: ../../c-api/unicode.rst:1879 msgid "See also :c:func:`PyUnicodeWriter_WriteUTF8`." -msgstr "" +msgstr ":c:func:`PyUnicodeWriter_WriteUTF8` も参照してください。" -#: ../../c-api/unicode.rst:1882 msgid "Deprecated API" -msgstr "" +msgstr "非推奨の API" -#: ../../c-api/unicode.rst:1884 msgid "The following API is deprecated." -msgstr "" +msgstr "以下の API は非推奨です。" -#: ../../c-api/unicode.rst:1888 msgid "" "This is a typedef of :c:type:`wchar_t`, which is a 16-bit type or 32-bit " "type depending on the platform. Please use :c:type:`wchar_t` directly " "instead." msgstr "" +"これは :c:type:`wchar_t` の typedef であり、プラットフォームに応じて 16 ビッ" +"トまたは 32 ビットの型になります。\n" +"代わりに :c:type:`wchar_t` を直接使ってください。" #: ../../c-api/unicode.rst:1892 msgid "" @@ -2602,27 +2825,33 @@ msgstr "" "Unicode バージョンのどちらを選択したかによって、 16ビットか32ビットのどちらか" "の型になっていました。" -#: ../../c-api/unicode.rst:1902 msgid "" "Do nothing and return ``0``. This API is kept only for backward " "compatibility, but there are no plans to remove it." msgstr "" +"何もせずに ``0`` を返します。\n" +"この API は後方互換性のためだけに残されていますが、削除する予定はありません。" -#: ../../c-api/unicode.rst:1908 msgid "" "This API does nothing since Python 3.12. Previously, this needed to be " "called for each string created using the old API (:c:func:`!" "PyUnicode_FromUnicode` or similar)." msgstr "" +"Python 3.12 以降、この API は何もしません。\n" +"以前は、古い API (:c:func:`!PyUnicode_FromUnicode` など) で作成した文字列ごと" +"に呼び出す必要がありました。" -#: ../../c-api/unicode.rst:1916 msgid "" "Do nothing and return ``1``. This API is kept only for backward " "compatibility, but there are no plans to remove it." msgstr "" +"何もせずに ``1`` を返します。\n" +"この API は後方互換性のためだけに残されていますが、削除する予定はありません。" -#: ../../c-api/unicode.rst:1922 msgid "" "This API does nothing since Python 3.12. Previously, this could be called to " "check if :c:func:`PyUnicode_READY` is necessary." msgstr "" +"Python 3.12 以降、この API は何もしません。\n" +"以前は、:c:func:`PyUnicode_READY` が必要かどうかを調べるために呼び出せまし" +"た。" diff --git a/c-api/utilities.po b/c-api/utilities.po index f23c283fd..91cac9ac3 100644 --- a/c-api/utilities.po +++ b/c-api/utilities.po @@ -16,10 +16,10 @@ msgstr "" "Last-Translator: tomo, 2021\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../c-api/utilities.rst:7 diff --git a/c-api/veryhigh.po b/c-api/veryhigh.po index e097510d9..25d34161e 100644 --- a/c-api/veryhigh.po +++ b/c-api/veryhigh.po @@ -19,10 +19,10 @@ msgstr "" "Last-Translator: Arihiro TAKASE, 2023\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../c-api/veryhigh.rst:8 @@ -46,7 +46,6 @@ msgid "" "following the functions which accept them as parameters." msgstr "" -#: ../../c-api/veryhigh.rst:19 msgid "" "Note also that several of these functions take :c:expr:`FILE*` parameters. " "One particular issue which needs to be handled carefully is that the :c:type:" @@ -57,6 +56,13 @@ msgid "" "it is certain that they were created by the same library that the Python " "runtime is using." msgstr "" +"これらの関数の一部は :c:expr:`FILE*` 引数も受け取ります。\n" +"C ライブラリが異なると :c:type:`FILE` 構造体も異なり、互換性がない場合がある" +"点に特に注意が必要です。\n" +"少なくとも Windows では、動的リンクされた拡張が実際に別のライブラリを使うこと" +"があります。\n" +":c:expr:`FILE*` 引数を渡す場合は、Python ランタイムが使うのと同じライブラリに" +"よって作成されたものだと確実に分かっている必要があります。" #: ../../c-api/veryhigh.rst:30 msgid "" @@ -122,12 +128,13 @@ msgstr "" "します。エラーがあっても、例外情報を得る方法はありません。 *flags* の意味につ" "いては、後述します。" -#: ../../c-api/veryhigh.rst:72 msgid "" "Note that if an otherwise unhandled :exc:`SystemExit` is raised, this " "function will not return ``-1``, but exit the process, as long as :c:member:" "`PyConfig.inspect` is zero." msgstr "" +"処理されない :exc:`SystemExit` が送出されると、:c:member:`PyConfig.inspect` " +"がゼロである限り、この関数は ``-1`` を返さずにプロセスを終了します。" #: ../../c-api/veryhigh.rst:79 msgid "" @@ -243,11 +250,12 @@ msgstr "" "_tkinter.c` がやっているように、インタプリタのプロンプトと他のイベントループ" "を統合できます。" -#: ../../c-api/veryhigh.rst:146 ../../c-api/veryhigh.rst:170 msgid "" "This function is only called from the :ref:`main interpreter `." msgstr "" +"この関数は :ref:`メインインタープリタ ` からだけ呼び" +"出されます。" #: ../../c-api/veryhigh.rst:153 msgid "" @@ -417,7 +425,6 @@ msgstr "" "トと、グローバル変数とローカル変数だけを受け取ります。\n" "他の引数には ``NULL`` が渡されます。" -#: ../../c-api/veryhigh.rst:266 msgid "" "Evaluate a precompiled code object, given a particular environment for its " "evaluation. This environment consists of a dictionary of global variables, " @@ -425,10 +432,11 @@ msgid "" "defaults, a dictionary of default values for :ref:`keyword-only ` arguments and a closure tuple of cells." msgstr "" -"与えられた特定の環境で、コンパイル済みのコードオブジェクトを評価します。この" -"環境はグローバル変数の辞書と、ローカル変数のマッピングオブジェクト、引数の配" -"列、キーワードとデフォルト値、:ref:`キーワード専用 ` " -"引数のデフォルト値の辞書と、セルのクロージャタプルで構成されます。" +"指定された評価環境で、コンパイル済みのコードオブジェクトを評価します。\n" +"環境は、グローバル変数の辞書、ローカル変数のマッピングオブジェクト、引数・" +"キーワード・デフォルト値それぞれの配列、:ref:`キーワード専用 ` 引数のデフォルト値の辞書、クロージャのセルのタプルからなりま" +"す。" #: ../../c-api/veryhigh.rst:275 msgid "" @@ -508,42 +516,47 @@ msgstr "" "``PyCompilerFlags *flags`` として渡されます。この場合、``from __future__ " "import`` は *flags* の内容を変更できます。" -#: ../../c-api/veryhigh.rst:332 msgid "" "Whenever ``PyCompilerFlags *flags`` is ``NULL``, :c:member:`~PyCompilerFlags." "cf_flags` is treated as equal to ``0``, and any modification due to ``from " "__future__ import`` is discarded." msgstr "" +"``PyCompilerFlags *flags`` が ``NULL`` の場合、:c:member:`~PyCompilerFlags." +"cf_flags` は ``0`` として扱われ、``from __future__ import`` による変更は破棄" +"されます。" #: ../../c-api/veryhigh.rst:338 msgid "Compiler flags." msgstr "コンパイラフラグ。" -#: ../../c-api/veryhigh.rst:342 msgid "" "*cf_feature_version* is the minor Python version. It should be initialized " "to ``PY_MINOR_VERSION``." msgstr "" +"``cf_feature_version`` は Python のマイナーバージョンです。\n" +"``PY_MINOR_VERSION`` に初期化してください。" -#: ../../c-api/veryhigh.rst:345 msgid "" "The field is ignored by default, it is used if and only if ``PyCF_ONLY_AST`` " "flag is set in :c:member:`~PyCompilerFlags.cf_flags`." msgstr "" +"このフィールドはデフォルトでは無視されます。\n" +":c:member:`~PyCompilerFlags.cf_flags` に ``PyCF_ONLY_AST`` フラグが設定されて" +"いる場合に限って使います。" -#: ../../c-api/veryhigh.rst:348 msgid "Added *cf_feature_version* field." -msgstr "" +msgstr "``cf_feature_version`` フィールドを追加しました。" -#: ../../c-api/veryhigh.rst:351 msgid "The available compiler flags are accessible as macros:" -msgstr "" +msgstr "利用できるコンパイラフラグはマクロとして公開されています。" -#: ../../c-api/veryhigh.rst:360 msgid "" "See :ref:`compiler flags ` in documentation of the :py:" "mod:`!ast` Python module, which exports these constants under the same names." msgstr "" +":py:mod:`!ast` Python モジュールのドキュメントの :ref:`コンパイラフラグ ` を参照してください。\n" +"このモジュールは同じ名前で定数をエクスポートしています。" #: ../../c-api/veryhigh.rst:366 msgid "" @@ -553,7 +566,5 @@ msgstr "" "このビットを *flags* にセットすると、除算演算子 ``/`` は :pep:`238` による" "「真の除算 (true division)」として扱われます。" -#: ../../c-api/veryhigh.rst:301 ../../c-api/veryhigh.rst:309 -#: ../../c-api/veryhigh.rst:318 msgid "Py_CompileString (C function)" -msgstr "" +msgstr "Py_CompileString (C 関数)" diff --git a/c-api/weakref.po b/c-api/weakref.po index d13366fc2..fba661908 100644 --- a/c-api/weakref.po +++ b/c-api/weakref.po @@ -16,10 +16,10 @@ msgstr "" "Last-Translator: tomo, 2021\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../c-api/weakref.rst:6 @@ -38,11 +38,13 @@ msgstr "" "な参照オブジェクトで、第二はオリジナルのオブジェクトに対して可能な限りプロキ" "シとして振舞うオブジェクトです。" -#: ../../c-api/weakref.rst:16 msgid "" "Return non-zero if *ob* is either a reference or proxy object. This " "function always succeeds." msgstr "" +"``ob`` が弱参照オブジェクトまたはプロキシオブジェクトの場合に非ゼロを返しま" +"す。\n" +"この関数は常に成功します。" #: ../../c-api/weakref.rst:22 msgid "" @@ -50,10 +52,11 @@ msgid "" "succeeds." msgstr "" -#: ../../c-api/weakref.rst:27 msgid "" "Return non-zero if *ob* is a proxy object. This function always succeeds." msgstr "" +"``ob`` がプロキシオブジェクトの場合に非ゼロを返します。\n" +"この関数は常に成功します。" #: ../../c-api/weakref.rst:32 msgid "" @@ -79,25 +82,26 @@ msgid "" "``None``, or ``NULL``, this will return ``NULL`` and raise :exc:`TypeError`." msgstr "" -#: ../../c-api/weakref.rst:56 msgid "" "Get a :term:`strong reference` to the referenced object from a weak " "reference, *ref*, into *\\*pobj*." msgstr "" +"弱参照 ``ref`` から参照先のオブジェクトへの :term:`強参照 ` を取得し、``*pobj`` に格納します。" -#: ../../c-api/weakref.rst:59 msgid "" "On success, set *\\*pobj* to a new :term:`strong reference` to the " "referenced object and return 1." msgstr "" +"成功した場合は、参照先のオブジェクトへの新しい :term:`強参照 ` を ``*pobj`` に設定し、1 を返します。" -#: ../../c-api/weakref.rst:61 msgid "If the reference is dead, set *\\*pobj* to ``NULL`` and return 0." msgstr "" +"参照先が消滅している場合は、``*pobj`` を ``NULL`` に設定し、0 を返します。" -#: ../../c-api/weakref.rst:62 msgid "On error, raise an exception and return -1." -msgstr "" +msgstr "エラーの場合は例外を送出し、-1 を返します。" #: ../../c-api/weakref.rst:69 msgid "" @@ -121,31 +125,34 @@ msgstr "" msgid "Similar to :c:func:`PyWeakref_GetObject`, but does no error checking." msgstr "" -#: ../../c-api/weakref.rst:93 msgid "" "Test if the weak reference *ref* is dead. Returns 1 if the reference is " "dead, 0 if it is alive, and -1 with an error set if *ref* is not a weak " "reference object." msgstr "" +"弱参照 ``ref`` の参照先が消滅しているかどうかを調べます。\n" +"参照先が消滅していれば 1、生存していれば 0 を返します。\n" +"``ref`` が弱参照オブジェクトでなければ、エラーを設定して -1 を返します。" -#: ../../c-api/weakref.rst:102 msgid "" "This function is called by the :c:member:`~PyTypeObject.tp_dealloc` handler " "to clear weak references." msgstr "" +"この関数は、弱参照をクリアするために :c:member:`~PyTypeObject.tp_dealloc` ハ" +"ンドラから呼び出されます。" -#: ../../c-api/weakref.rst:105 msgid "" "This iterates through the weak references for *object* and calls callbacks " "for those references which have one. It returns when all callbacks have been " "attempted." msgstr "" +"``object`` への弱参照を順に調べ、コールバックを持つものについてはそのコール" +"バックを呼び出します。\n" +"すべてのコールバックの呼び出しを試みた後で戻ります。" -#: ../../c-api/weakref.rst:112 msgid "Clears the weakrefs for *object* without calling the callbacks." -msgstr "" +msgstr "コールバックを呼び出さずに ``object`` への弱参照をクリアします。" -#: ../../c-api/weakref.rst:114 msgid "" "This function is called by the :c:member:`~PyTypeObject.tp_dealloc` handler " "for types with finalizers (i.e., :meth:`~object.__del__`). The handler for " @@ -153,9 +160,16 @@ msgid "" "and call their callbacks, then the finalizer, and finally this function to " "clear any weakrefs that may have been created by the finalizer." msgstr "" +"この関数は、ファイナライザ (つまり :meth:`~object.__del__`) を持つ型の :c:" +"member:`~PyTypeObject.tp_dealloc` ハンドラから呼び出されます。\n" +"このようなオブジェクトのハンドラは、まず :c:func:`PyObject_ClearWeakRefs` を" +"呼び出して弱参照をクリアし、そのコールバックを呼び出します。\n" +"次にファイナライザを呼び出し、最後にこの関数を呼び出してファイナライザが作成" +"した可能性のある弱参照をクリアします。" -#: ../../c-api/weakref.rst:120 msgid "" "In most circumstances, it's more appropriate to use :c:func:" "`PyObject_ClearWeakRefs` to clear weakrefs instead of this function." msgstr "" +"ほとんどの場合、弱参照のクリアにはこの関数よりも :c:func:" +"`PyObject_ClearWeakRefs` を使う方が適切です。" diff --git a/contents.po b/contents.po index 9a3f75077..30c317821 100644 --- a/contents.po +++ b/contents.po @@ -16,12 +16,11 @@ msgstr "" "Last-Translator: tomo, 2021\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" -#: ../../contents.rst:3 msgid "Python Documentation contents" -msgstr "Python Documentation contents" +msgstr "Python ドキュメントの目次" diff --git a/copyright.po b/copyright.po index 5badfb75e..2e1eb1987 100644 --- a/copyright.po +++ b/copyright.po @@ -16,10 +16,10 @@ msgstr "" "Last-Translator: tomo, 2021\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../copyright.rst:3 @@ -32,7 +32,7 @@ msgstr "Python and this documentation is:" #: ../../copyright.rst:7 msgid "Copyright © 2001 Python Software Foundation. All rights reserved." -msgstr "" +msgstr "Copyright © 2001 Python Software Foundation. All rights reserved." #: ../../copyright.rst:9 msgid "Copyright © 2000 BeOpen.com. All rights reserved." diff --git a/distributing/index.po b/distributing/index.po index f91f4e218..c9db0f117 100644 --- a/distributing/index.po +++ b/distributing/index.po @@ -17,10 +17,10 @@ msgstr "" "Last-Translator: TENMYO Masakazu, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../distributing/index.rst:10 diff --git a/distutils/_setuptools_disclaimer.po b/distutils/_setuptools_disclaimer.po index 55cc4fd40..702badb29 100644 --- a/distutils/_setuptools_disclaimer.po +++ b/distutils/_setuptools_disclaimer.po @@ -16,10 +16,10 @@ msgstr "" "Last-Translator: tomo, 2021\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../distutils/_setuptools_disclaimer.rst:3 diff --git a/distutils/apiref.po b/distutils/apiref.po index 599c17489..2e2652469 100644 --- a/distutils/apiref.po +++ b/distutils/apiref.po @@ -21,10 +21,10 @@ msgstr "" "Last-Translator: Transifex Bot <>, 2023\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../distutils/apiref.rst:5 diff --git a/distutils/builtdist.po b/distutils/builtdist.po index 4782154a8..fb6b267d1 100644 --- a/distutils/builtdist.po +++ b/distutils/builtdist.po @@ -20,10 +20,10 @@ msgstr "" "Last-Translator: Transifex Bot <>, 2023\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../distutils/builtdist.rst:5 @@ -566,12 +566,8 @@ msgstr "Packager" msgid "``packager``" msgstr "``packager``" -#: ../../distutils/builtdist.rst:223 ../../distutils/builtdist.rst:225 -#: ../../distutils/builtdist.rst:227 ../../distutils/builtdist.rst:229 -#: ../../distutils/builtdist.rst:231 ../../distutils/builtdist.rst:233 -#: ../../distutils/builtdist.rst:235 ../../distutils/builtdist.rst:237 msgid "(none)" -msgstr "(none)" +msgstr "(なし)" #: ../../distutils/builtdist.rst:225 msgid "Provides" diff --git a/distutils/commandref.po b/distutils/commandref.po index 2331199f2..fac738db7 100644 --- a/distutils/commandref.po +++ b/distutils/commandref.po @@ -16,10 +16,10 @@ msgstr "" "Last-Translator: tomo, 2021\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../distutils/commandref.rst:5 diff --git a/distutils/configfile.po b/distutils/configfile.po index 2c39db65e..83f124244 100644 --- a/distutils/configfile.po +++ b/distutils/configfile.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: Takeshi Nakazato, 2021\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../distutils/configfile.rst:5 diff --git a/distutils/examples.po b/distutils/examples.po index 37087985f..c8ce9c4fb 100644 --- a/distutils/examples.po +++ b/distutils/examples.po @@ -16,10 +16,10 @@ msgstr "" "Last-Translator: tomo, 2021\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../distutils/examples.rst:5 diff --git a/distutils/extending.po b/distutils/extending.po index dd10467dc..270cd2f83 100644 --- a/distutils/extending.po +++ b/distutils/extending.po @@ -17,10 +17,10 @@ msgstr "" "Last-Translator: Arihiro TAKASE, 2023\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../distutils/extending.rst:5 diff --git a/distutils/index.po b/distutils/index.po index 21a6ada1d..f075387ce 100644 --- a/distutils/index.po +++ b/distutils/index.po @@ -17,10 +17,10 @@ msgstr "" "Last-Translator: Shin Saito, 2021\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../distutils/index.rst:5 diff --git a/distutils/introduction.po b/distutils/introduction.po index 0cc9519d7..88f368769 100644 --- a/distutils/introduction.po +++ b/distutils/introduction.po @@ -17,10 +17,10 @@ msgstr "" "Last-Translator: mollinaca, 2021\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../distutils/introduction.rst:5 diff --git a/distutils/packageindex.po b/distutils/packageindex.po index 96e65ef15..2741a2c12 100644 --- a/distutils/packageindex.po +++ b/distutils/packageindex.po @@ -16,10 +16,10 @@ msgstr "" "Last-Translator: tomo, 2021\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../distutils/packageindex.rst:7 diff --git a/distutils/setupscript.po b/distutils/setupscript.po index b5f3d1978..5161cb70d 100644 --- a/distutils/setupscript.po +++ b/distutils/setupscript.po @@ -21,10 +21,10 @@ msgstr "" "Last-Translator: Transifex Bot <>, 2023\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../distutils/setupscript.rst:5 diff --git a/distutils/sourcedist.po b/distutils/sourcedist.po index ac0f74000..af42f4514 100644 --- a/distutils/sourcedist.po +++ b/distutils/sourcedist.po @@ -17,10 +17,10 @@ msgstr "" "Last-Translator: Transifex Bot <>, 2023\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../distutils/sourcedist.rst:5 diff --git a/distutils/uploading.po b/distutils/uploading.po index 601b5e350..379a6fdb2 100644 --- a/distutils/uploading.po +++ b/distutils/uploading.po @@ -16,10 +16,10 @@ msgstr "" "Last-Translator: tomo, 2021\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../distutils/uploading.rst:5 diff --git a/extending/building.po b/extending/building.po index 225442ac9..28c8f3e24 100644 --- a/extending/building.po +++ b/extending/building.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../extending/building.rst:7 @@ -89,6 +89,12 @@ msgid "" " suffix = b'U_' + name.encode('punycode').replace(b'-', b'_')\n" " return b'PyInit' + suffix" msgstr "" +"def initfunc_name(name):\n" +" try:\n" +" suffix = b'_' + name.encode('ascii')\n" +" except UnicodeEncodeError:\n" +" suffix = b'U_' + name.encode('punycode').replace(b'-', b'_')\n" +" return b'PyInit' + suffix" #: ../../extending/building.rst:39 msgid "" diff --git a/extending/embedding.po b/extending/embedding.po index 3b3fefcaf..4bc327113 100644 --- a/extending/embedding.po +++ b/extending/embedding.po @@ -19,10 +19,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../extending/embedding.rst:8 @@ -125,7 +125,6 @@ msgstr "" "トを実行するためのものです。例えばこれは、一つのファイル上で何らかの操作を実" "現するのに利用できます。 ::" -#: ../../extending/embedding.rst:56 msgid "" "#define PY_SSIZE_T_CLEAN\n" "#include \n" @@ -162,6 +161,40 @@ msgid "" " Py_ExitStatusException(status);\n" "}" msgstr "" +"#define PY_SSIZE_T_CLEAN\n" +"#include \n" +"\n" +"int\n" +"main(int argc, char *argv[])\n" +"{\n" +" PyStatus status;\n" +" PyConfig config;\n" +" PyConfig_InitPythonConfig(&config);\n" +"\n" +" /* 省略可能だが推奨 */\n" +" status = PyConfig_SetBytesString(&config, &config.program_name, " +"argv[0]);\n" +" if (PyStatus_Exception(status)) {\n" +" goto exception;\n" +" }\n" +"\n" +" status = Py_InitializeFromConfig(&config);\n" +" if (PyStatus_Exception(status)) {\n" +" goto exception;\n" +" }\n" +" PyConfig_Clear(&config);\n" +"\n" +" PyRun_SimpleString(\"from time import time,ctime\\n\"\n" +" \"print('Today is', ctime(time()))\\n\");\n" +" if (Py_FinalizeEx() < 0) {\n" +" exit(120);\n" +" }\n" +" return 0;\n" +"\n" +" exception:\n" +" PyConfig_Clear(&config);\n" +" Py_ExitStatusException(status);\n" +"}" #: ../../extending/embedding.rst:92 msgid "" @@ -299,7 +332,6 @@ msgstr "" "Python スクリプト内で定義されている関数を実行するためのコードは以下のようにな" "ります:" -#: ../../extending/embedding.rst:162 msgid "" "#define PY_SSIZE_T_CLEAN\n" "#include \n" @@ -374,6 +406,78 @@ msgid "" " return 0;\n" "}\n" msgstr "" +"#define PY_SSIZE_T_CLEAN\n" +"#include \n" +"\n" +"int\n" +"main(int argc, char *argv[])\n" +"{\n" +" PyObject *pName, *pModule, *pFunc;\n" +" PyObject *pArgs, *pValue;\n" +" int i;\n" +"\n" +" if (argc < 3) {\n" +" fprintf(stderr,\"Usage: call pythonfile funcname [args]\\n\");\n" +" return 1;\n" +" }\n" +"\n" +" Py_Initialize();\n" +" pName = PyUnicode_DecodeFSDefault(argv[1]);\n" +" /* pName のエラーチェックは省略 */\n" +"\n" +" pModule = PyImport_Import(pName);\n" +" Py_DECREF(pName);\n" +"\n" +" if (pModule != NULL) {\n" +" pFunc = PyObject_GetAttrString(pModule, argv[2]);\n" +" /* pFunc は新しい参照 */\n" +"\n" +" if (pFunc && PyCallable_Check(pFunc)) {\n" +" pArgs = PyTuple_New(argc - 3);\n" +" for (i = 0; i < argc - 3; ++i) {\n" +" pValue = PyLong_FromLong(atoi(argv[i + 3]));\n" +" if (!pValue) {\n" +" Py_DECREF(pArgs);\n" +" Py_DECREF(pModule);\n" +" fprintf(stderr, \"Cannot convert argument\\n\");\n" +" return 1;\n" +" }\n" +" /* ここで pValue の参照が盗まれる: */\n" +" PyTuple_SetItem(pArgs, i, pValue);\n" +" }\n" +" pValue = PyObject_CallObject(pFunc, pArgs);\n" +" Py_DECREF(pArgs);\n" +" if (pValue != NULL) {\n" +" printf(\"Result of call: %ld\\n\", PyLong_AsLong(pValue));\n" +" Py_DECREF(pValue);\n" +" }\n" +" else {\n" +" Py_DECREF(pFunc);\n" +" Py_DECREF(pModule);\n" +" PyErr_Print();\n" +" fprintf(stderr,\"Call failed\\n\");\n" +" return 1;\n" +" }\n" +" }\n" +" else {\n" +" if (PyErr_Occurred())\n" +" PyErr_Print();\n" +" fprintf(stderr, \"Cannot find function \\\"%s\\\"\\n\", " +"argv[2]);\n" +" }\n" +" Py_XDECREF(pFunc);\n" +" Py_DECREF(pModule);\n" +" }\n" +" else {\n" +" PyErr_Print();\n" +" fprintf(stderr, \"Failed to load \\\"%s\\\"\\n\", argv[1]);\n" +" return 1;\n" +" }\n" +" if (Py_FinalizeEx() < 0) {\n" +" return 120;\n" +" }\n" +" return 0;\n" +"}\n" #: ../../extending/embedding.rst:165 msgid "" @@ -389,7 +493,6 @@ msgstr "" "(できた実行可能形式を :program:`call` と呼びましょう)、以下のような Python ス" "クリプトを実行することにします:" -#: ../../extending/embedding.rst:171 msgid "" "def multiply(a,b):\n" " print(\"Will compute\", a, \"times\", b)\n" @@ -398,45 +501,57 @@ msgid "" " c = c + b\n" " return c" msgstr "" +"def multiply(a,b):\n" +" print(\"Will compute\", a, \"times\", b)\n" +" c = 0\n" +" for i in range(0, a):\n" +" c = c + b\n" +" return c" #: ../../extending/embedding.rst:180 msgid "then the result should be:" msgstr "実行結果は以下のようになるはずです:" -#: ../../extending/embedding.rst:182 msgid "" "$ call multiply multiply 3 2\n" "Will compute 3 times 2\n" "Result of call: 6" msgstr "" +"$ call multiply multiply 3 2\n" +"Will compute 3 times 2\n" +"Result of call: 6" -#: ../../extending/embedding.rst:188 msgid "" "Although the program is quite large for its functionality, most of the code " "is for data conversion between Python and C, and for error reporting. The " "interesting part with respect to embedding Python starts with ::" msgstr "" -"この程度の機能を実現するにはプログラムがいささか大きすぎますが、ほとんどは " -"Python から C へのデータ変換やエラー報告のためのコードです。Python の埋め込み" -"という観点から最も興味深い部分は以下のコードから始まる部分です::" +"機能の割に大きなプログラムですが、コードの大部分は Python と C の間のデータ変" +"換と、エラーの報告のためのものです。\n" +"Python の埋め込みという観点から重要なのは、次の箇所から始まる処理です。 ::" -#: ../../extending/embedding.rst:192 msgid "" "Py_Initialize();\n" "pName = PyUnicode_DecodeFSDefault(argv[1]);\n" "/* Error checking of pName left out */\n" "pModule = PyImport_Import(pName);" msgstr "" +"Py_Initialize();\n" +"pName = PyUnicode_DecodeFSDefault(argv[1]);\n" +"/* pName のエラーチェックは省略 */\n" +"pModule = PyImport_Import(pName);" -#: ../../extending/embedding.rst:197 msgid "" "After initializing the interpreter, the script is loaded using :c:func:" "`PyImport_Import`. This routine needs a Python string as its argument, " "which is constructed using the :c:func:`PyUnicode_DecodeFSDefault` data " "conversion routine. ::" msgstr "" +"インタープリタを初期化した後、:c:func:`PyImport_Import` でスクリプトをロード" +"します。\n" +"この関数には Python の文字列を引数として渡す必要があるため、データ変換関数 :" +"c:func:`PyUnicode_DecodeFSDefault` で作成します。 ::" -#: ../../extending/embedding.rst:202 msgid "" "pFunc = PyObject_GetAttrString(pModule, argv[2]);\n" "/* pFunc is a new reference */\n" @@ -446,6 +561,13 @@ msgid "" "}\n" "Py_XDECREF(pFunc);" msgstr "" +"pFunc = PyObject_GetAttrString(pModule, argv[2]);\n" +"/* pFunc は新しい参照 */\n" +"\n" +"if (pFunc && PyCallable_Check(pFunc)) {\n" +" ...\n" +"}\n" +"Py_XDECREF(pFunc);" #: ../../extending/embedding.rst:210 msgid "" @@ -461,9 +583,8 @@ msgstr "" "支えないでしょう。そこでプログラムは定石どおりに引数のタプル構築に進みます。" "その後、Python 関数を以下のコードで呼び出します::" -#: ../../extending/embedding.rst:216 msgid "pValue = PyObject_CallObject(pFunc, pArgs);" -msgstr "" +msgstr "pValue = PyObject_CallObject(pFunc, pArgs);" #: ../../extending/embedding.rst:218 msgid "" @@ -539,24 +660,28 @@ msgstr "" "上のコードを :c:func:`main` 関数のすぐ上に挿入します。また、以下の二つの文" "を :c:func:`Py_Initialize` の呼び出しの前に挿入します::" -#: ../../extending/embedding.rst:268 msgid "" "numargs = argc;\n" "PyImport_AppendInittab(\"emb\", &PyInit_emb);" msgstr "" +"numargs = argc;\n" +"PyImport_AppendInittab(\"emb\", &PyInit_emb);" -#: ../../extending/embedding.rst:271 msgid "" "These two lines initialize the ``numargs`` variable, and make the :func:`!" "emb.numargs` function accessible to the embedded Python interpreter. With " "these extensions, the Python script can do things like" msgstr "" +"この 2 行は、``numargs`` 変数を初期化し、埋め込まれた Python インタープリタか" +"ら :func:`!emb.numargs` 関数を利用できるようにします。\n" +"この拡張によって、Python スクリプトで次のような処理ができます。" -#: ../../extending/embedding.rst:275 msgid "" "import emb\n" "print(\"Number of arguments\", emb.numargs())" msgstr "" +"import emb\n" +"print(\"Number of arguments\", emb.numargs())" #: ../../extending/embedding.rst:280 msgid "" @@ -587,17 +712,16 @@ msgstr "" msgid "Compiling and Linking under Unix-like systems" msgstr "Unix 系システムにおけるコンパイルとリンク" -#: ../../extending/embedding.rst:303 msgid "" "It is not necessarily trivial to find the right flags to pass to your " "compiler (and linker) in order to embed the Python interpreter into your " "application, particularly because Python needs to load library modules " "implemented as C dynamic extensions (:file:`.so` files) linked against it." msgstr "" -"Python インタプリタをアプリケーションに埋め込むためにコンパイラ (とリンカ) に" -"渡すべき正しいフラグを見出すのは簡単でないかもしれません。これは特に、Python " -"がライブラリモジュールに対してリンクされた C 動的拡張 (:file:`.so` ファイル) " -"として実装されたものをロードする必要があるためです。" +"Python インタープリタをアプリケーションに組み込むために、コンパイラとリンカー" +"に渡す適切なフラグを見つけるのは、必ずしも簡単ではありません。\n" +"特に、Python にリンクされた C の動的拡張 (:file:`.so` ファイル) として実装さ" +"れたライブラリモジュールを、Python がロードする必要があるためです。" #: ../../extending/embedding.rst:309 msgid "" @@ -619,12 +743,14 @@ msgid "" msgstr "" "``pythonX.Y-config --cflags`` は推奨のコンパイルオプションを出力します:" -#: ../../extending/embedding.rst:318 msgid "" "$ /opt/bin/python3.11-config --cflags\n" "-I/opt/include/python3.11 -I/opt/include/python3.11 -Wsign-compare -DNDEBUG " "-g -fwrapv -O3 -Wall" msgstr "" +"$ /opt/bin/python3.11-config --cflags\n" +"-I/opt/include/python3.11 -I/opt/include/python3.11 -Wsign-compare -DNDEBUG " +"-g -fwrapv -O3 -Wall" #: ../../extending/embedding.rst:323 msgid "" @@ -633,12 +759,14 @@ msgid "" msgstr "" "``pythonX.Y-config --ldflags --embed`` は推奨のリンクオプションを出力します:" -#: ../../extending/embedding.rst:326 msgid "" "$ /opt/bin/python3.11-config --ldflags --embed\n" "-L/opt/lib/python3.11/config-3.11-x86_64-linux-gnu -L/opt/lib -lpython3.11 -" "lpthread -ldl -lutil -lm" msgstr "" +"$ /opt/bin/python3.11-config --ldflags --embed\n" +"-L/opt/lib/python3.11/config-3.11-x86_64-linux-gnu -L/opt/lib -lpython3.11 -" +"lpthread -ldl -lutil -lm" #: ../../extending/embedding.rst:332 msgid "" @@ -651,7 +779,6 @@ msgstr "" "た Python)での混乱を避けるために、上での例のように :file:`python{X.Y}-" "config` は絶対パスで起動したほうが良いです。" -#: ../../extending/embedding.rst:337 msgid "" "If this procedure doesn't work for you (it is not guaranteed to work for all " "Unix-like platforms; however, we welcome :ref:`bug reports ` は歓迎です)、あなたのシステムのダイナミックリンクについてのドキュメン" -"トを読み、Python の :file:`Makefile` のコンパイルオプションを調べる必要がある" -"でしょう(Makefile の場所を調べるには :func:`sysconfig.get_makefile_filename` " -"を使ってください)。この場合、 :mod:`sysconfig` モジュールが役に立つ道具になり" -"ます。これによってあなたが付け加えたいコンパイル・リンクのオプション構成をプ" -"ログラム的に抽出できます。例えば:" +"この手順でうまくいかない場合は、システムの動的リンクに関するドキュメントを読" +"むか、Python の :file:`Makefile` とコンパイルオプションを調べる、あるいはその" +"両方を行う必要があります。\n" +"すべての Unix 系プラットフォームで動作する保証はありませんが、:ref:`バグ報告 " +"` は歓迎します。\n" +"Makefile の場所は :func:`sysconfig.get_makefile_filename` で調べられます。\n" +"この場合、:mod:`sysconfig` モジュールを使うと、組み合わせたい設定値をプログラ" +"ムで抽出できて便利です。\n" +"例えば、次のように使います。" -#: ../../extending/embedding.rst:346 msgid "" ">>> import sysconfig\n" ">>> sysconfig.get_config_var('LIBS')\n" @@ -679,3 +806,8 @@ msgid "" ">>> sysconfig.get_config_var('LINKFORSHARED')\n" "'-Xlinker -export-dynamic'" msgstr "" +">>> import sysconfig\n" +">>> sysconfig.get_config_var('LIBS')\n" +"'-lpthread -ldl -lutil'\n" +">>> sysconfig.get_config_var('LINKFORSHARED')\n" +"'-Xlinker -export-dynamic'" diff --git a/extending/extending.po b/extending/extending.po index cbccc5806..0d4e48e77 100644 --- a/extending/extending.po +++ b/extending/extending.po @@ -22,10 +22,10 @@ msgstr "" "Last-Translator: Arihiro TAKASE, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../extending/extending.rst:8 @@ -131,6 +131,8 @@ msgid "" "#define PY_SSIZE_T_CLEAN\n" "#include " msgstr "" +"#define PY_SSIZE_T_CLEAN\n" +"#include " #: ../../extending/extending.rst:63 msgid "" @@ -325,7 +327,6 @@ msgstr "" "を判別できるはずなので、 :c:func:`PyErr_Occurred` を呼び出す必要はありませ" "ん。" -#: ../../extending/extending.rst:160 msgid "" "When a function *f* that calls another function *g* detects that the latter " "fails, *f* should itself return an error value (usually ``NULL`` or " @@ -337,17 +338,18 @@ msgid "" "interpreter's main loop, this aborts the currently executing Python code and " "tries to find an exception handler specified by the Python programmer." msgstr "" -"関数 *g* を呼び出す *f* が、前者の関数の呼び出しに失敗したことを検出すると、 " -"*f* 自体はエラー値 (大抵は ``NULL`` や ``-1``) を返さねばなりません。しか" -"し、 ``PyErr_*`` 関数群のいずれかを呼び出す必要は *ありません* --- なぜな" -"ら、 *g* がすでに呼び出しているからです。次いで *f* を呼び出したコードもエ" -"ラーを示す値を *自らを呼び出したコード* に返すことになりますが、同様に " -"``PyErr_*`` は *呼び出しません* 。以下同様に続きます --- エラーの最も詳しい原" -"因は、最初にエラーを検出した関数がすでに報告しているからです。エラーが " -"Python インタプリタのメインループに到達すると、現在実行中の Python コードは一" -"時停止し、 Python プログラマが指定した例外ハンドラを探し出そうとします。" +"別の関数 *g* を呼び出した関数 *f* が、その呼び出しの失敗を検出した場合、*f* " +"自身もエラー値 (通常は ``NULL`` または ``-1``) を返す必要があります。\n" +"このとき ``PyErr_*`` 関数を呼び出しては *いけません*。\n" +"*g* がすでに呼び出しているからです。\n" +"次に *f* の呼び出し元も、``PyErr_*`` を *呼び出さずに*、*その呼び出し元* へエ" +"ラーを示す値を返します。\n" +"以下同様に続きます。\n" +"エラーの最も詳しい原因は、最初にエラーを検出した関数がすでに報告していま" +"す。\n" +"エラーが Python インタープリタのメインループに到達すると、実行中の Python " +"コードの処理を中断し、Python プログラマーが指定した例外ハンドラーを探します。" -#: ../../extending/extending.rst:170 msgid "" "(There are situations where a module can actually give a more detailed error " "message by calling another ``PyErr_*`` function, and in such cases it is " @@ -355,11 +357,11 @@ msgid "" "cause information about the cause of the error to be lost: most operations " "can fail for a variety of reasons.)" msgstr "" -"(モジュールが ``PyErr_*`` 関数をもう一度呼び出して、より詳細なエラーメッセー" -"ジを提供するような状況があります。このような状況ではそうすべきです。とはい" -"え、一般的な規則としては、この関数を何度も呼び出す必要はなく、ともすればエ" -"ラーの原因に関する情報を失う結果になりがちです: これにより、ほとんどの操作が" -"様々な理由から失敗するかもしれません)" +"(別の ``PyErr_*`` 関数を呼び出すことで、モジュールがより詳しいエラーメッセー" +"ジを提供できる場合は、そうしても構いません。\n" +"ただし、一般には不要であり、エラーの原因に関する情報が失われるおそれがありま" +"す。\n" +"ほとんどの操作は様々な理由で失敗し得るためです。)" #: ../../extending/extending.rst:176 msgid "" @@ -386,20 +388,19 @@ msgstr "" ":c:func:`malloc` の呼び出し失敗は、常に例外にしなくてはなりません --- :c:" "func:`malloc` (または :c:func:`realloc`) を直接呼び出しているコードは、 :c:" "func:`PyErr_NoMemory` を呼び出して、失敗を示す値を返さねばなりません。オブ" -"ジェクトを生成する全ての関数 (例えば :c:func:`PyLong_FromLong`) は :c:func:" -"`PyErr_NoMemory` の呼び出しを済ませてしまうので、この規則が関係するのは直接 :" -"c:func:`malloc` を呼び出すコードだけです。" +"ジェクトを生成する全ての関数 (例えば :c:func:`PyLong_FromLong`) は " +"``PyErr_NoMemory()`` の呼び出しを済ませてしまうので、この規則が関係するのは直" +"接 :c:func:`malloc` を呼び出すコードだけです。" -#: ../../extending/extending.rst:188 msgid "" "Also note that, with the important exception of :c:func:`PyArg_ParseTuple` " "and friends, functions that return an integer status usually return a " "positive value or zero for success and ``-1`` for failure, like Unix system " "calls." msgstr "" -"また、 :c:func:`PyArg_ParseTuple` という重要な例外を除いて、整数の状態コード" -"を返す関数はたいてい、Unix のシステムコールと同じく、処理が成功した際にはゼロ" -"または正の値を返し、失敗した場合には ``-1`` を返します。" +"また、:c:func:`PyArg_ParseTuple` などの重要な例外を除き、整数の状態コードを返" +"す関数は通常、Unix のシステムコールと同じく、成功時に正の値またはゼロを返し、" +"失敗時に ``-1`` を返します。" #: ../../extending/extending.rst:192 msgid "" @@ -411,7 +412,6 @@ msgstr "" "ブジェクトに対して :c:func:`Py_XDECREF` や :c:func:`Py_DECREF` を呼び出して) " "ごみ処理を注意深く行ってください!" -#: ../../extending/extending.rst:196 msgid "" "The choice of which exception to raise is entirely yours. There are " "predeclared C objects corresponding to all built-in Python exceptions, such " @@ -423,6 +423,16 @@ msgid "" "you have an argument whose value must be in a particular range or must " "satisfy other conditions, :c:data:`PyExc_ValueError` is appropriate." msgstr "" +"どの例外を送出するかは自由に選べます。\n" +":c:data:`PyExc_ZeroDivisionError` など、Python のすべての組み込み例外に対応す" +"る C オブジェクトが宣言済みで、そのまま利用できます。\n" +"もちろん、例外は適切に選ぶ必要があります。\n" +"例えば、ファイルを開けなかったことを示すために :c:data:`PyExc_TypeError` を使" +"うべきではありません (おそらく :c:data:`PyExc_OSError` が適切です)。\n" +"引数リストに問題がある場合、:c:func:`PyArg_ParseTuple` 関数は通常 :c:data:" +"`PyExc_TypeError` を送出します。\n" +"引数の値が特定の範囲内でなければならない場合や、その他の条件を満たす必要があ" +"る場合は、:c:data:`PyExc_ValueError` が適切です。" #: ../../extending/extending.rst:206 msgid "" @@ -464,15 +474,18 @@ msgid "" "}" msgstr "" -#: ../../extending/extending.rst:233 msgid "" "Note that the Python name for the exception object is :exc:`!spam.error`. " "The :c:func:`PyErr_NewException` function may create a class with the base " "class being :exc:`Exception` (unless another class is passed in instead of " "``NULL``), described in :ref:`bltin-exceptions`." msgstr "" +"例外オブジェクトの Python での名前は :exc:`!spam.error` であることに注意して" +"ください。\n" +":c:func:`PyErr_NewException` 関数は、``NULL`` の代わりに別のクラスを渡さなけ" +"れば、:ref:`bltin-exceptions` で説明する :exc:`Exception` を基底クラスとする" +"クラスを作成できます。" -#: ../../extending/extending.rst:238 msgid "" "Note also that the :c:data:`!SpamError` variable retains a reference to the " "newly created exception class; this is intentional! Since the exception " @@ -482,6 +495,15 @@ msgid "" "pointer, C code which raises the exception could cause a core dump or other " "unintended side effects." msgstr "" +":c:data:`!SpamError` 変数が新しく作成した例外クラスへの参照を保持している点に" +"も注意してください。\n" +"これは意図的なものです。\n" +"外部のコードがモジュールから例外を削除する可能性があるため、クラスへの参照を" +"所有しておく必要があります。\n" +"そうすることで、クラスが破棄されて :c:data:`!SpamError` がダングリングポイン" +"ターになるのを防ぎます。\n" +"ダングリングポインターになると、その例外を送出する C コードがコアダンプなどの" +"意図しない副作用を引き起こすおそれがあります。" #: ../../extending/extending.rst:245 msgid "" @@ -489,13 +511,13 @@ msgid "" "later in this sample." msgstr "" -#: ../../extending/extending.rst:248 msgid "" "The :exc:`!spam.error` exception can be raised in your extension module " "using a call to :c:func:`PyErr_SetString` as shown below::" msgstr "" +"次のように :c:func:`PyErr_SetString` を呼び出すと、拡張モジュールから :exc:`!" +"spam.error` 例外を送出できます。 ::" -#: ../../extending/extending.rst:251 msgid "" "static PyObject *\n" "spam_system(PyObject *self, PyObject *args)\n" @@ -513,6 +535,21 @@ msgid "" " return PyLong_FromLong(sts);\n" "}" msgstr "" +"static PyObject *\n" +"spam_system(PyObject *self, PyObject *args)\n" +"{\n" +" const char *command;\n" +" int sts;\n" +"\n" +" if (!PyArg_ParseTuple(args, \"s\", &command))\n" +" return NULL;\n" +" sts = system(command);\n" +" if (sts < 0) {\n" +" PyErr_SetString(SpamError, \"System command failed\");\n" +" return NULL;\n" +" }\n" +" return PyLong_FromLong(sts);\n" +"}" #: ../../extending/extending.rst:271 msgid "Back to the Example" @@ -844,9 +881,8 @@ msgstr "" "file:`Modules/` ディレクトリに置き、 :file:`Modules/Setup.local` に自分の" "ファイルを説明する以下の一行:" -#: ../../extending/extending.rst:473 msgid "spam spammodule.o" -msgstr "" +msgstr "spam spammodule.o" #: ../../extending/extending.rst:477 msgid "" @@ -870,9 +906,8 @@ msgstr "" "モジュールが別のライブラリとリンクされている必要がある場合、ライブラリも設定" "ファイルに列挙できます。例えば以下のようにします。" -#: ../../extending/extending.rst:486 msgid "spam spammodule.o -lX11" -msgstr "" +msgstr "spam spammodule.o -lX11" #: ../../extending/extending.rst:494 msgid "Calling Python Functions from C" @@ -929,7 +964,6 @@ msgstr "" "`Py_INCREF` するようよく注意してください!)。例えば、以下のような関数がモ" "ジュールの一部になっていることでしょう::" -#: ../../extending/extending.rst:517 msgid "" "static PyObject *my_callback = NULL;\n" "\n" @@ -955,6 +989,30 @@ msgid "" " return result;\n" "}" msgstr "" +"static PyObject *my_callback = NULL;\n" +"\n" +"static PyObject *\n" +"my_set_callback(PyObject *dummy, PyObject *args)\n" +"{\n" +" PyObject *result = NULL;\n" +" PyObject *temp;\n" +"\n" +" if (PyArg_ParseTuple(args, \"O:set_callback\", &temp)) {\n" +" if (!PyCallable_Check(temp)) {\n" +" PyErr_SetString(PyExc_TypeError, \"parameter must be " +"callable\");\n" +" return NULL;\n" +" }\n" +" Py_XINCREF(temp); /* 新しいコールバックへの参照を追加する " +"*/\n" +" Py_XDECREF(my_callback); /* 以前のコールバックを解放する */\n" +" my_callback = temp; /* 新しいコールバックを保存する */\n" +" /* \"None\" を返すための定型処理 */\n" +" Py_INCREF(Py_None);\n" +" result = Py_None;\n" +" }\n" +" return result;\n" +"}" #: ../../extending/extending.rst:540 msgid "" @@ -998,7 +1056,6 @@ msgstr "" "化コードが入った丸括弧がある場合、この関数はタプルを返します。以下に例を示し" "ます::" -#: ../../extending/extending.rst:561 msgid "" "int arg;\n" "PyObject *arglist;\n" @@ -1011,6 +1068,16 @@ msgid "" "result = PyObject_CallObject(my_callback, arglist);\n" "Py_DECREF(arglist);" msgstr "" +"int arg;\n" +"PyObject *arglist;\n" +"PyObject *result;\n" +"...\n" +"arg = 123;\n" +"...\n" +"/* コールバックを呼び出す */\n" +"arglist = Py_BuildValue(\"(i)\", arg);\n" +"result = PyObject_CallObject(my_callback, arglist);\n" +"Py_DECREF(arglist);" #: ../../extending/extending.rst:572 msgid "" @@ -1026,7 +1093,6 @@ msgstr "" "タプルを生成して引数リストとして提供しており、このタプルは :c:func:" "`PyObject_CallObject` の呼び出し直後に :c:func:`Py_DECREF` されています。" -#: ../../extending/extending.rst:579 msgid "" "The return value of :c:func:`PyObject_CallObject` is \"new\": either it is a " "brand new object, or it is an existing object whose reference count has been " @@ -1034,13 +1100,13 @@ msgid "" "should somehow :c:func:`Py_DECREF` the result, even (especially!) if you are " "not interested in its value." msgstr "" -":c:func:`PyObject_CallObject` は戻り値として \"新しい\" オブジェクト: 新規に" -"作成されたオブジェクトか、既存のオブジェクトの参照カウントをインクリメントし" -"たものを返します。従って、このオブジェクトをグローバル変数に保存したいのでな" -"いかぎり、たとえこの戻り値に興味がなくても (むしろ、そうであればなおさら!) 何" -"がしかの方法で戻り値オブジェクトを :c:func:`Py_DECREF` しなければなりません。" +":c:func:`PyObject_CallObject` の戻り値は「新しい参照」です。\n" +"新しく作成したオブジェクトか、参照カウントを増やした既存のオブジェクトを指し" +"ます。\n" +"そのため、グローバル変数に保存するのでなければ、結果に対してどこかで :c:func:" +"`Py_DECREF` を呼び出す必要があります。\n" +"戻り値を使わない場合も (特にそのような場合こそ) 必要です。" -#: ../../extending/extending.rst:585 msgid "" "Before you do this, however, it is important to check that the return value " "isn't ``NULL``. If it is, the Python function terminated by raising an " @@ -1050,25 +1116,27 @@ msgid "" "handle the exception. If this is not possible or desirable, the exception " "should be cleared by calling :c:func:`PyErr_Clear`. For example::" msgstr "" -"とはいえ、戻り値を :c:func:`Py_DECREF` する前には、値が ``NULL`` でないか" -"チェックしておくことが重要です。もし ``NULL`` なら、呼び出した Python 関数は" -"例外を送出して終了させられています。 :c:func:`PyObject_CallObject` を呼び出し" -"ているコード自体もまた Python から呼び出されているのであれば、今度は C コード" -"が自分を呼び出している Python コードにエラー標示値を返さねばなりません。それ" -"により、インタプリタはスタックトレースを出力したり、例外を処理するための " -"Python コードを呼び出したりできます。例外の送出が不可能だったり、したくないの" -"なら、 :c:func:`PyErr_Clear` を呼んで例外を消去しておかねばなりません。例えば" -"以下のようにします::" +"ただし、その前に戻り値が ``NULL`` でないことを確認する必要があります。\n" +"``NULL`` なら、Python 関数は例外を送出して終了しています。\n" +":c:func:`PyObject_CallObject` を呼び出した C コード自体が Python から呼び出さ" +"れている場合は、Python の呼び出し元にエラーを示す値を返す必要があります。\n" +"これにより、インタープリタがスタックトレースを表示したり、呼び出し元の " +"Python コードが例外を処理したりできます。\n" +"そうすることが不可能、または望ましくない場合は、:c:func:`PyErr_Clear` を呼び" +"出して例外を消去する必要があります。\n" +"例えば、次のようにします。 ::" -#: ../../extending/extending.rst:593 msgid "" "if (result == NULL)\n" " return NULL; /* Pass error back */\n" "...use result...\n" "Py_DECREF(result);" msgstr "" +"if (result == NULL)\n" +" return NULL; /* 呼び出し元にエラーを返す */\n" +"...use result...\n" +"Py_DECREF(result);" -#: ../../extending/extending.rst:598 msgid "" "Depending on the desired interface to the Python callback function, you may " "also have to provide an argument list to :c:func:`PyObject_CallObject`. In " @@ -1079,15 +1147,16 @@ msgid "" "simplest way to do this is to call :c:func:`Py_BuildValue`. For example, if " "you want to pass an integral event code, you might use the following code::" msgstr "" -"Python コールバック関数をどんなインターフェースにしたいかによっては、引数リス" -"トを :c:func:`PyObject_CallObject` に与えなければならない場合もあります。ある" -"ケースでは、コールバック関数を指定したのと同じインターフェースを介して、引数" -"リストも渡されているかもしれません。また別のケースでは、新しいタプルを構築し" -"て引数リストを渡さねばならないかもしれません。この場合最も簡単なのは :c:func:" -"`Py_BuildValue` を呼ぶやり方です。例えば、整数のイベントコードを渡したけれ" -"ば、以下のようなコードを使うことになるでしょう::" +"Python のコールバック関数にどのようなインターフェースを用意するかによって" +"は、:c:func:`PyObject_CallObject` に引数リストを渡す必要もあります。\n" +"コールバック関数を指定するインターフェースを通じて、Python プログラムが引数リ" +"ストも渡す場合があります。\n" +"その場合は、関数オブジェクトと同じ方法で保存して使えます。\n" +"一方、引数リストとして渡す新しいタプルを構築しなければならない場合もありま" +"す。\n" +"最も簡単な方法は :c:func:`Py_BuildValue` を呼び出すことです。\n" +"例えば、整数のイベントコードを渡すには、次のように書けます。 ::" -#: ../../extending/extending.rst:607 msgid "" "PyObject *arglist;\n" "...\n" @@ -1099,6 +1168,15 @@ msgid "" "/* Here maybe use the result */\n" "Py_DECREF(result);" msgstr "" +"PyObject *arglist;\n" +"...\n" +"arglist = Py_BuildValue(\"(l)\", eventcode);\n" +"result = PyObject_CallObject(my_callback, arglist);\n" +"Py_DECREF(arglist);\n" +"if (result == NULL)\n" +" return NULL; /* 呼び出し元にエラーを返す */\n" +"/* 必要ならここで結果を使う */\n" +"Py_DECREF(result);" #: ../../extending/extending.rst:617 msgid "" @@ -1112,15 +1190,14 @@ msgstr "" "c:func:`Py_BuildValue` はメモリ不足におちいるかもしれず、チェックしておくべき" "です。" -#: ../../extending/extending.rst:621 msgid "" "You may also call a function with keyword arguments by using :c:func:" "`PyObject_Call`, which supports arguments and keyword arguments. As in the " "above example, we use :c:func:`Py_BuildValue` to construct the dictionary. ::" msgstr "" -"通常の引数とキーワード引数をサポートする :c:func:`PyObject_Call` を使って、" -"キーワード引数を伴う関数呼び出しをすることができます。上の例と同じように、 :" -"c:func:`Py_BuildValue` を作って辞書を作ります。 ::" +"位置引数とキーワード引数をサポートする :c:func:`PyObject_Call` を使うと、キー" +"ワード引数を指定して関数を呼び出すこともできます。\n" +"上の例と同じように、:c:func:`Py_BuildValue` を使って辞書を構築します。 ::" #: ../../extending/extending.rst:625 msgid "" @@ -1143,11 +1220,9 @@ msgstr "拡張モジュール関数でのパラメタ展開" msgid "The :c:func:`PyArg_ParseTuple` function is declared as follows::" msgstr ":c:func:`PyArg_ParseTuple` 関数は以下のように宣言されています::" -#: ../../extending/extending.rst:645 msgid "int PyArg_ParseTuple(PyObject *arg, const char *format, ...);" -msgstr "" +msgstr "int PyArg_ParseTuple(PyObject *arg, const char *format, ...);" -#: ../../extending/extending.rst:647 msgid "" "The *arg* argument must be a tuple object containing an argument list passed " "from Python to a C function. The *format* argument must be a format string, " @@ -1155,11 +1230,12 @@ msgid "" "Reference Manual. The remaining arguments must be addresses of variables " "whose type is determined by the format string." msgstr "" -"引数 *arg* は C 関数から Python に渡される引数リストが入ったタプルオブジェク" -"トでなければなりません。 *format* 引数は書式文字列で、 Python/C API リファレ" -"ンスマニュアルの :ref:`arg-parsing` で解説されている書法に従わねばなりませ" -"ん。残りの引数は、それぞれの変数のアドレスで、書式化文字列から決まる型になっ" -"ていなければなりません。" +"引数 *arg* は、Python から C 関数に渡された引数リストを含むタプルオブジェクト" +"でなければなりません。\n" +"引数 *format* は書式文字列で、その構文は Python/C API リファレンスマニュアル" +"の :ref:`arg-parsing` で説明しています。\n" +"残りの引数には、書式文字列によって型が決まる変数のアドレスを渡す必要がありま" +"す。" #: ../../extending/extending.rst:653 msgid "" @@ -1169,10 +1245,10 @@ msgid "" "probably crash or at least overwrite random bits in memory. So be careful!" msgstr "" ":c:func:`PyArg_ParseTuple` は Python 側から与えられた引数が必要な型になってい" -"るか調べるのに対し、 :c:func:`PyArg_ParseTuple` は呼び出しの際に渡された C 変" -"数のアドレスが有効な値を持つか調べられないことに注意してください: ここで間違" -"いを犯すと、コードがクラッシュするかもしれませんし、少なくともでたらめなビッ" -"トをメモリに上書きしてしまいます。慎重に!" +"るか調べるのに対し、 ``PyArg_ParseTuple()`` は呼び出しの際に渡された C 変数の" +"アドレスが有効な値を持つか調べられないことに注意してください: ここで間違いを" +"犯すと、コードがクラッシュするかもしれませんし、少なくともでたらめなビットを" +"メモリに上書きしてしまいます。慎重に!" #: ../../extending/extending.rst:658 msgid "" @@ -1187,7 +1263,6 @@ msgstr "" msgid "Some example calls::" msgstr "以下にいくつかの呼び出し例を示します::" -#: ../../extending/extending.rst:668 msgid "" "int ok;\n" "int i, j;\n" @@ -1198,28 +1273,41 @@ msgid "" "ok = PyArg_ParseTuple(args, \"\"); /* No arguments */\n" " /* Python call: f() */" msgstr "" +"int ok;\n" +"int i, j;\n" +"long k, l;\n" +"const char *s;\n" +"Py_ssize_t size;\n" +"\n" +"ok = PyArg_ParseTuple(args, \"\"); /* 引数なし */\n" +" /* Python での呼び出し: f() */" -#: ../../extending/extending.rst:679 msgid "" "ok = PyArg_ParseTuple(args, \"s\", &s); /* A string */\n" " /* Possible Python call: f('whoops!') */" msgstr "" +"ok = PyArg_ParseTuple(args, \"s\", &s); /* 文字列 */\n" +" /* Python での呼び出し例: f('whoops!') */" -#: ../../extending/extending.rst:684 msgid "" "ok = PyArg_ParseTuple(args, \"lls\", &k, &l, &s); /* Two longs and a string " "*/\n" " /* Possible Python call: f(1, 2, 'three') */" msgstr "" +"ok = PyArg_ParseTuple(args, \"lls\", &k, &l, &s); /* long 型の値 2 個と文字" +"列 */\n" +" /* Python での呼び出し例: f(1, 2, 'three') */" -#: ../../extending/extending.rst:689 msgid "" "ok = PyArg_ParseTuple(args, \"(ii)s#\", &i, &j, &s, &size);\n" " /* A pair of ints and a string, whose size is also returned */\n" " /* Possible Python call: f((1, 2), 'three') */" msgstr "" +"ok = PyArg_ParseTuple(args, \"(ii)s#\", &i, &j, &s, &size);\n" +" /* int 型の値のペアと文字列。\n" +" 文字列のサイズも取得する */\n" +" /* Python での呼び出し例: f((1, 2), 'three') */" -#: ../../extending/extending.rst:695 msgid "" "{\n" " const char *file;\n" @@ -1233,8 +1321,18 @@ msgid "" " f('spam', 'wb', 100000) */\n" "}" msgstr "" +"{\n" +" const char *file;\n" +" const char *mode = \"r\";\n" +" int bufsize = 0;\n" +" ok = PyArg_ParseTuple(args, \"s|si\", &file, &mode, &bufsize);\n" +" /* 文字列と、省略可能な別の文字列および整数 */\n" +" /* Python での呼び出し例:\n" +" f('spam')\n" +" f('spam', 'w')\n" +" f('spam', 'wb', 100000) */\n" +"}" -#: ../../extending/extending.rst:709 msgid "" "{\n" " int left, top, right, bottom, h, v;\n" @@ -1245,8 +1343,15 @@ msgid "" " f(((0, 0), (400, 300)), (10, 10)) */\n" "}" msgstr "" +"{\n" +" int left, top, right, bottom, h, v;\n" +" ok = PyArg_ParseTuple(args, \"((ii)(ii))(ii)\",\n" +" &left, &top, &right, &bottom, &h, &v);\n" +" /* 長方形と点 */\n" +" /* Python での呼び出し例:\n" +" f(((0, 0), (400, 300)), (10, 10)) */\n" +"}" -#: ../../extending/extending.rst:720 msgid "" "{\n" " Py_complex c;\n" @@ -1255,6 +1360,13 @@ msgid "" " /* Possible Python call: myfunction(1+2j) */\n" "}" msgstr "" +"{\n" +" Py_complex c;\n" +" ok = PyArg_ParseTuple(args, \"D:myfunction\", &c);\n" +" /* 複素数。\n" +" エラー用の関数名も指定する */\n" +" /* Python での呼び出し例: myfunction(1+2j) */\n" +"}" #: ../../extending/extending.rst:731 msgid "Keyword Parameters for Extension Functions" @@ -1266,12 +1378,14 @@ msgid "" msgstr "" ":c:func:`PyArg_ParseTupleAndKeywords` は、以下のように宣言されています::" -#: ../../extending/extending.rst:737 msgid "" "int PyArg_ParseTupleAndKeywords(PyObject *arg, PyObject *kwdict,\n" " const char *format, char * const " "*kwlist, ...);" msgstr "" +"int PyArg_ParseTupleAndKeywords(PyObject *arg, PyObject *kwdict,\n" +" const char *format, char * const " +"*kwlist, ...);" #: ../../extending/extending.rst:740 msgid "" @@ -1373,12 +1487,11 @@ msgid "" "This function is the counterpart to :c:func:`PyArg_ParseTuple`. It is " "declared as follows::" msgstr "" -":c:func:`Py_BuildValue` は :c:func:`PyArg_ParseTuple` の対極に位置するもので" -"す。この関数は以下のように定義されています::" +"``Py_BuildValue()`` は :c:func:`PyArg_ParseTuple` の対極に位置するものです。" +"この関数は以下のように定義されています::" -#: ../../extending/extending.rst:816 msgid "PyObject *Py_BuildValue(const char *format, ...);" -msgstr "" +msgstr "PyObject *Py_BuildValue(const char *format, ...);" #: ../../extending/extending.rst:818 msgid "" @@ -1387,10 +1500,10 @@ msgid "" "not output) must not be pointers, just values. It returns a new Python " "object, suitable for returning from a C function called from Python." msgstr "" -":c:func:`Py_BuildValue` は、 :c:func:`PyArg_ParseTuple` の認識する一連の書式" -"単位に似た書式単位を認識します。ただし (関数への出力ではなく、入力に使われ" -"る) 引数はポインタではなく、ただの値でなければなりません。 Python から呼び出" -"された C 関数が返す値として適切な、新たな Python オブジェクトを返します。" +"``Py_BuildValue()`` は、 :c:func:`PyArg_ParseTuple` の認識する一連の書式単位" +"に似た書式単位を認識します。ただし (関数への出力ではなく、入力に使われる) 引" +"数はポインタではなく、ただの値でなければなりません。 Python から呼び出された " +"C 関数が返す値として適切な、新たな Python オブジェクトを返します。" #: ../../extending/extending.rst:823 msgid "" @@ -1403,14 +1516,14 @@ msgid "" "that format unit. To force it to return a tuple of size 0 or one, " "parenthesize the format string." msgstr "" -":c:func:`PyArg_ParseTuple` とは一つ違う点があります: :c:func:" -"`PyArg_ParseTuple` は第一引数をタプルにする必要があります (Python の引数リス" -"トは内部的には常にタプルとして表現されるからです) が、 :c:func:" -"`Py_BuildValue` はタプルを生成するとは限りません。 :c:func:`Py_BuildValue` は" -"書式文字列中に書式単位が二つかそれ以上入っている場合にのみタプルを構築しま" -"す。書式文字列が空なら、 ``None`` を返します。きっかり一つの書式単位なら、そ" -"の書式単位が記述している何らかのオブジェクトになります。サイズが 0 や 1 のタ" -"プル返させたいのなら、書式文字列を丸括弧で囲います。" +":c:func:`PyArg_ParseTuple` とは一つ違う点があります: ``PyArg_ParseTuple()`` " +"は第一引数をタプルにする必要があります (Python の引数リストは内部的には常にタ" +"プルとして表現されるからです) が、 :c:func:`Py_BuildValue` はタプルを生成する" +"とは限りません。 ``Py_BuildValue()`` は書式文字列中に書式単位が二つかそれ以上" +"入っている場合にのみタプルを構築します。書式文字列が空なら、 ``None`` を返し" +"ます。きっかり一つの書式単位なら、その書式単位が記述している何らかのオブジェ" +"クトになります。サイズが 0 や 1 のタプル返させたいのなら、書式文字列を丸括弧" +"で囲います。" #: ../../extending/extending.rst:831 msgid "" @@ -1418,7 +1531,6 @@ msgid "" msgstr "" "以下に例を示します (左に呼び出し例を、右に構築される Python 値を示します):" -#: ../../extending/extending.rst:833 msgid "" "Py_BuildValue(\"\") None\n" "Py_BuildValue(\"i\", 123) 123\n" @@ -1438,6 +1550,23 @@ msgid "" "Py_BuildValue(\"((ii)(ii)) (ii)\",\n" " 1, 2, 3, 4, 5, 6) (((1, 2), (3, 4)), (5, 6))" msgstr "" +"Py_BuildValue(\"\") None\n" +"Py_BuildValue(\"i\", 123) 123\n" +"Py_BuildValue(\"iii\", 123, 456, 789) (123, 456, 789)\n" +"Py_BuildValue(\"s\", \"hello\") 'hello'\n" +"Py_BuildValue(\"y\", \"hello\") b'hello'\n" +"Py_BuildValue(\"ss\", \"hello\", \"world\") ('hello', 'world')\n" +"Py_BuildValue(\"s#\", \"hello\", 4) 'hell'\n" +"Py_BuildValue(\"y#\", \"hello\", 4) b'hell'\n" +"Py_BuildValue(\"()\") ()\n" +"Py_BuildValue(\"(i)\", 123) (123,)\n" +"Py_BuildValue(\"(ii)\", 123, 456) (123, 456)\n" +"Py_BuildValue(\"(i,i)\", 123, 456) (123, 456)\n" +"Py_BuildValue(\"[i,i]\", 123, 456) [123, 456]\n" +"Py_BuildValue(\"{s:i,s:i}\",\n" +" \"abc\", 123, \"def\", 456) {'abc': 123, 'def': 456}\n" +"Py_BuildValue(\"((ii)(ii)) (ii)\",\n" +" 1, 2, 3, 4, 5, 6) (((1, 2), (3, 4)), (5, 6))" #: ../../extending/extending.rst:857 msgid "Reference Counts" @@ -1456,7 +1585,6 @@ msgstr "" "func:`free` で行います。C++では本質的に同じ意味で演算子 ``new`` や " "``delete`` が使われます。そこで、以下の議論は C の場合に限定して行います。" -#: ../../extending/extending.rst:865 msgid "" "Every block of memory allocated with :c:func:`malloc` should eventually be " "returned to the pool of available memory by exactly one call to :c:func:" @@ -1470,6 +1598,17 @@ msgid "" "as referencing uninitialized data --- core dumps, wrong results, mysterious " "crashes." msgstr "" +":c:func:`malloc` で確保したメモリブロックは、最終的に :c:func:`free` をちょう" +"ど 1 回呼び出して、利用可能なメモリのプールに戻す必要があります。\n" +":c:func:`free` を適切なタイミングで呼び出すことが重要です。\n" +":c:func:`free` を呼び出さないままブロックのアドレスを失うと、そのメモリはプロ" +"グラムが終了するまで再利用できません。\n" +"これをメモリリーク (:dfn:`memory leak`) と呼びます。\n" +"一方、:c:func:`free` を呼び出した後もそのブロックを使い続けると、別の :c:" +"func:`malloc` 呼び出しによるブロックの再利用と競合します。\n" +"これを解放済みメモリの使用 (:dfn:`using freed memory`) と呼びます。\n" +"初期化していないデータへの参照と同様に、コアダンプ、誤った結果、不可解なク" +"ラッシュといった悪影響があります。" #: ../../extending/extending.rst:876 msgid "" @@ -1547,7 +1686,6 @@ msgstr "" "タが C で使えるようになるかもしれませんが、それまでは参照カウント法でやってい" "く以外にはないのです。" -#: ../../extending/extending.rst:909 msgid "" "While Python uses the traditional reference counting implementation, it also " "offers a cycle detector that works to detect reference cycles. This allows " @@ -1560,15 +1698,16 @@ msgid "" "in a reference cycle, or referenced from the objects in the cycle, even " "though there are no further references to the cycle itself." msgstr "" -"Python では、伝統的な参照カウント法の実装を行っている一方で、参照の循環を検出" -"するために働く循環参照検出機構 (cycle detector) も提供しています。循環参照検" -"出機構のおかげで、直接、間接にかかわらず循環参照の生成を気にせずにアプリケー" -"ションを構築できます; というのも、参照カウント法だけを使ったガベージコレク" -"ション実装にとって循環参照は弱点だからです。循環参照は、(間接参照の場合も含め" -"て) 相互への参照が入ったオブジェクトから形成されるため、循環内のオブジェクト" -"は各々非ゼロの参照カウントを持ちます。典型的な参照カウント法の実装では、たと" -"え循環参照を形成するオブジェクトに対して他に全く参照がないとしても、循環参照" -"内のどのオブジェクトに属するメモリも再利用できません。" +"Python は従来の参照カウント法に加えて、循環参照を検出する仕組みも備えていま" +"す。\n" +"これにより、アプリケーションは直接または間接的な循環参照ができることを心配せ" +"ずに済みます。\n" +"循環参照は、参照カウント法だけで実装したガベージコレクションの弱点です。\n" +"循環参照は、直接または間接的に自分自身への参照を持つオブジェクトからなり、循" +"環内の各オブジェクトの参照カウントはゼロではありません。\n" +"通常の参照カウント法の実装では、循環そのものへの参照がほかになくなっても、循" +"環内のオブジェクトや、そこから参照されるオブジェクトのメモリを回収できませ" +"ん。" #: ../../extending/extending.rst:920 msgid "" @@ -1587,7 +1726,6 @@ msgstr "" msgid "Reference Counting in Python" msgstr "Python における参照カウント法" -#: ../../extending/extending.rst:931 msgid "" "There are two macros, ``Py_INCREF(x)`` and ``Py_DECREF(x)``, which handle " "the incrementing and decrementing of the reference count. :c:func:" @@ -1597,13 +1735,15 @@ msgid "" "this purpose (and others), every object also contains a pointer to its type " "object." msgstr "" -"Python には、参照カウントのインクリメントやデクリメントを処理する二つのマク" -"ロ、 ``Py_INCREF(x)`` と ``Py_DECREF(x)`` があります。 :c:func:`Py_DECREF` " -"は、参照カウントがゼロに到達した際に、オブジェクトのメモリ解放も行います。柔" -"軟性を持たせるために、 :c:func:`free` を直接呼び出しません --- その代わりにオ" -"ブジェクトの型オブジェクト (:dfn:`type object`) を介します。このために (他の" -"目的もありますが)、全てのオブジェクトには自身の型オブジェクトに対するポインタ" -"が入っています。" +"参照カウントを増減するマクロとして、``Py_INCREF(x)`` と ``Py_DECREF(x)`` があ" +"ります。\n" +":c:func:`Py_DECREF` は、カウントがゼロになるとオブジェクトの解放も行いま" +"す。\n" +"柔軟性を持たせるため、:c:func:`free` を直接呼び出すのではなく、オブジェクトの" +"型オブジェクト (:dfn:`type object`) にある関数ポインターを介して呼び出しま" +"す。\n" +"この目的などのために、すべてのオブジェクトは自身の型オブジェクトへのポイン" +"ターも持っています。" #: ../../extending/extending.rst:938 msgid "" @@ -1668,22 +1808,21 @@ msgid "" "properly, as well as the previous owner)." msgstr "" ":c:func:`Py_INCREF` を呼び出すと、借用参照を所有参照に変更できます。この操作" -"は参照の借用元の状態には影響しません --- :c:func:`Py_INCREF` は新たな所有参照" -"を生成し、参照の所有者が担うべき全ての責任を課します (つまり、新たな参照の所" -"有者は、以前の所有者と同様、参照の放棄を適切に行わねばなりません)。" +"は参照の借用元の状態には影響しません --- ``Py_INCREF()`` は新たな所有参照を生" +"成し、参照の所有者が担うべき全ての責任を課します (つまり、新たな参照の所有者" +"は、以前の所有者と同様、参照の放棄を適切に行わねばなりません)。" #: ../../extending/extending.rst:971 msgid "Ownership Rules" msgstr "所有権にまつわる規則" -#: ../../extending/extending.rst:973 msgid "" "Whenever an object reference is passed into or out of a function, it is part " "of the function's interface specification whether ownership is transferred " "with the reference or not." msgstr "" -"オブジェクトへの参照を関数の内外に渡す場合には、オブジェクトの所有権が参照と" -"共に渡されるか否かが常に関数インターフェース仕様の一部となります。" +"オブジェクトへの参照を関数に渡す場合も、関数から返す場合も、その参照の所有権" +"を一緒に移すかどうかは、関数のインターフェース仕様の一部です。" #: ../../extending/extending.rst:977 msgid "" @@ -1702,7 +1841,6 @@ msgstr "" "ます。例えば、 :c:func:`PyLong_FromLong` はよく使う値をキャッシュしており、" "キャッシュされた値への参照を返すことがあります。" -#: ../../extending/extending.rst:985 msgid "" "Many functions that extract objects from other objects also transfer " "ownership with the reference, for instance :c:func:" @@ -1712,13 +1850,13 @@ msgid "" "`PyDict_GetItemString` all return references that you borrow from the tuple, " "list or dictionary." msgstr "" -":c:func:`PyObject_GetAttrString` のように、あるオブジェクトから別のオブジェク" -"トを抽出するような関数もまた、参照とともに所有権を委譲します。こちらの方はや" -"や理解しにくいかもしれません。というのはよく使われるルーチンのいくつかが例外" -"となっているからです: :c:func:`PyTuple_GetItem` 、 :c:func:" -"`PyList_GetItem` 、 :c:func:`PyDict_GetItem` 、および :c:func:" -"`PyDict_GetItemString` は全て、タプル、リスト、または辞書から借用参照を返しま" -"す。" +"ほかのオブジェクトからオブジェクトを取り出す多くの関数も、参照とともに所有権" +"を移します。\n" +"例えば :c:func:`PyObject_GetAttrString` がそうです。\n" +"ただし、こちらはよく使う関数にも例外があり、少し複雑です。\n" +":c:func:`PyTuple_GetItem`、:c:func:`PyList_GetItem`、:c:func:" +"`PyDict_GetItem`、:c:func:`PyDict_GetItemString` はいずれも、タプル、リスト、" +"辞書から借用した参照を返します。" #: ../../extending/extending.rst:992 msgid "" @@ -1796,7 +1934,6 @@ msgstr "" "参照を借りている際に起きる、関係ないオブジェクトに対する :c:func:`Py_DECREF` " "の使用です。例えば::" -#: ../../extending/extending.rst:1027 msgid "" "void\n" "bug(PyObject *list)\n" @@ -1807,6 +1944,14 @@ msgid "" " PyObject_Print(item, stdout, 0); /* BUG! */\n" "}" msgstr "" +"void\n" +"bug(PyObject *list)\n" +"{\n" +" PyObject *item = PyList_GetItem(list, 0);\n" +"\n" +" PyList_SetItem(list, 1, PyLong_FromLong(0L));\n" +" PyObject_Print(item, stdout, 0); /* 不具合あり! */\n" +"}" #: ../../extending/extending.rst:1036 msgid "" @@ -1828,7 +1973,6 @@ msgid "" "count of 1, disposing of it will call its :meth:`!__del__` method." msgstr "" -#: ../../extending/extending.rst:1047 msgid "" "Since it is written in Python, the :meth:`!__del__` method can execute " "arbitrary Python code. Could it perhaps do something to invalidate the " @@ -1838,6 +1982,15 @@ msgid "" "this was the last reference to that object, it would free the memory " "associated with it, thereby invalidating ``item``." msgstr "" +":meth:`!__del__` メソッドは Python で書かれているため、任意の Python コードを" +"実行できます。\n" +"では、:c:func:`!bug` 内の ``item`` への参照を無効にすることもできるでしょう" +"か。\n" +"もちろんできます。\n" +":c:func:`!bug` に渡されたリストに :meth:`!__del__` メソッドからアクセスできれ" +"ば、``del list[0]`` に相当する文を実行できます。\n" +"これがそのオブジェクトへの最後の参照であれば、オブジェクトのメモリが解放さ" +"れ、``item`` は無効になります。" #: ../../extending/extending.rst:1055 msgid "" @@ -1847,7 +2000,6 @@ msgstr "" "問題の原因が分かれば、解決は簡単です。一時的に参照回数を増やせばよいのです。" "正しく動作するバージョンは以下のようになります::" -#: ../../extending/extending.rst:1058 msgid "" "void\n" "no_bug(PyObject *list)\n" @@ -1860,13 +2012,26 @@ msgid "" " Py_DECREF(item);\n" "}" msgstr "" +"void\n" +"no_bug(PyObject *list)\n" +"{\n" +" PyObject *item = PyList_GetItem(list, 0);\n" +"\n" +" Py_INCREF(item);\n" +" PyList_SetItem(list, 1, PyLong_FromLong(0L));\n" +" PyObject_Print(item, stdout, 0);\n" +" Py_DECREF(item);\n" +"}" -#: ../../extending/extending.rst:1069 msgid "" "This is a true story. An older version of Python contained variants of this " "bug and someone spent a considerable amount of time in a C debugger to " "figure out why his :meth:`!__del__` methods would fail..." msgstr "" +"これは実際にあった話です。\n" +"古いバージョンの Python にはこの種の不具合があり、:meth:`!__del__` メソッドが" +"失敗する理由を突き止めるために、C のデバッガーでかなりの時間を費やした人がい" +"ました。" #: ../../extending/extending.rst:1073 msgid "" @@ -1889,7 +2054,6 @@ msgstr "" "ロセッサを利用できるようにします。明らかに、以下の関数は上の例と似た問題をは" "らんでいます::" -#: ../../extending/extending.rst:1082 msgid "" "void\n" "bug(PyObject *list)\n" @@ -1901,6 +2065,15 @@ msgid "" " PyObject_Print(item, stdout, 0); /* BUG! */\n" "}" msgstr "" +"void\n" +"bug(PyObject *list)\n" +"{\n" +" PyObject *item = PyList_GetItem(list, 0);\n" +" Py_BEGIN_ALLOW_THREADS\n" +" ...some blocking I/O call...\n" +" Py_END_ALLOW_THREADS\n" +" PyObject_Print(item, stdout, 0); /* 不具合あり! */\n" +"}" #: ../../extending/extending.rst:1096 msgid "NULL Pointers" @@ -1981,7 +2154,6 @@ msgstr "" msgid "Writing Extensions in C++" msgstr "C++での拡張モジュール作成" -#: ../../extending/extending.rst:1137 msgid "" "It is possible to write extension modules in C++. Some restrictions apply. " "If the main program (the Python interpreter) is compiled and linked by the C " @@ -1993,16 +2165,16 @@ msgid "" "`` --- they use this form already if the symbol ``__cplusplus`` is defined " "(all recent C++ compilers define this symbol)." msgstr "" -"C++でも拡張モジュールは作成できます。ただしいくつか制限があります。メインプロ" -"グラム (Python インタプリタ) は C コンパイラでコンパイルされリンクされている" -"ので、グローバル変数や静的オブジェクトをコンストラクタで作成できません。メイ" -"ンプログラムが C++ コンパイラでリンクされているならこれは問題ではありませ" -"ん。 Python インタプリタから呼び出される関数 (特にモジュール初期化関数) は、 " -"``extern \"C\"`` を使って宣言しなければなりません。また、Python ヘッダファイ" -"ルを ``extern \"C\" {...}`` に入れる必要はありません--- シンボル " -"``__cplusplus`` (最近の C++ コンパイラは全てこのシンボルを定義しています) が" -"定義されているときに ``extern \"C\" {...}`` が行われるように、ヘッダファイル" -"内にすでに書かれているからです。" +"C++ でも拡張モジュールを作成できますが、いくつか制限があります。\n" +"メインプログラム (Python インタープリタ) を C コンパイラでコンパイルしてリン" +"クする場合、コンストラクターを持つグローバルオブジェクトや静的オブジェクトは" +"使えません。\n" +"メインプログラムを C++ コンパイラでリンクする場合は問題ありません。\n" +"Python インタープリタから呼び出される関数 (特にモジュール初期化関数) は、" +"``extern \"C\"`` を使って宣言する必要があります。\n" +"Python のヘッダーファイルを ``extern \"C\" {...}`` で囲む必要はありません。\n" +"シンボル ``__cplusplus`` が定義されていれば、ヘッダーファイル自体がこの形式を" +"使います (最近の C++ コンパイラはすべてこのシンボルを定義します)。" #: ../../extending/extending.rst:1151 msgid "Providing a C API for an Extension Module" @@ -2026,7 +2198,6 @@ msgstr "" "たなコレクション型も他の拡張モジュールから直接操作できるようにするには一連の " "C 関数を持っていなければなりません。" -#: ../../extending/extending.rst:1164 msgid "" "At first sight this seems easy: just write the functions (without declaring " "them ``static``, of course), provide an appropriate header file, and " @@ -2041,18 +2212,21 @@ msgid "" "if symbols are globally visible, the module whose functions one wishes to " "call might not have been loaded yet!" msgstr "" -"一見するとこれは簡単なこと: 単に関数を (もちろん ``static`` などとは宣言せず" -"に) 書いて、適切なヘッダファイルを提供し、C API を書けばよいだけ、に思えま" -"す。そして実際のところ、全ての拡張モジュールが Python インタプリタに常に静的" -"にリンクされている場合にはうまく動作します。ところがモジュールが共有ライブラ" -"リの場合には、一つのモジュールで定義されているシンボルが他のモジュールから不" -"可視なことがあります。可視性の詳細はオペレーティングシステムによります; ある" -"システムは Python インタプリタと全ての拡張モジュール用に単一のグローバルな名" -"前空間を用意しています (例えば Windows)。別のシステムはモジュールのリンク時に" -"取り込まれるシンボルを明示的に指定する必要があります (AIX がその一例です)、ま" -"た別のシステム (ほとんどの Unix) では、違った戦略を選択肢として提供していま" -"す。そして、たとえシンボルがグローバル変数として可視であっても、呼び出したい" -"関数の入ったモジュールがまだロードされていないことだってあります!" +"一見すると簡単そうです。\n" +"関数を書き (もちろん ``static`` は付けずに)、適切なヘッダーファイルを用意し、" +"C API の使い方を文書化すればよさそうです。\n" +"実際、すべての拡張モジュールを常に Python インタープリタに静的にリンクするの" +"であれば、この方法で動作します。\n" +"しかし、モジュールを共有ライブラリとして使う場合、あるモジュールで定義したシ" +"ンボルが別のモジュールから見えるとは限りません。\n" +"可視性の詳細はオペレーティングシステムによって異なります。\n" +"Python インタープリタとすべての拡張モジュールで単一のグローバルな名前空間を使" +"うシステムもあれば (例えば Windows)、\n" +"モジュールのリンク時にインポートするシンボルを明示的に列挙する必要があるシス" +"テム (例えば AIX) や、\n" +"複数の方式から選べるシステム (ほとんどの Unix) もあります。\n" +"そして、シンボルがどこからでも見える場合でも、呼び出したい関数のあるモジュー" +"ルがまだロードされていないかもしれません。" #: ../../extending/extending.rst:1176 msgid "" @@ -2070,7 +2244,6 @@ msgstr "" "張モジュールからアクセスを *受けるべきではない* シンボルは別のやり方で公開せ" "ねばなりません。" -#: ../../extending/extending.rst:1183 msgid "" "Python provides a special mechanism to pass C-level information (pointers) " "from one extension module to another one: Capsules. A Capsule is a Python " @@ -2081,15 +2254,16 @@ msgid "" "module, retrieve the value of this name, and then retrieve the pointer from " "the Capsule." msgstr "" -"Python はある拡張モジュールの C レベルの情報 (ポインタ) を別のモジュールに渡" -"すための特殊な機構: Capsule (カプセル)を提供しています。 Capsule はポインタ " -"(:c:expr:`void \\*`) を記憶する Python のデータ型です。 Capsule は C API を介" -"してのみ生成したりアクセスしたりできますが、他の Python オブジェクトと同じよ" -"うに受け渡しできます。とりわけ、Capsule は拡張モジュールの名前空間内にある名" -"前に代入できます。他の拡張モジュールはこのモジュールを import でき、次に名前" -"を取得し、最後にCapsule へのポインタを取得します。" +"Python は、拡張モジュール間で C レベルの情報 (ポインター) を渡すための特別な" +"仕組みとして Capsule を提供しています。\n" +"Capsule はポインター (:c:expr:`void \\*`) を格納する Python のデータ型で" +"す。\n" +"作成や内容へのアクセスは C API 経由でしかできませんが、ほかの Python オブジェ" +"クトと同様に受け渡せます。\n" +"特に、拡張モジュールの名前空間にある名前に代入できます。\n" +"ほかの拡張モジュールはそのモジュールをインポートし、その名前に対応する値を取" +"得して、Capsule の中からポインターを取り出せます。" -#: ../../extending/extending.rst:1191 msgid "" "There are many ways in which Capsules can be used to export the C API of an " "extension module. Each function could get its own Capsule, or all C API " @@ -2098,11 +2272,11 @@ msgid "" "distributed in different ways between the module providing the code and the " "client modules." msgstr "" -"拡張モジュールの C API を公開するために、様々な方法で Capsule が使われます。" -"各関数を1つのオブジェクトに入れたり、全ての C API のポインタ配列を Capsule に" -"入れることができます。そして、ポインタに対する保存や取得といった様々な作業" -"は、コードを提供しているモジュールとクライアントモジュールとの間では異なる方" -"法で分散できます。" +"Capsule を使って拡張モジュールの C API を公開する方法はいくつもあります。\n" +"関数ごとに専用の Capsule を用意してもよいですし、すべての C API ポインターを" +"配列に格納し、その配列のアドレスを Capsule で公開しても構いません。\n" +"ポインターの保存や取得に関わる処理を、コードを提供するモジュールとクライアン" +"トモジュールにどう分担させるかにも、様々な方法があります。" #: ../../extending/extending.rst:1197 msgid "" @@ -2128,9 +2302,8 @@ msgstr "" "特に、 C API を公開するための Capsule には次のルールに従った名前を付けるべき" "です::" -#: ../../extending/extending.rst:1207 msgid "modulename.attributename" -msgstr "" +msgstr "modulename.attributename" #: ../../extending/extending.rst:1209 msgid "" @@ -2173,13 +2346,13 @@ msgid "" "modules." msgstr "" -#: ../../extending/extending.rst:1229 msgid "" "The function :c:func:`!PySpam_System` is a plain C function, declared " "``static`` like everything else::" msgstr "" +":c:func:`!PySpam_System` は普通の C 関数で、ほかと同じく ``static`` として宣" +"言します。 ::" -#: ../../extending/extending.rst:1232 msgid "" "static int\n" "PySpam_System(const char *command)\n" @@ -2187,12 +2360,15 @@ msgid "" " return system(command);\n" "}" msgstr "" +"static int\n" +"PySpam_System(const char *command)\n" +"{\n" +" return system(command);\n" +"}" -#: ../../extending/extending.rst:1238 msgid "The function :c:func:`!spam_system` is modified in a trivial way::" -msgstr "" +msgstr ":c:func:`!spam_system` には、ごく簡単な変更を加えます。 ::" -#: ../../extending/extending.rst:1240 msgid "" "static PyObject *\n" "spam_system(PyObject *self, PyObject *args)\n" @@ -2206,24 +2382,35 @@ msgid "" " return PyLong_FromLong(sts);\n" "}" msgstr "" +"static PyObject *\n" +"spam_system(PyObject *self, PyObject *args)\n" +"{\n" +" const char *command;\n" +" int sts;\n" +"\n" +" if (!PyArg_ParseTuple(args, \"s\", &command))\n" +" return NULL;\n" +" sts = PySpam_System(command);\n" +" return PyLong_FromLong(sts);\n" +"}" #: ../../extending/extending.rst:1252 msgid "In the beginning of the module, right after the line ::" msgstr "モジュールの先頭にある以下の行 ::" -#: ../../extending/extending.rst:1254 msgid "#include " -msgstr "" +msgstr "#include " #: ../../extending/extending.rst:1256 msgid "two more lines must be added::" msgstr "の直後に、以下の二行を必ず追加してください::" -#: ../../extending/extending.rst:1258 msgid "" "#define SPAM_MODULE\n" "#include \"spammodule.h\"" msgstr "" +"#define SPAM_MODULE\n" +"#include \"spammodule.h\"" #: ../../extending/extending.rst:1261 msgid "" @@ -2280,7 +2467,6 @@ msgstr "" "からくりの大部分はヘッダファイル :file:`spammodule.h` 内にあり、以下のように" "なっています::" -#: ../../extending/extending.rst:1296 msgid "" "#ifndef Py_SPAMMODULE_H\n" "#define Py_SPAMMODULE_H\n" @@ -2331,6 +2517,54 @@ msgid "" "\n" "#endif /* !defined(Py_SPAMMODULE_H) */" msgstr "" +"#ifndef Py_SPAMMODULE_H\n" +"#define Py_SPAMMODULE_H\n" +"#ifdef __cplusplus\n" +"extern \"C\" {\n" +"#endif\n" +"\n" +"/* spammodule のヘッダーファイル */\n" +"\n" +"/* C API 関数 */\n" +"#define PySpam_System_NUM 0\n" +"#define PySpam_System_RETURN int\n" +"#define PySpam_System_PROTO (const char *command)\n" +"\n" +"/* C API ポインターの総数 */\n" +"#define PySpam_API_pointers 1\n" +"\n" +"\n" +"#ifdef SPAM_MODULE\n" +"/* この部分は spammodule.c のコンパイル時に使う */\n" +"\n" +"static PySpam_System_RETURN PySpam_System PySpam_System_PROTO;\n" +"\n" +"#else\n" +"/* この部分は spammodule の API を使うモジュールで使う */\n" +"\n" +"static void **PySpam_API;\n" +"\n" +"#define PySpam_System \\\n" +" (*(PySpam_System_RETURN (*)PySpam_System_PROTO) " +"PySpam_API[PySpam_System_NUM])\n" +"\n" +"/* エラー時は -1、成功時は 0 を返す。\n" +" * エラーがあれば PyCapsule_Import が例外を設定する。\n" +" */\n" +"static int\n" +"import_spam(void)\n" +"{\n" +" PySpam_API = (void **)PyCapsule_Import(\"spam._C_API\", 0);\n" +" return (PySpam_API != NULL) ? 0 : -1;\n" +"}\n" +"\n" +"#endif\n" +"\n" +"#ifdef __cplusplus\n" +"}\n" +"#endif\n" +"\n" +"#endif /* !defined(Py_SPAMMODULE_H) */" #: ../../extending/extending.rst:1344 msgid "" @@ -2356,15 +2590,13 @@ msgid "" "}" msgstr "" -#: ../../extending/extending.rst:1362 msgid "" "The main disadvantage of this approach is that the file :file:`spammodule.h` " "is rather complicated. However, the basic structure is the same for each " "function that is exported, so it has to be learned only once." msgstr "" -"このアプローチの主要な欠点は、 :file:`spammodule.h` がやや難解になるというこ" -"とです。とはいえ、各関数の基本的な構成は公開されるものと同じなので、書き方を" -"一度だけ学べばすみます。" +"この方法の主な欠点は、:file:`spammodule.h` がやや複雑になることです。\n" +"ただし、公開するどの関数でも基本構造は同じなので、一度覚えれば済みます。" #: ../../extending/extending.rst:1366 msgid "" @@ -2419,17 +2651,14 @@ msgstr "" "\"旧式の\" 呼び出し規約を使っている場合には、この保証は適用されません --- 既" "存のコードにはいまだに旧式の呼び出し規約が多々あります。" -#: ../../extending/extending.rst:550 msgid "PyObject_CallObject (C function)" -msgstr "" +msgstr "PyObject_CallObject (C 関数)" -#: ../../extending/extending.rst:641 msgid "PyArg_ParseTuple (C function)" -msgstr "" +msgstr "PyArg_ParseTuple (C 関数)" -#: ../../extending/extending.rst:733 msgid "PyArg_ParseTupleAndKeywords (C function)" -msgstr "" +msgstr "PyArg_ParseTupleAndKeywords (C 関数)" #: ../../extending/extending.rst:754 msgid "Philbrick, Geoff" diff --git a/extending/index.po b/extending/index.po index c0ecf37e0..3a928db7e 100644 --- a/extending/index.po +++ b/extending/index.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: 菊池 健志, 2023\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../extending/index.rst:5 @@ -127,14 +127,13 @@ msgstr "" msgid "Embedding the CPython runtime in a larger application" msgstr "大規模なアプリケーションへの Python ランタイムの埋め込み" -#: ../../extending/index.rst:65 msgid "" "Sometimes, rather than creating an extension that runs inside the Python " "interpreter as the main application, it is desirable to instead embed the " "CPython runtime inside a larger application. This section covers some of the " "details involved in doing that successfully." msgstr "" -"Python インタープリタの中でメインアプリケーションとして実行される拡張を作るの" -"ではなく、 CPython をより大きなアプリケーションの中に埋め込む方が望ましいこと" -"があります。\n" -"この節ではその上手い埋め込みに関わる詳細について説明します。" +"Python インタープリタをメインアプリケーションとして、その中で実行する拡張を作" +"るよりも、大きなアプリケーションの中に CPython ランタイムを組み込む方が望まし" +"い場合があります。\n" +"この節では、そのために必要な詳細の一部を説明します。" diff --git a/extending/newtypes.po b/extending/newtypes.po index be08e8875..98f2a5cc7 100644 --- a/extending/newtypes.po +++ b/extending/newtypes.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../extending/newtypes.rst:7 @@ -44,7 +44,6 @@ msgstr "" "以下は :c:type:`PyTypeObject` の定義です。 :ref:`デバッグビルド ` でしか使われないいくつかのメンバは省いてあります:" -#: ../../extending/newtypes.rst:17 msgid "" "typedef struct _typeobject {\n" " PyObject_VAR_HEAD\n" @@ -142,6 +141,101 @@ msgid "" " uint16_t tp_versions_used;\n" "} PyTypeObject;\n" msgstr "" +"typedef struct _typeobject {\n" +" PyObject_VAR_HEAD\n" +" const char *tp_name; /* 表示用。形式は \".\" */\n" +" Py_ssize_t tp_basicsize, tp_itemsize; /* 割り当て用 */\n" +"\n" +" /* 標準の操作を実装するメソッド */\n" +"\n" +" destructor tp_dealloc;\n" +" Py_ssize_t tp_vectorcall_offset;\n" +" getattrfunc tp_getattr;\n" +" setattrfunc tp_setattr;\n" +" PyAsyncMethods *tp_as_async; /* 以前の名前は tp_compare (Python 2)\n" +" または tp_reserved (Python 3) */\n" +" reprfunc tp_repr;\n" +"\n" +" /* 標準クラス用のメソッド群 */\n" +"\n" +" PyNumberMethods *tp_as_number;\n" +" PySequenceMethods *tp_as_sequence;\n" +" PyMappingMethods *tp_as_mapping;\n" +"\n" +" /* その他の標準の操作 (バイナリ互換性のためこの位置に配置) */\n" +"\n" +" hashfunc tp_hash;\n" +" ternaryfunc tp_call;\n" +" reprfunc tp_str;\n" +" getattrofunc tp_getattro;\n" +" setattrofunc tp_setattro;\n" +"\n" +" /* オブジェクトを入出力バッファとして扱う関数 */\n" +" PyBufferProcs *tp_as_buffer;\n" +"\n" +" /* 任意機能や拡張機能の有無を定義するフラグ */\n" +" unsigned long tp_flags;\n" +"\n" +" const char *tp_doc; /* ドキュメント文字列 */\n" +"\n" +" /* リリース 2.0 で意味を割り当て */\n" +" /* アクセス可能な全オブジェクトについて関数を呼び出す */\n" +" traverseproc tp_traverse;\n" +"\n" +" /* 保持するオブジェクトへの参照を削除する */\n" +" inquiry tp_clear;\n" +"\n" +" /* リリース 2.1 で意味を割り当て */\n" +" /* 拡張比較 */\n" +" richcmpfunc tp_richcompare;\n" +"\n" +" /* 弱参照を有効にする */\n" +" Py_ssize_t tp_weaklistoffset;\n" +"\n" +" /* イテレータ */\n" +" getiterfunc tp_iter;\n" +" iternextfunc tp_iternext;\n" +"\n" +" /* 属性デスクリプタとサブクラス化に関するもの */\n" +" PyMethodDef *tp_methods;\n" +" PyMemberDef *tp_members;\n" +" PyGetSetDef *tp_getset;\n" +" // ヒープ型では強参照、静的な型では借用参照\n" +" PyTypeObject *tp_base;\n" +" PyObject *tp_dict;\n" +" descrgetfunc tp_descr_get;\n" +" descrsetfunc tp_descr_set;\n" +" Py_ssize_t tp_dictoffset;\n" +" initproc tp_init;\n" +" allocfunc tp_alloc;\n" +" newfunc tp_new;\n" +" freefunc tp_free; /* 低レベルのメモリ解放ルーチン */\n" +" inquiry tp_is_gc; /* PyObject_IS_GC 用 */\n" +" PyObject *tp_bases;\n" +" PyObject *tp_mro; /* メソッド解決順序 */\n" +" PyObject *tp_cache; /* 現在は未使用 */\n" +" void *tp_subclasses; /* 静的な組み込み型ではインデックス */\n" +" PyObject *tp_weaklist; /* 静的な組み込み型では未使用 */\n" +" destructor tp_del;\n" +"\n" +" /* 型の属性キャッシュのバージョンタグ。バージョン 2.6 で追加。\n" +" * ゼロならキャッシュは無効であり、初期化が必要。\n" +" */\n" +" unsigned int tp_version_tag;\n" +"\n" +" destructor tp_finalize;\n" +" vectorcallfunc tp_vectorcall;\n" +"\n" +" /* この型に関心を持つ型ウォッチャーを表すビット集合 */\n" +" unsigned char tp_watched;\n" +"\n" +" /* 使用された tp_version_tag 値の数。\n" +" * 属性キャッシュがこの型で無効な場合は、\n" +" * _Py_ATTR_CACHE_UNUSED に設定する (独自の MRO エントリーなどによる)。\n" +" * それ以外の場合は MAX_VERSIONS_PER_CLASS (別の場所で定義) 以下。\n" +" */\n" +" uint16_t tp_versions_used;\n" +"} PyTypeObject;\n" #: ../../extending/newtypes.rst:20 msgid "" @@ -169,9 +263,8 @@ msgstr "" "多くの場合いちばん簡単なのは、必要とするメンバがすべて含まれている例をとって" "きて、新しく作る型に合わせて値を変更することです。 ::" -#: ../../extending/newtypes.rst:31 msgid "const char *tp_name; /* For printing */" -msgstr "" +msgstr "const char *tp_name; /* 表示用 */" #: ../../extending/newtypes.rst:33 msgid "" @@ -183,9 +276,8 @@ msgstr "" "は診断目的で使われるものです。\n" "それなので、そのような場面で役に立つであろう名前を選んでください! ::" -#: ../../extending/newtypes.rst:37 msgid "Py_ssize_t tp_basicsize, tp_itemsize; /* For allocation */" -msgstr "" +msgstr "Py_ssize_t tp_basicsize, tp_itemsize; /* 割り当て用 */" #: ../../extending/newtypes.rst:39 msgid "" @@ -201,17 +293,15 @@ msgstr "" "度あり、ここで :c:member:`~PyTypeObject.tp_itemsize` メンバが使われます。これ" "らについてはあとでふれます。 ::" -#: ../../extending/newtypes.rst:44 msgid "const char *tp_doc;" -msgstr "" +msgstr "const char *tp_doc;" -#: ../../extending/newtypes.rst:46 msgid "" "Here you can put a string (or its address) that you want returned when the " "Python script references ``obj.__doc__`` to retrieve the doc string." msgstr "" -"ここには Python スクリプトリファレンス ``obj.__doc__`` が doc string を返すと" -"きの文字列 (あるいはそのアドレス) を入れます。" +"ここには、Python スクリプトが ``obj.__doc__`` を参照してドキュメント文字列を" +"取得するときに返す文字列 (またはそのアドレス) を設定します。" #: ../../extending/newtypes.rst:49 msgid "" @@ -225,9 +315,8 @@ msgstr "" msgid "Finalization and De-allocation" msgstr "ファイナライズとメモリ解放" -#: ../../extending/newtypes.rst:64 msgid "destructor tp_dealloc;" -msgstr "" +msgstr "destructor tp_dealloc;" #: ../../extending/newtypes.rst:66 msgid "" @@ -243,7 +332,6 @@ msgstr "" "す。オブジェクトそれ自体もここで解放される必要があります。この関数の例は、以" "下のようなものです::" -#: ../../extending/newtypes.rst:72 msgid "" "static void\n" "newdatatype_dealloc(PyObject *op)\n" @@ -253,14 +341,22 @@ msgid "" " Py_TYPE(self)->tp_free(self);\n" "}" msgstr "" +"static void\n" +"newdatatype_dealloc(PyObject *op)\n" +"{\n" +" newdatatypeobject *self = (newdatatypeobject *) op;\n" +" free(self->obj_UnderlyingDatatypePtr);\n" +" Py_TYPE(self)->tp_free(self);\n" +"}" -#: ../../extending/newtypes.rst:80 msgid "" "If your type supports garbage collection, the destructor should call :c:func:" "`PyObject_GC_UnTrack` before clearing any member fields::" msgstr "" +"型がガベージコレクションをサポートする場合、デストラクタでは、メンバフィール" +"ドをクリアする前に :c:func:`PyObject_GC_UnTrack` を呼び出す必要がありま" +"す。 ::" -#: ../../extending/newtypes.rst:83 msgid "" "static void\n" "newdatatype_dealloc(PyObject *op)\n" @@ -272,6 +368,15 @@ msgid "" " Py_TYPE(self)->tp_free(self);\n" "}" msgstr "" +"static void\n" +"newdatatype_dealloc(PyObject *op)\n" +"{\n" +" newdatatypeobject *self = (newdatatypeobject *) op;\n" +" PyObject_GC_UnTrack(op);\n" +" Py_CLEAR(self->other_obj);\n" +" ...\n" +" Py_TYPE(self)->tp_free(self);\n" +"}" #: ../../extending/newtypes.rst:97 msgid "" @@ -298,7 +403,6 @@ msgstr "" "たらそれを元に戻すことです。これは :c:func:`PyErr_Fetch` および :c:func:" "`PyErr_Restore` 関数を使うことによって可能になります::" -#: ../../extending/newtypes.rst:109 msgid "" "static void\n" "my_dealloc(PyObject *obj)\n" @@ -328,8 +432,34 @@ msgid "" " Py_TYPE(self)->tp_free(self);\n" "}" msgstr "" +"static void\n" +"my_dealloc(PyObject *obj)\n" +"{\n" +" MyObject *self = (MyObject *) obj;\n" +" PyObject *cbresult;\n" +"\n" +" if (self->my_callback != NULL) {\n" +" PyObject *err_type, *err_value, *err_traceback;\n" +"\n" +" /* 現在の例外の状態を保存する */\n" +" PyErr_Fetch(&err_type, &err_value, &err_traceback);\n" +"\n" +" cbresult = PyObject_CallNoArgs(self->my_callback);\n" +" if (cbresult == NULL) {\n" +" PyErr_WriteUnraisable(self->my_callback);\n" +" }\n" +" else {\n" +" Py_DECREF(cbresult);\n" +" }\n" +"\n" +" /* 保存した例外の状態を復元する */\n" +" PyErr_Restore(err_type, err_value, err_traceback);\n" +"\n" +" Py_DECREF(self->my_callback);\n" +" }\n" +" Py_TYPE(self)->tp_free(self);\n" +"}" -#: ../../extending/newtypes.rst:138 msgid "" "There are limitations to what you can safely do in a deallocator function. " "First, if your type supports garbage collection (using :c:member:" @@ -341,16 +471,16 @@ msgid "" "(as in the example above) might end up calling :c:member:`~PyTypeObject." "tp_dealloc` again, causing a double free and a crash." msgstr "" -"メモリ解放関数の中で安全に行えることにはいくつか制限があります。\n" -"1つ目は、その型が (:c:member:`~PyTypeObject.tp_traverse` および :c:member:" -"`~PyTypeObject.tp_clear` を使って) ガベージコレクションをサポートしている場" -"合、 :c:member:`~PyTypeObject.tp_dealloc` が呼び出されるまでに、消去されファ" -"イナライズされてしまうオブジェクトのメンバーが有り得ることです。\n" -"2つ目は、 :c:member:`~PyTypeObject.tp_dealloc` の中ではオブジェクトは不安定な" -"状態にあることです: つまり参照カウントが0であるということです。\n" -"(上の例にあるような) 複雑なオブジェクトや API の呼び出しでは、 :c:member:" -"`~PyTypeObject.tp_dealloc` を再度呼び出し、二重解放からクラッシュすることにな" -"るかもしれません。" +"メモリ解放関数で安全に行えることには制限があります。\n" +"まず、型が (:c:member:`~PyTypeObject.tp_traverse`、:c:member:`~PyTypeObject." +"tp_clear` の一方または両方を使って) ガベージコレクションをサポートする場合、:" +"c:member:`~PyTypeObject.tp_dealloc` が呼ばれる時点で、オブジェクトの一部のメ" +"ンバがすでにクリアされているか、ファイナライズされている可能性があります。\n" +"また、:c:member:`~PyTypeObject.tp_dealloc` の中ではオブジェクトの参照カウント" +"がゼロになっており、不安定な状態にあります。\n" +"上の例のような単純でないオブジェクトや API の呼び出しは、:c:member:" +"`~PyTypeObject.tp_dealloc` を再び呼び出し、二重解放によるクラッシュを引き起こ" +"す可能性があります。" #: ../../extending/newtypes.rst:147 msgid "" @@ -381,11 +511,12 @@ msgstr "" "`print` 関数は単に :func:`str` を呼び出します。) これらのハンドラはどちらも省" "略できます。" -#: ../../extending/newtypes.rst:167 msgid "" "reprfunc tp_repr;\n" "reprfunc tp_str;" msgstr "" +"reprfunc tp_repr;\n" +"reprfunc tp_str;" #: ../../extending/newtypes.rst:170 msgid "" @@ -397,7 +528,6 @@ msgstr "" "表現を格納した文字列オブジェクトを返す必要があります。簡単な例は以下のような" "ものです::" -#: ../../extending/newtypes.rst:174 msgid "" "static PyObject *\n" "newdatatype_repr(PyObject *op)\n" @@ -407,13 +537,22 @@ msgid "" " self->obj_UnderlyingDatatypePtr->size);\n" "}" msgstr "" +"static PyObject *\n" +"newdatatype_repr(PyObject *op)\n" +"{\n" +" newdatatypeobject *self = (newdatatypeobject *) op;\n" +" return PyUnicode_FromFormat(\"Repr-ified_newdatatype{{size:%d}}\",\n" +" self->obj_UnderlyingDatatypePtr->size);\n" +"}" -#: ../../extending/newtypes.rst:182 msgid "" "If no :c:member:`~PyTypeObject.tp_repr` handler is specified, the " "interpreter will supply a representation that uses the type's :c:member:" "`~PyTypeObject.tp_name` and a uniquely identifying value for the object." msgstr "" +":c:member:`~PyTypeObject.tp_repr` ハンドラを指定しない場合、インタープリタは" +"その型の :c:member:`~PyTypeObject.tp_name` とオブジェクトを一意に識別する値を" +"使った表現を生成します。" #: ../../extending/newtypes.rst:186 msgid "" @@ -437,7 +576,6 @@ msgstr "" msgid "Here is a simple example::" msgstr "以下は簡単な例です::" -#: ../../extending/newtypes.rst:195 msgid "" "static PyObject *\n" "newdatatype_str(PyObject *op)\n" @@ -447,12 +585,18 @@ msgid "" " self->obj_UnderlyingDatatypePtr->size);\n" "}" msgstr "" +"static PyObject *\n" +"newdatatype_str(PyObject *op)\n" +"{\n" +" newdatatypeobject *self = (newdatatypeobject *) op;\n" +" return PyUnicode_FromFormat(\"Stringified_newdatatype{{size:%d}}\",\n" +" self->obj_UnderlyingDatatypePtr->size);\n" +"}" #: ../../extending/newtypes.rst:206 msgid "Attribute Management" msgstr "属性を管理する" -#: ../../extending/newtypes.rst:208 msgid "" "For every object which can support attributes, the corresponding type must " "provide the functions that control how the attributes are resolved. There " @@ -461,8 +605,12 @@ msgid "" "an attribute is a special case, for which the new value passed to the " "handler is ``NULL``." msgstr "" +"属性を持つオブジェクトでは、対応する型が属性の解決方法を制御する関数を提供す" +"る必要があります。\n" +"属性を定義する場合は取得用の関数が、属性の設定を許可する場合は設定用の関数が" +"必要です。\n" +"属性の削除は特別な場合で、ハンドラには新しい値として ``NULL`` を渡します。" -#: ../../extending/newtypes.rst:214 msgid "" "Python supports two pairs of attribute handlers; a type that supports " "attributes only needs to implement the functions for one pair. The " @@ -470,8 +618,12 @@ msgid "" "`char\\*`, while the other accepts a :c:expr:`PyObject*`. Each type can use " "whichever pair makes more sense for the implementation's convenience. ::" msgstr "" +"Python は属性ハンドラの組を二つサポートしています。\n" +"属性をサポートする型は、どちらか一組の関数だけを実装すれば十分です。\n" +"違いは、一方が属性名を :c:expr:`char\\*` で受け取り、もう一方は :c:expr:" +"`PyObject*` で受け取る点です。\n" +"各型は実装に都合のよい方を使えます。 ::" -#: ../../extending/newtypes.rst:220 msgid "" "getattrfunc tp_getattr; /* char * version */\n" "setattrfunc tp_setattr;\n" @@ -479,8 +631,12 @@ msgid "" "getattrofunc tp_getattro; /* PyObject * version */\n" "setattrofunc tp_setattro;" msgstr "" +"getattrfunc tp_getattr; /* char * 版 */\n" +"setattrfunc tp_setattr;\n" +"/* ... */\n" +"getattrofunc tp_getattro; /* PyObject * 版 */\n" +"setattrofunc tp_setattro;" -#: ../../extending/newtypes.rst:226 msgid "" "If accessing attributes of an object is always a simple operation (this will " "be explained shortly), there are generic implementations which can be used " @@ -490,6 +646,11 @@ msgid "" "examples which have not been updated to use some of the new generic " "mechanism that is available." msgstr "" +"オブジェクトの属性へのアクセスが常に単純な操作で済む場合 (この後で説明しま" +"す)、:c:expr:`PyObject*` 版の属性管理関数として使える汎用の実装があります。\n" +"Python 2.2 以降、型固有の属性ハンドラが実際に必要になることはほとんどなくなり" +"ました。\n" +"ただし、新しい汎用の仕組みを使うように更新されていない例も数多くあります。" #: ../../extending/newtypes.rst:237 msgid "Generic Attribute Management" @@ -510,24 +671,20 @@ msgid "" msgstr "" ":c:func:`PyType_Ready` が呼ばれたとき、すでに属性の名前がわかっていること。" -#: ../../extending/newtypes.rst:245 msgid "" "No special processing is needed to record that an attribute was looked up or " "set, nor do actions need to be taken based on the value." msgstr "" -"属性を参照したり設定したりするときに、特別な記録のための処理が必要でなく、ま" -"た参照したり設定した値に対してどんな操作も実行する必要がないこと。" +"属性が取得または設定されたことを記録するための特別な処理も、属性の値に応じた" +"処理も不要であること。" -#: ../../extending/newtypes.rst:248 msgid "" "Note that this list does not place any restrictions on the values of the " "attributes, when the values are computed, or how relevant data is stored." msgstr "" -"これらの条件は、属性の値や、値が計算されるタイミング、または格納されたデータ" -"がどの程度妥当なものであるかといったことになんら制約を課すものではないことに" -"注意してください。" +"これらの条件は、属性の値、値を計算するタイミング、関連するデータの格納方法に" +"は何の制約も課しません。" -#: ../../extending/newtypes.rst:251 msgid "" "When :c:func:`PyType_Ready` is called, it uses three tables referenced by " "the type object to create :term:`descriptor`\\s which are placed in the " @@ -538,26 +695,40 @@ msgid "" "`~PyTypeObject.tp_getattro` and :c:member:`~PyTypeObject.tp_setattro` fields " "``NULL`` as well, allowing the base type to handle attributes." msgstr "" +":c:func:`PyType_Ready` は、型オブジェクトが参照する三つのテーブルを使って :" +"term:`デスクリプタ ` を作成し、型オブジェクトの辞書に格納しま" +"す。\n" +"各デスクリプタは、インスタンスオブジェクトの一つの属性へのアクセスを制御しま" +"す。\n" +"テーブルはいずれも省略可能です。\n" +"三つとも ``NULL`` の場合、その型のインスタンスが持つ属性は基底型から継承した" +"ものだけになります。\n" +"この場合、属性の処理を基底型に任せられるように、:c:member:`~PyTypeObject." +"tp_getattro` と :c:member:`~PyTypeObject.tp_setattro` フィールドも ``NULL`` " +"にしてください。" #: ../../extending/newtypes.rst:259 msgid "The tables are declared as three fields of the type object::" msgstr "テーブルはタイプオブジェクト中の 3つのメンバとして宣言されています::" -#: ../../extending/newtypes.rst:261 msgid "" "struct PyMethodDef *tp_methods;\n" "struct PyMemberDef *tp_members;\n" "struct PyGetSetDef *tp_getset;" msgstr "" +"struct PyMethodDef *tp_methods;\n" +"struct PyMemberDef *tp_members;\n" +"struct PyGetSetDef *tp_getset;" -#: ../../extending/newtypes.rst:265 msgid "" "If :c:member:`~PyTypeObject.tp_methods` is not ``NULL``, it must refer to an " "array of :c:type:`PyMethodDef` structures. Each entry in the table is an " "instance of this structure::" msgstr "" +":c:member:`~PyTypeObject.tp_methods` が ``NULL`` でない場合は、:c:type:" +"`PyMethodDef` 構造体の配列を指す必要があります。\n" +"テーブル内の各エントリーは、次の構造体のインスタンスです。 ::" -#: ../../extending/newtypes.rst:269 msgid "" "typedef struct PyMethodDef {\n" " const char *ml_name; /* method name */\n" @@ -566,14 +737,25 @@ msgid "" " const char *ml_doc; /* docstring */\n" "} PyMethodDef;" msgstr "" +"typedef struct PyMethodDef {\n" +" const char *ml_name; /* メソッド名 */\n" +" PyCFunction ml_meth; /* 実装関数 */\n" +" int ml_flags; /* フラグ */\n" +" const char *ml_doc; /* ドキュメント文字列 */\n" +"} PyMethodDef;" -#: ../../extending/newtypes.rst:276 msgid "" "One entry should be defined for each method provided by the type; no entries " "are needed for methods inherited from a base type. One additional entry is " "needed at the end; it is a sentinel that marks the end of the array. The :c:" "member:`~PyMethodDef.ml_name` field of the sentinel must be ``NULL``." msgstr "" +"型が提供するメソッドごとに一つのエントリーを定義します。\n" +"基底型から継承するメソッドのエントリーは不要です。\n" +"末尾には、配列の終わりを示す番兵となるエントリーをもう一つ追加する必要があり" +"ます。\n" +"番兵の :c:member:`~PyMethodDef.ml_name` フィールドは ``NULL`` にしなければな" +"りません。" #: ../../extending/newtypes.rst:281 msgid "" @@ -598,7 +780,6 @@ msgid "" "} PyMemberDef;" msgstr "" -#: ../../extending/newtypes.rst:293 msgid "" "For each entry in the table, a :term:`descriptor` will be constructed and " "added to the type which will be able to extract a value from the instance " @@ -609,8 +790,16 @@ msgid "" "the attribute can be accessed: you can set it to :c:macro:`Py_READONLY` to " "prevent Python code from setting it." msgstr "" +"テーブルの各エントリーから、インスタンス構造体の値を取り出せる :term:`デスク" +"リプタ ` が作成され、型に追加されます。\n" +":c:member:`~PyMemberDef.type` フィールドには :c:macro:`Py_T_INT` や :c:macro:" +"`Py_T_DOUBLE` のような型コードを設定します。\n" +"この値は、Python の値と C の値を相互に変換する方法を決めるために使います。\n" +":c:member:`~PyMemberDef.flags` フィールドには、属性へのアクセス方法を制御する" +"フラグを格納します。\n" +":c:macro:`Py_READONLY` を設定すると、Python コードからの値の設定を禁止できま" +"す。" -#: ../../extending/newtypes.rst:301 msgid "" "An interesting advantage of using the :c:member:`~PyTypeObject.tp_members` " "table to build descriptors that are used at runtime is that any attribute " @@ -619,6 +808,13 @@ msgid "" "the descriptor from the class object, and get the doc string using its :attr:" "`~type.__doc__` attribute." msgstr "" +":c:member:`~PyTypeObject.tp_members` テーブルから実行時に使うデスクリプタを作" +"成する方法には、興味深い利点があります。\n" +"この方法で定義した属性は、テーブルにテキストを指定するだけでドキュメント文字" +"列を関連付けられます。\n" +"アプリケーションはイントロスペクション API を使ってクラスオブジェクトからデス" +"クリプタを取得し、その :attr:`~type.__doc__` 属性からドキュメント文字列を取得" +"できます。" #: ../../extending/newtypes.rst:307 msgid "" @@ -630,7 +826,6 @@ msgstr "" msgid "Type-specific Attribute Management" msgstr "特定の型に特化した属性の管理" -#: ../../extending/newtypes.rst:323 msgid "" "For simplicity, only the :c:expr:`char\\*` version will be demonstrated " "here; the type of the name parameter is the only difference between the :c:" @@ -640,6 +835,13 @@ msgid "" "handler functions are called, so that if you do need to extend their " "functionality, you'll understand what needs to be done." msgstr "" +"簡単にするため、ここでは :c:expr:`char\\*` 版だけを示します。\n" +"インターフェースの :c:expr:`char\\*` 版と :c:expr:`PyObject*` 版の違いは、名" +"前を渡す引数の型だけです。\n" +"この例は、上の汎用の例と実質的に同じ処理を行いますが、Python 2.2 で追加された" +"汎用の仕組みは使いません。\n" +"ハンドラ関数の呼び出し方を説明するので、機能を拡張する必要がある場合に、何を" +"すべきかが分かるでしょう。" #: ../../extending/newtypes.rst:331 msgid "" @@ -652,7 +854,6 @@ msgstr "" msgid "Here is an example::" msgstr "以下に例を示します。::" -#: ../../extending/newtypes.rst:337 msgid "" "static PyObject *\n" "newdatatype_getattr(PyObject *op, char *name)\n" @@ -668,8 +869,20 @@ msgid "" " return NULL;\n" "}" msgstr "" +"static PyObject *\n" +"newdatatype_getattr(PyObject *op, char *name)\n" +"{\n" +" newdatatypeobject *self = (newdatatypeobject *) op;\n" +" if (strcmp(name, \"data\") == 0) {\n" +" return PyLong_FromLong(self->data);\n" +" }\n" +"\n" +" PyErr_Format(PyExc_AttributeError,\n" +" \"'%.100s' object has no attribute '%.400s'\",\n" +" Py_TYPE(self)->tp_name, name);\n" +" return NULL;\n" +"}" -#: ../../extending/newtypes.rst:351 msgid "" "The :c:member:`~PyTypeObject.tp_setattr` handler is called when the :meth:" "`~object.__setattr__` or :meth:`~object.__delattr__` method of a class " @@ -678,8 +891,14 @@ msgid "" "exception; if this were really all you wanted, the :c:member:`~PyTypeObject." "tp_setattr` handler should be set to ``NULL``. ::" msgstr "" +":c:member:`~PyTypeObject.tp_setattr` ハンドラは、クラスのインスタンスの :" +"meth:`~object.__setattr__` または :meth:`~object.__delattr__` メソッドが呼ば" +"れる状況で呼び出されます。\n" +"属性を削除する場合、第 3 引数は ``NULL`` になります。\n" +"次は単に例外を送出する例です。\n" +"本当にこれだけを行いたいのであれば、:c:member:`~PyTypeObject.tp_setattr` ハン" +"ドラを ``NULL`` に設定してください。 ::" -#: ../../extending/newtypes.rst:357 msgid "" "static int\n" "newdatatype_setattr(PyObject *op, char *name, PyObject *v)\n" @@ -688,24 +907,32 @@ msgid "" " return -1;\n" "}" msgstr "" +"static int\n" +"newdatatype_setattr(PyObject *op, char *name, PyObject *v)\n" +"{\n" +" PyErr_Format(PyExc_RuntimeError, \"Read-only attribute: %s\", name);\n" +" return -1;\n" +"}" #: ../../extending/newtypes.rst:365 msgid "Object Comparison" msgstr "オブジェクトの比較" -#: ../../extending/newtypes.rst:369 msgid "richcmpfunc tp_richcompare;" -msgstr "" +msgstr "richcmpfunc tp_richcompare;" -#: ../../extending/newtypes.rst:371 msgid "" "The :c:member:`~PyTypeObject.tp_richcompare` handler is called when " "comparisons are needed. It is analogous to the :ref:`rich comparison " "methods `, like :meth:`!__lt__`, and also called by :c:func:" "`PyObject_RichCompare` and :c:func:`PyObject_RichCompareBool`." msgstr "" +":c:member:`~PyTypeObject.tp_richcompare` ハンドラは、比較が必要なときに呼び出" +"されます。\n" +":meth:`!__lt__` などの :ref:`拡張比較メソッド ` に相当し、:c:" +"func:`PyObject_RichCompare` と :c:func:`PyObject_RichCompareBool` からも呼び" +"出されます。" -#: ../../extending/newtypes.rst:376 msgid "" "This function is called with two Python objects and the operator as " "arguments, where the operator is one of ``Py_EQ``, ``Py_NE``, ``Py_LE``, " @@ -715,6 +942,14 @@ msgid "" "comparison is not implemented and the other object's comparison method " "should be tried, or ``NULL`` if an exception was set." msgstr "" +"この関数は、二つの Python オブジェクトと演算子を引数として受け取ります。\n" +"演算子は ``Py_EQ``、``Py_NE``、``Py_LE``、``Py_GE``、``Py_LT``、``Py_GT`` の" +"いずれかです。\n" +"指定された演算子で二つのオブジェクトを比較し、比較が成功した場合は " +"``Py_True`` または ``Py_False`` を返してください。\n" +"比較が実装されておらず、もう一方のオブジェクトの比較メソッドを試すべきことを" +"示すには ``Py_NotImplemented`` を、例外を設定した場合は ``NULL`` を返してくだ" +"さい。" #: ../../extending/newtypes.rst:384 msgid "" @@ -724,7 +959,6 @@ msgstr "" "これは内部ポインタのサイズが等しければ等しいと見なすデータ型のサンプル実装で" "す::" -#: ../../extending/newtypes.rst:387 msgid "" "static PyObject *\n" "newdatatype_richcmp(PyObject *lhs, PyObject *rhs, int op)\n" @@ -752,6 +986,31 @@ msgid "" " return Py_NewRef(result);\n" " }" msgstr "" +"static PyObject *\n" +"newdatatype_richcmp(PyObject *lhs, PyObject *rhs, int op)\n" +"{\n" +" newdatatypeobject *obj1 = (newdatatypeobject *) lhs;\n" +" newdatatypeobject *obj2 = (newdatatypeobject *) rhs;\n" +" PyObject *result;\n" +" int c, size1, size2;\n" +"\n" +" /* 両方の引数が newdatatype 型であることを\n" +" 確認するコードは省略 */\n" +"\n" +" size1 = obj1->obj_UnderlyingDatatypePtr->size;\n" +" size2 = obj2->obj_UnderlyingDatatypePtr->size;\n" +"\n" +" switch (op) {\n" +" case Py_LT: c = size1 < size2; break;\n" +" case Py_LE: c = size1 <= size2; break;\n" +" case Py_EQ: c = size1 == size2; break;\n" +" case Py_NE: c = size1 != size2; break;\n" +" case Py_GT: c = size1 > size2; break;\n" +" case Py_GE: c = size1 >= size2; break;\n" +" }\n" +" result = c ? Py_True : Py_False;\n" +" return Py_NewRef(result);\n" +" }" #: ../../extending/newtypes.rst:415 msgid "Abstract Protocol Support" @@ -780,14 +1039,15 @@ msgid "" "slot, but a slot may still be unfilled.) ::" msgstr "" -#: ../../extending/newtypes.rst:432 msgid "" "PyNumberMethods *tp_as_number;\n" "PySequenceMethods *tp_as_sequence;\n" "PyMappingMethods *tp_as_mapping;" msgstr "" +"PyNumberMethods *tp_as_number;\n" +"PySequenceMethods *tp_as_sequence;\n" +"PyMappingMethods *tp_as_mapping;" -#: ../../extending/newtypes.rst:436 msgid "" "If you wish your object to be able to act like a number, a sequence, or a " "mapping object, then you place the address of a structure that implements " @@ -797,16 +1057,15 @@ msgid "" "of these in the :file:`Objects` directory of the Python source " "distribution. ::" msgstr "" -"お使いのオブジェクトを数値やシーケンス、あるいは辞書のようにふるまうようにし" -"たいならば、それぞれに C の :c:type:`PyNumberMethods` 構造体、 :c:type:" -"`PySequenceMethods` 構造体、または :c:type:`PyMappingMethods` 構造体のアドレ" -"スを入れます。これらに適切な値を入れても入れなくてもかまいません。これらを" -"使った例は Python の配布ソースにある :file:`Objects` でみつけることができるで" -"しょう。 ::" +"オブジェクトを数値、シーケンス、マッピングとして振る舞わせるには、それぞれ C " +"の :c:type:`PyNumberMethods`、:c:type:`PySequenceMethods`、:c:type:" +"`PyMappingMethods` 型の構造体のアドレスを設定します。\n" +"これらの構造体に適切な値を設定するのは、実装する側の責任です。\n" +"それぞれの使用例は、Python の配布ソースの :file:`Objects` ディレクトリで見つ" +"けられます。 ::" -#: ../../extending/newtypes.rst:443 msgid "hashfunc tp_hash;" -msgstr "" +msgstr "hashfunc tp_hash;" #: ../../extending/newtypes.rst:445 msgid "" @@ -816,7 +1075,6 @@ msgstr "" "この関数は、もし使うことにしたならば、データ型のインスタンスのハッシュ番号を" "返すようにします。次のは単純な例です::" -#: ../../extending/newtypes.rst:448 msgid "" "static Py_hash_t\n" "newdatatype_hash(PyObject *op)\n" @@ -830,18 +1088,32 @@ msgid "" " return result;\n" "}" msgstr "" +"static Py_hash_t\n" +"newdatatype_hash(PyObject *op)\n" +"{\n" +" newdatatypeobject *self = (newdatatypeobject *) op;\n" +" Py_hash_t result;\n" +" result = self->some_size + 32767 * self->some_number;\n" +" if (result == -1) {\n" +" result = -2;\n" +" }\n" +" return result;\n" +"}" -#: ../../extending/newtypes.rst:460 msgid "" ":c:type:`Py_hash_t` is a signed integer type with a platform-varying width. " "Returning ``-1`` from :c:member:`~PyTypeObject.tp_hash` indicates an error, " "which is why you should be careful to avoid returning it when hash " "computation is successful, as seen above." msgstr "" +":c:type:`Py_hash_t` は、幅がプラットフォームによって異なる符号付き整数型で" +"す。\n" +":c:member:`~PyTypeObject.tp_hash` が ``-1`` を返すとエラーを示すため、上の例" +"のように、ハッシュの計算に成功したときはこの値を返さないよう注意してくださ" +"い。" -#: ../../extending/newtypes.rst:467 msgid "ternaryfunc tp_call;" -msgstr "" +msgstr "ternaryfunc tp_call;" #: ../../extending/newtypes.rst:469 msgid "" @@ -875,7 +1147,6 @@ msgstr "" "*args* は呼び出しの引数を格納しているタプルです。ここから引数を取り出すには :" "c:func:`PyArg_ParseTuple` を使います。" -#: ../../extending/newtypes.rst:481 msgid "" "*kwds* is a dictionary of keyword arguments that were passed. If this is non-" "``NULL`` and you support keyword arguments, use :c:func:" @@ -883,12 +1154,17 @@ msgid "" "to support keyword arguments and this is non-``NULL``, raise a :exc:" "`TypeError` with a message saying that keyword arguments are not supported." msgstr "" +"``kwds`` は、渡されたキーワード引数の辞書です。\n" +"これが ``NULL`` でなく、キーワード引数をサポートする場合は、:c:func:" +"`PyArg_ParseTupleAndKeywords` で引数を取り出してください。\n" +"キーワード引数をサポートしない場合にこれが ``NULL`` でなければ、キーワード引" +"数をサポートしていないことを示すメッセージとともに :exc:`TypeError` を送出し" +"てください。" #: ../../extending/newtypes.rst:487 msgid "Here is a toy ``tp_call`` implementation::" msgstr "以下は ``tp_call`` の簡易な実装です::" -#: ../../extending/newtypes.rst:489 msgid "" "static PyObject *\n" "newdatatype_call(PyObject *op, PyObject *args, PyObject *kwds)\n" @@ -909,15 +1185,34 @@ msgid "" " return result;\n" "}" msgstr "" +"static PyObject *\n" +"newdatatype_call(PyObject *op, PyObject *args, PyObject *kwds)\n" +"{\n" +" newdatatypeobject *self = (newdatatypeobject *) op;\n" +" PyObject *result;\n" +" const char *arg1;\n" +" const char *arg2;\n" +" const char *arg3;\n" +"\n" +" if (!PyArg_ParseTuple(args, \"sss:call\", &arg1, &arg2, &arg3)) {\n" +" return NULL;\n" +" }\n" +" result = PyUnicode_FromFormat(\n" +" \"Returning -- value: [%d] arg1: [%s] arg2: [%s] arg3: [%s]\\n\",\n" +" self->obj_UnderlyingDatatypePtr->size,\n" +" arg1, arg2, arg3);\n" +" return result;\n" +"}" -#: ../../extending/newtypes.rst:510 msgid "" "/* Iterators */\n" "getiterfunc tp_iter;\n" "iternextfunc tp_iternext;" msgstr "" +"/* イテレータ */\n" +"getiterfunc tp_iter;\n" +"iternextfunc tp_iternext;" -#: ../../extending/newtypes.rst:514 msgid "" "These functions provide support for the iterator protocol. Both handlers " "take exactly one parameter, the instance for which they are being called, " @@ -927,6 +1222,13 @@ msgid "" "`~PyTypeObject.tp_iternext` corresponds to the Python :meth:`~iterator." "__next__` method." msgstr "" +"これらの関数はイテレータプロトコルをサポートします。\n" +"どちらのハンドラも、呼び出し対象のインスタンスを唯一の引数として受け取り、新" +"しい参照を返します。\n" +"エラーの場合は例外を設定し、``NULL`` を返してください。\n" +":c:member:`~PyTypeObject.tp_iter` は Python の :meth:`~object.__iter__` メ" +"ソッドに、:c:member:`~PyTypeObject.tp_iternext` は Python の :meth:" +"`~iterator.__next__` メソッドに対応します。" #: ../../extending/newtypes.rst:521 msgid "" @@ -935,22 +1237,27 @@ msgid "" "same guidelines apply as for Python classes:" msgstr "" -#: ../../extending/newtypes.rst:525 msgid "" "For collections (such as lists and tuples) which can support multiple " "independent iterators, a new iterator should be created and returned by each " "call to :c:member:`~PyTypeObject.tp_iter`." msgstr "" +"独立した複数のイテレータをサポートできるコレクション (リストやタプルなど) で" +"は、:c:member:`~PyTypeObject.tp_iter` を呼び出すたびに新しいイテレータを作成" +"して返す必要があります。" -#: ../../extending/newtypes.rst:528 msgid "" "Objects which can only be iterated over once (usually due to side effects of " "iteration, such as file objects) can implement :c:member:`~PyTypeObject." "tp_iter` by returning a new reference to themselves -- and should also " "therefore implement the :c:member:`~PyTypeObject.tp_iternext` handler." msgstr "" +"一度しか反復できないオブジェクト (ファイルオブジェクトのように、通常は反復に" +"副作用があるもの) は、自身への新しい参照を返すことで :c:member:" +"`~PyTypeObject.tp_iter` を実装できます。\n" +"その場合は :c:member:`~PyTypeObject.tp_iternext` ハンドラも実装する必要があり" +"ます。" -#: ../../extending/newtypes.rst:533 msgid "" "Any :term:`iterator` object should implement both :c:member:`~PyTypeObject." "tp_iter` and :c:member:`~PyTypeObject.tp_iternext`. An iterator's :c:member:" @@ -964,36 +1271,52 @@ msgid "" "`~PyTypeObject.tp_iternext` should always set an exception and return " "``NULL``." msgstr "" +":term:`イテレータ ` オブジェクトは、:c:member:`~PyTypeObject." +"tp_iter` と :c:member:`~PyTypeObject.tp_iternext` の両方を実装する必要があり" +"ます。\n" +"イテレータの :c:member:`~PyTypeObject.tp_iter` ハンドラは、そのイテレータへの" +"新しい参照を返します。\n" +":c:member:`~PyTypeObject.tp_iternext` ハンドラは、反復する次のオブジェクトが" +"あれば、それへの新しい参照を返します。\n" +"反復の終わりに達した場合、:c:member:`~PyTypeObject.tp_iternext` は例外を設定" +"せずに ``NULL`` を返しても、``NULL`` を返す *とともに* :exc:`StopIteration` " +"を設定しても構いません。\n" +"例外を設定しない方が、パフォーマンスが少しよくなることがあります。\n" +"実際にエラーが発生した場合は、:c:member:`~PyTypeObject.tp_iternext` は必ず例" +"外を設定し、``NULL`` を返してください。" #: ../../extending/newtypes.rst:549 msgid "Weak Reference Support" msgstr "弱参照(Weak Reference)のサポート" -#: ../../extending/newtypes.rst:551 msgid "" "One of the goals of Python's weak reference implementation is to allow any " "type to participate in the weak reference mechanism without incurring the " "overhead on performance-critical objects (such as numbers)." msgstr "" +"Python の弱参照の実装では、数値のようにパフォーマンスが重要なオブジェクトに" +"オーバーヘッドを課さず、どの型でも弱参照の仕組みに参加できるようにすることを" +"目指しています。" -#: ../../extending/newtypes.rst:556 msgid "Documentation for the :mod:`weakref` module." -msgstr "" +msgstr ":mod:`weakref` モジュールのドキュメント。" -#: ../../extending/newtypes.rst:558 msgid "" "For an object to be weakly referenceable, the extension type must set the " "``Py_TPFLAGS_MANAGED_WEAKREF`` bit of the :c:member:`~PyTypeObject.tp_flags` " "field. The legacy :c:member:`~PyTypeObject.tp_weaklistoffset` field should " "be left as zero." msgstr "" +"オブジェクトが弱参照をサポートするには、拡張の型が :c:member:`~PyTypeObject." +"tp_flags` フィールドの ``Py_TPFLAGS_MANAGED_WEAKREF`` ビットを設定する必要が" +"あります。\n" +"従来の :c:member:`~PyTypeObject.tp_weaklistoffset` フィールドはゼロのままにし" +"てください。" -#: ../../extending/newtypes.rst:563 msgid "" "Concretely, here is how the statically declared type object would look::" -msgstr "" +msgstr "具体的には、静的に宣言した型オブジェクトは次のようになります。 ::" -#: ../../extending/newtypes.rst:565 msgid "" "static PyTypeObject TrivialType = {\n" " PyVarObject_HEAD_INIT(NULL, 0)\n" @@ -1001,14 +1324,19 @@ msgid "" " .tp_flags = Py_TPFLAGS_MANAGED_WEAKREF | ...,\n" "};" msgstr "" +"static PyTypeObject TrivialType = {\n" +" PyVarObject_HEAD_INIT(NULL, 0)\n" +" /* ... 簡略化のためほかのメンバは省略 ... */\n" +" .tp_flags = Py_TPFLAGS_MANAGED_WEAKREF | ...,\n" +"};" -#: ../../extending/newtypes.rst:572 msgid "" "The only further addition is that ``tp_dealloc`` needs to clear any weak " "references (by calling :c:func:`PyObject_ClearWeakRefs`)::" msgstr "" +"このほかに必要なのは、``tp_dealloc`` で (:c:func:`PyObject_ClearWeakRefs` を" +"呼び出して) 弱参照をすべてクリアすることだけです。 ::" -#: ../../extending/newtypes.rst:575 msgid "" "static void\n" "Trivial_dealloc(PyObject *op)\n" @@ -1019,12 +1347,19 @@ msgid "" " Py_TYPE(op)->tp_free(op);\n" "}" msgstr "" +"static void\n" +"Trivial_dealloc(PyObject *op)\n" +"{\n" +" /* デストラクタを呼ぶ前に、まず弱参照をクリアする */\n" +" PyObject_ClearWeakRefs(op);\n" +" /* ... 簡略化のため残りの破棄処理は省略 ... */\n" +" Py_TYPE(op)->tp_free(op);\n" +"}" #: ../../extending/newtypes.rst:586 msgid "More Suggestions" msgstr "その他いろいろ" -#: ../../extending/newtypes.rst:588 msgid "" "In order to learn how to implement any specific method for your new data " "type, get the :term:`CPython` source code. Go to the :file:`Objects` " @@ -1032,38 +1367,47 @@ msgid "" "want (for example, ``tp_richcompare``). You will find examples of the " "function you want to implement." msgstr "" +"新しいデータ型の特定のメソッドを実装する方法を知るには、:term:`CPython` の" +"ソースコードを入手してください。\n" +":file:`Objects` ディレクトリで、``tp_`` に目的の関数名を続けた文字列 " +"(``tp_richcompare`` など) を C ソースファイルから検索すると、実装したい関数の" +"例が見つかります。" -#: ../../extending/newtypes.rst:594 msgid "" "When you need to verify that an object is a concrete instance of the type " "you are implementing, use the :c:func:`PyObject_TypeCheck` function. A " "sample of its use might be something like the following::" msgstr "" +"オブジェクトが実装中の型のインスタンスであることを確認するには、:c:func:" +"`PyObject_TypeCheck` 関数を使ってください。\n" +"例えば、次のように使います。 ::" -#: ../../extending/newtypes.rst:598 msgid "" "if (!PyObject_TypeCheck(some_object, &MyType)) {\n" " PyErr_SetString(PyExc_TypeError, \"arg #1 not a mything\");\n" " return NULL;\n" "}" msgstr "" +"if (!PyObject_TypeCheck(some_object, &MyType)) {\n" +" PyErr_SetString(PyExc_TypeError, \"arg #1 not a mything\");\n" +" return NULL;\n" +"}" -#: ../../extending/newtypes.rst:604 msgid "Download CPython source releases." -msgstr "" +msgstr "CPython のソースリリースをダウンロードできます。" #: ../../extending/newtypes.rst:605 msgid "https://www.python.org/downloads/source/" -msgstr "" +msgstr "https://www.python.org/downloads/source/" -#: ../../extending/newtypes.rst:607 msgid "" "The CPython project on GitHub, where the CPython source code is developed." msgstr "" +"CPython のソースコードが開発されている GitHub 上の CPython プロジェクトです。" #: ../../extending/newtypes.rst:608 msgid "https://github.com/python/cpython" -msgstr "" +msgstr "https://github.com/python/cpython" #: ../../extending/newtypes.rst:56 msgid "object" @@ -1085,21 +1429,18 @@ msgstr "finalization" msgid "finalization, of objects" msgstr "finalization, of objects" -#: ../../extending/newtypes.rst:93 msgid "PyErr_Fetch (C function)" -msgstr "" +msgstr "PyErr_Fetch (C 関数)" -#: ../../extending/newtypes.rst:93 msgid "PyErr_Restore (C function)" -msgstr "" +msgstr "PyErr_Restore (C 関数)" #: ../../extending/newtypes.rst:154 msgid "string" msgstr "string" -#: ../../extending/newtypes.rst:154 msgid "object representation" -msgstr "" +msgstr "オブジェクト表現" #: ../../extending/newtypes.rst:154 msgid "built-in function" diff --git a/extending/newtypes_tutorial.po b/extending/newtypes_tutorial.po index c67be0b70..c1671e845 100644 --- a/extending/newtypes_tutorial.po +++ b/extending/newtypes_tutorial.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../extending/newtypes_tutorial.rst:7 @@ -46,7 +46,6 @@ msgstr "" msgid "The Basics" msgstr "基本的なこと" -#: ../../extending/newtypes_tutorial.rst:26 msgid "" "The :term:`CPython` runtime sees all Python objects as variables of type :c:" "expr:`PyObject*`, which serves as a \"base type\" for all Python objects. " @@ -57,14 +56,16 @@ msgid "" "an object, a method called, or it is multiplied by another object. These C " "functions are called \"type methods\"." msgstr "" -":term:`CPython` ランタイムは Python の全てのオブジェクトを、 Python の全ての" -"オブジェクトの \"基底型 (base type)\" である :c:expr:`PyObject*` 型の変数と見" -"なします。 :c:type:`PyObject` 構造体自身は :term:`参照カウント ` と、オブジェクトの \"型オブジェクト\" へのポインタのみを持ちます。こ" -"こには動作が定義されています; 型オブジェクトは、例えば、ある属性があるオブ" -"ジェクトから検索されたり、メソッドが呼ばれたり、他のオブジェクトによって操作" -"されたりしたときに、どの (C) 関数がインタープリターから呼ばれるのかを決定しま" -"す。これらの C 関数は \"型メソッド (type method)\" と呼ばれます。" +":term:`CPython` ランタイムは、すべての Python オブジェクトを :c:expr:" +"`PyObject*` 型の変数として扱います。\n" +"この型はすべての Python オブジェクトの「基底型」の役割を果たします。\n" +":c:type:`PyObject` 構造体自体に含まれるのは、オブジェクトの :term:`参照カウン" +"ト ` と、その「型オブジェクト」へのポインタだけです。\n" +"動作を決めるのは、この型オブジェクトです。\n" +"例えばオブジェクトの属性を検索するとき、メソッドを呼び出すとき、ほかのオブ" +"ジェクトとの乗算を行うときに、インタープリタがどの C 関数を呼び出すかを決定し" +"ます。\n" +"これらの C 関数を「型メソッド」と呼びます。" #: ../../extending/newtypes_tutorial.rst:35 msgid "" @@ -144,13 +145,13 @@ msgid "" "}\n" msgstr "" -#: ../../extending/newtypes_tutorial.rst:50 msgid "" "Now that's quite a bit to take in at once, but hopefully bits will seem " "familiar from the previous chapter. This file defines three things:" msgstr "" -"一度に把握するにはちょっと量が多いですが、前の章よりはとっつきやすくなってい" -"ることと思います。このファイルでは、3つの要素が定義されています:" +"一度に理解するにはかなりの量ですが、前の章で見たことのある部分もあるでしょ" +"う。\n" +"このファイルでは、次の三つを定義しています。" #: ../../extending/newtypes_tutorial.rst:53 msgid "" @@ -183,14 +184,15 @@ msgstr "" msgid "The first bit is::" msgstr "まず最初はこれです::" -#: ../../extending/newtypes_tutorial.rst:63 msgid "" "typedef struct {\n" " PyObject_HEAD\n" "} CustomObject;" msgstr "" +"typedef struct {\n" +" PyObject_HEAD\n" +"} CustomObject;" -#: ../../extending/newtypes_tutorial.rst:67 msgid "" "This is what a Custom object will contain. ``PyObject_HEAD`` is mandatory " "at the start of each object struct and defines a field called ``ob_base`` of " @@ -200,13 +202,13 @@ msgid "" "abstract away the layout and to enable additional fields in :ref:`debug " "builds `." msgstr "" -"これが Custom オブジェクトの内容です。 ``PyObject_HEAD`` はそれぞれのオブジェ" -"クト構造体の先頭に必須なもので、 :c:type:`PyObject` 型の ``ob_base`` という名" -"前のフィールドを定義します。 :c:type:`PyObject` 型には (それぞれ :c:macro:" -"`Py_TYPE` マクロおよび :c:macro:`Py_REFCNT` マクロからアクセスできる) 型オブ" -"ジェクトへのポインタと参照カウントが格納されています。このマクロが用意されて" -"いる理由は、構造体のレイアウトを抽象化し、デバッグビルドでフィールドを追加で" -"きるようにするためです。" +"これが Custom オブジェクトの内容です。\n" +"各オブジェクト構造体の先頭には ``PyObject_HEAD`` が必須で、これは :c:type:" +"`PyObject` 型の ``ob_base`` というフィールドを定義します。\n" +"このフィールドには型オブジェクトへのポインタと参照カウントが含まれ、それぞ" +"れ :c:macro:`Py_TYPE` と :c:macro:`Py_REFCNT` マクロでアクセスできます。\n" +"このマクロはレイアウトを抽象化し、:ref:`デバッグビルド ` で" +"フィールドを追加できるようにするためのものです。" #: ../../extending/newtypes_tutorial.rst:76 msgid "" @@ -227,19 +229,21 @@ msgstr "" "の他にもデータを保持しています; 例えば、これは Python 標準の浮動小数点数の定" "義です::" -#: ../../extending/newtypes_tutorial.rst:83 msgid "" "typedef struct {\n" " PyObject_HEAD\n" " double ob_fval;\n" "} PyFloatObject;" msgstr "" +"typedef struct {\n" +" PyObject_HEAD\n" +" double ob_fval;\n" +"} PyFloatObject;" #: ../../extending/newtypes_tutorial.rst:88 msgid "The second bit is the definition of the type object. ::" msgstr "2つ目は型オブジェクトの定義です。 ::" -#: ../../extending/newtypes_tutorial.rst:90 msgid "" "static PyTypeObject CustomType = {\n" " .ob_base = PyVarObject_HEAD_INIT(NULL, 0)\n" @@ -251,6 +255,15 @@ msgid "" " .tp_new = PyType_GenericNew,\n" "};" msgstr "" +"static PyTypeObject CustomType = {\n" +" .ob_base = PyVarObject_HEAD_INIT(NULL, 0)\n" +" .tp_name = \"custom.Custom\",\n" +" .tp_doc = PyDoc_STR(\"Custom オブジェクト\"),\n" +" .tp_basicsize = sizeof(CustomObject),\n" +" .tp_itemsize = 0,\n" +" .tp_flags = Py_TPFLAGS_DEFAULT,\n" +" .tp_new = PyType_GenericNew,\n" +"};" #: ../../extending/newtypes_tutorial.rst:101 msgid "" @@ -278,21 +291,18 @@ msgstr "" msgid "We're going to pick it apart, one field at a time::" msgstr "一度に1つずつフィールドを取り上げていきましょう::" -#: ../../extending/newtypes_tutorial.rst:112 msgid ".ob_base = PyVarObject_HEAD_INIT(NULL, 0)" -msgstr "" +msgstr ".ob_base = PyVarObject_HEAD_INIT(NULL, 0)" -#: ../../extending/newtypes_tutorial.rst:114 msgid "" "This line is mandatory boilerplate to initialize the ``ob_base`` field " "mentioned above. ::" msgstr "" -"この行は、上で触れた ``ob_base`` フィールドの初期化に必須のボイラープレートで" -"す。" +"この行は、上で説明した ``ob_base`` フィールドを初期化するために必要な定型的な" +"記述です。 ::" -#: ../../extending/newtypes_tutorial.rst:117 msgid ".tp_name = \"custom.Custom\"," -msgstr "" +msgstr ".tp_name = \"custom.Custom\"," #: ../../extending/newtypes_tutorial.rst:119 msgid "" @@ -303,15 +313,17 @@ msgstr "" "これは、オブジェクトのデフォルトの文字列表現やエラーメッセージに現れます。例" "えば次の通りです:" -#: ../../extending/newtypes_tutorial.rst:122 msgid "" ">>> \"\" + custom.Custom()\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" "TypeError: can only concatenate str (not \"custom.Custom\") to str" msgstr "" +">>> \"\" + custom.Custom()\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"TypeError: can only concatenate str (not \"custom.Custom\") to str" -#: ../../extending/newtypes_tutorial.rst:129 msgid "" "Note that the name is a dotted name that includes both the module name and " "the name of the type within the module. The module in this case is :mod:`!" @@ -319,17 +331,19 @@ msgid "" "`!custom.Custom`. Using the real dotted import path is important to make " "your type compatible with the :mod:`pydoc` and :mod:`pickle` modules. ::" msgstr "" -"型の名前が、モジュール名とモジュールにおける型の名前の両方をドットでつないだ" -"名前になっていることに注意してください。この場合は、モジュールは :mod:`!" -"custom` で型は :class:`!Custom` なので、型の名前を :class:`!custom.Custom` に" -"設定しました。実際のドット付きのインポートパスを使うのは、 :mod:`pydoc` モ" -"ジュールや :mod:`pickle` モジュールと互換性を持たせるために重要なのです。" +"型の名前は、モジュール名とモジュール内の型の名前をドットでつないだ名前で" +"す。\n" +"この場合、モジュールは :mod:`!custom`、型は :class:`!Custom` なので、型の名前" +"を :class:`!custom.Custom` に設定します。\n" +"この型を :mod:`pydoc` や :mod:`pickle` モジュールと互換性のあるものにするに" +"は、実際のドット付きインポートパスを使うことが重要です。 ::" -#: ../../extending/newtypes_tutorial.rst:135 msgid "" ".tp_basicsize = sizeof(CustomObject),\n" ".tp_itemsize = 0," msgstr "" +".tp_basicsize = sizeof(CustomObject),\n" +".tp_itemsize = 0," #: ../../extending/newtypes_tutorial.rst:138 msgid "" @@ -342,7 +356,6 @@ msgstr "" "tp_itemsize` は可変サイズのオブジェクトでのみ使うものなので、サイズが可変でな" "いオブジェクトでは 0 にすべきです。" -#: ../../extending/newtypes_tutorial.rst:144 msgid "" "If you want your type to be subclassable from Python, and your type has the " "same :c:member:`~PyTypeObject.tp_basicsize` as its base type, you may have " @@ -355,14 +368,23 @@ msgid "" "type will be :class:`object`, or else you will be adding data members to " "your base type, and therefore increasing its size." msgstr "" +"Python からサブクラスを作成できる型で、その :c:member:`~PyTypeObject." +"tp_basicsize` が基底型と同じ場合は、多重継承で問題が起こる可能性がありま" +"す。\n" +"その型の Python サブクラスでは、:attr:`~type.__bases__` の先頭にその型を指定" +"しないと、その型の :meth:`~object.__new__` メソッドを呼び出す際にエラーが発生" +"します。\n" +"この問題は、型の :c:member:`~PyTypeObject.tp_basicsize` を基底型より大きな値" +"にすることで避けられます。\n" +"たいていの場合、基底型が :class:`object` であるか、基底型にデータメンバを追加" +"してサイズを増やすので、すでにこの条件を満たしています。" #: ../../extending/newtypes_tutorial.rst:154 msgid "We set the class flags to :c:macro:`Py_TPFLAGS_DEFAULT`. ::" msgstr ":c:macro:`Py_TPFLAGS_DEFAULT` にクラスフラグを設定します。 ::" -#: ../../extending/newtypes_tutorial.rst:156 msgid ".tp_flags = Py_TPFLAGS_DEFAULT," -msgstr "" +msgstr ".tp_flags = Py_TPFLAGS_DEFAULT," #: ../../extending/newtypes_tutorial.rst:158 msgid "" @@ -379,9 +401,8 @@ msgid "" "We provide a doc string for the type in :c:member:`~PyTypeObject.tp_doc`. ::" msgstr "この型の docstring は :c:member:`~PyTypeObject.tp_doc` に入れます。 ::" -#: ../../extending/newtypes_tutorial.rst:164 msgid ".tp_doc = PyDoc_STR(\"Custom objects\")," -msgstr "" +msgstr ".tp_doc = PyDoc_STR(\"Custom オブジェクト\")," #: ../../extending/newtypes_tutorial.rst:166 msgid "" @@ -397,9 +418,8 @@ msgstr "" "func:`PyType_GenericNew` として提供されるデフォルトの実装をそのまま使えま" "す。 ::" -#: ../../extending/newtypes_tutorial.rst:171 msgid ".tp_new = PyType_GenericNew," -msgstr "" +msgstr ".tp_new = PyType_GenericNew," #: ../../extending/newtypes_tutorial.rst:173 msgid "" @@ -441,11 +461,12 @@ msgstr "" "これは型をモジュールの辞書に追加します。こうすることで :class:`!Custom` クラ" "スの呼び出しで :class:`!Custom` インスタンスが作成できるようになります:" -#: ../../extending/newtypes_tutorial.rst:191 msgid "" ">>> import custom\n" ">>> mycustom = custom.Custom()" msgstr "" +">>> import custom\n" +">>> mycustom = custom.Custom()" #: ../../extending/newtypes_tutorial.rst:196 msgid "" @@ -455,7 +476,6 @@ msgstr "" "以上です!残りの作業はビルドだけです; :file:`custom.c` という名前のファイルに" "ここまでのコードを書き込み、" -#: ../../extending/newtypes_tutorial.rst:199 msgid "" "[build-system]\n" "requires = [\"setuptools\"]\n" @@ -465,16 +485,24 @@ msgid "" "name = \"custom\"\n" "version = \"1\"\n" msgstr "" +"[build-system]\n" +"requires = [\"setuptools\"]\n" +"build-backend = \"setuptools.build_meta\"\n" +"\n" +"[project]\n" +"name = \"custom\"\n" +"version = \"1\"\n" #: ../../extending/newtypes_tutorial.rst:201 msgid "in a file called :file:`pyproject.toml`, and" msgstr ":file:`pyproject.toml` というファイルにこれを書き込み、" -#: ../../extending/newtypes_tutorial.rst:203 msgid "" "from setuptools import Extension, setup\n" "setup(ext_modules=[Extension(\"custom\", [\"custom.c\"])])" msgstr "" +"from setuptools import Extension, setup\n" +"setup(ext_modules=[Extension(\"custom\", [\"custom.c\"])])" #: ../../extending/newtypes_tutorial.rst:208 msgid "in a file called :file:`setup.py`; then typing" @@ -482,10 +510,8 @@ msgstr "" "そして :file:`setup.py` というファイルにこのように書き込み、そして、以下のよ" "うに" -#: ../../extending/newtypes_tutorial.rst:210 -#: ../../extending/newtypes_tutorial.rst:548 msgid "$ python -m pip install ." -msgstr "" +msgstr "$ python -m pip install ." #: ../../extending/newtypes_tutorial.rst:214 msgid "" @@ -681,7 +707,6 @@ msgstr "" msgid "The object structure is updated accordingly::" msgstr "これにしたがうと、オブジェクトの構造体は次のようになります::" -#: ../../extending/newtypes_tutorial.rst:242 msgid "" "typedef struct {\n" " PyObject_HEAD\n" @@ -690,6 +715,12 @@ msgid "" " int number;\n" "} CustomObject;" msgstr "" +"typedef struct {\n" +" PyObject_HEAD\n" +" PyObject *first; /* ファーストネーム */\n" +" PyObject *last; /* ラストネーム */\n" +" int number;\n" +"} CustomObject;" #: ../../extending/newtypes_tutorial.rst:249 msgid "" @@ -699,7 +730,6 @@ msgstr "" "いまや管理すべきデータができたので、オブジェクトの割り当てと解放に際してはよ" "り慎重になる必要があります。最低限、オブジェクトの解放メソッドが必要です::" -#: ../../extending/newtypes_tutorial.rst:252 msgid "" "static void\n" "Custom_dealloc(PyObject *op)\n" @@ -710,15 +740,22 @@ msgid "" " Py_TYPE(self)->tp_free(self);\n" "}" msgstr "" +"static void\n" +"Custom_dealloc(PyObject *op)\n" +"{\n" +" CustomObject *self = (CustomObject *) op;\n" +" Py_XDECREF(self->first);\n" +" Py_XDECREF(self->last);\n" +" Py_TYPE(self)->tp_free(self);\n" +"}" #: ../../extending/newtypes_tutorial.rst:261 msgid "which is assigned to the :c:member:`~PyTypeObject.tp_dealloc` member::" msgstr "" "この関数は :c:member:`~PyTypeObject.tp_dealloc` メンバに代入されます。 ::" -#: ../../extending/newtypes_tutorial.rst:263 msgid ".tp_dealloc = Custom_dealloc," -msgstr "" +msgstr ".tp_dealloc = Custom_dealloc," #: ../../extending/newtypes_tutorial.rst:265 msgid "" @@ -748,14 +785,15 @@ msgid "" "``(CustomObject *)`` is safe. This is object-oriented polymorphism, in C!" msgstr "" -#: ../../extending/newtypes_tutorial.rst:283 msgid "" "In existing code, or in previous versions of this tutorial, you might see " "similar functions take a pointer to the subtype object structure " "(``CustomObject*``) directly, like this::" msgstr "" +"既存のコードやこのチュートリアルの以前のバージョンでは、次のようにサブタイプ" +"のオブジェクト構造体へのポインタ (``CustomObject*``) を直接受け取る関数を見か" +"けるかもしれません。 ::" -#: ../../extending/newtypes_tutorial.rst:287 msgid "" "Custom_dealloc(CustomObject *self)\n" "{\n" @@ -766,12 +804,21 @@ msgid "" "...\n" ".tp_dealloc = (destructor) Custom_dealloc," msgstr "" +"Custom_dealloc(CustomObject *self)\n" +"{\n" +" Py_XDECREF(self->first);\n" +" Py_XDECREF(self->last);\n" +" Py_TYPE(self)->tp_free((PyObject *) self);\n" +"}\n" +"...\n" +".tp_dealloc = (destructor) Custom_dealloc," -#: ../../extending/newtypes_tutorial.rst:296 msgid "" "This does the same thing on all architectures that CPython supports, but " "according to the C standard, it invokes undefined behavior." msgstr "" +"CPython がサポートするすべてのアーキテクチャでは同じ動作になりますが、C の規" +"格上は未定義の動作を引き起こします。" #: ../../extending/newtypes_tutorial.rst:300 msgid "" @@ -781,7 +828,6 @@ msgstr "" "ファーストネームとラストネームを空文字列に初期化しておきたいので、``tp_new`` " "の実装を追加することにしましょう::" -#: ../../extending/newtypes_tutorial.rst:303 msgid "" "static PyObject *\n" "Custom_new(PyTypeObject *type, PyObject *args, PyObject *kwds)\n" @@ -804,6 +850,26 @@ msgid "" " return (PyObject *) self;\n" "}" msgstr "" +"static PyObject *\n" +"Custom_new(PyTypeObject *type, PyObject *args, PyObject *kwds)\n" +"{\n" +" CustomObject *self;\n" +" self = (CustomObject *) type->tp_alloc(type, 0);\n" +" if (self != NULL) {\n" +" self->first = PyUnicode_FromString(\"\");\n" +" if (self->first == NULL) {\n" +" Py_DECREF(self);\n" +" return NULL;\n" +" }\n" +" self->last = PyUnicode_FromString(\"\");\n" +" if (self->last == NULL) {\n" +" Py_DECREF(self);\n" +" return NULL;\n" +" }\n" +" self->number = 0;\n" +" }\n" +" return (PyObject *) self;\n" +"}" #: ../../extending/newtypes_tutorial.rst:324 msgid "and install it in the :c:member:`~PyTypeObject.tp_new` member::" @@ -811,11 +877,9 @@ msgstr "" "そしてこれを :c:member:`~PyTypeObject.tp_new` メンバとしてインストールしま" "す::" -#: ../../extending/newtypes_tutorial.rst:326 msgid ".tp_new = Custom_new," -msgstr "" +msgstr ".tp_new = Custom_new," -#: ../../extending/newtypes_tutorial.rst:328 msgid "" "The ``tp_new`` handler is responsible for creating (as opposed to " "initializing) objects of the type. It is exposed in Python as the :meth:" @@ -825,8 +889,15 @@ msgid "" "type above. In this case, we use the ``tp_new`` handler to initialize the " "``first`` and ``last`` attributes to non-``NULL`` default values." msgstr "" +"``tp_new`` ハンドラは、その型のオブジェクトの初期化ではなく、作成を担当しま" +"す。\n" +"Python では :meth:`~object.__new__` メソッドとして公開されます。\n" +"``tp_new`` メンバを独自に定義する必要はなく、実際、多くの拡張型は、上の最初" +"の :class:`!Custom` 型と同じく :c:func:`PyType_GenericNew` をそのまま使いま" +"す。\n" +"今回は ``tp_new`` ハンドラを使って、``first`` と ``last`` 属性を ``NULL`` で" +"ないデフォルト値に初期化します。" -#: ../../extending/newtypes_tutorial.rst:336 msgid "" "``tp_new`` is passed the type being instantiated (not necessarily " "``CustomType``, if a subclass is instantiated) and any arguments passed when " @@ -835,6 +906,13 @@ msgid "" "often ignore the arguments, leaving the argument handling to initializer (a." "k.a. ``tp_init`` in C or ``__init__`` in Python) methods." msgstr "" +"``tp_new`` にはインスタンス化する型 (サブクラスをインスタンス化する場合は必ず" +"しも ``CustomType`` とは限りません) と、その型の呼び出し時に渡された引数を渡" +"します。\n" +"作成したインスタンスを返す必要があります。\n" +"``tp_new`` ハンドラは常に位置引数とキーワード引数を受け取りますが、それらを無" +"視して、初期化メソッド (C では ``tp_init``、Python では ``__init__``) に引数" +"の処理を任せることもよくあります。" #: ../../extending/newtypes_tutorial.rst:344 msgid "" @@ -852,9 +930,8 @@ msgstr "" "この ``tp_new`` の実装は、:c:member:`~PyTypeObject.tp_alloc` スロットを呼び出" "してメモリを割り当てます::" -#: ../../extending/newtypes_tutorial.rst:350 msgid "self = (CustomObject *) type->tp_alloc(type, 0);" -msgstr "" +msgstr "self = (CustomObject *) type->tp_alloc(type, 0);" #: ../../extending/newtypes_tutorial.rst:352 msgid "" @@ -865,15 +942,18 @@ msgstr "" "`~PyTypeObject.tp_alloc` の結果が ``NULL`` でないかチェックしなければなりませ" "ん。" -#: ../../extending/newtypes_tutorial.rst:356 msgid "" "We didn't fill the :c:member:`~PyTypeObject.tp_alloc` slot ourselves. " "Rather :c:func:`PyType_Ready` fills it for us by inheriting it from our base " "class, which is :class:`object` by default. Most types use the default " "allocation strategy." msgstr "" +"ここでは :c:member:`~PyTypeObject.tp_alloc` スロットを自分では設定していませ" +"ん。\n" +":c:func:`PyType_Ready` が、デフォルトでは :class:`object` となる基底クラスか" +"ら継承して設定してくれます。\n" +"ほとんどの型は、デフォルトの割り当て方法を使います。" -#: ../../extending/newtypes_tutorial.rst:362 msgid "" "If you are creating a co-operative :c:member:`~PyTypeObject.tp_new` (one " "that calls a base type's :c:member:`~PyTypeObject.tp_new` or :meth:`~object." @@ -885,23 +965,21 @@ msgid "" "correctly. (Specifically, you may not be able to create instances of such " "subclasses without getting a :exc:`TypeError`.)" msgstr "" -"もし協力的な :c:member:`~PyTypeObject.tp_new` (基底タイプの :c:member:" -"`~PyTypeObject.tp_new` または :meth:`~object.__new__` を呼んでいるもの) を作" -"りたいのならば、実行時のメソッド解決順序をつかってどのメソッドを呼びだすかを" -"決定しようとしては *いけません* 。常に呼び出す型を静的に決めておき、直接そ" -"の :c:member:`~PyTypeObject.tp_new` を呼び出すか、あるいは ``type->tp_base-" -">tp_new`` を経由してください。こうしないと、あなたが作成したタイプの Python " -"サブクラスが他の Python で定義されたクラスも継承している場合にうまく動かない" -"場合があります。 (とりわけ、そのようなサブクラスのインスタンスを :exc:" -"`TypeError` を出さずに作ることが不可能になります。)" +"基底型の :c:member:`~PyTypeObject.tp_new` や :meth:`~object.__new__` を呼び出" +"す、協調的な :c:member:`~PyTypeObject.tp_new` を実装する場合、実行時のメソッ" +"ド解決順序を使って呼び出すメソッドを決めようとしては *いけません*。\n" +"呼び出す型を常に静的に決め、その :c:member:`~PyTypeObject.tp_new` を直接、ま" +"たは ``type->tp_base->tp_new`` を通して呼び出してください。\n" +"そうしないと、この型の Python サブクラスが、ほかの Python で定義されたクラス" +"も継承する場合に正しく動作しない可能性があります。\n" +"具体的には、そのようなサブクラスのインスタンスを作ろうとすると :exc:" +"`TypeError` が発生する場合があります。" -#: ../../extending/newtypes_tutorial.rst:372 msgid "" "We also define an initialization function which accepts arguments to provide " "initial values for our instance::" -msgstr "" +msgstr "インスタンスの初期値を引数として受け取る初期化関数も定義し、 ::" -#: ../../extending/newtypes_tutorial.rst:375 msgid "" "static int\n" "Custom_init(PyObject *op, PyObject *args, PyObject *kwds)\n" @@ -930,24 +1008,52 @@ msgid "" " return 0;\n" "}" msgstr "" +"static int\n" +"Custom_init(PyObject *op, PyObject *args, PyObject *kwds)\n" +"{\n" +" CustomObject *self = (CustomObject *) op;\n" +" static char *kwlist[] = {\"first\", \"last\", \"number\", NULL};\n" +" PyObject *first = NULL, *last = NULL, *tmp;\n" +"\n" +" if (!PyArg_ParseTupleAndKeywords(args, kwds, \"|OOi\", kwlist,\n" +" &first, &last,\n" +" &self->number))\n" +" return -1;\n" +"\n" +" if (first) {\n" +" tmp = self->first;\n" +" Py_INCREF(first);\n" +" self->first = first;\n" +" Py_XDECREF(tmp);\n" +" }\n" +" if (last) {\n" +" tmp = self->last;\n" +" Py_INCREF(last);\n" +" self->last = last;\n" +" Py_XDECREF(tmp);\n" +" }\n" +" return 0;\n" +"}" #: ../../extending/newtypes_tutorial.rst:402 msgid "by filling the :c:member:`~PyTypeObject.tp_init` slot. ::" msgstr "これは :c:member:`~PyTypeObject.tp_init` メンバに代入されます。 ::" -#: ../../extending/newtypes_tutorial.rst:404 msgid ".tp_init = Custom_init," -msgstr "" +msgstr ".tp_init = Custom_init," -#: ../../extending/newtypes_tutorial.rst:406 msgid "" "The :c:member:`~PyTypeObject.tp_init` slot is exposed in Python as the :meth:" "`~object.__init__` method. It is used to initialize an object after it's " "created. Initializers always accept positional and keyword arguments, and " "they should return either ``0`` on success or ``-1`` on error." msgstr "" +":c:member:`~PyTypeObject.tp_init` スロットは、Python では :meth:`~object." +"__init__` メソッドとして公開されます。\n" +"作成後のオブジェクトを初期化するために使います。\n" +"初期化関数は常に位置引数とキーワード引数を受け取り、成功した場合は ``0``、エ" +"ラーの場合は ``-1`` を返す必要があります。" -#: ../../extending/newtypes_tutorial.rst:411 msgid "" "Unlike the ``tp_new`` handler, there is no guarantee that ``tp_init`` is " "called at all (for example, the :mod:`pickle` module by default doesn't " @@ -957,8 +1063,14 @@ msgid "" "new attribute values. We might be tempted, for example to assign the " "``first`` member like this::" msgstr "" +"``tp_new`` ハンドラと異なり、``tp_init`` が呼ばれる保証はありません (例えば :" +"mod:`pickle` モジュールは、デフォルトでは unpickle したインスタンスに対して :" +"meth:`~object.__init__` を呼び出しません)。\n" +"また、複数回呼ばれることもあります。\n" +"誰でもこのオブジェクトの :meth:`!__init__` メソッドを呼び出せるからです。\n" +"そのため、新しい属性値を代入するときは特に注意する必要があります。\n" +"例えば、``first`` メンバを次のように代入したくなるかもしれません。 ::" -#: ../../extending/newtypes_tutorial.rst:419 msgid "" "if (first) {\n" " Py_XDECREF(self->first);\n" @@ -966,8 +1078,12 @@ msgid "" " self->first = first;\n" "}" msgstr "" +"if (first) {\n" +" Py_XDECREF(self->first);\n" +" Py_INCREF(first);\n" +" self->first = first;\n" +"}" -#: ../../extending/newtypes_tutorial.rst:425 msgid "" "But this would be risky. Our type doesn't restrict the type of the " "``first`` member, so it could be any kind of object. It could have a " @@ -976,31 +1092,44 @@ msgid "" "` and let arbitrary code run in other threads that " "accesses and modifies our object." msgstr "" +"しかし、これは危険です。\n" +"この型は ``first`` メンバの型を制限していないので、どのようなオブジェクトでも" +"格納できます。\n" +"そのオブジェクトのデストラクタが、``first`` メンバにアクセスするコードを実行" +"する可能性があります。\n" +"また、デストラクタが :term:`スレッド状態 ` をデタッチ" +"し、別のスレッドで任意のコードが動いて、このオブジェクトにアクセスしたり変更" +"したりする可能性もあります。" -#: ../../extending/newtypes_tutorial.rst:432 msgid "" "To be paranoid and protect ourselves against this possibility, we almost " "always reassign members before decrementing their reference counts. When " "don't we have to do this?" msgstr "" +"この可能性にも十分に注意して対処するため、ほとんどの場合は、参照カウントを減" +"らす前にメンバに新しい値を代入します。\n" +"では、このようにする必要がないのはどのような場合でしょうか。" #: ../../extending/newtypes_tutorial.rst:436 msgid "when we absolutely know that the reference count is greater than 1;" msgstr "その参照カウントが 1 より大きいと確信できる場合" -#: ../../extending/newtypes_tutorial.rst:438 msgid "" "when we know that deallocation of the object [#]_ will neither detach the :" "term:`thread state ` nor cause any calls back into " "our type's code;" msgstr "" +"オブジェクト [#]_ の解放で、:term:`スレッド状態 ` がデ" +"タッチされることも、自分の型のコードが呼び戻されることもないと分かっている場" +"合。" -#: ../../extending/newtypes_tutorial.rst:441 msgid "" "when decrementing a reference count in a :c:member:`~PyTypeObject." "tp_dealloc` handler on a type which doesn't support cyclic garbage " "collection [#]_." msgstr "" +"循環ガベージコレクションをサポートしない型の :c:member:`~PyTypeObject." +"tp_dealloc` ハンドラ内で、参照カウントを減らす場合 [#]_。" #: ../../extending/newtypes_tutorial.rst:444 msgid "" @@ -1010,7 +1139,6 @@ msgstr "" "ここではインスタンス変数を属性として見えるようにしたいのですが、これにはいく" "つもの方法があります。もっとも簡単な方法は、メンバの定義を与えることです::" -#: ../../extending/newtypes_tutorial.rst:447 msgid "" "static PyMemberDef Custom_members[] = {\n" " {\"first\", Py_T_OBJECT_EX, offsetof(CustomObject, first), 0,\n" @@ -1022,6 +1150,15 @@ msgid "" " {NULL} /* Sentinel */\n" "};" msgstr "" +"static PyMemberDef Custom_members[] = {\n" +" {\"first\", Py_T_OBJECT_EX, offsetof(CustomObject, first), 0,\n" +" \"ファーストネーム\"},\n" +" {\"last\", Py_T_OBJECT_EX, offsetof(CustomObject, last), 0,\n" +" \"ラストネーム\"},\n" +" {\"number\", Py_T_INT, offsetof(CustomObject, number), 0,\n" +" \"独自の数値\"},\n" +" {NULL} /* 番兵 */\n" +"};" #: ../../extending/newtypes_tutorial.rst:457 msgid "" @@ -1030,18 +1167,18 @@ msgstr "" "そして、この定義を :c:member:`~PyTypeObject.tp_members` スロットに入れましょ" "う::" -#: ../../extending/newtypes_tutorial.rst:459 msgid ".tp_members = Custom_members," -msgstr "" +msgstr ".tp_members = Custom_members," -#: ../../extending/newtypes_tutorial.rst:461 msgid "" "Each member definition has a member name, type, offset, access flags and " "documentation string. See the :ref:`Generic-Attribute-Management` section " "below for details." msgstr "" +"各メンバ定義には、メンバ名、型、オフセット、アクセスフラグ、ドキュメント文字" +"列があります。\n" +"詳細は後述の :ref:`Generic-Attribute-Management` 節を参照してください。" -#: ../../extending/newtypes_tutorial.rst:465 msgid "" "A disadvantage of this approach is that it doesn't provide a way to restrict " "the types of objects that can be assigned to the Python attributes. We " @@ -1051,14 +1188,21 @@ msgid "" "``NULL`` values, the members can be set to ``NULL`` if the attributes are " "deleted." msgstr "" +"この方法の欠点は、Python の属性に代入できるオブジェクトの型を制限できないこと" +"です。\n" +"ファーストネームとラストネームには文字列を想定していますが、任意の Python オ" +"ブジェクトを代入できてしまいます。\n" +"さらに、属性を削除すると、C のポインタが ``NULL`` になります。\n" +"メンバを ``NULL`` でない値に初期化しても、属性が削除されれば ``NULL`` に設定" +"されます。" -#: ../../extending/newtypes_tutorial.rst:472 msgid "" "We define a single method, :meth:`!Custom.name`, that outputs the objects " "name as the concatenation of the first and last names. ::" msgstr "" +"ファーストネームとラストネームを連結してオブジェクトの名前を返す、:meth:`!" +"Custom.name` というメソッドを一つ定義します。 ::" -#: ../../extending/newtypes_tutorial.rst:475 msgid "" "static PyObject *\n" "Custom_name(PyObject *op, PyObject *Py_UNUSED(dummy))\n" @@ -1075,8 +1219,21 @@ msgid "" " return PyUnicode_FromFormat(\"%S %S\", self->first, self->last);\n" "}" msgstr "" +"static PyObject *\n" +"Custom_name(PyObject *op, PyObject *Py_UNUSED(dummy))\n" +"{\n" +" CustomObject *self = (CustomObject *) op;\n" +" if (self->first == NULL) {\n" +" PyErr_SetString(PyExc_AttributeError, \"first\");\n" +" return NULL;\n" +" }\n" +" if (self->last == NULL) {\n" +" PyErr_SetString(PyExc_AttributeError, \"last\");\n" +" return NULL;\n" +" }\n" +" return PyUnicode_FromFormat(\"%S %S\", self->first, self->last);\n" +"}" -#: ../../extending/newtypes_tutorial.rst:490 msgid "" "The method is implemented as a C function that takes a :class:`!Custom` (or :" "class:`!Custom` subclass) instance as the first argument. Methods always " @@ -1085,14 +1242,21 @@ msgid "" "to accept a positional argument tuple or keyword argument dictionary. This " "method is equivalent to the Python method:" msgstr "" +"このメソッドは、:class:`!Custom` (または :class:`!Custom` のサブクラス) のイ" +"ンスタンスを第 1 引数として受け取る C 関数として実装します。\n" +"メソッドは常に第 1 引数としてインスタンスを受け取ります。\n" +"多くの場合は位置引数やキーワード引数も受け取りますが、ここではどちらも受け取" +"らないため、位置引数のタプルやキーワード引数の辞書を受け取る必要はありませ" +"ん。\n" +"このメソッドは、次の Python メソッドに相当します。" -#: ../../extending/newtypes_tutorial.rst:497 msgid "" "def name(self):\n" " return \"%s %s\" % (self.first, self.last)" msgstr "" +"def name(self):\n" +" return \"%s %s\" % (self.first, self.last)" -#: ../../extending/newtypes_tutorial.rst:502 msgid "" "Note that we have to check for the possibility that our :attr:`!first` and :" "attr:`!last` members are ``NULL``. This is because they can be deleted, in " @@ -1100,6 +1264,11 @@ msgid "" "of these attributes and to restrict the attribute values to be strings. " "We'll see how to do that in the next section." msgstr "" +":attr:`!first` と :attr:`!last` メンバが ``NULL`` である可能性を確認する必要" +"があります。\n" +"これらの属性は削除可能で、削除された場合は ``NULL`` に設定されるためです。\n" +"これらの属性を削除できないようにし、値を文字列に制限するとよいでしょう。\n" +"次の節でその方法を説明します。" #: ../../extending/newtypes_tutorial.rst:508 msgid "" @@ -1109,7 +1278,6 @@ msgstr "" "さて、メソッドを定義したので、ここでメソッド定義用の配列を作成する必要があり" "ます::" -#: ../../extending/newtypes_tutorial.rst:511 msgid "" "static PyMethodDef Custom_methods[] = {\n" " {\"name\", Custom_name, METH_NOARGS,\n" @@ -1118,45 +1286,55 @@ msgid "" " {NULL} /* Sentinel */\n" "};" msgstr "" +"static PyMethodDef Custom_methods[] = {\n" +" {\"name\", Custom_name, METH_NOARGS,\n" +" \"ファーストネームとラストネームを連結した名前を返す\"\n" +" },\n" +" {NULL} /* 番兵 */\n" +"};" -#: ../../extending/newtypes_tutorial.rst:518 msgid "" "(note that we used the :c:macro:`METH_NOARGS` flag to indicate that the " "method is expecting no arguments other than *self*)" msgstr "" +"(``self`` 以外の引数を受け取らないことを示すために、:c:macro:`METH_NOARGS` フ" +"ラグを使っています。)" -#: ../../extending/newtypes_tutorial.rst:521 msgid "and assign it to the :c:member:`~PyTypeObject.tp_methods` slot::" msgstr "" +"そして、それを :c:member:`~PyTypeObject.tp_methods` スロットに代入します。 ::" -#: ../../extending/newtypes_tutorial.rst:523 msgid ".tp_methods = Custom_methods," -msgstr "" +msgstr ".tp_methods = Custom_methods," -#: ../../extending/newtypes_tutorial.rst:525 msgid "" "Finally, we'll make our type usable as a base class for subclassing. We've " "written our methods carefully so far so that they don't make any assumptions " "about the type of the object being created or used, so all we need to do is " "to add the :c:macro:`Py_TPFLAGS_BASETYPE` to our class flag definition::" msgstr "" +"最後に、この型をサブクラスの基底クラスとして使えるようにします。\n" +"ここまで、作成するオブジェクトや操作対象のオブジェクトの型を決めつけないよう" +"に注意してメソッドを書いてきました。\n" +"そのため、クラスのフラグ定義に :c:macro:`Py_TPFLAGS_BASETYPE` を追加するだけ" +"で済みます。 ::" -#: ../../extending/newtypes_tutorial.rst:530 msgid ".tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE," -msgstr "" +msgstr ".tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE," -#: ../../extending/newtypes_tutorial.rst:532 msgid "" "We rename :c:func:`!PyInit_custom` to :c:func:`!PyInit_custom2`, update the " "module name in the :c:type:`PyModuleDef` struct, and update the full class " "name in the :c:type:`PyTypeObject` struct." msgstr "" +":c:func:`!PyInit_custom` を :c:func:`!PyInit_custom2` に改名し、:c:type:" +"`PyModuleDef` 構造体のモジュール名と :c:type:`PyTypeObject` 構造体の完全なク" +"ラス名を更新します。" -#: ../../extending/newtypes_tutorial.rst:536 msgid "Finally, we update our :file:`setup.py` file to include the new module," msgstr "" +"最後に、新しいモジュールを含めるよう :file:`setup.py` ファイルを更新し、" -#: ../../extending/newtypes_tutorial.rst:538 msgid "" "from setuptools import Extension, setup\n" "setup(ext_modules=[\n" @@ -1164,16 +1342,19 @@ msgid "" " Extension(\"custom2\", [\"custom2.c\"]),\n" "])" msgstr "" +"from setuptools import Extension, setup\n" +"setup(ext_modules=[\n" +" Extension(\"custom\", [\"custom.c\"]),\n" +" Extension(\"custom2\", [\"custom2.c\"]),\n" +"])" -#: ../../extending/newtypes_tutorial.rst:546 msgid "and then we re-install so that we can ``import custom2``:" -msgstr "" +msgstr "``import custom2`` ができるように再インストールします。" #: ../../extending/newtypes_tutorial.rst:553 msgid "Providing finer control over data attributes" msgstr "データ属性をこまかく制御する" -#: ../../extending/newtypes_tutorial.rst:555 msgid "" "In this section, we'll provide finer control over how the :attr:`!first` " "and :attr:`!last` attributes are set in the :class:`!Custom` example. In the " @@ -1181,6 +1362,11 @@ msgid "" "attr:`!last` could be set to non-string values or even deleted. We want to " "make sure that these attributes always contain strings." msgstr "" +"この節では、:class:`!Custom` の例で :attr:`!first` と :attr:`!last` 属性を設" +"定する方法を、より細かく制御します。\n" +"前のバージョンのモジュールでは、インスタンス変数 :attr:`!first` と :attr:`!" +"last` に文字列以外の値を設定でき、削除することさえできました。\n" +"これらの属性が常に文字列を格納するようにしたいと思います。" #: ../../extending/newtypes_tutorial.rst:561 msgid "" @@ -1367,14 +1553,15 @@ msgid "" "}\n" msgstr "" -#: ../../extending/newtypes_tutorial.rst:564 msgid "" "To provide greater control, over the :attr:`!first` and :attr:`!last` " "attributes, we'll use custom getter and setter functions. Here are the " "functions for getting and setting the :attr:`!first` attribute::" msgstr "" +":attr:`!first` と :attr:`!last` 属性をもっと細かく制御するため、独自の " +"getter 関数と setter 関数を使います。\n" +":attr:`!first` 属性を取得、設定する関数は次のとおりです。 ::" -#: ../../extending/newtypes_tutorial.rst:568 msgid "" "static PyObject *\n" "Custom_getfirst(PyObject *op, void *closure)\n" @@ -1406,8 +1593,36 @@ msgid "" " return 0;\n" "}" msgstr "" +"static PyObject *\n" +"Custom_getfirst(PyObject *op, void *closure)\n" +"{\n" +" CustomObject *self = (CustomObject *) op;\n" +" Py_INCREF(self->first);\n" +" return self->first;\n" +"}\n" +"\n" +"static int\n" +"Custom_setfirst(PyObject *op, PyObject *value, void *closure)\n" +"{\n" +" CustomObject *self = (CustomObject *) op;\n" +" PyObject *tmp;\n" +" if (value == NULL) {\n" +" PyErr_SetString(PyExc_TypeError, \"Cannot delete the first " +"attribute\");\n" +" return -1;\n" +" }\n" +" if (!PyUnicode_Check(value)) {\n" +" PyErr_SetString(PyExc_TypeError,\n" +" \"The first attribute value must be a string\");\n" +" return -1;\n" +" }\n" +" tmp = self->first;\n" +" Py_INCREF(value);\n" +" self->first = value;\n" +" Py_DECREF(tmp);\n" +" return 0;\n" +"}" -#: ../../extending/newtypes_tutorial.rst:597 msgid "" "The getter function is passed a :class:`!Custom` object and a \"closure\", " "which is a void pointer. In this case, the closure is ignored. (The " @@ -1416,20 +1631,30 @@ msgid "" "getter and setter functions that decide the attribute to get or set based on " "data in the closure.)" msgstr "" +"getter 関数には、:class:`!Custom` オブジェクトと、void ポインタである「クロー" +"ジャ」を渡します。\n" +"ここではクロージャを無視します。\n" +"(クロージャは、定義に関するデータを getter や setter に渡す高度な使い方をサ" +"ポートします。\n" +"例えば、クロージャ内のデータに応じて取得や設定を行う属性を決める、一組の " +"getter 関数と setter 関数を用意できます。)" -#: ../../extending/newtypes_tutorial.rst:603 msgid "" "The setter function is passed the :class:`!Custom` object, the new value, " "and the closure. The new value may be ``NULL``, in which case the attribute " "is being deleted. In our setter, we raise an error if the attribute is " "deleted or if its new value is not a string." msgstr "" +"setter 関数には、:class:`!Custom` オブジェクト、新しい値、クロージャを渡しま" +"す。\n" +"新しい値が ``NULL`` の場合は、属性の削除を意味します。\n" +"今回の setter では、属性を削除しようとした場合や、新しい値が文字列でない場合" +"にエラーを送出します。" #: ../../extending/newtypes_tutorial.rst:608 msgid "We create an array of :c:type:`PyGetSetDef` structures::" msgstr "ここでは :c:type:`PyGetSetDef` 構造体の配列をつくります::" -#: ../../extending/newtypes_tutorial.rst:610 msgid "" "static PyGetSetDef Custom_getsetters[] = {\n" " {\"first\", Custom_getfirst, Custom_setfirst,\n" @@ -1439,28 +1664,35 @@ msgid "" " {NULL} /* Sentinel */\n" "};" msgstr "" +"static PyGetSetDef Custom_getsetters[] = {\n" +" {\"first\", Custom_getfirst, Custom_setfirst,\n" +" \"ファーストネーム\", NULL},\n" +" {\"last\", Custom_getlast, Custom_setlast,\n" +" \"ラストネーム\", NULL},\n" +" {NULL} /* 番兵 */\n" +"};" #: ../../extending/newtypes_tutorial.rst:618 msgid "and register it in the :c:member:`~PyTypeObject.tp_getset` slot::" msgstr "" "そしてこれを :c:member:`~PyTypeObject.tp_getset` スロットに登録します::" -#: ../../extending/newtypes_tutorial.rst:620 msgid ".tp_getset = Custom_getsetters," -msgstr "" +msgstr ".tp_getset = Custom_getsetters," -#: ../../extending/newtypes_tutorial.rst:622 msgid "" "The last item in a :c:type:`PyGetSetDef` structure is the \"closure\" " "mentioned above. In this case, we aren't using a closure, so we just pass " "``NULL``." msgstr "" +":c:type:`PyGetSetDef` 構造体の最後の項目は、先ほど説明した「クロージャ」で" +"す。\n" +"ここではクロージャを使わないので、単に ``NULL`` を渡します。" #: ../../extending/newtypes_tutorial.rst:625 msgid "We also remove the member definitions for these attributes::" msgstr "また、メンバ定義からはこれらの属性を除いておきましょう::" -#: ../../extending/newtypes_tutorial.rst:627 msgid "" "static PyMemberDef Custom_members[] = {\n" " {\"number\", Py_T_INT, offsetof(CustomObject, number), 0,\n" @@ -1468,6 +1700,11 @@ msgid "" " {NULL} /* Sentinel */\n" "};" msgstr "" +"static PyMemberDef Custom_members[] = {\n" +" {\"number\", Py_T_INT, offsetof(CustomObject, number), 0,\n" +" \"独自の数値\"},\n" +" {NULL} /* 番兵 */\n" +"};" #: ../../extending/newtypes_tutorial.rst:633 msgid "" @@ -1477,7 +1714,6 @@ msgstr "" "また、ここでは :c:member:`~PyTypeObject.tp_init` ハンドラも渡されるものとして" "文字列のみを許可するように修正する必要があります [#]_::" -#: ../../extending/newtypes_tutorial.rst:636 msgid "" "static int\n" "Custom_init(PyObject *op, PyObject *args, PyObject *kwds)\n" @@ -1506,8 +1742,33 @@ msgid "" " return 0;\n" "}" msgstr "" +"static int\n" +"Custom_init(PyObject *op, PyObject *args, PyObject *kwds)\n" +"{\n" +" CustomObject *self = (CustomObject *) op;\n" +" static char *kwlist[] = {\"first\", \"last\", \"number\", NULL};\n" +" PyObject *first = NULL, *last = NULL, *tmp;\n" +"\n" +" if (!PyArg_ParseTupleAndKeywords(args, kwds, \"|UUi\", kwlist,\n" +" &first, &last,\n" +" &self->number))\n" +" return -1;\n" +"\n" +" if (first) {\n" +" tmp = self->first;\n" +" Py_INCREF(first);\n" +" self->first = first;\n" +" Py_DECREF(tmp);\n" +" }\n" +" if (last) {\n" +" tmp = self->last;\n" +" Py_INCREF(last);\n" +" self->last = last;\n" +" Py_DECREF(tmp);\n" +" }\n" +" return 0;\n" +"}" -#: ../../extending/newtypes_tutorial.rst:663 msgid "" "With these changes, we can assure that the ``first`` and ``last`` members " "are never ``NULL`` so we can remove checks for ``NULL`` values in almost all " @@ -1516,6 +1777,12 @@ msgid "" "these calls is in the ``tp_dealloc`` implementation, where there is the " "possibility that the initialization of these members failed in ``tp_new``." msgstr "" +"これらの変更により、``first`` と ``last`` メンバが ``NULL`` にならないことを" +"保証できるため、ほとんどの場合は ``NULL`` のチェックを削除できます。\n" +"つまり、:c:func:`Py_XDECREF` の呼び出しのほとんどを :c:func:`Py_DECREF` に置" +"き換えられます。\n" +"唯一置き換えられないのは ``tp_dealloc`` の実装内です。\n" +"``tp_new`` でこれらのメンバの初期化に失敗した可能性があるためです。" #: ../../extending/newtypes_tutorial.rst:670 msgid "" @@ -1542,12 +1809,14 @@ msgstr "" "ることができます。そのような状況はオブジェクトの参照が循環しているときに起こ" "りえます。たとえば以下の例を考えてください:" -#: ../../extending/newtypes_tutorial.rst:682 msgid "" ">>> l = []\n" ">>> l.append(l)\n" ">>> del l" msgstr "" +">>> l = []\n" +">>> l.append(l)\n" +">>> del l" #: ../../extending/newtypes_tutorial.rst:688 msgid "" @@ -1561,7 +1830,6 @@ msgstr "" "りません。嬉しいことに Python には循環ガベージコレクタは最終的にはこのリスト" "が不要であることを検出し、解放できます。" -#: ../../extending/newtypes_tutorial.rst:693 msgid "" "In the second version of the :class:`!Custom` example, we allowed any kind " "of object to be stored in the :attr:`!first` or :attr:`!last` attributes " @@ -1569,8 +1837,14 @@ msgid "" "class:`!Custom`, and subclasses may add arbitrary attributes. For any of " "those two reasons, :class:`!Custom` objects can participate in cycles:" msgstr "" +":class:`!Custom` の例の第 2 版では、:attr:`!first` と :attr:`!last` 属性にど" +"のようなオブジェクトでも格納できるようにしました [#]_。\n" +"さらに、第 2 版と第 3 版では :class:`!Custom` のサブクラス化を許可しまし" +"た。\n" +"サブクラスには任意の属性を追加できます。\n" +"これらのどちらの理由によっても、:class:`!Custom` オブジェクトが参照の循環に加" +"わる可能性があります。" -#: ../../extending/newtypes_tutorial.rst:699 msgid "" ">>> import custom3\n" ">>> class Derived(custom3.Custom): pass\n" @@ -1578,14 +1852,21 @@ msgid "" ">>> n = Derived()\n" ">>> n.some_attribute = n" msgstr "" +">>> import custom3\n" +">>> class Derived(custom3.Custom): pass\n" +"...\n" +">>> n = Derived()\n" +">>> n.some_attribute = n" -#: ../../extending/newtypes_tutorial.rst:707 msgid "" "To allow a :class:`!Custom` instance participating in a reference cycle to " "be properly detected and collected by the cyclic GC, our :class:`!Custom` " "type needs to fill two additional slots and to enable a flag that enables " "these slots:" msgstr "" +"参照の循環に加わった :class:`!Custom` インスタンスを循環 GC が正しく検出して" +"回収できるようにするには、:class:`!Custom` 型でさらに二つのスロットを設定し、" +"それらのスロットを有効にするフラグを設定する必要があります。" #: ../../extending/newtypes_tutorial.rst:711 msgid "" @@ -1792,13 +2073,13 @@ msgid "" "}\n" msgstr "" -#: ../../extending/newtypes_tutorial.rst:714 msgid "" "First, the traversal method lets the cyclic GC know about subobjects that " "could participate in cycles::" msgstr "" +"まず、走査メソッドによって、参照の循環に加わる可能性のある子オブジェクトを循" +"環 GC に知らせます。 ::" -#: ../../extending/newtypes_tutorial.rst:717 msgid "" "static int\n" "Custom_traverse(PyObject *op, visitproc visit, void *arg)\n" @@ -1818,8 +2099,24 @@ msgid "" " return 0;\n" "}" msgstr "" +"static int\n" +"Custom_traverse(PyObject *op, visitproc visit, void *arg)\n" +"{\n" +" CustomObject *self = (CustomObject *) op;\n" +" int vret;\n" +" if (self->first) {\n" +" vret = visit(self->first, arg);\n" +" if (vret != 0)\n" +" return vret;\n" +" }\n" +" if (self->last) {\n" +" vret = visit(self->last, arg);\n" +" if (vret != 0)\n" +" return vret;\n" +" }\n" +" return 0;\n" +"}" -#: ../../extending/newtypes_tutorial.rst:735 msgid "" "For each subobject that can participate in cycles, we need to call the :c:" "func:`!visit` function, which is passed to the traversal method. The :c:func:" @@ -1827,15 +2124,22 @@ msgid "" "*arg* passed to the traversal method. It returns an integer value that must " "be returned if it is non-zero." msgstr "" +"参照の循環に加わる可能性のある子オブジェクトごとに、走査メソッドに渡された :" +"c:func:`!visit` 関数を呼び出す必要があります。\n" +":c:func:`!visit` 関数は、子オブジェクトと、走査メソッドに渡された追加の引数 " +"``arg`` を受け取ります。\n" +"戻り値は整数で、ゼロでなければその値をそのまま返す必要があります。" -#: ../../extending/newtypes_tutorial.rst:741 msgid "" "Python provides a :c:func:`Py_VISIT` macro that automates calling visit " "functions. With :c:func:`Py_VISIT`, we can minimize the amount of " "boilerplate in ``Custom_traverse``::" msgstr "" +"Python には、visit 関数の呼び出しを自動化する :c:func:`Py_VISIT` マクロがあり" +"ます。\n" +":c:func:`Py_VISIT` を使うと、``Custom_traverse`` の定型的なコードを最小限にで" +"きます。 ::" -#: ../../extending/newtypes_tutorial.rst:745 msgid "" "static int\n" "Custom_traverse(PyObject *op, visitproc visit, void *arg)\n" @@ -1846,20 +2150,29 @@ msgid "" " return 0;\n" "}" msgstr "" +"static int\n" +"Custom_traverse(PyObject *op, visitproc visit, void *arg)\n" +"{\n" +" CustomObject *self = (CustomObject *) op;\n" +" Py_VISIT(self->first);\n" +" Py_VISIT(self->last);\n" +" return 0;\n" +"}" -#: ../../extending/newtypes_tutorial.rst:755 msgid "" "The :c:member:`~PyTypeObject.tp_traverse` implementation must name its " "arguments exactly *visit* and *arg* in order to use :c:func:`Py_VISIT`." msgstr "" +":c:func:`Py_VISIT` を使うには、:c:member:`~PyTypeObject.tp_traverse` の実装" +"で、引数の名前を必ず ``visit`` と ``arg`` にする必要があります。" -#: ../../extending/newtypes_tutorial.rst:758 msgid "" "Second, we need to provide a method for clearing any subobjects that can " "participate in cycles::" msgstr "" +"次に、参照の循環に加わる可能性のある子オブジェクトをすべてクリアするメソッド" +"を用意する必要があります。 ::" -#: ../../extending/newtypes_tutorial.rst:761 msgid "" "static int\n" "Custom_clear(PyObject *op)\n" @@ -1870,8 +2183,15 @@ msgid "" " return 0;\n" "}" msgstr "" +"static int\n" +"Custom_clear(PyObject *op)\n" +"{\n" +" CustomObject *self = (CustomObject *) op;\n" +" Py_CLEAR(self->first);\n" +" Py_CLEAR(self->last);\n" +" return 0;\n" +"}" -#: ../../extending/newtypes_tutorial.rst:770 msgid "" "Notice the use of the :c:func:`Py_CLEAR` macro. It is the recommended and " "safe way to clear data attributes of arbitrary types while decrementing " @@ -1880,27 +2200,36 @@ msgid "" "attribute's destructor would call back into code that reads the attribute " "again (*especially* if there is a reference cycle)." msgstr "" +":c:func:`Py_CLEAR` マクロを使っていることに注目してください。\n" +"これは、参照カウントを減らしながら任意の型のデータ属性をクリアする、推奨され" +"る安全な方法です。\n" +"属性を ``NULL`` に設定する前に、代わりに :c:func:`Py_XDECREF` を呼び出すと、" +"属性のデストラクタがその属性を再び読み取るコードを呼び出す可能性があります " +"(参照の循環がある場合は *特に* 注意が必要です)。" -#: ../../extending/newtypes_tutorial.rst:778 msgid "You could emulate :c:func:`Py_CLEAR` by writing::" -msgstr "" +msgstr ":c:func:`Py_CLEAR` と同じ処理は、次のようにも書けます。 ::" -#: ../../extending/newtypes_tutorial.rst:780 msgid "" "PyObject *tmp;\n" "tmp = self->first;\n" "self->first = NULL;\n" "Py_XDECREF(tmp);" msgstr "" +"PyObject *tmp;\n" +"tmp = self->first;\n" +"self->first = NULL;\n" +"Py_XDECREF(tmp);" -#: ../../extending/newtypes_tutorial.rst:785 msgid "" "Nevertheless, it is much easier and less error-prone to always use :c:func:" "`Py_CLEAR` when deleting an attribute. Don't try to micro-optimize at the " "expense of robustness!" msgstr "" +"それでも、属性を削除するときは常に :c:func:`Py_CLEAR` を使う方が、はるかに簡" +"単で間違いも少なくなります。\n" +"堅牢性を犠牲にしてまで細かな最適化を試みないでください。" -#: ../../extending/newtypes_tutorial.rst:789 msgid "" "The deallocator ``Custom_dealloc`` may call arbitrary code when clearing " "attributes. It means the circular GC can be triggered inside the function. " @@ -1909,8 +2238,15 @@ msgid "" "members. Here is our reimplemented deallocator using :c:func:" "`PyObject_GC_UnTrack` and ``Custom_clear``::" msgstr "" +"メモリ解放関数 ``Custom_dealloc`` は、属性のクリア時に任意のコードを呼び出す" +"可能性があります。\n" +"つまり、この関数内で循環 GC が実行される可能性があります。\n" +"GC は参照カウントがゼロでないことを前提としているため、メンバをクリアする前" +"に :c:func:`PyObject_GC_UnTrack` を呼び出して、GC の追跡対象からオブジェクト" +"を外す必要があります。\n" +":c:func:`PyObject_GC_UnTrack` と ``Custom_clear`` を使って書き直したメモリ解" +"放関数は次のとおりです。 ::" -#: ../../extending/newtypes_tutorial.rst:796 msgid "" "static void\n" "Custom_dealloc(PyObject *op)\n" @@ -1920,16 +2256,24 @@ msgid "" " Py_TYPE(op)->tp_free(op);\n" "}" msgstr "" +"static void\n" +"Custom_dealloc(PyObject *op)\n" +"{\n" +" PyObject_GC_UnTrack(op);\n" +" (void)Custom_clear(op);\n" +" Py_TYPE(op)->tp_free(op);\n" +"}" -#: ../../extending/newtypes_tutorial.rst:804 msgid "" "Finally, we add the :c:macro:`Py_TPFLAGS_HAVE_GC` flag to the class flags::" msgstr "" +"最後に、クラスのフラグに :c:macro:`Py_TPFLAGS_HAVE_GC` フラグを追加しま" +"す。 ::" -#: ../../extending/newtypes_tutorial.rst:806 msgid "" ".tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC," msgstr "" +".tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC," #: ../../extending/newtypes_tutorial.rst:808 msgid "" @@ -1959,15 +2303,17 @@ msgstr "" "す。それに比べて、 :c:type:`PyTypeObject` 構造体を拡張モジュール間で共有する" "のは難しいです。" -#: ../../extending/newtypes_tutorial.rst:821 msgid "" "In this example we will create a :class:`!SubList` type that inherits from " "the built-in :class:`list` type. The new type will be completely compatible " "with regular lists, but will have an additional :meth:`!increment` method " "that increases an internal counter:" msgstr "" +"この例では、組み込みの :class:`list` 型を継承した :class:`!SubList` 型を作成" +"します。\n" +"新しい型は通常のリストと完全な互換性を持ち、さらに内部カウンタを増やす :meth:" +"`!increment` メソッドを持ちます。" -#: ../../extending/newtypes_tutorial.rst:826 msgid "" ">>> import sublist\n" ">>> s = sublist.SubList(range(3))\n" @@ -1979,6 +2325,15 @@ msgid "" ">>> print(s.increment())\n" "2" msgstr "" +">>> import sublist\n" +">>> s = sublist.SubList(range(3))\n" +">>> s.extend(s)\n" +">>> print(len(s))\n" +"6\n" +">>> print(s.increment())\n" +"1\n" +">>> print(s.increment())\n" +"2" #: ../../extending/newtypes_tutorial.rst:838 msgid "" @@ -2054,36 +2409,44 @@ msgid "" "}\n" msgstr "" -#: ../../extending/newtypes_tutorial.rst:841 msgid "" "As you can see, the source code closely resembles the :class:`!Custom` " "examples in previous sections. We will break down the main differences " "between them. ::" msgstr "" +"見てのとおり、ソースコードは前の節の :class:`!Custom` の例によく似ていま" +"す。\n" +"主な違いを順に見ていきましょう。 ::" -#: ../../extending/newtypes_tutorial.rst:844 msgid "" "typedef struct {\n" " PyListObject list;\n" " int state;\n" "} SubListObject;" msgstr "" +"typedef struct {\n" +" PyListObject list;\n" +" int state;\n" +"} SubListObject;" -#: ../../extending/newtypes_tutorial.rst:849 msgid "" "The primary difference for derived type objects is that the base type's " "object structure must be the first value. The base type will already " "include the :c:func:`PyObject_HEAD` at the beginning of its structure." msgstr "" +"派生型のオブジェクトで最も大きな違いは、先頭のメンバを基底型のオブジェクト構" +"造体にする必要があることです。\n" +"基底型の構造体には、すでに先頭に :c:func:`PyObject_HEAD` が含まれています。" -#: ../../extending/newtypes_tutorial.rst:853 msgid "" "When a Python object is a :class:`!SubList` instance, its ``PyObject *`` " "pointer can be safely cast to both ``PyListObject *`` and ``SubListObject " "*``::" msgstr "" +"Python オブジェクトが :class:`!SubList` のインスタンスである場合、その " +"``PyObject *`` ポインタは ``PyListObject *`` と ``SubListObject *`` のどちら" +"にも安全にキャストできます。 ::" -#: ../../extending/newtypes_tutorial.rst:856 msgid "" "static int\n" "SubList_init(PyObject *op, PyObject *args, PyObject *kwds)\n" @@ -2095,14 +2458,23 @@ msgid "" " return 0;\n" "}" msgstr "" +"static int\n" +"SubList_init(PyObject *op, PyObject *args, PyObject *kwds)\n" +"{\n" +" SubListObject *self = (SubListObject *) op;\n" +" if (PyList_Type.tp_init(op, args, kwds) < 0)\n" +" return -1;\n" +" self->state = 0;\n" +" return 0;\n" +"}" -#: ../../extending/newtypes_tutorial.rst:866 msgid "" "We see above how to call through to the :meth:`~object.__init__` method of " "the base type." msgstr "" +"上の例は、基底型の :meth:`~object.__init__` メソッドを呼び出す方法を示してい" +"ます。" -#: ../../extending/newtypes_tutorial.rst:869 msgid "" "This pattern is important when writing a type with custom :c:member:" "`~PyTypeObject.tp_new` and :c:member:`~PyTypeObject.tp_dealloc` members. " @@ -2110,6 +2482,12 @@ msgid "" "memory for the object with its :c:member:`~PyTypeObject.tp_alloc`, but let " "the base class handle it by calling its own :c:member:`~PyTypeObject.tp_new`." msgstr "" +"この方法は、独自の :c:member:`~PyTypeObject.tp_new` と :c:member:" +"`~PyTypeObject.tp_dealloc` メンバを持つ型を書くときに重要です。\n" +":c:member:`~PyTypeObject.tp_new` ハンドラでは、自身の :c:member:" +"`~PyTypeObject.tp_alloc` でオブジェクトのメモリを割り当てるのではなく、基底ク" +"ラスの :c:member:`~PyTypeObject.tp_new` を呼び出して、基底クラスに処理を任せ" +"るべきです。" #: ../../extending/newtypes_tutorial.rst:875 msgid "" @@ -2144,7 +2522,6 @@ msgid "" "}" msgstr "" -#: ../../extending/newtypes_tutorial.rst:901 msgid "" "Before calling :c:func:`PyType_Ready`, the type structure must have the :c:" "member:`~PyTypeObject.tp_base` slot filled in. When we are deriving an " @@ -2152,17 +2529,18 @@ msgid "" "tp_alloc` slot with :c:func:`PyType_GenericNew` -- the allocation function " "from the base type will be inherited." msgstr "" -":c:func:`PyType_Read` を呼ぶ前に、型の構造体の :c:member:`~PyTypeObject." -"tp_base` スロットは埋められていなければなりません。既存の型を継承する際に" -"は、 :c:member:`~PyTypeObject.tp_alloc` スロットを :c:func:" -"`PyType_GenericNew` で埋める必要はありません。 -- 基底型のアロケーション関数" -"が継承されます。" +":c:func:`PyType_Ready` を呼び出す前に、型の構造体の :c:member:`~PyTypeObject." +"tp_base` スロットを設定しておく必要があります。\n" +"既存の型から派生させる場合、:c:member:`~PyTypeObject.tp_alloc` スロットを :c:" +"func:`PyType_GenericNew` で設定する必要はありません。\n" +"基底型の割り当て関数が継承されます。" -#: ../../extending/newtypes_tutorial.rst:907 msgid "" "After that, calling :c:func:`PyType_Ready` and adding the type object to the " "module is the same as with the basic :class:`!Custom` examples." msgstr "" +"その後の :c:func:`PyType_Ready` の呼び出しと型オブジェクトのモジュールへの追" +"加は、基本的な :class:`!Custom` の例と同じです。" #: ../../extending/newtypes_tutorial.rst:912 msgid "Footnotes" @@ -2176,13 +2554,13 @@ msgstr "" "これはそのオブジェクトが文字列や実数などの基本タイプであるような時に成り立ち" "ます。" -#: ../../extending/newtypes_tutorial.rst:916 msgid "" "We relied on this in the :c:member:`~PyTypeObject.tp_dealloc` handler in " "this example, because our type doesn't support garbage collection." msgstr "" +"この例の :c:member:`~PyTypeObject.tp_dealloc` ハンドラでは、型がガベージコレ" +"クションをサポートしていないため、この点を利用しました。" -#: ../../extending/newtypes_tutorial.rst:919 msgid "" "We now know that the first and last members are strings, so perhaps we could " "be less careful about decrementing their reference counts, however, we " @@ -2191,10 +2569,16 @@ msgid "" "deallocating an instance of a string subclass won't call back into our " "objects." msgstr "" +"``first`` と ``last`` メンバが文字列だと分かったので、参照カウントを減らすと" +"きの注意を少し省けるかもしれません。\n" +"しかし、ここでは文字列のサブクラスのインスタンスも受け付けます。\n" +"通常の文字列の解放が自分のオブジェクトを呼び戻すことはありませんが、文字列の" +"サブクラスのインスタンスを解放するときにもそうならないとは保証できません。" -#: ../../extending/newtypes_tutorial.rst:925 msgid "" "Also, even with our attributes restricted to strings instances, the user " "could pass arbitrary :class:`str` subclasses and therefore still create " "reference cycles." msgstr "" +"また、属性を文字列のインスタンスに制限しても、ユーザーは任意の :class:`str` " +"サブクラスを渡せるので、依然として参照の循環を作れます。" diff --git a/extending/windows.po b/extending/windows.po index a4e8c9e1e..dbd998ebb 100644 --- a/extending/windows.po +++ b/extending/windows.po @@ -16,10 +16,10 @@ msgstr "" "Last-Translator: tomo, 2021\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../extending/windows.rst:8 @@ -71,7 +71,6 @@ msgstr "" msgid "A Cookbook Approach" msgstr "型どおりのアプローチ" -#: ../../extending/windows.rst:36 msgid "" "There are two approaches to building extension modules on Windows, just as " "there are on Unix: use the ``setuptools`` package to control the build " @@ -82,6 +81,14 @@ msgid "" "project file for the :source:`winsound ` standard " "library module." msgstr "" +"Unix と同様、Windows で拡張モジュールをビルドする方法には、``setuptools`` " +"パッケージでビルドを制御する方法と、手動で行う方法の 2 つがあります。\n" +"ほとんどの拡張では setuptools が適しています。\n" +"``setuptools`` による拡張モジュールのビルドとパッケージ化の説明は、:ref:" +"`setuptools-index` にあります。\n" +"手動で行う必要がある場合は、標準ライブラリの :source:`winsound ` モジュールのプロジェクトファイルを調べると参考になるでしょ" +"う。" #: ../../extending/windows.rst:48 msgid "Differences Between Unix and Windows" @@ -97,7 +104,6 @@ msgstr "" "ます。動的ロードされるようなモジュールをビルドしようとする前に、自分のシステ" "ムがどのように動作するか知っておいてください。" -#: ../../extending/windows.rst:57 msgid "" "In Unix, a shared object (:file:`.so`) file contains code to be used by the " "program, and also the names of functions and data that it expects to find in " @@ -106,11 +112,11 @@ msgid "" "actual locations in the program where the functions and data are placed in " "memory. This is basically a link operation." msgstr "" -"Unix では、共有オブジェクト (:file:`.so`) ファイルにプログラムが使うコード、" -"そしてプログラム内で使う関数名やデータが入っています。ファイルがプログラムに" -"結合されると、これらの関数やデータに対するファイルのコード内の全ての参照は、" -"メモリ内で関数やデータが配置されている、プログラム中の実際の場所を指すように" -"変更されます。これは基本的にはリンク操作にあたります。" +"Unix の共有オブジェクト (:file:`.so`) ファイルには、プログラムが使うコードに" +"加え、プログラム内に存在すると想定する関数やデータの名前が含まれています。\n" +"ファイルをプログラムに組み込むと、ファイル内のコードからそれらの関数やデータ" +"への参照は、メモリ上の実際の配置先を指すように変更されます。\n" +"これは基本的にリンク操作です。" #: ../../extending/windows.rst:64 msgid "" @@ -199,26 +205,30 @@ msgstr "" "作成したりはしません。Unix では、ライブラリとのリンクはむしろ ``from spam " "import *`` に似ています; この操作では個別にコードのコピーを生成します。" -#: ../../extending/windows.rst:101 msgid "" "Turn off the implicit, ``#pragma``-based linkage with the Python library, " "performed inside CPython header files." msgstr "" +"CPython のヘッダーファイル内で行われる、``#pragma`` による Python ライブラリ" +"への暗黙のリンクを無効にします。" #: ../../extending/windows.rst:110 msgid "Using DLLs in Practice" msgstr "DLL 使用の実際" -#: ../../extending/windows.rst:115 msgid "" "Windows Python is built in Microsoft Visual C++; using other compilers may " "or may not work. The rest of this section is MSVC++ specific." msgstr "" +"Windows 版 Python は Microsoft Visual C++ でビルドされています。\n" +"ほかのコンパイラで動作するかどうかは分かりません。\n" +"この節の残りは、MSVC++ 固有の説明です。" -#: ../../extending/windows.rst:118 msgid "" "When creating DLLs in Windows, you can use the CPython library in two ways:" msgstr "" +"Windows で DLL を作成する場合、CPython のライブラリを使う方法は 2 つありま" +"す。" #: ../../extending/windows.rst:120 msgid "" @@ -229,25 +239,31 @@ msgid "" "application-binary-interface>`_ enabled." msgstr "" -#: ../../extending/windows.rst:126 ../../extending/windows.rst:144 msgid "" "To build two DLLs, spam and ni (which uses C functions found in spam), you " "could use these commands::" msgstr "" +"spam と、spam 内の C 関数を使う ni という 2 つの DLL をビルドするには、次のコ" +"マンドを使えます。 ::" -#: ../../extending/windows.rst:129 msgid "" "cl /LD /I/python/include spam.c\n" "cl /LD /I/python/include ni.c spam.lib" msgstr "" +"cl /LD /I/python/include spam.c\n" +"cl /LD /I/python/include ni.c spam.lib" -#: ../../extending/windows.rst:132 msgid "" "The first command created three files: :file:`spam.obj`, :file:`spam.dll` " "and :file:`spam.lib`. :file:`Spam.dll` does not contain any Python " "functions (such as :c:func:`PyArg_ParseTuple`), but it does know how to find " "the Python code thanks to the implicitly linked :file:`pythonXY.lib`." msgstr "" +"最初のコマンドは、:file:`spam.obj`、:file:`spam.dll`、:file:`spam.lib` の 3 " +"つのファイルを作成します。\n" +":file:`Spam.dll` には :c:func:`PyArg_ParseTuple` などの Python の関数は含まれ" +"ていませんが、暗黙にリンクされた :file:`pythonXY.lib` によって Python のコー" +"ドを見つけられます。" #: ../../extending/windows.rst:137 ../../extending/windows.rst:155 msgid "" @@ -259,17 +275,20 @@ msgstr "" "ができ、このライブラリは spam と Python 実行形式中の必要な関数をどうやって見" "つければよいか知っています。" -#: ../../extending/windows.rst:141 msgid "" "Manually by defining :c:macro:`Py_NO_LINK_LIB` macro before including :file:" "`Python.h`. You must pass :file:`pythonXY.lib` to the linker." msgstr "" +":file:`Python.h` をインクルードする前に :c:macro:`Py_NO_LINK_LIB` マクロを定" +"義し、手動でリンクします。\n" +"リンカーに :file:`pythonXY.lib` を渡さなければなりません。" -#: ../../extending/windows.rst:147 msgid "" "cl /LD /DPy_NO_LINK_LIB /I/python/include spam.c ../libs/pythonXY.lib\n" "cl /LD /DPy_NO_LINK_LIB /I/python/include ni.c spam.lib ../libs/pythonXY.lib" msgstr "" +"cl /LD /DPy_NO_LINK_LIB /I/python/include spam.c ../libs/pythonXY.lib\n" +"cl /LD /DPy_NO_LINK_LIB /I/python/include ni.c spam.lib ../libs/pythonXY.lib" #: ../../extending/windows.rst:150 msgid "" diff --git a/faq/design.po b/faq/design.po index 5ce0d2d74..a21191700 100644 --- a/faq/design.po +++ b/faq/design.po @@ -21,10 +21,10 @@ msgstr "" "Last-Translator: TENMYO Masakazu, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../faq/design.rst:3 @@ -65,6 +65,10 @@ msgid "" " y--;\n" "z++;" msgstr "" +"if (x <= y)\n" +" x++;\n" +" y--;\n" +"z++;" #: ../../faq/design.rst:26 msgid "" @@ -130,6 +134,8 @@ msgid "" ">>> 1.2 - 1.0\n" "0.19999999999999996" msgstr "" +">>> 1.2 - 1.0\n" +"0.19999999999999996" #: ../../faq/design.rst:61 msgid "" @@ -137,9 +143,9 @@ msgid "" "Python, and much more to do with how the underlying platform handles " "floating-point numbers." msgstr "" -"そしてこれが Python のバグだと考えます。が、これはバグではありません。この結" -"果に Python はほとんど関与しておらず、むしろ基底のプラットフォームによる浮動" -"小数点数の扱い方が関与しています。" +"Python のバグと考えるかもしれませんが、そうではありません。 この結果に " +"Python はほとんど影響しておらず、むしろ大きく関係しているのは下敷きとしている" +"プラットフォームによる浮動小数点数の扱い方です。" #: ../../faq/design.rst:65 msgid "" @@ -150,21 +156,24 @@ msgid "" "point operations. This means that as far as floating-point operations are " "concerned, Python behaves like many popular languages including C and Java." msgstr "" -"CPython における :class:`float` 型は記憶に C 言語の ``double`` 型を使いま" -"す。 :class:`float` オブジェクトの値は固定精度 (典型的には 53 bit) の 2 進浮" -"動小数点数として格納され、 Python はプロセッサのハードウェアが実装している C " -"言語上の演算を使います。つまり、浮動小数点数に関して Python は C 言語や Java " -"のような多くの一般的な言語と同じように振る舞います。" +"CPython における :class:`float` 型は C 言語の ``double`` 型をデータ格納先に使" +"います。 :class:`float` オブジェクトの値は固定精度 (典型的には 53 bit) の 2 " +"進浮動小数点数で格納されます。 そして Python は浮動小数点演算を行うために C " +"の演算を使いますが、これはプロセッサのハードウェア実装に依存します。つまり、" +"浮動小数点数に関して Python は C 言語や Java を含む多くの一般的な言語と同じよ" +"うに振る舞います。" #: ../../faq/design.rst:72 msgid "" "Many numbers that can be written easily in decimal notation cannot be " "expressed exactly in binary floating point. For example, after::" msgstr "" +"10 進数表記 (decimal) で簡単に表せる数値でも、その多くは 2 進浮動小数点数 " +"(binary) で正確に表現できません。 たとえば次では ::" #: ../../faq/design.rst:75 msgid ">>> x = 1.2" -msgstr "" +msgstr ">>> x = 1.2" #: ../../faq/design.rst:77 msgid "" @@ -178,7 +187,7 @@ msgstr "" #: ../../faq/design.rst:81 msgid "1.0011001100110011001100110011001100110011001100110011 (binary)" -msgstr "" +msgstr "1.0011001100110011001100110011001100110011001100110011 (binary)" #: ../../faq/design.rst:83 msgid "which is exactly::" @@ -186,21 +195,23 @@ msgstr "で、正確には次の値です::" #: ../../faq/design.rst:85 msgid "1.1999999999999999555910790149937383830547332763671875 (decimal)" -msgstr "" +msgstr "1.1999999999999999555910790149937383830547332763671875 (decimal)" #: ../../faq/design.rst:87 msgid "" "The typical precision of 53 bits provides Python floats with 15--16 decimal " "digits of accuracy." msgstr "" -"53bit の典型的な精度は、Python の float に 10 進数で 15〜16桁の精度を与えま" -"す。" +"典型的な 53bit 精度は、Python の float に 10 進数での 15〜16 桁の正確さを与え" +"ます。" #: ../../faq/design.rst:90 msgid "" "For a fuller explanation, please see the :ref:`floating-point arithmetic " "` chapter in the Python tutorial." msgstr "" +"詳しくは、Python チュートリアルの :ref:`floating-point arithmetic ` の章を参照してください。" #: ../../faq/design.rst:95 msgid "Why are Python strings immutable?" @@ -286,7 +297,6 @@ msgstr "" "基底クラスにある同じ名前のメソッドを拡張するために、基底クラスのメソッドをど" "うにかして呼び出したい時にも便利です。" -#: ../../faq/design.rst:136 msgid "" "Finally, for instance variables it solves a syntactic problem with " "assignment: since local variables in Python are (by definition!) those " @@ -303,18 +313,20 @@ msgid "" "instance variables live in two different namespaces, and you need to tell " "Python which namespace to use." msgstr "" -"最後に、インスタンス変数に対する、代入の構文の問題を解決できます。Python の" -"ローカル変数は、関数の中で (global が明示的に宣言されることなく) 値が代入され" -"た変数 (と定義されています!) です。なので、ある代入が意図するのが、ローカル" -"変数へではなくインスタンス変数への代入であると、インタプリタが判断する手段が" -"必要です。そしてそれは構文を見るだけで分かる方が (効率が) 良いのです。C++ で" -"はその区別を宣言時に行いますが、Python では宣言がないので、この方法でしか区別" -"できなかったら残念です。 ``self.var`` を明示すればうまく解決できます。同様" -"に、インスタンス変数を使うのにも ``self.var`` と書かなければならないので、メ" -"ソッドの中の self が付いていない名前への参照は、そのインスタンスのディレクト" -"リを検索するまでもなくローカル変数とわかります。別の言い方をすれば、ローカル" -"変数とインスタンス変数は二つの異なる名前空間に存在し、Python にどちらの名前空" -"間を使うかを伝えなくてはならないのです。" +"最後に、インスタンス変数に対する、代入の構文の問題を解決できます。\n" +"Python のローカル変数は、関数の中で (global が明示的に宣言されることなく) 値" +"が代入された変数 (と定義されています!) です。\n" +"なので、ある代入が意図するのが、ローカル変数へではなくインスタンス変数への代" +"入であると、インタプリタが判断する手段が必要です。\n" +"そしてそれは構文を見るだけで分かる方が (効率が) 良いのです。\n" +"C++ ではその区別を宣言時に行いますが、Python には宣言がなく、この目的だけのた" +"めに導入しなければならないのは残念です。\n" +"``self.var`` を明示すればうまく解決できます。\n" +"同様に、インスタンス変数を使うのにも ``self.var`` と書かなければならないの" +"で、メソッド内の修飾のない名前を参照する際に、そのインスタンスの属性を検索す" +"る必要がなくなります。\n" +"別の言い方をすれば、ローカル変数とインスタンス変数は二つの異なる名前空間に存" +"在し、Python にどちらの名前空間を使うかを伝えなくてはならないのです。" #: ../../faq/design.rst:154 msgid "Why can't I use an assignment in an expression?" @@ -335,6 +347,8 @@ msgid "" "while chunk := fp.read(200):\n" " print(chunk)" msgstr "" +"while chunk := fp.read(200):\n" +" print(chunk)" #: ../../faq/design.rst:164 msgid "See :pep:`572` for more information." @@ -360,7 +374,7 @@ msgid "" "problem. Compare the easy with which we rewrite a formula like x*(a+b) into " "x*a + x*b to the clumsiness of doing the same thing using a raw OO notation." msgstr "" -"(a) 幾つかの演算では、接頭辞は接尾辞よりも単純に読みやすいからです。接頭辞" +"(a) 幾つかの演算では、接頭辞は接尾辞よりも単純に読みやすいからです。接頭辞" "(そして接中辞!)による演算は数学において長い歴史があり、そこでは課題に対す" "る数学者の思考を視覚的に助けるような記法が好まれます。x*(a+b)をx*a + x*bに書" "き換える容易さと、それと同じことを純粋なオブジェクト指向の記法で行う煩わしさ" @@ -377,13 +391,14 @@ msgid "" "mapping has a get() or keys() method, or something that isn't a file has a " "write() method." msgstr "" -"(b) len(x)というコードを読んだ時、私はそれが何かの長さを問うているのだなと知" -"ることができます。これは私に2つの事を知らせています。一つは結果が整数であるこ" -"と、そして引数は何らかのコンテナであることです。対して、x.len()を目にした場" -"合、私はその時点でxが何らかのコンテナであり、それが標準のlen()を持っているク" -"ラスを継承しているか、インターフェースを実装していることを知っている必要があ" -"ります。mappingを実装していないクラスがget()やkeys()メソッドを持っていたり、" -"fileでない何かがwrite()メソッドを持っているような混乱は時折見かけます。" +"(b) len(x) というコードを読んだ時、私はそれが何かの長さを問うているのだなと" +"知ることができます。これは私に2つの事を知らせています。一つは結果が整数である" +"こと、そして引数は何らかのコンテナであることです。対して、 x.len() を目にした" +"場合、私はその時点でxが何らかのコンテナであり、それが標準のlen()を持っている" +"クラスを継承しているか、インターフェースを実装していることを知っている必要が" +"あります。 mapping を実装していないクラスが get() や keys() メソッドを持って" +"いたり、 file でない何かが write() メソッドを持っているような混乱は時折見かけ" +"ます。" #: ../../faq/design.rst:189 msgid "https://mail.python.org/pipermail/python-3000/2006-November/004643.html" @@ -410,7 +425,7 @@ msgstr "" #: ../../faq/design.rst:201 msgid "\", \".join(['1', '2', '4', '8', '16'])" -msgstr "" +msgstr "\", \".join(['1', '2', '4', '8', '16'])" #: ../../faq/design.rst:203 msgid "which gives the result::" @@ -418,7 +433,7 @@ msgstr "結果はこうなります::" #: ../../faq/design.rst:205 msgid "\"1, 2, 4, 8, 16\"" -msgstr "" +msgstr "\"1, 2, 4, 8, 16\"" #: ../../faq/design.rst:207 msgid "There are two common arguments against this usage." @@ -437,21 +452,22 @@ msgstr "" "値に過ぎないというのが答えです。文字列に束縛された名前にメソッドが許されるな" "ら、リテラルに使えないようにする論理的な理由はないでしょう。" -#: ../../faq/design.rst:215 msgid "" "The second objection is typically cast as: \"I am really telling a sequence " "to join its members together with a string constant\". Sadly, you aren't. " "For some reason there seems to be much less difficulty with having :meth:" "`~str.split` as a string method, since in that case it is easy to see that ::" msgstr "" -"二つ目の反対理由は、典型的には「私は実際、要素を文字列定数とともに結合させる" -"よう、シーケンスに命じているのだ」というものです。残念ながら、そうではないの" -"です。いくつかの理由から :meth:`~str.split` を文字列のメソッドとしておいた方" -"がはるかに簡単です。これを見ると分かりやすいでしょう ::" +"二つ目の反論は、よく「シーケンスに対して、文字列定数を使って要素を結合するよ" +"うに指示しているのだ」と表現されます。\n" +"残念ながら、そうではありません。\n" +"なぜか :meth:`~str.split` が文字列のメソッドであることには、はるかに抵抗が少" +"ないようです。\n" +"次の例では、何を指示しているかが分かりやすいからでしょう。 ::" #: ../../faq/design.rst:220 msgid "\"1, 2, 4, 8, 16\".split(\", \")" -msgstr "" +msgstr "\"1, 2, 4, 8, 16\".split(\", \")" #: ../../faq/design.rst:222 msgid "" @@ -497,6 +513,11 @@ msgid "" " mydict[key] = getvalue(key)\n" " value = mydict[key]" msgstr "" +"try:\n" +" value = mydict[key]\n" +"except KeyError:\n" +" mydict[key] = getvalue(key)\n" +" value = mydict[key]" #: ../../faq/design.rst:246 msgid "" @@ -513,6 +534,10 @@ msgid "" "else:\n" " value = mydict[key] = getvalue(key)" msgstr "" +"if key in mydict:\n" +" value = mydict[key]\n" +"else:\n" +" value = mydict[key] = getvalue(key)" #: ../../faq/design.rst:254 msgid "" @@ -559,6 +584,12 @@ msgid "" "func = functions[value]\n" "func()" msgstr "" +"functions = {'a': function_1,\n" +" 'b': function_2,\n" +" 'c': self.method_1}\n" +"\n" +"func = functions[value]\n" +"func()" #: ../../faq/design.rst:279 msgid "" @@ -579,6 +610,14 @@ msgid "" " method = getattr(self, method_name)\n" " method()" msgstr "" +"class MyVisitor:\n" +" def visit_a(self):\n" +" ...\n" +"\n" +" def dispatch(self, value):\n" +" method_name = 'visit_' + str(value)\n" +" method = getattr(self, method_name)\n" +" method()" #: ../../faq/design.rst:291 msgid "" @@ -661,9 +700,8 @@ msgstr "" "る必要が無いことだけです -- しかし、(ラムダ式が生み出すオブジェクトと厳密に同" "じ型の) 関数オブジェクトが代入される先はただのローカル変数です!" -#: ../../faq/design.rst:328 msgid "Can Python be compiled to machine code, C or some other language?" -msgstr "Python は C やその他の言語のように機械語にコンパイルできますか?" +msgstr "Python を機械語、C、または他の言語にコンパイルできますか?" #: ../../faq/design.rst:330 msgid "" @@ -672,6 +710,10 @@ msgid "" "an up-and-coming compiler of Python into C++ code, aiming to support the " "full Python language." msgstr "" +"`Cython `_ は、 オプションアノテーションを付けた 修正" +"バージョンの Python から C 拡張 にコンパイルします。 `Nuitka `_ は Python から C++ コードへの有望なコンパイラで、 フルセット" +"の Python 言語サポートを目指しています。" #: ../../faq/design.rst:337 msgid "How does Python manage memory?" @@ -687,12 +729,12 @@ msgid "" "provides functions to perform a garbage collection, obtain debugging " "statistics, and tune the collector's parameters." msgstr "" -"Python のメモリ管理の詳細は実装に依ります。Python の標準の C 実装 :term:" -"`CPython` は参照カウントを使って、アクセスできないオブジェクトを探します。ま" -"た別のメカニズムを使って参照サイクルを集めます。これはサイクル検出アルゴリズ" -"ムを定期的に実行し、アクセスできないサイクルを探し、巻き込まれたオブジェクト" -"を削除します。 :mod:`gc` モジュールの関数で、ガベージコレクションを実行し、デ" -"バッグ統計を取得し、コレクタのパラメタを変更できます。" +"Python のメモリ管理の詳細は実装に依ります。 Python の標準実装である :term:" +"`CPython` は、参照カウントを使ってアクセスできない(訳注:参照されえない)オ" +"ブジェクトを検出し、そして別の仕組みで参照サイクル(循環参照)を集めます。サ" +"イクル検出アルゴリズムを定期的に実行し、アクセスできないサイクルを見つけて一" +"連のオブジェクトを削除します。 :mod:`gc` モジュールは、ガベージコレクションの" +"実行、デバッグ統計の取得、コレクタのパラメータ調整を行う関数を提供します。" #: ../../faq/design.rst:347 msgid "" @@ -702,6 +744,10 @@ msgid "" "problems if your Python code depends on the behavior of the reference " "counting implementation." msgstr "" +"ただし、他の実装( `Jython `_ や `PyPy `_ など)では、本格的なガベージコレクタのような別の仕組みを用いているかも" +"しれません。 この違いは微妙な移植の問題を起こす可能性があります。もし あなた" +"の Python コードが参照カウント実装の振る舞いに依存している場合には。" #: ../../faq/design.rst:353 msgid "" @@ -717,6 +763,9 @@ msgid "" " f = open(file)\n" " c = f.read(1)" msgstr "" +"for file in very_long_list_of_files:\n" +" f = open(file)\n" +" c = f.read(1)" #: ../../faq/design.rst:360 msgid "" @@ -746,6 +795,9 @@ msgid "" " with open(file) as f:\n" " c = f.read(1)" msgstr "" +"for file in very_long_list_of_files:\n" +" with open(file) as f:\n" +" c = f.read(1)" #: ../../faq/design.rst:375 msgid "Why doesn't CPython use a more traditional garbage collection scheme?" @@ -787,7 +839,6 @@ msgid "Why isn't all memory freed when CPython exits?" msgstr "" "なぜ CPython の終了時にすべてのメモリが解放されるわけではないのですか?" -#: ../../faq/design.rst:394 msgid "" "Objects referenced from the global namespaces of Python modules are not " "always deallocated when Python exits. This may happen if there are circular " @@ -796,20 +847,20 @@ msgid "" "about these). Python is, however, aggressive about cleaning up memory on " "exit and does try to destroy every single object." msgstr "" -"Python モジュールのグローバルな名前空間から参照されるオブジェクトは、Python " -"の終了時にメモリの割り当てを解除されるとは限りません。これは、循環参照がある" -"ときに起こりえます。解放できない C ライブラリ (例えば、Purify のようなツール" -"などが当てはまります) によって割り当てられたいくらかのメモリも含まれます。し" -"かし、Python は終了時にメモリをクリーンアップすることには積極的で、全ての単一" -"のオブジェクトを破棄しようとします。" +"Python モジュールのグローバル名前空間から参照されているオブジェクトは、" +"Python の終了時に必ずしも解放されるとは限りません。\n" +"循環参照があると、このようなことが起こる場合があります。\n" +"また、C ライブラリが割り当てたメモリの一部には解放できないものもあります (例" +"えば Purify のようなツールはこれを報告します)。\n" +"それでも Python は終了時のメモリの後始末を積極的に行い、すべてのオブジェクト" +"を破棄しようとします。" -#: ../../faq/design.rst:401 msgid "" "If you want to force Python to delete certain things on deallocation use " "the :mod:`atexit` module to run a function that will force those deletions." msgstr "" -"再割り当て時に Python が特定のものを削除するように強制したいときは、 :mod:" -"`atexit` モジュールを使って削除を強制する関数を実行してください。" +"解放時に特定のものを Python に確実に削除させたい場合は、:mod:`atexit` モ" +"ジュールを使い、それらを削除する関数を実行してください。" #: ../../faq/design.rst:406 msgid "Why are there separate tuple and list data types?" @@ -862,16 +913,15 @@ msgstr "" msgid "How are lists implemented in CPython?" msgstr "CPythonでリストはどのように実装されているのですか?" -#: ../../faq/design.rst:432 msgid "" "CPython's lists are really variable-length arrays, not Lisp-style linked " "lists. The implementation uses a contiguous array of references to other " "objects, and keeps a pointer to this array and the array's length in a list " "head structure." msgstr "" -"CPythonのリストは実際に変数分の長さの配列で、Lispスタイルの連結リストではあり" -"ません。この実装は他のオブジェクトへの参照の連続した配列を使用していて、この" -"配列へのポインタおよび配列長はリストの先頭の構造体に保存されています。" +"CPython のリストは可変長配列で、Lispスタイルの連結リストではありません。\n" +"この実装は他のオブジェクトへの参照の連続した配列を使用していて、この配列への" +"ポインタおよび配列長はリストの先頭の構造体に保存されています。" #: ../../faq/design.rst:436 msgid "" @@ -933,7 +983,6 @@ msgstr "" msgid "Why must dictionary keys be immutable?" msgstr "なぜ辞書のキーはイミュータブルでなくてはならないのですか?" -#: ../../faq/design.rst:465 msgid "" "The hash table implementation of dictionaries uses a hash value calculated " "from the key value to find the key. If the key were a mutable object, its " @@ -946,13 +995,15 @@ msgid "" "would be different." msgstr "" "辞書のハッシュテーブルの実装は、キーを見つけるために、キー値から計算された" -"ハッシュ値を使います。もしキーがミュータブルなオブジェクトだったら、その値は" -"変えられ、それによりハッシュ値も変わってしまいます。しかし、キーオブジェクト" -"を変更したのが何者であれ、値が辞書のキーとして使われていたと気付けないので、" -"辞書の中のエントリを適切な場所に動かせません。そして、同じオブジェクトを探そ" -"うとしても、ハッシュ値が違うため見つかりません。古い値を探そうとしても、その" -"ハッシュバイナリから見つかるオブジェクトの値は異なるでしょうから、これも見つ" -"かりません。" +"ハッシュ値を使います。\n" +"もしキーがミュータブルなオブジェクトだったら、その値は変えられ、それにより" +"ハッシュ値も変わってしまいます。\n" +"しかし、キーオブジェクトを変更したのが何者であれ、値が辞書のキーとして使われ" +"ていたと気付けないので、辞書の中のエントリを適切な場所に動かせません。\n" +"そして、同じオブジェクトを探そうとしても、ハッシュ値が違うため見つかりませ" +"ん。\n" +"古い値を探そうとしても、そのハッシュ値に対応する格納場所で見つかるオブジェク" +"トの値は異なるでしょうから、これも見つかりません。" #: ../../faq/design.rst:474 msgid "" @@ -969,19 +1020,22 @@ msgstr "" msgid "Some unacceptable solutions that have been proposed:" msgstr "いくつかの受け入れられなかった提案:" -#: ../../faq/design.rst:480 msgid "" "Hash lists by their address (object ID). This doesn't work because if you " "construct a new list with the same value it won't be found; e.g.::" msgstr "" -"アドレス (オブジェクト ID) のハッシュリスト。これは、同じ値の新しいリストを" -"作っても見つからないので駄目です。例えば::" +"リストのアドレス (オブジェクト ID) を使ってハッシュ値を計算する。\n" +"同じ値を持つ新しいリストを作っても見つからないため、この方法はうまくいきませ" +"ん。\n" +"例えば次のコードです。 ::" #: ../../faq/design.rst:483 msgid "" "mydict = {[1, 2]: '12'}\n" "print(mydict[[1, 2]])" msgstr "" +"mydict = {[1, 2]: '12'}\n" +"print(mydict[[1, 2]])" #: ../../faq/design.rst:486 msgid "" @@ -994,15 +1048,16 @@ msgstr "" "外を送出するでしょう。言い換えれば、辞書のキーは ``==`` を使って比較されるべ" "きであり、 :keyword:`is` ではないということです。" -#: ../../faq/design.rst:490 msgid "" "Make a copy when using a list as a key. This doesn't work because the list, " "being a mutable object, could contain a reference to itself, and then the " "copying code would run into an infinite loop." msgstr "" -"リストをキーとして使うときにコピーを作る。リストはミュータブルなので、自分自" -"身への参照を含むことができ、コードをコピーするときに無限ループにハマる可能性" -"があるので、これは駄目です。" +"リストをキーとして使う際にコピーを作る。\n" +"リストはミュータブルなオブジェクトなので、自分自身への参照を含む場合がありま" +"す。\n" +"その場合、コピーを行うコードが無限ループに陥るため、この方法はうまくいきませ" +"ん。" #: ../../faq/design.rst:494 msgid "" @@ -1066,6 +1121,22 @@ msgid "" " result = (result % 7777777) + i * 333\n" " return result" msgstr "" +"class ListWrapper:\n" +" def __init__(self, the_list):\n" +" self.the_list = the_list\n" +"\n" +" def __eq__(self, other):\n" +" return self.the_list == other.the_list\n" +"\n" +" def __hash__(self):\n" +" l = self.the_list\n" +" result = 98767 - len(l)*555\n" +" for i, el in enumerate(l):\n" +" try:\n" +" result = result + (hash(el) % 9999999) * 1001 + i\n" +" except Exception:\n" +" result = (result % 7777777) + i * 333\n" +" return result" #: ../../faq/design.rst:530 msgid "" @@ -1137,22 +1208,23 @@ msgid "" "for key in sorted(mydict):\n" " ... # do whatever with mydict[key]..." msgstr "" +"for key in sorted(mydict):\n" +" ... # mydict[key] を使って何でもできる ..." -#: ../../faq/design.rst:564 msgid "How do you specify and enforce an interface spec in Python?" -msgstr "Python ではどのようにインターフェース仕様を特定し適用するのですか?" +msgstr "" +"Python ではインターフェース仕様をどのように定義し、遵守させるのですか?" -#: ../../faq/design.rst:566 msgid "" "An interface specification for a module as provided by languages such as C++ " "and Java describes the prototypes for the methods and functions of the " "module. Many feel that compile-time enforcement of interface specifications " "helps in the construction of large programs." msgstr "" -"C++ や Java のような言語が提供するような、モジュールに対するインターフェース" -"仕様の特定は、モジュールのメソッドや関数の原型を表現します。インターフェース" -"の特定がコンパイル時に適用されることが、大きなプログラムの構成に役立つと、広" -"く感じられています。" +"C++ や Java などの言語が提供するモジュールのインターフェース仕様は、そのモ" +"ジュールのメソッドや関数のプロトタイプを記述します。\n" +"コンパイル時にインターフェース仕様への適合を強制することが、大規模なプログラ" +"ムの構築に役立つと考える人は多くいます。" #: ../../faq/design.rst:571 msgid "" @@ -1275,6 +1347,15 @@ msgid "" " pass\n" "..." msgstr "" +"class label(Exception): pass # declare a label\n" +"\n" +"try:\n" +" ...\n" +" if condition: raise label() # goto label\n" +" ...\n" +"except label: # goto 移動先\n" +" pass\n" +"..." #: ../../faq/design.rst:630 msgid "" @@ -1325,7 +1406,7 @@ msgstr "" #: ../../faq/design.rst:651 msgid "f = open(\"/mydir/file.txt\") # works fine!" -msgstr "" +msgstr "f = open(\"/mydir/file.txt\") # 正常に動く!" #: ../../faq/design.rst:653 msgid "" @@ -1340,6 +1421,9 @@ msgid "" "dir = r\"\\this\\is\\my\\dos\\dir\\ \"[:-1]\n" "dir = \"\\\\this\\\\is\\\\my\\\\dos\\\\dir\\\\\"" msgstr "" +"dir = r\"\\this\\is\\my\\dos\\dir\" \"\\\\\"\n" +"dir = r\"\\this\\is\\my\\dos\\dir\\ \"[:-1]\n" +"dir = \"\\\\this\\\\is\\\\my\\\\dos\\\\dir\\\\\"" #: ../../faq/design.rst:661 msgid "Why doesn't Python have a \"with\" statement for attribute assignments?" @@ -1361,21 +1445,24 @@ msgid "" " a = 1 # equivalent to obj.a = 1\n" " total = total + 1 # obj.total = obj.total + 1" msgstr "" +"with obj:\n" +" a = 1 # これに相当: obj.a = 1\n" +" total = total + 1 # obj.total = obj.total + 1" #: ../../faq/design.rst:671 msgid "In Python, such a construct would be ambiguous." msgstr "Python では、このような構造は曖昧になるでしょう。" -#: ../../faq/design.rst:673 msgid "" "Other languages, such as Object Pascal, Delphi, and C++, use static types, " "so it's possible to know, in an unambiguous way, what member is being " "assigned to. This is the main point of static typing -- the compiler " "*always* knows the scope of every variable at compile time." msgstr "" -"Object Pascal、Delphi、C++のような他の言語では、静的な型を使うので、曖昧な方" -"法でも、どのメンバに代入されているのか分かります。これが静的型付けの要点です " -"-- コンパイラは *いつでも* コンパイル時にすべての変数のスコープを知るのです。" +"Object Pascal、Delphi、C++のような他の言語では、静的な型を使うので、どのメン" +"バに代入されているのかを曖昧さなく判断できます。\n" +"これが静的型付けの要点です -- コンパイラは *いつでも* コンパイル時にすべての" +"変数のスコープを知るのです。" #: ../../faq/design.rst:678 msgid "" @@ -1400,6 +1487,9 @@ msgid "" " with a:\n" " print(x)" msgstr "" +"def foo(a):\n" +" with a:\n" +" print(x)" #: ../../faq/design.rst:690 msgid "" @@ -1431,6 +1521,9 @@ msgid "" "function(args).mydict[index][index].b = 42\n" "function(args).mydict[index][index].c = 63" msgstr "" +"function(args).mydict[index][index].a = 21\n" +"function(args).mydict[index][index].b = 42\n" +"function(args).mydict[index][index].c = 63" #: ../../faq/design.rst:703 msgid "write this::" @@ -1443,6 +1536,10 @@ msgid "" "ref.b = 42\n" "ref.c = 63" msgstr "" +"ref = function(args).mydict[index][index]\n" +"ref.a = 21\n" +"ref.b = 42\n" +"ref.c = 63" #: ../../faq/design.rst:710 msgid "" @@ -1460,7 +1557,7 @@ msgid "" "(see https://mail.python.org/pipermail/python-ideas/2016-May/040070.html)." msgstr "" "似た提案として、「先頭のドット」を使うなどして さらにコード量を減らす構文は、" -"明白さを優先をして却下されました (https://mail.python.org/pipermail/python-" +"明白さを優先して却下されました (https://mail.python.org/pipermail/python-" "ideas/2016-May/040070.html 参照)。" #: ../../faq/design.rst:720 @@ -1497,6 +1594,8 @@ msgid "" "if a == b\n" " print(a)" msgstr "" +"if a == b\n" +" print(a)" #: ../../faq/design.rst:738 msgid "versus ::" @@ -1507,15 +1606,18 @@ msgid "" "if a == b:\n" " print(a)" msgstr "" +"if a == b:\n" +" print(a)" -#: ../../faq/design.rst:743 msgid "" "Notice how the second one is slightly easier to read. Notice further how a " "colon sets off the example in this FAQ answer; it's a standard usage in " "English." msgstr "" -"を考えれば、後者のほうが少し読みやすいでしょう。さらに言えば、この FAQ の解答" -"例は次のようになるでしょう。これは、英語の標準的な用法です。" +"後者のほうが少し読みやすいことに注目してください。\n" +"この FAQ の回答でも、原文ではコロンを使って例を区切っていることにも注目してく" +"ださい。\n" +"これは英語では標準的な用法です。" #: ../../faq/design.rst:746 msgid "" @@ -1549,6 +1651,12 @@ msgid "" " \"B\": [6, 7], # last trailing comma is optional but good style\n" "}" msgstr "" +"[1, 2, 3,]\n" +"('a', 'b', 'c',)\n" +"d = {\n" +" \"A\": [1, 5],\n" +" \"B\": [6, 7], # 最後のカンマはオプションだが良いスタイル\n" +"}" #: ../../faq/design.rst:765 msgid "There are several reasons to allow this." @@ -1581,6 +1689,12 @@ msgid "" " \"fum\"\n" "]" msgstr "" +"x = [\n" +" \"fee\",\n" +" \"fie\"\n" +" \"foo\",\n" +" \"fum\"\n" +"]" #: ../../faq/design.rst:782 msgid "" diff --git a/faq/extending.po b/faq/extending.po index 83e180129..aa3b4745f 100644 --- a/faq/extending.po +++ b/faq/extending.po @@ -21,10 +21,10 @@ msgstr "" "Last-Translator: TENMYO Masakazu, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../faq/extending.rst:3 @@ -56,17 +56,18 @@ msgstr "ほとんどの中級から上級の Python 本もこの話題を扱っ msgid "Can I create my own functions in C++?" msgstr "C++ で独自の関数を作ることはできますか?" -#: ../../faq/extending.rst:28 msgid "" "Yes, using the C compatibility features found in C++. Place ``extern " "\"C\" { ... }`` around the Python include files and put ``extern \"C\"`` " "before each function that is going to be called by the Python interpreter. " "Global or static C++ objects with constructors are probably not a good idea." msgstr "" -"はい。C++ 内にある C 互換機能を使ってできます。 ``extern \"C\" { ... }`` で " -"Python のインクルードファイルを囲み、 ``extern \"C\"`` を Python インタプリタ" -"から呼ぶ各関数の前に置いてください。グローバルや静的な C++ オブジェクトの構造" -"体を持つものは良くないでしょう。" +"はい。\n" +"C++ 内にある C 互換機能を使ってできます。\n" +"``extern \"C\" { ... }`` で Python のインクルードファイルを囲み、 ``extern " +"\"C\"`` を Python インタプリタから呼ぶ各関数の前に置いてください。\n" +"コンストラクタを持つグローバルな C++ オブジェクトや静的な C++ オブジェクトを" +"使うのは、おそらく望ましくありません。" #: ../../faq/extending.rst:37 msgid "Writing C is hard; are there any alternatives?" @@ -219,22 +220,23 @@ msgstr "" "す。パラメタは、オブジェクト、呼び出すメソッドの名前、 :c:func:" "`Py_BuildValue` で使われるようなフォーマット文字列、そして引数です::" -#: ../../faq/extending.rst:117 msgid "" "PyObject *\n" "PyObject_CallMethod(PyObject *object, const char *method_name,\n" " const char *arg_format, ...);" msgstr "" +"PyObject *\n" +"PyObject_CallMethod(PyObject *object, const char *method_name,\n" +" const char *arg_format, ...);" -#: ../../faq/extending.rst:121 msgid "" "This works for any object that has methods -- whether built-in or user-" "defined. You are responsible for eventually :c:func:`Py_DECREF`\\ 'ing the " "return value." msgstr "" -"これはメソッドを持ついかなるオブジェクトにも有効で、組み込みかユーザ定義かは" -"関係ありません。返り値に対して :c:func:`Py_DECREF` する必要があることもありま" -"す。" +"これは、組み込みかユーザー定義かを問わず、メソッドを持つ任意のオブジェクトに" +"使えます。\n" +"返り値を使い終わったら、呼び出し側で :c:func:`Py_DECREF` する責任があります。" #: ../../faq/extending.rst:124 msgid "" @@ -244,7 +246,6 @@ msgstr "" "例えば、あるファイルオブジェクトの \"seek\" メソッドを 10, 0 を引数として呼ぶ" "とき (ファイルオブジェクトのポインタを \"f\" とします)::" -#: ../../faq/extending.rst:127 msgid "" "res = PyObject_CallMethod(f, \"seek\", \"(ii)\", 10, 0);\n" "if (res == NULL) {\n" @@ -254,8 +255,14 @@ msgid "" " Py_DECREF(res);\n" "}" msgstr "" +"res = PyObject_CallMethod(f, \"seek\", \"(ii)\", 10, 0);\n" +"if (res == NULL) {\n" +" ... 例外が発生した場合の処理 ...\n" +"}\n" +"else {\n" +" Py_DECREF(res);\n" +"}" -#: ../../faq/extending.rst:135 msgid "" "Note that since :c:func:`PyObject_CallObject` *always* wants a tuple for the " "argument list, to call a function without arguments, pass \"()\" for the " @@ -263,8 +270,9 @@ msgid "" "parentheses, e.g. \"(i)\"." msgstr "" "なお、 :c:func:`PyObject_CallObject` の引数リストには *常に* タプルが必要で" -"す。関数を引数なしで呼び出すには、フォーマットに \"()\" を渡し、関数を一つの" -"引数で呼び出すには、関数を括弧でくくって例えば \"(i)\" としてください。" +"す。\n" +"関数を引数なしで呼び出すには、フォーマットに \"()\" を渡し、関数を一つの引数" +"で呼び出すには、引数の書式を括弧で囲んで例えば \"(i)\" としてください。" #: ../../faq/extending.rst:142 msgid "" @@ -290,7 +298,6 @@ msgstr "" msgid "The easiest way to do this is to use the :class:`io.StringIO` class:" msgstr "最も簡単な方法は、 :class:`io.StringIO` クラスを使うことです:" -#: ../../faq/extending.rst:151 msgid "" ">>> import io, sys\n" ">>> sys.stdout = io.StringIO()\n" @@ -300,12 +307,18 @@ msgid "" "foo\n" "hello world!" msgstr "" +">>> import io, sys\n" +">>> sys.stdout = io.StringIO()\n" +">>> print('foo')\n" +">>> print('hello world!')\n" +">>> sys.stderr.write(sys.stdout.getvalue())\n" +"foo\n" +"hello world!" #: ../../faq/extending.rst:161 msgid "A custom object to do the same would look like this:" msgstr "これと同じことをするカスタムオブジェクトは次のようになるでしょう:" -#: ../../faq/extending.rst:163 msgid "" ">>> import io, sys\n" ">>> class StdoutCatcher(io.TextIOBase):\n" @@ -322,6 +335,20 @@ msgid "" "foo\n" "hello world!" msgstr "" +">>> import io, sys\n" +">>> class StdoutCatcher(io.TextIOBase):\n" +"... def __init__(self):\n" +"... self.data = []\n" +"... def write(self, stuff):\n" +"... self.data.append(stuff)\n" +"...\n" +">>> import sys\n" +">>> sys.stdout = StdoutCatcher()\n" +">>> print('foo')\n" +">>> print('hello world!')\n" +">>> sys.stderr.write(''.join(sys.stdout.data))\n" +"foo\n" +"hello world!" #: ../../faq/extending.rst:182 msgid "How do I access a module written in Python from C?" @@ -331,9 +358,8 @@ msgstr "C から Python で書かれたモジュールにアクセスするに msgid "You can get a pointer to the module object as follows::" msgstr "以下のようにモジュールオブジェクトへのポインタを得られます::" -#: ../../faq/extending.rst:186 msgid "module = PyImport_ImportModule(\"\");" -msgstr "" +msgstr "module = PyImport_ImportModule(\"\");" #: ../../faq/extending.rst:188 msgid "" @@ -357,9 +383,8 @@ msgstr "" "これで、モジュールの属性 (つまり、モジュールで定義された任意の名前) に以下の" "ようにアクセスできるようになります::" -#: ../../faq/extending.rst:197 msgid "attr = PyObject_GetAttrString(module, \"\");" -msgstr "" +msgstr "attr = PyObject_GetAttrString(module, \"\");" #: ../../faq/extending.rst:199 msgid "" @@ -413,13 +438,12 @@ msgstr "" msgid "How do I debug an extension?" msgstr "拡張をデバッグするにはどうしますか?" -#: ../../faq/extending.rst:226 msgid "" "When using GDB with dynamically loaded extensions, you can't set a " "breakpoint in your extension until your extension is loaded." msgstr "" "動的にロードされた拡張に GDB を使うとき、拡張がロードされるまでブレークポイン" -"トを設定してはいけません。" +"トを設定できません。" #: ../../faq/extending.rst:229 msgid "In your ``.gdbinit`` file (or interactively), add the command:" @@ -451,19 +475,20 @@ msgstr "" "Linux システムで Python モジュールをコンパイルしたいのですが、見つからない" "ファイルがあります。なぜですか?" -#: ../../faq/extending.rst:249 msgid "" "Most packaged versions of Python omit some files required for compiling " "Python extensions." msgstr "" +"パッケージとして配布されている Python の多くでは、Python 拡張のコンパイルに必" +"要なファイルの一部が省かれています。" -#: ../../faq/extending.rst:252 msgid "For Red Hat, install the python3-devel RPM to get the necessary files." msgstr "" +"Red Hat では、必要なファイルを入手するために python3-devel RPM をインストール" +"してください。" -#: ../../faq/extending.rst:254 msgid "For Debian, run ``apt-get install python3-dev``." -msgstr "" +msgstr "Debian では ``apt-get install python3-dev`` を実行してください。" #: ../../faq/extending.rst:257 msgid "How do I tell \"incomplete input\" from \"invalid input\"?" diff --git a/faq/general.po b/faq/general.po index b0b75f39c..a06a3c6de 100644 --- a/faq/general.po +++ b/faq/general.po @@ -21,10 +21,10 @@ msgstr "" "Last-Translator: TENMYO Masakazu, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../faq/general.rst:5 @@ -109,7 +109,6 @@ msgstr "" msgid "Are there copyright restrictions on the use of Python?" msgstr "Python を使うのに著作権の制限はありますか?" -#: ../../faq/general.rst:50 msgid "" "You can do anything you want with the source, as long as you leave the " "copyrights in and display those copyrights in any documentation about Python " @@ -119,12 +118,13 @@ msgid "" "some form. We would still like to know about all commercial use of Python, " "of course." msgstr "" -"あなたが作成する Python に関するドキュメントのすべてに著作権を残し、それらの" -"著作権を表示する限り、ソースコードをどのように扱ってもかまいません。この著作" -"権規則を尊重する限り、商用に Python を利用しても、ソースあるいはバイナリ形式" -"で(変更の有無にかかわらず) Python のコピーを販売しても、Python が何らかの形で" -"組み込まれた製品を販売してかまいません。もちろん、Python のあらゆる商業用途に" -"ついても同様です。" +"ソースに著作権表示を残し、作成する Python 関連のドキュメントにもその表示を載" +"せる限り、ソースを自由に扱えます。\n" +"著作権に関する規則を守れば、Python を商用利用したり、ソースやバイナリのコピー" +"を変更の有無にかかわらず販売したり、Python を何らかの形で組み込んだ製品を販売" +"したりしても構いません。\n" +"もちろん、Python がどのように商用利用されているかは、ぜひ知らせていただきたい" +"と思っています。" #: ../../faq/general.rst:57 msgid "" @@ -201,18 +201,17 @@ msgstr "" "理の方法が必要でした。Amoeba のエラー処理の経験から、プログラミング言語の機能" "としての例外の重要さを強く意識するようになりました。" -#: ../../faq/general.rst:93 msgid "" "It occurred to me that a scripting language with a syntax like ABC but with " "access to the Amoeba system calls would fill the need. I realized that it " "would be foolish to write an Amoeba-specific language, so I decided that I " "needed a language that was generally extensible." msgstr "" -"ABC のような構文と Amoeba のようなシステムコールを合わせ持ったスクリプト言語" -"が必要だろうと思いつきました。Amoeba 専用の言語を書くのは愚かであるだろうと気" -"づき、一般に拡張できるような言語を求めることに決めました。" +"ABC のような構文と Amoeba のシステムコールへのアクセスを合わせ持ったスクリプ" +"ト言語が必要だろうと思いつきました。\n" +"Amoeba 専用の言語を書くのは愚かであるだろうと気づき、一般に拡張できるような言" +"語を求めることに決めました。" -#: ../../faq/general.rst:98 msgid "" "During the 1989 Christmas holidays, I had a lot of time on my hand, so I " "decided to give it a try. During the next year, while still mostly working " @@ -220,18 +219,18 @@ msgid "" "success, and the feedback from colleagues made me add many early " "improvements." msgstr "" -"1989 年のクリスマス休暇の間、自由な時間がたくさんできたので、その言語を実際に" -"作ってみることにしました。翌年の間、勤務時間以外はほとんどその開発に費やし、" -"Python は Amoeba プロジェクトのなかで成果を重ね、同僚からのフィードバックは私" -"の開発を大いに加速させてくれました。" +"1989 年のクリスマス休暇には時間がたくさんあったので、試しに作ってみることにし" +"ました。\n" +"翌年も主に自分の時間を使って開発を続ける一方、Python は Amoeba プロジェクトで" +"使われ、ますます成果を上げていました。\n" +"同僚からのフィードバックを受けて、初期の改良を数多く加えました。" -#: ../../faq/general.rst:104 msgid "" "In February 1991, after just over a year of development, I decided to post " "to USENET. The rest is in the ``Misc/HISTORY`` file." msgstr "" -"1991 年 2 月、1 年間と少しの開発を経て、USENET に投稿することにしました。それ" -"は ``Misc/HISTORY`` ファイルに残っています。" +"1991 年 2 月、1 年間と少しの開発を経て、USENET に投稿することにしました。\n" +"その後の歴史は ``Misc/HISTORY`` ファイルに記されています。" #: ../../faq/general.rst:109 msgid "What is Python good for?" @@ -460,7 +459,6 @@ msgstr "" msgid "Is there a newsgroup or mailing list devoted to Python?" msgstr "Python のためのニュースグループやメーリングリストはありますか?" -#: ../../faq/general.rst:210 msgid "" "There is a newsgroup, :newsgroup:`comp.lang.python`, and a mailing list, " "`python-list `_. The " @@ -470,13 +468,13 @@ msgid "" "Usenet readers are often more able to cope with this volume." msgstr "" "ニュースグループ :newsgroup:`comp.lang.python` やメーリングリスト `python-" -"list `_ があります。" +"list `_ があります。\n" "ニュースグループとメーリングリストは互いに接続されていて、ニュースを購読すれ" -"ばメーリングリストに参加する必要はありません。 :newsgroup:`comp.lang.python` " -"は一日に数百のポスティングを受ける高いトラフィックで、USENET 読者は多くの場" -"合、このボリュームに応えることができます。" +"ばメーリングリストに参加する必要はありません。\n" +":newsgroup:`comp.lang.python` は一日に数百のポスティングを受ける高いトラ" +"フィックで、Usenet 閲覧ソフトのほうが、この量の投稿を扱いやすいことがよくあり" +"ます。" -#: ../../faq/general.rst:217 msgid "" "Announcements of new software releases and events can be found in comp.lang." "python.announce, a low-traffic moderated list that receives about five " @@ -484,9 +482,11 @@ msgid "" "`_." msgstr "" "新しいソフトウェアリリースとイベントの告知は comp.lang.python.announce で見つ" -"けられます。これは一日に 5 ポスティング程度を受ける低トラフィックの手頃なメー" -"リングリストです。`the python-announce mailing list `_ から利用可能です。" +"けられます。\n" +"これは一日に 5 ポスティング程度を受ける投稿が承認制になっている低トラフィック" +"のリストです。\n" +"`the python-announce mailing list `_ から利用可能です。" #: ../../faq/general.rst:222 msgid "" @@ -570,13 +570,13 @@ msgstr "" msgid "Are there any books on Python?" msgstr "Python の本はありますか?" -#: ../../faq/general.rst:264 msgid "" "Yes, there are many, and more are being published. See the python.org wiki " "at https://wiki.python.org/moin/PythonBooks for a list." msgstr "" -"はい、たくさんあり、そのほとんどは現在も出版されています。リストは python." -"org wiki https://wiki.python.org/moin/PythonBooks にあります。" +"はい、たくさんあり、さらに新しい本が出版されています。\n" +"リストは python.org wiki https://wiki.python.org/moin/PythonBooks にありま" +"す。" #: ../../faq/general.rst:267 msgid "" @@ -666,6 +666,10 @@ msgid "" "and supported by most widely used libraries. Python 2.x :pep:`is not " "maintained anymore <373>`." msgstr "" +"最新の安定版は `Python download page `_ で" +"見つけられます。 Python 3.x が推奨されるバージョンで、最も広く利用されている" +"ライブラリでサポートされています。 Python 2.x :pep:`は もはや保守されていませ" +"ん<373>` 。" #: ../../faq/general.rst:317 msgid "How many people are using Python?" @@ -758,7 +762,6 @@ msgstr "" msgid "Is it reasonable to propose incompatible changes to Python?" msgstr "Python の互換性を無くすような提案をしてもいいのですか?" -#: ../../faq/general.rst:362 msgid "" "In general, no. There are already millions of lines of Python code around " "the world, so any change in the language that invalidates more than a very " @@ -767,22 +770,23 @@ msgid "" "documentation; many books have been written about Python, and we don't want " "to invalidate them all at a single stroke." msgstr "" -"一般的には、してはいけません。世界中にすでに何百万行もの Python コードがある" -"ので、既存のプログラムのどんなに僅かな部分でも無効にしてしまうような言語仕様" -"の変更も認められてはなりません。コンバートするプログラムが出来てさえ、すべて" -"のドキュメントをアップデートしなければならないという問題があります。 Python " -"に関する多くの本が出版されているので、それらを一発で不適切にするようなことは" -"したくないです。" +"一般的には、してはいけません。\n" +"世界中にすでに何百万行もの Python コードがあるので、既存プログラムのごく僅か" +"な割合を超えて動かなくしてしまう言語の変更は、好ましくないと考えられます。\n" +"コンバートするプログラムが出来てさえ、すべてのドキュメントをアップデートしな" +"ければならないという問題があります。\n" +"Python に関する多くの本が出版されているので、それらを一発で不適切にするような" +"ことはしたくないです。" -#: ../../faq/general.rst:369 msgid "" "Providing a gradual upgrade path is necessary if a feature has to be " "changed. :pep:`5` describes the procedure followed for introducing backward-" "incompatible changes while minimizing disruption for users." msgstr "" "仕様を変えなければならないのなら、緩やかなアップグレード計画が組まれなくては" -"なりません。 :pep:`5` で、ユーザーの受ける分裂を最小限にしながら後方互換性の" -"ない変更を行うために従うべき手順について説明しています。" +"なりません。\n" +":pep:`5` で、ユーザーに生じる混乱を最小限にしながら後方互換性のない変更を行う" +"ために従うべき手順について説明しています。" #: ../../faq/general.rst:375 msgid "Is Python a good language for beginning programmers?" @@ -831,7 +835,6 @@ msgstr "" "見れば静的型付け言語を学ぶことは重要ですが、それが最初のプログラミングの授業" "で学ぶべき最高の話題とは限りません。" -#: ../../faq/general.rst:397 msgid "" "Many other aspects of Python make it a good first language. Like Java, " "Python has a large standard library so that students can be assigned " @@ -843,16 +846,17 @@ msgid "" "students about code reuse. Third-party modules such as PyGame are also " "helpful in extending the students' reach." msgstr "" -"Python の良いところは他にもたくさんあります。Python には、Java のように大きな" -"標準ライブラリがあり、生徒が何かを *する* 段階で非常に早くプログラミングプロ" -"ジェクトに参加できるようになります。宿題は標準の四則演算機や平均を求めるプロ" -"グラムに限定されません。標準ライブラリを使用することで、生徒はプログラミング" -"の原理を学びながら現実的なアプリケーションに取り組む満足感を得ることができま" -"す。また、標準ライブラリの使用からコードの再利用を学ぶことができます。 " -"PyGame などのサードパーティモジュールもまた手が届く範囲を広げるのに役立ちま" -"す。" +"ほかにも、Python を最初に学ぶ言語として適したものにする特徴は数多くありま" +"す。\n" +"Java と同様に大規模な標準ライブラリを備えているため、授業の早い段階から、実際" +"に何かを *行う* プログラムを課題にできます。\n" +"課題は定番の四則演算電卓や小切手帳の残高確認プログラムに限られません。\n" +"標準ライブラリを使えば、生徒はプログラミングの基礎を学びながら、実用的なアプ" +"リケーションに取り組む満足感を得られます。\n" +"標準ライブラリの利用を通じて、コードの再利用も学べます。\n" +"PyGame などのサードパーティモジュールも、生徒が取り組める範囲を広げるのに役立" +"ちます。" -#: ../../faq/general.rst:406 msgid "" "Python's interactive interpreter enables students to test language features " "while they're programming. They can keep a window with the interpreter " @@ -860,9 +864,10 @@ msgid "" "can't remember the methods for a list, they can do something like this::" msgstr "" "Python のインタラクティブインタプリタによって、プログラミングをしながら、言語" -"機能を確認することができます。別のウィンドウでプログラムのソースに入っている" -"間、ウィンドウでインタプリタを起動させたままにしておくことができます。リスト" -"のメソッドを思い出せないときは、例えばこのようにできます::" +"機能を確認することができます。\n" +"一つのウィンドウでインタープリタを動かしたまま、別のウィンドウでプログラムの" +"ソースを入力できます。\n" +"リストのメソッドを思い出せないときは、例えばこのようにできます::" #: ../../faq/general.rst:411 msgid "" @@ -891,6 +896,30 @@ msgid "" ">>> L\n" "[1]" msgstr "" +">>> L = []\n" +">>> dir(L)\n" +"['__add__', '__class__', '__contains__', '__delattr__', '__delitem__',\n" +"'__dir__', '__doc__', '__eq__', '__format__', '__ge__',\n" +"'__getattribute__', '__getitem__', '__gt__', '__hash__', '__iadd__',\n" +"'__imul__', '__init__', '__iter__', '__le__', '__len__', '__lt__',\n" +"'__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__',\n" +"'__repr__', '__reversed__', '__rmul__', '__setattr__', '__setitem__',\n" +"'__sizeof__', '__str__', '__subclasshook__', 'append', 'clear',\n" +"'copy', 'count', 'extend', 'index', 'insert', 'pop', 'remove',\n" +"'reverse', 'sort']\n" +">>> [d for d in dir(L) if '__' not in d]\n" +"['append', 'clear', 'copy', 'count', 'extend', 'index', 'insert', 'pop', " +"'remove', 'reverse', 'sort']\n" +"\n" +">>> help(L.append)\n" +"Help on built-in function append:\n" +"\n" +"append(...)\n" +" L.append(object) -> None -- append object to end\n" +"\n" +">>> L.append(1)\n" +">>> L\n" +"[1]" #: ../../faq/general.rst:435 msgid "" diff --git a/faq/gui.po b/faq/gui.po index 059677937..db25a89d5 100644 --- a/faq/gui.po +++ b/faq/gui.po @@ -19,10 +19,10 @@ msgstr "" "Last-Translator: Arihiro TAKASE, 2023\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../faq/gui.rst:5 @@ -100,15 +100,15 @@ msgstr "" "envvar:`!TCL_LIBRARY` と :envvar:`!TK_LIBRARY` でランタイムに指定することで" "す。" -#: ../../faq/gui.rst:49 msgid "" "Various third-party freeze libraries such as py2exe and cx_Freeze have " "handling for Tkinter applications built-in." msgstr "" +"py2exe や cx_Freeze など、さまざまなサードパーティの凍結ライブラリには、" +"Tkinter アプリケーションを扱う機能が組み込まれています。" -#: ../../faq/gui.rst:54 msgid "Can I have Tk events handled while waiting for I/O?" -msgstr "I/O を待つ間に扱われる Tk イベントを作れますか?" +msgstr "I/O を待っている間も Tk イベントを処理できますか?" #: ../../faq/gui.rst:56 msgid "" diff --git a/faq/index.po b/faq/index.po index 80f850128..c1f9e672e 100644 --- a/faq/index.po +++ b/faq/index.po @@ -16,10 +16,10 @@ msgstr "" "Last-Translator: tomo, 2021\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../faq/index.rst:5 diff --git a/faq/installed.po b/faq/installed.po index 09996c480..ac1560aa8 100644 --- a/faq/installed.po +++ b/faq/installed.po @@ -17,10 +17,10 @@ msgstr "" "Last-Translator: 菊池 健志, 2023\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../faq/installed.rst:3 @@ -115,14 +115,13 @@ msgstr "Python を削除してもいいですか?" msgid "That depends on where Python came from." msgstr "Python をどこから手に入れたかによります。" -#: ../../faq/installed.rst:42 msgid "" "If someone installed it deliberately, you can remove it without hurting " "anything. On Windows, use the Add/Remove Programs icon in the Control Panel." msgstr "" -"誰かが Python を意図してダウンロードしたのであれば、何の問題もなく削除するこ" -"とができます。Windows では、コントロールパネルのプログラムの追加と削除を使っ" -"てください。" +"誰かが Python を意図してインストールしたのであれば、何の問題もなく削除するこ" +"とができます。\n" +"Windows では、コントロールパネルのプログラムの追加と削除を使ってください。" #: ../../faq/installed.rst:45 msgid "" diff --git a/faq/library.po b/faq/library.po index e5129624d..a55e06a87 100644 --- a/faq/library.po +++ b/faq/library.po @@ -21,10 +21,10 @@ msgstr "" "Last-Translator: TENMYO Masakazu, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../faq/library.rst:5 @@ -111,6 +111,8 @@ msgid "" "import sys\n" "print(sys.builtin_module_names)" msgstr "" +"import sys\n" +"print(sys.builtin_module_names)" #: ../../faq/library.rst:47 msgid "How do I make a Python script executable on Unix?" @@ -141,7 +143,7 @@ msgstr "後者は、いくつかの方法でできます。最も直接的な方 #: ../../faq/library.rst:59 msgid "#!/usr/local/bin/python" -msgstr "" +msgstr "#!/usr/local/bin/python" #: ../../faq/library.rst:61 msgid "" @@ -165,7 +167,7 @@ msgstr "" #: ../../faq/library.rst:69 msgid "#!/usr/bin/env python" -msgstr "" +msgstr "#!/usr/bin/env python" #: ../../faq/library.rst:71 msgid "" @@ -194,6 +196,10 @@ msgid "" "exec python $0 ${1+\"$@\"}\n" "\"\"\"" msgstr "" +"#! /bin/sh\n" +"\"\"\":\"\n" +"exec python $0 ${1+\"$@\"}\n" +"\"\"\"" #: ../../faq/library.rst:86 msgid "" @@ -205,7 +211,7 @@ msgstr "" #: ../../faq/library.rst:89 msgid "__doc__ = \"\"\"...Whatever...\"\"\"" -msgstr "" +msgstr "__doc__ = \"\"\"...Whatever...\"\"\"" #: ../../faq/library.rst:94 msgid "Is there a curses/termcap package for Python?" @@ -243,13 +249,12 @@ msgstr "" msgid "Is there an equivalent to C's onexit() in Python?" msgstr "Python には C の onexit() に相当するものはありますか?" -#: ../../faq/library.rst:113 msgid "" "The :mod:`atexit` module provides a register function that is similar to " "C's :c:func:`!onexit`." msgstr "" -":mod:`atexit` モジュールは、 C の :c:func:`!onexit` と同じような関数登録を提" -"供します。" +":mod:`atexit` モジュールには、C の :c:func:`!onexit` に似た ``register()`` 関" +"数があります。" #: ../../faq/library.rst:118 msgid "Why don't my signal handlers work?" @@ -265,7 +270,7 @@ msgstr "" #: ../../faq/library.rst:123 msgid "handler(signum, frame)" -msgstr "" +msgstr "handler(signum, frame)" #: ../../faq/library.rst:125 msgid "so it should be declared with two parameters::" @@ -276,6 +281,8 @@ msgid "" "def handler(signum, frame):\n" " ..." msgstr "" +"def handler(signum, frame):\n" +" ..." #: ../../faq/library.rst:132 msgid "Common tasks" @@ -295,13 +302,12 @@ msgstr "" "ルは、モジュールの docstring から使用例を見つけてそれらを実行し、出力を " "docstring によって与えられた望まれる出力と比較します。" -#: ../../faq/library.rst:141 msgid "" "The :mod:`unittest` module is a fancier testing framework modelled on Java " "and Smalltalk testing frameworks." msgstr "" -":mod:`unittest` モジュールは、Java や Smalltalk のテストフレームワークを模し" -"た装飾されたテストフレームワークです。" +":mod:`unittest` モジュールは、Java や Smalltalk のテストフレームワークをモデ" +"ルにした、より高機能なテストフレームワークです。" #: ../../faq/library.rst:144 msgid "" @@ -329,6 +335,8 @@ msgid "" "if __name__ == \"__main__\":\n" " main_logic()" msgstr "" +"if __name__ == \"__main__\":\n" +" main_logic()" #: ../../faq/library.rst:157 msgid "at the bottom of the main module of your program." @@ -368,6 +376,8 @@ msgid "" "if __name__ == \"__main__\":\n" " self_test()" msgstr "" +"if __name__ == \"__main__\":\n" +" self_test()" #: ../../faq/library.rst:173 msgid "" @@ -460,6 +470,17 @@ msgid "" "\n" "time.sleep(10) # <---------------------------!" msgstr "" +"import threading, time\n" +"\n" +"def thread_task(name, n):\n" +" for i in range(n):\n" +" print(name, i)\n" +"\n" +"for i in range(10):\n" +" T = threading.Thread(target=thread_task, args=(str(i), i))\n" +" T.start()\n" +"\n" +"time.sleep(10) # <---------------------------!" #: ../../faq/library.rst:265 msgid "" @@ -488,6 +509,16 @@ msgid "" "\n" "time.sleep(10)" msgstr "" +"def thread_task(name, n):\n" +" time.sleep(0.001) # <--------------------!\n" +" for i in range(n):\n" +" print(name, i)\n" +"\n" +"for i in range(10):\n" +" T = threading.Thread(target=thread_task, args=(str(i), i))\n" +" T.start()\n" +"\n" +"time.sleep(10)" #: ../../faq/library.rst:282 msgid "" @@ -535,7 +566,6 @@ msgstr "" msgid "Here's a trivial example::" msgstr "ここにちょっとした例があります::" -#: ../../faq/library.rst:304 msgid "" "import threading, queue, time\n" "\n" @@ -573,6 +603,41 @@ msgid "" "print('Main thread sleeping')\n" "time.sleep(5)" msgstr "" +"import threading, queue, time\n" +"\n" +"# ワーカースレッドはキューからジョブを取り出す。キューが空になれば、\n" +"# それ以上の作業はないとして終了 (exit) する。\n" +"# (現実的には ワーカーは終了する (terminated) まで走り続ける)\n" +"def worker():\n" +" print('Running worker')\n" +" time.sleep(0.1)\n" +" while True:\n" +" try:\n" +" arg = q.get(block=False)\n" +" except queue.Empty:\n" +" print('Worker', threading.current_thread(), end=' ')\n" +" print('queue empty')\n" +" break\n" +" else:\n" +" print('Worker', threading.current_thread(), end=' ')\n" +" print('running with argument', arg)\n" +" time.sleep(0.5)\n" +"\n" +"# キュー作成\n" +"q = queue.Queue()\n" +"\n" +"# 5 個のワーカーからなるプールを開始\n" +"for i in range(5):\n" +" t = threading.Thread(target=worker, name='worker %i' % (i+1))\n" +" t.start()\n" +"\n" +"# キューへの作業追加を開始\n" +"for i in range(50):\n" +" q.put(i)\n" +"\n" +"# スレッドの作業時間を確保\n" +"print('Main thread sleeping')\n" +"time.sleep(5)" #: ../../faq/library.rst:340 msgid "When run, this will produce the following output:" @@ -594,6 +659,19 @@ msgid "" "Worker running with argument 5\n" "..." msgstr "" +"Running worker\n" +"Running worker\n" +"Running worker\n" +"Running worker\n" +"Running worker\n" +"Main thread sleeping\n" +"Worker running with argument 0\n" +"Worker running with argument 1\n" +"Worker running with argument 2\n" +"Worker running with argument 3\n" +"Worker running with argument 4\n" +"Worker running with argument 5\n" +"..." #: ../../faq/library.rst:358 msgid "" @@ -656,6 +734,17 @@ msgid "" "D1.update(D2)\n" "D.keys()" msgstr "" +"L.append(x)\n" +"L1.extend(L2)\n" +"x = L[i]\n" +"x = L.pop()\n" +"L1[i:j] = L2\n" +"L.sort()\n" +"x = y\n" +"x.field = y\n" +"D[x] = y\n" +"D1.update(D2)\n" +"D.keys()" #: ../../faq/library.rst:392 msgid "These aren't::" @@ -668,6 +757,10 @@ msgid "" "L[i] = L[j]\n" "D[x] = D[x] + 1" msgstr "" +"i = i+1\n" +"L.append(L[-1])\n" +"L[i] = L[j]\n" +"D[x] = D[x] + 1" #: ../../faq/library.rst:399 msgid "" @@ -711,6 +804,13 @@ msgid "" "containing this work, although it may not be completely functional in this " "release." msgstr "" +":pep:`703` の承認により、Python の CPython 実装から GIL を削除する作業が現在" +"進められています。はじめに、インタープリタをビルドする際にオプションのコンパ" +"イラフラグとして実装され、そのため GIL あり・なしの別々のビルドが利用可能にな" +"ります。長期的には、GIL を削除することのパフォーマンスへの影響が十分に理解さ" +"れた時点で、1つのビルドに落ち着くことが望まれています。Python 3.13 がこの作業" +"を含む最初のリリースになる可能性がありますが、このリリースで完全に機能すると" +"は限りません。" #: ../../faq/library.rst:422 msgid "" @@ -726,6 +826,16 @@ msgid "" "compensate for the removal of the GIL. The Python 3.9 fork is the first " "attempt at removing the GIL with an acceptable performance impact." msgstr "" +"GIL 削除に向けた現在の取り組みは `fork of Python 3.9 with the GIL removed " +"`_ by Sam Gross をベースとしています。そ" +"れ以前 Python 1.5 の時代には、 Greg Stein が実際に、 GIL を取り除き よりきめ" +"細かいロッキングに置き換える包括的なパッチセット (\"free threading\" パッチ) " +"を実装しました。 Adam Olsen は `python-safethread `_ プロジェクトで同様の実験を行いました。 残念な" +"がら、これら初期の実験はどちらも シングルスレッドのパフォーマンスの極端な低" +"下 (少なくとも 30% の遅れ) を示しましたが、それは GIL の削除を補うために必要" +"なきめ細かいロッキングの量のためでした。 Python 3.9 fork は、許容可能なパ" +"フォーマンス影響にて GIL を取り除こうとする最初の試みです。" #: ../../faq/library.rst:437 msgid "" @@ -737,6 +847,13 @@ msgid "" "doing so; the :mod:`multiprocessing` module provides a lower-level API in " "case you want more control over dispatching of tasks." msgstr "" +"現行の Python リリースに GIL が搭載されていることは、マルチ CPU マシン上で " +"Python を使いこなせないことを意味しません! 作業を複数の *スレッド* ではなく" +"複数の *プロセス* に分けることを考えればいいのです。 その簡単な方法は新し" +"い :mod:`concurrent.futures` モジュールの :class:`~concurrent.futures." +"ProcessPoolExecutor` クラスが提供しますが、タスクのディスパッチをより深く制御" +"したい場合には :mod:`multiprocessing` モジュールがより低水準な API を提供して" +"います。" #: ../../faq/library.rst:446 msgid "" @@ -761,6 +878,13 @@ msgid "" "since these must be written with multiple interpreters in mind in order to " "be usable, so many older extension modules will not be usable." msgstr "" +"GIL の影響を減らす別のアプローチとして、 GIL を真にグローバルなロックではな" +"く、インタープリタごとのロックにするというものがあります。これは :ref:" +"`Python 3.12 で初めて実装され ` C API で利用できます。 " +"Python のインターフェースは Python 3.13 で利用可能となる予定です。現時点での" +"主な制約はサードパーティー製の拡張モジュールで、使えるようにするには複数のイ" +"ンタープリタを想定して書く必要があるため、多くの古い拡張モジュールは使えなく" +"なります。" #: ../../faq/library.rst:462 msgid "Input and Output" @@ -875,16 +999,21 @@ msgid "" " s = f.read(8)\n" " x, y, z = struct.unpack(\">hhl\", s)" msgstr "" +"import struct\n" +"\n" +"with open(filename, \"rb\") as f:\n" +" s = f.read(8)\n" +" x, y, z = struct.unpack(\">hhl\", s)" -#: ../../faq/library.rst:518 msgid "" "The '>' in the format string forces big-endian data; the letter 'h' reads " "one \"short integer\" (2 bytes), and 'l' reads one \"long integer\" (4 " "bytes) from the string." msgstr "" -"フォーマット中の '>' はデータを強制的にビッグエンディアンにします。ファイルか" -"ら、文字 'h' は一つの\"整数\"(2 バイト)を読み込み、文字 'l' は一つの\"long 整" -"数\"を読み込みます。" +"書式文字列の \">\" は、データをビッグエンディアンとして解釈するよう指定しま" +"す。\n" +"\"h\" は文字列から一つの short 整数 (2 バイト) を読み取り、\"l\" は一つの " +"long 整数 (4 バイト) を読み取ります。" #: ../../faq/library.rst:522 msgid "" @@ -907,11 +1036,10 @@ msgstr "" "read()`` は :class:`bytes` オブジェクトではなく :class:`str` オブジェクトを返" "します。" -#: ../../faq/library.rst:535 msgid "I can't seem to use os.read() on a pipe created with os.popen(); why?" msgstr "" -"os.popen() によって作られたパイプで os.read() が使われていないようです。なぜ" -"ですか?" +"os.popen() で作成したパイプに os.read() を使えないようです。\n" +"なぜですか?" #: ../../faq/library.rst:537 msgid "" @@ -1004,6 +1132,9 @@ msgid "" "os.close(stdout.fileno())\n" "os.close(stderr.fileno())" msgstr "" +"os.close(stdin.fileno())\n" +"os.close(stdout.fileno())\n" +"os.close(stderr.fileno())" #: ../../faq/library.rst:581 msgid "Or you can use the numeric constants 0, 1 and 2, respectively." @@ -1082,6 +1213,22 @@ msgid "" "server.sendmail(fromaddr, toaddrs, msg)\n" "server.quit()" msgstr "" +"import sys, smtplib\n" +"\n" +"fromaddr = input(\"From: \")\n" +"toaddrs = input(\"To: \").split(',')\n" +"print(\"Enter message, end with ^D:\")\n" +"msg = ''\n" +"while True:\n" +" line = sys.stdin.readline()\n" +" if not line:\n" +" break\n" +" msg += line\n" +"\n" +"# The actual mail send\n" +"server = smtplib.SMTP('localhost')\n" +"server.sendmail(fromaddr, toaddrs, msg)\n" +"server.quit()" #: ../../faq/library.rst:634 msgid "" @@ -1110,6 +1257,18 @@ msgid "" "if sts != 0:\n" " print(\"Sendmail exit status\", sts)" msgstr "" +"import os\n" +"\n" +"SENDMAIL = \"/usr/sbin/sendmail\" # sendmail の場所\n" +"p = os.popen(\"%s -t -i\" % SENDMAIL, \"w\")\n" +"p.write(\"To: receiver@example.com\\n\")\n" +"p.write(\"Subject: test\\n\")\n" +"p.write(\"\\n\") # headers - body を分ける空行\n" +"p.write(\"Some text\\n\")\n" +"p.write(\"some more text\\n\")\n" +"sts = p.close()\n" +"if sts != 0:\n" +" print(\"Sendmail exit status\", sts)" #: ../../faq/library.rst:654 msgid "How do I avoid blocking in the connect() method of a socket?" @@ -1154,16 +1313,16 @@ msgstr "" "``errno.EISCONN`` は接続されたことを表します -- または、このソケットを :meth:" "`select.select` に渡して書き込み可能か調べることができます。" -#: ../../faq/library.rst:675 msgid "" "The :mod:`asyncio` module provides a general purpose single-threaded and " "concurrent asynchronous library, which can be used for writing non-blocking " "network code. The third-party `Twisted `_ library is a " "popular and feature-rich alternative." msgstr "" -":mod:`asyncio` モジュールは、ノンブロッキングのネットワークコードを書く作業の" -"ためにフレームワークのような方法を提供します。その他の選択肢として、`Twisted " -"`_ は多機能で著名なサードパーティのライブラリです。" +":mod:`asyncio` モジュールは、シングルスレッドで並行処理を行う汎用の非同期ライ" +"ブラリを提供し、ノンブロッキングのネットワークコードを書くのに使えます。\n" +"サードパーティの `Twisted `_ ライブラリも、広く使われて" +"いる多機能な選択肢です。" #: ../../faq/library.rst:683 msgid "Databases" @@ -1235,10 +1394,12 @@ msgid "" "import random\n" "random.random()" msgstr "" +"import random\n" +"random.random()" #: ../../faq/library.rst:721 msgid "This returns a random floating-point number in the range [0, 1)." -msgstr "" +msgstr "これは、 [0, 1) の範囲のランダムな浮動小数点数を返します。" #: ../../faq/library.rst:723 msgid "" @@ -1251,7 +1412,7 @@ msgstr "``randrange(a, b)`` は区間 [a, b) から整数を選びます。" #: ../../faq/library.rst:726 msgid "``uniform(a, b)`` chooses a floating-point number in the range [a, b)." -msgstr "" +msgstr "``uniform(a, b)`` は [a, b) の範囲の浮動小数点数を選びます。" #: ../../faq/library.rst:727 msgid "" diff --git a/faq/programming.po b/faq/programming.po index 7d2e9bb7b..a56757f16 100644 --- a/faq/programming.po +++ b/faq/programming.po @@ -21,10 +21,10 @@ msgstr "" "Last-Translator: TENMYO Masakazu, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../faq/programming.rst:5 @@ -388,6 +388,9 @@ msgid "" ">>> for x in range(5):\n" "... squares.append(lambda: x**2)" msgstr "" +">>> squares = []\n" +">>> for x in range(5):\n" +"... squares.append(lambda: x**2)" #: ../../faq/programming.rst:217 msgid "" @@ -408,6 +411,10 @@ msgid "" ">>> squares[4]()\n" "16" msgstr "" +">>> squares[2]()\n" +"16\n" +">>> squares[4]()\n" +"16" #: ../../faq/programming.rst:227 msgid "" @@ -429,6 +436,9 @@ msgid "" ">>> squares[2]()\n" "64" msgstr "" +">>> x = 8\n" +">>> squares[2]()\n" +"64" #: ../../faq/programming.rst:237 msgid "" @@ -444,6 +454,9 @@ msgid "" ">>> for x in range(5):\n" "... squares.append(lambda n=x: n**2)" msgstr "" +">>> squares = []\n" +">>> for x in range(5):\n" +"... squares.append(lambda n=x: n**2)" #: ../../faq/programming.rst:244 msgid "" @@ -466,6 +479,10 @@ msgid "" ">>> squares[4]()\n" "16" msgstr "" +">>> squares[2]()\n" +"4\n" +">>> squares[4]()\n" +"16" #: ../../faq/programming.rst:255 msgid "" @@ -501,7 +518,7 @@ msgstr "config.py::" #: ../../faq/programming.rst:270 msgid "x = 0 # Default value of the 'x' configuration setting" -msgstr "" +msgstr "x = 0 # 'x' 設定のデフォルト値" #: ../../faq/programming.rst:272 msgid "mod.py::" @@ -512,6 +529,8 @@ msgid "" "import config\n" "config.x = 1" msgstr "" +"import config\n" +"config.x = 1" #: ../../faq/programming.rst:277 msgid "main.py::" @@ -523,6 +542,9 @@ msgid "" "import mod\n" "print(config.x)" msgstr "" +"import config\n" +"import mod\n" +"print(config.x)" #: ../../faq/programming.rst:283 msgid "" @@ -583,15 +605,14 @@ msgstr "" msgid "locally developed modules" msgstr "自前で開発したモジュール" -#: ../../faq/programming.rst:306 msgid "" "It is sometimes necessary to move imports to a function or class to avoid " "problems with circular imports. Gordon McMillan says:" msgstr "" -"循環参照の問題を避けるために、インポートを関数やクラスに移すことが必要なとき" -"もあります。Gordon McMillan によれば:" +"循環インポートの問題を避けるために、インポートを関数やクラスに移すことが必要" +"なときもあります。\n" +"Gordon McMillan によれば:" -#: ../../faq/programming.rst:309 msgid "" "Circular imports are fine where both modules use the \"import \" " "form of import. They fail when the 2nd module wants to grab a name out of " @@ -599,9 +620,10 @@ msgid "" "That's because names in the 1st are not yet available, because the first " "module is busy importing the 2nd." msgstr "" -"循環参照は両方のモジュールが \"import \" 形式のインポートを使っていれ" -"ば大丈夫です。二つ目のモジュールが最初のモジュールから名前を確保しようとして " -"(\"from module import name\")、そのインポートがトップレベルにあると駄目です。" +"循環インポートは両方のモジュールが \"import \" 形式のインポートを使っ" +"ていれば大丈夫です。\n" +"二つ目のモジュールが最初のモジュールから名前を確保しようとして (\"from " +"module import name\")、そのインポートがトップレベルにあると駄目です。\n" "最初のモジュールが二つ目のモジュールをインポートするのに忙しくて、最初のモ" "ジュールの名前が利用可能になっていないからです。" @@ -630,7 +652,6 @@ msgstr "" "ポートすることさえできないかもしれません。この場合は、対応するプラットフォー" "ムに合わせたコードで正しいモジュールをインポートすることを選ぶと良いです。" -#: ../../faq/programming.rst:325 msgid "" "Only move imports into a local scope, such as inside a function definition, " "if it's necessary to solve a problem such as avoiding a circular import or " @@ -643,15 +664,19 @@ msgid "" "only a couple of dictionary lookups. Even if the module name has gone out " "of scope, the module is probably available in :data:`sys.modules`." msgstr "" -"循環参照の問題を避けたりモジュールの初期化にかかる時間を減らしたりしたいな" -"ら、単にインポートを関数定義の中などのローカルなスコープに移してください。こ" -"の手法は多くのインポートがプログラムがどのように実行されるかに依存しなくてよ" -"いときに特に有効です。ある関数の中でのみモジュールが使われるのなら、インポー" -"トをその関数の中に移すことを考えてもいいでしょう。なお、モジュールを読み込む" -"最初の回はモジュールの初期化の時間のために高価になりえますが、複数回目にモ" -"ジュールを読み込むのは事実上無料、辞書探索の数回のコストだけで済みます。モ" -"ジュール名がスコープから外れてさえ、そのモジュールはおそらく :data:`sys." -"modules` から利用できるでしょう。" +"インポートを関数定義内などのローカルスコープへ移すのは、循環インポートを避け" +"るといった問題の解決に必要な場合や、モジュールの初期化時間を短くしたい場合だ" +"けにしてください。\n" +"この手法は、プログラムの実行のされ方によって多くのインポートが不要になる場合" +"に特に有効です。\n" +"モジュールをある関数の中でしか使わない場合も、インポートをその関数内へ移すと" +"よいでしょう。\n" +"初回の読み込みにはモジュールの初期化が伴うため、時間がかかることがありま" +"す。\n" +"一方、繰り返し読み込むときのコストは辞書を数回検索する程度で、ほぼ無視できま" +"す。\n" +"モジュール名がスコープから外れても、モジュール自体はおそらく :data:`sys." +"modules` に残っています。" #: ../../faq/programming.rst:338 msgid "Why are default values shared between objects?" @@ -672,6 +697,10 @@ msgid "" " mydict[key] = value\n" " return mydict" msgstr "" +"def foo(mydict={}): # 危険:すべての呼び出しで単一辞書への参照が共有される\n" +" ... compute something ...\n" +" mydict[key] = value\n" +" return mydict" #: ../../faq/programming.rst:347 msgid "" @@ -696,15 +725,15 @@ msgstr "" "に一度だけ生成されます。この例の辞書のように、そのオブジェクトが変更されたと" "き、その後の関数の呼び出しは変更後のオブジェクトを参照します。" -#: ../../faq/programming.rst:356 msgid "" "By definition, immutable objects such as numbers, strings, tuples, and " "``None``, are safe from change. Changes to mutable objects such as " "dictionaries, lists, and class instances can lead to confusion." msgstr "" -"定義の時に、数、文字列、タプル、``None`` など、イミュータブルなオブジェクトを" -"使うと変更される危険がありません。辞書、リスト、クラスインスタンスなどの" -"ミュータブルなオブジェクトは混乱のもとです。" +"数値、文字列、タプル、``None`` などのイミュータブルなオブジェクトは、定義上、" +"変更されることがありません。\n" +"辞書、リスト、クラスインスタンスなどのミュータブルなオブジェクトを変更する" +"と、混乱を招く場合があります。" #: ../../faq/programming.rst:360 msgid "" @@ -723,6 +752,8 @@ msgid "" "def foo(mydict={}):\n" " ..." msgstr "" +"def foo(mydict={}):\n" +" ..." #: ../../faq/programming.rst:368 msgid "but::" @@ -734,6 +765,9 @@ msgid "" " if mydict is None:\n" " mydict = {} # create a new dict for local namespace" msgstr "" +"def foo(mydict=None):\n" +" if mydict is None:\n" +" mydict = {} # ローカル名前空間での新辞書作成" #: ../../faq/programming.rst:374 msgid "" @@ -744,9 +778,9 @@ msgid "" "implemented like this::" msgstr "" "この性質が便利なこともあります。時間のかかる計算を行う関数があるときに使われ" -"る一般的な技法は、関数が呼び出されるごとにパラメタと結果の値をキャッシュし、" -"再び同じ値が要求されたらキャッシュされた値を返すというものです。これは " -"\"memoizing\" と呼ばれ、このように実装されます::" +"る一般的な技法は、関数が呼び出されるごとにパラメータと結果の値をキャッシュ" +"し、再び同じ値が要求されたらキャッシュされた値を返すというものです。これはメ" +"モ化( \"memoizing\" )と呼ばれ、このように実装されます::" #: ../../faq/programming.rst:379 msgid "" @@ -761,6 +795,16 @@ msgid "" " _cache[(arg1, arg2)] = result # Store result in the cache\n" " return result" msgstr "" +"# 呼び出し元は2つのパラメータを指定でき、キーワードにより _cache をオプショ" +"ンとして渡せる\n" +"def expensive(arg1, arg2, *, _cache={}):\n" +" if (arg1, arg2) in _cache:\n" +" return _cache[(arg1, arg2)]\n" +"\n" +" # 値の算出\n" +" result = ... 高コストな計算 ...\n" +" _cache[(arg1, arg2)] = result # 結果をキャッシュに保持\n" +" return result" #: ../../faq/programming.rst:389 msgid "" @@ -797,12 +841,16 @@ msgid "" " ...\n" " g(x, *args, **kwargs)" msgstr "" +"def f(x, *args, **kwargs):\n" +" ...\n" +" kwargs['width'] = '14.3c'\n" +" ...\n" +" g(x, *args, **kwargs)" #: ../../faq/programming.rst:415 msgid "What is the difference between arguments and parameters?" msgstr "実引数と仮引数の違いは何ですか?" -#: ../../faq/programming.rst:417 msgid "" ":term:`Parameters ` are defined by the names that appear in a " "function definition, whereas :term:`arguments ` are the values " @@ -812,14 +860,18 @@ msgid "" msgstr "" ":term:`仮引数 (parameter) ` は関数定義に表れる名前で定義されるのに" "対し、 :term:`実引数 (argument) ` は関数を呼び出すときに実際に渡す" -"値のことです。仮引数は関数が受け取ることの出来る :term:`実引数の型 " -"` を定義します。例えば、以下のような関数定義があったとして::" +"値のことです。\n" +"仮引数は関数が受け取ることの出来る :term:`実引数の種類 ` を定義し" +"ます。\n" +"例えば、以下のような関数定義があったとして::" #: ../../faq/programming.rst:423 msgid "" "def func(foo, bar=None, **kwargs):\n" " pass" msgstr "" +"def func(foo, bar=None, **kwargs):\n" +" pass" #: ../../faq/programming.rst:426 msgid "" @@ -831,7 +883,7 @@ msgstr "" #: ../../faq/programming.rst:429 msgid "func(42, bar=314, extra=somevar)" -msgstr "" +msgstr "func(42, bar=314, extra=somevar)" #: ../../faq/programming.rst:431 msgid "the values ``42``, ``314``, and ``somevar`` are arguments." @@ -855,13 +907,20 @@ msgid "" ">>> x\n" "[10]" msgstr "" +">>> x = []\n" +">>> y = x\n" +">>> y.append(10)\n" +">>> y\n" +"[10]\n" +">>> x\n" +"[10]" #: ../../faq/programming.rst:447 msgid "" "you might be wondering why appending an element to ``y`` changed ``x`` too." msgstr "" "どうして ``y`` への要素の追加が ``x`` も変更してしまうのか疑問に思うかもしれ" -"ません。 " +"ません。" #: ../../faq/programming.rst:449 msgid "There are two factors that produce this result:" @@ -909,6 +968,13 @@ msgid "" ">>> y\n" "5" msgstr "" +">>> x = 5 # int はイミュータブル(不変)\n" +">>> y = x\n" +">>> x = x + 1 # 5 は変更不可。 ここでは新しいオブジェクトを作っている\n" +">>> x\n" +"6\n" +">>> y\n" +"5" #: ../../faq/programming.rst:471 msgid "" @@ -1028,6 +1094,14 @@ msgid "" ">>> func1(x, y)\n" "('new-value', 100)" msgstr "" +">>> def func1(a, b):\n" +"... a = 'new-value' # a と b はローカル名で\n" +"... b = b + 1 # 新しいオブジェクトが代入され\n" +"... return a, b # 新しい値一式を返す\n" +"...\n" +">>> x, y = 'old-value', 99\n" +">>> func1(x, y)\n" +"('new-value', 100)" #: ../../faq/programming.rst:528 msgid "This is almost always the clearest solution." @@ -1055,10 +1129,18 @@ msgid "" ">>> args\n" "['new-value', 100]" msgstr "" +">>> def func2(a):\n" +"... a[0] = 'new-value' # 'a' は mutable list への参照\n" +"... a[1] = a[1] + 1 # 共有されたオブジェクトを変える\n" +"...\n" +">>> args = ['old-value', 99]\n" +">>> func2(args)\n" +">>> args\n" +"['new-value', 100]" #: ../../faq/programming.rst:543 msgid "By passing in a dictionary that gets mutated::" -msgstr "変更される辞書に渡すことによって::" +msgstr "変更を受ける辞書を渡すことによって::" #: ../../faq/programming.rst:545 msgid "" @@ -1071,6 +1153,14 @@ msgid "" ">>> args\n" "{'a': 'new-value', 'b': 100}" msgstr "" +">>> def func3(args):\n" +"... args['a'] = 'new-value' # args は mutable dictionary\n" +"... args['b'] = args['b'] + 1 # インプレースで変更\n" +"...\n" +">>> args = {'a': 'old-value', 'b': 99}\n" +">>> func3(args)\n" +">>> args\n" +"{'a': 'new-value', 'b': 100}" #: ../../faq/programming.rst:554 msgid "Or bundle up values in a class instance::" @@ -1092,6 +1182,19 @@ msgid "" ">>> vars(args)\n" "{'a': 'new-value', 'b': 100}" msgstr "" +">>> class Namespace:\n" +"... def __init__(self, /, **args):\n" +"... for key, value in args.items():\n" +"... setattr(self, key, value)\n" +"...\n" +">>> def func4(args):\n" +"... args.a = 'new-value' # args は mutable Namespace\n" +"... args.b = args.b + 1 # オブジェクトをインプレースで変更\n" +"...\n" +">>> args = Namespace(a='old-value', b=99)\n" +">>> func4(args)\n" +">>> vars(args)\n" +"{'a': 'new-value', 'b': 100}" #: ../../faq/programming.rst:571 msgid "There's almost never a good reason to get this complicated." @@ -1123,6 +1226,10 @@ msgid "" " return a * x + b\n" " return result" msgstr "" +"def linear(a, b):\n" +" def result(x):\n" +" return a * x + b\n" +" return result" #: ../../faq/programming.rst:588 msgid "Or using a callable object::" @@ -1138,6 +1245,13 @@ msgid "" " def __call__(self, x):\n" " return self.a * x + self.b" msgstr "" +"class linear:\n" +"\n" +" def __init__(self, a, b):\n" +" self.a, self.b = a, b\n" +"\n" +" def __call__(self, x):\n" +" return self.a * x + self.b" #: ../../faq/programming.rst:598 msgid "In both cases, ::" @@ -1145,7 +1259,7 @@ msgstr "どちらの場合でも、 ::" #: ../../faq/programming.rst:600 msgid "taxes = linear(0.3, 2)" -msgstr "" +msgstr "taxes = linear(0.3, 2)" #: ../../faq/programming.rst:602 msgid "gives a callable object where ``taxes(10e6) == 0.3 * 10e6 + 2``." @@ -1160,8 +1274,8 @@ msgid "" "callables can share their signature via inheritance::" msgstr "" "呼び出し可能オブジェクトを使う方法は、少し遅くなり、わずかにコードが長くなる" -"という短所があります。ですが、継承を使って呼び出し可能オブジェクト同士で記号" -"を共有することもできます::" +"という短所があります。ですが、継承を使って呼び出し可能オブジェクト同士でシグ" +"ネチャを共有することもできます::" #: ../../faq/programming.rst:608 msgid "" @@ -1170,10 +1284,14 @@ msgid "" " def __call__(self, x):\n" " return self.a * (x ** self.b)" msgstr "" +"class exponential(linear):\n" +" # __init__ 継承\n" +" def __call__(self, x):\n" +" return self.a * (x ** self.b)" #: ../../faq/programming.rst:613 msgid "Object can encapsulate state for several methods::" -msgstr "オブジェクトはいくつかのメソッドに状態をカプセル化できます::" +msgstr "オブジェクトは複数メソッド向けの状態をカプセル化できます::" #: ../../faq/programming.rst:615 msgid "" @@ -1193,6 +1311,21 @@ msgid "" "count = counter()\n" "inc, dec, reset = count.up, count.down, count.set" msgstr "" +"class counter:\n" +"\n" +" value = 0\n" +"\n" +" def set(self, x):\n" +" self.value = x\n" +"\n" +" def up(self):\n" +" self.value = self.value + 1\n" +"\n" +" def down(self):\n" +" self.value = self.value - 1\n" +"\n" +"count = counter()\n" +"inc, dec, reset = count.up, count.down, count.set" #: ../../faq/programming.rst:631 msgid "" @@ -1224,7 +1357,7 @@ msgstr "" #: ../../faq/programming.rst:644 msgid "newdict = olddict.copy()" -msgstr "" +msgstr "newdict = olddict.copy()" #: ../../faq/programming.rst:646 msgid "Sequences can be copied by slicing::" @@ -1232,7 +1365,7 @@ msgstr "シーケンスはスライシングでコピーできます::" #: ../../faq/programming.rst:648 msgid "new_l = l[:]" -msgstr "" +msgstr "new_l = l[:]" #: ../../faq/programming.rst:652 msgid "How can I find the methods or attributes of an object?" @@ -1250,7 +1383,7 @@ msgstr "" #: ../../faq/programming.rst:660 msgid "How can my code discover the name of an object?" -msgstr "コードはどのようにオブジェクトの名前を見つけるのですか?" +msgstr "どうすればコードにてオブジェクトの名前を得ることができますか?" #: ../../faq/programming.rst:662 msgid "" @@ -1259,9 +1392,9 @@ msgid "" "``def`` and ``class`` statements, but in that case the value is a callable. " "Consider the following code::" msgstr "" -"概して、オブジェクトは本当は名前を持たないので、見つけることはできません。本" -"質的には、代入とはいつも値に名前を束縛することです。``def`` と ``class`` 文も" -"同じですが、この場合は値はコーラブルです。以下のコードを考えてみましょう::" +"一般的に言えば、できません。なぜならオブジェクトは実は名前を持ちません。本質" +"的には、いつでも代入とは値に名前を束縛することです。``def`` と ``class`` 文も" +"同じですが、この場合の値はコーラブルです。以下のコードを考えてみましょう::" #: ../../faq/programming.rst:667 msgid "" @@ -1276,6 +1409,16 @@ msgid "" ">>> print(a)\n" "<__main__.A object at 0x16D07CC>" msgstr "" +">>> class A:\n" +"... pass\n" +"...\n" +">>> B = A\n" +">>> a = B()\n" +">>> b = a\n" +">>> print(b)\n" +"<__main__.A object at 0x16D07CC>\n" +">>> print(a)\n" +"<__main__.A object at 0x16D07CC>" #: ../../faq/programming.rst:678 msgid "" @@ -1298,8 +1441,9 @@ msgid "" "approach might be beneficial." msgstr "" "概して、コードにとってある値の「名前を知っている」事は重要ではありません。あ" -"なたがわざと内省的なコードを書いているのでない限り、方針を変えた方がいいかも" -"しれないということになるでしょう。" +"なたがあえて introspective (訳注:実行時のオブジェクト情報を調査するような)" +"プログラムを書いているのでない限り、方針を変えた方がいいかもしれないというこ" +"とになるでしょう。" #: ../../faq/programming.rst:688 msgid "" @@ -1329,9 +1473,8 @@ msgstr "" "……そして、その猫が沢山の名前で知られていたり、逆に全く名前が無かったりしても" "驚かないでください!" -#: ../../faq/programming.rst:701 msgid "What's up with the comma operator's precedence?" -msgstr "カンマ演算子はなぜ優先されるのですか?" +msgstr "カンマ演算子の優先順位はどうなっていますか?" #: ../../faq/programming.rst:703 msgid "Comma is not an operator in Python. Consider this session::" @@ -1343,6 +1486,8 @@ msgid "" ">>> \"a\" in \"b\", \"a\"\n" "(False, 'a')" msgstr "" +">>> \"a\" in \"b\", \"a\"\n" +"(False, 'a')" #: ../../faq/programming.rst:708 msgid "" @@ -1354,7 +1499,7 @@ msgstr "" #: ../../faq/programming.rst:711 msgid "(\"a\" in \"b\"), \"a\"" -msgstr "" +msgstr "(\"a\" in \"b\"), \"a\"" #: ../../faq/programming.rst:713 msgid "not::" @@ -1362,7 +1507,7 @@ msgstr "こうではありません::" #: ../../faq/programming.rst:715 msgid "\"a\" in (\"b\", \"a\")" -msgstr "" +msgstr "\"a\" in (\"b\", \"a\")" #: ../../faq/programming.rst:717 msgid "" @@ -1388,6 +1533,10 @@ msgid "" "x, y = 50, 25\n" "small = x if x < y else y" msgstr "" +"[on_true] if [expression] else [on_false]\n" +"\n" +"x, y = 50, 25\n" +"small = x if x < y else y" #: ../../faq/programming.rst:731 msgid "" @@ -1399,7 +1548,7 @@ msgstr "" #: ../../faq/programming.rst:734 msgid "[expression] and [on_true] or [on_false]" -msgstr "" +msgstr "[expression] and [on_true] or [on_false]" #: ../../faq/programming.rst:736 msgid "" @@ -1452,6 +1601,30 @@ msgid "" "# | |_________________ range on y axis\n" "# |____________________________ range on x axis" msgstr "" +"from functools import reduce\n" +"\n" +"# 素数 < 1000\n" +"print(list(filter(None,map(lambda y:y*reduce(lambda x,y:x*y!=0,\n" +"map(lambda x,y=y:y%x,range(2,int(pow(y,0.5)+1))),1),range(2,1000)))))\n" +"\n" +"# 先頭 10 フィボナッチ数列\n" +"print(list(map(lambda x,f=lambda x,f:(f(x-1,f)+f(x-2,f)) if x>1 else 1:\n" +"f(x,f), range(10))))\n" +"\n" +"# マンデルブロ集合\n" +"print((lambda Ru,Ro,Iu,Io,IM,Sx,Sy:reduce(lambda x,y:x+'\\n'+y,map(lambda " +"y,\n" +"Iu=Iu,Io=Io,Ru=Ru,Ro=Ro,Sy=Sy,L=lambda yc,Iu=Iu,Io=Io,Ru=Ru,Ro=Ro,i=IM,\n" +"Sx=Sx,Sy=Sy:reduce(lambda x,y:x+y,map(lambda x,xc=Ru,yc=yc,Ru=Ru,Ro=Ro,\n" +"i=i,Sx=Sx,F=lambda xc,yc,x,y,k,f=lambda xc,yc,x,y,k,f:(k<=0)or (x*x+y*y\n" +">=4.0) or 1+f(xc,yc,x*x-y*y+xc,2.0*x*y+yc,k-1,f):f(xc,yc,x,y,k,f):chr(\n" +"64+F(Ru+x*(Ro-Ru)/Sx,yc,0,0,i)),range(Sx))):L(Iu+y*(Io-Iu)/Sy),range(Sy\n" +"))))(-2.1, 0.7, -1.2, 1.2, 30, 80, 24))\n" +"# \\___ ___/ \\___ ___/ | | |__ 画面行数\n" +"# V V | |______ 画面列数\n" +"# | | |__________ 最大 \"iterations\"\n" +"# | |_________________ y 軸範囲\n" +"# |____________________________ x 軸範囲" #: ../../faq/programming.rst:771 msgid "Don't try this at home, kids!" @@ -1459,7 +1632,7 @@ msgstr "よい子はまねしないでね!" #: ../../faq/programming.rst:777 msgid "What does the slash(/) in the parameter list of a function mean?" -msgstr "関数の引数リストにあるスラッシュ (/) は何を意味しますか?" +msgstr "関数の仮引数リストにあるスラッシュ (/) は何を意味しますか?" #: ../../faq/programming.rst:779 msgid "" @@ -1470,9 +1643,9 @@ msgid "" "position. For example, :func:`divmod` is a function that accepts positional-" "only parameters. Its documentation looks like this::" msgstr "" -"パラメータ関数の仮引数にあるスラッシュは、それより前にある仮引数は位置専用引" -"数であることを示します。\n" -"位置専用引数は、外で使える名前を持たない仮引数です。\n" +"関数の仮引数にあるスラッシュは、それより前にある仮引数は位置専用引数であるこ" +"とを示します。\n" +"位置専用引数は、外から使える名前を持たない仮引数です。\n" "位置専用引数を受け付ける関数の呼び出しにおいて、実引数はその位置だけに基づい" "て仮引数に対応付けられます。\n" "例えば、 :func:`divmod` は位置専用引数を受け付けます。\n" @@ -1486,6 +1659,11 @@ msgid "" "divmod(x, y, /)\n" " Return the tuple (x//y, x%y). Invariant: div*y + mod == x." msgstr "" +">>> help(divmod)\n" +"Help on built-in function divmod in module builtins:\n" +"\n" +"divmod(x, y, /)\n" +" Return the tuple (x//y, x%y). Invariant: div*y + mod == x." #: ../../faq/programming.rst:792 msgid "" @@ -1505,6 +1683,10 @@ msgid "" " File \"\", line 1, in \n" "TypeError: divmod() takes no keyword arguments" msgstr "" +">>> divmod(x=3, y=4)\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"TypeError: divmod() takes no keyword arguments" #: ../../faq/programming.rst:803 msgid "Numbers and strings" @@ -1530,6 +1712,9 @@ msgid "" ">>> a\n" "8" msgstr "" +">>> a = 0o10\n" +">>> a\n" +"8" #: ../../faq/programming.rst:816 msgid "" @@ -1550,6 +1735,12 @@ msgid "" ">>> b\n" "178" msgstr "" +">>> a = 0xa5\n" +">>> a\n" +"165\n" +">>> b = 0XB2\n" +">>> b\n" +"178" #: ../../faq/programming.rst:829 msgid "Why does -22 // 10 return -3?" @@ -1565,16 +1756,16 @@ msgstr "" #: ../../faq/programming.rst:834 msgid "i == (i // j) * j + (i % j)" -msgstr "" +msgstr "i == (i // j) * j + (i % j)" -#: ../../faq/programming.rst:836 msgid "" "then integer division has to return the floor. C also requires that " "identity to hold, and then compilers that truncate ``i // j`` need to make " "``i % j`` have the same sign as ``i``." msgstr "" -"整数除算は床を返すことになります。C にも C の一貫性があって、``i % j`` が " -"``i`` と同じ符号を持つように ``i // j`` を丸めています。" +"整数除算は床、つまり商以下の最大の整数を返す必要があります。\n" +"C でもこの等式を満たす必要があり、商をゼロ方向に切り捨てるコンパイラでは、" +"``i % j`` の符号を ``i`` と同じにする必要があります。" #: ../../faq/programming.rst:840 msgid "" @@ -1610,6 +1801,11 @@ msgid "" " ^\n" "SyntaxError: invalid decimal literal" msgstr "" +">>> 1.__class__\n" +" File \"\", line 1\n" +" 1.__class__\n" +" ^\n" +"SyntaxError: invalid decimal literal" #: ../../faq/programming.rst:859 msgid "" @@ -1732,6 +1928,27 @@ msgid "" ">>> a.tounicode()\n" "'yello, world'" msgstr "" +">>> import io\n" +">>> s = \"Hello, world\"\n" +">>> sio = io.StringIO(s)\n" +">>> sio.getvalue()\n" +"'Hello, world'\n" +">>> sio.seek(7)\n" +"7\n" +">>> sio.write(\"there!\")\n" +"6\n" +">>> sio.getvalue()\n" +"'Hello, there!'\n" +"\n" +">>> import array\n" +">>> a = array.array('w', s)\n" +">>> print(a)\n" +"array('w', 'Hello, world')\n" +">>> a[0] = 'y'\n" +">>> print(a)\n" +"array('w', 'yello, world')\n" +">>> a.tounicode()\n" +"'yello, world'" #: ../../faq/programming.rst:938 msgid "How do I use strings to call functions/methods?" @@ -1764,6 +1981,15 @@ msgid "" "\n" "dispatch[get_input()]() # Note trailing parens to call function" msgstr "" +"def a():\n" +" pass\n" +"\n" +"def b():\n" +" pass\n" +"\n" +"dispatch = {'go': a, 'stop': b} # 注意:関数にはカッコなし\n" +"\n" +"dispatch[get_input()]() # 注意:関数を呼び出すには末尾カッコ" #: ../../faq/programming.rst:957 msgid "Use the built-in function :func:`getattr`::" @@ -1774,6 +2000,8 @@ msgid "" "import foo\n" "getattr(foo, 'bar')()" msgstr "" +"import foo\n" +"getattr(foo, 'bar')()" #: ../../faq/programming.rst:962 msgid "" @@ -1799,6 +2027,15 @@ msgid "" "f = getattr(foo_instance, 'do_' + opname)\n" "f()" msgstr "" +"class Foo:\n" +" def do_foo(self):\n" +" ...\n" +"\n" +" def do_bar(self):\n" +" ...\n" +"\n" +"f = getattr(foo_instance, 'do_' + opname)\n" +"f()" #: ../../faq/programming.rst:978 msgid "Use :func:`locals` to resolve the function name::" @@ -1814,12 +2051,21 @@ msgid "" "f = locals()[fname]\n" "f()" msgstr "" +"def myFunc():\n" +" print(\"hello\")\n" +"\n" +"fname = \"myFunc\"\n" +"\n" +"f = locals()[fname]\n" +"f()" #: ../../faq/programming.rst:990 msgid "" "Is there an equivalent to Perl's ``chomp()`` for removing trailing newlines " "from strings?" msgstr "" +"文字列から後端の改行を取り除く Perl の ``chomp()`` に相当するものはあります" +"か?" #: ../../faq/programming.rst:992 msgid "" @@ -1841,6 +2087,11 @@ msgid "" ">>> lines.rstrip(\"\\n\\r\")\n" "'line 1 '" msgstr "" +">>> lines = (\"line 1 \\r\\n\"\n" +"... \"\\r\\n\"\n" +"... \"\\r\\n\")\n" +">>> lines.rstrip(\"\\n\\r\")\n" +"'line 1 '" #: ../../faq/programming.rst:1004 msgid "" @@ -1850,15 +2101,13 @@ msgstr "" "これは典型的に一度に一行ずつテキストを読みたい時にのみ使われるので、``S." "rstrip()`` をこの方法で使うとうまくいきます。" -#: ../../faq/programming.rst:1009 msgid "Is there a ``scanf()`` or ``sscanf()`` equivalent?" -msgstr "" +msgstr "``scanf()`` や ``sscanf()`` に相当するものはありますか?" #: ../../faq/programming.rst:1011 msgid "Not as such." msgstr "そのようなものはありません。" -#: ../../faq/programming.rst:1013 msgid "" "For simple input parsing, the easiest approach is usually to split the line " "into whitespace-delimited words using the :meth:`~str.split` method of " @@ -1867,6 +2116,11 @@ msgid "" "parameter which is useful if the line uses something other than whitespace " "as a separator." msgstr "" +"単純な入力を解析するには、通常、文字列オブジェクトの :meth:`~str.split` メ" +"ソッドで行を空白区切りの単語に分割し、:func:`int` や :func:`float` で十進数の" +"文字列を数値に変換するのが最も簡単です。\n" +":meth:`!split` には省略可能な ``sep`` 引数があり、空白以外の区切り文字を使っ" +"た行を扱うのに便利です。" #: ../../faq/programming.rst:1019 msgid "" @@ -1876,9 +2130,8 @@ msgstr "" "もっと複雑な入力解析をしたいなら、C の ``sscanf`` よりも正規表現の方が便利で" "すし、この処理に向いています。" -#: ../../faq/programming.rst:1024 msgid "What does ``UnicodeDecodeError`` or ``UnicodeEncodeError`` error mean?" -msgstr "" +msgstr "``UnicodeDecodeError`` や ``UnicodeEncodeError`` は何を意味しますか?" #: ../../faq/programming.rst:1026 msgid "See the :ref:`unicode-howto`." @@ -1896,7 +2149,6 @@ msgstr "" "奇数個のバックスラッシュで終わる raw string は文字列のクォートをエスケープし" "ます::" -#: ../../faq/programming.rst:1036 msgid "" ">>> r'C:\\this\\will\\not\\work\\'\n" " File \"\", line 1\n" @@ -1904,6 +2156,11 @@ msgid "" " ^\n" "SyntaxError: unterminated string literal (detected at line 1)" msgstr "" +">>> r'C:\\this\\will\\not\\work\\'\n" +" File \"\", line 1\n" +" r'C:\\this\\will\\not\\work\\'\n" +" ^\n" +"SyntaxError: unterminated string literal (detected at line 1)" #: ../../faq/programming.rst:1042 msgid "" @@ -1913,11 +2170,12 @@ msgstr "" "これにはいくつかの回避策があります。ひとつは通常文字列と二重バックスラッシュ" "を使うことです::" -#: ../../faq/programming.rst:1045 msgid "" ">>> 'C:\\\\this\\\\will\\\\work\\\\'\n" "'C:\\\\this\\\\will\\\\work\\\\'" msgstr "" +">>> 'C:\\\\this\\\\will\\\\work\\\\'\n" +"'C:\\\\this\\\\will\\\\work\\\\'" #: ../../faq/programming.rst:1048 msgid "" @@ -1927,11 +2185,12 @@ msgstr "" "もうひとつは、エスケープされたバックスラッシュを含む通常の文字列を、 raw " "string に連結します::" -#: ../../faq/programming.rst:1051 msgid "" ">>> r'C:\\this\\will\\work' '\\\\'\n" "'C:\\\\this\\\\will\\\\work\\\\'" msgstr "" +">>> r'C:\\this\\will\\work' '\\\\'\n" +"'C:\\\\this\\\\will\\\\work\\\\'" #: ../../faq/programming.rst:1054 msgid "" @@ -1941,11 +2200,12 @@ msgstr "" "Windowsでは、 :func:`os.path.join` を使ってバックスラッシュを追加することもで" "きます::" -#: ../../faq/programming.rst:1056 msgid "" ">>> os.path.join(r'C:\\this\\will\\work', '')\n" "'C:\\\\this\\\\will\\\\work\\\\'" msgstr "" +">>> os.path.join(r'C:\\this\\will\\work', '')\n" +"'C:\\\\this\\\\will\\\\work\\\\'" #: ../../faq/programming.rst:1059 msgid "" @@ -1958,11 +2218,12 @@ msgstr "" "ますが、 raw string の値を解釈する際にはエスケープが生じません。つまり、バッ" "クスラッシュは raw string 値の中に残ったままになります::" -#: ../../faq/programming.rst:1064 msgid "" ">>> r'backslash\\'preserved'\n" "\"backslash\\\\'preserved\"" msgstr "" +">>> r'backslash\\'preserved'\n" +"\"backslash\\\\'preserved\"" #: ../../faq/programming.rst:1067 msgid "Also see the specification in the :ref:`language reference `." @@ -2025,14 +2286,13 @@ msgstr "" "洗練された最適化に隠れたリグレッションの可能性を生む前に、(ユニットテストやそ" "の他の技法で) コードカバレッジを上げることを強く推奨します。" -#: ../../faq/programming.rst:1090 msgid "" "That being said, there are many tricks to speed up Python code. Here are " "some general principles which go a long way towards reaching acceptable " "performance levels:" msgstr "" -"とは言っても、Python コードを高速化する技法はたくさんあります。ここでは、満足" -"な性能のレベルにたどり着くまでの長い道のりを進む、一般的な方針を示します:" +"とはいえ、Python コードを高速化する方法はたくさんあります。\n" +"満足できる性能を得るうえで大いに役立つ一般的な方針を紹介します。" #: ../../faq/programming.rst:1094 msgid "" @@ -2068,7 +2328,6 @@ msgstr "" "`sorted` 関数を使ってください (また、中程度に高度な例は、 :ref:" "`sortinghowto` を参照してください)。" -#: ../../faq/programming.rst:1109 msgid "" "Abstractions tend to create indirections and force the interpreter to work " "more. If the levels of indirection outweigh the amount of useful work done, " @@ -2076,12 +2335,11 @@ msgid "" "especially under the form of tiny functions or methods (which are also often " "detrimental to readability)." msgstr "" -"抽象化は、遠回りにしがちで、インタプリタの作業を増やすことになります。この遠" -"回りさが、なされる作業の量より重大になると、プログラムが遅くなってしまいま" -"す。過度な抽象化、特に細かい関数やメソッドの形で現れるもの (これは読みにくさ" -"も落とします) は防ぐべきです。" +"抽象化によって処理が間接的になると、インタープリタの仕事が増えがちです。\n" +"間接的な処理の負担が本来の処理の量を上回ると、プログラムが遅くなります。\n" +"過度な抽象化、特に細かすぎる関数やメソッドは避けるべきです。\n" +"こうした関数やメソッドは、読みやすさを損なうこともよくあります。" -#: ../../faq/programming.rst:1115 msgid "" "If you have reached the limit of what pure Python can allow, there are tools " "to take you further away. For example, `Cython `_ can " @@ -2092,12 +2350,14 @@ msgid "" "skills, you can also :ref:`write a C extension module ` " "yourself." msgstr "" -"pure Python にできる限界に達したなら、更に進むためのツールがあります。例え" -"ば、`Cython `_ は、Python コードのわずかに変形した版を C " -"拡張にコンパイルし、多種のプラットフォームで使えます。Cython は、コンパイル " -"(と任意の型アノテーション) を利用し、コードの解釈を大幅に速くします。C プログ" -"ラミングに自信があるなら、自分で :ref:`write a C extension module ` こともできます。" +"Python だけで書いたコードの限界に達したら、さらに性能を上げるためのツールがあ" +"ります。\n" +"例えば `Cython `_ は、Python コードに少し手を加えたもの" +"を C 拡張にコンパイルでき、多くのプラットフォームで使えます。\n" +"Cython はコンパイルと、省略可能な型アノテーションを活用することで、インタープ" +"リタによる実行よりもコードを大幅に高速化できます。\n" +"C のプログラミングに自信があれば、自分で :ref:`C 拡張モジュールを書く " +"` こともできます。" #: ../../faq/programming.rst:1125 msgid "" @@ -2130,13 +2390,16 @@ msgstr "" "多くの :class:`str` オブジェクトを累積するのにおすすめのイディオムは、すべて" "をリストに配置してから最後に :meth:`str.join` を呼び出すことです::" -#: ../../faq/programming.rst:1141 msgid "" "chunks = []\n" "for s in my_strings:\n" " chunks.append(s)\n" "result = ''.join(chunks)" msgstr "" +"chunks = []\n" +"for s in my_strings:\n" +" chunks.append(s)\n" +"result = ''.join(chunks)" #: ../../faq/programming.rst:1146 msgid "(another reasonably efficient idiom is to use :class:`io.StringIO`)" @@ -2152,12 +2415,14 @@ msgstr "" "class:`bytearray` オブジェクトをインプレース結合 (``+=`` 演算子) で拡張するこ" "とです::" -#: ../../faq/programming.rst:1151 msgid "" "result = bytearray()\n" "for b in my_bytes_objects:\n" " result += b" msgstr "" +"result = bytearray()\n" +"for b in my_bytes_objects:\n" +" result += b" #: ../../faq/programming.rst:1157 msgid "Sequences (Tuples/Lists)" @@ -2233,11 +2498,12 @@ msgstr "シーケンスを逆順にイテレートするにはどうしたらい msgid "Use the :func:`reversed` built-in function::" msgstr "組み込み関数 :func:`reversed` を使ってください。" -#: ../../faq/programming.rst:1194 msgid "" "for x in reversed(sequence):\n" " ... # do something with x ..." msgstr "" +"for x in reversed(sequence):\n" +" ... # x を使った処理 ..." #: ../../faq/programming.rst:1197 msgid "" @@ -2259,15 +2525,13 @@ msgstr "Python Cookbook の長い議論に多くの方法があるので参照 msgid "https://code.activestate.com/recipes/52560/" msgstr "https://code.activestate.com/recipes/52560/" -#: ../../faq/programming.rst:1208 msgid "" "If you don't mind reordering the list, sort it and then scan from the end of " "the list, deleting duplicates as you go::" msgstr "" -"リストを並び替えて構わないのなら、ソートした上でリストの最初から最後までを調" -"べ、次のように重複を削除してください::" +"リストの順序を変えてもよければ、ソートしてから末尾から順に調べ、重複を削除し" +"てください。 ::" -#: ../../faq/programming.rst:1211 msgid "" "if mylist:\n" " mylist.sort()\n" @@ -2278,6 +2542,14 @@ msgid "" " else:\n" " last = mylist[i]" msgstr "" +"if mylist:\n" +" mylist.sort()\n" +" last = mylist[-1]\n" +" for i in range(len(mylist)-2, -1, -1):\n" +" if last == mylist[i]:\n" +" del mylist[i]\n" +" else:\n" +" last = mylist[i]" #: ../../faq/programming.rst:1220 msgid "" @@ -2287,9 +2559,8 @@ msgstr "" "リストのすべての要素が集合のキーとして使える (つまり、すべての要素が :term:" "`hashable`) なら、おそらくこのほうが速いです ::" -#: ../../faq/programming.rst:1223 msgid "mylist = list(set(mylist))" -msgstr "" +msgstr "mylist = list(set(mylist))" #: ../../faq/programming.rst:1225 msgid "" @@ -2314,12 +2585,14 @@ msgstr "" "明示的/暗黙的な反復でスライス置換する方が速くて簡単です。こちらは3つのバリ" "エーションです。::" -#: ../../faq/programming.rst:1237 msgid "" "mylist[:] = filter(keep_function, mylist)\n" "mylist[:] = (x for x in mylist if keep_condition)\n" "mylist[:] = [x for x in mylist if keep_condition]" msgstr "" +"mylist[:] = filter(keep_function, mylist)\n" +"mylist[:] = (x for x in mylist if keep_condition)\n" +"mylist[:] = [x for x in mylist if keep_condition]" #: ../../faq/programming.rst:1241 msgid "The list comprehension may be fastest." @@ -2333,9 +2606,8 @@ msgstr "Python で配列を作るにはどうしますか?" msgid "Use a list::" msgstr "リストを使ってください::" -#: ../../faq/programming.rst:1249 msgid "[\"this\", 1, \"is\", \"an\", \"array\"]" -msgstr "" +msgstr "[\"this\", 1, \"is\", \"an\", \"array\"]" #: ../../faq/programming.rst:1251 msgid "" @@ -2365,9 +2637,8 @@ msgstr "" "Lisp 方式の連結リストを得るのに、タプルを使って *cons cells* をエミュレートで" "きます::" -#: ../../faq/programming.rst:1262 msgid "lisp_list = (\"like\", (\"this\", (\"example\", None) ) )" -msgstr "" +msgstr "lisp_list = (\"like\", (\"this\", (\"example\", None) ) )" #: ../../faq/programming.rst:1264 msgid "" @@ -2389,42 +2660,44 @@ msgstr "多次元のリストを作るにはどうしますか?" msgid "You probably tried to make a multidimensional array like this::" msgstr "このようにして多次元の配列を作ろうとしてしまったことがあるでしょう::" -#: ../../faq/programming.rst:1277 msgid ">>> A = [[None] * 2] * 3" -msgstr "" +msgstr ">>> A = [[None] * 2] * 3" #: ../../faq/programming.rst:1279 msgid "This looks correct if you print it:" msgstr "これを表示したときには問題なさそうに見えます:" -#: ../../faq/programming.rst:1285 msgid "" ">>> A\n" "[[None, None], [None, None], [None, None]]" msgstr "" +">>> A\n" +"[[None, None], [None, None], [None, None]]" #: ../../faq/programming.rst:1290 msgid "But when you assign a value, it shows up in multiple places:" msgstr "しかし値を代入すると、その値が複数の場所に現れてしまいます:" -#: ../../faq/programming.rst:1296 msgid "" ">>> A[0][0] = 5\n" ">>> A\n" "[[5, None], [5, None], [5, None]]" msgstr "" +">>> A[0][0] = 5\n" +">>> A\n" +"[[5, None], [5, None], [5, None]]" -#: ../../faq/programming.rst:1302 msgid "" "The reason is that replicating a list with ``*`` doesn't create copies, it " "only creates references to the existing objects. The ``*3`` creates a list " "containing 3 references to the same list of length two. Changes to one row " "will show in all rows, which is almost certainly not what you want." msgstr "" -"これは、``*`` を使ったリストの複製がコピーを作らず、存在するオブジェクトへの" -"参照を作るだけだからです。この ``*3`` は長さ 2 の同じリストへの参照を含むリス" -"トを作ります。一つの列に対する変更はすべての列に現れますが、これが望んだ結果" -"であることはまずないでしょう。" +"``*`` によるリストの繰り返しは、要素のコピーではなく既存のオブジェクトへの参" +"照を作るためです。\n" +"``*3`` は、長さ 2 の同じリストへの参照を 3 つ含むリストを作ります。\n" +"1 つの行を変更するとすべての行に反映されますが、これが意図した結果であること" +"はまずないでしょう。" #: ../../faq/programming.rst:1307 msgid "" @@ -2434,12 +2707,14 @@ msgstr "" "おすすめの方法は、最初に望んだ長さのリストを作り、それから新しく作ったリスト" "でそれぞれの要素を埋めていくことです::" -#: ../../faq/programming.rst:1310 msgid "" "A = [None] * 3\n" "for i in range(3):\n" " A[i] = [None] * 2" msgstr "" +"A = [None] * 3\n" +"for i in range(3):\n" +" A[i] = [None] * 2" #: ../../faq/programming.rst:1314 msgid "" @@ -2449,11 +2724,12 @@ msgstr "" "これは長さ 2 の異なるリスト 3 つを含むリストを生成します。リスト内包表記も使" "えます::" -#: ../../faq/programming.rst:1317 msgid "" "w, h = 2, 3\n" "A = [[None] * w for i in range(h)]" msgstr "" +"w, h = 2, 3\n" +"A = [[None] * w for i in range(h)]" #: ../../faq/programming.rst:1320 msgid "" @@ -2475,12 +2751,14 @@ msgstr "" "メソッドや関数を呼び出して結果を蓄積するのには、 :term:`list comprehension` " "(リスト内包表記) がエレガントな解決策です::" -#: ../../faq/programming.rst:1330 msgid "" "result = [obj.method() for obj in mylist]\n" "\n" "result = [function(obj) for obj in mylist]" msgstr "" +"result = [obj.method() for obj in mylist]\n" +"\n" +"result = [function(obj) for obj in mylist]" #: ../../faq/programming.rst:1334 msgid "" @@ -2490,7 +2768,6 @@ msgstr "" "戻り値を保存せずにメソッドや関数を実行するだけなら、ただの :keyword:`for` " "ループで十分です::" -#: ../../faq/programming.rst:1337 msgid "" "for obj in mylist:\n" " obj.method()\n" @@ -2498,6 +2775,11 @@ msgid "" "for obj in mylist:\n" " function(obj)" msgstr "" +"for obj in mylist:\n" +" obj.method()\n" +"\n" +"for obj in mylist:\n" +" function(obj)" #: ../../faq/programming.rst:1346 msgid "" @@ -2526,7 +2808,6 @@ msgstr "" msgid "If you wrote::" msgstr "次のように書いたとします::" -#: ../../faq/programming.rst:1358 msgid "" ">>> a_tuple = (1, 2)\n" ">>> a_tuple[0] += 1\n" @@ -2534,8 +2815,12 @@ msgid "" " ...\n" "TypeError: 'tuple' object does not support item assignment" msgstr "" +">>> a_tuple = (1, 2)\n" +">>> a_tuple[0] += 1\n" +"Traceback (most recent call last):\n" +" ...\n" +"TypeError: 'tuple' object does not support item assignment" -#: ../../faq/programming.rst:1364 msgid "" "The reason for the exception should be immediately clear: ``1`` is added to " "the object ``a_tuple[0]`` points to (``1``), producing the result object, " @@ -2543,10 +2828,12 @@ msgid "" "to element ``0`` of the tuple, we get an error because we can't change what " "an element of a tuple points to." msgstr "" -"例外が送出された理由は明らかです: ``1`` が (``1``) を指すオブジェクト " -"``a_tuple[0]`` に加えられ、結果のオブジェクト ``2`` が生成されますが、計算結" -"果 ``2`` をタプルの第 ``0`` 要素に代入しようとしたときに、エラーが発生しま" -"す。なぜならば、タプルの要素が何を指すかは変えられないからです。" +"例外の理由は明らかでしょう。\n" +"``a_tuple[0]`` が指すオブジェクト (``1``) に ``1`` を加えると、結果のオブジェ" +"クト ``2`` が作られます。\n" +"しかし、計算結果の ``2`` をタプルのインデックス ``0`` の要素に代入しようとす" +"るとエラーになります。\n" +"タプルの要素が指すオブジェクトは変更できないためです。" #: ../../faq/programming.rst:1370 msgid "" @@ -2554,7 +2841,6 @@ msgid "" "approximately this::" msgstr "このような裏事情の元、累算代入文はだいたい次のようなことをしています::" -#: ../../faq/programming.rst:1373 msgid "" ">>> result = a_tuple[0] + 1\n" ">>> a_tuple[0] = result\n" @@ -2562,6 +2848,11 @@ msgid "" " ...\n" "TypeError: 'tuple' object does not support item assignment" msgstr "" +">>> result = a_tuple[0] + 1\n" +">>> a_tuple[0] = result\n" +"Traceback (most recent call last):\n" +" ...\n" +"TypeError: 'tuple' object does not support item assignment" #: ../../faq/programming.rst:1379 msgid "" @@ -2573,7 +2864,6 @@ msgstr "タプルは不変なので、例外を生み出しているのは操作 msgid "When you write something like::" msgstr "次のように書いたとします::" -#: ../../faq/programming.rst:1384 msgid "" ">>> a_tuple = (['foo'], 'bar')\n" ">>> a_tuple[0] += ['item']\n" @@ -2581,6 +2871,11 @@ msgid "" " ...\n" "TypeError: 'tuple' object does not support item assignment" msgstr "" +">>> a_tuple = (['foo'], 'bar')\n" +">>> a_tuple[0] += ['item']\n" +"Traceback (most recent call last):\n" +" ...\n" +"TypeError: 'tuple' object does not support item assignment" #: ../../faq/programming.rst:1390 msgid "" @@ -2590,11 +2885,12 @@ msgstr "" "この例外にはちょっと驚きますが、もっと驚くべきことは、エラーがあったとしても" "追記はきちんと動いている、という事実です::" -#: ../../faq/programming.rst:1393 msgid "" ">>> a_tuple[0]\n" "['foo', 'item']" msgstr "" +">>> a_tuple[0]\n" +"['foo', 'item']" #: ../../faq/programming.rst:1396 msgid "" @@ -2612,23 +2908,27 @@ msgstr "" "で、リストを返します。こんな理由で、リストでは ``+=`` は :meth:`!list." "extend` の \"略記\" だと言ったのでした::" -#: ../../faq/programming.rst:1404 msgid "" ">>> a_list = []\n" ">>> a_list += [1]\n" ">>> a_list\n" "[1]" msgstr "" +">>> a_list = []\n" +">>> a_list += [1]\n" +">>> a_list\n" +"[1]" #: ../../faq/programming.rst:1409 msgid "This is equivalent to::" msgstr "これは次と等価です::" -#: ../../faq/programming.rst:1411 msgid "" ">>> result = a_list.__iadd__([1])\n" ">>> a_list = result" msgstr "" +">>> result = a_list.__iadd__([1])\n" +">>> a_list = result" #: ../../faq/programming.rst:1414 msgid "" @@ -2646,7 +2946,6 @@ msgstr "" msgid "Thus, in our tuple example what is happening is equivalent to::" msgstr "従って、今のタプルの例では、次のと同じことが起きています::" -#: ../../faq/programming.rst:1421 msgid "" ">>> result = a_tuple[0].__iadd__(['item'])\n" ">>> a_tuple[0] = result\n" @@ -2654,6 +2953,11 @@ msgid "" " ...\n" "TypeError: 'tuple' object does not support item assignment" msgstr "" +">>> result = a_tuple[0].__iadd__(['item'])\n" +">>> a_tuple[0] = result\n" +"Traceback (most recent call last):\n" +" ...\n" +"TypeError: 'tuple' object does not support item assignment" #: ../../faq/programming.rst:1427 msgid "" @@ -2684,11 +2988,12 @@ msgstr "" "ます。Python では、 :meth:`list.sort` メソッドに ``key`` 引数を使ってくださ" "い::" -#: ../../faq/programming.rst:1439 msgid "" "Isorted = L[:]\n" "Isorted.sort(key=lambda s: int(s[10:15]))" msgstr "" +"Isorted = L[:]\n" +"Isorted.sort(key=lambda s: int(s[10:15]))" #: ../../faq/programming.rst:1444 msgid "How can I sort one list by values from another list?" @@ -2724,17 +3029,17 @@ msgstr "オブジェクト" msgid "What is a class?" msgstr "クラスとは何ですか?" -#: ../../faq/programming.rst:1466 msgid "" "A class is the particular object type created by executing a class " "statement. Class objects are used as templates to create instance objects, " "which embody both the data (attributes) and code (methods) specific to a " "datatype." msgstr "" -"クラスは、class 文の実行で生成される特殊なオブジェクトです。クラスオブジェク" -"トはインスタンスオブジェクトを生成するためのテンプレートとして使われ、ある" -"データ型に特有のデータ (attribute/属性) とコード (メソッド) の両方を内蔵して" -"います。" +"クラスは class 文の実行によって作られる、特定の種類のオブジェクトです。\n" +"クラスオブジェクトはインスタンスオブジェクトを作るためのテンプレートとして使" +"われます。\n" +"インスタンスオブジェクトは、そのデータ型に固有のデータ (属性) とコード (メ" +"ソッド) の両方を備えています。" #: ../../faq/programming.rst:1470 msgid "" @@ -2765,12 +3070,14 @@ msgstr "" "メソッドは、オブジェクト ``x`` が持つ関数で、通常 ``x.name(arguments...)`` と" "して呼び出されるものです。メソッドはクラス定義の中で関数として定義されます::" -#: ../../faq/programming.rst:1485 msgid "" "class C:\n" " def meth(self, arg):\n" " return arg * 2 + self.attribute" msgstr "" +"class C:\n" +" def meth(self, arg):\n" +" return arg * 2 + self.attribute" #: ../../faq/programming.rst:1491 msgid "What is self?" @@ -2827,7 +3134,6 @@ msgstr "" "的にそれを継承していなくても ``True`` を返します。「真のインスタンス」をテス" "トする場合は、クラスの :term:`MRO` を調べます:" -#: ../../faq/programming.rst:1516 msgid "" "from collections.abc import Mapping\n" "\n" @@ -2839,8 +3145,16 @@ msgid "" "\n" "Mapping.register(P)" msgstr "" +"from collections.abc import Mapping\n" +"\n" +"class P:\n" +" pass\n" +"\n" +"class C(P):\n" +" pass\n" +"\n" +"Mapping.register(P)" -#: ../../faq/programming.rst:1528 msgid "" ">>> c = C()\n" ">>> isinstance(c, C) # direct\n" @@ -2858,8 +3172,22 @@ msgid "" ">>> Mapping in type(c).__mro__\n" "False" msgstr "" +">>> c = C()\n" +">>> isinstance(c, C) # 直接\n" +"True\n" +">>> isinstance(c, P) # 間接\n" +"True\n" +">>> isinstance(c, Mapping) # 仮想\n" +"True\n" +"\n" +"# 実際の継承関係\n" +">>> type(c).__mro__\n" +"(, , )\n" +"\n" +"# 「実際の継承」を調べる\n" +">>> Mapping in type(c).__mro__\n" +"False" -#: ../../faq/programming.rst:1546 msgid "" "Note that most programs do not use :func:`isinstance` on user-defined " "classes very often. If you are developing the classes yourself, a more " @@ -2868,13 +3196,13 @@ msgid "" "and doing a different thing based on what class it is. For example, if you " "have a function that does something::" msgstr "" -"なお、大部分のプログラムでは、 :func:`isinstance` をユーザー定義のクラスに何" -"度も使うべきではありません。クラスを自分で開発するときに、適切なオブジェクト" -"指向スタイルは、特定の振る舞いをカプセル化するクラスのメソッドを定義するもの" -"であって、オブジェクトのクラスを調べてそのクラスに応じて違うことをするもので" -"はありません。例えば、何かをする関数があったとして::" +"なお、ほとんどのプログラムでは、ユーザー定義のクラスに対して :func:" +"`isinstance` を頻繁には使いません。\n" +"自分でクラスを開発するなら、オブジェクトのクラスを調べて処理を分岐させるより" +"も、各クラスに特定の振る舞いをカプセル化するメソッドを定義するほうが、オブ" +"ジェクト指向に適した書き方です。\n" +"例えば、次のような関数があるとします。 ::" -#: ../../faq/programming.rst:1553 msgid "" "def search(obj):\n" " if isinstance(obj, Mailbox):\n" @@ -2883,6 +3211,12 @@ msgid "" " ... # code to search a document\n" " elif ..." msgstr "" +"def search(obj):\n" +" if isinstance(obj, Mailbox):\n" +" ... # メールボックスを検索するコード\n" +" elif isinstance(obj, Document):\n" +" ... # 文書を検索するコード\n" +" elif ..." #: ../../faq/programming.rst:1560 msgid "" @@ -2892,7 +3226,6 @@ msgstr "" "よりよいアプローチは、``search()`` メソッドをすべてのクラスに定義して、それを" "ただ呼び出すことです::" -#: ../../faq/programming.rst:1563 msgid "" "class Mailbox:\n" " def search(self):\n" @@ -2904,6 +3237,15 @@ msgid "" "\n" "obj.search()" msgstr "" +"class Mailbox:\n" +" def search(self):\n" +" ... # メールボックスを検索するコード\n" +"\n" +"class Document:\n" +" def search(self):\n" +" ... # 文書を検索するコード\n" +"\n" +"obj.search()" #: ../../faq/programming.rst:1575 msgid "What is delegation?" @@ -2923,16 +3265,15 @@ msgstr "" "新しく実装し、他のすべてのメソッドを ``x`` の対応するメソッドに委譲する新しい" "クラスを作れます。" -#: ../../faq/programming.rst:1583 msgid "" "Python programmers can easily implement delegation. For example, the " "following class implements a class that behaves like a file but converts all " "written data to uppercase::" msgstr "" -"Python プログラマは簡単に委譲を実装できます。例えば、以下のクラスは、ファイル" -"のように振る舞いながらすべての文字を大文字に変換するクラスを実装します::" +"Python では委譲を簡単に実装できます。\n" +"例えば、次のクラスはファイルのように振る舞いますが、書き込まれるデータをすべ" +"て大文字に変換します。 ::" -#: ../../faq/programming.rst:1587 msgid "" "class UpperOut:\n" "\n" @@ -2945,6 +3286,16 @@ msgid "" " def __getattr__(self, name):\n" " return getattr(self._outfile, name)" msgstr "" +"class UpperOut:\n" +"\n" +" def __init__(self, outfile):\n" +" self._outfile = outfile\n" +"\n" +" def write(self, s):\n" +" self._outfile.write(s.upper())\n" +"\n" +" def __getattr__(self, name):\n" +" return getattr(self._outfile, name)" #: ../../faq/programming.rst:1598 msgid "" @@ -2962,7 +3313,6 @@ msgstr "" "されます。属性の制御の詳細は :ref:`言語リファレンス ` を参" "照してください。" -#: ../../faq/programming.rst:1605 msgid "" "Note that for more general cases delegation can get trickier. When " "attributes must be set as well as retrieved, the class must define a :meth:" @@ -2970,12 +3320,11 @@ msgid "" "implementation of :meth:`!__setattr__` is roughly equivalent to the " "following::" msgstr "" -"なお、一般的に委譲はトリッキーになりがちです。属性が設定される時には読み出さ" -"れる時と同様に、そのクラスに :meth:`~object.__setattr__` メソッドを定義する必" -"要があり、それには細心の注意が必要です。 :meth:`!__setattr__` の基本的な実装" -"はおおよそ以下のようになります::" +"より一般的な場合には、委譲が複雑になることがあります。\n" +"属性の取得だけでなく設定も扱うには、クラスに :meth:`~object.__setattr__` メ" +"ソッドも定義する必要があり、その実装には注意が必要です。\n" +":meth:`!__setattr__` の基本的な実装は、おおよそ次と同じです。 ::" -#: ../../faq/programming.rst:1610 msgid "" "class X:\n" " ...\n" @@ -2983,26 +3332,36 @@ msgid "" " self.__dict__[name] = value\n" " ..." msgstr "" +"class X:\n" +" ...\n" +" def __setattr__(self, name, value):\n" +" self.__dict__[name] = value\n" +" ..." -#: ../../faq/programming.rst:1616 msgid "" "Many :meth:`~object.__setattr__` implementations call :meth:`!object." "__setattr__` to set an attribute on self without causing infinite recursion::" msgstr "" +":meth:`~object.__setattr__` の多くの実装では、無限再帰を起こさずに ``self`` " +"の属性を設定するため、:meth:`!object.__setattr__` を呼び出します。 ::" -#: ../../faq/programming.rst:1619 msgid "" "class X:\n" " def __setattr__(self, name, value):\n" " # Custom logic here...\n" " object.__setattr__(self, name, value)" msgstr "" +"class X:\n" +" def __setattr__(self, name, value):\n" +" # ここに独自の処理を書く...\n" +" object.__setattr__(self, name, value)" -#: ../../faq/programming.rst:1624 msgid "" "Alternatively, it is possible to set attributes by inserting entries into :" "attr:`self.__dict__ ` directly." msgstr "" +":attr:`self.__dict__ ` に直接エントリーを追加して属性を設定" +"することもできます。" #: ../../faq/programming.rst:1629 msgid "" @@ -3016,14 +3375,15 @@ msgstr "" msgid "Use the built-in :func:`super` function::" msgstr "組み込みの :func:`super` 関数を使ってください::" -#: ../../faq/programming.rst:1633 msgid "" "class Derived(Base):\n" " def meth(self):\n" " super().meth() # calls Base.meth" msgstr "" +"class Derived(Base):\n" +" def meth(self):\n" +" super().meth() # Base.meth を呼び出す" -#: ../../faq/programming.rst:1637 msgid "" "In the example, :func:`super` will automatically determine the instance from " "which it was called (the ``self`` value), look up the :term:`method " @@ -3032,11 +3392,10 @@ msgid "" msgstr "" "この例では、 :func:`super` は呼ばれたインスタンス (``self`` の値) を自動判断" "し、 ``type(self).__mro__`` で :term:`method resolution order` (MRO メソッド" -"解決順) を検索し、そしてMRO内で ``Derived`` の次行を返します: ``Base`` 。" +"解決順) を検索し、MRO で ``Derived`` の次にある ``Base`` を返します。" -#: ../../faq/programming.rst:1644 msgid "How can I organize my code to make it easier to change the base class?" -msgstr "基底クラスの名前を変えやすいコードを書くにはどうしますか?" +msgstr "基底クラスを変更しやすいようにコードを構成するにはどうしますか?" #: ../../faq/programming.rst:1646 msgid "" @@ -3050,7 +3409,6 @@ msgstr "" "す。ちなみに、この手法は使用する基底クラスを動的に選びたいとき、例えば使える" "リソースによって選びたいときなどにも便利です。例::" -#: ../../faq/programming.rst:1651 msgid "" "class Base:\n" " ...\n" @@ -3060,6 +3418,13 @@ msgid "" "class Derived(BaseAlias):\n" " ..." msgstr "" +"class Base:\n" +" ...\n" +"\n" +"BaseAlias = Base\n" +"\n" +"class Derived(BaseAlias):\n" +" ..." #: ../../faq/programming.rst:1661 msgid "How do I create static class data and static class methods?" @@ -3081,7 +3446,6 @@ msgstr "" "静的なデータを作るには、単純にクラス属性を定義してください。その属性に新しい" "値を代入するには、代入するクラス名を明示する必要があります::" -#: ../../faq/programming.rst:1669 msgid "" "class C:\n" " count = 0 # number of times C.__init__ called\n" @@ -3092,6 +3456,14 @@ msgid "" " def getcount(self):\n" " return C.count # or return self.count" msgstr "" +"class C:\n" +" count = 0 # C.__init__ が呼び出された回数\n" +"\n" +" def __init__(self):\n" +" C.count = C.count + 1\n" +"\n" +" def getcount(self):\n" +" return C.count # または return self.count" #: ../../faq/programming.rst:1678 msgid "" @@ -3115,15 +3487,13 @@ msgstr "" "静的なデータの再束縛には、メソッド内であるか否かにかかわらず、いつもクラスを" "指定しなければなりません::" -#: ../../faq/programming.rst:1687 msgid "C.count = 314" -msgstr "" +msgstr "C.count = 314" #: ../../faq/programming.rst:1689 msgid "Static methods are possible::" msgstr "静的メソッドが使えます::" -#: ../../faq/programming.rst:1691 msgid "" "class C:\n" " @staticmethod\n" @@ -3131,6 +3501,11 @@ msgid "" " # No 'self' parameter!\n" " ..." msgstr "" +"class C:\n" +" @staticmethod\n" +" def static(arg1, arg2, arg3):\n" +" # 'self' 仮引数はない!\n" +" ..." #: ../../faq/programming.rst:1697 msgid "" @@ -3140,20 +3515,19 @@ msgstr "" "しかし、静的メソッドの効果を得るもっと簡単な方法は、単にモジュールレベル関数" "を使うことです::" -#: ../../faq/programming.rst:1700 msgid "" "def getcount():\n" " return C.count" msgstr "" +"def getcount():\n" +" return C.count" -#: ../../faq/programming.rst:1703 msgid "" "If your code is structured so as to define one class (or tightly related " "class hierarchy) per module, this supplies the desired encapsulation." msgstr "" -"モジュールあたりに一つのクラスを定義するように (あるいはクラス組織を厳密に関" -"連させるように) コードが構成されているなら、これで必要なカプセル化ができま" -"す。" +"モジュールごとに 1 つのクラス、または密接に関連するクラス階層を定義する構成な" +"ら、この方法で必要なカプセル化を実現できます。" #: ../../faq/programming.rst:1708 msgid "How can I overload constructors (or methods) in Python?" @@ -3161,25 +3535,27 @@ msgstr "" "Python でコンストラクタ(やメソッド)をオーバーロードするにはどうしたらいいです" "か?" -#: ../../faq/programming.rst:1710 msgid "" "This answer actually applies to all methods, but the question usually comes " "up first in the context of constructors." msgstr "" -"この質問の答えはすべてのメソッドについて言えることですが、この質問はだいたい" -"以下の構造の文脈から出てきます。" +"この回答は実際にはすべてのメソッドに当てはまりますが、通常、この疑問が最初に" +"生じるのはコンストラクタについてです。" #: ../../faq/programming.rst:1713 msgid "In C++ you'd write" msgstr "C++ では、このように書けます" -#: ../../faq/programming.rst:1715 msgid "" "class C {\n" " C() { cout << \"No arguments\\n\"; }\n" " C(int i) { cout << \"Argument is \" << i << \"\\n\"; }\n" "}" msgstr "" +"class C {\n" +" C() { cout << \"No arguments\\n\"; }\n" +" C(int i) { cout << \"Argument is \" << i << \"\\n\"; }\n" +"}" #: ../../faq/programming.rst:1722 msgid "" @@ -3189,7 +3565,6 @@ msgstr "" "Python では、一つのコンストラクタでデフォルトの引数を使ってすべての場合に対応" "するように書かなければなりません。例えば::" -#: ../../faq/programming.rst:1725 msgid "" "class C:\n" " def __init__(self, i=None):\n" @@ -3198,6 +3573,12 @@ msgid "" " else:\n" " print(\"Argument is\", i)" msgstr "" +"class C:\n" +" def __init__(self, i=None):\n" +" if i is None:\n" +" print(\"No arguments\")\n" +" else:\n" +" print(\"Argument is\", i)" #: ../../faq/programming.rst:1732 msgid "This is not entirely equivalent, but close enough in practice." @@ -3207,19 +3588,19 @@ msgstr "これで完全に等価とは言えませんが、実用上は十分に msgid "You could also try a variable-length argument list, e.g. ::" msgstr "長さが変えられる引数のリストを試すには、例えば ::" -#: ../../faq/programming.rst:1736 msgid "" "def __init__(self, *args):\n" " ..." msgstr "" +"def __init__(self, *args):\n" +" ..." #: ../../faq/programming.rst:1739 msgid "The same approach works for all method definitions." msgstr "これと同じやり方がすべてのメソッド定義で使えます。" -#: ../../faq/programming.rst:1743 msgid "I try to use __spam and I get an error about _SomeClassName__spam." -msgstr "__spam を使おうとしたら _SomeClassName__spam からエラーがでました。" +msgstr "__spam を使おうとすると、_SomeClassName__spam に関するエラーが出ます。" #: ../../faq/programming.rst:1745 msgid "" @@ -3236,13 +3617,13 @@ msgstr "" "子は、``classname`` が先頭のアンダースコアをすべて削除した現在のクラス名とす" "れば、``_classname__spam`` のように文字上で置換えられます。" -#: ../../faq/programming.rst:1751 msgid "" "The identifier can be used unchanged within the class, but to access it " "outside the class, the mangled name must be used:" msgstr "" +"クラス内では識別子をそのまま使えますが、クラス外からアクセスするにはマングル" +"化された名前を使う必要があります。" -#: ../../faq/programming.rst:1754 msgid "" "class A:\n" " def __one(self):\n" @@ -3256,13 +3637,26 @@ msgid "" "\n" "four = 4 * A()._A__one()" msgstr "" +"class A:\n" +" def __one(self):\n" +" return 1\n" +" def two(self):\n" +" return 2 * self.__one()\n" +"\n" +"class B(A):\n" +" def three(self):\n" +" return 3 * self._A__one()\n" +"\n" +"four = 4 * A()._A__one()" -#: ../../faq/programming.rst:1768 msgid "" "In particular, this does not guarantee privacy since an outside user can " "still deliberately access the private attribute; many Python programmers " "never bother to use private variable names at all." msgstr "" +"特に、この仕組みはプライバシーを保証するものではありません。\n" +"外部の利用者が意図的にプライベート属性にアクセスすることは可能です。\n" +"Python プログラマの多くは、プライベートな変数名をあえて使うことはしません。" #: ../../faq/programming.rst:1774 msgid "" @@ -3315,7 +3709,6 @@ msgstr "" "順序は任意です。 :func:`gc.collect` を起動して収集を強制することができます" "が、オブジェクトが決して回収されないような本当に病的な場合も *あります* 。" -#: ../../faq/programming.rst:1797 msgid "" "Despite the cycle collector, it's still a good idea to define an explicit " "``close()`` method on objects to be called whenever you're done with them. " @@ -3324,13 +3717,12 @@ msgid "" "``close()`` and ``close()`` should make sure that it can be called more than " "once for the same object." msgstr "" -"循環参照コレクタがあるとはいえ、オブジェクトに ``close()`` メソッドを明示的に" -"定義し、使い終わったらいつでも呼び出せるようにするのはいいことです。\n" -"``close()`` メソッドを使うと、サブオブジェクトを参照している属性を取り除けま" -"す。\n" -":meth:`!__del__` を直接呼び出さないでください -- :meth:`!__del__` は " -"``close()`` を呼び出すでしょうし、 ``close()`` なら同じオブジェクトに対して複" -"数回呼ばれてもいいことが保証されているでしょう。" +"循環参照を回収する仕組みがあっても、オブジェクトには明示的な ``close()`` メ" +"ソッドを定義し、使い終わったときに呼び出すようにするとよいでしょう。\n" +"``close()`` メソッドでは、下位のオブジェクトを参照する属性を削除できます。\n" +":meth:`!__del__` を直接呼び出さないでください。\n" +":meth:`!__del__` から ``close()`` を呼び出し、``close()`` は同じオブジェクト" +"に対して複数回呼び出せるように実装してください。" #: ../../faq/programming.rst:1804 msgid "" @@ -3383,16 +3775,16 @@ msgstr "" "はメモリの同じ場所にメモリ領域を確保されていることが、しばしば起きます。この" "現象を次の例で示しましょう:" -#: ../../faq/programming.rst:1843 msgid "" "The two ids belong to different integer objects that are created before, and " "deleted immediately after execution of the ``id()`` call. To be sure that " "objects whose id you want to examine are still alive, create another " "reference to the object:" msgstr "" -"2 つの同じ値を持つ id は ``id()`` の実行の前に作られてすぐさま削除された異な" -"る整数オブジェクトによるものです。id を調べたいオブジェクトがまだ生きてること" -"を保証したいなら、オブジェクトへの別の参照を作ってください:" +"この 2 つの id は、それぞれ ``id()`` の呼び出し前に作られ、呼び出しの実行直後" +"に削除された、異なる整数オブジェクトのものです。\n" +"id を調べるオブジェクトがまだ生存していることを保証するには、そのオブジェクト" +"への別の参照を作ってください。" #: ../../faq/programming.rst:1856 msgid "When can I rely on identity tests with the *is* operator?" @@ -3416,7 +3808,7 @@ msgstr "" "同一性テストの最も重要な特性は、オブジェクトは常にそれ自身と同一であり、 ``a " "is a`` は常に ``True`` を返すということです。 同一性テストは通常、等価性テス" "トよりも高速です。 また、等価性テストとは異なり、同一性テストは真偽値 " -"``True`` または``False`` を返すことが保証されています。" +"``True`` または ``False`` を返すことが保証されています。" #: ../../faq/programming.rst:1866 msgid "" @@ -3428,25 +3820,30 @@ msgstr "" "保証されている場合 *のみ* です。 一般的に、同一性が保証される状況は3つありま" "す:" -#: ../../faq/programming.rst:1870 msgid "" "Assignments create new names but do not change object identity. After the " "assignment ``new = old``, it is guaranteed that ``new is old``." msgstr "" +"代入は新しい名前を作りますが、オブジェクトの同一性は変えません。\n" +"``new = old`` と代入した後は、``new is old`` が保証されます。" -#: ../../faq/programming.rst:1873 msgid "" "Putting an object in a container that stores object references does not " "change object identity. After the list assignment ``s[0] = x``, it is " "guaranteed that ``s[0] is x``." msgstr "" +"オブジェクトへの参照を格納するコンテナにオブジェクトを入れても、その同一性は" +"変わりません。\n" +"リストへの代入 ``s[0] = x`` の後は、``s[0] is x`` が保証されます。" -#: ../../faq/programming.rst:1877 msgid "" "If an object is a singleton, it means that only one instance of that object " "can exist. After the assignments ``a = None`` and ``b = None``, it is " "guaranteed that ``a is b`` because ``None`` is a singleton." msgstr "" +"シングルトンのオブジェクトは、インスタンスが 1 つしか存在できません。\n" +"``None`` はシングルトンなので、``a = None`` と ``b = None`` を代入した後は、" +"``a is b`` が保証されます。" #: ../../faq/programming.rst:1881 msgid "" @@ -3479,13 +3876,16 @@ msgid "Likewise, new instances of mutable containers are never identical::" msgstr "" "同様に、ミュータブルなコンテナの新しいインスタンスは同一ではありません::" -#: ../../faq/programming.rst:1900 msgid "" ">>> a = []\n" ">>> b = []\n" ">>> a is b\n" "False" msgstr "" +">>> a = []\n" +">>> b = []\n" +">>> a is b\n" +"False" #: ../../faq/programming.rst:1905 msgid "" @@ -3495,12 +3895,15 @@ msgstr "" "標準ライブラリのコードには、同一性テストを正しく使うための一般的なパターンが" "あります:" -#: ../../faq/programming.rst:1908 msgid "" "As recommended by :pep:`8`, an identity test is the preferred way to check " "for ``None``. This reads like plain English in code and avoids confusion " "with other objects that may have boolean values that evaluate to false." msgstr "" +":pep:`8` が推奨するとおり、``None`` かどうかを調べるには同一性テストを使うの" +"が望ましい方法です。\n" +"コードを自然な英語として読めるうえ、真偽値が偽と評価されるほかのオブジェクト" +"との混同も避けられます。" #: ../../faq/programming.rst:1912 msgid "" @@ -3509,6 +3912,10 @@ msgid "" "guaranteed to be distinct from other objects. For example, here is how to " "implement a method that behaves like :meth:`dict.pop`:" msgstr "" +"オプション引数の検出は、 ``None`` が有効な入力値である場合に厄介なことになる" +"場合があります。この状況では、他のオブジェクトと必ず区別できる唯一のマーカー" +"オブジェクト( singleton sentinel object )を作ることで対策できます。例え" +"ば、 :meth:`dict.pop` のように振る舞うメソッドを実装する方法を示します:" #: ../../faq/programming.rst:1917 msgid "" @@ -3523,6 +3930,16 @@ msgid "" " raise KeyError(key)\n" " return default" msgstr "" +"_sentinel = object()\n" +"\n" +"def pop(self, key, default=_sentinel):\n" +" if key in self:\n" +" value = self[key]\n" +" del self[key]\n" +" return value\n" +" if default is _sentinel:\n" +" raise KeyError(key)\n" +" return default" #: ../../faq/programming.rst:1930 msgid "" @@ -3530,15 +3947,17 @@ msgid "" "identity tests. This prevents the code from being confused by objects such " "as ``float('NaN')`` that are not equal to themselves." msgstr "" +"コンテナの実装では、等価性テストを同一性テストで補強する必要がある場合があり" +"ます。これは、 ``float('NaN')`` のような自分自身と等しくないオブジェクトに" +"よってコードが混乱するのを防ぎます。" -#: ../../faq/programming.rst:1934 msgid "" "For example, here is the implementation of :meth:`!collections.abc.Sequence." "__contains__`::" msgstr "" -"例えば、これは :meth:`!collections.abc.Sequence.__contains__`: の実装です:" +"例えば、:meth:`!collections.abc.Sequence.__contains__` の実装は次のとおりで" +"す。 ::" -#: ../../faq/programming.rst:1937 msgid "" "def __contains__(self, value):\n" " for v in self:\n" @@ -3546,6 +3965,11 @@ msgid "" " return True\n" " return False" msgstr "" +"def __contains__(self, value):\n" +" for v in self:\n" +" if v is value or v == value:\n" +" return True\n" +" return False" #: ../../faq/programming.rst:1945 msgid "" @@ -3554,17 +3978,16 @@ msgstr "" "どうすればサブクラスはイミュータブルなインスタンスに格納されたデータを制御で" "きますか?" -#: ../../faq/programming.rst:1947 msgid "" "When subclassing an immutable type, override the :meth:`~object.__new__` " "method instead of the :meth:`~object.__init__` method. The latter only runs " "*after* an instance is created, which is too late to alter data in an " "immutable instance." msgstr "" -"イミュータブル型をサブクラス化する場合、 :meth:`~object.__init__` ではなく :" -"meth:`~object.__new__` メソッドを継承します。 前者はインスタンスが生成され" -"た *後* に動くため、イミュータブルなインスタンスのデータを変えるには遅すぎま" -"す。" +"イミュータブルな型のサブクラスを作る場合は、:meth:`~object.__init__` ではな" +"く :meth:`~object.__new__` メソッドをオーバーライドしてください。\n" +"``__init__()`` が実行されるのはインスタンスが作られた *後* なので、イミュータ" +"ブルなインスタンスのデータを変更するには遅すぎます。" #: ../../faq/programming.rst:1952 msgid "" @@ -3601,7 +4024,6 @@ msgstr "" msgid "The classes can be used like this:" msgstr "クラスはこのように使えます:" -#: ../../faq/programming.rst:1980 msgid "" ">>> FirstOfMonthDate(2012, 2, 14)\n" "FirstOfMonthDate(2012, 2, 1)\n" @@ -3612,6 +4034,14 @@ msgid "" ">>> TitleStr('Blog: Why Python Rocks')\n" "'blog-why-python-rocks'" msgstr "" +">>> FirstOfMonthDate(2012, 2, 14)\n" +"FirstOfMonthDate(2012, 2, 1)\n" +">>> NamedInt('ten')\n" +"10\n" +">>> NamedInt(20)\n" +"20\n" +">>> TitleStr('Blog: Why Python Rocks')\n" +"'blog-why-python-rocks'" #: ../../faq/programming.rst:1995 msgid "How do I cache method calls?" @@ -3658,22 +4088,20 @@ msgstr "" "weak references を渡すための特別な努力がない限り、インスタンスへの参照を作り" "ます。" -#: ../../faq/programming.rst:2015 msgid "" "The advantage of the least recently used algorithm is that the cache is " "bounded by the specified *maxsize*. The disadvantage is that instances are " "kept alive until they age out of the cache or until the cache is cleared." msgstr "" -"least recently used アルゴリズム(訳注:LRU 直近に使われたものを残す)の利点" -"は、キャッシュが指定された *maxsize* で制限されることです。欠点は、キャッシュ" -"から期限切れで追い出されるかクリアされるまで、インスタンスが生き続けることで" -"す。" +"LRU (最も長く使われていないものから削除する) アルゴリズムの利点は、指定され" +"た *maxsize* でキャッシュの大きさを制限できることです。\n" +"欠点は、長く使われずにキャッシュから追い出されるか、キャッシュが消去されるま" +"で、インスタンスが生存し続けることです。" #: ../../faq/programming.rst:2020 msgid "This example shows the various techniques::" msgstr "この例は各種テクニックを示します::" -#: ../../faq/programming.rst:2022 msgid "" "class Weather:\n" " \"Lookup weather information on a government website\"\n" @@ -3697,6 +4125,27 @@ msgid "" " \"Rainfall on a given date\"\n" " # Depends on the station_id, date, and units." msgstr "" +"class Weather:\n" +" \"政府のウェブサイトで気象情報を調べる\"\n" +"\n" +" def __init__(self, station_id):\n" +" self._station_id = station_id\n" +" # _station_id はプライベートで変更されない\n" +"\n" +" def current_temperature(self):\n" +" \"1 時間ごとの観測の最新値\"\n" +" # 古い結果は現在の状況を反映しないことがあるので、\n" +" # キャッシュしない。\n" +"\n" +" @cached_property\n" +" def location(self):\n" +" \"観測所の経度・緯度を返す\"\n" +" # 結果は station_id だけに依存する\n" +"\n" +" @lru_cache(maxsize=20)\n" +" def historic_rainfall(self, date, units='mm'):\n" +" \"指定した日の降水量\"\n" +" # station_id、date、units に依存する。" #: ../../faq/programming.rst:2044 msgid "" @@ -3828,11 +4277,12 @@ msgstr "" "り方の一つは、このモジュールの ``compile()`` 関数をインタラクティブに実行する" "ことです::" -#: ../../faq/programming.rst:2112 msgid "" ">>> import py_compile\n" ">>> py_compile.compile('foo.py')" msgstr "" +">>> import py_compile\n" +">>> py_compile.compile('foo.py')" #: ../../faq/programming.rst:2115 msgid "" @@ -3855,15 +4305,13 @@ msgstr "" "のファイルをコンパイルできます。シェルプロンプトから ``compileall.py`` を起動" "して、コンパイルしたいファイルを含むディレクトリのパスを指定してください::" -#: ../../faq/programming.rst:2124 msgid "python -m compileall ." -msgstr "" +msgstr "python -m compileall ." #: ../../faq/programming.rst:2128 msgid "How do I find the current module name?" msgstr "現在のモジュール名を知るにはどうしますか?" -#: ../../faq/programming.rst:2130 msgid "" "A module can find out its own module name by looking at the predefined " "global variable ``__name__``. If this has the value ``'__main__'``, the " @@ -3871,13 +4319,14 @@ msgid "" "importing them also provide a command-line interface or a self-test, and " "only execute this code after checking ``__name__``::" msgstr "" -"モジュールは前もって定義されたグローバル変数 ``__name__`` を検索することで自" -"身の名前を決定できます。この値が ``'__main__'`` であるとき、そのプログラムは" -"スクリプトとして実行されています。インポートされることによって使われる大抵の" -"モジュールはコマンドラインインターフェースや自己テストも提供していて、" -"``__name__`` をチェックしてからそのコードだけを実行します::" +"モジュールは、あらかじめ定義されたグローバル変数 ``__name__`` を調べることで" +"自分の名前を知ることができます。\n" +"値が ``'__main__'`` なら、そのプログラムはスクリプトとして実行されていま" +"す。\n" +"通常はインポートして使うモジュールの多くは、コマンドラインインターフェースや" +"自己テストも提供しています。\n" +"そのコードは ``__name__`` を確認した場合にだけ実行します。 ::" -#: ../../faq/programming.rst:2136 msgid "" "def main():\n" " print('Running test...')\n" @@ -3886,6 +4335,12 @@ msgid "" "if __name__ == '__main__':\n" " main()" msgstr "" +"def main():\n" +" print('Running test...')\n" +" ...\n" +"\n" +"if __name__ == '__main__':\n" +" main()" #: ../../faq/programming.rst:2145 msgid "How can I have modules that mutually import each other?" @@ -3899,21 +4354,23 @@ msgstr "以下のモジュールがあったとしましょう:" msgid ":file:`foo.py`::" msgstr ":file:`foo.py`::" -#: ../../faq/programming.rst:2151 msgid "" "from bar import bar_var\n" "foo_var = 1" msgstr "" +"from bar import bar_var\n" +"foo_var = 1" #: ../../faq/programming.rst:2154 msgid ":file:`bar.py`::" msgstr ":file:`bar.py`::" -#: ../../faq/programming.rst:2156 msgid "" "from foo import foo_var\n" "bar_var = 2" msgstr "" +"from foo import foo_var\n" +"bar_var = 2" #: ../../faq/programming.rst:2159 msgid "The problem is that the interpreter will perform the following steps:" @@ -3979,7 +4436,6 @@ msgstr "" msgid "There are (at least) three possible workarounds for this problem." msgstr "この問題には (少なくとも) 三つの解決策があります。" -#: ../../faq/programming.rst:2178 msgid "" "Guido van Rossum recommends avoiding all uses of ``from import ..." "``, and placing all code inside functions. Initializations of global " @@ -3987,10 +4443,11 @@ msgid "" "only. This means everything from an imported module is referenced as " "``.``." msgstr "" -"Guido van Rossum は ``from import ...`` を全く使わないで、すべての" -"コードを関数の中に入れることを勧めています。グローバル変数とクラス変数の初期" -"化は定数とビルトイン関数のみで行われるべきです。これでインポートされたすべて" -"のモジュールは ``.`` として参照されることになります。" +"Guido van Rossum は ``from import ...`` を一切使わず、すべてのコード" +"を関数内に置くことを勧めています。\n" +"グローバル変数やクラス変数の初期化には、定数か組み込み関数だけを使います。\n" +"つまり、インポートしたモジュール内のものはすべて ``.`` として参" +"照します。" #: ../../faq/programming.rst:2183 msgid "" @@ -4051,9 +4508,8 @@ msgstr "" ":mod:`importlib` に :func:`~importlib.import_module` という便利な関数があるの" "で、代わりにそちらを使用することを検討してください。" -#: ../../faq/programming.rst:2205 msgid "z = importlib.import_module('x.y.z')" -msgstr "" +msgstr "z = importlib.import_module('x.y.z')" #: ../../faq/programming.rst:2209 msgid "" @@ -4077,12 +4533,14 @@ msgstr "" "その基本モジュールの解析と再解析が繰り返されることになります。変更されさたモ" "ジュールの再読込を強制するには、こうしてください::" -#: ../../faq/programming.rst:2217 msgid "" "import importlib\n" "import modname\n" "importlib.reload(modname)" msgstr "" +"import importlib\n" +"import modname\n" +"importlib.reload(modname)" #: ../../faq/programming.rst:2221 msgid "" @@ -4090,9 +4548,8 @@ msgid "" "containing statements like ::" msgstr "注意:この手法は 100%安全とは言えません。とりわけ ::" -#: ../../faq/programming.rst:2224 msgid "from modname import some_objects" -msgstr "" +msgstr "from modname import some_objects" #: ../../faq/programming.rst:2226 msgid "" @@ -4106,7 +4563,6 @@ msgstr "" "スタンスは新しいクラス定義を使うようにアップデート *されません*。これによって" "以下の矛盾した振舞いがなされえます::" -#: ../../faq/programming.rst:2231 msgid "" ">>> import importlib\n" ">>> import cls\n" @@ -4116,22 +4572,31 @@ msgid "" ">>> isinstance(c, cls.C) # isinstance is false?!?\n" "False" msgstr "" +">>> import importlib\n" +">>> import cls\n" +">>> c = cls.C() # C のインスタンスを作る\n" +">>> importlib.reload(cls)\n" +"\n" +">>> isinstance(c, cls.C) # isinstance が偽になる!\n" +"False" -#: ../../faq/programming.rst:2239 msgid "" "The nature of the problem is made clear if you print out the \"identity\" of " "the class objects::" msgstr "" -"この問題の本質は、クラスオブジェクトの \"固有値\" を印字することで明らかにな" -"ります::" +"クラスオブジェクトの「識別値」を表示すると、この問題の原因がはっきりしま" +"す。 ::" -#: ../../faq/programming.rst:2242 msgid "" ">>> hex(id(c.__class__))\n" "'0x7352a0'\n" ">>> hex(id(cls.C))\n" "'0x4198d0'" msgstr "" +">>> hex(id(c.__class__))\n" +"'0x7352a0'\n" +">>> hex(id(cls.C))\n" +"'0x4198d0'" #: ../../faq/programming.rst:408 msgid "argument" diff --git a/faq/windows.po b/faq/windows.po index a59e97f07..5740de7cd 100644 --- a/faq/windows.po +++ b/faq/windows.po @@ -19,10 +19,10 @@ msgstr "" "Last-Translator: TENMYO Masakazu, 2023\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../faq/windows.rst:9 @@ -65,7 +65,7 @@ msgstr "" #: ../../faq/windows.rst:35 msgid "C:\\>" -msgstr "" +msgstr "C:\\>" #: ../../faq/windows.rst:39 msgid "" @@ -77,7 +77,7 @@ msgstr "" #: ../../faq/windows.rst:42 msgid "D:\\YourName\\Projects\\Python>" -msgstr "" +msgstr "D:\\YourName\\Projects\\Python>" #: ../../faq/windows.rst:46 msgid "" @@ -115,7 +115,7 @@ msgstr "" #: ../../faq/windows.rst:60 msgid "C:\\Users\\YourName> py" -msgstr "" +msgstr "C:\\Users\\YourName> py" #: ../../faq/windows.rst:64 msgid "You should then see something like:" @@ -129,6 +129,11 @@ msgid "" "information.\n" ">>>" msgstr "" +"Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:04:45) [MSC v.1900 32 bit " +"(Intel)] on win32\n" +"Type \"help\", \"copyright\", \"credits\" or \"license\" for more " +"information.\n" +">>>" #: ../../faq/windows.rst:72 msgid "" @@ -148,6 +153,10 @@ msgid "" ">>> \"Hello\" * 3\n" "'HelloHelloHello'" msgstr "" +">>> print(\"Hello\")\n" +"Hello\n" +">>> \"Hello\" * 3\n" +"'HelloHelloHello'" #: ../../faq/windows.rst:84 msgid "" @@ -178,7 +187,6 @@ msgstr "" "ドウは閉じます; Windows は 1 つの \"python\" コマンドをウィンドウで実行してい" "て、インタプリタを終了させたときに、そのウィンドウを閉じます。" -#: ../../faq/windows.rst:97 msgid "" "Now that we know the ``py`` command is recognized, you can give your Python " "script to it. You'll have to give either an absolute or a relative path to " @@ -190,13 +198,14 @@ msgstr "" "られるようになりました。\n" "そのためには Python スクリプトの絶対パスあるいは相対パスを与える必要がありま" "す。\n" -"Python スクリプトがデスクトップにあり、 ``hellp.py`` という名前で、ちょうど良" -"いことにコマンドプロンプトがホームディレクトリを開いていると仮定しましょう。" +"Python スクリプトがデスクトップにあり、 ``hello.py`` という名前で、ちょうど良" +"いことにコマンドプロンプトがホームディレクトリを開いていると仮定しましょ" +"う。\n" "そうすると次のような表示が見られます::" #: ../../faq/windows.rst:104 msgid "C:\\Users\\YourName>" -msgstr "" +msgstr "C:\\Users\\YourName>" #: ../../faq/windows.rst:106 msgid "" @@ -211,6 +220,8 @@ msgid "" "C:\\Users\\YourName> py Desktop\\hello.py\n" "hello" msgstr "" +"C:\\Users\\YourName> py Desktop\\hello.py\n" +"hello" #: ../../faq/windows.rst:114 msgid "How do I make Python scripts executable?" @@ -248,7 +259,6 @@ msgstr "" "トアップに時間がかかるようになったというバグレポートがあります。更に複雑なこ" "とに、Python は同様に設定された他の Windows システムではきちんと動くのです。" -#: ../../faq/windows.rst:131 msgid "" "The problem may be caused by a misconfiguration of virus checking software " "on the problem machine. Some virus scanners have been known to introduce " @@ -258,11 +268,13 @@ msgid "" "configured identically. McAfee, when configured to scan all file system read " "activity, is a particular offender." msgstr "" -"この問題はそのマシンのウイルス対策ソフトウェアの設定ミスによって起こされるこ" -"とがあります。ウイルススキャナの中には、ファイルシステムからの全ての読み込み" -"を監視するように設定した場合に、二桁のスタートアップオーバーヘッドを引き起す" -"ことが知られているものがあります。あなたのシステムのウイルススキャンソフト" -"ウェアの設定を確かめて、本当に同様に設定されていることを確実にしてください。" +"問題が起きるマシンのウイルス対策ソフトウェアの設定が原因かもしれません。\n" +"ファイルシステムからの読み取りをすべて監視するように設定すると、起動時のオー" +"バーヘッドが 100 倍程度になるウイルススキャナがあることが知られています。\n" +"各システムのウイルス対策ソフトウェアが本当に同じ設定になっているか確認してく" +"ださい。\n" +"特に McAfee は、ファイルシステムの読み取りをすべてスキャンする設定にすると、" +"この問題を起こします。" #: ../../faq/windows.rst:141 msgid "How do I make an executable from a Python script?" @@ -280,7 +292,6 @@ msgstr "" msgid "Is a ``*.pyd`` file the same as a DLL?" msgstr "``*.pyd`` ファイルは DLL と同じですか?" -#: ../../faq/windows.rst:150 msgid "" "Yes, .pyd files are dll's, but there are a few differences. If you have a " "DLL named ``foo.pyd``, then it must have a function ``PyInit_foo()``. You " @@ -289,12 +300,12 @@ msgid "" "``PyInit_foo()`` to initialize it. You do not link your .exe with foo.lib, " "as that would cause Windows to require the DLL to be present." msgstr "" -"はい、.pyd ファイルは dll と同じようなものですが、少し違いがあります。``foo." -"pyd`` という名前の DLL があったとしたら、それには関数 ``PyInit_foo()`` が含ま" -"れていなければなりません。そうすれば Python で \"import foo\" を書けて、" -"Python は foo.pyd (や foo.py、foo.pyc) を探して、あれば、``PyInit_foo()`` を" -"呼び出して初期化しようとします。Windows が DLL の存在を必要とするのと違い、." -"exe ファイルを foo.lib にリンクするわけではありません。" +"はい、.pyd ファイルは DLL ですが、いくつか違いがあります。\n" +"``foo.pyd`` という DLL には ``PyInit_foo()`` 関数が必要です。\n" +"Python で ``import foo`` と書くと、Python は foo.py や foo.pyc に加えて foo." +"pyd を探し、見つかれば ``PyInit_foo()`` を呼び出して初期化しようとします。\n" +".exe を foo.lib にリンクする必要はありません。\n" +"リンクすると、Windows がその DLL の存在を必須とするようになるためです。" #: ../../faq/windows.rst:157 msgid "" @@ -353,7 +364,6 @@ msgstr "" "`python{NN}.lib` は :file:`python{NN}.dll` に対するいわゆる \"インポートライ" "ブラリ\" です。これは単にリンカに対するシンボルを定義します。)" -#: ../../faq/windows.rst:182 msgid "" "Run-time linking greatly simplifies link options; everything happens at run " "time. Your code must load :file:`python{NN}.dll` using the Windows " @@ -363,13 +373,15 @@ msgid "" "these pointers transparent to any C code that calls routines in Python's C " "API." msgstr "" -"run-time なリンクは、リンクの選択を大いに単純化します。全ては実行時に行われま" -"す。コードは Windows の ``LoadLibraryEx()`` ルーチンで :file:`python{NN}." -"dll` をロードしなければなりません。コードはまた、Windows の " -"``GetProcAddress()`` ルーチンで得られるポインタで、 :file:`python{NN}.dll` " -"(すなわち、Python の C API)のルーチンとデータへアクセスしていなければなりませ" -"ん。マクロによって、このポインタを Python の C API のルーチンを呼び出す任意" -"の C コードに通して使えます。" +"実行時のリンクではすべての処理が実行時に行われるため、リンクオプションを大幅" +"に簡略化できます。\n" +"コードでは Windows の ``LoadLibraryEx()`` で :file:`python{NN}.dll` を読み込" +"む必要があります。\n" +"また、Windows の ``GetProcAddress()`` で得たポインタを使って、:file:" +"`python{NN}.dll` 内のルーチンやデータ (Python の C API) にアクセスする必要が" +"あります。\n" +"マクロを使えば、Python の C API を呼び出す C コード側でこれらのポインタを意識" +"せずに済むようにできます。" #: ../../faq/windows.rst:191 msgid "" @@ -423,6 +435,11 @@ msgid "" "initmyAppc(); // Initialize (import) the helper class.\n" "PyRun_SimpleString(\"import myApp\"); // Import the shadow class." msgstr "" +"#include \n" +"...\n" +"Py_Initialize(); // Pythonの初期化\n" +"initmyAppc(); // ヘルパーclassの初期化(import)\n" +"PyRun_SimpleString(\"import myApp\"); // shadowクラスのimport" #: ../../faq/windows.rst:218 msgid "" @@ -456,29 +473,33 @@ msgid "" "_resultobj = Py_None;\n" "return _resultobj;" msgstr "" +"Py_INCREF(Py_None);\n" +"_resultobj = Py_None;\n" +"return _resultobj;" -#: ../../faq/windows.rst:235 msgid "" "Alas, Py_None is a macro that expands to a reference to a complex data " "structure called _Py_NoneStruct inside pythonNN.dll. Again, this code will " "fail in a mult-compiler environment. Replace such code by:" msgstr "" -"ああ、Py_none は pythonNN.dll 内の _Py_NoneStruct という複雑なデータ構造に展" -"開するマクロです。また、このコードは他コンパイラ環境では失敗します。このコー" -"ドを次のように置き換えてください:" +"ああ、Py_None は pythonNN.dll 内の _Py_NoneStruct という複雑なデータ構造への" +"参照に展開するマクロです。\n" +"また、このコードは他コンパイラ環境では失敗します。\n" +"このコードを次のように置き換えてください:" #: ../../faq/windows.rst:239 msgid "return Py_BuildValue(\"\");" -msgstr "" +msgstr "return Py_BuildValue(\"\");" -#: ../../faq/windows.rst:243 msgid "" "It may be possible to use SWIG's ``%typemap`` command to make the change " "automatically, though I have not been able to get this to work (I'm a " "complete SWIG newbie)." msgstr "" -"これで、SWIG をまだ仕事に使えない (私は SWIG の完全な初心者です) 私でも、" -"SWIG の ``%typemap`` コマンドを使って自動的に変更できるようになります。" +"SWIG の ``%typemap`` コマンドを使えば、この変更を自動化できるかもしれませ" +"ん。\n" +"ただし、私はこれを動作させられていません (SWIG についてはまったくの初心者で" +"す)。" #: ../../faq/windows.rst:247 msgid "" @@ -544,15 +565,15 @@ msgstr "" msgid "How do I check for a keypress without blocking?" msgstr "ブロックすることなく押鍵を検出するにはどうしますか?" -#: ../../faq/windows.rst:276 msgid "" "Use the :mod:`msvcrt` module. This is a standard Windows-specific extension " "module. It defines a function ``kbhit()`` which checks whether a keyboard " "hit is present, and ``getch()`` which gets one character without echoing it." msgstr "" -":mod:`msvcrt` モジュールを使ってください。これは標準の Windows 専用拡張モ" -"ジュールです。これはキーボードが打たれているかを調べる関数 ``kbhit()`` と、反" -"響することなく一文字を得る ``getch()`` を定義します。" +":mod:`msvcrt` モジュールを使ってください。\n" +"これは Windows 専用の標準拡張モジュールです。\n" +"キー入力があるかを調べる ``kbhit()`` と、入力された文字を表示せずに 1 文字取" +"得する ``getch()`` が定義されています。" #: ../../faq/windows.rst:281 msgid "How do I solve the missing api-ms-win-crt-runtime-l1-1-0.dll error?" diff --git a/glossary.po b/glossary.po index 927e9612d..854177dcc 100644 --- a/glossary.po +++ b/glossary.po @@ -27,10 +27,10 @@ msgstr "" "Last-Translator: Inada Naoki , 2025\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../glossary.rst:5 @@ -102,9 +102,8 @@ msgstr "" "インダ及びローダーです。 :mod:`abc` モジュールを利用して独自の ABC を作成でき" "ます。" -#: ../../glossary.rst:38 msgid "annotate function" -msgstr "" +msgstr "annotate function" #: ../../glossary.rst:40 msgid "" @@ -128,13 +127,15 @@ msgstr "" "す。\n" "慣例により :term:`type hint` として使われています。" -#: ../../glossary.rst:50 msgid "" "Annotations of local variables cannot be accessed at runtime, but " "annotations of global variables, class attributes, and functions can be " "retrieved by calling :func:`annotationlib.get_annotations` on modules, " "classes, and functions, respectively." msgstr "" +"ローカル変数のアノテーションには実行時にアクセスできませんが、グローバル変" +"数、クラス属性、関数のアノテーションは、それぞれモジュール、クラス、関数に対" +"して :func:`annotationlib.get_annotations` を呼び出すことで取得できます。" #: ../../glossary.rst:55 msgid "" @@ -142,6 +143,10 @@ msgid "" "pep:`526`, and :pep:`649`, which describe this functionality. Also see :ref:" "`annotations-howto` for best practices on working with annotations." msgstr "" +"機能の説明がある :term:`variable annotation`, :term:`function annotation`, :" +"pep:`484`, :pep:`526`, :pep:`649` を参照してください。また、アノテーションを" +"利用するベストプラクティスとして :ref:`annotations-howto` も参照してくださ" +"い。" #: ../../glossary.rst:59 msgid "argument" @@ -171,6 +176,8 @@ msgid "" "complex(real=3, imag=5)\n" "complex(**{'real': 3, 'imag': 5})" msgstr "" +"complex(real=3, imag=5)\n" +"complex(**{'real': 3, 'imag': 5})" #: ../../glossary.rst:72 msgid "" @@ -188,6 +195,8 @@ msgid "" "complex(3, 5)\n" "complex(*(3, 5))" msgstr "" +"complex(3, 5)\n" +"complex(*(3, 5))" #: ../../glossary.rst:81 msgid "" @@ -283,7 +292,6 @@ msgstr "" "ジェクトは、次の :keyword:`yield` 式まで非同期ジェネレータ関数の本体を実行し" "ます。" -#: ../../glossary.rst:117 msgid "" "Each :keyword:`yield` temporarily suspends processing, remembering the " "execution state (including local variables and pending try-statements). " @@ -291,6 +299,11 @@ msgid "" "awaitable returned by :meth:`~object.__anext__`, it picks up where it left " "off. See :pep:`492` and :pep:`525`." msgstr "" +"各 :keyword:`yield` は処理を一時的に中断し、実行状態(ローカル変数や保留中の " +"try 文を含む)を記憶します。\n" +":meth:`~object.__anext__` が返す別の awaitable によって *非同期ジェネレータイ" +"テレータ* の実行が実際に再開すると、中断した箇所から処理を続けます。\n" +":pep:`492` と :pep:`525` を参照してください。" #: ../../glossary.rst:122 msgid "asynchronous iterable" @@ -326,21 +339,22 @@ msgstr "" "例外を送出するまで、非同期イテレータの :meth:`~object.__anext__` メソッドが返" "す awaitable を解決します。 :pep:`492` で導入されました。" -#: ../../glossary.rst:134 msgid "attached thread state" -msgstr "" +msgstr "attached thread state" -#: ../../glossary.rst:137 msgid "A :term:`thread state` that is active for the current OS thread." msgstr "" +"(アタッチされたスレッド状態) 現在の OS スレッドで有効な :term:`スレッド状態 " +"` です。" -#: ../../glossary.rst:139 msgid "" "When a :term:`thread state` is attached, the OS thread has access to the " "full Python C API and can safely invoke the bytecode interpreter." msgstr "" +":term:`スレッド状態 ` がアタッチされていると、OS スレッドは " +"Python C API の全機能にアクセスでき、バイトコードインタープリタを安全に呼び出" +"せます。" -#: ../../glossary.rst:143 msgid "" "Unless a function explicitly notes otherwise, attempting to call the C API " "without an attached thread state will result in a fatal error or undefined " @@ -348,6 +362,13 @@ msgid "" "user through the C API, or implicitly by the runtime, including during " "blocking C calls and by the bytecode interpreter in between calls." msgstr "" +"関数の説明に明示的な例外の記載がない限り、スレッド状態がアタッチされていない" +"状態で C API を呼び出そうとすると、致命的エラーまたは未定義の動作を引き起こし" +"ます。\n" +"スレッド状態は、利用者が C API を通じて明示的にアタッチしたりデタッチしたりで" +"きるほか、ランタイムが暗黙に行うこともあります。\n" +"後者には、ブロックする C 関数の呼び出し中に行う場合や、バイトコードインタープ" +"リタが呼び出しと呼び出しの間に行う場合が含まれます。" #: ../../glossary.rst:150 msgid "" @@ -441,19 +462,21 @@ msgstr "" ":class:`str` オブジェクトの読み書きができるファイルオブジェクトについては、 :" "term:`text file` も参照してください。" -#: ../../glossary.rst:188 msgid "borrowed reference" -msgstr "" +msgstr "borrowed reference" -#: ../../glossary.rst:190 msgid "" "In Python's C API, a borrowed reference is a reference to an object, where " "the code using the object does not own the reference. It becomes a dangling " "pointer if the object is destroyed. For example, a garbage collection can " "remove the last :term:`strong reference` to the object and so destroy it." msgstr "" +"(借用参照) Python の C API で、オブジェクトを使うコードが所有していない、その" +"オブジェクトへの参照です。\n" +"オブジェクトが破棄されると、ダングリングポインタになります。\n" +"たとえば、ガベージコレクションによってオブジェクトへの最後の :term:`強参照 " +"` が取り除かれ、オブジェクトが破棄されることがあります。" -#: ../../glossary.rst:196 msgid "" "Calling :c:func:`Py_INCREF` on the :term:`borrowed reference` is recommended " "to convert it to a :term:`strong reference` in-place, except when the object " @@ -461,6 +484,12 @@ msgid "" "func:`Py_NewRef` function can be used to create a new :term:`strong " "reference`." msgstr "" +":term:`借用参照 ` に対して :c:func:`Py_INCREF` を呼び出" +"し、その場で :term:`強参照 ` に変換することを推奨します。\n" +"ただし、借用参照の最後の使用までオブジェクトが破棄され得ない場合は除きま" +"す。\n" +":c:func:`Py_NewRef` 関数を使うと、新しい :term:`強参照 ` を" +"作成できます。" #: ../../glossary.rst:201 msgid "bytes-like object" @@ -483,7 +512,6 @@ msgstr "" "由した送信など、バイナリデータを要求するいろいろな操作に利用することができま" "す。" -#: ../../glossary.rst:210 msgid "" "Some operations need the binary data to be mutable. The documentation often " "refers to these as \"read-write bytes-like objects\". Example mutable " @@ -492,14 +520,15 @@ msgid "" "immutable objects (\"read-only bytes-like objects\"); examples of these " "include :class:`bytes` and a :class:`memoryview` of a :class:`bytes` object." msgstr "" -"幾つかの操作ではバイナリデータを変更する必要があります。\n" -"その操作のドキュメントではよく \"読み書き可能な bytes-like オブジェクト\" に" -"言及しています。\n" -"変更可能なバッファーオブジェクトには、 :class:`bytearray` と :class:" -"`bytearray` の :class:`memoryview` などが含まれます。\n" -"また、他の幾つかの操作では不変なオブジェクト内のバイナリデータ (\"読み出し専" -"用の bytes-like オブジェクト\") を必要します。それには :class:`bytes` と :" -"class:`bytes` の :class:`memoryview` オブジェクトが含まれます。" +"操作によっては、バイナリデータが変更可能である必要があります。\n" +"ドキュメントでは、そのようなデータを「読み書き可能な bytes-like オブジェク" +"ト」と呼ぶことがよくあります。\n" +"変更可能なバッファオブジェクトには、:class:`bytearray` や :class:`bytearray` " +"の :class:`memoryview` があります。\n" +"一方、別の操作では、バイナリデータが不変なオブジェクト(「読み出し専用の " +"bytes-like オブジェクト」)に格納されている必要があります。\n" +"そのようなオブジェクトには、:class:`bytes` や :class:`bytes` オブジェクトの :" +"class:`memoryview` があります。" #: ../../glossary.rst:218 msgid "bytecode" @@ -537,22 +566,27 @@ msgstr "" msgid "callable" msgstr "callable" -#: ../../glossary.rst:234 msgid "" "A callable is an object that can be called, possibly with a set of arguments " "(see :term:`argument`), with the following syntax::" msgstr "" +"呼び出し可能オブジェクトは、次の構文で呼び出すことができるオブジェクトで" +"す。\n" +"その際、実引数(:term:`実引数 ` を参照)を渡すこともできます。 ::" #: ../../glossary.rst:237 msgid "callable(argument1, argument2, argumentN)" -msgstr "" +msgstr "callable(argument1, argument2, argumentN)" -#: ../../glossary.rst:239 msgid "" "A :term:`function`, and by extension a :term:`method`, is a callable. An " "instance of a class that implements the :meth:`~object.__call__` method is " "also a callable." msgstr "" +":term:`関数 ` も :term:`メソッド ` も、呼び出し可能オブジェ" +"クトです。\n" +":meth:`~object.__call__` メソッドを実装したクラスのインスタンスも、呼び出し可" +"能オブジェクトです。" #: ../../glossary.rst:242 msgid "callback" @@ -580,19 +614,16 @@ msgstr "" msgid "class variable" msgstr "class variable" -#: ../../glossary.rst:253 msgid "" "A variable defined in a class and intended to be modified only at class " "level (i.e., not in an instance of the class)." msgstr "" -"(クラス変数) クラス上に定義され、クラスレベルで (つまり、クラスのインスタンス" -"上ではなしに) 変更されることを目的としている変数です。" +"(クラス変数) クラス内で定義され、クラスレベルでのみ(つまり、クラスのインスタ" +"ンスではなく)変更することを意図した変数です。" -#: ../../glossary.rst:255 msgid "closure variable" -msgstr "" +msgstr "closure variable" -#: ../../glossary.rst:257 msgid "" "A :term:`free variable` referenced from a :term:`nested scope` that is " "defined in an outer scope rather than being resolved at runtime from the " @@ -600,13 +631,20 @@ msgid "" "`nonlocal` keyword to allow write access, or implicitly defined if the " "variable is only being read." msgstr "" +"(クロージャ変数) :term:`ネストされたスコープ ` から参照される :" +"term:`自由変数 ` のうち、実行時にグローバル名前空間や組み込み" +"名前空間から解決されるのではなく、外側のスコープで定義されているものです。\n" +"書き込みを可能にするために :keyword:`nonlocal` キーワードで明示的に定義する場" +"合と、変数を読み取るだけで暗黙に定義される場合があります。" -#: ../../glossary.rst:262 msgid "" "For example, in the ``inner`` function in the following code, both ``x`` and " "``print`` are :term:`free variables `, but only ``x`` is a " "*closure variable*::" msgstr "" +"たとえば、次のコードの ``inner`` 関数では、``x`` と ``print`` はどちらも :" +"term:`自由変数 ` ですが、*クロージャ変数* は ``x`` だけで" +"す。 ::" #: ../../glossary.rst:265 msgid "" @@ -618,8 +656,14 @@ msgid "" " print(x)\n" " return inner" msgstr "" +"def outer():\n" +" x = 0\n" +" def inner():\n" +" nonlocal x\n" +" x += 1\n" +" print(x)\n" +" return inner" -#: ../../glossary.rst:273 msgid "" "Due to the :attr:`codeobject.co_freevars` attribute (which, despite its " "name, only includes the names of closure variables rather than listing all " @@ -627,6 +671,10 @@ msgid "" "sometimes used even when the intended meaning is to refer specifically to " "closure variables." msgstr "" +":attr:`codeobject.co_freevars` 属性には、その名前に反して、参照されるすべての" +"自由変数ではなくクロージャ変数の名前だけが含まれます。\n" +"このため、クロージャ変数だけを指す意図で、より一般的な用語である :term:`自由" +"変数 ` が使われることもあります。" #: ../../glossary.rst:277 msgid "complex number" @@ -652,72 +700,84 @@ msgstr "" "`cmath` を使います。複素数の使用はかなり高度な数学の機能です。必要性を感じな" "ければ、ほぼ間違いなく無視してしまってよいでしょう。" -#: ../../glossary.rst:289 msgid "context" -msgstr "" +msgstr "context" -#: ../../glossary.rst:291 msgid "" "This term has different meanings depending on where and how it is used. Some " "common meanings:" msgstr "" +"(コンテキスト) この語は、使われる場所や使い方によって意味が異なります。\n" +"よく使われる意味には次のものがあります:" -#: ../../glossary.rst:294 msgid "" "The temporary state or environment established by a :term:`context manager` " "via a :keyword:`with` statement." msgstr "" +":term:`コンテキストマネージャ ` が :keyword:`with` 文を通じ" +"て設定する、一時的な状態または環境。" -#: ../../glossary.rst:296 msgid "" "The collection of key­value bindings associated with a particular :class:" "`contextvars.Context` object and accessed via :class:`~contextvars." "ContextVar` objects. Also see :term:`context variable`." msgstr "" +"特定の :class:`contextvars.Context` オブジェクトに関連付けられ、:class:" +"`~contextvars.ContextVar` オブジェクトを通じてアクセスされる、キーと値の束縛" +"の集まり。\n" +":term:`コンテキスト変数 ` も参照してください。" -#: ../../glossary.rst:300 msgid "" "A :class:`contextvars.Context` object. Also see :term:`current context`." msgstr "" +":class:`contextvars.Context` オブジェクト。\n" +":term:`現在のコンテキスト ` も参照してください。" #: ../../glossary.rst:302 msgid "context management protocol" msgstr "コンテキスト管理プロトコル" -#: ../../glossary.rst:304 msgid "" "The :meth:`~object.__enter__` and :meth:`~object.__exit__` methods called by " "the :keyword:`with` statement. See :pep:`343`." msgstr "" +":keyword:`with` 文から呼び出される :meth:`~object.__enter__` メソッドと :" +"meth:`~object.__exit__` メソッドです。\n" +":pep:`343` を参照してください。" #: ../../glossary.rst:306 msgid "context manager" msgstr "context manager" -#: ../../glossary.rst:308 msgid "" "An object which implements the :term:`context management protocol` and " "controls the environment seen in a :keyword:`with` statement. See :pep:" "`343`." msgstr "" +":term:`コンテキスト管理プロトコル ` を実装し、:" +"keyword:`with` 文内の環境を管理するオブジェクトです。\n" +":pep:`343` を参照してください。" #: ../../glossary.rst:311 msgid "context variable" msgstr "context variable" -#: ../../glossary.rst:313 msgid "" "A variable whose value depends on which context is the :term:`current " "context`. Values are accessed via :class:`contextvars.ContextVar` objects. " "Context variables are primarily used to isolate state between concurrent " "asynchronous tasks." msgstr "" +"どのコンテキストが :term:`現在のコンテキスト ` であるかに" +"よって値が変わる変数です。\n" +"値には :class:`contextvars.ContextVar` オブジェクトを通じてアクセスします。\n" +"コンテキスト変数は主に、並行する非同期タスク間で状態を分離するために使われま" +"す。" #: ../../glossary.rst:317 msgid "contiguous" msgstr "contiguous" -#: ../../glossary.rst:321 msgid "" "A buffer is considered contiguous exactly if it is either *C-contiguous* or " "*Fortran contiguous*. Zero-dimensional buffers are C and Fortran " @@ -727,13 +787,14 @@ msgid "" "visiting items in order of memory address. However, in Fortran contiguous " "arrays, the first index varies the fastest." msgstr "" -"(隣接、連続) バッファが厳密に *C-連続* または *Fortran 連続* である場合に、そ" -"のバッファは連続しているとみなせます。\n" -"ゼロ次元バッファは C 連続であり Fortran 連続です。\n" -"一次元の配列では、その要素は必ずメモリ上で隣接するように配置され、添字がゼロ" -"から始まり増えていく順序で並びます。\n" -"多次元の C-連続な配列では、メモリアドレス順に要素を巡る際には最後の添え字が最" -"初に変わるのに対し、 Fortran 連続な配列では最初の添え字が最初に動きます。" +"(隣接、連続) バッファが *C-連続* または *Fortran 連続* のいずれかである場合、" +"かつその場合に限り、そのバッファは連続しているとみなされます。\n" +"ゼロ次元バッファは C 連続であり、Fortran 連続でもあります。\n" +"一次元配列では、要素はメモリ上で互いに隣接し、ゼロから始まる添字の昇順で並ん" +"でいなければなりません。\n" +"多次元の C-連続配列では、メモリアドレス順に要素をたどると、最後の添字が最も速" +"く変化します。\n" +"一方、Fortran 連続配列では、最初の添字が最も速く変化します。" #: ../../glossary.rst:329 msgid "coroutine" @@ -785,11 +846,9 @@ msgstr "" "グ言語の標準的な実装です。\"CPython\" という単語は、この実装を Jython や " "IronPython といった他の実装と区別する必要が有る場合に利用されます。" -#: ../../glossary.rst:349 msgid "current context" -msgstr "" +msgstr "current context" -#: ../../glossary.rst:351 msgid "" "The :term:`context` (:class:`contextvars.Context` object) that is currently " "used by :class:`~contextvars.ContextVar` objects to access (get or set) the " @@ -798,12 +857,19 @@ msgid "" "`asyncio`) associate each task with a context which becomes the current " "context whenever the task starts or resumes execution." msgstr "" +"(現在のコンテキスト) :class:`~contextvars.ContextVar` オブジェクトが :term:`" +"コンテキスト変数 ` の値にアクセス(取得や設定)するために現" +"在使っている :term:`コンテキスト `(:class:`contextvars.Context` オ" +"ブジェクト)です。\n" +"各スレッドには、それぞれ現在のコンテキストがあります。\n" +"非同期タスクを実行するフレームワーク(:mod:`asyncio` を参照)は、各タスクにコ" +"ンテキストを関連付けます。\n" +"このコンテキストは、タスクが実行を開始または再開するたびに、現在のコンテキス" +"トになります。" -#: ../../glossary.rst:357 msgid "cyclic isolate" -msgstr "" +msgstr "cyclic isolate" -#: ../../glossary.rst:359 msgid "" "A subgroup of one or more objects that reference each other in a reference " "cycle, but are not referenced by objects outside the group. The goal of " @@ -811,6 +877,10 @@ msgid "" "these groups and break the reference cycles so that the memory can be " "reclaimed." msgstr "" +"(孤立した循環参照群) 循環参照によって互いを参照している一つ以上のオブジェクト" +"からなる集まりで、外部のオブジェクトから参照されていないものです。\n" +":term:`循環ガベージコレクタ ` の目的は、こうした集まりを" +"特定し、循環参照を断ち切ってメモリを回収できるようにすることです。" #: ../../glossary.rst:363 msgid "decorator" @@ -834,7 +904,6 @@ msgstr "" "デコレータの文法はシンタックスシュガーです。次の2つの関数定義は意味的に同じも" "のです::" -#: ../../glossary.rst:372 msgid "" "def f(arg):\n" " ...\n" @@ -844,6 +913,13 @@ msgid "" "def f(arg):\n" " ..." msgstr "" +"def f(arg):\n" +" ...\n" +"f = staticmethod(f)\n" +"\n" +"@staticmethod\n" +"def f(arg):\n" +" ..." #: ../../glossary.rst:380 msgid "" @@ -859,7 +935,6 @@ msgstr "" msgid "descriptor" msgstr "descriptor" -#: ../../glossary.rst:385 msgid "" "Any object which defines the methods :meth:`~object.__get__`, :meth:`~object." "__set__`, or :meth:`~object.__delete__`. When a class attribute is a " @@ -871,6 +946,16 @@ msgid "" "basis for many features including functions, methods, properties, class " "methods, static methods, and reference to super classes." msgstr "" +"(デスクリプタ) :meth:`~object.__get__`、:meth:`~object.__set__`、:meth:" +"`~object.__delete__` のいずれかのメソッドを定義したオブジェクトです。\n" +"クラス属性がデスクリプタの場合、属性の検索時に、デスクリプタ特有の束縛動作が" +"起動します。\n" +"通常、*a.b* を使って属性を取得、設定、削除すると、*a* のクラス辞書から *b* と" +"いう名前のオブジェクトを検索しますが、*b* がデスクリプタなら、対応するデスク" +"リプタのメソッドが呼び出されます。\n" +"デスクリプタは、関数、メソッド、プロパティ、クラスメソッド、静的メソッド、" +"スーパークラスへの参照など、多くの機能の基盤となっているため、これを理解する" +"ことは Python を深く理解する鍵となります。" #: ../../glossary.rst:396 msgid "" @@ -884,12 +969,15 @@ msgstr "" msgid "dictionary" msgstr "dictionary" -#: ../../glossary.rst:400 msgid "" "An associative array, where arbitrary keys are mapped to values. The keys " "can be any object with :meth:`~object.__hash__` and :meth:`~object.__eq__` " "methods. Called a hash in Perl." msgstr "" +"(辞書) 任意のキーが値に対応付けられる連想配列です。\n" +"キーには、:meth:`~object.__hash__` メソッドと :meth:`~object.__eq__` メソッド" +"を持つ任意のオブジェクトを使えます。\n" +"Perl ではハッシュと呼ばれます。" #: ../../glossary.rst:404 msgid "dictionary comprehension" @@ -911,7 +999,6 @@ msgstr "" msgid "dictionary view" msgstr "dictionary view" -#: ../../glossary.rst:412 msgid "" "The objects returned from :meth:`dict.keys`, :meth:`dict.values`, and :meth:" "`dict.items` are called dictionary views. They provide a dynamic view on the " @@ -925,14 +1012,13 @@ msgstr "" "辞書の項目の動的なビューを提供します。\n" "すなわち、辞書が変更されるとビューはそれを反映します。\n" "辞書ビューを強制的に完全なリストにするには ``list(dictview)`` を使用してくだ" -"さい。 \n" +"さい。\n" ":ref:`dict-views` を参照してください。" #: ../../glossary.rst:418 msgid "docstring" msgstr "docstring" -#: ../../glossary.rst:420 msgid "" "A string literal which appears as the first expression in a class, function " "or module. While ignored when the suite is executed, it is recognized by " @@ -940,6 +1026,12 @@ msgid "" "enclosing class, function or module. Since it is available via " "introspection, it is the canonical place for documentation of the object." msgstr "" +"(ドキュメンテーション文字列) クラス、関数、モジュールの最初の式として現れる文" +"字列リテラルです。\n" +"スイートの実行時には無視されますが、コンパイラによって認識され、それを囲むク" +"ラス、関数、モジュールの :attr:`~definition.__doc__` 属性に格納されます。\n" +"イントロスペクションを通じて利用できるため、オブジェクトのドキュメントを書く" +"標準的な場所となっています。" #: ../../glossary.rst:426 msgid "duck-typing" @@ -971,7 +1063,6 @@ msgstr "" msgid "EAFP" msgstr "EAFP" -#: ../../glossary.rst:439 msgid "" "Easier to ask for forgiveness than permission. This common Python coding " "style assumes the existence of valid keys or attributes and catches " @@ -980,24 +1071,24 @@ msgid "" "statements. The technique contrasts with the :term:`LBYL` style common to " "many other languages such as C." msgstr "" -"「認可をとるより許しを請う方が容易 (easier to ask for forgiveness than " -"permission、マーフィーの法則)」の略です。この Python で広く使われているコー" -"ディングスタイルでは、通常は有効なキーや属性が存在するものと仮定し、その仮定" -"が誤っていた場合に例外を捕捉します。この簡潔で手早く書けるコーディングスタイ" -"ルには、 :keyword:`try` 文および :keyword:`except` 文がたくさんあるのが特徴で" -"す。このテクニックは、C のような言語でよく使われている :term:`LBYL` スタイル" -"と対照的なものです。" +"許可を求めるより、許しを請うほうが容易(Easier to ask for forgiveness than " +"permission)の略です。\n" +"Python で一般的なこのコーディングスタイルでは、有効なキーや属性が存在すると仮" +"定し、その仮定が誤っていた場合に例外を捕捉します。\n" +"この簡潔で高速なスタイルは、:keyword:`try` 文と :keyword:`except` 文を多用す" +"ることを特徴とします。\n" +"この手法は、C などの多くの言語で一般的な :term:`LBYL` スタイルと対照的です。" -#: ../../glossary.rst:445 msgid "evaluate function" -msgstr "" +msgstr "evaluate function" -#: ../../glossary.rst:447 msgid "" "A function that can be called to evaluate a lazily evaluated attribute of an " "object, such as the value of type aliases created with the :keyword:`type` " "statement." msgstr "" +"(評価関数) :keyword:`type` 文で作成された型エイリアスの値など、オブジェクトの" +"遅延評価される属性を評価するために呼び出せる関数です。" #: ../../glossary.rst:450 msgid "expression" @@ -1049,7 +1140,6 @@ msgstr "" msgid "file object" msgstr "file object" -#: ../../glossary.rst:470 msgid "" "An object exposing a file-oriented API (with methods such as :meth:`!read` " "or :meth:`!write`) to an underlying resource. Depending on the way it was " @@ -1058,6 +1148,13 @@ msgid "" "output, in-memory buffers, sockets, pipes, etc.). File objects are also " "called :dfn:`file-like objects` or :dfn:`streams`." msgstr "" +"(ファイルオブジェクト) 基になるリソースに対して、ファイル向けの API(:meth:`!" +"read` や :meth:`!write` などのメソッド)を提供するオブジェクトです。\n" +"作成方法に応じて、ディスク上の実際のファイル、または別の種類の記憶装置や通信" +"装置(標準入出力、メモリ内バッファ、ソケット、パイプなど)へのアクセスを仲介" +"できます。\n" +"ファイルオブジェクトは、:dfn:`file-like オブジェクト` や :dfn:`ストリーム` と" +"も呼ばれます。" #: ../../glossary.rst:478 msgid "" @@ -1081,33 +1178,35 @@ msgstr "file-like object" msgid "A synonym for :term:`file object`." msgstr ":term:`file object` と同義です。" -#: ../../glossary.rst:486 msgid "filesystem encoding and error handler" -msgstr "" +msgstr "filesystem encoding and error handler" -#: ../../glossary.rst:488 msgid "" "Encoding and error handler used by Python to decode bytes from the operating " "system and encode Unicode to the operating system." msgstr "" +"(ファイルシステムのエンコーディングとエラーハンドラ) オペレーティングシステム" +"から受け取ったバイト列のデコードと、オペレーティングシステムに渡す Unicode の" +"エンコードに Python が使用する、エンコーディングとエラーハンドラです。" -#: ../../glossary.rst:491 msgid "" "The filesystem encoding must guarantee to successfully decode all bytes " "below 128. If the file system encoding fails to provide this guarantee, API " "functions can raise :exc:`UnicodeError`." msgstr "" -"ファイルシステムのエンコーディングでは、すべてが 128 バイト以下に正常にデコー" -"ドされることが保証されなくてはなりません。ファイルシステムのエンコーディング" -"でこれが保証されなかった場合は、API 関数が :exc:`UnicodeError` を送出すること" -"があります。" +"ファイルシステムのエンコーディングは、128 未満のすべてのバイト値を正常にデ" +"コードできることを保証しなければなりません。\n" +"ファイルシステムのエンコーディングがこれを保証しない場合、API 関数が :exc:" +"`UnicodeError` を送出することがあります。" -#: ../../glossary.rst:495 msgid "" "The :func:`sys.getfilesystemencoding` and :func:`sys." "getfilesystemencodeerrors` functions can be used to get the filesystem " "encoding and error handler." msgstr "" +":func:`sys.getfilesystemencoding` 関数と :func:`sys." +"getfilesystemencodeerrors` 関数を使うと、ファイルシステムのエンコーディングと" +"エラーハンドラを取得できます。" #: ../../glossary.rst:499 msgid "" @@ -1116,10 +1215,15 @@ msgid "" "filesystem_encoding` and :c:member:`~PyConfig.filesystem_errors` members of :" "c:type:`PyConfig`." msgstr "" +":term:`ファイルシステムのエンコーディングとエラーハンドラ ` は、Python の開始時に :c:func:`PyConfig_Read` 関" +"数により設定されます。 :c:type:`PyConfig` のメンバー :c:member:`~PyConfig." +"filesystem_encoding` と :c:member:`~PyConfig.filesystem_errors` を参照してく" +"ださい。" -#: ../../glossary.rst:504 msgid "See also the :term:`locale encoding`." msgstr "" +":term:`ロケールエンコーディング ` も参照してください。" #: ../../glossary.rst:505 msgid "finder" @@ -1134,17 +1238,19 @@ msgstr "" "インポートされているモジュールの :term:`loader` の発見を試行するオブジェクト" "です。" -#: ../../glossary.rst:510 msgid "" "There are two types of finder: :term:`meta path finders ` " "for use with :data:`sys.meta_path`, and :term:`path entry finders ` for use with :data:`sys.path_hooks`." msgstr "" +"ファインダには、:data:`sys.meta_path` で使用する :term:`メタパスファインダ " +"` と、:data:`sys.path_hooks` で使用する :term:`パスエントリ" +"ファインダ ` の 2 種類があります。" -#: ../../glossary.rst:514 msgid "" "See :ref:`finders-and-loaders` and :mod:`importlib` for much more detail." msgstr "" +"詳しくは、:ref:`finders-and-loaders` と :mod:`importlib` を参照してください。" #: ../../glossary.rst:515 msgid "floor division" @@ -1166,23 +1272,24 @@ msgstr "" "を行う) ので ``-3`` になることに注意してください。\n" ":pep:`238` を参照してください。" -#: ../../glossary.rst:522 msgid "free threading" -msgstr "" +msgstr "free threading" -#: ../../glossary.rst:524 msgid "" "A threading model where multiple threads can run Python bytecode " "simultaneously within the same interpreter. This is in contrast to the :" "term:`global interpreter lock` which allows only one thread to execute " "Python bytecode at a time. See :pep:`703`." msgstr "" +"(フリースレッディング) 同じインタープリタ内で、複数のスレッドが Python バイト" +"コードを同時に実行できるスレッドモデルです。\n" +"一度に一つのスレッドだけが Python バイトコードを実行できる :term:`グローバル" +"インタープリタロック ` とは対照的です。\n" +":pep:`703` を参照してください。" -#: ../../glossary.rst:528 msgid "free variable" -msgstr "" +msgstr "free variable" -#: ../../glossary.rst:530 msgid "" "Formally, as defined in the :ref:`language execution model `, a " "free variable is any variable used in a namespace which is not a local " @@ -1191,6 +1298,12 @@ msgid "" "attribute, the term is also sometimes used as a synonym for :term:`closure " "variable`." msgstr "" +"(自由変数) :ref:`言語の実行モデル ` における正式な定義では、ある" +"名前空間で使われる変数で、その名前空間のローカル変数ではないものを指しま" +"す。\n" +"例については :term:`クロージャ変数 ` を参照してください。\n" +"実際の用法では、:attr:`codeobject.co_freevars` 属性の名前に由来して、:term:`" +"クロージャ変数 ` の同義語として使われることもあります。" #: ../../glossary.rst:535 msgid "function" @@ -1217,21 +1330,21 @@ msgid "An :term:`annotation` of a function parameter or return value." msgstr "" "(関数アノテーション) 関数のパラメータや返り値の :term:`annotation` です。" -#: ../../glossary.rst:545 msgid "" "Function annotations are usually used for :term:`type hints `: " "for example, this function is expected to take two :class:`int` arguments " "and is also expected to have an :class:`int` return value::" msgstr "" -"関数アノテーションは、通常は :term:`型ヒント ` のために使われま" -"す: 例えば、この関数は 2 つの :class:`int` 型の引数を取ると期待され、また :" -"class:`int` 型の返り値を持つと期待されています。" +"関数アノテーションは通常、:term:`型ヒント ` に使用されます。\n" +"たとえば、次の関数は二つの :class:`int` 型の引数を受け取り、:class:`int` 型の" +"値を返すことを想定しています。 ::" -#: ../../glossary.rst:550 msgid "" "def sum_two_numbers(a: int, b: int) -> int:\n" " return a + b" msgstr "" +"def sum_two_numbers(a: int, b: int) -> int:\n" +" return a + b" #: ../../glossary.rst:553 msgid "Function annotation syntax is explained in section :ref:`function`." @@ -1268,12 +1381,14 @@ msgstr "" "し、その変数を評価することで、新機能が最初に言語に追加されたのはいつかや、い" "つデフォルトになるか (またはなったか) を見ることができます::" -#: ../../glossary.rst:569 msgid "" ">>> import __future__\n" ">>> __future__.division\n" "_Feature((2, 2, 0, 'alpha', 2), (3, 0, 0, 'alpha', 0), 8192)" msgstr "" +">>> import __future__\n" +">>> __future__.division\n" +"_Feature((2, 2, 0, 'alpha', 2), (3, 0, 0, 'alpha', 0), 8192)" #: ../../glossary.rst:572 msgid "garbage collection" @@ -1340,19 +1455,24 @@ msgstr "" msgid "generator expression" msgstr "generator expression" -#: ../../glossary.rst:603 msgid "" "An :term:`expression` that returns an :term:`iterator`. It looks like a " "normal expression followed by a :keyword:`!for` clause defining a loop " "variable, range, and an optional :keyword:`!if` clause. The combined " "expression generates values for an enclosing function::" msgstr "" +"(ジェネレータ式) :term:`イテレータ ` を返す :term:`式 " +"` です。\n" +"通常の式の後に、ループ変数と範囲を定義する :keyword:`!for` 節、そして省略可能" +"な :keyword:`!if` 節が続く形をしています。\n" +"このように組み合わせた式は、外側の関数に渡す値を生成します。 ::" -#: ../../glossary.rst:608 msgid "" ">>> sum(i*i for i in range(10)) # sum of squares 0, 1, 4, ... 81\n" "285" msgstr "" +">>> sum(i*i for i in range(10)) # 平方数 0, 1, 4, ... 81 の合計\n" +"285" #: ../../glossary.rst:610 msgid "generic function" @@ -1375,22 +1495,26 @@ msgstr "" ":term:`single dispatch`、:func:`functools.singledispatch` デコレータ、:pep:" "`443` を参照してください。" -#: ../../glossary.rst:618 msgid "generic type" -msgstr "" +msgstr "generic type" -#: ../../glossary.rst:620 msgid "" "A :term:`type` that can be parameterized; typically a :ref:`container " "class` such as :class:`list` or :class:`dict`. Used for :" "term:`type hints ` and :term:`annotations `." msgstr "" +"(ジェネリック型) パラメータ化できる :term:`型 ` で、通常は :class:" +"`list` や :class:`dict` のような :ref:`コンテナクラス ` で" +"す。\n" +":term:`型ヒント ` や :term:`アノテーション ` に使用さ" +"れます。" -#: ../../glossary.rst:625 msgid "" "For more details, see :ref:`generic alias types`, :pep:" "`483`, :pep:`484`, :pep:`585`, and the :mod:`typing` module." msgstr "" +"詳しくは、:ref:`ジェネリックエイリアス型 `、:pep:`483`、:" +"pep:`484`、:pep:`585`、:mod:`typing` モジュールを参照してください。" #: ../../glossary.rst:627 msgid "GIL" @@ -1404,7 +1528,6 @@ msgstr ":term:`global interpreter lock` を参照してください。" msgid "global interpreter lock" msgstr "global interpreter lock" -#: ../../glossary.rst:632 msgid "" "The mechanism used by the :term:`CPython` interpreter to assure that only " "one thread executes Python :term:`bytecode` at a time. This simplifies the " @@ -1414,13 +1537,14 @@ msgid "" "multi-threaded, at the expense of much of the parallelism afforded by multi-" "processor machines." msgstr "" -"(グローバルインタプリタロック) :term:`CPython` インタプリタが利用している、一" -"度に Python の :term:`バイトコード ` を実行するスレッドは一つだけで" -"あることを保証する仕組みです。これにより (:class:`dict` などの重要な組み込み" -"型を含む) オブジェクトモデルが同時アクセスに対して暗黙的に安全になるので、 " -"CPython の実装がシンプルになります。インタプリタ全体をロックすることで、マル" -"チプロセッサマシンが生じる並列化のコストと引き換えに、インタプリタを簡単にマ" -"ルチスレッド化できるようになります。" +"(グローバルインタプリタロック) :term:`CPython` インタプリタが、一度に一つのス" +"レッドだけが Python の :term:`バイトコード ` を実行することを保証す" +"るために使う仕組みです。\n" +"この仕組みは、:class:`dict` などの重要な組み込み型を含むオブジェクトモデル" +"を、並行アクセスに対して暗黙に安全にすることで、CPython の実装を単純にしま" +"す。\n" +"インタプリタ全体をロックすると、マルチプロセッサマシンが可能にする並列性の多" +"くを犠牲にする代わりに、インタプリタをマルチスレッド化しやすくなります。" #: ../../glossary.rst:641 msgid "" @@ -1433,7 +1557,6 @@ msgstr "" "の計算の重い処理をするときに GIL を解除するように設計されています。また、I/O " "処理をする場合 GIL は常に解除されます。" -#: ../../glossary.rst:646 msgid "" "As of Python 3.13, the GIL can be disabled using the :option:`--disable-gil` " "build configuration. After building Python with this option, code must be " @@ -1442,13 +1565,24 @@ msgid "" "performance for multi-threaded applications and makes it easier to use multi-" "core CPUs efficiently. For more details, see :pep:`703`." msgstr "" +"Python 3.13 以降では、ビルド設定 :option:`--disable-gil` を使って GIL を無効" +"にできます。\n" +"このオプションで Python をビルドした後は、:option:`-X gil=0 <-X>` を指定する" +"か、環境変数 :envvar:`PYTHON_GIL=0 ` を設定してコードを実行する必" +"要があります。\n" +"この機能により、マルチスレッドアプリケーションの性能を改善でき、マルチコア " +"CPU を効率よく利用しやすくなります。\n" +"詳しくは :pep:`703` を参照してください。" -#: ../../glossary.rst:653 msgid "" "In prior versions of Python's C API, a function might declare that it " "requires the GIL to be held in order to use it. This refers to having an :" "term:`attached thread state`." msgstr "" +"以前の Python C API では、関数を使用するには GIL を保持する必要があると宣言さ" +"れていることがありました。\n" +"これは、:term:`スレッド状態がアタッチされている ` こと" +"を指します。" #: ../../glossary.rst:656 msgid "hash-based pyc" @@ -1468,13 +1602,18 @@ msgstr "" msgid "hashable" msgstr "hashable" -#: ../../glossary.rst:663 msgid "" "An object is *hashable* if it has a hash value which never changes during " "its lifetime (it needs a :meth:`~object.__hash__` method), and can be " "compared to other objects (it needs an :meth:`~object.__eq__` method). " "Hashable objects which compare equal must have the same hash value." msgstr "" +"(ハッシュ可能) オブジェクトの生存期間を通して変わらないハッシュ値を持ち(:" +"meth:`~object.__hash__` メソッドが必要です)、ほかのオブジェクトと比較できる" +"(:meth:`~object.__eq__` メソッドが必要です)場合、そのオブジェクトは *ハッ" +"シュ可能* です。\n" +"比較で等しいと判定されるハッシュ可能オブジェクトは、同じハッシュ値を持たなけ" +"ればなりません。" #: ../../glossary.rst:669 msgid "" @@ -1520,24 +1659,29 @@ msgstr "" msgid "immortal" msgstr "永続オブジェクト (immortal)" -#: ../../glossary.rst:686 msgid "" "*Immortal objects* are a CPython implementation detail introduced in :pep:" "`683`." msgstr "" +"*永続オブジェクト* は、:pep:`683` で導入された CPython の実装の詳細です。" -#: ../../glossary.rst:689 msgid "" "If an object is immortal, its :term:`reference count` is never modified, and " "therefore it is never deallocated while the interpreter is running. For " "example, :const:`True` and :const:`None` are immortal in CPython." msgstr "" +"オブジェクトが永続である場合、その :term:`参照カウント ` は" +"決して変更されず、そのためインタープリタの実行中にメモリが解放されることはあ" +"りません。\n" +"たとえば、CPython では :const:`True` と :const:`None` が永続オブジェクトで" +"す。" -#: ../../glossary.rst:693 msgid "" "Immortal objects can be identified via :func:`sys._is_immortal`, or via :c:" "func:`PyUnstable_IsImmortal` in the C API." msgstr "" +"永続オブジェクトは :func:`sys._is_immortal`、または C API の :c:func:" +"`PyUnstable_IsImmortal` によって識別できます。" #: ../../glossary.rst:695 msgid "immutable" @@ -1601,7 +1745,6 @@ msgstr "" msgid "interactive" msgstr "interactive" -#: ../../glossary.rst:719 msgid "" "Python has an interactive interpreter which means you can enter statements " "and expressions at the interpreter prompt, immediately execute them and see " @@ -1610,6 +1753,13 @@ msgid "" "test out new ideas or inspect modules and packages (remember ``help(x)``). " "For more on interactive mode, see :ref:`tut-interac`." msgstr "" +"(対話型) Python には対話型インタープリタがあり、そのプロンプトで文や式を入力" +"して、すぐに実行し、結果を見ることができます。\n" +"``python`` を引数なしで起動するだけで利用できます(コンピュータのメインメ" +"ニューで選択して起動することもできます)。\n" +"新しいアイデアを試したり、モジュールやパッケージを調べたりするための、とても" +"強力な方法です(``help(x)`` を思い出してください)。\n" +"対話モードについて詳しくは、:ref:`tut-interac` を参照してください。" #: ../../glossary.rst:726 msgid "interpreted" @@ -1635,7 +1785,6 @@ msgstr "" msgid "interpreter shutdown" msgstr "interpreter shutdown" -#: ../../glossary.rst:737 msgid "" "When asked to shut down, the Python interpreter enters a special phase where " "it gradually releases all allocated resources, such as modules and various " @@ -1646,16 +1795,15 @@ msgid "" "relies on may not function anymore (common examples are library modules or " "the warnings machinery)." msgstr "" -"Python インタープリターはシャットダウンを要請された時に、モジュールやすべての" -"クリティカルな内部構造をなどの、すべての確保したリソースを段階的に開放する、" -"特別なフェーズに入ります。\n" -"このフェーズは :term:`ガベージコレクタ ` を複数回呼び出し" -"ます。\n" -"これによりユーザー定義のデストラクターや weakref コールバックが呼び出されるこ" -"とがあります。\n" -"シャットダウンフェーズ中に実行されるコードは、それが依存するリソースがすでに" -"機能しない(よくある例はライブラリーモジュールや warning 機構です) ために様々" -"な例外に直面します。" +"Python インタープリタは、シャットダウンを要求されると、モジュールや各種の重要" +"な内部構造など、割り当てられたすべてのリソースを段階的に解放する特別な段階に" +"入ります。\n" +"また、:term:`ガベージコレクタ ` を複数回呼び出します。\n" +"これにより、ユーザー定義のデストラクタや weakref コールバックのコードが実行さ" +"れることがあります。\n" +"シャットダウン段階で実行されるコードでは、依存するリソースがすでに機能しなく" +"なっている場合があるため(よくある例はライブラリモジュールや warnings の仕組" +"みです)、さまざまな例外が発生することがあります。" #: ../../glossary.rst:746 msgid "" @@ -1669,7 +1817,6 @@ msgstr "" msgid "iterable" msgstr "iterable" -#: ../../glossary.rst:750 msgid "" "An object capable of returning its members one at a time. Examples of " "iterables include all sequence types (such as :class:`list`, :class:`str`, " @@ -1678,8 +1825,14 @@ msgid "" "meth:`~object.__iter__` method or with a :meth:`~object.__getitem__` method " "that implements :term:`sequence` semantics." msgstr "" +"(イテラブル) 要素を一つずつ返すことができるオブジェクトです。\n" +"例として、すべてのシーケンス型(:class:`list`、:class:`str`、:class:`tuple` " +"など)や、:class:`dict`、:term:`ファイルオブジェクト ` のような" +"一部のシーケンスでない型があります。\n" +"また、:meth:`~object.__iter__` メソッド、または :term:`シーケンス " +"` の意味論を実装する :meth:`~object.__getitem__` メソッドを定義した" +"任意のクラスのオブジェクトも該当します。" -#: ../../glossary.rst:758 msgid "" "Iterables can be used in a :keyword:`for` loop and in many other places " "where a sequence is needed (:func:`zip`, :func:`map`, ...). When an " @@ -1691,6 +1844,18 @@ msgid "" "temporary unnamed variable to hold the iterator for the duration of the " "loop. See also :term:`iterator`, :term:`sequence`, and :term:`generator`." msgstr "" +"イテラブルは :keyword:`for` ループや、シーケンスを必要とするほかの多くの場面" +"(:func:`zip`、:func:`map` など)で使えます(訳注: ここでのシーケンスは、シー" +"ケンス型ではなく、単なる列という意味です)。\n" +"組み込み関数 :func:`iter` にイテラブルオブジェクトを引数として渡すと、そのオ" +"ブジェクトのイテレータが返されます。\n" +"このイテレータで、一連の値を一度だけ走査できます。\n" +"イテラブルを使う際には通常、:func:`iter` を呼び出したり、イテレータオブジェク" +"トを自分で扱ったりする必要はありません。\n" +":keyword:`for` 文が自動的にこれを行い、一時的な無名の変数を作成して、ループの" +"実行中にイテレータを保持します。\n" +":term:`イテレータ `、:term:`シーケンス `、:term:`ジェネ" +"レータ ` も参照してください。" #: ../../glossary.rst:768 msgid "iterator" @@ -1837,13 +2002,13 @@ msgstr "" "*mapping* から *key* を取り除くと失敗します。この問題は、ロックするか EAFP ア" "プローチを使うことで解決できます。" -#: ../../glossary.rst:834 msgid "lexical analyzer" -msgstr "" +msgstr "lexical analyzer" -#: ../../glossary.rst:837 msgid "Formal name for the *tokenizer*; see :term:`token`." msgstr "" +"(字句解析器) *トークナイザ* の正式な名称です。\n" +":term:`トークン ` を参照してください。" #: ../../glossary.rst:838 msgid "list" @@ -1872,28 +2037,30 @@ msgstr "" "なるリストを返す、コンパクトな方法です。 ``result = ['{:#04x}'.format(x) for " "x in range(256) if x % 2 == 0]`` とすると、 0 から 255 までの偶数を 16進数表" "記 (0x..) した文字列からなるリストを生成します。 :keyword:`if` 節はオプション" -"です。 :keyword:`if` 節がない場合、 ``range(256)`` の全ての要素が処理されま" -"す。" +"です。 ``if`` 節がない場合、 ``range(256)`` の全ての要素が処理されます。" #: ../../glossary.rst:851 msgid "loader" msgstr "loader" -#: ../../glossary.rst:853 msgid "" "An object that loads a module. It must define the :meth:`!exec_module` and :" "meth:`!create_module` methods to implement the :class:`~importlib.abc." "Loader` interface. A loader is typically returned by a :term:`finder`. See " "also:" msgstr "" +"(ローダー) モジュールをロードするオブジェクトです。\n" +":class:`~importlib.abc.Loader` インターフェースを実装するには、:meth:`!" +"exec_module` メソッドと :meth:`!create_module` メソッドを定義しなければなりま" +"せん。\n" +"ローダーは通常、:term:`ファインダ ` から返されます。\n" +"次の項目も参照してください:" -#: ../../glossary.rst:859 msgid ":ref:`finders-and-loaders`" -msgstr "" +msgstr ":ref:`finders-and-loaders`" -#: ../../glossary.rst:860 msgid ":class:`importlib.abc.Loader`" -msgstr "" +msgstr ":class:`importlib.abc.Loader`" #: ../../glossary.rst:861 msgid ":pep:`302`" @@ -1903,28 +2070,31 @@ msgstr ":pep:`302`" msgid "locale encoding" msgstr "ロケールエンコーディング" -#: ../../glossary.rst:864 msgid "" "On Unix, it is the encoding of the LC_CTYPE locale. It can be set with :func:" "`locale.setlocale(locale.LC_CTYPE, new_locale) `." msgstr "" +"Unix では、LC_CTYPE ロケールのエンコーディングです。\n" +":func:`locale.setlocale(locale.LC_CTYPE, new_locale) ` で設" +"定できます。" -#: ../../glossary.rst:867 msgid "On Windows, it is the ANSI code page (ex: ``\"cp1252\"``)." -msgstr "" +msgstr "Windows では、ANSI コードページ(例: ``\"cp1252\"``)です。" -#: ../../glossary.rst:869 msgid "" "On Android and VxWorks, Python uses ``\"utf-8\"`` as the locale encoding." msgstr "" +"Android と VxWorks では、Python はロケールエンコーディングとして " +"``\"utf-8\"`` を使用します。" -#: ../../glossary.rst:871 msgid ":func:`locale.getencoding` can be used to get the locale encoding." msgstr "" +":func:`locale.getencoding` を使うと、ロケールエンコーディングを取得できます。" -#: ../../glossary.rst:873 msgid "See also the :term:`filesystem encoding and error handler`." msgstr "" +":term:`ファイルシステムのエンコーディングとエラーハンドラ ` も参照してください。" #: ../../glossary.rst:874 msgid "magic method" @@ -2026,12 +2196,14 @@ msgstr "" msgid "method resolution order" msgstr "method resolution order" -#: ../../glossary.rst:916 msgid "" "Method Resolution Order is the order in which base classes are searched for " "a member during lookup. See :ref:`python_2.3_mro` for details of the " "algorithm used by the Python interpreter since the 2.3 release." msgstr "" +"(メソッド解決順序) メンバーの検索時に基底クラスを調べる順序です。\n" +"Python インタープリタがリリース 2.3 以降で使っているアルゴリズムの詳細につい" +"ては、:ref:`python_2.3_mro` を参照してください。" #: ../../glossary.rst:919 msgid "module" @@ -2063,9 +2235,8 @@ msgstr "" "モジュールをロードするのに使われるインポート関連の情報を含む名前空間です。\n" ":class:`importlib.machinery.ModuleSpec` のインスタンスです。" -#: ../../glossary.rst:931 msgid "See also :ref:`module-specs`." -msgstr "" +msgstr ":ref:`module-specs` も参照してください。" #: ../../glossary.rst:932 msgid "MRO" @@ -2111,7 +2282,6 @@ msgstr "" "は名前付きタプルです。\n" "他の例は :data:`sys.float_info` です::" -#: ../../glossary.rst:949 msgid "" ">>> sys.float_info[1] # indexed access\n" "1024\n" @@ -2120,8 +2290,13 @@ msgid "" ">>> isinstance(sys.float_info, tuple) # kind of tuple\n" "True" msgstr "" +">>> sys.float_info[1] # インデックスによるアクセス\n" +"1024\n" +">>> sys.float_info.max_exp # 名前付きフィールドによるアクセス\n" +"1024\n" +">>> isinstance(sys.float_info, tuple) # タプルの一種\n" +"True" -#: ../../glossary.rst:956 msgid "" "Some named tuples are built-in types (such as the above examples). " "Alternatively, a named tuple can be created from a regular class definition " @@ -2131,6 +2306,14 @@ msgid "" "namedtuple`. The latter techniques also add some extra methods that may not " "be found in hand-written or built-in named tuples." msgstr "" +"名前付きタプルの一部は、上の例のような組み込み型です。\n" +"また、:class:`tuple` を継承して名前付きフィールドを定義する、通常のクラス定義" +"からも名前付きタプルを作成できます。\n" +"このようなクラスは手作業で書くことも、:class:`typing.NamedTuple` を継承した" +"り、ファクトリ関数 :func:`collections.namedtuple` を使ったりして作成すること" +"もできます。\n" +"後者の方法では、手書きの名前付きタプルや組み込みの名前付きタプルにはない場合" +"がある、いくつかの追加メソッドも用意されます。" #: ../../glossary.rst:964 msgid "namespace" @@ -2162,24 +2345,32 @@ msgstr "" msgid "namespace package" msgstr "namespace package" -#: ../../glossary.rst:978 msgid "" "A :term:`package` which serves only as a container for subpackages. " "Namespace packages may have no physical representation, and specifically are " "not like a :term:`regular package` because they have no ``__init__.py`` file." msgstr "" +"サブパッケージのコンテナとしてだけ機能する :term:`パッケージ ` で" +"す。\n" +"名前空間パッケージは物理的な実体を持たない場合があり、特に ``__init__.py`` " +"ファイルを持たない点で :term:`通常のパッケージ ` と異なりま" +"す。" -#: ../../glossary.rst:983 msgid "" "Namespace packages allow several individually installable packages to have a " "common parent package. Otherwise, it is recommended to use a :term:`regular " "package`." msgstr "" +"名前空間パッケージを使うと、個別にインストール可能な複数のパッケージが、共通" +"の親パッケージを持てます。\n" +"それ以外の場合は、:term:`通常のパッケージ ` の使用を推奨しま" +"す。" -#: ../../glossary.rst:986 msgid "" "For more information, see :pep:`420` and :ref:`reference-namespace-package`." msgstr "" +"詳しくは、:pep:`420` と :ref:`reference-namespace-package` を参照してくださ" +"い。" #: ../../glossary.rst:988 msgid "See also :term:`module`." @@ -2209,13 +2400,17 @@ msgstr "" msgid "new-style class" msgstr "new-style class" -#: ../../glossary.rst:1000 msgid "" "Old name for the flavor of classes now used for all class objects. In " "earlier Python versions, only new-style classes could use Python's newer, " "versatile features like :attr:`~object.__slots__`, descriptors, properties, :" "meth:`~object.__getattribute__`, class methods, and static methods." msgstr "" +"(新スタイルクラス) 現在すべてのクラスオブジェクトに使われている種類のクラス" +"の、以前の名称です。\n" +"古いバージョンの Python では、:attr:`~object.__slots__`、デスクリプタ、プロパ" +"ティ、:meth:`~object.__getattribute__`、クラスメソッド、静的メソッドといっ" +"た、Python の新しく多様な機能を使えるのは新スタイルクラスだけでした。" #: ../../glossary.rst:1005 msgid "object" @@ -2230,11 +2425,9 @@ msgstr "" "データ。もしくは、全ての :term:`新スタイルクラス ` の究極の" "基底クラスのこと。" -#: ../../glossary.rst:1010 msgid "optimized scope" -msgstr "" +msgstr "optimized scope" -#: ../../glossary.rst:1012 msgid "" "A scope where target local variable names are reliably known to the compiler " "when the code is compiled, allowing optimization of read and write access to " @@ -2244,20 +2437,27 @@ msgid "" "relying on a known set of local and nonlocal variable names are restricted " "to optimized scopes." msgstr "" +"(最適化されたスコープ) コードのコンパイル時に、対象となるローカル変数名をコン" +"パイラが確実に把握できるスコープです。\n" +"これにより、その名前への読み書きを最適化できます。\n" +"関数、ジェネレータ、コルーチン、内包表記、ジェネレータ式のローカル名前空間" +"は、この方法で最適化されます。\n" +"注意: インタープリタの最適化の大部分は、すべてのスコープに適用されます。\n" +"最適化されたスコープだけに適用されるのは、ローカル変数名と非ローカル変数名の" +"集合が既知であることに依存する最適化だけです。" #: ../../glossary.rst:1019 msgid "package" msgstr "package" -#: ../../glossary.rst:1021 msgid "" "A Python :term:`module` which can contain submodules or recursively, " "subpackages. Technically, a package is a Python module with a ``__path__`` " "attribute." msgstr "" -"(パッケージ) サブモジュールや再帰的にサブパッケージを含むことの出来る :term:" -"`module` のことです。専門的には、パッケージは ``__path__`` 属性を持つ Python " -"オブジェクトです。" +"(パッケージ) サブモジュールや、再帰的にサブパッケージを含むことができる " +"Python の :term:`モジュール ` です。\n" +"厳密には、パッケージは ``__path__`` 属性を持つ Python モジュールです。" #: ../../glossary.rst:1025 msgid "See also :term:`regular package` and :term:`namespace package`." @@ -2274,9 +2474,8 @@ msgid "" "an :term:`argument` (or in some cases, arguments) that the function can " "accept. There are five kinds of parameter:" msgstr "" -"(仮引数) 名前付の実体で :term:`関数 ` (や :term:`メソッド " -"` ) の定義において関数が受ける :term:`実引数 ` を指定しま" -"す。仮引数には5種類あります:" +"(仮引数) 名前付の実体で :term:`関数 ` (やメソッド ) の定義において" +"関数が受ける :term:`実引数 ` を指定します。仮引数には5種類あります:" #: ../../glossary.rst:1032 msgid "" @@ -2291,22 +2490,21 @@ msgstr "" #: ../../glossary.rst:1037 msgid "def func(foo, bar=None): ..." -msgstr "" +msgstr "def func(foo, bar=None): ..." -#: ../../glossary.rst:1041 msgid "" ":dfn:`positional-only`: specifies an argument that can be supplied only by " "position. Positional-only parameters can be defined by including a ``/`` " "character in the parameter list of the function definition after them, for " "example *posonly1* and *posonly2* in the following::" msgstr "" -"位置専用: 位置によってのみ与えられる引数を指定します。位置専用の引数は 関数定" -"義の引数のリストの中でそれらの後ろに ``/`` を含めることで定義できます。例えば" -"下記の *posonly1* と *posonly2* は位置専用引数になります:: " +":dfn:`位置専用`: 位置によってのみ与えられる引数を指定します。位置専用の引数は" +"関数定義の引数のリストの中でそれらの後ろに ``/`` を含めることで定義できます。" +"例えば下記の *posonly1* と *posonly2* は位置専用引数になります::" #: ../../glossary.rst:1046 msgid "def func(posonly1, posonly2, /, positional_or_keyword): ..." -msgstr "" +msgstr "def func(posonly1, posonly2, /, positional_or_keyword): ..." #: ../../glossary.rst:1050 msgid "" @@ -2321,9 +2519,8 @@ msgstr "" "ように、関数定義の仮引数リストに含めた可変長位置引数または裸の ``*`` の後で" "す::" -#: ../../glossary.rst:1056 msgid "def func(arg, *, kw_only1, kw_only2): ..." -msgstr "" +msgstr "def func(arg, *, kw_only1, kw_only2): ..." #: ../../glossary.rst:1058 msgid "" @@ -2337,9 +2534,8 @@ msgstr "" "個数の位置引数が与えられることを指定します。このような仮引数は、以下の " "*args* のように仮引数名の前に ``*`` をつけることで定義できます::" -#: ../../glossary.rst:1064 msgid "def func(*args, **kwargs): ..." -msgstr "" +msgstr "def func(*args, **kwargs): ..." #: ../../glossary.rst:1066 msgid "" @@ -2361,16 +2557,15 @@ msgstr "" "仮引数はオプションと必須の引数のどちらも指定でき、オプションの引数にはデフォ" "ルト値も指定できます。" -#: ../../glossary.rst:1075 msgid "" "See also the :term:`argument` glossary entry, the FAQ question on :ref:`the " "difference between arguments and parameters `, " "the :class:`inspect.Parameter` class, the :ref:`function` section, and :pep:" "`362`." msgstr "" -":term:`仮引数 ` 、FAQ の :ref:`実引数と仮引数の違いは何ですか? " -"` 、:class:`inspect.Parameter` クラス、 :ref:" -"`function` セクション、:pep:`362` を参照してください。" +"用語集の :term:`実引数 ` の項目、FAQ の :ref:`実引数と仮引数の違い" +"は何ですか? `、:class:`inspect.Parameter` クラ" +"ス、:ref:`function` の節、および :pep:`362` も参照してください。" #: ../../glossary.rst:1079 msgid "path entry" @@ -2410,24 +2605,25 @@ msgstr "" msgid "path entry hook" msgstr "path entry hook" -#: ../../glossary.rst:1093 msgid "" "A callable on the :data:`sys.path_hooks` list which returns a :term:`path " "entry finder` if it knows how to find modules on a specific :term:`path " "entry`." msgstr "" +":data:`sys.path_hooks` リスト内の呼び出し可能オブジェクトで、特定の :term:`パ" +"スエントリ ` 上でモジュールを見つける方法を知っている場合に、:" +"term:`パスエントリファインダ ` を返すものです。" #: ../../glossary.rst:1096 msgid "path based finder" msgstr "path based finder" -#: ../../glossary.rst:1098 msgid "" "One of the default :term:`meta path finders ` which " "searches an :term:`import path` for modules." msgstr "" -"デフォルトの :term:`meta path finder` の1つは、モジュールの :term:`import " -"path` を検索します。" +"モジュールを探すために :term:`インポートパス ` を検索する、デ" +"フォルトの :term:`メタパスファインダ ` の一つです。" #: ../../glossary.rst:1100 msgid "path-like object" @@ -2470,7 +2666,6 @@ msgstr "" "PEP は、機能についての簡潔な技術的仕様と提案する機能の論拠 (理論) を伝えるべ" "きです。" -#: ../../glossary.rst:1118 msgid "" "PEPs are intended to be the primary mechanisms for proposing major new " "features, for collecting community input on an issue, and for documenting " @@ -2478,10 +2673,11 @@ msgid "" "responsible for building consensus within the community and documenting " "dissenting opinions." msgstr "" -"PEP は、新機能の提案にかかる、コミュニティによる問題提起の集積と Python にな" -"される設計決断の文書化のための最上位の機構となることを意図しています。PEP の" -"著者にはコミュニティ内の合意形成を行うこと、反対意見を文書化することの責務が" -"あります。" +"PEP は、主要な新機能を提案し、ある問題に対するコミュニティの意見を集め、" +"Python に採用された設計上の決定を文書化するための、主要な仕組みとなることを意" +"図しています。\n" +"PEP の著者には、コミュニティ内で合意を形成し、反対意見を文書化する責任があり" +"ます。" #: ../../glossary.rst:1124 msgid "See :pep:`1`." @@ -2524,14 +2720,14 @@ msgstr "" "ものではありません -- これは API を組み込む前には見落とされていた重大な欠陥が" "露呈したときにのみ行われます。" -#: ../../glossary.rst:1143 msgid "" "Even for provisional APIs, backwards incompatible changes are seen as a " "\"solution of last resort\" - every attempt will still be made to find a " "backwards compatible resolution to any identified problems." msgstr "" -"暫定 API についても、後方互換性のない変更は「最終手段」とみなされています。問" -"題点が判明した場合でも後方互換な解決策を探すべきです。" +"暫定 API であっても、後方互換性のない変更は「最終手段」とみなされます。\n" +"特定された問題に対しては、引き続き、後方互換性のある解決策を見つけるためにあ" +"らゆる努力を行います。" #: ../../glossary.rst:1147 msgid "" @@ -2583,21 +2779,23 @@ msgstr "" "くの言語にはこの仕組みはないので、Python に慣れていない人は代わりに数値のカウ" "ンターを使うかもしれません::" -#: ../../glossary.rst:1167 msgid "" "for i in range(len(food)):\n" " print(food[i])" msgstr "" +"for i in range(len(food)):\n" +" print(food[i])" #: ../../glossary.rst:1170 msgid "As opposed to the cleaner, Pythonic method::" msgstr "これに対し、きれいな Pythonic な方法は::" -#: ../../glossary.rst:1172 msgid "" "for piece in food:\n" " print(piece)" msgstr "" +"for piece in food:\n" +" print(piece)" #: ../../glossary.rst:1174 msgid "qualified name" @@ -2615,7 +2813,6 @@ msgstr "" "されています。トップレベルの関数やクラスでは、修飾名はオブジェクトの名前と同" "じです::" -#: ../../glossary.rst:1181 msgid "" ">>> class C:\n" "... class D:\n" @@ -2629,6 +2826,17 @@ msgid "" ">>> C.D.meth.__qualname__\n" "'C.D.meth'" msgstr "" +">>> class C:\n" +"... class D:\n" +"... def meth(self):\n" +"... pass\n" +"...\n" +">>> C.__qualname__\n" +"'C'\n" +">>> C.D.__qualname__\n" +"'C.D'\n" +">>> C.D.meth.__qualname__\n" +"'C.D.meth'" #: ../../glossary.rst:1193 msgid "" @@ -2640,12 +2848,14 @@ msgstr "" "の親パッケージを含む全体のドット名表記、例えば ``email.mime.text`` を意味しま" "す::" -#: ../../glossary.rst:1197 msgid "" ">>> import email.mime.text\n" ">>> email.mime.text.__name__\n" "'email.mime.text'" msgstr "" +">>> import email.mime.text\n" +">>> email.mime.text.__name__\n" +"'email.mime.text'" #: ../../glossary.rst:1200 msgid "reference count" @@ -2718,7 +2928,6 @@ msgstr "" msgid "sequence" msgstr "sequence" -#: ../../glossary.rst:1229 msgid "" "An :term:`iterable` which supports efficient element access using integer " "indices via the :meth:`~object.__getitem__` special method and defines a :" @@ -2729,6 +2938,14 @@ msgid "" "sequence because the lookups use arbitrary :term:`hashable` keys rather than " "integers." msgstr "" +"(シーケンス) 整数インデックスを使った効率的な要素アクセスを :meth:`~object." +"__getitem__` 特殊メソッドでサポートし、シーケンスの長さを返す :meth:`~object." +"__len__` メソッドを定義する :term:`イテラブル ` です。\n" +"組み込みのシーケンス型には、:class:`list`、:class:`str`、:class:`tuple`、:" +"class:`bytes` などがあります。\n" +":class:`dict` も :meth:`~object.__getitem__` と :meth:`!__len__` をサポートし" +"ますが、検索には整数ではなく任意の :term:`ハッシュ可能な ` キーを使" +"うため、シーケンスではなくマッピングとみなされます。" #: ../../glossary.rst:1238 msgid "" @@ -2741,32 +2958,31 @@ msgid "" "`Common Sequence Operations `." msgstr "" -#: ../../glossary.rst:1247 msgid "set comprehension" -msgstr "" +msgstr "set comprehension" -#: ../../glossary.rst:1249 msgid "" "A compact way to process all or part of the elements in an iterable and " "return a set with the results. ``results = {c for c in 'abracadabra' if c " "not in 'abc'}`` generates the set of strings ``{'r', 'd'}``. See :ref:" "`comprehensions`." msgstr "" -"(集合内包表記) iterable 内の全てあるいは一部の要素を処理して、その結果からな" -"る集合を返すコンパクトな書き方です。 ``results = {c for c in 'abracadabra' " -"if c not in 'abc'}`` とすると、``{'r', 'd'}`` という文字列の辞書を生成しま" -"す。 :ref:`comprehensions` を参照してください。" +"(集合内包表記) イテラブルのすべて、または一部の要素を処理し、その結果からなる" +"集合を返す簡潔な書き方です。\n" +"``results = {c for c in 'abracadabra' if c not in 'abc'}`` は、文字列の集合 " +"``{'r', 'd'}`` を生成します。\n" +":ref:`comprehensions` を参照してください。" #: ../../glossary.rst:1253 msgid "single dispatch" msgstr "single dispatch" -#: ../../glossary.rst:1255 msgid "" "A form of :term:`generic function` dispatch where the implementation is " "chosen based on the type of a single argument." msgstr "" -":term:`generic function` の一種で実装は一つの引数の型により選択されます。" +"(単一ディスパッチ) :term:`ジェネリック関数 ` のディスパッチ" +"の一形態で、一つの引数の型に基づいて実装を選びます。" #: ../../glossary.rst:1257 msgid "slice" @@ -2784,28 +3000,32 @@ msgstr "" "ます。例えば、 ``variable_name[1:3:5]`` です。角括弧 (添字) 記号は :class:" "`slice` オブジェクトを内部で利用しています。" -#: ../../glossary.rst:1263 msgid "soft deprecated" -msgstr "" +msgstr "soft deprecated" -#: ../../glossary.rst:1265 msgid "" "A soft deprecated API should not be used in new code, but it is safe for " "already existing code to use it. The API remains documented and tested, but " "will not be enhanced further." msgstr "" +"(ソフト非推奨) ソフト非推奨の API は、新しいコードでは使うべきではありません" +"が、既存のコードで使い続けても安全です。\n" +"その API のドキュメントの掲載とテストは続けられますが、それ以上の機能拡張は行" +"われません。" -#: ../../glossary.rst:1269 msgid "" "Soft deprecation, unlike normal deprecation, does not plan on removing the " "API and will not emit warnings." msgstr "" +"通常の非推奨とは異なり、ソフト非推奨では API の削除は予定されておらず、警告も" +"出力されません。" -#: ../../glossary.rst:1272 msgid "" "See `PEP 387: Soft Deprecation `_." msgstr "" +"`PEP 387: Soft Deprecation `_ を参照してください。" #: ../../glossary.rst:1274 msgid "special method" @@ -2837,69 +3057,77 @@ msgstr "" "` かキーワードから構成されるもののどちらかです。後者には :" "keyword:`if`、:keyword:`while`、:keyword:`for` があります。" -#: ../../glossary.rst:1287 msgid "static type checker" -msgstr "" +msgstr "static type checker" -#: ../../glossary.rst:1289 msgid "" "An external tool that reads Python code and analyzes it, looking for issues " "such as incorrect types. See also :term:`type hints ` and the :" "mod:`typing` module." msgstr "" +"(静的型チェッカー) Python コードを読み込んで解析し、型の誤りなどの問題を探す" +"外部ツールです。\n" +":term:`型ヒント ` と :mod:`typing` モジュールも参照してください。" -#: ../../glossary.rst:1292 msgid "strong reference" -msgstr "" +msgstr "strong reference" -#: ../../glossary.rst:1294 msgid "" "In Python's C API, a strong reference is a reference to an object which is " "owned by the code holding the reference. The strong reference is taken by " "calling :c:func:`Py_INCREF` when the reference is created and released with :" "c:func:`Py_DECREF` when the reference is deleted." msgstr "" +"(強参照) Python の C API で、オブジェクトへの参照のうち、それを保持するコード" +"が所有するものです。\n" +"強参照は、参照を作成するときに :c:func:`Py_INCREF` を呼び出すことで取得され、" +"参照を削除するときに :c:func:`Py_DECREF` で解放されます。" -#: ../../glossary.rst:1300 msgid "" "The :c:func:`Py_NewRef` function can be used to create a strong reference to " "an object. Usually, the :c:func:`Py_DECREF` function must be called on the " "strong reference before exiting the scope of the strong reference, to avoid " "leaking one reference." msgstr "" +":c:func:`Py_NewRef` 関数を使うと、オブジェクトへの強参照を作成できます。\n" +"通常は、参照が一つリークするのを避けるために、強参照のスコープを抜ける前に、" +"その強参照に対して :c:func:`Py_DECREF` 関数を呼び出さなければなりません。" -#: ../../glossary.rst:1305 msgid "See also :term:`borrowed reference`." -msgstr "" +msgstr ":term:`借用参照 ` も参照してください。" #: ../../glossary.rst:1306 msgid "text encoding" msgstr "text encoding" -#: ../../glossary.rst:1308 msgid "" "A string in Python is a sequence of Unicode code points (in range " "``U+0000``--``U+10FFFF``). To store or transfer a string, it needs to be " "serialized as a sequence of bytes." msgstr "" +"Python の文字列は、Unicode コードポイントの列(``U+0000``--``U+10FFFF`` の範" +"囲)です。\n" +"文字列を保存または転送するには、バイト列としてシリアライズする必要がありま" +"す。" -#: ../../glossary.rst:1312 msgid "" "Serializing a string into a sequence of bytes is known as \"encoding\", and " "recreating the string from the sequence of bytes is known as \"decoding\"." msgstr "" +"文字列をバイト列にシリアライズすることを「エンコード」、バイト列から文字列を" +"復元することを「デコード」といいます。" -#: ../../glossary.rst:1315 msgid "" "There are a variety of different text serialization :ref:`codecs `, which are collectively referred to as \"text encodings\"." msgstr "" +"文字列をシリアライズするための :ref:`コーデック ` はさま" +"ざまあり、総称して「テキストエンコーディング」と呼ばれます。" #: ../../glossary.rst:1318 msgid "text file" msgstr "text file" -#: ../../glossary.rst:1320 msgid "" "A :term:`file object` able to read and write :class:`str` objects. Often, a " "text file actually accesses a byte-oriented datastream and handles the :term:" @@ -2907,13 +3135,14 @@ msgid "" "text mode (``'r'`` or ``'w'``), :data:`sys.stdin`, :data:`sys.stdout`, and " "instances of :class:`io.StringIO`." msgstr "" -"(テキストファイル) :class:`str` オブジェクトを読み書きできる :term:`file " -"object` です。\n" -"しばしば、テキストファイルは実際にバイト指向のデータストリームにアクセス" -"し、 :term:`テキストエンコーディング ` を自動的に行います。\n" -"テキストファイルの例は、 :data:`sys.stdin`, :data:`sys.stdout`, :class:`io." -"StringIO` インスタンスなどをテキストモード (``'r'`` or ``'w'``) で開いたファ" -"イルです。" +"(テキストファイル) :class:`str` オブジェクトを読み書きできる :term:`ファイル" +"オブジェクト ` です。\n" +"テキストファイルは、多くの場合、実際にはバイト指向のデータストリームにアクセ" +"スし、:term:`テキストエンコーディング ` を自動的に処理しま" +"す。\n" +"例として、テキストモード(``'r'`` または ``'w'``)で開いたファイル、:data:" +"`sys.stdin`、:data:`sys.stdout`、:class:`io.StringIO` のインスタンスがありま" +"す。" #: ../../glossary.rst:1327 msgid "" @@ -2924,32 +3153,40 @@ msgstr "" "オブジェクトについては、 :term:`バイナリファイル ` も参照してく" "ださい。" -#: ../../glossary.rst:1329 msgid "thread state" -msgstr "" +msgstr "thread state" -#: ../../glossary.rst:1332 msgid "" "The information used by the :term:`CPython` runtime to run in an OS thread. " "For example, this includes the current exception, if any, and the state of " "the bytecode interpreter." msgstr "" +"(スレッド状態) :term:`CPython` ランタイムが OS スレッド内で実行するために使う" +"情報です。\n" +"たとえば、現在の例外(あれば)や、バイトコードインタープリタの状態が含まれま" +"す。" -#: ../../glossary.rst:1336 msgid "" "Each thread state is bound to a single OS thread, but threads may have many " "thread states available. At most, one of them may be :term:`attached " "` at once." msgstr "" +"各スレッド状態は、一つの OS スレッドに結び付けられますが、スレッドには複数の" +"スレッド状態が用意されている場合があります。\n" +"一度に :term:`アタッチされる ` のは、そのうち最大一つ" +"です。" -#: ../../glossary.rst:1340 msgid "" "An :term:`attached thread state` is required to call most of Python's C API, " "unless a function explicitly documents otherwise. The bytecode interpreter " "only runs under an attached thread state." msgstr "" +"関数のドキュメントに明示的な例外の記載がない限り、Python の C API の大部分を" +"呼び出すには :term:`アタッチされたスレッド状態 ` が必" +"要です。\n" +"バイトコードインタープリタは、スレッド状態がアタッチされている場合だけ動作し" +"ます。" -#: ../../glossary.rst:1344 msgid "" "Each thread state belongs to a single interpreter, but each interpreter may " "have many thread states, including multiple for the same OS thread. Thread " @@ -2957,35 +3194,44 @@ msgid "" "one can be :term:`attached ` in that thread at any " "given moment." msgstr "" +"各スレッド状態は一つのインタープリタに属しますが、各インタープリタは、同じ " +"OS スレッドに対応する複数の状態も含めて、多数のスレッド状態を持つことができま" +"す。\n" +"複数のインタープリタのスレッド状態を同じスレッドに結び付けられますが、ある時" +"点でそのスレッドに :term:`アタッチできる ` のは一つだ" +"けです。" -#: ../../glossary.rst:1350 msgid "" "See :ref:`Thread State and the Global Interpreter Lock ` for more " "information." msgstr "" +"詳しくは、:ref:`スレッド状態とグローバルインタープリタロック ` を参" +"照してください。" #: ../../glossary.rst:1352 msgid "token" msgstr "トークン" -#: ../../glossary.rst:1355 msgid "" "A small unit of source code, generated by the :ref:`lexical analyzer " "` (also called the *tokenizer*). Names, numbers, strings, " "operators, newlines and similar are represented by tokens." msgstr "" +":ref:`字句解析器 ` (*トークナイザ* とも呼ばれます)が生成する、ソー" +"スコードの小さな単位です。\n" +"名前、数値、文字列、演算子、改行などは、トークンで表されます。" -#: ../../glossary.rst:1360 msgid "" "The :mod:`tokenize` module exposes Python's lexical analyzer. The :mod:" "`token` module contains information on the various types of tokens." msgstr "" +":mod:`tokenize` モジュールは、Python の字句解析器を公開します。\n" +":mod:`token` モジュールは、さまざまな種類のトークンについての情報を含みます。" #: ../../glossary.rst:1363 msgid "triple-quoted string" msgstr "triple-quoted string" -#: ../../glossary.rst:1365 msgid "" "A string which is bound by three instances of either a quotation mark (\") " "or an apostrophe ('). While they don't provide any functionality not " @@ -2995,22 +3241,28 @@ msgid "" "continuation character, making them especially useful when writing " "docstrings." msgstr "" -"(三重クォート文字列) 3つの連続したクォート記号(\")かアポストロフィー(')で囲ま" -"れた文字列。通常の(一重)クォート文字列に比べて表現できる文字列に違いはありま" -"せんが、幾つかの理由で有用です。1つか2つの連続したクォート記号をエスケープ無" -"しに書くことができますし、行継続文字(\\\\)を使わなくても複数行にまたがること" -"ができるので、ドキュメンテーション文字列を書く時に特に便利です。" +"(三重クォート文字列) クォート記号(\")またはアポストロフィー(')を三つ並べ" +"て囲んだ文字列です。\n" +"一重クォート文字列にない機能を提供するわけではありませんが、いくつかの理由で" +"便利です。\n" +"文字列の中にシングルクォートやダブルクォートをエスケープせずに含めることがで" +"き、行継続文字を使わずに複数行にまたがることもできるため、ドキュメンテーショ" +"ン文字列を書く際に特に役立ちます。" #: ../../glossary.rst:1372 msgid "type" msgstr "type" -#: ../../glossary.rst:1374 msgid "" "The type of a Python object determines what kind of object it is; every " "object has a type. An object's type is accessible as its :attr:`~object." "__class__` attribute or can be retrieved with ``type(obj)``." msgstr "" +"(型) Python オブジェクトの型は、それがどのような種類のオブジェクトかを決めま" +"す。\n" +"すべてのオブジェクトには型があります。\n" +"オブジェクトの型には :attr:`~object.__class__` 属性としてアクセスでき、" +"``type(obj)`` でも取得できます。" #: ../../glossary.rst:1378 msgid "type alias" @@ -3028,24 +3280,29 @@ msgstr "" "型エイリアスは :term:`型ヒント ` を単純化するのに有用です。例え" "ば::" -#: ../../glossary.rst:1385 msgid "" "def remove_gray_shades(\n" " colors: list[tuple[int, int, int]]) -> list[tuple[int, int, int]]:\n" " pass" msgstr "" +"def remove_gray_shades(\n" +" colors: list[tuple[int, int, int]]) -> list[tuple[int, int, int]]:\n" +" pass" #: ../../glossary.rst:1389 msgid "could be made more readable like this::" msgstr "これは次のようにより読みやすくできます::" -#: ../../glossary.rst:1391 msgid "" "Color = tuple[int, int, int]\n" "\n" "def remove_gray_shades(colors: list[Color]) -> list[Color]:\n" " pass" msgstr "" +"Color = tuple[int, int, int]\n" +"\n" +"def remove_gray_shades(colors: list[Color]) -> list[Color]:\n" +" pass" #: ../../glossary.rst:1396 ../../glossary.rst:1410 msgid "See :mod:`typing` and :pep:`484`, which describe this functionality." @@ -3063,12 +3320,14 @@ msgstr "" "(型ヒント) 変数、クラス属性、関数のパラメータや返り値の期待される型を指定す" "る :term:`annotation` です。" -#: ../../glossary.rst:1402 msgid "" "Type hints are optional and are not enforced by Python but they are useful " "to :term:`static type checkers `. They can also aid " "IDEs with code completion and refactoring." msgstr "" +"型ヒントは省略可能で、Python によって強制されませんが、:term:`静的型チェッ" +"カー ` に役立ちます。\n" +"IDE によるコード補完やリファクタリングにも役立ちます。" #: ../../glossary.rst:1406 msgid "" @@ -3108,11 +3367,12 @@ msgid "" "When annotating a variable or a class attribute, assignment is optional::" msgstr "変数あるいはクラス属性に注釈を付けたときは、代入部分は任意です::" -#: ../../glossary.rst:1424 msgid "" "class C:\n" " field: 'annotation'" msgstr "" +"class C:\n" +" field: 'annotation'" #: ../../glossary.rst:1427 msgid "" @@ -3122,9 +3382,8 @@ msgstr "" "変数アノテーションは通常は :term:`型ヒント` のために使われます: 例" "えば、この変数は :class:`int` の値を取ることを期待されています::" -#: ../../glossary.rst:1431 msgid "count: int = 0" -msgstr "" +msgstr "count: int = 0" #: ../../glossary.rst:1433 msgid "Variable annotation syntax is explained in section :ref:`annassign`." @@ -3187,17 +3446,14 @@ msgstr "" "学をリストにしたものです。対話プロンプトで \"``import this``\" とするとこのリ" "ストを読めます。" -#: ../../glossary.rst:319 msgid "C-contiguous" -msgstr "" +msgstr "C-contiguous" -#: ../../glossary.rst:319 msgid "Fortran contiguous" -msgstr "" +msgstr "Fortran contiguous" -#: ../../glossary.rst:876 msgid "magic" -msgstr "" +msgstr "magic" #: ../../glossary.rst:1276 msgid "special" diff --git a/howto/annotations.po b/howto/annotations.po index 917fa6024..d6aaf618e 100644 --- a/howto/annotations.po +++ b/howto/annotations.po @@ -16,15 +16,15 @@ msgstr "" "Last-Translator: tomo, 2021\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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 "" +msgstr "アノテーションのベストプラクティス" #: ../../howto/annotations.rst:0 msgid "author" @@ -45,6 +45,9 @@ msgid "" "``__annotations__`` on Python objects, we encourage you to follow the " "guidelines described below." msgstr "" +"このドキュメントは、アノテーションの辞書を扱う上でのベストプラクティスをまと" +"めるものです。Python オブジェクトに付与された ``__annotations__`` を Python " +"コードからアクセスする際には、以下のガイドラインに従うことを推奨します。" #: ../../howto/annotations.rst:16 msgid "" @@ -54,6 +57,11 @@ msgid "" "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:26 msgid "" @@ -62,12 +70,14 @@ msgid "" "information on how to use \"type hints\" in your code, please see the :mod:" "`typing` module." msgstr "" +"注意:本ドキュメントは、アノテーションの使い方ではなく、 ``__annotations__`` " +"の使い方を扱っています。型ヒントをコードの中でどうやって使うかについては、 :" +"mod:`typing` モジュールを参照してください。" #: ../../howto/annotations.rst:33 msgid "Accessing The Annotations Dict Of An Object In Python 3.10 And Newer" -msgstr "" +msgstr "オブジェクトのアノテーション辞書へのアクセス (Python 3.10 以降)" -#: ../../howto/annotations.rst:35 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 " @@ -75,6 +85,12 @@ msgid "" "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:42 msgid "" @@ -83,6 +99,9 @@ msgid "" "`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:47 msgid "" @@ -94,6 +113,12 @@ msgid "" "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:57 msgid "" @@ -103,6 +128,11 @@ msgid "" "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:65 msgid "" @@ -111,10 +141,14 @@ msgid "" "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:73 msgid "Accessing The Annotations Dict Of An Object In Python 3.9 And Older" -msgstr "" +msgstr "オブジェクトのアノテーション辞書へのアクセス (Python 3.9 以前)" #: ../../howto/annotations.rst:75 msgid "" @@ -122,6 +156,9 @@ msgid "" "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:80 msgid "" @@ -131,6 +168,10 @@ msgid "" "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:87 msgid "" @@ -140,6 +181,10 @@ msgid "" "``__annotations__`` attribute of a class may inadvertently return the " "annotations dict of a *base class.* As an example::" msgstr "" +"ただし、クラスについては推奨方法が異なります。なぜなら、クラスには " +"``__annotations__`` は必須ではなく、属性はベースクラスから継承されるので、 " +"``__annotations__`` 属性にアクセスするとベースクラスのアノテーション辞書を取" +"得してしまうという問題があるからです。例えば::" #: ../../howto/annotations.rst:94 msgid "" @@ -152,10 +197,19 @@ msgid "" "\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:103 msgid "This will print the annotations dict from ``Base``, not ``Derived``." msgstr "" +"このコードでは ``Derived`` ではなく ``Base`` のアノテーションが表示されます。" #: ../../howto/annotations.rst:106 msgid "" @@ -166,6 +220,12 @@ msgid "" "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:114 msgid "" @@ -173,6 +233,8 @@ msgid "" "``__annotations__`` attribute on an arbitrary object in Python 3.9 and " "before::" msgstr "" +"以上を踏まえると、Python 3.9 以前では、以下のサンプルコードで任意のオブジェク" +"トの ``__annotations__`` 属性を安全に取得することができます::" #: ../../howto/annotations.rst:118 msgid "" @@ -181,6 +243,10 @@ msgid "" "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:123 msgid "" @@ -188,6 +254,9 @@ msgid "" "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:128 msgid "" @@ -195,10 +264,13 @@ msgid "" "__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:134 msgid "Manually Un-Stringizing Stringized Annotations" -msgstr "" +msgstr "文字列指定のアノテーションを手動で解決する方法" #: ../../howto/annotations.rst:136 msgid "" @@ -207,6 +279,8 @@ msgid "" "really is best to call :func:`inspect.get_annotations` to do this work for " "you." msgstr "" +"アノテーションは文字列として指定されている場合があり、それを評価して Python " +"の値に変換するには、 :func:`inspect.get_annotations` を使うのが一番です。" #: ../../howto/annotations.rst:142 msgid "" @@ -215,18 +289,25 @@ msgid "" "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:148 msgid "" "In a nutshell, if you wish to evaluate a stringized annotation on an " "arbitrary object ``o``:" msgstr "" +"すなわち、任意のオブジェクト ``o`` の文字列アノテーションを評価するには:" #: ../../howto/annotations.rst:151 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:153 msgid "" @@ -234,6 +315,8 @@ msgid "" "``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` を呼ぶ。" #: ../../howto/annotations.rst:156 msgid "" @@ -242,12 +325,17 @@ msgid "" "accessing either ``o.__wrapped__`` or ``o.func`` as appropriate, until you " "have found the root unwrapped function." msgstr "" +"``o`` が :func:`functools.update_wrapper` か :func:`functools.wraps` か :" +"func:`functools.partial` でラップされた callable ならば、一番内部の関数に到達" +"するまで、 ``o.__wrapped__`` か ``o.func`` のどちらかを繰り返し取得する。" #: ../../howto/annotations.rst:160 msgid "" "If ``o`` is a callable (but not a class), use :attr:`o.__globals__ ` as the globals when calling :func:`eval`." msgstr "" +"``o`` がクラス以外の callable であれば、 :attr:`o.__globals__ ` を globals として :func:`eval` を呼ぶ。" #: ../../howto/annotations.rst:164 msgid "" @@ -257,18 +345,25 @@ msgid "" "hints that require annotating with string values that specifically *can't* " "be evaluated. For example:" msgstr "" +"しかし、必ずしもアノテーションの文字列が :func:`eval` で Python の値に変換で" +"きるとは限りません。理論上どんな文字列も指定可能であり、変換できない文字列を" +"型ヒントとして指定する必要がある場合が実際にあります。例えば:" #: ../../howto/annotations.rst:171 msgid "" ":pep:`604` union types using ``|``, before support for this was added to " "Python 3.10." msgstr "" +"``|`` を使った :pep:`604` のユニオン型 (これが追加された Python 3.10 より前の" +"バージョン)" #: ../../howto/annotations.rst:173 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:176 msgid "" @@ -277,22 +372,28 @@ msgid "" "it's recommended to only attempt to evaluate string values when explicitly " "requested to by the caller." msgstr "" +":func:`eval` で上記のような値を評価しようとすると、失敗し例外が発生します。そ" +"のため、アノテーションを扱うライブラリ API を作る際は、呼び出し側が明示的に要" +"求したときのみ、文字列を評価することが推奨されます。" #: ../../howto/annotations.rst:184 msgid "Best Practices For ``__annotations__`` In Any Python Version" -msgstr "" +msgstr "``__annotations__`` のベストプラクティス (全 Python バージョン共通)" -#: ../../howto/annotations.rst:186 msgid "" "You should avoid assigning to the ``__annotations__`` member of objects " "directly. Let Python manage setting ``__annotations__``." msgstr "" +"オブジェクトの ``__annotations__`` 属性に直接代入することは避けるべきです。" +"Python に任せましょう。" #: ../../howto/annotations.rst:189 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:192 msgid "" @@ -300,6 +401,9 @@ msgid "" "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:196 msgid "" @@ -307,19 +411,21 @@ msgid "" "should ensure that it's a dictionary before attempting to examine its " "contents." msgstr "" +"直接 ``__annotations__`` メンバーにアクセスするなら、まず値が辞書であることを" +"チェックしてから中身を調べるべきです。" #: ../../howto/annotations.rst:200 msgid "You should avoid modifying ``__annotations__`` dicts." -msgstr "" +msgstr "``__annotations__`` 辞書を書き換えるのは避けるべきです。" #: ../../howto/annotations.rst:202 msgid "" "You should avoid deleting the ``__annotations__`` attribute of an object." -msgstr "" +msgstr "``__annotations__`` 属性を削除するのは避けるべきです。" #: ../../howto/annotations.rst:207 msgid "``__annotations__`` Quirks" -msgstr "" +msgstr "``__annotations__`` の注意点" #: ../../howto/annotations.rst:209 msgid "" @@ -339,7 +445,6 @@ msgid "" "in Python 3.10 and newer." msgstr "" -#: ../../howto/annotations.rst:222 msgid "" "In all versions of Python 3, you can set ``__annotations__`` on a function " "object to ``None``. However, subsequently accessing the annotations on that " @@ -349,30 +454,46 @@ msgid "" "``__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 の値を設定で" +"き、設定した値がそのまま保持されます。" -#: ../../howto/annotations.rst:230 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" +"例えば、次のようになります。 ::" -#: ../../howto/annotations.rst:236 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__)" -#: ../../howto/annotations.rst:241 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" +"本来は「癖」と呼ぶような動作ではありませんが、意外に感じるかもしれないため、" +"ここで紹介しています。" -#: ../../howto/annotations.rst:244 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-" @@ -382,8 +503,16 @@ msgid "" "avoid these bugs by accessing the annotations from the class's :attr:`~type." "__dict__` (for example, ``cls.__dict__.get('__annotations__', None)``)." msgstr "" +"独自のメタクラスを使うクラスの ``__annotations__`` にアクセスすると、予期しな" +"い動作になる場合があります。\n" +"例は :pep:`749 <749#pep749-metaclasses>` を参照してください。\n" +"Python 3.14 以降では :func:`annotationlib.get_annotations`、Python 3.10 以降" +"では :func:`inspect.get_annotations` を使うことで、こうした動作を避けられま" +"す。\n" +"それ以前の Python では、``cls.__dict__.get('__annotations__', None)`` のよう" +"に、クラスの :attr:`~type.__dict__` からアノテーションを取得することで、この" +"問題を回避できます。" -#: ../../howto/annotations.rst:253 msgid "" "In some versions of Python, instances of classes may have an " "``__annotations__`` attribute. However, this is not supported functionality. " @@ -391,3 +520,10 @@ msgid "" "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))`` を使えます。" diff --git a/howto/argparse.po b/howto/argparse.po index c749f29d9..ad7814ef9 100644 --- a/howto/argparse.po +++ b/howto/argparse.po @@ -19,10 +19,10 @@ msgstr "" "Last-Translator: Arihiro TAKASE, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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/argparse.rst:5 @@ -42,11 +42,10 @@ msgid "" "This tutorial is intended to be a gentle introduction to :mod:`argparse`, " "the recommended command-line parsing module in the Python standard library." msgstr "" -"このチュートリアルでは、:mod:`argparse` を丁寧に説明します。:mod:`argparse` " +"このチュートリアルでは、:mod:`argparse` を丁寧に説明します。 ``argparse`` " "は、Python 標準ライブラリの一部であり、おすすめのコマンドライン引数の解析モ" "ジュールです。" -#: ../../howto/argparse.rst:16 msgid "" "The standard library includes two other libraries directly related to " "command-line parameter processing: the lower level :mod:`optparse` module " @@ -59,6 +58,16 @@ msgid "" "``optparse``, so some aspects of this tutorial will also be relevant to " "``optparse`` users." msgstr "" +"標準ライブラリには、コマンドライン引数の処理に直接関係するライブラリが、ほか" +"に 2 つあります。\n" +"より低水準の :mod:`optparse` モジュールは、アプリケーションに合わせた設定に多" +"くのコードが必要な場合もありますが、``argparse`` がサポートしない動作を指定で" +"きます。\n" +"さらに低水準の :mod:`getopt` は、C プログラマが使う :c:func:`!getopt` 系の関" +"数に相当するものです。\n" +"このガイドでは、これらのモジュールを直接は取り上げません。\n" +"ただし、``argparse`` の主要な概念の多くは ``optparse`` に由来するため、この" +"チュートリアルの一部は ``optparse`` の利用者にも役立ちます。" #: ../../howto/argparse.rst:29 msgid "Concepts" @@ -72,7 +81,6 @@ msgstr "" ":command:`ls` コマンドを使って、このチュートリアルで私たちが学ぶ機能をいくつ" "か見てみましょう:" -#: ../../howto/argparse.rst:34 msgid "" "$ ls\n" "cpython devguide prog.py pypy rm-unused-function.patch\n" @@ -91,6 +99,22 @@ msgid "" "Sort entries alphabetically if none of -cftuvSUX nor --sort is specified.\n" "..." msgstr "" +"$ ls\n" +"cpython devguide prog.py pypy rm-unused-function.patch\n" +"$ ls pypy\n" +"ctypes_configure demo dotviewer include lib_pypy lib-python ...\n" +"$ ls -l\n" +"total 20\n" +"drwxr-xr-x 19 wena wena 4096 Feb 18 18:51 cpython\n" +"drwxr-xr-x 4 wena wena 4096 Feb 8 12:04 devguide\n" +"-rwxr-xr-x 1 wena wena 535 Feb 19 00:05 prog.py\n" +"drwxr-xr-x 14 wena wena 4096 Feb 7 00:59 pypy\n" +"-rw-r--r-- 1 wena wena 741 Feb 18 01:01 rm-unused-function.patch\n" +"$ ls --help\n" +"Usage: ls [OPTION]... [FILE]...\n" +"List information about the FILEs (the current directory by default).\n" +"Sort entries alphabetically if none of -cftuvSUX nor --sort is specified.\n" +"..." #: ../../howto/argparse.rst:53 msgid "A few concepts we can learn from the four commands:" @@ -104,7 +128,6 @@ msgstr "" ":command:`ls` コマンドは、まったくオプションを指定せずに実行したとしても役に" "立ちます。デフォルトの動作は、カレントディレクトリの内容を表示することです。" -#: ../../howto/argparse.rst:58 msgid "" "If we want beyond what it provides by default, we tell it a bit more. In " "this case, we want it to display a different directory, ``pypy``. What we " @@ -115,14 +138,14 @@ msgid "" "position is *what you want copied,* and the second position is *where you " "want it copied to*." msgstr "" -"デフォルトの動作で提供される以上のことをしたい場合、すこしだけオプションを指" -"定する必要があります。別のディレクトリ ``pypy`` を表示したい場合、私たちがし" -"たことは、位置引数として知られる引数を指定することです。これは、引数がコマン" -"ドラインのどの位置に現れたかということだけを基に、プログラムがその値について" -"何をするのか分かるべきなので、このように名づけられています。このコンセプト" -"は :command:`cp` のようなコマンドで重要な意味があります。 :command:`cp` コマ" -"ンドのもっとも基本的な使い方は、 ``cp SRC DEST`` です。最初の引数は *何をコ" -"ピーしたいか* であり、二つ目の引数は *どこにコピーしたいか* を意味します。" +"デフォルト以外の動作をさせるには、追加の情報を渡します。\n" +"この例では、別のディレクトリ ``pypy`` の内容を表示させるために、位置引数と呼" +"ばれるものを指定しました。\n" +"コマンドライン上の位置だけで、プログラムがその値の用途を判断できることから、" +"この名前が付いています。\n" +"この考え方は :command:`cp` のようなコマンドではさらに重要です。\n" +"最も基本的な使い方は ``cp SRC DEST`` で、最初の位置は *コピーしたいもの*、2 " +"番目の位置は *コピー先* を表します。" #: ../../howto/argparse.rst:67 msgid "" @@ -152,19 +175,20 @@ msgstr "基礎" msgid "Let us start with a very simple example which does (almost) nothing::" msgstr "(ほとんど)何もしない、とても簡単な例から始めましょう::" -#: ../../howto/argparse.rst:81 msgid "" "import argparse\n" "parser = argparse.ArgumentParser()\n" "parser.parse_args()" msgstr "" +"import argparse\n" +"parser = argparse.ArgumentParser()\n" +"parser.parse_args()" #: ../../howto/argparse.rst:85 ../../howto/argparse.rst:193 #: ../../howto/argparse.rst:214 msgid "Following is a result of running the code:" msgstr "下記がこのコードを実行した結果です:" -#: ../../howto/argparse.rst:87 msgid "" "$ python prog.py\n" "$ python prog.py --help\n" @@ -179,6 +203,18 @@ msgid "" "usage: prog.py [-h]\n" "prog.py: error: unrecognized arguments: foo" msgstr "" +"$ python prog.py\n" +"$ python prog.py --help\n" +"usage: prog.py [-h]\n" +"\n" +"options:\n" +" -h, --help show this help message and exit\n" +"$ python prog.py --verbose\n" +"usage: prog.py [-h]\n" +"prog.py: error: unrecognized arguments: --verbose\n" +"$ python prog.py foo\n" +"usage: prog.py [-h]\n" +"prog.py: error: unrecognized arguments: foo" #: ../../howto/argparse.rst:102 ../../howto/argparse.rst:259 #: ../../howto/argparse.rst:303 @@ -201,17 +237,16 @@ msgstr "" "二つ目の実行結果から :mod:`argparse` モジュールの有用性がわかります。ほとんど" "何もしていないのに、すてきなヘルプメッセージが手に入りました。" -#: ../../howto/argparse.rst:110 msgid "" "The ``--help`` option, which can also be shortened to ``-h``, is the only " "option we get for free (i.e. no need to specify it). Specifying anything " "else results in an error. But even then, we do get a useful usage message, " "also for free." msgstr "" -"``--help`` (これは ``-h`` と短縮できます)だけが無料のオプションです(つまり" -"プログラムで指示する必要はありません)。他のオプションを指定するとエラーにな" -"ります。エラー時の有用な用法メッセージも、プログラムで指示することなく出力で" -"きます。" +"``--help`` (短く ``-h`` とも書けます) は、こちらで定義せずに使える唯一のオプ" +"ションです。\n" +"それ以外を指定するとエラーになりますが、その場合も追加の実装なしで役立つ使用" +"方法のメッセージが表示されます。" #: ../../howto/argparse.rst:117 msgid "Introducing Positional arguments" @@ -221,7 +256,6 @@ msgstr "位置引数の入門" msgid "An example::" msgstr "以下に例を示します::" -#: ../../howto/argparse.rst:121 msgid "" "import argparse\n" "parser = argparse.ArgumentParser()\n" @@ -229,12 +263,16 @@ msgid "" "args = parser.parse_args()\n" "print(args.echo)" msgstr "" +"import argparse\n" +"parser = argparse.ArgumentParser()\n" +"parser.add_argument(\"echo\")\n" +"args = parser.parse_args()\n" +"print(args.echo)" #: ../../howto/argparse.rst:127 msgid "And running the code:" msgstr "このコードを実行してみましょう:" -#: ../../howto/argparse.rst:129 msgid "" "$ python prog.py\n" "usage: prog.py [-h] echo\n" @@ -250,6 +288,19 @@ msgid "" "$ python prog.py foo\n" "foo" msgstr "" +"$ python prog.py\n" +"usage: prog.py [-h] echo\n" +"prog.py: error: the following arguments are required: echo\n" +"$ python prog.py --help\n" +"usage: prog.py [-h] echo\n" +"\n" +"positional arguments:\n" +" echo\n" +"\n" +"options:\n" +" -h, --help show this help message and exit\n" +"$ python prog.py foo\n" +"foo" #: ../../howto/argparse.rst:145 msgid "Here is what's happening:" @@ -270,13 +321,13 @@ msgstr "" msgid "Calling our program now requires us to specify an option." msgstr "プログラムを実行すると、オプションを指定するように要求されます。" -#: ../../howto/argparse.rst:153 msgid "" "The :meth:`~ArgumentParser.parse_args` method actually returns some data " "from the options specified, in this case, ``echo``." msgstr "" -":meth:`~ArgumentParser.parse_args` メソッドは指定されたオプションを、この場合" -"は ``echo`` として、返します。" +":meth:`~ArgumentParser.parse_args` メソッドは、指定されたオプションから得た" +"データを返します。\n" +"この例では ``echo`` に指定された値です。" #: ../../howto/argparse.rst:156 msgid "" @@ -302,7 +353,6 @@ msgstr "" "ためには推測するかソースコードを見なけれなりません。もうすこしヘルプメッセー" "ジ分かりやすくしてみましょう::" -#: ../../howto/argparse.rst:166 msgid "" "import argparse\n" "parser = argparse.ArgumentParser()\n" @@ -310,12 +360,16 @@ msgid "" "args = parser.parse_args()\n" "print(args.echo)" msgstr "" +"import argparse\n" +"parser = argparse.ArgumentParser()\n" +"parser.add_argument(\"echo\", help=\"echo the string you use here\")\n" +"args = parser.parse_args()\n" +"print(args.echo)" #: ../../howto/argparse.rst:172 msgid "And we get:" msgstr "修正した結果は以下のようになります:" -#: ../../howto/argparse.rst:174 msgid "" "$ python prog.py -h\n" "usage: prog.py [-h] echo\n" @@ -326,12 +380,19 @@ msgid "" "options:\n" " -h, --help show this help message and exit" msgstr "" +"$ python prog.py -h\n" +"usage: prog.py [-h] echo\n" +"\n" +"positional arguments:\n" +" echo echo the string you use here\n" +"\n" +"options:\n" +" -h, --help show this help message and exit" #: ../../howto/argparse.rst:185 msgid "Now, how about doing something even more useful::" msgstr "次は、もっと有益なことをしてみませんか?::" -#: ../../howto/argparse.rst:187 msgid "" "import argparse\n" "parser = argparse.ArgumentParser()\n" @@ -340,8 +401,13 @@ msgid "" "args = parser.parse_args()\n" "print(args.square**2)" msgstr "" +"import argparse\n" +"parser = argparse.ArgumentParser()\n" +"parser.add_argument(\"square\", help=\"display a square of a given " +"number\")\n" +"args = parser.parse_args()\n" +"print(args.square**2)" -#: ../../howto/argparse.rst:195 msgid "" "$ python prog.py 4\n" "Traceback (most recent call last):\n" @@ -349,6 +415,11 @@ msgid "" " print(args.square**2)\n" "TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int'" msgstr "" +"$ python prog.py 4\n" +"Traceback (most recent call last):\n" +" File \"prog.py\", line 5, in \n" +" print(args.square**2)\n" +"TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int'" #: ../../howto/argparse.rst:203 msgid "" @@ -360,7 +431,6 @@ msgstr "" "ションを文字列として扱います。 :mod:`argparse` にオプションの値を整数として扱" "うように伝えましょう::" -#: ../../howto/argparse.rst:207 msgid "" "import argparse\n" "parser = argparse.ArgumentParser()\n" @@ -370,8 +440,14 @@ msgid "" "args = parser.parse_args()\n" "print(args.square**2)" msgstr "" +"import argparse\n" +"parser = argparse.ArgumentParser()\n" +"parser.add_argument(\"square\", help=\"display a square of a given " +"number\",\n" +" type=int)\n" +"args = parser.parse_args()\n" +"print(args.square**2)" -#: ../../howto/argparse.rst:216 msgid "" "$ python prog.py 4\n" "16\n" @@ -379,6 +455,11 @@ msgid "" "usage: prog.py [-h] square\n" "prog.py: error: argument square: invalid int value: 'four'" msgstr "" +"$ python prog.py 4\n" +"16\n" +"$ python prog.py four\n" +"usage: prog.py [-h] square\n" +"prog.py: error: argument square: invalid int value: 'four'" #: ../../howto/argparse.rst:224 msgid "" @@ -400,7 +481,6 @@ msgstr "" "ここまで位置引数を扱ってきました。optional引数を追加する方法についても見てい" "きましょう::" -#: ../../howto/argparse.rst:234 msgid "" "import argparse\n" "parser = argparse.ArgumentParser()\n" @@ -409,13 +489,18 @@ msgid "" "if args.verbosity:\n" " print(\"verbosity turned on\")" msgstr "" +"import argparse\n" +"parser = argparse.ArgumentParser()\n" +"parser.add_argument(\"--verbosity\", help=\"increase output verbosity\")\n" +"args = parser.parse_args()\n" +"if args.verbosity:\n" +" print(\"verbosity turned on\")" #: ../../howto/argparse.rst:241 ../../howto/argparse.rst:287 #: ../../howto/argparse.rst:403 ../../howto/argparse.rst:437 msgid "And the output:" msgstr "実行してみましょう:" -#: ../../howto/argparse.rst:243 msgid "" "$ python prog.py --verbosity 1\n" "verbosity turned on\n" @@ -431,6 +516,19 @@ msgid "" "usage: prog.py [-h] [--verbosity VERBOSITY]\n" "prog.py: error: argument --verbosity: expected one argument" msgstr "" +"$ python prog.py --verbosity 1\n" +"verbosity turned on\n" +"$ python prog.py\n" +"$ python prog.py --help\n" +"usage: prog.py [-h] [--verbosity VERBOSITY]\n" +"\n" +"options:\n" +" -h, --help show this help message and exit\n" +" --verbosity VERBOSITY\n" +" increase output verbosity\n" +"$ python prog.py --verbosity\n" +"usage: prog.py [-h] [--verbosity VERBOSITY]\n" +"prog.py: error: argument --verbosity: expected one argument" #: ../../howto/argparse.rst:261 msgid "" @@ -476,7 +574,6 @@ msgstr "" "は、実際には ``True`` または ``False`` の二つの値だけが有効です。そうなるよう" "にコードを修正してみましょう::" -#: ../../howto/argparse.rst:279 msgid "" "import argparse\n" "parser = argparse.ArgumentParser()\n" @@ -486,8 +583,14 @@ msgid "" "if args.verbose:\n" " print(\"verbosity turned on\")" msgstr "" +"import argparse\n" +"parser = argparse.ArgumentParser()\n" +"parser.add_argument(\"--verbose\", help=\"increase output verbosity\",\n" +" action=\"store_true\")\n" +"args = parser.parse_args()\n" +"if args.verbose:\n" +" print(\"verbosity turned on\")" -#: ../../howto/argparse.rst:289 msgid "" "$ python prog.py --verbose\n" "verbosity turned on\n" @@ -501,6 +604,17 @@ msgid "" " -h, --help show this help message and exit\n" " --verbose increase output verbosity" msgstr "" +"$ python prog.py --verbose\n" +"verbosity turned on\n" +"$ python prog.py --verbose 1\n" +"usage: prog.py [-h] [--verbose]\n" +"prog.py: error: unrecognized arguments: 1\n" +"$ python prog.py --help\n" +"usage: prog.py [-h] [--verbose]\n" +"\n" +"options:\n" +" -h, --help show this help message and exit\n" +" --verbose increase output verbosity" #: ../../howto/argparse.rst:305 msgid "" @@ -542,7 +656,6 @@ msgstr "" "コマンドラインになれていれば、オプションの短いバージョンの話題に触れていない" "ことに気付いたでしょう。それはとても簡単です::" -#: ../../howto/argparse.rst:325 msgid "" "import argparse\n" "parser = argparse.ArgumentParser()\n" @@ -553,12 +666,19 @@ msgid "" "if args.verbose:\n" " print(\"verbosity turned on\")" msgstr "" +"import argparse\n" +"parser = argparse.ArgumentParser()\n" +"parser.add_argument(\"-v\", \"--verbose\", help=\"increase output " +"verbosity\",\n" +" action=\"store_true\")\n" +"args = parser.parse_args()\n" +"if args.verbose:\n" +" print(\"verbosity turned on\")" #: ../../howto/argparse.rst:333 msgid "And here goes:" msgstr "上記のプログラムを実行するとこうなります:" -#: ../../howto/argparse.rst:335 msgid "" "$ python prog.py -v\n" "verbosity turned on\n" @@ -569,6 +689,14 @@ msgid "" " -h, --help show this help message and exit\n" " -v, --verbose increase output verbosity" msgstr "" +"$ python prog.py -v\n" +"verbosity turned on\n" +"$ python prog.py --help\n" +"usage: prog.py [-h] [-v]\n" +"\n" +"options:\n" +" -h, --help show this help message and exit\n" +" -v, --verbose increase output verbosity" #: ../../howto/argparse.rst:346 msgid "Note that the new ability is also reflected in the help text." @@ -582,7 +710,6 @@ msgstr "位置引数とOptional引数の併用" msgid "Our program keeps growing in complexity::" msgstr "プログラムが複雑になってきました::" -#: ../../howto/argparse.rst:354 msgid "" "import argparse\n" "parser = argparse.ArgumentParser()\n" @@ -597,12 +724,23 @@ msgid "" "else:\n" " print(answer)" msgstr "" +"import argparse\n" +"parser = argparse.ArgumentParser()\n" +"parser.add_argument(\"square\", type=int,\n" +" help=\"display a square of a given number\")\n" +"parser.add_argument(\"-v\", \"--verbose\", action=\"store_true\",\n" +" help=\"increase output verbosity\")\n" +"args = parser.parse_args()\n" +"answer = args.square**2\n" +"if args.verbose:\n" +" print(f\"the square of {args.square} equals {answer}\")\n" +"else:\n" +" print(answer)" #: ../../howto/argparse.rst:367 msgid "And now the output:" msgstr "出力は以下のようになります:" -#: ../../howto/argparse.rst:369 msgid "" "$ python prog.py\n" "usage: prog.py [-h] [-v] square\n" @@ -614,14 +752,22 @@ msgid "" "$ python prog.py --verbose 4\n" "the square of 4 equals 16" msgstr "" +"$ python prog.py\n" +"usage: prog.py [-h] [-v] square\n" +"prog.py: error: the following arguments are required: square\n" +"$ python prog.py 4\n" +"16\n" +"$ python prog.py 4 --verbose\n" +"the square of 4 equals 16\n" +"$ python prog.py --verbose 4\n" +"the square of 4 equals 16" #: ../../howto/argparse.rst:381 msgid "We've brought back a positional argument, hence the complaint." msgstr "位置引数を元に戻したので、引数を指定しないとエラーになりました。" -#: ../../howto/argparse.rst:383 msgid "Note that the order does not matter." -msgstr "2つのオプションの順序を考慮しないことに注意してください。" +msgstr "指定する順序は関係ありません。" #: ../../howto/argparse.rst:385 msgid "" @@ -631,7 +777,6 @@ msgstr "" "複数の詳細レベルを値にとれるようにプログラムを元に戻して、指定された値を使っ" "てみましょう::" -#: ../../howto/argparse.rst:388 msgid "" "import argparse\n" "parser = argparse.ArgumentParser()\n" @@ -648,8 +793,21 @@ msgid "" "else:\n" " print(answer)" msgstr "" +"import argparse\n" +"parser = argparse.ArgumentParser()\n" +"parser.add_argument(\"square\", type=int,\n" +" help=\"display a square of a given number\")\n" +"parser.add_argument(\"-v\", \"--verbosity\", type=int,\n" +" help=\"increase output verbosity\")\n" +"args = parser.parse_args()\n" +"answer = args.square**2\n" +"if args.verbosity == 2:\n" +" print(f\"the square of {args.square} equals {answer}\")\n" +"elif args.verbosity == 1:\n" +" print(f\"{args.square}^2 == {answer}\")\n" +"else:\n" +" print(answer)" -#: ../../howto/argparse.rst:405 msgid "" "$ python prog.py 4\n" "16\n" @@ -663,6 +821,17 @@ msgid "" "$ python prog.py 4 -v 3\n" "16" msgstr "" +"$ python prog.py 4\n" +"16\n" +"$ python prog.py 4 -v\n" +"usage: prog.py [-h] [-v VERBOSITY] square\n" +"prog.py: error: argument -v/--verbosity: expected one argument\n" +"$ python prog.py 4 -v 1\n" +"4^2 == 16\n" +"$ python prog.py 4 -v 2\n" +"the square of 4 equals 16\n" +"$ python prog.py 4 -v 3\n" +"16" #: ../../howto/argparse.rst:419 msgid "" @@ -673,7 +842,6 @@ msgstr "" "プログラムのバグである最後の結果を除いて、上手く行っているようです。このバグ" "を、``--verbosity`` オプションが取れる値を制限することで修正しましょう::" -#: ../../howto/argparse.rst:422 msgid "" "import argparse\n" "parser = argparse.ArgumentParser()\n" @@ -690,8 +858,21 @@ msgid "" "else:\n" " print(answer)" msgstr "" +"import argparse\n" +"parser = argparse.ArgumentParser()\n" +"parser.add_argument(\"square\", type=int,\n" +" help=\"display a square of a given number\")\n" +"parser.add_argument(\"-v\", \"--verbosity\", type=int, choices=[0, 1, 2],\n" +" help=\"increase output verbosity\")\n" +"args = parser.parse_args()\n" +"answer = args.square**2\n" +"if args.verbosity == 2:\n" +" print(f\"the square of {args.square} equals {answer}\")\n" +"elif args.verbosity == 1:\n" +" print(f\"{args.square}^2 == {answer}\")\n" +"else:\n" +" print(answer)" -#: ../../howto/argparse.rst:439 msgid "" "$ python prog.py 4 -v 3\n" "usage: prog.py [-h] [-v {0,1,2}] square\n" @@ -708,6 +889,20 @@ msgid "" " -v, --verbosity {0,1,2}\n" " increase output verbosity" msgstr "" +"$ python prog.py 4 -v 3\n" +"usage: prog.py [-h] [-v {0,1,2}] square\n" +"prog.py: error: argument -v/--verbosity: invalid choice: 3 (choose from 0, " +"1, 2)\n" +"$ python prog.py 4 -h\n" +"usage: prog.py [-h] [-v {0,1,2}] square\n" +"\n" +"positional arguments:\n" +" square display a square of a given number\n" +"\n" +"options:\n" +" -h, --help show this help message and exit\n" +" -v, --verbosity {0,1,2}\n" +" increase output verbosity" #: ../../howto/argparse.rst:455 msgid "" @@ -727,7 +922,6 @@ msgstr "" "ファイルがその詳細レベル引数を扱う方法と同じです。( ``python --help`` の出力" "を確認してください)::" -#: ../../howto/argparse.rst:462 msgid "" "import argparse\n" "parser = argparse.ArgumentParser()\n" @@ -744,6 +938,20 @@ msgid "" "else:\n" " print(answer)" msgstr "" +"import argparse\n" +"parser = argparse.ArgumentParser()\n" +"parser.add_argument(\"square\", type=int,\n" +" help=\"display the square of a given number\")\n" +"parser.add_argument(\"-v\", \"--verbosity\", action=\"count\",\n" +" help=\"increase output verbosity\")\n" +"args = parser.parse_args()\n" +"answer = args.square**2\n" +"if args.verbosity == 2:\n" +" print(f\"the square of {args.square} equals {answer}\")\n" +"elif args.verbosity == 1:\n" +" print(f\"{args.square}^2 == {answer}\")\n" +"else:\n" +" print(answer)" #: ../../howto/argparse.rst:477 msgid "" @@ -753,7 +961,6 @@ msgstr "" "もう一つの action である \"count\" を紹介します。これは指定されたオプションの" "出現回数を数えます:" -#: ../../howto/argparse.rst:481 msgid "" "$ python prog.py 4\n" "16\n" @@ -778,6 +985,28 @@ msgid "" "$ python prog.py 4 -vvv\n" "16" msgstr "" +"$ python prog.py 4\n" +"16\n" +"$ python prog.py 4 -v\n" +"4^2 == 16\n" +"$ python prog.py 4 -vv\n" +"the square of 4 equals 16\n" +"$ python prog.py 4 --verbosity --verbosity\n" +"the square of 4 equals 16\n" +"$ python prog.py 4 -v 1\n" +"usage: prog.py [-h] [-v] square\n" +"prog.py: error: unrecognized arguments: 1\n" +"$ python prog.py 4 -h\n" +"usage: prog.py [-h] [-v] square\n" +"\n" +"positional arguments:\n" +" square display a square of a given number\n" +"\n" +"options:\n" +" -h, --help show this help message and exit\n" +" -v, --verbosity increase output verbosity\n" +"$ python prog.py 4 -vvv\n" +"16" #: ../../howto/argparse.rst:506 msgid "" @@ -830,7 +1059,6 @@ msgstr "最後の出力はプログラムにバグがあることを示します msgid "Let's fix::" msgstr "修正しましょう::" -#: ../../howto/argparse.rst:529 msgid "" "import argparse\n" "parser = argparse.ArgumentParser()\n" @@ -849,12 +1077,27 @@ msgid "" "else:\n" " print(answer)" msgstr "" +"import argparse\n" +"parser = argparse.ArgumentParser()\n" +"parser.add_argument(\"square\", type=int,\n" +" help=\"display a square of a given number\")\n" +"parser.add_argument(\"-v\", \"--verbosity\", action=\"count\",\n" +" help=\"increase output verbosity\")\n" +"args = parser.parse_args()\n" +"answer = args.square**2\n" +"\n" +"# バグ修正: == を >= に置き換える\n" +"if args.verbosity >= 2:\n" +" print(f\"the square of {args.square} equals {answer}\")\n" +"elif args.verbosity >= 1:\n" +" print(f\"{args.square}^2 == {answer}\")\n" +"else:\n" +" print(answer)" #: ../../howto/argparse.rst:546 msgid "And this is what it gives:" msgstr "これが結果です:" -#: ../../howto/argparse.rst:548 msgid "" "$ python prog.py 4 -vvv\n" "the square of 4 equals 16\n" @@ -866,14 +1109,22 @@ msgid "" " if args.verbosity >= 2:\n" "TypeError: '>=' not supported between instances of 'NoneType' and 'int'" msgstr "" +"$ python prog.py 4 -vvv\n" +"the square of 4 equals 16\n" +"$ python prog.py 4 -vvvv\n" +"the square of 4 equals 16\n" +"$ python prog.py 4\n" +"Traceback (most recent call last):\n" +" File \"prog.py\", line 11, in \n" +" if args.verbosity >= 2:\n" +"TypeError: '>=' not supported between instances of 'NoneType' and 'int'" -#: ../../howto/argparse.rst:561 msgid "" "First output went well, and fixes the bug we had before. That is, we want " "any value >= 2 to be as verbose as possible." msgstr "" -"最初の出力は上手くいっていますし、以前のバグが修正されています。最も詳細な出" -"力を得るには、2 以上の値が必要です。" +"最初の出力はうまくいき、先ほどのバグが直りました。\n" +"2 以上ならどの値でも最も詳しい出力にしたかったので、この動作で正解です。" #: ../../howto/argparse.rst:564 msgid "Third output not so good." @@ -883,7 +1134,6 @@ msgstr "三番目の結果は、よくありません。" msgid "Let's fix that bug::" msgstr "このバグを修正しましょう::" -#: ../../howto/argparse.rst:568 msgid "" "import argparse\n" "parser = argparse.ArgumentParser()\n" @@ -900,6 +1150,20 @@ msgid "" "else:\n" " print(answer)" msgstr "" +"import argparse\n" +"parser = argparse.ArgumentParser()\n" +"parser.add_argument(\"square\", type=int,\n" +" help=\"display a square of a given number\")\n" +"parser.add_argument(\"-v\", \"--verbosity\", action=\"count\", default=0,\n" +" help=\"increase output verbosity\")\n" +"args = parser.parse_args()\n" +"answer = args.square**2\n" +"if args.verbosity >= 2:\n" +" print(f\"the square of {args.square} equals {answer}\")\n" +"elif args.verbosity >= 1:\n" +" print(f\"{args.square}^2 == {answer}\")\n" +"else:\n" +" print(answer)" #: ../../howto/argparse.rst:583 msgid "" @@ -918,11 +1182,12 @@ msgstr "" msgid "And:" msgstr "こうなりました:" -#: ../../howto/argparse.rst:592 msgid "" "$ python prog.py 4\n" "16" msgstr "" +"$ python prog.py 4\n" +"16" #: ../../howto/argparse.rst:597 msgid "" @@ -946,7 +1211,6 @@ msgstr "" "もし、この小さなプログラムを二乗以外の累乗が行えるように拡張するとどうなるで" "しょうか::" -#: ../../howto/argparse.rst:609 msgid "" "import argparse\n" "parser = argparse.ArgumentParser()\n" @@ -962,13 +1226,25 @@ msgid "" "else:\n" " print(answer)" msgstr "" +"import argparse\n" +"parser = argparse.ArgumentParser()\n" +"parser.add_argument(\"x\", type=int, help=\"the base\")\n" +"parser.add_argument(\"y\", type=int, help=\"the exponent\")\n" +"parser.add_argument(\"-v\", \"--verbosity\", action=\"count\", default=0)\n" +"args = parser.parse_args()\n" +"answer = args.x**args.y\n" +"if args.verbosity >= 2:\n" +" print(f\"{args.x} to the power {args.y} equals {answer}\")\n" +"elif args.verbosity >= 1:\n" +" print(f\"{args.x}^{args.y} == {answer}\")\n" +"else:\n" +" print(answer)" #: ../../howto/argparse.rst:623 ../../howto/argparse.rst:661 #: ../../howto/argparse.rst:877 msgid "Output:" msgstr "出力:" -#: ../../howto/argparse.rst:625 msgid "" "$ python prog.py\n" "usage: prog.py [-h] [-v] x y\n" @@ -986,6 +1262,21 @@ msgid "" "$ python prog.py 4 2 -v\n" "4^2 == 16" msgstr "" +"$ python prog.py\n" +"usage: prog.py [-h] [-v] x y\n" +"prog.py: error: the following arguments are required: x, y\n" +"$ python prog.py -h\n" +"usage: prog.py [-h] [-v] x y\n" +"\n" +"positional arguments:\n" +" x the base\n" +" y the exponent\n" +"\n" +"options:\n" +" -h, --help show this help message and exit\n" +" -v, --verbosity\n" +"$ python prog.py 4 2 -v\n" +"4^2 == 16" #: ../../howto/argparse.rst:644 msgid "" @@ -996,7 +1287,6 @@ msgstr "" "これまで、出力されるテキストを *変更する* ために詳細レベルを使ってきました。" "かわりに下記の例では、*追加の* テキストを出力するのに詳細レベルを使用します::" -#: ../../howto/argparse.rst:648 msgid "" "import argparse\n" "parser = argparse.ArgumentParser()\n" @@ -1011,8 +1301,19 @@ msgid "" " print(f\"{args.x}^{args.y} == \", end=\"\")\n" "print(answer)" msgstr "" +"import argparse\n" +"parser = argparse.ArgumentParser()\n" +"parser.add_argument(\"x\", type=int, help=\"the base\")\n" +"parser.add_argument(\"y\", type=int, help=\"the exponent\")\n" +"parser.add_argument(\"-v\", \"--verbosity\", action=\"count\", default=0)\n" +"args = parser.parse_args()\n" +"answer = args.x**args.y\n" +"if args.verbosity >= 2:\n" +" print(f\"Running '{__file__}'\")\n" +"if args.verbosity >= 1:\n" +" print(f\"{args.x}^{args.y} == \", end=\"\")\n" +"print(answer)" -#: ../../howto/argparse.rst:663 msgid "" "$ python prog.py 4 2\n" "16\n" @@ -1022,6 +1323,13 @@ msgid "" "Running 'prog.py'\n" "4^2 == 16" msgstr "" +"$ python prog.py 4 2\n" +"16\n" +"$ python prog.py 4 2 -v\n" +"4^2 == 16\n" +"$ python prog.py 4 2 -vv\n" +"Running 'prog.py'\n" +"4^2 == 16" #: ../../howto/argparse.rst:677 msgid "Specifying ambiguous arguments" @@ -1037,7 +1345,6 @@ msgstr "" "いまいさがあるときは、 ``--`` を使うことで :meth:`~ArgumentParser." "parse_args` に対してこれ以降は位置引数であることを伝えることができます::" -#: ../../howto/argparse.rst:683 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-n', nargs='+')\n" @@ -1058,12 +1365,29 @@ msgid "" ">>> parser.parse_args(['-n', '1', '--', '2', '3'])\n" "Namespace(args=['2', '3'], n=['1'])" msgstr "" +">>> parser = argparse.ArgumentParser(prog='PROG')\n" +">>> parser.add_argument('-n', nargs='+')\n" +">>> parser.add_argument('args', nargs='*')\n" +"\n" +">>> # 曖昧なので、parse_args はオプションと解釈する\n" +">>> parser.parse_args(['-f'])\n" +"usage: PROG [-h] [-n N [N ...]] [args ...]\n" +"PROG: error: unrecognized arguments: -f\n" +"\n" +">>> parser.parse_args(['--', '-f'])\n" +"Namespace(args=['-f'], n=None)\n" +"\n" +">>> # 曖昧なので、-n オプションは引数を取れるだけ取る\n" +">>> parser.parse_args(['-n', '1', '2', '3'])\n" +"Namespace(args=[], n=['1', '2', '3'])\n" +"\n" +">>> parser.parse_args(['-n', '1', '--', '2', '3'])\n" +"Namespace(args=['2', '3'], n=['1'])" #: ../../howto/argparse.rst:704 msgid "Conflicting options" msgstr "競合するオプション" -#: ../../howto/argparse.rst:706 msgid "" "So far, we have been working with two methods of an :class:`argparse." "ArgumentParser` instance. Let's introduce a third one, :meth:" @@ -1072,14 +1396,14 @@ msgid "" "program so that the new functionality makes more sense: we'll introduce the " "``--quiet`` option, which will be the opposite of the ``--verbose`` one::" msgstr "" -"これまでのところ、 :class:`argparse.ArgumentParser` インスタンスの2つのメソッ" -"ドについて学んできました。ここで3つめのメソッドとして :meth:`~ArgumentParser." -"add_mutually_exclusive_group` を導入しましょう。このメソッドは互いに対立する" -"引数の指定を可能にします。また、新しい機能として理解しやすいように、プログラ" -"ムの残りの部分を変更しましょう: 以下では ``--quiet`` オプションを ``--" -"verbose`` と反対のオプションとして導入します::" +"これまで :class:`argparse.ArgumentParser` インスタンスの 2 つのメソッドを使っ" +"てきました。\n" +"3 つ目の :meth:`~ArgumentParser.add_mutually_exclusive_group` を紹介しましょ" +"う。\n" +"このメソッドでは、互いに同時指定できないオプションを定義できます。\n" +"新しい機能の意味が伝わるよう、プログラムのほかの部分も変更し、``--verbose`` " +"と反対の働きをする ``--quiet`` オプションを導入します。 ::" -#: ../../howto/argparse.rst:714 msgid "" "import argparse\n" "\n" @@ -1099,16 +1423,31 @@ msgid "" "else:\n" " print(f\"{args.x}^{args.y} == {answer}\")" msgstr "" +"import argparse\n" +"\n" +"parser = argparse.ArgumentParser()\n" +"group = parser.add_mutually_exclusive_group()\n" +"group.add_argument(\"-v\", \"--verbose\", action=\"store_true\")\n" +"group.add_argument(\"-q\", \"--quiet\", action=\"store_true\")\n" +"parser.add_argument(\"x\", type=int, help=\"the base\")\n" +"parser.add_argument(\"y\", type=int, help=\"the exponent\")\n" +"args = parser.parse_args()\n" +"answer = args.x**args.y\n" +"\n" +"if args.quiet:\n" +" print(answer)\n" +"elif args.verbose:\n" +" print(f\"{args.x} to the power {args.y} equals {answer}\")\n" +"else:\n" +" print(f\"{args.x}^{args.y} == {answer}\")" -#: ../../howto/argparse.rst:732 msgid "" "Our program is now simpler, and we've lost some functionality for the sake " "of demonstration. Anyways, here's the output:" msgstr "" -"プログラムはより簡潔になりましたが、デモのための機能が失われました。ともかく" -"下記が実行結果です:" +"プログラムは簡単になり、説明のためにいくつかの機能を省きました。\n" +"出力を見てみましょう。" -#: ../../howto/argparse.rst:735 msgid "" "$ python prog.py 4 2\n" "4^2 == 16\n" @@ -1123,6 +1462,18 @@ msgid "" "usage: prog.py [-h] [-v | -q] x y\n" "prog.py: error: argument -q/--quiet: not allowed with argument -v/--verbose" msgstr "" +"$ python prog.py 4 2\n" +"4^2 == 16\n" +"$ python prog.py 4 2 -q\n" +"16\n" +"$ python prog.py 4 2 -v\n" +"4 to the power 2 equals 16\n" +"$ python prog.py 4 2 -vq\n" +"usage: prog.py [-h] [-v | -q] x y\n" +"prog.py: error: argument -q/--quiet: not allowed with argument -v/--verbose\n" +"$ python prog.py 4 2 -v --quiet\n" +"usage: prog.py [-h] [-v | -q] x y\n" +"prog.py: error: argument -q/--quiet: not allowed with argument -v/--verbose" #: ../../howto/argparse.rst:750 msgid "" @@ -1142,7 +1493,6 @@ msgstr "" "結びの前に、恐らくあなたはプログラムの主な目的をユーザに伝えたいでしょう。万" "が一、彼らがそれを知らないときに備えて::" -#: ../../howto/argparse.rst:757 msgid "" "import argparse\n" "\n" @@ -1163,6 +1513,24 @@ msgid "" "else:\n" " print(f\"{args.x}^{args.y} == {answer}\")" msgstr "" +"import argparse\n" +"\n" +"parser = argparse.ArgumentParser(description=\"calculate X to the power of " +"Y\")\n" +"group = parser.add_mutually_exclusive_group()\n" +"group.add_argument(\"-v\", \"--verbose\", action=\"store_true\")\n" +"group.add_argument(\"-q\", \"--quiet\", action=\"store_true\")\n" +"parser.add_argument(\"x\", type=int, help=\"the base\")\n" +"parser.add_argument(\"y\", type=int, help=\"the exponent\")\n" +"args = parser.parse_args()\n" +"answer = args.x**args.y\n" +"\n" +"if args.quiet:\n" +" print(answer)\n" +"elif args.verbose:\n" +" print(f\"{args.x} to the power {args.y} equals {answer}\")\n" +"else:\n" +" print(f\"{args.x}^{args.y} == {answer}\")" #: ../../howto/argparse.rst:775 msgid "" @@ -1173,7 +1541,6 @@ msgstr "" "使用方法のテキストが少し変化しました。``[-v | -q]`` は ``-v`` または ``-q`` " "のどちらかを使用できるが、同時に両方を使用できないことを意味します:" -#: ../../howto/argparse.rst:779 ../../howto/argparse.rst:806 msgid "" "$ python prog.py --help\n" "usage: prog.py [-h] [-v | -q] x y\n" @@ -1189,6 +1556,19 @@ msgid "" " -v, --verbose\n" " -q, --quiet" msgstr "" +"$ python prog.py --help\n" +"usage: prog.py [-h] [-v | -q] x y\n" +"\n" +"calculate X to the power of Y\n" +"\n" +"positional arguments:\n" +" x the base\n" +" y the exponent\n" +"\n" +"options:\n" +" -h, --help show this help message and exit\n" +" -v, --verbose\n" +" -q, --quiet" #: ../../howto/argparse.rst:797 msgid "How to translate the argparse output" @@ -1228,9 +1608,8 @@ msgstr "" "す。たとえば、 `Babel `__ を使い、次のコマンドを実" "行します。" -#: ../../howto/argparse.rst:829 msgid "$ pybabel extract -o messages.po /usr/lib/python3.12/argparse.py" -msgstr "" +msgstr "$ pybabel extract -o messages.po /usr/lib/python3.12/argparse.py" #: ../../howto/argparse.rst:833 msgid "" @@ -1250,11 +1629,12 @@ msgstr "" "システム上の :mod:`argparse` モジュールの場所は、次のスクリプトで調べられま" "す::" -#: ../../howto/argparse.rst:840 msgid "" "import argparse\n" "print(argparse.__file__)" msgstr "" +"import argparse\n" +"print(argparse.__file__)" #: ../../howto/argparse.rst:843 msgid "" @@ -1274,33 +1654,39 @@ msgstr "" ":mod:`argparse` 出力内のあなたの文字列を翻訳するには、 :mod:`gettext` を使い" "ます。" -#: ../../howto/argparse.rst:850 msgid "Custom type converters" -msgstr "" +msgstr "独自の型変換" -#: ../../howto/argparse.rst:852 msgid "" "The :mod:`argparse` module allows you to specify custom type converters for " "your command-line arguments. This allows you to modify user input before " "it's stored in the :class:`argparse.Namespace`. This can be useful when you " "need to pre-process the input before it is used in your program." msgstr "" +":mod:`argparse` モジュールでは、コマンドライン引数に独自の型変換処理を指定で" +"きます。\n" +"これにより、利用者の入力を :class:`argparse.Namespace` に格納する前に変換でき" +"ます。\n" +"プログラムで入力を使う前に前処理が必要な場合に役立ちます。" -#: ../../howto/argparse.rst:857 msgid "" "When using a custom type converter, you can use any callable that takes a " "single string argument (the argument value) and returns the converted value. " "However, if you need to handle more complex scenarios, you can use a custom " "action class with the **action** parameter instead." msgstr "" +"独自の型変換処理には、引数の値を表す文字列を 1 つ受け取り、変換した値を返す任" +"意の呼び出し可能オブジェクトを使えます。\n" +"もっと複雑な処理が必要な場合は、代わりに **action** 引数で独自のアクションク" +"ラスを指定できます。" -#: ../../howto/argparse.rst:862 msgid "" "For example, let's say you want to handle arguments with different prefixes " "and process them accordingly::" msgstr "" +"例えば、異なるプレフィクスの引数を受け取り、それぞれに応じて処理したいとしま" +"す。 ::" -#: ../../howto/argparse.rst:865 msgid "" "import argparse\n" "\n" @@ -1314,37 +1700,52 @@ msgid "" "args = parser.parse_args()\n" "print(args)" msgstr "" +"import argparse\n" +"\n" +"parser = argparse.ArgumentParser(prefix_chars='-+')\n" +"\n" +"parser.add_argument('-a', metavar='', action='append',\n" +" type=lambda x: ('-', x))\n" +"parser.add_argument('+a', metavar='', action='append',\n" +" type=lambda x: ('+', x))\n" +"\n" +"args = parser.parse_args()\n" +"print(args)" -#: ../../howto/argparse.rst:879 msgid "" "$ python prog.py -a value1 +a value2\n" "Namespace(a=[('-', 'value1'), ('+', 'value2')])" msgstr "" +"$ python prog.py -a value1 +a value2\n" +"Namespace(a=[('-', 'value1'), ('+', 'value2')])" -#: ../../howto/argparse.rst:884 msgid "In this example, we:" -msgstr "" +msgstr "この例では、次のことを行っています。" -#: ../../howto/argparse.rst:886 msgid "" "Created a parser with custom prefix characters using the ``prefix_chars`` " "parameter." msgstr "" +"``prefix_chars`` 引数を使い、独自のプレフィクス文字を持つパーサを作りました。" -#: ../../howto/argparse.rst:889 msgid "" "Defined two arguments, ``-a`` and ``+a``, which used the ``type`` parameter " "to create custom type converters to store the value in a tuple with the " "prefix." msgstr "" +"``-a`` と ``+a`` という 2 つの引数を定義しました。\n" +"それぞれの ``type`` 引数で独自の型変換処理を指定し、値をプレフィクスと一緒に" +"タプルに格納するようにしました。" -#: ../../howto/argparse.rst:892 msgid "" "Without the custom type converters, the arguments would have treated the ``-" "a`` and ``+a`` as the same argument, which would have been undesirable. By " "using custom type converters, we were able to differentiate between the two " "arguments." msgstr "" +"独自の型変換処理がなければ、``-a`` と ``+a`` は同じ引数として扱われ、望ましく" +"ない結果になります。\n" +"型変換処理を使うことで、2 つの引数を区別できました。" #: ../../howto/argparse.rst:897 msgid "Conclusion" diff --git a/howto/clinic.po b/howto/clinic.po index c11b77535..2578026fd 100644 --- a/howto/clinic.po +++ b/howto/clinic.po @@ -17,10 +17,10 @@ msgstr "" "Last-Translator: tomo, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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/clinic.rst:8 diff --git a/howto/cporting.po b/howto/cporting.po index cad700c9b..5290ad2c4 100644 --- a/howto/cporting.po +++ b/howto/cporting.po @@ -17,10 +17,10 @@ msgstr "" "Last-Translator: tomo, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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/cporting.rst:7 diff --git a/howto/curses.po b/howto/curses.po index d3dfc2ca5..1139f1d6f 100644 --- a/howto/curses.po +++ b/howto/curses.po @@ -17,10 +17,10 @@ msgstr "" "Last-Translator: Mikami Akiko, 2021\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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/curses.rst:5 @@ -92,7 +92,6 @@ msgstr "" "みのUnixです。ほかにも、OSのインストーラや、カーネル設定などのツールで、これ" "らはグラフィカルサポートが利用可能になる前に動作する必要があります。" -#: ../../howto/curses.rst:38 msgid "" "The curses library provides fairly basic functionality, providing the " "programmer with an abstraction of a display containing multiple non-" @@ -103,6 +102,17 @@ msgid "" "interface concepts such as buttons, checkboxes, or dialogs; if you need such " "features, consider a user interface library such as :pypi:`Urwid`." msgstr "" +"curses ライブラリが提供するのは比較的基本的な機能です。\n" +"画面を、互いに重ならない複数のテキストウィンドウとして扱う仕組みを提供しま" +"す。\n" +"ウィンドウの内容は、テキストの追加や削除、見た目の変更など、さまざまな方法で" +"変更できます。\n" +"curses ライブラリは、意図した表示にするために端末へ送る制御コードを判断しま" +"す。\n" +"ボタン、チェックボックス、ダイアログなどのユーザーインターフェース部品の多く" +"は提供しません。\n" +"そのような機能が必要なら、:pypi:`Urwid` などのユーザーインターフェースライブ" +"ラリを検討してください。" #: ../../howto/curses.rst:48 msgid "" @@ -135,7 +145,6 @@ msgstr "" msgid "The Python curses module" msgstr "Python の curses module" -#: ../../howto/curses.rst:65 msgid "" "The Python module is a fairly simple wrapper over the C functions provided " "by curses; if you're already familiar with curses programming in C, it's " @@ -145,6 +154,13 @@ msgid "" "mvwaddstr` into a single :meth:`~curses.window.addstr` method. You'll see " "this covered in more detail later." msgstr "" +"Python のモジュールは、curses が提供する C 関数の比較的単純なラッパです。\n" +"C での curses プログラミングに慣れていれば、その知識を Python でも簡単に生か" +"せます。\n" +"最大の違いは、Python のインターフェースでは :c:func:`!addstr`、:c:func:`!" +"mvaddstr`、:c:func:`!mvwaddstr` のような別々の C 関数を 1 つの :meth:" +"`~curses.window.addstr` メソッドにまとめ、扱いやすくしていることです。\n" +"詳しくは後で説明します。" #: ../../howto/curses.rst:73 msgid "" @@ -163,7 +179,6 @@ msgstr "" msgid "Starting and ending a curses application" msgstr "curses アプリケーションの起動と終了" -#: ../../howto/curses.rst:82 msgid "" "Before doing anything, curses must be initialized. This is done by calling " "the :func:`~curses.initscr` function, which will determine the terminal " @@ -172,23 +187,31 @@ msgid "" "object representing the entire screen; this is usually called ``stdscr`` " "after the name of the corresponding C variable. ::" msgstr "" +"何をするにしても、まず curses を初期化する必要があります。\n" +":func:`~curses.initscr` 関数を呼び出すと、端末の種類を判定し、必要な設定コー" +"ドを端末へ送り、内部の各種データ構造を作成します。\n" +"成功すると、:func:`!initscr` は画面全体を表すウィンドウオブジェクトを返しま" +"す。\n" +"これは対応する C の変数名にちなんで、通常 ``stdscr`` と呼ばれます。 ::" -#: ../../howto/curses.rst:90 msgid "" "import curses\n" "stdscr = curses.initscr()" msgstr "" +"import curses\n" +"stdscr = curses.initscr()" -#: ../../howto/curses.rst:93 msgid "" "Usually curses applications turn off automatic echoing of keys to the " "screen, in order to be able to read keys and only display them under certain " "circumstances. This requires calling the :func:`~curses.noecho` function. ::" msgstr "" +"通常、curses アプリケーションではキー入力を自動的に画面へ表示する機能 (エ" +"コー) を無効にし、キーを読み取った後、必要な場合にだけ表示します。\n" +"そのためには :func:`~curses.noecho` 関数を呼び出します。 ::" -#: ../../howto/curses.rst:98 msgid "curses.noecho()" -msgstr "" +msgstr "curses.noecho()" #: ../../howto/curses.rst:100 msgid "" @@ -200,11 +223,9 @@ msgstr "" "する必要があります; これは cbreak モードと呼ばれ、通常の入力がバッファされる" "モードと逆に動作します。 ::" -#: ../../howto/curses.rst:104 msgid "curses.cbreak()" -msgstr "" +msgstr "curses.cbreak()" -#: ../../howto/curses.rst:106 msgid "" "Terminals usually return special keys, such as the cursor keys or navigation " "keys such as Page Up and Home, as a multibyte escape sequence. While you " @@ -213,15 +234,14 @@ msgid "" "const:`curses.KEY_LEFT`. To get curses to do the job, you'll have to enable " "keypad mode. ::" msgstr "" -"端末は通常、カーソルキーや Page Up や Home といった操作キーなどの特別なキーを" -"マルチバイトエスケープシーケンスとして返します。それらのシーケンスを想定して" -"対応する処理を行うアプリケーションを書けるように、 curses はそれを :const:" -"`curses.KEY_LEFT` のような特別な値を返して行ってくれます。 curses にその仕事" -"をさせるには、キーパッドモードを有効にする必要があります。 ::" +"端末は通常、カーソルキーや Page Up、Home などの特殊キーを、複数バイトのエス" +"ケープシーケンスとして返します。\n" +"これらのシーケンスを自分で処理することもできますが、curses に任せると :const:" +"`curses.KEY_LEFT` のような特別な値として受け取れます。\n" +"そのためには、キーパッドモードを有効にします。 ::" -#: ../../howto/curses.rst:113 msgid "stdscr.keypad(True)" -msgstr "" +msgstr "stdscr.keypad(True)" #: ../../howto/curses.rst:115 msgid "" @@ -231,12 +251,14 @@ msgstr "" "curses アプリケーションを終了させるのは起動よりも簡単です。 以下を呼び出す必" "要があります::" -#: ../../howto/curses.rst:118 msgid "" "curses.nocbreak()\n" "stdscr.keypad(False)\n" "curses.echo()" msgstr "" +"curses.nocbreak()\n" +"stdscr.keypad(False)\n" +"curses.echo()" #: ../../howto/curses.rst:122 msgid "" @@ -247,11 +269,9 @@ msgstr "" "cursesに親和性の高い設定をもとに戻します。そして、:func:`~curses.endwin` 関数" "を呼び出し、端末を通常の操作モードに復旧します。 ::" -#: ../../howto/curses.rst:126 msgid "curses.endwin()" -msgstr "" +msgstr "curses.endwin()" -#: ../../howto/curses.rst:128 msgid "" "A common problem when debugging a curses application is to get your terminal " "messed up when the application dies without restoring the terminal to its " @@ -259,11 +279,11 @@ msgid "" "raises an uncaught exception. Keys are no longer echoed to the screen when " "you type them, for example, which makes using the shell difficult." msgstr "" -"curses アプリケーションをデバッグするときの一般的な問題は、アプリケーションが" -"端末を以前の状態に復旧することなく異常終了したときに端末がめちゃめちゃになる" -"ことです。Python ではこの問題はコードにバグがあって、捕捉できない例外が発生し" -"たときによく起きます。タイプしたキーはもはやエコーされません、例えば、シェル" -"を使うのが難しくなります。" +"curses アプリケーションのデバッグでよくある問題は、端末の状態を復元する前にア" +"プリケーションが終了し、端末がおかしな状態のままになることです。\n" +"Python では、コードのバグで例外が発生し、それが捕捉されなかった場合によく起こ" +"ります。\n" +"例えば、入力したキーが画面に表示されなくなり、シェルを使いにくくなります。" #: ../../howto/curses.rst:134 msgid "" @@ -273,7 +293,6 @@ msgstr "" "Pythonでは、これらの複雑さを避けデバッグをより容易にするために、 :func:" "`curses.wrapper` 関数をインポートして、このように使います::" -#: ../../howto/curses.rst:137 msgid "" "from curses import wrapper\n" "\n" @@ -291,8 +310,22 @@ msgid "" "\n" "wrapper(main)" msgstr "" +"from curses import wrapper\n" +"\n" +"def main(stdscr):\n" +" # 画面を消去する\n" +" stdscr.clear()\n" +"\n" +" # i == 10 のとき ZeroDivisionError が発生する。\n" +" for i in range(0, 11):\n" +" v = i-10\n" +" stdscr.addstr(i, 0, '10 divided by {} is {}'.format(v, 10/v))\n" +"\n" +" stdscr.refresh()\n" +" stdscr.getkey()\n" +"\n" +"wrapper(main)" -#: ../../howto/curses.rst:153 msgid "" "The :func:`~curses.wrapper` function takes a callable object and does the " "initializations described above, also initializing colors if color support " @@ -304,19 +337,29 @@ msgid "" "funny state on exception and you'll be able to read the exception's message " "and traceback." msgstr "" +":func:`~curses.wrapper` 関数は呼び出し可能オブジェクトを受け取り、上記の初期" +"化を行います。\n" +"色がサポートされていれば、色の初期化も行います。\n" +"その後、:func:`!wrapper` は渡された呼び出し可能オブジェクトを実行します。\n" +"その呼び出しから戻ると、:func:`!wrapper` は端末をもとの状態に戻します。\n" +"呼び出しは :keyword:`try`...\\ :keyword:`except` の中で行われ、例外が発生する" +"と、それを捕捉して端末の状態を復元してから再送出します。\n" +"そのため、例外が発生しても端末が異常な状態のままにならず、例外のメッセージや" +"トレースバックを読めます。" #: ../../howto/curses.rst:165 msgid "Windows and Pads" msgstr "ウィンドウとパッド" -#: ../../howto/curses.rst:167 msgid "" "Windows are the basic abstraction in curses. A window object represents a " "rectangular area of the screen, and supports methods to display text, erase " "it, allow the user to input strings, and so forth." msgstr "" +"curses の基本となる抽象化はウィンドウです。\n" +"ウィンドウオブジェクトは画面上の長方形の領域を表し、テキストの表示や消去、利" +"用者による文字列の入力などのメソッドを備えています。" -#: ../../howto/curses.rst:171 msgid "" "The ``stdscr`` object returned by the :func:`~curses.initscr` function is a " "window object that covers the entire screen. Many programs may need only " @@ -325,15 +368,22 @@ msgid "" "newwin` function creates a new window of a given size, returning the new " "window object. ::" msgstr "" +":func:`~curses.initscr` 関数が返す ``stdscr`` オブジェクトは、画面全体を覆う" +"ウィンドウオブジェクトです。\n" +"多くのプログラムはこのウィンドウだけで十分ですが、個別に再描画や消去を行うた" +"めに、画面を小さなウィンドウに分けたい場合もあるでしょう。\n" +":func:`~curses.newwin` 関数は、指定されたサイズの新しいウィンドウを作り、その" +"ウィンドウオブジェクトを返します。 ::" -#: ../../howto/curses.rst:178 msgid "" "begin_x = 20; begin_y = 7\n" "height = 5; width = 40\n" "win = curses.newwin(height, width, begin_y, begin_x)" msgstr "" +"begin_x = 20; begin_y = 7\n" +"height = 5; width = 40\n" +"win = curses.newwin(height, width, begin_y, begin_x)" -#: ../../howto/curses.rst:182 msgid "" "Note that the coordinate system used in curses is unusual. Coordinates are " "always passed in the order *y,x*, and the top-left corner of a window is " @@ -342,23 +392,33 @@ msgid "" "difference from most other computer applications, but it's been part of " "curses since it was first written, and it's too late to change things now." msgstr "" +"curses の座標系は独特なので注意してください。\n" +"座標は常に *y,x* の順に渡し、ウィンドウの左上隅が (0,0) です。\n" +"これは *x* 座標を先にする通常の慣習と異なります。\n" +"ほかの多くのアプリケーションと違うのは残念ですが、curses の最初の実装からこの" +"方式なので、今から変更するには遅すぎます。" -#: ../../howto/curses.rst:190 msgid "" "Your application can determine the size of the screen by using the :data:" "`curses.LINES` and :data:`curses.COLS` variables to obtain the *y* and *x* " "sizes. Legal coordinates will then extend from ``(0,0)`` to ``(curses.LINES " "- 1, curses.COLS - 1)``." msgstr "" +"画面のサイズは、:data:`curses.LINES` と :data:`curses.COLS` 変数からそれぞれ " +"*y* 方向と *x* 方向の大きさを取得して調べられます。\n" +"有効な座標の範囲は ``(0,0)`` から ``(curses.LINES - 1, curses.COLS - 1)`` ま" +"でです。" -#: ../../howto/curses.rst:195 msgid "" "When you call a method to display or erase text, the effect doesn't " "immediately show up on the display. Instead you must call the :meth:" "`~curses.window.refresh` method of window objects to update the screen." msgstr "" +"テキストを表示または消去するメソッドを呼び出しても、その結果はすぐには画面に" +"現れません。\n" +"画面を更新するには、ウィンドウオブジェクトの :meth:`~curses.window.refresh` " +"メソッドを呼び出す必要があります。" -#: ../../howto/curses.rst:200 msgid "" "This is because curses was originally written with slow 300-baud terminal " "connections in mind; with these terminals, minimizing the time required to " @@ -368,8 +428,15 @@ msgid "" "window and then clears the window, there's no need to send the original text " "because they're never visible." msgstr "" +"これは、curses が当初、300 ボーという低速な端末接続を想定して書かれたためで" +"す。\n" +"そのような端末では、画面の再描画にかかる時間を最小限にすることが非常に重要で" +"した。\n" +"そこで curses は画面への変更を蓄積し、:meth:`!refresh` が呼ばれたときに最も効" +"率的な方法で表示します。\n" +"例えば、プログラムがウィンドウにテキストを表示してからそのウィンドウを消去し" +"た場合、テキストは実際には表示されないので、端末へ送る必要がありません。" -#: ../../howto/curses.rst:209 msgid "" "In practice, explicitly telling curses to redraw a window doesn't really " "complicate programming with curses much. Most programs go into a flurry of " @@ -378,8 +445,13 @@ msgid "" "redrawn before pausing to wait for user input, by first calling :meth:`!" "stdscr.refresh` or the :meth:`!refresh` method of some other relevant window." msgstr "" +"実際には、ウィンドウの再描画を明示的に指示しても、curses のプログラミングはそ" +"れほど複雑になりません。\n" +"多くのプログラムは一連の処理を行った後、キー入力などの利用者の操作を待って休" +"止します。\n" +"入力待ちに入る前に :meth:`!stdscr.refresh` または必要なほかのウィンドウの :" +"meth:`!refresh` を呼び出し、画面を再描画しておけばよいのです。" -#: ../../howto/curses.rst:217 msgid "" "A pad is a special case of a window; it can be larger than the actual " "display screen, and only a portion of the pad displayed at a time. Creating " @@ -387,8 +459,11 @@ msgid "" "giving the coordinates of the on-screen area where a subsection of the pad " "will be displayed. ::" msgstr "" +"パッドは特殊なウィンドウです。\n" +"実際の画面より大きくでき、一度に表示するのはその一部だけです。\n" +"作成時にはパッドの高さと幅を指定し、更新時にはパッドの一部を表示する画面上の" +"領域の座標を指定します。 ::" -#: ../../howto/curses.rst:223 msgid "" "pad = curses.newpad(100, 100)\n" "# These loops fill the pad with letters; addch() is\n" @@ -405,8 +480,21 @@ msgid "" "# : filled with pad content.\n" "pad.refresh( 0,0, 5,5, 20,75)" msgstr "" +"pad = curses.newpad(100, 100)\n" +"# このループでパッドを文字で埋める。addch() は\n" +"# 次の節で説明する。\n" +"for y in range(0, 99):\n" +" for x in range(0, 99):\n" +" pad.addch(y,x, ord('a') + (x*x+y*y) % 26)\n" +"\n" +"# 画面中央にパッドの一部を表示する。\n" +"# (0,0) : 表示するパッド領域の左上隅の座標。\n" +"# (5,5) : パッドの内容を表示するウィンドウ領域の\n" +"# 左上隅の座標。\n" +"# (20, 75) : パッドの内容を表示するウィンドウ領域の\n" +"# : 右下隅の座標。\n" +"pad.refresh( 0,0, 5,5, 20,75)" -#: ../../howto/curses.rst:238 msgid "" "The :meth:`!refresh` call displays a section of the pad in the rectangle " "extending from coordinate (5,5) to coordinate (20,75) on the screen; the " @@ -414,21 +502,27 @@ msgid "" "Beyond that difference, pads are exactly like ordinary windows and support " "the same methods." msgstr "" +":meth:`!refresh` の呼び出しは、画面上の座標 (5,5) から (20,75) までの長方形" +"に、パッドの一部を表示します。\n" +"表示する部分の左上隅は、パッド上の座標 (0,0) です。\n" +"この点以外は、パッドは通常のウィンドウとまったく同じで、同じメソッドを使えま" +"す。" -#: ../../howto/curses.rst:244 msgid "" "If you have multiple windows and pads on screen there is a more efficient " "way to update the screen and prevent annoying screen flicker as each part of " "the screen gets updated. :meth:`!refresh` actually does two things:" msgstr "" +"画面上に複数のウィンドウやパッドがある場合は、各部分の更新に伴うちらつきを防" +"ぎ、画面をより効率的に更新する方法があります。\n" +":meth:`!refresh` は実際には次の 2 つの処理を行っています。" -#: ../../howto/curses.rst:249 msgid "" "Calls the :meth:`~curses.window.noutrefresh` method of each window to update " "an underlying data structure representing the desired state of the screen." msgstr "" "それぞれのウィンドウの :meth:`~curses.window.noutrefresh` メソッドを呼び出し" -"て、配下にある、スクリーンの望ましい状態を表すデータ構造を更新します。 " +"て、配下にある、スクリーンの望ましい状態を表すデータ構造を更新します。" #: ../../howto/curses.rst:252 msgid "" @@ -438,17 +532,17 @@ msgstr "" ":func:`~curses.doupdate` 関数を呼び出して、データ構造に記録された望ましい状態" "に合致するように、物理スクリーンを更新します。" -#: ../../howto/curses.rst:255 msgid "" "Instead you can call :meth:`!noutrefresh` on a number of windows to update " "the data structure, and then call :func:`!doupdate` to update the screen." msgstr "" +"代わりに、複数のウィンドウで :meth:`!noutrefresh` を呼んでデータ構造を更新" +"し、その後 :func:`!doupdate` を呼んで画面を更新できます。" #: ../../howto/curses.rst:261 msgid "Displaying Text" msgstr "テキストの表示" -#: ../../howto/curses.rst:263 msgid "" "From a C programmer's point of view, curses may sometimes look like a twisty " "maze of functions, all subtly different. For example, :c:func:`!addstr` " @@ -459,6 +553,14 @@ msgid "" "default. :c:func:`!mvwaddstr` allows specifying both a window and a " "coordinate." msgstr "" +"C プログラマから見ると、curses は少しずつ異なる関数が入り組んだ迷路のように見" +"えることがあります。\n" +"例えば、:c:func:`!addstr` は ``stdscr`` ウィンドウの現在のカーソル位置に文字" +"列を表示し、:c:func:`!mvaddstr` は先に指定された y,x 座標へ移動してから表示し" +"ます。\n" +":c:func:`!waddstr` は :c:func:`!addstr` と同様ですが、デフォルトの " +"``stdscr`` の代わりに、使うウィンドウを指定できます。\n" +":c:func:`!mvwaddstr` ではウィンドウと座標の両方を指定できます。" #: ../../howto/curses.rst:272 msgid "" @@ -537,11 +639,12 @@ msgid "" "system encoding as returned by :func:`locale.getencoding`." msgstr "" -#: ../../howto/curses.rst:305 msgid "" "The :meth:`~curses.window.addch` methods take a character, which can be " "either a string of length 1, a bytestring of length 1, or an integer." msgstr "" +":meth:`~curses.window.addch` メソッドは文字を受け取ります。\n" +"文字は、長さ 1 の文字列、長さ 1 のバイト列、または整数で指定できます。" #: ../../howto/curses.rst:308 msgid "" @@ -551,7 +654,6 @@ msgid "" "for drawing borders). You can also use the appropriate Unicode character." msgstr "" -#: ../../howto/curses.rst:314 msgid "" "Windows remember where the cursor was left after the last operation, so if " "you leave out the *y,x* coordinates, the string or character will be " @@ -561,12 +663,12 @@ msgid "" "some location where it won't be distracting; it can be confusing to have the " "cursor blinking at some apparently random location." msgstr "" -"ウィンドウは最後の操作の後のカーソル位置を覚えているため、 *y,x* 座標をうっか" -"り忘れてしまっても、文字列や文字は最後の操作位置に表示されます。 ``move(y," -"x)`` メソッドでカーソルを移動させることもできます。常に点滅するカーソルを表示" -"する端末もあるため、カーソルが特定の位置にいることを保証して注意が反れないよ" -"うにしたいと思うかもしれません; ランダムに見える位置でカーソルが点滅すると面" -"を食らってしまいます。" +"ウィンドウは最後の操作後のカーソル位置を覚えているので、*y,x* 座標を省略する" +"と、文字列や文字は直前の操作でカーソルが残った位置に表示されます。\n" +"``move(y,x)`` メソッドでカーソルを移動することもできます。\n" +"常に点滅するカーソルを表示する端末もあるので、邪魔にならない位置にカーソルを" +"置くとよいでしょう。\n" +"無関係に見える場所でカーソルが点滅すると、混乱を招くことがあります。" #: ../../howto/curses.rst:322 msgid "" @@ -582,13 +684,16 @@ msgstr "" msgid "Attributes and Color" msgstr "属性とカラー" -#: ../../howto/curses.rst:333 msgid "" "Characters can be displayed in different ways. Status lines in a text-based " "application are commonly shown in reverse video, or a text viewer may need " "to highlight certain words. curses supports this by allowing you to specify " "an attribute for each cell on the screen." msgstr "" +"文字にはさまざまな表示方法があります。\n" +"テキストベースのアプリケーションではステータス行を反転表示することが多く、テ" +"キストビューアでは特定の単語を強調表示したい場合があります。\n" +"curses では画面上の各セルに属性を指定して、これらを実現できます。" #: ../../howto/curses.rst:338 msgid "" @@ -665,12 +770,14 @@ msgstr "" "つまり、反転するステータスラインを画面の最上部に表示するには、コードをこうし" "ます::" -#: ../../howto/curses.rst:364 msgid "" "stdscr.addstr(0, 0, \"Current mode: Typing mode\",\n" " curses.A_REVERSE)\n" "stdscr.refresh()" msgstr "" +"stdscr.addstr(0, 0, \"Current mode: Typing mode\",\n" +" curses.A_REVERSE)\n" +"stdscr.refresh()" #: ../../howto/curses.rst:368 msgid "" @@ -682,7 +789,6 @@ msgstr "" "す。そんな端末の中で最も一般的なものは Linux コンソールで、color xterm もそれ" "に続きます。" -#: ../../howto/curses.rst:372 msgid "" "To use color, you must call the :func:`~curses.start_color` function soon " "after calling :func:`~curses.initscr`, to initialize the default color set " @@ -693,8 +799,16 @@ msgid "" "to the British spelling, you'll have to resign yourself to misspelling it " "for the sake of these functions.)" msgstr "" +"色を使うには、:func:`~curses.initscr` の直後に :func:`~curses.start_color` を" +"呼び出し、デフォルトの色を初期化する必要があります (:func:`curses.wrapper` は" +"これを自動的に行います)。\n" +"初期化後、使用中の端末が実際にカラー表示に対応していれば、:func:`~curses." +"has_colors` は真を返します。\n" +"なお、curses はカナダやイギリスの綴り colour ではなく、アメリカの綴り color " +"を使います。\n" +"イギリス式の綴りに慣れている方も、これらの関数では「綴り間違い」を我慢してく" +"ださい。" -#: ../../howto/curses.rst:382 msgid "" "The curses library maintains a finite number of color pairs, containing a " "foreground (or text) color and a background color. You can get the " @@ -703,16 +817,23 @@ msgid "" "as :const:`A_REVERSE`, but again, such combinations are not guaranteed to " "work on all terminals." msgstr "" +"curses ライブラリは、前景色 (文字の色) と背景色からなる有限個のカラーペアを管" +"理します。\n" +":func:`~curses.color_pair` 関数で、カラーペアに対応する属性値を取得できま" +"す。\n" +"この値は :const:`A_REVERSE` などのほかの属性とビット単位の OR で組み合わせら" +"れますが、その組み合わせがすべての端末で動くとは限りません。" #: ../../howto/curses.rst:389 msgid "An example, which displays a line of text using color pair 1::" msgstr "例として、テキスト行をカラーペア 1 を使って表示します::" -#: ../../howto/curses.rst:391 msgid "" "stdscr.addstr(\"Pretty text\", curses.color_pair(1))\n" "stdscr.refresh()" msgstr "" +"stdscr.addstr(\"Pretty text\", curses.color_pair(1))\n" +"stdscr.refresh()" #: ../../howto/curses.rst:394 msgid "" @@ -722,7 +843,6 @@ msgid "" "hard-wired to white on black, and cannot be changed." msgstr "" -#: ../../howto/curses.rst:399 msgid "" "Colors are numbered, and :func:`start_color` initializes 8 basic colors when " "it activates color mode. They are: 0:black, 1:red, 2:green, 3:yellow, 4:" @@ -730,6 +850,12 @@ msgid "" "named constants for each of these colors: :const:`curses.COLOR_BLACK`, :" "const:`curses.COLOR_RED`, and so forth." msgstr "" +"色には番号が付いており、:func:`start_color` はカラーモードを有効にするときに " +"8 つの基本色を初期化します。\n" +"0 は黒、1 は赤、2 は緑、3 は黄、4 は青、5 はマゼンタ、6 はシアン、7 は白で" +"す。\n" +":mod:`curses` モジュールは各色に :const:`curses.COLOR_BLACK`、:const:`curses." +"COLOR_RED` などの定数を定義しています。" #: ../../howto/curses.rst:405 msgid "" @@ -739,22 +865,20 @@ msgstr "" "やってみましょう。カラー 1 を白背景に赤に変更してみましょう、こうして呼び出し" "ます::" -#: ../../howto/curses.rst:408 msgid "curses.init_pair(1, curses.COLOR_RED, curses.COLOR_WHITE)" -msgstr "" +msgstr "curses.init_pair(1, curses.COLOR_RED, curses.COLOR_WHITE)" -#: ../../howto/curses.rst:410 msgid "" "When you change a color pair, any text already displayed using that color " "pair will change to the new colors. You can also display new text in this " "color with::" msgstr "" -"カラーペアを変更するときには、既に表示された任意のテキストが利用するカラーペ" -"アを新しい色に変更します。新しいテキストをこの色で使うこともできます::" +"カラーペアを変更すると、そのペアを使って既に表示されているテキストも新しい色" +"になります。\n" +"次のように、その色で新たなテキストを表示することもできます。 ::" -#: ../../howto/curses.rst:414 msgid "stdscr.addstr(0,0, \"RED ALERT!\", curses.color_pair(1))" -msgstr "" +msgstr "stdscr.addstr(0,0, \"RED ALERT!\", curses.color_pair(1))" #: ../../howto/curses.rst:416 msgid "" @@ -772,12 +896,16 @@ msgstr "" msgid "User Input" msgstr "ユーザ入力" -#: ../../howto/curses.rst:429 msgid "" "The C curses library offers only very simple input mechanisms. Python's :mod:" "`curses` module adds a basic text-input widget. (Other libraries such as :" "pypi:`Urwid` have more extensive collections of widgets.)" msgstr "" +"C の curses ライブラリが提供する入力機能は、ごく単純なものだけです。\n" +"Python の :mod:`curses` モジュールは、基本的なテキスト入力ウィジェットを追加" +"しています。\n" +"(:pypi:`Urwid` などのほかのライブラリには、より豊富なウィジェットがありま" +"す。)" #: ../../howto/curses.rst:433 msgid "There are two methods for getting input from a window:" @@ -833,7 +961,6 @@ msgid "" " x = y = 0" msgstr "" -#: ../../howto/curses.rst:471 msgid "" "The :mod:`curses.ascii` module supplies ASCII class membership functions " "that take either integer or 1-character string arguments; these may be " @@ -842,6 +969,11 @@ msgid "" "arguments and return the same type. For example, :func:`curses.ascii.ctrl` " "returns the control character corresponding to its argument." msgstr "" +":mod:`curses.ascii` モジュールには、整数または 1 文字の文字列を受け取り、" +"ASCII の文字分類を判定する関数があります。\n" +"こうしたループの条件判定を読みやすく書くのに役立つでしょう。\n" +"また、整数または 1 文字の文字列を受け取り、同じ型を返す変換関数もあります。\n" +"例えば、:func:`curses.ascii.ctrl` は引数に対応する制御文字を返します。" #: ../../howto/curses.rst:478 msgid "" @@ -860,15 +992,18 @@ msgid "" "s = stdscr.getstr(0,0, 15)" msgstr "" -#: ../../howto/curses.rst:489 msgid "" "The :mod:`curses.textpad` module supplies a text box that supports an Emacs-" "like set of keybindings. Various methods of the :class:`~curses.textpad." "Textbox` class support editing with input validation and gathering the edit " "results either with or without trailing spaces. Here's an example::" msgstr "" +":mod:`curses.textpad` モジュールは、Emacs に似たキーバインドを使えるテキスト" +"ボックスを提供します。\n" +":class:`~curses.textpad.Textbox` の各種メソッドでは、入力を検証しながら編集し" +"たり、末尾の空白を残すか取り除くかを選んで編集結果を取得したりできます。\n" +"次に例を示します。 ::" -#: ../../howto/curses.rst:495 msgid "" "import curses\n" "from curses.textpad import Textbox, rectangle\n" @@ -888,6 +1023,23 @@ msgid "" " # Get resulting contents\n" " message = box.gather()" msgstr "" +"import curses\n" +"from curses.textpad import Textbox, rectangle\n" +"\n" +"def main(stdscr):\n" +" stdscr.addstr(0, 0, \"Enter IM message: (hit Ctrl-G to send)\")\n" +"\n" +" editwin = curses.newwin(5,30, 2,1)\n" +" rectangle(stdscr, 1,0, 1+5+1, 1+30+1)\n" +" stdscr.refresh()\n" +"\n" +" box = Textbox(editwin)\n" +"\n" +" # Ctrl-G が押されるまで、利用者に編集させる。\n" +" box.edit()\n" +"\n" +" # 編集結果を取得する\n" +" message = box.gather()" #: ../../howto/curses.rst:513 msgid "" @@ -912,7 +1064,6 @@ msgstr "" "Python の :mod:`curses` モジュールのライブラリページはいまやかなり充実してい" "ます。次はこれを見るべきです。" -#: ../../howto/curses.rst:524 msgid "" "If you're in doubt about the detailed behavior of the curses functions, " "consult the manual pages for your curses implementation, whether it's " @@ -920,8 +1071,12 @@ msgid "" "quirks, and provide complete lists of all the functions, attributes, and :" "ref:`ACS_\\* ` characters available to you." msgstr "" +"curses 関数の詳しい動作に疑問があれば、使用している実装が ncurses であって" +"も、プロプライエタリな Unix ベンダーのものであっても、その実装のマニュアル" +"ページを参照してください。\n" +"特有の動作に加え、利用可能なすべての関数、属性、:ref:`ACS_\\* ` 文字の一覧が記載されています。" -#: ../../howto/curses.rst:531 msgid "" "Because the curses API is so large, some functions aren't supported in the " "Python interface. Often this isn't because they're difficult to implement, " @@ -930,21 +1085,30 @@ msgid "" "would be welcome; see `the Python Developer's Guide `_ to learn more about submitting patches to Python." msgstr "" +"curses の API は非常に大きいため、Python のインターフェースではサポートしてい" +"ない関数もあります。\n" +"多くの場合、実装が難しいからではなく、まだ誰も必要としていないためです。\n" +"また、Python はまだ ncurses に付属するメニューライブラリにも対応していませ" +"ん。\n" +"これらへの対応を追加するパッチを歓迎します。\n" +"Python へのパッチの提出方法については、`Python Developer's Guide `_ を参照してください。" -#: ../../howto/curses.rst:539 msgid "" "`Writing Programs with NCURSES `_: a lengthy tutorial for C programmers." msgstr "" +"`Writing Programs with NCURSES `_: C プログラマ向けの詳しいチュートリアル。" #: ../../howto/curses.rst:541 msgid "`The ncurses man page `_" msgstr "`The ncurses man page `_" -#: ../../howto/curses.rst:542 msgid "" "`The ncurses FAQ `_" msgstr "" +"`ncurses の FAQ `_" #: ../../howto/curses.rst:543 msgid "" @@ -956,9 +1120,11 @@ msgstr "" "v=eN1eZtjLEnU>`_: curses または Urwid を使って端末を制御する PyCon 2013 講演" "ビデオです。" -#: ../../howto/curses.rst:545 msgid "" "`\"Console Applications with Urwid\" `_: video of a PyCon CA 2012 talk demonstrating some " "applications written using Urwid." msgstr "" +"`\"Console Applications with Urwid\" `_: Urwid で書かれたいくつかのアプリケーションを紹介" +"する PyCon CA 2012 の講演動画。" diff --git a/howto/descriptor.po b/howto/descriptor.po index 314c17a91..946d7516d 100644 --- a/howto/descriptor.po +++ b/howto/descriptor.po @@ -21,10 +21,10 @@ msgstr "" "Last-Translator: Arihiro TAKASE, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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/descriptor.rst:5 @@ -51,13 +51,12 @@ msgstr "" msgid "Contents" msgstr "内容" -#: ../../howto/descriptor.rst:13 msgid "" ":term:`Descriptors ` let objects customize attribute lookup, " "storage, and deletion." msgstr "" -":term:`デスクリプタ ` を使うと、オブジェクトの属性検索、保存、削" -"除をカスタマイズできます。" +":term:`デスクリプタ ` を使うと、オブジェクトの属性の検索、保存、" +"削除をカスタマイズできます。" #: ../../howto/descriptor.rst:16 msgid "This guide has four major sections:" @@ -119,18 +118,21 @@ msgstr "" msgid "Simple example: A descriptor that returns a constant" msgstr "シンプルな例: 定数を返すデスクリプタ" -#: ../../howto/descriptor.rst:45 msgid "" "The :class:`!Ten` class is a descriptor whose :meth:`~object.__get__` method " "always returns the constant ``10``:" msgstr "" +":class:`!Ten` クラスは、:meth:`~object.__get__` メソッドが常に定数 ``10`` を" +"返すデスクリプタです。" -#: ../../howto/descriptor.rst:48 msgid "" "class Ten:\n" " def __get__(self, obj, objtype=None):\n" " return 10" msgstr "" +"class Ten:\n" +" def __get__(self, obj, objtype=None):\n" +" return 10" #: ../../howto/descriptor.rst:54 msgid "" @@ -138,12 +140,14 @@ msgid "" "class:" msgstr "このデスクリプタを使うには他のクラスのクラス変数として保存します:" -#: ../../howto/descriptor.rst:56 msgid "" "class A:\n" " x = 5 # Regular class attribute\n" " y = Ten() # Descriptor instance" msgstr "" +"class A:\n" +" x = 5 # 通常のクラス属性\n" +" y = Ten() # デスクリプタのインスタンス" #: ../../howto/descriptor.rst:62 msgid "" @@ -153,7 +157,6 @@ msgstr "" "インタラクティブセッションを使って、通常の属性ルックアップと、デスクリプタの" "ルックアップの違いを見てみましょう。" -#: ../../howto/descriptor.rst:65 msgid "" ">>> a = A() # Make an instance of class A\n" ">>> a.x # Normal attribute lookup\n" @@ -161,6 +164,11 @@ msgid "" ">>> a.y # Descriptor lookup\n" "10" msgstr "" +">>> a = A() # クラス A のインスタンスを作る\n" +">>> a.x # 通常の属性検索\n" +"5\n" +">>> a.y # デスクリプタによる属性検索\n" +"10" #: ../../howto/descriptor.rst:73 msgid "" @@ -207,7 +215,6 @@ msgid "" msgstr "" "単に定数を返すよりも、なにか処理を実行するデスクリプタの方が面白いでしょう。" -#: ../../howto/descriptor.rst:93 msgid "" "import os\n" "\n" @@ -223,16 +230,27 @@ msgid "" " def __init__(self, dirname):\n" " self.dirname = dirname # Regular instance attribute" msgstr "" +"import os\n" +"\n" +"class DirectorySize:\n" +"\n" +" def __get__(self, obj, objtype=None):\n" +" return len(os.listdir(obj.dirname))\n" +"\n" +"class Directory:\n" +"\n" +" size = DirectorySize() # デスクリプタのインスタンス\n" +"\n" +" def __init__(self, dirname):\n" +" self.dirname = dirname # 通常のインスタンス属性" -#: ../../howto/descriptor.rst:109 msgid "" "An interactive session shows that the lookup is dynamic — it computes " "different, updated answers each time::" msgstr "" -"インタラクティブセッションで見たように、この探索は動的です。実行ごとに異なる" -"計算を行い、毎回答えが更新されます。" +"対話セッションを見ると、属性の検索が動的に行われ、毎回、その時点の状態に応じ" +"た結果が計算されることが分かります。 ::" -#: ../../howto/descriptor.rst:112 msgid "" ">>> s = Directory('songs')\n" ">>> g = Directory('games')\n" @@ -247,8 +265,18 @@ msgid "" "updated\n" "2" msgstr "" +">>> s = Directory('songs')\n" +">>> g = Directory('games')\n" +">>> s.size # songs ディレクトリには 20 個のファ" +"イルがある\n" +"20\n" +">>> g.size # games ディレクトリには 3 個のファイ" +"ルがある\n" +"3\n" +">>> os.remove('games/chess') # ゲームを 1 つ削除する\n" +">>> g.size # ファイル数は自動的に更新される\n" +"2" -#: ../../howto/descriptor.rst:122 msgid "" "Besides showing how descriptors can run computations, this example also " "reveals the purpose of the parameters to :meth:`~object.__get__`. The " @@ -257,12 +285,18 @@ msgid "" "parameter that lets the :meth:`~object.__get__` method learn the target " "directory. The *objtype* parameter is the class *Directory*." msgstr "" +"この例は、デスクリプタが計算を実行できることに加え、:meth:`~object.__get__` " +"の仮引数の役割も示しています。\n" +"*self* は *DirectorySize* のインスタンスである *size* です。\n" +"*obj* は *Directory* のインスタンスである *g* または *s* です。\n" +":meth:`~object.__get__` は、この *obj* 引数から対象のディレクトリを知ることが" +"できます。\n" +"*objtype* はクラス *Directory* です。" #: ../../howto/descriptor.rst:131 msgid "Managed attributes" msgstr "管理された属性" -#: ../../howto/descriptor.rst:133 msgid "" "A popular use for descriptors is managing access to instance data. The " "descriptor is assigned to a public attribute in the class dictionary while " @@ -270,6 +304,11 @@ msgid "" "dictionary. The descriptor's :meth:`~object.__get__` and :meth:`~object." "__set__` methods are triggered when the public attribute is accessed." msgstr "" +"デスクリプタのよくある用途は、インスタンスデータへのアクセスの管理です。\n" +"デスクリプタはクラス辞書内の公開属性に代入し、実際のデータはインスタンス辞書" +"内のプライベート属性に保存します。\n" +"公開属性にアクセスすると、デスクリプタの :meth:`~object.__get__` や :meth:" +"`~object.__set__` が呼び出されます。" #: ../../howto/descriptor.rst:139 msgid "" @@ -281,7 +320,6 @@ msgstr "" "す。パブリックな属性がアクセスされると、デスクリプタはルックアップや更新のロ" "グ出力をします。" -#: ../../howto/descriptor.rst:143 msgid "" "import logging\n" "\n" @@ -309,6 +347,31 @@ msgid "" " def birthday(self):\n" " self.age += 1 # Calls both __get__() and __set__()" msgstr "" +"import logging\n" +"\n" +"logging.basicConfig(level=logging.INFO)\n" +"\n" +"class LoggedAgeAccess:\n" +"\n" +" def __get__(self, obj, objtype=None):\n" +" value = obj._age\n" +" logging.info('Accessing %r giving %r', 'age', value)\n" +" return value\n" +"\n" +" def __set__(self, obj, value):\n" +" logging.info('Updating %r to %r', 'age', value)\n" +" obj._age = value\n" +"\n" +"class Person:\n" +"\n" +" age = LoggedAgeAccess() # デスクリプタのインスタンス\n" +"\n" +" def __init__(self, name, age):\n" +" self.name = name # 通常のインスタンス属性\n" +" self.age = age # __set__() を呼ぶ\n" +"\n" +" def birthday(self):\n" +" self.age += 1 # __get__() と __set__() の両方を呼ぶ" #: ../../howto/descriptor.rst:172 msgid "" @@ -318,7 +381,6 @@ msgstr "" "インタラクティブセッションの結果で見てわかるように、管理された属性の *age* の" "ログ出力が行われますが、通常の属性の *name* はログ出力されません。" -#: ../../howto/descriptor.rst:181 msgid "" ">>> mary = Person('Mary M', 30) # The initial age update is logged\n" "INFO:root:Updating 'age' to 30\n" @@ -347,6 +409,30 @@ msgid "" "INFO:root:Accessing 'age' giving 40\n" "40" msgstr "" +">>> mary = Person('Mary M', 30) # 年齢の初期設定がログに記録される\n" +"INFO:root:Updating 'age' to 30\n" +">>> dave = Person('David D', 40)\n" +"INFO:root:Updating 'age' to 40\n" +"\n" +">>> vars(mary) # 実際のデータはプライベート属性にあ" +"る\n" +"{'name': 'Mary M', '_age': 30}\n" +">>> vars(dave)\n" +"{'name': 'David D', '_age': 40}\n" +"\n" +">>> mary.age # データを取得し、そのアクセスを記録" +"する\n" +"INFO:root:Accessing 'age' giving 30\n" +"30\n" +">>> mary.birthday() # 更新もログに記録される\n" +"INFO:root:Accessing 'age' giving 30\n" +"INFO:root:Updating 'age' to 31\n" +"\n" +">>> dave.name # 通常の属性の検索は記録されない\n" +"'David D'\n" +">>> dave.age # 管理された属性だけが記録される\n" +"INFO:root:Accessing 'age' giving 40\n" +"40" #: ../../howto/descriptor.rst:206 msgid "" @@ -372,7 +458,6 @@ msgstr "" "クラスがデスクリプタを使うときに、クラスはそれぞれのデスクリプタにどのような" "変数名を使うかを通知します。" -#: ../../howto/descriptor.rst:218 msgid "" "In this example, the :class:`!Person` class has two descriptor instances, " "*name* and *age*. When the :class:`!Person` class is defined, it makes a " @@ -380,8 +465,13 @@ msgid "" "names can be recorded, giving each descriptor its own *public_name* and " "*private_name*:" msgstr "" +"この例では、:class:`!Person` クラスが *name* と *age* という 2 つのデスクリプ" +"タインスタンスを持ちます。\n" +":class:`!Person` の定義時に *LoggedAccess* の :meth:`~object.__set_name__` が" +"呼び出され、フィールド名が記録されます。\n" +"これにより、各デスクリプタが固有の *public_name* と *private_name* を持つよう" +"になります。" -#: ../../howto/descriptor.rst:223 msgid "" "import logging\n" "\n" @@ -414,27 +504,63 @@ msgid "" " def birthday(self):\n" " self.age += 1" msgstr "" +"import logging\n" +"\n" +"logging.basicConfig(level=logging.INFO)\n" +"\n" +"class LoggedAccess:\n" +"\n" +" def __set_name__(self, owner, name):\n" +" self.public_name = name\n" +" self.private_name = '_' + name\n" +"\n" +" def __get__(self, obj, objtype=None):\n" +" value = getattr(obj, self.private_name)\n" +" logging.info('Accessing %r giving %r', self.public_name, value)\n" +" return value\n" +"\n" +" def __set__(self, obj, value):\n" +" logging.info('Updating %r to %r', self.public_name, value)\n" +" setattr(obj, self.private_name, value)\n" +"\n" +"class Person:\n" +"\n" +" name = LoggedAccess() # 1 つ目のデスクリプタのインスタン" +"ス\n" +" age = LoggedAccess() # 2 つ目のデスクリプタのインスタン" +"ス\n" +"\n" +" def __init__(self, name, age):\n" +" self.name = name # 1 つ目のデスクリプタを呼ぶ\n" +" self.age = age # 2 つ目のデスクリプタを呼ぶ\n" +"\n" +" def birthday(self):\n" +" self.age += 1" -#: ../../howto/descriptor.rst:256 msgid "" "An interactive session shows that the :class:`!Person` class has called :" "meth:`~object.__set_name__` so that the field names would be recorded. Here " "we call :func:`vars` to look up the descriptor without triggering it:" msgstr "" +"対話セッションを見ると、:class:`!Person` クラスが :meth:`~object." +"__set_name__` を呼び出し、フィールド名が記録されたことが分かります。\n" +"ここでは、デスクリプタを呼び出さずに取得するため、:func:`vars` を使います。" -#: ../../howto/descriptor.rst:260 msgid "" ">>> vars(vars(Person)['name'])\n" "{'public_name': 'name', 'private_name': '_name'}\n" ">>> vars(vars(Person)['age'])\n" "{'public_name': 'age', 'private_name': '_age'}" msgstr "" +">>> vars(vars(Person)['name'])\n" +"{'public_name': 'name', 'private_name': '_name'}\n" +">>> vars(vars(Person)['age'])\n" +"{'public_name': 'age', 'private_name': '_age'}" #: ../../howto/descriptor.rst:267 msgid "The new class now logs access to both *name* and *age*:" msgstr "新しいクラスは *name* と *age* の両方でログを出力します。" -#: ../../howto/descriptor.rst:275 msgid "" ">>> pete = Person('Peter P', 10)\n" "INFO:root:Updating 'name' to 'Peter P'\n" @@ -443,36 +569,50 @@ msgid "" "INFO:root:Updating 'name' to 'Catherine C'\n" "INFO:root:Updating 'age' to 20" msgstr "" +">>> pete = Person('Peter P', 10)\n" +"INFO:root:Updating 'name' to 'Peter P'\n" +"INFO:root:Updating 'age' to 10\n" +">>> kate = Person('Catherine C', 20)\n" +"INFO:root:Updating 'name' to 'Catherine C'\n" +"INFO:root:Updating 'age' to 20" #: ../../howto/descriptor.rst:284 msgid "The two *Person* instances contain only the private names:" msgstr "2つの *Person* のインスタンスは、プライベート名しか保持していません。" -#: ../../howto/descriptor.rst:286 msgid "" ">>> vars(pete)\n" "{'_name': 'Peter P', '_age': 10}\n" ">>> vars(kate)\n" "{'_name': 'Catherine C', '_age': 20}" msgstr "" +">>> vars(pete)\n" +"{'_name': 'Peter P', '_age': 10}\n" +">>> vars(kate)\n" +"{'_name': 'Catherine C', '_age': 20}" #: ../../howto/descriptor.rst:295 msgid "Closing thoughts" msgstr "まとめ" -#: ../../howto/descriptor.rst:297 msgid "" "A :term:`descriptor` is what we call any object that defines :meth:`~object." "__get__`, :meth:`~object.__set__`, or :meth:`~object.__delete__`." msgstr "" +":meth:`~object.__get__`、:meth:`~object.__set__`、:meth:`~object.__delete__` " +"のいずれかを定義するオブジェクトを :term:`descriptor` と呼びます。" -#: ../../howto/descriptor.rst:300 msgid "" "Optionally, descriptors can have a :meth:`~object.__set_name__` method. " "This is only used in cases where a descriptor needs to know either the class " "where it was created or the name of class variable it was assigned to. " "(This method, if present, is called even if the class is not a descriptor.)" msgstr "" +"デスクリプタには、必要に応じて :meth:`~object.__set_name__` メソッドを定義で" +"きます。\n" +"これは、デスクリプタが、自身が定義されたクラスや代入先のクラス変数名を知る必" +"要がある場合に使います。\n" +"(このメソッドがあれば、そのクラスがデスクリプタでなくても呼び出されます。)" #: ../../howto/descriptor.rst:305 msgid "" @@ -552,13 +692,13 @@ msgstr "" "す。もし制限に合わなければ、例外を送出し、データが不正な状態になるのを防ぎま" "す。" -#: ../../howto/descriptor.rst:340 msgid "" "This :class:`!Validator` class is both an :term:`abstract base class` and a " "managed attribute descriptor:" msgstr "" +"この :class:`!Validator` クラスは、:term:`abstract base class` であると同時" +"に、属性へのアクセスを管理するデスクリプタでもあります。" -#: ../../howto/descriptor.rst:343 msgid "" "from abc import ABC, abstractmethod\n" "\n" @@ -578,12 +718,30 @@ msgid "" " def validate(self, value):\n" " pass" msgstr "" +"from abc import ABC, abstractmethod\n" +"\n" +"class Validator(ABC):\n" +"\n" +" def __set_name__(self, owner, name):\n" +" self.private_name = '_' + name\n" +"\n" +" def __get__(self, obj, objtype=None):\n" +" return getattr(obj, self.private_name)\n" +"\n" +" def __set__(self, obj, value):\n" +" self.validate(value)\n" +" setattr(obj, self.private_name, value)\n" +"\n" +" @abstractmethod\n" +" def validate(self, value):\n" +" pass" -#: ../../howto/descriptor.rst:363 msgid "" "Custom validators need to inherit from :class:`!Validator` and must supply " "a :meth:`!validate` method to test various restrictions as needed." msgstr "" +"独自のバリデータは :class:`!Validator` を継承し、必要な制約を検査する :meth:" +"`!validate` メソッドを実装しなければなりません。" #: ../../howto/descriptor.rst:368 msgid "Custom validators" @@ -594,25 +752,30 @@ msgid "Here are three practical data validation utilities:" msgstr "" "ここでは3つの実践的なバリデーションのユーティリティのサンプルを紹介します。" -#: ../../howto/descriptor.rst:372 msgid "" ":class:`!OneOf` verifies that a value is one of a restricted set of options." msgstr "" +":class:`!OneOf` は、値が指定された選択肢のいずれかであることを検証します。" -#: ../../howto/descriptor.rst:374 msgid "" ":class:`!Number` verifies that a value is either an :class:`int` or :class:" "`float`. Optionally, it verifies that a value is between a given minimum or " "maximum." msgstr "" +":class:`!Number` は、値が :class:`int` または :class:`float` であることを検証" +"します。\n" +"必要に応じて、指定された最小値以上、最大値以下であることも検証します。" -#: ../../howto/descriptor.rst:378 msgid "" ":class:`!String` verifies that a value is a :class:`str`. Optionally, it " "validates a given minimum or maximum length. It can validate a user-defined " "`predicate `_ " "as well." msgstr "" +":class:`!String` は、値が :class:`str` であることを検証します。\n" +"必要に応じて、指定された最小長や最大長の条件も検証します。\n" +"利用者が定義した `述語 `_ による検証もできます。" #: ../../howto/descriptor.rst:383 msgid "" @@ -678,7 +841,6 @@ msgstr "実践的なアプリケーション" msgid "Here's how the data validators can be used in a real class:" msgstr "次のコードは実際のクラスでデータバリデータを使う方法のサンプルです。" -#: ../../howto/descriptor.rst:443 msgid "" "class Component:\n" "\n" @@ -691,12 +853,21 @@ msgid "" " self.kind = kind\n" " self.quantity = quantity" msgstr "" +"class Component:\n" +"\n" +" name = String(minsize=3, maxsize=10, predicate=str.isupper)\n" +" kind = OneOf('wood', 'metal', 'plastic')\n" +" quantity = Number(minvalue=0)\n" +"\n" +" def __init__(self, name, kind, quantity):\n" +" self.name = name\n" +" self.kind = kind\n" +" self.quantity = quantity" #: ../../howto/descriptor.rst:456 msgid "The descriptors prevent invalid instances from being created:" msgstr "これらのデスクリプタは、不正インスタンスが作成されるのを防ぎます。" -#: ../../howto/descriptor.rst:458 msgid "" ">>> Component('Widget', 'metal', 5) # Blocked: 'Widget' is not all " "uppercase\n" @@ -722,6 +893,29 @@ msgid "" "\n" ">>> c = Component('WIDGET', 'metal', 5) # Allowed: The inputs are valid" msgstr "" +">>> Component('Widget', 'metal', 5) # 拒否: 'Widget' はすべて大文字では" +"ない\n" +"Traceback (most recent call last):\n" +" ...\n" +"ValueError: Expected to be true for " +"'Widget'\n" +"\n" +">>> Component('WIDGET', 'metle', 5) # 拒否: 'metle' は綴りが違う\n" +"Traceback (most recent call last):\n" +" ...\n" +"ValueError: Expected 'metle' to be one of {'metal', 'plastic', 'wood'}\n" +"\n" +">>> Component('WIDGET', 'metal', -5) # 拒否: -5 は負数\n" +"Traceback (most recent call last):\n" +" ...\n" +"ValueError: Expected -5 to be at least 0\n" +"\n" +">>> Component('WIDGET', 'metal', 'V') # 拒否: 'V' は数値ではない\n" +"Traceback (most recent call last):\n" +" ...\n" +"TypeError: Expected 'V' to be an int or float\n" +"\n" +">>> c = Component('WIDGET', 'metal', 5) # 許可: 入力は有効" #: ../../howto/descriptor.rst:484 msgid "Technical Tutorial" @@ -759,13 +953,17 @@ msgstr "" msgid "Definition and introduction" msgstr "定義と導入" -#: ../../howto/descriptor.rst:503 msgid "" "In general, a descriptor is an attribute value that has one of the methods " "in the descriptor protocol. Those methods are :meth:`~object.__get__`, :" "meth:`~object.__set__`, and :meth:`~object.__delete__`. If any of those " "methods are defined for an attribute, it is said to be a :term:`descriptor`." msgstr "" +"一般に、デスクリプタとは、デスクリプタプロトコルのメソッドのいずれかを持つ属" +"性値です。\n" +"そのメソッドは :meth:`~object.__get__`、:meth:`~object.__set__`、:meth:" +"`~object.__delete__` です。\n" +"これらのいずれかが定義された属性を :term:`descriptor` と呼びます。" #: ../../howto/descriptor.rst:508 msgid "" @@ -786,7 +984,6 @@ msgstr "" "デスクリプタメソッドを呼び出します。これがどの連鎖順位で行われるかは、どのデ" "スクリプタメソッドが定義されているかに依ります。" -#: ../../howto/descriptor.rst:517 msgid "" "Descriptors are a powerful, general purpose protocol. They are the " "mechanism behind properties, methods, static methods, class methods, and :" @@ -794,6 +991,11 @@ msgid "" "the underlying C code and offer a flexible set of new tools for everyday " "Python programs." msgstr "" +"デスクリプタは強力で汎用的なプロトコルです。\n" +"プロパティ、メソッド、静的メソッド、クラスメソッド、:func:`super` を支える仕" +"組みであり、Python 自身の至る所で使われています。\n" +"デスクリプタは内部の C コードを簡潔にし、日常的な Python プログラムにも柔軟な" +"道具を提供します。" #: ../../howto/descriptor.rst:525 msgid "Descriptor protocol" @@ -821,13 +1023,16 @@ msgstr "" "リプタとみなされ、探索された際のデフォルトの振る舞いをオーバーライドできま" "す。" -#: ../../howto/descriptor.rst:537 msgid "" "If an object defines :meth:`~object.__set__` or :meth:`~object.__delete__`, " "it is considered a data descriptor. Descriptors that only define :meth:" "`~object.__get__` are called non-data descriptors (they are often used for " "methods but other uses are possible)." msgstr "" +":meth:`~object.__set__` または :meth:`~object.__delete__` を定義するオブジェ" +"クトは、データデスクリプタとみなされます。\n" +":meth:`~object.__get__` だけを定義するものは非データデスクリプタと呼ばれ、メ" +"ソッドによく使われますが、ほかの用途にも使えます。" #: ../../howto/descriptor.rst:542 msgid "" @@ -843,13 +1048,17 @@ msgstr "" "ます。インスタンスの辞書に、非データデスクリプタと同名の項目があれば、辞書の" "項目の方が優先されます。" -#: ../../howto/descriptor.rst:548 msgid "" "To make a read-only data descriptor, define both :meth:`~object.__get__` " "and :meth:`~object.__set__` with the :meth:`~object.__set__` raising an :exc:" "`AttributeError` when called. Defining the :meth:`~object.__set__` method " "with an exception raising placeholder is enough to make it a data descriptor." msgstr "" +"読み取り専用のデータデスクリプタを作るには、:meth:`~object.__get__` と :meth:" +"`~object.__set__` の両方を定義し、:meth:`~object.__set__` が呼ばれたら :exc:" +"`AttributeError` を送出するようにします。\n" +"例外を送出するだけの :meth:`~object.__set__` を定義すれば、データデスクリプタ" +"になります。" #: ../../howto/descriptor.rst:555 msgid "Overview of descriptor invocation" @@ -871,13 +1080,15 @@ msgstr "" "しかし、属性アクセスの際に自動的に呼び出されるのが、一般的なデスクリプタの呼" "び出し方法です。" -#: ../../howto/descriptor.rst:563 msgid "" "The expression ``obj.x`` looks up the attribute ``x`` in the chain of " "namespaces for ``obj``. If the search finds a descriptor outside of the " "instance :attr:`~object.__dict__`, its :meth:`~object.__get__` method is " "invoked according to the precedence rules listed below." msgstr "" +"式 ``obj.x`` は、``obj`` の名前空間の連鎖から属性 ``x`` を探します。\n" +"インスタンスの :attr:`~object.__dict__` 以外でデスクリプタが見つかると、以下" +"の優先順位に従って :meth:`~object.__get__` が呼び出されます。" #: ../../howto/descriptor.rst:568 msgid "" @@ -891,13 +1102,16 @@ msgstr "" msgid "Invocation from an instance" msgstr "インスタンスからの呼び出し" -#: ../../howto/descriptor.rst:575 msgid "" "Instance lookup scans through a chain of namespaces giving data descriptors " "the highest priority, followed by instance variables, then non-data " "descriptors, then class variables, and lastly :meth:`~object.__getattr__` if " "it is provided." msgstr "" +"インスタンスの属性検索は名前空間の連鎖をたどり、データデスクリプタを最優先に" +"します。\n" +"次にインスタンス変数、非データデスクリプタ、クラス変数を調べ、最後に、定義さ" +"れていれば :meth:`~object.__getattr__` を呼び出します。" #: ../../howto/descriptor.rst:580 msgid "" @@ -944,23 +1158,29 @@ msgid "" " raise AttributeError(name)" msgstr "" -#: ../../howto/descriptor.rst:722 msgid "" "Note, there is no :meth:`~object.__getattr__` hook in the :meth:`~object." "__getattribute__` code. That is why calling :meth:`~object." "__getattribute__` directly or with ``super().__getattribute__`` will bypass :" "meth:`~object.__getattr__` entirely." msgstr "" +":meth:`~object.__getattribute__` のコード内には :meth:`~object.__getattr__` " +"フックがないことに注意してください。\n" +"そのため、:meth:`~object.__getattribute__` を直接呼んだり ``super()." +"__getattribute__`` で呼んだりすると、:meth:`~object.__getattr__` はまったく呼" +"ばれません。" -#: ../../howto/descriptor.rst:726 msgid "" "Instead, it is the dot operator and the :func:`getattr` function that are " "responsible for invoking :meth:`~object.__getattr__` whenever :meth:`~object." "__getattribute__` raises an :exc:`AttributeError`. Their logic is " "encapsulated in a helper function:" msgstr "" +"代わりに、:meth:`~object.__getattribute__` が :exc:`AttributeError` を送出し" +"たときに :meth:`~object.__getattr__` を呼び出すのは、ドット演算子と :func:" +"`getattr` 関数です。\n" +"その処理は、次の補助関数にまとめられます。" -#: ../../howto/descriptor.rst:731 msgid "" "def getattr_hook(obj, name):\n" " \"Emulate slot_tp_getattr_hook() in Objects/typeobject.c\"\n" @@ -971,54 +1191,63 @@ msgid "" " raise\n" " return type(obj).__getattr__(obj, name) # __getattr__" msgstr "" +"def getattr_hook(obj, name):\n" +" \"Objects/typeobject.c の slot_tp_getattr_hook() を模擬する\"\n" +" try:\n" +" return obj.__getattribute__(name)\n" +" except AttributeError:\n" +" if not hasattr(type(obj), '__getattr__'):\n" +" raise\n" +" return type(obj).__getattr__(obj, name) # __getattr__" #: ../../howto/descriptor.rst:776 msgid "Invocation from a class" msgstr "クラスからの呼び出し" -#: ../../howto/descriptor.rst:778 msgid "" "The logic for a dotted lookup such as ``A.x`` is in :meth:`!type." "__getattribute__`. The steps are similar to those for :meth:`!object." "__getattribute__` but the instance dictionary lookup is replaced by a search " "through the class's :term:`method resolution order`." msgstr "" +"``A.x`` のようなドット記法による検索の処理は、:meth:`!type.__getattribute__` " +"にあります。\n" +"手順は :meth:`!object.__getattribute__` と似ていますが、インスタンス辞書の検" +"索が、そのクラスの :term:`method resolution order` に従う検索に置き換わりま" +"す。" -#: ../../howto/descriptor.rst:783 msgid "If a descriptor is found, it is invoked with ``desc.__get__(None, A)``." msgstr "" -"``a.x`` に対するデスクリプタが見つかった場合、 ``desc.__get__(None, A)`` とい" -"う形式で呼び出されます。" +"デスクリプタが見つかると、``desc.__get__(None, A)`` として呼び出されます。" -#: ../../howto/descriptor.rst:785 msgid "" "The full C implementation can be found in :c:func:`!type_getattro` and :c:" "func:`!_PyType_Lookup` in :source:`Objects/typeobject.c`." msgstr "" -"完全な C での実装は :source:`Objects/typeobject.c` の中の:c:func:`!" -"type_getattro` と :c:func:`!_PyType_Lookup` を参照してください。" +"完全な C 実装は、:source:`Objects/typeobject.c` の :c:func:`!type_getattro` " +"と :c:func:`!_PyType_Lookup` にあります。" #: ../../howto/descriptor.rst:790 msgid "Invocation from super" msgstr "superからの呼び出し" -#: ../../howto/descriptor.rst:792 msgid "" "The logic for super's dotted lookup is in the :meth:`~object." "__getattribute__` method for object returned by :func:`super`." msgstr "" +"``super`` のドット記法による検索の処理は、:func:`super` が返すオブジェクト" +"の :meth:`~object.__getattribute__` メソッドにあります。" -#: ../../howto/descriptor.rst:795 msgid "" "A dotted lookup such as ``super(A, obj).m`` searches ``obj.__class__." "__mro__`` for the base class ``B`` immediately following ``A`` and then " "returns ``B.__dict__['m'].__get__(obj, A)``. If not a descriptor, ``m`` is " "returned unchanged." msgstr "" -"``super(A, obj).m`` のようなドットを使ったルックアップは ``obj.__class__." -"__mro__`` を探索して、 ``A`` の直前のクラス ``B`` をまず探し、 ``B." -"__dict__['m'].__get__(obj, A)`` を返します。もしデスクリプタでなければ ``m`` " -"を変更せずに返します。" +"``super(A, obj).m`` のようにドット記法で属性を検索すると、``obj.__class__." +"__mro__`` の中で ``A`` の直後にある基底クラス ``B`` を探し、\n" +"``B.__dict__['m'].__get__(obj, A)`` を返します。\n" +"``m`` がデスクリプタでなければ、そのまま返します。" #: ../../howto/descriptor.rst:800 msgid "" @@ -1036,20 +1265,21 @@ msgstr "" msgid "Summary of invocation logic" msgstr "呼び出しロジックのまとめ" -#: ../../howto/descriptor.rst:809 msgid "" "The mechanism for descriptors is embedded in the :meth:`~object." "__getattribute__` methods for :class:`object`, :class:`type`, and :func:" "`super`." msgstr "" +"デスクリプタの仕組みは、:class:`object`、:class:`type`、:func:`super` の :" +"meth:`~object.__getattribute__` メソッドに組み込まれています。" #: ../../howto/descriptor.rst:812 msgid "The important points to remember are:" msgstr "憶えておくべき重要な点は:" -#: ../../howto/descriptor.rst:814 msgid "Descriptors are invoked by the :meth:`~object.__getattribute__` method." msgstr "" +"デスクリプタは :meth:`~object.__getattribute__` メソッドから呼び出されます。" #: ../../howto/descriptor.rst:816 msgid "" @@ -1082,11 +1312,9 @@ msgid "Non-data descriptors may be overridden by instance dictionaries." msgstr "" "非データデスクリプタは、インスタンス辞書にオーバーライドされることがある" -#: ../../howto/descriptor.rst:833 msgid "Automatic name notification" -msgstr "自動的の名前の伝達" +msgstr "名前の自動通知" -#: ../../howto/descriptor.rst:835 msgid "" "Sometimes it is desirable for a descriptor to know what class variable name " "it was assigned to. When a new class is created, the :class:`type` " @@ -1095,6 +1323,13 @@ msgid "" "called with two arguments. The *owner* is the class where the descriptor is " "used, and the *name* is the class variable the descriptor was assigned to." msgstr "" +"デスクリプタが、代入先のクラス変数名を知りたい場合があります。\n" +"新しいクラスが作られると、メタクラス :class:`type` はそのクラスの辞書を調べま" +"す。\n" +"デスクリプタであるエントリーに :meth:`~object.__set_name__` が定義されていれ" +"ば、2 つの引数を渡して呼び出します。\n" +"*owner* はデスクリプタを使っているクラス、*name* はデスクリプタが代入されたク" +"ラス変数の名前です。" #: ../../howto/descriptor.rst:842 msgid "" @@ -1104,12 +1339,15 @@ msgstr "" "実装の詳細は :source:`Objects/typeobject.c` の中の :c:func:`!type_new` と :c:" "func:`!set_names` を参照してください。" -#: ../../howto/descriptor.rst:845 msgid "" "Since the update logic is in :meth:`!type.__new__`, notifications only take " "place at the time of class creation. If descriptors are added to the class " "afterwards, :meth:`~object.__set_name__` will need to be called manually." msgstr "" +"この更新処理は :meth:`!type.__new__` にあるため、通知はクラスの作成時にだけ行" +"われます。\n" +"後からクラスにデスクリプタを追加した場合は、:meth:`~object.__set_name__` を手" +"動で呼び出す必要があります。" #: ../../howto/descriptor.rst:851 msgid "ORM example" @@ -1135,7 +1373,6 @@ msgstr "" "タンスは、データベースのテーブルへのキーのみを保持します。デスクリプタがルッ" "クアップや更新をします。" -#: ../../howto/descriptor.rst:861 msgid "" "class Field:\n" "\n" @@ -1152,15 +1389,29 @@ msgid "" " conn.execute(self.store, [value, obj.key])\n" " conn.commit()" msgstr "" +"class Field:\n" +"\n" +" def __set_name__(self, owner, name):\n" +" self.fetch = f'SELECT {name} FROM {owner.table} WHERE {owner.key}" +"=?;'\n" +" self.store = f'UPDATE {owner.table} SET {name}=? WHERE {owner.key}" +"=?;'\n" +"\n" +" def __get__(self, obj, objtype=None):\n" +" return conn.execute(self.fetch, [obj.key]).fetchone()[0]\n" +"\n" +" def __set__(self, obj, value):\n" +" conn.execute(self.store, [value, obj.key])\n" +" conn.commit()" -#: ../../howto/descriptor.rst:876 msgid "" "We can use the :class:`!Field` class to define `models `_ that describe the schema for each table in a " "database:" msgstr "" +":class:`!Field` クラスを使うと、データベースの各テーブルのスキーマを表す `モ" +"デル `_ を定義できます。" -#: ../../howto/descriptor.rst:880 msgid "" "class Movie:\n" " table = 'Movies' # Table name\n" @@ -1181,16 +1432,35 @@ msgid "" " def __init__(self, key):\n" " self.key = key" msgstr "" +"class Movie:\n" +" table = 'Movies' # テーブル名\n" +" key = 'title' # 主キー\n" +" director = Field()\n" +" year = Field()\n" +"\n" +" def __init__(self, key):\n" +" self.key = key\n" +"\n" +"class Song:\n" +" table = 'Music'\n" +" key = 'title'\n" +" artist = Field()\n" +" year = Field()\n" +" genre = Field()\n" +"\n" +" def __init__(self, key):\n" +" self.key = key" #: ../../howto/descriptor.rst:901 msgid "To use the models, first connect to the database::" msgstr "モデルを使用するにはまずデータベースに接続します::" -#: ../../howto/descriptor.rst:903 msgid "" ">>> import sqlite3\n" ">>> conn = sqlite3.connect('entertainment.db')" msgstr "" +">>> import sqlite3\n" +">>> conn = sqlite3.connect('entertainment.db')" #: ../../howto/descriptor.rst:906 msgid "" @@ -1200,7 +1470,6 @@ msgstr "" "次のインタラクティブセッションでは、データベースからのデータの取得と、更新方" "法を示しています。" -#: ../../howto/descriptor.rst:934 msgid "" ">>> Movie('Star Wars').director\n" "'George Lucas'\n" @@ -1215,6 +1484,18 @@ msgid "" ">>> Movie('Star Wars').director\n" "'J.J. Abrams'" msgstr "" +">>> Movie('Star Wars').director\n" +"'George Lucas'\n" +">>> jaws = Movie('Jaws')\n" +">>> f'Released in {jaws.year} by {jaws.director}'\n" +"'Released in 1975 by Steven Spielberg'\n" +"\n" +">>> Song('Country Roads').artist\n" +"'John Denver'\n" +"\n" +">>> Movie('Star Wars').director = 'J.J. Abrams'\n" +">>> Movie('Star Wars').director\n" +"'J.J. Abrams'" #: ../../howto/descriptor.rst:955 msgid "Pure Python Equivalents" @@ -1245,9 +1526,8 @@ msgstr "" ":func:`property` を呼び出すことで、属性へアクセスすると関数の呼び出しを引き起" "こす、データデスクリプタを簡潔に組み立てられます。シグネチャはこうです::" -#: ../../howto/descriptor.rst:969 msgid "property(fget=None, fset=None, fdel=None, doc=None) -> property" -msgstr "" +msgstr "property(fget=None, fset=None, fdel=None, doc=None) -> property" #: ../../howto/descriptor.rst:971 msgid "" @@ -1256,7 +1536,6 @@ msgstr "" "このドキュメントでは、管理された属性 ``x`` を定義する典型的な使用法を示しま" "す:" -#: ../../howto/descriptor.rst:973 msgid "" "class C:\n" " def getx(self): return self.__x\n" @@ -1264,15 +1543,20 @@ msgid "" " def delx(self): del self.__x\n" " x = property(getx, setx, delx, \"I'm the 'x' property.\")" msgstr "" +"class C:\n" +" def getx(self): return self.__x\n" +" def setx(self, value): self.__x = value\n" +" def delx(self): del self.__x\n" +" x = property(getx, setx, delx, \"I'm the 'x' property.\")" -#: ../../howto/descriptor.rst:995 msgid "" "To see how :func:`property` is implemented in terms of the descriptor " "protocol, here is a pure Python equivalent that implements most of the core " "functionality:" msgstr "" +":func:`property` がデスクリプタプロトコルでどのように実装されているかを見るた" +"め、主要な機能の大部分を Python だけで実装した等価なコードを示します。" -#: ../../howto/descriptor.rst:998 msgid "" "class Property:\n" " \"Emulate PyProperty_Type() in Objects/descrobject.c\"\n" @@ -1314,15 +1598,54 @@ msgid "" " def deleter(self, fdel):\n" " return type(self)(self.fget, self.fset, fdel, self.__doc__)" msgstr "" +"class Property:\n" +" \"Objects/descrobject.c の PyProperty_Type() を模擬する\"\n" +"\n" +" def __init__(self, fget=None, fset=None, fdel=None, doc=None):\n" +" self.fget = fget\n" +" self.fset = fset\n" +" self.fdel = fdel\n" +" if doc is None and fget is not None:\n" +" doc = fget.__doc__\n" +" self.__doc__ = doc\n" +"\n" +" def __set_name__(self, owner, name):\n" +" self.__name__ = name\n" +"\n" +" def __get__(self, obj, objtype=None):\n" +" if obj is None:\n" +" return self\n" +" if self.fget is None:\n" +" raise AttributeError\n" +" return self.fget(obj)\n" +"\n" +" def __set__(self, obj, value):\n" +" if self.fset is None:\n" +" raise AttributeError\n" +" self.fset(obj, value)\n" +"\n" +" def __delete__(self, obj):\n" +" if self.fdel is None:\n" +" raise AttributeError\n" +" self.fdel(obj)\n" +"\n" +" def getter(self, fget):\n" +" return type(self)(fget, self.fset, self.fdel, self.__doc__)\n" +"\n" +" def setter(self, fset):\n" +" return type(self)(self.fget, fset, self.fdel, self.__doc__)\n" +"\n" +" def deleter(self, fdel):\n" +" return type(self)(self.fget, self.fset, fdel, self.__doc__)" -#: ../../howto/descriptor.rst:1122 msgid "" "The :func:`property` builtin helps whenever a user interface has granted " "attribute access and then subsequent changes require the intervention of a " "method." msgstr "" -"組み込みの :func:`property` 関数は、ユーザインターフェースへの属性アクセスが" -"与えられ、続く変更がメソッドの介入を要求するときに役立ちます。" +"組み込みの :func:`property` は、利用者向けのインターフェースで属性への直接ア" +"クセスを提供していたものの、後の変更でメソッドによる処理を挟む必要が生じた場" +"合に役立ちます。" #: ../../howto/descriptor.rst:1126 msgid "" @@ -1339,7 +1662,6 @@ msgstr "" "ントコードに影響を与えたくありません。この解決策は、property データデスクリプ" "タ内に値属性へのアクセスをラップすることです:" -#: ../../howto/descriptor.rst:1132 msgid "" "class Cell:\n" " ...\n" @@ -1350,12 +1672,21 @@ msgid "" " self.recalc()\n" " return self._value" msgstr "" +"class Cell:\n" +" ...\n" +"\n" +" @property\n" +" def value(self):\n" +" \"値を返す前にセルを再計算する\"\n" +" self.recalc()\n" +" return self._value" -#: ../../howto/descriptor.rst:1143 msgid "" "Either the built-in :func:`property` or our :func:`!Property` equivalent " "would work in this example." msgstr "" +"この例では、組み込みの :func:`property` でも、それに相当する自作の :func:`!" +"Property` でも動作します。" #: ../../howto/descriptor.rst:1148 msgid "Functions and methods" @@ -1369,17 +1700,17 @@ msgstr "" "Python のオブジェクト指向機能は、関数に基づく環境の上に構築されています。非" "データデスクリプタを使って、この 2 つはシームレスに組み合わされています。" -#: ../../howto/descriptor.rst:1153 msgid "" "Functions stored in class dictionaries get turned into methods when invoked. " "Methods only differ from regular functions in that the object instance is " "prepended to the other arguments. By convention, the instance is called " "*self* but could be called *this* or any other variable name." msgstr "" -"クラス辞書に格納された関数は、実行時にメソッドに変換されます。メソッドと通常" -"の関数はオブジェクトのインスタンスが他の引数よりも前に渡される点だけが異なり" -"ます。監修ではインスタンスは *self* という名前が使われますが、 *this* や他の" -"変数名も使えます。" +"クラス辞書に格納された関数は、呼び出されるときにメソッドに変換されます。\n" +"通常の関数との違いは、ほかの引数より前にオブジェクトのインスタンスが渡される" +"ことだけです。\n" +"慣習上、このインスタンスの引数名は *self* ですが、*this* などの別の名前でも構" +"いません。" #: ../../howto/descriptor.rst:1158 msgid "" @@ -1389,7 +1720,6 @@ msgstr "" "メソッドは、ほぼ次のコードと同等な :class:`types.MethodType` を使えば手動で作" "れます。" -#: ../../howto/descriptor.rst:1161 msgid "" "class MethodType:\n" " \"Emulate PyMethod_Type in Objects/classobject.c\"\n" @@ -1417,16 +1747,44 @@ msgid "" " \"Emulate method_descr_get() in Objects/classobject.c\"\n" " return self" msgstr "" +"class MethodType:\n" +" \"Objects/classobject.c の PyMethod_Type を模擬する\"\n" +"\n" +" def __init__(self, func, obj):\n" +" self.__func__ = func\n" +" self.__self__ = obj\n" +"\n" +" def __call__(self, *args, **kwargs):\n" +" func = self.__func__\n" +" obj = self.__self__\n" +" return func(obj, *args, **kwargs)\n" +"\n" +" def __getattribute__(self, name):\n" +" \"Objects/classobject.c の method_getset() を模擬する\"\n" +" if name == '__doc__':\n" +" return self.__func__.__doc__\n" +" return object.__getattribute__(self, name)\n" +"\n" +" def __getattr__(self, name):\n" +" \"Objects/classobject.c の method_getattro() を模擬する\"\n" +" return getattr(self.__func__, name)\n" +"\n" +" def __get__(self, obj, objtype=None):\n" +" \"Objects/classobject.c の method_descr_get() を模擬する\"\n" +" return self" -#: ../../howto/descriptor.rst:1189 msgid "" "To support automatic creation of methods, functions include the :meth:" "`~object.__get__` method for binding methods during attribute access. This " "means that functions are non-data descriptors that return bound methods " "during dotted lookup from an instance. Here's how it works:" msgstr "" +"関数には、属性アクセス時にメソッドを束縛する :meth:`~object.__get__` があり、" +"メソッドを自動的に作れるようになっています。\n" +"つまり、関数は非データデスクリプタであり、インスタンスからドット記法で検索す" +"ると束縛メソッドを返します。\n" +"その仕組みは次のとおりです。" -#: ../../howto/descriptor.rst:1194 msgid "" "class Function:\n" " ...\n" @@ -1437,16 +1795,22 @@ msgid "" " return self\n" " return MethodType(self, obj)" msgstr "" +"class Function:\n" +" ...\n" +"\n" +" def __get__(self, obj, objtype=None):\n" +" \"Objects/funcobject.c の func_descr_get() を模擬する\"\n" +" if obj is None:\n" +" return self\n" +" return MethodType(self, obj)" -#: ../../howto/descriptor.rst:1205 msgid "" "Running the following class in the interpreter shows how the function " "descriptor works in practice:" msgstr "" -"次のクラスをインタプリタを起動すると、この関数デスクリプタが実際にどう働くか" -"を見られます::" +"次のクラスをインタープリタで実行すると、関数デスクリプタが実際にどう動くかを" +"確認できます。" -#: ../../howto/descriptor.rst:1208 msgid "" "class D:\n" " def f(self):\n" @@ -1455,6 +1819,12 @@ msgid "" "class D2:\n" " pass" msgstr "" +"class D:\n" +" def f(self):\n" +" return self\n" +"\n" +"class D2:\n" +" pass" #: ../../howto/descriptor.rst:1226 msgid "" @@ -1463,49 +1833,60 @@ msgstr "" "この関数はイントロスペクションをサポートするために :term:`qualified name` も" "持っています。" -#: ../../howto/descriptor.rst:1228 msgid "" ">>> D.f.__qualname__\n" "'D.f'" msgstr "" +">>> D.f.__qualname__\n" +"'D.f'" -#: ../../howto/descriptor.rst:1233 msgid "" "Accessing the function through the class dictionary does not invoke :meth:" "`~object.__get__`. Instead, it just returns the underlying function object::" msgstr "" +"クラス辞書から関数にアクセスしても、:meth:`~object.__get__` は呼び出されませ" +"ん。\n" +"格納されている関数オブジェクトがそのまま返されます。 ::" -#: ../../howto/descriptor.rst:1236 msgid "" ">>> D.__dict__['f']\n" "" msgstr "" +">>> D.__dict__['f']\n" +"" -#: ../../howto/descriptor.rst:1239 msgid "" "Dotted access from a class calls :meth:`~object.__get__` which just returns " "the underlying function unchanged::" msgstr "" +"クラスからドット記法でアクセスすると :meth:`~object.__get__` が呼ばれますが、" +"これは元の関数をそのまま返すだけです。 ::" -#: ../../howto/descriptor.rst:1242 msgid "" ">>> D.f\n" "" msgstr "" +">>> D.f\n" +"" -#: ../../howto/descriptor.rst:1245 msgid "" "The interesting behavior occurs during dotted access from an instance. The " "dotted lookup calls :meth:`~object.__get__` which returns a bound method " "object::" msgstr "" +"興味深い動作が起きるのは、インスタンスからドット記法でアクセスしたときで" +"す。\n" +"この検索では :meth:`~object.__get__` が呼ばれ、束縛メソッドオブジェクトが返さ" +"れます。 ::" -#: ../../howto/descriptor.rst:1248 msgid "" ">>> d = D()\n" ">>> d.f\n" ">" msgstr "" +">>> d = D()\n" +">>> d.f\n" +">" #: ../../howto/descriptor.rst:1252 msgid "" @@ -1515,7 +1896,6 @@ msgstr "" "内部では、束縛メソッドはオリジナルの関数と束縛されたインスタンスを保持してい" "ます。" -#: ../../howto/descriptor.rst:1255 msgid "" ">>> d.f.__func__\n" "\n" @@ -1523,6 +1903,11 @@ msgid "" ">>> d.f.__self__\n" "<__main__.D object at 0x00B18C90>" msgstr "" +">>> d.f.__func__\n" +"\n" +"\n" +">>> d.f.__self__\n" +"<__main__.D object at 0x00B18C90>" #: ../../howto/descriptor.rst:1261 msgid "" @@ -1544,13 +1929,17 @@ msgstr "" "非データデスクリプタは、関数をメソッドに束縛する、各種の一般的なパターンに、" "単純な機構を提供します。" -#: ../../howto/descriptor.rst:1271 msgid "" "To recap, functions have a :meth:`~object.__get__` method so that they can " "be converted to a method when accessed as attributes. The non-data " "descriptor transforms an ``obj.f(*args)`` call into ``f(obj, *args)``. " "Calling ``cls.f(*args)`` becomes ``f(*args)``." msgstr "" +"ここまでを振り返ると、関数は :meth:`~object.__get__` メソッドを持ち、属性とし" +"てアクセスされたときにメソッドに変換できます。\n" +"この非データデスクリプタは ``obj.f(*args)`` という呼び出しを ``f(obj, " +"*args)`` に変換します。\n" +"``cls.f(*args)`` は ``f(*args)`` になります。" #: ../../howto/descriptor.rst:1276 msgid "This chart summarizes the binding and its two most useful variants:" @@ -1639,21 +2028,27 @@ msgid "" msgstr "" "静的メソッドは下にある関数をそのまま返すので、呼び出しの例は面白くありません:" -#: ../../howto/descriptor.rst:1314 msgid "" "class E:\n" " @staticmethod\n" " def f(x):\n" " return x * 10" msgstr "" +"class E:\n" +" @staticmethod\n" +" def f(x):\n" +" return x * 10" -#: ../../howto/descriptor.rst:1321 msgid "" ">>> E.f(3)\n" "30\n" ">>> E().f(3)\n" "30" msgstr "" +">>> E.f(3)\n" +"30\n" +">>> E().f(3)\n" +"30" #: ../../howto/descriptor.rst:1328 msgid "" @@ -1663,7 +2058,6 @@ msgstr "" "非データデスクリプタプロトコルを使うと、pure Python 版の :func:" "`staticmethod` は以下のようになります:" -#: ../../howto/descriptor.rst:1331 msgid "" "import functools\n" "\n" @@ -1684,8 +2078,25 @@ msgid "" " def __annotations__(self):\n" " return self.f.__annotations__" msgstr "" +"import functools\n" +"\n" +"class StaticMethod:\n" +" \"Objects/funcobject.c の PyStaticMethod_Type() を模擬する\"\n" +"\n" +" def __init__(self, f):\n" +" self.f = f\n" +" functools.update_wrapper(self, f)\n" +"\n" +" def __get__(self, obj, objtype=None):\n" +" return self.f\n" +"\n" +" def __call__(self, *args, **kwds):\n" +" return self.f(*args, **kwds)\n" +"\n" +" @property\n" +" def __annotations__(self):\n" +" return self.f.__annotations__" -#: ../../howto/descriptor.rst:1352 msgid "" "The :func:`functools.update_wrapper` call adds a ``__wrapped__`` attribute " "that refers to the underlying function. Also it carries forward the " @@ -1693,6 +2104,11 @@ msgid "" "including :attr:`~function.__name__`, :attr:`~function.__qualname__`, and :" "attr:`~function.__doc__`." msgstr "" +":func:`functools.update_wrapper` を呼び出すと、元の関数を参照する " +"``__wrapped__`` 属性が追加されます。\n" +"また、ラッパをラップ対象の関数と同じように見せるため、:attr:`~function." +"__name__`、:attr:`~function.__qualname__`、:attr:`~function.__doc__` などの必" +"要な属性が引き継がれます。" #: ../../howto/descriptor.rst:1421 msgid "Class methods" @@ -1708,21 +2124,27 @@ msgstr "" "ストの先頭に加えます。このフォーマットは、呼び出し元がオブジェクトでもクラス" "でも同じです:" -#: ../../howto/descriptor.rst:1427 msgid "" "class F:\n" " @classmethod\n" " def f(cls, x):\n" " return cls.__name__, x" msgstr "" +"class F:\n" +" @classmethod\n" +" def f(cls, x):\n" +" return cls.__name__, x" -#: ../../howto/descriptor.rst:1434 msgid "" ">>> F.f(3)\n" "('F', 3)\n" ">>> F().f(3)\n" "('F', 3)" msgstr "" +">>> F.f(3)\n" +"('F', 3)\n" +">>> F().f(3)\n" +"('F', 3)" #: ../../howto/descriptor.rst:1441 msgid "" @@ -1737,7 +2159,6 @@ msgstr "" "クラスコンストラクタを作ることです。例えば、クラスメソッド :func:`dict." "fromkeys` は新しい辞書をキーのリストから生成します。等価な pure Python 版は:" -#: ../../howto/descriptor.rst:1447 msgid "" "class Dict(dict):\n" " @classmethod\n" @@ -1748,12 +2169,19 @@ msgid "" " d[key] = value\n" " return d" msgstr "" +"class Dict(dict):\n" +" @classmethod\n" +" def fromkeys(cls, iterable, value=None):\n" +" \"Objects/dictobject.c の dict_fromkeys() を模擬する\"\n" +" d = cls()\n" +" for key in iterable:\n" +" d[key] = value\n" +" return d" #: ../../howto/descriptor.rst:1458 msgid "Now a new dictionary of unique keys can be constructed like this:" msgstr "これで一意なキーを持つ新しい辞書が以下のように構成できます:" -#: ../../howto/descriptor.rst:1460 msgid "" ">>> d = Dict.fromkeys('abracadabra')\n" ">>> type(d) is Dict\n" @@ -1761,6 +2189,11 @@ msgid "" ">>> d\n" "{'a': None, 'b': None, 'r': None, 'c': None, 'd': None}" msgstr "" +">>> d = Dict.fromkeys('abracadabra')\n" +">>> type(d) is Dict\n" +"True\n" +">>> d\n" +"{'a': None, 'b': None, 'r': None, 'c': None, 'd': None}" #: ../../howto/descriptor.rst:1468 msgid "" @@ -1770,7 +2203,6 @@ msgstr "" "非データデスクリプタプロトコルを使った、 :func:`classmethod` の pure Python " "版はこのようになります:" -#: ../../howto/descriptor.rst:1471 msgid "" "import functools\n" "\n" @@ -1786,6 +2218,19 @@ msgid "" " cls = type(obj)\n" " return MethodType(self.f, cls)" msgstr "" +"import functools\n" +"\n" +"class ClassMethod:\n" +" \"Objects/funcobject.c の PyClassMethod_Type() を模擬する\"\n" +"\n" +" def __init__(self, f):\n" +" self.f = f\n" +" functools.update_wrapper(self, f)\n" +"\n" +" def __get__(self, obj, cls=None):\n" +" if cls is None:\n" +" cls = type(obj)\n" +" return MethodType(self.f, cls)" #: ../../howto/descriptor.rst:1533 msgid "" @@ -1812,7 +2257,7 @@ msgid "" "fixed-length array of slot values. From a user point of view that has " "several effects:" msgstr "" -"クラスが ``__slots__`` を定義すると、インスタンスの辞書が固定超のスロットの値" +"クラスが ``__slots__`` を定義すると、インスタンスの辞書が固定長のスロットの値" "の配列と置き換えられます。ユーザーの目線からみると、いくつかの変化がありま" "す。" @@ -1829,8 +2274,9 @@ msgid "" "class Vehicle:\n" " __slots__ = ('id_number', 'make', 'model')" msgstr "" +"class Vehicle:\n" +" __slots__ = ('id_number', 'make', 'model')" -#: ../../howto/descriptor.rst:1556 msgid "" ">>> auto = Vehicle()\n" ">>> auto.id_nubmer = 'VYE483814LQEX'\n" @@ -1838,6 +2284,11 @@ msgid "" " ...\n" "AttributeError: 'Vehicle' object has no attribute 'id_nubmer'" msgstr "" +">>> auto = Vehicle()\n" +">>> auto.id_nubmer = 'VYE483814LQEX'\n" +"Traceback (most recent call last):\n" +" ...\n" +"AttributeError: 'Vehicle' object has no attribute 'id_nubmer'" #: ../../howto/descriptor.rst:1564 msgid "" @@ -1847,7 +2298,6 @@ msgstr "" "2. デスクリプタが ``__slots__`` に格納されたプライベートな属性へのアクセスを" "制御するような、イミュータブルオブジェクトが作りやすくなる。" -#: ../../howto/descriptor.rst:1567 msgid "" "class Immutable:\n" "\n" @@ -1866,8 +2316,22 @@ msgid "" " def name(self): # Read-only descriptor\n" " return self._name" msgstr "" +"class Immutable:\n" +"\n" +" __slots__ = ('_dept', '_name') # インスタンス辞書を置き換える\n" +"\n" +" def __init__(self, dept, name):\n" +" self._dept = dept # プライベート属性に格納する\n" +" self._name = name # プライベート属性に格納する\n" +"\n" +" @property # 読み取り専用のデスクリプタ\n" +" def dept(self):\n" +" return self._dept\n" +"\n" +" @property\n" +" def name(self): # 読み取り専用のデスクリプタ\n" +" return self._name" -#: ../../howto/descriptor.rst:1585 msgid "" ">>> mark = Immutable('Botany', 'Mark Watney')\n" ">>> mark.dept\n" @@ -1881,6 +2345,17 @@ msgid "" " ...\n" "AttributeError: 'Immutable' object has no attribute 'location'" msgstr "" +">>> mark = Immutable('Botany', 'Mark Watney')\n" +">>> mark.dept\n" +"'Botany'\n" +">>> mark.dept = 'Space Pirate'\n" +"Traceback (most recent call last):\n" +" ...\n" +"AttributeError: property 'dept' of 'Immutable' object has no setter\n" +">>> mark.location = 'Mars'\n" +"Traceback (most recent call last):\n" +" ...\n" +"AttributeError: 'Immutable' object has no attribute 'location'" #: ../../howto/descriptor.rst:1599 msgid "" @@ -1911,7 +2386,6 @@ msgstr "" "5. :func:`functools.cached_property` のような、動作にインスタンス辞書が必要な" "ツールが使えなくなる。" -#: ../../howto/descriptor.rst:1610 msgid "" "from functools import cached_property\n" "\n" @@ -1923,16 +2397,27 @@ msgid "" " return 4 * sum((-1.0)**n / (2.0*n + 1.0)\n" " for n in reversed(range(100_000)))" msgstr "" +"from functools import cached_property\n" +"\n" +"class CP:\n" +" __slots__ = () # インスタンス辞書をなくす\n" +"\n" +" @cached_property # インスタンス辞書が必要\n" +" def pi(self):\n" +" return 4 * sum((-1.0)**n / (2.0*n + 1.0)\n" +" for n in reversed(range(100_000)))" -#: ../../howto/descriptor.rst:1622 msgid "" ">>> CP().pi\n" "Traceback (most recent call last):\n" " ...\n" "TypeError: No '__dict__' attribute on 'CP' instance to cache 'pi' property." msgstr "" +">>> CP().pi\n" +"Traceback (most recent call last):\n" +" ...\n" +"TypeError: No '__dict__' attribute on 'CP' instance to cache 'pi' property." -#: ../../howto/descriptor.rst:1629 msgid "" "It is not possible to create an exact drop-in pure Python version of " "``__slots__`` because it requires direct access to C structures and control " @@ -1941,11 +2426,12 @@ msgid "" "``_slotvalues`` list. Reads and writes to that private structure are " "managed by member descriptors:" msgstr "" -"``__slots__`` はC構造体に直接アクセスし、オブジェクトのメモリ確保を制御する必" -"要があるため、ピュアPythonバージョンを作成することはできません。しかし、プラ" -"イベートの ``__slotvalues`` リストを使ってC構造体のスロットをほぼ忠実にエミュ" -"レートすることはできます。そのプライベートな構造体への読み書きはメンバーのデ" -"スクリプタによって管理されます。" +"``__slots__`` は C 構造体への直接アクセスとオブジェクトのメモリ割り当ての制御" +"を必要とするため、完全に置き換え可能な実装を Python だけで作ることはできませ" +"ん。\n" +"ただし、スロット用の C 構造体をプライベートな ``_slotvalues`` リストで模擬す" +"ることで、ほぼ忠実に再現できます。\n" +"このプライベートな構造への読み書きは、メンバーデスクリプタが管理します。" #: ../../howto/descriptor.rst:1636 msgid "" @@ -1986,11 +2472,12 @@ msgid "" " return f''" msgstr "" -#: ../../howto/descriptor.rst:1674 msgid "" "The :meth:`!type.__new__` method takes care of adding member objects to " "class variables:" msgstr "" +":meth:`!type.__new__` メソッドが、クラス変数にメンバーオブジェクトを追加しま" +"す。" #: ../../howto/descriptor.rst:1677 msgid "" @@ -2016,7 +2503,6 @@ msgstr "" "スタンスの作成の処理をします。おおざっぱにピュアPythonでのシミュレーションし" "たコードがこちらです。" -#: ../../howto/descriptor.rst:1694 msgid "" "class Object:\n" " 'Simulate how object.__new__() allocates memory for __slots__'\n" @@ -2047,14 +2533,42 @@ msgid "" " )\n" " super().__delattr__(name)" msgstr "" +"class Object:\n" +" 'object.__new__() が __slots__ 用のメモリを確保する仕組みを模擬する'\n" +"\n" +" def __new__(cls, *args, **kwargs):\n" +" 'Objects/typeobject.c の object_new() を模擬する'\n" +" inst = super().__new__(cls)\n" +" if hasattr(cls, 'slot_names'):\n" +" empty_slots = [null] * len(cls.slot_names)\n" +" object.__setattr__(inst, '_slotvalues', empty_slots)\n" +" return inst\n" +"\n" +" def __setattr__(self, name, value):\n" +" 'Objects/object.c の _PyObject_GenericSetAttrWithDict() を模擬する'\n" +" cls = type(self)\n" +" if hasattr(cls, 'slot_names') and name not in cls.slot_names:\n" +" raise AttributeError(\n" +" f'{cls.__name__!r} object has no attribute {name!r}'\n" +" )\n" +" super().__setattr__(name, value)\n" +"\n" +" def __delattr__(self, name):\n" +" 'Objects/object.c の _PyObject_GenericSetAttrWithDict() を模擬する'\n" +" cls = type(self)\n" +" if hasattr(cls, 'slot_names') and name not in cls.slot_names:\n" +" raise AttributeError(\n" +" f'{cls.__name__!r} object has no attribute {name!r}'\n" +" )\n" +" super().__delattr__(name)" -#: ../../howto/descriptor.rst:1725 msgid "" "To use the simulation in a real class, just inherit from :class:`!Object` " "and set the :term:`metaclass` to :class:`Type`:" msgstr "" +"この模擬実装を実際のクラスで使うには、:class:`!Object` を継承し、:term:" +"`metaclass` を :class:`Type` にするだけです。" -#: ../../howto/descriptor.rst:1728 msgid "" "class H(Object, metaclass=Type):\n" " 'Instance variables stored in slots'\n" @@ -2065,6 +2579,14 @@ msgid "" " self.x = x\n" " self.y = y" msgstr "" +"class H(Object, metaclass=Type):\n" +" 'インスタンス変数をスロットに格納する'\n" +"\n" +" slot_names = ['x', 'y']\n" +"\n" +" def __init__(self, x, y):\n" +" self.x = x\n" +" self.y = y" #: ../../howto/descriptor.rst:1739 msgid "" @@ -2072,7 +2594,6 @@ msgid "" msgstr "" "この時点ではメタクラスは *x* と *y* のメンバーオブジェクトをロードします。" -#: ../../howto/descriptor.rst:1741 msgid "" ">>> from pprint import pp\n" ">>> pp(dict(vars(H)))\n" @@ -2083,6 +2604,14 @@ msgid "" " 'x': ,\n" " 'y': }" msgstr "" +">>> from pprint import pp\n" +">>> pp(dict(vars(H)))\n" +"{'__module__': '__main__',\n" +" '__doc__': 'インスタンス変数をスロットに格納する',\n" +" 'slot_names': ['x', 'y'],\n" +" '__init__': ,\n" +" 'x': ,\n" +" 'y': }" #: ../../howto/descriptor.rst:1760 msgid "" @@ -2092,7 +2621,6 @@ msgstr "" "インスタンスが作成されると、属性が保持される ``slot_values`` のリストをイン" "スタンスが保持します:" -#: ../../howto/descriptor.rst:1763 msgid "" ">>> h = H(10, 20)\n" ">>> vars(h)\n" @@ -2101,15 +2629,24 @@ msgid "" ">>> vars(h)\n" "{'_slotvalues': [55, 20]}" msgstr "" +">>> h = H(10, 20)\n" +">>> vars(h)\n" +"{'_slotvalues': [10, 20]}\n" +">>> h.x = 55\n" +">>> vars(h)\n" +"{'_slotvalues': [55, 20]}" #: ../../howto/descriptor.rst:1772 msgid "Misspelled or unassigned attributes will raise an exception:" msgstr "スペルミスや、未アサインの属性は例外を送出します。" -#: ../../howto/descriptor.rst:1774 msgid "" ">>> h.xz\n" "Traceback (most recent call last):\n" " ...\n" "AttributeError: 'H' object has no attribute 'xz'" msgstr "" +">>> h.xz\n" +"Traceback (most recent call last):\n" +" ...\n" +"AttributeError: 'H' object has no attribute 'xz'" diff --git a/howto/enum.po b/howto/enum.po index 86cb44eda..6d7856f38 100644 --- a/howto/enum.po +++ b/howto/enum.po @@ -21,10 +21,10 @@ msgstr "" "Last-Translator: Arihiro TAKASE, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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/enum.rst:5 @@ -49,7 +49,6 @@ msgstr "" "これらは、限られた選択肢の値の一つを取る変数がある場合に便利です。例えば、曜" "日情報があります:" -#: ../../howto/enum.rst:18 msgid "" ">>> from enum import Enum\n" ">>> class Weekday(Enum):\n" @@ -61,12 +60,20 @@ msgid "" "... SATURDAY = 6\n" "... SUNDAY = 7" msgstr "" +">>> from enum import Enum\n" +">>> class Weekday(Enum):\n" +"... MONDAY = 1\n" +"... TUESDAY = 2\n" +"... WEDNESDAY = 3\n" +"... THURSDAY = 4\n" +"... FRIDAY = 5\n" +"... SATURDAY = 6\n" +"... SUNDAY = 7" #: ../../howto/enum.rst:28 msgid "Or perhaps the RGB primary colors::" msgstr "あるいは、RGB三原色でも構いません::" -#: ../../howto/enum.rst:30 msgid "" ">>> from enum import Enum\n" ">>> class Color(Enum):\n" @@ -74,6 +81,11 @@ msgid "" "... GREEN = 2\n" "... BLUE = 3" msgstr "" +">>> from enum import Enum\n" +">>> class Color(Enum):\n" +"... RED = 1\n" +"... GREEN = 2\n" +"... BLUE = 3" #: ../../howto/enum.rst:36 msgid "" @@ -107,11 +119,12 @@ msgstr "" "列挙型の性質によって、メンバの値は重要な場合とそうでない場合がありますが、い" "ずれの場合でも、その値は対応するメンバを取得するのに使えます::" -#: ../../howto/enum.rst:50 msgid "" ">>> Weekday(3)\n" "" msgstr "" +">>> Weekday(3)\n" +"" #: ../../howto/enum.rst:53 msgid "" @@ -122,45 +135,50 @@ msgstr "" "ご覧の通り、メンバの ``repr()`` は列挙型の名前、メンバの名前、そして値を表示" "します。メンバの ``str()`` は列挙型の名前とメンバの名前のみを表示します。" -#: ../../howto/enum.rst:57 msgid "" ">>> print(Weekday.THURSDAY)\n" "Weekday.THURSDAY" msgstr "" +">>> print(Weekday.THURSDAY)\n" +"Weekday.THURSDAY" #: ../../howto/enum.rst:60 msgid "The *type* of an enumeration member is the enum it belongs to::" msgstr "列挙型のメンバの型はそのメンバの属する列挙型です::" -#: ../../howto/enum.rst:62 msgid "" ">>> type(Weekday.MONDAY)\n" "\n" ">>> isinstance(Weekday.FRIDAY, Weekday)\n" "True" msgstr "" +">>> type(Weekday.MONDAY)\n" +"\n" +">>> isinstance(Weekday.FRIDAY, Weekday)\n" +"True" -#: ../../howto/enum.rst:67 msgid "Enum members have an attribute that contains just their :attr:`!name`::" msgstr "" +"列挙型のメンバーには、その名前だけを保持する :attr:`!name` 属性がありま" +"す。 ::" -#: ../../howto/enum.rst:69 msgid "" ">>> print(Weekday.TUESDAY.name)\n" "TUESDAY" msgstr "" +">>> print(Weekday.TUESDAY.name)\n" +"TUESDAY" -#: ../../howto/enum.rst:72 msgid "Likewise, they have an attribute for their :attr:`!value`::" -msgstr "" +msgstr "同様に、値を保持する :attr:`!value` 属性もあります。 ::" -#: ../../howto/enum.rst:75 msgid "" ">>> Weekday.WEDNESDAY.value\n" "3" msgstr "" +">>> Weekday.WEDNESDAY.value\n" +"3" -#: ../../howto/enum.rst:78 msgid "" "Unlike many languages that treat enumerations solely as name/value pairs, " "Python Enums can have behavior added. For example, :class:`datetime.date` " @@ -171,19 +189,27 @@ msgid "" "day from the :class:`~datetime.date` instance and return the matching enum " "member::" msgstr "" +"多くの言語では列挙型を名前と値の組だけとして扱いますが、Python の列挙型には動" +"作を追加できます。\n" +"例えば、:class:`datetime.date` には曜日を返す :meth:`~datetime.date.weekday` " +"と :meth:`~datetime.date.isoweekday` という 2 つのメソッドがあります。\n" +"違いは、一方が 0~6、もう一方が 1~7 で数えることです。\n" +"この違いを自分で管理する代わりに、:class:`!Weekday` 列挙型にメソッドを追加" +"し、:class:`~datetime.date` インスタンスから曜日を取り出して、対応する列挙型" +"メンバーを返すようにできます。 ::" -#: ../../howto/enum.rst:87 msgid "" "@classmethod\n" "def from_date(cls, date):\n" " return cls(date.isoweekday())" msgstr "" +"@classmethod\n" +"def from_date(cls, date):\n" +" return cls(date.isoweekday())" -#: ../../howto/enum.rst:91 msgid "The complete :class:`!Weekday` enum now looks like this::" -msgstr "" +msgstr ":class:`!Weekday` 列挙型全体は次のようになります。 ::" -#: ../../howto/enum.rst:93 msgid "" ">>> class Weekday(Enum):\n" "... MONDAY = 1\n" @@ -198,6 +224,18 @@ msgid "" "... def from_date(cls, date):\n" "... return cls(date.isoweekday())" msgstr "" +">>> class Weekday(Enum):\n" +"... MONDAY = 1\n" +"... TUESDAY = 2\n" +"... WEDNESDAY = 3\n" +"... THURSDAY = 4\n" +"... FRIDAY = 5\n" +"... SATURDAY = 6\n" +"... SUNDAY = 7\n" +"... #\n" +"... @classmethod\n" +"... def from_date(cls, date):\n" +"... return cls(date.isoweekday())" #: ../../howto/enum.rst:106 msgid "Now we can find out what today is! Observe::" @@ -218,15 +256,18 @@ msgstr "" "もちろん、あなたがこれを読んでいるのが他の曜日ならば、その曜日が代わりに表示" "されます。" -#: ../../howto/enum.rst:114 msgid "" "This :class:`!Weekday` enum is great if our variable only needs one day, but " "what if we need several? Maybe we're writing a function to plot chores " "during a week, and don't want to use a :class:`list` -- we could use a " "different type of :class:`Enum`::" msgstr "" +"この :class:`!Weekday` 列挙型は、変数が 1 つの曜日だけを表せばよい場合には便" +"利ですが、複数の曜日が必要ならどうでしょうか?\n" +"例えば、1 週間の家事を割り当てる関数を書いていて、:class:`list` は使いたくな" +"いとします。\n" +"別の種類の :class:`Enum` を使う方法があります。 ::" -#: ../../howto/enum.rst:119 msgid "" ">>> from enum import Flag\n" ">>> class Weekday(Flag):\n" @@ -238,6 +279,15 @@ msgid "" "... SATURDAY = 32\n" "... SUNDAY = 64" msgstr "" +">>> from enum import Flag\n" +">>> class Weekday(Flag):\n" +"... MONDAY = 1\n" +"... TUESDAY = 2\n" +"... WEDNESDAY = 4\n" +"... THURSDAY = 8\n" +"... FRIDAY = 16\n" +"... SATURDAY = 32\n" +"... SUNDAY = 64" #: ../../howto/enum.rst:129 msgid "" @@ -247,18 +297,20 @@ msgstr "" "ここでは2つの変更が行われています。:class:`Flag` を継承している点と、値がすべ" "て2の累乗である点です。" -#: ../../howto/enum.rst:132 msgid "" "Just like the original :class:`!Weekday` enum above, we can have a single " "selection::" msgstr "" +"先ほどの :class:`!Weekday` 列挙型と同じように、1 つの曜日を選べます。 ::" -#: ../../howto/enum.rst:134 msgid "" ">>> first_week_day = Weekday.MONDAY\n" ">>> first_week_day\n" "" msgstr "" +">>> first_week_day = Weekday.MONDAY\n" +">>> first_week_day\n" +"" #: ../../howto/enum.rst:138 msgid "" @@ -268,30 +320,34 @@ msgstr "" "ただし、:class:`Flag` は複数のメンバーをひとつの変数にまとめることもできま" "す::" -#: ../../howto/enum.rst:141 msgid "" ">>> weekend = Weekday.SATURDAY | Weekday.SUNDAY\n" ">>> weekend\n" "" msgstr "" +">>> weekend = Weekday.SATURDAY | Weekday.SUNDAY\n" +">>> weekend\n" +"" #: ../../howto/enum.rst:145 msgid "You can even iterate over a :class:`Flag` variable::" msgstr ":class:`Flag` 変数は反復することもできます::" -#: ../../howto/enum.rst:147 msgid "" ">>> for day in weekend:\n" "... print(day)\n" "Weekday.SATURDAY\n" "Weekday.SUNDAY" msgstr "" +">>> for day in weekend:\n" +"... print(day)\n" +"Weekday.SATURDAY\n" +"Weekday.SUNDAY" #: ../../howto/enum.rst:152 msgid "Okay, let's get some chores set up::" msgstr "さて、いくつかの家事を設定してみましょう::" -#: ../../howto/enum.rst:154 msgid "" ">>> chores_for_ethan = {\n" "... 'feed the cat': Weekday.MONDAY | Weekday.WEDNESDAY | Weekday." @@ -300,12 +356,17 @@ msgid "" "... 'answer SO questions': Weekday.SATURDAY,\n" "... }" msgstr "" +">>> chores_for_ethan = {\n" +"... 'feed the cat': Weekday.MONDAY | Weekday.WEDNESDAY | Weekday." +"FRIDAY,\n" +"... 'do the dishes': Weekday.TUESDAY | Weekday.THURSDAY,\n" +"... 'answer SO questions': Weekday.SATURDAY,\n" +"... }" #: ../../howto/enum.rst:160 msgid "And a function to display the chores for a given day::" msgstr "指定された日の家事を表示する関数も作成します::" -#: ../../howto/enum.rst:162 msgid "" ">>> def show_chores(chores, day):\n" "... for chore, days in chores.items():\n" @@ -315,6 +376,13 @@ msgid "" ">>> show_chores(chores_for_ethan, Weekday.SATURDAY)\n" "answer SO questions" msgstr "" +">>> def show_chores(chores, day):\n" +"... for chore, days in chores.items():\n" +"... if day in days:\n" +"... print(chore)\n" +"...\n" +">>> show_chores(chores_for_ethan, Weekday.SATURDAY)\n" +"answer SO questions" #: ../../howto/enum.rst:170 msgid "" @@ -324,7 +392,6 @@ msgstr "" "メンバーの実際の値が重要でない場合は、:func:`auto` を使用することで手間を省く" "ことができます::" -#: ../../howto/enum.rst:173 msgid "" ">>> from enum import auto\n" ">>> class Weekday(Flag):\n" @@ -337,28 +404,42 @@ msgid "" "... SUNDAY = auto()\n" "... WEEKEND = SATURDAY | SUNDAY" msgstr "" +">>> from enum import auto\n" +">>> class Weekday(Flag):\n" +"... MONDAY = auto()\n" +"... TUESDAY = auto()\n" +"... WEDNESDAY = auto()\n" +"... THURSDAY = auto()\n" +"... FRIDAY = auto()\n" +"... SATURDAY = auto()\n" +"... SUNDAY = auto()\n" +"... WEEKEND = SATURDAY | SUNDAY" #: ../../howto/enum.rst:189 msgid "Programmatic access to enumeration members and their attributes" msgstr "列挙型メンバーおよびそれらの属性へのプログラム的アクセス" -#: ../../howto/enum.rst:191 msgid "" "Sometimes it's useful to access members in enumerations programmatically (i." "e. situations where ``Color.RED`` won't do because the exact color is not " "known at program-writing time). ``Enum`` allows such access::" msgstr "" -"プログラム的にメンバーに番号でアクセスしたほうが便利な場合があります (すなわ" -"ち、プログラムを書いている時点で正確な色がまだわからなく、``Color.RED`` と書" -"くのが無理な場合など)。 ``Enum`` ではそのようなアクセスも可能です::" +"列挙型のメンバーに、プログラムで決めた値を使ってアクセスしたい場合がありま" +"す。\n" +"例えば、プログラムを書く時点では具体的な色が決まっておらず、``Color.RED`` と" +"書けない場合です。\n" +"``Enum`` はそのようなアクセスもできます。 ::" -#: ../../howto/enum.rst:195 msgid "" ">>> Color(1)\n" "\n" ">>> Color(3)\n" "" msgstr "" +">>> Color(1)\n" +"\n" +">>> Color(3)\n" +"" #: ../../howto/enum.rst:200 msgid "If you want to access enum members by *name*, use item access::" @@ -366,20 +447,23 @@ msgstr "" "列挙型メンバーに *名前* でアクセスしたい場合はアイテムとしてアクセスできま" "す::" -#: ../../howto/enum.rst:202 msgid "" ">>> Color['RED']\n" "\n" ">>> Color['GREEN']\n" "" msgstr "" +">>> Color['RED']\n" +"\n" +">>> Color['GREEN']\n" +"" -#: ../../howto/enum.rst:207 msgid "" "If you have an enum member and need its :attr:`!name` or :attr:`!value`::" msgstr "" +"列挙型メンバーから :attr:`!name` や :attr:`!value` を取得するには、次のように" +"します。 ::" -#: ../../howto/enum.rst:209 msgid "" ">>> member = Color.RED\n" ">>> member.name\n" @@ -387,6 +471,11 @@ msgid "" ">>> member.value\n" "1" msgstr "" +">>> member = Color.RED\n" +">>> member.name\n" +"'RED'\n" +">>> member.value\n" +"1" #: ../../howto/enum.rst:217 msgid "Duplicating enum members and values" @@ -396,7 +485,6 @@ msgstr "列挙型メンバーと値の重複" msgid "Having two enum members with the same name is invalid::" msgstr "同じ名前の列挙型メンバーを複数持つことはできません::" -#: ../../howto/enum.rst:221 msgid "" ">>> class Shape(Enum):\n" "... SQUARE = 2\n" @@ -406,8 +494,14 @@ msgid "" "...\n" "TypeError: 'SQUARE' already defined as 2" msgstr "" +">>> class Shape(Enum):\n" +"... SQUARE = 2\n" +"... SQUARE = 3\n" +"...\n" +"Traceback (most recent call last):\n" +"...\n" +"TypeError: 'SQUARE' already defined as 2" -#: ../../howto/enum.rst:229 msgid "" "However, an enum member can have other names associated with it. Given two " "entries ``A`` and ``B`` with the same value (and ``A`` defined first), ``B`` " @@ -416,12 +510,11 @@ msgid "" "member ``A``. By-name lookup of ``B`` will also return the member ``A``::" msgstr "" "しかし、列挙型メンバー は、別の名前を持つことができます。 同じ値を持つ " -"``A`` と``B`` が与えられた場合(そして ``A`` が先に定義されている場合)、 " +"``A`` と ``B`` が与えられた場合(そして ``A`` が先に定義されている場合)、 " "``B`` はメンバー ``A`` に対するエイリアスとなります。 ``A`` の値での検索で" "は、メンバー ``A`` が返されます。 ``A`` の名前での検索ではメンバー ``A`` を" "返します。``B`` の名前での検索も、メンバー ``A`` を返します::" -#: ../../howto/enum.rst:235 msgid "" ">>> class Shape(Enum):\n" "... SQUARE = 2\n" @@ -436,6 +529,18 @@ msgid "" ">>> Shape(2)\n" "" msgstr "" +">>> class Shape(Enum):\n" +"... SQUARE = 2\n" +"... DIAMOND = 1\n" +"... CIRCLE = 3\n" +"... ALIAS_FOR_SQUARE = 2\n" +"...\n" +">>> Shape.SQUARE\n" +"\n" +">>> Shape.ALIAS_FOR_SQUARE\n" +"\n" +">>> Shape(2)\n" +"" #: ../../howto/enum.rst:250 msgid "" @@ -446,9 +551,8 @@ msgstr "" "すでに定義されている属性と同じ名前のメンバー (一方がメンバーでもう一方がメ" "ソッド、など) の作成、あるいはメンバーと同じ名前の属性の作成はできません。" -#: ../../howto/enum.rst:256 msgid "Ensuring unique enumeration values" -msgstr "番号付けの値が一意であることの確認" +msgstr "列挙型の値が一意であることを保証する" #: ../../howto/enum.rst:258 msgid "" @@ -458,7 +562,6 @@ msgstr "" "デフォルトでは、列挙型は同じ値のエイリアスとして複数の名前を許容します。この" "振る舞いを望まない場合は、 :func:`unique` デコレータを使用できます::" -#: ../../howto/enum.rst:261 msgid "" ">>> from enum import Enum, unique\n" ">>> @unique\n" @@ -472,6 +575,17 @@ msgid "" "...\n" "ValueError: duplicate values found in : FOUR -> THREE" msgstr "" +">>> from enum import Enum, unique\n" +">>> @unique\n" +"... class Mistake(Enum):\n" +"... ONE = 1\n" +"... TWO = 2\n" +"... THREE = 3\n" +"... FOUR = 3\n" +"...\n" +"Traceback (most recent call last):\n" +"...\n" +"ValueError: duplicate values found in : FOUR -> THREE" #: ../../howto/enum.rst:275 msgid "Using automatic values" @@ -481,7 +595,6 @@ msgstr "値の自動設定を使う" msgid "If the exact value is unimportant you can use :class:`auto`::" msgstr "正確な値が重要でない場合、 :class:`auto` が使えます::" -#: ../../howto/enum.rst:279 msgid "" ">>> from enum import Enum, auto\n" ">>> class Color(Enum):\n" @@ -492,14 +605,22 @@ msgid "" ">>> [member.value for member in Color]\n" "[1, 2, 3]" msgstr "" +">>> from enum import Enum, auto\n" +">>> class Color(Enum):\n" +"... RED = auto()\n" +"... BLUE = auto()\n" +"... GREEN = auto()\n" +"...\n" +">>> [member.value for member in Color]\n" +"[1, 2, 3]" -#: ../../howto/enum.rst:288 msgid "" "The values are chosen by :func:`~Enum._generate_next_value_`, which can be " "overridden::" msgstr "" +"値は :func:`~Enum._generate_next_value_` によって選ばれます。\n" +"この関数はオーバーライドできます。 ::" -#: ../../howto/enum.rst:291 msgid "" ">>> class AutoName(Enum):\n" "... @staticmethod\n" @@ -515,12 +636,26 @@ msgid "" ">>> [member.value for member in Ordinal]\n" "['NORTH', 'SOUTH', 'EAST', 'WEST']" msgstr "" +">>> class AutoName(Enum):\n" +"... @staticmethod\n" +"... def _generate_next_value_(name, start, count, last_values):\n" +"... return name\n" +"...\n" +">>> class Ordinal(AutoName):\n" +"... NORTH = auto()\n" +"... SOUTH = auto()\n" +"... EAST = auto()\n" +"... WEST = auto()\n" +"...\n" +">>> [member.value for member in Ordinal]\n" +"['NORTH', 'SOUTH', 'EAST', 'WEST']" -#: ../../howto/enum.rst:307 msgid "" "The :meth:`~Enum._generate_next_value_` method must be defined before any " "members." msgstr "" +":meth:`~Enum._generate_next_value_` メソッドは、すべてのメンバーより前に定義" +"しなければなりません。" #: ../../howto/enum.rst:310 msgid "Iteration" @@ -530,7 +665,6 @@ msgstr "イテレーション" msgid "Iterating over the members of an enum does not provide the aliases::" msgstr "列挙型のメンバーのイテレートは別名をサポートしていません::" -#: ../../howto/enum.rst:314 msgid "" ">>> list(Shape)\n" "[, , ]\n" @@ -539,13 +673,18 @@ msgid "" "THURSDAY: 8>, , , ]" msgstr "" +">>> list(Shape)\n" +"[, , ]\n" +">>> list(Weekday)\n" +"[, , , , , , ]" -#: ../../howto/enum.rst:319 msgid "" "Note that the aliases ``Shape.ALIAS_FOR_SQUARE`` and ``Weekday.WEEKEND`` " "aren't shown." msgstr "" -"エイリアスである ``Shape.ALIAS_FOR_SQUARE`` と``Weekday.WEEKEND`` が表示され" +"エイリアスである ``Shape.ALIAS_FOR_SQUARE`` と ``Weekday.WEEKEND`` が表示され" "ていないことに注意してください。" #: ../../howto/enum.rst:321 @@ -558,7 +697,6 @@ msgstr "" "型メンバーのマッピングです。これには別名も含め、列挙されたすべての名前が入っ" "ています。" -#: ../../howto/enum.rst:325 msgid "" ">>> for name, member in Shape.__members__.items():\n" "... name, member\n" @@ -568,6 +706,13 @@ msgid "" "('CIRCLE', )\n" "('ALIAS_FOR_SQUARE', )" msgstr "" +">>> for name, member in Shape.__members__.items():\n" +"... name, member\n" +"...\n" +"('SQUARE', )\n" +"('DIAMOND', )\n" +"('CIRCLE', )\n" +"('ALIAS_FOR_SQUARE', )" #: ../../howto/enum.rst:333 msgid "" @@ -577,12 +722,14 @@ msgstr "" "属性 ``__members__`` は列挙型メンバーへの詳細なアクセスに使用できます。以下は" "すべての別名を探す例です::" -#: ../../howto/enum.rst:336 msgid "" ">>> [name for name, member in Shape.__members__.items() if member.name != " "name]\n" "['ALIAS_FOR_SQUARE']" msgstr "" +">>> [name for name, member in Shape.__members__.items() if member.name != " +"name]\n" +"['ALIAS_FOR_SQUARE']" #: ../../howto/enum.rst:341 msgid "" @@ -600,7 +747,6 @@ msgstr "比較" msgid "Enumeration members are compared by identity::" msgstr "列挙型メンバーは同一性を比較できます::" -#: ../../howto/enum.rst:350 msgid "" ">>> Color.RED is Color.RED\n" "True\n" @@ -609,6 +755,12 @@ msgid "" ">>> Color.RED is not Color.BLUE\n" "True" msgstr "" +">>> Color.RED is Color.RED\n" +"True\n" +">>> Color.RED is Color.BLUE\n" +"False\n" +">>> Color.RED is not Color.BLUE\n" +"True" #: ../../howto/enum.rst:357 msgid "" @@ -618,19 +770,21 @@ msgstr "" "列挙型の値の順序の比較はサポートされて *いません*。Enum メンバーは整数ではあ" "りません (`IntEnum`_ を参照してください)::" -#: ../../howto/enum.rst:360 msgid "" ">>> Color.RED < Color.BLUE\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" "TypeError: '<' not supported between instances of 'Color' and 'Color'" msgstr "" +">>> Color.RED < Color.BLUE\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"TypeError: '<' not supported between instances of 'Color' and 'Color'" #: ../../howto/enum.rst:365 msgid "Equality comparisons are defined though::" msgstr "ただし等価の比較は定義されています::" -#: ../../howto/enum.rst:367 msgid "" ">>> Color.BLUE == Color.RED\n" "False\n" @@ -639,6 +793,12 @@ msgid "" ">>> Color.BLUE == Color.BLUE\n" "True" msgstr "" +">>> Color.BLUE == Color.RED\n" +"False\n" +">>> Color.BLUE != Color.RED\n" +"True\n" +">>> Color.BLUE == Color.BLUE\n" +"True" #: ../../howto/enum.rst:374 msgid "" @@ -649,11 +809,12 @@ msgstr "" "非列挙型の値との比較は常に不等となります (繰り返しになりますが、:class:" "`IntEnum` はこれと異なる挙動になるよう設計されています)::" -#: ../../howto/enum.rst:378 msgid "" ">>> Color.BLUE == 2\n" "False" msgstr "" +">>> Color.BLUE == 2\n" +"False" #: ../../howto/enum.rst:383 msgid "" @@ -691,7 +852,6 @@ msgstr "" "列挙型は Python のクラスであり、通常どおりメソッドや特殊メソッドを持つことが" "できます::" -#: ../../howto/enum.rst:399 msgid "" ">>> class Mood(Enum):\n" "... FUNKY = 1\n" @@ -710,12 +870,27 @@ msgid "" "... return cls.HAPPY\n" "..." msgstr "" +">>> class Mood(Enum):\n" +"... FUNKY = 1\n" +"... HAPPY = 3\n" +"...\n" +"... def describe(self):\n" +"... # ここでは self はメンバー\n" +"... return self.name, self.value\n" +"...\n" +"... def __str__(self):\n" +"... return 'my custom str! {0}'.format(self.value)\n" +"...\n" +"... @classmethod\n" +"... def favorite_mood(cls):\n" +"... # ここでは cls は列挙型\n" +"... return cls.HAPPY\n" +"..." #: ../../howto/enum.rst:416 msgid "Then::" msgstr "上記の結果が以下のようになります::" -#: ../../howto/enum.rst:418 msgid "" ">>> Mood.favorite_mood()\n" "\n" @@ -724,8 +899,13 @@ msgid "" ">>> str(Mood.FUNKY)\n" "'my custom str! 1'" msgstr "" +">>> Mood.favorite_mood()\n" +"\n" +">>> Mood.HAPPY.describe()\n" +"('HAPPY', 3)\n" +">>> str(Mood.FUNKY)\n" +"'my custom str! 1'" -#: ../../howto/enum.rst:425 msgid "" "The rules for what is allowed are as follows: names that start and end with " "a single underscore are reserved by enum and cannot be used; all other " @@ -734,41 +914,55 @@ msgid "" "__str__`, :meth:`~object.__add__`, etc.), descriptors (methods are also " "descriptors), and variable names listed in :attr:`~Enum._ignore_`." msgstr "" +"使用できるものの規則は次のとおりです。\n" +"先頭と末尾がそれぞれ 1 つのアンダースコアである名前は enum が予約しているため" +"使えません。\n" +"それ以外の、列挙型の中で定義した属性はすべて列挙型のメンバーになります。\n" +"ただし、:meth:`~object.__str__` や :meth:`~object.__add__` などの特殊メソッ" +"ド、デスクリプタ (メソッドもデスクリプタです)、:attr:`~Enum._ignore_` に列挙" +"した変数名は例外です。" -#: ../../howto/enum.rst:432 msgid "" "Note: if your enumeration defines :meth:`~object.__new__` and/or :meth:" "`~object.__init__`, any value(s) given to the enum member will be passed " "into those methods. See `Planet`_ for an example." msgstr "" +"注意: 列挙型に :meth:`~object.__new__` や :meth:`~object.__init__` を定義する" +"と、メンバーに指定した値がそれらのメソッドに渡されます。\n" +"例は `Planet`_ を参照してください。" -#: ../../howto/enum.rst:438 msgid "" "The :meth:`~object.__new__` method, if defined, is used during creation of " "the Enum members; it is then replaced by Enum's :meth:`~object.__new__` " "which is used after class creation for lookup of existing members. See :ref:" "`new-vs-init` for more details." msgstr "" +":meth:`~object.__new__` を定義した場合、そのメソッドは Enum メンバーの作成時" +"に使われます。\n" +"その後は Enum の :meth:`~object.__new__` に置き換えられ、クラス作成後の既存メ" +"ンバーの検索に使われます。\n" +"詳しくは :ref:`new-vs-init` を参照してください。" #: ../../howto/enum.rst:445 msgid "Restricted Enum subclassing" msgstr "Enumのサブクラス化の制限" -#: ../../howto/enum.rst:447 msgid "" "A new :class:`Enum` class must have one base enum class, up to one concrete " "data type, and as many :class:`object`-based mixin classes as needed. The " "order of these base classes is::" msgstr "" -"新しい :class:`Enum` クラスは、ベースの enum クラスを1つ、具象データ型を1つ、" -"複数の :class:`object` ベースのミックスインクラスが許容されます。これらのベー" -"スクラスの順序は次の通りです::" +"新しい :class:`Enum` クラスには、基底となる列挙型クラスが 1 つ必要です。\n" +"加えて、具象データ型を最大 1 つ、:class:`object` を基底とするミックスインクラ" +"スを必要なだけ指定できます。\n" +"これらの基底クラスは次の順に並べます。 ::" -#: ../../howto/enum.rst:451 msgid "" "class EnumName([mix-in, ...,] [data-type,] base-enum):\n" " pass" msgstr "" +"class EnumName([mix-in, ...,] [data-type,] base-enum):\n" +" pass" #: ../../howto/enum.rst:454 msgid "" @@ -778,7 +972,6 @@ msgstr "" "列挙型のサブクラスの作成はその列挙型にメンバーが一つも定義されていない場合の" "み行なえます。従って以下は許されません::" -#: ../../howto/enum.rst:457 msgid "" ">>> class MoreColor(Color):\n" "... PINK = 17\n" @@ -787,12 +980,17 @@ msgid "" "...\n" "TypeError: cannot extend " msgstr "" +">>> class MoreColor(Color):\n" +"... PINK = 17\n" +"...\n" +"Traceback (most recent call last):\n" +"...\n" +"TypeError: cannot extend " #: ../../howto/enum.rst:464 msgid "But this is allowed::" msgstr "以下のような場合は許されます::" -#: ../../howto/enum.rst:466 msgid "" ">>> class Foo(Enum):\n" "... def some_behavior(self):\n" @@ -803,18 +1001,26 @@ msgid "" "... SAD = 2\n" "..." msgstr "" +">>> class Foo(Enum):\n" +"... def some_behavior(self):\n" +"... pass\n" +"...\n" +">>> class Bar(Foo):\n" +"... HAPPY = 1\n" +"... SAD = 2\n" +"..." -#: ../../howto/enum.rst:475 msgid "" "Allowing subclassing of enums that define members would lead to a violation " "of some important invariants of types and instances. On the other hand, it " "makes sense to allow sharing some common behavior between a group of " "enumerations. (See `OrderedEnum`_ for an example.)" msgstr "" -"メンバーが定義された列挙型のサブクラス化を許可すると、いくつかのデータ型およ" -"びインスタンスの重要な不変条件の違反を引き起こします。とはいえ、それが許可さ" -"れると、列挙型のグループ間での共通の挙動を共有するという利点もあります。 " -"(`OrderedEnum`_ の例を参照してください。)" +"メンバーを定義した列挙型のサブクラス化を許すと、型やインスタンスに関する重要" +"な不変条件が破られます。\n" +"一方、複数の列挙型で共通の動作を共有できるようにすることには意味がありま" +"す。\n" +"例は `OrderedEnum`_ を参照してください。" #: ../../howto/enum.rst:484 msgid "Dataclass support" @@ -828,7 +1034,6 @@ msgstr "" ":class:`~dataclasses.dataclass` を継承する場合、 :meth:`~Enum.__repr__` は継" "承するクラス名を省略します。 例えば::" -#: ../../howto/enum.rst:489 msgid "" ">>> from dataclasses import dataclass, field\n" ">>> @dataclass\n" @@ -844,6 +1049,19 @@ msgid "" ">>> Creature.DOG\n" "" msgstr "" +">>> from dataclasses import dataclass, field\n" +">>> @dataclass\n" +"... class CreatureDataMixin:\n" +"... size: str\n" +"... legs: int\n" +"... tail: bool = field(repr=False, default=True)\n" +"...\n" +">>> class Creature(CreatureDataMixin, Enum):\n" +"... BEETLE = 'small', 6\n" +"... DOG = 'medium', 4\n" +"...\n" +">>> Creature.DOG\n" +"" #: ../../howto/enum.rst:503 msgid "" @@ -872,7 +1090,6 @@ msgstr "" "加えることはサポートされていません。そうしてもエラーは送出されませんが、実行" "時にそれぞれのメンバが互いに等しいなど、非常に奇妙な結果が起こります::" -#: ../../howto/enum.rst:517 msgid "" ">>> @dataclass # don't do this: it does not make any sense\n" "... class Color(Enum):\n" @@ -884,6 +1101,16 @@ msgid "" ">>> Color.RED == Color.BLUE # problem is here: they should not be equal\n" "True" msgstr "" +">>> @dataclass # 意味のない操作なので、このようにしてはいけな" +"い\n" +"... class Color(Enum):\n" +"... RED = 1\n" +"... BLUE = 2\n" +"...\n" +">>> Color.RED is Color.BLUE\n" +"False\n" +">>> Color.RED == Color.BLUE # ここが問題: 等しくなるべきではない\n" +"True" #: ../../howto/enum.rst:529 msgid "Pickling" @@ -893,23 +1120,25 @@ msgstr "Pickle 化" msgid "Enumerations can be pickled and unpickled::" msgstr "列挙型は pickle 化と unpickle 化が行えます::" -#: ../../howto/enum.rst:533 msgid "" ">>> from test.test_enum import Fruit\n" ">>> from pickle import dumps, loads\n" ">>> Fruit.TOMATO is loads(dumps(Fruit.TOMATO))\n" "True" msgstr "" +">>> from test.test_enum import Fruit\n" +">>> from pickle import dumps, loads\n" +">>> Fruit.TOMATO is loads(dumps(Fruit.TOMATO))\n" +"True" -#: ../../howto/enum.rst:538 msgid "" "The usual restrictions for pickling apply: picklable enums must be defined " "in the top level of a module, since unpickling requires them to be " "importable from that module." msgstr "" -"通常の pickle 化の制限事項が適用されます: pickle 可能な列挙型はモジュールの" -"トップレベルで定義されていなくてはならず、unpickle 化はモジュールからインポー" -"ト可能でなければなりません。" +"通常の pickle 化の制約が適用されます。\n" +"unpickle 化の際にモジュールから列挙型をインポートできる必要があるため、" +"pickle 化する列挙型はモジュールのトップレベルで定義しなければなりません。" #: ../../howto/enum.rst:544 msgid "" @@ -919,19 +1148,24 @@ msgstr "" "pickle プロトコルバージョン 4 では他のクラスで入れ子になった列挙型の pickle " "化も容易です。" -#: ../../howto/enum.rst:547 msgid "" "It is possible to modify how enum members are pickled/unpickled by defining :" "meth:`~object.__reduce_ex__` in the enumeration class. The default method " "is by-value, but enums with complicated values may want to use by-name::" msgstr "" +"列挙型クラスに :meth:`~object.__reduce_ex__` を定義すると、メンバーの pickle " +"化・unpickle 化の方法を変更できます。\n" +"デフォルトでは値を使いますが、値が複雑な列挙型では名前を使う方法が適している" +"場合があります。 ::" -#: ../../howto/enum.rst:551 msgid "" ">>> import enum\n" ">>> class MyEnum(enum.Enum):\n" "... __reduce_ex__ = enum.pickle_by_enum_name" msgstr "" +">>> import enum\n" +">>> class MyEnum(enum.Enum):\n" +"... __reduce_ex__ = enum.pickle_by_enum_name" #: ../../howto/enum.rst:557 msgid "" @@ -951,7 +1185,6 @@ msgid "" msgstr "" ":class:`Enum` クラスは呼び出し可能で、以下の関数 API を提供しています::" -#: ../../howto/enum.rst:566 msgid "" ">>> Animal = Enum('Animal', 'ANT BEE CAT DOG')\n" ">>> Animal\n" @@ -961,6 +1194,13 @@ msgid "" ">>> list(Animal)\n" "[, , , ]" msgstr "" +">>> Animal = Enum('Animal', 'ANT BEE CAT DOG')\n" +">>> Animal\n" +"\n" +">>> Animal.ANT\n" +"\n" +">>> list(Animal)\n" +"[, , , ]" #: ../../howto/enum.rst:574 msgid "" @@ -970,7 +1210,6 @@ msgstr "" "この API の動作は :class:`~collections.namedtuple` と似ています。:class:" "`Enum` 呼び出しの第 1 引数は列挙型の名前です。" -#: ../../howto/enum.rst:577 msgid "" "The second argument is the *source* of enumeration member names. It can be " "a whitespace-separated string of names, a sequence of names, a sequence of 2-" @@ -981,8 +1220,15 @@ msgid "" "class derived from :class:`Enum` is returned. In other words, the above " "assignment to :class:`!Animal` is equivalent to::" msgstr "" +"第 2 引数は列挙型メンバーの名前の *もと* になるものです。\n" +"空白区切りの名前の文字列、名前のシーケンス、キーと値のペアを表す 2 要素タプル" +"のシーケンス、名前を値に対応付ける辞書などのマッピングを指定できます。\n" +"後の 2 つでは、列挙型に任意の値を割り当てられます。\n" +"それ以外では 1 から始まる整数が順に自動で割り当てられます (開始値は " +"``start`` 引数で変更できます)。\n" +":class:`Enum` を継承する新しいクラスが返されます。\n" +"つまり、上記の :class:`!Animal` への代入は次と同じです。 ::" -#: ../../howto/enum.rst:586 msgid "" ">>> class Animal(Enum):\n" "... ANT = 1\n" @@ -991,18 +1237,22 @@ msgid "" "... DOG = 4\n" "..." msgstr "" +">>> class Animal(Enum):\n" +"... ANT = 1\n" +"... BEE = 2\n" +"... CAT = 3\n" +"... DOG = 4\n" +"..." -#: ../../howto/enum.rst:593 msgid "" "The reason for defaulting to ``1`` as the starting number and not ``0`` is " "that ``0`` is ``False`` in a boolean sense, but by default enum members all " "evaluate to ``True``." msgstr "" -"``0`` ではなく``1`` をデフォルトの開始番号とする理由は、``0`` が真偽値として" +"``0`` ではなく ``1`` をデフォルトの開始番号とする理由は、``0`` が真偽値として" "は ``False`` であり、デフォルトの列挙メンバーはすべて ``True`` 評価されるよう" "にするためである。" -#: ../../howto/enum.rst:597 msgid "" "Pickling enums created with the functional API can be tricky as frame stack " "implementation details are used to try and figure out which module the " @@ -1010,44 +1260,45 @@ msgid "" "function in a separate module, and also may not work on IronPython or " "Jython). The solution is to specify the module name explicitly as follows::" msgstr "" -"機能 API による Enum の pickle 化は、その列挙型がどのモジュールで作成されたか" -"を見つけ出すためにフレームスタックの実装の詳細が使われるので、トリッキーにな" -"ることがあります (例えば別のモジュールのユーティリティ関数を使うと失敗します" -"し、IronPython や Jython ではうまくいきません)。解決策は、以下のようにモ" -"ジュール名を明示的に指定することです::" +"関数 API で作った列挙型の pickle 化は、注意が必要な場合があります。\n" +"列挙型が作られたモジュールを特定するために、フレームスタックの実装の詳細を使" +"うためです。\n" +"例えば、別モジュールのユーティリティ関数で作ると失敗し、IronPython や Jython " +"でも動かない可能性があります。\n" +"解決策は、次のようにモジュール名を明示的に指定することです。 ::" -#: ../../howto/enum.rst:603 msgid ">>> Animal = Enum('Animal', 'ANT BEE CAT DOG', module=__name__)" -msgstr "" +msgstr ">>> Animal = Enum('Animal', 'ANT BEE CAT DOG', module=__name__)" -#: ../../howto/enum.rst:607 msgid "" "If ``module`` is not supplied, and Enum cannot determine what it is, the new " "Enum members will not be unpicklable; to keep errors closer to the source, " "pickling will be disabled." msgstr "" -"``module`` が与えられない場合、Enum はそれがなにか決定できないため、新しい " -"Enum メンバーは unpickle 化できなくなります; エラーをソースの近いところで発生" -"させるため、pickle 化は無効になります。" +"``module`` が指定されず、Enum 自身もモジュールを特定できない場合、新しい " +"Enum メンバーは unpickle 化できません。\n" +"問題の発生源に近いところでエラーを出すため、pickle 化も無効になります。" -#: ../../howto/enum.rst:611 msgid "" "The new pickle protocol 4 also, in some circumstances, relies on :attr:" "`~type.__qualname__` being set to the location where pickle will be able to " "find the class. For example, if the class was made available in class " "SomeData in the global scope::" msgstr "" +"新しい pickle プロトコル 4 も、場合によっては、pickle がクラスを見つけられる" +"場所を :attr:`~type.__qualname__` に設定しておく必要があります。\n" +"例えば、グローバルスコープのクラス SomeData の中から、このクラスにアクセスで" +"きる場合は次のようにします。 ::" -#: ../../howto/enum.rst:616 msgid "" ">>> Animal = Enum('Animal', 'ANT BEE CAT DOG', qualname='SomeData.Animal')" msgstr "" +">>> Animal = Enum('Animal', 'ANT BEE CAT DOG', qualname='SomeData.Animal')" #: ../../howto/enum.rst:618 msgid "The complete signature is::" msgstr "完全な構文は以下のようになります::" -#: ../../howto/enum.rst:620 msgid "" "Enum(\n" " value='NewEnumName',\n" @@ -1059,10 +1310,18 @@ msgid "" " start=1,\n" " )" msgstr "" +"Enum(\n" +" value='NewEnumName',\n" +" names=<...>,\n" +" *,\n" +" module='...',\n" +" qualname='...',\n" +" type=,\n" +" start=1,\n" +" )" -#: ../../howto/enum.rst:630 msgid "*value*: What the new enum class will record as its name." -msgstr "" +msgstr "*value*: 新しい列挙型クラスの名前として記録する値。" #: ../../howto/enum.rst:632 msgid "" @@ -1072,41 +1331,36 @@ msgstr "" "*names*: enumのメンバー。 空白またはカンマで区切られた文字列 (値は特に指定が" "ない限り1から始まります)::" -#: ../../howto/enum.rst:635 msgid "'RED GREEN BLUE' | 'RED,GREEN,BLUE' | 'RED, GREEN, BLUE'" -msgstr "" +msgstr "'RED GREEN BLUE' | 'RED,GREEN,BLUE' | 'RED, GREEN, BLUE'" #: ../../howto/enum.rst:637 msgid "or an iterator of names::" msgstr "または名前のイテレータで指定もできます::" -#: ../../howto/enum.rst:639 msgid "['RED', 'GREEN', 'BLUE']" -msgstr "" +msgstr "['RED', 'GREEN', 'BLUE']" #: ../../howto/enum.rst:641 msgid "or an iterator of (name, value) pairs::" msgstr "または (名前, 値) のペアのイテレータでも指定できます::" -#: ../../howto/enum.rst:643 msgid "[('CYAN', 4), ('MAGENTA', 5), ('YELLOW', 6)]" -msgstr "" +msgstr "[('CYAN', 4), ('MAGENTA', 5), ('YELLOW', 6)]" #: ../../howto/enum.rst:645 msgid "or a mapping::" msgstr "またはマッピングでも指定できます::" -#: ../../howto/enum.rst:647 msgid "{'CHARTREUSE': 7, 'SEA_GREEN': 11, 'ROSEMARY': 42}" -msgstr "" +msgstr "{'CHARTREUSE': 7, 'SEA_GREEN': 11, 'ROSEMARY': 42}" #: ../../howto/enum.rst:649 msgid "*module*: name of module where new enum class can be found." msgstr "*module*: 新しい enum クラスが属するモジュールの名前です。" -#: ../../howto/enum.rst:651 msgid "*qualname*: where in module new enum class can be found." -msgstr "*qualname*: 新しい enum クラスが属するモジュールの場所です。" +msgstr "*qualname*: モジュール内で新しい列挙型クラスを見つけられる場所。" #: ../../howto/enum.rst:653 msgid "*type*: type to mix in to new enum class." @@ -1140,7 +1394,6 @@ msgstr "" ":class:`IntEnum` のメンバーは整数と比較できます;\n" "さらに言うと、異なる整数列挙型どうしでも比較できます::" -#: ../../howto/enum.rst:672 msgid "" ">>> from enum import IntEnum\n" ">>> class Shape(IntEnum):\n" @@ -1158,6 +1411,21 @@ msgid "" ">>> Shape.CIRCLE == Request.POST\n" "True" msgstr "" +">>> from enum import IntEnum\n" +">>> class Shape(IntEnum):\n" +"... CIRCLE = 1\n" +"... SQUARE = 2\n" +"...\n" +">>> class Request(IntEnum):\n" +"... POST = 1\n" +"... GET = 2\n" +"...\n" +">>> Shape == 1\n" +"False\n" +">>> Shape.CIRCLE == 1\n" +"True\n" +">>> Shape.CIRCLE == Request.POST\n" +"True" #: ../../howto/enum.rst:688 msgid "" @@ -1165,7 +1433,6 @@ msgid "" "enumerations::" msgstr "ただし、これらも標準の :class:`Enum` 列挙型とは比較できません::" -#: ../../howto/enum.rst:690 msgid "" ">>> class Shape(IntEnum):\n" "... CIRCLE = 1\n" @@ -1178,13 +1445,22 @@ msgid "" ">>> Shape.CIRCLE == Color.RED\n" "False" msgstr "" +">>> class Shape(IntEnum):\n" +"... CIRCLE = 1\n" +"... SQUARE = 2\n" +"...\n" +">>> class Color(Enum):\n" +"... RED = 1\n" +"... GREEN = 2\n" +"...\n" +">>> Shape.CIRCLE == Color.RED\n" +"False" #: ../../howto/enum.rst:701 msgid "" ":class:`IntEnum` values behave like integers in other ways you'd expect::" msgstr ":class:`IntEnum` の値は他の用途では整数のように振る舞います::" -#: ../../howto/enum.rst:703 msgid "" ">>> int(Shape.CIRCLE)\n" "1\n" @@ -1193,6 +1469,12 @@ msgid "" ">>> [i for i in range(Shape.SQUARE)]\n" "[0, 1]" msgstr "" +">>> int(Shape.CIRCLE)\n" +"1\n" +">>> ['a', 'b', 'c'][Shape.CIRCLE]\n" +"'b'\n" +">>> [i for i in range(Shape.SQUARE)]\n" +"[0, 1]" #: ../../howto/enum.rst:712 msgid "StrEnum" @@ -1213,7 +1495,6 @@ msgstr "" msgid "IntFlag" msgstr "IntFlag" -#: ../../howto/enum.rst:725 msgid "" "The next variation of :class:`Enum` provided, :class:`IntFlag`, is also " "based on :class:`int`. The difference being :class:`IntFlag` members can be " @@ -1222,12 +1503,12 @@ msgid "" "`IntFlag` members are also integers and can be used wherever an :class:`int` " "is used." msgstr "" -"次の :class:`Enum` の派生型 :class:`IntFlag` も、:class:`int` を基底クラスと" -"しています。\n" -"違いは、 :class:`IntFlag` のメンバーをビット演算子 (&, \\|, ^, ~) を使っ" -"て組み合わせられ、その結果も :class:`IntFlag` メンバーになることです。 :" -"class:`IntEnum` と同様、:class:`IntFlag` のメンバーも整数であり、:class:" -"`int` が使用されるところであればどこでも使えます。" +"次の :class:`Enum` の派生型 :class:`IntFlag` も、:class:`int` を基底としてい" +"ます。\n" +"違いは、:class:`IntFlag` のメンバーをビット演算子 (&, \\|, ^, ~) で組み合わせ" +"ることができ、可能であれば結果も :class:`IntFlag` のメンバーになる点です。\n" +":class:`IntEnum` と同様に、:class:`IntFlag` のメンバーも整数なので、:class:" +"`int` を使える場所ならどこでも使えます。" #: ../../howto/enum.rst:733 msgid "" @@ -1250,7 +1531,6 @@ msgstr "" msgid "Sample :class:`IntFlag` class::" msgstr ":class:`IntFlag` クラスの例::" -#: ../../howto/enum.rst:745 msgid "" ">>> from enum import IntFlag\n" ">>> class Perm(IntFlag):\n" @@ -1266,12 +1546,24 @@ msgid "" ">>> Perm.R in RW\n" "True" msgstr "" +">>> from enum import IntFlag\n" +">>> class Perm(IntFlag):\n" +"... R = 4\n" +"... W = 2\n" +"... X = 1\n" +"...\n" +">>> Perm.R | Perm.W\n" +"\n" +">>> Perm.R + Perm.W\n" +"6\n" +">>> RW = Perm.R | Perm.W\n" +">>> Perm.R in RW\n" +"True" #: ../../howto/enum.rst:759 msgid "It is also possible to name the combinations::" msgstr "組み合わせにも名前を付けられます::" -#: ../../howto/enum.rst:761 msgid "" ">>> class Perm(IntFlag):\n" "... R = 4\n" @@ -1286,6 +1578,18 @@ msgid "" ">>> Perm(7)\n" "" msgstr "" +">>> class Perm(IntFlag):\n" +"... R = 4\n" +"... W = 2\n" +"... X = 1\n" +"... RWX = 7\n" +"...\n" +">>> Perm.RWX\n" +"\n" +">>> ~Perm.RWX\n" +"\n" +">>> Perm(7)\n" +"" #: ../../howto/enum.rst:776 msgid "" @@ -1305,13 +1609,16 @@ msgstr "" "ていない (値が0である) 場合、その真偽値としての評価は :data:`False` になるこ" "とです::" -#: ../../howto/enum.rst:784 msgid "" ">>> Perm.R & Perm.X\n" "\n" ">>> bool(Perm.R & Perm.X)\n" "False" msgstr "" +">>> Perm.R & Perm.X\n" +"\n" +">>> bool(Perm.R & Perm.X)\n" +"False" #: ../../howto/enum.rst:789 msgid "" @@ -1322,7 +1629,6 @@ msgstr "" "合わせることができます(ただし、 :class:`IntFlag` 型ではなくなる可能性があり" "ます)::" -#: ../../howto/enum.rst:792 msgid "" ">>> Perm.X | 4\n" "\n" @@ -1330,6 +1636,11 @@ msgid "" ">>> Perm.X + 8\n" "9" msgstr "" +">>> Perm.X | 4\n" +"\n" +"\n" +">>> Perm.X + 8\n" +"9" #: ../../howto/enum.rst:800 msgid "" @@ -1338,21 +1649,23 @@ msgid "" msgstr "" "否定の演算子 ``~`` は、常に正の値を持つ :class:`IntFlag` メンバー を返す::" -#: ../../howto/enum.rst:803 msgid "" ">>> (~Perm.X).value == (Perm.R|Perm.W).value == 6\n" "True" msgstr "" +">>> (~Perm.X).value == (Perm.R|Perm.W).value == 6\n" +"True" #: ../../howto/enum.rst:806 msgid ":class:`IntFlag` members can also be iterated over::" msgstr ":class:`IntFlag` メンバーは反復処理することもできます::" -#: ../../howto/enum.rst:808 msgid "" ">>> list(RW)\n" "[, ]" msgstr "" +">>> list(RW)\n" +"[, ]" #: ../../howto/enum.rst:815 msgid "Flag" @@ -1384,7 +1697,6 @@ msgstr "" "設定されていない状態になった場合、その真偽値としての評価は :data:`False` とな" "ります::" -#: ../../howto/enum.rst:829 msgid "" ">>> from enum import Flag, auto\n" ">>> class Color(Flag):\n" @@ -1397,6 +1709,16 @@ msgid "" ">>> bool(Color.RED & Color.GREEN)\n" "False" msgstr "" +">>> from enum import Flag, auto\n" +">>> class Color(Flag):\n" +"... RED = auto()\n" +"... BLUE = auto()\n" +"... GREEN = auto()\n" +"...\n" +">>> Color.RED & Color.GREEN\n" +"\n" +">>> bool(Color.RED & Color.GREEN)\n" +"False" #: ../../howto/enum.rst:840 msgid "" @@ -1406,7 +1728,6 @@ msgstr "" "個別のフラグは 2 のべき乗 (1, 2, 4, 8, ...) の値を持つべきですが、フラグの組" "み合わせはそうはなりません::" -#: ../../howto/enum.rst:843 msgid "" ">>> class Color(Flag):\n" "... RED = auto()\n" @@ -1417,16 +1738,34 @@ msgid "" ">>> Color.WHITE\n" "" msgstr "" +">>> class Color(Flag):\n" +"... RED = auto()\n" +"... BLUE = auto()\n" +"... GREEN = auto()\n" +"... WHITE = RED | BLUE | GREEN\n" +"...\n" +">>> Color.WHITE\n" +"" #: ../../howto/enum.rst:852 msgid "" "Giving a name to the \"no flags set\" condition does not change its boolean " "value::" msgstr "" -"\"フラグが設定されていない\" 状態に名前を付けても、その真偽値は変わりません::" - -#: ../../howto/enum.rst:855 -msgid "" +"\"フラグが設定されていない\" 状態に名前を付けても、その真偽値は変わりません::" + +msgid "" +">>> class Color(Flag):\n" +"... BLACK = 0\n" +"... RED = auto()\n" +"... BLUE = auto()\n" +"... GREEN = auto()\n" +"...\n" +">>> Color.BLACK\n" +"\n" +">>> bool(Color.BLACK)\n" +"False" +msgstr "" ">>> class Color(Flag):\n" "... BLACK = 0\n" "... RED = auto()\n" @@ -1437,18 +1776,19 @@ msgid "" "\n" ">>> bool(Color.BLACK)\n" "False" -msgstr "" #: ../../howto/enum.rst:866 msgid ":class:`Flag` members can also be iterated over::" msgstr ":class:`Flag` メンバーは反復処理することもできます::" -#: ../../howto/enum.rst:868 msgid "" ">>> purple = Color.RED | Color.BLUE\n" ">>> list(purple)\n" "[, ]" msgstr "" +">>> purple = Color.RED | Color.BLUE\n" +">>> list(purple)\n" +"[, ]" #: ../../howto/enum.rst:876 msgid "" @@ -1482,22 +1822,24 @@ msgstr "" ":class:`IntEnum` は :mod:`enum` モジュールの一部ですが、単独での実装もとても" "簡単に行なえます::" -#: ../../howto/enum.rst:891 msgid "" "class IntEnum(int, ReprEnum): # or Enum instead of ReprEnum\n" " pass" msgstr "" +"class IntEnum(int, ReprEnum): # ReprEnum の代わりに Enum でもよい\n" +" pass" -#: ../../howto/enum.rst:894 msgid "" "This demonstrates how similar derived enumerations can be defined; for " "example a :class:`!FloatEnum` that mixes in :class:`float` instead of :class:" "`int`." msgstr "" +"このようにして、同様の派生列挙型を定義できます。\n" +"例えば、:class:`int` の代わりに :class:`float` をミックスインする :class:`!" +"FloatEnum` も作れます。" -#: ../../howto/enum.rst:897 msgid "Some rules:" -msgstr "いくつかのルール:" +msgstr "Some rules:" #: ../../howto/enum.rst:899 msgid "" @@ -1531,18 +1873,21 @@ msgstr "" "データ型でなければならなくなります。この制限は、メソッドの追加するだけの、他" "のデータ型を指定しない複合には適用されません。" -#: ../../howto/enum.rst:909 msgid "" "When another data type is mixed in, the :attr:`~Enum.value` attribute is " "*not the same* as the enum member itself, although it is equivalent and will " "compare equal." msgstr "" +"別のデータ型をミックスインした場合、:attr:`~Enum.value` 属性は列挙型メンバー" +"自身とは *同一ではありません*。\n" +"ただし、同等の値であり、等価比較では等しいと判定されます。" -#: ../../howto/enum.rst:912 msgid "" "A ``data type`` is a mixin that defines :meth:`~object.__new__`, or a :class:" "`~dataclasses.dataclass`" msgstr "" +"ここでいう ``データ型`` は、:meth:`~object.__new__` を定義するミックスイン、" +"または :class:`~dataclasses.dataclass` です。" #: ../../howto/enum.rst:914 msgid "" @@ -1552,31 +1897,36 @@ msgid "" "type." msgstr "" -#: ../../howto/enum.rst:917 msgid "" ":ref:`Formatted string literals `, :meth:`str.format`, and :func:" "`format` will use the enum's :meth:`~object.__str__` method." msgstr "" +":ref:`フォーマット済み文字列リテラル `、:meth:`str.format`、:func:" +"`format` は、列挙型の :meth:`~object.__str__` メソッドを使います。" -#: ../../howto/enum.rst:922 msgid "" "Because :class:`IntEnum`, :class:`IntFlag`, and :class:`StrEnum` are " "designed to be drop-in replacements for existing constants, their :meth:" "`~object.__str__` method has been reset to their data types' :meth:`~object." "__str__` method." msgstr "" +":class:`IntEnum`、:class:`IntFlag`、:class:`StrEnum` は既存の定数をそのまま置" +"き換えられるように設計されているため、:meth:`~object.__str__` メソッドは、そ" +"れぞれのデータ型の :meth:`~object.__str__` に設定し直されています。" -#: ../../howto/enum.rst:930 msgid "When to use :meth:`~object.__new__` vs. :meth:`~object.__init__`" -msgstr "" +msgstr ":meth:`~object.__new__` と :meth:`~object.__init__` の使い分け" -#: ../../howto/enum.rst:932 msgid "" ":meth:`~object.__new__` must be used whenever you want to customize the " "actual value of the :class:`Enum` member. Any other modifications may go in " "either :meth:`~object.__new__` or :meth:`~object.__init__`, with :meth:" "`~object.__init__` being preferred." msgstr "" +":class:`Enum` メンバーの実際の値をカスタマイズする場合は、:meth:`~object." +"__new__` を使わなければなりません。\n" +"それ以外の変更は :meth:`~object.__new__` と :meth:`~object.__init__` のどちら" +"でも行えますが、:meth:`~object.__init__` を使うほうが望ましいです。" #: ../../howto/enum.rst:936 msgid "" @@ -1586,7 +1936,6 @@ msgstr "" "例えば、複数の値をコンストラクタに渡すが、その中の1つだけを値として使いたい場" "合は次のようにします:" -#: ../../howto/enum.rst:939 msgid "" ">>> class Coordinate(bytes, Enum):\n" "... \"\"\"\n" @@ -1610,12 +1959,35 @@ msgid "" ">>> print(Coordinate(3))\n" "Coordinate.VY" msgstr "" +">>> class Coordinate(bytes, Enum):\n" +"... \"\"\"\n" +"... 整数のコードで検索できる、バイナリコード付きの座標。\n" +"... \"\"\"\n" +"... def __new__(cls, value, label, unit):\n" +"... obj = bytes.__new__(cls, [value])\n" +"... obj._value_ = value\n" +"... obj.label = label\n" +"... obj.unit = unit\n" +"... return obj\n" +"... PX = (0, 'P.X', 'km')\n" +"... PY = (1, 'P.Y', 'km')\n" +"... VX = (2, 'V.X', 'km/s')\n" +"... VY = (3, 'V.Y', 'km/s')\n" +"...\n" +"\n" +">>> print(Coordinate['PY'])\n" +"Coordinate.PY\n" +"\n" +">>> print(Coordinate(3))\n" +"Coordinate.VY" -#: ../../howto/enum.rst:963 msgid "" "*Do not* call ``super().__new__()``, as the lookup-only ``__new__`` is the " "one that is found; instead, use the data type directly." msgstr "" +"``super().__new__()`` は *呼び出さないでください*。\n" +"検索専用の ``__new__`` が見つかるためです。\n" +"代わりに、データ型を直接使ってください。" #: ../../howto/enum.rst:968 msgid "Finer Points" @@ -1651,13 +2023,12 @@ msgstr ":attr:`~Enum._name_` -- メンバー名" msgid ":attr:`~Enum._value_` -- value of the member; can be set in ``__new__``" msgstr ":attr:`~Enum._value_` -- メンバーの値; ``__new__`` で設定できます" -#: ../../howto/enum.rst:986 msgid "" ":meth:`~Enum._missing_` -- a lookup function used when a value is not found; " "may be overridden" msgstr "" ":meth:`~Enum._missing_` -- 値が見付からなかったときに使われる検索関数; オー" -"バーライドされていることがあります" +"バーライドできます" #: ../../howto/enum.rst:988 msgid "" @@ -1669,13 +2040,13 @@ msgstr "" "`str` です。この名前の要素はメンバーへの変換が行われず、最終的なクラスから削" "除されます。" -#: ../../howto/enum.rst:991 msgid "" ":meth:`~Enum._generate_next_value_` -- used to get an appropriate value for " "an enum member; may be overridden" msgstr "" ":meth:`~Enum._generate_next_value_` -- 列挙型のメンバーの適切な値を取得するの" -"に使われます。オーバーライドされます。" +"に使われます。\n" +"オーバーライドできます。" #: ../../howto/enum.rst:993 msgid "" @@ -1744,11 +2115,12 @@ msgid "" " ['RED', 'GREEN', 'BLUE']" msgstr "" -#: ../../howto/enum.rst:1031 msgid "" "In Python 2 code the :attr:`~Enum._order_` attribute is necessary as " "definition order is lost before it can be recorded." msgstr "" +"Python 2 では、記録する前に定義の順序が失われるため、:attr:`~Enum._order_` 属" +"性が必要です。" #: ../../howto/enum.rst:1036 msgid "_Private__names" @@ -1766,7 +2138,6 @@ msgstr "" msgid "``Enum`` member type" msgstr "``Enum`` メンバー型" -#: ../../howto/enum.rst:1047 msgid "" "Enum members are instances of their enum class, and are normally accessed as " "``EnumClass.member``. In certain situations, such as writing custom enum " @@ -1775,26 +2146,25 @@ msgid "" "names and attributes/methods from mixed-in classes, upper-case names are " "strongly recommended." msgstr "" -"列挙型メンバーはその列挙型クラスのインスタンスであり、通常は ``EnumClass." -"member`` としてアクセスされます。 振る舞い メンバー しかし、メンバー の名前" -"と、属性/methodsが混在しているクラスとの名前の衝突を避けるために、大文字の名" -"前を使うことを強く推奨します。" +"列挙型のメンバーは、その列挙型クラスのインスタンスであり、通常は ``EnumClass." +"member`` としてアクセスします。\n" +"列挙型の独自の動作を書く場合などには、あるメンバーから別のメンバーへ直接アク" +"セスできると便利であり、この使い方もサポートされています。\n" +"ただし、メンバー名とミックスインしたクラスの属性やメソッド名との衝突を避ける" +"ため、メンバー名には大文字を使うことを強く推奨します。" -#: ../../howto/enum.rst:1058 msgid "Creating members that are mixed with other data types" -msgstr "" +msgstr "ほかのデータ型と組み合わせたメンバーを作る" -#: ../../howto/enum.rst:1060 msgid "" "When subclassing other data types, such as :class:`int` or :class:`str`, " "with an :class:`Enum`, all values after the ``=`` are passed to that data " "type's constructor. For example::" msgstr "" -" :class:`int` や:class:`str` などの他のデータ型と :class:`Enum` のサブクラス" +" :class:`int` や :class:`str` などの他のデータ型と :class:`Enum` のサブクラス" "では、 ``=`` 以降の値はすべて、そのデータ型のコンストラクタに渡される。 例え" "ば::" -#: ../../howto/enum.rst:1064 msgid "" ">>> class MyEnum(IntEnum): # help(int) -> int(x, base=10) -> integer\n" "... example = '11', 16 # so x='11' and base=16\n" @@ -1802,6 +2172,11 @@ msgid "" ">>> MyEnum.example.value # and hex(11) is...\n" "17" msgstr "" +">>> class MyEnum(IntEnum): # help(int) -> int(x, base=10) -> integer\n" +"... example = '11', 16 # つまり x='11'、base=16\n" +"...\n" +">>> MyEnum.example.value # 16 進数の 11 は...\n" +"17" #: ../../howto/enum.rst:1072 msgid "Boolean value of ``Enum`` classes and members" @@ -1821,11 +2196,12 @@ msgstr "" "メンバーの値に依存する独自の enum の真偽値評価を行うには、クラスに次のコード" "を追加してください::" -#: ../../howto/enum.rst:1080 msgid "" "def __bool__(self):\n" " return bool(self.value)" msgstr "" +"def __bool__(self):\n" +" return bool(self.value)" #: ../../howto/enum.rst:1083 msgid "Plain :class:`Enum` classes always evaluate as :data:`True`." @@ -1842,10 +2218,9 @@ msgid "" "the class::" msgstr "" "enum サブクラスに追加のメソッドを与えた場合、後述の `Planet`_ クラスのよう" -"に、そのメソッドはメンバーの :func:`dir` に表示されますが、クラスの :func:" -"`dir` には表示されません::" +"に、そのメソッドはメンバーの :func:`dir` に表示されますが、クラスの " +"``dir()`` には表示されません::" -#: ../../howto/enum.rst:1093 msgid "" ">>> dir(Planet)\n" "['EARTH', 'JUPITER', 'MARS', 'MERCURY', 'NEPTUNE', 'SATURN', 'URANUS', " @@ -1854,18 +2229,24 @@ msgid "" "['__class__', '__doc__', '__module__', 'mass', 'name', 'radius', " "'surface_gravity', 'value']" msgstr "" +">>> dir(Planet)\n" +"['EARTH', 'JUPITER', 'MARS', 'MERCURY', 'NEPTUNE', 'SATURN', 'URANUS', " +"'VENUS', '__class__', '__doc__', '__members__', '__module__']\n" +">>> dir(Planet.EARTH)\n" +"['__class__', '__doc__', '__module__', 'mass', 'name', 'radius', " +"'surface_gravity', 'value']" #: ../../howto/enum.rst:1100 msgid "Combining members of ``Flag``" msgstr "``Flag`` のメンバーの組み合わせ" -#: ../../howto/enum.rst:1102 msgid "" "Iterating over a combination of :class:`Flag` members will only return the " "members that are comprised of a single bit::" msgstr "" +":class:`Flag` メンバーの組み合わせをイテレートすると、単一ビットで構成される" +"メンバーだけが返されます。 ::" -#: ../../howto/enum.rst:1105 msgid "" ">>> class Color(Flag):\n" "... RED = auto()\n" @@ -1880,16 +2261,26 @@ msgid "" ">>> Color(7) # not named combination\n" "" msgstr "" +">>> class Color(Flag):\n" +"... RED = auto()\n" +"... GREEN = auto()\n" +"... BLUE = auto()\n" +"... MAGENTA = RED | BLUE\n" +"... YELLOW = RED | GREEN\n" +"... CYAN = GREEN | BLUE\n" +"...\n" +">>> Color(3) # 名前付きの組み合わせ\n" +"\n" +">>> Color(7) # 名前のない組み合わせ\n" +"" -#: ../../howto/enum.rst:1120 msgid "``Flag`` and ``IntFlag`` minutia" -msgstr "" +msgstr "``Flag`` と ``IntFlag`` の細部" #: ../../howto/enum.rst:1122 msgid "Using the following snippet for our examples::" msgstr "例として以下のスニペットを使用します::" -#: ../../howto/enum.rst:1124 msgid "" ">>> class Color(IntFlag):\n" "... BLACK = 0\n" @@ -1900,10 +2291,17 @@ msgid "" "... WHITE = RED | GREEN | BLUE\n" "..." msgstr "" +">>> class Color(IntFlag):\n" +"... BLACK = 0\n" +"... RED = 1\n" +"... GREEN = 2\n" +"... BLUE = 4\n" +"... PURPLE = RED | BLUE\n" +"... WHITE = RED | GREEN | BLUE\n" +"..." -#: ../../howto/enum.rst:1133 msgid "the following are true:" -msgstr "" +msgstr "次のことが成り立ちます。" #: ../../howto/enum.rst:1135 msgid "single-bit flags are canonical" @@ -1917,11 +2315,12 @@ msgstr "複数ビットや0ビットのフラグはエイリアスです" msgid "only canonical flags are returned during iteration::" msgstr "反復処理では正規形のフラグのみ返却されます::" -#: ../../howto/enum.rst:1139 msgid "" ">>> list(Color.WHITE)\n" "[, , ]" msgstr "" +">>> list(Color.WHITE)\n" +"[, , ]" #: ../../howto/enum.rst:1142 msgid "" @@ -1929,7 +2328,6 @@ msgid "" "corresponding positive integer value::" msgstr "" -#: ../../howto/enum.rst:1145 msgid "" ">>> Color.BLUE\n" "\n" @@ -1937,12 +2335,16 @@ msgid "" ">>> ~Color.BLUE\n" "" msgstr "" +">>> Color.BLUE\n" +"\n" +"\n" +">>> ~Color.BLUE\n" +"" #: ../../howto/enum.rst:1151 msgid "names of pseudo-flags are constructed from their members' names::" msgstr "名前のないフラグについては、そのメンバーの名前から名前が生成されます::" -#: ../../howto/enum.rst:1153 msgid "" ">>> (Color.RED | Color.GREEN).name\n" "'RED|GREEN'\n" @@ -1955,12 +2357,21 @@ msgid "" ">>> (Perm.R & Perm.W).name is None # effectively Perm(0)\n" "True" msgstr "" +">>> (Color.RED | Color.GREEN).name\n" +"'RED|GREEN'\n" +"\n" +">>> class Perm(IntFlag):\n" +"... R = 4\n" +"... W = 2\n" +"... X = 1\n" +"...\n" +">>> (Perm.R & Perm.W).name is None # 実質的には Perm(0)\n" +"True" -#: ../../howto/enum.rst:1164 msgid "multi-bit flags, aka aliases, can be returned from operations::" msgstr "" +"演算の結果として、複数ビットのフラグ、つまり別名が返されることもあります。 ::" -#: ../../howto/enum.rst:1166 msgid "" ">>> Color.RED | Color.BLUE\n" "\n" @@ -1971,6 +2382,14 @@ msgid "" ">>> Color(0)\n" "" msgstr "" +">>> Color.RED | Color.BLUE\n" +"\n" +"\n" +">>> Color(7) # または Color(-1)\n" +"\n" +"\n" +">>> Color(0)\n" +"" #: ../../howto/enum.rst:1175 msgid "" @@ -1980,11 +2399,12 @@ msgstr "" "メンバーシップ/包含 のチェックでは、値が0のフラグは常に含まれるものとして扱わ" "れます::" -#: ../../howto/enum.rst:1178 msgid "" ">>> Color.BLACK in Color.WHITE\n" "True" msgstr "" +">>> Color.BLACK in Color.WHITE\n" +"True" #: ../../howto/enum.rst:1181 msgid "" @@ -1994,7 +2414,6 @@ msgstr "" "それ以外では、一方のフラグの全ビットが他方のフラグに含まれる場合のみ、Trueが" "返されます::" -#: ../../howto/enum.rst:1184 msgid "" ">>> Color.PURPLE in Color.WHITE\n" "True\n" @@ -2002,12 +2421,19 @@ msgid "" ">>> Color.GREEN in Color.PURPLE\n" "False" msgstr "" +">>> Color.PURPLE in Color.WHITE\n" +"True\n" +"\n" +">>> Color.GREEN in Color.PURPLE\n" +"False" -#: ../../howto/enum.rst:1190 msgid "" "There is a new boundary mechanism that controls how out-of-range / invalid " "bits are handled: ``STRICT``, ``CONFORM``, ``EJECT``, and ``KEEP``:" msgstr "" +"範囲外のビットや無効なビットをどう扱うかを制御する、新しい境界の仕組みがあり" +"ます。\n" +"``STRICT``、``CONFORM``、``EJECT``、``KEEP`` の 4 つです。" #: ../../howto/enum.rst:1193 msgid "STRICT --> raises an exception when presented with invalid values" @@ -2022,21 +2448,17 @@ msgid "EJECT --> lose Flag status and become a normal int with the given value" msgstr "" "EJECT --> フラグのステータスを失い、指定された値を持つ通常の int となります。" -#: ../../howto/enum.rst:1196 msgid "KEEP --> keep the extra bits" -msgstr "" +msgstr "KEEP --> 余分なビットを保持する" -#: ../../howto/enum.rst:1198 msgid "keeps Flag status and extra bits" -msgstr "" +msgstr "Flag としての型と余分なビットを保持します。" -#: ../../howto/enum.rst:1199 msgid "extra bits do not show up in iteration" -msgstr "" +msgstr "余分なビットはイテレーションには現れません。" -#: ../../howto/enum.rst:1200 msgid "extra bits do show up in repr() and str()" -msgstr "" +msgstr "余分なビットは repr() と str() の結果には現れます。" #: ../../howto/enum.rst:1202 msgid "" @@ -2061,7 +2483,6 @@ msgstr "" msgid "Enum Classes" msgstr "Enum クラス" -#: ../../howto/enum.rst:1219 msgid "" "The :class:`EnumType` metaclass is responsible for providing the :meth:" "`~object.__contains__`, :meth:`~object.__dir__`, :meth:`~object.__iter__` " @@ -2072,12 +2493,18 @@ msgid "" "__new__`, :meth:`~object.__getnewargs__`, :meth:`~object.__str__` and :meth:" "`~object.__repr__`)." msgstr "" +"メタクラス :class:`EnumType` は、:meth:`~object.__contains__`、:meth:" +"`~object.__dir__`、:meth:`~object.__iter__` などのメソッドを提供します。\n" +"これにより、通常のクラスでは失敗する ``list(Color)`` や ``some_enum_var in " +"Color`` のような操作を、:class:`Enum` クラスで行えるようになります。\n" +":class:`EnumType` はまた、作成される :class:`Enum` クラスの :meth:`~object." +"__new__`、:meth:`~object.__getnewargs__`、:meth:`~object.__str__`、:meth:" +"`~object.__repr__` などの各メソッドが適切なものになるようにします。" #: ../../howto/enum.rst:1228 msgid "Flag Classes" msgstr "Flag クラス" -#: ../../howto/enum.rst:1230 msgid "" "Flags have an expanded view of aliasing: to be canonical, the value of a " "flag needs to be a power-of-two value, and not a duplicate name. So, in " @@ -2085,12 +2512,17 @@ msgid "" "a. ``0``) or with more than one power-of-two value (e.g. ``3``) is " "considered an alias." msgstr "" +"フラグでは、別名の意味が拡張されています。\n" +"正規のフラグであるには、値が 2 の累乗であり、ほかのメンバーの別名でないことが" +"必要です。\n" +"そのため、:class:`Enum` で別名となるものに加えて、値を持たないフラグ (つまり " +"``0``) や、複数の 2 の累乗の値を組み合わせたフラグ (例えば ``3``) も別名とみ" +"なされます。" #: ../../howto/enum.rst:1236 msgid "Enum Members (aka instances)" msgstr "Enum メンバー (インスタンス)" -#: ../../howto/enum.rst:1238 msgid "" "The most interesting thing about enum members is that they are singletons. :" "class:`EnumType` creates them all while it is creating the enum class " @@ -2098,6 +2530,11 @@ msgid "" "that no new ones are ever instantiated by returning only the existing member " "instances." msgstr "" +"列挙型メンバーの最も興味深い点は、シングルトンであることです。\n" +":class:`EnumType` は列挙型クラスそのものを作る際に、すべてのメンバーを作りま" +"す。\n" +"その後、既存のメンバーインスタンスだけを返す独自の :meth:`~object.__new__` を" +"設定し、新しいインスタンスが作られないようにします。" #: ../../howto/enum.rst:1244 msgid "Flag Members" @@ -2111,11 +2548,12 @@ msgstr "" "フラグのメンバーは、:class:`Flag` クラスと同様に反復処理することができ、正規" "のメンバーのみが返されます。 例えば::" -#: ../../howto/enum.rst:1249 msgid "" ">>> list(Color)\n" "[, , ]" msgstr "" +">>> list(Color)\n" +"[, , ]" #: ../../howto/enum.rst:1252 msgid "(Note that ``BLACK``, ``PURPLE``, and ``WHITE`` do not show up.)" @@ -2128,11 +2566,12 @@ msgid "" msgstr "" "フラグのメンバーを反転させると、負の値ではなく、対応する正の値が返されます::" -#: ../../howto/enum.rst:1257 msgid "" ">>> ~Color.RED\n" "" msgstr "" +">>> ~Color.RED\n" +"" #: ../../howto/enum.rst:1260 msgid "" @@ -2142,11 +2581,12 @@ msgstr "" "フラグのメンバーは、それが含む2のべき乗の値の数に対応するlengthを持ちます。 " "例えば::" -#: ../../howto/enum.rst:1263 msgid "" ">>> len(Color.PURPLE)\n" "2" msgstr "" +">>> len(Color.PURPLE)\n" +"2" #: ../../howto/enum.rst:1270 msgid "Enum Cookbook" @@ -2188,11 +2628,12 @@ msgstr "値として :class:`object` インスタンスを使用する" msgid "use a descriptive string as the value" msgstr "値として解説文字列を使用する" -#: ../../howto/enum.rst:1288 msgid "" "use a tuple as the value and a custom :meth:`~object.__new__` to replace the " "tuple with an :class:`int` value" msgstr "" +"値にタプルを使い、独自の :meth:`~object.__new__` でタプルを :class:`int` の値" +"に置き換える" #: ../../howto/enum.rst:1291 msgid "" @@ -2212,7 +2653,6 @@ msgstr ":class:`auto` を使う" msgid "Using :class:`auto` would look like::" msgstr ":class:`auto` を使うと次のようになります::" -#: ../../howto/enum.rst:1301 msgid "" ">>> class Color(Enum):\n" "... RED = auto()\n" @@ -2222,6 +2662,13 @@ msgid "" ">>> Color.GREEN\n" "" msgstr "" +">>> class Color(Enum):\n" +"... RED = auto()\n" +"... BLUE = auto()\n" +"... GREEN = auto()\n" +"...\n" +">>> Color.GREEN\n" +"" #: ../../howto/enum.rst:1311 msgid "Using :class:`object`" @@ -2231,7 +2678,6 @@ msgstr ":class:`object` を使う" msgid "Using :class:`object` would look like::" msgstr ":class:`object` を使うと次のようになります::" -#: ../../howto/enum.rst:1315 msgid "" ">>> class Color(Enum):\n" "... RED = object()\n" @@ -2241,14 +2687,21 @@ msgid "" ">>> Color.GREEN\n" ">" msgstr "" +">>> class Color(Enum):\n" +"... RED = object()\n" +"... GREEN = object()\n" +"... BLUE = object()\n" +"...\n" +">>> Color.GREEN\n" +">" -#: ../../howto/enum.rst:1323 msgid "" "This is also a good example of why you might want to write your own :meth:" "`~object.__repr__`::" msgstr "" +"この例は、独自の :meth:`~object.__repr__` を書きたくなる理由もよく示していま" +"す。 ::" -#: ../../howto/enum.rst:1326 msgid "" ">>> class Color(Enum):\n" "... RED = object()\n" @@ -2260,6 +2713,15 @@ msgid "" ">>> Color.GREEN\n" "" msgstr "" +">>> class Color(Enum):\n" +"... RED = object()\n" +"... GREEN = object()\n" +"... BLUE = object()\n" +"... def __repr__(self):\n" +"... return \"<%s.%s>\" % (self.__class__.__name__, self._name_)\n" +"...\n" +">>> Color.GREEN\n" +"" #: ../../howto/enum.rst:1339 msgid "Using a descriptive string" @@ -2269,7 +2731,6 @@ msgstr "解説文字列を使う" msgid "Using a string as the value would look like::" msgstr "値として文字列を使うと次のようになります::" -#: ../../howto/enum.rst:1343 msgid "" ">>> class Color(Enum):\n" "... RED = 'stop'\n" @@ -2279,16 +2740,20 @@ msgid "" ">>> Color.GREEN\n" "" msgstr "" +">>> class Color(Enum):\n" +"... RED = 'stop'\n" +"... GREEN = 'go'\n" +"... BLUE = 'too fast!'\n" +"...\n" +">>> Color.GREEN\n" +"" -#: ../../howto/enum.rst:1353 msgid "Using a custom :meth:`~object.__new__`" -msgstr "" +msgstr "独自の :meth:`~object.__new__` を使う" -#: ../../howto/enum.rst:1355 msgid "Using an auto-numbering :meth:`~object.__new__` would look like::" -msgstr "" +msgstr "自動採番する :meth:`~object.__new__` を使うと、次のようになります。 ::" -#: ../../howto/enum.rst:1357 msgid "" ">>> class AutoNumber(Enum):\n" "... def __new__(cls):\n" @@ -2305,6 +2770,20 @@ msgid "" ">>> Color.GREEN\n" "" msgstr "" +">>> class AutoNumber(Enum):\n" +"... def __new__(cls):\n" +"... value = len(cls.__members__) + 1\n" +"... obj = object.__new__(cls)\n" +"... obj._value_ = value\n" +"... return obj\n" +"...\n" +">>> class Color(AutoNumber):\n" +"... RED = ()\n" +"... GREEN = ()\n" +"... BLUE = ()\n" +"...\n" +">>> Color.GREEN\n" +"" #: ../../howto/enum.rst:1372 msgid "" @@ -2314,7 +2793,6 @@ msgstr "" "``AutoNumber`` をより広い用途で使うには、シグニチャに ``*args`` を追加しま" "す::" -#: ../../howto/enum.rst:1374 msgid "" ">>> class AutoNumber(Enum):\n" "... def __new__(cls, *args): # this is the only change from above\n" @@ -2324,6 +2802,13 @@ msgid "" "... return obj\n" "..." msgstr "" +">>> class AutoNumber(Enum):\n" +"... def __new__(cls, *args): # 上の例からの変更はここだけ\n" +"... value = len(cls.__members__) + 1\n" +"... obj = object.__new__(cls)\n" +"... obj._value_ = value\n" +"... return obj\n" +"..." #: ../../howto/enum.rst:1382 msgid "" @@ -2333,7 +2818,6 @@ msgstr "" "``AutoNumber`` を継承すると、追加の引数を取り扱える独自の ``__init__`` が書け" "ます。" -#: ../../howto/enum.rst:1385 msgid "" ">>> class Swatch(AutoNumber):\n" "... def __init__(self, pantone='unknown'):\n" @@ -2349,23 +2833,40 @@ msgid "" ">>> Swatch.BLEACHED_CORAL.pantone\n" "'unknown'" msgstr "" +">>> class Swatch(AutoNumber):\n" +"... def __init__(self, pantone='unknown'):\n" +"... self.pantone = pantone\n" +"... AUBURN = '3497'\n" +"... SEA_GREEN = '1246'\n" +"... BLEACHED_CORAL = () # 新色なので、まだ Pantone コードはない!\n" +"...\n" +">>> Swatch.SEA_GREEN\n" +"\n" +">>> Swatch.SEA_GREEN.pantone\n" +"'1246'\n" +">>> Swatch.BLEACHED_CORAL.pantone\n" +"'unknown'" -#: ../../howto/enum.rst:1401 msgid "" "The :meth:`~object.__new__` method, if defined, is used during creation of " "the Enum members; it is then replaced by Enum's :meth:`~object.__new__` " "which is used after class creation for lookup of existing members." msgstr "" +":meth:`~object.__new__` を定義した場合、そのメソッドは Enum メンバーの作成時" +"に使われます。\n" +"その後は Enum の :meth:`~object.__new__` に置き換えられ、クラス作成後の既存メ" +"ンバーの検索に使われます。" -#: ../../howto/enum.rst:1407 msgid "" "*Do not* call ``super().__new__()``, as the lookup-only ``__new__`` is the " "one that is found; instead, use the data type directly -- e.g.::" msgstr "" +"``super().__new__()`` は *呼び出さないでください*。\n" +"検索専用の ``__new__`` が見つかるためです。\n" +"代わりに、例えば次のようにデータ型を直接使ってください。 ::" -#: ../../howto/enum.rst:1410 msgid "obj = int.__new__(cls, value)" -msgstr "" +msgstr "obj = int.__new__(cls, value)" #: ../../howto/enum.rst:1414 msgid "OrderedEnum" @@ -2380,7 +2881,6 @@ msgstr "" ":class:`IntEnum` をベースとしないため、通常の :class:`Enum` の不変条件 (他の" "列挙型と比較できないなど) のままで、メンバーを順序付けできる列挙型です::" -#: ../../howto/enum.rst:1420 msgid "" ">>> class OrderedEnum(Enum):\n" "... def __ge__(self, other):\n" @@ -2410,6 +2910,33 @@ msgid "" ">>> Grade.C < Grade.A\n" "True" msgstr "" +">>> class OrderedEnum(Enum):\n" +"... def __ge__(self, other):\n" +"... if self.__class__ is other.__class__:\n" +"... return self.value >= other.value\n" +"... return NotImplemented\n" +"... def __gt__(self, other):\n" +"... if self.__class__ is other.__class__:\n" +"... return self.value > other.value\n" +"... return NotImplemented\n" +"... def __le__(self, other):\n" +"... if self.__class__ is other.__class__:\n" +"... return self.value <= other.value\n" +"... return NotImplemented\n" +"... def __lt__(self, other):\n" +"... if self.__class__ is other.__class__:\n" +"... return self.value < other.value\n" +"... return NotImplemented\n" +"...\n" +">>> class Grade(OrderedEnum):\n" +"... A = 5\n" +"... B = 4\n" +"... C = 3\n" +"... D = 2\n" +"... F = 1\n" +"...\n" +">>> Grade.C < Grade.A\n" +"True" #: ../../howto/enum.rst:1450 msgid "DuplicateFreeEnum" @@ -2423,7 +2950,6 @@ msgstr "" "値が重複するメンバーがある場合に、エイリアスを作成するのではなくエラーを発生" "させます::" -#: ../../howto/enum.rst:1455 msgid "" ">>> class DuplicateFreeEnum(Enum):\n" "... def __init__(self, *args):\n" @@ -2446,6 +2972,26 @@ msgid "" " ...\n" "ValueError: aliases not allowed in DuplicateFreeEnum: 'GRENE' --> 'GREEN'" msgstr "" +">>> class DuplicateFreeEnum(Enum):\n" +"... def __init__(self, *args):\n" +"... cls = self.__class__\n" +"... if any(self.value == e.value for e in cls):\n" +"... a = self.name\n" +"... e = cls(self.value).name\n" +"... raise ValueError(\n" +"... \"aliases not allowed in DuplicateFreeEnum: %r --> " +"%r\"\n" +"... % (a, e))\n" +"...\n" +">>> class Color(DuplicateFreeEnum):\n" +"... RED = 1\n" +"... GREEN = 2\n" +"... BLUE = 3\n" +"... GRENE = 2\n" +"...\n" +"Traceback (most recent call last):\n" +" ...\n" +"ValueError: aliases not allowed in DuplicateFreeEnum: 'GRENE' --> 'GREEN'" #: ../../howto/enum.rst:1477 msgid "" @@ -2457,15 +3003,12 @@ msgstr "" "サブクラス化に役立つ例です。単に別名を無効にしたいだけなら、 :func:`unique` " "デコレーターを使用して行えます。" -#: ../../howto/enum.rst:1483 msgid "MultiValueEnum" -msgstr "" +msgstr "MultiValueEnum" -#: ../../howto/enum.rst:1485 msgid "Supports having more than one value per member::" -msgstr "" +msgstr "1 つのメンバーに複数の値を持たせられます。 ::" -#: ../../howto/enum.rst:1487 msgid "" ">>> class MultiValueEnum(Enum):\n" "... def __new__(cls, value, *values):\n" @@ -2484,18 +3027,34 @@ msgid "" ">>> DType(9)\n" "" msgstr "" +">>> class MultiValueEnum(Enum):\n" +"... def __new__(cls, value, *values):\n" +"... self = object.__new__(cls)\n" +"... self._value_ = value\n" +"... for v in values:\n" +"... self._add_value_alias_(v)\n" +"... return self\n" +"...\n" +">>> class DType(MultiValueEnum):\n" +"... float32 = 'f', 8\n" +"... double64 = 'd', 9\n" +"...\n" +">>> DType('f')\n" +"\n" +">>> DType(9)\n" +"" #: ../../howto/enum.rst:1506 msgid "Planet" msgstr "Planet" -#: ../../howto/enum.rst:1508 msgid "" "If :meth:`~object.__new__` or :meth:`~object.__init__` is defined, the value " "of the enum member will be passed to those methods::" msgstr "" +":meth:`~object.__new__` や :meth:`~object.__init__` を定義すると、列挙型メン" +"バーの値がこれらのメソッドに渡されます。 ::" -#: ../../howto/enum.rst:1511 msgid "" ">>> class Planet(Enum):\n" "... MERCURY = (3.303e+23, 2.4397e6)\n" @@ -2520,14 +3079,35 @@ msgid "" ">>> Planet.EARTH.surface_gravity\n" "9.802652743337129" msgstr "" +">>> class Planet(Enum):\n" +"... MERCURY = (3.303e+23, 2.4397e6)\n" +"... VENUS = (4.869e+24, 6.0518e6)\n" +"... EARTH = (5.976e+24, 6.37814e6)\n" +"... MARS = (6.421e+23, 3.3972e6)\n" +"... JUPITER = (1.9e+27, 7.1492e7)\n" +"... SATURN = (5.688e+26, 6.0268e7)\n" +"... URANUS = (8.686e+25, 2.5559e7)\n" +"... NEPTUNE = (1.024e+26, 2.4746e7)\n" +"... def __init__(self, mass, radius):\n" +"... self.mass = mass # 単位はキログラム\n" +"... self.radius = radius # 単位はメートル\n" +"... @property\n" +"... def surface_gravity(self):\n" +"... # 万有引力定数 (m3 kg-1 s-2)\n" +"... G = 6.67300E-11\n" +"... return G * self.mass / (self.radius * self.radius)\n" +"...\n" +">>> Planet.EARTH.value\n" +"(5.976e+24, 6378140.0)\n" +">>> Planet.EARTH.surface_gravity\n" +"9.802652743337129" #: ../../howto/enum.rst:1537 msgid "TimePeriod" msgstr "TimePeriod" -#: ../../howto/enum.rst:1539 msgid "An example to show the :attr:`~Enum._ignore_` attribute in use::" -msgstr "" +msgstr ":attr:`~Enum._ignore_` 属性の使用例です。 ::" #: ../../howto/enum.rst:1541 msgid "" @@ -2551,9 +3131,12 @@ msgstr "" msgid "Subclassing EnumType" msgstr "EnumType のサブクラスを作る" -#: ../../howto/enum.rst:1560 msgid "" "While most enum needs can be met by customizing :class:`Enum` subclasses, " "either with class decorators or custom functions, :class:`EnumType` can be " "subclassed to provide a different Enum experience." msgstr "" +"列挙型に関する要件の多くは、クラスデコレータや独自の関数で :class:`Enum` のサ" +"ブクラスをカスタマイズすれば満たせます。\n" +"一方、:class:`EnumType` のサブクラスを作れば、Enum 自体の使い方を変えることも" +"できます。" diff --git a/howto/functional.po b/howto/functional.po index 28c8c53e7..50e195f78 100644 --- a/howto/functional.po +++ b/howto/functional.po @@ -20,10 +20,10 @@ msgstr "" "Last-Translator: TENMYO Masakazu, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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/functional.rst:5 @@ -276,7 +276,6 @@ msgstr "" "そうだ」と言うのとも別の話です; 目指すのは、出現しうる入力すべてに対してプロ" "グラムが正しい結果を出すことの厳密な証明なのです。" -#: ../../howto/functional.rst:113 msgid "" "The technique used to prove programs correct is to write down " "**invariants**, properties of the input data and of the program's variables " @@ -286,12 +285,12 @@ msgid "" "This continues until you reach the end of the program, at which point the " "invariants should match the desired conditions on the program's output." msgstr "" -"プログラムを証明するために使われているのは **不変式** を書き出していくという" -"テクニックで、不変式とは入力データやプログラム変数のうち常に真である性質のこ" -"とです。コードの一行一行で、 **実行前** の不変式 X と Y が真なら **実行後に" -"** ちょっと違う不変式 X' と Y' が真になることを示していき、これをプログラムの" -"終わりまで続けるわけです。すると最終的な不変式はプログラムの出力に合った条件" -"になっているはずです。" +"プログラムの正しさを証明する手法では、入力データやプログラム変数について常に" +"真である性質、つまり **不変条件** を書き出します。\n" +"コードの各行について、**実行前** に不変条件 X と Y が成り立つなら、**実行後" +"** には少し異なる不変条件 X' と Y' が成り立つことを示します。\n" +"これをプログラムの終わりまで続け、最後の不変条件が、出力に求める条件と一致す" +"ることを確認します。" #: ../../howto/functional.rst:121 msgid "" @@ -466,7 +465,6 @@ msgstr "" "るいは :func:`iter` でイテレータを作れるオブジェクトである必要があります。次" "の二つは同じ意味になります::" -#: ../../howto/functional.rst:224 msgid "" "for i in iter(obj):\n" " print(i)\n" @@ -474,6 +472,11 @@ msgid "" "for i in obj:\n" " print(i)" msgstr "" +"for i in iter(obj):\n" +" print(i)\n" +"\n" +"for i in obj:\n" +" print(i)" #: ../../howto/functional.rst:230 msgid "" @@ -548,7 +551,6 @@ msgstr "" "辞書に対して :func:`iter` すると、辞書のキーでループを回すイテレータが返され" "ます::" -#: ../../howto/functional.rst:275 msgid "" ">>> m = {'Jan': 1, 'Feb': 2, 'Mar': 3, 'Apr': 4, 'May': 5, 'Jun': 6,\n" "... 'Jul': 7, 'Aug': 8, 'Sep': 9, 'Oct': 10, 'Nov': 11, 'Dec': 12}\n" @@ -567,6 +569,22 @@ msgid "" "Nov 11\n" "Dec 12" msgstr "" +">>> m = {'Jan': 1, 'Feb': 2, 'Mar': 3, 'Apr': 4, 'May': 5, 'Jun': 6,\n" +"... 'Jul': 7, 'Aug': 8, 'Sep': 9, 'Oct': 10, 'Nov': 11, 'Dec': 12}\n" +">>> for key in m:\n" +"... print(key, m[key])\n" +"Jan 1\n" +"Feb 2\n" +"Mar 3\n" +"Apr 4\n" +"May 5\n" +"Jun 6\n" +"Jul 7\n" +"Aug 8\n" +"Sep 9\n" +"Oct 10\n" +"Nov 11\n" +"Dec 12" #: ../../howto/functional.rst:292 msgid "" @@ -609,12 +627,14 @@ msgstr "" "ことでイテレータ化に対応しています。つまりこうやってファイルの各行を読んでい" "くことができるわけです::" -#: ../../howto/functional.rst:313 msgid "" "for line in file:\n" " # do something for each line\n" " ..." msgstr "" +"for line in file:\n" +" # 各行について処理する\n" +" ..." #: ../../howto/functional.rst:317 msgid "" @@ -624,7 +644,6 @@ msgstr "" "セットはイテラブルを受け取れますし、そのセットの要素でイテレートすることもで" "きます::" -#: ../../howto/functional.rst:320 msgid "" ">>> S = {2, 3, 5, 7, 11, 13}\n" ">>> for i in S:\n" @@ -636,12 +655,20 @@ msgid "" "11\n" "13" msgstr "" +">>> S = {2, 3, 5, 7, 11, 13}\n" +">>> for i in S:\n" +"... print(i)\n" +"2\n" +"3\n" +"5\n" +"7\n" +"11\n" +"13" #: ../../howto/functional.rst:333 msgid "Generator expressions and list comprehensions" msgstr "ジェネレータ式とリスト内包表記" -#: ../../howto/functional.rst:335 msgid "" "Two common operations on an iterator's output are 1) performing some " "operation for every element, 2) selecting a subset of elements that meet " @@ -649,10 +676,10 @@ msgid "" "strip off trailing whitespace from each line or extract all the strings " "containing a given substring." msgstr "" -"イテレータの出力に対してよく使う操作トップ 2 は、(1) ひとつずつ全要素に操作を" -"実行する、および (2) 条件に合う要素でサブセットを作る、です。たとえば文字列の" -"リストなら、各行のうしろに付いた邪魔なホワイトスペースを削りたいとか、特定の" -"文字列を含む部分をピックアップしたいなどと思うかもしれません。" +"イテレータの出力に対するよくある操作は、1) 各要素に何らかの処理を行うこと、" +"2) 条件に合う要素だけを選ぶことです。\n" +"例えば、文字列のリストがあれば、各行の末尾の空白を取り除いたり、指定した部分" +"文字列を含む文字列をすべて取り出したりする場合があります。" #: ../../howto/functional.rst:341 msgid "" @@ -666,7 +693,6 @@ msgstr "" "(https://www.haskell.org/) にインスパイアされました。文字列のストリームからホ" "ワイトスペースをすべて削るのは次のコードでできます::" -#: ../../howto/functional.rst:346 msgid "" ">>> line_list = [' line 1\\n', 'line 2 \\n', ' \\n', '']\n" "\n" @@ -676,17 +702,25 @@ msgid "" ">>> # List comprehension -- returns list\n" ">>> stripped_list = [line.strip() for line in line_list]" msgstr "" +">>> line_list = [' line 1\\n', 'line 2 \\n', ' \\n', '']\n" +"\n" +">>> # ジェネレータ式 -- イテレータを返す\n" +">>> stripped_iter = (line.strip() for line in line_list)\n" +"\n" +">>> # リスト内包表記 -- リストを返す\n" +">>> stripped_list = [line.strip() for line in line_list]" #: ../../howto/functional.rst:354 msgid "" "You can select only certain elements by adding an ``\"if\"`` condition::" msgstr "特定の要素だけを選び出すのは ``\"if\"`` 条件式を付けることで可能です::" -#: ../../howto/functional.rst:356 msgid "" ">>> stripped_list = [line.strip() for line in line_list\n" "... if line != \"\"]" msgstr "" +">>> stripped_list = [line.strip() for line in line_list\n" +"... if line != \"\"]" #: ../../howto/functional.rst:359 msgid "" @@ -756,9 +790,8 @@ msgstr "" "なっている括弧でも大丈夫です。関数にすぐ渡すイテレータを作りたければこう書け" "るのです::" -#: ../../howto/functional.rst:391 msgid "obj_total = sum(obj.count for obj in list_all_objects())" -msgstr "" +msgstr "obj_total = sum(obj.count for obj in list_all_objects())" #: ../../howto/functional.rst:393 msgid "" @@ -784,7 +817,6 @@ msgstr "" "別の書き方をすると、リスト内包表記やジェネレータ式は次の Python コードと同じ" "意味になります::" -#: ../../howto/functional.rst:402 msgid "" "for expr1 in sequence1:\n" " if not (condition1):\n" @@ -800,6 +832,19 @@ msgid "" " # Output the value of\n" " # the expression." msgstr "" +"for expr1 in sequence1:\n" +" if not (condition1):\n" +" continue # この要素を読み飛ばす\n" +" for expr2 in sequence2:\n" +" if not (condition2):\n" +" continue # この要素を読み飛ばす\n" +" ...\n" +" for exprN in sequenceN:\n" +" if not (conditionN):\n" +" continue # この要素を読み飛ばす\n" +"\n" +" # 式の値を\n" +" # 出力する。" #: ../../howto/functional.rst:416 msgid "" @@ -822,13 +867,16 @@ msgstr "" "ら括弧で囲わなくてはなりません。下にあるリスト内包表記で、最初のは構文エラー" "ですが、二番目は有効です::" -#: ../../howto/functional.rst:432 msgid "" "# Syntax error\n" "[x, y for x in seq1 for y in seq2]\n" "# Correct\n" "[(x, y) for x in seq1 for y in seq2]" msgstr "" +"# 構文エラー\n" +"[x, y for x in seq1 for y in seq2]\n" +"# 正しい書き方\n" +"[(x, y) for x in seq1 for y in seq2]" #: ../../howto/functional.rst:439 msgid "Generators" @@ -879,7 +927,6 @@ msgstr "" "の :term:`bytecode` コンパイラがこれを検出して、特別な方法でコンパイルしてく" "れるのです。" -#: ../../howto/functional.rst:464 msgid "" "When you call a generator function, it doesn't return a single value; " "instead it returns a generator object that supports the iterator protocol. " @@ -890,12 +937,14 @@ msgid "" "preserved. On the next call to the generator's :meth:`~generator.__next__` " "method, the function will resume executing." msgstr "" -"ジェネレータ関数は、呼ばれたときに一回だけ値を返すのではなく、イテレータ プロ" -"トコルに対応したオブジェクトを返します。上の例で ``yield`` を実行したとき、 " -"ジェネレータは ``return`` 文のようにして ``i`` の値を出力します。 ``yield`` " -"と ``return`` 文の大きな違いは、 ``yield`` に到達した段階でジェネレータの実行" -"状態が一時停止になって、ローカル変数が保存される点です。 次回そのジェネレータ" -"の :meth:`~generator.__next__` を呼ぶと、そこから関数が実行を再開します。" +"ジェネレータ関数を呼ぶと、計算結果の値ではなく、イテレータプロトコルに対応す" +"るジェネレータオブジェクトが返されます。\n" +"ジェネレータが ``yield`` 式を実行すると、``return`` 文と同じように ``i`` の値" +"を出力します。\n" +"大きな違いは、``yield`` に到達すると実行が中断され、ローカル変数が保持される" +"点です。\n" +"次にジェネレータの :meth:`~generator.__next__` メソッドを呼ぶと、関数の実行が" +"再開されます。" #: ../../howto/functional.rst:473 msgid "Here's a sample usage of the ``generate_ints()`` generator:" @@ -1002,9 +1051,8 @@ msgstr "" "Python 2.5 で、ジェネレータに値を渡す簡単な手段ができました。 :keyword:" "`yield` が、変数に代入したり演算したりできる値を返す式になったのです::" -#: ../../howto/functional.rst:543 msgid "val = (yield i)" -msgstr "" +msgstr "val = (yield i)" #: ../../howto/functional.rst:545 msgid "" @@ -1050,7 +1098,6 @@ msgstr "" "下にあるのは 1 ずつ増える単純なカウンタですが、内部カウンタの値を変更すること" "ができるようになっています。" -#: ../../howto/functional.rst:564 msgid "" "def counter(maximum):\n" " i = 0\n" @@ -1062,6 +1109,15 @@ msgid "" " else:\n" " i += 1" msgstr "" +"def counter(maximum):\n" +" i = 0\n" +" while i < maximum:\n" +" val = (yield i)\n" +" # 値が渡されたら、カウンタを変更する\n" +" if val is not None:\n" +" i = val\n" +" else:\n" +" i += 1" #: ../../howto/functional.rst:576 msgid "And here's an example of changing the counter:" @@ -1113,15 +1169,14 @@ msgstr "" "`RuntimeError` を引き起こします。 :meth:`~generator.close` はジェネレータが " "GC されるときにも呼ばれます。" -#: ../../howto/functional.rst:613 msgid "" "If you need to run cleanup code when a :exc:`GeneratorExit` occurs, I " "suggest using a ``try: ... finally:`` suite instead of catching :exc:" "`GeneratorExit`." msgstr "" -":exc:`GeneratorExit` が起こったときにクリーンアップ作業をする必要があるな" -"ら、 :exc:`GeneratorExit` を捕捉するのではなく ``try: ... finaly:`` するよう" -"お勧めします。" +":exc:`GeneratorExit` が発生したときに後片付けを行う必要がある場合は、:exc:" +"`GeneratorExit` を捕捉するのではなく、``try: ... finally:`` を使うことを勧め" +"ます。" #: ../../howto/functional.rst:616 msgid "" @@ -1207,7 +1262,6 @@ msgstr "" "振っていき、(*start* から数え始めたときの) 番号とそれぞれの要素を含む 2 タプ" "ルを返します。" -#: ../../howto/functional.rst:669 msgid "" ">>> for item in enumerate(['subject', 'verb', 'object']):\n" "... print(item)\n" @@ -1215,22 +1269,29 @@ msgid "" "(1, 'verb')\n" "(2, 'object')" msgstr "" +">>> for item in enumerate(['subject', 'verb', 'object']):\n" +"... print(item)\n" +"(0, 'subject')\n" +"(1, 'verb')\n" +"(2, 'object')" -#: ../../howto/functional.rst:675 msgid "" ":func:`enumerate` is often used when looping through a list and recording " "the indexes at which certain conditions are met::" msgstr "" -":func:`enumerate` はよく、リストに対してループさせて、条件に合う所に印を付け" -"ていくときに使われます::" +":func:`enumerate` は、リストをループで処理し、条件を満たす位置のインデックス" +"を記録するときによく使われます。 ::" -#: ../../howto/functional.rst:678 msgid "" "f = open('data.txt', 'r')\n" "for i, line in enumerate(f):\n" " if line.strip() == '':\n" " print('Blank line at line #%i' % i)" msgstr "" +"f = open('data.txt', 'r')\n" +"for i, line in enumerate(f):\n" +" if line.strip() == '':\n" +" print('Blank line at line #%i' % i)" #: ../../howto/functional.rst:683 msgid "" @@ -1243,7 +1304,6 @@ msgstr "" "をすべて集めたリストを作り、ソートして返します。 引数 *key* および *reverse* " "は、リストの :meth:`~list.sort` メソッドにそのまま渡されます。 ::" -#: ../../howto/functional.rst:688 msgid "" ">>> import random\n" ">>> # Generate 8 random numbers between [0, 10000)\n" @@ -1255,6 +1315,15 @@ msgid "" ">>> sorted(rand_list, reverse=True)\n" "[9878, 9828, 8442, 7953, 6431, 6213, 2207, 769]" msgstr "" +">>> import random\n" +">>> # 0 以上 10000 未満の乱数を 8 個生成する\n" +">>> rand_list = random.sample(range(10000), 8)\n" +">>> rand_list\n" +"[769, 7953, 9828, 6431, 8442, 9878, 6213, 2207]\n" +">>> sorted(rand_list)\n" +"[769, 2207, 6213, 6431, 7953, 8442, 9828, 9878]\n" +">>> sorted(rand_list, reverse=True)\n" +"[9878, 9828, 8442, 7953, 6431, 6213, 2207, 769]" #: ../../howto/functional.rst:698 msgid "" @@ -1280,11 +1349,12 @@ msgstr "" ":func:`zip(iterA, iterB, ...) ` はそれぞれの iterable から1つの要素を取" "り、それらをタプルに入れて返します::" -#: ../../howto/functional.rst:723 msgid "" "zip(['a', 'b', 'c'], (1, 2, 3)) =>\n" " ('a', 1), ('b', 2), ('c', 3)" msgstr "" +"zip(['a', 'b', 'c'], (1, 2, 3)) =>\n" +" ('a', 1), ('b', 2), ('c', 3)" #: ../../howto/functional.rst:726 msgid "" @@ -1309,11 +1379,12 @@ msgstr "" "違っていれば、出力されるストリームは一番短いイテラブルと同じ長さになりま" "す。 ::" -#: ../../howto/functional.rst:735 msgid "" "zip(['a', 'b'], (1, 2, 3)) =>\n" " ('a', 1), ('b', 2)" msgstr "" +"zip(['a', 'b'], (1, 2, 3)) =>\n" +" ('a', 1), ('b', 2)" #: ../../howto/functional.rst:738 msgid "" @@ -1376,7 +1447,6 @@ msgstr "" "オプションで開始する数 (デフォルトは 0) や数どうしの間隔 (デフォルトは 1) を" "与えられます::" -#: ../../howto/functional.rst:764 msgid "" "itertools.count() =>\n" " 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ...\n" @@ -1385,6 +1455,12 @@ msgid "" "itertools.count(10, 5) =>\n" " 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, ..." msgstr "" +"itertools.count() =>\n" +" 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ...\n" +"itertools.count(10) =>\n" +" 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, ...\n" +"itertools.count(10, 5) =>\n" +" 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, ..." #: ../../howto/functional.rst:771 msgid "" @@ -1397,11 +1473,12 @@ msgstr "" "をコピーして、 その要素を最初から最後まで無限に繰り返していくイテレータを返し" "ます。 ::" -#: ../../howto/functional.rst:775 msgid "" "itertools.cycle([1, 2, 3, 4, 5]) =>\n" " 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, ..." msgstr "" +"itertools.cycle([1, 2, 3, 4, 5]) =>\n" +" 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, ..." #: ../../howto/functional.rst:778 msgid "" @@ -1412,13 +1489,16 @@ msgstr "" ":func:`itertools.repeat(elem, [n]) ` は、与えられた要素を " "*n* 回返しますが、 *n* がなければ永遠に返し続けます。 ::" -#: ../../howto/functional.rst:781 msgid "" "itertools.repeat('abc') =>\n" " abc, abc, abc, abc, abc, abc, abc, abc, abc, abc, ...\n" "itertools.repeat('abc', 5) =>\n" " abc, abc, abc, abc, abc" msgstr "" +"itertools.repeat('abc') =>\n" +" abc, abc, abc, abc, abc, abc, abc, abc, abc, abc, ...\n" +"itertools.repeat('abc', 5) =>\n" +" abc, abc, abc, abc, abc" #: ../../howto/functional.rst:786 msgid "" @@ -1431,11 +1511,12 @@ msgstr "" "ラブルを受け取って、最初のイテレータから要素をすべて返し、次に二番目から 要素" "をすべて返し、ということを要素がなくなるまで続けます。 ::" -#: ../../howto/functional.rst:791 msgid "" "itertools.chain(['a', 'b', 'c'], (1, 2, 3)) =>\n" " a, b, c, 1, 2, 3" msgstr "" +"itertools.chain(['a', 'b', 'c'], (1, 2, 3)) =>\n" +" a, b, c, 1, 2, 3" #: ../../howto/functional.rst:794 msgid "" @@ -1454,7 +1535,6 @@ msgstr "" "トのスライスとは違って、マイナスの値は *start*, *stop*, *step* に使えませ" "ん。 ::" -#: ../../howto/functional.rst:801 msgid "" "itertools.islice(range(10), 8) =>\n" " 0, 1, 2, 3, 4, 5, 6, 7\n" @@ -1463,6 +1543,12 @@ msgid "" "itertools.islice(range(10), 2, 8, 2) =>\n" " 2, 4, 6" msgstr "" +"itertools.islice(range(10), 8) =>\n" +" 0, 1, 2, 3, 4, 5, 6, 7\n" +"itertools.islice(range(10), 2, 8) =>\n" +" 2, 3, 4, 5, 6, 7\n" +"itertools.islice(range(10), 2, 8, 2) =>\n" +" 2, 4, 6" #: ../../howto/functional.rst:808 msgid "" @@ -1480,7 +1566,6 @@ msgstr "" "たうちの一つが他よりも進んでいってしまうと、大量のメモリを消費することがあり" "ます。 ::" -#: ../../howto/functional.rst:816 msgid "" "itertools.tee( itertools.count() ) =>\n" " iterA, iterB\n" @@ -1491,6 +1576,14 @@ msgid "" "and iterB ->\n" " 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ..." msgstr "" +"itertools.tee( itertools.count() ) =>\n" +" iterA, iterB\n" +"\n" +"ここで iterA ->\n" +" 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ...\n" +"\n" +"また iterB ->\n" +" 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ..." #: ../../howto/functional.rst:827 msgid "Calling functions on elements" @@ -1520,7 +1613,6 @@ msgstr "" "プルのストリームを返すとみなして、 そのタプルを引数に使って *func* を呼びま" "す::" -#: ../../howto/functional.rst:839 msgid "" "itertools.starmap(os.path.join,\n" " [('/bin', 'python'), ('/usr', 'bin', 'java'),\n" @@ -1528,6 +1620,11 @@ msgid "" "=>\n" " /bin/python, /usr/bin/java, /usr/bin/perl, /usr/bin/ruby" msgstr "" +"itertools.starmap(os.path.join,\n" +" [('/bin', 'python'), ('/usr', 'bin', 'java'),\n" +" ('/usr', 'bin', 'perl'), ('/usr', 'bin', 'ruby')])\n" +"=>\n" +" /bin/python, /usr/bin/java, /usr/bin/perl, /usr/bin/ruby" #: ../../howto/functional.rst:847 msgid "Selecting elements" @@ -1550,11 +1647,12 @@ msgstr "" ":func:`itertools.filterfalse(predicate, iter) ` は :" "func:`filter` とは反対に、 述語が偽を返す要素をすべて返します::" -#: ../../howto/functional.rst:856 msgid "" "itertools.filterfalse(is_even, itertools.count()) =>\n" " 1, 3, 5, 7, 9, 11, 13, 15, ..." msgstr "" +"itertools.filterfalse(is_even, itertools.count()) =>\n" +" 1, 3, 5, 7, 9, 11, 13, 15, ..." #: ../../howto/functional.rst:859 msgid "" @@ -1566,7 +1664,6 @@ msgstr "" "を返している間だけ要素を返します。一度でも述語が偽を返すと、イテレータは出力" "終了の合図をします。 ::" -#: ../../howto/functional.rst:863 msgid "" "def less_than_10(x):\n" " return x < 10\n" @@ -1577,6 +1674,14 @@ msgid "" "itertools.takewhile(is_even, itertools.count()) =>\n" " 0" msgstr "" +"def less_than_10(x):\n" +" return x < 10\n" +"\n" +"itertools.takewhile(less_than_10, itertools.count()) =>\n" +" 0, 1, 2, 3, 4, 5, 6, 7, 8, 9\n" +"\n" +"itertools.takewhile(is_even, itertools.count()) =>\n" +" 0" #: ../../howto/functional.rst:872 msgid "" @@ -1588,7 +1693,6 @@ msgstr "" "真を返しているうちは要素を無視し、偽になってから残りの出力をすべて返しま" "す。 ::" -#: ../../howto/functional.rst:876 msgid "" "itertools.dropwhile(less_than_10, itertools.count()) =>\n" " 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, ...\n" @@ -1596,6 +1700,11 @@ msgid "" "itertools.dropwhile(is_even, itertools.count()) =>\n" " 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ..." msgstr "" +"itertools.dropwhile(less_than_10, itertools.count()) =>\n" +" 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, ...\n" +"\n" +"itertools.dropwhile(is_even, itertools.count()) =>\n" +" 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ..." #: ../../howto/functional.rst:882 msgid "" @@ -1608,27 +1717,26 @@ msgstr "" "レータを取り、 どちらかのイテレータを使い果たすまでの、 *selectors* が真とな" "る要素に対応する *data* 要素だけを返します::" -#: ../../howto/functional.rst:886 msgid "" "itertools.compress([1, 2, 3, 4, 5], [True, True, False, False, True]) =>\n" " 1, 2, 5" msgstr "" +"itertools.compress([1, 2, 3, 4, 5], [True, True, False, False, True]) =>\n" +" 1, 2, 5" #: ../../howto/functional.rst:891 msgid "Combinatoric functions" msgstr "組合せ関数" -#: ../../howto/functional.rst:893 msgid "" "The :func:`itertools.combinations(iterable, r) ` " "returns an iterator giving all possible *r*-tuple combinations of the " "elements contained in *iterable*. ::" msgstr "" -":func:`itertools.combinations(iterable, r) ` は、 " -"*iterable* から *r*-tuple 選択する全ての組み合わせを提供するイテレータを返し" -"ます ::" +":func:`itertools.combinations(iterable, r) ` は、" +"*iterable* 内の要素から *r* 個を選ぶすべての組み合わせを、タプルとして返すイ" +"テレータを作ります。 ::" -#: ../../howto/functional.rst:897 msgid "" "itertools.combinations([1, 2, 3, 4, 5], 2) =>\n" " (1, 2), (1, 3), (1, 4), (1, 5),\n" @@ -1641,6 +1749,16 @@ msgid "" " (2, 3, 4), (2, 3, 5), (2, 4, 5),\n" " (3, 4, 5)" msgstr "" +"itertools.combinations([1, 2, 3, 4, 5], 2) =>\n" +" (1, 2), (1, 3), (1, 4), (1, 5),\n" +" (2, 3), (2, 4), (2, 5),\n" +" (3, 4), (3, 5),\n" +" (4, 5)\n" +"\n" +"itertools.combinations([1, 2, 3, 4, 5], 3) =>\n" +" (1, 2, 3), (1, 2, 4), (1, 2, 5), (1, 3, 4), (1, 3, 5), (1, 4, 5),\n" +" (2, 3, 4), (2, 3, 5), (2, 4, 5),\n" +" (3, 4, 5)" #: ../../howto/functional.rst:908 msgid "" @@ -1656,7 +1774,6 @@ msgstr "" "permutations>` があり、こちらはこの順序についての制約がなく、 *r* 個選択する" "全ての順列を返します。" -#: ../../howto/functional.rst:915 msgid "" "itertools.permutations([1, 2, 3, 4, 5], 2) =>\n" " (1, 2), (1, 3), (1, 4), (1, 5),\n" @@ -1670,6 +1787,17 @@ msgid "" " ...\n" " (5, 4, 3, 2, 1)" msgstr "" +"itertools.permutations([1, 2, 3, 4, 5], 2) =>\n" +" (1, 2), (1, 3), (1, 4), (1, 5),\n" +" (2, 1), (2, 3), (2, 4), (2, 5),\n" +" (3, 1), (3, 2), (3, 4), (3, 5),\n" +" (4, 1), (4, 2), (4, 3), (4, 5),\n" +" (5, 1), (5, 2), (5, 3), (5, 4)\n" +"\n" +"itertools.permutations([1, 2, 3, 4, 5]) =>\n" +" (1, 2, 3, 4, 5), (1, 2, 3, 5, 4), (1, 2, 4, 3, 5),\n" +" ...\n" +" (5, 4, 3, 2, 1)" #: ../../howto/functional.rst:927 msgid "" @@ -1687,12 +1815,14 @@ msgstr "" "これらの関数が生成する組み合わせは、位置が基準ですので、 *iterable* の内容が" "一意でなくとも良いことに注目してください::" -#: ../../howto/functional.rst:933 msgid "" "itertools.permutations('aba', 3) =>\n" " ('a', 'b', 'a'), ('a', 'a', 'b'), ('b', 'a', 'a'),\n" " ('b', 'a', 'a'), ('a', 'a', 'b'), ('a', 'b', 'a')" msgstr "" +"itertools.permutations('aba', 3) =>\n" +" ('a', 'b', 'a'), ('a', 'a', 'b'), ('b', 'a', 'a'),\n" +" ('b', 'a', 'a'), ('a', 'a', 'b'), ('a', 'b', 'a')" #: ../../howto/functional.rst:937 msgid "" @@ -1702,7 +1832,6 @@ msgstr "" "全く同じタプル ``('a', 'a', 'b')`` が 2度現れていますが、これは 2つの 'a' が" "別の位置からのものだからです。" -#: ../../howto/functional.rst:940 msgid "" "The :func:`itertools.combinations_with_replacement(iterable, r) ` function relaxes a different constraint: " @@ -1711,11 +1840,11 @@ msgid "" "the second element is selected. ::" msgstr "" ":func:`itertools.combinations_with_replacement(iterable, r) ` 関数は別の制約を取り払います: 一回の選択で同" -"じ要素を繰り返し選んでも良い。概念的には、それぞれのタプルの最初のものとして" -"一つ要素が選ばれ、続いて 2つ目の選択のかわりにそれで置き換わります ::" +"combinations_with_replacement>` は、別の制約を緩めます。\n" +"同じタプル内で要素の重複を許すのです。\n" +"概念的には、タプルの最初の位置に入れる要素を 1 つ選び、それを選択元に戻してか" +"ら 2 つ目を選びます。 ::" -#: ../../howto/functional.rst:946 msgid "" "itertools.combinations_with_replacement([1, 2, 3, 4, 5], 2) =>\n" " (1, 1), (1, 2), (1, 3), (1, 4), (1, 5),\n" @@ -1724,6 +1853,12 @@ msgid "" " (4, 4), (4, 5),\n" " (5, 5)" msgstr "" +"itertools.combinations_with_replacement([1, 2, 3, 4, 5], 2) =>\n" +" (1, 1), (1, 2), (1, 3), (1, 4), (1, 5),\n" +" (2, 2), (2, 3), (2, 4), (2, 5),\n" +" (3, 3), (3, 4), (3, 5),\n" +" (4, 4), (4, 5),\n" +" (5, 5)" #: ../../howto/functional.rst:955 msgid "Grouping elements" @@ -1752,7 +1887,6 @@ msgstr "" "要素を集めて、キー値とそのキーに対応する要素のイテレータの 2-タプルのストリー" "ムを返します。" -#: ../../howto/functional.rst:968 msgid "" "city_list = [('Decatur', 'AL'), ('Huntsville', 'AL'), ('Selma', 'AL'),\n" " ('Anchorage', 'AK'), ('Nome', 'AK'),\n" @@ -1776,6 +1910,27 @@ msgid "" "iterator-3 =>\n" " ('Flagstaff', 'AZ'), ('Phoenix', 'AZ'), ('Tucson', 'AZ')" msgstr "" +"city_list = [('Decatur', 'AL'), ('Huntsville', 'AL'), ('Selma', 'AL'),\n" +" ('Anchorage', 'AK'), ('Nome', 'AK'),\n" +" ('Flagstaff', 'AZ'), ('Phoenix', 'AZ'), ('Tucson', 'AZ'),\n" +" ...\n" +" ]\n" +"\n" +"def get_state(city_state):\n" +" return city_state[1]\n" +"\n" +"itertools.groupby(city_list, get_state) =>\n" +" ('AL', iterator-1),\n" +" ('AK', iterator-2),\n" +" ('AZ', iterator-3), ...\n" +"\n" +"ここで\n" +"iterator-1 =>\n" +" ('Decatur', 'AL'), ('Huntsville', 'AL'), ('Selma', 'AL')\n" +"iterator-2 =>\n" +" ('Anchorage', 'AK'), ('Nome', 'AK')\n" +"iterator-3 =>\n" +" ('Flagstaff', 'AZ'), ('Phoenix', 'AZ'), ('Tucson', 'AZ')" #: ../../howto/functional.rst:990 msgid "" @@ -1835,7 +1990,6 @@ msgstr "" msgid "Here's a small but realistic example::" msgstr "以下にあるのは、小さいけれども現実的な一つの例です::" -#: ../../howto/functional.rst:1017 msgid "" "import functools\n" "\n" @@ -1847,6 +2001,15 @@ msgid "" "server_log = functools.partial(log, subsystem='server')\n" "server_log('Unable to open socket')" msgstr "" +"import functools\n" +"\n" +"def log(message, subsystem):\n" +" \"\"\"'message' の内容を指定されたサブシステムに書き込む。\"\"\"\n" +" print('%s: %s' % (subsystem, message))\n" +" ...\n" +"\n" +"server_log = functools.partial(log, subsystem='server')\n" +"server_log('Unable to open socket')" #: ../../howto/functional.rst:1027 msgid "" @@ -1905,7 +2068,6 @@ msgstr "" "とはいえ、多くの場合 :func:`functools.reduce` を使うよりは、単に :keyword:" "`for` ループを書いたほうがわかりやすくなります::" -#: ../../howto/functional.rst:1066 msgid "" "import functools\n" "# Instead of:\n" @@ -1916,20 +2078,26 @@ msgid "" "for i in [1, 2, 3]:\n" " product *= i" msgstr "" +"import functools\n" +"# 次の代わりに:\n" +"product = functools.reduce(operator.mul, [1, 2, 3], 1)\n" +"\n" +"# こう書ける:\n" +"product = 1\n" +"for i in [1, 2, 3]:\n" +" product *= i" -#: ../../howto/functional.rst:1075 msgid "" "A related function is :func:`itertools.accumulate(iterable, func=operator." "add) `. It performs the same calculation, but instead " "of returning only the final result, :func:`~itertools.accumulate` returns an " "iterator that also yields each partial result::" msgstr "" -"関連する関数は :func:`itertools.accumulate(iterable, func=operator.add) " -"` です。この関数は同じ計算をしますが、最終結果を返すの" -"ではなく、 :func:`~itertools.accumulate` はそれぞれの中間結果を生成するイテ" -"レータが返り値となります。" +"関連する関数に :func:`itertools.accumulate(iterable, func=operator.add) " +"` があります。\n" +"同じ計算を行いますが、:func:`~itertools.accumulate` は最終結果だけを返すので" +"はなく、途中の結果も順に生成するイテレータを返します。 ::" -#: ../../howto/functional.rst:1080 msgid "" "itertools.accumulate([1, 2, 3, 4, 5]) =>\n" " 1, 3, 6, 10, 15\n" @@ -1937,6 +2105,11 @@ msgid "" "itertools.accumulate([1, 2, 3, 4, 5], operator.mul) =>\n" " 1, 2, 6, 24, 120" msgstr "" +"itertools.accumulate([1, 2, 3, 4, 5]) =>\n" +" 1, 3, 6, 10, 15\n" +"\n" +"itertools.accumulate([1, 2, 3, 4, 5], operator.mul) =>\n" +" 1, 2, 6, 24, 120" #: ../../howto/functional.rst:1088 msgid "The operator module" @@ -2005,11 +2178,12 @@ msgstr "" "ちょうど良い関数がビルトインやモジュールで存在していれば、新しい関数を定義す" "る必要はまったくありません::" -#: ../../howto/functional.rst:1115 msgid "" "stripped_lines = [line.strip() for line in lines]\n" "existing_files = filter(os.path.exists, file_list)" msgstr "" +"stripped_lines = [line.strip() for line in lines]\n" +"existing_files = filter(os.path.exists, file_list)" #: ../../howto/functional.rst:1118 msgid "" @@ -2023,12 +2197,14 @@ msgstr "" "の 一つが :keyword:`lambda` 式です。 ``lambda`` は引数として複数のパラメータ" "と それをつなぐ式を取り、その式の値を返す無名の関数を作ります::" -#: ../../howto/functional.rst:1123 msgid "" "adder = lambda x, y: x+y\n" "\n" "print_assign = lambda name, value: name + '=' + str(value)" msgstr "" +"adder = lambda x, y: x+y\n" +"\n" +"print_assign = lambda name, value: name + '=' + str(value)" #: ../../howto/functional.rst:1127 msgid "" @@ -2036,7 +2212,6 @@ msgid "" "the usual way::" msgstr "もう一つの選択肢は、ふつうに ``def`` 文で関数を定義するだけです::" -#: ../../howto/functional.rst:1130 msgid "" "def adder(x, y):\n" " return x + y\n" @@ -2044,6 +2219,11 @@ msgid "" "def print_assign(name, value):\n" " return name + '=' + str(value)" msgstr "" +"def adder(x, y):\n" +" return x + y\n" +"\n" +"def print_assign(name, value):\n" +" return name + '=' + str(value)" #: ../../howto/functional.rst:1136 msgid "" @@ -2069,11 +2249,12 @@ msgstr "" "ちゃして読みにくい式になってしまいます。さて、次のコードは何をしているでしょ" "うか、素早くお答えください! ::" -#: ../../howto/functional.rst:1146 msgid "" "import functools\n" "total = functools.reduce(lambda a, b: (0, a[1] + b[1]), items)[1]" msgstr "" +"import functools\n" +"total = functools.reduce(lambda a, b: (0, a[1] + b[1]), items)[1]" #: ../../howto/functional.rst:1149 msgid "" @@ -2084,7 +2265,6 @@ msgstr "" "わかるにはわかるでしょうが、何がどうなっているのか紐解いていくには時間がかか" "るはずです。短い ``def`` 文で入れ子にすると、少し見通しが良くなりますが::" -#: ../../howto/functional.rst:1153 msgid "" "import functools\n" "def combine(a, b):\n" @@ -2092,25 +2272,31 @@ msgid "" "\n" "total = functools.reduce(combine, items)[1]" msgstr "" +"import functools\n" +"def combine(a, b):\n" +" return 0, a[1] + b[1]\n" +"\n" +"total = functools.reduce(combine, items)[1]" #: ../../howto/functional.rst:1159 msgid "But it would be best of all if I had simply used a ``for`` loop::" msgstr "でも単純に ``for`` ループにすれば良かったのです::" -#: ../../howto/functional.rst:1161 msgid "" "total = 0\n" "for a, b in items:\n" " total += b" msgstr "" +"total = 0\n" +"for a, b in items:\n" +" total += b" #: ../../howto/functional.rst:1165 msgid "Or the :func:`sum` built-in and a generator expression::" msgstr "あるいは :func:`sum` ビルトインとジェネレータ式でも良いですね::" -#: ../../howto/functional.rst:1167 msgid "total = sum(b for a, b in items)" -msgstr "" +msgstr "total = sum(b for a, b in items)" #: ../../howto/functional.rst:1169 msgid "" @@ -2174,35 +2360,33 @@ msgstr "" "Jewett, Mike Krell, Leandro Lameiro, Jussi Salmela, Collin Winter, Blake " "Winton." -#: ../../howto/functional.rst:1193 msgid "Version 0.1: posted June 30 2006." -msgstr "Version 0.1: posted June 30 2006." +msgstr "バージョン 0.1: 2006 年 6 月 30 日公開。" -#: ../../howto/functional.rst:1195 msgid "Version 0.11: posted July 1 2006. Typo fixes." -msgstr "Version 0.11: posted July 1 2006. Typo fixes." +msgstr "" +"バージョン 0.11: 2006 年 7 月 1 日公開。\n" +"誤記を修正。" -#: ../../howto/functional.rst:1197 msgid "" "Version 0.2: posted July 10 2006. Merged genexp and listcomp sections into " "one. Typo fixes." msgstr "" -"Version 0.2: posted July 10 2006. Merged genexp and listcomp sections into " -"one. Typo fixes." +"バージョン 0.2: 2006 年 7 月 10 日公開。\n" +"ジェネレータ式とリスト内包表記の節を統合。\n" +"誤記を修正。" -#: ../../howto/functional.rst:1200 msgid "" "Version 0.21: Added more references suggested on the tutor mailing list." -msgstr "" -"Version 0.21: Added more references suggested on the tutor mailing list." +msgstr "バージョン 0.21: tutor メーリングリストで提案された参考資料を追加。" -#: ../../howto/functional.rst:1202 msgid "" "Version 0.30: Adds a section on the ``functional`` module written by Collin " "Winter; adds short section on the operator module; a few other edits." msgstr "" -"Version 0.30: Adds a section on the ``functional`` module written by Collin " -"Winter; adds short section on the operator module; a few other edits." +"バージョン 0.30: Collin Winter による ``functional`` モジュールの節を追加。\n" +"operator モジュールの短い節を追加。\n" +"ほかにもいくつか修正。" #: ../../howto/functional.rst:1207 msgid "References" @@ -2267,17 +2451,16 @@ msgstr "https://en.wikipedia.org/wiki/Currying: カリー化の概念に関す msgid "Python-specific" msgstr "Python 特有の話" -#: ../../howto/functional.rst:1235 msgid "" "https://gnosis.cx/TPiP/: The first chapter of David Mertz's book :title-" "reference:`Text Processing in Python` discusses functional programming for " "text processing, in the section titled \"Utilizing Higher-Order Functions in " "Text Processing\"." msgstr "" -"https://gnosis.cx/TPiP/: David Mertz's の本の最初の章 :title-reference:`Text " -"Processing in Python` では文書処理のための関数プログラミングについて議論して" -"います、この議論の節には \"Utilizing Higher-Order Functions in Text " -"Processing\" というタイトルがついています。" +"https://gnosis.cx/TPiP/: David Mertz 著 :title-reference:`Text Processing in " +"Python` の第 1 章では、\"Utilizing Higher-Order Functions in Text " +"Processing\" という節で、テキスト処理のための関数型プログラミングを扱っていま" +"す。" #: ../../howto/functional.rst:1240 msgid "" @@ -2311,10 +2494,9 @@ msgstr ":mod:`operator` モジュールの文書。" msgid ":pep:`289`: \"Generator Expressions\"" msgstr ":pep:`289`: \"Generator Expressions\"" -#: ../../howto/functional.rst:1258 msgid "" ":pep:`342`: \"Coroutines via Enhanced Generators\" describes the new " "generator features in Python 2.5." msgstr "" -":pep:`342`: \"Coroutines via Enhanced Generators\" describes the new " -"generator features in Python 2.5." +":pep:`342`: \"Coroutines via Enhanced Generators\" は、Python 2.5 の新しい" +"ジェネレータ機能を説明しています。" diff --git a/howto/gdb_helpers.po b/howto/gdb_helpers.po index fcab68ebc..0376c7f59 100644 --- a/howto/gdb_helpers.po +++ b/howto/gdb_helpers.po @@ -16,171 +16,186 @@ msgstr "" "Last-Translator: tomo, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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/gdb_helpers.rst:5 msgid "Debugging C API extensions and CPython Internals with GDB" -msgstr "" +msgstr "GDB による C API 拡張と CPython 内部のデバッグ" -#: ../../howto/gdb_helpers.rst:9 msgid "" "This document explains how the Python GDB extension, ``python-gdb.py``, can " "be used with the GDB debugger to debug CPython extensions and the CPython " "interpreter itself." msgstr "" +"このドキュメントでは、Python の GDB 拡張 ``python-gdb.py`` を GDB デバッガと" +"組み合わせて、CPython 拡張や CPython インタープリタ自体をデバッグする方法を説" +"明します。" -#: ../../howto/gdb_helpers.rst:13 msgid "" "When debugging low-level problems such as crashes or deadlocks, a low-level " "debugger, such as GDB, is useful to diagnose and correct the issue. By " "default, GDB (or any of its front-ends) doesn't support high-level " "information specific to the CPython interpreter." msgstr "" +"クラッシュやデッドロックなどの低レベルの問題を調べて修正するには、GDB などの" +"低レベルのデバッガが役立ちます。\n" +"デフォルトでは GDB (およびそのフロントエンド) は CPython インタープリタ固有の" +"高レベルの情報に対応していません。" -#: ../../howto/gdb_helpers.rst:18 msgid "" "The ``python-gdb.py`` extension adds CPython interpreter information to GDB. " "The extension helps introspect the stack of currently executing Python " "functions. Given a Python object represented by a :c:expr:`PyObject *` " "pointer, the extension surfaces the type and value of the object." msgstr "" +"``python-gdb.py`` 拡張は CPython インタープリタの情報を GDB に追加します。\n" +"実行中の Python 関数のスタックを調べるのに役立ちます。\n" +":c:expr:`PyObject *` ポインタで表された Python オブジェクトについて、型と値を" +"表示できます。" -#: ../../howto/gdb_helpers.rst:23 msgid "" "Developers who are working on CPython extensions or tinkering with parts of " "CPython that are written in C can use this document to learn how to use the " "``python-gdb.py`` extension with GDB." msgstr "" +"このドキュメントは、CPython 拡張の開発者や CPython の C で書かれた部分を扱う" +"開発者が、GDB で ``python-gdb.py`` 拡張を使う方法を学ぶためのものです。" -#: ../../howto/gdb_helpers.rst:29 msgid "" "This document assumes that you are familiar with the basics of GDB and the " "CPython C API. It consolidates guidance from the `devguide `_ and the `Python wiki `_." msgstr "" +"このドキュメントは GDB と CPython C API の基礎を理解していることを前提として" +"います。\n" +"`開発者ガイド `_ と `Python wiki `_ の説明をまとめたものです。" -#: ../../howto/gdb_helpers.rst:36 msgid "Prerequisites" -msgstr "" +msgstr "前提条件" -#: ../../howto/gdb_helpers.rst:38 msgid "You need to have:" -msgstr "" +msgstr "次のものが必要です:" -#: ../../howto/gdb_helpers.rst:40 msgid "" "GDB 7 or later. (For earlier versions of GDB, see ``Misc/gdbinit`` in the " "sources of Python 3.11 or earlier.)" msgstr "" +"GDB 7 以降。(それ以前の GDB については、Python 3.11 以前のソースにある " +"``Misc/gdbinit`` を参照してください。)" -#: ../../howto/gdb_helpers.rst:42 msgid "" "GDB-compatible debugging information for Python and any extension you are " "debugging." -msgstr "" +msgstr "Python およびデバッグ対象の拡張の、GDB に対応したデバッグ情報。" -#: ../../howto/gdb_helpers.rst:44 msgid "The ``python-gdb.py`` extension." -msgstr "" +msgstr "``python-gdb.py`` 拡張。" -#: ../../howto/gdb_helpers.rst:46 msgid "" "The extension is built with Python, but might be distributed separately or " "not at all. Below, we include tips for a few common systems as examples. " "Note that even if the instructions match your system, they might be outdated." msgstr "" +"この拡張は Python と一緒にビルドされますが、別途配布されていることも、配布さ" +"れていないこともあります。\n" +"以下では一般的なシステムをいくつか例に挙げて説明します。\n" +"お使いのシステムに該当する手順でも、情報が古くなっている可能性に注意してくだ" +"さい。" -#: ../../howto/gdb_helpers.rst:52 msgid "Setup with Python built from source" -msgstr "" +msgstr "ソースからビルドした Python での設定" -#: ../../howto/gdb_helpers.rst:54 msgid "" "When you build CPython from source, debugging information should be " "available, and the build should add a ``python-gdb.py`` file to the root " "directory of your repository." msgstr "" +"CPython をソースからビルドすると、通常はデバッグ情報が利用でき、リポジトリの" +"ルートディレクトリに ``python-gdb.py`` ファイルが追加されます。" -#: ../../howto/gdb_helpers.rst:58 msgid "" "To activate support, you must add the directory containing ``python-gdb.py`` " "to GDB's \"auto-load-safe-path\". If you haven't done this, recent versions " "of GDB will print out a warning with instructions on how to do this." msgstr "" +"サポートを有効にするには、``python-gdb.py`` のあるディレクトリを GDB の " +"\"auto-load-safe-path\" に追加する必要があります。\n" +"追加していない場合、最近の GDB は追加方法を示す警告を表示します。" -#: ../../howto/gdb_helpers.rst:65 msgid "" "If you do not see instructions for your version of GDB, put this in your " "configuration file (``~/.gdbinit`` or ``~/.config/gdb/gdbinit``)::" msgstr "" +"お使いの GDB で手順が表示されない場合は、設定ファイル (``~/.gdbinit`` または " +"``~/.config/gdb/gdbinit``) に次を記述してください。 ::" -#: ../../howto/gdb_helpers.rst:68 msgid "add-auto-load-safe-path /path/to/cpython" -msgstr "" +msgstr "add-auto-load-safe-path /path/to/cpython" -#: ../../howto/gdb_helpers.rst:70 msgid "You can also add multiple paths, separated by ``:``." -msgstr "" +msgstr "``:`` で区切って複数のパスを追加することもできます。" -#: ../../howto/gdb_helpers.rst:74 msgid "Setup for Python from a Linux distro" -msgstr "" +msgstr "Linux ディストリビューションの Python での設定" -#: ../../howto/gdb_helpers.rst:76 msgid "" "Most Linux systems provide debug information for the system Python in a " "package called ``python-debuginfo``, ``python-dbg`` or similar. For example:" msgstr "" +"多くの Linux システムでは、システムの Python のデバッグ情報を ``python-" +"debuginfo`` や ``python-dbg`` などの名前のパッケージで提供しています。\n" +"例えば:" -#: ../../howto/gdb_helpers.rst:80 msgid "Fedora:" -msgstr "" +msgstr "Fedora:" -#: ../../howto/gdb_helpers.rst:82 msgid "" "sudo dnf install gdb\n" "sudo dnf debuginfo-install python3" msgstr "" +"sudo dnf install gdb\n" +"sudo dnf debuginfo-install python3" -#: ../../howto/gdb_helpers.rst:87 msgid "Ubuntu:" -msgstr "" +msgstr "Ubuntu:" -#: ../../howto/gdb_helpers.rst:89 msgid "sudo apt install gdb python3-dbg" -msgstr "" +msgstr "sudo apt install gdb python3-dbg" -#: ../../howto/gdb_helpers.rst:93 msgid "" "On several recent Linux systems, GDB can download debugging symbols " "automatically using *debuginfod*. However, this will not install the " "``python-gdb.py`` extension; you generally do need to install the debug info " "package separately." msgstr "" +"最近の Linux システムの一部では、GDB が *debuginfod* を使ってデバッグシンボル" +"を自動的にダウンロードできます。\n" +"ただし、これでは ``python-gdb.py`` 拡張はインストールされません。\n" +"通常はデバッグ情報のパッケージを別途インストールする必要があります。" -#: ../../howto/gdb_helpers.rst:100 msgid "Using the Debug build and Development mode" -msgstr "" +msgstr "デバッグビルドと開発モードの利用" -#: ../../howto/gdb_helpers.rst:102 msgid "For easier debugging, you might want to:" -msgstr "" +msgstr "デバッグを容易にするため、次の方法も検討してください:" -#: ../../howto/gdb_helpers.rst:104 msgid "" "Use a :ref:`debug build ` of Python. (When building from " "source, use ``configure --with-pydebug``. On Linux distros, install and run " "a package like ``python-debug`` or ``python-dbg``, if available.)" msgstr "" +"Python の :ref:`デバッグビルド ` を使う。(ソースからビルドする場" +"合は ``configure --with-pydebug`` を使います。Linux ディストリビューションで" +"は、``python-debug`` や ``python-dbg`` などのパッケージがあればインストールし" +"て実行します。)" -#: ../../howto/gdb_helpers.rst:107 msgid "Use the runtime :ref:`development mode ` (``-X dev``)." -msgstr "" +msgstr "実行時の :ref:`開発モード ` (``-X dev``) を使う。" #: ../../howto/gdb_helpers.rst:109 msgid "" @@ -189,25 +204,25 @@ msgid "" "process easier." msgstr "" -#: ../../howto/gdb_helpers.rst:115 msgid "Using the ``python-gdb`` extension" -msgstr "" +msgstr "``python-gdb`` 拡張の利用" -#: ../../howto/gdb_helpers.rst:117 msgid "" "When the extension is loaded, it provides two main features: pretty printers " "for Python values, and additional commands." msgstr "" +"この拡張を読み込むと、主に二つの機能が利用できます。\n" +"Python の値を整形して表示するプリティプリンタと、追加のコマンドです。" -#: ../../howto/gdb_helpers.rst:121 msgid "Pretty-printers" -msgstr "" +msgstr "プリティプリンタ" -#: ../../howto/gdb_helpers.rst:123 msgid "" "This is what a GDB backtrace looks like (truncated) when this extension is " "enabled::" msgstr "" +"この拡張を有効にすると、GDB のバックトレースは次のようになります (一部省" +"略)。 ::" #: ../../howto/gdb_helpers.rst:126 msgid "" @@ -240,21 +255,24 @@ msgid "" " 0x5c2b8d \"__lltrace__\") at Objects/dictobject.c:2171" msgstr "" -#: ../../howto/gdb_helpers.rst:142 msgid "" "Notice how the dictionary argument to ``PyDict_GetItemString`` is displayed " "as its ``repr()``, rather than an opaque ``PyObject *`` pointer." msgstr "" +"``PyDict_GetItemString`` の引数の辞書が、内部の分からない ``PyObject *`` ポイ" +"ンタではなく ``repr()`` の結果として表示されている点に注目してください。" -#: ../../howto/gdb_helpers.rst:145 msgid "" "The extension works by supplying a custom printing routine for values of " "type ``PyObject *``. If you need to access lower-level details of an " "object, then cast the value to a pointer of the appropriate type. For " "example::" msgstr "" +"この拡張は ``PyObject *`` 型の値に専用の表示処理を提供します。\n" +"オブジェクトの低レベルの詳細を調べるには、適切な型のポインタにキャストしてく" +"ださい。\n" +"例えば次のようにします。 ::" -#: ../../howto/gdb_helpers.rst:149 msgid "" "(gdb) p globals\n" "$1 = {'__builtins__': , '__name__':\n" @@ -275,14 +293,32 @@ msgid "" "{me_hash = 0, me_key = 0x0, me_value = 0x0}, {\n" " me_hash = 6614918939584953775, me_key = '__package__', me_value = None}}}" msgstr "" +"(gdb) p globals\n" +"$1 = {'__builtins__': , '__name__':\n" +"'__main__', 'ctypes': , '__doc__': None,\n" +"'__package__': None}\n" +"\n" +"(gdb) p *(PyDictObject*)globals\n" +"$2 = {ob_refcnt = 3, ob_type = 0x3dbdf85820, ma_fill = 5, ma_used = 5,\n" +"ma_mask = 7, ma_table = 0x63d0f8, ma_lookup = 0x3dbdc7ea70\n" +", ma_smalltable = {{me_hash = 7065186196740147912,\n" +"me_key = '__builtins__', me_value = },\n" +"{me_hash = -368181376027291943, me_key = '__name__',\n" +"me_value ='__main__'}, {me_hash = 0, me_key = 0x0, me_value = 0x0},\n" +"{me_hash = 0, me_key = 0x0, me_value = 0x0},\n" +"{me_hash = -9177857982131165996, me_key = 'ctypes',\n" +"me_value = },\n" +"{me_hash = -8518757509529533123, me_key = '__doc__', me_value = None},\n" +"{me_hash = 0, me_key = 0x0, me_value = 0x0}, {\n" +" me_hash = 6614918939584953775, me_key = '__package__', me_value = None}}}" -#: ../../howto/gdb_helpers.rst:168 msgid "" "Note that the pretty-printers do not actually call ``repr()``. For basic " "types, they try to match its result closely." msgstr "" +"プリティプリンタは実際に ``repr()`` を呼び出すわけではありません。\n" +"基本的な型では、その結果にできるだけ近い表示を行います。" -#: ../../howto/gdb_helpers.rst:171 msgid "" "An area that can be confusing is that the custom printer for some types look " "a lot like GDB's built-in printer for standard types. For example, the " @@ -290,8 +326,11 @@ msgid "" "representation that is not distinguishable from one of a regular machine-" "level integer::" msgstr "" +"一部の型の専用の表示処理は、標準の型に対する GDB 組み込みの表示処理とよく似て" +"いるため、混同しやすいことがあります。\n" +"例えば Python の ``int`` (:c:expr:`PyLongObject *`) のプリティプリンタによる" +"表示は、通常の機械レベルの整数の表示と区別がつきません。 ::" -#: ../../howto/gdb_helpers.rst:177 msgid "" "(gdb) p some_machine_integer\n" "$3 = 42\n" @@ -299,71 +338,88 @@ msgid "" "(gdb) p some_python_integer\n" "$4 = 42" msgstr "" +"(gdb) p some_machine_integer\n" +"$3 = 42\n" +"\n" +"(gdb) p some_python_integer\n" +"$4 = 42" -#: ../../howto/gdb_helpers.rst:183 msgid "" "The internal structure can be revealed with a cast to :c:expr:`PyLongObject " "*`::" -msgstr "" +msgstr ":c:expr:`PyLongObject *` にキャストすると内部構造を確認できます。 ::" -#: ../../howto/gdb_helpers.rst:185 msgid "" "(gdb) p *(PyLongObject*)some_python_integer\n" "$5 = {ob_base = {ob_base = {ob_refcnt = 8, ob_type = 0x3dad39f5e0}, ob_size " "= 1},\n" "ob_digit = {42}}" msgstr "" +"(gdb) p *(PyLongObject*)some_python_integer\n" +"$5 = {ob_base = {ob_base = {ob_refcnt = 8, ob_type = 0x3dad39f5e0}, ob_size " +"= 1},\n" +"ob_digit = {42}}" -#: ../../howto/gdb_helpers.rst:189 msgid "" "A similar confusion can arise with the ``str`` type, where the output looks " "a lot like gdb's built-in printer for ``char *``::" msgstr "" +"``str`` 型でも、GDB 組み込みの ``char *`` の表示とよく似ているため、同様に混" +"同しやすいことがあります。 ::" -#: ../../howto/gdb_helpers.rst:192 msgid "" "(gdb) p ptr_to_python_str\n" "$6 = '__builtins__'" msgstr "" +"(gdb) p ptr_to_python_str\n" +"$6 = '__builtins__'" -#: ../../howto/gdb_helpers.rst:195 msgid "" "The pretty-printer for ``str`` instances defaults to using single-quotes (as " "does Python's ``repr`` for strings) whereas the standard printer for ``char " "*`` values uses double-quotes and contains a hexadecimal address::" msgstr "" +"``str`` インスタンスのプリティプリンタは、デフォルトでシングルクォートを使い" +"ます (Python の文字列の ``repr`` と同様です)。\n" +"一方、``char *`` の標準の表示はダブルクォートを使い、16 進数のアドレスも含み" +"ます。 ::" -#: ../../howto/gdb_helpers.rst:199 msgid "" "(gdb) p ptr_to_char_star\n" "$7 = 0x6d72c0 \"hello world\"" msgstr "" +"(gdb) p ptr_to_char_star\n" +"$7 = 0x6d72c0 \"hello world\"" -#: ../../howto/gdb_helpers.rst:202 msgid "" "Again, the implementation details can be revealed with a cast to :c:expr:" "`PyUnicodeObject *`::" msgstr "" +"この場合も :c:expr:`PyUnicodeObject *` にキャストすると実装の詳細を確認できま" +"す。 ::" -#: ../../howto/gdb_helpers.rst:205 msgid "" "(gdb) p *(PyUnicodeObject*)$6\n" "$8 = {ob_base = {ob_refcnt = 33, ob_type = 0x3dad3a95a0}, length = 12,\n" "str = 0x7ffff2128500, hash = 7065186196740147912, state = 1, defenc = 0x0}" msgstr "" +"(gdb) p *(PyUnicodeObject*)$6\n" +"$8 = {ob_base = {ob_refcnt = 33, ob_type = 0x3dad3a95a0}, length = 12,\n" +"str = 0x7ffff2128500, hash = 7065186196740147912, state = 1, defenc = 0x0}" -#: ../../howto/gdb_helpers.rst:210 msgid "``py-list``" -msgstr "" +msgstr "``py-list``" -#: ../../howto/gdb_helpers.rst:212 msgid "" "The extension adds a ``py-list`` command, which lists the Python source code " "(if any) for the current frame in the selected thread. The current line is " "marked with a \">\"::" msgstr "" +"この拡張は ``py-list`` コマンドを追加します。\n" +"このコマンドは選択中のスレッドの現在のフレームに対応する Python ソースコード" +"があれば、それを表示します。\n" +"現在の行には \">\" が付きます。 ::" -#: ../../howto/gdb_helpers.rst:216 msgid "" "(gdb) py-list\n" " 901 if options.profile:\n" @@ -378,24 +434,37 @@ msgid "" " 910 except KeyboardInterrupt:\n" " 911 # properly quit on a keyboard interrupt..." msgstr "" +"(gdb) py-list\n" +" 901 if options.profile:\n" +" 902 options.profile = False\n" +" 903 profile_me()\n" +" 904 return\n" +" 905\n" +">906 u = UI()\n" +" 907 if not u.quit:\n" +" 908 try:\n" +" 909 gtk.main()\n" +" 910 except KeyboardInterrupt:\n" +" 911 # properly quit on a keyboard interrupt..." -#: ../../howto/gdb_helpers.rst:229 msgid "" "Use ``py-list START`` to list at a different line number within the Python " "source, and ``py-list START,END`` to list a specific range of lines within " "the Python source." msgstr "" +"Python ソース内の別の行から表示するには ``py-list START`` を、特定の行範囲を" +"表示するには ``py-list START,END`` を使います。" -#: ../../howto/gdb_helpers.rst:234 msgid "``py-up`` and ``py-down``" -msgstr "" +msgstr "``py-up`` と ``py-down``" -#: ../../howto/gdb_helpers.rst:236 msgid "" "The ``py-up`` and ``py-down`` commands are analogous to GDB's regular ``up`` " "and ``down`` commands, but try to move at the level of CPython frames, " "rather than C frames." msgstr "" +"``py-up`` と ``py-down`` は GDB の通常の ``up`` と ``down`` に相当するコマン" +"ドですが、C のフレームではなく CPython のフレーム単位で移動しようとします。" #: ../../howto/gdb_helpers.rst:240 msgid "" @@ -406,15 +475,13 @@ msgid "" "look up the value of the related ``PyFrameObject *``." msgstr "" -#: ../../howto/gdb_helpers.rst:246 msgid "They emit the frame number (at the C level) within the thread." -msgstr "" +msgstr "これらのコマンドはスレッド内の (C レベルの) フレーム番号を表示します。" #: ../../howto/gdb_helpers.rst:248 ../../howto/gdb_helpers.rst:320 msgid "For example::" msgstr "例えば::" -#: ../../howto/gdb_helpers.rst:250 msgid "" "(gdb) py-up\n" "#37 Frame 0x9420b04, for file /usr/lib/python2.6/site-packages/\n" @@ -428,23 +495,33 @@ msgid "" "(gdb) py-up\n" "Unable to find an older python frame" msgstr "" +"(gdb) py-up\n" +"#37 Frame 0x9420b04, for file /usr/lib/python2.6/site-packages/\n" +"gnome_sudoku/main.py, line 906, in start_game ()\n" +" u = UI()\n" +"(gdb) py-up\n" +"#40 Frame 0x948e82c, for file /usr/lib/python2.6/site-packages/\n" +"gnome_sudoku/gnome_sudoku.py, line 22, in start_game(main=)\n" +" main.start_game()\n" +"(gdb) py-up\n" +"Unable to find an older python frame" -#: ../../howto/gdb_helpers.rst:261 msgid "so we're at the top of the Python stack." -msgstr "" +msgstr "これで Python スタックの先頭に到達しました。" -#: ../../howto/gdb_helpers.rst:263 msgid "" "The frame numbers correspond to those displayed by GDB's standard " "``backtrace`` command. The command skips C frames which are not executing " "Python code." msgstr "" +"フレーム番号は GDB の標準の ``backtrace`` コマンドで表示されるものと対応しま" +"す。\n" +"Python コードを実行していない C のフレームはスキップされます。" -#: ../../howto/gdb_helpers.rst:267 msgid "Going back down::" -msgstr "" +msgstr "逆向きに戻ると次のようになります。 ::" -#: ../../howto/gdb_helpers.rst:269 msgid "" "(gdb) py-down\n" "#37 Frame 0x9420b04, for file /usr/lib/python2.6/site-packages/gnome_sudoku/" @@ -484,19 +561,58 @@ msgid "" "(gdb) py-down\n" "Unable to find a newer python frame" msgstr "" +"(gdb) py-down\n" +"#37 Frame 0x9420b04, for file /usr/lib/python2.6/site-packages/gnome_sudoku/" +"main.py, line 906, in start_game ()\n" +" u = UI()\n" +"(gdb) py-down\n" +"#34 (unable to read python frame information)\n" +"(gdb) py-down\n" +"#23 (unable to read python frame information)\n" +"(gdb) py-down\n" +"#19 (unable to read python frame information)\n" +"(gdb) py-down\n" +"#14 Frame 0x99262ac, for file /usr/lib/python2.6/site-packages/gnome_sudoku/" +"game_selector.py, line 201, in run_swallowed_dialog " +"(self=, puzzle=None, saved_games=[{'gsd.auto_fills': 0, 'tracking': {}, " +"'trackers': {}, 'notes': [], 'saved_at': 1270084485, 'game': '7 8 0 0 0 0 0 " +"5 6 0 0 9 0 8 0 1 0 0 0 4 6 0 0 0 0 7 0 6 5 0 0 0 4 7 9 2 0 0 0 9 0 1 0 0 0 " +"3 9 7 6 0 0 0 1 8 0 6 0 0 0 0 2 8 0 0 0 5 0 4 0 6 0 0 2 1 0 0 0 0 0 4 5\\n7 " +"8 0 0 0 0 0 5 6 0 0 9 0 8 0 1 0 0 0 4 6 0 0 0 0 7 0 6 5 1 8 3 4 7 9 2 0 0 0 " +"9 0 1 0 0 0 3 9 7 6 0 0 0 1 8 0 6 0 0 0 0 2 8 0 0 0 5 0 4 0 6 0 0 2 1 0 0 0 " +"0 0 4 5', 'gsd.impossible_hints': 0, 'timer.__absolute_start_time__': , 'gsd.hints': 0, 'timer.active_time': , 'timer.total_time': }], dialog=, saved_game_model=, sudoku_maker=, main_page=0) " +"at remote 0x98fa6e4>, d=)\n" +" gtk.main()\n" +"(gdb) py-down\n" +"#8 (unable to read python frame information)\n" +"(gdb) py-down\n" +"Unable to find a newer python frame" -#: ../../howto/gdb_helpers.rst:289 msgid "and we're at the bottom of the Python stack." -msgstr "" +msgstr "これで Python スタックの末尾に到達しました。" -#: ../../howto/gdb_helpers.rst:291 msgid "" "Note that in Python 3.12 and newer, the same C stack frame can be used for " "multiple Python stack frames. This means that ``py-up`` and ``py-down`` may " "move multiple Python frames at once. For example::" msgstr "" +"Python 3.12 以降では、複数の Python スタックフレームが同じ C スタックフレーム" +"を使うことがあります。\n" +"このため ``py-up`` と ``py-down`` は複数の Python フレームを一度に移動する場" +"合があります。\n" +"例えば次のようになります。 ::" -#: ../../howto/gdb_helpers.rst:295 msgid "" "(gdb) py-up\n" "#6 Frame 0x7ffff7fb62b0, for file /tmp/rec.py, line 5, in recursive_function " @@ -522,18 +638,40 @@ msgid "" "(gdb) py-up\n" "Unable to find an older python frame" msgstr "" +"(gdb) py-up\n" +"#6 Frame 0x7ffff7fb62b0, for file /tmp/rec.py, line 5, in recursive_function " +"(n=0)\n" +" time.sleep(5)\n" +"#6 Frame 0x7ffff7fb6240, for file /tmp/rec.py, line 7, in recursive_function " +"(n=1)\n" +" recursive_function(n-1)\n" +"#6 Frame 0x7ffff7fb61d0, for file /tmp/rec.py, line 7, in recursive_function " +"(n=2)\n" +" recursive_function(n-1)\n" +"#6 Frame 0x7ffff7fb6160, for file /tmp/rec.py, line 7, in recursive_function " +"(n=3)\n" +" recursive_function(n-1)\n" +"#6 Frame 0x7ffff7fb60f0, for file /tmp/rec.py, line 7, in recursive_function " +"(n=4)\n" +" recursive_function(n-1)\n" +"#6 Frame 0x7ffff7fb6080, for file /tmp/rec.py, line 7, in recursive_function " +"(n=5)\n" +" recursive_function(n-1)\n" +"#6 Frame 0x7ffff7fb6020, for file /tmp/rec.py, line 9, in ()\n" +" recursive_function(5)\n" +"(gdb) py-up\n" +"Unable to find an older python frame" -#: ../../howto/gdb_helpers.rst:315 msgid "``py-bt``" -msgstr "" +msgstr "``py-bt``" -#: ../../howto/gdb_helpers.rst:317 msgid "" "The ``py-bt`` command attempts to display a Python-level backtrace of the " "current thread." msgstr "" +"``py-bt`` コマンドは現在のスレッドの Python レベルのバックトレースを表示しよ" +"うとします。" -#: ../../howto/gdb_helpers.rst:322 msgid "" "(gdb) py-bt\n" "#8 (unable to read python frame information)\n" @@ -569,25 +707,59 @@ msgid "" "0xb771b7f4>)\n" " main.start_game()" msgstr "" +"(gdb) py-bt\n" +"#8 (unable to read python frame information)\n" +"#11 Frame 0x9aead74, for file /usr/lib/python2.6/site-packages/gnome_sudoku/" +"dialog_swallower.py, line 48, in run_dialog " +"(self=, main_page=0) " +"at remote 0x98fa6e4>, d=)\n" +" gtk.main()\n" +"#14 Frame 0x99262ac, for file /usr/lib/python2.6/site-packages/gnome_sudoku/" +"game_selector.py, line 201, in run_swallowed_dialog " +"(self=, puzzle=None, saved_games=[{'gsd.auto_fills': 0, 'tracking': {}, " +"'trackers': {}, 'notes': [], 'saved_at': 1270084485, 'game': '7 8 0 0 0 0 0 " +"5 6 0 0 9 0 8 0 1 0 0 0 4 6 0 0 0 0 7 0 6 5 0 0 0 4 7 9 2 0 0 0 9 0 1 0 0 0 " +"3 9 7 6 0 0 0 1 8 0 6 0 0 0 0 2 8 0 0 0 5 0 4 0 6 0 0 2 1 0 0 0 0 0 4 5\\n7 " +"8 0 0 0 0 0 5 6 0 0 9 0 8 0 1 0 0 0 4 6 0 0 0 0 7 0 6 5 1 8 3 4 7 9 2 0 0 0 " +"9 0 1 0 0 0 3 9 7 6 0 0 0 1 8 0 6 0 0 0 0 2 8 0 0 0 5 0 4 0 6 0 0 2 1 0 0 0 " +"0 0 4 5', 'gsd.impossible_hints': 0, 'timer.__absolute_start_time__': , 'gsd.hints': 0, 'timer.active_time': , 'timer.total_time': }], dialog=, saved_game_model=, sudoku_maker=)\n" +" main.start_game()" -#: ../../howto/gdb_helpers.rst:336 msgid "" "The frame numbers correspond to those displayed by GDB's standard " "``backtrace`` command." msgstr "" +"フレーム番号は GDB の標準の ``backtrace`` コマンドで表示されるものと対応しま" +"す。" -#: ../../howto/gdb_helpers.rst:340 msgid "``py-print``" -msgstr "" +msgstr "``py-print``" -#: ../../howto/gdb_helpers.rst:342 msgid "" "The ``py-print`` command looks up a Python name and tries to print it. It " "looks in locals within the current thread, then globals, then finally " "builtins::" msgstr "" +"``py-print`` コマンドは Python の名前を検索し、その値を表示しようとします。\n" +"現在のスレッドのローカル変数、グローバル変数、組み込みの名前の順に検索しま" +"す。 ::" -#: ../../howto/gdb_helpers.rst:346 msgid "" "(gdb) py-print self\n" "local 'self' = ,\n" @@ -599,38 +771,51 @@ msgid "" "(gdb) py-print scarlet_pimpernel\n" "'scarlet_pimpernel' not found" msgstr "" +"(gdb) py-print self\n" +"local 'self' = ,\n" +"main_page=0) at remote 0x98fa6e4>\n" +"(gdb) py-print __name__\n" +"global '__name__' = 'gnome_sudoku.dialog_swallower'\n" +"(gdb) py-print len\n" +"builtin 'len' = \n" +"(gdb) py-print scarlet_pimpernel\n" +"'scarlet_pimpernel' not found" -#: ../../howto/gdb_helpers.rst:356 msgid "" "If the current C frame corresponds to multiple Python frames, ``py-print`` " "only considers the first one." msgstr "" +"現在の C フレームが複数の Python フレームに対応する場合、``py-print`` は最初" +"のものだけを対象にします。" -#: ../../howto/gdb_helpers.rst:360 msgid "``py-locals``" -msgstr "" +msgstr "``py-locals``" -#: ../../howto/gdb_helpers.rst:362 msgid "" "The ``py-locals`` command looks up all Python locals within the current " "Python frame in the selected thread, and prints their representations::" msgstr "" +"``py-locals`` コマンドは、選択中のスレッドの現在の Python フレームにあるすべ" +"てのローカル変数を調べ、それぞれの値の表現を表示します。 ::" -#: ../../howto/gdb_helpers.rst:365 msgid "" "(gdb) py-locals\n" "self = ,\n" "main_page=0) at remote 0x98fa6e4>\n" "d = " msgstr "" +"(gdb) py-locals\n" +"self = ,\n" +"main_page=0) at remote 0x98fa6e4>\n" +"d = " -#: ../../howto/gdb_helpers.rst:370 msgid "" "If the current C frame corresponds to multiple Python frames, locals from " "all of them will be shown::" msgstr "" +"現在の C フレームが複数の Python フレームに対応する場合、すべてのフレームの" +"ローカル変数が表示されます。 ::" -#: ../../howto/gdb_helpers.rst:373 msgid "" "(gdb) py-locals\n" "Locals for recursive_function\n" @@ -647,19 +832,33 @@ msgid "" "n = 5\n" "Locals for " msgstr "" +"(gdb) py-locals\n" +"Locals for recursive_function\n" +"n = 0\n" +"Locals for recursive_function\n" +"n = 1\n" +"Locals for recursive_function\n" +"n = 2\n" +"Locals for recursive_function\n" +"n = 3\n" +"Locals for recursive_function\n" +"n = 4\n" +"Locals for recursive_function\n" +"n = 5\n" +"Locals for " -#: ../../howto/gdb_helpers.rst:390 msgid "Use with GDB commands" -msgstr "" +msgstr "GDB コマンドとの併用" -#: ../../howto/gdb_helpers.rst:392 msgid "" "The extension commands complement GDB's built-in commands. For example, you " "can use a frame numbers shown by ``py-bt`` with the ``frame`` command to go " "a specific frame within the selected thread, like this::" msgstr "" +"拡張のコマンドは GDB 組み込みのコマンドを補完します。\n" +"例えば、``py-bt`` が表示するフレーム番号を ``frame`` コマンドに渡すと、選択中" +"のスレッドの特定のフレームに移動できます。 ::" -#: ../../howto/gdb_helpers.rst:396 msgid "" "(gdb) py-bt\n" "(output snipped)\n" @@ -682,14 +881,34 @@ msgid "" "1547 with test_support.temp_cwd(TESTCWD, quiet=True):\n" ">1548 main()" msgstr "" +"(gdb) py-bt\n" +"(output snipped)\n" +"#68 Frame 0xaa4560, for file Lib/test/regrtest.py, line 1548, in " +"()\n" +" main()\n" +"(gdb) frame 68\n" +"#68 0x00000000004cd1e6 in PyEval_EvalFrameEx (f=Frame 0xaa4560, for file Lib/" +"test/regrtest.py, line 1548, in (), throwflag=0) at Python/ceval." +"c:2665\n" +"2665 x = call_function(&sp, oparg);\n" +"(gdb) py-list\n" +"1543 # Run the tests in a context manager that temporary changes the " +"CWD to a\n" +"1544 # temporary and writable directory. If it's not possible to " +"create or\n" +"1545 # change the CWD, the original CWD will be used. The original " +"CWD is\n" +"1546 # available from test_support.SAVEDCWD.\n" +"1547 with test_support.temp_cwd(TESTCWD, quiet=True):\n" +">1548 main()" -#: ../../howto/gdb_helpers.rst:411 msgid "" "The ``info threads`` command will give you a list of the threads within the " "process, and you can use the ``thread`` command to select a different one::" msgstr "" +"``info threads`` コマンドはプロセス内のスレッドの一覧を表示します。\n" +"``thread`` コマンドを使うと別のスレッドを選択できます。 ::" -#: ../../howto/gdb_helpers.rst:414 msgid "" "(gdb) info threads\n" " 105 Thread 0x7fffefa18710 (LWP 10260) sem_wait () at ../nptl/sysdeps/unix/" @@ -699,15 +918,24 @@ msgid "" "* 1 Thread 0x7ffff7fe2700 (LWP 10145) 0x00000038e46d73e3 in select () at ../" "sysdeps/unix/syscall-template.S:82" msgstr "" +"(gdb) info threads\n" +" 105 Thread 0x7fffefa18710 (LWP 10260) sem_wait () at ../nptl/sysdeps/unix/" +"sysv/linux/x86_64/sem_wait.S:86\n" +" 104 Thread 0x7fffdf5fe710 (LWP 10259) sem_wait () at ../nptl/sysdeps/unix/" +"sysv/linux/x86_64/sem_wait.S:86\n" +"* 1 Thread 0x7ffff7fe2700 (LWP 10145) 0x00000038e46d73e3 in select () at ../" +"sysdeps/unix/syscall-template.S:82" -#: ../../howto/gdb_helpers.rst:419 msgid "" "You can use ``thread apply all COMMAND`` or (``t a a COMMAND`` for short) to " "run a command on all threads. With ``py-bt``, this lets you see what every " "thread is doing at the Python level::" msgstr "" +"``thread apply all COMMAND`` (省略形は ``t a a COMMAND``) を使うと、すべての" +"スレッドでコマンドを実行できます。\n" +"``py-bt`` と組み合わせると、各スレッドが Python レベルで何を実行しているか確" +"認できます。 ::" -#: ../../howto/gdb_helpers.rst:423 msgid "" "(gdb) t a a py-bt\n" "\n" @@ -787,3 +1015,80 @@ msgid "" ", , _RLock__count=1) at remote " +"0xd7ff40>, count_owner=(1, 140737213728528), count=1, " +"owner=140737213728528)\n" +" self.__block.acquire()\n" +"#8 Frame 0x7fffac001640, for file /home/david/coding/python-svn/Lib/" +"threading.py, line 269, in wait " +"(self=<_Condition(_Condition__lock=<_RLock(_Verbose__verbose=False, " +"_RLock__owner=140737354016512, _RLock__block=, _RLock__count=1) at remote 0xd7ff40>, acquire=, _is_owned=, " +"_release_save=, release=, _acquire_restore=, " +"_Verbose__verbose=False, _Condition__waiters=[]) at remote 0xd7fd10>, " +"timeout=None, waiter=, saved_state=(1, " +"140737213728528))\n" +" self._acquire_restore(saved_state)\n" +"#12 Frame 0x7fffb8001a10, for file /home/david/coding/python-svn/Lib/test/" +"lock_tests.py, line 348, in f ()\n" +" cond.wait()\n" +"#16 Frame 0x7fffb8001c40, for file /home/david/coding/python-svn/Lib/test/" +"lock_tests.py, line 37, in task (tid=140737213728528)\n" +" f()\n" +"\n" +"Thread 104 (Thread 0x7fffdf5fe710 (LWP 10259)):\n" +"#5 Frame 0x7fffe4001580, for file /home/david/coding/python-svn/Lib/" +"threading.py, line 155, in _acquire_restore " +"(self=<_RLock(_Verbose__verbose=False, _RLock__owner=140737354016512, " +"_RLock__block=, _RLock__count=1) at remote " +"0xd7ff40>, count_owner=(1, 140736940992272), count=1, " +"owner=140736940992272)\n" +" self.__block.acquire()\n" +"#8 Frame 0x7fffc8002090, for file /home/david/coding/python-svn/Lib/" +"threading.py, line 269, in wait " +"(self=<_Condition(_Condition__lock=<_RLock(_Verbose__verbose=False, " +"_RLock__owner=140737354016512, _RLock__block=, _RLock__count=1) at remote 0xd7ff40>, acquire=, _is_owned=, " +"_release_save=, release=, _acquire_restore=, " +"_Verbose__verbose=False, _Condition__waiters=[]) at remote 0xd7fd10>, " +"timeout=None, waiter=, saved_state=(1, " +"140736940992272))\n" +" self._acquire_restore(saved_state)\n" +"#12 Frame 0x7fffac001c90, for file /home/david/coding/python-svn/Lib/test/" +"lock_tests.py, line 348, in f ()\n" +" cond.wait()\n" +"#16 Frame 0x7fffac0011c0, for file /home/david/coding/python-svn/Lib/test/" +"lock_tests.py, line 37, in task (tid=140736940992272)\n" +" f()\n" +"\n" +"Thread 1 (Thread 0x7ffff7fe2700 (LWP 10145)):\n" +"#5 Frame 0xcb5380, for file /home/david/coding/python-svn/Lib/test/" +"lock_tests.py, line 16, in _wait ()\n" +" time.sleep(0.01)\n" +"#8 Frame 0x7fffd00024a0, for file /home/david/coding/python-svn/Lib/test/" +"lock_tests.py, line 378, in _check_notify " +"(self=, skipped=[], _mirrorOutput=False, testsRun=39, " +"buffer=False, _original_stderr=, " +"_stdout_buffer=, " +"_stderr_buffer=, " +"_moduleSetUpFailed=False, expectedFailures=[], errors=[], " +"_previousTestClass=, unexpectedSuccesses=[], " +"failures=[], shouldStop=False, failfast=False) at remote 0xc185a0>, " +"_threads=(0,), _後片付けs=[], _type_equality_funcs={: , : " +", : " +", : " +", `:" msgstr "" +"続いて :option:`--with-dtrace オプションで CPython を構成 <--with-dtrace>` す" +"る必要があります:" -#: ../../howto/instrumentation.rst:52 msgid "checking for --with-dtrace... yes" -msgstr "" +msgstr "checking for --with-dtrace... yes" -#: ../../howto/instrumentation.rst:56 msgid "" "On macOS, you can list available DTrace probes by running a Python process " "in the background and listing all probes made available by the Python " "provider::" msgstr "" +"macOS では Python プロセスをバックグラウンドで実行し、Python プロバイダが提供" +"するすべてのプローブを列挙すると、利用可能な DTrace プローブを確認できま" +"す。 ::" -#: ../../howto/instrumentation.rst:60 msgid "" "$ python3.6 -q &\n" "$ sudo dtrace -l -P python$! # or: dtrace -l -m python3.6\n" @@ -153,37 +152,60 @@ msgid "" "29570 python18035 python3.6 _PyEval_EvalFrameDefault line\n" "29571 python18035 python3.6 maybe_dtrace_line line" msgstr "" +"$ python3.6 -q &\n" +"$ sudo dtrace -l -P python$! # or: dtrace -l -m python3.6\n" +"\n" +" ID PROVIDER MODULE FUNCTION NAME\n" +"29564 python18035 python3.6 _PyEval_EvalFrameDefault " +"function-entry\n" +"29565 python18035 python3.6 dtrace_function_entry " +"function-entry\n" +"29566 python18035 python3.6 _PyEval_EvalFrameDefault " +"function-return\n" +"29567 python18035 python3.6 dtrace_function_return " +"function-return\n" +"29568 python18035 python3.6 collect gc-" +"done\n" +"29569 python18035 python3.6 collect gc-" +"start\n" +"29570 python18035 python3.6 _PyEval_EvalFrameDefault line\n" +"29571 python18035 python3.6 maybe_dtrace_line line" -#: ../../howto/instrumentation.rst:73 msgid "" "On Linux, you can verify if the SystemTap static markers are present in the " "built binary by seeing if it contains a \".note.stapsdt\" section." msgstr "" +"Linux では、ビルドしたバイナリに \".note.stapsdt\" セクションが含まれているか" +"調べると、SystemTap の静的マーカーの有無を確認できます。" -#: ../../howto/instrumentation.rst:78 msgid "" "$ readelf -S ./python | grep .note.stapsdt\n" "[30] .note.stapsdt NOTE 0000000000000000 00308d78" msgstr "" +"$ readelf -S ./python | grep .note.stapsdt\n" +"[30] .note.stapsdt NOTE 0000000000000000 00308d78" -#: ../../howto/instrumentation.rst:81 msgid "" "If you've built Python as a shared library (with the :option:`--enable-" "shared` configure option), you need to look instead within the shared " "library. For example::" msgstr "" +"Python を共有ライブラリとしてビルドした場合 (configure オプション :option:`--" +"enable-shared` を指定した場合) は、共有ライブラリの中を調べる必要がありま" +"す。\n" +"例えば次のようにします。 ::" -#: ../../howto/instrumentation.rst:85 msgid "" "$ readelf -S libpython3.3dm.so.1.0 | grep .note.stapsdt\n" "[29] .note.stapsdt NOTE 0000000000000000 00365b68" msgstr "" +"$ readelf -S libpython3.3dm.so.1.0 | grep .note.stapsdt\n" +"[29] .note.stapsdt NOTE 0000000000000000 00365b68" #: ../../howto/instrumentation.rst:88 msgid "Sufficiently modern readelf can print the metadata::" msgstr "十分に新しい readelf ではメタデータを出力できます::" -#: ../../howto/instrumentation.rst:90 msgid "" "$ readelf -n ./python\n" "\n" @@ -230,27 +252,75 @@ msgid "" "0x00000000008d6bea\n" " Arguments: 8@%rbp 8@%r12 -4@%eax" msgstr "" +"$ readelf -n ./python\n" +"\n" +"Displaying notes found at file offset 0x00000254 with length 0x00000020:\n" +" Owner Data size Description\n" +" GNU 0x00000010 NT_GNU_ABI_TAG (ABI version " +"tag)\n" +" OS: Linux, ABI: 2.6.32\n" +"\n" +"Displaying notes found at file offset 0x00000274 with length 0x00000024:\n" +" Owner Data size Description\n" +" GNU 0x00000014 NT_GNU_BUILD_ID (unique build " +"ID bitstring)\n" +" Build ID: df924a2b08a7e89f6e11251d4602022977af2670\n" +"\n" +"Displaying notes found at file offset 0x002d6c30 with length 0x00000144:\n" +" Owner Data size Description\n" +" stapsdt 0x00000031 NT_STAPSDT (SystemTap probe " +"descriptors)\n" +" Provider: python\n" +" Name: gc__start\n" +" Location: 0x00000000004371c3, Base: 0x0000000000630ce2, Semaphore: " +"0x00000000008d6bf6\n" +" Arguments: -4@%ebx\n" +" stapsdt 0x00000030 NT_STAPSDT (SystemTap probe " +"descriptors)\n" +" Provider: python\n" +" Name: gc__done\n" +" Location: 0x00000000004374e1, Base: 0x0000000000630ce2, Semaphore: " +"0x00000000008d6bf8\n" +" Arguments: -8@%rax\n" +" stapsdt 0x00000045 NT_STAPSDT (SystemTap probe " +"descriptors)\n" +" Provider: python\n" +" Name: function__entry\n" +" Location: 0x000000000053db6c, Base: 0x0000000000630ce2, Semaphore: " +"0x00000000008d6be8\n" +" Arguments: 8@%rbp 8@%r12 -4@%eax\n" +" stapsdt 0x00000046 NT_STAPSDT (SystemTap probe " +"descriptors)\n" +" Provider: python\n" +" Name: function__return\n" +" Location: 0x000000000053dba8, Base: 0x0000000000630ce2, Semaphore: " +"0x00000000008d6bea\n" +" Arguments: 8@%rbp 8@%r12 -4@%eax" -#: ../../howto/instrumentation.rst:125 msgid "" "The above metadata contains information for SystemTap describing how it can " "patch strategically placed machine code instructions to enable the tracing " "hooks used by a SystemTap script." msgstr "" +"上記のメタデータには、SystemTap が適所に配置された機械語命令を書き換え、" +"SystemTap スクリプトで使うトレースフックを有効にするための情報が含まれていま" +"す。" #: ../../howto/instrumentation.rst:131 msgid "Static DTrace probes" msgstr "静的 DTrace プローブ" -#: ../../howto/instrumentation.rst:133 msgid "" "The following example DTrace script can be used to show the call/return " "hierarchy of a Python script, only tracing within the invocation of a " "function called \"start\". In other words, import-time function invocations " "are not going to be listed:" msgstr "" +"次の DTrace スクリプトの例は、Python スクリプトの呼び出しと復帰の階層を表示し" +"ます。\n" +"\"start\" という関数の呼び出し中だけをトレースするため、インポート時の関数呼" +"び出しは表示されません:" -#: ../../howto/instrumentation.rst:138 msgid "" "self int indent;\n" "\n" @@ -286,20 +356,51 @@ msgid "" " self->trace = 0;\n" "}" msgstr "" +"self int indent;\n" +"\n" +"python$target:::function-entry\n" +"/copyinstr(arg1) == \"start\"/\n" +"{\n" +" self->trace = 1;\n" +"}\n" +"\n" +"python$target:::function-entry\n" +"/self->trace/\n" +"{\n" +" printf(\"%d\\t%*s:\", timestamp, 15, probename);\n" +" printf(\"%*s\", self->indent, \"\");\n" +" printf(\"%s:%s:%d\\n\", basename(copyinstr(arg0)), copyinstr(arg1), " +"arg2);\n" +" self->indent++;\n" +"}\n" +"\n" +"python$target:::function-return\n" +"/self->trace/\n" +"{\n" +" self->indent--;\n" +" printf(\"%d\\t%*s:\", timestamp, 15, probename);\n" +" printf(\"%*s\", self->indent, \"\");\n" +" printf(\"%s:%s:%d\\n\", basename(copyinstr(arg0)), copyinstr(arg1), " +"arg2);\n" +"}\n" +"\n" +"python$target:::function-return\n" +"/copyinstr(arg1) == \"start\"/\n" +"{\n" +" self->trace = 0;\n" +"}" #: ../../howto/instrumentation.rst:172 ../../howto/instrumentation.rst:230 msgid "It can be invoked like this::" msgstr "この例は次のように実行できます::" -#: ../../howto/instrumentation.rst:174 msgid "$ sudo dtrace -q -s call_stack.d -c \"python3.6 script.py\"" -msgstr "" +msgstr "$ sudo dtrace -q -s call_stack.d -c \"python3.6 script.py\"" #: ../../howto/instrumentation.rst:176 ../../howto/instrumentation.rst:236 msgid "The output looks like this:" msgstr "出力はこのようになります:" -#: ../../howto/instrumentation.rst:178 msgid "" "156641360502280 function-entry:call_stack.py:start:23\n" "156641360518804 function-entry: call_stack.py:function_1:1\n" @@ -320,17 +421,36 @@ msgid "" "156641360732567 function-return: call_stack.py:function_5:21\n" "156641360747370 function-return:call_stack.py:start:28" msgstr "" +"156641360502280 function-entry:call_stack.py:start:23\n" +"156641360518804 function-entry: call_stack.py:function_1:1\n" +"156641360532797 function-entry: call_stack.py:function_3:9\n" +"156641360546807 function-return: call_stack.py:function_3:10\n" +"156641360563367 function-return: call_stack.py:function_1:2\n" +"156641360578365 function-entry: call_stack.py:function_2:5\n" +"156641360591757 function-entry: call_stack.py:function_1:1\n" +"156641360605556 function-entry: call_stack.py:function_3:9\n" +"156641360617482 function-return: call_stack.py:function_3:10\n" +"156641360629814 function-return: call_stack.py:function_1:2\n" +"156641360642285 function-return: call_stack.py:function_2:6\n" +"156641360656770 function-entry: call_stack.py:function_3:9\n" +"156641360669707 function-return: call_stack.py:function_3:10\n" +"156641360687853 function-entry: call_stack.py:function_4:13\n" +"156641360700719 function-return: call_stack.py:function_4:14\n" +"156641360719640 function-entry: call_stack.py:function_5:18\n" +"156641360732567 function-return: call_stack.py:function_5:21\n" +"156641360747370 function-return:call_stack.py:start:28" #: ../../howto/instrumentation.rst:201 msgid "Static SystemTap markers" msgstr "静的 SystemTap マーカー" -#: ../../howto/instrumentation.rst:203 msgid "" "The low-level way to use the SystemTap integration is to use the static " "markers directly. This requires you to explicitly state the binary file " "containing them." msgstr "" +"SystemTap との連携を低レベルで行う方法は、静的マーカーを直接使うことです。\n" +"この場合、マーカーを含むバイナリファイルを明示する必要があります。" #: ../../howto/instrumentation.rst:207 msgid "" @@ -340,7 +460,6 @@ msgstr "" "例えば、この SystemTap スクリプトは Python の呼び出し/返却 (call/return) 階層" "を表示するのに使えます:" -#: ../../howto/instrumentation.rst:210 msgid "" "probe process(\"python\").mark(\"function__entry\") {\n" " filename = user_string($arg1);\n" @@ -360,15 +479,33 @@ msgid "" " thread_indent(-1), funcname, filename, lineno);\n" "}" msgstr "" +"probe process(\"python\").mark(\"function__entry\") {\n" +" filename = user_string($arg1);\n" +" funcname = user_string($arg2);\n" +" lineno = $arg3;\n" +"\n" +" printf(\"%s => %s in %s:%d\\\\n\",\n" +" thread_indent(1), funcname, filename, lineno);\n" +"}\n" +"\n" +"probe process(\"python\").mark(\"function__return\") {\n" +" filename = user_string($arg1);\n" +" funcname = user_string($arg2);\n" +" lineno = $arg3;\n" +"\n" +" printf(\"%s <= %s in %s:%d\\\\n\",\n" +" thread_indent(-1), funcname, filename, lineno);\n" +"}" -#: ../../howto/instrumentation.rst:232 msgid "" "$ stap \\\n" " show-call-hierarchy.stp \\\n" " -c \"./python test.py\"" msgstr "" +"$ stap \\\n" +" show-call-hierarchy.stp \\\n" +" -c \"./python test.py\"" -#: ../../howto/instrumentation.rst:238 msgid "" "11408 python(8274): => __contains__ in Lib/_abcoll.py:362\n" "11414 python(8274): => __getitem__ in Lib/os.py:425\n" @@ -377,6 +514,12 @@ msgid "" "11428 python(8274): <= __getitem__ in Lib/os.py:426\n" "11433 python(8274): <= __contains__ in Lib/_abcoll.py:366" msgstr "" +"11408 python(8274): => __contains__ in Lib/_abcoll.py:362\n" +"11414 python(8274): => __getitem__ in Lib/os.py:425\n" +"11418 python(8274): => encode in Lib/os.py:490\n" +"11424 python(8274): <= encode in Lib/os.py:493\n" +"11428 python(8274): <= __getitem__ in Lib/os.py:426\n" +"11433 python(8274): <= __contains__ in Lib/_abcoll.py:366" #: ../../howto/instrumentation.rst:247 msgid "where the columns are:" @@ -401,30 +544,31 @@ msgstr "" "そして、残りの部分はスクリプトが実行していた呼び出し/返却階層を表示していま" "す。" -#: ../../howto/instrumentation.rst:255 msgid "" "For a :option:`--enable-shared` build of CPython, the markers are contained " "within the libpython shared library, and the probe's dotted path needs to " "reflect this. For example, this line from the above example:" msgstr "" +":option:`--enable-shared` を指定した CPython のビルドでは、マーカーは " +"libpython 共有ライブラリに含まれるため、プローブのドットで区切ったパスにもそ" +"れを反映する必要があります。\n" +"例えば、上の例の次の行は:" -#: ../../howto/instrumentation.rst:259 msgid "probe process(\"python\").mark(\"function__entry\") {" -msgstr "" +msgstr "probe process(\"python\").mark(\"function__entry\") {" -#: ../../howto/instrumentation.rst:263 msgid "should instead read:" -msgstr "" +msgstr "次のように書き換えます:" -#: ../../howto/instrumentation.rst:265 msgid "" "probe process(\"python\").library(\"libpython3.6dm.so.1.0\")." "mark(\"function__entry\") {" msgstr "" +"probe process(\"python\").library(\"libpython3.6dm.so.1.0\")." +"mark(\"function__entry\") {" -#: ../../howto/instrumentation.rst:269 msgid "(assuming a :ref:`debug build ` of CPython 3.6)" -msgstr "" +msgstr "(CPython 3.6 の :ref:`デバッグビルド ` を想定しています)" #: ../../howto/instrumentation.rst:273 msgid "Available static markers" @@ -438,14 +582,13 @@ msgstr "" "このマーカーは Python の関数の実行が開始されたことを示しています。\n" "このマーカーは、ピュア Python (バイトコード) の関数でしか起動されません。" -#: ../../howto/instrumentation.rst:280 msgid "" "The filename, function name, and line number are provided back to the " "tracing script as positional arguments, which must be accessed using " "``$arg1``, ``$arg2``, ``$arg3``:" msgstr "" -"トレーススクリプトには位置引数として、ファイル名、関数名、行番号が渡され、必" -"ず ``$arg1``, ``$arg2``, ``$arg3`` で渡されます:" +"ファイル名、関数名、行番号が位置引数としてトレーススクリプトに渡されます。\n" +"それぞれ ``$arg1``、``$arg2``、``$arg3`` を使ってアクセスしてください:" #: ../../howto/instrumentation.rst:284 msgid "" @@ -467,16 +610,18 @@ msgstr "" msgid "``$arg3`` : ``int`` line number" msgstr "``$arg3`` : ``int`` 行番号" -#: ../../howto/instrumentation.rst:293 msgid "" "This marker is the converse of :c:func:`!function__entry`, and indicates " "that execution of a Python function has ended (either via ``return``, or via " "an exception). It is only triggered for pure-Python (bytecode) functions." msgstr "" +"このマーカーは :c:func:`!function__entry` と対をなし、Python 関数の実行が終了" +"したことを示します (``return`` による終了と例外による終了の両方を含みま" +"す)。\n" +"ピュア Python (バイトコード) の関数でのみ発火します。" -#: ../../howto/instrumentation.rst:297 msgid "The arguments are the same as for :c:func:`!function__entry`" -msgstr "" +msgstr "引数は :c:func:`!function__entry` と同じです。" #: ../../howto/instrumentation.rst:301 msgid "" @@ -488,58 +633,67 @@ msgstr "" "これは Python プロファイラによる行ごとのトレースと同等です。\n" "このマーカーは C 関数の内部では起動されません。" -#: ../../howto/instrumentation.rst:305 msgid "The arguments are the same as for :c:func:`!function__entry`." -msgstr "" +msgstr "引数は :c:func:`!function__entry` と同じです。" -#: ../../howto/instrumentation.rst:309 msgid "" "Fires when the Python interpreter starts a garbage collection cycle. " "``arg0`` is the generation to scan, like :func:`gc.collect`." msgstr "" +"Python インタプリタがガベージコレクションのサイクルを開始したときに発火しま" +"す。\n" +"``arg0`` は :func:`gc.collect` と同様に、走査する世代を指定します。" -#: ../../howto/instrumentation.rst:314 msgid "" "Fires when the Python interpreter finishes a garbage collection cycle. " "``arg0`` is the number of collected objects." msgstr "" -"Python インタプリタによる循環参照のガベージコレクションが完了したときに発火し" -"ます。\n" +"Python インタプリタがガベージコレクションのサイクルを終了したときに発火しま" +"す。\n" "``arg0`` は回収したオブジェクトの数です。" -#: ../../howto/instrumentation.rst:319 msgid "" "Fires before :mod:`importlib` attempts to find and load the module. ``arg0`` " "is the module name." msgstr "" +":mod:`importlib` がモジュールの検索と読み込みを試みる前に発火します。\n" +"``arg0`` はモジュール名です。" -#: ../../howto/instrumentation.rst:326 msgid "" "Fires after :mod:`importlib`'s find_and_load function is called. ``arg0`` is " "the module name, ``arg1`` indicates if module was successfully loaded." msgstr "" +":mod:`importlib` の find_and_load 関数が呼び出された後に発火します。\n" +"``arg0`` はモジュール名で、``arg1`` はモジュールの読み込みが成功したかどうか" +"を示します。" -#: ../../howto/instrumentation.rst:335 msgid "" "Fires when :func:`sys.audit` or :c:func:`PySys_Audit` is called. ``arg0`` is " "the event name as C string, ``arg1`` is a :c:type:`PyObject` pointer to a " "tuple object." msgstr "" +":func:`sys.audit` または :c:func:`PySys_Audit` が呼び出されたときに発火しま" +"す。\n" +"``arg0`` は C 文字列のイベント名、``arg1`` はタプルオブジェクトへの :c:type:" +"`PyObject` ポインタです。" #: ../../howto/instrumentation.rst:343 msgid "SystemTap Tapsets" msgstr "SystemTap Tapset" -#: ../../howto/instrumentation.rst:345 msgid "" "The higher-level way to use the SystemTap integration is to use a " "\"tapset\": SystemTap's equivalent of a library, which hides some of the " "lower-level details of the static markers." msgstr "" +"SystemTap との連携を高レベルで行う方法は、\"tapset\" を使うことです。\n" +"これは SystemTap のライブラリに相当し、静的マーカーの低レベルの詳細の一部を隠" +"します。" -#: ../../howto/instrumentation.rst:349 msgid "Here is a tapset file, based on a non-shared build of CPython:" msgstr "" +"共有ライブラリを使わない CPython のビルドを対象とする tapset ファイルの例を示" +"します:" #: ../../howto/instrumentation.rst:351 msgid "" @@ -564,17 +718,19 @@ msgid "" "}" msgstr "" -#: ../../howto/instrumentation.rst:372 msgid "" "If this file is installed in SystemTap's tapset directory (e.g. ``/usr/share/" "systemtap/tapset``), then these additional probepoints become available:" msgstr "" +"このファイルを SystemTap の tapset ディレクトリ (例えば ``/usr/share/" +"systemtap/tapset``) にインストールすると、次のプローブポイントが利用できます:" -#: ../../howto/instrumentation.rst:378 msgid "" "This probe point indicates that execution of a Python function has begun. It " "is only triggered for pure-Python (bytecode) functions." msgstr "" +"このプローブポイントは Python 関数の実行が開始されたことを示します。\n" +"ピュア Python (バイトコード) の関数でのみ発火します。" #: ../../howto/instrumentation.rst:383 msgid "" @@ -588,14 +744,15 @@ msgstr "" msgid "Examples" msgstr "使用例" -#: ../../howto/instrumentation.rst:391 msgid "" "This SystemTap script uses the tapset above to more cleanly implement the " "example given above of tracing the Python function-call hierarchy, without " "needing to directly name the static markers:" msgstr "" +"次の SystemTap スクリプトは上の tapset を使い、先ほどの Python 関数の呼び出し" +"階層をトレースする例を簡潔に実装しています。\n" +"静的マーカーの名前を直接指定する必要がありません:" -#: ../../howto/instrumentation.rst:395 msgid "" "probe python.function.entry\n" "{\n" @@ -609,15 +766,28 @@ msgid "" " thread_indent(-1), funcname, filename, lineno);\n" "}" msgstr "" +"probe python.function.entry\n" +"{\n" +" printf(\"%s => %s in %s:%d\\n\",\n" +" thread_indent(1), funcname, filename, lineno);\n" +"}\n" +"\n" +"probe python.function.return\n" +"{\n" +" printf(\"%s <= %s in %s:%d\\n\",\n" +" thread_indent(-1), funcname, filename, lineno);\n" +"}" -#: ../../howto/instrumentation.rst:410 msgid "" "The following script uses the tapset above to provide a top-like view of all " "running CPython code, showing the top 20 most frequently entered bytecode " "frames, each second, across the whole system:" msgstr "" +"次のスクリプトは上の tapset を使い、実行中の CPython コード全体を top のよう" +"に表示します。\n" +"システム全体で最も頻繁に実行が開始されたバイトコードフレームの上位 20 件を毎" +"秒表示します:" -#: ../../howto/instrumentation.rst:414 msgid "" "global fn_calls;\n" "\n" @@ -638,3 +808,21 @@ msgid "" " delete fn_calls;\n" "}" msgstr "" +"global fn_calls;\n" +"\n" +"probe python.function.entry\n" +"{\n" +" fn_calls[pid(), filename, funcname, lineno] += 1;\n" +"}\n" +"\n" +"probe timer.ms(1000) {\n" +" printf(\"\\033[2J\\033[1;1H\") /* clear screen \\*/\n" +" printf(\"%6s %80s %6s %30s %6s\\n\",\n" +" \"PID\", \"FILENAME\", \"LINE\", \"FUNCTION\", \"CALLS\")\n" +" foreach ([pid, filename, funcname, lineno] in fn_calls- limit 20) {\n" +" printf(\"%6d %80s %6d %30s %6d\\n\",\n" +" pid, filename, lineno, funcname,\n" +" fn_calls[pid, filename, funcname, lineno]);\n" +" }\n" +" delete fn_calls;\n" +"}" diff --git a/howto/ipaddress.po b/howto/ipaddress.po index 7d18d2e81..6f7861661 100644 --- a/howto/ipaddress.po +++ b/howto/ipaddress.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: Takanori Suzuki , 2021\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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/ipaddress.rst:9 @@ -128,13 +128,16 @@ msgstr "" "アドレスは整数から直接作成することも可能です。32ビットに収まる値はIPv4アドレ" "スであるとみなされます::" -#: ../../howto/ipaddress.rst:64 msgid "" ">>> ipaddress.ip_address(3221225985)\n" "IPv4Address('192.0.2.1')\n" ">>> ipaddress.ip_address(42540766411282592856903984951653826561)\n" "IPv6Address('2001:db8::1')" msgstr "" +">>> ipaddress.ip_address(3221225985)\n" +"IPv4Address('192.0.2.1')\n" +">>> ipaddress.ip_address(42540766411282592856903984951653826561)\n" +"IPv6Address('2001:db8::1')" #: ../../howto/ipaddress.rst:69 msgid "" @@ -145,7 +148,6 @@ msgstr "" "IPv4またはIPv6アドレスの使用を強制するには、適切なクラスを直接呼び出す必要が" "あります。これは特にIPv6アドレスを小さな整数で作成する場合に役立ちます::" -#: ../../howto/ipaddress.rst:73 msgid "" ">>> ipaddress.ip_address(1)\n" "IPv4Address('0.0.0.1')\n" @@ -154,12 +156,17 @@ msgid "" ">>> ipaddress.IPv6Address(1)\n" "IPv6Address('::1')" msgstr "" +">>> ipaddress.ip_address(1)\n" +"IPv4Address('0.0.0.1')\n" +">>> ipaddress.IPv4Address(1)\n" +"IPv4Address('0.0.0.1')\n" +">>> ipaddress.IPv6Address(1)\n" +"IPv6Address('::1')" #: ../../howto/ipaddress.rst:82 msgid "Defining Networks" msgstr "ネットワークを定義する" -#: ../../howto/ipaddress.rst:84 msgid "" "Host addresses are usually grouped together into IP networks, so :mod:" "`ipaddress` provides a way to create, inspect and manipulate network " @@ -170,29 +177,34 @@ msgid "" "whether or not an address is part of the network and the network address " "defines the expected value of those bits." msgstr "" -"ホストアドレスは通常IPネットワークへ統合され、 :mod:`ipaddress` はネットワー" -"ク定義の作成、検査、操作の手段を提供します。IPネットワークオブジェクトはネッ" -"トワークの一部であるホストアドレスの範囲を定義する文字列から生成されます。こ" -"の情報の最も単純な形式は「ネットワークアドレス/ネットワークプレフィックス」の" -"ペアであり、プレフィックスは先頭のビット数として定義され、アドレスがネット" -"ワークの一部であるかどうか、それらのビットに期待される値がネットワークアドレ" -"スに定義されているかを判断するために比較されます。" +"ホストアドレスは通常 IP ネットワークにまとめられます。\n" +"そのため :mod:`ipaddress` はネットワーク定義を作成、検査、操作する方法を提供" +"しています。\n" +"IP ネットワークオブジェクトは、そのネットワークに属するホストアドレスの範囲を" +"定義する文字列から作成します。\n" +"最も単純な形式は「ネットワークアドレス/ネットワークプレフィックス」の組で" +"す。\n" +"プレフィックスは、アドレスがネットワークに属するかを判定するために比較する、" +"先頭からのビット数を定義します。\n" +"ネットワークアドレスは、そのビット列に期待する値を定義します。" -#: ../../howto/ipaddress.rst:93 msgid "" "As for addresses, a factory function is provided that determines the correct " "IP version automatically::" msgstr "" -"アドレスについては、正しいIPバージョンを自動的に判断するファクトリー関数が提" -"供されます::" +"アドレスと同様に、適切な IP バージョンを自動的に判定するファクトリー関数が用" +"意されています。 ::" -#: ../../howto/ipaddress.rst:96 msgid "" ">>> ipaddress.ip_network('192.0.2.0/24')\n" "IPv4Network('192.0.2.0/24')\n" ">>> ipaddress.ip_network('2001:db8::0/96')\n" "IPv6Network('2001:db8::/96')" msgstr "" +">>> ipaddress.ip_network('192.0.2.0/24')\n" +"IPv4Network('192.0.2.0/24')\n" +">>> ipaddress.ip_network('2001:db8::0/96')\n" +"IPv6Network('2001:db8::/96')" #: ../../howto/ipaddress.rst:101 msgid "" @@ -208,19 +220,17 @@ msgstr "" "トワーク上のネットワークインターフェースを表すのに使用されるため、このような" "定義はインターフェースオブジェクトと呼ばれます。" -#: ../../howto/ipaddress.rst:107 msgid "" "By default, attempting to create a network object with host bits set will " "result in :exc:`ValueError` being raised. To request that the additional " "bits instead be coerced to zero, the flag ``strict=False`` can be passed to " "the constructor::" msgstr "" -"デフォルトでは、ホストビットセットの指定でネットワークオブジェクトを作成しよ" -"うとすると :exc:`ValueError` が発生する結果となります。 ``strict=False`` フラ" -"グをコンストラクタに渡すと、追加分のビットをゼロとして強制的に処理するように" -"要求できます::" +"デフォルトでは、ホスト部のビットに 1 が含まれるネットワークオブジェクトを作成" +"しようとすると :exc:`ValueError` が送出されます。\n" +"コンストラクタに ``strict=False`` を渡すと、代わりにそのビットをゼロにできま" +"す。 ::" -#: ../../howto/ipaddress.rst:112 msgid "" ">>> ipaddress.ip_network('192.0.2.1/24')\n" "Traceback (most recent call last):\n" @@ -229,6 +239,12 @@ msgid "" ">>> ipaddress.ip_network('192.0.2.1/24', strict=False)\n" "IPv4Network('192.0.2.0/24')" msgstr "" +">>> ipaddress.ip_network('192.0.2.1/24')\n" +"Traceback (most recent call last):\n" +" ...\n" +"ValueError: 192.0.2.1/24 has host bits set\n" +">>> ipaddress.ip_network('192.0.2.1/24', strict=False)\n" +"IPv4Network('192.0.2.0/24')" #: ../../howto/ipaddress.rst:119 msgid "" @@ -242,21 +258,23 @@ msgstr "" "特定できる単一のアドレスのみを含むものとして処理され、ネットワークプレフィッ" "クスはネットワークアドレスの全体を含みます::" -#: ../../howto/ipaddress.rst:124 msgid "" ">>> ipaddress.ip_network(3221225984)\n" "IPv4Network('192.0.2.0/32')\n" ">>> ipaddress.ip_network(42540766411282592856903984951653826560)\n" "IPv6Network('2001:db8::/128')" msgstr "" +">>> ipaddress.ip_network(3221225984)\n" +"IPv4Network('192.0.2.0/32')\n" +">>> ipaddress.ip_network(42540766411282592856903984951653826560)\n" +"IPv6Network('2001:db8::/128')" -#: ../../howto/ipaddress.rst:129 msgid "" "As with addresses, creation of a particular kind of network can be forced by " "calling the class constructor directly instead of using the factory function." msgstr "" -"アドレスについては、ファクトリー関数を呼ぶ代わりにクラスコンストラクタを直接" -"呼ぶことで、作成対象のネットワークを特定の種類に強制することができます。" +"アドレスと同様に、ファクトリー関数の代わりにクラスのコンストラクタを直接呼び" +"出すと、作成するネットワークの種類を指定できます。" #: ../../howto/ipaddress.rst:135 msgid "Host Interfaces" @@ -291,9 +309,8 @@ msgstr "" "整数入力は(ネットワークと同様に)受け入れられ、適切なコンストラクタを直接呼び" "出すことで特定のIPバージョンの使用を強制できます。" -#: ../../howto/ipaddress.rst:157 msgid "Inspecting Address/Network/Interface Objects" -msgstr "アドレス/ネットワーク/インターフェースオブジェクト" +msgstr "アドレス/ネットワーク/インターフェースオブジェクトの情報を調べる" #: ../../howto/ipaddress.rst:159 msgid "" @@ -309,7 +326,6 @@ msgstr "" msgid "Extracting the IP version::" msgstr "IPバージョンを抽出する::" -#: ../../howto/ipaddress.rst:165 msgid "" ">>> addr4 = ipaddress.ip_address('192.0.2.1')\n" ">>> addr6 = ipaddress.ip_address('2001:db8::1')\n" @@ -318,12 +334,17 @@ msgid "" ">>> addr4.version\n" "4" msgstr "" +">>> addr4 = ipaddress.ip_address('192.0.2.1')\n" +">>> addr6 = ipaddress.ip_address('2001:db8::1')\n" +">>> addr6.version\n" +"6\n" +">>> addr4.version\n" +"4" #: ../../howto/ipaddress.rst:172 msgid "Obtaining the network from an interface::" msgstr "インターフェースからネットワークを取得する::" -#: ../../howto/ipaddress.rst:174 msgid "" ">>> host4 = ipaddress.ip_interface('192.0.2.1/24')\n" ">>> host4.network\n" @@ -332,12 +353,17 @@ msgid "" ">>> host6.network\n" "IPv6Network('2001:db8::/96')" msgstr "" +">>> host4 = ipaddress.ip_interface('192.0.2.1/24')\n" +">>> host4.network\n" +"IPv4Network('192.0.2.0/24')\n" +">>> host6 = ipaddress.ip_interface('2001:db8::1/96')\n" +">>> host6.network\n" +"IPv6Network('2001:db8::/96')" #: ../../howto/ipaddress.rst:181 msgid "Finding out how many individual addresses are in a network::" msgstr "個別なアドレスがいくつネットワークに存在するかを調べる::" -#: ../../howto/ipaddress.rst:183 msgid "" ">>> net4 = ipaddress.ip_network('192.0.2.0/24')\n" ">>> net4.num_addresses\n" @@ -346,12 +372,17 @@ msgid "" ">>> net6.num_addresses\n" "4294967296" msgstr "" +">>> net4 = ipaddress.ip_network('192.0.2.0/24')\n" +">>> net4.num_addresses\n" +"256\n" +">>> net6 = ipaddress.ip_network('2001:db8::0/96')\n" +">>> net6.num_addresses\n" +"4294967296" #: ../../howto/ipaddress.rst:190 msgid "Iterating through the \"usable\" addresses on a network::" msgstr "「使用可能」なネットワーク上のアドレスを順番にたどる::" -#: ../../howto/ipaddress.rst:192 msgid "" ">>> net4 = ipaddress.ip_network('192.0.2.0/24')\n" ">>> for x in net4.hosts():\n" @@ -365,20 +396,29 @@ msgid "" "192.0.2.253\n" "192.0.2.254" msgstr "" +">>> net4 = ipaddress.ip_network('192.0.2.0/24')\n" +">>> for x in net4.hosts():\n" +"... print(x)\n" +"192.0.2.1\n" +"192.0.2.2\n" +"192.0.2.3\n" +"192.0.2.4\n" +"...\n" +"192.0.2.252\n" +"192.0.2.253\n" +"192.0.2.254" -#: ../../howto/ipaddress.rst:205 msgid "" "Obtaining the netmask (i.e. set bits corresponding to the network prefix) or " "the hostmask (any bits that are not part of the netmask):" msgstr "" -"ネットマスクを取得(例: ネットワークプレフィックスに応じてビットを設定)したり" -"ホストマスク(ネットマスクの一部ではない任意のビット)を取得する:" +"ネットマスク (ネットワークプレフィックスに対応するビットが 1 のマスク) やホス" +"トマスク (ネットマスクに含まれないビットが 1 のマスク) を取得する:" #: ../../howto/ipaddress.rst:220 msgid "Exploding or compressing the address::" msgstr "アドレスを展開したり圧縮したりする::" -#: ../../howto/ipaddress.rst:222 msgid "" ">>> addr6.exploded\n" "'2001:0db8:0000:0000:0000:0000:0000:0001'\n" @@ -389,6 +429,14 @@ msgid "" ">>> net6.compressed\n" "'2001:db8::/96'" msgstr "" +">>> addr6.exploded\n" +"'2001:0db8:0000:0000:0000:0000:0000:0001'\n" +">>> addr6.compressed\n" +"'2001:db8::1'\n" +">>> net6.exploded\n" +"'2001:0db8:0000:0000:0000:0000:0000:0000/96'\n" +">>> net6.compressed\n" +"'2001:db8::/96'" #: ../../howto/ipaddress.rst:231 msgid "" @@ -414,7 +462,6 @@ msgstr "" "ネットワークをリストとして扱うと便利な場合があります。これは、ネットワークを" "次のようにインデックス付けすることが可能なことを意味します::" -#: ../../howto/ipaddress.rst:243 msgid "" ">>> net4[1]\n" "IPv4Address('192.0.2.1')\n" @@ -425,6 +472,14 @@ msgid "" ">>> net6[-1]\n" "IPv6Address('2001:db8::ffff:ffff')" msgstr "" +">>> net4[1]\n" +"IPv4Address('192.0.2.1')\n" +">>> net4[-1]\n" +"IPv4Address('192.0.2.255')\n" +">>> net6[1]\n" +"IPv6Address('2001:db8::1')\n" +">>> net6[-1]\n" +"IPv6Address('2001:db8::ffff:ffff')" #: ../../howto/ipaddress.rst:253 msgid "" @@ -434,11 +489,12 @@ msgstr "" "以下のようなリストのメンバーシップの判定用文法が使用可能なように、ネットワー" "クオブジェクト自身が適応します::" -#: ../../howto/ipaddress.rst:256 msgid "" "if address in network:\n" " # do something" msgstr "" +"if address in network:\n" +" # 何らかの処理をする" #: ../../howto/ipaddress.rst:259 msgid "Containment testing is done efficiently based on the network prefix::" @@ -446,7 +502,6 @@ msgstr "" "ネットワークプレフィックスに基づき、所属しているかどうかの判定が効果的にでき" "ます::" -#: ../../howto/ipaddress.rst:261 msgid "" ">>> addr4 = ipaddress.ip_address('192.0.2.1')\n" ">>> addr4 in ipaddress.ip_network('192.0.2.0/24')\n" @@ -454,24 +509,29 @@ msgid "" ">>> addr4 in ipaddress.ip_network('192.0.3.0/24')\n" "False" msgstr "" +">>> addr4 = ipaddress.ip_address('192.0.2.1')\n" +">>> addr4 in ipaddress.ip_network('192.0.2.0/24')\n" +"True\n" +">>> addr4 in ipaddress.ip_network('192.0.3.0/24')\n" +"False" #: ../../howto/ipaddress.rst:269 msgid "Comparisons" msgstr "比較" -#: ../../howto/ipaddress.rst:271 msgid "" ":mod:`ipaddress` provides some simple, hopefully intuitive ways to compare " "objects, where it makes sense::" msgstr "" -":mod:`ipaddress` はオブジェクトの比較をするための単純で、かつ願わくば直観的な" -"方法を意味が通じるように提供します::" +":mod:`ipaddress` は、比較に意味がある場合にオブジェクトを比較する、単純で直感" +"的な方法を提供しています。 ::" -#: ../../howto/ipaddress.rst:274 msgid "" ">>> ipaddress.ip_address('192.0.2.1') < ipaddress.ip_address('192.0.2.2')\n" "True" msgstr "" +">>> ipaddress.ip_address('192.0.2.1') < ipaddress.ip_address('192.0.2.2')\n" +"True" #: ../../howto/ipaddress.rst:277 msgid "" @@ -495,7 +555,6 @@ msgstr "" "らオブジェクトを直接受け付けません。直接渡すのではなく、他のモジュールが受け" "付ける整数や文字列に強制的に変換する必要があります::" -#: ../../howto/ipaddress.rst:288 msgid "" ">>> addr4 = ipaddress.ip_address('192.0.2.1')\n" ">>> str(addr4)\n" @@ -503,12 +562,16 @@ msgid "" ">>> int(addr4)\n" "3221225985" msgstr "" +">>> addr4 = ipaddress.ip_address('192.0.2.1')\n" +">>> str(addr4)\n" +"'192.0.2.1'\n" +">>> int(addr4)\n" +"3221225985" #: ../../howto/ipaddress.rst:296 msgid "Getting more detail when instance creation fails" msgstr "インスタンスの生成に失敗した場合にさらに詳細を取得する" -#: ../../howto/ipaddress.rst:298 msgid "" "When creating address/network/interface objects using the version-agnostic " "factory functions, any errors will be reported as :exc:`ValueError` with a " @@ -517,12 +580,13 @@ msgid "" "because it's necessary to know whether the value is *supposed* to be IPv4 or " "IPv6 in order to provide more detail on why it has been rejected." msgstr "" -"上述したバージョンに関知しないファクトリー関数を使用してアドレス/ネットワー" -"ク/インターフェースオブジェクトを作成する場合、渡された値がそのタイプのオブ" -"ジェクトとして認識されなかったと単純に通知する汎用的なメッセージとともに、ど" -"のエラーでも :exc:`ValueError` として報告されます。特定のエラーが提供されない" -"のは、拒否された理由をより詳細に提供するために、値がIPv4またはIPv6である *は" -"ず* かどうかを知る必要があるためです。" +"IP バージョンを自動判定するファクトリー関数でアドレス、ネットワーク、インター" +"フェースのオブジェクトを作成すると、エラーはすべて :exc:`ValueError` として報" +"告されます。\n" +"メッセージは、渡された値をその種類のオブジェクトとして認識できなかったという" +"一般的なものです。\n" +"値が拒否された理由を詳しく説明するには、入力が IPv4 と IPv6 の *どちらを意図" +"しているか* を知る必要があるためです。" #: ../../howto/ipaddress.rst:305 msgid "" @@ -545,7 +609,6 @@ msgstr "" "クラスコンストラクタを直接使用する場合にはこれらのエラーメッセージはさらに非" "常に詳細になっています。例えば::" -#: ../../howto/ipaddress.rst:314 msgid "" ">>> ipaddress.ip_address(\"192.168.0.256\")\n" "Traceback (most recent call last):\n" @@ -566,6 +629,24 @@ msgid "" " ...\n" "ipaddress.NetmaskValueError: '64' is not a valid netmask" msgstr "" +">>> ipaddress.ip_address(\"192.168.0.256\")\n" +"Traceback (most recent call last):\n" +" ...\n" +"ValueError: '192.168.0.256' does not appear to be an IPv4 or IPv6 address\n" +">>> ipaddress.IPv4Address(\"192.168.0.256\")\n" +"Traceback (most recent call last):\n" +" ...\n" +"ipaddress.AddressValueError: Octet 256 (> 255) not permitted in " +"'192.168.0.256'\n" +"\n" +">>> ipaddress.ip_network(\"192.168.0.1/64\")\n" +"Traceback (most recent call last):\n" +" ...\n" +"ValueError: '192.168.0.1/64' does not appear to be an IPv4 or IPv6 network\n" +">>> ipaddress.IPv4Network(\"192.168.0.1/64\")\n" +"Traceback (most recent call last):\n" +" ...\n" +"ipaddress.NetmaskValueError: '64' is not a valid netmask" #: ../../howto/ipaddress.rst:332 msgid "" @@ -577,10 +658,13 @@ msgstr "" "スとして持ち、エラーの特定のタイプに興味がない場合でも、以下のようにコードを" "記述できます::" -#: ../../howto/ipaddress.rst:336 msgid "" "try:\n" " network = ipaddress.IPv4Network(address)\n" "except ValueError:\n" " print('address/netmask is invalid for IPv4:', address)" msgstr "" +"try:\n" +" network = ipaddress.IPv4Network(address)\n" +"except ValueError:\n" +" print('address/netmask is invalid for IPv4:', address)" diff --git a/howto/isolating-extensions.po b/howto/isolating-extensions.po index 3be8e474b..96f2d4e59 100644 --- a/howto/isolating-extensions.po +++ b/howto/isolating-extensions.po @@ -17,10 +17,10 @@ msgstr "" "Last-Translator: Taichi Haradaguchi, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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/isolating-extensions.rst:7 @@ -31,70 +31,85 @@ msgstr "拡張モジュールを分離する" msgid "Abstract" msgstr "概要" -#: ../../howto/isolating-extensions.rst:11 msgid "" "Traditionally, state belonging to Python extension modules was kept in C " "``static`` variables, which have process-wide scope. This document describes " "problems of such per-process state and shows a safer way: per-module state." msgstr "" +"従来、Python 拡張モジュールの状態は、プロセス全体をスコープとする C の " +"``static`` 変数に保持されていました。\n" +"このドキュメントでは、プロセスごとの状態が抱える問題と、より安全な方法である" +"モジュールごとの状態について説明します。" -#: ../../howto/isolating-extensions.rst:16 msgid "" "The document also describes how to switch to per-module state where " "possible. This transition involves allocating space for that state, " "potentially switching from static types to heap types, and—perhaps most " "importantly—accessing per-module state from code." msgstr "" +"また、可能な場合にモジュールごとの状態へ移行する方法も説明します。\n" +"移行には状態の領域の割り当て、必要に応じた静的な型からヒープ型への切り替え、" +"そして特に重要な、コードからモジュールごとの状態へのアクセスが伴います。" -#: ../../howto/isolating-extensions.rst:23 msgid "Who should read this" -msgstr "" +msgstr "対象読者" -#: ../../howto/isolating-extensions.rst:25 msgid "" "This guide is written for maintainers of :ref:`C-API ` " "extensions who would like to make that extension safer to use in " "applications where Python itself is used as a library." msgstr "" +"このガイドは、Python 自体をライブラリとして使うアプリケーションでも安全に利用" +"できる拡張にしたいと考えている、:ref:`C API ` 拡張の保守担当者を" +"対象としています。" #: ../../howto/isolating-extensions.rst:31 msgid "Background" msgstr "背景" -#: ../../howto/isolating-extensions.rst:33 msgid "" "An *interpreter* is the context in which Python code runs. It contains " "configuration (e.g. the import path) and runtime state (e.g. the set of " "imported modules)." msgstr "" +"*インタープリタ* は Python コードが実行されるコンテキストです。\n" +"インポートパスなどの設定と、インポート済みモジュールの集合などの実行時の状態" +"を含みます。" -#: ../../howto/isolating-extensions.rst:37 msgid "" "Python supports running multiple interpreters in one process. There are two " "cases to think about—users may run interpreters:" msgstr "" +"Python は一つのプロセス内で複数のインタープリタを実行できます。\n" +"次の二つの場合を考える必要があります:" -#: ../../howto/isolating-extensions.rst:40 msgid "" "in sequence, with several :c:func:`Py_InitializeEx`/:c:func:`Py_FinalizeEx` " "cycles, and" msgstr "" +":c:func:`Py_InitializeEx` と :c:func:`Py_FinalizeEx` のサイクルを繰り返し、順" +"番に実行する場合。" -#: ../../howto/isolating-extensions.rst:42 msgid "" "in parallel, managing \"sub-interpreters\" using :c:func:" "`Py_NewInterpreter`/:c:func:`Py_EndInterpreter`." msgstr "" +":c:func:`Py_NewInterpreter` と :c:func:`Py_EndInterpreter` で「サブインタープ" +"リタ」を管理し、並列に実行する場合。" -#: ../../howto/isolating-extensions.rst:45 msgid "" "Both cases (and combinations of them) would be most useful when embedding " "Python within a library. Libraries generally shouldn't make assumptions " "about the application that uses them, which include assuming a process-wide " "\"main Python interpreter\"." msgstr "" +"どちらも (また両者の組み合わせも)、Python をライブラリに埋め込む場合に特に役" +"立ちます。\n" +"一般にライブラリは、それを使うアプリケーションについて仮定を置くべきではあり" +"ません。\n" +"プロセス全体に一つの「メインの Python インタープリタ」があるという仮定も同様" +"です。" -#: ../../howto/isolating-extensions.rst:50 msgid "" "Historically, Python extension modules don't handle this use case well. Many " "extension modules (and even some stdlib modules) use *per-process* global " @@ -104,19 +119,28 @@ msgid "" "introduce edge cases that lead to crashes when a module is loaded in more " "than one interpreter in the same process." msgstr "" +"歴史的に、Python 拡張モジュールはこの用途にうまく対応していません。\n" +"C の ``static`` 変数が非常に手軽に使えるため、多くの拡張モジュール (標準ライ" +"ブラリの一部も含みます) は *プロセスごと* のグローバルな状態を使っていま" +"す。\n" +"その結果、インタープリタ固有であるべきデータがインタープリタ間で共有されてし" +"まいます。\n" +"拡張の開発者が注意しないと、同じプロセスの複数のインタープリタにモジュールを" +"読み込んだ場合に、特殊な条件でクラッシュする問題を簡単に持ち込んでしまいま" +"す。" -#: ../../howto/isolating-extensions.rst:58 msgid "" "Unfortunately, *per-interpreter* state is not easy to achieve. Extension " "authors tend to not keep multiple interpreters in mind when developing, and " "it is currently cumbersome to test the behavior." msgstr "" +"残念ながら、*インタープリタごと* の状態を実現するのは簡単ではありません。\n" +"拡張の開発者は複数のインタープリタを考慮せずに開発しがちで、現在はその動作の" +"テストにも手間がかかります。" -#: ../../howto/isolating-extensions.rst:63 msgid "Enter Per-Module State" -msgstr "" +msgstr "モジュールごとの状態の導入" -#: ../../howto/isolating-extensions.rst:65 msgid "" "Instead of focusing on per-interpreter state, Python's C API is evolving to " "better support the more granular *per-module* state. This means that C-level " @@ -125,8 +149,14 @@ msgid "" "multiple module objects corresponding to a single extension can even be " "loaded in a single interpreter." msgstr "" +"Python の C API はインタープリタごとの状態よりも、さらに細かい単位の *モ" +"ジュールごと* の状態を扱いやすくする方向へ進化しています。\n" +"つまり、C レベルのデータは *モジュールオブジェクト* に結び付けるべきです。\n" +"各インタープリタが独自のモジュールオブジェクトを作成することで、データを分離" +"します。\n" +"分離をテストするために、一つの拡張に対応する複数のモジュールオブジェクトを、" +"一つのインタープリタに読み込むこともできます。" -#: ../../howto/isolating-extensions.rst:72 msgid "" "Per-module state provides an easy way to think about lifetime and resource " "ownership: the extension module will initialize when a module object is " @@ -134,8 +164,14 @@ msgid "" "any other :c:expr:`PyObject *`; there are no \"on interpreter shutdown\" " "hooks to think—or forget—about." msgstr "" +"モジュールごとの状態を使うと、寿命とリソースの所有関係を簡単に考えられま" +"す。\n" +"モジュールオブジェクトの作成時に拡張モジュールを初期化し、解放時に後始末をし" +"ます。\n" +"この点ではモジュールは他の :c:expr:`PyObject *` と同じです。\n" +"「インタープリタ終了時」のフックを考慮する必要も、それを忘れる心配もありませ" +"ん。" -#: ../../howto/isolating-extensions.rst:78 msgid "" "Note that there are use cases for different kinds of \"globals\": per-" "process, per-interpreter, per-thread or per-task state. With per-module " @@ -143,17 +179,24 @@ msgid "" "exceptional cases: if you need them, you should give them additional care " "and testing. (Note that this guide does not cover them.)" msgstr "" +"プロセスごと、インタープリタごと、スレッドごと、タスクごとの状態など、異なる" +"種類の「グローバル」な状態にも用途があります。\n" +"モジュールごとの状態を基本としても、これらを使うことはできます。\n" +"ただし例外的な場合として扱い、必要なら追加の注意とテストを行ってください。\n" +"このガイドではこれらは扱いません。" #: ../../howto/isolating-extensions.rst:87 msgid "Isolated Module Objects" -msgstr "" +msgstr "分離されたモジュールオブジェクト" -#: ../../howto/isolating-extensions.rst:89 msgid "" "The key point to keep in mind when developing an extension module is that " "several module objects can be created from a single shared library. For " "example:" msgstr "" +"拡張モジュールの開発で押さえるべき点は、一つの共有ライブラリから複数のモ" +"ジュールオブジェクトが作成され得るということです。\n" +"例えば:" #: ../../howto/isolating-extensions.rst:93 msgid "" @@ -165,8 +208,14 @@ msgid "" ">>> old_binascii == binascii\n" "False" msgstr "" +">>> import sys\n" +">>> import binascii\n" +">>> old_binascii = binascii\n" +">>> del sys.modules['binascii']\n" +">>> import binascii # 新しいモジュールオブジェクトを作成\n" +">>> old_binascii == binascii\n" +"False" -#: ../../howto/isolating-extensions.rst:103 msgid "" "As a rule of thumb, the two modules should be completely independent. All " "objects and state specific to the module should be encapsulated within the " @@ -175,19 +224,26 @@ msgid "" "are possible (see `Managing Global State`_), but they will need more thought " "and attention to edge cases." msgstr "" +"原則として、二つのモジュールは完全に独立しているべきです。\n" +"モジュール固有のすべてのオブジェクトと状態をモジュールオブジェクト内にカプセ" +"ル化し、他のモジュールオブジェクトと共有せず、モジュールオブジェクトの解放時" +"に後始末してください。\n" +"これはあくまで原則なので例外はあります (`グローバルな状態の管理 `_ を参照)。\n" +"ただし、例外的な扱いにはより慎重な検討と特殊な条件への注意が必要です。" -#: ../../howto/isolating-extensions.rst:111 msgid "" "While some modules could do with less stringent restrictions, isolated " "modules make it easier to set clear expectations and guidelines that work " "across a variety of use cases." msgstr "" +"一部のモジュールでは制約を緩められるかもしれません。\n" +"それでもモジュールを分離すると、さまざまな用途に通用する明確な期待動作や指針" +"を定めやすくなります。" -#: ../../howto/isolating-extensions.rst:117 msgid "Surprising Edge Cases" -msgstr "" +msgstr "意外な動作が生じる場合" -#: ../../howto/isolating-extensions.rst:119 msgid "" "Note that isolated modules do create some surprising edge cases. Most " "notably, each module object will typically not share its classes and " @@ -196,8 +252,13 @@ msgid "" "``binascii.Error`` are separate objects. In the following code, the " "exception is *not* caught:" msgstr "" +"モジュールを分離すると、一部の場合に意外な動作が生じます。\n" +"特に、通常は各モジュールオブジェクトがクラスや例外を同種の別のモジュールと共" +"有しません。\n" +"`先ほどの例 `__ の続きでは、``old_binascii.Error`` " +"と ``binascii.Error`` は別のオブジェクトです。\n" +"次のコードでは例外は捕捉 *されません*:" -#: ../../howto/isolating-extensions.rst:126 msgid "" ">>> old_binascii.Error == binascii.Error\n" "False\n" @@ -210,44 +271,57 @@ msgid "" " File \"\", line 2, in \n" "binascii.Error: Non-hexadecimal digit found" msgstr "" +">>> old_binascii.Error == binascii.Error\n" +"False\n" +">>> try:\n" +"... old_binascii.unhexlify(b'qwertyuiop')\n" +"... except binascii.Error:\n" +"... print('boo')\n" +"...\n" +"Traceback (most recent call last):\n" +" File \"\", line 2, in \n" +"binascii.Error: Non-hexadecimal digit found" -#: ../../howto/isolating-extensions.rst:139 msgid "" "This is expected. Notice that pure-Python modules behave the same way: it is " "a part of how Python works." msgstr "" +"これは想定された動作です。\n" +"ピュア Python のモジュールも同じように動作します。\n" +"これは Python の仕組みの一部です。" -#: ../../howto/isolating-extensions.rst:142 msgid "" "The goal is to make extension modules safe at the C level, not to make hacks " "behave intuitively. Mutating ``sys.modules`` \"manually\" counts as a hack." msgstr "" +"目標は拡張モジュールを C レベルで安全にすることであり、特殊な操作を直感的に動" +"作させることではありません。\n" +"``sys.modules`` を「手作業で」変更するのは、そうした特殊な操作に当たります。" -#: ../../howto/isolating-extensions.rst:148 msgid "Making Modules Safe with Multiple Interpreters" -msgstr "" +msgstr "複数のインタープリタでも安全なモジュールにする" -#: ../../howto/isolating-extensions.rst:152 msgid "Managing Global State" -msgstr "" +msgstr "グローバルな状態の管理" -#: ../../howto/isolating-extensions.rst:154 msgid "" "Sometimes, the state associated with a Python module is not specific to that " "module, but to the entire process (or something else \"more global\" than a " "module). For example:" msgstr "" +"Python モジュールに関連する状態が、そのモジュール固有ではなく、プロセス全体 " +"(またはモジュールより「広域」のもの) に属する場合もあります。\n" +"例えば:" -#: ../../howto/isolating-extensions.rst:158 msgid "The ``readline`` module manages *the* terminal." -msgstr "" +msgstr "``readline`` モジュールは、そのプロセスの *端末* を管理します。" -#: ../../howto/isolating-extensions.rst:159 msgid "" "A module running on a circuit board wants to control *the* on-board LED." msgstr "" +"回路基板で動作するモジュールは、その *基板上の LED* を制御したいかもしれませ" +"ん。" -#: ../../howto/isolating-extensions.rst:162 msgid "" "In these cases, the Python module should provide *access* to the global " "state, rather than *own* it. If possible, write the module so that multiple " @@ -255,6 +329,12 @@ msgid "" "whether for Python or other languages). If that is not possible, consider " "explicit locking." msgstr "" +"このような場合、Python モジュールはグローバルな状態を *所有* するのではなく、" +"その状態への *アクセス* を提供するべきです。\n" +"可能なら、モジュールの複数のコピーが独立して状態にアクセスできるようにしてく" +"ださい (Python や他の言語用の別のライブラリも同時にアクセスすることがありま" +"す)。\n" +"それが不可能なら、明示的なロックを検討してください。" #: ../../howto/isolating-extensions.rst:168 msgid "" @@ -264,18 +344,18 @@ msgid "" "Object per Process`_." msgstr "" -#: ../../howto/isolating-extensions.rst:175 msgid "Managing Per-Module State" -msgstr "" +msgstr "モジュールごとの状態の管理" -#: ../../howto/isolating-extensions.rst:177 msgid "" "To use per-module state, use :ref:`multi-phase extension module " "initialization `. This signals that your module " "supports multiple interpreters correctly." msgstr "" +"モジュールごとの状態を使うには、:ref:`拡張モジュールの複数フェーズ初期化 " +"` を使います。\n" +"これはモジュールが複数のインタープリタを正しくサポートすることを示します。" -#: ../../howto/isolating-extensions.rst:181 msgid "" "Set ``PyModuleDef.m_size`` to a positive number to request that many bytes " "of storage local to the module. Usually, this will be set to the size of " @@ -285,22 +365,33 @@ msgid "" "``csv``'s :py:data:`~csv.field_size_limit`) which the C code needs to " "function." msgstr "" +"``PyModuleDef.m_size`` に正の数を設定すると、そのバイト数のモジュール専用の記" +"憶領域を確保できます。\n" +"通常は、モジュールの C レベルの状態をすべて格納する、モジュール固有の " +"``struct`` のサイズを指定します。\n" +"特に、C コードの動作に必要なクラスへのポインタ (例外を含み、静的な型を除きま" +"す) や、``csv`` の :py:data:`~csv.field_size_limit` などの設定は、ここに格納" +"してください。" -#: ../../howto/isolating-extensions.rst:190 msgid "" "Another option is to store state in the module's ``__dict__``, but you must " "avoid crashing when users modify ``__dict__`` from Python code. This usually " "means error- and type-checking at the C level, which is easy to get wrong " "and hard to test sufficiently." msgstr "" +"状態をモジュールの ``__dict__`` に格納する方法もありますが、ユーザーが " +"Python コードで ``__dict__`` を変更してもクラッシュしないようにする必要があり" +"ます。\n" +"通常は C レベルでエラーや型を検査することになりますが、これは間違えやすく、十" +"分なテストも困難です。" -#: ../../howto/isolating-extensions.rst:195 msgid "" "However, if module state is not needed in C code, storing it in ``__dict__`` " "only is a good idea." msgstr "" +"ただし、C コードでモジュールの状態を使わないなら、``__dict__`` だけに格納する" +"のがよい方法です。" -#: ../../howto/isolating-extensions.rst:198 msgid "" "If the module state includes ``PyObject`` pointers, the module object must " "hold references to those objects and implement the module-level hooks " @@ -309,27 +400,38 @@ msgid "" "and make the code longer; this is the price for modules which can be " "unloaded cleanly." msgstr "" +"モジュールの状態に ``PyObject`` ポインタが含まれる場合、モジュールオブジェク" +"トはそのオブジェクトへの参照を保持し、モジュールレベルのフック " +"``m_traverse``、``m_clear``、``m_free`` を実装する必要があります。\n" +"これらはクラスの ``tp_traverse``、``tp_clear``、``tp_free`` のように働きま" +"す。\n" +"フックの追加には手間がかかり、コードも長くなります。\n" +"これはモジュールをきれいに解放できるようにするための代償です。" -#: ../../howto/isolating-extensions.rst:205 msgid "" "An example of a module with per-module state is currently available as " "`xxlimited `__; example module initialization shown at the bottom of the file." msgstr "" +"モジュールごとの状態を使うモジュールの例として、`xxlimited `__ があります。\n" +"モジュールの初期化の例はファイルの末尾にあります。" -#: ../../howto/isolating-extensions.rst:211 msgid "Opt-Out: Limiting to One Module Object per Process" -msgstr "" +msgstr "対応しない場合: プロセスごとに一つのモジュールオブジェクトに制限する" -#: ../../howto/isolating-extensions.rst:213 msgid "" "A non-negative ``PyModuleDef.m_size`` signals that a module supports " "multiple interpreters correctly. If this is not yet the case for your " "module, you can explicitly make your module loadable only once per process. " "For example::" msgstr "" +"``PyModuleDef.m_size`` が非負であることは、モジュールが複数のインタープリタを" +"正しくサポートすることを示します。\n" +"まだ対応していない場合は、プロセスごとに一度だけ読み込めるよう明示的に制限で" +"きます。\n" +"例えば次のようにします。 ::" -#: ../../howto/isolating-extensions.rst:218 msgid "" "// A process-wide flag\n" "static int loaded = 0;\n" @@ -352,8 +454,28 @@ msgid "" " // ... rest of initialization\n" "}" msgstr "" +"// プロセス全体で共有するフラグ\n" +"static int loaded = 0;\n" +"\n" +"// スレッド安全性を確保するミューテックス (フリースレッド版 Python でのみ必" +"要)\n" +"static PyMutex modinit_mutex = {0};\n" +"\n" +"static int\n" +"exec_module(PyObject* module)\n" +"{\n" +" PyMutex_Lock(&modinit_mutex);\n" +" if (loaded) {\n" +" PyMutex_Unlock(&modinit_mutex);\n" +" PyErr_SetString(PyExc_ImportError,\n" +" \"cannot load module more than once per process\");\n" +" return -1;\n" +" }\n" +" loaded = 1;\n" +" PyMutex_Unlock(&modinit_mutex);\n" +" // ... 残りの初期化処理\n" +"}" -#: ../../howto/isolating-extensions.rst:240 msgid "" "If your module's :c:member:`PyModuleDef.m_clear` function is able to prepare " "for future re-initialization, it should clear the ``loaded`` flag. In this " @@ -361,19 +483,24 @@ msgid "" "but it will, for example, support being loaded after Python runtime shutdown " "(:c:func:`Py_FinalizeEx`) and re-initialization (:c:func:`Py_Initialize`)." msgstr "" +"モジュールの :c:member:`PyModuleDef.m_clear` 関数で将来の再初期化に備えられる" +"場合は、そこで ``loaded`` フラグをクリアしてください。\n" +"この場合、複数のインスタンスの *同時* 存在はサポートしませんが、例えば " +"Python ランタイムを終了 (:c:func:`Py_FinalizeEx`) してから再初期化 (:c:func:" +"`Py_Initialize`) した後で、モジュールを読み込むことはできます。" -#: ../../howto/isolating-extensions.rst:249 msgid "Module State Access from Functions" -msgstr "" +msgstr "関数からモジュールの状態にアクセスする" -#: ../../howto/isolating-extensions.rst:251 msgid "" "Accessing the state from module-level functions is straightforward. " "Functions get the module object as their first argument; for extracting the " "state, you can use ``PyModule_GetState``::" msgstr "" +"モジュールレベルの関数から状態にアクセスするのは簡単です。\n" +"関数の最初の引数にはモジュールオブジェクトが渡されます。\n" +"``PyModule_GetState`` を使うと状態を取得できます。 ::" -#: ../../howto/isolating-extensions.rst:255 msgid "" "static PyObject *\n" "func(PyObject *module, PyObject *args)\n" @@ -385,32 +512,48 @@ msgid "" " // ... rest of logic\n" "}" msgstr "" +"static PyObject *\n" +"func(PyObject *module, PyObject *args)\n" +"{\n" +" my_struct *state = (my_struct*)PyModule_GetState(module);\n" +" if (state == NULL) {\n" +" return NULL;\n" +" }\n" +" // ... 残りの処理\n" +"}" -#: ../../howto/isolating-extensions.rst:266 msgid "" "``PyModule_GetState`` may return ``NULL`` without setting an exception if " "there is no module state, i.e. ``PyModuleDef.m_size`` was zero. In your own " "module, you're in control of ``m_size``, so this is easy to prevent." msgstr "" +"モジュールの状態がない場合、つまり ``PyModuleDef.m_size`` がゼロの場合、" +"``PyModule_GetState`` は例外を設定せずに ``NULL`` を返すことがあります。\n" +"自分のモジュールでは ``m_size`` を管理できるので、これは簡単に防げます。" -#: ../../howto/isolating-extensions.rst:273 msgid "Heap Types" -msgstr "" +msgstr "ヒープ型" -#: ../../howto/isolating-extensions.rst:275 msgid "" "Traditionally, types defined in C code are *static*; that is, ``static " "PyTypeObject`` structures defined directly in code and initialized using " "``PyType_Ready()``." msgstr "" +"従来、C コードで定義する型は *静的* なものです。\n" +"つまり、コード内に ``static PyTypeObject`` 構造体を直接定義し、" +"``PyType_Ready()`` で初期化します。" -#: ../../howto/isolating-extensions.rst:279 msgid "" "Such types are necessarily shared across the process. Sharing them between " "module objects requires paying attention to any state they own or access. To " "limit the possible issues, static types are immutable at the Python level: " "for example, you can't set ``str.myattribute = 123``." msgstr "" +"このような型は必然的にプロセス全体で共有されます。\n" +"モジュールオブジェクト間で共有するには、その型が所有したりアクセスしたりする" +"状態に注意が必要です。\n" +"問題を抑えるため、静的な型は Python レベルでは不変になっています。\n" +"例えば ``str.myattribute = 123`` は設定できません。" #: ../../howto/isolating-extensions.rst:285 msgid "" @@ -422,7 +565,6 @@ msgid "" "process-wide GIL." msgstr "" -#: ../../howto/isolating-extensions.rst:292 msgid "" "Because they are immutable and process-global, static types cannot access " "\"their\" module state. If any method of such a type requires access to " @@ -430,16 +572,18 @@ msgid "" "*heap type* for short. These correspond more closely to classes created by " "Python's ``class`` statement." msgstr "" +"静的な型は不変で、プロセス全体に属するため、「自分の」モジュールの状態にアク" +"セスできません。\n" +"その型のメソッドがモジュールの状態にアクセスする必要がある場合、*ヒープに割り" +"当てる型*、略して *ヒープ型* に変換しなければなりません。\n" +"ヒープ型は Python の ``class`` 文で作成するクラスにより近いものです。" -#: ../../howto/isolating-extensions.rst:299 msgid "For new modules, using heap types by default is a good rule of thumb." -msgstr "" +msgstr "新しいモジュールでは、基本的にヒープ型を使うのがよい方針です。" -#: ../../howto/isolating-extensions.rst:303 msgid "Changing Static Types to Heap Types" -msgstr "" +msgstr "静的な型をヒープ型に変更する" -#: ../../howto/isolating-extensions.rst:305 msgid "" "Static types can be converted to heap types, but note that the heap type API " "was not designed for \"lossless\" conversion from static types—that is, " @@ -448,70 +592,86 @@ msgid "" "unintentionally change a few details (e.g. pickleability or inherited " "slots). Always test the details that are important to you." msgstr "" +"静的な型はヒープ型に変換できます。\n" +"ただし、ヒープ型の API は「完全に同じ動作を保つ」変換、つまり元の静的な型と" +"まったく同じ動作をする型の作成を目的に設計されたものではありません。\n" +"新しい API でクラス定義を書き直すと、pickle 化の可否や継承するスロットなど、" +"一部の詳細が意図せず変わることがあります。\n" +"重要な点は必ずテストしてください。" -#: ../../howto/isolating-extensions.rst:314 msgid "" "Watch out for the following two points in particular (but note that this is " "not a comprehensive list):" -msgstr "" +msgstr "特に次の二点に注意してください (ただし、これですべてではありません):" -#: ../../howto/isolating-extensions.rst:317 msgid "" "Unlike static types, heap type objects are mutable by default. Use the :c:" "macro:`Py_TPFLAGS_IMMUTABLETYPE` flag to prevent mutability." msgstr "" +"静的な型とは異なり、ヒープ型のオブジェクトはデフォルトで可変です。\n" +"変更を禁止するには :c:macro:`Py_TPFLAGS_IMMUTABLETYPE` フラグを使ってくださ" +"い。" -#: ../../howto/isolating-extensions.rst:319 msgid "" "Heap types inherit :c:member:`~PyTypeObject.tp_new` by default, so it may " "become possible to instantiate them from Python code. You can prevent this " "with the :c:macro:`Py_TPFLAGS_DISALLOW_INSTANTIATION` flag." msgstr "" +"ヒープ型はデフォルトで :c:member:`~PyTypeObject.tp_new` を継承するため、" +"Python コードからインスタンスを作成できるようになる場合があります。\n" +":c:macro:`Py_TPFLAGS_DISALLOW_INSTANTIATION` フラグでこれを防げます。" -#: ../../howto/isolating-extensions.rst:325 msgid "Defining Heap Types" -msgstr "" +msgstr "ヒープ型の定義" -#: ../../howto/isolating-extensions.rst:327 msgid "" "Heap types can be created by filling a :c:struct:`PyType_Spec` structure, a " "description or \"blueprint\" of a class, and calling :c:func:" "`PyType_FromModuleAndSpec` to construct a new class object." msgstr "" +"ヒープ型は、クラスの説明や「設計図」に当たる :c:struct:`PyType_Spec` 構造体に" +"値を設定し、:c:func:`PyType_FromModuleAndSpec` を呼び出して新しいクラスオブ" +"ジェクトを構築することで作成できます。" -#: ../../howto/isolating-extensions.rst:332 msgid "" "Other functions, like :c:func:`PyType_FromSpec`, can also create heap types, " "but :c:func:`PyType_FromModuleAndSpec` associates the module with the class, " "allowing access to the module state from methods." msgstr "" +":c:func:`PyType_FromSpec` などの他の関数でもヒープ型を作成できますが、:c:" +"func:`PyType_FromModuleAndSpec` はクラスにモジュールを関連付けるため、メソッ" +"ドからモジュールの状態にアクセスできます。" -#: ../../howto/isolating-extensions.rst:336 msgid "" "The class should generally be stored in *both* the module state (for safe " "access from C) and the module's ``__dict__`` (for access from Python code)." msgstr "" +"一般にクラスは、C から安全にアクセスするためのモジュールの状態と、Python コー" +"ドからアクセスするためのモジュールの ``__dict__`` の *両方* に格納してくださ" +"い。" -#: ../../howto/isolating-extensions.rst:342 msgid "Garbage-Collection Protocol" -msgstr "" +msgstr "ガベージコレクションのプロトコル" -#: ../../howto/isolating-extensions.rst:344 msgid "" "Instances of heap types hold a reference to their type. This ensures that " "the type isn't destroyed before all its instances are, but may result in " "reference cycles that need to be broken by the garbage collector." msgstr "" +"ヒープ型のインスタンスは自分の型への参照を保持します。\n" +"これにより、すべてのインスタンスが破棄されるまで型は破棄されません。\n" +"ただし、ガベージコレクタで解消する必要のある循環参照が生じる場合があります。" -#: ../../howto/isolating-extensions.rst:349 msgid "" "To avoid memory leaks, instances of heap types must implement the garbage " "collection protocol. That is, heap types should:" msgstr "" +"メモリリークを防ぐには、ヒープ型のインスタンスでガベージコレクションのプロト" +"コルを実装する必要があります。\n" +"具体的には、ヒープ型で次を行います:" -#: ../../howto/isolating-extensions.rst:353 msgid "Have the :c:macro:`Py_TPFLAGS_HAVE_GC` flag." -msgstr "" +msgstr ":c:macro:`Py_TPFLAGS_HAVE_GC` フラグを設定する。" #: ../../howto/isolating-extensions.rst:354 msgid "" @@ -519,31 +679,34 @@ msgid "" "(e.g. using ``Py_VISIT(Py_TYPE(self))``)." msgstr "" -#: ../../howto/isolating-extensions.rst:357 msgid "" "Please refer to the documentation of :c:macro:`Py_TPFLAGS_HAVE_GC` and :c:" "member:`~PyTypeObject.tp_traverse` for additional considerations." msgstr "" +"その他の注意点は :c:macro:`Py_TPFLAGS_HAVE_GC` と :c:member:`~PyTypeObject." +"tp_traverse` のドキュメントを参照してください。" -#: ../../howto/isolating-extensions.rst:361 msgid "" "The API for defining heap types grew organically, leaving it somewhat " "awkward to use in its current state. The following sections will guide you " "through common issues." msgstr "" +"ヒープ型を定義する API は必要に応じて拡張されてきたため、現在の形には多少使い" +"づらいところがあります。\n" +"以降の節では、よくある問題を説明します。" -#: ../../howto/isolating-extensions.rst:367 msgid "``tp_traverse`` in Python 3.8 and lower" -msgstr "" +msgstr "Python 3.8 以前の ``tp_traverse``" -#: ../../howto/isolating-extensions.rst:369 msgid "" "The requirement to visit the type from ``tp_traverse`` was added in Python " "3.9. If you support Python 3.8 and lower, the traverse function must *not* " "visit the type, so it must be more complicated::" msgstr "" +"``tp_traverse`` から型を訪問するという要件は Python 3.9 で追加されました。\n" +"Python 3.8 以前をサポートする場合、走査関数は型を訪問しては *ならない* ため、" +"少し複雑になります。 ::" -#: ../../howto/isolating-extensions.rst:373 msgid "" "static int my_traverse(PyObject *self, visitproc visit, void *arg)\n" "{\n" @@ -553,48 +716,54 @@ msgid "" " return 0;\n" "}" msgstr "" +"static int my_traverse(PyObject *self, visitproc visit, void *arg)\n" +"{\n" +" if (Py_Version >= 0x03090000) {\n" +" Py_VISIT(Py_TYPE(self));\n" +" }\n" +" return 0;\n" +"}" -#: ../../howto/isolating-extensions.rst:381 msgid "" "Unfortunately, :c:data:`Py_Version` was only added in Python 3.11. As a " "replacement, use:" msgstr "" +"残念ながら :c:data:`Py_Version` が追加されたのは Python 3.11 です。\n" +"代わりに次を使ってください:" -#: ../../howto/isolating-extensions.rst:384 msgid ":c:macro:`PY_VERSION_HEX`, if not using the stable ABI, or" -msgstr "" +msgstr "Stable ABI を使わない場合は :c:macro:`PY_VERSION_HEX`。" -#: ../../howto/isolating-extensions.rst:385 msgid "" ":py:data:`sys.version_info` (via :c:func:`PySys_GetObject` and :c:func:" "`PyArg_ParseTuple`)." msgstr "" +"それ以外は :py:data:`sys.version_info` (:c:func:`PySys_GetObject` と :c:func:" +"`PyArg_ParseTuple` を介して取得)。" -#: ../../howto/isolating-extensions.rst:390 msgid "Delegating ``tp_traverse``" -msgstr "" +msgstr "``tp_traverse`` の委譲" -#: ../../howto/isolating-extensions.rst:392 msgid "" "If your traverse function delegates to the :c:member:`~PyTypeObject." "tp_traverse` of its base class (or another type), ensure that " "``Py_TYPE(self)`` is visited only once. Note that only heap type are " "expected to visit the type in ``tp_traverse``." msgstr "" +"走査関数が基底クラス (または他の型) の :c:member:`~PyTypeObject.tp_traverse` " +"に処理を委譲する場合、``Py_TYPE(self)`` を訪問するのが一度だけになるようにし" +"てください。\n" +"``tp_traverse`` で型を訪問するのはヒープ型だけです。" -#: ../../howto/isolating-extensions.rst:397 msgid "For example, if your traverse function includes::" -msgstr "" +msgstr "例えば、走査関数に次が含まれ、 ::" -#: ../../howto/isolating-extensions.rst:399 msgid "base->tp_traverse(self, visit, arg)" -msgstr "" +msgstr "base->tp_traverse(self, visit, arg)" -#: ../../howto/isolating-extensions.rst:401 msgid "...and ``base`` may be a static type, then it should also include::" -msgstr "" +msgstr "``base`` が静的な型の場合もあるなら、次も追加してください。 ::" -#: ../../howto/isolating-extensions.rst:403 msgid "" "if (base->tp_flags & Py_TPFLAGS_HEAPTYPE) {\n" " // a heap type's tp_traverse already visited Py_TYPE(self)\n" @@ -604,39 +773,48 @@ msgid "" " }\n" "}" msgstr "" +"if (base->tp_flags & Py_TPFLAGS_HEAPTYPE) {\n" +" // ヒープ型の tp_traverse はすでに Py_TYPE(self) を訪問している\n" +"} else {\n" +" if (Py_Version >= 0x03090000) {\n" +" Py_VISIT(Py_TYPE(self));\n" +" }\n" +"}" -#: ../../howto/isolating-extensions.rst:411 msgid "" "It is not necessary to handle the type's reference count in :c:member:" "`~PyTypeObject.tp_new` and :c:member:`~PyTypeObject.tp_clear`." msgstr "" +":c:member:`~PyTypeObject.tp_new` と :c:member:`~PyTypeObject.tp_clear` で型の" +"参照カウントを操作する必要はありません。" -#: ../../howto/isolating-extensions.rst:416 msgid "Defining ``tp_dealloc``" -msgstr "" +msgstr "``tp_dealloc`` の定義" -#: ../../howto/isolating-extensions.rst:418 msgid "" "If your type has a custom :c:member:`~PyTypeObject.tp_dealloc` function, it " "needs to:" msgstr "" +"型に独自の :c:member:`~PyTypeObject.tp_dealloc` 関数がある場合、次の処理が必" +"要です:" -#: ../../howto/isolating-extensions.rst:421 msgid "" "call :c:func:`PyObject_GC_UnTrack` before any fields are invalidated, and" msgstr "" +"いずれかのフィールドを無効にする前に :c:func:`PyObject_GC_UnTrack` を呼び出" +"す。" -#: ../../howto/isolating-extensions.rst:422 msgid "decrement the reference count of the type." -msgstr "" +msgstr "型の参照カウントを減らす。" -#: ../../howto/isolating-extensions.rst:424 msgid "" "To keep the type valid while ``tp_free`` is called, the type's refcount " "needs to be decremented *after* the instance is deallocated. For example::" msgstr "" +"``tp_free`` の呼び出し中も型を有効に保つため、型の参照カウントはインスタンス" +"を解放した *後* に減らす必要があります。\n" +"例えば次のようにします。 ::" -#: ../../howto/isolating-extensions.rst:427 msgid "" "static void my_dealloc(PyObject *self)\n" "{\n" @@ -647,122 +825,150 @@ msgid "" " Py_DECREF(type);\n" "}" msgstr "" +"static void my_dealloc(PyObject *self)\n" +"{\n" +" PyObject_GC_UnTrack(self);\n" +" ...\n" +" PyTypeObject *type = Py_TYPE(self);\n" +" type->tp_free(self);\n" +" Py_DECREF(type);\n" +"}" -#: ../../howto/isolating-extensions.rst:436 msgid "" "The default ``tp_dealloc`` function does this, so if your type does *not* " "override ``tp_dealloc`` you don't need to add it." msgstr "" +"デフォルトの ``tp_dealloc`` 関数はこの処理を行うため、``tp_dealloc`` をオー" +"バーライド *しない* 型では追加する必要はありません。" -#: ../../howto/isolating-extensions.rst:442 msgid "Not overriding ``tp_free``" -msgstr "" +msgstr "``tp_free`` をオーバーライドしない" -#: ../../howto/isolating-extensions.rst:444 msgid "" "The :c:member:`~PyTypeObject.tp_free` slot of a heap type must be set to :c:" "func:`PyObject_GC_Del`. This is the default; do not override it." msgstr "" +"ヒープ型の :c:member:`~PyTypeObject.tp_free` スロットは :c:func:" +"`PyObject_GC_Del` に設定する必要があります。\n" +"これがデフォルトなので、オーバーライドしないでください。" -#: ../../howto/isolating-extensions.rst:450 msgid "Avoiding ``PyObject_New``" -msgstr "" +msgstr "``PyObject_New`` を避ける" -#: ../../howto/isolating-extensions.rst:452 msgid "GC-tracked objects need to be allocated using GC-aware functions." msgstr "" +"GC が追跡するオブジェクトは、GC に対応した関数で割り当てる必要があります。" #: ../../howto/isolating-extensions.rst:454 msgid "If you use use :c:func:`PyObject_New` or :c:func:`PyObject_NewVar`:" msgstr "" -#: ../../howto/isolating-extensions.rst:456 msgid "" "Get and call type's :c:member:`~PyTypeObject.tp_alloc` slot, if possible. " "That is, replace ``TYPE *o = PyObject_New(TYPE, typeobj)`` with::" msgstr "" +"可能なら、型の :c:member:`~PyTypeObject.tp_alloc` スロットを取得して呼び出し" +"てください。\n" +"つまり ``TYPE *o = PyObject_New(TYPE, typeobj)`` を次に置き換えます。 ::" -#: ../../howto/isolating-extensions.rst:459 msgid "TYPE *o = typeobj->tp_alloc(typeobj, 0);" -msgstr "" +msgstr "TYPE *o = typeobj->tp_alloc(typeobj, 0);" -#: ../../howto/isolating-extensions.rst:461 msgid "" "Replace ``o = PyObject_NewVar(TYPE, typeobj, size)`` with the same, but use " "size instead of the 0." msgstr "" +"``o = PyObject_NewVar(TYPE, typeobj, size)`` も同様に置き換えますが、0 の代わ" +"りに ``size`` を使います。" -#: ../../howto/isolating-extensions.rst:464 msgid "" "If the above is not possible (e.g. inside a custom ``tp_alloc``), call :c:" "func:`PyObject_GC_New` or :c:func:`PyObject_GC_NewVar`::" msgstr "" +"それができない場合 (例えば独自の ``tp_alloc`` の内部) は、:c:func:" +"`PyObject_GC_New` または :c:func:`PyObject_GC_NewVar` を呼び出してくださ" +"い。 ::" -#: ../../howto/isolating-extensions.rst:467 msgid "" "TYPE *o = PyObject_GC_New(TYPE, typeobj);\n" "\n" "TYPE *o = PyObject_GC_NewVar(TYPE, typeobj, size);" msgstr "" +"TYPE *o = PyObject_GC_New(TYPE, typeobj);\n" +"\n" +"TYPE *o = PyObject_GC_NewVar(TYPE, typeobj, size);" -#: ../../howto/isolating-extensions.rst:473 msgid "Module State Access from Classes" -msgstr "" +msgstr "クラスからモジュールの状態にアクセスする" -#: ../../howto/isolating-extensions.rst:475 msgid "" "If you have a type object defined with :c:func:`PyType_FromModuleAndSpec`, " "you can call :c:func:`PyType_GetModule` to get the associated module, and " "then :c:func:`PyModule_GetState` to get the module's state." msgstr "" +":c:func:`PyType_FromModuleAndSpec` で定義した型オブジェクトがあれば、:c:func:" +"`PyType_GetModule` で関連付けられたモジュールを取得し、:c:func:" +"`PyModule_GetState` でその状態を取得できます。" -#: ../../howto/isolating-extensions.rst:479 msgid "" "To save a some tedious error-handling boilerplate code, you can combine " "these two steps with :c:func:`PyType_GetModuleState`, resulting in::" msgstr "" +"エラー処理の定型コードを省くには、:c:func:`PyType_GetModuleState` でこの二つ" +"の手順をまとめられます。 ::" -#: ../../howto/isolating-extensions.rst:482 msgid "" "my_struct *state = (my_struct*)PyType_GetModuleState(type);\n" "if (state == NULL) {\n" " return NULL;\n" "}" msgstr "" +"my_struct *state = (my_struct*)PyType_GetModuleState(type);\n" +"if (state == NULL) {\n" +" return NULL;\n" +"}" -#: ../../howto/isolating-extensions.rst:489 msgid "Module State Access from Regular Methods" -msgstr "" +msgstr "通常のメソッドからモジュールの状態にアクセスする" -#: ../../howto/isolating-extensions.rst:491 msgid "" "Accessing the module-level state from methods of a class is somewhat more " "complicated, but is possible thanks to API introduced in Python 3.9. To get " "the state, you need to first get the *defining class*, and then get the " "module state from it." msgstr "" +"クラスのメソッドからモジュールレベルの状態にアクセスするのは少し複雑ですが、" +"Python 3.9 で導入された API により可能になりました。\n" +"まず *メソッドを定義したクラス* を取得し、そのクラスからモジュールの状態を取" +"得します。" -#: ../../howto/isolating-extensions.rst:496 msgid "" "The largest roadblock is getting *the class a method was defined in*, or " "that method's \"defining class\" for short. The defining class can have a " "reference to the module it is part of." msgstr "" +"最大の難所は、*メソッドが定義されたクラス*、略して「定義クラス」を取得するこ" +"とです。\n" +"定義クラスは、そのクラスが属するモジュールへの参照を保持できます。" -#: ../../howto/isolating-extensions.rst:500 msgid "" "Do not confuse the defining class with ``Py_TYPE(self)``. If the method is " "called on a *subclass* of your type, ``Py_TYPE(self)`` will refer to that " "subclass, which may be defined in different module than yours." msgstr "" +"定義クラスと ``Py_TYPE(self)`` を混同しないでください。\n" +"型の *サブクラス* のインスタンスでメソッドが呼び出された場合、" +"``Py_TYPE(self)`` はそのサブクラスを指します。\n" +"そのサブクラスは別のモジュールで定義されているかもしれません。" -#: ../../howto/isolating-extensions.rst:505 msgid "" "The following Python code can illustrate the concept. ``Base." "get_defining_class`` returns ``Base`` even if ``type(self) == Sub``:" msgstr "" +"次の Python コードでこの考え方を示します。\n" +"``Base.get_defining_class`` は ``type(self) == Sub`` の場合でも ``Base`` を返" +"します:" -#: ../../howto/isolating-extensions.rst:509 msgid "" "class Base:\n" " def get_type_of_self(self):\n" @@ -774,14 +980,26 @@ msgid "" "class Sub(Base):\n" " pass" msgstr "" +"class Base:\n" +" def get_type_of_self(self):\n" +" return type(self)\n" +"\n" +" def get_defining_class(self):\n" +" return __class__\n" +"\n" +"class Sub(Base):\n" +" pass" -#: ../../howto/isolating-extensions.rst:521 msgid "" "For a method to get its \"defining class\", it must use the :ref:" "`METH_METHOD | METH_FASTCALL | METH_KEYWORDS ` :c:type:`calling convention ` and the " "corresponding :c:type:`PyCMethod` signature::" msgstr "" +"メソッドが「定義クラス」を取得するには、:ref:`METH_METHOD | METH_FASTCALL | " +"METH_KEYWORDS ` :c:type:`呼び出し規" +"約 ` と、それに対応する :c:type:`PyCMethod` シグネチャを使う必要" +"があります。 ::" #: ../../howto/isolating-extensions.rst:526 msgid "" @@ -793,11 +1011,12 @@ msgid "" " PyObject *kwnames) // NULL, or dict of keyword arguments" msgstr "" -#: ../../howto/isolating-extensions.rst:533 msgid "" "Once you have the defining class, call :c:func:`PyType_GetModuleState` to " "get the state of its associated module." msgstr "" +"定義クラスを取得したら、:c:func:`PyType_GetModuleState` を呼び出して、関連付" +"けられたモジュールの状態を取得します。" #: ../../howto/isolating-extensions.rst:536 msgid "For example::" @@ -830,15 +1049,13 @@ msgid "" "}" msgstr "" -#: ../../howto/isolating-extensions.rst:564 msgid "Module State Access from Slot Methods, Getters and Setters" -msgstr "" +msgstr "スロットメソッド、ゲッター、セッターからモジュールの状態にアクセスする" #: ../../howto/isolating-extensions.rst:568 msgid "This is new in Python 3.11." msgstr "これは Python 3.11 の新機能です。" -#: ../../howto/isolating-extensions.rst:576 msgid "" "Slot methods—the fast C equivalents for special methods, such as :c:member:" "`~PyNumberMethods.nb_add` for :py:attr:`~object.__add__` or :c:member:" @@ -847,15 +1064,23 @@ msgid "" "`PyCMethod`. The same goes for getters and setters defined with :c:type:" "`PyGetSetDef`." msgstr "" +"スロットメソッドは、特殊メソッドに相当する高速な C の処理です。\n" +"例えば :py:attr:`~object.__add__` に対応する :c:member:`~PyNumberMethods." +"nb_add` や、初期化に使う :c:member:`~PyTypeObject.tp_new` があります。\n" +"これらの API は非常に単純で、:c:type:`PyCMethod` とは異なり定義クラスを渡せま" +"せん。\n" +":c:type:`PyGetSetDef` で定義するゲッターやセッターも同様です。" -#: ../../howto/isolating-extensions.rst:583 msgid "" "To access the module state in these cases, use the :c:func:" "`PyType_GetModuleByDef` function, and pass in the module definition. Once " "you have the module, call :c:func:`PyModule_GetState` to get the state::" msgstr "" +"このような場合にモジュールの状態にアクセスするには、:c:func:" +"`PyType_GetModuleByDef` 関数にモジュール定義を渡します。\n" +"モジュールを取得したら、:c:func:`PyModule_GetState` を呼び出して状態を取得し" +"ます。 ::" -#: ../../howto/isolating-extensions.rst:588 msgid "" "PyObject *module = PyType_GetModuleByDef(Py_TYPE(self), &module_def);\n" "my_struct *state = (my_struct*)PyModule_GetState(module);\n" @@ -863,34 +1088,46 @@ msgid "" " return NULL;\n" "}" msgstr "" +"PyObject *module = PyType_GetModuleByDef(Py_TYPE(self), &module_def);\n" +"my_struct *state = (my_struct*)PyModule_GetState(module);\n" +"if (state == NULL) {\n" +" return NULL;\n" +"}" -#: ../../howto/isolating-extensions.rst:594 msgid "" ":c:func:`!PyType_GetModuleByDef` works by searching the :term:`method " "resolution order` (i.e. all superclasses) for the first superclass that has " "a corresponding module." msgstr "" +":c:func:`!PyType_GetModuleByDef` は :term:`method resolution order` (すべての" +"スーパークラス) を検索し、対応するモジュールを持つ最初のスーパークラスを探し" +"ます。" -#: ../../howto/isolating-extensions.rst:600 msgid "" "In very exotic cases (inheritance chains spanning multiple modules created " "from the same definition), :c:func:`!PyType_GetModuleByDef` might not return " "the module of the true defining class. However, it will always return a " "module with the same definition, ensuring a compatible C memory layout." msgstr "" +"非常に特殊な場合 (同じ定義から作成された複数のモジュールに継承関係がまたがる" +"場合)、:c:func:`!PyType_GetModuleByDef` は本来の定義クラスのモジュールを返さ" +"ないことがあります。\n" +"ただし、必ず同じ定義のモジュールを返すため、C のメモリレイアウトの互換性は保" +"証されます。" -#: ../../howto/isolating-extensions.rst:608 msgid "Lifetime of the Module State" -msgstr "" +msgstr "モジュールの状態の寿命" -#: ../../howto/isolating-extensions.rst:610 msgid "" "When a module object is garbage-collected, its module state is freed. For " "each pointer to (a part of) the module state, you must hold a reference to " "the module object." msgstr "" +"モジュールオブジェクトがガベージコレクションで回収されると、モジュールの状態" +"も解放されます。\n" +"モジュールの状態 (またはその一部) へのポインタを保持する間は、それぞれモ" +"ジュールオブジェクトへの参照を保持しなければなりません。" -#: ../../howto/isolating-extensions.rst:614 msgid "" "Usually this is not an issue, because types created with :c:func:" "`PyType_FromModuleAndSpec`, and their instances, hold a reference to the " @@ -898,14 +1135,18 @@ msgid "" "reference module state from other places, such as callbacks for external " "libraries." msgstr "" +":c:func:`PyType_FromModuleAndSpec` で作成した型とそのインスタンスはモジュール" +"への参照を保持するため、通常これは問題になりません。\n" +"ただし、外部ライブラリのコールバックなど、他の場所からモジュールの状態を参照" +"する場合は、参照カウントに注意する必要があります。" #: ../../howto/isolating-extensions.rst:623 msgid "Open Issues" msgstr "取り掛かり中の問題" -#: ../../howto/isolating-extensions.rst:625 msgid "Several issues around per-module state and heap types are still open." msgstr "" +"モジュールごとの状態とヒープ型には、まだ未解決の問題がいくつかあります。" #: ../../howto/isolating-extensions.rst:627 msgid "" @@ -916,7 +1157,7 @@ msgstr "" #: ../../howto/isolating-extensions.rst:632 msgid "Per-Class Scope" -msgstr "" +msgstr "クラスごとのスコープ" #: ../../howto/isolating-extensions.rst:634 msgid "" @@ -926,12 +1167,13 @@ msgid "" "per-class scope)." msgstr "" -#: ../../howto/isolating-extensions.rst:641 msgid "Lossless Conversion to Heap Types" -msgstr "" +msgstr "動作を完全に保ったヒープ型への変換" -#: ../../howto/isolating-extensions.rst:643 msgid "" "The heap type API was not designed for \"lossless\" conversion from static " "types; that is, creating a type that works exactly like a given static type." msgstr "" +"ヒープ型の API は、静的な型から動作を完全に保ったまま変換すること、つまり元の" +"静的な型とまったく同じ動作をする型の作成を目的に設計されたものではありませ" +"ん。" diff --git a/howto/logging-cookbook.po b/howto/logging-cookbook.po index 743e3f0a7..80a0e63c8 100644 --- a/howto/logging-cookbook.po +++ b/howto/logging-cookbook.po @@ -20,10 +20,10 @@ msgstr "" "Last-Translator: Takeshi Nakazato, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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/logging-cookbook.rst:5 @@ -71,7 +71,6 @@ msgstr "" "ない) ことが可能で、すべての子 logger への呼び出しは親にまで渡されます。まず" "はメインのモジュールです::" -#: ../../howto/logging-cookbook.rst:26 msgid "" "import logging\n" "import auxiliary_module\n" @@ -104,12 +103,41 @@ msgid "" "auxiliary_module.some_function()\n" "logger.info('done with auxiliary_module.some_function()')" msgstr "" +"import logging\n" +"import auxiliary_module\n" +"\n" +"# 'spam_application' という名前のロガーを作成する\n" +"logger = logging.getLogger('spam_application')\n" +"logger.setLevel(logging.DEBUG)\n" +"# デバッグメッセージも記録するファイルハンドラーを作成する\n" +"fh = logging.FileHandler('spam.log')\n" +"fh.setLevel(logging.DEBUG)\n" +"# より高いログレベルのコンソールハンドラーを作成する\n" +"ch = logging.StreamHandler()\n" +"ch.setLevel(logging.ERROR)\n" +"# フォーマッターを作成してハンドラーに設定する\n" +"formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - " +"%(message)s')\n" +"fh.setFormatter(formatter)\n" +"ch.setFormatter(formatter)\n" +"# ロガーにハンドラーを追加する\n" +"logger.addHandler(fh)\n" +"logger.addHandler(ch)\n" +"\n" +"logger.info('creating an instance of auxiliary_module.Auxiliary')\n" +"a = auxiliary_module.Auxiliary()\n" +"logger.info('created an instance of auxiliary_module.Auxiliary')\n" +"logger.info('calling auxiliary_module.Auxiliary.do_something')\n" +"a.do_something()\n" +"logger.info('finished auxiliary_module.Auxiliary.do_something')\n" +"logger.info('calling auxiliary_module.some_function()')\n" +"auxiliary_module.some_function()\n" +"logger.info('done with auxiliary_module.some_function()')" #: ../../howto/logging-cookbook.rst:56 msgid "Here is the auxiliary module::" msgstr "そして補助モジュール (auxiliary module) がこちらです::" -#: ../../howto/logging-cookbook.rst:58 msgid "" "import logging\n" "\n" @@ -130,12 +158,29 @@ msgid "" "def some_function():\n" " module_logger.info('received a call to \"some_function\"')" msgstr "" +"import logging\n" +"\n" +"# ロガーを作成する\n" +"module_logger = logging.getLogger('spam_application.auxiliary')\n" +"\n" +"class Auxiliary:\n" +" def __init__(self):\n" +" self.logger = logging.getLogger('spam_application.auxiliary." +"Auxiliary')\n" +" self.logger.info('creating an instance of Auxiliary')\n" +"\n" +" def do_something(self):\n" +" self.logger.info('doing something')\n" +" a = 1 + 1\n" +" self.logger.info('done doing something')\n" +"\n" +"def some_function():\n" +" module_logger.info('received a call to \"some_function\"')" #: ../../howto/logging-cookbook.rst:76 msgid "The output looks like this:" msgstr "出力はこのようになります:" -#: ../../howto/logging-cookbook.rst:78 msgid "" "2005-03-23 23:47:11,663 - spam_application - INFO -\n" " creating an instance of auxiliary_module.Auxiliary\n" @@ -158,6 +203,26 @@ msgid "" "2005-03-23 23:47:11,673 - spam_application - INFO -\n" " done with auxiliary_module.some_function()" msgstr "" +"2005-03-23 23:47:11,663 - spam_application - INFO -\n" +" creating an instance of auxiliary_module.Auxiliary\n" +"2005-03-23 23:47:11,665 - spam_application.auxiliary.Auxiliary - INFO -\n" +" creating an instance of Auxiliary\n" +"2005-03-23 23:47:11,665 - spam_application - INFO -\n" +" created an instance of auxiliary_module.Auxiliary\n" +"2005-03-23 23:47:11,668 - spam_application - INFO -\n" +" calling auxiliary_module.Auxiliary.do_something\n" +"2005-03-23 23:47:11,668 - spam_application.auxiliary.Auxiliary - INFO -\n" +" doing something\n" +"2005-03-23 23:47:11,669 - spam_application.auxiliary.Auxiliary - INFO -\n" +" done doing something\n" +"2005-03-23 23:47:11,670 - spam_application - INFO -\n" +" finished auxiliary_module.Auxiliary.do_something\n" +"2005-03-23 23:47:11,671 - spam_application - INFO -\n" +" calling auxiliary_module.some_function()\n" +"2005-03-23 23:47:11,672 - spam_application.auxiliary - INFO -\n" +" received a call to 'some_function'\n" +"2005-03-23 23:47:11,673 - spam_application - INFO -\n" +" done with auxiliary_module.some_function()" #: ../../howto/logging-cookbook.rst:102 msgid "Logging from multiple threads" @@ -171,7 +236,6 @@ msgstr "" "複数スレッドからのロギングでは特別に何かをする必要はありません。\n" "次の例はmain (初期) スレッドとそれ以外のスレッドからのロギングの例です::" -#: ../../howto/logging-cookbook.rst:107 msgid "" "import logging\n" "import threading\n" @@ -200,12 +264,37 @@ msgid "" "if __name__ == '__main__':\n" " main()" msgstr "" +"import logging\n" +"import threading\n" +"import time\n" +"\n" +"def worker(arg):\n" +" while not arg['stop']:\n" +" logging.debug('Hi from myfunc')\n" +" time.sleep(0.5)\n" +"\n" +"def main():\n" +" logging.basicConfig(level=logging.DEBUG, format='%(relativeCreated)6d " +"%(threadName)s %(message)s')\n" +" info = {'stop': False}\n" +" thread = threading.Thread(target=worker, args=(info,))\n" +" thread.start()\n" +" while True:\n" +" try:\n" +" logging.debug('Hello from main')\n" +" time.sleep(0.75)\n" +" except KeyboardInterrupt:\n" +" info['stop'] = True\n" +" break\n" +" thread.join()\n" +"\n" +"if __name__ == '__main__':\n" +" main()" #: ../../howto/logging-cookbook.rst:133 msgid "When run, the script should print something like the following:" msgstr "実行すると、出力は以下のようになるはずです:" -#: ../../howto/logging-cookbook.rst:135 msgid "" " 0 Thread-1 Hi from myfunc\n" " 3 MainThread Hello from main\n" @@ -225,6 +314,23 @@ msgid "" "4513 MainThread Hello from main\n" "4518 Thread-1 Hi from myfunc" msgstr "" +" 0 Thread-1 Hi from myfunc\n" +" 3 MainThread Hello from main\n" +" 505 Thread-1 Hi from myfunc\n" +" 755 MainThread Hello from main\n" +"1007 Thread-1 Hi from myfunc\n" +"1507 MainThread Hello from main\n" +"1508 Thread-1 Hi from myfunc\n" +"2010 Thread-1 Hi from myfunc\n" +"2258 MainThread Hello from main\n" +"2512 Thread-1 Hi from myfunc\n" +"3009 MainThread Hello from main\n" +"3013 Thread-1 Hi from myfunc\n" +"3515 Thread-1 Hi from myfunc\n" +"3761 MainThread Hello from main\n" +"4017 Thread-1 Hi from myfunc\n" +"4513 MainThread Hello from main\n" +"4518 Thread-1 Hi from myfunc" #: ../../howto/logging-cookbook.rst:155 msgid "" @@ -257,7 +363,6 @@ msgstr "" "コードの中のログ記録の呼び出しは変更されずに残ります。少し前に取り上げた単純" "なモジュール式の例を少し変えるとこうなります::" -#: ../../howto/logging-cookbook.rst:169 msgid "" "import logging\n" "\n" @@ -285,6 +390,31 @@ msgid "" "logger.error('error message')\n" "logger.critical('critical message')" msgstr "" +"import logging\n" +"\n" +"logger = logging.getLogger('simple_example')\n" +"logger.setLevel(logging.DEBUG)\n" +"# デバッグメッセージも記録するファイルハンドラーを作成する\n" +"fh = logging.FileHandler('spam.log')\n" +"fh.setLevel(logging.DEBUG)\n" +"# より高いログレベルのコンソールハンドラーを作成する\n" +"ch = logging.StreamHandler()\n" +"ch.setLevel(logging.ERROR)\n" +"# フォーマッターを作成してハンドラーに設定する\n" +"formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - " +"%(message)s')\n" +"ch.setFormatter(formatter)\n" +"fh.setFormatter(formatter)\n" +"# ロガーにハンドラーを追加する\n" +"logger.addHandler(ch)\n" +"logger.addHandler(fh)\n" +"\n" +"# 「アプリケーション」のコード\n" +"logger.debug('debug message')\n" +"logger.info('info message')\n" +"logger.warning('warn message')\n" +"logger.error('error message')\n" +"logger.critical('critical message')" #: ../../howto/logging-cookbook.rst:194 msgid "" @@ -319,7 +449,6 @@ msgstr "" msgid "Logging to multiple destinations" msgstr "複数の出力先にログを出力する" -#: ../../howto/logging-cookbook.rst:210 msgid "" "Let's say you want to log to console and file with different message formats " "and in differing circumstances. Say you want to log messages with levels of " @@ -327,11 +456,13 @@ msgid "" "console. Let's also assume that the file should contain timestamps, but the " "console messages should not. Here's how you can achieve this::" msgstr "" -"コンソールとファイルに、別々のメッセージ書式で、別々の状況に応じたログ出力を" -"行わせたいとしましょう。例えば DEBUG よりも高いレベルのメッセージはファイルに" -"記録し、INFO 以上のレベルのメッセージはコンソールに出力したいという場合です。" -"また、ファイルにはタイムスタンプを記録し、コンソールには出力しないとします。" -"以下のようにすれば、こうした挙動を実現できます::" +"コンソールとファイルに、それぞれ異なる書式や条件でログを出力したいとしま" +"す。\n" +"例えば DEBUG 以上のレベルのメッセージをファイルに、INFO 以上のメッセージをコ" +"ンソールに出力するとします。\n" +"また、ファイルにはタイムスタンプを含め、コンソールには含めないものとしま" +"す。\n" +"次のように実現できます。 ::" #: ../../howto/logging-cookbook.rst:216 msgid "" @@ -374,19 +505,21 @@ msgstr "" msgid "When you run this, on the console you will see" msgstr "これを実行すると、コンソールには以下のように出力されます:" -#: ../../howto/logging-cookbook.rst:250 msgid "" "root : INFO Jackdaws love my big sphinx of quartz.\n" "myapp.area1 : INFO How quickly daft jumping zebras vex.\n" "myapp.area2 : WARNING Jail zesty vixen who grabbed pay from quack.\n" "myapp.area2 : ERROR The five boxing wizards jump quickly." msgstr "" +"root : INFO Jackdaws love my big sphinx of quartz.\n" +"myapp.area1 : INFO How quickly daft jumping zebras vex.\n" +"myapp.area2 : WARNING Jail zesty vixen who grabbed pay from quack.\n" +"myapp.area2 : ERROR The five boxing wizards jump quickly." #: ../../howto/logging-cookbook.rst:257 msgid "and in the file you will see something like" msgstr "そして、ファイルには以下のように出力されるはずです:" -#: ../../howto/logging-cookbook.rst:259 msgid "" "10-22 22:19 root INFO Jackdaws love my big sphinx of quartz.\n" "10-22 22:19 myapp.area1 DEBUG Quick zephyrs blow, vexing daft Jim.\n" @@ -395,6 +528,12 @@ msgid "" "quack.\n" "10-22 22:19 myapp.area2 ERROR The five boxing wizards jump quickly." msgstr "" +"10-22 22:19 root INFO Jackdaws love my big sphinx of quartz.\n" +"10-22 22:19 myapp.area1 DEBUG Quick zephyrs blow, vexing daft Jim.\n" +"10-22 22:19 myapp.area1 INFO How quickly daft jumping zebras vex.\n" +"10-22 22:19 myapp.area2 WARNING Jail zesty vixen who grabbed pay from " +"quack.\n" +"10-22 22:19 myapp.area2 ERROR The five boxing wizards jump quickly." #: ../../howto/logging-cookbook.rst:267 msgid "" @@ -412,7 +551,6 @@ msgstr "" "この例ではコンソールとファイルのハンドラだけを使っていますが、実際には任意の" "数のハンドラや組み合わせを使えます。" -#: ../../howto/logging-cookbook.rst:273 msgid "" "Note that the above choice of log filename ``/tmp/myapp.log`` implies use of " "a standard location for temporary files on POSIX systems. On Windows, you " @@ -420,11 +558,11 @@ msgid "" "the directory exists and that you have the permissions to create and update " "files in it." msgstr "" -"ここでファイル名として ``/tmp/myapp.log`` を選んだということは、一時ファイル" -"の標準的な場所として POSIX システムを想定していることに注意してください。 " -"Windows の場合、ディレクトリが存在し、そのディレクトリに対してファイルを更新" -"するための適切な権限を有することを保証するために、ログファイル向けのディレク" -"トリ名として異なる選択を取る必要があるでしょう。" +"上のログファイル名 ``/tmp/myapp.log`` は、POSIX システムの一時ファイルの標準" +"的な場所を使っています。\n" +"Windows では、別のディレクトリを選ぶ必要があるかもしれません。\n" +"いずれの場合も、ディレクトリが存在し、その中でファイルを作成・更新する権限が" +"あることを確認してください。" #: ../../howto/logging-cookbook.rst:282 msgid "Custom handling of levels" @@ -458,7 +596,6 @@ msgstr "深刻度 ``DEBUG`` 以上のメッセージをファイル ``app.log`` msgid "Suppose you configure logging with the following JSON:" msgstr "logging モジュールを下記の JSON によって構成したとしましょう:" -#: ../../howto/logging-cookbook.rst:295 msgid "" "{\n" " \"version\": 1,\n" @@ -498,6 +635,43 @@ msgid "" " }\n" "}" msgstr "" +"{\n" +" \"version\": 1,\n" +" \"disable_existing_loggers\": false,\n" +" \"formatters\": {\n" +" \"simple\": {\n" +" \"format\": \"%(levelname)-8s - %(message)s\"\n" +" }\n" +" },\n" +" \"handlers\": {\n" +" \"stdout\": {\n" +" \"class\": \"logging.StreamHandler\",\n" +" \"level\": \"INFO\",\n" +" \"formatter\": \"simple\",\n" +" \"stream\": \"ext://sys.stdout\"\n" +" },\n" +" \"stderr\": {\n" +" \"class\": \"logging.StreamHandler\",\n" +" \"level\": \"ERROR\",\n" +" \"formatter\": \"simple\",\n" +" \"stream\": \"ext://sys.stderr\"\n" +" },\n" +" \"file\": {\n" +" \"class\": \"logging.FileHandler\",\n" +" \"formatter\": \"simple\",\n" +" \"filename\": \"app.log\",\n" +" \"mode\": \"w\"\n" +" }\n" +" },\n" +" \"root\": {\n" +" \"level\": \"DEBUG\",\n" +" \"handlers\": [\n" +" \"stderr\",\n" +" \"stdout\",\n" +" \"file\"\n" +" ]\n" +" }\n" +"}" #: ../../howto/logging-cookbook.rst:335 msgid "" @@ -509,7 +683,6 @@ msgid "" "section parallel to ``formatters`` and ``handlers``:" msgstr "" -#: ../../howto/logging-cookbook.rst:341 msgid "" "{\n" " \"filters\": {\n" @@ -520,13 +693,20 @@ msgid "" " }\n" "}" msgstr "" +"{\n" +" \"filters\": {\n" +" \"warnings_and_below\": {\n" +" \"()\" : \"__main__.filter_maker\",\n" +" \"level\": \"WARNING\"\n" +" }\n" +" }\n" +"}" #: ../../howto/logging-cookbook.rst:352 msgid "and changing the section on the ``stdout`` handler to add it:" msgstr "" "そして ``stdout`` のハンドラに関するセクションにフィルターを追加します:" -#: ../../howto/logging-cookbook.rst:354 msgid "" "{\n" " \"stdout\": {\n" @@ -538,6 +718,15 @@ msgid "" " }\n" "}" msgstr "" +"{\n" +" \"stdout\": {\n" +" \"class\": \"logging.StreamHandler\",\n" +" \"level\": \"INFO\",\n" +" \"formatter\": \"simple\",\n" +" \"stream\": \"ext://sys.stdout\",\n" +" \"filters\": [\"warnings_and_below\"]\n" +" }\n" +"}" #: ../../howto/logging-cookbook.rst:366 msgid "" @@ -547,7 +736,6 @@ msgstr "" "フィルターは単なる関数なので、 ``filter_maker`` (ファクトリ関数) は以下のよう" "に定義することができます:" -#: ../../howto/logging-cookbook.rst:369 msgid "" "def filter_maker(level):\n" " level = getattr(logging, level)\n" @@ -557,6 +745,13 @@ msgid "" "\n" " return filter" msgstr "" +"def filter_maker(level):\n" +" level = getattr(logging, level)\n" +"\n" +" def filter(record):\n" +" return record.levelno <= level\n" +"\n" +" return filter" #: ../../howto/logging-cookbook.rst:379 msgid "" @@ -582,7 +777,6 @@ msgstr "" "フィルターを追加した ``main.py`` の全体像は以下のようになり、これで実行できる" "状態になりました:" -#: ../../howto/logging-cookbook.rst:389 msgid "" "import json\n" "import logging\n" @@ -650,69 +844,150 @@ msgid "" "logging.error('An ERROR message')\n" "logging.critical('A CRITICAL message')" msgstr "" - -#: ../../howto/logging-cookbook.rst:457 -msgid "And after running it like this:" -msgstr "これを以下のように実行します:" - -#: ../../howto/logging-cookbook.rst:459 -msgid "python main.py 2>stderr.log >stdout.log" -msgstr "" - -#: ../../howto/logging-cookbook.rst:463 -msgid "We can see the results are as expected:" -msgstr "すると期待通りの結果を得ることができます:" - -#: ../../howto/logging-cookbook.rst:465 -msgid "" -"$ more *.log\n" -"::::::::::::::\n" -"app.log\n" -"::::::::::::::\n" -"DEBUG - A DEBUG message\n" -"INFO - An INFO message\n" -"WARNING - A WARNING message\n" -"ERROR - An ERROR message\n" -"CRITICAL - A CRITICAL message\n" -"::::::::::::::\n" -"stderr.log\n" -"::::::::::::::\n" -"ERROR - An ERROR message\n" -"CRITICAL - A CRITICAL message\n" -"::::::::::::::\n" -"stdout.log\n" -"::::::::::::::\n" -"INFO - An INFO message\n" -"WARNING - A WARNING message" -msgstr "" - -#: ../../howto/logging-cookbook.rst:489 -msgid "Configuration server example" -msgstr "設定サーバの例" - -#: ../../howto/logging-cookbook.rst:491 -msgid "Here is an example of a module using the logging configuration server::" -msgstr "ログ記録設定サーバを使うモジュールの例です::" - -#: ../../howto/logging-cookbook.rst:493 -msgid "" +"import json\n" "import logging\n" "import logging.config\n" -"import time\n" -"import os\n" -"\n" -"# read initial config file\n" -"logging.config.fileConfig('logging.conf')\n" -"\n" -"# create and start listener on port 9999\n" -"t = logging.config.listen(9999)\n" -"t.start()\n" -"\n" -"logger = logging.getLogger('simpleExample')\n" "\n" -"try:\n" -" # loop through logging calls to see the difference\n" -" # new configurations make, until Ctrl+C is pressed\n" +"CONFIG = '''\n" +"{\n" +" \"version\": 1,\n" +" \"disable_existing_loggers\": false,\n" +" \"formatters\": {\n" +" \"simple\": {\n" +" \"format\": \"%(levelname)-8s - %(message)s\"\n" +" }\n" +" },\n" +" \"filters\": {\n" +" \"warnings_and_below\": {\n" +" \"()\" : \"__main__.filter_maker\",\n" +" \"level\": \"WARNING\"\n" +" }\n" +" },\n" +" \"handlers\": {\n" +" \"stdout\": {\n" +" \"class\": \"logging.StreamHandler\",\n" +" \"level\": \"INFO\",\n" +" \"formatter\": \"simple\",\n" +" \"stream\": \"ext://sys.stdout\",\n" +" \"filters\": [\"warnings_and_below\"]\n" +" },\n" +" \"stderr\": {\n" +" \"class\": \"logging.StreamHandler\",\n" +" \"level\": \"ERROR\",\n" +" \"formatter\": \"simple\",\n" +" \"stream\": \"ext://sys.stderr\"\n" +" },\n" +" \"file\": {\n" +" \"class\": \"logging.FileHandler\",\n" +" \"formatter\": \"simple\",\n" +" \"filename\": \"app.log\",\n" +" \"mode\": \"w\"\n" +" }\n" +" },\n" +" \"root\": {\n" +" \"level\": \"DEBUG\",\n" +" \"handlers\": [\n" +" \"stderr\",\n" +" \"stdout\",\n" +" \"file\"\n" +" ]\n" +" }\n" +"}\n" +"'''\n" +"\n" +"def filter_maker(level):\n" +" level = getattr(logging, level)\n" +"\n" +" def filter(record):\n" +" return record.levelno <= level\n" +"\n" +" return filter\n" +"\n" +"logging.config.dictConfig(json.loads(CONFIG))\n" +"logging.debug('A DEBUG message')\n" +"logging.info('An INFO message')\n" +"logging.warning('A WARNING message')\n" +"logging.error('An ERROR message')\n" +"logging.critical('A CRITICAL message')" + +#: ../../howto/logging-cookbook.rst:457 +msgid "And after running it like this:" +msgstr "これを以下のように実行します:" + +msgid "python main.py 2>stderr.log >stdout.log" +msgstr "python main.py 2>stderr.log >stdout.log" + +#: ../../howto/logging-cookbook.rst:463 +msgid "We can see the results are as expected:" +msgstr "すると期待通りの結果を得ることができます:" + +msgid "" +"$ more *.log\n" +"::::::::::::::\n" +"app.log\n" +"::::::::::::::\n" +"DEBUG - A DEBUG message\n" +"INFO - An INFO message\n" +"WARNING - A WARNING message\n" +"ERROR - An ERROR message\n" +"CRITICAL - A CRITICAL message\n" +"::::::::::::::\n" +"stderr.log\n" +"::::::::::::::\n" +"ERROR - An ERROR message\n" +"CRITICAL - A CRITICAL message\n" +"::::::::::::::\n" +"stdout.log\n" +"::::::::::::::\n" +"INFO - An INFO message\n" +"WARNING - A WARNING message" +msgstr "" +"$ more *.log\n" +"::::::::::::::\n" +"app.log\n" +"::::::::::::::\n" +"DEBUG - A DEBUG message\n" +"INFO - An INFO message\n" +"WARNING - A WARNING message\n" +"ERROR - An ERROR message\n" +"CRITICAL - A CRITICAL message\n" +"::::::::::::::\n" +"stderr.log\n" +"::::::::::::::\n" +"ERROR - An ERROR message\n" +"CRITICAL - A CRITICAL message\n" +"::::::::::::::\n" +"stdout.log\n" +"::::::::::::::\n" +"INFO - An INFO message\n" +"WARNING - A WARNING message" + +#: ../../howto/logging-cookbook.rst:489 +msgid "Configuration server example" +msgstr "設定サーバの例" + +#: ../../howto/logging-cookbook.rst:491 +msgid "Here is an example of a module using the logging configuration server::" +msgstr "ログ記録設定サーバを使うモジュールの例です::" + +msgid "" +"import logging\n" +"import logging.config\n" +"import time\n" +"import os\n" +"\n" +"# read initial config file\n" +"logging.config.fileConfig('logging.conf')\n" +"\n" +"# create and start listener on port 9999\n" +"t = logging.config.listen(9999)\n" +"t.start()\n" +"\n" +"logger = logging.getLogger('simpleExample')\n" +"\n" +"try:\n" +" # loop through logging calls to see the difference\n" +" # new configurations make, until Ctrl+C is pressed\n" " while True:\n" " logger.debug('debug message')\n" " logger.info('info message')\n" @@ -725,18 +1000,44 @@ msgid "" " logging.config.stopListening()\n" " t.join()" msgstr "" +"import logging\n" +"import logging.config\n" +"import time\n" +"import os\n" +"\n" +"# 初期設定ファイルを読む\n" +"logging.config.fileConfig('logging.conf')\n" +"\n" +"# 9999 番ポートでリスナーを作成して開始する\n" +"t = logging.config.listen(9999)\n" +"t.start()\n" +"\n" +"logger = logging.getLogger('simpleExample')\n" +"\n" +"try:\n" +" # Ctrl+C が押されるまでログの呼び出しを繰り返し、\n" +" # 新しい設定による違いを確認する\n" +" while True:\n" +" logger.debug('debug message')\n" +" logger.info('info message')\n" +" logger.warning('warn message')\n" +" logger.error('error message')\n" +" logger.critical('critical message')\n" +" time.sleep(5)\n" +"except KeyboardInterrupt:\n" +" # 後片付け\n" +" logging.config.stopListening()\n" +" t.join()" -#: ../../howto/logging-cookbook.rst:522 msgid "" "And here is a script that takes a filename and sends that file to the " "server, properly preceded with the binary-encoded length, as the new logging " "configuration::" msgstr "" -"そしてファイル名を受け取ってそのファイルをサーバに送るスクリプトですが、それ" -"に先だってバイナリエンコード長を新しいログ記録の設定として先に送っておきま" -"す::" +"次は、ファイル名を受け取り、そのファイルを新しいロギング設定としてサーバーに" +"送るスクリプトです。\n" +"ファイルの内容の前に、バイナリ形式で表したデータ長を送ります。 ::" -#: ../../howto/logging-cookbook.rst:526 msgid "" "#!/usr/bin/env python\n" "import socket, sys, struct\n" @@ -755,6 +1056,22 @@ msgid "" "s.close()\n" "print('complete')" msgstr "" +"#!/usr/bin/env python\n" +"import socket, sys, struct\n" +"\n" +"with open(sys.argv[1], 'rb') as f:\n" +" data_to_send = f.read()\n" +"\n" +"HOST = 'localhost'\n" +"PORT = 9999\n" +"s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n" +"print('connecting...')\n" +"s.connect((HOST, PORT))\n" +"print('sending config...')\n" +"s.send(struct.pack('>L', len(data_to_send)))\n" +"s.send(data_to_send)\n" +"s.close()\n" +"print('complete')" #: ../../howto/logging-cookbook.rst:547 msgid "Dealing with handlers that block" @@ -843,7 +1160,6 @@ msgstr "" msgid "An example of using these two classes follows (imports omitted)::" msgstr "この2つのクラスを利用する例です (import は省略)::" -#: ../../howto/logging-cookbook.rst:589 msgid "" "que = queue.Queue(-1) # no limit on size\n" "queue_handler = QueueHandler(que)\n" @@ -861,16 +1177,28 @@ msgid "" "root.warning('Look out!')\n" "listener.stop()" msgstr "" +"que = queue.Queue(-1) # サイズの上限なし\n" +"queue_handler = QueueHandler(que)\n" +"handler = logging.StreamHandler()\n" +"listener = QueueListener(que, handler)\n" +"root = logging.getLogger()\n" +"root.addHandler(queue_handler)\n" +"formatter = logging.Formatter('%(threadName)s: %(message)s')\n" +"handler.setFormatter(formatter)\n" +"listener.start()\n" +"# ログ出力には、内部キューを監視する内部スレッドではなく、\n" +"# イベントを生成したスレッド (メインスレッド) が表示される。\n" +"# これが期待する動作。\n" +"root.warning('Look out!')\n" +"listener.stop()" #: ../../howto/logging-cookbook.rst:605 msgid "which, when run, will produce:" msgstr "実行すると次のように出力します:" -#: ../../howto/logging-cookbook.rst:607 msgid "MainThread: Look out!" -msgstr "" +msgstr "MainThread: Look out!" -#: ../../howto/logging-cookbook.rst:611 msgid "" "Although the earlier discussion wasn't specifically talking about async " "code, but rather about slow logging handlers, it should be noted that when " @@ -880,16 +1208,16 @@ msgid "" "application, to use the above approach for logging, so that any blocking " "code runs only in the ``QueueListener`` thread." msgstr "" -"上述の議論は特に同期コードにについてのものではなく、むしろ遅いロギングハンド" -"ラについてでしたが、非同期コードやネットワーク、あるいはファイルハンドラから" -"のロギングでさえも (イベントループをブロックしてしまう) 問題につながる可能性" -"があることには注意すべきでしょう。これはいくつかのロギングが :mod:`asyncio` " -"内部で行われることが理由です。何らかの非同期コードがアプリケーションの中で使" -"われている場合、ロギングには上記のアプローチを使っていかなるブロッキングコー" -"ドも ``QueueListener`` スレッド内だけで実行されるようにしておくことが最も良い" -"でしょう。" +"ここまでは特に非同期コードを対象とせず、処理の遅いロギングハンドラについて説" +"明しました。\n" +"ただし、非同期コードからログを出力する場合、ネットワークハンドラだけでなく" +"ファイルハンドラも、イベントループをブロックして問題を起こす可能性がありま" +"す。\n" +":mod:`asyncio` の内部でもログが出力されるためです。\n" +"アプリケーションで非同期コードを使う場合は、ブロックする処理が " +"``QueueListener`` スレッド内だけで実行されるよう、上記の方法を使うのがよいで" +"しょう。" -#: ../../howto/logging-cookbook.rst:619 msgid "" "Prior to Python 3.5, the :class:`QueueListener` always passed every message " "received from the queue to every handler it was initialized with. (This was " @@ -900,22 +1228,22 @@ msgid "" "of each message with the handler's level, and only passes a message to a " "handler if it's appropriate to do so." msgstr "" -"Python 3.5 以前は、 :class:`QueueListener` クラスは常にキューから受け取った" -"メッセージを、初期化元となっているそれぞれのハンドラーに受け渡していました。 " -"( というのも、レベルフィルターリングは別サイド、つまり、キューが満たされてい" -"る場所で処理されるということが想定されているからです) Python 3.5以降では、" -"キーワードとなる引数 ``respect_handler_level=True`` をリスナーのコントラク" -"ターに受け渡すことで、この挙動を変更することができるようになっています。これ" -"が行われると、各メッセージのレベルをハンドラーのレベルと比較して、そうするこ" -"とが適切な場合のみ、メッセージをハンドラーに渡します。" +"Python 3.5 より前の :class:`QueueListener` は、キューから受け取ったすべての" +"メッセージを、初期化時に渡されたすべてのハンドラに渡していました。\n" +"レベルによるフィルタリングは、キューへ書き込む側ですべて行うと想定していたた" +"めです。\n" +"3.5 以降では、リスナーのコンストラクタにキーワード引数 " +"``respect_handler_level=True`` を渡すと、この動作を変更できます。\n" +"この場合、リスナーは各メッセージのレベルとハンドラのレベルを比較し、条件を満" +"たすメッセージだけをハンドラに渡します。" -#: ../../howto/logging-cookbook.rst:629 msgid "" "The :class:`QueueListener` can be started (and stopped) via the :keyword:" "`with` statement. For example:" msgstr "" +":class:`QueueListener` は :keyword:`with` 文で開始 (および停止) できます。\n" +"例えば:" -#: ../../howto/logging-cookbook.rst:633 msgid "" "with QueueListener(que, handler) as listener:\n" " # The queue listener automatically starts\n" @@ -924,6 +1252,12 @@ msgid "" "# The queue listener automatically stops once\n" "# the 'with' block is exited." msgstr "" +"with QueueListener(que, handler) as listener:\n" +" # with ブロックに入ると、\n" +" # キューリスナーが自動的に開始する。\n" +" pass\n" +"# with ブロックを抜けると、\n" +"# キューリスナーが自動的に停止する。" #: ../../howto/logging-cookbook.rst:645 msgid "Sending and receiving logging events across a network" @@ -975,7 +1309,6 @@ msgstr "" "受信端では :mod:`socketserver` モジュールを使って受信プログラムを作成しておき" "ます。簡単な実用プログラムを以下に示します::" -#: ../../howto/logging-cookbook.rst:678 msgid "" "import pickle\n" "import logging\n" @@ -1065,6 +1398,92 @@ msgid "" "if __name__ == '__main__':\n" " main()" msgstr "" +"import pickle\n" +"import logging\n" +"import logging.handlers\n" +"import socketserver\n" +"import struct\n" +"\n" +"\n" +"class LogRecordStreamHandler(socketserver.StreamRequestHandler):\n" +" \"\"\"ストリームで届くログ要求のハンドラー。\n" +"\n" +" This basically logs the record using whatever logging policy is\n" +" configured locally.\n" +" \"\"\"\n" +"\n" +" def handle(self):\n" +" \"\"\"\n" +" Handle multiple requests - each expected to be a 4-byte length,\n" +" followed by the LogRecord in pickle format. Logs the record\n" +" according to whatever policy is configured locally.\n" +" \"\"\"\n" +" while True:\n" +" chunk = self.connection.recv(4)\n" +" if len(chunk) < 4:\n" +" break\n" +" slen = struct.unpack('>L', chunk)[0]\n" +" chunk = self.connection.recv(slen)\n" +" while len(chunk) < slen:\n" +" chunk = chunk + self.connection.recv(slen - len(chunk))\n" +" obj = self.unPickle(chunk)\n" +" record = logging.makeLogRecord(obj)\n" +" self.handleLogRecord(record)\n" +"\n" +" def unPickle(self, data):\n" +" return pickle.loads(data)\n" +"\n" +" def handleLogRecord(self, record):\n" +" # 名前が指定されていれば、レコードが示すロガーではなく\n" +" # その名前のロガーを使う。\n" +" if self.server.logname is not None:\n" +" name = self.server.logname\n" +" else:\n" +" name = record.name\n" +" logger = logging.getLogger(name)\n" +" # 注意: すべてのレコードが記録される。Logger.handle は通常、\n" +" # ロガーのレベルによるフィルタリングの後で呼ばれるため。\n" +" # 処理時間とネットワーク帯域を無駄にしないよう、\n" +" # フィルタリングはクライアント側で行う。\n" +" logger.handle(record)\n" +"\n" +"class LogRecordSocketReceiver(socketserver.ThreadingTCPServer):\n" +" \"\"\"\n" +" Simple TCP socket-based logging receiver suitable for testing.\n" +" \"\"\"\n" +"\n" +" allow_reuse_address = True\n" +"\n" +" def __init__(self, host='localhost',\n" +" port=logging.handlers.DEFAULT_TCP_LOGGING_PORT,\n" +" handler=LogRecordStreamHandler):\n" +" socketserver.ThreadingTCPServer.__init__(self, (host, port), " +"handler)\n" +" self.abort = 0\n" +" self.timeout = 1\n" +" self.logname = None\n" +"\n" +" def serve_until_stopped(self):\n" +" import select\n" +" abort = 0\n" +" while not abort:\n" +" rd, wr, ex = select.select([self.socket.fileno()],\n" +" [], [],\n" +" self.timeout)\n" +" if rd:\n" +" self.handle_request()\n" +" abort = self.abort\n" +"\n" +"def main():\n" +" logging.basicConfig(\n" +" format='%(relativeCreated)5d %(name)-15s %(levelname)-8s " +"%(message)s')\n" +" tcpserver = LogRecordSocketReceiver()\n" +" print('About to start TCP server...')\n" +" tcpserver.serve_until_stopped()\n" +"\n" +"if __name__ == '__main__':\n" +" main()" #: ../../howto/logging-cookbook.rst:763 msgid "" @@ -1075,7 +1494,6 @@ msgstr "" "コンソールには何も出力されません; サーバ側では以下のようなメッセージを目にす" "るはずです::" -#: ../../howto/logging-cookbook.rst:766 msgid "" "About to start TCP server...\n" " 59 root INFO Jackdaws love my big sphinx of quartz.\n" @@ -1084,6 +1502,12 @@ msgid "" " 69 myapp.area2 WARNING Jail zesty vixen who grabbed pay from quack.\n" " 69 myapp.area2 ERROR The five boxing wizards jump quickly." msgstr "" +"About to start TCP server...\n" +" 59 root INFO Jackdaws love my big sphinx of quartz.\n" +" 59 myapp.area1 DEBUG Quick zephyrs blow, vexing daft Jim.\n" +" 69 myapp.area1 INFO How quickly daft jumping zebras vex.\n" +" 69 myapp.area2 WARNING Jail zesty vixen who grabbed pay from quack.\n" +" 69 myapp.area2 ERROR The five boxing wizards jump quickly." #: ../../howto/logging-cookbook.rst:775 msgid "" @@ -1098,21 +1522,20 @@ msgstr "" "し代替シリアライズ手法を実装して、それを使うように上記のスクリプトを修正する" "こともできます。" -#: ../../howto/logging-cookbook.rst:783 msgid "Running a logging socket listener in production" -msgstr "作成中のロギングソケットのリスナーを実行する" +msgstr "本番環境でロギングソケットのリスナーを実行する" -#: ../../howto/logging-cookbook.rst:787 msgid "" "To run a logging listener in production, you may need to use a process-" "management tool such as `Supervisor `_. `Here is a " "Gist `__ which provides the bare-bones files to run " "the above functionality using Supervisor. It consists of the following files:" msgstr "" -"作成中のロギングリスナーを実行するためには、 `Supervisor `_ のようなプロセス管理ツールを使う必要があるかもしれません。 `こちらの " -"Gist `__ は Supervisor を使って上記の機能を実行するた" -"めの必要最低限のファイルを提供しています。以下のファイルが必要になります:" +"本番環境でロギングリスナーを実行するには、`Supervisor `_ などのプロセス管理ツールが必要になる場合があります。\n" +"`こちらの Gist `__ には、上記の機能を Supervisor で実" +"行するための最小限のファイルが含まれています。\n" +"構成は次のとおりです:" #: ../../howto/logging-cookbook.rst:794 msgid "File" @@ -1187,9 +1610,8 @@ msgstr "web アプリケーションのための JSON 設定ファイル" msgid ":file:`client.py`" msgstr ":file:`client.py`" -#: ../../howto/logging-cookbook.rst:814 msgid "A Python script to exercise the web application" -msgstr "web アプリケーションを起動するための Python スクリプト" +msgstr "Web アプリケーションの動作を試す Python スクリプト" #: ../../howto/logging-cookbook.rst:817 msgid "" @@ -1243,13 +1665,13 @@ msgstr "" "``bash ensure_app.sh`` を実行して Supervisor が上記の設定で実行されていること" "を確認してください。" -#: ../../howto/logging-cookbook.rst:837 msgid "" "Run ``venv/bin/python client.py`` to exercise the web application, which " "will lead to records being written to the log." msgstr "" -"``venv/bin/python client.py`` を実行して web アプリケーションを起動してくださ" -"い。これによりログにレコードが書き込まれるはずです。" +"``venv/bin/python client.py`` を実行して Web アプリケーションの動作を試してく" +"ださい。\n" +"これによりログにレコードが書き込まれます。" #: ../../howto/logging-cookbook.rst:840 msgid "" @@ -1279,32 +1701,36 @@ msgstr "" "ありそうもないことですが、テスト環境で設定したポートが別の設定と衝突してし" "まった場合、設定ファイルを修正する必要があるかもしれません。" -#: ../../howto/logging-cookbook.rst:851 msgid "" "The default configuration uses a TCP socket on port 9020. You can use a Unix " "Domain socket instead of a TCP socket by doing the following:" msgstr "" +"デフォルトの設定はポート 9020 の TCP ソケットを使います。\n" +"次の変更で、TCP ソケットの代わりに Unix ドメインソケットを使えます:" -#: ../../howto/logging-cookbook.rst:854 msgid "" "In :file:`listener.json`, add a ``socket`` key with the path to the domain " "socket you want to use. If this key is present, the listener listens on the " "corresponding domain socket and not on a TCP socket (the ``port`` key is " "ignored)." msgstr "" +":file:`listener.json` に ``socket`` キーを追加し、使うドメインソケットのパス" +"を指定します。\n" +"このキーがある場合、リスナーは TCP ソケットではなく、指定されたドメインソケッ" +"トで待ち受けます (``port`` キーは無視されます)。" -#: ../../howto/logging-cookbook.rst:859 msgid "" "In :file:`webapp.json`, change the socket handler configuration dictionary " "so that the ``host`` value is the path to the domain socket, and set the " "``port`` value to ``null``." msgstr "" +":file:`webapp.json` のソケットハンドラの設定辞書で、``host`` の値をドメインソ" +"ケットのパスに、``port`` の値を ``null`` に変更します。" #: ../../howto/logging-cookbook.rst:869 msgid "Adding contextual information to your logging output" msgstr "コンテキスト情報をログ記録出力に付加する" -#: ../../howto/logging-cookbook.rst:871 msgid "" "Sometimes you want logging output to contain contextual information in " "addition to the parameters passed to the logging call. For example, in a " @@ -1319,17 +1745,18 @@ msgid "" "logging an application, it could be hard to manage if the number of :class:" "`Logger` instances becomes effectively unbounded." msgstr "" -"時にはログ記録出力にログ関数の呼び出し時に渡されたパラメータに加えてコンテキ" -"スト情報を含めたいこともあるでしょう。たとえば、ネットワークアプリケーション" -"で、クライアント固有の情報 (例: リモートクライアントの名前、 IP アドレス) も" -"ログ記録に残しておきたいと思ったとしましょう。 *extra* パラメータをこの目的に" -"使うこともできますが、いつでもこの方法で情報を渡すのが便利なやり方とも限りま" -"せん。また接続ごとに :class:`Logger` インスタンスを生成する誘惑に駆られるかも" -"しれませんが、生成した :class:`Logger` インスタンスはガーベジコレクションで回" -"収されないので、これは良いアイデアとは言えません。この例は現実的な問題ではな" -"いかもしれませんが、 :class:`Logger` インスタンスの個数がアプリケーションの中" -"でログ記録が行われるレベルの粒度に依存する場合、 :class:`Logger` インスタンス" -"の個数が事実上無制限にならないと、管理が難しくなります。" +"ログ呼び出しに渡す引数に加えて、コンテキスト情報もログに含めたい場合がありま" +"す。\n" +"例えばネットワークアプリケーションで、リモートクライアントのユーザー名や IP " +"アドレスなど、クライアント固有の情報を記録したい場合です。\n" +"*extra* パラメータで実現できますが、この方法で毎回情報を渡すのは便利とは限り" +"ません。\n" +"接続ごとに :class:`Logger` インスタンスを作りたくなるかもしれませんが、これら" +"はガベージコレクションで回収されないため、よい方法ではありません。\n" +":class:`Logger` インスタンスの数がアプリケーションのログ記録の粒度で決まるな" +"ら、実用上は問題ありません。\n" +"しかし :class:`Logger` インスタンスの数が事実上無制限になると、管理が難しくな" +"る可能性があります。" #: ../../howto/logging-cookbook.rst:886 msgid "Using LoggerAdapters to impart contextual information" @@ -1370,7 +1797,6 @@ msgstr "" "スト情報をその委譲された呼び出しに埋め込みます。 :class:`LoggerAdapter` の" "コードから少し抜き出してみます::" -#: ../../howto/logging-cookbook.rst:904 msgid "" "def debug(self, msg, /, *args, **kwargs):\n" " \"\"\"\n" @@ -1380,6 +1806,13 @@ msgid "" " msg, kwargs = self.process(msg, kwargs)\n" " self.logger.debug(msg, *args, **kwargs)" msgstr "" +"def debug(self, msg, /, *args, **kwargs):\n" +" \"\"\"\n" +" Delegate a debug call to the underlying logger, after adding\n" +" contextual information from this adapter instance.\n" +" \"\"\"\n" +" msg, kwargs = self.process(msg, kwargs)\n" +" self.logger.debug(msg, *args, **kwargs)" #: ../../howto/logging-cookbook.rst:912 msgid "" @@ -1420,7 +1853,6 @@ msgstr "" "要なだけです。次に挙げるのはこのクラスを使った例で、コンストラクタで使われる" "「辞書風」オブジェクトにどの振る舞いが必要なのかも示しています::" -#: ../../howto/logging-cookbook.rst:929 msgid "" "class CustomAdapter(logging.LoggerAdapter):\n" " \"\"\"\n" @@ -1430,16 +1862,24 @@ msgid "" " def process(self, msg, kwargs):\n" " return '[%s] %s' % (self.extra['connid'], msg), kwargs" msgstr "" +"class CustomAdapter(logging.LoggerAdapter):\n" +" \"\"\"\n" +" This example adapter expects the passed in dict-like object to have a\n" +" 'connid' key, whose value in brackets is prepended to the log message.\n" +" \"\"\"\n" +" def process(self, msg, kwargs):\n" +" return '[%s] %s' % (self.extra['connid'], msg), kwargs" #: ../../howto/logging-cookbook.rst:937 msgid "which you can use like this::" msgstr "これを次のように使うことができます::" -#: ../../howto/logging-cookbook.rst:939 msgid "" "logger = logging.getLogger(__name__)\n" "adapter = CustomAdapter(logger, {'connid': some_conn_id})" msgstr "" +"logger = logging.getLogger(__name__)\n" +"adapter = CustomAdapter(logger, {'connid': some_conn_id})" #: ../../howto/logging-cookbook.rst:942 msgid "" @@ -1502,7 +1942,6 @@ msgstr "" "といったようにです。その場合、同じフォーマット文字列を使って以下に示すように" "似たような出力を得られます。これはスクリプトの例です::" -#: ../../howto/logging-cookbook.rst:973 msgid "" "import logging\n" "from random import choice\n" @@ -1544,12 +1983,50 @@ msgid "" " a2.log(lvl, 'A message at %s level with %d %s', lvlname, 2, " "'parameters')" msgstr "" +"import logging\n" +"from random import choice\n" +"\n" +"class ContextFilter(logging.Filter):\n" +" \"\"\"\n" +" This is a filter which injects contextual information into the log.\n" +"\n" +" Rather than use actual contextual information, we just use random\n" +" data in this demo.\n" +" \"\"\"\n" +"\n" +" USERS = ['jim', 'fred', 'sheila']\n" +" IPS = ['123.231.231.123', '127.0.0.1', '192.168.0.1']\n" +"\n" +" def filter(self, record):\n" +"\n" +" record.ip = choice(ContextFilter.IPS)\n" +" record.user = choice(ContextFilter.USERS)\n" +" return True\n" +"\n" +"if __name__ == '__main__':\n" +" levels = (logging.DEBUG, logging.INFO, logging.WARNING, logging.ERROR, " +"logging.CRITICAL)\n" +" logging.basicConfig(level=logging.DEBUG,\n" +" format='%(asctime)-15s %(name)-5s %(levelname)-8s " +"IP: %(ip)-15s User: %(user)-8s %(message)s')\n" +" a1 = logging.getLogger('a.b.c')\n" +" a2 = logging.getLogger('d.e.f')\n" +"\n" +" f = ContextFilter()\n" +" a1.addFilter(f)\n" +" a2.addFilter(f)\n" +" a1.debug('A debug message')\n" +" a1.info('An info message with %s', 'some parameters')\n" +" for x in range(10):\n" +" lvl = choice(levels)\n" +" lvlname = logging.getLevelName(lvl)\n" +" a2.log(lvl, 'A message at %s level with %d %s', lvlname, 2, " +"'parameters')" #: ../../howto/logging-cookbook.rst:1010 msgid "which, when run, produces something like:" msgstr "実行すると、以下のようになります:" -#: ../../howto/logging-cookbook.rst:1012 msgid "" "2010-09-06 22:38:15,292 a.b.c DEBUG IP: 123.231.231.123 User: fred A " "debug message\n" @@ -1576,12 +2053,35 @@ msgid "" "2010-09-06 22:38:15,301 d.e.f INFO IP: 123.231.231.123 User: fred A " "message at INFO level with 2 parameters" msgstr "" +"2010-09-06 22:38:15,292 a.b.c DEBUG IP: 123.231.231.123 User: fred A " +"debug message\n" +"2010-09-06 22:38:15,300 a.b.c INFO IP: 192.168.0.1 User: sheila An " +"info message with some parameters\n" +"2010-09-06 22:38:15,300 d.e.f CRITICAL IP: 127.0.0.1 User: sheila A " +"message at CRITICAL level with 2 parameters\n" +"2010-09-06 22:38:15,300 d.e.f ERROR IP: 127.0.0.1 User: jim A " +"message at ERROR level with 2 parameters\n" +"2010-09-06 22:38:15,300 d.e.f DEBUG IP: 127.0.0.1 User: sheila A " +"message at DEBUG level with 2 parameters\n" +"2010-09-06 22:38:15,300 d.e.f ERROR IP: 123.231.231.123 User: fred A " +"message at ERROR level with 2 parameters\n" +"2010-09-06 22:38:15,300 d.e.f CRITICAL IP: 192.168.0.1 User: jim A " +"message at CRITICAL level with 2 parameters\n" +"2010-09-06 22:38:15,300 d.e.f CRITICAL IP: 127.0.0.1 User: sheila A " +"message at CRITICAL level with 2 parameters\n" +"2010-09-06 22:38:15,300 d.e.f DEBUG IP: 192.168.0.1 User: jim A " +"message at DEBUG level with 2 parameters\n" +"2010-09-06 22:38:15,301 d.e.f ERROR IP: 127.0.0.1 User: sheila A " +"message at ERROR level with 2 parameters\n" +"2010-09-06 22:38:15,301 d.e.f DEBUG IP: 123.231.231.123 User: fred A " +"message at DEBUG level with 2 parameters\n" +"2010-09-06 22:38:15,301 d.e.f INFO IP: 123.231.231.123 User: fred A " +"message at INFO level with 2 parameters" #: ../../howto/logging-cookbook.rst:1028 msgid "Use of ``contextvars``" msgstr "``contextvars`` の利用" -#: ../../howto/logging-cookbook.rst:1030 msgid "" "Since Python 3.7, the :mod:`contextvars` module has provided context-local " "storage which works for both :mod:`threading` and :mod:`asyncio` processing " @@ -1590,12 +2090,11 @@ msgid "" "logs can populated with contextual information such as, for example, request " "attributes handled by web applications." msgstr "" -"Python 3.7 以降、 :mod:`contextvars` モジュールは :mod:`threading` と :mod:" -"`asyncio` の両方の処理上のニーズを満たすコンテキストローカルな変数を提供して" -"います。このタイプの変数はスレッドローカルな変数に適しています。以下の例は、" -"マルチスレッド環境において、 いかにして web アプリケーションによって処理され" -"るリクエスト属性のような処理の文脈上の情報とともにログを投入できるかを示しま" -"す。" +"Python 3.7 以降の :mod:`contextvars` モジュールは、:mod:`threading` と :mod:" +"`asyncio` の両方で使えるコンテキストローカルな記憶領域を提供します。\n" +"このため、一般にスレッドローカルな記憶領域より適している場合があります。\n" +"次の例では、マルチスレッド環境で Web アプリケーションが処理するリクエストの属" +"性など、コンテキスト情報をログに追加する方法を示します。" #: ../../howto/logging-cookbook.rst:1036 msgid "" @@ -1618,7 +2117,6 @@ msgstr "" msgid "Let's assume that the library can be simulated by the following code:" msgstr "ここで、ライブラリは以下のコードで模することができるとします:" -#: ../../howto/logging-cookbook.rst:1045 msgid "" "# webapplib.py\n" "import logging\n" @@ -1632,6 +2130,17 @@ msgid "" " # Just sleep for a bit so other threads get to run\n" " time.sleep(0.01)" msgstr "" +"# webapplib.py\n" +"import logging\n" +"import time\n" +"\n" +"logger = logging.getLogger(__name__)\n" +"\n" +"def useful():\n" +" # ライブラリから記録する代表的なイベント\n" +" logger.debug('Hello from webapplib!')\n" +" # 他のスレッドが実行されるよう少し待つ\n" +" time.sleep(0.01)" #: ../../howto/logging-cookbook.rst:1059 msgid "" @@ -1799,7 +2308,6 @@ msgid "" " main()" msgstr "" -#: ../../howto/logging-cookbook.rst:1203 msgid "" "If you run the above, you should find that roughly half the requests go " "into :file:`app1.log` and the rest into :file:`app2.log`, and the all the " @@ -1809,16 +2317,68 @@ msgid "" "dummy request will always appear together in a log line). This is " "illustrated by the following shell output:" msgstr "" -"上記のコードを実行すると、およそ半分のリクエストが :file:`app1.log` に、残り" -"半分が :file:`app2.log` にそれぞれ記録され、同時に全てのリクエストが :file:" -"`app.log` に記録されることがわかるでしょう。それぞれの web アプリケーション固" -"有のログはそれぞれのアプリケーションからのログエントリだけを含み、リクエスト" -"情報が矛盾なくログに表示されている (すなわち、各ダミーリクエストの情報は常に" -"ログの行とともに現れる) はずです。このことは以下のシェルコマンドの出力により" -"例示されています:" - -#: ../../howto/logging-cookbook.rst:1210 -msgid "" +"上のコードを実行すると、リクエストのおよそ半分が :file:`app1.log` に、残り" +"が :file:`app2.log` に記録され、すべてのリクエストが :file:`app.log` にも記録" +"されます。\n" +"各 Web アプリケーション専用のログには、そのアプリケーションのログエントリだけ" +"が含まれます。\n" +"また、リクエストの情報は一貫して表示されます。\n" +"つまり、各ダミーリクエストの情報は常に同じログ行にまとまって現れます。\n" +"次のシェル出力で確認できます:" + +msgid "" +"~/logging-contextual-webapp$ python main.py\n" +"app1 processed 51 requests\n" +"app2 processed 49 requests\n" +"~/logging-contextual-webapp$ wc -l *.log\n" +" 153 app1.log\n" +" 147 app2.log\n" +" 300 app.log\n" +" 600 total\n" +"~/logging-contextual-webapp$ head -3 app1.log\n" +"Thread-3 (process_request) app1 __main__ jim 192.168.3.21 POST Request " +"processing started\n" +"Thread-3 (process_request) app1 webapplib jim 192.168.3.21 POST Hello " +"from webapplib!\n" +"Thread-5 (process_request) app1 __main__ jim 192.168.3.21 POST Request " +"processing started\n" +"~/logging-contextual-webapp$ head -3 app2.log\n" +"Thread-1 (process_request) app2 __main__ sheila 192.168.2.21 GET Request " +"processing started\n" +"Thread-1 (process_request) app2 webapplib sheila 192.168.2.21 GET Hello " +"from webapplib!\n" +"Thread-2 (process_request) app2 __main__ jim 192.168.2.20 GET Request " +"processing started\n" +"~/logging-contextual-webapp$ head app.log\n" +"Thread-1 (process_request) app2 __main__ sheila 192.168.2.21 GET Request " +"processing started\n" +"Thread-1 (process_request) app2 webapplib sheila 192.168.2.21 GET Hello " +"from webapplib!\n" +"Thread-2 (process_request) app2 __main__ jim 192.168.2.20 GET Request " +"processing started\n" +"Thread-3 (process_request) app1 __main__ jim 192.168.3.21 POST Request " +"processing started\n" +"Thread-2 (process_request) app2 webapplib jim 192.168.2.20 GET Hello " +"from webapplib!\n" +"Thread-3 (process_request) app1 webapplib jim 192.168.3.21 POST Hello " +"from webapplib!\n" +"Thread-4 (process_request) app2 __main__ fred 192.168.2.22 GET Request " +"processing started\n" +"Thread-5 (process_request) app1 __main__ jim 192.168.3.21 POST Request " +"processing started\n" +"Thread-4 (process_request) app2 webapplib fred 192.168.2.22 GET Hello " +"from webapplib!\n" +"Thread-6 (process_request) app1 __main__ jim 192.168.3.21 POST Request " +"processing started\n" +"~/logging-contextual-webapp$ grep app1 app1.log | wc -l\n" +"153\n" +"~/logging-contextual-webapp$ grep app2 app2.log | wc -l\n" +"147\n" +"~/logging-contextual-webapp$ grep app1 app.log | wc -l\n" +"153\n" +"~/logging-contextual-webapp$ grep app2 app.log | wc -l\n" +"147" +msgstr "" "~/logging-contextual-webapp$ python main.py\n" "app1 processed 51 requests\n" "app2 processed 49 requests\n" @@ -1870,7 +2430,6 @@ msgid "" "153\n" "~/logging-contextual-webapp$ grep app2 app.log | wc -l\n" "147" -msgstr "" #: ../../howto/logging-cookbook.rst:1250 msgid "Imparting contextual information in handlers" @@ -1888,7 +2447,6 @@ msgstr "" "下に示すスクリプトのように、直接レコードを編集する代わりに新しい :class:" "`~LogRecord` を返すフィルタを使うことができます::" -#: ../../howto/logging-cookbook.rst:1257 msgid "" "import copy\n" "import logging\n" @@ -1909,12 +2467,29 @@ msgid "" "\n" " logger.info('A log message')" msgstr "" +"import copy\n" +"import logging\n" +"\n" +"def filter(record: logging.LogRecord):\n" +" record = copy.copy(record)\n" +" record.user = 'jim'\n" +" return record\n" +"\n" +"if __name__ == '__main__':\n" +" logger = logging.getLogger()\n" +" logger.setLevel(logging.INFO)\n" +" handler = logging.StreamHandler()\n" +" formatter = logging.Formatter('%(message)s from %(user)-8s')\n" +" handler.setFormatter(formatter)\n" +" handler.addFilter(filter)\n" +" logger.addHandler(handler)\n" +"\n" +" logger.info('A log message')" #: ../../howto/logging-cookbook.rst:1279 msgid "Logging to a single file from multiple processes" msgstr "複数のプロセスからの単一ファイルへのログ記録" -#: ../../howto/logging-cookbook.rst:1281 msgid "" "Although logging is thread-safe, and logging to a single file from multiple " "threads in a single process *is* supported, logging to a single file from " @@ -1929,26 +2504,31 @@ msgid "" "includes a working socket receiver which can be used as a starting point for " "you to adapt in your own applications." msgstr "" -"ログ記録はスレッドセーフであり、単一プロセスの複数のスレッドからの単一ファイ" -"ルへのログ記録はサポート *されています* が、 *複数プロセス* からの単一ファイ" -"ルへのログ記録はサポート *されません* 。なぜなら、複数のプロセスをまたいで単" -"一のファイルへのアクセスを直列化する標準の方法が Python には存在しないからで" -"す。複数のプロセスから単一ファイルへログ記録しなければならないなら、最も良い" -"方法は、すべてのプロセスが :class:`~handlers.SocketHandler` に対してログ記録" -"を行い、独立したプロセスとしてソケットサーバを動かすことです。ソケットサーバ" -"はソケットから読み取ってファイルにログを書き出します。 (この機能を実行するた" -"めに、既存のプロセスの 1 つのスレッドを割り当てることもできます) :ref:`この" -"節 ` では、このアプローチをさらに詳細に文書化しています。動" -"作するソケット受信プログラムが含まれているので、アプリケーションに組み込むた" -"めの出発点として使用できるでしょう。" - -#: ../../howto/logging-cookbook.rst:1294 +"logging はスレッドセーフで、一つのプロセスの複数のスレッドから単一のファイル" +"にログを記録することはサポート *されています*。\n" +"一方、*複数のプロセス* から単一のファイルに記録することはサポート *されません" +"*。\n" +"Python には、複数のプロセスによる単一ファイルへのアクセスを直列化する標準的な" +"方法がないためです。\n" +"必要な場合は、すべてのプロセスで :class:`~handlers.SocketHandler` にログを送" +"り、別のプロセスにソケットサーバーを実装して、受信したログをファイルに書き込" +"む方法があります。\n" +"既存のプロセスの一つのスレッドを、この処理専用にすることもできます。\n" +":ref:`この節 ` ではこの方法を詳しく説明し、動作するソケット" +"受信プログラムも示しています。\n" +"自分のアプリケーションに合わせて変更する際の出発点として使えます。" + msgid "" "You could also write your own handler which uses the :class:" "`~multiprocessing.Lock` class from the :mod:`multiprocessing` module to " "serialize access to the file from your processes. The stdlib :class:" "`FileHandler` and subclasses do not make use of :mod:`multiprocessing`." msgstr "" +":mod:`multiprocessing` モジュールの :class:`~multiprocessing.Lock` クラスを使" +"い、複数のプロセスからファイルへのアクセスを直列化する独自のハンドラを作るこ" +"ともできます。\n" +"標準ライブラリの :class:`FileHandler` とそのサブクラスは :mod:" +"`multiprocessing` を使っていません。" #: ../../howto/logging-cookbook.rst:1301 msgid "" @@ -1973,7 +2553,6 @@ msgstr "" "listener とアプリケーション内の他のプロセスで完全に異なる設定を使う例になって" "いるので、各自の要求に応じたコードを書く叩き台になるでしょう::" -#: ../../howto/logging-cookbook.rst:1312 msgid "" "# You'll need these imports in your own code\n" "import logging\n" @@ -2092,6 +2671,114 @@ msgid "" "if __name__ == '__main__':\n" " main()" msgstr "" +"# 自分のコードでもこれらのインポートが必要\n" +"import logging\n" +"import logging.handlers\n" +"import multiprocessing\n" +"\n" +"# 次の 2 行のインポートはこの実演用\n" +"from random import choice, random\n" +"import time\n" +"\n" +"#\n" +"# リスナーとワーカーのログ設定を定義できるよう、両プロセスの関数は\n" +"# そのプロセスのログを設定する呼び出し可能オブジェクトを\n" +"# configurer パラメーターで受け取る。これらの関数には、\n" +"# 通信に使うキューも渡す。\n" +"#\n" +"# 実際にはリスナーを自由に設定できるが、この単純な例では、\n" +"# リスナーは受信したレコードにレベルやフィルターの処理を適用しない。\n" +"# 通常は、除外されるイベントをプロセス間で送らないよう、\n" +"# ワーカープロセス側でこれらの処理を行うとよい。\n" +"#\n" +"# 結果を確認しやすいよう、ローテーションするファイルのサイズを小さくする。\n" +"def listener_configurer():\n" +" root = logging.getLogger()\n" +" h = logging.handlers.RotatingFileHandler('mptest.log', 'a', 300, 10)\n" +" f = logging.Formatter('%(asctime)s %(processName)-10s %(name)s " +"%(levelname)-8s %(message)s')\n" +" h.setFormatter(f)\n" +" root.addHandler(h)\n" +"\n" +"# リスナープロセスの最上位のループ。キューからログイベント\n" +"# (LogRecord) を待ち受けて処理し、\n" +"# LogRecord の代わりに None を受け取ったら終了する。\n" +"def listener_process(queue, configurer):\n" +" configurer()\n" +" while True:\n" +" try:\n" +" record = queue.get()\n" +" if record is None: # 終了を伝える番兵としてリスナーに送る。\n" +" break\n" +" logger = logging.getLogger(record.name)\n" +" logger.handle(record) # レベルやフィルターの処理を適用せず、その" +"まま記録する。\n" +" except Exception:\n" +" import sys, traceback\n" +" print('Whoops! Problem:', file=sys.stderr)\n" +" traceback.print_exc(file=sys.stderr)\n" +"\n" +"# この実演でランダムに選択するための配列\n" +"\n" +"LEVELS = [logging.DEBUG, logging.INFO, logging.WARNING,\n" +" logging.ERROR, logging.CRITICAL]\n" +"\n" +"LOGGERS = ['a.b.c', 'd.e.f']\n" +"\n" +"MESSAGES = [\n" +" 'Random message #1',\n" +" 'Random message #2',\n" +" 'Random message #3',\n" +"]\n" +"\n" +"# ワーカーの設定は、ワーカープロセスの実行開始時に行う。\n" +"# Windows では fork の動作に頼れないため、\n" +"# 各プロセスが開始時にログ設定のコードを実行する。\n" +"def worker_configurer(queue):\n" +" h = logging.handlers.QueueHandler(queue) # 必要なハンドラーはこの一つだ" +"け\n" +" root = logging.getLogger()\n" +" root.addHandler(h)\n" +" # 実演のためすべてのメッセージを送り、他のレベルやフィルターの処理は適用" +"しない。\n" +" root.setLevel(logging.DEBUG)\n" +"\n" +"# ワーカープロセスの最上位のループ。ランダムな間隔を空けて\n" +"# 10 個のイベントを記録してから終了する。\n" +"# print のメッセージは、何か動作していることを確認するためだけのもの。\n" +"def worker_process(queue, configurer):\n" +" configurer(queue)\n" +" name = multiprocessing.current_process().name\n" +" print('Worker started: %s' % name)\n" +" for i in range(10):\n" +" time.sleep(random())\n" +" logger = logging.getLogger(choice(LOGGERS))\n" +" level = choice(LEVELS)\n" +" message = choice(MESSAGES)\n" +" logger.log(level, message)\n" +" print('Worker finished: %s' % name)\n" +"\n" +"# 実演全体を制御する。キューを作成し、リスナーを作成して開始する。\n" +"# 10 個のワーカーを作成して開始し、終了を待つ。\n" +"# 最後にキューに None を送り、リスナーに終了を伝える。\n" +"def main():\n" +" queue = multiprocessing.Queue(-1)\n" +" listener = multiprocessing.Process(target=listener_process,\n" +" args=(queue, listener_configurer))\n" +" listener.start()\n" +" workers = []\n" +" for i in range(10):\n" +" worker = multiprocessing.Process(target=worker_process,\n" +" args=(queue, worker_configurer))\n" +" workers.append(worker)\n" +" worker.start()\n" +" for w in workers:\n" +" w.join()\n" +" queue.put_nowait(None)\n" +" listener.join()\n" +"\n" +"if __name__ == '__main__':\n" +" main()" #: ../../howto/logging-cookbook.rst:1417 msgid "" @@ -2099,7 +2786,6 @@ msgid "" "separate thread::" msgstr "上のスクリプトの亜種で、logging をメインプロセスの別スレッドで行う例::" -#: ../../howto/logging-cookbook.rst:1420 msgid "" "import logging\n" "import logging.config\n" @@ -2195,6 +2881,99 @@ msgid "" " q.put(None)\n" " lp.join()" msgstr "" +"import logging\n" +"import logging.config\n" +"import logging.handlers\n" +"from multiprocessing import Process, Queue\n" +"import random\n" +"import threading\n" +"import time\n" +"\n" +"def logger_thread(q):\n" +" while True:\n" +" record = q.get()\n" +" if record is None:\n" +" break\n" +" logger = logging.getLogger(record.name)\n" +" logger.handle(record)\n" +"\n" +"\n" +"def worker_process(q):\n" +" qh = logging.handlers.QueueHandler(q)\n" +" root = logging.getLogger()\n" +" root.setLevel(logging.DEBUG)\n" +" root.addHandler(qh)\n" +" levels = [logging.DEBUG, logging.INFO, logging.WARNING, logging.ERROR,\n" +" logging.CRITICAL]\n" +" loggers = ['foo', 'foo.bar', 'foo.bar.baz',\n" +" 'spam', 'spam.ham', 'spam.ham.eggs']\n" +" for i in range(100):\n" +" lvl = random.choice(levels)\n" +" logger = logging.getLogger(random.choice(loggers))\n" +" logger.log(lvl, 'Message no. %d', i)\n" +"\n" +"if __name__ == '__main__':\n" +" q = Queue()\n" +" d = {\n" +" 'version': 1,\n" +" 'formatters': {\n" +" 'detailed': {\n" +" 'class': 'logging.Formatter',\n" +" 'format': '%(asctime)s %(name)-15s %(levelname)-8s " +"%(processName)-10s %(message)s'\n" +" }\n" +" },\n" +" 'handlers': {\n" +" 'console': {\n" +" 'class': 'logging.StreamHandler',\n" +" 'level': 'INFO',\n" +" },\n" +" 'file': {\n" +" 'class': 'logging.FileHandler',\n" +" 'filename': 'mplog.log',\n" +" 'mode': 'w',\n" +" 'formatter': 'detailed',\n" +" },\n" +" 'foofile': {\n" +" 'class': 'logging.FileHandler',\n" +" 'filename': 'mplog-foo.log',\n" +" 'mode': 'w',\n" +" 'formatter': 'detailed',\n" +" },\n" +" 'errors': {\n" +" 'class': 'logging.FileHandler',\n" +" 'filename': 'mplog-errors.log',\n" +" 'mode': 'w',\n" +" 'level': 'ERROR',\n" +" 'formatter': 'detailed',\n" +" },\n" +" },\n" +" 'loggers': {\n" +" 'foo': {\n" +" 'handlers': ['foofile']\n" +" }\n" +" },\n" +" 'root': {\n" +" 'level': 'DEBUG',\n" +" 'handlers': ['console', 'file', 'errors']\n" +" },\n" +" }\n" +" workers = []\n" +" for i in range(5):\n" +" wp = Process(target=worker_process, name='worker %d' % (i + 1), " +"args=(q,))\n" +" workers.append(wp)\n" +" wp.start()\n" +" logging.config.dictConfig(d)\n" +" lp = threading.Thread(target=logger_thread, args=(q,))\n" +" lp.start()\n" +" # この時点で、メインプロセスは独自の仕事を行える\n" +" # それが終わったら、ワーカーの終了を待てる。\n" +" for wp in workers:\n" +" wp.join()\n" +" # ログ用のスレッドにも終了を伝える\n" +" q.put(None)\n" +" lp.join()" #: ../../howto/logging-cookbook.rst:1512 msgid "" @@ -2225,25 +3004,24 @@ msgstr "" "ProcessPoolExecutor` を使いたいのであれば、少し違う方法でキューを作る必要があ" "ります。次のような方法の代わりに" -#: ../../howto/logging-cookbook.rst:1525 msgid "queue = multiprocessing.Queue(-1)" -msgstr "" +msgstr "queue = multiprocessing.Queue(-1)" #: ../../howto/logging-cookbook.rst:1529 msgid "you should use" msgstr "次のコードを利用する必要があります" -#: ../../howto/logging-cookbook.rst:1531 msgid "" "queue = multiprocessing.Manager().Queue(-1) # also works with the examples " "above" msgstr "" +"queue = multiprocessing.Manager().Queue(-1) # also works with the examples " +"above" #: ../../howto/logging-cookbook.rst:1535 msgid "and you can then replace the worker creation from this::" msgstr "そして、次のようなワーカー作成コードがあったとすると::" -#: ../../howto/logging-cookbook.rst:1537 msgid "" "workers = []\n" "for i in range(10):\n" @@ -2254,6 +3032,14 @@ msgid "" "for w in workers:\n" " w.join()" msgstr "" +"workers = []\n" +"for i in range(10):\n" +" worker = multiprocessing.Process(target=worker_process,\n" +" args=(queue, worker_configurer))\n" +" workers.append(worker)\n" +" worker.start()\n" +"for w in workers:\n" +" w.join()" #: ../../howto/logging-cookbook.rst:1546 msgid "to this (remembering to first import :mod:`concurrent.futures`)::" @@ -2261,12 +3047,14 @@ msgstr "" "次のように変更します(最初に :mod:`concurrent.futures` をインポートするのを忘" "れないようにしましょう)::" -#: ../../howto/logging-cookbook.rst:1548 msgid "" "with concurrent.futures.ProcessPoolExecutor(max_workers=10) as executor:\n" " for i in range(10):\n" " executor.submit(worker_process, queue, worker_configurer)" msgstr "" +"with concurrent.futures.ProcessPoolExecutor(max_workers=10) as executor:\n" +" for i in range(10):\n" +" executor.submit(worker_process, queue, worker_configurer)" #: ../../howto/logging-cookbook.rst:1553 msgid "Deploying Web applications using Gunicorn and uWSGI" @@ -2305,40 +3093,64 @@ msgid "" "number of files and the size of the files both remain bounded. For this " "usage pattern, the logging package provides a :class:`RotatingFileHandler`::" msgstr "" -"ログファイルがある大きさに達したら、新しいファイルを開いてそこにログを取りた" -"いことがあります。そのファイルをある数だけ残し、その数のファイルが生成された" -"らファイルを循環し、ファイルの数も大きさも制限したいこともあるでしょう。この" -"利用パターンのために、 logging パッケージは :class:`RotatingFileHandler` を提" -"供しています::" - -#: ../../howto/logging-cookbook.rst:1576 -msgid "" +"ログファイルがある大きさに達したら、新しいファイルを開いてそこにログを取りた" +"いことがあります。そのファイルをある数だけ残し、その数のファイルが生成された" +"らファイルを循環し、ファイルの数も大きさも制限したいこともあるでしょう。この" +"利用パターンのために、 logging パッケージは :class:`RotatingFileHandler` を提" +"供しています::" + +msgid "" +"import glob\n" +"import logging\n" +"import logging.handlers\n" +"\n" +"LOG_FILENAME = 'logging_rotatingfile_example.out'\n" +"\n" +"# Set up a specific logger with our desired output level\n" +"my_logger = logging.getLogger('MyLogger')\n" +"my_logger.setLevel(logging.DEBUG)\n" +"\n" +"# Add the log message handler to the logger\n" +"handler = logging.handlers.RotatingFileHandler(\n" +" LOG_FILENAME, maxBytes=20, backupCount=5)\n" +"\n" +"my_logger.addHandler(handler)\n" +"\n" +"# Log some messages\n" +"for i in range(20):\n" +" my_logger.debug('i = %d' % i)\n" +"\n" +"# See what files are created\n" +"logfiles = glob.glob('%s*' % LOG_FILENAME)\n" +"\n" +"for filename in logfiles:\n" +" print(filename)" +msgstr "" "import glob\n" "import logging\n" "import logging.handlers\n" "\n" "LOG_FILENAME = 'logging_rotatingfile_example.out'\n" "\n" -"# Set up a specific logger with our desired output level\n" +"# 目的の出力レベルを持つロガーを設定する\n" "my_logger = logging.getLogger('MyLogger')\n" "my_logger.setLevel(logging.DEBUG)\n" "\n" -"# Add the log message handler to the logger\n" +"# ログメッセージのハンドラーをロガーに追加する\n" "handler = logging.handlers.RotatingFileHandler(\n" " LOG_FILENAME, maxBytes=20, backupCount=5)\n" "\n" "my_logger.addHandler(handler)\n" "\n" -"# Log some messages\n" +"# メッセージを記録する\n" "for i in range(20):\n" " my_logger.debug('i = %d' % i)\n" "\n" -"# See what files are created\n" +"# 作成されたファイルを確認する\n" "logfiles = glob.glob('%s*' % LOG_FILENAME)\n" "\n" "for filename in logfiles:\n" " print(filename)" -msgstr "" #: ../../howto/logging-cookbook.rst:1602 msgid "" @@ -2348,7 +3160,6 @@ msgstr "" "この結果として、アプリケーションのログ履歴の一部である、6 つに別れたファイル" "が得られます:" -#: ../../howto/logging-cookbook.rst:1605 msgid "" "logging_rotatingfile_example.out\n" "logging_rotatingfile_example.out.1\n" @@ -2357,6 +3168,12 @@ msgid "" "logging_rotatingfile_example.out.4\n" "logging_rotatingfile_example.out.5" msgstr "" +"logging_rotatingfile_example.out\n" +"logging_rotatingfile_example.out.1\n" +"logging_rotatingfile_example.out.2\n" +"logging_rotatingfile_example.out.3\n" +"logging_rotatingfile_example.out.4\n" +"logging_rotatingfile_example.out.5" #: ../../howto/logging-cookbook.rst:1614 msgid "" @@ -2415,7 +3232,6 @@ msgstr "" "で、 :meth:`str.format` か :class:`string.Template` を使った format を指定す" "る事ができます。次の例はこの機能を使ってみています:" -#: ../../howto/logging-cookbook.rst:1645 msgid "" ">>> import logging\n" ">>> root = logging.getLogger()\n" @@ -2439,6 +3255,27 @@ msgid "" "2010-10-28 15:13:11,494 foo.bar CRITICAL This is a CRITICAL message\n" ">>>" msgstr "" +">>> import logging\n" +">>> root = logging.getLogger()\n" +">>> root.setLevel(logging.DEBUG)\n" +">>> handler = logging.StreamHandler()\n" +">>> bf = logging.Formatter('{asctime} {name} {levelname:8s} {message}',\n" +"... style='{')\n" +">>> handler.setFormatter(bf)\n" +">>> root.addHandler(handler)\n" +">>> logger = logging.getLogger('foo.bar')\n" +">>> logger.debug('This is a DEBUG message')\n" +"2010-10-28 15:11:55,341 foo.bar DEBUG This is a DEBUG message\n" +">>> logger.critical('This is a CRITICAL message')\n" +"2010-10-28 15:12:11,526 foo.bar CRITICAL This is a CRITICAL message\n" +">>> df = logging.Formatter('$asctime $name ${levelname} $message',\n" +"... style='$')\n" +">>> handler.setFormatter(df)\n" +">>> logger.debug('This is a DEBUG message')\n" +"2010-10-28 15:13:06,924 foo.bar DEBUG This is a DEBUG message\n" +">>> logger.critical('This is a CRITICAL message')\n" +"2010-10-28 15:13:11,494 foo.bar CRITICAL This is a CRITICAL message\n" +">>>" #: ../../howto/logging-cookbook.rst:1669 msgid "" @@ -2450,12 +3287,14 @@ msgstr "" "全に独立していることに注意してください。次の例でわかるように、メッセージを生" "成する部分では % を使い続けています::" -#: ../../howto/logging-cookbook.rst:1673 msgid "" ">>> logger.error('This is an%s %s %s', 'other,', 'ERROR,', 'message')\n" "2010-10-28 15:19:29,833 foo.bar ERROR This is another, ERROR, message\n" ">>>" msgstr "" +">>> logger.error('This is an%s %s %s', 'other,', 'ERROR,', 'message')\n" +"2010-10-28 15:19:29,833 foo.bar ERROR This is another, ERROR, message\n" +">>>" #: ../../howto/logging-cookbook.rst:1677 msgid "" @@ -2495,7 +3334,6 @@ msgstr "" "logging パッケージはそのオブジェクトに対して ``str()`` を使って実際の format " "文字列を生成します。次の2つのクラスを見てください::" -#: ../../howto/logging-cookbook.rst:1696 ../../howto/logging-cookbook.rst:2784 msgid "" "class BraceMessage:\n" " def __init__(self, fmt, /, *args, **kwargs):\n" @@ -2515,6 +3353,23 @@ msgid "" " from string import Template\n" " return Template(self.fmt).substitute(**self.kwargs)" msgstr "" +"class BraceMessage:\n" +" def __init__(self, fmt, /, *args, **kwargs):\n" +" self.fmt = fmt\n" +" self.args = args\n" +" self.kwargs = kwargs\n" +"\n" +" def __str__(self):\n" +" return self.fmt.format(*self.args, **self.kwargs)\n" +"\n" +"class DollarMessage:\n" +" def __init__(self, fmt, /, **kwargs):\n" +" self.fmt = fmt\n" +" self.kwargs = kwargs\n" +"\n" +" def __str__(self):\n" +" from string import Template\n" +" return Template(self.fmt).substitute(**self.kwargs)" #: ../../howto/logging-cookbook.rst:1714 msgid "" @@ -2543,7 +3398,6 @@ msgstr "" "です。これらは次の例のようにして利用できます。(上のクラスが ``wherever`` とい" "うモジュールで定義されていると仮定します):" -#: ../../howto/logging-cookbook.rst:1726 msgid "" ">>> from wherever import BraceMessage as __\n" ">>> print(__('Message with {0} {name}', 2, name='placeholders'))\n" @@ -2561,6 +3415,21 @@ msgid "" "Message with 2 placeholders\n" ">>>" msgstr "" +">>> from wherever import BraceMessage as __\n" +">>> print(__('Message with {0} {name}', 2, name='placeholders'))\n" +"Message with 2 placeholders\n" +">>> class Point: pass\n" +"...\n" +">>> p = Point()\n" +">>> p.x = 0.5\n" +">>> p.y = 0.5\n" +">>> print(__('Message with coordinates: ({point.x:.2f}, {point.y:.2f})',\n" +"... point=p))\n" +"Message with coordinates: (0.50, 0.50)\n" +">>> from wherever import DollarMessage as __\n" +">>> print(__('Message with $num $what', num=2, what='placeholders'))\n" +"Message with 2 placeholders\n" +">>>" #: ../../howto/logging-cookbook.rst:1744 msgid "" @@ -2597,7 +3466,6 @@ msgstr "" "次の例のように、 :class:`LoggerAdapter` を利用して上と似たような効果を実現す" "る方法もあります::" -#: ../../howto/logging-cookbook.rst:1759 msgid "" "import logging\n" "\n" @@ -2625,6 +3493,31 @@ msgid "" " logging.basicConfig(level=logging.DEBUG)\n" " main()" msgstr "" +"import logging\n" +"\n" +"class Message:\n" +" def __init__(self, fmt, args):\n" +" self.fmt = fmt\n" +" self.args = args\n" +"\n" +" def __str__(self):\n" +" return self.fmt.format(*self.args)\n" +"\n" +"class StyleAdapter(logging.LoggerAdapter):\n" +" def log(self, level, msg, /, *args, stacklevel=1, **kwargs):\n" +" if self.isEnabledFor(level):\n" +" msg, kwargs = self.process(msg, kwargs)\n" +" self.logger.log(level, Message(msg, args), **kwargs,\n" +" stacklevel=stacklevel+1)\n" +"\n" +"logger = StyleAdapter(logging.getLogger(__name__))\n" +"\n" +"def main():\n" +" logger.debug('Hello, {}', 'world!')\n" +"\n" +"if __name__ == '__main__':\n" +" logging.basicConfig(level=logging.DEBUG)\n" +" main()" #: ../../howto/logging-cookbook.rst:1785 msgid "" @@ -2638,7 +3531,6 @@ msgstr "" msgid "Customizing ``LogRecord``" msgstr "``LogRecord`` のカスタマイズ" -#: ../../howto/logging-cookbook.rst:1796 msgid "" "Every logging event is represented by a :class:`LogRecord` instance. When an " "event is logged and not filtered out by a logger's level, a :class:" @@ -2648,19 +3540,20 @@ msgid "" "disabled). Before Python 3.2, there were only two places where this creation " "was done:" msgstr "" -"全ての logging イベントは :class:`LogRecord` のインスタンスとして表現されま" -"す。イベントのログが取られて logger のレベルでフィルタされなかった場合、イベ" -"ントの情報を含む :class:`LogRecord` が生成され、その logger (と、 propagate " -"が無効になるまでの上位 logger) の handler に渡されます。 Python 3.2 までは、" -"この生成が行われているのは2箇所だけでした:" +"すべてのログイベントは :class:`LogRecord` インスタンスで表されます。\n" +"ログ呼び出しが行われ、ロガーのレベルで除外されなければ、イベントの情報を格納" +"した :class:`LogRecord` が作成されます。\n" +"これはそのロガーのハンドラと、階層の上方向への伝播が無効になっているロガーま" +"での、祖先ロガーのハンドラに渡されます (伝播が無効なロガー自身も含みます)。\n" +"Python 3.2 より前では、レコードを作成する箇所は次の二つだけでした:" -#: ../../howto/logging-cookbook.rst:1803 msgid "" ":meth:`Logger.makeRecord`, which is called in the normal process of logging " "an event. This invoked :class:`LogRecord` directly to create an instance." msgstr "" -":meth:`Logger.makeRecord`: 通常のイベント logging プロセスで呼ばれます。これ" -"は :class:`LogRecord` を直接読んでインスタンスを生成します。" +":meth:`Logger.makeRecord` は、通常のログイベントの処理中に呼び出されます。\n" +"このメソッドは :class:`LogRecord` を直接呼び出してインスタンスを作成していま" +"した。" #: ../../howto/logging-cookbook.rst:1806 msgid "" @@ -2683,15 +3576,14 @@ msgstr "" "そのために :class:`LogRecord` で何か特別なことをしたい場合は、次のどちらかを" "しなければなりません。" -#: ../../howto/logging-cookbook.rst:1815 msgid "" "Create your own :class:`Logger` subclass, which overrides :meth:`Logger." "makeRecord`, and set it using :func:`~logging.setLoggerClass` before any " "loggers that you care about are instantiated." msgstr "" -":meth:`Logger.makeRecord` をオーバーライドした独自の :class:`Logger` のサブク" -"ラスを作り、利用したい logger のどれかがインスタンス化される前に、それを :" -"func:`~logging.setLoggerClass` を使って登録する。" +":meth:`Logger.makeRecord` をオーバーライドする独自の :class:`Logger` サブクラ" +"スを作り、対象とするロガーが一つでもインスタンス化される前に、:func:" +"`~logging.setLoggerClass` で登録する。" #: ../../howto/logging-cookbook.rst:1818 msgid "" @@ -2727,9 +3619,8 @@ msgstr "" "れずに設定しないといけなくなります。 (新しいパッケージやモジュールを追加し、" "モジュールレベルで次の式を実行することで、新しい logger が作られます) ::" -#: ../../howto/logging-cookbook.rst:1833 msgid "logger = logging.getLogger(__name__)" -msgstr "" +msgstr "logger = logging.getLogger(__name__)" #: ../../howto/logging-cookbook.rst:1835 msgid "" @@ -2808,13 +3699,11 @@ msgstr "" "しての実行時のオーバーヘッドになることを念頭に置き、このテクニックは :class:" "`Filter` を利用するだけでは望む結果が得られない場合にのみ使うべきです。" -#: ../../howto/logging-cookbook.rst:1873 msgid "Subclassing QueueHandler and QueueListener- a ZeroMQ example" -msgstr "" +msgstr "QueueHandler と QueueListener のサブクラス化: ZeroMQ の例" -#: ../../howto/logging-cookbook.rst:1876 ../../howto/logging-cookbook.rst:2009 msgid "Subclass ``QueueHandler``" -msgstr "" +msgstr "``QueueHandler`` のサブクラス化" #: ../../howto/logging-cookbook.rst:1878 msgid "" @@ -2826,7 +3715,6 @@ msgstr "" "ZeroMQ の 'publish' ソケットに送信することができます。下の例では、ソケットを" "別に作ってそれを handler に ('queue' として) 渡します::" -#: ../../howto/logging-cookbook.rst:1882 msgid "" "import zmq # using pyzmq, the Python binding for ZeroMQ\n" "import json # for serializing records portably\n" @@ -2842,6 +3730,19 @@ msgid "" "\n" "handler = ZeroMQSocketHandler(sock)" msgstr "" +"import zmq # using pyzmq, the Python binding for ZeroMQ\n" +"import json # for serializing records portably\n" +"\n" +"ctx = zmq.Context()\n" +"sock = zmq.Socket(ctx, zmq.PUB) # or zmq.PUSH, or other suitable value\n" +"sock.bind('tcp://*:5556') # or wherever\n" +"\n" +"class ZeroMQSocketHandler(QueueHandler):\n" +" def enqueue(self, record):\n" +" self.queue.send_json(record.__dict__)\n" +"\n" +"\n" +"handler = ZeroMQSocketHandler(sock)" #: ../../howto/logging-cookbook.rst:1897 msgid "" @@ -2851,7 +3752,6 @@ msgstr "" "もちろん同じことを別の設計でもできます。socket を作るのに必要な情報を " "handler に渡す例です::" -#: ../../howto/logging-cookbook.rst:1900 msgid "" "class ZeroMQSocketHandler(QueueHandler):\n" " def __init__(self, uri, socktype=zmq.PUB, ctx=None):\n" @@ -2866,10 +3766,21 @@ msgid "" " def close(self):\n" " self.queue.close()" msgstr "" +"class ZeroMQSocketHandler(QueueHandler):\n" +" def __init__(self, uri, socktype=zmq.PUB, ctx=None):\n" +" self.ctx = ctx or zmq.Context()\n" +" socket = zmq.Socket(self.ctx, socktype)\n" +" socket.bind(uri)\n" +" super().__init__(socket)\n" +"\n" +" def enqueue(self, record):\n" +" self.queue.send_json(record.__dict__)\n" +"\n" +" def close(self):\n" +" self.queue.close()" -#: ../../howto/logging-cookbook.rst:1915 ../../howto/logging-cookbook.rst:1945 msgid "Subclass ``QueueListener``" -msgstr "" +msgstr "``QueueListener`` のサブクラス化" #: ../../howto/logging-cookbook.rst:1917 msgid "" @@ -2895,11 +3806,9 @@ msgid "" " return logging.makeLogRecord(msg)" msgstr "" -#: ../../howto/logging-cookbook.rst:1935 msgid "Subclassing QueueHandler and QueueListener- a ``pynng`` example" -msgstr "" +msgstr "QueueHandler と QueueListener のサブクラス化: ``pynng`` の例" -#: ../../howto/logging-cookbook.rst:1937 msgid "" "In a similar way to the above section, we can implement a listener and " "handler using :pypi:`pynng`, which is a Python binding to `NNG `_ の Python バインディングです。\n" +"以下のコードは ``pynng`` をインストールした環境で試せます。\n" +"今回は順序を変えて、リスナーから示します。" #: ../../howto/logging-cookbook.rst:1947 msgid "" @@ -2970,7 +3885,6 @@ msgid "" " listener.stop()" msgstr "" -#: ../../howto/logging-cookbook.rst:2013 msgid "" "# sender.py\n" "import json\n" @@ -3018,15 +3932,62 @@ msgid "" " delay = random.random() * 2 + 0.5\n" " time.sleep(delay)" msgstr "" +"# sender.py\n" +"import json\n" +"import logging\n" +"import logging.handlers\n" +"import time\n" +"import random\n" +"\n" +"import pynng\n" +"\n" +"DEFAULT_ADDR = \"tcp://localhost:13232\"\n" +"\n" +"class NNGSocketHandler(logging.handlers.QueueHandler):\n" +"\n" +" def __init__(self, uri):\n" +" socket = pynng.Pub0(dial=uri, send_timeout=500)\n" +" super().__init__(socket)\n" +"\n" +" def enqueue(self, record):\n" +" # レコードを UTF-8 でエンコードした JSON として送る\n" +" d = dict(record.__dict__)\n" +" data = json.dumps(d)\n" +" self.queue.send(data.encode('utf-8'))\n" +"\n" +" def close(self):\n" +" self.queue.close()\n" +"\n" +"logging.getLogger('pynng').propagate = False\n" +"handler = NNGSocketHandler(DEFAULT_ADDR)\n" +"# 出力にプロセス ID を含める\n" +"logging.basicConfig(level=logging.DEBUG,\n" +" handlers=[logging.StreamHandler(), handler],\n" +" format='%(levelname)-8s %(name)10s %(process)6s " +"%(message)s')\n" +"levels = (logging.DEBUG, logging.INFO, logging.WARNING, logging.ERROR,\n" +" logging.CRITICAL)\n" +"logger_names = ('myapp', 'myapp.lib1', 'myapp.lib2')\n" +"msgno = 1\n" +"while True:\n" +" # ロガーとレベルをランダムに選んで記録する\n" +" level = random.choice(levels)\n" +" logger = logging.getLogger(random.choice(logger_names))\n" +" logger.log(level, 'Message no. %5d' % msgno)\n" +" msgno += 1\n" +" delay = random.random() * 2 + 0.5\n" +" time.sleep(delay)" -#: ../../howto/logging-cookbook.rst:2060 msgid "" "You can run the above two snippets in separate command shells. If we run the " "listener in one shell and run the sender in two separate shells, we should " "see something like the following. In the first sender shell:" msgstr "" +"上の二つのコードは別々のシェルで実行できます。\n" +"一つのシェルでリスナーを、別の二つのシェルで送信側を実行すると、次のような出" +"力になります。\n" +"一つ目の送信側のシェルでは:" -#: ../../howto/logging-cookbook.rst:2064 msgid "" "$ python sender.py\n" "DEBUG myapp 613 Message no. 1\n" @@ -3039,12 +4000,20 @@ msgid "" "INFO myapp.lib1 613 Message no. 8\n" "(and so on)" msgstr "" +"$ python sender.py\n" +"DEBUG myapp 613 Message no. 1\n" +"WARNING myapp.lib2 613 Message no. 2\n" +"CRITICAL myapp.lib2 613 Message no. 3\n" +"WARNING myapp.lib2 613 Message no. 4\n" +"CRITICAL myapp.lib1 613 Message no. 5\n" +"DEBUG myapp 613 Message no. 6\n" +"CRITICAL myapp.lib1 613 Message no. 7\n" +"INFO myapp.lib1 613 Message no. 8\n" +"(and so on)" -#: ../../howto/logging-cookbook.rst:2077 msgid "In the second sender shell:" -msgstr "" +msgstr "二つ目の送信側のシェルでは:" -#: ../../howto/logging-cookbook.rst:2079 msgid "" "$ python sender.py\n" "INFO myapp.lib2 657 Message no. 1\n" @@ -3057,12 +4026,20 @@ msgid "" "DEBUG myapp.lib1 657 Message no. 8\n" "(and so on)" msgstr "" +"$ python sender.py\n" +"INFO myapp.lib2 657 Message no. 1\n" +"CRITICAL myapp.lib2 657 Message no. 2\n" +"CRITICAL myapp 657 Message no. 3\n" +"CRITICAL myapp.lib1 657 Message no. 4\n" +"INFO myapp.lib1 657 Message no. 5\n" +"WARNING myapp.lib2 657 Message no. 6\n" +"CRITICAL myapp 657 Message no. 7\n" +"DEBUG myapp.lib1 657 Message no. 8\n" +"(and so on)" -#: ../../howto/logging-cookbook.rst:2092 msgid "In the listener shell:" -msgstr "" +msgstr "リスナーのシェルでは:" -#: ../../howto/logging-cookbook.rst:2094 msgid "" "$ python listener.py\n" "Press Ctrl-C to stop.\n" @@ -3084,12 +4061,31 @@ msgid "" "DEBUG myapp.lib1 657 Message no. 8\n" "(and so on)" msgstr "" +"$ python listener.py\n" +"Press Ctrl-C to stop.\n" +"DEBUG myapp 613 Message no. 1\n" +"WARNING myapp.lib2 613 Message no. 2\n" +"INFO myapp.lib2 657 Message no. 1\n" +"CRITICAL myapp.lib2 613 Message no. 3\n" +"CRITICAL myapp.lib2 657 Message no. 2\n" +"CRITICAL myapp 657 Message no. 3\n" +"WARNING myapp.lib2 613 Message no. 4\n" +"CRITICAL myapp.lib1 613 Message no. 5\n" +"CRITICAL myapp.lib1 657 Message no. 4\n" +"INFO myapp.lib1 657 Message no. 5\n" +"DEBUG myapp 613 Message no. 6\n" +"WARNING myapp.lib2 657 Message no. 6\n" +"CRITICAL myapp 657 Message no. 7\n" +"CRITICAL myapp.lib1 613 Message no. 7\n" +"INFO myapp.lib1 613 Message no. 8\n" +"DEBUG myapp.lib1 657 Message no. 8\n" +"(and so on)" -#: ../../howto/logging-cookbook.rst:2116 msgid "" "As you can see, the logging from the two sender processes is interleaved in " "the listener's output." msgstr "" +"このように、リスナーの出力には二つの送信プロセスのログが入り交じっています。" #: ../../howto/logging-cookbook.rst:2121 msgid "An example dictionary-based configuration" @@ -3102,13 +4098,62 @@ msgid "" "stable/topics/logging/#configuring-logging>`_. This dictionary is passed to :" "func:`~config.dictConfig` to put the configuration into effect::" msgstr "" -"次の例は辞書を使った logging の構成です。この例は `Django プロジェクトのド" -"キュメント `_ から持ってきました。この辞書を :func:`~config." -"dictConfig` に渡して設定を有効にします::" - -#: ../../howto/logging-cookbook.rst:2127 -msgid "" +"次の例は辞書を使った logging の構成です。この例は `Django プロジェクトのド" +"キュメント `_ から持ってきました。この辞書を :func:`~config." +"dictConfig` に渡して設定を有効にします::" + +msgid "" +"LOGGING = {\n" +" 'version': 1,\n" +" 'disable_existing_loggers': False,\n" +" 'formatters': {\n" +" 'verbose': {\n" +" 'format': '{levelname} {asctime} {module} {process:d} {thread:d} " +"{message}',\n" +" 'style': '{',\n" +" },\n" +" 'simple': {\n" +" 'format': '{levelname} {message}',\n" +" 'style': '{',\n" +" },\n" +" },\n" +" 'filters': {\n" +" 'special': {\n" +" '()': 'project.logging.SpecialFilter',\n" +" 'foo': 'bar',\n" +" },\n" +" },\n" +" 'handlers': {\n" +" 'console': {\n" +" 'level': 'INFO',\n" +" 'class': 'logging.StreamHandler',\n" +" 'formatter': 'simple',\n" +" },\n" +" 'mail_admins': {\n" +" 'level': 'ERROR',\n" +" 'class': 'django.utils.log.AdminEmailHandler',\n" +" 'filters': ['special']\n" +" }\n" +" },\n" +" 'loggers': {\n" +" 'django': {\n" +" 'handlers': ['console'],\n" +" 'propagate': True,\n" +" },\n" +" 'django.request': {\n" +" 'handlers': ['mail_admins'],\n" +" 'level': 'ERROR',\n" +" 'propagate': False,\n" +" },\n" +" 'myproject.custom': {\n" +" 'handlers': ['console', 'mail_admins'],\n" +" 'level': 'INFO',\n" +" 'filters': ['special']\n" +" }\n" +" }\n" +"}" +msgstr "" "LOGGING = {\n" " 'version': 1,\n" " 'disable_existing_loggers': False,\n" @@ -3158,7 +4203,6 @@ msgid "" " }\n" " }\n" "}" -msgstr "" #: ../../howto/logging-cookbook.rst:2176 msgid "" @@ -3182,7 +4226,6 @@ msgstr "" "namer と rotator を定義する方法の例は以下の実行可能なスクリプトに示されていま" "す。ここではログファイルを gzip により圧縮する例を示しています::" -#: ../../howto/logging-cookbook.rst:2188 msgid "" "import gzip\n" "import logging\n" @@ -3213,6 +4256,34 @@ msgid "" "for i in range(1000):\n" " root.info(f'Message no. {i + 1}')" msgstr "" +"import gzip\n" +"import logging\n" +"import logging.handlers\n" +"import os\n" +"import shutil\n" +"\n" +"def namer(name):\n" +" return name + \".gz\"\n" +"\n" +"def rotator(source, dest):\n" +" with open(source, 'rb') as f_in:\n" +" with gzip.open(dest, 'wb') as f_out:\n" +" shutil.copyfileobj(f_in, f_out)\n" +" os.remove(source)\n" +"\n" +"\n" +"rh = logging.handlers.RotatingFileHandler('rotated.log', maxBytes=128, " +"backupCount=5)\n" +"rh.rotator = rotator\n" +"rh.namer = namer\n" +"\n" +"root = logging.getLogger()\n" +"root.setLevel(logging.INFO)\n" +"root.addHandler(rh)\n" +"f = logging.Formatter('%(asctime)s %(message)s')\n" +"rh.setFormatter(f)\n" +"for i in range(1000):\n" +" root.info(f'Message no. {i + 1}')" #: ../../howto/logging-cookbook.rst:2216 msgid "" @@ -3221,7 +4292,6 @@ msgstr "" "このスクリプトを実行すると、6つの新しいファイルが生成され、そのうち5つは圧縮" "されています:" -#: ../../howto/logging-cookbook.rst:2218 msgid "" "$ ls rotated.log*\n" "rotated.log rotated.log.2.gz rotated.log.4.gz\n" @@ -3231,6 +4301,13 @@ msgid "" "2023-01-20 02:28:17,767 Message no. 997\n" "2023-01-20 02:28:17,767 Message no. 998" msgstr "" +"$ ls rotated.log*\n" +"rotated.log rotated.log.2.gz rotated.log.4.gz\n" +"rotated.log.1.gz rotated.log.3.gz rotated.log.5.gz\n" +"$ zcat rotated.log.1.gz\n" +"2023-01-20 02:28:17,767 Message no. 996\n" +"2023-01-20 02:28:17,767 Message no. 997\n" +"2023-01-20 02:28:17,767 Message no. 998" #: ../../howto/logging-cookbook.rst:2229 msgid "A more elaborate multiprocessing example" @@ -3547,9 +4624,8 @@ msgstr "" ":class:`~logging.handlers.SysLogHandler` のインスタンスに、次のような format " "文字列を持った :class:`~logging.Formatter` インスタンスをアタッチする::" -#: ../../howto/logging-cookbook.rst:2482 msgid "'ASCII section\\ufeffUnicode section'" -msgstr "" +msgstr "'ASCII section\\ufeffUnicode section'" #: ../../howto/logging-cookbook.rst:2484 msgid "" @@ -3616,7 +4692,6 @@ msgstr "" "実現する方法は幾つもありますが、次の例は JSON を使ってイベントを、機械でパー" "スできる形にシリアライズする単純な方法です::" -#: ../../howto/logging-cookbook.rst:2512 msgid "" "import json\n" "import logging\n" @@ -3634,16 +4709,32 @@ msgid "" "logging.basicConfig(level=logging.INFO, format='%(message)s')\n" "logging.info(_('message 1', foo='bar', bar='baz', num=123, fnum=123.456))" msgstr "" +"import json\n" +"import logging\n" +"\n" +"class StructuredMessage:\n" +" def __init__(self, message, /, **kwargs):\n" +" self.message = message\n" +" self.kwargs = kwargs\n" +"\n" +" def __str__(self):\n" +" return '%s >>> %s' % (self.message, json.dumps(self.kwargs))\n" +"\n" +"_ = StructuredMessage # optional, to improve readability\n" +"\n" +"logging.basicConfig(level=logging.INFO, format='%(message)s')\n" +"logging.info(_('message 1', foo='bar', bar='baz', num=123, fnum=123.456))" #: ../../howto/logging-cookbook.rst:2528 msgid "If the above script is run, it prints:" msgstr "上のスクリプトを実行すると次のように出力されます:" -#: ../../howto/logging-cookbook.rst:2530 msgid "" "message 1 >>> {\"fnum\": 123.456, \"num\": 123, \"bar\": \"baz\", \"foo\": " "\"bar\"}" msgstr "" +"message 1 >>> {\"fnum\": 123.456, \"num\": 123, \"bar\": \"baz\", \"foo\": " +"\"bar\"}" #: ../../howto/logging-cookbook.rst:2534 ../../howto/logging-cookbook.rst:2576 msgid "" @@ -3659,7 +4750,6 @@ msgstr "" "より特殊な処理が必要な場合、次の例のように、カスタムの JSON エンコーダを作る" "ことができます::" -#: ../../howto/logging-cookbook.rst:2540 msgid "" "import json\n" "import logging\n" @@ -3691,20 +4781,47 @@ msgid "" "if __name__ == '__main__':\n" " main()" msgstr "" +"import json\n" +"import logging\n" +"\n" +"\n" +"class Encoder(json.JSONEncoder):\n" +" def default(self, o):\n" +" if isinstance(o, set):\n" +" return tuple(o)\n" +" elif isinstance(o, str):\n" +" return o.encode('unicode_escape').decode('ascii')\n" +" return super().default(o)\n" +"\n" +"class StructuredMessage:\n" +" def __init__(self, message, /, **kwargs):\n" +" self.message = message\n" +" self.kwargs = kwargs\n" +"\n" +" def __str__(self):\n" +" s = Encoder().encode(self.kwargs)\n" +" return '%s >>> %s' % (self.message, s)\n" +"\n" +"_ = StructuredMessage # optional, to improve readability\n" +"\n" +"def main():\n" +" logging.basicConfig(level=logging.INFO, format='%(message)s')\n" +" logging.info(_('message 1', set_value={1, 2, 3}, snowman='\\u2603'))\n" +"\n" +"if __name__ == '__main__':\n" +" main()" #: ../../howto/logging-cookbook.rst:2570 msgid "When the above script is run, it prints:" msgstr "上のスクリプトを実行すると次のように出力されます:" -#: ../../howto/logging-cookbook.rst:2572 msgid "message 1 >>> {\"snowman\": \"\\u2603\", \"set_value\": [1, 2, 3]}" -msgstr "" +msgstr "message 1 >>> {\"snowman\": \"\\u2603\", \"set_value\": [1, 2, 3]}" #: ../../howto/logging-cookbook.rst:2585 msgid "Customizing handlers with :func:`dictConfig`" msgstr "handler を :func:`dictConfig` を使ってカスタマイズする" -#: ../../howto/logging-cookbook.rst:2587 msgid "" "There are times when you want to customize logging handlers in particular " "ways, and if you use :func:`dictConfig` you may be able to do this without " @@ -3713,14 +4830,13 @@ msgid "" "the file handlers in the stdlib don't offer built-in support. You can " "customize handler creation using a plain function such as::" msgstr "" -"logging handler に特定のカスタマイズを何度もしたい場合で、 :func:" -"`dictConfig` を使っているなら、サブクラスを作らなくてもカスタマイズが可能で" -"す。例えば、ログファイルの owner を設定したいとします。これは POSIX 環境で" -"は :func:`shutil.chown` を使って簡単に実現できますが、標準ライブラリの file " -"handler はこの機能を組み込みでサポートしていません。 handler の生成を通常の関" -"数を使ってカスタマイズすることができます::" +"ロギングハンドラを特定の方法でカスタマイズしたい場合、:func:`dictConfig` を使" +"えばサブクラスを作らずに実現できることがあります。\n" +"例えば、ログファイルの所有者を設定したいとします。\n" +"POSIX では :func:`shutil.chown` で簡単に設定できますが、標準ライブラリのファ" +"イルハンドラにはその機能が組み込まれていません。\n" +"次のような通常の関数で、ハンドラの作成をカスタマイズできます。 ::" -#: ../../howto/logging-cookbook.rst:2594 msgid "" "def owned_file_handler(filename, mode='a', encoding=None, owner=None):\n" " if owner:\n" @@ -3729,6 +4845,12 @@ msgid "" " shutil.chown(filename, *owner)\n" " return logging.FileHandler(filename, mode, encoding)" msgstr "" +"def owned_file_handler(filename, mode='a', encoding=None, owner=None):\n" +" if owner:\n" +" if not os.path.exists(filename):\n" +" open(filename, 'a').close()\n" +" shutil.chown(filename, *owner)\n" +" return logging.FileHandler(filename, mode, encoding)" #: ../../howto/logging-cookbook.rst:2601 msgid "" @@ -3738,7 +4860,6 @@ msgstr "" "そして、 :func:`dictConfig` に渡される構成設定の中で、この関数を使って " "logging handler を生成するように指定することができます::" -#: ../../howto/logging-cookbook.rst:2604 msgid "" "LOGGING = {\n" " 'version': 1,\n" @@ -3770,6 +4891,35 @@ msgid "" " },\n" "}" msgstr "" +"LOGGING = {\n" +" 'version': 1,\n" +" 'disable_existing_loggers': False,\n" +" 'formatters': {\n" +" 'default': {\n" +" 'format': '%(asctime)s %(levelname)s %(name)s %(message)s'\n" +" },\n" +" },\n" +" 'handlers': {\n" +" 'file':{\n" +" # 以下の値はこの辞書から取り出して削除し、\n" +" # ハンドラーの作成、レベルの設定、\n" +" # フォーマッターの設定に使う。\n" +" '()': owned_file_handler,\n" +" 'level':'DEBUG',\n" +" 'formatter': 'default',\n" +" # 以下の値は、ハンドラーを作成する呼び出し可能オブジェクトに\n" +" # キーワード引数として渡す。\n" +" 'owner': ['pulse', 'pulse'],\n" +" 'filename': 'chowntest.log',\n" +" 'mode': 'w',\n" +" 'encoding': 'utf-8',\n" +" },\n" +" },\n" +" 'root': {\n" +" 'handlers': ['file'],\n" +" 'level': 'DEBUG',\n" +" },\n" +"}" #: ../../howto/logging-cookbook.rst:2634 msgid "" @@ -3780,7 +4930,6 @@ msgstr "" "この例は説明用のものですが、owner の user と group を ``pulse`` に設定してい" "ます。これを動くスクリプトに ``chowntest.py`` に組み込んでみます::" -#: ../../howto/logging-cookbook.rst:2638 msgid "" "import logging, logging.config, os, shutil\n" "\n" @@ -3825,12 +4974,53 @@ msgid "" "logger = logging.getLogger('mylogger')\n" "logger.debug('A debug message')" msgstr "" +"import logging, logging.config, os, shutil\n" +"\n" +"def owned_file_handler(filename, mode='a', encoding=None, owner=None):\n" +" if owner:\n" +" if not os.path.exists(filename):\n" +" open(filename, 'a').close()\n" +" shutil.chown(filename, *owner)\n" +" return logging.FileHandler(filename, mode, encoding)\n" +"\n" +"LOGGING = {\n" +" 'version': 1,\n" +" 'disable_existing_loggers': False,\n" +" 'formatters': {\n" +" 'default': {\n" +" 'format': '%(asctime)s %(levelname)s %(name)s %(message)s'\n" +" },\n" +" },\n" +" 'handlers': {\n" +" 'file':{\n" +" # 以下の値はこの辞書から取り出して削除し、\n" +" # ハンドラーの作成、レベルの設定、\n" +" # フォーマッターの設定に使う。\n" +" '()': owned_file_handler,\n" +" 'level':'DEBUG',\n" +" 'formatter': 'default',\n" +" # 以下の値は、ハンドラーを作成する呼び出し可能オブジェクトに\n" +" # キーワード引数として渡す。\n" +" 'owner': ['pulse', 'pulse'],\n" +" 'filename': 'chowntest.log',\n" +" 'mode': 'w',\n" +" 'encoding': 'utf-8',\n" +" },\n" +" },\n" +" 'root': {\n" +" 'handlers': ['file'],\n" +" 'level': 'DEBUG',\n" +" },\n" +"}\n" +"\n" +"logging.config.dictConfig(LOGGING)\n" +"logger = logging.getLogger('mylogger')\n" +"logger.debug('A debug message')" #: ../../howto/logging-cookbook.rst:2681 msgid "To run this, you will probably need to run as ``root``:" msgstr "これを実行するには、 ``root`` 権限で実行する必要があるかもしれません:" -#: ../../howto/logging-cookbook.rst:2683 msgid "" "$ sudo python3.3 chowntest.py\n" "$ cat chowntest.log\n" @@ -3838,8 +5028,12 @@ msgid "" "$ ls -l chowntest.log\n" "-rw-r--r-- 1 pulse pulse 55 2013-11-05 09:34 chowntest.log" msgstr "" +"$ sudo python3.3 chowntest.py\n" +"$ cat chowntest.log\n" +"2013-11-05 09:34:51,128 DEBUG mylogger A debug message\n" +"$ ls -l chowntest.log\n" +"-rw-r--r-- 1 pulse pulse 55 2013-11-05 09:34 chowntest.log" -#: ../../howto/logging-cookbook.rst:2691 msgid "" "Note that this example uses Python 3.3 because that's where :func:`shutil." "chown` makes an appearance. This approach should work with any Python " @@ -3847,11 +5041,12 @@ msgid "" "With pre-3.3 versions, you would need to implement the actual ownership " "change using e.g. :func:`os.chown`." msgstr "" -":func:`shutil.chown` が追加されたのが Python 3.3 からなので、この例は Python " -"3.3 を使っています。このアプローチ自体は :func:`dictConfig` をサポートした全" -"ての Python バージョン - Python 2.7, 3.2 以降 - で利用できます。 3.3 以前の" -"バージョンでは、オーナーを変更するのに :func:`os.chown` を利用する必要がある" -"でしょう。" +"この例で Python 3.3 を使っているのは、:func:`shutil.chown` が追加されたバー" +"ジョンだからです。\n" +"この方法は :func:`dictConfig` をサポートする Python 2.7、3.2 以降で使えま" +"す。\n" +"3.3 より前では、例えば :func:`os.chown` を使って所有者の変更処理を実装する必" +"要があります。" #: ../../howto/logging-cookbook.rst:2697 msgid "" @@ -3861,17 +5056,15 @@ msgstr "" "実際には、handler を生成する関数はプロジェクト内のどこかにあるユーティリティ" "モジュールに置くことになるでしょう。設定の中で直接関数を参照する代わりに::" -#: ../../howto/logging-cookbook.rst:2700 msgid "'()': owned_file_handler," -msgstr "" +msgstr "'()': owned_file_handler," #: ../../howto/logging-cookbook.rst:2702 msgid "you could use e.g.::" msgstr "次のように書くこともできます::" -#: ../../howto/logging-cookbook.rst:2704 msgid "'()': 'ext://project.util.owned_file_handler'," -msgstr "" +msgstr "'()': 'ext://project.util.owned_file_handler'," #: ../../howto/logging-cookbook.rst:2706 msgid "" @@ -4054,7 +5247,6 @@ msgstr "" "このアプローチによる例をお見せします。最初は :meth:`str.format` を使って" "フォーマットする例です::" -#: ../../howto/logging-cookbook.rst:2813 msgid "" ">>> __ = BraceMessage\n" ">>> print(__('Message with {0} {1}', 2, 'placeholders'))\n" @@ -4068,18 +5260,32 @@ msgid "" "point=p))\n" "Message with coordinates: (0.50, 0.50)" msgstr "" +">>> __ = BraceMessage\n" +">>> print(__('Message with {0} {1}', 2, 'placeholders'))\n" +"Message with 2 placeholders\n" +">>> class Point: pass\n" +"...\n" +">>> p = Point()\n" +">>> p.x = 0.5\n" +">>> p.y = 0.5\n" +">>> print(__('Message with coordinates: ({point.x:.2f}, {point.y:.2f})', " +"point=p))\n" +"Message with coordinates: (0.50, 0.50)" #: ../../howto/logging-cookbook.rst:2824 msgid "Secondly, formatting with :class:`string.Template`::" msgstr "2つめは :class:`string.Template` でフォーマットする例です::" -#: ../../howto/logging-cookbook.rst:2826 msgid "" ">>> __ = DollarMessage\n" ">>> print(__('Message with $num $what', num=2, what='placeholders'))\n" "Message with 2 placeholders\n" ">>>" msgstr "" +">>> __ = DollarMessage\n" +">>> print(__('Message with $num $what', num=2, what='placeholders'))\n" +"Message with 2 placeholders\n" +">>>" #: ../../howto/logging-cookbook.rst:2831 msgid "" @@ -4104,7 +5310,6 @@ msgstr "" msgid "Configuring filters with :func:`dictConfig`" msgstr "filter を :func:`dictConfig` を使ってカスタマイズする" -#: ../../howto/logging-cookbook.rst:2847 msgid "" "You *can* configure filters using :func:`~logging.config.dictConfig`, though " "it might not be obvious at first glance how to do it (hence this recipe). " @@ -4118,18 +5323,19 @@ msgid "" "callable which returns a :class:`~logging.Filter` instance). Here is a " "complete example::" msgstr "" -":func:`~logging.config.dictConfig` によってフィルタを設定 *出来ます* が、どう" -"やってそれを行うのかが初見では明快とは言えないでしょう(そのためのこのレシピで" -"す)。 :class:`~logging.Filter` のみが唯一標準ライブラリに含まれているだけです" -"し、それは何の要求にも応えてはくれません(ただの基底クラスですから)ので、典型" -"的には :meth:`~logging.Filter.filter` メソッドをオーバライドした :class:" -"`~logging.Filter` のサブクラスをあなた自身で定義する必要があります。これをす" -"るには、設定辞書内のフィルタ指定部分に、 ``()`` キーでそのフィルタを作るのに" -"使われる callable を指定してください(クラスを指定するのが最もわかりやすいです" -"が、 :class:`~logging.Filter` インスタンスを返却する callable を提供すること" -"でも出来ます)。以下に完全な例を示します::" +":func:`~logging.config.dictConfig` でフィルタを設定 *できます*。\n" +"ただし、一見しただけでは方法が分かりにくいため、このレシピで説明します。\n" +"標準ライブラリに含まれるフィルタクラスは :class:`~logging.Filter` だけで、基" +"底クラスとして用意されているため、多くの要件にはそのまま対応できないでしょ" +"う。\n" +"通常は :class:`~logging.Filter` のサブクラスを定義し、:meth:`~logging.Filter." +"filter` をオーバーライドします。\n" +"設定辞書のフィルタの項目では ``()`` キーに、フィルタを作成する呼び出し可能オ" +"ブジェクトを指定します。\n" +"クラスを指定するのが分かりやすい方法ですが、:class:`~logging.Filter` インスタ" +"ンスを返すものであれば指定できます。\n" +"完全な例を示します。 ::" -#: ../../howto/logging-cookbook.rst:2858 msgid "" "import logging\n" "import logging.config\n" @@ -4173,20 +5379,59 @@ msgid "" " logging.debug('hello')\n" " logging.debug('hello - noshow')" msgstr "" +"import logging\n" +"import logging.config\n" +"import sys\n" +"\n" +"class MyFilter(logging.Filter):\n" +" def __init__(self, param=None):\n" +" self.param = param\n" +"\n" +" def filter(self, record):\n" +" if self.param is None:\n" +" allow = True\n" +" else:\n" +" allow = self.param not in record.msg\n" +" if allow:\n" +" record.msg = 'changed: ' + record.msg\n" +" return allow\n" +"\n" +"LOGGING = {\n" +" 'version': 1,\n" +" 'filters': {\n" +" 'myfilter': {\n" +" '()': MyFilter,\n" +" 'param': 'noshow',\n" +" }\n" +" },\n" +" 'handlers': {\n" +" 'console': {\n" +" 'class': 'logging.StreamHandler',\n" +" 'filters': ['myfilter']\n" +" }\n" +" },\n" +" 'root': {\n" +" 'level': 'DEBUG',\n" +" 'handlers': ['console']\n" +" },\n" +"}\n" +"\n" +"if __name__ == '__main__':\n" +" logging.config.dictConfig(LOGGING)\n" +" logging.debug('hello')\n" +" logging.debug('hello - noshow')" -#: ../../howto/logging-cookbook.rst:2900 msgid "" "This example shows how you can pass configuration data to the callable which " "constructs the instance, in the form of keyword parameters. When run, the " "above script will print:" msgstr "" -"どのようにして設定データとして、そのインスタンスを構築する callable をキー" -"ワードパラメータの形で渡すのか、をこの例は教えてくれます。上記スクリプトは実" -"行すると、このような出力をします:" +"この例は、インスタンスを構築する呼び出し可能オブジェクトに、設定データをキー" +"ワード引数として渡す方法を示しています。\n" +"上のスクリプトを実行すると、次のように表示されます:" -#: ../../howto/logging-cookbook.rst:2904 msgid "changed: hello" -msgstr "" +msgstr "changed: hello" #: ../../howto/logging-cookbook.rst:2908 msgid "which shows that the filter is working as configured." @@ -4236,12 +5481,47 @@ msgid "" "even when exception information is present. You can do this with a custom " "formatter class, as shown in the following example::" msgstr "" -"例外の書式化をカスタマイズしたいことがあるでしょう - わかりやすさのために、例" -"外情報がある場合でもログイベントごとに一行に収まることを死守したいと望むとし" -"ましょう。フォーマッタのクラスをカスタマイズして、このように出来ます::" - -#: ../../howto/logging-cookbook.rst:2935 -msgid "" +"例外の書式化をカスタマイズしたいことがあるでしょう - わかりやすさのために、例" +"外情報がある場合でもログイベントごとに一行に収まることを死守したいと望むとし" +"ましょう。フォーマッタのクラスをカスタマイズして、このように出来ます::" + +msgid "" +"import logging\n" +"\n" +"class OneLineExceptionFormatter(logging.Formatter):\n" +" def formatException(self, exc_info):\n" +" \"\"\"\n" +" Format an exception so that it prints on a single line.\n" +" \"\"\"\n" +" result = super().formatException(exc_info)\n" +" return repr(result) # or format into one line however you want to\n" +"\n" +" def format(self, record):\n" +" s = super().format(record)\n" +" if record.exc_text:\n" +" s = s.replace('\\n', '') + '|'\n" +" return s\n" +"\n" +"def configure_logging():\n" +" fh = logging.FileHandler('output.txt', 'w')\n" +" f = OneLineExceptionFormatter('%(asctime)s|%(levelname)s|%(message)s|',\n" +" '%d/%m/%Y %H:%M:%S')\n" +" fh.setFormatter(f)\n" +" root = logging.getLogger()\n" +" root.setLevel(logging.DEBUG)\n" +" root.addHandler(fh)\n" +"\n" +"def main():\n" +" configure_logging()\n" +" logging.info('Sample message')\n" +" try:\n" +" x = 1 / 0\n" +" except ZeroDivisionError as e:\n" +" logging.exception('ZeroDivisionError: %s', e)\n" +"\n" +"if __name__ == '__main__':\n" +" main()" +msgstr "" "import logging\n" "\n" "class OneLineExceptionFormatter(logging.Formatter):\n" @@ -4277,19 +5557,21 @@ msgid "" "\n" "if __name__ == '__main__':\n" " main()" -msgstr "" #: ../../howto/logging-cookbook.rst:2971 msgid "When run, this produces a file with exactly two lines:" msgstr "実行してみましょう。このように正確に2行の出力を生成します:" -#: ../../howto/logging-cookbook.rst:2973 msgid "" "28/01/2015 07:21:23|INFO|Sample message|\n" "28/01/2015 07:21:23|ERROR|ZeroDivisionError: division by zero|'Traceback " "(most recent call last):\\n File \"logtest7.py\", line 30, in main\\n x " "= 1 / 0\\nZeroDivisionError: division by zero'|" msgstr "" +"28/01/2015 07:21:23|INFO|Sample message|\n" +"28/01/2015 07:21:23|ERROR|ZeroDivisionError: division by zero|'Traceback " +"(most recent call last):\\n File \"logtest7.py\", line 30, in main\\n x " +"= 1 / 0\\nZeroDivisionError: division by zero'|" #: ../../howto/logging-cookbook.rst:2978 msgid "" @@ -4305,7 +5587,6 @@ msgstr "" msgid "Speaking logging messages" msgstr "ロギングメッセージを喋る" -#: ../../howto/logging-cookbook.rst:2987 msgid "" "There might be situations when it is desirable to have logging messages " "rendered in an audible rather than a visible format. This is easy to do if " @@ -4321,20 +5602,19 @@ msgid "" "other handlers to be kept waiting. Here is a short example showing the " "approach, which assumes that the ``espeak`` TTS package is available::" msgstr "" -"ロギングメッセージを目で見る形式ではなく音で聴く形式として出力したい、という" -"状況があるかもしれません。これはあなたのシステムで text- to-speech (TTS) 機能" -"が利用可能であれば、容易です。それが Python バインディングを持っていなくと" -"も、です。ほとんどの TTS システムはあなたが実行出来るコマンドラインプログラム" -"を持っていて、このことで、 :mod:`subprocess` を使うことでハンドラが呼び出せま" -"す。ここでは、TTS コマンドラインプログラムはユーザとの対話を期待せず、完了に" -"は時間がかかり、そしてログメッセージの頻度はユーザをメッセージで圧倒してしま" -"うほどには高くはなく、そして並列で喋るよりはメッセージ一つにつき一回喋ること" -"が受け容れられる、としておきます。ここでお見せする実装例では、次が処理される" -"前に一つのメッセージを喋り終わるまで待ち、結果としてほかのハンドラを待たせる" -"ことになります。 ``espeak`` TTS パッケージが手許にあるとして、このアプローチ" -"による短い例はこのようなものです::" - -#: ../../howto/logging-cookbook.rst:3000 +"ログメッセージを画面ではなく音声で出力したい場合もあります。\n" +"システムで音声合成 (TTS) が使えれば、Python バインディングがなくても簡単に実" +"現できます。\n" +"多くの TTS システムにはコマンドラインプログラムがあり、ハンドラから :mod:" +"`subprocess` で呼び出せます。\n" +"ここでは、TTS プログラムがユーザーとの対話を必要とせず、完了に長い時間がかか" +"らないことを前提とします。\n" +"また、ログの頻度がユーザーを圧倒するほど高くなく、メッセージを同時にではなく" +"一つずつ読み上げてもよいものとします。\n" +"次の実装例は、一つのメッセージを読み上げ終わるまで次を処理しないため、他のハ" +"ンドラを待たせる可能性があります。\n" +"``espeak`` TTS パッケージが利用できる場合の短い例を示します。 ::" + msgid "" "import logging\n" "import subprocess\n" @@ -4365,6 +5645,34 @@ msgid "" " configure_logging()\n" " sys.exit(main())" msgstr "" +"import logging\n" +"import subprocess\n" +"import sys\n" +"\n" +"class TTSHandler(logging.Handler):\n" +" def emit(self, record):\n" +" msg = self.format(record)\n" +" # 英語の女性の声でゆっくり話す\n" +" cmd = ['espeak', '-s150', '-ven+f3', msg]\n" +" p = subprocess.Popen(cmd, stdout=subprocess.PIPE,\n" +" stderr=subprocess.STDOUT)\n" +" # プログラムの終了を待つ\n" +" p.communicate()\n" +"\n" +"def configure_logging():\n" +" h = TTSHandler()\n" +" root = logging.getLogger()\n" +" root.addHandler(h)\n" +" # デフォルトのフォーマッターはメッセージをそのまま返す\n" +" root.setLevel(logging.DEBUG)\n" +"\n" +"def main():\n" +" logging.info('Hello')\n" +" logging.debug('Goodbye')\n" +"\n" +"if __name__ == '__main__':\n" +" configure_logging()\n" +" sys.exit(main())" #: ../../howto/logging-cookbook.rst:3029 msgid "" @@ -4386,7 +5694,6 @@ msgstr "" msgid "Buffering logging messages and outputting them conditionally" msgstr "ロギングメッセージをバッファリングし、条件に従って出力する" -#: ../../howto/logging-cookbook.rst:3041 msgid "" "There might be situations where you want to log messages in a temporary area " "and only output them if a certain condition occurs. For example, you may " @@ -4395,11 +5702,12 @@ msgid "" "collected debug information, but if there is an error, you want all the " "debug information to be output as well as the error." msgstr "" -"メッセージを一次領域に記録し、ある種の特定の状況になった場合にだけ出力した" -"い、ということがあるかもしれません。たとえばある関数内でのデバッグのためのロ" -"グ出力をしたくても、エラーなしで終了する限りにおいては収集されたデバッグ情報" -"による混雑は喰らいたくはなく、エラーがあった場合にだけエラー出力とともにデ" -"バッグ情報を見たいのだ、のようなことがあるでしょう。" +"ログメッセージを一時的な領域に記録し、特定の条件が成立した場合にだけ出力した" +"いことがあります。\n" +"例えば、関数内でデバッグイベントの記録を開始し、エラーなく終了した場合は、収" +"集した情報でログを埋めたくないとします。\n" +"一方、エラーが起きた場合は、エラーとともにデバッグ情報をすべて出力したいとし" +"ます。" #: ../../howto/logging-cookbook.rst:3048 msgid "" @@ -4422,7 +5730,6 @@ msgstr "" "ラッシュされます。何か特別なフラッシュの振る舞いをしたければ、このレシピはさ" "らに特殊化した ``MemoryHandler`` とともに利用出来ます。" -#: ../../howto/logging-cookbook.rst:3058 msgid "" "The example script has a simple function, ``foo``, which just cycles through " "all the logging levels, writing to ``sys.stderr`` to say what level it's " @@ -4430,10 +5737,11 @@ msgid "" "pass a parameter to ``foo`` which, if true, will log at ERROR and CRITICAL " "levels - otherwise, it only logs at DEBUG, INFO and WARNING levels." msgstr "" -"スクリプト例では、 ``foo`` という、単に全てのログレベルについて、 ``sys." -"stderr`` にもどのレベルを出力したのかについて書き出しながら実際のログ出力も行" -"う、という単純な関数を使っています。 ``foo`` に真を与えると ERROR と " -"CRITICAL の出力をし、そうでなければ DEBUG, INFO, WARNING だけを出力します。" +"スクリプトの例には、ログレベルを順にたどる単純な関数 ``foo`` があります。\n" +"これから記録するレベルを ``sys.stderr`` に表示してから、そのレベルで実際にロ" +"グを記録します。\n" +"``foo`` の引数に真を渡すと ERROR と CRITICAL のレベルでも記録し、それ以外で" +"は DEBUG、INFO、WARNING だけを記録します。" #: ../../howto/logging-cookbook.rst:3064 msgid "" @@ -4458,7 +5766,6 @@ msgstr "" msgid "Here's the script::" msgstr "スクリプトはこれです::" -#: ../../howto/logging-cookbook.rst:3074 msgid "" "import logging\n" "from logging.handlers import MemoryHandler\n" @@ -4523,12 +5830,73 @@ msgid "" " write_line('Calling decorated foo with True')\n" " assert decorated_foo(True)" msgstr "" +"import logging\n" +"from logging.handlers import MemoryHandler\n" +"import sys\n" +"\n" +"logger = logging.getLogger(__name__)\n" +"logger.addHandler(logging.NullHandler())\n" +"\n" +"def log_if_errors(logger, target_handler=None, flush_level=None, " +"capacity=None):\n" +" if target_handler is None:\n" +" target_handler = logging.StreamHandler()\n" +" if flush_level is None:\n" +" flush_level = logging.ERROR\n" +" if capacity is None:\n" +" capacity = 100\n" +" handler = MemoryHandler(capacity, flushLevel=flush_level, " +"target=target_handler)\n" +"\n" +" def decorator(fn):\n" +" def wrapper(*args, **kwargs):\n" +" logger.addHandler(handler)\n" +" try:\n" +" return fn(*args, **kwargs)\n" +" except Exception:\n" +" logger.exception('call failed')\n" +" raise\n" +" finally:\n" +" super(MemoryHandler, handler).flush()\n" +" logger.removeHandler(handler)\n" +" return wrapper\n" +"\n" +" return decorator\n" +"\n" +"def write_line(s):\n" +" sys.stderr.write('%s\\n' % s)\n" +"\n" +"def foo(fail=False):\n" +" write_line('about to log at DEBUG ...')\n" +" logger.debug('Actually logged at DEBUG')\n" +" write_line('about to log at INFO ...')\n" +" logger.info('Actually logged at INFO')\n" +" write_line('about to log at WARNING ...')\n" +" logger.warning('Actually logged at WARNING')\n" +" if fail:\n" +" write_line('about to log at ERROR ...')\n" +" logger.error('Actually logged at ERROR')\n" +" write_line('about to log at CRITICAL ...')\n" +" logger.critical('Actually logged at CRITICAL')\n" +" return fail\n" +"\n" +"decorated_foo = log_if_errors(logger)(foo)\n" +"\n" +"if __name__ == '__main__':\n" +" logger.setLevel(logging.DEBUG)\n" +" write_line('Calling undecorated foo with False')\n" +" assert not foo(False)\n" +" write_line('Calling undecorated foo with True')\n" +" assert foo(True)\n" +" write_line('Calling decorated foo with False')\n" +" assert not decorated_foo(False)\n" +" write_line('Calling decorated foo with True')\n" +" assert decorated_foo(True)" #: ../../howto/logging-cookbook.rst:3135 msgid "When this script is run, the following output should be observed:" msgstr "実行すればこのような出力になるはずです:" -#: ../../howto/logging-cookbook.rst:3137 msgid "" "Calling undecorated foo with False\n" "about to log at DEBUG ...\n" @@ -4556,6 +5924,31 @@ msgid "" "about to log at CRITICAL ...\n" "Actually logged at CRITICAL" msgstr "" +"Calling undecorated foo with False\n" +"about to log at DEBUG ...\n" +"about to log at INFO ...\n" +"about to log at WARNING ...\n" +"Calling undecorated foo with True\n" +"about to log at DEBUG ...\n" +"about to log at INFO ...\n" +"about to log at WARNING ...\n" +"about to log at ERROR ...\n" +"about to log at CRITICAL ...\n" +"Calling decorated foo with False\n" +"about to log at DEBUG ...\n" +"about to log at INFO ...\n" +"about to log at WARNING ...\n" +"Calling decorated foo with True\n" +"about to log at DEBUG ...\n" +"about to log at INFO ...\n" +"about to log at WARNING ...\n" +"about to log at ERROR ...\n" +"Actually logged at DEBUG\n" +"Actually logged at INFO\n" +"Actually logged at WARNING\n" +"Actually logged at ERROR\n" +"about to log at CRITICAL ...\n" +"Actually logged at CRITICAL" #: ../../howto/logging-cookbook.rst:3165 msgid "" @@ -4571,12 +5964,14 @@ msgstr "" msgid "You can of course use the conventional means of decoration::" msgstr "当然のことですが、デコレーションはいつものやり方でどうぞ::" -#: ../../howto/logging-cookbook.rst:3171 msgid "" "@log_if_errors(logger)\n" "def foo(fail=False):\n" " ..." msgstr "" +"@log_if_errors(logger)\n" +"def foo(fail=False):\n" +" ..." #: ../../howto/logging-cookbook.rst:3179 msgid "Sending logging messages to email, with buffering" @@ -4600,7 +5995,6 @@ msgstr "" "見るためには、ダウンロードしたスクリプトを ``-h`` 引数をつけて実行してくださ" "い)。" -#: ../../howto/logging-cookbook.rst:3189 msgid "" "import logging\n" "import logging.handlers\n" @@ -4667,6 +6061,70 @@ msgid "" " h.flush()\n" " h.close()" msgstr "" +"import logging\n" +"import logging.handlers\n" +"import smtplib\n" +"\n" +"class BufferingSMTPHandler(logging.handlers.BufferingHandler):\n" +" def __init__(self, mailhost, port, username, password, fromaddr, " +"toaddrs,\n" +" subject, capacity):\n" +" logging.handlers.BufferingHandler.__init__(self, capacity)\n" +" self.mailhost = mailhost\n" +" self.mailport = port\n" +" self.username = username\n" +" self.password = password\n" +" self.fromaddr = fromaddr\n" +" if isinstance(toaddrs, str):\n" +" toaddrs = [toaddrs]\n" +" self.toaddrs = toaddrs\n" +" self.subject = subject\n" +" self.setFormatter(logging.Formatter(\"%(asctime)s %(levelname)-5s " +"%(message)s\"))\n" +"\n" +" def flush(self):\n" +" if len(self.buffer) > 0:\n" +" try:\n" +" smtp = smtplib.SMTP(self.mailhost, self.mailport)\n" +" smtp.starttls()\n" +" smtp.login(self.username, self.password)\n" +" msg = \"From: %s\\r\\nTo: %s\\r\\nSubject: %s\\r\\n\\r\\n\" " +"% (self.fromaddr, ','.join(self.toaddrs), self.subject)\n" +" for record in self.buffer:\n" +" s = self.format(record)\n" +" msg = msg + s + \"\\r\\n\"\n" +" smtp.sendmail(self.fromaddr, self.toaddrs, msg)\n" +" smtp.quit()\n" +" except Exception:\n" +" if logging.raiseExceptions:\n" +" raise\n" +" self.buffer = []\n" +"\n" +"if __name__ == '__main__':\n" +" import argparse\n" +"\n" +" ap = argparse.ArgumentParser()\n" +" aa = ap.add_argument\n" +" aa('host', metavar='HOST', help='SMTP server')\n" +" aa('--port', '-p', type=int, default=587, help='SMTP port')\n" +" aa('user', metavar='USER', help='SMTP username')\n" +" aa('password', metavar='PASSWORD', help='SMTP password')\n" +" aa('to', metavar='TO', help='Addressee for emails')\n" +" aa('sender', metavar='SENDER', help='Sender email address')\n" +" aa('--subject', '-s',\n" +" default='Test Logging email from Python logging module (buffering)',\n" +" help='Subject of email')\n" +" options = ap.parse_args()\n" +" logger = logging.getLogger()\n" +" logger.setLevel(logging.DEBUG)\n" +" h = BufferingSMTPHandler(options.host, options.port, options.user,\n" +" options.password, options.sender,\n" +" options.to, options.subject, 10)\n" +" logger.addHandler(h)\n" +" for i in range(102):\n" +" logger.info(\"Info index = %d\", i)\n" +" h.flush()\n" +" h.close()" #: ../../howto/logging-cookbook.rst:3253 msgid "" @@ -4694,7 +6152,6 @@ msgstr "" "なフォーマット処理は ``UTCFormatter`` のようなクラスを使って行うことができま" "す::" -#: ../../howto/logging-cookbook.rst:3266 msgid "" "import logging\n" "import time\n" @@ -4702,6 +6159,11 @@ msgid "" "class UTCFormatter(logging.Formatter):\n" " converter = time.gmtime" msgstr "" +"import logging\n" +"import time\n" +"\n" +"class UTCFormatter(logging.Formatter):\n" +" converter = time.gmtime" #: ../../howto/logging-cookbook.rst:3272 msgid "" @@ -4710,12 +6172,49 @@ msgid "" "the :func:`~logging.config.dictConfig` API with an approach illustrated by " "the following complete example::" msgstr "" -"そしてコード中で ``UTCFormatter`` を :class:`~logging.Formatter` の代わりに使" -"えます。これを設定を通して行いたい場合、 :func:`~logging.config.dictConfig` " -"API を以下の完全な例で示すようなアプローチで使うことが出来ます::" - -#: ../../howto/logging-cookbook.rst:3277 -msgid "" +"そしてコード中で ``UTCFormatter`` を :class:`~logging.Formatter` の代わりに使" +"えます。これを設定を通して行いたい場合、 :func:`~logging.config.dictConfig` " +"API を以下の完全な例で示すようなアプローチで使うことが出来ます::" + +msgid "" +"import logging\n" +"import logging.config\n" +"import time\n" +"\n" +"class UTCFormatter(logging.Formatter):\n" +" converter = time.gmtime\n" +"\n" +"LOGGING = {\n" +" 'version': 1,\n" +" 'disable_existing_loggers': False,\n" +" 'formatters': {\n" +" 'utc': {\n" +" '()': UTCFormatter,\n" +" 'format': '%(asctime)s %(message)s',\n" +" },\n" +" 'local': {\n" +" 'format': '%(asctime)s %(message)s',\n" +" }\n" +" },\n" +" 'handlers': {\n" +" 'console1': {\n" +" 'class': 'logging.StreamHandler',\n" +" 'formatter': 'utc',\n" +" },\n" +" 'console2': {\n" +" 'class': 'logging.StreamHandler',\n" +" 'formatter': 'local',\n" +" },\n" +" },\n" +" 'root': {\n" +" 'handlers': ['console1', 'console2'],\n" +" }\n" +"}\n" +"\n" +"if __name__ == '__main__':\n" +" logging.config.dictConfig(LOGGING)\n" +" logging.warning('The local time is %s', time.asctime())" +msgstr "" "import logging\n" "import logging.config\n" "import time\n" @@ -4753,17 +6252,17 @@ msgid "" "if __name__ == '__main__':\n" " logging.config.dictConfig(LOGGING)\n" " logging.warning('The local time is %s', time.asctime())" -msgstr "" #: ../../howto/logging-cookbook.rst:3315 msgid "When this script is run, it should print something like:" msgstr "実行すれば、このような出力になるはずです:" -#: ../../howto/logging-cookbook.rst:3317 msgid "" "2015-10-17 12:53:29,501 The local time is Sat Oct 17 13:53:29 2015\n" "2015-10-17 13:53:29,501 The local time is Sat Oct 17 13:53:29 2015" msgstr "" +"2015-10-17 12:53:29,501 The local time is Sat Oct 17 13:53:29 2015\n" +"2015-10-17 13:53:29,501 The local time is Sat Oct 17 13:53:29 2015" #: ../../howto/logging-cookbook.rst:3322 msgid "" @@ -4777,7 +6276,6 @@ msgstr "" msgid "Using a context manager for selective logging" msgstr "ロギングの選択にコンテキストマネージャを使う" -#: ../../howto/logging-cookbook.rst:3331 msgid "" "There are times when it would be useful to temporarily change the logging " "configuration and revert it back after doing something. For this, a context " @@ -4786,15 +6284,12 @@ msgid "" "optionally change the logging level and add a logging handler purely in the " "scope of the context manager::" msgstr "" -"一時的にロギングの設定を変えて、作業をした後に設定を戻せると便利なときがあり" -"ます。\n" -"こういうときの、ロギングコンテキストの保存と復元をする方法ではコンテキストマ" -"ネージャを使うのが一番です。\n" -"以下にあるのがそのためのコンテキストマネージャの簡単な例で、これを使うと、任" -"意にロギングレベルを変更し、コンテキストマネージャのスコープ内で他に影響を及" -"ぼさずロギングハンドラを追加できるようになります::" +"ロギングの設定を一時的に変更し、処理後に元に戻せると便利な場合があります。\n" +"設定を保存・復元するにはコンテキストマネージャが分かりやすい方法です。\n" +"次の簡単な例では、必要に応じてロギングレベルを変更したり、ハンドラを追加した" +"りできます。\n" +"変更はコンテキストマネージャの有効期間だけ適用されます。 ::" -#: ../../howto/logging-cookbook.rst:3338 msgid "" "import logging\n" "import sys\n" @@ -4822,6 +6317,31 @@ msgid "" " self.handler.close()\n" " # implicit return of None => don't swallow exceptions" msgstr "" +"import logging\n" +"import sys\n" +"\n" +"class LoggingContext:\n" +" def __init__(self, logger, level=None, handler=None, close=True):\n" +" self.logger = logger\n" +" self.level = level\n" +" self.handler = handler\n" +" self.close = close\n" +"\n" +" def __enter__(self):\n" +" if self.level is not None:\n" +" self.old_level = self.logger.level\n" +" self.logger.setLevel(self.level)\n" +" if self.handler:\n" +" self.logger.addHandler(self.handler)\n" +"\n" +" def __exit__(self, et, ev, tb):\n" +" if self.level is not None:\n" +" self.logger.setLevel(self.old_level)\n" +" if self.handler:\n" +" self.logger.removeHandler(self.handler)\n" +" if self.handler and self.close:\n" +" self.handler.close()\n" +" # 暗黙に None を返すので、例外を握りつぶさない" #: ../../howto/logging-cookbook.rst:3364 msgid "" @@ -4847,7 +6367,6 @@ msgstr "" "どのように動作するのかを示すためには、次のコード群を上のコードに付け加えると" "よいです::" -#: ../../howto/logging-cookbook.rst:3373 msgid "" "if __name__ == '__main__':\n" " logger = logging.getLogger('foo')\n" @@ -4866,6 +6385,22 @@ msgid "" " logger.info('6. This should appear just once on stderr.')\n" " logger.debug('7. This should not appear.')" msgstr "" +"if __name__ == '__main__':\n" +" logger = logging.getLogger('foo')\n" +" logger.addHandler(logging.StreamHandler())\n" +" logger.setLevel(logging.INFO)\n" +" logger.info('1. This should appear just once on stderr.')\n" +" logger.debug('2. This should not appear.')\n" +" with LoggingContext(logger, level=logging.DEBUG):\n" +" logger.debug('3. This should appear once on stderr.')\n" +" logger.debug('4. This should not appear.')\n" +" h = logging.StreamHandler(sys.stdout)\n" +" with LoggingContext(logger, level=logging.DEBUG, handler=h, " +"close=True):\n" +" logger.debug('5. This should appear twice - once on stderr and once " +"on stdout.')\n" +" logger.info('6. This should appear just once on stderr.')\n" +" logger.debug('7. This should not appear.')" #: ../../howto/logging-cookbook.rst:3388 msgid "" @@ -4896,7 +6431,6 @@ msgstr "" msgid "If we run the resulting script, the result is as follows:" msgstr "出来上がったスクリプトを実行すると、結果は次のようになります::" -#: ../../howto/logging-cookbook.rst:3400 msgid "" "$ python logctx.py\n" "1. This should appear just once on stderr.\n" @@ -4905,6 +6439,12 @@ msgid "" "5. This should appear twice - once on stderr and once on stdout.\n" "6. This should appear just once on stderr." msgstr "" +"$ python logctx.py\n" +"1. This should appear just once on stderr.\n" +"3. This should appear once on stderr.\n" +"5. This should appear twice - once on stderr and once on stdout.\n" +"5. This should appear twice - once on stderr and once on stdout.\n" +"6. This should appear just once on stderr." #: ../../howto/logging-cookbook.rst:3409 msgid "" @@ -4914,11 +6454,12 @@ msgstr "" "``stderr`` を ``/dev/null`` へパイプした状態でもう一度実行すると、次のように" "なり、これは ``stdout`` の方に書かれたメッセージだけが現れています:" -#: ../../howto/logging-cookbook.rst:3412 msgid "" "$ python logctx.py 2>/dev/null\n" "5. This should appear twice - once on stderr and once on stdout." msgstr "" +"$ python logctx.py 2>/dev/null\n" +"5. This should appear twice - once on stderr and once on stdout." #: ../../howto/logging-cookbook.rst:3417 msgid "Once again, but piping ``stdout`` to ``/dev/null``, we get:" @@ -4926,7 +6467,6 @@ msgstr "" "``stdout`` を ``/dev/null`` へパイプした状態でさらにもう一度実行すると、こう" "なります:" -#: ../../howto/logging-cookbook.rst:3419 msgid "" "$ python logctx.py >/dev/null\n" "1. This should appear just once on stderr.\n" @@ -4934,6 +6474,11 @@ msgid "" "5. This should appear twice - once on stderr and once on stdout.\n" "6. This should appear just once on stderr." msgstr "" +"$ python logctx.py >/dev/null\n" +"1. This should appear just once on stderr.\n" +"3. This should appear once on stderr.\n" +"5. This should appear twice - once on stderr and once on stdout.\n" +"6. This should appear just once on stderr." #: ../../howto/logging-cookbook.rst:3427 msgid "" @@ -4994,7 +6539,6 @@ msgstr "" "ライン引数を使ってアプリケーションのログの冗長性を制御したいとします。 ``app." "py`` は次のコードのようになるでしょう::" -#: ../../howto/logging-cookbook.rst:3454 msgid "" "import argparse\n" "import importlib\n" @@ -5040,6 +6584,48 @@ msgid "" "if __name__ == '__main__':\n" " sys.exit(main())" msgstr "" +"import argparse\n" +"import importlib\n" +"import logging\n" +"import os\n" +"import sys\n" +"\n" +"def main(args=None):\n" +" scriptname = os.path.basename(__file__)\n" +" parser = argparse.ArgumentParser(scriptname)\n" +" levels = ('DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL')\n" +" parser.add_argument('--log-level', default='INFO', choices=levels)\n" +" subparsers = parser.add_subparsers(dest='command',\n" +" help='Available commands:')\n" +" start_cmd = subparsers.add_parser('start', help='Start a service')\n" +" start_cmd.add_argument('name', metavar='NAME',\n" +" help='Name of service to start')\n" +" stop_cmd = subparsers.add_parser('stop',\n" +" help='Stop one or more services')\n" +" stop_cmd.add_argument('names', metavar='NAME', nargs='+',\n" +" help='Name of service to stop')\n" +" restart_cmd = subparsers.add_parser('restart',\n" +" help='Restart one or more " +"services')\n" +" restart_cmd.add_argument('names', metavar='NAME', nargs='+',\n" +" help='Name of service to restart')\n" +" options = parser.parse_args()\n" +" # コマンドを振り分けるコードをすべてこのファイルに置くこともできるが、\n" +" # ここでは説明のため、各コマンドを別のモジュールに実装する。\n" +" try:\n" +" mod = importlib.import_module(options.command)\n" +" cmd = getattr(mod, 'command')\n" +" except (ImportError, AttributeError):\n" +" print('Unable to find the code for command \\'%s\\'' % options." +"command)\n" +" return 1\n" +" # ここを工夫して、ファイルや辞書から設定を読み込んでもよい\n" +" logging.basicConfig(level=options.log_level,\n" +" format='%(levelname)s %(name)s %(message)s')\n" +" cmd(options)\n" +"\n" +"if __name__ == '__main__':\n" +" sys.exit(main())" #: ../../howto/logging-cookbook.rst:3495 msgid "" @@ -5049,7 +6635,6 @@ msgstr "" "``start`` 、 ``stop`` 、 ``restart`` コマンドは個別のモジュールとして実装され" "ます。次は起動コマンドのソースです::" -#: ../../howto/logging-cookbook.rst:3498 msgid "" "# start.py\n" "import logging\n" @@ -5061,12 +6646,20 @@ msgid "" " # actually do the command processing here ...\n" " logger.info('Started the \\'%s\\' service.', options.name)" msgstr "" +"# start.py\n" +"import logging\n" +"\n" +"logger = logging.getLogger(__name__)\n" +"\n" +"def command(options):\n" +" logger.debug('About to start %s', options.name)\n" +" # ここで実際のコマンド処理を行う ...\n" +" logger.info('Started the \\'%s\\' service.', options.name)" #: ../../howto/logging-cookbook.rst:3508 msgid "and thus for stopping::" msgstr "停止コマンドのソースは次の通りです::" -#: ../../howto/logging-cookbook.rst:3510 msgid "" "# stop.py\n" "import logging\n" @@ -5087,12 +6680,29 @@ msgid "" " # actually do the command processing here ...\n" " logger.info('Stopped the %s service%s.', services, plural)" msgstr "" +"# stop.py\n" +"import logging\n" +"\n" +"logger = logging.getLogger(__name__)\n" +"\n" +"def command(options):\n" +" n = len(options.names)\n" +" if n == 1:\n" +" plural = ''\n" +" services = '\\'%s\\'' % options.names[0]\n" +" else:\n" +" plural = 's'\n" +" services = ', '.join('\\'%s\\'' % name for name in options.names)\n" +" i = services.rfind(', ')\n" +" services = services[:i] + ' and ' + services[i + 2:]\n" +" logger.debug('About to stop %s', services)\n" +" # ここで実際のコマンド処理を行う ...\n" +" logger.info('Stopped the %s service%s.', services, plural)" #: ../../howto/logging-cookbook.rst:3529 msgid "and similarly for restarting::" msgstr "同様に、再起動のコマンドは次の通りです::" -#: ../../howto/logging-cookbook.rst:3531 msgid "" "# restart.py\n" "import logging\n" @@ -5113,6 +6723,24 @@ msgid "" " # actually do the command processing here ...\n" " logger.info('Restarted the %s service%s.', services, plural)" msgstr "" +"# restart.py\n" +"import logging\n" +"\n" +"logger = logging.getLogger(__name__)\n" +"\n" +"def command(options):\n" +" n = len(options.names)\n" +" if n == 1:\n" +" plural = ''\n" +" services = '\\'%s\\'' % options.names[0]\n" +" else:\n" +" plural = 's'\n" +" services = ', '.join('\\'%s\\'' % name for name in options.names)\n" +" i = services.rfind(', ')\n" +" services = services[:i] + ' and ' + services[i + 2:]\n" +" logger.debug('About to restart %s', services)\n" +" # ここで実際のコマンド処理を行う ...\n" +" logger.info('Restarted the %s service%s.', services, plural)" #: ../../howto/logging-cookbook.rst:3550 msgid "" @@ -5122,7 +6750,6 @@ msgstr "" "このアプリケーションをデフォルトのログレベルで実行すると、次のような出力が得" "られます:" -#: ../../howto/logging-cookbook.rst:3552 msgid "" "$ python app.py start foo\n" "INFO start Started the 'foo' service.\n" @@ -5133,6 +6760,14 @@ msgid "" "$ python app.py restart foo bar baz\n" "INFO restart Restarted the 'foo', 'bar' and 'baz' services." msgstr "" +"$ python app.py start foo\n" +"INFO start Started the 'foo' service.\n" +"\n" +"$ python app.py stop foo bar\n" +"INFO stop Stopped the 'foo' and 'bar' services.\n" +"\n" +"$ python app.py restart foo bar baz\n" +"INFO restart Restarted the 'foo', 'bar' and 'baz' services." #: ../../howto/logging-cookbook.rst:3563 msgid "" @@ -5150,7 +6785,6 @@ msgstr "" "ログレベルを変更し、ログに出力する情報を変更できるようにしましょう。もし、よ" "り詳細な情報が必要だとしましょう:" -#: ../../howto/logging-cookbook.rst:3569 msgid "" "$ python app.py --log-level DEBUG start foo\n" "DEBUG start About to start foo\n" @@ -5164,35 +6798,52 @@ msgid "" "DEBUG restart About to restart 'foo', 'bar' and 'baz'\n" "INFO restart Restarted the 'foo', 'bar' and 'baz' services." msgstr "" +"$ python app.py --log-level DEBUG start foo\n" +"DEBUG start About to start foo\n" +"INFO start Started the 'foo' service.\n" +"\n" +"$ python app.py --log-level DEBUG stop foo bar\n" +"DEBUG stop About to stop 'foo' and 'bar'\n" +"INFO stop Stopped the 'foo' and 'bar' services.\n" +"\n" +"$ python app.py --log-level DEBUG restart foo bar baz\n" +"DEBUG restart About to restart 'foo', 'bar' and 'baz'\n" +"INFO restart Restarted the 'foo', 'bar' and 'baz' services." #: ../../howto/logging-cookbook.rst:3583 msgid "And if we want less:" msgstr "あるいは情報を減らしたい場合もあるでしょう:" -#: ../../howto/logging-cookbook.rst:3585 msgid "" "$ python app.py --log-level WARNING start foo\n" "$ python app.py --log-level WARNING stop foo bar\n" "$ python app.py --log-level WARNING restart foo bar baz" msgstr "" +"$ python app.py --log-level WARNING start foo\n" +"$ python app.py --log-level WARNING stop foo bar\n" +"$ python app.py --log-level WARNING restart foo bar baz" -#: ../../howto/logging-cookbook.rst:3591 msgid "" "In this case, the commands don't print anything to the console, since " "nothing at ``WARNING`` level or above is logged by them." -msgstr "この場合、コマンドはコンソールに何も出力しなくなります。" +msgstr "" +"この場合、コマンドは ``WARNING`` 以上のレベルのログを記録しないため、コンソー" +"ルには何も表示されません。" #: ../../howto/logging-cookbook.rst:3597 msgid "A Qt GUI for logging" msgstr "Qt GUIのログ出力" -#: ../../howto/logging-cookbook.rst:3599 msgid "" "A question that comes up from time to time is about how to log to a GUI " "application. The `Qt `_ framework is a popular cross-" "platform UI framework with Python bindings using :pypi:`PySide2` or :pypi:" "`PyQt5` libraries." msgstr "" +"GUI アプリケーションにログを表示する方法は、ときどき寄せられる質問です。\n" +"`Qt `_ は広く使われているクロスプラットフォームの UI フ" +"レームワークで、:pypi:`PySide2` や :pypi:`PyQt5` ライブラリによる Python バイ" +"ンディングがあります。" #: ../../howto/logging-cookbook.rst:3604 msgid "" @@ -5210,23 +6861,26 @@ msgstr "" "ンドのタスクを行うワーカースレッドからログ出力を行います(ここではランダムな" "期間にランダムなレベルでメッセージを出しています)。" -#: ../../howto/logging-cookbook.rst:3611 msgid "" "The worker thread is implemented using Qt's ``QThread`` class rather than " "the :mod:`threading` module, as there are circumstances where one has to use " "``QThread``, which offers better integration with other ``Qt`` components." msgstr "" -"ワーカースレッドは :mod:`threading` モジュールではなく、Qtの ``QThread`` クラ" -"スを使っています。これは他の ``Qt`` コンポーネントとうまく統合できるように、 " -"``QThread`` を使う必要があるからです。" +"ワーカースレッドは :mod:`threading` モジュールではなく Qt の ``QThread`` クラ" +"スで実装しています。\n" +"他の ``Qt`` コンポーネントとの連携に優れた ``QThread`` を使う必要がある場合も" +"あるためです。" -#: ../../howto/logging-cookbook.rst:3615 msgid "" "The code should work with recent releases of any of ``PySide6``, ``PyQt6``, " "``PySide2`` or ``PyQt5``. You should be able to adapt the approach to " "earlier versions of Qt. Please refer to the comments in the code snippet for " "more detailed information." msgstr "" +"このコードは ``PySide6``、``PyQt6``、``PySide2``、``PyQt5`` のいずれも最近の" +"リリースで動作するはずです。\n" +"以前の Qt に合わせて変更することもできるでしょう。\n" +"詳しくはコード内のコメントを参照してください。" #: ../../howto/logging-cookbook.rst:3620 msgid "" @@ -5594,7 +7248,6 @@ msgstr "" "あります。上記のハンドラにより、構造化データは以下のように渡すことができるで" "しょう::" -#: ../../howto/logging-cookbook.rst:3932 msgid "" "sd = {\n" " 'foo@12345': {'bar': 'baz', 'baz': 'bozz', 'fizz': r'buzz'},\n" @@ -5604,6 +7257,13 @@ msgid "" "i = 1\n" "logger.debug('Message %d', i, extra=extra)" msgstr "" +"sd = {\n" +" 'foo@12345': {'bar': 'baz', 'baz': 'bozz', 'fizz': r'buzz'},\n" +" 'foo@54321': {'rab': 'baz', 'zab': 'bozz', 'zzif': r'buzz'}\n" +"}\n" +"extra = {'structured_data': sd}\n" +"i = 1\n" +"logger.debug('Message %d', i, extra=extra)" #: ../../howto/logging-cookbook.rst:3941 msgid "How to treat a logger like an output stream" @@ -5621,7 +7281,6 @@ msgstr "" "きあります。これは file-like な API でロガーをラップするクラスを使うことで実" "現できます。以下はそのようなクラスを例解する短いスクリプトです:" -#: ../../howto/logging-cookbook.rst:3948 msgid "" "import logging\n" "\n" @@ -5658,16 +7317,51 @@ msgid "" "if __name__ == \"__main__\":\n" " main()" msgstr "" +"import logging\n" +"\n" +"class LoggerWriter:\n" +" def __init__(self, logger, level):\n" +" self.logger = logger\n" +" self.level = level\n" +"\n" +" def write(self, message):\n" +" if message != '\\n': # 必要なら、改行だけの出力を避ける\n" +" self.logger.log(self.level, message)\n" +"\n" +" def flush(self):\n" +" # 実際には何もしないが、ファイルライクオブジェクトに期待される場合が" +"ある。\n" +" # 必要に応じて実装する\n" +" pass\n" +"\n" +" def close(self):\n" +" # 実際には何もしないが、ファイルライクオブジェクトに期待される場合が" +"ある。\n" +" # 必要に応じて実装する。フラグを設定し、\n" +" # 以降の write の呼び出しで例外を送出するようにしてもよい\n" +" pass\n" +"\n" +"def main():\n" +" logging.basicConfig(level=logging.DEBUG)\n" +" logger = logging.getLogger('demo')\n" +" info_fp = LoggerWriter(logger, logging.INFO)\n" +" debug_fp = LoggerWriter(logger, logging.DEBUG)\n" +" print('An INFO message', file=info_fp)\n" +" print('A DEBUG message', file=debug_fp)\n" +"\n" +"if __name__ == \"__main__\":\n" +" main()" #: ../../howto/logging-cookbook.rst:3983 msgid "When this script is run, it prints" msgstr "このスクリプトを実行すると、次のように出力されます。" -#: ../../howto/logging-cookbook.rst:3985 msgid "" "INFO:demo:An INFO message\n" "DEBUG:demo:A DEBUG message" msgstr "" +"INFO:demo:An INFO message\n" +"DEBUG:demo:A DEBUG message" #: ../../howto/logging-cookbook.rst:3990 msgid "" @@ -5677,13 +7371,16 @@ msgstr "" "また、 ``sys.stdout`` や ``sys.stderr`` をリダイレクトするには " "``LoggerWriter`` を使って以下のようにします:" -#: ../../howto/logging-cookbook.rst:3993 msgid "" "import sys\n" "\n" "sys.stdout = LoggerWriter(logger, logging.INFO)\n" "sys.stderr = LoggerWriter(logger, logging.WARNING)" msgstr "" +"import sys\n" +"\n" +"sys.stdout = LoggerWriter(logger, logging.INFO)\n" +"sys.stderr = LoggerWriter(logger, logging.WARNING)" #: ../../howto/logging-cookbook.rst:4000 msgid "" @@ -5697,7 +7394,6 @@ msgstr "" "で上書きされる *前の* ``sys.stderr`` を使って) 設定を行います。そして、以下の" "ような結果を得るでしょう:" -#: ../../howto/logging-cookbook.rst:4005 msgid "" ">>> print('Foo')\n" "INFO:demo:Foo\n" @@ -5705,6 +7401,11 @@ msgid "" "WARNING:demo:Bar\n" ">>>" msgstr "" +">>> print('Foo')\n" +"INFO:demo:Foo\n" +">>> print('Bar', file=sys.stderr)\n" +"WARNING:demo:Bar\n" +">>>" #: ../../howto/logging-cookbook.rst:4013 msgid "" @@ -5726,17 +7427,17 @@ msgstr "" "いてはなすがままになっています。たとえば、上記の ``LoggerWriter`` の定義で、" "次のようなコードの断片があったとします。" -#: ../../howto/logging-cookbook.rst:4021 msgid "" "sys.stderr = LoggerWriter(logger, logging.WARNING)\n" "1 / 0" msgstr "" +"sys.stderr = LoggerWriter(logger, logging.WARNING)\n" +"1 / 0" #: ../../howto/logging-cookbook.rst:4026 msgid "then running the script results in" msgstr "このスクリプトを実行すると以下のような結果が得られます。" -#: ../../howto/logging-cookbook.rst:4028 msgid "" "WARNING:demo:Traceback (most recent call last):\n" "\n" @@ -5754,8 +7455,22 @@ msgid "" "WARNING:demo::\n" "WARNING:demo:division by zero" msgstr "" +"WARNING:demo:Traceback (most recent call last):\n" +"\n" +"WARNING:demo: File \"/home/runner/cookbook-loggerwriter/test.py\", line 53, " +"in \n" +"\n" +"WARNING:demo:\n" +"WARNING:demo:main()\n" +"WARNING:demo: File \"/home/runner/cookbook-loggerwriter/test.py\", line 49, " +"in main\n" +"\n" +"WARNING:demo:\n" +"WARNING:demo:1 / 0\n" +"WARNING:demo:ZeroDivisionError\n" +"WARNING:demo::\n" +"WARNING:demo:division by zero" -#: ../../howto/logging-cookbook.rst:4044 msgid "" "As you can see, this output isn't ideal. That's because the underlying code " "which writes to ``sys.stderr`` makes multiple writes, each of which results " @@ -5764,8 +7479,13 @@ msgid "" "when newlines are seen. Let's use a slightly better implementation of " "``LoggerWriter``:" msgstr "" +"この出力は望ましいものではありません。\n" +"内部のコードが ``sys.stderr`` に複数回の書き込みを行い、そのたびに別のログ行" +"になるためです (例えば上の最後の三行)。\n" +"この問題を避けるには、書き込まれた内容をバッファにため、改行が現れたときだけ" +"ログ行を出力します。\n" +"``LoggerWriter`` を少し改善してみましょう:" -#: ../../howto/logging-cookbook.rst:4050 msgid "" "class BufferingLoggerWriter(LoggerWriter):\n" " def __init__(self, logger, level):\n" @@ -5784,6 +7504,22 @@ msgid "" " for part in parts:\n" " self.logger.log(self.level, part)" msgstr "" +"class BufferingLoggerWriter(LoggerWriter):\n" +" def __init__(self, logger, level):\n" +" super().__init__(logger, level)\n" +" self.buffer = ''\n" +"\n" +" def write(self, message):\n" +" if '\\n' not in message:\n" +" self.buffer += message\n" +" else:\n" +" parts = message.split('\\n')\n" +" if self.buffer:\n" +" s = self.buffer + parts.pop(0)\n" +" self.logger.log(self.level, s)\n" +" self.buffer = parts.pop()\n" +" for part in parts:\n" +" self.logger.log(self.level, part)" #: ../../howto/logging-cookbook.rst:4069 msgid "" @@ -5793,7 +7529,6 @@ msgstr "" "この実装は改行があらわれるまでログをバッファリングし、行全体をログに出力する" "だけです。このアプローチにより、より適切な出力が得られます:" -#: ../../howto/logging-cookbook.rst:4072 msgid "" "WARNING:demo:Traceback (most recent call last):\n" "WARNING:demo: File \"/home/runner/cookbook-loggerwriter/main.py\", line 55, " @@ -5804,6 +7539,14 @@ msgid "" "WARNING:demo: 1/0\n" "WARNING:demo:ZeroDivisionError: division by zero" msgstr "" +"WARNING:demo:Traceback (most recent call last):\n" +"WARNING:demo: File \"/home/runner/cookbook-loggerwriter/main.py\", line 55, " +"in \n" +"WARNING:demo: main()\n" +"WARNING:demo: File \"/home/runner/cookbook-loggerwriter/main.py\", line 52, " +"in main\n" +"WARNING:demo: 1/0\n" +"WARNING:demo:ZeroDivisionError: division by zero" #: ../../howto/logging-cookbook.rst:4085 msgid "Patterns to avoid" @@ -5837,13 +7580,12 @@ msgstr "" "ではエラーがおきることなく、同じファイルを何度も開けます。これは次のように間" "違って使われる可能性があります。" -#: ../../howto/logging-cookbook.rst:4100 msgid "" "Adding a file handler more than once which references the same file (e.g. by " "a copy/paste/forget-to-change error)." msgstr "" -"同じファイルを指すファイルハンドラを1度以上追加する(例えばコピー&ペーストし" -"て書き換え忘れによるエラー)。" +"同じファイルを参照するファイルハンドラを複数回追加する (例えばコピー&ペース" +"ト後の変更忘れによって)。" #: ../../howto/logging-cookbook.rst:4103 msgid "" @@ -5871,7 +7613,6 @@ msgstr "" "ファイルを複数回開くことは、 *一見* 動作しているように見えますが、さまざまな" "問題を引き起こす可能性があります:" -#: ../../howto/logging-cookbook.rst:4113 msgid "" "Logging output can be garbled because multiple threads or processes try to " "write to the same file. Although logging guards against concurrent use of " @@ -5879,11 +7620,12 @@ msgid "" "if concurrent writes are attempted by two different threads using two " "different handler instances which happen to point to the same file." msgstr "" -"複数のスレッドが同一ファイルに書き出そうとすると、ログ出力が文字化けする可能" -"性があります。ログモジュールは同じハンドラーのインスタンスに対して並列で利用" -"しても正しく動くようになっていますが、同じファイルを参照する2つの異なるハンド" -"ラーのインスタンスに対し、2つのスレッドから同時に書き込みをした場合にはそのよ" -"うな保護は働きません。" +"複数のスレッドやプロセスが同じファイルに書き込もうとすると、ログ出力が混ざっ" +"て壊れる可能性があります。\n" +"logging は複数のスレッドによる同じハンドラインスタンスの同時使用を保護しま" +"す。\n" +"しかし、同じファイルを指す別々のハンドラインスタンスを使い、二つのスレッドが" +"同時に書き込む場合には、そのような保護はありません。" #: ../../howto/logging-cookbook.rst:4119 msgid "" @@ -5939,17 +7681,17 @@ msgstr "" "ライブラリ内でロガーに :class:`~logging.NullHandler` 以外のハンドラーを追加す" "る" -#: ../../howto/logging-cookbook.rst:4143 msgid "" "Configuring logging by adding handlers, formatters and filters is the " "responsibility of the application developer, not the library developer. If " "you are maintaining a library, ensure that you don't add handlers to any of " "your loggers other than a :class:`~logging.NullHandler` instance." msgstr "" -"ハンドラーやフォーマッター、フィルターを追加してログ出力をカスタマイズするの" -"はライブラリ開発者ではなく、アプリケーション開発者の責務です。もしあなたがラ" -"イブラリのメンテナンスをしているのであれば、 :class:`~logging.NullHandler` イ" -"ンスタンス以外のロガーを追加してはいけない、ということを意味します。" +"ハンドラ、フォーマッタ、フィルタを追加してロギングを設定するのは、アプリケー" +"ション開発者の責任です。\n" +"ライブラリ開発者の責任ではありません。\n" +"ライブラリを保守している場合、そのロガーに追加するハンドラは :class:" +"`~logging.NullHandler` インスタンスだけにしてください。" #: ../../howto/logging-cookbook.rst:4149 msgid "Creating a lot of loggers" diff --git a/howto/logging.po b/howto/logging.po index a0cabdb00..63c5dbbe7 100644 --- a/howto/logging.po +++ b/howto/logging.po @@ -25,10 +25,10 @@ msgstr "" "Last-Translator: Inada Naoki , 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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/logging.rst:5 @@ -111,29 +111,30 @@ msgstr "" "プログラムの通常の操作中に発生したイベントの報告 (例えば、状態の監視や障害の" "分析)" -#: ../../howto/logging.rst:44 msgid "" "A logger's :meth:`~Logger.info` (or :meth:`~Logger.debug` method for very " "detailed output for diagnostic purposes)" msgstr "" +"ロガーの :meth:`~Logger.info` (診断用の非常に詳しい出力には :meth:`~Logger." +"debug`) メソッド" #: ../../howto/logging.rst:49 msgid "Issue a warning regarding a particular runtime event" msgstr "特定のランタイムイベントに関わる警告の発行" -#: ../../howto/logging.rst:49 msgid "" ":func:`warnings.warn` in library code if the issue is avoidable and the " "client application should be modified to eliminate the warning" msgstr "" -"その発行が避けられるもので、クライアントアプリケーションを修正してその警告を" -"排除するべきなら :func:`warnings.warn`" +"問題を回避でき、クライアントアプリケーションを修正して警告の原因を取り除くべ" +"き場合は、ライブラリのコードで :func:`warnings.warn` を使う" -#: ../../howto/logging.rst:54 msgid "" "A logger's :meth:`~Logger.warning` method if there is nothing the client " "application can do about the situation, but the event should still be noted" msgstr "" +"クライアントアプリケーションでは対処できなくても、そのイベントを記録すべき場" +"合はロガーの :meth:`~Logger.warning` メソッド" #: ../../howto/logging.rst:60 msgid "Report an error regarding a particular runtime event" @@ -143,27 +144,28 @@ msgstr "特定のランタイムイベントに関わるエラーの報告" msgid "Raise an exception" msgstr "例外の送出" -#: ../../howto/logging.rst:63 msgid "" "Report suppression of an error without raising an exception (e.g. error " "handler in a long-running server process)" msgstr "" -"例外の送出をしないエラーの抑制 (例えば、長期のサーバプロセス中のエラーハンド" -"ラ)" +"例外を送出せずに処理したエラーの報告 (例えば、長時間稼働するサーバープロセス" +"のエラーハンドラ)" -#: ../../howto/logging.rst:63 msgid "" "A logger's :meth:`~Logger.error`, :meth:`~Logger.exception` or :meth:" "`~Logger.critical` method as appropriate for the specific error and " "application domain" msgstr "" +"エラーやアプリケーションの分野に応じて、ロガーの :meth:`~Logger.error`、:" +"meth:`~Logger.exception`、:meth:`~Logger.critical` メソッド" -#: ../../howto/logging.rst:70 msgid "" "The logger methods are named after the level or severity of the events they " "are used to track. The standard levels and their applicability are described " "below (in increasing order of severity):" msgstr "" +"ロガーのメソッド名は、追跡するイベントのレベルや重大度に対応しています。\n" +"標準のレベルとその用途を、重大度の低い順に示します:" #: ../../howto/logging.rst:77 ../../howto/logging.rst:875 msgid "Level" @@ -194,14 +196,14 @@ msgstr "想定された通りのことが起こったことの確認。" msgid "``WARNING``" msgstr "``WARNING``" -#: ../../howto/logging.rst:85 msgid "" "An indication that something unexpected happened, or indicative of some " "problem in the near future (e.g. 'disk space low'). The software is still " "working as expected." msgstr "" -"想定外のことが起こった、または問題が近く起こりそうである (例えば、'disk " -"space low') ことの表示。" +"想定外のことが起こった、または近い将来の問題を示す情報 (例えば「ディスク容量" +"が少ない」)。\n" +"ソフトウェアは引き続き想定どおり動作しています。" #: ../../howto/logging.rst:90 ../../howto/logging.rst:879 msgid "``ERROR``" @@ -217,18 +219,18 @@ msgstr "より重大な問題により、ソフトウェアがある機能を実 msgid "``CRITICAL``" msgstr "``CRITICAL``" -#: ../../howto/logging.rst:93 msgid "" "A serious error, indicating that the program itself may be unable to " "continue running." -msgstr "プログラム自体が実行を続けられないことを表す、重大なエラー。" +msgstr "プログラム自体が実行を継続できない可能性を示す、重大なエラー。" -#: ../../howto/logging.rst:97 msgid "" "The default level is ``WARNING``, which means that only events of this " "severity and higher will be tracked, unless the logging package is " "configured to do otherwise." msgstr "" +"デフォルトのレベルは ``WARNING`` です。\n" +"そのため、別の設定をしない限り、この重大度以上のイベントだけが追跡されます。" #: ../../howto/logging.rst:100 msgid "" @@ -248,12 +250,14 @@ msgstr "簡単な例" msgid "A very simple example is::" msgstr "ごく簡単な例は::" -#: ../../howto/logging.rst:112 msgid "" "import logging\n" "logging.warning('Watch out!') # will print a message to the console\n" "logging.info('I told you so') # will not print anything" msgstr "" +"import logging\n" +"logging.warning('Watch out!') # will print a message to the console\n" +"logging.info('I told you so') # will not print anything" #: ../../howto/logging.rst:116 msgid "If you type these lines into a script and run it, you'll see:" @@ -261,11 +265,9 @@ msgstr "" "これらの行をスクリプトにタイプして実行すると、次のようにコンソールに出力され" "ます:" -#: ../../howto/logging.rst:118 msgid "WARNING:root:Watch out!" -msgstr "" +msgstr "WARNING:root:Watch out!" -#: ../../howto/logging.rst:122 msgid "" "printed out on the console. The ``INFO`` message doesn't appear because the " "default level is ``WARNING``. The printed message includes the indication of " @@ -273,8 +275,14 @@ msgid "" "e. 'Watch out!'. The actual output can be formatted quite flexibly if you " "need that; formatting options will also be explained later." msgstr "" +"これがコンソールに表示されます。\n" +"デフォルトのレベルが ``WARNING`` なので、``INFO`` のメッセージは表示されませ" +"ん。\n" +"表示されるメッセージには、レベルとログ呼び出しで指定したイベントの説明、つま" +"り 'Watch out!' が含まれます。\n" +"必要なら出力の書式を柔軟に設定できます。\n" +"書式設定のオプションは後で説明します。" -#: ../../howto/logging.rst:128 msgid "" "Notice that in this example, we use functions directly on the ``logging`` " "module, like ``logging.debug``, rather than creating a logger and calling " @@ -285,6 +293,13 @@ msgid "" "reason as well as others, it's better to create loggers and call their " "methods." msgstr "" +"この例ではロガーを作成してメソッドを呼ぶ代わりに、``logging.debug`` など " +"``logging`` モジュールの関数を直接使っています。\n" +"これらはルートロガーを操作する関数ですが、この例のように設定がまだ行われてい" +"ない場合は :func:`~logging.basicConfig` を自動的に呼び出すため便利です。\n" +"ただし、大きなプログラムでは通常、ロギングの設定を明示的に制御したくなるで" +"しょう。\n" +"この点などを考えると、ロガーを作成してそのメソッドを呼ぶ方が適しています。" #: ../../howto/logging.rst:137 msgid "Logging to a file" @@ -301,7 +316,6 @@ msgstr "" "を見て行きましょう。以下のサンプルを試すときは Python インタプリタを新しく起" "動して、上のセッションの続きにならないようにしてください::" -#: ../../howto/logging.rst:143 msgid "" "import logging\n" "logger = logging.getLogger(__name__)\n" @@ -312,6 +326,14 @@ msgid "" "logger.warning('And this, too')\n" "logger.error('And non-ASCII stuff, too, like Øresund and Malmö')" msgstr "" +"import logging\n" +"logger = logging.getLogger(__name__)\n" +"logging.basicConfig(filename='example.log', encoding='utf-8', level=logging." +"DEBUG)\n" +"logger.debug('This message should go to the log file')\n" +"logger.info('So should this')\n" +"logger.warning('And this, too')\n" +"logger.error('And non-ASCII stuff, too, like Øresund and Malmö')" #: ../../howto/logging.rst:151 msgid "" @@ -333,13 +355,16 @@ msgid "" "messages:" msgstr "そして、ファイルの中身を確認すると、ログメッセージが確認できます:" -#: ../../howto/logging.rst:161 msgid "" "DEBUG:__main__:This message should go to the log file\n" "INFO:__main__:So should this\n" "WARNING:__main__:And this, too\n" "ERROR:__main__:And non-ASCII stuff, too, like Øresund and Malmö" msgstr "" +"DEBUG:__main__:This message should go to the log file\n" +"INFO:__main__:So should this\n" +"WARNING:__main__:And this, too\n" +"ERROR:__main__:And non-ASCII stuff, too, like Øresund and Malmö" #: ../../howto/logging.rst:168 msgid "" @@ -356,20 +381,16 @@ msgid "" "If you want to set the logging level from a command-line option such as:" msgstr "次のようなコマンドラインオプションでログレベルを設定したいと考え:" -#: ../../howto/logging.rst:174 msgid "--log=INFO" -msgstr "" +msgstr "--log=INFO" -#: ../../howto/logging.rst:178 msgid "" "and you have the value of the parameter passed for ``--log`` in some " "variable *loglevel*, you can use::" -msgstr "" -"``--log`` に渡されたパラメータの値を変数 *loglevel* に保存しているとしたら、" +msgstr "``--log`` に渡された値を変数 *loglevel* に保存しているなら、 ::" -#: ../../howto/logging.rst:181 msgid "getattr(logging, loglevel.upper())" -msgstr "" +msgstr "getattr(logging, loglevel.upper())" #: ../../howto/logging.rst:183 msgid "" @@ -381,7 +402,6 @@ msgstr "" "ます。ユーザの入力値をすべてエラーチェックしたくなり、次の例のように実装する" "こともあるでしょう::" -#: ../../howto/logging.rst:187 msgid "" "# assuming loglevel is bound to the string value obtained from the\n" "# command line argument. Convert to upper case to allow the user to\n" @@ -391,13 +411,22 @@ msgid "" " raise ValueError('Invalid log level: %s' % loglevel)\n" "logging.basicConfig(level=numeric_level, ...)" msgstr "" +"# loglevel はコマンドライン引数から取得した文字列とする。\n" +"# --log=DEBUG と --log=debug のどちらでも指定できるよう、\n" +"# 大文字に変換する\n" +"numeric_level = getattr(logging, loglevel.upper(), None)\n" +"if not isinstance(numeric_level, int):\n" +" raise ValueError('Invalid log level: %s' % loglevel)\n" +"logging.basicConfig(level=numeric_level, ...)" -#: ../../howto/logging.rst:195 msgid "" "The call to :func:`basicConfig` should come *before* any calls to a logger's " "methods such as :meth:`~Logger.debug`, :meth:`~Logger.info`, etc. Otherwise, " "that logging event may not be handled in the desired manner." msgstr "" +":func:`basicConfig` は、ロガーの :meth:`~Logger.debug` や :meth:`~Logger." +"info` などのメソッドを呼ぶ *前* に呼び出してください。\n" +"そうしないと、ログイベントが意図した方法で処理されない可能性があります。" #: ../../howto/logging.rst:199 msgid "" @@ -411,11 +440,12 @@ msgstr "" "に新たに始めたいなら、上記の例での呼び出しを次のように変え、*filemode* 引数を" "指定する方法がとれます::" -#: ../../howto/logging.rst:204 msgid "" "logging.basicConfig(filename='example.log', filemode='w', level=logging." "DEBUG)" msgstr "" +"logging.basicConfig(filename='example.log', filemode='w', level=logging." +"DEBUG)" #: ../../howto/logging.rst:206 msgid "" @@ -437,19 +467,19 @@ msgstr "" "変数データのログを取るには、イベント記述メッセージにフォーマット文字列を使" "い、引数に変数データを加えてください。例えば::" -#: ../../howto/logging.rst:216 msgid "" "import logging\n" "logging.warning('%s before you %s', 'Look', 'leap!')" msgstr "" +"import logging\n" +"logging.warning('%s before you %s', 'Look', 'leap!')" #: ../../howto/logging.rst:219 msgid "will display:" msgstr "により、次のように表示されます:" -#: ../../howto/logging.rst:221 msgid "WARNING:root:Look before you leap!" -msgstr "" +msgstr "WARNING:root:Look before you leap!" #: ../../howto/logging.rst:225 msgid "" @@ -479,7 +509,6 @@ msgstr "" "メッセージを表示するのに使われるフォーマットを変更するには、使いたいフォー" "マットを指定する必要があります::" -#: ../../howto/logging.rst:239 msgid "" "import logging\n" "logging.basicConfig(format='%(levelname)s:%(message)s', level=logging." @@ -488,17 +517,25 @@ msgid "" "logging.info('So should this')\n" "logging.warning('And this, too')" msgstr "" +"import logging\n" +"logging.basicConfig(format='%(levelname)s:%(message)s', level=logging." +"DEBUG)\n" +"logging.debug('This message should appear on the console')\n" +"logging.info('So should this')\n" +"logging.warning('And this, too')" #: ../../howto/logging.rst:245 msgid "which would print:" msgstr "により、次のように表示されます:" -#: ../../howto/logging.rst:247 msgid "" "DEBUG:This message should appear on the console\n" "INFO:So should this\n" "WARNING:And this, too" msgstr "" +"DEBUG:This message should appear on the console\n" +"INFO:So should this\n" +"WARNING:And this, too" #: ../../howto/logging.rst:253 msgid "" @@ -527,20 +564,21 @@ msgstr "" "イベントの日付と時刻を表示するには、フォーマット文字列に '%(asctime)s' を置い" "てください::" -#: ../../howto/logging.rst:267 msgid "" "import logging\n" "logging.basicConfig(format='%(asctime)s %(message)s')\n" "logging.warning('is when this event was logged.')" msgstr "" +"import logging\n" +"logging.basicConfig(format='%(asctime)s %(message)s')\n" +"logging.warning('is when this event was logged.')" #: ../../howto/logging.rst:271 msgid "which should print something like this:" msgstr "これは以下の様なフォーマットで表示されます:" -#: ../../howto/logging.rst:273 msgid "2010-12-12 11:41:42,612 is when this event was logged." -msgstr "" +msgstr "2010-12-12 11:41:42,612 is when this event was logged." #: ../../howto/logging.rst:277 msgid "" @@ -552,21 +590,23 @@ msgstr "" "`3339` に似ています。日付と時間のフォーマットをより詳細に制御する必要があるな" "ら、以下の例の様に、 ``basicConfig`` に *datefmt* 引数を指定してください::" -#: ../../howto/logging.rst:281 msgid "" "import logging\n" "logging.basicConfig(format='%(asctime)s %(message)s', datefmt='%m/%d/%Y %I:" "%M:%S %p')\n" "logging.warning('is when this event was logged.')" msgstr "" +"import logging\n" +"logging.basicConfig(format='%(asctime)s %(message)s', datefmt='%m/%d/%Y %I:" +"%M:%S %p')\n" +"logging.warning('is when this event was logged.')" #: ../../howto/logging.rst:285 msgid "which would display something like this:" msgstr "これは次のように表示されます:" -#: ../../howto/logging.rst:287 msgid "12/12/2010 11:46:36 AM is when this event was logged." -msgstr "" +msgstr "12/12/2010 11:46:36 AM is when this event was logged." #: ../../howto/logging.rst:291 msgid "" @@ -684,9 +724,8 @@ msgstr "" "ロガーに名前をつけるときの良い習慣は、ロギングを使う各モジュールに、以下のよ" "うに名付けられた、モジュールレベルロガーを使うことです::" -#: ../../howto/logging.rst:343 msgid "logger = logging.getLogger(__name__)" -msgstr "" +msgstr "logger = logging.getLogger(__name__)" #: ../../howto/logging.rst:345 msgid "" @@ -710,7 +749,6 @@ msgstr "" "の同名のメソッドを呼び出します。これらの関数とメソッドは、同じ署名をもってい" "ます。ルートロガーの名前は、ログ出力では 'root' と表示されます。" -#: ../../howto/logging.rst:354 msgid "" "It is, of course, possible to log messages to different destinations. " "Support is included in the package for writing log messages to files, HTTP " @@ -720,12 +758,13 @@ msgid "" "destination class if you have special requirements not met by any of the " "built-in handler classes." msgstr "" -"もちろん、メッセージを異なる送信先に記録することも出来ます。このパッケージで" -"は、ファイルへ、 HTTP GET/POST 先へ、 SMTP 経由で電子メールへ、汎用のソケット" -"へ、キューへ、または Windows NT イベントログのような OS 毎のログ記録機構へ" -"の、ログメッセージの書きこみがサポートされています。送信先は、 :dfn:" -"`handler` クラスによって取り扱われます。組み込みのハンドラクラスでは満たせな" -"いような、特殊な要件があるなら、独自のログ送信先を生成できます。" +"ログメッセージはさまざまな出力先に送れます。\n" +"このパッケージは、ファイル、HTTP GET/POST の送信先、SMTP によるメール、汎用ソ" +"ケット、キュー、syslog や Windows NT イベントログなどの OS 固有のロギング機構" +"に対応しています。\n" +"出力先は :dfn:`ハンドラ` クラスが扱います。\n" +"組み込みのハンドラクラスでは満たせない要件があれば、独自のログ出力先クラスを" +"作成できます。" #: ../../howto/logging.rst:361 msgid "" @@ -752,9 +791,8 @@ msgstr "" ":func:`basicConfig` が設定するデフォルトのメッセージのフォーマットは次のよう" "になります:" -#: ../../howto/logging.rst:371 msgid "severity:logger name:message" -msgstr "" +msgstr "重大度:ロガー名:メッセージ" #: ../../howto/logging.rst:375 msgid "" @@ -766,9 +804,8 @@ msgstr "" "で、これを変更できます。フォーマット文字列を構成するためのすべてのオプション" "は、 :ref:`formatter-objects` を参照してください。" -#: ../../howto/logging.rst:380 msgid "Logging Flow" -msgstr "Logging Flow" +msgstr "ログ処理の流れ" #: ../../howto/logging.rst:382 msgid "" @@ -1060,28 +1097,25 @@ msgstr "" "す。コンストラクタは三つのオプション引数を取ります -- メッセージのフォーマッ" "ト文字列、日付のフォーマット文字列、スタイル標識です。" -#: ../../howto/logging.rst:561 msgid "" "If there is no message format string, the default is to use the raw " "message. If there is no date format string, the default date format is:" msgstr "" -"フォーマット文字列に何も渡さない場合は、デフォルトで行メッセージが利用されま" -"す。また、日付フォーマットに何も渡さない場合は、デフォルトで以下のフォーマッ" -"トが利用されます:" +"メッセージの書式文字列を指定しなければ、デフォルトではメッセージをそのまま使" +"います。\n" +"日付の書式文字列を指定しなければ、デフォルトの書式は次のとおりです:" -#: ../../howto/logging.rst:564 msgid "%Y-%m-%d %H:%M:%S" -msgstr "" +msgstr "%Y-%m-%d %H:%M:%S" -#: ../../howto/logging.rst:568 msgid "" "with the milliseconds tacked on at the end. The ``style`` is one of ``'%'``, " "``'{'``, or ``'$'``. If one of these is not specified, then ``'%'`` will be " "used." msgstr "" -"時刻の末尾にはミリ秒が付きます。 ``style`` は ``'%'``, ``'{'``, または " -"``'{TX-PL-LABEL}#x27;`` のいずれかです。特に指定がなければ ``'%'`` が使われま" -"す。" +"末尾にはミリ秒が付きます。\n" +"``style`` には ``'%'``、``'{'``、``'$'`` のいずれかを指定します。\n" +"省略すると ``'%'`` が使われます。" #: ../../howto/logging.rst:571 msgid "" @@ -1112,11 +1146,9 @@ msgstr "" "次のメッセージフォーマット文字列は、人が読みやすい形式の時刻、メッセージの深" "刻度、およびメッセージの内容を、順番に出力します::" -#: ../../howto/logging.rst:585 msgid "'%(asctime)s - %(levelname)s - %(message)s'" -msgstr "" +msgstr "'%(asctime)s - %(levelname)s - %(message)s'" -#: ../../howto/logging.rst:587 msgid "" "Formatters use a user-configurable function to convert the creation time of " "a record to a tuple. By default, :func:`time.localtime` is used; to change " @@ -1126,13 +1158,16 @@ msgid "" "want all logging times to be shown in GMT, set the ``converter`` attribute " "in the Formatter class (to ``time.gmtime`` for GMT display)." msgstr "" -"フォーマッタは、ユーザが設定できる関数を使って、生成時刻をタプルに記録しま" -"す。デフォルトでは、 :func:`time.localtime` が使われます。特定のフォーマッタ" -"インスタンスに対してこれを変更するには、インスタンスの ``converter`` 属性を :" -"func:`time.localtime` や :func:`time.gmtime` と同じ署名をもつ関数に設定してく" -"ださい。すべてのフォーマッタインスタンスに対してこれを変更するには、例えば全" -"てのロギング時刻を GMT で表示するには、フォーマッタクラスの ``converter`` 属" -"性を (GMT 表示の ``time.gmtime`` に) 設定してください。" +"フォーマッタは設定可能な関数を使って、レコードの作成時刻をタプルに変換しま" +"す。\n" +"デフォルトでは :func:`time.localtime` が使われます。\n" +"特定のフォーマッタインスタンスで変更するには、その ``converter`` 属性を :" +"func:`time.localtime` または :func:`time.gmtime` と同じシグネチャの関数に設定" +"します。\n" +"すべてのフォーマッタで変更するには、Formatter クラスの ``converter`` 属性を設" +"定します。\n" +"例えば、すべてのログの時刻を GMT で表示するには ``time.gmtime`` に設定しま" +"す。" #: ../../howto/logging.rst:597 msgid "Configuring Logging" @@ -1173,7 +1208,6 @@ msgstr "" "下の例では、Python コードを使って、とても簡単なロガー、コンソールハンドラ、そ" "して簡単なフォーマッタを設定しています::" -#: ../../howto/logging.rst:614 msgid "" "import logging\n" "\n" @@ -1202,6 +1236,32 @@ msgid "" "logger.error('error message')\n" "logger.critical('critical message')" msgstr "" +"import logging\n" +"\n" +"# ロガーを作成する\n" +"logger = logging.getLogger('simple_example')\n" +"logger.setLevel(logging.DEBUG)\n" +"\n" +"# コンソールハンドラーを作成し、レベルを debug に設定する\n" +"ch = logging.StreamHandler()\n" +"ch.setLevel(logging.DEBUG)\n" +"\n" +"# フォーマッターを作成する\n" +"formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - " +"%(message)s')\n" +"\n" +"# ch にフォーマッターを設定する\n" +"ch.setFormatter(formatter)\n" +"\n" +"# ロガーに ch を追加する\n" +"logger.addHandler(ch)\n" +"\n" +"# 「アプリケーション」のコード\n" +"logger.debug('debug message')\n" +"logger.info('info message')\n" +"logger.warning('warn message')\n" +"logger.error('error message')\n" +"logger.critical('critical message')" #: ../../howto/logging.rst:640 msgid "" @@ -1209,7 +1269,6 @@ msgid "" msgstr "" "このモジュールを実行すると、コマンドラインによって以下の出力がなされます:" -#: ../../howto/logging.rst:642 msgid "" "$ python simple_logging_module.py\n" "2005-03-19 15:10:26,618 - simple_example - DEBUG - debug message\n" @@ -1218,6 +1277,12 @@ msgid "" "2005-03-19 15:10:26,697 - simple_example - ERROR - error message\n" "2005-03-19 15:10:26,773 - simple_example - CRITICAL - critical message" msgstr "" +"$ python simple_logging_module.py\n" +"2005-03-19 15:10:26,618 - simple_example - DEBUG - debug message\n" +"2005-03-19 15:10:26,620 - simple_example - INFO - info message\n" +"2005-03-19 15:10:26,695 - simple_example - WARNING - warn message\n" +"2005-03-19 15:10:26,697 - simple_example - ERROR - error message\n" +"2005-03-19 15:10:26,773 - simple_example - CRITICAL - critical message" #: ../../howto/logging.rst:651 msgid "" @@ -1228,7 +1293,6 @@ msgstr "" "以下の Python モジュールは、ロガー、ハンドラ、フォーマッタをほとんど上述の例" "と同じように生成していますが、オブジェクト名だけが異なります::" -#: ../../howto/logging.rst:655 msgid "" "import logging\n" "import logging.config\n" @@ -1245,12 +1309,25 @@ msgid "" "logger.error('error message')\n" "logger.critical('critical message')" msgstr "" +"import logging\n" +"import logging.config\n" +"\n" +"logging.config.fileConfig('logging.conf')\n" +"\n" +"# ロガーを作成する\n" +"logger = logging.getLogger('simpleExample')\n" +"\n" +"# 「アプリケーション」のコード\n" +"logger.debug('debug message')\n" +"logger.info('info message')\n" +"logger.warning('warn message')\n" +"logger.error('error message')\n" +"logger.critical('critical message')" #: ../../howto/logging.rst:670 msgid "Here is the logging.conf file:" msgstr "これが logging.conf ファイルです:" -#: ../../howto/logging.rst:672 msgid "" "[loggers]\n" "keys=root,simpleExample\n" @@ -1280,13 +1357,38 @@ msgid "" "[formatter_simpleFormatter]\n" "format=%(asctime)s - %(name)s - %(levelname)s - %(message)s" msgstr "" +"[loggers]\n" +"keys=root,simpleExample\n" +"\n" +"[handlers]\n" +"keys=consoleHandler\n" +"\n" +"[formatters]\n" +"keys=simpleFormatter\n" +"\n" +"[logger_root]\n" +"level=DEBUG\n" +"handlers=consoleHandler\n" +"\n" +"[logger_simpleExample]\n" +"level=DEBUG\n" +"handlers=consoleHandler\n" +"qualname=simpleExample\n" +"propagate=0\n" +"\n" +"[handler_consoleHandler]\n" +"class=StreamHandler\n" +"level=DEBUG\n" +"formatter=simpleFormatter\n" +"args=(sys.stdout,)\n" +"\n" +"[formatter_simpleFormatter]\n" +"format=%(asctime)s - %(name)s - %(levelname)s - %(message)s" -#: ../../howto/logging.rst:702 msgid "" "The output is nearly identical to that of the non-config-file-based example:" -msgstr "出力は、設定ファイルに基づく例とだいたい同じです:" +msgstr "出力は、設定ファイルを使わない例とほぼ同じです:" -#: ../../howto/logging.rst:704 msgid "" "$ python simple_logging_config.py\n" "2005-03-19 15:38:55,977 - simpleExample - DEBUG - debug message\n" @@ -1295,6 +1397,12 @@ msgid "" "2005-03-19 15:38:56,055 - simpleExample - ERROR - error message\n" "2005-03-19 15:38:56,130 - simpleExample - CRITICAL - critical message" msgstr "" +"$ python simple_logging_config.py\n" +"2005-03-19 15:38:55,977 - simpleExample - DEBUG - debug message\n" +"2005-03-19 15:38:55,979 - simpleExample - INFO - info message\n" +"2005-03-19 15:38:56,054 - simpleExample - WARNING - warn message\n" +"2005-03-19 15:38:56,055 - simpleExample - ERROR - error message\n" +"2005-03-19 15:38:56,130 - simpleExample - CRITICAL - critical message" #: ../../howto/logging.rst:713 msgid "" @@ -1306,7 +1414,6 @@ msgstr "" "プロパティを変えやすくなるという点で、Python コードの方法より少し優れていま" "す。" -#: ../../howto/logging.rst:717 msgid "" "The :func:`fileConfig` function takes a default parameter, " "``disable_existing_loggers``, which defaults to ``True`` for reasons of " @@ -1316,14 +1423,14 @@ msgid "" "configuration. Please refer to the reference documentation for more " "information, and specify ``False`` for this parameter if you wish." msgstr "" -":func:`fileConfig` 関数はデフォルト引数 ``disable_existing_loggers`` を取り、" -"後方互換性のためにデフォルト値は ``True`` になっています。\n" -"これはあなたの望むものかもしれませんし、そうでないかもしれません。というの" -"は、設定で明示的に指定したクラス (もしくはその親クラス) を除いて、 :func:" -"`fileConfig` が呼び出される前に存在した非ルートロガーを無効化してしまうからで" +":func:`fileConfig` 関数の ``disable_existing_loggers`` パラメータは、後方互換" +"性のためデフォルトで ``True`` です。\n" +"この設定が望ましいとは限りません。\n" +"そのロガー自身または祖先ロガーの名前が設定に明記されていない限り、:func:" +"`fileConfig` の呼び出し前から存在するルート以外のロガーが無効になるためで" "す。\n" -"より詳細なことはリファレンスを参照し、望むならこの引数に ``False`` を指定して" -"ください。" +"詳しくはリファレンスを参照し、必要に応じてこのパラメータを ``False`` にしてく" +"ださい。" #: ../../howto/logging.rst:725 msgid "" @@ -1356,7 +1463,6 @@ msgstr "" "るとき、パッケージ ``mypackage`` のモジュール ``mymodule`` で定義されたクラス" "に) ``mypackage.mymodule.MyHandler`` のどちらかが使えます。" -#: ../../howto/logging.rst:743 msgid "" "In Python 3.2, a new means of configuring logging has been introduced, using " "dictionaries to hold configuration information. This provides a superset of " @@ -1370,14 +1476,16 @@ msgid "" "can construct the dictionary in Python code, receive it in pickled form over " "a socket, or use whatever approach makes sense for your application." msgstr "" -"Python 3.2 では、ロギングを設定するのに新しく、辞書に設定情報を持たせる手段が" -"導入されました。これは、上で概説した設定ファイルに基づく方法による機能の上位" -"版を提供し、新しいアプリケーションやデプロイにはこのメソッドが推奨されます。" -"Python の辞書を使って設定情報を保持し、辞書は他の用途にも使えるので、設定の選" -"択肢が広がります。例えば、JSON フォーマットの設定ファイルや、YAML 処理機能が" -"使えれば YAML フォーマットのファイルを使って、設定辞書を構成できます。また、" -"もちろん、Python コードで辞書を構成し、ソケットを通して pickle 化された形式を" -"受け取るなど、アプリケーションで意味があるいかなるやり方でも使えます。" +"Python 3.2 では、設定情報を辞書に保持する新しいロギング設定方法が導入されまし" +"た。\n" +"これは上述の設定ファイル方式の機能をすべて含み、新しいアプリケーションやデプ" +"ロイに推奨される方法です。\n" +"設定を保持する Python の辞書にはさまざまな方法でデータを入れられるため、選択" +"肢が広がります。\n" +"例えば JSON 形式の設定ファイルや、YAML を処理できる環境なら YAML 形式のファイ" +"ルから設定辞書を構築できます。\n" +"Python コードで辞書を作ったり、ソケットで pickle 形式のデータを受け取ったりす" +"るなど、アプリケーションに適した方法を使えます。" #: ../../howto/logging.rst:755 msgid "" @@ -1386,7 +1494,6 @@ msgid "" msgstr "" "以下は、上記と同じ設定を辞書ベースの新しい手法で記載した YAML 形式の例です:" -#: ../../howto/logging.rst:758 msgid "" "version: 1\n" "formatters:\n" @@ -1407,6 +1514,24 @@ msgid "" " level: DEBUG\n" " handlers: [console]" msgstr "" +"version: 1\n" +"formatters:\n" +" simple:\n" +" format: '%(asctime)s - %(name)s - %(levelname)s - %(message)s'\n" +"handlers:\n" +" console:\n" +" class: logging.StreamHandler\n" +" level: DEBUG\n" +" formatter: simple\n" +" stream: ext://sys.stdout\n" +"loggers:\n" +" simpleExample:\n" +" level: DEBUG\n" +" handlers: [console]\n" +" propagate: no\n" +"root:\n" +" level: DEBUG\n" +" handlers: [console]" #: ../../howto/logging.rst:779 msgid "" @@ -1533,11 +1658,12 @@ msgstr "" "ます。ライブラリ *foo* によるすべてのロギングが、 'foo.x', 'foo.x.y' その他に" "該当する名前のロガーによってなされるなら::" -#: ../../howto/logging.rst:841 msgid "" "import logging\n" "logging.getLogger('foo').addHandler(logging.NullHandler())" msgstr "" +"import logging\n" +"logging.getLogger('foo').addHandler(logging.NullHandler())" #: ../../howto/logging.rst:844 msgid "" @@ -1564,7 +1690,6 @@ msgstr "" "するアプリケーション開発者が、ロギングの詳細度 (verbosity) やハンドラを望みの" "とおりに設定することを困難にしたり、不可能にしてしまいます。" -#: ../../howto/logging.rst:855 msgid "" "It is strongly advised that you *do not add any handlers other than* :class:" "`~logging.NullHandler` *to your library's loggers*. This is because the " @@ -1574,12 +1699,14 @@ msgid "" "handlers 'under the hood', you might well interfere with their ability to " "carry out unit tests and deliver logs which suit their requirements." msgstr "" -"*ライブラリのロガーには、* :class:`~logging.NullHandler` *以外のハンドラを追" -"加しない* ことを強く推奨します。これは、ハンドラの設定が、あなたのライブラリ" -"を使うアプリケーション開発者にも伝播するからです。アプリケーション開発者は、" -"対象となる聴衆と、そのアプリケーションにどのハンドラが最も適しているかを知っ" -"ています。ハンドラを 'ボンネットの中で' 加えてしまうと、ユニットテストをして" -"必要に応じたログを送達する能力に干渉しかねません。" +"*ライブラリのロガーには* :class:`~logging.NullHandler` *以外のハンドラを追加" +"しない* ことを強く推奨します。\n" +"ハンドラの設定は、そのライブラリを使うアプリケーション開発者が決めるものだか" +"らです。\n" +"アプリケーション開発者はログの読者や、アプリケーションに最適なハンドラを把握" +"しています。\n" +"ライブラリが内部で勝手にハンドラを追加すると、ユニットテストや、要件に合うロ" +"グの出力を妨げる可能性があります。" #: ../../howto/logging.rst:866 msgid "Logging Levels" @@ -1705,7 +1832,6 @@ msgstr "" msgid "Custom Levels" msgstr "カスタムレベル" -#: ../../howto/logging.rst:926 msgid "" "Defining your own levels is possible, but should not be necessary, as the " "existing levels have been chosen on the basis of practical experience. " @@ -1717,12 +1843,14 @@ msgid "" "difficult for the using developer to control and/or interpret, because a " "given numeric value might mean different things for different libraries." msgstr "" -"独自のレベルを定義することは可能ですが、必須ではなく、実経験上は既存のレベル" -"が選ばれます。しかし、カスタムレベルが必要だと確信するなら、レベルの定義には" -"多大な注意を払うべきで、*ライブラリの開発の際、カスタムレベルを定義することは" -"とても悪いアイデア* になり得ます。これは、複数のライブラリの作者がみな独自の" -"カスタムレベルを定義すると、与えられた数値が異なるライブラリで異なる意味にな" -"りえるため、開発者がこれを制御または解釈するのが難しくなるからです。" +"独自のレベルを定義することはできますが、既存のレベルは実際の経験に基づいて選" +"ばれているため、通常は必要ないはずです。\n" +"それでも必要だと確信する場合は、十分に注意してください。\n" +"特に *ライブラリで独自のレベルを定義するのは、非常によくない考え* かもしれま" +"せん。\n" +"複数のライブラリが独自のレベルを定義すると、同じ数値がライブラリごとに異なる" +"意味を持ち、併用する開発者がログを制御したり解釈したりするのが難しくなる可能" +"性があるためです。" #: ../../howto/logging.rst:939 msgid "Useful Handlers" @@ -1761,13 +1889,12 @@ msgstr "" "ん。代わりに、 :class:`~handlers.RotatingFileHandler` や :class:`~handlers." "TimedRotatingFileHandler` を使用してください。" -#: ../../howto/logging.rst:954 msgid "" ":class:`~handlers.RotatingFileHandler` instances send messages to disk " "files, with support for maximum log file sizes and log file rotation." msgstr "" -":class:`~handlers.RotatingFileHandler` インスタンスは、メッセージをディスク" -"ファイルに送り、最大ログファイル数とログファイル循環をサポートします。" +":class:`~handlers.RotatingFileHandler` インスタンスはメッセージをディスク上の" +"ファイルに送り、ログファイルの最大サイズとローテーションをサポートします。" #: ../../howto/logging.rst:957 msgid "" @@ -1962,7 +2089,6 @@ msgstr "" "ん。 :class:`Handler` サブクラスの :meth:`~Handler.emit` メソッドの間に起こる" "他の例外は、 :meth:`~Handler.handleError` メソッドに渡されます。" -#: ../../howto/logging.rst:1042 msgid "" "The default implementation of :meth:`~Handler.handleError` in :class:" "`Handler` checks to see if a module-level variable, :data:`raiseExceptions`, " @@ -1970,9 +2096,8 @@ msgid "" "the exception is swallowed." msgstr "" ":class:`Handler` の :meth:`~Handler.handleError` のデフォルト実装は、モジュー" -"ルレベル変数 :data:`raiseExceptions` が設定されているかどうかチェックします。" -"設定されているなら、トレースバックが :data:`sys.stderr` に出力されます。設定" -"されていないなら、例外は飲み込まれます。" +"ルレベルの変数 :data:`raiseExceptions` の値を調べます。\n" +"真ならトレースバックを :data:`sys.stderr` に表示し、偽なら例外を無視します。" #: ../../howto/logging.rst:1048 msgid "" @@ -2030,12 +2155,14 @@ msgstr "" "のメソッドは引数にレベルを取って、そのレベルの呼び出しに対して Logger がイベ" "ントを生成するなら true を返します。このようにコードを書くことができます::" -#: ../../howto/logging.rst:1081 msgid "" "if logger.isEnabledFor(logging.DEBUG):\n" " logger.debug('Message with %s, %s', expensive_func1(),\n" " expensive_func2())" msgstr "" +"if logger.isEnabledFor(logging.DEBUG):\n" +" logger.debug('Message with %s, %s', expensive_func1(),\n" +" expensive_func2())" #: ../../howto/logging.rst:1085 msgid "" @@ -2088,15 +2215,15 @@ msgstr "それを避ける方法" msgid "Information about where calls were made from." msgstr "呼び出しがどこから行われたかに関する情報。" -#: ../../howto/logging.rst:1105 msgid "" "Set ``logging._srcfile`` to ``None``. This avoids calling :func:`sys." "_getframe`, which may help to speed up your code in environments like PyPy " "(which can't speed up code that uses :func:`sys._getframe`)." msgstr "" -"``logging._srcfile`` を ``None`` にする。このことにより :func:`sys." -"_getframe` 呼び出しを避けることが出来、PyPy のような環境(:func:`sys." -"_getframe` の高速化が出来ない)において高速化の役に立ちます。" +"``logging._srcfile`` を ``None`` にする。\n" +":func:`sys._getframe` の呼び出しを避けられるため、それを使うコードを高速化で" +"きない PyPy などの環境で、高速化に役立つ可能性があります (:func:`sys." +"_getframe` を使うコードが対象です)。" #: ../../howto/logging.rst:1111 msgid "Threading information." diff --git a/howto/pyporting.po b/howto/pyporting.po index d06accd6e..6c9806638 100644 --- a/howto/pyporting.po +++ b/howto/pyporting.po @@ -16,15 +16,14 @@ msgstr "" "Last-Translator: tomo, 2021\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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/pyporting.rst:7 msgid "How to port Python 2 Code to Python 3" -msgstr "" +msgstr "Python 2 のコードを Python 3 に移植する方法" #: ../../howto/pyporting.rst:0 msgid "author" @@ -34,58 +33,63 @@ msgstr "author" msgid "Brett Cannon" msgstr "Brett Cannon" -#: ../../howto/pyporting.rst:11 msgid "" "Python 2 reached its official end-of-life at the start of 2020. This means " "that no new bug reports, fixes, or changes will be made to Python 2 - it's " "no longer supported: see :pep:`373` and `status of Python versions `_." msgstr "" +"Python 2 の公式サポートは 2020 年の初めに終了しました。\n" +"Python 2 に対する新しいバグ報告の受け付け、修正、変更は行われず、サポートされ" +"ていません。\n" +":pep:`373` と `Python 各バージョンの状況 `_ を参照してください。" -#: ../../howto/pyporting.rst:16 msgid "" "If you are looking to port an extension module instead of pure Python code, " "please see :ref:`cporting-howto`." msgstr "" -"もしあなたが標準 Python ライブラリではなく拡張ライブラリでの移植手段を探して" -"いるならば :ref:`cporting-howto` を参照してください。" +"Python だけで書かれたコードではなく、拡張モジュールを移植する場合は :ref:" +"`cporting-howto` を参照してください。" -#: ../../howto/pyporting.rst:19 msgid "" "The archived python-porting_ mailing list may contain some useful guidance." msgstr "" +"アーカイブされた python-porting_ メーリングリストにも、役立つ情報があるかもし" +"れません。" -#: ../../howto/pyporting.rst:21 msgid "" "Since Python 3.11 the original porting guide was discontinued. You can find " "the old guide in the `archive `_." msgstr "" +"従来の移植ガイドは Python 3.11 から廃止されました。\n" +"以前のガイドは `アーカイブ `_ で読めます。" -#: ../../howto/pyporting.rst:27 msgid "Third-party guides" -msgstr "" +msgstr "サードパーティのガイド" -#: ../../howto/pyporting.rst:29 msgid "There are also multiple third-party guides that might be useful:" -msgstr "" +msgstr "次のようなサードパーティのガイドも参考になります:" -#: ../../howto/pyporting.rst:31 msgid "`Guide by Fedora `_" -msgstr "" +msgstr "`Fedora のガイド `_" -#: ../../howto/pyporting.rst:32 msgid "`PyCon 2020 tutorial `_" msgstr "" +"`PyCon 2020 のチュートリアル `_" -#: ../../howto/pyporting.rst:33 msgid "" "`Guide by DigitalOcean `_" msgstr "" +"`DigitalOcean のガイド `_" -#: ../../howto/pyporting.rst:34 msgid "" "`Guide by ActiveState `_" msgstr "" +"`ActiveState のガイド `_" diff --git a/howto/regex.po b/howto/regex.po index a978948b4..ac64bb7b9 100644 --- a/howto/regex.po +++ b/howto/regex.po @@ -19,10 +19,10 @@ msgstr "" "Last-Translator: Arihiro TAKASE, 2023\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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/regex.rst:5 @@ -94,7 +94,6 @@ msgstr "" "化までは扱いません、それにはマッチングエンジンの内部に対する十分な理解が必要" "だからです。" -#: ../../howto/regex.rst:42 msgid "" "The regular expression language is relatively small and restricted, so not " "all possible string processing tasks can be done using regular expressions. " @@ -104,11 +103,13 @@ msgid "" "be slower than an elaborate regular expression, it will also probably be " "more understandable." msgstr "" -"正規表現言語は相対的に小さく、制限されています、そのため正規表現を使ってあら" -"ゆる文字列処理作業を行なえるわけではありません。正規表現を使って行うことので" -"きる作業もあります、ただ表現はとても複雑なものになります。それらの場合では、" -"Python コードを書いた方がいいでしょう; Python コードは念入りに作られた正規表" -"現より遅くなりますが、おそらくより読み易いでしょう。" +"正規表現の言語は比較的小規模で機能も限られているため、あらゆる文字列処理を正" +"規表現で行えるわけではありません。\n" +"正規表現で処理することは *できても*、その正規表現が非常に複雑になってしまう作" +"業もあります。\n" +"そうした場合は、処理を Python コードで書いた方がよいかもしれません。\n" +"Python コードは工夫を凝らした正規表現より遅くなりますが、おそらく理解しやすく" +"なるでしょう。" #: ../../howto/regex.rst:51 msgid "Simple Patterns" @@ -173,9 +174,8 @@ msgstr "" "ここに特殊文字の完全な一覧があります; これらの意味はこの HOWTO の残りの部分で" "説明します。" -#: ../../howto/regex.rst:79 msgid ". ^ $ * + ? { } [ ] \\ | ( )" -msgstr "" +msgstr ". ^ $ * + ? { } [ ] \\ | ( )" #: ../../howto/regex.rst:83 msgid "" @@ -196,19 +196,18 @@ msgstr "" "ベットのみにマッチしたい場合、 ``[a-z]`` の正規表現をつかうことになるでしょ" "う。" -#: ../../howto/regex.rst:92 msgid "" "Metacharacters (except ``\\``) are not active inside classes. For example, " "``[akm$]`` will match any of the characters ``'a'``, ``'k'``, ``'m'``, or " "``'$'``; ``'$'`` is usually a metacharacter, but inside a character class " "it's stripped of its special nature." msgstr "" -"(``\\`` を除く) 特殊文字は文字クラスの内部では有効になりません。例えば、 " -"``[akm$]`` は ``'a'``, ``'k'``, ``'m'``, または ``'{TX-PL-LABEL}#x27;`` のい" -"ずれかにマッチします; ``'{TX-PL-LABEL}#x27;`` は通常は特殊文字ですが、文字ク" -"ラス内部ではその特別な性質は取り除かれます。" +"文字クラスの内部では、``\\`` を除く特殊文字は特別な意味を持ちません。\n" +"例えば ``[akm$]`` は ``'a'``、``'k'``、``'m'``、``'$'`` のいずれかにマッチし" +"ます。\n" +"``'$'`` は通常は特殊文字ですが、文字クラスの内部ではその特別な意味を失いま" +"す。" -#: ../../howto/regex.rst:97 msgid "" "You can match the characters not listed within the class by :dfn:" "`complementing` the set. This is indicated by including a ``'^'`` as the " @@ -217,12 +216,11 @@ msgid "" "does not have special meaning. For example: ``[5^]`` will match either a " "``'5'`` or a ``'^'``." msgstr "" -":dfn:`補集合を取る` ことで、文字クラス内のリストにない文字に対してマッチさせ" -"られます。\n" -"補集合は、クラスの最初の文字として ``'^'`` を含めることで表せます。\n" -"例えば、 ``[^5]`` は ``'5'`` 以外の文字にマッチします。\n" -"キャレットが文字クラス以外の場所に現れた場合は、特別な意味は持ちません。\n" -"例えば、 ``[5^]`` は ``'5'`` や ``'^'`` にマッチします。" +":dfn:`補集合を取る` と、文字クラスに挙げていない文字にマッチさせられます。\n" +"文字クラスの最初に ``'^'`` を置いて表します。\n" +"例えば ``[^5]`` は ``'5'`` 以外の文字にマッチします。\n" +"キャレットが文字クラス内の先頭以外の位置にあれば、特別な意味はありません。\n" +"例えば ``[5^]`` は ``'5'`` または ``'^'`` にマッチします。" #: ../../howto/regex.rst:103 msgid "" @@ -250,7 +248,6 @@ msgstr "" "``'\\'`` で始まるいくつかの特殊シーケンスは、数字、アルファベット、空白文字以" "外など、よく使う文字集合を表しています。" -#: ../../howto/regex.rst:115 msgid "" "Let's take an example: ``\\w`` matches any alphanumeric character. If the " "regex pattern is expressed in bytes, this is equivalent to the class ``[a-zA-" @@ -260,12 +257,12 @@ msgid "" "in a string pattern by supplying the :const:`re.ASCII` flag when compiling " "the regular expression." msgstr "" -"一つ例をお見せしましょう: ``\\w`` は任意の英数字文字にマッチします。バイト列" -"パターンに対しては、これは文字クラス ``[a-zA-Z0-9_]`` と等価です。ユニコード" -"パターンに対しては、 ``\\w`` は :mod:`unicodedata` モジュールで提供されてい" -"る Unicode データベースで letters としてマークされている全ての文字とマッチし" -"ます。正規表現のコンパイル時に :const:`re.ASCII` フラグを与えることにより、 " -"``\\w`` を、より制限された定義で使うことが出来ます。" +"例えば、``\\w`` は任意の英数字にマッチします。\n" +"バイト列のパターンでは、これは文字クラス ``[a-zA-Z0-9_]`` と同じです。\n" +"文字列のパターンでは、``\\w`` は :mod:`unicodedata` モジュールが提供する " +"Unicode データベースで文字 (letter) とされるすべての文字にマッチします。\n" +"正規表現のコンパイル時に :const:`re.ASCII` フラグを指定すると、\n" +"文字列のパターンでも ``\\w`` のマッチ対象を ``[a-zA-Z0-9_]`` に制限できます。" #: ../../howto/regex.rst:123 msgid "" @@ -285,9 +282,10 @@ msgstr "" msgid "``\\d``" msgstr "``\\d``" -#: ../../howto/regex.rst:131 msgid "Matches any decimal digit; this is equivalent to the class ``[0-9]``." -msgstr "任意の十進数とマッチします; これは集合 ``[0-9]`` と同じ意味です。" +msgstr "" +"任意の十進数字にマッチします。\n" +"文字クラス ``[0-9]`` と同じです。" #: ../../howto/regex.rst:133 msgid "``\\D``" @@ -524,7 +522,6 @@ msgid "" "``'b'``, so it succeeds." msgstr "再び ``b`` を試みる。今回の現在位置の文字は ``'b'`` なので成功。" -#: ../../howto/regex.rst:219 msgid "" "The end of the RE has now been reached, and it has matched ``'abcb'``. This " "demonstrates how the matching engine goes as far as it can at first, and if " @@ -533,13 +530,13 @@ msgid "" "``[bcd]*``, and if that subsequently fails, the engine will conclude that " "the string doesn't match the RE at all." msgstr "" -"正規表現の終端に達して、 ``'abcd'`` にマッチしました。\n" -"この説明は、マッチングエンジンが最初に到達できるところまで進みマッチしなかっ" -"た場合、逐次戻って再度残りの正規表現とのマッチを次々と試みること様子を示して" -"います。\n" -"正規表現エンジンは ``[bcd]*`` の 0 回マッチを試すところまで戻り、その後続の正" -"規表現とのマッチに失敗した場合には、エンジンは正規表現と文字列が完全にマッチ" -"しないと結論づけることになります。" +"これで正規表現の末尾に達し、``'abcb'`` にマッチしました。\n" +"この例が示すように、マッチングエンジンはまず可能な限り先へ進みます。\n" +"マッチしなければ少しずつ後戻りし、残りの正規表現とのマッチを繰り返し試みま" +"す。\n" +"``[bcd]*`` が 0 回マッチする場合まで後戻りしても残りの正規表現がマッチしなけ" +"れば、\n" +"その文字列はこの正規表現にマッチしないと判断します。" #: ../../howto/regex.rst:226 msgid "" @@ -594,11 +591,13 @@ msgstr "" "的な値が仮定されます。\n" "*m* の省略は下限は 0 と解釈され、*n* の省略は上限は無限として解釈されます。" -#: ../../howto/regex.rst:248 msgid "" "The simplest case ``{m}`` matches the preceding item exactly *m* times. For " "example, ``a/{2}b`` will only match ``'a//b'``." msgstr "" +"最も単純な ``{m}`` は、直前の要素のちょうど *m* 回の繰り返しにマッチしま" +"す。\n" +"例えば ``a/{2}b`` は ``'a//b'`` だけにマッチします。" #: ../../howto/regex.rst:251 msgid "" @@ -643,27 +642,28 @@ msgstr "" "くの操作、パターンマッチの検索や文字列の置換の実行などのメソッドを持っていま" "す。 ::" -#: ../../howto/regex.rst:274 msgid "" ">>> import re\n" ">>> p = re.compile('ab*')\n" ">>> p\n" "re.compile('ab*')" msgstr "" +">>> import re\n" +">>> p = re.compile('ab*')\n" +">>> p\n" +"re.compile('ab*')" -#: ../../howto/regex.rst:279 msgid "" ":func:`re.compile` also accepts an optional *flags* argument, used to enable " "various special features and syntax variations. We'll go over the available " "settings later, but for now a single example will do::" msgstr "" -":func:`re.compile` はいくつかの *flags* 引数を受け付けることができます、この" -"引数はさまざまな特別な機能を有効にしたり、構文を変化させたりします。利用でき" -"る設定に何があるかは後に飛ばすことにして、簡単な例をやることにしましょう::" +":func:`re.compile` は省略可能な *flags* 引数も受け取ります。\n" +"さまざまな機能や構文上の違いを有効にするための引数です。\n" +"利用できる設定は後で説明しますが、まずは一つ例を見てみましょう。 ::" -#: ../../howto/regex.rst:283 msgid ">>> p = re.compile('ab*', re.IGNORECASE)" -msgstr "" +msgstr ">>> p = re.compile('ab*', re.IGNORECASE)" #: ../../howto/regex.rst:285 msgid "" @@ -806,9 +806,8 @@ msgstr "" msgid "Regular String" msgstr "通常の文字列" -#: ../../howto/regex.rst:344 msgid "Raw string" -msgstr "Raw string" +msgstr "raw 文字列" #: ../../howto/regex.rst:346 msgid "``\"ab*\"``" @@ -905,11 +904,10 @@ msgstr "" "返します。このオブジェクトにはマッチした情報が含まれます: マッチの開始と終了" "位置、マッチした部分文字列、など。" -#: ../../howto/regex.rst:383 msgid "" "You can learn about this by interactively experimenting with the :mod:`re` " "module." -msgstr "" +msgstr ":mod:`re` モジュールを対話的に試すと理解が深まります。" #: ../../howto/regex.rst:386 msgid "" @@ -920,13 +918,16 @@ msgstr "" "ンタプリタを起動して、 :mod:`re` モジュールをインポートし、正規表現をコンパイ" "ルします::" -#: ../../howto/regex.rst:389 msgid "" ">>> import re\n" ">>> p = re.compile('[a-z]+')\n" ">>> p\n" "re.compile('[a-z]+')" msgstr "" +">>> import re\n" +">>> p = re.compile('[a-z]+')\n" +">>> p\n" +"re.compile('[a-z]+')" #: ../../howto/regex.rst:394 msgid "" @@ -1013,7 +1014,6 @@ msgstr "マッチの位置 (start, end) を含むタプルを返す" msgid "Trying these methods will soon clarify their meaning::" msgstr "これらのメソッドを試せば、その意味はすぐに理解できます::" -#: ../../howto/regex.rst:431 msgid "" ">>> m.group()\n" "'tempo'\n" @@ -1022,6 +1022,12 @@ msgid "" ">>> m.span()\n" "(0, 5)" msgstr "" +">>> m.group()\n" +"'tempo'\n" +">>> m.start(), m.end()\n" +"(0, 5)\n" +">>> m.span()\n" +"(0, 5)" #: ../../howto/regex.rst:438 msgid "" @@ -1084,12 +1090,14 @@ msgstr "" "ります。\n" ":meth:`~re.Pattern.findall` はマッチした文字列のリストを返します::" -#: ../../howto/regex.rst:469 msgid "" ">>> p = re.compile(r'\\d+')\n" ">>> p.findall('12 drummers drumming, 11 pipers piping, 10 lords a-leaping')\n" "['12', '11', '10']" msgstr "" +">>> p = re.compile(r'\\d+')\n" +">>> p.findall('12 drummers drumming, 11 pipers piping, 10 lords a-leaping')\n" +"['12', '11', '10']" #: ../../howto/regex.rst:473 msgid "" @@ -1117,7 +1125,6 @@ msgstr "" "ト ` インスタンスのシーケンスを :term:`iterator` として返しま" "す::" -#: ../../howto/regex.rst:483 msgid "" ">>> iterator = p.finditer('12 drummers drumming, 11 ... 10 ...')\n" ">>> iterator\n" @@ -1129,6 +1136,15 @@ msgid "" "(22, 24)\n" "(29, 31)" msgstr "" +">>> iterator = p.finditer('12 drummers drumming, 11 ... 10 ...')\n" +">>> iterator\n" +"\n" +">>> for match in iterator:\n" +"... print(match.span())\n" +"...\n" +"(0, 2)\n" +"(22, 24)\n" +"(29, 31)" #: ../../howto/regex.rst:495 msgid "Module-Level Functions" @@ -1277,7 +1293,6 @@ msgstr "" "冗長な正規表現を利用できるようにして、よりきれいで理解しやすくまとめることが" "できます。" -#: ../../howto/regex.rst:563 msgid "" "Perform case-insensitive matching; character class and literal strings will " "match letters by ignoring case. For example, ``[A-Z]`` will match lowercase " @@ -1293,17 +1308,19 @@ msgid "" "also set the :const:`LOCALE` flag." msgstr "" "大文字と小文字を区別しないマッチングを実行します; 文字クラスと文字列リテラル" -"は大文字か小文字かに関係なくパターンにマッチします。例えば、 ``[A-Z]`` は小文" -"字のアルファベットにもマッチします。 :const:`ASCII` フラグによって非 ASCII 文" -"字のマッチングが無効化されていなければ、完全なユニコードのマッチングも可能で" -"す。ユニコードで ``[a-z]`` または ``[A-Z]`` が :const:`IGNORECASE` フラグとと" -"もに使われると、 52個の ASCII 文字に加えて 次の4つの 非 ASCII 文字にマッチし" -"ます: 'İ' (U+0130, ラテン語の大文字 I で、上部に点がついたもの), " -"'ı' (U+0131, ラテン語の小文字 i で上部に点がない), 'ſ' (U+017F, ラテン語の小" -"文字 s), 'K' (U+212A, ケルビン記号)。 ``Spam`` は ``'Spam'``, ``'spam'``, " -"``'spAM'``, そして ``'ſpam'`` にマッチします (ただし最後の文字列はユニコード" -"モードの場合のみマッチします)。この「小文字化」は現在のロケールを考慮しませ" -"ん; ただし :const:`LOCALE` フラグをセットした場合はロケールを考慮します。" +"は大文字か小文字かに関係なくパターンにマッチします。\n" +"例えば、 ``[A-Z]`` は小文字のアルファベットにもマッチします。\n" +":const:`ASCII` フラグによって非 ASCII 文字のマッチングが無効化されていなけれ" +"ば、完全なユニコードのマッチングも可能です。\n" +"ユニコードで ``[a-z]`` または ``[A-Z]`` が :const:`IGNORECASE` フラグとともに" +"使われると、 52個の ASCII 文字に加えて 次の4つの 非 ASCII 文字にマッチしま" +"す: 'İ' (U+0130, ラテン語の大文字 I で、上部に点がついたもの), 'ı' (U+0131, " +"ラテン語の小文字 i で上部に点がない), 'ſ' (U+017F, ラテン文字の小文字の長い " +"s), 'K' (U+212A, ケルビン記号)。\n" +"``Spam`` は ``'Spam'``, ``'spam'``, ``'spAM'``, そして ``'ſpam'`` にマッチし" +"ます (ただし最後の文字列はユニコードモードの場合のみマッチします)。\n" +"この「小文字化」は現在のロケールを考慮しません; ただし :const:`LOCALE` フラグ" +"をセットした場合はロケールを考慮します。" #: ../../howto/regex.rst:581 msgid "" @@ -1313,7 +1330,6 @@ msgstr "" "``\\w``, ``\\W``, ``\\b``, ``\\B`` と小文字大文字の区別を無視したマッチング" "を、 Unicode データベースではなく現在のロケールに従って行います。" -#: ../../howto/regex.rst:584 msgid "" "Locales are a feature of the C library intended to help in writing programs " "that take account of language differences. For example, if you're " @@ -1346,7 +1362,7 @@ msgstr "" "\"文化\" しか扱うことができず、また8ビットのロケールでしか正しく動作しないか" "らです。Python 3 ではユニコード (文字列の) パターンに対してユニコードのマッチ" "ングがデフォルトで有効化されており、これにより異なるロケールまたは言語を同時" -"に扱うことができます。 " +"に扱うことができます。" #: ../../howto/regex.rst:606 msgid "" @@ -1416,7 +1432,6 @@ msgstr "" "例えば、ここに :const:`re.VERBOSE` を利用した正規表現があります; 読み易いと思" "いませんか? ::" -#: ../../howto/regex.rst:651 msgid "" "charref = re.compile(r\"\"\"\n" " &[#] # Start of a numeric entity reference\n" @@ -1428,17 +1443,28 @@ msgid "" " ; # Trailing semicolon\n" "\"\"\", re.VERBOSE)" msgstr "" +"charref = re.compile(r\"\"\"\n" +" &[#] # Start of a numeric entity reference\n" +" (\n" +" 0[0-7]+ # Octal form\n" +" | [0-9]+ # Decimal form\n" +" | x[0-9a-fA-F]+ # Hexadecimal form\n" +" )\n" +" ; # Trailing semicolon\n" +"\"\"\", re.VERBOSE)" #: ../../howto/regex.rst:661 msgid "Without the verbose setting, the RE would look like this::" msgstr "冗長な表現を利用しない設定の場合、正規表現はこうなります::" -#: ../../howto/regex.rst:663 msgid "" "charref = re.compile(\"&#(0[0-7]+\"\n" " \"|[0-9]+\"\n" " \"|x[0-9a-fA-F]+);\")" msgstr "" +"charref = re.compile(\"&#(0[0-7]+\"\n" +" \"|[0-9]+\"\n" +" \"|x[0-9a-fA-F]+);\")" #: ../../howto/regex.rst:667 msgid "" @@ -1476,7 +1502,6 @@ msgstr "" "これまでで、まだ扱っていない特殊文字がいくつかありました。そのほとんどをこの" "節で扱っていきます。" -#: ../../howto/regex.rst:688 msgid "" "Some of the remaining metacharacters to be discussed are :dfn:`zero-width " "assertions`. They don't cause the engine to advance through the string; " @@ -1487,12 +1512,12 @@ msgid "" "once at a given location, they can obviously be matched an infinite number " "of times." msgstr "" -"残りの特殊文字の内いくつかは :dfn:`ゼロ幅アサーション zero-width-assertions` " -"に関するものです。これらは文字列に対してエンジンを進めません; 文字列を全く利" -"用しない代わりに、単純に成功か失敗かを利用します。例えば、 ``\\b`` は現在位置" -"が単語の境界であることを示します; ``\\b`` によってエンジンの読んでいる位置は" -"全く変化しません。つまり、これはゼロ幅アサーションは繰り返し使うことがありま" -"せん、一度ある位置でマッチしたら、明らかに無限回マッチできます。" +"残りの特殊文字には :dfn:`ゼロ幅アサーション` があります。\n" +"これは文字を一つも消費せず、成功か失敗かを判定するだけなので、エンジンが文字" +"列内を進むことはありません。\n" +"例えば ``\\b`` は現在位置が単語の境界であることを判定し、位置を変えません。\n" +"ゼロ幅アサーションは繰り返すべきではありません。\n" +"ある位置で一度マッチすれば、そこで何度でもマッチできてしまうためです。" #: ../../howto/regex.rst:696 msgid "``|``" @@ -1545,13 +1570,16 @@ msgstr "" "例えば、行の先頭の ``From`` にのみマッチさせたい場合には ``^From`` 正規表現を" "利用します。 ::" -#: ../../howto/regex.rst:714 msgid "" ">>> print(re.search('^From', 'From Here to Eternity'))\n" "\n" ">>> print(re.search('^From', 'Reciting From Memory'))\n" "None" msgstr "" +">>> print(re.search('^From', 'From Here to Eternity'))\n" +"\n" +">>> print(re.search('^From', 'Reciting From Memory'))\n" +"None" #: ../../howto/regex.rst:719 msgid "To match a literal ``'^'``, use ``\\^``." @@ -1569,7 +1597,6 @@ msgstr "" "行の末尾にマッチします、行の末尾は文字列の末尾と改行文字の直前として定義され" "ます。 ::" -#: ../../howto/regex.rst:725 msgid "" ">>> print(re.search('}$', '{block}'))\n" "\n" @@ -1578,6 +1605,12 @@ msgid "" ">>> print(re.search('}$', '{block}\\n'))\n" "" msgstr "" +">>> print(re.search('}$', '{block}'))\n" +"\n" +">>> print(re.search('}$', '{block} '))\n" +"None\n" +">>> print(re.search('}$', '{block}\\n'))\n" +"" #: ../../howto/regex.rst:732 msgid "" @@ -1604,9 +1637,8 @@ msgstr "" "いは: ``\\A`` は依然として文字列の先頭にのみマッチしますが、 ``^`` は文字列内" "に改行文字に続く部分があればそこにマッチすることです。" -#: ../../howto/regex.rst:741 msgid "``\\z``" -msgstr "" +msgstr "``\\z``" #: ../../howto/regex.rst:742 msgid "Matches only at the end of the string." @@ -1616,9 +1648,10 @@ msgstr "文字列の末尾でのみマッチします。" msgid "``\\Z``" msgstr "``\\Z``" -#: ../../howto/regex.rst:745 msgid "The same as ``\\z``. For compatibility with old Python versions." msgstr "" +"``\\z`` と同じです。\n" +"古い Python バージョンとの互換性のためにあります。" #: ../../howto/regex.rst:747 msgid "``\\b``" @@ -1643,7 +1676,6 @@ msgstr "" "以下の例では ``class`` がそのものの単語のときのみマッチします; 別の単語内に含" "まれている場合はマッチしません。 ::" -#: ../../howto/regex.rst:756 msgid "" ">>> p = re.compile(r'\\bclass\\b')\n" ">>> print(p.search('no class at all'))\n" @@ -1653,6 +1685,13 @@ msgid "" ">>> print(p.search('one subclass is'))\n" "None" msgstr "" +">>> p = re.compile(r'\\bclass\\b')\n" +">>> print(p.search('no class at all'))\n" +"\n" +">>> print(p.search('the declassified algorithm'))\n" +"None\n" +">>> print(p.search('one subclass is'))\n" +"None" #: ../../howto/regex.rst:764 msgid "" @@ -1672,7 +1711,6 @@ msgstr "" "じ正規表現のように見えますが、正規表現文字列の前の ``'r'`` が省略されていま" "す。 ::" -#: ../../howto/regex.rst:772 msgid "" ">>> p = re.compile('\\bclass\\b')\n" ">>> print(p.search('no class at all'))\n" @@ -1680,6 +1718,11 @@ msgid "" ">>> print(p.search('\\b' + 'class' + '\\b'))\n" "" msgstr "" +">>> p = re.compile('\\bclass\\b')\n" +">>> print(p.search('no class at all'))\n" +"None\n" +">>> print(p.search('\\b' + 'class' + '\\b'))\n" +"" #: ../../howto/regex.rst:778 msgid "" @@ -1720,13 +1763,16 @@ msgstr "" "て興味ある部分にマッチするようにして、文字列を分割するのに使われます。例え" "ば、RFC-822 ヘッダ行は ``':'`` を挟んでこのようにヘッダ名と値に分割されます:" -#: ../../howto/regex.rst:796 msgid "" "From: author@example.com\n" "User-Agent: Thunderbird 1.5.0.9 (X11/20061227)\n" "MIME-Version: 1.0\n" "To: editor@example.com" msgstr "" +"From: author@example.com\n" +"User-Agent: Thunderbird 1.5.0.9 (X11/20061227)\n" +"MIME-Version: 1.0\n" +"To: editor@example.com" #: ../../howto/regex.rst:803 msgid "" @@ -1818,11 +1864,12 @@ msgstr "" ":meth:`~re.Match.group` には一回に複数の引数を渡してもかまいません、その場合" "にはそれらのグループに対応する値を含むタプルを返します。 ::" -#: ../../howto/regex.rst:850 msgid "" ">>> m.group(2,1,2)\n" "('b', 'abc', 'b')" msgstr "" +">>> m.group(2,1,2)\n" +"('b', 'abc', 'b')" #: ../../howto/regex.rst:853 msgid "" @@ -1832,11 +1879,12 @@ msgstr "" ":meth:`~re.Match.groups` メソッドは 1 から全てのサブグループの文字列を含むタ" "プルを返します。::" -#: ../../howto/regex.rst:856 msgid "" ">>> m.groups()\n" "('abc', 'b')" msgstr "" +">>> m.groups()\n" +"('abc', 'b')" #: ../../howto/regex.rst:859 msgid "" @@ -1859,12 +1907,14 @@ msgstr "" msgid "For example, the following RE detects doubled words in a string. ::" msgstr "例えば、以下の正規表現は二重になった単語を検出します。 ::" -#: ../../howto/regex.rst:869 msgid "" ">>> p = re.compile(r'\\b(\\w+)\\s+\\1\\b')\n" ">>> p.search('Paris in the the spring').group()\n" "'the the'" msgstr "" +">>> p = re.compile(r'\\b(\\w+)\\s+\\1\\b')\n" +">>> p.search('Paris in the the spring').group()\n" +"'the the'" #: ../../howto/regex.rst:873 msgid "" @@ -1895,7 +1945,6 @@ msgstr "" "なっていきます。この問題の解決を助ける二つの機能があります。その両方が正規表" "現を拡張するための一般的な構文を利用します、まずはそれらをみてみましょう。" -#: ../../howto/regex.rst:887 msgid "" "Perl 5 is well known for its powerful additions to standard regular " "expressions. For these new features the Perl developers couldn't choose new " @@ -1905,13 +1954,12 @@ msgid "" "expressions would be assuming that ``&`` was a regular character and " "wouldn't have escaped it by writing ``\\&`` or ``[&]``." msgstr "" -"Perl 5 は標準正規表現にパワフルな拡張を加えたことでよく知られています。それら" -"の新しい機能のために Perl 開発者たちは、Perl正規表現と標準正規表現との混乱を" -"招く違いなしには、新たな一文字メタキャラクタも ``\\`` ではじまる新たな特殊" -"シーケンスもどちらも選択出来ませんでした。たとえば彼らがもし ``&`` を新たなメ" -"タキャラクタとして選んでいたら、 ``&`` が通常文字とみなされていた古い正規表現" -"は ``\\&`` や ``[&]`` のように書くことでエスケープされなければならなかったで" -"しょう。" +"Perl 5 は、標準的な正規表現への強力な拡張でよく知られています。\n" +"新機能のために一文字のメタ文字や ``\\`` で始まる特殊シーケンスを追加すると、" +"標準的な正規表現との違いが混乱を招くため、Perl の開発者はそれらを選べませんで" +"した。\n" +"例えば ``&`` を新しいメタ文字にしたとすると、従来の式では ``&`` を通常の文字" +"として扱っているため、``\\&`` や ``[&]`` としてエスケープしていないはずです。" #: ../../howto/regex.rst:894 msgid "" @@ -1970,7 +2018,6 @@ msgid "" "()" msgstr "" -#: ../../howto/regex.rst:922 msgid "" "Except for the fact that you can't retrieve the contents of what the group " "matched, a non-capturing group behaves exactly the same as a capturing " @@ -1982,14 +2029,14 @@ msgid "" "performance difference in searching between capturing and non-capturing " "groups; neither form is any faster than the other." msgstr "" -"マッチしたグループの内容を取得しないということを除けば、取り込まないグループ" -"は厳密に取り込むグループと同様に振る舞います; この中に何を入れてもかまいませ" -"ん、 ``*`` のような繰り返しの特殊文字で繰り返したり、他のグループ (取り込むま" -"たは取り込まない) の入れ子にすることもでいます。 ``(?:...)`` は特に、既にある" -"パターンを変更する際に便利です、なぜなら他の番号づけ新しいグループを変更する" -"ことなく新しいグループを追加することができます。取り込むグループと取り込まな" -"いグループで検索のパフォーマンスに差がないことにも触れておくべきことです; ど" -"ちらも同じ速度で動作します。" +"取り込まないグループは、マッチした内容を取得できない点以外は、取り込むグルー" +"プと同じように動作します。\n" +"中に任意の正規表現を置いたり、``*`` などの特殊文字で繰り返したり、他のグルー" +"プ (取り込むものも取り込まないものも) の中に入れ子にしたりできます。\n" +"``(?:...)`` は既存のパターンを変更するときに特に便利です。\n" +"他のグループの番号を変えずに、新しいグループを追加できます。\n" +"なお、検索時の性能はどちらのグループでも変わらず、片方が速いということはあり" +"ません。" #: ../../howto/regex.rst:931 msgid "" @@ -2018,7 +2065,6 @@ msgstr "" "容しています。名前つきグループにも番号が振られますので、グループについての情" "報を、2つの方法で取り出せます::" -#: ../../howto/regex.rst:942 msgid "" ">>> p = re.compile(r'(?P\\b\\w+\\b)')\n" ">>> m = p.search( '(((( Lots of punctuation )))' )\n" @@ -2027,6 +2073,12 @@ msgid "" ">>> m.group(1)\n" "'Lots'" msgstr "" +">>> p = re.compile(r'(?P\\b\\w+\\b)')\n" +">>> m = p.search( '(((( Lots of punctuation )))' )\n" +">>> m.group('word')\n" +"'Lots'\n" +">>> m.group(1)\n" +"'Lots'" #: ../../howto/regex.rst:949 msgid "" @@ -2053,7 +2105,6 @@ msgstr "" "め、便利です。以下は :mod:`imaplib` モジュールで使われている正規表現の例で" "す::" -#: ../../howto/regex.rst:960 msgid "" "InternalDate = re.compile(r'INTERNALDATE \"'\n" " r'(?P[ 123][0-9])-(?P[A-Z][a-z][a-z])-'\n" @@ -2062,6 +2113,12 @@ msgid "" " r' (?P[-+])(?P[0-9][0-9])(?P[0-9][0-9])'\n" " r'\"')" msgstr "" +"InternalDate = re.compile(r'INTERNALDATE \"'\n" +" r'(?P[ 123][0-9])-(?P[A-Z][a-z][a-z])-'\n" +" r'(?P[0-9][0-9][0-9][0-9])'\n" +" r' (?P[0-9][0-9]):(?P[0-9][0-9]):(?P[0-9][0-9])'\n" +" r' (?P[-+])(?P[0-9][0-9])(?P[0-9][0-9])'\n" +" r'\"')" #: ../../howto/regex.rst:967 msgid "" @@ -2088,12 +2145,14 @@ msgstr "" "同じ単語が2つ連なっているのを見つける正規表現 ``\\b(\\w+)\\s+\\1\\b`` は " "``\\b(?P\\w+)\\s+(?P=word)\\b`` のように書けます::" -#: ../../howto/regex.rst:977 msgid "" ">>> p = re.compile(r'\\b(?P\\w+)\\s+(?P=word)\\b')\n" ">>> p.search('Paris in the the spring').group()\n" "'the the'" msgstr "" +">>> p = re.compile(r'\\b(?P\\w+)\\s+(?P=word)\\b')\n" +">>> p.search('Paris in the the spring').group()\n" +"'the the'" #: ../../howto/regex.rst:983 msgid "Lookahead Assertions" @@ -2112,7 +2171,6 @@ msgstr "" msgid "``(?=...)``" msgstr "``(?=...)``" -#: ../../howto/regex.rst:989 msgid "" "Positive lookahead assertion. This succeeds if the contained regular " "expression, represented here by ``...``, successfully matches at the current " @@ -2120,9 +2178,11 @@ msgid "" "tried, the matching engine doesn't advance at all; the rest of the pattern " "is tried right where the assertion started." msgstr "" -"肯定先読みアサーション。 ``...`` で表わす正規表現が現在位置でマッチすれば成功" -"し、それ以外の場合失敗します。しかし、表現が試行された場合でもエンジンは先に" -"進みません; パターンの残りの部分はアサーションの開始時点から右に試行します。" +"肯定先読みアサーションです。\n" +"ここで ``...`` と表している内部の正規表現が現在位置でマッチすれば成功し、それ" +"以外は失敗します。\n" +"内部の正規表現を試してもマッチングエンジンの位置は進みません。\n" +"残りのパターンは、アサーションを開始したのとまったく同じ位置から試されます。" #: ../../howto/regex.rst:995 msgid "``(?!...)``" @@ -2194,7 +2254,6 @@ msgstr "" msgid "``.*[.]([^b]..|.[^a].|..[^t])$``" msgstr "``.*[.]([^b]..|.[^a].|..[^t])$``" -#: ../../howto/regex.rst:1025 msgid "" "The expression gets messier when you try to patch up the first solution by " "requiring one of the following cases to match: the first character of the " @@ -2204,12 +2263,13 @@ msgid "" "with a two-letter extension such as ``sendmail.cf``. We'll complicate the " "pattern again in an effort to fix it." msgstr "" -"正規表現が混乱してきました。最初の解決策を取り繕って、以下の場合に合わせるこ" -"とを要求しています: 拡張子の最初の文字は ``b`` でなく; 二番目の文字は ``a`` " -"でなく; 三番目の文字は ``t`` でない。これは ``foo.bar`` を受け付けますが、 " -"``autoexec.bat`` は拒否します。しかし、三文字の拡張子を要求し、 ``sendmail." -"cf`` のような二文字の拡張子を受け付けません。これを修正するのにパターンを再び" -"複雑にすることになります。" +"最初の試みを修正し、拡張子の最初の文字が ``b`` でない、二文字目が ``a`` でな" +"い、三文字目が ``t`` でない、のいずれかを満たすようにすると、正規表現は複雑に" +"なります。\n" +"これなら ``foo.bar`` を受け入れ、``autoexec.bat`` を除外できます。\n" +"しかし拡張子が三文字であることを要求するため、``sendmail.cf`` のような二文字" +"の拡張子は受け入れられません。\n" +"これを修正すると、パターンはさらに複雑になります。" #: ../../howto/regex.rst:1033 msgid "``.*[.]([^b].?.?|.[^a]?.?|..?[^t]?)$``" @@ -2316,7 +2376,6 @@ msgstr "" msgid "Splitting Strings" msgstr "文字列の分割" -#: ../../howto/regex.rst:1085 msgid "" "The :meth:`~re.Pattern.split` method of a pattern splits a string apart " "wherever the RE matches, returning a list of the pieces. It's similar to " @@ -2325,11 +2384,12 @@ msgid "" "splitting by whitespace or by a fixed string. As you'd expect, there's a " "module-level :func:`re.split` function, too." msgstr "" -":meth:`~re.Match.split` メソッドは文字列を正規表現にマッチした場所で分割し、" -"リストで返却します。文字列の :meth:`~str.split` メソッドに似てはいますが、" -"もっとずっと一般化したデリミタで分割出来ます; 文字列の :meth:`!split` メソッ" -"ドは単に空白文字か固定文字列で分割出来るだけです。ご想像通り、モジュールレベ" -"ルの :func:`re.split` 関数もあります。" +"パターンの :meth:`~re.Pattern.split` メソッドは、正規表現がマッチする箇所で文" +"字列を分割し、各部分のリストを返します。\n" +"文字列の :meth:`~str.split` に似ていますが、区切りの指定にはずっと自由度があ" +"ります。\n" +"文字列の :meth:`!split` は空白か固定文字列でしか分割できません。\n" +"モジュールレベルの :func:`re.split` 関数もあります。" #: ../../howto/regex.rst:1096 msgid "" @@ -2342,7 +2402,6 @@ msgstr "" "されている場合、その内容も結果のリストの一部として返されます。 *maxsplit* が" "非ゼロの場合、最大で *maxsplit* の分割が実行されます。" -#: ../../howto/regex.rst:1101 msgid "" "You can limit the number of splits made, by passing a value for *maxsplit*. " "When *maxsplit* is nonzero, at most *maxsplit* splits will be made, and the " @@ -2350,12 +2409,11 @@ msgid "" "the following example, the delimiter is any sequence of non-alphanumeric " "characters. ::" msgstr "" -"*maxsplit* に値を渡すことで、分割される回数を制限することができます。 " -"*maxsplit* が非ゼロの場合、最大で *maxsplit* の分割が行なわれ、文字列の残りが" -"リストの最終要素として返されます。以下の例では、デリミタは任意の英数文字の" -"シーケンスです。 ::" +"*maxsplit* に値を渡すと、分割回数を制限できます。\n" +"*maxsplit* がゼロでなければ最大でその回数だけ分割し、残りの文字列をリストの最" +"後の要素として返します。\n" +"次の例では、英数字以外の文字が連続する部分が区切りになります。 ::" -#: ../../howto/regex.rst:1107 msgid "" ">>> p = re.compile(r'\\W+')\n" ">>> p.split('This is a test, short and sweet, of split().')\n" @@ -2363,6 +2421,11 @@ msgid "" ">>> p.split('This is a test, short and sweet, of split().', 3)\n" "['This', 'is', 'a', 'test, short and sweet, of split().']" msgstr "" +">>> p = re.compile(r'\\W+')\n" +">>> p.split('This is a test, short and sweet, of split().')\n" +"['This', 'is', 'a', 'test', 'short', 'and', 'sweet', 'of', 'split', '']\n" +">>> p.split('This is a test, short and sweet, of split().', 3)\n" +"['This', 'is', 'a', 'test, short and sweet, of split().']" #: ../../howto/regex.rst:1113 msgid "" @@ -2375,7 +2438,6 @@ msgstr "" "知りたい場合はよくあります。取りこみ用の括弧を正規表現に使った場合、その値も" "リストの一部として返されます。以下の呼び出しを比較してみましょう::" -#: ../../howto/regex.rst:1118 msgid "" ">>> p = re.compile(r'\\W+')\n" ">>> p2 = re.compile(r'(\\W+)')\n" @@ -2384,6 +2446,12 @@ msgid "" ">>> p2.split('This... is a test.')\n" "['This', '... ', 'is', ' ', 'a', ' ', 'test', '.', '']" msgstr "" +">>> p = re.compile(r'\\W+')\n" +">>> p2 = re.compile(r'(\\W+)')\n" +">>> p.split('This... is a test.')\n" +"['This', 'is', 'a', 'test', '']\n" +">>> p2.split('This... is a test.')\n" +"['This', '... ', 'is', ' ', 'a', ' ', 'test', '.', '']" #: ../../howto/regex.rst:1125 msgid "" @@ -2393,7 +2461,6 @@ msgstr "" "モジュールレベル関数 :func:`re.split` は最初の引数に利用する正規表現を追加し" "ますが、それ以外は同じです。 ::" -#: ../../howto/regex.rst:1128 msgid "" ">>> re.split(r'[\\W]+', 'Words, words, words.')\n" "['Words', 'words', 'words', '']\n" @@ -2402,32 +2469,36 @@ msgid "" ">>> re.split(r'[\\W]+', 'Words, words, words.', 1)\n" "['Words', 'words, words.']" msgstr "" +">>> re.split(r'[\\W]+', 'Words, words, words.')\n" +"['Words', 'words', 'words', '']\n" +">>> re.split(r'([\\W]+)', 'Words, words, words.')\n" +"['Words', ', ', 'words', ', ', 'words', '.', '']\n" +">>> re.split(r'[\\W]+', 'Words, words, words.', 1)\n" +"['Words', 'words, words.']" #: ../../howto/regex.rst:1137 msgid "Search and Replace" msgstr "検索と置換" -#: ../../howto/regex.rst:1139 msgid "" "Another common task is to find all the matches for a pattern, and replace " "them with a different string. The :meth:`~re.Pattern.sub` method takes a " "replacement value, which can be either a string or a function, and the " "string to be processed." msgstr "" -"もう一つのよくある作業は、パターンにマッチする全ての文字列を探し、異なる文字" -"列に置換します。\n" -":meth:`~re.Pattern.sub` メソッドは置換する値をとります、文字列と関数の両方を" -"とることができ、文字列を処理します。" +"パターンにマッチする部分をすべて探し、別の文字列に置き換えることもよくある作" +"業です。\n" +":meth:`~re.Pattern.sub` は、置換する値 (文字列または関数) と、処理対象の文字" +"列を受け取ります。" -#: ../../howto/regex.rst:1146 msgid "" "Returns the string obtained by replacing the leftmost non-overlapping " "occurrences of the RE in *string* by the replacement *replacement*. If the " "pattern isn't found, *string* is returned unchanged." msgstr "" -"*string* 内で最も長く、他の部分と重複するところがない正規表現を " -"*replacement* に置換した文字列を返します。パターンが見つからなかった場合 " -"*string* は変更されずに返されます。" +"*string* 内で正規表現にマッチする、互いに重ならない部分を左から順に " +"*replacement* に置き換えた文字列を返します。\n" +"パターンが見つからなければ *string* をそのまま返します。" #: ../../howto/regex.rst:1150 msgid "" @@ -2447,7 +2518,6 @@ msgstr "" "ここに :meth:`~re.Pattern.sub` メソッドを使った単純な例があります。これは色の" "名前を ``colour`` に置換します::" -#: ../../howto/regex.rst:1157 msgid "" ">>> p = re.compile('(blue|white|red)')\n" ">>> p.sub('colour', 'blue socks and red shoes')\n" @@ -2455,6 +2525,11 @@ msgid "" ">>> p.sub('colour', 'blue socks and red shoes', count=1)\n" "'colour socks and red shoes'" msgstr "" +">>> p = re.compile('(blue|white|red)')\n" +">>> p.sub('colour', 'blue socks and red shoes')\n" +"'colour socks and colour shoes'\n" +">>> p.sub('colour', 'blue socks and red shoes', count=1)\n" +"'colour socks and red shoes'" #: ../../howto/regex.rst:1163 msgid "" @@ -2465,7 +2540,6 @@ msgstr "" ":meth:`~re.Pattern.subn` メソッドも同じ働きをしますが、新しい文字列と置換の実" "行回数を含む 2-タプルを返します::" -#: ../../howto/regex.rst:1166 msgid "" ">>> p = re.compile('(blue|white|red)')\n" ">>> p.subn('colour', 'blue socks and red shoes')\n" @@ -2473,6 +2547,11 @@ msgid "" ">>> p.subn('colour', 'no colours at all')\n" "('no colours at all', 0)" msgstr "" +">>> p = re.compile('(blue|white|red)')\n" +">>> p.subn('colour', 'blue socks and red shoes')\n" +"('colour socks and colour shoes', 2)\n" +">>> p.subn('colour', 'no colours at all')\n" +"('no colours at all', 0)" #: ../../howto/regex.rst:1172 msgid "" @@ -2482,12 +2561,14 @@ msgstr "" "空文字列とのマッチは、直前の空文字列とマッチした部分と隣接していない場合にの" "み置換されます。 ::" -#: ../../howto/regex.rst:1175 msgid "" ">>> p = re.compile('x*')\n" ">>> p.sub('-', 'abxd')\n" "'-a-b--d-'" msgstr "" +">>> p = re.compile('x*')\n" +">>> p.sub('-', 'abxd')\n" +"'-a-b--d-'" #: ../../howto/regex.rst:1179 msgid "" @@ -2514,14 +2595,15 @@ msgstr "" "この例は単語 ``section`` に続く ``{`` と ``}`` で閉じられた文字列にマッチ" "し、 ``section`` を ``subsection`` に変更します::" -#: ../../howto/regex.rst:1189 msgid "" ">>> p = re.compile('section{ ( [^}]* ) }', re.VERBOSE)\n" ">>> p.sub(r'subsection{\\1}','section{First} section{second}')\n" "'subsection{First} subsection{second}'" msgstr "" +">>> p = re.compile('section{ ( [^}]* ) }', re.VERBOSE)\n" +">>> p.sub(r'subsection{\\1}','section{First} section{second}')\n" +"'subsection{First} subsection{second}'" -#: ../../howto/regex.rst:1193 msgid "" "There's also a syntax for referring to named groups as defined by the ``(?" "P...)`` syntax. ``\\g`` will use the substring matched by the " @@ -2532,15 +2614,15 @@ msgid "" "literal character ``'0'``.) The following substitutions are all equivalent, " "but use all three variations of the replacement string. ::" msgstr "" -"``(?P...)`` 構文で定義された名前つきグループを参照するための構文もあり" -"ます。 ``\\g`` は ``name`` で名前づけされたグループにマッチする文字列を" -"利用し、 ``\\g`` は対応するグループ番号を利用します。つまり " -"``\\g<2>`` は ``\\2`` と等価ですが、 ``\\g<2>0`` のような置換文字列に対しては" -"明確に異なります。 (``\\20`` はグループ番号20への参照と解釈され、グループ2の" -"後にリテラル文字 ``'0'`` が続くとは解釈されません。) 以下に示す置換は全て等価" -"ですが、これらは文字列置換に全部で3種の変種を利用しています。 ::" +"``(?P...)`` で定義した名前付きグループを参照する構文もあります。\n" +"``\\g`` は ``name`` というグループにマッチした部分文字列を使い、" +"``\\g`` はグループ番号で指定します。\n" +"``\\g<2>`` は ``\\2`` と同じですが、``\\g<2>0`` のような置換文字列でも曖昧に" +"なりません。\n" +"``\\20`` は、グループ 2 に文字 ``'0'`` を続けたものではなく、グループ 20 への" +"参照と解釈されます。\n" +"次の三つの置換は、それぞれ異なる書き方で同じ結果を得ます。 ::" -#: ../../howto/regex.rst:1202 msgid "" ">>> p = re.compile('section{ (?P [^}]* ) }', re.VERBOSE)\n" ">>> p.sub(r'subsection{\\1}','section{First}')\n" @@ -2550,6 +2632,13 @@ msgid "" ">>> p.sub(r'subsection{\\g}','section{First}')\n" "'subsection{First}'" msgstr "" +">>> p = re.compile('section{ (?P [^}]* ) }', re.VERBOSE)\n" +">>> p.sub(r'subsection{\\1}','section{First}')\n" +"'subsection{First}'\n" +">>> p.sub(r'subsection{\\g<1>}','section{First}')\n" +"'subsection{First}'\n" +">>> p.sub(r'subsection{\\g}','section{First}')\n" +"'subsection{First}'" #: ../../howto/regex.rst:1210 msgid "" @@ -2571,7 +2660,6 @@ msgid "" "hexadecimal::" msgstr "続く例では、置換関数は十進数文字列を十六進数文字列に変換しています::" -#: ../../howto/regex.rst:1219 msgid "" ">>> def hexrepl(match):\n" "... \"Return the hex string for a decimal number\"\n" @@ -2582,6 +2670,14 @@ msgid "" ">>> p.sub(hexrepl, 'Call 65490 for printing, 49152 for user code.')\n" "'Call 0xffd2 for printing, 0xc000 for user code.'" msgstr "" +">>> def hexrepl(match):\n" +"... \"Return the hex string for a decimal number\"\n" +"... value = int(match.group())\n" +"... return hex(value)\n" +"...\n" +">>> p = re.compile(r'\\d+')\n" +">>> p.sub(hexrepl, 'Call 65490 for printing, 49152 for user code.')\n" +"'Call 0xffd2 for printing, 0xc000 for user code.'" #: ../../howto/regex.rst:1228 msgid "" @@ -2617,7 +2713,6 @@ msgstr "" msgid "Use String Methods" msgstr "文字列メソッドを利用する" -#: ../../howto/regex.rst:1246 msgid "" "Sometimes using the :mod:`re` module is a mistake. If you're matching a " "fixed string, or a single character class, and you're not using any :mod:" @@ -2628,12 +2723,14 @@ msgid "" "for the purpose, instead of the large, more generalized regular expression " "engine." msgstr "" -"いくつかの場合 :mod:`re` モジュールを利用することは間違いである場合がありま" -"す。固定文字列や単一の文字クラスにマッチさせる場合や、 :const:`~re." -"IGNORECASE` フラグのような :mod:`re` の機能を利用しない場合、正規表現の全ての" -"能力は必要とされていなでしょう。文字列は固定文字列に対する操作を実行するメ" -"ソッドを持っていて、大きな汎用化された正規表現エンジンではなく、目的のために" -"最適化された単一の小さな C loop で実装されているため、大抵の場合高速です." +":mod:`re` モジュールを使わない方がよい場合もあります。\n" +"固定文字列や単一の文字クラスに一致するか調べるだけで、:const:`~re." +"IGNORECASE` フラグなどの :mod:`re` の機能を使わないなら、正規表現の機能は必要" +"ないかもしれません。\n" +"文字列には固定文字列を扱うメソッドがいくつかあり、通常はこちらの方がはるかに" +"高速です。\n" +"大きく汎用的な正規表現エンジンではなく、その目的に最適化された、小さな一つの " +"C のループで実装されているためです。" #: ../../howto/regex.rst:1254 msgid "" @@ -2657,7 +2754,6 @@ msgstr "" "``\\bword\\b`` として、 ``word`` の両側に単語の境界が要求されるようにします。" "これは :meth:`!replace` の能力を越えた作業です。)" -#: ../../howto/regex.rst:1263 msgid "" "Another common task is deleting every occurrence of a single character from " "a string or replacing it with another single character. You might do this " @@ -2665,10 +2761,10 @@ msgid "" "capable of doing both tasks and will be faster than any regular expression " "operation can be." msgstr "" -"別のよくある作業は、文字列の中に出現する文字を全て削除することと、別の文字で" -"置換することです。この作業を ``re.sub('\\n', ' ', S)`` のようにして行うかもし" -"れませんが、 :meth:`~str.translate` は削除と置換の両方の作業をこなし、正規表" -"現操作よりも高速に行うことができます。" +"よくある作業には、文字列中の特定の一文字をすべて削除したり、別の一文字に置換" +"したりすることもあります。\n" +"``re.sub('\\n', ' ', S)`` のように書くこともできますが、:meth:`~str." +"translate` は両方の作業ができ、どの正規表現による操作よりも高速です。" #: ../../howto/regex.rst:1269 msgid "" @@ -2715,13 +2811,16 @@ msgstr "" "一方 :func:`~re.search` は文字列の先の方まで走査し、最初にみつけたマッチを報" "告します。::" -#: ../../howto/regex.rst:1290 msgid "" ">>> print(re.search('super', 'superstition').span())\n" "(0, 5)\n" ">>> print(re.search('super', 'insuperable').span())\n" "(2, 7)" msgstr "" +">>> print(re.search('super', 'superstition').span())\n" +"(0, 5)\n" +">>> print(re.search('super', 'insuperable').span())\n" +"(2, 7)" #: ../../howto/regex.rst:1295 msgid "" @@ -2819,7 +2918,6 @@ msgid "" "" msgstr "" -#: ../../howto/regex.rst:1342 msgid "" "(Note that parsing HTML or XML with regular expressions is painful. Quick-" "and-dirty patterns will handle common cases, but HTML and XML have special " @@ -2828,11 +2926,11 @@ msgid "" "patterns will be *very* complicated. Use an HTML or XML parser module for " "such tasks.)" msgstr "" -"(HTML や XML を正規表現でパースすることは苦痛を伴うものであることは記憶に留め" -"ておいて下さい。素早く、汚いパターンは大抵の場合うまく動作しますが、HTML と " -"XML は正規表現が破綻する特別な例です; 全ての可能な場合にうまく動作する正規表" -"現を書き上げたときには、パターンは *非常に* 複雑なものになります。そのような" -"作業をする場合には HTML や XML パーサを利用しましょう。)" +"HTML や XML を正規表現で解析するのは大変です。\n" +"間に合わせのパターンでも一般的な場合は扱えますが、HTML や XML には、単純な正" +"規表現では対応できない特殊な場合があります。\n" +"すべての場合を扱おうとすると、パターンは *非常に* 複雑になります。\n" +"このような作業には HTML や XML のパーサモジュールを使ってください。" #: ../../howto/regex.rst:1350 msgid "Using re.VERBOSE" @@ -2878,7 +2976,6 @@ msgstr "" "す。三重クォートを利用することで、正規表現をきちんとフォーマットすることがで" "きます::" -#: ../../howto/regex.rst:1369 msgid "" "pat = re.compile(r\"\"\"\n" " \\s* # Skip leading whitespace\n" @@ -2889,14 +2986,21 @@ msgid "" " \\s*$ # Trailing whitespace to end-of-line\n" "\"\"\", re.VERBOSE)" msgstr "" +"pat = re.compile(r\"\"\"\n" +" \\s* # 先頭の空白を読み飛ばす\n" +" (?P
[^:]+) # ヘッダー名\n" +" \\s* : # 空白とコロン\n" +" (?P.*?) # ヘッダーの値。*? を使って\n" +" # 後ろに続く空白を除去する\n" +" \\s*$ # 行末までの空白\n" +"\"\"\", re.VERBOSE)" #: ../../howto/regex.rst:1378 msgid "This is far more readable than::" msgstr "これは下よりはるかに読みやすいです::" -#: ../../howto/regex.rst:1380 msgid "pat = re.compile(r\"\\s*(?P
[^:]+)\\s*:(?P.*?)\\s*$\")" -msgstr "" +msgstr "pat = re.compile(r\"\\s*(?P
[^:]+)\\s*:(?P.*?)\\s*$\")" #: ../../howto/regex.rst:1384 msgid "Feedback" diff --git a/howto/sockets.po b/howto/sockets.po index a0fddb964..410b4e3f4 100644 --- a/howto/sockets.po +++ b/howto/sockets.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: Takanori Suzuki , 2021\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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/sockets.rst:5 @@ -79,7 +79,6 @@ msgstr "" "提示しよう。だが、まずはブロッキングソケットから始めることにする。ノンブロッ" "キングを扱うより先に、ブロッキングの仕組みを知っておかなくてはならないのだ。" -#: ../../howto/sockets.rst:31 msgid "" "Part of the trouble with understanding these things is that \"socket\" can " "mean a number of subtly different things, depending on context. So first, " @@ -90,26 +89,27 @@ msgid "" "sockets and \"client\" sockets." msgstr "" "話を理解しにくくしている要因として、「ソケット」という言葉が文脈によって微妙" -"に違うものを指すことが挙げられる。そこでまず、「クライアント」ソケット - 対話" -"の両端 - と「サーバ」ソケット - 電話交換手みたいなもの - の区別を付けておこ" -"う。クライアントアプリケーション (たとえばブラウザ) は「クライアント」ソケッ" -"トだけを使うが、話し相手のウェブサーバは「サーバ」ソケットと「クライアント」" -"ソケットの両方を使う。" +"に違うものを指すことが挙げられる。\n" +"そこでまず、「クライアント」ソケット - 対話の一方の端 - と「サーバ」ソケット " +"- 電話交換手みたいなもの - の区別を付けておこう。\n" +"クライアントアプリケーション (たとえばブラウザ) は「クライアント」ソケットだ" +"けを使うが、話し相手のウェブサーバは「サーバ」ソケットと「クライアント」ソ" +"ケットの両方を使う。" #: ../../howto/sockets.rst:40 msgid "History" msgstr "歴史" -#: ../../howto/sockets.rst:42 msgid "" "Of the various forms of :abbr:`IPC (Inter Process Communication)`, sockets " "are by far the most popular. On any given platform, there are likely to be " "other forms of IPC that are faster, but for cross-platform communication, " "sockets are about the only game in town." msgstr "" -"各種 :abbr:`IPC (Inter Process Communication` (プロセス間通信) の中でも、ソ" -"ケットは群を抜いて人気がある。どのプラットフォームにも、ソケットより速い IPC " -"はあるだろう。だが、プラットフォームをまたぐ通信はソケットの独擅場だ。" +"各種 :abbr:`IPC (Inter Process Communication)` (プロセス間通信) の中でも、ソ" +"ケットは群を抜いて人気がある。\n" +"どのプラットフォームにも、ソケットより速い IPC はあるだろう。\n" +"だが、プラットフォームをまたぐ通信はソケットの独擅場だ。" #: ../../howto/sockets.rst:47 msgid "" @@ -135,13 +135,16 @@ msgstr "" "あなたがリンクをクリックしてこのページに来たとき、ブラウザは大雑把に言って次" "のようなことをしたのである::" -#: ../../howto/sockets.rst:59 msgid "" "# create an INET, STREAMing socket\n" "s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n" "# now connect to the web server on port 80 - the normal http port\n" "s.connect((\"www.python.org\", 80))" msgstr "" +"# INET の STREAM ソケットを作る\n" +"s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n" +"# HTTP の通常のポートである 80 番でウェブサーバーに接続する\n" +"s.connect((\"www.python.org\", 80))" #: ../../howto/sockets.rst:64 msgid "" @@ -162,7 +165,6 @@ msgid "" msgstr "" "ウェブサーバで起こる事柄はもう少し複雑だ。まず「サーバソケット」を作る::" -#: ../../howto/sockets.rst:73 msgid "" "# create an INET, STREAMing socket\n" "serversocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n" @@ -171,6 +173,12 @@ msgid "" "# become a server socket\n" "serversocket.listen(5)" msgstr "" +"# INET の STREAM ソケットを作る\n" +"serversocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n" +"# 外部から接続できるホストとウェルノウンポートにソケットをバインドする\n" +"serversocket.bind((socket.gethostname(), 80))\n" +"# サーバーソケットにする\n" +"serversocket.listen(5)" #: ../../howto/sockets.rst:80 msgid "" @@ -216,7 +224,6 @@ msgstr "" "よし、「サーバーソケット」ができて、80 番ポートで耳を澄ましているところまで来" "た。では、ウェブサーバのメインループに入ろう::" -#: ../../howto/sockets.rst:98 msgid "" "while True:\n" " # accept connections from outside\n" @@ -226,6 +233,13 @@ msgid "" " ct = make_client_thread(clientsocket)\n" " ct.start()" msgstr "" +"while True:\n" +" # 外部からの接続を受け付ける\n" +" (clientsocket, address) = serversocket.accept()\n" +" # clientsocket を使って処理する\n" +" # ここではスレッドを使うサーバーだとする\n" +" ct = make_client_thread(clientsocket)\n" +" ct.start()" #: ../../howto/sockets.rst:106 msgid "" @@ -284,7 +298,6 @@ msgstr "" msgid "Using a Socket" msgstr "ソケットの利用" -#: ../../howto/sockets.rst:136 msgid "" "The first thing to note, is that the web browser's \"client\" socket and the " "web server's \"client\" socket are identical beasts. That is, this is a " @@ -295,11 +308,13 @@ msgid "" "rule of sockets." msgstr "" "はじめに憶えておくべきなのは、ウェブブラウザの「クライアント」ソケットとウェ" -"ブサーバの「クライアント」ソケットがまったく同じ種族だということだ。つまり、" -"これは「ピア・トゥ・ピア」(1 対 1) の会話である。別の言い方をすると、 *設計者" -"として自分で会話のエチケット規則を決めなくてはいけない* ということでもある。" -"通常は、 ``connect`` してくるソケットが要求あるいは宣言をして会話を始める。だ" -"が、それはそう設計しただけのことだ - ソケットの規則ではない。" +"ブサーバの「クライアント」ソケットがまったく同じ種族だということだ。\n" +"つまり、これは「ピア・トゥ・ピア」(対等な相手同士) の会話である。\n" +"別の言い方をすると、 *設計者として自分で会話のエチケット規則を決めなくてはい" +"けない* ということでもある。\n" +"通常は、 ``connect`` してくるソケットが要求やログイン情報を送って会話を始め" +"る。\n" +"だが、それはそう設計しただけのことだ - ソケットの規則ではない。" #: ../../howto/sockets.rst:143 msgid "" @@ -392,7 +407,6 @@ msgstr "" "毎回接続を終わらせるのはイヤだとして、最も単純な解決策は固定長メッセージだろ" "う::" -#: ../../howto/sockets.rst:183 msgid "" "class MySocket:\n" " \"\"\"demonstration class only\n" @@ -428,6 +442,39 @@ msgid "" " bytes_recd = bytes_recd + len(chunk)\n" " return b''.join(chunks)" msgstr "" +"class MySocket:\n" +" \"\"\"説明用のクラス\n" +" - 効率よりも分かりやすさを優先したコード\n" +" \"\"\"\n" +"\n" +" def __init__(self, sock=None):\n" +" if sock is None:\n" +" self.sock = socket.socket(\n" +" socket.AF_INET, socket.SOCK_STREAM)\n" +" else:\n" +" self.sock = sock\n" +"\n" +" def connect(self, host, port):\n" +" self.sock.connect((host, port))\n" +"\n" +" def mysend(self, msg):\n" +" totalsent = 0\n" +" while totalsent < MSGLEN:\n" +" sent = self.sock.send(msg[totalsent:])\n" +" if sent == 0:\n" +" raise RuntimeError(\"socket connection broken\")\n" +" totalsent = totalsent + sent\n" +"\n" +" def myreceive(self):\n" +" chunks = []\n" +" bytes_recd = 0\n" +" while bytes_recd < MSGLEN:\n" +" chunk = self.sock.recv(min(MSGLEN - bytes_recd, 2048))\n" +" if chunk == b'':\n" +" raise RuntimeError(\"socket connection broken\")\n" +" chunks.append(chunk)\n" +" bytes_recd = bytes_recd + len(chunk)\n" +" return b''.join(chunks)" #: ../../howto/sockets.rst:217 msgid "" @@ -507,7 +554,6 @@ msgstr "" msgid "Binary Data" msgstr "バイナリデータ" -#: ../../howto/sockets.rst:254 msgid "" "It is perfectly possible to send binary data over a socket. The major " "problem is that not all machines use the same formats for binary data. For " @@ -518,8 +564,15 @@ msgid "" "little-endian, with the least significant byte first - that same ``1`` would " "be ``01 00``." msgstr "" +"ソケットでバイナリデータを送ることはもちろん可能だ。\n" +"大きな問題は、すべてのマシンが同じバイナリデータ形式を使うわけではないこと" +"だ。\n" +"例えば、`ネットワークバイトオーダー `_ は最上位バイトを先頭に置くビッグエンディアンなので、" +"値が ``1`` の 16 ビット整数は 16 進数で ``00 01`` という 2 バイトになる。\n" +"一方、一般的なプロセッサーのほとんど (x86/AMD64、ARM、RISC-V) は最下位バイト" +"を先頭に置くリトルエンディアンで、同じ ``1`` が ``01 00`` になる。" -#: ../../howto/sockets.rst:262 msgid "" "Socket libraries have calls for converting 16 and 32 bit integers - ``ntohl, " "htonl, ntohs, htons`` where \"n\" means *network* and \"h\" means *host*, " @@ -527,6 +580,12 @@ msgid "" "order, these do nothing, but where the machine is byte-reversed, these swap " "the bytes around appropriately." msgstr "" +"ソケットライブラリには、16 ビットと 32 ビットの整数を変換する関数 ``ntohl, " +"htonl, ntohs, htons`` がある。\n" +"「n」は *network*、「h」は *host*、「s」は *short*、「l」は *long* を意味す" +"る。\n" +"ネットワークとホストのバイト順が同じなら何もしないが、逆のバイト順を使うマシ" +"ンでは適切にバイトを入れ替える。" #: ../../howto/sockets.rst:268 msgid "" @@ -596,7 +655,6 @@ msgstr "" msgid "When Sockets Die" msgstr "ソケットが死ぬと" -#: ../../howto/sockets.rst:304 msgid "" "Probably the worst thing about using blocking sockets is what happens when " "the other side comes down hard (without doing a ``close``). Your socket is " @@ -610,32 +668,36 @@ msgid "" "automatic recycling of resources. In other words, if you do manage to kill " "the thread, your whole process is likely to be screwed up." msgstr "" -"ブロッキングソケットを使っていて一番いやなのは多分、相手側が意地悪く " -"(``close`` せずに) ダウンするときに起こる事柄だ。自分側のソケットは高確率でハ" -"ングするだろう。TCP は信頼性の高いプロトコルなので、ずっとずっと待ち続けて、" -"なかなか見捨てないのだ。スレッドを使っているのであれば、そのスレッド全体が根" -"本から死んだ状態になる。こうなると、もう手の施しようがない。まあ、ブロッキン" -"グ読み出しの間ロックし続けるといった馬鹿げたことをしていない限り、リソースの" -"点ではたいして消費にならない。だから *ぜったいに* そのスレッドを殺そうとして" -"はいけない - プロセスよりスレッドが効率的である理由のひとつは、自動リソース回" -"収にまつわるオーバヘッドを避けられるという点にあるのだ。つまり別の言い方をす" -"ると、どうにかしてそのスレッドを殺したなら、プロセス全体がぐちゃぐちゃになっ" -"てしまうだろうということだ。" +"ブロッキングソケットを使っていて一番いやなのは多分、相手側が突然 (``close`` " +"せずに) ダウンするときに起こる事柄だ。\n" +"自分側のソケットは高確率でハングするだろう。\n" +"TCP は信頼性の高いプロトコルなので、ずっとずっと待ち続けて、なかなか見捨てな" +"いのだ。\n" +"スレッドを使っているのであれば、そのスレッド全体が根本から死んだ状態にな" +"る。\n" +"こうなると、もう手の施しようがない。\n" +"まあ、ブロッキング読み出しの間ロックし続けるといった馬鹿げたことをしていない" +"限り、リソースの点ではたいして消費にならない。\n" +"だから *ぜったいに* そのスレッドを殺そうとしてはいけない - プロセスよりスレッ" +"ドが効率的である理由のひとつは、自動リソース回収にまつわるオーバヘッドを避け" +"られるという点にあるのだ。\n" +"つまり別の言い方をすると、どうにかしてそのスレッドを殺したなら、プロセス全体" +"がぐちゃぐちゃになってしまうだろうということだ。" #: ../../howto/sockets.rst:318 msgid "Non-blocking Sockets" msgstr "ノンブロッキングソケット" -#: ../../howto/sockets.rst:320 msgid "" "If you've understood the preceding, you already know most of what you need " "to know about the mechanics of using sockets. You'll still use the same " "calls, in much the same ways. It's just that, if you do it right, your app " "will be almost inside-out." msgstr "" -"ここまで理解してきたなら、もうソケットの仕組みについて必要なことはほとんど" -"知っていることになる。これからも同じコールを、ほぼ同じように使っていくだけ、" -"それだけだ。これをちゃんとやっていれば、そのアプリはだいたい完璧であろう。" +"ここまで理解できたなら、ソケットを使う仕組みについて必要なことはほとんど分" +"かっている。\n" +"使う関数も、その使い方も、これまでとほぼ同じだ。\n" +"ただし、適切に実装すると、アプリケーションの構成はほとんど裏返しになる。" #: ../../howto/sockets.rst:325 msgid "" @@ -682,7 +744,6 @@ msgstr "" "い。しかし Python で ``select`` を理解しておけば C でもほとんど問題なく書け" "る、という程度には似ている::" -#: ../../howto/sockets.rst:345 msgid "" "ready_to_read, ready_to_write, in_error = \\\n" " select.select(\n" @@ -691,6 +752,12 @@ msgid "" " potential_errs,\n" " timeout)" msgstr "" +"ready_to_read, ready_to_write, in_error = \\\n" +" select.select(\n" +" potential_readers,\n" +" potential_writers,\n" +" potential_errs,\n" +" timeout)" #: ../../howto/sockets.rst:352 msgid "" diff --git a/howto/sorting.po b/howto/sorting.po index 422410f45..401e636af 100644 --- a/howto/sorting.po +++ b/howto/sorting.po @@ -20,10 +20,10 @@ msgstr "" "Last-Translator: Arihiro TAKASE, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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/sorting.rst:4 @@ -67,11 +67,12 @@ msgstr "" "単純な昇順のソートはとても簡単です: :func:`sorted` 関数を呼ぶだけです。そうす" "れば、新たにソートされたリストが返されます::" -#: ../../howto/sorting.rst:22 msgid "" ">>> sorted([5, 2, 3, 1, 4])\n" "[1, 2, 3, 4, 5]" msgstr "" +">>> sorted([5, 2, 3, 1, 4])\n" +"[1, 2, 3, 4, 5]" #: ../../howto/sorting.rst:27 msgid "" @@ -85,13 +86,16 @@ msgstr "" "します)。多くの場合、こちらの方法は :func:`sorted` と比べると不便です - ただ" "し、元々のリストが不要な場合には、わずかですがより効率的です。" -#: ../../howto/sorting.rst:32 msgid "" ">>> a = [5, 2, 3, 1, 4]\n" ">>> a.sort()\n" ">>> a\n" "[1, 2, 3, 4, 5]" msgstr "" +">>> a = [5, 2, 3, 1, 4]\n" +">>> a.sort()\n" +">>> a\n" +"[1, 2, 3, 4, 5]" #: ../../howto/sorting.rst:39 msgid "" @@ -101,35 +105,41 @@ msgstr "" "違いは他にもあります、 :meth:`list.sort` メソッドはリストにのみ定義されていま" "す。一方 :func:`sorted` 関数は任意のイテラブルを受け付けます。" -#: ../../howto/sorting.rst:42 msgid "" ">>> sorted({1: 'D', 2: 'B', 3: 'B', 4: 'E', 5: 'A'})\n" "[1, 2, 3, 4, 5]" msgstr "" +">>> sorted({1: 'D', 2: 'B', 3: 'B', 4: 'E', 5: 'A'})\n" +"[1, 2, 3, 4, 5]" #: ../../howto/sorting.rst:48 msgid "Key Functions" msgstr "Key 関数" -#: ../../howto/sorting.rst:50 msgid "" "The :meth:`list.sort` method and the functions :func:`sorted`, :func:`min`, :" "func:`max`, :func:`heapq.nsmallest`, and :func:`heapq.nlargest` have a *key* " "parameter to specify a function (or other callable) to be called on each " "list element prior to making comparisons." msgstr "" +":meth:`list.sort` メソッドと :func:`sorted`、:func:`min`、:func:`max`、:func:" +"`heapq.nsmallest`、:func:`heapq.nlargest` 関数には、比較の前にリストの各要素" +"に対して呼び出す関数 (または他の呼び出し可能オブジェクト) を指定する ``key`` " +"パラメーターがあります。" -#: ../../howto/sorting.rst:56 msgid "" "For example, here's a case-insensitive string comparison using :meth:`str." "casefold`:" msgstr "" +"例えば、:meth:`str.casefold` を使うと、大文字と小文字を区別せずに文字列を比較" +"できます。" -#: ../../howto/sorting.rst:59 msgid "" ">>> sorted(\"This is a test string from Andrew\".split(), key=str.casefold)\n" "['a', 'Andrew', 'from', 'is', 'string', 'test', 'This']" msgstr "" +">>> sorted(\"This is a test string from Andrew\".split(), key=str.casefold)\n" +"['a', 'Andrew', 'from', 'is', 'string', 'test', 'This']" #: ../../howto/sorting.rst:64 msgid "" @@ -143,15 +153,14 @@ msgstr "" "りソートを高速に行えます、キー関数は各入力レコードに対してきっちり一回だけ呼" "び出されるからです。" -#: ../../howto/sorting.rst:69 msgid "" "A common pattern is to sort complex objects using some of the object's " "indices as keys. For example:" msgstr "" -"よくある利用パターンはいくつかの要素から成る対象をインデクスのどれかをキーと" -"してソートすることです。例えば:" +"よくある使い方は、複数の要素を持つオブジェクトからインデックスで取り出した値" +"をキーにしてソートすることです。\n" +"例を示します。" -#: ../../howto/sorting.rst:72 msgid "" ">>> student_tuples = [\n" "... ('john', 'A', 15),\n" @@ -161,6 +170,13 @@ msgid "" ">>> sorted(student_tuples, key=lambda student: student[2]) # sort by age\n" "[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]" msgstr "" +">>> student_tuples = [\n" +"... ('john', 'A', 15),\n" +"... ('jane', 'B', 12),\n" +"... ('dave', 'B', 10),\n" +"... ]\n" +">>> sorted(student_tuples, key=lambda student: student[2]) # 年齢でソート\n" +"[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]" #: ../../howto/sorting.rst:82 msgid "" @@ -169,7 +185,6 @@ msgstr "" "同じテクニックは名前づけされた属性 (named attributes) を使うことでオブジェク" "トに対しても動作します。例えば:" -#: ../../howto/sorting.rst:84 msgid "" ">>> class Student:\n" "... def __init__(self, name, grade, age):\n" @@ -188,6 +203,22 @@ msgid "" "age\n" "[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]" msgstr "" +">>> class Student:\n" +"... def __init__(self, name, grade, age):\n" +"... self.name = name\n" +"... self.grade = grade\n" +"... self.age = age\n" +"... def __repr__(self):\n" +"... return repr((self.name, self.grade, self.age))\n" +"\n" +">>> student_objects = [\n" +"... Student('john', 'A', 15),\n" +"... Student('jane', 'B', 12),\n" +"... Student('dave', 'B', 10),\n" +"... ]\n" +">>> sorted(student_objects, key=lambda student: student.age) # 年齢でソー" +"ト\n" +"[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]" #: ../../howto/sorting.rst:102 msgid "" @@ -219,7 +250,6 @@ msgstr "" msgid "Using those functions, the above examples become simpler and faster:" msgstr "これらの関数を利用すると、上の例はもっと簡単で高速になります:" -#: ../../howto/sorting.rst:116 msgid "" ">>> from operator import itemgetter, attrgetter\n" "\n" @@ -229,16 +259,22 @@ msgid "" ">>> sorted(student_objects, key=attrgetter('age'))\n" "[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]" msgstr "" +">>> from operator import itemgetter, attrgetter\n" +"\n" +">>> sorted(student_tuples, key=itemgetter(2))\n" +"[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]\n" +"\n" +">>> sorted(student_objects, key=attrgetter('age'))\n" +"[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]" -#: ../../howto/sorting.rst:126 msgid "" "The operator module functions allow multiple levels of sorting. For example, " "to sort by *grade* then by *age*:" msgstr "" -"operator モジュールの関数は複数の段階でのソートを可能にします。例えば、 " -"*grade* でソートしてさらに *age* でソートする場合:" +"operator モジュールの関数では、複数のキーに優先順位を付けてソートできます。\n" +"例えば、まず *grade* で比較し、同じ場合は *age* で比較するには、次のようにし" +"ます。" -#: ../../howto/sorting.rst:129 msgid "" ">>> sorted(student_tuples, key=itemgetter(1,2))\n" "[('john', 'A', 15), ('dave', 'B', 10), ('jane', 'B', 12)]\n" @@ -246,6 +282,11 @@ msgid "" ">>> sorted(student_objects, key=attrgetter('grade', 'age'))\n" "[('john', 'A', 15), ('dave', 'B', 10), ('jane', 'B', 12)]" msgstr "" +">>> sorted(student_tuples, key=itemgetter(1,2))\n" +"[('john', 'A', 15), ('dave', 'B', 10), ('jane', 'B', 12)]\n" +"\n" +">>> sorted(student_objects, key=attrgetter('grade', 'age'))\n" +"[('john', 'A', 15), ('dave', 'B', 10), ('jane', 'B', 12)]" #: ../../howto/sorting.rst:137 msgid "" @@ -258,7 +299,6 @@ msgstr "" "す。:func:`~functools.partial` 関数は複数引数の関数の `アリティ `_ を減らし、キー関数に適したものにできます。" -#: ../../howto/sorting.rst:142 msgid "" ">>> from functools import partial\n" ">>> from unicodedata import normalize\n" @@ -271,6 +311,16 @@ msgid "" ">>> sorted(names, key=partial(normalize, 'NFC'))\n" "['Abe', 'Eloise', 'Nubia', 'Núñez', 'Zeke', 'Zoë', 'Åbjørn', 'Élana']" msgstr "" +">>> from functools import partial\n" +">>> from unicodedata import normalize\n" +"\n" +">>> names = 'Zoë Åbjørn Núñez Élana Zeke Abe Nubia Eloise'.split()\n" +"\n" +">>> sorted(names, key=partial(normalize, 'NFD'))\n" +"['Abe', 'Åbjørn', 'Eloise', 'Élana', 'Nubia', 'Núñez', 'Zeke', 'Zoë']\n" +"\n" +">>> sorted(names, key=partial(normalize, 'NFC'))\n" +"['Abe', 'Eloise', 'Nubia', 'Núñez', 'Zeke', 'Zoë', 'Åbjørn', 'Élana']" #: ../../howto/sorting.rst:156 msgid "Ascending and Descending" @@ -286,7 +336,6 @@ msgstr "" "として受け付けます。このパラメータは降順ソートを行うかどうかの フラグとして利" "用されます。 例えば、学生のデータを *age* の逆順で得たい場合:" -#: ../../howto/sorting.rst:162 msgid "" ">>> sorted(student_tuples, key=itemgetter(2), reverse=True)\n" "[('john', 'A', 15), ('jane', 'B', 12), ('dave', 'B', 10)]\n" @@ -294,6 +343,11 @@ msgid "" ">>> sorted(student_objects, key=attrgetter('age'), reverse=True)\n" "[('john', 'A', 15), ('jane', 'B', 12), ('dave', 'B', 10)]" msgstr "" +">>> sorted(student_tuples, key=itemgetter(2), reverse=True)\n" +"[('john', 'A', 15), ('jane', 'B', 12), ('dave', 'B', 10)]\n" +"\n" +">>> sorted(student_objects, key=attrgetter('age'), reverse=True)\n" +"[('john', 'A', 15), ('jane', 'B', 12), ('dave', 'B', 10)]" #: ../../howto/sorting.rst:171 msgid "Sort Stability and Complex Sorts" @@ -309,12 +363,14 @@ msgstr "" "Sorting_algorithm#Stability>`_ であることが保証されています。これはレコードの" "中に同じキーがある場合、元々の順序が維持されるということを意味します。" -#: ../../howto/sorting.rst:177 msgid "" ">>> data = [('red', 1), ('blue', 1), ('red', 2), ('blue', 2)]\n" ">>> sorted(data, key=itemgetter(0))\n" "[('blue', 1), ('blue', 2), ('red', 1), ('red', 2)]" msgstr "" +">>> data = [('red', 1), ('blue', 1), ('red', 2), ('blue', 2)]\n" +">>> sorted(data, key=itemgetter(0))\n" +"[('blue', 1), ('blue', 2), ('red', 1), ('red', 2)]" #: ../../howto/sorting.rst:183 msgid "" @@ -324,17 +380,15 @@ msgstr "" "二つの *blue* のレコードが元々の順序を維持して、 ``('blue', 1)`` が " "``('blue', 2)`` の前にあることに注意してください。" -#: ../../howto/sorting.rst:186 msgid "" "This wonderful property lets you build complex sorts in a series of sorting " "steps. For example, to sort the student data by descending *grade* and then " "ascending *age*, do the *age* sort first and then sort again using *grade*:" msgstr "" -"この素晴しい性質によって複数のソートを段階的に組み合わせることができます。例" -"えば、学生データを *grade* の降順にソートし、さらに *age* の昇順にソートした" -"い場合には、まず *age* でソートし、次に *grade* でもう一度ソートします:" +"この性質を使うと、複数回のソートを組み合わせて複雑な順序で並べられます。\n" +"例えば、学生のデータを *grade* の降順に並べ、同じ成績の中では *age* の昇順に" +"並べるには、先に *age* でソートしてから *grade* でもう一度ソートします。" -#: ../../howto/sorting.rst:190 msgid "" ">>> s = sorted(student_objects, key=attrgetter('age')) # sort on " "secondary key\n" @@ -342,6 +396,11 @@ msgid "" "primary key, descending\n" "[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]" msgstr "" +">>> s = sorted(student_objects, key=attrgetter('age')) # 第 2 キーでソー" +"ト\n" +">>> sorted(s, key=attrgetter('grade'), reverse=True) # 次に第 1 キーの" +"降順でソート\n" +"[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]" #: ../../howto/sorting.rst:196 msgid "" @@ -351,7 +410,6 @@ msgstr "" "この処理は、リストおよびフィールド名とソート順序のタプルを複数受け取れるラッ" "パー関数へ抽象化できます。" -#: ../../howto/sorting.rst:199 msgid "" ">>> def multisort(xs, specs):\n" "... for key, reverse in reversed(specs):\n" @@ -361,6 +419,13 @@ msgid "" ">>> multisort(list(student_objects), (('grade', True), ('age', False)))\n" "[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]" msgstr "" +">>> def multisort(xs, specs):\n" +"... for key, reverse in reversed(specs):\n" +"... xs.sort(key=attrgetter(key), reverse=reverse)\n" +"... return xs\n" +"\n" +">>> multisort(list(student_objects), (('grade', True), ('age', False)))\n" +"[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]" #: ../../howto/sorting.rst:209 msgid "" @@ -406,7 +471,6 @@ msgid "" "For example, to sort the student data by *grade* using the DSU approach:" msgstr "例えば、DSU アプローチを利用して学生データを *grade* でソートする場合:" -#: ../../howto/sorting.rst:227 msgid "" ">>> decorated = [(student.grade, i, student) for i, student in " "enumerate(student_objects)]\n" @@ -414,15 +478,20 @@ msgid "" ">>> [student for grade, i, student in decorated] # undecorate\n" "[('john', 'A', 15), ('jane', 'B', 12), ('dave', 'B', 10)]" msgstr "" +">>> decorated = [(student.grade, i, student) for i, student in " +"enumerate(student_objects)]\n" +">>> decorated.sort()\n" +">>> [student for grade, i, student in decorated] # デコレートを" +"取り除く\n" +"[('john', 'A', 15), ('jane', 'B', 12), ('dave', 'B', 10)]" -#: ../../howto/sorting.rst:234 msgid "" "This idiom works because tuples are compared lexicographically; the first " "items are compared; if they are the same then the second items are compared, " "and so on." msgstr "" -"このイディオムはタブルが辞書編集的に比較されるため正しく動作します; 最初の要" -"素が比較され、同じ場合には第二の要素が比較され、以下も同様に動きます。" +"このイディオムが機能するのは、タプルが辞書式順序で比較されるためです。\n" +"最初の要素を比較し、同じなら二番目の要素を比較する、というように進みます。" #: ../../howto/sorting.rst:238 msgid "" @@ -440,34 +509,33 @@ msgstr "" "ソートが安定になります -- もし二つの要素が同じキーを持つ場合、それらの順序が" "ソートされたリストでも維持されます。" -#: ../../howto/sorting.rst:244 msgid "" "The original items do not have to be comparable because the ordering of the " "decorated tuples will be determined by at most the first two items. So for " "example the original list could contain complex numbers which cannot be " "sorted directly." msgstr "" -"元々の要素が比較可能な要素を持つとは限りません、なぜならデコレートされたタブ" -"ルの順序は多くの場合、最初の二つの要素で決定されるからです。例として元のリス" -"トは直接比較できない複素数を含むことができます。" +"デコレートしたタプルの順序は、最大でも最初の二つの要素を比較すれば決まるた" +"め、元の要素は比較可能である必要がありません。\n" +"例えば、元のリストに、そのままではソートできない複素数を含めることもできま" +"す。" -#: ../../howto/sorting.rst:249 msgid "" "Another name for this idiom is `Schwartzian transform `_\\, after Randal L. Schwartz, who " "popularized it among Perl programmers." msgstr "" -"このイディオムの別名に `Schwartzian transform `_ があります。これは Perl プログラマの間で有名な " -"Randal L. Schwartz にちなんでいます。" +"このイディオムは `Schwartzian transform `_ とも呼ばれます。\n" +"Perl プログラマーの間にこの手法を広めた Randal L. Schwartz にちなんだ名前で" +"す。" -#: ../../howto/sorting.rst:253 msgid "" "Now that Python sorting provides key-functions, this technique is not often " "needed." msgstr "" -"いまや Python のソートは key 関数による方法を提供しているので、このテクニック" -"は不要でしょう。" +"現在の Python のソートではキー関数を使えるため、このテクニックが必要になるこ" +"とはあまりありません。" #: ../../howto/sorting.rst:256 msgid "Comparison Functions" @@ -506,50 +574,48 @@ msgstr "" "数を目にすることがよくあります。また、その API の一部として比較関数を提供して" "いるライブラリもあります。例えば、 :func:`locale.strcoll` は比較関数です。" -#: ../../howto/sorting.rst:272 msgid "" "To accommodate those situations, Python provides :class:`functools." "cmp_to_key` to wrap the comparison function to make it usable as a key " "function::" msgstr "" "このような場合に対処するため、Python は比較関数をラップしてキー関数として使え" -"るようにする関数 :class:`functools.cmp_to_key` を提供しています。" +"るようにする関数 :class:`functools.cmp_to_key` を提供しています。 ::" -#: ../../howto/sorting.rst:276 msgid "sorted(words, key=cmp_to_key(strcoll)) # locale-aware sort order" -msgstr "" +msgstr "sorted(words, key=cmp_to_key(strcoll)) # ロケールに応じたソート順" -#: ../../howto/sorting.rst:279 msgid "Strategies For Unorderable Types and Values" -msgstr "" +msgstr "順序を比較できない型や値への対処" -#: ../../howto/sorting.rst:281 msgid "" "A number of type and value issues can arise when sorting. Here are some " "strategies that can help:" msgstr "" +"ソートでは、型や値に関する問題が起こる場合があります。\n" +"役に立つ対処方法をいくつか紹介します。" -#: ../../howto/sorting.rst:284 msgid "Convert non-comparable input types to strings prior to sorting:" -msgstr "" +msgstr "比較できない型の入力は、ソートの前に文字列に変換します。" -#: ../../howto/sorting.rst:286 msgid "" ">>> data = ['twelve', '11', 10]\n" ">>> sorted(map(str, data))\n" "['10', '11', 'twelve']" msgstr "" +">>> data = ['twelve', '11', 10]\n" +">>> sorted(map(str, data))\n" +"['10', '11', 'twelve']" -#: ../../howto/sorting.rst:292 msgid "" "This is needed because most cross-type comparisons raise a :exc:`TypeError`." msgstr "" +"型が異なる値を比較すると、多くの場合 :exc:`TypeError` が送出されるため、この" +"変換が必要です。" -#: ../../howto/sorting.rst:295 msgid "Remove special values prior to sorting:" -msgstr "" +msgstr "ソートの前に特殊な値を取り除きます。" -#: ../../howto/sorting.rst:297 msgid "" ">>> from math import isnan\n" ">>> from itertools import filterfalse\n" @@ -557,62 +623,74 @@ msgid "" ">>> sorted(filterfalse(isnan, data))\n" "[1.1, 2.2, 3.3]" msgstr "" +">>> from math import isnan\n" +">>> from itertools import filterfalse\n" +">>> data = [3.3, float('nan'), 1.1, 2.2]\n" +">>> sorted(filterfalse(isnan, data))\n" +"[1.1, 2.2, 3.3]" -#: ../../howto/sorting.rst:305 msgid "" "This is needed because the `IEEE-754 standard `_ specifies that, \"Every NaN shall compare unordered with " "everything, including itself.\"" msgstr "" +"`IEEE-754 規格 `_ は「すべての NaN " +"は、自分自身を含むあらゆる値との比較で順序付け不能となる」と定めているため、" +"この処理が必要です。" -#: ../../howto/sorting.rst:309 msgid "Likewise, ``None`` can be stripped from datasets as well:" -msgstr "" +msgstr "同様に、データから ``None`` を取り除くこともできます。" -#: ../../howto/sorting.rst:311 msgid "" ">>> data = [3.3, None, 1.1, 2.2]\n" ">>> sorted(x for x in data if x is not None)\n" "[1.1, 2.2, 3.3]" msgstr "" +">>> data = [3.3, None, 1.1, 2.2]\n" +">>> sorted(x for x in data if x is not None)\n" +"[1.1, 2.2, 3.3]" -#: ../../howto/sorting.rst:317 msgid "This is needed because ``None`` is not comparable to other types." -msgstr "" +msgstr "``None`` と他の型の値では順序を比較できないため、この処理が必要です。" -#: ../../howto/sorting.rst:319 msgid "Convert mapping types into sorted item lists before sorting:" -msgstr "" +msgstr "マッピング型は、ソートの前にソート済みの要素のリストに変換します。" -#: ../../howto/sorting.rst:321 msgid "" ">>> data = [{'a': 1}, {'b': 2}]\n" ">>> sorted(data, key=lambda d: sorted(d.items()))\n" "[{'a': 1}, {'b': 2}]" msgstr "" +">>> data = [{'a': 1}, {'b': 2}]\n" +">>> sorted(data, key=lambda d: sorted(d.items()))\n" +"[{'a': 1}, {'b': 2}]" -#: ../../howto/sorting.rst:327 msgid "" "This is needed because dict-to-dict comparisons raise a :exc:`TypeError`." msgstr "" +"辞書同士の順序を比較すると :exc:`TypeError` が送出されるため、この変換が必要" +"です。" -#: ../../howto/sorting.rst:330 msgid "Convert set types into sorted lists before sorting:" -msgstr "" +msgstr "集合型は、ソートの前にソート済みのリストに変換します。" -#: ../../howto/sorting.rst:332 msgid "" ">>> data = [{'a', 'b', 'c'}, {'b', 'c', 'd'}]\n" ">>> sorted(map(sorted, data))\n" "[['a', 'b', 'c'], ['b', 'c', 'd']]" msgstr "" +">>> data = [{'a', 'b', 'c'}, {'b', 'c', 'd'}]\n" +">>> sorted(map(sorted, data))\n" +"[['a', 'b', 'c'], ['b', 'c', 'd']]" -#: ../../howto/sorting.rst:338 msgid "" "This is needed because the elements contained in set types do not have a " "deterministic order. For example, ``list({'a', 'b'})`` may produce either " "``['a', 'b']`` or ``['b', 'a']``." msgstr "" +"集合型に含まれる要素には決まった順序がないため、この変換が必要です。\n" +"例えば、``list({'a', 'b'})`` の結果は ``['a', 'b']`` にも ``['b', 'a']`` にも" +"なり得ます。" #: ../../howto/sorting.rst:343 msgid "Odds and Ends" @@ -641,7 +719,6 @@ msgstr "" "しい場合元々の順序が維持されます)。面白いことにこの影響はパラメータ無しで :" "func:`reversed` 関数を二回使うことで模倣することができます:" -#: ../../howto/sorting.rst:355 msgid "" ">>> data = [('red', 1), ('blue', 1), ('red', 2), ('blue', 2)]\n" ">>> standard_way = sorted(data, key=itemgetter(0), reverse=True)\n" @@ -651,6 +728,13 @@ msgid "" ">>> standard_way\n" "[('red', 1), ('red', 2), ('blue', 1), ('blue', 2)]" msgstr "" +">>> data = [('red', 1), ('blue', 1), ('red', 2), ('blue', 2)]\n" +">>> standard_way = sorted(data, key=itemgetter(0), reverse=True)\n" +">>> double_reversed = list(reversed(sorted(reversed(data), " +"key=itemgetter(0))))\n" +">>> assert standard_way == double_reversed\n" +">>> standard_way\n" +"[('red', 1), ('red', 2), ('blue', 1), ('blue', 2)]" #: ../../howto/sorting.rst:364 msgid "" @@ -662,12 +746,14 @@ msgstr "" "ラスに標準のソート順序を追加することは :meth:`~object.__lt__` メソッドを定義" "することで達成できます。" -#: ../../howto/sorting.rst:368 msgid "" ">>> Student.__lt__ = lambda self, other: self.age < other.age\n" ">>> sorted(student_objects)\n" "[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]" msgstr "" +">>> Student.__lt__ = lambda self, other: self.age < other.age\n" +">>> sorted(student_objects)\n" +"[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]" #: ../../howto/sorting.rst:374 msgid "" @@ -694,13 +780,16 @@ msgstr "" "ソースにアクセスすることもできます。例えば学生の成績が辞書に保存されている場" "合、それを利用して別の学生の名前のリストをソートすることができます:" -#: ../../howto/sorting.rst:386 msgid "" ">>> students = ['dave', 'john', 'jane']\n" ">>> newgrades = {'john': 'F', 'jane':'A', 'dave': 'C'}\n" ">>> sorted(students, key=newgrades.__getitem__)\n" "['jane', 'dave', 'john']" msgstr "" +">>> students = ['dave', 'john', 'jane']\n" +">>> newgrades = {'john': 'F', 'jane':'A', 'dave': 'C'}\n" +">>> sorted(students, key=newgrades.__getitem__)\n" +"['jane', 'dave', 'john']" #: ../../howto/sorting.rst:394 msgid "Partial Sorts" diff --git a/howto/unicode.po b/howto/unicode.po index a691aa863..82b0d49be 100644 --- a/howto/unicode.po +++ b/howto/unicode.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: Takanori Suzuki , 2023\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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/unicode.rst:5 @@ -102,7 +102,6 @@ msgstr "" "例えば、「ローマ数字の 1」という文字 'Ⅰ' は大文字の 'I' とは別の文字です。\n" "両者は通常は同じに見えますが、異なる意味を持つ別々の2つの文字です。" -#: ../../howto/unicode.rst:42 msgid "" "The Unicode standard describes how characters are represented by **code " "points**. A code point value is an integer in the range 0 to 0x10FFFF " @@ -111,6 +110,12 @@ msgid "" "this document, a code point is written using the notation ``U+265E`` to mean " "the character with value ``0x265e`` (9,822 in decimal)." msgstr "" +"Unicode 標準は、文字を **コードポイント** で表す方法を定めています。\n" +"コードポイントの値は 0 から 0x10FFFF までの整数です (約 110 万個の値があり、`" +"実際に割り当てられた数 `_ " +"はそれより少なくなっています)。\n" +"標準とこの文書では、``U+265E`` という表記で、値が ``0x265e`` (10 進数では " +"9,822) の文字を表します。" #: ../../howto/unicode.rst:50 msgid "" @@ -120,7 +125,6 @@ msgstr "" "Unicode 標準は、文字とそれに対応するコードポイントを列挙した多くの表を含んで" "います:" -#: ../../howto/unicode.rst:53 msgid "" "0061 'a'; LATIN SMALL LETTER A\n" "0062 'b'; LATIN SMALL LETTER B\n" @@ -138,6 +142,21 @@ msgid "" "1F609 '😉'; WINKING FACE\n" "..." msgstr "" +"0061 'a'; LATIN SMALL LETTER A\n" +"0062 'b'; LATIN SMALL LETTER B\n" +"0063 'c'; LATIN SMALL LETTER C\n" +"...\n" +"007B '{'; LEFT CURLY BRACKET\n" +"...\n" +"2167 'Ⅷ'; ROMAN NUMERAL EIGHT\n" +"2168 'Ⅸ'; ROMAN NUMERAL NINE\n" +"...\n" +"265E '♞'; BLACK CHESS KNIGHT\n" +"265F '♟'; BLACK CHESS PAWN\n" +"...\n" +"1F600 '😀'; GRINNING FACE\n" +"1F609 '😉'; WINKING FACE\n" +"..." #: ../../howto/unicode.rst:71 msgid "" @@ -189,19 +208,23 @@ msgstr "" "訳する規則を **文字エンコーディング** または単に **エンコーディング** と呼び" "ます。" -#: ../../howto/unicode.rst:97 msgid "" "The first encoding you might think of is using 32-bit integers as the code " "unit, and then using the CPU's representation of 32-bit integers. In this " "representation, the string \"Python\" might look like this:" msgstr "" +"最初に思い付くエンコーディングは、32 ビット整数をコードユニットとし、CPU の " +"32 ビット整数表現を使う方法かもしれません。\n" +"この方法では、文字列 \"Python\" は例えば次のように表されます。" -#: ../../howto/unicode.rst:101 msgid "" " P y t h o n\n" "0x50 00 00 00 79 00 00 00 74 00 00 00 68 00 00 00 6f 00 00 00 6e 00 00 00\n" " 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23" msgstr "" +" P y t h o n\n" +"0x50 00 00 00 79 00 00 00 74 00 00 00 68 00 00 00 6f 00 00 00 6e 00 00 00\n" +" 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23" #: ../../howto/unicode.rst:107 msgid "" @@ -242,13 +265,13 @@ msgstr "" "``strlen()`` のような現存する C 関数と互換性がありません、そのためワイド文字" "列関数一式が新たに必要となります。" -#: ../../howto/unicode.rst:123 msgid "" "Therefore this encoding isn't used very much, and people instead choose " "other encodings that are more efficient and convenient, such as UTF-8." msgstr "" +"そのため、このエンコーディングはあまり使われず、代わりに UTF-8 のような、より" +"効率的で便利なエンコーディングが選ばれます。" -#: ../../howto/unicode.rst:126 msgid "" "UTF-8 is one of the most commonly used encodings, and Python often defaults " "to using it. UTF stands for \"Unicode Transformation Format\", and the '8' " @@ -256,6 +279,13 @@ msgid "" "and UTF-32 encodings, but they are less frequently used than UTF-8.) UTF-8 " "uses the following rules:" msgstr "" +"UTF-8 は最も広く使われるエンコーディングの一つで、Python でもデフォルトとして" +"よく使われます。\n" +"UTF は \"Unicode Transformation Format\" の略で、「8」はエンコーディングに 8 " +"ビットの値を使うことを意味します。\n" +"(UTF-16 や UTF-32 というエンコーディングもありますが、UTF-8 ほど頻繁には使わ" +"れません。)\n" +"UTF-8 は次の規則に従います。" #: ../../howto/unicode.rst:132 msgid "" @@ -278,7 +308,6 @@ msgstr "UTF-8 はいくつかの便利な性質を持っています:" msgid "It can handle any Unicode code point." msgstr "任意の Unicode コードポイントを扱うことができる。" -#: ../../howto/unicode.rst:139 msgid "" "A Unicode string is turned into a sequence of bytes that contains embedded " "zero bytes only where they represent the null character (U+0000). This means " @@ -286,6 +315,10 @@ msgid "" "sent through protocols that can't handle zero bytes for anything other than " "end-of-string markers." msgstr "" +"Unicode 文字列をバイト列に変換したとき、値がゼロのバイトが含まれるのは、それ" +"がヌル文字 (U+0000) を表す場合だけです。\n" +"そのため、UTF-8 文字列は ``strcpy()`` などの C 関数で処理でき、文字列の終端以" +"外ではゼロのバイトを扱えないプロトコルでも送信できます。" #: ../../howto/unicode.rst:144 msgid "A string of ASCII text is also valid UTF-8 text." @@ -309,7 +342,6 @@ msgstr "" "の開始を決定し、再同期することができる可能性があります。同様の理由でランダム" "な 8-bit データは正当な UTF-8 とみなされにくくなっています。" -#: ../../howto/unicode.rst:150 msgid "" "UTF-8 is a byte oriented encoding. The encoding specifies that each " "character is represented by a specific sequence of one or more bytes. This " @@ -317,6 +349,12 @@ msgid "" "oriented encodings, like UTF-16 and UTF-32, where the sequence of bytes " "varies depending on the hardware on which the string was encoded." msgstr "" +"UTF-8 はバイト単位のエンコーディングです。\n" +"各文字を、決まった 1 バイト以上の並びで表すように定めています。\n" +"そのため、整数やワード単位のエンコーディングで生じ得るバイト順の問題を避けら" +"れます。\n" +"例えば UTF-16 や UTF-32 では、文字列をエンコードしたハードウェアによってバイ" +"トの並びが変わります。" #: ../../howto/unicode.rst:158 ../../howto/unicode.rst:514 #: ../../howto/unicode.rst:735 @@ -336,12 +374,14 @@ msgstr "" "悟してください。Unicode の起源と発展の `年表 `_ もサイトにあります。" -#: ../../howto/unicode.rst:165 msgid "" "On the Computerphile Youtube channel, Tom Scott briefly `discusses the " "history of Unicode and UTF-8 `_ " "(9 minutes 36 seconds)." msgstr "" +"Computerphile の YouTube チャンネルでは、Tom Scott が `Unicode と UTF-8 の歴" +"史を簡潔に説明しています `_ (9 " +"分 36 秒)。" #: ../../howto/unicode.rst:169 msgid "" @@ -352,7 +392,6 @@ msgstr "" "標準を理解する助けにするために、Jukka Korpela が Unicode 文字表を読むための `" "入門ガイド `_ を書いています。" -#: ../../howto/unicode.rst:173 msgid "" "Another `good introductory article `_ もありま" +"す。\n" +"ここまでの説明で理解できなかった場合は、先に進む前にそちらの記事を読んでみて" +"ください。" #: ../../howto/unicode.rst:178 msgid "" @@ -387,13 +432,15 @@ msgstr "" msgid "The String Type" msgstr "文字列型" -#: ../../howto/unicode.rst:192 msgid "" "Since Python 3.0, the language's :class:`str` type contains Unicode " "characters, meaning any string created using ``\"unicode rocks!\"``, " "``'unicode rocks!'``, or the triple-quoted string syntax is stored as " "Unicode." msgstr "" +"Python 3.0 以降、:class:`str` 型は Unicode 文字を格納します。\n" +"つまり、``\"unicode rocks!\"``、``'unicode rocks!'``、または三重引用符の文字" +"列構文で作った文字列は、すべて Unicode として保存されます。" #: ../../howto/unicode.rst:196 msgid "" @@ -403,7 +450,6 @@ msgstr "" "Python ソースコードのデフォルトエンコーディングは UTF-8 なので、文字列リテラ" "ルの中に Unicode 文字をそのまま含めることができます::" -#: ../../howto/unicode.rst:199 msgid "" "try:\n" " with open('/tmp/input.txt', 'r') as f:\n" @@ -412,32 +458,39 @@ msgid "" " # 'File not found' error message.\n" " print(\"Fichier non trouvé\")" msgstr "" +"try:\n" +" with open('/tmp/input.txt', 'r') as f:\n" +" ...\n" +"except OSError:\n" +" # 「ファイルが見つからない」というエラーメッセージ。\n" +" print(\"Fichier non trouvé\")" #: ../../howto/unicode.rst:206 msgid "" "Side note: Python 3 also supports using Unicode characters in identifiers::" msgstr "追記: Python3 は Unicode 文字を使った識別子もサポートしています::" -#: ../../howto/unicode.rst:208 msgid "" "répertoire = \"/tmp/records.log\"\n" "with open(répertoire, \"w\") as f:\n" " f.write(\"test\\n\")" msgstr "" +"répertoire = \"/tmp/records.log\"\n" +"with open(répertoire, \"w\") as f:\n" +" f.write(\"test\\n\")" -#: ../../howto/unicode.rst:212 msgid "" "If you can't enter a particular character in your editor or want to keep the " "source code ASCII-only for some reason, you can also use escape sequences in " "string literals. (Depending on your system, you may see the actual capital-" "delta glyph instead of a \\u escape.) ::" msgstr "" -"エディタである特定の文字が入力できなかったり、とある理由でソースコードを " -"ASCII のみに保ちたい場合は、文字列リテラルでエスケープシーケンスが使えます。" -"(使ってるシステムによっては、\\u でエスケープされた文字列ではなく、実物の大文" -"字のラムダのグリフが見えるかもしれません。)::" +"エディターで特定の文字を入力できない場合や、何らかの理由でソースコードを " +"ASCII だけにしたい場合は、文字列リテラルでエスケープシーケンスを使えます。\n" +"(システムによっては、\\u エスケープではなく、実際の大文字のデルタのグリフが表" +"示される場合があります。\n" +") ::" -#: ../../howto/unicode.rst:217 msgid "" ">>> \"\\N{GREEK CAPITAL LETTER DELTA}\" # Using the character name\n" "'\\u0394'\n" @@ -446,6 +499,12 @@ msgid "" ">>> \"\\U00000394\" # Using a 32-bit hex value\n" "'\\u0394'" msgstr "" +">>> \"\\N{GREEK CAPITAL LETTER DELTA}\" # 文字名を使う\n" +"'\\u0394'\n" +">>> \"\\u0394\" # 16 ビットの 16 進数を使う\n" +"'\\u0394'\n" +">>> \"\\U00000394\" # 32 ビットの 16 進数を使う\n" +"'\\u0394'" #: ../../howto/unicode.rst:224 msgid "" @@ -474,7 +533,6 @@ msgstr "" "く) 、``'backslashreplace'`` (エスケープシーケンス ``\\xNN`` を挿入する) で" "す。次の例はこれらの違いを示しています::" -#: ../../howto/unicode.rst:236 msgid "" ">>> b'\\x80abc'.decode(\"utf-8\", \"strict\")\n" "Traceback (most recent call last):\n" @@ -488,6 +546,17 @@ msgid "" ">>> b'\\x80abc'.decode(\"utf-8\", \"ignore\")\n" "'abc'" msgstr "" +">>> b'\\x80abc'.decode(\"utf-8\", \"strict\")\n" +"Traceback (most recent call last):\n" +" ...\n" +"UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 0:\n" +" invalid start byte\n" +">>> b'\\x80abc'.decode(\"utf-8\", \"replace\")\n" +"'\\ufffdabc'\n" +">>> b'\\x80abc'.decode(\"utf-8\", \"backslashreplace\")\n" +"'\\\\x80abc'\n" +">>> b'\\x80abc'.decode(\"utf-8\", \"ignore\")\n" +"'abc'" #: ../../howto/unicode.rst:248 msgid "" @@ -516,13 +585,16 @@ msgstr "" "文字列を返します。逆の操作は :func:`ord` 組み込み関数です、この関数は一文字" "の Unicode 文字列を引数にとり、コードポイント値を返します::" -#: ../../howto/unicode.rst:260 msgid "" ">>> chr(57344)\n" "'\\ue000'\n" ">>> ord('\\ue000')\n" "57344" msgstr "" +">>> chr(57344)\n" +"'\\ue000'\n" +">>> ord('\\ue000')\n" +"57344" #: ../../howto/unicode.rst:266 msgid "Converting to Bytes" @@ -538,7 +610,6 @@ msgstr "" "のメソッドは、 Unicode 文字列を指定された *encoding* でエンコードして、 :" "class:`bytes` による表現で返します。" -#: ../../howto/unicode.rst:272 msgid "" "The *errors* parameter is the same as the parameter of the :meth:`~bytes." "decode` method but supports a few more possible handlers. As well as " @@ -553,14 +624,13 @@ msgstr "" "``'strict'`` 、 ``'ignore'`` 、 ``'replace'`` (このメソッドでは、エンコードで" "きなかった文字の代わりに疑問符を挿入する) の他に、 ``'xmlcharrefreplace'`` " "(XML 文字参照を挿入する) と ``backslashreplace`` (エスケープシーケンス " -"``\\nNNNN`` を挿入する)、 ``namereplace`` (エスケープシーケンス ``\\N{...}`` " +"``\\uNNNN`` を挿入する)、 ``namereplace`` (エスケープシーケンス ``\\N{...}`` " "を挿入する) があります。" #: ../../howto/unicode.rst:280 msgid "The following example shows the different results::" msgstr "次の例では、それぞれの異なる処理結果が示されています::" -#: ../../howto/unicode.rst:282 msgid "" ">>> u = chr(40960) + 'abcd' + chr(1972)\n" ">>> u.encode('utf-8')\n" @@ -581,6 +651,24 @@ msgid "" ">>> u.encode('ascii', 'namereplace')\n" "b'\\\\N{YI SYLLABLE IT}abcd\\\\u07b4'" msgstr "" +">>> u = chr(40960) + 'abcd' + chr(1972)\n" +">>> u.encode('utf-8')\n" +"b'\\xea\\x80\\x80abcd\\xde\\xb4'\n" +">>> u.encode('ascii')\n" +"Traceback (most recent call last):\n" +" ...\n" +"UnicodeEncodeError: 'ascii' codec can't encode character '\\ua000' in\n" +" position 0: ordinal not in range(128)\n" +">>> u.encode('ascii', 'ignore')\n" +"b'abcd'\n" +">>> u.encode('ascii', 'replace')\n" +"b'?abcd?'\n" +">>> u.encode('ascii', 'xmlcharrefreplace')\n" +"b'ꀀabcd޴'\n" +">>> u.encode('ascii', 'backslashreplace')\n" +"b'\\\\ua000abcd\\\\u07b4'\n" +">>> u.encode('ascii', 'namereplace')\n" +"b'\\\\N{YI SYLLABLE IT}abcd\\\\u07b4'" #: ../../howto/unicode.rst:301 msgid "" @@ -613,7 +701,6 @@ msgstr "" "``\\u`` を使い、続けてコードポイントを4桁の16進数を書きます。エスケープシーケ" "ンス ``\\U`` も同様です、ただし4桁ではなく8桁の16進数を使います::" -#: ../../howto/unicode.rst:317 msgid "" ">>> s = \"a\\xac\\u1234\\u20ac\\U00008000\"\n" "... # ^^^^ two-digit hex escape\n" @@ -622,6 +709,12 @@ msgid "" ">>> [ord(c) for c in s]\n" "[97, 172, 4660, 8364, 32768]" msgstr "" +">>> s = \"a\\xac\\u1234\\u20ac\\U00008000\"\n" +"... # ^^^^ 2 桁の 16 進エスケープ\n" +"... # ^^^^^^ 4 桁の Unicode エスケープ\n" +"... # ^^^^^^^^^^ 8 桁の Unicode エスケープ\n" +">>> [ord(c) for c in s]\n" +"[97, 172, 4660, 8364, 32768]" #: ../../howto/unicode.rst:324 msgid "" @@ -660,7 +753,6 @@ msgstr "" "はソースファイルの一行目や二行目に特別なコメントを含めることによってできま" "す::" -#: ../../howto/unicode.rst:339 msgid "" "#!/usr/bin/env python\n" "# -*- coding: latin-1 -*-\n" @@ -668,6 +760,11 @@ msgid "" "u = 'abcdé'\n" "print(ord(u[-1]))" msgstr "" +"#!/usr/bin/env python\n" +"# -*- coding: latin-1 -*-\n" +"\n" +"u = 'abcdé'\n" +"print(ord(u[-1]))" #: ../../howto/unicode.rst:345 msgid "" @@ -696,7 +793,6 @@ msgstr "" msgid "Unicode Properties" msgstr "Unicode プロパティ" -#: ../../howto/unicode.rst:358 msgid "" "The Unicode specification includes a database of information about code " "points. For each defined code point, the information includes the " @@ -705,6 +801,13 @@ msgid "" "fractions such as one-third and four-fifths, etc.). There are also display-" "related properties, such as how to use the code point in bidirectional text." msgstr "" +"Unicode の仕様には、コードポイントに関する情報のデータベースが含まれていま" +"す。\n" +"定義済みのコードポイントごとに、文字名、カテゴリー、該当する場合は数値 (ロー" +"マ数字や、3 分の 1、5 分の 4 などの分数といった、数の概念を表す文字の場合) が" +"記録されています。\n" +"双方向テキストでのコードポイントの使い方など、表示に関するプロパティもありま" +"す。" #: ../../howto/unicode.rst:366 msgid "" @@ -714,7 +817,6 @@ msgstr "" "以下のプログラムはいくつかの文字に対する情報を表示し、特定の文字の数値を印字" "します::" -#: ../../howto/unicode.rst:369 msgid "" "import unicodedata\n" "\n" @@ -727,12 +829,21 @@ msgid "" "# Get numeric value of second character\n" "print(unicodedata.numeric(u[1]))" msgstr "" +"import unicodedata\n" +"\n" +"u = chr(233) + chr(0x0bf2) + chr(3972) + chr(6000) + chr(13231)\n" +"\n" +"for i, c in enumerate(u):\n" +" print(i, '%04x' % ord(c), unicodedata.category(c), end=\" \")\n" +" print(unicodedata.name(c))\n" +"\n" +"# 2 番目の文字の数値を取得する\n" +"print(unicodedata.numeric(u[1]))" #: ../../howto/unicode.rst:380 msgid "When run, this prints:" msgstr "実行すると、このように出力されます::" -#: ../../howto/unicode.rst:382 msgid "" "0 00e9 Ll LATIN SMALL LETTER E WITH ACUTE\n" "1 0bf2 No TAMIL NUMBER ONE THOUSAND\n" @@ -741,6 +852,12 @@ msgid "" "4 33af So SQUARE RAD OVER S SQUARED\n" "1000.0" msgstr "" +"0 00e9 Ll LATIN SMALL LETTER E WITH ACUTE\n" +"1 0bf2 No TAMIL NUMBER ONE THOUSAND\n" +"2 0f84 Mn TIBETAN MARK HALANTA\n" +"3 1770 Lo TAGBANWA LETTER SA\n" +"4 33af So SQUARE RAD OVER S SQUARED\n" +"1000.0" #: ../../howto/unicode.rst:391 msgid "" @@ -763,11 +880,9 @@ msgstr "" "Values 節 `_ " "を参照してください。" -#: ../../howto/unicode.rst:402 msgid "Comparing Strings" -msgstr "" +msgstr "文字列の比較" -#: ../../howto/unicode.rst:404 msgid "" "Unicode adds some complication to comparing strings, because the same set of " "characters can be represented by different sequences of code points. For " @@ -776,8 +891,14 @@ msgid "" "point for 'COMBINING CIRCUMFLEX ACCENT'. These will produce the same output " "when printed, but one is a string of length 1 and the other is of length 2." msgstr "" +"Unicode では、同じ文字の並びを異なるコードポイント列で表せるため、文字列の比" +"較が少し複雑になります。\n" +"例えば「ê」は、一つのコードポイント U+00EA でも、U+0065 U+0302 という並びでも" +"表せます。\n" +"後者は「e」のコードポイントの後に「COMBINING CIRCUMFLEX ACCENT」のコードポイ" +"ントを置いたものです。\n" +"表示すると同じ出力になりますが、一方は長さ 1、もう一方は長さ 2 の文字列です。" -#: ../../howto/unicode.rst:412 msgid "" "One tool for a case-insensitive comparison is the :meth:`~str.casefold` " "string method that converts a string to a case-insensitive form following an " @@ -785,13 +906,21 @@ msgid "" "handling for characters such as the German letter 'ß' (code point U+00DF), " "which becomes the pair of lowercase letters 'ss'." msgstr "" +"大文字と小文字を区別しない比較に使える方法の一つが、文字列の :meth:`~str." +"casefold` メソッドです。\n" +"Unicode 標準のアルゴリズムに従い、大文字と小文字を区別しない形式に文字列を変" +"換します。\n" +"このアルゴリズムは、ドイツ語の「ß」(コードポイント U+00DF) などの文字を特別に" +"扱い、この文字は小文字二つの「ss」に変換されます。" -#: ../../howto/unicode.rst:421 msgid "" ">>> street = 'Gürzenichstraße'\n" ">>> street.casefold()\n" "'gürzenichstrasse'" msgstr "" +">>> street = 'Gürzenichstraße'\n" +">>> street.casefold()\n" +"'gürzenichstrasse'" #: ../../howto/unicode.rst:425 msgid "" @@ -803,7 +932,6 @@ msgid "" "combining characters differently:" msgstr "" -#: ../../howto/unicode.rst:434 msgid "" "import unicodedata\n" "\n" @@ -820,31 +948,49 @@ msgid "" "print('length of second string=', len(multiple_chars))\n" "print(compare_strs(single_char, multiple_chars))" msgstr "" +"import unicodedata\n" +"\n" +"def compare_strs(s1, s2):\n" +" def NFD(s):\n" +" return unicodedata.normalize('NFD', s)\n" +"\n" +" return NFD(s1) == NFD(s2)\n" +"\n" +"single_char = 'ê'\n" +"multiple_chars = '\\N{LATIN SMALL LETTER E}\\N{COMBINING CIRCUMFLEX " +"ACCENT}'\n" +"print('length of first string=', len(single_char))\n" +"print('length of second string=', len(multiple_chars))\n" +"print(compare_strs(single_char, multiple_chars))" #: ../../howto/unicode.rst:448 msgid "When run, this outputs:" msgstr "実行すると、このように出力されます:" -#: ../../howto/unicode.rst:450 msgid "" "$ python compare-strs.py\n" "length of first string= 1\n" "length of second string= 2\n" "True" msgstr "" +"$ python compare-strs.py\n" +"length of first string= 1\n" +"length of second string= 2\n" +"True" -#: ../../howto/unicode.rst:457 msgid "" "The first argument to the :func:`~unicodedata.normalize` function is a " "string giving the desired normalization form, which can be one of 'NFC', " "'NFKC', 'NFD', and 'NFKD'." msgstr "" +":func:`~unicodedata.normalize` 関数の最初の引数は、目的の正規化形式を表す文字" +"列です。\n" +"'NFC'、'NFKC'、'NFD'、'NFKD' のいずれかを指定できます。" -#: ../../howto/unicode.rst:461 msgid "The Unicode Standard also specifies how to do caseless comparisons::" msgstr "" +"Unicode 標準には、大文字と小文字を区別しない比較の方法も定められています。 ::" -#: ../../howto/unicode.rst:463 msgid "" "import unicodedata\n" "\n" @@ -861,14 +1007,32 @@ msgid "" "\n" "print(compare_caseless(single_char, multiple_chars))" msgstr "" +"import unicodedata\n" +"\n" +"def compare_caseless(s1, s2):\n" +" def NFD(s):\n" +" return unicodedata.normalize('NFD', s)\n" +"\n" +" return NFD(NFD(s1).casefold()) == NFD(NFD(s2).casefold())\n" +"\n" +"# 使用例\n" +"single_char = 'ê'\n" +"multiple_chars = '\\N{LATIN CAPITAL LETTER E}\\N{COMBINING CIRCUMFLEX " +"ACCENT}'\n" +"\n" +"print(compare_caseless(single_char, multiple_chars))" -#: ../../howto/unicode.rst:477 msgid "" "This will print ``True``. (Why is :func:`!NFD` invoked twice? Because " "there are a few characters that make :meth:`~str.casefold` return a non-" "normalized string, so the result needs to be normalized again. See section " "3.13 of the Unicode Standard for a discussion and an example.)" msgstr "" +"この例は ``True`` を表示します。\n" +"(:func:`!NFD` を 2 回呼び出すのはなぜでしょうか。\n" +"一部の文字では :meth:`~str.casefold` が正規化されていない文字列を返すため、結" +"果をもう一度正規化する必要があるからです。\n" +"説明と例は Unicode 標準の 3.13 節を参照してください。)" #: ../../howto/unicode.rst:484 msgid "Unicode Regular Expressions" @@ -889,15 +1053,13 @@ msgstr "" "る意味を持ちます。例えば、 ``\\d`` はバイト列では ``[0-9]`` の範囲の文字と一" "致しますが、文字列では ``'Nd'`` カテゴリーにある任意の文字と一致します。" -#: ../../howto/unicode.rst:493 msgid "" "The string in this example has the number 57 written in both Thai and Arabic " "numerals::" msgstr "" "この例にある文字列には、タイ語の数字とアラビア数字の両方で数字の 57 が書いて" -"あります。" +"あります。 ::" -#: ../../howto/unicode.rst:496 msgid "" "import re\n" "p = re.compile(r'\\d+')\n" @@ -906,6 +1068,12 @@ msgid "" "m = p.search(s)\n" "print(repr(m.group()))" msgstr "" +"import re\n" +"p = re.compile(r'\\d+')\n" +"\n" +"s = \"Over \\u0e55\\u0e57 57 flavours\"\n" +"m = p.search(s)\n" +"print(repr(m.group()))" #: ../../howto/unicode.rst:503 msgid "" @@ -917,15 +1085,14 @@ msgstr "" "const:`re.ASCII` を :func:`~re.compile` に渡した場合、 ``\\d+`` は先程とは" "違って部分文字列 \"57\" に一致します。" -#: ../../howto/unicode.rst:507 msgid "" "Similarly, ``\\w`` matches a wide variety of Unicode characters but only " "``[a-zA-Z0-9_]`` in bytes or if :const:`re.ASCII` is supplied, and ``\\s`` " "will match either Unicode whitespace characters or ``[ \\t\\n\\r\\f\\v]``." msgstr "" -"同様に、 ``\\w`` は非常に多くの Unicode 文字に一致しますが、バイト列の場合も" -"しくは :const:`re.ASCII` が渡された場合は ``[a-zA-Z0-9_]`` にしか一致しませ" -"ん。 ``\\s`` は文字列では Unicode 空白文字に、バイト列では " +"同様に、``\\w`` は幅広い Unicode 文字に一致しますが、バイト列の場合や :const:" +"`re.ASCII` を指定した場合には ``[a-zA-Z0-9_]`` だけに一致します。\n" +"``\\s`` も同じ条件に応じて、Unicode の空白文字、または " "``[ \\t\\n\\r\\f\\v]`` に一致します。" #: ../../howto/unicode.rst:518 @@ -992,7 +1159,6 @@ msgstr "" "力です。プログラムは Unicode 文字列をどう受けとり、どう Unicode を外部記憶装" "置や送受信装置に適した形式に変換するのでしょう?" -#: ../../howto/unicode.rst:544 msgid "" "It's possible that you may not need to do anything depending on your input " "sources and output destinations; you should check whether the libraries used " @@ -1000,13 +1166,13 @@ msgid "" "Unicode data, for example. Many relational databases also support Unicode-" "valued columns and can return Unicode values from an SQL query." msgstr "" -"入力ソースと出力先に依存しないような方法は可能です; アプリケーションに利用さ" -"れているライブラリが Unicode をそのままサポートしているかを調べなければいけま" -"せん。例えば XML パーサーは大抵 Unicode データを返します。多くのリレーショナ" -"ルデータベースも Unicode 値の入ったコラムをサポートしていますし、 SQL の問い" -"合わせで Unicode 値を返すことができます。" +"入力元と出力先によっては、何もする必要がないかもしれません。\n" +"アプリケーションで使っているライブラリが Unicode をそのまま扱えるか確認してく" +"ださい。\n" +"例えば、XML パーサーは多くの場合 Unicode データを返します。\n" +"多くのリレーショナルデータベースも Unicode 値の列をサポートし、SQL の問い合わ" +"せに Unicode 値を返せます。" -#: ../../howto/unicode.rst:550 msgid "" "Unicode data is usually converted to a particular encoding before it gets " "written to disk or sent over a socket. It's possible to do all the work " @@ -1014,10 +1180,12 @@ msgid "" "bytes with ``bytes.decode(encoding)``. However, the manual approach is not " "recommended." msgstr "" -"Unicode のデータはディスクに書き込まれたり、ソケットを介して送信されたりする" -"にあたって、通常、特定のエンコーディングに変換されます。推奨はされませんが、" -"これを手動で行うことも可能です。ファイルを開き、8バイトオブジェクトを読み込" -"み、バイト列を ``bytes.decode(encoding)`` で変換することにより実現できます。" +"Unicode データは通常、ディスクに書いたりソケット経由で送ったりする前に、特定" +"のエンコーディングに変換されます。\n" +"すべてを自分で処理することもできます。\n" +"ファイルを開き、8 ビットのバイトからなるオブジェクトを読み取り、``bytes." +"decode(encoding)`` でバイト列を変換します。\n" +"ただし、このように手動で処理する方法は推奨しません。" #: ../../howto/unicode.rst:555 msgid "" @@ -1059,12 +1227,14 @@ msgstr "" msgid "Reading Unicode from a file is therefore simple::" msgstr "そのためファイルから Unicode を読むのは単純です::" -#: ../../howto/unicode.rst:576 msgid "" "with open('unicode.txt', encoding='utf-8') as f:\n" " for line in f:\n" " print(repr(line))" msgstr "" +"with open('unicode.txt', encoding='utf-8') as f:\n" +" for line in f:\n" +" print(repr(line))" #: ../../howto/unicode.rst:580 msgid "" @@ -1072,13 +1242,16 @@ msgid "" "writing::" msgstr "読み書きの両方ができる update モードでファイルを開くことも可能です::" -#: ../../howto/unicode.rst:583 msgid "" "with open('test', encoding='utf-8', mode='w+') as f:\n" " f.write('\\u4500 blah blah blah\\n')\n" " f.seek(0)\n" " print(repr(f.readline()[:1]))" msgstr "" +"with open('test', encoding='utf-8', mode='w+') as f:\n" +" f.write('\\u4500 blah blah blah\\n')\n" +" f.seek(0)\n" +" print(repr(f.readline()[:1]))" #: ../../howto/unicode.rst:588 msgid "" @@ -1101,7 +1274,6 @@ msgstr "" "ディアン (big-endian) 用の 'utf-16-be' というような変種があり、これらは特定の" "1つのバイト順を指定していて BOM をスキップしません。" -#: ../../howto/unicode.rst:597 msgid "" "In some areas, it is also convention to use a \"BOM\" at the start of UTF-8 " "encoded files; the name is misleading since UTF-8 is not byte-order " @@ -1109,6 +1281,12 @@ msgid "" "reading such files, use the 'utf-8-sig' codec to automatically skip the mark " "if present." msgstr "" +"UTF-8 でエンコードされたファイルの先頭にも「BOM」を付ける慣習がある分野があり" +"ます。\n" +"UTF-8 はバイト順に依存しないため、この名前は紛らわしいものです。\n" +"このマークは、ファイルが UTF-8 でエンコードされていることを示すだけです。\n" +"このようなファイルを読むときは、'utf-8-sig' コーデックを使えば、マークがあっ" +"た場合に自動的に読み飛ばせます。" #: ../../howto/unicode.rst:604 msgid "Unicode filenames" @@ -1141,12 +1319,14 @@ msgstr "" "イル名を Unicode 文字列として渡すだけで正しいエンコーディングに自動的に変更さ" "れます::" -#: ../../howto/unicode.rst:622 msgid "" "filename = 'filename\\u4500abc'\n" "with open(filename, 'w') as f:\n" " f.write('blah\\n')" msgstr "" +"filename = 'filename\\u4500abc'\n" +"with open(filename, 'w') as f:\n" +" f.write('blah\\n')" #: ../../howto/unicode.rst:626 msgid "" @@ -1156,7 +1336,6 @@ msgstr "" ":func:`os.stat` のような :mod:`os` モジュールの関数も Unicode のファイル名を" "受け付けます。" -#: ../../howto/unicode.rst:629 msgid "" "The :func:`os.listdir` function returns filenames, which raises an issue: " "should it return the Unicode version of filenames, or should it return bytes " @@ -1168,8 +1347,17 @@ msgid "" "assuming the default :term:`filesystem encoding ` is UTF-8, running the following program::" msgstr "" +":func:`os.listdir` 関数はファイル名を返しますが、ここで問題になるのは、ファイ" +"ル名を Unicode で返すべきか、エンコードしたバイト列で返すべきかということで" +"す。\n" +":func:`os.listdir` は、ディレクトリのパスをバイト列と Unicode 文字列のどちら" +"で渡すかに応じて、両方に対応します。\n" +"パスを Unicode 文字列で渡すと、ファイル名をファイルシステムのエンコーディング" +"でデコードし、Unicode 文字列のリストを返します。\n" +"バイト列でパスを渡すと、ファイル名もバイト列で返します。\n" +"例えば、デフォルトの :term:`ファイルシステムエンコーディング ` が UTF-8 の場合、次のプログラムを実行すると、 ::" -#: ../../howto/unicode.rst:639 msgid "" "fn = 'filename\\u4500abc'\n" "f = open(fn, 'w')\n" @@ -1179,17 +1367,26 @@ msgid "" "print(os.listdir(b'.'))\n" "print(os.listdir('.'))" msgstr "" +"fn = 'filename\\u4500abc'\n" +"f = open(fn, 'w')\n" +"f.close()\n" +"\n" +"import os\n" +"print(os.listdir(b'.'))\n" +"print(os.listdir('.'))" #: ../../howto/unicode.rst:647 msgid "will produce the following output:" msgstr "以下の出力結果が生成されます:" -#: ../../howto/unicode.rst:649 msgid "" "$ python listdir-test.py\n" "[b'filename\\xe4\\x94\\x80abc', ...]\n" "['filename\\u4500abc', ...]" msgstr "" +"$ python listdir-test.py\n" +"[b'filename\\xe4\\x94\\x80abc', ...]\n" +"['filename\\u4500abc', ...]" #: ../../howto/unicode.rst:655 msgid "" @@ -1199,13 +1396,16 @@ msgstr "" "最初のリストは UTF-8 でエンコーディングされたファイル名を含み、第二のリスト" "は Unicode 版を含んでいます。" -#: ../../howto/unicode.rst:658 msgid "" "Note that on most occasions, you should can just stick with using Unicode " "with these APIs. The bytes APIs should only be used on systems where " "undecodable file names can be present; that's pretty much only Unix systems " "now." msgstr "" +"ほとんどの場合、これらの API では Unicode を使えば十分です。\n" +"バイト列の API は、デコードできないファイル名が存在し得るシステムでのみ使うべ" +"きです。\n" +"現在では、ほぼ Unix システムに限られます。" #: ../../howto/unicode.rst:665 msgid "Tips for Writing Unicode-aware Programs" @@ -1230,7 +1430,6 @@ msgstr "" "ソフトウェアは内部では Unicode 文字列のみを利用し、入力データはできるだけ早期" "にデコードし、出力の直前でエンコードすべきです。" -#: ../../howto/unicode.rst:675 msgid "" "If you attempt to write processing functions that accept both Unicode and " "byte strings, you will find your program vulnerable to bugs wherever you " @@ -1238,6 +1437,10 @@ msgid "" "or decoding: if you do e.g. ``str + bytes``, a :exc:`TypeError` will be " "raised." msgstr "" +"Unicode 文字列とバイト列の両方を受け付ける処理関数を書こうとすると、この二種" +"類を組み合わせるあらゆる箇所でバグが生じやすくなります。\n" +"自動的なエンコードやデコードは行われません。\n" +"例えば ``str + bytes`` を行うと :exc:`TypeError` が送出されます。" #: ../../howto/unicode.rst:680 msgid "" @@ -1264,20 +1467,23 @@ msgstr "" msgid "Converting Between File Encodings" msgstr "ファイルエンコーディングの変換" -#: ../../howto/unicode.rst:693 msgid "" "The :class:`~codecs.StreamRecoder` class can transparently convert between " "encodings, taking a stream that returns data in encoding #1 and behaving " "like a stream returning data in encoding #2." msgstr "" +":class:`~codecs.StreamRecoder` クラスは、エンコーディング間の変換を透過的に行" +"えます。\n" +"エンコーディング #1 でデータを返すストリームを受け取り、エンコーディング #2 " +"でデータを返すストリームとして動作します。" -#: ../../howto/unicode.rst:697 msgid "" "For example, if you have an input file *f* that's in Latin-1, you can wrap " "it with a :class:`~codecs.StreamRecoder` to return bytes encoded in UTF-8::" msgstr "" +"例えば、Latin-1 の入力ファイル ``f`` を :class:`~codecs.StreamRecoder` でラッ" +"プすると、UTF-8 でエンコードされたバイト列を返すようにできます。 ::" -#: ../../howto/unicode.rst:701 msgid "" "new_f = codecs.StreamRecoder(f,\n" " # en/decoder: used by read() to encode its results and\n" @@ -1287,20 +1493,30 @@ msgid "" " # reader/writer: used to read and write to the stream.\n" " codecs.getreader('latin-1'), codecs.getwriter('latin-1') )" msgstr "" +"new_f = codecs.StreamRecoder(f,\n" +" # エンコーダー/デコーダー: read() の結果のエンコードと\n" +" # write() の入力のデコードに使う。\n" +" codecs.getencoder('utf-8'), codecs.getdecoder('utf-8'),\n" +"\n" +" # リーダー/ライター: ストリームの読み書きに使う。\n" +" codecs.getreader('latin-1'), codecs.getwriter('latin-1') )" #: ../../howto/unicode.rst:711 msgid "Files in an Unknown Encoding" msgstr "不明なエンコーディングのファイル" -#: ../../howto/unicode.rst:713 msgid "" "What can you do if you need to make a change to a file, but don't know the " "file's encoding? If you know the encoding is ASCII-compatible and only want " "to examine or modify the ASCII parts, you can open the file with the " "``surrogateescape`` error handler::" msgstr "" +"ファイルを変更したいのに、そのエンコーディングが分からない場合はどうすればよ" +"いでしょうか。\n" +"ASCII 互換のエンコーディングだと分かっていて、ASCII の部分だけを調べたり変更" +"したりしたい場合は、``surrogateescape`` エラーハンドラーを指定してファイルを" +"開けます。 ::" -#: ../../howto/unicode.rst:718 msgid "" "with open(fname, 'r', encoding=\"ascii\", errors=\"surrogateescape\") as f:\n" " data = f.read()\n" @@ -1311,23 +1527,35 @@ msgid "" " encoding=\"ascii\", errors=\"surrogateescape\") as f:\n" " f.write(data)" msgstr "" +"with open(fname, 'r', encoding=\"ascii\", errors=\"surrogateescape\") as f:\n" +" data = f.read()\n" +"\n" +"# 文字列 'data' を変更する\n" +"\n" +"with open(fname + '.new', 'w',\n" +" encoding=\"ascii\", errors=\"surrogateescape\") as f:\n" +" f.write(data)" -#: ../../howto/unicode.rst:727 msgid "" "The ``surrogateescape`` error handler will decode any non-ASCII bytes as " "code points in a special range running from U+DC80 to U+DCFF. These code " "points will then turn back into the same bytes when the ``surrogateescape`` " "error handler is used to encode the data and write it back out." msgstr "" +"``surrogateescape`` エラーハンドラーは、ASCII 以外のバイトを U+DC80 から " +"U+DCFF までの特別な範囲のコードポイントにデコードします。\n" +"``surrogateescape`` エラーハンドラーを使ってデータをエンコードし、書き戻す" +"と、これらのコードポイントは元と同じバイトに戻ります。" -#: ../../howto/unicode.rst:737 msgid "" "One section of `Mastering Python 3 Input/Output `_, a PyCon 2010 talk by David " "Beazley, discusses text processing and binary data handling." msgstr "" +"David Beazley による PyCon 2010 の講演 `Mastering Python 3 Input/Output " +"`_ では、テ" +"キスト処理とバイナリデータの扱いを説明する節があります。" -#: ../../howto/unicode.rst:741 msgid "" "The `PDF slides for Marc-André Lemburg's presentation \"Writing Unicode-" "aware Applications in Python\" から入手可能です、そして" -"文字エンコーディングの問題と同様にアプリケーションの国際化やローカライズにつ" -"いても議論されています。このスライドは Python 2.x のみをカバーしています。" +"`Marc-André Lemburg の講演 \"Writing Unicode-aware Applications in Python\" " +"の PDF スライド `_ は、文字エンコーディングの問題に" +"加え、アプリケーションの国際化とローカライズの方法を説明しています。\n" +"このスライドは Python 2.x だけを対象にしています。" -#: ../../howto/unicode.rst:747 msgid "" "`The Guts of Unicode in Python `_ is a PyCon 2013 talk by Benjamin Peterson that " "discusses the internal Unicode representation in Python 3.3." msgstr "" +"`The Guts of Unicode in Python `_ は、Python 3.3 の Unicode の内部表現を解説する、" +"Benjamin Peterson による PyCon 2013 の講演です。" #: ../../howto/unicode.rst:754 msgid "Acknowledgements" diff --git a/howto/urllib2.po b/howto/urllib2.po index b381a1c87..4e44c451d 100644 --- a/howto/urllib2.po +++ b/howto/urllib2.po @@ -20,10 +20,10 @@ msgstr "" "Last-Translator: TENMYO Masakazu, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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/urllib2.rst:5 @@ -62,7 +62,6 @@ msgstr "" msgid "A tutorial on *Basic Authentication*, with examples in Python." msgstr "*Basic 認証* についてのチュートリアルで Python の例がついています。" -#: ../../howto/urllib2.rst:22 msgid "" "**urllib.request** is a Python module for fetching URLs (Uniform Resource " "Locators). It offers a very simple interface, in the form of the *urlopen* " @@ -71,14 +70,14 @@ msgid "" "common situations - like basic authentication, cookies, proxies and so on. " "These are provided by objects called handlers and openers." msgstr "" -"**urllib.request** は URLs (Uniform Resource Locators) を取得するための " -"Python モジュールです。このモジュールはとても簡単なインターフェースを " -"*urlopen* 関数の形式で提供しています。また、このモジュールは一般的な状況で利" -"用するためにいくらか複雑なインターフェースも提供しています - basic 認証やクッ" -"キー、プロキシ等。これらは handler や opener と呼ばれるオブジェクトとして提供" -"されます。" +"**urllib.request** は、URL (Uniform Resource Locator) からリソースを取得する " +"Python モジュールです。\n" +"*urlopen* 関数という、とても単純なインターフェースを提供します。\n" +"この関数は、さまざまなプロトコルを使って URL からリソースを取得できます。\n" +"また、Basic 認証、クッキー、プロキシなど、よくある状況を扱うための、少し複雑" +"なインターフェースも提供します。\n" +"これらは handler や opener と呼ばれるオブジェクトによって提供されます。" -#: ../../howto/urllib2.rst:29 msgid "" "urllib.request supports fetching URLs for many \"URL schemes\" (identified " "by the string before the ``\":\"`` in URL - for example ``\"ftp\"`` is the " @@ -86,9 +85,11 @@ msgid "" "protocols (e.g. FTP, HTTP). This tutorial focuses on the most common case, " "HTTP." msgstr "" -"urllib.request は多くの \"URL スキーム\" (URL の \":\" の前の文字列で識別され" -"るもの - 例えば \"ftp://python.org/\" では \"ftp\") の URL を、関連するネット" -"ワークプロトコル(例えば FTP, HTTP) を利用することで、取得できます。" +"urllib.request は、多くの「URL スキーム」に対応するネットワークプロトコル " +"(FTP、HTTP など) を使って、URL からリソースを取得できます。\n" +"URL スキームは URL の ``\":\"`` より前の文字列で識別されます。\n" +"例えば、``\"ftp://python.org/\"`` の URL スキームは ``\"ftp\"`` です。\n" +"このチュートリアルでは、最も一般的な HTTP に焦点を当てます。" #: ../../howto/urllib2.rst:34 msgid "" @@ -118,12 +119,14 @@ msgstr "URL を取得する" msgid "The simplest way to use urllib.request is as follows::" msgstr "urllib.request を利用する最も簡単な方法は以下です::" -#: ../../howto/urllib2.rst:48 msgid "" "import urllib.request\n" "with urllib.request.urlopen('http://python.org/') as response:\n" " html = response.read()" msgstr "" +"import urllib.request\n" +"with urllib.request.urlopen('http://python.org/') as response:\n" +" html = response.read()" #: ../../howto/urllib2.rst:52 msgid "" @@ -135,7 +138,6 @@ msgstr "" "func:`shutil.copyfileobj` と :func:`tempfile.NamedTemporaryFile` 関数を使って" "行うことができます::" -#: ../../howto/urllib2.rst:56 msgid "" "import shutil\n" "import tempfile\n" @@ -148,6 +150,16 @@ msgid "" "with open(tmp_file.name) as html:\n" " pass" msgstr "" +"import shutil\n" +"import tempfile\n" +"import urllib.request\n" +"\n" +"with urllib.request.urlopen('http://python.org/') as response:\n" +" with tempfile.NamedTemporaryFile(delete=False) as tmp_file:\n" +" shutil.copyfileobj(response, tmp_file)\n" +"\n" +"with open(tmp_file.name) as html:\n" +" pass" #: ../../howto/urllib2.rst:67 msgid "" @@ -179,7 +191,6 @@ msgstr "" "オブジェクトで、これはつまりレスポンスに ``.read()`` と呼び出せることを意味し" "ています::" -#: ../../howto/urllib2.rst:80 msgid "" "import urllib.request\n" "\n" @@ -187,6 +198,11 @@ msgid "" "with urllib.request.urlopen(req) as response:\n" " the_page = response.read()" msgstr "" +"import urllib.request\n" +"\n" +"req = urllib.request.Request('http://python.org/')\n" +"with urllib.request.urlopen(req) as response:\n" +" the_page = response.read()" #: ../../howto/urllib2.rst:86 msgid "" @@ -196,9 +212,8 @@ msgstr "" "urllib.request は同じリクエストインターフェースを全ての URL スキームに対して" "利用できるようにしています。例えば、FTP リクエストの場合はこうできます::" -#: ../../howto/urllib2.rst:89 msgid "req = urllib.request.Request('ftp://example.com/')" -msgstr "" +msgstr "req = urllib.request.Request('ftp://example.com/')" #: ../../howto/urllib2.rst:91 msgid "" @@ -240,7 +255,6 @@ msgstr "" "ストオブジェクトに ``data`` 引数として渡します。エンコーディングは :mod:" "`urllib.parse` ライブラリの関数を使って行います。 ::" -#: ../../howto/urllib2.rst:110 msgid "" "import urllib.parse\n" "import urllib.request\n" @@ -256,6 +270,19 @@ msgid "" "with urllib.request.urlopen(req) as response:\n" " the_page = response.read()" msgstr "" +"import urllib.parse\n" +"import urllib.request\n" +"\n" +"url = 'http://www.someserver.com/cgi-bin/register.cgi'\n" +"values = {'name' : 'Michael Foord',\n" +" 'location' : 'Northampton',\n" +" 'language' : 'Python' }\n" +"\n" +"data = urllib.parse.urlencode(values)\n" +"data = data.encode('ascii') # data は bytes にする\n" +"req = urllib.request.Request(url, data)\n" +"with urllib.request.urlopen(req) as response:\n" +" the_page = response.read()" #: ../../howto/urllib2.rst:124 msgid "" @@ -268,7 +295,6 @@ msgstr "" "Specification, Form Submission `_ を見て下さい)。" -#: ../../howto/urllib2.rst:129 msgid "" "If you do not pass the ``data`` argument, urllib uses a **GET** request. One " "way in which GET and POST requests differ is that POST requests often have " @@ -280,21 +306,22 @@ msgid "" "side-effects, nor a POST requests from having no side-effects. Data can also " "be passed in an HTTP GET request by encoding it in the URL itself." msgstr "" -"``data`` 引数を渡さない場合、urllib は **GET** リクエストを利用します。GET " -"と POST リクエストの一つの違いは、POST リクエストにしばしば、「副作用」がある" -"ことです: POST リクエストはいくつかの方法によってシステムの状態を変化させま" -"す (例えば100ポンドのスパムの缶詰をドアの前まで配達する注文を web サイトで行" -"う)。とはいえ HTTP 標準で明確にされている内容では、POST は *常に* 副作用を持" -"ち、GET リクエストは *決して* 副作用を持たないことを意図するけれども、、GET " -"リクエストが副作用を持つことも、POST リクエストが副作用を持たないことも、妨げ" -"られません。HTTP の GET リクエストでもデータ自身をエンコーディングすることで" -"データを渡すことができます。" +"``data`` 引数を渡さない場合、urllib は **GET** リクエストを利用します。\n" +"GET と POST リクエストの一つの違いは、POST リクエストにしばしば、「副作用」が" +"あることです: POST リクエストはいくつかの方法によってシステムの状態を変化させ" +"ます (例えば100ポンドのスパムの缶詰をドアの前まで配達する注文を web サイトで" +"行う)。\n" +"とはいえ HTTP 標準で明確にされている内容では、POST は *常に* 副作用を持ち、" +"GET リクエストは *決して* 副作用を持たないことを意図するけれども、GET リクエ" +"ストが副作用を持つことも、POST リクエストが副作用を持たないことも、妨げられま" +"せん。\n" +"HTTP の GET リクエストでも、URL 自体にデータをエンコードすることでデータを渡" +"せます。" #: ../../howto/urllib2.rst:139 msgid "This is done as follows::" msgstr "以下のようにして行います::" -#: ../../howto/urllib2.rst:141 msgid "" ">>> import urllib.request\n" ">>> import urllib.parse\n" @@ -309,6 +336,18 @@ msgid "" ">>> full_url = url + '?' + url_values\n" ">>> data = urllib.request.urlopen(full_url)" msgstr "" +">>> import urllib.request\n" +">>> import urllib.parse\n" +">>> data = {}\n" +">>> data['name'] = 'Somebody Here'\n" +">>> data['location'] = 'Northampton'\n" +">>> data['language'] = 'Python'\n" +">>> url_values = urllib.parse.urlencode(data)\n" +">>> print(url_values) # 順序は下の出力と異なる場合がある。\n" +"name=Somebody+Here&language=Python&location=Northampton\n" +">>> url = 'http://www.example.com/example.cgi'\n" +">>> full_url = url + '?' + url_values\n" +">>> data = urllib.request.urlopen(full_url)" #: ../../howto/urllib2.rst:154 msgid "" @@ -352,7 +391,6 @@ msgstr "" "できます。以下の例は上の例と同じですが、自身を Internet Explorer [#]_ のバー" "ジョンの一つとして扱っています。 ::" -#: ../../howto/urllib2.rst:174 msgid "" "import urllib.parse\n" "import urllib.request\n" @@ -370,32 +408,50 @@ msgid "" "with urllib.request.urlopen(req) as response:\n" " the_page = response.read()" msgstr "" +"import urllib.parse\n" +"import urllib.request\n" +"\n" +"url = 'http://www.someserver.com/cgi-bin/register.cgi'\n" +"user_agent = 'Mozilla/5.0 (Windows NT 6.1; Win64; x64)'\n" +"values = {'name': 'Michael Foord',\n" +" 'location': 'Northampton',\n" +" 'language': 'Python' }\n" +"headers = {'User-Agent': user_agent}\n" +"\n" +"data = urllib.parse.urlencode(values)\n" +"data = data.encode('ascii')\n" +"req = urllib.request.Request(url, data, headers)\n" +"with urllib.request.urlopen(req) as response:\n" +" the_page = response.read()" -#: ../../howto/urllib2.rst:190 msgid "" "The response also has two useful methods. See the section on `info and " "geturl`_ which comes after we have a look at what happens when things go " "wrong." msgstr "" -"レスポンスは二つの便利なメソッドも持っています。 `info と geturl`_ の節を見て" -"下さい、この節は後で問題が起きた場合に見ておくべき内容です。" +"レスポンスには便利なメソッドが二つあります。\n" +"問題が起きたときの動作を説明した後の、`info と geturl `_ の" +"節を参照してください。" #: ../../howto/urllib2.rst:195 msgid "Handling Exceptions" msgstr "例外を処理する" -#: ../../howto/urllib2.rst:197 msgid "" "*urlopen* raises :exc:`~urllib.error.URLError` when it cannot handle a " "response (though as usual with Python APIs, built-in exceptions such as :exc:" "`ValueError`, :exc:`TypeError` etc. may also be raised)." msgstr "" +"*urlopen* はレスポンスを処理できない場合に :exc:`~urllib.error.URLError` を送" +"出します (ただし、他の Python API と同様に、:exc:`ValueError` や :exc:" +"`TypeError` などの組み込み例外が送出される場合もあります)。" -#: ../../howto/urllib2.rst:201 msgid "" ":exc:`~urllib.error.HTTPError` is the subclass of :exc:`~urllib.error." "URLError` raised in the specific case of HTTP URLs." msgstr "" +":exc:`~urllib.error.HTTPError` は :exc:`~urllib.error.URLError` のサブクラス" +"で、HTTP URL に固有の場合に送出されます。" #: ../../howto/urllib2.rst:204 msgid "The exception classes are exported from the :mod:`urllib.error` module." @@ -434,7 +490,6 @@ msgstr "" msgid "HTTPError" msgstr "HTTPError" -#: ../../howto/urllib2.rst:227 msgid "" "Every HTTP response from the server contains a numeric \"status code\". " "Sometimes the status code indicates that the server is unable to fulfil the " @@ -445,17 +500,29 @@ msgid "" "HTTPError`. Typical errors include '404' (page not found), '403' (request " "forbidden), and '401' (authentication required)." msgstr "" +"サーバーからのすべての HTTP レスポンスには、数値の「ステータスコード」が含ま" +"れます。\n" +"ステータスコードは、サーバーがリクエストを処理できないことを示す場合がありま" +"す。\n" +"デフォルトのハンドラーは、そうしたレスポンスの一部を処理します。\n" +"例えば、別の URL から文書を取得するようクライアントに要求する「リダイレクト」" +"の場合、urllib が処理します。\n" +"処理できないレスポンスに対しては、urlopen が :exc:`~urllib.error.HTTPError` " +"を送出します。\n" +"よくあるエラーには、'404' (ページが見つからない)、'403' (リクエストが禁止され" +"ている)、'401' (認証が必要) があります。" #: ../../howto/urllib2.rst:235 msgid "" "See section 10 of :rfc:`2616` for a reference on all the HTTP error codes." msgstr "HTTP のエラーコード全てについては :rfc:`2616` の10節を参照して下さい。" -#: ../../howto/urllib2.rst:237 msgid "" "The :exc:`~urllib.error.HTTPError` instance raised will have an integer " "'code' attribute, which corresponds to the error sent by the server." msgstr "" +"送出された :exc:`~urllib.error.HTTPError` インスタンスには、サーバーが送った" +"エラーに対応する整数の 'code' 属性があります。" #: ../../howto/urllib2.rst:241 msgid "Error Codes" @@ -565,7 +632,6 @@ msgstr "" "スポンスとして扱えます。これは code 属性だけでなく、 ``urllib.response`` モ" "ジュールが返すような read, geturl, info メソッドも持つことを意味します::" -#: ../../howto/urllib2.rst:324 msgid "" ">>> req = urllib.request.Request('http://www.python.org/fish.html')\n" ">>> try:\n" @@ -582,23 +648,37 @@ msgid "" " Page Not Found\\n\n" " ..." msgstr "" +">>> req = urllib.request.Request('http://www.python.org/fish.html')\n" +">>> try:\n" +"... urllib.request.urlopen(req)\n" +"... except urllib.error.HTTPError as e:\n" +"... print(e.code)\n" +"... print(e.read())\n" +"...\n" +"404\n" +"b'\\n\\n\\nPage Not Found\\n\n" +" ..." -#: ../../howto/urllib2.rst:339 msgid "Wrapping it Up" -msgstr "エラーをラップする" +msgstr "まとめ" -#: ../../howto/urllib2.rst:341 msgid "" "So if you want to be prepared for :exc:`~urllib.error.HTTPError` *or* :exc:" "`~urllib.error.URLError` there are two basic approaches. I prefer the second " "approach." msgstr "" +":exc:`~urllib.error.HTTPError` *または* :exc:`~urllib.error.URLError` に対応" +"するには、基本的に二つの方法があります。\n" +"筆者は二番目の方法を好んでいます。" #: ../../howto/urllib2.rst:345 msgid "Number 1" msgstr "その1" -#: ../../howto/urllib2.rst:350 msgid "" "from urllib.request import Request, urlopen\n" "from urllib.error import URLError, HTTPError\n" @@ -614,12 +694,27 @@ msgid "" "else:\n" " # everything is fine" msgstr "" +"from urllib.request import Request, urlopen\n" +"from urllib.error import URLError, HTTPError\n" +"req = Request(someurl)\n" +"try:\n" +" response = urlopen(req)\n" +"except HTTPError as e:\n" +" print('The server couldn\\'t fulfill the request.')\n" +" print('Error code: ', e.code)\n" +"except URLError as e:\n" +" print('We failed to reach a server.')\n" +" print('Reason: ', e.reason)\n" +"else:\n" +" # すべて正常" -#: ../../howto/urllib2.rst:367 msgid "" "The ``except HTTPError`` *must* come first, otherwise ``except URLError`` " "will *also* catch an :exc:`~urllib.error.HTTPError`." msgstr "" +"``except HTTPError`` を *必ず* 先に書いてください。\n" +"そうしないと、``except URLError`` が :exc:`~urllib.error.HTTPError` *も* 捕捉" +"してしまいます。" #: ../../howto/urllib2.rst:371 msgid "Number 2" @@ -647,12 +742,14 @@ msgstr "" msgid "info and geturl" msgstr "info と geturl" -#: ../../howto/urllib2.rst:394 msgid "" "The response returned by urlopen (or the :exc:`~urllib.error.HTTPError` " "instance) has two useful methods :meth:`!info` and :meth:`!geturl` and is " "defined in the module :mod:`urllib.response`." msgstr "" +"urlopen が返すレスポンス (または :exc:`~urllib.error.HTTPError` インスタン" +"ス) には、便利なメソッド :meth:`!info` と :meth:`!geturl` があります。\n" +"これらは :mod:`urllib.response` モジュールで定義されています。" #: ../../howto/urllib2.rst:398 msgid "" @@ -718,26 +815,23 @@ msgstr "" "たいと思うでしょう、例えばクッキーを処理する opener が得たい場合や、リダイレ" "クションを処理しない opener を得たい場合。" -#: ../../howto/urllib2.rst:427 msgid "" "To create an opener, instantiate an ``OpenerDirector``, and then call ``." "add_handler(some_handler_instance)`` repeatedly." msgstr "" -"opener を作成するには、 ``OpenerDirector`` をインスタンス化して、続けて、 ``." -"add_handler(some_handler_instance)`` を呼び出します。" +"opener を作るには、``OpenerDirector`` のインスタンスを作成し、``." +"add_handler(some_handler_instance)`` を繰り返し呼び出します。" -#: ../../howto/urllib2.rst:430 msgid "" "Alternatively, you can use ``build_opener``, which is a convenience function " "for creating opener objects with a single function call. ``build_opener`` " "adds several handlers by default, but provides a quick way to add more and/" "or override the default handlers." msgstr "" -"それに代わる方法として、 ``build_opener`` を利用することもできます、これは " -"opener オブジェクトを一回の関数呼び出しで作成できる便利な関数です。 " -"``build_opener`` はいくつかのハンドラをデフォルトで追加しますが、デフォルトの" -"ハンドラに対して追加、継承のどちらかまたは両方を行うのに手っ取り早い方法を提" -"供してくれます。" +"代わりに、一度の関数呼び出しで opener オブジェクトを作れる便利な関数 " +"``build_opener`` も使えます。\n" +"``build_opener`` はデフォルトでいくつかのハンドラーを追加しますが、さらにハン" +"ドラーを追加したり、デフォルトのハンドラーを置き換えたりするのも簡単です。" #: ../../howto/urllib2.rst:435 msgid "" @@ -747,15 +841,14 @@ msgstr "" "追加したくなる可能性がある handler としては、プロキシ処理、認証など、一般的で" "すがいくらか特定の状況に限られるものでしょう。" -#: ../../howto/urllib2.rst:438 msgid "" "``install_opener`` can be used to make an ``opener`` object the (global) " "default opener. This means that calls to ``urlopen`` will use the opener you " "have installed." msgstr "" -"``install_opener`` も (グローバルな) デフォルト ``opener`` オブジェクトの作成" -"に利用できます。つまり、 ``urlopen`` を呼び出すと、インストールした opener が" -"利用されます。" +"``install_opener`` を使うと、``opener`` オブジェクトを (グローバルな) デフォ" +"ルトの opener に設定できます。\n" +"以降、``urlopen`` の呼び出しは、登録した opener を使います。" #: ../../howto/urllib2.rst:442 msgid "" @@ -771,7 +864,6 @@ msgstr "" msgid "Basic Authentication" msgstr "Basic 認証" -#: ../../howto/urllib2.rst:450 msgid "" "To illustrate creating and installing a handler we will use the " "``HTTPBasicAuthHandler``. For a more detailed discussion of this subject -- " @@ -779,6 +871,10 @@ msgid "" "Authentication Tutorial `__." msgstr "" +"ハンドラーの作成と登録の例として、``HTTPBasicAuthHandler`` を使います。\n" +"Basic 認証の仕組みを含む詳しい説明は、`Basic 認証のチュートリアル `__ を参照してください。" #: ../../howto/urllib2.rst:456 msgid "" @@ -795,23 +891,21 @@ msgstr "" msgid "e.g." msgstr "例" -#: ../../howto/urllib2.rst:463 msgid "WWW-Authenticate: Basic realm=\"cPanel Users\"" -msgstr "" +msgstr "WWW-Authenticate: Basic realm=\"cPanel Users\"" -#: ../../howto/urllib2.rst:468 msgid "" "The client should then retry the request with the appropriate name and " "password for the realm included as a header in the request. This is 'basic " "authentication'. In order to simplify this process we can create an instance " "of ``HTTPBasicAuthHandler`` and an opener to use this handler." msgstr "" -"クライアントはリクエストヘッダに含まれる realm に対して適切な名前とパスワード" -"とともにリクエストを再試行する必要があります。これが 'basic 認証' です。一連" -"の流れを簡単化するために、 ``HTTPBasicAuthHandler`` のインスタンスを作成し、 " -"opener が handler を利用するようにします。" +"クライアントは、その realm に適した名前とパスワードをリクエストヘッダーに含め" +"て、リクエストを再試行します。\n" +"これが「Basic 認証」です。\n" +"この処理を簡単にするために、``HTTPBasicAuthHandler`` のインスタンスと、そのハ" +"ンドラーを使う opener を作成できます。" -#: ../../howto/urllib2.rst:473 msgid "" "The ``HTTPBasicAuthHandler`` uses an object called a password manager to " "handle the mapping of URLs and realms to passwords and usernames. If you " @@ -823,25 +917,26 @@ msgid "" "providing an alternative combination for a specific realm. We indicate this " "by providing ``None`` as the realm argument to the ``add_password`` method." msgstr "" -"``HTTPBasicAuthHandler`` はパスワードマネージャーと呼ばれる、 URL と realm を" -"パスワードとユーザ名への対応づけを処理する、オブジェクトを利用します。 realm " -"が何なのか(サーバから返される認証ヘッダから) 知りたい場合には、 " -"``HTTPPasswordMgr`` を利用できます。多くの場合、realm が何なのかについて気に" -"することはありません。そのような場合には ``HTTPPasswordMgrWithDefaultRealm`` " -"を使うと便利です。これは URL に対してデフォルトのユーザ名とパスワードを指定で" -"きます。これによって特定の realm に対する代替の組み合わせを提供することなしに" -"利用できるようになります。このことは ``add_password`` メソッドの realm 引数と" -"して ``None`` を与えることで明示することができます。" +"``HTTPBasicAuthHandler`` は、パスワードマネージャーというオブジェクトを使い、" +"URL と realm をユーザー名とパスワードに対応付けます。\n" +"サーバーからの認証ヘッダーで realm が分かっている場合は、``HTTPPasswordMgr`` " +"を使えます。\n" +"realm を特に気にしないことも多く、その場合は " +"``HTTPPasswordMgrWithDefaultRealm`` が便利です。\n" +"これを使うと、URL に対するデフォルトのユーザー名とパスワードを指定できま" +"す。\n" +"特定の realm に別の組み合わせを指定していなければ、このデフォルト値が使われま" +"す。\n" +"デフォルト値を登録するには、``add_password`` メソッドの ``realm`` 引数に " +"``None`` を渡します。" -#: ../../howto/urllib2.rst:483 msgid "" "The top-level URL is the first URL that requires authentication. URLs " "\"deeper\" than the URL you pass to .add_password() will also match. ::" msgstr "" -"トップレベルの URL が認証が必要なはじめに URL です。この URL よりも「深い」" -"URL を渡しても .add_password() は同様にマッチします。::" +"トップレベルの URL は、認証が必要になる最初の URL です。\n" +"``.add_password()`` に渡した URL より「深い」URL も対象になります。 ::" -#: ../../howto/urllib2.rst:486 msgid "" "# create a password manager\n" "password_mgr = urllib.request.HTTPPasswordMgrWithDefaultRealm()\n" @@ -863,8 +958,26 @@ msgid "" "# Now all calls to urllib.request.urlopen use our opener.\n" "urllib.request.install_opener(opener)" msgstr "" +"# パスワードマネージャーを作成する\n" +"password_mgr = urllib.request.HTTPPasswordMgrWithDefaultRealm()\n" +"\n" +"# ユーザー名とパスワードを追加する。\n" +"# realm が分かっていれば、None の代わりに指定できる。\n" +"top_level_url = \"http://example.com/foo/\"\n" +"password_mgr.add_password(None, top_level_url, username, password)\n" +"\n" +"handler = urllib.request.HTTPBasicAuthHandler(password_mgr)\n" +"\n" +"# \"opener\" (OpenerDirector のインスタンス) を作成する\n" +"opener = urllib.request.build_opener(handler)\n" +"\n" +"# opener を使って URL を取得する\n" +"opener.open(a_url)\n" +"\n" +"# opener を登録する。\n" +"# 以降の urllib.request.urlopen の呼び出しはすべてこの opener を使う。\n" +"urllib.request.install_opener(opener)" -#: ../../howto/urllib2.rst:508 msgid "" "In the above example we only supplied our ``HTTPBasicAuthHandler`` to " "``build_opener``. By default openers have the handlers for normal situations " @@ -873,6 +986,12 @@ msgid "" "``HTTPDefaultErrorHandler``, ``HTTPRedirectHandler``, ``FTPHandler``, " "``FileHandler``, ``DataHandler``, ``HTTPErrorProcessor``." msgstr "" +"上の例では、``build_opener`` に ``HTTPBasicAuthHandler`` だけを渡しました。\n" +"デフォルトの opener には、通常の状況に対応するハンドラーが備わっています。\n" +"``ProxyHandler`` (:envvar:`!http_proxy` 環境変数などのプロキシ設定がある場" +"合)、``UnknownHandler``、``HTTPHandler``、``HTTPDefaultErrorHandler``、" +"``HTTPRedirectHandler``、``FTPHandler``、``FileHandler``、``DataHandler``、" +"``HTTPErrorProcessor`` です。" #: ../../howto/urllib2.rst:515 msgid "" @@ -911,12 +1030,14 @@ msgstr "" "`Basic Authentication`_ handler を設定したときと同じような流れで行うことがで" "きます: ::" -#: ../../howto/urllib2.rst:534 msgid "" ">>> proxy_support = urllib.request.ProxyHandler({})\n" ">>> opener = urllib.request.build_opener(proxy_support)\n" ">>> urllib.request.install_opener(opener)" msgstr "" +">>> proxy_support = urllib.request.ProxyHandler({})\n" +">>> opener = urllib.request.build_opener(proxy_support)\n" +">>> urllib.request.install_opener(opener)" #: ../../howto/urllib2.rst:540 msgid "" @@ -966,7 +1087,6 @@ msgstr "" "ベルからは隠蔽されていています。しかし、以下を利用することで全てのソケットに" "対してグローバルにデフォルトタイムアウトを設定することができます ::" -#: ../../howto/urllib2.rst:562 msgid "" "import socket\n" "import urllib.request\n" @@ -980,6 +1100,17 @@ msgid "" "req = urllib.request.Request('http://www.voidspace.org.uk')\n" "response = urllib.request.urlopen(req)" msgstr "" +"import socket\n" +"import urllib.request\n" +"\n" +"# 秒単位のタイムアウト\n" +"timeout = 10\n" +"socket.setdefaulttimeout(timeout)\n" +"\n" +"# この urllib.request.urlopen の呼び出しは、socket モジュールに\n" +"# 設定したデフォルトのタイムアウトを使う\n" +"req = urllib.request.Request('http://www.voidspace.org.uk')\n" +"response = urllib.request.urlopen(req)" #: ../../howto/urllib2.rst:579 msgid "Footnotes" @@ -989,9 +1120,8 @@ msgstr "脚注" msgid "This document was reviewed and revised by John Lee." msgstr "このドキュメントは John Lee によって査読、改訂されました。" -#: ../../howto/urllib2.rst:583 msgid "Google for example." -msgstr "Google を例題にする。" +msgstr "例えば Google です。" #: ../../howto/urllib2.rst:584 msgid "" @@ -1033,9 +1163,11 @@ msgstr "" "報を利用します。localhost のサーバでスクリプトをテストしようとすると、urllib " "がプロキシを利用するのを止めなければいけません。" -#: ../../howto/urllib2.rst:596 msgid "" "urllib opener for SSL proxy (CONNECT method): `ASPN Cookbook Recipe `_." msgstr "" +"SSL プロキシ (CONNECT メソッド) 用の urllib opener: `ASPN Cookbook Recipe " +"`_。" diff --git a/includes/wasm-notavail.po b/includes/wasm-notavail.po index df2d29641..afcae3c83 100644 --- a/includes/wasm-notavail.po +++ b/includes/wasm-notavail.po @@ -16,10 +16,10 @@ msgstr "" "Last-Translator: souma987, 2023\n" "Language-Team: Japanese (https://www.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../includes/wasm-notavail.rst:3 diff --git a/install/index.po b/install/index.po index 737535d0d..523447180 100644 --- a/install/index.po +++ b/install/index.po @@ -23,10 +23,10 @@ msgstr "" "Last-Translator: Transifex Bot <>, 2023\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../install/index.rst:7 @@ -782,7 +782,6 @@ msgstr "(Windows の場合はスラッシュをバックスラッシュに脳内 msgid "Alternate installation: Unix (the prefix scheme)" msgstr "別の場所へのインストール: Unix (prefix スキーム)" -#: ../../install/index.rst:400 msgid "" "The \"prefix scheme\" is useful when you wish to use one Python installation " "to perform the build/install (i.e., to run the setup script), but install " @@ -792,13 +791,13 @@ msgid "" "and home schemes come before. However, there are at least two known cases " "where the prefix scheme will be useful." msgstr "" -"あるインストール済みの Python を使ってモジュールのビルド/インストールを (例え" -"ば setup スクリプトを実行して) 行いたいけれども、 別のインストール済みの " -"Python のサードパーティ製モジュール置き場 (あるいは、そう見えるようなディレク" -"トリ構造) に、ビルドされた モジュールをインストールしたい場合には、\"prefix " -"スキーム\" が便利です。そんな作業はまったくありえそうにない、と思うなら、確か" -"にその通りです --- \"home スキーム\" を先に説明したのもそのためです。とはい" -"え、prefix スキームが有用なケースは少なくとも二つあります。" +"ある Python 環境を使ってビルドやインストール (setup スクリプトの実行) を行い" +"ながら、別の Python 環境のサードパーティーモジュール用ディレクトリ (またはそ" +"れに似た構成のディレクトリ) にモジュールをインストールしたい場合、プレフィッ" +"クススキームが便利です。\n" +"少し変わった使い方に思えるかもしれませんが、その通りです。\n" +"そのため、ユーザースキームとホームスキームを先に説明しました。\n" +"それでも、プレフィックススキームが役立つ場面は少なくとも 2 つあります。" #: ../../install/index.rst:407 msgid "" diff --git a/installing/index.po b/installing/index.po index 0f65b6b96..84b95f6ba 100644 --- a/installing/index.po +++ b/installing/index.po @@ -19,10 +19,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../installing/index.rst:7 @@ -48,16 +48,15 @@ msgstr "" "Python 開発者たちに、彼らのソフトウェアのオープンソースライセンスのもとでの利" "用も可能にしてくれています。" -#: ../../installing/index.rst:15 msgid "" "This allows Python users to share and collaborate effectively, benefiting " "from the solutions others have already created to common (and sometimes even " "rare!) problems, as well as potentially contributing their own solutions to " "the common pool." msgstr "" -"これはほかの人が既に挙げた共通の(あるいは時折極めて稀有な!)問題や、彼ら自身の" -"解法による潜在的な貢献が共通の場所に蓄えられることによる恩恵によって、Python " -"ユーザに共有と協調を効果的に行なうことの助けとなっています。" +"これにより、Python ユーザーは効果的に共有や協力を行えます。\n" +"よくある問題 (ときには珍しい問題も!) に対してほかの人がすでに作った解決策を" +"活用でき、自分の解決策を共有して貢献することもできます。" #: ../../installing/index.rst:20 msgid "" @@ -167,7 +166,7 @@ msgstr "" #: ../../installing/index.rst:66 msgid "" "The use of ``venv`` is now recommended for creating virtual environments." -msgstr "仮想環境の作成には、 ``venv`` の使用をお勧めします。" +msgstr "仮想環境の作成には、 ``venv`` の使用が今は推奨されています。" #: ../../installing/index.rst:71 msgid "" @@ -197,9 +196,8 @@ msgstr "" "以下のコマンドは、モジュールの最新バージョンとそれが依存するモジュールを、 " "Python Package Index からインストールします。" -#: ../../installing/index.rst:84 msgid "python -m pip install SomePackage" -msgstr "" +msgstr "python -m pip install SomePackage" #: ../../installing/index.rst:88 msgid "" @@ -229,11 +227,12 @@ msgstr "" "ます。``>`` や ``<`` などの比較演算子など、シェルが解釈する特殊文字を使う場" "合、パッケージ名とバージョンを二重引用符で囲んでください::" -#: ../../installing/index.rst:100 msgid "" "python -m pip install SomePackage==1.0.4 # specific version\n" "python -m pip install \"SomePackage>=1.0.4\" # minimum version" msgstr "" +"python -m pip install SomePackage==1.0.4 # 特定のバージョン\n" +"python -m pip install \"SomePackage>=1.0.4\" # 最小バージョンを指定" #: ../../installing/index.rst:103 msgid "" @@ -245,9 +244,8 @@ msgstr "" "試みても効果はありません。既に存在しているモジュールのアップグレードには、明" "示的にそれを要求しなければなりません::" -#: ../../installing/index.rst:107 msgid "python -m pip install --upgrade SomePackage" -msgstr "" +msgstr "python -m pip install --upgrade SomePackage" #: ../../installing/index.rst:109 msgid "" @@ -257,14 +255,14 @@ msgstr "" "``pip`` とその機能についての詳しい情報とリソースは `Python Packaging User " "Guide `__ にあります。" -#: ../../installing/index.rst:112 msgid "" "Creation of virtual environments is done through the :mod:`venv` module. " "Installing packages into an active virtual environment uses the commands " "shown above." msgstr "" -"仮想環境の作成は :mod:`venv` モジュールを通して行われます。\n" -"有効な仮想環境にインストールするには 上記のコマンドを使います。 " +"仮想環境は :mod:`venv` モジュールを使って作成します。\n" +"有効化した仮想環境にパッケージをインストールするには、上記のコマンドを使いま" +"す。" #: ../../installing/index.rst:118 msgid "" @@ -429,9 +427,8 @@ msgstr "" "``pip`` がデフォルトでインストールされていないことがあります。\n" "次のコマンドで問題の解決が見込めます::" -#: ../../installing/index.rst:215 msgid "python -m ensurepip --default-pip" -msgstr "" +msgstr "python -m ensurepip --default-pip" #: ../../installing/index.rst:217 msgid "" diff --git a/library/2to3.po b/library/2to3.po index f8f05088e..745a5eaa0 100644 --- a/library/2to3.po +++ b/library/2to3.po @@ -20,10 +20,10 @@ msgstr "" "Last-Translator: Arihiro TAKASE, 2023\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/2to3.rst:4 diff --git a/library/__future__.po b/library/__future__.po index 8c365b4e4..e8447ebba 100644 --- a/library/__future__.po +++ b/library/__future__.po @@ -17,10 +17,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/__future__.rst:2 @@ -101,21 +101,17 @@ msgstr "" "2.1 で future 文が導入されて以来、この仕組みを使って以下の機能が言語に導入さ" "れてきました:" -#: ../../library/__future__.rst:41 msgid "feature" -msgstr "feature" +msgstr "機能" -#: ../../library/__future__.rst:41 msgid "optional in" -msgstr "optional in" +msgstr "選択可能になったリリース" -#: ../../library/__future__.rst:41 msgid "mandatory in" -msgstr "mandatory in" +msgstr "必須になったリリース" -#: ../../library/__future__.rst:41 msgid "effect" -msgstr "effect" +msgstr "内容" #: ../../library/__future__.rst:43 msgid "nested_scopes" @@ -234,35 +230,34 @@ msgstr "annotations" msgid "3.7.0b1" msgstr "3.7.0b1" -#: ../../library/__future__.rst:67 msgid "Never [1]_" -msgstr "" +msgstr "予定なし [1]_" -#: ../../library/__future__.rst:67 msgid "" ":pep:`563`: *Postponed evaluation of annotations*, :pep:`649`: *Deferred " "evaluation of annotations using descriptors*" msgstr "" +":pep:`563`: *アノテーションの評価の延期*、:pep:`649`: *デスクリプタを使ったア" +"ノテーションの遅延評価*" #: ../../library/__future__.rst:79 msgid "Each statement in :file:`__future__.py` is of the form::" msgstr ":file:`__future__.py` のそれぞれの文は次のような形式をしています::" -#: ../../library/__future__.rst:81 msgid "" "FeatureName = _Feature(OptionalRelease, MandatoryRelease,\n" " CompilerFlag)" msgstr "" +"FeatureName = _Feature(OptionalRelease, MandatoryRelease,\n" +" CompilerFlag)" -#: ../../library/__future__.rst:84 msgid "" "where, normally, *OptionalRelease* is less than *MandatoryRelease*, and both " "are 5-tuples of the same form as :data:`sys.version_info`::" msgstr "" -"ここで、普通は、 *OptionalRelease* は *MandatoryRelease* より小さく、2つと" -"も :data:`sys.version_info` と同じフォーマットの5つのタプルからなります::" +"通常、*OptionalRelease* は *MandatoryRelease* より小さく、どちらも :data:" +"`sys.version_info` と同じ形式の 5 要素のタプルです。 ::" -#: ../../library/__future__.rst:87 msgid "" "(PY_MAJOR_VERSION, # the 2 in 2.1.0a3; an int\n" " PY_MINOR_VERSION, # the 1; an int\n" @@ -272,6 +267,13 @@ msgid "" " PY_RELEASE_SERIAL # the 3; an int\n" ")" msgstr "" +"(PY_MAJOR_VERSION, # 2.1.0a3 の 2。整数\n" +" PY_MINOR_VERSION, # 1。整数\n" +" PY_MICRO_VERSION, # 0。整数\n" +" PY_RELEASE_LEVEL, # \"alpha\", \"beta\", \"candidate\", \"final\" のいずれ" +"か。文字列\n" +" PY_RELEASE_SERIAL # 3。整数\n" +")" #: ../../library/__future__.rst:96 msgid "" @@ -319,13 +321,16 @@ msgstr "" "のフラグは :class:`_Feature` インスタンスの :attr:`_Feature.compiler_flag` 属" "性に保存されています。" -#: ../../library/__future__.rst:119 msgid "" "``from __future__ import annotations`` was previously scheduled to become " "mandatory in Python 3.10, but the change was delayed and ultimately " "canceled. This feature will eventually be deprecated and removed. See :pep:" "`649` and :pep:`749`." msgstr "" +"``from __future__ import annotations`` は、以前は Python 3.10 で必須になる予" +"定でしたが、延期された後、最終的に取りやめになりました。\n" +"この機能はいずれ非推奨となり、削除される予定です。\n" +":pep:`649` と :pep:`749` を参照してください。" #: ../../library/__future__.rst:127 msgid ":ref:`future`" diff --git a/library/__main__.po b/library/__main__.po index 952e86798..4c067a37a 100644 --- a/library/__main__.po +++ b/library/__main__.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/__main__.rst:2 @@ -74,15 +74,17 @@ msgid "" msgstr "" "Python モジュールやパッケージがインポートされるとき、 ``__name__`` の値はその" "モジュールの名前となります。\n" -"通常、インポートされる Python ファイル自体のファイル名から拡張子``.py`` を除" +"通常、インポートされる Python ファイル自体のファイル名から拡張子 ``.py`` を除" "いたものとなります::" -#: ../../library/__main__.rst:31 msgid "" ">>> import configparser\n" ">>> configparser.__name__\n" "'configparser'" msgstr "" +">>> import configparser\n" +">>> configparser.__name__\n" +"'configparser'" #: ../../library/__main__.rst:35 msgid "" @@ -92,12 +94,14 @@ msgstr "" "インポートされるファイルがパッケージの一部である場合は、 ``__name__`` にはそ" "のパッケージのパスも含まれます::" -#: ../../library/__main__.rst:38 msgid "" ">>> from concurrent.futures import process\n" ">>> process.__name__\n" "'concurrent.futures.process'" msgstr "" +">>> from concurrent.futures import process\n" +">>> process.__name__\n" +"'concurrent.futures.process'" #: ../../library/__main__.rst:42 msgid "" @@ -133,21 +137,23 @@ msgstr "以下のものがトップレベルのスクリプト環境となりま msgid "the scope of an interactive prompt::" msgstr "インタラクティブプロンプトのスコープ::" -#: ../../library/__main__.rst:57 msgid "" ">>> __name__\n" "'__main__'" msgstr "" +">>> __name__\n" +"'__main__'" #: ../../library/__main__.rst:60 msgid "the Python module passed to the Python interpreter as a file argument:" msgstr "Python インタープリタにファイル引数として渡される Python モジュール:" -#: ../../library/__main__.rst:62 msgid "" "$ python helloworld.py\n" "Hello, world!" msgstr "" +"$ python helloworld.py\n" +"Hello, world!" #: ../../library/__main__.rst:67 msgid "" @@ -157,17 +163,17 @@ msgstr "" "Python インタープリタにPython :option:`-m` オプションとして渡される Python モ" "ジュールまたはパッケージ:" -#: ../../library/__main__.rst:70 msgid "" "$ python -m tarfile\n" "usage: tarfile.py [-h] [-v] (...)" msgstr "" +"$ python -m tarfile\n" +"usage: tarfile.py [-h] [-v] (...)" #: ../../library/__main__.rst:75 msgid "Python code read by the Python interpreter from standard input:" msgstr "標準入力から Python インタープリタが読み込む Python コード:" -#: ../../library/__main__.rst:77 msgid "" "$ echo \"import this\" | python\n" "The Zen of Python, by Tim Peters\n" @@ -176,6 +182,12 @@ msgid "" "Explicit is better than implicit.\n" "..." msgstr "" +"$ echo \"import this\" | python\n" +"The Zen of Python, by Tim Peters\n" +"\n" +"Beautiful is better than ugly.\n" +"Explicit is better than implicit.\n" +"..." #: ../../library/__main__.rst:86 msgid "" @@ -183,7 +195,6 @@ msgid "" msgstr "" "Python インタープリタに :option:`-c` オプションで渡される Python コード:" -#: ../../library/__main__.rst:88 msgid "" "$ python -c \"import this\"\n" "The Zen of Python, by Tim Peters\n" @@ -192,6 +203,12 @@ msgid "" "Explicit is better than implicit.\n" "..." msgstr "" +"$ python -c \"import this\"\n" +"The Zen of Python, by Tim Peters\n" +"\n" +"Beautiful is better than ugly.\n" +"Explicit is better than implicit.\n" +"..." #: ../../library/__main__.rst:97 msgid "" @@ -213,12 +230,14 @@ msgstr "" "このことから、モジュールが import 文で初期化された場合以外の場合でのみコード" "を実行するため、次のコードがしばしば用いられます::" -#: ../../library/__main__.rst:105 msgid "" "if __name__ == '__main__':\n" " # Execute when the module is not initialized from an import statement.\n" " ..." msgstr "" +"if __name__ == '__main__':\n" +" # モジュールが import 文で初期化された場合以外に実行する。\n" +" ..." #: ../../library/__main__.rst:111 msgid "" @@ -265,7 +284,6 @@ msgstr "" "最もよくあるのが、プログラムの主要な処理を ``main`` 関数の中にカプセル化する" "ことです::" -#: ../../library/__main__.rst:131 msgid "" "# echo.py\n" "\n" @@ -287,6 +305,25 @@ msgid "" "if __name__ == '__main__':\n" " sys.exit(main()) # next section explains the use of sys.exit" msgstr "" +"# echo.py\n" +"\n" +"import shlex\n" +"import sys\n" +"\n" +"def echo(phrase: str) -> None:\n" +" \"\"\"print を呼び出すだけのダミーのラッパー。\"\"\"\n" +" # 説明のため、この関数に有用で再利用可能な処理が\n" +" # 含まれていると考える\n" +" print(phrase)\n" +"\n" +"def main() -> int:\n" +" \"\"\"入力された引数を標準出力に出力する\"\"\"\n" +" phrase = shlex.join(sys.argv)\n" +" echo(phrase)\n" +" return 0\n" +"\n" +"if __name__ == '__main__':\n" +" sys.exit(main()) # sys.exit の使い方は次の節で説明" #: ../../library/__main__.rst:151 msgid "" @@ -321,35 +358,42 @@ msgstr "" msgid "Packaging Considerations" msgstr "パッケージングで考慮すべき点" -#: ../../library/__main__.rst:167 msgid "" "``main`` functions are often used to create command-line tools by specifying " "them as entry points for console scripts. When this is done, `pip `_ inserts the function call into a template script, where the " "return value of ``main`` is passed into :func:`sys.exit`. For example::" msgstr "" +"``main`` 関数は、コンソールスクリプトのエントリーポイントに指定して、コマンド" +"ラインツールを作るためによく使われます。\n" +"この場合、`pip `_ は関数呼び出しをテンプレートのスクリ" +"プトに挿入し、``main`` の戻り値を :func:`sys.exit` に渡します。\n" +"例えば、次のようになります。 ::" -#: ../../library/__main__.rst:173 msgid "sys.exit(main())" -msgstr "" +msgstr "sys.exit(main())" -#: ../../library/__main__.rst:175 msgid "" "Since the call to ``main`` is wrapped in :func:`sys.exit`, the expectation " "is that your function will return some value acceptable as an input to :func:" "`sys.exit`; typically, an integer or ``None`` (which is implicitly returned " "if your function does not have a return statement)." msgstr "" +"``main`` の呼び出しは :func:`sys.exit` で囲まれるため、関数は :func:`sys." +"exit` の入力として受け付けられる値を返すことが想定されています。\n" +"通常は整数か ``None`` です (関数に return 文がない場合は暗黙に ``None`` を返" +"します)。" -#: ../../library/__main__.rst:180 msgid "" "By proactively following this convention ourselves, our module will have the " "same behavior when run directly (i.e. ``python echo.py``) as it will have if " "we later package it as a console script entry-point in a pip-installable " "package." msgstr "" +"最初からこの慣習に従っておくと、モジュールを直接実行した場合 (``python echo." +"py`` など) と、後で pip でインストール可能なパッケージのコンソールスクリプト" +"のエントリーポイントとして配布した場合とで、同じ動作になります。" -#: ../../library/__main__.rst:185 msgid "" "In particular, be careful about returning strings from your ``main`` " "function. :func:`sys.exit` will interpret a string argument as a failure " @@ -358,53 +402,68 @@ msgid "" "py`` example from earlier exemplifies using the ``sys.exit(main())`` " "convention." msgstr "" +"特に、``main`` 関数から文字列を返す場合は注意してください。\n" +":func:`sys.exit` は文字列の引数を失敗のメッセージとして扱うため、プログラムは" +"失敗を示す終了コード ``1`` で終了し、その文字列は :data:`sys.stderr` に出力さ" +"れます。\n" +"先ほどの ``echo.py`` は、``sys.exit(main())`` の慣習に従った例です。" -#: ../../library/__main__.rst:193 msgid "" "`Python Packaging User Guide `_ contains a " "collection of tutorials and references on how to distribute and install " "Python packages with modern tools." msgstr "" +"`Python Packaging User Guide `_ には、現在使わ" +"れているツールで Python パッケージを配布・インストールする方法について、" +"チュートリアルとリファレンスがまとめられています。" -#: ../../library/__main__.rst:199 msgid "``__main__.py`` in Python Packages" -msgstr "" +msgstr "Python パッケージの ``__main__.py``" -#: ../../library/__main__.rst:201 msgid "" "If you are not familiar with Python packages, see section :ref:`tut-" "packages` of the tutorial. Most commonly, the ``__main__.py`` file is used " "to provide a command-line interface for a package. Consider the following " "hypothetical package, \"bandclass\":" msgstr "" +"Python パッケージについてよく知らない場合は、チュートリアルの :ref:`tut-" +"packages` を参照してください。\n" +"``__main__.py`` ファイルは、主にパッケージのコマンドラインインターフェースを" +"提供するために使われます。\n" +"次のような「bandclass」という架空のパッケージを考えてみます。" -#: ../../library/__main__.rst:206 msgid "" "bandclass\n" " ├── __init__.py\n" " ├── __main__.py\n" " └── student.py" msgstr "" +"bandclass\n" +" ├── __init__.py\n" +" ├── __main__.py\n" +" └── student.py" -#: ../../library/__main__.rst:213 msgid "" "``__main__.py`` will be executed when the package itself is invoked directly " "from the command line using the :option:`-m` flag. For example:" msgstr "" +"コマンドラインから :option:`-m` フラグでパッケージ自体を直接実行すると、" +"``__main__.py`` が実行されます。\n" +"例を示します。" -#: ../../library/__main__.rst:216 msgid "$ python -m bandclass" -msgstr "" +msgstr "$ python -m bandclass" -#: ../../library/__main__.rst:220 msgid "" "This command will cause ``__main__.py`` to run. How you utilize this " "mechanism will depend on the nature of the package you are writing, but in " "this hypothetical case, it might make sense to allow the teacher to search " "for students::" msgstr "" +"このコマンドで ``__main__.py`` が実行されます。\n" +"この仕組みの使い方は、作成するパッケージの性質によります。\n" +"この架空の例では、教師が生徒を検索できるようにするとよいでしょう。 ::" -#: ../../library/__main__.rst:225 msgid "" "# bandclass/__main__.py\n" "\n" @@ -414,69 +473,98 @@ msgid "" "student_name = sys.argv[1] if len(sys.argv) >= 2 else ''\n" "print(f'Found student: {search_students(student_name)}')" msgstr "" +"# bandclass/__main__.py\n" +"\n" +"import sys\n" +"from .student import search_students\n" +"\n" +"student_name = sys.argv[1] if len(sys.argv) >= 2 else ''\n" +"print(f'Found student: {search_students(student_name)}')" -#: ../../library/__main__.rst:233 msgid "" "Note that ``from .student import search_students`` is an example of a " "relative import. This import style can be used when referencing modules " "within a package. For more details, see :ref:`intra-package-references` in " "the :ref:`tut-modules` section of the tutorial." msgstr "" +"``from .student import search_students`` は相対インポートの例です。\n" +"この書き方は、パッケージ内のモジュールを参照するときに使えます。\n" +"詳しくは、チュートリアルの :ref:`tut-modules` にある :ref:`intra-package-" +"references` を参照してください。" -#: ../../library/__main__.rst:241 msgid "" "The content of ``__main__.py`` typically isn't fenced with an ``if __name__ " "== '__main__'`` block. Instead, those files are kept short and import " "functions to execute from other modules. Those other modules can then be " "easily unit-tested and are properly reusable." msgstr "" +"通常、``__main__.py`` の内容は ``if __name__ == '__main__'`` ブロックでは囲み" +"ません。\n" +"代わりに、ファイルを短く保ち、実行する関数を他のモジュールからインポートしま" +"す。\n" +"そうすれば、それらのモジュールを簡単にユニットテストでき、再利用もしやすくな" +"ります。" -#: ../../library/__main__.rst:246 msgid "" "If used, an ``if __name__ == '__main__'`` block will still work as expected " "for a ``__main__.py`` file within a package, because its ``__name__`` " "attribute will include the package's path if imported::" msgstr "" +"パッケージ内の ``__main__.py`` で ``if __name__ == '__main__'`` ブロックを" +"使った場合も、期待どおりに動作します。\n" +"インポートされたときには、``__name__`` 属性にパッケージのパスが含まれるためで" +"す。 ::" -#: ../../library/__main__.rst:250 msgid "" ">>> import asyncio.__main__\n" ">>> asyncio.__main__.__name__\n" "'asyncio.__main__'" msgstr "" +">>> import asyncio.__main__\n" +">>> asyncio.__main__.__name__\n" +"'asyncio.__main__'" -#: ../../library/__main__.rst:254 msgid "" "This won't work for ``__main__.py`` files in the root directory of a ``." "zip`` file though. Hence, for consistency, a minimal ``__main__.py`` " "without a ``__name__`` check is preferred." msgstr "" +"ただし、``.zip`` ファイルのルートディレクトリにある ``__main__.py`` では、こ" +"の方法は使えません。\n" +"そのため、一貫性を保つには、``__name__`` のチェックを含まない最小限の " +"``__main__.py`` にする方がよいでしょう。" -#: ../../library/__main__.rst:260 msgid "" "See :mod:`venv` for an example of a package with a minimal ``__main__.py`` " "in the standard library. It doesn't contain a ``if __name__ == '__main__'`` " "block. You can invoke it with ``python -m venv [directory]``." msgstr "" +"標準ライブラリ内で最小限の ``__main__.py`` を持つパッケージの例は、:mod:" +"`venv` を参照してください。\n" +"``if __name__ == '__main__'`` ブロックは含まれていません。\n" +"``python -m venv [directory]`` で実行できます。" -#: ../../library/__main__.rst:264 msgid "" "See :mod:`runpy` for more details on the :option:`-m` flag to the " "interpreter executable." msgstr "" +"インタープリタ実行ファイルの :option:`-m` フラグの詳細は、:mod:`runpy` を参照" +"してください。" -#: ../../library/__main__.rst:267 msgid "" "See :mod:`zipapp` for how to run applications packaged as *.zip* files. In " "this case Python looks for a ``__main__.py`` file in the root directory of " "the archive." msgstr "" +"*.zip* ファイルにまとめたアプリケーションの実行方法は、:mod:`zipapp` を参照し" +"てください。\n" +"この場合、Python はアーカイブのルートディレクトリにある ``__main__.py`` を探" +"します。" #: ../../library/__main__.rst:274 msgid "``import __main__``" msgstr "``import __main__``" -#: ../../library/__main__.rst:276 msgid "" "Regardless of which module a Python program was started with, other modules " "running within that same program can import the top-level environment's " @@ -484,12 +572,15 @@ msgid "" "doesn't import a ``__main__.py`` file but rather whichever module that " "received the special name ``'__main__'``." msgstr "" +"Python プログラムをどのモジュールから起動したかにかかわらず、同じプログラム内" +"の他のモジュールは、``__main__`` モジュールをインポートすることでトップレベル" +"環境のスコープ (:term:`名前空間 `) をインポートできます。\n" +"これは ``__main__.py`` というファイルのインポートではなく、特別な名前 " +"``'__main__'`` が割り当てられたモジュールのインポートです。" -#: ../../library/__main__.rst:282 msgid "Here is an example module that consumes the ``__main__`` namespace::" -msgstr "" +msgstr "``__main__`` の名前空間を利用するモジュールの例を示します。 ::" -#: ../../library/__main__.rst:284 msgid "" "# namely.py\n" "\n" @@ -504,12 +595,22 @@ msgid "" "\n" " print(__main__.my_name)" msgstr "" +"# namely.py\n" +"\n" +"import __main__\n" +"\n" +"def did_user_define_their_name():\n" +" return 'my_name' in dir(__main__)\n" +"\n" +"def print_user_name():\n" +" if not did_user_define_their_name():\n" +" raise ValueError('Define the variable `my_name`!')\n" +"\n" +" print(__main__.my_name)" -#: ../../library/__main__.rst:297 msgid "Example usage of this module could be as follows::" -msgstr "" +msgstr "このモジュールは、例えば次のように使えます。 ::" -#: ../../library/__main__.rst:299 msgid "" "# start.py\n" "\n" @@ -528,39 +629,60 @@ msgid "" "if __name__ == \"__main__\":\n" " sys.exit(main())" msgstr "" +"# start.py\n" +"\n" +"import sys\n" +"\n" +"from namely import print_user_name\n" +"\n" +"# my_name = \"Dinsdale\"\n" +"\n" +"def main():\n" +" try:\n" +" print_user_name()\n" +" except ValueError as ve:\n" +" return str(ve)\n" +"\n" +"if __name__ == \"__main__\":\n" +" sys.exit(main())" -#: ../../library/__main__.rst:316 msgid "Now, if we started our program, the result would look like this:" -msgstr "" +msgstr "このプログラムを起動すると、次のような結果になります。" -#: ../../library/__main__.rst:318 msgid "" "$ python start.py\n" "Define the variable `my_name`!" msgstr "" +"$ python start.py\n" +"Define the variable `my_name`!" -#: ../../library/__main__.rst:323 msgid "" "The exit code of the program would be 1, indicating an error. Uncommenting " "the line with ``my_name = \"Dinsdale\"`` fixes the program and now it exits " "with status code 0, indicating success:" msgstr "" +"プログラムの終了コードは、エラーを示す 1 になります。\n" +"``my_name = \"Dinsdale\"`` の行のコメントを外すとプログラムは正しく動作し、成" +"功を示す終了コード 0 で終了します。" -#: ../../library/__main__.rst:327 msgid "" "$ python start.py\n" "Dinsdale" msgstr "" +"$ python start.py\n" +"Dinsdale" -#: ../../library/__main__.rst:332 msgid "" "Note that importing ``__main__`` doesn't cause any issues with " "unintentionally running top-level code meant for script use which is put in " "the ``if __name__ == \"__main__\"`` block of the ``start`` module. Why does " "this work?" msgstr "" +"``__main__`` をインポートしても、``start`` モジュールの ``if __name__ == " +"\"__main__\"`` ブロックにある、スクリプト用のトップレベルコードが意図せず実行" +"されることはありません。\n" +"なぜこのように動作するのでしょうか。" -#: ../../library/__main__.rst:336 msgid "" "Python inserts an empty ``__main__`` module in :data:`sys.modules` at " "interpreter startup, and populates it by running top-level code. In our " @@ -572,14 +694,24 @@ msgid "" "` in the import system's reference for details on how " "this works." msgstr "" +"Python はインタープリタの起動時に空の ``__main__`` モジュールを :data:`sys." +"modules` に追加し、トップレベルコードを実行してその内容を埋めていきます。\n" +"この例では、``start`` モジュールが一行ずつ実行され、``namely`` をインポートし" +"ます。\n" +"今度は ``namely`` が ``__main__`` (実体は ``start``) をインポートするので、循" +"環インポートになります。\n" +"しかし、内容が部分的に埋まった ``__main__`` モジュールが :data:`sys.modules` " +"にあるため、Python はそれを ``namely`` に渡せます。\n" +"詳しい仕組みは、インポートシステムのリファレンスの :ref:`__main__ に関する特" +"別な考慮事項 ` を参照してください。" -#: ../../library/__main__.rst:345 msgid "" "The Python REPL is another example of a \"top-level environment\", so " "anything defined in the REPL becomes part of the ``__main__`` scope::" msgstr "" +"Python の REPL も「トップレベル環境」の一例なので、REPL で定義したものはすべ" +"て ``__main__`` のスコープの一部になります。 ::" -#: ../../library/__main__.rst:348 msgid "" ">>> import namely\n" ">>> namely.did_user_define_their_name()\n" @@ -594,9 +726,22 @@ msgid "" ">>> namely.print_user_name()\n" "Jabberwocky" msgstr "" +">>> import namely\n" +">>> namely.did_user_define_their_name()\n" +"False\n" +">>> namely.print_user_name()\n" +"Traceback (most recent call last):\n" +"...\n" +"ValueError: Define the variable `my_name`!\n" +">>> my_name = 'Jabberwocky'\n" +">>> namely.did_user_define_their_name()\n" +"True\n" +">>> namely.print_user_name()\n" +"Jabberwocky" -#: ../../library/__main__.rst:361 msgid "" "The ``__main__`` scope is used in the implementation of :mod:`pdb` and :mod:" "`rlcompleter`." msgstr "" +"``__main__`` のスコープは、:mod:`pdb` と :mod:`rlcompleter` の実装で使われて" +"います。" diff --git a/library/_thread.po b/library/_thread.po index 0cc1b8efe..fd2e35e47 100644 --- a/library/_thread.po +++ b/library/_thread.po @@ -19,10 +19,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/_thread.rst:2 @@ -81,59 +81,70 @@ msgstr "" msgid "When the function returns, the thread silently exits." msgstr "関数が戻るとき、スレッドは静かに終了します。" -#: ../../library/_thread.rst:52 msgid "" "When the function terminates with an unhandled exception, :func:`sys." "unraisablehook` is called to handle the exception. The *object* attribute of " "the hook argument is *function*. By default, a stack trace is printed and " "then the thread exits (but other threads continue to run)." msgstr "" +"処理されない例外によって関数が終了すると、例外を処理するために :func:`sys." +"unraisablehook` が呼び出されます。\n" +"フックに渡される引数の ``object`` 属性は ``function`` です。\n" +"デフォルトではスタックトレースを表示してスレッドを終了します (他のスレッドは" +"実行を続けます)。" -#: ../../library/_thread.rst:57 msgid "" "When the function raises a :exc:`SystemExit` exception, it is silently " "ignored." msgstr "" +"関数が :exc:`SystemExit` 例外を送出した場合は、何も表示せずに無視します。" -#: ../../library/_thread.rst:60 msgid "" "Raises an :ref:`auditing event ` ``_thread.start_new_thread`` with " "arguments ``function``, ``args``, ``kwargs``." msgstr "" +"引数 ``function``、``args``、``kwargs`` を指定して、:ref:`監査イベント " +"` ``_thread.start_new_thread`` を発生させます。" -#: ../../library/_thread.rst:62 msgid ":func:`sys.unraisablehook` is now used to handle unhandled exceptions." msgstr "" +"処理されない例外を扱うために :func:`sys.unraisablehook` を使うようになりまし" +"た。" -#: ../../library/_thread.rst:68 msgid "" "Simulate the effect of a signal arriving in the main thread. A thread can " "use this function to interrupt the main thread, though there is no guarantee " "that the interruption will happen immediately." msgstr "" +"メインスレッドにシグナルが届いたときの効果を模倣します。\n" +"スレッドはこの関数でメインスレッドに割り込めますが、即座に割り込む保証はあり" +"ません。" -#: ../../library/_thread.rst:72 msgid "" "If given, *signum* is the number of the signal to simulate. If *signum* is " "not given, :const:`signal.SIGINT` is simulated." msgstr "" +"``signum`` を指定した場合は、模倣するシグナルの番号になります。\n" +"``signum`` を指定しない場合は、:const:`signal.SIGINT` を模倣します。" -#: ../../library/_thread.rst:75 msgid "" "If the given signal isn't handled by Python (it was set to :const:`signal." "SIG_DFL` or :const:`signal.SIG_IGN`), this function does nothing." msgstr "" +"指定したシグナルを Python が処理しない場合 (:const:`signal.SIG_DFL` または :" +"const:`signal.SIG_IGN` に設定されている場合)、この関数は何もしません。" -#: ../../library/_thread.rst:79 msgid "The *signum* argument is added to customize the signal number." -msgstr "" +msgstr "シグナル番号を変更できるよう、``signum`` 引数が追加されました。" -#: ../../library/_thread.rst:83 msgid "" "This does not emit the corresponding signal but schedules a call to the " "associated handler (if it exists). If you want to truly emit the signal, " "use :func:`signal.raise_signal`." msgstr "" +"この関数は実際にシグナルを発生させるのではなく、対応するハンドラーがあれば、" +"その呼び出しを予約します。\n" +"実際にシグナルを発生させるには :func:`signal.raise_signal` を使ってください。" #: ../../library/_thread.rst:90 msgid "" @@ -164,21 +175,22 @@ msgstr "" "な、マジッククッキーとして意図されています。スレッドが終了し、他のスレッドが" "作られたとき、スレッド ID は再利用されるかもしれません。" -#: ../../library/_thread.rst:118 msgid "" "Return the native integral Thread ID of the current thread assigned by the " "kernel. This is a non-negative integer. Its value may be used to uniquely " "identify this particular thread system-wide (until the thread terminates, " "after which the value may be recycled by the OS)." msgstr "" +"カーネルが割り当てた、現在のスレッドのネイティブなスレッド ID を返します。\n" +"これは非負の整数です。\n" +"この値で、システム全体においてこのスレッドを一意に識別できます (スレッドが終" +"了するまでで、その後は OS が値を再利用することがあります)。" -#: ../../library/_thread.rst:123 ../../library/_thread.rst:148 msgid "Availability" -msgstr "" +msgstr "利用可能な環境" -#: ../../library/_thread.rst:127 msgid "Added support for GNU/kFreeBSD." -msgstr "" +msgstr "GNU/kFreeBSD のサポートが追加されました。" #: ../../library/_thread.rst:133 msgid "" @@ -213,16 +225,17 @@ msgstr "" "トフォームに関する情報がない場合は 4096 の整数倍のスタックサイズを選ぶといい" "かもしれません)。" -#: ../../library/_thread.rst:150 msgid "Unix platforms with POSIX threads support." -msgstr "" +msgstr "POSIX スレッドをサポートする Unix プラットフォーム。" -#: ../../library/_thread.rst:155 msgid "" "The maximum value allowed for the *timeout* parameter of :meth:`Lock.acquire " "`. Specifying a timeout greater than this value will " "raise an :exc:`OverflowError`." msgstr "" +":meth:`Lock.acquire ` の ``timeout`` パラメーターに指" +"定できる最大値です。\n" +"この値を超えるタイムアウトを指定すると :exc:`OverflowError` が送出されます。" #: ../../library/_thread.rst:162 msgid "Lock objects have the following methods:" @@ -240,13 +253,15 @@ msgstr "" "ている場合には解除されるまで待ってからロックを獲得します (同時にロックを獲得" "できるスレッドはひとつだけであり、これこそがロックの存在理由です)。" -#: ../../library/_thread.rst:171 msgid "" "If the *blocking* argument is present, the action depends on its value: if " "it is false, the lock is only acquired if it can be acquired immediately " "without waiting, while if it is true, the lock is acquired unconditionally " "as above." msgstr "" +"``blocking`` 引数を指定した場合、動作はその値によって変わります。\n" +"偽なら、待たずにすぐ獲得できる場合だけロックを獲得します。\n" +"真なら、上で説明したように無条件にロックを獲得します。" #: ../../library/_thread.rst:176 msgid "" @@ -272,9 +287,8 @@ msgstr "新しい *timeout* 引数。" msgid "Lock acquires can now be interrupted by signals on POSIX." msgstr "POSIX ではロックの取得がシグナルに割り込まれるようになりました。" -#: ../../library/_thread.rst:190 msgid "Lock acquires can now be interrupted by signals on Windows." -msgstr "" +msgstr "Windows でのロックの獲得をシグナルで中断できるようになりました。" #: ../../library/_thread.rst:196 msgid "" @@ -284,13 +298,13 @@ msgstr "" "ロックを解放します。そのロックは既に獲得されたものでなければなりませんが、し" "かし同じスレッドによって獲得されたものである必要はありません。" -#: ../../library/_thread.rst:202 msgid "" "Return the status of the lock: ``True`` if it has been acquired by some " "thread, ``False`` if not." msgstr "" -"ロックの状態を返します: 同じスレッドによって獲得されたものなら ``True`` 、違" -"うのなら ``False`` を返します。" +"ロックの状態を返します。\n" +"いずれかのスレッドがロックを獲得していれば ``True``、そうでなければ " +"``False`` を返します。" #: ../../library/_thread.rst:205 msgid "" @@ -300,7 +314,6 @@ msgstr "" "これらのメソッドに加えて、ロックオブジェクトは :keyword:`with` 文を通じて以下" "の例のように使うこともできます。 ::" -#: ../../library/_thread.rst:208 msgid "" "import _thread\n" "\n" @@ -309,16 +322,23 @@ msgid "" "with a_lock:\n" " print(\"a_lock is locked while this executes\")" msgstr "" +"import _thread\n" +"\n" +"a_lock = _thread.allocate_lock()\n" +"\n" +"with a_lock:\n" +" print(\"a_lock is locked while this executes\")" #: ../../library/_thread.rst:215 msgid "**Caveats:**" msgstr "**警告:**" -#: ../../library/_thread.rst:219 msgid "" "Interrupts always go to the main thread (the :exc:`KeyboardInterrupt` " "exception will be received by that thread.)" msgstr "" +"割り込みは常にメインスレッドに届きます (:exc:`KeyboardInterrupt` 例外を受け取" +"るのはこのスレッドです)。" #: ../../library/_thread.rst:222 msgid "" diff --git a/library/abc.po b/library/abc.po index f1da8dddf..f752e5119 100644 --- a/library/abc.po +++ b/library/abc.po @@ -17,10 +17,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/abc.rst:2 @@ -52,6 +52,11 @@ msgid "" "class or instance provides a particular interface, for example, if it is :" "term:`hashable` or if it is a :term:`mapping`." msgstr "" +":mod:`collections` モジュール には、抽象基底クラス から派生するいくつかの具象" +"クラスがある。もちろん、これらはさらに派生させることができる。さらに、 :mod:" +"`collections.abc` サブモジュールには、クラスやインスタンス が特定のインター" +"フェース 、たとえば 、 :term:`hashable` であるか、 :term:`mapping` であるかを" +"テストするために使用できる抽象基底クラス があります。" #: ../../library/abc.rst:27 msgid "" @@ -68,16 +73,21 @@ msgid "" "an abstract base class can be created by simply deriving from :class:`!ABC` " "avoiding sometimes confusing metaclass usage, for example::" msgstr "" +"メタクラスとして :class:`ABCMeta` を持つヘルパークラスです。このクラスを使う" +"ことで、:class:`!ABC` を継承するだけで抽象基底クラスを作成でき、しばしば混乱" +"しがちなメタクラスの使用を避けることができます。例えば::" -#: ../../library/abc.rst:36 msgid "" "from abc import ABC\n" "\n" "class MyABC(ABC):\n" " pass" msgstr "" +"from abc import ABC\n" +"\n" +"class MyABC(ABC):\n" +" pass" -#: ../../library/abc.rst:41 msgid "" "Note that the type of :class:`!ABC` is still :class:`ABCMeta`, therefore " "inheriting from :class:`!ABC` requires the usual precautions regarding " @@ -85,14 +95,22 @@ msgid "" "One may also define an abstract base class by passing the metaclass keyword " "and using :class:`!ABCMeta` directly, for example::" msgstr "" +":class:`!ABC` の型は :class:`ABCMeta` なので、:class:`!ABC` を継承する場合" +"も、メタクラスを使う際の通常の注意が必要です。\n" +"多重継承ではメタクラスが競合する場合があります。\n" +"また、``metaclass`` キーワードに :class:`!ABCMeta` を直接指定して、抽象基底ク" +"ラスを定義することもできます。 ::" -#: ../../library/abc.rst:47 msgid "" "from abc import ABCMeta\n" "\n" "class MyABC(metaclass=ABCMeta):\n" " pass" msgstr "" +"from abc import ABCMeta\n" +"\n" +"class MyABC(metaclass=ABCMeta):\n" +" pass" #: ../../library/abc.rst:57 msgid "Metaclass for defining Abstract Base Classes (ABCs)." @@ -117,11 +135,10 @@ msgstr "" "Resolution Order, メソッド解決順)には現れませんし、この ABC のメソッド実装が" "(:func:`super` を通してだけでなく)呼び出し可能になるわけでもありません。 [#]_" -#: ../../library/abc.rst:68 msgid "" "Classes created with a metaclass of :class:`!ABCMeta` have the following " "method:" -msgstr "" +msgstr "メタクラスが :class:`!ABCMeta` のクラスには、次のメソッドがあります。" #: ../../library/abc.rst:72 msgid "" @@ -129,7 +146,6 @@ msgid "" msgstr "" "*subclass* を \"仮想的サブクラス\" としてこの ABC に登録します。たとえば::" -#: ../../library/abc.rst:75 msgid "" "from abc import ABC\n" "\n" @@ -141,6 +157,15 @@ msgid "" "assert issubclass(tuple, MyABC)\n" "assert isinstance((), MyABC)" msgstr "" +"from abc import ABC\n" +"\n" +"class MyABC(ABC):\n" +" pass\n" +"\n" +"MyABC.register(tuple)\n" +"\n" +"assert issubclass(tuple, MyABC)\n" +"assert isinstance((), MyABC)" #: ../../library/abc.rst:85 msgid "Returns the registered subclass, to allow usage as a class decorator." @@ -148,11 +173,12 @@ msgstr "" "クラスデコレータとして使うことができるように、登録されたサブクラスを返しま" "す。" -#: ../../library/abc.rst:88 msgid "" "To detect calls to :meth:`!register`, you can use the :func:" "`get_cache_token` function." msgstr "" +":meth:`!register` の呼び出しを検出するには、:func:`get_cache_token` 関数を使" +"えます。" #: ../../library/abc.rst:92 msgid "You can also override this method in an abstract base class:" @@ -162,7 +188,6 @@ msgstr "また、次のメソッドを抽象基底クラスの中でオーバー msgid "(Must be defined as a class method.)" msgstr "(クラスメソッドとして定義しなければなりません。)" -#: ../../library/abc.rst:98 msgid "" "Check whether *subclass* is considered a subclass of this ABC. This means " "that you can customize the behavior of :func:`issubclass` further without " @@ -170,8 +195,13 @@ msgid "" "subclass of the ABC. (This class method is called from the :meth:`~type." "__subclasscheck__` method of the ABC.)" msgstr "" +"``subclass`` がこの ABC のサブクラスとみなされるか調べます。\n" +"このメソッドで :func:`issubclass` の動作をさらにカスタマイズすれば、ABC のサ" +"ブクラスとみなしたいクラスごとに :meth:`register` を呼ぶ必要がなくなりま" +"す。\n" +"(このクラスメソッドは、ABC の :meth:`~type.__subclasscheck__` メソッドから呼" +"び出されます。)" -#: ../../library/abc.rst:104 msgid "" "This method should return ``True``, ``False`` or :data:`NotImplemented`. If " "it returns ``True``, the *subclass* is considered a subclass of this ABC. If " @@ -179,13 +209,18 @@ msgid "" "ABC, even if it would normally be one. If it returns :data:`!" "NotImplemented`, the subclass check is continued with the usual mechanism." msgstr "" +"このメソッドは ``True``、``False``、:data:`NotImplemented` のいずれかを返す必" +"要があります。\n" +"``True`` を返すと、``subclass`` はこの ABC のサブクラスとみなされます。\n" +"``False`` を返すと、通常ならサブクラスであっても、``subclass`` はこの ABC の" +"サブクラスとはみなされません。\n" +":data:`!NotImplemented` を返すと、通常の仕組みでサブクラスの検査を続けます。" #: ../../library/abc.rst:114 msgid "" "For a demonstration of these concepts, look at this example ABC definition::" msgstr "この概念のデモとして、次の ABC 定義の例を見てください::" -#: ../../library/abc.rst:116 msgid "" "class Foo:\n" " def __getitem__(self, index):\n" @@ -214,8 +249,33 @@ msgid "" "\n" "MyIterable.register(Foo)" msgstr "" +"class Foo:\n" +" def __getitem__(self, index):\n" +" ...\n" +" def __len__(self):\n" +" ...\n" +" def get_iterator(self):\n" +" return iter(self)\n" +"\n" +"class MyIterable(ABC):\n" +"\n" +" @abstractmethod\n" +" def __iter__(self):\n" +" while False:\n" +" yield None\n" +"\n" +" def get_iterator(self):\n" +" return self.__iter__()\n" +"\n" +" @classmethod\n" +" def __subclasshook__(cls, C):\n" +" if cls is MyIterable:\n" +" if any(\"__iter__\" in B.__dict__ for B in C.__mro__):\n" +" return True\n" +" return NotImplemented\n" +"\n" +"MyIterable.register(Foo)" -#: ../../library/abc.rst:143 msgid "" "The ABC ``MyIterable`` defines the standard iterable method, :meth:`~object." "__iter__`, as an abstract method. The implementation given here can still " @@ -223,16 +283,24 @@ msgid "" "the ``MyIterable`` abstract base class, but it does not have to be " "overridden in non-abstract derived classes." msgstr "" +"ABC ``MyIterable`` は、イテラブルの標準的なメソッド :meth:`~object.__iter__` " +"を抽象メソッドとして定義しています。\n" +"ここで定義した実装は、サブクラスから呼び出すこともできます。\n" +":meth:`!get_iterator` メソッドも抽象基底クラス ``MyIterable`` の一部ですが、" +"抽象クラスではない派生クラスでオーバーライドする必要はありません。" -#: ../../library/abc.rst:149 msgid "" "The :meth:`__subclasshook__` class method defined here says that any class " "that has an :meth:`~object.__iter__` method in its :attr:`~object.__dict__` " "(or in that of one of its base classes, accessed via the :attr:`~type." "__mro__` list) is considered a ``MyIterable`` too." msgstr "" +"ここで定義したクラスメソッド :meth:`__subclasshook__` は、:attr:`~object." +"__dict__` に :meth:`~object.__iter__` メソッドを持つクラスを ``MyIterable`` " +"とみなします。\n" +"また、:attr:`~type.__mro__` リストからたどれる基底クラスのいずれかがそのメ" +"ソッドを持つ場合も、同様にみなします。" -#: ../../library/abc.rst:154 msgid "" "Finally, the last line makes ``Foo`` a virtual subclass of ``MyIterable``, " "even though it does not define an :meth:`~object.__iter__` method (it uses " @@ -241,10 +309,15 @@ msgid "" "``get_iterator`` available as a method of ``Foo``, so it is provided " "separately." msgstr "" +"最後の行では、:meth:`~object.__iter__` メソッドを定義していない ``Foo`` も、" +"``MyIterable`` の仮想的サブクラスにしています (``Foo`` は :meth:`~object." +"__len__` と :meth:`~object.__getitem__` に基づく古いイテラブルプロトコルを" +"使っています)。\n" +"ただし、これによって ``get_iterator`` が ``Foo`` のメソッドとして使えるように" +"なるわけではないので、別途定義しています。" -#: ../../library/abc.rst:163 msgid "The :mod:`!abc` module also provides the following decorator:" -msgstr "" +msgstr ":mod:`!abc` モジュールは、次のデコレータも提供します。" #: ../../library/abc.rst:167 msgid "A decorator indicating abstract methods." @@ -277,7 +350,6 @@ msgid "" "the following usage examples::" msgstr "" -#: ../../library/abc.rst:187 msgid "" "class C(ABC):\n" " @abstractmethod\n" @@ -309,6 +381,35 @@ msgid "" " ...\n" " x = property(_get_x, _set_x)" msgstr "" +"class C(ABC):\n" +" @abstractmethod\n" +" def my_abstract_method(self, arg1):\n" +" ...\n" +" @classmethod\n" +" @abstractmethod\n" +" def my_abstract_classmethod(cls, arg2):\n" +" ...\n" +" @staticmethod\n" +" @abstractmethod\n" +" def my_abstract_staticmethod(arg3):\n" +" ...\n" +"\n" +" @property\n" +" @abstractmethod\n" +" def my_abstract_property(self):\n" +" ...\n" +" @my_abstract_property.setter\n" +" @abstractmethod\n" +" def my_abstract_property(self, val):\n" +" ...\n" +"\n" +" @abstractmethod\n" +" def _get_x(self):\n" +" ...\n" +" @abstractmethod\n" +" def _set_x(self, val):\n" +" ...\n" +" x = property(_get_x, _set_x)" #: ../../library/abc.rst:217 msgid "" @@ -319,7 +420,6 @@ msgid "" "Python's built-in :class:`property` does the equivalent of::" msgstr "" -#: ../../library/abc.rst:223 msgid "" "class Descriptor:\n" " ...\n" @@ -328,6 +428,12 @@ msgid "" " return any(getattr(f, '__isabstractmethod__', False) for\n" " f in (self._fget, self._fset, self._fdel))" msgstr "" +"class Descriptor:\n" +" ...\n" +" @property\n" +" def __isabstractmethod__(self):\n" +" return any(getattr(f, '__isabstractmethod__', False) for\n" +" f in (self._fget, self._fset, self._fdel))" #: ../../library/abc.rst:232 msgid "" @@ -342,9 +448,8 @@ msgstr "" "ことができます。これは協調的多重継承を使ったフレームワークにおいて super 呼び" "出しの終点として有効です。" -#: ../../library/abc.rst:239 msgid "The :mod:`!abc` module also supports the following legacy decorators:" -msgstr "" +msgstr ":mod:`!abc` モジュールは、次の古いデコレータもサポートしています。" #: ../../library/abc.rst:244 msgid "" @@ -370,7 +475,6 @@ msgstr "" "この特殊ケースは :func:`classmethod` デコレータが抽象メソッドに適用された場合" "に抽象的だと正しく認識されるようになったため撤廃されます::" -#: ../../library/abc.rst:255 msgid "" "class C(ABC):\n" " @classmethod\n" @@ -378,6 +482,11 @@ msgid "" " def my_abstract_classmethod(cls, arg):\n" " ..." msgstr "" +"class C(ABC):\n" +" @classmethod\n" +" @abstractmethod\n" +" def my_abstract_classmethod(cls, arg):\n" +" ..." #: ../../library/abc.rst:265 msgid "" @@ -403,7 +512,6 @@ msgstr "" "この特殊ケースは :func:`staticmethod` デコレータが抽象メソッドに適用された場" "合に抽象的だと正しく認識されるようになったため撤廃されます::" -#: ../../library/abc.rst:276 msgid "" "class C(ABC):\n" " @staticmethod\n" @@ -411,6 +519,11 @@ msgid "" " def my_abstract_staticmethod(arg):\n" " ..." msgstr "" +"class C(ABC):\n" +" @staticmethod\n" +" @abstractmethod\n" +" def my_abstract_staticmethod(arg):\n" +" ..." #: ../../library/abc.rst:285 msgid "" @@ -437,7 +550,6 @@ msgstr "" "この特殊ケースは :func:`property` デコレータが抽象メソッドに適用された場合に" "抽象的だと正しく認識されるようになったため撤廃されます::" -#: ../../library/abc.rst:297 msgid "" "class C(ABC):\n" " @property\n" @@ -445,6 +557,11 @@ msgid "" " def my_abstract_property(self):\n" " ..." msgstr "" +"class C(ABC):\n" +" @property\n" +" @abstractmethod\n" +" def my_abstract_property(self):\n" +" ..." #: ../../library/abc.rst:303 msgid "" @@ -456,7 +573,6 @@ msgstr "" "ドの1つ以上を abstract にすることで、読み書きできる抽象プロパティを定義するこ" "とができます::" -#: ../../library/abc.rst:307 msgid "" "class C(ABC):\n" " @property\n" @@ -468,6 +584,15 @@ msgid "" " def x(self, val):\n" " ..." msgstr "" +"class C(ABC):\n" +" @property\n" +" def x(self):\n" +" ...\n" +"\n" +" @x.setter\n" +" @abstractmethod\n" +" def x(self, val):\n" +" ..." #: ../../library/abc.rst:317 msgid "" @@ -477,17 +602,19 @@ msgstr "" "構成するメソッド全てが abstract でない場合、abstract と定義されたメソッドのみ" "が、具象サブクラスによってオーバーライドする必要があります::" -#: ../../library/abc.rst:320 msgid "" "class D(C):\n" " @C.x.setter\n" " def x(self, val):\n" " ..." msgstr "" +"class D(C):\n" +" @C.x.setter\n" +" def x(self, val):\n" +" ..." -#: ../../library/abc.rst:326 msgid "The :mod:`!abc` module also provides the following functions:" -msgstr "" +msgstr ":mod:`!abc` モジュールは、次の関数も提供します。" #: ../../library/abc.rst:330 msgid "Returns the current abstract base class cache token." @@ -504,27 +631,30 @@ msgstr "" "任意のABCでの :meth:`ABCMeta.register` の呼び出しごとに、トークンは変更されま" "す。" -#: ../../library/abc.rst:340 msgid "" "A function to recalculate an abstract class's abstraction status. This " "function should be called if a class's abstract methods have been " "implemented or changed after it was created. Usually, this function should " "be called from within a class decorator." msgstr "" +"抽象クラスが抽象であるかどうかを再計算する関数です。\n" +"クラスを作成した後で、その抽象メソッドを実装したり変更したりした場合に呼び出" +"してください。\n" +"通常はクラスデコレータの中から呼び出します。" -#: ../../library/abc.rst:345 msgid "Returns *cls*, to allow usage as a class decorator." -msgstr "" +msgstr "クラスデコレータとして使えるように、``cls`` を返します。" -#: ../../library/abc.rst:347 msgid "If *cls* is not an instance of :class:`ABCMeta`, does nothing." -msgstr "" +msgstr "``cls`` が :class:`ABCMeta` のインスタンスでなければ、何もしません。" -#: ../../library/abc.rst:351 msgid "" "This function assumes that *cls*'s superclasses are already updated. It does " "not update any subclasses." msgstr "" +"この関数は、``cls`` のスーパークラスがすでに更新されていることを前提としま" +"す。\n" +"サブクラスの更新は行いません。" #: ../../library/abc.rst:357 msgid "Footnotes" diff --git a/library/aifc.po b/library/aifc.po index 104e03e2b..3036c2b12 100644 --- a/library/aifc.po +++ b/library/aifc.po @@ -12,15 +12,14 @@ msgstr "" "PO-Revision-Date: 2024-11-19 01:02+0000\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" -#: ../../library/aifc.rst:2 msgid ":mod:`!aifc` --- Read and write AIFF and AIFC files" -msgstr "" +msgstr ":mod:`!aifc` --- AIFF および AIFC ファイルの読み書き" #: ../../library/aifc.rst:10 msgid "" @@ -28,9 +27,13 @@ msgid "" "`removed in Python 3.13 ` after being deprecated in " "Python 3.11. The removal was decided in :pep:`594`." msgstr "" +"このモジュールは今や Python 標準ライブラリの一部ではありません。このモジュー" +"ルは Python 3.11 で非推奨となったあと、:ref:`Python 3.13 で削除` されました。削除の決定は :pep:`594` でなされました。" -#: ../../library/aifc.rst:14 msgid "" "The last version of Python that provided the :mod:`!aifc` module was `Python " "3.12 `_." msgstr "" +":mod:`!aifc` モジュールを提供していた最後の Python バージョンは、`Python " +"3.12 `_ です。" diff --git a/library/allos.po b/library/allos.po index c8df90c38..e0f8a4a9f 100644 --- a/library/allos.po +++ b/library/allos.po @@ -17,10 +17,10 @@ msgstr "" "Last-Translator: mollinaca, 2021\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/allos.rst:5 diff --git a/library/archiving.po b/library/archiving.po index ea4b9a46d..19d692d4d 100644 --- a/library/archiving.po +++ b/library/archiving.po @@ -16,20 +16,23 @@ msgstr "" "Last-Translator: tomo, 2021\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/archiving.rst:5 msgid "Data Compression and Archiving" msgstr "データ圧縮とアーカイブ" -#: ../../library/archiving.rst:7 msgid "" "The modules described in this chapter support data compression with the " "zlib, gzip, bzip2, lzma, and zstd algorithms, and the creation of ZIP- and " "tar-format archives. See also :ref:`archiving-operations` provided by the :" "mod:`shutil` module." msgstr "" +"この章のモジュールは、zlib、gzip、bzip2、lzma、zstd アルゴリズムによるデータ" +"圧縮と、ZIP 形式・tar 形式のアーカイブ作成をサポートします。\n" +":mod:`shutil` モジュールが提供する :ref:`archiving-operations` も参照してくだ" +"さい。" diff --git a/library/argparse.po b/library/argparse.po index 58360f589..ddce6e830 100644 --- a/library/argparse.po +++ b/library/argparse.po @@ -22,10 +22,10 @@ msgstr "" "Last-Translator: tomo, 2025\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/argparse.rst:2 @@ -33,6 +33,8 @@ msgid "" ":mod:`!argparse` --- Parser for command-line options, arguments and " "subcommands" msgstr "" +":mod:`!argparse` --- コマンドラインオプションや引数、サブコマンド向けのパー" +"サー" #: ../../library/argparse.rst:12 msgid "**Source code:** :source:`Lib/argparse.py`" @@ -65,7 +67,6 @@ msgstr "" "リアル ` では、コマンドラインの解析についてより優しく説明" "しています。" -#: ../../library/argparse.rst:34 msgid "" "The :mod:`!argparse` module makes it easy to write user-friendly command-" "line interfaces. The program defines what arguments it requires, and :mod:`!" @@ -74,14 +75,23 @@ msgid "" "messages. The module will also issue errors when users give the program " "invalid arguments." msgstr "" +":mod:`!argparse` モジュールを使うと、使いやすいコマンドラインインターフェース" +"を簡単に作成できます。\n" +"プログラムで必要な引数を定義すると、:mod:`!argparse` が :data:`sys.argv` から" +"それらを解析する方法を判断します。\n" +":mod:`!argparse` はヘルプと使用法のメッセージも自動生成し、ユーザーが不正な引" +"数を渡すとエラーを表示します。" -#: ../../library/argparse.rst:40 msgid "" "The :mod:`!argparse` module's support for command-line interfaces is built " "around an instance of :class:`argparse.ArgumentParser`. It is a container " "for argument specifications and has options that apply to the parser as " "whole::" msgstr "" +":mod:`!argparse` のコマンドラインインターフェースのサポートは、:class:" +"`argparse.ArgumentParser` のインスタンスを中心に構成されています。\n" +"このオブジェクトは引数の仕様を格納し、パーサー全体に適用するオプションを持ち" +"ます。 ::" #: ../../library/argparse.rst:44 msgid "" @@ -90,6 +100,10 @@ msgid "" " description='What the program does',\n" " epilog='Text at the bottom of help')" msgstr "" +"parser = argparse.ArgumentParser(\n" +" prog='ProgramName',\n" +" description='What the program does',\n" +" epilog='Text at the bottom of help')" #: ../../library/argparse.rst:49 msgid "" @@ -108,6 +122,10 @@ msgid "" "parser.add_argument('-v', '--verbose',\n" " action='store_true') # on/off flag" msgstr "" +"parser.add_argument('filename') # 位置引数\n" +"parser.add_argument('-c', '--count') # 値を取るオプション\n" +"parser.add_argument('-v', '--verbose',\n" +" action='store_true') # オン/オフフラグ" #: ../../library/argparse.rst:58 msgid "" @@ -117,18 +135,20 @@ msgstr "" ":meth:`ArgumentParser.parse_args` メソッドはパーサーを実行し、抽出したデータ" "を :class:`argparse.Namespace` オブジェクト内に配置します::" -#: ../../library/argparse.rst:61 msgid "" "args = parser.parse_args()\n" "print(args.filename, args.count, args.verbose)" msgstr "" +"args = parser.parse_args()\n" +"print(args.filename, args.count, args.verbose)" -#: ../../library/argparse.rst:65 msgid "" "If you're looking for a guide about how to upgrade :mod:`optparse` code to :" "mod:`!argparse`, see :ref:`Upgrading Optparse Code `." msgstr "" +":mod:`optparse` のコードを :mod:`!argparse` に移行する方法は、:ref:`Optparse " +"のコードのアップグレード ` を参照してください。" #: ../../library/argparse.rst:69 msgid "ArgumentParser objects" @@ -144,11 +164,12 @@ msgstr "" "ワード引数として渡すべきです。各引数についてはあとで詳しく説明しますが、簡単" "に言うと:" -#: ../../library/argparse.rst:83 msgid "" "prog_ - The name of the program (default: generated from the ``__main__`` " "module attributes and ``sys.argv[0]``)" msgstr "" +"prog_ - プログラム名 (デフォルト: ``__main__`` モジュールの属性と ``sys." +"argv[0]`` から生成)" #: ../../library/argparse.rst:86 msgid "" @@ -217,17 +238,19 @@ msgstr "" "add_help_ - ``-h/--help`` オプションをパーサーに追加する (デフォルト: " "``True``)" -#: ../../library/argparse.rst:113 msgid "" "allow_abbrev_ - Allows long options to be abbreviated if the abbreviation is " "unambiguous (default: ``True``)" msgstr "" +"allow_abbrev_ - 意味が一意に決まる場合に、長いオプションの省略を許可する (デ" +"フォルト: ``True``)" -#: ../../library/argparse.rst:116 msgid "" "exit_on_error_ - Determines whether or not :class:`!ArgumentParser` exits " "with error info when an error occurs. (default: ``True``)" msgstr "" +"exit_on_error_ - エラーが起きたときに、:class:`!ArgumentParser` がエラー情報" +"を表示して終了するかどうか (デフォルト: ``True``)" #: ../../library/argparse.rst:119 msgid "" @@ -255,9 +278,8 @@ msgstr "" msgid "*exit_on_error* parameter was added." msgstr "*exit_on_error* 引数が追加されました。" -#: ../../library/argparse.rst:134 msgid "*suggest_on_error* and *color* parameters were added." -msgstr "" +msgstr "``suggest_on_error`` と ``color`` パラメーターが追加されました。" #: ../../library/argparse.rst:137 ../../library/argparse.rst:686 msgid "The following sections describe how each of these are used." @@ -267,39 +289,45 @@ msgstr "以下の節では各オプションの利用方法を説明します。 msgid "prog" msgstr "``prog``" -#: ../../library/argparse.rst:146 msgid "" "By default, :class:`ArgumentParser` calculates the name of the program to " "display in help messages depending on the way the Python interpreter was run:" msgstr "" +"デフォルトでは、:class:`ArgumentParser` は Python インタープリタの実行方法に" +"応じて、ヘルプに表示するプログラム名を求めます。" -#: ../../library/argparse.rst:149 msgid "" "The :func:`base name ` of ``sys.argv[0]`` if a file was " "passed as argument." msgstr "" +"ファイルを引数に渡した場合は、``sys.argv[0]`` の :func:`ベース名 `。" -#: ../../library/argparse.rst:151 msgid "" "The Python interpreter name followed by ``sys.argv[0]`` if a directory or a " "zipfile was passed as argument." msgstr "" +"ディレクトリか ZIP ファイルを引数に渡した場合は、Python インタープリタの名前" +"に ``sys.argv[0]`` を続けたもの。" -#: ../../library/argparse.rst:153 msgid "" "The Python interpreter name followed by ``-m`` followed by the module or " "package name if the :option:`-m` option was used." msgstr "" +":option:`-m` オプションを使った場合は、Python インタープリタの名前に ``-m``、" +"モジュール名またはパッケージ名を続けたもの。" -#: ../../library/argparse.rst:156 msgid "" "This default is almost always desirable because it will make the help " "messages match the string that was used to invoke the program on the command " "line. However, to change this default behavior, another value can be " "supplied using the ``prog=`` argument to :class:`ArgumentParser`::" msgstr "" +"このデフォルトの動作では、コマンドラインでプログラムを実行した文字列とヘルプ" +"の表記が一致するので、ほとんどの場合に適しています。\n" +"変更したい場合は、:class:`ArgumentParser` の ``prog=`` 引数に別の値を指定でき" +"ます。 ::" -#: ../../library/argparse.rst:161 msgid "" ">>> parser = argparse.ArgumentParser(prog='myprogram')\n" ">>> parser.print_help()\n" @@ -308,15 +336,22 @@ msgid "" "options:\n" " -h, --help show this help message and exit" msgstr "" +">>> parser = argparse.ArgumentParser(prog='myprogram')\n" +">>> parser.print_help()\n" +"usage: myprogram [-h]\n" +"\n" +"options:\n" +" -h, --help show this help message and exit" -#: ../../library/argparse.rst:168 msgid "" "Note that the program name, whether determined from ``sys.argv[0]``, from " "the ``__main__`` module attributes or from the ``prog=`` argument, is " "available to help messages using the ``%(prog)s`` format specifier." msgstr "" +"プログラム名は、``sys.argv[0]``、``__main__`` モジュールの属性、``prog=`` 引" +"数のどれから決まった場合でも、ヘルプ内で書式指定子 ``%(prog)s`` を使って参照" +"できます。" -#: ../../library/argparse.rst:175 msgid "" ">>> parser = argparse.ArgumentParser(prog='myprogram')\n" ">>> parser.add_argument('--foo', help='foo of the %(prog)s program')\n" @@ -327,25 +362,35 @@ msgid "" " -h, --help show this help message and exit\n" " --foo FOO foo of the myprogram program" msgstr "" +">>> parser = argparse.ArgumentParser(prog='myprogram')\n" +">>> parser.add_argument('--foo', help='foo of the %(prog)s program')\n" +">>> parser.print_help()\n" +"usage: myprogram [-h] [--foo FOO]\n" +"\n" +"options:\n" +" -h, --help show this help message and exit\n" +" --foo FOO foo of the myprogram program" -#: ../../library/argparse.rst:184 msgid "" "The default ``prog`` value now reflects how ``__main__`` was actually " "executed, rather than always being ``os.path.basename(sys.argv[0])``." msgstr "" +"デフォルトの ``prog`` 値は、常に ``os.path.basename(sys.argv[0])`` になるので" +"はなく、``__main__`` の実際の実行方法を反映するようになりました。" #: ../../library/argparse.rst:189 msgid "usage" msgstr "usage" -#: ../../library/argparse.rst:191 msgid "" "By default, :class:`ArgumentParser` calculates the usage message from the " "arguments it contains. The default message can be overridden with the " "``usage=`` keyword argument::" msgstr "" +"デフォルトでは、:class:`ArgumentParser` は登録された引数から使用法のメッセー" +"ジを生成します。\n" +"``usage=`` キーワード引数を指定すると、このメッセージを置き換えられます。 ::" -#: ../../library/argparse.rst:195 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', usage='%(prog)s " "[options]')\n" @@ -361,6 +406,19 @@ msgid "" " -h, --help show this help message and exit\n" " --foo [FOO] foo help" msgstr "" +">>> parser = argparse.ArgumentParser(prog='PROG', usage='%(prog)s " +"[options]')\n" +">>> parser.add_argument('--foo', nargs='?', help='foo help')\n" +">>> parser.add_argument('bar', nargs='+', help='bar help')\n" +">>> parser.print_help()\n" +"usage: PROG [options]\n" +"\n" +"positional arguments:\n" +" bar bar help\n" +"\n" +"options:\n" +" -h, --help show this help message and exit\n" +" --foo [FOO] foo help" #: ../../library/argparse.rst:208 msgid "" @@ -370,7 +428,6 @@ msgstr "" "``%(prog)s`` フォーマット指定子を、使用法メッセージ内でプログラム名として利用" "できます。" -#: ../../library/argparse.rst:211 msgid "" "When a custom usage message is specified for the main parser, you may also " "want to consider passing the ``prog`` argument to :meth:`~ArgumentParser." @@ -378,12 +435,15 @@ msgid "" "`~_SubParsersAction.add_parser`, to ensure consistent command prefixes and " "usage information across subparsers." msgstr "" +"メインのパーサーに独自の使用法メッセージを指定する場合は、サブパーサー間でコ" +"マンドの先頭部分や使用法の情報を揃えるため、:meth:`~ArgumentParser." +"add_subparsers` に ``prog`` 引数を渡すか、:meth:`~_SubParsersAction." +"add_parser` に ``prog`` と ``usage`` 引数を渡すことも検討してください。" #: ../../library/argparse.rst:221 msgid "description" msgstr "description" -#: ../../library/argparse.rst:223 msgid "" "Most calls to the :class:`ArgumentParser` constructor will use the " "``description=`` keyword argument. This argument gives a brief description " @@ -391,6 +451,11 @@ msgid "" "description is displayed between the command-line usage string and the help " "messages for the various arguments." msgstr "" +":class:`ArgumentParser` コンストラクターを呼ぶ際は、多くの場合 " +"``description=`` キーワード引数を使います。\n" +"この引数には、プログラムが何をどのように行うかの簡潔な説明を指定します。\n" +"ヘルプでは、コマンドラインの使用法を示す文字列と各引数のヘルプの間に表示され" +"ます。" #: ../../library/argparse.rst:229 msgid "" @@ -414,7 +479,6 @@ msgstr "" "します。このテキストは :class:`ArgumentParser` の ``epilog=`` 引数に指定でき" "ます::" -#: ../../library/argparse.rst:240 msgid "" ">>> parser = argparse.ArgumentParser(\n" "... description='A foo that bars',\n" @@ -429,6 +493,18 @@ msgid "" "\n" "And that's how you'd foo a bar" msgstr "" +">>> parser = argparse.ArgumentParser(\n" +"... description='A foo that bars',\n" +"... epilog=\"And that's how you'd foo a bar\")\n" +">>> parser.print_help()\n" +"usage: argparse.py [-h]\n" +"\n" +"A foo that bars\n" +"\n" +"options:\n" +" -h, --help show this help message and exit\n" +"\n" +"And that's how you'd foo a bar" #: ../../library/argparse.rst:253 msgid "" @@ -460,7 +536,6 @@ msgstr "" "すべての位置アクションとオプションのアクションをそれらから集め、そのアクショ" "ンを構築中の :class:`ArgumentParser` オブジェクトに追加します::" -#: ../../library/argparse.rst:268 msgid "" ">>> parent_parser = argparse.ArgumentParser(add_help=False)\n" ">>> parent_parser.add_argument('--parent', type=int)\n" @@ -475,16 +550,27 @@ msgid "" ">>> bar_parser.parse_args(['--bar', 'YYY'])\n" "Namespace(bar='YYY', parent=None)" msgstr "" +">>> parent_parser = argparse.ArgumentParser(add_help=False)\n" +">>> parent_parser.add_argument('--parent', type=int)\n" +"\n" +">>> foo_parser = argparse.ArgumentParser(parents=[parent_parser])\n" +">>> foo_parser.add_argument('foo')\n" +">>> foo_parser.parse_args(['--parent', '2', 'XXX'])\n" +"Namespace(foo='XXX', parent=2)\n" +"\n" +">>> bar_parser = argparse.ArgumentParser(parents=[parent_parser])\n" +">>> bar_parser.add_argument('--bar')\n" +">>> bar_parser.parse_args(['--bar', 'YYY'])\n" +"Namespace(bar='YYY', parent=None)" -#: ../../library/argparse.rst:281 msgid "" "Note that most parent parsers will specify ``add_help=False``. Otherwise, " "the :class:`ArgumentParser` will see two ``-h/--help`` options (one in the " "parent and one in the child) and raise an error." msgstr "" -"一番親になるパーサーに ``add_help=False`` を指定していることに注目してくださ" -"い。こうしないと、:class:`ArgumentParser` は2つの ``-h/--help`` オプションを" -"与えられる (1つは親から、もうひとつは子から) ことになり、エラーを発生します。" +"多くの親パーサーでは ``add_help=False`` を指定します。\n" +"そうしないと、:class:`ArgumentParser` は親と子に一つずつ、計二つの ``-h/--" +"help`` オプションを検出してエラーを発生させます。" #: ../../library/argparse.rst:286 msgid "" @@ -521,7 +607,6 @@ msgstr "" "`ArgumentParser` オブジェクトはコマンドラインヘルプの中の description_ と " "epilog_ を折り返して表示します::" -#: ../../library/argparse.rst:310 msgid "" ">>> parser = argparse.ArgumentParser(\n" "... prog='PROG',\n" @@ -544,6 +629,26 @@ msgid "" "words\n" "will be wrapped across a couple lines" msgstr "" +">>> parser = argparse.ArgumentParser(\n" +"... prog='PROG',\n" +"... description='''this description\n" +"... was indented weird\n" +"... but that is okay''',\n" +"... epilog='''\n" +"... likewise for this epilog whose whitespace will\n" +"... be cleaned up and whose words will be wrapped\n" +"... across a couple lines''')\n" +">>> parser.print_help()\n" +"usage: PROG [-h]\n" +"\n" +"this description was indented weird but that is okay\n" +"\n" +"options:\n" +" -h, --help show this help message and exit\n" +"\n" +"likewise for this epilog whose whitespace will be cleaned up and whose " +"words\n" +"will be wrapped across a couple lines" #: ../../library/argparse.rst:330 msgid "" @@ -554,7 +659,6 @@ msgstr "" "``formatter_class=`` に :class:`RawDescriptionHelpFormatter` を渡した場合、 " "description_ と epilog_ は整形済みとされ改行されません::" -#: ../../library/argparse.rst:334 msgid "" ">>> parser = argparse.ArgumentParser(\n" "... prog='PROG',\n" @@ -578,14 +682,38 @@ msgid "" "options:\n" " -h, --help show this help message and exit" msgstr "" +">>> parser = argparse.ArgumentParser(\n" +"... prog='PROG',\n" +"... formatter_class=argparse.RawDescriptionHelpFormatter,\n" +"... description=textwrap.dedent('''\\\n" +"... Please do not mess up this text!\n" +"... --------------------------------\n" +"... I have indented it\n" +"... exactly the way\n" +"... I want it\n" +"... '''))\n" +">>> parser.print_help()\n" +"usage: PROG [-h]\n" +"\n" +"Please do not mess up this text!\n" +"--------------------------------\n" +" I have indented it\n" +" exactly the way\n" +" I want it\n" +"\n" +"options:\n" +" -h, --help show this help message and exit" -#: ../../library/argparse.rst:356 msgid "" ":class:`RawTextHelpFormatter` maintains whitespace for all sorts of help " "text, including argument descriptions. However, multiple newlines are " "replaced with one. If you wish to preserve multiple blank lines, add spaces " "between the newlines." msgstr "" +":class:`RawTextHelpFormatter` は、引数の説明を含むすべてのヘルプテキストの空" +"白を保持します。\n" +"ただし、連続する改行は一つにまとめられます。\n" +"複数の空行を残したい場合は、改行の間にスペースを入れてください。" #: ../../library/argparse.rst:361 msgid "" @@ -595,7 +723,6 @@ msgstr "" ":class:`ArgumentDefaultsHelpFormatter` は各引数のデフォルト値を自動的にヘルプ" "に追加します::" -#: ../../library/argparse.rst:364 msgid "" ">>> parser = argparse.ArgumentParser(\n" "... prog='PROG',\n" @@ -612,6 +739,20 @@ msgid "" " -h, --help show this help message and exit\n" " --foo FOO FOO! (default: 42)" msgstr "" +">>> parser = argparse.ArgumentParser(\n" +"... prog='PROG',\n" +"... formatter_class=argparse.ArgumentDefaultsHelpFormatter)\n" +">>> parser.add_argument('--foo', type=int, default=42, help='FOO!')\n" +">>> parser.add_argument('bar', nargs='*', default=[1, 2, 3], help='BAR!')\n" +">>> parser.print_help()\n" +"usage: PROG [-h] [--foo FOO] [bar ...]\n" +"\n" +"positional arguments:\n" +" bar BAR! (default: [1, 2, 3])\n" +"\n" +"options:\n" +" -h, --help show this help message and exit\n" +" --foo FOO FOO! (default: 42)" #: ../../library/argparse.rst:379 msgid "" @@ -622,7 +763,6 @@ msgstr "" ":class:`MetavarTypeHelpFormatter` は、各引数の値の表示名に type_ 引数の値を使" "用します (通常は dest_ の値が使用されます)::" -#: ../../library/argparse.rst:383 msgid "" ">>> parser = argparse.ArgumentParser(\n" "... prog='PROG',\n" @@ -639,20 +779,37 @@ msgid "" " -h, --help show this help message and exit\n" " --foo int" msgstr "" +">>> parser = argparse.ArgumentParser(\n" +"... prog='PROG',\n" +"... formatter_class=argparse.MetavarTypeHelpFormatter)\n" +">>> parser.add_argument('--foo', type=int)\n" +">>> parser.add_argument('bar', type=float)\n" +">>> parser.print_help()\n" +"usage: PROG [-h] [--foo int] float\n" +"\n" +"positional arguments:\n" +" float\n" +"\n" +"options:\n" +" -h, --help show this help message and exit\n" +" --foo int" #: ../../library/argparse.rst:400 msgid "prefix_chars" msgstr "prefix_chars" -#: ../../library/argparse.rst:402 msgid "" "Most command-line options will use ``-`` as the prefix, e.g. ``-f/--foo``. " "Parsers that need to support different or additional prefix characters, e.g. " "for options like ``+f`` or ``/foo``, may specify them using the " "``prefix_chars=`` argument to the :class:`ArgumentParser` constructor::" msgstr "" +"ほとんどのコマンドラインオプションでは、``-f/--foo`` のように接頭辞として ``-" +"`` を使います。\n" +"``+f`` や ``/foo`` のように、別の文字や追加の文字を接頭辞としてサポートする必" +"要があるパーサーでは、:class:`ArgumentParser` コンストラクターの " +"``prefix_chars=`` 引数でそれらの文字を指定できます。 ::" -#: ../../library/argparse.rst:408 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', prefix_chars='-+')\n" ">>> parser.add_argument('+f')\n" @@ -660,6 +817,11 @@ msgid "" ">>> parser.parse_args('+f X ++bar Y'.split())\n" "Namespace(bar='Y', f='X')" msgstr "" +">>> parser = argparse.ArgumentParser(prog='PROG', prefix_chars='-+')\n" +">>> parser.add_argument('+f')\n" +">>> parser.add_argument('++bar')\n" +">>> parser.parse_args('+f X ++bar Y'.split())\n" +"Namespace(bar='Y', f='X')" #: ../../library/argparse.rst:414 msgid "" @@ -689,7 +851,6 @@ msgstr "" "た場合、指定された文字のいずれかで始まる引数はファイルとして扱われ、そのファ" "イルに含まれる引数リストに置換されます。例えば::" -#: ../../library/argparse.rst:429 msgid "" ">>> with open('args.txt', 'w', encoding=sys.getfilesystemencoding()) as fp:\n" "... fp.write('-f\\nbar')\n" @@ -699,6 +860,13 @@ msgid "" ">>> parser.parse_args(['-f', 'foo', '@args.txt'])\n" "Namespace(f='bar')" msgstr "" +">>> with open('args.txt', 'w', encoding=sys.getfilesystemencoding()) as fp:\n" +"... fp.write('-f\\nbar')\n" +"...\n" +">>> parser = argparse.ArgumentParser(fromfile_prefix_chars='@')\n" +">>> parser.add_argument('-f')\n" +">>> parser.parse_args(['-f', 'foo', '@args.txt'])\n" +"Namespace(f='bar')" #: ../../library/argparse.rst:437 msgid "" @@ -715,11 +883,12 @@ msgstr "" "ます。このため、上の例では、``['-f', 'foo', '@args.txt']`` は ``['-f', " "'foo', '-f', 'bar']`` と等価になります。" -#: ../../library/argparse.rst:443 msgid "" ":class:`ArgumentParser` uses :term:`filesystem encoding and error handler` " "to read the file containing arguments." msgstr "" +":class:`ArgumentParser` は、引数を記述したファイルを :term:`filesystem " +"encoding and error handler` を使って読み込みます。" #: ../../library/argparse.rst:446 msgid "" @@ -729,7 +898,6 @@ msgstr "" "``fromfile_prefix_chars=`` 引数のデフォルト値は ``None`` で、引数がファイル参" "照として扱われることがないことを意味しています。" -#: ../../library/argparse.rst:449 msgid "" ":class:`ArgumentParser` changed encoding and errors to read arguments files " "from default (e.g. :func:`locale.getpreferredencoding(False) ` と ``\"strict\"`` など) から :term:" +"`filesystem encoding and error handler` に変更しました。\n" +"Windows では、引数ファイルを ANSI コードページではなく UTF-8 でエンコードして" +"ください。" #: ../../library/argparse.rst:457 msgid "argument_default" @@ -761,7 +935,6 @@ msgstr "" "全体で :meth:`~ArgumentParser.parse_args` メソッド呼び出しの属性の生成を抑制" "するには、``argument_default=SUPPRESS`` を指定します::" -#: ../../library/argparse.rst:468 msgid "" ">>> parser = argparse.ArgumentParser(argument_default=argparse.SUPPRESS)\n" ">>> parser.add_argument('--foo')\n" @@ -771,6 +944,13 @@ msgid "" ">>> parser.parse_args([])\n" "Namespace()" msgstr "" +">>> parser = argparse.ArgumentParser(argument_default=argparse.SUPPRESS)\n" +">>> parser.add_argument('--foo')\n" +">>> parser.add_argument('bar', nargs='?')\n" +">>> parser.parse_args(['--foo', '1', 'BAR'])\n" +"Namespace(bar='BAR', foo='1')\n" +">>> parser.parse_args([])\n" +"Namespace()" #: ../../library/argparse.rst:479 msgid "allow_abbrev" @@ -791,7 +971,6 @@ msgid "This feature can be disabled by setting ``allow_abbrev`` to ``False``::" msgstr "" "この機能は、``allow_abbrev`` に ``False`` を指定することで無効にできます::" -#: ../../library/argparse.rst:487 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', allow_abbrev=False)\n" ">>> parser.add_argument('--foobar', action='store_true')\n" @@ -800,6 +979,12 @@ msgid "" "usage: PROG [-h] [--foobar] [--foonley]\n" "PROG: error: unrecognized arguments: --foon" msgstr "" +">>> parser = argparse.ArgumentParser(prog='PROG', allow_abbrev=False)\n" +">>> parser.add_argument('--foobar', action='store_true')\n" +">>> parser.add_argument('--foonley', action='store_false')\n" +">>> parser.parse_args(['--foon'])\n" +"usage: PROG [-h] [--foobar] [--foonley]\n" +"PROG: error: unrecognized arguments: --foon" #: ../../library/argparse.rst:498 msgid "conflict_handler" @@ -817,7 +1002,6 @@ msgstr "" "デフォルトでは、:class:`ArgumentParser` オブジェクトは、すでに利用されている" "オプション文字列を使って新しい引数をつくろうとしたときに例外を送出します::" -#: ../../library/argparse.rst:505 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-f', '--foo', help='old foo help')\n" @@ -826,6 +1010,12 @@ msgid "" " ..\n" "ArgumentError: argument --foo: conflicting option string(s): --foo" msgstr "" +">>> parser = argparse.ArgumentParser(prog='PROG')\n" +">>> parser.add_argument('-f', '--foo', help='old foo help')\n" +">>> parser.add_argument('--foo', help='new foo help')\n" +"Traceback (most recent call last):\n" +" ..\n" +"ArgumentError: argument --foo: conflicting option string(s): --foo" #: ../../library/argparse.rst:512 msgid "" @@ -838,7 +1028,6 @@ msgstr "" "で上書きするほうが便利な場合があります。この動作をするには、:class:" "`ArgumentParser` の ``conflict_handler=`` 引数に ``'resolve'`` を渡します::" -#: ../../library/argparse.rst:517 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', " "conflict_handler='resolve')\n" @@ -852,6 +1041,17 @@ msgid "" " -f FOO old foo help\n" " --foo FOO new foo help" msgstr "" +">>> parser = argparse.ArgumentParser(prog='PROG', " +"conflict_handler='resolve')\n" +">>> parser.add_argument('-f', '--foo', help='old foo help')\n" +">>> parser.add_argument('--foo', help='new foo help')\n" +">>> parser.print_help()\n" +"usage: PROG [-h] [-f FOO] [--foo FOO]\n" +"\n" +"options:\n" +" -h, --help show this help message and exit\n" +" -f FOO old foo help\n" +" --foo FOO new foo help" #: ../../library/argparse.rst:528 msgid "" @@ -869,12 +1069,15 @@ msgstr "" msgid "add_help" msgstr "add_help" -#: ../../library/argparse.rst:537 msgid "" "By default, :class:`ArgumentParser` objects add an option which simply " "displays the parser's help message. If ``-h`` or ``--help`` is supplied at " "the command line, the :class:`!ArgumentParser` help will be printed." msgstr "" +"デフォルトでは、:class:`ArgumentParser` オブジェクトに、パーサーのヘルプを表" +"示するオプションが追加されます。\n" +"コマンドラインで ``-h`` または ``--help`` を指定すると、:class:`!" +"ArgumentParser` のヘルプが表示されます。" #: ../../library/argparse.rst:541 msgid "" @@ -885,7 +1088,6 @@ msgstr "" "必要に応じて、この help オプションを無効にする場合があります。これは :class:" "`ArgumentParser` の ``add_help=`` 引数に ``False`` を渡すことで可能です::" -#: ../../library/argparse.rst:545 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', add_help=False)\n" ">>> parser.add_argument('--foo', help='foo help')\n" @@ -895,6 +1097,13 @@ msgid "" "options:\n" " --foo FOO foo help" msgstr "" +">>> parser = argparse.ArgumentParser(prog='PROG', add_help=False)\n" +">>> parser.add_argument('--foo', help='foo help')\n" +">>> parser.print_help()\n" +"usage: PROG [--foo FOO]\n" +"\n" +"options:\n" +" --foo FOO foo help" #: ../../library/argparse.rst:553 msgid "" @@ -908,7 +1117,6 @@ msgstr "" "オプションではありません。この場合、``prefix_chars`` の最初の文字がヘルプオプ" "ションの接頭辞として利用されます::" -#: ../../library/argparse.rst:559 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', prefix_chars='+/')\n" ">>> parser.print_help()\n" @@ -917,17 +1125,25 @@ msgid "" "options:\n" " +h, ++help show this help message and exit" msgstr "" +">>> parser = argparse.ArgumentParser(prog='PROG', prefix_chars='+/')\n" +">>> parser.print_help()\n" +"usage: PROG [+h]\n" +"\n" +"options:\n" +" +h, ++help show this help message and exit" #: ../../library/argparse.rst:568 msgid "exit_on_error" msgstr "exit_on_error" -#: ../../library/argparse.rst:570 msgid "" "Normally, when you pass an invalid argument list to the :meth:" "`~ArgumentParser.parse_args` method of an :class:`ArgumentParser`, it will " "print a *message* to :data:`sys.stderr` and exit with a status code of 2." msgstr "" +"通常、:class:`ArgumentParser` の :meth:`~ArgumentParser.parse_args` メソッド" +"に不正な引数リストを渡すと、:data:`sys.stderr` に *メッセージ* を表示し、終了" +"ステータス 2 で終了します。" #: ../../library/argparse.rst:574 msgid "" @@ -937,7 +1153,6 @@ msgstr "" "もしエラーを例外としてプログラム内でキャッチしたい場合は、``exit_on_error`` " "を ``False`` に設定してください::" -#: ../../library/argparse.rst:577 msgid "" ">>> parser = argparse.ArgumentParser(exit_on_error=False)\n" ">>> parser.add_argument('--integers', type=int)\n" @@ -951,10 +1166,20 @@ msgid "" "...\n" "Catching an argumentError" msgstr "" +">>> parser = argparse.ArgumentParser(exit_on_error=False)\n" +">>> parser.add_argument('--integers', type=int)\n" +"_StoreAction(option_strings=['--integers'], dest='integers', nargs=None, " +"const=None, default=None, type=, choices=None, help=None, " +"metavar=None)\n" +">>> try:\n" +"... parser.parse_args('--integers a'.split())\n" +"... except argparse.ArgumentError:\n" +"... print('Catching an argumentError')\n" +"...\n" +"Catching an argumentError" -#: ../../library/argparse.rst:590 msgid "suggest_on_error" -msgstr "" +msgstr "suggest_on_error" #: ../../library/argparse.rst:592 msgid "" @@ -1050,11 +1275,12 @@ msgstr "" "1つのコマンドライン引数がどう解析されるかを定義します。各引数についての詳細は" "後述しますが、簡単に言うと:" -#: ../../library/argparse.rst:657 msgid "" "`name or flags`_ - Either a name or a list of option strings, e.g. ``'foo'`` " "or ``'-f', '--foo'``." msgstr "" +"`name or flags`_ - 名前、またはオプション文字列のリスト (例: ``'foo'``、``'-" +"f', '--foo'``)。" #: ../../library/argparse.rst:660 msgid "" @@ -1071,13 +1297,12 @@ msgid "" "const_ - A constant value required by some action_ and nargs_ selections." msgstr "const_ - 一部の action_ と nargs_ の組み合わせで利用される定数。" -#: ../../library/argparse.rst:667 msgid "" "default_ - The value produced if the argument is absent from the command " "line and if it is absent from the namespace object." msgstr "" "default_ - コマンドラインに対応する引数が存在せず、さらに namespace オブジェ" -"クトにも存在しない場合に利用される値。 " +"クトにも存在しない場合に利用される値。" #: ../../library/argparse.rst:670 msgid "" @@ -1109,9 +1334,8 @@ msgid "" "meth:`parse_args`." msgstr "dest_ - :meth:`parse_args` が返すオブジェクトに追加される属性名。" -#: ../../library/argparse.rst:684 msgid "deprecated_ - Whether or not use of the argument is deprecated." -msgstr "" +msgstr "deprecated_ - この引数の使用が非推奨かどうか。" #: ../../library/argparse.rst:692 msgid "name or flags" @@ -1135,17 +1359,15 @@ msgstr "" msgid "For example, an optional argument could be created like::" msgstr "たとえば、オプション引数は次のように作成します::" -#: ../../library/argparse.rst:702 msgid ">>> parser.add_argument('-f', '--foo')" -msgstr "" +msgstr ">>> parser.add_argument('-f', '--foo')" #: ../../library/argparse.rst:704 msgid "while a positional argument could be created like::" msgstr "一方、位置引数は次のように作成します::" -#: ../../library/argparse.rst:706 msgid ">>> parser.add_argument('bar')" -msgstr "" +msgstr ">>> parser.add_argument('bar')" #: ../../library/argparse.rst:708 msgid "" @@ -1156,7 +1378,6 @@ msgstr "" ":meth:`~ArgumentParser.parse_args` が呼ばれたとき、オプション引数は接頭辞 ``-" "`` により識別され、それ以外の引数は位置引数として扱われます::" -#: ../../library/argparse.rst:712 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-f', '--foo')\n" @@ -1169,6 +1390,16 @@ msgid "" "usage: PROG [-h] [-f FOO] bar\n" "PROG: error: the following arguments are required: bar" msgstr "" +">>> parser = argparse.ArgumentParser(prog='PROG')\n" +">>> parser.add_argument('-f', '--foo')\n" +">>> parser.add_argument('bar')\n" +">>> parser.parse_args(['BAR'])\n" +"Namespace(bar='BAR', foo=None)\n" +">>> parser.parse_args(['BAR', '--foo', 'FOO'])\n" +"Namespace(bar='BAR', foo='FOO')\n" +">>> parser.parse_args(['--foo', 'FOO'])\n" +"usage: PROG [-h] [-f FOO] bar\n" +"PROG: error: the following arguments are required: bar" #: ../../library/argparse.rst:723 msgid "" @@ -1214,11 +1445,12 @@ msgstr "" "引数は、コマンドライン引数がどう処理されるかを指定します。提供されているアク" "ションは:" -#: ../../library/argparse.rst:754 msgid "" "``'store'`` - This just stores the argument's value. This is the default " "action." msgstr "" +"``'store'`` - 引数の値を格納します。\n" +"これがデフォルトのアクションです。" #: ../../library/argparse.rst:757 msgid "" @@ -1232,13 +1464,16 @@ msgstr "" "ください。``'store_const'`` アクションは、何かの種類のフラグを指定するオプ" "ション引数によく使われます。例えば::" -#: ../../library/argparse.rst:762 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', action='store_const', const=42)\n" ">>> parser.parse_args(['--foo'])\n" "Namespace(foo=42)" msgstr "" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument('--foo', action='store_const', const=42)\n" +">>> parser.parse_args(['--foo'])\n" +"Namespace(foo=42)" #: ../../library/argparse.rst:767 msgid "" @@ -1248,7 +1483,6 @@ msgid "" "``True`` respectively::" msgstr "" -#: ../../library/argparse.rst:772 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', action='store_true')\n" @@ -1257,6 +1491,12 @@ msgid "" ">>> parser.parse_args('--foo --bar'.split())\n" "Namespace(foo=True, bar=False, baz=True)" msgstr "" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument('--foo', action='store_true')\n" +">>> parser.add_argument('--bar', action='store_false')\n" +">>> parser.add_argument('--baz', action='store_false')\n" +">>> parser.parse_args('--foo --bar'.split())\n" +"Namespace(foo=True, bar=False, baz=True)" #: ../../library/argparse.rst:779 msgid "" @@ -1292,7 +1532,6 @@ msgstr "" "は ``None`` であることに注意してください。``'append_const'`` アクションは、定" "数を同じリストに複数回格納する場合に便利です。例えば::" -#: ../../library/argparse.rst:796 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--str', dest='types', action='append_const', " @@ -1302,6 +1541,13 @@ msgid "" ">>> parser.parse_args('--str --int'.split())\n" "Namespace(types=[, ])" msgstr "" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument('--str', dest='types', action='append_const', " +"const=str)\n" +">>> parser.add_argument('--int', dest='types', action='append_const', " +"const=int)\n" +">>> parser.parse_args('--str --int'.split())\n" +"Namespace(types=[, ])" #: ../../library/argparse.rst:802 msgid "" @@ -1312,7 +1558,6 @@ msgid "" "will be appended to the list. Example usage::" msgstr "" -#: ../../library/argparse.rst:810 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument(\"--foo\", action=\"extend\", nargs=\"+\", " @@ -1321,6 +1566,12 @@ msgid "" "\"f4\"])\n" "Namespace(foo=['f1', 'f2', 'f3', 'f4'])" msgstr "" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument(\"--foo\", action=\"extend\", nargs=\"+\", " +"type=str)\n" +">>> parser.parse_args([\"--foo\", \"f1\", \"--foo\", \"f2\", \"f3\", " +"\"f4\"])\n" +"Namespace(foo=['f1', 'f2', 'f3', 'f4'])" #: ../../library/argparse.rst:817 msgid "" @@ -1330,13 +1581,16 @@ msgstr "" "``'count'`` - このアクションはキーワード引数の数を数えます。例えば、verboseレ" "ベルを上げるのに役立ちます::" -#: ../../library/argparse.rst:820 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--verbose', '-v', action='count', default=0)\n" ">>> parser.parse_args(['-vvv'])\n" "Namespace(verbose=3)" msgstr "" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument('--verbose', '-v', action='count', default=0)\n" +">>> parser.parse_args(['-vvv'])\n" +"Namespace(verbose=3)" #: ../../library/argparse.rst:825 msgid "Note, the *default* will be ``None`` unless explicitly set to *0*." @@ -1344,16 +1598,16 @@ msgstr "" "*default* は明示的に *0* と指定されない場合は ``None`` であることに注意してく" "ださい。" -#: ../../library/argparse.rst:827 msgid "" "``'help'`` - This prints a complete help message for all the options in the " "current parser and then exits. By default a help action is automatically " "added to the parser. See :class:`ArgumentParser` for details of how the " "output is created." msgstr "" -"``'help'`` - このアクションは現在のパーサー中のすべてのオプションのヘルプメッ" -"セージを表示し、終了します。出力の生成方法の詳細については :class:" -"`ArgumentParser` を参照してください。" +"``'help'`` - 現在のパーサーのすべてのオプションについてヘルプを表示し、終了し" +"ます。\n" +"デフォルトでは、このヘルプアクションはパーサーに自動的に追加されます。\n" +"出力の生成方法の詳細は :class:`ArgumentParser` を参照してください。" #: ../../library/argparse.rst:832 msgid "" @@ -1365,7 +1619,6 @@ msgstr "" "出しに ``version=`` キーワード引数を期待します。指定されたときはバージョン情" "報を表示して終了します::" -#: ../../library/argparse.rst:836 msgid "" ">>> import argparse\n" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" @@ -1374,6 +1627,12 @@ msgid "" ">>> parser.parse_args(['--version'])\n" "PROG 2.0" msgstr "" +">>> import argparse\n" +">>> parser = argparse.ArgumentParser(prog='PROG')\n" +">>> parser.add_argument('--version', action='version', version='%(prog)s " +"2.0')\n" +">>> parser.parse_args(['--version'])\n" +"PROG 2.0" #: ../../library/argparse.rst:842 msgid "" @@ -1389,7 +1648,6 @@ msgid "" "boolean actions such as ``--foo`` and ``--no-foo``::" msgstr "" -#: ../../library/argparse.rst:852 msgid "" ">>> import argparse\n" ">>> parser = argparse.ArgumentParser()\n" @@ -1397,8 +1655,12 @@ msgid "" ">>> parser.parse_args(['--no-foo'])\n" "Namespace(foo=False)" msgstr "" +">>> import argparse\n" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument('--foo', action=argparse.BooleanOptionalAction)\n" +">>> parser.parse_args(['--no-foo'])\n" +"Namespace(foo=False)" -#: ../../library/argparse.rst:860 msgid "" "The recommended way to create a custom action is to extend :class:`Action`, " "overriding the :meth:`!__call__` method and optionally the :meth:`!__init__` " @@ -1406,12 +1668,16 @@ msgid "" "using the :meth:`~ArgumentParser.register` method and reference them by " "their registered name." msgstr "" +"カスタムアクションを作るには、:class:`Action` を継承して :meth:`!__call__` メ" +"ソッドをオーバーライドし、必要に応じて :meth:`!__init__` と :meth:`!" +"format_usage` メソッドもオーバーライドする方法を推奨します。\n" +":meth:`~ArgumentParser.register` メソッドでカスタムアクションを登録し、その登" +"録名で参照することもできます。" #: ../../library/argparse.rst:865 msgid "An example of a custom action::" msgstr "カスタムアクションの例です::" -#: ../../library/argparse.rst:867 msgid "" ">>> class FooAction(argparse.Action):\n" "... def __init__(self, option_strings, dest, nargs=None, **kwargs):\n" @@ -1431,16 +1697,32 @@ msgid "" ">>> args\n" "Namespace(bar='1', foo='2')" msgstr "" - -#: ../../library/argparse.rst:885 -msgid "For more details, see :class:`Action`." -msgstr "詳細は :class:`Action` を参照してください。" - -#: ../../library/argparse.rst:891 +">>> class FooAction(argparse.Action):\n" +"... def __init__(self, option_strings, dest, nargs=None, **kwargs):\n" +"... if nargs is not None:\n" +"... raise ValueError(\"nargs not allowed\")\n" +"... super().__init__(option_strings, dest, **kwargs)\n" +"... def __call__(self, parser, namespace, values, option_string=None):\n" +"... print('%r %r %r' % (namespace, values, option_string))\n" +"... setattr(namespace, self.dest, values)\n" +"...\n" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument('--foo', action=FooAction)\n" +">>> parser.add_argument('bar', action=FooAction)\n" +">>> args = parser.parse_args('1 --foo 2'.split())\n" +"Namespace(bar=None, foo=None) '1' None\n" +"Namespace(bar='1', foo=None) '2' '--foo'\n" +">>> args\n" +"Namespace(bar='1', foo='2')" + +#: ../../library/argparse.rst:885 +msgid "For more details, see :class:`Action`." +msgstr "詳細は :class:`Action` を参照してください。" + +#: ../../library/argparse.rst:891 msgid "nargs" msgstr "nargs" -#: ../../library/argparse.rst:893 msgid "" ":class:`ArgumentParser` objects usually associate a single command-line " "argument with a single action to be taken. The ``nargs`` keyword argument " @@ -1448,6 +1730,12 @@ msgid "" "action. See also :ref:`specifying-ambiguous-arguments`. The supported values " "are:" msgstr "" +":class:`ArgumentParser` オブジェクトは通常、一つのコマンドライン引数に対して" +"一つのアクションを実行します。\n" +"``nargs`` キーワード引数を使うと、一つのアクションに別の個数のコマンドライン" +"引数を対応させられます。\n" +":ref:`specifying-ambiguous-arguments` も参照してください。\n" +"指定できる値は次のとおりです。" #: ../../library/argparse.rst:898 msgid "" @@ -1457,7 +1745,6 @@ msgstr "" "``N`` (整数) -- ``N`` 個の引数がコマンドラインから集められ、リストに格納され" "ます。例えば::" -#: ../../library/argparse.rst:901 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', nargs=2)\n" @@ -1465,6 +1752,11 @@ msgid "" ">>> parser.parse_args('c --foo a b'.split())\n" "Namespace(bar=['c'], foo=['a', 'b'])" msgstr "" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument('--foo', nargs=2)\n" +">>> parser.add_argument('bar', nargs=1)\n" +">>> parser.parse_args('c --foo a b'.split())\n" +"Namespace(bar=['c'], foo=['a', 'b'])" #: ../../library/argparse.rst:907 msgid "" @@ -1489,7 +1781,6 @@ msgstr "" "いというケースもありえます。この場合は const_ の値が生成されます。この動作の" "例です::" -#: ../../library/argparse.rst:919 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', nargs='?', const='c', default='d')\n" @@ -1501,6 +1792,15 @@ msgid "" ">>> parser.parse_args([])\n" "Namespace(bar='d', foo='d')" msgstr "" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument('--foo', nargs='?', const='c', default='d')\n" +">>> parser.add_argument('bar', nargs='?', default='d')\n" +">>> parser.parse_args(['XX', '--foo', 'YY'])\n" +"Namespace(bar='XX', foo='YY')\n" +">>> parser.parse_args(['XX', '--foo'])\n" +"Namespace(bar='XX', foo='c')\n" +">>> parser.parse_args([])\n" +"Namespace(bar='d', foo='d')" #: ../../library/argparse.rst:929 msgid "" @@ -1509,7 +1809,6 @@ msgid "" msgstr "" "``nargs='?'`` のよくある利用例の1つは、入出力ファイルの指定オプションです::" -#: ../../library/argparse.rst:932 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('infile', nargs='?')\n" @@ -1521,6 +1820,15 @@ msgid "" ">>> parser.parse_args([])\n" "Namespace(infile=None, outfile=None)" msgstr "" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument('infile', nargs='?')\n" +">>> parser.add_argument('outfile', nargs='?')\n" +">>> parser.parse_args(['input.txt', 'output.txt'])\n" +"Namespace(infile='input.txt', outfile='output.txt')\n" +">>> parser.parse_args(['input.txt'])\n" +"Namespace(infile='input.txt', outfile=None)\n" +">>> parser.parse_args([])\n" +"Namespace(infile=None, outfile=None)" #: ../../library/argparse.rst:944 msgid "" @@ -1533,7 +1841,6 @@ msgstr "" "が ``nargs='*'`` を持つことにあまり意味はありませんが、複数のオプション引数" "が ``nargs='*'`` を持つことはありえます。例えば::" -#: ../../library/argparse.rst:949 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', nargs='*')\n" @@ -1542,6 +1849,12 @@ msgid "" ">>> parser.parse_args('a b --foo x y --bar 1 2'.split())\n" "Namespace(bar=['1', '2'], baz=['a', 'b'], foo=['x', 'y'])" msgstr "" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument('--foo', nargs='*')\n" +">>> parser.add_argument('--bar', nargs='*')\n" +">>> parser.add_argument('baz', nargs='*')\n" +">>> parser.parse_args('a b --foo x y --bar 1 2'.split())\n" +"Namespace(bar=['1', '2'], baz=['a', 'b'], foo=['x', 'y'])" #: ../../library/argparse.rst:958 msgid "" @@ -1553,7 +1866,6 @@ msgstr "" "す。加えて、最低でも1つのコマンドライン引数が存在しない場合にエラーメッセージ" "を生成します。例えば::" -#: ../../library/argparse.rst:962 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('foo', nargs='+')\n" @@ -1563,8 +1875,14 @@ msgid "" "usage: PROG [-h] foo [foo ...]\n" "PROG: error: the following arguments are required: foo" msgstr "" +">>> parser = argparse.ArgumentParser(prog='PROG')\n" +">>> parser.add_argument('foo', nargs='+')\n" +">>> parser.parse_args(['a', 'b'])\n" +"Namespace(foo=['a', 'b'])\n" +">>> parser.parse_args([])\n" +"usage: PROG [-h] foo [foo ...]\n" +"PROG: error: the following arguments are required: foo" -#: ../../library/argparse.rst:970 msgid "" "If the ``nargs`` keyword argument is not provided, the number of arguments " "consumed is determined by the action_. Generally this means a single " @@ -1572,6 +1890,12 @@ msgid "" "be produced. Actions that do not consume command-line arguments (e.g. " "``'store_const'``) set ``nargs=0``." msgstr "" +"``nargs`` キーワード引数を指定しなかった場合、消費する引数の数は action_ に" +"よって決まります。\n" +"通常は、一つのコマンドライン引数を消費して、リストではなく単一の値を生成しま" +"す。\n" +"コマンドライン引数を消費しないアクション (``'store_const'`` など) では、" +"``nargs=0`` が設定されます。" #: ../../library/argparse.rst:980 msgid "const" @@ -1646,7 +1970,6 @@ msgstr "" "る値を指定します。オプション引数では、オプション文字列がコマンドライン上に存" "在しなかったときに ``default`` の値が利用されます::" -#: ../../library/argparse.rst:1017 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default=42)\n" @@ -1655,20 +1978,30 @@ msgid "" ">>> parser.parse_args([])\n" "Namespace(foo=42)" msgstr "" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument('--foo', default=42)\n" +">>> parser.parse_args(['--foo', '2'])\n" +"Namespace(foo='2')\n" +">>> parser.parse_args([])\n" +"Namespace(foo=42)" -#: ../../library/argparse.rst:1024 msgid "" "If the target namespace already has an attribute set, the action *default* " "will not overwrite it::" msgstr "" +"対象の名前空間にすでに属性が設定されている場合、アクションの *default* はその" +"値を上書きしません。 ::" -#: ../../library/argparse.rst:1027 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default=42)\n" ">>> parser.parse_args([], namespace=argparse.Namespace(foo=101))\n" "Namespace(foo=101)" msgstr "" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument('--foo', default=42)\n" +">>> parser.parse_args([], namespace=argparse.Namespace(foo=101))\n" +"Namespace(foo=101)" #: ../../library/argparse.rst:1032 msgid "" @@ -1682,7 +2015,6 @@ msgstr "" "に、type_ 変換引数が与えられていればそれらを適用します。そうでない場合、パー" "サーは値をそのまま使用します::" -#: ../../library/argparse.rst:1037 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--length', default='10', type=int)\n" @@ -1690,6 +2022,11 @@ msgid "" ">>> parser.parse_args()\n" "Namespace(length=10, width=10.5)" msgstr "" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument('--length', default='10', type=int)\n" +">>> parser.add_argument('--width', default=10.5, type=int)\n" +">>> parser.parse_args()\n" +"Namespace(length=10, width=10.5)" #: ../../library/argparse.rst:1043 msgid "" @@ -1699,7 +2036,6 @@ msgstr "" "nargs_ が ``?`` か ``*`` である位置引数では、コマンドライン引数が指定されな" "かった場合 ``default`` の値が使われます。例えば::" -#: ../../library/argparse.rst:1046 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('foo', nargs='?', default=42)\n" @@ -1708,13 +2044,21 @@ msgid "" ">>> parser.parse_args([])\n" "Namespace(foo=42)" msgstr "" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument('foo', nargs='?', default=42)\n" +">>> parser.parse_args(['a'])\n" +"Namespace(foo='a')\n" +">>> parser.parse_args([])\n" +"Namespace(foo=42)" -#: ../../library/argparse.rst:1053 msgid "" "For required_ arguments, the ``default`` value is ignored. For example, this " "applies to positional arguments with nargs_ values other than ``?`` or " "``*``, or optional arguments marked as ``required=True``." msgstr "" +"required_ の引数では ``default`` の値は無視されます。\n" +"例えば、nargs_ が ``?`` や ``*`` 以外の位置引数や、``required=True`` を指定し" +"たオプション引数が該当します。" #: ../../library/argparse.rst:1057 msgid "" @@ -1724,7 +2068,6 @@ msgstr "" "``default=argparse.SUPPRESS`` を渡すと、コマンドライン引数が存在しないときに" "属性の追加をしなくなります::" -#: ../../library/argparse.rst:1060 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default=argparse.SUPPRESS)\n" @@ -1733,6 +2076,12 @@ msgid "" ">>> parser.parse_args(['--foo', '1'])\n" "Namespace(foo='1')" msgstr "" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument('--foo', default=argparse.SUPPRESS)\n" +">>> parser.parse_args([])\n" +"Namespace()\n" +">>> parser.parse_args(['--foo', '1'])\n" +"Namespace(foo='1')" #: ../../library/argparse.rst:1071 msgid "type" @@ -1757,10 +2106,10 @@ msgid "" "If the type_ keyword is used with the default_ keyword, the type converter " "is only applied if the default is a string." msgstr "" -"もし type_ キーワードが default_ キーワードとともに使用された場合、default_ " -"の値が文字列のときのみ、type converter による変換などが行われます。" +"もし type_ キーワードが default_ キーワードとともに使用された場合、" +"``default`` の値が文字列のときのみ、type converter による変換などが行われま" +"す。" -#: ../../library/argparse.rst:1082 msgid "" "The argument to ``type`` can be a callable that accepts a single string or " "the name of a registered type (see :meth:`~ArgumentParser.register`) If the " @@ -1768,13 +2117,17 @@ msgid "" "`ValueError`, the exception is caught and a nicely formatted error message " "is displayed. Other exception types are not handled." msgstr "" +"``type`` には、一つの文字列を受け取る呼び出し可能オブジェクト、または登録済み" +"の型の名前 (:meth:`~ArgumentParser.register` を参照) を渡せます。\n" +"この関数が :exc:`ArgumentTypeError`、:exc:`TypeError`、:exc:`ValueError` を送" +"出すると、その例外を捕捉して読みやすい形式のエラーメッセージを表示します。\n" +"それ以外の例外は処理しません。" #: ../../library/argparse.rst:1088 msgid "Common built-in types and functions can be used as type converters:" msgstr "" "一般的なビルトインデータ型や関数を ``type`` 引数の値として直接指定できます::" -#: ../../library/argparse.rst:1090 msgid "" "import argparse\n" "import pathlib\n" @@ -1786,12 +2139,20 @@ msgid "" "parser.add_argument('code_point', type=ord)\n" "parser.add_argument('datapath', type=pathlib.Path)" msgstr "" +"import argparse\n" +"import pathlib\n" +"\n" +"parser = argparse.ArgumentParser()\n" +"parser.add_argument('count', type=int)\n" +"parser.add_argument('distance', type=float)\n" +"parser.add_argument('street', type=ascii)\n" +"parser.add_argument('code_point', type=ord)\n" +"parser.add_argument('datapath', type=pathlib.Path)" #: ../../library/argparse.rst:1102 msgid "User defined functions can be used as well:" msgstr "ユーザが定義した関数も使用できます::" -#: ../../library/argparse.rst:1104 msgid "" ">>> def hyphenated(string):\n" "... return '-'.join([word[:4] for word in string.casefold().split()])\n" @@ -1801,6 +2162,13 @@ msgid "" ">>> parser.parse_args(['\"The Tale of Two Cities\"'])\n" "Namespace(short_title='\"the-tale-of-two-citi')" msgstr "" +">>> def hyphenated(string):\n" +"... return '-'.join([word[:4] for word in string.casefold().split()])\n" +"...\n" +">>> parser = argparse.ArgumentParser()\n" +">>> _ = parser.add_argument('short_title', type=hyphenated)\n" +">>> parser.parse_args(['\"The Tale of Two Cities\"'])\n" +"Namespace(short_title='\"the-tale-of-two-citi')" #: ../../library/argparse.rst:1114 msgid "" @@ -1837,7 +2205,6 @@ msgstr "" "発生しうる) :exc:`~json.JSONDecodeError` は適切に整形されて表示されません。ま" "た、:exc:`FileNotFoundError` が発生しても parser は何も処理しません。" -#: ../../library/argparse.rst:1128 msgid "" "Even :class:`~argparse.FileType` has its limitations for use with the " "``type`` keyword. If one argument uses :class:`~argparse.FileType` and then " @@ -1846,6 +2213,12 @@ msgid "" "the parser has run and then use the :keyword:`with`-statement to manage the " "files." msgstr "" +":class:`~argparse.FileType` でさえ、``type`` キーワードでの使用には制限があり" +"ます。\n" +"ある引数で :class:`~argparse.FileType` を使い、その後の引数でエラーが起きる" +"と、エラーは報告されますが、ファイルは自動的には閉じられません。\n" +"この場合は、引数の解析が終わってから :keyword:`with` 文でファイルを管理する方" +"が適切です。" #: ../../library/argparse.rst:1135 msgid "" @@ -1873,7 +2246,6 @@ msgstr "" "き、引数の値がチェックされ、その値が選択肢の中に含まれていない場合はエラー" "メッセージを表示します::" -#: ../../library/argparse.rst:1150 msgid "" ">>> parser = argparse.ArgumentParser(prog='game.py')\n" ">>> parser.add_argument('move', choices=['rock', 'paper', 'scissors'])\n" @@ -1884,6 +2256,14 @@ msgid "" "game.py: error: argument move: invalid choice: 'fire' (choose from 'rock',\n" "'paper', 'scissors')" msgstr "" +">>> parser = argparse.ArgumentParser(prog='game.py')\n" +">>> parser.add_argument('move', choices=['rock', 'paper', 'scissors'])\n" +">>> parser.parse_args(['rock'])\n" +"Namespace(move='rock')\n" +">>> parser.parse_args(['fire'])\n" +"usage: game.py [-h] {rock,paper,scissors}\n" +"game.py: error: argument move: invalid choice: 'fire' (choose from 'rock',\n" +"'paper', 'scissors')" #: ../../library/argparse.rst:1159 msgid "" @@ -1926,15 +2306,17 @@ msgstr "" msgid "required" msgstr "required" -#: ../../library/argparse.rst:1180 msgid "" "In general, the :mod:`!argparse` module assumes that flags like ``-f`` and " "``--bar`` indicate *optional* arguments, which can always be omitted at the " "command line. To make an option *required*, ``True`` can be specified for " "the ``required=`` keyword argument to :meth:`~ArgumentParser.add_argument`::" msgstr "" +":mod:`!argparse` モジュールは通常、``-f`` や ``--bar`` のようなフラグを、コマ" +"ンドラインで常に省略できる *オプション* 引数として扱います。\n" +"オプションを *必須* にするには、:meth:`~ArgumentParser.add_argument` の " +"``required=`` キーワード引数に ``True`` を指定します。 ::" -#: ../../library/argparse.rst:1185 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', required=True)\n" @@ -1944,6 +2326,13 @@ msgid "" "usage: [-h] --foo FOO\n" ": error: the following arguments are required: --foo" msgstr "" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument('--foo', required=True)\n" +">>> parser.parse_args(['--foo', 'BAR'])\n" +"Namespace(foo='BAR')\n" +">>> parser.parse_args([])\n" +"usage: [-h] --foo FOO\n" +": error: the following arguments are required: --foo" #: ../../library/argparse.rst:1193 msgid "" @@ -1967,13 +2356,15 @@ msgstr "" msgid "help" msgstr "help" -#: ../../library/argparse.rst:1208 msgid "" "The ``help`` value is a string containing a brief description of the " "argument. When a user requests help (usually by using ``-h`` or ``--help`` " "at the command line), these ``help`` descriptions will be displayed with " "each argument." msgstr "" +"``help`` の値には、引数の簡潔な説明を文字列で指定します。\n" +"ユーザーがヘルプを要求すると (通常はコマンドラインで ``-h`` または ``--" +"help`` を指定します)、各引数とともにこの ``help`` の説明が表示されます。" #: ../../library/argparse.rst:1213 msgid "" @@ -1988,7 +2379,6 @@ msgstr "" "プログラム名 ``%(prog)s`` と、 ``%(default)s`` や ``%(type)s`` など :meth:" "`~ArgumentParser.add_argument` のキーワード引数の多くが含まれます::" -#: ../../library/argparse.rst:1218 msgid "" ">>> parser = argparse.ArgumentParser(prog='frobble')\n" ">>> parser.add_argument('bar', nargs='?', type=int, default=42,\n" @@ -2002,6 +2392,17 @@ msgid "" "options:\n" " -h, --help show this help message and exit" msgstr "" +">>> parser = argparse.ArgumentParser(prog='frobble')\n" +">>> parser.add_argument('bar', nargs='?', type=int, default=42,\n" +"... help='the bar to %(prog)s (default: %(default)s)')\n" +">>> parser.print_help()\n" +"usage: frobble [-h] [bar]\n" +"\n" +"positional arguments:\n" +" bar the bar to frobble (default: 42)\n" +"\n" +"options:\n" +" -h, --help show this help message and exit" #: ../../library/argparse.rst:1230 msgid "" @@ -2011,13 +2412,13 @@ msgstr "" "ヘルプ文字列は %-フォーマットをサポートしているので、ヘルプ文字列内にリテラ" "ル ``%`` を表示したい場合は ``%%`` のようにエスケープしなければなりません。" -#: ../../library/argparse.rst:1233 msgid "" ":mod:`!argparse` supports silencing the help entry for certain options, by " "setting the ``help`` value to ``argparse.SUPPRESS``::" msgstr "" +":mod:`!argparse` では、``help`` の値を ``argparse.SUPPRESS`` に設定すると、そ" +"のオプションをヘルプに表示しないようにできます。 ::" -#: ../../library/argparse.rst:1236 msgid "" ">>> parser = argparse.ArgumentParser(prog='frobble')\n" ">>> parser.add_argument('--foo', help=argparse.SUPPRESS)\n" @@ -2027,12 +2428,18 @@ msgid "" "options:\n" " -h, --help show this help message and exit" msgstr "" +">>> parser = argparse.ArgumentParser(prog='frobble')\n" +">>> parser.add_argument('--foo', help=argparse.SUPPRESS)\n" +">>> parser.print_help()\n" +"usage: frobble [-h]\n" +"\n" +"options:\n" +" -h, --help show this help message and exit" #: ../../library/argparse.rst:1248 msgid "metavar" msgstr "metavar" -#: ../../library/argparse.rst:1250 msgid "" "When :class:`ArgumentParser` generates help messages, it needs some way to " "refer to each expected argument. By default, :class:`!ArgumentParser` " @@ -2043,8 +2450,17 @@ msgid "" "single optional argument ``--foo`` that should be followed by a single " "command-line argument will be referred to as ``FOO``. An example::" msgstr "" +":class:`ArgumentParser` がヘルプを生成する際には、受け付ける各引数を表す名前" +"が必要です。\n" +"デフォルトでは、:class:`!ArgumentParser` オブジェクトは dest_ の値を各引数の" +"「名前」として使います。\n" +"位置引数のアクションでは dest_ の値をそのまま使い、オプション引数のアクション" +"では dest_ の値を大文字にして使います。\n" +"そのため、``dest='bar'`` の位置引数は ``bar`` と表示されます。\n" +"コマンドライン引数を一つ受け取るオプション ``--foo`` では、その値が ``FOO`` " +"と表示されます。\n" +"例えば次のようになります。 ::" -#: ../../library/argparse.rst:1259 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo')\n" @@ -2061,12 +2477,25 @@ msgid "" " -h, --help show this help message and exit\n" " --foo FOO" msgstr "" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument('--foo')\n" +">>> parser.add_argument('bar')\n" +">>> parser.parse_args('X --foo Y'.split())\n" +"Namespace(bar='X', foo='Y')\n" +">>> parser.print_help()\n" +"usage: [-h] [--foo FOO] bar\n" +"\n" +"positional arguments:\n" +" bar\n" +"\n" +"options:\n" +" -h, --help show this help message and exit\n" +" --foo FOO" #: ../../library/argparse.rst:1274 msgid "An alternative name can be specified with ``metavar``::" msgstr "代わりの名前を、``metavar`` として指定できます::" -#: ../../library/argparse.rst:1276 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', metavar='YYY')\n" @@ -2083,6 +2512,20 @@ msgid "" " -h, --help show this help message and exit\n" " --foo YYY" msgstr "" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument('--foo', metavar='YYY')\n" +">>> parser.add_argument('bar', metavar='XXX')\n" +">>> parser.parse_args('X --foo Y'.split())\n" +"Namespace(bar='X', foo='Y')\n" +">>> parser.print_help()\n" +"usage: [-h] [--foo YYY] XXX\n" +"\n" +"positional arguments:\n" +" XXX\n" +"\n" +"options:\n" +" -h, --help show this help message and exit\n" +" --foo YYY" #: ../../library/argparse.rst:1291 msgid "" @@ -2103,7 +2546,6 @@ msgstr "" "``nargs`` を指定した場合、metavar が複数回利用されるかもしれません。" "``metavar`` にタプルを渡すと、各引数に対して異なる名前を指定できます::" -#: ../../library/argparse.rst:1299 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-x', nargs=2)\n" @@ -2116,6 +2558,16 @@ msgid "" " -x X X\n" " --foo bar baz" msgstr "" +">>> parser = argparse.ArgumentParser(prog='PROG')\n" +">>> parser.add_argument('-x', nargs=2)\n" +">>> parser.add_argument('--foo', nargs=2, metavar=('bar', 'baz'))\n" +">>> parser.print_help()\n" +"usage: PROG [-h] [-x X X] [--foo bar baz]\n" +"\n" +"options:\n" +" -h, --help show this help message and exit\n" +" -x X X\n" +" --foo bar baz" #: ../../library/argparse.rst:1314 msgid "dest" @@ -2136,13 +2588,16 @@ msgstr "" "決定されます。位置引数のアクションについては、 ``dest`` は通常 :meth:" "`~ArgumentParser.add_argument` の第一引数として渡します::" -#: ../../library/argparse.rst:1323 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('bar')\n" ">>> parser.parse_args(['XXX'])\n" "Namespace(bar='XXX')" msgstr "" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument('bar')\n" +">>> parser.parse_args(['XXX'])\n" +"Namespace(bar='XXX')" #: ../../library/argparse.rst:1328 msgid "" @@ -2178,19 +2633,20 @@ msgstr "" msgid "``dest`` allows a custom attribute name to be provided::" msgstr "``dest`` にカスタムの属性名を与えることも可能です::" -#: ../../library/argparse.rst:1347 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', dest='bar')\n" ">>> parser.parse_args('--foo XXX'.split())\n" "Namespace(bar='XXX')" msgstr "" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument('--foo', dest='bar')\n" +">>> parser.parse_args('--foo XXX'.split())\n" +"Namespace(bar='XXX')" -#: ../../library/argparse.rst:1356 msgid "deprecated" -msgstr "" +msgstr "deprecated" -#: ../../library/argparse.rst:1358 msgid "" "During a project's lifetime, some arguments may need to be removed from the " "command line. Before removing them, you should inform your users that the " @@ -2200,8 +2656,15 @@ msgid "" "the future. For arguments, if ``deprecated`` is ``True``, then a warning " "will be printed to :data:`sys.stderr` when the argument is used::" msgstr "" +"プロジェクトの開発を続けるうちに、コマンドライン引数を削除する必要が生じるこ" +"とがあります。\n" +"削除する前に、その引数が非推奨となり、削除される予定であることをユーザーに知" +"らせてください。\n" +":meth:`~ArgumentParser.add_argument` の ``deprecated`` キーワード引数は、その" +"引数が非推奨で将来削除されるかどうかを指定し、デフォルトは ``False`` です。\n" +"``deprecated`` が ``True`` の引数を使うと、:data:`sys.stderr` に警告が表示さ" +"れます。 ::" -#: ../../library/argparse.rst:1368 msgid "" ">>> import argparse\n" ">>> parser = argparse.ArgumentParser(prog='snake.py')\n" @@ -2212,20 +2675,31 @@ msgid "" "snake.py: warning: option '--legs' is deprecated\n" "Namespace(legs=4)" msgstr "" +">>> import argparse\n" +">>> parser = argparse.ArgumentParser(prog='snake.py')\n" +">>> parser.add_argument('--legs', default=0, type=int, deprecated=True)\n" +">>> parser.parse_args([])\n" +"Namespace(legs=0)\n" +">>> parser.parse_args(['--legs', '4'])\n" +"snake.py: warning: option '--legs' is deprecated\n" +"Namespace(legs=4)" #: ../../library/argparse.rst:1381 msgid "Action classes" msgstr "Action クラス" -#: ../../library/argparse.rst:1383 msgid "" ":class:`!Action` classes implement the Action API, a callable which returns " "a callable which processes arguments from the command-line. Any object which " "follows this API may be passed as the ``action`` parameter to :meth:" "`~ArgumentParser.add_argument`." msgstr "" +":class:`!Action` クラスは Action API を実装します。\n" +"この API は、呼び出されると、コマンドライン引数を処理する呼び出し可能オブジェ" +"クトを返します。\n" +"この API に従うオブジェクトであれば、:meth:`~ArgumentParser.add_argument` の " +"``action`` パラメーターに渡せます。" -#: ../../library/argparse.rst:1392 msgid "" ":class:`!Action` objects are used by an :class:`ArgumentParser` to represent " "the information needed to parse a single argument from one or more strings " @@ -2233,8 +2707,12 @@ msgid "" "positional arguments plus any keyword arguments passed to :meth:" "`ArgumentParser.add_argument` except for the ``action`` itself." msgstr "" +":class:`ArgumentParser` は :class:`!Action` オブジェクトを使って、コマンドラ" +"インの一つ以上の文字列から一つの引数を解析するために必要な情報を表します。\n" +":class:`!Action` クラスは、二つの位置引数と、:meth:`ArgumentParser." +"add_argument` に渡されたキーワード引数 (``action`` 自身を除く) を受け付けなけ" +"ればなりません。" -#: ../../library/argparse.rst:1398 msgid "" "Instances of :class:`!Action` (or return value of any callable to the " "``action`` parameter) should have attributes :attr:`!dest`, :attr:`!" @@ -2242,53 +2720,70 @@ msgid "" "help`, etc. defined. The easiest way to ensure these attributes are defined " "is to call :meth:`!Action.__init__`." msgstr "" +":class:`!Action` のインスタンス (または ``action`` パラメーターに渡した呼び出" +"し可能オブジェクトの返り値) には、:attr:`!dest`、:attr:`!option_strings`、:" +"attr:`!default`、:attr:`!type`、:attr:`!required`、:attr:`!help` などの属性を" +"定義してください。\n" +"これらの属性を確実に定義する最も簡単な方法は、:meth:`!Action.__init__` を呼び" +"出すことです。" -#: ../../library/argparse.rst:1406 msgid "" ":class:`!Action` instances should be callable, so subclasses must override " "the :meth:`!__call__` method, which should accept four parameters:" msgstr "" +":class:`!Action` のインスタンスは呼び出し可能でなければなりません。\n" +"そのため、サブクラスでは :meth:`!__call__` メソッドをオーバーライドし、次の四" +"つの引数を受け付けるようにしてください。" -#: ../../library/argparse.rst:1409 msgid "" "*parser* - The :class:`ArgumentParser` object which contains this action." -msgstr "" +msgstr "*parser* - このアクションを含む :class:`ArgumentParser` オブジェクト。" -#: ../../library/argparse.rst:1411 msgid "" "*namespace* - The :class:`Namespace` object that will be returned by :meth:" "`~ArgumentParser.parse_args`. Most actions add an attribute to this object " "using :func:`setattr`." msgstr "" +"*namespace* - :meth:`~ArgumentParser.parse_args` が返す :class:`Namespace` オ" +"ブジェクト。\n" +"ほとんどのアクションは :func:`setattr` を使って、このオブジェクトに属性を追加" +"します。" -#: ../../library/argparse.rst:1415 msgid "" "*values* - The associated command-line arguments, with any type conversions " "applied. Type conversions are specified with the type_ keyword argument to :" "meth:`~ArgumentParser.add_argument`." msgstr "" +"*values* - 対応するコマンドライン引数に型変換を適用した値。\n" +"型変換は :meth:`~ArgumentParser.add_argument` の type_ キーワード引数で指定し" +"ます。" -#: ../../library/argparse.rst:1419 msgid "" "*option_string* - The option string that was used to invoke this action. The " "``option_string`` argument is optional, and will be absent if the action is " "associated with a positional argument." msgstr "" +"*option_string* - このアクションの呼び出しに使われたオプション文字列。\n" +"``option_string`` 引数は省略可能で、位置引数に対応するアクションでは指定され" +"ません。" -#: ../../library/argparse.rst:1423 msgid "" "The :meth:`!__call__` method may perform arbitrary actions, but will " "typically set attributes on the ``namespace`` based on ``dest`` and " "``values``." msgstr "" +":meth:`!__call__` メソッドは任意の処理を行えますが、通常は ``dest`` と " +"``values`` に基づいて ``namespace`` の属性を設定します。" -#: ../../library/argparse.rst:1428 msgid "" ":class:`!Action` subclasses can define a :meth:`!format_usage` method that " "takes no argument and return a string which will be used when printing the " "usage of the program. If such method is not provided, a sensible default " "will be used." msgstr "" +":class:`!Action` のサブクラスでは、引数を取らず、プログラムの使用法の表示に使" +"う文字列を返す :meth:`!format_usage` メソッドを定義できます。\n" +"このメソッドを定義しなければ、適切なデフォルトの表示が使われます。" #: ../../library/argparse.rst:1434 msgid "The parse_args() method" @@ -2302,12 +2797,14 @@ msgstr "" "引数の文字列をオブジェクトに変換し、namespace オブジェクトの属性に代入しま" "す。結果の namespace オブジェクトを返します。" -#: ../../library/argparse.rst:1441 msgid "" "Previous calls to :meth:`add_argument` determine exactly what objects are " "created and how they are assigned. See the documentation for :meth:`!" "add_argument` for details." msgstr "" +"どのようなオブジェクトを作り、どう代入するかは、それまでの :meth:" +"`add_argument` の呼び出しで決まります。\n" +"詳細は :meth:`!add_argument` のドキュメントを参照してください。" #: ../../library/argparse.rst:1445 msgid "" @@ -2339,7 +2836,6 @@ msgstr "" "オプションの値の指定に複数の方法をサポートしています。もっとも単純な場合に" "は、オプションとその値は次のように2つの別々の引数として渡されます::" -#: ../../library/argparse.rst:1459 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-x')\n" @@ -2349,6 +2845,13 @@ msgid "" ">>> parser.parse_args(['--foo', 'FOO'])\n" "Namespace(foo='FOO', x=None)" msgstr "" +">>> parser = argparse.ArgumentParser(prog='PROG')\n" +">>> parser.add_argument('-x')\n" +">>> parser.add_argument('--foo')\n" +">>> parser.parse_args(['-x', 'X'])\n" +"Namespace(foo=None, x='X')\n" +">>> parser.parse_args(['--foo', 'FOO'])\n" +"Namespace(foo='FOO', x=None)" #: ../../library/argparse.rst:1467 msgid "" @@ -2360,11 +2863,12 @@ msgstr "" "値は次のように ``=`` で区切られた1つのコマンドライン引数として渡すこともでき" "ます::" -#: ../../library/argparse.rst:1471 msgid "" ">>> parser.parse_args(['--foo=FOO'])\n" "Namespace(foo='FOO', x=None)" msgstr "" +">>> parser.parse_args(['--foo=FOO'])\n" +"Namespace(foo='FOO', x=None)" #: ../../library/argparse.rst:1474 msgid "" @@ -2374,11 +2878,12 @@ msgstr "" "短いオプション (1文字のオプション) では、オプションとその値は次のように連結し" "て渡すことができます::" -#: ../../library/argparse.rst:1477 msgid "" ">>> parser.parse_args(['-xX'])\n" "Namespace(foo=None, x='X')" msgstr "" +">>> parser.parse_args(['-xX'])\n" +"Namespace(foo=None, x='X')" #: ../../library/argparse.rst:1480 msgid "" @@ -2389,7 +2894,6 @@ msgstr "" "い場合、複数の短いオプションは次のように1つの接頭辞 ``-`` だけで連結できま" "す::" -#: ../../library/argparse.rst:1483 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-x', action='store_true')\n" @@ -2398,6 +2902,12 @@ msgid "" ">>> parser.parse_args(['-xyzZ'])\n" "Namespace(x=True, y=True, z='Z')" msgstr "" +">>> parser = argparse.ArgumentParser(prog='PROG')\n" +">>> parser.add_argument('-x', action='store_true')\n" +">>> parser.add_argument('-y', action='store_true')\n" +">>> parser.add_argument('-z')\n" +">>> parser.parse_args(['-xyzZ'])\n" +"Namespace(x=True, y=True, z='Z')" #: ../../library/argparse.rst:1492 msgid "Invalid arguments" @@ -2503,17 +3013,19 @@ msgstr "" "引数 ``'--'`` を挿入して、:meth:`~ArgumentParser.parse_args` にそれ以降のすべ" "てが位置引数だと教えることができます::" -#: ../../library/argparse.rst:1565 msgid "" ">>> parser.parse_args(['--', '-f'])\n" "Namespace(foo='-f', one=None)" msgstr "" +">>> parser.parse_args(['--', '-f'])\n" +"Namespace(foo='-f', one=None)" -#: ../../library/argparse.rst:1568 msgid "" "See also :ref:`the argparse howto on ambiguous arguments ` for more details." msgstr "" +"詳細は :ref:`argparse の HOWTO の曖昧な引数についての説明 ` も参照してください。" #: ../../library/argparse.rst:1574 msgid "Argument abbreviations (prefix matching)" @@ -2529,7 +3041,6 @@ msgstr "" "`、長いオプションに曖昧さがない (先頭文字列が一意である) かぎ" "り、先頭文字列に短縮して指定できます::" -#: ../../library/argparse.rst:1580 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-bacon')\n" @@ -2542,6 +3053,16 @@ msgid "" "usage: PROG [-h] [-bacon BACON] [-badger BADGER]\n" "PROG: error: ambiguous option: -ba could match -badger, -bacon" msgstr "" +">>> parser = argparse.ArgumentParser(prog='PROG')\n" +">>> parser.add_argument('-bacon')\n" +">>> parser.add_argument('-badger')\n" +">>> parser.parse_args('-bac MMM'.split())\n" +"Namespace(bacon='MMM', badger=None)\n" +">>> parser.parse_args('-bad WOOD'.split())\n" +"Namespace(bacon=None, badger='WOOD')\n" +">>> parser.parse_args('-ba BA'.split())\n" +"usage: PROG [-h] [-bacon BACON] [-badger BADGER]\n" +"PROG: error: ambiguous option: -ba could match -badger, -bacon" #: ../../library/argparse.rst:1591 msgid "" @@ -2555,15 +3076,18 @@ msgstr "" msgid "Beyond ``sys.argv``" msgstr "``sys.argv`` 以外" -#: ../../library/argparse.rst:1599 msgid "" "Sometimes it may be useful to have an :class:`ArgumentParser` parse " "arguments other than those of :data:`sys.argv`. This can be accomplished by " "passing a list of strings to :meth:`~ArgumentParser.parse_args`. This is " "useful for testing at the interactive prompt::" msgstr "" +":class:`ArgumentParser` で :data:`sys.argv` 以外の引数を解析したい場合もあり" +"ます。\n" +"その場合は、:meth:`~ArgumentParser.parse_args` に文字列のリストを渡してくださ" +"い。\n" +"対話プロンプトでのテストに便利です。 ::" -#: ../../library/argparse.rst:1604 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument(\n" @@ -2577,6 +3101,17 @@ msgid "" ">>> parser.parse_args(['1', '2', '3', '4', '--sum'])\n" "Namespace(accumulate=, integers=[1, 2, 3, 4])" msgstr "" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument(\n" +"... 'integers', metavar='int', type=int, choices=range(10),\n" +"... nargs='+', help='an integer in the range 0..9')\n" +">>> parser.add_argument(\n" +"... '--sum', dest='accumulate', action='store_const', const=sum,\n" +"... default=max, help='sum the integers (default: find the max)')\n" +">>> parser.parse_args(['1', '2', '3', '4'])\n" +"Namespace(accumulate=, integers=[1, 2, 3, 4])\n" +">>> parser.parse_args(['1', '2', '3', '4', '--sum'])\n" +"Namespace(accumulate=, integers=[1, 2, 3, 4])" #: ../../library/argparse.rst:1619 msgid "The Namespace object" @@ -2600,7 +3135,6 @@ msgstr "" "class:`object` のサブクラスです。もし属性を辞書のように扱える方が良ければ、標" "準的な Python のイディオム :func:`vars` を利用できます::" -#: ../../library/argparse.rst:1630 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo')\n" @@ -2608,6 +3142,11 @@ msgid "" ">>> vars(args)\n" "{'foo': 'BAR'}" msgstr "" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument('--foo')\n" +">>> args = parser.parse_args(['--foo', 'BAR'])\n" +">>> vars(args)\n" +"{'foo': 'BAR'}" #: ../../library/argparse.rst:1636 msgid "" @@ -2619,7 +3158,6 @@ msgstr "" "既存のオブジェクトに属性を設定する方が良い場合があります。これは " "``namespace=`` キーワード引数を指定することで可能です::" -#: ../../library/argparse.rst:1640 msgid "" ">>> class C:\n" "... pass\n" @@ -2631,6 +3169,15 @@ msgid "" ">>> c.foo\n" "'BAR'" msgstr "" +">>> class C:\n" +"... pass\n" +"...\n" +">>> c = C()\n" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument('--foo')\n" +">>> parser.parse_args(args=['--foo', 'BAR'], namespace=c)\n" +">>> c.foo\n" +"'BAR'" #: ../../library/argparse.rst:1652 msgid "Other utilities" @@ -2640,7 +3187,6 @@ msgstr "その他のユーティリティ" msgid "Sub-commands" msgstr "サブコマンド" -#: ../../library/argparse.rst:1662 msgid "" "Many programs split up their functionality into a number of subcommands, for " "example, the ``svn`` program can invoke subcommands like ``svn checkout``, " @@ -2654,23 +3200,38 @@ msgid "" "command name and any :class:`!ArgumentParser` constructor arguments, and " "returns an :class:`!ArgumentParser` object that can be modified as usual." msgstr "" +"多くのプログラムは、機能をいくつかのサブコマンドに分けています。\n" +"例えば ``svn`` プログラムでは、``svn checkout``、``svn update``、``svn " +"commit`` などのサブコマンドを呼び出せます。\n" +"それぞれ異なる種類のコマンドライン引数を必要とする複数の機能を持つプログラム" +"では、このように分ける方法が特に適しています。\n" +":class:`ArgumentParser` では :meth:`!add_subparsers` メソッドでサブコマンドを" +"作成できます。\n" +"通常、:meth:`!add_subparsers` は引数なしで呼び出し、専用のアクションオブジェ" +"クトを返します。\n" +"このオブジェクトの :meth:`~_SubParsersAction.add_parser` メソッドは、コマンド" +"名と任意の :class:`!ArgumentParser` コンストラクター引数を受け取り、通常と同" +"じように設定できる :class:`!ArgumentParser` オブジェクトを返します。" #: ../../library/argparse.rst:1674 msgid "Description of parameters:" msgstr "引数の説明:" -#: ../../library/argparse.rst:1676 msgid "" "*title* - title for the sub-parser group in help output; by default " "\"subcommands\" if description is provided, otherwise uses title for " "positional arguments" msgstr "" +"*title* - ヘルプに表示するサブパーサーグループのタイトル。\n" +"デフォルトでは、``description`` が指定されていれば \"subcommands\"、そうでな" +"ければ位置引数のタイトルを使います。" -#: ../../library/argparse.rst:1680 msgid "" "*description* - description for the sub-parser group in help output, by " "default ``None``" msgstr "" +"*description* - ヘルプに表示するサブパーサーグループの説明。\n" +"デフォルトは ``None`` です。" #: ../../library/argparse.rst:1683 msgid "" @@ -2679,11 +3240,12 @@ msgid "" "subparser argument" msgstr "" -#: ../../library/argparse.rst:1687 msgid "" "*parser_class* - class which will be used to create sub-parser instances, by " "default the class of the current parser (e.g. :class:`ArgumentParser`)" msgstr "" +"*parser_class* - サブパーサーのインスタンスを作るクラス。\n" +"デフォルトでは、現在のパーサーのクラス (:class:`ArgumentParser` など) です。" #: ../../library/argparse.rst:1690 msgid "" @@ -2713,17 +3275,17 @@ msgstr "" "help_ - ヘルプ出力に表示されるサブパーサーグループのヘルプです。デフォルトは " "``None`` です" -#: ../../library/argparse.rst:1701 msgid "" "metavar_ - string presenting available subcommands in help; by default it is " "``None`` and presents subcommands in form {cmd1, cmd2, ..}" msgstr "" +"metavar_ - ヘルプで利用可能なサブコマンドを表す文字列。\n" +"デフォルトは ``None`` で、{cmd1, cmd2, ..} の形式で表示されます。" #: ../../library/argparse.rst:1704 msgid "Some example usage::" msgstr "いくつかの使用例::" -#: ../../library/argparse.rst:1706 msgid "" ">>> # create the top-level parser\n" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" @@ -2745,6 +3307,25 @@ msgid "" ">>> parser.parse_args(['--foo', 'b', '--baz', 'Z'])\n" "Namespace(baz='Z', foo=True)" msgstr "" +">>> # 最上位のパーサーを作成する\n" +">>> parser = argparse.ArgumentParser(prog='PROG')\n" +">>> parser.add_argument('--foo', action='store_true', help='foo help')\n" +">>> subparsers = parser.add_subparsers(help='subcommand help')\n" +">>>\n" +">>> # \"a\" コマンド用のパーサーを作成する\n" +">>> parser_a = subparsers.add_parser('a', help='a help')\n" +">>> parser_a.add_argument('bar', type=int, help='bar help')\n" +">>>\n" +">>> # \"b\" コマンド用のパーサーを作成する\n" +">>> parser_b = subparsers.add_parser('b', help='b help')\n" +">>> parser_b.add_argument('--baz', choices=('X', 'Y', 'Z'), help='baz " +"help')\n" +">>>\n" +">>> # 引数リストを解析する\n" +">>> parser.parse_args(['a', '12'])\n" +"Namespace(bar=12, foo=False)\n" +">>> parser.parse_args(['--foo', 'b', '--baz', 'Z'])\n" +"Namespace(baz='Z', foo=True)" #: ../../library/argparse.rst:1725 msgid "" @@ -2775,7 +3356,6 @@ msgstr "" "メッセージは、上の例にもあるように :meth:`~_SubParsersAction.add_parser` の " "``help=`` 引数によって指定できます)" -#: ../../library/argparse.rst:1740 msgid "" ">>> parser.parse_args(['--help'])\n" "usage: PROG [-h] [--foo] {a,b} ...\n" @@ -2805,6 +3385,33 @@ msgid "" " -h, --help show this help message and exit\n" " --baz {X,Y,Z} baz help" msgstr "" +">>> parser.parse_args(['--help'])\n" +"usage: PROG [-h] [--foo] {a,b} ...\n" +"\n" +"positional arguments:\n" +" {a,b} subcommand help\n" +" a a help\n" +" b b help\n" +"\n" +"options:\n" +" -h, --help show this help message and exit\n" +" --foo foo help\n" +"\n" +">>> parser.parse_args(['a', '--help'])\n" +"usage: PROG a [-h] bar\n" +"\n" +"positional arguments:\n" +" bar bar help\n" +"\n" +"options:\n" +" -h, --help show this help message and exit\n" +"\n" +">>> parser.parse_args(['b', '--help'])\n" +"usage: PROG b [-h] [--baz {X,Y,Z}]\n" +"\n" +"options:\n" +" -h, --help show this help message and exit\n" +" --baz {X,Y,Z} baz help" #: ../../library/argparse.rst:1768 msgid "" @@ -2816,7 +3423,6 @@ msgstr "" "もサポートしています。どちらかが存在する場合、サブパーサーのコマンドはヘルプ" "出力でそれぞれのグループの中に表示されます。例えば::" -#: ../../library/argparse.rst:1772 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> subparsers = parser.add_subparsers(title='subcommands',\n" @@ -2835,6 +3441,22 @@ msgid "" "\n" " {foo,bar} additional help" msgstr "" +">>> parser = argparse.ArgumentParser()\n" +">>> subparsers = parser.add_subparsers(title='subcommands',\n" +"... description='valid subcommands',\n" +"... help='additional help')\n" +">>> subparsers.add_parser('foo')\n" +">>> subparsers.add_parser('bar')\n" +">>> parser.parse_args(['-h'])\n" +"usage: [-h] {foo,bar} ...\n" +"\n" +"options:\n" +" -h, --help show this help message and exit\n" +"\n" +"subcommands:\n" +" valid subcommands\n" +"\n" +" {foo,bar} additional help" #: ../../library/argparse.rst:1789 msgid "" @@ -2844,7 +3466,6 @@ msgid "" "``checkout``::" msgstr "" -#: ../../library/argparse.rst:1794 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> subparsers = parser.add_subparsers()\n" @@ -2853,6 +3474,12 @@ msgid "" ">>> parser.parse_args(['co', 'bar'])\n" "Namespace(foo='bar')" msgstr "" +">>> parser = argparse.ArgumentParser()\n" +">>> subparsers = parser.add_subparsers()\n" +">>> checkout = subparsers.add_parser('checkout', aliases=['co'])\n" +">>> checkout.add_argument('foo')\n" +">>> parser.parse_args(['co', 'bar'])\n" +"Namespace(foo='bar')" #: ../../library/argparse.rst:1801 msgid "" @@ -2868,7 +3495,6 @@ msgid "" "example::" msgstr "" -#: ../../library/argparse.rst:1820 msgid "" ">>> # subcommand functions\n" ">>> def foo(args):\n" @@ -2902,6 +3528,37 @@ msgid "" ">>> args.func(args)\n" "((XYZYX))" msgstr "" +">>> # サブコマンドの関数\n" +">>> def foo(args):\n" +"... print(args.x * args.y)\n" +"...\n" +">>> def bar(args):\n" +"... print('((%s))' % args.z)\n" +"...\n" +">>> # 最上位のパーサーを作成する\n" +">>> parser = argparse.ArgumentParser()\n" +">>> subparsers = parser.add_subparsers(required=True)\n" +">>>\n" +">>> # \"foo\" コマンド用のパーサーを作成する\n" +">>> parser_foo = subparsers.add_parser('foo')\n" +">>> parser_foo.add_argument('-x', type=int, default=1)\n" +">>> parser_foo.add_argument('y', type=float)\n" +">>> parser_foo.set_defaults(func=foo)\n" +">>>\n" +">>> # \"bar\" コマンド用のパーサーを作成する\n" +">>> parser_bar = subparsers.add_parser('bar')\n" +">>> parser_bar.add_argument('z')\n" +">>> parser_bar.set_defaults(func=bar)\n" +">>>\n" +">>> # 引数を解析し、選ばれた関数を呼び出す\n" +">>> args = parser.parse_args('foo 1 -x 2'.split())\n" +">>> args.func(args)\n" +"2.0\n" +">>>\n" +">>> # 引数を解析し、選ばれた関数を呼び出す\n" +">>> args = parser.parse_args('bar XYZYX'.split())\n" +">>> args.func(args)\n" +"((XYZYX))" #: ../../library/argparse.rst:1852 msgid "" @@ -2918,7 +3575,6 @@ msgstr "" "ブパーサーの名前を確認する必要がある場合は、:meth:`add_subparsers` を呼び出す" "ときに ``dest`` キーワードを指定できます::" -#: ../../library/argparse.rst:1859 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> subparsers = parser.add_subparsers(dest='subparser_name')\n" @@ -2929,16 +3585,24 @@ msgid "" ">>> parser.parse_args(['2', 'frobble'])\n" "Namespace(subparser_name='2', y='frobble')" msgstr "" +">>> parser = argparse.ArgumentParser()\n" +">>> subparsers = parser.add_subparsers(dest='subparser_name')\n" +">>> subparser1 = subparsers.add_parser('1')\n" +">>> subparser1.add_argument('-x')\n" +">>> subparser2 = subparsers.add_parser('2')\n" +">>> subparser2.add_argument('y')\n" +">>> parser.parse_args(['2', 'frobble'])\n" +"Namespace(subparser_name='2', y='frobble')" -#: ../../library/argparse.rst:1868 msgid "New *required* keyword-only parameter." -msgstr "" +msgstr "キーワード専用の *required* パラメーターが追加されました。" -#: ../../library/argparse.rst:1871 msgid "" "Subparser's *prog* is no longer affected by a custom usage message in the " "main parser." msgstr "" +"メインパーサーに指定した独自の使用法メッセージが、サブパーサーの *prog* に影" +"響しなくなりました。" #: ../../library/argparse.rst:1877 msgid "FileType objects" @@ -2958,7 +3622,6 @@ msgstr "" "ズ、エンコーディング、エラー処理でファイルとして開きます (詳細は :func:" "`open` 関数を参照してください。)::" -#: ../../library/argparse.rst:1887 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--raw', type=argparse.FileType('wb', 0))\n" @@ -2968,6 +3631,13 @@ msgid "" "Namespace(out=<_io.TextIOWrapper name='file.txt' mode='w' encoding='UTF-8'>, " "raw=<_io.FileIO name='raw.dat' mode='wb'>)" msgstr "" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument('--raw', type=argparse.FileType('wb', 0))\n" +">>> parser.add_argument('out', type=argparse.FileType('w', " +"encoding='UTF-8'))\n" +">>> parser.parse_args(['--raw', 'raw.dat', 'file.txt'])\n" +"Namespace(out=<_io.TextIOWrapper name='file.txt' mode='w' encoding='UTF-8'>, " +"raw=<_io.FileIO name='raw.dat' mode='wb'>)" #: ../../library/argparse.rst:1893 msgid "" @@ -2979,15 +3649,17 @@ msgstr "" "`FileType` であれば :data:`sys.stdin` を、書き込み用の :class:`FileType` であ" "れば :data:`sys.stdout` に変換します::" -#: ../../library/argparse.rst:1897 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('infile', type=argparse.FileType('r'))\n" ">>> parser.parse_args(['-'])\n" "Namespace(infile=<_io.TextIOWrapper name='' encoding='UTF-8'>)" msgstr "" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument('infile', type=argparse.FileType('r'))\n" +">>> parser.parse_args(['-'])\n" +"Namespace(infile=<_io.TextIOWrapper name='' encoding='UTF-8'>)" -#: ../../library/argparse.rst:1904 msgid "" "If one argument uses *FileType* and then a subsequent argument fails, an " "error is reported but the file is not automatically closed. This can also " @@ -2995,6 +3667,11 @@ msgid "" "after the parser has run and then use the :keyword:`with`-statement to " "manage the files." msgstr "" +"ある引数で *FileType* を使い、その後の引数でエラーが起きると、エラーは報告さ" +"れますが、ファイルは自動的には閉じられません。\n" +"出力ファイルの内容を失うこともあります。\n" +"この場合は、引数の解析が終わってから :keyword:`with` 文でファイルを管理する方" +"が適切です。" #: ../../library/argparse.rst:1910 msgid "Added the *encodings* and *errors* parameters." @@ -3004,7 +3681,6 @@ msgstr "*encodings* と *errors* がパラメータに追加されました。" msgid "Argument groups" msgstr "引数グループ" -#: ../../library/argparse.rst:1922 msgid "" "By default, :class:`ArgumentParser` groups command-line arguments into " "\"positional arguments\" and \"options\" when displaying help messages. When " @@ -3012,8 +3688,11 @@ msgid "" "appropriate groups can be created using the :meth:`!add_argument_group` " "method::" msgstr "" +"デフォルトでは、:class:`ArgumentParser` はヘルプを表示する際に、コマンドライ" +"ン引数を \"positional arguments\" と \"options\" に分けます。\n" +"引数の意味に応じた別の分け方が適している場合は、:meth:`!add_argument_group` " +"メソッドでグループを作成できます。 ::" -#: ../../library/argparse.rst:1928 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', add_help=False)\n" ">>> group = parser.add_argument_group('group')\n" @@ -3026,8 +3705,17 @@ msgid "" " bar bar help\n" " --foo FOO foo help" msgstr "" +">>> parser = argparse.ArgumentParser(prog='PROG', add_help=False)\n" +">>> group = parser.add_argument_group('group')\n" +">>> group.add_argument('--foo', help='foo help')\n" +">>> group.add_argument('bar', help='bar help')\n" +">>> parser.print_help()\n" +"usage: PROG [--foo FOO] bar\n" +"\n" +"group:\n" +" bar bar help\n" +" --foo FOO foo help" -#: ../../library/argparse.rst:1939 msgid "" "The :meth:`add_argument_group` method returns an argument group object which " "has an :meth:`~ArgumentParser.add_argument` method just like a regular :" @@ -3037,8 +3725,14 @@ msgid "" "accepts *title* and *description* arguments which can be used to customize " "this display::" msgstr "" +":meth:`add_argument_group` メソッドは、通常の :class:`ArgumentParser` と同じ" +"ように :meth:`~ArgumentParser.add_argument` メソッドを持つ引数グループオブ" +"ジェクトを返します。\n" +"グループに追加した引数は通常の引数と同じように処理されますが、ヘルプでは別の" +"グループに表示されます。\n" +":meth:`!add_argument_group` の *title* と *description* 引数で、この表示をカ" +"スタマイズできます。 ::" -#: ../../library/argparse.rst:1947 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', add_help=False)\n" ">>> group1 = parser.add_argument_group('group1', 'group1 description')\n" @@ -3058,8 +3752,24 @@ msgid "" "\n" " --bar BAR bar help" msgstr "" +">>> parser = argparse.ArgumentParser(prog='PROG', add_help=False)\n" +">>> group1 = parser.add_argument_group('group1', 'group1 description')\n" +">>> group1.add_argument('foo', help='foo help')\n" +">>> group2 = parser.add_argument_group('group2', 'group2 description')\n" +">>> group2.add_argument('--bar', help='bar help')\n" +">>> parser.print_help()\n" +"usage: PROG [--bar BAR] foo\n" +"\n" +"group1:\n" +" group1 description\n" +"\n" +" foo foo help\n" +"\n" +"group2:\n" +" group2 description\n" +"\n" +" --bar BAR bar help" -#: ../../library/argparse.rst:1965 msgid "" "The optional, keyword-only parameters argument_default_ and " "conflict_handler_ allow for finer-grained control of the behavior of the " @@ -3067,6 +3777,10 @@ msgid "" "`ArgumentParser` constructor, but apply specifically to the argument group " "rather than the entire parser." msgstr "" +"省略可能なキーワード専用パラメーター argument_default_ と conflict_handler_ " +"を使うと、引数グループの動作をより細かく制御できます。\n" +"これらの意味は :class:`ArgumentParser` コンストラクターと同じですが、パーサー" +"全体ではなく、その引数グループだけに適用されます。" #: ../../library/argparse.rst:1970 msgid "" @@ -3076,29 +3790,34 @@ msgstr "" "ユーザー定義グループにないすべての引数は通常の \"位置引数\" と \"オプション引" "数\" セクションに表示されます。" -#: ../../library/argparse.rst:1973 msgid "" "Calling :meth:`add_argument_group` on an argument group now raises an " "exception. This nesting was never supported, often failed to work correctly, " "and was unintentionally exposed through inheritance." msgstr "" +"引数グループに対して :meth:`add_argument_group` を呼び出すと、例外が送出され" +"るようになりました。\n" +"この入れ子構造はもともとサポートされておらず、正しく動作しないことも多くあり" +"ました。\n" +"継承によって意図せず利用可能になっていたものです。" -#: ../../library/argparse.rst:1978 msgid "Passing prefix_chars_ to :meth:`add_argument_group` is now deprecated." msgstr "" +":meth:`add_argument_group` に prefix_chars_ を渡すことは非推奨になりました。" #: ../../library/argparse.rst:1984 msgid "Mutual exclusion" msgstr "相互排他" -#: ../../library/argparse.rst:1988 msgid "" "Create a mutually exclusive group. :mod:`!argparse` will make sure that only " "one of the arguments in the mutually exclusive group was present on the " "command line::" msgstr "" +"相互排他グループを作成します。\n" +":mod:`!argparse` は、そのグループに含まれる複数の引数がコマンドラインで同時に" +"指定されないことを確認します。 ::" -#: ../../library/argparse.rst:1992 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> group = parser.add_mutually_exclusive_group()\n" @@ -3112,6 +3831,17 @@ msgid "" "usage: PROG [-h] [--foo | --bar]\n" "PROG: error: argument --bar: not allowed with argument --foo" msgstr "" +">>> parser = argparse.ArgumentParser(prog='PROG')\n" +">>> group = parser.add_mutually_exclusive_group()\n" +">>> group.add_argument('--foo', action='store_true')\n" +">>> group.add_argument('--bar', action='store_false')\n" +">>> parser.parse_args(['--foo'])\n" +"Namespace(bar=True, foo=True)\n" +">>> parser.parse_args(['--bar'])\n" +"Namespace(bar=False, foo=False)\n" +">>> parser.parse_args(['--foo', '--bar'])\n" +"usage: PROG [-h] [--foo | --bar]\n" +"PROG: error: argument --bar: not allowed with argument --foo" #: ../../library/argparse.rst:2004 msgid "" @@ -3122,7 +3852,6 @@ msgstr "" ":meth:`add_mutually_exclusive_group` メソッドの引数 *required* に True 値を指" "定すると、その相互排他引数のどれか1つを選ぶことが要求されます::" -#: ../../library/argparse.rst:2008 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> group = parser.add_mutually_exclusive_group(required=True)\n" @@ -3132,16 +3861,26 @@ msgid "" "usage: PROG [-h] (--foo | --bar)\n" "PROG: error: one of the arguments --foo --bar is required" msgstr "" +">>> parser = argparse.ArgumentParser(prog='PROG')\n" +">>> group = parser.add_mutually_exclusive_group(required=True)\n" +">>> group.add_argument('--foo', action='store_true')\n" +">>> group.add_argument('--bar', action='store_false')\n" +">>> parser.parse_args([])\n" +"usage: PROG [-h] (--foo | --bar)\n" +"PROG: error: one of the arguments --foo --bar is required" -#: ../../library/argparse.rst:2016 msgid "" "Note that currently mutually exclusive argument groups do not support the " "*title* and *description* arguments of :meth:`~ArgumentParser." "add_argument_group`. However, a mutually exclusive group can be added to an " "argument group that has a title and description. For example::" msgstr "" +"現在、相互排他引数グループでは :meth:`~ArgumentParser.add_argument_group` の " +"*title* と *description* 引数はサポートされていません。\n" +"ただし、タイトルと説明を持つ引数グループに、相互排他グループを追加することは" +"できます。\n" +"例えば次のようになります。 ::" -#: ../../library/argparse.rst:2022 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> group = parser.add_argument_group('Group title', 'Group description')\n" @@ -3160,14 +3899,35 @@ msgid "" " --foo FOO foo help\n" " --bar BAR bar help" msgstr "" +">>> parser = argparse.ArgumentParser(prog='PROG')\n" +">>> group = parser.add_argument_group('Group title', 'Group description')\n" +">>> exclusive_group = group.add_mutually_exclusive_group(required=True)\n" +">>> exclusive_group.add_argument('--foo', help='foo help')\n" +">>> exclusive_group.add_argument('--bar', help='bar help')\n" +">>> parser.print_help()\n" +"usage: PROG [-h] (--foo FOO | --bar BAR)\n" +"\n" +"options:\n" +" -h, --help show this help message and exit\n" +"\n" +"Group title:\n" +" Group description\n" +"\n" +" --foo FOO foo help\n" +" --bar BAR bar help" -#: ../../library/argparse.rst:2039 msgid "" "Calling :meth:`add_argument_group` or :meth:`add_mutually_exclusive_group` " "on a mutually exclusive group now raises an exception. This nesting was " "never supported, often failed to work correctly, and was unintentionally " "exposed through inheritance." msgstr "" +"相互排他グループに対して :meth:`add_argument_group` または :meth:" +"`add_mutually_exclusive_group` を呼び出すと、例外が送出されるようになりまし" +"た。\n" +"この入れ子構造はもともとサポートされておらず、正しく動作しないことも多くあり" +"ました。\n" +"継承によって意図せず利用可能になっていたものです。" #: ../../library/argparse.rst:2047 msgid "Parser defaults" @@ -3186,7 +3946,6 @@ msgstr "" "を使うと与えられたコマンドライン引数の内容によらず追加の属性を決定することが" "可能です::" -#: ../../library/argparse.rst:2057 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('foo', type=int)\n" @@ -3194,6 +3953,11 @@ msgid "" ">>> parser.parse_args(['736'])\n" "Namespace(bar=42, baz='badger', foo=736)" msgstr "" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument('foo', type=int)\n" +">>> parser.set_defaults(bar=42, baz='badger')\n" +">>> parser.parse_args(['736'])\n" +"Namespace(bar=42, baz='badger', foo=736)" #: ../../library/argparse.rst:2063 msgid "" @@ -3201,7 +3965,6 @@ msgid "" msgstr "" "パーサーレベルのデフォルト値は常に引数レベルのデフォルト値を上書きします::" -#: ../../library/argparse.rst:2065 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default='bar')\n" @@ -3209,6 +3972,11 @@ msgid "" ">>> parser.parse_args([])\n" "Namespace(foo='spam')" msgstr "" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument('--foo', default='bar')\n" +">>> parser.set_defaults(foo='spam')\n" +">>> parser.parse_args([])\n" +"Namespace(foo='spam')" #: ../../library/argparse.rst:2071 msgid "" @@ -3228,13 +3996,16 @@ msgstr "" ":meth:`~ArgumentParser.add_argument` か :meth:`~ArgumentParser.set_defaults` " "によって指定された、 namespace の属性のデフォルト値を取得します::" -#: ../../library/argparse.rst:2081 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default='badger')\n" ">>> parser.get_default('foo')\n" "'badger'" msgstr "" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument('--foo', default='badger')\n" +">>> parser.get_default('foo')\n" +"'badger'" #: ../../library/argparse.rst:2088 msgid "Printing help" @@ -3314,7 +4085,6 @@ msgstr "" "エラーを生成しません。代わりに、評価された namespace オブジェクトと、残りの引" "数文字列のリストからなる2要素タプルを返します。" -#: ../../library/argparse.rst:2134 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', action='store_true')\n" @@ -3322,6 +4092,11 @@ msgid "" ">>> parser.parse_known_args(['--foo', '--badger', 'BAR', 'spam'])\n" "(Namespace(bar='BAR', foo=True), ['--badger', 'spam'])" msgstr "" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument('--foo', action='store_true')\n" +">>> parser.add_argument('bar')\n" +">>> parser.parse_known_args(['--foo', '--badger', 'BAR', 'spam'])\n" +"(Namespace(bar='BAR', foo=True), ['--badger', 'spam'])" #: ../../library/argparse.rst:2141 msgid "" @@ -3369,25 +4144,28 @@ msgstr "" "このメソッドをオーバーライドすると便利なこととして、スペースで区切られた行の" "単語1つ1つを別々の引数として扱えます。次の例でその方法を示します::" -#: ../../library/argparse.rst:2164 msgid "" "class MyArgumentParser(argparse.ArgumentParser):\n" " def convert_arg_line_to_args(self, arg_line):\n" " return arg_line.split()" msgstr "" +"class MyArgumentParser(argparse.ArgumentParser):\n" +" def convert_arg_line_to_args(self, arg_line):\n" +" return arg_line.split()" #: ../../library/argparse.rst:2170 msgid "Exiting methods" msgstr "終了メソッド" -#: ../../library/argparse.rst:2174 msgid "" "This method terminates the program, exiting with the specified *status* and, " "if given, it prints a *message* to :data:`sys.stderr` before that. The user " "can override this method to handle these steps differently::" msgstr "" +"このメソッドは、指定された *status* でプログラムを終了します。\n" +"*message* が指定されていれば、終了前に :data:`sys.stderr` に表示します。\n" +"このメソッドをオーバーライドして、これらの処理を変更できます。 ::" -#: ../../library/argparse.rst:2178 msgid "" "class ErrorCatchingArgumentParser(argparse.ArgumentParser):\n" " def exit(self, status=0, message=None):\n" @@ -3395,12 +4173,18 @@ msgid "" " raise Exception(f'Exiting because of an error: {message}')\n" " exit(status)" msgstr "" +"class ErrorCatchingArgumentParser(argparse.ArgumentParser):\n" +" def exit(self, status=0, message=None):\n" +" if status:\n" +" raise Exception(f'Exiting because of an error: {message}')\n" +" exit(status)" -#: ../../library/argparse.rst:2186 msgid "" "This method prints a usage message, including the *message*, to :data:`sys." "stderr` and terminates the program with a status code of 2." msgstr "" +"このメソッドは、*message* を含む使用法メッセージを :data:`sys.stderr` に表示" +"し、ステータスコード 2 でプログラムを終了します。" #: ../../library/argparse.rst:2191 msgid "Intermixed parsing" @@ -3418,13 +4202,16 @@ msgstr "" "parse_known_intermixed_args` メソッドは、このような方法での解析をサポートして" "います。" -#: ../../library/argparse.rst:2201 msgid "" "These parsers do not support all the :mod:`!argparse` features, and will " "raise exceptions if unsupported features are used. In particular, " "subparsers, and mutually exclusive groups that include both optionals and " "positionals are not supported." msgstr "" +"これらのパーサーは :mod:`!argparse` のすべての機能をサポートしているわけでは" +"なく、未対応の機能を使うと例外を送出します。\n" +"特に、サブパーサーと、オプション引数と位置引数の両方を含む相互排他グループに" +"は対応していません。" #: ../../library/argparse.rst:2206 msgid "" @@ -3437,7 +4224,6 @@ msgstr "" "parse_intermixed_args` の違いを表しています: 前者は ``['2', '3']`` を、解析さ" "れない引数として返し、後者は全ての位置引数を ``rest`` に入れて返しています::" -#: ../../library/argparse.rst:2212 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo')\n" @@ -3448,6 +4234,14 @@ msgid "" ">>> parser.parse_intermixed_args('doit 1 --foo bar 2 3'.split())\n" "Namespace(cmd='doit', foo='bar', rest=[1, 2, 3])" msgstr "" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument('--foo')\n" +">>> parser.add_argument('cmd')\n" +">>> parser.add_argument('rest', nargs='*', type=int)\n" +">>> parser.parse_known_args('doit 1 --foo bar 2 3'.split())\n" +"(Namespace(cmd='doit', foo='bar', rest=[1]), ['2', '3'])\n" +">>> parser.parse_intermixed_args('doit 1 --foo bar 2 3'.split())\n" +"Namespace(cmd='doit', foo='bar', rest=[1, 2, 3])" #: ../../library/argparse.rst:2221 msgid "" @@ -3461,32 +4255,35 @@ msgstr "" ":meth:`~ArgumentParser.parse_intermixed_args` は、解析されない引数が残された" "場合にはエラーを送出します。" -#: ../../library/argparse.rst:2230 msgid "Registering custom types or actions" -msgstr "" +msgstr "独自の型やアクションの登録" -#: ../../library/argparse.rst:2234 msgid "" "Sometimes it's desirable to use a custom string in error messages to provide " "more user-friendly output. In these cases, :meth:`!register` can be used to " "register custom actions or types with a parser and allow you to reference " "the type by their registered name instead of their callable name." msgstr "" +"エラーメッセージに独自の文字列を使って、出力をユーザーにわかりやすくしたい場" +"合があります。\n" +"その場合は、:meth:`!register` で独自のアクションや型をパーサーに登録すると、" +"呼び出し可能オブジェクトの名前の代わりに登録名で型を参照できます。" -#: ../../library/argparse.rst:2239 msgid "" "The :meth:`!register` method accepts three arguments - a *registry_name*, " "specifying the internal registry where the object will be stored (e.g., " "``action``, ``type``), *value*, which is the key under which the object will " "be registered, and object, the callable to be registered." msgstr "" +":meth:`!register` メソッドは三つの引数を受け取ります。\n" +"*registry_name* はオブジェクトを格納する内部レジストリ (``action``、``type`` " +"など)、*value* は登録に使うキー、``object`` は登録する呼び出し可能オブジェク" +"トです。" -#: ../../library/argparse.rst:2244 msgid "" "The following example shows how to register a custom type with a parser::" -msgstr "" +msgstr "次の例は、パーサーに独自の型を登録する方法を示します。 ::" -#: ../../library/argparse.rst:2246 msgid "" ">>> import argparse\n" ">>> parser = argparse.ArgumentParser()\n" @@ -3501,6 +4298,18 @@ msgid "" "usage: PROG [-h] [--foo FOO]\n" "PROG: error: argument --foo: invalid 'hexadecimal integer' value: '1.2'" msgstr "" +">>> import argparse\n" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.register('type', 'hexadecimal integer', lambda s: int(s, 16))\n" +">>> parser.add_argument('--foo', type='hexadecimal integer')\n" +"_StoreAction(option_strings=['--foo'], dest='foo', nargs=None, const=None, " +"default=None, type='hexadecimal integer', choices=None, required=False, " +"help=None, metavar=None, deprecated=False)\n" +">>> parser.parse_args(['--foo', '0xFA'])\n" +"Namespace(foo=250)\n" +">>> parser.parse_args(['--foo', '1.2'])\n" +"usage: PROG [-h] [--foo FOO]\n" +"PROG: error: argument --foo: invalid 'hexadecimal integer' value: '1.2'" #: ../../library/argparse.rst:2258 msgid "Exceptions" diff --git a/library/array.po b/library/array.po index e2991dc90..b4cd12a97 100644 --- a/library/array.po +++ b/library/array.po @@ -21,10 +21,10 @@ msgstr "" "Last-Translator: tomo, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/array.rst:2 @@ -97,9 +97,8 @@ msgstr "``'u'``" msgid "wchar_t" msgstr "wchar_t" -#: ../../library/array.rst:25 ../../library/array.rst:27 msgid "Unicode character" -msgstr "Unicode文字(unicode型)" +msgstr "Unicode 文字" #: ../../library/array.rst:25 ../../library/array.rst:29 #: ../../library/array.rst:31 ../../library/array.rst:33 @@ -115,9 +114,8 @@ msgstr "\\(1)" msgid "``'w'``" msgstr "``'w'``" -#: ../../library/array.rst:27 msgid "Py_UCS4" -msgstr "" +msgstr "Py_UCS4" #: ../../library/array.rst:27 ../../library/array.rst:37 #: ../../library/array.rst:39 ../../library/array.rst:45 @@ -213,20 +211,22 @@ msgstr "double" msgid "Notes:" msgstr "注釈:" -#: ../../library/array.rst:53 msgid "It can be 16 bits or 32 bits depending on the platform." msgstr "" +"プラットフォームによって、16 ビットの場合と 32 ビットの場合があります。" -#: ../../library/array.rst:55 msgid "" "``array('u')`` now uses :c:type:`wchar_t` as C type instead of deprecated " "``Py_UNICODE``. This change doesn't affect its behavior because " "``Py_UNICODE`` is alias of :c:type:`wchar_t` since Python 3.3." msgstr "" +"``array('u')`` の C の型は、非推奨の ``Py_UNICODE`` から :c:type:`wchar_t` に" +"変更されました。\n" +"Python 3.3 以降、``Py_UNICODE`` は :c:type:`wchar_t` の別名なので、この変更に" +"よる動作の違いはありません。" -#: ../../library/array.rst:60 msgid "Please migrate to ``'w'`` typecode." -msgstr "" +msgstr "型コード ``'w'`` に移行してください。" #: ../../library/array.rst:64 msgid "" @@ -249,15 +249,17 @@ msgstr "すべての利用可能なタイプコードを含む文字列" msgid "The module defines the following type:" msgstr "このモジュールでは次の型を定義しています:" -#: ../../library/array.rst:81 msgid "" "A new array whose items are restricted by *typecode*, and initialized from " "the optional *initializer* value, which must be a :class:`bytes` or :class:" "`bytearray` object, a Unicode string, or iterable over elements of the " "appropriate type." msgstr "" +"要素の型を *typecode* で制限した新しい配列を作成します。\n" +"省略可能な *initializer* を指定すると、その値で初期化します。\n" +"この値は :class:`bytes` オブジェクト、:class:`bytearray` オブジェクト、" +"Unicode 文字列、または適切な型の要素を返すイテラブルでなければなりません。" -#: ../../library/array.rst:86 msgid "" "If given a :class:`bytes` or :class:`bytearray` object, the initializer is " "passed to the new array's :meth:`frombytes` method; if given a Unicode " @@ -265,6 +267,11 @@ msgid "" "otherwise, the initializer's iterator is passed to the :meth:`extend` method " "to add initial items to the array." msgstr "" +":class:`bytes` または :class:`bytearray` オブジェクトを指定した場合、" +"``initializer`` は新しい配列の :meth:`frombytes` メソッドに渡されます。\n" +"Unicode 文字列を指定した場合は :meth:`fromunicode` メソッドに渡されます。\n" +"それ以外の場合は、``initializer`` のイテレーターを :meth:`extend` メソッドに" +"渡して、初期値となる要素を配列に追加します。" #: ../../library/array.rst:93 msgid "" @@ -329,11 +336,11 @@ msgid "" "backward compatibility and should be avoided in new code. The buffer " "interface is documented in :ref:`bufferobjects`." msgstr "" -"C やC++ で書いたコードからアレイオブジェクトを使う場合 (:meth:`buffer_info` " -"の情報を使う意味のある唯一の方法です) は、アレイオブジェクトでサポートしてい" -"るバッファインターフェースを使う方がより理にかなっています。このメソッドは後" -"方互換性のために保守されており、新しいコードでの使用は避けるべきです。バッ" -"ファインターフェースの説明は :ref:`bufferobjects` にあります。" +"C やC++ で書いたコードからアレイオブジェクトを使う場合 (``buffer_info()`` の" +"情報を使う意味のある唯一の方法です) は、アレイオブジェクトでサポートしている" +"バッファインターフェースを使う方がより理にかなっています。このメソッドは後方" +"互換性のために保守されており、新しいコードでの使用は避けるべきです。バッファ" +"インターフェースの説明は :ref:`bufferobjects` にあります。" #: ../../library/array.rst:138 msgid "" @@ -365,12 +372,14 @@ msgstr "" "ない場合、アレイに値を追加できるような正しい型の要素からなるイテレーション可" "能オブジェクトでなければなりません。" -#: ../../library/array.rst:159 msgid "" "Appends items from the :term:`bytes-like object`, interpreting its content " "as an array of machine values (as if it had been read from a file using the :" "meth:`fromfile` method)." msgstr "" +":term:`bytes-like object` の内容をマシンのデータ形式の配列として解釈し、要素" +"を追加します (:meth:`fromfile` メソッドでファイルから読み込んだ場合と同じで" +"す)。" #: ../../library/array.rst:163 msgid ":meth:`!fromstring` is renamed to :meth:`frombytes` for clarity." @@ -398,13 +407,17 @@ msgstr "" "リストから要素を追加します。型に関するエラーが発生した場合にアレイが変更され" "ないことを除き、 ``for x in list: a.append(x)`` と同じです。" -#: ../../library/array.rst:183 msgid "" "Extends this array with data from the given Unicode string. The array must " "have type code ``'u'`` or ``'w'``; otherwise a :exc:`ValueError` is raised. " "Use ``array.frombytes(unicodestring.encode(enc))`` to append Unicode data to " "an array of some other type." msgstr "" +"指定した Unicode 文字列のデータを配列に追加します。\n" +"配列の型コードは ``'u'`` または ``'w'`` でなければならず、それ以外では :exc:" +"`ValueError` を送出します。\n" +"他の型の配列に Unicode データを追加するには、``array.frombytes(unicodestring." +"encode(enc))`` を使ってください。" #: ../../library/array.rst:191 msgid "" @@ -414,9 +427,8 @@ msgid "" "`ValueError` if *x* is not found." msgstr "" -#: ../../library/array.rst:196 msgid "Added optional *start* and *stop* parameters." -msgstr "" +msgstr "省略可能な *start* と *stop* パラメーターが追加されました。" #: ../../library/array.rst:202 msgid "" @@ -440,9 +452,8 @@ msgstr "" msgid "Remove the first occurrence of *x* from the array." msgstr "アレイ中の *x* のうち、最初に現れたものを取り除きます。" -#: ../../library/array.rst:220 msgid "Remove all elements from the array." -msgstr "" +msgstr "配列のすべての要素を削除します。" #: ../../library/array.rst:227 msgid "Reverse the order of the items in the array." @@ -457,9 +468,9 @@ msgstr "" "array をマシンの値の array に変換して、 bytes の形で返します (:meth:`tofile` " "メソッドを使ってファイルに書かれるバイト列と同じです)。" -#: ../../library/array.rst:236 msgid ":meth:`!tostring` is renamed to :meth:`tobytes` for clarity." msgstr "" +"名前を明確にするため、:meth:`!tostring` を :meth:`tobytes` に改名しました。" #: ../../library/array.rst:242 msgid "Write all items (as machine values) to the :term:`file object` *f*." @@ -470,12 +481,16 @@ msgstr "" msgid "Convert the array to an ordinary list with the same items." msgstr "アレイを同じ要素を持つ普通のリストに変換します。" -#: ../../library/array.rst:252 msgid "" "Convert the array to a Unicode string. The array must have a type ``'u'`` " "or ``'w'``; otherwise a :exc:`ValueError` is raised. Use ``array.tobytes()." "decode(enc)`` to obtain a Unicode string from an array of some other type." msgstr "" +"配列を Unicode 文字列に変換します。\n" +"配列の型コードは ``'u'`` または ``'w'`` でなければならず、それ以外では :exc:" +"`ValueError` を送出します。\n" +"他の型の配列から Unicode 文字列を得るには、``array.tobytes().decode(enc)`` を" +"使ってください。" #: ../../library/array.rst:257 msgid "" @@ -490,13 +505,16 @@ msgid "" "Examples::" msgstr "" -#: ../../library/array.rst:269 msgid "" "array('l')\n" "array('w', 'hello \\u2641')\n" "array('l', [1, 2, 3, 4, 5])\n" "array('d', [1.0, 2.0, 3.14, -inf, nan])" msgstr "" +"array('l')\n" +"array('w', 'hello \\u2641')\n" +"array('l', [1, 2, 3, 4, 5])\n" +"array('d', [1.0, 2.0, 3.14, -inf, nan])" #: ../../library/array.rst:277 msgid "Module :mod:`struct`" diff --git a/library/ast.po b/library/ast.po index 73485d388..4ff6987be 100644 --- a/library/ast.po +++ b/library/ast.po @@ -21,15 +21,14 @@ msgstr "" "Last-Translator: Takanori Suzuki , 2025\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" -#: ../../library/ast.rst:2 msgid ":mod:`!ast` --- Abstract syntax trees" -msgstr "" +msgstr ":mod:`!ast` --- 抽象構文木" #: ../../library/ast.rst:14 msgid "**Source code:** :source:`Lib/ast.py`" @@ -63,9 +62,8 @@ msgstr "" "`compile` を使って Python コード・オブジェクトにコンパイルすることができま" "す。" -#: ../../library/ast.rst:33 msgid "Abstract grammar" -msgstr "" +msgstr "抽象文法" #: ../../library/ast.rst:35 msgid "The abstract grammar is currently defined as follows:" @@ -315,20 +313,22 @@ msgstr "" "ストで表されます。全ての属性は AST を :func:`compile` でコンパイルする際には" "存在しなければならず、そして妥当な値でなければなりません。" -#: ../../library/ast.rst:79 msgid "" "The :attr:`!_field_types` attribute on each concrete class is a dictionary " "mapping field names (as also listed in :attr:`_fields`) to their types." msgstr "" +"各具象クラスの :attr:`!_field_types` 属性は、フィールド名 (:attr:`_fields` に" +"も列挙されています) をその型に対応付ける辞書です。" -#: ../../library/ast.rst:82 msgid "" ">>> ast.TypeVar._field_types\n" "{'name': , 'bound': ast.expr | None, 'default_value': ast.expr " "| None}" msgstr "" +">>> ast.TypeVar._field_types\n" +"{'name': , 'bound': ast.expr | None, 'default_value': ast.expr " +"| None}" -#: ../../library/ast.rst:94 msgid "" "Instances of :class:`ast.expr` and :class:`ast.stmt` subclasses have :attr:" "`lineno`, :attr:`col_offset`, :attr:`end_lineno`, and :attr:`end_col_offset` " @@ -339,13 +339,14 @@ msgid "" "the node. The UTF-8 offset is recorded because the parser uses UTF-8 " "internally." msgstr "" -":class:`ast.expr` や :class:`ast.stmt` のサブクラスのインスタンスは :attr:" -"`lineno`, :attr:`col_offset`, :attr:`end_lineno`, および :attr:" -"`end_col_offset` 属性を持ちます。 :attr:`lineno` と :attr:`end_lineno` はソー" -"ステキストの範囲を最初と最後の行番号で表し (1 から数え始めるので、最初の行の" -"行番号は 1 となります)、 :attr:`col_offset` と :attr:`end_col_offset` はノー" -"ドが生成した最初と最後のトークンの UTF-8 バイトオフセットです。 UTF-8 オフ" -"セットはパーサが内部で使用するので記録されます。" +":class:`ast.expr` と :class:`ast.stmt` のサブクラスのインスタンスは、:attr:" +"`lineno`、:attr:`col_offset`、:attr:`end_lineno`、:attr:`end_col_offset` 属性" +"を持ちます。\n" +":attr:`lineno` と :attr:`end_lineno` は、対応するソーステキストの最初と最後の" +"行番号です (1 から数えるので、先頭行は 1 です)。\n" +":attr:`col_offset` と :attr:`end_col_offset` は、ノードの生成元となった最初と" +"最後のトークンに対応する UTF-8 バイトオフセットです。\n" +"パーサーは内部で UTF-8 を使うため、この形式のオフセットを記録します。" #: ../../library/ast.rst:103 msgid "" @@ -388,11 +389,12 @@ msgstr "" "たとえば、 :class:`ast.UnaryOp` ノードを生成して属性を埋めるには、次のように" "することができます ::" -#: ../../library/ast.rst:118 msgid "" "node = ast.UnaryOp(ast.USub(), ast.Constant(5, lineno=0, col_offset=0),\n" " lineno=0, col_offset=0)" msgstr "" +"node = ast.UnaryOp(ast.USub(), ast.Constant(5, lineno=0, col_offset=0),\n" +" lineno=0, col_offset=0)" #: ../../library/ast.rst:121 msgid "" @@ -416,11 +418,12 @@ msgstr "" "単純なインデックスはその値で表現され、幅を持つスライスはタプルで表現されま" "す。" -#: ../../library/ast.rst:139 msgid "" "The :meth:`~object.__repr__` output of :class:`~ast.AST` nodes includes the " "values of the node fields." msgstr "" +":class:`~ast.AST` ノードの :meth:`~object.__repr__` の出力に、ノードのフィー" +"ルドの値が含まれるようになりました。" #: ../../library/ast.rst:144 msgid "" @@ -430,12 +433,14 @@ msgid "" "instantiating them will return an instance of a different class." msgstr "" -#: ../../library/ast.rst:151 msgid "" "Old classes :class:`!ast.Index` and :class:`!ast.ExtSlice` are still " "available, but they will be removed in future Python releases. In the " "meantime, instantiating them will return an instance of a different class." msgstr "" +"古いクラス :class:`!ast.Index` と :class:`!ast.ExtSlice` はまだ利用できます" +"が、将来の Python で削除されます。\n" +"現在、これらをインスタンス化すると、別のクラスのインスタンスが返されます。" #: ../../library/ast.rst:158 msgid "" @@ -456,27 +461,29 @@ msgstr "" "Snakes `__ プロジェクトと" "そのすべての貢献者の成果物をもとにしています。" -#: ../../library/ast.rst:174 msgid "Root nodes" -msgstr "" +msgstr "ルートノード" -#: ../../library/ast.rst:178 msgid "" "A Python module, as with :ref:`file input `. Node type generated " "by :func:`ast.parse` in the default ``\"exec\"`` *mode*." msgstr "" +":ref:`ファイル入力 ` のような Python モジュールを表します。\n" +":func:`ast.parse` の *mode* がデフォルトの ``\"exec\"`` のときに生成される" +"ノード型です。" -#: ../../library/ast.rst:181 msgid "``body`` is a :class:`list` of the module's :ref:`ast-statements`." msgstr "" +"``body`` は、モジュールの :ref:`文 ` の :class:`list` です。" -#: ../../library/ast.rst:183 msgid "" "``type_ignores`` is a :class:`list` of the module's type ignore comments; " "see :func:`ast.parse` for more details." msgstr "" +"``type_ignores`` は、モジュールの型検査を無視するコメントの :class:`list` で" +"す。\n" +"詳細は :func:`ast.parse` を参照してください。" -#: ../../library/ast.rst:186 msgid "" ">>> print(ast.dump(ast.parse('x = 1'), indent=4))\n" "Module(\n" @@ -486,37 +493,48 @@ msgid "" " Name(id='x', ctx=Store())],\n" " value=Constant(value=1))])" msgstr "" +">>> print(ast.dump(ast.parse('x = 1'), indent=4))\n" +"Module(\n" +" body=[\n" +" Assign(\n" +" targets=[\n" +" Name(id='x', ctx=Store())],\n" +" value=Constant(value=1))])" -#: ../../library/ast.rst:199 msgid "" "A single Python :ref:`expression input `. Node type " "generated by :func:`ast.parse` when *mode* is ``\"eval\"``." msgstr "" +"Python の単一の :ref:`式入力 ` を表します。\n" +":func:`ast.parse` の *mode* が ``\"eval\"`` のときに生成されるノード型です。" -#: ../../library/ast.rst:202 msgid "" "``body`` is a single node, one of the :ref:`expression types `." msgstr "" +"``body`` は、:ref:`式の型 ` のいずれかの単一ノードです。" -#: ../../library/ast.rst:205 ../../library/ast.rst:275 msgid "" ">>> print(ast.dump(ast.parse('123', mode='eval'), indent=4))\n" "Expression(\n" " body=Constant(value=123))" msgstr "" +">>> print(ast.dump(ast.parse('123', mode='eval'), indent=4))\n" +"Expression(\n" +" body=Constant(value=123))" -#: ../../library/ast.rst:214 msgid "" "A single :ref:`interactive input `, like in :ref:`tut-interac`. " "Node type generated by :func:`ast.parse` when *mode* is ``\"single\"``." msgstr "" +":ref:`対話モード ` などでの、単一の :ref:`対話的な入力 " +"` を表します。\n" +":func:`ast.parse` の *mode* が ``\"single\"`` のときに生成されるノード型で" +"す。" -#: ../../library/ast.rst:217 msgid "``body`` is a :class:`list` of :ref:`statement nodes `." -msgstr "" +msgstr "``body`` は :ref:`文ノード ` の :class:`list` です。" -#: ../../library/ast.rst:219 msgid "" ">>> print(ast.dump(ast.parse('x = 1; y = 2', mode='single'), indent=4))\n" "Interactive(\n" @@ -530,33 +548,48 @@ msgid "" " Name(id='y', ctx=Store())],\n" " value=Constant(value=2))])" msgstr "" +">>> print(ast.dump(ast.parse('x = 1; y = 2', mode='single'), indent=4))\n" +"Interactive(\n" +" body=[\n" +" Assign(\n" +" targets=[\n" +" Name(id='x', ctx=Store())],\n" +" value=Constant(value=1)),\n" +" Assign(\n" +" targets=[\n" +" Name(id='y', ctx=Store())],\n" +" value=Constant(value=2))])" -#: ../../library/ast.rst:236 msgid "" "A representation of an old-style type comments for functions, as Python " "versions prior to 3.5 didn't support :pep:`484` annotations. Node type " "generated by :func:`ast.parse` when *mode* is ``\"func_type\"``." msgstr "" +"関数の旧形式の型コメントを表します。\n" +"Python 3.5 より前のバージョンでは、:pep:`484` のアノテーションはサポートされ" +"ていませんでした。\n" +":func:`ast.parse` の *mode* が ``\"func_type\"`` のときに生成されるノード型で" +"す。" -#: ../../library/ast.rst:240 msgid "Such type comments would look like this::" -msgstr "" +msgstr "この形式の型コメントは、次のようなものです。 ::" -#: ../../library/ast.rst:242 msgid "" "def sum_two_number(a, b):\n" " # type: (int, int) -> int\n" " return a + b" msgstr "" +"def sum_two_number(a, b):\n" +" # type: (int, int) -> int\n" +" return a + b" -#: ../../library/ast.rst:246 msgid "" "``argtypes`` is a :class:`list` of :ref:`expression nodes `." msgstr "" +"``argtypes`` は :ref:`式ノード ` の :class:`list` です。" -#: ../../library/ast.rst:248 msgid "``returns`` is a single :ref:`expression node `." -msgstr "" +msgstr "``returns`` は単一の :ref:`式ノード ` です。" #: ../../library/ast.rst:250 msgid "" @@ -705,7 +738,6 @@ msgstr "" "集合 (set) をあらわします。 ``elts`` は集合の各要素を表現するノードのリストを" "保持します。" -#: ../../library/ast.rst:360 msgid "" ">>> print(ast.dump(ast.parse('{1, 2, 3}', mode='eval'), indent=4))\n" "Expression(\n" @@ -715,6 +747,13 @@ msgid "" " Constant(value=2),\n" " Constant(value=3)]))" msgstr "" +">>> print(ast.dump(ast.parse('{1, 2, 3}', mode='eval'), indent=4))\n" +"Expression(\n" +" body=Set(\n" +" elts=[\n" +" Constant(value=1),\n" +" Constant(value=2),\n" +" Constant(value=3)]))" #: ../../library/ast.rst:373 msgid "" @@ -726,14 +765,13 @@ msgstr "" "ト を順序が一致した形で (それぞれ :code:`dictionary.keys()` と :code:" "`dictionary.values()` を呼び出したときに返される順序で) 保持します。" -#: ../../library/ast.rst:377 msgid "" "When doing dictionary unpacking using dictionary literals the expression to " "be expanded goes in the ``values`` list, with a ``None`` at the " "corresponding position in ``keys``." msgstr "" -"辞書リテラルを使って辞書を展開した場合、展開された式ツリーにおいて辞書は " -"``values`` リストに入り、 ``keys`` の対応する位置には ``None`` が入ります。" +"辞書リテラルで辞書のアンパックを行う場合、展開対象の式が ``values`` リストに" +"入り、``keys`` の対応する位置には ``None`` が入ります。" #: ../../library/ast.rst:381 msgid "" @@ -794,7 +832,6 @@ msgid "" " Name(id='a', ctx=Del())])])" msgstr "" -#: ../../library/ast.rst:437 msgid "" "A ``*var`` variable reference. ``value`` holds the variable, typically a :" "class:`Name` node. This type must be used when building a :class:`Call` node " @@ -802,7 +839,7 @@ msgid "" msgstr "" "``*var`` 形式の変数の参照をあらわします。 ``value`` は変数、典型的には :" "class:`Name` ノード、を保持します。この型は ``*args`` を伴う関数呼び出しノー" -"ド :class:`Call` を構築する際に使用します。 " +"ド :class:`Call` を構築する際に使用します。" #: ../../library/ast.rst:441 msgid "" @@ -875,13 +912,12 @@ msgid "" " operand=Name(id='x', ctx=Load())))" msgstr "" -#: ../../library/ast.rst:506 msgid "" "A binary operation (like addition or division). ``op`` is the operator, and " "``left`` and ``right`` are any expression nodes." msgstr "" -"(加算や減算のような) 二項演算をあらわします。 ``op`` は演算子、 ``left`` と " -"``right`` は任意の式ツリーのノードです。" +"加算や除算のような二項演算を表します。\n" +"``op`` は演算子で、``left`` と ``right`` は任意の式ノードです。" #: ../../library/ast.rst:509 msgid "" @@ -963,21 +999,20 @@ msgstr "" "関数呼び出しをあらわします。 ``func`` は関数で、多くの場合 :class:`Name` また" "は :class:`Attribute` のオブジェクトです。 関数呼び出しの引数:" -#: ../../library/ast.rst:601 msgid "``args`` holds a list of the arguments passed by position." -msgstr "``args`` は位置引数のリストを保持します。 " +msgstr "``args`` は位置引数のリストを保持します。" -#: ../../library/ast.rst:602 msgid "" "``keywords`` holds a list of :class:`.keyword` objects representing " "arguments passed by keyword." msgstr "" +"``keywords`` は、キーワードで渡す引数を表す :class:`.keyword` オブジェクトの" +"リストを保持します。" -#: ../../library/ast.rst:605 msgid "" "The ``args`` and ``keywords`` arguments are optional and default to empty " "lists." -msgstr "" +msgstr "``args`` と ``keywords`` 引数は省略可能で、デフォルトは空リストです。" #: ../../library/ast.rst:607 msgid "" @@ -1059,7 +1094,6 @@ msgstr "" "であってもよい :class:`Assign` ノードと異なり、このノードの場合は ``target`` " "と ``value`` の両方が単一のノードでなければなりません。" -#: ../../library/ast.rst:671 msgid "" ">>> print(ast.dump(ast.parse('(x := 4)', mode='eval'), indent=4))\n" "Expression(\n" @@ -1067,6 +1101,11 @@ msgid "" " target=Name(id='x', ctx=Store()),\n" " value=Constant(value=4)))" msgstr "" +">>> print(ast.dump(ast.parse('(x := 4)', mode='eval'), indent=4))\n" +"Expression(\n" +" body=NamedExpr(\n" +" target=Name(id='x', ctx=Store()),\n" +" value=Constant(value=4)))" #: ../../library/ast.rst:682 msgid "Subscripting" @@ -1319,15 +1358,19 @@ msgid "" " value=Name(id='c', ctx=Load()))])" msgstr "" -#: ../../library/ast.rst:896 msgid "" "An assignment with a type annotation. ``target`` is a single node and can be " "a :class:`Name`, an :class:`Attribute` or a :class:`Subscript`. " "``annotation`` is the annotation, such as a :class:`Constant` or :class:" "`Name` node. ``value`` is a single optional node." msgstr "" +"型アノテーションを伴う代入です。\n" +"``target`` は単一のノードで、:class:`Name`、:class:`Attribute`、:class:" +"`Subscript` のいずれかです。\n" +"``annotation`` はアノテーションを表す :class:`Constant` や :class:`Name` など" +"のノードです。\n" +"``value`` は省略可能な単一のノードです。" -#: ../../library/ast.rst:901 msgid "" "``simple`` is always either 0 (indicating a \"complex\" target) or 1 " "(indicating a \"simple\" target). A \"simple\" target consists solely of a :" @@ -1335,6 +1378,12 @@ msgid "" "targets are considered complex. Only simple targets appear in the :attr:" "`~object.__annotations__` dictionary of modules and classes." msgstr "" +"``simple`` は常に 0 (「複雑な」代入先) または 1 (「単純な」代入先) のいずれか" +"です。\n" +"「単純な」代入先は、括弧で囲まれていない :class:`Name` ノードだけからなり、そ" +"れ以外はすべて複雑な代入先とみなされます。\n" +"モジュールやクラスの :attr:`~object.__annotations__` 辞書に含まれるのは、単純" +"な代入先だけです。" #: ../../library/ast.rst:907 msgid "" @@ -1400,7 +1449,6 @@ msgstr "" ":class:`Assign` と異なり、 ``target`` 属性は class :class:`Tuple` や :class:" "`List` であってはいけません。" -#: ../../library/ast.rst:959 msgid "" ">>> print(ast.dump(ast.parse('x += 2'), indent=4))\n" "Module(\n" @@ -1410,6 +1458,13 @@ msgid "" " op=Add(),\n" " value=Constant(value=2))])" msgstr "" +">>> print(ast.dump(ast.parse('x += 2'), indent=4))\n" +"Module(\n" +" body=[\n" +" AugAssign(\n" +" target=Name(id='x', ctx=Store()),\n" +" op=Add(),\n" +" value=Constant(value=2))])" #: ../../library/ast.rst:972 msgid "" @@ -1458,7 +1513,6 @@ msgstr "" "``del`` 文をあらわします。 ``targets`` は :class:`Name`, :class:" "`Attribute`, :class:`Subscript` などのノードのリストです。" -#: ../../library/ast.rst:1006 msgid "" ">>> print(ast.dump(ast.parse('del x,y,z'), indent=4))\n" "Module(\n" @@ -1469,26 +1523,39 @@ msgid "" " Name(id='y', ctx=Del()),\n" " Name(id='z', ctx=Del())])])" msgstr "" +">>> print(ast.dump(ast.parse('del x,y,z'), indent=4))\n" +"Module(\n" +" body=[\n" +" Delete(\n" +" targets=[\n" +" Name(id='x', ctx=Del()),\n" +" Name(id='y', ctx=Del()),\n" +" Name(id='z', ctx=Del())])])" #: ../../library/ast.rst:1020 msgid "A ``pass`` statement." msgstr "``pass`` 文をあらわします。" -#: ../../library/ast.rst:1022 msgid "" ">>> print(ast.dump(ast.parse('pass'), indent=4))\n" "Module(\n" " body=[\n" " Pass()])" msgstr "" +">>> print(ast.dump(ast.parse('pass'), indent=4))\n" +"Module(\n" +" body=[\n" +" Pass()])" -#: ../../library/ast.rst:1032 msgid "" "A :ref:`type alias ` created through the :keyword:`type` " "statement. ``name`` is the name of the alias, ``type_params`` is a list of :" "ref:`type parameters `, and ``value`` is the value of the " "type alias." msgstr "" +":keyword:`type` 文で作成した :ref:`型エイリアス ` です。\n" +"``name`` はエイリアスの名前、``type_params`` は :ref:`型パラメーター ` のリスト、``value`` は型エイリアスの値です。" #: ../../library/ast.rst:1037 msgid "" @@ -1631,7 +1698,6 @@ msgid "" " value=Constant(value=Ellipsis))])])])" msgstr "" -#: ../../library/ast.rst:1154 msgid "" "A ``for`` loop. ``target`` holds the variable(s) the loop assigns to, as a " "single :class:`Name`, :class:`Tuple`, :class:`List`, :class:`Attribute` or :" @@ -1640,6 +1706,15 @@ msgid "" "Those in ``orelse`` are executed if the loop finishes normally, rather than " "via a ``break`` statement." msgstr "" +"``for`` ループです。\n" +"``target`` はループの代入先となる変数を、単一の :class:`Name`、:class:" +"`Tuple`、:class:`List`、:class:`Attribute`、:class:`Subscript` のいずれかの" +"ノードとして保持します。\n" +"``iter`` は繰り返しの対象となるオブジェクトを、同じく単一のノードとして保持し" +"ます。\n" +"``body`` と ``orelse`` は実行するノードのリストを保持します。\n" +"``orelse`` 内のノードは、``break`` 文によらずループが正常に終了した場合に実行" +"されます。" #: ../../library/ast.rst:1165 msgid "" @@ -1885,36 +1960,42 @@ msgid "" " Name(id='d', ctx=Load())]))])])" msgstr "" -#: ../../library/ast.rst:1393 msgid "Pattern matching" -msgstr "" +msgstr "パターンマッチ" -#: ../../library/ast.rst:1398 msgid "" "A ``match`` statement. ``subject`` holds the subject of the match (the " "object that is being matched against the cases) and ``cases`` contains an " "iterable of :class:`match_case` nodes with the different cases." msgstr "" +"``match`` 文です。\n" +"``subject`` はマッチ対象 (各 case と照合するオブジェクト) を保持し、" +"``cases`` は各 case を表す :class:`match_case` ノードのイテラブルを保持しま" +"す。" -#: ../../library/ast.rst:1406 msgid "" "A single case pattern in a ``match`` statement. ``pattern`` contains the " "match pattern that the subject will be matched against. Note that the :class:" "`AST` nodes produced for patterns differ from those produced for " "expressions, even when they share the same syntax." msgstr "" +"``match`` 文の一つの case パターンです。\n" +"``pattern`` は、対象と照合するパターンを保持します。\n" +"構文が同じでも、パターン用に生成される :class:`AST` ノードは、式用に生成され" +"るノードとは異なります。" -#: ../../library/ast.rst:1411 msgid "" "The ``guard`` attribute contains an expression that will be evaluated if the " "pattern matches the subject." msgstr "" +"``guard`` 属性は、パターンが対象にマッチした場合に評価する式を保持します。" -#: ../../library/ast.rst:1414 msgid "" "``body`` contains a list of nodes to execute if the pattern matches and the " "result of evaluating the guard expression is true." msgstr "" +"``body`` は、パターンがマッチし、ガード式の評価結果が真だった場合に実行する" +"ノードのリストを保持します。" #: ../../library/ast.rst:1417 msgid "" @@ -1951,13 +2032,17 @@ msgid "" " value=Constant(value=Ellipsis))])])])" msgstr "" -#: ../../library/ast.rst:1455 msgid "" "A match literal or value pattern that compares by equality. ``value`` is an " "expression node. Permitted value nodes are restricted as described in the " "match statement documentation. This pattern succeeds if the match subject is " "equal to the evaluated value." msgstr "" +"等価比較を行うリテラルパターンまたは値パターンです。\n" +"``value`` は式ノードです。\n" +"指定できる値ノードは、match 文のドキュメントに記載されたとおりに制限されま" +"す。\n" +"マッチ対象が、式を評価した値と等しければ成功します。" #: ../../library/ast.rst:1460 msgid "" @@ -1979,12 +2064,15 @@ msgid "" " value=Constant(value=Ellipsis))])])])" msgstr "" -#: ../../library/ast.rst:1483 msgid "" "A match literal pattern that compares by identity. ``value`` is the " "singleton to be compared against: ``None``, ``True``, or ``False``. This " "pattern succeeds if the match subject is the given constant." msgstr "" +"同一性を比較するリテラルパターンです。\n" +"``value`` は比較対象のシングルトンで、``None``、``True``、``False`` のいずれ" +"かです。\n" +"マッチ対象がこの定数と同一のオブジェクトなら成功します。" #: ../../library/ast.rst:1487 msgid "" @@ -2005,13 +2093,17 @@ msgid "" " value=Constant(value=Ellipsis))])])])" msgstr "" -#: ../../library/ast.rst:1509 msgid "" "A match sequence pattern. ``patterns`` contains the patterns to be matched " "against the subject elements if the subject is a sequence. Matches a " "variable length sequence if one of the subpatterns is a ``MatchStar`` node, " "otherwise matches a fixed length sequence." msgstr "" +"シーケンスパターンです。\n" +"``patterns`` は、対象がシーケンスである場合にその各要素と照合するパターンを保" +"持します。\n" +"サブパターンの一つが ``MatchStar`` ノードなら可変長のシーケンスに、それ以外な" +"ら固定長のシーケンスにマッチします。" #: ../../library/ast.rst:1514 msgid "" @@ -2037,13 +2129,15 @@ msgid "" " value=Constant(value=Ellipsis))])])])" msgstr "" -#: ../../library/ast.rst:1541 msgid "" "Matches the rest of the sequence in a variable length match sequence " "pattern. If ``name`` is not ``None``, a list containing the remaining " "sequence elements is bound to that name if the overall sequence pattern is " "successful." msgstr "" +"可変長のシーケンスパターンで、シーケンスの残りの部分にマッチします。\n" +"``name`` が ``None`` でなければ、シーケンスパターン全体が成功したときに、残り" +"の要素を含むリストをその名前に束縛します。" #: ../../library/ast.rst:1545 msgid "" @@ -2079,7 +2173,6 @@ msgid "" " value=Constant(value=Ellipsis))])])])" msgstr "" -#: ../../library/ast.rst:1582 msgid "" "A match mapping pattern. ``keys`` is a sequence of expression nodes. " "``patterns`` is a corresponding sequence of pattern nodes. ``rest`` is an " @@ -2087,8 +2180,13 @@ msgid "" "elements. Permitted key expressions are restricted as described in the match " "statement documentation." msgstr "" +"マッピングパターンです。\n" +"``keys`` は式ノードのシーケンス、``patterns`` はそれに対応するパターンノード" +"のシーケンスです。\n" +"``rest`` は省略可能な名前で、マッピングの残りの要素を取得する場合に指定しま" +"す。\n" +"キーに使える式は、match 文のドキュメントに記載されたとおりに制限されます。" -#: ../../library/ast.rst:1588 msgid "" "This pattern succeeds if the subject is a mapping, all evaluated key " "expressions are present in the mapping, and the value corresponding to each " @@ -2096,6 +2194,10 @@ msgid "" "dict containing the remaining mapping elements is bound to that name if the " "overall mapping pattern is successful." msgstr "" +"対象がマッピングで、すべてのキー式の評価結果がそのマッピングに存在し、各キー" +"に対応する値が対応するサブパターンにマッチすれば成功します。\n" +"``rest`` が ``None`` でなければ、マッピングパターン全体が成功したときに、残り" +"の要素を含む辞書をその名前に束縛します。" #: ../../library/ast.rst:1594 msgid "" @@ -2129,7 +2231,6 @@ msgid "" " value=Constant(value=Ellipsis))])])])" msgstr "" -#: ../../library/ast.rst:1629 msgid "" "A match class pattern. ``cls`` is an expression giving the nominal class to " "be matched. ``patterns`` is a sequence of pattern nodes to be matched " @@ -2139,20 +2240,32 @@ msgid "" "the corresponding patterns (specified as keyword values in the class " "pattern)." msgstr "" +"クラスパターンです。\n" +"``cls`` は照合に使うクラスを表す式です。\n" +"``patterns`` はパターンノードのシーケンスで、クラスが定義するパターンマッチ用" +"の属性の並びと照合します。\n" +"``kwd_attrs`` は追加で照合する属性のシーケンス (クラスパターンのキーワード引" +"数の名前)、``kwd_patterns`` はそれらに対応するパターン (クラスパターンのキー" +"ワード引数の値) です。" -#: ../../library/ast.rst:1636 msgid "" "This pattern succeeds if the subject is an instance of the nominated class, " "all positional patterns match the corresponding class-defined attributes, " "and any specified keyword attributes match their corresponding pattern." msgstr "" +"対象が指定したクラスのインスタンスで、すべての位置パターンがクラスで定義した" +"対応する属性にマッチし、キーワードで指定した属性もそれぞれ対応するパターンに" +"マッチすれば成功します。" -#: ../../library/ast.rst:1640 msgid "" "Note: classes may define a property that returns self in order to match a " "pattern node against the instance being matched. Several builtin types are " "also matched that way, as described in the match statement documentation." msgstr "" +"クラスに ``self`` を返すプロパティを定義すると、パターンノードをインスタンス" +"自体と照合できます。\n" +"match 文のドキュメントで説明しているように、一部の組み込み型も同じように照合" +"されます。" #: ../../library/ast.rst:1644 msgid "" @@ -2198,20 +2311,25 @@ msgid "" " value=Constant(value=Ellipsis))])])])" msgstr "" -#: ../../library/ast.rst:1691 msgid "" "A match \"as-pattern\", capture pattern or wildcard pattern. ``pattern`` " "contains the match pattern that the subject will be matched against. If the " "pattern is ``None``, the node represents a capture pattern (i.e a bare name) " "and will always succeed." msgstr "" +"AS パターン、キャプチャパターン、またはワイルドカードパターンです。\n" +"``pattern`` は、対象と照合するパターンを保持します。\n" +"``pattern`` が ``None`` の場合、このノードはキャプチャパターン (名前だけのパ" +"ターン) を表し、常に成功します。" -#: ../../library/ast.rst:1696 msgid "" "The ``name`` attribute contains the name that will be bound if the pattern " "is successful. If ``name`` is ``None``, ``pattern`` must also be ``None`` " "and the node represents the wildcard pattern." msgstr "" +"``name`` 属性は、パターンが成功した場合に束縛する名前を保持します。\n" +"``name`` が ``None`` の場合は ``pattern`` も ``None`` でなければならず、ノー" +"ドはワイルドカードパターンを表します。" #: ../../library/ast.rst:1700 msgid "" @@ -2243,7 +2361,6 @@ msgid "" " value=Constant(value=Ellipsis))])])])" msgstr "" -#: ../../library/ast.rst:1733 msgid "" "A match \"or-pattern\". An or-pattern matches each of its subpatterns in " "turn to the subject, until one succeeds. The or-pattern is then deemed to " @@ -2251,6 +2368,11 @@ msgid "" "``patterns`` attribute contains a list of match pattern nodes that will be " "matched against the subject." msgstr "" +"OR パターンです。\n" +"各サブパターンを順に対象と照合し、どれか一つが成功すれば OR パターン全体が成" +"功します。\n" +"どのサブパターンも成功しなければ失敗します。\n" +"``patterns`` 属性は、対象と照合するパターンノードのリストを保持します。" #: ../../library/ast.rst:1739 msgid "" @@ -2276,15 +2398,15 @@ msgid "" " value=Constant(value=Ellipsis))])])])" msgstr "" -#: ../../library/ast.rst:1766 msgid "Type annotations" -msgstr "" +msgstr "型アノテーション" -#: ../../library/ast.rst:1770 msgid "" "A ``# type: ignore`` comment located at *lineno*. *tag* is the optional tag " "specified by the form ``# type: ignore ``." msgstr "" +"*lineno* 行にある ``# type: ignore`` コメントです。\n" +"*tag* は、``# type: ignore `` の形式で指定する省略可能なタグです。" #: ../../library/ast.rst:1773 msgid "" @@ -2311,24 +2433,25 @@ msgid "" " TypeIgnore(lineno=1, tag='[assignment]')])" msgstr "" -#: ../../library/ast.rst:1796 msgid "" ":class:`!TypeIgnore` nodes are not generated when the *type_comments* " "parameter is set to ``False`` (default). See :func:`ast.parse` for more " "details." msgstr "" +"*type_comments* パラメーターが ``False`` (デフォルト) の場合、:class:`!" +"TypeIgnore` ノードは生成されません。\n" +"詳細は :func:`ast.parse` を参照してください。" -#: ../../library/ast.rst:1804 msgid "Type parameters" -msgstr "" +msgstr "型パラメーター" -#: ../../library/ast.rst:1806 msgid "" ":ref:`Type parameters ` can exist on classes, functions, and " "type aliases." msgstr "" +"クラス、関数、型エイリアスには :ref:`型パラメーター ` を定義でき" +"ます。" -#: ../../library/ast.rst:1811 msgid "" "A :class:`typing.TypeVar`. ``name`` is the name of the type variable. " "``bound`` is the bound or constraints, if any. If ``bound`` is a :class:" @@ -2336,6 +2459,12 @@ msgid "" "``default_value`` is the default value; if the :class:`!TypeVar` has no " "default, this attribute will be set to ``None``." msgstr "" +":class:`typing.TypeVar` を表します。\n" +"``name`` は型変数の名前です。\n" +"``bound`` は、指定されていれば上限または制約を保持します。\n" +":class:`Tuple` なら制約、それ以外なら上限を表します。\n" +"``default_value`` はデフォルト値で、:class:`!TypeVar` にデフォルトがなければ " +"``None`` になります。" #: ../../library/ast.rst:1817 msgid "" @@ -2356,17 +2485,18 @@ msgid "" " ctx=Load()))])" msgstr "" -#: ../../library/ast.rst:1836 ../../library/ast.rst:1871 -#: ../../library/ast.rst:1903 msgid "Added the *default_value* parameter." -msgstr "" +msgstr "*default_value* パラメーターが追加されました。" -#: ../../library/ast.rst:1841 msgid "" "A :class:`typing.ParamSpec`. ``name`` is the name of the parameter " "specification. ``default_value`` is the default value; if the :class:`!" "ParamSpec` has no default, this attribute will be set to ``None``." msgstr "" +":class:`typing.ParamSpec` を表します。\n" +"``name`` はパラメーター仕様の名前です。\n" +"``default_value`` はデフォルト値で、:class:`!ParamSpec` にデフォルトがなけれ" +"ば ``None`` になります。" #: ../../library/ast.rst:1845 msgid "" @@ -2394,12 +2524,15 @@ msgid "" " ctx=Load()))])" msgstr "" -#: ../../library/ast.rst:1876 msgid "" "A :class:`typing.TypeVarTuple`. ``name`` is the name of the type variable " "tuple. ``default_value`` is the default value; if the :class:`!TypeVarTuple` " "has no default, this attribute will be set to ``None``." msgstr "" +":class:`typing.TypeVarTuple` を表します。\n" +"``name`` は型変数タプルの名前です。\n" +"``default_value`` はデフォルト値で、:class:`!TypeVarTuple` にデフォルトがなけ" +"れば ``None`` になります。" #: ../../library/ast.rst:1880 msgid "" @@ -2457,14 +2590,12 @@ msgstr "" msgid "``returns`` is the return annotation." msgstr "``returns`` は戻り値に対する注釈です。" -#: ../../library/ast.rst:1919 ../../library/ast.rst:2082 msgid "``type_params`` is a list of :ref:`type parameters `." msgstr "" +"``type_params`` は :ref:`型パラメーター ` のリストです。" -#: ../../library/ast.rst:1925 ../../library/ast.rst:2109 -#: ../../library/ast.rst:2120 msgid "Added ``type_params``." -msgstr "" +msgstr "``type_params`` が追加されました。" #: ../../library/ast.rst:1931 msgid "" @@ -2474,7 +2605,6 @@ msgstr "" "``lambda`` は式の中で使うことができる最小限の関数定義です。 :class:" "`FunctionDef` ノードと異なり、 ``body`` は単一のノードとなります。" -#: ../../library/ast.rst:1934 msgid "" ">>> print(ast.dump(ast.parse('lambda x,y: ...'), indent=4))\n" "Module(\n" @@ -2487,6 +2617,16 @@ msgid "" " arg(arg='y')]),\n" " body=Constant(value=Ellipsis)))])" msgstr "" +">>> print(ast.dump(ast.parse('lambda x,y: ...'), indent=4))\n" +"Module(\n" +" body=[\n" +" Expr(\n" +" value=Lambda(\n" +" args=arguments(\n" +" args=[\n" +" arg(arg='x'),\n" +" arg(arg='y')]),\n" +" body=Constant(value=Ellipsis)))])" #: ../../library/ast.rst:1950 msgid "The arguments for a function." @@ -2525,11 +2665,13 @@ msgstr "" "です。デフォルト値の数nが位置引数の数より少ない場合、それらは最後のn個の引数" "に割り当てられます。" -#: ../../library/ast.rst:1964 msgid "" "A single argument in a list. ``arg`` is a raw string of the argument name; " "``annotation`` is its annotation, such as a :class:`Name` node." msgstr "" +"引数リスト内の一つの引数を表します。\n" +"``arg`` は引数名の文字列で、``annotation`` は :class:`Name` ノードなどで表す" +"アノテーションです。" #: ../../library/ast.rst:1969 msgid "" @@ -2581,7 +2723,6 @@ msgstr "" msgid "A ``return`` statement." msgstr "``return`` 文です。" -#: ../../library/ast.rst:2013 msgid "" ">>> print(ast.dump(ast.parse('return 4'), indent=4))\n" "Module(\n" @@ -2589,13 +2730,20 @@ msgid "" " Return(\n" " value=Constant(value=4))])" msgstr "" +">>> print(ast.dump(ast.parse('return 4'), indent=4))\n" +"Module(\n" +" body=[\n" +" Return(\n" +" value=Constant(value=4))])" -#: ../../library/ast.rst:2025 msgid "" "A ``yield`` or ``yield from`` expression. Because these are expressions, " "they must be wrapped in an :class:`Expr` node if the value sent back is not " "used." msgstr "" +"``yield`` 式または ``yield from`` 式です。\n" +"これらは式なので、返されてきた値を使わない場合は :class:`Expr` ノードで囲む必" +"要があります。" #: ../../library/ast.rst:2028 msgid "" @@ -2620,7 +2768,6 @@ msgid "" msgstr "" "``global`` および ``nonlocal`` 文です。 ``names`` は生の文字列のリストです。" -#: ../../library/ast.rst:2050 msgid "" ">>> print(ast.dump(ast.parse('global x,y,z'), indent=4))\n" "Module(\n" @@ -2640,6 +2787,23 @@ msgid "" " 'y',\n" " 'z'])])" msgstr "" +">>> print(ast.dump(ast.parse('global x,y,z'), indent=4))\n" +"Module(\n" +" body=[\n" +" Global(\n" +" names=[\n" +" 'x',\n" +" 'y',\n" +" 'z'])])\n" +"\n" +">>> print(ast.dump(ast.parse('nonlocal x,y,z'), indent=4))\n" +"Module(\n" +" body=[\n" +" Nonlocal(\n" +" names=[\n" +" 'x',\n" +" 'y',\n" +" 'z'])])" #: ../../library/ast.rst:2073 msgid "A class definition." @@ -2653,12 +2817,14 @@ msgstr "``name`` はクラス名をあらわす生の文字列です。" msgid "``bases`` is a list of nodes for explicitly specified base classes." msgstr "``bases`` は明示的に指定された基底クラスをあらわすノードのリストです。" -#: ../../library/ast.rst:2077 msgid "" "``keywords`` is a list of :class:`.keyword` nodes, principally for " "'metaclass'. Other keywords will be passed to the metaclass, as per :pep:" "`3115`." msgstr "" +"``keywords`` は :class:`.keyword` ノードのリストで、主に 'metaclass' の指定に" +"使います。\n" +"それ以外のキーワードは :pep:`3115` に従ってメタクラスに渡されます。" #: ../../library/ast.rst:2079 msgid "" @@ -2746,7 +2912,6 @@ msgstr "" "class:`For` および :class:`With` と同じフィールドを持ちます。 :class:" "`AsyncFunctionDef` の本体 (body) の中でのみ有効です。" -#: ../../library/ast.rst:2155 msgid "" "When a string is parsed by :func:`ast.parse`, operator nodes (subclasses of :" "class:`ast.operator`, :class:`ast.unaryop`, :class:`ast.cmpop`, :class:`ast." @@ -2754,6 +2919,11 @@ msgid "" "singletons. Changes to one will be reflected in all other occurrences of the " "same value (for example, :class:`ast.Add`)." msgstr "" +":func:`ast.parse` で文字列を解析すると、返される木の演算子ノード (:class:" +"`ast.operator`、:class:`ast.unaryop`、:class:`ast.cmpop`、:class:`ast." +"boolop`、:class:`ast.expr_context` のサブクラス) はシングルトンになります。\n" +"一つを変更すると、同じ値 (例えば :class:`ast.Add`) を持つ他のすべての箇所にも" +"反映されます。" #: ../../library/ast.rst:2163 msgid ":mod:`ast` helpers" @@ -2775,7 +2945,6 @@ msgid "" "PyCF_OPTIMIZED_AST`` otherwise." msgstr "" -#: ../../library/ast.rst:2175 msgid "" "If ``type_comments=True`` is given, the parser is modified to check and " "return type comments as specified by :pep:`484` and :pep:`526`. This is " @@ -2787,6 +2956,16 @@ msgid "" "the ``type_ignores`` attribute of :class:`Module` (otherwise it is always an " "empty list)." msgstr "" +"``type_comments=True`` を指定すると、パーサーは :pep:`484` と :pep:`526` で定" +"義された型コメントを検査して返すようになります。\n" +"これは :func:`compile` に渡すフラグに :data:`ast.PyCF_TYPE_COMMENTS` を追加す" +"るのと同じです。\n" +"不適切な位置に型コメントがあると構文エラーを報告します。\n" +"このフラグがなければ型コメントは無視され、対応する AST ノードの " +"``type_comment`` フィールドは常に ``None`` になります。\n" +"また、``# type: ignore`` コメントの位置は :class:`Module` の " +"``type_ignores`` 属性として返されます (このフラグがなければ常に空リストで" +"す)。" #: ../../library/ast.rst:2185 msgid "" @@ -2798,7 +2977,6 @@ msgstr "" "-> List[str]`` のような :pep:`484` の \"シグネチャ型コメント (signature type " "comments)\" に対応するように修正されます。" -#: ../../library/ast.rst:2189 msgid "" "Setting ``feature_version`` to a tuple ``(major, minor)`` will result in a " "\"best-effort\" attempt to parse using that Python version's grammar. For " @@ -2810,13 +2988,22 @@ msgid "" "is the same as when run on the Python version corresponding to " "``feature_version``." msgstr "" +"``feature_version`` にタプル ``(major, minor)`` を指定すると、できる限りその " +"Python バージョンの文法を使って解析します。\n" +"例えば ``feature_version=(3, 9)`` なら、:keyword:`match` 文を受け付けないよう" +"にします。\n" +"現在、``major`` は ``3`` でなければなりません。\n" +"サポートする最も古いバージョンは ``(3, 7)`` (将来の Python では引き上げられる" +"可能性があります)、最も新しいバージョンは ``sys.version_info[0:2]`` です。\n" +"あくまで可能な限り合わせるものであり、解析結果や解析の成否が " +"``feature_version`` に対応する Python で実行した場合と同じになる保証はありま" +"せん。" #: ../../library/ast.rst:2199 msgid "" "If source contains a null character (``\\0``), :exc:`ValueError` is raised." msgstr "" -#: ../../library/ast.rst:2202 msgid "" "Note that successfully parsing source code into an AST object doesn't " "guarantee that the source code provided is valid Python code that can be " @@ -2825,12 +3012,20 @@ msgid "" "node for a return statement, but it cannot be compiled alone (it needs to be " "inside a function node)." msgstr "" +"ソースコードを AST オブジェクトに解析できても、実行可能な正しい Python コード" +"であるとは限りません。\n" +"コンパイルの段階で、さらに :exc:`SyntaxError` が送出される可能性がありま" +"す。\n" +"例えば、``return 42`` というソースからは有効な return 文の AST ノードが生成さ" +"れますが、単独ではコンパイルできません (関数ノードの内部に置く必要がありま" +"す)。" -#: ../../library/ast.rst:2209 msgid "" "In particular, :func:`ast.parse` won't do any scoping checks, which the " "compilation step does." msgstr "" +"特に、:func:`ast.parse` はスコープの検査を行いません。\n" +"これはコンパイルの段階で行われます。" #: ../../library/ast.rst:2213 msgid "" @@ -2847,11 +3042,13 @@ msgstr "" "``type_comments``、``mode='func_type'``、``feature_version`` が追加されまし" "た。" -#: ../../library/ast.rst:2220 msgid "" "The minimum supported version for ``feature_version`` is now ``(3, 7)``. The " "``optimize`` argument was added." msgstr "" +"``feature_version`` でサポートする最も古いバージョンが ``(3, 7)`` になりまし" +"た。\n" +"``optimize`` 引数が追加されました。" #: ../../library/ast.rst:2227 msgid "" @@ -2862,15 +3059,14 @@ msgstr "" ":class:`ast.AST` オブジェクトを逆に構文解析して、 :func:`ast.parse` が元の :" "class:`ast.AST` と等価なオブジェクトを生成できるような文字列を生成します。" -#: ../../library/ast.rst:2232 msgid "" "The produced code string will not necessarily be equal to the original code " "that generated the :class:`ast.AST` object (without any compiler " "optimizations, such as constant tuples/frozensets)." msgstr "" -"生成されたコード文字列は、生成元のコードである :class:`ast.AST` オブジェクト" -"と必ずしも等価であるとは限りません (定数タプルや frozenset などに対するコンパ" -"イラ最適化なしのコードです)。" +":class:`ast.AST` オブジェクトの生成元となったコードと、生成されたコード文字列" +"が一致するとは限りません (定数タプルや frozenset などに対するコンパイラ最適化" +"を行わない場合でも同様です)。" #: ../../library/ast.rst:2237 msgid "" @@ -2891,17 +3087,16 @@ msgstr "" "ます: 文字列、バイト列、数、タプル、リスト、辞書、集合、ブール値、``None``、" "``Ellipsis``。" -#: ../../library/ast.rst:2250 msgid "" "This can be used for evaluating strings containing Python values without the " "need to parse the values oneself. It is not capable of evaluating " "arbitrarily complex expressions, for example involving operators or indexing." msgstr "" -"この関数は Python の式を含んだ文字列を、値自身を解析することなしに評価するの" -"に使えます。この関数は、例えば演算や添え字を含んだ任意の複雑な表現を評価する" -"のには使えません。" +"この関数を使うと、Python の値を含む文字列を、自分で解析する処理を書かずに評価" +"できます。\n" +"演算子やインデックス参照を含む式など、任意の複雑な式を評価することはできませ" +"ん。" -#: ../../library/ast.rst:2255 msgid "" "This function had been documented as \"safe\" in the past without defining " "what that meant. That was misleading. This is specifically designed not to " @@ -2912,6 +3107,17 @@ msgid "" "excessive CPU consumption denial of service on some inputs. Calling it on " "untrusted data is thus not recommended." msgstr "" +"この関数は以前、意味を明確にしないまま「安全」と説明されていましたが、これは" +"誤解を招く表現でした。\n" +"より汎用的な :func:`eval` とは異なり、Python コードを実行しないように設計され" +"ています。\n" +"名前空間や名前の検索はなく、関数などを呼び出すこともできません。\n" +"しかし、攻撃を受けないわけではありません。\n" +"比較的小さな入力でも、メモリや C スタックを使い果たし、プロセスをクラッシュさ" +"せる可能性があります。\n" +"入力によっては、過剰な CPU 使用によるサービス拒否を引き起こす可能性もありま" +"す。\n" +"そのため、信頼できないデータに対して呼び出すことは推奨しません。" #: ../../library/ast.rst:2265 msgid "" @@ -2921,11 +3127,13 @@ msgstr "" "Python の抽象構文木コンパイラのスタックの深さの限界を越えることで、 Python イ" "ンタプリタをクラッシュさせる可能性があります。" -#: ../../library/ast.rst:2268 msgid "" "It can raise :exc:`ValueError`, :exc:`TypeError`, :exc:`SyntaxError`, :exc:" "`MemoryError` and :exc:`RecursionError` depending on the malformed input." msgstr "" +"不正な入力の内容によっては、:exc:`ValueError`、:exc:`TypeError`、:exc:" +"`SyntaxError`、:exc:`MemoryError`、:exc:`RecursionError` を送出することがあり" +"ます。" #: ../../library/ast.rst:2272 msgid "Now allows bytes and set literals." @@ -2935,9 +3143,8 @@ msgstr "バイト列リテラルと集合リテラルが受け取れるように msgid "Now supports creating empty sets with ``'set()'``." msgstr "``'set()'`` による空の集合の生成をサポートするようになりました。" -#: ../../library/ast.rst:2278 msgid "For string inputs, leading spaces and tabs are now stripped." -msgstr "" +msgstr "文字列の入力では、先頭のスペースとタブを取り除くようになりました。" #: ../../library/ast.rst:2284 msgid "" @@ -2956,13 +3163,16 @@ msgstr "" msgid ":class:`AsyncFunctionDef` is now supported." msgstr ":class:`AsyncFunctionDef` がサポートされました。" -#: ../../library/ast.rst:2296 msgid "" "Get source code segment of the *source* that generated *node*. If some " "location information (:attr:`~ast.AST.lineno`, :attr:`~ast.AST.end_lineno`, :" "attr:`~ast.AST.col_offset`, or :attr:`~ast.AST.end_col_offset`) is missing, " "return ``None``." msgstr "" +"*source* から、*node* の生成元となったソースコードの部分を取得します。\n" +"位置情報 (:attr:`~ast.AST.lineno`、:attr:`~ast.AST.end_lineno`、:attr:`~ast." +"AST.col_offset`、:attr:`~ast.AST.end_col_offset`) のいずれかが欠けていれば " +"``None`` を返します。" #: ../../library/ast.rst:2300 msgid "" @@ -2972,7 +3182,6 @@ msgstr "" "*padded* が ``True`` の場合、複数行にわたる文の最初の行が元の位置に一致するよ" "うに空白文字でパディングされます。" -#: ../../library/ast.rst:2308 msgid "" "When you compile a node tree with :func:`compile`, the compiler expects :" "attr:`~ast.AST.lineno` and :attr:`~ast.AST.col_offset` attributes for every " @@ -2981,6 +3190,12 @@ msgid "" "set, by setting them to the values of the parent node. It works recursively " "starting at *node*." msgstr "" +"ノードの木を :func:`compile` でコンパイルする際、コンパイラは、対応するすべて" +"のノードに :attr:`~ast.AST.lineno` と :attr:`~ast.AST.col_offset` 属性がある" +"ことを前提とします。\n" +"生成したノードにこれらを手作業で設定するのは煩雑なので、この補助関数は、まだ" +"設定されていない属性に親ノードの値を再帰的に設定します。\n" +"処理は *node* から始まります。" #: ../../library/ast.rst:2317 msgid "" @@ -2991,12 +3206,14 @@ msgstr "" "*node* で始まるツリー内の各ノードの行番号と終了行番号を *n* ずつ増やします。" "これはファイルの中で別の場所に \"コードを移動する\" ときに便利です。" -#: ../../library/ast.rst:2324 msgid "" "Copy source location (:attr:`~ast.AST.lineno`, :attr:`~ast.AST.col_offset`, :" "attr:`~ast.AST.end_lineno`, and :attr:`~ast.AST.end_col_offset`) from " "*old_node* to *new_node* if possible, and return *new_node*." msgstr "" +"可能であれば、*old_node* のソース上の位置 (:attr:`~ast.AST.lineno`、:attr:" +"`~ast.AST.col_offset`、:attr:`~ast.AST.end_lineno`、:attr:`~ast.AST." +"end_col_offset`) を *new_node* にコピーし、*new_node* を返します。" #: ../../library/ast.rst:2331 msgid "" @@ -3066,9 +3283,8 @@ msgstr "" "ビジターが :meth:`generic_visit` を呼び出すかそれ自身で子ノードを訪れない限り" "訪れられないということです。" -#: ../../library/ast.rst:2373 msgid "Handles all constant nodes." -msgstr "" +msgstr "すべての定数ノードを処理します。" #: ../../library/ast.rst:2375 msgid "" @@ -3130,43 +3346,46 @@ msgid "" " )" msgstr "" -#: ../../library/ast.rst:2410 msgid "" "Keep in mind that if the node you're operating on has child nodes you must " "either transform the child nodes yourself or call the :meth:`~ast." "NodeVisitor.generic_visit` method for the node first." msgstr "" +"処理するノードに子ノードがある場合は、子ノードを自分で変換するか、先にその" +"ノードに対して :meth:`~ast.NodeVisitor.generic_visit` メソッドを呼び出す必要" +"があります。" -#: ../../library/ast.rst:2414 msgid "" "For nodes that were part of a collection of statements (that applies to all " "statement nodes), the visitor may also return a list of nodes rather than " "just a single node." msgstr "" -"文のコレクションであるようなノード (全ての文のノードが当てはまります) に対し" -"て、このビジターは単独のノードではなくノードのリストを返すかもしれません。" +"文のコレクションの要素であるノード (すべての文ノードが該当します) に対して" +"は、ビジターは単一のノードの代わりにノードのリストを返すこともできます。" -#: ../../library/ast.rst:2418 msgid "" "If :class:`NodeTransformer` introduces new nodes (that weren't part of " "original tree) without giving them location information (such as :attr:`~ast." "AST.lineno`), :func:`fix_missing_locations` should be called with the new " "sub-tree to recalculate the location information::" msgstr "" +":class:`NodeTransformer` で元の木にない新しいノードを追加し、:attr:`~ast.AST." +"lineno` などの位置情報を設定していない場合は、新しい部分木に対して :func:" +"`fix_missing_locations` を呼び出し、位置情報を補ってください。 ::" -#: ../../library/ast.rst:2423 msgid "" "tree = ast.parse('foo', mode='eval')\n" "new_tree = fix_missing_locations(RewriteName().visit(tree))" msgstr "" +"tree = ast.parse('foo', mode='eval')\n" +"new_tree = fix_missing_locations(RewriteName().visit(tree))" #: ../../library/ast.rst:2426 msgid "Usually you use the transformer like this::" msgstr "たいてい、変換器の使い方は次のようになります::" -#: ../../library/ast.rst:2428 msgid "node = YourTransformer().visit(node)" -msgstr "" +msgstr "node = YourTransformer().visit(node)" #: ../../library/ast.rst:2433 msgid "" @@ -3211,9 +3430,8 @@ msgstr "" msgid "Added the *indent* option." msgstr "*indent* オプションを追加しました。" -#: ../../library/ast.rst:2454 msgid "Added the *show_empty* option." -msgstr "" +msgstr "*show_empty* オプションが追加されました。" #: ../../library/ast.rst:2457 msgid "" @@ -3243,9 +3461,8 @@ msgid "" " type_ignores=[])" msgstr "" -#: ../../library/ast.rst:2488 msgid "Compiler flags" -msgstr "" +msgstr "コンパイラのフラグ" #: ../../library/ast.rst:2490 msgid "" @@ -3270,11 +3487,12 @@ msgid "" msgstr "" "コンパイルされたコードオブジェクトの代わりに抽象構文木を生成して返します。" -#: ../../library/ast.rst:2507 msgid "" "The returned AST is optimized according to the *optimize* argument in :func:" "`compile` or :func:`ast.parse`." msgstr "" +"返される AST は、:func:`compile` または :func:`ast.parse` の *optimize* 引数" +"に従って最適化されます。" #: ../../library/ast.rst:2514 msgid "" @@ -3284,11 +3502,9 @@ msgstr "" ":pep:`484` および :pep:`526` 形式の型コメント (``# type: ``, ``# type: " "ignore ``) のサポートを有効化します。" -#: ../../library/ast.rst:2522 msgid "Recursively compares two ASTs." -msgstr "" +msgstr "二つの AST を再帰的に比較します。" -#: ../../library/ast.rst:2524 msgid "" "*compare_attributes* affects whether AST attributes are considered in the " "comparison. If *compare_attributes* is ``False`` (default), then attributes " @@ -3296,6 +3512,12 @@ msgid "" "check whether the ASTs are structurally equal but differ in whitespace or " "similar details. Attributes include line numbers and column offsets." msgstr "" +"*compare_attributes* は、比較に AST の属性を含めるかどうかを指定します。\n" +"``False`` (デフォルト) の場合は属性を無視し、それ以外の場合はすべての属性が等" +"しい必要があります。\n" +"このオプションは、空白などの細部が異なっていても AST の構造が等しいかどうかを" +"調べる際に便利です。\n" +"属性には行番号や列オフセットが含まれます。" #: ../../library/ast.rst:2537 msgid "Command-line usage" @@ -3309,9 +3531,8 @@ msgstr "" ":mod:`ast` モジュールはコマンドラインからスクリプトとして実行することができま" "す。実行方法は単純です:" -#: ../../library/ast.rst:2544 msgid "python -m ast [-m ] [-a] [infile]" -msgstr "" +msgstr "python -m ast [-m ] [-a] [infile]" #: ../../library/ast.rst:2548 msgid "The following options are accepted:" @@ -3341,15 +3562,17 @@ msgstr "行番号や列オフセットなどの属性を含めます。" msgid "Indentation of nodes in AST (number of spaces)." msgstr "AST におけるノードのインデント (空白の数) です。" -#: ../../library/ast.rst:2577 msgid "" "Python version in the format 3.x (for example, 3.10). Defaults to the " "current version of the interpreter." msgstr "" +"3.x 形式の Python バージョン (例: 3.10)。\n" +"デフォルトは現在のインタープリタのバージョンです。" -#: ../../library/ast.rst:2585 msgid "Optimization level for parser. Defaults to no optimization." msgstr "" +"パーサーの最適化レベル。\n" +"デフォルトでは最適化しません。" #: ../../library/ast.rst:2591 msgid "" @@ -3373,7 +3596,6 @@ msgstr "" "外部ドキュメント `Green Tree Snakes `_ には Python AST についての詳細が書かれています。" -#: ../../library/ast.rst:2606 msgid "" "`ASTTokens `_ " "annotates Python ASTs with the positions of tokens and text in the source " @@ -3382,14 +3604,16 @@ msgid "" msgstr "" "`ASTTokens `_ は " "Python AST を、生成元のソースコードのトークン位置やテキストで注解します。これ" -"はソースコード変換を行うツールで有用です。 " +"はソースコード変換を行うツールで有用です。" -#: ../../library/ast.rst:2611 msgid "" "`leoAst.py `_ unifies the token-based and parse-tree-based views of python programs " "by inserting two-way links between tokens and ast nodes." msgstr "" +"`leoAst.py `_ は、トークンと AST ノードの間に双方向のリンクを挿入することで、Python " +"プログラムのトークンに基づく表現と構文木に基づく表現を結び付けます。" #: ../../library/ast.rst:2616 msgid "" @@ -3402,21 +3626,23 @@ msgstr "" "は自動リファクタリングアプリケーション (codemod) やリンタを作成する際に有用で" "す。" -#: ../../library/ast.rst:2621 msgid "" "`Parso `_ is a Python parser that supports " "error recovery and round-trip parsing for different Python versions (in " "multiple Python versions). Parso is also able to list multiple syntax errors " "in your Python file." msgstr "" +"`Parso `_ は、エラーからの回復と、ソースコード" +"を解析して元に戻す処理をサポートする Python パーサーです。\n" +"複数の Python バージョン上で動作し、異なるバージョンの構文を扱えます。\n" +"Python ファイル内の複数の構文エラーを列挙することもできます。" #: ../../library/ast.rst:59 msgid "? (question mark)" msgstr "? (クエスチョンマーク)" -#: ../../library/ast.rst:59 ../../library/ast.rst:60 msgid "in AST grammar" -msgstr "" +msgstr "AST の文法内" #: ../../library/ast.rst:60 msgid "* (asterisk)" diff --git a/library/asynchat.po b/library/asynchat.po index 23cc950dd..7c9cc6754 100644 --- a/library/asynchat.po +++ b/library/asynchat.po @@ -12,29 +12,32 @@ msgstr "" "PO-Revision-Date: 2024-11-19 01:02+0000\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" -#: ../../library/asynchat.rst:2 msgid ":mod:`!asynchat` --- Asynchronous socket command/response handler" -msgstr "" +msgstr ":mod:`!asynchat` --- 非同期ソケットのコマンド・応答ハンドラー" -#: ../../library/asynchat.rst:10 msgid "" "This module is no longer part of the Python standard library. It was :ref:" "`removed in Python 3.12 ` after being deprecated in " "Python 3.6. The removal was decided in :pep:`594`." msgstr "" +"このモジュールは Python 標準ライブラリから削除されました。\n" +"Python 3.6 で非推奨となり、:ref:`Python 3.12 で削除 ` さ" +"れました。\n" +"削除は :pep:`594` で決定されました。" -#: ../../library/asynchat.rst:14 msgid "Applications should use the :mod:`asyncio` module instead." msgstr "" +"アプリケーションでは、代わりに :mod:`asyncio` モジュールを使ってください。" -#: ../../library/asynchat.rst:16 msgid "" "The last version of Python that provided the :mod:`!asynchat` module was " "`Python 3.11 `_." msgstr "" +":mod:`!asynchat` モジュールが含まれる最後のバージョンは `Python 3.11 " +"`_ です。" diff --git a/library/asyncio-api-index.po b/library/asyncio-api-index.po index 5228ce12b..f82f1e610 100644 --- a/library/asyncio-api-index.po +++ b/library/asyncio-api-index.po @@ -20,33 +20,31 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/asyncio-api-index.rst:6 msgid "High-level API Index" msgstr "高水準の API インデックス" -#: ../../library/asyncio-api-index.rst:8 msgid "This page lists all high-level async/await enabled asyncio APIs." msgstr "" -"このページには、すべての高水準の 非同期/待機 可能な asyncio API が一覧になっ" -"ています。" +"このページには、async/await に対応する asyncio の高水準 API をすべて列挙して" +"います。" #: ../../library/asyncio-api-index.rst:12 msgid "Tasks" msgstr "Task" -#: ../../library/asyncio-api-index.rst:14 msgid "" "Utilities to run asyncio programs, create Tasks, and await on multiple " "things with timeouts." msgstr "" -"ユーティリティは asyncio プログラムを実行し、タスクを作成し、タイムアウトのあ" -"る複数の機能を待っています。" +"asyncio プログラムの実行、タスクの作成、タイムアウト付きで複数の処理の完了を" +"待つためのユーティリティです。" #: ../../library/asyncio-api-index.rst:21 msgid ":func:`run`" @@ -112,9 +110,8 @@ msgstr "イベントループのまだ終了していないすべてのタスク msgid "``await`` :func:`sleep`" msgstr "``await`` :func:`sleep`" -#: ../../library/asyncio-api-index.rst:45 msgid "Sleep for a number of seconds." -msgstr "数秒間スリープします。" +msgstr "指定した秒数だけスリープします。" #: ../../library/asyncio-api-index.rst:47 msgid "``await`` :func:`gather`" diff --git a/library/asyncio-dev.po b/library/asyncio-dev.po index 96a8c8761..85d1cff56 100644 --- a/library/asyncio-dev.po +++ b/library/asyncio-dev.po @@ -18,22 +18,21 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/asyncio-dev.rst:7 msgid "Developing with asyncio" msgstr "asyncio での開発" -#: ../../library/asyncio-dev.rst:9 msgid "" "Asynchronous programming is different from classic \"sequential\" " "programming." msgstr "" -"非同期プログラミングは伝統的な \"同期的\" プログラミングとは異なります。" +"非同期プログラミングは、従来の「逐次的」なプログラミングとは異なります。" #: ../../library/asyncio-dev.rst:12 msgid "" @@ -87,9 +86,8 @@ msgstr "" ":ref:`asyncio ロガー ` のログレベルを :py:const:`logging." "DEBUG` に設定します。例えばアプリケーションの起動時に以下を実行します::" -#: ../../library/asyncio-dev.rst:40 msgid "logging.basicConfig(level=logging.DEBUG)" -msgstr "" +msgstr "logging.basicConfig(level=logging.DEBUG)" #: ../../library/asyncio-dev.rst:42 msgid "" @@ -123,15 +121,14 @@ msgstr "" "I/O セレクタが I/O 処理を実行する時間が長すぎる場合、その実行時間が記録されま" "す。" -#: ../../library/asyncio-dev.rst:56 msgid "" "Callbacks taking longer than 100 milliseconds are logged. The :attr:`loop." "slow_callback_duration` attribute can be used to set the minimum execution " "duration in seconds that is considered \"slow\"." msgstr "" -"実行時間が100ミリ秒を超えるコールバックは記録されます。 \"遅い\" の判断基準と" -"なる実行時間の最小値は :attr:`loop.slow_callback_duration` 属性で設定できま" -"す。" +"実行時間が 100 ミリ秒を超えるコールバックはログに記録されます。\n" +":attr:`loop.slow_callback_duration` 属性で、「遅い」とみなす実行時間の最小値" +"を秒単位で設定できます。" #: ../../library/asyncio-dev.rst:64 msgid "Concurrency and Multithreading" @@ -159,11 +156,9 @@ msgstr "" "別の OS スレッドからのコールバック (:term:`callback`) をスケジュールする場" "合、 :meth:`loop.call_soon_threadsafe` メソッドを使ってください。例:" -#: ../../library/asyncio-dev.rst:75 msgid "loop.call_soon_threadsafe(callback, *args)" -msgstr "" +msgstr "loop.call_soon_threadsafe(callback, *args)" -#: ../../library/asyncio-dev.rst:77 msgid "" "Almost all asyncio objects are not thread safe, which is typically not a " "problem unless there is code that works with them from outside of a Task or " @@ -174,11 +169,10 @@ msgstr "" "バックの外側で非同期オブジェクトを使うコードが存在しない限り、それが問題には" "なることはほとんどありません。もしそのような目的で低レベルの asyncio API を呼" "び出すようなコードを書く必要がある場合、 :meth:`loop.call_soon_threadsafe` メ" -"ソッドを使ってください。例: " +"ソッドを使ってください。例:" -#: ../../library/asyncio-dev.rst:83 msgid "loop.call_soon_threadsafe(fut.cancel)" -msgstr "" +msgstr "loop.call_soon_threadsafe(fut.cancel)" #: ../../library/asyncio-dev.rst:85 msgid "" @@ -187,11 +181,10 @@ msgid "" "`concurrent.futures.Future` to access the result::" msgstr "" "別の OS スレッドからコルーチンオブジェクトをスケジュールする場合は、 :func:" -"`run_coroutine_threadsafe` メソッドを使ってください。 :func:" -"`run_coroutine_threadsafe` は結果にアクセスするための :class:`concurrent." +"`run_coroutine_threadsafe` メソッドを使ってください。 " +"``run_coroutine_threadsafe()`` は結果にアクセスするための :class:`concurrent." "futures.Future` オブジェクトを返します:" -#: ../../library/asyncio-dev.rst:89 msgid "" "async def coro_func():\n" " return await asyncio.sleep(1, 42)\n" @@ -202,6 +195,14 @@ msgid "" "# Wait for the result:\n" "result = future.result()" msgstr "" +"async def coro_func():\n" +" return await asyncio.sleep(1, 42)\n" +"\n" +"# 後で、別の OS スレッド内で実行する:\n" +"\n" +"future = asyncio.run_coroutine_threadsafe(coro_func(), loop)\n" +"# 結果を待つ:\n" +"result = future.result()" #: ../../library/asyncio-dev.rst:98 msgid "To handle signals the event loop must be run in the main thread." @@ -209,13 +210,16 @@ msgstr "" "シグナルの処理を行うには、イベントループはメインスレッド内で実行しなければな" "りません。" -#: ../../library/asyncio-dev.rst:101 msgid "" "The :meth:`loop.run_in_executor` method can be used with a :class:" "`concurrent.futures.ThreadPoolExecutor` or :class:`~concurrent.futures." "InterpreterPoolExecutor` to execute blocking code in a different OS thread " "without blocking the OS thread that the event loop runs in." msgstr "" +":meth:`loop.run_in_executor` メソッドを :class:`concurrent.futures." +"ThreadPoolExecutor` または :class:`~concurrent.futures." +"InterpreterPoolExecutor` と組み合わせると、イベントループの OS スレッドをブ" +"ロックせずに、別の OS スレッドでブロッキングコードを実行できます。" #: ../../library/asyncio-dev.rst:107 msgid "" @@ -243,7 +247,6 @@ msgstr "" msgid "Running Blocking Code" msgstr "ブロッキングコードの実行" -#: ../../library/asyncio-dev.rst:123 msgid "" "Blocking (CPU-bound) code should not be called directly. For example, if a " "function performs a CPU-intensive calculation for 1 second, all concurrent " @@ -251,15 +254,17 @@ msgid "" msgstr "" "ブロッキングコード (CPU バウンドなコード) を直接呼び出すべきではありません。" "たとえば、 CPU 負荷の高い関数を1秒実行したとすると、並行に処理されている全て" -"の非同期タスクと I/O 処理は1秒遅れる可能性があります。 " +"の非同期タスクと I/O 処理は1秒遅れる可能性があります。" -#: ../../library/asyncio-dev.rst:128 msgid "" "An executor can be used to run a task in a different thread, including in a " "different interpreter, or even in a different process to avoid blocking the " "OS thread with the event loop. See the :meth:`loop.run_in_executor` method " "for more details." msgstr "" +"Executor を使うと、別のスレッド (別のインタープリタを含む) や別のプロセスで処" +"理を実行し、イベントループの OS スレッドがブロックされるのを避けられます。\n" +"詳細は :meth:`loop.run_in_executor` メソッドを参照してください。" #: ../../library/asyncio-dev.rst:138 msgid "Logging" @@ -281,9 +286,8 @@ msgstr "" "デフォルトのログレベルは :py:const:`logging.INFO` ですが、これは簡単に調節で" "きます:" -#: ../../library/asyncio-dev.rst:146 msgid "logging.getLogger(\"asyncio\").setLevel(logging.WARNING)" -msgstr "" +msgstr "logging.getLogger(\"asyncio\").setLevel(logging.WARNING)" #: ../../library/asyncio-dev.rst:149 msgid "" @@ -299,18 +303,15 @@ msgstr "" msgid "Detect never-awaited coroutines" msgstr "待ち受け処理を伴わないコルーチンの検出" -#: ../../library/asyncio-dev.rst:159 msgid "" "When a coroutine function is called, but not awaited (e.g. ``coro()`` " "instead of ``await coro()``) or the coroutine is not scheduled with :meth:" "`asyncio.create_task`, asyncio will emit a :exc:`RuntimeWarning`::" msgstr "" -"コルーチンが呼び出されただけで、待ち受け処理がない場合 (たとえば ``await " -"coro()`` のかわりに ``coro()`` と書いてしまった場合) 、またはコルーチンが :" -"meth:`asyncio.create_task` を使わずにスケジュールされた場合、 asyncio は :" -"exc:`RuntimeWarning` 警告を送出します:" +"コルーチン関数を呼び出しただけで、await も :meth:`asyncio.create_task` による" +"スケジュールも行わなかった場合 (例えば ``await coro()`` の代わりに " +"``coro()`` と書いた場合)、asyncio は :exc:`RuntimeWarning` を出します。 ::" -#: ../../library/asyncio-dev.rst:164 msgid "" "import asyncio\n" "\n" @@ -322,22 +323,31 @@ msgid "" "\n" "asyncio.run(main())" msgstr "" +"import asyncio\n" +"\n" +"async def test():\n" +" print(\"never scheduled\")\n" +"\n" +"async def main():\n" +" test()\n" +"\n" +"asyncio.run(main())" #: ../../library/asyncio-dev.rst:174 ../../library/asyncio-dev.rst:219 msgid "Output::" msgstr "出力::" -#: ../../library/asyncio-dev.rst:176 msgid "" "test.py:7: RuntimeWarning: coroutine 'test' was never awaited\n" " test()" msgstr "" +"test.py:7: RuntimeWarning: coroutine 'test' was never awaited\n" +" test()" #: ../../library/asyncio-dev.rst:179 ../../library/asyncio-dev.rst:235 msgid "Output in debug mode::" msgstr "デバッグモードの出力::" -#: ../../library/asyncio-dev.rst:181 msgid "" "test.py:7: RuntimeWarning: coroutine 'test' was never awaited\n" "Coroutine created at (most recent call last)\n" @@ -350,6 +360,16 @@ msgid "" " test()\n" " test()" msgstr "" +"test.py:7: RuntimeWarning: coroutine 'test' was never awaited\n" +"Coroutine created at (most recent call last)\n" +" File \"../t.py\", line 9, in \n" +" asyncio.run(main(), debug=True)\n" +"\n" +" < .. >\n" +"\n" +" File \"../t.py\", line 7, in main\n" +" test()\n" +" test()" #: ../../library/asyncio-dev.rst:192 msgid "" @@ -359,11 +379,12 @@ msgstr "" "通常の修正方法はコルーチンを待ち受ける (await) か、 :meth:`asyncio." "create_task` 関数を呼び出すことです:" -#: ../../library/asyncio-dev.rst:195 msgid "" "async def main():\n" " await test()" msgstr "" +"async def main():\n" +" await test()" #: ../../library/asyncio-dev.rst:200 msgid "Detect never-retrieved exceptions" @@ -385,7 +406,6 @@ msgstr "" msgid "Example of an unhandled exception::" msgstr "処理されない例外の例:" -#: ../../library/asyncio-dev.rst:209 msgid "" "import asyncio\n" "\n" @@ -397,8 +417,16 @@ msgid "" "\n" "asyncio.run(main())" msgstr "" +"import asyncio\n" +"\n" +"async def bug():\n" +" raise Exception(\"not consumed\")\n" +"\n" +"async def main():\n" +" asyncio.create_task(bug())\n" +"\n" +"asyncio.run(main())" -#: ../../library/asyncio-dev.rst:221 msgid "" "Task exception was never retrieved\n" "future: \n" @@ -409,6 +437,14 @@ msgid "" " raise Exception(\"not consumed\")\n" "Exception: not consumed" msgstr "" +"Task exception was never retrieved\n" +"future: \n" +" exception=Exception('not consumed')>\n" +"\n" +"Traceback (most recent call last):\n" +" File \"test.py\", line 4, in bug\n" +" raise Exception(\"not consumed\")\n" +"Exception: not consumed" #: ../../library/asyncio-dev.rst:230 msgid "" @@ -418,11 +454,9 @@ msgstr "" "タスクが生成された箇所を特定するには、 :ref:`デバッグモードを有効化して " "` トレースバックを取得してください:" -#: ../../library/asyncio-dev.rst:233 msgid "asyncio.run(main(), debug=True)" -msgstr "" +msgstr "asyncio.run(main(), debug=True)" -#: ../../library/asyncio-dev.rst:237 msgid "" "Task exception was never retrieved\n" "future: \n" @@ -439,3 +473,17 @@ msgid "" " raise Exception(\"not consumed\")\n" "Exception: not consumed" msgstr "" +"Task exception was never retrieved\n" +"future: \n" +" exception=Exception('not consumed') created at asyncio/tasks.py:321>\n" +"\n" +"source_traceback: Object created at (most recent call last):\n" +" File \"../t.py\", line 9, in \n" +" asyncio.run(main(), debug=True)\n" +"\n" +"< .. >\n" +"\n" +"Traceback (most recent call last):\n" +" File \"../t.py\", line 4, in bug\n" +" raise Exception(\"not consumed\")\n" +"Exception: not consumed" diff --git a/library/asyncio-eventloop.po b/library/asyncio-eventloop.po index e110dc56e..db540e266 100644 --- a/library/asyncio-eventloop.po +++ b/library/asyncio-eventloop.po @@ -20,23 +20,22 @@ msgstr "" "Last-Translator: souma987, 2023\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/asyncio-eventloop.rst:8 msgid "Event Loop" msgstr "イベントループ" -#: ../../library/asyncio-eventloop.rst:10 msgid "" "**Source code:** :source:`Lib/asyncio/events.py`, :source:`Lib/asyncio/" "base_events.py`" msgstr "" -"**ソースコード:** :source:`Lib/asyncio/profile.py` と :source:`Lib/asyncio/" -"pstats.py`" +"**ソースコード:** :source:`Lib/asyncio/events.py`, :source:`Lib/asyncio/" +"base_events.py`" #: ../../library/asyncio-eventloop.rst:16 msgid "Preface" @@ -80,29 +79,29 @@ msgstr "以下の低水準関数はイベントループの取得、設定、生 msgid "Return the running event loop in the current OS thread." msgstr "現在の OS スレッドで実行中のイベントループを取得します。" -#: ../../library/asyncio-eventloop.rst:36 msgid "Raise a :exc:`RuntimeError` if there is no running event loop." -msgstr "" +msgstr "実行中のイベントループがなければ :exc:`RuntimeError` を送出します。" -#: ../../library/asyncio-eventloop.rst:38 msgid "This function can only be called from a coroutine or a callback." -msgstr "" +msgstr "この関数は、コルーチンまたはコールバックからのみ呼び出せます。" #: ../../library/asyncio-eventloop.rst:44 msgid "Get the current event loop." msgstr "現在のイベントループを取得します。" -#: ../../library/asyncio-eventloop.rst:46 msgid "" "When called from a coroutine or a callback (e.g. scheduled with call_soon or " "similar API), this function will always return the running event loop." msgstr "" +"コルーチンまたはコールバック (``call_soon()`` などの API でスケジュールしたも" +"の) から呼び出すと、常に実行中のイベントループを返します。" -#: ../../library/asyncio-eventloop.rst:50 msgid "" "If there is no running event loop set, the function will return the result " "of the ``get_event_loop_policy().get_event_loop()`` call." msgstr "" +"実行中のイベントループがなければ、``get_event_loop_policy()." +"get_event_loop()`` の呼び出し結果を返します。" #: ../../library/asyncio-eventloop.rst:53 msgid "" @@ -114,28 +113,32 @@ msgstr "" "なため、コルーチンやコールバックでは :func:`get_event_loop` よりも :func:" "`get_running_loop` を使うほうが好ましいと考えられます。" -#: ../../library/asyncio-eventloop.rst:58 msgid "" "As noted above, consider using the higher-level :func:`asyncio.run` " "function, instead of using these lower level functions to manually create " "and close an event loop." msgstr "" +"前述のとおり、これらの低水準関数でイベントループを手動で作成・クローズする代" +"わりに、より高水準な :func:`asyncio.run` の使用を検討してください。" -#: ../../library/asyncio-eventloop.rst:62 msgid "Raises a :exc:`RuntimeError` if there is no current event loop." msgstr "" +"現在のイベントループがなければ :exc:`RuntimeError` を送出するようになりまし" +"た。" -#: ../../library/asyncio-eventloop.rst:67 msgid "" "The :mod:`!asyncio` policy system is deprecated and will be removed in " "Python 3.16; from there on, this function will return the current running " "event loop if present else it will return the loop set by :func:" "`set_event_loop`." msgstr "" +":mod:`!asyncio` のポリシーシステムは非推奨で、Python 3.16 で削除されます。\n" +"それ以降、この関数は実行中のイベントループがあればそれを返し、なければ :func:" +"`set_event_loop` で設定したループを返します。" #: ../../library/asyncio-eventloop.rst:74 msgid "Set *loop* as the current event loop for the current OS thread." -msgstr "" +msgstr "*loop* を OS スレッドの現在のイベントループに設定します。" #: ../../library/asyncio-eventloop.rst:78 msgid "Create and return a new event loop object." @@ -166,7 +169,6 @@ msgid "" msgstr "" "`イベントループのメソッド`_ 節は、イベントループ API のリファレンスです。" -#: ../../library/asyncio-eventloop.rst:92 msgid "" "The `Callback Handles`_ section documents the :class:`Handle` and :class:" "`TimerHandle` instances which are returned from scheduling methods such as :" @@ -174,7 +176,7 @@ msgid "" msgstr "" "`コールバックハンドル`_ 節は :meth:`loop.call_soon` や :meth:`loop." "call_later` などのスケジューリングメソッドが返す :class:`Handle` や :class:" -"`TimerHandle` インスタンスについて解説しています。 " +"`TimerHandle` インスタンスについて解説しています。" #: ../../library/asyncio-eventloop.rst:96 msgid "" @@ -209,10 +211,8 @@ msgstr "イベントループは以下の **低水準な** API を持ってい msgid "Running and stopping the loop" msgstr "ループの開始と停止" -#: ../../library/asyncio-eventloop.rst:123 msgid "Run until the *future* (an instance of :class:`Future`) has completed." -msgstr "" -"*フューチャー* (:class:`Future` インスタンス) が完了するまで実行します。" +msgstr "*future* (:class:`Future` のインスタンス) が完了するまで実行します。" #: ../../library/asyncio-eventloop.rst:126 msgid "" @@ -237,6 +237,10 @@ msgid "" "scheduled in response to I/O events (and those that were already scheduled), " "and then exit." msgstr "" +":meth:`run_forever` メソッドが呼ばれるより前に :meth:`stop` メソッドが呼ばれ" +"た場合、イベントループはタイムアウトをゼロにして一度だけ I/O セレクタの問い合" +"わせ処理を行い、 I/O イベントに対してスケジュールされた全てのコールバック (お" +"よび既にスケジュール済みのコールバック) を実行したのち、終了します。" #: ../../library/asyncio-eventloop.rst:140 msgid "" @@ -301,6 +305,12 @@ msgid "" "loop will issue a warning if a new asynchronous generator is iterated. This " "should be used to reliably finalize all scheduled asynchronous generators." msgstr "" +"現在オープンになっているすべての :term:`asynchronous generator` (非同期ジェネ" +"レータ) オブジェクトをスケジュールし、 :meth:`~agen.aclose` メソッドを呼び出" +"すことでそれらをクローズします。 このメソッドの呼び出し後に新しい非同期ジェネ" +"レータがイテレートされると、イベントループは警告を発します。このメソッドはス" +"ケジュールされたすべての非同期ジェネレータの終了処理を確実に行うために使用す" +"べきです。" #: ../../library/asyncio-eventloop.rst:180 msgid "" @@ -314,7 +324,6 @@ msgstr ":func:`asyncio.run` を使った場合はこの関数を呼び出す必 msgid "Example::" msgstr "以下はプログラム例です::" -#: ../../library/asyncio-eventloop.rst:185 msgid "" "try:\n" " loop.run_forever()\n" @@ -322,38 +331,50 @@ msgid "" " loop.run_until_complete(loop.shutdown_asyncgens())\n" " loop.close()" msgstr "" +"try:\n" +" loop.run_forever()\n" +"finally:\n" +" loop.run_until_complete(loop.shutdown_asyncgens())\n" +" loop.close()" -#: ../../library/asyncio-eventloop.rst:196 msgid "" "Schedule the closure of the default executor and wait for it to join all of " "the threads in the :class:`~concurrent.futures.ThreadPoolExecutor`. Once " "this method has been called, using the default executor with :meth:`loop." "run_in_executor` will raise a :exc:`RuntimeError`." msgstr "" +"デフォルトの Executor の終了をスケジュールし、:class:`~concurrent.futures." +"ThreadPoolExecutor` のすべてのスレッドの終了を待ちます。\n" +"このメソッドを呼び出した後で :meth:`loop.run_in_executor` によりデフォルトの " +"Executor を使うと、:exc:`RuntimeError` が送出されます。" -#: ../../library/asyncio-eventloop.rst:202 msgid "" "The *timeout* parameter specifies the amount of time (in :class:`float` " "seconds) the executor will be given to finish joining. With the default, " "``None``, the executor is allowed an unlimited amount of time." msgstr "" +"*timeout* は、Executor のスレッドの終了を待つ制限時間を秒単位の :class:" +"`float` で指定します。\n" +"デフォルトの ``None`` では、待ち時間に制限はありません。" -#: ../../library/asyncio-eventloop.rst:207 msgid "" "If the *timeout* is reached, a :exc:`RuntimeWarning` is emitted and the " "default executor is terminated without waiting for its threads to finish " "joining." msgstr "" +"*timeout* に達すると :exc:`RuntimeWarning` を出し、スレッドの終了を待たずにデ" +"フォルトの Executor の終了処理を行います。" -#: ../../library/asyncio-eventloop.rst:213 msgid "" "Do not call this method when using :func:`asyncio.run`, as the latter " "handles default executor shutdown automatically." msgstr "" +":func:`asyncio.run` はデフォルトの Executor の終了処理を自動的に行うため、こ" +"れを使う場合はこのメソッドを呼び出さないでください。" #: ../../library/asyncio-eventloop.rst:218 msgid "Added the *timeout* parameter." -msgstr "" +msgstr "*timeout* 引数が追加されました。" #: ../../library/asyncio-eventloop.rst:222 msgid "Scheduling callbacks" @@ -372,6 +393,8 @@ msgid "" "Return an instance of :class:`asyncio.Handle`, which can be used later to " "cancel the callback." msgstr "" +":class:`asyncio.Handle` のインスタンスを返します。このインスタンスを使ってス" +"ケジュールしたコールバックをキャンセルすることができます。" #: ../../library/asyncio-eventloop.rst:232 msgid "" @@ -381,30 +404,38 @@ msgstr "" "コールバックは登録された順に呼び出されます。各コールバックは厳密に1回だけ呼び" "出されます。" -#: ../../library/asyncio-eventloop.rst:235 msgid "" "The optional keyword-only *context* argument specifies a custom :class:" "`contextvars.Context` for the *callback* to run in. Callbacks use the " "current context when no *context* is provided." msgstr "" +"省略可能なキーワード専用引数 *context* には、*callback* の実行に使う :class:" +"`contextvars.Context` を指定します。\n" +"*context* を指定しなければ、現在のコンテキストを使います。" -#: ../../library/asyncio-eventloop.rst:239 msgid "Unlike :meth:`call_soon_threadsafe`, this method is not thread-safe." msgstr "" +":meth:`call_soon_threadsafe` とは異なり、このメソッドはスレッドセーフではあり" +"ません。" -#: ../../library/asyncio-eventloop.rst:243 msgid "" "A thread-safe variant of :meth:`call_soon`. When scheduling callbacks from " "another thread, this function *must* be used, since :meth:`call_soon` is not " "thread-safe." msgstr "" +":meth:`call_soon` のスレッドセーフな版です。\n" +":meth:`call_soon` はスレッドセーフではないため、別のスレッドからコールバック" +"をスケジュールする場合は *必ず* この関数を使ってください。" -#: ../../library/asyncio-eventloop.rst:247 msgid "" "This function is safe to be called from a reentrant context or signal " "handler, however, it is not safe or fruitful to use the returned handle in " "such contexts." msgstr "" +"この関数は、再入可能なコンテキストやシグナルハンドラーから安全に呼び出せま" +"す。\n" +"ただし、そのようなコンテキストで返されたハンドルを使うことは、安全でも有用で" +"もありません。" #: ../../library/asyncio-eventloop.rst:250 msgid "" @@ -442,12 +473,14 @@ msgstr "" "をコールバックに渡すことを許していません。キーワード引数を渡すためには :func:" "`functools.partial` を使ってください:" -#: ../../library/asyncio-eventloop.rst:268 msgid "" "# will schedule \"print(\"Hello\", flush=True)\"\n" "loop.call_soon(\n" " functools.partial(print, \"Hello\", flush=True))" msgstr "" +"# print(\"Hello\", flush=True) をスケジュールする\n" +"loop.call_soon(\n" +" functools.partial(print, \"Hello\", flush=True))" #: ../../library/asyncio-eventloop.rst:272 msgid "" @@ -577,7 +610,6 @@ msgid "Create an :class:`asyncio.Future` object attached to the event loop." msgstr "" "イベントループに接続した :class:`asyncio.Future` オブジェクトを生成します。" -#: ../../library/asyncio-eventloop.rst:358 msgid "" "This is the preferred way to create Futures in asyncio. This lets third-" "party event loops provide alternative implementations of the Future object " @@ -585,13 +617,15 @@ msgid "" msgstr "" "asyncio でフューチャーオブジェクトを作成するために推奨される方法です。このメ" "ソッドにより、サードパーティ製のイベントループがFutures クラスの(パフォーマン" -"スや計測方法が優れた) 代替実装を提供することを可能にします。 " +"スや計測方法が優れた) 代替実装を提供することを可能にします。" #: ../../library/asyncio-eventloop.rst:366 msgid "" "Schedule the execution of :ref:`coroutine ` *coro*. Return a :" "class:`Task` object." msgstr "" +":ref:`コルーチン ` *coro* の実行をスケジュールします。 :class:" +"`Task` オブジェクトを返します。" #: ../../library/asyncio-eventloop.rst:369 msgid "" @@ -602,12 +636,15 @@ msgstr "" "サードパーティのイベントループは相互運用のための自身の :class:`Task` のサブク" "ラスを使用できます。この場合、結果は :class:`Task` のサブクラスになります。" -#: ../../library/asyncio-eventloop.rst:373 msgid "" "The full function signature is largely the same as that of the :class:`Task` " "constructor (or factory) - all of the keyword arguments to this function are " "passed through to that interface." msgstr "" +"関数のシグネチャ全体は :class:`Task` のコンストラクター (またはファクトリー) " +"とほぼ同じです。\n" +"この関数に渡したキーワード引数はすべて、そのコンストラクターやファクトリーに" +"渡されます。" #: ../../library/asyncio-eventloop.rst:377 msgid "" @@ -627,13 +664,17 @@ msgstr "" "の :class:`contextvars.Context` を指定できます。*context* が省略された場合、" "現在のコンテキストのコピーが作成されます。" -#: ../../library/asyncio-eventloop.rst:384 msgid "" "An optional keyword-only *eager_start* argument allows specifying if the " "task should execute eagerly during the call to create_task, or be scheduled " "later. If *eager_start* is not passed the mode set by :meth:`loop." "set_task_factory` will be used." msgstr "" +"省略可能なキーワード専用引数 *eager_start* では、``create_task()`` の呼び出し" +"中にタスクの実行を即座に開始するか、後で実行するようにスケジュールするかを指" +"定できます。\n" +"*eager_start* を渡さない場合は :meth:`loop.set_task_factory` で設定したモード" +"を使います。" #: ../../library/asyncio-eventloop.rst:389 msgid "Added the *name* parameter." @@ -643,30 +684,34 @@ msgstr "*name* パラメータを追加しました。" msgid "Added the *context* parameter." msgstr "*context* パラメータを追加しました。" -#: ../../library/asyncio-eventloop.rst:395 msgid "" "Added ``kwargs`` which passes on arbitrary extra parameters, including " "``name`` and ``context``." msgstr "" +"``name`` と ``context`` を含む任意の追加パラメーターを渡す ``kwargs`` が追加" +"されました。" -#: ../../library/asyncio-eventloop.rst:398 msgid "" "Rolled back the change that passes on *name* and *context* (if it is None), " "while still passing on other arbitrary keyword arguments (to avoid breaking " "backwards compatibility with 3.13.3)." msgstr "" +"*name* と、値が ``None`` の場合の *context* を渡す変更を取り消しました。\n" +"それ以外の任意のキーワード引数は、3.13.3 との後方互換性を保つため、引き続き渡" +"されます。" -#: ../../library/asyncio-eventloop.rst:402 msgid "" "All *kwargs* are now passed on. The *eager_start* parameter works with eager " "task factories." msgstr "" +"すべての *kwargs* を渡すようになりました。\n" +"*eager_start* パラメーターは、タスクを即座に実行するファクトリーで機能しま" +"す。" #: ../../library/asyncio-eventloop.rst:407 msgid "Set a task factory that will be used by :meth:`loop.create_task`." msgstr ":meth:`loop.create_task` が使用するタスクファクトリーを設定します。" -#: ../../library/asyncio-eventloop.rst:410 msgid "" "If *factory* is ``None`` the default task factory will be set. Otherwise, " "*factory* must be a *callable* with the signature matching ``(loop, coro, " @@ -674,22 +719,32 @@ msgid "" "*coro* is a coroutine object. The callable must pass on all *kwargs*, and " "return a :class:`asyncio.Task`-compatible object." msgstr "" +"*factory* が ``None`` の場合は、デフォルトのタスクファクトリーを設定しま" +"す。\n" +"それ以外の場合、*factory* はシグネチャが ``(loop, coro, **kwargs)`` に対応す" +"る *呼び出し可能オブジェクト* でなければなりません。\n" +"ここで *loop* は使用するイベントループへの参照、*coro* はコルーチンオブジェク" +"トです。\n" +"この呼び出し可能オブジェクトは、すべての *kwargs* を呼び出し先に渡し、:class:" +"`asyncio.Task` と互換性のあるオブジェクトを返す必要があります。" -#: ../../library/asyncio-eventloop.rst:416 msgid "Required that all *kwargs* are passed on to :class:`asyncio.Task`." msgstr "" +"すべての *kwargs* を :class:`asyncio.Task` に渡すことが必須になりました。" -#: ../../library/asyncio-eventloop.rst:419 msgid "" "*name* is no longer passed to task factories. *context* is no longer passed " "to task factories if it is ``None``." msgstr "" +"*name* をタスクファクトリーに渡さなくなりました。\n" +"*context* も、値が ``None`` の場合は渡さなくなりました。" -#: ../../library/asyncio-eventloop.rst:423 msgid "" "*name* and *context* are now unconditionally passed on to task factories " "again." msgstr "" +"*name* と *context* を、再び無条件にタスクファクトリーに渡すようになりまし" +"た。" #: ../../library/asyncio-eventloop.rst:428 msgid "Return a task factory or ``None`` if the default one is in use." @@ -715,10 +770,13 @@ msgid "" "`~socket.AF_INET6` depending on *host* (or the *family* argument, if " "provided)." msgstr "" +"ソケットファミリーは *host* (または *family* 引数が与えられた場合は " +"*family*) に依存し、 :py:const:`~socket.AF_INET` か :py:const:`~socket." +"AF_INET6` のいずれかを指定します。" #: ../../library/asyncio-eventloop.rst:451 msgid "The socket type will be :py:const:`~socket.SOCK_STREAM`." -msgstr "" +msgstr "ソケットタイプは :py:const:`~socket.SOCK_STREAM` になります。" #: ../../library/asyncio-eventloop.rst:453 #: ../../library/asyncio-eventloop.rst:1246 @@ -816,17 +874,16 @@ msgstr "" "致確認は行われません (これは深刻なセキュリティリスクであり、中間者攻撃を受け" "る可能性があります)。" -#: ../../library/asyncio-eventloop.rst:493 msgid "" "*family*, *proto*, *flags* are the optional address family, protocol and " "flags to be passed through to getaddrinfo() for *host* resolution. If given, " "these should all be integers from the corresponding :mod:`socket` module " "constants." msgstr "" -"*family*, *proto*, *flags* は任意のアドレスファミリであり、*host* 解決のため" -"の getaddrinfo() 経由で渡されるプロトコルおよびフラグになります。このオプショ" -"ンが与えられた場合、これらはすべて :mod:`socket` モジュール定数に従った整数で" -"なければなりません。" +"*family*、*proto*、*flags* は省略可能な引数で、それぞれアドレスファミリー、プ" +"ロトコル、フラグを指定します。\n" +"*host* の名前解決のために ``getaddrinfo()`` に渡されます。\n" +"指定する場合は、:mod:`socket` モジュールの対応する整数定数を使ってください。" #: ../../library/asyncio-eventloop.rst:498 msgid "" @@ -874,14 +931,14 @@ msgstr "" "*port*、 *family*、 *proto*、 *flags*、 *happy_eyeballs_delay*、 " "*interleave* および *local_addr* のいずれも指定してはいけません。" -#: ../../library/asyncio-eventloop.rst:523 -#: ../../library/asyncio-eventloop.rst:639 -#: ../../library/asyncio-eventloop.rst:887 msgid "" "The *sock* argument transfers ownership of the socket to the transport " "created. To close the socket, call the transport's :meth:`~asyncio." "BaseTransport.close` method." msgstr "" +"*sock* 引数を渡すと、ソケットの所有権は作成されたトランスポートに移ります。\n" +"ソケットを閉じるには、トランスポートの :meth:`~asyncio.BaseTransport.close` " +"メソッドを呼び出してください。" #: ../../library/asyncio-eventloop.rst:527 msgid "" @@ -905,17 +962,15 @@ msgstr "" "の) 待ち時間を秒単位で指定します。指定した待ち時間を超えると接続は中断しま" "す。 ``None`` が与えられた場合はデフォルト値 ``60.0`` が使われます。" -#: ../../library/asyncio-eventloop.rst:535 -#: ../../library/asyncio-eventloop.rst:794 -#: ../../library/asyncio-eventloop.rst:898 -#: ../../library/asyncio-eventloop.rst:987 msgid "" "*ssl_shutdown_timeout* is the time in seconds to wait for the SSL shutdown " "to complete before aborting the connection. ``30.0`` seconds if ``None`` " "(default)." msgstr "" +"*ssl_shutdown_timeout* は、接続を中断する前に SSL の終了処理を待つ時間を秒単" +"位で指定します。\n" +"``None`` (デフォルト) の場合は ``30.0`` 秒です。" -#: ../../library/asyncio-eventloop.rst:539 msgid "" "*all_errors* determines what exceptions are raised when a connection cannot " "be created. By default, only a single ``Exception`` is raised: the first " @@ -924,6 +979,12 @@ msgid "" "``True``, an ``ExceptionGroup`` will be raised containing all exceptions " "(even if there is only one)." msgstr "" +"*all_errors* は、接続を確立できなかった場合に送出する例外を指定します。\n" +"デフォルトでは ``Exception`` を一つだけ送出します。\n" +"例外が一つだけの場合や、すべてのエラーメッセージが同じ場合は最初の例外、それ" +"以外の場合はエラーメッセージをまとめた一つの ``OSError`` です。\n" +"``all_errors`` が ``True`` の場合、すべての例外を含む ``ExceptionGroup`` を送" +"出します (例外が一つだけでも同じです)。" #: ../../library/asyncio-eventloop.rst:549 #: ../../library/asyncio-eventloop.rst:806 @@ -936,17 +997,18 @@ msgid "" "The socket option :ref:`socket.TCP_NODELAY ` is set " "by default for all TCP connections." msgstr "" +"全ての TCP 接続に対してデフォルトでソケットオプション :ref:`socket." +"TCP_NODELAY ` が設定されるようになりました。" #: ../../library/asyncio-eventloop.rst:558 #: ../../library/asyncio-eventloop.rst:908 msgid "Added the *ssl_handshake_timeout* parameter." -msgstr "" +msgstr "*ssl_handshake_timeout* 引数が追加されました。" #: ../../library/asyncio-eventloop.rst:562 msgid "Added the *happy_eyeballs_delay* and *interleave* parameters." msgstr "*happy_eyeballs_delay* と *interleave* が追加されました。" -#: ../../library/asyncio-eventloop.rst:564 msgid "" "Happy Eyeballs Algorithm: Success with Dual-Stack Hosts. When a server's " "IPv4 path and protocol are working, but the server's IPv6 path and protocol " @@ -956,10 +1018,20 @@ msgid "" "This document specifies requirements for algorithms that reduce this user-" "visible delay and provides an algorithm." msgstr "" +"Happy Eyeballs アルゴリズム: デュアルスタックホストでの接続を成功させる方" +"法。\n" +"サーバーへの IPv4 の経路とプロトコルが機能していても、IPv6 の経路とプロトコル" +"が機能していないと、デュアルスタックのクライアントアプリケーションでは、IPv4 " +"専用のクライアントに比べて接続が大幅に遅れることがあります。\n" +"デュアルスタックのクライアントで利用者の使い勝手が悪くなるため、これは望まし" +"くありません。\n" +"この文書は、利用者に見えるこの遅延を減らすアルゴリズムの要件を定め、一つのア" +"ルゴリズムを示します。" #: ../../library/asyncio-eventloop.rst:573 msgid "For more information: https://datatracker.ietf.org/doc/html/rfc6555" msgstr "" +"詳しくは右記を参照してください: https://datatracker.ietf.org/doc/html/rfc6555" #: ../../library/asyncio-eventloop.rst:577 #: ../../library/asyncio-eventloop.rst:703 @@ -994,10 +1066,13 @@ msgid "" "`~socket.AF_INET6`, or :py:const:`~socket.AF_UNIX`, depending on *host* (or " "the *family* argument, if provided)." msgstr "" +"ソケットファミリーは *host* (または *family* 引数が与えられた場合は " +"*family*) に依存し、 :py:const:`~socket.AF_INET`、 :py:const:`~socket." +"AF_INET6`、:py:const:`~socket.AF_UNIX` のいずれかを指定します。" #: ../../library/asyncio-eventloop.rst:601 msgid "The socket type will be :py:const:`~socket.SOCK_DGRAM`." -msgstr "" +msgstr "ソケットタイプは :py:const:`~socket.SOCK_DGRAM` になります。" #: ../../library/asyncio-eventloop.rst:603 #: ../../library/asyncio-eventloop.rst:730 @@ -1024,27 +1099,25 @@ msgstr "" "``(local_host, local_port)`` のタプルを指定します。 *local_host* と " "*local_port* は :meth:`getaddrinfo` メソッドを使用して検索されます。" -#: ../../library/asyncio-eventloop.rst:614 msgid "" "*remote_addr*, if given, is a ``(remote_host, remote_port)`` tuple used to " "connect the socket to a remote address. The *remote_host* and *remote_port* " "are looked up using :meth:`getaddrinfo`." msgstr "" -"*remote_addr* が指定される場合、``(remote_host, remote_por)`` のタプルで、ソ" -"ケットをリモートアドレスに束縛するために使用されます。*remote_host* と " -"*remote_port* は :meth:`getaddrinfo` を使用して検索されます。" +"*remote_addr* を指定する場合は、ソケットをリモートアドレスに接続するための " +"``(remote_host, remote_port)`` タプルを渡します。\n" +"*remote_host* と *remote_port* は :meth:`getaddrinfo` を使って検索されます。" -#: ../../library/asyncio-eventloop.rst:618 msgid "" "*family*, *proto*, *flags* are the optional address family, protocol and " "flags to be passed through to :meth:`getaddrinfo` for *host* resolution. If " "given, these should all be integers from the corresponding :mod:`socket` " "module constants." msgstr "" -"*family*, *proto*, *flags* は任意のアドレスファミリです。これらのファミリ、プ" -"ロトコル、フラグは、*host* 解決のため :meth:`getaddrinfo` 経由でオプションで" -"渡されます。これらのオプションを指定する場合、すべて :mod:`socket` モジュール" -"定数に従った整数でなければなりません。" +"*family*、*proto*、*flags* は省略可能な引数で、それぞれアドレスファミリー、プ" +"ロトコル、フラグを指定します。\n" +"*host* の名前解決のために :meth:`getaddrinfo` に渡されます。\n" +"指定する場合は、:mod:`socket` モジュールの対応する整数定数を使ってください。" #: ../../library/asyncio-eventloop.rst:623 msgid "" @@ -1054,6 +1127,12 @@ msgid "" "Unixes. If the :ref:`socket.SO_REUSEPORT ` constant " "is not defined then this capability is unsupported." msgstr "" +"*reuse_port* は、同じポートにバインドされた既存の端点すべてがこのフラグを設定" +"して生成されている場合に限り、この端点を既存の端点と同じポートにバインドする" +"ことを許可するよう、カーネルに指示します(訳註: ソケットのオプション " +"SO_REUSEPORT を使用します)。このオプションは、Windows やいくつかの UNIX シス" +"テムではサポートされていません。:ref:`socket.SO_REUSEPORT ` 定数が定義されていなければ、この機能はサポートされません。" #: ../../library/asyncio-eventloop.rst:629 msgid "" @@ -1089,6 +1168,8 @@ msgid "" "The *family*, *proto*, *flags*, *reuse_address*, *reuse_port*, " "*allow_broadcast*, and *sock* parameters were added." msgstr "" +"*family*, *proto*, *flags*, *reuse_address*, *reuse_port*, " +"*allow_broadcast*, *sock* パラメータが追加されました。" #: ../../library/asyncio-eventloop.rst:650 msgid "Added support for Windows." @@ -1100,6 +1181,10 @@ msgid "" "SO_REUSEADDR ` poses a significant security concern " "for UDP. Explicitly passing ``reuse_address=True`` will raise an exception." msgstr "" +":ref:`socket.SO_REUSEADDR ` の利用が UDP に対して重大" +"なセキュリティ上の懸念をもたらすため、 *reuse_address* パラメータはサポートさ" +"れなくなりました。明示的に ``reuse_address=True`` を設定すると例外を送出しま" +"す。" #: ../../library/asyncio-eventloop.rst:659 msgid "" @@ -1118,12 +1203,17 @@ msgid "" "unix-constants>` is used instead, which specifically prevents processes with " "differing UIDs from assigning sockets to the same socket address." msgstr "" +"サポートされているプラットフォームでは、 *reuse_port* が同様の機能に対する代" +"用品として利用できます。 *reuse_port* は代替機能として :ref:`socket." +"SO_REUSEPORT ` を使っており、複数のプロセスが異なる " +"UID で同一のソケットに対して割り当てられるのを明確に禁止します。" -#: ../../library/asyncio-eventloop.rst:670 msgid "" "The *reuse_address* parameter, disabled since Python 3.8.1, 3.7.6 and " "3.6.10, has been entirely removed." msgstr "" +"Python 3.8.1、3.7.6、3.6.10 以降で無効になっていた *reuse_address* パラメー" +"ターが、完全に削除されました。" #: ../../library/asyncio-eventloop.rst:680 msgid "Create a Unix connection." @@ -1134,6 +1224,8 @@ msgid "" "The socket family will be :py:const:`~socket.AF_UNIX`; socket type will be :" "py:const:`~socket.SOCK_STREAM`." msgstr "" +"ソケットファミリーは :py:const:`~socket.AF_UNIX` になります; また、ソケットタ" +"イプは :py:const:`~socket.SOCK_STREAM` になります。" #: ../../library/asyncio-eventloop.rst:687 msgid "" @@ -1153,29 +1245,26 @@ msgstr "" "このメソッドの引数についての詳細は :meth:`loop.create_connection` メソッドの" "ドキュメントを参照してください。" -#: ../../library/asyncio-eventloop.rst:695 -#: ../../library/asyncio-eventloop.rst:851 -#: ../../library/asyncio-eventloop.rst:1316 -#: ../../library/asyncio-eventloop.rst:1862 -#: ../../library/asyncio-eventloop.rst:1869 msgid "Availability" -msgstr "" +msgstr "利用可能な環境" -#: ../../library/asyncio-eventloop.rst:697 msgid "" "Added the *ssl_handshake_timeout* parameter. The *path* parameter can now be " "a :term:`path-like object`." msgstr "" +"*ssl_handshake_timeout* パラメーターが追加されました。\n" +"*path* パラメーターに :term:`path-like object` を指定できるようになりました。" #: ../../library/asyncio-eventloop.rst:707 msgid "Creating network servers" msgstr "ネットワークサーバの生成" -#: ../../library/asyncio-eventloop.rst:723 msgid "" "Create a TCP server (socket type :const:`~socket.SOCK_STREAM`) listening on " "*port* of the *host* address." msgstr "" +"アドレス *host* のポート *port* で接続を待ち受ける TCP サーバー (ソケットタイ" +"プ :const:`~socket.SOCK_STREAM`) を作成します。" #: ../../library/asyncio-eventloop.rst:726 msgid "Returns a :class:`Server` object." @@ -1218,20 +1307,27 @@ msgstr "" "*host* が空の文字列か ``None`` の場合、すべてのインターフェースが想定され、複" "合的なソケットのリスト (通常は一つが IPv4、もう一つが IPv6) が返されます。" -#: ../../library/asyncio-eventloop.rst:746 msgid "" "The *port* parameter can be set to specify which port the server should " "listen on. If ``0`` or ``None`` (the default), a random unused port will be " "selected (note that if *host* resolves to multiple network interfaces, a " "different random port will be selected for each interface)." msgstr "" +"*port* パラメーターには、サーバーが待ち受けるポートを指定できます。\n" +"``0`` または ``None`` (デフォルト) の場合、未使用のポートがランダムに選ばれま" +"す。\n" +"*host* が複数のネットワークインターフェースに解決される場合は、インターフェー" +"スごとに異なるランダムなポートが選ばれることに注意してください。" -#: ../../library/asyncio-eventloop.rst:751 msgid "" "*family* can be set to either :const:`socket.AF_INET` or :const:`~socket." "AF_INET6` to force the socket to use IPv4 or IPv6. If not set, the *family* " "will be determined from host name (defaults to :const:`~socket.AF_UNSPEC`)." msgstr "" +"*family* に :const:`socket.AF_INET` または :const:`~socket.AF_INET6` を指定す" +"ると、ソケットでそれぞれ IPv4 または IPv6 を使うよう強制できます。\n" +"指定しなければホスト名から決まり、デフォルト値は :const:`~socket.AF_UNSPEC` " +"です。" #: ../../library/asyncio-eventloop.rst:756 msgid "*flags* is a bitmask for :meth:`getaddrinfo`." @@ -1246,11 +1342,13 @@ msgstr "" "*sock* にソケットオブジェクトを設定することができます。指定した場合、 *host* " "と *port* を指定してはいけません。" -#: ../../library/asyncio-eventloop.rst:763 msgid "" "The *sock* argument transfers ownership of the socket to the server created. " "To close the socket, call the server's :meth:`~asyncio.Server.close` method." msgstr "" +"*sock* 引数を渡すと、ソケットの所有権は作成されたサーバーに移ります。\n" +"ソケットを閉じるには、サーバーの :meth:`~asyncio.Server.close` メソッドを呼び" +"出してください。" #: ../../library/asyncio-eventloop.rst:767 msgid "" @@ -1291,15 +1389,15 @@ msgstr "" "SO_REUSEPORT を使用します)。このオプションは、Windows ではサポートされていま" "せん。" -#: ../../library/asyncio-eventloop.rst:783 msgid "" "*keep_alive* set to ``True`` keeps connections active by enabling the " "periodic transmission of messages." msgstr "" +"*keep_alive* を ``True`` にすると、定期的なメッセージ送信を有効にして接続を維" +"持します。" -#: ../../library/asyncio-eventloop.rst:788 msgid "Added the *keep_alive* parameter." -msgstr "" +msgstr "*keep_alive* パラメーターが追加されました。" #: ../../library/asyncio-eventloop.rst:790 msgid "" @@ -1327,12 +1425,14 @@ msgstr "" msgid "The *host* parameter can be a sequence of strings." msgstr "*host* パラメータに文字列のシーケンスを指定できるようになりました。" -#: ../../library/asyncio-eventloop.rst:814 msgid "" "Added *ssl_handshake_timeout* and *start_serving* parameters. The socket " "option :ref:`socket.TCP_NODELAY ` is set by default " "for all TCP connections." msgstr "" +"*ssl_handshake_timeout* と *start_serving* パラメーターが追加されました。\n" +"すべての TCP 接続で、デフォルトでソケットオプション :ref:`socket.TCP_NODELAY " +"` を設定するようになりました。" #: ../../library/asyncio-eventloop.rst:824 msgid "" @@ -1344,11 +1444,12 @@ msgstr "" "`StreamReader` と :class:`StreamWriter` のペアを返し、async/await コードから" "使うことができます。" -#: ../../library/asyncio-eventloop.rst:836 msgid "" "Similar to :meth:`loop.create_server` but works with the :py:const:`~socket." "AF_UNIX` socket family." msgstr "" +":meth:`loop.create_server` と似ていますが、ソケットファミリー :py:const:" +"`~socket.AF_UNIX` を使います。" #: ../../library/asyncio-eventloop.rst:839 msgid "" @@ -1360,12 +1461,14 @@ msgstr "" "須です。 抽象 Unix ソケット、 :class:`str`、 :class:`bytes`、 and :class:" "`~pathlib.Path` 形式でのパスがサポートされています。" -#: ../../library/asyncio-eventloop.rst:844 msgid "" "If *cleanup_socket* is true then the Unix socket will automatically be " "removed from the filesystem when the server is closed, unless the socket has " "been replaced after the server has been created." msgstr "" +"*cleanup_socket* が真の場合、サーバーを閉じると Unix ソケットをファイルシステ" +"ムから自動的に削除します。\n" +"ただし、サーバーを作成した後にソケットが置き換えられていれば削除しません。" #: ../../library/asyncio-eventloop.rst:848 msgid "" @@ -1375,15 +1478,16 @@ msgstr "" "このメソッドの引数についての詳細は :meth:`loop.create_server` メソッドのド" "キュメントを参照してください。" -#: ../../library/asyncio-eventloop.rst:855 msgid "" "Added the *ssl_handshake_timeout* and *start_serving* parameters. The *path* " "parameter can now be a :class:`~pathlib.Path` object." msgstr "" +"*ssl_handshake_timeout* と *start_serving* パラメーターが追加されました。\n" +"*path* パラメーターに :class:`~pathlib.Path` オブジェクトを指定できるようにな" +"りました。" -#: ../../library/asyncio-eventloop.rst:864 msgid "Added the *cleanup_socket* parameter." -msgstr "" +msgstr "*cleanup_socket* パラメーターが追加されました。" #: ../../library/asyncio-eventloop.rst:872 msgid "Wrap an already accepted connection into a transport/protocol pair." @@ -1497,26 +1601,34 @@ msgstr "TLS へのアップグレード" msgid "Upgrade an existing transport-based connection to TLS." msgstr "既存のトランスポートベースの接続を TLS にアップグレードします。" -#: ../../library/asyncio-eventloop.rst:957 msgid "" "Create a TLS coder/decoder instance and insert it between the *transport* " "and the *protocol*. The coder/decoder implements both *transport*-facing " "protocol and *protocol*-facing transport." msgstr "" +"TLS のエンコード・デコードを行うインスタンスを作成し、*transport* と " +"*protocol* の間に挿入します。\n" +"このインスタンスは、*transport* に対するプロトコルと、*protocol* に対するトラ" +"ンスポートの両方のインターフェースを実装します。" -#: ../../library/asyncio-eventloop.rst:961 msgid "" "Return the created two-interface instance. After *await*, the *protocol* " "must stop using the original *transport* and communicate with the returned " "object only because the coder caches *protocol*-side data and sporadically " "exchanges extra TLS session packets with *transport*." msgstr "" +"作成した、二つのインターフェースを持つインスタンスを返します。\n" +"*await* の後、*protocol* は元の *transport* の使用をやめ、返されたオブジェク" +"トだけを使って通信する必要があります。\n" +"エンコーダーが *protocol* 側のデータをキャッシュし、必要に応じて追加の TLS " +"セッションパケットを *transport* と交換するためです。" -#: ../../library/asyncio-eventloop.rst:966 msgid "" "In some situations (e.g. when the passed transport is already closing) this " "may return ``None``." msgstr "" +"渡されたトランスポートがすでに終了処理中である場合など、状況によっては " +"``None`` を返すことがあります。" #: ../../library/asyncio-eventloop.rst:971 msgid "" @@ -1558,18 +1670,19 @@ msgstr "" "ファイル記述子 *fd* に対する読み込みが可能かどうかの監視を開始し、 *fd* が読" "み込み可能になると、指定した引数でコールバック *callback* を呼び出します。" -#: ../../library/asyncio-eventloop.rst:1008 -#: ../../library/asyncio-eventloop.rst:1022 msgid "" "Any preexisting callback registered for *fd* is cancelled and replaced by " "*callback*." msgstr "" +"*fd* にすでに登録されているコールバックがあれば、キャンセルして *callback* に" +"置き換えます。" -#: ../../library/asyncio-eventloop.rst:1013 msgid "" "Stop monitoring the *fd* file descriptor for read availability. Returns " "``True`` if *fd* was previously being monitored for reads." msgstr "" +"ファイル記述子 *fd* が読み込み可能になるのを監視する処理を停止します。\n" +"それまで *fd* の読み込みを監視していた場合は ``True`` を返します。" #: ../../library/asyncio-eventloop.rst:1018 msgid "" @@ -1588,11 +1701,12 @@ msgstr "" "コールバック *callback* に :ref:`キーワード引数を渡す ` 場合は :func:`functools.partial` を使ってください。" -#: ../../library/asyncio-eventloop.rst:1030 msgid "" "Stop monitoring the *fd* file descriptor for write availability. Returns " "``True`` if *fd* was previously being monitored for writes." msgstr "" +"ファイル記述子 *fd* が書き込み可能になるのを監視する処理を停止します。\n" +"それまで *fd* の書き込みを監視していた場合は ``True`` を返します。" #: ../../library/asyncio-eventloop.rst:1033 msgid "" @@ -1644,15 +1758,15 @@ msgstr "受信したデータをバイトオブジェクトとして返します msgid "*sock* must be a non-blocking socket." msgstr "*sock* はノンブロッキングソケットでなければなりません。" -#: ../../library/asyncio-eventloop.rst:1057 msgid "" "Even though this method was always documented as a coroutine method, " "releases before Python 3.7 returned a :class:`Future`. Since Python 3.7 this " "is an ``async def`` method." msgstr "" "このメソッドは常にコルーチンメソッドとしてドキュメントに記載されてきました" -"が、 Python 3.7 以前のリリースでは :class:`Future` オブジェクトを返していまし" -"た。 Python 3.7 からは ``async def`` メソッドになりました。" +"が、 Python 3.7 より前のリリースでは :class:`Future` オブジェクトを返していま" +"した。\n" +"Python 3.7 からは ``async def`` メソッドになりました。" #: ../../library/asyncio-eventloop.rst:1065 msgid "" @@ -1667,25 +1781,25 @@ msgstr "" msgid "Return the number of bytes written to the buffer." msgstr "バッファに書き込んだデータのバイト数を返します。" -#: ../../library/asyncio-eventloop.rst:1077 msgid "" "Receive a datagram of up to *bufsize* from *sock*. Asynchronous version of :" "meth:`socket.recvfrom() `." msgstr "" +"*sock* から最大 *bufsize* バイトのデータグラムを受信します。\n" +":meth:`socket.recvfrom() ` の非同期版です。" -#: ../../library/asyncio-eventloop.rst:1080 msgid "Return a tuple of (received data, remote address)." -msgstr "" +msgstr "(受信したデータ, 送信元アドレス) のタプルを返します。" -#: ../../library/asyncio-eventloop.rst:1089 msgid "" "Receive a datagram of up to *nbytes* from *sock* into *buf*. Asynchronous " "version of :meth:`socket.recvfrom_into() `." msgstr "" +"*sock* から最大 *nbytes* バイトのデータグラムを受信し、*buf* に格納します。\n" +":meth:`socket.recvfrom_into() ` の非同期版です。" -#: ../../library/asyncio-eventloop.rst:1093 msgid "Return a tuple of (number of bytes received, remote address)." -msgstr "" +msgstr "(受信したバイト数, 送信元アドレス) のタプルを返します。" #: ../../library/asyncio-eventloop.rst:1102 msgid "" @@ -1708,26 +1822,25 @@ msgstr "" "場合は例外が送出されます。エラーとなった場合、接続の受信側で正しく処理された" "データの総量を特定する方法はありません。" -#: ../../library/asyncio-eventloop.rst:1113 -#: ../../library/asyncio-eventloop.rst:1167 msgid "" "Even though the method was always documented as a coroutine method, before " "Python 3.7 it returned a :class:`Future`. Since Python 3.7, this is an " "``async def`` method." msgstr "" "このメソッドは常にコルーチンメソッドとしてドキュメントに記載されてきました" -"が、 Python 3.7 以前のリリースでは :class:`Future` オブジェクトを返していまし" -"た。 Python 3.7 からは ``async def`` メソッドになりました。" +"が、 Python 3.7 より前のリリースでは :class:`Future` オブジェクトを返していま" +"した。\n" +"Python 3.7 からは ``async def`` メソッドになりました。" -#: ../../library/asyncio-eventloop.rst:1121 msgid "" "Send a datagram from *sock* to *address*. Asynchronous version of :meth:" "`socket.sendto() `." msgstr "" +"*sock* から *address* にデータグラムを送信します。\n" +":meth:`socket.sendto() ` の非同期版です。" -#: ../../library/asyncio-eventloop.rst:1125 msgid "Return the number of bytes sent." -msgstr "" +msgstr "送信したバイト数を返します。" #: ../../library/asyncio-eventloop.rst:1134 msgid "Connect *sock* to a remote socket at *address*." @@ -1841,7 +1954,6 @@ msgstr ":meth:`socket.getaddrinfo` の非同期版です。" msgid "Asynchronous version of :meth:`socket.getnameinfo`." msgstr ":meth:`socket.getnameinfo` の非同期版です。" -#: ../../library/asyncio-eventloop.rst:1224 msgid "" "Both *getaddrinfo* and *getnameinfo* internally utilize their synchronous " "versions through the loop's default thread pool executor. When this executor " @@ -1850,8 +1962,13 @@ msgid "" "consider using a custom executor for other user tasks, or setting a default " "executor with a larger number of workers." msgstr "" +"*getaddrinfo* と *getnameinfo* は、内部ではループのデフォルトのスレッドプー" +"ル Executor を通じて同期版を呼び出します。\n" +"この Executor に空きがなくなると処理が遅れ、高水準のネットワークライブラリで" +"タイムアウトが増えることがあります。\n" +"これを軽減するには、他のユーザー処理に別の Executor を使うか、ワーカー数の多" +"い Executor をデフォルトに設定することを検討してください。" -#: ../../library/asyncio-eventloop.rst:1231 msgid "" "Both *getaddrinfo* and *getnameinfo* methods were always documented to " "return a coroutine, but prior to Python 3.7 they were, in fact, returning :" @@ -1859,17 +1976,16 @@ msgid "" "coroutines." msgstr "" "*getaddrinfo* と *getnameinfo* の2つのメソッドは、いずれも常にコルーチンメ" -"ソッドとしてドキュメントに記載されてきましたが、 Python 3.7 以前のリリースで" -"は、実際には :class:`asyncio.Future` オブジェクトを返していました。 Python " -"3.7 からはどちらのメソッドもコルーチンになりました。" +"ソッドとしてドキュメントに記載されてきましたが、 Python 3.7 より前のリリース" +"では、実際には :class:`asyncio.Future` オブジェクトを返していました。\n" +"Python 3.7 からはどちらのメソッドもコルーチンになりました。" #: ../../library/asyncio-eventloop.rst:1239 msgid "Working with pipes" msgstr "パイプとやりとりする" -#: ../../library/asyncio-eventloop.rst:1244 msgid "Register the read end of *pipe* in the event loop." -msgstr "イベントループの読み込み側終端に *pipe* を登録します。" +msgstr "*pipe* の読み込み側の終端をイベントループに登録します。" #: ../../library/asyncio-eventloop.rst:1249 msgid "*pipe* is a :term:`file-like object `." @@ -1886,14 +2002,12 @@ msgstr "" "`ReadTransport` のインターフェースをサポートし、 *protocol* は " "*protocol_factory* ファクトリでインスタンス化されたオブジェクトです。" -#: ../../library/asyncio-eventloop.rst:1255 -#: ../../library/asyncio-eventloop.rst:1272 msgid "" "With :class:`SelectorEventLoop` event loop, the *pipe* is set to non-" "blocking mode." msgstr "" -":class:`SelectorEventLoop` イベントループの場合、*pipe* は非ブロックモードに" -"設定されていなければなりません。" +":class:`SelectorEventLoop` イベントループでは、*pipe* が非ブロックモードに設" +"定されます。" #: ../../library/asyncio-eventloop.rst:1261 msgid "Register the write end of *pipe* in the event loop." @@ -1936,17 +2050,16 @@ msgid "Set *callback* as the handler for the *signum* signal." msgstr "" "コールバック *callback* をシグナル *signum* に対するハンドラに設定します。" -#: ../../library/asyncio-eventloop.rst:1295 msgid "" "The callback will be invoked by *loop*, along with other queued callbacks " "and runnable coroutines of that event loop. Unlike signal handlers " "registered using :func:`signal.signal`, a callback registered with this " "function is allowed to interact with the event loop." msgstr "" -"コールバックは *loop*、登録された他のコールバック、およびイベントループの実行" -"可能なコルーチンから呼び出されます。 :func:`signal.signal` を使って登録された" -"シグナルハンドラと異なり、この関数で登録されたコールバックはイベントループと" -"相互作用することが可能です。" +"このコールバックは、キューに入っている他のコールバックや実行可能なコルーチン" +"とともに、イベントループ *loop* によって呼び出されます。\n" +":func:`signal.signal` で登録したシグナルハンドラとは異なり、この関数で登録し" +"たコールバックはイベントループとやりとりできます。" #: ../../library/asyncio-eventloop.rst:1300 msgid "" @@ -1987,7 +2100,6 @@ msgstr "スレッドまたはプロセスプールでコードを実行する" msgid "Arrange for *func* to be called in the specified executor." msgstr "指定したエグゼキュータで関数 *func* が実行されるように準備します。" -#: ../../library/asyncio-eventloop.rst:1330 msgid "" "The *executor* argument should be an :class:`concurrent.futures.Executor` " "instance. The default executor is used if *executor* is ``None``. The " @@ -1995,8 +2107,13 @@ msgid "" "a :class:`concurrent.futures.ThreadPoolExecutor` will be lazy-initialized " "and used by :func:`run_in_executor` if needed." msgstr "" +"*executor* 引数には :class:`concurrent.futures.Executor` のインスタンスを指定" +"します。\n" +"``None`` の場合はデフォルトの Executor を使います。\n" +"デフォルトの Executor は :meth:`loop.set_default_executor` で設定できます。\n" +"設定しなければ、:func:`run_in_executor` が必要になった時点で :class:" +"`concurrent.futures.ThreadPoolExecutor` を初期化して使います。" -#: ../../library/asyncio-eventloop.rst:1338 msgid "" "import asyncio\n" "import concurrent.futures\n" @@ -2044,14 +2161,62 @@ msgid "" "if __name__ == '__main__':\n" " asyncio.run(main())" msgstr "" +"import asyncio\n" +"import concurrent.futures\n" +"\n" +"def blocking_io():\n" +" # ログ記録などのファイル操作はイベントループをブロックする\n" +" # 可能性があるので、スレッドプールで実行する。\n" +" with open('/dev/urandom', 'rb') as f:\n" +" return f.read(100)\n" +"\n" +"def cpu_bound():\n" +" # CPU バウンドな処理はイベントループをブロックする。\n" +" # 通常はプロセスプールで実行する方がよい。\n" +" return sum(i * i for i in range(10 ** 7))\n" +"\n" +"async def main():\n" +" loop = asyncio.get_running_loop()\n" +"\n" +" ## 実行方法:\n" +"\n" +" # 1. ループのデフォルトの Executor で実行する:\n" +" result = await loop.run_in_executor(\n" +" None, blocking_io)\n" +" print('default thread pool', result)\n" +"\n" +" # 2. 自分で作成したスレッドプールで実行する:\n" +" with concurrent.futures.ThreadPoolExecutor() as pool:\n" +" result = await loop.run_in_executor(\n" +" pool, blocking_io)\n" +" print('custom thread pool', result)\n" +"\n" +" # 3. 自分で作成したプロセスプールで実行する:\n" +" with concurrent.futures.ProcessPoolExecutor() as pool:\n" +" result = await loop.run_in_executor(\n" +" pool, cpu_bound)\n" +" print('custom process pool', result)\n" +"\n" +" # 4. 自分で作成したインタープリタプールで実行する:\n" +" with concurrent.futures.InterpreterPoolExecutor() as pool:\n" +" result = await loop.run_in_executor(\n" +" pool, cpu_bound)\n" +" print('custom interpreter pool', result)\n" +"\n" +"if __name__ == '__main__':\n" +" asyncio.run(main())" -#: ../../library/asyncio-eventloop.rst:1384 msgid "" "Note that the entry point guard (``if __name__ == '__main__'``) is required " "for option 3 due to the peculiarities of :mod:`multiprocessing`, which is " "used by :class:`~concurrent.futures.ProcessPoolExecutor`. See :ref:`Safe " "importing of main module `." msgstr "" +"例の 3 番では、:class:`~concurrent.futures.ProcessPoolExecutor` が使う :mod:" +"`multiprocessing` の特性により、エントリーポイントのガード (``if __name__ == " +"'__main__'``) が必要です。\n" +":ref:`メインモジュールの安全なインポート ` " +"を参照してください。" #: ../../library/asyncio-eventloop.rst:1389 msgid "This method returns a :class:`asyncio.Future` object." @@ -2077,19 +2242,24 @@ msgstr "" "`~concurrent.futures.ThreadPoolExecutor`) にデフォルト値を設定させるようにな" "りました。" -#: ../../library/asyncio-eventloop.rst:1403 msgid "" "Set *executor* as the default executor used by :meth:`run_in_executor`. " "*executor* must be an instance of :class:`~concurrent.futures." "ThreadPoolExecutor`, which includes :class:`~concurrent.futures." "InterpreterPoolExecutor`." msgstr "" +"*executor* を、:meth:`run_in_executor` が使うデフォルトの Executor に設定しま" +"す。\n" +"*executor* は :class:`~concurrent.futures.ThreadPoolExecutor` のインスタンス" +"でなければなりません。\n" +"これには :class:`~concurrent.futures.InterpreterPoolExecutor` も含まれます。" -#: ../../library/asyncio-eventloop.rst:1408 msgid "" "*executor* must be an instance of :class:`~concurrent.futures." "ThreadPoolExecutor`." msgstr "" +"*executor* は :class:`~concurrent.futures.ThreadPoolExecutor` のインスタンス" +"でなければならなくなりました。" #: ../../library/asyncio-eventloop.rst:1414 msgid "Error Handling API" @@ -2118,18 +2288,21 @@ msgstr "" "``dict`` オブジェクトです (*context* についての詳細は :meth:" "`call_exception_handler` メソッドのドキュメントを参照してください)。" -#: ../../library/asyncio-eventloop.rst:1430 msgid "" "If the handler is called on behalf of a :class:`~asyncio.Task` or :class:" "`~asyncio.Handle`, it is run in the :class:`contextvars.Context` of that " "task or callback handle." msgstr "" +":class:`~asyncio.Task` または :class:`~asyncio.Handle` のためにハンドラーを呼" +"び出す場合、そのタスクまたはコールバックハンドルの :class:`contextvars." +"Context` で実行します。" -#: ../../library/asyncio-eventloop.rst:1436 msgid "" "The handler may be called in the :class:`~contextvars.Context` of the task " "or handle where the exception originated." msgstr "" +"例外が発生したタスクまたはハンドルの :class:`~contextvars.Context` で、ハンド" +"ラーを呼び出す場合があるようになりました。" #: ../../library/asyncio-eventloop.rst:1441 msgid "" @@ -2183,9 +2356,8 @@ msgstr "'exception' (任意): 例外オブジェクト;" msgid "'future' (optional): :class:`asyncio.Future` instance;" msgstr "'future' (任意): :class:`asyncio.Future` インスタンス;" -#: ../../library/asyncio-eventloop.rst:1467 msgid "'task' (optional): :class:`asyncio.Task` instance;" -msgstr "" +msgstr "'task' (省略可能): :class:`asyncio.Task` のインスタンス" #: ../../library/asyncio-eventloop.rst:1468 msgid "'handle' (optional): :class:`asyncio.Handle` instance;" @@ -2200,17 +2372,14 @@ msgid "'transport' (optional): :ref:`Transport ` instance;" msgstr "" "'transport' (任意): :ref:`トランスポート ` インスタンス;" -#: ../../library/asyncio-eventloop.rst:1471 msgid "'socket' (optional): :class:`socket.socket` instance;" -msgstr "" +msgstr "'socket' (省略可能): :class:`socket.socket` のインスタンス" -#: ../../library/asyncio-eventloop.rst:1472 msgid "'source_traceback' (optional): Traceback of the source;" -msgstr "" +msgstr "'source_traceback' (省略可能): 生成元のトレースバック" -#: ../../library/asyncio-eventloop.rst:1473 msgid "'handle_traceback' (optional): Traceback of the handle;" -msgstr "" +msgstr "'handle_traceback' (省略可能): ハンドルのトレースバック" #: ../../library/asyncio-eventloop.rst:1474 msgid "'asyncgen' (optional): Asynchronous generator that caused" @@ -2220,11 +2389,14 @@ msgstr "" msgid "the exception." msgstr "" -#: ../../library/asyncio-eventloop.rst:1479 msgid "" "This method should not be overloaded in subclassed event loops. For custom " "exception handling, use the :meth:`set_exception_handler` method." msgstr "" +"イベントループのサブクラスで、このメソッドをオーバーライドしないでくださ" +"い。\n" +"例外処理をカスタマイズするには :meth:`set_exception_handler` を使ってくださ" +"い。" #: ../../library/asyncio-eventloop.rst:1484 msgid "Enabling debug mode" @@ -2254,16 +2426,17 @@ msgstr "" "新しい :ref:`Python 開発モード ` を使ってデバッグモードを有効化する" "ことができるようになりました。" -#: ../../library/asyncio-eventloop.rst:1505 msgid "" "This attribute can be used to set the minimum execution duration in seconds " "that is considered \"slow\". When debug mode is enabled, \"slow\" callbacks " "are logged." msgstr "" +"この属性は、「遅い」とみなす実行時間の最小値を秒単位で設定するために使いま" +"す。\n" +"デバッグモードが有効な場合、「遅い」コールバックがログに記録されます。" -#: ../../library/asyncio-eventloop.rst:1509 msgid "Default value is 100 milliseconds." -msgstr "" +msgstr "デフォルト値は 100 ミリ秒です。" #: ../../library/asyncio-eventloop.rst:1513 msgid "The :ref:`debug mode of asyncio `." @@ -2283,12 +2456,15 @@ msgstr "" "高水準の関数である :func:`asyncio.create_subprocess_shell` や :func:`asyncio." "create_subprocess_exec` を代わりに使うことを検討してください。" -#: ../../library/asyncio-eventloop.rst:1526 msgid "" "On Windows, the default event loop :class:`ProactorEventLoop` supports " "subprocesses, whereas :class:`SelectorEventLoop` does not. See :ref:" "`Subprocess Support on Windows ` for details." msgstr "" +"Windows では、デフォルトの :class:`ProactorEventLoop` はサブプロセスをサポー" +"トしますが、:class:`SelectorEventLoop` はサポートしません。\n" +"詳細は :ref:`Windows でのサブプロセスのサポート ` を参照してください。" #: ../../library/asyncio-eventloop.rst:1538 msgid "" @@ -2351,17 +2527,15 @@ msgstr "その他の引数:" msgid "*stdin* can be any of these:" msgstr "*stdin* は下記のいずれかをとることができます:" -#: ../../library/asyncio-eventloop.rst:1564 -#: ../../library/asyncio-eventloop.rst:1575 -#: ../../library/asyncio-eventloop.rst:1585 msgid "a file-like object" -msgstr "" +msgstr "ファイルライクオブジェクト" -#: ../../library/asyncio-eventloop.rst:1565 msgid "" "an existing file descriptor (a positive integer), for example those created " "with :meth:`os.pipe`" msgstr "" +"既存のファイル記述子 (正の整数)。\n" +"例えば :meth:`os.pipe` で作成したもの。" #: ../../library/asyncio-eventloop.rst:1566 #: ../../library/asyncio-eventloop.rst:1576 @@ -2429,13 +2603,16 @@ msgstr "" "していません。ストリームからテキストに変換するには :func:`bytes.decode` 関数" "を使ってください。" -#: ../../library/asyncio-eventloop.rst:1604 msgid "" "If a file-like object passed as *stdin*, *stdout* or *stderr* represents a " "pipe, then the other side of this pipe should be registered with :meth:" "`~loop.connect_write_pipe` or :meth:`~loop.connect_read_pipe` for use with " "the event loop." msgstr "" +"*stdin*、*stdout*、*stderr* として渡したファイルライクオブジェクトがパイプを" +"表す場合、イベントループで使うには、パイプのもう一方の端を :meth:`~loop." +"connect_write_pipe` または :meth:`~loop.connect_read_pipe` で登録してくださ" +"い。" #: ../../library/asyncio-eventloop.rst:1609 msgid "" @@ -2527,10 +2704,11 @@ msgstr "" ":meth:`loop.call_soon` や :meth:`loop.call_soon_threadsafe` が返すコールバッ" "クのラッパーです。" -#: ../../library/asyncio-eventloop.rst:1658 msgid "" "Return the :class:`contextvars.Context` object associated with the handle." msgstr "" +"ハンドルに関連付けられた :class:`contextvars.Context` オブジェクトを返しま" +"す。" #: ../../library/asyncio-eventloop.rst:1665 msgid "" @@ -2582,9 +2760,8 @@ msgstr "" "create_unix_server`、 :func:`start_server` および :func:`start_unix_server` " "関数により生成されます。" -#: ../../library/asyncio-eventloop.rst:1698 msgid "Do not instantiate the :class:`Server` class directly." -msgstr "" +msgstr ":class:`Server` クラスを直接インスタンス化しないでください。" #: ../../library/asyncio-eventloop.rst:1702 msgid "" @@ -2596,7 +2773,6 @@ msgstr "" "の中で使われた場合、 ``async with`` 文が完了した時に Server オブジェクトがク" "ローズされること、およびそれ以降に接続を受け付けないことが保証されます。" -#: ../../library/asyncio-eventloop.rst:1707 msgid "" "srv = await loop.create_server(...)\n" "\n" @@ -2605,6 +2781,12 @@ msgid "" "\n" "# At this point, srv is closed and no longer accepts new connections." msgstr "" +"srv = await loop.create_server(...)\n" +"\n" +"async with srv:\n" +" # 何らかの処理\n" +"\n" +"# この時点で srv は閉じられており、新しい接続を受け付けない。" #: ../../library/asyncio-eventloop.rst:1715 msgid "Server object is an asynchronous context manager since Python 3.7." @@ -2612,11 +2794,12 @@ msgstr "" "Python 3.7 から、 Server オブジェクトは非同期のコンテキストマネージャになりま" "した。" -#: ../../library/asyncio-eventloop.rst:1718 msgid "" "This class was exposed publicly as ``asyncio.Server`` in Python 3.9.11, " "3.10.3 and 3.11." msgstr "" +"このクラスは Python 3.9.11、3.10.3、3.11 で ``asyncio.Server`` として公開され" +"ました。" #: ../../library/asyncio-eventloop.rst:1723 msgid "" @@ -2632,43 +2815,49 @@ msgid "" "open." msgstr "既存の受信中のクライアントとの接続を表すソケットはオープンのままです。" -#: ../../library/asyncio-eventloop.rst:1729 msgid "" "The server is closed asynchronously; use the :meth:`wait_closed` coroutine " "to wait until the server is closed (and no more connections are active)." msgstr "" +"サーバーは非同期に閉じられます。\n" +"サーバーが閉じられ、すべての接続が終了するまで待つには、:meth:`wait_closed` " +"コルーチンを使ってください。" -#: ../../library/asyncio-eventloop.rst:1735 msgid "Close all existing incoming client connections." -msgstr "" +msgstr "受け付け済みのすべてのクライアント接続を閉じます。" -#: ../../library/asyncio-eventloop.rst:1737 msgid "" "Calls :meth:`~asyncio.BaseTransport.close` on all associated transports." msgstr "" +"関連付けられたすべてのトランスポートに対して :meth:`~asyncio.BaseTransport." +"close` を呼び出します。" -#: ../../library/asyncio-eventloop.rst:1740 msgid "" ":meth:`close` should be called before :meth:`close_clients` when closing the " "server to avoid races with new clients connecting." msgstr "" +"新しいクライアント接続との競合を避けるため、サーバーを閉じる際は :meth:" +"`close_clients` の前に :meth:`close` を呼び出してください。" -#: ../../library/asyncio-eventloop.rst:1747 msgid "" "Close all existing incoming client connections immediately, without waiting " "for pending operations to complete." msgstr "" +"保留中の処理の完了を待たずに、受け付け済みのすべてのクライアント接続を即座に" +"閉じます。" -#: ../../library/asyncio-eventloop.rst:1750 msgid "" "Calls :meth:`~asyncio.WriteTransport.abort` on all associated transports." msgstr "" +"関連付けられたすべてのトランスポートに対して :meth:`~asyncio.WriteTransport." +"abort` を呼び出します。" -#: ../../library/asyncio-eventloop.rst:1753 msgid "" ":meth:`close` should be called before :meth:`abort_clients` when closing the " "server to avoid races with new clients connecting." msgstr "" +"新しいクライアント接続との競合を避けるため、サーバーを閉じる際は :meth:" +"`abort_clients` の前に :meth:`close` を呼び出してください。" #: ../../library/asyncio-eventloop.rst:1760 msgid "Return the event loop associated with the server object." @@ -2678,11 +2867,12 @@ msgstr "サーバオブジェクトに付随するイベントループを返し msgid "Start accepting connections." msgstr "接続の受け付けを開始します。" -#: ../../library/asyncio-eventloop.rst:1769 msgid "" "This method is idempotent, so it can be called when the server is already " "serving." msgstr "" +"このメソッドはべき等なので、サーバーがすでに接続を受け付けていても呼び出せま" +"す。" #: ../../library/asyncio-eventloop.rst:1772 msgid "" @@ -2698,13 +2888,12 @@ msgstr "" "start_serving()`` または :meth:`Server.serve_forever` メソッドを使ってオブ" "ジェクトが接続の受け付けを開始するようにすることができます。" -#: ../../library/asyncio-eventloop.rst:1784 msgid "" "Start accepting connections until the coroutine is cancelled. Cancellation " "of ``serve_forever`` task causes the server to be closed." msgstr "" "接続の受け入れを開始し、コルーチンがキャンセルされるまで継続します。 " -"``serve_forever`` タスクのキャンセルによりサーバーもクローズされます。 " +"``serve_forever`` タスクのキャンセルによりサーバーもクローズされます。" #: ../../library/asyncio-eventloop.rst:1788 msgid "" @@ -2715,7 +2904,6 @@ msgstr "" "す。ひとつの *Server* オブジェクトにつき ``serve_forever`` タスクはひとつだけ" "存在できます。" -#: ../../library/asyncio-eventloop.rst:1794 msgid "" "async def client_connected(reader, writer):\n" " # Communicate with the client with\n" @@ -2729,16 +2917,28 @@ msgid "" "\n" "asyncio.run(main('127.0.0.1', 0))" msgstr "" +"async def client_connected(reader, writer):\n" +" # reader/writer ストリームでクライアントと通信する。\n" +" # 例えば次のようにする:\n" +" await reader.readline()\n" +"\n" +"async def main(host, port):\n" +" srv = await asyncio.start_server(\n" +" client_connected, host, port)\n" +" await srv.serve_forever()\n" +"\n" +"asyncio.run(main('127.0.0.1', 0))" #: ../../library/asyncio-eventloop.rst:1810 msgid "Return ``True`` if the server is accepting new connections." msgstr "サーバーが新規に接続の受け入れを開始した場合 ``True`` を返します。" -#: ../../library/asyncio-eventloop.rst:1817 msgid "" "Wait until the :meth:`close` method completes and all active connections " "have finished." msgstr "" +":meth:`close` メソッドが完了し、すべてのアクティブな接続が終了するまで待ちま" +"す。" #: ../../library/asyncio-eventloop.rst:1822 msgid "" @@ -2759,23 +2959,23 @@ msgstr "" msgid "Event Loop Implementations" msgstr "イベントループの実装" -#: ../../library/asyncio-eventloop.rst:1837 msgid "" "asyncio ships with two different event loop implementations: :class:" "`SelectorEventLoop` and :class:`ProactorEventLoop`." msgstr "" "asyncio は2つの異なるイベントループの実装、 :class:`SelectorEventLoop` と :" -"class:`ProactorEventLoop`、 を提供します: " +"class:`ProactorEventLoop`、 を提供します:" -#: ../../library/asyncio-eventloop.rst:1840 msgid "By default asyncio is configured to use :class:`EventLoop`." msgstr "" +"デフォルトでは、asyncio は :class:`EventLoop` を使うように設定されています。" -#: ../../library/asyncio-eventloop.rst:1845 msgid "" "A subclass of :class:`AbstractEventLoop` based on the :mod:`selectors` " "module." msgstr "" +":mod:`selectors` モジュールに基づく :class:`AbstractEventLoop` のサブクラスで" +"す。" #: ../../library/asyncio-eventloop.rst:1848 msgid "" @@ -2786,7 +2986,6 @@ msgstr "" "プラットフォーム上で利用可能な最も効率の良い *selector* を使います。特定のセ" "レクタ実装を使うように手動で構成することも可能です::" -#: ../../library/asyncio-eventloop.rst:1852 msgid "" "import asyncio\n" "import selectors\n" @@ -2798,40 +2997,54 @@ msgid "" "SelectSelector())\n" "asyncio.run(main(), loop_factory=loop_factory)" msgstr "" +"import asyncio\n" +"import selectors\n" +"\n" +"async def main():\n" +" ...\n" +"\n" +"loop_factory = lambda: asyncio.SelectorEventLoop(selectors." +"SelectSelector())\n" +"asyncio.run(main(), loop_factory=loop_factory)" -#: ../../library/asyncio-eventloop.rst:1867 msgid "" "A subclass of :class:`AbstractEventLoop` for Windows that uses \"I/O " "Completion Ports\" (IOCP)." msgstr "" +"I/O 完了ポート (IOCP) を使う、Windows 用の :class:`AbstractEventLoop` のサブ" +"クラスです。" -#: ../../library/asyncio-eventloop.rst:1873 msgid "" "`MSDN documentation on I/O Completion Ports `_." msgstr "" +"`I/O 完了ポートの MSDN ドキュメント `_。" -#: ../../library/asyncio-eventloop.rst:1878 msgid "" "An alias to the most efficient available subclass of :class:" "`AbstractEventLoop` for the given platform." msgstr "" +"そのプラットフォームで利用可能な、最も効率的な :class:`AbstractEventLoop` の" +"サブクラスの別名です。" -#: ../../library/asyncio-eventloop.rst:1881 msgid "" "It is an alias to :class:`SelectorEventLoop` on Unix and :class:" "`ProactorEventLoop` on Windows." msgstr "" +"Unix では :class:`SelectorEventLoop`、Windows では :class:" +"`ProactorEventLoop` の別名です。" #: ../../library/asyncio-eventloop.rst:1887 msgid "Abstract base class for asyncio-compliant event loops." msgstr "asyncio に適合するイベントループの抽象基底クラスです。" -#: ../../library/asyncio-eventloop.rst:1889 msgid "" "The :ref:`asyncio-event-loop-methods` section lists all methods that an " "alternative implementation of ``AbstractEventLoop`` should have defined." msgstr "" +":ref:`asyncio-event-loop-methods` の節には、``AbstractEventLoop`` の代替実装" +"で定義すべきメソッドをすべて列挙しています。" #: ../../library/asyncio-eventloop.rst:1895 msgid "Examples" @@ -2861,7 +3074,6 @@ msgstr "" ":meth:`loop.call_soon` メソッドを使ってコールバックをスケジュールする例です。" "コールバックは ``\"Hello World\"`` を出力しイベントループを停止します::" -#: ../../library/asyncio-eventloop.rst:1913 msgid "" "import asyncio\n" "\n" @@ -2881,6 +3093,24 @@ msgid "" "finally:\n" " loop.close()" msgstr "" +"import asyncio\n" +"\n" +"def hello_world(loop):\n" +" \"\"\"'Hello World' を表示してイベントループを停止するコールバック" +"\"\"\"\n" +" print('Hello World')\n" +" loop.stop()\n" +"\n" +"loop = asyncio.new_event_loop()\n" +"\n" +"# hello_world() の呼び出しをスケジュールする\n" +"loop.call_soon(hello_world, loop)\n" +"\n" +"# loop.stop() で終了するブロッキング呼び出し\n" +"try:\n" +" loop.run_forever()\n" +"finally:\n" +" loop.close()" #: ../../library/asyncio-eventloop.rst:1933 msgid "" @@ -2949,7 +3179,6 @@ msgstr "" "ファイル記述子が :meth:`loop.add_reader` メソッドを使って何らかのデータを受信" "するまで待機し、その後イベントループをクローズします::" -#: ../../library/asyncio-eventloop.rst:1982 msgid "" "import asyncio\n" "from socket import socketpair\n" @@ -2984,14 +3213,45 @@ msgid "" " wsock.close()\n" " loop.close()" msgstr "" +"import asyncio\n" +"from socket import socketpair\n" +"\n" +"# 接続されたファイル記述子のペアを作成する\n" +"rsock, wsock = socketpair()\n" +"\n" +"loop = asyncio.new_event_loop()\n" +"\n" +"def reader():\n" +" data = rsock.recv(100)\n" +" print(\"Received:\", data.decode())\n" +"\n" +" # 処理が済んだので、ファイル記述子の登録を解除する\n" +" loop.remove_reader(rsock)\n" +"\n" +" # イベントループを停止する\n" +" loop.stop()\n" +"\n" +"# 読み込みイベント用にファイル記述子を登録する\n" +"loop.add_reader(rsock, reader)\n" +"\n" +"# ネットワークからのデータ受信を模倣する\n" +"loop.call_soon(wsock.send, 'abc'.encode())\n" +"\n" +"try:\n" +" # イベントループを実行する\n" +" loop.run_forever()\n" +"finally:\n" +" # 処理が済んだので、ソケットとイベントループを閉じる。\n" +" rsock.close()\n" +" wsock.close()\n" +" loop.close()" -#: ../../library/asyncio-eventloop.rst:2017 msgid "" "A similar :ref:`example ` using " "transports, protocols, and the :meth:`loop.create_connection` method." msgstr "" "トランスポート、プロトコル、および :meth:`loop.create_connection` メソッドを" -"使用した同じような :ref:`例 `。 " +"使用した同じような :ref:`例 `。" #: ../../library/asyncio-eventloop.rst:2021 msgid "" @@ -3009,11 +3269,12 @@ msgstr "SIGINT および SIGTERM 用のシグナルハンドラーの設定" msgid "(This ``signals`` example only works on Unix.)" msgstr "(ここに挙げる ``signals`` の例は Unix でのみ動きます。)" -#: ../../library/asyncio-eventloop.rst:2033 msgid "" "Register handlers for signals :const:`~signal.SIGINT` and :const:`~signal." "SIGTERM` using the :meth:`loop.add_signal_handler` method::" msgstr "" +":meth:`loop.add_signal_handler` メソッドで、シグナル :const:`~signal.SIGINT` " +"と :const:`~signal.SIGTERM` のハンドラーを登録します。 ::" #: ../../library/asyncio-eventloop.rst:2036 msgid "" diff --git a/library/asyncio-exceptions.po b/library/asyncio-exceptions.po index 5b723cc0f..e2573540a 100644 --- a/library/asyncio-exceptions.po +++ b/library/asyncio-exceptions.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/asyncio-exceptions.rst:8 diff --git a/library/asyncio-extending.po b/library/asyncio-extending.po index b0e235af3..03fce922c 100644 --- a/library/asyncio-extending.po +++ b/library/asyncio-extending.po @@ -12,145 +12,151 @@ msgstr "" "PO-Revision-Date: 2022-11-05 19:48+0000\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" -#: ../../library/asyncio-extending.rst:6 msgid "Extending" -msgstr "" +msgstr "拡張" -#: ../../library/asyncio-extending.rst:8 msgid "" "The main direction for :mod:`asyncio` extending is writing custom *event " "loop* classes. Asyncio has helpers that could be used to simplify this task." msgstr "" +":mod:`asyncio` を拡張する主な方法は、独自の *イベントループ* クラスを書くこと" +"です。\n" +"asyncio には、この作業を簡単にするための補助機能があります。" -#: ../../library/asyncio-extending.rst:13 msgid "" "Third-parties should reuse existing asyncio code with caution, a new Python " "version is free to break backward compatibility in *internal* part of API." msgstr "" +"サードパーティーが既存の asyncio コードを再利用する際は注意してください。\n" +"新しい Python バージョンでは、API の *内部的な* 部分について後方互換性が失わ" +"れる可能性があります。" -#: ../../library/asyncio-extending.rst:19 msgid "Writing a Custom Event Loop" -msgstr "" +msgstr "独自のイベントループを書く" -#: ../../library/asyncio-extending.rst:21 msgid "" ":class:`asyncio.AbstractEventLoop` declares very many methods. Implementing " "all them from scratch is a tedious job." msgstr "" +":class:`asyncio.AbstractEventLoop` には非常に多くのメソッドが宣言されており、" +"すべてを一から実装するのは大変な作業です。" -#: ../../library/asyncio-extending.rst:24 msgid "" "A loop can get many common methods implementation for free by inheriting " "from :class:`asyncio.BaseEventLoop`." msgstr "" +":class:`asyncio.BaseEventLoop` を継承すれば、多くの共通メソッドの実装をそのま" +"ま利用できます。" -#: ../../library/asyncio-extending.rst:27 msgid "" "In turn, the successor should implement a bunch of *private* methods " "declared but not implemented in :class:`asyncio.BaseEventLoop`." msgstr "" +"その代わり、サブクラスでは :class:`asyncio.BaseEventLoop` に宣言されているも" +"のの実装されていない *非公開* メソッドを実装する必要があります。" -#: ../../library/asyncio-extending.rst:30 msgid "" "For example, ``loop.create_connection()`` checks arguments, resolves DNS " "addresses, and calls ``loop._make_socket_transport()`` that should be " "implemented by inherited class. The ``_make_socket_transport()`` method is " "not documented and is considered as an *internal* API." msgstr "" +"例えば ``loop.create_connection()`` は、引数の検査と DNS によるアドレス解決を" +"行い、サブクラスで実装すべき ``loop._make_socket_transport()`` を呼び出しま" +"す。\n" +"``_make_socket_transport()`` は文書化されておらず、*内部* API とみなされま" +"す。" -#: ../../library/asyncio-extending.rst:38 msgid "Future and Task private constructors" -msgstr "" +msgstr "Future と Task の非公開コンストラクター" -#: ../../library/asyncio-extending.rst:40 msgid "" ":class:`asyncio.Future` and :class:`asyncio.Task` should be never created " "directly, please use corresponding :meth:`loop.create_future` and :meth:" "`loop.create_task`, or :func:`asyncio.create_task` factories instead." msgstr "" +":class:`asyncio.Future` と :class:`asyncio.Task` は直接作成しないでくださ" +"い。\n" +"代わりに、それぞれに対応するファクトリー :meth:`loop.create_future` と :meth:" +"`loop.create_task`、または :func:`asyncio.create_task` を使ってください。" -#: ../../library/asyncio-extending.rst:44 msgid "" "However, third-party *event loops* may *reuse* built-in future and task " "implementations for the sake of getting a complex and highly optimized code " "for free." msgstr "" +"ただし、サードパーティーの *イベントループ* は、複雑で高度に最適化されたコー" +"ドを自前で実装せずに利用するために、組み込みの Future と Task の実装を *再利" +"用* してもかまいません。" -#: ../../library/asyncio-extending.rst:47 msgid "For this purpose the following, *private* constructors are listed:" -msgstr "" +msgstr "この目的のために、以下の *非公開* コンストラクターを紹介します。" -#: ../../library/asyncio-extending.rst:51 msgid "Create a built-in future instance." -msgstr "" +msgstr "組み込みの Future インスタンスを作成します。" -#: ../../library/asyncio-extending.rst:53 msgid "*loop* is an optional event loop instance." -msgstr "" +msgstr "*loop* は省略可能なイベントループのインスタンスです。" -#: ../../library/asyncio-extending.rst:57 msgid "Create a built-in task instance." -msgstr "" +msgstr "組み込みの Task インスタンスを作成します。" -#: ../../library/asyncio-extending.rst:59 msgid "" "*loop* is an optional event loop instance. The rest of arguments are " "described in :meth:`loop.create_task` description." msgstr "" +"*loop* は省略可能なイベントループのインスタンスです。\n" +"他の引数については :meth:`loop.create_task` を参照してください。" -#: ../../library/asyncio-extending.rst:64 msgid "*context* argument is added." -msgstr "" +msgstr "*context* 引数が追加されました。" -#: ../../library/asyncio-extending.rst:69 msgid "Task lifetime support" -msgstr "" +msgstr "タスクの生存期間の管理" -#: ../../library/asyncio-extending.rst:71 msgid "" "A third party task implementation should call the following functions to " "keep a task visible by :func:`asyncio.all_tasks` and :func:`asyncio." "current_task`:" msgstr "" +"サードパーティーのタスク実装では、:func:`asyncio.all_tasks` と :func:" +"`asyncio.current_task` でタスクを取得できるように、次の関数を呼び出す必要があ" +"ります。" -#: ../../library/asyncio-extending.rst:76 msgid "Register a new *task* as managed by *asyncio*." -msgstr "" +msgstr "新しい *task* を *asyncio* が管理するタスクとして登録します。" -#: ../../library/asyncio-extending.rst:78 msgid "Call the function from a task constructor." -msgstr "" +msgstr "タスクのコンストラクターから呼び出してください。" -#: ../../library/asyncio-extending.rst:82 msgid "Unregister a *task* from *asyncio* internal structures." -msgstr "" +msgstr "*asyncio* の内部データ構造から *task* の登録を解除します。" -#: ../../library/asyncio-extending.rst:84 msgid "The function should be called when a task is about to finish." -msgstr "" +msgstr "タスクが終了する直前に呼び出してください。" -#: ../../library/asyncio-extending.rst:88 msgid "Switch the current task to the *task* argument." -msgstr "" +msgstr "現在のタスクを、引数 *task* に切り替えます。" -#: ../../library/asyncio-extending.rst:90 msgid "" "Call the function just before executing a portion of embedded *coroutine* (:" "meth:`coroutine.send` or :meth:`coroutine.throw`)." msgstr "" +"タスク内の *コルーチン* を部分的に実行する直前 (:meth:`coroutine.send` また" +"は :meth:`coroutine.throw` の呼び出し直前) に呼び出してください。" -#: ../../library/asyncio-extending.rst:95 msgid "Switch the current task back from *task* to ``None``." -msgstr "" +msgstr "現在のタスクを *task* から ``None`` に戻します。" -#: ../../library/asyncio-extending.rst:97 msgid "" "Call the function just after :meth:`coroutine.send` or :meth:`coroutine." "throw` execution." msgstr "" +":meth:`coroutine.send` または :meth:`coroutine.throw` の実行直後に呼び出して" +"ください。" diff --git a/library/asyncio-future.po b/library/asyncio-future.po index 3a9016f91..a067c2755 100644 --- a/library/asyncio-future.po +++ b/library/asyncio-future.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: Takeshi Nakazato, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/asyncio-future.rst:8 @@ -101,18 +101,21 @@ msgstr "" "引数 *obj* が上記のいずれにもあてはまらない場合は :exc:`TypeError` 例外を送出" "します。" -#: ../../library/asyncio-future.rst:54 msgid "" "Save a reference to the result of this function, to avoid a task " "disappearing mid-execution." msgstr "" +"タスクが実行途中で消えないように、この関数の返り値への参照を保持してくださ" +"い。" -#: ../../library/asyncio-future.rst:57 msgid "" "See also the :func:`create_task` function which is the preferred way for " "creating new tasks or use :class:`asyncio.TaskGroup` which keeps reference " "to the task internally." msgstr "" +"新しいタスクの作成に推奨される :func:`create_task` 関数も参照してください。\n" +"または、タスクへの参照を内部で保持する :class:`asyncio.TaskGroup` を使ってく" +"ださい。" #: ../../library/asyncio-future.rst:61 msgid "The function accepts any :term:`awaitable` object." @@ -120,11 +123,12 @@ msgstr "" "この関数はどんな :term:`awaitable` なオブジェクトでも受け入れるようになりまし" "た。" -#: ../../library/asyncio-future.rst:64 msgid "" "Deprecation warning is emitted if *obj* is not a Future-like object and " "*loop* is not specified and there is no running event loop." msgstr "" +"*obj* が Future に相当するオブジェクトではなく、*loop* を指定せず、実行中のイ" +"ベントループもない場合に、非推奨の警告が出ます。" #: ../../library/asyncio-future.rst:71 msgid "" @@ -134,11 +138,12 @@ msgstr "" ":class:`concurrent.futures.Future` オブジェクトを :class:`asyncio.Future` オ" "ブジェクトでラップします。" -#: ../../library/asyncio-future.rst:74 msgid "" "Deprecation warning is emitted if *future* is not a Future-like object and " "*loop* is not specified and there is no running event loop." msgstr "" +"*future* が Future に相当するオブジェクトではなく、*loop* を指定せず、実行中" +"のイベントループもない場合に、非推奨の警告が出ます。" #: ../../library/asyncio-future.rst:80 msgid "Future Object" @@ -151,12 +156,15 @@ msgid "" msgstr "" "Future は非同期処理の最終結果を表すクラスです。スレッドセーフではありません。" -#: ../../library/asyncio-future.rst:87 msgid "" "Future is an :term:`awaitable` object. Coroutines can await on Future " "objects until they either have a result or an exception set, or until they " "are cancelled. A Future can be awaited multiple times and the result is same." msgstr "" +"Future は :term:`awaitable` オブジェクトです。\n" +"コルーチンは Future を await して、結果か例外が設定されるか、キャンセルされる" +"まで待機できます。\n" +"同じ Future を複数回 await でき、その結果は同じです。" #: ../../library/asyncio-future.rst:92 msgid "" @@ -185,11 +193,12 @@ msgstr "" msgid "Added support for the :mod:`contextvars` module." msgstr ":mod:`contextvars` モジュールのサポートを追加。" -#: ../../library/asyncio-future.rst:106 msgid "" "Deprecation warning is emitted if *loop* is not specified and there is no " "running event loop." msgstr "" +"*loop* が指定されておらず、実行中のイベントループもない場合に、非推奨の警告を" +"出すようになりました。" #: ../../library/asyncio-future.rst:112 msgid "Return the result of the Future." @@ -219,20 +228,21 @@ msgstr "" "Future が *キャンセルされた* 場合、このメソッドは :exc:`CancelledError` 例外" "を送出します。" -#: ../../library/asyncio-future.rst:123 msgid "" "If the Future's result isn't yet available, this method raises an :exc:" "`InvalidStateError` exception." msgstr "" +"Future の結果がまだ得られない場合は、:exc:`InvalidStateError` を送出します。" #: ../../library/asyncio-future.rst:128 msgid "Mark the Future as *done* and set its result." msgstr "Future を *完了* とマークし、結果を設定します。" -#: ../../library/asyncio-future.rst:130 ../../library/asyncio-future.rst:137 msgid "" "Raises an :exc:`InvalidStateError` error if the Future is already *done*." msgstr "" +"Future がすでに *完了* している場合は、:exc:`InvalidStateError` を送出しま" +"す。" #: ../../library/asyncio-future.rst:135 msgid "Mark the Future as *done* and set an exception." @@ -263,11 +273,12 @@ msgstr "" "通常の場合、このメソッドは Future に処理結果や例外を設定する前に Future が *" "キャンセルされていない* ことを確認するために使用されます::" -#: ../../library/asyncio-future.rst:155 msgid "" "if not fut.cancelled():\n" " fut.set_result(42)" msgstr "" +"if not fut.cancelled():\n" +" fut.set_result(42)" #: ../../library/asyncio-future.rst:160 msgid "Add a callback to be run when the Future is *done*." @@ -303,12 +314,14 @@ msgstr "" "コールバックにパラメータを渡すには、次の例のように :func:`functools.partial` " "を使うことができます::" -#: ../../library/asyncio-future.rst:175 msgid "" "# Call 'print(\"Future:\", fut)' when \"fut\" is done.\n" "fut.add_done_callback(\n" " functools.partial(print, \"Future:\"))" msgstr "" +"# fut が完了したら print(\"Future:\", fut) を呼び出す。\n" +"fut.add_done_callback(\n" +" functools.partial(print, \"Future:\"))" #: ../../library/asyncio-future.rst:179 msgid "" @@ -344,9 +357,8 @@ msgstr "" "す。そうでない場合 Future の状態を *キャンセル* に変更した上でコールバックを" "スケジュールし、 ``True`` を返します。" -#: ../../library/asyncio-future.rst:198 msgid "Added the *msg* parameter." -msgstr "" +msgstr "*msg* パラメーターが追加されました。" #: ../../library/asyncio-future.rst:203 msgid "Return the exception that was set on this Future." @@ -380,7 +392,6 @@ msgstr "" "この例は Future オブジェクトを生成し、Future に結果を設定するための非同期タス" "クを生成してスケジュールし、そして Future に結果が設定されるまで待機します::" -#: ../../library/asyncio-future.rst:227 msgid "" "async def set_after(fut, delay, value):\n" " # Sleep for *delay* seconds.\n" @@ -410,6 +421,33 @@ msgid "" "\n" "asyncio.run(main())" msgstr "" +"async def set_after(fut, delay, value):\n" +" # delay 秒スリープする。\n" +" await asyncio.sleep(delay)\n" +"\n" +" # Future fut の結果に value を設定する。\n" +" fut.set_result(value)\n" +"\n" +"async def main():\n" +" # 現在のイベントループを取得する。\n" +" loop = asyncio.get_running_loop()\n" +"\n" +" # 新しい Future オブジェクトを作成する。\n" +" fut = loop.create_future()\n" +"\n" +" # set_after() コルーチンを別のタスクで並行して実行する。\n" +" # ここではイベントループへの参照をすでに持っているので、\n" +" # 低水準の loop.create_task() API を使っている。\n" +" # そうでなければ asyncio.create_task() を使えばよい。\n" +" loop.create_task(\n" +" set_after(fut, 1, '... world'))\n" +"\n" +" print('hello ...')\n" +"\n" +" # fut の結果が得られるまで待ち (1 秒)、表示する。\n" +" print(await fut)\n" +"\n" +"asyncio.run(main())" #: ../../library/asyncio-future.rst:258 msgid "" @@ -460,8 +498,9 @@ msgstr "" "asyncio の Future は :func:`concurrent.futures.wait` および :func:" "`concurrent.futures.as_completed` との互換性がありません。" -#: ../../library/asyncio-future.rst:279 msgid "" ":meth:`asyncio.Future.cancel` accepts an optional ``msg`` argument, but :" "meth:`concurrent.futures.Future.cancel` does not." msgstr "" +":meth:`asyncio.Future.cancel` は省略可能な ``msg`` 引数を受け付けますが、:" +"meth:`concurrent.futures.Future.cancel` は受け付けません。" diff --git a/library/asyncio-llapi-index.po b/library/asyncio-llapi-index.po index 26de7682e..6662c89ec 100644 --- a/library/asyncio-llapi-index.po +++ b/library/asyncio-llapi-index.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: Arihiro TAKASE, 2023\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/asyncio-llapi-index.rst:6 @@ -48,9 +48,10 @@ msgstr "実行中のイベントループを取得するために **利用が推 msgid ":func:`asyncio.get_event_loop`" msgstr ":func:`asyncio.get_event_loop`" -#: ../../library/asyncio-llapi-index.rst:22 msgid "Get an event loop instance (running or current via the current policy)." msgstr "" +"実行中のイベントループ、または現在のポリシーが返す現在のイベントループのイン" +"スタンスを取得します。" #: ../../library/asyncio-llapi-index.rst:24 msgid ":func:`asyncio.set_event_loop`" @@ -83,11 +84,10 @@ msgstr ":ref:`asyncio.get_running_loop() を使う `。" msgid "Event Loop Methods" msgstr "イベントループのメソッド" -#: ../../library/asyncio-llapi-index.rst:39 msgid "" "See also the main documentation section about the :ref:`asyncio-event-loop-" "methods`." -msgstr "" +msgstr ":ref:`asyncio-event-loop-methods` の本編も参照してください。" #: ../../library/asyncio-llapi-index.rst:42 msgid "Lifecycle" @@ -125,17 +125,15 @@ msgstr ":meth:`loop.close`" msgid "Close the event loop." msgstr "イベントループをクローズします。" -#: ../../library/asyncio-llapi-index.rst:59 msgid ":meth:`loop.is_running`" -msgstr "" +msgstr ":meth:`loop.is_running`" #: ../../library/asyncio-llapi-index.rst:60 msgid "Return ``True`` if the event loop is running." msgstr "イベントループが実行中の場合 ``True`` を返します。" -#: ../../library/asyncio-llapi-index.rst:62 msgid ":meth:`loop.is_closed`" -msgstr "" +msgstr ":meth:`loop.is_closed`" #: ../../library/asyncio-llapi-index.rst:63 msgid "Return ``True`` if the event loop is closed." @@ -177,9 +175,8 @@ msgstr "コールバックのスケジューリング" msgid ":meth:`loop.call_soon`" msgstr ":meth:`loop.call_soon`" -#: ../../library/asyncio-llapi-index.rst:87 msgid "Invoke a callback soon." -msgstr "コールバックを即座に実行します。" +msgstr "コールバックがまもなく実行されるようにスケジュールします。" #: ../../library/asyncio-llapi-index.rst:89 msgid ":meth:`loop.call_soon_threadsafe`" @@ -205,9 +202,8 @@ msgstr ":meth:`loop.call_at`" msgid "Invoke a callback *at* the given time." msgstr "*与えられた時刻に* コールバックを実行します。" -#: ../../library/asyncio-llapi-index.rst:99 msgid "Thread/Interpreter/Process Pool" -msgstr "" +msgstr "スレッド・インタープリタ・プロセスのプール" #: ../../library/asyncio-llapi-index.rst:104 msgid "``await`` :meth:`loop.run_in_executor`" @@ -396,25 +392,21 @@ msgstr ":class:`~socket.socket` からデータを受信します。" msgid "``await`` :meth:`loop.sock_recv_into`" msgstr "``await`` :meth:`loop.sock_recv_into`" -#: ../../library/asyncio-llapi-index.rst:190 msgid "Receive data from the :class:`~socket.socket` into a buffer." -msgstr ":class:`~socket.socket` からデータを受信し、バッファに送信します。" +msgstr ":class:`~socket.socket` からデータを受信し、バッファに格納します。" -#: ../../library/asyncio-llapi-index.rst:192 msgid "``await`` :meth:`loop.sock_recvfrom`" -msgstr "" +msgstr "``await`` :meth:`loop.sock_recvfrom`" -#: ../../library/asyncio-llapi-index.rst:193 msgid "Receive a datagram from the :class:`~socket.socket`." -msgstr "" +msgstr ":class:`~socket.socket` からデータグラムを受信します。" -#: ../../library/asyncio-llapi-index.rst:195 msgid "``await`` :meth:`loop.sock_recvfrom_into`" -msgstr "" +msgstr "``await`` :meth:`loop.sock_recvfrom_into`" -#: ../../library/asyncio-llapi-index.rst:196 msgid "Receive a datagram from the :class:`~socket.socket` into a buffer." msgstr "" +":class:`~socket.socket` からデータグラムを受信し、バッファに格納します。" #: ../../library/asyncio-llapi-index.rst:198 msgid "``await`` :meth:`loop.sock_sendall`" @@ -424,13 +416,13 @@ msgstr "``await`` :meth:`loop.sock_sendall`" msgid "Send data to the :class:`~socket.socket`." msgstr ":class:`~socket.socket` にデータを送信します。" -#: ../../library/asyncio-llapi-index.rst:201 msgid "``await`` :meth:`loop.sock_sendto`" -msgstr "" +msgstr "``await`` :meth:`loop.sock_sendto`" -#: ../../library/asyncio-llapi-index.rst:202 msgid "Send a datagram via the :class:`~socket.socket` to the given address." msgstr "" +":class:`~socket.socket` を通じて、指定したアドレスにデータグラムを送信しま" +"す。" #: ../../library/asyncio-llapi-index.rst:204 msgid "``await`` :meth:`loop.sock_connect`" @@ -452,9 +444,8 @@ msgstr ":class:`~socket.socket` の接続を受け入れます。" msgid "``await`` :meth:`loop.sock_sendfile`" msgstr "``await`` :meth:`loop.sock_sendfile`" -#: ../../library/asyncio-llapi-index.rst:211 msgid "Send a file over the :class:`~socket.socket`." -msgstr "Send a file over the :class:`~socket.socket`." +msgstr ":class:`~socket.socket` を通じてファイルを送信します。" #: ../../library/asyncio-llapi-index.rst:213 msgid ":meth:`loop.add_reader`" @@ -564,11 +555,12 @@ msgstr ":meth:`loop.default_exception_handler`" msgid "The default exception handler implementation." msgstr "デフォルトの例外ハンドラー実装です。" -#: ../../library/asyncio-llapi-index.rst:270 msgid "" ":ref:`Using asyncio.new_event_loop() and loop.run_forever() " "`." msgstr "" +":ref:`asyncio.new_event_loop() と loop.run_forever() を使う " +"`。" #: ../../library/asyncio-llapi-index.rst:273 msgid ":ref:`Using loop.call_later() `." @@ -704,9 +696,8 @@ msgstr "" "ドです。該当するトランスポートは :meth:`loop.create_connection`, :meth:`loop." "create_unix_connection`, :meth:`loop.connect_write_pipe` などの戻り値です:" -#: ../../library/asyncio-llapi-index.rst:339 msgid "Write Transports" -msgstr "トランスポートにデータを書き込みます。" +msgstr "書き込みトランスポート" #: ../../library/asyncio-llapi-index.rst:344 msgid ":meth:`transport.write() `" @@ -761,15 +752,15 @@ msgstr "" ":meth:`transport.get_write_buffer_size() `" -#: ../../library/asyncio-llapi-index.rst:361 msgid "Return the current size of the output buffer." -msgstr "" +msgstr "出力バッファの現在のサイズを返します。" -#: ../../library/asyncio-llapi-index.rst:363 msgid "" ":meth:`transport.get_write_buffer_limits() `" msgstr "" +":meth:`transport.get_write_buffer_limits() `" #: ../../library/asyncio-llapi-index.rst:365 msgid "Return high and low water marks for write flow control." @@ -815,9 +806,8 @@ msgstr "" "サブプロセスに対するトランスポートの低レベルな抽象化です。 :meth:`loop." "subprocess_exec` や :meth:`loop.subprocess_shell` の戻り値です:" -#: ../../library/asyncio-llapi-index.rst:390 msgid "Subprocess Transports" -msgstr "サブプロセス化されたトランスポート" +msgstr "サブプロセストランスポート" #: ../../library/asyncio-llapi-index.rst:395 msgid ":meth:`transport.get_pid() `" @@ -1004,9 +994,8 @@ msgstr "" msgid "Subprocess Protocols" msgstr "サブプロセスプロトコル" -#: ../../library/asyncio-llapi-index.rst:487 msgid "``callback`` :meth:`~SubprocessProtocol.pipe_data_received`" -msgstr "" +msgstr "``callback`` :meth:`~SubprocessProtocol.pipe_data_received`" #: ../../library/asyncio-llapi-index.rst:488 msgid "" @@ -1015,9 +1004,8 @@ msgstr "" "子プロセスが標準出力 (*stdout*) または標準エラー出力 (*stderr*) のパイプに" "データを書き込んだときに呼び出されます。" -#: ../../library/asyncio-llapi-index.rst:491 msgid "``callback`` :meth:`~SubprocessProtocol.pipe_connection_lost`" -msgstr "" +msgstr "``callback`` :meth:`~SubprocessProtocol.pipe_connection_lost`" #: ../../library/asyncio-llapi-index.rst:492 msgid "" @@ -1031,12 +1019,14 @@ msgid "" msgstr "" "``callback`` :meth:`process_exited() `" -#: ../../library/asyncio-llapi-index.rst:497 msgid "" "Called when the child process has exited. It can be called before :meth:" "`~SubprocessProtocol.pipe_data_received` and :meth:`~SubprocessProtocol." "pipe_connection_lost` methods." msgstr "" +"子プロセスが終了したときに呼び出されます。\n" +":meth:`~SubprocessProtocol.pipe_data_received` や :meth:`~SubprocessProtocol." +"pipe_connection_lost` より先に呼び出されることもあります。" #: ../../library/asyncio-llapi-index.rst:503 msgid "Event Loop Policies" diff --git a/library/asyncio-platforms.po b/library/asyncio-platforms.po index c827997f5..d5ff34c2d 100644 --- a/library/asyncio-platforms.po +++ b/library/asyncio-platforms.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/asyncio-platforms.rst:9 @@ -190,7 +190,6 @@ msgstr "" "class:`~selectors.SelectSelector` または :class:`~selectors.PollSelector` を" "使うように手動で設定します。以下はその例です::" -#: ../../library/asyncio-platforms.rst:95 msgid "" "import asyncio\n" "import selectors\n" @@ -199,3 +198,9 @@ msgid "" "loop = asyncio.SelectorEventLoop(selector)\n" "asyncio.set_event_loop(loop)" msgstr "" +"import asyncio\n" +"import selectors\n" +"\n" +"selector = selectors.SelectSelector()\n" +"loop = asyncio.SelectorEventLoop(selector)\n" +"asyncio.set_event_loop(loop)" diff --git a/library/asyncio-policy.po b/library/asyncio-policy.po index 4d80fac8e..ff90a6312 100644 --- a/library/asyncio-policy.po +++ b/library/asyncio-policy.po @@ -17,24 +17,25 @@ msgstr "" "Last-Translator: Takeshi Nakazato, 2022\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/asyncio-policy.rst:8 msgid "Policies" msgstr "ポリシー" -#: ../../library/asyncio-policy.rst:12 msgid "" "Policies are deprecated and will be removed in Python 3.16. Users are " "encouraged to use the :func:`asyncio.run` function or the :class:`asyncio." "Runner` with *loop_factory* to use the desired loop implementation." msgstr "" +"ポリシーは非推奨で、Python 3.16 で削除されます。\n" +"使いたいイベントループの実装を選ぶには、:func:`asyncio.run` 関数、または :" +"class:`asyncio.Runner` に *loop_factory* を指定する方法を推奨します。" -#: ../../library/asyncio-policy.rst:18 msgid "" "An event loop policy is a global object used to get and set the current :ref:" "`event loop `, as well as create new event loops. The " @@ -43,19 +44,31 @@ msgid "" "implementations, or substituted by a :ref:`custom policy ` that can override these behaviors." msgstr "" +"イベントループポリシーは、現在の :ref:`イベントループ ` " +"の取得・設定と、新しいイベントループの作成に使うグローバルオブジェクトで" +"す。\n" +"異なるイベントループの実装を使うには、デフォルトのポリシーを :ref:`組み込みの" +"別のポリシー ` に :ref:`置き換える ` ことができます。\n" +"また、これらの動作を変更する :ref:`カスタムポリシー ` に置き換えることもできます。" -#: ../../library/asyncio-policy.rst:27 msgid "" "The :ref:`policy object ` gets and sets a separate " "event loop per *context*. This is per-thread by default, though custom " "policies could define *context* differently." msgstr "" +":ref:`ポリシーオブジェクト ` は、*コンテキスト* ごと" +"に独立したイベントループを取得・設定します。\n" +"デフォルトではスレッドごとですが、カスタムポリシーでは *コンテキスト* を別の" +"単位で定義できます。" -#: ../../library/asyncio-policy.rst:32 msgid "" "Custom event loop policies can control the behavior of :func:" "`get_event_loop`, :func:`set_event_loop`, and :func:`new_event_loop`." msgstr "" +"カスタムイベントループポリシーは、:func:`get_event_loop`、:func:" +"`set_event_loop`、:func:`new_event_loop` の動作を制御できます。" #: ../../library/asyncio-policy.rst:35 msgid "" @@ -80,11 +93,11 @@ msgstr "" msgid "Return the current process-wide policy." msgstr "プロセス全体にわたる現在のポリシーを返します。" -#: ../../library/asyncio-policy.rst:51 msgid "" "The :func:`get_event_loop_policy` function is deprecated and will be removed " "in Python 3.16." msgstr "" +":func:`get_event_loop_policy` 関数は非推奨で、Python 3.16 で削除されます。" #: ../../library/asyncio-policy.rst:57 msgid "Set the current process-wide policy to *policy*." @@ -95,11 +108,11 @@ msgid "If *policy* is set to ``None``, the default policy is restored." msgstr "" "*policy* が ``None`` の場合、デフォルトポリシーが現在のポリシーに戻されます。" -#: ../../library/asyncio-policy.rst:61 msgid "" "The :func:`set_event_loop_policy` function is deprecated and will be removed " "in Python 3.16." msgstr "" +":func:`set_event_loop_policy` 関数は非推奨で、Python 3.16 で削除されます。" #: ../../library/asyncio-policy.rst:69 msgid "Policy Objects" @@ -137,11 +150,12 @@ msgstr "現在のコンテキストにイベントループ *loop* を設定し msgid "Create and return a new event loop object." msgstr "新しいイベントループオブジェクトを生成して返します。" -#: ../../library/asyncio-policy.rst:98 msgid "" "The :class:`AbstractEventLoopPolicy` class is deprecated and will be removed " "in Python 3.16." msgstr "" +":class:`AbstractEventLoopPolicy` クラスは非推奨で、Python 3.16 で削除されま" +"す。" #: ../../library/asyncio-policy.rst:105 msgid "asyncio ships with the following built-in policies:" @@ -155,13 +169,12 @@ msgstr "" "デフォルトの asyncio ポリシーです。Unix では :class:`SelectorEventLoop` 、" "Windows では :class:`ProactorEventLoop` を使います。" -#: ../../library/asyncio-policy.rst:113 msgid "" "There is no need to install the default policy manually. asyncio is " "configured to use the default policy automatically." msgstr "" "デフォルトのポリシーを手動でインストールする必要はありません。 asyncio はデ" -"フォルトポリシーを使うように自動的に構成されます。 " +"フォルトポリシーを使うように自動的に構成されます。" #: ../../library/asyncio-policy.rst:118 msgid "On Windows, :class:`ProactorEventLoop` is now used by default." @@ -169,17 +182,19 @@ msgstr "" "Windows では :class:`ProactorEventLoop` がデフォルトで使われるようになりまし" "た。" -#: ../../library/asyncio-policy.rst:120 msgid "" "The :meth:`get_event_loop` method of the default asyncio policy now raises " "a :exc:`RuntimeError` if there is no set event loop." msgstr "" +"asyncio のデフォルトポリシーの :meth:`get_event_loop` は、イベントループが設" +"定されていなければ :exc:`RuntimeError` を送出するようになりました。" -#: ../../library/asyncio-policy.rst:124 msgid "" "The :class:`DefaultEventLoopPolicy` class is deprecated and will be removed " "in Python 3.16." msgstr "" +":class:`DefaultEventLoopPolicy` クラスは非推奨で、Python 3.16 で削除されま" +"す。" #: ../../library/asyncio-policy.rst:131 msgid "" @@ -189,15 +204,15 @@ msgstr "" ":class:`SelectorEventLoop` イベントループ実装を使った別のイベントループポリ" "シーです。" -#: ../../library/asyncio-policy.rst:134 ../../library/asyncio-policy.rst:146 msgid "Availability" -msgstr "" +msgstr "利用可能な環境" -#: ../../library/asyncio-policy.rst:136 msgid "" "The :class:`WindowsSelectorEventLoopPolicy` class is deprecated and will be " "removed in Python 3.16." msgstr "" +":class:`WindowsSelectorEventLoopPolicy` クラスは非推奨で、Python 3.16 で削除" +"されます。" #: ../../library/asyncio-policy.rst:143 msgid "" @@ -207,11 +222,12 @@ msgstr "" ":class:`ProactorEventLoop` イベントループ実装を使った別のイベントループポリ" "シーです。" -#: ../../library/asyncio-policy.rst:148 msgid "" "The :class:`WindowsProactorEventLoopPolicy` class is deprecated and will be " "removed in Python 3.16." msgstr "" +":class:`WindowsProactorEventLoopPolicy` クラスは非推奨で、Python 3.16 で削除" +"されます。" #: ../../library/asyncio-policy.rst:156 msgid "Custom Policies" diff --git a/library/asyncio-protocol.po b/library/asyncio-protocol.po index 0430a2b20..b1c39f769 100644 --- a/library/asyncio-protocol.po +++ b/library/asyncio-protocol.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/asyncio-protocol.rst:9 @@ -341,12 +341,14 @@ msgstr "" "例えば、以下のコードはトランスポート内のソケットオブジェクトを取得しようとし" "ます::" -#: ../../library/asyncio-protocol.rst:182 msgid "" "sock = transport.get_extra_info('socket')\n" "if sock is not None:\n" " print(sock.getsockopt(...))" msgstr "" +"sock = transport.get_extra_info('socket')\n" +"if sock is not None:\n" +" print(sock.getsockopt(...))" #: ../../library/asyncio-protocol.rst:186 msgid "Categories of information that can be queried on some transports:" @@ -566,7 +568,6 @@ msgstr "" "が *low* の値以下になると :meth:`~BaseProtocol.resume_writing` メソッドが呼び" "出されます。" -#: ../../library/asyncio-protocol.rst:315 msgid "" "The defaults are implementation-specific. If only the high watermark is " "given, the low watermark defaults to an implementation-specific value less " @@ -577,13 +578,16 @@ msgid "" "Use of zero for either limit is generally sub-optimal as it reduces " "opportunities for doing I/O and computation concurrently." msgstr "" -"デフォルト値は実装固有になります。 *high* のみ与えられた場合、 *low* は " -"*high* 以下の実装固有のデフォルト値になります。 *high* をゼロに設定すると " -"*low* も強制的にゼロになり、バッファーが空でなくなるとすぐに :meth:" -"`~BaseProtocol.pause_writing` メソッドが呼び出されるようになります。 *low* を" -"ゼロに設定すると、バッファーが空にな :meth:`~BaseProtocol.resume_writing` が" -"呼び出されるようになります。どちらかにゼロを設定することは I/O と計算を並行に" -"実行する機会を減少させるため、一般に最適ではありません。" +"デフォルト値は実装固有になります。\n" +"*high* のみ与えられた場合、 *low* は *high* 以下の実装固有のデフォルト値にな" +"ります。\n" +"*high* をゼロに設定すると *low* も強制的にゼロになり、バッファーが空でなくな" +"るとすぐに :meth:`~BaseProtocol.pause_writing` メソッドが呼び出されるようにな" +"ります。\n" +"*low* をゼロに設定すると、バッファーが空になって初めて :meth:`~BaseProtocol." +"resume_writing` が呼び出されるようになります。\n" +"どちらかにゼロを設定することは I/O と計算を並行に実行する機会を減少させるた" +"め、一般に最適ではありません。" #: ../../library/asyncio-protocol.rst:326 msgid "Use :meth:`~WriteTransport.get_write_buffer_limits` to get the limits." @@ -667,9 +671,8 @@ msgstr "" "` メソッドが引数 :const:`None` で呼び出されま" "す。" -#: ../../library/asyncio-protocol.rst:382 msgid "Subprocess Transports" -msgstr "サブプロセス化されたトランスポート" +msgstr "サブプロセストランスポート" #: ../../library/asyncio-protocol.rst:386 msgid "Return the subprocess process id as an integer." @@ -855,15 +858,15 @@ msgstr "" msgid "Connection Callbacks" msgstr "通信のコールバック" -#: ../../library/asyncio-protocol.rst:492 msgid "" "Connection callbacks are called on all protocols, exactly once per a " "successful connection. All other protocol callbacks can only be called " "between those two methods." msgstr "" -"コネクションコールバックは全てのプロトコルから、成功したコネクションそれぞれ" -"につきただ一度だけ呼び出されます。その他の全てのプロトコルコールバックはこれ" -"ら2つのメソッドの間に呼び出すことができます。 " +"コネクションコールバックはすべてのプロトコルに対して、成功した接続ごとにそれ" +"ぞれ一度だけ呼び出されます。\n" +"他のプロトコルコールバックは、これら二つのメソッドの呼び出しの間にのみ呼び出" +"されます。" #: ../../library/asyncio-protocol.rst:498 msgid "Called when a connection is made." @@ -887,9 +890,9 @@ msgid "" "means a regular EOF is received, or the connection was aborted or closed by " "this side of the connection." msgstr "" -"引数は例外オブジェクトまたは :const:`None` になります。:const:`None` のとき、" -"通常の EOF が受信されたか、あるいはコネクションがこちら側から中止またはクロー" -"ズされたことを意味します。" +"引数は例外オブジェクトまたは :const:`None` になります。 ``None`` のとき、通常" +"の EOF が受信されたか、あるいはコネクションがこちら側から中止またはクローズさ" +"れたことを意味します。" #: ../../library/asyncio-protocol.rst:514 msgid "Flow Control Callbacks" @@ -932,16 +935,15 @@ msgstr "" "pause_writing` は呼び出されません: バッファーサイズは必ず制限値を超えなければ" "なりません。" -#: ../../library/asyncio-protocol.rst:533 msgid "" "Conversely, :meth:`~BaseProtocol.resume_writing` is called when the buffer " "size is equal or lower than the low watermark. These end conditions are " "important to ensure that things go as expected when either mark is zero." msgstr "" "それに対して、 :meth:`~BaseProtocol.resume_writing` はバッファーサイズが最低" -"水位点と等しいかそれよりも小さい場合に呼び出されます。これらの境界条件は、ど" -"ちらの基準値もゼロである場合の処理が期待通りとなることを保証するために重要で" -"す。" +"水位点と等しいかそれよりも小さい場合に呼び出されます。\n" +"これらの境界条件は、どちらかの基準値がゼロである場合の処理が期待通りとなるこ" +"とを保証するために重要です。" #: ../../library/asyncio-protocol.rst:540 msgid "Streaming Protocols" @@ -1036,13 +1038,16 @@ msgstr "" msgid "State machine:" msgstr "ステートマシン:" -#: ../../library/asyncio-protocol.rst:585 msgid "" "start -> connection_made\n" " [-> data_received]*\n" " [-> eof_received]?\n" "-> connection_lost -> end" msgstr "" +"start -> connection_made\n" +" [-> data_received]*\n" +" [-> eof_received]?\n" +"-> connection_lost -> end" #: ../../library/asyncio-protocol.rst:594 msgid "Buffered Streaming Protocols" @@ -1132,7 +1137,6 @@ msgstr "" "`~BufferedProtocol.get_buffer` と :meth:`~BufferedProtocol.buffer_updated` が" "呼び出されることはありません。" -#: ../../library/asyncio-protocol.rst:643 msgid "" "start -> connection_made\n" " [-> get_buffer\n" @@ -1141,6 +1145,12 @@ msgid "" " [-> eof_received]?\n" "-> connection_lost -> end" msgstr "" +"start -> connection_made\n" +" [-> get_buffer\n" +" [-> buffer_updated]?\n" +" ]*\n" +" [-> eof_received]?\n" +"-> connection_lost -> end" #: ../../library/asyncio-protocol.rst:654 msgid "Datagram Protocols" @@ -1183,15 +1193,15 @@ msgstr "" "どの場合、データグラムが配信できなければそのまま通知されることなく破棄されま" "す。" -#: ../../library/asyncio-protocol.rst:677 msgid "" "On BSD systems (macOS, FreeBSD, etc.) flow control is not supported for " "datagram protocols, because there is no reliable way to detect send failures " "caused by writing too many packets." msgstr "" -"BSD システム (macOS, FreeBSD など) ではフロー制御はサポートされていません。こ" -"れは非常に多くのパケットを書き込もうとしたことによる送信の失敗を検出する信頼" -"できる方法が存在しないためです。" +"BSD システム (macOS, FreeBSD など) ではデータグラムプロトコルのフロー制御はサ" +"ポートされていません。\n" +"これは非常に多くのパケットを書き込もうとしたことによる送信の失敗を検出する信" +"頼できる方法が存在しないためです。" #: ../../library/asyncio-protocol.rst:681 msgid "" @@ -1249,14 +1259,12 @@ msgstr "*fd* はクローズされたファイル記述子を表す整数です msgid "Called when the child process has exited." msgstr "子プロセスが終了したときに呼び出されます。" -#: ../../library/asyncio-protocol.rst:716 msgid "" "It can be called before :meth:`~SubprocessProtocol.pipe_data_received` and :" "meth:`~SubprocessProtocol.pipe_connection_lost` methods." msgstr "" -"これは、 :meth:`~SubprocessProtocol.pipe_data_received` と :meth:" -"`~SubprocessProtocol.pipe_connection_lost` メソッドの前に呼び出すことができま" -"す。" +":meth:`~SubprocessProtocol.pipe_data_received` や :meth:`~SubprocessProtocol." +"pipe_connection_lost` より先に呼び出されることもあります。" #: ../../library/asyncio-protocol.rst:721 msgid "Examples" @@ -1274,7 +1282,6 @@ msgstr "" ":meth:`loop.create_server` メソッドを使って TCP エコーサーバーを生成し、受信" "したデータをそのまま送り返して、最後にコネクションをクローズします::" -#: ../../library/asyncio-protocol.rst:731 msgid "" "import asyncio\n" "\n" @@ -1311,6 +1318,39 @@ msgid "" "\n" "asyncio.run(main())" msgstr "" +"import asyncio\n" +"\n" +"\n" +"class EchoServerProtocol(asyncio.Protocol):\n" +" def connection_made(self, transport):\n" +" peername = transport.get_extra_info('peername')\n" +" print('Connection from {}'.format(peername))\n" +" self.transport = transport\n" +"\n" +" def data_received(self, data):\n" +" message = data.decode()\n" +" print('Data received: {!r}'.format(message))\n" +"\n" +" print('Send: {!r}'.format(message))\n" +" self.transport.write(data)\n" +"\n" +" print('Close the client socket')\n" +" self.transport.close()\n" +"\n" +"\n" +"async def main():\n" +" # 低水準 API を使うため、イベントループへの参照を取得する。\n" +" loop = asyncio.get_running_loop()\n" +"\n" +" server = await loop.create_server(\n" +" EchoServerProtocol,\n" +" '127.0.0.1', 8888)\n" +"\n" +" async with server:\n" +" await server.serve_forever()\n" +"\n" +"\n" +"asyncio.run(main())" #: ../../library/asyncio-protocol.rst:769 msgid "" @@ -1332,7 +1372,6 @@ msgstr "" ":meth:`loop.create_connection` メソッドを使った TCP エコークライアントは、" "データを送信したあとコネクションがクローズされるまで待機します::" -#: ../../library/asyncio-protocol.rst:780 msgid "" "import asyncio\n" "\n" @@ -1376,6 +1415,46 @@ msgid "" "\n" "asyncio.run(main())" msgstr "" +"import asyncio\n" +"\n" +"\n" +"class EchoClientProtocol(asyncio.Protocol):\n" +" def __init__(self, message, on_con_lost):\n" +" self.message = message\n" +" self.on_con_lost = on_con_lost\n" +"\n" +" def connection_made(self, transport):\n" +" transport.write(self.message.encode())\n" +" print('Data sent: {!r}'.format(self.message))\n" +"\n" +" def data_received(self, data):\n" +" print('Data received: {!r}'.format(data.decode()))\n" +"\n" +" def connection_lost(self, exc):\n" +" print('The server closed the connection')\n" +" self.on_con_lost.set_result(True)\n" +"\n" +"\n" +"async def main():\n" +" # 低水準 API を使うため、イベントループへの参照を取得する。\n" +" loop = asyncio.get_running_loop()\n" +"\n" +" on_con_lost = loop.create_future()\n" +" message = 'Hello World!'\n" +"\n" +" transport, protocol = await loop.create_connection(\n" +" lambda: EchoClientProtocol(message, on_con_lost),\n" +" '127.0.0.1', 8888)\n" +"\n" +" # プロトコルが接続の切断を通知するまで待ち、\n" +" # トランスポートを閉じる。\n" +" try:\n" +" await on_con_lost\n" +" finally:\n" +" transport.close()\n" +"\n" +"\n" +"asyncio.run(main())" #: ../../library/asyncio-protocol.rst:825 msgid "" @@ -1398,7 +1477,6 @@ msgstr "" ":meth:`loop.create_datagram_endpoint` メソッドを使った UDP エコーサーバーは受" "信したデータをそのまま送り返します::" -#: ../../library/asyncio-protocol.rst:837 msgid "" "import asyncio\n" "\n" @@ -1435,6 +1513,39 @@ msgid "" "\n" "asyncio.run(main())" msgstr "" +"import asyncio\n" +"\n" +"\n" +"class EchoServerProtocol:\n" +" def connection_made(self, transport):\n" +" self.transport = transport\n" +"\n" +" def datagram_received(self, data, addr):\n" +" message = data.decode()\n" +" print('Received %r from %s' % (message, addr))\n" +" print('Send %r to %s' % (message, addr))\n" +" self.transport.sendto(data, addr)\n" +"\n" +"\n" +"async def main():\n" +" print(\"Starting UDP server\")\n" +"\n" +" # 低水準 API を使うため、イベントループへの参照を取得する。\n" +" loop = asyncio.get_running_loop()\n" +"\n" +" # 一つのプロトコルインスタンスで、\n" +" # すべてのクライアント要求を処理する。\n" +" transport, protocol = await loop.create_datagram_endpoint(\n" +" EchoServerProtocol,\n" +" local_addr=('127.0.0.1', 9999))\n" +"\n" +" try:\n" +" await asyncio.sleep(3600) # 1 時間処理を続ける。\n" +" finally:\n" +" transport.close()\n" +"\n" +"\n" +"asyncio.run(main())" #: ../../library/asyncio-protocol.rst:876 msgid "UDP Echo Client" @@ -1448,7 +1559,6 @@ msgstr "" ":meth:`loop.create_datagram_endpoint` メソッドを使った UDP エコークライアント" "はデータを送信し、応答を受信するとトランスポートをクローズします::" -#: ../../library/asyncio-protocol.rst:881 msgid "" "import asyncio\n" "\n" @@ -1498,6 +1608,52 @@ msgid "" "\n" "asyncio.run(main())" msgstr "" +"import asyncio\n" +"\n" +"\n" +"class EchoClientProtocol:\n" +" def __init__(self, message, on_con_lost):\n" +" self.message = message\n" +" self.on_con_lost = on_con_lost\n" +" self.transport = None\n" +"\n" +" def connection_made(self, transport):\n" +" self.transport = transport\n" +" print('Send:', self.message)\n" +" self.transport.sendto(self.message.encode())\n" +"\n" +" def datagram_received(self, data, addr):\n" +" print(\"Received:\", data.decode())\n" +"\n" +" print(\"Close the socket\")\n" +" self.transport.close()\n" +"\n" +" def error_received(self, exc):\n" +" print('Error received:', exc)\n" +"\n" +" def connection_lost(self, exc):\n" +" print(\"Connection closed\")\n" +" self.on_con_lost.set_result(True)\n" +"\n" +"\n" +"async def main():\n" +" # 低水準 API を使うため、イベントループへの参照を取得する。\n" +" loop = asyncio.get_running_loop()\n" +"\n" +" on_con_lost = loop.create_future()\n" +" message = \"Hello World!\"\n" +"\n" +" transport, protocol = await loop.create_datagram_endpoint(\n" +" lambda: EchoClientProtocol(message, on_con_lost),\n" +" remote_addr=('127.0.0.1', 9999))\n" +"\n" +" try:\n" +" await on_con_lost\n" +" finally:\n" +" transport.close()\n" +"\n" +"\n" +"asyncio.run(main())" #: ../../library/asyncio-protocol.rst:933 msgid "Connecting Existing Sockets" @@ -1511,7 +1667,6 @@ msgstr "" "プロトコルを設定した :meth:`loop.create_connection` メソッドを使ってソケット" "がデータを受信するまで待機します::" -#: ../../library/asyncio-protocol.rst:938 msgid "" "import asyncio\n" "import socket\n" @@ -1562,6 +1717,53 @@ msgid "" "\n" "asyncio.run(main())" msgstr "" +"import asyncio\n" +"import socket\n" +"\n" +"\n" +"class MyProtocol(asyncio.Protocol):\n" +"\n" +" def __init__(self, on_con_lost):\n" +" self.transport = None\n" +" self.on_con_lost = on_con_lost\n" +"\n" +" def connection_made(self, transport):\n" +" self.transport = transport\n" +"\n" +" def data_received(self, data):\n" +" print(\"Received:\", data.decode())\n" +"\n" +" # 処理が済んだのでトランスポートを閉じる。\n" +" # connection_lost() は自動的に呼び出される。\n" +" self.transport.close()\n" +"\n" +" def connection_lost(self, exc):\n" +" # ソケットが閉じられた\n" +" self.on_con_lost.set_result(True)\n" +"\n" +"\n" +"async def main():\n" +" # 低水準 API を使うため、イベントループへの参照を取得する。\n" +" loop = asyncio.get_running_loop()\n" +" on_con_lost = loop.create_future()\n" +"\n" +" # 接続されたソケットのペアを作成する\n" +" rsock, wsock = socket.socketpair()\n" +"\n" +" # データを待ち受けるためにソケットを登録する。\n" +" transport, protocol = await loop.create_connection(\n" +" lambda: MyProtocol(on_con_lost), sock=rsock)\n" +"\n" +" # ネットワークからのデータ受信を模倣する。\n" +" loop.call_soon(wsock.send, 'abc'.encode())\n" +"\n" +" try:\n" +" await protocol.on_con_lost\n" +" finally:\n" +" transport.close()\n" +" wsock.close()\n" +"\n" +"asyncio.run(main())" #: ../../library/asyncio-protocol.rst:989 msgid "" diff --git a/library/asyncio-queue.po b/library/asyncio-queue.po index a9161d8d9..f8161ea3f 100644 --- a/library/asyncio-queue.po +++ b/library/asyncio-queue.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: Arihiro TAKASE, 2023\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/asyncio-queue.rst:7 @@ -103,11 +103,12 @@ msgstr "キューが空ならば ``True`` を、そうでなければ ``False`` msgid "Return ``True`` if there are :attr:`maxsize` items in the queue." msgstr "キューに要素が :attr:`maxsize` 個あれば ``True`` を返します。" -#: ../../library/asyncio-queue.rst:57 msgid "" "If the queue was initialized with ``maxsize=0`` (the default), then :meth:" "`full` never returns ``True``." msgstr "" +"``maxsize=0`` (デフォルト) で初期化したキューでは、:meth:`full` が ``True`` " +"を返すことはありません。" #: ../../library/asyncio-queue.rst:63 msgid "" @@ -117,18 +118,18 @@ msgstr "" "キューから要素を削除して返します。キューが空の場合項目が利用可能になるまで待" "機します。" -#: ../../library/asyncio-queue.rst:66 msgid "" "Raises :exc:`QueueShutDown` if the queue has been shut down and is empty, or " "if the queue has been shut down immediately." msgstr "" +"キューがシャットダウン済みで空の場合、または即時シャットダウンされた場合は、:" +"exc:`QueueShutDown` を送出します。" -#: ../../library/asyncio-queue.rst:71 msgid "" "Return an item if one is immediately available, else raise :exc:`QueueEmpty`." msgstr "" -"直ちに利用できるアイテムがあるときはそれを、そうでなければ :exc:`QueueEmpty` " -"を返します。" +"直ちに利用できる要素がある場合はその要素を返し、そうでなければ :exc:" +"`QueueEmpty` を送出します。" #: ../../library/asyncio-queue.rst:77 msgid "Block until all items in the queue have been received and processed." @@ -155,9 +156,8 @@ msgstr "" "要素をキューに入力します。キューが満杯の場合、要素を追加する前に空きスロット" "が利用できるようになるまで待機します。" -#: ../../library/asyncio-queue.rst:91 msgid "Raises :exc:`QueueShutDown` if the queue has been shut down." -msgstr "" +msgstr "キューがシャットダウン済みの場合、:exc:`QueueShutDown` を送出します。" #: ../../library/asyncio-queue.rst:95 msgid "Put an item into the queue without blocking." @@ -192,16 +192,17 @@ msgid "" "join`." msgstr "" -#: ../../library/asyncio-queue.rst:121 msgid "Indicate that a formerly enqueued work item is complete." -msgstr "" +msgstr "キューに投入されていた作業項目の処理が完了したことを通知します。" -#: ../../library/asyncio-queue.rst:123 msgid "" "Used by queue consumers. For each :meth:`~Queue.get` used to fetch a work " "item, a subsequent call to :meth:`task_done` tells the queue that the " "processing on the work item is complete." msgstr "" +"キューから作業を取り出す側が使います。\n" +":meth:`~Queue.get` で作業項目を取り出すたびに、処理後に :meth:`task_done` を" +"呼び出して、作業が完了したことをキューに伝えます。" #: ../../library/asyncio-queue.rst:127 msgid "" @@ -219,25 +220,21 @@ msgid "" "in the queue." msgstr "" -#: ../../library/asyncio-queue.rst:135 msgid "" "Raises :exc:`ValueError` if called more times than there were items placed " "in the queue." msgstr "" -"キューに追加されているアイテム数以上の呼び出しが行われたときに :exc:" -"`ValueError` を送出します。" +"呼び出し回数がキューに追加されたアイテムの総数を超えると :exc:`ValueError` を" +"送出します。" #: ../../library/asyncio-queue.rst:140 msgid "Priority Queue" msgstr "優先度付きのキュー" -#: ../../library/asyncio-queue.rst:144 msgid "" "A variant of :class:`Queue`; retrieves entries in priority order (lowest " "first)." -msgstr "" -":class:`Queue` の変種です; 優先順位にしたがって要素を取り出します (最低順位が" -"最初に取り出されます)。" +msgstr ":class:`Queue` の一種で、優先度の値が小さい要素から取り出します。" #: ../../library/asyncio-queue.rst:147 msgid "Entries are typically tuples of the form ``(priority_number, data)``." @@ -292,7 +289,6 @@ msgstr "" "キューを使って、並行処理を行う複数のタスクにワークロードを分散させることがで" "きます::" -#: ../../library/asyncio-queue.rst:191 msgid "" "import asyncio\n" "import random\n" @@ -348,3 +344,56 @@ msgid "" "\n" "asyncio.run(main())" msgstr "" +"import asyncio\n" +"import random\n" +"import time\n" +"\n" +"\n" +"async def worker(name, queue):\n" +" while True:\n" +" # キューから作業項目を取り出す。\n" +" sleep_for = await queue.get()\n" +"\n" +" # sleep_for 秒スリープする。\n" +" await asyncio.sleep(sleep_for)\n" +"\n" +" # 作業項目の処理が完了したことをキューに通知する。\n" +" queue.task_done()\n" +"\n" +" print(f'{name} has slept for {sleep_for:.2f} seconds')\n" +"\n" +"\n" +"async def main():\n" +" # 作業を格納するキューを作成する。\n" +" queue = asyncio.Queue()\n" +"\n" +" # ランダムな待ち時間を生成してキューに追加する。\n" +" total_sleep_time = 0\n" +" for _ in range(20):\n" +" sleep_for = random.uniform(0.05, 1.0)\n" +" total_sleep_time += sleep_for\n" +" queue.put_nowait(sleep_for)\n" +"\n" +" # キューを並行して処理する三つのワーカータスクを作成する。\n" +" tasks = []\n" +" for i in range(3):\n" +" task = asyncio.create_task(worker(f'worker-{i}', queue))\n" +" tasks.append(task)\n" +"\n" +" # キューの全項目の処理が完了するまで待つ。\n" +" started_at = time.monotonic()\n" +" await queue.join()\n" +" total_slept_for = time.monotonic() - started_at\n" +"\n" +" # ワーカータスクをキャンセルする。\n" +" for task in tasks:\n" +" task.cancel()\n" +" # すべてのワーカータスクのキャンセルが完了するまで待つ。\n" +" await asyncio.gather(*tasks, return_exceptions=True)\n" +"\n" +" print('====')\n" +" print(f'3 workers slept in parallel for {total_slept_for:.2f} seconds')\n" +" print(f'total expected sleep time: {total_sleep_time:.2f} seconds')\n" +"\n" +"\n" +"asyncio.run(main())" diff --git a/library/asyncio-runner.po b/library/asyncio-runner.po index 6515337d6..46c8b8ada 100644 --- a/library/asyncio-runner.po +++ b/library/asyncio-runner.po @@ -18,19 +18,18 @@ msgstr "" "Last-Translator: 菊池 健志, 2023\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" -#: ../../library/asyncio-runner.rst:6 msgid "Runners" -msgstr "" +msgstr "Runner" #: ../../library/asyncio-runner.rst:8 msgid "**Source code:** :source:`Lib/asyncio/runners.py`" -msgstr "" +msgstr "**ソースコード:** :source:`Lib/asyncio/runners.py`" #: ../../library/asyncio-runner.rst:11 msgid "" @@ -52,19 +51,18 @@ msgstr "" msgid "Running an asyncio Program" msgstr "非同期プログラムの実行" -#: ../../library/asyncio-runner.rst:27 msgid "Execute *coro* in an asyncio event loop and return the result." -msgstr "" +msgstr "asyncio のイベントループで *coro* を実行し、その結果を返します。" -#: ../../library/asyncio-runner.rst:29 ../../library/asyncio-runner.rst:121 msgid "The argument can be any awaitable object." -msgstr "" +msgstr "引数には任意の awaitable オブジェクトを指定できます。" -#: ../../library/asyncio-runner.rst:31 msgid "" "This function runs the awaitable, taking care of managing the asyncio event " "loop, *finalizing asynchronous generators*, and closing the executor." msgstr "" +"この関数は awaitable を実行し、asyncio のイベントループの管理、*非同期ジェネ" +"レーターの終了処理*、Executor の終了処理を行います。" #: ../../library/asyncio-runner.rst:35 ../../library/asyncio-runner.rst:131 msgid "" @@ -84,7 +82,6 @@ msgstr "" "``False`` は明示的にデバッグモードを無効化します。 グローバルな :ref:" "`asyncio-debug-mode` 設定を尊重するために ``None`` が使用されます。" -#: ../../library/asyncio-runner.rst:42 msgid "" "If *loop_factory* is not ``None``, it is used to create a new event loop; " "otherwise :func:`asyncio.new_event_loop` is used. The loop is closed at the " @@ -93,19 +90,29 @@ msgid "" "*loop_factory* to configure the event loop instead of policies. Passing :" "class:`asyncio.EventLoop` allows running asyncio without the policy system." msgstr "" +"*loop_factory* が ``None`` でなければ、それを使って新しいイベントループを作成" +"します。\n" +"それ以外の場合は :func:`asyncio.new_event_loop` を使います。\n" +"終了時にループを閉じます。\n" +"この関数は asyncio プログラムのメインのエントリーポイントとして使い、できれば" +"一度だけ呼び出してください。\n" +"イベントループの設定には、ポリシーの代わりに *loop_factory* を使うことを推奨" +"します。\n" +":class:`asyncio.EventLoop` を渡すと、ポリシーシステムを使わずに asyncio を実" +"行できます。" -#: ../../library/asyncio-runner.rst:50 msgid "" "The executor is given a timeout duration of 5 minutes to shutdown. If the " "executor hasn't finished within that duration, a warning is emitted and the " "executor is closed." msgstr "" +"Executor の終了を待つ制限時間は 5 分です。\n" +"その時間内に終了しなければ、警告を出して Executor の終了処理を行います。" #: ../../library/asyncio-runner.rst:54 msgid "Example::" msgstr "以下はプログラム例です::" -#: ../../library/asyncio-runner.rst:56 msgid "" "async def main():\n" " await asyncio.sleep(1)\n" @@ -113,6 +120,11 @@ msgid "" "\n" "asyncio.run(main())" msgstr "" +"async def main():\n" +" await asyncio.sleep(1)\n" +" print('hello')\n" +"\n" +"asyncio.run(main())" #: ../../library/asyncio-runner.rst:64 msgid "Updated to use :meth:`loop.shutdown_default_executor`." @@ -128,22 +140,22 @@ msgstr "" #: ../../library/asyncio-runner.rst:73 msgid "Added *loop_factory* parameter." -msgstr "" +msgstr "*loop_factory* 引数が追加されました。" -#: ../../library/asyncio-runner.rst:77 ../../library/asyncio-runner.rst:136 msgid "*coro* can be any awaitable object." -msgstr "" +msgstr "*coro* に任意の awaitable オブジェクトを指定できるようになりました。" -#: ../../library/asyncio-runner.rst:81 msgid "" "The :mod:`!asyncio` policy system is deprecated and will be removed in " "Python 3.16; from there on, an explicit *loop_factory* is needed to " "configure the event loop." msgstr "" +":mod:`!asyncio` のポリシーシステムは非推奨で、Python 3.16 で削除されます。\n" +"それ以降、イベントループを設定するには *loop_factory* を明示的に指定する必要" +"があります。" -#: ../../library/asyncio-runner.rst:87 msgid "Runner context manager" -msgstr "" +msgstr "Runner コンテキストマネージャー" #: ../../library/asyncio-runner.rst:91 msgid "" @@ -153,27 +165,31 @@ msgstr "" "同じコンテキスト上での *複数* の非同期関数呼び出しをシンプルにするコンテキス" "トマネージャ。" -#: ../../library/asyncio-runner.rst:94 msgid "" "Sometimes several top-level async functions should be called in the same :" "ref:`event loop ` and :class:`contextvars.Context`." msgstr "" +"複数のトップレベルの非同期関数を、同じ :ref:`イベントループ ` と :class:`contextvars.Context` で呼び出したい場合があります。" -#: ../../library/asyncio-runner.rst:101 msgid "" "*loop_factory* could be used for overriding the loop creation. It is the " "responsibility of the *loop_factory* to set the created loop as the current " "one. By default :func:`asyncio.new_event_loop` is used and set as current " "event loop with :func:`asyncio.set_event_loop` if *loop_factory* is ``None``." msgstr "" +"*loop_factory* で、ループの作成方法を変更できます。\n" +"作成したループを現在のループとして設定するのは *loop_factory* の役割です。\n" +"*loop_factory* が ``None`` の場合は、デフォルトで :func:`asyncio." +"new_event_loop` を使い、:func:`asyncio.set_event_loop` で現在のイベントループ" +"に設定します。" -#: ../../library/asyncio-runner.rst:106 msgid "" "Basically, :func:`asyncio.run` example can be rewritten with the runner " "usage::" msgstr "" +":func:`asyncio.run` の例は、Runner を使って次のように書き換えられます。 ::" -#: ../../library/asyncio-runner.rst:108 msgid "" "async def main():\n" " await asyncio.sleep(1)\n" @@ -182,84 +198,95 @@ msgid "" "with asyncio.Runner() as runner:\n" " runner.run(main())" msgstr "" +"async def main():\n" +" await asyncio.sleep(1)\n" +" print('hello')\n" +"\n" +"with asyncio.Runner() as runner:\n" +" runner.run(main())" -#: ../../library/asyncio-runner.rst:119 msgid "Execute *coro* in the embedded event loop." -msgstr "" +msgstr "内部のイベントループで *coro* を実行します。" -#: ../../library/asyncio-runner.rst:123 msgid "If the argument is a coroutine, it is wrapped in a Task." -msgstr "" +msgstr "引数がコルーチンの場合、Task でラップします。" -#: ../../library/asyncio-runner.rst:125 msgid "" "An optional keyword-only *context* argument allows specifying a custom :" "class:`contextvars.Context` for the code to run in. The runner's default " "context is used if context is ``None``." msgstr "" +"省略可能なキーワード専用引数 *context* には、コードの実行に使う :class:" +"`contextvars.Context` を指定できます。\n" +"``context`` が ``None`` の場合は、Runner のデフォルトのコンテキストを使いま" +"す。" -#: ../../library/asyncio-runner.rst:129 msgid "Returns the awaitable's result or raises an exception." -msgstr "" +msgstr "awaitable の結果を返すか、例外を送出します。" -#: ../../library/asyncio-runner.rst:140 msgid "Close the runner." -msgstr "" +msgstr "Runner を閉じます。" -#: ../../library/asyncio-runner.rst:142 msgid "" "Finalize asynchronous generators, shutdown default executor, close the event " "loop and release embedded :class:`contextvars.Context`." msgstr "" +"非同期ジェネレーターの終了処理を行い、デフォルトの Executor とイベントループ" +"を閉じ、内部の :class:`contextvars.Context` を解放します。" -#: ../../library/asyncio-runner.rst:147 msgid "Return the event loop associated with the runner instance." -msgstr "" +msgstr "Runner インスタンスに関連付けられたイベントループを返します。" -#: ../../library/asyncio-runner.rst:151 msgid "" ":class:`Runner` uses the lazy initialization strategy, its constructor " "doesn't initialize underlying low-level structures." msgstr "" +":class:`Runner` は遅延初期化を採用しており、コンストラクターでは内部の低水準" +"なデータ構造を初期化しません。" -#: ../../library/asyncio-runner.rst:154 msgid "" "Embedded *loop* and *context* are created at the :keyword:`with` body " "entering or the first call of :meth:`run` or :meth:`get_loop`." msgstr "" +"内部の *loop* と *context* は、:keyword:`with` 文の本体に入るとき、または :" +"meth:`run` か :meth:`get_loop` を初めて呼び出すときに作成されます。" -#: ../../library/asyncio-runner.rst:159 msgid "Handling Keyboard Interruption" -msgstr "" +msgstr "キーボード割り込みの処理" -#: ../../library/asyncio-runner.rst:163 msgid "" "When :const:`signal.SIGINT` is raised by :kbd:`Ctrl-C`, :exc:" "`KeyboardInterrupt` exception is raised in the main thread by default. " "However this doesn't work with :mod:`asyncio` because it can interrupt " "asyncio internals and can hang the program from exiting." msgstr "" +":kbd:`Ctrl-C` で :const:`signal.SIGINT` が発生すると、デフォルトではメインス" +"レッドで :exc:`KeyboardInterrupt` が送出されます。\n" +"しかし :mod:`asyncio` では、内部の処理が中断されてプログラムが終了できなくな" +"る可能性があるため、この動作は適していません。" -#: ../../library/asyncio-runner.rst:168 msgid "" "To mitigate this issue, :mod:`asyncio` handles :const:`signal.SIGINT` as " "follows:" msgstr "" +"この問題を軽減するため、:mod:`asyncio` は :const:`signal.SIGINT` を次のように" +"処理します。" -#: ../../library/asyncio-runner.rst:170 msgid "" ":meth:`asyncio.Runner.run` installs a custom :const:`signal.SIGINT` handler " "before any user code is executed and removes it when exiting from the " "function." msgstr "" +":meth:`asyncio.Runner.run` はユーザーコードの実行前に独自の :const:`signal." +"SIGINT` ハンドラーを設定し、関数を終了するときに取り除きます。" -#: ../../library/asyncio-runner.rst:172 msgid "" "The :class:`~asyncio.Runner` creates the main task for the passed coroutine " "for its execution." msgstr "" +":class:`~asyncio.Runner` は、渡されたコルーチンを実行するメインタスクを作成し" +"ます。" -#: ../../library/asyncio-runner.rst:174 msgid "" "When :const:`signal.SIGINT` is raised by :kbd:`Ctrl-C`, the custom signal " "handler cancels the main task by calling :meth:`asyncio.Task.cancel` which " @@ -268,11 +295,22 @@ msgid "" "used for resource cleanup. After the main task is cancelled, :meth:`asyncio." "Runner.run` raises :exc:`KeyboardInterrupt`." msgstr "" +":kbd:`Ctrl-C` によって :const:`signal.SIGINT` が発生すると、独自のシグナルハ" +"ンドラーが :meth:`asyncio.Task.cancel` を呼び出してメインタスクをキャンセルし" +"ます。\n" +"これにより、メインタスク内で :exc:`asyncio.CancelledError` が送出されます。\n" +"Python のスタックが巻き戻されるため、``try/except`` や ``try/finally`` ブロッ" +"クでリソースを解放できます。\n" +"メインタスクのキャンセル後、:meth:`asyncio.Runner.run` は :exc:" +"`KeyboardInterrupt` を送出します。" -#: ../../library/asyncio-runner.rst:180 msgid "" "A user could write a tight loop which cannot be interrupted by :meth:" "`asyncio.Task.cancel`, in which case the second following :kbd:`Ctrl-C` " "immediately raises the :exc:`KeyboardInterrupt` without cancelling the main " "task." msgstr "" +"ユーザーが書いたループが処理を譲らずに繰り返し続け、:meth:`asyncio.Task." +"cancel` で中断できない場合があります。\n" +"その場合、2 回目の :kbd:`Ctrl-C` はメインタスクをキャンセルせず、即座に :exc:" +"`KeyboardInterrupt` を送出します。" diff --git a/library/asyncio-stream.po b/library/asyncio-stream.po index 8c4a6fe52..b11fb6ba4 100644 --- a/library/asyncio-stream.po +++ b/library/asyncio-stream.po @@ -19,10 +19,10 @@ msgstr "" "Last-Translator: Rafael Fontenelle , 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/asyncio-stream.rst:7 @@ -48,7 +48,6 @@ msgid "Here is an example of a TCP echo client written using asyncio streams::" msgstr "" "以下は asyncio ストリームを使って書いた TCP エコークライアントの例です::" -#: ../../library/asyncio-stream.rst:22 ../../library/asyncio-stream.rst:430 msgid "" "import asyncio\n" "\n" @@ -69,6 +68,24 @@ msgid "" "\n" "asyncio.run(tcp_echo_client('Hello World!'))" msgstr "" +"import asyncio\n" +"\n" +"async def tcp_echo_client(message):\n" +" reader, writer = await asyncio.open_connection(\n" +" '127.0.0.1', 8888)\n" +"\n" +" print(f'Send: {message!r}')\n" +" writer.write(message.encode())\n" +" await writer.drain()\n" +"\n" +" data = await reader.read(100)\n" +" print(f'Received: {data.decode()!r}')\n" +"\n" +" print('Close the connection')\n" +" writer.close()\n" +" await writer.wait_closed()\n" +"\n" +"asyncio.run(tcp_echo_client('Hello World!'))" #: ../../library/asyncio-stream.rst:42 msgid "See also the `Examples`_ section below." @@ -116,16 +133,19 @@ msgid "" "create_connection`." msgstr "残りの引数は直接 :meth:`loop.create_connection` に渡されます。" -#: ../../library/asyncio-stream.rst:74 ../../library/asyncio-stream.rst:154 msgid "" "The *sock* argument transfers ownership of the socket to the :class:" "`StreamWriter` created. To close the socket, call its :meth:`~asyncio." "StreamWriter.close` method." msgstr "" +"*sock* 引数を渡すと、ソケットの所有権は作成された :class:`StreamWriter` に移" +"ります。\n" +"ソケットを閉じるには、その :meth:`~asyncio.StreamWriter.close` メソッドを呼び" +"出してください。" #: ../../library/asyncio-stream.rst:78 msgid "Added the *ssl_handshake_timeout* parameter." -msgstr "" +msgstr "*ssl_handshake_timeout* 引数が追加されました。" #: ../../library/asyncio-stream.rst:81 msgid "Added the *happy_eyeballs_delay* and *interleave* parameters." @@ -173,20 +193,21 @@ msgid "" "The rest of the arguments are passed directly to :meth:`loop.create_server`." msgstr "残りの引数は直接 :meth:`loop.create_server` に渡されます。" -#: ../../library/asyncio-stream.rst:121 ../../library/asyncio-stream.rst:185 msgid "" "The *sock* argument transfers ownership of the socket to the server created. " "To close the socket, call the server's :meth:`~asyncio.Server.close` method." msgstr "" +"*sock* 引数を渡すと、ソケットの所有権は作成されたサーバーに移ります。\n" +"ソケットを閉じるには、サーバーの :meth:`~asyncio.Server.close` メソッドを呼び" +"出してください。" #: ../../library/asyncio-stream.rst:125 msgid "Added the *ssl_handshake_timeout* and *start_serving* parameters." msgstr "" "*ssl_handshake_timeout* と *start_serving* パラメータが追加されました。" -#: ../../library/asyncio-stream.rst:134 msgid "Added the *keep_alive* parameter." -msgstr "" +msgstr "*keep_alive* パラメーターが追加されました。" #: ../../library/asyncio-stream.rst:139 msgid "Unix Sockets" @@ -209,15 +230,15 @@ msgstr "" msgid "See also the documentation of :meth:`loop.create_unix_connection`." msgstr ":meth:`loop.create_unix_connection` のドキュメントも参照してください。" -#: ../../library/asyncio-stream.rst:158 ../../library/asyncio-stream.rst:189 msgid "Availability" -msgstr "" +msgstr "利用可能な環境" -#: ../../library/asyncio-stream.rst:160 msgid "" "Added the *ssl_handshake_timeout* parameter. The *path* parameter can now be " "a :term:`path-like object`" msgstr "" +"*ssl_handshake_timeout* パラメーターが追加されました。\n" +"*path* パラメーターに :term:`path-like object` を指定できるようになりました。" #: ../../library/asyncio-stream.rst:177 msgid "Start a Unix socket server." @@ -231,22 +252,25 @@ msgstr ":func:`start_server` と似ていますが Unix ソケットに対して msgid "See also the documentation of :meth:`loop.create_unix_server`." msgstr ":meth:`loop.create_unix_server` のドキュメントも参照してください。" -#: ../../library/asyncio-stream.rst:191 msgid "" "Added the *ssl_handshake_timeout* and *start_serving* parameters. The *path* " "parameter can now be a :term:`path-like object`." msgstr "" +"*ssl_handshake_timeout* と *start_serving* パラメーターが追加されました。\n" +"*path* パラメーターに :term:`path-like object` を指定できるようになりました。" #: ../../library/asyncio-stream.rst:203 msgid "StreamReader" msgstr "StreamReader" -#: ../../library/asyncio-stream.rst:207 msgid "" "Represents a reader object that provides APIs to read data from the IO " "stream. As an :term:`asynchronous iterable`, the object supports the :" "keyword:`async for` statement." msgstr "" +"I/O ストリームからデータを読み込む API を提供するリーダーオブジェクトです。\n" +":term:`非同期イテラブル ` なので、:keyword:`async " +"for` 文をサポートします。" #: ../../library/asyncio-stream.rst:211 msgid "" @@ -256,9 +280,8 @@ msgstr "" "*StreamReader* オブジェクトを直接インスタンス化することは推奨されません; 代わ" "りに :func:`open_connection` や :func:`start_server` を使ってください。" -#: ../../library/asyncio-stream.rst:217 msgid "Acknowledge the EOF." -msgstr "EOF の肯定応答を行います。" +msgstr "EOF に達したことをストリームに通知します。" #: ../../library/asyncio-stream.rst:222 msgid "Read up to *n* bytes from the stream." @@ -357,17 +380,22 @@ msgstr "" "外が送出され、内部バッファーがリセットされます。このとき :attr:" "`IncompleteReadError.partial` 属性は区切り文字の一部を含むかもしれません。" -#: ../../library/asyncio-stream.rst:275 msgid "" "The *separator* may also be a tuple of separators. In this case the return " "value will be the shortest possible that has any separator as the suffix. " "For the purposes of :exc:`LimitOverrunError`, the shortest possible " "separator is considered to be the one that matched." msgstr "" +"*separator* には、区切り文字のタプルも指定できます。\n" +"この場合、いずれかの区切り文字を末尾に持つ、できる限り短いデータを返しま" +"す。\n" +":exc:`LimitOverrunError` の判定では、該当する最短の区切り文字がマッチしたもの" +"として扱います。" -#: ../../library/asyncio-stream.rst:285 msgid "The *separator* parameter may now be a :class:`tuple` of separators." msgstr "" +"*separator* パラメーターに、区切り文字の :class:`tuple` を指定できるようにな" +"りました。" #: ../../library/asyncio-stream.rst:290 msgid "Return ``True`` if the buffer is empty and :meth:`feed_eof` was called." @@ -407,11 +435,12 @@ msgstr "" msgid "The method should be used along with the ``drain()`` method::" msgstr "このメソッドは ``drain()`` メソッドと組み合わせて使うべきです::" -#: ../../library/asyncio-stream.rst:314 msgid "" "stream.write(data)\n" "await stream.drain()" msgstr "" +"stream.write(data)\n" +"await stream.drain()" #: ../../library/asyncio-stream.rst:319 msgid "" @@ -423,27 +452,30 @@ msgstr "" "を即座に書き込みます。書き込みに失敗した場合、データは送信可能になるまで内部" "の書き込みバッファーに格納されて待機します。" -#: ../../library/asyncio-stream.rst:326 msgid "" "stream.writelines(lines)\n" "await stream.drain()" msgstr "" +"stream.writelines(lines)\n" +"await stream.drain()" #: ../../library/asyncio-stream.rst:331 msgid "The method closes the stream and the underlying socket." msgstr "このメソッドはストリームと背後にあるソケットをクローズします。" -#: ../../library/asyncio-stream.rst:333 msgid "" "The method should be used, though not mandatory, along with the " "``wait_closed()`` method::" msgstr "" +"必須ではありませんが、このメソッドは ``wait_closed()`` と組み合わせて使ってく" +"ださい。 ::" -#: ../../library/asyncio-stream.rst:336 msgid "" "stream.close()\n" "await stream.wait_closed()" msgstr "" +"stream.close()\n" +"await stream.wait_closed()" #: ../../library/asyncio-stream.rst:341 msgid "" @@ -476,13 +508,13 @@ msgstr "" msgid "Wait until it is appropriate to resume writing to the stream. Example::" msgstr "ストリームへの書き込み再開に適切な状態になるまで待ちます。使用例::" -#: ../../library/asyncio-stream.rst:364 msgid "" "writer.write(data)\n" "await writer.drain()" msgstr "" +"writer.write(data)\n" +"await writer.drain()" -#: ../../library/asyncio-stream.rst:367 msgid "" "This is a flow control method that interacts with the underlying IO write " "buffer. When the size of the buffer reaches the high watermark, *drain()* " @@ -490,15 +522,14 @@ msgid "" "writing can be resumed. When there is nothing to wait for, the :meth:" "`drain` returns immediately." msgstr "" -"このメソッドは背後にある IO 書き込みバッファーとやりとりを行うフロー制御メ" -"ソッドです。バッファーのサイズが最高水位点に達した場合、*drain()* はバッファ" -"のサイズが最低水位点を下回るまで減量され、書き込み再開可能になるまで書き込み" -"をブロックします。待ち受けの必要がない場合、 :meth:`drain` は即座にリターンし" -"ます。" +"このメソッドは背後にある IO 書き込みバッファとやりとりを行うフロー制御メソッ" +"ドです。\n" +"バッファのサイズが最高水位点に達すると、*drain()* はサイズが最低水位点まで減" +"り、書き込みを再開できるようになるまで待機します。\n" +"待つ必要がない場合、:meth:`drain` はすぐに返ります。" -#: ../../library/asyncio-stream.rst:378 msgid "Upgrade an existing stream-based connection to TLS." -msgstr "" +msgstr "既存のストリームベースの接続を TLS にアップグレードします。" #: ../../library/asyncio-stream.rst:380 msgid "Parameters:" @@ -516,19 +547,23 @@ msgstr "" "*server_hostname*: 対象のサーバーの証明書との照合に使われるホスト名を設定また" "は上書きします。" -#: ../../library/asyncio-stream.rst:387 msgid "" "*ssl_handshake_timeout* is the time in seconds to wait for the TLS handshake " "to complete before aborting the connection. ``60.0`` seconds if ``None`` " "(default)." msgstr "" +"*ssl_handshake_timeout* は、接続を中断する前に TLS ハンドシェイクの完了を待つ" +"時間を秒単位で指定します。\n" +"``None`` (デフォルト) の場合は ``60.0`` 秒です。" -#: ../../library/asyncio-stream.rst:391 msgid "" "*ssl_shutdown_timeout* is the time in seconds to wait for the SSL shutdown " "to complete before aborting the connection. ``30.0`` seconds if ``None`` " "(default)." msgstr "" +"*ssl_shutdown_timeout* は、接続を中断する前に SSL の終了処理を待つ時間を秒単" +"位で指定します。\n" +"``None`` (デフォルト) の場合は ``30.0`` 秒です。" #: ../../library/asyncio-stream.rst:403 msgid "" @@ -541,12 +576,14 @@ msgstr "" msgid "Wait until the stream is closed." msgstr "ストリームがクローズされるまで待機します。" -#: ../../library/asyncio-stream.rst:413 msgid "" "Should be called after :meth:`close` to wait until the underlying connection " "is closed, ensuring that all data has been flushed before e.g. exiting the " "program." msgstr "" +":meth:`close` の後に呼び出して、下層の接続が閉じられるまで待ってください。\n" +"これにより、例えばプログラムを終了する前に、すべてのデータがフラッシュされた" +"ことを確認できます。" #: ../../library/asyncio-stream.rst:421 msgid "Examples" @@ -579,7 +616,6 @@ msgstr "ストリームを使った TCP Echo サーバー" msgid "TCP echo server using the :func:`asyncio.start_server` function::" msgstr ":func:`asyncio.start_server` 関数を使った TCP Echo サーバーです::" -#: ../../library/asyncio-stream.rst:463 msgid "" "import asyncio\n" "\n" @@ -610,6 +646,34 @@ msgid "" "\n" "asyncio.run(main())" msgstr "" +"import asyncio\n" +"\n" +"async def handle_echo(reader, writer):\n" +" data = await reader.read(100)\n" +" message = data.decode()\n" +" addr = writer.get_extra_info('peername')\n" +"\n" +" print(f\"Received {message!r} from {addr!r}\")\n" +"\n" +" print(f\"Send: {message!r}\")\n" +" writer.write(data)\n" +" await writer.drain()\n" +"\n" +" print(\"Close the connection\")\n" +" writer.close()\n" +" await writer.wait_closed()\n" +"\n" +"async def main():\n" +" server = await asyncio.start_server(\n" +" handle_echo, '127.0.0.1', 8888)\n" +"\n" +" addrs = ', '.join(str(sock.getsockname()) for sock in server.sockets)\n" +" print(f'Serving on {addrs}')\n" +"\n" +" async with server:\n" +" await server.serve_forever()\n" +"\n" +"asyncio.run(main())" #: ../../library/asyncio-stream.rst:495 msgid "" @@ -631,7 +695,6 @@ msgid "" msgstr "" "コマンドラインから渡された URL の HTTP ヘッダーを問い合わせる簡単な例です::" -#: ../../library/asyncio-stream.rst:504 msgid "" "import asyncio\n" "import urllib.parse\n" @@ -669,22 +732,55 @@ msgid "" "url = sys.argv[1]\n" "asyncio.run(print_http_headers(url))" msgstr "" +"import asyncio\n" +"import urllib.parse\n" +"import sys\n" +"\n" +"async def print_http_headers(url):\n" +" url = urllib.parse.urlsplit(url)\n" +" if url.scheme == 'https':\n" +" reader, writer = await asyncio.open_connection(\n" +" url.hostname, 443, ssl=True)\n" +" else:\n" +" reader, writer = await asyncio.open_connection(\n" +" url.hostname, 80)\n" +"\n" +" query = (\n" +" f\"HEAD {url.path or '/'} HTTP/1.0\\r\\n\"\n" +" f\"Host: {url.hostname}\\r\\n\"\n" +" f\"\\r\\n\"\n" +" )\n" +"\n" +" writer.write(query.encode('latin-1'))\n" +" while True:\n" +" line = await reader.readline()\n" +" if not line:\n" +" break\n" +"\n" +" line = line.decode('latin1').rstrip()\n" +" if line:\n" +" print(f'HTTP header> {line}')\n" +"\n" +" # 本文を無視し、ソケットを閉じる\n" +" writer.close()\n" +" await writer.wait_closed()\n" +"\n" +"url = sys.argv[1]\n" +"asyncio.run(print_http_headers(url))" #: ../../library/asyncio-stream.rst:541 msgid "Usage::" msgstr "使い方::" -#: ../../library/asyncio-stream.rst:543 msgid "python example.py http://example.com/path/page.html" -msgstr "" +msgstr "python example.py http://example.com/path/page.html" #: ../../library/asyncio-stream.rst:545 msgid "or with HTTPS::" msgstr "または HTTPS を使用::" -#: ../../library/asyncio-stream.rst:547 msgid "python example.py https://example.com/path/page.html" -msgstr "" +msgstr "python example.py https://example.com/path/page.html" #: ../../library/asyncio-stream.rst:553 msgid "Register an open socket to wait for data using streams" @@ -698,7 +794,6 @@ msgstr "" ":func:`open_connection` 関数を使ってソケットがデータを受信するまで待つコルー" "チンです::" -#: ../../library/asyncio-stream.rst:558 msgid "" "import asyncio\n" "import socket\n" @@ -730,6 +825,34 @@ msgid "" "\n" "asyncio.run(wait_for_data())" msgstr "" +"import asyncio\n" +"import socket\n" +"\n" +"async def wait_for_data():\n" +" # 低水準 API を使うため、現在のイベントループへの参照を取得する。\n" +" loop = asyncio.get_running_loop()\n" +"\n" +" # 接続されたソケットのペアを作成する。\n" +" rsock, wsock = socket.socketpair()\n" +"\n" +" # データを待ち受けるために、開いているソケットを登録する。\n" +" reader, writer = await asyncio.open_connection(sock=rsock)\n" +"\n" +" # ネットワークからのデータ受信を模倣する\n" +" loop.call_soon(wsock.send, 'abc'.encode())\n" +"\n" +" # データを待つ\n" +" data = await reader.read(100)\n" +"\n" +" # データを受信して処理が済んだので、ソケットを閉じる\n" +" print(\"Received:\", data.decode())\n" +" writer.close()\n" +" await writer.wait_closed()\n" +"\n" +" # もう一方のソケットを閉じる\n" +" wsock.close()\n" +"\n" +"asyncio.run(wait_for_data())" #: ../../library/asyncio-stream.rst:590 msgid "" diff --git a/library/asyncio-subprocess.po b/library/asyncio-subprocess.po index 9ad55b607..9b31b88b2 100644 --- a/library/asyncio-subprocess.po +++ b/library/asyncio-subprocess.po @@ -19,10 +19,10 @@ msgstr "" "Last-Translator: souma987, 2023\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/asyncio-subprocess.rst:7 @@ -53,7 +53,6 @@ msgstr "" "以下は、 asyncio モジュールがどのようにシェルコマンドを実行し、結果を取得でき" "るかを示す例です::" -#: ../../library/asyncio-subprocess.rst:22 msgid "" "import asyncio\n" "\n" @@ -73,31 +72,48 @@ msgid "" "\n" "asyncio.run(run('ls /zzz'))" msgstr "" +"import asyncio\n" +"\n" +"async def run(cmd):\n" +" proc = await asyncio.create_subprocess_shell(\n" +" cmd,\n" +" stdout=asyncio.subprocess.PIPE,\n" +" stderr=asyncio.subprocess.PIPE)\n" +"\n" +" stdout, stderr = await proc.communicate()\n" +"\n" +" print(f'[{cmd!r} exited with {proc.returncode}]')\n" +" if stdout:\n" +" print(f'[stdout]\\n{stdout.decode()}')\n" +" if stderr:\n" +" print(f'[stderr]\\n{stderr.decode()}')\n" +"\n" +"asyncio.run(run('ls /zzz'))" #: ../../library/asyncio-subprocess.rst:40 msgid "will print::" msgstr "このサンプルコードは以下を出力します::" -#: ../../library/asyncio-subprocess.rst:42 msgid "" "['ls /zzz' exited with 1]\n" "[stderr]\n" "ls: /zzz: No such file or directory" msgstr "" +"['ls /zzz' exited with 1]\n" +"[stderr]\n" +"ls: /zzz: No such file or directory" -#: ../../library/asyncio-subprocess.rst:46 msgid "" "Because all asyncio subprocess functions are asynchronous and asyncio " "provides many tools to work with such functions, it is easy to execute and " "monitor multiple subprocesses in parallel. It is indeed trivial to modify " "the above example to run several commands simultaneously::" msgstr "" -"全ての asyncio のサブプロセス関数は非同期ですが、 asyncio モジュールはこれら" -"の非同期関数と協調するための多くのツールを提供しているので、複数のサブプロセ" -"スを並列に実行して監視することは簡単です。実際、上記のサンプルコードを複数の" -"コマンドを同時に実行するように修正するのはきわめて単純です::" +"asyncio のサブプロセス関数はすべて非同期で、asyncio にはこれらの関数を扱うた" +"めのツールが多数あるため、複数のサブプロセスを並列に実行して監視するのは簡単" +"です。\n" +"実際、上の例を変更して複数のコマンドを同時に実行するのはごく簡単です。 ::" -#: ../../library/asyncio-subprocess.rst:51 msgid "" "async def main():\n" " await asyncio.gather(\n" @@ -106,6 +122,12 @@ msgid "" "\n" "asyncio.run(main())" msgstr "" +"async def main():\n" +" await asyncio.gather(\n" +" run('ls /zzz'),\n" +" run('sleep 1; echo \"hello\"'))\n" +"\n" +"asyncio.run(main())" #: ../../library/asyncio-subprocess.rst:58 msgid "See also the `Examples`_ subsection." @@ -119,14 +141,16 @@ msgstr "サブプロセスの生成" msgid "Create a subprocess." msgstr "サブプロセスを作成します。" -#: ../../library/asyncio-subprocess.rst:70 -#: ../../library/asyncio-subprocess.rst:89 msgid "" "The *limit* argument sets the buffer limit for :class:`StreamReader` " "wrappers for :attr:`~asyncio.subprocess.Process.stdout` and :attr:`~asyncio." "subprocess.Process.stderr` (if :const:`subprocess.PIPE` is passed to " "*stdout* and *stderr* arguments)." msgstr "" +"*limit* 引数は、:attr:`~asyncio.subprocess.Process.stdout` と :attr:" +"`~asyncio.subprocess.Process.stderr` をラップする :class:`StreamReader` の" +"バッファの上限を設定します (*stdout* と *stderr* 引数に :const:`subprocess." +"PIPE` を渡した場合)。" #: ../../library/asyncio-subprocess.rst:74 #: ../../library/asyncio-subprocess.rst:93 @@ -202,20 +226,25 @@ msgstr "定数" msgid "Can be passed to the *stdin*, *stdout* or *stderr* parameters." msgstr "*stdin*, *stdout* または *stderr* に渡すことができます。" -#: ../../library/asyncio-subprocess.rst:133 msgid "" "If *PIPE* is passed to *stdin* argument, the :attr:`Process.stdin ` attribute will point to a :class:`~asyncio." "StreamWriter` instance." msgstr "" +"*stdin* 引数に *PIPE* を渡すと、:attr:`Process.stdin ` 属性は :class:`~asyncio.StreamWriter` インスタンスを指しま" +"す。" -#: ../../library/asyncio-subprocess.rst:137 msgid "" "If *PIPE* is passed to *stdout* or *stderr* arguments, the :attr:`Process." "stdout ` and :attr:`Process.stderr " "` attributes will point to :class:" "`~asyncio.StreamReader` instances." msgstr "" +"*stdout* または *stderr* 引数に *PIPE* を渡すと、対応する :attr:`Process." +"stdout ` 属性または :attr:`Process.stderr " +"` 属性は :class:`~asyncio.StreamReader` イ" +"ンスタンスを指します。" #: ../../library/asyncio-subprocess.rst:145 msgid "" @@ -251,12 +280,14 @@ msgstr "" "プロセスと通信したり、サブプロセスの完了を監視したりするための高水準のラッ" "パーです。" -#: ../../library/asyncio-subprocess.rst:167 msgid "" "An object that wraps OS processes created by the :func:`~asyncio." "create_subprocess_exec` and :func:`~asyncio.create_subprocess_shell` " "functions." msgstr "" +":func:`~asyncio.create_subprocess_exec` 関数や :func:`~asyncio." +"create_subprocess_shell` 関数で作成した OS のプロセスをラップするオブジェクト" +"です。" #: ../../library/asyncio-subprocess.rst:171 msgid "" @@ -274,12 +305,14 @@ msgstr "" "Popen と異なり、 Process インスタンスは :meth:`~subprocess.Popen.poll` メソッ" "ドに相当するメソッドを持っていません;" -#: ../../library/asyncio-subprocess.rst:178 msgid "" "the :meth:`~asyncio.subprocess.Process.communicate` and :meth:`~asyncio." "subprocess.Process.wait` methods don't have a *timeout* parameter: use the :" "func:`~asyncio.wait_for` function;" msgstr "" +":meth:`~asyncio.subprocess.Process.communicate` メソッドと :meth:`~asyncio." +"subprocess.Process.wait` メソッドには *timeout* パラメーターがありません。\n" +":func:`~asyncio.wait_for` 関数を使ってください。" #: ../../library/asyncio-subprocess.rst:182 msgid "" @@ -316,17 +349,16 @@ msgstr "子プロセスが終了するのを待ち受けます。" msgid "Set and return the :attr:`returncode` attribute." msgstr ":attr:`returncode` 属性を設定し、その値を返します。" -#: ../../library/asyncio-subprocess.rst:202 msgid "" "This method can deadlock when using ``stdout=PIPE`` or ``stderr=PIPE`` and " "the child process generates so much output that it blocks waiting for the OS " "pipe buffer to accept more data. Use the :meth:`communicate` method when " "using pipes to avoid this condition." msgstr "" -"``stdout=PIPE`` または ``stderr=PIPE`` を使っており、OS パイプバッファがさら" -"なるデータを受け付けるようになるまで子プロセスをブロックするほど大量の出力を" -"生成場合、このメソッドはデッドロックする可能性があります。この条件を避けるた" -"め、パイプを使用する場合は :meth:`communicate` メソッドを使ってください。" +"``stdout=PIPE`` または ``stderr=PIPE`` を使う場合、子プロセスが大量に出力し" +"て OS のパイプバッファに空きができるまでブロックされると、このメソッドはデッ" +"ドロックする可能性があります。\n" +"パイプを使うときは :meth:`communicate` メソッドでこの状況を回避してください。" #: ../../library/asyncio-subprocess.rst:211 msgid "Interact with process:" @@ -360,17 +392,16 @@ msgstr "" msgid "Return a tuple ``(stdout_data, stderr_data)``." msgstr "``(stdout_data, stderr_data)`` のタプルを返します。" -#: ../../library/asyncio-subprocess.rst:223 msgid "" "If either :exc:`BrokenPipeError` or :exc:`ConnectionResetError` exception is " "raised when writing *input* into *stdin*, the exception is ignored. This " "condition occurs when the process exits before all data are written into " "*stdin*." msgstr "" -"*input* を標準入力 *stdin* nに書き込んでいる時に :exc:`BrokenPipeError` また" -"は :exc:`ConnectionResetError` 例外が送出された場合、例外は無視されます。この" -"ような条件は、全てのデータが *stdin* に書き込まれる前にプロセスが終了した場合" -"に起こります。" +"*input* を *stdin* に書き込む際に :exc:`BrokenPipeError` または :exc:" +"`ConnectionResetError` が送出された場合、その例外は無視されます。\n" +"これは、すべてのデータを *stdin* に書き込む前にプロセスが終了すると発生しま" +"す。" #: ../../library/asyncio-subprocess.rst:228 msgid "" @@ -393,87 +424,98 @@ msgstr "" "い。そのため、返されるデータのサイズが大きいかまたは無制限の場合はこのメソッ" "ドを使わないようにしてください。" -#: ../../library/asyncio-subprocess.rst:239 msgid "*stdin* gets closed when ``input=None`` too." -msgstr "" +msgstr "``input=None`` の場合も *stdin* を閉じるようになりました。" #: ../../library/asyncio-subprocess.rst:243 msgid "Sends the signal *signal* to the child process." msgstr "子プロセスにシグナル *signal* を送信します。" -#: ../../library/asyncio-subprocess.rst:247 msgid "" "On Windows, :py:const:`~signal.SIGTERM` is an alias for :meth:`terminate`. " "``CTRL_C_EVENT`` and ``CTRL_BREAK_EVENT`` can be sent to processes started " "with a *creationflags* parameter which includes ``CREATE_NEW_PROCESS_GROUP``." msgstr "" +"Windows では :py:const:`~signal.SIGTERM` の送信は :meth:`terminate` の呼び出" +"しと同じです。\n" +"*creationflags* パラメーターに ``CREATE_NEW_PROCESS_GROUP`` を含めて起動した" +"プロセスには、``CTRL_C_EVENT`` と ``CTRL_BREAK_EVENT`` を送信できます。" #: ../../library/asyncio-subprocess.rst:254 msgid "Stop the child process." msgstr "子プロセスを停止します。" -#: ../../library/asyncio-subprocess.rst:256 msgid "" "On POSIX systems this method sends :py:const:`~signal.SIGTERM` to the child " "process." msgstr "" +"POSIX システムでは、子プロセスに :py:const:`~signal.SIGTERM` を送信します。" -#: ../../library/asyncio-subprocess.rst:259 msgid "" "On Windows the Win32 API function :c:func:`!TerminateProcess` is called to " "stop the child process." msgstr "" +"Windows では、Win32 API 関数 :c:func:`!TerminateProcess` を呼び出して子プロセ" +"スを停止します。" #: ../../library/asyncio-subprocess.rst:264 msgid "Kill the child process." msgstr "子プロセスを強制終了 (kill) します。" -#: ../../library/asyncio-subprocess.rst:266 msgid "" "On POSIX systems this method sends :py:data:`~signal.SIGKILL` to the child " "process." msgstr "" +"POSIX システムでは、子プロセスに :py:data:`~signal.SIGKILL` を送信します。" #: ../../library/asyncio-subprocess.rst:269 msgid "On Windows this method is an alias for :meth:`terminate`." msgstr "Windows では、このメソッドは :meth:`terminate` のエイリアスです。" -#: ../../library/asyncio-subprocess.rst:273 msgid "" "Standard input stream (:class:`~asyncio.StreamWriter`) or ``None`` if the " "process was created with ``stdin=None``." msgstr "" +"標準入力ストリーム (:class:`~asyncio.StreamWriter`) です。\n" +"``stdin=None`` でプロセスを作成した場合は ``None`` です。" -#: ../../library/asyncio-subprocess.rst:278 msgid "" "Standard output stream (:class:`~asyncio.StreamReader`) or ``None`` if the " "process was created with ``stdout=None``." msgstr "" +"標準出力ストリーム (:class:`~asyncio.StreamReader`) です。\n" +"``stdout=None`` でプロセスを作成した場合は ``None`` です。" -#: ../../library/asyncio-subprocess.rst:283 msgid "" "Standard error stream (:class:`~asyncio.StreamReader`) or ``None`` if the " "process was created with ``stderr=None``." msgstr "" +"標準エラーストリーム (:class:`~asyncio.StreamReader`) です。\n" +"``stderr=None`` でプロセスを作成した場合は ``None`` です。" -#: ../../library/asyncio-subprocess.rst:288 msgid "" "Use the :meth:`communicate` method rather than :attr:`process.stdin.write() " "`, :attr:`await process.stdout.read() ` or :attr:`await " "process.stderr.read() `. This avoids deadlocks due to streams " "pausing reading or writing and blocking the child process." msgstr "" +":attr:`process.stdin.write() `、:attr:`await process.stdout.read() " +"`、:attr:`await process.stderr.read() ` の代わりに :meth:" +"`communicate` メソッドを使ってください。\n" +"これにより、ストリームの読み書きが一時停止して子プロセスがブロックされること" +"によるデッドロックを回避できます。" #: ../../library/asyncio-subprocess.rst:297 msgid "Process identification number (PID)." msgstr "子プロセスのプロセス番号 (PID) です。" -#: ../../library/asyncio-subprocess.rst:299 msgid "" "Note that for processes created by the :func:`~asyncio." "create_subprocess_shell` function, this attribute is the PID of the spawned " "shell." msgstr "" +":func:`~asyncio.create_subprocess_shell` 関数で作成したプロセスでは、この属性" +"は起動したシェルの PID です。" #: ../../library/asyncio-subprocess.rst:304 msgid "Return code of the process when it exits." diff --git a/library/asyncio-sync.po b/library/asyncio-sync.po index 2f6beab6e..81e17fe8f 100644 --- a/library/asyncio-sync.po +++ b/library/asyncio-sync.po @@ -20,10 +20,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/asyncio-sync.rst:7 @@ -111,7 +111,6 @@ msgstr "" "Lock の望ましい使用方法は、 :keyword:`async with` 文と組み合わせて使うことで" "す::" -#: ../../library/asyncio-sync.rst:50 msgid "" "lock = asyncio.Lock()\n" "\n" @@ -119,13 +118,17 @@ msgid "" "async with lock:\n" " # access shared state" msgstr "" +"lock = asyncio.Lock()\n" +"\n" +"# ... 後で\n" +"async with lock:\n" +" # 共有状態にアクセスする" #: ../../library/asyncio-sync.rst:56 ../../library/asyncio-sync.rst:201 #: ../../library/asyncio-sync.rst:309 msgid "which is equivalent to::" msgstr "これは以下のコードと等価です::" -#: ../../library/asyncio-sync.rst:58 msgid "" "lock = asyncio.Lock()\n" "\n" @@ -136,6 +139,14 @@ msgid "" "finally:\n" " lock.release()" msgstr "" +"lock = asyncio.Lock()\n" +"\n" +"# ... 後で\n" +"await lock.acquire()\n" +"try:\n" +" # 共有状態にアクセスする\n" +"finally:\n" +" lock.release()" #: ../../library/asyncio-sync.rst:67 ../../library/asyncio-sync.rst:113 #: ../../library/asyncio-sync.rst:189 ../../library/asyncio-sync.rst:297 @@ -220,7 +231,6 @@ msgstr "" msgid "Example::" msgstr "以下はプログラム例です::" -#: ../../library/asyncio-sync.rst:120 msgid "" "async def waiter(event):\n" " print('waiting for it ...')\n" @@ -243,6 +253,26 @@ msgid "" "\n" "asyncio.run(main())" msgstr "" +"async def waiter(event):\n" +" print('waiting for it ...')\n" +" await event.wait()\n" +" print('... got it!')\n" +"\n" +"async def main():\n" +" # Event オブジェクトを作成する。\n" +" event = asyncio.Event()\n" +"\n" +" # 'event' がセットされるまで待機するタスクを起動する。\n" +" waiter_task = asyncio.create_task(waiter(event))\n" +"\n" +" # 1 秒待ってからイベントをセットする。\n" +" await asyncio.sleep(1)\n" +" event.set()\n" +"\n" +" # 待機中のタスクが終了するまで待つ。\n" +" await waiter_task\n" +"\n" +"asyncio.run(main())" #: ../../library/asyncio-sync.rst:144 msgid "Wait until the event is set." @@ -328,7 +358,6 @@ msgstr "" "Condition の望ましい使用方法は :keyword:`async with` 文と組み合わせて使うこと" "です::" -#: ../../library/asyncio-sync.rst:195 msgid "" "cond = asyncio.Condition()\n" "\n" @@ -336,8 +365,12 @@ msgid "" "async with cond:\n" " await cond.wait()" msgstr "" +"cond = asyncio.Condition()\n" +"\n" +"# ... 後で\n" +"async with cond:\n" +" await cond.wait()" -#: ../../library/asyncio-sync.rst:203 msgid "" "cond = asyncio.Condition()\n" "\n" @@ -348,6 +381,14 @@ msgid "" "finally:\n" " cond.release()" msgstr "" +"cond = asyncio.Condition()\n" +"\n" +"# ... 後で\n" +"await cond.acquire()\n" +"try:\n" +" await cond.wait()\n" +"finally:\n" +" cond.release()" #: ../../library/asyncio-sync.rst:215 msgid "Acquire the underlying lock." @@ -361,11 +402,12 @@ msgstr "" "このメソッドは下層のロックが *解除される* まで待機し、ロックを *ロック状態* " "に変更して ``True`` を返します。" -#: ../../library/asyncio-sync.rst:222 msgid "" "Wake up *n* tasks (1 by default) waiting on this condition. If fewer than " "*n* tasks are waiting they are all awakened." msgstr "" +"この条件変数で待機しているタスクを *n* 個 (デフォルトは 1 個) 起こします。\n" +"待機しているタスクが *n* 個未満なら、すべて起こします。" #: ../../library/asyncio-sync.rst:225 ../../library/asyncio-sync.rst:240 msgid "" @@ -424,24 +466,30 @@ msgstr "" "動されると、 Condition は再びロックを獲得し、メソッドは ``True`` を返しま" "す。" -#: ../../library/asyncio-sync.rst:264 msgid "" "Note that a task *may* return from this call spuriously, which is why the " "caller should always re-check the state and be prepared to :meth:`~Condition." "wait` again. For this reason, you may prefer to use :meth:`~Condition." "wait_for` instead." msgstr "" +"この呼び出しは、通知を受けていなくても返る *場合があります*。\n" +"そのため、呼び出し側では必ず状態を再確認し、必要なら再び :meth:`~Condition." +"wait` できるようにしてください。\n" +"このため、代わりに :meth:`~Condition.wait_for` を使う方が適している場合もあり" +"ます。" -#: ../../library/asyncio-sync.rst:272 msgid "Wait until a predicate becomes *true*." -msgstr "引数 predicate の条件が *真* になるまで待機します。" +msgstr "``predicate`` の評価結果が *真* になるまで待機します。" -#: ../../library/asyncio-sync.rst:274 msgid "" "The predicate must be a callable which result will be interpreted as a " "boolean value. The method will repeatedly :meth:`~Condition.wait` until the " "predicate evaluates to *true*. The final value is the return value." msgstr "" +"``predicate`` は呼び出し可能オブジェクトでなければならず、その結果はブール値" +"として解釈されます。\n" +"このメソッドは ``predicate`` の評価結果が *真* になるまで :meth:`~Condition." +"wait` を繰り返し、最後の評価結果を返します。" #: ../../library/asyncio-sync.rst:281 msgid "Semaphore" @@ -481,7 +529,6 @@ msgstr "" "セマフォの望ましい使用方法は、 :keyword:`async with` 文と組み合わせて使うこと" "です::" -#: ../../library/asyncio-sync.rst:303 msgid "" "sem = asyncio.Semaphore(10)\n" "\n" @@ -489,8 +536,12 @@ msgid "" "async with sem:\n" " # work with shared resource" msgstr "" +"sem = asyncio.Semaphore(10)\n" +"\n" +"# ... 後で\n" +"async with sem:\n" +" # 共有リソースを操作する" -#: ../../library/asyncio-sync.rst:311 msgid "" "sem = asyncio.Semaphore(10)\n" "\n" @@ -501,6 +552,14 @@ msgid "" "finally:\n" " sem.release()" msgstr "" +"sem = asyncio.Semaphore(10)\n" +"\n" +"# ... 後で\n" +"await sem.acquire()\n" +"try:\n" +" # 共有リソースを操作する\n" +"finally:\n" +" sem.release()" #: ../../library/asyncio-sync.rst:323 msgid "Acquire a semaphore." @@ -544,25 +603,23 @@ msgstr "BoundedSemaphore" msgid "A bounded semaphore object. Not thread-safe." msgstr "有限セマフォオブジェクトです。スレッドセーフではありません。" -#: ../../library/asyncio-sync.rst:349 msgid "" "Bounded Semaphore is a version of :class:`Semaphore` that raises a :exc:" "`ValueError` in :meth:`~Semaphore.release` if it increases the internal " "counter above the initial *value*." msgstr "" -"有限セマフォは :class:`Semaphore` の一種で、 :meth:`~Semaphore.release` メ" -"ソッドの呼び出しにより内部カウンターが *初期値* よりも増加してしまう場合は :" -"exc:`ValueError` 例外を送出します。" +"有限セマフォは :class:`Semaphore` の一種です。\n" +":meth:`~Semaphore.release` によって内部カウンターが初期値 *value* を超える場" +"合、:exc:`ValueError` を送出します。" -#: ../../library/asyncio-sync.rst:358 msgid "Barrier" -msgstr "" +msgstr "Barrier" -#: ../../library/asyncio-sync.rst:362 msgid "A barrier object. Not thread-safe." msgstr "" +"バリアオブジェクトです。\n" +"スレッドセーフではありません。" -#: ../../library/asyncio-sync.rst:364 msgid "" "A barrier is a simple synchronization primitive that allows to block until " "*parties* number of tasks are waiting on it. Tasks can wait on the :meth:" @@ -570,18 +627,22 @@ msgid "" "tasks end up waiting on :meth:`~Barrier.wait`. At that point all of the " "waiting tasks would unblock simultaneously." msgstr "" +"バリアは、*parties* 個のタスクが待機するまでブロックできる単純な同期プリミ" +"ティブです。\n" +"タスクは :meth:`~Barrier.wait` メソッドで待機でき、指定した数のタスクが :" +"meth:`~Barrier.wait` で待機するまでブロックされます。\n" +"その時点で、待機しているすべてのタスクのブロックが同時に解除されます。" -#: ../../library/asyncio-sync.rst:370 msgid "" ":keyword:`async with` can be used as an alternative to awaiting on :meth:" "`~Barrier.wait`." msgstr "" +":meth:`~Barrier.wait` を await する代わりに :keyword:`async with` を使えま" +"す。" -#: ../../library/asyncio-sync.rst:373 msgid "The barrier can be reused any number of times." -msgstr "" +msgstr "バリアは何度でも再利用できます。" -#: ../../library/asyncio-sync.rst:379 msgid "" "async def example_barrier():\n" " # barrier with 3 parties\n" @@ -604,40 +665,68 @@ msgid "" "\n" "asyncio.run(example_barrier())" msgstr "" +"async def example_barrier():\n" +" # 3 タスクが参加するバリア\n" +" b = asyncio.Barrier(3)\n" +"\n" +" # 待機するタスクを 2 つ作成する\n" +" asyncio.create_task(b.wait())\n" +" asyncio.create_task(b.wait())\n" +"\n" +" await asyncio.sleep(0)\n" +" print(b)\n" +"\n" +" # 3 回目の .wait() の呼び出しでバリアを通過する\n" +" await b.wait()\n" +" print(b)\n" +" print(\"barrier passed\")\n" +"\n" +" await asyncio.sleep(0)\n" +" print(b)\n" +"\n" +"asyncio.run(example_barrier())" -#: ../../library/asyncio-sync.rst:400 msgid "Result of this example is::" -msgstr "" +msgstr "この例の実行結果は次のとおりです。 ::" -#: ../../library/asyncio-sync.rst:402 msgid "" "\n" "\n" "barrier passed\n" "" msgstr "" +"\n" +"\n" +"barrier passed\n" +"" -#: ../../library/asyncio-sync.rst:412 msgid "" "Pass the barrier. When all the tasks party to the barrier have called this " "function, they are all unblocked simultaneously." msgstr "" +"バリアを通過します。\n" +"バリアに参加するすべてのタスクがこの関数を呼び出すと、すべてのタスクのブロッ" +"クが同時に解除されます。" -#: ../../library/asyncio-sync.rst:415 msgid "" "When a waiting or blocked task in the barrier is cancelled, this task exits " "the barrier which stays in the same state. If the state of the barrier is " "\"filling\", the number of waiting task decreases by 1." msgstr "" +"バリアで待機中またはブロック中のタスクがキャンセルされると、そのタスクはバリ" +"アから抜けます。\n" +"バリアの状態は変わりません。\n" +"バリアが \"filling\" 状態の場合、待機中のタスク数は 1 減ります。" -#: ../../library/asyncio-sync.rst:420 msgid "" "The return value is an integer in the range of 0 to ``parties-1``, different " "for each task. This can be used to select a task to do some special " "housekeeping, e.g.::" msgstr "" +"戻り値は 0 から ``parties-1`` までの整数で、タスクごとに異なります。\n" +"これを使うと、後片付けなどの特別な処理を行うタスクを選べます。\n" +"例えば次のようにします。 ::" -#: ../../library/asyncio-sync.rst:424 msgid "" "...\n" "async with barrier as position:\n" @@ -645,41 +734,52 @@ msgid "" " # Only one task prints this\n" " print('End of *draining phase*')" msgstr "" +"...\n" +"async with barrier as position:\n" +" if position == 0:\n" +" # 1 つのタスクだけがこれを表示する\n" +" print('End of *draining phase*')" -#: ../../library/asyncio-sync.rst:430 msgid "" "This method may raise a :class:`BrokenBarrierError` exception if the barrier " "is broken or reset while a task is waiting. It could raise a :exc:" "`CancelledError` if a task is cancelled." msgstr "" +"タスクの待機中にバリアが broken 状態になるかリセットされると、:class:" +"`BrokenBarrierError` が送出される場合があります。\n" +"タスクがキャンセルされると :exc:`CancelledError` が送出される場合があります。" -#: ../../library/asyncio-sync.rst:437 msgid "" "Return the barrier to the default, empty state. Any tasks waiting on it " "will receive the :class:`BrokenBarrierError` exception." msgstr "" +"バリアをデフォルトの空の状態に戻します。\n" +"バリアで待機しているタスクには :class:`BrokenBarrierError` が送出されます。" -#: ../../library/asyncio-sync.rst:440 msgid "" "If a barrier is broken it may be better to just leave it and create a new " "one." msgstr "" +"バリアが broken 状態になった場合は、そのバリアをそのままにして新しく作り直す" +"方がよいこともあります。" -#: ../../library/asyncio-sync.rst:445 msgid "" "Put the barrier into a broken state. This causes any active or future calls " "to :meth:`~Barrier.wait` to fail with the :class:`BrokenBarrierError`. Use " "this for example if one of the tasks needs to abort, to avoid infinite " "waiting tasks." msgstr "" +"バリアを broken 状態にします。\n" +"これにより、実行中および今後の :meth:`~Barrier.wait` の呼び出しは :class:" +"`BrokenBarrierError` で失敗します。\n" +"例えば、いずれかのタスクが処理を中断する必要があるときに、他のタスクが無限に" +"待機しないようにするために使います。" -#: ../../library/asyncio-sync.rst:452 msgid "The number of tasks required to pass the barrier." -msgstr "" +msgstr "バリアを通過するために必要なタスク数です。" -#: ../../library/asyncio-sync.rst:456 msgid "The number of tasks currently waiting in the barrier while filling." -msgstr "" +msgstr "filling 状態のバリアで現在待機しているタスク数です。" #: ../../library/asyncio-sync.rst:460 msgid "A boolean that is ``True`` if the barrier is in the broken state." diff --git a/library/asyncio-task.po b/library/asyncio-task.po index 3a43ded5e..607d28154 100644 --- a/library/asyncio-task.po +++ b/library/asyncio-task.po @@ -23,10 +23,10 @@ msgstr "" "Last-Translator: tomo, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/asyncio-task.rst:6 @@ -45,11 +45,9 @@ msgstr "" msgid "Coroutines" msgstr "コルーチン" -#: ../../library/asyncio-task.rst:21 msgid "**Source code:** :source:`Lib/asyncio/coroutines.py`" -msgstr "" +msgstr "**ソースコード:** :source:`Lib/asyncio/coroutines.py`" -#: ../../library/asyncio-task.rst:25 msgid "" ":term:`Coroutines ` declared with the async/await syntax is the " "preferred way of writing asyncio applications. For example, the following " @@ -57,9 +55,8 @@ msgid "" msgstr "" "async/await 構文で宣言された :term:`コルーチン ` は、 asyncio を" "使ったアプリケーションを書くのに推奨される方法です。例えば、次のコードスニ" -"ペットは \"hello\" を出力し、そこから 1 秒待って \"world\" を出力します:: " +"ペットは \"hello\" を出力し、そこから 1 秒待って \"world\" を出力します::" -#: ../../library/asyncio-task.rst:30 msgid "" ">>> import asyncio\n" "\n" @@ -72,6 +69,16 @@ msgid "" "hello\n" "world" msgstr "" +">>> import asyncio\n" +"\n" +">>> async def main():\n" +"... print('hello')\n" +"... await asyncio.sleep(1)\n" +"... print('world')\n" +"\n" +">>> asyncio.run(main())\n" +"hello\n" +"world" #: ../../library/asyncio-task.rst:41 msgid "" @@ -80,11 +87,12 @@ msgstr "" "単にコルーチンを呼び出しただけでは、コルーチンの実行スケジュールは予約されて" "いないことに注意してください::" -#: ../../library/asyncio-task.rst:44 msgid "" ">>> main()\n" "" msgstr "" +">>> main()\n" +"" #: ../../library/asyncio-task.rst:47 msgid "To actually run a coroutine, asyncio provides the following mechanisms:" @@ -109,7 +117,6 @@ msgstr "" "コルーチンを await すること。次のコード片は 1 秒間待機した後に \"hello\" と出" "力し、 *更に* 2 秒間待機してから \"world\" と出力します::" -#: ../../library/asyncio-task.rst:56 msgid "" "import asyncio\n" "import time\n" @@ -128,18 +135,37 @@ msgid "" "\n" "asyncio.run(main())" msgstr "" +"import asyncio\n" +"import time\n" +"\n" +"async def say_after(delay, what):\n" +" await asyncio.sleep(delay)\n" +" print(what)\n" +"\n" +"async def main():\n" +" print(f\"started at {time.strftime('%X')}\")\n" +"\n" +" await say_after(1, 'hello')\n" +" await say_after(2, 'world')\n" +"\n" +" print(f\"finished at {time.strftime('%X')}\")\n" +"\n" +"asyncio.run(main())" #: ../../library/asyncio-task.rst:73 msgid "Expected output::" msgstr "予想される出力::" -#: ../../library/asyncio-task.rst:75 msgid "" "started at 17:13:52\n" "hello\n" "world\n" "finished at 17:13:55" msgstr "" +"started at 17:13:52\n" +"hello\n" +"world\n" +"finished at 17:13:55" #: ../../library/asyncio-task.rst:80 msgid "" @@ -157,7 +183,6 @@ msgstr "" "上のコード例を編集して、ふたつの ``say_after`` コルーチンを *並行して* 走らせ" "てみましょう::" -#: ../../library/asyncio-task.rst:86 msgid "" "async def main():\n" " task1 = asyncio.create_task(\n" @@ -175,6 +200,20 @@ msgid "" "\n" " print(f\"finished at {time.strftime('%X')}\")" msgstr "" +"async def main():\n" +" task1 = asyncio.create_task(\n" +" say_after(1, 'hello'))\n" +"\n" +" task2 = asyncio.create_task(\n" +" say_after(2, 'world'))\n" +"\n" +" print(f\"started at {time.strftime('%X')}\")\n" +"\n" +" # 両方のタスクが完了するまで待つ (約 2 秒かかる)。\n" +" await task1\n" +" await task2\n" +"\n" +" print(f\"finished at {time.strftime('%X')}\")" #: ../../library/asyncio-task.rst:102 msgid "" @@ -184,21 +223,25 @@ msgstr "" "予想される出力が、スニペットの実行が前回よりも 1 秒早いことを示していることに" "注意してください::" -#: ../../library/asyncio-task.rst:105 msgid "" "started at 17:14:32\n" "hello\n" "world\n" "finished at 17:14:34" msgstr "" +"started at 17:14:32\n" +"hello\n" +"world\n" +"finished at 17:14:34" -#: ../../library/asyncio-task.rst:110 msgid "" "The :class:`asyncio.TaskGroup` class provides a more modern alternative to :" "func:`create_task`. Using this API, the last example becomes::" msgstr "" +":class:`asyncio.TaskGroup` クラスは、:func:`create_task` に代わるより新しい手" +"段です。\n" +"この API を使うと、直前の例は次のようになります。 ::" -#: ../../library/asyncio-task.rst:114 msgid "" "async def main():\n" " async with asyncio.TaskGroup() as tg:\n" @@ -214,10 +257,22 @@ msgid "" "\n" " print(f\"finished at {time.strftime('%X')}\")" msgstr "" +"async def main():\n" +" async with asyncio.TaskGroup() as tg:\n" +" task1 = tg.create_task(\n" +" say_after(1, 'hello'))\n" +"\n" +" task2 = tg.create_task(\n" +" say_after(2, 'world'))\n" +"\n" +" print(f\"started at {time.strftime('%X')}\")\n" +"\n" +" # コンテキストマネージャーを抜けるときに暗黙に await する。\n" +"\n" +" print(f\"finished at {time.strftime('%X')}\")" -#: ../../library/asyncio-task.rst:128 msgid "The timing and output should be the same as for the previous version." -msgstr "" +msgstr "実行にかかる時間と出力は、直前の例と同じになるはずです。" #: ../../library/asyncio-task.rst:130 msgid ":class:`asyncio.TaskGroup`." @@ -253,7 +308,6 @@ msgstr "" "Python のコルーチンは *awaitable* であり、他のコルーチンから待機されることが" "できます::" -#: ../../library/asyncio-task.rst:152 msgid "" "import asyncio\n" "\n" @@ -271,6 +325,21 @@ msgid "" "\n" "asyncio.run(main())" msgstr "" +"import asyncio\n" +"\n" +"async def nested():\n" +" return 42\n" +"\n" +"async def main():\n" +" # \"nested()\" を呼び出すだけでは何も起こらない。\n" +" # コルーチンオブジェクトは作成されるが await されないので、\n" +" # まったく実行されない。\n" +" nested() # \"RuntimeWarning\" が発生する。\n" +"\n" +" # 今度は await してみる:\n" +" print(await nested()) # \"42\" と表示する。\n" +"\n" +"asyncio.run(main())" #: ../../library/asyncio-task.rst:170 msgid "" @@ -307,7 +376,6 @@ msgstr "" ":func:`asyncio.create_task` のような関数で、コルーチンが *Task* にラップされ" "ているとき、自動的にコルーチンは即時実行されるようにスケジュールされます::" -#: ../../library/asyncio-task.rst:187 msgid "" "import asyncio\n" "\n" @@ -325,6 +393,20 @@ msgid "" "\n" "asyncio.run(main())" msgstr "" +"import asyncio\n" +"\n" +"async def nested():\n" +" return 42\n" +"\n" +"async def main():\n" +" # nested() がまもなく \"main()\" と並行して実行されるようにする。\n" +" task = asyncio.create_task(nested())\n" +"\n" +" # \"task\" で \"nested()\" をキャンセルしたり、\n" +" # 単に await して完了を待ったりできる:\n" +" await task\n" +"\n" +"asyncio.run(main())" #: ../../library/asyncio-task.rst:205 msgid "Futures" @@ -370,7 +452,6 @@ msgstr "" "Future オブジェクトはライブラリや asyncio のAPIで外部に提供されることもあり、" "await (待機)されることができます::" -#: ../../library/asyncio-task.rst:221 msgid "" "async def main():\n" " await function_that_returns_a_future_object()\n" @@ -381,6 +462,14 @@ msgid "" " some_python_coroutine()\n" " )" msgstr "" +"async def main():\n" +" await function_that_returns_a_future_object()\n" +"\n" +" # これも有効:\n" +" await asyncio.gather(\n" +" function_that_returns_a_future_object(),\n" +" some_python_coroutine()\n" +" )" #: ../../library/asyncio-task.rst:230 msgid "" @@ -407,12 +496,15 @@ msgstr "" "ケジュールします。\n" "Task オブジェクトを返します。" -#: ../../library/asyncio-task.rst:246 msgid "" "The full function signature is largely the same as that of the :class:`Task` " "constructor (or factory) - all of the keyword arguments to this function are " "passed through to that interface." msgstr "" +"関数のシグネチャ全体は :class:`Task` のコンストラクター (またはファクトリー) " +"とほぼ同じです。\n" +"この関数に渡したキーワード引数はすべて、そのコンストラクターやファクトリーに" +"渡されます。" #: ../../library/asyncio-task.rst:250 msgid "" @@ -424,13 +516,17 @@ msgstr "" "の :class:`contextvars.Context` を指定できます。*context* が省略された場合、" "現在のコンテキストのコピーが作成されます。" -#: ../../library/asyncio-task.rst:254 msgid "" "An optional keyword-only *eager_start* argument allows specifying if the " "task should execute eagerly during the call to create_task, or be scheduled " "later. If *eager_start* is not passed the mode set by :meth:`loop." "set_task_factory` will be used." msgstr "" +"省略可能なキーワード専用引数 *eager_start* では、``create_task()`` の呼び出し" +"中にタスクの実行を即座に開始するか、後で実行するようにスケジュールするかを指" +"定できます。\n" +"*eager_start* を渡さない場合は :meth:`loop.set_task_factory` で設定したモード" +"を使います。" #: ../../library/asyncio-task.rst:259 msgid "" @@ -441,12 +537,14 @@ msgstr "" "行されます。現在のスレッドに実行中のループが無い場合は、 :exc:`RuntimeError` " "が送出されます。" -#: ../../library/asyncio-task.rst:265 msgid "" ":meth:`asyncio.TaskGroup.create_task` is a new alternative leveraging " "structural concurrency; it allows for waiting for a group of related tasks " "with strong safety guarantees." msgstr "" +":meth:`asyncio.TaskGroup.create_task` は、構造化された並行処理を使う新しい代" +"替手段です。\n" +"強い安全性の保証のもとで、関連するタスクのグループを待機できます。" #: ../../library/asyncio-task.rst:271 msgid "" @@ -461,7 +559,6 @@ msgstr "" "なくてもガーベジコレクションされる可能性があります。信頼性のある \"fire-and-" "forget\" バックグラウンドタスクが必要な場合、コレクションを使ってください。" -#: ../../library/asyncio-task.rst:278 msgid "" "background_tasks = set()\n" "\n" @@ -476,6 +573,17 @@ msgid "" " # completion:\n" " task.add_done_callback(background_tasks.discard)" msgstr "" +"background_tasks = set()\n" +"\n" +"for i in range(10):\n" +" task = asyncio.create_task(some_coro(param=i))\n" +"\n" +" # タスクを集合に追加する。これにより強参照が作成される。\n" +" background_tasks.add(task)\n" +"\n" +" # 完了したタスクへの参照を保持し続けないように、\n" +" # 各タスクが完了したら集合から自身への参照を削除するようにする:\n" +" task.add_done_callback(background_tasks.discard)" #: ../../library/asyncio-task.rst:293 ../../library/asyncio-task.rst:1250 msgid "Added the *name* parameter." @@ -485,9 +593,10 @@ msgstr "*name* パラメータを追加しました。" msgid "Added the *context* parameter." msgstr "*context* パラメータを追加しました。" -#: ../../library/asyncio-task.rst:299 msgid "Added the *eager_start* parameter by passing on all *kwargs*." msgstr "" +"すべての *kwargs* を渡すようにすることで、*eager_start* パラメーターが追加さ" +"れました。" #: ../../library/asyncio-task.rst:304 msgid "Task Cancellation" @@ -501,7 +610,6 @@ msgstr "" "タスクは簡単に、そして安全にキャンセルできます。タスクがキャンセルされた場" "合、:exc:`asyncio.CancelledError` が次の機会に送出されます。" -#: ../../library/asyncio-task.rst:310 msgid "" "It is recommended that coroutines use ``try/finally`` blocks to robustly " "perform clean-up logic. In case :exc:`asyncio.CancelledError` is explicitly " @@ -509,8 +617,13 @@ msgid "" "`asyncio.CancelledError` directly subclasses :exc:`BaseException` so most " "code will not need to be aware of it." msgstr "" +"後片付けを確実に行うため、コルーチンでは ``try/finally`` ブロックを使うことを" +"推奨します。\n" +":exc:`asyncio.CancelledError` を明示的に捕捉した場合、通常は後片付けが終わっ" +"たら伝播させてください。\n" +":exc:`asyncio.CancelledError` は :exc:`BaseException` の直接のサブクラスなの" +"で、ほとんどのコードでは特別に意識する必要はありません。" -#: ../../library/asyncio-task.rst:316 msgid "" "The asyncio components that enable structured concurrency, like :class:" "`asyncio.TaskGroup` and :func:`asyncio.timeout`, are implemented using " @@ -520,23 +633,36 @@ msgid "" "exc:`asyncio.CancelledError` is truly desired, it is necessary to also call " "``uncancel()`` to completely remove the cancellation state." msgstr "" +":class:`asyncio.TaskGroup` や :func:`asyncio.timeout` など、構造化された並行" +"処理を実現する asyncio の構成要素は内部でキャンセルを使って実装されていま" +"す。\n" +"コルーチンが :exc:`asyncio.CancelledError` を握りつぶすと、正しく動作しない場" +"合があります。\n" +"同様に、ユーザーのコードから :meth:`uncancel ` を呼び" +"出すことも通常は避けてください。\n" +"ただし、本当に :exc:`asyncio.CancelledError` を抑制したい場合は、キャンセル状" +"態を完全に解除するために ``uncancel()`` も呼び出す必要があります。" #: ../../library/asyncio-task.rst:328 msgid "Task Groups" msgstr "" -#: ../../library/asyncio-task.rst:330 msgid "" "Task groups combine a task creation API with a convenient and reliable way " "to wait for all tasks in the group to finish." msgstr "" +"タスクグループは、タスクを作成する API と、グループ内のすべてのタスクの終了を" +"便利かつ確実に待つ手段を組み合わせたものです。" -#: ../../library/asyncio-task.rst:335 msgid "" "An :ref:`asynchronous context manager ` holding a " "group of tasks. Tasks can be added to the group using :meth:`create_task`. " "All tasks are awaited when the context manager exits." msgstr "" +"タスクのグループを保持する :ref:`非同期コンテキストマネージャー ` です。\n" +":meth:`create_task` でタスクをグループに追加できます。\n" +"コンテキストマネージャーを抜けるときに、すべてのタスクを await します。" #: ../../library/asyncio-task.rst:344 msgid "" @@ -546,13 +672,13 @@ msgid "" "given ``coro``." msgstr "" -#: ../../library/asyncio-task.rst:352 msgid "Close the given coroutine if the task group is not active." msgstr "" +"タスクグループがアクティブでない場合、渡されたコルーチンを閉じるようになりま" +"した。" -#: ../../library/asyncio-task.rst:356 msgid "Passes on all *kwargs* to :meth:`loop.create_task`" -msgstr "" +msgstr "すべての *kwargs* を :meth:`loop.create_task` に渡すようになりました。" #: ../../library/asyncio-task.rst:358 ../../library/asyncio-task.rst:564 #: ../../library/asyncio-task.rst:737 ../../library/asyncio-task.rst:795 @@ -560,7 +686,6 @@ msgstr "" msgid "Example::" msgstr "以下はプログラム例です::" -#: ../../library/asyncio-task.rst:360 msgid "" "async def main():\n" " async with asyncio.TaskGroup() as tg:\n" @@ -569,6 +694,12 @@ msgid "" " print(f\"Both tasks have completed now: {task1.result()}, {task2." "result()}\")" msgstr "" +"async def main():\n" +" async with asyncio.TaskGroup() as tg:\n" +" task1 = tg.create_task(some_coro(...))\n" +" task2 = tg.create_task(another_coro(...))\n" +" print(f\"Both tasks have completed now: {task1.result()}, {task2." +"result()}\")" #: ../../library/asyncio-task.rst:366 msgid "" @@ -579,7 +710,6 @@ msgid "" "block is exited, no new tasks may be added to the group." msgstr "" -#: ../../library/asyncio-task.rst:373 msgid "" "The first time any of the tasks belonging to the group fails with an " "exception other than :exc:`asyncio.CancelledError`, the remaining tasks in " @@ -590,16 +720,26 @@ msgid "" "exc:`asyncio.CancelledError` will interrupt an ``await``, but it will not " "bubble out of the containing ``async with`` statement." msgstr "" +"グループ内のいずれかのタスクが :exc:`asyncio.CancelledError` 以外の例外で初め" +"て失敗した時点で、グループ内の残りのタスクをキャンセルします。\n" +"それ以降はグループにタスクを追加できません。\n" +"この時点で ``async with`` 文の本体がまだ実行中 (つまり :meth:`~object." +"__aexit__` がまだ呼び出されていない) なら、``async with`` 文を直接含むタスク" +"もキャンセルされます。\n" +"これによって生じる :exc:`asyncio.CancelledError` は ``await`` を中断します" +"が、それを含む ``async with`` 文の外には伝播しません。" -#: ../../library/asyncio-task.rst:383 msgid "" "Once all tasks have finished, if any tasks have failed with an exception " "other than :exc:`asyncio.CancelledError`, those exceptions are combined in " "an :exc:`ExceptionGroup` or :exc:`BaseExceptionGroup` (as appropriate; see " "their documentation) which is then raised." msgstr "" +"すべてのタスクが終了した時点で、:exc:`asyncio.CancelledError` 以外の例外で失" +"敗したタスクがあれば、それらの例外を :exc:`ExceptionGroup` または :exc:" +"`BaseExceptionGroup` にまとめて送出します (どちらを使うかは、それぞれのドキュ" +"メントを参照してください)。" -#: ../../library/asyncio-task.rst:390 msgid "" "Two base exceptions are treated specially: If any task fails with :exc:" "`KeyboardInterrupt` or :exc:`SystemExit`, the task group still cancels the " @@ -607,6 +747,11 @@ msgid "" "`KeyboardInterrupt` or :exc:`SystemExit` is re-raised instead of :exc:" "`ExceptionGroup` or :exc:`BaseExceptionGroup`." msgstr "" +"基底例外のうち、2 つは特別に扱います。\n" +"いずれかのタスクが :exc:`KeyboardInterrupt` または :exc:`SystemExit` で失敗し" +"た場合も、タスクグループは残りのタスクをキャンセルして終了を待ちます。\n" +"ただし、その後は :exc:`ExceptionGroup` や :exc:`BaseExceptionGroup` ではな" +"く、最初の :exc:`KeyboardInterrupt` または :exc:`SystemExit` を再送出します。" #: ../../library/asyncio-task.rst:396 msgid "" @@ -620,7 +765,6 @@ msgid "" "`KeyboardInterrupt` and :exc:`SystemExit` as in the previous paragraph." msgstr "" -#: ../../library/asyncio-task.rst:408 msgid "" "Task groups are careful not to mix up the internal cancellation used to " "\"wake up\" their :meth:`~object.__aexit__` with cancellation requests for " @@ -630,26 +774,38 @@ msgid "" "group will process its exceptions, and then the outer task group will " "receive another cancellation and process its own exceptions." msgstr "" +"タスクグループは、:meth:`~object.__aexit__` を「起こす」ための内部的なキャン" +"セルと、タスクグループが実行されているタスクに対する外部からのキャンセル要求" +"を区別します。\n" +"特に、タスクグループが構文上入れ子になっていて、両方のグループの子タスクで同" +"時に例外が発生した場合は、まず内側のグループが例外を処理します。\n" +"その後、外側のグループが別のキャンセルを受け取り、自身の例外を処理します。" -#: ../../library/asyncio-task.rst:416 msgid "" "In the case where a task group is cancelled externally and also must raise " "an :exc:`ExceptionGroup`, it will call the parent task's :meth:`~asyncio." "Task.cancel` method. This ensures that a :exc:`asyncio.CancelledError` will " "be raised at the next :keyword:`await`, so the cancellation is not lost." msgstr "" +"タスクグループが外部からキャンセルされ、かつ :exc:`ExceptionGroup` を送出する" +"必要もある場合は、親タスクの :meth:`~asyncio.Task.cancel` メソッドを呼び出し" +"ます。\n" +"これにより、次の :keyword:`await` で :exc:`asyncio.CancelledError` が送出さ" +"れ、キャンセルが失われないようにします。" -#: ../../library/asyncio-task.rst:422 msgid "" "Task groups preserve the cancellation count reported by :meth:`asyncio.Task." "cancelling`." msgstr "" +"タスクグループは :meth:`asyncio.Task.cancelling` が返すキャンセル回数を保持し" +"ます。" -#: ../../library/asyncio-task.rst:427 msgid "" "Improved handling of simultaneous internal and external cancellations and " "correct preservation of cancellation counts." msgstr "" +"内部と外部からのキャンセルが同時に発生した場合の処理が改善され、キャンセル回" +"数が正しく保持されるようになりました。" #: ../../library/asyncio-task.rst:431 msgid "Terminating a Task Group" @@ -729,15 +885,15 @@ msgstr "" "``sleep()`` は常に現在の Task を一時中断し、他の Task が実行されるのを許可し" "ます。" -#: ../../library/asyncio-task.rst:491 msgid "" "Setting the delay to 0 provides an optimized path to allow other tasks to " "run. This can be used by long-running functions to avoid blocking the event " "loop for the full duration of the function call." msgstr "" -"delay を 0 に設定することで、他のタスクを実行可能にする最適な方針を提供しま" -"す。この方法は、実行時間の長い関数が、その実行時間全体にわたってイベントルー" -"プをブロックしないようにするために利用できます。" +"``delay`` を 0 に設定すると、最適化された処理経路で他のタスクを実行できるよう" +"にします。\n" +"長時間実行する関数でこれを使うと、関数の呼び出し中ずっとイベントループをブ" +"ロックしてしまうのを避けられます。" #: ../../library/asyncio-task.rst:497 msgid "" @@ -767,9 +923,10 @@ msgstr "" msgid "Removed the *loop* parameter." msgstr "*loop* パラメータが削除されました。" -#: ../../library/asyncio-task.rst:518 msgid "Raises :exc:`ValueError` if *delay* is :data:`~math.nan`." msgstr "" +"*delay* が :data:`~math.nan` の場合に :exc:`ValueError` を送出するようになり" +"ました。" #: ../../library/asyncio-task.rst:523 msgid "Running Tasks Concurrently" @@ -851,7 +1008,6 @@ msgid "" "tasks)." msgstr "" -#: ../../library/asyncio-task.rst:566 msgid "" "import asyncio\n" "\n" @@ -889,8 +1045,42 @@ msgid "" "# Task C: factorial(4) = 24\n" "# [2, 6, 24]" msgstr "" +"import asyncio\n" +"\n" +"async def factorial(name, number):\n" +" f = 1\n" +" for i in range(2, number + 1):\n" +" print(f\"Task {name}: Compute factorial({number}), currently i={i}..." +"\")\n" +" await asyncio.sleep(1)\n" +" f *= i\n" +" print(f\"Task {name}: factorial({number}) = {f}\")\n" +" return f\n" +"\n" +"async def main():\n" +" # 3 つの呼び出しを並行に実行するようスケジュールする:\n" +" L = await asyncio.gather(\n" +" factorial(\"A\", 2),\n" +" factorial(\"B\", 3),\n" +" factorial(\"C\", 4),\n" +" )\n" +" print(L)\n" +"\n" +"asyncio.run(main())\n" +"\n" +"# 期待される出力:\n" +"#\n" +"# Task A: Compute factorial(2), currently i=2...\n" +"# Task B: Compute factorial(3), currently i=2...\n" +"# Task C: Compute factorial(4), currently i=2...\n" +"# Task A: factorial(2) = 2\n" +"# Task B: Compute factorial(3), currently i=3...\n" +"# Task C: Compute factorial(4), currently i=3...\n" +"# Task B: factorial(3) = 6\n" +"# Task C: Compute factorial(4), currently i=4...\n" +"# Task C: factorial(4) = 24\n" +"# [2, 6, 24]" -#: ../../library/asyncio-task.rst:602 msgid "" "If *return_exceptions* is false, cancelling gather() after it has been " "marked done won't cancel any submitted awaitables. For instance, gather can " @@ -898,6 +1088,12 @@ msgid "" "calling ``gather.cancel()`` after catching an exception (raised by one of " "the awaitables) from gather won't cancel any other awaitables." msgstr "" +"*return_exceptions* が偽の場合、完了状態になった後で ``gather()`` をキャンセ" +"ルしても、渡された awaitable はキャンセルされません。\n" +"例えば、``gather`` は例外を呼び出し元に伝播した時点で完了状態になることがあり" +"ます。\n" +"そのため、いずれかの awaitable が送出した例外を ``gather`` から捕捉した後で " +"``gather.cancel()`` を呼び出しても、他の awaitable はキャンセルされません。" #: ../../library/asyncio-task.rst:609 msgid "" @@ -907,22 +1103,22 @@ msgstr "" "*gather* 自身がキャンセルされた場合は、 *return_exceptions* の値に関わらず" "キャンセルが伝搬されます。" -#: ../../library/asyncio-task.rst:616 msgid "" "Deprecation warning is emitted if no positional arguments are provided or " "not all positional arguments are Future-like objects and there is no running " "event loop." msgstr "" +"位置引数が渡されていない場合、または位置引数のすべてが Future のようなオブ" +"ジェクトというわけではなく、かつ実行中のイベントループがない場合に、非推奨の" +"警告を出すようになりました。" #: ../../library/asyncio-task.rst:625 msgid "Eager Task Factory" msgstr "" -#: ../../library/asyncio-task.rst:629 msgid "A task factory for eager task execution." -msgstr "" +msgstr "タスクの実行を即座に開始するタスクファクトリーです。" -#: ../../library/asyncio-task.rst:631 msgid "" "When using this factory (via :meth:`loop.set_task_factory(asyncio." "eager_task_factory) `), coroutines begin execution " @@ -931,14 +1127,21 @@ msgid "" "overhead of loop scheduling is avoided for coroutines that complete " "synchronously." msgstr "" +"このファクトリーを :meth:`loop.set_task_factory(asyncio.eager_task_factory) " +"` で使うと、:class:`Task` の構築中にコルーチンの実行を" +"同期的に開始します。\n" +"タスクがイベントループにスケジュールされるのは、処理がブロックした場合だけで" +"す。\n" +"同期的に完了するコルーチンではループへのスケジュールに伴うオーバーヘッドを避" +"けられるため、性能が向上する場合があります。" -#: ../../library/asyncio-task.rst:637 msgid "" "A common example where this is beneficial is coroutines which employ caching " "or memoization to avoid actual I/O when possible." msgstr "" +"これが役立つ典型例は、キャッシュやメモ化を使って可能な限り実際の I/O を避ける" +"コルーチンです。" -#: ../../library/asyncio-task.rst:642 msgid "" "Immediate execution of the coroutine is a semantic change. If the coroutine " "returns or raises, the task is never scheduled to the event loop. If the " @@ -946,27 +1149,42 @@ msgid "" "change may introduce behavior changes to existing applications. For example, " "the application's task execution order is likely to change." msgstr "" +"コルーチンを即座に実行すると、実行の意味が変わります。\n" +"コルーチンが値を返すか例外を送出すると、タスクはイベントループにスケジュール" +"されません。\n" +"コルーチンの実行がブロックすると、タスクはイベントループにスケジュールされま" +"す。\n" +"この変更により、既存のアプリケーションの動作が変わる可能性があります。\n" +"例えば、タスクの実行順序は変わる可能性が高いでしょう。" -#: ../../library/asyncio-task.rst:653 msgid "" "Create an eager task factory, similar to :func:`eager_task_factory`, using " "the provided *custom_task_constructor* when creating a new task instead of " "the default :class:`Task`." msgstr "" +":func:`eager_task_factory` と同様に即時実行するタスクファクトリーを作成しま" +"す。\n" +"新しいタスクの作成には、デフォルトの :class:`Task` の代わりに、指定された " +"*custom_task_constructor* を使います。" -#: ../../library/asyncio-task.rst:657 msgid "" "*custom_task_constructor* must be a *callable* with the signature matching " "the signature of :class:`Task.__init__ `. The callable must return a :" "class:`asyncio.Task`-compatible object." msgstr "" +"*custom_task_constructor* は :class:`Task.__init__ ` と同じシグネチャを" +"持つ *呼び出し可能オブジェクト* でなければなりません。\n" +"このオブジェクトは :class:`asyncio.Task` と互換性のあるオブジェクトを返す必要" +"があります。" -#: ../../library/asyncio-task.rst:661 msgid "" "This function returns a *callable* intended to be used as a task factory of " "an event loop via :meth:`loop.set_task_factory(factory) `)." msgstr "" +"この関数は、:meth:`loop.set_task_factory(factory) ` で" +"イベントループのタスクファクトリーとして使うための *呼び出し可能オブジェクト" +"* を返します。" #: ../../library/asyncio-task.rst:668 msgid "Shielding From Cancellation" @@ -989,21 +1207,20 @@ msgstr "" msgid "The statement::" msgstr "文::" -#: ../../library/asyncio-task.rst:679 msgid "" "task = asyncio.create_task(something())\n" "res = await shield(task)" msgstr "" +"task = asyncio.create_task(something())\n" +"res = await shield(task)" #: ../../library/asyncio-task.rst:682 msgid "is equivalent to::" msgstr "は、以下と同じです ::" -#: ../../library/asyncio-task.rst:684 msgid "res = await something()" -msgstr "" +msgstr "res = await something()" -#: ../../library/asyncio-task.rst:686 msgid "" "*except* that if the coroutine containing it is cancelled, the Task running " "in ``something()`` is not cancelled. From the point of view of " @@ -1011,11 +1228,11 @@ msgid "" "still cancelled, so the \"await\" expression still raises a :exc:" "`CancelledError`." msgstr "" -"それを含むコルーチンがキャンセルされた場合を *除き*、``something()`` 内で動作" -"している Task はキャンセルされません。\n" -"``something()`` 側から見るとキャンセルは発生しません。\n" -"呼び出し元がキャンセルされた場合でも、 \"await\" 式は :exc:`CancelledError` " -"を送出します。" +"ただし、これを含むコルーチンがキャンセルされても、``something()`` を実行して" +"いる Task はキャンセルされない *という違いがあります*。\n" +"``something()`` 側から見ると、キャンセルは発生していません。\n" +"呼び出し元はキャンセルされるため、\"await\" 式は :exc:`CancelledError` を送出" +"します。" #: ../../library/asyncio-task.rst:692 msgid "" @@ -1034,7 +1251,6 @@ msgstr "" "完全にキャンセルを無視したい場合 (推奨はしません) は、 ``shield()`` 関数は次" "のように try/except 節と組み合わせることになるでしょう::" -#: ../../library/asyncio-task.rst:699 msgid "" "task = asyncio.create_task(something())\n" "try:\n" @@ -1042,71 +1258,92 @@ msgid "" "except CancelledError:\n" " res = None" msgstr "" +"task = asyncio.create_task(something())\n" +"try:\n" +" res = await shield(task)\n" +"except CancelledError:\n" +" res = None" -#: ../../library/asyncio-task.rst:707 msgid "" "Save a reference to tasks passed to this function, to avoid a task " "disappearing mid-execution. The event loop only keeps weak references to " "tasks. A task that isn't referenced elsewhere may get garbage collected at " "any time, even before it's done." msgstr "" +"タスクが実行途中で消えないように、この関数に渡すタスクへの参照を保持してくだ" +"さい。\n" +"イベントループはタスクへの弱参照しか保持しません。\n" +"他から参照されていないタスクは、完了前でもいつでもガベージコレクションされる" +"可能性があります。" -#: ../../library/asyncio-task.rst:715 msgid "" "Deprecation warning is emitted if *aw* is not Future-like object and there " "is no running event loop." msgstr "" +"*aw* が Future のようなオブジェクトでなく、実行中のイベントループもない場合" +"に、非推奨の警告を出すようになりました。" #: ../../library/asyncio-task.rst:721 msgid "Timeouts" msgstr "タイムアウト" -#: ../../library/asyncio-task.rst:725 msgid "" "Return an :ref:`asynchronous context manager ` that " "can be used to limit the amount of time spent waiting on something." msgstr "" +"待機に費やす時間を制限できる :ref:`非同期コンテキストマネージャー ` を返します。" -#: ../../library/asyncio-task.rst:729 msgid "" "*delay* can either be ``None``, or a float/int number of seconds to wait. If " "*delay* is ``None``, no time limit will be applied; this can be useful if " "the delay is unknown when the context manager is created." msgstr "" +"*delay* には ``None``、または待機する秒数を浮動小数点数か整数で指定できま" +"す。\n" +"*delay* が ``None`` の場合、時間制限は適用されません。\n" +"コンテキストマネージャーの作成時点で待機時間が分からない場合に便利です。" -#: ../../library/asyncio-task.rst:734 msgid "" "In either case, the context manager can be rescheduled after creation using :" "meth:`Timeout.reschedule`." msgstr "" +"どちらの場合も、作成後に :meth:`Timeout.reschedule` でコンテキストマネー" +"ジャーの期限を変更できます。" -#: ../../library/asyncio-task.rst:739 msgid "" "async def main():\n" " async with asyncio.timeout(10):\n" " await long_running_task()" msgstr "" +"async def main():\n" +" async with asyncio.timeout(10):\n" +" await long_running_task()" -#: ../../library/asyncio-task.rst:743 msgid "" "If ``long_running_task`` takes more than 10 seconds to complete, the context " "manager will cancel the current task and handle the resulting :exc:`asyncio." "CancelledError` internally, transforming it into a :exc:`TimeoutError` which " "can be caught and handled." msgstr "" +"``long_running_task`` の完了に 10 秒を超えてかかると、コンテキストマネー" +"ジャーは現在のタスクをキャンセルします。\n" +"その結果生じる :exc:`asyncio.CancelledError` を内部で処理し、捕捉して処理でき" +"る :exc:`TimeoutError` に変換します。" -#: ../../library/asyncio-task.rst:750 msgid "" "The :func:`asyncio.timeout` context manager is what transforms the :exc:" "`asyncio.CancelledError` into a :exc:`TimeoutError`, which means the :exc:" "`TimeoutError` can only be caught *outside* of the context manager." msgstr "" +":exc:`asyncio.CancelledError` を :exc:`TimeoutError` に変換するのは :func:" +"`asyncio.timeout` のコンテキストマネージャーです。\n" +"そのため、:exc:`TimeoutError` を捕捉できるのはコンテキストマネージャーの *外" +"側* だけです。" -#: ../../library/asyncio-task.rst:755 msgid "Example of catching :exc:`TimeoutError`::" -msgstr "" +msgstr ":exc:`TimeoutError` を捕捉する例です。 ::" -#: ../../library/asyncio-task.rst:757 msgid "" "async def main():\n" " try:\n" @@ -1117,49 +1354,58 @@ msgid "" "\n" " print(\"This statement will run regardless.\")" msgstr "" +"async def main():\n" +" try:\n" +" async with asyncio.timeout(10):\n" +" await long_running_task()\n" +" except TimeoutError:\n" +" print(\"The long operation timed out, but we've handled it.\")\n" +"\n" +" print(\"This statement will run regardless.\")" -#: ../../library/asyncio-task.rst:766 msgid "" "The context manager produced by :func:`asyncio.timeout` can be rescheduled " "to a different deadline and inspected." msgstr "" +":func:`asyncio.timeout` が生成するコンテキストマネージャーは、期限を変更した" +"り、状態を調べたりできます。" -#: ../../library/asyncio-task.rst:771 msgid "" "An :ref:`asynchronous context manager ` for " "cancelling overdue coroutines." msgstr "" +"期限を超えたコルーチンをキャンセルするための :ref:`非同期コンテキストマネー" +"ジャー ` です。" -#: ../../library/asyncio-task.rst:774 msgid "" "``when`` should be an absolute time at which the context should time out, as " "measured by the event loop's clock:" msgstr "" +"``when`` には、イベントループの時計で計測した、タイムアウトすべき絶対時刻を指" +"定してください。" -#: ../../library/asyncio-task.rst:777 msgid "If ``when`` is ``None``, the timeout will never trigger." -msgstr "" +msgstr "``when`` が ``None`` の場合、タイムアウトは発生しません。" -#: ../../library/asyncio-task.rst:778 msgid "" "If ``when < loop.time()``, the timeout will trigger on the next iteration of " "the event loop." msgstr "" +"``when < loop.time()`` の場合、イベントループの次の反復でタイムアウトが発生し" +"ます。" -#: ../../library/asyncio-task.rst:783 msgid "" "Return the current deadline, or ``None`` if the current deadline is not set." msgstr "" +"現在の期限を返します。\n" +"期限が設定されていなければ ``None`` を返します。" -#: ../../library/asyncio-task.rst:788 msgid "Reschedule the timeout." -msgstr "" +msgstr "タイムアウトの期限を変更します。" -#: ../../library/asyncio-task.rst:792 msgid "Return whether the context manager has exceeded its deadline (expired)." -msgstr "" +msgstr "コンテキストマネージャーが期限を過ぎたかどうかを返します。" -#: ../../library/asyncio-task.rst:797 msgid "" "async def main():\n" " try:\n" @@ -1176,18 +1422,31 @@ msgid "" " if cm.expired():\n" " print(\"Looks like we haven't finished on time.\")" msgstr "" +"async def main():\n" +" try:\n" +" # 開始時には期限が分からないので、``None`` を渡す。\n" +" async with asyncio.timeout(None) as cm:\n" +" # 期限が分かったので設定する。\n" +" new_deadline = get_running_loop().time() + 10\n" +" cm.reschedule(new_deadline)\n" +"\n" +" await long_running_task()\n" +" except TimeoutError:\n" +" pass\n" +"\n" +" if cm.expired():\n" +" print(\"Looks like we haven't finished on time.\")" -#: ../../library/asyncio-task.rst:812 msgid "Timeout context managers can be safely nested." -msgstr "" +msgstr "タイムアウトのコンテキストマネージャーは安全に入れ子にできます。" -#: ../../library/asyncio-task.rst:818 msgid "" "Similar to :func:`asyncio.timeout`, except *when* is the absolute time to " "stop waiting, or ``None``." msgstr "" +":func:`asyncio.timeout` と似ていますが、*when* には待機を終了する絶対時刻、ま" +"たは ``None`` を指定します。" -#: ../../library/asyncio-task.rst:823 msgid "" "async def main():\n" " loop = get_running_loop()\n" @@ -1200,6 +1459,16 @@ msgid "" "\n" " print(\"This statement will run regardless.\")" msgstr "" +"async def main():\n" +" loop = get_running_loop()\n" +" deadline = loop.time() + 20\n" +" try:\n" +" async with asyncio.timeout_at(deadline):\n" +" await long_running_task()\n" +" except TimeoutError:\n" +" print(\"The long operation timed out, but we've handled it.\")\n" +"\n" +" print(\"This statement will run regardless.\")" #: ../../library/asyncio-task.rst:839 msgid "" @@ -1245,7 +1514,6 @@ msgstr "" msgid "If the wait is cancelled, the future *aw* is also cancelled." msgstr "待機が中止された場合 *aw* も中止されます。" -#: ../../library/asyncio-task.rst:864 msgid "" "async def eternity():\n" " # Sleep for one hour\n" @@ -1265,27 +1533,49 @@ msgid "" "#\n" "# timeout!" msgstr "" +"async def eternity():\n" +" # 1 時間スリープする\n" +" await asyncio.sleep(3600)\n" +" print('yay!')\n" +"\n" +"async def main():\n" +" # 最大 1 秒待つ\n" +" try:\n" +" await asyncio.wait_for(eternity(), timeout=1.0)\n" +" except TimeoutError:\n" +" print('timeout!')\n" +"\n" +"asyncio.run(main())\n" +"\n" +"# 期待される出力:\n" +"#\n" +"# timeout!" -#: ../../library/asyncio-task.rst:882 msgid "" "When *aw* is cancelled due to a timeout, ``wait_for`` waits for *aw* to be " "cancelled. Previously, it raised :exc:`TimeoutError` immediately." msgstr "" +"タイムアウトにより *aw* をキャンセルする場合、``wait_for`` は *aw* のキャンセ" +"ルが完了するまで待つようになりました。\n" +"以前は :exc:`TimeoutError` を即座に送出していました。" -#: ../../library/asyncio-task.rst:890 msgid "Raises :exc:`TimeoutError` instead of :exc:`asyncio.TimeoutError`." msgstr "" +":exc:`asyncio.TimeoutError` の代わりに :exc:`TimeoutError` を送出するようにな" +"りました。" #: ../../library/asyncio-task.rst:895 msgid "Waiting Primitives" msgstr "要素の終了待機" -#: ../../library/asyncio-task.rst:900 msgid "" "Run :class:`~asyncio.Future` and :class:`~asyncio.Task` instances in the " "*aws* iterable concurrently and block until the condition specified by " "*return_when*." msgstr "" +"イテラブル *aws* に含まれる :class:`~asyncio.Future` と :class:`~asyncio." +"Task` のインスタンスを並行に実行し、*return_when* で指定した条件が満たされる" +"までブロックします。" #: ../../library/asyncio-task.rst:904 msgid "The *aws* iterable must not be empty." @@ -1299,9 +1589,8 @@ msgstr "Task/Future からなる 2 つの集合 ``(done, pending)`` を返しま msgid "Usage::" msgstr "使い方::" -#: ../../library/asyncio-task.rst:910 msgid "done, pending = await asyncio.wait(aws)" -msgstr "" +msgstr "done, pending = await asyncio.wait(aws)" #: ../../library/asyncio-task.rst:912 msgid "" @@ -1311,12 +1600,14 @@ msgstr "" "*timeout* (浮動小数点数または整数) が指定されていたら、処理を返すのを待つ最大" "秒数を制御するのに使われます。" -#: ../../library/asyncio-task.rst:915 msgid "" "Note that this function does not raise :exc:`TimeoutError`. Futures or Tasks " "that aren't done when the timeout occurs are simply returned in the second " "set." msgstr "" +"この関数は :exc:`TimeoutError` を送出しません。\n" +"タイムアウト時点で完了していない Future や Task は、単に 2 番目の集合に入れて" +"返されます。" #: ../../library/asyncio-task.rst:919 msgid "" @@ -1338,12 +1629,13 @@ msgstr "説明" msgid "The function will return when any future finishes or is cancelled." msgstr "いずれかのフューチャが終了したかキャンセルされたときに返します。" -#: ../../library/asyncio-task.rst:932 msgid "" "The function will return when any future finishes by raising an exception. " "If no future raises an exception then it is equivalent to :const:" "`ALL_COMPLETED`." msgstr "" +"いずれかのフューチャが例外を送出して終了すると、この関数は返ります。\n" +"例外を送出するフューチャがない場合は、:const:`ALL_COMPLETED` と等価です。" #: ../../library/asyncio-task.rst:937 msgid "The function will return when all futures finish or are cancelled." @@ -1357,22 +1649,22 @@ msgstr "" ":func:`~asyncio.wait_for` と異なり、 ``wait()`` はタイムアウトが起きたとき" "に Future をキャンセルしません。" -#: ../../library/asyncio-task.rst:945 msgid "Passing coroutine objects to ``wait()`` directly is forbidden." -msgstr "" +msgstr "``wait()`` にコルーチンオブジェクトを直接渡すことは禁止されました。" -#: ../../library/asyncio-task.rst:948 ../../library/asyncio-task.rst:1006 msgid "Added support for generators yielding tasks." -msgstr "" +msgstr "タスクを yield するジェネレーターをサポートするようになりました。" -#: ../../library/asyncio-task.rst:954 msgid "" "Run :ref:`awaitable objects ` in the *aws* iterable " "concurrently. The returned object can be iterated to obtain the results of " "the awaitables as they finish." msgstr "" +"イテラブル *aws* に含まれる :ref:`awaitable オブジェクト ` を並行に実行します。\n" +"返されたオブジェクトを反復すると、awaitable の完了に応じて結果を取得できま" +"す。" -#: ../../library/asyncio-task.rst:958 msgid "" "The object returned by ``as_completed()`` can be iterated as an :term:" "`asynchronous iterator` or a plain :term:`iterator`. When asynchronous " @@ -1380,8 +1672,13 @@ msgid "" "are tasks or futures. This makes it easy to correlate previously-scheduled " "tasks with their results. Example::" msgstr "" +"``as_completed()`` が返すオブジェクトは :term:`asynchronous iterator` として" +"も通常の :term:`iterator` としても反復できます。\n" +"非同期反復の場合、もともと渡された awaitable が Task または Future なら、その" +"オブジェクトを yield します。\n" +"これにより、スケジュール済みのタスクと結果を簡単に対応付けられます。\n" +"例えば次のように使います。 ::" -#: ../../library/asyncio-task.rst:964 msgid "" "ipv4_connect = create_task(open_connection(\"127.0.0.1\", 80))\n" "ipv6_connect = create_task(open_connection(\"::1\", 80))\n" @@ -1397,21 +1694,38 @@ msgid "" " else:\n" " print(\"IPv4 connection established.\")" msgstr "" +"ipv4_connect = create_task(open_connection(\"127.0.0.1\", 80))\n" +"ipv6_connect = create_task(open_connection(\"::1\", 80))\n" +"tasks = [ipv4_connect, ipv6_connect]\n" +"\n" +"async for earliest_connect in as_completed(tasks):\n" +" # earliest_connect は完了している。await するか\n" +" # earliest_connect.result() を呼び出すと結果を取得できる。\n" +" reader, writer = await earliest_connect\n" +"\n" +" if earliest_connect is ipv6_connect:\n" +" print(\"IPv6 connection established.\")\n" +" else:\n" +" print(\"IPv4 connection established.\")" -#: ../../library/asyncio-task.rst:978 msgid "" "During asynchronous iteration, implicitly-created tasks will be yielded for " "supplied awaitables that aren't tasks or futures." msgstr "" +"非同期反復では、渡された awaitable が Task や Future でない場合、暗黙に作成さ" +"れたタスクを yield します。" -#: ../../library/asyncio-task.rst:981 msgid "" "When used as a plain iterator, each iteration yields a new coroutine that " "returns the result or raises the exception of the next completed awaitable. " "This pattern is compatible with Python versions older than 3.13::" msgstr "" +"通常のイテレーターとして使う場合、反復のたびに新しいコルーチンを yield しま" +"す。\n" +"このコルーチンは、次に完了する awaitable の結果を返すか、その例外を送出しま" +"す。\n" +"この使い方は Python 3.13 より前のバージョンと互換性があります。 ::" -#: ../../library/asyncio-task.rst:985 msgid "" "ipv4_connect = create_task(open_connection(\"127.0.0.1\", 80))\n" "ipv6_connect = create_task(open_connection(\"::1\", 80))\n" @@ -1423,25 +1737,40 @@ msgid "" " # awaitable that finishes next.\n" " reader, writer = await next_connect" msgstr "" +"ipv4_connect = create_task(open_connection(\"127.0.0.1\", 80))\n" +"ipv6_connect = create_task(open_connection(\"::1\", 80))\n" +"tasks = [ipv4_connect, ipv6_connect]\n" +"\n" +"for next_connect in as_completed(tasks):\n" +" # next_connect は元のタスクオブジェクトではない。\n" +" # await すると、次に完了する awaitable の結果を取得するか、\n" +" # その例外を送出する。\n" +" reader, writer = await next_connect" -#: ../../library/asyncio-task.rst:995 msgid "" "A :exc:`TimeoutError` is raised if the timeout occurs before all awaitables " "are done. This is raised by the ``async for`` loop during asynchronous " "iteration or by the coroutines yielded during plain iteration." msgstr "" +"すべての awaitable が完了する前にタイムアウトすると、:exc:`TimeoutError` を送" +"出します。\n" +"非同期反復では ``async for`` ループが、通常の反復では yield されたコルーチン" +"が、この例外を送出します。" -#: ../../library/asyncio-task.rst:1002 msgid "" "Deprecation warning is emitted if not all awaitable objects in the *aws* " "iterable are Future-like objects and there is no running event loop." msgstr "" +"イテラブル *aws* に含まれる awaitable オブジェクトのすべてが Future のような" +"オブジェクトというわけではなく、かつ実行中のイベントループがない場合に、非推" +"奨の警告を出すようになりました。" -#: ../../library/asyncio-task.rst:1009 msgid "" "The result can now be used as either an :term:`asynchronous iterator` or as " "a plain :term:`iterator` (previously it was only a plain iterator)." msgstr "" +"結果を :term:`asynchronous iterator` としても通常の :term:`iterator` としても" +"使えるようになりました (以前は通常のイテレーターとしてのみ使えました)。" #: ../../library/asyncio-task.rst:1015 msgid "Running in Threads" @@ -1467,14 +1796,15 @@ msgid "" "Return a coroutine that can be awaited to get the eventual result of *func*." msgstr "関数 *func* の最終結果を待ち受けできるコルーチンを返します。" -#: ../../library/asyncio-task.rst:1029 msgid "" "This coroutine function is primarily intended to be used for executing IO-" "bound functions/methods that would otherwise block the event loop if they " "were run in the main thread. For example::" msgstr "" +"このコルーチン関数は主に、メインスレッドで実行するとイベントループをブロック" +"してしまう I/O バウンドの関数やメソッドを実行するためのものです。\n" +"例えば次のように使います。 ::" -#: ../../library/asyncio-task.rst:1033 msgid "" "def blocking_io():\n" " print(f\"start blocking_io at {time.strftime('%X')}\")\n" @@ -1502,14 +1832,42 @@ msgid "" "# blocking_io complete at 19:50:54\n" "# finished main at 19:50:54" msgstr "" +"def blocking_io():\n" +" print(f\"start blocking_io at {time.strftime('%X')}\")\n" +" # time.sleep() は、ファイル操作などのブロックする\n" +" # I/O バウンドの処理に置き換えられる。\n" +" time.sleep(1)\n" +" print(f\"blocking_io complete at {time.strftime('%X')}\")\n" +"\n" +"async def main():\n" +" print(f\"started main at {time.strftime('%X')}\")\n" +"\n" +" await asyncio.gather(\n" +" asyncio.to_thread(blocking_io),\n" +" asyncio.sleep(1))\n" +"\n" +" print(f\"finished main at {time.strftime('%X')}\")\n" +"\n" +"\n" +"asyncio.run(main())\n" +"\n" +"# 期待される出力:\n" +"#\n" +"# started main at 19:50:53\n" +"# start blocking_io at 19:50:53\n" +"# blocking_io complete at 19:50:54\n" +"# finished main at 19:50:54" -#: ../../library/asyncio-task.rst:1059 msgid "" "Directly calling ``blocking_io()`` in any coroutine would block the event " "loop for its duration, resulting in an additional 1 second of run time. " "Instead, by using ``asyncio.to_thread()``, we can run it in a separate " "thread without blocking the event loop." msgstr "" +"コルーチン内で ``blocking_io()`` を直接呼び出すと、実行中ずっとイベントループ" +"をブロックするため、実行時間が 1 秒長くなります。\n" +"代わりに ``asyncio.to_thread()`` を使えば、イベントループをブロックせずに別の" +"スレッドで実行できます。" #: ../../library/asyncio-task.rst:1066 msgid "" @@ -1546,7 +1904,6 @@ msgstr "" "び出すためのものです。\n" "例えば次のように使います::" -#: ../../library/asyncio-task.rst:1087 msgid "" "def in_thread(loop: asyncio.AbstractEventLoop) -> None:\n" " # Run some blocking IO\n" @@ -1569,12 +1926,32 @@ msgid "" " # Run something in a thread\n" " await asyncio.to_thread(in_thread, loop)" msgstr "" +"def in_thread(loop: asyncio.AbstractEventLoop) -> None:\n" +" # ブロックする I/O を実行する\n" +" pathlib.Path(\"example.txt\").write_text(\"hello world\", " +"encoding=\"utf8\")\n" +"\n" +" # コルーチンを作成する\n" +" coro = asyncio.sleep(1, result=3)\n" +"\n" +" # 指定されたループにコルーチンを送る\n" +" future = asyncio.run_coroutine_threadsafe(coro, loop)\n" +"\n" +" # 省略可能な timeout 引数を指定して結果を待つ\n" +" assert future.result(timeout=2) == 3\n" +"\n" +"async def amain() -> None:\n" +" # 実行中のループを取得する\n" +" loop = asyncio.get_running_loop()\n" +"\n" +" # スレッドで処理を実行する\n" +" await asyncio.to_thread(in_thread, loop)" -#: ../../library/asyncio-task.rst:1107 msgid "It's also possible to run the other way around. Example::" msgstr "" +"逆に、別のスレッドで実行するイベントループへ処理を送ることもできます。\n" +"例えば次のようにします。 ::" -#: ../../library/asyncio-task.rst:1109 msgid "" "@contextlib.contextmanager\n" "def loop_in_thread() -> Generator[asyncio.AbstractEventLoop]:\n" @@ -1609,6 +1986,38 @@ msgid "" " # Wait for the result with an optional timeout argument\n" " assert future.result(timeout=2) == 3" msgstr "" +"@contextlib.contextmanager\n" +"def loop_in_thread() -> Generator[asyncio.AbstractEventLoop]:\n" +" loop_fut = concurrent.futures.Future[asyncio.AbstractEventLoop]()\n" +" stop_event = asyncio.Event()\n" +"\n" +" async def main() -> None:\n" +" loop_fut.set_result(asyncio.get_running_loop())\n" +" await stop_event.wait()\n" +"\n" +" with concurrent.futures.ThreadPoolExecutor(1) as tpe:\n" +" complete_fut = tpe.submit(asyncio.run, main())\n" +" for fut in concurrent.futures.as_completed((loop_fut, " +"complete_fut)):\n" +" if fut is loop_fut:\n" +" loop = loop_fut.result()\n" +" try:\n" +" yield loop\n" +" finally:\n" +" loop.call_soon_threadsafe(stop_event.set)\n" +" else:\n" +" fut.result()\n" +"\n" +"# 別のスレッドにループを作成する\n" +"with loop_in_thread() as loop:\n" +" # コルーチンを作成する\n" +" coro = asyncio.sleep(1, result=3)\n" +"\n" +" # 指定されたループにコルーチンを送る\n" +" future = asyncio.run_coroutine_threadsafe(coro, loop)\n" +"\n" +" # 省略可能な timeout 引数を指定して結果を待つ\n" +" assert future.result(timeout=2) == 3" #: ../../library/asyncio-task.rst:1141 msgid "" @@ -1618,7 +2027,6 @@ msgstr "" "コルーチンから例外が送出された場合、返された Future に通知されます。\n" "これはイベントループの Task をキャンセルするのにも使えます::" -#: ../../library/asyncio-task.rst:1145 msgid "" "try:\n" " result = future.result(timeout)\n" @@ -1630,6 +2038,15 @@ msgid "" "else:\n" " print(f'The coroutine returned: {result!r}')" msgstr "" +"try:\n" +" result = future.result(timeout)\n" +"except TimeoutError:\n" +" print('The coroutine took too long, cancelling the task...')\n" +" future.cancel()\n" +"except Exception as exc:\n" +" print(f'The coroutine raised an exception: {exc!r}')\n" +"else:\n" +" print(f'The coroutine returned: {result!r}')" #: ../../library/asyncio-task.rst:1155 msgid "" @@ -1680,9 +2097,8 @@ msgstr "" "*loop* が ``None`` の場合、 :func:`get_running_loop` は現在のループを取得する" "のに使われます。" -#: ../../library/asyncio-task.rst:1192 msgid "Return ``True`` if *obj* is a coroutine object." -msgstr "" +msgstr "*obj* がコルーチンオブジェクトなら ``True`` を返します。" #: ../../library/asyncio-task.rst:1198 msgid "Task Object" @@ -1720,7 +2136,6 @@ msgstr "" "Task が Future の完了を待っているときは、イベントループは他の Task やコール" "バックを動作させるか、 IO 処理を実行します。" -#: ../../library/asyncio-task.rst:1216 msgid "" "Use the high-level :func:`asyncio.create_task` function to create Tasks, or " "the low-level :meth:`loop.create_task` or :func:`ensure_future` functions. " @@ -1729,7 +2144,7 @@ msgstr "" "Task を作成するには高レベルの :func:`asyncio.create_task` 関数、あるいは低レ" "ベルの :meth:`loop.create_task` 関数や :func:`ensure_future` 関数を使用してく" "ださい。\n" -"手作業での Task の実装は推奨されません。" +"Task を直接インスタンス化することは推奨されません。" #: ../../library/asyncio-task.rst:1221 msgid "" @@ -1743,16 +2158,14 @@ msgstr "" "`CancelledError` 例外を送出します。キャンセルの際にコルーチンが Future オブ" "ジェクトを待っていた場合、その Future オブジェクトはキャンセルされます。" -#: ../../library/asyncio-task.rst:1226 msgid "" ":meth:`cancelled` can be used to check if the Task was cancelled. The method " "returns ``True`` if the wrapped coroutine did not suppress the :exc:" "`CancelledError` exception and was actually cancelled." msgstr "" -":meth:`cancelled` は、タスクがキャンセルされたかを調べるのに使用できます。タ" -"スクを内包するコルーチンで :exc:`CancelledError` 例外が抑制されておらず、かつ" -"タスクが実際にキャンセルされている場合に、このメソッドは ``True`` を変えま" -"す。" +":meth:`cancelled` を使うと Task がキャンセルされたかどうかを確認できます。\n" +"Task が内包するコルーチンが :exc:`CancelledError` 例外を抑制せず、実際にキャ" +"ンセルされた場合、このメソッドは ``True`` を返します。" #: ../../library/asyncio-task.rst:1231 msgid "" @@ -1762,15 +2175,17 @@ msgstr "" ":class:`asyncio.Task` は、:meth:`Future.set_result` と :meth:`Future." "set_exception` を除いて、:class:`Future` の API をすべて継承しています。" -#: ../../library/asyncio-task.rst:1235 msgid "" "An optional keyword-only *context* argument allows specifying a custom :" "class:`contextvars.Context` for the *coro* to run in. If no *context* is " "provided, the Task copies the current context and later runs its coroutine " "in the copied context." msgstr "" +"省略可能なキーワード専用引数 *context* では、*coro* を実行するための独自の :" +"class:`contextvars.Context` を指定できます。\n" +"*context* を指定しない場合、Task は現在のコンテキストをコピーし、後でそのコ" +"ピーの中でコルーチンを実行します。" -#: ../../library/asyncio-task.rst:1240 msgid "" "An optional keyword-only *eager_start* argument allows eagerly starting the " "execution of the :class:`asyncio.Task` at task creation time. If set to " @@ -1779,20 +2194,26 @@ msgid "" "coroutine returns or raises without blocking, the task will be finished " "eagerly and will skip scheduling to the event loop." msgstr "" +"省略可能なキーワード専用引数 *eager_start* では、:class:`asyncio.Task` の作成" +"時に実行を即座に開始するよう指定できます。\n" +"``True`` に設定され、イベントループが実行中であれば、タスクはコルーチンの実行" +"を即座に開始し、コルーチンが初めてブロックするまで実行します。\n" +"コルーチンがブロックせずに値を返すか例外を送出すると、タスクはその場で完了" +"し、イベントループへのスケジュールを省略します。" #: ../../library/asyncio-task.rst:1247 msgid "Added support for the :mod:`contextvars` module." msgstr ":mod:`contextvars` モジュールのサポートを追加。" -#: ../../library/asyncio-task.rst:1253 msgid "" "Deprecation warning is emitted if *loop* is not specified and there is no " "running event loop." msgstr "" +"*loop* が指定されておらず、実行中のイベントループもない場合に、非推奨の警告を" +"出すようになりました。" -#: ../../library/asyncio-task.rst:1260 msgid "Added the *eager_start* parameter." -msgstr "" +msgstr "*eager_start* パラメーターが追加されました。" #: ../../library/asyncio-task.rst:1265 msgid "Return ``True`` if the Task is *done*." @@ -1826,11 +2247,12 @@ msgstr "" "Task が *キャンセル* されている場合、このメソッドは :exc:`CancelledError` 例" "外を送出します。" -#: ../../library/asyncio-task.rst:1281 msgid "" "If the Task's result isn't yet available, this method raises an :exc:" "`InvalidStateError` exception." msgstr "" +"Task の結果がまだ利用できない場合、このメソッドは :exc:`InvalidStateError` を" +"送出します。" #: ../../library/asyncio-task.rst:1286 msgid "Return the exception of the Task." @@ -1904,7 +2326,6 @@ msgid "Only one stack frame is returned for a suspended coroutine." msgstr "" "サスペンドされているコルーチンの場合スタックフレームが 1 個だけ返されます。" -#: ../../library/asyncio-task.rst:1330 msgid "" "The optional *limit* argument sets the maximum number of frames to return; " "by default all available frames are returned. The ordering of the returned " @@ -1912,11 +2333,12 @@ msgid "" "newest frames of a stack are returned, but the oldest frames of a traceback " "are returned. (This matches the behavior of the traceback module.)" msgstr "" -"オプション引数 *limit* は返すフレームの最大数を指定します; デフォルトでは取得" -"可能な全てのフレームを返します。返されるリストの順番は、スタックが返される" -"か、トレースバックが返されるかによって変わります: スタックでは新しい順に並ん" -"だリストが返されますが、トレースバックでは古い順に並んだリストが返されます" -"(これは traceback モジュールの振る舞いと一致します)。" +"省略可能な *limit* 引数は返すフレーム数の上限を指定します。\n" +"デフォルトでは取得可能なすべてのフレームを返します。\n" +"返されるリストの順序は、スタックとトレースバックのどちらを返すかによって異な" +"ります。\n" +"スタックの場合は最も新しいフレーム群、トレースバックの場合は最も古いフレーム" +"群が返されます (これは traceback モジュールの動作と一致します)。" #: ../../library/asyncio-task.rst:1339 msgid "Print the stack or traceback for this Task." @@ -1934,30 +2356,33 @@ msgstr "" msgid "The *limit* argument is passed to :meth:`get_stack` directly." msgstr "引数 *limit* は :meth:`get_stack` にそのまま渡されます。" -#: ../../library/asyncio-task.rst:1346 msgid "" "The *file* argument is an I/O stream to which the output is written; by " "default output is written to :data:`sys.stdout`." msgstr "" +"*file* 引数は出力先の I/O ストリームです。\n" +"デフォルトでは :data:`sys.stdout` に出力します。" #: ../../library/asyncio-task.rst:1351 msgid "Return the coroutine object wrapped by the :class:`Task`." msgstr ":class:`Task` がラップしているコルーチンオブジェクトを返します。" -#: ../../library/asyncio-task.rst:1355 msgid "" "This will return ``None`` for Tasks which have already completed eagerly. " "See the :ref:`Eager Task Factory `." msgstr "" +"即時実行ですでに完了した Task では ``None`` を返します。\n" +":ref:`即時実行するタスクファクトリー ` を参照してくださ" +"い。" -#: ../../library/asyncio-task.rst:1362 msgid "Newly added eager task execution means result may be ``None``." msgstr "" +"即時実行するタスクが追加されたため、結果が ``None`` になる場合があります。" -#: ../../library/asyncio-task.rst:1366 msgid "" "Return the :class:`contextvars.Context` object associated with the task." msgstr "" +"タスクに関連付けられた :class:`contextvars.Context` オブジェクトを返します。" #: ../../library/asyncio-task.rst:1373 msgid "Return the name of the Task." @@ -1981,31 +2406,31 @@ msgid "" msgstr "" "引数 *value* は文字列に変換可能なオブジェクトであれば何でもかまいません。" -#: ../../library/asyncio-task.rst:1388 msgid "" "In the default Task implementation, the name will be visible in the :func:" "`repr` output of a task object." msgstr "" -"Task のデフォルト実装では、名前はオブジェクトの :func:`repr` メソッドの出力で" +"デフォルトの Task 実装では、タスクオブジェクトの :func:`repr` の出力で名前を" "確認できます。" #: ../../library/asyncio-task.rst:1395 msgid "Request the Task to be cancelled." msgstr "このタスクに、自身のキャンセルを要求します。" -#: ../../library/asyncio-task.rst:1397 msgid "" "If the Task is already *done* or *cancelled*, return ``False``, otherwise, " "return ``True``." msgstr "" +"Task がすでに *完了* または *キャンセル* されている場合は ``False`` を、それ" +"以外の場合は ``True`` を返します。" -#: ../../library/asyncio-task.rst:1400 msgid "" "The method arranges for a :exc:`CancelledError` exception to be thrown into " "the wrapped coroutine on the next cycle of the event loop." msgstr "" +"このメソッドは、イベントループの次のサイクルで、ラップしているコルーチンに :" +"exc:`CancelledError` を送出するように手配します。" -#: ../../library/asyncio-task.rst:1403 msgid "" "The coroutine then has a chance to clean up or even deny the request by " "suppressing the exception with a :keyword:`try` ... ... ``except " @@ -2016,24 +2441,28 @@ msgid "" "suppress the cancellation, it needs to call :meth:`Task.uncancel` in " "addition to catching the exception." msgstr "" +"コルーチンは、:keyword:`try` ... ``except CancelledError`` ... :keyword:" +"`finally` ブロックで後片付けをしたり、例外を抑制してキャンセル要求を拒否した" +"りできます。\n" +"このため、:meth:`Future.cancel` と異なり、:meth:`Task.cancel` は Task がキャ" +"ンセルされることを保証しません。\n" +"ただし、キャンセルを完全に抑制するのは一般的ではなく、強く非推奨とします。\n" +"それでもキャンセルを抑制する場合、コルーチンは例外を捕捉するだけでなく :meth:" +"`Task.uncancel` も呼び出す必要があります。" -#: ../../library/asyncio-task.rst:1413 msgid "Added the *msg* parameter." -msgstr "" +msgstr "*msg* パラメーターが追加されました。" -#: ../../library/asyncio-task.rst:1416 msgid "The ``msg`` parameter is propagated from cancelled task to its awaiter." msgstr "" +"``msg`` パラメーターが、キャンセルされたタスクからそのタスクを await する側へ" +"伝播するようになりました。" -#: ../../library/asyncio-task.rst:1421 msgid "" "The following example illustrates how coroutines can intercept the " "cancellation request::" -msgstr "" -"以下の例は、コルーチンがどのようにしてキャンセルのリクエストを阻止するかを示" -"しています::" +msgstr "次の例は、コルーチンがキャンセル要求を捕捉する方法を示しています。 ::" -#: ../../library/asyncio-task.rst:1424 msgid "" "async def cancel_me():\n" " print('cancel_me(): before sleep')\n" @@ -2069,6 +2498,39 @@ msgid "" "# cancel_me(): after sleep\n" "# main(): cancel_me is cancelled now" msgstr "" +"async def cancel_me():\n" +" print('cancel_me(): before sleep')\n" +"\n" +" try:\n" +" # 1 時間待つ\n" +" await asyncio.sleep(3600)\n" +" except asyncio.CancelledError:\n" +" print('cancel_me(): cancel sleep')\n" +" raise\n" +" finally:\n" +" print('cancel_me(): after sleep')\n" +"\n" +"async def main():\n" +" # \"cancel_me\" タスクを作成する\n" +" task = asyncio.create_task(cancel_me())\n" +"\n" +" # 1 秒待つ\n" +" await asyncio.sleep(1)\n" +"\n" +" task.cancel()\n" +" try:\n" +" await task\n" +" except asyncio.CancelledError:\n" +" print(\"main(): cancel_me is cancelled now\")\n" +"\n" +"asyncio.run(main())\n" +"\n" +"# 期待される出力:\n" +"#\n" +"# cancel_me(): before sleep\n" +"# cancel_me(): cancel sleep\n" +"# cancel_me(): after sleep\n" +"# main(): cancel_me is cancelled now" #: ../../library/asyncio-task.rst:1460 msgid "Return ``True`` if the Task is *cancelled*." @@ -2084,21 +2546,19 @@ msgstr "" "ているコルーチンが内部で送出された :exc:`CancelledError` 例外を伝達したと" "き、 Task は実際に *キャンセル* されます。" -#: ../../library/asyncio-task.rst:1468 msgid "Decrement the count of cancellation requests to this Task." -msgstr "" +msgstr "この Task に対するキャンセル要求の回数を減らします。" -#: ../../library/asyncio-task.rst:1470 msgid "Returns the remaining number of cancellation requests." -msgstr "" +msgstr "残っているキャンセル要求の回数を返します。" -#: ../../library/asyncio-task.rst:1472 msgid "" "Note that once execution of a cancelled task completed, further calls to :" "meth:`uncancel` are ineffective." msgstr "" +"キャンセルされたタスクの実行が完了した後は、:meth:`uncancel` を呼び出しても効" +"果はありません。" -#: ../../library/asyncio-task.rst:1477 msgid "" "This method is used by asyncio's internals and isn't expected to be used by " "end-user code. In particular, if a Task gets successfully uncancelled, this " @@ -2106,8 +2566,13 @@ msgid "" "func:`asyncio.timeout` to continue running, isolating cancellation to the " "respective structured block. For example::" msgstr "" +"このメソッドは asyncio の内部で使うもので、ユーザーのコードからの使用は想定し" +"ていません。\n" +"特に、Task のキャンセル状態を正常に解除できると、キャンセルの影響をそれぞれの" +"構造化されたブロック内に限定でき、:ref:`taskgroups` や :func:`asyncio." +"timeout` などの構造化された並行処理を継続できます。\n" +"例えば次のようになります。 ::" -#: ../../library/asyncio-task.rst:1484 msgid "" "async def make_request_with_timeout():\n" " try:\n" @@ -2120,8 +2585,17 @@ msgid "" " # Outer code not affected by the timeout:\n" " await unrelated_code()" msgstr "" +"async def make_request_with_timeout():\n" +" try:\n" +" async with asyncio.timeout(1):\n" +" # タイムアウトの影響を受ける構造化されたブロック:\n" +" await make_request()\n" +" await make_another_request()\n" +" except TimeoutError:\n" +" log(\"There was a timeout\")\n" +" # 外側のコードはタイムアウトの影響を受けない:\n" +" await unrelated_code()" -#: ../../library/asyncio-task.rst:1495 msgid "" "While the block with ``make_request()`` and ``make_another_request()`` might " "get cancelled due to the timeout, ``unrelated_code()`` should continue " @@ -2129,15 +2603,22 @@ msgid "" "`uncancel`. :class:`TaskGroup` context managers use :func:`uncancel` in a " "similar fashion." msgstr "" +"``make_request()`` と ``make_another_request()`` を含むブロックはタイムアウト" +"によってキャンセルされる可能性がありますが、その場合も ``unrelated_code()`` " +"は実行を続ける必要があります。\n" +"これを実現するのが :meth:`uncancel` です。\n" +":class:`TaskGroup` コンテキストマネージャーも同様に :func:`uncancel` を使いま" +"す。" -#: ../../library/asyncio-task.rst:1501 msgid "" "If end-user code is, for some reason, suppressing cancellation by catching :" "exc:`CancelledError`, it needs to call this method to remove the " "cancellation state." msgstr "" +"何らかの理由でユーザーのコードが :exc:`CancelledError` を捕捉してキャンセルを" +"抑制する場合、キャンセル状態を解除するためにこのメソッドを呼び出す必要があり" +"ます。" -#: ../../library/asyncio-task.rst:1505 msgid "" "When this method decrements the cancellation count to zero, the method " "checks if a previous :meth:`cancel` call had arranged for :exc:" @@ -2145,18 +2626,24 @@ msgid "" "that arrangement will be rescinded (by resetting the internal " "``_must_cancel`` flag)." msgstr "" +"このメソッドによってキャンセル回数がゼロになると、以前の :meth:`cancel` の呼" +"び出しがタスクへの :exc:`CancelledError` の送出を手配していたかどうかを確認し" +"ます。\n" +"まだ送出されていなければ、内部の ``_must_cancel`` フラグをリセットして、その" +"手配を取り消します。" -#: ../../library/asyncio-task.rst:1511 msgid "Changed to rescind pending cancellation requests upon reaching zero." msgstr "" +"キャンセル回数がゼロになったら、保留中のキャンセル要求を取り消すようになりま" +"した。" -#: ../../library/asyncio-task.rst:1516 msgid "" "Return the number of pending cancellation requests to this Task, i.e., the " "number of calls to :meth:`cancel` less the number of :meth:`uncancel` calls." msgstr "" +"この Task に対する保留中のキャンセル要求の回数、つまり :meth:`cancel` の呼び" +"出し回数から :meth:`uncancel` の呼び出し回数を引いた値を返します。" -#: ../../library/asyncio-task.rst:1520 msgid "" "Note that if this number is greater than zero but the Task is still " "executing, :meth:`cancelled` will still return ``False``. This is because " @@ -2164,9 +2651,15 @@ msgid "" "the task not being cancelled after all if the cancellation requests go down " "to zero." msgstr "" +"この回数がゼロより大きくても、Task がまだ実行中なら :meth:`cancelled` は " +"``False`` を返します。\n" +":meth:`uncancel` を呼び出してこの回数を減らし、キャンセル要求がゼロになれば、" +"最終的にタスクがキャンセルされないこともあるためです。" -#: ../../library/asyncio-task.rst:1526 msgid "" "This method is used by asyncio's internals and isn't expected to be used by " "end-user code. See :meth:`uncancel` for more details." msgstr "" +"このメソッドは asyncio の内部で使うもので、ユーザーのコードからの使用は想定し" +"ていません。\n" +"詳しくは :meth:`uncancel` を参照してください。" diff --git a/library/asyncio.po b/library/asyncio.po index eb03cc0db..a2128e634 100644 --- a/library/asyncio.po +++ b/library/asyncio.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: Takanori Suzuki , 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/asyncio.rst:91 @@ -44,7 +44,6 @@ msgstr ":mod:`!asyncio` --- 非同期 I/O" msgid "Hello World!" msgstr "Hello World!" -#: ../../library/asyncio.rst:13 msgid "" "import asyncio\n" "\n" @@ -55,6 +54,14 @@ msgid "" "\n" "asyncio.run(main())" msgstr "" +"import asyncio\n" +"\n" +"async def main():\n" +" print('Hello ...')\n" +" await asyncio.sleep(1)\n" +" print('... World!')\n" +"\n" +"asyncio.run(main())" #: ../../library/asyncio.rst:22 msgid "" @@ -105,9 +112,8 @@ msgstr ":ref:`subprocesses ` を管理する" msgid "distribute tasks via :ref:`queues `;" msgstr ":ref:`キュー ` を使ってタスクを分散する" -#: ../../library/asyncio.rst:43 msgid ":ref:`synchronize ` concurrent code;" -msgstr "並列処理のコードを :ref:`同期 ` させる" +msgstr "並行処理のコードを :ref:`同期 ` させる" #: ../../library/asyncio.rst:45 msgid "" @@ -145,9 +151,8 @@ msgstr "" "コールバックを用いたライブラリと async/await 構文を使ったコードの :ref:`橋渡" "し `" -#: ../../includes/wasm-notavail.rst:3 msgid "Availability" -msgstr "" +msgstr "利用可能な環境" #: ../../includes/wasm-notavail.rst:5 msgid "" @@ -159,13 +164,13 @@ msgstr "" #: ../../library/asyncio.rst:64 msgid "asyncio REPL" -msgstr "" +msgstr "asyncio REPL" #: ../../library/asyncio.rst:65 msgid "" "You can experiment with an ``asyncio`` concurrent context in the :term:" "`REPL`:" -msgstr "" +msgstr ":term:`REPL` で、``asyncio`` 並行コンテキストを試すことができます:" #: ../../library/asyncio.rst:67 msgid "" @@ -178,24 +183,34 @@ msgid "" ">>> await asyncio.sleep(10, result='hello')\n" "'hello'" msgstr "" +"$ python -m asyncio\n" +"asyncio REPL ...\n" +"Use \"await\" directly instead of \"asyncio.run()\".\n" +"Type \"help\", \"copyright\", \"credits\" or \"license\" for more " +"information.\n" +">>> import asyncio\n" +">>> await asyncio.sleep(10, result='hello')\n" +"'hello'" -#: ../../library/asyncio.rst:77 msgid "" "Raises an :ref:`auditing event ` ``cpython.run_stdin`` with no " "arguments." msgstr "" "引数無しで :ref:`監査イベント ` ``cpython.run_stdin`` を送出しま" -"す。 " +"す。" -#: ../../library/asyncio.rst:79 msgid "(also 3.11.10, 3.10.15, 3.9.20, and 3.8.20) Emits audit events." msgstr "" +"(3.11.10、3.10.15、3.9.20、3.8.20 も同様) 監査イベントを送出するようになりま" +"した。" -#: ../../library/asyncio.rst:82 msgid "" "Uses PyREPL if possible, in which case :envvar:`PYTHONSTARTUP` is also " "executed. Emits audit events." msgstr "" +"可能な場合は PyREPL を使用するようになり、その場合は :envvar:`PYTHONSTARTUP` " +"も実行されます。\n" +"監査イベントを送出するようになりました。" #: ../../library/asyncio.rst:90 msgid "Reference" diff --git a/library/asyncore.po b/library/asyncore.po index ff224cfa2..d22bd18d2 100644 --- a/library/asyncore.po +++ b/library/asyncore.po @@ -12,29 +12,32 @@ msgstr "" "PO-Revision-Date: 2024-11-19 01:02+0000\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" -#: ../../library/asyncore.rst:2 msgid ":mod:`!asyncore` --- Asynchronous socket handler" -msgstr "" +msgstr ":mod:`!asyncore` --- 非同期ソケットハンドラー" -#: ../../library/asyncore.rst:10 msgid "" "This module is no longer part of the Python standard library. It was :ref:" "`removed in Python 3.12 ` after being deprecated in " "Python 3.6. The removal was decided in :pep:`594`." msgstr "" +"このモジュールは Python 標準ライブラリから削除されました。\n" +"Python 3.6 で非推奨となり、:ref:`Python 3.12 で削除 ` さ" +"れました。\n" +"削除は :pep:`594` で決定されました。" -#: ../../library/asyncore.rst:14 msgid "Applications should use the :mod:`asyncio` module instead." msgstr "" +"アプリケーションでは、代わりに :mod:`asyncio` モジュールを使ってください。" -#: ../../library/asyncore.rst:16 msgid "" "The last version of Python that provided the :mod:`!asyncore` module was " "`Python 3.11 `_." msgstr "" +":mod:`!asyncore` モジュールを提供していた最後のバージョンは `Python 3.11 " +"`_ です。" diff --git a/library/atexit.po b/library/atexit.po index 8fc93dd51..f35c79702 100644 --- a/library/atexit.po +++ b/library/atexit.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/atexit.rst:2 @@ -163,18 +163,17 @@ msgstr "" msgid ":mod:`atexit` Example" msgstr ":mod:`atexit` の例" -#: ../../library/atexit.rst:84 msgid "" "The following simple example demonstrates how a module can initialize a " "counter from a file when it is imported and save the counter's updated value " "automatically when the program terminates without relying on the application " "making an explicit call into this module at termination. ::" msgstr "" -"次の簡単な例では、あるモジュールを import した時にカウンタを初期化しておき、" -"プログラムが終了するときにアプリケーションがこのモジュールを明示的に呼び出さ" -"なくてもカウンタが更新されるようにする方法を示しています。 ::" +"次の簡単な例では、モジュールのインポート時にファイルからカウンタの値を読み込" +"んで初期化し、プログラムの終了時に更新後の値を自動保存する方法を示します。\n" +"アプリケーションが終了時にこのモジュールを明示的に呼び出す必要はありませ" +"ん。 ::" -#: ../../library/atexit.rst:89 msgid "" "try:\n" " with open('counterfile') as infile:\n" @@ -194,6 +193,23 @@ msgid "" "\n" "atexit.register(savecounter)" msgstr "" +"try:\n" +" with open('counterfile') as infile:\n" +" _count = int(infile.read())\n" +"except FileNotFoundError:\n" +" _count = 0\n" +"\n" +"def incrcounter(n):\n" +" global _count\n" +" _count = _count + n\n" +"\n" +"def savecounter():\n" +" with open('counterfile', 'w') as outfile:\n" +" outfile.write('%d' % _count)\n" +"\n" +"import atexit\n" +"\n" +"atexit.register(savecounter)" #: ../../library/atexit.rst:107 msgid "" @@ -203,7 +219,6 @@ msgstr "" ":func:`register` に指定した位置引数とキーワード引数は登録した関数を呼び出す際" "に渡されます::" -#: ../../library/atexit.rst:110 msgid "" "def goodbye(name, adjective):\n" " print('Goodbye %s, it was %s to meet you.' % (name, adjective))\n" @@ -214,12 +229,19 @@ msgid "" "# or:\n" "atexit.register(goodbye, adjective='nice', name='Donny')" msgstr "" +"def goodbye(name, adjective):\n" +" print('Goodbye %s, it was %s to meet you.' % (name, adjective))\n" +"\n" +"import atexit\n" +"\n" +"atexit.register(goodbye, 'Donny', 'nice')\n" +"# または:\n" +"atexit.register(goodbye, adjective='nice', name='Donny')" #: ../../library/atexit.rst:119 msgid "Usage as a :term:`decorator`::" msgstr ":term:`デコレータ ` として利用する例::" -#: ../../library/atexit.rst:121 msgid "" "import atexit\n" "\n" @@ -227,9 +249,11 @@ msgid "" "def goodbye():\n" " print('You are now leaving the Python sector.')" msgstr "" +"import atexit\n" +"\n" +"@atexit.register\n" +"def goodbye():\n" +" print('You are now leaving the Python sector.')" -#: ../../library/atexit.rst:127 msgid "This only works with functions that can be called without arguments." -msgstr "" -"デコレータとして利用できるのは、その関数が引数なしで呼び出された場合に限られ" -"ます。" +msgstr "デコレータとして利用できるのは、引数なしで呼び出せる関数に限られます。" diff --git a/library/audioop.po b/library/audioop.po index 5c16ff7fc..b3c834919 100644 --- a/library/audioop.po +++ b/library/audioop.po @@ -12,15 +12,14 @@ msgstr "" "PO-Revision-Date: 2024-11-19 01:02+0000\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" -#: ../../library/audioop.rst:2 msgid ":mod:`!audioop` --- Manipulate raw audio data" -msgstr "" +msgstr ":mod:`!audioop` --- 生の音声データの操作" #: ../../library/audioop.rst:10 msgid "" @@ -28,9 +27,13 @@ msgid "" "`removed in Python 3.13 ` after being deprecated in " "Python 3.11. The removal was decided in :pep:`594`." msgstr "" +"このモジュールは今や Python 標準ライブラリの一部ではありません。このモジュー" +"ルは Python 3.11 で非推奨となったあと、:ref:`Python 3.13 で削除` されました。削除の決定は :pep:`594` でなされました。" -#: ../../library/audioop.rst:14 msgid "" "The last version of Python that provided the :mod:`!audioop` module was " "`Python 3.12 `_." msgstr "" +":mod:`!audioop` モジュールを提供していた最後のバージョンは `Python 3.12 " +"`_ です。" diff --git a/library/audit_events.po b/library/audit_events.po index 197babe36..400b51e20 100644 --- a/library/audit_events.po +++ b/library/audit_events.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/audit_events.rst:6 @@ -126,13 +126,11 @@ msgstr "_winapi.TerminateProcess" msgid "``handle``, ``exit_code``" msgstr "``handle``, ``exit_code``" -#: ../../library/audit_events.rst:46 msgid "_posixsubprocess.fork_exec" -msgstr "" +msgstr "_posixsubprocess.fork_exec" -#: ../../library/audit_events.rst:46 msgid "``exec_list``, ``args``, ``env``" -msgstr "" +msgstr "``exec_list``, ``args``, ``env``" #: ../../library/audit_events.rst:48 msgid "ctypes.PyObj_FromPtr" @@ -142,9 +140,8 @@ msgstr "ctypes.PyObj_FromPtr" msgid "``obj``" msgstr "``obj``" -#: ../../library/audit_events.rst:51 msgid "The ``_posixsubprocess.fork_exec`` internal audit event." -msgstr "" +msgstr "内部の監査イベント ``_posixsubprocess.fork_exec``。" #: ../../library/audit_events.rst:3 msgid "audit events" diff --git a/library/base64.po b/library/base64.po index 0385010db..fa3dd3966 100644 --- a/library/base64.po +++ b/library/base64.po @@ -20,10 +20,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/base64.rst:2 @@ -42,6 +42,10 @@ msgid "" "Base32 and Base16) and the non-standard :ref:`Base85 encodings `." msgstr "" +"このモジュールは、バイナリデータを印刷可能なASCII文字列にエンコード、及びデ" +"コードするための関数を提供しています。:rfc:`4648` に :ref:`定義されているエン" +"コーディング ` (Base64、Base32、Base16)に加えて標準ではな" +"い :ref:`Base 85 ` をサポートしています。" #: ../../library/base64.rst:22 msgid "" @@ -66,6 +70,12 @@ msgid "" "`2045`. Note that if you are looking for :rfc:`2045` support you probably " "want to be looking at the :mod:`email` package instead." msgstr "" +":ref:`従来のインターフェース ` は文字列からのデコードができま" +"せんが、:term:`file object ` との間のエンコードとデコードが可能" +"な関数を提供します。これは標準の base64 アルファベットのみをサポートし、:rfc:" +"`2045` の規定にあるように、76文字ごとに改行されます。:rfc:`2045` のサポートの" +"ためには、代わりに :mod:`email` パッケージを参照する必要があるかもしれませ" +"ん。" #: ../../library/base64.rst:36 msgid "" @@ -87,7 +97,7 @@ msgstr "" #: ../../library/base64.rst:48 msgid "RFC 4648 Encodings" -msgstr "" +msgstr "RFC 4648 エンコーディング" #: ../../library/base64.rst:50 msgid "" @@ -95,6 +105,9 @@ msgid "" "can be safely sent by email, used as parts of URLs, or included as part of " "an HTTP POST request." msgstr "" +":rfc:`4648` エンコーディングは、email で安全に送信したり、 URL の一部として" +"使ったり、あるいは HTTP POST リクエストの一部に含めるために用いるのに適してい" +"ます。" #: ../../library/base64.rst:56 msgid "" @@ -177,6 +190,8 @@ msgstr "" msgid "" "May assert or raise a :exc:`ValueError` if the length of *altchars* is not 2." msgstr "" +"*altchars* の長さが2でない場合は、 assert または:exc:`ValueError`が発生しま" +"す。" #: ../../library/base64.rst:92 msgid "" @@ -274,20 +289,27 @@ msgid "" "Similar to :func:`b32encode` but uses the Extended Hex Alphabet, as defined " "in :rfc:`4648`." msgstr "" +":func:`b32encode` に似ていますが、 :rfc:`4648` で定義されているように" +"Extended Hex Alphabetを使用します。" #: ../../library/base64.rst:157 msgid "" "Similar to :func:`b32decode` but uses the Extended Hex Alphabet, as defined " "in :rfc:`4648`." msgstr "" +":func:`b32decode` に似ていますが、 :rfc:`4648` で定義されているように" +"Extended Hex Alphabetを使用します。" -#: ../../library/base64.rst:160 msgid "" "This version does not allow the digit 0 (zero) to the letter O (oh) and " "digit 1 (one) to either the letter I (eye) or letter L (el) mappings, all " "these characters are included in the Extended Hex Alphabet and are not " "interchangeable." msgstr "" +"この方式では、数字の 0 (ゼロ) を文字の O (オー) に、数字の 1 (いち) を文字の " +"I (アイ) または L (エル) に対応付けることはできません。\n" +"これらはすべて Extended Hex Alphabet に含まれる別々の文字で、置き換えられない" +"ためです。" #: ../../library/base64.rst:170 msgid "" @@ -307,7 +329,7 @@ msgstr "" #: ../../library/base64.rst:190 msgid "Base85 Encodings" -msgstr "" +msgstr "Base85 エンコーディング" #: ../../library/base64.rst:192 msgid "" @@ -344,18 +366,16 @@ msgstr "" msgid "Handling of null bytes" msgstr "" -#: ../../library/base64.rst:206 msgid "" "Refer to the documentation of the individual functions for more information." -msgstr "" +msgstr "詳しくは、各関数のドキュメントを参照してください。" -#: ../../library/base64.rst:210 msgid "" "Encode the :term:`bytes-like object` *b* using Ascii85 and return the " "encoded :class:`bytes`." msgstr "" "Ascii85 を使って :term:`bytes-like object` の *b* をエンコードし、エンコード" -"された :class:`bytes` を返します。 " +"された :class:`bytes` を返します。" #: ../../library/base64.rst:213 msgid "" @@ -390,13 +410,12 @@ msgstr "" "*adobe* を指定すると、エンコードしたバイトシーケンスを ``<~`` と ``~>`` で囲" "みます。これは Adobe の実装で使われています。" -#: ../../library/base64.rst:232 msgid "" "Decode the Ascii85 encoded :term:`bytes-like object` or ASCII string *b* and " "return the decoded :class:`bytes`." msgstr "" "Ascii85 エンコードされた :term:`bytes-like object` または ASCII 文字列 *b* を" -"デコードし、デコードされた :class:`bytes` を返します。 " +"デコードし、デコードされた :class:`bytes` を返します。" #: ../../library/base64.rst:235 msgid "" @@ -470,7 +489,7 @@ msgstr "" #: ../../library/base64.rst:291 msgid "Legacy Interface" -msgstr "" +msgstr "レガシーインターフェース" #: ../../library/base64.rst:295 msgid "" @@ -529,12 +548,14 @@ msgstr "モジュールの使用例:" msgid "Security Considerations" msgstr "セキュリティで考慮すべき点" -#: ../../library/base64.rst:344 msgid "" "A new security considerations section was added to :rfc:`4648` (section 12); " "it's recommended to review the security section for any code deployed to " "production." msgstr "" +":rfc:`4648` に、セキュリティ上の考慮事項をまとめた節 (第 12 節) が新たに追加" +"されました。\n" +"本番環境で使うコードでは、このセキュリティの節を確認することを推奨します。" #: ../../library/base64.rst:349 msgid "Module :mod:`binascii`" diff --git a/library/bdb.po b/library/bdb.po index 398042b53..cb5b960c3 100644 --- a/library/bdb.po +++ b/library/bdb.po @@ -19,10 +19,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/bdb.rst:2 @@ -61,18 +61,17 @@ msgstr "" "このクラスはテンポラリブレークポイント、無視するカウント、無効化と再有効化、" "条件付きブレークポイントを実装しています。" -#: ../../library/bdb.rst:28 msgid "" "Breakpoints are indexed by number through a list called :attr:`bpbynumber` " "and by ``(file, line)`` pairs through :attr:`bplist`. The former points to " "a single instance of class :class:`Breakpoint`. The latter points to a list " "of such instances since there may be more than one breakpoint per line." msgstr "" -"ブレークポイントは :attr:`bpbynumber` という名前のリストで番号によりインデッ" -"クスされ、 :attr:`bplist` により ``(file, line)`` の形でインデックスされま" -"す。 :attr:`bpbynumber` は :class:`Breakpoint` クラスのインスタンスを指してい" -"ます。一方 :attr:`bplist` は、同じ行に複数のブレークポイントが設定される場合" -"があるので、インスタンスのリストを指しています。" +"ブレークポイントは :attr:`bpbynumber` というリストでは番号を使って、:attr:" +"`bplist` では ``(file, line)`` の組を使って参照します。\n" +"前者では一つの :class:`Breakpoint` インスタンスが得られます。\n" +"同じ行に複数のブレークポイントを設定できるため、後者ではインスタンスのリスト" +"が得られます。" #: ../../library/bdb.rst:33 msgid "" @@ -116,29 +115,23 @@ msgid "" "formatted:" msgstr "ブレークポイントに関する情報を持つ文字列をフォーマットして返します:" -#: ../../library/bdb.rst:63 msgid "Breakpoint number." -msgstr "" +msgstr "ブレークポイントの番号。" -#: ../../library/bdb.rst:64 msgid "Temporary status (del or keep)." -msgstr "" +msgstr "一時的なブレークポイントかどうか (del または keep)。" -#: ../../library/bdb.rst:65 msgid "File/line position." -msgstr "" +msgstr "ファイルと行の位置。" -#: ../../library/bdb.rst:66 msgid "Break condition." -msgstr "" +msgstr "停止する条件。" -#: ../../library/bdb.rst:67 msgid "Number of times to ignore." -msgstr "" +msgstr "無視する回数。" -#: ../../library/bdb.rst:68 msgid "Number of times hit." -msgstr "" +msgstr "ヒットした回数。" #: ../../library/bdb.rst:74 msgid "" @@ -152,31 +145,29 @@ msgstr "" msgid ":class:`Breakpoint` instances have the following attributes:" msgstr ":class:`Breakpoint` インスタンスは以下の属性を持ちます:" -#: ../../library/bdb.rst:81 msgid "File name of the :class:`Breakpoint`." -msgstr "" +msgstr ":class:`Breakpoint` のファイル名です。" -#: ../../library/bdb.rst:85 msgid "Line number of the :class:`Breakpoint` within :attr:`file`." -msgstr "" +msgstr ":attr:`file` 内での :class:`Breakpoint` の行番号です。" -#: ../../library/bdb.rst:89 msgid "``True`` if a :class:`Breakpoint` at (file, line) is temporary." msgstr "" +"``(file, line)`` の :class:`Breakpoint` が一時的なものであれば ``True`` で" +"す。" -#: ../../library/bdb.rst:93 msgid "Condition for evaluating a :class:`Breakpoint` at (file, line)." -msgstr "" +msgstr "``(file, line)`` の :class:`Breakpoint` を評価する条件です。" -#: ../../library/bdb.rst:97 msgid "" "Function name that defines whether a :class:`Breakpoint` is hit upon " "entering the function." msgstr "" +"関数に入ったときに :class:`Breakpoint` にヒットするかどうかを決める関数名で" +"す。" -#: ../../library/bdb.rst:102 msgid "``True`` if :class:`Breakpoint` is enabled." -msgstr "" +msgstr ":class:`Breakpoint` が有効なら ``True`` です。" #: ../../library/bdb.rst:106 msgid "Numeric index for a single instance of a :class:`Breakpoint`." @@ -188,13 +179,11 @@ msgid "" "`line`) tuples." msgstr "" -#: ../../library/bdb.rst:115 msgid "Number of times to ignore a :class:`Breakpoint`." -msgstr "" +msgstr ":class:`Breakpoint` を無視する回数です。" -#: ../../library/bdb.rst:119 msgid "Count of the number of times a :class:`Breakpoint` has been hit." -msgstr "" +msgstr ":class:`Breakpoint` にヒットした回数です。" #: ../../library/bdb.rst:123 msgid "The :class:`Bdb` class acts as a generic Python debugger base class." @@ -225,7 +214,6 @@ msgstr "" "で発生したかどうかは、フレームのグローバル変数の ``__name__`` によって決定さ" "れます。" -#: ../../library/bdb.rst:135 msgid "" "The *backend* argument specifies the backend to use for :class:`Bdb`. It can " "be either ``'settrace'`` or ``'monitoring'``. ``'settrace'`` uses :func:`sys." @@ -236,14 +224,24 @@ msgid "" "some differences. The debugger developers are encouraged to use the " "``'monitoring'`` backend to achieve better performance." msgstr "" +"*backend* 引数は :class:`Bdb` が使うバックエンドを指定します。\n" +"``'settrace'`` または ``'monitoring'`` を指定できます。\n" +"``'settrace'`` は :func:`sys.settrace` を使い、後方互換性が最も高いバックエン" +"ドです。\n" +"``'monitoring'`` は Python 3.12 で導入された :mod:`sys.monitoring` を使いま" +"す。\n" +"使わないイベントを無効にできるため、大幅に効率がよくなる場合があります。\n" +"両方のバックエンドで同一のインターフェースを保つようにしていますが、いくつか" +"違いがあります。\n" +"性能を高めるため、デバッガーの開発者には ``'monitoring'`` バックエンドの使用" +"を推奨します。" #: ../../library/bdb.rst:145 msgid "Added the *skip* parameter." msgstr "*skip* パラメータが追加されました。" -#: ../../library/bdb.rst:148 msgid "Added the *backend* parameter." -msgstr "" +msgstr "*backend* パラメーターが追加されました。" #: ../../library/bdb.rst:151 msgid "" @@ -251,36 +249,42 @@ msgid "" msgstr "" "以下の :class:`Bdb` のメソッドは、通常オーバーライドする必要はありません。" -#: ../../library/bdb.rst:155 msgid "Return canonical form of *filename*." -msgstr "" +msgstr "*filename* を正規化した形式で返します。" -#: ../../library/bdb.rst:157 msgid "" "For real file names, the canonical form is an operating-system-dependent, :" "func:`case-normalized ` :func:`absolute path `. A *filename* with angle brackets, such as ``\"\"`` " "generated in interactive mode, is returned unchanged." msgstr "" +"実際のファイル名では、正規化された形式とは、OS に応じて :func:`大文字・小文字" +"を正規化した ` :func:`絶対パス ` です。\n" +"対話モードで生成される ``\"\"`` のように山括弧で囲まれた *filename* " +"は、そのまま返します。" -#: ../../library/bdb.rst:164 msgid "" "Start tracing. For ``'settrace'`` backend, this method is equivalent to " "``sys.settrace(self.trace_dispatch)``" msgstr "" +"トレースを開始します。\n" +"``'settrace'`` バックエンドでは、``sys.settrace(self.trace_dispatch)`` と同じ" +"です。" -#: ../../library/bdb.rst:171 msgid "" "Stop tracing. For ``'settrace'`` backend, this method is equivalent to ``sys." "settrace(None)``" msgstr "" +"トレースを停止します。\n" +"``'settrace'`` バックエンドでは、``sys.settrace(None)`` と同じです。" -#: ../../library/bdb.rst:178 msgid "" "Set the :attr:`!botframe`, :attr:`!stopframe`, :attr:`!returnframe` and :" "attr:`quitting ` attributes with values ready to start " "debugging." msgstr "" +":attr:`!botframe`、:attr:`!stopframe`、:attr:`!returnframe`、:attr:`quitting " +"` 属性を、デバッグを開始できる値に設定します。" #: ../../library/bdb.rst:183 msgid "" @@ -352,7 +356,6 @@ msgstr "" "を参照してください。コードとフレームオブジェクトについてのより詳しい情報" "は、 :ref:`types` を参照してください。" -#: ../../library/bdb.rst:210 msgid "" "If the debugger should stop on the current line, invoke the :meth:" "`user_line` method (which should be overridden in subclasses). Raise a :exc:" @@ -360,8 +363,13 @@ msgid "" "(which can be set from :meth:`user_line`). Return a reference to the :meth:" "`trace_dispatch` method for further tracing in that scope." msgstr "" +"デバッガーが現在の行で停止するべきなら、:meth:`user_line` メソッドを呼び出し" +"ます (サブクラスでオーバーライドしてください)。\n" +":attr:`quitting ` フラグが設定されていれば :exc:`BdbQuit` を送" +"出します (このフラグは :meth:`user_line` から設定できます)。\n" +"そのスコープ内のトレースを続けるために、:meth:`trace_dispatch` メソッドへの参" +"照を返します。" -#: ../../library/bdb.rst:218 msgid "" "If the debugger should stop on this function call, invoke the :meth:" "`user_call` method (which should be overridden in subclasses). Raise a :exc:" @@ -369,8 +377,13 @@ msgid "" "(which can be set from :meth:`user_call`). Return a reference to the :meth:" "`trace_dispatch` method for further tracing in that scope." msgstr "" +"デバッガーがこの関数呼び出しで停止するべきなら、:meth:`user_call` メソッドを" +"呼び出します (サブクラスでオーバーライドしてください)。\n" +":attr:`quitting ` フラグが設定されていれば :exc:`BdbQuit` を送" +"出します (このフラグは :meth:`user_call` から設定できます)。\n" +"そのスコープ内のトレースを続けるために、:meth:`trace_dispatch` メソッドへの参" +"照を返します。" -#: ../../library/bdb.rst:226 msgid "" "If the debugger should stop on this function return, invoke the :meth:" "`user_return` method (which should be overridden in subclasses). Raise a :" @@ -378,8 +391,13 @@ msgid "" "(which can be set from :meth:`user_return`). Return a reference to the :" "meth:`trace_dispatch` method for further tracing in that scope." msgstr "" +"デバッガーがこの関数からのリターンで停止するべきなら、:meth:`user_return` メ" +"ソッドを呼び出します (サブクラスでオーバーライドしてください)。\n" +":attr:`quitting ` フラグが設定されていれば :exc:`BdbQuit` を送" +"出します (このフラグは :meth:`user_return` から設定できます)。\n" +"そのスコープ内のトレースを続けるために、:meth:`trace_dispatch` メソッドへの参" +"照を返します。" -#: ../../library/bdb.rst:234 msgid "" "If the debugger should stop at this exception, invokes the :meth:" "`user_exception` method (which should be overridden in subclasses). Raise a :" @@ -387,6 +405,12 @@ msgid "" "(which can be set from :meth:`user_exception`). Return a reference to the :" "meth:`trace_dispatch` method for further tracing in that scope." msgstr "" +"デバッガーがこの例外で停止するべきなら、:meth:`user_exception` メソッドを呼び" +"出します (サブクラスでオーバーライドしてください)。\n" +":attr:`quitting ` フラグが設定されていれば :exc:`BdbQuit` を送" +"出します (このフラグは :meth:`user_exception` から設定できます)。\n" +"そのスコープ内のトレースを続けるために、:meth:`trace_dispatch` メソッドへの参" +"照を返します。" #: ../../library/bdb.rst:240 msgid "" @@ -396,27 +420,30 @@ msgstr "" "通常、継承クラスは以下のメソッド群をオーバーライドしません。しかし、停止やブ" "レークポイント機能を再定義したい場合には、オーバーライドすることもあります。" -#: ../../library/bdb.rst:245 msgid "Return ``True`` if *module_name* matches any skip pattern." msgstr "" +"*module_name* がいずれかのスキップパターンにマッチすれば ``True`` を返しま" +"す。" #: ../../library/bdb.rst:249 msgid "Return ``True`` if *frame* is below the starting frame in the stack." msgstr "" -#: ../../library/bdb.rst:253 msgid "Return ``True`` if there is an effective breakpoint for this line." -msgstr "" +msgstr "この行に実際に停止するブレークポイントがあれば ``True`` を返します。" -#: ../../library/bdb.rst:255 msgid "" "Check whether a line or function breakpoint exists and is in effect. Delete " "temporary breakpoints based on information from :func:`effective`." msgstr "" +"行または関数のブレークポイントが存在し、実際に停止するかどうかを確認しま" +"す。\n" +":func:`effective` の情報に基づいて、一時的なブレークポイントを削除します。" -#: ../../library/bdb.rst:260 msgid "Return ``True`` if any breakpoint exists for *frame*'s filename." msgstr "" +"*frame* のファイル名に対してブレークポイントが 1 つでもあれば ``True`` を返し" +"ます。" #: ../../library/bdb.rst:262 msgid "" @@ -426,17 +453,19 @@ msgstr "" "継承クラスはデバッガー操作をするために以下のメソッド群をオーバーライドするべ" "きです。" -#: ../../library/bdb.rst:267 msgid "" "Called from :meth:`dispatch_call` if a break might stop inside the called " "function." msgstr "" +"呼び出された関数内で停止する可能性がある場合、:meth:`dispatch_call` から呼び" +"出されます。" -#: ../../library/bdb.rst:270 msgid "" "*argument_list* is not used anymore and will always be ``None``. The " "argument is kept for backwards compatibility." msgstr "" +"*argument_list* は現在使われておらず、常に ``None`` です。\n" +"後方互換性のために残されています。" #: ../../library/bdb.rst:275 msgid "" @@ -508,11 +537,12 @@ msgstr "" "*frame* からデバッグを開始します。*frame* が指定されなかった場合、デバッグは" "呼び出し元のフレームから開始します。" -#: ../../library/bdb.rst:319 msgid "" ":func:`set_trace` will enter the debugger immediately, rather than on the " "next line of code to be executed." msgstr "" +":func:`set_trace` は、次に実行されるコードの行を待たずに、直ちにデバッガに入" +"るようになりました。" #: ../../library/bdb.rst:325 msgid "" @@ -522,11 +552,13 @@ msgstr "" "ブレークポイントに到達するか終了したときにストップします。もしブレークポイン" "トが1つも無い場合、システムのトレース関数を ``None`` に設定します。" -#: ../../library/bdb.rst:332 msgid "" "Set the :attr:`!quitting` attribute to ``True``. This raises :exc:`BdbQuit` " "in the next call to one of the :meth:`!dispatch_\\*` methods." msgstr "" +":attr:`!quitting` 属性を ``True`` に設定します。\n" +"これにより、次にいずれかの :meth:`!dispatch_\\*` メソッドを呼び出すと :exc:" +"`BdbQuit` が送出されます。" #: ../../library/bdb.rst:336 msgid "" @@ -592,9 +624,9 @@ msgstr "" "ら数値に変換されます。 *arg* が非数値の文字列である場合、指定されたブレークポ" "イントが存在しないか削除された場合、 :exc:`ValueError` が上げられます。" -#: ../../library/bdb.rst:378 msgid "Return ``True`` if there is a breakpoint for *lineno* in *filename*." msgstr "" +"*filename* の *lineno* 行にブレークポイントがあれば ``True`` を返します。" #: ../../library/bdb.rst:382 msgid "" @@ -614,27 +646,36 @@ msgstr "" msgid "Return all breakpoints that are set." msgstr "セットされているすべてのブレークポイントを返します。" -#: ../../library/bdb.rst:394 msgid "" "Derived classes and clients can call the following methods to disable and " "restart events to achieve better performance. These methods only work when " "using the ``'monitoring'`` backend." msgstr "" +"派生クラスやクライアントは、次のメソッドでイベントを無効にしたり再開したりし" +"て、性能を高められます。\n" +"これらのメソッドが機能するのは ``'monitoring'`` バックエンドを使う場合だけで" +"す。" -#: ../../library/bdb.rst:400 msgid "" "Disable the current event until the next time :func:`restart_events` is " "called. This is helpful when the debugger is not interested in the current " "line." msgstr "" +"次に :func:`restart_events` が呼び出されるまで、現在のイベントを無効にしま" +"す。\n" +"デバッガーが現在の行を調べる必要がない場合に役立ちます。" -#: ../../library/bdb.rst:408 msgid "" "Restart all the disabled events. This function is automatically called in " "``dispatch_*`` methods after ``user_*`` methods are called. If the " "``dispatch_*`` methods are not overridden, the disabled events will be " "restarted after each user interaction." msgstr "" +"無効にしたすべてのイベントを再開します。\n" +"この関数は ``dispatch_*`` メソッド内で、``user_*`` メソッドの呼び出し後に自動" +"的に呼び出されます。\n" +"``dispatch_*`` メソッドをオーバーライドしていなければ、ユーザーとのやりとりの" +"たびに、無効にしたイベントが再開されます。" #: ../../library/bdb.rst:416 msgid "" @@ -654,15 +695,16 @@ msgid "" "of frames below the frame where the debugger was invoked." msgstr "" -#: ../../library/bdb.rst:428 msgid "" "Return a string with information about a stack entry, which is a ``(frame, " "lineno)`` tuple. The return string contains:" msgstr "" +"スタックのエントリーを表す ``(frame, lineno)`` タプルについての情報を文字列で" +"返します。\n" +"返す文字列には次の情報を含みます。" -#: ../../library/bdb.rst:431 msgid "The canonical filename which contains the frame." -msgstr "" +msgstr "フレームを含むファイルの正規化された名前。" #: ../../library/bdb.rst:432 msgid "The function name or ``\"\"``." @@ -688,11 +730,13 @@ msgstr "" "以下の2つのメソッドは、文字列として渡された :term:`文 ` をデバッグ" "するもので、クライアントから利用されます。" -#: ../../library/bdb.rst:443 msgid "" "Debug a statement executed via the :func:`exec` function. *globals* " "defaults to :attr:`!__main__.__dict__`, *locals* defaults to *globals*." msgstr "" +":func:`exec` 関数で実行する文をデバッグします。\n" +"*globals* のデフォルトは :attr:`!__main__.__dict__`、*locals* のデフォルトは " +"*globals* です。" #: ../../library/bdb.rst:448 msgid "" @@ -702,9 +746,10 @@ msgstr "" ":func:`eval` 関数を利用して式を実行しデバッグします。 *globals* と *locals* " "は :meth:`run` と同じ意味です。" -#: ../../library/bdb.rst:453 msgid "For backwards compatibility. Calls the :meth:`run` method." -msgstr "後方互換性のためのメソッドです。 :meth:`run` を使ってください。" +msgstr "" +"後方互換性のためのメソッドです。\n" +":meth:`run` メソッドを呼び出します。" #: ../../library/bdb.rst:457 msgid "Debug a single function call, and return its result." @@ -714,13 +759,13 @@ msgstr "1つの関数呼び出しをデバッグし、その結果を返しま msgid "Finally, the module defines the following functions:" msgstr "最後に、このモジュールは以下の関数を提供しています:" -#: ../../library/bdb.rst:464 msgid "" "Return ``True`` if we should break here, depending on the way the :class:" "`Breakpoint` *b* was set." msgstr "" +":class:`Breakpoint` *b* の設定に基づき、この位置で停止するべきなら ``True`` " +"を返します。" -#: ../../library/bdb.rst:467 msgid "" "If it was set via line number, it checks if :attr:`b.line ` is the same as the one in *frame*. If the breakpoint was set via :" @@ -728,14 +773,19 @@ msgid "" "the right *frame* (the right function) and if we are on its first executable " "line." msgstr "" +"行番号で設定されたブレークポイントでは、:attr:`b.line ` " +"と *frame* の行番号が同じかどうかを確認します。\n" +":attr:`関数名 ` で設定された場合は、正しい *frame* " +"(正しい関数) 内にいて、その関数の最初の実行可能な行にいるかどうかを確認する必" +"要があります。" -#: ../../library/bdb.rst:476 msgid "" "Return ``(active breakpoint, delete temporary flag)`` or ``(None, None)`` as " "the breakpoint to act upon." msgstr "" +"停止に使うブレークポイントとして ``(active breakpoint, delete temporary " +"flag)``、または ``(None, None)`` を返します。" -#: ../../library/bdb.rst:479 msgid "" "The *active breakpoint* is the first entry in :attr:`bplist ` for the (:attr:`file `, :attr:`line ` cannot be evaluated (in which case, :attr:`ignore ` count is ignored)." msgstr "" +"*active breakpoint* は、存在する (:attr:`file `、:attr:" +"`line `) に対応する :attr:`bplist ` のうち、次の条件を満たす最初のエントリーです。\n" +":attr:`有効 ` で、:func:`checkfuncname` が真を返し、:" +"attr:`条件 ` が偽ではなく、:attr:`無視する回数 ` が正でもないことが条件です。\n" +"一時的なブレークポイントを削除すべきことを表す *flag* が ``False`` になるの" +"は、:attr:`cond ` を評価できない場合だけです (この場" +"合、:attr:`無視する回数 ` は考慮しません)。" -#: ../../library/bdb.rst:490 msgid "If no such entry exists, then ``(None, None)`` is returned." -msgstr "" +msgstr "該当するエントリーがなければ ``(None, None)`` を返します。" #: ../../library/bdb.rst:495 msgid "Start debugging with a :class:`Bdb` instance from caller's frame." @@ -758,6 +816,5 @@ msgstr "" ":class:`Bdb` クラスのインスタンスを使って、呼び出し元のフレームからデバッグを" "開始します。" -#: ../../library/bdb.rst:330 msgid "quitting (bdb.Bdb attribute)" -msgstr "" +msgstr "quitting (bdb.Bdb の属性)" diff --git a/library/binary.po b/library/binary.po index abfc154ff..ad9d744c6 100644 --- a/library/binary.po +++ b/library/binary.po @@ -16,10 +16,10 @@ msgstr "" "Last-Translator: tomo, 2021\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/binary.rst:5 diff --git a/library/binascii.po b/library/binascii.po index e71230a0c..9f000da5f 100644 --- a/library/binascii.po +++ b/library/binascii.po @@ -21,10 +21,10 @@ msgstr "" "Last-Translator: tomo, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/binascii.rst:2 @@ -66,23 +66,26 @@ msgstr "" msgid "The :mod:`binascii` module defines the following functions:" msgstr ":mod:`binascii` モジュールでは以下の関数を定義します:" -#: ../../library/binascii.rst:36 msgid "" "Convert a single line of uuencoded data back to binary and return the binary " "data. Lines normally contain 45 (binary) bytes, except for the last line. " "Line data may be followed by whitespace." msgstr "" "uuencode された 1 行のデータをバイナリに変換し、変換後のバイナリデータを返し" -"ます。最後の行を除いて、通常 1 行には (バイナリデータで) 45 バイトが含まれま" -"す。入力データの先頭には空白文字が連続していてもかまいません。" +"ます。\n" +"最後の行を除いて、通常 1 行には (バイナリデータで) 45 バイトが含まれます。\n" +"行データの後ろには空白文字が続いていてもかまいません。" -#: ../../library/binascii.rst:43 msgid "" "Convert binary data to a line of ASCII characters, the return value is the " "converted line, including a newline char. The length of *data* should be at " "most 45. If *backtick* is true, zeros are represented by ``'`'`` instead of " "spaces." msgstr "" +"バイナリデータを 1 行の ASCII 文字列に変換し、改行文字を含む変換結果を返しま" +"す。\n" +"*data* の長さは 45 以下でなければなりません。\n" +"*backtick* が真の場合、ゼロをスペースではなく ``'`'`` で表します。" #: ../../library/binascii.rst:47 msgid "Added the *backtick* parameter." @@ -96,37 +99,34 @@ msgstr "" "base64 でエンコードされたデータのブロックをバイナリに変換し、変換後のバイナリ" "データを返します。一度に 1 行以上のデータを与えてもかまいません。" -#: ../../library/binascii.rst:56 msgid "" "If *strict_mode* is true, only valid base64 data will be converted. Invalid " "base64 data will raise :exc:`binascii.Error`." msgstr "" +"*strict_mode* が真の場合、有効な Base64 データのみ変換します。\n" +"無効な Base64 データでは :exc:`binascii.Error` を送出します。" -#: ../../library/binascii.rst:59 msgid "Valid base64:" -msgstr "" +msgstr "有効な Base64 データの条件:" #: ../../library/binascii.rst:61 msgid "Conforms to :rfc:`3548`." msgstr "" -#: ../../library/binascii.rst:62 msgid "Contains only characters from the base64 alphabet." -msgstr "" +msgstr "Base64 アルファベットの文字だけを含む。" -#: ../../library/binascii.rst:63 msgid "" "Contains no excess data after padding (including excess padding, newlines, " "etc.)." msgstr "" +"パディングの後に余分なデータ (余分なパディングや改行などを含む) がない。" -#: ../../library/binascii.rst:64 msgid "Does not start with a padding." -msgstr "" +msgstr "パディングで始まらない。" -#: ../../library/binascii.rst:66 msgid "Added the *strict_mode* parameter." -msgstr "" +msgstr "*strict_mode* パラメーターが追加されました。" #: ../../library/binascii.rst:72 msgid "" @@ -152,7 +152,6 @@ msgstr "" "度に 1 行以上のデータを渡すことができます。オプション引数 *header* が与えられ" "ており、かつその値が真であれば、アンダースコアは空白文字にデコードされます。" -#: ../../library/binascii.rst:89 msgid "" "Convert binary data to a line(s) of ASCII characters in quoted-printable " "encoding. The return value is the converted line(s). If the optional " @@ -165,15 +164,18 @@ msgid "" "might corrupt the binary data stream." msgstr "" "バイナリデータを quoted-printable 形式でエンコードして 1 行から複数行の " -"ASCII 文字列に変換します。変換後の文字列を返します。オプション引数 " -"*quptetabs* が存在し、かつその値が真であれば、全てのタブおよび空白文字もエン" -"コードされます。オプション引数 *istext* が存在し、かつその値が真であれば、改" -"行はエンコードされませんが、行末の空白文字はエンコードされます。オプション引" -"数 *header* が存在し、かつその値が真である場合、空白文字は :rfc:`1522` にした" -"がってアンダースコアにエンコードされます。オプション引数 *header* が存在し、" -"かつその値が偽である場合、改行文字も同様にエンコードされます。そうでない場" -"合、復帰 (linefeed) 文字の変換によってバイナリデータストリームが破損してしま" -"うかもしれません。" +"ASCII 文字列に変換します。\n" +"変換後の文字列を返します。\n" +"オプション引数 *quotetabs* が存在し、かつその値が真であれば、全てのタブおよび" +"空白文字もエンコードされます。\n" +"オプション引数 *istext* が存在し、かつその値が真であれば、改行はエンコードさ" +"れませんが、行末の空白文字はエンコードされます。\n" +"オプション引数 *header* が存在し、かつその値が真である場合、空白文字は :rfc:" +"`1522` にしたがってアンダースコアにエンコードされます。\n" +"オプション引数 *header* が存在し、かつその値が偽である場合、改行文字も同様に" +"エンコードされます。\n" +"そうでない場合、改行 (linefeed) 文字の変換によってバイナリデータストリームが" +"破損してしまうかもしれません。" #: ../../library/binascii.rst:102 msgid "" @@ -202,7 +204,6 @@ msgstr "" "アルゴリズムとして設計されたもので、一般的なハッシュアルゴリズムには向きませ" "ん。以下のようにして使います::" -#: ../../library/binascii.rst:116 msgid "" "print(binascii.crc32(b\"hello world\"))\n" "# Or, in two pieces:\n" @@ -210,10 +211,14 @@ msgid "" "crc = binascii.crc32(b\" world\", crc)\n" "print('crc32 = {:#010x}'.format(crc))" msgstr "" +"print(binascii.crc32(b\"hello world\"))\n" +"# または、2 つに分けて計算する:\n" +"crc = binascii.crc32(b\"hello\")\n" +"crc = binascii.crc32(b\" world\", crc)\n" +"print('crc32 = {:#010x}'.format(crc))" -#: ../../library/binascii.rst:122 msgid "The result is always unsigned." -msgstr "" +msgstr "結果は常に符号なしになりました。" #: ../../library/binascii.rst:128 msgid "" @@ -225,19 +230,24 @@ msgstr "" "表現に変換されます。したがって、返されるバイトオブジェクトは *data* の2倍の長" "さになります。" -#: ../../library/binascii.rst:132 msgid "" "Similar functionality (but returning a text string) is also conveniently " "accessible using the :meth:`bytes.hex` method." msgstr "" +"同様の機能は :meth:`bytes.hex` メソッドからも手軽に使えます (ただしテキスト文" +"字列を返します)。" -#: ../../library/binascii.rst:135 msgid "" "If *sep* is specified, it must be a single character str or bytes object. It " "will be inserted in the output after every *bytes_per_sep* input bytes. " "Separator placement is counted from the right end of the output by default, " "if you wish to count from the left, supply a negative *bytes_per_sep* value." msgstr "" +"*sep* を指定する場合は、1 文字の ``str`` または ``bytes`` オブジェクトでなけ" +"ればなりません。\n" +"入力の *bytes_per_sep* バイトごとに、出力に区切り文字を挿入します。\n" +"デフォルトでは出力の右端から数えて区切り文字を配置します。\n" +"左端から数えるには *bytes_per_sep* に負の値を指定してください。" #: ../../library/binascii.rst:150 msgid "The *sep* and *bytes_per_sep* parameters were added." diff --git a/library/binhex.po b/library/binhex.po index 31a9b6d2e..938f7cb18 100644 --- a/library/binhex.po +++ b/library/binhex.po @@ -17,10 +17,10 @@ msgstr "" "Last-Translator: mollinaca, 2021\n" "Language-Team: Japanese (https://www.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/binhex.rst:2 diff --git a/library/bisect.po b/library/bisect.po index 1697b6cf7..6dd09faa7 100644 --- a/library/bisect.po +++ b/library/bisect.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/bisect.rst:2 @@ -39,6 +39,10 @@ msgid "" "expensive comparison operations, this can be an improvement over linear " "searches or frequent resorting." msgstr "" +"このモジュールは、挿入のたびにリストをソートすることなく、ソートされた順序で" +"リストを維持するためのサポートを提供します。 コストのかかる比較演算を伴う長い" +"リストの場合、これは線形検索や頻繁な並べ替えよりも改善される可能性がありま" +"す。" #: ../../library/bisect.rst:19 msgid "" @@ -50,6 +54,12 @@ msgid "" "functions only call the :meth:`~object.__lt__` method and will return an " "insertion point between values in an array." msgstr "" +"このモジュールは、基本的な二分法アルゴリズムを使用しているため :mod:`bisect` " +"と呼ばれます。 特定の値を検索する他の二分法ツールとは異なり、このモジュールの" +"関数は挿入点を特定するように設計されています。 したがって、関数は値が見つかっ" +"たかどうかを判断するために :meth:`~object.__eq__` メソッドを呼び出すことはあ" +"りません。 その代わりに、関数は :meth:`~object.__lt__` メソッドのみを呼び出" +"し、配列内の値間の挿入点を返します。" #: ../../library/bisect.rst:29 msgid "The following functions are provided:" @@ -71,26 +81,29 @@ msgstr "" "insert()`` の第一引数として使うのに適しています。*a* はすでにソートされている" "ものとします。" -#: ../../library/bisect.rst:41 msgid "" "The returned insertion point *ip* partitions the array *a* into two slices " "such that ``all(elem < x for elem in a[lo : ip])`` is true for the left " "slice and ``all(elem >= x for elem in a[ip : hi])`` is true for the right " "slice." msgstr "" +"返された挿入位置 *ip* は、配列 *a* を 2 つのスライスに分割します。\n" +"左側のスライスでは ``all(elem < x for elem in a[lo : ip])`` が真となり、右側" +"のスライスでは ``all(elem >= x for elem in a[ip : hi])`` が真となります。" -#: ../../library/bisect.rst:46 msgid "" "*key* specifies a :term:`key function` of one argument that is used to " "extract a comparison key from each element in the array. To support " "searching complex records, the key function is not applied to the *x* value." msgstr "" +"*key* は、配列の各要素から比較用のキーを取り出す、引数を 1 つ受け取る :term:`" +"キー関数 ` を指定します。\n" +"複雑なレコードを検索できるように、キー関数は値 *x* には適用しません。" -#: ../../library/bisect.rst:50 msgid "" "If *key* is ``None``, the elements are compared directly and no key function " "is called." -msgstr "" +msgstr "*key* が ``None`` の場合は要素を直接比較し、キー関数を呼び出しません。" #: ../../library/bisect.rst:53 ../../library/bisect.rst:67 #: ../../library/bisect.rst:85 ../../library/bisect.rst:105 @@ -102,14 +115,18 @@ msgid "" "Similar to :py:func:`~bisect.bisect_left`, but returns an insertion point " "which comes after (to the right of) any existing entries of *x* in *a*." msgstr "" +":py:func:`~bisect.bisect_left` と似ていますが、 *a* に含まれる *x* のうち、ど" +"のエントリーよりも後ろ(右)にくるような挿入点を返します。" -#: ../../library/bisect.rst:63 msgid "" "The returned insertion point *ip* partitions the array *a* into two slices " "such that ``all(elem <= x for elem in a[lo : ip])`` is true for the left " "slice and ``all(elem > x for elem in a[ip : hi])`` is true for the right " "slice." msgstr "" +"返された挿入位置 *ip* は、配列 *a* を 2 つのスライスに分割します。\n" +"左側のスライスでは ``all(elem <= x for elem in a[lo : ip])`` が真となり、右側" +"のスライスでは ``all(elem > x for elem in a[ip : hi])`` が真となります。" #: ../../library/bisect.rst:73 msgid "Insert *x* in *a* in sorted order." @@ -122,23 +139,27 @@ msgid "" "*x* at the appropriate position to maintain sort order." msgstr "" -#: ../../library/bisect.rst:79 ../../library/bisect.rst:99 msgid "" "To support inserting records in a table, the *key* function (if any) is " "applied to *x* for the search step but not for the insertion step." msgstr "" +"テーブルへのレコードの挿入に対応するため、*key* 関数を指定した場合は、探索の" +"段階で *x* に適用し、挿入の段階では適用しません。" -#: ../../library/bisect.rst:82 ../../library/bisect.rst:102 msgid "" "Keep in mind that the *O*\\ (log *n*) search is dominated by the slow *O*\\ " "(*n*) insertion step." msgstr "" +"*O*\\ (log *n*) の探索よりも、遅い *O*\\ (*n*) の挿入処理が全体の実行時間を支" +"配することに注意してください。" #: ../../library/bisect.rst:92 msgid "" "Similar to :py:func:`~bisect.insort_left`, but inserting *x* in *a* after " "any existing entries of *x*." msgstr "" +":py:func:`~bisect.insort_left` と似ていますが、 *a* に含まれる *x* のうち、ど" +"のエントリーよりも後ろに *x* を挿入します。" #: ../../library/bisect.rst:95 msgid "" @@ -156,18 +177,23 @@ msgid "" "When writing time sensitive code using *bisect()* and *insort()*, keep these " "thoughts in mind:" msgstr "" +"*bisect()* と *insort()* を使って時間的制約のあるコードを書くときは、以下のこ" +"とを念頭に置いてください:" #: ../../library/bisect.rst:115 msgid "" "Bisection is effective for searching ranges of values. For locating specific " "values, dictionaries are more performant." msgstr "" +"二分法は、値の範囲を検索するのに有効です。 特定の値を検索する場合は、辞書の方" +"が効率的です。" -#: ../../library/bisect.rst:118 msgid "" "The *insort()* functions are *O*\\ (*n*) because the logarithmic search step " "is dominated by the linear time insertion step." msgstr "" +"*insort()* 関数の計算量は *O*\\ (*n*) です。\n" +"対数時間の探索よりも、線形時間の挿入処理が全体の実行時間を支配するためです。" #: ../../library/bisect.rst:121 msgid "" @@ -180,12 +206,14 @@ msgid "" "shown in the examples section below)." msgstr "" -#: ../../library/bisect.rst:131 msgid "" "`Sorted Collections `_ is a " "high performance module that uses *bisect* to managed sorted collections of " "data." msgstr "" +"`Sorted Collections `_ は、" +"*bisect* を使ってソート済みのデータのコレクションを管理する高性能なモジュール" +"です。" #: ../../library/bisect.rst:135 msgid "" @@ -211,8 +239,10 @@ msgid "" "five functions show how to transform them into the standard lookups for " "sorted lists::" msgstr "" +"上記の `bisect 関数`_ は挿入点を見つけるには便利ですが、一般的な検索タスクに" +"使うには厄介であったり、使いにくい場合があります。 以下の5つの関数は、それら" +"をソートされたリストの標準的な検索に変換する方法を示しています::" -#: ../../library/bisect.rst:150 msgid "" "def index(a, x):\n" " 'Locate the leftmost value exactly equal to x'\n" @@ -249,6 +279,40 @@ msgid "" " return a[i]\n" " raise ValueError" msgstr "" +"def index(a, x):\n" +" 'xにちょうど等しい左端の値を見つける'\n" +" i = bisect_left(a, x)\n" +" if i != len(a) and a[i] == x:\n" +" return i\n" +" raise ValueError\n" +"\n" +"def find_lt(a, x):\n" +" 'xより小さい右端の値を見つける'\n" +" i = bisect_left(a, x)\n" +" if i:\n" +" return a[i-1]\n" +" raise ValueError\n" +"\n" +"def find_le(a, x):\n" +" 'x以下の右端の値を見つける'\n" +" i = bisect_right(a, x)\n" +" if i:\n" +" return a[i-1]\n" +" raise ValueError\n" +"\n" +"def find_gt(a, x):\n" +" 'xより大きい左端の値を見つける'\n" +" i = bisect_right(a, x)\n" +" if i != len(a):\n" +" return a[i]\n" +" raise ValueError\n" +"\n" +"def find_ge(a, x):\n" +" 'x以上の左端の要素を見つける'\n" +" i = bisect_left(a, x)\n" +" if i != len(a):\n" +" return a[i]\n" +" raise ValueError" #: ../../library/bisect.rst:187 msgid "Examples" @@ -261,6 +325,10 @@ msgid "" "grade for an exam score (say) based on a set of ordered numeric breakpoints: " "90 and up is an 'A', 80 to 89 is a 'B', and so on::" msgstr "" +":py:func:`~bisect.bisect` 関数は数値テーブルの探索に役に立ちます。この例で" +"は、 :py:func:`~bisect.bisect` を使って、(たとえば)順序のついた数値の区切り点" +"の集合に基づいて、試験の成績の等級を表す文字を調べます。区切り点は 90 以上は " +"'A'、 80 から 89 は 'B'、などです::" #: ../../library/bisect.rst:196 msgid "" @@ -278,8 +346,10 @@ msgid "" "work with lists of tuples. The *key* argument can serve to extract the " "field used for ordering records in a table::" msgstr "" +":py:func:`~bisect.bisect` と :py:func:`~bisect.insort` 関数もタプルのリストで" +"動作します。 引数 *key* はテーブルのレコードの順序付けに使用されるフィールド" +"を抽出します::" -#: ../../library/bisect.rst:207 msgid "" ">>> from collections import namedtuple\n" ">>> from operator import attrgetter\n" @@ -311,14 +381,45 @@ msgid "" " Movie(name='Aliens', released=1986, director='Cameron'),\n" " Movie(name='Titanic', released=1997, director='Cameron')]" msgstr "" +">>> from collections import namedtuple\n" +">>> from operator import attrgetter\n" +">>> from bisect import bisect, insort\n" +">>> from pprint import pprint\n" +"\n" +">>> Movie = namedtuple('Movie', ('name', 'released', 'director'))\n" +"\n" +">>> movies = [\n" +"... Movie('Jaws', 1975, 'Spielberg'),\n" +"... Movie('Titanic', 1997, 'Cameron'),\n" +"... Movie('The Birds', 1963, 'Hitchcock'),\n" +"... Movie('Aliens', 1986, 'Cameron')\n" +"... ]\n" +"\n" +">>> # 1960 年より後に公開された最初の映画を探す\n" +">>> by_year = attrgetter('released')\n" +">>> movies.sort(key=by_year)\n" +">>> movies[bisect(movies, 1960, key=by_year)]\n" +"Movie(name='The Birds', released=1963, director='Hitchcock')\n" +"\n" +">>> # ソート順を保ったまま映画を挿入する\n" +">>> romance = Movie('Love Story', 1970, 'Hiller')\n" +">>> insort(movies, romance, key=by_year)\n" +">>> pprint(movies)\n" +"[Movie(name='The Birds', released=1963, director='Hitchcock'),\n" +" Movie(name='Love Story', released=1970, director='Hiller'),\n" +" Movie(name='Jaws', released=1975, director='Spielberg'),\n" +" Movie(name='Aliens', released=1986, director='Cameron'),\n" +" Movie(name='Titanic', released=1997, director='Cameron')]" #: ../../library/bisect.rst:237 msgid "" "If the key function is expensive, it is possible to avoid repeated function " "calls by searching a list of precomputed keys to find the index of a record::" msgstr "" +"キー関数がコストがかかる場合は、レコードのインデックスを見つけるために事前に" +"計算されたキーのリストを検索することにより、関数呼び出しの繰り返しを回避する" +"ことが可能です::" -#: ../../library/bisect.rst:240 msgid "" ">>> data = [('red', 5), ('blue', 1), ('yellow', 8), ('black', 0)]\n" ">>> data.sort(key=lambda r: r[1]) # Or use operator.itemgetter(1).\n" @@ -332,3 +433,15 @@ msgid "" ">>> data[bisect_left(keys, 8)]\n" "('yellow', 8)" msgstr "" +">>> data = [('red', 5), ('blue', 1), ('yellow', 8), ('black', 0)]\n" +">>> data.sort(key=lambda r: r[1]) # または operator.itemgetter(1) を使" +"う。\n" +">>> keys = [r[1] for r in data] # キーのリストを事前に計算する。\n" +">>> data[bisect_left(keys, 0)]\n" +"('black', 0)\n" +">>> data[bisect_left(keys, 1)]\n" +"('blue', 1)\n" +">>> data[bisect_left(keys, 5)]\n" +"('red', 5)\n" +">>> data[bisect_left(keys, 8)]\n" +"('yellow', 8)" diff --git a/library/builtins.po b/library/builtins.po index f9de0938a..26c312840 100644 --- a/library/builtins.po +++ b/library/builtins.po @@ -17,22 +17,24 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/builtins.rst:2 msgid ":mod:`!builtins` --- Built-in objects" msgstr ":mod:`!builtins` --- 組み込みオブジェクト" -#: ../../library/builtins.rst:9 msgid "" "This module provides direct access to all 'built-in' identifiers of Python; " "for example, ``builtins.open`` is the full name for the built-in function :" "func:`open`." msgstr "" +"このモジュールを使うと、Python のすべての「組み込み」識別子に直接アクセスでき" +"ます。\n" +"例えば ``builtins.open`` は、組み込み関数 :func:`open` の完全な名前です。" #: ../../library/builtins.rst:12 msgid "" @@ -48,7 +50,6 @@ msgstr "" "ば、組み込みの :func:`open` をラップした :func:`open` という関数を実装したい" "モジュールがあったとすると、このモジュールは次のように直接的に使われます::" -#: ../../library/builtins.rst:18 msgid "" "import builtins\n" "\n" @@ -67,6 +68,22 @@ msgid "" "\n" " # ..." msgstr "" +"import builtins\n" +"\n" +"def open(path):\n" +" f = builtins.open(path, 'r')\n" +" return UpperCaser(f)\n" +"\n" +"class UpperCaser:\n" +" '''ファイルから得られる出力を大文字に変換するラッパー。'''\n" +"\n" +" def __init__(self, f):\n" +" self._f = f\n" +"\n" +" def read(self, count=-1):\n" +" return self._f.read(count).upper()\n" +"\n" +" # ..." #: ../../library/builtins.rst:35 msgid "" @@ -82,18 +99,14 @@ msgstr "" "詳細部分なので、異なる Python の実装では ``__builtins__`` は使われていないこ" "ともあります。" -#: ../../library/builtins.rst:43 msgid ":ref:`built-in-consts`" -msgstr "" +msgstr ":ref:`built-in-consts`" -#: ../../library/builtins.rst:44 msgid ":ref:`bltin-exceptions`" -msgstr "" +msgstr ":ref:`bltin-exceptions`" -#: ../../library/builtins.rst:45 msgid ":ref:`built-in-funcs`" -msgstr "" +msgstr ":ref:`built-in-funcs`" -#: ../../library/builtins.rst:46 msgid ":ref:`bltin-types`" -msgstr "" +msgstr ":ref:`bltin-types`" diff --git a/library/bz2.po b/library/bz2.po index 70d0c5e70..6c3c053cc 100644 --- a/library/bz2.po +++ b/library/bz2.po @@ -19,10 +19,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/bz2.rst:2 @@ -182,13 +182,12 @@ msgstr "" "``1`` から ``9`` の整数で指定できます。\n" "圧縮率は ``1`` が最低で、``9`` (デフォルト値) が最高です。" -#: ../../library/bz2.rst:86 msgid "" "If *mode* is ``'r'``, the input file may be the concatenation of multiple " "compressed streams." msgstr "" -"*mode* の値が ``'r'`` の場合、入力ファイルは複数の圧縮ストリームでも構いませ" -"ん。" +"*mode* が ``'r'`` の場合、入力ファイルは複数の圧縮ストリームを連結したもので" +"もかまいません。" #: ../../library/bz2.rst:89 msgid "" @@ -201,9 +200,8 @@ msgstr "" "truncate` を除くすべてが備わっています。イテレーションと :keyword:`with` 文を" "サポートしています。" -#: ../../library/bz2.rst:94 msgid ":class:`BZ2File` also provides the following methods and attributes:" -msgstr "" +msgstr ":class:`BZ2File` は次のメソッドと属性も提供します。" #: ../../library/bz2.rst:98 msgid "" @@ -226,50 +224,47 @@ msgstr "" "下層のファイルオブジェクトの位置が変わる惧れがあります(e.g. :class:`BZ2File` " "を *filename* にファイルオブジェクトを渡して作成した場合)。" -#: ../../library/bz2.rst:111 msgid "Return the file descriptor for the underlying file." -msgstr "" +msgstr "下層のファイルのファイル記述子を返します。" -#: ../../library/bz2.rst:117 msgid "Return whether the file was opened for reading." -msgstr "" +msgstr "ファイルが読み込み用に開かれたかどうかを返します。" -#: ../../library/bz2.rst:123 msgid "Return whether the file supports seeking." -msgstr "" +msgstr "ファイルがシークをサポートしているかどうかを返します。" -#: ../../library/bz2.rst:129 msgid "Return whether the file was opened for writing." -msgstr "" +msgstr "ファイルが書き込み用に開かれたかどうかを返します。" -#: ../../library/bz2.rst:135 msgid "" "Read up to *size* uncompressed bytes, while trying to avoid making multiple " "reads from the underlying stream. Reads up to a buffer's worth of data if " "size is negative." msgstr "" +"下層のストリームから複数回読み込むのをなるべく避けながら、展開後のデータを最" +"大 *size* バイト読み込みます。\n" +"``size`` が負の場合、最大でバッファ 1 つ分のデータを読み込みます。" -#: ../../library/bz2.rst:139 msgid "Returns ``b''`` if the file is at EOF." -msgstr "" +msgstr "ファイルが EOF に達している場合は ``b''`` を返します。" -#: ../../library/bz2.rst:145 msgid "Read bytes into *b*." -msgstr "" +msgstr "*b* にバイト列を読み込みます。" -#: ../../library/bz2.rst:147 msgid "Returns the number of bytes read (0 for EOF)." -msgstr "" +msgstr "読み込んだバイト数を返します (EOF の場合は 0)。" #: ../../library/bz2.rst:153 msgid "``'rb'`` for reading and ``'wb'`` for writing." msgstr "``'rb'`` は読み込み用、 ``'wb'`` は書き込み用です。" -#: ../../library/bz2.rst:159 msgid "" "The bzip2 file name. Equivalent to the :attr:`~io.FileIO.name` attribute of " "the underlying :term:`file object`." msgstr "" +"bzip2 ファイルの名前です。\n" +"下層の :term:`ファイルオブジェクト ` の :attr:`~io.FileIO.name` " +"属性と同じです。" #: ../../library/bz2.rst:165 msgid "Support for the :keyword:`with` statement was added." @@ -384,18 +379,17 @@ msgstr "" "タ展開に使用できます。一度に展開したい場合は、:func:`decompress` 関数を使って" "ください。" -#: ../../library/bz2.rst:234 msgid "" "This class does not transparently handle inputs containing multiple " "compressed streams, unlike :func:`decompress` and :class:`BZ2File`. If you " "need to decompress a multi-stream input with :class:`BZ2Decompressor`, you " "must use a new decompressor for each stream." msgstr "" -"このクラスは、:func:`decompress` や :class:`BZ2File` とは異なり、複数の圧縮レ" -"ベルが混在しているデータを透過的に扱うことができません。 :class:" -"`BZ2Decompressor` クラスを用いて、複数のストリームからなるデータを展開する場" -"合は、それぞれのストリームについてデコンプレッサオブジェクトを用意してくださ" -"い。" +"このクラスは、:func:`decompress` や :class:`BZ2File` とは異なり、\n" +"複数の圧縮ストリームを含む入力を透過的に扱うことができません。\n" +":class:`BZ2Decompressor` クラスを用いて、複数のストリームからなるデータを展開" +"する場合は、\n" +"それぞれのストリームについてデコンプレッサオブジェクトを用意してください。" #: ../../library/bz2.rst:241 msgid "" @@ -424,13 +418,12 @@ msgstr "" "``False`` に設定されます。この場合、 :meth:`~.decompress` を次に呼び出すと、" "*data* を ``b''`` として提供し、出力をさらに取得することができます。" -#: ../../library/bz2.rst:254 msgid "" "If all of the input data was decompressed and returned (either because this " "was less than *max_length* bytes, or because *max_length* was negative), " "the :attr:`~.needs_input` attribute will be set to ``True``." msgstr "" -"入力データの全てが圧縮され返された (*max_length* バイトより少ないためか " +"入力データの全てが展開され返された (*max_length* バイトより少ないためか " "*max_length* が負のため) 場合、\n" ":attr:`~.needs_input` 属性は ``True`` になります。" diff --git a/library/calendar.po b/library/calendar.po index 3051381e8..96450275f 100644 --- a/library/calendar.po +++ b/library/calendar.po @@ -21,10 +21,10 @@ msgstr "" "Last-Translator: Takanori Suzuki , 2025\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/calendar.rst:2 @@ -90,36 +90,32 @@ msgstr "" "使えるいくつかのメソッドを提供しています。しかし整形機能そのものは提供してい" "ません。それはサブクラスの仕事なのです。" -#: ../../library/calendar.rst:41 msgid ":class:`Calendar` instances have the following methods and attributes:" -msgstr "" +msgstr ":class:`Calendar` インスタンスは次のメソッドと属性を持ちます。" -#: ../../library/calendar.rst:45 msgid "The first weekday as an integer (0--6)." -msgstr "" +msgstr "週の最初の曜日を表す整数 (0~6) です。" -#: ../../library/calendar.rst:47 msgid "" "This property can also be set and read using :meth:`~Calendar." "setfirstweekday` and :meth:`~Calendar.getfirstweekday` respectively." msgstr "" +"このプロパティは、:meth:`~Calendar.setfirstweekday` で設定し、:meth:" +"`~Calendar.getfirstweekday` で読み取ることもできます。" -#: ../../library/calendar.rst:53 msgid "Return an :class:`int` for the current first weekday (0--6)." -msgstr "" +msgstr "現在の週の最初の曜日を :class:`int` (0~6) で返します。" -#: ../../library/calendar.rst:55 msgid "Identical to reading the :attr:`~Calendar.firstweekday` property." -msgstr "" +msgstr ":attr:`~Calendar.firstweekday` プロパティを読み取るのと同じです。" #: ../../library/calendar.rst:59 msgid "" "Set the first weekday to *firstweekday*, passed as an :class:`int` (0--6)" msgstr "" -#: ../../library/calendar.rst:61 msgid "Identical to setting the :attr:`~Calendar.firstweekday` property." -msgstr "" +msgstr ":attr:`~Calendar.firstweekday` プロパティを設定するのと同じです。" #: ../../library/calendar.rst:65 msgid "" @@ -140,13 +136,16 @@ msgstr "" "た後の日のうち、週の欠けを埋めるために必要な日を (:class:`datetime.date` オブ" "ジェクトとして) 返します。" -#: ../../library/calendar.rst:80 msgid "" "Return an iterator for the month *month* in the year *year* similar to :meth:" "`itermonthdates`, but not restricted by the :class:`datetime.date` range. " "Days returned will simply be day of the month numbers. For the days outside " "of the specified month, the day number is ``0``." msgstr "" +":meth:`itermonthdates` と同様に *year* 年 *month* 月のイテレーターを返します" +"が、:class:`datetime.date` の範囲には制限されません。\n" +"各日は単に月内の日を表す数値として返されます。\n" +"指定した月に含まれない日は ``0`` です。" #: ../../library/calendar.rst:88 msgid "" @@ -156,21 +155,25 @@ msgid "" "week day number." msgstr "" -#: ../../library/calendar.rst:96 msgid "" "Return an iterator for the month *month* in the year *year* similar to :meth:" "`itermonthdates`, but not restricted by the :class:`datetime.date` range. " "Days returned will be tuples consisting of a year, a month and a day of the " "month numbers." msgstr "" +":meth:`itermonthdates` と同様に *year* 年 *month* 月のイテレーターを返します" +"が、:class:`datetime.date` の範囲には制限されません。\n" +"各日は、年、月、日を表す数値からなるタプルとして返されます。" -#: ../../library/calendar.rst:106 msgid "" "Return an iterator for the month *month* in the year *year* similar to :meth:" "`itermonthdates`, but not restricted by the :class:`datetime.date` range. " "Days returned will be tuples consisting of a year, a month, a day of the " "month, and a day of the week numbers." msgstr "" +":meth:`itermonthdates` と同様に *year* 年 *month* 月のイテレーターを返します" +"が、:class:`datetime.date` の範囲には制限されません。\n" +"各日は、年、月、日、曜日を表す数値からなるタプルとして返されます。" #: ../../library/calendar.rst:116 msgid "" @@ -257,12 +260,14 @@ msgid "" "day of the week, where ``0`` is Monday and ``6`` is Sunday." msgstr "" -#: ../../library/calendar.rst:186 msgid "" "Return a string containing the header row of weekday names, formatted with " "the given *width* for each column. The names depend on the locale settings " "and are padded to the specified width." msgstr "" +"曜日名のヘッダー行を、各列の幅が *width* になるよう整形した文字列で返しま" +"す。\n" +"曜日名はロケール設定に従い、指定した幅になるよう空白を補います。" #: ../../library/calendar.rst:193 msgid "" @@ -277,19 +282,20 @@ msgstr "" "とができます。 :meth:`setfirstweekday` メソッドでセットされた週の最初の曜日に" "依存します。" -#: ../../library/calendar.rst:202 msgid "" "Return a string representing the month's name centered within the specified " "*width*. If *withyear* is ``True``, include the year in the output. The " "*theyear* and *themonth* parameters specify the year and month for the name " "to be formatted respectively." msgstr "" +"月名を指定した *width* の幅で中央揃えにした文字列を返します。\n" +"*withyear* が ``True`` なら、出力に年も含めます。\n" +"*theyear* と *themonth* はそれぞれ、表示する名前の年と月を指定します。" #: ../../library/calendar.rst:210 msgid "Print a month's calendar as returned by :meth:`formatmonth`." msgstr ":meth:`formatmonth` で返されるひと月分のカレンダーを出力します。" -#: ../../library/calendar.rst:215 msgid "" "Return a *m*-column calendar for an entire year as a multi-line string. " "Optional parameters *w*, *l*, and *c* are for date column width, lines per " @@ -298,11 +304,12 @@ msgid "" "`setfirstweekday` method. The earliest year for which a calendar can be " "generated is platform-dependent." msgstr "" -"*m* 列からなる一年間のカレンダーを複数行の文字列で返します。任意の引数 *w*, " -"*l*, *c* はそれぞれ、日付列の表示幅、各週の行数及び月と月の間のスペースの数を" -"変更するためのものです。 :meth:`setfirstweekday` メソッドでセットされた週の最" -"初の曜日に依存します。カレンダーを出力できる最初の年はプラットフォームに依存" -"します。" +"*m* 列からなる一年間のカレンダーを複数行の文字列で返します。\n" +"任意の引数 *w*, *l*, *c* はそれぞれ、日付列の表示幅、各週の行数及び月と月の間" +"のスペースの数を変更するためのものです。\n" +"コンストラクタで指定された、または :meth:`setfirstweekday` メソッドで設定され" +"た週の最初の曜日に依存します。\n" +"カレンダーを出力できる最初の年はプラットフォームに依存します。" #: ../../library/calendar.rst:225 msgid "" @@ -348,92 +355,99 @@ msgstr "" "コーディングを指定します (デフォルトではシステムデフォルトのエンコーディング" "です)。" -#: ../../library/calendar.rst:259 msgid "" "Return a month name as an HTML table row. If *withyear* is true the year " "will be included in the row, otherwise just the month name will be used." msgstr "" +"月名を HTML の表の行として返します。\n" +"*withyear* が真の場合は行に年も含め、それ以外の場合は月名だけを使います。" -#: ../../library/calendar.rst:264 msgid "" ":class:`!HTMLCalendar` has the following attributes you can override to " "customize the CSS classes used by the calendar:" msgstr "" +":class:`!HTMLCalendar` の次の属性をオーバーライドすると、カレンダーで使う " +"CSS クラスを変更できます。" -#: ../../library/calendar.rst:269 msgid "" "A list of CSS classes used for each weekday. The default class list is::" msgstr "" +"各曜日に使う CSS クラスのリストです。\n" +"デフォルトのリストは次のとおりです。 ::" -#: ../../library/calendar.rst:271 msgid "" "cssclasses = [\"mon\", \"tue\", \"wed\", \"thu\", \"fri\", \"sat\", \"sun\"]" msgstr "" +"cssclasses = [\"mon\", \"tue\", \"wed\", \"thu\", \"fri\", \"sat\", \"sun\"]" -#: ../../library/calendar.rst:273 msgid "more styles can be added for each day::" -msgstr "" +msgstr "各曜日にスタイルを追加できます。 ::" -#: ../../library/calendar.rst:275 msgid "" "cssclasses = [\"mon text-bold\", \"tue\", \"wed\", \"thu\", \"fri\", " "\"sat\", \"sun red\"]" msgstr "" +"cssclasses = [\"mon text-bold\", \"tue\", \"wed\", \"thu\", \"fri\", " +"\"sat\", \"sun red\"]" -#: ../../library/calendar.rst:277 msgid "Note that the length of this list must be seven items." -msgstr "" +msgstr "このリストの要素数は 7 でなければなりません。" -#: ../../library/calendar.rst:282 msgid "The CSS class for a weekday occurring in the previous or coming month." -msgstr "" +msgstr "前月または翌月に属する日に使う CSS クラスです。" -#: ../../library/calendar.rst:289 msgid "" "A list of CSS classes used for weekday names in the header row. The default " "is the same as :attr:`cssclasses`." msgstr "" +"ヘッダー行の曜日名に使う CSS クラスのリストです。\n" +"デフォルトは :attr:`cssclasses` と同じです。" -#: ../../library/calendar.rst:297 msgid "" "The month's head CSS class (used by :meth:`formatmonthname`). The default " "value is ``\"month\"``." msgstr "" +"月の見出しに使う CSS クラスです (:meth:`formatmonthname` が使用します)。\n" +"デフォルト値は ``\"month\"`` です。" -#: ../../library/calendar.rst:305 msgid "" "The CSS class for the whole month's table (used by :meth:`formatmonth`). The " "default value is ``\"month\"``." msgstr "" +"月全体の表に使う CSS クラスです (:meth:`formatmonth` が使用します)。\n" +"デフォルト値は ``\"month\"`` です。" -#: ../../library/calendar.rst:313 msgid "" "The CSS class for the whole year's table of tables (used by :meth:" "`formatyear`). The default value is ``\"year\"``." msgstr "" +"1 年分の各月の表をまとめる表に使う CSS クラスです (:meth:`formatyear` が使用" +"します)。\n" +"デフォルト値は ``\"year\"`` です。" -#: ../../library/calendar.rst:321 msgid "" "The CSS class for the table head for the whole year (used by :meth:" "`formatyear`). The default value is ``\"year\"``." msgstr "" +"年全体の表の見出しに使う CSS クラスです (:meth:`formatyear` が使用します)。\n" +"デフォルト値は ``\"year\"`` です。" -#: ../../library/calendar.rst:327 msgid "" "Note that although the naming for the above described class attributes is " "singular (e.g. ``cssclass_month`` ``cssclass_noday``), one can replace the " "single CSS class with a space separated list of CSS classes, for example::" msgstr "" +"これらのクラス属性の名前は単数形 (例えば ``cssclass_month`` や " +"``cssclass_noday``) ですが、単一の CSS クラスを、スペースで区切った複数の " +"CSS クラスに置き換えることもできます。\n" +"例えば次のように指定します。 ::" -#: ../../library/calendar.rst:331 msgid "\"text-bold text-red\"" -msgstr "" +msgstr "\"text-bold text-red\"" -#: ../../library/calendar.rst:333 msgid "Here is an example how :class:`!HTMLCalendar` can be customized::" -msgstr "" +msgstr ":class:`!HTMLCalendar` をカスタマイズする例です。 ::" -#: ../../library/calendar.rst:335 msgid "" "class CustomHTMLCal(calendar.HTMLCalendar):\n" " cssclasses = [style + \" text-nowrap\" for style in\n" @@ -442,26 +456,40 @@ msgid "" " cssclass_month = \"text-center month\"\n" " cssclass_year = \"text-italic lead\"" msgstr "" +"class CustomHTMLCal(calendar.HTMLCalendar):\n" +" cssclasses = [style + \" text-nowrap\" for style in\n" +" calendar.HTMLCalendar.cssclasses]\n" +" cssclass_month_head = \"text-center month-head\"\n" +" cssclass_month = \"text-center month\"\n" +" cssclass_year = \"text-italic lead\"" -#: ../../library/calendar.rst:345 msgid "" "This subclass of :class:`TextCalendar` can be passed a locale name in the " "constructor and will return month and weekday names in the specified locale." msgstr "" +":class:`TextCalendar` のこのサブクラスは、コンストラクターにロケール名を渡せ" +"ます。\n" +"指定したロケールの月名と曜日名を返します。" -#: ../../library/calendar.rst:351 msgid "" "This subclass of :class:`HTMLCalendar` can be passed a locale name in the " "constructor and will return month and weekday names in the specified locale." msgstr "" +":class:`HTMLCalendar` のこのサブクラスは、コンストラクターにロケール名を渡せ" +"ます。\n" +"指定したロケールの月名と曜日名を返します。" -#: ../../library/calendar.rst:357 msgid "" "The constructor, :meth:`!formatweekday` and :meth:`!formatmonthname` methods " "of these two classes temporarily change the ``LC_TIME`` locale to the given " "*locale*. Because the current locale is a process-wide setting, they are not " "thread-safe." msgstr "" +"これら 2 つのクラスのコンストラクターと :meth:`!formatweekday`、:meth:`!" +"formatmonthname` メソッドは、``LC_TIME`` ロケールを指定された *locale* に一時" +"的に変更します。\n" +"現在のロケールはプロセス全体の設定なので、これらはスレッドセーフではありませ" +"ん。" #: ../../library/calendar.rst:363 msgid "For simple text calendars this module provides the following functions." @@ -481,11 +509,12 @@ msgstr "" "`FRIDAY`, :const:`SATURDAY` 及び :const:`SUNDAY` は便宜上提供されています。例" "えば、日曜日を週の開始日に設定するときは::" -#: ../../library/calendar.rst:372 msgid "" "import calendar\n" "calendar.setfirstweekday(calendar.SUNDAY)" msgstr "" +"import calendar\n" +"calendar.setfirstweekday(calendar.SUNDAY)" #: ../../library/calendar.rst:378 msgid "Returns the current setting for the weekday to start each week." @@ -498,13 +527,12 @@ msgstr "" "*year* が閏年なら :const:`True` を、そうでなければ :const:`False` を返しま" "す。" -#: ../../library/calendar.rst:388 msgid "" "Returns the number of leap years in the range from *y1* to *y2* (exclusive), " "where *y1* and *y2* are years." msgstr "" -"範囲(*y1* ... *y2*)指定された期間の閏年の回数を返します。ここで *y1* や *y2* " -"は年を表します。" +"*y1* 以上 *y2* 未満の年の範囲に含まれる閏年の数を返します。\n" +"*y1* と *y2* は年を表します。" #: ../../library/calendar.rst:391 msgid "This function works for ranges spanning a century change." @@ -546,22 +574,24 @@ msgstr "" msgid "Prints a month's calendar as returned by :func:`month`." msgstr ":func:`month` 関数によって返される月のカレンダーを出力します。" -#: ../../library/calendar.rst:426 msgid "" "Returns a month's calendar in a multi-line string using the :meth:" "`~TextCalendar.formatmonth` of the :class:`TextCalendar` class." msgstr "" +":class:`TextCalendar` クラスの :meth:`~TextCalendar.formatmonth` を使い、1 か" +"月分のカレンダーを複数行の文字列で返します。" #: ../../library/calendar.rst:432 msgid "" "Prints the calendar for an entire year as returned by :func:`calendar`." msgstr ":func:`calendar` 関数で返される一年間のカレンダーを出力します。" -#: ../../library/calendar.rst:437 msgid "" "Returns a 3-column calendar for an entire year as a multi-line string using " "the :meth:`~TextCalendar.formatyear` of the :class:`TextCalendar` class." msgstr "" +":class:`TextCalendar` クラスの :meth:`~TextCalendar.formatyear` を使い、1 年" +"分の 3 列のカレンダーを複数行の文字列で返します。" #: ../../library/calendar.rst:443 msgid "" @@ -581,57 +611,69 @@ msgstr "" msgid "The :mod:`calendar` module exports the following data attributes:" msgstr ":mod:`calendar` モジュールの以下のデータ属性を利用することができます:" -#: ../../library/calendar.rst:454 msgid "" "A sequence that represents the days of the week in the current locale, where " "Monday is day number 0." msgstr "" +"現在のロケールの曜日名を表すシーケンスです。\n" +"月曜日が曜日番号 0 です。" -#: ../../library/calendar.rst:464 msgid "" "A sequence that represents the abbreviated days of the week in the current " "locale, where Mon is day number 0." msgstr "" +"現在のロケールの曜日の略称を表すシーケンスです。\n" +"月曜日 (Mon) が曜日番号 0 です。" -#: ../../library/calendar.rst:479 msgid "" "Aliases for the days of the week, where ``MONDAY`` is ``0`` and ``SUNDAY`` " "is ``6``." msgstr "" +"曜日を表す別名です。\n" +"``MONDAY`` が ``0``、``SUNDAY`` が ``6`` です。" -#: ../../library/calendar.rst:487 msgid "" "Enumeration defining days of the week as integer constants. The members of " "this enumeration are exported to the module scope as :data:`MONDAY` through :" "data:`SUNDAY`." msgstr "" +"曜日を整数定数として定義する列挙型です。\n" +"この列挙型のメンバーは、モジュールのスコープに :data:`MONDAY` から :data:" +"`SUNDAY` として公開されます。" -#: ../../library/calendar.rst:496 msgid "" "A sequence that represents the months of the year in the current locale. " "This follows normal convention of January being month number 1, so it has a " "length of 13 and ``month_name[0]`` is the empty string." msgstr "" +"現在のロケールの月名を表すシーケンスです。\n" +"通常の慣例どおり 1 月の月番号を 1 とするため、長さは 13 で、" +"``month_name[0]`` は空文字列です。" -#: ../../library/calendar.rst:507 msgid "" "A sequence that represents the abbreviated months of the year in the current " "locale. This follows normal convention of January being month number 1, so " "it has a length of 13 and ``month_abbr[0]`` is the empty string." msgstr "" +"現在のロケールの月名の略称を表すシーケンスです。\n" +"通常の慣例どおり 1 月の月番号を 1 とするため、長さは 13 で、" +"``month_abbr[0]`` は空文字列です。" -#: ../../library/calendar.rst:528 msgid "" "Aliases for the months of the year, where ``JANUARY`` is ``1`` and " "``DECEMBER`` is ``12``." msgstr "" +"月を表す別名です。\n" +"``JANUARY`` が ``1``、``DECEMBER`` が ``12`` です。" -#: ../../library/calendar.rst:536 msgid "" "Enumeration defining months of the year as integer constants. The members of " "this enumeration are exported to the module scope as :data:`JANUARY` " "through :data:`DECEMBER`." msgstr "" +"月を整数定数として定義する列挙型です。\n" +"この列挙型のメンバーは、モジュールのスコープに :data:`JANUARY` から :data:" +"`DECEMBER` として公開されます。" #: ../../library/calendar.rst:543 msgid "The :mod:`calendar` module defines the following exceptions:" @@ -643,19 +685,18 @@ msgid "" "outside of the range 1-12 (inclusive)." msgstr "" -#: ../../library/calendar.rst:552 msgid "The invalid month number." -msgstr "" +msgstr "無効な月番号です。" -#: ../../library/calendar.rst:557 msgid "" "A subclass of :exc:`ValueError`, raised when the given weekday number is " "outside of the range 0-6 (inclusive)." msgstr "" +":exc:`ValueError` のサブクラスで、指定された曜日番号が 0~6 の範囲外の場合に" +"送出されます。" -#: ../../library/calendar.rst:562 msgid "The invalid weekday number." -msgstr "" +msgstr "無効な曜日番号です。" #: ../../library/calendar.rst:567 msgid "Module :mod:`datetime`" @@ -687,18 +728,18 @@ msgid "" "to interactively print a calendar." msgstr "" -#: ../../library/calendar.rst:585 msgid "" "python -m calendar [-h] [-L LOCALE] [-e ENCODING] [-t {text,html}]\n" " [-w WIDTH] [-l LINES] [-s SPACING] [-m MONTHS] [-c CSS]\n" " [-f FIRST_WEEKDAY] [year] [month]" msgstr "" +"python -m calendar [-h] [-L LOCALE] [-e ENCODING] [-t {text,html}]\n" +" [-w WIDTH] [-l LINES] [-s SPACING] [-m MONTHS] [-c CSS]\n" +" [-f FIRST_WEEKDAY] [year] [month]" -#: ../../library/calendar.rst:592 msgid "For example, to print a calendar for the year 2000:" -msgstr "" +msgstr "例えば、2000 年のカレンダーを表示するには次のようにします。" -#: ../../library/calendar.rst:594 msgid "" "$ python -m calendar 2000\n" " 2000\n" @@ -738,6 +779,43 @@ msgid "" "23 24 25 26 27 28 29 27 28 29 30 25 26 27 28 29 30 31\n" "30 31" msgstr "" +"$ python -m calendar 2000\n" +" 2000\n" +"\n" +" January February March\n" +"Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su\n" +" 1 2 1 2 3 4 5 6 1 2 3 4 5\n" +" 3 4 5 6 7 8 9 7 8 9 10 11 12 13 6 7 8 9 10 11 12\n" +"10 11 12 13 14 15 16 14 15 16 17 18 19 20 13 14 15 16 17 18 19\n" +"17 18 19 20 21 22 23 21 22 23 24 25 26 27 20 21 22 23 24 25 26\n" +"24 25 26 27 28 29 30 28 29 27 28 29 30 31\n" +"31\n" +"\n" +" April May June\n" +"Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su\n" +" 1 2 1 2 3 4 5 6 7 1 2 3 4\n" +" 3 4 5 6 7 8 9 8 9 10 11 12 13 14 5 6 7 8 9 10 11\n" +"10 11 12 13 14 15 16 15 16 17 18 19 20 21 12 13 14 15 16 17 18\n" +"17 18 19 20 21 22 23 22 23 24 25 26 27 28 19 20 21 22 23 24 25\n" +"24 25 26 27 28 29 30 29 30 31 26 27 28 29 30\n" +"\n" +" July August September\n" +"Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su\n" +" 1 2 1 2 3 4 5 6 1 2 3\n" +" 3 4 5 6 7 8 9 7 8 9 10 11 12 13 4 5 6 7 8 9 10\n" +"10 11 12 13 14 15 16 14 15 16 17 18 19 20 11 12 13 14 15 16 17\n" +"17 18 19 20 21 22 23 21 22 23 24 25 26 27 18 19 20 21 22 23 24\n" +"24 25 26 27 28 29 30 28 29 30 31 25 26 27 28 29 30\n" +"31\n" +"\n" +" October November December\n" +"Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su\n" +" 1 1 2 3 4 5 1 2 3\n" +" 2 3 4 5 6 7 8 6 7 8 9 10 11 12 4 5 6 7 8 9 10\n" +" 9 10 11 12 13 14 15 13 14 15 16 17 18 19 11 12 13 14 15 16 17\n" +"16 17 18 19 20 21 22 20 21 22 23 24 25 26 18 19 20 21 22 23 24\n" +"23 24 25 26 27 28 29 27 28 29 30 25 26 27 28 29 30 31\n" +"30 31" #: ../../library/calendar.rst:635 msgid "The following options are accepted:" @@ -747,29 +825,34 @@ msgstr "以下のオプションが使用できます:" msgid "Show the help message and exit." msgstr "ヘルプメッセージを表示して終了します。" -#: ../../library/calendar.rst:647 msgid "The locale to use for month and weekday names. Defaults to English." msgstr "" +"月名と曜日名に使うロケールです。\n" +"デフォルトは英語です。" -#: ../../library/calendar.rst:653 msgid "" "The encoding to use for output. :option:`--encoding` is required if :option:" "`--locale` is set." msgstr "" +"出力に使うエンコーディングです。\n" +":option:`--locale` を設定した場合は :option:`--encoding` が必須です。" -#: ../../library/calendar.rst:659 msgid "Print the calendar to the terminal as text, or as an HTML document." msgstr "" +"カレンダーをテキストとして端末に表示するか、HTML 文書として出力します。" -#: ../../library/calendar.rst:665 msgid "" "The weekday to start each week. Must be a number between 0 (Monday) and 6 " "(Sunday). Defaults to 0." msgstr "" +"週の最初の曜日です。\n" +"0 (月曜日) から 6 (日曜日) までの数値を指定してください。\n" +"デフォルトは 0 です。" -#: ../../library/calendar.rst:673 msgid "The year to print the calendar for. Defaults to the current year." msgstr "" +"カレンダーを表示する年です。\n" +"デフォルトは現在の年です。" #: ../../library/calendar.rst:679 msgid "" @@ -778,44 +861,54 @@ msgid "" "printing a calendar for the full year." msgstr "" -#: ../../library/calendar.rst:685 msgid "*Text-mode options:*" -msgstr "" +msgstr "*テキストモードのオプション:*" -#: ../../library/calendar.rst:689 msgid "" "The width of the date column in terminal columns. The date is printed " "centred in the column. Any value lower than 2 is ignored. Defaults to 2." msgstr "" +"日付の列の幅を、端末の桁数で指定します。\n" +"日付は列の中央に表示されます。\n" +"2 未満の値は無視します。\n" +"デフォルトは 2 です。" -#: ../../library/calendar.rst:697 msgid "" "The number of lines for each week in terminal rows. The date is printed top-" "aligned. Any value lower than 1 is ignored. Defaults to 1." msgstr "" +"各週に使う行数を、端末の行数で指定します。\n" +"日付は上揃えで表示されます。\n" +"1 未満の値は無視します。\n" +"デフォルトは 1 です。" -#: ../../library/calendar.rst:705 msgid "" "The space between months in columns. Any value lower than 2 is ignored. " "Defaults to 6." msgstr "" +"月と月の間隔を桁数で指定します。\n" +"2 未満の値は無視します。\n" +"デフォルトは 6 です。" -#: ../../library/calendar.rst:712 msgid "The number of months printed per row. Defaults to 3." msgstr "" +"1 行に表示する月の数です。\n" +"デフォルトは 3 です。" -#: ../../library/calendar.rst:715 msgid "" "By default, today's date is highlighted in color and can be :ref:`controlled " "using environment variables `." msgstr "" +"デフォルトでは今日の日付を色で強調表示します。\n" +"この動作は :ref:`環境変数で制御できます `。" -#: ../../library/calendar.rst:719 msgid "*HTML-mode options:*" -msgstr "" +msgstr "*HTML モードのオプション:*" -#: ../../library/calendar.rst:723 msgid "" "The path of a CSS stylesheet to use for the calendar. This must either be " "relative to the generated HTML, or an absolute HTTP or ``file:///`` URL." msgstr "" +"カレンダーに使う CSS スタイルシートのパスです。\n" +"生成される HTML からの相対パスか、絶対 HTTP URL または ``file:///`` URL でな" +"ければなりません。" diff --git a/library/cgi.po b/library/cgi.po index 1e13e8890..28d393549 100644 --- a/library/cgi.po +++ b/library/cgi.po @@ -12,15 +12,15 @@ msgstr "" "PO-Revision-Date: 2024-11-19 01:02+0000\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/cgi.rst:2 msgid ":mod:`!cgi` --- Common Gateway Interface support" -msgstr "" +msgstr ":mod:`!cgi` --- Common Gateway Interface のサポート" #: ../../library/cgi.rst:10 msgid "" @@ -28,6 +28,9 @@ msgid "" "`removed in Python 3.13 ` after being deprecated in " "Python 3.11. The removal was decided in :pep:`594`." msgstr "" +"このモジュールは今や Python 標準ライブラリの一部ではありません。このモジュー" +"ルは Python 3.11 で非推奨となったあと、:ref:`Python 3.13 で削除` されました。削除の決定は :pep:`594` でなされました。" #: ../../library/cgi.rst:14 msgid "" @@ -35,9 +38,14 @@ msgid "" "is a copy of the cgi module, no longer maintained or supported by the core " "Python team." msgstr "" +"代替として、PyPI 上にあるこのモジュールのフォーク :pypi:`legacy-cgi` を利用で" +"きます。これは cgi モジュールのコピーであり、もはやコア Python チームによって" +"メンテナンスもサポートもされていません。" #: ../../library/cgi.rst:18 msgid "" "The last version of Python that provided the :mod:`!cgi` module was `Python " "3.12 `_." msgstr "" +":mod:`!cgi` モジュールを提供していた最後の Python バージョンは `Python 3.12 " +"`_ です。" diff --git a/library/cgitb.po b/library/cgitb.po index 04eddd5ae..5e23dfb5c 100644 --- a/library/cgitb.po +++ b/library/cgitb.po @@ -12,15 +12,14 @@ msgstr "" "PO-Revision-Date: 2024-11-19 01:02+0000\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" -#: ../../library/cgitb.rst:2 msgid ":mod:`!cgitb` --- Traceback manager for CGI scripts" -msgstr "" +msgstr ":mod:`!cgitb` --- CGI スクリプトのトレースバック管理" #: ../../library/cgitb.rst:10 msgid "" @@ -28,6 +27,9 @@ msgid "" "`removed in Python 3.13 ` after being deprecated in " "Python 3.11. The removal was decided in :pep:`594`." msgstr "" +"このモジュールは今や Python 標準ライブラリの一部ではありません。このモジュー" +"ルは Python 3.11 で非推奨となったあと、:ref:`Python 3.13 で削除` されました。削除の決定は :pep:`594` でなされました。" #: ../../library/cgitb.rst:14 msgid "" @@ -36,8 +38,9 @@ msgid "" "core Python team." msgstr "" -#: ../../library/cgitb.rst:18 msgid "" "The last version of Python that provided the :mod:`!cgitb` module was " "`Python 3.12 `_." msgstr "" +":mod:`!cgitb` モジュールを提供していた最後のバージョンは `Python 3.12 " +"`_ です。" diff --git a/library/chunk.po b/library/chunk.po index 86334c64a..dd9389015 100644 --- a/library/chunk.po +++ b/library/chunk.po @@ -12,15 +12,14 @@ msgstr "" "PO-Revision-Date: 2024-11-19 01:02+0000\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" -#: ../../library/chunk.rst:2 msgid ":mod:`!chunk` --- Read IFF chunked data" -msgstr "" +msgstr ":mod:`!chunk` --- IFF チャンクデータの読み込み" #: ../../library/chunk.rst:10 msgid "" @@ -28,9 +27,13 @@ msgid "" "`removed in Python 3.13 ` after being deprecated in " "Python 3.11. The removal was decided in :pep:`594`." msgstr "" +"このモジュールは今や Python 標準ライブラリの一部ではありません。このモジュー" +"ルは Python 3.11 で非推奨となったあと、:ref:`Python 3.13 で削除` されました。削除の決定は :pep:`594` でなされました。" -#: ../../library/chunk.rst:14 msgid "" "The last version of Python that provided the :mod:`!chunk` module was " "`Python 3.12 `_." msgstr "" +":mod:`!chunk` モジュールを提供していた最後のバージョンは `Python 3.12 " +"`_ です。" diff --git a/library/cmath.po b/library/cmath.po index 5466b9117..937b556f0 100644 --- a/library/cmath.po +++ b/library/cmath.po @@ -19,10 +19,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/cmath.rst:2 @@ -46,7 +46,6 @@ msgstr "" "これらのメソッドはそのオブジェクトを複素数または浮動小数点数に変換するのにそ" "れぞれ使われ、呼び出された関数はそうして変換された結果を利用します。" -#: ../../library/cmath.rst:18 msgid "" "For functions involving branch cuts, we have the problem of deciding how to " "define those functions on the cut itself. Following Kahan's \"Branch cuts " @@ -56,307 +55,263 @@ msgid "" "axis we look at the sign of the imaginary part, while for a branch cut along " "the imaginary axis we look at the sign of the real part." msgstr "" +"分枝切断を持つ関数では、切断そのものの上で関数をどう定義するかが問題になりま" +"す。\n" +"Kahan の論文 \"Branch cuts for complex elementary functions\" と、C99 以降の " +"C 規格の附属書 G に従い、ゼロの符号で分枝切断のどちら側かを区別します。\n" +"実軸の一部に沿った分枝切断では虚部の符号を使い、虚軸に沿った分枝切断では実部" +"の符号を使います。" -#: ../../library/cmath.rst:26 msgid "" "For example, the :func:`cmath.sqrt` function has a branch cut along the " "negative real axis. An argument of ``-2-0j`` is treated as though it lies " "*below* the branch cut, and so gives a result on the negative imaginary " "axis::" msgstr "" +"例えば :func:`cmath.sqrt` 関数は、負の実軸に沿った分枝切断を持ちます。\n" +"引数 ``-2-0j`` は分枝切断の *下側* にあるものとして扱うため、結果は負の虚軸上" +"になります。 ::" -#: ../../library/cmath.rst:31 msgid "" ">>> cmath.sqrt(-2-0j)\n" "-1.4142135623730951j" msgstr "" +">>> cmath.sqrt(-2-0j)\n" +"-1.4142135623730951j" -#: ../../library/cmath.rst:34 msgid "" "But an argument of ``-2+0j`` is treated as though it lies above the branch " "cut::" -msgstr "" +msgstr "一方、引数 ``-2+0j`` は分枝切断の上側にあるものとして扱います。 ::" -#: ../../library/cmath.rst:37 msgid "" ">>> cmath.sqrt(-2+0j)\n" "1.4142135623730951j" msgstr "" +">>> cmath.sqrt(-2+0j)\n" +"1.4142135623730951j" -#: ../../library/cmath.rst:42 msgid "**Conversions to and from polar coordinates**" -msgstr "" +msgstr "**極座標変換**" -#: ../../library/cmath.rst:44 msgid ":func:`phase(z) `" -msgstr "" +msgstr ":func:`phase(z) `" -#: ../../library/cmath.rst:44 msgid "Return the phase of *z*" -msgstr "" +msgstr "*z* の位相を返します" -#: ../../library/cmath.rst:45 msgid ":func:`polar(z) `" -msgstr "" +msgstr ":func:`polar(z) `" -#: ../../library/cmath.rst:45 msgid "Return the representation of *z* in polar coordinates" -msgstr "" +msgstr "*z* を極座標で表した値を返します" -#: ../../library/cmath.rst:46 msgid ":func:`rect(r, phi) `" -msgstr "" +msgstr ":func:`rect(r, phi) `" -#: ../../library/cmath.rst:46 msgid "Return the complex number *z* with polar coordinates *r* and *phi*" -msgstr "" +msgstr "極座標が *r* と *phi* である複素数 *z* を返します" -#: ../../library/cmath.rst:48 msgid "**Power and logarithmic functions**" -msgstr "" +msgstr "**指数関数と対数関数**" -#: ../../library/cmath.rst:50 msgid ":func:`exp(z) `" -msgstr "" +msgstr ":func:`exp(z) `" -#: ../../library/cmath.rst:50 msgid "Return *e* raised to the power *z*" -msgstr "" +msgstr "*e* の *z* 乗を返します" -#: ../../library/cmath.rst:51 msgid ":func:`log(z[, base]) `" -msgstr "" +msgstr ":func:`log(z[, base]) `" -#: ../../library/cmath.rst:51 msgid "Return the logarithm of *z* to the given *base* (*e* by default)" -msgstr "" +msgstr "*base* (デフォルトは *e*) を底とする *z* の対数を返します" -#: ../../library/cmath.rst:52 msgid ":func:`log10(z) `" -msgstr "" +msgstr ":func:`log10(z) `" -#: ../../library/cmath.rst:52 msgid "Return the base-10 logarithm of *z*" -msgstr "" +msgstr "10 を底とする *z* の対数を返します" -#: ../../library/cmath.rst:53 msgid ":func:`sqrt(z) `" -msgstr "" +msgstr ":func:`sqrt(z) `" -#: ../../library/cmath.rst:53 msgid "Return the square root of *z*" -msgstr "" +msgstr "*z* の平方根を返します" -#: ../../library/cmath.rst:55 msgid "**Trigonometric functions**" -msgstr "" +msgstr "**三角関数**" -#: ../../library/cmath.rst:57 msgid ":func:`acos(z) `" -msgstr "" +msgstr ":func:`acos(z) `" -#: ../../library/cmath.rst:57 msgid "Return the arc cosine of *z*" -msgstr "" +msgstr "*z* の逆余弦を返します" -#: ../../library/cmath.rst:58 msgid ":func:`asin(z) `" -msgstr "" +msgstr ":func:`asin(z) `" -#: ../../library/cmath.rst:58 msgid "Return the arc sine of *z*" -msgstr "" +msgstr "*z* の逆正弦を返します" -#: ../../library/cmath.rst:59 msgid ":func:`atan(z) `" -msgstr "" +msgstr ":func:`atan(z) `" -#: ../../library/cmath.rst:59 msgid "Return the arc tangent of *z*" -msgstr "" +msgstr "*z* の逆正接を返します" -#: ../../library/cmath.rst:60 msgid ":func:`cos(z) `" -msgstr "" +msgstr ":func:`cos(z) `" -#: ../../library/cmath.rst:60 msgid "Return the cosine of *z*" -msgstr "" +msgstr "*z* の余弦を返します" -#: ../../library/cmath.rst:61 msgid ":func:`sin(z) `" -msgstr "" +msgstr ":func:`sin(z) `" -#: ../../library/cmath.rst:61 msgid "Return the sine of *z*" -msgstr "" +msgstr "*z* の正弦を返します" -#: ../../library/cmath.rst:62 msgid ":func:`tan(z) `" -msgstr "" +msgstr ":func:`tan(z) `" -#: ../../library/cmath.rst:62 msgid "Return the tangent of *z*" -msgstr "" +msgstr "*z* の正接を返します" -#: ../../library/cmath.rst:64 msgid "**Hyperbolic functions**" -msgstr "" +msgstr "**双曲線関数**" -#: ../../library/cmath.rst:66 msgid ":func:`acosh(z) `" -msgstr "" +msgstr ":func:`acosh(z) `" -#: ../../library/cmath.rst:66 msgid "Return the inverse hyperbolic cosine of *z*" -msgstr "" +msgstr "*z* の逆双曲線余弦を返します" -#: ../../library/cmath.rst:67 msgid ":func:`asinh(z) `" -msgstr "" +msgstr ":func:`asinh(z) `" -#: ../../library/cmath.rst:67 msgid "Return the inverse hyperbolic sine of *z*" -msgstr "" +msgstr "*z* の逆双曲線正弦を返します" -#: ../../library/cmath.rst:68 msgid ":func:`atanh(z) `" -msgstr "" +msgstr ":func:`atanh(z) `" -#: ../../library/cmath.rst:68 msgid "Return the inverse hyperbolic tangent of *z*" -msgstr "" +msgstr "*z* の逆双曲線正接を返します" -#: ../../library/cmath.rst:69 msgid ":func:`cosh(z) `" -msgstr "" +msgstr ":func:`cosh(z) `" -#: ../../library/cmath.rst:69 msgid "Return the hyperbolic cosine of *z*" -msgstr "" +msgstr "*z* の双曲線余弦を返します" -#: ../../library/cmath.rst:70 msgid ":func:`sinh(z) `" -msgstr "" +msgstr ":func:`sinh(z) `" -#: ../../library/cmath.rst:70 msgid "Return the hyperbolic sine of *z*" -msgstr "" +msgstr "*z* の双曲線正弦を返します" -#: ../../library/cmath.rst:71 msgid ":func:`tanh(z) `" -msgstr "" +msgstr ":func:`tanh(z) `" -#: ../../library/cmath.rst:71 msgid "Return the hyperbolic tangent of *z*" -msgstr "" +msgstr "*z* の双曲線正接を返します" -#: ../../library/cmath.rst:73 msgid "**Classification functions**" -msgstr "" +msgstr "**類別関数**" -#: ../../library/cmath.rst:75 msgid ":func:`isfinite(z) `" -msgstr "" +msgstr ":func:`isfinite(z) `" -#: ../../library/cmath.rst:75 msgid "Check if all components of *z* are finite" -msgstr "" +msgstr "*z* の実部と虚部が両方とも有限かどうかを調べます" -#: ../../library/cmath.rst:76 msgid ":func:`isinf(z) `" -msgstr "" +msgstr ":func:`isinf(z) `" -#: ../../library/cmath.rst:76 msgid "Check if any component of *z* is infinite" -msgstr "" +msgstr "*z* の実部または虚部が無限大かどうかを調べます" -#: ../../library/cmath.rst:77 msgid ":func:`isnan(z) `" -msgstr "" +msgstr ":func:`isnan(z) `" -#: ../../library/cmath.rst:77 msgid "Check if any component of *z* is a NaN" -msgstr "" +msgstr "*z* の実部または虚部が NaN かどうかを調べます" -#: ../../library/cmath.rst:78 msgid ":func:`isclose(a, b, *, rel_tol, abs_tol) `" -msgstr "" +msgstr ":func:`isclose(a, b, *, rel_tol, abs_tol) `" -#: ../../library/cmath.rst:78 msgid "Check if the values *a* and *b* are close to each other" -msgstr "" +msgstr "*a* と *b* が互いに近い値かを調べる" #: ../../library/cmath.rst:80 msgid "**Constants**" -msgstr "" +msgstr "**定数**" #: ../../library/cmath.rst:82 msgid ":data:`pi`" -msgstr "" +msgstr ":data:`pi`" #: ../../library/cmath.rst:82 msgid "*π* = 3.141592..." -msgstr "" +msgstr "*π* = 3.141592..." #: ../../library/cmath.rst:83 msgid ":data:`e`" -msgstr "" +msgstr ":data:`e`" #: ../../library/cmath.rst:83 msgid "*e* = 2.718281..." -msgstr "" +msgstr "*e* = 2.718281..." #: ../../library/cmath.rst:84 msgid ":data:`tau`" -msgstr "" +msgstr ":data:`tau`" #: ../../library/cmath.rst:84 msgid "*τ* = 2\\ *π* = 6.283185..." -msgstr "" +msgstr "*τ* = 2\\ *π* = 6.283185..." #: ../../library/cmath.rst:85 msgid ":data:`inf`" -msgstr "" +msgstr ":data:`inf`" #: ../../library/cmath.rst:85 msgid "Positive infinity" -msgstr "" +msgstr "正の無限大" -#: ../../library/cmath.rst:86 msgid ":data:`infj`" -msgstr "" +msgstr ":data:`infj`" -#: ../../library/cmath.rst:86 msgid "Pure imaginary infinity" -msgstr "" +msgstr "虚部が無限大の純虚数" #: ../../library/cmath.rst:87 msgid ":data:`nan`" -msgstr "" +msgstr ":data:`nan`" #: ../../library/cmath.rst:87 msgid "\"Not a number\" (NaN)" -msgstr "" +msgstr "非数 \"Not a number\" (NaN)" -#: ../../library/cmath.rst:88 msgid ":data:`nanj`" -msgstr "" +msgstr ":data:`nanj`" -#: ../../library/cmath.rst:88 msgid "Pure imaginary NaN" -msgstr "" +msgstr "虚部が NaN の純虚数" #: ../../library/cmath.rst:93 msgid "Conversions to and from polar coordinates" msgstr "極座標変換" -#: ../../library/cmath.rst:95 msgid "" "A Python complex number ``z`` is stored internally using *rectangular* or " "*Cartesian* coordinates. It is completely determined by its *real part* ``z." "real`` and its *imaginary part* ``z.imag``." msgstr "" +"Python の複素数 ``z`` は、内部では *直交座標* (デカルト座標) で保持されま" +"す。\n" +"*実部* ``z.real`` と *虚部* ``z.imag`` によって完全に定まります。" #: ../../library/cmath.rst:99 msgid "" @@ -379,7 +334,6 @@ msgid "" msgstr "" "次の関数はネイティブの直交座標を極座標に変換したりその逆を行うのに使えます。" -#: ../../library/cmath.rst:111 msgid "" "Return the phase of *z* (also known as the *argument* of *z*), as a float. " "``phase(z)`` is equivalent to ``math.atan2(z.imag, z.real)``. The result " @@ -387,14 +341,21 @@ msgid "" "along the negative real axis. The sign of the result is the same as the " "sign of ``z.imag``, even when ``z.imag`` is zero::" msgstr "" +"*z* の位相 (*偏角* とも呼びます) を浮動小数点数で返します。\n" +"``phase(z)`` は ``math.atan2(z.imag, z.real)`` と同じです。\n" +"結果の範囲は [-\\ *π*, *π*] で、分枝切断は負の実軸に沿っています。\n" +"``z.imag`` がゼロの場合も、結果の符号は ``z.imag`` の符号と同じです。 ::" -#: ../../library/cmath.rst:117 msgid "" ">>> phase(-1+0j)\n" "3.141592653589793\n" ">>> phase(-1-0j)\n" "-3.141592653589793" msgstr "" +">>> phase(-1+0j)\n" +"3.141592653589793\n" +">>> phase(-1-0j)\n" +"-3.141592653589793" #: ../../library/cmath.rst:125 msgid "" @@ -403,139 +364,155 @@ msgid "" "function for this operation." msgstr "" -#: ../../library/cmath.rst:132 msgid "" "Return the representation of *z* in polar coordinates. Returns a pair ``(r, " "phi)`` where *r* is the modulus of *z* and *phi* is the phase of *z*. " "``polar(z)`` is equivalent to ``(abs(z), phase(z))``." msgstr "" +"*z* の極座標表現を返します。\n" +"戻り値は ``(r, phi)`` の組で、*r* は *z* の大きさ、*phi* は *z* の位相で" +"す。\n" +"``polar(z)`` は ``(abs(z), phase(z))`` と同じです。" -#: ../../library/cmath.rst:140 msgid "" "Return the complex number *z* with polar coordinates *r* and *phi*. " "Equivalent to ``complex(r * math.cos(phi), r * math.sin(phi))``." msgstr "" +"極座標が *r* と *phi* である複素数 *z* を返します。\n" +"``complex(r * math.cos(phi), r * math.sin(phi))`` と同じです。" #: ../../library/cmath.rst:145 msgid "Power and logarithmic functions" msgstr "指数関数と対数関数" -#: ../../library/cmath.rst:149 msgid "" "Return *e* raised to the power *z*, where *e* is the base of natural " "logarithms." -msgstr "" +msgstr "自然対数の底 *e* の *z* 乗を返します。" -#: ../../library/cmath.rst:155 msgid "" "Return the logarithm of *z* to the given *base*. If the *base* is not " "specified, returns the natural logarithm of *z*. There is one branch cut, " "from 0 along the negative real axis to -∞." msgstr "" +"*base* を底とする *z* の対数を返します。\n" +"*base* を指定しない場合は *z* の自然対数を返します。\n" +"分枝切断は 1 つで、0 から負の実軸に沿って -∞ まで延びています。" -#: ../../library/cmath.rst:162 msgid "" "Return the base-10 logarithm of *z*. This has the same branch cut as :func:" "`log`." msgstr "" +"10 を底とする *z* の対数を返します。\n" +"分枝切断は :func:`log` と同じです。" -#: ../../library/cmath.rst:168 msgid "" "Return the square root of *z*. This has the same branch cut as :func:`log`." msgstr "" +"*z* の平方根を返します。\n" +"分枝切断は :func:`log` と同じです。" #: ../../library/cmath.rst:172 msgid "Trigonometric functions" msgstr "三角関数" -#: ../../library/cmath.rst:176 msgid "" "Return the arc cosine of *z*. There are two branch cuts: One extends right " "from 1 along the real axis to ∞. The other extends left from -1 along the " "real axis to -∞." msgstr "" +"*z* の逆余弦を返します。\n" +"分枝切断は 2 つあります。\n" +"一方は 1 から実軸に沿って右に ∞ まで、もう一方は -1 から実軸に沿って左に -∞ " +"まで延びています。" -#: ../../library/cmath.rst:183 msgid "" "Return the arc sine of *z*. This has the same branch cuts as :func:`acos`." msgstr "" +"*z* の逆正弦を返します。\n" +"分枝切断は :func:`acos` と同じです。" -#: ../../library/cmath.rst:188 msgid "" "Return the arc tangent of *z*. There are two branch cuts: One extends from " "``1j`` along the imaginary axis to ``∞j``. The other extends from ``-1j`` " "along the imaginary axis to ``-∞j``." msgstr "" +"*z* の逆正接を返します。\n" +"分枝切断は 2 つあります。\n" +"一方は ``1j`` から虚軸に沿って ``∞j`` まで、もう一方は ``-1j`` から虚軸に沿っ" +"て ``-∞j`` まで延びています。" -#: ../../library/cmath.rst:195 msgid "Return the cosine of *z*." -msgstr "" +msgstr "*z* の余弦を返します。" -#: ../../library/cmath.rst:200 msgid "Return the sine of *z*." -msgstr "" +msgstr "*z* の正弦を返します。" -#: ../../library/cmath.rst:205 msgid "Return the tangent of *z*." -msgstr "" +msgstr "*z* の正接を返します。" #: ../../library/cmath.rst:209 msgid "Hyperbolic functions" msgstr "双曲線関数" -#: ../../library/cmath.rst:213 msgid "" "Return the inverse hyperbolic cosine of *z*. There is one branch cut, " "extending left from 1 along the real axis to -∞." msgstr "" +"*z* の逆双曲線余弦を返します。\n" +"分枝切断は 1 つで、1 から実軸に沿って左に -∞ まで延びています。" -#: ../../library/cmath.rst:219 msgid "" "Return the inverse hyperbolic sine of *z*. There are two branch cuts: One " "extends from ``1j`` along the imaginary axis to ``∞j``. The other extends " "from ``-1j`` along the imaginary axis to ``-∞j``." msgstr "" +"*z* の逆双曲線正弦を返します。\n" +"分枝切断は 2 つあります。\n" +"一方は ``1j`` から虚軸に沿って ``∞j`` まで、もう一方は ``-1j`` から虚軸に沿っ" +"て ``-∞j`` まで延びています。" -#: ../../library/cmath.rst:226 msgid "" "Return the inverse hyperbolic tangent of *z*. There are two branch cuts: One " "extends from ``1`` along the real axis to ``∞``. The other extends from " "``-1`` along the real axis to ``-∞``." msgstr "" +"*z* の逆双曲線正接を返します。\n" +"分枝切断は 2 つあります。\n" +"一方は ``1`` から実軸に沿って ``∞`` まで、もう一方は ``-1`` から実軸に沿って " +"``-∞`` まで延びています。" -#: ../../library/cmath.rst:233 msgid "Return the hyperbolic cosine of *z*." -msgstr "" +msgstr "*z* の双曲線余弦を返します。" -#: ../../library/cmath.rst:238 msgid "Return the hyperbolic sine of *z*." -msgstr "" +msgstr "*z* の双曲線正弦を返します。" -#: ../../library/cmath.rst:243 msgid "Return the hyperbolic tangent of *z*." -msgstr "" +msgstr "*z* の双曲線正接を返します。" #: ../../library/cmath.rst:247 msgid "Classification functions" msgstr "類別関数" -#: ../../library/cmath.rst:251 msgid "" "Return ``True`` if both the real and imaginary parts of *z* are finite, and " "``False`` otherwise." msgstr "" +"*z* の実部と虚部が両方とも有限なら ``True``、それ以外は ``False`` を返しま" +"す。" -#: ../../library/cmath.rst:259 msgid "" "Return ``True`` if either the real or the imaginary part of *z* is an " "infinity, and ``False`` otherwise." msgstr "" +"*z* の実部または虚部が無限大なら ``True``、それ以外は ``False`` を返します。" -#: ../../library/cmath.rst:265 msgid "" "Return ``True`` if either the real or the imaginary part of *z* is a NaN, " "and ``False`` otherwise." msgstr "" +"*z* の実部または虚部が NaN なら ``True``、それ以外は ``False`` を返します。" #: ../../library/cmath.rst:271 msgid "" @@ -545,14 +522,16 @@ msgstr "" "値 *a* と *b* が互いに近い場合 ``True`` を、そうでない場合は ``False`` を返し" "ます。" -#: ../../library/cmath.rst:274 msgid "" "Whether or not two values are considered close is determined according to " "given absolute and relative tolerances. If no errors occur, the result will " "be: ``abs(a-b) <= max(rel_tol * max(abs(a), abs(b)), abs_tol)``." msgstr "" +"2 つの値が近いとみなされるかは、指定された絶対許容誤差と相対許容誤差で決まり" +"ます。\n" +"エラーが起きなければ、結果は ``abs(a-b) <= max(rel_tol * max(abs(a), " +"abs(b)), abs_tol)`` です。" -#: ../../library/cmath.rst:278 msgid "" "*rel_tol* is the relative tolerance -- it is the maximum allowed difference " "between *a* and *b*, relative to the larger absolute value of *a* or *b*. " @@ -561,6 +540,12 @@ msgid "" "within about 9 decimal digits. *rel_tol* must be nonnegative and less than " "``1.0``." msgstr "" +"*rel_tol* は相対許容誤差です。\n" +"*a* と *b* の絶対値の大きい方に対する、両者の差の許容最大比率を表します。\n" +"例えば、5% の誤差を許容するには ``rel_tol=0.05`` を渡します。\n" +"デフォルトの許容誤差は ``1e-09`` で、2 つの値がおよそ 10 進 9 桁の精度で等し" +"いことを保証します。\n" +"*rel_tol* は非負で ``1.0`` 未満でなければなりません。" #: ../../library/cmath.rst:285 msgid "" @@ -585,7 +570,7 @@ msgstr "" #: ../../library/cmath.rst:300 msgid ":pep:`485` -- A function for testing approximate equality" -msgstr ":pep:`485` -- 近似的に等しいことを調べる関数" +msgstr ":pep:`485` -- A function for testing approximate equality" #: ../../library/cmath.rst:304 msgid "Constants" @@ -649,7 +634,6 @@ msgstr "" "可能な場合 (虚数部がゼロの複素数) でも、常に複素数を返すので注意してくださ" "い。" -#: ../../library/cmath.rst:364 msgid "" "A note on branch cuts: They are curves along which the given function fails " "to be continuous. They are a necessary feature of many complex functions. " @@ -659,12 +643,11 @@ msgid "" "choice of branch cuts for numerical purposes, a good reference should be the " "following:" msgstr "" -"分枝切断 (branch cut) に関する注釈: 分枝切断を持つ曲線上では、与えられた関数" -"は連続ではなくなります。これらは多くの複素関数における必然的な特性です。複素" -"関数を計算する必要がある場合、これらの分枝に関して理解しているものと仮定して" -"います。悟りに至るために何らかの (到底基礎的とはいえない) 複素数に関する書を" -"ひもといてください。数値計算を目的とした分枝切断の正しい選択方法についての情" -"報としては、以下がよい参考文献となります:" +"分枝切断 (branch cut) について: 分枝切断は、関数が連続でなくなる曲線で、多く" +"の複素関数に必要なものです。\n" +"複素関数を計算する場合、分枝切断を理解していることを前提とします。\n" +"詳しくは、初歩的すぎない複素関数の教科書を参照してください。\n" +"数値計算に適した分枝切断の選び方については、次の文献が参考になります。" #: ../../library/cmath.rst:374 msgid "" diff --git a/library/cmd.po b/library/cmd.po index 0fb70c975..b61387694 100644 --- a/library/cmd.po +++ b/library/cmd.po @@ -19,10 +19,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/cmd.rst:2 @@ -70,7 +70,6 @@ msgstr "" "トは :kbd:`Tab` です。 *completekey* が :const:`None` でなく、 :mod:" "`readline` が利用できるならば、コマンド補完は自動的に行われます。" -#: ../../library/cmd.rst:29 msgid "" "The default, ``'tab'``, is treated specially, so that it refers to the :kbd:" "`Tab` key on every :data:`readline.backend`. Specifically, if :data:" @@ -78,6 +77,12 @@ msgid "" "``'tab'``. Note that other values are not treated this way, and might only " "work with a specific backend." msgstr "" +"デフォルト値 ``'tab'`` は、すべての :data:`readline.backend` で :kbd:`Tab` " +"キーを指すように特別に扱われます。\n" +"具体的には、:data:`readline.backend` が ``editline`` の場合、``Cmd`` は " +"``'tab'`` の代わりに ``'^I'`` を使います。\n" +"他の値はこのようには扱われず、特定のバックエンドでしか機能しない可能性があり" +"ます。" #: ../../library/cmd.rst:36 msgid "" @@ -99,9 +104,10 @@ msgstr "" "引数に渡した *stdin* を使いたい場合は、インスタンスの :attr:`use_rawinput` 属" "性を ``False`` にセットしてください。そうしないと *stdin* は無視されます。" -#: ../../library/cmd.rst:45 msgid "``completekey='tab'`` is replaced by ``'^I'`` for ``editline``." msgstr "" +"``editline`` では ``completekey='tab'`` を ``'^I'`` に置き換えるようになりま" +"した。" #: ../../library/cmd.rst:52 msgid "Cmd Objects" @@ -147,7 +153,6 @@ msgstr "" msgid "An end-of-file on input is passed back as the string ``'EOF'``." msgstr "入力のファイル終端は、文字列 ``'EOF'`` として渡されます。" -#: ../../library/cmd.rst:78 msgid "" "An interpreter instance will recognize a command name ``foo`` if and only if " "it has a method :meth:`!do_foo`. As a special case, a line beginning with " @@ -155,15 +160,21 @@ msgid "" "another special case, a line beginning with the character ``'!'`` is " "dispatched to the method :meth:`!do_shell` (if such a method is defined)." msgstr "" +"インタープリタのインスタンスがコマンド名 ``foo`` を認識するのは、:meth:`!" +"do_foo` メソッドを持つ場合に限られます。\n" +"例外として、``'?'`` で始まる行は :meth:`do_help` メソッドに振り分けます。\n" +"また、``'!'`` で始まる行は :meth:`!do_shell` メソッドが定義されていれば、その" +"メソッドに振り分けます。" -#: ../../library/cmd.rst:84 msgid "" "This method will return when the :meth:`postcmd` method returns a true " "value. The *stop* argument to :meth:`postcmd` is the return value from the " "command's corresponding :meth:`!do_\\*` method." msgstr "" +"このメソッドは、:meth:`postcmd` メソッドが真の値を返すと終了します。\n" +":meth:`postcmd` の *stop* 引数は、コマンドに対応する :meth:`!do_\\*` メソッド" +"の戻り値です。" -#: ../../library/cmd.rst:88 msgid "" "If completion is enabled, completing commands will be done automatically, " "and completing of commands args is done by calling :meth:`!complete_foo` " @@ -174,8 +185,15 @@ msgid "" "could be used to provide different completion depending upon which position " "the argument is in." msgstr "" +"補完が有効な場合、コマンド名は自動的に補完します。\n" +"コマンドの引数の補完には、*text*、*line*、*begidx*、*endidx* を引数として :" +"meth:`!complete_foo` を呼び出します。\n" +"*text* はマッチさせる文字列の接頭辞で、返す候補はすべてこの文字列で始まらなけ" +"ればなりません。\n" +"*line* は先頭の空白を取り除いた現在の入力行です。\n" +"*begidx* と *endidx* は接頭辞のテキストの開始・終了インデックスで、引数の位置" +"に応じて補完内容を変えるために使えます。" -#: ../../library/cmd.rst:99 msgid "" "All subclasses of :class:`Cmd` inherit a predefined :meth:`!do_help`. This " "method, called with an argument ``'bar'``, invokes the corresponding method :" @@ -185,6 +203,17 @@ msgid "" "help_\\*` methods or commands that have docstrings), and also lists any " "undocumented commands." msgstr "" +":class:`Cmd` のすべてのサブクラスは、あらかじめ定義された :meth:`!do_help` を" +"継承します。\n" +"引数 ``'bar'`` を渡すと、対応する :meth:`!help_bar` メソッドを呼び出しま" +"す。\n" +"そのメソッドがなければ、:meth:`!do_bar` の docstring がある場合にそれを表示し" +"ます。\n" +"引数なしの場合、:meth:`!do_help` は利用可能なヘルプトピックをすべて表示しま" +"す。\n" +"つまり、対応する :meth:`!help_\\*` メソッドがあるコマンドや、docstring がある" +"コマンドの一覧です。\n" +"説明のないコマンドの一覧も表示します。" #: ../../library/cmd.rst:110 msgid "" @@ -214,18 +243,23 @@ msgstr "" "コマンドの先頭の語が認識されないときに、入力行に対して呼び出されます。このメ" "ソッドがオーバーライドされていないなら、エラーメッセージを表示して戻ります。" -#: ../../library/cmd.rst:133 msgid "" "Method called to complete an input line when no command-specific :meth:`!" "complete_\\*` method is available. By default, it returns an empty list." msgstr "" +"コマンド専用の :meth:`!complete_\\*` メソッドがない場合に、入力行を補完するた" +"めに呼び出されるメソッドです。\n" +"デフォルトでは空のリストを返します。" -#: ../../library/cmd.rst:139 msgid "" "Method called to display a list of strings as a compact set of columns. Each " "column is only as wide as necessary. Columns are separated by two spaces for " "readability." msgstr "" +"文字列のリストを、コンパクトな複数列の形式で表示するために呼び出されるメソッ" +"ドです。\n" +"各列の幅は必要な分だけ確保します。\n" +"読みやすくするため、列の間は 2 つのスペースで区切ります。" #: ../../library/cmd.rst:146 msgid "" @@ -307,13 +341,12 @@ msgstr "" "meth:`cmdloop` 内でチェックされます; これが空でない場合、その要素は、あたかも" "プロンプトから入力されたかのように順に処理されます。" -#: ../../library/cmd.rst:203 msgid "" "A string to issue as an intro or banner. May be overridden by giving the :" "meth:`cmdloop` method an argument." msgstr "" -"イントロあるいはバナーとして表示される文字列。 :meth:`cmdloop` メソッドに引数" -"を与えるために、オーバーライドされるかもしれません。" +"イントロやバナーとして表示する文字列です。\n" +":meth:`cmdloop` メソッドに引数を渡すと、この値を上書きできます。" #: ../../library/cmd.rst:209 msgid "" @@ -321,12 +354,15 @@ msgid "" msgstr "" "ヘルプ出力に文書化されたコマンドのセクションがある場合に表示するヘッダ。" -#: ../../library/cmd.rst:214 msgid "" "The header to issue if the help output has a section for miscellaneous help " "topics (that is, there are :meth:`!help_\\*` methods without corresponding :" "meth:`!do_\\*` methods)." msgstr "" +"ヘルプ出力にその他のヘルプトピックのセクションがある場合に表示する見出しで" +"す。\n" +"これは、対応する :meth:`!do_\\*` メソッドのない :meth:`!help_\\*` メソッドが" +"ある場合です。" #: ../../library/cmd.rst:221 msgid "" @@ -373,15 +409,17 @@ msgstr "" "この節では、:mod:`turtle` モジュールのいくつかのコマンドを持ったシェルの作成" "方法の簡単な例を示します。" -#: ../../library/cmd.rst:254 msgid "" "Basic turtle commands such as :meth:`~turtle.forward` are added to a :class:" "`Cmd` subclass with method named :meth:`!do_forward`. The argument is " "converted to a number and dispatched to the turtle module. The docstring is " "used in the help utility provided by the shell." msgstr "" +":meth:`~turtle.forward` などの基本的な turtle コマンドを、:meth:`!" +"do_forward` という名前のメソッドで :class:`Cmd` のサブクラスに追加します。\n" +"引数を数値に変換して turtle モジュールに渡します。\n" +"docstring はシェルのヘルプ機能で使われます。" -#: ../../library/cmd.rst:259 msgid "" "The example also includes a basic record and playback facility implemented " "with the :meth:`~Cmd.precmd` method which is responsible for converting the " @@ -389,6 +427,11 @@ msgid "" "do_playback` method reads the file and adds the recorded commands to the :" "attr:`~Cmd.cmdqueue` for immediate playback::" msgstr "" +"この例には、:meth:`~Cmd.precmd` メソッドで実装した簡単な記録・再生機能もあり" +"ます。\n" +"このメソッドは入力を小文字に変換し、コマンドをファイルに書き込みます。\n" +":meth:`!do_playback` メソッドはファイルを読み取り、記録されたコマンドを :" +"attr:`~Cmd.cmdqueue` に追加してすぐに再生します。 ::" #: ../../library/cmd.rst:265 msgid "" @@ -479,7 +522,6 @@ msgstr "" "以下は、turtle シェルでの機能のヘルプ表示、空行によるコマンドの繰り返し、単純" "な記録と再実行のセッション例です:" -#: ../../library/cmd.rst:343 msgid "" "Welcome to the turtle shell. Type help or ? to list commands.\n" "\n" @@ -539,14 +581,70 @@ msgid "" "(turtle) bye\n" "Thank you for using Turtle" msgstr "" +"Welcome to the turtle shell. Type help or ? to list commands.\n" +"\n" +"(turtle) ?\n" +"\n" +"Documented commands (type help ):\n" +"========================================\n" +"bye color goto home playback record right\n" +"circle forward heading left position reset undo\n" +"\n" +"(turtle) help forward\n" +"Move the turtle forward by the specified distance: FORWARD 10\n" +"(turtle) record spiral.cmd\n" +"(turtle) position\n" +"Current position is 0 0\n" +"\n" +"(turtle) heading\n" +"Current heading is 0\n" +"\n" +"(turtle) reset\n" +"(turtle) circle 20\n" +"(turtle) right 30\n" +"(turtle) circle 40\n" +"(turtle) right 30\n" +"(turtle) circle 60\n" +"(turtle) right 30\n" +"(turtle) circle 80\n" +"(turtle) right 30\n" +"(turtle) circle 100\n" +"(turtle) right 30\n" +"(turtle) circle 120\n" +"(turtle) right 30\n" +"(turtle) circle 120\n" +"(turtle) heading\n" +"Current heading is 180\n" +"\n" +"(turtle) forward 100\n" +"(turtle)\n" +"(turtle) right 90\n" +"(turtle) forward 100\n" +"(turtle)\n" +"(turtle) right 90\n" +"(turtle) forward 400\n" +"(turtle) right 90\n" +"(turtle) forward 500\n" +"(turtle) right 90\n" +"(turtle) forward 400\n" +"(turtle) right 90\n" +"(turtle) forward 300\n" +"(turtle) playback spiral.cmd\n" +"Current position is 0 0\n" +"\n" +"Current heading is 0\n" +"\n" +"Current heading is 180\n" +"\n" +"(turtle) bye\n" +"Thank you for using Turtle" #: ../../library/cmd.rst:74 msgid "? (question mark)" msgstr "? (クエスチョンマーク)" -#: ../../library/cmd.rst:74 msgid "in a command interpreter" -msgstr "" +msgstr "コマンドインタープリタでの使用" #: ../../library/cmd.rst:74 msgid "! (exclamation)" diff --git a/library/cmdline.po b/library/cmdline.po index 8ead94775..37fb20a5d 100644 --- a/library/cmdline.po +++ b/library/cmdline.po @@ -17,10 +17,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/cmdline.rst:5 @@ -63,9 +63,8 @@ msgstr ":mod:`cProfile`: :ref:`profile ` を参照" msgid ":ref:`dis `" msgstr ":ref:`dis `" -#: ../../library/cmdline.rst:17 msgid ":ref:`doctest `" -msgstr "" +msgstr ":ref:`doctest `" #: ../../library/cmdline.rst:18 msgid ":mod:`!encodings.rot_13`" @@ -103,29 +102,25 @@ msgstr ":mod:`!idlelib`" msgid ":ref:`inspect `" msgstr ":ref:`inspect `" -#: ../../library/cmdline.rst:27 msgid ":ref:`json `" -msgstr "" +msgstr ":ref:`json `" -#: ../../library/cmdline.rst:28 msgid ":ref:`mimetypes `" -msgstr "" +msgstr ":ref:`mimetypes `" #: ../../library/cmdline.rst:29 msgid ":mod:`pdb`" msgstr ":mod:`pdb`" -#: ../../library/cmdline.rst:30 msgid ":ref:`pickle `" -msgstr "" +msgstr ":ref:`pickle `" #: ../../library/cmdline.rst:31 msgid ":ref:`pickletools `" msgstr ":ref:`pickletools `" -#: ../../library/cmdline.rst:32 msgid ":ref:`platform `" -msgstr "" +msgstr ":ref:`platform `" #: ../../library/cmdline.rst:33 msgid ":mod:`poplib`" @@ -171,9 +166,8 @@ msgstr ":ref:`site `" msgid ":ref:`sqlite3 `" msgstr ":ref:`sqlite3 `" -#: ../../library/cmdline.rst:44 msgid ":ref:`symtable `" -msgstr "" +msgstr ":ref:`symtable `" #: ../../library/cmdline.rst:45 msgid ":ref:`sysconfig `" diff --git a/library/code.po b/library/code.po index bfb70af7d..21d183dd0 100644 --- a/library/code.po +++ b/library/code.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/code.rst:2 @@ -58,13 +58,16 @@ msgstr "" "``'__name__'`` が ``'__console__'`` に設定され、キー ``'__doc__'`` が " "``None`` に設定された新しく作られた辞書です。" -#: ../../library/code.rst:25 msgid "" "Note that functions and classes objects created under an :class:`!" "InteractiveInterpreter` instance will belong to the namespace specified by " "*locals*. They are only pickleable if *locals* is the namespace of an " "existing module." msgstr "" +":class:`!InteractiveInterpreter` インスタンスで作成した関数やクラスのオブジェ" +"クトは、*locals* で指定した名前空間に属します。\n" +"これらを pickle 化できるのは、*locals* が既存のモジュールの名前空間である場合" +"だけです。" #: ../../library/code.rst:34 msgid "" @@ -226,7 +229,6 @@ msgstr "" "る可能性がありますし、常に捕らえることができるとは限りません。呼び出し側はそ" "れを処理するために準備しておくべきです。" -#: ../../library/code.rst:123 msgid "" "Display the syntax error that just occurred. This does not display a stack " "trace because there isn't one for syntax errors. If *filename* is given, it " @@ -234,11 +236,13 @@ msgid "" "Python's parser, because it always uses ``''`` when reading from a " "string. The output is written by the :meth:`write` method." msgstr "" -"起きたばかりの構文エラーを表示します。複数の構文エラーに対して一つあるのでは" -"ないため、これはスタックトレースを表示しません。 *filename* が与えられた場合" -"は、Pythonのパーサが与えるデフォルトのファイル名の代わりに例外の中へ入れられ" -"ます。なぜなら、文字列から読み込んでいるときはパーサは常に ``''`` を" -"使うからです。出力は :meth:`write` メソッドによって書き込まれます。" +"起きたばかりの構文エラーを表示します。\n" +"構文エラーにはスタックトレースがないため、スタックトレースは表示しません。\n" +"*filename* を指定すると、Python のパーサーが提供するデフォルトのファイル名の" +"代わりに、その値を例外に設定します。\n" +"これは、文字列から読み込む場合にパーサーが常に ``''`` を使うためで" +"す。\n" +"出力は :meth:`write` メソッドで書き込まれます。" #: ../../library/code.rst:132 msgid "" @@ -313,7 +317,6 @@ msgstr "バナーの表示を抑制するには、空の文字列を渡してく msgid "Print an exit message when exiting." msgstr "終了時に、終了メッセージを表示します。" -#: ../../library/code.rst:177 msgid "" "Push a line of source text to the interpreter. The line should not have a " "trailing newline; it may have internal newlines. The line is appended to a " @@ -325,14 +328,18 @@ msgid "" "is required, ``False`` if the line was dealt with in some way (this is the " "same as :meth:`!runsource`)." msgstr "" -"ソーステキストの一行をインタープリターへ送ります。その行の末尾に改行がついて" -"いてはいけません。内部に改行を持っているかもしれません。その行はバッファへ追" -"加され、ソースとして連結されたバッファの内容が渡されインタープリターの :meth:" -"`~InteractiveInterpreter.runsource` メソッドが呼び出されます。コマンドが実行" -"されたか、有効であることをこれが示している場合は、バッファはリセットされま" -"す。そうでなければ、コマンドが不完全で、その行が付加された後のままバッファは" -"残されます。さらに入力が必要ならば、戻り値は ``True`` です。その行がある方法" -"で処理されたならば、 ``False`` です(これは :meth:`!runsource` と同じです)。" +"ソーステキストの1行をインタープリターへ送ります。\n" +"``line`` の末尾に改行を含めてはいけませんが、内部には含められます。\n" +"その行はバッファに追加され、バッファの内容を連結したものをソースとして、\n" +"インタープリターの :meth:`~InteractiveInterpreter.runsource` メソッドが呼び出" +"されます。\n" +"この呼び出しの結果が、コマンドが実行されたか無効だったことを示す場合、バッ" +"ファはリセットされます。\n" +"そうでない場合、コマンドは不完全なので、その行を追加した後のバッファがそのま" +"ま保持されます。\n" +"さらに入力が必要な場合は ``True`` を返し、その行が何らかの形で処理された場合" +"は ``False`` を返します\n" +"(これは :meth:`!runsource` と同じです)。" #: ../../library/code.rst:189 msgid "Remove any unhandled source text from the input buffer." diff --git a/library/codecs.po b/library/codecs.po index 969b37acc..9719bd8c6 100644 --- a/library/codecs.po +++ b/library/codecs.po @@ -25,10 +25,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/codecs.rst:2 @@ -274,11 +274,12 @@ msgstr "" msgid "Hyphens and spaces are converted to underscore." msgstr "" -#: ../../library/codecs.rst:173 msgid "" "Unregister a codec search function and clear the registry's cache. If the " "search function is not registered, do nothing." msgstr "" +"codec 検索関数の登録を解除し、レジストリのキャッシュを消去します。\n" +"検索関数が登録されていなければ何もしません。" #: ../../library/codecs.rst:179 msgid "" @@ -335,19 +336,19 @@ msgstr "" "は ``'strict'`` で、エンコード時にエラーがあれば :exc:`ValueError` を送出しま" "す。" -#: ../../library/codecs.rst:205 msgid "" "*buffering* has the same meaning as for the built-in :func:`open` function. " "It defaults to -1 which means that the default buffer size will be used." msgstr "" +"*buffering* は組み込み関数 :func:`open` の引数と同じ意味です。\n" +"デフォルトは -1 で、デフォルトのバッファサイズを使うことを意味します。" #: ../../library/codecs.rst:208 msgid "The ``'U'`` mode has been removed." msgstr "``'U'`` モードは削除されました。" -#: ../../library/codecs.rst:213 msgid ":func:`codecs.open` has been superseded by :func:`open`." -msgstr "" +msgstr ":func:`codecs.open` は :func:`open` に置き換えられました。" #: ../../library/codecs.rst:218 msgid "" @@ -421,17 +422,17 @@ msgstr "" "ゆるキーワード引数と同様に) インクリメンタル・デコーダにそのまま引き渡されま" "す。" -#: ../../library/codecs.rst:254 msgid "" "This function requires that the codec accept :class:`bytes` objects to " "decode. Therefore it does not support text-to-text encoders such as " "``rot_13``, although ``rot_13`` may be used equivalently with :func:" "`iterencode`." msgstr "" -"この関数では、コーデックはエンコードする :class:`bytes` オブジェクトを受け付" -"ける必要があります。\n" -"従って、 ``rot_13`` のようなテキストからテキストへのエンコーダが :func:" -"`iterencode` で同等に使えるとしても、この関数ではサポートしていません。" +"この関数では、コーデックはデコードする :class:`bytes` オブジェクトを受け付け" +"る必要があります。\n" +"従って、``rot_13`` のようなテキストからテキストへのエンコーダはサポートしませ" +"んが、\n" +"``rot_13`` は :func:`iterencode` で同じように使えます。" #: ../../library/codecs.rst:260 msgid "" @@ -502,11 +503,12 @@ msgstr "" "エラー処理の簡便化と標準化のため、コーデックは、*errors* 文字列引数を指定した" "場合に別のエラー処理を行うような仕組みを実装してもかまいません\\:" -#: ../../library/codecs.rst:328 msgid "" "The following error handlers can be used with all Python :ref:`standard-" "encodings` codecs:" msgstr "" +"次のエラーハンドラは、Python のすべての :ref:`standard-encodings` の codec で" +"使えます。" #: ../../library/codecs.rst:334 ../../library/codecs.rst:377 #: ../../library/codecs.rst:397 @@ -547,24 +549,31 @@ msgstr "" msgid "``'replace'``" msgstr "``'replace'``" -#: ../../library/codecs.rst:344 msgid "" "Replace with a replacement marker. On encoding, use ``?`` (ASCII character). " "On decoding, use ``�`` (U+FFFD, the official REPLACEMENT CHARACTER). " "Implemented in :func:`replace_errors`." msgstr "" +"代替の文字に置き換えます。\n" +"エンコード時は ASCII 文字の ``?``、デコード時は ``�`` (U+FFFD、正式名称 " +"REPLACEMENT CHARACTER) を使います。\n" +":func:`replace_errors` に実装されています。" #: ../../library/codecs.rst:350 msgid "``'backslashreplace'``" msgstr "``'backslashreplace'``" -#: ../../library/codecs.rst:350 msgid "" "Replace with backslashed escape sequences. On encoding, use hexadecimal form " "of Unicode code point with formats :samp:`\\\\x{hh}` :samp:`\\\\u{xxxx}` :" "samp:`\\\\U{xxxxxxxx}`. On decoding, use hexadecimal form of byte value with " "format :samp:`\\\\x{hh}`. Implemented in :func:`backslashreplace_errors`." msgstr "" +"バックスラッシュによるエスケープシーケンスに置き換えます。\n" +"エンコード時は、Unicode コードポイントを :samp:`\\\\x{hh}`、:samp:`\\" +"\\u{xxxx}`、:samp:`\\\\U{xxxxxxxx}` の形式の 16 進表現にします。\n" +"デコード時は、バイト値を :samp:`\\\\x{hh}` の形式の 16 進表現にします。\n" +":func:`backslashreplace_errors` に実装されています。" #: ../../library/codecs.rst:359 msgid "``'surrogateescape'``" @@ -582,33 +591,38 @@ msgstr "" "ンドラが使用されると、このコードは同じバイト列に戻されます。 (詳しくは :pep:" "`383` を参照。)" -#: ../../library/codecs.rst:373 msgid "" "The following error handlers are only applicable to encoding (within :term:" "`text encodings `):" msgstr "" +"次のエラーハンドラは、:term:`テキストエンコーディング ` のエン" +"コード時にのみ使えます。" #: ../../library/codecs.rst:379 msgid "``'xmlcharrefreplace'``" msgstr "``'xmlcharrefreplace'``" -#: ../../library/codecs.rst:379 msgid "" "Replace with XML/HTML numeric character reference, which is a decimal form " "of Unicode code point with format :samp:`&#{num};`. Implemented in :func:" "`xmlcharrefreplace_errors`." msgstr "" +"Unicode コードポイントを :samp:`&#{num};` の形式で 10 進数で表した、XML/HTML " +"の数値文字参照に置き換えます。\n" +":func:`xmlcharrefreplace_errors` に実装されています。" #: ../../library/codecs.rst:385 msgid "``'namereplace'``" msgstr "``'namereplace'``" -#: ../../library/codecs.rst:385 msgid "" "Replace with ``\\N{...}`` escape sequences, what appears in the braces is " "the Name property from Unicode Character Database. Implemented in :func:" "`namereplace_errors`." msgstr "" +"``\\N{...}`` のエスケープシーケンスに置き換えます。\n" +"波括弧の中には Unicode 文字データベースの Name プロパティを使います。\n" +":func:`namereplace_errors` に実装されています。" #: ../../library/codecs.rst:394 msgid "" @@ -627,32 +641,36 @@ msgstr "``'surrogatepass'``" msgid "utf-8, utf-16, utf-32, utf-16-be, utf-16-le, utf-32-be, utf-32-le" msgstr "utf-8, utf-16, utf-32, utf-16-be, utf-16-le, utf-32-be, utf-32-le" -#: ../../library/codecs.rst:399 msgid "" "Allow encoding and decoding surrogate code point (``U+D800`` - ``U+DFFF``) " "as normal code point. Otherwise these codecs treat the presence of surrogate " "code point in :class:`str` as an error." msgstr "" +"サロゲートコードポイント (``U+D800``~``U+DFFF``) を通常のコードポイントとし" +"てエンコード・デコードできるようにします。\n" +"この指定がなければ、これらの codec は :class:`str` にサロゲートコードポイント" +"が含まれているとエラーとして扱います。" #: ../../library/codecs.rst:406 msgid "The ``'surrogateescape'`` and ``'surrogatepass'`` error handlers." msgstr "``'surrogateescape'`` および ``'surrogatepass'`` エラーハンドラ。" -#: ../../library/codecs.rst:409 msgid "" "The ``'surrogatepass'`` error handler now works with utf-16\\* and utf-32\\* " "codecs." msgstr "" +"``'surrogatepass'`` エラーハンドラが utf-16\\* と utf-32\\* の codec でも使え" +"るようになりました。" #: ../../library/codecs.rst:413 msgid "The ``'namereplace'`` error handler." msgstr "``'namereplace'`` エラーハンドラです。" -#: ../../library/codecs.rst:416 msgid "" "The ``'backslashreplace'`` error handler now works with decoding and " "translating." msgstr "" +"``'backslashreplace'`` エラーハンドラがデコードと文字変換にも対応しました。" #: ../../library/codecs.rst:420 msgid "" @@ -697,15 +715,14 @@ msgstr "" "対位置として扱われます。境界の外側にある位置を返した場合には :exc:" "`IndexError` が送出されます。" -#: ../../library/codecs.rst:441 msgid "" "Decoding and translating works similarly, except :exc:`UnicodeDecodeError` " "or :exc:`UnicodeTranslateError` will be passed to the handler and that the " "replacement from the error handler will be put into the output directly." msgstr "" -"デコードと翻訳の動作は似ていますが、エラーハンドラに渡されるのが :exc:" -"`UnicodeDecodeError` か :exc:`UnicodeTranslateError` である点と、エラーハンド" -"ラの置換した内容が直接出力されるという点が異なります。" +"デコードと文字変換も同様に動作しますが、ハンドラには :exc:" +"`UnicodeDecodeError` または :exc:`UnicodeTranslateError` が渡されます。\n" +"また、エラーハンドラが返す置換内容は、そのまま出力に入れられます。" #: ../../library/codecs.rst:446 msgid "" @@ -729,76 +746,84 @@ msgid "" "level functions:" msgstr "以下の標準エラーハンドラも、モジュールレベルの関数として利用できます。" -#: ../../library/codecs.rst:460 msgid "Implements the ``'strict'`` error handling." -msgstr "" +msgstr "``'strict'`` エラー処理を実装します。" -#: ../../library/codecs.rst:462 msgid "Each encoding or decoding error raises a :exc:`UnicodeError`." msgstr "" +"エンコードまたはデコードのエラーごとに :exc:`UnicodeError` を送出します。" -#: ../../library/codecs.rst:467 msgid "Implements the ``'ignore'`` error handling." -msgstr "" +msgstr "``'ignore'`` エラー処理を実装します。" -#: ../../library/codecs.rst:469 msgid "" "Malformed data is ignored; encoding or decoding is continued without further " "notice." msgstr "" +"不正な形式のデータを無視し、通知せずにエンコードまたはデコードを続けます。" -#: ../../library/codecs.rst:475 msgid "Implements the ``'replace'`` error handling." -msgstr "" +msgstr "``'replace'`` エラー処理を実装します。" -#: ../../library/codecs.rst:477 msgid "" "Substitutes ``?`` (ASCII character) for encoding errors or ``�`` (U+FFFD, " "the official REPLACEMENT CHARACTER) for decoding errors." msgstr "" +"エンコードエラーでは ASCII 文字の ``?``、デコードエラーでは ``�`` (U+FFFD、正" +"式名称 REPLACEMENT CHARACTER) に置き換えます。" -#: ../../library/codecs.rst:483 msgid "Implements the ``'backslashreplace'`` error handling." -msgstr "" +msgstr "``'backslashreplace'`` エラー処理を実装します。" -#: ../../library/codecs.rst:485 msgid "" "Malformed data is replaced by a backslashed escape sequence. On encoding, " "use the hexadecimal form of Unicode code point with formats :samp:`\\\\x{hh}" "` :samp:`\\\\u{xxxx}` :samp:`\\\\U{xxxxxxxx}`. On decoding, use the " "hexadecimal form of byte value with format :samp:`\\\\x{hh}`." msgstr "" +"不正な形式のデータを、バックスラッシュによるエスケープシーケンスに置き換えま" +"す。\n" +"エンコード時は、Unicode コードポイントを :samp:`\\\\x{hh}`、:samp:`\\" +"\\u{xxxx}`、:samp:`\\\\U{xxxxxxxx}` の形式の 16 進表現にします。\n" +"デコード時は、バイト値を :samp:`\\\\x{hh}` の形式の 16 進表現にします。" -#: ../../library/codecs.rst:491 msgid "Works with decoding and translating." -msgstr "" +msgstr "デコードと文字変換にも対応しました。" -#: ../../library/codecs.rst:497 msgid "" "Implements the ``'xmlcharrefreplace'`` error handling (for encoding within :" "term:`text encoding` only)." msgstr "" +"``'xmlcharrefreplace'`` エラー処理を実装します (:term:`テキストエンコーディン" +"グ ` のエンコード時のみ)。" -#: ../../library/codecs.rst:500 msgid "" "The unencodable character is replaced by an appropriate XML/HTML numeric " "character reference, which is a decimal form of Unicode code point with " "format :samp:`&#{num};` ." msgstr "" +"エンコードできない文字を、対応する XML/HTML の数値文字参照に置き換えます。\n" +"これは Unicode コードポイントを :samp:`&#{num};` の形式で 10 進数で表したもの" +"です。" -#: ../../library/codecs.rst:507 msgid "" "Implements the ``'namereplace'`` error handling (for encoding within :term:" "`text encoding` only)." msgstr "" +"``'namereplace'`` エラー処理を実装します (:term:`テキストエンコーディング " +"` のエンコード時のみ)。" -#: ../../library/codecs.rst:510 msgid "" "The unencodable character is replaced by a ``\\N{...}`` escape sequence. The " "set of characters that appear in the braces is the Name property from " "Unicode Character Database. For example, the German lowercase letter ``'ß'`` " "will be converted to byte sequence ``\\N{LATIN SMALL LETTER SHARP S}`` ." msgstr "" +"エンコードできない文字を ``\\N{...}`` のエスケープシーケンスに置き換えま" +"す。\n" +"波括弧の中には Unicode 文字データベースの Name プロパティを使います。\n" +"例えば、ドイツ語の小文字 ``'ß'`` はバイト列 ``\\N{LATIN SMALL LETTER SHARP S}" +"`` に変換されます。" #: ../../library/codecs.rst:521 msgid "Stateless Encoding and Decoding" @@ -1125,12 +1150,15 @@ msgstr "" msgid "Stream Encoding and Decoding" msgstr "ストリームのエンコードとデコード" -#: ../../library/codecs.rst:712 msgid "" "The :class:`StreamWriter` and :class:`StreamReader` classes provide generic " "working interfaces which can be used to implement new encoding submodules " "very easily. See :mod:`!encodings.utf_8` for an example of how this is done." msgstr "" +":class:`StreamWriter` クラスと :class:`StreamReader` クラスは、汎用的な動作イ" +"ンターフェースを提供し、新しいエンコーディングのサブモジュールを簡単に実装で" +"きるようにします。\n" +"実装例は :mod:`!encodings.utf_8` を参照してください。" #: ../../library/codecs.rst:720 msgid "StreamWriter Objects" @@ -1192,12 +1220,15 @@ msgstr "" msgid "Writes the object's contents encoded to the stream." msgstr "*object* の内容をエンコードしてストリームに書き出します。" -#: ../../library/codecs.rst:753 msgid "" "Writes the concatenated iterable of strings to the stream (possibly by " "reusing the :meth:`write` method). Infinite or very large iterables are not " "supported. The standard bytes-to-bytes codecs do not support this method." msgstr "" +"文字列のイテラブルの内容を連結してストリームに書き込みます (:meth:`write` メ" +"ソッドを再利用する場合もあります)。\n" +"無限のイテラブルや非常に大きいイテラブルはサポートしません。\n" +"標準のバイト列からバイト列への codec では、このメソッドをサポートしません。" #: ../../library/codecs.rst:761 ../../library/codecs.rst:856 msgid "Resets the codec buffers used for keeping internal state." @@ -1289,18 +1320,16 @@ msgid "Decodes data from the stream and returns the resulting object." msgstr "" "ストリームからのデータをデコードし、デコード済のオブジェクトを返します。" -#: ../../library/codecs.rst:809 msgid "" "The *chars* argument indicates the number of decoded code points or bytes to " "return. The :func:`read` method will never return more data than requested, " "but it might return less, if there is not enough available." msgstr "" -"*chars* 引数は、いくつのデコードされたコードポイントまたはバイト列を返すかを" -"表します。 :func:`read` メソッドは、要求された数以上のデータを返すことはあり" -"ませんが、データがそれより少ない場合には要求された数未満のデータを返す場合が" -"あります。" +"*chars* 引数は、デコードして返すコードポイント数またはバイト数を指定しま" +"す。\n" +":func:`read` メソッドは要求された量を超えるデータを返すことはありません。\n" +"利用できるデータが足りない場合は、それより少ない量を返すことがあります。" -#: ../../library/codecs.rst:814 msgid "" "The *size* argument indicates the approximate maximum number of encoded " "bytes or code points to read for decoding. The decoder can modify this " @@ -1308,10 +1337,12 @@ msgid "" "much as possible. This parameter is intended to prevent having to decode " "huge files in one step." msgstr "" -"*size* 引数は、デコード用に読み込むエンコードされたバイト列またはコードポイン" -"トの、およその最大バイト数を表します。デコーダはこの値を適切な値に変更できま" -"す。デフォルト値 -1 の場合、可能な限り多くのデータを読み込みます。この引数の" -"目的は、巨大なファイルの一括デコードを防ぐことにあります。" +"*size* 引数は、デコードのために読み込むエンコード済みデータの、およその最大バ" +"イト数または最大コードポイント数を指定します。\n" +"デコーダは必要に応じてこの設定を変更できます。\n" +"デフォルト値 -1 は、可能な限り多く読み込んでデコードすることを意味します。\n" +"このパラメーターは、巨大なファイルを一度にデコードせずに済むようにするための" +"ものです。" #: ../../library/codecs.rst:821 msgid "" @@ -1444,13 +1475,17 @@ msgstr "" ":class:`StreamRecoder` はデータをあるエンコーディングから別のエンコーディング" "に変換します。異なるエンコーディング環境を扱うとき、便利な場合があります。" -#: ../../library/codecs.rst:903 msgid "" "Creates a :class:`StreamRecoder` instance which implements a two-way " "conversion: *encode* and *decode* work on the frontend — the data visible to " "code calling :meth:`~StreamReader.read` and :meth:`~StreamWriter.write`, " "while *Reader* and *Writer* work on the backend — the data in *stream*." msgstr "" +"双方向の変換を行う :class:`StreamRecoder` インスタンスを作成します。\n" +"*encode* と *decode* はフロントエンド、つまり :meth:`~StreamReader.read` や :" +"meth:`~StreamWriter.write` を呼び出すコードから見えるデータを扱います。\n" +"一方、*Reader* と *Writer* はバックエンド、つまり *stream* 内のデータを扱いま" +"す。" #: ../../library/codecs.rst:909 msgid "" @@ -1519,10 +1554,9 @@ msgstr "" "また、バイト列から文字列オブジェクトを再生成することは *デコード* と呼ばれま" "す。\n" "テキストをシリアライズするコーデックには多くの種類があります。\n" -"それらは、集合的に term:`テキストエンコーディング ` と呼ばれま" -"す。" +"それらは、集合的に :term:`テキストエンコーディング ` と呼ばれ" +"ます。" -#: ../../library/codecs.rst:943 msgid "" "The simplest text encoding (called ``'latin-1'`` or ``'iso-8859-1'``) maps " "the code points 0--255 to the bytes ``0x0``--``0xff``, which means that a " @@ -1535,12 +1569,13 @@ msgstr "" "最も単純なテキストエンコーディング (``'latin-1'`` または ``'iso-8859-1'``) で" "は、0--255 の範囲にあるコードポイントを ``0x0``--``0xff`` のバイトにマップし" "ます。\n" -"つまり、この codec では ``U+00FF`` 以上のコードポイントを含む文字列オブジェク" -"トをエンコードすることはできません。\n" +"つまり、この codec では ``U+00FF`` より大きいのコードポイントを含む文字列オブ" +"ジェクトをエンコードすることはできません。\n" "このようなエンコード処理をしようとすると、次のように :exc:" -"`UnicodeEncodeError` が送出されます (エラーメッセージの細かところは異なる場合" -"があります。): ``UnicodeEncodeError: 'latin-1' codec can't encode character " -"'\\u1234' in position 3: ordinal not in range(256)`` 。" +"`UnicodeEncodeError` が送出されます (エラーメッセージの細かいところは異なる場" +"合があります。\n" +"): ``UnicodeEncodeError: 'latin-1' codec can't encode character '\\u1234' in " +"position 3: ordinal not in range(256)`` 。" #: ../../library/codecs.rst:951 msgid "" @@ -1725,7 +1760,6 @@ msgstr "RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK" msgid "INVERTED QUESTION MARK" msgstr "INVERTED QUESTION MARK" -#: ../../library/codecs.rst:1026 msgid "" "in iso-8859-1), this increases the probability that a ``utf-8-sig`` encoding " "can be correctly guessed from the byte sequence. So here the BOM is not used " @@ -1736,13 +1770,16 @@ msgid "" "three bytes if they appear as the first three bytes in the file. In UTF-8, " "the use of the BOM is discouraged and should generally be avoided." msgstr "" -"のようになる)ので、``utf-8-sig`` エンコーディングがバイト列から正しく推測され" -"る確率を高めます。つまりここでは BOM はバイト列を生成する際のバイト順を決定で" -"きるように使われているのではなく、エンコーディングを推測する助けになる印とし" -"て使われているのです。``utf-8-sig`` codec はエンコーディングの際ファイルに最" -"初の3文字として ``0xef``, ``0xbb``, ``0xbf`` を書き込みます。デコーディングの" -"際はファイルの先頭に現れたこれら3バイトはスキップします。UTF-8 では BOM の使" -"用は推奨されておらず、一般的には避けるべきです。" +"に対応します)。\n" +"このため、バイト列から ``utf-8-sig`` エンコーディングを正しく推測できる確率が" +"高まります。\n" +"ここで BOM はバイト順を判定するためではなく、エンコーディングの推測を助ける印" +"として使われます。\n" +"``utf-8-sig`` codec は、エンコード時にファイルの最初の 3 バイトとして " +"``0xef``、``0xbb``、``0xbf`` を書き込みます。\n" +"デコード時は、これらがファイルの最初の 3 バイトに現れた場合にスキップしま" +"す。\n" +"UTF-8 での BOM の使用は推奨されず、通常は避けてください。" #: ../../library/codecs.rst:1039 msgid "Standard Encodings" @@ -1774,7 +1811,6 @@ msgid "" "platforms." msgstr "" -#: ../../library/codecs.rst:1055 msgid "" "Some common encodings can bypass the codecs lookup machinery to improve " "performance. These optimization opportunities are only recognized by CPython " @@ -1789,8 +1825,8 @@ msgstr "" "別しない) 別名に対してのみです: utf-8, utf8, latin-1, latin1, iso-8859-1, " "iso8859-1, mbcs (Windows のみ), ascii, us-ascii, utf-16, utf16, utf-32, " "utf32 およびダッシュの代わりにアンダースコアを用いたもの。\n" -"これらのエンコーディングの別のつづりを使用すると実行時間の低下を招くかもしれ" -"ません。" +"これらのエンコーディングの別のつづりを使用すると実行が遅くなることがありま" +"す。" #: ../../library/codecs.rst:1063 msgid "Optimization opportunity recognized for us-ascii." @@ -1959,10 +1995,8 @@ msgstr "cp775" msgid "IBM775" msgstr "IBM775" -#: ../../library/codecs.rst:1108 ../../library/codecs.rst:1175 -#: ../../library/codecs.rst:1225 ../../library/codecs.rst:1242 msgid "Baltic languages" -msgstr "バルト沿岸国" +msgstr "バルト諸語" #: ../../library/codecs.rst:1110 msgid "cp850" @@ -1993,10 +2027,8 @@ msgstr "cp855" msgid "855, IBM855" msgstr "855, IBM855" -#: ../../library/codecs.rst:1114 ../../library/codecs.rst:1162 -#: ../../library/codecs.rst:1227 ../../library/codecs.rst:1264 msgid "Belarusian, Bulgarian, Macedonian, Russian, Serbian" -msgstr "" +msgstr "ベラルーシ語、ブルガリア語、マケドニア語、ロシア語、セルビア語" #: ../../library/codecs.rst:1117 msgid "cp856" @@ -2084,9 +2116,8 @@ msgstr "cp865" msgid "865, IBM865" msgstr "865, IBM865" -#: ../../library/codecs.rst:1133 msgid "Danish, Norwegian" -msgstr "デンマーク、ノルウェー" +msgstr "デンマーク語、ノルウェー語" #: ../../library/codecs.rst:1135 msgid "cp866" @@ -2124,9 +2155,8 @@ msgstr "cp875" msgid "cp932" msgstr "cp932" -#: ../../library/codecs.rst:1143 msgid "932, ms932, mskanji, ms-kanji, windows-31j" -msgstr "" +msgstr "932, ms932, mskanji, ms-kanji, windows-31j" #: ../../library/codecs.rst:1143 ../../library/codecs.rst:1179 #: ../../library/codecs.rst:1181 ../../library/codecs.rst:1183 @@ -2162,9 +2192,8 @@ msgstr "950, ms950" msgid "cp1006" msgstr "cp1006" -#: ../../library/codecs.rst:1150 msgid "Urdu" -msgstr "Urdu" +msgstr "ウルドゥー語" #: ../../library/codecs.rst:1152 msgid "cp1026" @@ -2266,9 +2295,8 @@ msgstr "cp1258" msgid "windows-1258" msgstr "windows-1258" -#: ../../library/codecs.rst:1177 msgid "Vietnamese" -msgstr "ベトナム" +msgstr "ベトナム語" #: ../../library/codecs.rst:1179 msgid "euc_jp" @@ -2430,9 +2458,8 @@ msgstr "iso8859_3" msgid "iso-8859-3, latin3, L3" msgstr "iso-8859-3, latin3, L3" -#: ../../library/codecs.rst:1223 msgid "Esperanto, Maltese" -msgstr "エスペラント、マルタ" +msgstr "エスペラント、マルタ語" #: ../../library/codecs.rst:1225 msgid "iso8859_4" @@ -2562,9 +2589,8 @@ msgstr "koi8_r" msgid "koi8_t" msgstr "koi8_t" -#: ../../library/codecs.rst:1254 msgid "Tajik" -msgstr "タジク" +msgstr "タジク語" #: ../../library/codecs.rst:1258 msgid "koi8_u" @@ -2578,9 +2604,8 @@ msgstr "kz1048" msgid "kz_1048, strk1048_2002, rk1048" msgstr "kz_1048, strk1048_2002, rk1048" -#: ../../library/codecs.rst:1260 ../../library/codecs.rst:1278 msgid "Kazakh" -msgstr "カザフ" +msgstr "カザフ語" #: ../../library/codecs.rst:1264 msgid "mac_cyrillic" @@ -2610,9 +2635,8 @@ msgstr "maciceland" msgid "mac_latin2" msgstr "mac_latin2" -#: ../../library/codecs.rst:1271 msgid "maclatin2, maccentraleurope, mac_centeuro" -msgstr "" +msgstr "maclatin2, maccentraleurope, mac_centeuro" #: ../../library/codecs.rst:1274 msgid "mac_roman" @@ -2730,9 +2754,8 @@ msgstr "U7, unicode-1-1-utf-7" msgid "utf_8" msgstr "utf_8" -#: ../../library/codecs.rst:1304 msgid "U8, UTF, utf8, cp65001" -msgstr "" +msgstr "U8, UTF, utf8, cp65001" #: ../../library/codecs.rst:1306 msgid "utf_8_sig" @@ -2748,13 +2771,13 @@ msgstr "" "``U+DFFF``) がエンコードされることを許可しなくなりました。utf-32\\* デコーダ" "は、サロゲートコードポイントに対応するバイト列をデコードしなくなりました。" -#: ../../library/codecs.rst:1315 msgid "``cp65001`` is now an alias to ``utf_8``." -msgstr "" +msgstr "``cp65001`` は ``utf_8`` の別名になりました。" -#: ../../library/codecs.rst:1318 msgid "On Windows, ``cpXXX`` codecs are now available for all code pages." msgstr "" +"Windows では、すべてのコードページに対して ``cpXXX`` codec を利用できるように" +"なりました。" #: ../../library/codecs.rst:1323 msgid "Python Specific Encodings" @@ -2849,12 +2872,15 @@ msgstr ":rfc:`3492` の実装です。ステートフル codecs は、サポー msgid "raw_unicode_escape" msgstr "raw_unicode_escape" -#: ../../library/codecs.rst:1366 msgid "" "Latin-1 encoding with :samp:`\\\\u{XXXX}` and :samp:`\\\\U{XXXXXXXX}` for " "other code points. Existing backslashes are not escaped in any way. It is " "used in the Python pickle protocol." msgstr "" +"Latin-1 エンコーディングを使い、その範囲外のコードポイントを :samp:`\\" +"\\u{XXXX}` と :samp:`\\\\U{XXXXXXXX}` で表します。\n" +"既存のバックスラッシュはエスケープしません。\n" +"Python の pickle プロトコルで使われています。" #: ../../library/codecs.rst:1376 msgid "undefined" @@ -2883,9 +2909,8 @@ msgstr "" "ドからデコードします。実際には、Python のソースコードはデフォルトでは UTF-8 " "を使用することに注意してください。" -#: ../../library/codecs.rst:1393 msgid "\"unicode_internal\" codec is removed." -msgstr "" +msgstr "\"unicode_internal\" codec は削除されました。" #: ../../library/codecs.rst:1400 msgid "Binary Transforms" @@ -3089,11 +3114,12 @@ msgstr "" "ています。このモジュールは ``punycode`` エンコーディングおよび :mod:" "`stringprep` の上に構築されています。" -#: ../../library/codecs.rst:1491 msgid "" "If you need the IDNA 2008 standard from :rfc:`5891` and :rfc:`5895`, use the " "third-party :pypi:`idna` module." msgstr "" +":rfc:`5891` と :rfc:`5895` の IDNA 2008 規格が必要な場合は、サードパーティー" +"の :pypi:`idna` モジュールを使ってください。" #: ../../library/codecs.rst:1494 msgid "" @@ -3141,8 +3167,8 @@ msgstr "" "ベルを要求通りに ACE に変換します。逆に、入力のバイト文字列を ``.`` 区切り文" "字でラベルに分解し、 ACE ラベルを Unicode に変換します。さらに、 :mod:" "`socket` モジュールは Unicode ホスト名を ACE に透過的に変換するため、アプリ" -"ケーションはホスト名を :mod:`socket` モジュールに渡す際にホスト名の変換に煩わ" -"されることがありません。その上で、ホスト名を関数パラメタとして持つ、 :mod:" +"ケーションはホスト名を ``socket`` モジュールに渡す際にホスト名の変換に煩わさ" +"れることがありません。その上で、ホスト名を関数パラメタとして持つ、 :mod:" "`http.client` や :mod:`ftplib` のようなモジュールでは Unicode ホスト名を受理" "します (:mod:`http.client` でもまた、 :mailheader:`Host` フィールドにある " "IDNA ホスト名を、フィールド全体を送信する場合に透過的に送信します)。" @@ -3193,21 +3219,18 @@ msgstr ":rfc:`3490` 仕様に従ってラベルを Unicode に変換します。 msgid ":mod:`encodings.mbcs` --- Windows ANSI codepage" msgstr ":mod:`encodings.mbcs` --- Windows ANSI コードページ" -#: ../../library/codecs.rst:1551 msgid "This module implements the ANSI codepage (CP_ACP)." -msgstr "" +msgstr "このモジュールは ANSI コードページ (CP_ACP) を実装しています。" -#: ../../library/codecs.rst:1553 msgid "Availability" -msgstr "" +msgstr "利用可能な環境" -#: ../../library/codecs.rst:1555 msgid "" "Before 3.2, the *errors* argument was ignored; ``'replace'`` was always used " "to encode, and ``'ignore'`` to decode." msgstr "" -"3.2 以前は *errors* 引数は無視されました; エンコードには常に ``'replace'`` " -"が、デコードには ``'ignore'`` が使われました。" +"3.2 より前は *errors* 引数が無視され、エンコードには常に ``'replace'``、デ" +"コードには ``'ignore'`` が使われていました。" #: ../../library/codecs.rst:1559 msgid "Support any error handler." @@ -3251,42 +3274,34 @@ msgstr "ストリーム" msgid "stackable" msgstr "スタック可能" -#: ../../library/codecs.rst:316 msgid "strict" -msgstr "" +msgstr "strict" -#: ../../library/codecs.rst:316 ../../library/codecs.rst:368 -#: ../../library/codecs.rst:391 msgid "error handler's name" -msgstr "" +msgstr "エラーハンドラ名" #: ../../library/codecs.rst:316 msgid "ignore" msgstr "ignore" -#: ../../library/codecs.rst:316 msgid "replace" -msgstr "" +msgstr "replace" -#: ../../library/codecs.rst:316 msgid "backslashreplace" -msgstr "" +msgstr "backslashreplace" -#: ../../library/codecs.rst:316 msgid "surrogateescape" -msgstr "" +msgstr "surrogateescape" #: ../../library/codecs.rst:316 msgid "? (question mark)" msgstr "? (クエスチョンマーク)" -#: ../../library/codecs.rst:316 msgid "replacement character" -msgstr "" +msgstr "置換文字" -#: ../../library/codecs.rst:316 msgid "\\ (backslash)" -msgstr "" +msgstr "\\ (バックスラッシュ)" #: ../../library/codecs.rst:316 ../../library/codecs.rst:368 msgid "escape sequence" @@ -3304,14 +3319,11 @@ msgstr "\\u" msgid "\\U" msgstr "\\U" -#: ../../library/codecs.rst:368 msgid "xmlcharrefreplace" -msgstr "" +msgstr "xmlcharrefreplace" -#: ../../library/codecs.rst:368 msgid "namereplace" -msgstr "" +msgstr "namereplace" -#: ../../library/codecs.rst:391 msgid "surrogatepass" -msgstr "" +msgstr "surrogatepass" diff --git a/library/codeop.po b/library/codeop.po index 14650d79d..04b00b45d 100644 --- a/library/codeop.po +++ b/library/codeop.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/codeop.rst:2 @@ -57,13 +57,12 @@ msgstr "" "入力の一行がPythonの文として完全であるかどうかを見分けられること: 簡単に言え" "ば、次が '``>>>``' か、あるいは '``...``' かどうかを見分けます。" -#: ../../library/codeop.rst:25 msgid "" "Remembering which future statements the user has entered, so subsequent " "input can be compiled with these in effect." msgstr "" -"どのfuture文をユーザが入力したのかを覚えていること。したがって、実質的にそれ" -"に続く入力をこれらとともにコンパイルすることができます。" +"ユーザーが入力した future 文を記憶し、それ以降の入力を、その指定が有効な状態" +"でコンパイルできること。" #: ../../library/codeop.rst:28 msgid "" @@ -126,7 +125,6 @@ msgstr "" "えば、バックスラッシュの後ろに改行が2つあって、その後ろにゴミがあるかもしれま" "せん。パーサのAPIがより良くなればすぐに、この挙動は修正されるでしょう。" -#: ../../library/codeop.rst:61 msgid "" "Instances of this class have :meth:`~object.__call__` methods identical in " "signature to the built-in function :func:`compile`, but with the difference " @@ -134,13 +132,12 @@ msgid "" "statement, the instance 'remembers' and compiles all subsequent program " "texts with the statement in force." msgstr "" -"このクラスのインスタンスは組み込み関数 :func:`compile` とシグネチャが一致す" -"る :meth:`~object.__call__` メソッドを持っていますが、インスタンスが :mod:" -"`__future__` 文を含むプログラムテキストをコンパイルする場合は、インスタンスは" -"有効なその文とともに続くすべてのプログラムテキストを'覚えていて'コンパイルす" -"るという違いがあります。" +"このクラスのインスタンスは、組み込み関数 :func:`compile` と同じシグネチャの :" +"meth:`~object.__call__` メソッドを持ちます。\n" +"ただし、:mod:`__future__` 文を含むプログラムテキストをコンパイルすると、その" +"文の指定を記憶し、以後のすべてのプログラムテキストにもその指定を適用してコン" +"パイルします。" -#: ../../library/codeop.rst:70 msgid "" "Instances of this class have :meth:`~object.__call__` methods identical in " "signature to :func:`compile_command`; the difference is that if the instance " @@ -148,8 +145,8 @@ msgid "" "'remembers' and compiles all subsequent program texts with the statement in " "force." msgstr "" -"このクラスのインスタンスは :func:`compile_command` とシグネチャが一致する :" -"meth:`~object.__call__` メソッドを持っています。インスタンスが :mod:" -"`__future__` 文を含むプログラムテキストをコンパイルする場合に、インスタンスは" -"有効なその文とともにそれに続くすべてのプログラムテキストを'覚えていて'コンパ" -"イルするという違いがあります。" +"このクラスのインスタンスは、:func:`compile_command` と同じシグネチャの :meth:" +"`~object.__call__` メソッドを持ちます。\n" +"ただし、:mod:`__future__` 文を含むプログラムテキストをコンパイルすると、その" +"文の指定を記憶し、以後のすべてのプログラムテキストにもその指定を適用してコン" +"パイルします。" diff --git a/library/collections.abc.po b/library/collections.abc.po index 78d093cf2..361b28638 100644 --- a/library/collections.abc.po +++ b/library/collections.abc.po @@ -20,10 +20,10 @@ msgstr "" "Last-Translator: Takeshi Nakazato, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/collections.abc.rst:2 @@ -58,13 +58,16 @@ msgstr "" ":func:`issubclass` や :func:`isinstance` を使ったインターフェースに対するテス" "トは、以下の3つのいずれかの方法で動作します。" -#: ../../library/collections.abc.rst:30 msgid "" "A newly written class can inherit directly from one of the abstract base " "classes. The class must supply the required abstract methods. The " "remaining mixin methods come from inheritance and can be overridden if " "desired. Other methods may be added as needed:" msgstr "" +"新しく作るクラスは、抽象基底クラスのいずれかを直接継承できます。\n" +"そのクラスでは、必須の抽象メソッドを実装しなければなりません。\n" +"残りの mixin メソッドは継承され、必要に応じてオーバーライドできます。\n" +"他のメソッドも必要に応じて追加できます:" #: ../../library/collections.abc.rst:35 msgid "" @@ -94,7 +97,6 @@ msgstr "" ">>> isinstance(C(), Sequence)\n" "True" -#: ../../library/collections.abc.rst:50 msgid "" "Existing classes and built-in classes can be registered as \"virtual " "subclasses\" of the ABCs. Those classes should define the full API " @@ -103,6 +105,13 @@ msgid "" "determine whether the full interface is supported. The exception to this " "rule is for methods that are automatically inferred from the rest of the API:" msgstr "" +"既存のクラスや組み込みクラスは、ABC の「仮想サブクラス」として登録できま" +"す。\n" +"それらのクラスでは、すべての抽象メソッドとすべての mixin メソッドを含む完全" +"な API を定義する必要があります。\n" +"これにより、利用者は :func:`issubclass` や :func:`isinstance` によるテスト" +"で、完全なインターフェースがサポートされているかどうかを判断できます。\n" +"ただし、API の他の部分から自動的に導かれるメソッドは例外です:" #: ../../library/collections.abc.rst:58 msgid "" @@ -152,11 +161,13 @@ msgstr "" "`reversed` 関数は自動的に ``__getitem__`` と ``__len__`` を使うようにフォール" "バックするからです。" -#: ../../library/collections.abc.rst:82 msgid "" "Some simple interfaces are directly recognizable by the presence of the " "required methods (unless those methods have been set to :const:`None`):" msgstr "" +"単純なインターフェースの中には、必要なメソッドが存在することによって直接認識" +"できるものもあります (ただし、それらのメソッドが :const:`None` に設定されてい" +"ない場合に限ります):" #: ../../library/collections.abc.rst:85 msgid "" @@ -363,12 +374,14 @@ msgstr ":class:`Set`" msgid ":class:`Collection`" msgstr ":class:`Collection`" -#: ../../library/collections.abc.rst:143 msgid "" "``__le__``, ``__lt__``, ``__eq__``, ``__ne__``, ``__gt__``, ``__ge__``, " "``__and__``, ``__or__``, ``__sub__``, ``__rsub__``, ``__xor__``, " "``__rxor__`` and ``isdisjoint``" msgstr "" +"``__le__``, ``__lt__``, ``__eq__``, ``__ne__``, ``__gt__``, ``__ge__``, " +"``__and__``, ``__or__``, ``__sub__``, ``__rsub__``, ``__xor__``, " +"``__rxor__``, ``isdisjoint``" #: ../../library/collections.abc.rst:148 msgid ":class:`MutableSet`" @@ -428,9 +441,8 @@ msgstr ":class:`MappingView`" msgid ":class:`Sized`" msgstr ":class:`Sized`" -#: ../../library/collections.abc.rst:165 msgid "``__init__``, ``__len__`` and ``__repr__``" -msgstr "" +msgstr "``__init__``, ``__len__``, ``__repr__``" #: ../../library/collections.abc.rst:166 msgid ":class:`ItemsView`" @@ -640,8 +652,8 @@ msgstr "" #: ../../library/collections.abc.rst:264 msgid "ABCs for read-only and mutable :term:`sequences `." msgstr "" -"読み出し専用の :term:`シーケンス ` およびミュータブルな :term:`シー" -"ケンス ` の ABC です。" +"読み出し専用の :term:`シーケンス ` およびミュータブルなシーケンス" +"の ABC です。" #: ../../library/collections.abc.rst:266 msgid "" @@ -665,15 +677,16 @@ msgstr "" msgid "The index() method added support for *stop* and *start* arguments." msgstr "index() メソッドは *stop* と *start* 引数をサポートしました。" -#: ../../library/collections.abc.rst:282 msgid "ABCs for read-only and mutable :ref:`sets `." -msgstr "読み出し専用でミュータブルな :ref:`集合 ` の ABC です。" +msgstr "" +"読み出し専用の :ref:`集合 ` とミュータブルな集合のための ABC で" +"す。" #: ../../library/collections.abc.rst:287 msgid "ABCs for read-only and mutable :term:`mappings `." msgstr "" -"読み出し専用の :term:`マッピング ` およびミュータブルな :term:`マッ" -"ピング ` の ABC です。" +"読み出し専用の :term:`マッピング ` およびミュータブルなマッピングの " +"ABC です。" #: ../../library/collections.abc.rst:294 msgid "" @@ -690,13 +703,12 @@ msgstr "" ":keyword:`await` で使用できる :term:`awaitable` オブジェクトの ABC です。カス" "タムの実装は、:meth:`~object.__await__` メソッドを提供しなければなりません。" -#: ../../library/collections.abc.rst:302 msgid "" ":term:`Coroutine ` objects and instances of the :class:" "`~collections.abc.Coroutine` ABC are all instances of this ABC." msgstr "" -":class:`~collections.abc.Coroutine` ABC の :term:`Coroutine ` オブ" -"ジェクトとインスタンスは、すべてこの ABC のインスタンスです。" +":term:`コルーチン ` オブジェクトと :class:`~collections.abc." +"Coroutine` ABC のインスタンスは、いずれもこの ABC のインスタンスです。" #: ../../library/collections.abc.rst:306 msgid "" @@ -743,15 +755,14 @@ msgstr "" "ンに対して ``False`` を返します。そのようなコルーチンを検出するためには :" "func:`inspect.isawaitable` を使ってください。" -#: ../../library/collections.abc.rst:330 msgid "" "See :ref:`annotating-generators-and-coroutines` for details on using :class:" "`!Coroutine` in type annotations. The variance and order of type parameters " "correspond to those of :class:`Generator`." msgstr "" ":class:`!Coroutine` を型アノテーションで使う方法の詳細は、 :ref:`annotating-" -"generators-and-coroutines` を参照してください。型パラメータの意味と順序は :" -"class:`Generator` と同様です。" +"generators-and-coroutines` を参照してください。\n" +"型パラメータの変性と順序は :class:`Generator` と同様です。" #: ../../library/collections.abc.rst:339 msgid "" diff --git a/library/collections.po b/library/collections.po index 1d304e881..5a41813a5 100644 --- a/library/collections.po +++ b/library/collections.po @@ -22,10 +22,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/collections.rst:2 @@ -189,17 +189,18 @@ msgstr "" "サブコンテキストを作成するメソッド、最初のマッピング以外のすべてにアクセスす" "るためのプロパティがあります:" -#: ../../library/collections.rst:70 msgid "" "A user updateable list of mappings. The list is ordered from first-searched " "to last-searched. It is the only stored state and can be modified to change " "which mappings are searched. The list should always contain at least one " "mapping." msgstr "" -"マッピングのユーザがアップデートできるリストです。このリストは最初に探される" -"ものから最後に探されるものの順に並んでいます。これが唯一のソートされた状態で" -"あり、変更してマッピングが探される順番を変更できます。このリストは常に一つ以" -"上のマッピングを含んでいなければなりません。" +"ユーザーが更新できるマッピングのリストです。\n" +"マッピングは最初に検索されるものから最後に検索されるものの順に並んでいま" +"す。\n" +"保存される状態はこのリストだけであり、リストを変更すると検索対象のマッピング" +"を変更できます。\n" +"リストには常に少なくとも一つのマッピングが含まれていなければなりません。" #: ../../library/collections.rst:77 msgid "" @@ -258,6 +259,10 @@ msgid "" ">>> list(ChainMap(adjustments, baseline))\n" "['music', 'art', 'opera']" msgstr "" +">>> baseline = {'music': 'bach', 'art': 'rembrandt'}\n" +">>> adjustments = {'art': 'van gogh', 'opera': 'carmen'}\n" +">>> list(ChainMap(adjustments, baseline))\n" +"['music', 'art', 'opera']" #: ../../library/collections.rst:110 msgid "" @@ -274,6 +279,10 @@ msgid "" ">>> list(combined)\n" "['music', 'art', 'opera']" msgstr "" +">>> combined = baseline.copy()\n" +">>> combined.update(adjustments)\n" +">>> list(combined)\n" +"['music', 'art', 'opera']" #: ../../library/collections.rst:118 msgid "Added support for ``|`` and ``|=`` operators, specified in :pep:`584`." @@ -344,6 +353,8 @@ msgid "" "import builtins\n" "pylookup = ChainMap(locals(), globals(), vars(builtins))" msgstr "" +"import builtins\n" +"pylookup = ChainMap(locals(), globals(), vars(builtins))" #: ../../library/collections.rst:156 msgid "" @@ -353,7 +364,6 @@ msgid "" msgstr "" "ユーザ指定のコマンドライン引数、環境変数、デフォルト値、の順に優先させる例::" -#: ../../library/collections.rst:159 msgid "" "import os, argparse\n" "\n" @@ -370,6 +380,20 @@ msgid "" "print(combined['color'])\n" "print(combined['user'])" msgstr "" +"import os, argparse\n" +"\n" +"defaults = {'color': 'red', 'user': 'guest'}\n" +"\n" +"parser = argparse.ArgumentParser()\n" +"parser.add_argument('-u', '--user')\n" +"parser.add_argument('-c', '--color')\n" +"namespace = parser.parse_args()\n" +"command_line_args = {k: v for k, v in vars(namespace).items() if v is not " +"None}\n" +"\n" +"combined = ChainMap(command_line_args, os.environ, defaults)\n" +"print(combined['color'])\n" +"print(combined['user'])" #: ../../library/collections.rst:173 msgid "" @@ -411,7 +435,6 @@ msgstr "" "除を望むなら、チェーンの深いところで見つかったキーを更新するサブクラスを簡単" "に作れます::" -#: ../../library/collections.rst:197 msgid "" "class DeepChainMap(ChainMap):\n" " 'Variant of ChainMap that allows direct updates to inner scopes'\n" @@ -438,6 +461,30 @@ msgid "" ">>> d # display result\n" "DeepChainMap({'zebra': 'black', 'snake': 'red'}, {}, {'lion': 'orange'})" msgstr "" +"class DeepChainMap(ChainMap):\n" +" '内側のスコープを直接更新できる ChainMap の変種'\n" +"\n" +" def __setitem__(self, key, value):\n" +" for mapping in self.maps:\n" +" if key in mapping:\n" +" mapping[key] = value\n" +" return\n" +" self.maps[0][key] = value\n" +"\n" +" def __delitem__(self, key):\n" +" for mapping in self.maps:\n" +" if key in mapping:\n" +" del mapping[key]\n" +" return\n" +" raise KeyError(key)\n" +"\n" +">>> d = DeepChainMap({'zebra': 'black'}, {'elephant': 'blue'}, {'lion': " +"'yellow'})\n" +">>> d['lion'] = 'orange' # 2 階層下の既存のキーを更新\n" +">>> d['snake'] = 'red' # 新しいキーは最上位の辞書に追加\n" +">>> del d['elephant'] # 1 階層下の既存のキーを削除\n" +">>> d # 結果を表示\n" +"DeepChainMap({'zebra': 'black', 'snake': 'red'}, {}, {'lion': 'orange'})" #: ../../library/collections.rst:223 msgid ":class:`Counter` objects" @@ -450,7 +497,6 @@ msgid "" msgstr "" "便利で迅速な検数をサポートするカウンタツールが提供されています。例えば::" -#: ../../library/collections.rst:228 msgid "" ">>> # Tally occurrences of words in a list\n" ">>> cnt = Counter()\n" @@ -467,6 +513,20 @@ msgid "" "[('the', 1143), ('and', 966), ('to', 762), ('of', 669), ('i', 631),\n" " ('you', 554), ('a', 546), ('my', 514), ('hamlet', 471), ('in', 451)]" msgstr "" +">>> # リスト内の単語の出現回数を数える\n" +">>> cnt = Counter()\n" +">>> for word in ['red', 'blue', 'red', 'green', 'blue', 'blue']:\n" +"... cnt[word] += 1\n" +"...\n" +">>> cnt\n" +"Counter({'blue': 3, 'red': 2, 'green': 1})\n" +"\n" +">>> # Hamlet で最も頻出する単語を 10 個見つける\n" +">>> import re\n" +">>> words = re.findall(r'\\w+', open('hamlet.txt').read().lower())\n" +">>> Counter(words).most_common(10)\n" +"[('the', 1143), ('and', 966), ('to', 762), ('of', 669), ('i', 631),\n" +" ('you', 554), ('a', 546), ('my', 514), ('hamlet', 471), ('in', 451)]" #: ../../library/collections.rst:245 msgid "" @@ -537,16 +597,17 @@ msgstr "" "は挿入した順番で返されます。ある要素のカウントが 1 未満なら、 :meth:" "`elements` はそれを無視します。" -#: ../../library/collections.rst:295 msgid "" "Return a list of the *n* most common elements and their counts from the most " "common to the least. If *n* is omitted or ``None``, :meth:`most_common` " "returns *all* elements in the counter. Elements with equal counts are " "ordered in the order first encountered:" msgstr "" -"最も多い *n* 要素を、カウントが多いものから少ないものまで順に並べたリストを返" -"します。 *n* が省略されるか ``None`` であれば、 :meth:`most_common` はカウン" -"タの *すべての* 要素を返します。等しいカウントの要素は挿入順に並べられます:" +"出現回数が多い順に *n* 個の要素とそれぞれのカウントを並べたリストを返しま" +"す。\n" +"*n* が省略されるか ``None`` であれば、 :meth:`most_common` はカウンタの *すべ" +"ての* 要素を返します。\n" +"等しいカウントの要素は挿入順に並べられます:" #: ../../library/collections.rst:305 msgid "" @@ -617,7 +678,6 @@ msgstr "" msgid "Common patterns for working with :class:`Counter` objects::" msgstr ":class:`Counter` オブジェクトを使ったよくあるパターン::" -#: ../../library/collections.rst:356 msgid "" "c.total() # total of all counts\n" "c.clear() # reset all counts\n" @@ -629,6 +689,15 @@ msgid "" "c.most_common()[:-n-1:-1] # n least common elements\n" "+c # remove zero and negative counts" msgstr "" +"c.total() # すべてのカウントの合計\n" +"c.clear() # すべてのカウントをリセット\n" +"list(c) # 重複しない要素のリスト\n" +"set(c) # 集合に変換\n" +"dict(c) # 通常の辞書に変換\n" +"c.items() # (elem, cnt) のペアにアクセス\n" +"Counter(dict(list_of_pairs)) # (elem, cnt) のペアのリストから変換\n" +"c.most_common()[:-n-1:-1] # 出現回数が少ない方から n 個の要素\n" +"+c # 0 と負のカウントを削除" #: ../../library/collections.rst:366 msgid "" @@ -783,10 +852,10 @@ msgstr "" "上げるには、 :func:`itertools.combinations_with_replacement` を参照してくださ" "い::" -#: ../../library/collections.rst:447 msgid "" "map(Counter, combinations_with_replacement('ABC', 2)) # --> AA AB AC BB BC CC" msgstr "" +"map(Counter, combinations_with_replacement('ABC', 2)) # --> AA AB AC BB BC CC" #: ../../library/collections.rst:451 msgid ":class:`deque` objects" @@ -989,7 +1058,6 @@ msgstr "" msgid "Example:" msgstr "例:" -#: ../../library/collections.rst:596 msgid "" ">>> from collections import deque\n" ">>> d = deque('ghi') # make a new deque with three items\n" @@ -1044,6 +1112,56 @@ msgid "" ">>> d\n" "deque(['c', 'b', 'a'])" msgstr "" +">>> from collections import deque\n" +">>> d = deque('ghi') # 3 要素の deque を新しく作成\n" +">>> for elem in d: # deque の要素を反復処理\n" +"... print(elem.upper())\n" +"G\n" +"H\n" +"I\n" +"\n" +">>> d.append('j') # 新しい要素を右側に追加\n" +">>> d.appendleft('f') # 新しい要素を左側に追加\n" +">>> d # deque の表現を表示\n" +"deque(['f', 'g', 'h', 'i', 'j'])\n" +"\n" +">>> d.pop() # 右端の要素を返して削除\n" +"'j'\n" +">>> d.popleft() # 左端の要素を返して削除\n" +"'f'\n" +">>> list(d) # deque の内容をリストにする\n" +"['g', 'h', 'i']\n" +">>> d[0] # 左端の要素を見る\n" +"'g'\n" +">>> d[-1] # 右端の要素を見る\n" +"'i'\n" +"\n" +">>> list(reversed(d)) # deque の内容を逆順のリストにする\n" +"['i', 'h', 'g']\n" +">>> 'h' in d # deque を検索\n" +"True\n" +">>> d.extend('jkl') # 複数の要素を一度に追加\n" +">>> d\n" +"deque(['g', 'h', 'i', 'j', 'k', 'l'])\n" +">>> d.rotate(1) # 右にローテート\n" +">>> d\n" +"deque(['l', 'g', 'h', 'i', 'j', 'k'])\n" +">>> d.rotate(-1) # 左にローテート\n" +">>> d\n" +"deque(['g', 'h', 'i', 'j', 'k', 'l'])\n" +"\n" +">>> deque(reversed(d)) # 逆順の deque を新しく作成\n" +"deque(['l', 'k', 'j', 'i', 'h', 'g'])\n" +">>> d.clear() # deque を空にする\n" +">>> d.pop() # 空の deque からは取り出せない\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in -toplevel-\n" +" d.pop()\n" +"IndexError: pop from an empty deque\n" +"\n" +">>> d.extendleft('abc') # extendleft() は入力の順序を反転する\n" +">>> d\n" +"deque(['c', 'b', 'a'])" #: ../../library/collections.rst:651 msgid ":class:`deque` Recipes" @@ -1061,13 +1179,16 @@ msgstr "" "長さが制限された deque は Unix における ``tail`` フィルタに相当する機能を提供" "します::" -#: ../../library/collections.rst:658 msgid "" "def tail(filename, n=10):\n" " 'Return the last n lines of a file'\n" " with open(filename) as f:\n" " return deque(f, n)" msgstr "" +"def tail(filename, n=10):\n" +" 'ファイルの末尾 n 行を返す'\n" +" with open(filename) as f:\n" +" return deque(f, n)" #: ../../library/collections.rst:663 msgid "" @@ -1077,7 +1198,6 @@ msgstr "" "deque を使用する別のアプローチは、右に要素を追加し左から要素を取り出すことで" "最近追加した要素のシーケンスを保持することです::" -#: ../../library/collections.rst:666 msgid "" "def moving_average(iterable, n=3):\n" " # moving_average([40, 30, 50, 46, 39, 44]) --> 40.0 42.0 45.0 43.0\n" @@ -1091,6 +1211,17 @@ msgid "" " d.append(elem)\n" " yield s / n" msgstr "" +"def moving_average(iterable, n=3):\n" +" # moving_average([40, 30, 50, 46, 39, 44]) --> 40.0 42.0 45.0 43.0\n" +" # https://en.wikipedia.org/wiki/Moving_average\n" +" it = iter(iterable)\n" +" d = deque(itertools.islice(it, n-1))\n" +" d.appendleft(0)\n" +" s = sum(d)\n" +" for elem in it:\n" +" s += elem - d.popleft()\n" +" d.append(elem)\n" +" yield s / n" #: ../../library/collections.rst:678 msgid "" @@ -1108,7 +1239,6 @@ msgstr "" "そのイテレータが値を出し切った場合は、 :meth:`~deque.popleft` で除去できま" "す; そうでない場合は、 :meth:`~deque.rotate` メソッドで末尾に回せます::" -#: ../../library/collections.rst:685 msgid "" "def roundrobin(*iterables):\n" " \"roundrobin('ABC', 'D', 'EF') --> A D E B F C\"\n" @@ -1122,25 +1252,38 @@ msgid "" " # Remove an exhausted iterator.\n" " iterators.popleft()" msgstr "" +"def roundrobin(*iterables):\n" +" \"roundrobin('ABC', 'D', 'EF') --> A D E B F C\"\n" +" iterators = deque(map(iter, iterables))\n" +" while iterators:\n" +" try:\n" +" while True:\n" +" yield next(iterators[0])\n" +" iterators.rotate(-1)\n" +" except StopIteration:\n" +" # 使い果たされたイテレータを削除\n" +" iterators.popleft()" -#: ../../library/collections.rst:697 msgid "" "The :meth:`~deque.rotate` method provides a way to implement :class:`deque` " "slicing and deletion. For example, a pure Python implementation of ``del " "d[n]`` relies on the ``rotate()`` method to position elements to be popped::" msgstr "" -":meth:`~deque.rotate` メソッドは、 :class:`deque` のスライスや削除の機能を提" -"供します。\n" -"例えば、 純粋な Python 実装の ``del d[n]`` は ``rotate()`` メソッドを頼りに、" -"pop される要素の位置を割り出します::" +":meth:`~deque.rotate` メソッドを使うと :class:`deque` のスライスや削除を実装" +"できます。\n" +"例えば、``del d[n]`` を純粋な Python で実装するには、``rotate()`` メソッドで" +"削除対象の要素を取り出せる位置に移動します。 ::" -#: ../../library/collections.rst:701 msgid "" "def delete_nth(d, n):\n" " d.rotate(-n)\n" " d.popleft()\n" " d.rotate(n)" msgstr "" +"def delete_nth(d, n):\n" +" d.rotate(-n)\n" +" d.popleft()\n" +" d.rotate(n)" #: ../../library/collections.rst:706 msgid "" @@ -1201,15 +1344,14 @@ msgstr "" "もし :attr:`default_factory` 属性が ``None`` であれば、このメソッドは :exc:" "`KeyError` 例外を、 *key* を引数として発生させます。" -#: ../../library/collections.rst:739 msgid "" "If :attr:`default_factory` is not ``None``, it is called without arguments " "to provide a default value for the given *key*, this value is inserted in " "the dictionary for the *key*, and returned." msgstr "" -"もし :attr:`default_factory` 属性が ``None`` でない場合、このメソッドは引数な" -"しで呼び出され、与えらえた *key* に対応するデフォルト値を提供します。この値" -"は、辞書内に *key* に対応して登録され、最後に返されます。" +":attr:`default_factory` が ``None`` でない場合は、それを引数なしで呼び出して " +"*key* のデフォルト値を取得します。\n" +"この値を辞書に *key* の値として登録し、返します。" #: ../../library/collections.rst:743 msgid "" @@ -1237,6 +1379,10 @@ msgid "" "normal dictionaries, return ``None`` as a default rather than using :attr:" "`default_factory`." msgstr "" +"なお、 :meth:`__missing__` は :meth:`~object.__getitem__` 以外のいかなる演算" +"に対しても呼び出され *ません* 。よって :meth:`~dict.get` は、普通の辞書と同様" +"に、 :attr:`default_factory` を使うのではなくデフォルトとして ``None`` を返し" +"ます。" #: ../../library/collections.rst:756 msgid ":class:`defaultdict` objects support the following instance variable:" @@ -1294,26 +1440,26 @@ msgstr "" "`defaultdict` を(他の言語の bag や multisetのように)要素の数え上げに便利に使" "うことができます:" -#: ../../library/collections.rst:811 msgid "" "When a letter is first encountered, it is missing from the mapping, so the :" "attr:`~defaultdict.default_factory` function calls :func:`int` to supply a " "default count of zero. The increment operation then builds up the count for " "each letter." msgstr "" -"最初に文字が出現したときは、マッピングが存在しないので :attr:`~defaultdict." -"default_factory` 関数が :func:`int` を呼んでデフォルトのカウント0を生成しま" -"す。インクリメント操作が各文字を数え上げます。" +"最初に文字が出現したときは、その文字がマッピングに存在しないので :attr:" +"`~defaultdict.default_factory` 関数が :func:`int` を呼んでデフォルトのカウン" +"ト0を生成します。\n" +"インクリメント操作が各文字を数え上げます。" -#: ../../library/collections.rst:815 msgid "" "The function :func:`int` which always returns zero is just a special case of " "constant functions. A faster and more flexible way to create constant " "functions is to use a lambda function which can supply any constant value " "(not just zero):" msgstr "" -"常に0を返す :func:`int` は特殊な関数でした。定数を生成するより速くて柔軟な方" -"法は、 0に限らず何でも定数を生成するラムダ関数を使うことです:" +"常に 0 を返す :func:`int` は、一定の値を返す関数の一例にすぎません。\n" +"そのような関数をより高速かつ柔軟に作るには、0 に限らず任意の定数を返せるラム" +"ダ関数を使います。" #: ../../library/collections.rst:828 msgid "" @@ -1339,7 +1485,6 @@ msgstr "" "でも利用でき、場所に対するインデックスの代わりに名前を使ってフィールドにアク" "セスできるようになります。" -#: ../../library/collections.rst:849 msgid "" "Returns a new tuple subclass named *typename*. The new subclass is used to " "create tuple-like objects that have fields accessible by attribute lookup as " @@ -1348,6 +1493,12 @@ msgid "" "`~object.__repr__` method which lists the tuple contents in a ``name=value`` " "format." msgstr "" +"*typename* という名前の新しいタプルのサブクラスを返します。\n" +"このサブクラスでは、インデックスによるアクセスや反復に加えて、属性名でも" +"フィールドにアクセスできるタプルに似たオブジェクトを作成できます。\n" +"インスタンスには *typename* と *field_names* を含む便利な docstring と、タプ" +"ルの内容を ``name=value`` 形式で列挙する便利な :meth:`~object.__repr__` メ" +"ソッドもあります。" #: ../../library/collections.rst:856 msgid "" @@ -1407,6 +1558,8 @@ msgid "" "If *module* is defined, the :attr:`~type.__module__` attribute of the named " "tuple is set to that value." msgstr "" +"もし *module* が指定されていれば、名前付きタプルの :attr:`~type.__module__` " +"属性は、指定された値に設定されます" #: ../../library/collections.rst:881 msgid "" @@ -1442,15 +1595,16 @@ msgstr "*module* 引数が追加されました。" #: ../../library/collections.rst:897 msgid "Removed the *verbose* parameter and the :attr:`!_source` attribute." -msgstr "" +msgstr "*verbose* 引数と :attr:`!_source` 属性が削除されました。" #: ../../library/collections.rst:900 msgid "" "Added the *defaults* parameter and the :attr:`~somenamedtuple." "_field_defaults` attribute." msgstr "" +"*defaults* 引数と :attr:`~somenamedtuple._field_defaults` 属性が追加されまし" +"た。" -#: ../../library/collections.rst:904 msgid "" ">>> # Basic example\n" ">>> Point = namedtuple('Point', ['x', 'y'])\n" @@ -1466,6 +1620,20 @@ msgid "" ">>> p # readable __repr__ with a name=value style\n" "Point(x=11, y=22)" msgstr "" +">>> # 基本的な例\n" +">>> Point = namedtuple('Point', ['x', 'y'])\n" +">>> p = Point(11, y=22) # 位置引数またはキーワード引数でインスタンスを作" +"成\n" +">>> p[0] + p[1] # 通常のタプル (11, 22) と同様にインデックスでア" +"クセス可能\n" +"33\n" +">>> x, y = p # 通常のタプルと同様にアンパック\n" +">>> x, y\n" +"(11, 22)\n" +">>> p.x + p.y # フィールドには名前でもアクセス可能\n" +"33\n" +">>> p # name=value 形式の読みやすい __repr__\n" +"Point(x=11, y=22)" #: ../../library/collections.rst:920 msgid "" @@ -1510,12 +1678,14 @@ msgid "" msgstr "" "既存の sequence や Iterable から新しいインスタンスを作るクラスメソッド." -#: ../../library/collections.rst:944 msgid "" ">>> t = [11, 22]\n" ">>> Point._make(t)\n" "Point(x=11, y=22)" msgstr "" +">>> t = [11, 22]\n" +">>> Point._make(t)\n" +"Point(x=11, y=22)" #: ../../library/collections.rst:952 msgid "" @@ -1524,12 +1694,14 @@ msgid "" msgstr "" "フィールド名を対応する値にマッピングする新しい :class:`dict` を返します::" -#: ../../library/collections.rst:955 msgid "" ">>> p = Point(x=11, y=22)\n" ">>> p._asdict()\n" "{'x': 11, 'y': 22}" msgstr "" +">>> p = Point(x=11, y=22)\n" +">>> p._asdict()\n" +"{'x': 11, 'y': 22}" #: ../../library/collections.rst:961 msgid "Returns an :class:`OrderedDict` instead of a regular :class:`dict`." @@ -1556,7 +1728,6 @@ msgstr "" "指定されたフィールドを新しい値で置き換えた、新しい名前付きタプルを作って返し" "ます::" -#: ../../library/collections.rst:976 msgid "" ">>> p = Point(x=11, y=22)\n" ">>> p._replace(x=33)\n" @@ -1566,6 +1737,13 @@ msgid "" "... inventory[partnum] = record._replace(price=newprices[partnum], " "timestamp=time.now())" msgstr "" +">>> p = Point(x=11, y=22)\n" +">>> p._replace(x=33)\n" +"Point(x=33, y=22)\n" +"\n" +">>> for partnum, record in inventory.items():\n" +"... inventory[partnum] = record._replace(price=newprices[partnum], " +"timestamp=time.now())" #: ../../library/collections.rst:983 msgid "" @@ -1589,7 +1767,6 @@ msgstr "" "フィールド名をリストにしたタプルです。内省 (introspection) したり、既存の名前" "付きタプルをもとに新しい名前つきタプルを作成する時に便利です。" -#: ../../library/collections.rst:994 msgid "" ">>> p._fields # view the field names\n" "('x', 'y')\n" @@ -1599,12 +1776,18 @@ msgid "" ">>> Pixel(11, 22, 128, 255, 0)\n" "Pixel(x=11, y=22, red=128, green=255, blue=0)" msgstr "" +">>> p._fields # フィールド名を表示\n" +"('x', 'y')\n" +"\n" +">>> Color = namedtuple('Color', 'red green blue')\n" +">>> Pixel = namedtuple('Pixel', Point._fields + Color._fields)\n" +">>> Pixel(11, 22, 128, 255, 0)\n" +"Pixel(x=11, y=22, red=128, green=255, blue=0)" #: ../../library/collections.rst:1006 msgid "Dictionary mapping field names to default values." msgstr "フィールド名からデフォルト値への対応を持つ辞書です。" -#: ../../library/collections.rst:1008 msgid "" ">>> Account = namedtuple('Account', ['type', 'balance'], defaults=[0])\n" ">>> Account._field_defaults\n" @@ -1612,6 +1795,11 @@ msgid "" ">>> Account('premium')\n" "Account(type='premium', balance=0)" msgstr "" +">>> Account = namedtuple('Account', ['type', 'balance'], defaults=[0])\n" +">>> Account._field_defaults\n" +"{'balance': 0}\n" +">>> Account('premium')\n" +"Account(type='premium', balance=0)" #: ../../library/collections.rst:1016 msgid "" @@ -1639,7 +1827,6 @@ msgstr "" "のは容易です。次の例では計算済みフィールドと固定幅の print format を追加して" "います:" -#: ../../library/collections.rst:1033 msgid "" ">>> class Point(namedtuple('Point', ['x', 'y'])):\n" "... __slots__ = ()\n" @@ -1655,6 +1842,19 @@ msgid "" "Point: x= 3.000 y= 4.000 hypot= 5.000\n" "Point: x=14.000 y= 0.714 hypot=14.018" msgstr "" +">>> class Point(namedtuple('Point', ['x', 'y'])):\n" +"... __slots__ = ()\n" +"... @property\n" +"... def hypot(self):\n" +"... return (self.x ** 2 + self.y ** 2) ** 0.5\n" +"... def __str__(self):\n" +"... return 'Point: x=%6.3f y=%6.3f hypot=%6.3f' % (self.x, self.y, " +"self.hypot)\n" +"\n" +">>> for p in Point(3, 4), Point(14, 5/7):\n" +"... print(p)\n" +"Point: x= 3.000 y= 4.000 hypot= 5.000\n" +"Point: x=14.000 y= 0.714 hypot=14.018" #: ../../library/collections.rst:1048 msgid "" @@ -1697,13 +1897,16 @@ msgstr "" "NamedTuple` を参照してください。\n" ":keyword:`class` キーワードを使った洗練された記法も紹介されています::" -#: ../../library/collections.rst:1074 msgid "" "class Component(NamedTuple):\n" " part_number: int\n" " weight: float\n" " description: Optional[str] = None" msgstr "" +"class Component(NamedTuple):\n" +" part_number: int\n" +" weight: float\n" +" description: Optional[str] = None" #: ../../library/collections.rst:1079 msgid "" @@ -1789,6 +1992,9 @@ msgid "" "different signature. It accepts an optional argument to specify which item " "is popped." msgstr "" +":class:`OrderedDict` の :meth:`~OrderedDict.popitem` メソッドはシグネチャが異" +"なります。\n" +"どの要素を取り出すかを指定するオプション引数を受け付けます。" #: ../../library/collections.rst:1116 msgid "" @@ -1809,11 +2015,12 @@ msgstr "" "は ``(k := next(iter(d)), d.pop(k))`` で実現できます。これにより、該当する要" "素のうちで最も左側の (先頭の) ものを辞書から削除して返すことができます。" -#: ../../library/collections.rst:1123 msgid "" ":class:`OrderedDict` has a :meth:`~OrderedDict.move_to_end` method to " "efficiently reposition an element to an endpoint." msgstr "" +":class:`OrderedDict` には、要素を先頭または末尾に効率よく移動する :meth:" +"`~OrderedDict.move_to_end` メソッドがあります。" #: ../../library/collections.rst:1126 msgid "" @@ -1825,7 +2032,6 @@ msgstr "" "OrderedDict の ``od.move_to_end(k, last=True)`` は ``d[k] = d.pop(k)`` で実現" "できます。" -#: ../../library/collections.rst:1130 msgid "" "A regular :class:`dict` does not have an efficient equivalent for " "OrderedDict's ``od.move_to_end(k, last=False)`` which moves the key and its " @@ -1833,12 +2039,13 @@ msgid "" msgstr "" "組み込みの :class:`dict` では、キーと値のペアを最も左側 (先頭) に移動する " "OrderedDict の ``od.move_to_end(k, last=False)`` を実現する効率の良い方法はあ" -"りません。 " +"りません。" -#: ../../library/collections.rst:1134 msgid "" "Until Python 3.8, :class:`dict` lacked a :meth:`~object.__reversed__` method." msgstr "" +"Python 3.8 より前の :class:`dict` には :meth:`~object.__reversed__` メソッド" +"がありませんでした。" #: ../../library/collections.rst:1139 msgid "" @@ -1870,7 +2077,6 @@ msgstr "" "場合には先頭に移動します。指定した *key* が存在しない場合は :exc:`KeyError` " "を送出します。" -#: ../../library/collections.rst:1158 msgid "" ">>> d = OrderedDict.fromkeys('abcde')\n" ">>> d.move_to_end('b')\n" @@ -1880,6 +2086,13 @@ msgid "" ">>> ''.join(d)\n" "'bacde'" msgstr "" +">>> d = OrderedDict.fromkeys('abcde')\n" +">>> d.move_to_end('b')\n" +">>> ''.join(d)\n" +"'acdeb'\n" +">>> d.move_to_end('b', last=False)\n" +">>> ''.join(d)\n" +"'bacde'" #: ../../library/collections.rst:1170 msgid "" @@ -1889,19 +2102,23 @@ msgstr "" "通常のマッピングのメソッドに加え、順序付き辞書は :func:`reversed` による逆順" "の反復もサポートしています。" -#: ../../library/collections.rst:1175 msgid "" "Equality tests between :class:`OrderedDict` objects are order-sensitive and " "are roughly equivalent to ``list(od1.items())==list(od2.items())``." msgstr "" +":class:`OrderedDict` オブジェクト同士の等価性の比較は順序を考慮し、ほぼ " +"``list(od1.items())==list(od2.items())`` と等価です。" -#: ../../library/collections.rst:1178 msgid "" "Equality tests between :class:`OrderedDict` objects and other :class:" "`~collections.abc.Mapping` objects are order-insensitive like regular " "dictionaries. This allows :class:`OrderedDict` objects to be substituted " "anywhere a regular dictionary is used." msgstr "" +":class:`OrderedDict` オブジェクトと他の :class:`~collections.abc.Mapping` オ" +"ブジェクトの等価性の比較では、通常の辞書と同様に順序は考慮されません。\n" +"このため、通常の辞書を使う場所ならどこでも :class:`OrderedDict` オブジェクト" +"で置き換えられます。" #: ../../library/collections.rst:1183 msgid "" @@ -1917,6 +2134,8 @@ msgid "" "passed to the :class:`OrderedDict` constructor and its :meth:`~dict.update` " "method." msgstr "" +":pep:`468` の受理によって、:class:`OrderedDict` のコンストラクタと、:meth:" +"`~dict.update` メソッドに渡したキーワード引数の順序は保持されます。" #: ../../library/collections.rst:1197 msgid ":class:`OrderedDict` Examples and Recipes" @@ -1978,7 +2197,6 @@ msgid "" " return result" msgstr "" -#: ../../library/collections.rst:1241 msgid "" "class MultiHitLRUCache:\n" " \"\"\" LRU cache that defers caching a result until\n" @@ -2015,6 +2233,41 @@ msgid "" " self.cache.popitem(last=False)\n" " return result" msgstr "" +"class MultiHitLRUCache:\n" +" \"\"\" 結果が複数回要求されるまで\n" +" キャッシュへの保存を遅らせる LRU キャッシュ。\n" +"\n" +"\n" +" 一度しか要求されない結果で LRU キャッシュが置き換わるのを防ぐため、\n" +" 同じ要求が複数回行われるまでキャッシュに保存しない。\n" +"\n" +"\n" +" \"\"\"\n" +"\n" +" def __init__(self, func, maxsize=128, maxrequests=4096, cache_after=1):\n" +" self.requests = OrderedDict() # { uncached_key : request_count }\n" +" self.cache = OrderedDict() # { cached_key : function_result }\n" +" self.func = func\n" +" self.maxrequests = maxrequests # キャッシュにない要求の最大数\n" +" self.maxsize = maxsize # 保存する戻り値の最大数\n" +" self.cache_after = cache_after\n" +"\n" +" def __call__(self, *args):\n" +" if args in self.cache:\n" +" self.cache.move_to_end(args)\n" +" return self.cache[args]\n" +" result = self.func(*args)\n" +" self.requests[args] = self.requests.get(args, 0) + 1\n" +" if self.requests[args] <= self.cache_after:\n" +" self.requests.move_to_end(args)\n" +" if len(self.requests) > self.maxrequests:\n" +" self.requests.popitem(last=False)\n" +" else:\n" +" self.requests.pop(args, None)\n" +" self.cache[args] = result\n" +" if len(self.cache) > self.maxsize:\n" +" self.cache.popitem(last=False)\n" +" return result" #: ../../library/collections.rst:1310 msgid ":class:`UserDict` objects" diff --git a/library/colorsys.po b/library/colorsys.po index b23ce6dcd..9f391e3d9 100644 --- a/library/colorsys.po +++ b/library/colorsys.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/colorsys.rst:2 @@ -84,7 +84,6 @@ msgstr "HSV から RGB に変換します。" msgid "Example::" msgstr "以下はプログラム例です::" -#: ../../library/colorsys.rst:61 msgid "" ">>> import colorsys\n" ">>> colorsys.rgb_to_hsv(0.2, 0.4, 0.4)\n" @@ -92,3 +91,8 @@ msgid "" ">>> colorsys.hsv_to_rgb(0.5, 0.5, 0.4)\n" "(0.2, 0.4, 0.4)" msgstr "" +">>> import colorsys\n" +">>> colorsys.rgb_to_hsv(0.2, 0.4, 0.4)\n" +"(0.5, 0.5, 0.4)\n" +">>> colorsys.hsv_to_rgb(0.5, 0.5, 0.4)\n" +"(0.2, 0.4, 0.4)" diff --git a/library/compileall.po b/library/compileall.po index acb4319d5..6a6104a28 100644 --- a/library/compileall.po +++ b/library/compileall.po @@ -19,10 +19,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/compileall.rst:2 @@ -47,9 +47,8 @@ msgstr "" "をライブラリのインストール時に生成することで、ライブラリディレクトリに書き込" "み権限をもたないユーザでも、これらを利用できるようになります。" -#: ../../includes/wasm-notavail.rst:3 msgid "Availability" -msgstr "" +msgstr "利用可能な環境" #: ../../includes/wasm-notavail.rst:5 msgid "" @@ -163,13 +162,14 @@ msgstr "" ":program:`python -m compileall -r 0` は :program:`python -m " "compileall -l` と等価です。" -#: ../../library/compileall.rst:92 msgid "" "Use *N* workers to compile the files within the given directory. If ``0`` is " "used, then the result of :func:`os.process_cpu_count` will be used." msgstr "" +"指定されたディレクトリ内のファイルを *N* 個のワーカーを使ってコンパイルしま" +"す。\n" +"``0`` を指定すると、:func:`os.process_cpu_count` の結果が使われます。" -#: ../../library/compileall.rst:98 msgid "" "Control how the generated byte-code files are invalidated at runtime. The " "``timestamp`` value, means that ``.pyc`` files with the source timestamp and " @@ -181,58 +181,65 @@ msgid "" "`SOURCE_DATE_EPOCH` environment variable is not set, and ``checked-hash`` if " "the ``SOURCE_DATE_EPOCH`` environment variable is set." msgstr "" -"生成したバイトコードファイルを実行時に無効化する方法を制御します。" -"``timestamp`` を指定すると、生成した``.pyc`` ファイルにソースファイルのタイム" -"スタンプとサイズを埋め込みます。``checked-hash`` と ``unchecked-hash`` を指定" -"すると、ハッシュベースの pycファイルが生成されます。ハッシュベースのpycファイ" -"ルは、ソースファイルにタイムスタンプではなくハッシュ値を埋め込みます。Python " -"がバイトコードキャッシュファイルを実行時に検証する方法の詳細を知るには、:ref:" -"`pyc-invalidation` を参照してください。デフォルト値は、:envvar:" -"`SOURCE_DATE_EPOCH` 環境変数が設定されていなければ ``timestamp`` で、" -"``SOURCE_DATE_EPOCH`` 環境変数が設定されていれば、``checked-hash`` になりま" -"す。" +"生成したバイトコードファイルを実行時に無効化する方法を制御します。\n" +"``timestamp`` を指定すると、生成した ``.pyc`` ファイルにソースファイルのタイ" +"ムスタンプとサイズを埋め込みます。\n" +"``checked-hash`` と ``unchecked-hash`` を指定すると、ハッシュベースの pycファ" +"イルが生成されます。\n" +"ハッシュベースの pyc ファイルには、タイムスタンプの代わりにソースファイルの内" +"容のハッシュ値を埋め込みます。\n" +"Python がバイトコードキャッシュファイルを実行時に検証する方法の詳細を知るに" +"は、:ref:`pyc-invalidation` を参照してください。\n" +"デフォルト値は、:envvar:`SOURCE_DATE_EPOCH` 環境変数が設定されていなければ " +"``timestamp`` で、``SOURCE_DATE_EPOCH`` 環境変数が設定されていれば、" +"``checked-hash`` になります。" -#: ../../library/compileall.rst:111 msgid "" "Compile with the given optimization level. May be used multiple times to " "compile for multiple levels at a time (for example, ``compileall -o 1 -o " "2``)." msgstr "" +"指定された最適化レベルでコンパイルします。\n" +"複数回指定すると、複数のレベルで一度にコンパイルできます (例: ``compileall -" +"o 1 -o 2``)。" -#: ../../library/compileall.rst:117 msgid "Ignore symlinks pointing outside the given directory." -msgstr "" +msgstr "指定されたディレクトリの外を指すシンボリックリンクを無視します。" -#: ../../library/compileall.rst:121 msgid "" "If two ``.pyc`` files with different optimization level have the same " "content, use hard links to consolidate duplicate files." msgstr "" +"最適化レベルが異なる二つの ``.pyc`` ファイルの内容が同じ場合、ハードリンクを" +"使って重複するファイルをまとめます。" #: ../../library/compileall.rst:124 msgid "Added the ``-i``, ``-b`` and ``-h`` options." msgstr "``-i``, ``-b``, ``-h`` オプションを追加。" -#: ../../library/compileall.rst:127 msgid "" "Added the ``-j``, ``-r``, and ``-qq`` options. ``-q`` option was changed " "to a multilevel value. ``-b`` will always produce a byte-code file ending " "in ``.pyc``, never ``.pyo``." msgstr "" -"``-j``, ``-r``, ``-qq`` オプションが追加されました。``-q`` オプションが複数の" -"レベルの値に変更されました。``-b`` は常に拡張子 ``.pyc`` のバイトエンコーディ" -"ングファイルを生成し、``.pyo`` を作りません。" +"``-j``、``-r``、``-qq`` オプションが追加されました。\n" +"``-q`` オプションが複数のレベルの値を取るように変更されました。\n" +"``-b`` は常に拡張子が ``.pyc`` のバイトコードファイルを生成し、``.pyo`` は生" +"成しません。" #: ../../library/compileall.rst:132 msgid "Added the ``--invalidation-mode`` option." msgstr "``--invalidation-mode`` オプションが追加されました。" -#: ../../library/compileall.rst:135 msgid "" "Added the ``-s``, ``-p``, ``-e`` and ``--hardlink-dupes`` options. Raised " "the default recursion limit from 10 to :py:func:`sys.getrecursionlimit()`. " "Added the possibility to specify the ``-o`` option multiple times." msgstr "" +"``-s``、``-p``、``-e``、``--hardlink-dupes`` オプションが追加されました。\n" +"デフォルトの再帰上限が 10 から :py:func:`sys.getrecursionlimit()` に引き上げ" +"られました。\n" +"``-o`` オプションを複数回指定できるようになりました。" #: ../../library/compileall.rst:142 msgid "" @@ -244,13 +251,17 @@ msgstr "" "ンはありません。 Python インタプリタ自体のオプションを使ってください: :" "program:`python -O -m compileall`." -#: ../../library/compileall.rst:146 msgid "" "Similarly, the :func:`compile` function respects the :data:`sys." "pycache_prefix` setting. The generated bytecode cache will only be useful " "if :func:`compile` is run with the same :data:`sys.pycache_prefix` (if any) " "that will be used at runtime." msgstr "" +"同様に、:func:`compile` 関数は :data:`sys.pycache_prefix` の設定に従いま" +"す。\n" +"生成されたバイトコードキャッシュを利用するには、:func:`compile` の実行時と" +"コードの実行時で :data:`sys.pycache_prefix` の設定を揃える必要があります (設" +"定しない場合も同様です)。" #: ../../library/compileall.rst:152 msgid "Public functions" @@ -296,13 +307,17 @@ msgstr "" "*force* が真の場合、タイムスタンプが最新のであってもモジュールは再コンパイル" "されます。" -#: ../../library/compileall.rst:172 msgid "" "If *rx* is given, its ``search`` method is called on the complete path to " "each file considered for compilation, and if it returns a true value, the " "file is skipped. This can be used to exclude files matching a regular " "expression, given as a :ref:`re.Pattern ` object." msgstr "" +"*rx* が指定された場合、コンパイル対象の各ファイルの完全なパスを引数として、そ" +"の ``search`` メソッドを呼び出します。\n" +"真の値が返された場合、そのファイルはスキップされます。\n" +":ref:`re.Pattern ` オブジェクトとして渡した正規表現にマッチする" +"ファイルを除外するために使えます。" #: ../../library/compileall.rst:177 ../../library/compileall.rst:254 msgid "" @@ -328,15 +343,17 @@ msgstr "" "す。デフォルトは :pep:`3147` で決められた場所と名前を使い、複数のバージョン" "の Python のバイトコードファイルが共存できるようにします。" -#: ../../library/compileall.rst:187 ../../library/compileall.rst:264 msgid "" "*optimize* specifies the optimization level for the compiler. It is passed " "to the built-in :func:`compile` function. Accepts also a sequence of " "optimization levels which lead to multiple compilations of one :file:`.py` " "file in one call." msgstr "" +"*optimize* はコンパイラの最適化レベルを指定します。\n" +"この値は組み込みの :func:`compile` 関数に渡されます。\n" +"最適化レベルのシーケンスも受け付け、その場合は一回の呼び出しで一つの :file:`." +"py` ファイルを複数回コンパイルします。" -#: ../../library/compileall.rst:191 msgid "" "The argument *workers* specifies how many workers are used to compile files " "in parallel. The default is to not use multiple workers. If the platform " @@ -345,6 +362,12 @@ msgid "" "cores in the system is used. If *workers* is lower than ``0``, a :exc:" "`ValueError` will be raised." msgstr "" +"*workers* 引数は、ファイルを並列にコンパイルするワーカーの数を指定します。\n" +"デフォルトでは複数のワーカーを使いません。\n" +"複数のワーカーを使えないプラットフォームで *workers* 引数が指定された場合は、" +"逐次コンパイルにフォールバックします。\n" +"*workers* が 0 の場合は、システムのコア数が使われます。\n" +"*workers* が ``0`` より小さい場合は :exc:`ValueError` を送出します。" #: ../../library/compileall.rst:198 ../../library/compileall.rst:268 msgid "" @@ -355,19 +378,22 @@ msgstr "" "*invalidation_mode* は、:class:`py_compile.PycInvalidationMode` のメンバーで" "なければならず、生成されたpycファイルを実行時に無効化する方法を制御します。" -#: ../../library/compileall.rst:202 ../../library/compileall.rst:272 msgid "" "The *stripdir*, *prependdir* and *limit_sl_dest* arguments correspond to the " "``-s``, ``-p`` and ``-e`` options described above. They may be specified as " "``str`` or :py:class:`os.PathLike`." msgstr "" +"*stripdir*、*prependdir*、*limit_sl_dest* 引数は、それぞれ上で説明した ``-" +"s``、``-p``、``-e`` オプションに対応します。\n" +"``str`` または :py:class:`os.PathLike` として指定できます。" -#: ../../library/compileall.rst:206 ../../library/compileall.rst:276 msgid "" "If *hardlink_dupes* is true and two ``.pyc`` files with different " "optimization level have the same content, use hard links to consolidate " "duplicate files." msgstr "" +"*hardlink_dupes* が真で、最適化レベルが異なる二つの ``.pyc`` ファイルの内容が" +"同じ場合、ハードリンクを使って重複するファイルをまとめます。" #: ../../library/compileall.rst:209 ../../library/compileall.rst:307 msgid "Added the *legacy* and *optimize* parameter." @@ -400,22 +426,24 @@ msgstr ":term:`path-like object` を受け入れるようになりました。" msgid "The *invalidation_mode* parameter was added." msgstr "*invalidation_mode* 引数を追加しました。" -#: ../../library/compileall.rst:228 ../../library/compileall.rst:291 -#: ../../library/compileall.rst:320 msgid "" "The *invalidation_mode* parameter's default value is updated to ``None``." msgstr "" +"*invalidation_mode* パラメータのデフォルト値が ``None`` に変更されました。" -#: ../../library/compileall.rst:231 msgid "Setting *workers* to 0 now chooses the optimal number of cores." msgstr "" +"*workers* を 0 に設定すると、最適なコア数が選択されるようになりました。" -#: ../../library/compileall.rst:234 msgid "" "Added *stripdir*, *prependdir*, *limit_sl_dest* and *hardlink_dupes* " "arguments. Default value of *maxlevels* was changed from ``10`` to ``sys." "getrecursionlimit()``" msgstr "" +"*stripdir*、*prependdir*、*limit_sl_dest*、*hardlink_dupes* 引数が追加されま" +"した。\n" +"*maxlevels* のデフォルト値が ``10`` から ``sys.getrecursionlimit()`` に変更さ" +"れました。" #: ../../library/compileall.rst:240 msgid "" @@ -438,7 +466,6 @@ msgstr "" "ルが実行される時点でソースファイルが存在しない場合に、トレースバックやその他" "のメッセージに使われるバイトコードファイルにもコンパイルされます。" -#: ../../library/compileall.rst:249 msgid "" "If *rx* is given, its ``search`` method is passed the full path name to the " "file being compiled, and if it returns a true value, the file is not " @@ -446,6 +473,12 @@ msgid "" "matching a regular expression, given as a :ref:`re.Pattern ` " "object." msgstr "" +"*rx* が指定された場合、コンパイル対象のファイルの完全なパス名を、その " +"``search`` メソッドに渡します。\n" +"真の値が返された場合、そのファイルはコンパイルされず、``True`` が返されま" +"す。\n" +":ref:`re.Pattern ` オブジェクトとして渡した正規表現にマッチする" +"ファイルを除外するために使えます。" #: ../../library/compileall.rst:294 msgid "" @@ -487,7 +520,6 @@ msgstr "" ":file:`Lib/` ディレクトリ以下にある全ての :file:`.py` ファイルを強制的に再コ" "ンパイルするには、以下のようにします::" -#: ../../library/compileall.rst:326 msgid "" "import compileall\n" "\n" @@ -501,6 +533,17 @@ msgid "" "import pathlib\n" "compileall.compile_dir(pathlib.Path('Lib/'), force=True)" msgstr "" +"import compileall\n" +"\n" +"compileall.compile_dir('Lib/', force=True)\n" +"\n" +"# .svn ディレクトリ内のファイルを除外して同じコンパイルを実行\n" +"import re\n" +"compileall.compile_dir('Lib/', rx=re.compile(r'[/\\\\][.]svn'), force=True)\n" +"\n" +"# pathlib.Path オブジェクトも使用可能\n" +"import pathlib\n" +"compileall.compile_dir(pathlib.Path('Lib/'), force=True)" #: ../../library/compileall.rst:340 msgid "Module :mod:`py_compile`" diff --git a/library/concurrency.po b/library/concurrency.po index 386b8cb4b..9fb939fae 100644 --- a/library/concurrency.po +++ b/library/concurrency.po @@ -16,17 +16,16 @@ msgstr "" "Last-Translator: tomo, 2021\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/concurrency.rst:5 msgid "Concurrent Execution" msgstr "並行実行" -#: ../../library/concurrency.rst:7 msgid "" "The modules described in this chapter provide support for concurrent " "execution of code. The appropriate choice of tool will depend on the task to " @@ -34,10 +33,11 @@ msgid "" "(event driven cooperative multitasking vs preemptive multitasking). Here's " "an overview:" msgstr "" -"この章で記述されているモジュールは、コードの並行実行のサポートを提供します。" -"ツールの適切な選択は、実行されるタスク(IO bound vs CPU bound) や推奨される開" -"発スタイル (イベントドリブンな協調的マルチタスク vs プリエンプティブマルチタ" -"スク) に依存します。ここに概観を示します:" +"この章で説明するモジュールは、コードの並行実行をサポートします。\n" +"適切なツールは、実行するタスク (CPU バウンドか I/O バウンドか) と、好みの開発" +"スタイル (イベント駆動の協調的マルチタスクかプリエンプティブマルチタスクか) " +"によって異なります。\n" +"概要は以下のとおりです:" #: ../../library/concurrency.rst:27 msgid "The following are support modules for some of the above services:" diff --git a/library/concurrent.futures.po b/library/concurrent.futures.po index 8d7e217b4..63c264fd1 100644 --- a/library/concurrent.futures.po +++ b/library/concurrent.futures.po @@ -22,10 +22,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/concurrent.futures.rst:2 @@ -38,6 +38,9 @@ msgid "" "concurrent/futures/process.py`, and :source:`Lib/concurrent/futures/" "interpreter.py`" msgstr "" +"**ソースコード:** :source:`Lib/concurrent/futures/thread.py`、:source:`Lib/" +"concurrent/futures/process.py` および :source:`Lib/concurrent/futures/" +"interpreter.py`" #: ../../library/concurrent.futures.rst:15 msgid "" @@ -47,17 +50,20 @@ msgstr "" ":mod:`concurrent.futures` モジュールは、非同期に実行できる呼び出し可能オブ" "ジェクトの高水準のインターフェースを提供します。" -#: ../../library/concurrent.futures.rst:18 msgid "" "The asynchronous execution can be performed with threads, using :class:" "`ThreadPoolExecutor` or :class:`InterpreterPoolExecutor`, or separate " "processes, using :class:`ProcessPoolExecutor`. Each implements the same " "interface, which is defined by the abstract :class:`Executor` class." msgstr "" +"非同期実行には、:class:`ThreadPoolExecutor` または :class:" +"`InterpreterPoolExecutor` によるスレッド、あるいは :class:" +"`ProcessPoolExecutor` による別プロセスを使えます。\n" +"いずれも、抽象クラス :class:`Executor` で定義された同じインターフェースを実装" +"しています。" -#: ../../includes/wasm-notavail.rst:3 msgid "Availability" -msgstr "" +msgstr "利用可能な環境" #: ../../includes/wasm-notavail.rst:5 msgid "" @@ -89,32 +95,36 @@ msgstr "" "にスケジュールし、呼び出し可能オブジェクトの実行を表現する :class:`Future` オ" "ブジェクトを返します。 ::" -#: ../../library/concurrent.futures.rst:40 msgid "" "with ThreadPoolExecutor(max_workers=1) as executor:\n" " future = executor.submit(pow, 323, 1235)\n" " print(future.result())" msgstr "" +"with ThreadPoolExecutor(max_workers=1) as executor:\n" +" future = executor.submit(pow, 323, 1235)\n" +" print(future.result())" -#: ../../library/concurrent.futures.rst:46 msgid "Similar to :func:`map(fn, *iterables) ` except:" -msgstr "" +msgstr ":func:`map(fn, *iterables) ` と似ていますが、次の違いがあります:" -#: ../../library/concurrent.futures.rst:48 msgid "" "The *iterables* are collected immediately rather than lazily, unless a " "*buffersize* is specified to limit the number of submitted tasks whose " "results have not yet been yielded. If the buffer is full, iteration over the " "*iterables* pauses until a result is yielded from the buffer." msgstr "" +"結果をまだ yield していない投入済みタスクの数を制限する *buffersize* が指定さ" +"れていない限り、*iterables* の要素は遅延せず、直ちに収集されます。\n" +"バッファがいっぱいになると、バッファから結果が yield されるまで *iterables* " +"の反復処理は一時停止します。" -#: ../../library/concurrent.futures.rst:53 msgid "" "*fn* is executed asynchronously and several calls to *fn* may be made " "concurrently." msgstr "" +"*fn* は非同期に実行され、複数の *fn* の呼び出しが並行して行われる場合がありま" +"す。" -#: ../../library/concurrent.futures.rst:56 msgid "" "The returned iterator raises a :exc:`TimeoutError` if :meth:`~iterator." "__next__` is called and the result isn't available after *timeout* seconds " @@ -124,16 +134,18 @@ msgid "" msgstr "" "もし :meth:`~iterator.__next__` が呼ばれその結果が元々の :meth:`Executor." "map` の呼び出しから *timeout* 秒経った後も利用できない場合、返されるイテレー" -"タは :exc:`TimeoutError` を送出します。*timeout* は整数または浮動小数点数で" -"す。もし *timeout* が指定されないか の場合、待ち時間に制限はありません。" +"タは :exc:`TimeoutError` を送出します。\n" +"*timeout* は整数または浮動小数点数です。\n" +"*timeout* を省略するか ``None`` を指定した場合、待ち時間に制限はありません。" #: ../../library/concurrent.futures.rst:62 msgid "" "If a *fn* call raises an exception, then that exception will be raised when " "its value is retrieved from the iterator." msgstr "" +"もし *fn* の呼び出しが例外を送出した場合、その例外はイテレータから値を受け取" +"る時に送出されます。" -#: ../../library/concurrent.futures.rst:65 msgid "" "When using :class:`ProcessPoolExecutor`, this method chops *iterables* into " "a number of chunks which it submits to the pool as separate tasks. The " @@ -143,14 +155,22 @@ msgid "" "size of 1. With :class:`ThreadPoolExecutor` and :class:" "`InterpreterPoolExecutor`, *chunksize* has no effect." msgstr "" +":class:`ProcessPoolExecutor` を使う場合、このメソッドは *iterables* を複数の" +"チャンクに分割し、それぞれを別々のタスクとしてプールに投入します。\n" +"*chunksize* を正の整数に設定すると、各チャンクのおおよそのサイズを指定できま" +"す。\n" +"非常に長いイテラブルでは、*chunksize* に大きな値を使うと、デフォルトのサイズ " +"1 に比べて性能が大幅に向上する場合があります。\n" +":class:`ThreadPoolExecutor` と :class:`InterpreterPoolExecutor` では、" +"*chunksize* は効果がありません。" #: ../../library/concurrent.futures.rst:74 msgid "Added the *chunksize* parameter." -msgstr "" +msgstr "*chunksize* 引数が追加されました。" #: ../../library/concurrent.futures.rst:77 msgid "Added the *buffersize* parameter." -msgstr "" +msgstr "*buffersize* 引数が追加されました。" #: ../../library/concurrent.futures.rst:82 msgid "" @@ -181,19 +201,24 @@ msgstr "" "れます。 *wait* の値に関係なく、すべての未完了のフューチャの実行が完了するま" "で Python プログラム全体は終了しません。" -#: ../../library/concurrent.futures.rst:95 msgid "" "If *cancel_futures* is ``True``, this method will cancel all pending futures " "that the executor has not started running. Any futures that are completed or " "running won't be cancelled, regardless of the value of *cancel_futures*." msgstr "" +"*cancel_futures* が ``True`` の場合、このメソッドは executor がまだ実行を開始" +"していない未完了のフューチャをすべてキャンセルします。\n" +"すでに完了したフューチャや実行中のフューチャは、*cancel_futures* の値にかかわ" +"らずキャンセルされません。" -#: ../../library/concurrent.futures.rst:100 msgid "" "If both *cancel_futures* and *wait* are ``True``, all futures that the " "executor has started running will be completed prior to this method " "returning. The remaining futures are cancelled." msgstr "" +"*cancel_futures* と *wait* がともに ``True`` の場合、executor が実行を開始し" +"たフューチャはすべて、このメソッドが返る前に完了します。\n" +"残りのフューチャはキャンセルされます。" #: ../../library/concurrent.futures.rst:104 msgid "" @@ -206,7 +231,6 @@ msgstr "" "(*wait* を ``True`` にセットして :meth:`Executor.shutdown` が呼ばれたかのよう" "に待ちます)。" -#: ../../library/concurrent.futures.rst:109 msgid "" "import shutil\n" "with ThreadPoolExecutor(max_workers=4) as e:\n" @@ -215,6 +239,12 @@ msgid "" " e.submit(shutil.copy, 'src3.txt', 'dest3.txt')\n" " e.submit(shutil.copy, 'src4.txt', 'dest4.txt')" msgstr "" +"import shutil\n" +"with ThreadPoolExecutor(max_workers=4) as e:\n" +" e.submit(shutil.copy, 'src1.txt', 'dest1.txt')\n" +" e.submit(shutil.copy, 'src2.txt', 'dest2.txt')\n" +" e.submit(shutil.copy, 'src3.txt', 'dest3.txt')\n" +" e.submit(shutil.copy, 'src4.txt', 'dest4.txt')" #: ../../library/concurrent.futures.rst:116 msgid "Added *cancel_futures*." @@ -240,7 +270,6 @@ msgstr "" ":class:`Future` に関連づけられた呼び出し可能オブジェクトが、別の :class:" "`Future` の結果を待つ時にデッドロックすることがあります。例::" -#: ../../library/concurrent.futures.rst:129 msgid "" "import time\n" "def wait_on_b():\n" @@ -258,6 +287,21 @@ msgid "" "a = executor.submit(wait_on_b)\n" "b = executor.submit(wait_on_a)" msgstr "" +"import time\n" +"def wait_on_b():\n" +" time.sleep(5)\n" +" print(b.result()) # b は a を待っているため完了しない\n" +" return 5\n" +"\n" +"def wait_on_a():\n" +" time.sleep(5)\n" +" print(a.result()) # a は b を待っているため完了しない\n" +" return 6\n" +"\n" +"\n" +"executor = ThreadPoolExecutor(max_workers=2)\n" +"a = executor.submit(wait_on_b)\n" +"b = executor.submit(wait_on_a)" #: ../../library/concurrent.futures.rst:145 msgid "And::" @@ -283,7 +327,6 @@ msgstr "" "最大で *max_workers* 個のスレッドを非同期実行に使う :class:`Executor` のサブ" "クラスです。" -#: ../../library/concurrent.futures.rst:162 msgid "" "All threads enqueued to ``ThreadPoolExecutor`` will be joined before the " "interpreter can exit. Note that the exit handler which does this is executed " @@ -292,8 +335,15 @@ msgid "" "exit gracefully. For this reason, it is recommended that " "``ThreadPoolExecutor`` not be used for long-running tasks." msgstr "" +"``ThreadPoolExecutor`` に登録されたすべてのスレッドは、インタープリタの終了前" +"に join されます。\n" +"この処理を行う終了ハンドラは、``atexit`` で追加した終了ハンドラよりも *前に* " +"実行されることに注意してください。\n" +"そのため、スレッドに正常終了を指示できるように、メインスレッドの例外を捕捉し" +"て処理しなければなりません。\n" +"この理由から、長時間実行するタスクには ``ThreadPoolExecutor`` を使わないこと" +"を推奨します。" -#: ../../library/concurrent.futures.rst:169 msgid "" "*initializer* is an optional callable that is called at the start of each " "worker thread; *initargs* is a tuple of arguments passed to the " @@ -301,6 +351,12 @@ msgid "" "jobs will raise a :exc:`~concurrent.futures.thread.BrokenThreadPool`, as " "well as any attempt to submit more jobs to the pool." msgstr "" +"*initializer* は省略可能な呼び出し可能オブジェクトで、各ワーカースレッドの開" +"始時に呼び出されます。\n" +"*initargs* は、この初期化処理に渡す引数のタプルです。\n" +"*initializer* が例外を送出した場合、現在未完了のジョブはすべて :exc:" +"`~concurrent.futures.thread.BrokenThreadPool` を送出し、プールへの新たなジョ" +"ブの投入も同じ例外を送出します。" #: ../../library/concurrent.futures.rst:175 msgid "" @@ -322,37 +378,46 @@ msgid "" "class:`threading.Thread` names for worker threads created by the pool for " "easier debugging." msgstr "" +"*thread_name_prefix* 引数が追加され、デバッグしやすくなるようにプールから作ら" +"れたワーカスレッド :class:`threading.Thread` の名前を管理できるようになりまし" +"た。" #: ../../library/concurrent.futures.rst:188 #: ../../library/concurrent.futures.rst:401 msgid "Added the *initializer* and *initargs* arguments." msgstr "*initializer* と *initargs* 引数が追加されました。" -#: ../../library/concurrent.futures.rst:191 msgid "" "Default value of *max_workers* is changed to ``min(32, os.cpu_count() + " "4)``. This default value preserves at least 5 workers for I/O bound tasks. " "It utilizes at most 32 CPU cores for CPU bound tasks which release the GIL. " "And it avoids using very large resources implicitly on many-core machines." msgstr "" +"*max_workers* のデフォルト値が ``min(32, os.cpu_count() + 4)`` に変更されまし" +"た。\n" +"このデフォルト値により、I/O バウンドのタスクには少なくとも 5 個のワーカーが確" +"保されます。\n" +"GIL を解放する CPU バウンドのタスクには最大 32 個の CPU コアを利用します。\n" +"また、多数のコアを持つマシンで暗黙に大量のリソースを使うことを避けられます。" -#: ../../library/concurrent.futures.rst:197 msgid "" "ThreadPoolExecutor now reuses idle worker threads before starting " "*max_workers* worker threads too." msgstr "" +"ThreadPoolExecutor は、*max_workers* 個のワーカースレッドを起動する前に、待機" +"中のワーカースレッドを再利用するようにもなりました。" -#: ../../library/concurrent.futures.rst:200 msgid "" "Default value of *max_workers* is changed to ``min(32, (os." "process_cpu_count() or 1) + 4)``." msgstr "" +"*max_workers* のデフォルト値が ``min(32, (os.process_cpu_count() or 1) + " +"4)`` に変更されました。" #: ../../library/concurrent.futures.rst:208 msgid "ThreadPoolExecutor Example" msgstr "ThreadPoolExecutor の例" -#: ../../library/concurrent.futures.rst:211 msgid "" "import concurrent.futures\n" "import urllib.request\n" @@ -382,12 +447,38 @@ msgid "" " else:\n" " print('%r page is %d bytes' % (url, len(data)))" msgstr "" +"import concurrent.futures\n" +"import urllib.request\n" +"\n" +"URLS = ['http://www.foxnews.com/',\n" +" 'http://www.cnn.com/',\n" +" 'http://europe.wsj.com/',\n" +" 'http://www.bbc.co.uk/',\n" +" 'http://nonexistent-subdomain.python.org/']\n" +"\n" +"# 一つのページを取得し、URL と内容を報告する\n" +"def load_url(url, timeout):\n" +" with urllib.request.urlopen(url, timeout=timeout) as conn:\n" +" return conn.read()\n" +"\n" +"# with 文を使えばスレッドを速やかに後始末できる\n" +"with concurrent.futures.ThreadPoolExecutor(max_workers=5) as executor:\n" +" # 読み込みを開始し、各フューチャに URL を対応付ける\n" +" future_to_url = {executor.submit(load_url, url, 60): url for url in " +"URLS}\n" +" for future in concurrent.futures.as_completed(future_to_url):\n" +" url = future_to_url[future]\n" +" try:\n" +" data = future.result()\n" +" except Exception as exc:\n" +" print('%r generated an exception: %s' % (url, exc))\n" +" else:\n" +" print('%r page is %d bytes' % (url, len(data)))" #: ../../library/concurrent.futures.rst:240 msgid "InterpreterPoolExecutor" -msgstr "" +msgstr "InterpreterPoolExecutor" -#: ../../library/concurrent.futures.rst:242 msgid "" "The :class:`InterpreterPoolExecutor` class uses a pool of interpreters to " "execute calls asynchronously. It is a :class:`ThreadPoolExecutor` subclass, " @@ -395,8 +486,13 @@ msgid "" "that each worker has its own interpreter, and runs each task using that " "interpreter." msgstr "" +":class:`InterpreterPoolExecutor` クラスは、インタープリタのプールを使って呼び" +"出しを非同期に実行します。\n" +":class:`ThreadPoolExecutor` のサブクラスなので、各ワーカーはそれぞれのスレッ" +"ドで動作します。\n" +"異なる点は、各ワーカーが専用のインタープリタを持ち、それを使って各タスクを実" +"行することです。" -#: ../../library/concurrent.futures.rst:248 msgid "" "The biggest benefit to using interpreters instead of only threads is true " "multi-core parallelism. Each interpreter has its own :term:`Global " @@ -404,8 +500,13 @@ msgid "" "interpreter can run on one CPU core, while code in another interpreter runs " "unblocked on a different core." msgstr "" +"スレッドだけを使う代わりにインタープリタを使う最大の利点は、複数のコアで真に" +"並列実行できることです。\n" +"各インタープリタはそれぞれの :term:`グローバルインタープリタロック ` を持ちます。\n" +"そのため、一つのインタープリタのコードをある CPU コアで実行しながら、別のイン" +"タープリタのコードを他のコアで、妨げられることなく実行できます。" -#: ../../library/concurrent.futures.rst:254 msgid "" "The tradeoff is that writing concurrent code for use with multiple " "interpreters can take extra effort. However, this is because it forces you " @@ -417,6 +518,16 @@ msgid "" "deal with several of the big pain points of using threads, like race " "conditions." msgstr "" +"その代わり、複数のインタープリタを使う並行コードの作成には、追加の手間がかか" +"る場合があります。\n" +"しかしこれは、インタープリタがいつ、どのようにやり取りするかを慎重に考え、共" +"有するデータを明示する必要があるためです。\n" +"このことは、複数コアでの真の並列実行をはじめ、追加の手間に見合ういくつかの利" +"点につながります。\n" +"例えば、このように書かれたコードでは、並行処理の振る舞いを考えやすくなる場合" +"があります。\n" +"競合状態など、スレッドを使う際の大きな問題のいくつかに対処せずに済むことも、" +"大きな利点です。" #: ../../library/concurrent.futures.rst:264 msgid "" @@ -432,7 +543,6 @@ msgid "" "``__main__``." msgstr "" -#: ../../library/concurrent.futures.rst:276 msgid "" "Isolation means a mutable object, or other data, cannot be used by more than " "one interpreter at the same time. That effectively means interpreters " @@ -441,16 +551,27 @@ msgid "" "copies manually. Immutable objects and data, like the builtin singletons, " "strings, and tuples of immutable objects, don't have these limitations." msgstr "" +"分離されているため、ミュータブルなオブジェクトやその他のデータを、複数のイン" +"タープリタで同時に使うことはできません。\n" +"実質的に、インタープリタ間でそのようなオブジェクトやデータを共有することはで" +"きないということです。\n" +"各インタープリタはそれぞれのコピーを持たなければならず、コピー間の変更は手動" +"で同期する必要があります。\n" +"組み込みのシングルトン、文字列、イミュータブルなオブジェクトからなるタプルな" +"ど、イミュータブルなオブジェクトやデータにはこの制約がありません。" -#: ../../library/concurrent.futures.rst:284 msgid "" "Communicating and synchronizing between interpreters is most effectively " "done using dedicated tools, like those proposed in :pep:`734`. One less " "efficient alternative is to serialize with :mod:`pickle` and then send the " "bytes over a shared :mod:`socket ` or :func:`pipe `." msgstr "" +"インタープリタ間の通信や同期には、:pep:`734` で提案されたような専用のツールを" +"使うのが最も効率的です。\n" +"効率は劣りますが、:mod:`pickle` でシリアライズしてから、共有の :mod:`ソケッ" +"ト ` や :func:`パイプ ` を介してバイト列を送る方法もありま" +"す。" -#: ../../library/concurrent.futures.rst:292 msgid "" "A :class:`ThreadPoolExecutor` subclass that executes calls asynchronously " "using a pool of at most *max_workers* threads. Each thread runs tasks in " @@ -460,8 +581,15 @@ msgid "" "Interpreter Lock `, which means code run with this " "executor has true multi-core parallelism." msgstr "" +"最大 *max_workers* 個のスレッドからなるプールを使い、呼び出しを非同期に実行す" +"る :class:`ThreadPoolExecutor` のサブクラスです。\n" +"各スレッドは専用のインタープリタでタスクを実行します。\n" +"ワーカーのインタープリタは互いに分離されているため、それぞれが独自の実行時の" +"状態を持ち、ミュータブルなオブジェクトやその他のデータを共有できません。\n" +"各インタープリタはそれぞれの :term:`グローバルインタープリタロック ` を持つため、この executor で実行するコードは複数のコアで真" +"に並列実行できます。" -#: ../../library/concurrent.futures.rst:300 msgid "" "The optional *initializer* and *initargs* arguments have the same meaning as " "for :class:`!ThreadPoolExecutor`: the initializer is run when each worker is " @@ -469,6 +597,12 @@ msgid "" "executor serializes the *initializer* and *initargs* using :mod:`pickle` " "when sending them to the worker's interpreter." msgstr "" +"省略可能な *initializer* と *initargs* 引数の意味は :class:`!" +"ThreadPoolExecutor` と同じです。\n" +"初期化処理は各ワーカーの作成時に実行されますが、この場合はワーカーのインター" +"プリタ内で実行されます。\n" +"executor は、*initializer* と *initargs* をワーカーのインタープリタに送る際" +"に :mod:`pickle` でシリアライズします。" #: ../../library/concurrent.futures.rst:308 #: ../../library/concurrent.futures.rst:330 @@ -492,17 +626,20 @@ msgid "" "and :class:`memoryview`. See :pep:`734` for more info." msgstr "" -#: ../../library/concurrent.futures.rst:322 msgid "Other caveats from parent :class:`ThreadPoolExecutor` apply here." msgstr "" +"親クラス :class:`ThreadPoolExecutor` のその他の注意事項も当てはまります。" -#: ../../library/concurrent.futures.rst:324 msgid "" ":meth:`~Executor.submit` and :meth:`~Executor.map` work like normal, except " "the worker serializes the callable and arguments using :mod:`pickle` when " "sending them to its interpreter. The worker likewise serializes the return " "value when sending it back." msgstr "" +":meth:`~Executor.submit` と :meth:`~Executor.map` は通常どおり動作しますが、" +"ワーカーが呼び出し可能オブジェクトと引数を自分のインタープリタに送る際に :" +"mod:`pickle` でシリアライズする点が異なります。\n" +"戻り値を送り返す際にも、同様にシリアライズします。" #: ../../library/concurrent.futures.rst:333 msgid "" @@ -553,7 +690,6 @@ msgstr "" ":class:`ProcessPoolExecutor` に渡された呼び出し可能オブジェクトから :class:" "`Executor` や :class:`Future` メソッドを呼ぶとデッドロックに陥ります。" -#: ../../library/concurrent.futures.rst:362 msgid "" "An :class:`Executor` subclass that executes calls asynchronously using a " "pool of at most *max_workers* processes. If *max_workers* is ``None`` or " @@ -567,8 +703,21 @@ msgid "" "given, the default :mod:`multiprocessing` context is used. See :ref:" "`multiprocessing-start-methods`." msgstr "" +"最大 *max_workers* 個のプロセスからなるプールを使い、呼び出しを非同期に実行す" +"る :class:`Executor` のサブクラスです。\n" +"*max_workers* が ``None`` または省略された場合、デフォルトで :func:`os." +"process_cpu_count` が使われます。\n" +"*max_workers* が ``0`` 以下の場合は :exc:`ValueError` を送出します。\n" +"Windows では、*max_workers* は ``61`` 以下でなければなりません。\n" +"そうでない場合は :exc:`ValueError` を送出します。\n" +"*max_workers* が ``None`` の場合、利用可能なプロセッサ数がそれより多くても、" +"デフォルトで選択される値は最大 ``61`` です。\n" +"*mp_context* には :mod:`multiprocessing` のコンテキストまたは ``None`` を指定" +"でき、ワーカーの起動に使われます。\n" +"*mp_context* が ``None`` または省略された場合、デフォルトの :mod:" +"`multiprocessing` コンテキストが使われます。\n" +":ref:`multiprocessing-start-methods` を参照してください。" -#: ../../library/concurrent.futures.rst:376 msgid "" "*initializer* is an optional callable that is called at the start of each " "worker process; *initargs* is a tuple of arguments passed to the " @@ -576,8 +725,13 @@ msgid "" "jobs will raise a :exc:`~concurrent.futures.process.BrokenProcessPool`, as " "well as any attempt to submit more jobs to the pool." msgstr "" +"*initializer* は省略可能な呼び出し可能オブジェクトで、各ワーカープロセスの開" +"始時に呼び出されます。\n" +"*initargs* は、この初期化処理に渡す引数のタプルです。\n" +"*initializer* が例外を送出した場合、現在未完了のジョブはすべて :exc:" +"`~concurrent.futures.process.BrokenProcessPool` を送出し、プールへの新たな" +"ジョブの投入も同じ例外を送出します。" -#: ../../library/concurrent.futures.rst:382 msgid "" "*max_tasks_per_child* is an optional argument that specifies the maximum " "number of tasks a single process can execute before it will exit and be " @@ -587,6 +741,13 @@ msgid "" "default in absence of a *mp_context* parameter. This feature is incompatible " "with the \"fork\" start method." msgstr "" +"*max_tasks_per_child* は省略可能な引数で、一つのプロセスが終了して新しいワー" +"カープロセスに置き換わるまでに実行できるタスクの最大数を指定します。\n" +"デフォルトの *max_tasks_per_child* は ``None`` で、ワーカープロセスはプールが" +"存在する限り存続します。\n" +"最大数を指定し、*mp_context* パラメータを指定しなかった場合、デフォルトでは " +"multiprocessing の開始方式に \"spawn\" が使われます。\n" +"この機能は \"fork\" 開始方式とは併用できません。" #: ../../library/concurrent.futures.rst:390 msgid "" @@ -595,20 +756,25 @@ msgid "" "behaviour was undefined but operations on the executor or its futures would " "often freeze or deadlock." msgstr "" +"ワーカプロセスの1つが突然終了した場合、:exc:`~concurrent.futures.process." +"BrokenProcessPool` エラーが送出されるようになりました。\n" +"以前は挙動は未定義でしたが、 executor や futures がフリーズしたりデッドロッ" +"クを起こすことがしばしばでした。" -#: ../../library/concurrent.futures.rst:397 msgid "" "The *mp_context* argument was added to allow users to control the " "start_method for worker processes created by the pool." msgstr "" +"プールが作成するワーカープロセスの開始方式を利用者が制御できるよう、" +"*mp_context* 引数が追加されました。" -#: ../../library/concurrent.futures.rst:403 msgid "" "The *max_tasks_per_child* argument was added to allow users to control the " "lifetime of workers in the pool." msgstr "" +"プール内のワーカーの存続期間を利用者が制御できるよう、*max_tasks_per_child* " +"引数が追加されました。" -#: ../../library/concurrent.futures.rst:407 msgid "" "On POSIX systems, if your application has multiple threads and the :mod:" "`multiprocessing` context uses the ``\"fork\"`` start method: The :func:`os." @@ -616,49 +782,66 @@ msgid "" "`DeprecationWarning`. Pass a *mp_context* configured to use a different " "start method. See the :func:`os.fork` documentation for further explanation." msgstr "" +"POSIX システムで、アプリケーションが複数のスレッドを持ち、:mod:" +"`multiprocessing` コンテキストが ``\"fork\"`` 開始方式を使う場合、ワーカーを" +"起動するために内部で呼び出す :func:`os.fork` 関数が :exc:" +"`DeprecationWarning` を送出することがあります。\n" +"別の開始方式を使うように設定した *mp_context* を渡してください。\n" +"詳しくは :func:`os.fork` のドキュメントを参照してください。" -#: ../../library/concurrent.futures.rst:415 msgid "" "*max_workers* uses :func:`os.process_cpu_count` by default, instead of :func:" "`os.cpu_count`." msgstr "" +"*max_workers* のデフォルトで、:func:`os.cpu_count` の代わりに :func:`os." +"process_cpu_count` を使うようになりました。" -#: ../../library/concurrent.futures.rst:419 msgid "" "The default process start method (see :ref:`multiprocessing-start-methods`) " "changed away from *fork*. If you require the *fork* start method for :class:" "`ProcessPoolExecutor` you must explicitly pass ``mp_context=multiprocessing." "get_context(\"fork\")``." msgstr "" +"プロセスのデフォルトの開始方式 (:ref:`multiprocessing-start-methods` を参照) " +"が *fork* 以外に変更されました。\n" +":class:`ProcessPoolExecutor` で *fork* 開始方式が必要な場合は、" +"``mp_context=multiprocessing.get_context(\"fork\")`` を明示的に渡さなければな" +"りません。" -#: ../../library/concurrent.futures.rst:427 msgid "" "Attempt to terminate all living worker processes immediately by calling :" "meth:`Process.terminate ` on each of " "them. Internally, it will also call :meth:`Executor.shutdown` to ensure that " "all other resources associated with the executor are freed." msgstr "" +"存続中のすべてのワーカープロセスについて :meth:`Process.terminate " +"` を呼び出し、直ちに終了させようとしま" +"す。\n" +"executor に関連するその他のリソースをすべて解放するため、内部では :meth:" +"`Executor.shutdown` も呼び出します。" -#: ../../library/concurrent.futures.rst:432 -#: ../../library/concurrent.futures.rst:444 msgid "" "After calling this method the caller should no longer submit tasks to the " "executor." msgstr "" +"このメソッドを呼び出した後は、executor にタスクを投入しないでください。" -#: ../../library/concurrent.futures.rst:439 msgid "" "Attempt to kill all living worker processes immediately by calling :meth:" "`Process.kill ` on each of them. Internally, " "it will also call :meth:`Executor.shutdown` to ensure that all other " "resources associated with the executor are freed." msgstr "" +"存続中のすべてのワーカープロセスについて :meth:`Process.kill " +"` を呼び出し、直ちに強制終了させようとしま" +"す。\n" +"executor に関連するその他のリソースをすべて解放するため、内部では :meth:" +"`Executor.shutdown` も呼び出します。" #: ../../library/concurrent.futures.rst:452 msgid "ProcessPoolExecutor Example" msgstr "ProcessPoolExecutor の例" -#: ../../library/concurrent.futures.rst:455 msgid "" "import concurrent.futures\n" "import math\n" @@ -693,6 +876,38 @@ msgid "" "if __name__ == '__main__':\n" " main()" msgstr "" +"import concurrent.futures\n" +"import math\n" +"\n" +"PRIMES = [\n" +" 112272535095293,\n" +" 112582705942171,\n" +" 112272535095293,\n" +" 115280095190773,\n" +" 115797848077099,\n" +" 1099726899285419]\n" +"\n" +"def is_prime(n):\n" +" if n < 2:\n" +" return False\n" +" if n == 2:\n" +" return True\n" +" if n % 2 == 0:\n" +" return False\n" +"\n" +" sqrt_n = int(math.floor(math.sqrt(n)))\n" +" for i in range(3, sqrt_n + 1, 2):\n" +" if n % i == 0:\n" +" return False\n" +" return True\n" +"\n" +"def main():\n" +" with concurrent.futures.ProcessPoolExecutor() as executor:\n" +" for number, prime in zip(PRIMES, executor.map(is_prime, PRIMES)):\n" +" print('%d is prime: %s' % (number, prime))\n" +"\n" +"if __name__ == '__main__':\n" +" main()" #: ../../library/concurrent.futures.rst:490 msgid "Future Objects" @@ -717,13 +932,16 @@ msgstr "" "スタンスは :meth:`Executor.submit` で生成され、テストを除いて直接生成すべきで" "はありません。" -#: ../../library/concurrent.futures.rst:503 msgid "" "Attempt to cancel the call. If the call is currently being executed or " "finished running and cannot be cancelled then the method will return " "``False``, otherwise the call will be cancelled and the method will return " "``True``." msgstr "" +"呼び出しのキャンセルを試みます。\n" +"呼び出しがすでに実行中または実行済みで、キャンセルできない場合は ``False`` を" +"返します。\n" +"それ以外の場合は呼び出しをキャンセルして ``True`` を返します。" #: ../../library/concurrent.futures.rst:510 msgid "Return ``True`` if the call was successfully cancelled." @@ -763,10 +981,9 @@ msgstr "" "future が完了する前にキャンセルされた場合 :exc:`CancelledError` が送出されま" "す。" -#: ../../library/concurrent.futures.rst:534 msgid "" "If the call raised an exception, this method will raise the same exception." -msgstr "" +msgstr "呼び出しが例外を送出した場合、このメソッドも同じ例外を送出します。" #: ../../library/concurrent.futures.rst:538 msgid "" @@ -826,14 +1043,13 @@ msgstr "" "以下の :class:`Future` メソッドは、ユニットテストでの使用と :class:" "`Executor` を実装することを意図しています。" -#: ../../library/concurrent.futures.rst:570 msgid "" "This method should only be called by :class:`Executor` implementations " "before executing the work associated with the :class:`Future` and by unit " "tests." msgstr "" -"このメソッドは、:class:`Future` に関連付けられたワークやユニットテストによる" -"ワークの実行前に、 :class:`Executor` の実装によってのみ呼び出してください。" +"このメソッドを呼び出してよいのは、:class:`Future` に関連付けられた処理を実行" +"する前の :class:`Executor` の実装と、ユニットテストだけです。" #: ../../library/concurrent.futures.rst:574 msgid "" @@ -847,24 +1063,21 @@ msgstr "" "class:`Future` の完了を (:func:`as_completed` または :func:`wait` により) " "待機するすべてのスレッドが起動します。" -#: ../../library/concurrent.futures.rst:579 msgid "" "If the method returns ``True`` then the :class:`Future` was not cancelled " "and has been put in the running state, i.e. calls to :meth:`Future.running` " "will return ``True``." msgstr "" -"このメソッドが ``True`` を返す場合、 :class:`Future` はキャンセルされて、実行" -"状態に移行されています。つまり、 :meth:`Future.running` を呼び出すと " -"``True`` が返ります。" +"このメソッドが ``True`` を返す場合、 :class:`Future` はキャンセルされておら" +"ず、実行状態に移行しています。\n" +"つまり、 :meth:`Future.running` を呼び出すと ``True`` が返ります。" -#: ../../library/concurrent.futures.rst:583 msgid "" "This method can only be called once and cannot be called after :meth:`Future." "set_result` or :meth:`Future.set_exception` have been called." msgstr "" -"このメソッドは、一度だけ呼び出すことができ、:meth:`Future.set_result` また" -"は :meth:`Future.set_exception` がキャンセルされた後には呼び出すことができま" -"せん。" +"このメソッドは一度だけ呼び出すことができ、:meth:`Future.set_result` または :" +"meth:`Future.set_exception` が呼び出された後には呼び出すことができません。" #: ../../library/concurrent.futures.rst:589 msgid "" @@ -880,12 +1093,12 @@ msgstr "" "このメソッドは、 :class:`Executor` の実装またはユニットテストによってのみ使用" "してください。" -#: ../../library/concurrent.futures.rst:595 -#: ../../library/concurrent.futures.rst:608 msgid "" "This method raises :exc:`concurrent.futures.InvalidStateError` if the :class:" "`Future` is already done." msgstr "" +":class:`Future` がすでに完了している場合、このメソッドは :exc:`concurrent." +"futures.InvalidStateError` を送出します。" #: ../../library/concurrent.futures.rst:602 msgid "" @@ -899,7 +1112,6 @@ msgstr "" msgid "Module Functions" msgstr "モジュール関数" -#: ../../library/concurrent.futures.rst:618 msgid "" "Wait for the :class:`Future` instances (possibly created by different :class:" "`Executor` instances) given by *fs* to complete. Duplicate futures given to " @@ -909,6 +1121,14 @@ msgid "" "named ``not_done``, contains the futures that did not complete (pending or " "running futures)." msgstr "" +"*fs* で指定された :class:`Future` インスタンス (異なる :class:`Executor` イン" +"スタンスで作成されたものでも可) が完了するまで待機します。\n" +"*fs* に重複して指定されたフューチャは一つにまとめられ、一度だけ返されます。\n" +"集合を要素とする、要素数 2 の名前付きタプルを返します。\n" +"最初の集合 ``done`` には、待機が終わるまでに完了したフューチャ (実行済みまた" +"はキャンセル済みのフューチャ) が含まれます。\n" +"二つ目の集合 ``not_done`` には、完了していないフューチャ (保留中または実行中" +"のフューチャ) が含まれます。" #: ../../library/concurrent.futures.rst:626 msgid "" @@ -940,18 +1160,18 @@ msgstr "説明" msgid "The function will return when any future finishes or is cancelled." msgstr "いずれかのフューチャが終了したかキャンセルされたときに返します。" -#: ../../library/concurrent.futures.rst:643 msgid "" "The function will return when any future finishes by raising an exception. " "If no future raises an exception then it is equivalent to :const:" "`ALL_COMPLETED`." msgstr "" +"いずれかのフューチャが例外を送出して終了すると、この関数は返ります。\n" +"例外を送出するフューチャがない場合は、:const:`ALL_COMPLETED` と等価です。" #: ../../library/concurrent.futures.rst:648 msgid "The function will return when all futures finish or are cancelled." msgstr "すべてのフューチャが終了したかキャンセルされたときに返します。" -#: ../../library/concurrent.futures.rst:652 msgid "" "Returns an iterator over the :class:`Future` instances (possibly created by " "different :class:`Executor` instances) given by *fs* that yields futures as " @@ -963,6 +1183,17 @@ msgid "" "original call to :func:`as_completed`. *timeout* can be an int or float. If " "*timeout* is not specified or ``None``, there is no limit to the wait time." msgstr "" +"*fs* で指定された :class:`Future` インスタンス (異なる :class:`Executor` イン" +"スタンスで作成されたものでも可) を、完了するたびに (実行済みまたはキャンセル" +"済みになった順に) yield するイテレータを返します。\n" +"*fs* に重複して指定されたフューチャは、一度だけ返されます。\n" +":func:`as_completed` の呼び出し前に完了していたフューチャが、最初に yield さ" +"れます。\n" +"返されたイテレータの :meth:`~iterator.__next__` が呼び出された際、最初の :" +"func:`as_completed` の呼び出しから *timeout* 秒が経過しても結果を取得できなけ" +"れば、:exc:`TimeoutError` を送出します。\n" +"*timeout* には整数または浮動小数点数を指定できます。\n" +"*timeout* が省略された場合や ``None`` の場合は、待ち時間に制限はありません。" #: ../../library/concurrent.futures.rst:665 msgid ":pep:`3148` -- futures - execute computations asynchronously" @@ -982,42 +1213,50 @@ msgstr "例外クラス" msgid "Raised when a future is cancelled." msgstr "future がキャンセルされたときに送出されます。" -#: ../../library/concurrent.futures.rst:681 msgid "" "A deprecated alias of :exc:`TimeoutError`, raised when a future operation " "exceeds the given timeout." msgstr "" +":exc:`TimeoutError` の非推奨のエイリアスです。\n" +"フューチャの操作が指定されたタイムアウトを超えた場合に送出されます。" #: ../../library/concurrent.futures.rst:686 msgid "This class was made an alias of :exc:`TimeoutError`." msgstr "このクラスは :exc:`TimeoutError` のエイリアスになりました。" -#: ../../library/concurrent.futures.rst:691 msgid "" "Derived from :exc:`RuntimeError`, this exception class is raised when an " "executor is broken for some reason, and cannot be used to submit or execute " "new tasks." msgstr "" +":exc:`RuntimeError` の派生クラスです。\n" +"何らかの理由で executor が壊れて、新しいタスクの投入や実行に使えなくなった場" +"合に送出されます。" -#: ../../library/concurrent.futures.rst:699 msgid "" "Raised when an operation is performed on a future that is not allowed in the " "current state." msgstr "" +"フューチャに対して、現在の状態では許可されていない操作を行った場合に送出され" +"ます。" -#: ../../library/concurrent.futures.rst:708 msgid "" "Derived from :exc:`~concurrent.futures.BrokenExecutor`, this exception class " "is raised when one of the workers of a :class:`~concurrent.futures." "ThreadPoolExecutor` has failed initializing." msgstr "" +":exc:`~concurrent.futures.BrokenExecutor` の派生クラスです。\n" +":class:`~concurrent.futures.ThreadPoolExecutor` のワーカーのいずれかで初期化" +"に失敗した場合に送出されます。" -#: ../../library/concurrent.futures.rst:719 msgid "" "Derived from :exc:`~concurrent.futures.thread.BrokenThreadPool`, this " "exception class is raised when one of the workers of a :class:`~concurrent." "futures.InterpreterPoolExecutor` has failed initializing." msgstr "" +":exc:`~concurrent.futures.thread.BrokenThreadPool` の派生クラスです。\n" +":class:`~concurrent.futures.InterpreterPoolExecutor` のワーカーのいずれかで初" +"期化に失敗した場合に送出されます。" #: ../../library/concurrent.futures.rst:728 msgid "" @@ -1026,10 +1265,13 @@ msgid "" "when there's an uncaught exception from the submitted task." msgstr "" -#: ../../library/concurrent.futures.rst:739 msgid "" "Derived from :exc:`~concurrent.futures.BrokenExecutor` (formerly :exc:" "`RuntimeError`), this exception class is raised when one of the workers of " "a :class:`~concurrent.futures.ProcessPoolExecutor` has terminated in a non-" "clean fashion (for example, if it was killed from the outside)." msgstr "" +":exc:`~concurrent.futures.BrokenExecutor` (以前は :exc:`RuntimeError`) の派生" +"クラスです。\n" +":class:`~concurrent.futures.ProcessPoolExecutor` のワーカーのいずれかが正常で" +"ない形で終了した場合 (例えば、外部から強制終了された場合) に送出されます。" diff --git a/library/concurrent.po b/library/concurrent.po index c4d0f276c..3b8123a4b 100644 --- a/library/concurrent.po +++ b/library/concurrent.po @@ -17,10 +17,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/concurrent.rst:2 diff --git a/library/configparser.po b/library/configparser.po index 88aec4096..26d26c499 100644 --- a/library/configparser.po +++ b/library/configparser.po @@ -25,10 +25,10 @@ msgstr "" "Last-Translator: Takeshi Nakazato, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/configparser.rst:2 @@ -51,23 +51,24 @@ msgstr "" "ラスを使ってユーザーが簡単にカスタマイズできる Python プログラムを作ることが" "できます。" -#: ../../library/configparser.rst:31 msgid "" "This library does *not* interpret or write the value-type prefixes used in " "the Windows Registry extended version of INI syntax." msgstr "" -"このライブラリでは、Windowsのレジストリ用に拡張された INI 文法はサポート *し" -"ていません* 。" +"このライブラリは、Windows レジストリ用に拡張された INI 構文で使われる値の型を" +"表す接頭辞を解釈したり書き込んだりは *しません*。" #: ../../library/configparser.rst:36 msgid "Module :mod:`tomllib`" msgstr "モジュール :mod:`tomllib`" -#: ../../library/configparser.rst:37 msgid "" "TOML is a well-specified format for application configuration files. It is " "specifically designed to be an improved version of INI." msgstr "" +"TOML は、アプリケーションの設定ファイル向けに仕様が明確に定められた形式で" +"す。\n" +"INI を改善することを目的に設計されています。" #: ../../library/configparser.rst:40 msgid "Module :mod:`shlex`" @@ -85,11 +86,12 @@ msgstr "" msgid "Module :mod:`json`" msgstr ":mod:`json` モジュール" -#: ../../library/configparser.rst:45 msgid "" "The ``json`` module implements a subset of JavaScript syntax which is " "sometimes used for configuration, but does not support comments." msgstr "" +"``json`` モジュールは JavaScript の構文のサブセットを実装しています。\n" +"設定に使われることもありますが、コメントはサポートしません。" #: ../../library/configparser.rst:61 msgid "Quick Start" @@ -99,7 +101,6 @@ msgstr "クイックスタート" msgid "Let's take a very basic configuration file that looks like this:" msgstr "次のような、非常に簡単な設定ファイルを例に考えましょう:" -#: ../../library/configparser.rst:65 msgid "" "[DEFAULT]\n" "ServerAliveInterval = 45\n" @@ -114,6 +115,18 @@ msgid "" "Port = 50022\n" "ForwardX11 = no" msgstr "" +"[DEFAULT]\n" +"ServerAliveInterval = 45\n" +"Compression = yes\n" +"CompressionLevel = 9\n" +"ForwardX11 = yes\n" +"\n" +"[forge.example]\n" +"User = hg\n" +"\n" +"[topsecret.server.example]\n" +"Port = 50022\n" +"ForwardX11 = no" #: ../../library/configparser.rst:80 msgid "" @@ -130,7 +143,6 @@ msgstr "" ":mod:`configparser` のクラス群はそれらのファイルを読み書きできます。\n" "まずは上のような設定ファイルをプログラムから作成してみましょう。" -#: ../../library/configparser.rst:86 msgid "" ">>> import configparser\n" ">>> config = configparser.ConfigParser()\n" @@ -148,6 +160,21 @@ msgid "" "... config.write(configfile)\n" "..." msgstr "" +">>> import configparser\n" +">>> config = configparser.ConfigParser()\n" +">>> config['DEFAULT'] = {'ServerAliveInterval': '45',\n" +"... 'Compression': 'yes',\n" +"... 'CompressionLevel': '9'}\n" +">>> config['forge.example'] = {}\n" +">>> config['forge.example']['User'] = 'hg'\n" +">>> config['topsecret.server.example'] = {}\n" +">>> topsecret = config['topsecret.server.example']\n" +">>> topsecret['Port'] = '50022' # パーサーを変更する\n" +">>> topsecret['ForwardX11'] = 'no' # ここも同様\n" +">>> config['DEFAULT']['ForwardX11'] = 'yes'\n" +">>> with open('example.ini', 'w') as configfile:\n" +"... config.write(configfile)\n" +"..." #: ../../library/configparser.rst:104 msgid "" @@ -167,7 +194,6 @@ msgstr "" "これで設定ファイルを作成して保存できました。次はこれを読み込み直して、中の" "データを取り出してみましょう。" -#: ../../library/configparser.rst:111 msgid "" ">>> config = configparser.ConfigParser()\n" ">>> config.sections()\n" @@ -199,6 +225,35 @@ msgid "" ">>> config['forge.example']['ForwardX11']\n" "'yes'" msgstr "" +">>> config = configparser.ConfigParser()\n" +">>> config.sections()\n" +"[]\n" +">>> config.read('example.ini')\n" +"['example.ini']\n" +">>> config.sections()\n" +"['forge.example', 'topsecret.server.example']\n" +">>> 'forge.example' in config\n" +"True\n" +">>> 'python.org' in config\n" +"False\n" +">>> config['forge.example']['User']\n" +"'hg'\n" +">>> config['DEFAULT']['Compression']\n" +"'yes'\n" +">>> topsecret = config['topsecret.server.example']\n" +">>> topsecret['ForwardX11']\n" +"'no'\n" +">>> topsecret['Port']\n" +"'50022'\n" +">>> for key in config['forge.example']:\n" +"... print(key)\n" +"user\n" +"compressionlevel\n" +"serveraliveinterval\n" +"compression\n" +"forwardx11\n" +">>> config['forge.example']['ForwardX11']\n" +"'yes'" #: ../../library/configparser.rst:143 msgid "" @@ -212,7 +267,6 @@ msgstr "" "[1]_。 また、セクション内の各キーは大文字小文字を区別せず、全て小文字で保存さ" "れていることにも注意してください [1]_。" -#: ../../library/configparser.rst:148 ../../library/configparser.rst:1003 msgid "" "It is possible to read several configurations into a single :class:" "`ConfigParser`, where the most recently added configuration has the highest " @@ -221,14 +275,20 @@ msgid "" "an ``override.ini`` file, which will override any conflicting keys from the " "``example.ini`` file." msgstr "" +"1 つの :class:`ConfigParser` に複数の設定を読み込むことができ、最後に追加した" +"設定が最も優先されます。\n" +"重複するキーには後から読み込んだ設定の値が使われ、重複しない既存のキーは保持" +"されます。\n" +"次の例では ``override.ini`` ファイルを読み込み、``example.ini`` ファイルと重" +"複するキーの値を上書きします。" -#: ../../library/configparser.rst:155 ../../library/configparser.rst:1010 msgid "" "[DEFAULT]\n" "ServerAliveInterval = -1" msgstr "" +"[DEFAULT]\n" +"ServerAliveInterval = -1" -#: ../../library/configparser.rst:160 ../../library/configparser.rst:1015 msgid "" ">>> config_override = configparser.ConfigParser()\n" ">>> config_override['DEFAULT'] = {'ServerAliveInterval': '-1'}\n" @@ -241,12 +301,23 @@ msgid "" ">>> print(config_override.get('DEFAULT', 'ServerAliveInterval'))\n" "-1" msgstr "" +">>> config_override = configparser.ConfigParser()\n" +">>> config_override['DEFAULT'] = {'ServerAliveInterval': '-1'}\n" +">>> with open('override.ini', 'w') as configfile:\n" +"... config_override.write(configfile)\n" +"...\n" +">>> config_override = configparser.ConfigParser()\n" +">>> config_override.read(['example.ini', 'override.ini'])\n" +"['example.ini', 'override.ini']\n" +">>> print(config_override.get('DEFAULT', 'ServerAliveInterval'))\n" +"-1" -#: ../../library/configparser.rst:174 msgid "" "This behaviour is equivalent to a :meth:`ConfigParser.read` call with " "several files passed to the *filenames* parameter." msgstr "" +"この動作は、*filenames* 引数に複数のファイルを渡して :meth:`ConfigParser." +"read` を呼び出す場合と同じです。" #: ../../library/configparser.rst:179 msgid "Supported Datatypes" @@ -261,13 +332,16 @@ msgstr "" "Config parser は値のデータ型について何も推論せず、常に文字列のまま内部に保存" "します。他のデータ型が必要な場合は自分で変換する必要があります:" -#: ../../library/configparser.rst:185 msgid "" ">>> int(topsecret['Port'])\n" "50022\n" ">>> float(topsecret['CompressionLevel'])\n" "9.0" msgstr "" +">>> int(topsecret['Port'])\n" +"50022\n" +">>> float(topsecret['CompressionLevel'])\n" +"9.0" #: ../../library/configparser.rst:192 msgid "" @@ -287,7 +361,6 @@ msgstr "" "``'on'``/``'off'``、``'true'``/``'false'``、``'1'``/``'0'`` を真偽値として認" "識します [1]_。例えば:" -#: ../../library/configparser.rst:200 msgid "" ">>> topsecret.getboolean('ForwardX11')\n" "False\n" @@ -296,6 +369,12 @@ msgid "" ">>> config.getboolean('forge.example', 'Compression')\n" "True" msgstr "" +">>> topsecret.getboolean('ForwardX11')\n" +"False\n" +">>> config['forge.example'].getboolean('ForwardX11')\n" +"True\n" +">>> config.getboolean('forge.example', 'Compression')\n" +"True" #: ../../library/configparser.rst:209 msgid "" @@ -313,13 +392,13 @@ msgstr "" msgid "Fallback Values" msgstr "代替値" -#: ../../library/configparser.rst:217 msgid "" "As with a dictionary, you can use a section's :meth:`~ConfigParser.get` " "method to provide fallback values:" msgstr "" +"辞書と同様に、セクションの :meth:`~ConfigParser.get` メソッドを使って代替値を" +"指定できます:" -#: ../../library/configparser.rst:220 msgid "" ">>> topsecret.get('Port')\n" "'50022'\n" @@ -329,6 +408,13 @@ msgid "" ">>> topsecret.get('Cipher', '3des-cbc')\n" "'3des-cbc'" msgstr "" +">>> topsecret.get('Port')\n" +"'50022'\n" +">>> topsecret.get('CompressionLevel')\n" +"'9'\n" +">>> topsecret.get('Cipher')\n" +">>> topsecret.get('Cipher', '3des-cbc')\n" +"'3des-cbc'" #: ../../library/configparser.rst:230 msgid "" @@ -343,26 +429,33 @@ msgstr "" "ん。その値を ``'topsecret.server.example'`` から取得しようとした場合、代替値" "を指定しても常にデフォルト値を返します:" -#: ../../library/configparser.rst:236 msgid "" ">>> topsecret.get('CompressionLevel', '3')\n" "'9'" msgstr "" +">>> topsecret.get('CompressionLevel', '3')\n" +"'9'" -#: ../../library/configparser.rst:241 msgid "" "One more thing to be aware of is that the parser-level :meth:`~ConfigParser." "get` method provides a custom, more complex interface, maintained for " "backwards compatibility. When using this method, a fallback value can be " "provided via the ``fallback`` keyword-only argument:" msgstr "" +"もう 1 つ注意が必要なのは、パーサーの :meth:`~ConfigParser.get` メソッドに" +"は、後方互換性のために維持されている独自の、より複雑なインターフェースがある" +"ことです。\n" +"このメソッドを使う場合、代替値はキーワード専用引数 ``fallback`` で指定できま" +"す:" -#: ../../library/configparser.rst:246 msgid "" ">>> config.get('forge.example', 'monster',\n" "... fallback='No such things as monsters')\n" "'No such things as monsters'" msgstr "" +">>> config.get('forge.example', 'monster',\n" +"... fallback='No such things as monsters')\n" +"'No such things as monsters'" #: ../../library/configparser.rst:252 msgid "" @@ -374,7 +467,6 @@ msgstr "" "`~ConfigParser.getfloat` と :meth:`~ConfigParser.getboolean` メソッドでも使え" "ます。例えば:" -#: ../../library/configparser.rst:256 msgid "" ">>> 'BatchMode' in topsecret\n" "False\n" @@ -384,12 +476,18 @@ msgid "" ">>> topsecret.getboolean('BatchMode', fallback=True)\n" "False" msgstr "" +">>> 'BatchMode' in topsecret\n" +"False\n" +">>> topsecret.getboolean('BatchMode', fallback=True)\n" +"True\n" +">>> config['DEFAULT']['BatchMode'] = 'no'\n" +">>> topsecret.getboolean('BatchMode', fallback=True)\n" +"False" #: ../../library/configparser.rst:268 msgid "Supported INI File Structure" msgstr "サポートするINI ファイルの構造" -#: ../../library/configparser.rst:270 msgid "" "A configuration file consists of sections, each led by a ``[section]`` " "header, followed by key/value entries separated by a specific string (``=`` " @@ -401,20 +499,37 @@ msgid "" "of the value. Depending on the parser's mode, blank lines may be treated as " "parts of multiline values or ignored." msgstr "" +"設定ファイルはセクションで構成されます。\n" +"各セクションは ``[section]`` ヘッダーで始まり、その後に特定の文字列 (デフォル" +"トでは ``=`` または ``:`` [1]_) で区切られたキーと値のエントリーが続きま" +"す。\n" +"デフォルトでは、セクション名は大文字と小文字を区別しますが、キーは区別しませ" +"ん [1]_。\n" +"キーと値の前後の空白は取り除かれます。\n" +"パーサーの設定で許可されていれば値を省略でき [1]_、その場合はキーと値を区切る" +"デリミタも省略できます。\n" +"値の最初の行よりも深くインデントすれば、値を複数行にわたって記述することもで" +"きます。\n" +"パーサーのモードによって、空行は複数行の値の一部として扱われる場合も、無視さ" +"れる場合もあります。" -#: ../../library/configparser.rst:280 msgid "" "By default, a valid section name can be any string that does not contain '\\" "\\n'. To change this, see :attr:`ConfigParser.SECTCRE`." msgstr "" +"デフォルトでは、'\\\\n' を含まない任意の文字列をセクション名にできます。\n" +"これを変更するには :attr:`ConfigParser.SECTCRE` を参照してください。" -#: ../../library/configparser.rst:283 msgid "" "The first section name may be omitted if the parser is configured to allow " "an unnamed top level section with ``allow_unnamed_section=True``. In this " "case, the keys/values may be retrieved by :const:`UNNAMED_SECTION` as in " "``config[UNNAMED_SECTION]``." msgstr "" +"``allow_unnamed_section=True`` を指定して無名の最上位セクションを許可した場" +"合、最初のセクション名は省略できます。\n" +"この場合、``config[UNNAMED_SECTION]`` のように :const:`UNNAMED_SECTION` を" +"使ってキーと値を取得できます。" #: ../../library/configparser.rst:288 msgid "" @@ -430,7 +545,6 @@ msgstr "" msgid "For example:" msgstr "例えば:" -#: ../../library/configparser.rst:294 msgid "" "[Simple Values]\n" "key=value\n" @@ -474,18 +588,58 @@ msgid "" " of a value\n" " # Did I mention we can indent comments, too?" msgstr "" +"[Simple Values]\n" +"key=value\n" +"spaces in keys=allowed\n" +"spaces in values=allowed as well\n" +"spaces around the delimiter = obviously\n" +"you can also use : to delimit keys from values\n" +"\n" +"[All Values Are Strings]\n" +"values like this: 1000000\n" +"or this: 3.14159265359\n" +"are they treated as numbers? : no\n" +"integers, floats and booleans are held as: strings\n" +"can use the API to get converted values directly: true\n" +"\n" +"[Multiline Values]\n" +"chorus: I'm a lumberjack, and I'm okay\n" +" I sleep all night and I work all day\n" +"\n" +"[No Values]\n" +"key_without_value\n" +"empty string value here =\n" +"\n" +"[You can use comments]\n" +"# このように\n" +"; このようにも\n" +"\n" +"# デフォルトでは他の内容がない行にのみ記述できます。\n" +"# インラインコメントは、デリミタを値の一部として使えなくするため、\n" +"# 問題になることがあります。\n" +"# ただし、この動作はカスタマイズできます。\n" +"\n" +" [Sections Can Be Indented]\n" +" can_values_be_as_well = True\n" +" does_that_mean_anything_special = False\n" +" purpose = formatting for readability\n" +" multiline_values = are\n" +" handled just fine as\n" +" long as they are indented\n" +" deeper than the first line\n" +" of a value\n" +" # コメントもインデントできます。" -#: ../../library/configparser.rst:342 msgid "Unnamed Sections" -msgstr "" +msgstr "無名セクション" -#: ../../library/configparser.rst:344 msgid "" "The name of the first section (or unique) may be omitted and values " "retrieved by the :const:`UNNAMED_SECTION` attribute." msgstr "" +"最初のセクション (または唯一のセクション) の名前は省略でき、:const:" +"`UNNAMED_SECTION` 属性を使って値を取得できます。" -#: ../../library/configparser.rst:347 msgid "" ">>> config = \"\"\"\n" "... option = value\n" @@ -498,6 +652,16 @@ msgid "" ">>> unnamed.get(configparser.UNNAMED_SECTION, 'option')\n" "'value'" msgstr "" +">>> config = \"\"\"\n" +"... option = value\n" +"...\n" +"... [ Section 2 ]\n" +"... another = val\n" +"... \"\"\"\n" +">>> unnamed = configparser.ConfigParser(allow_unnamed_section=True)\n" +">>> unnamed.read_string(config)\n" +">>> unnamed.get(configparser.UNNAMED_SECTION, 'option')\n" +"'value'" #: ../../library/configparser.rst:361 msgid "Interpolation of values" @@ -524,7 +688,6 @@ msgstr "" "別なデフォルトセクション中 [1]_ の他の値を参照するフォーマット文字列を含める" "ことができます。追加のデフォルト値を初期化時に提供できます。" -#: ../../library/configparser.rst:378 msgid "" "[Paths]\n" "home_dir: /Users\n" @@ -536,6 +699,14 @@ msgid "" "escaped):\n" "gain: 80%%" msgstr "" +"[Paths]\n" +"home_dir: /Users\n" +"my_dir: %(home_dir)s/lumberjack\n" +"my_pictures: %(my_dir)s/Pictures\n" +"\n" +"[Escape]\n" +"# %% で % 記号をエスケープします (エスケープが必要なのは % だけです):\n" +"gain: 80%%" #: ../../library/configparser.rst:389 msgid "" @@ -585,7 +756,6 @@ msgstr "" "たとえば、上記の basic interpolation で指定した設定は、extended " "interpolation を使うと下記のようになります:" -#: ../../library/configparser.rst:414 msgid "" "[Paths]\n" "home_dir: /Users\n" @@ -597,12 +767,19 @@ msgid "" "escaped):\n" "cost: $$80" msgstr "" +"[Paths]\n" +"home_dir: /Users\n" +"my_dir: ${home_dir}/lumberjack\n" +"my_pictures: ${my_dir}/Pictures\n" +"\n" +"[Escape]\n" +"# $$ で $ 記号をエスケープします (エスケープが必要なのは $ だけです):\n" +"cost: $$80" #: ../../library/configparser.rst:425 msgid "Values from other sections can be fetched as well:" msgstr "他のセクションから値を持ってくることもできます:" -#: ../../library/configparser.rst:427 msgid "" "[Common]\n" "home_dir: /Users\n" @@ -621,6 +798,22 @@ msgid "" "my_pictures: ${my_dir}/Pictures\n" "python_dir: ${Frameworks:path}/Python/Versions/${Frameworks:Python}" msgstr "" +"[Common]\n" +"home_dir: /Users\n" +"library_dir: /Library\n" +"system_dir: /System\n" +"macports_dir: /opt/local\n" +"\n" +"[Frameworks]\n" +"Python: 3.2\n" +"path: ${Common:system_dir}/Library/Frameworks/\n" +"\n" +"[Arthur]\n" +"nickname: Two Sheds\n" +"last_name: Jackson\n" +"my_dir: ${Common:home_dir}/twosheds\n" +"my_pictures: ${my_dir}/Pictures\n" +"python_dir: ${Frameworks:path}/Python/Versions/${Frameworks:Python}" #: ../../library/configparser.rst:447 msgid "Mapping Protocol Access" @@ -675,11 +868,12 @@ msgstr "" "す。同時に、キー ``'a'`` を含むセクションにおいて、どちらの式も ``True`` を返" "します::" -#: ../../library/configparser.rst:472 msgid "" "\"a\" in parser[\"section\"]\n" "\"A\" in parser[\"section\"]" msgstr "" +"\"a\" in parser[\"section\"]\n" +"\"A\" in parser[\"section\"]" #: ../../library/configparser.rst:475 msgid "" @@ -763,31 +957,34 @@ msgstr "" "合をサポートするために、非常に役立ちます。デフォルトの機能は主に歴史的背景に" "よって決められたので、機能によってはカスタマイズしてお使いください。" -#: ../../library/configparser.rst:515 msgid "" "The most common way to change the way a specific config parser works is to " "use the :meth:`!__init__` options:" msgstr "" +"個々の設定パーサーの動作を変える最も一般的な方法は、:meth:`!__init__` のオプ" +"ションを使うことです:" #: ../../library/configparser.rst:518 msgid "*defaults*, default value: ``None``" msgstr "*defaults*, デフォルト値: ``None``" -#: ../../library/configparser.rst:520 msgid "" "This option accepts a dictionary of key-value pairs which will be initially " "put in the ``DEFAULT`` section. This makes for an elegant way to support " "concise configuration files that don't specify values which are the same as " "the documented default." msgstr "" -"このオプションは最初に ``DEFAULT`` セクションに加えられるキー-値の対の辞書を" -"受け付けます。" +"このオプションは、最初に ``DEFAULT`` セクションに追加するキーと値の対を含む辞" +"書を受け付けます。\n" +"これにより、文書に記載されたデフォルト値と同じ値の指定を省いた、簡潔な設定" +"ファイルを容易にサポートできます。" -#: ../../library/configparser.rst:525 msgid "" "Hint: if you want to specify default values for a specific section, use :" "meth:`~ConfigParser.read_dict` before you read the actual file." msgstr "" +"ヒント: 特定のセクションのデフォルト値を指定するには、実際のファイルを読み込" +"む前に :meth:`~ConfigParser.read_dict` を使ってください。" #: ../../library/configparser.rst:528 msgid "*dict_type*, default value: :class:`dict`" @@ -821,7 +1018,6 @@ msgstr "" "注意: 一度の操作でキー-値の対を複数追加する方法もあります。そのような操作に普" "通の辞書を使うと、キーの並びは挿入順になります。例えば:" -#: ../../library/configparser.rst:542 msgid "" ">>> parser = configparser.ConfigParser()\n" ">>> parser.read_dict({'section1': {'key1': 'value1',\n" @@ -839,6 +1035,21 @@ msgid "" ">>> [option for option in parser['section3']]\n" "['foo', 'bar', 'baz']" msgstr "" +">>> parser = configparser.ConfigParser()\n" +">>> parser.read_dict({'section1': {'key1': 'value1',\n" +"... 'key2': 'value2',\n" +"... 'key3': 'value3'},\n" +"... 'section2': {'keyA': 'valueA',\n" +"... 'keyB': 'valueB',\n" +"... 'keyC': 'valueC'},\n" +"... 'section3': {'foo': 'x',\n" +"... 'bar': 'y',\n" +"... 'baz': 'z'}\n" +"... })\n" +">>> parser.sections()\n" +"['section1', 'section2', 'section3']\n" +">>> [option for option in parser['section3']]\n" +"['foo', 'bar', 'baz']" #: ../../library/configparser.rst:560 msgid "*allow_no_value*, default value: ``False``" @@ -855,7 +1066,6 @@ msgstr "" "`ConfigParser` がサポートする文法に従います。コンストラクタの " "*allow_no_value* 引数で、そのような値を許可することができます。" -#: ../../library/configparser.rst:567 msgid "" ">>> import configparser\n" "\n" @@ -885,6 +1095,33 @@ msgid "" " ...\n" "KeyError: 'does-not-exist'" msgstr "" +">>> import configparser\n" +"\n" +">>> sample_config = \"\"\"\n" +"... [mysqld]\n" +"... user = mysql\n" +"... pid-file = /var/run/mysqld/mysqld.pid\n" +"... skip-external-locking\n" +"... old_passwords = 1\n" +"... skip-bdb\n" +"... # 今回は ACID は不要です\n" +"... skip-innodb\n" +"... \"\"\"\n" +">>> config = configparser.ConfigParser(allow_no_value=True)\n" +">>> config.read_string(sample_config)\n" +"\n" +">>> # 値のある設定は従来どおりに扱われます:\n" +">>> config[\"mysqld\"][\"user\"]\n" +"'mysql'\n" +"\n" +">>> # 値のない設定は None を返します:\n" +">>> config[\"mysqld\"][\"skip-bdb\"]\n" +"\n" +">>> # 指定されていない設定は引き続きエラーになります:\n" +">>> config[\"mysqld\"][\"does-not-exist\"]\n" +"Traceback (most recent call last):\n" +" ...\n" +"KeyError: 'does-not-exist'" #: ../../library/configparser.rst:597 msgid "*delimiters*, default value: ``('=', ':')``" @@ -956,7 +1193,6 @@ msgstr "" "も、複数行にわたる値で、行の先頭にコメント接頭辞文字を保存する唯一の方法は、" "次の例のように接頭辞を補間することです::" -#: ../../library/configparser.rst:628 msgid "" ">>> from configparser import ConfigParser, ExtendedInterpolation\n" ">>> parser = ConfigParser(interpolation=ExtendedInterpolation())\n" @@ -997,18 +1233,60 @@ msgid "" "line #2\n" "line #3" msgstr "" +">>> from configparser import ConfigParser, ExtendedInterpolation\n" +">>> parser = ConfigParser(interpolation=ExtendedInterpolation())\n" +">>> # デフォルトの BasicInterpolation も使用できます\n" +">>> parser.read_string(\"\"\"\n" +"... [DEFAULT]\n" +"... hash = #\n" +"...\n" +"... [hashes]\n" +"... shebang =\n" +"... ${hash}!/usr/bin/env python\n" +"... ${hash} -*- coding: utf-8 -*-\n" +"...\n" +"... extensions =\n" +"... enabled_extension\n" +"... another_extension\n" +"... #disabled_by_comment\n" +"... yet_another_extension\n" +"...\n" +"... interpolation not necessary = if # is not at line start\n" +"... even in multiline values = line #1\n" +"... line #2\n" +"... line #3\n" +"... \"\"\")\n" +">>> print(parser['hashes']['shebang'])\n" +"\n" +"#!/usr/bin/env python\n" +"# -*- coding: utf-8 -*-\n" +">>> print(parser['hashes']['extensions'])\n" +"\n" +"enabled_extension\n" +"another_extension\n" +"yet_another_extension\n" +">>> print(parser['hashes']['interpolation not necessary'])\n" +"if # is not at line start\n" +">>> print(parser['hashes']['even in multiline values'])\n" +"line #1\n" +"line #2\n" +"line #3" #: ../../library/configparser.rst:667 msgid "*strict*, default value: ``True``" msgstr "*strict*, デフォルト値: ``True``" -#: ../../library/configparser.rst:669 msgid "" "When set to ``True``, the parser will not allow for any section or option " "duplicates while reading from a single source (using :meth:`~ConfigParser." "read_file`, :meth:`~ConfigParser.read_string` or :meth:`~ConfigParser." "read_dict`). It is recommended to use strict parsers in new applications." msgstr "" +"``True`` に設定すると、パーサーは単一のソースから (:meth:`~ConfigParser." +"read_file`、:meth:`~ConfigParser.read_string`、:meth:`~ConfigParser." +"read_dict` を使って) 読み込む際に、セクションやオプションの重複を許可しませ" +"ん。\n" +"新しいアプリケーションでは、この厳密なパーサーを使うことを推奨します。" #: ../../library/configparser.rst:674 msgid "" @@ -1037,7 +1315,6 @@ msgstr "" "ルが大きく複雑になったとき、ユーザーがファイル構造を見失いやすいです。この例" "をご覧ください:" -#: ../../library/configparser.rst:687 msgid "" "[Section]\n" "key = multiline\n" @@ -1045,6 +1322,11 @@ msgid "" "\n" " this = is still a part of the multiline value of 'key'" msgstr "" +"[Section]\n" +"key = multiline\n" +" value with a gotcha\n" +"\n" +" this = is still a part of the multiline value of 'key'" #: ../../library/configparser.rst:695 msgid "" @@ -1114,7 +1396,6 @@ msgstr "" msgid "*converters*, default value: not set" msgstr "*converters*, デフォルト値: 未設定" -#: ../../library/configparser.rst:726 msgid "" "Config parsers provide option value getters that perform type conversion. " "By default :meth:`~ConfigParser.getint`, :meth:`~ConfigParser.getfloat`, " @@ -1127,6 +1408,18 @@ msgid "" "``parser_instance.getdecimal('section', 'key', fallback=0)`` and " "``parser_instance['section'].getdecimal('key', 0)``." msgstr "" +"設定パーサーには、型変換を行ってオプションの値を取得するメソッドがありま" +"す。\n" +"デフォルトでは :meth:`~ConfigParser.getint`、:meth:`~ConfigParser." +"getfloat`、:meth:`~ConfigParser.getboolean` が実装されています。\n" +"ほかの取得メソッドが必要な場合は、サブクラスで定義するか、各キーをコンバー" +"ター名、各値をその変換を実装する呼び出し可能オブジェクトとする辞書を渡せま" +"す。\n" +"例えば、``{'decimal': decimal.Decimal}`` を渡すと、パーサーオブジェクトとすべ" +"てのセクションプロキシに :meth:`!getdecimal` が追加されます。\n" +"つまり、``parser_instance.getdecimal('section', 'key', fallback=0)`` と " +"``parser_instance['section'].getdecimal('key', 0)`` のどちらも使えるようにな" +"ります。" #: ../../library/configparser.rst:737 msgid "" @@ -1164,7 +1457,6 @@ msgstr "" "``'false'``, ``'off'`` 。文字列と対応するブール値のカスタム辞書を指定すること" "でこれを上書きできます。たとえば:" -#: ../../library/configparser.rst:754 msgid "" ">>> custom = configparser.ConfigParser()\n" ">>> custom['section1'] = {'funky': 'nope'}\n" @@ -1176,6 +1468,15 @@ msgid "" ">>> custom['section1'].getboolean('funky')\n" "False" msgstr "" +">>> custom = configparser.ConfigParser()\n" +">>> custom['section1'] = {'funky': 'nope'}\n" +">>> custom['section1'].getboolean('funky')\n" +"Traceback (most recent call last):\n" +"...\n" +"ValueError: Not a boolean: nope\n" +">>> custom.BOOLEAN_STATES = {'sure': True, 'nope': False}\n" +">>> custom['section1'].getboolean('funky')\n" +"False" #: ../../library/configparser.rst:766 msgid "" @@ -1197,7 +1498,6 @@ msgstr "" "すべてのキーは小文字になります。それがふさわしくなければ、このメソッドを上書" "きしてください。例えば:" -#: ../../library/configparser.rst:778 msgid "" ">>> config = \"\"\"\n" "... [Section1]\n" @@ -1220,15 +1520,36 @@ msgid "" ">>> list(custom['Section2'].keys())\n" "['AnotherKey']" msgstr "" +">>> config = \"\"\"\n" +"... [Section1]\n" +"... Key = Value\n" +"...\n" +"... [Section2]\n" +"... AnotherKey = Value\n" +"... \"\"\"\n" +">>> typical = configparser.ConfigParser()\n" +">>> typical.read_string(config)\n" +">>> list(typical['Section1'].keys())\n" +"['key']\n" +">>> list(typical['Section2'].keys())\n" +"['anotherkey']\n" +">>> custom = configparser.RawConfigParser()\n" +">>> custom.optionxform = lambda option: option\n" +">>> custom.read_string(config)\n" +">>> list(custom['Section1'].keys())\n" +"['Key']\n" +">>> list(custom['Section2'].keys())\n" +"['AnotherKey']" -#: ../../library/configparser.rst:802 msgid "" "The optionxform function transforms option names to a canonical form. This " "should be an idempotent function: if the name is already in canonical form, " "it should be returned unchanged." msgstr "" +"``optionxform()`` 関数はオプション名を正規形に変換します。\n" +"この関数は冪等でなければなりません。\n" +"つまり、名前がすでに正規形であれば、そのまま返す必要があります。" -#: ../../library/configparser.rst:809 msgid "" "A compiled regular expression used to parse section headers. The default " "matches ``[section]`` to the name ``\"section\"``. Whitespace is considered " @@ -1236,13 +1557,13 @@ msgid "" "name ``\" larch \"``. Override this attribute if that's unsuitable. For " "example:" msgstr "" -"セクションヘッダを解析するのに使われる、コンパイルされた正規表現です。デフォ" -"ルトでは ``[section]`` が ``\"section\"`` という名前にマッチします。空白はセ" -"クション名の一部と見なされるので、``[ larch ]`` は ``\" larch \"`` という" -"名のセクションとして読み込まれます。これがふさわしくない場合、このメソッドを" -"上書きしてください。例えば:" +"セクションヘッダーを解析するために使われる、コンパイル済みの正規表現です。\n" +"デフォルトでは ``[section]`` にマッチし、名前を ``\"section\"`` とします。\n" +"空白はセクション名の一部と見なされるため、``[ larch ]`` は ``\" larch " +"\"`` という名前のセクションとして読み込まれます。\n" +"これが適切でなければ、この属性を上書きしてください。\n" +"例えば:" -#: ../../library/configparser.rst:815 msgid "" ">>> import re\n" ">>> config = \"\"\"\n" @@ -1262,6 +1583,23 @@ msgid "" ">>> custom.sections()\n" "['Section 1', 'Section 2']" msgstr "" +">>> import re\n" +">>> config = \"\"\"\n" +"... [Section 1]\n" +"... option = value\n" +"...\n" +"... [ Section 2 ]\n" +"... another = val\n" +"... \"\"\"\n" +">>> typical = configparser.ConfigParser()\n" +">>> typical.read_string(config)\n" +">>> typical.sections()\n" +"['Section 1', ' Section 2 ']\n" +">>> custom = configparser.ConfigParser()\n" +">>> custom.SECTCRE = re.compile(r\"\\[ *(?P
[^]]+?) *\\]\")\n" +">>> custom.read_string(config)\n" +">>> custom.sections()\n" +"['Section 1', 'Section 2']" #: ../../library/configparser.rst:837 msgid "" @@ -1295,7 +1633,6 @@ msgstr "" msgid "An example of writing to a configuration file::" msgstr "設定ファイルを書き出す例::" -#: ../../library/configparser.rst:853 msgid "" "import configparser\n" "\n" @@ -1318,12 +1655,31 @@ msgid "" "with open('example.cfg', 'w') as configfile:\n" " config.write(configfile)" msgstr "" +"import configparser\n" +"\n" +"config = configparser.RawConfigParser()\n" +"\n" +"# RawConfigParser の set 関数では、内部的にキーに文字列以外の値も\n" +"# 代入できますが、ファイルへの書き出しや raw でないモードでの取得を\n" +"# 試みるとエラーになります。\n" +"# マップ型プロトコルや ConfigParser の set() による値の設定では、\n" +"# このような代入はできません。\n" +"config.add_section('Section1')\n" +"config.set('Section1', 'an_int', '15')\n" +"config.set('Section1', 'a_bool', 'true')\n" +"config.set('Section1', 'a_float', '3.1415')\n" +"config.set('Section1', 'baz', 'fun')\n" +"config.set('Section1', 'bar', 'Python')\n" +"config.set('Section1', 'foo', '%(bar)s is %(baz)s!')\n" +"\n" +"# 設定ファイルを 'example.cfg' に書き出す\n" +"with open('example.cfg', 'w') as configfile:\n" +" config.write(configfile)" #: ../../library/configparser.rst:874 msgid "An example of reading the configuration file again::" msgstr "設定ファイルを読み込む例::" -#: ../../library/configparser.rst:876 msgid "" "import configparser\n" "\n" @@ -1341,12 +1697,26 @@ msgid "" "if config.getboolean('Section1', 'a_bool'):\n" " print(config.get('Section1', 'foo'))" msgstr "" +"import configparser\n" +"\n" +"config = configparser.RawConfigParser()\n" +"config.read('example.cfg')\n" +"\n" +"# 値が浮動小数点数でなければ getfloat() は例外を送出します\n" +"# getint() と getboolean() もそれぞれの型について同様に動作します\n" +"a_float = config.getfloat('Section1', 'a_float')\n" +"an_int = config.getint('Section1', 'an_int')\n" +"print(a_float + an_int)\n" +"\n" +"# 次の出力では '%(bar)s' や '%(baz)s' は補間されません。\n" +"# これは RawConfigParser() を使用しているためです。\n" +"if config.getboolean('Section1', 'a_bool'):\n" +" print(config.get('Section1', 'foo'))" #: ../../library/configparser.rst:892 msgid "To get interpolation, use :class:`ConfigParser`::" msgstr "補間するには、 :class:`ConfigParser` を使ってください::" -#: ../../library/configparser.rst:894 msgid "" "import configparser\n" "\n" @@ -1380,6 +1750,38 @@ msgid "" "print(cfg.get('Section1', 'monster', fallback=None))\n" " # -> None" msgstr "" +"import configparser\n" +"\n" +"cfg = configparser.ConfigParser()\n" +"cfg.read('example.cfg')\n" +"\n" +"# 1 回の取得操作で補間を無効にするには、\n" +"# get() の省略可能な引数 *raw* を True に設定します。\n" +"print(cfg.get('Section1', 'foo', raw=False)) # -> \"Python is fun!\"\n" +"print(cfg.get('Section1', 'foo', raw=True)) # -> \"%(bar)s is %(baz)s!\"\n" +"\n" +"# 省略可能な引数 *vars* は、補間時に優先される要素を\n" +"# 含む辞書です。\n" +"print(cfg.get('Section1', 'foo', vars={'bar': 'Documentation',\n" +" 'baz': 'evil'}))\n" +"\n" +"# 省略可能な引数 *fallback* で代替値を指定できます\n" +"print(cfg.get('Section1', 'foo'))\n" +" # -> \"Python is fun!\"\n" +"\n" +"print(cfg.get('Section1', 'foo', fallback='Monty is not.'))\n" +" # -> \"Python is fun!\"\n" +"\n" +"print(cfg.get('Section1', 'monster', fallback='No such things as " +"monsters.'))\n" +" # -> \"No such things as monsters.\"\n" +"\n" +"# 単に print(cfg.get('Section1', 'monster')) とすると NoOptionError になりま" +"すが、\n" +"# 次のようにも書けます:\n" +"\n" +"print(cfg.get('Section1', 'monster', fallback=None))\n" +" # -> None" #: ../../library/configparser.rst:925 msgid "" @@ -1389,7 +1791,6 @@ msgstr "" "どちらの型の ConfigParsers でもデフォルト値が利用できます。使われているオプ" "ションがどこにも定義されていなければ、そのデフォルト値が補間に使われます。 ::" -#: ../../library/configparser.rst:928 msgid "" "import configparser\n" "\n" @@ -1402,6 +1803,17 @@ msgid "" "config.remove_option('Section1', 'baz')\n" "print(config.get('Section1', 'foo')) # -> \"Life is hard!\"" msgstr "" +"import configparser\n" +"\n" +"# 'bar' と 'baz' のデフォルト値がそれぞれ 'Life' と 'hard' の新しいインスタン" +"ス\n" +"config = configparser.ConfigParser({'bar': 'Life', 'baz': 'hard'})\n" +"config.read('example.cfg')\n" +"\n" +"print(config.get('Section1', 'foo')) # -> \"Python is fun!\"\n" +"config.remove_option('Section1', 'bar')\n" +"config.remove_option('Section1', 'baz')\n" +"print(config.get('Section1', 'foo')) # -> \"Life is hard!\"" #: ../../library/configparser.rst:943 msgid "ConfigParser Objects" @@ -1432,7 +1844,6 @@ msgstr "" "す。*inline_comment_prefixes* が与えられた場合、非空行のコメントに接頭する部" "分文字列としての組み合わせとして使われます。" -#: ../../library/configparser.rst:964 msgid "" "When *strict* is ``True`` (the default), the parser won't allow for any " "section or option duplicates while reading from a single source (file, " @@ -1446,13 +1857,15 @@ msgid "" msgstr "" "*strict* が ``True`` (デフォルト) であれば、パーサーは単一のソース (ファイ" "ル、文字列、辞書) 中にセクションやオプションの重複を認めず、 :exc:" -"`DuplicateSectionError` や :exc:`DuplicateOptionError` を送出します。 " +"`DuplicateSectionError` や :exc:`DuplicateOptionError` を送出します。\n" "*empty_lines_in_values* が ``False`` (デフォルト: ``True``) なら、空行はそれ" -"ぞれオプションの終わりを示します。 *allow_no_value* が ``True`` (デフォルト: " -"``False``) なら、値のないオプションが受け付けられます。そのオプションの値は " -"``None`` となり、後端のデリミタを除いてシリアル化されます。" +"ぞれオプションの終わりを示します。\n" +"そうでなければ、複数行のオプション内の空行は値の一部として保持されます。\n" +"*allow_no_value* が ``True`` (デフォルト: ``False``) なら、値のないオプション" +"が受け付けられます。\n" +"そのオプションの値は ``None`` となり、後端のデリミタを除いてシリアル化されま" +"す。" -#: ../../library/configparser.rst:974 msgid "" "When *default_section* is given, it specifies the name for the special " "section holding default values for other sections and interpolation purposes " @@ -1461,6 +1874,12 @@ msgid "" "evaluate an already parsed config file, but will be used when writing parsed " "settings to a new config file." msgstr "" +"*default_section* を指定すると、ほかのセクションのデフォルト値や補間用の値を" +"保持する特別なセクションの名前 (通常は ``\"DEFAULT\"``) を設定できます。\n" +"この値は、インスタンス属性 ``default_section`` を使って実行時に取得、変更でき" +"ます。\n" +"値を変更しても、すでに解析した設定ファイルは再評価されませんが、解析済みの設" +"定を新しい設定ファイルへ書き出す際に使われます。" #: ../../library/configparser.rst:981 msgid "" @@ -1489,7 +1908,6 @@ msgstr "" "フォルトの実装を使うと、値 ``foo %(bar)s`` と ``foo %(BAR)s`` は等しくなりま" "す。" -#: ../../library/configparser.rst:993 msgid "" "When *converters* is given, it should be a dictionary where each key " "represents the name of a type converter and each value is a callable " @@ -1497,13 +1915,20 @@ msgid "" "converter gets its own corresponding :meth:`!get*` method on the parser " "object and section proxies." msgstr "" +"*converters* を指定する場合は、各キーを型コンバーター名、各値を文字列から目的" +"のデータ型への変換を実装する呼び出し可能オブジェクトとする辞書でなければなり" +"ません。\n" +"各コンバーターに対応する :meth:`!get*` メソッドが、パーサーオブジェクトとセク" +"ションプロキシに追加されます。" -#: ../../library/configparser.rst:999 msgid "" "When *allow_unnamed_section* is ``True`` (default: ``False``), the first " "section name can be omitted. See the `\"Unnamed Sections\" section <#unnamed-" "sections>`_." msgstr "" +"*allow_unnamed_section* が ``True`` (デフォルトは ``False``) の場合、最初のセ" +"クション名を省略できます。\n" +"`「無名セクション」の節 <#unnamed-sections>`_ を参照してください。" #: ../../library/configparser.rst:1028 msgid "The default *dict_type* is :class:`collections.OrderedDict`." @@ -1522,28 +1947,31 @@ msgstr "" msgid "The *converters* argument was added." msgstr "*converters* 引数が追加されました。" -#: ../../library/configparser.rst:1039 msgid "" "The *defaults* argument is read with :meth:`read_dict`, providing consistent " "behavior across the parser: non-string keys and values are implicitly " "converted to strings." msgstr "" +"*defaults* 引数は :meth:`read_dict` で読み込まれ、パーサー全体で動作が統一さ" +"れました。\n" +"文字列でないキーと値は暗黙に文字列に変換されます。" -#: ../../library/configparser.rst:1044 ../../library/configparser.rst:1332 msgid "" "The default *dict_type* is :class:`dict`, since it now preserves insertion " "order." msgstr "" +"挿入順を保持するようになったため、*dict_type* のデフォルトは :class:`dict` に" +"なりました。" -#: ../../library/configparser.rst:1048 msgid "" "Raise a :exc:`MultilineContinuationError` when *allow_no_value* is ``True``, " "and a key without a value is continued with an indented line." msgstr "" +"*allow_no_value* が ``True`` で、値のないキーの後にインデントされた行が続く場" +"合、:exc:`MultilineContinuationError` を送出するようになりました。" -#: ../../library/configparser.rst:1052 ../../library/configparser.rst:1336 msgid "The *allow_unnamed_section* argument was added." -msgstr "" +msgstr "*allow_unnamed_section* 引数が追加されました。" #: ../../library/configparser.rst:1057 msgid "Return a dictionary containing the instance-wide defaults." @@ -1604,7 +2032,6 @@ msgstr "" "ファイル名の iterable を読み込んでパースしようと試みます。正常にパースできた" "ファイル名のリストを返します。" -#: ../../library/configparser.rst:1100 msgid "" "If *filenames* is a string, a :class:`bytes` object or a :term:`path-like " "object`, it is treated as a single filename. If a file named in *filenames* " @@ -1619,7 +2046,7 @@ msgstr "" "けないファイルがある場合、そのファイルは無視されます。この挙動は、設定ファイ" "ルが置かれる可能性のある場所(例えば、 カレントディレクトリ、ホームディレクト" "リ、システム全体の設定を行うディレクトリ)のイテラブルを指定して、イテラブルの" -"中で存在する全ての設定ファイルを読むことを想定して設計されています。 " +"中で存在する全ての設定ファイルを読むことを想定して設計されています。" #: ../../library/configparser.rst:1109 msgid "" @@ -1634,7 +2061,6 @@ msgstr "" "を呼ぶ前に 、まず :meth:`read_file` を用いて必要なファイルを読み込んでくださ" "い::" -#: ../../library/configparser.rst:1115 msgid "" "import configparser, os\n" "\n" @@ -1643,12 +2069,20 @@ msgid "" "config.read(['site.cfg', os.path.expanduser('~/.myapp.cfg')],\n" " encoding='cp1250')" msgstr "" +"import configparser, os\n" +"\n" +"config = configparser.ConfigParser()\n" +"config.read_file(open('defaults.cfg'))\n" +"config.read(['site.cfg', os.path.expanduser('~/.myapp.cfg')],\n" +" encoding='cp1250')" -#: ../../library/configparser.rst:1122 msgid "" "Added the *encoding* parameter. Previously, all files were read using the " "default encoding for :func:`open`." msgstr "" +"*encoding* 引数が追加されました。\n" +"以前は、すべてのファイルを :func:`open` のデフォルトのエンコーディングで読み" +"込んでいました。" #: ../../library/configparser.rst:1126 msgid "The *filenames* parameter accepts a :term:`path-like object`." @@ -1668,12 +2102,15 @@ msgstr "" "設定データを *f* から読み込んで解析します。*f* は Unicode 文字列を yield する" "イテラブル (例えばテキストモードで開かれたファイル) です。" -#: ../../library/configparser.rst:1138 msgid "" "Optional argument *source* specifies the name of the file being read. If " "not given and *f* has a :attr:`!name` attribute, that is used for *source*; " "the default is ``''``." msgstr "" +"省略可能な引数 *source* は、読み込むファイルの名前を指定します。\n" +"指定されておらず、*f* に :attr:`!name` 属性がある場合、その値が *source* に使" +"われます。\n" +"デフォルトは ``''`` です。" #: ../../library/configparser.rst:1142 msgid "Replaces :meth:`!readfp`." @@ -1718,7 +2155,6 @@ msgstr "" msgid "This method can be used to copy state between parsers." msgstr "このメソッドを使ってパーサー間で状態をコピーできます。" -#: ../../library/configparser.rst:1174 msgid "" "Get an *option* value for the named *section*. If *vars* is provided, it " "must be a dictionary. The *option* is looked up in *vars* (if provided), " @@ -1726,19 +2162,21 @@ msgid "" "*fallback* is provided, it is used as a fallback value. ``None`` can be " "provided as a *fallback* value." msgstr "" -"指名された *section* の *option* の値を取得します。*vars* が提供されるなら、" -"それは辞書でなければならず、(与えられたなら) *vars*, *section*, " -"*DEFAULTSECT* 内からこの順で *option* が探索されます。*fallback* の値として " -"``None`` を与えられます。" +"指定された *section* の *option* の値を取得します。\n" +"*vars* を指定する場合は辞書でなければなりません。\n" +"*option* は *vars* (指定されている場合)、*section*、*DEFAULTSECT* の順に検索" +"されます。\n" +"キーが見つからず、*fallback* が指定されている場合は、その値を代わりに返しま" +"す。\n" +"*fallback* には ``None`` も指定できます。" -#: ../../library/configparser.rst:1180 msgid "" "All the ``'%'`` interpolations are expanded in the return values, unless the " "*raw* argument is true. Values for interpolation keys are looked up in the " "same manner as the option." msgstr "" -"*raw* が真でない時には、全ての ``'%'`` 置換は展開されてから返されます。置換後" -"の値はオプションと同じ順序で探されます。" +"引数 *raw* が真でなければ、戻り値ではすべての ``'%'`` 補間が展開されます。\n" +"補間に使うキーの値は、オプションと同じ方法で検索されます。" #: ../../library/configparser.rst:1184 msgid "" @@ -1759,14 +2197,15 @@ msgstr "" "指定された *section* 中の *option* を整数に型強制する補助メソッドです。 " "*raw*, *vars* および *fallback* の説明は :meth:`get` を参照してください。" -#: ../../library/configparser.rst:1199 msgid "" "A convenience method which coerces the *option* in the specified *section* " "to a floating-point number. See :meth:`get` for explanation of *raw*, " "*vars* and *fallback*." msgstr "" +"指定された *section* の *option* を浮動小数点数に変換する便利なメソッドで" +"す。\n" +"*raw*、*vars*、*fallback* の説明は :meth:`get` を参照してください。" -#: ../../library/configparser.rst:1206 msgid "" "A convenience method which coerces the *option* in the specified *section* " "to a Boolean value. Note that the accepted values for the option are " @@ -1777,12 +2216,12 @@ msgid "" "`ValueError`. See :meth:`get` for explanation of *raw*, *vars* and " "*fallback*." msgstr "" -"指定された *section* 中の *option* をブール値に型強制する補助メソッドです。な" -"お、このオプションで受け付けられる値はこのメソッドが ``True`` を返す " -"``'1'``, ``'yes'``, ``'true'``, および ``'on'``,と、このメソッドが ``False`` " -"を返す ``'0'``, ``'no'``, ``'false'``, and ``'off'`` です。その他のいかなる値" -"も :exc:`ValueError` を送出します。 *raw*, *vars* および *fallback* の説明" -"は :meth:`get` を参照してください。" +"指定された *section* の *option* をブール値に変換する便利なメソッドです。\n" +"``'1'``、``'yes'``、``'true'``、``'on'`` に対しては ``True`` を、\n" +"``'0'``、``'no'``、``'false'``、``'off'`` に対しては ``False`` を返します。\n" +"これらの文字列値は大文字と小文字を区別せずに調べられます。\n" +"その他の値に対しては :exc:`ValueError` を送出します。\n" +"*raw*、*vars*、*fallback* の説明は :meth:`get` を参照してください。" #: ../../library/configparser.rst:1219 msgid "" @@ -1835,11 +2274,12 @@ msgstr "" "後で :meth:`read` を呼び出すことでパースできます。 *space_around_delimiters* " "が真なら、キーと値の間のデリミタはスペースで囲まれます。" -#: ../../library/configparser.rst:1247 msgid "" "Raises InvalidWriteError if this would write a representation which cannot " "be accurately parsed by a future :meth:`read` call from this parser." msgstr "" +"このパーサーで後から :meth:`read` を呼び出したときに正確に解析できない表現を" +"書き込もうとすると、``InvalidWriteError`` を送出します。" #: ../../library/configparser.rst:1253 msgid "" @@ -1891,11 +2331,12 @@ msgstr "" "上で、これを文字列引数をとって文字列を返す関数に設定できます。例えば、これを " "``str`` に設定すると、オプション名に大文字小文字の区別をつけられます::" -#: ../../library/configparser.rst:1286 msgid "" "cfgparser = ConfigParser()\n" "cfgparser.optionxform = str" msgstr "" +"cfgparser = ConfigParser()\n" +"cfgparser.optionxform = str" #: ../../library/configparser.rst:1289 msgid "" @@ -1905,30 +2346,36 @@ msgstr "" "なお、設定ファイルを読み込むとき、オプション名の周りの空白は :meth:" "`optionxform` が呼び出される前に取り除かれます。" -#: ../../library/configparser.rst:1295 msgid "" "A special object representing a section name used to reference the unnamed " "section (see :ref:`unnamed-sections`)." msgstr "" +"無名セクションを参照するためのセクション名を表す特別なオブジェクトです (:ref:" +"`unnamed-sections` を参照)。" -#: ../../library/configparser.rst:1300 msgid "" "The maximum depth for recursive interpolation for :meth:`~configparser." "ConfigParser.get` when the *raw* parameter is false. This is relevant only " "when the default *interpolation* is used." msgstr "" +"引数 *raw* が偽の場合に :meth:`~configparser.ConfigParser.get` で行う、再帰的" +"な補間の深さの上限です。\n" +"デフォルトの *interpolation* を使う場合にのみ関係します。" #: ../../library/configparser.rst:1308 msgid "RawConfigParser Objects" msgstr "RawConfigParser オブジェクト" -#: ../../library/configparser.rst:1319 msgid "" "Legacy variant of the :class:`ConfigParser`. It has interpolation disabled " "by default and allows for non-string section names, option names, and values " "via its unsafe ``add_section`` and ``set`` methods, as well as the legacy " "``defaults=`` keyword argument handling." msgstr "" +":class:`ConfigParser` のレガシーな変種です。\n" +"デフォルトで補間が無効になっており、安全でない ``add_section``、``set`` メ" +"ソッドと、レガシーな ``defaults=`` キーワード引数の処理を通じて、文字列でない" +"セクション名、オプション名、値を使用できます。" #: ../../library/configparser.rst:1340 msgid "" @@ -1940,18 +2387,23 @@ msgstr "" "してください。補間を望まない場合、 ``ConfigParser(interpolation=None)`` を使" "用できます。" -#: ../../library/configparser.rst:1347 msgid "" "Add a section named *section* or :const:`UNNAMED_SECTION` to the instance." msgstr "" +"*section* という名前のセクション、または :const:`UNNAMED_SECTION` をインスタ" +"ンスに追加します。" -#: ../../library/configparser.rst:1349 msgid "" "If the given section already exists, :exc:`DuplicateSectionError` is raised. " "If the *default section* name is passed, :exc:`ValueError` is raised. If :" "const:`UNNAMED_SECTION` is passed and support is disabled, :exc:" "`UnnamedSectionDisabledError` is raised." msgstr "" +"指定されたセクションがすでに存在する場合、:exc:`DuplicateSectionError` を送出" +"します。\n" +"*デフォルトセクション* の名前を渡すと、:exc:`ValueError` を送出します。\n" +":const:`UNNAMED_SECTION` を渡し、無名セクションのサポートが無効になっている場" +"合、:exc:`UnnamedSectionDisabledError` を送出します。" #: ../../library/configparser.rst:1354 msgid "" @@ -1962,9 +2414,8 @@ msgstr "" "ることができます。この振る舞いはサポートされておらず、内部エラーを起こす可能" "性があります。" -#: ../../library/configparser.rst:1357 msgid "Added support for :const:`UNNAMED_SECTION`." -msgstr "" +msgstr ":const:`UNNAMED_SECTION` のサポートが追加されました。" #: ../../library/configparser.rst:1363 msgid "" @@ -2006,18 +2457,21 @@ msgstr "他の全ての :mod:`configparser` 例外の基底クラスです。" msgid "Exception raised when a specified section is not found." msgstr "指定したセクションが見つからなかった時に起きる例外です。" -#: ../../library/configparser.rst:1391 msgid "" "Exception raised if :meth:`~ConfigParser.add_section` is called with the " "name of a section that is already present or in strict parsers when a " "section if found more than once in a single input file, string or dictionary." msgstr "" +"すでに存在するセクションの名前で :meth:`~ConfigParser.add_section` を呼び出し" +"た場合、または厳密なパーサーで単一の入力ファイル、文字列、辞書に同じセクショ" +"ンが複数回見つかった場合に送出される例外です。" -#: ../../library/configparser.rst:1395 msgid "" "Added the optional *source* and *lineno* attributes and parameters to :meth:" "`!__init__`." msgstr "" +":meth:`!__init__` に省略可能な *source*、*lineno* 属性と引数が追加されまし" +"た。" #: ../../library/configparser.rst:1402 msgid "" @@ -2082,36 +2536,41 @@ msgstr "" msgid "Exception raised when errors occur attempting to parse a file." msgstr "ファイルの構文解析中にエラーが起きた場合に発生する例外です。" -#: ../../library/configparser.rst:1448 msgid "" "The ``filename`` attribute and :meth:`!__init__` constructor argument were " "removed. They have been available using the name ``source`` since 3.2." msgstr "" +"``filename`` 属性と :meth:`!__init__` コンストラクタの引数が削除されまし" +"た。\n" +"これらは 3.2 以降、``source`` という名前で利用できます。" -#: ../../library/configparser.rst:1454 msgid "" "Exception raised when a key without a corresponding value is continued with " "an indented line." msgstr "" +"対応する値のないキーの後にインデントされた行が続く場合に送出される例外です。" -#: ../../library/configparser.rst:1461 msgid "" "Exception raised when attempting to use the :const:`UNNAMED_SECTION` without " "enabling it." msgstr "" +":const:`UNNAMED_SECTION` を有効にせずに使おうとした場合に送出される例外です。" -#: ../../library/configparser.rst:1468 msgid "" "Exception raised when an attempted :meth:`ConfigParser.write` would not be " "parsed accurately with a future :meth:`ConfigParser.read` call." msgstr "" +":meth:`ConfigParser.write` で書き込もうとしている内容が、後の :meth:" +"`ConfigParser.read` 呼び出しで正確に解析できない場合に送出される例外です。" -#: ../../library/configparser.rst:1471 msgid "" "Ex: Writing a key beginning with the :attr:`ConfigParser.SECTCRE` pattern " "would parse as a section header when read. Attempting to write this will " "raise this exception." msgstr "" +"例えば、:attr:`ConfigParser.SECTCRE` のパターンで始まるキーを書き込むと、読み" +"込み時にセクションヘッダーとして解析されます。\n" +"このようなキーを書き込もうとすると、この例外を送出します。" #: ../../library/configparser.rst:1478 msgid "Footnotes" @@ -2151,9 +2610,8 @@ msgstr "Windows ini ファイル" msgid "% (percent)" msgstr "% (パーセント)" -#: ../../library/configparser.rst:367 ../../library/configparser.rst:400 msgid "interpolation in configuration files" -msgstr "" +msgstr "設定ファイル内の補間" #: ../../library/configparser.rst:400 msgid "$ (dollar)" diff --git a/library/constants.po b/library/constants.po index 08e213032..50eb93249 100644 --- a/library/constants.po +++ b/library/constants.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: Takanori Suzuki , 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/constants.rst:4 @@ -78,7 +78,6 @@ msgstr "" "ンテキストでの評価はしてはいけません。:data:`!NotImplemented` が :data:" "`types.NotImplementedType` 型の唯一のインスタンスです。" -#: ../../library/constants.rst:40 msgid "" "When a binary (or in-place) method returns :data:`!NotImplemented` the " "interpreter will try the reflected operation on the other type (or some " @@ -88,36 +87,44 @@ msgid "" "error message or the :data:`!NotImplemented` value being returned to Python " "code." msgstr "" -"二項演算の (あるいはインプレースの) メソッドが :data:`!NotImplemented` を返し" -"た場合、インタープリタはもう一方の型で定義された対の演算で代用を試みます (あ" -"るいは演算によっては他の代替手段も試みます)。試行された演算全てが :data:`!" -"NotImplemented` を返した場合、インタープリタは適切な例外を送出します。 :data:" -"`!NotImplemented` を正しく返さないと、誤解を招きかねないエラーメッセージに" -"なったり、 :data:`!NotImplemented` が Python コードに返されるようなことになり" -"ます。" +"二項演算 (またはインプレース演算) のメソッドが :data:`!NotImplemented` を返し" +"た場合、\n" +"インタープリタはもう一方の型に定義された対の演算を試みます (演算子によっては" +"別の代替手段を試みます)。\n" +"すべての試行が :data:`!NotImplemented` を返した場合、インタープリタは適切な例" +"外を送出します。\n" +"誤って :data:`!NotImplemented` を返すと、誤解を招くエラーメッセージが表示され" +"たり、\n" +":data:`!NotImplemented` の値が Python コードに返されたりします。" #: ../../library/constants.rst:47 msgid "See :ref:`implementing-the-arithmetic-operations` for examples." msgstr "" "例として :ref:`implementing-the-arithmetic-operations` を参照してください。" -#: ../../library/constants.rst:51 msgid "" ":data:`!NotImplemented` and :exc:`!NotImplementedError` are not " "interchangeable. This constant should only be used as described above; see :" "exc:`NotImplementedError` for details on correct usage of the exception." msgstr "" +":data:`!NotImplemented` と :exc:`!NotImplementedError` は互いに置き換えられま" +"せん。\n" +"この定数は、上で説明した用途にのみ使ってください。\n" +"例外の正しい使い方については :exc:`NotImplementedError` を参照してください。" -#: ../../library/constants.rst:56 msgid "Evaluating :data:`!NotImplemented` in a boolean context was deprecated." msgstr "" +":data:`!NotImplemented` を真偽値として評価することは非推奨となりました。" -#: ../../library/constants.rst:59 msgid "" "Evaluating :data:`!NotImplemented` in a boolean context now raises a :exc:" "`TypeError`. It previously evaluated to :const:`True` and emitted a :exc:" "`DeprecationWarning` since Python 3.9." msgstr "" +":data:`!NotImplemented` を真偽値として評価すると、:exc:`TypeError` が送出され" +"るようになりました。\n" +"以前は :const:`True` と評価され、Python 3.9 以降では :exc:" +"`DeprecationWarning` も発生していました。" #: ../../library/constants.rst:68 msgid "" diff --git a/library/contextlib.po b/library/contextlib.po index ec46a3f12..f06a9b006 100644 --- a/library/contextlib.po +++ b/library/contextlib.po @@ -20,10 +20,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/contextlib.rst:2 @@ -93,13 +93,15 @@ msgstr "" "`~object.__enter__` と :meth:`~object.__exit__` メソッドを別々に定義しなくて" "も、ファクトリ関数を定義することができます。" -#: ../../library/contextlib.rst:50 msgid "" "While many objects natively support use in with statements, sometimes a " "resource needs to be managed that isn't a context manager in its own right, " "and doesn't implement a ``close()`` method for use with ``contextlib." "closing``." msgstr "" +"多くのオブジェクトは with 文での使用をサポートしていますが、コンテキストマ" +"ネージャではなく、``contextlib.closing`` で使うための ``close()`` メソッドも" +"実装していないリソースを管理する必要が生じることもあります。" #: ../../library/contextlib.rst:54 msgid "" @@ -108,7 +110,6 @@ msgid "" msgstr "" "リソースを正しく管理するよう保証する抽象的な例は以下のようなものでしょう::" -#: ../../library/contextlib.rst:57 msgid "" "from contextlib import contextmanager\n" "\n" @@ -122,17 +123,30 @@ msgid "" " # Code to release resource, e.g.:\n" " release_resource(resource)" msgstr "" +"from contextlib import contextmanager\n" +"\n" +"@contextmanager\n" +"def managed_resource(*args, **kwds):\n" +" # リソースを確保するコードの例:\n" +" resource = acquire_resource(*args, **kwds)\n" +" try:\n" +" yield resource\n" +" finally:\n" +" # リソースを解放するコードの例:\n" +" release_resource(resource)" #: ../../library/contextlib.rst:69 msgid "The function can then be used like this::" msgstr "このとき、関数は次のように使うことができます::" -#: ../../library/contextlib.rst:71 msgid "" ">>> with managed_resource(timeout=3600) as resource:\n" "... # Resource is released at the end of this block,\n" "... # even if code in the block raises an exception" msgstr "" +">>> with managed_resource(timeout=3600) as resource:\n" +"... # ブロック内のコードが例外を送出しても、\n" +"... # ブロックの終わりでリソースは解放されます" #: ../../library/contextlib.rst:75 msgid "" @@ -222,7 +236,6 @@ msgstr "" msgid "A simple example::" msgstr "簡単な例::" -#: ../../library/contextlib.rst:115 msgid "" "from contextlib import asynccontextmanager\n" "\n" @@ -238,6 +251,19 @@ msgid "" " async with get_connection() as conn:\n" " return conn.query('SELECT ...')" msgstr "" +"from contextlib import asynccontextmanager\n" +"\n" +"@asynccontextmanager\n" +"async def get_connection():\n" +" conn = await acquire_db_connection()\n" +" try:\n" +" yield conn\n" +" finally:\n" +" await release_db_connection(conn)\n" +"\n" +"async def get_all_users():\n" +" async with get_connection() as conn:\n" +" return conn.query('SELECT ...')" #: ../../library/contextlib.rst:131 msgid "" @@ -248,7 +274,6 @@ msgstr "" "レータとして使うことも :keyword:`async with` 文と組み合わせて使うこともできま" "す::" -#: ../../library/contextlib.rst:134 msgid "" "import time\n" "from contextlib import asynccontextmanager\n" @@ -265,6 +290,20 @@ msgid "" "async def main():\n" " # ... async code ..." msgstr "" +"import time\n" +"from contextlib import asynccontextmanager\n" +"\n" +"@asynccontextmanager\n" +"async def timeit():\n" +" now = time.monotonic()\n" +" try:\n" +" yield\n" +" finally:\n" +" print(f'it took {time.monotonic() - now}s to run')\n" +"\n" +"@timeit()\n" +"async def main():\n" +" # ... 非同期のコード ..." #: ../../library/contextlib.rst:149 msgid "" @@ -295,7 +334,6 @@ msgstr "" "ブロックの完了時に *thing* を close するコンテキストマネージャを返します。こ" "れは基本的に以下と等価です::" -#: ../../library/contextlib.rst:164 msgid "" "from contextlib import contextmanager\n" "\n" @@ -306,6 +344,14 @@ msgid "" " finally:\n" " thing.close()" msgstr "" +"from contextlib import contextmanager\n" +"\n" +"@contextmanager\n" +"def closing(thing):\n" +" try:\n" +" yield thing\n" +" finally:\n" +" thing.close()" #: ../../library/contextlib.rst:173 msgid "And lets you write code like this::" @@ -313,7 +359,6 @@ msgstr "" "そして、明示的に ``page`` を close する必要なしに、次のように書くことができま" "す::" -#: ../../library/contextlib.rst:175 msgid "" "from contextlib import closing\n" "from urllib.request import urlopen\n" @@ -322,6 +367,12 @@ msgid "" " for line in page:\n" " print(line)" msgstr "" +"from contextlib import closing\n" +"from urllib.request import urlopen\n" +"\n" +"with closing(urlopen('https://www.python.org')) as page:\n" +" for line in page:\n" +" print(line)" #: ../../library/contextlib.rst:182 msgid "" @@ -331,7 +382,6 @@ msgstr "" "``page`` を明示的に close する必要は無く、エラーが発生した場合でも、 :" "keyword:`with` ブロックを出るときに ``page.close()`` が呼ばれます。" -#: ../../library/contextlib.rst:187 msgid "" "Most types managing resources support the :term:`context manager` protocol, " "which closes *thing* on leaving the :keyword:`with` statement. As such, :" @@ -339,6 +389,12 @@ msgid "" "context managers. This example is purely for illustration purposes, as :func:" "`~urllib.request.urlopen` would normally be used in a context manager." msgstr "" +"リソースを管理するほとんどの型は :term:`context manager` プロトコルをサポート" +"し、:keyword:`with` 文を抜けるときに *thing* を閉じます。\n" +"そのため、:func:`!closing` はコンテキストマネージャをサポートしないサードパー" +"ティー製の型で特に役立ちます。\n" +":func:`~urllib.request.urlopen` は通常、コンテキストマネージャとして使用する" +"ため、この例は説明のためのものにすぎません。" #: ../../library/contextlib.rst:196 msgid "" @@ -348,7 +404,6 @@ msgstr "" "ブロックの完了時に *thing* の ``aclose()`` メソッドを呼び出すような非同期コン" "テキストマネージャを返します。これは基本的に以下と等価です::" -#: ../../library/contextlib.rst:199 msgid "" "from contextlib import asynccontextmanager\n" "\n" @@ -359,6 +414,14 @@ msgid "" " finally:\n" " await thing.aclose()" msgstr "" +"from contextlib import asynccontextmanager\n" +"\n" +"@asynccontextmanager\n" +"async def aclosing(thing):\n" +" try:\n" +" yield thing\n" +" finally:\n" +" await thing.aclose()" #: ../../library/contextlib.rst:208 msgid "" @@ -370,7 +433,6 @@ msgstr "" "ロックが終了した場合に、 ``aclosing()`` は非同期ジェネレータの決定論的なク" "リーンアップをサポートすることです::" -#: ../../library/contextlib.rst:212 msgid "" "from contextlib import aclosing\n" "\n" @@ -379,6 +441,12 @@ msgid "" " if value == 42:\n" " break" msgstr "" +"from contextlib import aclosing\n" +"\n" +"async with aclosing(my_generator()) as values:\n" +" async for value in values:\n" +" if value == 42:\n" +" break" #: ../../library/contextlib.rst:219 msgid "" @@ -403,7 +471,6 @@ msgstr "" "テキストマネージャに対する、選択可能な代役として使われることが意図されていま" "す::" -#: ../../library/contextlib.rst:235 msgid "" "def myfunction(arg, ignore_exceptions=False):\n" " if ignore_exceptions:\n" @@ -415,12 +482,20 @@ msgid "" " with cm:\n" " # Do something" msgstr "" +"def myfunction(arg, ignore_exceptions=False):\n" +" if ignore_exceptions:\n" +" # suppress を使ってすべての例外を無視します。\n" +" cm = contextlib.suppress(Exception)\n" +" else:\n" +" # 例外を無視せず、cm は何も行いません。\n" +" cm = contextlib.nullcontext()\n" +" with cm:\n" +" # 何らかの処理" #: ../../library/contextlib.rst:245 msgid "An example using *enter_result*::" msgstr "*enter_result* を使った例です::" -#: ../../library/contextlib.rst:247 msgid "" "def process_file(file_or_path):\n" " if isinstance(file_or_path, str):\n" @@ -433,6 +508,16 @@ msgid "" " with cm as file:\n" " # Perform processing on the file" msgstr "" +"def process_file(file_or_path):\n" +" if isinstance(file_or_path, str):\n" +" # 文字列の場合はファイルを開きます\n" +" cm = open(file_or_path)\n" +" else:\n" +" # ファイルを閉じる責任は呼び出し側にあります\n" +" cm = nullcontext(file_or_path)\n" +"\n" +" with cm as file:\n" +" # ファイルを処理します" #: ../../library/contextlib.rst:258 msgid "" @@ -442,7 +527,6 @@ msgstr "" ":ref:`非同期コンテキストマネージャ ` の代役として使う" "こともできます::" -#: ../../library/contextlib.rst:261 msgid "" "async def send_http(session=None):\n" " if not session:\n" @@ -455,6 +539,16 @@ msgid "" " async with cm as session:\n" " # Send http requests with session" msgstr "" +"async def send_http(session=None):\n" +" if not session:\n" +" # HTTP セッションがなければ aiohttp で作成します\n" +" cm = aiohttp.ClientSession()\n" +" else:\n" +" # セッションを閉じる責任は呼び出し側にあります\n" +" cm = nullcontext(session)\n" +"\n" +" async with cm as session:\n" +" # session を使って HTTP リクエストを送信します" #: ../../library/contextlib.rst:274 msgid ":term:`asynchronous context manager` support was added." @@ -487,7 +581,6 @@ msgstr "" msgid "For example::" msgstr "例えば::" -#: ../../library/contextlib.rst:293 msgid "" "from contextlib import suppress\n" "\n" @@ -497,12 +590,18 @@ msgid "" "with suppress(FileNotFoundError):\n" " os.remove('someotherfile.tmp')" msgstr "" +"from contextlib import suppress\n" +"\n" +"with suppress(FileNotFoundError):\n" +" os.remove('somefile.tmp')\n" +"\n" +"with suppress(FileNotFoundError):\n" +" os.remove('someotherfile.tmp')" #: ../../library/contextlib.rst:301 msgid "This code is equivalent to::" msgstr "これは以下と等価です::" -#: ../../library/contextlib.rst:303 msgid "" "try:\n" " os.remove('somefile.tmp')\n" @@ -514,6 +613,15 @@ msgid "" "except FileNotFoundError:\n" " pass" msgstr "" +"try:\n" +" os.remove('somefile.tmp')\n" +"except FileNotFoundError:\n" +" pass\n" +"\n" +"try:\n" +" os.remove('someotherfile.tmp')\n" +"except FileNotFoundError:\n" +" pass" #: ../../library/contextlib.rst:313 ../../library/contextlib.rst:362 #: ../../library/contextlib.rst:372 ../../library/contextlib.rst:389 @@ -522,7 +630,6 @@ msgstr "" "このコンテキストマネージャは :ref:`再入可能(リエントラント) ` " "です。" -#: ../../library/contextlib.rst:315 msgid "" "If the code within the :keyword:`!with` block raises a :exc:" "`BaseExceptionGroup`, suppressed exceptions are removed from the group. Any " @@ -530,12 +637,18 @@ msgid "" "group which is created using the original group's :meth:`~BaseExceptionGroup." "derive` method." msgstr "" +":keyword:`!with` ブロック内のコードが :exc:`BaseExceptionGroup` を送出した場" +"合、抑制対象の例外はグループから取り除かれます。\n" +"グループ内の抑制されなかった例外は、元のグループの :meth:" +"`~BaseExceptionGroup.derive` メソッドで作成した新しいグループにまとめて再送出" +"されます。" -#: ../../library/contextlib.rst:323 msgid "" "``suppress`` now supports suppressing exceptions raised as part of a :exc:" "`BaseExceptionGroup`." msgstr "" +"``suppress`` は、:exc:`BaseExceptionGroup` の一部として送出された例外の抑制を" +"サポートするようになりました。" #: ../../library/contextlib.rst:329 msgid "" @@ -566,12 +679,14 @@ msgstr "" "よって捕捉することができます。代替の出力ストリームは ``__enter__`` メソッドに" "よって返されるので、 :keyword:`with` 文のターゲットとして利用可能です::" -#: ../../library/contextlib.rst:341 msgid "" "with redirect_stdout(io.StringIO()) as f:\n" " help(pow)\n" "s = f.getvalue()" msgstr "" +"with redirect_stdout(io.StringIO()) as f:\n" +" help(pow)\n" +"s = f.getvalue()" #: ../../library/contextlib.rst:345 msgid "" @@ -581,12 +696,14 @@ msgstr "" ":func:`help` の出力をディスク上のファイルに送るためには、出力を通常のファイル" "にリダイレクトします::" -#: ../../library/contextlib.rst:348 msgid "" "with open('help.txt', 'w') as f:\n" " with redirect_stdout(f):\n" " help(pow)" msgstr "" +"with open('help.txt', 'w') as f:\n" +" with redirect_stdout(f):\n" +" help(pow)" #: ../../library/contextlib.rst:352 msgid "To send the output of :func:`help` to *sys.stderr*::" @@ -594,11 +711,12 @@ msgstr "" ":func:`help` の出力を標準エラー出力 (*sys.stderr*) に送るには以下のようにしま" "す::" -#: ../../library/contextlib.rst:354 msgid "" "with redirect_stdout(sys.stderr):\n" " help(pow)" msgstr "" +"with redirect_stdout(sys.stderr):\n" +" help(pow)" #: ../../library/contextlib.rst:357 msgid "" @@ -675,7 +793,6 @@ msgstr "" msgid "Example of ``ContextDecorator``::" msgstr "``ContextDecorator`` の例::" -#: ../../library/contextlib.rst:407 msgid "" "from contextlib import ContextDecorator\n" "\n" @@ -688,12 +805,21 @@ msgid "" " print('Finishing')\n" " return False" msgstr "" +"from contextlib import ContextDecorator\n" +"\n" +"class mycontext(ContextDecorator):\n" +" def __enter__(self):\n" +" print('Starting')\n" +" return self\n" +"\n" +" def __exit__(self, *exc):\n" +" print('Finishing')\n" +" return False" #: ../../library/contextlib.rst:418 ../../library/contextlib.rst:490 msgid "The class can then be used like this::" msgstr "このとき、クラスは次のように使うことができます::" -#: ../../library/contextlib.rst:420 msgid "" ">>> @mycontext()\n" "... def function():\n" @@ -711,29 +837,48 @@ msgid "" "The bit in the middle\n" "Finishing" msgstr "" +">>> @mycontext()\n" +"... def function():\n" +"... print('The bit in the middle')\n" +"...\n" +">>> function()\n" +"Starting\n" +"The bit in the middle\n" +"Finishing\n" +"\n" +">>> with mycontext():\n" +"... print('The bit in the middle')\n" +"...\n" +"Starting\n" +"The bit in the middle\n" +"Finishing" #: ../../library/contextlib.rst:436 msgid "" "This change is just syntactic sugar for any construct of the following form::" msgstr "これは次のような形のコードに対するシンタックスシュガーになります::" -#: ../../library/contextlib.rst:438 msgid "" "def f():\n" " with cm():\n" " # Do stuff" msgstr "" +"def f():\n" +" with cm():\n" +" # 処理を行います" #: ../../library/contextlib.rst:442 msgid "``ContextDecorator`` lets you instead write::" msgstr "``ContextDecorator`` を使うと代わりに次のように書けます::" -#: ../../library/contextlib.rst:444 msgid "" "@cm()\n" "def f():\n" " # Do stuff" msgstr "" +"@cm()\n" +"def f():\n" +" # 処理を行います" #: ../../library/contextlib.rst:448 msgid "" @@ -751,7 +896,6 @@ msgstr "" "すでに基底クラスを持っているコンテキストマネージャーも、``ContextDecorator`` " "を mixin クラスとして利用することで拡張できます::" -#: ../../library/contextlib.rst:454 msgid "" "from contextlib import ContextDecorator\n" "\n" @@ -762,6 +906,14 @@ msgid "" " def __exit__(self, *exc):\n" " return False" msgstr "" +"from contextlib import ContextDecorator\n" +"\n" +"class mycontext(ContextBaseClass, ContextDecorator):\n" +" def __enter__(self):\n" +" return self\n" +"\n" +" def __exit__(self, *exc):\n" +" return False" #: ../../library/contextlib.rst:464 msgid "" @@ -783,7 +935,6 @@ msgstr ":class:`ContextDecorator` と同じですが、非同期関数専用の msgid "Example of ``AsyncContextDecorator``::" msgstr "``AsyncContextDecorator`` の使用例::" -#: ../../library/contextlib.rst:478 msgid "" "from asyncio import run\n" "from contextlib import AsyncContextDecorator\n" @@ -797,8 +948,18 @@ msgid "" " print('Finishing')\n" " return False" msgstr "" +"from asyncio import run\n" +"from contextlib import AsyncContextDecorator\n" +"\n" +"class mycontext(AsyncContextDecorator):\n" +" async def __aenter__(self):\n" +" print('Starting')\n" +" return self\n" +"\n" +" async def __aexit__(self, *exc):\n" +" print('Finishing')\n" +" return False" -#: ../../library/contextlib.rst:492 msgid "" ">>> @mycontext()\n" "... async def function():\n" @@ -818,6 +979,23 @@ msgid "" "The bit in the middle\n" "Finishing" msgstr "" +">>> @mycontext()\n" +"... async def function():\n" +"... print('The bit in the middle')\n" +"...\n" +">>> run(function())\n" +"Starting\n" +"The bit in the middle\n" +"Finishing\n" +"\n" +">>> async def function():\n" +"... async with mycontext():\n" +"... print('The bit in the middle')\n" +"...\n" +">>> run(function())\n" +"Starting\n" +"The bit in the middle\n" +"Finishing" #: ../../library/contextlib.rst:515 msgid "" @@ -834,7 +1012,6 @@ msgid "" "as follows::" msgstr "例えば、複数のファイルを1つの with 文で簡単に扱うことができます::" -#: ../../library/contextlib.rst:522 msgid "" "with ExitStack() as stack:\n" " files = [stack.enter_context(open(fname)) for fname in filenames]\n" @@ -842,12 +1019,18 @@ msgid "" " # the with statement, even if attempts to open files later\n" " # in the list raise an exception" msgstr "" +"with ExitStack() as stack:\n" +" files = [stack.enter_context(open(fname)) for fname in filenames]\n" +" # リストの後半にあるファイルを開く際に例外が発生しても、\n" +" # 開いたすべてのファイルは with 文の終わりで\n" +" # 自動的に閉じられます" -#: ../../library/contextlib.rst:528 msgid "" "The :meth:`~object.__enter__` method returns the :class:`ExitStack` " "instance, and performs no additional operations." msgstr "" +":meth:`~object.__enter__` メソッドは :class:`ExitStack` インスタンスを返すだ" +"けで、追加の処理は行いません。" #: ../../library/contextlib.rst:531 msgid "" @@ -895,12 +1078,15 @@ msgstr "" "す。アプリケーション独自のより高レベルなコンテキストマネージャーを作るための" "基板として使うのに適しています。" -#: ../../library/contextlib.rst:556 msgid "" "Enters a new context manager and adds its :meth:`~object.__exit__` method to " "the callback stack. The return value is the result of the context manager's " "own :meth:`~object.__enter__` method." msgstr "" +"新しいコンテキストマネージャに入り、その :meth:`~object.__exit__` メソッドを" +"コールバックスタックに追加します。\n" +"戻り値は、コンテキストマネージャ自身の :meth:`~object.__enter__` メソッドの結" +"果です。" #: ../../library/contextlib.rst:560 msgid "" @@ -918,31 +1104,38 @@ msgstr "" "*cm* がコンテキストマネージャでなかった場合、 :exc:`AttributeError` の代わり" "に :exc:`TypeError` 例外を送出します。" -#: ../../library/contextlib.rst:569 msgid "" "Adds a context manager's :meth:`~object.__exit__` method to the callback " "stack." msgstr "" +"コンテキストマネージャの :meth:`~object.__exit__` メソッドをコールバックス" +"タックに追加します。" -#: ../../library/contextlib.rst:571 msgid "" "As ``__enter__`` is *not* invoked, this method can be used to cover part of " "an :meth:`~object.__enter__` implementation with a context manager's own :" "meth:`~object.__exit__` method." msgstr "" +"``__enter__`` は呼び出され *ない* ため、このメソッドを使えば、:meth:`~object." +"__enter__` の実装の一部を、コンテキストマネージャ自身の :meth:`~object." +"__exit__` メソッドによる終了処理の対象にできます。" -#: ../../library/contextlib.rst:575 msgid "" "If passed an object that is not a context manager, this method assumes it is " "a callback with the same signature as a context manager's :meth:`~object." "__exit__` method and adds it directly to the callback stack." msgstr "" +"コンテキストマネージャでないオブジェクトが渡された場合、このメソッドは、その" +"オブジェクトをコンテキストマネージャの :meth:`~object.__exit__` メソッドと同" +"じシグネチャを持つコールバックと見なし、コールバックスタックに直接追加しま" +"す。" -#: ../../library/contextlib.rst:579 msgid "" "By returning true values, these callbacks can suppress exceptions the same " "way context manager :meth:`~object.__exit__` methods can." msgstr "" +"これらのコールバックは、真の値を返すことで、コンテキストマネージャの :meth:" +"`~object.__exit__` メソッドと同様に例外を抑制できます。" #: ../../library/contextlib.rst:582 msgid "" @@ -993,7 +1186,6 @@ msgid "" msgstr "" "例えば、複数のファイルを \"all or nothing\" に開く処理を次のように書けます::" -#: ../../library/contextlib.rst:606 msgid "" "with ExitStack() as stack:\n" " files = [stack.enter_context(open(fname)) for fname in filenames]\n" @@ -1004,6 +1196,15 @@ msgid "" " # they will remain open even after the with statement ends.\n" " # close_files() can then be invoked explicitly to close them all." msgstr "" +"with ExitStack() as stack:\n" +" files = [stack.enter_context(open(fname)) for fname in filenames]\n" +" # close メソッドを保持しますが、まだ呼び出しません。\n" +" close_files = stack.pop_all().close\n" +" # どれかのファイルを開くのに失敗すると、それまでに開いた\n" +" # すべてのファイルが自動的に閉じられます。\n" +" # すべてのファイルを\n" +" # 開けた場合は、with 文が終わった後も開いたままになります。\n" +" # その後、close_files() を明示的に呼んですべて閉じられます。" #: ../../library/contextlib.rst:617 msgid "" @@ -1025,17 +1226,19 @@ msgstr "" "managers>` です。スタック上で同期と非同期の両方のコンテキストマネージャの組み" "合わせをサポートします。また、後処理のためのコルーチンも持っています。" -#: ../../library/contextlib.rst:629 msgid "" "The :meth:`~ExitStack.close` method is not implemented; :meth:`aclose` must " "be used instead." msgstr "" +":meth:`~ExitStack.close` メソッドは実装されていません。\n" +"代わりに :meth:`aclose` を使用する必要があります。" -#: ../../library/contextlib.rst:635 msgid "" "Similar to :meth:`ExitStack.enter_context` but expects an asynchronous " "context manager." msgstr "" +":meth:`ExitStack.enter_context` に似ていますが、非同期コンテキストマネージャ" +"を受け取ります。" #: ../../library/contextlib.rst:638 msgid "" @@ -1045,25 +1248,26 @@ msgstr "" "*cm* が非同期コンテキストマネージャでなかった場合、 :exc:`AttributeError` の" "代わりに :exc:`TypeError` 例外を送出します。" -#: ../../library/contextlib.rst:644 msgid "" "Similar to :meth:`ExitStack.push` but expects either an asynchronous context " "manager or a coroutine function." msgstr "" +":meth:`ExitStack.push` に似ていますが、非同期コンテキストマネージャまたはコ" +"ルーチン関数を受け取ります。" -#: ../../library/contextlib.rst:649 msgid "Similar to :meth:`ExitStack.callback` but expects a coroutine function." msgstr "" +":meth:`ExitStack.callback` に似ていますが、コルーチン関数を受け取ります。" -#: ../../library/contextlib.rst:654 msgid "Similar to :meth:`ExitStack.close` but properly handles awaitables." msgstr "" +":meth:`ExitStack.close` に似ていますが、待機可能オブジェクトを適切に処理しま" +"す。" #: ../../library/contextlib.rst:656 msgid "Continuing the example for :func:`asynccontextmanager`::" msgstr ":func:`asynccontextmanager` の使用例の続きです::" -#: ../../library/contextlib.rst:658 msgid "" "async with AsyncExitStack() as stack:\n" " connections = [await stack.enter_async_context(get_connection())\n" @@ -1072,6 +1276,12 @@ msgid "" " # the async with statement, even if attempts to open a connection\n" " # later in the list raise an exception." msgstr "" +"async with AsyncExitStack() as stack:\n" +" connections = [await stack.enter_async_context(get_connection())\n" +" for i in range(5)]\n" +" # リストの後半で接続を開く際に例外が発生しても、\n" +" # 開いたすべての接続は async with 文の終わりで\n" +" # 自動的に解放されます。" #: ../../library/contextlib.rst:668 msgid "Examples and Recipes" @@ -1105,7 +1315,6 @@ msgstr "" "場合や、いくつかのコンテキストマネージャーがオプションとなる場合に、可変数個" "のコンテキストマネージャーが必要になります::" -#: ../../library/contextlib.rst:684 msgid "" "with ExitStack() as stack:\n" " for resource in resources:\n" @@ -1115,6 +1324,13 @@ msgid "" " stack.callback(release_special_resource, special)\n" " # Perform operations that use the acquired resources" msgstr "" +"with ExitStack() as stack:\n" +" for resource in resources:\n" +" stack.enter_context(resource)\n" +" if need_special_resource():\n" +" special = acquire_special_resource()\n" +" stack.callback(release_special_resource, special)\n" +" # 確保したリソースを使う操作を行います" #: ../../library/contextlib.rst:692 msgid "" @@ -1143,7 +1359,6 @@ msgstr "" "うに、 catch したい場合があります。 :class:`ExitStack` を使って、コンテキスト" "マネージャープロトコル内のステップを分離することができます::" -#: ../../library/contextlib.rst:706 msgid "" "stack = ExitStack()\n" "try:\n" @@ -1154,6 +1369,14 @@ msgid "" " with stack:\n" " # Handle normal case" msgstr "" +"stack = ExitStack()\n" +"try:\n" +" x = stack.enter_context(cm)\n" +"except Exception:\n" +" # __enter__ の例外を処理します\n" +"else:\n" +" with stack:\n" +" # 通常の場合を処理します" #: ../../library/contextlib.rst:715 msgid "" @@ -1177,12 +1400,14 @@ msgstr "" msgid "Cleaning up in an ``__enter__`` implementation" msgstr "``__enter__`` 実装内のクリーンアップ" -#: ../../library/contextlib.rst:727 msgid "" "As noted in the documentation of :meth:`ExitStack.push`, this method can be " "useful in cleaning up an already allocated resource if later steps in the :" "meth:`~object.__enter__` implementation fail." msgstr "" +":meth:`ExitStack.push` のドキュメントで説明したとおり、このメソッドは :meth:" +"`~object.__enter__` の実装の後半で処理が失敗した場合に、すでに確保したリソー" +"スをクリーンアップするのに役立ちます。" #: ../../library/contextlib.rst:731 msgid "" @@ -1194,7 +1419,6 @@ msgstr "" "数を受け取るコンテキストマネージャーで、この方法を使ってコンテキストマネー" "ジャープロトコルを提供しています::" -#: ../../library/contextlib.rst:735 msgid "" "from contextlib import contextmanager, AbstractContextManager, ExitStack\n" "\n" @@ -1231,6 +1455,40 @@ msgid "" " # We don't need to duplicate any of our resource release logic\n" " self.release_resource()" msgstr "" +"from contextlib import contextmanager, AbstractContextManager, ExitStack\n" +"\n" +"class ResourceManager(AbstractContextManager):\n" +"\n" +" def __init__(self, acquire_resource, release_resource, " +"check_resource_ok=None):\n" +" self.acquire_resource = acquire_resource\n" +" self.release_resource = release_resource\n" +" if check_resource_ok is None:\n" +" def check_resource_ok(resource):\n" +" return True\n" +" self.check_resource_ok = check_resource_ok\n" +"\n" +" @contextmanager\n" +" def _cleanup_on_error(self):\n" +" with ExitStack() as stack:\n" +" stack.push(self)\n" +" yield\n" +" # 検証に成功し、例外は発生しませんでした。\n" +" # したがって、リソースを保持し、\n" +" # 呼び出し側に返します。\n" +" stack.pop_all()\n" +"\n" +" def __enter__(self):\n" +" resource = self.acquire_resource()\n" +" with self._cleanup_on_error():\n" +" if not self.check_resource_ok(resource):\n" +" msg = \"Failed validation for {!r}\"\n" +" raise RuntimeError(msg.format(resource))\n" +" return resource\n" +"\n" +" def __exit__(self, *exc_details):\n" +" # リソースの解放処理を重複して記述する必要はありません\n" +" self.release_resource()" #: ../../library/contextlib.rst:771 msgid "Replacing any use of ``try-finally`` and flag variables" @@ -1248,7 +1506,6 @@ msgstr "" "に ``except`` 句を使うだけでは処理できない) ケースでは次のようなコードになり" "ます::" -#: ../../library/contextlib.rst:778 msgid "" "cleanup_needed = True\n" "try:\n" @@ -1259,6 +1516,14 @@ msgid "" " if cleanup_needed:\n" " cleanup_resources()" msgstr "" +"cleanup_needed = True\n" +"try:\n" +" result = perform_operation()\n" +" if result:\n" +" cleanup_needed = False\n" +"finally:\n" +" if cleanup_needed:\n" +" cleanup_resources()" #: ../../library/contextlib.rst:787 msgid "" @@ -1278,7 +1543,6 @@ msgstr "" ":class:`ExitStack` を使えば、代わりに ``with`` 文の終わりに実行されるコール" "バックを登録し、後でそのコールバックをスキップするかどうかを決定できます::" -#: ../../library/contextlib.rst:795 msgid "" "from contextlib import ExitStack\n" "\n" @@ -1288,12 +1552,20 @@ msgid "" " if result:\n" " stack.pop_all()" msgstr "" +"from contextlib import ExitStack\n" +"\n" +"with ExitStack() as stack:\n" +" stack.callback(cleanup_resources)\n" +" result = perform_operation()\n" +" if result:\n" +" stack.pop_all()" -#: ../../library/contextlib.rst:803 msgid "" "This allows the intended cleanup behaviour to be made explicit up front, " "rather than requiring a separate flag variable." msgstr "" +"これにより、別途フラグ変数を用意せずに、意図したクリーンアップの動作をあらか" +"じめ明示できます。" #: ../../library/contextlib.rst:806 msgid "" @@ -1303,7 +1575,6 @@ msgstr "" "もしあるアプリケーションがこのパターンを多用するのであれば、小さいヘルパーク" "ラスを導入してよりシンプルにすることができます::" -#: ../../library/contextlib.rst:809 msgid "" "from contextlib import ExitStack\n" "\n" @@ -1320,6 +1591,20 @@ msgid "" " if result:\n" " cb.cancel()" msgstr "" +"from contextlib import ExitStack\n" +"\n" +"class Callback(ExitStack):\n" +" def __init__(self, callback, /, *args, **kwds):\n" +" super().__init__()\n" +" self.callback(callback, *args, **kwds)\n" +"\n" +" def cancel(self):\n" +" self.pop_all()\n" +"\n" +"with Callback(cleanup_resources) as cb:\n" +" result = perform_operation()\n" +" if result:\n" +" cb.cancel()" #: ../../library/contextlib.rst:824 msgid "" @@ -1331,7 +1616,6 @@ msgstr "" "`ExitStack.callback` のデコレーター形式を利用してリソース開放処理を宣言するこ" "とができます::" -#: ../../library/contextlib.rst:829 msgid "" "from contextlib import ExitStack\n" "\n" @@ -1343,6 +1627,15 @@ msgid "" " if result:\n" " stack.pop_all()" msgstr "" +"from contextlib import ExitStack\n" +"\n" +"with ExitStack() as stack:\n" +" @stack.callback\n" +" def cleanup_resources():\n" +" ...\n" +" result = perform_operation()\n" +" if result:\n" +" stack.pop_all()" #: ../../library/contextlib.rst:839 msgid "" @@ -1379,7 +1672,6 @@ msgstr "" "ネージャーを別々に書く代わりに、 :class:`ContextDecorator` を継承すると1つの" "定義で両方の機能を提供できます::" -#: ../../library/contextlib.rst:856 msgid "" "from contextlib import ContextDecorator\n" "import logging\n" @@ -1396,37 +1688,59 @@ msgid "" " def __exit__(self, exc_type, exc, exc_tb):\n" " logging.info('Exiting: %s', self.name)" msgstr "" +"from contextlib import ContextDecorator\n" +"import logging\n" +"\n" +"logging.basicConfig(level=logging.INFO)\n" +"\n" +"class track_entry_and_exit(ContextDecorator):\n" +" def __init__(self, name):\n" +" self.name = name\n" +"\n" +" def __enter__(self):\n" +" logging.info('Entering: %s', self.name)\n" +"\n" +" def __exit__(self, exc_type, exc, exc_tb):\n" +" logging.info('Exiting: %s', self.name)" #: ../../library/contextlib.rst:871 msgid "Instances of this class can be used as both a context manager::" msgstr "このクラスのインスタンスはコンテキストマネージャーとしても利用でき::" -#: ../../library/contextlib.rst:873 msgid "" "with track_entry_and_exit('widget loader'):\n" " print('Some time consuming activity goes here')\n" " load_widget()" msgstr "" +"with track_entry_and_exit('widget loader'):\n" +" print('Some time consuming activity goes here')\n" +" load_widget()" #: ../../library/contextlib.rst:877 msgid "And also as a function decorator::" msgstr "また関数デコレーターとしても利用できます::" -#: ../../library/contextlib.rst:879 msgid "" "@track_entry_and_exit('widget loader')\n" "def activity():\n" " print('Some time consuming activity goes here')\n" " load_widget()" msgstr "" +"@track_entry_and_exit('widget loader')\n" +"def activity():\n" +" print('Some time consuming activity goes here')\n" +" load_widget()" -#: ../../library/contextlib.rst:884 msgid "" "Note that there is one additional limitation when using context managers as " "function decorators: there's no way to access the return value of :meth:" "`~object.__enter__`. If that value is needed, then it is still necessary to " "use an explicit ``with`` statement." msgstr "" +"コンテキストマネージャを関数デコレータとして使う場合には、もう 1 つ制限があり" +"ます。\n" +":meth:`~object.__enter__` の戻り値にアクセスする方法がありません。\n" +"その値が必要な場合は、明示的な ``with`` 文を使う必要があります。" #: ../../library/contextlib.rst:891 msgid ":pep:`343` - The \"with\" statement" @@ -1533,7 +1847,6 @@ msgstr "" "また :func:`suppress`, :func:`redirect_stdout`, そして :func:`chdir` もリエン" "トラントです。以下はリエントラントな利用法の非常に単純な例です::" -#: ../../library/contextlib.rst:953 msgid "" ">>> from contextlib import redirect_stdout\n" ">>> from io import StringIO\n" @@ -1550,6 +1863,20 @@ msgid "" "This is written to the stream rather than stdout\n" "This is also written to the stream" msgstr "" +">>> from contextlib import redirect_stdout\n" +">>> from io import StringIO\n" +">>> stream = StringIO()\n" +">>> write_to_stream = redirect_stdout(stream)\n" +">>> with write_to_stream:\n" +"... print(\"This is written to the stream rather than stdout\")\n" +"... with write_to_stream:\n" +"... print(\"This is also written to the stream\")\n" +"...\n" +">>> print(\"This is written directly to stdout\")\n" +"This is written directly to stdout\n" +">>> print(stream.getvalue())\n" +"This is written to the stream rather than stdout\n" +"This is also written to the stream" #: ../../library/contextlib.rst:968 msgid "" @@ -1576,7 +1903,6 @@ msgstr "" msgid "Reusable context managers" msgstr "再利用可能なコンテキストマネージャ" -#: ../../library/contextlib.rst:983 msgid "" "Distinct from both single use and reentrant context managers are " "\"reusable\" context managers (or, to be completely explicit, \"reusable, " @@ -1588,10 +1914,11 @@ msgstr "" "単回使用のコンテキストマネージャとリエントラントなコンテキストマネージャのい" "ずれとも異なるタイプに \"再利用可能\" なコンテキストマネージャがあります (あ" "るいは、より明確には、\"再利用可能だがリエントラントでない\" コンテキストマ" -"ネージャです。リエントラントなコンテキストマネージャもまた再利用可能だからで" -"す)。再利用可能なコンテキストマネージャは複数回利用をサポートしますが、同じコ" -"ンテキストマネージャのインスタンスがすでに with 文で使われている場合には失敗" -"します (もしくは正しく動作しません)。" +"ネージャです。\n" +"リエントラントなコンテキストマネージャもまた再利用可能だからです)。\n" +"再利用可能なコンテキストマネージャは複数回利用をサポートしますが、同じコンテ" +"キストマネージャのインスタンスが外側の with 文ですでに使用中の場合には失敗し" +"ます (もしくは正しく動作しません)。" #: ../../library/contextlib.rst:990 msgid "" @@ -1603,17 +1930,17 @@ msgstr "" "ネージャの例です (リエントラントなロックのためには :class:`threading.RLock` " "を代わりに使う必要があります)。" -#: ../../library/contextlib.rst:994 msgid "" "Another example of a reusable, but not reentrant, context manager is :class:" "`ExitStack`, as it invokes *all* currently registered callbacks when leaving " "any with statement, regardless of where those callbacks were added::" msgstr "" -"再利用可能だがリエントラントでないコンテキストマネージャのもうひとつの例は :" -"class:`ExitStack` です。これは現在登録されている *全ての* コールバック関数" -"を、どこで登録されたかにかかわらず、呼び出します::" +"再利用可能だがリエントラントでないコンテキストマネージャのもう一つの例は :" +"class:`ExitStack` です。\n" +"これを使うどの with 文を抜けるときにも、現在登録されている *すべての* コール" +"バックを呼び出します。\n" +"コールバックをどこで登録したかは関係ありません。 ::" -#: ../../library/contextlib.rst:999 msgid "" ">>> from contextlib import ExitStack\n" ">>> stack = ExitStack()\n" @@ -1641,6 +1968,31 @@ msgid "" "Callback: from outer context\n" "Leaving outer context" msgstr "" +">>> from contextlib import ExitStack\n" +">>> stack = ExitStack()\n" +">>> with stack:\n" +"... stack.callback(print, \"Callback: from first context\")\n" +"... print(\"Leaving first context\")\n" +"...\n" +"Leaving first context\n" +"Callback: from first context\n" +">>> with stack:\n" +"... stack.callback(print, \"Callback: from second context\")\n" +"... print(\"Leaving second context\")\n" +"...\n" +"Leaving second context\n" +"Callback: from second context\n" +">>> with stack:\n" +"... stack.callback(print, \"Callback: from outer context\")\n" +"... with stack:\n" +"... stack.callback(print, \"Callback: from inner context\")\n" +"... print(\"Leaving inner context\")\n" +"... print(\"Leaving outer context\")\n" +"...\n" +"Leaving inner context\n" +"Callback: from inner context\n" +"Callback: from outer context\n" +"Leaving outer context" #: ../../library/contextlib.rst:1025 msgid "" @@ -1661,7 +2013,6 @@ msgstr "" "ひとつの :class:`ExitStack` インスタンスを再利用する代わりに複数のインスタン" "スを使うことにより、この問題は回避することができます::" -#: ../../library/contextlib.rst:1033 msgid "" ">>> from contextlib import ExitStack\n" ">>> with ExitStack() as outer_stack:\n" @@ -1676,3 +2027,15 @@ msgid "" "Leaving outer context\n" "Callback: from outer context" msgstr "" +">>> from contextlib import ExitStack\n" +">>> with ExitStack() as outer_stack:\n" +"... outer_stack.callback(print, \"Callback: from outer context\")\n" +"... with ExitStack() as inner_stack:\n" +"... inner_stack.callback(print, \"Callback: from inner context\")\n" +"... print(\"Leaving inner context\")\n" +"... print(\"Leaving outer context\")\n" +"...\n" +"Leaving inner context\n" +"Callback: from inner context\n" +"Leaving outer context\n" +"Callback: from outer context" diff --git a/library/contextvars.po b/library/contextvars.po index e2b813c3c..ab29802a4 100644 --- a/library/contextvars.po +++ b/library/contextvars.po @@ -19,10 +19,10 @@ msgstr "" "Last-Translator: tomo, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/contextvars.rst:2 @@ -45,12 +45,14 @@ msgstr "" "`~contextvars.copy_context` 関数と :class:`~contextvars.Context` クラスを使う" "べきです。" -#: ../../library/contextvars.rst:17 msgid "" "Context managers that have state should use Context Variables instead of :" "func:`threading.local` to prevent their state from bleeding to other code " "unexpectedly, when used in concurrent code." msgstr "" +"状態を持つコンテキストマネージャは、並行コードで使用した際に、その状態が予期" +"せずほかのコードに漏れるのを防ぐため、:func:`threading.local` ではなくコンテ" +"キスト変数を使うべきです。" #: ../../library/contextvars.rst:21 msgid "See also :pep:`567` for additional details." @@ -66,9 +68,8 @@ msgstr "" "このクラスは新しいコンテキスト変数を宣言するのに使われます。例えば、次の通り" "です:" -#: ../../library/contextvars.rst:33 msgid "var: ContextVar[int] = ContextVar('var', default=42)" -msgstr "" +msgstr "var: ContextVar[int] = ContextVar('var', default=42)" #: ../../library/contextvars.rst:35 msgid "" @@ -159,7 +160,6 @@ msgstr "" msgid "For example::" msgstr "例えば::" -#: ../../library/contextvars.rst:87 msgid "" "var = ContextVar('var')\n" "\n" @@ -170,6 +170,15 @@ msgid "" "# After the reset call the var has no value again, so\n" "# var.get() would raise a LookupError." msgstr "" +"var = ContextVar('var')\n" +"\n" +"token = var.set('new value')\n" +"# 'var' を使うコード。\n" +"# var.get() は 'new value' を返します。\n" +"var.reset(token)\n" +"\n" +"# reset の呼び出し後は var の値が再びなくなるため、\n" +"# var.get() を呼ぶと LookupError が送出されます。" #: ../../library/contextvars.rst:99 msgid "" @@ -188,7 +197,6 @@ msgid "" "`with` block::" msgstr "" -#: ../../library/contextvars.rst:108 msgid "" "var = ContextVar('var', default='default value')\n" "\n" @@ -197,10 +205,15 @@ msgid "" "\n" "assert var.get() == 'default value'" msgstr "" +"var = ContextVar('var', default='default value')\n" +"\n" +"with var.set('new value'):\n" +" assert var.get() == 'new value'\n" +"\n" +"assert var.get() == 'default value'" -#: ../../library/contextvars.rst:117 msgid "Added support for usage as a context manager." -msgstr "" +msgstr "コンテキストマネージャとして使用できるようになりました。" #: ../../library/contextvars.rst:121 msgid "" @@ -240,11 +253,12 @@ msgstr "" "次のスニペットは、現在のコンテキストのコピーを取得し、コンテキストに設定され" "ているすべての変数とその値を表示します::" -#: ../../library/contextvars.rst:146 msgid "" "ctx: Context = copy_context()\n" "print(list(ctx.items()))" msgstr "" +"ctx: Context = copy_context()\n" +"print(list(ctx.items()))" #: ../../library/contextvars.rst:149 msgid "" @@ -255,9 +269,8 @@ msgstr "" "この関数の複雑性は *O*\\ (1) です。つまり、少数のコンテキスト変数を持つコンテ" "キストと多くの変数を持つコンテキストで同程度の速度で動作します。" -#: ../../library/contextvars.rst:156 msgid "A mapping of :class:`ContextVars ` to their values." -msgstr ":class:`ContextVars` とその値の対応付け。" +msgstr ":class:`ContextVar` とその値を対応付けるマッピング。" #: ../../library/contextvars.rst:158 msgid "" @@ -267,47 +280,59 @@ msgstr "" "``Context()`` は、値を持たない空のコンテキストを生成します。現在のコンテキス" "トのコピーを得るには、:func:`~contextvars.copy_context` 関数を利用します。" -#: ../../library/contextvars.rst:162 msgid "" "Each thread has its own effective stack of :class:`!Context` objects. The :" "term:`current context` is the :class:`!Context` object at the top of the " "current thread's stack. All :class:`!Context` objects in the stacks are " "considered to be *entered*." msgstr "" +"各スレッドには、実質的にそれぞれ独立した :class:`!Context` オブジェクトのス" +"タックがあります。\n" +":term:`current context` は、現在のスレッドのスタックの最上部にある :class:`!" +"Context` オブジェクトです。\n" +"スタック内のすべての :class:`!Context` オブジェクトは、*入っている* 状態と見" +"なされます。" -#: ../../library/contextvars.rst:167 msgid "" "*Entering* a context, which can be done by calling its :meth:`~Context.run` " "method, makes the context the current context by pushing it onto the top of " "the current thread's context stack." msgstr "" +"コンテキストに *入る* には、その :meth:`~Context.run` メソッドを呼び出しま" +"す。\n" +"これにより、そのコンテキストが現在のスレッドのコンテキストスタックの最上部に" +"積まれ、現在のコンテキストになります。" -#: ../../library/contextvars.rst:171 msgid "" "*Exiting* from the current context, which can be done by returning from the " "callback passed to the :meth:`~Context.run` method, restores the current " "context to what it was before the context was entered by popping the context " "off the top of the context stack." msgstr "" +"現在のコンテキストから *出る* には、:meth:`~Context.run` メソッドに渡したコー" +"ルバックから戻ります。\n" +"これにより、そのコンテキストがコンテキストスタックの最上部から取り除かれ、現" +"在のコンテキストが、そのコンテキストに入る前のものに戻ります。" -#: ../../library/contextvars.rst:176 msgid "" "Since each thread has its own context stack, :class:`ContextVar` objects " "behave in a similar fashion to :func:`threading.local` when values are " "assigned in different threads." msgstr "" +"各スレッドが独自のコンテキストスタックを持つため、異なるスレッドで値を代入し" +"た場合、:class:`ContextVar` オブジェクトは :func:`threading.local` と同様に振" +"る舞います。" -#: ../../library/contextvars.rst:180 msgid "" "Attempting to enter an already entered context, including contexts entered " "in other threads, raises a :exc:`RuntimeError`." msgstr "" +"ほかのスレッドで入っているコンテキストも含め、すでに入っているコンテキストに" +"入ろうとすると、:exc:`RuntimeError` が送出されます。" -#: ../../library/contextvars.rst:183 msgid "After exiting a context, it can later be re-entered (from any thread)." -msgstr "" +msgstr "コンテキストから出た後は、どのスレッドからでも再び入ることができます。" -#: ../../library/contextvars.rst:185 msgid "" "Any changes to :class:`ContextVar` values via the :meth:`ContextVar.set` " "method are recorded in the current context. The :meth:`ContextVar.get` " @@ -316,24 +341,32 @@ msgid "" "context was entered (if needed, the values can be restored by re-entering " "the context)." msgstr "" +":meth:`ContextVar.set` メソッドによる :class:`ContextVar` の値の変更は、現在" +"のコンテキストに記録されます。\n" +":meth:`ContextVar.get` メソッドは、現在のコンテキストに対応する値を返しま" +"す。\n" +"コンテキストから出ると、そのコンテキストに入っていた間に行ったコンテキスト変" +"数の変更は、実質的に元に戻ります (必要であれば、そのコンテキストに再び入るこ" +"とで変更後の値を復元できます)。" #: ../../library/contextvars.rst:192 msgid "Context implements the :class:`collections.abc.Mapping` interface." msgstr "" "Context は、 :class:`collections.abc.Mapping` インターフェースを実装します。" -#: ../../library/contextvars.rst:196 msgid "" "Enters the Context, executes ``callable(*args, **kwargs)``, then exits the " "Context. Returns *callable*'s return value, or propagates an exception if " "one occurred." msgstr "" +"このコンテキストに入り、``callable(*args, **kwargs)`` を実行してから、このコ" +"ンテキストを出ます。\n" +"*callable* の戻り値を返すか、例外が発生した場合はそれを伝播させます。" #: ../../library/contextvars.rst:200 msgid "Example:" msgstr "例:" -#: ../../library/contextvars.rst:202 msgid "" "import contextvars\n" "\n" @@ -366,6 +399,36 @@ msgid "" "# However, outside of 'ctx', 'var' is still set to 'spam':\n" "print(var.get()) # 'spam'" msgstr "" +"import contextvars\n" +"\n" +"var = contextvars.ContextVar('var')\n" +"var.set('spam')\n" +"print(var.get()) # 'spam'\n" +"\n" +"ctx = contextvars.copy_context()\n" +"\n" +"def main():\n" +" # 'copy_context()' と 'ctx.run(main)' を呼ぶ前に\n" +" # 'var' を 'spam' に設定したため、次のようになります:\n" +" print(var.get()) # 'spam'\n" +" print(ctx[var]) # 'spam'\n" +"\n" +" var.set('ham')\n" +"\n" +" # 'var' を 'ham' に設定した後は:\n" +" print(var.get()) # 'ham'\n" +" print(ctx[var]) # 'ham'\n" +"\n" +"# 'main' 関数が 'var' に行う変更はすべて\n" +"# 'ctx' 内にとどまります。\n" +"ctx.run(main)\n" +"\n" +"# 'main()' 関数は 'ctx' コンテキスト内で実行されたので、\n" +"# 'var' の変更はその中にとどまります:\n" +"print(ctx[var]) # 'ham'\n" +"\n" +"# 一方、'ctx' の外では 'var' は依然として 'spam' に設定されています:\n" +"print(var.get()) # 'spam'" #: ../../library/contextvars.rst:248 msgid "Return a shallow copy of the context object." @@ -424,16 +487,17 @@ msgstr "" msgid "asyncio support" msgstr "asyncio サポート" -#: ../../library/contextvars.rst:294 msgid "" "Context variables are natively supported in :mod:`asyncio` and are ready to " "be used without any extra configuration. For example, here is a simple echo " "server, that uses a context variable to make the address of a remote client " "available in the Task that handles that client::" msgstr "" -"コンテキスト変数は、追加の設定なしに :mod:`asyncio` をサポートします。例え" -"ば、次の単純なechoサーバーは、クライアントを扱う Task の中でリモートクライア" -"ントのアドレスが利用できるように、コンテキスト変数を利用します::" +"コンテキスト変数は :mod:`asyncio` に標準でサポートされており、追加の設定なし" +"に使用できます。\n" +"例えば、以下はコンテキスト変数を使った単純な echo サーバーです。\n" +"リモートクライアントのアドレスを、そのクライアントを扱う Task 内で利用できる" +"ようにしています。 ::" #: ../../library/contextvars.rst:300 msgid "" diff --git a/library/copy.po b/library/copy.po index cbfa8164d..62fe0e95e 100644 --- a/library/copy.po +++ b/library/copy.po @@ -21,10 +21,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/copy.rst:2 @@ -56,17 +56,18 @@ msgstr "以下にインターフェースをまとめます:" #: ../../library/copy.rst:22 msgid "Return a shallow copy of *obj*." -msgstr "" +msgstr "*obj* の浅い (shallow) コピーを返します。" #: ../../library/copy.rst:27 msgid "Return a deep copy of *obj*." -msgstr "" +msgstr "*obj* の深い (deep) コピーを返します。" -#: ../../library/copy.rst:32 msgid "" "Creates a new object of the same type as *obj*, replacing fields with values " "from *changes*." msgstr "" +"*obj* と同じ型の新しいオブジェクトを作成し、フィールドを *changes* の値で置き" +"換えます。" #: ../../library/copy.rst:40 msgid "Raised for module specific errors." @@ -91,13 +92,12 @@ msgstr "" "限り) 元のオブジェクト中に見つかったオブジェクトに対する *参照* を挿入しま" "す。" -#: ../../library/copy.rst:50 msgid "" "A *deep copy* constructs a new compound object and then, recursively, " "inserts *copies* into it of the objects found in the original." msgstr "" -"*深いコピー (deep copy)* は新たな複合オブジェクトを作成し、その後元のオブジェ" -"クト中に見つかったオブジェクトの *コピー* を挿入します。" +"*深いコピー (deep copy)* は新しい複合オブジェクトを作成し、元のオブジェクトに" +"含まれるオブジェクトを再帰的に *コピー* して挿入します。" #: ../../library/copy.rst:53 msgid "" @@ -107,13 +107,12 @@ msgstr "" "深いコピー操作には、しばしば浅いコピー操作の時には存在しない 2 つの問題がつい" "てまわります:" -#: ../../library/copy.rst:56 msgid "" "Recursive objects (compound objects that, directly or indirectly, contain a " "reference to themselves) may cause a recursive loop." msgstr "" -"再帰的なオブジェクト (直接、間接に関わらず、自分自身に対する参照を持つ複合オ" -"ブジェクト) は再帰ループを引き起こします。" +"再帰的なオブジェクト (直接または間接に自分自身への参照を含む複合オブジェク" +"ト) は、再帰ループを引き起こすことがあります。" #: ../../library/copy.rst:59 msgid "" @@ -179,19 +178,20 @@ msgstr "" "ル :mod:`pickle` の説明を参照してください。実際、 :mod:`copy` モジュール" "は、 :mod:`copyreg` モジュールによって登録された pickle 関数を使用します。" -#: ../../library/copy.rst:92 msgid "" "In order for a class to define its own copy implementation, it can define " "special methods :meth:`~object.__copy__` and :meth:`~object.__deepcopy__`." msgstr "" +"クラス独自のコピー処理を実装するには、特殊メソッド :meth:`~object.__copy__` " +"と :meth:`~object.__deepcopy__` を定義できます。" -#: ../../library/copy.rst:98 msgid "" "Called to implement the shallow copy operation; no additional arguments are " "passed." msgstr "" +"浅いコピー操作を実装するために呼び出されます。\n" +"追加の引数は渡されません。" -#: ../../library/copy.rst:104 msgid "" "Called to implement the deep copy operation; it is passed one argument, the " "*memo* dictionary. If the ``__deepcopy__`` implementation needs to make a " @@ -199,20 +199,30 @@ msgid "" "with the component as first argument and the *memo* dictionary as second " "argument. The *memo* dictionary should be treated as an opaque object." msgstr "" +"深いコピー操作を実装するために呼び出されます。\n" +"引数として *memo* 辞書が 1 つ渡されます。\n" +"``__deepcopy__`` の実装内で構成要素の深いコピーが必要な場合は、第 1 引数にそ" +"の構成要素、第 2 引数に *memo* 辞書を渡して :func:`~copy.deepcopy` 関数を呼び" +"出す必要があります。\n" +"*memo* 辞書は内部構造に立ち入らない不透明なオブジェクトとして扱ってください。" -#: ../../library/copy.rst:114 msgid "" "Function :func:`!copy.replace` is more limited than :func:`~copy.copy` and :" "func:`~copy.deepcopy`, and only supports named tuples created by :func:" "`~collections.namedtuple`, :mod:`dataclasses`, and other classes which " "define method :meth:`~object.__replace__`." msgstr "" +":func:`!copy.replace` 関数は :func:`~copy.copy` や :func:`~copy.deepcopy` よ" +"り制限が多く、:func:`~collections.namedtuple` で作成した名前付きタプル、:mod:" +"`dataclasses`、および :meth:`~object.__replace__` メソッドを定義するクラスの" +"みをサポートします。" -#: ../../library/copy.rst:122 msgid "" "This method should create a new object of the same type, replacing fields " "with values from *changes*." msgstr "" +"このメソッドは、フィールドを *changes* の値で置き換えた、同じ型の新しいオブ" +"ジェクトを作成する必要があります。" #: ../../library/copy.rst:128 msgid "Module :mod:`pickle`" @@ -242,6 +252,5 @@ msgstr "__copy__() (コピープロトコル)" msgid "__deepcopy__() (copy protocol)" msgstr "__deepcopy__() (コピープロトコル)" -#: ../../library/copy.rst:111 msgid "__replace__() (replace protocol)" -msgstr "" +msgstr "__replace__() (置換プロトコル)" diff --git a/library/copyreg.po b/library/copyreg.po index dd76a3ab1..d5124c2d0 100644 --- a/library/copyreg.po +++ b/library/copyreg.po @@ -19,10 +19,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/copyreg.rst:2 diff --git a/library/crypt.po b/library/crypt.po index 0a7fdb541..89ff5c7db 100644 --- a/library/crypt.po +++ b/library/crypt.po @@ -12,15 +12,14 @@ msgstr "" "PO-Revision-Date: 2024-11-19 01:02+0000\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" -#: ../../library/crypt.rst:2 msgid ":mod:`!crypt` --- Function to check Unix passwords" -msgstr "" +msgstr ":mod:`!crypt` --- Unix パスワードを確認する関数" #: ../../library/crypt.rst:10 msgid "" @@ -28,6 +27,9 @@ msgid "" "`removed in Python 3.13 ` after being deprecated in " "Python 3.11. The removal was decided in :pep:`594`." msgstr "" +"このモジュールは今や Python 標準ライブラリの一部ではありません。このモジュー" +"ルは Python 3.11 で非推奨となったあと、:ref:`Python 3.13 で削除` されました。削除の決定は :pep:`594` でなされました。" #: ../../library/crypt.rst:14 msgid "" @@ -37,8 +39,9 @@ msgid "" "These are not supported or maintained by the Python core team." msgstr "" -#: ../../library/crypt.rst:19 msgid "" "The last version of Python that provided the :mod:`!crypt` module was " "`Python 3.12 `_." msgstr "" +":mod:`!crypt` モジュールを提供していた最後の Python バージョンは `Python " +"3.12 `_ です。" diff --git a/library/crypto.po b/library/crypto.po index 2c0081612..4108e7532 100644 --- a/library/crypto.po +++ b/library/crypto.po @@ -18,25 +18,25 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/crypto.rst:5 msgid "Cryptographic Services" msgstr "暗号関連のサービス" -#: ../../library/crypto.rst:9 msgid "" "The modules described in this chapter implement various algorithms of a " "cryptographic nature. They are available at the discretion of the " "installation. Here's an overview:" msgstr "" -"この章で記述されているモジュールでは、暗号の本質に関わる様々なアルゴリズムを" -"実装しています。 これらは必要に応じてインストールすることで使用できます。概要" -"を以下に示します:" +"この章で説明するモジュールは、暗号に関するさまざまなアルゴリズムを実装してい" +"ます。\n" +"利用できるかどうかはインストール環境によります。\n" +"概要を以下に示します:" #: ../../library/crypto.rst:7 msgid "cryptography" diff --git a/library/csv.po b/library/csv.po index 53abd0139..0b522779c 100644 --- a/library/csv.po +++ b/library/csv.po @@ -21,10 +21,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/csv.rst:2 @@ -106,7 +106,6 @@ msgstr "モジュールコンテンツ" msgid "The :mod:`csv` module defines the following functions:" msgstr ":mod:`csv` モジュールでは以下の関数を定義しています:" -#: ../../library/csv.rst:58 msgid "" "Return a :ref:`reader object ` that will process lines from " "the given *csvfile*. A csvfile must be an iterable of strings, each in the " @@ -120,6 +119,21 @@ msgid "" "parameters in the current dialect. For full details about the dialect and " "formatting parameters, see section :ref:`csv-fmt-params`." msgstr "" +"指定された *csvfile* の行を処理する :ref:`reader オブジェクト ` を返します。\n" +"``csvfile`` は文字列のイテラブルでなければならず、各文字列は reader に定義さ" +"れた CSV 形式である必要があります。\n" +"``csvfile`` には通常、ファイルライクオブジェクトやリストを使います。\n" +"*csvfile* がファイルオブジェクトの場合は、``newline=''`` を指定して開く必要が" +"あります [1]_。\n" +"省略可能な *dialect* 引数では、特定の CSV 表現形式に固有のパラメータ群を指定" +"できます。\n" +":class:`Dialect` クラスのサブクラスのインスタンスか、:func:`list_dialects` 関" +"数が返す文字列のいずれかを指定できます。\n" +"その他の省略可能なキーワード引数 *fmtparams* を指定すると、現在の表現形式の書" +"式パラメータを個別に上書きできます。\n" +"表現形式と書式パラメータの詳細については、:ref:`csv-fmt-params` 節を参照して" +"ください。" #: ../../library/csv.rst:72 msgid "" @@ -138,7 +152,6 @@ msgstr "" msgid "A short usage example::" msgstr "短い利用例::" -#: ../../library/csv.rst:78 msgid "" ">>> import csv\n" ">>> with open('eggs.csv', newline='') as csvfile:\n" @@ -148,6 +161,13 @@ msgid "" "Spam, Spam, Spam, Spam, Spam, Baked Beans\n" "Spam, Lovely Spam, Wonderful Spam" msgstr "" +">>> import csv\n" +">>> with open('eggs.csv', newline='') as csvfile:\n" +"... spamreader = csv.reader(csvfile, delimiter=' ', quotechar='|')\n" +"... for row in spamreader:\n" +"... print(', '.join(row))\n" +"Spam, Spam, Spam, Spam, Spam, Baked Beans\n" +"Spam, Lovely Spam, Wonderful Spam" #: ../../library/csv.rst:89 msgid "" @@ -185,7 +205,6 @@ msgstr "" "きます。他の非文字列データは、書き出される前に :func:`str` を使って文字列に変" "換されます。" -#: ../../library/csv.rst:108 msgid "" "import csv\n" "with open('eggs.csv', 'w', newline='') as csvfile:\n" @@ -194,6 +213,12 @@ msgid "" " spamwriter.writerow(['Spam'] * 5 + ['Baked Beans'])\n" " spamwriter.writerow(['Spam', 'Lovely Spam', 'Wonderful Spam'])" msgstr "" +"import csv\n" +"with open('eggs.csv', 'w', newline='') as csvfile:\n" +" spamwriter = csv.writer(csvfile, delimiter=' ',\n" +" quotechar='|', quoting=csv.QUOTE_MINIMAL)\n" +" spamwriter.writerow(['Spam'] * 5 + ['Baked Beans'])\n" +" spamwriter.writerow(['Spam', 'Lovely Spam', 'Wonderful Spam'])" #: ../../library/csv.rst:118 msgid "" @@ -252,7 +277,6 @@ msgstr "" "るオブジェクトを生成します。マップのキーは省略可能な *fieldnames* パラメータ" "で与えられます。" -#: ../../library/csv.rst:157 msgid "" "The *fieldnames* parameter is a :term:`sequence`. If *fieldnames* is " "omitted, the values in the first row of file *f* will be used as the " @@ -261,6 +285,12 @@ msgid "" "results. Regardless of how the fieldnames are determined, the dictionary " "preserves their original ordering." msgstr "" +"*fieldnames* 引数は :term:`sequence` です。\n" +"*fieldnames* を省略すると、ファイル *f* の最初の行の値をフィールド名として使" +"い、その行を結果から除外します。\n" +"*fieldnames* を指定すると、それをフィールド名として使い、最初の行も結果に含め" +"ます。\n" +"フィールド名の決め方にかかわらず、辞書はその元の順序を保持します。" #: ../../library/csv.rst:164 msgid "" @@ -300,7 +330,6 @@ msgstr "返される行の型は :class:`OrderedDict` になりました。" msgid "Returned rows are now of type :class:`dict`." msgstr "返される行の型は :class:`dict` になりました。" -#: ../../library/csv.rst:183 msgid "" ">>> import csv\n" ">>> with open('names.csv', newline='') as csvfile:\n" @@ -314,8 +343,18 @@ msgid "" ">>> print(row)\n" "{'first_name': 'John', 'last_name': 'Cleese'}" msgstr "" +">>> import csv\n" +">>> with open('names.csv', newline='') as csvfile:\n" +"... reader = csv.DictReader(csvfile)\n" +"... for row in reader:\n" +"... print(row['first_name'], row['last_name'])\n" +"...\n" +"Eric Idle\n" +"John Cleese\n" +"\n" +">>> print(row)\n" +"{'first_name': 'John', 'last_name': 'Cleese'}" -#: ../../library/csv.rst:199 msgid "" "Create an object which operates like a regular writer but maps dictionaries " "onto output rows. The *fieldnames* parameter is a :mod:`sequence " @@ -331,15 +370,20 @@ msgid "" "to the underlying :class:`writer` instance." msgstr "" "通常の writer のように動作しますが、辞書を出力行にマップするオブジェクトを生" -"成します。 *fieldnames* パラメータは、:meth:`~csvwriter.writerow` メソッドに" -"渡された辞書の値がどのような順番でファイル *f* に書かれるかを指定するキーの :" -"mod:`sequence ` です。 :meth:`~csvwriter.writerow` メソッド" -"に渡された辞書に *fieldnames* には存在しないキーが含まれている場合、オプショ" -"ンの *extrasaction* パラメータによってどんな動作を行うかが指定されます。この" -"値がデフォルト値である ``'raise'`` に設定されている場合、 :exc:`ValueError` " -"が送出されます。 ``'ignore'`` に設定されている場合、辞書の余分な値は無視され" -"ます。その他のパラメータはベースになっている :class:`writer` インスタンスに渡" -"されます。" +"成します。\n" +"*fieldnames* パラメータは、:meth:`~csvwriter.writerow` メソッドに渡された辞書" +"の値がどのような順番でファイル *f* に書かれるかを指定するキーの :mod:" +"`sequence ` です。\n" +"省略可能な *restval* パラメータは、辞書に *fieldnames* のキーがない場合に書き" +"込む値を指定します。\n" +":meth:`~csvwriter.writerow` メソッドに渡された辞書に *fieldnames* には存在し" +"ないキーが含まれている場合、オプションの *extrasaction* パラメータによってど" +"んな動作を行うかが指定されます。\n" +"この値がデフォルト値である ``'raise'`` に設定されている場合、 :exc:" +"`ValueError` が送出されます。\n" +"``'ignore'`` に設定されている場合、辞書の余分な値は無視されます。\n" +"その他のパラメータはベースになっている :class:`writer` インスタンスに渡されま" +"す。" #: ../../library/csv.rst:214 msgid "" @@ -349,7 +393,6 @@ msgstr "" ":class:`DictReader` クラスとは異なり、 :class:`DictWriter` の *fieldnames* パ" "ラメータは省略可能ではありません。" -#: ../../library/csv.rst:221 msgid "" "import csv\n" "\n" @@ -362,6 +405,16 @@ msgid "" " writer.writerow({'first_name': 'Lovely', 'last_name': 'Spam'})\n" " writer.writerow({'first_name': 'Wonderful', 'last_name': 'Spam'})" msgstr "" +"import csv\n" +"\n" +"with open('names.csv', 'w', newline='') as csvfile:\n" +" fieldnames = ['first_name', 'last_name']\n" +" writer = csv.DictWriter(csvfile, fieldnames=fieldnames)\n" +"\n" +" writer.writeheader()\n" +" writer.writerow({'first_name': 'Baked', 'last_name': 'Beans'})\n" +" writer.writerow({'first_name': 'Lovely', 'last_name': 'Spam'})\n" +" writer.writerow({'first_name': 'Wonderful', 'last_name': 'Spam'})" #: ../../library/csv.rst:235 msgid "" @@ -377,20 +430,26 @@ msgstr "" "す。 :class:`Dialect` クラスのインスタンスは :class:`reader` と :class:" "`writer` のインスタンスの挙動を定義します。" -#: ../../library/csv.rst:241 msgid "" "All available :class:`Dialect` names are returned by :func:`list_dialects`, " "and they can be registered with specific :class:`reader` and :class:`writer` " "classes through their initializer (``__init__``) functions like this::" msgstr "" +"利用可能な :class:`Dialect` の名前はすべて :func:`list_dialects` で取得できま" +"す。\n" +"次のように初期化関数 (``__init__``) を通じて、個々の :class:`reader` クラス" +"や :class:`writer` クラスに表現形式を指定できます。 ::" -#: ../../library/csv.rst:245 msgid "" "import csv\n" "\n" "with open('students.csv', 'w', newline='') as csvfile:\n" " writer = csv.writer(csvfile, dialect='unix')" msgstr "" +"import csv\n" +"\n" +"with open('students.csv', 'w', newline='') as csvfile:\n" +" writer = csv.writer(csvfile, dialect='unix')" #: ../../library/csv.rst:253 msgid "" @@ -441,13 +500,16 @@ msgstr "" "`Dialect` サブクラスを返します。オプションの *delimiters* パラメータを与えた" "場合、有効なデリミタ文字を含んでいるはずの文字列として解釈されます。" -#: ../../library/csv.rst:288 msgid "" "Analyze the sample text (presumed to be in CSV format) and return :const:" "`True` if the first row appears to be a series of column headers. Inspecting " "each column, one of two key criteria will be considered to estimate if the " "sample contains a header:" msgstr "" +"CSV 形式であると想定したサンプルテキストを解析し、最初の行が列見出しの並びと" +"思われる場合に :const:`True` を返します。\n" +"各列を調べ、次の 2 つの主要な基準のいずれかに基づいて、サンプルに見出しが含ま" +"れるかを推定します:" #: ../../library/csv.rst:293 msgid "the second through n-th rows contain numeric values" @@ -479,7 +541,6 @@ msgstr "" msgid "An example for :class:`Sniffer` use::" msgstr ":class:`Sniffer` の利用例::" -#: ../../library/csv.rst:307 msgid "" "with open('example.csv', newline='') as csvfile:\n" " dialect = csv.Sniffer().sniff(csvfile.read(1024))\n" @@ -487,6 +548,11 @@ msgid "" " reader = csv.reader(csvfile, dialect)\n" " # ... process CSV file contents here ..." msgstr "" +"with open('example.csv', newline='') as csvfile:\n" +" dialect = csv.Sniffer().sniff(csvfile.read(1024))\n" +" csvfile.seek(0)\n" +" reader = csv.reader(csvfile, dialect)\n" +" # ... ここで CSV ファイルの内容を処理します ..." #: ../../library/csv.rst:316 msgid "The :mod:`csv` module defines the following constants:" @@ -542,31 +608,40 @@ msgstr "" ":class:`reader` オブジェクトに、クオート文字に対する特殊処理を行わないよう指" "示します。" -#: ../../library/csv.rst:348 msgid "" "Instructs :class:`writer` objects to quote all fields which are not " "``None``. This is similar to :data:`QUOTE_ALL`, except that if a field " "value is ``None`` an empty (unquoted) string is written." msgstr "" +":class:`writer` オブジェクトに、``None`` ではないすべてのフィールドをクォート" +"するよう指示します。\n" +":data:`QUOTE_ALL` に似ていますが、フィールドの値が ``None`` の場合は、クォー" +"トされていない空文字列を書き込みます。" -#: ../../library/csv.rst:352 msgid "" "Instructs :class:`reader` objects to interpret an empty (unquoted) field as " "``None`` and to otherwise behave as :data:`QUOTE_ALL`." msgstr "" +":class:`reader` オブジェクトに、クォートされていない空のフィールドを " +"``None`` と解釈し、それ以外は :data:`QUOTE_ALL` と同様に動作するよう指示しま" +"す。" -#: ../../library/csv.rst:359 msgid "" "Instructs :class:`writer` objects to always place quotes around fields which " "are strings. This is similar to :data:`QUOTE_NONNUMERIC`, except that if a " "field value is ``None`` an empty (unquoted) string is written." msgstr "" +":class:`writer` オブジェクトに、文字列のフィールドを常にクォートするよう指示" +"します。\n" +":data:`QUOTE_NONNUMERIC` に似ていますが、フィールドの値が ``None`` の場合は、" +"クォートされていない空文字列を書き込みます。" -#: ../../library/csv.rst:363 msgid "" "Instructs :class:`reader` objects to interpret an empty (unquoted) string as " "``None`` and to otherwise behave as :data:`QUOTE_NONNUMERIC`." msgstr "" +":class:`reader` オブジェクトに、クォートされていない空文字列を ``None`` と解" +"釈し、それ以外は :data:`QUOTE_NONNUMERIC` と同様に動作するよう指示します。" #: ../../library/csv.rst:368 msgid "The :mod:`csv` module defines the following exception:" @@ -580,7 +655,6 @@ msgstr "全ての関数において、エラーが検出された際に送出さ msgid "Dialects and Formatting Parameters" msgstr "Dialect クラスと書式化パラメータ" -#: ../../library/csv.rst:380 msgid "" "To make it easier to specify the format of input and output records, " "specific formatting parameters are grouped together into dialects. A " @@ -592,6 +666,17 @@ msgid "" "specify individual formatting parameters, which have the same names as the " "attributes defined below for the :class:`Dialect` class." msgstr "" +"入出力レコードの形式を簡単に指定できるように、書式パラメータを表現形式 " +"(dialect) としてまとめています。\n" +"表現形式は :class:`Dialect` クラスのサブクラスであり、CSV ファイルの形式を記" +"述するさまざまな属性を持ちます。\n" +":class:`reader` オブジェクトや :class:`writer` オブジェクトを作成する際、" +"``dialect`` 引数には文字列か :class:`Dialect` クラスのサブクラスを指定できま" +"す。\n" +"*dialect* 引数に加えて、またはその代わりに、書式パラメータを個別に指定するこ" +"ともできます。\n" +"各パラメータの名前は、以下で定義する :class:`Dialect` クラスの属性名と同じで" +"す。" #: ../../library/csv.rst:390 msgid "Dialects support the following attributes:" @@ -813,12 +898,14 @@ msgstr "writer で使われる表現形式の読み出し専用の記述です msgid "DictWriter objects have the following public method:" msgstr "DictWriter のオブジェクトは以下の public メソッドを持っています:" -#: ../../library/csv.rst:537 msgid "" "Write a row with the field names (as specified in the constructor) to the " "writer's file object, formatted according to the current dialect. Return the " "return value of the :meth:`csvwriter.writerow` call used internally." msgstr "" +"コンストラクタで指定したフィールド名を、現在の表現形式に従って整形し、writer " +"のファイルオブジェクトに 1 行書き込みます。\n" +"内部で呼び出す :meth:`csvwriter.writerow` の戻り値を返します。" #: ../../library/csv.rst:542 msgid "" @@ -836,7 +923,6 @@ msgstr "使用例" msgid "The simplest example of reading a CSV file::" msgstr "最も簡単な CSV ファイル読み込みの例です::" -#: ../../library/csv.rst:554 msgid "" "import csv\n" "with open('some.csv', newline='') as f:\n" @@ -844,12 +930,16 @@ msgid "" " for row in reader:\n" " print(row)" msgstr "" +"import csv\n" +"with open('some.csv', newline='') as f:\n" +" reader = csv.reader(f)\n" +" for row in reader:\n" +" print(row)" #: ../../library/csv.rst:560 msgid "Reading a file with an alternate format::" msgstr "別の書式での読み込み::" -#: ../../library/csv.rst:562 msgid "" "import csv\n" "with open('passwd', newline='') as f:\n" @@ -857,18 +947,26 @@ msgid "" " for row in reader:\n" " print(row)" msgstr "" +"import csv\n" +"with open('passwd', newline='') as f:\n" +" reader = csv.reader(f, delimiter=':', quoting=csv.QUOTE_NONE)\n" +" for row in reader:\n" +" print(row)" #: ../../library/csv.rst:568 msgid "The corresponding simplest possible writing example is::" msgstr "上に対して、単純な書き込みのプログラム例は以下のようになります。 ::" -#: ../../library/csv.rst:570 msgid "" "import csv\n" "with open('some.csv', 'w', newline='') as f:\n" " writer = csv.writer(f)\n" " writer.writerows(someiterable)" msgstr "" +"import csv\n" +"with open('some.csv', 'w', newline='') as f:\n" +" writer = csv.writer(f)\n" +" writer.writerows(someiterable)" #: ../../library/csv.rst:575 msgid "" @@ -903,13 +1001,16 @@ msgstr "" msgid "Registering a new dialect::" msgstr "新しい表現形式の登録::" -#: ../../library/csv.rst:591 msgid "" "import csv\n" "csv.register_dialect('unixpwd', delimiter=':', quoting=csv.QUOTE_NONE)\n" "with open('passwd', newline='') as f:\n" " reader = csv.reader(f, 'unixpwd')" msgstr "" +"import csv\n" +"csv.register_dialect('unixpwd', delimiter=':', quoting=csv.QUOTE_NONE)\n" +"with open('passwd', newline='') as f:\n" +" reader = csv.reader(f, 'unixpwd')" #: ../../library/csv.rst:596 msgid "" @@ -938,12 +1039,14 @@ msgid "" msgstr "" "このモジュールは文字列の解析は直接サポートしませんが、簡単にできます。 ::" -#: ../../library/csv.rst:611 msgid "" "import csv\n" "for row in csv.reader(['one,two,three']):\n" " print(row)" msgstr "" +"import csv\n" +"for row in csv.reader(['one,two,three']):\n" +" print(row)" #: ../../library/csv.rst:617 msgid "Footnotes" diff --git a/library/ctypes.po b/library/ctypes.po index 5d58f5114..8012f699e 100644 --- a/library/ctypes.po +++ b/library/ctypes.po @@ -20,10 +20,10 @@ msgstr "" "Last-Translator: Nozomu Kaneko , 2025\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/ctypes.rst:2 @@ -104,14 +104,15 @@ msgstr "" "Windows エラーは以前は :exc:`WindowsError` を送出していましたが、これは現在で" "は :exc:`OSError` の別名になっています。" -#: ../../library/ctypes.rst:53 msgid "" "Here are some examples for Windows. Note that ``msvcrt`` is the MS standard " "C library containing most standard C functions, and uses the ``cdecl`` " "calling convention::" msgstr "" +"Windows での例を示します。\n" +"``msvcrt`` は、標準 C 関数の大半を含む MS 標準 C ライブラリで、``cdecl`` 呼び" +"出し規約を使用します。 ::" -#: ../../library/ctypes.rst:57 msgid "" ">>> from ctypes import *\n" ">>> print(windll.kernel32)\n" @@ -121,6 +122,13 @@ msgid "" ">>> libc = cdll.msvcrt\n" ">>>" msgstr "" +">>> from ctypes import *\n" +">>> print(windll.kernel32)\n" +"\n" +">>> print(cdll.msvcrt)\n" +"\n" +">>> libc = cdll.msvcrt\n" +">>>" #: ../../library/ctypes.rst:65 msgid "Windows appends the usual ``.dll`` file suffix automatically." @@ -147,7 +155,6 @@ msgid "" "CDLL by calling the constructor::" msgstr "" -#: ../../library/ctypes.rst:79 msgid "" ">>> cdll.LoadLibrary(\"libc.so.6\")\n" "\n" @@ -156,6 +163,12 @@ msgid "" "\n" ">>>" msgstr "" +">>> cdll.LoadLibrary(\"libc.so.6\")\n" +"\n" +">>> libc = CDLL(\"libc.so.6\")\n" +">>> libc\n" +"\n" +">>>" #: ../../library/ctypes.rst:92 msgid "Accessing functions from loaded dlls" @@ -165,7 +178,6 @@ msgstr "ロードしたdllから関数にアクセスする" msgid "Functions are accessed as attributes of dll objects::" msgstr "dll オブジェクトの属性として関数にアクセスします::" -#: ../../library/ctypes.rst:96 msgid "" ">>> libc.printf\n" "<_FuncPtr object at 0x...>\n" @@ -179,8 +191,18 @@ msgid "" "AttributeError: function 'MyOwnFunction' not found\n" ">>>" msgstr "" +">>> libc.printf\n" +"<_FuncPtr object at 0x...>\n" +">>> print(windll.kernel32.GetModuleHandleA)\n" +"<_FuncPtr object at 0x...>\n" +">>> print(windll.kernel32.MyOwnFunction)\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +" File \"ctypes.py\", line 239, in __getattr__\n" +" func = _StdcallFuncPtr(name, self)\n" +"AttributeError: function 'MyOwnFunction' not found\n" +">>>" -#: ../../library/ctypes.rst:108 msgid "" "Note that win32 system dlls like ``kernel32`` and ``user32`` often export " "ANSI as well as UNICODE versions of a function. The UNICODE version is " @@ -190,14 +212,25 @@ msgid "" "following C prototype, and a macro is used to expose one of them as " "``GetModuleHandle`` depending on whether UNICODE is defined or not::" msgstr "" +"``kernel32`` や ``user32`` などの win32 システム DLL は、関数の ANSI 版と " +"UNICODE 版を両方エクスポートすることがよくあります。\n" +"UNICODE 版は名前の末尾に ``W``、ANSI 版は ``A`` を付けてエクスポートされま" +"す。\n" +"指定したモジュール名の *モジュールハンドル* を返す win32 の " +"``GetModuleHandle`` 関数には、以下の C プロトタイプがあります。\n" +"UNICODE が定義されているかどうかに応じて、マクロが一方を ``GetModuleHandle`` " +"として公開します。 ::" -#: ../../library/ctypes.rst:116 msgid "" "/* ANSI version */\n" "HMODULE GetModuleHandleA(LPCSTR lpModuleName);\n" "/* UNICODE version */\n" "HMODULE GetModuleHandleW(LPCWSTR lpModuleName);" msgstr "" +"/* ANSI 版 */\n" +"HMODULE GetModuleHandleA(LPCSTR lpModuleName);\n" +"/* UNICODE 版 */\n" +"HMODULE GetModuleHandleW(LPCWSTR lpModuleName);" #: ../../library/ctypes.rst:121 msgid "" @@ -220,12 +253,14 @@ msgstr "" "ない名前でエクスポートすることがあります。このような場合に関数を取り出すに" "は、 :func:`getattr` を使わなければなりません。::" -#: ../../library/ctypes.rst:129 msgid "" ">>> getattr(cdll.msvcrt, \"??2@YAPAXI@Z\")\n" "<_FuncPtr object at 0x...>\n" ">>>" msgstr "" +">>> getattr(cdll.msvcrt, \"??2@YAPAXI@Z\")\n" +"<_FuncPtr object at 0x...>\n" +">>>" #: ../../library/ctypes.rst:133 msgid "" @@ -237,7 +272,6 @@ msgstr "" "こうした関数には序数を使って dll オブジェクトにインデックス指定することでアク" "セスします::" -#: ../../library/ctypes.rst:136 msgid "" ">>> cdll.kernel32[1]\n" "<_FuncPtr object at 0x...>\n" @@ -249,37 +283,53 @@ msgid "" "AttributeError: function ordinal 0 not found\n" ">>>" msgstr "" +">>> cdll.kernel32[1]\n" +"<_FuncPtr object at 0x...>\n" +">>> cdll.kernel32[0]\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +" File \"ctypes.py\", line 310, in __getitem__\n" +" func = _StdcallFuncPtr(name, self)\n" +"AttributeError: function ordinal 0 not found\n" +">>>" #: ../../library/ctypes.rst:150 msgid "Calling functions" msgstr "関数を呼び出す" -#: ../../library/ctypes.rst:152 msgid "" "You can call these functions like any other Python callable. This example " "uses the ``rand()`` function, which takes no arguments and returns a pseudo-" "random integer::" msgstr "" +"これらの関数は、ほかの Python の呼び出し可能オブジェクトと同じように呼び出せ" +"ます。\n" +"この例では、引数を取らず疑似乱数の整数を返す ``rand()`` 関数を使います。 ::" -#: ../../library/ctypes.rst:155 msgid "" ">>> print(libc.rand())\n" "1804289383" msgstr "" +">>> print(libc.rand())\n" +"1804289383" -#: ../../library/ctypes.rst:158 msgid "" "On Windows, you can call the ``GetModuleHandleA()`` function, which returns " "a win32 module handle (passing ``None`` as single argument to call it with a " "``NULL`` pointer)::" msgstr "" +"Windows では、win32 モジュールハンドルを返す ``GetModuleHandleA()`` 関数を呼" +"び出せます (唯一の引数に ``None`` を渡すと、``NULL`` ポインタを渡して呼び出せ" +"ます)。 ::" -#: ../../library/ctypes.rst:161 msgid "" ">>> print(hex(windll.kernel32.GetModuleHandleA(None)))\n" "0x1d000000\n" ">>>" msgstr "" +">>> print(hex(windll.kernel32.GetModuleHandleA(None)))\n" +"0x1d000000\n" +">>>" #: ../../library/ctypes.rst:165 msgid "" @@ -323,7 +373,6 @@ msgstr "" "Windows では、関数が無効な引数とともに呼び出された場合の一般保護例外によるク" "ラッシュを防ぐために、 :mod:`ctypes` は win32 構造化例外処理を使います::" -#: ../../library/ctypes.rst:187 msgid "" ">>> windll.kernel32.GetModuleHandleA(32)\n" "Traceback (most recent call last):\n" @@ -331,6 +380,11 @@ msgid "" "OSError: exception: access violation reading 0x00000020\n" ">>>" msgstr "" +">>> windll.kernel32.GetModuleHandleA(32)\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"OSError: exception: access violation reading 0x00000020\n" +">>>" #: ../../library/ctypes.rst:193 msgid "" @@ -344,7 +398,6 @@ msgstr "" "ジュールが役に立つ場合があります (例えば、誤った C ライブラリ呼び出しによって" "引き起こされたセグメンテーション違反) 。" -#: ../../library/ctypes.rst:198 msgid "" "``None``, integers, bytes objects and (unicode) strings are the only native " "Python objects that can directly be used as parameters in these function " @@ -354,6 +407,13 @@ msgid "" "platform's default C :c:expr:`int` type, their value is masked to fit into " "the C type." msgstr "" +"これらの関数呼び出しに引数として直接渡せる Python 標準のオブジェクトは、" +"``None``、整数、バイト列オブジェクト、(Unicode) 文字列だけです。\n" +"``None`` は C の ``NULL`` ポインタとして渡され、バイト列オブジェクトと文字列" +"は、データを格納するメモリブロックへのポインタ (:c:expr:`char *` または :c:" +"expr:`wchar_t *`) として渡されます。\n" +"Python の整数は、プラットフォームのデフォルトの C :c:expr:`int` 型として渡さ" +"れ、その C 型に収まるよう値がマスクされます。" #: ../../library/ctypes.rst:205 msgid "" @@ -390,7 +450,7 @@ msgstr ":class:`c_bool`" #: ../../library/ctypes.rst:219 msgid ":c:expr:`_Bool`" -msgstr "" +msgstr ":c:expr:`_Bool`" #: ../../library/ctypes.rst:219 msgid "bool (1)" @@ -522,13 +582,11 @@ msgstr ":class:`c_ssize_t`" msgid ":c:type:`ssize_t` or :c:expr:`Py_ssize_t`" msgstr "" -#: ../../library/ctypes.rst:251 msgid ":class:`c_time_t`" -msgstr "" +msgstr ":class:`c_time_t`" -#: ../../library/ctypes.rst:251 msgid ":c:type:`time_t`" -msgstr "" +msgstr ":c:type:`time_t`" #: ../../library/ctypes.rst:253 msgid ":class:`c_float`" @@ -599,41 +657,36 @@ msgstr "整数または ``None``" msgid "The constructor accepts any object with a truth value." msgstr "コンストラクタは任意のオブジェクトをその真偽値として受け取ります。" -#: ../../library/ctypes.rst:269 msgid "" "Additionally, if IEC 60559 compatible complex arithmetic (Annex G) is " "supported in both C and ``libffi``, the following complex types are " "available:" msgstr "" +"さらに、C と ``libffi`` の両方が IEC 60559 に準拠した複素数演算 (附属書 G) を" +"サポートする場合、以下の複素数型を利用できます:" -#: ../../library/ctypes.rst:275 msgid ":class:`c_float_complex`" -msgstr "" +msgstr ":class:`c_float_complex`" -#: ../../library/ctypes.rst:275 msgid ":c:expr:`float complex`" -msgstr "" +msgstr ":c:expr:`float complex`" #: ../../library/ctypes.rst:275 ../../library/ctypes.rst:277 #: ../../library/ctypes.rst:279 msgid "complex" msgstr "複素数" -#: ../../library/ctypes.rst:277 msgid ":class:`c_double_complex`" -msgstr "" +msgstr ":class:`c_double_complex`" -#: ../../library/ctypes.rst:277 msgid ":c:expr:`double complex`" -msgstr "" +msgstr ":c:expr:`double complex`" -#: ../../library/ctypes.rst:279 msgid ":class:`c_longdouble_complex`" -msgstr "" +msgstr ":class:`c_longdouble_complex`" -#: ../../library/ctypes.rst:279 msgid ":c:expr:`long double complex`" -msgstr "" +msgstr ":c:expr:`long double complex`" #: ../../library/ctypes.rst:283 msgid "" @@ -643,7 +696,6 @@ msgstr "" "これら全ての型はその型を呼び出すことによって作成でき、オプションとして型と値" "が合っている初期化子を指定することができます::" -#: ../../library/ctypes.rst:286 msgid "" ">>> c_int()\n" "c_long(0)\n" @@ -653,13 +705,19 @@ msgid "" "c_ushort(65533)\n" ">>>" msgstr "" +">>> c_int()\n" +"c_long(0)\n" +">>> c_wchar_p(\"Hello, World\")\n" +"c_wchar_p(140018365411392)\n" +">>> c_ushort(-3)\n" +"c_ushort(65533)\n" +">>>" #: ../../library/ctypes.rst:294 msgid "" "Since these types are mutable, their value can also be changed afterwards::" msgstr "これらの型は変更可能であり、値を後で変更することもできます::" -#: ../../library/ctypes.rst:296 msgid "" ">>> i = c_int(42)\n" ">>> print(i)\n" @@ -671,14 +729,26 @@ msgid "" "-99\n" ">>>" msgstr "" +">>> i = c_int(42)\n" +">>> print(i)\n" +"c_long(42)\n" +">>> print(i.value)\n" +"42\n" +">>> i.value = -99\n" +">>> print(i.value)\n" +"-99\n" +">>>" -#: ../../library/ctypes.rst:306 msgid "" "Assigning a new value to instances of the pointer types :class:`c_char_p`, :" "class:`c_wchar_p`, and :class:`c_void_p` changes the *memory location* they " "point to, *not the contents* of the memory block (of course not, because " "Python string objects are immutable)::" msgstr "" +"ポインタ型 :class:`c_char_p`、:class:`c_wchar_p`、:class:`c_void_p` のインス" +"タンスに新しい値を代入すると、そのポインタが指す *メモリ位置* が変わり、メモ" +"リブロックの *内容は変わりません* (Python の文字列オブジェクトは不変なので、" +"当然の動作です)。 ::" #: ../../library/ctypes.rst:311 msgid "" @@ -714,7 +784,6 @@ msgstr "" "ス (あるいは変更) することができます。もし現在のメモリブロックに NUL 終端文字" "列としてアクセスしたいなら、 ``value`` プロパティを使ってください::" -#: ../../library/ctypes.rst:333 msgid "" ">>> from ctypes import *\n" ">>> p = create_string_buffer(3) # create a 3 byte buffer, " @@ -735,14 +804,36 @@ msgid "" "10 b'Hi\\x00lo\\x00\\x00\\x00\\x00\\x00'\n" ">>>" msgstr "" +">>> from ctypes import *\n" +">>> p = create_string_buffer(3) # NUL バイトで初期化した 3 バイト" +"のバッファを作成します\n" +">>> print(sizeof(p), repr(p.raw))\n" +"3 b'\\x00\\x00\\x00'\n" +">>> p = create_string_buffer(b\"Hello\") # NUL 終端文字列を含むバッファを" +"作成します\n" +">>> print(sizeof(p), repr(p.raw))\n" +"6 b'Hello\\x00'\n" +">>> print(repr(p.value))\n" +"b'Hello'\n" +">>> p = create_string_buffer(b\"Hello\", 10) # 10 バイトのバッファを作成しま" +"す\n" +">>> print(sizeof(p), repr(p.raw))\n" +"10 b'Hello\\x00\\x00\\x00\\x00\\x00'\n" +">>> p.value = b\"Hi\"\n" +">>> print(sizeof(p), repr(p.raw))\n" +"10 b'Hi\\x00lo\\x00\\x00\\x00\\x00\\x00'\n" +">>>" -#: ../../library/ctypes.rst:350 msgid "" "The :func:`create_string_buffer` function replaces the old :func:`!c_buffer` " "function (which is still available as an alias). To create a mutable memory " "block containing unicode characters of the C type :c:type:`wchar_t`, use " "the :func:`create_unicode_buffer` function." msgstr "" +":func:`create_string_buffer` 関数は、古い :func:`!c_buffer` 関数を置き換える" +"ものです (後者は別名として引き続き利用できます)。\n" +"C の :c:type:`wchar_t` 型の Unicode 文字を格納する変更可能なメモリブロックを" +"作成するには、:func:`create_unicode_buffer` 関数を使ってください。" #: ../../library/ctypes.rst:359 msgid "Calling functions, continued" @@ -758,7 +849,6 @@ msgstr "" "することに注意してください。したがって、これらの例はコンソールプロンプトでの" "み動作し、 *IDLE* や *PythonWin* では動作しません。::" -#: ../../library/ctypes.rst:365 msgid "" ">>> printf = libc.printf\n" ">>> printf(b\"Hello, %s\\n\", b\"World!\")\n" @@ -777,6 +867,22 @@ msgid "" "parameter 2\n" ">>>" msgstr "" +">>> printf = libc.printf\n" +">>> printf(b\"Hello, %s\\n\", b\"World!\")\n" +"Hello, World!\n" +"14\n" +">>> printf(b\"Hello, %S\\n\", \"World!\")\n" +"Hello, World!\n" +"14\n" +">>> printf(b\"%d bottles of beer\\n\", 42)\n" +"42 bottles of beer\n" +"19\n" +">>> printf(b\"%f bottles of beer\\n\", 42.5)\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"ctypes.ArgumentError: argument 2: TypeError: Don't know how to convert " +"parameter 2\n" +">>>" #: ../../library/ctypes.rst:381 msgid "" @@ -788,19 +894,20 @@ msgstr "" "字列およびバイト列オブジェクトを除くすべての Python 型を対応する :mod:" "`ctypes` 型でラップしなければなりません::" -#: ../../library/ctypes.rst:385 msgid "" ">>> printf(b\"An int %d, a double %f\\n\", 1234, c_double(3.14))\n" "An int 1234, a double 3.140000\n" "31\n" ">>>" msgstr "" +">>> printf(b\"An int %d, a double %f\\n\", 1234, c_double(3.14))\n" +"An int 1234, a double 3.140000\n" +"31\n" +">>>" -#: ../../library/ctypes.rst:393 msgid "Calling variadic functions" -msgstr "" +msgstr "可変長引数関数の呼び出し" -#: ../../library/ctypes.rst:395 msgid "" "On a lot of platforms calling variadic functions through ctypes is exactly " "the same as calling functions with a fixed number of parameters. On some " @@ -808,22 +915,27 @@ msgid "" "convention for variadic functions is different than that for regular " "functions." msgstr "" +"多くのプラットフォームでは、ctypes を使った可変長引数関数の呼び出し方は、引数" +"の数が固定の関数とまったく同じです。\n" +"一部のプラットフォーム、特に Apple プラットフォームの ARM64 では、可変長引数" +"関数の呼び出し規約が通常の関数とは異なります。" -#: ../../library/ctypes.rst:400 msgid "" "On those platforms it is required to specify the :attr:`~_CFuncPtr.argtypes` " "attribute for the regular, non-variadic, function arguments:" msgstr "" +"それらのプラットフォームでは、可変長ではない通常の引数について :attr:" +"`~_CFuncPtr.argtypes` 属性を指定する必要があります:" -#: ../../library/ctypes.rst:403 msgid "libc.printf.argtypes = [ctypes.c_char_p]" -msgstr "" +msgstr "libc.printf.argtypes = [ctypes.c_char_p]" -#: ../../library/ctypes.rst:407 msgid "" "Because specifying the attribute does not inhibit portability it is advised " "to always specify :attr:`~_CFuncPtr.argtypes` for all variadic functions." msgstr "" +"この属性の指定は移植性を損なわないため、すべての可変長引数関数について常に :" +"attr:`~_CFuncPtr.argtypes` を指定することを推奨します。" #: ../../library/ctypes.rst:414 msgid "Calling functions with your own custom data types" @@ -838,7 +950,6 @@ msgid "" "or an object with an :attr:`!_as_parameter_` attribute::" msgstr "" -#: ../../library/ctypes.rst:422 msgid "" ">>> class Bottles:\n" "... def __init__(self, number):\n" @@ -850,6 +961,15 @@ msgid "" "19\n" ">>>" msgstr "" +">>> class Bottles:\n" +"... def __init__(self, number):\n" +"... self._as_parameter_ = number\n" +"...\n" +">>> bottles = Bottles(42)\n" +">>> printf(b\"%d bottles of beer\\n\", bottles)\n" +"42 bottles of beer\n" +"19\n" +">>>" #: ../../library/ctypes.rst:432 msgid "" @@ -862,13 +982,13 @@ msgstr "" msgid "Specifying the required argument types (function prototypes)" msgstr "要求される引数の型を指定する (関数プロトタイプ)" -#: ../../library/ctypes.rst:442 msgid "" "It is possible to specify the required argument types of functions exported " "from DLLs by setting the :attr:`~_CFuncPtr.argtypes` attribute." msgstr "" +"DLL がエクスポートする関数の引数に必要な型は、:attr:`~_CFuncPtr.argtypes` 属" +"性を設定して指定できます。" -#: ../../library/ctypes.rst:445 msgid "" ":attr:`~_CFuncPtr.argtypes` must be a sequence of C data types (the :func:`!" "printf` function is probably not a good example here, because it takes a " @@ -876,8 +996,10 @@ msgid "" "string, on the other hand this is quite handy to experiment with this " "feature)::" msgstr "" +":attr:`~_CFuncPtr.argtypes` は C のデータ型のシーケンスでなければなりません " +"(:func:`!printf` 関数は、書式文字列に応じて引数の数や型が変わるので、ここでは" +"良い例とはいえませんが、この機能を試すには便利です)。 ::" -#: ../../library/ctypes.rst:450 msgid "" ">>> printf.argtypes = [c_char_p, c_char_p, c_int, c_double]\n" ">>> printf(b\"String '%s', Int %d, Double %f\\n\", b\"Hi\", 10, 2.2)\n" @@ -885,6 +1007,11 @@ msgid "" "37\n" ">>>" msgstr "" +">>> printf.argtypes = [c_char_p, c_char_p, c_int, c_double]\n" +">>> printf(b\"String '%s', Int %d, Double %f\\n\", b\"Hi\", 10, 2.2)\n" +"String 'Hi', Int 10, Double 2.200000\n" +"37\n" +">>>" #: ../../library/ctypes.rst:456 msgid "" @@ -895,7 +1022,6 @@ msgstr "" "(C の関数のプロトタイプのように) 書式を指定すると互換性のない引数型になるのを" "防ぎ、引数を有効な型へ変換しようとします。::" -#: ../../library/ctypes.rst:459 msgid "" ">>> printf(b\"%d %d %d\", 1, 2, 3)\n" "Traceback (most recent call last):\n" @@ -907,6 +1033,15 @@ msgid "" "13\n" ">>>" msgstr "" +">>> printf(b\"%d %d %d\", 1, 2, 3)\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"ctypes.ArgumentError: argument 2: TypeError: 'int' object cannot be " +"interpreted as ctypes.c_char_p\n" +">>> printf(b\"%s %d %f\\n\", b\"X\", 2, 3)\n" +"X 2 3.000000\n" +"13\n" +">>>" #: ../../library/ctypes.rst:468 msgid "" @@ -926,51 +1061,54 @@ msgstr "" msgid "Return types" msgstr "戻り値の型" -#: ../../library/ctypes.rst:492 msgid "" "By default functions are assumed to return the C :c:expr:`int` type. Other " "return types can be specified by setting the :attr:`~_CFuncPtr.restype` " "attribute of the function object." msgstr "" +"デフォルトでは、関数は C の :c:expr:`int` 型を返すと仮定します。\n" +"関数オブジェクトの :attr:`~_CFuncPtr.restype` 属性を設定すれば、ほかの戻り値" +"の型を指定できます。" -#: ../../library/ctypes.rst:496 msgid "" "The C prototype of :c:func:`time` is ``time_t time(time_t *)``. Because :c:" "type:`time_t` might be of a different type than the default return type :c:" "expr:`int`, you should specify the :attr:`!restype` attribute::" msgstr "" +":c:func:`time` の C プロトタイプは ``time_t time(time_t *)`` です。\n" +":c:type:`time_t` は、デフォルトの戻り値の型 :c:expr:`int` と異なる場合がある" +"ため、:attr:`!restype` 属性を指定する必要があります。 ::" -#: ../../library/ctypes.rst:500 msgid ">>> libc.time.restype = c_time_t" -msgstr "" +msgstr ">>> libc.time.restype = c_time_t" -#: ../../library/ctypes.rst:502 msgid "The argument types can be specified using :attr:`~_CFuncPtr.argtypes`::" -msgstr "" +msgstr "引数の型は :attr:`~_CFuncPtr.argtypes` を使って指定できます。 ::" -#: ../../library/ctypes.rst:504 msgid ">>> libc.time.argtypes = (POINTER(c_time_t),)" -msgstr "" +msgstr ">>> libc.time.argtypes = (POINTER(c_time_t),)" -#: ../../library/ctypes.rst:506 msgid "" "To call the function with a ``NULL`` pointer as first argument, use " "``None``::" msgstr "" +"第 1 引数に ``NULL`` ポインタを渡して関数を呼び出すには、``None`` を使いま" +"す。 ::" -#: ../../library/ctypes.rst:508 msgid "" ">>> print(libc.time(None))\n" "1150640792" msgstr "" +">>> print(libc.time(None))\n" +"1150640792" -#: ../../library/ctypes.rst:511 msgid "" "Here is a more advanced example, it uses the :func:`!strchr` function, which " "expects a string pointer and a char, and returns a pointer to a string::" msgstr "" +"もう少し高度な例として、文字列へのポインタと char を受け取り、文字列へのポイ" +"ンタを返す :func:`!strchr` 関数を使います。 ::" -#: ../../library/ctypes.rst:514 msgid "" ">>> strchr = libc.strchr\n" ">>> strchr(b\"abcdef\", ord(\"d\"))\n" @@ -982,15 +1120,26 @@ msgid "" "None\n" ">>>" msgstr "" +">>> strchr = libc.strchr\n" +">>> strchr(b\"abcdef\", ord(\"d\"))\n" +"8059983\n" +">>> strchr.restype = c_char_p # c_char_p は文字列へのポインタです\n" +">>> strchr(b\"abcdef\", ord(\"d\"))\n" +"b'def'\n" +">>> print(strchr(b\"abcdef\", ord(\"x\")))\n" +"None\n" +">>>" -#: ../../library/ctypes.rst:524 msgid "" "If you want to avoid the :func:`ord(\"x\") ` calls above, you can set " "the :attr:`~_CFuncPtr.argtypes` attribute, and the second argument will be " "converted from a single character Python bytes object into a C char:" msgstr "" +"上の例の :func:`ord(\"x\") ` の呼び出しを省くには、:attr:`~_CFuncPtr." +"argtypes` 属性を設定します。\n" +"これにより、第 2 引数が 1 文字の Python バイト列オブジェクトから C の char に" +"変換されます:" -#: ../../library/ctypes.rst:528 msgid "" ">>> strchr.restype = c_char_p\n" ">>> strchr.argtypes = [c_char_p, c_char]\n" @@ -1006,8 +1155,20 @@ msgid "" "b'def'\n" ">>>" msgstr "" +">>> strchr.restype = c_char_p\n" +">>> strchr.argtypes = [c_char_p, c_char]\n" +">>> strchr(b\"abcdef\", b\"d\")\n" +"b'def'\n" +">>> strchr(b\"abcdef\", b\"def\")\n" +"Traceback (most recent call last):\n" +"ctypes.ArgumentError: argument 2: TypeError: one character bytes, bytearray " +"or integer expected\n" +">>> print(strchr(b\"abcdef\", b\"x\"))\n" +"None\n" +">>> strchr(b\"abcdef\", b\"d\")\n" +"b'def'\n" +">>>" -#: ../../library/ctypes.rst:543 msgid "" "You can also use a callable Python object (a function or a class for " "example) as the :attr:`~_CFuncPtr.restype` attribute, if the foreign " @@ -1016,8 +1177,12 @@ msgid "" "result of your function call. This is useful to check for error return " "values and automatically raise an exception::" msgstr "" +"外部関数が整数を返す場合、:attr:`~_CFuncPtr.restype` 属性に、関数やクラスなど" +"の Python の呼び出し可能オブジェクトを使うこともできます。\n" +"C 関数が返した *整数* を引数としてそのオブジェクトが呼び出され、その結果が関" +"数呼び出しの結果として使われます。\n" +"これは、戻り値のエラーを検査して例外を自動的に送出するのに役立ちます。 ::" -#: ../../library/ctypes.rst:549 msgid "" ">>> GetModuleHandle = windll.kernel32.GetModuleHandleA\n" ">>> def ValidHandle(value):\n" @@ -1036,6 +1201,22 @@ msgid "" "OSError: [Errno 126] The specified module could not be found.\n" ">>>" msgstr "" +">>> GetModuleHandle = windll.kernel32.GetModuleHandleA\n" +">>> def ValidHandle(value):\n" +"... if value == 0:\n" +"... raise WinError()\n" +"... return value\n" +"...\n" +">>>\n" +">>> GetModuleHandle.restype = ValidHandle\n" +">>> GetModuleHandle(None)\n" +"486539264\n" +">>> GetModuleHandle(\"something silly\")\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +" File \"\", line 3, in ValidHandle\n" +"OSError: [Errno 126] The specified module could not be found.\n" +">>>" #: ../../library/ctypes.rst:566 msgid "" @@ -1049,12 +1230,14 @@ msgstr "" "オプションでエラーコードパラメータを取ります。このパラメータが使われない場合" "は、エラーコードを取り出すために :func:`GetLastError` を呼び出します。" -#: ../../library/ctypes.rst:571 msgid "" "Please note that a much more powerful error checking mechanism is available " "through the :attr:`~_CFuncPtr.errcheck` attribute; see the reference manual " "for details." msgstr "" +":attr:`~_CFuncPtr.errcheck` 属性を使うと、さらに強力なエラー検査の仕組みを利" +"用できます。\n" +"詳細はリファレンスマニュアルを参照してください。" #: ../../library/ctypes.rst:579 msgid "Passing pointers (or: passing parameters by reference)" @@ -1086,7 +1269,6 @@ msgstr "" "処理を行うことから、 Python 側でポインタオブジェクト自体を必要としないなら" "ば :func:`byref` を使う方がより高速です。::" -#: ../../library/ctypes.rst:591 msgid "" ">>> i = c_int()\n" ">>> f = c_float()\n" @@ -1100,6 +1282,17 @@ msgid "" "1 3.1400001049 b'Hello'\n" ">>>" msgstr "" +">>> i = c_int()\n" +">>> f = c_float()\n" +">>> s = create_string_buffer(b'\\000' * 32)\n" +">>> print(i.value, f.value, repr(s.value))\n" +"0 0.0 b''\n" +">>> libc.sscanf(b\"1 3.14 Hello\", b\"%d %f %s\",\n" +"... byref(i), byref(f), s)\n" +"3\n" +">>> print(i.value, f.value, repr(s.value))\n" +"1 3.1400001049 b'Hello'\n" +">>>" #: ../../library/ctypes.rst:607 msgid "Structures and unions" @@ -1131,7 +1324,6 @@ msgstr "" "以下は、 *x* と *y* という名前の二つの整数からなる簡単な POINT 構造体の例で" "す。コンストラクタで構造体を初期化する方法も説明しています::" -#: ../../library/ctypes.rst:620 msgid "" ">>> from ctypes import *\n" ">>> class POINT(Structure):\n" @@ -1150,6 +1342,22 @@ msgid "" "TypeError: too many initializers\n" ">>>" msgstr "" +">>> from ctypes import *\n" +">>> class POINT(Structure):\n" +"... _fields_ = [(\"x\", c_int),\n" +"... (\"y\", c_int)]\n" +"...\n" +">>> point = POINT(10, 20)\n" +">>> print(point.x, point.y)\n" +"10 20\n" +">>> point = POINT(y=5)\n" +">>> print(point.x, point.y)\n" +"0 5\n" +">>> POINT(1, 2, 3)\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"TypeError: too many initializers\n" +">>>" #: ../../library/ctypes.rst:637 msgid "" @@ -1167,7 +1375,6 @@ msgstr "" "*upperleft* と *lowerright* という名前の二つの POINT を持つ RECT 構造体で" "す。::" -#: ../../library/ctypes.rst:643 msgid "" ">>> class RECT(Structure):\n" "... _fields_ = [(\"upperleft\", POINT),\n" @@ -1180,6 +1387,16 @@ msgid "" "0 0\n" ">>>" msgstr "" +">>> class RECT(Structure):\n" +"... _fields_ = [(\"upperleft\", POINT),\n" +"... (\"lowerright\", POINT)]\n" +"...\n" +">>> rc = RECT(point)\n" +">>> print(rc.upperleft.x, rc.upperleft.y)\n" +"0 5\n" +">>> print(rc.lowerright.x, rc.lowerright.y)\n" +"0 0\n" +">>>" #: ../../library/ctypes.rst:654 msgid "" @@ -1189,20 +1406,22 @@ msgstr "" "入れ子になった構造体はいくつかの方法を用いてコンストラクタで初期化することが" "できます。::" -#: ../../library/ctypes.rst:656 msgid "" ">>> r = RECT(POINT(1, 2), POINT(3, 4))\n" ">>> r = RECT((1, 2), (3, 4))" msgstr "" +">>> r = RECT(POINT(1, 2), POINT(3, 4))\n" +">>> r = RECT((1, 2), (3, 4))" -#: ../../library/ctypes.rst:659 msgid "" "Field :term:`descriptor`\\s can be retrieved from the *class*, they are " "useful for debugging because they can provide useful information. See :class:" "`CField`::" msgstr "" +"フィールドの :term:`descriptor` は *クラス* から取得でき、有用な情報を提供す" +"るためデバッグに役立ちます。\n" +":class:`CField` を参照してください。 ::" -#: ../../library/ctypes.rst:663 msgid "" ">>> POINT.x\n" "\n" @@ -1210,6 +1429,11 @@ msgid "" "\n" ">>>" msgstr "" +">>> POINT.x\n" +"\n" +">>> POINT.y\n" +"\n" +">>>" #: ../../library/ctypes.rst:674 msgid "" @@ -1222,17 +1446,20 @@ msgstr "" "ポートしていません。これは 32-bit の x86 環境では動くかもしれませんが、このラ" "イブラリでは一般の場合に動作することは保証していません。" -#: ../../library/ctypes.rst:680 msgid "Structure/union layout, alignment and byte order" -msgstr "" +msgstr "構造体と共用体のレイアウト、アラインメント、バイト順序" -#: ../../library/ctypes.rst:682 msgid "" "By default, Structure and Union fields are laid out in the same way the C " "compiler does it. It is possible to override this behavior entirely by " "specifying a :attr:`~Structure._layout_` class attribute in the subclass " "definition; see the attribute documentation for details." msgstr "" +"デフォルトでは、``Structure`` と ``Union`` のフィールドは C コンパイラと同じ" +"方法で配置されます。\n" +"サブクラス定義で :attr:`~Structure._layout_` クラス属性を指定すれば、この動作" +"を完全に上書きできます。\n" +"詳細はこの属性のドキュメントを参照してください。" #: ../../library/ctypes.rst:687 msgid "" @@ -1267,12 +1494,14 @@ msgstr "" msgid "Bit fields in structures and unions" msgstr "構造体と共用体におけるビットフィールド" -#: ../../library/ctypes.rst:708 msgid "" "It is possible to create structures and unions containing bit fields. Bit " "fields are only possible for integer fields, the bit width is specified as " "the third item in the :attr:`~Structure._fields_` tuples::" msgstr "" +"ビットフィールドを含む構造体や共用体も作成できます。\n" +"ビットフィールドにできるのは整数フィールドだけで、ビット幅は :attr:" +"`~Structure._fields_` のタプルの第 3 要素として指定します。 ::" #: ../../library/ctypes.rst:712 msgid "" @@ -1304,9 +1533,8 @@ msgid "" "a positive integer::" msgstr "推奨されている配列の作成方法はデータ型に正の整数を掛けることです。::" -#: ../../library/ctypes.rst:733 msgid "TenPointsArrayType = POINT * 10" -msgstr "" +msgstr "TenPointsArrayType = POINT * 10" #: ../../library/ctypes.rst:735 msgid "" @@ -1316,7 +1544,6 @@ msgstr "" "ややわざとらしいデータ型の例になりますが、他のものに混ざって 4 個の POINT が" "ある構造体です::" -#: ../../library/ctypes.rst:738 msgid "" ">>> from ctypes import *\n" ">>> class POINT(Structure):\n" @@ -1331,17 +1558,31 @@ msgid "" "4\n" ">>>" msgstr "" +">>> from ctypes import *\n" +">>> class POINT(Structure):\n" +"... _fields_ = (\"x\", c_int), (\"y\", c_int)\n" +"...\n" +">>> class MyStruct(Structure):\n" +"... _fields_ = [(\"a\", c_int),\n" +"... (\"b\", c_float),\n" +"... (\"point_array\", POINT * 4)]\n" +">>>\n" +">>> print(len(MyStruct().point_array))\n" +"4\n" +">>>" #: ../../library/ctypes.rst:751 msgid "Instances are created in the usual way, by calling the class::" msgstr "インスタンスはクラスを呼び出す通常の方法で作成します。::" -#: ../../library/ctypes.rst:753 msgid "" "arr = TenPointsArrayType()\n" "for pt in arr:\n" " print(pt.x, pt.y)" msgstr "" +"arr = TenPointsArrayType()\n" +"for pt in arr:\n" +" print(pt.x, pt.y)" #: ../../library/ctypes.rst:757 msgid "" @@ -1355,7 +1596,6 @@ msgstr "" msgid "Initializers of the correct type can also be specified::" msgstr "正しい型の初期化子を指定することもできます。::" -#: ../../library/ctypes.rst:762 msgid "" ">>> from ctypes import *\n" ">>> TenIntegers = c_int * 10\n" @@ -1367,6 +1607,15 @@ msgid "" "1 2 3 4 5 6 7 8 9 10\n" ">>>" msgstr "" +">>> from ctypes import *\n" +">>> TenIntegers = c_int * 10\n" +">>> ii = TenIntegers(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)\n" +">>> print(ii)\n" +"\n" +">>> for i in ii: print(i, end=\" \")\n" +"...\n" +"1 2 3 4 5 6 7 8 9 10\n" +">>>" #: ../../library/ctypes.rst:776 msgid "Pointers" @@ -1380,13 +1629,16 @@ msgstr "" "ポインタのインスタンスは :mod:`ctypes` 型に対して :func:`pointer` 関数を呼び" "出して作成します。::" -#: ../../library/ctypes.rst:781 msgid "" ">>> from ctypes import *\n" ">>> i = c_int(42)\n" ">>> pi = pointer(i)\n" ">>>" msgstr "" +">>> from ctypes import *\n" +">>> i = c_int(42)\n" +">>> pi = pointer(i)\n" +">>>" #: ../../library/ctypes.rst:786 msgid "" @@ -1396,12 +1648,14 @@ msgstr "" "次のように、ポインタインスタンスは、ポインタが指すオブジェクト (上の例では " "``i``) を返す :attr:`~_Pointer.contents` 属性を持ちます::" -#: ../../library/ctypes.rst:789 msgid "" ">>> pi.contents\n" "c_long(42)\n" ">>>" msgstr "" +">>> pi.contents\n" +"c_long(42)\n" +">>>" #: ../../library/ctypes.rst:793 msgid "" @@ -1412,7 +1666,6 @@ msgstr "" "はないことに注意してください。属性を取り出す度に、新しい同等のオブジェクトを" "作成しているのです。::" -#: ../../library/ctypes.rst:796 msgid "" ">>> pi.contents is i\n" "False\n" @@ -1420,6 +1673,11 @@ msgid "" "False\n" ">>>" msgstr "" +">>> pi.contents is i\n" +"False\n" +">>> pi.contents is pi.contents\n" +"False\n" +">>>" #: ../../library/ctypes.rst:802 msgid "" @@ -1430,7 +1688,6 @@ msgstr "" "別の :class:`c_int` インスタンスがポインタの contents 属性に代入されると、こ" "れが記憶されているメモリ位置を指すポインタに変化します。::" -#: ../../library/ctypes.rst:805 msgid "" ">>> i = c_int(99)\n" ">>> pi.contents = i\n" @@ -1438,23 +1695,29 @@ msgid "" "c_long(99)\n" ">>>" msgstr "" +">>> i = c_int(99)\n" +">>> pi.contents = i\n" +">>> pi.contents\n" +"c_long(99)\n" +">>>" #: ../../library/ctypes.rst:814 msgid "Pointer instances can also be indexed with integers::" msgstr "ポインタインスタンスは整数でインデックス指定することもできます。::" -#: ../../library/ctypes.rst:816 msgid "" ">>> pi[0]\n" "99\n" ">>>" msgstr "" +">>> pi[0]\n" +"99\n" +">>>" #: ../../library/ctypes.rst:820 msgid "Assigning to an integer index changes the pointed to value::" msgstr "整数インデックスへ代入するとポインタが指す値が変更されます。::" -#: ../../library/ctypes.rst:822 msgid "" ">>> print(i)\n" "c_long(99)\n" @@ -1463,6 +1726,12 @@ msgid "" "c_long(22)\n" ">>>" msgstr "" +">>> print(i)\n" +"c_long(99)\n" +">>> pi[0] = 22\n" +">>> print(i)\n" +"c_long(22)\n" +">>>" #: ../../library/ctypes.rst:829 msgid "" @@ -1490,7 +1759,6 @@ msgstr "" "は任意の :mod:`ctypes` 型を受け取る :func:`POINTER` 関数を使って行われ、新し" "い型を返します::" -#: ../../library/ctypes.rst:840 msgid "" ">>> PI = POINTER(c_int)\n" ">>> PI\n" @@ -1503,6 +1771,16 @@ msgid "" "\n" ">>>" msgstr "" +">>> PI = POINTER(c_int)\n" +">>> PI\n" +"\n" +">>> PI(42)\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"TypeError: expected c_long instead of int\n" +">>> PI(c_int(42))\n" +"\n" +">>>" #: ../../library/ctypes.rst:851 msgid "" @@ -1512,13 +1790,16 @@ msgstr "" "ポインタ型を引数なしで呼び出すと ``NULL`` ポインタを作成します。 ``NULL`` ポ" "インタは ``False`` ブール値を持っています。::" -#: ../../library/ctypes.rst:854 msgid "" ">>> null_ptr = POINTER(c_int)()\n" ">>> print(bool(null_ptr))\n" "False\n" ">>>" msgstr "" +">>> null_ptr = POINTER(c_int)()\n" +">>> print(bool(null_ptr))\n" +"False\n" +">>>" #: ../../library/ctypes.rst:859 msgid "" @@ -1529,7 +1810,6 @@ msgstr "" "(しかし、 ``NULL`` でない不正なポインタの指す値の取り出す行為は Python をク" "ラッシュさせるでしょう)。::" -#: ../../library/ctypes.rst:862 msgid "" ">>> null_ptr[0]\n" "Traceback (most recent call last):\n" @@ -1543,10 +1823,20 @@ msgid "" "ValueError: NULL pointer access\n" ">>>" msgstr "" +">>> null_ptr[0]\n" +"Traceback (most recent call last):\n" +" ....\n" +"ValueError: NULL pointer access\n" +">>>\n" +"\n" +">>> null_ptr[0] = 1234\n" +"Traceback (most recent call last):\n" +" ....\n" +"ValueError: NULL pointer access\n" +">>>" -#: ../../library/ctypes.rst:877 msgid "Thread safety without the GIL" -msgstr "" +msgstr "GIL のない環境でのスレッド安全性" #: ../../library/ctypes.rst:879 msgid "" @@ -1555,14 +1845,15 @@ msgid "" "object concurrently is safe, but not across multiple objects:" msgstr "" -#: ../../library/ctypes.rst:882 msgid "" ">>> number = c_int(42)\n" ">>> pointer_a = pointer(number)\n" ">>> pointer_b = pointer(number)" msgstr "" +">>> number = c_int(42)\n" +">>> pointer_a = pointer(number)\n" +">>> pointer_b = pointer(number)" -#: ../../library/ctypes.rst:888 msgid "" "In the above, it's only safe for one object to read and write to the address " "at once if the GIL is disabled. So, ``pointer_a`` can be shared and written " @@ -1570,6 +1861,12 @@ msgid "" "to do the same. If this is an issue, consider using a :class:`threading." "Lock` to synchronize access to memory:" msgstr "" +"上の例で GIL が無効の場合、同じアドレスに対して一度に安全に読み書きできるの" +"は、1 つのオブジェクトだけです。\n" +"したがって、複数のスレッドで ``pointer_a`` を共有して書き込むことはできます" +"が、``pointer_b`` が同じことをしようとしていない場合に限られます。\n" +"これが問題になる場合は、:class:`threading.Lock` を使ってメモリへのアクセスを" +"同期することを検討してください:" #: ../../library/ctypes.rst:893 msgid "" @@ -1587,7 +1884,6 @@ msgstr "" msgid "Type conversions" msgstr "型変換" -#: ../../library/ctypes.rst:910 msgid "" "Usually, ctypes does strict type checking. This means, if you have " "``POINTER(c_int)`` in the :attr:`~_CFuncPtr.argtypes` list of a function or " @@ -1597,8 +1893,16 @@ msgid "" "array instances instead of pointer types. So, for ``POINTER(c_int)``, " "ctypes accepts an array of c_int::" msgstr "" +"通常、ctypes は厳密な型検査を行います。\n" +"例えば、関数の :attr:`~_CFuncPtr.argtypes` リストや構造体定義のメンバーフィー" +"ルドの型に ``POINTER(c_int)`` を指定した場合、まったく同じ型のインスタンスし" +"か受け付けません。\n" +"ただし、この規則には例外があり、ctypes がほかのオブジェクトを受け付ける場合も" +"あります。\n" +"例えば、ポインタ型の代わりに、互換性のある配列インスタンスを渡せます。\n" +"そのため、``POINTER(c_int)`` に対しては、ctypes は c_int の配列を受け付けま" +"す。 ::" -#: ../../library/ctypes.rst:917 msgid "" ">>> class Bar(Structure):\n" "... _fields_ = [(\"count\", c_int), (\"values\", POINTER(c_int))]\n" @@ -1614,8 +1918,20 @@ msgid "" "3\n" ">>>" msgstr "" +">>> class Bar(Structure):\n" +"... _fields_ = [(\"count\", c_int), (\"values\", POINTER(c_int))]\n" +"...\n" +">>> bar = Bar()\n" +">>> bar.values = (c_int * 3)(1, 2, 3)\n" +">>> bar.count = 3\n" +">>> for i in range(bar.count):\n" +"... print(bar.values[i])\n" +"...\n" +"1\n" +"2\n" +"3\n" +">>>" -#: ../../library/ctypes.rst:931 msgid "" "In addition, if a function argument is explicitly declared to be a pointer " "type (such as ``POINTER(c_int)``) in :attr:`~_CFuncPtr.argtypes`, an object " @@ -1623,6 +1939,10 @@ msgid "" "ctypes will apply the required :func:`byref` conversion in this case " "automatically." msgstr "" +"さらに、:attr:`~_CFuncPtr.argtypes` で関数の引数を ``POINTER(c_int)`` などの" +"ポインタ型として明示的に宣言した場合、参照先の型 (この場合は ``c_int``) のオ" +"ブジェクトを関数に渡せます。\n" +"この場合、ctypes は必要な :func:`byref` 変換を自動的に適用します。" #: ../../library/ctypes.rst:936 msgid "To set a POINTER type field to ``NULL``, you can assign ``None``::" @@ -1630,11 +1950,12 @@ msgstr "" "POINTER型フィールドを ``NULL`` に設定するために、 ``None`` を代入してもかまい" "ません。::" -#: ../../library/ctypes.rst:938 msgid "" ">>> bar.values = None\n" ">>>" msgstr "" +">>> bar.values = None\n" +">>>" #: ../../library/ctypes.rst:943 msgid "" @@ -1650,7 +1971,6 @@ msgstr "" "``POINTER(c_int)`` ポインタまたは :class:`c_int` 配列を ``values`` フィールド" "に対して受け取り、他の型のインスタンスは受け取りません::" -#: ../../library/ctypes.rst:949 msgid "" ">>> bar.values = (c_byte * 4)()\n" "Traceback (most recent call last):\n" @@ -1659,6 +1979,12 @@ msgid "" "instance\n" ">>>" msgstr "" +">>> bar.values = (c_byte * 4)()\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"TypeError: incompatible types, c_byte_Array_4 instance instead of LP_c_long " +"instance\n" +">>>" #: ../../library/ctypes.rst:955 msgid "For these cases, the :func:`cast` function is handy." @@ -1678,13 +2004,16 @@ msgstr "" "ります。そして、第二引数のインスタンスを返します。このインスタンスは第一引数" "と同じメモリブロックを参照しています::" -#: ../../library/ctypes.rst:963 msgid "" ">>> a = (c_byte * 4)()\n" ">>> cast(a, POINTER(c_int))\n" "\n" ">>>" msgstr "" +">>> a = (c_byte * 4)()\n" +">>> cast(a, POINTER(c_int))\n" +"\n" +">>>" #: ../../library/ctypes.rst:968 msgid "" @@ -1694,7 +2023,6 @@ msgstr "" "したがって、 :func:`cast` を ``Bar`` 構造体の ``values`` フィールドへ代入する" "ために使うことができます::" -#: ../../library/ctypes.rst:971 msgid "" ">>> bar = Bar()\n" ">>> bar.values = cast((c_byte * 4)(), POINTER(c_int))\n" @@ -1702,6 +2030,11 @@ msgid "" "0\n" ">>>" msgstr "" +">>> bar = Bar()\n" +">>> bar.values = cast((c_byte * 4)(), POINTER(c_int))\n" +">>> print(bar.values[0])\n" +"0\n" +">>>" #: ../../library/ctypes.rst:981 msgid "Incomplete Types" @@ -1716,7 +2049,6 @@ msgstr "" "*不完全型* はメンバーがまだ指定されていない構造体、共用体もしくは配列です。 " "C では、前方宣言により指定され、後で定義されます。::" -#: ../../library/ctypes.rst:987 msgid "" "struct cell; /* forward declaration */\n" "\n" @@ -1725,6 +2057,12 @@ msgid "" " struct cell *next;\n" "};" msgstr "" +"struct cell; /* 前方宣言 */\n" +"\n" +"struct cell {\n" +" char *name;\n" +" struct cell *next;\n" +"};" #: ../../library/ctypes.rst:994 msgid "" @@ -1733,7 +2071,6 @@ msgid "" msgstr "" "ctypes コードへの直接的な変換ではこうなるでしょう。しかし、動作しません::" -#: ../../library/ctypes.rst:997 msgid "" ">>> class cell(Structure):\n" "... _fields_ = [(\"name\", c_char_p),\n" @@ -1745,6 +2082,15 @@ msgid "" "NameError: name 'cell' is not defined\n" ">>>" msgstr "" +">>> class cell(Structure):\n" +"... _fields_ = [(\"name\", c_char_p),\n" +"... (\"next\", POINTER(cell))]\n" +"...\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +" File \"\", line 2, in cell\n" +"NameError: name 'cell' is not defined\n" +">>>" #: ../../library/ctypes.rst:1007 msgid "" @@ -1753,7 +2099,6 @@ msgid "" "`~Structure._fields_` attribute later, after the class statement::" msgstr "" -#: ../../library/ctypes.rst:1011 msgid "" ">>> from ctypes import *\n" ">>> class cell(Structure):\n" @@ -1763,6 +2108,13 @@ msgid "" "... (\"next\", POINTER(cell))]\n" ">>>" msgstr "" +">>> from ctypes import *\n" +">>> class cell(Structure):\n" +"... pass\n" +"...\n" +">>> cell._fields_ = [(\"name\", c_char_p),\n" +"... (\"next\", POINTER(cell))]\n" +">>>" #: ../../library/ctypes.rst:1019 msgid "" @@ -1832,14 +2184,15 @@ msgstr "" "これらのファクトリ関数はともに最初の引数に戻り値の型、残りの引数としてコール" "バック関数が想定する引数の型を渡して呼び出されます。" -#: ../../library/ctypes.rst:1058 msgid "" "I will present an example here which uses the standard C library's :c:func:`!" "qsort` function, that is used to sort items with the help of a callback " "function. :c:func:`!qsort` will be used to sort an array of integers::" msgstr "" +"ここでは、標準 C ライブラリの :c:func:`!qsort` 関数を使う例を示します。\n" +"この関数は、コールバック関数を使って要素をソートします。\n" +":c:func:`!qsort` で整数の配列をソートしてみます。 ::" -#: ../../library/ctypes.rst:1062 msgid "" ">>> IntArray5 = c_int * 5\n" ">>> ia = IntArray5(5, 1, 7, 33, 99)\n" @@ -1847,8 +2200,12 @@ msgid "" ">>> qsort.restype = None\n" ">>>" msgstr "" +">>> IntArray5 = c_int * 5\n" +">>> ia = IntArray5(5, 1, 7, 33, 99)\n" +">>> qsort = libc.qsort\n" +">>> qsort.restype = None\n" +">>>" -#: ../../library/ctypes.rst:1068 msgid "" ":func:`!qsort` must be called with a pointer to the data to sort, the number " "of items in the data array, the size of one item, and a pointer to the " @@ -1857,6 +2214,12 @@ msgid "" "is smaller than the second, a zero if they are equal, and a positive integer " "otherwise." msgstr "" +":func:`!qsort` は、ソートするデータへのポインタ、データ配列の要素数、1 要素の" +"サイズ、比較関数であるコールバックへのポインタを渡して呼び出す必要がありま" +"す。\n" +"コールバックは、要素への 2 つのポインタを引数として呼び出されます。\n" +"最初の要素が 2 番目より小さければ負の整数、等しければゼロ、それ以外なら正の整" +"数を返す必要があります。" #: ../../library/ctypes.rst:1074 msgid "" @@ -1866,11 +2229,12 @@ msgstr "" "コールバック関数は整数へのポインタを受け取り、整数を返す必要があります。ま" "ず、コールバック関数のための ``type`` を作成します。::" -#: ../../library/ctypes.rst:1077 msgid "" ">>> CMPFUNC = CFUNCTYPE(c_int, POINTER(c_int), POINTER(c_int))\n" ">>>" msgstr "" +">>> CMPFUNC = CFUNCTYPE(c_int, POINTER(c_int), POINTER(c_int))\n" +">>>" #: ../../library/ctypes.rst:1080 msgid "" @@ -1879,7 +2243,6 @@ msgid "" msgstr "" "まず初めに、これが受け取った変数を表示するだけのシンプルなコールバックです::" -#: ../../library/ctypes.rst:1083 msgid "" ">>> def py_cmp_func(a, b):\n" "... print(\"py_cmp_func\", a[0], b[0])\n" @@ -1888,12 +2251,17 @@ msgid "" ">>> cmp_func = CMPFUNC(py_cmp_func)\n" ">>>" msgstr "" +">>> def py_cmp_func(a, b):\n" +"... print(\"py_cmp_func\", a[0], b[0])\n" +"... return 0\n" +"...\n" +">>> cmp_func = CMPFUNC(py_cmp_func)\n" +">>>" #: ../../library/ctypes.rst:1090 msgid "The result::" msgstr "結果は以下の通りです::" -#: ../../library/ctypes.rst:1092 msgid "" ">>> qsort(ia, len(ia), sizeof(c_int), cmp_func)\n" "py_cmp_func 5 1\n" @@ -1903,12 +2271,18 @@ msgid "" "py_cmp_func 1 7\n" ">>>" msgstr "" +">>> qsort(ia, len(ia), sizeof(c_int), cmp_func)\n" +"py_cmp_func 5 1\n" +"py_cmp_func 33 99\n" +"py_cmp_func 7 33\n" +"py_cmp_func 5 7\n" +"py_cmp_func 1 7\n" +">>>" #: ../../library/ctypes.rst:1100 msgid "Now we can actually compare the two items and return a useful result::" msgstr "ここで 2 つの要素を実際に比較し、役に立つ結果を返します::" -#: ../../library/ctypes.rst:1102 msgid "" ">>> def py_cmp_func(a, b):\n" "... print(\"py_cmp_func\", a[0], b[0])\n" @@ -1923,18 +2297,33 @@ msgid "" "py_cmp_func 5 7\n" ">>>" msgstr "" +">>> def py_cmp_func(a, b):\n" +"... print(\"py_cmp_func\", a[0], b[0])\n" +"... return a[0] - b[0]\n" +"...\n" +">>>\n" +">>> qsort(ia, len(ia), sizeof(c_int), CMPFUNC(py_cmp_func))\n" +"py_cmp_func 5 1\n" +"py_cmp_func 33 99\n" +"py_cmp_func 7 33\n" +"py_cmp_func 1 7\n" +"py_cmp_func 5 7\n" +">>>" #: ../../library/ctypes.rst:1115 msgid "As we can easily check, our array is sorted now::" msgstr "簡単に確認できるように、配列を次のようにソートしました::" -#: ../../library/ctypes.rst:1117 msgid "" ">>> for i in ia: print(i, end=\" \")\n" "...\n" "1 5 7 33 99\n" ">>>" msgstr "" +">>> for i in ia: print(i, end=\" \")\n" +"...\n" +"1 5 7 33 99\n" +">>>" #: ../../library/ctypes.rst:1122 msgid "" @@ -1944,7 +2333,6 @@ msgstr "" "関数ファクトリはデコレータファクトリとしても使えるので、次のようにも書けま" "す::" -#: ../../library/ctypes.rst:1125 msgid "" ">>> @CFUNCTYPE(c_int, POINTER(c_int), POINTER(c_int))\n" "... def py_cmp_func(a, b):\n" @@ -1959,6 +2347,18 @@ msgid "" "py_cmp_func 5 7\n" ">>>" msgstr "" +">>> @CFUNCTYPE(c_int, POINTER(c_int), POINTER(c_int))\n" +"... def py_cmp_func(a, b):\n" +"... print(\"py_cmp_func\", a[0], b[0])\n" +"... return a[0] - b[0]\n" +"...\n" +">>> qsort(ia, len(ia), sizeof(c_int), py_cmp_func)\n" +"py_cmp_func 5 1\n" +"py_cmp_func 33 99\n" +"py_cmp_func 7 33\n" +"py_cmp_func 1 7\n" +"py_cmp_func 5 7\n" +">>>" #: ../../library/ctypes.rst:1140 msgid "" @@ -1991,12 +2391,14 @@ msgstr "" msgid "Accessing values exported from dlls" msgstr "dllからエクスポートされた値へアクセスする" -#: ../../library/ctypes.rst:1156 msgid "" "Some shared libraries not only export functions, they also export variables. " "An example in the Python library itself is the :c:data:`Py_Version`, Python " "runtime version number encoded in a single constant integer." msgstr "" +"共有ライブラリには、関数だけでなく変数もエクスポートするものがあります。\n" +"Python ライブラリ自体にも例があり、:c:data:`Py_Version` は Python ランタイム" +"のバージョン番号を単一の定数の整数に符号化したものです。" #: ../../library/ctypes.rst:1160 msgid "" @@ -2005,12 +2407,14 @@ msgid "" "to the Python C api::" msgstr "" -#: ../../library/ctypes.rst:1164 msgid "" ">>> version = ctypes.c_int.in_dll(ctypes.pythonapi, \"Py_Version\")\n" ">>> print(hex(version.value))\n" "0x30c00a0" msgstr "" +">>> version = ctypes.c_int.in_dll(ctypes.pythonapi, \"Py_Version\")\n" +">>> print(hex(version.value))\n" +"0x30c00a0" #: ../../library/ctypes.rst:1168 msgid "" @@ -2129,7 +2533,6 @@ msgstr "" msgid "Consider the following example::" msgstr "次に示す例について考えてみてください。::" -#: ../../library/ctypes.rst:1230 msgid "" ">>> from ctypes import *\n" ">>> class POINT(Structure):\n" @@ -2149,6 +2552,23 @@ msgid "" "3 4 3 4\n" ">>>" msgstr "" +">>> from ctypes import *\n" +">>> class POINT(Structure):\n" +"... _fields_ = (\"x\", c_int), (\"y\", c_int)\n" +"...\n" +">>> class RECT(Structure):\n" +"... _fields_ = (\"a\", POINT), (\"b\", POINT)\n" +"...\n" +">>> p1 = POINT(1, 2)\n" +">>> p2 = POINT(3, 4)\n" +">>> rc = RECT(p1, p2)\n" +">>> print(rc.a.x, rc.a.y, rc.b.x, rc.b.y)\n" +"1 2 3 4\n" +">>> # 2 つの点を交換します\n" +">>> rc.a, rc.b = rc.b, rc.a\n" +">>> print(rc.a.x, rc.a.y, rc.b.x, rc.b.y)\n" +"3 4 3 4\n" +">>>" #: ../../library/ctypes.rst:1248 msgid "" @@ -2159,15 +2579,17 @@ msgstr "" "きたのでしょうか? 上の行の ``rc.a, rc.b = rc.b, rc.a`` の各段階はこのようにな" "ります。::" -#: ../../library/ctypes.rst:1251 msgid "" ">>> temp0, temp1 = rc.b, rc.a\n" ">>> rc.a = temp0\n" ">>> rc.b = temp1\n" ">>>" msgstr "" +">>> temp0, temp1 = rc.b, rc.a\n" +">>> rc.a = temp0\n" +">>> rc.b = temp1\n" +">>>" -#: ../../library/ctypes.rst:1256 msgid "" "Note that ``temp0`` and ``temp1`` are objects still using the internal " "buffer of the ``rc`` object above. So executing ``rc.a = temp0`` copies the " @@ -2175,11 +2597,12 @@ msgid "" "the contents of ``temp1``. So, the last assignment ``rc.b = temp1``, doesn't " "have the expected effect." msgstr "" -"``temp0`` と ``temp1`` は前記の ``rc`` オブジェクトの内部バッファでまだ使われ" -"ているオブジェクトです。したがって、 ``rc.a = temp0`` を実行すると ``temp0`` " -"のバッファ内容が ``rc`` のバッファへコピーされます。さらに、これは ``temp1`` " -"の内容を変更します。そのため、最後の代入 ``rc.b = temp1`` は、期待する結果に" -"はならないのです。" +"``temp0`` と ``temp1`` は前記の ``rc`` オブジェクトの内部バッファを引き続き使" +"用しているオブジェクトです。\n" +"したがって、 ``rc.a = temp0`` を実行すると ``temp0`` のバッファ内容が ``rc`` " +"のバッファへコピーされます。\n" +"さらに、これは ``temp1`` の内容を変更します。\n" +"そのため、最後の代入 ``rc.b = temp1`` は、期待する結果にはならないのです。" #: ../../library/ctypes.rst:1262 msgid "" @@ -2197,7 +2620,6 @@ msgid "" "this::" msgstr "期待とは違う振る舞いをする別の例はこれです::" -#: ../../library/ctypes.rst:1268 msgid "" ">>> s = c_char_p()\n" ">>> s.value = b\"abc def ghi\"\n" @@ -2207,6 +2629,13 @@ msgid "" "False\n" ">>>" msgstr "" +">>> s = c_char_p()\n" +">>> s.value = b\"abc def ghi\"\n" +">>> s.value\n" +"b'abc def ghi'\n" +">>> s.value is s.value\n" +"False\n" +">>>" #: ../../library/ctypes.rst:1278 msgid "" @@ -2253,7 +2682,6 @@ msgstr "" "常のメモリブロックより小さくすることはできません。これをやろうとすると、 :" "exc:`ValueError` が送出されます。::" -#: ../../library/ctypes.rst:1301 msgid "" ">>> short_array = (c_short * 4)()\n" ">>> print(sizeof(short_array))\n" @@ -2269,6 +2697,19 @@ msgid "" "8\n" ">>>" msgstr "" +">>> short_array = (c_short * 4)()\n" +">>> print(sizeof(short_array))\n" +"8\n" +">>> resize(short_array, 4)\n" +"Traceback (most recent call last):\n" +" ...\n" +"ValueError: minimum size is 8\n" +">>> resize(short_array, 32)\n" +">>> sizeof(short_array)\n" +"32\n" +">>> sizeof(type(short_array))\n" +"8\n" +">>>" #: ../../library/ctypes.rst:1315 msgid "" @@ -2280,7 +2721,6 @@ msgstr "" "するのでしょうか? この型は要素の数が 4 個であるとまだ認識しているので、他の要" "素にアクセスするとエラーになります。::" -#: ../../library/ctypes.rst:1319 msgid "" ">>> short_array[:]\n" "[0, 0, 0, 0]\n" @@ -2290,6 +2730,13 @@ msgid "" "IndexError: invalid index\n" ">>>" msgstr "" +">>> short_array[:]\n" +"[0, 0, 0, 0]\n" +">>> short_array[7]\n" +"Traceback (most recent call last):\n" +" ...\n" +"IndexError: invalid index\n" +">>>" #: ../../library/ctypes.rst:1327 msgid "" @@ -2369,7 +2816,6 @@ msgstr "" msgid "Here are some examples::" msgstr "ここに例があります::" -#: ../../library/ctypes.rst:1377 msgid "" ">>> from ctypes.util import find_library\n" ">>> find_library(\"m\")\n" @@ -2380,6 +2826,14 @@ msgid "" "'libbz2.so.1.0'\n" ">>>" msgstr "" +">>> from ctypes.util import find_library\n" +">>> find_library(\"m\")\n" +"'libm.so.6'\n" +">>> find_library(\"c\")\n" +"'libc.so.6'\n" +">>> find_library(\"bz2\")\n" +"'libbz2.so.1.0'\n" +">>>" #: ../../library/ctypes.rst:1386 msgid "" @@ -2388,7 +2842,6 @@ msgid "" "pathname if successful::" msgstr "" -#: ../../library/ctypes.rst:1390 msgid "" ">>> from ctypes.util import find_library\n" ">>> find_library(\"c\")\n" @@ -2401,6 +2854,16 @@ msgid "" "'/System/Library/Frameworks/AGL.framework/AGL'\n" ">>>" msgstr "" +">>> from ctypes.util import find_library\n" +">>> find_library(\"c\")\n" +"'/usr/lib/libc.dylib'\n" +">>> find_library(\"m\")\n" +"'/usr/lib/libm.dylib'\n" +">>> find_library(\"bz2\")\n" +"'/usr/lib/libbz2.dylib'\n" +">>> find_library(\"AGL\")\n" +"'/System/Library/Frameworks/AGL.framework/AGL'\n" +">>>" #: ../../library/ctypes.rst:1401 msgid "" @@ -2418,40 +2881,48 @@ msgid "" "to locate the library at runtime." msgstr "" -#: ../../library/ctypes.rst:1413 msgid "Listing loaded shared libraries" -msgstr "" +msgstr "ロード済み共有ライブラリの一覧取得" -#: ../../library/ctypes.rst:1415 msgid "" "When writing code that relies on code loaded from shared libraries, it can " "be useful to know which shared libraries have already been loaded into the " "current process." msgstr "" +"共有ライブラリからロードしたコードに依存するコードを書く場合、現在のプロセス" +"にどの共有ライブラリがすでにロードされているかを知ると役立つことがあります。" -#: ../../library/ctypes.rst:1419 msgid "" "The :mod:`!ctypes.util` module provides the :func:`~ctypes.util.dllist` " "function, which calls the different APIs provided by the various platforms " "to help determine which shared libraries have already been loaded into the " "current process." msgstr "" +":mod:`!ctypes.util` モジュールの :func:`~ctypes.util.dllist` 関数は、各プラッ" +"トフォームが提供する異なる API を呼び出して、現在のプロセスにすでにロードされ" +"た共有ライブラリを調べます。" -#: ../../library/ctypes.rst:1423 msgid "" "The exact output of this function will be system dependent. On most " "platforms, the first entry of this list represents the current process " "itself, which may be an empty string. For example, on glibc-based Linux, the " "return may look like::" msgstr "" +"この関数の具体的な出力はシステムに依存します。\n" +"ほとんどのプラットフォームでは、リストの最初の要素は現在のプロセス自体を表" +"し、空文字列の場合もあります。\n" +"例えば、glibc を使う Linux では次のような結果を返すことがあります。 ::" -#: ../../library/ctypes.rst:1428 msgid "" ">>> from ctypes.util import dllist\n" ">>> dllist()\n" "['', 'linux-vdso.so.1', '/lib/x86_64-linux-gnu/libm.so.6', '/lib/x86_64-" "linux-gnu/libc.so.6', ... ]" msgstr "" +">>> from ctypes.util import dllist\n" +">>> dllist()\n" +"['', 'linux-vdso.so.1', '/lib/x86_64-linux-gnu/libm.so.6', '/lib/x86_64-" +"linux-gnu/libc.so.6', ... ]" #: ../../library/ctypes.rst:1435 msgid "Loading shared libraries" @@ -2475,7 +2946,6 @@ msgstr "" "ライブラリの関数は標準 C 呼び出し規約を使用し、 :c:expr:`int` を返すと仮定さ" "れます。" -#: ../../library/ctypes.rst:1447 msgid "" "On Windows creating a :class:`CDLL` instance may fail even if the DLL name " "exists. When a dependent DLL of the loaded DLL is not found, a :exc:" @@ -2486,11 +2956,19 @@ msgid "" "which DLL is not found, you need to find the list of dependent DLLs and " "determine which one is not found using Windows debugging and tracing tools." msgstr "" +"Windows では、DLL の名前が存在していても :class:`CDLL` インスタンスの作成が失" +"敗することがあります。\n" +"ロードする DLL の依存先 DLL が見つからない場合、*\"[WinError 126] The " +"specified module could not be found\"* というメッセージで :exc:`OSError` が送" +"出されます。\n" +"Windows API がこの情報を返さないため、エラーメッセージには見つからない DLL の" +"名前が含まれず、原因の特定が難しくなります。\n" +"このエラーを解決し、見つからない DLL を特定するには、依存先 DLL の一覧を調" +"べ、Windows のデバッグツールやトレースツールで、どれが見つからないのかを判定" +"する必要があります。" -#: ../../library/ctypes.rst:1459 ../../library/ctypes.rst:1484 -#: ../../library/ctypes.rst:1497 ../../library/ctypes.rst:1515 msgid "The *name* parameter can now be a :term:`path-like object`." -msgstr "" +msgstr "*name* 引数に :term:`path-like object` を指定できるようになりました。" #: ../../library/ctypes.rst:1463 msgid "" @@ -2508,23 +2986,15 @@ msgid "" "a failure, an :class:`OSError` is automatically raised." msgstr "" -#: ../../library/ctypes.rst:1476 ../../library/ctypes.rst:1493 -#: ../../library/ctypes.rst:1637 ../../library/ctypes.rst:1645 -#: ../../library/ctypes.rst:1817 ../../library/ctypes.rst:1869 -#: ../../library/ctypes.rst:2021 ../../library/ctypes.rst:2073 -#: ../../library/ctypes.rst:2082 ../../library/ctypes.rst:2107 -#: ../../library/ctypes.rst:2121 ../../library/ctypes.rst:2130 -#: ../../library/ctypes.rst:2139 ../../library/ctypes.rst:2154 -#: ../../library/ctypes.rst:2221 ../../library/ctypes.rst:2248 -#: ../../library/ctypes.rst:2648 ../../library/ctypes.rst:3046 msgid "Availability" -msgstr "" +msgstr "利用可能な環境" -#: ../../library/ctypes.rst:1478 msgid "" ":exc:`WindowsError` used to be raised, which is now an alias of :exc:" "`OSError`." msgstr "" +"以前は :exc:`WindowsError` を送出していましたが、現在は :exc:`OSError` の別名" +"になっています。" #: ../../library/ctypes.rst:1489 msgid "" @@ -2568,14 +3038,13 @@ msgid "" "the process, and to get a handle to it." msgstr "" -#: ../../library/ctypes.rst:1524 msgid "" "The *mode* parameter can be used to specify how the library is loaded. For " "details, consult the :manpage:`dlopen(3)` manpage. On Windows, *mode* is " "ignored. On posix systems, RTLD_NOW is always added, and is not " "configurable." msgstr "" -"*mode* パラメータを使うと、ライブラリがどうやってロードされたかを特定できま" +"*mode* パラメータを使うと、ライブラリをどのようにロードするかを指定できま" "す。\n" "詳細は :manpage:`dlopen(3)` マニュアルページを参考にしてください。\n" "Windows では *mode* は無視されます。\n" @@ -2601,7 +3070,6 @@ msgstr "" "して、 :func:`ctypes.set_errno` 関数は ctypes のプライベートコピーを置き換" "え、以前の値を返します。" -#: ../../library/ctypes.rst:1540 msgid "" "The *use_last_error* parameter, when set to true, enables the same mechanism " "for the Windows error code which is managed by the :func:`GetLastError` and :" @@ -2609,6 +3077,11 @@ msgid "" "and :func:`ctypes.set_last_error` are used to request and change the ctypes " "private copy of the windows error code." msgstr "" +"*use_last_error* 引数を真に設定すると、Windows API 関数の :func:" +"`GetLastError` と :func:`!SetLastError` が管理する Windows エラーコードについ" +"て同じ仕組みが有効になります。\n" +"ctypes 内部にある Windows エラーコードのコピーの取得と変更には、:func:" +"`ctypes.get_last_error` と :func:`ctypes.set_last_error` を使います。" #: ../../library/ctypes.rst:1546 msgid "" @@ -2663,7 +3136,6 @@ msgstr "" "れると毎回同じオブジェクトを返すことに注意してください。\n" "それとは反対に、添字を通したアクセスは毎回新しいオブジェクトを返します::" -#: ../../library/ctypes.rst:1583 msgid "" ">>> from ctypes import CDLL\n" ">>> libc = CDLL(\"libc.so.6\") # On Linux\n" @@ -2672,6 +3144,12 @@ msgid "" ">>> libc['time'] == libc['time']\n" "False" msgstr "" +">>> from ctypes import CDLL\n" +">>> libc = CDLL(\"libc.so.6\") # Linux の場合\n" +">>> libc.time == libc.time\n" +"True\n" +">>> libc['time'] == libc['time']\n" +"False" #: ../../library/ctypes.rst:1590 msgid "" @@ -2689,13 +3167,16 @@ msgstr "ライブラリへのアクセスに用いられるシステムハンド msgid "The name of the library passed in the constructor." msgstr "コンストラクタに渡されたライブラリの名前。" -#: ../../library/ctypes.rst:1603 msgid "" "Shared libraries can also be loaded by using one of the prefabricated " "objects, which are instances of the :class:`LibraryLoader` class, either by " "calling the :meth:`~LibraryLoader.LoadLibrary` method, or by retrieving the " "library as attribute of the loader instance." msgstr "" +"あらかじめ作成されている :class:`LibraryLoader` クラスのインスタンスを使っ" +"て、共有ライブラリをロードすることもできます。\n" +":meth:`~LibraryLoader.LoadLibrary` メソッドを呼び出すか、ローダーインスタンス" +"の属性としてライブラリを取得します。" #: ../../library/ctypes.rst:1611 msgid "" @@ -2705,13 +3186,17 @@ msgstr "" "共有ライブラリをロードするクラス。 *dlltype* は :class:`CDLL` 、 :class:" "`PyDLL` 、 :class:`WinDLL` もしくは :class:`OleDLL` 型の一つであるべきです。" -#: ../../library/ctypes.rst:1614 msgid "" ":meth:`!__getattr__` has special behavior: It allows loading a shared " "library by accessing it as attribute of a library loader instance. The " "result is cached, so repeated attribute accesses return the same library " "each time." msgstr "" +":meth:`!__getattr__` には特別な動作があります。\n" +"ライブラリローダーインスタンスの属性にアクセスすると、共有ライブラリをロード" +"できます。\n" +"結果はキャッシュされるため、属性へのアクセスを繰り返しても毎回同じライブラリ" +"を返します。" #: ../../library/ctypes.rst:1620 msgid "" @@ -2729,13 +3214,11 @@ msgstr "これらの前もって作られたライブラリローダーを利用 msgid "Creates :class:`CDLL` instances." msgstr ":class:`CDLL` インスタンスを作ります。" -#: ../../library/ctypes.rst:1635 msgid "Creates :class:`WinDLL` instances." -msgstr "" +msgstr ":class:`WinDLL` インスタンスを作成します。" -#: ../../library/ctypes.rst:1643 msgid "Creates :class:`OleDLL` instances." -msgstr "" +msgstr ":class:`OleDLL` インスタンスを作成します。" #: ../../library/ctypes.rst:1651 msgid "Creates :class:`PyDLL` instances." @@ -2749,40 +3232,49 @@ msgstr "" "C Python api に直接アクセスするために、すぐに使用できる Python 共有ライブラリ" "オブジェクトが次のように用意されています。" -#: ../../library/ctypes.rst:1660 msgid "" "An instance of :class:`PyDLL` that exposes Python C API functions as " "attributes. Note that all these functions are assumed to return C :c:expr:" "`int`, which is of course not always the truth, so you have to assign the " "correct :attr:`!restype` attribute to use these functions." msgstr "" +"Python C API 関数を属性として公開する :class:`PyDLL` のインスタンスです。\n" +"すべての関数が C の :c:expr:`int` を返すと仮定していますが、実際には常にそう" +"とは限りません。\n" +"これらの関数を使うには、:attr:`!restype` 属性に正しい型を設定する必要がありま" +"す。" -#: ../../library/ctypes.rst:1665 ../../library/ctypes.rst:1667 msgid "" "Loading a library through any of these objects raises an :ref:`auditing " "event ` ``ctypes.dlopen`` with string argument ``name``, the name " "used to load the library." msgstr "" +"これらのオブジェクトを通じてライブラリをロードすると、ロードに使うライブラリ" +"名を文字列引数 ``name`` とする :ref:`監査イベント ` ``ctypes." +"dlopen`` が発生します。" -#: ../../library/ctypes.rst:1671 ../../library/ctypes.rst:1673 msgid "" "Accessing a function on a loaded library raises an auditing event ``ctypes." "dlsym`` with arguments ``library`` (the library object) and ``name`` (the " "symbol's name as a string or integer)." msgstr "" +"ロード済みライブラリの関数にアクセスすると、引数 ``library`` (ライブラリオブ" +"ジェクト) と ``name`` (文字列または整数のシンボル名) を持つ監査イベント " +"``ctypes.dlsym`` が発生します。" -#: ../../library/ctypes.rst:1677 ../../library/ctypes.rst:1679 msgid "" "In cases when only the library handle is available rather than the object, " "accessing a function raises an auditing event ``ctypes.dlsym/handle`` with " "arguments ``handle`` (the raw library handle) and ``name``." msgstr "" +"ライブラリオブジェクトではなくハンドルだけが利用できる場合、関数にアクセスす" +"ると、引数 ``handle`` (生のライブラリハンドル) と ``name`` を持つ監査イベン" +"ト ``ctypes.dlsym/handle`` が発生します。" #: ../../library/ctypes.rst:1686 msgid "Foreign functions" msgstr "外部関数" -#: ../../library/ctypes.rst:1688 msgid "" "As explained in the previous section, foreign functions can be accessed as " "attributes of loaded shared libraries. The function objects created in this " @@ -2790,14 +3282,20 @@ msgid "" "instances as arguments, and return the default result type specified by the " "library loader." msgstr "" +"前の節で説明したとおり、外部関数にはロード済み共有ライブラリの属性としてアク" +"セスできます。\n" +"この方法で作成した関数オブジェクトは、デフォルトで任意の数の引数を受け付け、" +"任意の ctypes データインスタンスを引数に取ります。\n" +"戻り値の型は、ライブラリローダーが指定するデフォルトの型になります。" -#: ../../library/ctypes.rst:1693 msgid "" "They are instances of a private local class :class:`!_FuncPtr` (not exposed " "in :mod:`!ctypes`) which inherits from the private :class:`_CFuncPtr` class:" msgstr "" +"これらは、非公開の :class:`_CFuncPtr` クラスを継承する、非公開のローカルクラ" +"ス :class:`!_FuncPtr` のインスタンスです (:mod:`!ctypes` では公開されていませ" +"ん)。" -#: ../../library/ctypes.rst:1696 msgid "" ">>> import ctypes\n" ">>> lib = ctypes.CDLL(None)\n" @@ -2806,6 +3304,12 @@ msgid "" ">>> lib._FuncPtr is ctypes._CFuncPtr\n" "False" msgstr "" +">>> import ctypes\n" +">>> lib = ctypes.CDLL(None)\n" +">>> issubclass(lib._FuncPtr, ctypes._CFuncPtr)\n" +"True\n" +">>> lib._FuncPtr is ctypes._CFuncPtr\n" +"False" #: ../../library/ctypes.rst:1707 msgid "Base class for C callable foreign functions." @@ -2835,7 +3339,6 @@ msgstr "" "外部関数の結果の型を指定するために ctypes 型を代入する。何も返さない関数を表" "す :c:expr:`void` に対しては ``None`` を使います。" -#: ../../library/ctypes.rst:1720 msgid "" "It is possible to assign a callable Python object that is not a ctypes type, " "in this case the function is assumed to return a C :c:expr:`int`, and the " @@ -2844,6 +3347,13 @@ msgid "" "or error checking use a ctypes data type as :attr:`!restype` and assign a " "callable to the :attr:`errcheck` attribute." msgstr "" +"ctypes の型以外の、Python の呼び出し可能オブジェクトを代入することもできま" +"す。\n" +"この場合、関数は C の :c:expr:`int` を返すと仮定され、その整数を渡して呼び出" +"し可能オブジェクトを呼び出すことで、追加の処理やエラー検査を行えます。\n" +"この使い方は非推奨です。\n" +"より柔軟な後処理やエラー検査を行うには、:attr:`!restype` に ctypes のデータ型" +"を設定し、:attr:`errcheck` 属性に呼び出し可能オブジェクトを代入してください。" #: ../../library/ctypes.rst:1729 msgid "" @@ -2867,13 +3377,17 @@ msgid "" "object using ctypes conversion rules." msgstr "" -#: ../../library/ctypes.rst:1742 msgid "" "New: It is now possible to put items in argtypes which are not ctypes types, " "but each item must have a :meth:`~_CData.from_param` method which returns a " "value usable as argument (integer, string, ctypes instance). This allows " "defining adapters that can adapt custom objects as function parameters." msgstr "" +"新機能: ``argtypes`` に ctypes の型以外の要素も指定できるようになりました。\n" +"ただし、各要素には、引数として使える値 (整数、文字列、ctypes インスタンス) を" +"返す :meth:`~_CData.from_param` メソッドが必要です。\n" +"これにより、独自のオブジェクトを関数の引数に適合させるアダプターを定義できま" +"す。" #: ../../library/ctypes.rst:1749 msgid "" @@ -2883,11 +3397,11 @@ msgstr "" "Python 関数または他の呼び出し可能オブジェクトをこの属性に代入します。呼び出し" "可能オブジェクトは三つ以上の引数とともに呼び出されます。" -#: ../../library/ctypes.rst:1756 msgid "" "*result* is what the foreign function returns, as specified by the :attr:`!" "restype` attribute." msgstr "" +"*result* は、:attr:`!restype` 属性で指定された型で外部関数が返す値です。" #: ../../library/ctypes.rst:1759 msgid "" @@ -2917,7 +3431,6 @@ msgstr "" "戻り値をチェックして、外部関数呼び出しが失敗しているなら例外を送出させること" "もできます。" -#: ../../library/ctypes.rst:1772 ../../library/ctypes.rst:1774 msgid "" "On Windows, when a foreign function call raises a system exception (for " "example, due to an access violation), it will be captured and replaced with " @@ -2925,13 +3438,19 @@ msgid "" "set_exception`` with argument ``code`` will be raised, allowing an audit " "hook to replace the exception with its own." msgstr "" +"Windows では、外部関数呼び出しがアクセス違反などのシステム例外を発生させる" +"と、それを捕捉して適切な Python 例外に置き換えます。\n" +"さらに、引数 ``code`` を持つ監査イベント ``ctypes.set_exception`` が発生し、" +"監査フックが独自の例外に置き換えられるようになります。" -#: ../../library/ctypes.rst:1780 ../../library/ctypes.rst:1782 msgid "" "Some ways to invoke foreign function calls as well as some of the functions " "in this module may raise an auditing event ``ctypes.call_function`` with " "arguments ``function pointer`` and ``arguments``." msgstr "" +"外部関数の呼び出し方によっては、またこのモジュールの一部の関数では、引数 " +"``function pointer`` と ``arguments`` を持つ監査イベント ``ctypes." +"call_function`` が発生する場合があります。" #: ../../library/ctypes.rst:1789 msgid "Function prototypes" @@ -2969,12 +3488,15 @@ msgstr "" "data:`errno` の値と交換されます。 *use_last_error* も Windows エラーコードに" "対するのと同様です。" -#: ../../library/ctypes.rst:1812 msgid "" "The returned function prototype creates functions that use the ``stdcall`` " "calling convention. The function will release the GIL during the call. " "*use_errno* and *use_last_error* have the same meaning as above." msgstr "" +"返された関数プロトタイプは、``stdcall`` 呼び出し規約を使う関数を作成しま" +"す。\n" +"関数は呼び出し中に GIL を解放します。\n" +"*use_errno* と *use_last_error* の意味は上記と同じです。" #: ../../library/ctypes.rst:1822 msgid "" @@ -3029,19 +3551,23 @@ msgstr "" "*iid* はオプションのインターフェイス識別子へのポインタで、拡張されたエラー情" "報の提供のために使われます。" -#: ../../library/ctypes.rst:1861 msgid "" "If *iid* is not specified, an :exc:`OSError` is raised if the COM method " "call fails. If *iid* is specified, a :exc:`~ctypes.COMError` is raised " "instead." msgstr "" +"*iid* を指定しない場合、COM メソッドの呼び出しが失敗すると :exc:`OSError` を" +"送出します。\n" +"*iid* を指定した場合は、代わりに :exc:`~ctypes.COMError` を送出します。" -#: ../../library/ctypes.rst:1865 msgid "" "COM methods use a special calling convention: They require a pointer to the " "COM interface as first argument, in addition to those parameters that are " "specified in the :attr:`!argtypes` tuple." msgstr "" +"COM メソッドは特別な呼び出し規約を使います。\n" +":attr:`!argtypes` タプルで指定した引数に加えて、第 1 引数として COM インター" +"フェースへのポインタが必要です。" #: ../../library/ctypes.rst:1872 msgid "" @@ -3051,11 +3577,12 @@ msgstr "" "オプションの *paramflags* パラメータは上述した機能より多機能な外部関数ラッ" "パーを作成します。" -#: ../../library/ctypes.rst:1875 msgid "" "*paramflags* must be a tuple of the same length as :attr:`~_CFuncPtr." "argtypes`." msgstr "" +"*paramflags* は、:attr:`~_CFuncPtr.argtypes` と同じ長さのタプルでなければなり" +"ません。" #: ../../library/ctypes.rst:1877 msgid "" @@ -3107,14 +3634,15 @@ msgstr "" msgid "The optional third item is the default value for this parameter." msgstr "オプションの第三要素はこのパラメータのデフォルト値です。" -#: ../../library/ctypes.rst:1898 msgid "" "The following example demonstrates how to wrap the Windows ``MessageBoxW`` " "function so that it supports default parameters and named arguments. The C " "declaration from the windows header file is this::" msgstr "" +"次の例では、Windows の ``MessageBoxW`` 関数をラップして、引数のデフォルト値と" +"名前付き引数をサポートする方法を示します。\n" +"Windows ヘッダーファイルの C 宣言は次のとおりです。 ::" -#: ../../library/ctypes.rst:1902 msgid "" "WINUSERAPI int WINAPI\n" "MessageBoxW(\n" @@ -3123,12 +3651,17 @@ msgid "" " LPCWSTR lpCaption,\n" " UINT uType);" msgstr "" +"WINUSERAPI int WINAPI\n" +"MessageBoxW(\n" +" HWND hWnd,\n" +" LPCWSTR lpText,\n" +" LPCWSTR lpCaption,\n" +" UINT uType);" #: ../../library/ctypes.rst:1909 ../../library/ctypes.rst:1932 msgid "Here is the wrapping with :mod:`ctypes`::" msgstr ":mod:`ctypes` を使ってラップします。::" -#: ../../library/ctypes.rst:1911 msgid "" ">>> from ctypes import c_int, WINFUNCTYPE, windll\n" ">>> from ctypes.wintypes import HWND, LPCWSTR, UINT\n" @@ -3137,6 +3670,12 @@ msgid "" "\"Hello from ctypes\"), (1, \"flags\", 0)\n" ">>> MessageBox = prototype((\"MessageBoxW\", windll.user32), paramflags)" msgstr "" +">>> from ctypes import c_int, WINFUNCTYPE, windll\n" +">>> from ctypes.wintypes import HWND, LPCWSTR, UINT\n" +">>> prototype = WINFUNCTYPE(c_int, HWND, LPCWSTR, LPCWSTR, UINT)\n" +">>> paramflags = (1, \"hwnd\", 0), (1, \"text\", \"Hi\"), (1, \"caption\", " +"\"Hello from ctypes\"), (1, \"flags\", 0)\n" +">>> MessageBox = prototype((\"MessageBoxW\", windll.user32), paramflags)" #: ../../library/ctypes.rst:1917 msgid "The ``MessageBox`` foreign function can now be called in these ways::" @@ -3144,12 +3683,14 @@ msgstr "" "これで外部関数の ``MessageBox`` を次のような方法で呼び出すことができるように" "なりました::" -#: ../../library/ctypes.rst:1919 msgid "" ">>> MessageBox()\n" ">>> MessageBox(text=\"Spam, spam, spam\")\n" ">>> MessageBox(flags=2, text=\"foo bar\")" msgstr "" +">>> MessageBox()\n" +">>> MessageBox(text=\"Spam, spam, spam\")\n" +">>> MessageBox(flags=2, text=\"foo bar\")" #: ../../library/ctypes.rst:1923 msgid "" @@ -3162,15 +3703,17 @@ msgstr "" "数は、指定されたウィンドウの大きさを呼び出し側が与える ``RECT`` 構造体へコ" "ピーすることで取り出します。 C の宣言はこうです。::" -#: ../../library/ctypes.rst:1927 msgid "" "WINUSERAPI BOOL WINAPI\n" "GetWindowRect(\n" " HWND hWnd,\n" " LPRECT lpRect);" msgstr "" +"WINUSERAPI BOOL WINAPI\n" +"GetWindowRect(\n" +" HWND hWnd,\n" +" LPRECT lpRect);" -#: ../../library/ctypes.rst:1934 msgid "" ">>> from ctypes import POINTER, WINFUNCTYPE, windll, WinError\n" ">>> from ctypes.wintypes import BOOL, HWND, RECT\n" @@ -3180,6 +3723,13 @@ msgid "" "paramflags)\n" ">>>" msgstr "" +">>> from ctypes import POINTER, WINFUNCTYPE, windll, WinError\n" +">>> from ctypes.wintypes import BOOL, HWND, RECT\n" +">>> prototype = WINFUNCTYPE(BOOL, HWND, POINTER(RECT))\n" +">>> paramflags = (1, \"hwnd\"), (2, \"lprect\")\n" +">>> GetWindowRect = prototype((\"GetWindowRect\", windll.user32), " +"paramflags)\n" +">>>" #: ../../library/ctypes.rst:1941 msgid "" @@ -3193,7 +3743,6 @@ msgstr "" "れ自動的に返します。そのため、GetWindowRect 関数は呼び出されると RECT インス" "タンスを返します。" -#: ../../library/ctypes.rst:1946 msgid "" "Output parameters can be combined with the :attr:`~_CFuncPtr.errcheck` " "protocol to do further output processing and error checking. The win32 " @@ -3201,8 +3750,11 @@ msgid "" "failure, so this function could do the error checking, and raises an " "exception when the api call failed::" msgstr "" +"出力引数は :attr:`~_CFuncPtr.errcheck` プロトコルと組み合わせて、出力の追加処" +"理やエラー検査を行えます。\n" +"win32 API の ``GetWindowRect`` 関数は成功か失敗かを ``BOOL`` で返すので、次の" +"関数でエラーを検査し、API 呼び出しが失敗した場合に例外を送出できます。 ::" -#: ../../library/ctypes.rst:1951 msgid "" ">>> def errcheck(result, func, args):\n" "... if not result:\n" @@ -3212,6 +3764,13 @@ msgid "" ">>> GetWindowRect.errcheck = errcheck\n" ">>>" msgstr "" +">>> def errcheck(result, func, args):\n" +"... if not result:\n" +"... raise WinError()\n" +"... return args\n" +"...\n" +">>> GetWindowRect.errcheck = errcheck\n" +">>>" #: ../../library/ctypes.rst:1959 msgid "" @@ -3222,7 +3781,6 @@ msgid "" "and return them instead, the normal processing will no longer take place::" msgstr "" -#: ../../library/ctypes.rst:1965 msgid "" ">>> def errcheck(result, func, args):\n" "... if not result:\n" @@ -3233,6 +3791,14 @@ msgid "" ">>> GetWindowRect.errcheck = errcheck\n" ">>>" msgstr "" +">>> def errcheck(result, func, args):\n" +"... if not result:\n" +"... raise WinError()\n" +"... rc = args[1]\n" +"... return rc.left, rc.top, rc.bottom, rc.right\n" +"...\n" +">>> GetWindowRect.errcheck = errcheck\n" +">>>" #: ../../library/ctypes.rst:1978 msgid "Utility functions" @@ -3246,13 +3812,12 @@ msgstr "" "メモリバッファのアドレスを示す整数を返します。 *obj* は ctypes 型のインスタン" "スでなければなりません。" -#: ../../library/ctypes.rst:1985 msgid "" "Raises an :ref:`auditing event ` ``ctypes.addressof`` with " "argument ``obj``." msgstr "" "引数 ``obj`` を指定して :ref:`監査イベント ` ``ctypes.addressof`` " -"を送出します。 " +"を送出します。" #: ../../library/ctypes.rst:1990 msgid "" @@ -3276,9 +3841,8 @@ msgid "``byref(obj, offset)`` corresponds to this C code::" msgstr "" "``byref(obj, offset)`` は、 C コードとしては、以下のようにみなされます。::" -#: ../../library/ctypes.rst:2002 msgid "(((char *)&obj) + offset)" -msgstr "" +msgstr "(((char *)&obj) + offset)" #: ../../library/ctypes.rst:2004 msgid "" @@ -3288,25 +3852,29 @@ msgstr "" "返されるオブジェクトは外部関数呼び出しのパラメータとしてのみ使用できます。" "``pointer(obj)`` と似たふるまいをしますが、作成が非常に速く行えます。" -#: ../../library/ctypes.rst:2010 msgid "" "Copies a COM pointer from *src* to *dst* and returns the Windows specific :c:" "type:`!HRESULT` value." msgstr "" +"COM ポインタを *src* から *dst* にコピーし、Windows 固有の :c:type:`!" +"HRESULT` 値を返します。" -#: ../../library/ctypes.rst:2013 msgid "" "If *src* is not ``NULL``, its ``AddRef`` method is called, incrementing the " "reference count." msgstr "" +"*src* が ``NULL`` でない場合、その ``AddRef`` メソッドを呼び出して参照カウン" +"トを増やします。" -#: ../../library/ctypes.rst:2016 msgid "" "In contrast, the reference count of *dst* will not be decremented before " "assigning the new value. Unless *dst* is ``NULL``, the caller is responsible " "for decrementing the reference count by calling its ``Release`` method when " "necessary." msgstr "" +"一方、新しい値を代入する前に *dst* の参照カウントを減らすことはありません。\n" +"*dst* が ``NULL`` でなければ、呼び出し側が必要に応じてその ``Release`` メソッ" +"ドを呼び出し、参照カウントを減らす責任を持ちます。" #: ../../library/ctypes.rst:2028 msgid "" @@ -3348,13 +3916,12 @@ msgstr "" "成します。バイト列の長さを使うべきではない場合は、第二引数として整数を渡し" "て、配列の長さを指定することができます。" -#: ../../library/ctypes.rst:2047 msgid "" "Raises an :ref:`auditing event ` ``ctypes.create_string_buffer`` " "with arguments ``init``, ``size``." msgstr "" "引数 ``init``, ``size`` を指定して :ref:`監査イベント ` ``ctypes." -"create_string_buffer`` を送出します。 " +"create_string_buffer`` を送出します。" #: ../../library/ctypes.rst:2052 msgid "" @@ -3385,27 +3952,30 @@ msgstr "" "使うべきでない場合は、配列のサイズを指定するために整数を第二引数として渡すこ" "とができます。" -#: ../../library/ctypes.rst:2064 msgid "" "Raises an :ref:`auditing event ` ``ctypes.create_unicode_buffer`` " "with arguments ``init``, ``size``." msgstr "" "引数 ``init``, ``size`` を指定して :ref:`監査イベント ` ``ctypes." -"create_unicode_buffer`` を送出します。 " +"create_unicode_buffer`` を送出します。" -#: ../../library/ctypes.rst:2069 msgid "" "This function is a hook which allows implementing in-process COM servers " "with ctypes. It is called from the DllCanUnloadNow function that the " "_ctypes extension dll exports." msgstr "" +"この関数は、ctypes でプロセス内 COM サーバーを実装するためのフックです。\n" +"``_ctypes`` 拡張 DLL がエクスポートする ``DllCanUnloadNow()`` 関数から呼び出" +"されます。" -#: ../../library/ctypes.rst:2078 msgid "" "This function is a hook which allows implementing in-process COM servers " "with ctypes. It is called from the DllGetClassObject function that the " "``_ctypes`` extension dll exports." msgstr "" +"この関数は、ctypes でプロセス内 COM サーバーを実装するためのフックです。\n" +"``_ctypes`` 拡張 DLL がエクスポートする ``DllGetClassObject()`` 関数から呼び" +"出されます。" #: ../../library/ctypes.rst:2088 msgid "" @@ -3436,33 +4006,44 @@ msgstr "" "放する必要があるなら、メモリ割り付けを行ったのと同じライブラリの関数を使うこ" "とが重要です。" -#: ../../library/ctypes.rst:2113 msgid "" "Try to provide a list of paths of the shared libraries loaded into the " "current process. These paths are not normalized or processed in any way. " "The function can raise :exc:`OSError` if the underlying platform APIs fail. " "The exact functionality is system dependent." msgstr "" +"現在のプロセスにロードされた共有ライブラリのパスの一覧を取得しようとしま" +"す。\n" +"これらのパスには正規化などの処理は一切行いません。\n" +"基盤となるプラットフォーム API が失敗した場合、:exc:`OSError` を送出すること" +"があります。\n" +"厳密な動作はシステムに依存します。" -#: ../../library/ctypes.rst:2118 msgid "" "On most platforms, the first element of the list represents the current " "executable file. It may be an empty string." msgstr "" +"ほとんどのプラットフォームでは、リストの最初の要素は現在の実行ファイルを表し" +"ます。\n" +"空文字列の場合もあります。" -#: ../../library/ctypes.rst:2126 msgid "" "Returns a textual description of the error code *code*. If no error code is " "specified, the last error code is used by calling the Windows API function :" "func:`GetLastError`." msgstr "" +"エラーコード *code* の説明文を返します。\n" +"エラーコードを指定しない場合は、Windows API 関数 :func:`GetLastError` を呼び" +"出して最後のエラーコードを取得し、それを使用します。" -#: ../../library/ctypes.rst:2135 msgid "" "Returns the last error code set by Windows in the calling thread. This " "function calls the Windows ``GetLastError()`` function directly, it does not " "return the ctypes-private copy of the error code." msgstr "" +"呼び出し元スレッドで Windows が設定した最後のエラーコードを返します。\n" +"Windows の ``GetLastError()`` 関数を直接呼び出し、ctypes 内部のエラーコードの" +"コピーは返しません。" #: ../../library/ctypes.rst:2144 msgid "" @@ -3472,27 +4053,25 @@ msgstr "" "システムの :data:`errno` 変数の、スレッドローカルなプライベートコピーを返しま" "す。" -#: ../../library/ctypes.rst:2147 msgid "" "Raises an :ref:`auditing event ` ``ctypes.get_errno`` with no " "arguments." msgstr "" -"引数無しで :ref:`監査イベント ` ``ctypes.get_errno`` を送出しま" -"す。 " +"引数無しで :ref:`監査イベント ` ``ctypes.get_errno`` を送出します。" -#: ../../library/ctypes.rst:2151 msgid "" "Returns the current value of the ctypes-private copy of the system :data:`!" "LastError` variable in the calling thread." msgstr "" +"呼び出し元スレッドにある、システムの :data:`!LastError` 変数の ctypes 内部の" +"コピーの現在値を返します。" -#: ../../library/ctypes.rst:2156 msgid "" "Raises an :ref:`auditing event ` ``ctypes.get_last_error`` with no " "arguments." msgstr "" "引数無しで :ref:`監査イベント ` ``ctypes.get_last_error`` を送出し" -"ます。 " +"ます。" #: ../../library/ctypes.rst:2161 msgid "" @@ -3514,14 +4093,16 @@ msgstr "" "ロックを値 *c* を *count* バイト分書き込みます。 *dst* はアドレスを指定する整" "数または ctypes インスタンスである必要があります。" -#: ../../library/ctypes.rst:2175 msgid "" "Create or return a ctypes pointer type. Pointer types are cached and reused " "internally, so calling this function repeatedly is cheap. *type* must be a " "ctypes type." msgstr "" +"ctypes のポインタ型を作成するか、既存の型を返します。\n" +"ポインタ型は内部でキャッシュされて再利用されるため、繰り返し呼び出しても負荷" +"は小さくなります。\n" +"*type* は ctypes の型でなければなりません。" -#: ../../library/ctypes.rst:2181 msgid "" "The resulting pointer type is cached in the ``__pointer_type__`` attribute " "of *type*. It is possible to set this attribute before the first call to " @@ -3529,12 +4110,20 @@ msgid "" "discouraged: manually creating a suitable pointer type is difficult without " "relying on implementation details that may change in future Python versions." msgstr "" +"結果のポインタ型は、*type* の ``__pointer_type__`` 属性にキャッシュされま" +"す。\n" +"最初に ``POINTER`` を呼び出す前にこの属性を設定すれば、独自のポインタ型を指定" +"できます。\n" +"ただし、この方法は推奨しません。\n" +"将来の Python バージョンで変わりうる実装の詳細に依存せず、適切なポインタ型を" +"手動で作成することは難しいためです。" -#: ../../library/ctypes.rst:2192 msgid "" "Create a new pointer instance, pointing to *obj*. The returned object is of " "the type ``POINTER(type(obj))``." msgstr "" +"*obj* を指す新しいポインタインスタンスを作成します。\n" +"返されるオブジェクトの型は ``POINTER(type(obj))`` です。" #: ../../library/ctypes.rst:2195 msgid "" @@ -3564,28 +4153,27 @@ msgstr "" "システム変数 :data:`errno` の、呼び出し元スレッドでの ctypes のプライベートコ" "ピーの現在値を *value* に設定し、前の値を返します。" -#: ../../library/ctypes.rst:2212 msgid "" "Raises an :ref:`auditing event ` ``ctypes.set_errno`` with " "argument ``errno``." msgstr "" "引数 ``errno`` を指定して :ref:`監査イベント ` ``ctypes." -"set_errno`` を送出します。 " +"set_errno`` を送出します。" -#: ../../library/ctypes.rst:2217 msgid "" "Sets the current value of the ctypes-private copy of the system :data:`!" "LastError` variable in the calling thread to *value* and return the previous " "value." msgstr "" +"呼び出し元スレッドにある、システムの :data:`!LastError` 変数の ctypes 内部の" +"コピーの現在値を *value* に設定し、以前の値を返します。" -#: ../../library/ctypes.rst:2223 msgid "" "Raises an :ref:`auditing event ` ``ctypes.set_last_error`` with " "argument ``error``." msgstr "" "引数 ``error`` を指定して :ref:`監査イベント ` ``ctypes." -"set_last_error`` を送出します。 " +"set_last_error`` を送出します。" #: ../../library/ctypes.rst:2228 msgid "" @@ -3595,59 +4183,72 @@ msgstr "" "ctypes の型やインスタンスのメモリバッファのサイズをバイト数で返します。C の " "``sizeof`` 演算子と同様の動きをします。" -#: ../../library/ctypes.rst:2234 msgid "" "Return the byte string at *void \\*ptr*. If *size* is specified, it is used " "as size, otherwise the string is assumed to be zero-terminated." msgstr "" +"*void \\*ptr* にあるバイト文字列を返します。\n" +"*size* を指定した場合はそのサイズを使い、省略した場合はゼロ終端文字列と仮定し" +"ます。" -#: ../../library/ctypes.rst:2238 msgid "" "Raises an :ref:`auditing event ` ``ctypes.string_at`` with " "arguments ``ptr``, ``size``." msgstr "" +"引数 ``ptr``、``size`` を持つ :ref:`監査イベント ` ``ctypes." +"string_at`` が発生します。" -#: ../../library/ctypes.rst:2243 msgid "" "Creates an instance of :exc:`OSError`. If *code* is not specified, :func:" "`GetLastError` is called to determine the error code. If *descr* is not " "specified, :func:`FormatError` is called to get a textual description of the " "error." msgstr "" +":exc:`OSError` のインスタンスを作成します。\n" +"*code* を指定しない場合は、:func:`GetLastError` を呼び出してエラーコードを取" +"得します。\n" +"*descr* を指定しない場合は、:func:`FormatError` を呼び出してエラーの説明文を" +"取得します。" -#: ../../library/ctypes.rst:2250 msgid "" "An instance of :exc:`WindowsError` used to be created, which is now an alias " "of :exc:`OSError`." msgstr "" +"以前は :exc:`WindowsError` のインスタンスを作成していましたが、現在は :exc:" +"`OSError` の別名になっています。" -#: ../../library/ctypes.rst:2257 msgid "" "Return the wide-character string at *void \\*ptr*. If *size* is specified, " "it is used as the number of characters of the string, otherwise the string " "is assumed to be zero-terminated." msgstr "" +"*void \\*ptr* にあるワイド文字列を返します。\n" +"*size* を指定した場合は文字数として使い、省略した場合はゼロ終端文字列と仮定し" +"ます。" -#: ../../library/ctypes.rst:2262 msgid "" "Raises an :ref:`auditing event ` ``ctypes.wstring_at`` with " "arguments ``ptr``, ``size``." msgstr "" +"引数 ``ptr``、``size`` を持つ :ref:`監査イベント ` ``ctypes." +"wstring_at`` が発生します。" -#: ../../library/ctypes.rst:2267 msgid "" "Return a :class:`memoryview` object of length *size* that references memory " "starting at *void \\*ptr*." msgstr "" +"*void \\*ptr* から始まるメモリを参照する、長さ *size* の :class:`memoryview` " +"オブジェクトを返します。" -#: ../../library/ctypes.rst:2270 msgid "" "If *readonly* is true, the returned :class:`!memoryview` object can not be " "used to modify the underlying memory. (Changes made by other means will " "still be reflected in the returned object.)" msgstr "" +"*readonly* が真の場合、返される :class:`!memoryview` オブジェクトを使って参照" +"先のメモリを変更することはできません (ほかの方法で行った変更は、返されたオブ" +"ジェクトにも反映されます)。" -#: ../../library/ctypes.rst:2275 msgid "" "This function is similar to :func:`string_at` with the key difference of not " "making a copy of the specified memory. It is a semantically equivalent (but " @@ -3656,12 +4257,19 @@ msgid "" "integers, *ptr* can also be given as a :class:`ctypes.POINTER` or a :func:" "`~ctypes.byref` object.)" msgstr "" +"この関数は :func:`string_at` に似ていますが、指定したメモリのコピーを作成しな" +"い点が大きく異なります。\n" +"``memoryview((c_byte * size).from_address(ptr))`` と意味的に同等で、より効率" +"的な代替手段です。\n" +":meth:`~_CData.from_address` は整数のみを受け付けますが、*ptr* には :class:" +"`ctypes.POINTER` や :func:`~ctypes.byref` のオブジェクトも指定できます。" -#: ../../library/ctypes.rst:2282 msgid "" "Raises an :ref:`auditing event ` ``ctypes.memoryview_at`` with " "arguments ``address``, ``size``, ``readonly``." msgstr "" +"引数 ``address``、``size``、``readonly`` を持つ :ref:`監査イベント " +"` ``ctypes.memoryview_at`` が発生します。" #: ../../library/ctypes.rst:2290 msgid "Data types" @@ -3683,13 +4291,13 @@ msgstr "" "す。これはメモリブロックがポインタを含む場合に存続し続ける必要のある他の " "Python オブジェクトを含んでいます。" -#: ../../library/ctypes.rst:2302 msgid "" "Common methods of ctypes data types, these are all class methods (to be " "exact, they are methods of the :term:`metaclass`):" msgstr "" -"ctypes データ型の共通メソッド、すべてのクラスメソッドが存在します (正確に" -"は、 :term:`メタクラス ` のメソッドです):" +"ctypes データ型に共通のメソッドです。\n" +"すべてクラスメソッドです (正確には :term:`メタクラス ` のメソッド" +"です):" #: ../../library/ctypes.rst:2307 msgid "" @@ -3705,13 +4313,12 @@ msgstr "" "ファのオフセットをバイト単位で指定します。デフォルトではゼロです。もし " "*source* バッファが十分に大きくなければ、 :exc:`ValueError` が送出されます。" -#: ../../library/ctypes.rst:2313 ../../library/ctypes.rst:2323 msgid "" "Raises an :ref:`auditing event ` ``ctypes.cdata/buffer`` with " "arguments ``pointer``, ``size``, ``offset``." msgstr "" "引数 ``pointer``, ``size``, ``offset`` を指定して :ref:`監査イベント " -"` ``ctypes.cdata/buffer`` を送出します。 " +"` ``ctypes.cdata/buffer`` を送出します。" #: ../../library/ctypes.rst:2317 msgid "" @@ -3734,19 +4341,23 @@ msgstr "" "このメソッドは *address* で指定されたメモリを使って ctypes 型のインスタンスを" "返します。 *address* は整数でなければなりません。" -#: ../../library/ctypes.rst:2330 ../../library/ctypes.rst:2332 msgid "" "This method, and others that indirectly call this method, raises an :ref:" "`auditing event ` ``ctypes.cdata`` with argument ``address``." msgstr "" +"このメソッドと、それを間接的に呼び出すメソッドは、引数 ``address`` を持つ :" +"ref:`監査イベント ` ``ctypes.cdata`` を発生させます。" -#: ../../library/ctypes.rst:2338 msgid "" "This method adapts *obj* to a ctypes type. It is called with the actual " "object used in a foreign function call when the type is present in the " "foreign function's :attr:`~_CFuncPtr.argtypes` tuple; it must return an " "object that can be used as a function call parameter." msgstr "" +"*obj* を ctypes の型に適合させるメソッドです。\n" +"外部関数の :attr:`~_CFuncPtr.argtypes` タプルにその型が含まれている場合、実際" +"の関数呼び出しで使われるオブジェクトを渡して呼び出されます。\n" +"関数呼び出しの引数として使えるオブジェクトを返す必要があります。" #: ../../library/ctypes.rst:2343 msgid "" @@ -3768,16 +4379,17 @@ msgstr "" "ンスを返します。 *name* はエクスポートされたデータの名前で、 *library* はロー" "ドされた共有ライブラリです。" -#: ../../library/ctypes.rst:2353 msgid "Common class variables of ctypes data types:" -msgstr "" +msgstr "ctypes データ型に共通のクラス変数:" -#: ../../library/ctypes.rst:2357 msgid "" "The pointer type that was created by calling :func:`POINTER` for " "corresponding ctypes data type. If a pointer type was not yet created, the " "attribute is missing." msgstr "" +"対応する ctypes データ型に対して :func:`POINTER` を呼び出して作成したポインタ" +"型です。\n" +"まだポインタ型を作成していない場合、この属性は存在しません。" #: ../../library/ctypes.rst:2363 msgid "Common instance variables of ctypes data types:" @@ -3815,7 +4427,6 @@ msgstr "" "オブジェクトはデバッグでのみ使われます。決してディクショナリの内容を変更しな" "いで下さい。" -#: ../../library/ctypes.rst:2392 msgid "" "This non-public class is the base class of all fundamental ctypes data " "types. It is mentioned here because it contains the common attributes of the " @@ -3823,26 +4434,27 @@ msgid "" "class:`_CData`, so it inherits their methods and attributes. ctypes data " "types that are not and do not contain pointers can now be pickled." msgstr "" -"この非公開クラスは、全ての基本的な ctypes データ型の基底クラスです。これは基" -"本的な ctypes データ型に共通の属性を持っているので、ここで触れておきます。 :" -"class:`_SimpleCData` は :class:`_CData` の子クラスなので、そのメソッドと属性" -"を継承しています。ポインタでないかポインタを含まない ctypes データ型は、現在" -"は pickle 化できます。" +"この非公開クラスは、全ての基本的な ctypes データ型の基底クラスです。\n" +"これは基本的な ctypes データ型に共通の属性を持っているので、ここで触れておき" +"ます。\n" +":class:`_SimpleCData` は :class:`_CData` の子クラスなので、そのメソッドと属性" +"を継承しています。\n" +"ポインタそのものではなく、ポインタも含まない ctypes データ型は、現在は " +"pickle 化できます。" #: ../../library/ctypes.rst:2398 msgid "Instances have a single attribute:" msgstr "インスタンスは一つだけ属性を持ちます:" -#: ../../library/ctypes.rst:2402 msgid "" "This attribute contains the actual value of the instance. For integer and " "pointer types, it is an integer, for character types, it is a single " "character bytes object or string, for character pointer types it is a Python " "bytes object or string." msgstr "" -"この属性は、インスタンスの実際の値を持ちます。整数型とポインタ型に対しては整" -"数型、文字型に対しては一文字のバイト列オブジェクト、文字へのポインタに対して" -"は Python のバイト列オブジェクトもしくは文字列となります。" +"この属性はインスタンスの実際の値を保持します。\n" +"整数型とポインタ型では整数、文字型では一文字の bytes オブジェクトまたは文字" +"列、文字へのポインタ型では Python の bytes オブジェクトまたは文字列です。" #: ../../library/ctypes.rst:2407 msgid "" @@ -3866,13 +4478,16 @@ msgid "" "instance." msgstr "" -#: ../../library/ctypes.rst:2421 msgid "" "Subclasses of fundamental data types do *not* inherit this behavior. So, if " "a foreign functions :attr:`!restype` is a subclass of :class:`c_void_p`, you " "will receive an instance of this subclass from the function call. Of course, " "you can get the value of the pointer by accessing the ``value`` attribute." msgstr "" +"基本データ型のサブクラスは、この動作を継承 *しません*。\n" +"したがって、外部関数の :attr:`!restype` が :class:`c_void_p` のサブクラスの場" +"合、関数呼び出しからそのサブクラスのインスタンスを受け取ります。\n" +"もちろん、``value`` 属性にアクセスすればポインタの値を取得できます。" #: ../../library/ctypes.rst:2426 msgid "These are the fundamental ctypes data types:" @@ -3936,23 +4551,26 @@ msgstr "" "C :c:expr:`float` データ型を表します。コンストラクタはオプションの浮動小数点" "数初期化子を受け取ります。" -#: ../../library/ctypes.rst:2470 msgid "" "Represents the C :c:expr:`double complex` datatype, if available. The " "constructor accepts an optional :class:`complex` initializer." msgstr "" +"利用可能な場合に、C の :c:expr:`double complex` データ型を表します。\n" +"コンストラクタは省略可能な :class:`complex` の初期値を受け付けます。" -#: ../../library/ctypes.rst:2478 msgid "" "Represents the C :c:expr:`float complex` datatype, if available. The " "constructor accepts an optional :class:`complex` initializer." msgstr "" +"利用可能な場合に、C の :c:expr:`float complex` データ型を表します。\n" +"コンストラクタは省略可能な :class:`complex` の初期値を受け付けます。" -#: ../../library/ctypes.rst:2486 msgid "" "Represents the C :c:expr:`long double complex` datatype, if available. The " "constructor accepts an optional :class:`complex` initializer." msgstr "" +"利用可能な場合に、C の :c:expr:`long double complex` データ型を表します。\n" +"コンストラクタは省略可能な :class:`complex` の初期値を受け付けます。" #: ../../library/ctypes.rst:2494 msgid "" @@ -4146,11 +4764,12 @@ msgstr "" "表します。 ``True`` または ``False`` の値を持ち、コンストラクタは真偽値と解釈" "できるオブジェクトを受け取ります。" -#: ../../library/ctypes.rst:2645 msgid "" "Represents a :c:type:`!HRESULT` value, which contains success or error " "information for a function or method call." msgstr "" +"関数やメソッドの呼び出しの成功またはエラーに関する情報を含む :c:type:`!" +"HRESULT` 値を表します。" #: ../../library/ctypes.rst:2653 msgid "" @@ -4160,9 +4779,8 @@ msgstr "" "C :c:expr:`PyObject *` データ型を表します。引数なしでこれを呼び出すと " "``NULL`` :c:expr:`PyObject *` ポインタを作成します。" -#: ../../library/ctypes.rst:2656 msgid ":class:`!py_object` is now a :term:`generic type`." -msgstr "" +msgstr ":class:`!py_object` が :term:`generic type` になりました。" #: ../../library/ctypes.rst:2659 msgid "" @@ -4180,11 +4798,12 @@ msgstr "構造化データ型" msgid "Abstract base class for unions in native byte order." msgstr "ネイティブのバイトオーダーでの共用体のための抽象ベースクラス。" -#: ../../library/ctypes.rst:2674 msgid "" "Unions share common attributes and behavior with structures; see :class:" "`Structure` documentation for details." msgstr "" +"共用体は構造体と共通の属性と動作を持ちます。\n" +"詳細は :class:`Structure` のドキュメントを参照してください。" #: ../../library/ctypes.rst:2679 msgid "Abstract base class for unions in *big endian* byte order." @@ -4269,7 +4888,6 @@ msgstr "" "数を定義することができます。これにより、次のように自身を直接または間接的に参" "照するデータ型を作成できるようになります::" -#: ../../library/ctypes.rst:2729 msgid "" "class List(Structure):\n" " pass\n" @@ -4277,12 +4895,18 @@ msgid "" " ...\n" " ]" msgstr "" +"class List(Structure):\n" +" pass\n" +"List._fields_ = [(\"pnext\", POINTER(List)),\n" +" ...\n" +" ]" -#: ../../library/ctypes.rst:2735 msgid "" "The :attr:`!_fields_` class variable can only be set once. Later assignments " "will raise an :exc:`AttributeError`." msgstr "" +":attr:`!_fields_` クラス変数は 1 回だけ設定できます。\n" +"その後の代入では :exc:`AttributeError` を送出します。" #: ../../library/ctypes.rst:2738 msgid "" @@ -4294,11 +4918,12 @@ msgid "" "fields, as if :attr:`!_fields_` was empty." msgstr "" -#: ../../library/ctypes.rst:2746 msgid "" "Sub-subclasses of structure types inherit the fields of the base class plus " "the :attr:`_fields_` defined in the sub-subclass, if any." msgstr "" +"構造体型のサブクラスのサブクラスは、基底クラスのフィールドを継承し、さらに自" +"身で :attr:`_fields_` を定義していれば、そのフィールドも持ちます。" #: ../../library/ctypes.rst:2752 msgid "" @@ -4312,13 +4937,18 @@ msgstr "" msgid "This is only implemented for the MSVC-compatible memory layout." msgstr "" -#: ../../library/ctypes.rst:2761 msgid "" "For historical reasons, if :attr:`!_pack_` is non-zero, the MSVC-compatible " "layout will be used by default. On non-Windows platforms, this default is " "deprecated and is slated to become an error in Python 3.19. If it is " "intended, set :attr:`~Structure._layout_` to ``'ms'`` explicitly." msgstr "" +"歴史的な理由から、:attr:`!_pack_` がゼロ以外の場合、デフォルトで MSVC 互換の" +"レイアウトを使用します。\n" +"Windows 以外のプラットフォームでは、このデフォルトの動作は非推奨であり、" +"Python 3.19 ではエラーになる予定です。\n" +"このレイアウトを意図している場合は、:attr:`~Structure._layout_` に ``'ms'`` " +"を明示的に設定してください。" #: ../../library/ctypes.rst:2770 msgid "" @@ -4327,52 +4957,64 @@ msgid "" "attribute to 0 is the same as not setting it at all." msgstr "" -#: ../../library/ctypes.rst:2778 msgid "" "An optional string naming the struct/union layout. It can currently be set " "to:" msgstr "" +"構造体や共用体のレイアウト名を指定する、省略可能な文字列です。\n" +"現在は以下の値を指定できます:" -#: ../../library/ctypes.rst:2781 msgid "" "``\"ms\"``: the layout used by the Microsoft compiler (MSVC). On GCC and " "Clang, this layout can be selected with ``__attribute__((ms_struct))``." msgstr "" +"``\"ms\"``: Microsoft コンパイラ (MSVC) が使うレイアウトです。\n" +"GCC と Clang では、``__attribute__((ms_struct))`` でこのレイアウトを選べま" +"す。" -#: ../../library/ctypes.rst:2784 msgid "" "``\"gcc-sysv\"``: the layout used by GCC with the System V or “SysV-like” " "data model, as used on Linux and macOS. With this layout, :attr:`~Structure." "_pack_` must be unset or zero." msgstr "" +"``\"gcc-sysv\"``: Linux や macOS で使われる、System V または「SysV に似た」" +"データモデルで GCC が使うレイアウトです。\n" +"このレイアウトでは、:attr:`~Structure._pack_` を設定しないか、ゼロにする必要" +"があります。" -#: ../../library/ctypes.rst:2788 msgid "" "If not set explicitly, ``ctypes`` will use a default that matches the " "platform conventions. This default may change in future Python releases (for " "example, when a new platform gains official support, or when a difference " "between similar platforms is found). Currently the default will be:" msgstr "" +"明示的に設定しない場合、``ctypes`` はプラットフォームの慣例に合うデフォルト値" +"を使います。\n" +"このデフォルト値は、例えば新しいプラットフォームが正式にサポートされたり、似" +"たプラットフォーム間の違いが見つかったりした場合など、将来の Python リリース" +"で変わる可能性があります。\n" +"現在のデフォルト値は次のとおりです:" -#: ../../library/ctypes.rst:2794 msgid "On Windows: ``\"ms\"``" -msgstr "" +msgstr "Windows の場合: ``\"ms\"``" -#: ../../library/ctypes.rst:2795 msgid "" "When :attr:`~Structure._pack_` is specified: ``\"ms\"``. (This is " "deprecated; see :attr:`~Structure._pack_` documentation.)" msgstr "" +":attr:`~Structure._pack_` を指定した場合: ``\"ms\"`` (この動作は非推奨で" +"す。\n" +":attr:`~Structure._pack_` のドキュメントを参照してください)。" -#: ../../library/ctypes.rst:2797 msgid "Otherwise: ``\"gcc-sysv\"``" -msgstr "" +msgstr "それ以外の場合: ``\"gcc-sysv\"``" -#: ../../library/ctypes.rst:2799 msgid "" ":attr:`!_layout_` must already be defined when :attr:`~Structure._fields_` " "is assigned, otherwise it will have no effect." msgstr "" +":attr:`~Structure._fields_` に代入する時点で :attr:`!_layout_` が定義されてい" +"ないと、効果はありません。" #: ../../library/ctypes.rst:2806 msgid "" @@ -4400,7 +5042,6 @@ msgstr "" msgid "Here is an example type (Windows)::" msgstr "型の例です (Windows)::" -#: ../../library/ctypes.rst:2817 msgid "" "class _U(Union):\n" " _fields_ = [(\"lptdesc\", POINTER(TYPEDESC)),\n" @@ -4412,8 +5053,16 @@ msgid "" " _fields_ = [(\"u\", _U),\n" " (\"vt\", VARTYPE)]" msgstr "" +"class _U(Union):\n" +" _fields_ = [(\"lptdesc\", POINTER(TYPEDESC)),\n" +" (\"lpadesc\", POINTER(ARRAYDESC)),\n" +" (\"hreftype\", HREFTYPE)]\n" +"\n" +"class TYPEDESC(Structure):\n" +" _anonymous_ = (\"u\",)\n" +" _fields_ = [(\"u\", _U),\n" +" (\"vt\", VARTYPE)]" -#: ../../library/ctypes.rst:2828 msgid "" "The ``TYPEDESC`` structure describes a COM data type, the ``vt`` field " "specifies which one of the union fields is valid. Since the ``u`` field is " @@ -4423,11 +5072,11 @@ msgid "" "temporary union instance::" msgstr "" "``TYPEDESC`` 構造体はCOMデータ型を表現しており、 ``vt`` フィールドは共用体" -"フィールドのどれが有効であるかを指定します。 ``u`` フィールドは匿名フィールド" -"として定義されているため、 TYPEDESC インスタンスから取り除かれてそのメンバー" -"へ直接アクセスできます。 ``td.lptdesc`` と ``td.u.lptdesc`` は同等ですが、前" -"者がより高速です。なぜなら一時的な共用体インスタンスを作る必要がないためで" -"す。::" +"フィールドのどれが有効であるかを指定します。\n" +"``u`` フィールドは匿名フィールドとして定義されているため、 ``TYPEDESC`` イン" +"スタンスからそのメンバーに直接アクセスできます。\n" +"``td.lptdesc`` と ``td.u.lptdesc`` は同等ですが、前者がより高速です。\n" +"なぜなら一時的な共用体インスタンスを作る必要がないためです。 ::" #: ../../library/ctypes.rst:2835 msgid "" @@ -4464,13 +5113,13 @@ msgstr "" "解釈され、そのため、同じ名前をもつ :attr:`_fields_` を初期化するか、 :attr:" "`_fields_` に存在しない名前に対しては新しい属性を作ります。" -#: ../../library/ctypes.rst:2855 msgid "" "Descriptor for fields of a :class:`Structure` and :class:`Union`. For " "example::" msgstr "" +":class:`Structure` と :class:`Union` のフィールドのデスクリプタです。\n" +"例えば次のように使います。 ::" -#: ../../library/ctypes.rst:2858 msgid "" ">>> class Color(Structure):\n" "... _fields_ = (\n" @@ -4492,72 +5141,95 @@ msgid "" ">>> Color.blinking.bit_offset\n" "1" msgstr "" +">>> class Color(Structure):\n" +"... _fields_ = (\n" +"... ('red', c_uint8),\n" +"... ('green', c_uint8),\n" +"... ('blue', c_uint8),\n" +"... ('intense', c_bool, 1),\n" +"... ('blinking', c_bool, 1),\n" +"... )\n" +"...\n" +">>> Color.red\n" +"\n" +">>> Color.green.type\n" +"\n" +">>> Color.blue.byte_offset\n" +"2\n" +">>> Color.intense\n" +"\n" +">>> Color.blinking.bit_offset\n" +"1" -#: ../../library/ctypes.rst:2878 msgid "All attributes are read-only." -msgstr "" +msgstr "すべての属性は読み出し専用です。" -#: ../../library/ctypes.rst:2880 msgid "" ":class:`!CField` objects are created via :attr:`~Structure._fields_`; do not " "instantiate the class directly." msgstr "" +":class:`!CField` オブジェクトは :attr:`~Structure._fields_` を通じて作成され" +"ます。\n" +"このクラスを直接インスタンス化しないでください。" -#: ../../library/ctypes.rst:2885 msgid "" "Previously, descriptors only had ``offset`` and ``size`` attributes and a " "readable string representation; the :class:`!CField` class was not available " "directly." msgstr "" +"以前のデスクリプタは ``offset`` と ``size`` 属性、および読みやすい文字列表現" +"だけを持ち、:class:`!CField` クラスは直接利用できませんでした。" -#: ../../library/ctypes.rst:2891 msgid "Name of the field, as a string." -msgstr "" +msgstr "文字列で表したフィールド名です。" -#: ../../library/ctypes.rst:2895 msgid "Type of the field, as a :ref:`ctypes class `." msgstr "" +":ref:`ctypes のクラス ` で表したフィールドの型です。" -#: ../../library/ctypes.rst:2900 msgid "Offset of the field, in bytes." -msgstr "" +msgstr "フィールドのオフセット (バイト単位) です。" -#: ../../library/ctypes.rst:2902 msgid "" "For bitfields, this is the offset of the underlying byte-aligned *storage " "unit*; see :attr:`~CField.bit_offset`." msgstr "" +"ビットフィールドでは、これはバイト境界に整列した、元になる *格納単位* のオフ" +"セットです。\n" +":attr:`~CField.bit_offset` を参照してください。" -#: ../../library/ctypes.rst:2907 msgid "Size of the field, in bytes." -msgstr "" +msgstr "フィールドのサイズ (バイト単位) です。" -#: ../../library/ctypes.rst:2909 msgid "" "For bitfields, this is the size of the underlying *storage unit*. Typically, " "it has the same size as the bitfield's type." msgstr "" +"ビットフィールドでは、これは元になる *格納単位* のサイズです。\n" +"通常はビットフィールドの型と同じサイズです。" -#: ../../library/ctypes.rst:2914 msgid "For non-bitfields, equivalent to :attr:`~CField.byte_size`." -msgstr "" +msgstr "ビットフィールドでない場合は、:attr:`~CField.byte_size` と同じです。" -#: ../../library/ctypes.rst:2916 msgid "" "For bitfields, this contains a backwards-compatible bit-packed value that " "combines :attr:`~CField.bit_size` and :attr:`~CField.bit_offset`. Prefer " "using the explicit attributes instead." msgstr "" +"ビットフィールドでは、:attr:`~CField.bit_size` と :attr:`~CField.bit_offset` " +"をビット単位でまとめた、後方互換性のための値を格納します。\n" +"代わりに、これらの明示的な属性を使ってください。" -#: ../../library/ctypes.rst:2923 msgid "True if this is a bitfield." -msgstr "" +msgstr "ビットフィールドであれば真です。" -#: ../../library/ctypes.rst:2928 msgid "" "The location of a bitfield within its *storage unit*, that is, within :attr:" "`~CField.byte_size` bytes of memory starting at :attr:`~CField.byte_offset`." msgstr "" +"ビットフィールドの *格納単位* 内での位置です。\n" +"つまり、:attr:`~CField.byte_offset` から始まる :attr:`~CField.byte_size` バイ" +"トのメモリ内での位置です。" #: ../../library/ctypes.rst:2932 msgid "" @@ -4566,11 +5238,12 @@ msgid "" "significant bits." msgstr "" -#: ../../library/ctypes.rst:2936 msgid "" "For non-bitfields, :attr:`!bit_offset` is zero and :attr:`!bit_size` is " "equal to ``byte_size * 8``." msgstr "" +"ビットフィールドでない場合、:attr:`!bit_offset` はゼロで、:attr:`!bit_size` " +"は ``byte_size * 8`` に等しくなります。" #: ../../library/ctypes.rst:2941 msgid "" @@ -4685,23 +5358,19 @@ msgstr "" "この例外は外部関数呼び出しが渡された引数を変換できなかったときに送出されま" "す。" -#: ../../library/ctypes.rst:3026 msgid "This exception is raised when a COM method call failed." -msgstr "" +msgstr "COM メソッドの呼び出しが失敗した場合に送出される例外です。" -#: ../../library/ctypes.rst:3030 msgid "The integer value representing the error code." -msgstr "" +msgstr "エラーコードを表す整数値です。" -#: ../../library/ctypes.rst:3034 msgid "The error message." -msgstr "" +msgstr "エラーメッセージ。" -#: ../../library/ctypes.rst:3038 msgid "The 5-tuple ``(descr, source, helpfile, helpcontext, progid)``." msgstr "" +"5 要素のタプル ``(descr, source, helpfile, helpcontext, progid)`` です。" -#: ../../library/ctypes.rst:3040 msgid "" "*descr* is the textual description. *source* is the language-dependent " "``ProgID`` for the class or application that raised the error. *helpfile* " @@ -4709,3 +5378,9 @@ msgid "" "identifier. *progid* is the ``ProgID`` of the interface that defined the " "error." msgstr "" +"*descr* は説明文です。\n" +"*source* は、エラーを発生させたクラスやアプリケーションの、言語に依存する " +"``ProgID`` です。\n" +"*helpfile* はヘルプファイルのパスです。\n" +"*helpcontext* はヘルプコンテキスト識別子です。\n" +"*progid* は、エラーを定義したインターフェースの ``ProgID`` です。" diff --git a/library/curses.ascii.po b/library/curses.ascii.po index f72d0d9f7..dc2e52a40 100644 --- a/library/curses.ascii.po +++ b/library/curses.ascii.po @@ -19,10 +19,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/curses.ascii.rst:2 @@ -159,9 +159,8 @@ msgstr "キャンセル (Cancel)" msgid "End of medium" msgstr "媒体終端" -#: ../../library/curses.ascii.rst:77 msgid "Substitute" -msgstr "代入文字" +msgstr "置換文字" #: ../../library/curses.ascii.rst:79 msgid "Escape" diff --git a/library/curses.panel.po b/library/curses.panel.po index 2e5fae3c9..99306df28 100644 --- a/library/curses.panel.po +++ b/library/curses.panel.po @@ -17,10 +17,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/curses.panel.rst:2 diff --git a/library/curses.po b/library/curses.po index 58ccc804e..b0d8c2452 100644 --- a/library/curses.po +++ b/library/curses.po @@ -20,10 +20,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/curses.rst:2 @@ -54,15 +54,16 @@ msgstr "" "の拡張モジュールは Linux および BSD 系の Unixで動作するオープンソースの " "curses ライブラリである ncurses の API に合致するように設計されています。" -#: ../../includes/wasm-mobile-notavail.rst:3 msgid "Availability" -msgstr "" +msgstr "利用可能な環境" #: ../../includes/wasm-mobile-notavail.rst:5 msgid "" "This module is not supported on :ref:`mobile platforms ` or :ref:`WebAssembly platforms `." msgstr "" +"このモジュールは :ref:`モバイルプラットフォーム ` と :" +"ref:`WebAssemblyプラットフォーム ` をサポートしません。" #: ../../library/curses.rst:28 msgid "" @@ -70,11 +71,12 @@ msgid "" "integer, a one-character Unicode string or a one-byte byte string." msgstr "" -#: ../../library/curses.rst:31 msgid "" "Whenever the documentation mentions a *character string* it can be specified " "as a Unicode string or a byte string." msgstr "" +"このドキュメントで *文字列* と記されている箇所では、Unicode 文字列またはバイ" +"ト文字列を指定できます。" #: ../../library/curses.rst:36 msgid "Module :mod:`curses.ascii`" @@ -144,23 +146,26 @@ msgstr "" msgid "The module :mod:`curses` defines the following functions:" msgstr ":mod:`curses` では以下の関数を定義しています:" -#: ../../library/curses.rst:73 msgid "" "Allow use of default values for colors on terminals supporting this feature. " "Use this to support transparency in your application." msgstr "" +"この機能をサポートする端末で、色のデフォルト値を使用できるようにします。\n" +"アプリケーションで透過表示をサポートするには、この関数を使用してください。" -#: ../../library/curses.rst:76 msgid "" "Assign terminal default foreground/background colors to color number ``-1``. " "So ``init_pair(x, COLOR_RED, -1)`` will initialize pair *x* as red on " "default background and ``init_pair(x, -1, COLOR_BLUE)`` will initialize pair " "*x* as default foreground on blue." msgstr "" +"端末のデフォルトの前景色と背景色を色番号 ``-1`` に割り当てます。\n" +"したがって、``init_pair(x, COLOR_RED, -1)`` はペア *x* をデフォルトの背景色に" +"赤の前景色として初期化し、``init_pair(x, -1, COLOR_BLUE)`` はペア *x* を青の" +"背景色にデフォルトの前景色として初期化します。" -#: ../../library/curses.rst:81 msgid "Change the definition of the color-pair ``0`` to ``(fg, bg)``." -msgstr "" +msgstr "色ペア ``0`` の定義を ``(fg, bg)`` に変更します。" #: ../../library/curses.rst:88 msgid "" @@ -216,7 +221,6 @@ msgstr "" "れた色の R、G、B、の値からなる三要素のタプルが返されます。この値は ``0`` (そ" "の成分はない) から ``1000`` (その成分の最大強度) の範囲をとります。" -#: ../../library/curses.rst:124 msgid "" "Return the attribute value for displaying text in the specified color pair. " "Only the first 256 color pairs are supported. This attribute value can be " @@ -224,8 +228,12 @@ msgid "" "`!A_\\*` attributes. :func:`pair_number` is the counterpart to this " "function." msgstr "" +"指定した色ペアでテキストを表示するための属性値を返します。\n" +"最初の 256 個の色ペアだけがサポートされています。\n" +"この属性値は :const:`A_STANDOUT`、:const:`A_REVERSE`、その他の :const:`!" +"A_\\*` 属性と組み合わせることができます。\n" +":func:`pair_number` はこの関数と逆の処理を行います。" -#: ../../library/curses.rst:133 msgid "" "Set the cursor state. *visibility* can be set to ``0``, ``1``, or ``2``, " "for invisible, normal, or very visible. If the terminal supports the " @@ -233,10 +241,10 @@ msgid "" "exception. On many terminals, the \"visible\" mode is an underline cursor " "and the \"very visible\" mode is a block cursor." msgstr "" -"カーソルの状態を設定します。*visibility* は ``0`` 、 ``1``または ``2`` に設定" -"され、それぞれ不可視、通常、または非常に可視、を意味します。要求された可視属" -"性を端末がサポートしている場合、以前のカーソル状態が返されます; そうでなけれ" -"ば例外が送出されます。多くの端末では、\"可視 (通常)\" モードは下線カーソル" +"カーソルの状態を設定します。*visibility* は ``0`` 、 ``1`` または ``2`` に設" +"定され、それぞれ不可視、通常、または非常に可視、を意味します。要求された可視" +"属性を端末がサポートしている場合、以前のカーソル状態が返されます; そうでなけ" +"れば例外が送出されます。多くの端末では、\"可視 (通常)\" モードは下線カーソル" "で、\"非常に可視\" モードはブロックカーソルです。" #: ../../library/curses.rst:142 @@ -291,11 +299,11 @@ msgid "" msgstr "" "仮想スクリーンは :meth:`~window.addstr` のような書き込み操作をウィンドウに" "行った後に :meth:`~window.noutrefresh` を呼び出して更新することができます。通" -"常の:meth:`~window.refresh` 呼び出しは、単に :meth:`!noutrefresh` を呼んだ後" -"に :func:`!doupdate`を呼ぶだけです; 複数のウィンドウを更新しなければならない" -"場合、すべてのウィンドウに対して :meth:`!noutrefresh` を呼び出した後、一度だ" -"け :func:`!doupdate` を呼ぶことで、パフォーマンスを向上させることができ、おそ" -"らくスクリーンのちらつきも押さえることができます。" +"常の :meth:`~window.refresh` 呼び出しは、単に :meth:`!noutrefresh` を呼んだ" +"後に :func:`!doupdate` を呼ぶだけです; 複数のウィンドウを更新しなければならな" +"い場合、すべてのウィンドウに対して :meth:`!noutrefresh` を呼び出した後、一度" +"だけ :func:`!doupdate` を呼ぶことで、パフォーマンスを向上させることができ、お" +"そらくスクリーンのちらつきも押さえることができます。" #: ../../library/curses.rst:178 msgid "" @@ -382,11 +390,12 @@ msgstr "" "`BUTTONn_DOUBLE_CLICKED`, :const:`BUTTONn_TRIPLE_CLICKED`, :const:" "`BUTTON_SHIFT`, :const:`BUTTON_CTRL`, :const:`BUTTON_ALT`。" -#: ../../library/curses.rst:230 ../../library/curses.rst:1797 msgid "" "The ``BUTTON5_*`` constants are now exposed if they are provided by the " "underlying curses library." msgstr "" +"基盤となる curses ライブラリが ``BUTTON5_*`` 定数を提供する場合に、それらが公" +"開されるようになりました。" #: ../../library/curses.rst:237 msgid "" @@ -419,9 +428,8 @@ msgid "" "terminals that support more than 16 colors (e.g. xterm-256color)." msgstr "" -#: ../../library/curses.rst:258 msgid "Extended color support requires ncurses version 6.1 or later." -msgstr "" +msgstr "拡張カラーのサポートには ncurses バージョン 6.1 以降が必要です。" #: ../../library/curses.rst:264 msgid "" @@ -485,7 +493,6 @@ msgstr "" "で何も行いません; :func:`can_change_color` が ``True`` を返す場合にのみ動作し" "ます。" -#: ../../library/curses.rst:305 msgid "" "Change the definition of a color-pair. It takes three arguments: the number " "of the color-pair to be changed, the foreground color number, and the " @@ -498,6 +505,17 @@ msgid "" "refreshed and all occurrences of that color-pair are changed to the new " "definition." msgstr "" +"色ペアの定義を変更します。\n" +"変更する色ペアの番号、前景色の番号、背景色の番号という 3 つの引数を取りま" +"す。\n" +"*pair_number* の値は ``1`` から ``COLOR_PAIRS - 1`` の範囲でなければなりませ" +"ん (色ペア ``0`` は :func:`use_default_colors` と :func:" +"`assume_default_colors` でのみ変更できます)。\n" +"引数 *fg* と *bg* の値は ``0`` から ``COLORS - 1`` の範囲か、:func:`!" +"use_default_colors` または :func:`!assume_default_colors` を呼び出した後であ" +"れば ``-1`` でなければなりません。\n" +"色ペアが以前に初期化されていた場合、スクリーンが更新され、その色ペアを使用し" +"ているすべての箇所が新しい定義に変わります。" #: ../../library/curses.rst:320 msgid "" @@ -515,13 +533,12 @@ msgstr "" "端末のオープン時にエラーが発生した場合、curses ライブラリによってインタープリ" "タが終了される場合があります。" -#: ../../library/curses.rst:331 msgid "" "Return ``True`` if :func:`resize_term` would modify the window structure, " "``False`` otherwise." msgstr "" -":func:`resize_term` によってウィンドウ構造が変更されている場合に ``True`` " -"を、そうでない場合は ``False`` を返します。" +":func:`resize_term` を呼び出した場合にウィンドウ構造が変更されるなら " +"``True`` を、そうでなければ ``False`` を返します。" #: ../../library/curses.rst:337 msgid "" @@ -531,7 +548,6 @@ msgstr "" ":func:`endwin` がすでに呼び出されている (すなわち、curses ライブラリが非初期" "化されてしまっている) 場合に ``True`` を返します。" -#: ../../library/curses.rst:343 msgid "" "Return the name of the key numbered *k* as a bytes object. The name of a " "key generating printable ASCII character is the key's character. The name " @@ -541,19 +557,21 @@ msgid "" "of the prefix ``b'M-'`` followed by the name of the corresponding ASCII " "character." msgstr "" -"bytes オブジェクト *k* に番号付けされているキーの名前を返します。\n" +"番号 *k* のキーの名前を bytes オブジェクトで返します。\n" "印字可能な ASCII 文字を生成するキーの名前はそのキーの文字自体になります。\n" "コントロールキーと組み合わせたキーの名前は、キャレット(``b'^'``)の後に対応す" "る ASCII 文字が続く 2 バイトの bytes オブジェクトになります。\n" "Alt キーと組み合わせたキー (128--255) の名前は、先頭に ``b'M-'`` が付き、その" -"後に対応する ASCII 文字が続く bytes オブジェクトになります。" +"後に対応する ASCII 文字の名前が続く bytes オブジェクトになります。" -#: ../../library/curses.rst:353 msgid "" "Return the user's current line kill character as a one-byte bytes object. " "Under Unix operating systems this is a property of the controlling tty of " "the curses program, and is not set by the curses library itself." msgstr "" +"ユーザの現在の行消去文字を、1 バイトの bytes オブジェクトとして返します。\n" +"Unix オペレーティングシステムでは、これは curses プログラムの制御端末の属性で" +"あり、curses ライブラリ自体が設定するものではありません。" #: ../../library/curses.rst:360 msgid "" @@ -673,7 +691,6 @@ msgstr "" msgid "Leave echo mode. Echoing of input characters is turned off." msgstr "echo モードを終了します。入力のエコーバックはオフにされます。" -#: ../../library/curses.rst:439 msgid "" "Leave newline mode. Disable translation of return into newline on input, " "and disable low-level translation of newline into newline/return on output " @@ -682,12 +699,12 @@ msgid "" "translation off, curses can sometimes speed up vertical motion a little; " "also, it will be able to detect the return key on input." msgstr "" -"newline モードを終了します。入力時のリターンキーから改行への変換、および出力" -"時の改行から復帰/改行への低レベル変換を無効化します (ただし、" -"``addch('\\n')`` の振る舞いは変更せず、仮想スクリーン上では常に復帰と改行に等" -"しくなります)。変換をオフにすることで、curses は水平方向の動きを少しだけ高速" -"化できることがあります; また、入力中のリターンキーの検出ができるようになりま" -"す。" +"newline モードを終了します。\n" +"入力時のリターンキーから改行への変換、および出力時の改行から復帰/改行への低レ" +"ベル変換を無効化します (ただし、``addch('\\n')`` の振る舞いは変更せず、仮想ス" +"クリーン上では常に復帰と改行に等しくなります)。\n" +"変換をオフにすることで、curses は垂直方向の動きを少しだけ高速化できることがあ" +"ります; また、入力中のリターンキーの検出ができるようになります。" #: ../../library/curses.rst:449 msgid "" @@ -811,34 +828,34 @@ msgstr "" ":func:`resetty` で使用される、バッファ内の端末モードの現在の状態を保存しま" "す。" -#: ../../library/curses.rst:535 msgid "Retrieves the value set by :func:`set_escdelay`." -msgstr "" +msgstr ":func:`set_escdelay` で設定した値を取得します。" -#: ../../library/curses.rst:541 msgid "" "Sets the number of milliseconds to wait after reading an escape character, " "to distinguish between an individual escape character entered on the " "keyboard from escape sequences sent by cursor and function keys." msgstr "" +"キーボードで入力した単独のエスケープ文字と、カーソルキーやファンクションキー" +"が送信するエスケープシーケンスを区別するため、エスケープ文字を読み込んだ後に" +"待機する時間をミリ秒で設定します。" -#: ../../library/curses.rst:549 msgid "Retrieves the value set by :func:`set_tabsize`." -msgstr "" +msgstr ":func:`set_tabsize` で設定した値を取得します。" -#: ../../library/curses.rst:555 msgid "" "Sets the number of columns used by the curses library when converting a tab " "character to spaces as it adds the tab to a window." msgstr "" +"curses ライブラリがウィンドウにタブ文字を追加する際、タブ文字を空白に変換する" +"ために使用する桁数を設定します。" -#: ../../library/curses.rst:562 msgid "" "Set the virtual screen cursor to *y*, *x*. If *y* and *x* are both ``-1``, " "then :meth:`leaveok ` is set ``True``." msgstr "" "仮想スクリーンのカーソルを *y*, *x* に設定します。*y* および *x* がどちらも " -"``-1`` の場合、 :meth:`leaveok` が に``True``に設定されます。" +"``-1`` の場合、 :meth:`leaveok` が に ``True`` に設定されます。" #: ../../library/curses.rst:568 msgid "" @@ -918,13 +935,16 @@ msgstr "" "が数値で表せる機能値でない場合 ``-2`` を返し、機能がキャンセルされているか、" "端末記述上に見つからない場合 ``-1`` を返します。" -#: ../../library/curses.rst:619 msgid "" "Return the value of the string capability corresponding to the terminfo " "capability name *capname* as a bytes object. Return ``None`` if *capname* " "is not a terminfo \"string capability\", or is canceled or absent from the " "terminal description." msgstr "" +"terminfo の機能名 *capname* に対応する文字列機能の値を bytes オブジェクトとし" +"て返します。\n" +"*capname* が terminfo の「文字列機能」でない場合や、端末の記述で取り消されて" +"いるか存在しない場合は、``None`` を返します。" #: ../../library/curses.rst:627 msgid "" @@ -979,11 +999,12 @@ msgstr "" msgid "Only one *ch* can be pushed before :meth:`!getch` is called." msgstr ":meth:`!getch` を呼び出すまでは *ch* は一つしかプッシュできません。" -#: ../../library/curses.rst:663 msgid "" "Update the :const:`LINES` and :const:`COLS` module variables. Useful for " "detecting manual screen resize." msgstr "" +"モジュール変数 :const:`LINES` と :const:`COLS` を更新します。\n" +"手動によるスクリーンのサイズ変更を検出する際に役立ちます。" #: ../../library/curses.rst:671 msgid "Push *ch* so the next :meth:`~window.get_wch` will return it." @@ -1019,9 +1040,8 @@ msgstr "" "`COLUMNS` が設定されていないとウィンドウのサイズを使います) いても、" "terminfo データベースに指定された lines および columns の値を使います。" -#: ../../library/curses.rst:698 msgid "Equivalent to ``assume_default_colors(-1, -1)``." -msgstr "" +msgstr "``assume_default_colors(-1, -1)`` と等価です。" #: ../../library/curses.rst:703 msgid "" @@ -1108,13 +1128,12 @@ msgid "" "line." msgstr "" -#: ../../library/curses.rst:767 msgid "" "Remove attribute *attr* from the \"background\" set applied to all writes to " "the current window." msgstr "" -"現在のウィンドウに書き込まれたすべての内容に対し \"バックグラウンド\" に設定" -"された属性 *attr* を除去します。" +"現在のウィンドウへのすべての書き込みに適用される \"バックグラウンド\" の属性" +"セットから *attr* を取り除きます。" #: ../../library/curses.rst:773 msgid "" @@ -1298,7 +1317,6 @@ msgstr "" "び *bs* は共に *horch* です。この関数では、角に使われるデフォルト文字が常に使" "用されます。" -#: ../../library/curses.rst:850 msgid "" "Set the attributes of *num* characters at the current cursor position, or at " "position ``(y, x)`` if supplied. If *num* is not given or is ``-1``, the " @@ -1307,14 +1325,20 @@ msgid "" "will be touched using the :meth:`touchline` method so that the contents will " "be redisplayed by the next window refresh." msgstr "" +"現在のカーソル位置、または指定した位置 ``(y, x)`` にある *num* 文字の属性を設" +"定します。\n" +"*num* を指定しないか ``-1`` にした場合は、行末までのすべての文字に属性が設定" +"されます。\n" +"``(y, x)`` を指定した場合、この関数はカーソルをその位置に移動します。\n" +"変更した行は :meth:`touchline` メソッドで変更済みと記録され、次回のウィンドウ" +"更新時に内容が再表示されます。" -#: ../../library/curses.rst:860 msgid "" "Like :meth:`erase`, but also cause the whole window to be repainted upon " "next call to :meth:`refresh`." msgstr "" -":meth:`erase` に似ていますが、次に :meth:`refresh` が呼び出された際にすべての" -"ウィンドウを再描画するようにします。" +":meth:`erase` に似ていますが、次に :meth:`refresh` が呼び出された際にウィンド" +"ウ全体を再描画するようにします。" #: ../../library/curses.rst:866 msgid "" @@ -1324,13 +1348,13 @@ msgstr "" "*flag* が ``True`` ならば、次の :meth:`refresh` はウィンドウを完全に消去しま" "す。" -#: ../../library/curses.rst:872 msgid "" "Erase from cursor to the end of the window: all lines below the cursor are " "deleted, and then the equivalent of :meth:`clrtoeol` is performed." msgstr "" -"カーソルの位置からウィンドウの端までを消去します: カーソル以降のすべての行が" -"削除されるため、:meth:`clrtoeol` と等価です。" +"カーソル位置からウィンドウの末尾までを消去します。\n" +"まずカーソルのある行より下のすべての行を消去し、次に :meth:`clrtoeol` と同等" +"の処理を行います。" #: ../../library/curses.rst:878 msgid "Erase from cursor to the end of the line." @@ -1367,13 +1391,12 @@ msgstr "" "ではなく、ウィンドウの原点からの相対位置です。派生したウィンドウオブジェクト" "が返されます。" -#: ../../library/curses.rst:908 msgid "" "Add character *ch* with attribute *attr*, and immediately call :meth:" "`refresh` on the window." msgstr "" -"文字 *ch* に属性 *attr* を付与し、即座に :meth:`refresh` をウィンドウに対して" -"呼び出します。" +"属性 *attr* を持つ文字 *ch* を追加し、すぐにウィンドウの :meth:`refresh` を呼" +"び出します。" #: ../../library/curses.rst:914 msgid "" @@ -1386,9 +1409,10 @@ msgstr "" "含まれるかを調べて、``True`` または ``False`` を返します。スクリーン上のウィ" "ンドウの一部がマウスイベントの発生場所を含むかどうかを調べる上で便利です。" -#: ../../library/curses.rst:919 msgid "Previously it returned ``1`` or ``0`` instead of ``True`` or ``False``." msgstr "" +"以前は ``True`` または ``False`` ではなく、``1`` または ``0`` を返していまし" +"た。" #: ../../library/curses.rst:925 msgid "" @@ -1406,9 +1430,8 @@ msgstr "" msgid "Clear the window." msgstr "ウィンドウをクリアします。" -#: ../../library/curses.rst:940 msgid "Return a tuple ``(y, x)`` of coordinates of upper-left corner." -msgstr "" +msgstr "左上隅の座標をタプル ``(y, x)`` として返します。" #: ../../library/curses.rst:945 msgid "Return the given window's current background character/attribute pair." @@ -1466,9 +1489,8 @@ msgid "" "maximum value for *n* is 2047." msgstr "" -#: ../../library/curses.rst:993 ../../library/curses.rst:1088 msgid "The maximum value for *n* was increased from 1023 to 2047." -msgstr "" +msgstr "*n* の最大値が 1023 から 2047 に増えました。" #: ../../library/curses.rst:999 msgid "" @@ -1534,7 +1556,6 @@ msgstr "" "``(y, x)`` に文字 *ch* を属性 *attr* で描画し、行の *x* からの内容を 1 文字分" "右にずらします。" -#: ../../library/curses.rst:1047 msgid "" "Insert *nlines* lines into the specified window above the current line. The " "*nlines* bottom lines are lost. For negative *nlines*, delete *nlines* " @@ -1542,10 +1563,12 @@ msgid "" "up. The bottom *nlines* lines are cleared. The current cursor position " "remains the same." msgstr "" -"*nlines* 行を指定されたウィンドウの現在の行の上に挿入します。その下にある " -"*nlines* 行は失われます。負の *nlines* を指定すると、カーソルのある行以降の " -"*nlines* を削除し、削除された行の後ろに続く内容が上に来ます。その下にある " -"*nlines* は消去されます。現在のカーソル位置はそのままです。" +"指定されたウィンドウの現在の行の上に *nlines* 行を挿入します。\n" +"最下部の *nlines* 行は失われます。\n" +"*nlines* が負の場合は、カーソルのある行からその絶対値に相当する行数を削除し、" +"残りの行を上に移動します。\n" +"最下部の同じ行数分は消去されます。\n" +"現在のカーソル位置は変わりません。" #: ../../library/curses.rst:1056 msgid "" @@ -1890,24 +1913,21 @@ msgstr "" "``-1`` を返します。*delay* が正の値であれば、:meth:`getch` は *delay* ミリ秒" "間ブロックし、ブロック後の時点で入力がない場合には ``-1`` を返します。" -#: ../../library/curses.rst:1307 msgid "" "Pretend *count* lines have been changed, starting with line *start*. If " "*changed* is supplied, it specifies whether the affected lines are marked as " "having been changed (*changed*\\ ``=True``) or unchanged (*changed*\\ " "``=False``)." msgstr "" -"*start* から始まる *count* 行が変更されたかのように振舞わせます。もし " -"*changed* が与えられた場合、その引数は指定された行が変更された(*changed*\\ " -"``=True``)か、変更されていないか(*changed*\\ )を指定します。" +"*start* 行から *count* 行が変更されたものとして扱います。\n" +"*changed* を指定した場合は、対象の行を変更済み (*changed*\\ ``=True``) とする" +"か、未変更 (*changed*\\ ``=False``) とするかを指定します。" -#: ../../library/curses.rst:1314 msgid "" "Pretend the whole window has been changed, for purposes of drawing " "optimizations." msgstr "" -"描画を最適化するために、すべてのウィンドウが変更されたかのように振舞わせま" -"す。" +"描画を最適化するために、ウィンドウ全体が変更されたかのように振舞わせます。" #: ../../library/curses.rst:1320 msgid "" @@ -1917,11 +1937,12 @@ msgstr "" "ウィンドウ内のすべての行を、最後に :meth:`refresh` を呼んだ際から変更されてい" "ないものとしてマークします。" -#: ../../library/curses.rst:1327 msgid "" "Display a vertical line starting at ``(y, x)`` with length *n* consisting of " "the character *ch* with attributes *attr*." msgstr "" +"``(y, x)`` を始点として、属性 *attr* の文字 *ch* からなる長さ *n* の垂直線を" +"表示します。" #: ../../library/curses.rst:1332 msgid "Constants" @@ -1947,33 +1968,37 @@ msgstr "" ":func:`napms` のような整数を返す curses ルーチンのいくつかは、成功した際に :" "const:`OK` を返します。" -#: ../../library/curses.rst:1352 msgid "A bytes object representing the current version of the module." -msgstr "" +msgstr "モジュールの現在のバージョンを表す bytes オブジェクトです。" -#: ../../library/curses.rst:1357 msgid "" "A named tuple containing the three components of the ncurses library " "version: *major*, *minor*, and *patch*. All values are integers. The " "components can also be accessed by name, so ``curses.ncurses_version[0]`` " "is equivalent to ``curses.ncurses_version.major`` and so on." msgstr "" +"ncurses ライブラリのバージョンの 3 つの成分 *major*、*minor*、*patch* を含む" +"名前付きタプルです。\n" +"値はすべて整数です。\n" +"各成分には名前でもアクセスできるため、例えば ``curses.ncurses_version[0]`` " +"は ``curses.ncurses_version.major`` と等価です。" -#: ../../library/curses.rst:1362 msgid "Availability: if the ncurses library is used." -msgstr "" +msgstr "利用可能な環境: ncurses ライブラリが使用されている場合。" -#: ../../library/curses.rst:1368 msgid "" "The maximum number of colors the terminal can support. It is defined only " "after the call to :func:`start_color`." msgstr "" +"端末がサポートできる色の最大数です。\n" +":func:`start_color` の呼び出し後にのみ定義されます。" -#: ../../library/curses.rst:1373 msgid "" "The maximum number of color pairs the terminal can support. It is defined " "only after the call to :func:`start_color`." msgstr "" +"端末がサポートできる色ペアの最大数です。\n" +":func:`start_color` の呼び出し後にのみ定義されます。" #: ../../library/curses.rst:1378 msgid "" @@ -1989,11 +2014,12 @@ msgid "" "func:`resizeterm` and :func:`resize_term`." msgstr "" -#: ../../library/curses.rst:1391 msgid "" "Some constants are available to specify character cell attributes. The exact " "constants available are system dependent." msgstr "" +"文字セルの属性を指定するための定数が用意されています。\n" +"実際に利用できる定数はシステムによって異なります。" #: ../../library/curses.rst:1395 msgid "Attribute" @@ -2020,9 +2046,8 @@ msgstr "太字モード" msgid "Dim mode" msgstr "低輝度モード" -#: ../../library/curses.rst:1405 msgid "Invisible or blank mode" -msgstr "" +msgstr "非表示または空白モード" #: ../../library/curses.rst:1407 msgid "Italic mode" @@ -2032,13 +2057,11 @@ msgstr "イタリックモード" msgid "Normal attribute" msgstr "通常の属性" -#: ../../library/curses.rst:1411 msgid "Protected mode" -msgstr "" +msgstr "保護モード" -#: ../../library/curses.rst:1413 msgid "Reverse background and foreground colors" -msgstr "" +msgstr "背景色と前景色を反転" #: ../../library/curses.rst:1416 msgid "Standout mode" @@ -2048,55 +2071,46 @@ msgstr "強調モード" msgid "Underline mode" msgstr "下線モード" -#: ../../library/curses.rst:1420 msgid "Horizontal highlight" -msgstr "" +msgstr "水平強調" -#: ../../library/curses.rst:1422 msgid "Left highlight" -msgstr "" +msgstr "左強調" -#: ../../library/curses.rst:1424 msgid "Low highlight" -msgstr "" +msgstr "下強調" -#: ../../library/curses.rst:1426 msgid "Right highlight" -msgstr "" +msgstr "右強調" -#: ../../library/curses.rst:1428 msgid "Top highlight" -msgstr "" +msgstr "上強調" -#: ../../library/curses.rst:1430 msgid "Vertical highlight" -msgstr "" +msgstr "垂直強調" #: ../../library/curses.rst:1433 msgid "``A_ITALIC`` was added." msgstr "``A_ITALIC`` が追加されました。" -#: ../../library/curses.rst:1436 msgid "" "Several constants are available to extract corresponding attributes returned " "by some methods." msgstr "" +"一部のメソッドが返す値から対応する属性を取り出すための定数が用意されていま" +"す。" -#: ../../library/curses.rst:1440 msgid "Bit-mask" -msgstr "" +msgstr "ビットマスク" -#: ../../library/curses.rst:1442 msgid "Bit-mask to extract attributes" -msgstr "" +msgstr "属性を取り出すビットマスク" -#: ../../library/curses.rst:1445 msgid "Bit-mask to extract a character" -msgstr "" +msgstr "文字を取り出すビットマスク" -#: ../../library/curses.rst:1448 msgid "Bit-mask to extract color-pair field information" -msgstr "" +msgstr "色ペアフィールドの情報を取り出すビットマスク" #: ../../library/curses.rst:1452 msgid "" @@ -2490,7 +2504,6 @@ msgstr "端末リサイズイベント" msgid "Maximum key value" msgstr "最大キー値" -#: ../../library/curses.rst:1650 msgid "" "On VT100s and their software emulations, such as X terminal emulators, there " "are normally at least four function keys (:const:`KEY_F1 `, :const:" @@ -2501,6 +2514,15 @@ msgid "" "(older PC keyboards may have only ten function keys); also, the following " "keypad mappings are standard:" msgstr "" +"VT100 とそのソフトウェアエミュレーション (X 端末エミュレータなど) では、通常" +"は少なくとも 4 つのファンクションキー (:const:`KEY_F1 `、:const:" +"`KEY_F2 `、:const:`KEY_F3 `、:const:`KEY_F4 `) が利用" +"でき、矢印キーはそれぞれ :const:`KEY_UP`、:const:`KEY_DOWN`、:const:" +"`KEY_LEFT`、:const:`KEY_RIGHT` に対応付けられています。\n" +"PC キーボードのあるマシンでは、矢印キーと 12 個のファンクションキーがあると考" +"えてよいでしょう (古い PC キーボードにはファンクションキーが 10 個しかない場" +"合もあります)。\n" +"また、以下のキーパッドの対応付けが標準です:" #: ../../library/curses.rst:1659 msgid "Keycap" @@ -2751,42 +2773,33 @@ msgstr "右上角" msgid "vertical line" msgstr "垂直線" -#: ../../library/curses.rst:1775 msgid "" "The following table lists mouse button constants used by :meth:`getmouse`:" -msgstr "" +msgstr ":meth:`getmouse` で使用するマウスボタン定数を以下の表に示します:" -#: ../../library/curses.rst:1778 msgid "Mouse button constant" -msgstr "" +msgstr "マウスボタン定数" -#: ../../library/curses.rst:1780 msgid "Mouse button *n* pressed" -msgstr "" +msgstr "マウスボタン *n* が押された" -#: ../../library/curses.rst:1782 msgid "Mouse button *n* released" -msgstr "" +msgstr "マウスボタン *n* が離された" -#: ../../library/curses.rst:1784 msgid "Mouse button *n* clicked" -msgstr "" +msgstr "マウスボタン *n* がクリックされた" -#: ../../library/curses.rst:1786 msgid "Mouse button *n* double clicked" -msgstr "" +msgstr "マウスボタン *n* がダブルクリックされた" -#: ../../library/curses.rst:1788 msgid "Mouse button *n* triple clicked" -msgstr "" +msgstr "マウスボタン *n* がトリプルクリックされた" -#: ../../library/curses.rst:1790 msgid "Shift was down during button state change" -msgstr "" +msgstr "ボタンの状態変更時に Shift が押されていた" -#: ../../library/curses.rst:1792 ../../library/curses.rst:1794 msgid "Control was down during button state change" -msgstr "" +msgstr "ボタンの状態変更時に Control が押されていた" #: ../../library/curses.rst:1801 msgid "The following table lists the predefined colors:" @@ -3049,25 +3062,20 @@ msgstr "" "移動操作は、カーソルがウィンドウの縁にあって移動ができない場合には何も行いま" "せん。場合によっては、以下のような同義のキーストロークがサポートされています:" -#: ../../library/curses.rst:1930 msgid ":const:`~curses.KEY_LEFT`" -msgstr "" +msgstr ":const:`~curses.KEY_LEFT`" -#: ../../library/curses.rst:1932 msgid ":const:`~curses.KEY_RIGHT`" -msgstr "" +msgstr ":const:`~curses.KEY_RIGHT`" -#: ../../library/curses.rst:1934 msgid ":const:`~curses.KEY_UP`" -msgstr "" +msgstr ":const:`~curses.KEY_UP`" -#: ../../library/curses.rst:1936 msgid ":const:`~curses.KEY_DOWN`" -msgstr "" +msgstr ":const:`~curses.KEY_DOWN`" -#: ../../library/curses.rst:1938 msgid ":const:`~curses.KEY_BACKSPACE`" -msgstr "" +msgstr ":const:`~curses.KEY_BACKSPACE`" #: ../../library/curses.rst:1938 msgid ":kbd:`Control-h`" diff --git a/library/custominterp.po b/library/custominterp.po index 58d589b18..661ee6568 100644 --- a/library/custominterp.po +++ b/library/custominterp.po @@ -17,10 +17,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/custominterp.rst:5 diff --git a/library/dataclasses.po b/library/dataclasses.po index 22ab19387..0c6fa6599 100644 --- a/library/dataclasses.po +++ b/library/dataclasses.po @@ -20,10 +20,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/dataclasses.rst:2 @@ -54,7 +54,6 @@ msgstr "" "これらの生成されたメソッドで利用されるメンバー変数は :pep:`526` 型アノテー" "ションを用いて定義されます。例えば、このコードでは::" -#: ../../library/dataclasses.rst:22 msgid "" "from dataclasses import dataclass\n" "\n" @@ -68,12 +67,22 @@ msgid "" " def total_cost(self) -> float:\n" " return self.unit_price * self.quantity_on_hand" msgstr "" +"from dataclasses import dataclass\n" +"\n" +"@dataclass\n" +"class InventoryItem:\n" +" \"\"\"在庫内の品目を管理するクラス。\"\"\"\n" +" name: str\n" +" unit_price: float\n" +" quantity_on_hand: int = 0\n" +"\n" +" def total_cost(self) -> float:\n" +" return self.unit_price * self.quantity_on_hand" #: ../../library/dataclasses.rst:34 msgid "will add, among other things, a :meth:`!__init__` that looks like::" msgstr "とりわけ、以下のような :meth:`!__init__` が追加されます::" -#: ../../library/dataclasses.rst:36 msgid "" "def __init__(self, name: str, unit_price: float, quantity_on_hand: int = " "0):\n" @@ -81,6 +90,11 @@ msgid "" " self.unit_price = unit_price\n" " self.quantity_on_hand = quantity_on_hand" msgstr "" +"def __init__(self, name: str, unit_price: float, quantity_on_hand: int = " +"0):\n" +" self.name = name\n" +" self.unit_price = unit_price\n" +" self.quantity_on_hand = quantity_on_hand" #: ../../library/dataclasses.rst:41 msgid "" @@ -137,14 +151,15 @@ msgstr "" "合の動作は、後述する引数によって異なります。デコレータは呼び出した際に指定し" "たクラスと同じクラスを返します。新しいクラスは生成されません。" -#: ../../library/dataclasses.rst:69 msgid "" "If ``@dataclass`` is used just as a simple decorator with no parameters, it " "acts as if it has the default values documented in this signature. That is, " "these three uses of ``@dataclass`` are equivalent::" msgstr "" +"``@dataclass`` をパラメータなしの単純なデコレータとして使用すると、このシグネ" +"チャに記載されたデフォルト値を指定した場合と同じ動作になります。\n" +"つまり、以下の 3 通りの ``@dataclass`` の使い方は等価です。 ::" -#: ../../library/dataclasses.rst:74 msgid "" "@dataclass\n" "class C:\n" @@ -160,23 +175,36 @@ msgid "" "class C:\n" " ..." msgstr "" +"@dataclass\n" +"class C:\n" +" ...\n" +"\n" +"@dataclass()\n" +"class C:\n" +" ...\n" +"\n" +"@dataclass(init=True, repr=True, eq=True, order=False, unsafe_hash=False, " +"frozen=False,\n" +" match_args=True, kw_only=False, slots=False, weakref_slot=False)\n" +"class C:\n" +" ..." -#: ../../library/dataclasses.rst:87 msgid "The parameters to ``@dataclass`` are:" -msgstr "" +msgstr "``@dataclass`` のパラメータは以下のとおりです:" -#: ../../library/dataclasses.rst:89 msgid "" "*init*: If true (the default), a :meth:`~object.__init__` method will be " "generated." msgstr "" +"*init*: 真の場合 (デフォルト)、:meth:`~object.__init__` メソッドを生成しま" +"す。" -#: ../../library/dataclasses.rst:92 msgid "" "If the class already defines :meth:`!__init__`, this parameter is ignored." msgstr "" +"クラスがすでに :meth:`!__init__` を定義している場合、このパラメータは無視され" +"ます。" -#: ../../library/dataclasses.rst:95 msgid "" "*repr*: If true (the default), a :meth:`~object.__repr__` method will be " "generated. The generated repr string will have the class name and the name " @@ -185,11 +213,19 @@ msgid "" "example: ``InventoryItem(name='widget', unit_price=3.0, " "quantity_on_hand=10)``." msgstr "" +"*repr*: 真の場合 (デフォルト)、:meth:`~object.__repr__` メソッドを生成しま" +"す。\n" +"生成される repr 文字列にはクラス名と、クラスで定義した順に各フィールドの名前" +"と repr が含まれます。\n" +"repr から除外すると指定されたフィールドは含まれません。\n" +"例えば、``InventoryItem(name='widget', unit_price=3.0, " +"quantity_on_hand=10)`` となります。" -#: ../../library/dataclasses.rst:102 msgid "" "If the class already defines :meth:`!__repr__`, this parameter is ignored." msgstr "" +"クラスがすでに :meth:`!__repr__` を定義している場合、このパラメータは無視され" +"ます。" #: ../../library/dataclasses.rst:105 msgid "" @@ -199,12 +235,12 @@ msgid "" "type." msgstr "" -#: ../../library/dataclasses.rst:110 msgid "" "If the class already defines :meth:`!__eq__`, this parameter is ignored." msgstr "" +"クラスがすでに :meth:`!__eq__` を定義している場合、このパラメータは無視されま" +"す。" -#: ../../library/dataclasses.rst:113 msgid "" "*order*: If true (the default is ``False``), :meth:`~object.__lt__`, :meth:" "`~object.__le__`, :meth:`~object.__gt__`, and :meth:`~object.__ge__` methods " @@ -212,12 +248,20 @@ msgid "" "fields, in order. Both instances in the comparison must be of the identical " "type. If *order* is true and *eq* is false, a :exc:`ValueError` is raised." msgstr "" +"*order*: 真の場合 (デフォルトは ``False``)、:meth:`~object.__lt__`、:meth:" +"`~object.__le__`、:meth:`~object.__gt__`、:meth:`~object.__ge__` メソッドを生" +"成します。\n" +"これらのメソッドは、フィールドを順に並べたタプルのようにこのクラスのインスタ" +"ンスを比較します。\n" +"比較する両方のインスタンスは、まったく同じ型でなければなりません。\n" +"*order* が真で *eq* が偽の場合は、:exc:`ValueError` を送出します。" -#: ../../library/dataclasses.rst:120 msgid "" "If the class already defines any of :meth:`!__lt__`, :meth:`!__le__`, :meth:" "`!__gt__`, or :meth:`!__ge__`, then :exc:`TypeError` is raised." msgstr "" +"クラスがすでに :meth:`!__lt__`、:meth:`!__le__`、:meth:`!__gt__`、:meth:`!" +"__ge__` のいずれかを定義している場合は、:exc:`TypeError` を送出します。" #: ../../library/dataclasses.rst:124 msgid "" @@ -225,7 +269,6 @@ msgid "" "is generated according to how *eq* and *frozen* are set." msgstr "" -#: ../../library/dataclasses.rst:127 msgid "" ":meth:`!__hash__` is used by built-in :meth:`hash`, and when objects are " "added to hashed collections such as dictionaries and sets. Having a :meth:`!" @@ -234,8 +277,14 @@ msgid "" "and behavior of :meth:`!__eq__`, and the values of the *eq* and *frozen* " "flags in the ``@dataclass`` decorator." msgstr "" +":meth:`!__hash__` は組み込みの :meth:`hash` で使用されるほか、辞書や集合のよ" +"うなハッシュを使用するコレクションにオブジェクトを追加する際にも使用されま" +"す。\n" +":meth:`!__hash__` があることは、そのクラスのインスタンスが不変であることを示" +"唆します。\n" +"可変性は複雑な性質で、プログラマの意図、:meth:`!__eq__` の有無と動作、" +"``@dataclass`` デコレータの *eq* と *frozen* フラグの値に依存します。" -#: ../../library/dataclasses.rst:134 msgid "" "By default, ``@dataclass`` will not implicitly add a :meth:`~object." "__hash__` method unless it is safe to do so. Neither will it add or change " @@ -243,8 +292,13 @@ msgid "" "attribute ``__hash__ = None`` has a specific meaning to Python, as described " "in the :meth:`!__hash__` documentation." msgstr "" +"デフォルトでは、安全な場合を除き、``@dataclass`` は :meth:`~object.__hash__` " +"メソッドを暗黙的に追加しません。\n" +"また、明示的に定義済みの :meth:`!__hash__` メソッドを追加したり変更したりしま" +"せん。\n" +"クラス属性を ``__hash__ = None`` に設定することには、:meth:`!__hash__` のド" +"キュメントで説明されているように、Python における特定の意味があります。" -#: ../../library/dataclasses.rst:140 msgid "" "If :meth:`!__hash__` is not explicitly defined, or if it is set to ``None``, " "then ``@dataclass`` *may* add an implicit :meth:`!__hash__` method. Although " @@ -253,16 +307,26 @@ msgid "" "logically immutable but can still be mutated. This is a specialized use case " "and should be considered carefully." msgstr "" +":meth:`!__hash__` が明示的に定義されていないか、``None`` に設定されている場" +"合、``@dataclass`` は暗黙的な :meth:`!__hash__` メソッドを追加する *ことがあ" +"ります*。\n" +"推奨されませんが、``unsafe_hash=True`` を指定して、``@dataclass`` に :meth:`!" +"__hash__` メソッドを強制的に作成させることができます。\n" +"論理的には不変でも変更可能なクラスの場合に、この方法を使うことが考えられま" +"す。\n" +"これは特殊な用途であり、慎重に検討する必要があります。" -#: ../../library/dataclasses.rst:147 msgid "" "Here are the rules governing implicit creation of a :meth:`!__hash__` " "method. Note that you cannot both have an explicit :meth:`!__hash__` method " "in your dataclass and set ``unsafe_hash=True``; this will result in a :exc:" "`TypeError`." msgstr "" +":meth:`!__hash__` メソッドの暗黙的な作成には、以下の規則が適用されます。\n" +"データクラスに明示的な :meth:`!__hash__` メソッドを定義し、同時に " +"``unsafe_hash=True`` を設定することはできません。\n" +"この場合は :exc:`TypeError` が発生します。" -#: ../../library/dataclasses.rst:152 msgid "" "If *eq* and *frozen* are both true, by default ``@dataclass`` will generate " "a :meth:`!__hash__` method for you. If *eq* is true and *frozen* is false, :" @@ -272,6 +336,13 @@ msgid "" "used (if the superclass is :class:`object`, this means it will fall back to " "id-based hashing)." msgstr "" +"*eq* と *frozen* がともに真の場合、デフォルトでは ``@dataclass`` は :meth:`!" +"__hash__` メソッドを生成します。\n" +"*eq* が真で *frozen* が偽の場合、:meth:`!__hash__` は ``None`` に設定され、" +"ハッシュ不可能であることを示します (可変なので実際にハッシュ不可能です)。\n" +"*eq* が偽の場合、:meth:`!__hash__` は変更されないため、スーパークラスの :" +"meth:`!__hash__` メソッドが使用されます (スーパークラスが :class:`object` の" +"場合、id に基づくハッシュが使われます)。" #: ../../library/dataclasses.rst:160 msgid "" @@ -281,7 +352,6 @@ msgid "" "class, then :exc:`TypeError` is raised. See the discussion below." msgstr "" -#: ../../library/dataclasses.rst:165 msgid "" "*match_args*: If true (the default is ``True``), the :attr:`~object." "__match_args__` tuple will be created from the list of non keyword-only " @@ -290,8 +360,14 @@ msgid "" "__match_args__` is already defined in the class, then :attr:`!" "__match_args__` will not be generated." msgstr "" +"*match_args*: 真の場合 (デフォルトは ``True``)、生成される :meth:`~object." +"__init__` メソッドのキーワード専用でないパラメータのリストから :attr:" +"`~object.__match_args__` タプルを作成します (:meth:`!__init__` が生成されない" +"場合も同様です。\n" +"上記を参照)。\n" +"偽の場合、またはクラスに :attr:`!__match_args__` がすでに定義されている場合" +"は、:attr:`!__match_args__` を生成しません。" -#: ../../library/dataclasses.rst:174 msgid "" "*kw_only*: If true (the default value is ``False``), then all fields will be " "marked as keyword-only. If a field is marked as keyword-only, then the only " @@ -300,28 +376,40 @@ msgid "" "is called. See the :term:`parameter` glossary entry for details. Also see " "the :const:`KW_ONLY` section." msgstr "" +"*kw_only*: 真の場合 (デフォルト値は ``False``)、すべてのフィールドをキーワー" +"ド専用に指定します。\n" +"フィールドをキーワード専用にすることの唯一の効果は、そのフィールドから生成さ" +"れる :meth:`~object.__init__` のパラメータを、:meth:`!__init__` の呼び出し時" +"にキーワードで指定する必要があるという点です。\n" +"詳細は用語集の :term:`parameter` を参照してください。\n" +":const:`KW_ONLY` の節も参照してください。" -#: ../../library/dataclasses.rst:182 msgid "Keyword-only fields are not included in :attr:`!__match_args__`." -msgstr "" +msgstr "キーワード専用フィールドは :attr:`!__match_args__` に含まれません。" -#: ../../library/dataclasses.rst:186 msgid "" "*slots*: If true (the default is ``False``), :attr:`~object.__slots__` " "attribute will be generated and new class will be returned instead of the " "original one. If :attr:`!__slots__` is already defined in the class, then :" "exc:`TypeError` is raised." msgstr "" +"*slots*: 真の場合 (デフォルトは ``False``)、:attr:`~object.__slots__` 属性を" +"生成し、元のクラスの代わりに新しいクラスを返します。\n" +"クラスに :attr:`!__slots__` がすでに定義されている場合は、:exc:`TypeError` を" +"送出します。" -#: ../../library/dataclasses.rst:192 msgid "" "Passing parameters to a base class :meth:`~object.__init_subclass__` when " "using ``slots=True`` will result in a :exc:`TypeError`. Either use " "``__init_subclass__`` with no parameters or use default values as a " "workaround. See :gh:`91126` for full details." msgstr "" +"``slots=True`` を使用する際に基底クラスの :meth:`~object.__init_subclass__` " +"にパラメータを渡すと、:exc:`TypeError` が発生します。\n" +"回避するには、パラメータなしの ``__init_subclass__`` を使用するか、デフォルト" +"値を使用してください。\n" +"詳細は :gh:`91126` を参照してください。" -#: ../../library/dataclasses.rst:200 msgid "" "If a field name is already included in the :attr:`!__slots__` of a base " "class, it will not be included in the generated :attr:`!__slots__` to " @@ -330,14 +418,26 @@ msgid "" "`fields` instead. To be able to determine inherited slots, base class :attr:" "`!__slots__` may be any iterable, but *not* an iterator." msgstr "" +"基底クラスの :attr:`!__slots__` にフィールド名がすでに含まれている場合、:ref:" +"`オーバーライド ` を防ぐため、生成される :attr:`!" +"__slots__` には含まれません。\n" +"したがって、データクラスのフィールド名を取得するために :attr:`!__slots__` を" +"使用しないでください。\n" +"代わりに :func:`fields` を使用してください。\n" +"継承するスロットを判定できるように、基底クラスの :attr:`!__slots__` には任意" +"のイテラブルを使用できますが、イテレータは使用 *できません*。" -#: ../../library/dataclasses.rst:210 msgid "" "*weakref_slot*: If true (the default is ``False``), add a slot named " "\"__weakref__\", which is required to make an instance :func:`weakref-able " "`. It is an error to specify ``weakref_slot=True`` without also " "specifying ``slots=True``." msgstr "" +"*weakref_slot*: 真の場合 (デフォルトは ``False``)、インスタンスを :func:`弱参" +"照可能 ` にするために必要な \"__weakref__\" という名前のスロット" +"を追加します。\n" +"``slots=True`` を指定せずに ``weakref_slot=True`` を指定するとエラーになりま" +"す。" #: ../../library/dataclasses.rst:218 msgid "" @@ -346,23 +446,26 @@ msgid "" msgstr "" "``フィールド`` には、通常の Python の文法でデフォルト値を指定できます。" -#: ../../library/dataclasses.rst:221 msgid "" "@dataclass\n" "class C:\n" " a: int # 'a' has no default value\n" " b: int = 0 # assign a default value for 'b'" msgstr "" +"@dataclass\n" +"class C:\n" +" a: int # 'a' にはデフォルト値がない\n" +" b: int = 0 # 'b' にデフォルト値を割り当てる" -#: ../../library/dataclasses.rst:226 msgid "" "In this example, both :attr:`!a` and :attr:`!b` will be included in the " "added :meth:`~object.__init__` method, which will be defined as::" msgstr "" +"この例では、:attr:`!a` と :attr:`!b` の両方が、次のように定義される :meth:" +"`~object.__init__` メソッドに含まれます。 ::" -#: ../../library/dataclasses.rst:229 msgid "def __init__(self, a: int, b: int = 0):" -msgstr "" +msgstr "def __init__(self, a: int, b: int = 0):" #: ../../library/dataclasses.rst:231 msgid "" @@ -374,7 +477,6 @@ msgstr "" "に定義すると、 :exc:`TypeError` が送出されます。これは、単一のクラスであって" "も、クラス継承の結果でも起きえます。" -#: ../../library/dataclasses.rst:237 msgid "" "For common and simple use cases, no other functionality is required. There " "are, however, some dataclass features that require additional per-field " @@ -382,8 +484,13 @@ msgid "" "replace the default field value with a call to the provided :func:`!field` " "function. For example::" msgstr "" +"一般的で単純な用途では、これ以外の機能は必要ありません。\n" +"ただし、データクラスの機能には、フィールドごとの追加情報を必要とするものもあ" +"ります。\n" +"追加情報を指定するために、フィールドのデフォルト値を、提供されている :func:`!" +"field` 関数の呼び出しに置き換えられます。\n" +"例えば次のようにします。 ::" -#: ../../library/dataclasses.rst:243 msgid "" "@dataclass\n" "class C:\n" @@ -392,6 +499,12 @@ msgid "" "c = C()\n" "c.mylist += [1, 2, 3]" msgstr "" +"@dataclass\n" +"class C:\n" +" mylist: list[int] = field(default_factory=list)\n" +"\n" +"c = C()\n" +"c.mylist += [1, 2, 3]" #: ../../library/dataclasses.rst:250 msgid "" @@ -401,18 +514,18 @@ msgid "" "meaning. No code should directly use the :const:`MISSING` value." msgstr "" -#: ../../library/dataclasses.rst:255 msgid "The parameters to :func:`!field` are:" -msgstr "" +msgstr ":func:`!field` のパラメータは以下のとおりです:" -#: ../../library/dataclasses.rst:257 msgid "" "*default*: If provided, this will be the default value for this field. This " "is needed because the :func:`!field` call itself replaces the normal " "position of the default value." msgstr "" +"*default*: 指定した場合、このフィールドのデフォルト値になります。\n" +"通常デフォルト値を指定する位置が :func:`!field` 呼び出しで置き換わるため、こ" +"のパラメータが必要になります。" -#: ../../library/dataclasses.rst:261 msgid "" "*default_factory*: If provided, it must be a zero-argument callable that " "will be called when a default value is needed for this field. Among other " @@ -420,20 +533,27 @@ msgid "" "discussed below. It is an error to specify both *default* and " "*default_factory*." msgstr "" +"*default_factory*: 指定する場合、引数を取らない呼び出し可能オブジェクトでなけ" +"ればなりません。\n" +"このフィールドのデフォルト値が必要なときに呼び出されます。\n" +"用途の一例として、後述するように、可変なデフォルト値を持つフィールドの指定に" +"使用できます。\n" +"*default* と *default_factory* を両方指定するとエラーになります。" -#: ../../library/dataclasses.rst:267 msgid "" "*init*: If true (the default), this field is included as a parameter to the " "generated :meth:`~object.__init__` method." msgstr "" +"*init*: 真の場合 (デフォルト)、このフィールドを、生成される :meth:`~object." +"__init__` メソッドのパラメータに含めます。" -#: ../../library/dataclasses.rst:270 msgid "" "*repr*: If true (the default), this field is included in the string returned " "by the generated :meth:`~object.__repr__` method." msgstr "" +"*repr*: 真の場合 (デフォルト)、このフィールドを、生成される :meth:`~object." +"__repr__` メソッドが返す文字列に含めます。" -#: ../../library/dataclasses.rst:273 msgid "" "*hash*: This can be a bool or ``None``. If true, this field is included in " "the generated :meth:`~object.__hash__` method. If false, this field is " @@ -443,6 +563,15 @@ msgid "" "comparisons. Setting this value to anything other than ``None`` is " "discouraged." msgstr "" +"*hash*: bool または ``None`` を指定できます。\n" +"真の場合、このフィールドを、生成される :meth:`~object.__hash__` メソッドに含" +"めます。\n" +"偽の場合、このフィールドを、生成される :meth:`~object.__hash__` から除外しま" +"す。\n" +"``None`` の場合 (デフォルト)、*compare* の値を使用します。\n" +"比較に使用するフィールドはハッシュにも含めるべきなので、通常はこれが期待され" +"る動作です。\n" +"この値を ``None`` 以外に設定することは推奨されません。" #: ../../library/dataclasses.rst:281 msgid "" @@ -457,14 +586,15 @@ msgstr "" "要かつ、その型のハッシュ値を計算するのに他のフィールドも使われることです。\n" "フィールドがハッシュから除外されていたとしても、比較には使えます。" -#: ../../library/dataclasses.rst:287 msgid "" "*compare*: If true (the default), this field is included in the generated " "equality and comparison methods (:meth:`~object.__eq__`, :meth:`~object." "__gt__`, et al.)." msgstr "" +"*compare*: 真の場合 (デフォルト)、このフィールドを、生成される等価比較および" +"順序比較のメソッド (:meth:`~object.__eq__`、:meth:`~object.__gt__` など) に含" +"めます。" -#: ../../library/dataclasses.rst:291 msgid "" "*metadata*: This can be a mapping or ``None``. ``None`` is treated as an " "empty dict. This value is wrapped in :func:`~types.MappingProxyType` to " @@ -473,20 +603,28 @@ msgid "" "mechanism. Multiple third-parties can each have their own key, to use as a " "namespace in the metadata." msgstr "" +"*metadata*: マッピングまたは ``None`` を指定できます。\n" +"``None`` は空の辞書として扱われます。\n" +"この値は :func:`~types.MappingProxyType` でラップして読み取り専用にし、:" +"class:`Field` オブジェクト上で公開します。\n" +"データクラス自体はこの値を一切使用せず、サードパーティの拡張機構として提供し" +"ています。\n" +"複数のサードパーティがそれぞれ独自のキーを持ち、メタデータ内の名前空間として" +"使用できます。" -#: ../../library/dataclasses.rst:299 msgid "" "*kw_only*: If true, this field will be marked as keyword-only. This is used " "when the generated :meth:`~object.__init__` method's parameters are computed." msgstr "" +"*kw_only*: 真の場合、このフィールドをキーワード専用に指定します。\n" +"これは、生成される :meth:`~object.__init__` メソッドのパラメータを算出する際" +"に使用されます。" -#: ../../library/dataclasses.rst:303 msgid "Keyword-only fields are also not included in :attr:`!__match_args__`." -msgstr "" +msgstr "キーワード専用フィールドは :attr:`!__match_args__` にも含まれません。" -#: ../../library/dataclasses.rst:307 msgid "*doc*: optional docstring for this field." -msgstr "" +msgstr "*doc*: このフィールドの省略可能な docstring です。" #: ../../library/dataclasses.rst:311 msgid "" @@ -499,7 +637,6 @@ msgid "" "specified. For example, after::" msgstr "" -#: ../../library/dataclasses.rst:320 msgid "" "@dataclass\n" "class C:\n" @@ -508,36 +645,48 @@ msgid "" " z: int = field(repr=False, default=10)\n" " t: int = 20" msgstr "" +"@dataclass\n" +"class C:\n" +" x: int\n" +" y: int = field(repr=False)\n" +" z: int = field(repr=False, default=10)\n" +" t: int = 20" -#: ../../library/dataclasses.rst:327 msgid "" "The class attribute :attr:`!C.z` will be ``10``, the class attribute :attr:`!" "C.t` will be ``20``, and the class attributes :attr:`!C.x` and :attr:`!C.y` " "will not be set." msgstr "" +"クラス属性 :attr:`!C.z` は ``10``、クラス属性 :attr:`!C.t` は ``20`` になり、" +"クラス属性 :attr:`!C.x` と :attr:`!C.y` は設定されません。" -#: ../../library/dataclasses.rst:333 msgid "" ":class:`!Field` objects describe each defined field. These objects are " "created internally, and are returned by the :func:`fields` module-level " "method (see below). Users should never instantiate a :class:`!Field` object " "directly. Its documented attributes are:" msgstr "" +":class:`!Field` オブジェクトは、定義された各フィールドを記述します。\n" +"これらのオブジェクトは内部で作成され、モジュールレベルの :func:`fields` 関数 " +"(後述) から返されます。\n" +"ユーザーが :class:`!Field` オブジェクトを直接インスタンス化してはいけませ" +"ん。\n" +"公開されている属性は以下のとおりです:" -#: ../../library/dataclasses.rst:338 msgid ":attr:`!name`: The name of the field." -msgstr "" +msgstr ":attr:`!name`: フィールドの名前。" -#: ../../library/dataclasses.rst:339 msgid ":attr:`!type`: The type of the field." -msgstr "" +msgstr ":attr:`!type`: フィールドの型。" -#: ../../library/dataclasses.rst:340 msgid "" ":attr:`!default`, :attr:`!default_factory`, :attr:`!init`, :attr:`!repr`, :" "attr:`!hash`, :attr:`!compare`, :attr:`!metadata`, and :attr:`!kw_only` have " "the identical meaning and values as they do in the :func:`field` function." msgstr "" +":attr:`!default`、:attr:`!default_factory`、:attr:`!init`、:attr:`!repr`、:" +"attr:`!hash`、:attr:`!compare`、:attr:`!metadata`、:attr:`!kw_only` の意味と" +"値は、:func:`field` 関数のものと同じです。" #: ../../library/dataclasses.rst:344 msgid "" @@ -547,7 +696,6 @@ msgstr "" "他の属性があることもありますが、それらはプライベートであり、調べたり、依存し" "たりしてはなりません。" -#: ../../library/dataclasses.rst:349 msgid "" "``InitVar[T]`` type annotations describe variables that are :ref:`init-only " "`. Fields annotated with :class:`!InitVar` " @@ -555,6 +703,13 @@ msgid "" "`fields` function nor used in any way except adding them as parameters to :" "meth:`~object.__init__` and an optional :meth:`__post_init__`." msgstr "" +"``InitVar[T]`` 型アノテーションは、:ref:`初期化限定 ` の変数を記述します。\n" +":class:`!InitVar` でアノテーションされたフィールドは疑似フィールドとみなされ" +"ます。\n" +"そのため、:func:`fields` 関数から返されず、:meth:`~object.__init__` および存" +"在する場合は :meth:`__post_init__` のパラメータとして追加する以外の用途には使" +"われません。" #: ../../library/dataclasses.rst:358 msgid "" @@ -578,11 +733,9 @@ msgid "" "into. Other objects are copied with :func:`copy.deepcopy`." msgstr "" -#: ../../library/dataclasses.rst:371 msgid "Example of using :func:`!asdict` on nested dataclasses::" -msgstr "" +msgstr "入れ子になったデータクラスに :func:`!asdict` を使用する例です。 ::" -#: ../../library/dataclasses.rst:373 msgid "" "@dataclass\n" "class Point:\n" @@ -599,19 +752,32 @@ msgid "" "c = C([Point(0, 0), Point(10, 4)])\n" "assert asdict(c) == {'mylist': [{'x': 0, 'y': 0}, {'x': 10, 'y': 4}]}" msgstr "" +"@dataclass\n" +"class Point:\n" +" x: int\n" +" y: int\n" +"\n" +"@dataclass\n" +"class C:\n" +" mylist: list[Point]\n" +"\n" +"p = Point(10, 20)\n" +"assert asdict(p) == {'x': 10, 'y': 20}\n" +"\n" +"c = C([Point(0, 0), Point(10, 4)])\n" +"assert asdict(c) == {'mylist': [{'x': 0, 'y': 0}, {'x': 10, 'y': 4}]}" -#: ../../library/dataclasses.rst:388 ../../library/dataclasses.rst:408 msgid "To create a shallow copy, the following workaround may be used::" -msgstr "" +msgstr "浅いコピーを作成するには、以下の方法が使えます。 ::" -#: ../../library/dataclasses.rst:390 msgid "{field.name: getattr(obj, field.name) for field in fields(obj)}" -msgstr "" +msgstr "{field.name: getattr(obj, field.name) for field in fields(obj)}" -#: ../../library/dataclasses.rst:392 msgid "" ":func:`!asdict` raises :exc:`TypeError` if *obj* is not a dataclass instance." msgstr "" +"*obj* がデータクラスのインスタンスでない場合、:func:`!asdict` は :exc:" +"`TypeError` を送出します。" #: ../../library/dataclasses.rst:397 msgid "" @@ -625,21 +791,22 @@ msgstr "" msgid "Continuing from the previous example::" msgstr "1つ前の例の続きです::" -#: ../../library/dataclasses.rst:405 msgid "" "assert astuple(p) == (10, 20)\n" "assert astuple(c) == ([(0, 0), (10, 4)],)" msgstr "" +"assert astuple(p) == (10, 20)\n" +"assert astuple(c) == ([(0, 0), (10, 4)],)" -#: ../../library/dataclasses.rst:410 msgid "tuple(getattr(obj, field.name) for field in dataclasses.fields(obj))" -msgstr "" +msgstr "tuple(getattr(obj, field.name) for field in dataclasses.fields(obj))" -#: ../../library/dataclasses.rst:412 msgid "" ":func:`!astuple` raises :exc:`TypeError` if *obj* is not a dataclass " "instance." msgstr "" +"*obj* がデータクラスのインスタンスでない場合、:func:`!astuple` は :exc:" +"`TypeError` を送出します。" #: ../../library/dataclasses.rst:417 msgid "" @@ -653,11 +820,13 @@ msgid "" "`@dataclass `." msgstr "" -#: ../../library/dataclasses.rst:427 msgid "" "If *module* is defined, the :attr:`!__module__` attribute of the dataclass " "is set to that value. By default, it is set to the module name of the caller." msgstr "" +"*module* を指定した場合、データクラスの :attr:`!__module__` 属性はその値に設" +"定されます。\n" +"デフォルトでは、呼び出し元のモジュール名に設定されます。" #: ../../library/dataclasses.rst:431 msgid "" @@ -675,7 +844,6 @@ msgid "" "This function is provided as a convenience. For example::" msgstr "" -#: ../../library/dataclasses.rst:442 msgid "" "C = make_dataclass('C',\n" " [('x', int),\n" @@ -683,12 +851,16 @@ msgid "" " ('z', int, field(default=5))],\n" " namespace={'add_one': lambda self: self.x + 1})" msgstr "" +"C = make_dataclass('C',\n" +" [('x', int),\n" +" 'y',\n" +" ('z', int, field(default=5))],\n" +" namespace={'add_one': lambda self: self.x + 1})" #: ../../library/dataclasses.rst:448 msgid "Is equivalent to::" msgstr "は、次のコードと等しいです::" -#: ../../library/dataclasses.rst:450 msgid "" "@dataclass\n" "class C:\n" @@ -699,38 +871,56 @@ msgid "" " def add_one(self):\n" " return self.x + 1" msgstr "" +"@dataclass\n" +"class C:\n" +" x: int\n" +" y: 'typing.Any'\n" +" z: int = 5\n" +"\n" +" def add_one(self):\n" +" return self.x + 1" -#: ../../library/dataclasses.rst:459 msgid "Added the *decorator* parameter." -msgstr "" +msgstr "*decorator* パラメータを追加しました。" -#: ../../library/dataclasses.rst:464 msgid "" "Creates a new object of the same type as *obj*, replacing fields with values " "from *changes*. If *obj* is not a Data Class, raises :exc:`TypeError`. If " "keys in *changes* are not field names of the given dataclass, raises :exc:" "`TypeError`." msgstr "" +"*obj* と同じ型の新しいオブジェクトを作成し、フィールドを *changes* の値で置き" +"換えます。\n" +"*obj* がデータクラスでない場合は :exc:`TypeError` を送出します。\n" +"*changes* のキーが指定したデータクラスのフィールド名でない場合は :exc:" +"`TypeError` を送出します。" -#: ../../library/dataclasses.rst:469 msgid "" "The newly returned object is created by calling the :meth:`~object.__init__` " "method of the dataclass. This ensures that :meth:`__post_init__`, if " "present, is also called." msgstr "" +"新たに返すオブジェクトは、データクラスの :meth:`~object.__init__` メソッドを" +"呼び出して作成します。\n" +"これにより、:meth:`__post_init__` が存在する場合は、それも確実に呼び出されま" +"す。" -#: ../../library/dataclasses.rst:473 msgid "" "Init-only variables without default values, if any exist, must be specified " "on the call to :func:`!replace` so that they can be passed to :meth:`!" "__init__` and :meth:`__post_init__`." msgstr "" +"デフォルト値を持たない初期化限定変数がある場合は、:meth:`!__init__` と :meth:" +"`__post_init__` に渡せるように、:func:`!replace` の呼び出し時に指定する必要が" +"あります。" -#: ../../library/dataclasses.rst:477 msgid "" "It is an error for *changes* to contain any fields that are defined as " "having ``init=False``. A :exc:`ValueError` will be raised in this case." msgstr "" +"*changes* に ``init=False`` で定義されたフィールドが含まれているとエラーにな" +"ります。\n" +"この場合は :exc:`ValueError` を送出します。" #: ../../library/dataclasses.rst:481 msgid "" @@ -743,11 +933,12 @@ msgid "" "instance copying." msgstr "" -#: ../../library/dataclasses.rst:490 msgid "" "Dataclass instances are also supported by generic function :func:`copy." "replace`." msgstr "" +"データクラスのインスタンスは、汎用関数 :func:`copy.replace` でもサポートされ" +"ています。" #: ../../library/dataclasses.rst:494 msgid "" @@ -765,11 +956,12 @@ msgstr "" "い) かどうかを知る必要がある場合は、 ``not isinstance(obj, type)`` で追加の" "チェックをしてください::" -#: ../../library/dataclasses.rst:501 msgid "" "def is_dataclass_instance(obj):\n" " return is_dataclass(obj) and not isinstance(obj, type)" msgstr "" +"def is_dataclass_instance(obj):\n" +" return is_dataclass(obj) and not isinstance(obj, type)" #: ../../library/dataclasses.rst:506 msgid "A sentinel value signifying a missing default or default_factory." @@ -793,7 +985,6 @@ msgid "" "fields::" msgstr "このサンプルでは ``y`` と ``z`` がキーワード専用フィールドとなります::" -#: ../../library/dataclasses.rst:521 msgid "" "@dataclass\n" "class Point:\n" @@ -804,12 +995,21 @@ msgid "" "\n" "p = Point(0, y=1.5, z=2.0)" msgstr "" +"@dataclass\n" +"class Point:\n" +" x: float\n" +" _: KW_ONLY\n" +" y: float\n" +" z: float\n" +"\n" +"p = Point(0, y=1.5, z=2.0)" -#: ../../library/dataclasses.rst:530 msgid "" "In a single dataclass, it is an error to specify more than one field whose " "type is :const:`!KW_ONLY`." msgstr "" +"単一のデータクラス内で、型が :const:`!KW_ONLY` のフィールドを複数指定するとエ" +"ラーになります。" #: ../../library/dataclasses.rst:537 msgid "" @@ -825,7 +1025,6 @@ msgstr "" msgid "Post-init processing" msgstr "初期化後の処理" -#: ../../library/dataclasses.rst:548 msgid "" "When defined on the class, it will be called by the generated :meth:`~object." "__init__`, normally as :meth:`!self.__post_init__`. However, if any " @@ -834,17 +1033,21 @@ msgid "" "__init__` method is generated, then :meth:`!__post_init__` will not " "automatically be called." msgstr "" +"クラスに定義されている場合、生成された :meth:`~object.__init__` から、通常" +"は :meth:`!self.__post_init__` として呼び出されます。\n" +"ただし、``InitVar`` フィールドが定義されている場合、それらもクラスで定義され" +"た順に :meth:`!__post_init__` に渡されます。\n" +":meth:`!__init__` メソッドが生成されない場合、:meth:`!__post_init__` は自動的" +"には呼び出されません。" -#: ../../library/dataclasses.rst:555 msgid "" "Among other uses, this allows for initializing field values that depend on " "one or more other fields. For example::" msgstr "" -"他の機能と組み合わせることで、他の 1 つ以上のフィールドに依存しているフィール" -"ドが初期化できます。\n" -"例えば次のようにできます::" +"用途の一例として、他の一つ以上のフィールドに依存するフィールドの値を初期化で" +"きます。\n" +"例えば次のようにできます。 ::" -#: ../../library/dataclasses.rst:558 msgid "" "@dataclass\n" "class C:\n" @@ -855,6 +1058,14 @@ msgid "" " def __post_init__(self):\n" " self.c = self.a + self.b" msgstr "" +"@dataclass\n" +"class C:\n" +" a: float\n" +" b: float\n" +" c: float = field(init=False)\n" +"\n" +" def __post_init__(self):\n" +" self.c = self.a + self.b" #: ../../library/dataclasses.rst:567 msgid "" @@ -864,7 +1075,6 @@ msgid "" "call this method in a :meth:`__post_init__` method::" msgstr "" -#: ../../library/dataclasses.rst:572 msgid "" "class Rectangle:\n" " def __init__(self, height, width):\n" @@ -878,13 +1088,26 @@ msgid "" " def __post_init__(self):\n" " super().__init__(self.side, self.side)" msgstr "" +"class Rectangle:\n" +" def __init__(self, height, width):\n" +" self.height = height\n" +" self.width = width\n" +"\n" +"@dataclass\n" +"class Square(Rectangle):\n" +" side: float\n" +"\n" +" def __post_init__(self):\n" +" super().__init__(self.side, self.side)" -#: ../../library/dataclasses.rst:584 msgid "" "Note, however, that in general the dataclass-generated :meth:`!__init__` " "methods don't need to be called, since the derived dataclass will take care " "of initializing all fields of any base class that is a dataclass itself." msgstr "" +"ただし、基底クラス自体がデータクラスであれば、派生データクラスがそのすべての" +"フィールドを初期化するため、一般にデータクラスが生成した :meth:`!__init__` メ" +"ソッドを呼び出す必要はありません。" #: ../../library/dataclasses.rst:588 msgid "" @@ -929,15 +1152,13 @@ msgid "" "dataclasses." msgstr "" -#: ../../library/dataclasses.rst:620 msgid "" "For example, suppose a field will be initialized from a database, if a value " "is not provided when creating the class::" msgstr "" -"例えば、あるフィールドがデータベースから初期化されると仮定して、クラスを作成" -"するときには値が与えられない次の場合を考えます::" +"例えば、インスタンスの作成時に値が渡されなかった場合に、フィールドをデータ" +"ベースから初期化するものとします。 ::" -#: ../../library/dataclasses.rst:623 msgid "" "@dataclass\n" "class C:\n" @@ -951,12 +1172,24 @@ msgid "" "\n" "c = C(10, database=my_database)" msgstr "" +"@dataclass\n" +"class C:\n" +" i: int\n" +" j: int | None = None\n" +" database: InitVar[DatabaseType | None] = None\n" +"\n" +" def __post_init__(self, database):\n" +" if self.j is None and database is not None:\n" +" self.j = database.lookup('j')\n" +"\n" +"c = C(10, database=my_database)" -#: ../../library/dataclasses.rst:635 msgid "" "In this case, :func:`fields` will return :class:`Field` objects for :attr:`!" "i` and :attr:`!j`, but not for :attr:`!database`." msgstr "" +"この場合、:func:`fields` は :attr:`!i` と :attr:`!j` の :class:`Field` オブ" +"ジェクトを返しますが、:attr:`!database` のものは返しません。" #: ../../library/dataclasses.rst:641 msgid "Frozen instances" @@ -971,12 +1204,14 @@ msgid "" "methods will raise a :exc:`FrozenInstanceError` when invoked." msgstr "" -#: ../../library/dataclasses.rst:649 msgid "" "There is a tiny performance penalty when using ``frozen=True``: :meth:" "`~object.__init__` cannot use simple assignment to initialize fields, and " "must use :meth:`!object.__setattr__`." msgstr "" +"``frozen=True`` を使用すると、パフォーマンスがわずかに低下します。\n" +":meth:`~object.__init__` がフィールドの初期化に単純な代入を使えず、:meth:`!" +"object.__setattr__` を使用しなければならないためです。" #: ../../library/dataclasses.rst:658 msgid "Inheritance" @@ -994,7 +1229,6 @@ msgid "" "order, derived classes override base classes. An example::" msgstr "" -#: ../../library/dataclasses.rst:670 msgid "" "@dataclass\n" "class Base:\n" @@ -1006,27 +1240,38 @@ msgid "" " z: int = 10\n" " x: int = 15" msgstr "" +"@dataclass\n" +"class Base:\n" +" x: Any = 15.0\n" +" y: int = 0\n" +"\n" +"@dataclass\n" +"class C(Base):\n" +" z: int = 10\n" +" x: int = 15" -#: ../../library/dataclasses.rst:680 msgid "" "The final list of fields is, in order, :attr:`!x`, :attr:`!y`, :attr:`!z`. " "The final type of :attr:`!x` is :class:`int`, as specified in class :class:`!" "C`." msgstr "" +"最終的なフィールドのリストは、順に :attr:`!x`、:attr:`!y`、:attr:`!z` となり" +"ます。\n" +":attr:`!x` の最終的な型は、クラス :class:`!C` で指定された :class:`int` で" +"す。" -#: ../../library/dataclasses.rst:683 msgid "" "The generated :meth:`~object.__init__` method for :class:`!C` will look " "like::" msgstr "" +":class:`!C` に生成される :meth:`~object.__init__` メソッドは、次のようになり" +"ます。 ::" -#: ../../library/dataclasses.rst:685 msgid "def __init__(self, x: int = 15, y: int = 0, z: int = 10):" -msgstr "" +msgstr "def __init__(self, x: int = 15, y: int = 0, z: int = 10):" -#: ../../library/dataclasses.rst:688 msgid "Re-ordering of keyword-only parameters in :meth:`!__init__`" -msgstr "" +msgstr ":meth:`!__init__` のキーワード専用パラメータの並べ替え" #: ../../library/dataclasses.rst:690 msgid "" @@ -1040,14 +1285,14 @@ msgstr "" "のキーワード専用引数は、非キーワード専用パラメータの末尾にこなければならない" "という、キーワード専用パラメータのPythonの実装の都合で必要なことです。" -#: ../../library/dataclasses.rst:696 msgid "" "In this example, :attr:`!Base.y`, :attr:`!Base.w`, and :attr:`!D.t` are " "keyword-only fields, and :attr:`!Base.x` and :attr:`!D.z` are regular " "fields::" msgstr "" +"この例では、:attr:`!Base.y`、:attr:`!Base.w`、:attr:`!D.t` はキーワード専用" +"フィールドで、:attr:`!Base.x` と :attr:`!D.z` は通常のフィールドです。 ::" -#: ../../library/dataclasses.rst:699 msgid "" "@dataclass\n" "class Base:\n" @@ -1061,49 +1306,62 @@ msgid "" " z: int = 10\n" " t: int = field(kw_only=True, default=0)" msgstr "" +"@dataclass\n" +"class Base:\n" +" x: Any = 15.0\n" +" _: KW_ONLY\n" +" y: int = 0\n" +" w: int = 1\n" +"\n" +"@dataclass\n" +"class D(Base):\n" +" z: int = 10\n" +" t: int = field(kw_only=True, default=0)" -#: ../../library/dataclasses.rst:711 msgid "The generated :meth:`!__init__` method for :class:`!D` will look like::" msgstr "" +":class:`!D` に生成される :meth:`!__init__` メソッドは、次のようになりま" +"す。 ::" -#: ../../library/dataclasses.rst:713 msgid "" "def __init__(self, x: Any = 15.0, z: int = 10, *, y: int = 0, w: int = 1, t: " "int = 0):" msgstr "" +"def __init__(self, x: Any = 15.0, z: int = 10, *, y: int = 0, w: int = 1, t: " +"int = 0):" -#: ../../library/dataclasses.rst:715 msgid "" "Note that the parameters have been re-ordered from how they appear in the " "list of fields: parameters derived from regular fields are followed by " "parameters derived from keyword-only fields." msgstr "" -"パラメータは、フィールドのリストの表示方法によって並べ替えられます。通常の" -"フィールドから派生したパラメータの後に、キーワードのみのフィールドから派生し" -"たパラメータが続きます。" +"引数の順序はフィールドのリストに現れる順序から変更されています。\n" +"通常のフィールドに対応する引数の後に、キーワード専用フィールドに対応する引数" +"が続きます。" -#: ../../library/dataclasses.rst:719 msgid "" "The relative ordering of keyword-only parameters is maintained in the re-" "ordered :meth:`!__init__` parameter list." msgstr "" +"並べ替え後の :meth:`!__init__` のパラメータリストでは、キーワード専用パラメー" +"タ同士の相対的な順序は保持されます。" #: ../../library/dataclasses.rst:724 msgid "Default factory functions" msgstr "デフォルトファクトリ関数" -#: ../../library/dataclasses.rst:726 msgid "" "If a :func:`field` specifies a *default_factory*, it is called with zero " "arguments when a default value for the field is needed. For example, to " "create a new instance of a list, use::" msgstr "" +":func:`field` に *default_factory* が指定されている場合、フィールドのデフォル" +"ト値が必要になると、引数なしで呼び出されます。\n" +"例えば、リストの新しいインスタンスを作成するには、次のようにします。 ::" -#: ../../library/dataclasses.rst:730 msgid "mylist: list = field(default_factory=list)" -msgstr "" +msgstr "mylist: list = field(default_factory=list)" -#: ../../library/dataclasses.rst:732 msgid "" "If a field is excluded from :meth:`~object.__init__` (using ``init=False``) " "and the field also specifies *default_factory*, then the default factory " @@ -1111,6 +1369,10 @@ msgid "" "function. This happens because there is no other way to give the field an " "initial value." msgstr "" +"フィールドが (``init=False`` によって) :meth:`~object.__init__` から除外され" +"ており、そのフィールドに *default_factory* も指定されている場合、生成された :" +"meth:`!__init__` 関数からデフォルトファクトリ関数が常に呼び出されます。\n" +"これは、フィールドに初期値を与える方法が他にないためです。" #: ../../library/dataclasses.rst:739 msgid "Mutable default values" @@ -1124,7 +1386,6 @@ msgstr "" "Python はメンバ変数のデフォルト値をクラス属性に保持します。\n" "データクラスを使っていない、この例を考えてみましょう::" -#: ../../library/dataclasses.rst:744 msgid "" "class C:\n" " x = []\n" @@ -1138,18 +1399,29 @@ msgid "" "assert o1.x == [1, 2]\n" "assert o1.x is o2.x" msgstr "" +"class C:\n" +" x = []\n" +" def add(self, element):\n" +" self.x.append(element)\n" +"\n" +"o1 = C()\n" +"o2 = C()\n" +"o1.add(1)\n" +"o2.add(2)\n" +"assert o1.x == [1, 2]\n" +"assert o1.x is o2.x" -#: ../../library/dataclasses.rst:756 msgid "" "Note that the two instances of class :class:`!C` share the same class " "variable :attr:`!x`, as expected." msgstr "" +"想定どおり、クラス :class:`!C` の 2 つのインスタンスが同じクラス変数 :attr:`!" +"x` を共有していることに注意してください。" #: ../../library/dataclasses.rst:759 msgid "Using dataclasses, *if* this code was valid::" msgstr "データクラスを使っているこのコードが *もし仮に* 有効なものだとしたら::" -#: ../../library/dataclasses.rst:761 msgid "" "@dataclass\n" "class D:\n" @@ -1157,12 +1429,16 @@ msgid "" " def add(self, element):\n" " self.x.append(element)" msgstr "" +"@dataclass\n" +"class D:\n" +" x: list = [] # このコードは ValueError を送出する\n" +" def add(self, element):\n" +" self.x.append(element)" #: ../../library/dataclasses.rst:767 msgid "it would generate code similar to::" msgstr "データクラスは次のようなコードを生成するでしょう::" -#: ../../library/dataclasses.rst:769 msgid "" "class D:\n" " x = []\n" @@ -1173,6 +1449,14 @@ msgid "" "\n" "assert D().x is D().x" msgstr "" +"class D:\n" +" x = []\n" +" def __init__(self, x=x):\n" +" self.x = x\n" +" def add(self, element):\n" +" self.x.append(element)\n" +"\n" +"assert D().x is D().x" #: ../../library/dataclasses.rst:778 msgid "" @@ -1195,7 +1479,6 @@ msgstr "" "デフォルトファクトリ関数を使うのが、フィールドのデフォルト値として可変な型の" "新しいインスタンスを作成する手段です::" -#: ../../library/dataclasses.rst:792 msgid "" "@dataclass\n" "class D:\n" @@ -1203,37 +1486,49 @@ msgid "" "\n" "assert D().x is not D().x" msgstr "" +"@dataclass\n" +"class D:\n" +" x: list = field(default_factory=list)\n" +"\n" +"assert D().x is not D().x" -#: ../../library/dataclasses.rst:798 msgid "" "Instead of looking for and disallowing objects of type :class:`list`, :class:" "`dict`, or :class:`set`, unhashable objects are now not allowed as default " "values. Unhashability is used to approximate mutability." msgstr "" +":class:`list`、:class:`dict`、:class:`set` 型のオブジェクトを検出して禁止する" +"代わりに、ハッシュ不可能なオブジェクトをデフォルト値として禁止するようになり" +"ました。\n" +"ハッシュ不可能かどうかを、可変かどうかの近似的な判定に使用しています。" -#: ../../library/dataclasses.rst:805 msgid "Descriptor-typed fields" -msgstr "" +msgstr "デスクリプタ型のフィールド" -#: ../../library/dataclasses.rst:807 msgid "" "Fields that are assigned :ref:`descriptor objects ` as their " "default value have the following special behaviors:" msgstr "" +"デフォルト値として :ref:`デスクリプタオブジェクト ` が代入された" +"フィールドは、以下のような特別な動作をします:" -#: ../../library/dataclasses.rst:810 msgid "" "The value for the field passed to the dataclass's :meth:`~object.__init__` " "method is passed to the descriptor's :meth:`~object.__set__` method rather " "than overwriting the descriptor object." msgstr "" +"データクラスの :meth:`~object.__init__` メソッドに渡されたフィールドの値は、" +"デスクリプタオブジェクトを上書きするのではなく、デスクリプタの :meth:" +"`~object.__set__` メソッドに渡されます。" -#: ../../library/dataclasses.rst:814 msgid "" "Similarly, when getting or setting the field, the descriptor's :meth:" "`~object.__get__` or :meth:`!__set__` method is called rather than returning " "or overwriting the descriptor object." msgstr "" +"同様に、フィールドを取得または設定すると、デスクリプタオブジェクトを返したり" +"上書きしたりする代わりに、デスクリプタの :meth:`~object.__get__` または :" +"meth:`!__set__` メソッドを呼び出します。" #: ../../library/dataclasses.rst:818 msgid "" @@ -1245,7 +1540,6 @@ msgid "" "in this situation, no default value will be provided for the field." msgstr "" -#: ../../library/dataclasses.rst:828 msgid "" "class IntConversionDescriptor:\n" " def __init__(self, *, default):\n" @@ -1273,10 +1567,37 @@ msgid "" "i.quantity_on_hand = 2.5 # calls __set__ with 2.5\n" "print(i.quantity_on_hand) # 2" msgstr "" +"class IntConversionDescriptor:\n" +" def __init__(self, *, default):\n" +" self._default = default\n" +"\n" +" def __set_name__(self, owner, name):\n" +" self._name = \"_\" + name\n" +"\n" +" def __get__(self, obj, type):\n" +" if obj is None:\n" +" return self._default\n" +"\n" +" return getattr(obj, self._name, self._default)\n" +"\n" +" def __set__(self, obj, value):\n" +" setattr(obj, self._name, int(value))\n" +"\n" +"@dataclass\n" +"class InventoryItem:\n" +" quantity_on_hand: IntConversionDescriptor = " +"IntConversionDescriptor(default=100)\n" +"\n" +"i = InventoryItem()\n" +"print(i.quantity_on_hand) # 100\n" +"i.quantity_on_hand = 2.5 # 2.5 を渡して __set__ を呼び出す\n" +"print(i.quantity_on_hand) # 2" -#: ../../library/dataclasses.rst:853 msgid "" "Note that if a field is annotated with a descriptor type, but is not " "assigned a descriptor object as its default value, the field will act like a " "normal field." msgstr "" +"フィールドにデスクリプタ型のアノテーションが付いていても、デフォルト値として" +"デスクリプタオブジェクトが代入されていなければ、通常のフィールドと同じように" +"動作することに注意してください。" diff --git a/library/datatypes.po b/library/datatypes.po index d16e6da42..dcf63feb2 100644 --- a/library/datatypes.po +++ b/library/datatypes.po @@ -16,10 +16,10 @@ msgstr "" "Last-Translator: tomo, 2021\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/datatypes.rst:5 diff --git a/library/datetime.po b/library/datetime.po index 583bc711f..3845639f0 100644 --- a/library/datetime.po +++ b/library/datetime.po @@ -21,10 +21,10 @@ msgstr "" "Last-Translator: Takanori Suzuki , 2025\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/datetime.rst:2 @@ -158,7 +158,6 @@ msgstr "" "これらの :class:`tzinfo` オブジェクトは UTC 時間からのオフセットやタイムゾー" "ンの名前、夏時間が実施されるかどうかの情報を保持しています。" -#: ../../library/datetime.rst:72 msgid "" "Only one concrete :class:`tzinfo` class, the :class:`timezone` class, is " "supplied by the :mod:`!datetime` module. The :class:`!timezone` class can " @@ -168,14 +167,14 @@ msgid "" "across the world are more political than rational, change frequently, and " "there is no standard suitable for every application aside from UTC." msgstr "" -"ただ一つの具象 :class:`tzinfo` クラスである :class:`timezone` クラスが :mod:" -"`!datetime` モジュールで提供されています。 :class:`!timezone` クラスは、UTCか" -"らのオフセットが固定である単純なタイムゾーン(例えばUTCそれ自体)、および北ア" -"メリカにおける東部標準時(EST)/東部夏時間(EDT)のような単純ではないタイム" -"ゾーンの両方を表現できます。より深く詳細までタイムゾーンをサポートするかはア" -"プリケーションに依存します。世界中の時刻の調整を決めるルールは合理的というよ" -"りかは政治的なもので、頻繁に変わり、UTC を除くと都合のよい基準というものはあ" -"りません。" +":mod:`!datetime` モジュールが提供する具象 :class:`tzinfo` クラスは :class:" +"`timezone` だけです。\n" +":class:`!timezone` クラスは、UTC 自体や北米の EST、EDT など、UTC からのオフ" +"セットが固定された単純なタイムゾーンを表現できます。\n" +"より詳細なタイムゾーンの扱いはアプリケーションに任されています。\n" +"世界各地の時刻調整のルールは合理的というより政治的なもので、頻繁に変更されま" +"す。\n" +"UTC を除けば、あらゆるアプリケーションに適した標準はありません。" #: ../../library/datetime.rst:81 msgid "Constants" @@ -334,6 +333,8 @@ msgstr "" msgid "" "A :class:`.datetime` object ``d`` is aware if both of the following hold:" msgstr "" +"次の条件を両方とも満たす場合、 :class:`.datetime` オブジェクト ``d`` は " +"aware です:" #: ../../library/datetime.rst:185 msgid "``d.tzinfo`` is not ``None``" @@ -345,11 +346,13 @@ msgstr "``d.tzinfo.utcoffset(d)`` が ``None`` を返さない" #: ../../library/datetime.rst:188 msgid "Otherwise, ``d`` is naive." -msgstr "" +msgstr "どちらかを満たさない場合は、 ``d`` は naive です。" #: ../../library/datetime.rst:190 msgid "A :class:`.time` object ``t`` is aware if both of the following hold:" msgstr "" +"次の条件を両方とも満たす場合、 :class:`.time` オブジェクト ``t`` は aware で" +"す:" #: ../../library/datetime.rst:192 msgid "``t.tzinfo`` is not ``None``" @@ -361,7 +364,7 @@ msgstr "``t.tzinfo.utcoffset(None)`` が ``None`` を返さない" #: ../../library/datetime.rst:195 msgid "Otherwise, ``t`` is naive." -msgstr "" +msgstr "どちらかを満たさない場合は、 ``t`` は naive です。" #: ../../library/datetime.rst:197 msgid "" @@ -461,7 +464,6 @@ msgid "" "datetime.timedelta(days=64, seconds=29156, microseconds=10)" msgstr "" -#: ../../library/datetime.rst:246 msgid "" "If any argument is a float and there are fractional microseconds, the " "fractional microseconds left over from all arguments are combined and their " @@ -469,10 +471,11 @@ msgid "" "tiebreaker. If no argument is a float, the conversion and normalization " "processes are exact (no information is lost)." msgstr "" -"引数のいずれかが浮動小数点であり、小数のマイクロ秒が存在する場合、小数のマイ" -"クロ秒は全ての引数から一度取り置かれ、それらの和は最近接偶数のマイクロ秒に丸" -"められます。浮動小数点の引数がない場合、値の変換と正規化の過程は厳密な (失わ" -"れる情報がない) ものとなります。" +"引数に浮動小数点数があり、マイクロ秒未満の端数が生じる場合は、すべての引数の" +"端数を合計し、最も近いマイクロ秒に丸めます。\n" +"ちょうど中間の値は偶数側に丸めます。\n" +"浮動小数点数の引数がなければ、変換と正規化は厳密に行われ、情報は失われませ" +"ん。" #: ../../library/datetime.rst:253 msgid "" @@ -496,13 +499,13 @@ msgid "" "(-1, 86399, 999999)" msgstr "" -#: ../../library/datetime.rst:264 msgid "" "Since the string representation of :class:`!timedelta` objects can be " "confusing, use the following recipe to produce a more readable format:" msgstr "" +":class:`!timedelta` オブジェクトの文字列表現は分かりにくいことがあるため、以" +"下のレシピで読みやすい形式にできます:" -#: ../../library/datetime.rst:267 msgid "" ">>> def pretty_timedelta(td):\n" "... if td.days >= 0:\n" @@ -515,6 +518,16 @@ msgid "" ">>> pretty_timedelta(d)\n" "'-(1:00:00)'" msgstr "" +">>> def pretty_timedelta(td):\n" +"... if td.days >= 0:\n" +"... return str(td)\n" +"... return f'-({-td!s})'\n" +"...\n" +">>> d = timedelta(hours=-1)\n" +">>> str(d) # 人には分かりにくい\n" +"'-1 day, 23:00:00'\n" +">>> pretty_timedelta(d)\n" +"'-(1:00:00)'" #: ../../library/datetime.rst:281 ../../library/datetime.rst:615 #: ../../library/datetime.rst:1175 ../../library/datetime.rst:1813 @@ -562,18 +575,19 @@ msgstr "インスタンスの属性 (読み出しのみ):" #: ../../library/datetime.rst:307 msgid "Between -999,999,999 and 999,999,999 inclusive." -msgstr "" +msgstr "両端値を含む-999,999,999 から 999,999,999 の間" #: ../../library/datetime.rst:312 msgid "Between 0 and 86,399 inclusive." -msgstr "" +msgstr "両端値を含む 0 から 86,399 の間" -#: ../../library/datetime.rst:316 msgid "" "It is a somewhat common bug for code to unintentionally use this attribute " "when it is actually intended to get a :meth:`~timedelta.total_seconds` value " "instead:" msgstr "" +"本来は :meth:`~timedelta.total_seconds` の値を取得するつもりで、誤ってこの属" +"性を使用してしまうバグは比較的よくあります:" #: ../../library/datetime.rst:320 msgid "" @@ -587,7 +601,7 @@ msgstr "" #: ../../library/datetime.rst:331 msgid "Between 0 and 999,999 inclusive." -msgstr "" +msgstr "両端値を含む 0 から 999,999 の間" #: ../../library/datetime.rst:334 ../../library/datetime.rst:650 #: ../../library/datetime.rst:1248 @@ -708,6 +722,8 @@ msgid "" "Computes the quotient and the remainder: ``q = t1 // t2`` (3) and ``r = t1 % " "t2``. ``q`` is an integer and ``r`` is a :class:`timedelta` object." msgstr "" +"商と剰余が計算されます: ``q = t1 // t2`` (3) と ``r = t1 % t2`` 。``q`` は整" +"数で ``r`` は :class:`timedelta` オブジェクトです。" #: ../../library/datetime.rst:380 msgid "``+t1``" @@ -726,6 +742,8 @@ msgid "" "Equivalent to ``timedelta(-t1.days, -t1.seconds, -t1.microseconds)``, and to " "``t1 * -1``. (1)(4)" msgstr "" +"``timedelta(-t1.days, -t1.seconds, -t1.microseconds)``、および ``t1 * -1`` と" +"同じです。 (1)(4)" #: ../../library/datetime.rst:387 msgid "``abs(t)``" @@ -795,13 +813,16 @@ msgstr "" ":class:`timedelta` オブジェクトの文字列表現は内部表現に類似した形に正規化され" "ます。そのため負の timedelta は少し変な結果になります。例えば::" -#: ../../library/datetime.rst:419 msgid "" ">>> timedelta(hours=-5)\n" "datetime.timedelta(days=-1, seconds=68400)\n" ">>> print(_)\n" "-1 day, 19:00:00" msgstr "" +">>> timedelta(hours=-5)\n" +"datetime.timedelta(days=-1, seconds=68400)\n" +">>> print(_)\n" +"-1 day, 19:00:00" #: ../../library/datetime.rst:425 msgid "" @@ -959,9 +980,8 @@ msgid "" "If an argument outside those ranges is given, :exc:`ValueError` is raised." msgstr "範囲を超えた引数を与えた場合、 :exc:`ValueError` が送出されます。" -#: ../../library/datetime.rst:512 ../../library/datetime.rst:937 msgid "Other constructors, all class methods:" -msgstr "他のコンストラクタ、および全てのクラスメソッドを以下に示します:" +msgstr "その他のコンストラクタ (すべてクラスメソッド):" #: ../../library/datetime.rst:516 msgid "Return the current local date." @@ -1020,6 +1040,10 @@ msgid "" ":exc:`ValueError` is raised unless ``1 <= ordinal <= date.max.toordinal()``. " "For any date ``d``, ``date.fromordinal(d.toordinal()) == d``." msgstr "" +"``1 <= ordinal <= date.max.toordinal()`` でない場合、 :exc:`ValueError` が送" +"出されます。\n" +"任意の日付 ``d`` に対し、 ``date.fromordinal(d.toordinal()) == d`` となりま" +"す。" #: ../../library/datetime.rst:551 msgid "" @@ -1074,15 +1098,17 @@ msgstr "" "年月日で指定された ISO 暦の日付に対応する :class:`date` を返します。\n" "この関数は :meth:`date.isocalendar` 関数の逆関数です。" -#: ../../library/datetime.rst:583 msgid "" "Return a :class:`.date` corresponding to *date_string*, parsed according to " "*format*. This is equivalent to::" msgstr "" +"*format* に従って *date_string* を解析し、対応する :class:`.date` を返しま" +"す。\n" +"次の式と等価です。 ::" #: ../../library/datetime.rst:586 msgid "date(*(time.strptime(date_string, format)[0:3]))" -msgstr "" +msgstr "date(*(time.strptime(date_string, format)[0:3]))" #: ../../library/datetime.rst:588 msgid "" @@ -1090,6 +1116,10 @@ msgid "" "by :func:`time.strptime` or if it returns a value which isn't a time tuple. " "See also :ref:`strftime-strptime-behavior` and :meth:`date.fromisoformat`." msgstr "" +"date_string と format が :func:`time.strptime` で構文解析できない場合や、この" +"関数が時刻タプルを返してこない場合には :exc:`ValueError` を送出します。:ref:" +"`strftime-strptime-behavior` および :meth:`date.fromisoformat` も参照してくだ" +"さい。" #: ../../library/datetime.rst:595 msgid "" @@ -1195,7 +1225,6 @@ msgstr "``date1 >= date2``" msgid "Order comparison. (5)" msgstr "順序の比較。(5)" -#: ../../library/datetime.rst:675 msgid "" "*date2* is moved forward in time if ``timedelta.days > 0``, or backward if " "``timedelta.days < 0``. Afterward ``date2 - date1 == timedelta.days``. " @@ -1207,7 +1236,7 @@ msgstr "" "0`` の場合は戻る方向に移動します。\n" "演算後は ``date2 - date1 == timedelta.days`` が成立します。\n" "``timedelta.seconds`` および ``timedelta.microseconds`` は無視されます。\n" -"``date2.year`` が :const:`MINYEAR` になってしまったり、 :const:`MAXYEAR` より" +"``date2.year`` が :const:`MINYEAR` より小さくなったり、 :const:`MAXYEAR` より" "大きくなってしまう場合には :exc:`OverflowError` が送出されます。" #: ../../library/datetime.rst:682 @@ -1237,12 +1266,15 @@ msgstr "" "日を表していても、:class:`!datetime` オブジェクトとは決して等価にはなりませ" "ん。" -#: ../../library/datetime.rst:696 msgid "" "*date1* is considered less than *date2* when *date1* precedes *date2* in " "time. In other words, ``date1 < date2`` if and only if ``date1.toordinal() < " "date2.toordinal()``." msgstr "" +"*date1* が時間的に *date2* より前にある場合、*date1* は *date2* より小さいと" +"みなされます。\n" +"言い換えると、``date1.toordinal() < date2.toordinal()`` の場合に限り ``date1 " +"< date2`` となります。" #: ../../library/datetime.rst:700 msgid "" @@ -1259,18 +1291,17 @@ msgid "" "in subclasses." msgstr "" -#: ../../library/datetime.rst:712 msgid "" "In Boolean contexts, all :class:`date` objects are considered to be true." msgstr "" -"ブール演算コンテキストでは、全ての :class:`.time` オブジェクトは真とみなされ" -"ます。" +"ブール値の文脈では、すべての :class:`date` オブジェクトは真とみなされます。" -#: ../../library/datetime.rst:718 msgid "" "Return a new :class:`date` object with the same values, but with specified " "parameters updated." msgstr "" +"指定したパラメータだけを更新し、それ以外は同じ値を持つ新しい :class:`date` オ" +"ブジェクトを返します。" #: ../../library/datetime.rst:721 ../../library/datetime.rst:2002 msgid "Example::" @@ -1284,11 +1315,12 @@ msgid "" "datetime.date(2002, 12, 26)" msgstr "" -#: ../../library/datetime.rst:728 msgid "" "The generic function :func:`copy.replace` also supports :class:`date` " "objects." msgstr "" +"汎用関数 :func:`copy.replace` も :class:`date` オブジェクトをサポートしていま" +"す。" #: ../../library/datetime.rst:734 ../../library/datetime.rst:1454 msgid "" @@ -1305,10 +1337,10 @@ msgstr "時分秒が 0 で、 DST フラグが -1 です。" msgid "``d.timetuple()`` is equivalent to::" msgstr "``d.timetuple()`` は次の式と等価です::" -#: ../../library/datetime.rst:740 msgid "" "time.struct_time((d.year, d.month, d.day, 0, 0, 0, d.weekday(), yday, -1))" msgstr "" +"time.struct_time((d.year, d.month, d.day, 0, 0, 0, d.weekday(), yday, -1))" #: ../../library/datetime.rst:742 msgid "" @@ -1324,6 +1356,9 @@ msgid "" "1 has ordinal 1. For any :class:`date` object ``d``, ``date.fromordinal(d." "toordinal()) == d``." msgstr "" +"先発グレゴリオ暦における日付序数を返します。 1 年の 1 月 1 日が序数 1 となり" +"ます。任意の :class:`date` オブジェクト ``d`` について、 ``date." +"fromordinal(d.toordinal()) == d`` となります。" #: ../../library/datetime.rst:755 msgid "" @@ -1407,6 +1442,8 @@ msgstr "" #: ../../library/datetime.rst:801 msgid "For a date ``d``, ``str(d)`` is equivalent to ``d.isoformat()``." msgstr "" +"``date`` オブジェクト ``d`` において、``str(d)`` は ``d.isoformat()`` と等価" +"です。" #: ../../library/datetime.rst:806 msgid "Return a string representing the date::" @@ -1423,9 +1460,8 @@ msgstr "" msgid "``d.ctime()`` is equivalent to::" msgstr "``d.ctime()`` は次の式と等価です::" -#: ../../library/datetime.rst:814 ../../library/datetime.rst:1642 msgid "time.ctime(time.mktime(d.timetuple()))" -msgstr "" +msgstr "time.ctime(time.mktime(d.timetuple()))" #: ../../library/datetime.rst:816 msgid "" @@ -1622,9 +1658,8 @@ msgstr "" msgid "Equivalent to::" msgstr "次と等価です::" -#: ../../library/datetime.rst:945 msgid "datetime.fromtimestamp(time.time())" -msgstr "" +msgstr "datetime.fromtimestamp(time.time())" #: ../../library/datetime.rst:947 msgid "See also :meth:`now`, :meth:`fromtimestamp`." @@ -1641,18 +1676,18 @@ msgstr "" msgid "Return the current local date and time." msgstr "現在のローカルな日時を返します。" -#: ../../library/datetime.rst:956 msgid "" "If optional argument *tz* is ``None`` or not specified, this is like :meth:" "`today`, but, if possible, supplies more precision than can be gotten from " "going through a :func:`time.time` timestamp (for example, this may be " "possible on platforms supplying the C :c:func:`gettimeofday` function)." msgstr "" -"オプションの引数 *tz* が ``None`` であるか指定されていない場合、このメソッド" -"は :meth:`today` と同様ですが、可能ならば :func:`time.time` タイムスタンプを" -"通じて得ることができる、より高い精度で時刻を提供します (例えば、プラット" -"フォームが C 関数 :c:func:`gettimeofday` をサポートする場合には可能なことが" -"あります)。" +"省略可能な引数 *tz* が ``None`` または未指定の場合、このメソッドは :meth:" +"`today` と同様に動作します。\n" +"ただし可能であれば、:func:`time.time` のタイムスタンプ経由で得られる精度より" +"も高い精度で時刻を返します\n" +"(例えば、C 関数 :c:func:`gettimeofday` を提供するプラットフォームでは可能な場" +"合があります)。" #: ../../library/datetime.rst:962 msgid "" @@ -1668,11 +1703,12 @@ msgid "This function is preferred over :meth:`today` and :meth:`utcnow`." msgstr "" ":meth:`today` および :meth:`utcnow` よりもこの関数を使う方が好ましいです。" -#: ../../library/datetime.rst:969 msgid "" "Subsequent calls to :meth:`!datetime.now` may return the same instant " "depending on the precision of the underlying clock." msgstr "" +"基盤となる時計の精度によっては、:meth:`!datetime.now` を続けて呼び出しても同" +"じ時点を返すことがあります。" #: ../../library/datetime.rst:974 msgid "Return the current UTC date and time, with :attr:`.tzinfo` ``None``." @@ -1704,9 +1740,9 @@ msgstr "" "そのため、 UTC での現在の時刻を表すオブジェクトの作成では ``datetime." "now(timezone.utc)`` を呼び出す方法が推奨されます。" -#: ../../library/datetime.rst:989 msgid "Use :meth:`datetime.now` with :const:`UTC` instead." msgstr "" +"代わりに :const:`UTC` を指定して :meth:`datetime.now` を使用してください。" #: ../../library/datetime.rst:994 msgid "" @@ -1765,10 +1801,10 @@ msgstr "" "くは :c:func:`gmtime` の呼び出し失敗で :exc:`ValueError` ではなく :exc:" "`OSError` を送出するようになりました。" -#: ../../library/datetime.rst:1020 msgid ":meth:`fromtimestamp` may return instances with :attr:`.fold` set to 1." msgstr "" -":meth:`fromtimestamp` は :attr:`.fold` を1にしてインスタンスを返します。" +":meth:`fromtimestamp` は :attr:`.fold` が 1 に設定されたインスタンスを返すこ" +"とがあります。" #: ../../library/datetime.rst:1025 msgid "" @@ -1778,16 +1814,15 @@ msgstr "" "POSIX タイムスタンプに対応する、:attr:`tzinfo` が ``None`` の UTC での :" "class:`.datetime` を返します。(返されるオブジェクトは naive です。)" -#: ../../library/datetime.rst:1028 msgid "" "This may raise :exc:`OverflowError`, if the timestamp is out of the range of " "values supported by the platform C :c:func:`gmtime` function, and :exc:" "`OSError` on :c:func:`gmtime` failure. It's common for this to be restricted " "to years in 1970 through 2038." msgstr "" -"タイムスタンプがプラットフォームにおける C 関数 :c:func:`localtime` でサポー" -"トされている範囲を超えている場合には :exc:`OverflowError` を、:c:func:" -"`gmtime` が失敗した場合には :exc:`OSError` を送出します。\n" +"タイムスタンプがプラットフォームにおける C 関数 :c:func:`gmtime` でサポートさ" +"れている範囲を超えている場合には :exc:`OverflowError` を、:c:func:`gmtime` が" +"失敗した場合には :exc:`OSError` を送出します。\n" "これはたいてい 1970 年から 2038 年に制限されています。" #: ../../library/datetime.rst:1033 @@ -1796,9 +1831,8 @@ msgstr "" "aware な :class:`.datetime` オブジェクトを得るには :meth:`fromtimestamp` を呼" "んでください::" -#: ../../library/datetime.rst:1035 msgid "datetime.fromtimestamp(timestamp, timezone.utc)" -msgstr "" +msgstr "datetime.fromtimestamp(timestamp, timezone.utc)" #: ../../library/datetime.rst:1037 msgid "" @@ -1806,18 +1840,17 @@ msgid "" "expression::" msgstr "POSIX 互換プラットフォームでは、これは以下の表現と等価です::" -#: ../../library/datetime.rst:1040 msgid "" "datetime(1970, 1, 1, tzinfo=timezone.utc) + timedelta(seconds=timestamp)" msgstr "" +"datetime(1970, 1, 1, tzinfo=timezone.utc) + timedelta(seconds=timestamp)" -#: ../../library/datetime.rst:1042 msgid "" "except the latter formula always supports the full years range: between :" "const:`MINYEAR` and :const:`MAXYEAR` inclusive." msgstr "" -"後者を除き、式は常に年の全範囲 (:const:`MINYEAR` から :const:`MAXYEAR` を含み" -"ます) をサポートします。" +"ただし、後者の式は常に年の全範囲 (:const:`MINYEAR` から :const:`MAXYEAR` ま" +"で、両端を含む) をサポートするという違いがあります。" #: ../../library/datetime.rst:1047 msgid "" @@ -1846,9 +1879,10 @@ msgstr "" "るようになりました。 :c:func:`gmtime` の呼び出し失敗で :exc:`ValueError` では" "なく :exc:`OSError` を送出するようになりました。" -#: ../../library/datetime.rst:1061 msgid "Use :meth:`datetime.fromtimestamp` with :const:`UTC` instead." msgstr "" +"代わりに :const:`UTC` を指定して :meth:`datetime.fromtimestamp` を使用してく" +"ださい。" #: ../../library/datetime.rst:1066 msgid "" @@ -1883,11 +1917,12 @@ msgstr "" "使われます。*date* 引数に :class:`.datetime` オブジェクトが与えられた場合、そ" "の時刻部分と :attr:`.tzinfo` 属性は無視されます。" -#: ../../library/datetime.rst:1082 msgid "" "For any :class:`.datetime` object ``d``, ``d == datetime.combine(d.date(), d." "time(), d.tzinfo)``." msgstr "" +"任意の :class:`.datetime` オブジェクト ``d`` について、``d == datetime." +"combine(d.date(), d.time(), d.tzinfo)`` となります。" #: ../../library/datetime.rst:1085 msgid "Added the *tzinfo* argument." @@ -1938,11 +1973,12 @@ msgid "" " tzinfo=datetime.timezone(datetime.timedelta(seconds=14400)))" msgstr "" -#: ../../library/datetime.rst:1127 msgid "" "Previously, this method only supported formats that could be emitted by :" "meth:`date.isoformat` or :meth:`datetime.isoformat`." msgstr "" +"以前は、このメソッドは :meth:`date.isoformat` または :meth:`datetime." +"isoformat` が出力できる形式だけをサポートしていました。" #: ../../library/datetime.rst:1134 msgid "" @@ -1970,9 +2006,8 @@ msgid "" msgstr "" "*format* がマイクロ秒やタイムゾーン情報を含まない場合は、以下と等価です::" -#: ../../library/datetime.rst:1148 ../../library/datetime.rst:2643 msgid "datetime(*(time.strptime(date_string, format)[0:6]))" -msgstr "" +msgstr "datetime(*(time.strptime(date_string, format)[0:6]))" #: ../../library/datetime.rst:1150 msgid "" @@ -2156,15 +2191,17 @@ msgstr "" "あるか、両方とも aware である場合にのみ定義されています。片方が aware でもう" "一方が naive の場合、 :exc:`TypeError` が送出されます。" -#: ../../library/datetime.rst:1287 msgid "" "If both are naive, or both are aware and have the same :attr:`~.datetime." "tzinfo` attribute, the :attr:`~.datetime.tzinfo` attributes are ignored, and " "the result is a :class:`timedelta` object ``t`` such that ``datetime2 + t == " "datetime1``. No time zone adjustments are done in this case." msgstr "" +"両方が naive の場合、または両方が aware で同じ :attr:`~.datetime.tzinfo` 属性" +"を持つ場合、:attr:`~.datetime.tzinfo` 属性は無視され、結果は ``datetime2 + t " +"== datetime1`` を満たす :class:`timedelta` オブジェクト ``t`` となります。\n" +"この場合、タイムゾーンの調整は行われません。" -#: ../../library/datetime.rst:1292 msgid "" "If both are aware and have different :attr:`~.datetime.tzinfo` attributes, " "``a-b`` acts as if ``a`` and ``b`` were first converted to naive UTC " @@ -2172,6 +2209,11 @@ msgid "" "replace(tzinfo=None) - b.utcoffset())`` except that the implementation never " "overflows." msgstr "" +"両方が aware で異なる :attr:`~.datetime.tzinfo` 属性を持つ場合、``a-b`` は、" +"先に ``a`` と ``b`` を naive な UTC の日時に変換したかのように動作します。\n" +"結果は ``(a.replace(tzinfo=None) - a.utcoffset()) - (b.replace(tzinfo=None) " +"- b.utcoffset())`` となりますが、実装ではオーバーフローが起きない点が異なりま" +"す。" #: ../../library/datetime.rst:1298 msgid "" @@ -2204,13 +2246,13 @@ msgstr "" "タイムゾーンを考慮して、*datetime1* が時刻として *datetime2* よりも前を表す場" "合に、*datetime1* は *datetime2* よりも小さいと見なされます。" -#: ../../library/datetime.rst:1316 msgid "" "Order comparison between naive and aware :class:`.datetime` objects raises :" "exc:`TypeError`." msgstr "" +"naive な :class:`.datetime` オブジェクトと aware なものの順序比較は、:exc:" +"`TypeError` を送出します。" -#: ../../library/datetime.rst:1319 msgid "" "If both comparands are aware, and have the same :attr:`!tzinfo` attribute, " "the :attr:`!tzinfo` and :attr:`~.datetime.fold` attributes are ignored and " @@ -2219,14 +2261,19 @@ msgid "" "comparands were first converted to UTC datetimes except that the " "implementation never overflows." msgstr "" +"比較対象が両方とも aware で同じ :attr:`!tzinfo` 属性を持つ場合、:attr:`!" +"tzinfo` と :attr:`~.datetime.fold` 属性を無視して、元の日時を比較します。\n" +"比較対象が両方とも aware で異なる :attr:`~.datetime.tzinfo` 属性を持つ場合、" +"先に UTC の日時に変換したかのように比較しますが、実装ではオーバーフローが起き" +"ない点が異なります。" #: ../../library/datetime.rst:1326 msgid "" "Equality comparisons between aware and naive :class:`.datetime` instances " "don't raise :exc:`TypeError`." msgstr "" -"aware な :class:`datetime` インスタンスと naive な :class:`datetime` インスタ" -"ンスの等価比較では :exc:`TypeError` は送出されません。" +"aware な :class:`datetime` インスタンスと naive な ``datetime`` インスタンス" +"の等価比較では :exc:`TypeError` は送出されません。" #: ../../library/datetime.rst:1342 msgid "Return :class:`date` object with same year, month and day." @@ -2253,13 +2300,16 @@ msgstr "" "同じhour、minute、second、microsecond、fold および tzinfo 属性を持つ :class:" "`.time` オブジェクトを返します。 :meth:`time` メソッドも参照してください。" -#: ../../library/datetime.rst:1367 msgid "" "Return a new :class:`datetime` object with the same attributes, but with " "specified parameters updated. Note that ``tzinfo=None`` can be specified to " "create a naive datetime from an aware datetime with no conversion of date " "and time data." msgstr "" +"指定したパラメータだけを更新し、それ以外は同じ属性を持つ新しい :class:" +"`datetime` オブジェクトを返します。\n" +"``tzinfo=None`` を指定すると、日付と時刻のデータを変換せずに、aware な日時か" +"ら naive な日時を作成できます。" #: ../../library/datetime.rst:1372 msgid "" @@ -2280,7 +2330,6 @@ msgstr "" "日付および時刻データを調整して、返り値が *self* と同じ UTC 時刻を持ち、 *tz* " "におけるローカルな時刻を表すようにします。" -#: ../../library/datetime.rst:1385 msgid "" "If provided, *tz* must be an instance of a :class:`tzinfo` subclass, and " "its :meth:`utcoffset` and :meth:`dst` methods must not return ``None``. If " @@ -2288,8 +2337,9 @@ msgid "" msgstr "" "もし与えられた場合、 *tz* は :class:`tzinfo` のサブクラスのインスタンスでなけ" "ればならず、 インスタンスの :meth:`utcoffset` および :meth:`dst` メソッドは " -"``None`` を返してはなりません。もし *self* が naive ならば、おそらくシステム" -"のタイムゾーンで時間を表現します。" +"``None`` を返してはなりません。\n" +"*self* が naive の場合は、システムのタイムゾーンの時刻を表すものとして扱われ" +"ます。" #: ../../library/datetime.rst:1389 msgid "" @@ -2326,12 +2376,11 @@ msgid "" "object from an aware datetime *dt* without conversion of date and time data, " "use ``dt.replace(tzinfo=None)``." msgstr "" -"単に :class:`timezone` オブジェクト *tz* を :class:`datetime` オブジェクト " -"*dt* に追加したいだけで、日付や時刻データへの調整を行わないのなら、``dt." -"replace(tzinfo=tz)`` を使ってください。単に aware な :class:`datetime` オブ" -"ジェクト *dt* から :class:`!timezone` オブジェクトを除去したいだけで、日付や" -"時刻データの変換を行わないのなら、``dt.replace(tzinfo=None)`` を使ってくださ" -"い。" +"単に :class:`timezone` オブジェクト *tz* を ``datetime`` オブジェクト *dt* に" +"追加したいだけで、日付や時刻データへの調整を行わないのなら、``dt." +"replace(tzinfo=tz)`` を使ってください。単に aware な ``datetime`` オブジェク" +"ト *dt* から :class:`!timezone` オブジェクトを除去したいだけで、日付や時刻" +"データの変換を行わないのなら、``dt.replace(tzinfo=None)`` を使ってください。" #: ../../library/datetime.rst:1405 msgid "" @@ -2343,7 +2392,6 @@ msgstr "" "上書きして, :meth:`astimezone` が返す結果に影響を及ぼすことができます。エラー" "の場合を無視すると、 :meth:`astimezone` は以下のように動作します::" -#: ../../library/datetime.rst:1409 msgid "" "def astimezone(self, tz):\n" " if self.tzinfo is tz:\n" @@ -2353,6 +2401,13 @@ msgid "" " # Convert from UTC to tz's local time.\n" " return tz.fromutc(utc)" msgstr "" +"def astimezone(self, tz):\n" +" if self.tzinfo is tz:\n" +" return self\n" +" # self を UTC に変換し、新しい timezone オブジェクトを設定する。\n" +" utc = (self - self.utcoffset()).replace(tzinfo=tz)\n" +" # UTC から tz のローカル時刻に変換する。\n" +" return tz.fromutc(utc)" #: ../../library/datetime.rst:1417 msgid "*tz* now can be omitted." @@ -2367,7 +2422,6 @@ msgstr "" "呼び出せるようになりました。これは、システムのローカルな時間を表現していると" "想定されます。" -#: ../../library/datetime.rst:1427 msgid "" "If :attr:`.tzinfo` is ``None``, returns ``None``, else returns ``self.tzinfo." "utcoffset(self)``, and raises an exception if the latter doesn't return " @@ -2375,7 +2429,7 @@ msgid "" msgstr "" ":attr:`.tzinfo` が ``None`` の場合、 ``None`` を返し、そうでない場合には " "``self.tzinfo.utcoffset(self)`` を返します。\n" -"後者の式が ``None`` あるいは 1 日以下の大きさを持つ :class:`timedelta` オブ" +"後者の式が ``None`` あるいは 1 日未満の大きさを持つ :class:`timedelta` オブ" "ジェクトのいずれかを返さない場合には例外を送出します。" #: ../../library/datetime.rst:1431 ../../library/datetime.rst:2042 @@ -2411,12 +2465,14 @@ msgstr "" "後者の式が ``None`` か文字列オブジェクトのいずれかを返さない場合には例外を送" "出します。" -#: ../../library/datetime.rst:1458 msgid "" "time.struct_time((d.year, d.month, d.day,\n" " d.hour, d.minute, d.second,\n" " d.weekday(), yday, dst))" msgstr "" +"time.struct_time((d.year, d.month, d.day,\n" +" d.hour, d.minute, d.second,\n" +" d.weekday(), yday, dst))" #: ../../library/datetime.rst:1462 msgid "" @@ -2436,15 +2492,17 @@ msgstr "" "場合、 :meth:`dst` がゼロでない値を返すと :attr:`!tm_isdst` は1となります; そ" "れ以外の場合には :attr:`!tm_isdst` は0に設定されます。" -#: ../../library/datetime.rst:1473 msgid "" "If :class:`.datetime` instance ``d`` is naive, this is the same as ``d." "timetuple()`` except that :attr:`~.time.struct_time.tm_isdst` is forced to 0 " "regardless of what ``d.dst()`` returns. DST is never in effect for a UTC " "time." msgstr "" +":class:`.datetime` インスタンス ``d`` が naive の場合、``d.dst()`` の返り値に" +"関係なく :attr:`~.time.struct_time.tm_isdst` が強制的に 0 になる点を除き、" +"``d.timetuple()`` と同じです。\n" +"UTC 時刻に DST が適用されることはありません。" -#: ../../library/datetime.rst:1477 msgid "" "If ``d`` is aware, ``d`` is normalized to UTC time, by subtracting ``d." "utcoffset()``, and a :class:`time.struct_time` for the normalized time is " @@ -2452,8 +2510,12 @@ msgid "" "`OverflowError` may be raised if ``d.year`` was ``MINYEAR`` or ``MAXYEAR`` " "and UTC adjustment spills over a year boundary." msgstr "" +"``d`` が aware の場合、``d.utcoffset()`` を引いて ``d`` を UTC 時刻に正規化" +"し、その時刻の :class:`time.struct_time` を返します。\n" +":attr:`!tm_isdst` は強制的に 0 になります。\n" +"``d.year`` が ``MINYEAR`` または ``MAXYEAR`` で、UTC への調整が年の境界を越え" +"る場合、:exc:`OverflowError` を送出することがあります。" -#: ../../library/datetime.rst:1486 msgid "" "Because naive ``datetime`` objects are treated by many ``datetime`` methods " "as local times, it is preferred to use aware datetimes to represent times in " @@ -2464,11 +2526,12 @@ msgid "" msgstr "" "naive な ``datetime`` オブジェクトは多くの ``datetime`` メソッドでローカルな" "時間として扱われるため、 aware な datetime を使って UTC の時刻を表すのが好ま" -"しいです。結果として、 :meth:`datetime.utctimetuple` は誤解を招きやすい返り値" -"を返すかもしれません。\n" -"UTC を表す naive な ``datetime`` があった場合、 :meth:`.datetime.timetuple` " -"が使えるところでは ``datetime.replace(tzinfo=timezone.utc)`` で aware にしま" -"す。" +"しいです。\n" +"結果として、 :meth:`datetime.utctimetuple` は誤解を招きやすい返り値を返すかも" +"しれません。\n" +"UTC を表す naive な ``datetime`` があった場合、 ``datetime." +"replace(tzinfo=timezone.utc)`` で aware にしてから :meth:`.datetime." +"timetuple` を使えます。" #: ../../library/datetime.rst:1495 msgid "" @@ -2478,14 +2541,13 @@ msgstr "" "先発グレゴリオ暦における日付序数を返します。``self.date().toordinal()`` と同" "じです。" -#: ../../library/datetime.rst:1500 msgid "" "Return POSIX timestamp corresponding to the :class:`.datetime` instance. The " "return value is a :class:`float` similar to that returned by :func:`time." "time`." msgstr "" ":class:`.datetime` インスタンスに対応する POSIX タイムスタンプを返します。\n" -"返り値は :func:`time.time` で返される値に近い :class:`float` です。" +":func:`time.time` の返り値と同様に、返り値は :class:`float` です。" #: ../../library/datetime.rst:1504 msgid "" @@ -2509,9 +2571,8 @@ msgstr "" "aware な :class:`.datetime` インスタンスに対しては以下のように返り値が計算さ" "れます::" -#: ../../library/datetime.rst:1514 msgid "(dt - datetime(1970, 1, 1, tzinfo=timezone.utc)).total_seconds()" -msgstr "" +msgstr "(dt - datetime(1970, 1, 1, tzinfo=timezone.utc)).total_seconds()" #: ../../library/datetime.rst:1518 msgid "" @@ -2534,17 +2595,15 @@ msgstr "" "れていなかった場合、 ``tzinfo=timezone.utc`` を引数に与えることで POSIX タイ" "ムスタンプを取得できます::" -#: ../../library/datetime.rst:1530 msgid "timestamp = dt.replace(tzinfo=timezone.utc).timestamp()" -msgstr "" +msgstr "timestamp = dt.replace(tzinfo=timezone.utc).timestamp()" #: ../../library/datetime.rst:1532 msgid "or by calculating the timestamp directly::" msgstr "もしくは直接タイムスタンプを計算することもできます::" -#: ../../library/datetime.rst:1534 msgid "timestamp = (dt - datetime(1970, 1, 1)) / timedelta(seconds=1)" -msgstr "" +msgstr "timestamp = (dt - datetime(1970, 1, 1)) / timedelta(seconds=1)" #: ../../library/datetime.rst:1538 msgid "" @@ -2673,19 +2732,17 @@ msgstr "" "``'seconds'``: :attr:`hour` 、 :attr:`minute` 、 :attr:`second` を ``HH:MM:" "SS`` の書式で含めます。" -#: ../../library/datetime.rst:1601 ../../library/datetime.rst:1992 msgid "" "``'milliseconds'``: Include full time, but truncate fractional second part " "to milliseconds. ``HH:MM:SS.sss`` format." msgstr "" -"``'milliseconds'``: 全ての時刻を含みますが、小数第二位をミリ秒に切り捨てま" -"す。\n" -"``HH:MM:SS.sss`` の書式で表現します。" +"``'milliseconds'``: 時刻全体を含めますが、秒の小数部分はミリ秒単位で切り捨て" +"ます。\n" +"``HH:MM:SS.sss`` 形式になります。" -#: ../../library/datetime.rst:1603 ../../library/datetime.rst:1994 msgid "``'microseconds'``: Include full time in ``HH:MM:SS.ffffff`` format." msgstr "" -"``'microseconds'``: 全ての時刻を ``HH:MM:SS.mmmmmm`` の書式で含めます。" +"``'microseconds'``: 全ての時刻を ``HH:MM:SS.ffffff`` の書式で含めます。" #: ../../library/datetime.rst:1607 ../../library/datetime.rst:1998 msgid "Excluded time components are truncated, not rounded." @@ -2709,11 +2766,12 @@ msgstr "" msgid "Added the *timespec* parameter." msgstr "*timespec* パラメータを追加しました." -#: ../../library/datetime.rst:1625 msgid "" "For a :class:`.datetime` instance ``d``, ``str(d)`` is equivalent to ``d." "isoformat(' ')``." msgstr "" +":class:`.datetime` インスタンス ``d`` について、``str(d)`` は ``d." +"isoformat(' ')`` と等価です。" #: ../../library/datetime.rst:1631 msgid "Return a string representing the date and time::" @@ -2973,17 +3031,22 @@ msgstr "" ":class:`.time` コンストラクタに *tzinfo* 引数として与えられたオブジェクトにな" "り、何も渡されなかった場合には ``None`` になります。" -#: ../../library/datetime.rst:1871 msgid "" ":class:`.time` objects support equality and order comparisons, where ``a`` " "is considered less than ``b`` when ``a`` precedes ``b`` in time." msgstr "" +":class:`.time` オブジェクトは等価比較と順序比較をサポートします。\n" +"``a`` が時刻として ``b`` より前を表す場合、``a`` は ``b`` より小さいとみなさ" +"れます。" -#: ../../library/datetime.rst:1874 msgid "" "Naive and aware :class:`!time` objects are never equal. Order comparison " "between naive and aware :class:`!time` objects raises :exc:`TypeError`." msgstr "" +"naive な :class:`!time` オブジェクトと aware なものが等しくなることはありませ" +"ん。\n" +"naive な :class:`!time` オブジェクトと aware なものの順序比較は、:exc:" +"`TypeError` を送出します。" #: ../../library/datetime.rst:1878 msgid "" @@ -3026,9 +3089,8 @@ msgstr "" "た。\n" "全詳細については :issue:`13936` を参照してください。" -#: ../../library/datetime.rst:1897 msgid "Other constructors:" -msgstr "" +msgstr "その他のコンストラクタ:" #: ../../library/datetime.rst:1901 msgid "" @@ -3038,17 +3100,17 @@ msgstr "" "以下の例外を除く、有効な ISO 8601 フォーマットで与えられた *time_string* に対" "応する :class:`.time` を返します :" -#: ../../library/datetime.rst:1905 msgid "" "The leading ``T``, normally required in cases where there may be ambiguity " "between a date and a time, is not required." msgstr "" +"日付と時刻の区別が曖昧になる可能性がある場合に通常必要となる、先頭の ``T`` は" +"必須ではありません。" -#: ../../library/datetime.rst:1907 msgid "" "Fractional seconds may have any number of digits (anything beyond 6 will be " "truncated)." -msgstr "" +msgstr "秒の小数部分の桁数は任意です (6 桁を超える部分は切り捨てられます)。" #: ../../library/datetime.rst:1911 msgid "Examples:" @@ -3076,17 +3138,19 @@ msgid "" "datetime.time(4, 23, 1, tzinfo=datetime.timezone.utc)" msgstr "" -#: ../../library/datetime.rst:1935 msgid "" "Previously, this method only supported formats that could be emitted by :" "meth:`time.isoformat`." msgstr "" +"以前は、このメソッドは :meth:`time.isoformat` が出力できる形式だけをサポート" +"していました。" -#: ../../library/datetime.rst:1941 msgid "" "Return a :class:`.time` corresponding to *date_string*, parsed according to " "*format*." msgstr "" +"*format* に従って *date_string* を解析し、対応する :class:`.time` を返しま" +"す。" #: ../../library/datetime.rst:1944 msgid "" @@ -3095,17 +3159,19 @@ msgid "" msgstr "" "*format* がマイクロ秒やタイムゾーン情報を含まない場合は、以下と等価です::" -#: ../../library/datetime.rst:1946 msgid "time(*(time.strptime(date_string, format)[3:6]))" -msgstr "" +msgstr "time(*(time.strptime(date_string, format)[3:6]))" -#: ../../library/datetime.rst:1948 msgid "" ":exc:`ValueError` is raised if the *date_string* and *format* cannot be " "parsed by :func:`time.strptime` or if it returns a value which is not a time " "tuple. See also :ref:`strftime-strptime-behavior` and :meth:`time." "fromisoformat`." msgstr "" +"*date_string* と *format* を :func:`time.strptime` で解析できない場合、または" +"その返り値が時刻タプルでない場合、:exc:`ValueError` を送出します。\n" +":ref:`strftime-strptime-behavior` と :meth:`time.fromisoformat` も参照してく" +"ださい。" #: ../../library/datetime.rst:1961 msgid "" @@ -3168,9 +3234,8 @@ msgid "" "'12:34:56'" msgstr "" -#: ../../library/datetime.rst:2019 msgid "For a time ``t``, ``str(t)`` is equivalent to ``t.isoformat()``." -msgstr "" +msgstr "時刻 ``t`` について、``str(t)`` は ``t.isoformat()`` と等価です。" #: ../../library/datetime.rst:2024 msgid "" @@ -3196,7 +3261,6 @@ msgstr "" ":ref:`strftime-strptime-behavior` および :meth:`time.isoformat` も参照してく" "ださい。" -#: ../../library/datetime.rst:2038 msgid "" "If :attr:`.tzinfo` is ``None``, returns ``None``, else returns ``self.tzinfo." "utcoffset(None)``, and raises an exception if the latter doesn't return " @@ -3204,7 +3268,7 @@ msgid "" msgstr "" ":attr:`.tzinfo` が ``None`` の場合、 ``None`` を返し、そうでない場合には " "``self.tzinfo.utcoffset(None)`` を返します。\n" -"後者の式が ``None`` あるいは 1 日以下の大きさを持つ :class:`timedelta` オブ" +"後者の式が ``None`` あるいは 1 日未満の大きさを持つ :class:`timedelta` オブ" "ジェクトのいずれかを返さない場合には例外を送出します。" #: ../../library/datetime.rst:2048 @@ -3366,11 +3430,12 @@ msgstr "" "ほとんどの :meth:`utcoffset` 実装は、おそらく以下の二つのうちの一つに似たもの" "になるでしょう::" -#: ../../library/datetime.rst:2140 msgid "" "return CONSTANT # fixed-offset class\n" "return CONSTANT + self.dst(dt) # daylight-aware class" msgstr "" +"return CONSTANT # 固定オフセットのクラス\n" +"return CONSTANT + self.dst(dt) # 夏時間を考慮するクラス" #: ../../library/datetime.rst:2143 msgid "" @@ -3396,7 +3461,6 @@ msgstr "" "夏時間 (DST) 修正を、 :class:`timedelta` オブジェクトで返します。\n" "DST 情報が未知の場合、 ``None`` が返されます。" -#: ../../library/datetime.rst:2159 msgid "" "Return ``timedelta(0)`` if DST is not in effect. If DST is in effect, return " "the offset as a :class:`timedelta` object (see :meth:`utcoffset` for " @@ -3408,16 +3472,17 @@ msgid "" "tm_isdst` flag should be set, and :meth:`tzinfo.fromutc` calls :meth:`dst` " "to account for DST changes when crossing time zones." msgstr "" -"DST が有効でない場合には ``timedelta(0)`` を返します。\n" -"DST が有効の場合、オフセットは :class:`timedelta` オブジェクトで返します (詳" -"細は :meth:`utcoffset` を参照してください)。\n" -"DST オフセットが利用可能な場合、この値は :meth:`utcoffset` が返す UTC からの" -"オフセットには既に加算されているため、 DST を個別に取得する必要がない限り :" -"meth:`dst` を使って問い合わせる必要はないので注意してください。\n" -"例えば、 :meth:`datetime.timetuple` は :attr:`~.datetime.tzinfo` 属性の :" -"meth:`dst` メソッドを呼んで :attr:`~time.struct_time.tm_isdst` フラグがセット" -"されているかどうか判断し、 :meth:`tzinfo.fromutc` は :meth:`dst` タイムゾーン" -"を移動する際に DST による変更があるかどうかを調べます。" +"DST が適用されない場合は ``timedelta(0)`` を返します。\n" +"適用される場合は、調整量を :class:`timedelta` オブジェクトで返します (詳細" +"は :meth:`utcoffset` を参照してください)。\n" +"DST の調整量は :meth:`utcoffset` が返す UTC オフセットにすでに加算されている" +"ため、DST 情報を個別に取得したい場合を除き、:meth:`dst` を呼び出す必要はあり" +"ません。\n" +"例えば、:meth:`datetime.timetuple` は :attr:`~.datetime.tzinfo` 属性の :meth:" +"`dst` メソッドを呼び出して、:attr:`~time.struct_time.tm_isdst` フラグに設定す" +"る値を決定します。\n" +"また :meth:`tzinfo.fromutc` は :meth:`dst` を呼び出し、タイムゾーンをまたぐ際" +"の DST の変化を考慮します。" #: ../../library/datetime.rst:2169 msgid "" @@ -3537,7 +3602,6 @@ msgstr "" "におけるメソッドは引数 *dt* が ``None`` の場合と、 :class:`.datetime` の場合" "を受理するように用意しなければなりません。" -#: ../../library/datetime.rst:2228 msgid "" "When ``None`` is passed, it's up to the class designer to decide the best " "response. For example, returning ``None`` is appropriate if the class wishes " @@ -3545,11 +3609,11 @@ msgid "" "It may be more useful for ``utcoffset(None)`` to return the standard UTC " "offset, as there is no other convention for discovering the standard offset." msgstr "" -"``None`` が渡された場合、最良の応答方法を決めるのはクラス設計者次第です。例え" -"ば、このクラスが :class:`tzinfo` プロトコルと関係をもたないということを表明さ" -"せたければ、 ``None`` が適切です。標準時のオフセットを見つける他の手段がない" -"場合には、標準 UTC オフセットを返すために ``utcoffset(None)`` を使うともっと" -"便利かもしれません。" +"``None`` が渡された場合、最良の応答方法を決めるのはクラス設計者です。\n" +"例えば、時刻オブジェクトが :class:`tzinfo` プロトコルに関与しないことを表した" +"い場合は、``None`` を返すのが適切です。\n" +"標準オフセットを調べる方法は他に定められていないため、``utcoffset(None)`` が" +"標準の UTC オフセットを返す方が便利な場合もあります。" #: ../../library/datetime.rst:2234 msgid "" @@ -3575,7 +3639,6 @@ msgstr "" "サブクラスでオーバーライドすると良い、もう 1 つの :class:`tzinfo` のメソッド" "があります:" -#: ../../library/datetime.rst:2245 msgid "" "This is called from the default :meth:`datetime.astimezone` implementation. " "When called from that, ``dt.tzinfo`` is *self*, and *dt*'s date and time " @@ -3583,11 +3646,11 @@ msgid "" "`fromutc` is to adjust the date and time data, returning an equivalent " "datetime in *self*'s local time." msgstr "" -"デフォルトの 実装で呼び出されます。 :meth:`datetime.astimezone` から呼ばれた" -"場合、 ``dt.tzinfo`` は *self* であり、 *dt* の日付および時刻データは UTC 時" -"刻を表しているものとして見えます。 :meth:`fromutc` の目的は、 *self* のローカ" -"ル時刻に等しい :class:`datetime` オブジェクトを返すことにより日付と時刻データ" -"メンバを修正することにあります。" +"デフォルトの :meth:`datetime.astimezone` 実装から呼び出されます。\n" +"その場合、``dt.tzinfo`` は *self* であり、*dt* の日付と時刻は UTC を表すもの" +"として解釈します。\n" +":meth:`fromutc` は日付と時刻を調整し、同じ時点を *self* のローカル時刻で表す " +"datetime を返すためのメソッドです。" #: ../../library/datetime.rst:2251 msgid "" @@ -3828,7 +3891,6 @@ msgid "" "Pacific = USTimeZone(-8, \"Pacific\", \"PST\", \"PDT\")\n" msgstr "" -#: ../../library/datetime.rst:2286 msgid "" "Note that there are unavoidable subtleties twice per year in a :class:" "`tzinfo` subclass accounting for both standard and daylight time, at the DST " @@ -3840,9 +3902,8 @@ msgstr "" "間の移行のときに、回避不能の難解な問題が年に 2 度あるので注意してください。\n" "具体的な例として、東部アメリカ時刻 (US Eastern, UTC -0500) を考えます。\n" "EDT は 3 月の第二日曜日の 1:59 (EST) の 1 分後に開始し、11 月の最初の日曜日" -"の (EDTの) 1:59 に終了します::" +"の 1:59 (EDT) の 1 分後に終了します。 ::" -#: ../../library/datetime.rst:2292 msgid "" " UTC 3:MM 4:MM 5:MM 6:MM 7:MM 8:MM\n" " EST 22:MM 23:MM 0:MM 1:MM 2:MM 3:MM\n" @@ -3852,6 +3913,13 @@ msgid "" "\n" " end 23:MM 0:MM 1:MM 1:MM 2:MM 3:MM" msgstr "" +" UTC 3:MM 4:MM 5:MM 6:MM 7:MM 8:MM\n" +" EST 22:MM 23:MM 0:MM 1:MM 2:MM 3:MM\n" +" EDT 23:MM 0:MM 1:MM 2:MM 3:MM 4:MM\n" +"\n" +"start 22:MM 23:MM 0:MM 1:MM 3:MM 4:MM\n" +"\n" +" end 23:MM 0:MM 1:MM 1:MM 2:MM 3:MM" #: ../../library/datetime.rst:2300 msgid "" @@ -4049,7 +4117,6 @@ msgstr "" "返り値は、ローカル時刻と UTC の差分に等しい :class:`timedelta` インスタンスで" "す。" -#: ../../library/datetime.rst:2414 msgid "" "If *name* is not provided in the constructor, the name returned by " "``tzname(dt)`` is generated from the value of the ``offset`` as follows. If " @@ -4060,9 +4127,9 @@ msgstr "" "*name* が構築時に与えられなかった場合、 ``tzname(dt)`` によって返される name " "は以下の様に ``offset`` の値から生成されます。\n" "*offset* が ``timedelta(0)`` であった場合、 name は \"UTC\"になります。\n" -"それ以外の場合、 'UTC±HH:MM' という書式の文字列になり、± は ``offset`` を、" -"HH と MM はそれぞれ二桁の ``offset.hours`` と ``offset.minutes`` を表現しま" -"す。" +"それ以外の場合、 'UTC±HH:MM' という書式の文字列になり、± は ``offset`` の符号" +"を、HH と MM はそれぞれ二桁の ``offset.hours`` と ``offset.minutes`` を表現し" +"ます。" #: ../../library/datetime.rst:2420 msgid "" @@ -4102,12 +4169,14 @@ msgstr "" "``strftime(format)`` メソッドをサポートし、時刻を表現する文字列を明示的な書式" "文字列で統制して作成しています。" -#: ../../library/datetime.rst:2453 msgid "" "Conversely, the :meth:`date.strptime`, :meth:`datetime.strptime` and :meth:" "`time.strptime` class methods create an object from a string representing " "the time and a corresponding format string." msgstr "" +"逆に、クラスメソッド :meth:`date.strptime`、:meth:`datetime.strptime`、:meth:" +"`time.strptime` は、時刻を表す文字列と対応する書式文字列からオブジェクトを作" +"成します。" #: ../../library/datetime.rst:2457 msgid "" @@ -4133,9 +4202,8 @@ msgstr "使用法" msgid "Convert object to a string according to a given format" msgstr "オブジェクトを与えられた書式に従って文字列に変換する" -#: ../../library/datetime.rst:2463 msgid "Parse a string into an object given a corresponding format" -msgstr "" +msgstr "対応する書式を指定して文字列を解析し、オブジェクトに変換する" #: ../../library/datetime.rst:2465 msgid "Type of method" @@ -4167,11 +4235,12 @@ msgid "" msgstr "" ":meth:`~.datetime.strftime` と :meth:`~.datetime.strptime` の書式コード" -#: ../../library/datetime.rst:2476 msgid "" "These methods accept format codes that can be used to parse and format " "dates::" msgstr "" +"これらのメソッドは、日付の解析と書式設定に使用できる書式コードを受け付けま" +"す。 ::" #: ../../library/datetime.rst:2478 msgid "" @@ -4698,25 +4767,25 @@ msgstr "" msgid "Using ``datetime.strptime(date_string, format)`` is equivalent to::" msgstr "``datetime.strptime(date_string, format)`` は次の式と等価です::" -#: ../../library/datetime.rst:2645 msgid "" "except when the format includes sub-second components or time zone offset " "information, which are supported in ``datetime.strptime`` but are discarded " "by ``time.strptime``." msgstr "" -"ただし、 ``datetime.strptime`` はサポートしているが ``time.strptime`` には無" -"い、秒未満の単位やタイムゾーンオフセットの情報が format に 含まれているときは" -"除きます。" +"ただし、書式 ``format`` に秒未満の成分やタイムゾーンオフセットの情報が含まれ" +"る場合は除きます。\n" +"これらの情報は ``datetime.strptime`` ではサポートされますが、``time." +"strptime`` では破棄されます。" -#: ../../library/datetime.rst:2649 msgid "" "For :class:`.time` objects, the format codes for year, month, and day should " "not be used, as :class:`!time` objects have no such values. If they're used " "anyway, 1900 is substituted for the year, and 1 for the month and day." msgstr "" -":class:`.time` オブジェクトには、年、月、日の値がないため、それらを書式コード" -"を使うことができません。\n" -"無理矢理使った場合、年は1900に置き換えられ、月と日は1に置き換えられます。" +":class:`.time` オブジェクトでは、年、月、日の書式コードは使用すべきではありま" +"せん。\n" +":class:`!time` オブジェクトはこれらの値を持たないためです。\n" +"使用した場合、年には 1900、月と日には 1 が代入されます。" #: ../../library/datetime.rst:2653 msgid "" @@ -4724,9 +4793,9 @@ msgid "" "microseconds should not be used, as :class:`date` objects have no such " "values. If they're used anyway, 0 is substituted for them." msgstr "" -":class:`date` オブジェクトには、時、分、秒、マイクロ秒の値がないため、それら" -"の書式コードを使うことができません。\n" -"無理矢理使った場合、これらの値は0に置き換えられます。" +":class:`date` オブジェクトに時、分、秒、マイクロ秒の書式コードを使うべきでは" +"ありません。:class:`date` オブジェクトはこれらの値を持たないためです。使用し" +"た場合は、これらの値に 0 が代入されます。" #: ../../library/datetime.rst:2657 msgid "" @@ -4742,13 +4811,16 @@ msgstr "" "方、他のプラットフォームでは ``strftime`` が :exc:`UnicodeError` を送出した" "り、その代わりに空文字列を返したりするかもしれません。" -#: ../../library/datetime.rst:2666 msgid "" "Because the format depends on the current locale, care should be taken when " "making assumptions about the output value. Field orderings will vary (for " "example, \"month/day/year\" versus \"day/month/year\"), and the output may " "contain non-ASCII characters." msgstr "" +"書式は現在のロケールに依存するため、出力値について仮定する際は注意してくださ" +"い。\n" +"フィールドの順序は (例えば「月/日/年」と「日/月/年」のように) 異なり、出力に" +"非 ASCII 文字が含まれる場合があります。" #: ../../library/datetime.rst:2672 msgid "" @@ -4775,15 +4847,13 @@ msgstr "" "バージョン 3.2 では、 :meth:`~.datetime.strftime` メソッドは years >= 1000 の" "範囲の年数しか扱えませんでした。" -#: ../../library/datetime.rst:2684 msgid "" "When used with the :meth:`~.datetime.strptime` method, the ``%p`` directive " "only affects the output hour field if the ``%I`` directive is used to parse " "the hour." msgstr "" -":meth:`~.datetime.strptime` メソッドと共に使われた場合、 ``%p`` 指定子は出力" -"の時間フィールドのみに影響し、 ``%I`` 指定子が使われたかのように振る舞いま" -"す。" +":meth:`~.datetime.strptime` メソッドで ``%p`` 指定子が出力の時フィールドに影" +"響するのは、時の解析に ``%I`` 指定子を使う場合だけです。" #: ../../library/datetime.rst:2688 msgid "" @@ -5002,6 +5072,5 @@ msgstr "" msgid "% (percent)" msgstr "% (パーセント)" -#: ../../library/datetime.rst:2441 msgid "datetime format" -msgstr "" +msgstr "日時の書式" diff --git a/library/dbm.po b/library/dbm.po index a9c0d2117..b6af8f2b5 100644 --- a/library/dbm.po +++ b/library/dbm.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/dbm.rst:2 @@ -36,17 +36,14 @@ msgstr "**ソースコード:** :source:`Lib/dbm/__init__.py`" msgid ":mod:`dbm` is a generic interface to variants of the DBM database:" msgstr "" -#: ../../library/dbm.rst:13 msgid ":mod:`dbm.sqlite3`" -msgstr "" +msgstr ":mod:`dbm.sqlite3`" -#: ../../library/dbm.rst:14 msgid ":mod:`dbm.gnu`" -msgstr "" +msgstr ":mod:`dbm.gnu`" -#: ../../library/dbm.rst:15 msgid ":mod:`dbm.ndbm`" -msgstr "" +msgstr ":mod:`dbm.ndbm`" #: ../../library/dbm.rst:17 msgid "" @@ -64,99 +61,91 @@ msgstr "" "サポートされているモジュールそれぞれによって送出される可能性のある例外を含む" "タプル。これにはユニークな例外があり、最初の要素として同じく :exc:`dbm." "error` という名前の例外が含まれます --- :exc:`dbm.error` が送出される場合、後" -"者(訳注:タプルの ``dbm.error`` ではなく例外 :exc:`dbm.error`)が使用されます。" +"者(訳注:タプルの ``dbm.error`` ではなく例外 ``dbm.error``)が使用されます。" -#: ../../library/dbm.rst:31 msgid "" "This function attempts to guess which of the several simple database modules " "available --- :mod:`dbm.sqlite3`, :mod:`dbm.gnu`, :mod:`dbm.ndbm`, or :mod:" "`dbm.dumb` --- should be used to open a given file." msgstr "" +"指定されたファイルを開くために、利用可能な単純なデータベースモジュール :mod:" +"`dbm.sqlite3`、:mod:`dbm.gnu`、:mod:`dbm.ndbm`、:mod:`dbm.dumb` のどれを使う" +"べきか推測します。" -#: ../../library/dbm.rst:35 msgid "Return one of the following values:" -msgstr "" +msgstr "次のいずれかの値を返します:" -#: ../../library/dbm.rst:37 msgid "" "``None`` if the file can't be opened because it's unreadable or doesn't exist" -msgstr "" +msgstr "ファイルが読み取り不能か存在しないため開けない場合は ``None``" -#: ../../library/dbm.rst:38 msgid "the empty string (``''``) if the file's format can't be guessed" -msgstr "" +msgstr "ファイル形式を推測できない場合は空文字列 (``''``)" -#: ../../library/dbm.rst:39 msgid "" "a string containing the required module name, such as ``'dbm.ndbm'`` or " "``'dbm.gnu'``" -msgstr "" +msgstr "``'dbm.ndbm'`` や ``'dbm.gnu'`` など、必要なモジュール名の文字列" -#: ../../library/dbm.rst:41 ../../library/dbm.rst:250 ../../library/dbm.rst:448 msgid "*filename* accepts a :term:`path-like object`." -msgstr "" +msgstr "*filename* に :term:`path-like object` を渡せるようになりました。" -#: ../../library/dbm.rst:65 msgid "Open a database and return the corresponding database object." -msgstr "" +msgstr "データベースを開き、対応するデータベースオブジェクトを返します。" #: ../../library/dbm.rst:0 msgid "Parameters" msgstr "パラメーター" -#: ../../library/dbm.rst:67 msgid "" "The database file to open. If the database file already exists, the :func:" "`whichdb` function is used to determine its type and the appropriate module " "is used; if it does not exist, the first submodule listed above that can be " "imported is used." msgstr "" +"開くデータベースファイル。\n" +"データベースファイルがすでに存在する場合は :func:`whichdb` 関数で種類を判定" +"し、適切なモジュールを使います。\n" +"存在しない場合は、上に挙げたサブモジュールのうち最初にインポートできたものを" +"使います。" -#: ../../library/dbm.rst:68 ../../library/dbm.rst:222 msgid "The database file to open." -msgstr "" +msgstr "開くデータベースファイル。" -#: ../../library/dbm.rst:70 msgid "" "If the database file already exists, the :func:`whichdb` function is used to " "determine its type and the appropriate module is used; if it does not exist, " "the first submodule listed above that can be imported is used." msgstr "" +"データベースファイルがすでに存在する場合は :func:`whichdb` 関数で種類を判定" +"し、適切なモジュールを使います。\n" +"存在しない場合は、上に挙げたサブモジュールのうち最初にインポートできたものを" +"使います。" -#: ../../library/dbm.rst:75 ../../library/dbm.rst:178 ../../library/dbm.rst:353 msgid "" "* ``'r'`` (default): |flag_r| * ``'w'``: |flag_w| * ``'c'``: |flag_c| * " "``'n'``: |flag_n|" msgstr "" +"* ``'r'`` (デフォルト): |flag_r| * ``'w'``: |flag_w| * ``'c'``: |flag_c| * " +"``'n'``: |flag_n|" -#: ../../library/dbm.rst:76 ../../library/dbm.rst:180 ../../library/dbm.rst:227 -#: ../../library/dbm.rst:354 msgid "``'r'`` (default): |flag_r|" -msgstr "" +msgstr "``'r'`` (デフォルト): |flag_r|" -#: ../../library/dbm.rst:77 ../../library/dbm.rst:181 ../../library/dbm.rst:228 -#: ../../library/dbm.rst:355 ../../library/dbm.rst:429 msgid "``'w'``: |flag_w|" -msgstr "" +msgstr "``'w'``: |flag_w|" -#: ../../library/dbm.rst:78 ../../library/dbm.rst:182 ../../library/dbm.rst:229 -#: ../../library/dbm.rst:356 msgid "``'c'``: |flag_c|" -msgstr "" +msgstr "``'c'``: |flag_c|" -#: ../../library/dbm.rst:79 ../../library/dbm.rst:183 ../../library/dbm.rst:230 -#: ../../library/dbm.rst:357 ../../library/dbm.rst:431 msgid "``'n'``: |flag_n|" -msgstr "" +msgstr "``'n'``: |flag_n|" -#: ../../library/dbm.rst:81 ../../library/dbm.rst:244 ../../library/dbm.rst:359 -#: ../../library/dbm.rst:433 msgid "|mode_param_doc|" -msgstr "" +msgstr "|mode_param_doc|" -#: ../../library/dbm.rst:84 msgid "*file* accepts a :term:`path-like object`." -msgstr "" +msgstr "*file* に :term:`path-like object` を渡せるようになりました。" #: ../../library/dbm.rst:87 msgid "" @@ -188,17 +177,19 @@ msgid "" "`dbm` backends." msgstr "" -#: ../../library/dbm.rst:103 msgid "" "Added native support for the context management protocol to the objects " "returned by :func:`~dbm.open`." msgstr "" +":func:`~dbm.open` が返すオブジェクトに、コンテキスト管理プロトコルのネイティ" +"ブサポートを追加しました。" -#: ../../library/dbm.rst:107 msgid "" "Deleting a key from a read-only database raises a database module specific " "exception instead of :exc:`KeyError`." msgstr "" +"読み取り専用データベースからキーを削除すると、:exc:`KeyError` ではなくデータ" +"ベースモジュール固有の例外を送出するようになりました。" #: ../../library/dbm.rst:111 msgid "" @@ -251,9 +242,8 @@ msgstr "個々のサブモジュールは以降の節で説明されます。" msgid ":mod:`dbm.sqlite3` --- SQLite backend for dbm" msgstr "" -#: ../../library/dbm.rst:156 msgid "**Source code:** :source:`Lib/dbm/sqlite3.py`" -msgstr "" +msgstr "**ソースコード:** :source:`Lib/dbm/sqlite3.py`" #: ../../library/dbm.rst:160 msgid "" @@ -263,9 +253,8 @@ msgid "" "including the SQLite CLI." msgstr "" -#: ../../includes/wasm-mobile-notavail.rst:3 ../../includes/wasm-notavail.rst:3 msgid "Availability" -msgstr "" +msgstr "利用可能な環境" #: ../../includes/wasm-notavail.rst:5 msgid "" @@ -282,15 +271,15 @@ msgid "" "manager via the :keyword:`with` keyword." msgstr "" -#: ../../library/dbm.rst:174 msgid "The path to the database to be opened." -msgstr "" +msgstr "開くデータベースのパス。" -#: ../../library/dbm.rst:185 msgid "" "The Unix file access mode of the file (default: octal ``0o666``), used only " "when the database has to be created." msgstr "" +"ファイルの Unix アクセスモード (デフォルトは 8 進数の ``0o666``)。\n" +"データベースを新規作成する必要がある場合にのみ使います。" #: ../../library/dbm.rst:191 msgid ":mod:`dbm.gnu` --- GNU database manager" @@ -318,6 +307,8 @@ msgid "" "This module is not supported on :ref:`mobile platforms ` or :ref:`WebAssembly platforms `." msgstr "" +"このモジュールは :ref:`モバイルプラットフォーム ` と :" +"ref:`WebAssemblyプラットフォーム ` をサポートしません。" #: ../../library/dbm.rst:214 msgid "" @@ -329,11 +320,9 @@ msgstr "" "定のように、一般的なマップ型のエラーに対しては :exc:`KeyError` が送出されま" "す。" -#: ../../library/dbm.rst:220 msgid "Open a GDBM database and return a :class:`!gdbm` object." -msgstr "" +msgstr "GDBM データベースを開き、:class:`!gdbm` オブジェクトを返します。" -#: ../../library/dbm.rst:226 msgid "" "* ``'r'`` (default): |flag_r| * ``'w'``: |flag_w| * ``'c'``: |flag_c| * " "``'n'``: |flag_n| The following additional characters may be appended to " @@ -344,48 +333,62 @@ msgid "" "versions of GDBM. See the :data:`open_flags` member for a list of supported " "flag characters." msgstr "" +"* ``'r'`` (デフォルト): |flag_r| * ``'w'``: |flag_w| * ``'c'``: |flag_c| * " +"``'n'``: |flag_n|\n" +"\n" +"次の文字を追加して、データベースを開く方法を制御できます:\n" +"\n" +"* ``'f'``: 高速モードでデータベースを開きます。\n" +" データベースへの書き込みは同期されません。\n" +"* ``'s'``: 同期モード。\n" +" データベースへの変更は直ちにファイルに書き込まれます。\n" +"* ``'u'``: データベースをロックしません。\n" +"\n" +"すべてのフラグが GDBM のすべてのバージョンで有効とは限りません。\n" +"サポートするフラグ文字の一覧は :data:`open_flags` メンバーを参照してくださ" +"い。" -#: ../../library/dbm.rst:232 msgid "" "The following additional characters may be appended to control how the " "database is opened:" -msgstr "" +msgstr "次の文字を追加して、データベースを開く方法を制御できます:" -#: ../../library/dbm.rst:235 msgid "" "``'f'``: Open the database in fast mode. Writes to the database will not be " "synchronized." msgstr "" +"``'f'``: 高速モードでデータベースを開きます。\n" +"データベースへの書き込みは同期されません。" -#: ../../library/dbm.rst:237 msgid "" "``'s'``: Synchronized mode. Changes to the database will be written " "immediately to the file." msgstr "" +"``'s'``: 同期モード。\n" +"データベースへの変更は直ちにファイルに書き込まれます。" -#: ../../library/dbm.rst:239 msgid "``'u'``: Do not lock database." -msgstr "" +msgstr "``'u'``: データベースをロックしません。" -#: ../../library/dbm.rst:241 msgid "" "Not all flags are valid for all versions of GDBM. See the :data:`open_flags` " "member for a list of supported flag characters." msgstr "" +"すべてのフラグが GDBM のすべてのバージョンで有効とは限りません。\n" +"サポートするフラグ文字の一覧は :data:`open_flags` メンバーを参照してくださ" +"い。" -#: ../../library/dbm.rst:0 msgid "Raises" -msgstr "" +msgstr "送出される例外" -#: ../../library/dbm.rst:247 msgid "If an invalid *flag* argument is passed." -msgstr "" +msgstr "不正な *flag* 引数が渡された場合。" -#: ../../library/dbm.rst:255 msgid "" "A string of characters the *flag* parameter of :meth:`~dbm.gnu.open` " "supports." msgstr "" +":meth:`~dbm.gnu.open` の *flag* パラメーターが受け付ける文字を並べた文字列。" #: ../../library/dbm.rst:257 msgid "" @@ -394,13 +397,16 @@ msgid "" "methods are also provided:" msgstr "" -#: ../../library/dbm.rst:263 msgid "" "It's possible to loop over every key in the database using this method and " "the :meth:`nextkey` method. The traversal is ordered by GDBM's internal " "hash values, and won't be sorted by the key values. This method returns the " "starting key." msgstr "" +"このメソッドと :meth:`nextkey` メソッドを使って、データベースのすべてのキーを" +"順にたどれます。\n" +"走査の順序は GDBM 内部のハッシュ値に基づき、キーの値の順には並びません。\n" +"このメソッドは最初のキーを返します。" #: ../../library/dbm.rst:270 msgid "" @@ -412,15 +418,17 @@ msgstr "" "コードはデータベース ``db`` について、キー全てを含むリストをメモリ上に生成す" "ることなく全てのキーを出力します::" -#: ../../library/dbm.rst:274 msgid "" "k = db.firstkey()\n" "while k is not None:\n" " print(k)\n" " k = db.nextkey(k)" msgstr "" +"k = db.firstkey()\n" +"while k is not None:\n" +" print(k)\n" +" k = db.nextkey(k)" -#: ../../library/dbm.rst:281 msgid "" "If you have carried out a lot of deletions and would like to shrink the " "space used by the GDBM file, this routine will reorganize the database. :" @@ -428,6 +436,12 @@ msgid "" "by using this reorganization; otherwise, deleted file space will be kept and " "reused as new (key, value) pairs are added." msgstr "" +"多数の削除を行った後、GDBM ファイルの使用領域を縮小したい場合に、このルーチン" +"でデータベースを再編成できます。\n" +":class:`!gdbm` オブジェクトは、この再編成以外の方法ではデータベースファイルの" +"長さを縮めません。\n" +"再編成しない場合、削除されたファイル領域はそのまま残り、新しい (key, value) " +"ペアを追加したときに再利用されます。" #: ../../library/dbm.rst:289 msgid "" @@ -437,9 +451,8 @@ msgstr "" "データベースが高速モードで開かれていた場合、このメソッドはディスクにまだ書き" "込まれていないデータを全て書き込ませます。" -#: ../../library/dbm.rst:294 msgid "Close the GDBM database." -msgstr "" +msgstr "GDBM データベースを閉じます。" #: ../../library/dbm.rst:298 msgid "Remove all items from the GDBM database." @@ -460,13 +473,18 @@ msgid "" "NDBM interface or the :abbr:`GDBM (GNU dbm)` compatibility interface." msgstr "" -#: ../../library/dbm.rst:326 msgid "" "The NDBM library shipped as part of macOS has an undocumented limitation on " "the size of values, which can result in corrupted database files when " "storing values larger than this limit. Reading such corrupted files can " "result in a hard crash (segmentation fault)." msgstr "" +"macOS に付属する NDBM ライブラリには、値のサイズに関する文書化されていない制" +"限があります。\n" +"この制限より大きな値を保存すると、データベースファイルが破損することがありま" +"す。\n" +"破損したファイルを読み取ると、プログラムがクラッシュ (セグメンテーション" +"フォールト) することがあります。" #: ../../library/dbm.rst:335 msgid "" @@ -478,19 +496,18 @@ msgstr "" "定のように、一般的なマップ型のエラーに対しては :exc:`KeyError` が送出されま" "す。" -#: ../../library/dbm.rst:341 msgid "Name of the NDBM implementation library used." -msgstr "" +msgstr "使用している NDBM 実装ライブラリの名前。" -#: ../../library/dbm.rst:346 msgid "Open an NDBM database and return an :class:`!ndbm` object." -msgstr "" +msgstr "NDBM データベースを開き、:class:`!ndbm` オブジェクトを返します。" -#: ../../library/dbm.rst:348 msgid "" "The basename of the database file (without the :file:`.dir` or :file:`.pag` " "extensions)." msgstr "" +"データベースファイルのベース名 (:file:`.dir` や :file:`.pag` 拡張子は含めませ" +"ん)。" #: ../../library/dbm.rst:362 msgid "" @@ -499,13 +516,12 @@ msgid "" "methods are also provided:" msgstr "" -#: ../../library/dbm.rst:366 msgid "Accepts :term:`path-like object` for filename." msgstr "" +"ファイル名として :term:`path-like object` を受け付けるようになりました。" -#: ../../library/dbm.rst:371 msgid "Close the NDBM database." -msgstr "" +msgstr "NDBM データベースを閉じます。" #: ../../library/dbm.rst:375 msgid "Remove all items from the NDBM database." @@ -538,9 +554,8 @@ msgid "" "backends, such as :mod:`dbm.gnu`, no external library is required." msgstr "" -#: ../../library/dbm.rst:404 msgid "The :mod:`!dbm.dumb` module defines the following:" -msgstr "" +msgstr ":mod:`!dbm.dumb` モジュールは以下を定義しています:" #: ../../library/dbm.rst:408 msgid "" @@ -559,40 +574,42 @@ msgid "" "and :meth:`~dumbdbm.close` methods." msgstr "" -#: ../../library/dbm.rst:419 msgid "" "The basename of the database file (without extensions). A new database " "creates the following files: - :file:`{filename}.dat` - :file:`{filename}." "dir`" msgstr "" +"データベースファイルのベース名 (拡張子は含めません)。\n" +"新しいデータベースを作ると、次のファイルが作成されます:\n" +"\n" +"- :file:`{filename}.dat`\n" +"- :file:`{filename}.dir`" -#: ../../library/dbm.rst:420 msgid "" "The basename of the database file (without extensions). A new database " "creates the following files:" msgstr "" +"データベースファイルのベース名 (拡張子は含めません)。\n" +"新しいデータベースを作ると、次のファイルが作成されます:" -#: ../../library/dbm.rst:423 msgid ":file:`{filename}.dat`" -msgstr "" +msgstr ":file:`{filename}.dat`" -#: ../../library/dbm.rst:424 msgid ":file:`{filename}.dir`" -msgstr "" +msgstr ":file:`{filename}.dir`" -#: ../../library/dbm.rst:427 msgid "" "* ``'r'``: |flag_r| * ``'w'``: |flag_w| * ``'c'`` (default): |flag_c| * " "``'n'``: |flag_n|" msgstr "" +"* ``'r'``: |flag_r| * ``'w'``: |flag_w| * ``'c'`` (デフォルト): |flag_c| * " +"``'n'``: |flag_n|" -#: ../../library/dbm.rst:428 msgid "``'r'``: |flag_r|" -msgstr "" +msgstr "``'r'``: |flag_r|" -#: ../../library/dbm.rst:430 msgid "``'c'`` (default): |flag_c|" -msgstr "" +msgstr "``'c'`` (デフォルト): |flag_c|" #: ../../library/dbm.rst:437 msgid "" @@ -604,16 +621,19 @@ msgstr "" "るときに、 Python の抽象構文木コンパイラのスタックの深さの限界を越えるせい" "で、 Python インタプリタをクラッシュさせることができます。" -#: ../../library/dbm.rst:441 msgid "" ":func:`~dbm.dumb.open` always creates a new database when *flag* is ``'n'``." msgstr "" +"*flag* が ``'n'`` の場合、:func:`~dbm.dumb.open` は常に新しいデータベースを作" +"成するようになりました。" -#: ../../library/dbm.rst:444 msgid "" "A database opened read-only if *flag* is ``'r'``. A database is not created " "if it does not exist if *flag* is ``'r'`` or ``'w'``." msgstr "" +"*flag* が ``'r'`` の場合は読み取り専用でデータベースを開きます。\n" +"*flag* が ``'r'`` または ``'w'`` でデータベースが存在しない場合、新規作成しな" +"くなりました。" #: ../../library/dbm.rst:451 msgid "" @@ -621,15 +641,15 @@ msgid "" "MutableMapping` class, the following methods are provided:" msgstr "" -#: ../../library/dbm.rst:457 msgid "" "Synchronize the on-disk directory and data files. This method is called by " "the :meth:`shelve.Shelf.sync` method." msgstr "" +"ディスク上のディレクトリファイルとデータファイルを同期します。\n" +"このメソッドは :meth:`shelve.Shelf.sync` メソッドから呼び出されます。" -#: ../../library/dbm.rst:462 msgid "Close the database." -msgstr "" +msgstr "データベースを閉じます。" #: ../../library/dbm.rst:388 msgid "databases" diff --git a/library/debug.po b/library/debug.po index f4fb74bea..12d47fc47 100644 --- a/library/debug.po +++ b/library/debug.po @@ -16,17 +16,16 @@ msgstr "" "Last-Translator: tomo, 2021\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/debug.rst:3 msgid "Debugging and Profiling" msgstr "デバッグとプロファイル" -#: ../../library/debug.rst:5 msgid "" "These libraries help you with Python development: the debugger enables you " "to step through code, analyze stack frames and set breakpoints etc., and the " @@ -35,7 +34,10 @@ msgid "" "provide visibility into runtime behaviors that would otherwise require " "intrusive debugging or patching." msgstr "" -"ここに含まれるライブラリは Python での開発を手助けするものです。デバッガを使" -"うと、コードのステップ実行や、スタックフレームの解析、ブレークポイントの設定" -"などができます。プロファイラはコードを実行して実行時間の詳細を提供し、プログ" -"ラムのボトルネックを特定できるようにします。" +"ここに含まれるライブラリは Python での開発を手助けします。\n" +"デバッガを使うと、コードのステップ実行やスタックフレームの解析、ブレークポイ" +"ントの設定などができます。\n" +"プロファイラはコードを実行して実行時間の詳しい内訳を示すので、プログラムのボ" +"トルネックを特定できます。\n" +"監査イベントを使うと、通常ならプログラムに手を加えるデバッグやパッチ適用が必" +"要な実行時の振る舞いを把握できます。" diff --git a/library/decimal.po b/library/decimal.po index 01922a333..5468caeb3 100644 --- a/library/decimal.po +++ b/library/decimal.po @@ -19,10 +19,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/decimal.rst:2 @@ -93,22 +93,21 @@ msgid "" "multiplicands. For instance, ``1.3 * 1.2`` gives ``1.56`` while ``1.30 * " "1.20`` gives ``1.5600``." msgstr "" -":mod:`decimal` モジュールでは、有効桁数の表記が取り入れられており、例えば " +"``decimal`` モジュールでは、有効桁数の表記が取り入れられており、例えば " "``1.30 + 1.20`` は ``2.50`` になります。すなわち、末尾のゼロは有効数字を示す" "ために残されます。こうした仕様は通貨計算を行うアプリケーションでは慣例です。" "乗算の場合、「教科書的な」アプローチでは、乗算の被演算子すべての桁数を使いま" "す。例えば、 ``1.3 * 1.2`` は ``1.56`` になり、 ``1.30 * 1.20`` は " "``1.5600`` になります。" -#: ../../library/decimal.rst:61 msgid "" "Unlike hardware based binary floating point, the decimal module has a user " "alterable precision (defaulting to 28 places) which can be as large as " "needed for a given problem:" msgstr "" -"ハードウェアによる 2 進浮動小数点表現と違い、:mod:`decimal` モジュールでは計" -"算精度をユーザが変更できます(デフォルトでは 28 桁です)。この桁数はほとんどの" -"問題解決に十分な大きさです:" +"ハードウェアによる 2 進浮動小数点演算と違い、``decimal`` モジュールではユー" +"ザーが精度を変更できます (デフォルトは 28 桁です)。\n" +"問題に応じて必要なだけ精度を高くできます:" #: ../../library/decimal.rst:73 msgid "" @@ -121,10 +120,10 @@ msgid "" msgstr "" "二進と十進の浮動小数点は、いずれも広く公開されている標準仕様のもとに実装され" "ています。組み込みの浮動小数点型では、標準仕様で提唱されている機能のほんのさ" -"さやかな部分を利用できるにすぎませんが、:mod:`decimal` では標準仕様が要求して" -"いる全ての機能を利用できます。必要に応じて、プログラマは値の丸めやシグナル処" -"理を完全に制御できます。この中には全ての不正確な操作を例外でブロックして正確" -"な算術を遵守させるオプションもあります。" +"さやかな部分を利用できるにすぎませんが、 ``decimal`` では標準仕様が要求してい" +"る全ての機能を利用できます。必要に応じて、プログラマは値の丸めやシグナル処理" +"を完全に制御できます。この中には全ての不正確な操作を例外でブロックして正確な" +"算術を遵守させるオプションもあります。" #: ../../library/decimal.rst:80 msgid "" @@ -154,9 +153,9 @@ msgid "" "``+0``." msgstr "" "十進数型は変更不能です。これは符号、係数部、そして指数を持ちます。有効桁数を" -"残すために、仮数部の末尾にあるゼロは切り詰められません。 :mod:`decimal` で" -"は、 ``Infinity``, ``-Infinity``, および ``NaN`` といった特殊な値も定義されて" -"います。標準仕様では ``-0`` と ``+0`` も区別します。" +"残すために、仮数部の末尾にあるゼロは切り詰められません。 ``decimal`` では、 " +"``Infinity``, ``-Infinity``, および ``NaN`` といった特殊な値も定義されていま" +"す。標準仕様では ``-0`` と ``+0`` も区別します。" #: ../../library/decimal.rst:94 msgid "" @@ -186,8 +185,8 @@ msgid "" msgstr "" "シグナルとは、演算の過程で生じる例外的条件です。個々のシグナルは、アプリケー" "ションそれぞれの要求に従って、無視されたり、単なる情報とみなされたり、例外と" -"して扱われたりします。 :mod:`decimal` モジュールには、 :const:`Clamped`, :" -"const:`InvalidOperation`, :const:`DivisionByZero`, :const:`Inexact`, :const:" +"して扱われたりします。 ``decimal`` モジュールには、 :const:`Clamped`, :const:" +"`InvalidOperation`, :const:`DivisionByZero`, :const:`Inexact`, :const:" "`Rounded`, :const:`Subnormal`, :const:`Overflow`, :const:`Underflow`, およ" "び :const:`FloatOperation` といったシグナルがあります。" @@ -212,9 +211,8 @@ msgstr "" "IBM による汎用十進演算仕様、`The General Decimal Arithmetic Specification " "`_。" -#: ../../library/decimal.rst:125 msgid "Quick-start tutorial" -msgstr "" +msgstr "入門チュートリアル" #: ../../library/decimal.rst:127 msgid "" @@ -222,11 +220,10 @@ msgid "" "current context with :func:`getcontext` and, if necessary, setting new " "values for precision, rounding, or enabled traps::" msgstr "" -"普通、 :mod:`decimal` を使うときには、モジュールをインポートし、現在の演算コ" -"ンテキストを :func:`getcontext` で調べ、必要なら、精度、丸め、有効なトラップ" -"を設定します::" +"普通、 ``decimal`` を使うときには、モジュールをインポートし、現在の演算コンテ" +"キストを :func:`getcontext` で調べ、必要なら、精度、丸め、有効なトラップを設" +"定します::" -#: ../../library/decimal.rst:131 msgid "" ">>> from decimal import *\n" ">>> getcontext()\n" @@ -236,6 +233,13 @@ msgid "" "\n" ">>> getcontext().prec = 7 # Set a new precision" msgstr "" +">>> from decimal import *\n" +">>> getcontext()\n" +"Context(prec=28, rounding=ROUND_HALF_EVEN, Emin=-999999, Emax=999999,\n" +" capitals=1, clamp=0, flags=[], traps=[Overflow, DivisionByZero,\n" +" InvalidOperation])\n" +"\n" +">>> getcontext().prec = 7 # 新しい精度を設定します" #: ../../library/decimal.rst:139 msgid "" @@ -245,12 +249,11 @@ msgid "" "values such as ``NaN`` which stands for \"Not a number\", positive and " "negative ``Infinity``, and ``-0``::" msgstr "" -":class:`Decimal` インスタンスは、整数、文字列、浮動小数点数、またはタプルから" -"構成できます。整数や浮動小数点数からの構成は、整数や浮動小数点数の値を正確に" -"変換します。 :class:`Decimal` は \"非数 (Not a Number)\" を表す ``NaN`` や正" -"負の ``Infinity`` (無限大)、 ``-0`` といった特殊な値も表現できます::" +"``Decimal`` インスタンスは、整数、文字列、浮動小数点数、またはタプルから構成" +"できます。整数や浮動小数点数からの構成は、整数や浮動小数点数の値を正確に変換" +"します。 ``Decimal`` は \"非数 (Not a Number)\" を表す ``NaN`` や正負の " +"``Infinity`` (無限大)、 ``-0`` といった特殊な値も表現できます::" -#: ../../library/decimal.rst:145 msgid "" ">>> getcontext().prec = 28\n" ">>> Decimal(10)\n" @@ -270,6 +273,23 @@ msgid "" ">>> Decimal('-Infinity')\n" "Decimal('-Infinity')" msgstr "" +">>> getcontext().prec = 28\n" +">>> Decimal(10)\n" +"Decimal('10')\n" +">>> Decimal('3.14')\n" +"Decimal('3.14')\n" +">>> Decimal(3.14)\n" +"Decimal('3.140000000000000124344978758017532527446746826171875')\n" +">>> Decimal((0, (3, 1, 4), -2))\n" +"Decimal('3.14')\n" +">>> Decimal(str(2.0 ** 0.5))\n" +"Decimal('1.4142135623730951')\n" +">>> Decimal(2) ** Decimal('0.5')\n" +"Decimal('1.414213562373095048801688724')\n" +">>> Decimal('NaN')\n" +"Decimal('NaN')\n" +">>> Decimal('-Infinity')\n" +"Decimal('-Infinity')" #: ../../library/decimal.rst:163 msgid "" @@ -280,7 +300,6 @@ msgstr "" ":exc:`FloatOperation` シグナルがトラップされる場合、コンストラクタや順序比較" "において誤って decimal と float が混ざると、例外が送出されます::" -#: ../../library/decimal.rst:167 msgid "" ">>> c = getcontext()\n" ">>> c.traps[FloatOperation] = True\n" @@ -295,6 +314,18 @@ msgid "" ">>> Decimal('3.5') == 3.5\n" "True" msgstr "" +">>> c = getcontext()\n" +">>> c.traps[FloatOperation] = True\n" +">>> Decimal(3.14)\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"decimal.FloatOperation: []\n" +">>> Decimal('3.5') < 3.7\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"decimal.FloatOperation: []\n" +">>> Decimal('3.5') == 3.5\n" +"True" #: ../../library/decimal.rst:182 msgid "" @@ -302,10 +333,9 @@ msgid "" "digits input. Context precision and rounding only come into play during " "arithmetic operations." msgstr "" -"新たな :class:`Decimal` の有効桁数は入力の桁数だけで決まります。演算コンテキ" -"ストにおける精度や値丸めの設定が影響するのは算術演算の間だけです。" +"新たな ``Decimal`` の有効桁数は入力の桁数だけで決まります。演算コンテキストに" +"おける精度や値丸めの設定が影響するのは算術演算の間だけです。" -#: ../../library/decimal.rst:186 msgid "" ">>> getcontext().prec = 6\n" ">>> Decimal('3.0')\n" @@ -318,6 +348,16 @@ msgid "" ">>> Decimal('3.1415926535') + Decimal('2.7182818285')\n" "Decimal('5.85988')" msgstr "" +">>> getcontext().prec = 6\n" +">>> Decimal('3.0')\n" +"Decimal('3.0')\n" +">>> Decimal('3.1415926535')\n" +"Decimal('3.1415926535')\n" +">>> Decimal('3.1415926535') + Decimal('2.7182818285')\n" +"Decimal('5.85987')\n" +">>> getcontext().rounding = ROUND_UP\n" +">>> Decimal('3.1415926535') + Decimal('2.7182818285')\n" +"Decimal('5.85988')" #: ../../library/decimal.rst:199 msgid "" @@ -327,21 +367,24 @@ msgstr "" "C バージョンの内部制限を超えた場合、decimal の構成は :class:" "`InvalidOperation` を送出します::" -#: ../../library/decimal.rst:202 msgid "" ">>> Decimal(\"1e9999999999999999999\")\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" "decimal.InvalidOperation: []" msgstr "" +">>> Decimal(\"1e9999999999999999999\")\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"decimal.InvalidOperation: []" -#: ../../library/decimal.rst:209 msgid "" "Decimals interact well with much of the rest of Python. Here is a small " "decimal floating-point flying circus:" msgstr "" +"Decimal は Python の他の多くの機能とうまく連携します。\n" +"10 進浮動小数点数を使った、ちょっとした実演を見てみましょう:" -#: ../../library/decimal.rst:212 msgid "" ">>> data = list(map(Decimal, '1.34 1.87 3.45 2.35 1.00 0.03 9.25'.split()))\n" ">>> max(data)\n" @@ -369,6 +412,31 @@ msgid "" ">>> c % a\n" "Decimal('0.77')" msgstr "" +">>> data = list(map(Decimal, '1.34 1.87 3.45 2.35 1.00 0.03 9.25'.split()))\n" +">>> max(data)\n" +"Decimal('9.25')\n" +">>> min(data)\n" +"Decimal('0.03')\n" +">>> sorted(data)\n" +"[Decimal('0.03'), Decimal('1.00'), Decimal('1.34'), Decimal('1.87'),\n" +" Decimal('2.35'), Decimal('3.45'), Decimal('9.25')]\n" +">>> sum(data)\n" +"Decimal('19.29')\n" +">>> a,b,c = data[:3]\n" +">>> str(a)\n" +"'1.34'\n" +">>> float(a)\n" +"1.34\n" +">>> round(a, 1)\n" +"Decimal('1.3')\n" +">>> int(a)\n" +"1\n" +">>> a * 5\n" +"Decimal('6.70')\n" +">>> a * b\n" +"Decimal('2.5058')\n" +">>> c % a\n" +"Decimal('0.77')" #: ../../library/decimal.rst:241 msgid "And some mathematical functions are also available to Decimal:" @@ -415,7 +483,6 @@ msgstr "" "ます。前者はほとんどのトラップが有効になっており、とりわけデバッグの際に便利" "です:" -#: ../../library/decimal.rst:275 msgid "" ">>> myothercontext = Context(prec=60, rounding=ROUND_HALF_DOWN)\n" ">>> setcontext(myothercontext)\n" @@ -438,6 +505,26 @@ msgid "" " Decimal(42) / Decimal(0)\n" "DivisionByZero: x / 0" msgstr "" +">>> myothercontext = Context(prec=60, rounding=ROUND_HALF_DOWN)\n" +">>> setcontext(myothercontext)\n" +">>> Decimal(1) / Decimal(7)\n" +"Decimal('0.142857142857142857142857142857142857142857142857142857142857')\n" +"\n" +">>> ExtendedContext\n" +"Context(prec=9, rounding=ROUND_HALF_EVEN, Emin=-999999, Emax=999999,\n" +" capitals=1, clamp=0, flags=[], traps=[])\n" +">>> setcontext(ExtendedContext)\n" +">>> Decimal(1) / Decimal(7)\n" +"Decimal('0.142857143')\n" +">>> Decimal(42) / Decimal(0)\n" +"Decimal('Infinity')\n" +"\n" +">>> setcontext(BasicContext)\n" +">>> Decimal(42) / Decimal(0)\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in -toplevel-\n" +" Decimal(42) / Decimal(0)\n" +"DivisionByZero: x / 0" #: ../../library/decimal.rst:299 msgid "" @@ -451,7 +538,6 @@ msgstr "" "す。そのため、フラグのモニタを行いたいような演算の前には :meth:`~Context." "clear_flags` メソッドでフラグをクリアしておくのがベストです。 ::" -#: ../../library/decimal.rst:304 msgid "" ">>> setcontext(ExtendedContext)\n" ">>> getcontext().clear_flags()\n" @@ -461,6 +547,13 @@ msgid "" "Context(prec=9, rounding=ROUND_HALF_EVEN, Emin=-999999, Emax=999999,\n" " capitals=1, clamp=0, flags=[Inexact, Rounded], traps=[])" msgstr "" +">>> setcontext(ExtendedContext)\n" +">>> getcontext().clear_flags()\n" +">>> Decimal(355) / Decimal(113)\n" +"Decimal('3.14159292')\n" +">>> getcontext()\n" +"Context(prec=9, rounding=ROUND_HALF_EVEN, Emin=-999999, Emax=999999,\n" +" capitals=1, clamp=0, flags=[Inexact, Rounded], traps=[])" #: ../../library/decimal.rst:312 msgid "" @@ -480,7 +573,6 @@ msgstr "" "コンテキストの :attr:`~Context.traps` 属性に入っている辞書を使うと、個々のト" "ラップをセットできます:" -#: ../../library/decimal.rst:319 msgid "" ">>> setcontext(ExtendedContext)\n" ">>> Decimal(1) / Decimal(0)\n" @@ -492,6 +584,15 @@ msgid "" " Decimal(1) / Decimal(0)\n" "DivisionByZero: x / 0" msgstr "" +">>> setcontext(ExtendedContext)\n" +">>> Decimal(1) / Decimal(0)\n" +"Decimal('Infinity')\n" +">>> getcontext().traps[DivisionByZero] = 1\n" +">>> Decimal(1) / Decimal(0)\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in -toplevel-\n" +" Decimal(1) / Decimal(0)\n" +"DivisionByZero: x / 0" #: ../../library/decimal.rst:331 msgid "" @@ -503,9 +604,9 @@ msgid "" msgstr "" "ほとんどのプログラムでは、開始時に一度だけ現在の演算コンテキストを修正しま" "す。また、多くのアプリケーションでは、データから :class:`Decimal` への変換は" -"ループ内で一度だけキャストして行います。コンテキストを設定し、 :class:" -"`Decimal` オブジェクトを生成できたら、ほとんどのプログラムは他の Python 数値" -"型と全く変わらないかのように :class:`Decimal` を操作できます。" +"ループ内で一度だけキャストして行います。コンテキストを設定し、 ``Decimal`` オ" +"ブジェクトを生成できたら、ほとんどのプログラムは他の Python 数値型と全く変わ" +"らないかのように ``Decimal`` を操作できます。" #: ../../library/decimal.rst:343 msgid "Decimal objects" @@ -528,7 +629,6 @@ msgstr "" "す。 *value* が文字列の場合、先頭と末尾の空白および全てのアンダースコアを取り" "除いた後には以下の 10進数文字列の文法に従わなければなりません::" -#: ../../library/decimal.rst:355 msgid "" "sign ::= '+' | '-'\n" "digit ::= '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | " @@ -542,8 +642,18 @@ msgid "" "numeric-value ::= decimal-part [exponent-part] | infinity\n" "numeric-string ::= [sign] numeric-value | [sign] nan" msgstr "" +"sign ::= '+' | '-'\n" +"digit ::= '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | " +"'9'\n" +"indicator ::= 'e' | 'E'\n" +"digits ::= digit [digit]...\n" +"decimal-part ::= digits '.' [digits] | ['.'] digits\n" +"exponent-part ::= indicator [sign] digits\n" +"infinity ::= 'Infinity' | 'Inf'\n" +"nan ::= 'NaN' [digits] | 'sNaN' [digits]\n" +"numeric-value ::= decimal-part [exponent-part] | infinity\n" +"numeric-string ::= [sign] numeric-value | [sign] nan" -#: ../../library/decimal.rst:366 msgid "" "Other Unicode decimal digits are also permitted where ``digit`` appears " "above. These include decimal digits from various other alphabets (for " @@ -552,6 +662,11 @@ msgid "" "example, ``inf``, ``Inf``, ``INFINITY``, and ``iNfINity`` are all acceptable " "spellings for positive infinity." msgstr "" +"上記の ``digit`` には、他の Unicode の 10 進数字も使えます。\n" +"例えばアラビア・インド数字やデーヴァナーガリー数字など、さまざまな文字体系の " +"10 進数字や、全角数字 ``'\\uff10'`` から ``'\\uff19'`` が含まれます。\n" +"大文字・小文字は区別しないので、例えば ``inf``、``Inf``、``INFINITY``、" +"``iNfINity`` はすべて正の無限大を表す表記として使えます。" #: ../../library/decimal.rst:373 msgid "" @@ -565,7 +680,6 @@ msgstr "" "を表す整数でなければなりません。例えば、 ``Decimal((0, (1, 4, 1, 4), -3))`` " "は ``Decimal('1.414')`` を返します。" -#: ../../library/decimal.rst:378 msgid "" "If *value* is a :class:`float`, the binary floating-point value is " "losslessly converted to its exact decimal equivalent. This conversion can " @@ -573,6 +687,12 @@ msgid "" "``Decimal(float('1.1'))`` converts to " "``Decimal('1.100000000000000088817841970012523233890533447265625')``." msgstr "" +"*value* が :class:`float` の場合、その 2 進浮動小数点数の値を、損失なく正確に" +"対応する 10 進数へ変換します。\n" +"この変換には 53 桁以上の精度が必要になることもよくあります。\n" +"例えば ``Decimal(float('1.1'))`` は " +"``Decimal('1.100000000000000088817841970012523233890533447265625')`` に変換さ" +"れます。" #: ../../library/decimal.rst:384 msgid "" @@ -596,7 +716,7 @@ msgstr "" "*context* 引数の目的は、 *value* が正しくない形式の文字列であった場合に行う処" "理を決めることにあります; 演算コンテキストが :const:`InvalidOperation` をト" "ラップするようになっていれば、例外を送出します。それ以外の場合には、コンスト" -"ラクタは値が ``NaN`` の :class:`Decimal` を返します。" +"ラクタは値が ``NaN`` の ``Decimal`` を返します。" #: ../../library/decimal.rst:394 msgid "Once constructed, :class:`Decimal` objects are immutable." @@ -628,7 +748,6 @@ msgstr "" "コード中の整数リテラルや浮動小数点リテラルと同様に、アンダースコアを用いて桁" "をグルーピングできます。" -#: ../../library/decimal.rst:408 msgid "" "Decimal floating-point objects share many properties with the other built-in " "numeric types such as :class:`float` and :class:`int`. All of the usual " @@ -637,6 +756,11 @@ msgid "" "compared, sorted, and coerced to another type (such as :class:`float` or :" "class:`int`)." msgstr "" +"10 進浮動小数点オブジェクトは、:class:`float` や :class:`int` などの他の組み" +"込み数値型と多くの性質を共有しています。\n" +"通常の数学演算や特殊メソッドはすべて利用できます。\n" +"また、コピー、pickle 化、表示、辞書のキーや集合の要素としての利用、比較、ソー" +"ト、他の型 (:class:`float` や :class:`int` など) への変換もできます。" #: ../../library/decimal.rst:415 msgid "" @@ -649,13 +773,16 @@ msgstr "" "す。十進オブジェクトに対して剰余演算を適用すると、計算結果の符号は除数の符号" "ではなく *被除数* の符号と一致します::" -#: ../../library/decimal.rst:420 msgid "" ">>> (-7) % 4\n" "1\n" ">>> Decimal(-7) % Decimal(4)\n" "Decimal('-3')" msgstr "" +">>> (-7) % 4\n" +"1\n" +">>> Decimal(-7) % Decimal(4)\n" +"Decimal('-3')" #: ../../library/decimal.rst:425 msgid "" @@ -667,13 +794,16 @@ msgstr "" "めた) 整数部分を返します。そのため通常の恒等式 ``x == (x // y) * y + x % y`` " "が維持されます::" -#: ../../library/decimal.rst:429 msgid "" ">>> -7 // 4\n" "-2\n" ">>> Decimal(-7) // Decimal(4)\n" "Decimal('-1')" msgstr "" +">>> -7 // 4\n" +"-2\n" +">>> Decimal(-7) // Decimal(4)\n" +"Decimal('-1')" #: ../../library/decimal.rst:434 msgid "" @@ -708,11 +838,12 @@ msgstr "" ":class:`Decimal` インスタンスと他の数値型が混在する比較が完全にサポートされる" "ようになりました。" -#: ../../library/decimal.rst:450 msgid "" "In addition to the standard numeric properties, decimal floating-point " "objects also have a number of specialized methods:" msgstr "" +"10 進浮動小数点オブジェクトには、標準的な数値の性質に加えて、次のような専用メ" +"ソッドがあります:" #: ../../library/decimal.rst:456 msgid "" @@ -734,11 +865,12 @@ msgstr "" "与えられた :class:`Decimal` インスタンスを、既約分数で分母が正数の分数として" "表現した整数のペア ``(n, d)`` を返します。" -#: ../../library/decimal.rst:467 msgid "" ">>> Decimal('-3.14').as_integer_ratio()\n" "(-157, 50)" msgstr "" +">>> Decimal('-3.14').as_integer_ratio()\n" +"(-157, 50)" #: ../../library/decimal.rst:470 msgid "" @@ -748,13 +880,12 @@ msgstr "" "変換は正確に行われます。無限大に対してはOverflowErrorを、NaNに対しては" "ValueError を送出します。" -#: ../../library/decimal.rst:477 msgid "" "Return a :term:`named tuple` representation of the number: " "``DecimalTuple(sign, digits, exponent)``." msgstr "" "数値を表現するための :term:`名前付きタプル `: " -"``DecimalTuple(sign, digittuple, exponent)`` を返します。" +"``DecimalTuple(sign, digits, exponent)`` を返します。" #: ../../library/decimal.rst:483 msgid "" @@ -774,13 +905,16 @@ msgstr "" "二つの Decimal インスタンスの値を比較します。 :meth:`compare` は Decimal イン" "スタンスを返し、被演算子のどちらかが NaN ならば結果は NaN です::" -#: ../../library/decimal.rst:493 msgid "" "a or b is a NaN ==> Decimal('NaN')\n" "a < b ==> Decimal('-1')\n" "a == b ==> Decimal('0')\n" "a > b ==> Decimal('1')" msgstr "" +"a または b が NaN ==> Decimal('NaN')\n" +"a < b ==> Decimal('-1')\n" +"a == b ==> Decimal('0')\n" +"a > b ==> Decimal('1')" #: ../../library/decimal.rst:500 msgid "" @@ -880,13 +1014,13 @@ msgstr "" "与えられた数での(自然)指数関数 ``e**x`` の値を返します。結果は :const:" "`ROUND_HALF_EVEN` 丸めモードで正しく丸められます。" -#: ../../library/decimal.rst:578 msgid "" "Alternative constructor that only accepts instances of :class:`float` or :" "class:`int`." msgstr "" +":class:`float` または :class:`int` のインスタンスだけを受け付ける、別形式のコ" +"ンストラクタです。" -#: ../../library/decimal.rst:581 msgid "" "Note ``Decimal.from_float(0.1)`` is not the same as ``Decimal('0.1')``. " "Since 0.1 is not exactly representable in binary floating point, the value " @@ -895,8 +1029,10 @@ msgid "" "``0.1000000000000000055511151231257827021181583404541015625``." msgstr "" "なお、``Decimal.from_float(0.1)`` は ``Decimal('0.1')`` と同じではありませ" -"ん。0.1 は二進浮動小数点数で正確に表せないので、その値は表現できる最も近い" -"値、``0x1.999999999999ap-4`` として記憶されます。浮動小数点数での等価な値は " +"ん。\n" +"0.1 は二進浮動小数点数で正確に表せないので、その値は表現できる最も近い値、" +"``0x1.999999999999ap-4`` として記憶されます。\n" +"同じ値を十進数で表すと " "``0.1000000000000000055511151231257827021181583404541015625`` です。" #: ../../library/decimal.rst:587 @@ -907,7 +1043,6 @@ msgstr "" "Python 3.2 以降では、 :class:`Decimal` インスタンスは :class:`float` から直接" "構成できるようになりました。" -#: ../../library/decimal.rst:590 msgid "" ">>> Decimal.from_float(0.1)\n" "Decimal('0.1000000000000000055511151231257827021181583404541015625')\n" @@ -918,14 +1053,22 @@ msgid "" ">>> Decimal.from_float(float('-inf'))\n" "Decimal('-Infinity')" msgstr "" +">>> Decimal.from_float(0.1)\n" +"Decimal('0.1000000000000000055511151231257827021181583404541015625')\n" +">>> Decimal.from_float(float('nan'))\n" +"Decimal('NaN')\n" +">>> Decimal.from_float(float('inf'))\n" +"Decimal('Infinity')\n" +">>> Decimal.from_float(float('-inf'))\n" +"Decimal('-Infinity')" -#: ../../library/decimal.rst:605 msgid "" "Alternative constructor that only accepts instances of :class:`float`, :" "class:`int` or :class:`Decimal`, but not strings or tuples." msgstr "" +":class:`float`、:class:`int`、:class:`Decimal` のインスタンスだけを受け付け、" +"文字列やタプルは受け付けない、別形式のコンストラクタです。" -#: ../../library/decimal.rst:609 msgid "" ">>> Decimal.from_number(314)\n" "Decimal('314')\n" @@ -934,6 +1077,12 @@ msgid "" ">>> Decimal.from_number(Decimal('3.14'))\n" "Decimal('3.14')" msgstr "" +">>> Decimal.from_number(314)\n" +"Decimal('314')\n" +">>> Decimal.from_number(0.1)\n" +"Decimal('0.1000000000000000055511151231257827021181583404541015625')\n" +">>> Decimal.from_number(Decimal('3.14'))\n" +"Decimal('3.14')" #: ../../library/decimal.rst:622 msgid "" @@ -1041,7 +1190,6 @@ msgstr "" "演算対象の底 10 の対数を返します。結果は :const:`ROUND_HALF_EVEN` 丸めモード" "で正しく丸められます。" -#: ../../library/decimal.rst:691 msgid "" "For a nonzero number, return the adjusted exponent of its operand as a :" "class:`Decimal` instance. If the operand is a zero then ``Decimal('-" @@ -1049,9 +1197,10 @@ msgid "" "the operand is an infinity then ``Decimal('Infinity')`` is returned." msgstr "" "非零の数値については、 :class:`Decimal` インスタンスとして調整された指数を返" -"します。演算対象がゼロだった場合、 ``Decimal('-Infinity')`` が返され :const:" -"`DivisionByZero` フラグが送出されます。演算対象が無限大だった場合、 " -"``Decimal('Infinity')`` が返されます。" +"します。\n" +"演算対象がゼロだった場合、 ``Decimal('-Infinity')`` が返され :const:" +"`DivisionByZero` フラグがセットされます。\n" +"演算対象が無限大だった場合、 ``Decimal('Infinity')`` が返されます。" #: ../../library/decimal.rst:699 msgid "" @@ -1148,13 +1297,13 @@ msgstr "" "向の数を返します。もし両者が数値的に等しければ、二つめの対象の符号を採った一" "つめの対象のコピーを返します。" -#: ../../library/decimal.rst:765 msgid "" "Used for producing canonical values of an equivalence class within either " "the current context or the specified context." msgstr "" +"現在のコンテキストまたは指定したコンテキスト内で、同値類の標準形となる値を生" +"成するために使います。" -#: ../../library/decimal.rst:768 msgid "" "This has the same semantics as the unary plus operation, except that if the " "final result is finite it is reduced to its simplest form, with all trailing " @@ -1163,22 +1312,27 @@ msgid "" "exponent is incremented by 1. Otherwise (the coefficient is zero) the " "exponent is set to 0. In all cases the sign is unchanged." msgstr "" +"単項プラス演算と同じ意味を持ちますが、最終結果が有限の場合は、末尾のゼロをす" +"べて取り除き、符号を保ったまま最も単純な形にします。\n" +"具体的には、係数がゼロでない 10 の倍数である間、係数を 10 で割って指数を 1 増" +"やします。\n" +"それ以外 (係数がゼロ) の場合は指数を 0 にします。\n" +"いずれの場合も符号は変わりません。" -#: ../../library/decimal.rst:775 msgid "" "For example, ``Decimal('32.100')`` and ``Decimal('0.321000e+2')`` both " "normalize to the equivalent value ``Decimal('32.1')``." msgstr "" +"例えば ``Decimal('32.100')`` と ``Decimal('0.321000e+2')`` は、どちらも同じ値" +"を持つ ``Decimal('32.1')`` に正規化されます。" -#: ../../library/decimal.rst:778 msgid "Note that rounding is applied *before* reducing to simplest form." -msgstr "" +msgstr "最も単純な形にする *前に* 丸めが適用されます。" -#: ../../library/decimal.rst:780 msgid "" "In the latest versions of the specification, this operation is also known as " "``reduce``." -msgstr "" +msgstr "この演算は、新しい版の仕様では ``reduce`` とも呼ばれています。" #: ../../library/decimal.rst:785 msgid "" @@ -1307,7 +1461,6 @@ msgstr "" msgid "If the result is zero then its sign will be the sign of *self*." msgstr "結果が0になる場合の符号は *self* の符号と同じになります。" -#: ../../library/decimal.rst:851 msgid "" "Return the result of rotating the digits of the first operand by an amount " "specified by the second operand. The second operand must be an integer in " @@ -1318,12 +1471,15 @@ msgid "" "length precision if necessary. The sign and exponent of the first operand " "are unchanged." msgstr "" -"一つ目の演算対象の数字を二つ目で指定された量だけ巡回(rotate)した結果を返しま" -"す。二つめの演算対象は -precision から precision までの範囲の整数でなければな" -"りません。この二つ目の演算対象の絶対値を何桁ずらすかを決めます。そしてもし正" -"の数ならば巡回の方向は左に、そうでなければ右になります。一つ目の演算対象の仮" -"数部は必要ならば精度いっぱいまでゼロで埋められます。符号と指数は変えられませ" -"ん。" +"1 つ目の演算対象の数字を、2 つ目の演算対象で指定した桁数だけ巡回させた結果を" +"返します。\n" +"2 つ目の演算対象は -precision から precision までの整数でなければなりませ" +"ん。\n" +"その絶対値が巡回させる桁数を表し、正なら左へ、それ以外なら右へ巡回させま" +"す。\n" +"必要に応じて 1 つ目の演算対象の係数の左側をゼロで埋め、長さを precision に揃" +"えます。\n" +"1 つ目の演算対象の符号と指数は変わりません。" #: ../../library/decimal.rst:862 msgid "" @@ -1343,7 +1499,6 @@ msgstr "" "が、一つめの演算対象を ``10**other`` 倍したものを返します。二つ目の演算対象は" "整数でなければなりません。" -#: ../../library/decimal.rst:877 msgid "" "Return the result of shifting the digits of the first operand by an amount " "specified by the second operand. The second operand must be an integer in " @@ -1353,11 +1508,14 @@ msgid "" "right. Digits shifted into the coefficient are zeros. The sign and " "exponent of the first operand are unchanged." msgstr "" -"一つ目の演算対象の数字を二つ目で指定された量だけシフトした結果を返します。二" -"つ目の演算対象は -precision から precision までの範囲の整数でなければなりませ" -"ん。この二つ目の演算対象の絶対値が何桁ずらすかを決めます。そしてもし正の数な" -"らばシフトの方向は左に、そうでなければ右になります。一つ目の演算対象の係数は" -"必要ならば精度いっぱいまでゼロで埋められます。符号と指数は変えられません。" +"1 つ目の演算対象の数字を、2 つ目の演算対象で指定した桁数だけシフトした結果を" +"返します。\n" +"2 つ目の演算対象は -precision から precision までの整数でなければなりませ" +"ん。\n" +"その絶対値がシフトする桁数を表し、正なら左へ、それ以外なら右へシフトしま" +"す。\n" +"シフトによって係数に入る数字はゼロです。\n" +"1 つ目の演算対象の符号と指数は変わりません。" #: ../../library/decimal.rst:887 msgid "Return the square root of the argument to full precision." @@ -1368,15 +1526,14 @@ msgid "" "Convert to a string, using engineering notation if an exponent is needed." msgstr "文字列に変換します。指数が必要なら工学表記が使われます。" -#: ../../library/decimal.rst:894 ../../library/decimal.rst:1551 msgid "" "Engineering notation has an exponent which is a multiple of 3. This can " "leave up to 3 digits to the left of the decimal place and may require the " "addition of either one or two trailing zeros." msgstr "" -"工学表記法では指数は 3 の倍数になります。これにより、基数の小数部には最大で " -"3 桁までの数字が残されるとともに、末尾に 1 つまたは 2 つの 0 の付加が必要とさ" -"れるかもしれません。" +"工学表記法では指数が 3 の倍数になります。\n" +"そのため、小数点の左側には最大 3 桁の数字が残り、末尾にゼロを 1 つまたは 2 つ" +"追加する必要が生じることがあります。" #: ../../library/decimal.rst:898 msgid "" @@ -1415,17 +1572,21 @@ msgstr "" "値を丸めます。 *rounding* が指定されていれば適用されます; それ以外の場合、値" "丸めの方法は *context* の設定か現在のコンテキストの設定になります。" -#: ../../library/decimal.rst:919 msgid "Decimal numbers can be rounded using the :func:`.round` function:" -msgstr "" +msgstr "Decimal の数値は :func:`.round` 関数で丸められます:" -#: ../../library/decimal.rst:924 msgid "" "If *ndigits* is not given or ``None``, returns the nearest :class:`int` to " "*number*, rounding ties to even, and ignoring the rounding mode of the :" "class:`Decimal` context. Raises :exc:`OverflowError` if *number* is an " "infinity or :exc:`ValueError` if it is a (quiet or signaling) NaN." msgstr "" +"*ndigits* を指定しないか ``None`` にすると、*number* に最も近い :class:`int` " +"を返します。\n" +"ちょうど中間なら偶数に丸め、:class:`Decimal` のコンテキストの丸めモードは無視" +"します。\n" +"*number* が無限大なら :exc:`OverflowError` を、無言 NaN または発信 NaN なら :" +"exc:`ValueError` を送出します。" #: ../../library/decimal.rst:930 msgid "" @@ -1439,27 +1600,26 @@ msgid "" "the current context's precision. In other words, for the non-corner cases:" msgstr "" -#: ../../library/decimal.rst:940 msgid "" "if *ndigits* is positive, return *number* rounded to *ndigits* decimal " "places;" msgstr "" +"*ndigits* が正なら、*number* を小数点以下 *ndigits* 桁に丸めて返します。" -#: ../../library/decimal.rst:942 msgid "if *ndigits* is zero, return *number* rounded to the nearest integer;" -msgstr "" +msgstr "*ndigits* がゼロなら、*number* を最も近い整数に丸めて返します。" -#: ../../library/decimal.rst:943 msgid "" "if *ndigits* is negative, return *number* rounded to the nearest multiple of " "``10**abs(ndigits)``." msgstr "" +"*ndigits* が負なら、*number* を最も近い ``10**abs(ndigits)`` の倍数に丸めて返" +"します。" #: ../../library/decimal.rst:946 msgid "For example::" msgstr "例えば::" -#: ../../library/decimal.rst:948 msgid "" ">>> from decimal import Decimal, getcontext, ROUND_DOWN\n" ">>> getcontext().rounding = ROUND_DOWN\n" @@ -1474,6 +1634,18 @@ msgid "" ">>> round(Decimal('3.75'), -1)\n" "Decimal('0E+1')" msgstr "" +">>> from decimal import Decimal, getcontext, ROUND_DOWN\n" +">>> getcontext().rounding = ROUND_DOWN\n" +">>> round(Decimal('3.75')) # コンテキストの丸めモードは無視します\n" +"4\n" +">>> round(Decimal('3.5')) # 中間値は偶数に丸めます\n" +"4\n" +">>> round(Decimal('3.75'), 0) # コンテキストの丸めモードを使います\n" +"Decimal('3')\n" +">>> round(Decimal('3.75'), 1)\n" +"Decimal('3.7')\n" +">>> round(Decimal('3.75'), -1)\n" +"Decimal('0E+1')" #: ../../library/decimal.rst:965 msgid "Logical operands" @@ -1554,7 +1726,6 @@ msgstr "" "たとえば、以下のコードでは精度を42桁に設定し、計算を実行し、そして元のコンテ" "キストに復帰します::" -#: ../../library/decimal.rst:1012 msgid "" "from decimal import localcontext\n" "\n" @@ -1563,12 +1734,16 @@ msgid "" " s = calculate_something()\n" "s = +s # Round the final result back to the default precision" msgstr "" +"from decimal import localcontext\n" +"\n" +"with localcontext() as ctx:\n" +" ctx.prec = 42 # 高精度で計算します\n" +" s = calculate_something()\n" +"s = +s # 最終結果をデフォルトの精度に丸めます" -#: ../../library/decimal.rst:1019 msgid "Using keyword arguments, the code would be the following::" -msgstr "" +msgstr "キーワード引数を使うと、次のように書けます。 ::" -#: ../../library/decimal.rst:1021 msgid "" "from decimal import localcontext\n" "\n" @@ -1576,35 +1751,45 @@ msgid "" " s = calculate_something()\n" "s = +s" msgstr "" +"from decimal import localcontext\n" +"\n" +"with localcontext(prec=42) as ctx:\n" +" s = calculate_something()\n" +"s = +s" -#: ../../library/decimal.rst:1027 msgid "" "Raises :exc:`TypeError` if *kwargs* supplies an attribute that :class:" "`Context` doesn't support. Raises either :exc:`TypeError` or :exc:" "`ValueError` if *kwargs* supplies an invalid value for an attribute." msgstr "" +"*kwargs* に :class:`Context` がサポートしない属性を渡すと :exc:`TypeError` を" +"送出します。\n" +"*kwargs* に属性の不正な値を渡すと :exc:`TypeError` または :exc:`ValueError` " +"を送出します。" -#: ../../library/decimal.rst:1031 msgid "" ":meth:`localcontext` now supports setting context attributes through the use " "of keyword arguments." msgstr "" +":meth:`localcontext` でキーワード引数を使ってコンテキストの属性を設定できるよ" +"うになりました。" -#: ../../library/decimal.rst:1036 msgid "" "Return a context object initialized to the proper values for one of the IEEE " "interchange formats. The argument must be a multiple of 32 and less than :" "const:`IEEE_CONTEXT_MAX_BITS`." msgstr "" +"IEEE の交換形式のいずれかに適した値で初期化したコンテキストオブジェクトを返し" +"ます。\n" +"引数は 32 の倍数で、:const:`IEEE_CONTEXT_MAX_BITS` 未満でなければなりません。" -#: ../../library/decimal.rst:1042 msgid "" "New contexts can also be created using the :class:`Context` constructor " "described below. In addition, the module provides three pre-made contexts:" msgstr "" "新たなコンテキストは、以下で説明する :class:`Context` コンストラクタを使って" -"生成できます。その他にも、 :mod:`decimal` モジュールでは作成済みのコンテキス" -"トを提供しています:" +"作成できます。\n" +"このほか、モジュールは作成済みのコンテキストを 3 つ提供しています。" #: ../../library/decimal.rst:1048 msgid "" @@ -1701,48 +1886,53 @@ msgstr "" "上に挙げた三つのコンテキストに加え、 :class:`Context` コンストラクタを使って" "新たなコンテキストを生成できます。" -#: ../../library/decimal.rst:1095 msgid "" "Creates a new context. If a field is not specified or is :const:`None`, the " "default values are copied from the :const:`DefaultContext`. If the *flags* " "field is not specified or is :const:`None`, all flags are cleared." msgstr "" -"新たなコンテキストを生成します。あるフィールドが定義されていないか :const:" -"`None` であれば、 :const:`DefaultContext` からデフォルト値をコピーします。 " -"*flags* フィールドが設定されていいか :const:`None` の場合には、全てのフラグが" -"クリアされます。" +"新たなコンテキストを生成します。\n" +"あるフィールドが定義されていないか :const:`None` であれば、 :const:" +"`DefaultContext` からデフォルト値をコピーします。\n" +"*flags* フィールドが指定されていないか :const:`None` の場合には、全てのフラグ" +"がクリアされます。" -#: ../../library/decimal.rst:1101 msgid "" "An integer in the range [``1``, :const:`MAX_PREC`] that sets the precision " "for arithmetic operations in the context." msgstr "" +"コンテキスト内の算術演算の精度を設定する、[``1``, :const:`MAX_PREC`] の範囲の" +"整数。" -#: ../../library/decimal.rst:1106 msgid "One of the constants listed in the section `Rounding Modes`_." -msgstr "" +msgstr "`Rounding Modes`_ 節に挙げられた定数のいずれか。" -#: ../../library/decimal.rst:1111 msgid "" "Lists of any signals to be set. Generally, new contexts should only set " "traps and leave the flags clear." msgstr "" +"設定するシグナルのリスト。\n" +"通常、新しいコンテキストではトラップだけを設定し、フラグはクリアしたままにし" +"てください。" -#: ../../library/decimal.rst:1117 msgid "" "Integers specifying the outer limits allowable for exponents. *Emin* must be " "in the range [:const:`MIN_EMIN`, ``0``], *Emax* in the range [``0``, :const:" "`MAX_EMAX`]." msgstr "" +"指数に許される範囲の上下限を指定する整数。\n" +"*Emin* は [:const:`MIN_EMIN`, ``0``]、*Emax* は [``0``, :const:`MAX_EMAX`] の" +"範囲でなければなりません。" -#: ../../library/decimal.rst:1123 msgid "" "Either ``0`` or ``1`` (the default). If set to ``1``, exponents are printed " "with a capital ``E``; otherwise, a lowercase ``e`` is used: " "``Decimal('6.02e+23')``." msgstr "" +"``0`` または ``1`` (デフォルト)。\n" +"``1`` にすると指数を大文字の ``E`` で表示し、それ以外では小文字の ``e`` を使" +"います: ``Decimal('6.02e+23')``。" -#: ../../library/decimal.rst:1129 msgid "" "Either ``0`` (the default) or ``1``. If set to ``1``, the exponent ``e`` of " "a :class:`Decimal` instance representable in this context is strictly " @@ -1754,12 +1944,24 @@ msgid "" "exponent constraints; this preserves the value of the number but loses " "information about significant trailing zeros. For example::" msgstr "" +":class:`Decimal` インスタンスをこのコンテキストで表現するときの指数の制約を指" +"定する、``0`` (デフォルト) または ``1``。\n" +"``1`` にすると指数 ``e`` は ``Emin - prec + 1 <= e <= Emax - prec + 1`` の範" +"囲に厳しく制限されます。\n" +"*clamp* が ``0`` の場合は制約が緩く、:class:`Decimal` インスタンスの調整済み" +"指数が :attr:`~Context.Emax` 以下であればよいことになります。\n" +"*clamp* が ``1`` のときは、指数の制約を満たすよう、大きな正規数の指数を可能な" +"限り減らし、その分のゼロを係数に追加します。\n" +"この変換で数値は保たれますが、末尾のゼロの有効桁数に関する情報は失われま" +"す。\n" +"例えば次のようになります。 ::" -#: ../../library/decimal.rst:1140 msgid "" ">>> Context(prec=6, Emax=999, clamp=1).create_decimal('1.23e999')\n" "Decimal('1.23000E+999')" msgstr "" +">>> Context(prec=6, Emax=999, clamp=1).create_decimal('1.23e999')\n" +"Decimal('1.23000E+999')" #: ../../library/decimal.rst:1143 msgid "" @@ -1769,7 +1971,6 @@ msgstr "" "*clamp* の値 ``1`` は、IEEE 754 で規定された固定幅十進交換形式と互換にできま" "す。" -#: ../../library/decimal.rst:1146 msgid "" "The :class:`Context` class defines several general purpose methods as well " "as a large number of methods for doing arithmetic directly in a given " @@ -1781,15 +1982,16 @@ msgid "" "exp(context=C)``. Each :class:`Context` method accepts a Python integer (an " "instance of :class:`int`) anywhere that a Decimal instance is accepted." msgstr "" -":class:`Context` クラスでは、いくつかの汎用のメソッドの他、現在のコンテキスト" -"で算術演算を直接行うためのメソッドを数多く定義しています。加えて、 :class:" -"`Decimal` の各メソッドについて(:meth:`~Decimal.adjusted` および :meth:" -"`~Decimal.as_tuple` メソッドを例外として)対応する :class:`Context` のメソッド" -"が存在します。たとえば、 :class:`Context` インスタンス ``C`` と :class:" -"`Decimal` インスタンス ``x`` に対して、 ``C.exp(x)`` は ``x.exp(context=C)`` " -"と等価です。それぞれの :class:`Context` メソッドは、Decimal インスタンスが受" -"け付けられるところならどこでも、Python の整数 (:class:`int` のインスタンス) " -"を受け付けます。" +":class:`Context` クラスでは、いくつかの汎用のメソッドの他、指定されたコンテキ" +"ストで算術演算を直接行うためのメソッドを数多く定義しています。\n" +"加えて、 :class:`Decimal` の各メソッドについて(:meth:`~Decimal.adjusted` およ" +"び :meth:`~Decimal.as_tuple` メソッドを例外として)対応する :class:`Context` " +"のメソッドが存在します。\n" +"たとえば、 :class:`Context` インスタンス ``C`` と :class:`Decimal` インスタ" +"ンス ``x`` に対して、 ``C.exp(x)`` は ``x.exp(context=C)`` と等価です。\n" +"それぞれの :class:`Context` メソッドは、Decimal インスタンスが受け付けられる" +"ところならどこでも、Python の整数 (:class:`int` のインスタンス) を受け付けま" +"す。" #: ../../library/decimal.rst:1159 msgid "Resets all of the flags to ``0``." @@ -1832,7 +2034,6 @@ msgstr "" "もあります。以下の例は、丸められていない入力を使うということは和にゼロを加え" "ると結果が変わり得るという見本です:" -#: ../../library/decimal.rst:1187 msgid "" ">>> getcontext().prec = 3\n" ">>> Decimal('3.4445') + Decimal('1.0023')\n" @@ -1840,6 +2041,11 @@ msgid "" ">>> Decimal('3.4445') + Decimal(0) + Decimal('1.0023')\n" "Decimal('4.44')" msgstr "" +">>> getcontext().prec = 3\n" +">>> Decimal('3.4445') + Decimal('1.0023')\n" +"Decimal('4.45')\n" +">>> Decimal('3.4445') + Decimal(0) + Decimal('1.0023')\n" +"Decimal('4.44')" #: ../../library/decimal.rst:1195 msgid "" @@ -1863,7 +2069,6 @@ msgstr "" "い、変換にコンテキストの精度、丸めメソッド、フラグ、そしてトラップが適用され" "ます。" -#: ../../library/decimal.rst:1206 msgid "" ">>> context = Context(prec=5, rounding=ROUND_DOWN)\n" ">>> context.create_decimal_from_float(math.pi)\n" @@ -1874,15 +2079,22 @@ msgid "" " ...\n" "decimal.Inexact: None" msgstr "" +">>> context = Context(prec=5, rounding=ROUND_DOWN)\n" +">>> context.create_decimal_from_float(math.pi)\n" +"Decimal('3.1415')\n" +">>> context = Context(prec=5, traps=[Inexact])\n" +">>> context.create_decimal_from_float(math.pi)\n" +"Traceback (most recent call last):\n" +" ...\n" +"decimal.Inexact: None" -#: ../../library/decimal.rst:1221 msgid "" "Returns a value equal to ``Emin - prec + 1`` which is the minimum exponent " "value for subnormal results. When underflow occurs, the exponent is set to :" "const:`Etiny`." msgstr "" -"``Emin - prec + 1`` に等しい値を返します。演算結果の劣化が起こる桁の最小値で" -"す。アンダーフローが起きた場合、指数は :const:`Etiny` に設定されます。" +"非正規数の演算結果で取り得る最小の指数 ``Emin - prec + 1`` を返します。\n" +"アンダーフローが起きた場合、指数は :const:`Etiny` に設定されます。" #: ../../library/decimal.rst:1227 msgid "Returns a value equal to ``Emax - prec + 1``." @@ -1901,8 +2113,8 @@ msgstr "" "を生成して、算術演算を適用するというアプローチをとります。演算はアクティブな" "スレッドにおける現在のコンテキストの下で行われます。もう一つのアプローチは、" "コンテキストのメソッドを使った特定のコンテキスト下での計算です。コンテキスト" -"のメソッドは :class:`Decimal` クラスのメソッドに似ているので、ここでは簡単な" -"説明にとどめます。" +"のメソッドは ``Decimal`` クラスのメソッドに似ているので、ここでは簡単な説明に" +"とどめます。" #: ../../library/decimal.rst:1239 msgid "Returns the absolute value of *x*." @@ -2114,11 +2326,12 @@ msgstr "" "ンテキストの丸めモードを使って丸められます。結果は常に、Python バージョンにお" "いて正しく丸められます。" -#: ../../library/decimal.rst:1469 msgid "" "``Decimal(0) ** Decimal(0)`` results in ``InvalidOperation``, and if " "``InvalidOperation`` is not trapped, then results in ``Decimal('NaN')``." msgstr "" +"``Decimal(0) ** Decimal(0)`` は ``InvalidOperation`` を発生させます。\n" +"``InvalidOperation`` をトラップしない場合は ``Decimal('NaN')`` になります。" #: ../../library/decimal.rst:1472 msgid "" @@ -2209,17 +2422,15 @@ msgstr "一つめの演算対象の指数部に二つめの値を加えたもの msgid "Returns a shifted copy of *x*, *y* times." msgstr "*x* を *y* 回シフトしたコピーを返します。" -#: ../../library/decimal.rst:1539 msgid "Square root of a non-negative number to context precision." -msgstr "*x* の平方根を精度いっぱいまで求めます。" +msgstr "非負の数の平方根をコンテキストの精度で求めます。" #: ../../library/decimal.rst:1544 msgid "Return the difference between *x* and *y*." msgstr "*x* と *y* の間の差を返します。" -#: ../../library/decimal.rst:1558 msgid "Rounds to an integer." -msgstr "最近傍の整数に値を丸めます。" +msgstr "整数に丸めます。" #: ../../library/decimal.rst:1563 msgid "Converts a number to a string using scientific notation." @@ -2269,13 +2480,11 @@ msgstr "``-849999999``" msgid "``-1999999999999999997``" msgstr "``-1999999999999999997``" -#: ../../library/decimal.rst:1586 msgid "``256``" -msgstr "" +msgstr "``256``" -#: ../../library/decimal.rst:1586 msgid "``512``" -msgstr "" +msgstr "``512``" #: ../../library/decimal.rst:1591 msgid "" @@ -2284,7 +2493,6 @@ msgstr "" "値は ``True`` です。現在のPythonは常にスレッドを持っているので、非推奨になり" "ました。" -#: ../../library/decimal.rst:1597 msgid "" "The default value is ``True``. If Python is :option:`configured using the --" "without-decimal-contextvar option <--without-decimal-contextvar>`, the C " @@ -2292,6 +2500,11 @@ msgid "" "value is ``False``. This is slightly faster in some nested context " "scenarios." msgstr "" +"デフォルト値は ``True`` です。\n" +"Python を :option:`--without-decimal-contextvar オプションで構成 <--without-" +"decimal-contextvar>` した場合、C 版はコルーチンローカルではなくスレッドローカ" +"ルのコンテキストを使い、値は ``False`` になります。\n" +"コンテキストを入れ子にする一部の状況では、こちらの方がわずかに高速です。" #: ../../library/decimal.rst:1606 msgid "Rounding modes" @@ -2535,7 +2748,6 @@ msgstr "" msgid "The following table summarizes the hierarchy of signals::" msgstr "これらのシグナルの階層構造をまとめると、以下の表のようになります::" -#: ../../library/decimal.rst:1766 msgid "" "exceptions.ArithmeticError(exceptions.Exception)\n" " DecimalException\n" @@ -2549,10 +2761,20 @@ msgid "" " Subnormal\n" " FloatOperation(DecimalException, exceptions.TypeError)" msgstr "" +"exceptions.ArithmeticError(exceptions.Exception)\n" +" DecimalException\n" +" Clamped\n" +" DivisionByZero(DecimalException, exceptions.ZeroDivisionError)\n" +" Inexact\n" +" Overflow(Inexact, Rounded)\n" +" Underflow(Inexact, Rounded, Subnormal)\n" +" InvalidOperation\n" +" Rounded\n" +" Subnormal\n" +" FloatOperation(DecimalException, exceptions.TypeError)" -#: ../../library/decimal.rst:1785 msgid "Floating-point notes" -msgstr "" +msgstr "浮動小数点に関する注意点" #: ../../library/decimal.rst:1789 msgid "Mitigating round-off error with increased precision" @@ -2569,7 +2791,6 @@ msgstr "" "に表現できるようになります); しかし、ゼロでない桁が一定の精度を越えている場合" "には、演算によっては依然として値丸めによる誤差を引き起こします。" -#: ../../library/decimal.rst:1795 msgid "" "The effects of round-off error can be amplified by the addition or " "subtraction of nearly offsetting quantities resulting in loss of " @@ -2577,8 +2798,11 @@ msgid "" "floating-point arithmetic with insufficient precision causes the breakdown " "of the associative and distributive properties of addition:" msgstr "" +"ほぼ相殺する量を加減算すると、丸め誤差の影響が増幅され、桁落ちが生じることが" +"あります。\n" +"Knuth は、精度の足りない浮動小数点演算の丸めによって、加算の結合法則や分配法" +"則が成り立たなくなる 2 つの示唆に富む例を挙げています:" -#: ../../library/decimal.rst:1801 msgid "" "# Examples from Seminumerical Algorithms, Section 4.2.2.\n" ">>> from decimal import Decimal, getcontext\n" @@ -2596,6 +2820,21 @@ msgid "" ">>> u * (v+w)\n" "Decimal('0.0060000')" msgstr "" +"# Seminumerical Algorithms の 4.2.2 節の例。\n" +">>> from decimal import Decimal, getcontext\n" +">>> getcontext().prec = 8\n" +"\n" +">>> u, v, w = Decimal(11111113), Decimal(-11111111), Decimal('7.51111111')\n" +">>> (u + v) + w\n" +"Decimal('9.5111111')\n" +">>> u + (v + w)\n" +"Decimal('10')\n" +"\n" +">>> u, v, w = Decimal(20000), Decimal(-6), Decimal('6.0000003')\n" +">>> (u*v) + (u*w)\n" +"Decimal('0.01')\n" +">>> u * (v+w)\n" +"Decimal('0.0060000')" #: ../../library/decimal.rst:1819 msgid "" @@ -2605,7 +2844,6 @@ msgstr "" ":mod:`decimal` モジュールでは、最下桁を失わないように十分に計算精度を広げるこ" "とで、上で問題にしたような恒等性をとりもどせます:" -#: ../../library/decimal.rst:1822 msgid "" ">>> getcontext().prec = 20\n" ">>> u, v, w = Decimal(11111113), Decimal(-11111111), Decimal('7.51111111')\n" @@ -2620,6 +2858,18 @@ msgid "" ">>> u * (v+w)\n" "Decimal('0.0060000')" msgstr "" +">>> getcontext().prec = 20\n" +">>> u, v, w = Decimal(11111113), Decimal(-11111111), Decimal('7.51111111')\n" +">>> (u + v) + w\n" +"Decimal('9.51111111')\n" +">>> u + (v + w)\n" +"Decimal('9.51111111')\n" +">>>\n" +">>> u, v, w = Decimal(20000), Decimal(-6), Decimal('6.0000003')\n" +">>> (u*v) + (u*w)\n" +"Decimal('0.0060000')\n" +">>> u * (v+w)\n" +"Decimal('0.0060000')" #: ../../library/decimal.rst:1839 msgid "Special values" @@ -2727,7 +2977,6 @@ msgstr "" "ロの大きさはやはりゼロなので、正のゼロと負のゼロは等しいとみなされ、符号は単" "なる参考にすぎません。" -#: ../../library/decimal.rst:1884 msgid "" "In addition to the two signed zeros which are distinct yet equal, there are " "various representations of zero with differing precisions yet equivalent in " @@ -2735,6 +2984,11 @@ msgid "" "normalized floating-point representations, it is not immediately obvious " "that the following calculation returns a value equal to zero:" msgstr "" +"表現が異なっても値が等しいこの 2 つの符号付きゼロに加え、精度は異なっても値は" +"等しいゼロの表現がさまざまにあります。\n" +"これには少し慣れが必要です。\n" +"正規化された浮動小数点表現に慣れていると、次の計算がゼロに等しい値を返すこと" +"は一見して分からないかもしれません:" #: ../../library/decimal.rst:1899 msgid "Working with threads" @@ -2760,15 +3014,17 @@ msgstr "" "同様に、:func:`setcontext` 関数は自動的に引数のコンテキストを現在のスレッドの" "コンテキストに設定します。" -#: ../../library/decimal.rst:1908 msgid "" "If :func:`setcontext` has not been called before :func:`getcontext`, then :" "func:`getcontext` will automatically create a new context for use in the " "current thread. New context objects have default values set from the :data:" "`decimal.DefaultContext` object." msgstr "" +":func:`setcontext` を呼ばずに :func:`getcontext` を呼ぶと、:func:" +"`getcontext` は現在のスレッドで使う新しいコンテキストを自動的に作成します。\n" +"新しいコンテキストオブジェクトのデフォルト値は :data:`decimal." +"DefaultContext` オブジェクトから設定されます。" -#: ../../library/decimal.rst:1913 msgid "" "The :data:`sys.flags.thread_inherit_context` flag affects the context for " "new threads. If the flag is false, new threads will start with an empty " @@ -2777,16 +3033,26 @@ msgid "" "is true, new threads will start with a copy of context from the caller of :" "meth:`threading.Thread.start`." msgstr "" +":data:`sys.flags.thread_inherit_context` フラグは、新しいスレッドのコンテキス" +"トに影響します。\n" +"フラグが偽なら、新しいスレッドは空のコンテキストで開始します。\n" +"この場合、:func:`getcontext` を呼ぶと新しいコンテキストオブジェクトを作成し、" +"*DefaultContext* のデフォルト値を使います。\n" +"フラグが真なら、新しいスレッドは :meth:`threading.Thread.start` の呼び出し元" +"のコンテキストのコピーで開始します。" -#: ../../library/decimal.rst:1920 msgid "" "To control the defaults so that each thread will use the same values " "throughout the application, directly modify the *DefaultContext* object. " "This should be done *before* any threads are started so that there won't be " "a race condition between threads calling :func:`getcontext`. For example::" msgstr "" +"アプリケーション全体で各スレッドが同じデフォルト値を使うようにするには、" +"*DefaultContext* オブジェクトを直接変更してください。\n" +"スレッド間で :func:`getcontext` の呼び出しが競合しないように、どのスレッドも" +"開始する *前に* 変更してください。\n" +"例えば次のようにします。 ::" -#: ../../library/decimal.rst:1925 msgid "" "# Set applicationwide defaults for all threads about to be launched\n" "DefaultContext.prec = 12\n" @@ -2801,6 +3067,19 @@ msgid "" "t3.start()\n" " . . ." msgstr "" +"# これから起動する全スレッドに対するアプリケーション共通のデフォルト値を設定" +"します\n" +"DefaultContext.prec = 12\n" +"DefaultContext.rounding = ROUND_DOWN\n" +"DefaultContext.traps = ExtendedContext.traps.copy()\n" +"DefaultContext.traps[InvalidOperation] = 1\n" +"setcontext(DefaultContext)\n" +"\n" +"# その後、スレッドを開始できます\n" +"t1.start()\n" +"t2.start()\n" +"t3.start()\n" +" . . ." #: ../../library/decimal.rst:1944 msgid "Recipes" @@ -3111,11 +3390,12 @@ msgid "" "would suggest:" msgstr "" -#: ../../library/decimal.rst:2225 msgid "" ">>> Decimal(math.pi)\n" "Decimal('3.141592653589793115997963468544185161590576171875')" msgstr "" +">>> Decimal(math.pi)\n" +"Decimal('3.141592653589793115997963468544185161590576171875')" #: ../../library/decimal.rst:2230 msgid "" @@ -3160,7 +3440,6 @@ msgstr "" "get\" (打ち込んだ値が得られる値)という点にあります。入力が丸められないという" "ことを忘れていると結果が奇妙に見えるというのは弱点です:" -#: ../../library/decimal.rst:2247 msgid "" ">>> getcontext().prec = 3\n" ">>> Decimal('3.104') + Decimal('2.104')\n" @@ -3168,6 +3447,11 @@ msgid "" ">>> Decimal('3.104') + Decimal('0.000') + Decimal('2.104')\n" "Decimal('5.20')" msgstr "" +">>> getcontext().prec = 3\n" +">>> Decimal('3.104') + Decimal('2.104')\n" +"Decimal('5.21')\n" +">>> Decimal('3.104') + Decimal('0.000') + Decimal('2.104')\n" +"Decimal('5.20')" #: ../../library/decimal.rst:2255 msgid "" @@ -3177,12 +3461,14 @@ msgstr "" "解決策は、精度を増やすか、単項プラス演算子を使って入力の丸めを強制することで" "す:" -#: ../../library/decimal.rst:2258 msgid "" ">>> getcontext().prec = 3\n" ">>> +Decimal('1.23456789') # unary plus triggers rounding\n" "Decimal('1.23')" msgstr "" +">>> getcontext().prec = 3\n" +">>> +Decimal('1.23456789') # 単項プラスで丸めます\n" +"Decimal('1.23')" #: ../../library/decimal.rst:2264 msgid "" @@ -3209,51 +3495,64 @@ msgid "" "large numbers." msgstr "" -#: ../../library/decimal.rst:2282 msgid "" "The context must be adapted for exact arbitrary precision arithmetic. :attr:" "`~Context.Emin` and :attr:`~Context.Emax` should always be set to the " "maximum values, :attr:`~Context.clamp` should always be 0 (the default). " "Setting :attr:`~Context.prec` requires some care." msgstr "" +"正確な任意精度演算を行うには、コンテキストを調整する必要があります。\n" +":attr:`~Context.Emin` と :attr:`~Context.Emax` は常に範囲が最大になる値に設定" +"し、:attr:`~Context.clamp` は常に 0 (デフォルト) にしてください。\n" +":attr:`~Context.prec` の設定には少し注意が必要です。" -#: ../../library/decimal.rst:2286 msgid "" "The easiest approach for trying out bignum arithmetic is to use the maximum " "value for :attr:`~Context.prec` as well [#]_::" msgstr "" +"多倍長整数の演算を試す最も簡単な方法は、:attr:`~Context.prec` にも最大値を使" +"うことです [#]_。 ::" -#: ../../library/decimal.rst:2289 msgid "" ">>> setcontext(Context(prec=MAX_PREC, Emax=MAX_EMAX, Emin=MIN_EMIN))\n" ">>> x = Decimal(2) ** 256\n" ">>> x / 128\n" "Decimal('904625697166532776746648320380374280103671755200316906558262375061821325312')" msgstr "" +">>> setcontext(Context(prec=MAX_PREC, Emax=MAX_EMAX, Emin=MIN_EMIN))\n" +">>> x = Decimal(2) ** 256\n" +">>> x / 128\n" +"Decimal('904625697166532776746648320380374280103671755200316906558262375061821325312')" -#: ../../library/decimal.rst:2295 msgid "" "For inexact results, :const:`MAX_PREC` is far too large on 64-bit platforms " "and the available memory will be insufficient::" msgstr "" +"結果が不正確な場合、64 ビットプラットフォームでは :const:`MAX_PREC` が大きす" +"ぎるため、利用可能なメモリが足りなくなります。 ::" -#: ../../library/decimal.rst:2298 msgid "" ">>> Decimal(1) / 3\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" "MemoryError" msgstr "" +">>> Decimal(1) / 3\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"MemoryError" -#: ../../library/decimal.rst:2303 msgid "" "On systems with overallocation (e.g. Linux), a more sophisticated approach " "is to adjust :attr:`~Context.prec` to the amount of available RAM. Suppose " "that you have 8GB of RAM and expect 10 simultaneous operands using a maximum " "of 500MB each::" msgstr "" +"メモリの過剰割り当てを行うシステム (Linux など) では、利用可能な RAM の容量に" +"合わせて :attr:`~Context.prec` を調整する方が適切です。\n" +"RAM が 8 GB あり、それぞれ最大 500 MB の演算対象を同時に 10 個使うことを想定" +"しているとします。 ::" -#: ../../library/decimal.rst:2307 msgid "" ">>> import sys\n" ">>>\n" @@ -3276,15 +3575,37 @@ msgid "" " File \"\", line 1, in \n" " decimal.Inexact: []" msgstr "" +">>> import sys\n" +">>>\n" +">>> # 1 つの演算対象が 8 バイトのワード単位で 500 MB を使う場合の最大桁数\n" +">>> # 1 ワードは 19 桁 (32 ビットビルドでは 4 バイトで 9 桁):\n" +">>> maxdigits = 19 * ((500 * 1024**2) // 8)\n" +">>>\n" +">>> # 動作を確認します:\n" +">>> c = Context(prec=maxdigits, Emax=MAX_EMAX, Emin=MIN_EMIN)\n" +">>> c.traps[Inexact] = True\n" +">>> setcontext(c)\n" +">>>\n" +">>> # 利用可能な精度を 9 で埋めます:\n" +">>> x = Decimal(0).logical_invert() * 9\n" +">>> sys.getsizeof(x)\n" +"524288112\n" +">>> x + 2\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +" decimal.Inexact: []" -#: ../../library/decimal.rst:2327 msgid "" "In general (and especially on systems without overallocation), it is " "recommended to estimate even tighter bounds and set the :attr:`Inexact` trap " "if all calculations are expected to be exact." msgstr "" +"すべての計算が正確になるはずなら、一般に (特に過剰割り当てを行わないシステム" +"では)、さらに厳密な上限を見積もり、:attr:`Inexact` トラップを設定することを推" +"奨します。" -#: ../../library/decimal.rst:2336 msgid "" "This approach now works for all exact results except for non-integer powers." msgstr "" +"この方法は、指数が整数でないべき乗を除くすべての正確な結果で使えるようになり" +"ました。" diff --git a/library/development.po b/library/development.po index 2b400eaca..6d9277784 100644 --- a/library/development.po +++ b/library/development.po @@ -17,10 +17,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/development.rst:5 diff --git a/library/devmode.po b/library/devmode.po index d3d0aecf4..2389a9988 100644 --- a/library/devmode.po +++ b/library/devmode.po @@ -17,58 +17,67 @@ msgstr "" "Last-Translator: Yusuke Miyazaki , 2021\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/devmode.rst:4 msgid "Python Development Mode" msgstr "Python 開発モード" -#: ../../library/devmode.rst:8 msgid "" "The Python Development Mode introduces additional runtime checks that are " "too expensive to be enabled by default. It should not be more verbose than " "the default if the code is correct; new warnings are only emitted when an " "issue is detected." msgstr "" +"Python 開発モードは、コストが高すぎてデフォルトでは有効にできない追加の実行時" +"チェックを行います。\n" +"コードが正しければ、デフォルトより多くのメッセージが表示されることはないはず" +"です。\n" +"問題を検出したときだけ新たな警告を出します。" -#: ../../library/devmode.rst:13 msgid "" "It can be enabled using the :option:`-X dev <-X>` command line option or by " "setting the :envvar:`PYTHONDEVMODE` environment variable to ``1``." msgstr "" +":option:`-X dev <-X>` コマンドラインオプションを使うか、:envvar:" +"`PYTHONDEVMODE` 環境変数を ``1`` に設定すると有効にできます。" -#: ../../library/devmode.rst:16 msgid "See also :ref:`Python debug build `." -msgstr "" +msgstr ":ref:`Python のデバッグビルド ` も参照してください。" #: ../../library/devmode.rst:19 msgid "Effects of the Python Development Mode" -msgstr "" +msgstr "Python 開発モードの影響" #: ../../library/devmode.rst:21 msgid "" "Enabling the Python Development Mode is similar to the following command, " "but with additional effects described below::" msgstr "" +"Python 開発モードを有効化することは次のコマンドに似ていますが、以下で説明され" +"る追加の影響があります::" #: ../../library/devmode.rst:24 msgid "" "PYTHONMALLOC=debug PYTHONASYNCIODEBUG=1 python -W default -X faulthandler" msgstr "" +"PYTHONMALLOC=debug PYTHONASYNCIODEBUG=1 python -W default -X faulthandler" #: ../../library/devmode.rst:26 msgid "Effects of the Python Development Mode:" -msgstr "" +msgstr "Python 開発モードの影響:" #: ../../library/devmode.rst:28 msgid "" "Add ``default`` :ref:`warning filter `. The " "following warnings are shown:" msgstr "" +"``default`` の :ref:`警告フィルタ ` を追加しま" +"す。次の警告が表示されます:" #: ../../library/devmode.rst:31 msgid ":exc:`DeprecationWarning`" @@ -91,108 +100,120 @@ msgid "" "Normally, the above warnings are filtered by the default :ref:`warning " "filters `." msgstr "" +"通常、上記の警告は デフォルトの :ref:`警告フィルタ ` によりフィルタリングされます。" -#: ../../library/devmode.rst:39 msgid "" "It behaves as if the :option:`-W default <-W>` command line option is used." msgstr "" +":option:`-W default <-W>` コマンドラインオプションを使った場合と同じ動作にな" +"ります。" -#: ../../library/devmode.rst:41 msgid "" "Use the :option:`-W error <-W>` command line option or set the :envvar:" "`PYTHONWARNINGS` environment variable to ``error`` to treat warnings as " "errors." msgstr "" +"警告をエラーとして扱うには、:option:`-W error <-W>` コマンドラインオプション" +"を使うか、:envvar:`PYTHONWARNINGS` 環境変数を ``error`` に設定してください。" -#: ../../library/devmode.rst:45 msgid "Install debug hooks on memory allocators to check for:" -msgstr "" +msgstr "メモリアロケーターにデバッグフックを設定し、次の問題をチェックします:" -#: ../../library/devmode.rst:47 msgid "Buffer underflow" -msgstr "" +msgstr "バッファーアンダーフロー" -#: ../../library/devmode.rst:48 msgid "Buffer overflow" -msgstr "" +msgstr "バッファーオーバーフロー" -#: ../../library/devmode.rst:49 msgid "Memory allocator API violation" -msgstr "" +msgstr "メモリアロケーター API の規則違反" -#: ../../library/devmode.rst:50 msgid "Unsafe usage of the GIL" -msgstr "" +msgstr "GIL の安全でない使用" -#: ../../library/devmode.rst:52 msgid "See the :c:func:`PyMem_SetupDebugHooks` C function." -msgstr "" +msgstr "C 関数 :c:func:`PyMem_SetupDebugHooks` を参照してください。" -#: ../../library/devmode.rst:54 msgid "" "It behaves as if the :envvar:`PYTHONMALLOC` environment variable is set to " "``debug``." msgstr "" +":envvar:`PYTHONMALLOC` 環境変数を ``debug`` に設定した場合と同じ動作になりま" +"す。" -#: ../../library/devmode.rst:57 msgid "" "To enable the Python Development Mode without installing debug hooks on " "memory allocators, set the :envvar:`PYTHONMALLOC` environment variable to " "``default``." msgstr "" +"メモリアロケーターにデバッグフックを設定せずに Python 開発モードを有効にする" +"には、:envvar:`PYTHONMALLOC` 環境変数を ``default`` に設定してください。" -#: ../../library/devmode.rst:61 msgid "" "Call :func:`faulthandler.enable` at Python startup to install handlers for " "the :const:`~signal.SIGSEGV`, :const:`~signal.SIGFPE`, :const:`~signal." "SIGABRT`, :const:`~signal.SIGBUS` and :const:`~signal.SIGILL` signals to " "dump the Python traceback on a crash." msgstr "" +"Python 起動時に :func:`faulthandler.enable` を呼び、:const:`~signal." +"SIGSEGV`、:const:`~signal.SIGFPE`、:const:`~signal.SIGABRT`、:const:`~signal." +"SIGBUS`、:const:`~signal.SIGILL` シグナルのハンドラーを設定して、クラッシュ時" +"に Python のトレースバックを出力します。" -#: ../../library/devmode.rst:66 msgid "" "It behaves as if the :option:`-X faulthandler <-X>` command line option is " "used or if the :envvar:`PYTHONFAULTHANDLER` environment variable is set to " "``1``." msgstr "" +":option:`-X faulthandler <-X>` コマンドラインオプションを使うか、:envvar:" +"`PYTHONFAULTHANDLER` 環境変数を ``1`` に設定した場合と同じ動作になります。" -#: ../../library/devmode.rst:70 msgid "" "Enable :ref:`asyncio debug mode `. For example, :mod:" "`asyncio` checks for coroutines that were not awaited and logs them." msgstr "" +":ref:`asyncio のデバッグモード ` を有効にします。\n" +"例えば :mod:`asyncio` は await されなかったコルーチンを検出してログに記録しま" +"す。" -#: ../../library/devmode.rst:73 msgid "" "It behaves as if the :envvar:`PYTHONASYNCIODEBUG` environment variable is " "set to ``1``." msgstr "" +":envvar:`PYTHONASYNCIODEBUG` 環境変数を ``1`` に設定した場合と同じ動作になり" +"ます。" -#: ../../library/devmode.rst:76 msgid "" "Check the *encoding* and *errors* arguments for string encoding and decoding " "operations. Examples: :func:`open`, :meth:`str.encode` and :meth:`bytes." "decode`." msgstr "" +"文字列のエンコードとデコードで *encoding* と *errors* 引数をチェックしま" +"す。\n" +"対象の例として :func:`open`、:meth:`str.encode`、:meth:`bytes.decode` があり" +"ます。" -#: ../../library/devmode.rst:80 msgid "" "By default, for best performance, the *errors* argument is only checked at " "the first encoding/decoding error and the *encoding* argument is sometimes " "ignored for empty strings." msgstr "" +"デフォルトでは性能を優先するため、*errors* 引数は最初のエンコードまたはデコー" +"ドのエラー時にだけチェックし、空文字列では *encoding* 引数を無視する場合があ" +"ります。" -#: ../../library/devmode.rst:84 msgid "The :class:`io.IOBase` destructor logs ``close()`` exceptions." msgstr "" +":class:`io.IOBase` のデストラクタが ``close()`` の例外をログに記録します。" -#: ../../library/devmode.rst:85 msgid "" "Set the :attr:`~sys.flags.dev_mode` attribute of :data:`sys.flags` to " "``True``." msgstr "" +":data:`sys.flags` の :attr:`~sys.flags.dev_mode` 属性を ``True`` に設定しま" +"す。" -#: ../../library/devmode.rst:88 msgid "" "The Python Development Mode does not enable the :mod:`tracemalloc` module by " "default, because the overhead cost (to performance and memory) would be too " @@ -202,39 +223,51 @@ msgid "" "buffer overflow error logs the traceback where the memory block was " "allocated." msgstr "" +"Python 開発モードでは、性能とメモリのオーバーヘッドが大きすぎるため、:mod:" +"`tracemalloc` モジュールをデフォルトでは有効にしません。\n" +":mod:`tracemalloc` モジュールを有効にすると、一部のエラーの発生元に関する追加" +"情報が得られます。\n" +"例えば :exc:`ResourceWarning` はリソース割り当て時のトレースバックを記録し、" +"バッファーオーバーフローのエラーはメモリブロック割り当て時のトレースバックを" +"記録します。" -#: ../../library/devmode.rst:95 msgid "" "The Python Development Mode does not prevent the :option:`-O` command line " "option from removing :keyword:`assert` statements nor from setting :const:" "`__debug__` to ``False``." msgstr "" +"Python 開発モードを有効にしても、:option:`-O` コマンドラインオプションによ" +"る :keyword:`assert` 文の削除や、:const:`__debug__` の ``False`` への設定は妨" +"げられません。" -#: ../../library/devmode.rst:99 msgid "" "The Python Development Mode can only be enabled at the Python startup. Its " "value can be read from :data:`sys.flags.dev_mode `." msgstr "" +"Python 開発モードは Python 起動時にのみ有効にできます。\n" +"その値は :data:`sys.flags.dev_mode ` から取得できます。" -#: ../../library/devmode.rst:102 msgid "The :class:`io.IOBase` destructor now logs ``close()`` exceptions." msgstr "" +":class:`io.IOBase` のデストラクタが ``close()`` の例外をログに記録するように" +"なりました。" -#: ../../library/devmode.rst:105 msgid "" "The *encoding* and *errors* arguments are now checked for string encoding " "and decoding operations." msgstr "" +"文字列のエンコードとデコードで *encoding* と *errors* 引数をチェックするよう" +"になりました。" #: ../../library/devmode.rst:111 msgid "ResourceWarning Example" -msgstr "" +msgstr "ResourceWarning の例" -#: ../../library/devmode.rst:113 msgid "" "Example of a script counting the number of lines of the text file specified " "in the command line::" msgstr "" +"コマンドラインで指定したテキストファイルの行数を数えるスクリプトの例です。 ::" #: ../../library/devmode.rst:116 msgid "" @@ -249,24 +282,38 @@ msgid "" "if __name__ == \"__main__\":\n" " main()" msgstr "" +"import sys\n" +"\n" +"def main():\n" +" fp = open(sys.argv[1])\n" +" nlines = len(fp.readlines())\n" +" print(nlines)\n" +" # ファイルは暗黙的に閉じられる\n" +"\n" +"if __name__ == \"__main__\":\n" +" main()" -#: ../../library/devmode.rst:127 msgid "" "The script does not close the file explicitly. By default, Python does not " "emit any warning. Example using README.txt, which has 269 lines:" msgstr "" +"このスクリプトはファイルを明示的に閉じていません。\n" +"デフォルトでは Python は警告を出しません。\n" +"269 行の README.txt を使った例です:" #: ../../library/devmode.rst:130 msgid "" "$ python script.py README.txt\n" "269" msgstr "" +"$ python script.py README.txt\n" +"269" -#: ../../library/devmode.rst:135 msgid "" "Enabling the Python Development Mode displays a :exc:`ResourceWarning` " "warning:" msgstr "" +"Python 開発モードを有効にすると :exc:`ResourceWarning` 警告が表示されます:" #: ../../library/devmode.rst:137 msgid "" @@ -277,12 +324,18 @@ msgid "" " main()\n" "ResourceWarning: Enable tracemalloc to get the object allocation traceback" msgstr "" +"$ python -X dev script.py README.txt\n" +"269\n" +"script.py:10: ResourceWarning: unclosed file <_io.TextIOWrapper name='README." +"rst' mode='r' encoding='UTF-8'>\n" +" main()\n" +"ResourceWarning: Enable tracemalloc to get the object allocation traceback" -#: ../../library/devmode.rst:145 msgid "" "In addition, enabling :mod:`tracemalloc` shows the line where the file was " "opened:" msgstr "" +"さらに :mod:`tracemalloc` を有効にすると、ファイルを開いた行が表示されます:" #: ../../library/devmode.rst:148 msgid "" @@ -297,11 +350,22 @@ msgid "" " File \"script.py\", lineno 4\n" " fp = open(sys.argv[1])" msgstr "" +"$ python -X dev -X tracemalloc=5 script.py README.rst\n" +"269\n" +"script.py:10: ResourceWarning: unclosed file <_io.TextIOWrapper name='README." +"rst' mode='r' encoding='UTF-8'>\n" +" main()\n" +"Object allocated at (most recent call last):\n" +" File \"script.py\", lineno 10\n" +" main()\n" +" File \"script.py\", lineno 4\n" +" fp = open(sys.argv[1])" -#: ../../library/devmode.rst:160 msgid "" "The fix is to close explicitly the file. Example using a context manager::" msgstr "" +"ファイルを明示的に閉じれば修正できます。\n" +"コンテキストマネージャを使った例です。 ::" #: ../../library/devmode.rst:162 msgid "" @@ -311,22 +375,29 @@ msgid "" " nlines = len(fp.readlines())\n" " print(nlines)" msgstr "" +"def main():\n" +" # ブロックを終了する際に明示的にファイルを閉じる\n" +" with open(sys.argv[1]) as fp:\n" +" nlines = len(fp.readlines())\n" +" print(nlines)" -#: ../../library/devmode.rst:168 msgid "" "Not closing a resource explicitly can leave a resource open for way longer " "than expected; it can cause severe issues upon exiting Python. It is bad in " "CPython, but it is even worse in PyPy. Closing resources explicitly makes an " "application more deterministic and more reliable." msgstr "" +"リソースを明示的に閉じないと、予想よりずっと長い間開いたままになり、Python 終" +"了時に重大な問題を起こすことがあります。\n" +"CPython でも問題ですが、PyPy ではさらに深刻です。\n" +"リソースを明示的に閉じることで、アプリケーションの動作がより確定的になり、信" +"頼性も高まります。" -#: ../../library/devmode.rst:175 msgid "Bad file descriptor error example" -msgstr "" +msgstr "Bad file descriptor エラーの例" -#: ../../library/devmode.rst:177 msgid "Script displaying the first line of itself::" -msgstr "" +msgstr "自分自身の最初の行を表示するスクリプトです。 ::" #: ../../library/devmode.rst:179 msgid "" @@ -341,22 +412,34 @@ msgid "" "\n" "main()" msgstr "" +"import os\n" +"\n" +"def main():\n" +" fp = open(__file__)\n" +" firstline = fp.readline()\n" +" print(firstline.rstrip())\n" +" os.close(fp.fileno())\n" +" # ファイルは暗黙的に閉じられる\n" +"\n" +"main()" -#: ../../library/devmode.rst:190 msgid "By default, Python does not emit any warning:" -msgstr "" +msgstr "デフォルトでは Python は警告を出しません:" #: ../../library/devmode.rst:192 msgid "" "$ python script.py\n" "import os" msgstr "" +"$ python script.py\n" +"import os" -#: ../../library/devmode.rst:197 msgid "" "The Python Development Mode shows a :exc:`ResourceWarning` and logs a \"Bad " "file descriptor\" error when finalizing the file object:" msgstr "" +"Python 開発モードでは :exc:`ResourceWarning` が表示され、ファイルオブジェクト" +"のファイナライズ時に \"Bad file descriptor\" エラーがログに記録されます:" #: ../../library/devmode.rst:200 msgid "" @@ -373,8 +456,19 @@ msgid "" " main()\n" "OSError: [Errno 9] Bad file descriptor" msgstr "" +"$ python -X dev script.py\n" +"import os\n" +"script.py:10: ResourceWarning: unclosed file <_io.TextIOWrapper name='script." +"py' mode='r' encoding='UTF-8'>\n" +" main()\n" +"ResourceWarning: Enable tracemalloc to get the object allocation traceback\n" +"Exception ignored in: <_io.TextIOWrapper name='script.py' mode='r' " +"encoding='UTF-8'>\n" +"Traceback (most recent call last):\n" +" File \"script.py\", line 10, in \n" +" main()\n" +"OSError: [Errno 9] Bad file descriptor" -#: ../../library/devmode.rst:213 msgid "" "``os.close(fp.fileno())`` closes the file descriptor. When the file object " "finalizer tries to close the file descriptor again, it fails with the ``Bad " @@ -382,9 +476,16 @@ msgid "" "worst case scenario, closing it twice can lead to a crash (see :issue:" "`18748` for an example)." msgstr "" +"``os.close(fp.fileno())`` はファイル記述子を閉じます。\n" +"ファイルオブジェクトのファイナライザーがそのファイル記述子を再度閉じようとす" +"ると、``Bad file descriptor`` エラーで失敗します。\n" +"ファイル記述子は 1 回だけ閉じなければなりません。\n" +"2 回閉じると、最悪の場合クラッシュすることがあります (例として :issue:" +"`18748` を参照してください)。" -#: ../../library/devmode.rst:219 msgid "" "The fix is to remove the ``os.close(fp.fileno())`` line, or open the file " "with ``closefd=False``." msgstr "" +"``os.close(fp.fileno())`` の行を削除するか、``closefd=False`` を指定してファ" +"イルを開けば修正できます。" diff --git a/library/dialog.po b/library/dialog.po index ab565d348..ad6fcec6a 100644 --- a/library/dialog.po +++ b/library/dialog.po @@ -16,10 +16,10 @@ msgstr "" "Last-Translator: Osamu NAKAMURA, 2021\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/dialog.rst:2 @@ -54,13 +54,12 @@ msgstr "" msgid "The base class for custom dialogs." msgstr "カスタムダイアログ用の基底クラスです。" -#: ../../library/dialog.rst:32 msgid "" "Override to construct the dialog's interface and return the widget that " "should have initial focus." msgstr "" -"ダイアログインターフェースの構築をオーバーライドし、初期フォーカスを持つべき" -"ウィジットを返します。" +"このメソッドをオーバーライドしてダイアログのインターフェースを構築し、初期" +"フォーカスを持たせるウィジェットを返してください。" #: ../../library/dialog.rst:37 msgid "" @@ -187,109 +186,100 @@ msgstr "" msgid "**Convenience classes**" msgstr "**便利なクラス**" -#: ../../library/dialog.rst:119 msgid "" "The below classes are used for creating file/directory windows from scratch. " "These do not emulate the native look-and-feel of the platform." msgstr "" +"以下のクラスは、ファイルやディレクトリのウィンドウを一から作るために使いま" +"す。\n" +"プラットフォームのネイティブのルックアンドフィールは再現しません。" #: ../../library/dialog.rst:124 msgid "Create a dialog prompting the user to select a directory." msgstr "" -#: ../../library/dialog.rst:126 msgid "" "The *FileDialog* class should be subclassed for custom event handling and " "behaviour." msgstr "" +"イベント処理や動作をカスタマイズするには、*FileDialog* クラスをサブクラス化し" +"てください。" -#: ../../library/dialog.rst:131 msgid "Create a basic file selection dialog." -msgstr "" +msgstr "基本的なファイル選択ダイアログを作ります。" -#: ../../library/dialog.rst:135 msgid "Trigger the termination of the dialog window." -msgstr "" +msgstr "ダイアログウィンドウの終了を開始します。" -#: ../../library/dialog.rst:139 msgid "Event handler for double-click event on directory." -msgstr "" +msgstr "ディレクトリのダブルクリックイベントのハンドラー。" -#: ../../library/dialog.rst:143 msgid "Event handler for click event on directory." -msgstr "" +msgstr "ディレクトリのクリックイベントのハンドラー。" -#: ../../library/dialog.rst:147 msgid "Event handler for double-click event on file." -msgstr "" +msgstr "ファイルのダブルクリックイベントのハンドラー。" -#: ../../library/dialog.rst:151 msgid "Event handler for single-click event on file." -msgstr "" +msgstr "ファイルのシングルクリックイベントのハンドラー。" -#: ../../library/dialog.rst:155 msgid "Filter the files by directory." -msgstr "" +msgstr "ディレクトリでファイルを絞り込みます。" -#: ../../library/dialog.rst:159 msgid "Retrieve the file filter currently in use." -msgstr "" +msgstr "現在使っているファイルフィルターを取得します。" -#: ../../library/dialog.rst:163 msgid "Retrieve the currently selected item." -msgstr "" +msgstr "現在選択されている項目を取得します。" -#: ../../library/dialog.rst:167 msgid "Render dialog and start event loop." -msgstr "" +msgstr "ダイアログを表示し、イベントループを開始します。" -#: ../../library/dialog.rst:171 msgid "Exit dialog returning current selection." -msgstr "" +msgstr "現在の選択を返してダイアログを終了します。" -#: ../../library/dialog.rst:175 msgid "Exit dialog returning filename, if any." -msgstr "" +msgstr "ダイアログを終了し、ファイル名があれば返します。" -#: ../../library/dialog.rst:179 msgid "Set the file filter." -msgstr "" +msgstr "ファイルフィルターを設定します。" -#: ../../library/dialog.rst:183 msgid "Update the current file selection to *file*." -msgstr "" +msgstr "現在のファイルの選択を *file* に更新します。" -#: ../../library/dialog.rst:188 msgid "" "A subclass of FileDialog that creates a dialog window for selecting an " "existing file." msgstr "" +"既存のファイルを選択するダイアログウィンドウを作る FileDialog のサブクラスで" +"す。" -#: ../../library/dialog.rst:193 msgid "" "Test that a file is provided and that the selection indicates an already " "existing file." msgstr "" +"ファイルが指定されていて、選択が既存のファイルを指していることを確認します。" -#: ../../library/dialog.rst:198 msgid "" "A subclass of FileDialog that creates a dialog window for selecting a " "destination file." msgstr "" +"保存先のファイルを選択するダイアログウィンドウを作る FileDialog のサブクラス" +"です。" -#: ../../library/dialog.rst:203 msgid "" "Test whether or not the selection points to a valid file that is not a " "directory. Confirmation is required if an already existing file is selected." msgstr "" +"選択がディレクトリではなく、有効なファイルを指しているかを確認します。\n" +"既存のファイルを選択した場合は確認を求めます。" #: ../../library/dialog.rst:208 msgid ":mod:`tkinter.commondialog` --- Dialog window templates" msgstr "" -#: ../../library/dialog.rst:214 msgid "**Source code:** :source:`Lib/tkinter/commondialog.py`" -msgstr "" +msgstr "**ソースコード:** :source:`Lib/tkinter/commondialog.py`" #: ../../library/dialog.rst:218 msgid "" @@ -297,10 +287,8 @@ msgid "" "that is the base class for dialogs defined in other supporting modules." msgstr "" -#: ../../library/dialog.rst:225 msgid "Render the Dialog window." -msgstr "" +msgstr "Dialog ウィンドウを表示します。" -#: ../../library/dialog.rst:230 msgid "Modules :mod:`tkinter.messagebox`, :ref:`tut-files`" -msgstr "" +msgstr ":mod:`tkinter.messagebox` モジュール、:ref:`tut-files`" diff --git a/library/difflib.po b/library/difflib.po index 190178db8..bf0e8fc15 100644 --- a/library/difflib.po +++ b/library/difflib.po @@ -20,10 +20,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/difflib.rst:2 @@ -108,9 +108,8 @@ msgstr "" "スティックは、 :class:`SequenceMatcher` の作成時に ``autojunk`` パラメタを " "``False`` に設定することで無効化できます。" -#: ../../library/difflib.rst:55 ../../library/difflib.rst:386 msgid "Added the *autojunk* parameter." -msgstr "" +msgstr "*autojunk* パラメーターを追加しました。" #: ../../library/difflib.rst:61 msgid "" @@ -167,13 +166,16 @@ msgstr "``'? '``" msgid "line not present in either input sequence" msgstr "行は入力シーケンスのどちらにも存在しない" -#: ../../library/difflib.rst:80 msgid "" "Lines beginning with '``?``' attempt to guide the eye to intraline " "differences, and were not present in either input sequence. These lines can " "be confusing if the sequences contain whitespace characters, such as spaces, " "tabs or line breaks." msgstr "" +"'``?``' で始まる行は、行内の相違点を見つけやすくするためのもので、どちらの入" +"力シーケンスにも存在しません。\n" +"シーケンスにスペース、タブ、改行などの空白文字が含まれる場合、これらの行は分" +"かりにくくなることがあります。" #: ../../library/difflib.rst:87 msgid "" @@ -489,7 +491,6 @@ msgstr "" "writelines` で扱うのに適した diff になるので (なぜなら入力と出力の両方が改行" "付きのため) 、これは有用です。" -#: ../../library/difflib.rst:300 msgid "" "The unified diff format normally has a header for filenames and modification " "times. Any or all of these may be specified using strings for *fromfile*, " @@ -497,6 +498,11 @@ msgid "" "normally expressed in the ISO 8601 format. If not specified, the strings " "default to blanks." msgstr "" +"ユニファイド形式の差分は、通常、ファイル名と更新日時のヘッダーを持ちます。\n" +"これらは *fromfile*、*tofile*、*fromfiledate*、*tofiledate* に文字列を渡し" +"て、必要なものだけでもすべてでも指定できます。\n" +"更新日時は通常 ISO 8601 形式で表します。\n" +"指定しない場合は空文字列になります。" #: ../../library/difflib.rst:324 msgid "" @@ -587,25 +593,25 @@ msgstr "" "じになります; すなわち、いかなる要素も無視しなくなります。例えば以下のような" "引数を渡すと::" -#: ../../library/difflib.rst:375 msgid "lambda x: x in \" \\t\"" -msgstr "" +msgstr "lambda x: x in \" \\t\"" -#: ../../library/difflib.rst:377 msgid "" "if you're comparing lines as sequences of characters, and don't want to " "synch up on blanks or hard tabs." -msgstr "空白とタブ文字を無視して文字のシーケンスを比較します。" +msgstr "" +"これは、行を文字のシーケンスとして比較する際に、空白やタブ文字を対応付けの基" +"点にしたくない場合の例です。" -#: ../../library/difflib.rst:380 msgid "" "The optional arguments *a* and *b* are sequences to be compared; both " "default to empty strings. The elements of both sequences must be :term:" "`hashable`." msgstr "" -"オプションの引数 *a* と *b* は、比較される文字列で、デフォルトでは空の文字列" -"です。両方のシーケンスの要素は、 :term:`ハッシュ可能 ` である必要が" -"あります。" +"省略可能な引数 *a* と *b* は比較するシーケンスで、どちらもデフォルトは空文字" +"列です。\n" +"両方のシーケンスの要素は :term:`ハッシュ可能 ` でなければなりませ" +"ん。" #: ../../library/difflib.rst:383 msgid "" @@ -639,21 +645,20 @@ msgstr "*bjunk* および *bpopular* 属性。" msgid ":class:`SequenceMatcher` objects have the following methods:" msgstr ":class:`SequenceMatcher` オブジェクトは以下のメソッドを持ちます:" -#: ../../library/difflib.rst:403 msgid "Set the two sequences to be compared." -msgstr "比較される2つの文字列を設定します。" +msgstr "比較する 2 つのシーケンスを設定します。" -#: ../../library/difflib.rst:405 msgid "" ":class:`SequenceMatcher` computes and caches detailed information about the " "second sequence, so if you want to compare one sequence against many " "sequences, use :meth:`set_seq2` to set the commonly used sequence once and " "call :meth:`set_seq1` repeatedly, once for each of the other sequences." msgstr "" -":class:`SequenceMatcher` オブジェクトは、2つ目のシーケンスについての詳細な情" -"報を計算し、キャッシュします。 1つのシーケンスをいくつものシーケンスと比較す" -"る場合、まず :meth:`set_seq2` を使って文字列を設定しておき、別の文字列を1つず" -"つ比較するために、繰り返し :meth:`set_seq1` を呼び出します。" +":class:`SequenceMatcher` は 2 つ目のシーケンスの詳細な情報を計算してキャッ" +"シュします。\n" +"1 つのシーケンスを多数のシーケンスと比較するには、:meth:`set_seq2` で共通の" +"シーケンスを一度設定し、比較相手のシーケンスごとに :meth:`set_seq1` を呼び出" +"します。" #: ../../library/difflib.rst:413 msgid "" @@ -675,7 +680,6 @@ msgstr "" msgid "Find longest matching block in ``a[alo:ahi]`` and ``b[blo:bhi]``." msgstr "``a[alo:ahi]`` と ``b[blo:bhi]`` の中から、最長のマッチ列を探します。" -#: ../../library/difflib.rst:427 msgid "" "If *isjunk* was omitted or ``None``, :meth:`find_longest_match` returns " "``(i, j, k)`` such that ``a[i:i+k]`` is equal to ``b[j:j+k]``, where ``alo " @@ -686,15 +690,14 @@ msgid "" "all those maximal matching blocks that start earliest in *a*, return the one " "that starts earliest in *b*." msgstr "" -"*isjunk* が省略されたか ``None`` の時、 :meth:`find_longest_match` は ``a[i:" -"i+k]`` が ``b[j:j+k]`` と等しいような ``(i, j, k)`` を返します。その値は " -"``alo <= i <= i+k <= ahi`` かつ ``blo <= j <= j+k <= bhi`` となります。 " -"``(i', j', k')`` でも、同じようになります。さらに ``k >= k'``, ``i <= i'`` " -"が ``i == i'``, ``j <= j'`` でも同様です。言い換えると、いくつものマッチ列す" -"べてのうち、 *a* 内で最初に始まるものを返します。そしてその *a* 内で最初の" -"マッチ列すべてのうち *b* 内で最初に始まるものを返します。" +"*isjunk* が省略されたか ``None`` の場合、:meth:`find_longest_match` は ``a[i:" +"i+k]`` が ``b[j:j+k]`` に等しくなる ``(i, j, k)`` を返します。\n" +"ここで ``alo <= i <= i+k <= ahi`` かつ ``blo <= j <= j+k <= bhi`` です。\n" +"これらの条件を満たす任意の ``(i', j', k')`` に対して、さらに ``k >= k'``、" +"``i <= i'``、および ``i == i'`` ならば ``j <= j'`` という条件も満たします。\n" +"つまり、最長の一致ブロックのうち *a* 内で最も早く始まるものを返します。\n" +"そのようなブロックが複数あれば、*b* 内で最も早く始まるものを返します。" -#: ../../library/difflib.rst:440 msgid "" "If *isjunk* was provided, first the longest matching block is determined as " "above, but with the additional restriction that no junk element appears in " @@ -702,11 +705,12 @@ msgid "" "(only) junk elements on both sides. So the resulting block never matches on " "junk except as identical junk happens to be adjacent to an interesting match." msgstr "" -"引数 *isjunk* が与えられている場合、上記の通り、はじめに最長のマッチ列を判定" -"します。ブロック内に junk 要素が見当たらないような追加条件の際はこれに該当し" -"ません。次にそのマッチ列を、その両側の junk 要素にマッチするよう、できる限り" -"広げていきます。そのため結果となる列は、探している列のたまたま直前にあった同" -"一の junk 以外の junk にはマッチしません。" +"引数 *isjunk* が与えられている場合、まず上記のように最長のマッチ列を判定しま" +"すが、列に junk 要素を含めないという制約が加わります。\n" +"次に、その列の両側にある junk 要素だけをマッチさせて、列をできる限り広げま" +"す。\n" +"したがって、junk 以外の要素のマッチ列に同一の junk 要素が隣接している場合を除" +"き、結果の列で junk 要素がマッチすることはありません。" #: ../../library/difflib.rst:447 msgid "" @@ -732,15 +736,14 @@ msgstr "このメソッドは :term:`named tuple` ``Match(a, b, size)`` を返 msgid "Added default arguments." msgstr "デフォルト引数が追加されました。" -#: ../../library/difflib.rst:466 msgid "" "Return list of triples describing non-overlapping matching subsequences. " "Each triple is of the form ``(i, j, n)``, and means that ``a[i:i+n] == b[j:" "j+n]``. The triples are monotonically increasing in *i* and *j*." msgstr "" -"マッチした互いに重複の無いシーケンスを表す、3つ組の値のリストを返します。\n" -"それぞれの値は ``(i, j, n)`` という形式で表され、``a[i:i+n] == b[j:j+n]`` と" -"いう関係を意味します。3つの値は *i* と *j* の間で単調に増加します。" +"重複しない一致部分シーケンスを表す 3 要素タプルのリストを返します。\n" +"各タプルは ``(i, j, n)`` の形式で、``a[i:i+n] == b[j:j+n]`` を意味します。\n" +"タプルの並びでは *i* と *j* がそれぞれ単調に増加します。" #: ../../library/difflib.rst:471 msgid "" @@ -756,24 +759,26 @@ msgstr "" "``j+n < j'`` です。言い換えると並んでいる3つ組は常に隣接していない同じブロッ" "クを表しています。" -#: ../../library/difflib.rst:479 msgid "" ">>> s = SequenceMatcher(None, \"abxcd\", \"abcd\")\n" ">>> s.get_matching_blocks()\n" "[Match(a=0, b=0, size=2), Match(a=3, b=2, size=2), Match(a=5, b=4, size=0)]" msgstr "" +">>> s = SequenceMatcher(None, \"abxcd\", \"abcd\")\n" +">>> s.get_matching_blocks()\n" +"[Match(a=0, b=0, size=2), Match(a=3, b=2, size=2), Match(a=5, b=4, size=0)]" -#: ../../library/difflib.rst:488 msgid "" "Return list of 5-tuples describing how to turn *a* into *b*. Each tuple is " "of the form ``(tag, i1, i2, j1, j2)``. The first tuple has ``i1 == j1 == " "0``, and remaining tuples have *i1* equal to the *i2* from the preceding " "tuple, and, likewise, *j1* equal to the previous *j2*." msgstr "" -"*a* を *b* にするための方法を記述する5つのタプルを返します。それぞれのタプル" -"は ``(tag, i1, i2, j1, j2)`` という形式であらわされます。最初のタプルは ``i1 " -"== j1 == 0`` であり、*i1* はその前にあるタプルの *i2* と同じ値です。同様に " -"*j1* は前の *j2* と同じ値になります。" +"*a* を *b* にするための方法を記述する、5 要素のタプルのリストを返します。\n" +"それぞれのタプルは ``(tag, i1, i2, j1, j2)`` という形式です。\n" +"最初のタプルでは ``i1 == j1 == 0`` であり、残りのタプルでは *i1* が直前のタプ" +"ルの *i2* と同じ値になります。\n" +"同様に、*j1* は直前のタプルの *j2* と同じ値になります。" #: ../../library/difflib.rst:493 msgid "The *tag* values are strings, with these meanings:" @@ -822,7 +827,6 @@ msgstr "``a[i1:i2] == b[j1:j2]`` (サブシーケンスは等しい)." msgid "For example::" msgstr "例えば::" -#: ../../library/difflib.rst:514 msgid "" ">>> a = \"qabxcd\"\n" ">>> b = \"abycdf\"\n" @@ -836,6 +840,17 @@ msgid "" "equal a[4:6] --> b[3:5] 'cd' --> 'cd'\n" "insert a[6:6] --> b[5:6] '' --> 'f'" msgstr "" +">>> a = \"qabxcd\"\n" +">>> b = \"abycdf\"\n" +">>> s = SequenceMatcher(None, a, b)\n" +">>> for tag, i1, i2, j1, j2 in s.get_opcodes():\n" +"... print('{:7} a[{}:{}] --> b[{}:{}] {!r:>8} --> {!r}'.format(\n" +"... tag, i1, i2, j1, j2, a[i1:i2], b[j1:j2]))\n" +"delete a[0:1] --> b[0:0] 'q' --> ''\n" +"equal a[1:3] --> b[0:2] 'ab' --> 'ab'\n" +"replace a[3:4] --> b[2:3] 'x' --> 'y'\n" +"equal a[4:6] --> b[3:5] 'cd' --> 'cd'\n" +"insert a[6:6] --> b[5:6] '' --> 'f'" #: ../../library/difflib.rst:529 msgid "Return a :term:`generator` of groups with up to *n* lines of context." @@ -843,14 +858,13 @@ msgstr "" "最大 *n* 行までのコンテキストを含むグループを生成するような、 :term:`ジェネ" "レータ ` を返します。" -#: ../../library/difflib.rst:531 msgid "" "Starting with the groups returned by :meth:`get_opcodes`, this method splits " "out smaller change clusters and eliminates intervening ranges which have no " "changes." msgstr "" -"このメソッドは、 :meth:`get_opcodes` で返されるグループの中から、似たような差" -"異のかたまりに分け、間に挟まっている変更の無い部分を省きます。" +":meth:`get_opcodes` が返すグループをもとに、変更箇所をより小さなまとまりに分" +"割し、間に挟まる変更のない範囲を除きます。" #: ../../library/difflib.rst:535 msgid "The groups are returned in the same format as :meth:`get_opcodes`." @@ -906,7 +920,6 @@ msgstr ":meth:`ratio` の上界を、より高速に計算します。" msgid "Return an upper bound on :meth:`ratio` very quickly." msgstr ":meth:`ratio` の上界を、非常に高速に計算します。" -#: ../../library/difflib.rst:573 msgid "" "The three methods that return the ratio of matching to total characters can " "give different results due to differing levels of approximation, although :" @@ -914,6 +927,10 @@ msgid "" "real_quick_ratio` are always at least as large as :meth:`~SequenceMatcher." "ratio`:" msgstr "" +"一致した文字数の総文字数に対する比率を返す 3 つのメソッドは、近似の程度が異な" +"るため、結果も異なる場合があります。\n" +"ただし :meth:`~SequenceMatcher.quick_ratio` と :meth:`~SequenceMatcher." +"real_quick_ratio` の結果は、常に :meth:`~SequenceMatcher.ratio` 以上です:" #: ../../library/difflib.rst:590 msgid "SequenceMatcher Examples" @@ -923,32 +940,39 @@ msgstr "SequenceMatcher の例" msgid "This example compares two strings, considering blanks to be \"junk\":" msgstr "この例は2つの文字列を比較します。空白を \"junk\" とします:" -#: ../../library/difflib.rst:598 msgid "" ":meth:`~SequenceMatcher.ratio` returns a float in [0, 1], measuring the " "similarity of the sequences. As a rule of thumb, a :meth:`~SequenceMatcher." "ratio` value over 0.6 means the sequences are close matches:" msgstr "" +":meth:`~SequenceMatcher.ratio` は [0, 1] の範囲の浮動小数点数を返し、シーケン" +"スの類似度を示します。\n" +"目安として、:meth:`~SequenceMatcher.ratio` の値が 0.6 を超えていれば、シーケ" +"ンスはよく似ています:" -#: ../../library/difflib.rst:605 msgid "" "If you're only interested in where the sequences match, :meth:" "`~SequenceMatcher.get_matching_blocks` is handy:" msgstr "" +"シーケンスのどこが一致するかだけを知りたい場合は、:meth:`~SequenceMatcher." +"get_matching_blocks` が便利です:" -#: ../../library/difflib.rst:614 msgid "" "Note that the last tuple returned by :meth:`~SequenceMatcher." "get_matching_blocks` is always a dummy, ``(len(a), len(b), 0)``, and this is " "the only case in which the last tuple element (number of elements matched) " "is ``0``." msgstr "" +":meth:`~SequenceMatcher.get_matching_blocks` が返す最後のタプルは、常にダミー" +"の ``(len(a), len(b), 0)`` です。\n" +"タプルの最後の要素 (一致した要素数) が ``0`` になるのは、このタプルだけです。" -#: ../../library/difflib.rst:618 msgid "" "If you want to know how to change the first sequence into the second, use :" "meth:`~SequenceMatcher.get_opcodes`:" msgstr "" +"最初のシーケンスを 2 つ目に変える方法を知るには、:meth:`~SequenceMatcher." +"get_opcodes` を使います:" #: ../../library/difflib.rst:629 msgid "" @@ -958,12 +982,14 @@ msgstr "" ":class:`SequenceMatcher` を使った、シンプルで使えるコードを知るには、このモ" "ジュールの関数 :func:`get_close_matches` を参照してください。" -#: ../../library/difflib.rst:633 msgid "" "`Simple version control recipe `_ for a small application built with :class:" "`SequenceMatcher`." msgstr "" +":class:`SequenceMatcher` で作った小さなアプリケーションについては、`簡単な" +"バージョン管理のレシピ `_ を参照してください。" #: ../../library/difflib.rst:641 msgid "Differ Objects" @@ -1017,17 +1043,16 @@ msgstr "" "あるときに真を返します。デフォルトは ``None`` であり、どんな文字も junk とは" "見なされません。" -#: ../../library/difflib.rst:666 msgid "" "These junk-filtering functions speed up matching to find differences and do " "not cause any differing lines or characters to be ignored. Read the " "description of the :meth:`~SequenceMatcher.find_longest_match` method's " "*isjunk* parameter for an explanation." msgstr "" -"これらの junk フィルター関数により、差分を発見するマッチングが高速化し、差分" -"の行や文字が無視されることがなくなります。説明については、 :meth:" -"`~SequenceMatcher.find_longest_match` メソッドの *isjunk* 引数の説明をご覧く" -"ださい。" +"これらの junk フィルター関数は、相違点を探すマッチングを高速化しますが、相違" +"のある行や文字そのものを無視するわけではありません。\n" +"詳しくは :meth:`~SequenceMatcher.find_longest_match` メソッドの *isjunk* パラ" +"メーターの説明を参照してください。" #: ../../library/difflib.rst:672 msgid "" @@ -1061,13 +1086,16 @@ msgstr "" msgid "Differ Example" msgstr "Differ の例" -#: ../../library/difflib.rst:692 msgid "" "This example compares two texts. First we set up the texts, sequences of " "individual single-line strings ending with newlines (such sequences can also " "be obtained from the :meth:`~io.IOBase.readlines` method of file-like " "objects):" msgstr "" +"この例では 2 つのテキストを比較します。\n" +"まず、末尾に改行のある 1 行ずつの文字列のシーケンスとしてテキストを用意しま" +"す (ファイル類似オブジェクトの :meth:`~io.IOBase.readlines` メソッドでも取得" +"できます):" #: ../../library/difflib.rst:711 msgid "Next we instantiate a Differ object:" @@ -1099,10 +1127,11 @@ msgstr "これは、複数行の文字列として、次のように出力され msgid "A command-line interface to difflib" msgstr "difflib のコマンドラインインターフェース" -#: ../../library/difflib.rst:759 msgid "" "This example shows how to use difflib to create a ``diff``-like utility." msgstr "" +"この例では、difflib を使って ``diff`` のようなユーティリティを作る方法を示し" +"ます。" #: ../../library/difflib.rst:761 msgid "" @@ -1171,13 +1200,11 @@ msgid "" " main()\n" msgstr "" -#: ../../library/difflib.rst:764 msgid "ndiff example" -msgstr "" +msgstr "ndiff の例" -#: ../../library/difflib.rst:766 msgid "This example shows how to use :func:`difflib.ndiff`." -msgstr "" +msgstr "この例では :func:`difflib.ndiff` の使い方を示します。" #: ../../library/difflib.rst:768 msgid "" diff --git a/library/dis.po b/library/dis.po index 9a70d93be..aa917a4a2 100644 --- a/library/dis.po +++ b/library/dis.po @@ -20,10 +20,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/dis.rst:2 @@ -66,11 +66,12 @@ msgstr "" "従来は使用されるバイト数は命令ごとに異なりましたが、このモジュールでは各々一" "つの命令につき2バイト使用することとなっています。" -#: ../../library/dis.rst:33 msgid "" "The argument of jump, exception handling and loop instructions is now the " "instruction offset rather than the byte offset." msgstr "" +"ジャンプ、例外処理、ループ命令の引数が、バイトオフセットではなく命令のオフ" +"セットになりました。" #: ../../library/dis.rst:37 msgid "" @@ -82,54 +83,57 @@ msgid "" "shown by passing ``adaptive=True``." msgstr "" -#: ../../library/dis.rst:45 msgid "" "The argument of a jump is the offset of the target instruction relative to " "the instruction that appears immediately after the jump instruction's :" "opcode:`CACHE` entries." msgstr "" +"ジャンプの引数は、ジャンプ命令の :opcode:`CACHE` エントリーの直後にある命令を" +"基準とした、ジャンプ先の命令への相対オフセットになりました。" -#: ../../library/dis.rst:50 msgid "" "As a consequence, the presence of the :opcode:`CACHE` instructions is " "transparent for forward jumps but needs to be taken into account when " "reasoning about backward jumps." msgstr "" +"このため、前方ジャンプでは :opcode:`CACHE` 命令の存在を意識する必要はありませ" +"んが、後方ジャンプを考える際は考慮する必要があります。" -#: ../../library/dis.rst:54 msgid "" "The output shows logical labels rather than instruction offsets for jump " "targets and exception handlers. The ``-O`` command line option and the " "``show_offsets`` argument were added." msgstr "" +"ジャンプ先と例外ハンドラーの出力に、命令オフセットではなく論理ラベルを表示す" +"るようになりました。\n" +"``-O`` コマンドラインオプションと ``show_offsets`` 引数を追加しました。" -#: ../../library/dis.rst:59 msgid "" "The :option:`-P ` command-line option and the " "``show_positions`` argument were added." msgstr "" +":option:`-P ` コマンドラインオプションと " +"``show_positions`` 引数を追加しました。" -#: ../../library/dis.rst:63 msgid "The :option:`-S ` command-line option is added." msgstr "" +":option:`-S ` コマンドラインオプションを追加しました。" -#: ../../library/dis.rst:65 msgid "Example: Given the function :func:`!myfunc`::" -msgstr "" +msgstr "例として、次の :func:`!myfunc` 関数があるとします。 ::" -#: ../../library/dis.rst:67 msgid "" "def myfunc(alist):\n" " return len(alist)" msgstr "" +"def myfunc(alist):\n" +" return len(alist)" -#: ../../library/dis.rst:70 msgid "" "the following command can be used to display the disassembly of :func:`!" "myfunc`:" -msgstr "" +msgstr "次のコマンドで :func:`!myfunc` の逆アセンブル結果を表示できます:" -#: ../../library/dis.rst:73 msgid "" ">>> dis.dis(myfunc)\n" " 2 RESUME 0\n" @@ -139,6 +143,13 @@ msgid "" " CALL 1\n" " RETURN_VALUE" msgstr "" +">>> dis.dis(myfunc)\n" +" 2 RESUME 0\n" +"\n" +" 3 LOAD_GLOBAL 1 (len + NULL)\n" +" LOAD_FAST_BORROW 0 (alist)\n" +" CALL 1\n" +" RETURN_VALUE" #: ../../library/dis.rst:83 msgid "(The \"2\" is a line number)." @@ -152,9 +163,8 @@ msgstr "コマンドライン・インターフェース" msgid "The :mod:`dis` module can be invoked as a script from the command line:" msgstr "" -#: ../../library/dis.rst:92 msgid "python -m dis [-h] [-C] [-O] [-P] [-S] [infile]" -msgstr "" +msgstr "python -m dis [-h] [-C] [-O] [-P] [-S] [infile]" #: ../../library/dis.rst:96 msgid "The following options are accepted:" @@ -164,28 +174,26 @@ msgstr "以下のオプションが使用できます:" msgid "Display usage and exit." msgstr "使い方を表示して終了します。" -#: ../../library/dis.rst:106 msgid "Show inline caches." -msgstr "" +msgstr "インラインキャッシュを表示します。" -#: ../../library/dis.rst:112 msgid "Show offsets of instructions." -msgstr "" +msgstr "命令のオフセットを表示します。" -#: ../../library/dis.rst:118 msgid "Show positions of instructions in the source code." -msgstr "" +msgstr "ソースコード内の命令の位置を表示します。" -#: ../../library/dis.rst:124 msgid "Show specialized bytecode." -msgstr "" +msgstr "特殊化されたバイトコードを表示します。" -#: ../../library/dis.rst:128 msgid "" "If :file:`infile` is specified, its disassembled code will be written to " "stdout. Otherwise, disassembly is performed on compiled source code received " "from stdin." msgstr "" +":file:`infile` を指定すると、その逆アセンブル結果を標準出力に書き出します。\n" +"指定しなければ、標準入力から受け取ったソースコードをコンパイルして逆アセンブ" +"ルします。" #: ../../library/dis.rst:132 msgid "Bytecode analysis" @@ -245,29 +253,34 @@ msgstr "" "これを設定すると、 :meth:`.dis` の出力において、指定された命令コード " "(opcode) に \"現在の命令 (instruction)\" を表す印が表示されます。" -#: ../../library/dis.rst:161 msgid "" "If *show_caches* is ``True``, :meth:`.dis` will display inline cache entries " "used by the interpreter to specialize the bytecode." msgstr "" +"*show_caches* が ``True`` なら、:meth:`.dis` はインタープリタがバイトコードの" +"特殊化に使うインラインキャッシュエントリーを表示します。" -#: ../../library/dis.rst:164 msgid "" "If *adaptive* is ``True``, :meth:`.dis` will display specialized bytecode " "that may be different from the original bytecode." msgstr "" +"*adaptive* が ``True`` なら、:meth:`.dis` は特殊化されたバイトコードを表示し" +"ます。\n" +"これは元のバイトコードと異なる場合があります。" -#: ../../library/dis.rst:167 msgid "" "If *show_offsets* is ``True``, :meth:`.dis` will include instruction offsets " "in the output." msgstr "" +"*show_offsets* が ``True`` なら、:meth:`.dis` の出力に命令オフセットを含めま" +"す。" -#: ../../library/dis.rst:170 msgid "" "If *show_positions* is ``True``, :meth:`.dis` will include instruction " "source code positions in the output." msgstr "" +"*show_positions* が ``True`` なら、:meth:`.dis` の出力にソースコード内の命令" +"の位置を含めます。" #: ../../library/dis.rst:175 msgid "" @@ -301,31 +314,24 @@ msgstr "" ":func:`code_info` のようなコードオブジェクトの詳細を含んだ整形された複数行文" "字列を返します。" -#: ../../library/dis.rst:196 ../../library/dis.rst:242 -#: ../../library/dis.rst:295 msgid "This can now handle coroutine and asynchronous generator objects." msgstr "" +"コルーチンオブジェクトと非同期ジェネレーターオブジェクトも扱えるようになりま" +"した。" -#: ../../library/dis.rst:199 ../../library/dis.rst:298 -#: ../../library/dis.rst:320 ../../library/dis.rst:356 -#: ../../library/dis.rst:382 msgid "Added the *show_caches* and *adaptive* parameters." -msgstr "" +msgstr "*show_caches* と *adaptive* パラメーターを追加しました。" -#: ../../library/dis.rst:202 msgid "Added the *show_offsets* parameter" -msgstr "" +msgstr "*show_offsets* パラメーターを追加しました。" -#: ../../library/dis.rst:205 ../../library/dis.rst:304 -#: ../../library/dis.rst:326 ../../library/dis.rst:362 msgid "Added the *show_positions* parameter." -msgstr "" +msgstr "*show_positions* パラメーターを追加しました。" #: ../../library/dis.rst:208 msgid "Example:" msgstr "例:" -#: ../../library/dis.rst:210 msgid "" ">>> bytecode = dis.Bytecode(myfunc)\n" ">>> for instr in bytecode:\n" @@ -337,6 +343,15 @@ msgid "" "CALL\n" "RETURN_VALUE" msgstr "" +">>> bytecode = dis.Bytecode(myfunc)\n" +">>> for instr in bytecode:\n" +"... print(instr.opname)\n" +"...\n" +"RESUME\n" +"LOAD_GLOBAL\n" +"LOAD_FAST_BORROW\n" +"CALL\n" +"RETURN_VALUE" #: ../../library/dis.rst:224 msgid "Analysis functions" @@ -396,7 +411,6 @@ msgstr "" msgid "Added *file* parameter." msgstr "*file* 引数が追加されました。" -#: ../../library/dis.rst:264 msgid "" "Disassemble the *x* object. *x* can denote either a module, a class, a " "method, a function, a generator, an asynchronous generator, a coroutine, a " @@ -411,6 +425,20 @@ msgid "" "before being disassembled. If no object is provided, this function " "disassembles the last traceback." msgstr "" +"オブジェクト *x* を逆アセンブルします。\n" +"*x* にはモジュール、クラス、メソッド、関数、ジェネレーター、非同期ジェネレー" +"ター、コルーチン、コードオブジェクト、ソースコード文字列、生のバイトコードの" +"バイト列を指定できます。\n" +"モジュールの場合はすべての関数を、クラスの場合はクラスメソッドと静的メソッド" +"を含むすべてのメソッドを逆アセンブルします。\n" +"コードオブジェクトや生のバイトコードの列の場合は、バイトコード命令ごとに 1 行" +"を表示します。\n" +"入れ子のコードオブジェクトも再帰的に逆アセンブルします。\n" +"これには、ジェネレーター式、入れ子の関数やクラスの本体、:ref:`アノテーション" +"スコープ ` で使うコードオブジェクトなどが含まれます。\n" +"文字列は、組み込み関数 :func:`compile` でコードオブジェクトにコンパイルしてか" +"ら逆アセンブルします。\n" +"オブジェクトを指定しない場合は、最後のトレースバックを逆アセンブルします。" #: ../../library/dis.rst:277 ../../library/dis.rst:314 #: ../../library/dis.rst:350 @@ -421,32 +449,32 @@ msgstr "" "*file* 引数が渡された場合は、アセンブリをそこに書き込みます。\n" "そうでない場合は ``sys.stdout`` に出力します。" -#: ../../library/dis.rst:280 msgid "" "The maximal depth of recursion is limited by *depth* unless it is ``None``. " "``depth=0`` means no recursion." msgstr "" +"*depth* が ``None`` でなければ、再帰の最大の深さをその値に制限します。\n" +"``depth=0`` は再帰しないことを意味します。" -#: ../../library/dis.rst:283 msgid "" "If *show_caches* is ``True``, this function will display inline cache " "entries used by the interpreter to specialize the bytecode." msgstr "" +"*show_caches* が ``True`` なら、インタープリタがバイトコードの特殊化に使うイ" +"ンラインキャッシュエントリーを表示します。" -#: ../../library/dis.rst:286 msgid "" "If *adaptive* is ``True``, this function will display specialized bytecode " "that may be different from the original bytecode." msgstr "" +"*adaptive* が ``True`` なら、特殊化されたバイトコードを表示します。\n" +"これは元のバイトコードと異なる場合があります。" -#: ../../library/dis.rst:292 msgid "Implemented recursive disassembling and added *depth* parameter." -msgstr "" +msgstr "再帰的な逆アセンブルを実装し、*depth* パラメーターを追加しました。" -#: ../../library/dis.rst:301 ../../library/dis.rst:323 -#: ../../library/dis.rst:359 msgid "Added the *show_offsets* parameter." -msgstr "" +msgstr "*show_offsets* パラメーターを追加しました。" #: ../../library/dis.rst:310 msgid "" @@ -465,12 +493,14 @@ msgstr "" "コードオブジェクトを逆アセンブルします。*lasti* が与えられた場合は、最後の命" "令を示します。出力は次のようなカラムに分割されます:" -#: ../../library/dis.rst:337 msgid "" "the source code location of the instruction. Complete location information " "is shown if *show_positions* is true. Otherwise (the default) only the line " "number is displayed." msgstr "" +"ソースコード内の命令の位置。\n" +"*show_positions* が真なら完全な位置情報を表示します。\n" +"それ以外 (デフォルト) では行番号だけを表示します。" #: ../../library/dis.rst:340 msgid "the current instruction, indicated as ``-->``," @@ -520,29 +550,35 @@ msgstr "" "イテレータは、与えられたコードの各命令の詳細情報を保持する名前付きタプル :" "class:`Instruction` からなる列を生成します。" -#: ../../library/dis.rst:378 msgid "The *adaptive* parameter works as it does in :func:`dis`." -msgstr "" +msgstr "*adaptive* パラメーターは :func:`dis` のものと同じように動作します。" -#: ../../library/dis.rst:385 msgid "" "The *show_caches* parameter is deprecated and has no effect. The iterator " "generates the :class:`Instruction` instances with the *cache_info* field " "populated (regardless of the value of *show_caches*) and it no longer " "generates separate items for the cache entries." msgstr "" +"*show_caches* パラメーターは非推奨となり、効果がなくなりました。\n" +"イテレーターは、*show_caches* の値にかかわらず *cache_info* フィールドを設定" +"した :class:`Instruction` インスタンスを生成し、キャッシュエントリーを個別の" +"項目として生成しなくなりました。" -#: ../../library/dis.rst:393 msgid "" "This generator function uses the :meth:`~codeobject.co_lines` method of the :" "ref:`code object ` *code* to find the offsets which are starts " "of lines in the source code. They are generated as ``(offset, lineno)`` " "pairs." msgstr "" +"このジェネレーター関数は、:ref:`コードオブジェクト ` *code* " +"の :meth:`~codeobject.co_lines` メソッドを使い、ソースコードの各行が始まるオ" +"フセットを調べます。\n" +"結果は ``(offset, lineno)`` ペアとして生成されます。" -#: ../../library/dis.rst:398 msgid "Line numbers can be decreasing. Before, they were always increasing." msgstr "" +"行番号が減少する場合もあるようになりました。\n" +"以前は常に増加していました。" #: ../../library/dis.rst:401 msgid "" @@ -551,40 +587,48 @@ msgid "" "attributes of the :ref:`code object `." msgstr "" -#: ../../library/dis.rst:406 msgid "" "Line numbers can be ``None`` for bytecode that does not map to source lines." msgstr "" +"ソース行に対応しないバイトコードでは、行番号が ``None`` になる場合がありま" +"す。" -#: ../../library/dis.rst:412 msgid "" "Detect all offsets in the raw compiled bytecode string *code* which are jump " "targets, and return a list of these offsets." msgstr "" +"生のコンパイル済みバイトコード文字列 *code* 内でジャンプ先となるすべてのオフ" +"セットを検出し、そのリストを返します。" #: ../../library/dis.rst:418 msgid "Compute the stack effect of *opcode* with argument *oparg*." msgstr "*opcode* と引数 *oparg* がスタックに与える影響を計算します。" -#: ../../library/dis.rst:420 msgid "" "If the code has a jump target and *jump* is ``True``, :func:`~stack_effect` " "will return the stack effect of jumping. If *jump* is ``False``, it will " "return the stack effect of not jumping. And if *jump* is ``None`` (default), " "it will return the maximal stack effect of both cases." msgstr "" +"命令にジャンプ先があり、*jump* が ``True`` なら、:func:`~stack_effect` はジャ" +"ンプした場合のスタックへの影響を返します。\n" +"*jump* が ``False`` なら、ジャンプしない場合の影響を返します。\n" +"*jump* が ``None`` (デフォルト) なら、両者のうち大きい方を返します。" -#: ../../library/dis.rst:427 msgid "Added *jump* parameter." -msgstr "" +msgstr "*jump* パラメーターを追加しました。" -#: ../../library/dis.rst:430 msgid "" "If ``oparg`` is omitted (or ``None``), the stack effect is now returned for " "``oparg=0``. Previously this was an error for opcodes that use their arg. It " "is also no longer an error to pass an integer ``oparg`` when the ``opcode`` " "does not use it; the ``oparg`` in this case is ignored." msgstr "" +"``oparg`` を省略するか ``None`` にすると、``oparg=0`` の場合のスタックへの影" +"響を返すようになりました。\n" +"以前は、引数を使うオペコードに対してはエラーでした。\n" +"また、``opcode`` が引数を使わない場合に整数の ``oparg`` を渡してもエラーにな" +"らず、``oparg`` を無視するようになりました。" #: ../../library/dis.rst:440 msgid "Python Bytecode Instructions" @@ -614,107 +658,116 @@ msgstr "" msgid "human readable name for operation" msgstr "人間が読むための命令名" -#: ../../library/dis.rst:462 msgid "" "numeric code for the base operation if operation is specialized; otherwise " "equal to :data:`opcode`" msgstr "" +"特殊化された命令の場合は基となる命令の数値コード。\n" +"それ以外は :data:`opcode` と同じです。" -#: ../../library/dis.rst:468 msgid "" "human readable name for the base operation if operation is specialized; " "otherwise equal to :data:`opname`" msgstr "" +"特殊化された命令の場合は基となる命令の、人間が読める名前。\n" +"それ以外は :data:`opname` と同じです。" #: ../../library/dis.rst:474 msgid "numeric argument to operation (if any), otherwise ``None``" msgstr "(ある場合は) 命令の数値引数、無ければ ``None``" -#: ../../library/dis.rst:478 msgid "alias for :data:`arg`" -msgstr "" +msgstr ":data:`arg` の別名" -#: ../../library/dis.rst:482 msgid "resolved arg value (if any), otherwise ``None``" msgstr "" +"解決済みの引数値 (ある場合)。\n" +"ない場合は ``None``" -#: ../../library/dis.rst:487 msgid "" "human readable description of operation argument (if any), otherwise an " "empty string." msgstr "" +"命令の引数の、人間が読める説明 (ある場合)。\n" +"ない場合は空文字列。" #: ../../library/dis.rst:493 msgid "start index of operation within bytecode sequence" msgstr "バイトコード列の中での命令の開始位置" -#: ../../library/dis.rst:498 msgid "" "start index of operation within bytecode sequence, including prefixed " "``EXTENDED_ARG`` operations if present; otherwise equal to :data:`offset`" msgstr "" +"バイトコード列内で命令が始まるインデックス。\n" +"前に ``EXTENDED_ARG`` 命令が付く場合はそれを含め、付かない場合は :data:" +"`offset` と同じです。" -#: ../../library/dis.rst:504 msgid "start index of the cache entries following the operation" -msgstr "" +msgstr "命令に続くキャッシュエントリーの開始インデックス" -#: ../../library/dis.rst:509 msgid "end index of the cache entries following the operation" -msgstr "" +msgstr "命令に続くキャッシュエントリーの終了インデックス" -#: ../../library/dis.rst:514 msgid "``True`` if this opcode starts a source line, otherwise ``False``" -msgstr "" +msgstr "このオペコードがソース行の先頭なら ``True``、それ以外なら ``False``" -#: ../../library/dis.rst:519 msgid "" "source line number associated with this opcode (if any), otherwise ``None``" msgstr "" +"このオペコードに対応するソースの行番号 (ある場合)。\n" +"ない場合は ``None``" #: ../../library/dis.rst:524 msgid "``True`` if other code jumps to here, otherwise ``False``" msgstr "" "他のコードからここへジャンプする場合は ``True`` 、そうでない場合は ``False``" -#: ../../library/dis.rst:529 msgid "" "bytecode index of the jump target if this is a jump operation, otherwise " "``None``" msgstr "" +"ジャンプ命令の場合はジャンプ先のバイトコードのインデックス。\n" +"それ以外は ``None``" -#: ../../library/dis.rst:535 msgid "" ":class:`dis.Positions` object holding the start and end locations that are " "covered by this instruction." msgstr "" +"この命令が対応する範囲の開始位置と終了位置を保持する :class:`dis.Positions` " +"オブジェクト。" -#: ../../library/dis.rst:540 msgid "" "Information about the cache entries of this instruction, as triplets of the " "form ``(name, size, data)``, where the ``name`` and ``size`` describe the " "cache format and data is the contents of the cache. ``cache_info`` is " "``None`` if the instruction does not have caches." msgstr "" +"``(name, size, data)`` 形式の 3 要素タプルで表した、この命令のキャッシュエン" +"トリーの情報。\n" +"``name`` と ``size`` はキャッシュの形式を表し、``data`` はキャッシュの内容で" +"す。\n" +"命令にキャッシュがなければ ``cache_info`` は ``None`` です。" -#: ../../library/dis.rst:550 msgid "Field ``positions`` is added." -msgstr "" +msgstr "``positions`` フィールドを追加しました。" -#: ../../library/dis.rst:554 msgid "Changed field ``starts_line``." -msgstr "" +msgstr "``starts_line`` フィールドを変更しました。" -#: ../../library/dis.rst:556 msgid "" "Added fields ``start_offset``, ``cache_offset``, ``end_offset``, " "``baseopname``, ``baseopcode``, ``jump_target``, ``oparg``, ``line_number`` " "and ``cache_info``." msgstr "" +"``start_offset``、``cache_offset``、``end_offset``、``baseopname``、" +"``baseopcode``、``jump_target``、``oparg``、``line_number``、``cache_info`` " +"フィールドを追加しました。" -#: ../../library/dis.rst:563 msgid "" "In case the information is not available, some fields might be ``None``." msgstr "" +"情報が取得できない場合、一部のフィールドは ``None`` になることがあります。" #: ../../library/dis.rst:573 msgid "" @@ -725,78 +778,90 @@ msgstr "現在 Python コンパイラは次のバイトコード命令を生成 msgid "**General instructions**" msgstr "**一般的な命令**" -#: ../../library/dis.rst:578 msgid "" "In the following, We will refer to the interpreter stack as ``STACK`` and " "describe operations on it as if it was a Python list. The top of the stack " "corresponds to ``STACK[-1]`` in this language." msgstr "" +"以下ではインタープリタのスタックを ``STACK`` と呼び、Python のリストのように" +"扱って操作を説明します。\n" +"この表記ではスタックの先頭は ``STACK[-1]`` に相当します。" -#: ../../library/dis.rst:584 msgid "" "Do nothing code. Used as a placeholder by the bytecode optimizer, and to " "generate line tracing events." msgstr "" +"何もしない命令です。\n" +"バイトコード最適化器のプレースホルダーや、行トレースイベントの生成に使いま" +"す。" -#: ../../library/dis.rst:590 msgid "Removes the top-of-stack item::" -msgstr "" +msgstr "スタックの先頭の要素を取り除きます。 ::" -#: ../../library/dis.rst:592 msgid "STACK.pop()" -msgstr "" +msgstr "STACK.pop()" -#: ../../library/dis.rst:597 msgid "" "Removes the top-of-stack item. Equivalent to ``POP_TOP``. Used to clean up " "at the end of loops, hence the name." msgstr "" +"スタックの先頭の要素を取り除きます。\n" +"``POP_TOP`` と同じです。\n" +"ループの終わりの後始末に使うことが名前の由来です。" -#: ../../library/dis.rst:606 msgid "Implements ``del STACK[-2]``. Used to clean up when a generator exits." msgstr "" +"``del STACK[-2]`` を実行します。\n" +"ジェネレーターの終了時の後始末に使います。" -#: ../../library/dis.rst:614 msgid "" "Push the i-th item to the top of the stack without removing it from its " "original location::" msgstr "" +"先頭から ``i`` 番目の要素を元の位置から取り除かず、スタックの先頭にプッシュし" +"ます。 ::" -#: ../../library/dis.rst:617 msgid "" "assert i > 0\n" "STACK.append(STACK[-i])" msgstr "" +"assert i > 0\n" +"STACK.append(STACK[-i])" -#: ../../library/dis.rst:625 msgid "Swap the top of the stack with the i-th element::" -msgstr "" +msgstr "スタックの先頭と、先頭から ``i`` 番目の要素を交換します。 ::" -#: ../../library/dis.rst:627 msgid "STACK[-i], STACK[-1] = STACK[-1], STACK[-i]" -msgstr "" +msgstr "STACK[-i], STACK[-1] = STACK[-1], STACK[-i]" -#: ../../library/dis.rst:634 msgid "" "Rather than being an actual instruction, this opcode is used to mark extra " "space for the interpreter to cache useful data directly in the bytecode " "itself. It is automatically hidden by all ``dis`` utilities, but can be " "viewed with ``show_caches=True``." msgstr "" +"このオペコードは実際の命令ではなく、インタープリタが有用なデータをバイトコー" +"ド自体にキャッシュするための追加領域を示します。\n" +"すべての ``dis`` ユーティリティで自動的に非表示になりますが、" +"``show_caches=True`` にすると表示できます。" -#: ../../library/dis.rst:639 msgid "" "Logically, this space is part of the preceding instruction. Many opcodes " "expect to be followed by an exact number of caches, and will instruct the " "interpreter to skip over them at runtime." msgstr "" +"論理的には、この領域は直前の命令の一部です。\n" +"多くのオペコードは決まった数のキャッシュが後続することを想定し、実行時にはイ" +"ンタープリタにそれらを読み飛ばさせます。" -#: ../../library/dis.rst:643 msgid "" "Populated caches can look like arbitrary instructions, so great care should " "be taken when reading or modifying raw, adaptive bytecode containing " "quickened data." msgstr "" +"データの入ったキャッシュは任意の命令に見えることがあるため、高速化用データを" +"含む生の適応的バイトコードを読み取ったり変更したりするときは、十分な注意が必" +"要です。" #: ../../library/dis.rst:650 msgid "**Unary operations**" @@ -810,105 +875,109 @@ msgstr "" "1オペランド命令はスタックの先頭を取り出して操作を適用し、結果をスタックへプッ" "シュし戻します。" -#: ../../library/dis.rst:658 msgid "Implements ``STACK[-1] = -STACK[-1]``." -msgstr "" +msgstr "``STACK[-1] = -STACK[-1]`` を実行します。" -#: ../../library/dis.rst:663 msgid "Implements ``STACK[-1] = not STACK[-1]``." -msgstr "" +msgstr "``STACK[-1] = not STACK[-1]`` を実行します。" -#: ../../library/dis.rst:665 ../../library/dis.rst:1333 -#: ../../library/dis.rst:1349 msgid "This instruction now requires an exact :class:`bool` operand." msgstr "" +"この命令は、厳密に :class:`bool` 型の演算対象を要求するようになりました。" -#: ../../library/dis.rst:671 msgid "Implements ``STACK[-1] = ~STACK[-1]``." -msgstr "" +msgstr "``STACK[-1] = ~STACK[-1]`` を実行します。" -#: ../../library/dis.rst:676 msgid "Implements ``STACK[-1] = iter(STACK[-1])``." -msgstr "" +msgstr "``STACK[-1] = iter(STACK[-1])`` を実行します。" -#: ../../library/dis.rst:681 msgid "" "If ``STACK[-1]`` is a :term:`generator iterator` or :term:`coroutine` object " "it is left as is. Otherwise, implements ``STACK[-1] = iter(STACK[-1])``." msgstr "" +"``STACK[-1]`` が :term:`generator iterator` または :term:`coroutine` オブジェ" +"クトなら、そのままにします。\n" +"それ以外は ``STACK[-1] = iter(STACK[-1])`` を実行します。" -#: ../../library/dis.rst:689 msgid "Implements ``STACK[-1] = bool(STACK[-1])``." -msgstr "" +msgstr "``STACK[-1] = bool(STACK[-1])`` を実行します。" -#: ../../library/dis.rst:694 msgid "**Binary and in-place operations**" -msgstr "" +msgstr "**2 オペランド命令とインプレース命令**" -#: ../../library/dis.rst:696 msgid "" "Binary operations remove the top two items from the stack (``STACK[-1]`` and " "``STACK[-2]``). They perform the operation, then put the result back on the " "stack." msgstr "" +"2 オペランド命令は、スタックの先頭 2 要素 (``STACK[-1]`` と ``STACK[-2]``) を" +"取り出し、演算を行って結果をスタックに戻します。" -#: ../../library/dis.rst:699 msgid "" "In-place operations are like binary operations, but the operation is done in-" "place when ``STACK[-2]`` supports it, and the resulting ``STACK[-1]`` may be " "(but does not have to be) the original ``STACK[-2]``." msgstr "" +"インプレース命令は 2 オペランド命令に似ていますが、``STACK[-2]`` が対応してい" +"る場合はその場で演算を行います。\n" +"結果の ``STACK[-1]`` は元の ``STACK[-2]`` と同じオブジェクトになる場合があり" +"ますが、必ずそうなるわけではありません。" -#: ../../library/dis.rst:706 msgid "" "Implements the binary and in-place operators (depending on the value of " "*op*)::" msgstr "" +"*op* の値に応じた 2 オペランド演算子またはインプレース演算子を実装します。 ::" -#: ../../library/dis.rst:709 msgid "" "rhs = STACK.pop()\n" "lhs = STACK.pop()\n" "STACK.append(lhs op rhs)" msgstr "" +"rhs = STACK.pop()\n" +"lhs = STACK.pop()\n" +"STACK.append(lhs op rhs)" -#: ../../library/dis.rst:714 msgid "" "With oparg :``NB_SUBSCR``, implements binary subscript (replaces opcode " "``BINARY_SUBSCR``)" msgstr "" +"``oparg`` が ``NB_SUBSCR`` の場合は、2 オペランドの添字参照を実行します (オペ" +"コード ``BINARY_SUBSCR`` に代わるものです)。" -#: ../../library/dis.rst:720 ../../library/dis.rst:730 -#: ../../library/dis.rst:738 ../../library/dis.rst:750 -#: ../../library/dis.rst:828 ../../library/dis.rst:838 -#: ../../library/dis.rst:848 ../../library/dis.rst:1054 -#: ../../library/dis.rst:1065 ../../library/dis.rst:1176 -#: ../../library/dis.rst:1188 ../../library/dis.rst:1200 msgid "Implements::" -msgstr "" +msgstr "次の処理を実行します。 ::" -#: ../../library/dis.rst:722 msgid "" "key = STACK.pop()\n" "container = STACK.pop()\n" "value = STACK.pop()\n" "container[key] = value" msgstr "" +"key = STACK.pop()\n" +"container = STACK.pop()\n" +"value = STACK.pop()\n" +"container[key] = value" -#: ../../library/dis.rst:732 msgid "" "key = STACK.pop()\n" "container = STACK.pop()\n" "del container[key]" msgstr "" +"key = STACK.pop()\n" +"container = STACK.pop()\n" +"del container[key]" -#: ../../library/dis.rst:740 msgid "" "end = STACK.pop()\n" "start = STACK.pop()\n" "container = STACK.pop()\n" "STACK.append(container[start:end])" msgstr "" +"end = STACK.pop()\n" +"start = STACK.pop()\n" +"container = STACK.pop()\n" +"STACK.append(container[start:end])" #: ../../library/dis.rst:752 msgid "" @@ -923,108 +992,117 @@ msgstr "" msgid "**Coroutine opcodes**" msgstr "**コルーチン命令コード**" -#: ../../library/dis.rst:765 msgid "" "Implements ``STACK[-1] = get_awaitable(STACK[-1])``, where " "``get_awaitable(o)`` returns ``o`` if ``o`` is a coroutine object or a " "generator object with the :data:`~inspect.CO_ITERABLE_COROUTINE` flag, or " "resolves ``o.__await__``." msgstr "" +"``STACK[-1] = get_awaitable(STACK[-1])`` を実行します。\n" +"ここで ``get_awaitable(o)`` は、``o`` がコルーチンオブジェクトか :data:" +"`~inspect.CO_ITERABLE_COROUTINE` フラグのあるジェネレーターオブジェクトなら " +"``o`` を返し、それ以外は ``o.__await__`` を解決します。" -#: ../../library/dis.rst:770 msgid "" "If the ``where`` operand is nonzero, it indicates where the instruction " "occurs:" -msgstr "" +msgstr "``where`` オペランドがゼロでなければ、命令が現れる場所を示します:" -#: ../../library/dis.rst:773 msgid "``1``: After a call to ``__aenter__``" -msgstr "" +msgstr "``1``: ``__aenter__`` の呼び出しの後" -#: ../../library/dis.rst:774 msgid "``2``: After a call to ``__aexit__``" -msgstr "" +msgstr "``2``: ``__aexit__`` の呼び出しの後" -#: ../../library/dis.rst:778 msgid "Previously, this instruction did not have an oparg." -msgstr "" +msgstr "以前は、この命令に ``oparg`` はありませんでした。" -#: ../../library/dis.rst:784 msgid "Implements ``STACK[-1] = STACK[-1].__aiter__()``." -msgstr "" +msgstr "``STACK[-1] = STACK[-1].__aiter__()`` を実行します。" -#: ../../library/dis.rst:787 msgid "Returning awaitable objects from ``__aiter__`` is no longer supported." msgstr "" +"``__aiter__`` から awaitable オブジェクトを返すことは、サポートされなくなりま" +"した。" -#: ../../library/dis.rst:794 msgid "" "Implement ``STACK.append(get_awaitable(STACK[-1].__anext__()))`` to the " "stack. See ``GET_AWAITABLE`` for details about ``get_awaitable``." msgstr "" +"``STACK.append(get_awaitable(STACK[-1].__anext__()))`` を実行してスタックに追" +"加します。\n" +"``get_awaitable`` の詳細は ``GET_AWAITABLE`` を参照してください。" -#: ../../library/dis.rst:802 msgid "" "Terminates an :keyword:`async for` loop. Handles an exception raised when " "awaiting a next item. The stack contains the async iterable in ``STACK[-2]`` " "and the raised exception in ``STACK[-1]``. Both are popped. If the exception " "is not :exc:`StopAsyncIteration`, it is re-raised." msgstr "" +":keyword:`async for` ループを終了します。\n" +"次の要素を await するときに送出された例外を処理します。\n" +"スタックの ``STACK[-2]`` には非同期イテラブル、``STACK[-1]`` には送出された例" +"外があり、両方をポップします。\n" +"例外が :exc:`StopAsyncIteration` でなければ再送出します。" -#: ../../library/dis.rst:809 ../../library/dis.rst:900 -#: ../../library/dis.rst:911 msgid "" "Exception representation on the stack now consist of one, not three, items." -msgstr "" +msgstr "スタック上の例外の表現が、3 要素ではなく 1 要素になりました。" -#: ../../library/dis.rst:815 msgid "" "Handles an exception raised during a :meth:`~generator.throw` or :meth:" "`~generator.close` call through the current frame. If ``STACK[-1]`` is an " "instance of :exc:`StopIteration`, pop three values from the stack and push " "its ``value`` member. Otherwise, re-raise ``STACK[-1]``." msgstr "" +"現在のフレームを通じた :meth:`~generator.throw` または :meth:`~generator." +"close` の呼び出し中に送出された例外を処理します。\n" +"``STACK[-1]`` が :exc:`StopIteration` のインスタンスなら、スタックから 3 つの" +"値をポップして、その ``value`` メンバーをプッシュします。\n" +"それ以外は ``STACK[-1]`` を再送出します。" #: ../../library/dis.rst:824 msgid "**Miscellaneous opcodes**" msgstr "**その他の命令コード**" -#: ../../library/dis.rst:830 msgid "" "item = STACK.pop()\n" "set.add(STACK[-i], item)" msgstr "" +"item = STACK.pop()\n" +"set.add(STACK[-i], item)" -#: ../../library/dis.rst:833 msgid "Used to implement set comprehensions." -msgstr "" +msgstr "集合内包表記の実装に使います。" -#: ../../library/dis.rst:840 msgid "" "item = STACK.pop()\n" "list.append(STACK[-i], item)" msgstr "" +"item = STACK.pop()\n" +"list.append(STACK[-i], item)" -#: ../../library/dis.rst:843 msgid "Used to implement list comprehensions." -msgstr "" +msgstr "リスト内包表記の実装に使います。" -#: ../../library/dis.rst:850 msgid "" "value = STACK.pop()\n" "key = STACK.pop()\n" "dict.__setitem__(STACK[-i], key, value)" msgstr "" +"value = STACK.pop()\n" +"key = STACK.pop()\n" +"dict.__setitem__(STACK[-i], key, value)" -#: ../../library/dis.rst:854 msgid "Used to implement dict comprehensions." -msgstr "" +msgstr "辞書内包表記の実装に使います。" -#: ../../library/dis.rst:857 msgid "" "Map value is ``STACK[-1]`` and map key is ``STACK[-2]``. Before, those were " "reversed." msgstr "" +"マッピングの値が ``STACK[-1]``、キーが ``STACK[-2]`` になりました。\n" +"以前は逆でした。" #: ../../library/dis.rst:861 msgid "" @@ -1037,120 +1115,142 @@ msgstr "" "たは key/value ペアをスタックから取り除きますが、コンテナオブジェクトはループ" "の次のイテレーションで利用できるようにスタックに残しておきます。" -#: ../../library/dis.rst:869 msgid "Returns with ``STACK[-1]`` to the caller of the function." -msgstr "" +msgstr "``STACK[-1]`` を返り値として、関数の呼び出し元に戻ります。" -#: ../../library/dis.rst:874 msgid "Yields ``STACK.pop()`` from a :term:`generator`." -msgstr "" +msgstr ":term:`generator` から ``STACK.pop()`` を yield します。" -#: ../../library/dis.rst:876 msgid "oparg set to be the stack depth." -msgstr "" +msgstr "``oparg`` にスタックの深さを設定するようになりました。" -#: ../../library/dis.rst:879 msgid "" "oparg set to be the exception block depth, for efficient closing of " "generators." msgstr "" +"ジェネレーターを効率よく閉じるため、``oparg`` に例外ブロックの深さを設定する" +"ようになりました。" -#: ../../library/dis.rst:882 msgid "" "oparg is ``1`` if this instruction is part of a yield-from or await, and " "``0`` otherwise." msgstr "" +"``oparg`` は、この命令が yield from または await の一部なら ``1``、それ以外" +"は ``0`` になりました。" -#: ../../library/dis.rst:888 msgid "" "Checks whether ``__annotations__`` is defined in ``locals()``, if not it is " "set up to an empty ``dict``. This opcode is only emitted if a class or " "module body contains :term:`variable annotations ` " "statically." msgstr "" +"``locals()`` に ``__annotations__`` が定義されているかを確認し、なければ空の " +"``dict`` に設定します。\n" +"このオペコードは、クラスやモジュールの本体に :term:`変数アノテーション " +"` が静的に含まれる場合にのみ生成されます。" -#: ../../library/dis.rst:898 msgid "" "Pops a value from the stack, which is used to restore the exception state." -msgstr "" +msgstr "スタックから値をポップし、例外の状態を復元するために使います。" -#: ../../library/dis.rst:905 msgid "" "Re-raises the exception currently on top of the stack. If oparg is non-zero, " "pops an additional value from the stack which is used to set :attr:`~frame." "f_lasti` of the current frame." msgstr "" +"現在スタックの先頭にある例外を再送出します。\n" +"``oparg`` がゼロでなければ、さらに値を 1 つポップし、現在のフレームの :attr:" +"`~frame.f_lasti` を設定するために使います。" -#: ../../library/dis.rst:916 msgid "" "Pops a value from the stack. Pushes the current exception to the top of the " "stack. Pushes the value originally popped back to the stack. Used in " "exception handlers." msgstr "" +"スタックから値を 1 つポップします。\n" +"現在の例外をスタックの先頭にプッシュし、最初にポップした値をスタックに戻しま" +"す。\n" +"例外ハンドラーで使います。" -#: ../../library/dis.rst:924 msgid "" "Performs exception matching for ``except``. Tests whether the ``STACK[-2]`` " "is an exception matching ``STACK[-1]``. Pops ``STACK[-1]`` and pushes the " "boolean result of the test." msgstr "" +"``except`` の例外の照合を行います。\n" +"``STACK[-2]`` が ``STACK[-1]`` に一致する例外かを調べます。\n" +"``STACK[-1]`` をポップし、照合結果の真偽値をプッシュします。" -#: ../../library/dis.rst:932 msgid "" "Performs exception matching for ``except*``. Applies ``split(STACK[-1])`` on " "the exception group representing ``STACK[-2]``." msgstr "" +"``except*`` の例外の照合を行います。\n" +"``STACK[-2]`` が表す例外グループに ``split(STACK[-1])`` を適用します。" -#: ../../library/dis.rst:935 msgid "" "In case of a match, pops two items from the stack and pushes the non-" "matching subgroup (``None`` in case of full match) followed by the matching " "subgroup. When there is no match, pops one item (the match type) and pushes " "``None``." msgstr "" +"一致した場合は、スタックから 2 要素をポップし、一致しないサブグループ (すべて" +"一致した場合は ``None``)、一致するサブグループの順にプッシュします。\n" +"一致しない場合は、1 要素 (照合する型) をポップし、``None`` をプッシュします。" -#: ../../library/dis.rst:944 msgid "" "Calls the function in position 4 on the stack with arguments (type, val, tb) " "representing the exception at the top of the stack. Used to implement the " "call ``context_manager.__exit__(*exc_info())`` when an exception has " "occurred in a :keyword:`with` statement." msgstr "" +"スタックの先頭から 4 番目にある関数を、先頭の例外を表す引数 (type, val, tb) " +"で呼び出します。\n" +":keyword:`with` 文で例外が起きたときの ``context_manager." +"__exit__(*exc_info())`` の呼び出しを実装するために使います。" -#: ../../library/dis.rst:951 msgid "" "The ``__exit__`` function is in position 4 of the stack rather than 7. " "Exception representation on the stack now consist of one, not three, items." msgstr "" +"``__exit__`` 関数の位置が、スタックの先頭から 7 番目ではなく 4 番目になりまし" +"た。\n" +"スタック上の例外の表現が、3 要素ではなく 1 要素になりました。" -#: ../../library/dis.rst:958 msgid "" "Pushes a common constant onto the stack. The interpreter contains a " "hardcoded list of constants supported by this instruction. Used by the :" "keyword:`assert` statement to load :exc:`AssertionError`." msgstr "" +"よく使う定数をスタックにプッシュします。\n" +"インタープリタには、この命令がサポートする定数の固定のリストがあります。\n" +":keyword:`assert` 文で :exc:`AssertionError` をロードするために使います。" -#: ../../library/dis.rst:967 msgid "" "Pushes :func:`!builtins.__build_class__` onto the stack. It is later called " "to construct a class." msgstr "" +":func:`!builtins.__build_class__` をスタックにプッシュします。\n" +"これは後でクラスを構築するために呼び出されます。" -#: ../../library/dis.rst:972 msgid "" "Perform ``STACK.append(len(STACK[-1]))``. Used in :keyword:`match` " "statements where comparison with structure of pattern is needed." msgstr "" +"``STACK.append(len(STACK[-1]))`` を実行します。\n" +"パターンの構造との比較が必要な :keyword:`match` 文で使います。" -#: ../../library/dis.rst:980 msgid "" "If ``STACK[-1]`` is an instance of :class:`collections.abc.Mapping` (or, " "more technically: if it has the :c:macro:`Py_TPFLAGS_MAPPING` flag set in " "its :c:member:`~PyTypeObject.tp_flags`), push ``True`` onto the stack. " "Otherwise, push ``False``." msgstr "" +"``STACK[-1]`` が :class:`collections.abc.Mapping` のインスタンスなら (より厳" +"密には、:c:member:`~PyTypeObject.tp_flags` に :c:macro:`Py_TPFLAGS_MAPPING` " +"フラグが設定されていれば)、スタックに ``True`` をプッシュします。\n" +"それ以外は ``False`` をプッシュします。" -#: ../../library/dis.rst:990 msgid "" "If ``STACK[-1]`` is an instance of :class:`collections.abc.Sequence` and is " "*not* an instance of :class:`str`/:class:`bytes`/:class:`bytearray` (or, " @@ -1158,59 +1258,80 @@ msgid "" "its :c:member:`~PyTypeObject.tp_flags`), push ``True`` onto the stack. " "Otherwise, push ``False``." msgstr "" +"``STACK[-1]`` が :class:`collections.abc.Sequence` のインスタンスで、:class:" +"`str`/:class:`bytes`/:class:`bytearray` のインスタンスでは *ない* 場合 (より" +"厳密には、:c:member:`~PyTypeObject.tp_flags` に :c:macro:" +"`Py_TPFLAGS_SEQUENCE` フラグが設定されていれば)、スタックに ``True`` をプッ" +"シュします。\n" +"それ以外は ``False`` をプッシュします。" -#: ../../library/dis.rst:1000 msgid "" "``STACK[-1]`` is a tuple of mapping keys, and ``STACK[-2]`` is the match " "subject. If ``STACK[-2]`` contains all of the keys in ``STACK[-1]``, push a :" "class:`tuple` containing the corresponding values. Otherwise, push ``None``." msgstr "" +"``STACK[-1]`` はマッピングのキーのタプル、``STACK[-2]`` は照合対象です。\n" +"``STACK[-2]`` が ``STACK[-1]`` のすべてのキーを含んでいれば、対応する値を含" +"む :class:`tuple` をプッシュします。\n" +"それ以外は ``None`` をプッシュします。" -#: ../../library/dis.rst:1006 ../../library/dis.rst:1714 msgid "" "Previously, this instruction also pushed a boolean value indicating success " "(``True``) or failure (``False``)." msgstr "" +"以前は、成功 (``True``) または失敗 (``False``) を示す真偽値もプッシュしていま" +"した。" -#: ../../library/dis.rst:1013 msgid "" "Implements ``name = STACK.pop()``. *namei* is the index of *name* in the " "attribute :attr:`~codeobject.co_names` of the :ref:`code object `. The compiler tries to use :opcode:`STORE_FAST` or :opcode:" "`STORE_GLOBAL` if possible." msgstr "" +"``name = STACK.pop()`` を実行します。\n" +"*namei* は、:ref:`コードオブジェクト ` の :attr:`~codeobject." +"co_names` 属性内の ``name`` のインデックスです。\n" +"コンパイラは、可能なら :opcode:`STORE_FAST` または :opcode:`STORE_GLOBAL` を" +"使おうとします。" -#: ../../library/dis.rst:1020 msgid "" "Implements ``del name``, where *namei* is the index into :attr:`~codeobject." "co_names` attribute of the :ref:`code object `." msgstr "" +"``del name`` を実行します。\n" +"*namei* は :ref:`コードオブジェクト ` の :attr:`~codeobject." +"co_names` 属性内のインデックスです。" -#: ../../library/dis.rst:1026 msgid "" "Unpacks ``STACK[-1]`` into *count* individual values, which are put onto the " "stack right-to-left. Require there to be exactly *count* values.::" msgstr "" +"``STACK[-1]`` を *count* 個の値にアンパックし、右から左の順にスタックに置きま" +"す。\n" +"値はちょうど *count* 個でなければなりません。 ::" -#: ../../library/dis.rst:1029 msgid "" "assert(len(STACK[-1]) == count)\n" "STACK.extend(STACK.pop()[:-count-1:-1])" msgstr "" +"assert(len(STACK[-1]) == count)\n" +"STACK.extend(STACK.pop()[:-count-1:-1])" -#: ../../library/dis.rst:1035 msgid "" "Implements assignment with a starred target: Unpacks an iterable in " "``STACK[-1]`` into individual values, where the total number of values can " "be smaller than the number of items in the iterable: one of the new values " "will be a list of all leftover items." msgstr "" +"星付きの代入先への代入を実装します。\n" +"``STACK[-1]`` のイテラブルを個別の値にアンパックしますが、値の総数はイテラブ" +"ルの要素数より少なくてもかまいません。\n" +"新しい値の 1 つは、残りの要素をすべて含むリストになります。" -#: ../../library/dis.rst:1040 msgid "The number of values before and after the list value is limited to 255." msgstr "" +"リストとなる値の前後の値の数は、それぞれ 255 個までに制限されています。" -#: ../../library/dis.rst:1042 msgid "" "The number of values before the list value is encoded in the argument of the " "opcode. The number of values after the list if any is encoded using an " @@ -1218,6 +1339,12 @@ msgid "" "values where the low byte of *counts* is the number of values before the " "list value, the high byte of *counts* the number of values after it." msgstr "" +"リストとなる値より前の値の数はオペコードの引数に符号化されます。\n" +"リストより後にも値がある場合、その数は ``EXTENDED_ARG`` を使って符号化されま" +"す。\n" +"したがって、引数は 2 バイトの値とみなせます。\n" +"*counts* の下位バイトがリストより前の値の数、上位バイトがリストより後の値の数" +"です。" #: ../../library/dis.rst:1048 msgid "" @@ -1225,30 +1352,35 @@ msgid "" "d`` will be stored after execution as ``STACK.extend((a, b, c))``." msgstr "" -#: ../../library/dis.rst:1056 msgid "" "obj = STACK.pop()\n" "value = STACK.pop()\n" "obj.name = value" msgstr "" +"obj = STACK.pop()\n" +"value = STACK.pop()\n" +"obj.name = value" -#: ../../library/dis.rst:1060 msgid "" "where *namei* is the index of name in :attr:`~codeobject.co_names` of the :" "ref:`code object `." msgstr "" +"ここで *namei* は :ref:`コードオブジェクト ` の :attr:" +"`~codeobject.co_names` 内の ``name`` のインデックスです。" -#: ../../library/dis.rst:1067 msgid "" "obj = STACK.pop()\n" "del obj.name" msgstr "" +"obj = STACK.pop()\n" +"del obj.name" -#: ../../library/dis.rst:1070 msgid "" "where *namei* is the index of name into :attr:`~codeobject.co_names` of the :" "ref:`code object `." msgstr "" +"ここで *namei* は :ref:`コードオブジェクト ` の :attr:" +"`~codeobject.co_names` 内の ``name`` のインデックスです。" #: ../../library/dis.rst:1076 msgid "Works as :opcode:`STORE_NAME`, but stores the name as a global." @@ -1266,10 +1398,11 @@ msgstr "" msgid "Pushes ``co_consts[consti]`` onto the stack." msgstr "``co_consts[consti]`` をスタックにプッシュします。" -#: ../../library/dis.rst:1091 msgid "" "Pushes the integer ``i`` onto the stack. ``i`` must be in ``range(256)``" msgstr "" +"整数 ``i`` をスタックにプッシュします。\n" +"``i`` は ``range(256)`` の範囲内でなければなりません。" #: ../../library/dis.rst:1099 msgid "" @@ -1277,20 +1410,22 @@ msgid "" "value is known to be immortal." msgstr "" -#: ../../library/dis.rst:1107 msgid "" "Pushes the value associated with ``co_names[namei]`` onto the stack. The " "name is looked up within the locals, then the globals, then the builtins." msgstr "" +"``co_names[namei]`` に対応する値をスタックにプッシュします。\n" +"名前はローカル、グローバル、組み込みの順に探します。" -#: ../../library/dis.rst:1113 msgid "" "Pushes a reference to the locals dictionary onto the stack. This is used to " "prepare namespace dictionaries for :opcode:`LOAD_FROM_DICT_OR_DEREF` and :" "opcode:`LOAD_FROM_DICT_OR_GLOBALS`." msgstr "" +"ローカル変数の辞書への参照をスタックにプッシュします。\n" +":opcode:`LOAD_FROM_DICT_OR_DEREF` と :opcode:`LOAD_FROM_DICT_OR_GLOBALS` に渡" +"す名前空間の辞書を準備するために使います。" -#: ../../library/dis.rst:1122 msgid "" "Pops a mapping off the stack and looks up the value for ``co_names[namei]``. " "If the name is not found there, looks it up in the globals and then the " @@ -1298,14 +1433,19 @@ msgid "" "variables in :ref:`annotation scopes ` within class " "bodies." msgstr "" +"スタックからマッピングをポップし、``co_names[namei]`` の値を探します。\n" +"そこに名前がなければ、:opcode:`LOAD_GLOBAL` と同様にグローバル、組み込みの順" +"に探します。\n" +"クラス本体の :ref:`アノテーションスコープ ` でグローバル変" +"数をロードするために使います。" -#: ../../library/dis.rst:1133 msgid "" "Creates a tuple consuming *count* items from the stack, and pushes the " "resulting tuple onto the stack::" msgstr "" +"スタックから *count* 個の要素を取り出してタプルを作り、そのタプルをスタックに" +"プッシュします。 ::" -#: ../../library/dis.rst:1136 msgid "" "if count == 0:\n" " value = ()\n" @@ -1315,6 +1455,13 @@ msgid "" "\n" "STACK.append(value)" msgstr "" +"if count == 0:\n" +" value = ()\n" +"else:\n" +" value = tuple(STACK[-count:])\n" +" STACK = STACK[:-count]\n" +"\n" +"STACK.append(value)" #: ../../library/dis.rst:1147 msgid "Works as :opcode:`BUILD_TUPLE`, but creates a list." @@ -1328,64 +1475,68 @@ msgstr "" ":opcode:`BUILD_TUPLE` と同じように動作しますが、この命令は set を作り出しま" "す。" -#: ../../library/dis.rst:1157 msgid "" "Pushes a new dictionary object onto the stack. Pops ``2 * count`` items so " "that the dictionary holds *count* entries: ``{..., STACK[-4]: STACK[-3], " "STACK[-2]: STACK[-1]}``." msgstr "" +"新しい辞書オブジェクトをスタックにプッシュします。\n" +"辞書が ``{..., STACK[-4]: STACK[-3], STACK[-2]: STACK[-1]}`` という *count* " +"個のエントリーを持つように、``2 * count`` 個の要素をポップします。" -#: ../../library/dis.rst:1161 msgid "" "The dictionary is created from stack items instead of creating an empty " "dictionary pre-sized to hold *count* items." msgstr "" +"*count* 個の要素を収容するサイズの空の辞書を作るのではなく、スタックの要素か" +"ら辞書を作るようになりました。" -#: ../../library/dis.rst:1168 msgid "" "Concatenates *count* strings from the stack and pushes the resulting string " "onto the stack." msgstr "" +"スタックから *count* 個の文字列を連結し、結果の文字列をスタックにプッシュしま" +"す。" -#: ../../library/dis.rst:1178 msgid "" "seq = STACK.pop()\n" "list.extend(STACK[-i], seq)" msgstr "" +"seq = STACK.pop()\n" +"list.extend(STACK[-i], seq)" -#: ../../library/dis.rst:1181 msgid "Used to build lists." -msgstr "" +msgstr "リストの構築に使います。" -#: ../../library/dis.rst:1190 msgid "" "seq = STACK.pop()\n" "set.update(STACK[-i], seq)" msgstr "" +"seq = STACK.pop()\n" +"set.update(STACK[-i], seq)" -#: ../../library/dis.rst:1193 msgid "Used to build sets." -msgstr "" +msgstr "集合の構築に使います。" -#: ../../library/dis.rst:1202 msgid "" "map = STACK.pop()\n" "dict.update(STACK[-i], map)" msgstr "" +"map = STACK.pop()\n" +"dict.update(STACK[-i], map)" -#: ../../library/dis.rst:1205 msgid "Used to build dicts." -msgstr "" +msgstr "辞書の構築に使います。" -#: ../../library/dis.rst:1212 msgid "Like :opcode:`DICT_UPDATE` but raises an exception for duplicate keys." -msgstr "" +msgstr ":opcode:`DICT_UPDATE` と同じですが、キーが重複すると例外を送出します。" -#: ../../library/dis.rst:1219 msgid "" "If the low bit of ``namei`` is not set, this replaces ``STACK[-1]`` with " "``getattr(STACK[-1], co_names[namei>>1])``." msgstr "" +"``namei`` の最下位ビットが立っていなければ、``STACK[-1]`` を " +"``getattr(STACK[-1], co_names[namei>>1])`` に置き換えます。" #: ../../library/dis.rst:1222 msgid "" @@ -1399,34 +1550,33 @@ msgid "" "pushed." msgstr "" -#: ../../library/dis.rst:1231 msgid "" "If the low bit of ``namei`` is set, then a ``NULL`` or ``self`` is pushed to " "the stack before the attribute or unbound method respectively." msgstr "" +"``namei`` の最下位ビットが立っている場合、属性または非束縛メソッドより先に、" +"それぞれ ``NULL`` または ``self`` をスタックにプッシュするようになりました。" -#: ../../library/dis.rst:1238 msgid "" "This opcode implements :func:`super`, both in its zero-argument and two-" "argument forms (e.g. ``super().method()``, ``super().attr`` and ``super(cls, " "self).method()``, ``super(cls, self).attr``)." msgstr "" +"このオペコードは、引数なしと引数 2 つの両方の :func:`super` を実装します (例" +"えば ``super().method()``、``super().attr``、``super(cls, self).method()``、" +"``super(cls, self).attr``)。" -#: ../../library/dis.rst:1242 msgid "It pops three values from the stack (from top of stack down):" -msgstr "" +msgstr "スタックの先頭から順に、次の 3 つの値をポップします:" -#: ../../library/dis.rst:1244 msgid "``self``: the first argument to the current method" -msgstr "" +msgstr "``self``: 現在のメソッドの最初の引数" -#: ../../library/dis.rst:1245 msgid "``cls``: the class within which the current method was defined" -msgstr "" +msgstr "``cls``: 現在のメソッドを定義したクラス" -#: ../../library/dis.rst:1246 msgid "the global ``super``" -msgstr "" +msgstr "グローバルの ``super``" #: ../../library/dis.rst:1248 msgid "" @@ -1441,11 +1591,12 @@ msgid "" "it is unset a single value is pushed to the stack." msgstr "" -#: ../../library/dis.rst:1255 msgid "" "The second-low bit of ``namei``, if set, means that this was a two-argument " "call to :func:`super` (unset means zero-argument)." msgstr "" +"``namei`` の下から 2 番目のビットが立っていれば、引数 2 つの :func:`super` 呼" +"び出しであることを示します (立っていなければ引数なしです)。" #: ../../library/dis.rst:1263 msgid "" @@ -1454,21 +1605,23 @@ msgid "" "(``opname & 16``), the result should be coerced to ``bool``." msgstr "" -#: ../../library/dis.rst:1267 msgid "" "The fifth-lowest bit of the oparg now indicates a forced conversion to :" "class:`bool`." msgstr "" +"``oparg`` の下から 5 番目のビットが、:class:`bool` への強制変換を表すようにな" +"りました。" -#: ../../library/dis.rst:1274 msgid "Performs ``is`` comparison, or ``is not`` if ``invert`` is 1." msgstr "" +"``is`` による比較を行います。\n" +"``invert`` が 1 なら ``is not`` による比較を行います。" -#: ../../library/dis.rst:1281 msgid "Performs ``in`` comparison, or ``not in`` if ``invert`` is 1." msgstr "" +"``in`` による比較を行います。\n" +"``invert`` が 1 なら ``not in`` による比較を行います。" -#: ../../library/dis.rst:1288 msgid "" "Imports the module ``co_names[namei]``. ``STACK[-1]`` and ``STACK[-2]`` are " "popped and provide the *fromlist* and *level* arguments of :func:" @@ -1476,61 +1629,78 @@ msgid "" "namespace is not affected: for a proper import statement, a subsequent :" "opcode:`STORE_FAST` instruction modifies the namespace." msgstr "" +"モジュール ``co_names[namei]`` をインポートします。\n" +"``STACK[-1]`` と ``STACK[-2]`` をポップし、:func:`__import__` の *fromlist* " +"と *level* 引数として使います。\n" +"モジュールオブジェクトをスタックにプッシュします。\n" +"現在の名前空間は変わりません。\n" +"通常の import 文では、後続の :opcode:`STORE_FAST` 命令が名前空間を変更しま" +"す。" -#: ../../library/dis.rst:1296 msgid "" "Loads the attribute ``co_names[namei]`` from the module found in " "``STACK[-1]``. The resulting object is pushed onto the stack, to be " "subsequently stored by a :opcode:`STORE_FAST` instruction." msgstr "" +"``STACK[-1]`` にあるモジュールから属性 ``co_names[namei]`` をロードします。\n" +"結果のオブジェクトをスタックにプッシュし、その後の :opcode:`STORE_FAST` 命令" +"で保存できるようにします。" #: ../../library/dis.rst:1303 msgid "Increments bytecode counter by *delta*." msgstr "バイトコードカウンタを *delta* だけ増加させます。" -#: ../../library/dis.rst:1308 msgid "Decrements bytecode counter by *delta*. Checks for interrupts." msgstr "" +"バイトコードカウンターを *delta* だけ減らします。\n" +"割り込みをチェックします。" -#: ../../library/dis.rst:1315 msgid "Decrements bytecode counter by *delta*. Does not check for interrupts." msgstr "" +"バイトコードカウンターを *delta* だけ減らします。\n" +"割り込みはチェックしません。" -#: ../../library/dis.rst:1322 msgid "" "If ``STACK[-1]`` is true, increments the bytecode counter by *delta*. " "``STACK[-1]`` is popped." msgstr "" +"``STACK[-1]`` が真なら、バイトコードカウンターを *delta* だけ増やします。\n" +"``STACK[-1]`` はポップします。" -#: ../../library/dis.rst:1325 ../../library/dis.rst:1341 msgid "" "The oparg is now a relative delta rather than an absolute target. This " "opcode is a pseudo-instruction, replaced in final bytecode by the directed " "versions (forward/backward)." msgstr "" +"``oparg`` は絶対位置のジャンプ先ではなく、相対的な差分になりました。\n" +"このオペコードは疑似命令となり、最終的なバイトコードでは方向 (前方/後方) ごと" +"の命令に置き換えられます。" -#: ../../library/dis.rst:1330 ../../library/dis.rst:1346 -#: ../../library/dis.rst:1359 ../../library/dis.rst:1370 msgid "This is no longer a pseudo-instruction." -msgstr "" +msgstr "疑似命令ではなくなりました。" -#: ../../library/dis.rst:1338 msgid "" "If ``STACK[-1]`` is false, increments the bytecode counter by *delta*. " "``STACK[-1]`` is popped." msgstr "" +"``STACK[-1]`` が偽なら、バイトコードカウンターを *delta* だけ増やします。\n" +"``STACK[-1]`` はポップします。" -#: ../../library/dis.rst:1354 msgid "" "If ``STACK[-1]`` is not ``None``, increments the bytecode counter by " "*delta*. ``STACK[-1]`` is popped." msgstr "" +"``STACK[-1]`` が ``None`` でなければ、バイトコードカウンターを *delta* だけ増" +"やします。\n" +"``STACK[-1]`` はポップします。" -#: ../../library/dis.rst:1365 msgid "" "If ``STACK[-1]`` is ``None``, increments the bytecode counter by *delta*. " "``STACK[-1]`` is popped." msgstr "" +"``STACK[-1]`` が ``None`` なら、バイトコードカウンターを *delta* だけ増やしま" +"す。\n" +"``STACK[-1]`` はポップします。" #: ../../library/dis.rst:1375 msgid "" @@ -1540,9 +1710,8 @@ msgid "" "code counter is incremented by *delta*." msgstr "" -#: ../../library/dis.rst:1380 msgid "Up until 3.11 the iterator was popped when it was exhausted." -msgstr "" +msgstr "3.11 までは、要素を使い切るとイテレーターをポップしていました。" #: ../../library/dis.rst:1385 msgid "Loads the global named ``co_names[namei>>1]`` onto the stack." @@ -1561,84 +1730,94 @@ msgid "" msgstr "" "ローカルな ``co_varnames[var_num]`` への参照をスタックにプッシュします。" -#: ../../library/dis.rst:1395 msgid "" "This opcode is now only used in situations where the local variable is " "guaranteed to be initialized. It cannot raise :exc:`UnboundLocalError`." msgstr "" +"このオペコードは、ローカル変数が初期化されていることが保証される場合にのみ使" +"うようになりました。\n" +":exc:`UnboundLocalError` を送出することはありません。" -#: ../../library/dis.rst:1401 msgid "" "Pushes a borrowed reference to the local ``co_varnames[var_num]`` onto the " "stack." msgstr "" +"ローカル変数 ``co_varnames[var_num]`` への借用参照をスタックにプッシュしま" +"す。" -#: ../../library/dis.rst:1408 msgid "" "Pushes references to ``co_varnames[var_nums >> 4]`` and " "``co_varnames[var_nums & 15]`` onto the stack." msgstr "" +"``co_varnames[var_nums >> 4]`` と ``co_varnames[var_nums & 15]`` への参照をス" +"タックにプッシュします。" -#: ../../library/dis.rst:1416 msgid "" "Pushes borrowed references to ``co_varnames[var_nums >> 4]`` and " "``co_varnames[var_nums & 15]`` onto the stack." msgstr "" +"``co_varnames[var_nums >> 4]`` と ``co_varnames[var_nums & 15]`` への借用参照" +"をスタックにプッシュします。" -#: ../../library/dis.rst:1423 msgid "" "Pushes a reference to the local ``co_varnames[var_num]`` onto the stack, " "raising an :exc:`UnboundLocalError` if the local variable has not been " "initialized." msgstr "" +"ローカル変数 ``co_varnames[var_num]`` への参照をスタックにプッシュします。\n" +"変数が初期化されていなければ :exc:`UnboundLocalError` を送出します。" -#: ../../library/dis.rst:1431 msgid "" "Pushes a reference to the local ``co_varnames[var_num]`` onto the stack (or " "pushes ``NULL`` onto the stack if the local variable has not been " "initialized) and sets ``co_varnames[var_num]`` to ``NULL``." msgstr "" +"ローカル変数 ``co_varnames[var_num]`` への参照をスタックにプッシュします (変" +"数が初期化されていなければ ``NULL`` をプッシュします)。\n" +"そして ``co_varnames[var_num]`` を ``NULL`` に設定します。" -#: ../../library/dis.rst:1439 msgid "Stores ``STACK.pop()`` into the local ``co_varnames[var_num]``." -msgstr "" +msgstr "``STACK.pop()`` をローカル変数 ``co_varnames[var_num]`` に保存します。" -#: ../../library/dis.rst:1443 msgid "" "Stores ``STACK[-1]`` into ``co_varnames[var_nums >> 4]`` and ``STACK[-2]`` " "into ``co_varnames[var_nums & 15]``." msgstr "" +"``STACK[-1]`` を ``co_varnames[var_nums >> 4]`` に、``STACK[-2]`` を " +"``co_varnames[var_nums & 15]`` に保存します。" -#: ../../library/dis.rst:1450 msgid "" "Stores ``STACK.pop()`` into the local ``co_varnames[var_nums >> 4]`` and " "pushes a reference to the local ``co_varnames[var_nums & 15]`` onto the " "stack." msgstr "" +"``STACK.pop()`` をローカル変数 ``co_varnames[var_nums >> 4]`` に保存し、ロー" +"カル変数 ``co_varnames[var_nums & 15]`` への参照をスタックにプッシュします。" #: ../../library/dis.rst:1458 msgid "Deletes local ``co_varnames[var_num]``." msgstr "ローカルな ``co_varnames[var_num]`` を削除します。" -#: ../../library/dis.rst:1463 msgid "" "Creates a new cell in slot ``i``. If that slot is nonempty then that value " "is stored into the new cell." msgstr "" +"スロット ``i`` に新しいセルを作ります。\n" +"スロットが空でなければ、その値を新しいセルに保存します。" -#: ../../library/dis.rst:1471 msgid "" "Loads the cell contained in slot ``i`` of the \"fast locals\" storage. " "Pushes a reference to the object the cell contains on the stack." msgstr "" +"\"fast locals\" 領域のスロット ``i`` にあるセルをロードします。\n" +"セルに入っているオブジェクトへの参照をスタックにプッシュします。" -#: ../../library/dis.rst:1474 ../../library/dis.rst:1496 -#: ../../library/dis.rst:1507 msgid "" "``i`` is no longer offset by the length of :attr:`~codeobject.co_varnames`." msgstr "" +"``i`` に :attr:`~codeobject.co_varnames` の長さをオフセットとして加えなくなり" +"ました。" -#: ../../library/dis.rst:1480 msgid "" "Pops a mapping off the stack and looks up the name associated with slot " "``i`` of the \"fast locals\" storage in this mapping. If the name is not " @@ -1648,113 +1827,126 @@ msgid "" "LOAD_CLASSDEREF`) and in :ref:`annotation scopes ` within " "class bodies." msgstr "" +"スタックからマッピングをポップし、その中で \"fast locals\" 領域のスロット " +"``i`` に対応する名前を探します。\n" +"名前がなければ、:opcode:`LOAD_DEREF` と同様にスロット ``i`` のセルからロード" +"します。\n" +"クラス本体 (以前は :opcode:`!LOAD_CLASSDEREF` を使用) や、クラス本体の :ref:`" +"アノテーションスコープ ` で :term:`クロージャ変数 " +"` をロードするために使います。" -#: ../../library/dis.rst:1493 msgid "" "Stores ``STACK.pop()`` into the cell contained in slot ``i`` of the \"fast " "locals\" storage." msgstr "" +"``STACK.pop()`` を \"fast locals\" 領域のスロット ``i`` にあるセルに保存しま" +"す。" -#: ../../library/dis.rst:1502 msgid "" "Empties the cell contained in slot ``i`` of the \"fast locals\" storage. " "Used by the :keyword:`del` statement." msgstr "" +"\"fast locals\" 領域のスロット ``i`` にあるセルを空にします。\n" +":keyword:`del` 文で使います。" -#: ../../library/dis.rst:1513 msgid "" "Copies the ``n`` :term:`free (closure) variables ` from " "the closure into the frame. Removes the need for special code on the " "caller's side when calling closures." msgstr "" +"クロージャからフレームへ、``n`` 個の :term:`自由 (クロージャ) 変数 ` をコピーします。\n" +"これにより、クロージャの呼び出し元で特別なコードを用意する必要がなくなりま" +"す。" -#: ../../library/dis.rst:1522 msgid "" "Raises an exception using one of the 3 forms of the ``raise`` statement, " "depending on the value of *argc*:" msgstr "" +"*argc* の値に応じて、``raise`` 文の 3 つの形式のいずれかで例外を送出します:" -#: ../../library/dis.rst:1525 msgid "0: ``raise`` (re-raise previous exception)" -msgstr "" +msgstr "0: ``raise`` (直前の例外を再送出)" -#: ../../library/dis.rst:1526 msgid "" "1: ``raise STACK[-1]`` (raise exception instance or type at ``STACK[-1]``)" msgstr "" +"1: ``raise STACK[-1]`` (``STACK[-1]`` の例外インスタンスまたは例外型を送出)" -#: ../../library/dis.rst:1527 msgid "" "2: ``raise STACK[-2] from STACK[-1]`` (raise exception instance or type at " "``STACK[-2]`` with ``__cause__`` set to ``STACK[-1]``)" msgstr "" +"2: ``raise STACK[-2] from STACK[-1]`` (``__cause__`` を ``STACK[-1]`` に設定" +"し、``STACK[-2]`` の例外インスタンスまたは例外型を送出)" -#: ../../library/dis.rst:1533 msgid "" "Calls a callable object with the number of arguments specified by ``argc``. " "On the stack are (in ascending order):" msgstr "" +"``argc`` で指定した数の引数で呼び出し可能オブジェクトを呼び出します。\n" +"スタックには下から上の順に次のものがあります:" -#: ../../library/dis.rst:1536 ../../library/dis.rst:1560 msgid "The callable" -msgstr "" +msgstr "呼び出し可能オブジェクト" -#: ../../library/dis.rst:1537 ../../library/dis.rst:1561 msgid "``self`` or ``NULL``" -msgstr "" +msgstr "``self`` または ``NULL``" -#: ../../library/dis.rst:1538 ../../library/dis.rst:1562 msgid "The remaining positional arguments" -msgstr "" +msgstr "残りの位置引数" -#: ../../library/dis.rst:1540 msgid "``argc`` is the total of the positional arguments, excluding ``self``." -msgstr "" +msgstr "``argc`` は ``self`` を除いた位置引数の総数です。" -#: ../../library/dis.rst:1542 msgid "" "``CALL`` pops all arguments and the callable object off the stack, calls the " "callable object with those arguments, and pushes the return value returned " "by the callable object." msgstr "" +"``CALL`` はすべての引数と呼び出し可能オブジェクトをスタックからポップし、それ" +"らの引数でオブジェクトを呼び出して、その返り値をスタックにプッシュします。" -#: ../../library/dis.rst:1548 msgid "The callable now always appears at the same position on the stack." msgstr "" +"呼び出し可能オブジェクトが、常にスタック上の同じ位置に現れるようになりまし" +"た。" -#: ../../library/dis.rst:1551 msgid "Calls with keyword arguments are now handled by :opcode:`CALL_KW`." msgstr "" +"キーワード引数のある呼び出しは :opcode:`CALL_KW` で処理するようになりました。" -#: ../../library/dis.rst:1557 msgid "" "Calls a callable object with the number of arguments specified by ``argc``, " "including one or more named arguments. On the stack are (in ascending order):" msgstr "" +"1 つ以上の名前付き引数を含む、``argc`` で指定した数の引数で呼び出し可能オブ" +"ジェクトを呼び出します。\n" +"スタックには下から上の順に次のものがあります:" -#: ../../library/dis.rst:1563 msgid "The named arguments" -msgstr "" +msgstr "名前付き引数" -#: ../../library/dis.rst:1564 msgid "A :class:`tuple` of keyword argument names" -msgstr "" +msgstr "キーワード引数名の :class:`tuple`" -#: ../../library/dis.rst:1566 msgid "" "``argc`` is the total of the positional and named arguments, excluding " "``self``. The length of the tuple of keyword argument names is the number of " "named arguments." msgstr "" +"``argc`` は ``self`` を除いた位置引数と名前付き引数の総数です。\n" +"キーワード引数名のタプルの長さが、名前付き引数の数です。" -#: ../../library/dis.rst:1569 msgid "" "``CALL_KW`` pops all arguments, the keyword names, and the callable object " "off the stack, calls the callable object with those arguments, and pushes " "the return value returned by the callable object." msgstr "" +"``CALL_KW`` はすべての引数、キーワード名、呼び出し可能オブジェクトをスタック" +"からポップし、それらの引数でオブジェクトを呼び出して、その返り値をスタックに" +"プッシュします。" -#: ../../library/dis.rst:1578 msgid "" "Calls a callable object with variable set of positional and keyword " "arguments. If the lowest bit of *flags* is set, the top of the stack " @@ -1765,6 +1957,14 @@ msgid "" "callable object off the stack, calls the callable object with those " "arguments, and pushes the return value returned by the callable object." msgstr "" +"可変個の位置引数とキーワード引数で呼び出し可能オブジェクトを呼び出します。\n" +"*flags* の最下位ビットが立っている場合、スタックの先頭には追加のキーワード引" +"数を含むマッピングオブジェクトがあります。\n" +"呼び出し前に、マッピングオブジェクトとイテラブルをそれぞれアンパックし、内容" +"をキーワード引数と位置引数として渡します。\n" +"``CALL_FUNCTION_EX`` はすべての引数と呼び出し可能オブジェクトをスタックから" +"ポップし、それらの引数でオブジェクトを呼び出して、その返り値をスタックにプッ" +"シュします。" #: ../../library/dis.rst:1593 msgid "" @@ -1772,231 +1972,260 @@ msgid "" "``NULL`` pushed by :opcode:`LOAD_METHOD` for non-method calls." msgstr "" -#: ../../library/dis.rst:1602 msgid "" "Pushes a new function object on the stack built from the code object at " "``STACK[-1]``." msgstr "" +"``STACK[-1]`` にあるコードオブジェクトから新しい関数オブジェクトを作り、ス" +"タックにプッシュします。" -#: ../../library/dis.rst:1604 msgid "Flag value ``0x04`` is a tuple of strings instead of dictionary" -msgstr "" +msgstr "フラグ値 ``0x04`` は、辞書ではなく文字列のタプルになりました。" -#: ../../library/dis.rst:1607 msgid "Qualified name at ``STACK[-1]`` was removed." -msgstr "" +msgstr "``STACK[-1]`` にあった修飾名を取り除きました。" -#: ../../library/dis.rst:1610 msgid "" "Extra function attributes on the stack, signaled by oparg flags, were " "removed. They now use :opcode:`SET_FUNCTION_ATTRIBUTE`." msgstr "" +"``oparg`` のフラグで指定していた、スタック上の追加の関数属性を取り除きまし" +"た。\n" +"これらには :opcode:`SET_FUNCTION_ATTRIBUTE` を使うようになりました。" -#: ../../library/dis.rst:1617 msgid "" "Sets an attribute on a function object. Expects the function at " "``STACK[-1]`` and the attribute value to set at ``STACK[-2]``; consumes both " "and leaves the function at ``STACK[-1]``. The flag determines which " "attribute to set:" msgstr "" +"関数オブジェクトの属性を設定します。\n" +"``STACK[-1]`` に関数、``STACK[-2]`` に設定する属性値があることを想定し、両方" +"を取り出して関数を ``STACK[-1]`` に残します。\n" +"設定する属性はフラグで決まります:" -#: ../../library/dis.rst:1621 msgid "" "``0x01`` a tuple of default values for positional-only and positional-or-" "keyword parameters in positional order" msgstr "" +"``0x01`` 位置専用パラメーターと位置またはキーワードのパラメーターのデフォルト" +"値を、位置の順に並べたタプル" -#: ../../library/dis.rst:1623 msgid "``0x02`` a dictionary of keyword-only parameters' default values" -msgstr "" +msgstr "``0x02`` キーワード専用パラメーターのデフォルト値の辞書" #: ../../library/dis.rst:1624 msgid "``0x04`` a tuple of strings containing parameters' annotations" msgstr "" -#: ../../library/dis.rst:1625 msgid "``0x08`` a tuple containing cells for free variables, making a closure" -msgstr "" +msgstr "``0x08`` 自由変数のセルを含み、クロージャを構成するタプル" -#: ../../library/dis.rst:1634 msgid "" "Pushes a slice object on the stack. *argc* must be 2 or 3. If it is 2, " "implements::" msgstr "" +"スライスオブジェクトをスタックにプッシュします。\n" +"*argc* は 2 または 3 でなければなりません。\n" +"2 の場合は次の処理を行います。 ::" -#: ../../library/dis.rst:1636 msgid "" "end = STACK.pop()\n" "start = STACK.pop()\n" "STACK.append(slice(start, end))" msgstr "" +"end = STACK.pop()\n" +"start = STACK.pop()\n" +"STACK.append(slice(start, end))" -#: ../../library/dis.rst:1640 msgid "if it is 3, implements::" -msgstr "" +msgstr "3 の場合は次の処理を行います。 ::" -#: ../../library/dis.rst:1642 msgid "" "step = STACK.pop()\n" "end = STACK.pop()\n" "start = STACK.pop()\n" "STACK.append(slice(start, end, step))" msgstr "" +"step = STACK.pop()\n" +"end = STACK.pop()\n" +"start = STACK.pop()\n" +"STACK.append(slice(start, end, step))" -#: ../../library/dis.rst:1647 msgid "See the :func:`slice` built-in function for more information." -msgstr "" +msgstr "詳しくは組み込み関数 :func:`slice` を参照してください。" -#: ../../library/dis.rst:1652 msgid "" "Prefixes any opcode which has an argument too big to fit into the default " "one byte. *ext* holds an additional byte which act as higher bits in the " "argument. For each opcode, at most three prefixal ``EXTENDED_ARG`` are " "allowed, forming an argument from two-byte to four-byte." msgstr "" +"デフォルトの 1 バイトに収まらない大きさの引数を持つオペコードの前に付けま" +"す。\n" +"*ext* は、引数の上位ビットとなる追加の 1 バイトを保持します。\n" +"各オペコードの前には最大 3 つの ``EXTENDED_ARG`` を付けられ、2 バイトから 4 " +"バイトの引数を構成できます。" -#: ../../library/dis.rst:1660 msgid "Convert value to a string, depending on ``oparg``::" -msgstr "" +msgstr "``oparg`` に応じて値を文字列に変換します。 ::" -#: ../../library/dis.rst:1662 msgid "" "value = STACK.pop()\n" "result = func(value)\n" "STACK.append(result)" msgstr "" +"value = STACK.pop()\n" +"result = func(value)\n" +"STACK.append(result)" -#: ../../library/dis.rst:1666 msgid "``oparg == 1``: call :func:`str` on *value*" -msgstr "" +msgstr "``oparg == 1``: *value* に :func:`str` を適用します" -#: ../../library/dis.rst:1667 msgid "``oparg == 2``: call :func:`repr` on *value*" -msgstr "" +msgstr "``oparg == 2``: *value* に :func:`repr` を適用します" -#: ../../library/dis.rst:1668 msgid "``oparg == 3``: call :func:`ascii` on *value*" -msgstr "" +msgstr "``oparg == 3``: *value* に :func:`ascii` を適用します" -#: ../../library/dis.rst:1670 ../../library/dis.rst:1683 -#: ../../library/dis.rst:1696 msgid "Used for implementing formatted string literals (f-strings)." -msgstr "" +msgstr "フォーマット済み文字列リテラル (f-string) の実装に使います。" -#: ../../library/dis.rst:1677 msgid "Formats the value on top of stack::" -msgstr "" +msgstr "スタックの先頭の値を書式化します。 ::" -#: ../../library/dis.rst:1679 msgid "" "value = STACK.pop()\n" "result = value.__format__(\"\")\n" "STACK.append(result)" msgstr "" +"value = STACK.pop()\n" +"result = value.__format__(\"\")\n" +"STACK.append(result)" -#: ../../library/dis.rst:1689 msgid "Formats the given value with the given format spec::" -msgstr "" +msgstr "指定された値を、指定された書式指定で書式化します。 ::" -#: ../../library/dis.rst:1691 msgid "" "spec = STACK.pop()\n" "value = STACK.pop()\n" "result = value.__format__(spec)\n" "STACK.append(result)" msgstr "" +"spec = STACK.pop()\n" +"value = STACK.pop()\n" +"result = value.__format__(spec)\n" +"STACK.append(result)" -#: ../../library/dis.rst:1703 msgid "" "``STACK[-1]`` is a tuple of keyword attribute names, ``STACK[-2]`` is the " "class being matched against, and ``STACK[-3]`` is the match subject. " "*count* is the number of positional sub-patterns." msgstr "" +"``STACK[-1]`` はキーワード属性名のタプル、``STACK[-2]`` は照合に使うクラス、" +"``STACK[-3]`` は照合対象です。\n" +"*count* は位置によるサブパターンの数です。" -#: ../../library/dis.rst:1707 msgid "" "Pop ``STACK[-1]``, ``STACK[-2]``, and ``STACK[-3]``. If ``STACK[-3]`` is an " "instance of ``STACK[-2]`` and has the positional and keyword attributes " "required by *count* and ``STACK[-1]``, push a tuple of extracted attributes. " "Otherwise, push ``None``." msgstr "" +"``STACK[-1]``、``STACK[-2]``、``STACK[-3]`` をポップします。\n" +"``STACK[-3]`` が ``STACK[-2]`` のインスタンスで、*count* と ``STACK[-1]`` が" +"要求する位置属性とキーワード属性を持っていれば、取り出した属性のタプルをプッ" +"シュします。\n" +"それ以外は ``None`` をプッシュします。" -#: ../../library/dis.rst:1721 msgid "A no-op. Performs internal tracing, debugging and optimization checks." msgstr "" +"何もしない命令です。\n" +"内部のトレース、デバッグ、最適化のためのチェックを行います。" -#: ../../library/dis.rst:1723 msgid "" "The ``context`` operand consists of two parts. The lowest two bits indicate " "where the ``RESUME`` occurs:" msgstr "" +"``context`` オペランドは 2 つの部分で構成されます。\n" +"下位 2 ビットは ``RESUME`` が現れる位置を示します:" -#: ../../library/dis.rst:1726 msgid "" "``0`` The start of a function, which is neither a generator, coroutine nor " "an async generator" msgstr "" +"``0`` ジェネレーター、コルーチン、非同期ジェネレーターのいずれでもない関数の" +"開始位置" -#: ../../library/dis.rst:1728 msgid "``1`` After a ``yield`` expression" -msgstr "" +msgstr "``1`` ``yield`` 式の後" -#: ../../library/dis.rst:1729 msgid "``2`` After a ``yield from`` expression" -msgstr "" +msgstr "``2`` ``yield from`` 式の後" -#: ../../library/dis.rst:1730 msgid "``3`` After an ``await`` expression" -msgstr "" +msgstr "``3`` ``await`` 式の後" -#: ../../library/dis.rst:1732 msgid "" "The next bit is ``1`` if the RESUME is at except-depth ``1``, and ``0`` " "otherwise." msgstr "" +"その次のビットは、RESUME の例外処理の深さが ``1`` なら ``1``、それ以外なら " +"``0`` です。" -#: ../../library/dis.rst:1737 msgid "The oparg value changed to include information about except-depth" -msgstr "" +msgstr "``oparg`` の値に例外処理の深さの情報を含めるようになりました。" -#: ../../library/dis.rst:1743 msgid "" "Create a generator, coroutine, or async generator from the current frame. " "Used as first opcode of in code object for the above mentioned callables. " "Clear the current frame and return the newly created generator." msgstr "" +"現在のフレームからジェネレーター、コルーチン、非同期ジェネレーターを作成しま" +"す。\n" +"これらの呼び出し可能オブジェクトのコードオブジェクトで、最初のオペコードとし" +"て使います。\n" +"現在のフレームをクリアし、新しく作ったジェネレーターを返します。" -#: ../../library/dis.rst:1752 msgid "" "Equivalent to ``STACK[-1] = STACK[-2].send(STACK[-1])``. Used in ``yield " "from`` and ``await`` statements." msgstr "" +"``STACK[-1] = STACK[-2].send(STACK[-1])`` と同じです。\n" +"``yield from`` と ``await`` 文で使います。" -#: ../../library/dis.rst:1755 msgid "" "If the call raises :exc:`StopIteration`, pop the top value from the stack, " "push the exception's ``value`` attribute, and increment the bytecode counter " "by *delta*." msgstr "" +"呼び出しが :exc:`StopIteration` を送出した場合、スタックの先頭の値をポップ" +"し、例外の ``value`` 属性をプッシュして、バイトコードカウンターを *delta* だ" +"け増やします。" -#: ../../library/dis.rst:1764 msgid "" "This is not really an opcode. It identifies the dividing line between " "opcodes in the range [0,255] which don't use their argument and those that " "do (``< HAVE_ARGUMENT`` and ``>= HAVE_ARGUMENT``, respectively)." msgstr "" +"これは実際にはオペコードではありません。\n" +"[0,255] の範囲のオペコードについて、引数を使わないもの (``< HAVE_ARGUMENT``) " +"と使うもの (``>= HAVE_ARGUMENT``) の境界を示します。" -#: ../../library/dis.rst:1768 msgid "" "If your application uses pseudo instructions or specialized instructions, " "use the :data:`hasarg` collection instead." msgstr "" +"アプリケーションで疑似命令や特殊化された命令を扱う場合は、代わりに :data:" +"`hasarg` コレクションを使ってください。" -#: ../../library/dis.rst:1771 msgid "" "Now every instruction has an argument, but opcodes ``< HAVE_ARGUMENT`` " "ignore it. Before, only opcodes ``>= HAVE_ARGUMENT`` had an argument." msgstr "" +"すべての命令が引数を持つようになりましたが、``< HAVE_ARGUMENT`` のオペコード" +"は引数を無視します。\n" +"以前は ``>= HAVE_ARGUMENT`` のオペコードだけが引数を持っていました。" #: ../../library/dis.rst:1775 msgid "" @@ -2005,205 +2234,186 @@ msgid "" "their arg." msgstr "" -#: ../../library/dis.rst:1780 msgid "Use :data:`hasarg` instead." -msgstr "" +msgstr "代わりに :data:`hasarg` を使ってください。" -#: ../../library/dis.rst:1785 msgid "" "Calls an intrinsic function with one argument. Passes ``STACK[-1]`` as the " "argument and sets ``STACK[-1]`` to the result. Used to implement " "functionality that is not performance critical." msgstr "" +"引数を 1 つ取る内部関数を呼び出します。\n" +"``STACK[-1]`` を引数として渡し、結果を ``STACK[-1]`` に設定します。\n" +"性能が重要ではない機能の実装に使います。" -#: ../../library/dis.rst:1789 ../../library/dis.rst:1843 msgid "The operand determines which intrinsic function is called:" -msgstr "" +msgstr "どの内部関数を呼び出すかはオペランドで決まります:" -#: ../../library/dis.rst:1792 ../../library/dis.rst:1846 msgid "Operand" -msgstr "" +msgstr "オペランド" #: ../../library/dis.rst:1792 ../../library/dis.rst:1846 msgid "Description" msgstr "説明" -#: ../../library/dis.rst:1794 msgid "``INTRINSIC_1_INVALID``" -msgstr "" +msgstr "``INTRINSIC_1_INVALID``" -#: ../../library/dis.rst:1794 ../../library/dis.rst:1848 msgid "Not valid" -msgstr "" +msgstr "無効" -#: ../../library/dis.rst:1796 msgid "``INTRINSIC_PRINT``" -msgstr "" +msgstr "``INTRINSIC_PRINT``" -#: ../../library/dis.rst:1796 msgid "Prints the argument to standard out. Used in the REPL." msgstr "" +"引数を標準出力に表示します。\n" +"REPL で使います。" -#: ../../library/dis.rst:1799 msgid "``INTRINSIC_IMPORT_STAR``" -msgstr "" +msgstr "``INTRINSIC_IMPORT_STAR``" -#: ../../library/dis.rst:1799 msgid "Performs ``import *`` for the named module." -msgstr "" +msgstr "指定された名前のモジュールに対して ``import *`` を実行します。" -#: ../../library/dis.rst:1802 msgid "``INTRINSIC_STOPITERATION_ERROR``" -msgstr "" +msgstr "``INTRINSIC_STOPITERATION_ERROR``" #: ../../library/dis.rst:1802 msgid "Extracts the return value from a ``StopIteration`` exception." msgstr "" -#: ../../library/dis.rst:1805 msgid "``INTRINSIC_ASYNC_GEN_WRAP``" -msgstr "" +msgstr "``INTRINSIC_ASYNC_GEN_WRAP``" -#: ../../library/dis.rst:1805 msgid "Wraps an async generator value" -msgstr "" +msgstr "非同期ジェネレーターの値をラップします" -#: ../../library/dis.rst:1807 msgid "``INTRINSIC_UNARY_POSITIVE``" -msgstr "" +msgstr "``INTRINSIC_UNARY_POSITIVE``" -#: ../../library/dis.rst:1807 msgid "Performs the unary ``+`` operation" -msgstr "" +msgstr "単項 ``+`` 演算を行います" -#: ../../library/dis.rst:1810 msgid "``INTRINSIC_LIST_TO_TUPLE``" -msgstr "" +msgstr "``INTRINSIC_LIST_TO_TUPLE``" -#: ../../library/dis.rst:1810 msgid "Converts a list to a tuple" -msgstr "" +msgstr "リストをタプルに変換します" -#: ../../library/dis.rst:1812 msgid "``INTRINSIC_TYPEVAR``" -msgstr "" +msgstr "``INTRINSIC_TYPEVAR``" -#: ../../library/dis.rst:1812 msgid "Creates a :class:`typing.TypeVar`" -msgstr "" +msgstr ":class:`typing.TypeVar` を作成します" -#: ../../library/dis.rst:1814 msgid "``INTRINSIC_PARAMSPEC``" -msgstr "" +msgstr "``INTRINSIC_PARAMSPEC``" -#: ../../library/dis.rst:1814 msgid "Creates a :class:`typing.ParamSpec`" -msgstr "" +msgstr ":class:`typing.ParamSpec` を作成します" -#: ../../library/dis.rst:1817 msgid "``INTRINSIC_TYPEVARTUPLE``" -msgstr "" +msgstr "``INTRINSIC_TYPEVARTUPLE``" -#: ../../library/dis.rst:1817 msgid "Creates a :class:`typing.TypeVarTuple`" -msgstr "" +msgstr ":class:`typing.TypeVarTuple` を作成します" -#: ../../library/dis.rst:1820 msgid "``INTRINSIC_SUBSCRIPT_GENERIC``" -msgstr "" +msgstr "``INTRINSIC_SUBSCRIPT_GENERIC``" -#: ../../library/dis.rst:1820 msgid "Returns :class:`typing.Generic` subscripted with the argument" -msgstr "" +msgstr "引数を添字とした :class:`typing.Generic` を返します" -#: ../../library/dis.rst:1823 msgid "``INTRINSIC_TYPEALIAS``" -msgstr "" +msgstr "``INTRINSIC_TYPEALIAS``" -#: ../../library/dis.rst:1823 msgid "" "Creates a :class:`typing.TypeAliasType`; used in the :keyword:`type` " "statement. The argument is a tuple of the type alias's name, type " "parameters, and value." msgstr "" +":class:`typing.TypeAliasType` を作成します。\n" +":keyword:`type` 文で使います。\n" +"引数は、型エイリアスの名前、型パラメーター、値のタプルです。" -#: ../../library/dis.rst:1835 msgid "" "Calls an intrinsic function with two arguments. Used to implement " "functionality that is not performance critical::" msgstr "" +"引数を 2 つ取る内部関数を呼び出します。\n" +"性能が重要ではない機能の実装に使います。 ::" -#: ../../library/dis.rst:1838 msgid "" "arg2 = STACK.pop()\n" "arg1 = STACK.pop()\n" "result = intrinsic2(arg1, arg2)\n" "STACK.append(result)" msgstr "" +"arg2 = STACK.pop()\n" +"arg1 = STACK.pop()\n" +"result = intrinsic2(arg1, arg2)\n" +"STACK.append(result)" -#: ../../library/dis.rst:1848 msgid "``INTRINSIC_2_INVALID``" -msgstr "" +msgstr "``INTRINSIC_2_INVALID``" -#: ../../library/dis.rst:1850 msgid "``INTRINSIC_PREP_RERAISE_STAR``" -msgstr "" +msgstr "``INTRINSIC_PREP_RERAISE_STAR``" -#: ../../library/dis.rst:1850 msgid "Calculates the :exc:`ExceptionGroup` to raise from a ``try-except*``." -msgstr "" +msgstr "``try-except*`` から送出する :exc:`ExceptionGroup` を計算します。" -#: ../../library/dis.rst:1854 msgid "``INTRINSIC_TYPEVAR_WITH_BOUND``" -msgstr "" +msgstr "``INTRINSIC_TYPEVAR_WITH_BOUND``" -#: ../../library/dis.rst:1854 msgid "Creates a :class:`typing.TypeVar` with a bound." -msgstr "" +msgstr "上限付きの :class:`typing.TypeVar` を作成します。" -#: ../../library/dis.rst:1857 msgid "``INTRINSIC_TYPEVAR_WITH_CONSTRAINTS``" -msgstr "" +msgstr "``INTRINSIC_TYPEVAR_WITH_CONSTRAINTS``" -#: ../../library/dis.rst:1857 msgid "Creates a :class:`typing.TypeVar` with constraints." -msgstr "" +msgstr "制約付きの :class:`typing.TypeVar` を作成します。" -#: ../../library/dis.rst:1861 msgid "``INTRINSIC_SET_FUNCTION_TYPE_PARAMS``" -msgstr "" +msgstr "``INTRINSIC_SET_FUNCTION_TYPE_PARAMS``" -#: ../../library/dis.rst:1861 msgid "Sets the ``__type_params__`` attribute of a function." -msgstr "" +msgstr "関数の ``__type_params__`` 属性を設定します。" -#: ../../library/dis.rst:1870 msgid "" "Performs special method lookup on ``STACK[-1]``. If ``type(STACK[-1])." "__xxx__`` is a method, leave ``type(STACK[-1]).__xxx__; STACK[-1]`` on the " "stack. If ``type(STACK[-1]).__xxx__`` is not a method, leave ``STACK[-1]." "__xxx__; NULL`` on the stack." msgstr "" +"``STACK[-1]`` の特殊メソッドを検索します。\n" +"``type(STACK[-1]).__xxx__`` がメソッドなら、``type(STACK[-1]).__xxx__; " +"STACK[-1]`` をスタックに残します。\n" +"メソッドでなければ、``STACK[-1].__xxx__; NULL`` をスタックに残します。" -#: ../../library/dis.rst:1879 msgid "**Pseudo-instructions**" -msgstr "" +msgstr "**疑似命令**" -#: ../../library/dis.rst:1881 msgid "" "These opcodes do not appear in Python bytecode. They are used by the " "compiler but are replaced by real opcodes or removed before bytecode is " "generated." msgstr "" +"これらのオペコードは Python のバイトコードには現れません。\n" +"コンパイラが使用しますが、バイトコードを生成する前に実際のオペコードに置き換" +"えられるか、取り除かれます。" -#: ../../library/dis.rst:1886 msgid "" "Set up an exception handler for the following code block. If an exception " "occurs, the value stack level is restored to its current state and control " "is transferred to the exception handler at ``target``." msgstr "" +"後続のコードブロックの例外ハンドラーを設定します。\n" +"例外が発生すると、値スタックの深さを現在の状態に戻し、``target`` の例外ハンド" +"ラーに制御を移します。" -#: ../../library/dis.rst:1893 msgid "" "Like ``SETUP_FINALLY``, but in case of an exception also pushes the last " "instruction (``lasti``) to the stack so that ``RERAISE`` can restore it. If " @@ -2211,53 +2421,62 @@ msgid "" "frame are restored to their current state, and control is transferred to the " "exception handler at ``target``." msgstr "" +"``SETUP_FINALLY`` と同じですが、例外発生時に最後の命令 (``lasti``) もスタック" +"にプッシュし、``RERAISE`` で復元できるようにします。\n" +"例外が発生すると、値スタックの深さとフレーム内の最後の命令を現在の状態に戻" +"し、``target`` の例外ハンドラーに制御を移します。" -#: ../../library/dis.rst:1902 msgid "" "Like ``SETUP_CLEANUP``, but in case of an exception one more item is popped " "from the stack before control is transferred to the exception handler at " "``target``." msgstr "" +"``SETUP_CLEANUP`` と同じですが、例外発生時にスタックからさらに 1 要素をポップ" +"してから、``target`` の例外ハンドラーに制御を移します。" -#: ../../library/dis.rst:1906 msgid "" "This variant is used in :keyword:`with` and :keyword:`async with` " "constructs, which push the return value of the context manager's :meth:" "`~object.__enter__` or :meth:`~object.__aenter__` to the stack." msgstr "" +"この変種は :keyword:`with` と :keyword:`async with` で使います。\n" +"これらの構文は、コンテキストマネージャの :meth:`~object.__enter__` または :" +"meth:`~object.__aenter__` の返り値をスタックにプッシュします。" -#: ../../library/dis.rst:1913 msgid "" "Marks the end of the code block associated with the last ``SETUP_FINALLY``, " "``SETUP_CLEANUP`` or ``SETUP_WITH``." msgstr "" +"直前の ``SETUP_FINALLY``、``SETUP_CLEANUP``、``SETUP_WITH`` に対応するコード" +"ブロックの終わりを示します。" -#: ../../library/dis.rst:1919 msgid "" "Undirected relative jump instructions which are replaced by their directed " "(forward/backward) counterparts by the assembler." msgstr "" +"方向の指定のない相対ジャンプ命令です。\n" +"アセンブラーが、対応する方向 (前方/後方) の命令に置き換えます。" -#: ../../library/dis.rst:1925 msgid "" "Conditional jumps which do not impact the stack. Replaced by the sequence " "``COPY 1``, ``TO_BOOL``, ``POP_JUMP_IF_TRUE/FALSE``." msgstr "" +"スタックを変更しない条件付きジャンプです。\n" +"``COPY 1``、``TO_BOOL``、``POP_JUMP_IF_TRUE/FALSE`` の並びに置き換えます。" -#: ../../library/dis.rst:1930 msgid "" "Pushes a reference to the cell contained in slot ``i`` of the \"fast " "locals\" storage." msgstr "" +"\"fast locals\" 領域のスロット ``i`` にあるセルへの参照をスタックにプッシュし" +"ます。" -#: ../../library/dis.rst:1933 msgid "" "Note that ``LOAD_CLOSURE`` is replaced with ``LOAD_FAST`` in the assembler." -msgstr "" +msgstr "``LOAD_CLOSURE`` はアセンブラーで ``LOAD_FAST`` に置き換えられます。" -#: ../../library/dis.rst:1935 msgid "This opcode is now a pseudo-instruction." -msgstr "" +msgstr "このオペコードは疑似命令になりました。" #: ../../library/dis.rst:1941 msgid "" @@ -2277,12 +2496,14 @@ msgstr "" "これらのコレクションは、自動でバイトコード命令を解析するために提供されていま" "す:" -#: ../../library/dis.rst:1953 msgid "" "The collections now contain pseudo instructions and instrumented " "instructions as well. These are opcodes with values ``>= MIN_PSEUDO_OPCODE`` " "and ``>= MIN_INSTRUMENTED_OPCODE``." msgstr "" +"これらのコレクションは、疑似命令と計測用命令も含むようになりました。\n" +"これらは、それぞれ ``>= MIN_PSEUDO_OPCODE`` と ``>= " +"MIN_INSTRUMENTED_OPCODE`` の値を持つオペコードです。" #: ../../library/dis.rst:1960 msgid "Sequence of operation names, indexable using the bytecode." @@ -2298,15 +2519,13 @@ msgstr "命令コード名をバイトコードに対応づける辞書。" msgid "Sequence of all compare operation names." msgstr "すべての比較命令の名前のリスト。" -#: ../../library/dis.rst:1975 msgid "Sequence of bytecodes that use their argument." -msgstr "" +msgstr "引数を使うバイトコードのシーケンス。" #: ../../library/dis.rst:1982 msgid "Sequence of bytecodes that access a constant." msgstr "定数にアクセスするバイトコードのリスト。" -#: ../../library/dis.rst:1987 msgid "" "Sequence of bytecodes that access a :term:`free (closure) variable `. 'free' in this context refers to names in the current scope that " @@ -2314,14 +2533,20 @@ msgid "" "from this scope. It does *not* include references to global or builtin " "scopes." msgstr "" +":term:`自由 (クロージャ) 変数 ` にアクセスするバイトコード" +"のシーケンス。\n" +"ここで「自由」とは、内側のスコープから参照される現在のスコープの名前、または" +"現在のスコープから参照される外側のスコープの名前を指します。\n" +"グローバルや組み込みのスコープへの参照は *含みません*。" #: ../../library/dis.rst:1995 msgid "Sequence of bytecodes that access an attribute by name." msgstr "名前によって属性にアクセスするバイトコードのリスト。" -#: ../../library/dis.rst:2000 msgid "Sequence of bytecodes that have a jump target. All jumps are relative." msgstr "" +"ジャンプ先を持つバイトコードのシーケンス。\n" +"ジャンプはすべて相対ジャンプです。" #: ../../library/dis.rst:2007 msgid "Sequence of bytecodes that access a local variable." @@ -2331,25 +2556,26 @@ msgstr "ローカル変数にアクセスするバイトコードのリスト。 msgid "Sequence of bytecodes of Boolean operations." msgstr "ブール命令のバイトコードのリスト。" -#: ../../library/dis.rst:2016 msgid "Sequence of bytecodes that set an exception handler." -msgstr "" +msgstr "例外ハンドラーを設定するバイトコードのシーケンス。" #: ../../library/dis.rst:2023 msgid "Sequence of bytecodes that have a relative jump target." msgstr "相対ジャンプ先を持つバイトコードのリスト。" -#: ../../library/dis.rst:2025 msgid "All jumps are now relative. Use :data:`hasjump`." msgstr "" +"すべてのジャンプが相対ジャンプになりました。\n" +":data:`hasjump` を使ってください。" #: ../../library/dis.rst:2031 msgid "Sequence of bytecodes that have an absolute jump target." msgstr "絶対ジャンプ先を持つバイトコードのリスト。" -#: ../../library/dis.rst:2033 msgid "All jumps are now relative. This list is empty." msgstr "" +"すべてのジャンプが相対ジャンプになりました。\n" +"このリストは空です。" #: ../../library/dis.rst:1632 msgid "built-in function" diff --git a/library/distribution.po b/library/distribution.po index b3dddc3f6..5f88a8089 100644 --- a/library/distribution.po +++ b/library/distribution.po @@ -17,10 +17,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/distribution.rst:3 diff --git a/library/distutils.po b/library/distutils.po index fe2836c87..8c0265191 100644 --- a/library/distutils.po +++ b/library/distutils.po @@ -12,26 +12,30 @@ msgstr "" "PO-Revision-Date: 2024-11-19 01:02+0000\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" -#: ../../library/distutils.rst:2 msgid ":mod:`!distutils` --- Building and installing Python modules" -msgstr "" +msgstr ":mod:`!distutils` --- Python モジュールのビルドとインストール" -#: ../../library/distutils.rst:10 msgid "" "This module is no longer part of the Python standard library. It was :ref:" "`removed in Python 3.12 ` after being " "deprecated in Python 3.10. The removal was decided in :pep:`632`, which has " "`migration advice `_." msgstr "" +"このモジュールは Python 標準ライブラリから削除されました。\n" +"Python 3.10 で非推奨となった後、:ref:`Python 3.12 で削除されました " +"`。\n" +"削除は :pep:`632` で決定され、この PEP には `移行に関する助言 `_ も記載されています。" -#: ../../library/distutils.rst:16 msgid "" "The last version of Python that provided the :mod:`!distutils` module was " "`Python 3.11 `_." msgstr "" +":mod:`!distutils` モジュールを提供していた最後の Python バージョンは `Python " +"3.11 `_ です。" diff --git a/library/doctest.po b/library/doctest.po index f73874b67..cf2a38bdc 100644 --- a/library/doctest.po +++ b/library/doctest.po @@ -23,10 +23,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/doctest.rst:2 @@ -79,7 +79,6 @@ msgstr "" msgid "Here's a complete but small example module::" msgstr "以下に完全かつ短い実行例を示します::" -#: ../../library/doctest.rst:33 msgid "" "\"\"\"\n" "This is the \"example\" module.\n" @@ -136,6 +135,62 @@ msgid "" " import doctest\n" " doctest.testmod()" msgstr "" +"\"\"\"\n" +"これは \"example\" モジュールです。\n" +"\n" +"example モジュールは factorial() という関数を一つ提供します。\n" +"例えば、\n" +"\n" +">>> factorial(5)\n" +"120\n" +"\"\"\"\n" +"\n" +"def factorial(n):\n" +" \"\"\"0 以上の整数 n の階乗を返します。\n" +"\n" +" >>> [factorial(n) for n in range(6)]\n" +" [1, 1, 2, 6, 24, 120]\n" +" >>> factorial(30)\n" +" 265252859812191058636308480000000\n" +" >>> factorial(-1)\n" +" Traceback (most recent call last):\n" +" ...\n" +" ValueError: n must be >= 0\n" +"\n" +" 浮動小数点数でも階乗を求められますが、その値は厳密に整数でなければなりま" +"せん:\n" +" >>> factorial(30.1)\n" +" Traceback (most recent call last):\n" +" ...\n" +" ValueError: n must be exact integer\n" +" >>> factorial(30.0)\n" +" 265252859812191058636308480000000\n" +"\n" +" また、極端に大きな値も使えません:\n" +" >>> factorial(1e100)\n" +" Traceback (most recent call last):\n" +" ...\n" +" OverflowError: n too large\n" +" \"\"\"\n" +"\n" +" import math\n" +" if not n >= 0:\n" +" raise ValueError(\"n must be >= 0\")\n" +" if math.floor(n) != n:\n" +" raise ValueError(\"n must be exact integer\")\n" +" if n+1 == n: # 1e300 のような値を検出\n" +" raise OverflowError(\"n too large\")\n" +" result = 1\n" +" factor = 2\n" +" while factor <= n:\n" +" result *= factor\n" +" factor += 1\n" +" return result\n" +"\n" +"\n" +"if __name__ == \"__main__\":\n" +" import doctest\n" +" doctest.testmod()" #: ../../library/doctest.rst:88 msgid "" @@ -150,6 +205,8 @@ msgid "" "$ python example.py\n" "$" msgstr "" +"$ python example.py\n" +"$" #: ../../library/doctest.rst:96 msgid "" @@ -161,7 +218,6 @@ msgstr "" "を意味しています。スクリプトに ``-v`` を与えると、 :mod:`doctest` は何を行お" "うとしているのかを記録した詳細なログを出力し、最後にまとめを出力します:" -#: ../../library/doctest.rst:100 msgid "" "$ python example.py -v\n" "Trying:\n" @@ -175,12 +231,22 @@ msgid "" " [1, 1, 2, 6, 24, 120]\n" "ok" msgstr "" +"$ python example.py -v\n" +"Trying:\n" +" factorial(5)\n" +"Expecting:\n" +" 120\n" +"ok\n" +"Trying:\n" +" [factorial(n) for n in range(6)]\n" +"Expecting:\n" +" [1, 1, 2, 6, 24, 120]\n" +"ok" #: ../../library/doctest.rst:114 msgid "And so on, eventually ending with:" msgstr "といった具合で、最後には:" -#: ../../library/doctest.rst:116 msgid "" "Trying:\n" " factorial(1e100)\n" @@ -197,6 +263,20 @@ msgid "" "Test passed.\n" "$" msgstr "" +"Trying:\n" +" factorial(1e100)\n" +"Expecting:\n" +" Traceback (most recent call last):\n" +" ...\n" +" OverflowError: n too large\n" +"ok\n" +"2 items passed all tests:\n" +" 1 test in __main__\n" +" 6 tests in __main__.factorial\n" +"7 tests in 2 items.\n" +"7 passed.\n" +"Test passed.\n" +"$" #: ../../library/doctest.rst:133 msgid "" @@ -207,11 +287,12 @@ msgid "" "file :file:`Lib/test/test_doctest/test_doctest.py`." msgstr "" -#: ../../library/doctest.rst:139 msgid "" "Output is colorized by default and can be :ref:`controlled using environment " "variables `." msgstr "" +"出力はデフォルトで色付きになり、:ref:`環境変数で制御できます `。" #: ../../library/doctest.rst:147 msgid "Simple Usage: Checking Examples in Docstrings" @@ -222,17 +303,22 @@ msgid "" "The simplest way to start using doctest (but not necessarily the way you'll " "continue to do it) is to end each module :mod:`!M` with::" msgstr "" +"doctest を試す簡単な方法 (とはいえ、いつもそうする必要はないのですが) は、各" +"モジュール :mod:`!M` の最後を、以下のようにして締めくくることです::" -#: ../../library/doctest.rst:152 msgid "" "if __name__ == \"__main__\":\n" " import doctest\n" " doctest.testmod()" msgstr "" +"if __name__ == \"__main__\":\n" +" import doctest\n" +" doctest.testmod()" #: ../../library/doctest.rst:156 msgid ":mod:`!doctest` then examines docstrings in module :mod:`!M`." msgstr "" +"こうすると、 :mod:`!doctest` は :mod:`!M` 中の docstring を検査します。" #: ../../library/doctest.rst:158 msgid "" @@ -244,7 +330,7 @@ msgstr "" #: ../../library/doctest.rst:161 msgid "python M.py" -msgstr "" +msgstr "python M.py" #: ../../library/doctest.rst:163 msgid "" @@ -264,7 +350,7 @@ msgstr "一方、``-v`` スイッチをつけて走らせると::" #: ../../library/doctest.rst:170 msgid "python M.py -v" -msgstr "" +msgstr "python M.py -v" #: ../../library/doctest.rst:172 msgid "" @@ -286,11 +372,12 @@ msgstr "" "func:`testmod` は ``sys.argv`` 上のスイッチを調べません。(したがって、 ``-" "v`` をつけても効果はありません)。" -#: ../../library/doctest.rst:180 msgid "" "There is also a command line shortcut for running :func:`testmod`, see " "section :ref:`doctest-cli`." msgstr "" +":func:`testmod` をコマンドラインから簡単に実行する方法もあります。\n" +":ref:`doctest-cli` 節を参照してください。" #: ../../library/doctest.rst:183 msgid "" @@ -317,6 +404,8 @@ msgid "" "import doctest\n" "doctest.testfile(\"example.txt\")" msgstr "" +"import doctest\n" +"doctest.testfile(\"example.txt\")" #: ../../library/doctest.rst:197 msgid "" @@ -331,7 +420,6 @@ msgstr "" "ラムである必要はありません!例えば、 :file:`example.txt` には以下のような内容" "が入っているとします:" -#: ../../library/doctest.rst:202 msgid "" "The ``example`` module\n" "======================\n" @@ -349,6 +437,21 @@ msgid "" " >>> factorial(6)\n" " 120" msgstr "" +"``example`` モジュール\n" +"=====================\n" +"\n" +"``factorial`` の使い方\n" +"---------------------\n" +"\n" +"これは reStructuredText 形式のテキストファイルの例です。\n" +"まず ``example`` モジュールから ``factorial`` をインポートします:\n" +"\n" +" >>> from example import factorial\n" +"\n" +"次に、使ってみましょう:\n" +"\n" +" >>> factorial(6)\n" +" 120" #: ../../library/doctest.rst:220 msgid "" @@ -358,7 +461,6 @@ msgstr "" "``doctest.testfile(\"example.txt\")`` を実行すると、このドキュメント内のエ" "ラーを見つけ出します::" -#: ../../library/doctest.rst:223 msgid "" "File \"./example.txt\", line 14, in example.txt\n" "Failed example:\n" @@ -368,6 +470,13 @@ msgid "" "Got:\n" " 720" msgstr "" +"File \"./example.txt\", line 14, in example.txt\n" +"Failed example:\n" +" factorial(6)\n" +"Expected:\n" +" 120\n" +"Got:\n" +" 720" #: ../../library/doctest.rst:231 msgid "" @@ -388,8 +497,8 @@ msgid "" "locations." msgstr "" "デフォルトでは、 :func:`testfile` は自分自身を呼び出したモジュールのあるディ" -"レクトリを探します。その他の場所にあるファイルを見に行くように :func:" -"`testfile` に指示するためのオプション引数についての説明は :ref:`doctest-" +"レクトリを探します。その他の場所にあるファイルを見に行くように " +"``testfile()`` に指示するためのオプション引数についての説明は :ref:`doctest-" "basic-api` 節を参照してください。" #: ../../library/doctest.rst:240 @@ -401,11 +510,12 @@ msgstr "" "ンスイッチ ``-v`` またはオプションのキーワード引数 *verbose* によって指定でき" "ます。" -#: ../../library/doctest.rst:244 msgid "" "There is also a command line shortcut for running :func:`testfile`, see " "section :ref:`doctest-cli`." msgstr "" +":func:`testfile` をコマンドラインから簡単に実行する方法もあります。\n" +":ref:`doctest-cli` 節を参照してください。" #: ../../library/doctest.rst:247 msgid "" @@ -416,7 +526,7 @@ msgstr "" #: ../../library/doctest.rst:253 msgid "Command-line Usage" -msgstr "" +msgstr "コマンドラインでの使用" #: ../../library/doctest.rst:255 msgid "" @@ -425,17 +535,18 @@ msgstr "" #: ../../library/doctest.rst:257 msgid "python -m doctest [-v] [-o OPTION] [-f] file [file ...]" -msgstr "" +msgstr "python -m doctest [-v] [-o OPTION] [-f] file [file ...]" -#: ../../library/doctest.rst:265 msgid "" "Detailed report of all examples tried is printed to standard output, along " "with assorted summaries at the end::" msgstr "" +"試したすべての実行例の詳細な報告を標準出力に表示し、最後に各種の結果をまとめ" +"ます。 ::" #: ../../library/doctest.rst:268 msgid "python -m doctest -v example.py" -msgstr "" +msgstr "python -m doctest -v example.py" #: ../../library/doctest.rst:270 msgid "" @@ -443,26 +554,31 @@ msgid "" "`testmod` on it. Note that this may not work correctly if the file is part " "of a package and imports other submodules from that package." msgstr "" +"こうすると :file:`example.py` を単体モジュールとしてインポートして、それに対" +"して :func:`testmod` を実行します。このファイルがパッケージの一部で他のサブモ" +"ジュールをそのパッケージからインポートしている場合はうまく動かないことに注意" +"してください。" -#: ../../library/doctest.rst:274 msgid "" "If the file name does not end with :file:`.py`, :mod:`!doctest` infers that " "it must be run with :func:`testfile` instead::" msgstr "" +"ファイル名が :file:`.py` で終わっていない場合、:mod:`!doctest` は代わりに :" +"func:`testfile` で実行すべきだと判断します。 ::" #: ../../library/doctest.rst:277 msgid "python -m doctest -v example.txt" -msgstr "" +msgstr "python -m doctest -v example.txt" -#: ../../library/doctest.rst:281 msgid "" "Option flags control various aspects of doctest's behavior, see section :ref:" "`doctest-options`." msgstr "" +"オプションフラグで doctest のさまざまな動作を制御できます。\n" +":ref:`doctest-options` 節を参照してください。" -#: ../../library/doctest.rst:288 msgid "This is shorthand for ``-o FAIL_FAST``." -msgstr "" +msgstr "``-o FAIL_FAST`` の短縮形です。" #: ../../library/doctest.rst:296 msgid "How It Works" @@ -496,7 +612,6 @@ msgstr "" "モジュールの docstring と、すべての関数、クラスおよびメソッドの docstring が" "検索されます。モジュールに import されたオブジェクトは検索されません。" -#: ../../library/doctest.rst:314 msgid "" "In addition, there are cases when you want tests to be part of a module but " "not part of the help text, which requires that the tests not be included in " @@ -508,12 +623,21 @@ msgid "" "docstrings. In output, a key ``K`` in ``M.__test__`` appears with name ``M." "__test__.K``." msgstr "" +"テストをモジュールに含めつつ、ヘルプテキストには表示したくない場合もありま" +"す。\n" +"その場合、テストを docstring に含めることはできません。\n" +"Doctest はモジュールレベルの変数 ``__test__`` を探し、それを使って他のテスト" +"を見つけます。\n" +"``M.__test__`` が存在する場合、その値は辞書でなければならず、各項目は名前 (文" +"字列) を関数オブジェクト、クラスオブジェクト、または文字列に対応付けます。\n" +"``M.__test__`` から見つかった関数やクラスの docstring が検索され、文字列は " +"docstring として扱われます。\n" +"出力では、``M.__test__`` のキー ``K`` は ``M.__test__.K`` という名前で表示さ" +"れます。" -#: ../../library/doctest.rst:323 msgid "For example, place this block of code at the top of :file:`example.py`:" -msgstr "" +msgstr "例えば、次のコードブロックを :file:`example.py` の先頭に置きます。" -#: ../../library/doctest.rst:325 msgid "" "__test__ = {\n" " 'numbers': \"\"\"\n" @@ -525,8 +649,16 @@ msgid "" "\"\"\"\n" "}" msgstr "" +"__test__ = {\n" +" 'numbers': \"\"\"\n" +">>> factorial(6)\n" +"720\n" +"\n" +">>> [factorial(n) for n in range(6)]\n" +"[1, 1, 2, 6, 24, 120]\n" +"\"\"\"\n" +"}" -#: ../../library/doctest.rst:337 msgid "" "The value of ``example.__test__[\"numbers\"]`` will be treated as a " "docstring and all the tests inside it will be run. It is important to note " @@ -534,6 +666,11 @@ msgid "" "mod:`!doctest` searches them recursively for docstrings, which are then " "scanned for tests." msgstr "" +"``example.__test__[\"numbers\"]`` の値は docstring として扱われ、その中のテス" +"トがすべて実行されます。\n" +"辞書の値には関数、クラスオブジェクト、モジュールを指定することもできます。\n" +"その場合、:mod:`!doctest` はそれらから docstring を再帰的に探し、見つかった " +"docstring からテストを検索します。" #: ../../library/doctest.rst:343 msgid "" @@ -554,10 +691,9 @@ msgid "" "shell." msgstr "" "ほとんどの場合、対話コンソールセッション上でのコピー/ペーストはうまく動作し" -"ます。とはいえ、:mod:`doctest` は特定の Python シェルの振る舞いを正確にエミュ" +"ます。とはいえ、 ``doctest`` は特定の Python シェルの振る舞いを正確にエミュ" "レーションしようとするわけではありません。" -#: ../../library/doctest.rst:357 msgid "" ">>> # comments are ignored\n" ">>> x = 12\n" @@ -575,6 +711,21 @@ msgid "" "NO!!!\n" ">>>" msgstr "" +">>> # コメントは無視されます\n" +">>> x = 12\n" +">>> x\n" +"12\n" +">>> if x == 13:\n" +"... print(\"yes\")\n" +"... else:\n" +"... print(\"no\")\n" +"... print(\"NO\")\n" +"... print(\"NO!!!\")\n" +"...\n" +"no\n" +"NO\n" +"NO!!!\n" +">>>" #: ../../library/doctest.rst:377 msgid "" @@ -645,7 +796,6 @@ msgstr "" "の理由でバックスラッシュを用いる場合、raw docstring を使ってバックスラッシュ" "を入力どおりに扱わせるようにしなければなりません::" -#: ../../library/doctest.rst:407 msgid "" ">>> def f(x):\n" "... r'''Backslashes in a raw docstring: m\\n'''\n" @@ -653,6 +803,11 @@ msgid "" ">>> print(f.__doc__)\n" "Backslashes in a raw docstring: m\\n" msgstr "" +">>> def f(x):\n" +"... r'''Backslashes in a raw docstring: m\\n'''\n" +"...\n" +">>> print(f.__doc__)\n" +"Backslashes in a raw docstring: m\\n" #: ../../library/doctest.rst:413 msgid "" @@ -666,7 +821,6 @@ msgstr "" "doctest にあるバックスラッシュを二重にする (そして raw string を使わない) と" "いう方法もあります::" -#: ../../library/doctest.rst:417 msgid "" ">>> def f(x):\n" "... '''Backslashes in a raw docstring: m\\\\n'''\n" @@ -674,18 +828,26 @@ msgid "" ">>> print(f.__doc__)\n" "Backslashes in a raw docstring: m\\n" msgstr "" +">>> def f(x):\n" +"... '''Backslashes in a raw docstring: m\\\\n'''\n" +"...\n" +">>> print(f.__doc__)\n" +"Backslashes in a raw docstring: m\\n" #: ../../library/doctest.rst:423 msgid "The starting column doesn't matter::" msgstr "開始カラムはどこでもかまいません::" -#: ../../library/doctest.rst:425 msgid "" ">>> assert \"Easy!\"\n" " >>> import math\n" " >>> math.floor(1.9)\n" " 1" msgstr "" +">>> assert \"Easy!\"\n" +" >>> import math\n" +" >>> math.floor(1.9)\n" +" 1" #: ../../library/doctest.rst:430 msgid "" @@ -709,6 +871,13 @@ msgid "" "names defined earlier in the docstring being run. Examples cannot see names " "defined in other docstrings." msgstr "" +"デフォルトでは、 :mod:`doctest` はテストを行うべき docstring を見つけるたび" +"に :mod:`!M` のグローバル名前空間の *浅いコピー* を使い、テストの実行によって" +"モジュールの実際のグローバル名前空間を変更しないようにし、かつ :mod:`!M` 内で" +"行ったテストが痕跡を残して偶発的に別のテストを誤って動作させないようにしてい" +"ます。したがって、実行例中では :mod:`!M` 内のトップレベルで定義されたすべての" +"名前と、 docstring が動作する以前に定義された名前を自由に使えます。個々の実行" +"例は他の docstring 中で定義された名前を参照できません。" #: ../../library/doctest.rst:447 msgid "" @@ -739,13 +908,16 @@ msgstr "" msgid "Simple example::" msgstr "簡単な例を示しましょう::" -#: ../../library/doctest.rst:464 msgid "" ">>> [1, 2, 3].remove(42)\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" "ValueError: list.remove(x): x not in list" msgstr "" +">>> [1, 2, 3].remove(42)\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"ValueError: list.remove(x): x not in list" #: ../../library/doctest.rst:469 msgid "" @@ -765,11 +937,12 @@ msgstr "" "なりません。トレースバックの形式は以下の二通りの行のいずれかで、実行例の最初" "の行と同じインデントでなければりません::" -#: ../../library/doctest.rst:476 msgid "" "Traceback (most recent call last):\n" "Traceback (innermost last):" msgstr "" +"Traceback (most recent call last):\n" +"Traceback (innermost last):" #: ../../library/doctest.rst:479 msgid "" @@ -792,7 +965,6 @@ msgstr "" "入った行があります。これは通常トレースバックの最後の行ですが、例外が複数行の" "詳細情報を持っている場合、複数の行にわたることもあります::" -#: ../../library/doctest.rst:488 msgid "" ">>> raise ValueError('multi\\n line\\ndetail')\n" "Traceback (most recent call last):\n" @@ -801,6 +973,12 @@ msgid "" " line\n" "detail" msgstr "" +">>> raise ValueError('multi\\n line\\ndetail')\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"ValueError: multi\n" +" line\n" +"detail" #: ../../library/doctest.rst:495 msgid "" @@ -820,7 +998,6 @@ msgstr "" "ない限り、トレースバックスタックは省略する、ということです。したがって、先ほ" "どの例は以下のように書くべきでしょう::" -#: ../../library/doctest.rst:501 msgid "" ">>> raise ValueError('multi\\n line\\ndetail')\n" "Traceback (most recent call last):\n" @@ -829,8 +1006,13 @@ msgid "" " line\n" "detail" msgstr "" +">>> raise ValueError('multi\\n line\\ndetail')\n" +"Traceback (most recent call last):\n" +" ...\n" +"ValueError: multi\n" +" line\n" +"detail" -#: ../../library/doctest.rst:508 msgid "" "Note that tracebacks are treated very specially. In particular, in the " "rewritten example, the use of ``...`` is independent of doctest's :const:" @@ -838,11 +1020,12 @@ msgid "" "just as well be three (or three hundred) commas or digits, or an indented " "transcript of a Monty Python skit." msgstr "" -"トレースバックの扱いは非常に特殊なので注意してください。特に、上の書き直した" -"実行例では、 ``...`` の扱いは doctest の :const:`ELLIPSIS` オプションとは独立" -"しています。この例での省略記号は何かの省略を表しているかもしれませんし、コン" -"マや数字が 3 個 (または 300 個) かもしれませんし、 Monty Python のスキットを" -"インデントして書き写したものかもしれません。" +"トレースバックは特別な方法で扱われる点に注意してください。\n" +"特に、上の書き直した実行例での ``...`` の使用は doctest の :const:`ELLIPSIS` " +"オプションとは無関係です。\n" +"この例の省略記号は省いてもかまいませんし、代わりにコンマや数字を 3 個 (また" +"は 300 個) 並べたり、Monty Python の寸劇をインデントして書き写したりしてもか" +"まいません。" #: ../../library/doctest.rst:514 msgid "Some details you should read once, but won't need to remember:" @@ -902,13 +1085,13 @@ msgstr "" "な :exc:`SyntaxError` をテストする必要があるというごく稀なケースでは、実行例" "にトレースバックヘッダを手作業で追加する必要があるでしょう。" -#: ../../library/doctest.rst:541 msgid "" "For some exceptions, Python displays the position of the error using ``^`` " "markers and tildes::" msgstr "" +"一部の例外では、Python は ``^`` マーカとチルダを使ってエラーの位置を示しま" +"す。 ::" -#: ../../library/doctest.rst:544 msgid "" ">>> 1 + None\n" " File \"\", line 1\n" @@ -916,6 +1099,11 @@ msgid "" " ~~^~~~~~\n" "TypeError: unsupported operand type(s) for +: 'int' and 'NoneType'" msgstr "" +">>> 1 + None\n" +" File \"\", line 1\n" +" 1 + None\n" +" ~~^~~~~~\n" +"TypeError: unsupported operand type(s) for +: 'int' and 'NoneType'" #: ../../library/doctest.rst:550 msgid "" @@ -928,7 +1116,6 @@ msgstr "" "ません。例えば、以下の例では、間違った場所に ``^`` マーカを入れても成功してし" "まいます::" -#: ../../library/doctest.rst:554 msgid "" ">>> 1 + None\n" " File \"\", line 1\n" @@ -936,6 +1123,11 @@ msgid "" " ^~~~~~~~\n" "TypeError: unsupported operand type(s) for +: 'int' and 'NoneType'" msgstr "" +">>> 1 + None\n" +" File \"\", line 1\n" +" 1 + None\n" +" ^~~~~~~~\n" +"TypeError: unsupported operand type(s) for +: 'int' and 'NoneType'" #: ../../library/doctest.rst:565 msgid "Option Flags" @@ -1030,14 +1222,15 @@ msgstr "" "ように \"しまった、マッチしすぎた! (match too much!)\" と驚くことになりかね" "ません。" -#: ../../library/doctest.rst:620 msgid "" "When specified, doctests expecting exceptions pass so long as an exception " "of the expected type is raised, even if the details (message and fully " "qualified exception name) don't match." msgstr "" +"このフラグを指定すると、例外を期待する doctest は、期待した型の例外が送出され" +"れば成功します。\n" +"詳細 (メッセージと例外の完全修飾名) が一致していなくてもかまいません。" -#: ../../library/doctest.rst:624 msgid "" "For example, an example expecting ``ValueError: 42`` will pass if the actual " "exception raised is ``ValueError: 3*14``, but will fail if, say, a :exc:" @@ -1046,8 +1239,14 @@ msgid "" "and versions of Python and the code/libraries in use. Hence, all three of " "these variations will work with the flag specified:" msgstr "" +"例えば、``ValueError: 42`` を期待する実行例は、実際に送出された例外が " +"``ValueError: 3*14`` でも成功しますが、代わりに :exc:`TypeError` などが送出さ" +"れると失敗します。\n" +"例外クラスの前に付いた完全修飾名も無視します。\n" +"この部分は Python の実装やバージョン、使用するコードやライブラリによって異な" +"ることがあります。\n" +"したがって、このフラグを指定すると、次の 3 通りはいずれも成功します。" -#: ../../library/doctest.rst:632 msgid "" ">>> raise Exception('message')\n" "Traceback (most recent call last):\n" @@ -1061,21 +1260,34 @@ msgid "" "Traceback (most recent call last):\n" "__main__.Exception: message" msgstr "" +">>> raise Exception('message')\n" +"Traceback (most recent call last):\n" +"Exception: message\n" +"\n" +">>> raise Exception('message')\n" +"Traceback (most recent call last):\n" +"builtins.Exception: message\n" +"\n" +">>> raise Exception('message')\n" +"Traceback (most recent call last):\n" +"__main__.Exception: message" -#: ../../library/doctest.rst:646 msgid "" "Note that :const:`ELLIPSIS` can also be used to ignore the details of the " "exception message, but such a test may still fail based on whether the " "module name is present or matches exactly." msgstr "" +":const:`ELLIPSIS` を使って例外メッセージの詳細を無視することもできますが、そ" +"の場合はモジュール名の有無や完全一致するかどうかによってテストが失敗する可能" +"性があります。" #: ../../library/doctest.rst:650 msgid "" ":const:`IGNORE_EXCEPTION_DETAIL` now also ignores any information relating " "to the module containing the exception under test." msgstr "" -":mod:`doctest` モジュールの :const:`IGNORE_EXCEPTION_DETAIL` フラグが、 テス" -"トされている例外を含むモジュールの名前を無視するようになりました。" +"``doctest`` モジュールの :const:`IGNORE_EXCEPTION_DETAIL` フラグが、 テストさ" +"れている例外を含むモジュールの名前を無視するようになりました。" #: ../../library/doctest.rst:657 msgid "" @@ -1193,23 +1405,22 @@ msgstr "" "トさせる際に使います。 :func:`register_optionflag` は以下のような定形文で呼び" "出さなければなりません::" -#: ../../library/doctest.rst:730 msgid "MY_FLAG = register_optionflag('MY_FLAG')" -msgstr "" +msgstr "MY_FLAG = register_optionflag('MY_FLAG')" #: ../../library/doctest.rst:740 msgid "Directives" msgstr "ディレクティブ (Directives)" -#: ../../library/doctest.rst:742 msgid "" "Doctest directives may be used to modify the :ref:`option flags ` for an individual example. Doctest directives are special Python " "comments following an example's source code:" msgstr "" -"doctest ディレクティブは個々の実行例の :ref:`オプションフラグ ` を操作するために使われます。 doctest ディレクティブは後のソースコー" -"ド例にあるような特殊な Python コメントです:" +"doctest ディレクティブを使うと、個々の実行例の :ref:`オプションフラグ " +"` を変更できます。\n" +"doctest ディレクティブは、実行例のソースコードの後ろに置く特殊な Python コメ" +"ントです:" #: ../../library/doctest.rst:753 msgid "" @@ -1233,29 +1444,31 @@ msgstr "" msgid "For example, this test passes:" msgstr "例えば、以下のテストは成功します:" -#: ../../library/doctest.rst:762 msgid "" ">>> print(list(range(20))) # doctest: +NORMALIZE_WHITESPACE\n" "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9,\n" "10, 11, 12, 13, 14, 15, 16, 17, 18, 19]" msgstr "" +">>> print(list(range(20))) # doctest: +NORMALIZE_WHITESPACE\n" +"[0, 1, 2, 3, 4, 5, 6, 7, 8, 9,\n" +"10, 11, 12, 13, 14, 15, 16, 17, 18, 19]" -#: ../../library/doctest.rst:769 msgid "" "Without the directive it would fail, both because the actual output doesn't " "have two blanks before the single-digit list elements, and because the " "actual output is on a single line. This test also passes, and also requires " "a directive to do so:" msgstr "" -"ディレクティブがない場合、実際の出力には一桁の数字の間に二つスペースが入って" -"いないこと、実際の出力は 1 行になることから、テストは成功しないはずです。別の" -"ディレクティブを使って、このテストを成功させることもできます:" +"ディレクティブがない場合、実際の出力では 1 桁のリスト要素の前に空白が 2 つ入" +"らず、出力全体が 1 行になるため、テストは失敗します。\n" +"次のテストも成功しますが、やはりディレクティブが必要です。" -#: ../../library/doctest.rst:774 msgid "" ">>> print(list(range(20))) # doctest: +ELLIPSIS\n" "[0, 1, ..., 18, 19]" msgstr "" +">>> print(list(range(20))) # doctest: +ELLIPSIS\n" +"[0, 1, ..., 18, 19]" #: ../../library/doctest.rst:780 msgid "" @@ -1264,11 +1477,12 @@ msgid "" msgstr "" "複数のディレクティブは、一つの物理行の中にコンマで区切って指定できます:" -#: ../../library/doctest.rst:783 msgid "" ">>> print(list(range(20))) # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE\n" "[0, 1, ..., 18, 19]" msgstr "" +">>> print(list(range(20))) # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE\n" +"[0, 1, ..., 18, 19]" #: ../../library/doctest.rst:789 msgid "" @@ -1278,12 +1492,14 @@ msgstr "" "一つの実行例中で複数のディレクティブコメントを使った場合、それらは組み合わさ" "れます:" -#: ../../library/doctest.rst:792 msgid "" ">>> print(list(range(20))) # doctest: +ELLIPSIS\n" "... # doctest: +NORMALIZE_WHITESPACE\n" "[0, 1, ..., 18, 19]" msgstr "" +">>> print(list(range(20))) # doctest: +ELLIPSIS\n" +"... # doctest: +NORMALIZE_WHITESPACE\n" +"[0, 1, ..., 18, 19]" #: ../../library/doctest.rst:799 msgid "" @@ -1295,12 +1511,14 @@ msgstr "" "することができます。この書きかたは、実行例が長すぎるためにディレクティブを同" "じ行に入れると収まりが悪い場合に便利です:" -#: ../../library/doctest.rst:803 msgid "" ">>> print(list(range(5)) + list(range(10, 20)) + list(range(30, 40)))\n" "... # doctest: +ELLIPSIS\n" "[0, ..., 4, 10, ..., 19, 30, ..., 39]" msgstr "" +">>> print(list(range(5)) + list(range(10, 20)) + list(range(30, 40)))\n" +"... # doctest: +ELLIPSIS\n" +"[0, ..., 4, 10, ..., 19, 30, ..., 39]" #: ../../library/doctest.rst:810 msgid "" @@ -1337,32 +1555,36 @@ msgstr "" "例えば、集合を出力する際、 Python は要素がある特定の順番で並ぶよう保証しては" "いません。したがって、以下のようなテスト ::" -#: ../../library/doctest.rst:828 msgid "" ">>> foo()\n" "{\"spam\", \"eggs\"}" msgstr "" +">>> foo()\n" +"{\"spam\", \"eggs\"}" #: ../../library/doctest.rst:831 msgid "is vulnerable! One workaround is to do ::" msgstr "は失敗するかもしれないのです! 回避するには ::" -#: ../../library/doctest.rst:833 msgid "" ">>> foo() == {\"spam\", \"eggs\"}\n" "True" msgstr "" +">>> foo() == {\"spam\", \"eggs\"}\n" +"True" #: ../../library/doctest.rst:836 msgid "instead. Another is to do ::" msgstr "とするのが一つのやり方です。別のやり方は ::" -#: ../../library/doctest.rst:838 msgid "" ">>> d = sorted(foo())\n" ">>> d\n" "['eggs', 'spam']" msgstr "" +">>> d = sorted(foo())\n" +">>> d\n" +"['eggs', 'spam']" #: ../../library/doctest.rst:842 msgid "There are others, but you get the idea." @@ -1374,7 +1596,6 @@ msgstr "" "以下のように、オブジェクトアドレスを埋め込むような結果を print するのもよくあ" "りません :" -#: ../../library/doctest.rst:846 msgid "" ">>> id(1.0) # certain to fail some of the time\n" "7948648\n" @@ -1382,6 +1603,11 @@ msgid "" ">>> C() # the default repr() for instances embeds an address\n" "" msgstr "" +">>> id(1.0) # いつか必ず失敗します\n" +"7948648\n" +">>> class C: pass\n" +">>> C() # インスタンスのデフォルトの repr() にはアドレスが含まれます\n" +"" #: ../../library/doctest.rst:854 msgid "" @@ -1389,11 +1615,12 @@ msgid "" msgstr "" ":const:`ELLIPSIS` ディレクティブを使うと、上のような例をうまく解決できます:" -#: ../../library/doctest.rst:856 msgid "" ">>> C() # doctest: +ELLIPSIS\n" "" msgstr "" +">>> C() # doctest: +ELLIPSIS\n" +"" #: ../../library/doctest.rst:862 msgid "" @@ -1424,11 +1651,12 @@ msgstr "" "``I/2.**J`` の形式になる数値はどのプラットフォームでもうまく動作するので、私" "はこの形式の数値を生成するように doctest の実行例を工夫しています::" -#: ../../library/doctest.rst:876 msgid "" ">>> 3./4 # utterly safe\n" "0.75" msgstr "" +">>> 3./4 # 完全に安全\n" +"0.75" #: ../../library/doctest.rst:879 msgid "" @@ -1442,17 +1670,16 @@ msgstr "" msgid "Basic API" msgstr "基本 API" -#: ../../library/doctest.rst:888 msgid "" "The functions :func:`testmod` and :func:`testfile` provide a simple " "interface to doctest that should be sufficient for most basic uses. For a " "less formal introduction to these two functions, see sections :ref:`doctest-" "simple-testmod` and :ref:`doctest-simple-testfile`." msgstr "" -"数 :func:`testmod` と :func:`testfile` は、ほとんどの基本的な用途に十分な " -"doctest インターフェースを提供しています。これら二つの関数についてあまり形式" -"的でない入門が読みたければ、 :ref:`doctest-simple-testmod` 節や :ref:" -"`doctest-simple-testfile` 節を参照してください。" +"関数 :func:`testmod` と :func:`testfile` は、基本的な用途の大半に十分な、" +"doctest の簡単なインターフェースを提供します。\n" +"この 2 つの関数の平易な入門については、:ref:`doctest-simple-testmod` 節と :" +"ref:`doctest-simple-testfile` 節を参照してください。" #: ../../library/doctest.rst:896 msgid "" @@ -1488,8 +1715,8 @@ msgid "" "absolute path (i.e., it may not begin with ``/``)." msgstr "" "*module_relative* が ``True`` (デフォルト) の場合、*filename* は OS に依存し" -"ないモジュールの相対パスになります。デフォルトでは、このパスは関数 :func:" -"`testfile` を呼び出しているモジュールからの相対パスになります; ただし、" +"ないモジュールの相対パスになります。デフォルトでは、このパスは関数 " +"``testfile()`` を呼び出しているモジュールからの相対パスになります; ただし、" "*package* 引数を指定した場合には、パッケージからの相対になります。OS への依存" "性を除くため、*filename* ではパスを分割する文字に ``/`` を使わなければなら" "ず、絶対パスにしてはなりません (パス文字列を ``/`` で始めてはなりません)。" @@ -1638,13 +1865,17 @@ msgstr "" "から到達可能な関数およびクラスの docstring 内にある実行例をテストします。 " "``m.__doc__`` 内の実行例からテストを開始します。" -#: ../../library/doctest.rst:973 msgid "" "Also test examples reachable from dict ``m.__test__``, if it exists. ``m." "__test__`` maps names (strings) to functions, classes and strings; function " "and class docstrings are searched for examples; strings are searched " "directly, as if they were docstrings." msgstr "" +"辞書 ``m.__test__`` が存在する場合、そこから到達可能な実行例もテストしま" +"す。\n" +"``m.__test__`` は名前 (文字列) を関数、クラス、文字列に対応付けます。\n" +"関数やクラスでは docstring から実行例を検索し、文字列は docstring とみなして" +"直接検索します。" #: ../../library/doctest.rst:978 msgid "" @@ -1674,6 +1905,13 @@ msgid "" "*exclude_empty* argument to the newer :class:`DocTestFinder` constructor " "defaults to true." msgstr "" +"オプション引数 *exclude_empty* はデフォルトでは偽になっています。この値を真に" +"すると、doctest を持たないオブジェクトを考慮から外します。デフォルトの設定は" +"依存のバージョンとの互換性を考えたハックであり、:meth:`doctest.master." +"summarize ` と :func:`testmod` を合わせて利用してい" +"るようなコードでも、テスト実行例を持たないオブジェクトから出力を得るようにし" +"ています。新たに追加された :class:`DocTestFinder` のコンストラクタの " +"*exclude_empty* はデフォルトで真になります。" #: ../../library/doctest.rst:993 msgid "" @@ -1748,8 +1986,13 @@ msgid "" "discovery, include a :ref:`load_tests ` function in " "your test module::" msgstr "" +"doctest が付けられたモジュールが大きくなるにつれ、全ての doctest を組織的に実" +"行したくなるでしょう。 :mod:`doctest` モジュールは 2 つの関数を提供してい" +"て、 :mod:`unittest` のテストスイートを作り、 doctest を含んだテキストファイ" +"ルを作成するのに使えます。 :mod:`unittest` のテストディスカバリと組み合わせる" +"には、テストモジュールに :ref:`load_tests ` 関数を書いて" +"おいてください::" -#: ../../library/doctest.rst:1029 msgid "" "import unittest\n" "import doctest\n" @@ -1759,6 +2002,13 @@ msgid "" " tests.addTests(doctest.DocTestSuite(my_module_with_doctests))\n" " return tests" msgstr "" +"import unittest\n" +"import doctest\n" +"import my_module_with_doctests\n" +"\n" +"def load_tests(loader, tests, ignore):\n" +" tests.addTests(doctest.DocTestSuite(my_module_with_doctests))\n" +" return tests" #: ../../library/doctest.rst:1037 msgid "" @@ -1795,7 +2045,7 @@ msgstr "" #: ../../library/doctest.rst:1055 msgid "Options may be provided as keyword arguments:" -msgstr ":func:`DocFileSuite` には、キーワード引数でオプションを指定できます:" +msgstr "``DocFileSuite()`` には、キーワード引数でオプションを指定できます:" #: ../../library/doctest.rst:1057 msgid "" @@ -1822,15 +2072,15 @@ msgstr "" "め、各ファイル名はパスを分割するのに ``/`` 文字を使わなければならず、絶対パス" "にしてはなりません (パス文字列を ``/`` で始めてはなりません)。" -#: ../../library/doctest.rst:1068 msgid "" "If *module_relative* is ``False``, then each filename in *paths* specifies " "an OS-specific path. The path may be absolute or relative; relative paths " "are resolved with respect to the current working directory." msgstr "" -"*module_relative* が ``False`` の場合、*filename* は OS 依存のパスを示しま" -"す。パスは絶対パスでも相対パスでもかまいません; 相対パスにした場合、現在の作" -"業ディレクトリを基準に解決します。" +"*module_relative* が ``False`` の場合、*paths* 内の各ファイル名は OS 依存のパ" +"スを示します。\n" +"パスは絶対パスでも相対パスでもかまいません; 相対パスにした場合、現在の作業" +"ディレクトリを基準に解決します。" #: ../../library/doctest.rst:1072 msgid "" @@ -1972,7 +2222,6 @@ msgid "" "approximate) line number." msgstr "" -#: ../../library/doctest.rst:1149 msgid "" "Under the covers, :func:`DocTestSuite` creates a :class:`unittest.TestSuite` " "out of :class:`!doctest.DocTestCase` instances, and :class:`!DocTestCase` is " @@ -1980,13 +2229,20 @@ msgid "" "documented here (it's an internal detail), but studying its code can answer " "questions about the exact details of :mod:`unittest` integration." msgstr "" +"内部では、:func:`DocTestSuite` は :class:`!doctest.DocTestCase` インスタンス" +"から :class:`unittest.TestSuite` を作成します。\n" +":class:`!DocTestCase` は :class:`unittest.TestCase` のサブクラスです。\n" +":class:`!DocTestCase` は実装の詳細にあたるため、ここでは説明しませんが、その" +"コードを読むと :mod:`unittest` との統合の詳しい仕組みが分かります。" -#: ../../library/doctest.rst:1155 msgid "" "Similarly, :func:`DocFileSuite` creates a :class:`unittest.TestSuite` out " "of :class:`!doctest.DocFileCase` instances, and :class:`!DocFileCase` is a " "subclass of :class:`!DocTestCase`." msgstr "" +"同様に、:func:`DocFileSuite` は :class:`!doctest.DocFileCase` インスタンスか" +"ら :class:`unittest.TestSuite` を作成します。\n" +":class:`!DocFileCase` は :class:`!DocTestCase` のサブクラスです。" #: ../../library/doctest.rst:1159 msgid "" @@ -2132,7 +2388,6 @@ msgid "" "following diagram::" msgstr "これらの処理クラスの関係を図にまとめると、以下のようになります::" -#: ../../library/doctest.rst:1233 msgid "" " list of:\n" "+------+ +---------+\n" @@ -2143,6 +2398,14 @@ msgid "" " DocTestParser | Example | OutputChecker\n" " +---------+" msgstr "" +" list of:\n" +"+------+ +---------+\n" +"|module| --DocTestFinder-> | DocTest | --DocTestRunner-> results\n" +"+------+ | ^ +---------+ | ^ (printed)\n" +" | | | Example | | |\n" +" v | | ... | v |\n" +" DocTestParser | Example | OutputChecker\n" +" +---------+" #: ../../library/doctest.rst:1246 msgid "DocTest Objects" @@ -2155,7 +2418,7 @@ msgid "" "names." msgstr "" "単一の名前空間内で実行される doctest 実行例の集まりです。コンストラクタの引数" -"は :class:`DocTest` インスタンス中の同名の属性の初期化に使われます。" +"は ``DocTest`` インスタンス中の同名の属性の初期化に使われます。" #: ../../library/doctest.rst:1255 msgid "" @@ -2233,8 +2496,8 @@ msgid "" "attributes of the same names." msgstr "" "ひとつの Python 文と、それに対する期待する出力からなる、単一の対話的モードの" -"実行例です。コンストラクタの引数は :class:`Example` インスタンス中の同名の属" -"性の初期化に使われます。" +"実行例です。コンストラクタの引数は ``Example`` インスタンス中の同名の属性の初" +"期化に使われます。" #: ../../library/doctest.rst:1312 msgid "" @@ -2244,14 +2507,14 @@ msgstr "" ":class:`Example` では、以下の属性を定義しています。これらの変数はコンストラク" "タで初期化されます。直接変更してはなりません。" -#: ../../library/doctest.rst:1318 msgid "" "A string containing the example's source code. This source code consists of " "a single Python statement, and always ends with a newline; the constructor " "adds a newline when necessary." msgstr "" -"実行例のソースコードが入った文字列です。ソースコードは単一の Python で、末尾" -"は常に改行です。コンストラクタは必要に応じて改行を追加します。" +"実行例のソースコードを含む文字列です。\n" +"ソースコードは単一の Python 文で、末尾は常に改行です。\n" +"コンストラクタは必要に応じて改行を追加します。" #: ../../library/doctest.rst:1325 msgid "" @@ -2296,7 +2559,6 @@ msgstr "" "実行例の入っている文字列のインデント、すなわち実行例の最初のプロンプトより前" "にある空白文字の数です。" -#: ../../library/doctest.rst:1355 msgid "" "A dictionary mapping from option flags to ``True`` or ``False``, which is " "used to override default options for this example. Any option flags not " @@ -2304,6 +2566,11 @@ msgid "" "by the :class:`DocTestRunner`'s :ref:`optionflags `). By " "default, no options are set." msgstr "" +"オプションフラグを ``True`` または ``False`` に対応付ける辞書で、この実行例の" +"デフォルトのオプションを上書きするために使われます。\n" +"この辞書に含まれないオプションフラグは、:class:`DocTestRunner` の :ref:" +"`optionflags ` で指定されたデフォルト値のままになります。\n" +"デフォルトではオプションは設定されていません。" #: ../../library/doctest.rst:1365 msgid "DocTestFinder objects" @@ -2334,9 +2601,9 @@ msgid "" "The optional argument *parser* specifies the :class:`DocTestParser` object " "(or a drop-in replacement) that is used to extract doctests from docstrings." msgstr "" -"オプション引数 *parser* には、 docstring から :class:`DocTest` を抽出するのに" -"使う :class:`DocTestParser` オブジェクト (またはその代替となるオブジェクト) " -"を指定します。" +"オプション引数 *parser* には、 docstring から ``DocTest`` を抽出するのに使" +"う :class:`DocTestParser` オブジェクト (またはその代替となるオブジェクト) を" +"指定します。" #: ../../library/doctest.rst:1381 msgid "" @@ -2367,15 +2634,14 @@ msgstr "" "*obj* または *obj* 内に入っているオブジェクトの docstring 中で定義されてい" "る :class:`DocTest` のリストを返します。" -#: ../../library/doctest.rst:1396 msgid "" "The optional argument *name* specifies the object's name; this name will be " "used to construct names for the returned :class:`DocTest`\\ s. If *name* is " "not specified, then ``obj.__name__`` is used." msgstr "" -"オプション引数 *name* には、オブジェクトの名前を指定します。この名前は、関数" -"が返す :class:`DocTest` の名前になります。 *name* を指定しない場合、 ``obj." -"__name__`` を使います。" +"オプション引数 *name* には、オブジェクトの名前を指定します。\n" +"この名前は、返される :class:`DocTest` の名前を組み立てるために使われます。\n" +"*name* を指定しない場合、 ``obj.__name__`` を使います。" #: ../../library/doctest.rst:1400 msgid "" @@ -2402,9 +2668,9 @@ msgid "" "imported from other modules. (Contained objects with modules other than " "*module* are ignored.)" msgstr "" -"他のモジュールから import されたオブジェクトに対して :class:`DocTestFinder` " -"が :class:`DocTest` を抽出するのを避けるために使います。 (*module* 由来でない" -"オブジェクトを無視します。)" +"他のモジュールから import されたオブジェクトに対して ``DocTestFinder`` が " +"``DocTest`` を抽出するのを避けるために使います。 (*module* 由来でないオブジェ" +"クトを無視します。)" #: ../../library/doctest.rst:1410 msgid "To find the name of the file containing the object." @@ -2414,7 +2680,6 @@ msgstr "オブジェクトの入っているファイル名を調べるために msgid "To help find the line number of the object within its file." msgstr "オブジェクトがファイル内の何行目にあるかを調べる手助けにします。" -#: ../../library/doctest.rst:1414 msgid "" "If *module* is ``False``, no attempt to find the module will be made. This " "is obscure, of use mostly in testing doctest itself: if *module* is " @@ -2422,12 +2687,12 @@ msgid "" "objects are considered to belong to the (non-existent) module, so all " "contained objects will (recursively) be searched for doctests." msgstr "" -"*module* が ``False`` の場合には、モジュールの検索を試みません。これは正確さ" -"を欠くような使い方で、通常 doctest 自体のテストにしか使いません。*module* が " -"``False`` の場合、または *module* が ``None`` で自動的に的確なモジュールを見" -"つけ出せない場合には、すべてのオブジェクトは ``(non-existent)`` モジュールに" -"属するとみなされ、そのオブジェクト内のすべてのオブジェクトに対して (再帰的" -"に) doctest の検索を行います。" +"*module* が ``False`` の場合、モジュールを検索しません。\n" +"これは主に doctest 自体のテストで使う特殊な機能です。\n" +"*module* が ``False`` の場合、または ``None`` でモジュールを自動的に見つけら" +"れなかった場合、すべてのオブジェクトがその (実在しない) モジュールに属すると" +"みなします。\n" +"そのため、内部のすべてのオブジェクトから doctest を再帰的に検索します。" #: ../../library/doctest.rst:1420 msgid "" @@ -2488,9 +2753,9 @@ msgid "" "error messages." msgstr "" "指定した文字列からすべての doctest 実行例を抽出し、 :class:`Example` オブジェ" -"クトからなるリストにして返します。各 :class:`Example` の行番号は 0 から数えま" -"す。オプション引数 *name* はこの文字列につける名前で、エラーメッセージにしか" -"使われません。" +"クトからなるリストにして返します。各 ``Example`` の行番号は 0 から数えます。" +"オプション引数 *name* はこの文字列につける名前で、エラーメッセージにしか使わ" +"れません。" #: ../../library/doctest.rst:1462 msgid "" @@ -2504,21 +2769,17 @@ msgstr "" "て返します。各 :class:`Example` の行番号は 0から数えます。オプション引数 " "*name* はこの文字列につける名前で、エラーメッセージにしか使われません。" -#: ../../library/doctest.rst:1469 msgid "TestResults objects" -msgstr "" +msgstr "TestResults オブジェクト" -#: ../../library/doctest.rst:1476 msgid "Number of failed tests." -msgstr "" +msgstr "失敗したテストの数。" -#: ../../library/doctest.rst:1480 msgid "Number of attempted tests." -msgstr "" +msgstr "実行を試みたテストの数。" -#: ../../library/doctest.rst:1484 msgid "Number of skipped tests." -msgstr "" +msgstr "スキップしたテストの数。" #: ../../library/doctest.rst:1492 msgid "DocTestRunner objects" @@ -2593,17 +2854,20 @@ msgstr "" "出力と実際の出力を比較する方法や、テストの失敗を表示する方法を制御できます。" "詳しくは :ref:`doctest-options` 節を参照してください。" -#: ../../library/doctest.rst:1528 msgid "" "The test runner accumulates statistics. The aggregated number of attempted, " "failed and skipped examples is also available via the :attr:`tries`, :attr:" "`failures` and :attr:`skips` attributes. The :meth:`run` and :meth:" "`summarize` methods return a :class:`TestResults` instance." msgstr "" +"テストランナーは統計情報を蓄積します。\n" +"実行を試みた実行例、失敗した実行例、スキップした実行例の累計は、それぞれ :" +"attr:`tries`、:attr:`failures`、:attr:`skips` 属性でも参照できます。\n" +":meth:`run` と :meth:`summarize` メソッドは :class:`TestResults` インスタンス" +"を返します。" -#: ../../library/doctest.rst:1533 msgid ":class:`DocTestRunner` defines the following methods:" -msgstr "" +msgstr ":class:`DocTestRunner` は以下のメソッドを定義しています。" #: ../../library/doctest.rst:1538 msgid "" @@ -2676,12 +2940,14 @@ msgstr "" "*example* の入っているテストです。 *out* は出力用の関数で、 :meth:" "`DocTestRunner.run` に渡されます。" -#: ../../library/doctest.rst:1583 msgid "" "Run the examples in *test* (a :class:`DocTest` object), and display the " "results using the writer function *out*. Return a :class:`TestResults` " "instance." msgstr "" +"*test* (:class:`DocTest` オブジェクト) 内の実行例を実行し、書き込み用の関数 " +"*out* で結果を表示します。\n" +":class:`TestResults` インスタンスを返します。" #: ../../library/doctest.rst:1587 msgid "" @@ -2705,18 +2971,20 @@ msgstr "" "セットを指定します。*compileflags* を指定しない場合、デフォルト値は *globs* " "で適用されている future-import フラグセットになります。" -#: ../../library/doctest.rst:1596 msgid "" "The output of each example is checked using the :class:`DocTestRunner`'s " "output checker, and the results are formatted by the :meth:`!DocTestRunner." "report_\\*` methods." msgstr "" +"各実行例の出力は :class:`DocTestRunner` の出力チェッカーで検証され、結果は :" +"meth:`!DocTestRunner.report_\\*` メソッドで書式化されます。" -#: ../../library/doctest.rst:1603 msgid "" "Print a summary of all the test cases that have been run by this " "DocTestRunner, and return a :class:`TestResults` instance." msgstr "" +"この ``DocTestRunner`` が実行したすべてのテストケースの結果をまとめて表示" +"し、:class:`TestResults` インスタンスを返します。" #: ../../library/doctest.rst:1606 msgid "" @@ -2732,17 +3000,14 @@ msgstr "" msgid ":class:`DocTestParser` has the following attributes:" msgstr "" -#: ../../library/doctest.rst:1614 msgid "Number of attempted examples." -msgstr "" +msgstr "実行を試みた実行例の数。" -#: ../../library/doctest.rst:1618 msgid "Number of failed examples." -msgstr "" +msgstr "失敗した実行例の数。" -#: ../../library/doctest.rst:1622 msgid "Number of skipped examples." -msgstr "" +msgstr "スキップした実行例の数。" #: ../../library/doctest.rst:1630 msgid "OutputChecker objects" @@ -2797,8 +3062,8 @@ msgstr "デバッグ" #: ../../library/doctest.rst:1665 msgid "Doctest provides several mechanisms for debugging doctest examples:" msgstr "" -":mod:`doctest` では、doctest 実行例をデバッグするメカニズムをいくつか提供して" -"います:" +"``doctest`` では、doctest 実行例をデバッグするメカニズムをいくつか提供してい" +"ます:" #: ../../library/doctest.rst:1667 msgid "" @@ -2825,7 +3090,7 @@ msgid "" "meth:`debug` method defined by :class:`unittest.TestCase`." msgstr "" ":func:`DocTestSuite` の生成する :mod:`unittest` テストケースは、 :meth:" -"`debug` メソッドをサポートしています。 :meth:`debug` は :class:`unittest." +"`debug` メソッドをサポートしています。 ``debug()`` は :class:`unittest." "TestCase` で定義されています。" #: ../../library/doctest.rst:1678 @@ -2840,7 +3105,6 @@ msgstr "" "の現在の値などを調べられます。たとえば、以下のようなモジュールレベルの " "docstring の入ったファイル :file:`a.py` があるとします::" -#: ../../library/doctest.rst:1683 msgid "" "\"\"\"\n" ">>> def f(x):\n" @@ -2852,12 +3116,20 @@ msgid "" "9\n" "\"\"\"" msgstr "" +"\"\"\"\n" +">>> def f(x):\n" +"... g(x*2)\n" +">>> def g(x):\n" +"... print(x+3)\n" +"... import pdb; pdb.set_trace()\n" +">>> f(3)\n" +"9\n" +"\"\"\"" #: ../../library/doctest.rst:1693 msgid "Then an interactive Python session may look like this::" msgstr "対話セッションは以下のようになるでしょう::" -#: ../../library/doctest.rst:1695 msgid "" ">>> import a, doctest\n" ">>> doctest.testmod(a)\n" @@ -2889,6 +3161,35 @@ msgid "" "(0, 3)\n" ">>>" msgstr "" +">>> import a, doctest\n" +">>> doctest.testmod(a)\n" +"--Return--\n" +"> (3)g()->None\n" +"-> import pdb; pdb.set_trace()\n" +"(Pdb) list\n" +" 1 def g(x):\n" +" 2 print(x+3)\n" +" 3 -> import pdb; pdb.set_trace()\n" +"[EOF]\n" +"(Pdb) p x\n" +"6\n" +"(Pdb) step\n" +"--Return--\n" +"> (2)f()->None\n" +"-> g(x*2)\n" +"(Pdb) list\n" +" 1 def f(x):\n" +" 2 -> g(x*2)\n" +"[EOF]\n" +"(Pdb) p x\n" +"3\n" +"(Pdb) step\n" +"--Return--\n" +"> (1)?()->None\n" +"-> f(3)\n" +"(Pdb) cont\n" +"(0, 3)\n" +">>>" #: ../../library/doctest.rst:1726 msgid "" @@ -2914,7 +3215,6 @@ msgstr "" "Python のコメント文になります。生成したスクリプトを文字列で返します。例え" "ば、 ::" -#: ../../library/doctest.rst:1739 msgid "" "import doctest\n" "print(doctest.script_from_examples(r\"\"\"\n" @@ -2926,12 +3226,20 @@ msgid "" " 3\n" "\"\"\"))" msgstr "" +"import doctest\n" +"print(doctest.script_from_examples(r\"\"\"\n" +" Set x and y to 1 and 2.\n" +" >>> x, y = 1, 2\n" +"\n" +" Print their sum:\n" +" >>> print(x+y)\n" +" 3\n" +"\"\"\"))" #: ../../library/doctest.rst:1749 msgid "displays::" msgstr "は::" -#: ../../library/doctest.rst:1751 msgid "" "# Set x and y to 1 and 2.\n" "x, y = 1, 2\n" @@ -2941,6 +3249,13 @@ msgid "" "# Expected:\n" "## 3" msgstr "" +"# Set x and y to 1 and 2.\n" +"x, y = 1, 2\n" +"#\n" +"# Print their sum:\n" +"print(x+y)\n" +"# Expected:\n" +"## 3" #: ../../library/doctest.rst:1759 msgid "" @@ -2955,7 +3270,6 @@ msgstr "" msgid "Convert the doctest for an object to a script." msgstr "あるオブジェクトの doctest をスクリプトに変換します。" -#: ../../library/doctest.rst:1768 msgid "" "Argument *module* is a module object, or dotted name of a module, containing " "the object whose doctests are of interest. Argument *name* is the name " @@ -2964,18 +3278,28 @@ msgid "" "as described for :func:`script_from_examples` above. For example, if " "module :file:`a.py` contains a top-level function :func:`!f`, then ::" msgstr "" +"引数 *module* は、対象の doctest を持つオブジェクトを含むモジュールのオブジェ" +"クト、またはドット区切りのモジュール名です。\n" +"引数 *name* は、対象の doctest を持つオブジェクトのモジュール内での名前で" +"す。\n" +"戻り値は、上記の :func:`script_from_examples` と同じ方法で、オブジェクトの " +"docstring を Python スクリプトに変換した文字列です。\n" +"例えば、モジュール :file:`a.py` のトップレベルに関数 :func:`!f` がある場合、" +"次のコードは ::" -#: ../../library/doctest.rst:1775 msgid "" "import a, doctest\n" "print(doctest.testsource(a, \"a.f\"))" msgstr "" +"import a, doctest\n" +"print(doctest.testsource(a, \"a.f\"))" -#: ../../library/doctest.rst:1778 msgid "" "prints a script version of function :func:`!f`'s docstring, with doctests " "converted to code, and the rest placed in comments." msgstr "" +"関数 :func:`!f` の docstring をスクリプトに変換して表示します。\n" +"doctest はコードに変換され、残りはコメントになります。" #: ../../library/doctest.rst:1784 msgid "Debug the doctests for an object." @@ -3057,8 +3381,8 @@ msgid "" msgstr "" ":class:`DebugRunner` クラス自体や :class:`DebugRunner` クラスが送出する特殊な" "例外は、テストフレームワークの作者にとって非常に興味のあるところですが、ここ" -"では概要しか述べられません。詳しくはソースコード、とりわけ :class:" -"`DebugRunner` の docstring (それ自体 doctest です!) を参照してください:" +"では概要しか述べられません。詳しくはソースコード、とりわけ ``DebugRunner`` " +"の docstring (それ自体 doctest です!) を参照してください:" #: ../../library/doctest.rst:1825 msgid "" @@ -3193,7 +3517,6 @@ msgstr "" "という形で、きっと見返りを得るでしょう。私は今でも、自分の :mod:`doctest` 実" "行例が \"無害な\" 変更を行った際にうまく動作しなくなることに驚いています。" -#: ../../library/doctest.rst:1913 msgid "" "Doctest also makes an excellent tool for regression testing, especially if " "you don't skimp on explanatory text. By interleaving prose and examples, it " @@ -3213,21 +3536,27 @@ msgid "" "functionality seemingly at random. It's a different attitude, and produces " "different results, blurring the distinction between testing and explaining." msgstr "" -"説明テキストの作成をけちらなければ、:mod:`doctest` は回帰テストの優れたツール" -"にもなり得ます。説明文と実行例を交互に記述していけば、実際に何をどうしてテス" -"トしているのかもっと簡単に把握できるようになるでしょう。もちろん、コードベー" -"スのテストに詳しくコメントを入れるのも手ですが、そんなことをするプログラマは" -"ほとんどいません。多くの人々が、:mod:`doctest` のアプローチをとった方がきれい" -"にテストを書けると気づいています。おそらく、これは単にコード中にコメントを書" -"くのが少し面倒だからという理由でしょう。私はもう少し穿った見方もしています。" -"doctest ベースのテストを書くときの自然な態度は、自分のソフトウェアのよい点を" -"説明しようとして、実行例を使って説明しようとするときの態度そのものだからだ、" -"という理由です。それゆえに、テストファイルは自然と単純な機能の解説から始め、" -"論理的により複雑で境界条件的なケースに進むような形になります。結果的に、一見" -"ランダムに見えるような個別の機能をテストしている個別の関数の集まりではなく、" -"首尾一貫した説明ができるようになるのです。:mod:`doctest` によるテストの作成は" -"まったく別の取り組み方であり、テストと説明の区別をなくして、まったく違う結果" -"を生み出すのです。" +"Doctest は回帰テストの優れたツールにもなります。\n" +"説明文を惜しまず書けば、特に役立ちます。\n" +"説明文と実行例を交互に記述すると、実際に何を、なぜテストしているのかを把握し" +"やすくなります。\n" +"テストが失敗したときにも、よい説明文があれば問題と修正方法が分かりやすくなり" +"ます。\n" +"確かに、コードで書くテストにも詳しいコメントを付けられますが、そうするプログ" +"ラマーは少数です。\n" +"代わりに doctest を使うと、はるかに分かりやすいテストになると感じる人は多くい" +"ます。\n" +"単に、doctest ではコードよりも説明文が少し書きやすく、コード中ではコメントが" +"少し書きにくいからかもしれません。\n" +"私はそれよりも深い理由があると考えています。\n" +"doctest ベースのテストを書くときは、ソフトウェアの細かな点を説明し、実行例で" +"示そうという姿勢に自然となります。\n" +"すると、最も単純な機能から始まり、複雑な場合や境界条件へと論理的に進むテスト" +"ファイルになります。\n" +"結果として、個々の機能の断片をばらばらにテストする関数の集まりではなく、筋の" +"通った説明ができます。\n" +"取り組む姿勢が違うため、テストと説明の区別が薄れるという違った結果を生むので" +"す。" #: ../../library/doctest.rst:1931 msgid "" @@ -3269,20 +3598,18 @@ msgstr "" "回帰テストのトピックをテストケースの入った docstring に対応付けた辞書 " "``__test__`` 辞書を定義します。" -#: ../../library/doctest.rst:1946 msgid "" "When you have placed your tests in a module, the module can itself be the " "test runner. When a test fails, you can arrange for your test runner to re-" "run only the failing doctest while you debug the problem. Here is a minimal " "example of such a test runner::" msgstr "" -"テストコードをモジュールに組み込むことで、そのモジュールは、モジュール自身が" -"テストランナーになることができます。テストが失敗した場合には、問題箇所をデ" -"バッグする際に、失敗したdoctestだけを再度実行することで、作成したテストラン" -"ナーを修正することができます。これがこのようなテストランナーの最小例となりま" -"す。" +"テストをモジュール内に置くと、そのモジュール自体をテストランナーにできま" +"す。\n" +"テストが失敗したときは、問題をデバッグする間、失敗した doctest だけを再実行す" +"るようにテストランナーを設定できます。\n" +"次に、そのようなテストランナーの最小限の例を示します。 ::" -#: ../../library/doctest.rst:1951 msgid "" "if __name__ == '__main__':\n" " import doctest\n" @@ -3299,6 +3626,20 @@ msgid "" " fail, total = doctest.testmod(optionflags=flags)\n" " print(f\"{fail} failures out of {total} tests\")" msgstr "" +"if __name__ == '__main__':\n" +" import doctest\n" +" flags = doctest.REPORT_NDIFF|doctest.FAIL_FAST\n" +" if len(sys.argv) > 1:\n" +" name = sys.argv[1]\n" +" if name in globals():\n" +" obj = globals()[name]\n" +" else:\n" +" obj = __test__[name]\n" +" doctest.run_docstring_examples(obj, globals(), name=name,\n" +" optionflags=flags)\n" +" else:\n" +" fail, total = doctest.testmod(optionflags=flags)\n" +" print(f\"{fail} failures out of {total} tests\")" #: ../../library/doctest.rst:1968 msgid "Footnotes" @@ -3318,9 +3659,8 @@ msgstr "" msgid ">>>" msgstr ">>>" -#: ../../library/doctest.rst:373 msgid "interpreter prompt" -msgstr "" +msgstr "インタープリタのプロンプト" #: ../../library/doctest.rst:373 ../../library/doctest.rst:608 msgid "..." @@ -3330,17 +3670,14 @@ msgstr "..." msgid "^ (caret)" msgstr "^ (キャレット)" -#: ../../library/doctest.rst:539 msgid "marker" -msgstr "" +msgstr "マーカー" -#: ../../library/doctest.rst:588 msgid "" -msgstr "" +msgstr "" -#: ../../library/doctest.rst:608 ../../library/doctest.rst:733 msgid "in doctests" -msgstr "" +msgstr "doctest 内" #: ../../library/doctest.rst:733 msgid "# (hash)" diff --git a/library/email.charset.po b/library/email.charset.po index 76d45453e..c51f3c802 100644 --- a/library/email.charset.po +++ b/library/email.charset.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/email.charset.rst:2 @@ -175,15 +175,13 @@ msgstr "" "*input_charset* を Unicode に変換するための Python 用コーデック名です。変換用" "のコーデックが必要ないときは、この値は ``None`` になります。" -#: ../../library/email.charset.rst:91 msgid "" "The name of the Python codec used to convert Unicode to the " "*output_charset*. If no conversion codec is necessary, this attribute will " "have the same value as the *input_codec*." msgstr "" -"Unicode を *output_charset* に変換するための Python 用コーデック名です。変換" -"用のコーデックが必要ないときは、この値は ``None`` になります。この属性は " -"*input_codec* と同じ値を持つことになるでしょう。" +"Unicode を *output_charset* に変換するための Python コーデック名です。\n" +"変換用のコーデックが不要な場合、この属性は *input_codec* と同じ値になります。" #: ../../library/email.charset.rst:96 msgid ":class:`Charset` instances also have the following methods:" @@ -195,7 +193,6 @@ msgstr "" "メッセージ本体のエンコードに使われる content-transfer-encoding の値を返しま" "す。" -#: ../../library/email.charset.rst:102 msgid "" "This is either the string ``quoted-printable`` or ``base64`` depending on " "the encoding used, or it is a function, in which case you should call the " @@ -203,11 +200,12 @@ msgid "" "function should then set the :mailheader:`Content-Transfer-Encoding` header " "itself to whatever is appropriate." msgstr "" -"この値は使用しているエンコーディングの文字列 ``quoted-printable`` または " -"``base64`` か、あるいは関数のいずれかです。後者の場合、これはエンコードされ" -"る Message オブジェクトを単一の引数として取るような関数である必要があります。" -"この関数は変換後 :mailheader:`Content-Transfer-Encoding` ヘッダ自体を、なんで" -"あれ適切な値に設定する必要があります。" +"使用するエンコーディングに応じて、文字列 ``quoted-printable`` または " +"``base64``、あるいは関数を返します。\n" +"関数の場合は、エンコードする Message オブジェクトを唯一の引数としてその関数を" +"呼び出してください。\n" +"その関数が :mailheader:`Content-Transfer-Encoding` ヘッダーを適切な値に設定し" +"ます。" #: ../../library/email.charset.rst:108 msgid "" diff --git a/library/email.compat32-message.po b/library/email.compat32-message.po index e7e4d7ba1..3a6fde30c 100644 --- a/library/email.compat32-message.po +++ b/library/email.compat32-message.po @@ -17,10 +17,10 @@ msgstr "" "Last-Translator: tomo, 2021\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/email.compat32-message.rst:4 @@ -31,7 +31,6 @@ msgstr "" ":mod:`email.message.Message`: :data:`~email.policy.compat32` API を使用した電" "子メールメッセージの表現" -#: ../../library/email.compat32-message.rst:13 msgid "" "The :class:`Message` class is very similar to the :class:`~email.message." "EmailMessage` class, without the methods added by that class, and with the " @@ -40,20 +39,26 @@ msgid "" "message.EmailMessage` class, are not recommended unless you are dealing with " "legacy code." msgstr "" +":class:`Message` クラスは :class:`~email.message.EmailMessage` クラスによく似" +"ていますが、後者で追加されたメソッドはなく、一部の他のメソッドでもデフォルト" +"の動作が少し異なります。\n" +"ここでは、:class:`~email.message.EmailMessage` クラスでもサポートされているも" +"のの、従来のコードを扱う場合以外には推奨されないメソッドも説明します。" -#: ../../library/email.compat32-message.rst:20 msgid "The philosophy and structure of the two classes is otherwise the same." -msgstr "" +msgstr "それ以外の点では、両クラスの設計思想と構造は同じです。" -#: ../../library/email.compat32-message.rst:22 msgid "" "This document describes the behavior under the default (for :class:" "`Message`) policy :attr:`~email.policy.Compat32`. If you are going to use " "another policy, you should be using the :class:`~email.message.EmailMessage` " "class instead." msgstr "" +"このドキュメントは、:class:`Message` のデフォルトのポリシーである :attr:" +"`~email.policy.Compat32` での動作を説明します。\n" +"別のポリシーを使う場合は、代わりに :class:`~email.message.EmailMessage` クラ" +"スを使ってください。" -#: ../../library/email.compat32-message.rst:26 msgid "" "An email message consists of *headers* and a *payload*. Headers must be :" "rfc:`5322` style names and values, where the field name and value are " @@ -64,8 +69,16 @@ msgid "" "message having a MIME type such as :mimetype:`multipart/\\*` or :mimetype:" "`message/rfc822`." msgstr "" +"電子メールメッセージは *ヘッダー* と *ペイロード* からなります。\n" +"ヘッダーの名前と値は :rfc:`5322` の形式に従い、フィールド名と値をコロンで区切" +"る必要があります。\n" +"コロンはフィールド名にも値にも含まれません。\n" +"ペイロードには、単純なテキストメッセージ、バイナリオブジェクト、または各々が" +"独自のヘッダーとペイロードを持つサブメッセージを構造化して並べたものを使えま" +"す。\n" +"最後の形式のペイロードは、メッセージの MIME 型が :mimetype:`multipart/\\*` " +"や :mimetype:`message/rfc822` などの場合に使われます。" -#: ../../library/email.compat32-message.rst:35 msgid "" "The conceptual model provided by a :class:`Message` object is that of an " "ordered dictionary of headers with additional methods for accessing both " @@ -74,8 +87,12 @@ msgid "" "over the object tree. Note that duplicate headers are supported but special " "methods must be used to access them." msgstr "" +":class:`Message` オブジェクトは概念的にはヘッダーの順序付き辞書であり、ヘッ" +"ダーの特定の情報やペイロードへのアクセス、メッセージの直列化、オブジェクトツ" +"リーの再帰的な巡回のためのメソッドが追加されています。\n" +"同名のヘッダーを複数持てますが、それらへのアクセスには専用のメソッドが必要で" +"す。" -#: ../../library/email.compat32-message.rst:42 msgid "" "The :class:`Message` pseudo-dictionary is indexed by the header names, which " "must be ASCII values. The values of the dictionary are strings that are " @@ -88,12 +105,23 @@ msgid "" "list of :class:`Message` objects, for MIME container documents (e.g. :" "mimetype:`multipart/\\*` and :mimetype:`message/rfc822`)." msgstr "" +":class:`Message` は辞書に似たインターフェースを持ち、ASCII 値でなければならな" +"いヘッダー名をキーとします。\n" +"辞書の値は文字列で、ASCII 文字だけを含むことを想定しています。\n" +"非 ASCII 入力には特別な処理がありますが、常に正しい結果になるとは限りませ" +"ん。\n" +"ヘッダーの格納時と取得時には大文字・小文字が保持されますが、フィールド名の照" +"合では区別されません。\n" +"*Unix-From* ヘッダーまたは ``From_`` ヘッダーとも呼ばれるエンベロープヘッダー" +"を一つ持つこともできます。\n" +"*ペイロード* は、単純なメッセージオブジェクトでは文字列またはバイト列であり、" +"MIME コンテナ文書 (:mimetype:`multipart/\\*` や :mimetype:`message/rfc822` な" +"ど) では :class:`Message` オブジェクトのリストです。" #: ../../library/email.compat32-message.rst:53 msgid "Here are the methods of the :class:`Message` class:" msgstr ":class:`Message` クラスのメソッドは以下のとおりです:" -#: ../../library/email.compat32-message.rst:58 msgid "" "If *policy* is specified (it must be an instance of a :mod:`~email.policy` " "class) use the rules it specifies to update and serialize the representation " @@ -102,12 +130,16 @@ msgid "" "Python 3.2 version of the email package. For more information see the :mod:" "`~email.policy` documentation." msgstr "" +"*policy* を指定した場合 (:mod:`~email.policy` のクラスのインスタンスでなけれ" +"ばなりません)、その規則に従ってメッセージの表現を更新し、直列化します。\n" +"*policy* を指定しない場合、Python 3.2 版の email パッケージとの後方互換性を維" +"持する :class:`compat32 ` ポリシーを使います。\n" +"詳しくは :mod:`~email.policy` のドキュメントを参照してください。" #: ../../library/email.compat32-message.rst:65 msgid "The *policy* keyword argument was added." msgstr "キーワード引数 *policy* が追加されました。" -#: ../../library/email.compat32-message.rst:70 msgid "" "Return the entire message flattened as a string. When optional *unixfrom* " "is true, the envelope header is included in the returned string. *unixfrom* " @@ -119,6 +151,17 @@ msgid "" "control some of the formatting produced by the method, since the specified " "*policy* will be passed to the ``Generator``." msgstr "" +"メッセージ全体をフラット化した文字列を返します。\n" +"オプションの *unixfrom* が真の場合、戻り値にはエンベロープヘッダーが含まれま" +"す。\n" +"*unixfrom* のデフォルトは ``False`` です。\n" +"後方互換性のため *maxheaderlen* のデフォルトは ``0`` なので、別の値を使うには" +"明示的に指定する必要があります (このメソッドはポリシーの *max_line_length* を" +"無視します)。\n" +"*policy* 引数で、メッセージインスタンスから取得するデフォルトのポリシーを上書" +"きできます。\n" +"指定した *policy* は ``Generator`` に渡されるため、メソッドが生成する書式の一" +"部を制御できます。" #: ../../library/email.compat32-message.rst:80 #: ../../library/email.compat32-message.rst:122 @@ -131,7 +174,6 @@ msgstr "" "メッセージのフラット化は :class:`Message` の変更を引き起こす可能性があります " "(例えば、MIME の境界が生成される、変更される等)。" -#: ../../library/email.compat32-message.rst:84 msgid "" "Note that this method is provided as a convenience and may not always format " "the message the way you want. For example, by default it does not do the " @@ -140,8 +182,15 @@ msgid "" "Generator` instance and use its :meth:`~email.generator.Generator.flatten` " "method directly. For example::" msgstr "" +"このメソッドは便利な補助機能として提供されており、常に希望どおりの書式になる" +"とは限りません。\n" +"例えば、デフォルトでは Unix mbox 形式に必要な、``From`` で始まる行の書き換え" +"を行いません。\n" +"より柔軟に制御するには、:class:`~email.generator.Generator` のインスタンスを" +"作成し、その :meth:`~email.generator.Generator.flatten` メソッドを直接使って" +"ください。\n" +"例えば次のようにします。 ::" -#: ../../library/email.compat32-message.rst:91 msgid "" "from io import StringIO\n" "from email.generator import Generator\n" @@ -150,6 +199,12 @@ msgid "" "g.flatten(msg)\n" "text = fp.getvalue()" msgstr "" +"from io import StringIO\n" +"from email.generator import Generator\n" +"fp = StringIO()\n" +"g = Generator(fp, mangle_from_=True, maxheaderlen=60)\n" +"g.flatten(msg)\n" +"text = fp.getvalue()" #: ../../library/email.compat32-message.rst:98 msgid "" @@ -163,13 +218,13 @@ msgstr "" msgid "the *policy* keyword argument was added." msgstr "*policy* キーワード引数が追加されました。" -#: ../../library/email.compat32-message.rst:108 msgid "" "Equivalent to :meth:`.as_string`. Allows ``str(msg)`` to produce a string " "containing the formatted message." msgstr "" +":meth:`.as_string` と同じです。\n" +"``str(msg)`` で、書式化されたメッセージを含む文字列を生成できるようにします。" -#: ../../library/email.compat32-message.rst:114 msgid "" "Return the entire message flattened as a bytes object. When optional " "*unixfrom* is true, the envelope header is included in the returned string. " @@ -178,8 +233,15 @@ msgid "" "used to control some of the formatting produced by the method, since the " "specified *policy* will be passed to the ``BytesGenerator``." msgstr "" +"メッセージ全体をフラット化した bytes オブジェクトを返します。\n" +"オプションの *unixfrom* が真の場合、戻り値にはエンベロープヘッダーが含まれま" +"す。\n" +"*unixfrom* のデフォルトは ``False`` です。\n" +"*policy* 引数で、メッセージインスタンスから取得するデフォルトのポリシーを上書" +"きできます。\n" +"指定した *policy* は ``BytesGenerator`` に渡されるため、メソッドが生成する書" +"式の一部を制御できます。" -#: ../../library/email.compat32-message.rst:126 msgid "" "Note that this method is provided as a convenience and may not always format " "the message the way you want. For example, by default it does not do the " @@ -188,8 +250,15 @@ msgid "" "BytesGenerator` instance and use its :meth:`~email.generator.BytesGenerator." "flatten` method directly. For example::" msgstr "" +"このメソッドは便利な補助機能として提供されており、常に希望どおりの書式になる" +"とは限りません。\n" +"例えば、デフォルトでは Unix mbox 形式に必要な、``From`` で始まる行の書き換え" +"を行いません。\n" +"より柔軟に制御するには、:class:`~email.generator.BytesGenerator` のインスタン" +"スを作成し、その :meth:`~email.generator.BytesGenerator.flatten` メソッドを直" +"接使ってください。\n" +"例えば次のようにします。 ::" -#: ../../library/email.compat32-message.rst:134 msgid "" "from io import BytesIO\n" "from email.generator import BytesGenerator\n" @@ -198,14 +267,21 @@ msgid "" "g.flatten(msg)\n" "text = fp.getvalue()" msgstr "" +"from io import BytesIO\n" +"from email.generator import BytesGenerator\n" +"fp = BytesIO()\n" +"g = BytesGenerator(fp, mangle_from_=True, maxheaderlen=60)\n" +"g.flatten(msg)\n" +"text = fp.getvalue()" -#: ../../library/email.compat32-message.rst:146 msgid "" "Equivalent to :meth:`.as_bytes`. Allows ``bytes(msg)`` to produce a bytes " "object containing the formatted message." msgstr "" +":meth:`.as_bytes` と同じです。\n" +"``bytes(msg)`` で、書式化されたメッセージを含む bytes オブジェクトを生成でき" +"るようにします。" -#: ../../library/email.compat32-message.rst:154 msgid "" "Return ``True`` if the message's payload is a list of sub-\\ :class:" "`Message` objects, otherwise return ``False``. When :meth:`is_multipart` " @@ -215,6 +291,14 @@ msgid "" "'multipart'\" will return the ``True``. For example, ``is_multipart`` will " "return ``True`` when the :class:`Message` is of type ``message/rfc822``.)" msgstr "" +"メッセージのペイロードがサブメッセージの :class:`Message` オブジェクトのリス" +"トなら ``True`` を、それ以外なら ``False`` を返します。\n" +":meth:`is_multipart` が ``False`` を返す場合、ペイロードは文字列オブジェクト" +"のはずです (CTE でエンコードされたバイナリのペイロードの場合もあります)。\n" +":meth:`is_multipart` が ``True`` を返しても、``msg.get_content_maintype() == " +"'multipart'`` が ``True`` を返すとは限りません。\n" +"例えば、:class:`Message` の型が ``message/rfc822`` の場合も " +"``is_multipart()`` は ``True`` を返します。" #: ../../library/email.compat32-message.rst:166 msgid "" @@ -280,7 +364,6 @@ msgstr "" "が ``False``) にもかかわらず *i* が与えられたときは :exc:`TypeError` が発生し" "ます。" -#: ../../library/email.compat32-message.rst:203 msgid "" "Optional *decode* is a flag indicating whether the payload should be decoded " "or not, according to the :mailheader:`Content-Transfer-Encoding` header. " @@ -295,8 +378,20 @@ msgid "" "message's defect property (:class:`~email.errors.InvalidBase64PaddingDefect` " "or :class:`~email.errors.InvalidBase64CharactersDefect`, respectively)." msgstr "" +"オプションの *decode* は、:mailheader:`Content-Transfer-Encoding` ヘッダーに" +"従ってペイロードをデコードするかどうかを指定するフラグです。\n" +"``True`` で、メッセージがマルチパートでない場合、このヘッダーの値が ``quoted-" +"printable`` または ``base64`` ならペイロードをデコードします。\n" +"別のエンコーディングを使っている場合や :mailheader:`Content-Transfer-" +"Encoding` ヘッダーがない場合は、ペイロードをデコードせずそのまま返します。\n" +"いずれの場合も戻り値はバイナリデータです。\n" +"メッセージがマルチパートで *decode* が ``True`` の場合は ``None`` を返しま" +"す。\n" +"base64 のペイロードにパディングの欠落や base64 の文字集合にない文字がある場合" +"は、それぞれ :class:`~email.errors.InvalidBase64PaddingDefect` または :class:" +"`~email.errors.InvalidBase64CharactersDefect` がメッセージの欠陥を記録するプ" +"ロパティに追加されます。" -#: ../../library/email.compat32-message.rst:217 msgid "" "When *decode* is ``False`` (the default) the body is returned as a string " "without decoding the :mailheader:`Content-Transfer-Encoding`. However, for " @@ -306,6 +401,13 @@ msgid "" "``charset`` is specified, or if the ``charset`` given is not recognized by " "the email package, the body is decoded using the default ASCII charset." msgstr "" +"*decode* が ``False`` (デフォルト) の場合、:mailheader:`Content-Transfer-" +"Encoding` をデコードせず、本体を文字列として返します。\n" +"ただし、:mailheader:`Content-Transfer-Encoding` が 8bit の場合は、:" +"mailheader:`Content-Type` ヘッダーで指定された ``charset`` と ``replace`` エ" +"ラーハンドラーを使って、元のバイト列のデコードを試みます。\n" +"``charset`` が指定されていない場合、または email パッケージが認識できない場合" +"は、デフォルトの ASCII 文字セットで本体をデコードします。" #: ../../library/email.compat32-message.rst:226 msgid "" @@ -314,16 +416,15 @@ msgid "" "get_content` and :meth:`~email.message.EmailMessage.iter_parts`." msgstr "" -#: ../../library/email.compat32-message.rst:234 msgid "" "Set the entire message object's payload to *payload*. It is the client's " "responsibility to ensure the payload invariants. Optional *charset* sets " "the message's default character set; see :meth:`set_charset` for details." msgstr "" -"メッセージオブジェクト全体のペイロードを *payload* に設定します。クライアント" -"はペイロードを変更してはいけません。オプションの *charset* はメッセージのデ" -"フォルト文字セットを設定します。詳しくは :meth:`set_charset` を参照してくださ" -"い。" +"メッセージオブジェクトのペイロード全体を *payload* に設定します。\n" +"ペイロードが満たすべき条件を維持する責任は呼び出し側にあります。\n" +"省略可能な *charset* はメッセージのデフォルトの文字セットを設定します。\n" +"詳しくは :meth:`set_charset` を参照してください。" #: ../../library/email.compat32-message.rst:238 msgid "" @@ -437,13 +538,15 @@ msgstr "" "注意: どんな場合も、メッセージ中のエンベロープヘッダはこのマップ形式のインタ" "フェイスには含まれません。" -#: ../../library/email.compat32-message.rst:299 msgid "" "In a model generated from bytes, any header values that (in contravention of " "the RFCs) contain non-ASCII bytes will, when retrieved through this " "interface, be represented as :class:`~email.header.Header` objects with a " "charset of ``unknown-8bit``." msgstr "" +"バイト列から生成されたモデルでは、RFC に反して非 ASCII バイトを含むヘッダー値" +"をこのインターフェースから取得すると、文字セットが ``unknown-8bit`` の :" +"class:`~email.header.Header` オブジェクトとして返されます。" #: ../../library/email.compat32-message.rst:307 msgid "Return the total number of headers, including duplicates." @@ -460,11 +563,12 @@ msgstr "" "は最後にコロンをふくんでいてはいけません。このメソッドは以下のように ``in`` " "演算子で使われます::" -#: ../../library/email.compat32-message.rst:316 msgid "" "if 'message-id' in myMessage:\n" " print('Message-ID:', myMessage['message-id'])" msgstr "" +"if 'message-id' in myMessage:\n" +" print('Message-ID:', myMessage['message-id'])" #: ../../library/email.compat32-message.rst:322 msgid "" @@ -506,11 +610,12 @@ msgstr "" "せん*。もしメッセージが名前 *name* をもつフィールドをひとつしか持たないように" "したければ、最初にそれを除去してください。たとえば::" -#: ../../library/email.compat32-message.rst:341 msgid "" "del msg['subject']\n" "msg['subject'] = 'Python roolz!'" msgstr "" +"del msg['subject']\n" +"msg['subject'] = 'Python roolz!'" #: ../../library/email.compat32-message.rst:347 msgid "" @@ -537,12 +642,14 @@ msgstr "" "メッセージ中にあるすべてのヘッダのフィールド名とその値を 2-タプルのリストとし" "て返します。" -#: ../../library/email.compat32-message.rst:370 msgid "" "Return the value of the named header field. This is identical to :meth:" "`~object.__getitem__` except that optional *failobj* is returned if the " "named header is missing (defaults to ``None``)." msgstr "" +"指定した名前のヘッダーフィールドの値を返します。\n" +":meth:`~object.__getitem__` と同じですが、ヘッダーがない場合にオプションの " +"*failobj* (デフォルトは ``None``) を返す点が異なります。" #: ../../library/email.compat32-message.rst:374 msgid "Here are some additional useful methods:" @@ -558,16 +665,17 @@ msgstr "" "前のヘッダがメッセージ中に含まれていない場合は *failobj* (デフォルトでは " "``None``) が返されます。" -#: ../../library/email.compat32-message.rst:386 msgid "" "Extended header setting. This method is similar to :meth:`__setitem__` " "except that additional header parameters can be provided as keyword " "arguments. *_name* is the header field to add and *_value* is the *primary* " "value for the header." msgstr "" -"拡張ヘッダ設定。このメソッドは :meth:`__setitem__` と似ていますが、追加のヘッ" -"ダ・パラメータをキーワード引数で指定できるところが違っています。 *_name* に追" -"加するヘッダフィールドを、 *_value* にそのヘッダの *最初の* 値を渡します。" +"拡張ヘッダ設定。\n" +"このメソッドは :meth:`__setitem__` と似ていますが、追加のヘッダ・パラメータを" +"キーワード引数で指定できるところが違っています。\n" +"*_name* に追加するヘッダフィールドを、 *_value* にそのヘッダの *主たる* 値を" +"渡します。" #: ../../library/email.compat32-message.rst:391 msgid "" @@ -602,36 +710,36 @@ msgstr "" msgid "Here's an example::" msgstr "以下はこの使用例です::" -#: ../../library/email.compat32-message.rst:407 msgid "msg.add_header('Content-Disposition', 'attachment', filename='bud.gif')" msgstr "" +"msg.add_header('Content-Disposition', 'attachment', filename='bud.gif')" #: ../../library/email.compat32-message.rst:409 msgid "This will add a header that looks like ::" msgstr "こうするとヘッダには以下のように追加されます ::" -#: ../../library/email.compat32-message.rst:411 msgid "Content-Disposition: attachment; filename=\"bud.gif\"" -msgstr "" +msgstr "Content-Disposition: attachment; filename=\"bud.gif\"" #: ../../library/email.compat32-message.rst:413 msgid "An example with non-ASCII characters::" msgstr "非 ASCII 文字を使った例::" -#: ../../library/email.compat32-message.rst:415 msgid "" "msg.add_header('Content-Disposition', 'attachment',\n" " filename=('iso-8859-1', '', 'Fußballer.ppt'))" msgstr "" +"msg.add_header('Content-Disposition', 'attachment',\n" +" filename=('iso-8859-1', '', 'Fußballer.ppt'))" #: ../../library/email.compat32-message.rst:418 msgid "Which produces ::" msgstr "は、以下のようになります ::" -#: ../../library/email.compat32-message.rst:420 msgid "" "Content-Disposition: attachment; filename*=\"iso-8859-1''Fu%DFballer.ppt\"" msgstr "" +"Content-Disposition: attachment; filename*=\"iso-8859-1''Fu%DFballer.ppt\"" #: ../../library/email.compat32-message.rst:425 msgid "" @@ -750,16 +858,16 @@ msgid "" "individual header objects returned by the header access methods." msgstr "" -#: ../../library/email.compat32-message.rst:496 msgid "" "Return the value of the :mailheader:`Content-Type` header's parameter " "*param* as a string. If the message has no :mailheader:`Content-Type` " "header or if there is no such parameter, then *failobj* is returned " "(defaults to ``None``)." msgstr "" -"メッセージの :mailheader:`Content-Type` ヘッダ中のパラメータ *param* を文字列" -"として返します。そのメッセージ中に :mailheader:`Content-Type` ヘッダが存在し" -"なかった場合、 *failobj* (デフォルトは ``None``) が返されます。" +":mailheader:`Content-Type` ヘッダーのパラメータ *param* の値を文字列で返しま" +"す。\n" +"メッセージに :mailheader:`Content-Type` ヘッダーがない場合、または指定された" +"パラメータがない場合は *failobj* (デフォルトは ``None``) を返します。" #: ../../library/email.compat32-message.rst:501 msgid "" @@ -769,7 +877,6 @@ msgstr "" "オプション引数 *header* が与えられた場合、 :mailheader:`Content-Type` のかわ" "りにそのヘッダが使用されます。" -#: ../../library/email.compat32-message.rst:504 msgid "" "Parameter keys are always compared case insensitively. The return value can " "either be a string, or a 3-tuple if the parameter was :rfc:`2231` encoded. " @@ -778,12 +885,15 @@ msgid "" "``None``, in which case you should consider ``VALUE`` to be encoded in the " "``us-ascii`` charset. You can usually ignore ``LANGUAGE``." msgstr "" -"パラメータのキー比較は常に大文字小文字を区別しません。返り値は文字列か 3 要素" -"のタプルで、タプルになるのはパラメータが :rfc:`2231` エンコードされている場合" -"です。3 要素タプルの場合、各要素の値は ``(CHARSET, LANGUAGE, VALUE)`` の形式" -"になっています。 ``CHARSET`` と ``LAGUAGE`` は ``None`` になることがあり、そ" -"の場合 ``VALUE`` は ``us-ascii`` 文字セットでエンコードされているとみなさなけ" -"ればならないので注意してください。普段は ``LANGUAGE`` を無視できます。" +"パラメータのキー比較は常に大文字小文字を区別しません。\n" +"返り値は文字列か 3 要素のタプルで、タプルになるのはパラメータが :rfc:`2231` " +"エンコードされている場合です。\n" +"3 要素タプルの場合、各要素の値は ``(CHARSET, LANGUAGE, VALUE)`` の形式になっ" +"ています。\n" +"``CHARSET`` と ``LANGUAGE`` は ``None`` になることがあり、その場合 ``VALUE`` " +"は ``us-ascii`` 文字セットでエンコードされているとみなさなければならないので" +"注意してください。\n" +"普段は ``LANGUAGE`` を無視できます。" #: ../../library/email.compat32-message.rst:512 msgid "" @@ -800,11 +910,12 @@ msgstr "" "は適切にデコードされた Unicode 文字列を返し、そうでない場合は unquote された" "元の文字列を返します。たとえば::" -#: ../../library/email.compat32-message.rst:519 msgid "" "rawparam = msg.get_param('foo')\n" "param = email.utils.collapse_rfc2231_value(rawparam)" msgstr "" +"rawparam = msg.get_param('foo')\n" +"param = email.utils.collapse_rfc2231_value(rawparam)" #: ../../library/email.compat32-message.rst:522 msgid "" @@ -830,15 +941,15 @@ msgstr "" "合、 :rfc:`2045` にしたがいこの値には :mimetype:`text/plain` が設定され、新し" "いパラメータ値が末尾に追加されます。" -#: ../../library/email.compat32-message.rst:541 msgid "" "Optional *header* specifies an alternative header to :mailheader:`Content-" "Type`, and all parameters will be quoted as necessary unless optional " "*requote* is ``False`` (the default is ``True``)." msgstr "" -"オプション引数 *header* が与えられた場合、 :mailheader:`Content-Type` のかわ" -"りにそのヘッダが使用されます。オプション引数 *requote* が ``False`` でない限" -"り、この値は quote されます (デフォルトは ``True``)。" +"オプションの *header* は、:mailheader:`Content-Type` の代わりに使うヘッダーを" +"指定します。\n" +"オプションの *requote* が ``False`` でない限り、すべてのパラメータは必要に応" +"じて引用符で囲まれます (*requote* のデフォルトは ``True`` です)。" #: ../../library/email.compat32-message.rst:545 msgid "" @@ -852,12 +963,14 @@ msgstr "" "すが、デフォルトではこれは空文字列となります。 *charset* と *language* はどち" "らも文字列である必要があります。" -#: ../../library/email.compat32-message.rst:550 msgid "" "If *replace* is ``False`` (the default) the header is moved to the end of " "the list of headers. If *replace* is ``True``, the header will be updated " "in place." msgstr "" +"*replace* が ``False`` (デフォルト) の場合、ヘッダーはヘッダー一覧の末尾に移" +"動します。\n" +"*replace* が ``True`` の場合は、元の位置で更新されます。" #: ../../library/email.compat32-message.rst:554 msgid "``replace`` keyword was added." @@ -954,7 +1067,6 @@ msgstr "" "quote します。そのメッセージが :mailheader:`Content-Type` ヘッダを含んでいな" "い場合、 :exc:`~email.errors.HeaderParseError` が発生します。" -#: ../../library/email.compat32-message.rst:612 msgid "" "Note that using this method is subtly different than deleting the old :" "mailheader:`Content-Type` header and adding a new one with the new boundary " @@ -965,20 +1077,22 @@ msgid "" msgstr "" "注意: このメソッドを使うのは、古い :mailheader:`Content-Type` ヘッダを削除し" "て新しい boundary をもったヘッダを :meth:`add_header` で足すのとは少し違いま" -"す。 :meth:`set_boundary` は一連のヘッダ中での :mailheader:`Content-Type` " -"ヘッダの位置を保つからです。しかし、これは元の :mailheader:`Content-Type` " -"ヘッダ中に存在していた連続する行の順番までは *保ちません* 。" +"す。\n" +":meth:`set_boundary` は一連のヘッダ中での :mailheader:`Content-Type` ヘッダの" +"位置を保つからです。\n" +"しかし、これは元の :mailheader:`Content-Type` ヘッダ中に存在していた継続行は " +"*保持しません* 。" -#: ../../library/email.compat32-message.rst:622 msgid "" "Return the ``charset`` parameter of the :mailheader:`Content-Type` header, " "coerced to lower case. If there is no :mailheader:`Content-Type` header, or " "if that header has no ``charset`` parameter, *failobj* is returned." msgstr "" "そのメッセージ中の :mailheader:`Content-Type` ヘッダにある、 ``charset`` パラ" -"メータの値を返します。値はすべて小文字に変換されます。メッセージ中に :" -"mailheader:`Content-Type` がなかったり、このヘッダ中に ``charaset`` パラメー" -"タがない場合には *failobj* が返されます。" +"メータの値を返します。\n" +"値はすべて小文字に変換されます。\n" +"メッセージ中に :mailheader:`Content-Type` がなかったり、このヘッダ中に " +"``charset`` パラメータがない場合には *failobj* が返されます。" #: ../../library/email.compat32-message.rst:626 msgid "" @@ -1015,13 +1129,16 @@ msgstr "" "あるいは MIME maintype が :mimetype:`text` でないいずれかの場合には、リストの" "要素として *failobj* が返されます。" -#: ../../library/email.compat32-message.rst:646 msgid "" "Return the lowercased value (without parameters) of the message's :" "mailheader:`Content-Disposition` header if it has one, or ``None``. The " "possible values for this method are *inline*, *attachment* or ``None`` if " "the message follows :rfc:`2183`." msgstr "" +"メッセージに :mailheader:`Content-Disposition` ヘッダーがあれば、パラメータを" +"除いた値を小文字で返し、なければ ``None`` を返します。\n" +"メッセージが :rfc:`2183` に準拠していれば、戻り値は *inline*、*attachment*、" +"``None`` のいずれかです。" #: ../../library/email.compat32-message.rst:655 msgid "" @@ -1044,7 +1161,6 @@ msgstr "" "以下の例は、 multipart メッセージのすべての part において、その MIME タイプを" "表示していくものです。 :" -#: ../../library/email.compat32-message.rst:674 msgid "" ">>> for part in msg.walk():\n" "... print(part.get_content_type())\n" @@ -1056,16 +1172,29 @@ msgid "" "message/rfc822\n" "text/plain" msgstr "" +">>> for part in msg.walk():\n" +"... print(part.get_content_type())\n" +"multipart/report\n" +"text/plain\n" +"message/delivery-status\n" +"text/plain\n" +"text/plain\n" +"message/rfc822\n" +"text/plain" -#: ../../library/email.compat32-message.rst:686 msgid "" "``walk`` iterates over the subparts of any part where :meth:`is_multipart` " "returns ``True``, even though ``msg.get_content_maintype() == 'multipart'`` " "may return ``False``. We can see this in our example by making use of the " "``_structure`` debug helper function:" msgstr "" +"``walk()`` は、:meth:`is_multipart` が ``True`` を返すパートのサブパートを反" +"復処理します。\n" +"``msg.get_content_maintype() == 'multipart'`` が ``False`` を返す場合も同様で" +"す。\n" +"デバッグ用の補助関数 ``_structure()`` を使うと、この例でその様子を確認できま" +"す。" -#: ../../library/email.compat32-message.rst:692 msgid "" ">>> for part in msg.walk():\n" "... print(part.get_content_maintype() == 'multipart',\n" @@ -1086,13 +1215,34 @@ msgid "" " message/rfc822\n" " text/plain" msgstr "" +">>> for part in msg.walk():\n" +"... print(part.get_content_maintype() == 'multipart',\n" +"... part.is_multipart())\n" +"True True\n" +"False False\n" +"False True\n" +"False False\n" +"False False\n" +"False True\n" +"False False\n" +">>> _structure(msg)\n" +"multipart/report\n" +" text/plain\n" +" message/delivery-status\n" +" text/plain\n" +" text/plain\n" +" message/rfc822\n" +" text/plain" -#: ../../library/email.compat32-message.rst:713 msgid "" "Here the ``message`` parts are not ``multiparts``, but they do contain " "subparts. ``is_multipart()`` returns ``True`` and ``walk`` descends into the " "subparts." msgstr "" +"ここでは ``message`` パートは ``multipart`` ではありませんが、サブパートを含" +"んでいます。\n" +"``is_multipart()`` は ``True`` を返し、``walk()`` はサブパートの中へ進みま" +"す。" #: ../../library/email.compat32-message.rst:718 msgid "" diff --git a/library/email.contentmanager.po b/library/email.contentmanager.po index ce024a87a..6e5e39f00 100644 --- a/library/email.contentmanager.po +++ b/library/email.contentmanager.po @@ -17,15 +17,14 @@ msgstr "" "Last-Translator: Tetsuo Koyama , 2021\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" -#: ../../library/email.contentmanager.rst:2 msgid ":mod:`!email.contentmanager`: Managing MIME Content" -msgstr "" +msgstr ":mod:`!email.contentmanager`: MIME コンテンツの管理" #: ../../library/email.contentmanager.rst:10 msgid "**Source code:** :source:`Lib/email/contentmanager.py`" @@ -35,26 +34,32 @@ msgstr "**ソースコード:** :source:`Lib/email/contentmanager.py`" msgid "[1]_" msgstr "[1]_" -#: ../../library/email.contentmanager.rst:19 msgid "" "Base class for content managers. Provides the standard registry mechanisms " "to register converters between MIME content and other representations, as " "well as the ``get_content`` and ``set_content`` dispatch methods." msgstr "" +"コンテンツマネージャーの基底クラスです。\n" +"MIME コンテンツと他の表現との変換処理を登録する標準のレジストリ機構と、処理を" +"振り分ける ``get_content()``、``set_content()`` メソッドを提供します。" -#: ../../library/email.contentmanager.rst:26 msgid "" "Look up a handler function based on the ``mimetype`` of *msg* (see next " "paragraph), call it, passing through all arguments, and return the result of " "the call. The expectation is that the handler will extract the payload from " "*msg* and return an object that encodes information about the extracted data." msgstr "" +"*msg* の ``mimetype`` に基づいてハンドラー関数を探し (次の段落を参照)、すべて" +"の引数をそのまま渡して呼び出し、その結果を返します。\n" +"ハンドラーは *msg* からペイロードを抽出し、抽出したデータの情報を表すオブジェ" +"クトを返すことを想定しています。" -#: ../../library/email.contentmanager.rst:32 msgid "" "To find the handler, look for the following keys in the registry, stopping " "with the first one found:" msgstr "" +"ハンドラーを見つけるには、レジストリで次のキーを順に探し、最初に見つかったも" +"のを使います。" #: ../../library/email.contentmanager.rst:35 msgid "the string representing the full MIME type (``maintype/subtype``)" @@ -68,13 +73,13 @@ msgstr "``maintype`` を表す文字列" msgid "the empty string" msgstr "空の文字列" -#: ../../library/email.contentmanager.rst:39 msgid "" "If none of these keys produce a handler, raise a :exc:`KeyError` for the " "full MIME type." msgstr "" +"どのキーでもハンドラーが見つからない場合、完全な MIME 型を示す :exc:" +"`KeyError` を送出します。" -#: ../../library/email.contentmanager.rst:45 msgid "" "If the ``maintype`` is ``multipart``, raise a :exc:`TypeError`; otherwise " "look up a handler function based on the type of *obj* (see next paragraph), " @@ -84,13 +89,21 @@ msgid "" "making other changes to *msg* as well, such as adding various MIME headers " "to encode information needed to interpret the stored data." msgstr "" +"``maintype`` が ``multipart`` の場合は :exc:`TypeError` を送出します。\n" +"そうでなければ、*obj* の型に基づいてハンドラー関数を探し (次の段落を参照)、" +"*msg* の :meth:`~email.message.EmailMessage.clear_content` を呼び出してから、" +"すべての引数をそのまま渡してハンドラー関数を呼び出します。\n" +"ハンドラーは *obj* を変換して *msg* に格納することを想定しています。\n" +"格納したデータの解釈に必要な情報を表す MIME ヘッダーを追加するなど、*msg* に" +"他の変更を加えることもあります。" -#: ../../library/email.contentmanager.rst:54 msgid "" "To find the handler, obtain the type of *obj* (``typ = type(obj)``), and " "look for the following keys in the registry, stopping with the first one " "found:" msgstr "" +"ハンドラーを見つけるには、*obj* の型を取得し (``typ = type(obj)``)、レジスト" +"リで次のキーを順に探して最初に見つかったものを使います。" #: ../../library/email.contentmanager.rst:58 msgid "the type itself (``typ``)" @@ -102,15 +115,12 @@ msgid "" "__qualname__``)." msgstr "型の完全修飾名 (``typ.__module__ + '.' + typ.__qualname__``)." -#: ../../library/email.contentmanager.rst:61 msgid "the type's :attr:`qualname ` (``typ.__qualname__``)" -msgstr "" +msgstr "型の :attr:`qualname ` (``typ.__qualname__``)" -#: ../../library/email.contentmanager.rst:62 msgid "the type's :attr:`name ` (``typ.__name__``)." -msgstr "" +msgstr "型の :attr:`name ` (``typ.__name__``)。" -#: ../../library/email.contentmanager.rst:64 msgid "" "If none of the above match, repeat all of the checks above for each of the " "types in the :term:`MRO` (:attr:`typ.__mro__ `). Finally, if " @@ -118,6 +128,12 @@ msgid "" "there is no handler for ``None``, raise a :exc:`KeyError` for the fully " "qualified name of the type." msgstr "" +"いずれも一致しない場合、:term:`MRO` (:attr:`typ.__mro__ `) 内の" +"各型について、上記の確認をすべて繰り返します。\n" +"それでもハンドラーが見つからない場合、最後にキー ``None`` のハンドラーを探し" +"ます。\n" +"``None`` のハンドラーもなければ、型の完全修飾名を示す :exc:`KeyError` を送出" +"します。" #: ../../library/email.contentmanager.rst:71 msgid "" @@ -125,30 +141,35 @@ msgid "" "also :class:`.MIMEPart`)." msgstr "" -#: ../../library/email.contentmanager.rst:77 msgid "" "Record the function *handler* as the handler for *key*. For the possible " "values of *key*, see :meth:`get_content`." msgstr "" +"関数 *handler* を *key* のハンドラーとして登録します。\n" +"*key* に指定できる値は :meth:`get_content` を参照してください。" -#: ../../library/email.contentmanager.rst:83 msgid "" "Record *handler* as the function to call when an object of a type matching " "*typekey* is passed to :meth:`set_content`. For the possible values of " "*typekey*, see :meth:`set_content`." msgstr "" +"*typekey* に一致する型のオブジェクトが :meth:`set_content` に渡されたときに呼" +"び出す関数として、*handler* を登録します。\n" +"*typekey* に指定できる値は :meth:`set_content` を参照してください。" -#: ../../library/email.contentmanager.rst:89 msgid "Content Manager Instances" -msgstr "" +msgstr "コンテンツマネージャーのインスタンス" -#: ../../library/email.contentmanager.rst:91 msgid "" "Currently the email package provides only one concrete content manager, :" "data:`raw_data_manager`, although more may be added in the future. :data:" "`raw_data_manager` is the :attr:`~email.policy.EmailPolicy.content_manager` " "provided by :attr:`~email.policy.EmailPolicy` and its derivatives." msgstr "" +"現在、email パッケージが提供する具体的なコンテンツマネージャーは :data:" +"`raw_data_manager` だけですが、将来さらに追加される可能性があります。\n" +":data:`raw_data_manager` は :attr:`~email.policy.EmailPolicy` とその派生クラ" +"スが提供する :attr:`~email.policy.EmailPolicy.content_manager` です。" #: ../../library/email.contentmanager.rst:100 msgid "" @@ -173,44 +194,55 @@ msgid "" "to unicode. The default error handler is ``replace``." msgstr "" -#: ../../library/email.contentmanager.rst:131 msgid "Add headers and payload to *msg*:" -msgstr "" +msgstr "*msg* にヘッダーとペイロードを追加します。" -#: ../../library/email.contentmanager.rst:133 msgid "" "Add a :mailheader:`Content-Type` header with a ``maintype/subtype`` value." msgstr "" +"``maintype/subtype`` の値を持つ :mailheader:`Content-Type` ヘッダーを追加しま" +"す。" -#: ../../library/email.contentmanager.rst:136 msgid "" "For ``str``, set the MIME ``maintype`` to ``text``, and set the subtype to " "*subtype* if it is specified, or ``plain`` if it is not." msgstr "" +"``str`` の場合、MIME の ``maintype`` を ``text`` に設定します。\n" +"サブタイプは *subtype* が指定されていればその値に、そうでなければ ``plain`` " +"に設定します。" -#: ../../library/email.contentmanager.rst:138 msgid "" "For ``bytes``, use the specified *maintype* and *subtype*, or raise a :exc:" "`TypeError` if they are not specified." msgstr "" +"``bytes`` の場合、指定された *maintype* と *subtype* を使います。\n" +"指定されていなければ :exc:`TypeError` を送出します。" -#: ../../library/email.contentmanager.rst:140 msgid "" "For :class:`~email.message.EmailMessage` objects, set the maintype to " "``message``, and set the subtype to *subtype* if it is specified or " "``rfc822`` if it is not. If *subtype* is ``partial``, raise an error " "(``bytes`` objects must be used to construct ``message/partial`` parts)." msgstr "" +":class:`~email.message.EmailMessage` オブジェクトの場合、メインタイプを " +"``message`` に設定します。\n" +"サブタイプは *subtype* が指定されていればその値に、そうでなければ ``rfc822`` " +"に設定します。\n" +"*subtype* が ``partial`` の場合はエラーを送出します (``message/partial`` パー" +"トの作成には ``bytes`` オブジェクトを使う必要があります)。" -#: ../../library/email.contentmanager.rst:146 msgid "" "If *charset* is provided (which is valid only for ``str``), encode the " "string to bytes using the specified character set. The default is " "``utf-8``. If the specified *charset* is a known alias for a standard MIME " "charset name, use the standard charset instead." msgstr "" +"*charset* が指定されている場合 (``str`` でのみ有効)、指定された文字セットで文" +"字列をバイト列にエンコードします。\n" +"デフォルトは ``utf-8`` です。\n" +"指定された *charset* が標準の MIME 文字セット名の既知の別名であれば、標準の文" +"字セット名を使います。" -#: ../../library/email.contentmanager.rst:151 msgid "" "If *cte* is set, encode the payload using the specified content transfer " "encoding, and set the :mailheader:`Content-Transfer-Encoding` header to that " @@ -219,8 +251,14 @@ msgid "" "specified encoding (for example, specifying a *cte* of ``7bit`` for an input " "that contains non-ASCII values), raise a :exc:`ValueError`." msgstr "" +"*cte* が設定されている場合、指定されたコンテンツ転送エンコーディングでペイ" +"ロードをエンコードし、:mailheader:`Content-Transfer-Encoding` ヘッダーをその" +"値に設定します。\n" +"*cte* に指定できる値は ``quoted-printable``、``base64``、``7bit``、``8bit``、" +"``binary`` です。\n" +"非 ASCII 値を含む入力に *cte* として ``7bit`` を指定するなど、入力を指定され" +"た形式でエンコードできない場合は :exc:`ValueError` を送出します。" -#: ../../library/email.contentmanager.rst:159 msgid "" "For ``str`` objects, if *cte* is not set use heuristics to determine the " "most compact encoding. Prior to encoding, :meth:`str.splitlines` is used to " @@ -228,14 +266,19 @@ msgid "" "terminated by the current policy's :data:`~email.policy.Policy.linesep` " "property (even if the original string did not end with one)." msgstr "" +"``str`` オブジェクトで *cte* を設定していない場合、ヒューリスティックによって" +"最もコンパクトなエンコーディングを決めます。\n" +"エンコード前に :meth:`str.splitlines` ですべての行境界を正規化し、ペイロード" +"の各行が現在のポリシーの :data:`~email.policy.Policy.linesep` プロパティで終" +"わるようにします (元の文字列が改行で終わっていなくても同様です)。" -#: ../../library/email.contentmanager.rst:165 msgid "" "For ``bytes`` objects, *cte* is taken to be base64 if not set, and the " "aforementioned newline translation is not performed." msgstr "" +"``bytes`` オブジェクトの場合、*cte* を設定していなければ base64 とみなし、上" +"記の改行変換は行いません。" -#: ../../library/email.contentmanager.rst:167 msgid "" "For :class:`~email.message.EmailMessage`, per :rfc:`2046`, raise an error if " "a *cte* of ``quoted-printable`` or ``base64`` is requested for *subtype* " @@ -243,15 +286,22 @@ msgid "" "body``. For ``message/rfc822``, use ``8bit`` if *cte* is not specified. " "For all other values of *subtype*, use ``7bit``." msgstr "" +":class:`~email.message.EmailMessage` の場合、:rfc:`2046` に従い、*subtype* " +"が ``rfc822`` で *cte* に ``quoted-printable`` または ``base64`` を指定した場" +"合と、*subtype* が ``external-body`` で *cte* に ``7bit`` 以外を指定した場合" +"にはエラーを送出します。\n" +"``message/rfc822`` で *cte* が指定されていなければ ``8bit`` を使います。\n" +"それ以外の *subtype* では ``7bit`` を使います。" -#: ../../library/email.contentmanager.rst:174 msgid "" "A *cte* of ``binary`` does not actually work correctly yet. The " "``EmailMessage`` object as modified by ``set_content`` is correct, but :" "class:`~email.generator.BytesGenerator` does not serialize it correctly." msgstr "" +"*cte* の ``binary`` は、まだ正しく動作しません。\n" +"``set_content()`` によって変更された ``EmailMessage`` オブジェクトは正しいも" +"のの、:class:`~email.generator.BytesGenerator` が正しく直列化しません。" -#: ../../library/email.contentmanager.rst:179 msgid "" "If *disposition* is set, use it as the value of the :mailheader:`Content-" "Disposition` header. If not specified, and *filename* is specified, add the " @@ -259,38 +309,52 @@ msgid "" "*filename* is also not specified, do not add the header. The only valid " "values for *disposition* are ``attachment`` and ``inline``." msgstr "" +"*disposition* が設定されていれば、:mailheader:`Content-Disposition` ヘッダー" +"の値として使います。\n" +"指定されておらず、*filename* が指定されている場合は、値を ``attachment`` とし" +"てヘッダーを追加します。\n" +"*disposition* も *filename* も指定されていなければ、ヘッダーは追加しませ" +"ん。\n" +"*disposition* に有効な値は ``attachment`` と ``inline`` だけです。" -#: ../../library/email.contentmanager.rst:186 msgid "" "If *filename* is specified, use it as the value of the ``filename`` " "parameter of the :mailheader:`Content-Disposition` header." msgstr "" +"*filename* が指定されている場合、:mailheader:`Content-Disposition` ヘッダー" +"の ``filename`` パラメータの値として使います。" -#: ../../library/email.contentmanager.rst:189 msgid "" "If *cid* is specified, add a :mailheader:`Content-ID` header with *cid* as " "its value." msgstr "" +"*cid* が指定されている場合、その値を持つ :mailheader:`Content-ID` ヘッダーを" +"追加します。" -#: ../../library/email.contentmanager.rst:192 msgid "" "If *params* is specified, iterate its ``items`` method and use the resulting " "``(key, value)`` pairs to set additional parameters on the :mailheader:" "`Content-Type` header." msgstr "" +"*params* が指定されている場合、その ``items()`` メソッドの結果を反復処理し、" +"得られた ``(key, value)`` ペアを使って :mailheader:`Content-Type` ヘッダーに" +"追加のパラメータを設定します。" -#: ../../library/email.contentmanager.rst:196 msgid "" "If *headers* is specified and is a list of strings of the form ``headername: " "headervalue`` or a list of ``header`` objects (distinguished from strings by " "having a ``name`` attribute), add the headers to *msg*." msgstr "" +"*headers* が指定されていて、``headername: headervalue`` 形式の文字列のリス" +"ト、または ``header`` オブジェクトのリスト (``name`` 属性を持つことで文字列と" +"区別します) である場合、そのヘッダーを *msg* に追加します。" #: ../../library/email.contentmanager.rst:203 msgid "Footnotes" msgstr "脚注" -#: ../../library/email.contentmanager.rst:204 msgid "" "Originally added in 3.4 as a :term:`provisional module `" msgstr "" +"当初は 3.4 で :term:`暫定モジュール ` として追加されまし" +"た。" diff --git a/library/email.encoders.po b/library/email.encoders.po index 3ed57d1b5..68be4fca9 100644 --- a/library/email.encoders.po +++ b/library/email.encoders.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/email.encoders.rst:2 diff --git a/library/email.errors.po b/library/email.errors.po index 7d7ea066d..843785296 100644 --- a/library/email.errors.po +++ b/library/email.errors.po @@ -17,15 +17,14 @@ msgstr "" "Last-Translator: tomo, 2021\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" -#: ../../library/email.errors.rst:2 msgid ":mod:`!email.errors`: Exception and Defect classes" -msgstr "" +msgstr ":mod:`!email.errors`: 例外クラスと障害クラス" #: ../../library/email.errors.rst:7 msgid "**Source code:** :source:`Lib/email/errors.py`" @@ -48,14 +47,15 @@ msgstr "" "は標準の :exc:`Exception` クラスから派生しており、追加のメソッドは定義されて" "いません。" -#: ../../library/email.errors.rst:23 msgid "" "This is the base class for exceptions raised by the :class:`~email.parser." "Parser` class. It is derived from :exc:`MessageError`. This class is also " "used internally by the parser used by :mod:`~email.headerregistry`." msgstr "" +":class:`~email.parser.Parser` クラスが送出する例外の基底クラスで、:exc:" +"`MessageError` から派生しています。\n" +":mod:`~email.headerregistry` のパーサーでも内部的に使われています。" -#: ../../library/email.errors.rst:31 msgid "" "Raised under some error conditions when parsing the :rfc:`5322` headers of a " "message, this class is derived from :exc:`MessageParseError`. The :meth:" @@ -66,12 +66,19 @@ msgid "" "header (that is, there is what is supposed to be a continuation line that " "has no leading whitespace and looks like a header)." msgstr "" +"メッセージの :rfc:`5322` ヘッダーを解析する際の、一部のエラー条件で送出されま" +"す。\n" +"このクラスは :exc:`MessageParseError` から派生しています。\n" +":meth:`~email.message.EmailMessage.set_boundary` は、呼び出し時にコンテントタ" +"イプが不明な場合にこのエラーを送出します。\n" +":class:`~email.header.Header` は、一部の base64 デコードエラーや、別のヘッ" +"ダーが埋め込まれているように見えるヘッダーを作成しようとした場合にこのエラー" +"を送出することがあります (継続行のはずの行の先頭に空白がなく、ヘッダーのよう" +"に見える場合です)。" -#: ../../library/email.errors.rst:43 msgid "Deprecated and no longer used." -msgstr "" +msgstr "非推奨となっており、現在は使われていません。" -#: ../../library/email.errors.rst:48 msgid "" "Raised if the :meth:`~email.message.Message.attach` method is called on an " "instance of a class derived from :class:`~email.mime.nonmultipart." @@ -79,23 +86,31 @@ msgid "" "`MultipartConversionError` multiply inherits from :exc:`MessageError` and " "the built-in :exc:`TypeError`." msgstr "" +":class:`~email.mime.nonmultipart.MIMENonMultipart` から派生したクラス (:" +"class:`~email.mime.image.MIMEImage` など) のインスタンスで :meth:`~email." +"message.Message.attach` を呼び出すと送出されます。\n" +":exc:`MultipartConversionError` は :exc:`MessageError` と組み込みの :exc:" +"`TypeError` を多重継承しています。" -#: ../../library/email.errors.rst:58 msgid "" "Raised when an error occurs when the :mod:`~email.generator` outputs headers." msgstr "" +":mod:`~email.generator` がヘッダーを出力するときにエラーが発生すると送出され" +"ます。" -#: ../../library/email.errors.rst:64 msgid "" "This is the base class for all defects found when parsing email messages. It " "is derived from :exc:`ValueError`." msgstr "" +"電子メールメッセージの解析中に見つかったすべての障害の基底クラスです。\n" +":exc:`ValueError` から派生しています。" -#: ../../library/email.errors.rst:69 msgid "" "This is the base class for all defects found when parsing email headers. It " "is derived from :exc:`MessageDefect`." msgstr "" +"電子メールヘッダーの解析中に見つかったすべての障害の基底クラスです。\n" +":exc:`MessageDefect` から派生しています。" #: ../../library/email.errors.rst:72 msgid "" @@ -118,79 +133,90 @@ msgid "" msgstr "" "すべての障害クラスは :class:`email.errors.MessageDefect` のサブクラスです。" -#: ../../library/email.errors.rst:82 msgid "" "A message claimed to be a multipart, but had no :mimetype:`boundary` " "parameter." msgstr "" +"メッセージはマルチパートと宣言されていますが、:mimetype:`boundary` パラメータ" +"がありません。" -#: ../../library/email.errors.rst:87 msgid "" "The start boundary claimed in the :mailheader:`Content-Type` header was " "never found." msgstr "" +":mailheader:`Content-Type` ヘッダーで宣言された開始境界が見つかりませんでし" +"た。" -#: ../../library/email.errors.rst:92 msgid "" "A start boundary was found, but no corresponding close boundary was ever " "found." -msgstr "" +msgstr "開始境界は見つかりましたが、対応する終了境界が見つかりませんでした。" -#: ../../library/email.errors.rst:99 msgid "The message had a continuation line as its first header line." -msgstr "" +msgstr "メッセージの最初のヘッダー行が継続行になっています。" -#: ../../library/email.errors.rst:103 msgid "A \"Unix From\" header was found in the middle of a header block." -msgstr "" +msgstr "ヘッダーブロックの途中に \"Unix From\" ヘッダーが見つかりました。" -#: ../../library/email.errors.rst:107 msgid "" "A line was found while parsing headers that had no leading white space but " "contained no ':'. Parsing continues assuming that the line represents the " "first line of the body." msgstr "" +"ヘッダーの解析中に、先頭に空白がなく、コロンも含まない行が見つかりました。\n" +"その行を本文の最初の行とみなして解析を続けます。" -#: ../../library/email.errors.rst:115 msgid "" "A header was found that was missing a colon, or was otherwise malformed." -msgstr "" +msgstr "コロンがないなど、形式が不正なヘッダーが見つかりました。" -#: ../../library/email.errors.rst:117 msgid "This defect has not been used for several Python versions." -msgstr "この欠陥が使われていないPythonバージョンがいくつかあります。" +msgstr "この障害は、ここ数バージョンの Python では使われていません。" -#: ../../library/email.errors.rst:122 msgid "" "A message claimed to be a :mimetype:`multipart`, but no subparts were found. " "Note that when a message has this defect, its :meth:`~email.message.Message." "is_multipart` method may return ``False`` even though its content type " "claims to be :mimetype:`multipart`." msgstr "" +"メッセージは :mimetype:`multipart` と宣言されていますが、サブパートが見つかり" +"ませんでした。\n" +"この障害があるメッセージでは、コンテントタイプが :mimetype:`multipart` であっ" +"ても :meth:`~email.message.Message.is_multipart` が ``False`` を返すことがあ" +"ります。" -#: ../../library/email.errors.rst:129 msgid "" "When decoding a block of base64 encoded bytes, the padding was not correct. " "Enough padding is added to perform the decode, but the resulting decoded " "bytes may be invalid." msgstr "" +"base64 でエンコードされたバイト列のブロックをデコードするときに、パディングの" +"不正が見つかりました。\n" +"デコードに必要なパディングは補われますが、結果のバイト列が不正になる可能性が" +"あります。" -#: ../../library/email.errors.rst:135 msgid "" "When decoding a block of base64 encoded bytes, characters outside the base64 " "alphabet were encountered. The characters are ignored, but the resulting " "decoded bytes may be invalid." msgstr "" +"base64 でエンコードされたバイト列のブロックをデコードするときに、base64 の文" +"字集合にない文字が見つかりました。\n" +"その文字は無視されますが、結果のバイト列が不正になる可能性があります。" -#: ../../library/email.errors.rst:141 msgid "" "When decoding a block of base64 encoded bytes, the number of non-padding " "base64 characters was invalid (1 more than a multiple of 4). The encoded " "block was kept as-is." msgstr "" +"base64 でエンコードされたバイト列のブロックをデコードするときに、パディングを" +"除く base64 文字の数が不正でした (4 の倍数より 1 多い数でした)。\n" +"エンコードされたブロックはそのまま保持されます。" -#: ../../library/email.errors.rst:147 msgid "" "When decoding an invalid or unparsable date field. The original value is " "kept as-is." msgstr "" +"不正な日付フィールド、または解析できない日付フィールドをデコードするときに発" +"生します。\n" +"元の値はそのまま保持されます。" diff --git a/library/email.examples.po b/library/email.examples.po index 3360e6254..2672b4ae6 100644 --- a/library/email.examples.po +++ b/library/email.examples.po @@ -17,10 +17,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/email.examples.rst:4 @@ -44,7 +44,6 @@ msgstr "" "最初に、シンプルなテキストメッセージ (テキストコンテンツとアドレスの両方がユ" "ニコード文字を含み得る) を作成・送信する方法を見てみましょう:" -#: ../../library/email.examples.rst:12 msgid "" "# Import smtplib for the actual sending function\n" "import smtplib\n" @@ -69,6 +68,29 @@ msgid "" "s.send_message(msg)\n" "s.quit()\n" msgstr "" +"# 実際の送信に使う smtplib をインポートします\n" +"import smtplib\n" +"\n" +"# 必要な email モジュールをインポートします\n" +"from email.message import EmailMessage\n" +"\n" +"# textfile に名前が入っているプレーンテキストファイルを読み込み用に開きま" +"す。\n" +"with open(textfile) as fp:\n" +" # text/plain メッセージを作成します\n" +" msg = EmailMessage()\n" +" msg.set_content(fp.read())\n" +"\n" +"# me == 送信者のメールアドレス\n" +"# you == 受信者のメールアドレス\n" +"msg['Subject'] = f'The contents of {textfile}'\n" +"msg['From'] = me\n" +"msg['To'] = you\n" +"\n" +"# 自分の SMTP サーバー経由でメッセージを送信します。\n" +"s = smtplib.SMTP('localhost')\n" +"s.send_message(msg)\n" +"s.quit()\n" #: ../../library/email.examples.rst:15 msgid "" @@ -78,7 +100,6 @@ msgstr "" ":rfc:`822` ヘッダーの解析は、 :mod:`~email.parser` モジュールにあるクラスを使" "用することにより、簡単に実現できます:" -#: ../../library/email.examples.rst:18 msgid "" "# Import the email modules we'll need\n" "#from email.parser import BytesParser\n" @@ -106,6 +127,32 @@ msgid "" "print('Recipient username: {}'.format(headers['to'].addresses[0].username))\n" "print('Sender name: {}'.format(headers['from'].addresses[0].display_name))\n" msgstr "" +"# 必要な email モジュールをインポートします\n" +"#from email.parser import BytesParser\n" +"from email.parser import Parser\n" +"from email.policy import default\n" +"\n" +"# 電子メールのヘッダーがファイルにある場合、次の 2 行のコメントを外します:\n" +"# with open(messagefile, 'rb') as fp:\n" +"# headers = BytesParser(policy=default).parse(fp)\n" +"\n" +"# 文字列中のヘッダーを解析する場合 (一般的ではありません) は、次のようにしま" +"す:\n" +"headers = Parser(policy=default).parsestr(\n" +" 'From: Foo Bar \\n'\n" +" 'To: \\n'\n" +" 'Subject: Test message\\n'\n" +" '\\n'\n" +" 'Body would go here\\n')\n" +"\n" +"# これで、辞書としてヘッダーの各項目にアクセスできます:\n" +"print('To: {}'.format(headers['to']))\n" +"print('From: {}'.format(headers['from']))\n" +"print('Subject: {}'.format(headers['subject']))\n" +"\n" +"# アドレスの各部分にもアクセスできます:\n" +"print('Recipient username: {}'.format(headers['to'].addresses[0].username))\n" +"print('Sender name: {}'.format(headers['from'].addresses[0].display_name))\n" #: ../../library/email.examples.rst:21 msgid "" @@ -153,7 +200,6 @@ msgstr "" "つぎはあるディレクトリに含まれている内容全体をひとつの電子メールメッセージと" "して送信するやり方です: [1]_" -#: ../../library/email.examples.rst:30 msgid "" "#!/usr/bin/env python3\n" "\n" @@ -240,6 +286,90 @@ msgid "" "if __name__ == '__main__':\n" " main()\n" msgstr "" +"#!/usr/bin/env python3\n" +"\n" +"\"\"\"ディレクトリの内容を MIME メッセージとして送信します。\"\"\"\n" +"\n" +"import os\n" +"import smtplib\n" +"# ファイル名の拡張子から MIME 型を推測するために使います\n" +"import mimetypes\n" +"\n" +"from argparse import ArgumentParser\n" +"\n" +"from email.message import EmailMessage\n" +"from email.policy import SMTP\n" +"\n" +"\n" +"def main():\n" +" parser = ArgumentParser(description=\"\"\"\\\n" +"Send the contents of a directory as a MIME message.\n" +"Unless the -o option is given, the email is sent by forwarding to your " +"local\n" +"SMTP server, which then does the normal delivery process. Your local " +"machine\n" +"must be running an SMTP server.\n" +"\"\"\")\n" +" parser.add_argument('-d', '--directory',\n" +" help=\"\"\"Mail the contents of the specified " +"directory,\n" +" otherwise use the current directory. Only the " +"regular\n" +" files in the directory are sent, and we don't " +"recurse to\n" +" subdirectories.\"\"\")\n" +" parser.add_argument('-o', '--output',\n" +" metavar='FILE',\n" +" help=\"\"\"Print the composed message to FILE " +"instead of\n" +" sending the message to the SMTP server.\"\"\")\n" +" parser.add_argument('-s', '--sender', required=True,\n" +" help='The value of the From: header (required)')\n" +" parser.add_argument('-r', '--recipient', required=True,\n" +" action='append', metavar='RECIPIENT',\n" +" default=[], dest='recipients',\n" +" help='A To: header value (at least one required)')\n" +" args = parser.parse_args()\n" +" directory = args.directory\n" +" if not directory:\n" +" directory = '.'\n" +" # メッセージを作成します\n" +" msg = EmailMessage()\n" +" msg['Subject'] = f'Contents of directory {os.path.abspath(directory)}'\n" +" msg['To'] = ', '.join(args.recipients)\n" +" msg['From'] = args.sender\n" +" msg.preamble = 'You will not see this in a MIME-aware mail reader.\\n'\n" +"\n" +" for filename in os.listdir(directory):\n" +" path = os.path.join(directory, filename)\n" +" if not os.path.isfile(path):\n" +" continue\n" +" # ファイルの拡張子からコンテントタイプを推測します。\n" +" # エンコーディングは無視しますが、本来は gzip などで圧縮された\n" +" # ファイルのような単純なケースを確認する必要があります。\n" +" ctype, encoding = mimetypes.guess_file_type(path)\n" +" if ctype is None or encoding is not None:\n" +" # 推測できなかったか、ファイルがエンコード (圧縮) されているの" +"で、\n" +" # 汎用のバイナリデータ型を使います。\n" +" ctype = 'application/octet-stream'\n" +" maintype, subtype = ctype.split('/', 1)\n" +" with open(path, 'rb') as fp:\n" +" msg.add_attachment(fp.read(),\n" +" maintype=maintype,\n" +" subtype=subtype,\n" +" filename=filename)\n" +" # メッセージを送信または保存します\n" +" if args.output:\n" +" with open(args.output, 'wb') as fp:\n" +" fp.write(msg.as_bytes(policy=SMTP))\n" +" else:\n" +" with smtplib.SMTP('localhost') as s:\n" +" s.send_message(msg)\n" +"\n" +"\n" +"if __name__ == '__main__':\n" +" main()\n" #: ../../library/email.examples.rst:33 msgid "" @@ -249,7 +379,6 @@ msgstr "" "つぎに、上のような MIME メッセージをどうやって展開してひとつのディレクトリ上" "の複数ファイルにするかを示します:" -#: ../../library/email.examples.rst:36 msgid "" "#!/usr/bin/env python3\n" "\n" @@ -306,6 +435,61 @@ msgid "" "if __name__ == '__main__':\n" " main()\n" msgstr "" +"#!/usr/bin/env python3\n" +"\n" +"\"\"\"MIME メッセージをディレクトリ内のファイルに展開します。\"\"\"\n" +"\n" +"import os\n" +"import email\n" +"import mimetypes\n" +"\n" +"from email.policy import default\n" +"\n" +"from argparse import ArgumentParser\n" +"\n" +"\n" +"def main():\n" +" parser = ArgumentParser(description=\"\"\"\\\n" +"Unpack a MIME message into a directory of files.\n" +"\"\"\")\n" +" parser.add_argument('-d', '--directory', required=True,\n" +" help=\"\"\"Unpack the MIME message into the named\n" +" directory, which will be created if it doesn't " +"already\n" +" exist.\"\"\")\n" +" parser.add_argument('msgfile')\n" +" args = parser.parse_args()\n" +"\n" +" with open(args.msgfile, 'rb') as fp:\n" +" msg = email.message_from_binary_file(fp, policy=default)\n" +"\n" +" try:\n" +" os.mkdir(args.directory)\n" +" except FileExistsError:\n" +" pass\n" +"\n" +" counter = 1\n" +" for part in msg.walk():\n" +" # multipart/* は単なるコンテナです\n" +" if part.get_content_maintype() == 'multipart':\n" +" continue\n" +" # メールメッセージによって重要なファイルが上書きされないように、\n" +" # 実際のアプリケーションではファイル名を安全なものにする必要がありま" +"す\n" +" filename = part.get_filename()\n" +" if not filename:\n" +" ext = mimetypes.guess_extension(part.get_content_type())\n" +" if not ext:\n" +" # 汎用のバイナリデータ用拡張子を使います\n" +" ext = '.bin'\n" +" filename = f'part-{counter:03d}{ext}'\n" +" counter += 1\n" +" with open(os.path.join(args.directory, filename), 'wb') as fp:\n" +" fp.write(part.get_payload(decode=True))\n" +"\n" +"\n" +"if __name__ == '__main__':\n" +" main()\n" #: ../../library/email.examples.rst:39 msgid "" @@ -318,7 +502,6 @@ msgstr "" "す。もう少し面白くするために、 HTML 部分に関連する画像を追加し、さらに送信だ" "けでなく、送信しようとしているもののコピーをディスクにも保存してみます。" -#: ../../library/email.examples.rst:44 msgid "" "#!/usr/bin/env python3\n" "\n" @@ -380,6 +563,65 @@ msgid "" "with smtplib.SMTP('localhost') as s:\n" " s.send_message(msg)\n" msgstr "" +"#!/usr/bin/env python3\n" +"\n" +"import smtplib\n" +"\n" +"from email.message import EmailMessage\n" +"from email.headerregistry import Address\n" +"from email.utils import make_msgid\n" +"\n" +"# 基本のテキストメッセージを作成します。\n" +"msg = EmailMessage()\n" +"msg['Subject'] = \"Pourquoi pas des asperges pour ce midi ?\"\n" +"msg['From'] = Address(\"Pepé Le Pew\", \"pepe\", \"example.com\")\n" +"msg['To'] = (Address(\"Penelope Pussycat\", \"penelope\", \"example.com\"),\n" +" Address(\"Fabrette Pussycat\", \"fabrette\", \"example.com\"))\n" +"msg.set_content(\"\"\"\\\n" +"Salut!\n" +"\n" +"Cette recette [1] sera sûrement un très bon repas.\n" +"\n" +"[1] http://www.yummly.com/recipe/Roasted-Asparagus-Epicurious-203718\n" +"\n" +"--Pepé\n" +"\"\"\")\n" +"\n" +"# HTML 版を追加します。\n" +"# メッセージは multipart/alternative コンテナになり、\n" +"# 最初のパートが元のテキストメッセージ、\n" +"# 2 番目のパートが新しい HTML メッセージになります。\n" +"asparagus_cid = make_msgid()\n" +"msg.add_alternative(\"\"\"\\\n" +"\n" +" \n" +" \n" +"

Salut!

\n" +"

Cette\n" +" \n" +" recette\n" +" sera sûrement un très bon repas.\n" +"

\n" +" \n" +" \n" +"\n" +"\"\"\".format(asparagus_cid=asparagus_cid[1:-1]), subtype='html')\n" +"# HTML で使うために msgid から <> を取り除く必要がある点に注意してくださ" +"い。\n" +"\n" +"# HTML パートに関連する画像を追加します。\n" +"with open(\"roasted-asparagus.jpg\", 'rb') as img:\n" +" msg.get_payload()[1].add_related(img.read(), 'image', 'jpeg',\n" +" cid=asparagus_cid)\n" +"\n" +"# 送信する内容のローカルコピーを作成します。\n" +"with open('outgoing.msg', 'wb') as f:\n" +" f.write(bytes(msg))\n" +"\n" +"# ローカル SMTP サーバー経由でメッセージを送信します。\n" +"with smtplib.SMTP('localhost') as s:\n" +" s.send_message(msg)\n" #: ../../library/email.examples.rst:47 msgid "" @@ -389,7 +631,6 @@ msgstr "" "前の例のメッセージが送信されてきたら、これを処理する方法の一つは次のようなも" "のです:" -#: ../../library/email.examples.rst:50 msgid "" "import os\n" "import sys\n" @@ -479,12 +720,95 @@ msgid "" "# Of course, there are lots of email messages that could break this simple\n" "# minded program, but it will handle the most common ones.\n" msgstr "" +"import os\n" +"import sys\n" +"import tempfile\n" +"import mimetypes\n" +"import webbrowser\n" +"\n" +"# 必要な email モジュールをインポートします\n" +"from email import policy\n" +"from email.parser import BytesParser\n" +"\n" +"\n" +"def magic_html_parser(html_text, partfiles):\n" +" \"\"\"安全性に配慮して処理し、partfiles にリンクする HTML を返します。\n" +"\n" +" href=\"cid:....\" 属性を書き換え、partfiles 内のファイル名を指すようにし" +"ます。\n" +" 簡単ではありませんが、html.parser を使えば実現できるはずです。\n" +" \"\"\"\n" +" raise NotImplementedError(\"Add the magic needed\")\n" +"\n" +"\n" +"# 実際のプログラムでは、引数からファイル名を取得します。\n" +"with open('outgoing.msg', 'rb') as fp:\n" +" msg = BytesParser(policy=policy.default).parse(fp)\n" +"\n" +"# これでヘッダーの各項目に辞書としてアクセスでき、\n" +"# 非 ASCII 文字は Unicode に変換されます:\n" +"print('To:', msg['to'])\n" +"print('From:', msg['from'])\n" +"print('Subject:', msg['subject'])\n" +"\n" +"# メッセージ内容のプレビューを表示するには、最も書式の少ないペイロードを\n" +"# 取り出して最初の 3 行を表示できます。\n" +"# もちろん、プレーンテキストのパートが\n" +"# なければ HTML の最初の 3 行を表示してもあまり役に立ちませんが、\n" +"# ここでは考え方を示すための例としています。\n" +"simplest = msg.get_body(preferencelist=('plain', 'html'))\n" +"print()\n" +"print(''.join(simplest.get_content().splitlines(keepends=True)[:3]))\n" +"\n" +"ans = input(\"View full message?\")\n" +"if ans.lower()[0] == 'n':\n" +" sys.exit()\n" +"\n" +"# 表示のために最も情報の豊かな代替パートを取り出せます:\n" +"richest = msg.get_body()\n" +"partfiles = {}\n" +"if richest['content-type'].maintype == 'text':\n" +" if richest['content-type'].subtype == 'plain':\n" +" for line in richest.get_content().splitlines():\n" +" print(line)\n" +" sys.exit()\n" +" elif richest['content-type'].subtype == 'html':\n" +" body = richest\n" +" else:\n" +" print(\"Don't know how to display {}\".format(richest." +"get_content_type()))\n" +" sys.exit()\n" +"elif richest['content-type'].content_type == 'multipart/related':\n" +" body = richest.get_body(preferencelist=('html'))\n" +" for part in richest.iter_attachments():\n" +" fn = part.get_filename()\n" +" if fn:\n" +" extension = os.path.splitext(part.get_filename())[1]\n" +" else:\n" +" extension = mimetypes.guess_extension(part.get_content_type())\n" +" with tempfile.NamedTemporaryFile(suffix=extension, delete=False) as " +"f:\n" +" f.write(part.get_content())\n" +" # ここでも <> を除いて、メール形式の cid を HTML 形式にします。\n" +" partfiles[part['content-id'][1:-1]] = f.name\n" +"else:\n" +" print(\"Don't know how to display {}\".format(richest." +"get_content_type()))\n" +" sys.exit()\n" +"with tempfile.NamedTemporaryFile(mode='w', delete=False) as f:\n" +" f.write(magic_html_parser(body.get_content(), partfiles))\n" +"webbrowser.open(f.name)\n" +"os.remove(f.name)\n" +"for fn in partfiles.values():\n" +" os.remove(fn)\n" +"\n" +"# もちろん、この単純なプログラムでは扱えないメッセージも数多くありますが、\n" +"# よくあるメッセージには対応できます。\n" #: ../../library/email.examples.rst:52 msgid "Up to the prompt, the output from the above is:" msgstr "プロンプトまでの、上記のプログラムの出力はこうなります:" -#: ../../library/email.examples.rst:54 msgid "" "To: Penelope Pussycat , Fabrette Pussycat " "\n" @@ -495,6 +819,14 @@ msgid "" "\n" "Cette recette [1] sera sûrement un très bon repas." msgstr "" +"To: Penelope Pussycat , Fabrette Pussycat " +"\n" +"From: Pepé Le Pew \n" +"Subject: Pourquoi pas des asperges pour ce midi ?\n" +"\n" +"Salut!\n" +"\n" +"Cette recette [1] sera sûrement un très bon repas." #: ../../library/email.examples.rst:66 msgid "Footnotes" diff --git a/library/email.generator.po b/library/email.generator.po index 11732ceef..e1e5cf5fe 100644 --- a/library/email.generator.po +++ b/library/email.generator.po @@ -17,21 +17,19 @@ msgstr "" "Last-Translator: tomo, 2021\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" -#: ../../library/email.generator.rst:2 msgid ":mod:`!email.generator`: Generating MIME documents" -msgstr "" +msgstr ":mod:`!email.generator`: MIME 文書の生成" #: ../../library/email.generator.rst:7 msgid "**Source code:** :source:`Lib/email/generator.py`" msgstr "**ソースコード:** :source:`Lib/email/generator.py`" -#: ../../library/email.generator.rst:11 msgid "" "One of the most common tasks is to generate the flat (serialized) version of " "the email message represented by a message object structure. You will need " @@ -40,8 +38,13 @@ msgid "" "structure and producing a serialized representation is the job of the " "generator classes." msgstr "" +"メッセージオブジェクトの構造で表された電子メールメッセージから、フラットな " +"(直列化された) 表現を生成することは、よく行う処理の一つです。\n" +":meth:`smtplib.SMTP.sendmail` で送信したり、コンソールに表示したりするには、" +"この処理が必要です。\n" +"メッセージオブジェクトの構造を受け取り、直列化された表現を作成するのがジェネ" +"レータークラスの役割です。" -#: ../../library/email.generator.rst:18 msgid "" "As with the :mod:`email.parser` module, you aren't limited to the " "functionality of the bundled generator; you could write one from scratch " @@ -57,8 +60,19 @@ msgid "" "changes to the :class:`~email.message.EmailMessage` object as defaults are " "filled in.)" msgstr "" +":mod:`email.parser` モジュールと同様に、付属のジェネレーターの機能だけを使う" +"必要はなく、自分で一から実装することもできます。\n" +"ただし、付属のジェネレーターはほとんどの電子メールを標準に準拠して生成でき、" +"MIME メッセージも非 MIME メッセージも適切に扱えるはずです。\n" +"また、変換を行わない同じ :mod:`~email.policy` を両方に使えば、バイト列の解析" +"と生成が互いに逆の操作になるよう設計されています。\n" +"つまり、直列化されたバイトストリームを :class:`~email.parser.BytesParser` で" +"解析し、:class:`BytesGenerator` で再生成すると、入力と同じ出力が得られるはず" +"です [#]_。\n" +"(一方、プログラムで構築した :class:`~email.message.EmailMessage` にジェネレー" +"ターを使うと、デフォルト値が補われる際に :class:`~email.message." +"EmailMessage` オブジェクトが変更されることがあります。)" -#: ../../library/email.generator.rst:32 msgid "" "The :class:`Generator` class can be used to flatten a message into a text " "(as opposed to binary) serialized representation, but since Unicode cannot " @@ -67,23 +81,36 @@ msgid "" "Content Transfer Encoding techniques for encoding email messages for " "transport over channels that are not \"8 bit clean\"." msgstr "" +":class:`Generator` クラスを使うと、メッセージをバイナリではなくテキストの直列" +"化表現にフラット化できます。\n" +"ただし、Unicode はバイナリデータを直接表現できないため、メッセージを ASCII 文" +"字だけからなる形式に変換する必要があります。\n" +"そのために、8 ビットデータをそのまま通せない経路で電子メールを送信するため" +"の、標準の電子メール RFC に定められたコンテンツ転送エンコーディングを使いま" +"す。" -#: ../../library/email.generator.rst:39 msgid "" "To accommodate reproducible processing of SMIME-signed messages :class:" "`Generator` disables header folding for message parts of type ``multipart/" "signed`` and all subparts." msgstr "" +"SMIME で署名されたメッセージを再現可能な形で処理できるよう、:class:" +"`Generator` は ``multipart/signed`` 型のパートとそのすべてのサブパートで、" +"ヘッダーの折り返しを無効にします。" -#: ../../library/email.generator.rst:47 msgid "" "Return a :class:`BytesGenerator` object that will write any message provided " "to the :meth:`flatten` method, or any surrogateescape encoded text provided " "to the :meth:`write` method, to the :term:`file-like object` *outfp*. " "*outfp* must support a ``write`` method that accepts binary data." msgstr "" +":meth:`flatten` に渡されたメッセージ、または :meth:`write` に渡された " +"surrogateescape でエンコードされたテキストを、:term:`ファイルライクオブジェク" +"ト ` *outfp* に書き込む :class:`BytesGenerator` オブジェク" +"トを返します。\n" +"*outfp* は、バイナリデータを受け取る ``write()`` メソッドを持つ必要がありま" +"す。" -#: ../../library/email.generator.rst:52 ../../library/email.generator.rst:153 msgid "" "If optional *mangle_from_* is ``True``, put a ``>`` character in front of " "any line in the body that starts with the exact string ``\"From \"``, that " @@ -95,6 +122,15 @@ msgid "" "`WHY THE CONTENT-LENGTH FORMAT IS BAD `_)." msgstr "" +"オプションの *mangle_from_* が ``True`` の場合、本体中で正確に文字列 " +"``\"From \"`` から始まる行、つまり行頭の ``From`` の後に空白がある行の先頭に " +"``>`` を追加します。\n" +"*mangle_from_* のデフォルトは、*policy* の :attr:`~email.policy.Policy." +"mangle_from_` 設定の値です (:data:`~email.policy.compat32` ポリシーでは " +"``True``、それ以外では ``False`` です)。\n" +"*mangle_from_* は、メッセージを Unix mbox 形式で保存する場合を想定しています " +"(:mod:`mailbox` と `WHY THE CONTENT-LENGTH FORMAT IS BAD `_ を参照してください)。" #: ../../library/email.generator.rst:62 ../../library/email.generator.rst:163 msgid "" @@ -104,7 +140,6 @@ msgid "" "lines according to the *policy* settings." msgstr "" -#: ../../library/email.generator.rst:67 ../../library/email.generator.rst:168 msgid "" "If *policy* is specified, use that policy to control message generation. If " "*policy* is ``None`` (the default), use the policy associated with the :" @@ -112,16 +147,22 @@ msgid "" "object passed to ``flatten`` to control the message generation. See :mod:" "`email.policy` for details on what *policy* controls." msgstr "" +"*policy* が指定されていれば、そのポリシーでメッセージの生成を制御します。\n" +"*policy* が ``None`` (デフォルト) であれば、``flatten()`` に渡された :class:" +"`~email.message.Message` または :class:`~email.message.EmailMessage` オブジェ" +"クトに関連付けられたポリシーを使います。\n" +"*policy* が制御する内容については :mod:`email.policy` を参照してください。" #: ../../library/email.generator.rst:75 ../../library/email.generator.rst:174 msgid "Added the *policy* keyword." msgstr "キーワード引数 *policy* が追加されました。" -#: ../../library/email.generator.rst:77 ../../library/email.generator.rst:176 msgid "" "The default behavior of the *mangle_from_* and *maxheaderlen* parameters is " "to follow the policy." msgstr "" +"*mangle_from_* と *maxheaderlen* 引数のデフォルトの動作が、ポリシーに従うよう" +"になりました。" #: ../../library/email.generator.rst:83 msgid "" @@ -133,7 +174,6 @@ msgstr "" "のファイルにはこの :class:`BytesGenerator` インスタンスが作成されたときに指定" "されたものが使われます。" -#: ../../library/email.generator.rst:87 msgid "" "If the :mod:`~email.policy` option :attr:`~email.policy.Policy.cte_type` is " "``8bit`` (the default), copy any headers in the original parsed message that " @@ -148,8 +188,21 @@ msgid "" "bytes in headers using the MIME ``unknown-8bit`` character set, thus " "rendering them RFC-compliant." msgstr "" +":mod:`~email.policy` の :attr:`~email.policy.Policy.cte_type` が ``8bit`` (デ" +"フォルト) の場合、解析した元のメッセージのうち変更されていないヘッダーを出力" +"へコピーします。\n" +"その際、最上位ビットが立っているバイトも元どおりに再現し、非 ASCII の :" +"mailheader:`Content-Transfer-Encoding` を持つ本文パートではそれを保持しま" +"す。\n" +"``cte_type`` が ``7bit`` の場合は、ASCII 互換の :mailheader:`Content-" +"Transfer-Encoding` を使い、最上位ビットが立っているバイトを必要に応じて変換し" +"ます。\n" +"つまり、非 ASCII の :mailheader:`Content-Transfer-Encoding` (:mailheader:" +"`Content-Transfer-Encoding: 8bit`) を持つパートを ASCII 互換の :mailheader:" +"`Content-Transfer-Encoding` に変換し、ヘッダー中の RFC に反する非 ASCII バイ" +"トを MIME の ``unknown-8bit`` 文字セットでエンコードして、RFC に準拠させま" +"す。" -#: ../../library/email.generator.rst:104 ../../library/email.generator.rst:197 msgid "" "If *unixfrom* is ``True``, print the envelope header delimiter used by the " "Unix mailbox format (see :mod:`mailbox`) before the first of the :rfc:`5322` " @@ -157,28 +210,40 @@ msgid "" "header, craft a standard one. The default is ``False``. Note that for " "subparts, no envelope header is ever printed." msgstr "" +"*unixfrom* が ``True`` の場合、最上位のメッセージオブジェクトの最初の :rfc:" +"`5322` ヘッダーより前に、Unix メールボックス形式で使うエンベロープヘッダーの" +"区切りを出力します (:mod:`mailbox` を参照)。\n" +"最上位のオブジェクトにエンベロープヘッダーがなければ、標準的なものを作成しま" +"す。\n" +"デフォルトは ``False`` です。\n" +"サブパートではエンベロープヘッダーは出力されません。" -#: ../../library/email.generator.rst:110 ../../library/email.generator.rst:203 msgid "" "If *linesep* is not ``None``, use it as the separator character between all " "the lines of the flattened message. If *linesep* is ``None`` (the default), " "use the value specified in the *policy*." msgstr "" +"*linesep* が ``None`` でない場合、フラット化されたメッセージのすべての行を区" +"切る文字として使います。\n" +"*linesep* が ``None`` (デフォルト) の場合、*policy* で指定された値を使いま" +"す。" -#: ../../library/email.generator.rst:119 msgid "" "Return an independent clone of this :class:`BytesGenerator` instance with " "the exact same option settings, and *fp* as the new *outfp*." msgstr "" +"この :class:`BytesGenerator` インスタンスとまったく同じオプション設定で、新し" +"い *outfp* を *fp* とした、独立した複製を返します。" -#: ../../library/email.generator.rst:125 msgid "" "Encode *s* using the ``ASCII`` codec and the ``surrogateescape`` error " "handler, and pass it to the *write* method of the *outfp* passed to the :" "class:`BytesGenerator`'s constructor." msgstr "" +"*s* を ``ASCII`` コーデックと ``surrogateescape`` エラーハンドラーでエンコー" +"ドし、:class:`BytesGenerator` のコンストラクタに渡された *outfp* の " +"``write()`` メソッドに渡します。" -#: ../../library/email.generator.rst:130 msgid "" "As a convenience, :class:`~email.message.EmailMessage` provides the methods :" "meth:`~email.message.EmailMessage.as_bytes` and ``bytes(aMessage)`` (a.k.a. :" @@ -186,6 +251,11 @@ msgid "" "of a serialized binary representation of a message object. For more detail, " "see :mod:`email.message`." msgstr "" +":class:`~email.message.EmailMessage` には、メッセージオブジェクトを直列化した" +"バイナリ表現を簡単に生成するための :meth:`~email.message.EmailMessage." +"as_bytes` と ``bytes(aMessage)`` (すなわち :meth:`~email.message." +"EmailMessage.__bytes__`) が用意されています。\n" +"詳しくは :mod:`email.message` を参照してください。" #: ../../library/email.generator.rst:137 msgid "" @@ -198,13 +268,16 @@ msgid "" "using :class:`BytesGenerator`, and not :class:`Generator`." msgstr "" -#: ../../library/email.generator.rst:148 msgid "" "Return a :class:`Generator` object that will write any message provided to " "the :meth:`flatten` method, or any text provided to the :meth:`write` " "method, to the :term:`file-like object` *outfp*. *outfp* must support a " "``write`` method that accepts string data." msgstr "" +":meth:`flatten` に渡されたメッセージ、または :meth:`write` に渡されたテキスト" +"を、:term:`ファイルライクオブジェクト ` *outfp* に書き込" +"む :class:`Generator` オブジェクトを返します。\n" +"*outfp* は、文字列データを受け取る ``write()`` メソッドを持つ必要があります。" #: ../../library/email.generator.rst:182 msgid "" @@ -216,7 +289,6 @@ msgstr "" "のファイルにはこの :class:`Generator` インスタンスが作成されたときに指定され" "たものが使われます。" -#: ../../library/email.generator.rst:186 msgid "" "If the :mod:`~email.policy` option :attr:`~email.policy.Policy.cte_type` is " "``8bit``, generate the message as if the option were set to ``7bit``. (This " @@ -228,6 +300,16 @@ msgid "" "Encoding`, and encode RFC-invalid non-ASCII bytes in headers using the MIME " "``unknown-8bit`` character set, thus rendering them RFC-compliant." msgstr "" +":mod:`~email.policy` の :attr:`~email.policy.Policy.cte_type` が ``8bit`` の" +"場合、``7bit`` に設定されているものとしてメッセージを生成します。\n" +"(文字列では非 ASCII バイトを表せないため、この処理が必要です。)\n" +"最上位ビットが立っているバイトは、ASCII 互換の :mailheader:`Content-Transfer-" +"Encoding` を使って必要に応じて変換します。\n" +"つまり、非 ASCII の :mailheader:`Content-Transfer-Encoding` (:mailheader:" +"`Content-Transfer-Encoding: 8bit`) を持つパートを ASCII 互換の :mailheader:" +"`Content-Transfer-Encoding` に変換し、ヘッダー中の RFC に反する非 ASCII バイ" +"トを MIME の ``unknown-8bit`` 文字セットでエンコードして、RFC に準拠させま" +"す。" #: ../../library/email.generator.rst:209 msgid "" @@ -237,20 +319,23 @@ msgstr "" "``8bit`` メッセージ本体の再エンコードがサポートされました。*linesep* 引数が追" "加されました。" -#: ../../library/email.generator.rst:216 msgid "" "Return an independent clone of this :class:`Generator` instance with the " "exact same options, and *fp* as the new *outfp*." msgstr "" +"この :class:`Generator` インスタンスとまったく同じオプションで、新しい " +"*outfp* を *fp* とした、独立した複製を返します。" -#: ../../library/email.generator.rst:222 msgid "" "Write *s* to the *write* method of the *outfp* passed to the :class:" "`Generator`'s constructor. This provides just enough file-like API for :" "class:`Generator` instances to be used in the :func:`print` function." msgstr "" +":class:`Generator` のコンストラクタに渡された *outfp* の ``write()`` メソッド" +"に *s* を書き込みます。\n" +"これにより、:class:`Generator` インスタンスを :func:`print` 関数で使うために" +"必要な、最小限のファイルライク API を提供します。" -#: ../../library/email.generator.rst:228 msgid "" "As a convenience, :class:`~email.message.EmailMessage` provides the methods :" "meth:`~email.message.EmailMessage.as_string` and ``str(aMessage)`` (a.k.a. :" @@ -258,6 +343,11 @@ msgid "" "of a formatted string representation of a message object. For more detail, " "see :mod:`email.message`." msgstr "" +":class:`~email.message.EmailMessage` には、メッセージオブジェクトの書式化され" +"た文字列表現を簡単に生成するための :meth:`~email.message.EmailMessage." +"as_string` と ``str(aMessage)`` (すなわち :meth:`~email.message.EmailMessage." +"__str__`) が用意されています。\n" +"詳しくは :mod:`email.message` を参照してください。" #: ../../library/email.generator.rst:235 msgid "" @@ -268,7 +358,6 @@ msgid "" "in with information about the part." msgstr "" -#: ../../library/email.generator.rst:244 msgid "" "Act like :class:`Generator`, except that for any subpart of the message " "passed to :meth:`Generator.flatten`, if the subpart is of main type :" @@ -277,12 +366,18 @@ msgid "" "*fmt* using information from the part and print the resulting filled-in " "string." msgstr "" +":class:`Generator` と同様に動作しますが、:meth:`Generator.flatten` に渡された" +"メッセージのサブパートについて、メインタイプが :mimetype:`text` ならデコード" +"したペイロードを出力します。\n" +"メインタイプが :mimetype:`text` でなければ、パートをそのまま出力する代わり" +"に、その情報を文字列 *fmt* に埋め込み、結果の文字列を出力します。" -#: ../../library/email.generator.rst:251 msgid "" "To fill in *fmt*, execute ``fmt % part_info``, where ``part_info`` is a " "dictionary composed of the following keys and values:" msgstr "" +"*fmt* への埋め込みには ``fmt % part_info`` を使います。\n" +"``part_info`` は以下のキーと値からなる辞書です。" #: ../../library/email.generator.rst:254 msgid "``type`` -- Full MIME type of the non-\\ :mimetype:`text` part" @@ -314,14 +409,13 @@ msgid "" msgstr "" "``encoding`` -- 非 :mimetype:`text` 型 subpart の Content-transfer-encoding" -#: ../../library/email.generator.rst:266 msgid "If *fmt* is ``None``, use the following default *fmt*:" -msgstr "" +msgstr "*fmt* が ``None`` の場合、次のデフォルトの *fmt* を使います。" -#: ../../library/email.generator.rst:268 msgid "" "\"[Non-text (%(type)s) part of message omitted, filename %(filename)s]\"" msgstr "" +"\"[Non-text (%(type)s) part of message omitted, filename %(filename)s]\"" #: ../../library/email.generator.rst:270 msgid "" @@ -333,7 +427,6 @@ msgstr "" msgid "Footnotes" msgstr "脚注" -#: ../../library/email.generator.rst:276 msgid "" "This statement assumes that you use the appropriate setting for " "``unixfrom``, and that there are no :mod:`email.policy` settings calling for " @@ -344,3 +437,10 @@ msgid "" "parsing error recovery. It is a goal to fix these latter edge cases when " "possible." msgstr "" +"この説明は、``unixfrom`` が適切に設定され、:mod:`email.policy` に自動調整を要" +"求する設定がないことを前提としています (例えば :attr:`~email.policy." +"EmailPolicy.refold_source` は ``none`` でなければなりませんが、これはデフォル" +"トでは *ありません*)。\n" +"また、メッセージが RFC に準拠していないと、解析エラーからの回復中に元のテキス" +"トの正確な情報が失われることがあるため、常に成り立つわけでもありません。\n" +"このような例外的な場合は、可能な限り修正していくことを目指しています。" diff --git a/library/email.header.po b/library/email.header.po index bad09dd56..7cde58104 100644 --- a/library/email.header.po +++ b/library/email.header.po @@ -17,10 +17,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/email.header.rst:2 @@ -100,7 +100,6 @@ msgstr "" "文字列ではなく、 :class:`Header` インスタンスを使うのです。 :class:`Header` " "クラスは :mod:`email.header` モジュールからインポートしてください。たとえば::" -#: ../../library/email.header.rst:40 msgid "" ">>> from email.message import Message\n" ">>> from email.header import Header\n" @@ -110,6 +109,13 @@ msgid "" ">>> msg.as_string()\n" "'Subject: =?iso-8859-1?q?p=F6stal?=\\n\\n'" msgstr "" +">>> from email.message import Message\n" +">>> from email.header import Header\n" +">>> msg = Message()\n" +">>> h = Header('p\\xf6stal', 'iso-8859-1')\n" +">>> msg['Subject'] = h\n" +">>> msg.as_string()\n" +"'Subject: =?iso-8859-1?q?p=F6stal?=\\n\\n'" #: ../../library/email.header.rst:50 msgid "" @@ -167,7 +173,6 @@ msgstr "" "場合 (デフォルト)、初期値の *s* および以後の :meth:`append` 呼び出しにおける" "文字集合として ``us-ascii`` が使われます。" -#: ../../library/email.header.rst:77 msgid "" "The maximum line length can be specified explicitly via *maxlinelen*. For " "splitting the first line to a shorter value (to account for the field header " @@ -176,12 +181,12 @@ msgid "" "value for *header_name* is ``None``, meaning it is not taken into account " "for the first line of a long, split header." msgstr "" -"行の最大長は *maxlinelen* によって明示的に指定できます。最初の行を (:" -"mailheader:`Subject` などの *s* に含まれないフィールドヘッダの責任をとるた" -"め) 短く切りとる場合、 *header_name* にそのフィールド名を指定してください。 " -"*maxlinelen* のデフォルト値は 78 であり、 *header_name* のデフォルト値は " -"``None`` です。これはその最初の行を長い、切りとられたヘッダとして扱わないこと" -"を意味します。" +"行の最大長は *maxlinelen* で明示的に指定できます。\n" +":mailheader:`Subject` など、*s* に含まれないフィールド名の長さを考慮して最初" +"の行を短くするには、*header_name* にフィールド名を渡してください。\n" +"*maxlinelen* のデフォルトは 78 です。\n" +"*header_name* のデフォルトは ``None`` で、この場合は長いヘッダーを折り返す" +"際、最初の行でフィールド名の長さを考慮しません。" #: ../../library/email.header.rst:84 msgid "" @@ -247,8 +252,8 @@ msgid "" msgstr "" "いずれの場合でも、 :rfc:`2822` 準拠のヘッダを :rfc:`2047` の規則を用いて生成" "する際、文字列は指定された文字セットの出力コーデックを用いてエンコードされま" -"す。出力コーデックを用いて文字列がエンコードできないときは :exc:" -"`UnicodeError` が発生します。" +"す。出力コーデックを用いて文字列がエンコードできないときは ``UnicodeError`` " +"が発生します。" #: ../../library/email.header.rst:115 msgid "" @@ -268,7 +273,6 @@ msgstr "" "返され、非 ASCII 部分は base64 または quoted-printable エンコーディングで包含" "されるでしょう。" -#: ../../library/email.header.rst:125 msgid "" "Optional *splitchars* is a string containing characters which should be " "given extra weight by the splitting algorithm during normal header " @@ -280,14 +284,16 @@ msgid "" "point when other split chars do not appear in the line being split. " "Splitchars does not affect :RFC:`2047` encoded lines." msgstr "" -"オプション引数 *splitchars* は、通常のヘッダーの折り返し処理の間に分割アルゴ" -"リズムによって特別な重みが与えられるべき文字を含む文字列です。これは、 :RFC:" -"`2822` の 'higher level syntactic breaks' の非常に荒いサポートです: " -"splitchar の後の分割点は、行分割において優先されます。 分割文字は文字列中での" -"出現順に優先されます。スペースとタブは、分割しようとする行に他の分割文字が出" -"現しない時に、分割点として他の文字と比べてどのような優先順位が与えられるべき" -"かを示すために、文字列に含めることができます。 Splitchars は :RFC:`2047` エン" -"コードされた行には影響しません。" +"省略可能な *splitchars* は、通常のヘッダーの折り返しで分割位置を決める際に優" +"先する文字を含む文字列です。\n" +"これは :RFC:`2822` の「上位の構文上の区切り」を大まかにサポートするもので" +"す。\n" +"指定された文字の直後を分割位置として優先し、その優先順位は文字列内での並び順" +"に従います。\n" +"スペースとタブもこの文字列に含められます。\n" +"これにより、分割する行に他の分割文字がない場合、スペースとタブのどちらを分割" +"位置として優先するかを指定できます。\n" +"``splitchars`` は :RFC:`2047` でエンコードされた行には影響しません。" #: ../../library/email.header.rst:135 msgid "" @@ -296,7 +302,6 @@ msgid "" msgstr "" "与えられた場合、*maxlinelen* はインスタンスの最大行長の値を上書きします。" -#: ../../library/email.header.rst:138 msgid "" "*linesep* specifies the characters used to separate the lines of the folded " "header. It defaults to the most useful value for Python application code " @@ -305,7 +310,7 @@ msgid "" msgstr "" "*linesep* は、折り返しヘッダの行を区切る文字を指定します。デフォルトでは" "Pythonアプリケーションコードに最も有用な値(``\\n``)になりますが、RFC準拠の行" -"区切り文字でヘッダを生成するために``\\r\\n``を指定することができます。" +"区切り文字でヘッダを生成するために ``\\r\\n`` を指定することができます。" #: ../../library/email.header.rst:143 msgid "Added the *linesep* argument." @@ -409,12 +414,12 @@ msgstr "" "charset)`` という形式の 2要素タプルからなるリストを返します。ここで " "*decoded_string* はデコードされた文字列、 *charset* はその文字集合です。" -#: ../../library/email.header.rst:202 msgid "" "This function takes one of those sequence of pairs and returns a :class:" "`Header` instance. Optional *maxlinelen*, *header_name*, and " "*continuation_ws* are as in the :class:`Header` constructor." msgstr "" -"この関数はこれらのリストの項目から、 :class:`Header` インスタンスを返します。" -"オプション引数 *maxlinelen* 、 *header_name* および *continuation_ws* は :" -"class:`Header` コンストラクタに与えるものと同じです。" +"この関数は、そのようなペアのシーケンスを受け取り、:class:`Header` インスタン" +"スを返します。\n" +"省略可能な *maxlinelen*、*header_name*、*continuation_ws* は :class:`Header` " +"コンストラクタと同じです。" diff --git a/library/email.headerregistry.po b/library/email.headerregistry.po index e72426007..27e752bc8 100644 --- a/library/email.headerregistry.po +++ b/library/email.headerregistry.po @@ -19,15 +19,14 @@ msgstr "" "Last-Translator: Arihiro TAKASE, 2023\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" -#: ../../library/email.headerregistry.rst:2 msgid ":mod:`!email.headerregistry`: Custom Header Objects" -msgstr "" +msgstr ":mod:`!email.headerregistry`: カスタムヘッダーオブジェクト" #: ../../library/email.headerregistry.rst:10 msgid "**Source code:** :source:`Lib/email/headerregistry.py`" @@ -181,9 +180,8 @@ msgstr "" "``parse`` という名前の :func:`classmethod` を特殊化されたクラスが提供すること" "を要求しています。このメソッドは以下のように呼び出されます::" -#: ../../library/email.headerregistry.rst:94 msgid "parse(string, kwds)" -msgstr "" +msgstr "parse(string, kwds)" #: ../../library/email.headerregistry.rst:96 msgid "" @@ -206,7 +204,6 @@ msgstr "" "が、エンコードされていないヘッダ値をパースできるように、すべての有効なUnicode" "文字も正しく処理する必要があります。" -#: ../../library/email.headerregistry.rst:105 msgid "" "``BaseHeader``'s ``__new__`` then creates the header instance, and calls its " "``init`` method. The specialized class only needs to provide an ``init`` " @@ -214,26 +211,28 @@ msgid "" "``BaseHeader`` itself. Such an ``init`` method should look like this::" msgstr "" "その後、 ``BaseHeader`` の ``__new__`` がヘッダのインスタンスを生成し、 " -"``init`` メソッドを呼び出します。 特殊クラスは、 ``BaseHeader`` が提供しない" -"属性を設定したい場合にのみ ``init`` メソッドを提供する必要があります。 このよ" -"うな``init`` メソッドは以下のようなものです:" +"``init`` メソッドを呼び出します。\n" +"特殊クラスは、 ``BaseHeader`` が提供しない属性を設定したい場合にのみ " +"``init`` メソッドを提供する必要があります。\n" +"このような ``init`` メソッドは以下のようなものです。 ::" -#: ../../library/email.headerregistry.rst:110 msgid "" "def init(self, /, *args, **kw):\n" " self._myattr = kw.pop('myattr')\n" " super().init(*args, **kw)" msgstr "" +"def init(self, /, *args, **kw):\n" +" self._myattr = kw.pop('myattr')\n" +" super().init(*args, **kw)" -#: ../../library/email.headerregistry.rst:114 msgid "" "That is, anything extra that the specialized class puts in to the ``kwds`` " "dictionary should be removed and handled, and the remaining contents of " "``kw`` (and ``args``) passed to the ``BaseHeader`` ``init`` method." msgstr "" "つまり、特殊クラスが ``kwds`` の辞書に追加したものはすべて削除して処理し、 " -"``kw``の残りの内容 (と ``args``) は``BaseHeader`` の``init`` メソッドに渡す必" -"要があるのです。" +"``kw`` の残りの内容 (と ``args``) は ``BaseHeader`` の ``init`` メソッドに渡" +"す必要があるのです。" #: ../../library/email.headerregistry.rst:121 msgid "" @@ -272,24 +271,22 @@ msgstr "" msgid "This header type provides no additional attributes." msgstr "このヘッダ型には追加の属性はありません。" -#: ../../library/email.headerregistry.rst:141 msgid "" ":rfc:`5322` specifies a very specific format for dates within email headers. " "The ``DateHeader`` parser recognizes that date format, as well as " "recognizing a number of variant forms that are sometimes found \"in the " "wild\"." msgstr "" -":rfc:`5322` specifies a very specific format for dates within email headers. " -"The ``DateHeader`` parser recognizes that date format, as well as " -"recognizing a number of variant forms that are sometimes found \"in the " -"wild\"." +":rfc:`5322` は、電子メールヘッダー内の日付について厳密な形式を定めていま" +"す。\n" +"``DateHeader`` のパーサーはその形式に加え、実際のメールで見かけるさまざまな変" +"形も認識します。" #: ../../library/email.headerregistry.rst:146 #: ../../library/email.headerregistry.rst:188 msgid "This header type provides the following additional attributes:" msgstr "このヘッダ型は以下の属性も提供しています:" -#: ../../library/email.headerregistry.rst:150 msgid "" "If the header value can be recognized as a valid date of one form or " "another, this attribute will contain a :class:`~datetime.datetime` instance " @@ -300,18 +297,25 @@ msgid "" "then :attr:`.datetime` will contain an aware ``datetime`` that uses :class:" "`datetime.timezone` to record the timezone offset." msgstr "" +"ヘッダー値を何らかの有効な日付形式として認識できた場合、この属性にはその日時" +"を表す :class:`~datetime.datetime` インスタンスが入ります。\n" +"入力のタイムゾーンが ``-0000`` (UTC だが送信元のタイムゾーン情報はないことを" +"示します) の場合、:attr:`.datetime` は naive な :class:`~datetime.datetime` " +"になります。\n" +"``+0000`` を含む特定のタイムゾーンオフセットが見つかった場合、:attr:`." +"datetime` は :class:`datetime.timezone` でオフセットを記録した aware な " +"``datetime`` になります。" -#: ../../library/email.headerregistry.rst:160 msgid "" "The ``decoded`` value of the header is determined by formatting the " "``datetime`` according to the :rfc:`5322` rules; that is, it is set to::" msgstr "" -"ヘッダーの ``decoded`` 値は、 ``datetime`` を :rfc:`5322` のルールに従って" -"フォーマットすることで決定されます。" +"ヘッダーの ``decoded`` 値は、``datetime`` を :rfc:`5322` の規則に従って書式化" +"したものです。\n" +"つまり、次のように設定されます。 ::" -#: ../../library/email.headerregistry.rst:163 msgid "email.utils.format_datetime(self.datetime)" -msgstr "" +msgstr "email.utils.format_datetime(self.datetime)" #: ../../library/email.headerregistry.rst:165 msgid "" @@ -323,25 +327,22 @@ msgstr "" "タンスである可能性があります。 これは、例えば、次のようなコードは有効であり、" "期待通りの動作をすることを意味します::" -#: ../../library/email.headerregistry.rst:169 msgid "msg['Date'] = datetime(2011, 7, 15, 21)" -msgstr "" +msgstr "msg['Date'] = datetime(2011, 7, 15, 21)" -#: ../../library/email.headerregistry.rst:171 msgid "" "Because this is a naive ``datetime`` it will be interpreted as a UTC " "timestamp, and the resulting value will have a timezone of ``-0000``. Much " "more useful is to use the :func:`~email.utils.localtime` function from the :" "mod:`~email.utils` module::" msgstr "" -"これは単純な ``datetime`` であるため、UTC タイムスタンプとして解釈され、結果" -"として ``-0000`` というタイムゾーンを持つ値になります。 もっと便利なのは :" -"mod:`~email.utils` モジュールの :func:`~email.utils.localtime` 関数を使用する" -"ことです::" +"これはnaive な ``datetime`` であるため、UTC タイムスタンプとして解釈され、結" +"果として ``-0000`` というタイムゾーンを持つ値になります。\n" +"もっと便利なのは :mod:`~email.utils` モジュールの :func:`~email.utils." +"localtime` 関数を使用することです。 ::" -#: ../../library/email.headerregistry.rst:176 msgid "msg['Date'] = utils.localtime()" -msgstr "" +msgstr "msg['Date'] = utils.localtime()" #: ../../library/email.headerregistry.rst:178 msgid "" @@ -393,7 +394,6 @@ msgid "" "'``." msgstr "" -#: ../../library/email.headerregistry.rst:213 msgid "" "A list of :class:`.Address` and :class:`.Group` objects in any combination " "may be used to set the value of an address header. ``Group`` objects whose " @@ -401,28 +401,38 @@ msgid "" "allows an address list to be copied with groups intact by using the list " "obtained from the ``groups`` attribute of the source header." msgstr "" +"アドレスヘッダーの値の設定には、:class:`.Address` と :class:`.Group` オブジェ" +"クトを自由に組み合わせたリストを使えます。\n" +"``display_name`` が ``None`` の ``Group`` オブジェクトは単独のアドレスとして" +"解釈されます。\n" +"このため、元のヘッダーの ``groups`` 属性から得たリストを使えば、グループを保" +"持したままアドレス一覧をコピーできます。" #: ../../library/email.headerregistry.rst:222 msgid "" "A subclass of :class:`.AddressHeader` that adds one additional attribute:" msgstr "追加の属性を 1 つ持つ、:class:`.AddressHeader` の派生クラスです:" -#: ../../library/email.headerregistry.rst:228 msgid "" "The single address encoded by the header value. If the header value " "actually contains more than one address (which would be a violation of the " "RFC under the default :mod:`~email.policy`), accessing this attribute will " "result in a :exc:`ValueError`." msgstr "" +"ヘッダー値で表された単一のアドレスです。\n" +"ヘッダー値に複数のアドレスが含まれる場合 (デフォルトの :mod:`~email.policy` " +"では RFC 違反です)、この属性にアクセスすると :exc:`ValueError` が発生します。" -#: ../../library/email.headerregistry.rst:234 msgid "" "Many of the above classes also have a ``Unique`` variant (for example, " "``UniqueUnstructuredHeader``). The only difference is that in the " "``Unique`` variant, :attr:`~.BaseHeader.max_count` is set to 1." msgstr "" +"上記のクラスの多くには、``Unique`` 版もあります (例えば " +"``UniqueUnstructuredHeader``)。\n" +"違いは、``Unique`` 版では :attr:`~.BaseHeader.max_count` が 1 に設定されるこ" +"とだけです。" -#: ../../library/email.headerregistry.rst:241 msgid "" "There is really only one valid value for the :mailheader:`MIME-Version` " "header, and that is ``1.0``. For future proofing, this header class " @@ -430,6 +440,10 @@ msgid "" "per :rfc:`2045`, then the header object will have non-``None`` values for " "the following attributes:" msgstr "" +":mailheader:`MIME-Version` ヘッダーの有効な値は実際には ``1.0`` だけです。\n" +"将来に備え、このヘッダークラスは他の有効なバージョン番号もサポートします。\n" +"バージョン番号が :rfc:`2045` に照らして有効であれば、ヘッダーオブジェクトの以" +"下の属性は ``None`` 以外の値になります。" #: ../../library/email.headerregistry.rst:249 msgid "" @@ -444,17 +458,19 @@ msgstr "メジャーバージョン番号 (整数)" msgid "The minor version number as an integer" msgstr "マイナーバージョン番号 (整数)" -#: ../../library/email.headerregistry.rst:263 msgid "" "MIME headers all start with the prefix 'Content-'. Each specific header has " "a certain value, described under the class for that header. Some can also " "take a list of supplemental parameters, which have a common format. This " "class serves as a base for all the MIME headers that take parameters." msgstr "" +"MIME ヘッダーはすべて接頭辞 ``Content-`` で始まります。\n" +"各ヘッダーにはそれぞれの値があり、対応するクラスの説明に記載されています。\n" +"また、共通形式の補助パラメータの一覧を持てるものもあります。\n" +"このクラスは、パラメータを持つすべての MIME ヘッダーの基底クラスです。" -#: ../../library/email.headerregistry.rst:270 msgid "A dictionary mapping parameter names to parameter values." -msgstr "" +msgstr "パラメータ名をパラメータ値に対応付ける辞書です。" #: ../../library/email.headerregistry.rst:275 msgid "" @@ -464,9 +480,8 @@ msgstr "" ":mailheader:`Content-Type` ヘッダを扱う :class:`ParameterizedMIMEHeader` クラ" "スです。" -#: ../../library/email.headerregistry.rst:280 msgid "The content type string, in the form ``maintype/subtype``." -msgstr "" +msgstr "``maintype/subtype`` 形式のコンテントタイプ文字列。" #: ../../library/email.headerregistry.rst:289 msgid "" @@ -476,9 +491,8 @@ msgstr "" ":mailheader:`Content-Disposition` ヘッダを扱う :class:" "`ParameterizedMIMEHeader` クラスです。" -#: ../../library/email.headerregistry.rst:294 msgid "``inline`` and ``attachment`` are the only valid values in common use." -msgstr "" +msgstr "一般的に使われる有効な値は ``inline`` と ``attachment`` だけです。" #: ../../library/email.headerregistry.rst:299 msgid "Handles the :mailheader:`Content-Transfer-Encoding` header." @@ -492,7 +506,6 @@ msgstr "" "有効な値は ``7bit``、``8bit``、``base64``、``quoted-printable`` です。詳細に" "ついては :rfc:`2045` を参照してください。" -#: ../../library/email.headerregistry.rst:312 msgid "" "This is the factory used by :class:`~email.policy.EmailPolicy` by default. " "``HeaderRegistry`` builds the class used to create a header instance " @@ -504,6 +517,16 @@ msgid "" "initialization. *base_class* is always the last class in the generated " "class's :class:`~type.__bases__` list." msgstr "" +"これは :class:`~email.policy.EmailPolicy` がデフォルトで使うファクトリで" +"す。\n" +"``HeaderRegistry`` は、*base_class* と自身のレジストリから取得した専用クラス" +"を使って、ヘッダーインスタンスを作成するためのクラスを動的に構築します。\n" +"ヘッダー名がレジストリにない場合、*default_class* で指定されたクラスを専用ク" +"ラスとして使います。\n" +"*use_default_map* が ``True`` (デフォルト) の場合、初期化時にヘッダー名からク" +"ラスへの標準の対応付けをレジストリにコピーします。\n" +"*base_class* は常に、生成されたクラスの :class:`~type.__bases__` 一覧の最後の" +"クラスになります。" #: ../../library/email.headerregistry.rst:322 msgid "The default mappings are:" @@ -546,9 +569,8 @@ msgstr "sender" msgid "UniqueSingleAddressHeader" msgstr "UniqueSingleAddressHeader" -#: ../../library/email.headerregistry.rst:0 msgid "resent-sender" -msgstr "" +msgstr "resent-sender" #: ../../library/email.headerregistry.rst:329 msgid "SingleAddressHeader" @@ -585,13 +607,11 @@ msgstr "cc" msgid "resent-cc" msgstr "resent-cc" -#: ../../library/email.headerregistry.rst:0 msgid "bcc" -msgstr "" +msgstr "bcc" -#: ../../library/email.headerregistry.rst:0 msgid "resent-bcc" -msgstr "" +msgstr "resent-bcc" #: ../../library/email.headerregistry.rst:0 msgid "from" @@ -605,63 +625,54 @@ msgstr "resent-from" msgid "reply-to" msgstr "reply-to" -#: ../../library/email.headerregistry.rst:0 msgid "mime-version" -msgstr "" +msgstr "mime-version" -#: ../../library/email.headerregistry.rst:339 msgid "MIMEVersionHeader" -msgstr "" +msgstr "MIMEVersionHeader" -#: ../../library/email.headerregistry.rst:0 msgid "content-type" -msgstr "" +msgstr "content-type" -#: ../../library/email.headerregistry.rst:340 msgid "ContentTypeHeader" -msgstr "" +msgstr "ContentTypeHeader" -#: ../../library/email.headerregistry.rst:0 msgid "content-disposition" -msgstr "" +msgstr "content-disposition" -#: ../../library/email.headerregistry.rst:341 msgid "ContentDispositionHeader" -msgstr "" +msgstr "ContentDispositionHeader" -#: ../../library/email.headerregistry.rst:0 msgid "content-transfer-encoding" -msgstr "" +msgstr "content-transfer-encoding" -#: ../../library/email.headerregistry.rst:342 msgid "ContentTransferEncodingHeader" -msgstr "" +msgstr "ContentTransferEncodingHeader" -#: ../../library/email.headerregistry.rst:0 msgid "message-id" -msgstr "" +msgstr "message-id" -#: ../../library/email.headerregistry.rst:343 msgid "MessageIDHeader" -msgstr "" +msgstr "MessageIDHeader" #: ../../library/email.headerregistry.rst:345 msgid "``HeaderRegistry`` has the following methods:" msgstr "``HeaderRegistry`` には以下のメソッドがあります:" -#: ../../library/email.headerregistry.rst:350 msgid "" "*name* is the name of the header to be mapped. It will be converted to " "lower case in the registry. *cls* is the specialized class to be used, " "along with *base_class*, to create the class used to instantiate headers " "that match *name*." msgstr "" +"*name* は対応付けるヘッダーの名前です。\n" +"レジストリ内では小文字に変換されます。\n" +"*cls* は専用クラスで、*base_class* と組み合わせて、*name* に一致するヘッダー" +"をインスタンス化するクラスの作成に使われます。" -#: ../../library/email.headerregistry.rst:358 msgid "Construct and return a class to handle creating a *name* header." -msgstr "" +msgstr "*name* ヘッダーの作成を担当するクラスを構築して返します。" -#: ../../library/email.headerregistry.rst:363 msgid "" "Retrieves the specialized header associated with *name* from the registry " "(using *default_class* if *name* does not appear in the registry) and " @@ -669,13 +680,19 @@ msgid "" "class's constructor, passing it the same argument list, and finally returns " "the class instance created thereby." msgstr "" +"*name* に関連付けられた専用ヘッダークラスをレジストリから取得します (*name* " +"がレジストリになければ *default_class* を使います)。\n" +"それを *base_class* と組み合わせてクラスを作成し、同じ引数リストを渡してその" +"コンストラクタを呼び出し、生成されたインスタンスを返します。" -#: ../../library/email.headerregistry.rst:370 msgid "" "The following classes are the classes used to represent data parsed from " "structured headers and can, in general, be used by an application program to " "construct structured values to assign to specific headers." msgstr "" +"以下のクラスは、構造化ヘッダーから解析したデータの表現に使われます。\n" +"通常、アプリケーションからも、特定のヘッダーに代入する構造化された値の作成に" +"使えます。" #: ../../library/email.headerregistry.rst:377 msgid "" @@ -685,23 +702,20 @@ msgstr "" "このクラスは電子メールのアドレスを表すのに使われます。アドレスの一般的な形式" "は::" -#: ../../library/email.headerregistry.rst:380 msgid "[display_name] " -msgstr "" +msgstr "[display_name] " #: ../../library/email.headerregistry.rst:382 msgid "or::" msgstr "もしくは::" -#: ../../library/email.headerregistry.rst:384 msgid "username@domain" -msgstr "" +msgstr "username@domain" -#: ../../library/email.headerregistry.rst:386 msgid "" "where each part must conform to specific syntax rules spelled out in :rfc:" "`5322`." -msgstr "" +msgstr "各部分は :rfc:`5322` で定められた構文規則に従う必要があります。" #: ../../library/email.headerregistry.rst:389 msgid "" @@ -713,12 +727,13 @@ msgid "" "*not* allowed in the username portion of the address." msgstr "" -#: ../../library/email.headerregistry.rst:398 msgid "" "The display name portion of the address, if any, with all quoting removed. " "If the address does not have a display name, this attribute will be an empty " "string." msgstr "" +"アドレスの表示名部分で、引用符はすべて取り除かれます。\n" +"アドレスに表示名がなければ、空文字列になります。" #: ../../library/email.headerregistry.rst:404 msgid "The ``username`` portion of the address, with all quoting removed." @@ -728,25 +743,31 @@ msgstr "アドレスの ``username`` 部分、クォートは取り除かれま msgid "The ``domain`` portion of the address." msgstr "アドレスの ``domain`` 部分。" -#: ../../library/email.headerregistry.rst:412 msgid "" "The ``username@domain`` portion of the address, correctly quoted for use as " "a bare address (the second form shown above). This attribute is not mutable." msgstr "" +"アドレスの ``username@domain`` 部分で、表示名のないアドレス (上記の 2 番目の" +"形式) として使えるよう正しく引用符が付けられます。\n" +"この属性は変更できません。" -#: ../../library/email.headerregistry.rst:418 msgid "" "The ``str`` value of the object is the address quoted according to :rfc:" "`5322` rules, but with no Content Transfer Encoding of any non-ASCII " "characters." msgstr "" +"オブジェクトの ``str`` 値は、:rfc:`5322` の規則に従って引用符を付けたアドレス" +"ですが、非 ASCII 文字にコンテンツ転送エンコーディングは適用されません。" -#: ../../library/email.headerregistry.rst:422 msgid "" "To support SMTP (:rfc:`5321`), ``Address`` handles one special case: if " "``username`` and ``domain`` are both the empty string (or ``None``), then " "the string value of the ``Address`` is ``<>``." msgstr "" +"SMTP (:rfc:`5321`) をサポートするため、``Address`` は一つの特殊な場合を扱いま" +"す。\n" +"``username`` と ``domain`` が両方とも空文字列 (または ``None``) の場合、" +"``Address`` の文字列値は ``<>`` になります。" #: ../../library/email.headerregistry.rst:429 msgid "" @@ -756,32 +777,36 @@ msgstr "" "このクラスはアドレスグループを表すのに使われます。アドレスグループの一般的な" "形式は::" -#: ../../library/email.headerregistry.rst:432 msgid "display_name: [address-list];" -msgstr "" +msgstr "display_name: [address-list];" -#: ../../library/email.headerregistry.rst:434 msgid "" "As a convenience for processing lists of addresses that consist of a mixture " "of groups and single addresses, a ``Group`` may also be used to represent " "single addresses that are not part of a group by setting *display_name* to " "``None`` and providing a list of the single address as *addresses*." msgstr "" +"グループと単独のアドレスが混在する一覧を扱いやすくするため、``Group`` でグ" +"ループに属さない単独のアドレスを表すこともできます。\n" +"その場合、*display_name* を ``None`` にし、*addresses* にそのアドレスだけを含" +"むリストを渡します。" -#: ../../library/email.headerregistry.rst:441 msgid "" "The ``display_name`` of the group. If it is ``None`` and there is exactly " "one ``Address`` in ``addresses``, then the ``Group`` represents a single " "address that is not in a group." msgstr "" +"グループの ``display_name`` です。\n" +"値が ``None`` で、``addresses`` に ``Address`` がちょうど一つある場合、その " +"``Group`` はグループに属さない単独のアドレスを表します。" -#: ../../library/email.headerregistry.rst:447 msgid "" "A possibly empty tuple of :class:`.Address` objects representing the " "addresses in the group." msgstr "" +"グループ内のアドレスを表す :class:`.Address` オブジェクトのタプルです。\n" +"空の場合もあります。" -#: ../../library/email.headerregistry.rst:452 msgid "" "The ``str`` value of a ``Group`` is formatted according to :rfc:`5322`, but " "with no Content Transfer Encoding of any non-ASCII characters. If " @@ -789,12 +814,17 @@ msgid "" "``addresses`` list, the ``str`` value will be the same as the ``str`` of " "that single ``Address``." msgstr "" +"``Group`` の ``str`` 値は :rfc:`5322` に従って書式化されますが、非 ASCII 文字" +"にコンテンツ転送エンコーディングは適用されません。\n" +"``display_name`` が ``None`` で、``addresses`` リストに ``Address`` が一つだ" +"けある場合、``str`` 値はその ``Address`` の ``str`` 値と同じになります。" #: ../../library/email.headerregistry.rst:460 msgid "Footnotes" msgstr "脚注" -#: ../../library/email.headerregistry.rst:461 msgid "" "Originally added in 3.3 as a :term:`provisional module `" msgstr "" +"当初は 3.3 で :term:`暫定モジュール ` として追加されまし" +"た。" diff --git a/library/email.iterators.po b/library/email.iterators.po index 9db56e72c..e24f59cb1 100644 --- a/library/email.iterators.po +++ b/library/email.iterators.po @@ -17,10 +17,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/email.iterators.rst:2 @@ -109,7 +109,6 @@ msgstr "" "そのメッセージオブジェクト構造の content-type をインデントつきで表示します。" "例えば:" -#: ../../library/email.iterators.rst:57 msgid "" ">>> msg = email.message_from_file(somefile)\n" ">>> _structure(msg)\n" @@ -129,6 +128,23 @@ msgid "" " text/plain\n" " text/plain" msgstr "" +">>> msg = email.message_from_file(somefile)\n" +">>> _structure(msg)\n" +"multipart/mixed\n" +" text/plain\n" +" text/plain\n" +" multipart/digest\n" +" message/rfc822\n" +" text/plain\n" +" message/rfc822\n" +" text/plain\n" +" message/rfc822\n" +" text/plain\n" +" message/rfc822\n" +" text/plain\n" +" message/rfc822\n" +" text/plain\n" +" text/plain" #: ../../library/email.iterators.rst:81 msgid "" diff --git a/library/email.message.po b/library/email.message.po index 785d896c6..17ca7f556 100644 --- a/library/email.message.po +++ b/library/email.message.po @@ -18,15 +18,14 @@ msgstr "" "Last-Translator: Tetsuo Koyama , 2021\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" -#: ../../library/email.message.rst:2 msgid ":mod:`!email.message`: Representing an email message" -msgstr "" +msgstr ":mod:`!email.message`: 電子メールメッセージの表現" #: ../../library/email.message.rst:10 msgid "**Source code:** :source:`Lib/email/message.py`" @@ -45,7 +44,6 @@ msgid "" "bodies, and for creating or modifying structured messages." msgstr "" -#: ../../library/email.message.rst:22 msgid "" "An email message consists of *headers* and a *payload* (which is also " "referred to as the *content*). Headers are :rfc:`5322` or :rfc:`6532` style " @@ -57,8 +55,17 @@ msgid "" "having a MIME type such as :mimetype:`multipart/\\*` or :mimetype:`message/" "rfc822`." msgstr "" +"電子メールメッセージは *ヘッダー* と *ペイロード* (*コンテンツ* とも呼ばれま" +"す) からなります。\n" +"ヘッダーは :rfc:`5322` または :rfc:`6532` 形式のフィールド名と値で、両者はコ" +"ロンで区切られます。\n" +"コロンはフィールド名にも値にも含まれません。\n" +"ペイロードには、単純なテキストメッセージ、バイナリオブジェクト、または各々が" +"独自のヘッダーとペイロードを持つサブメッセージを構造化して並べたものを使えま" +"す。\n" +"最後の形式のペイロードは、メッセージの MIME 型が :mimetype:`multipart/\\*` " +"や :mimetype:`message/rfc822` などの場合に使われます。" -#: ../../library/email.message.rst:31 msgid "" "The conceptual model provided by an :class:`EmailMessage` object is that of " "an ordered dictionary of headers coupled with a *payload* that represents " @@ -69,8 +76,14 @@ msgid "" "type), for operating on the payload, for generating a serialized version of " "the message, and for recursively walking over the object tree." msgstr "" +":class:`EmailMessage` オブジェクトは概念的には、ヘッダーの順序付き辞書と、:" +"rfc:`5322` のメッセージ本体を表す *ペイロード* を組み合わせたものです。\n" +"ペイロードはサブメッセージの ``EmailMessage`` オブジェクトのリストになること" +"もあります。\n" +"ヘッダーの名前と値にアクセスする通常の辞書メソッドに加え、MIME コンテントタイ" +"プなどのヘッダーの特定の情報へのアクセス、ペイロードの操作、メッセージの直列" +"化、オブジェクトツリーの再帰的な巡回のためのメソッドがあります。" -#: ../../library/email.message.rst:40 msgid "" "The :class:`EmailMessage` dictionary-like interface is indexed by the header " "names, which must be ASCII values. The values of the dictionary are strings " @@ -79,14 +92,24 @@ msgid "" "but unlike a real dict, there can be duplicates. Additional methods are " "provided for working with headers that have duplicate keys." msgstr "" +":class:`EmailMessage` の辞書に似たインターフェースは、ASCII 値でなければなら" +"ないヘッダー名をキーとします。\n" +"辞書の値は、追加のメソッドを持つ文字列です。\n" +"ヘッダーの格納時と取得時には大文字・小文字が保持されますが、フィールド名の照" +"合では区別されません。\n" +"キーには順序がありますが、通常の辞書と異なり重複できます。\n" +"キーが重複するヘッダーを扱うための追加のメソッドも用意されています。" -#: ../../library/email.message.rst:47 msgid "" "The *payload* is either a string or bytes object, in the case of simple " "message objects, or a list of :class:`EmailMessage` objects, for MIME " "container documents such as :mimetype:`multipart/\\*` and :mimetype:`message/" "rfc822` message objects." msgstr "" +"*ペイロード* は、単純なメッセージオブジェクトでは文字列または bytes オブジェ" +"クトです。\n" +":mimetype:`multipart/\\*` や :mimetype:`message/rfc822` などの MIME コンテナ" +"文書では、:class:`EmailMessage` オブジェクトのリストです。" #: ../../library/email.message.rst:55 msgid "" @@ -98,7 +121,6 @@ msgid "" "`~email.policy` documentation." msgstr "" -#: ../../library/email.message.rst:64 msgid "" "Return the entire message flattened as a string. When optional *unixfrom* " "is true, the envelope header is included in the returned string. *unixfrom* " @@ -111,6 +133,18 @@ msgid "" "produced by the method, since the specified *policy* will be passed to the :" "class:`~email.generator.Generator`." msgstr "" +"メッセージ全体をフラット化した文字列を返します。\n" +"オプションの *unixfrom* が真の場合、戻り値にはエンベロープヘッダーが含まれま" +"す。\n" +"*unixfrom* のデフォルトは ``False`` です。\n" +"基底クラス :class:`~email.message.Message` との後方互換性のため " +"*maxheaderlen* を受け取りますが、デフォルトは ``None`` です。\n" +"したがって、デフォルトではポリシーの :attr:`~email.policy.Policy." +"max_line_length` が行長を制御します。\n" +"*policy* 引数で、メッセージインスタンスから取得するデフォルトのポリシーを上書" +"きできます。\n" +"指定した *policy* は :class:`~email.generator.Generator` に渡されるため、メ" +"ソッドが生成する書式の一部を制御できます。" #: ../../library/email.message.rst:76 ../../library/email.message.rst:114 msgid "" @@ -122,7 +156,6 @@ msgstr "" "メッセージのフラット化は :class:`EmailMessage` の変更を引き起こす可能性があり" "ます (例えば、MIME の境界が生成される、変更される等)。" -#: ../../library/email.message.rst:80 msgid "" "Note that this method is provided as a convenience and may not be the most " "useful way to serialize messages in your application, especially if you are " @@ -131,29 +164,39 @@ msgid "" "restricted to producing messages serialized as \"7 bit clean\" when :attr:" "`~email.policy.EmailPolicy.utf8` is ``False``, which is the default." msgstr "" +"このメソッドは便利な補助機能として提供されており、特に複数のメッセージを扱う" +"場合には、アプリケーションに最適な直列化方法とは限りません。\n" +"より柔軟な直列化 API については :class:`email.generator.Generator` を参照して" +"ください。\n" +"また、:attr:`~email.policy.EmailPolicy.utf8` が ``False`` (デフォルト) の場" +"合、このメソッドが生成できるのは 7 ビットだけを使う形式に直列化されたメッセー" +"ジに限られます。" -#: ../../library/email.message.rst:88 msgid "" "the default behavior when *maxheaderlen* is not specified was changed from " "defaulting to 0 to defaulting to the value of *max_line_length* from the " "policy." msgstr "" +"*maxheaderlen* を指定しない場合のデフォルトの動作が、値 0 を使う動作から、ポ" +"リシーの *max_line_length* の値を使う動作に変わりました。" -#: ../../library/email.message.rst:95 msgid "" "Equivalent to ``as_string(policy=self.policy.clone(utf8=True))``. Allows " "``str(msg)`` to produce a string containing the serialized message in a " "readable format." msgstr "" +"``as_string(policy=self.policy.clone(utf8=True))`` と同じです。\n" +"``str(msg)`` で、読みやすい形式に直列化されたメッセージを含む文字列を生成でき" +"るようにします。" -#: ../../library/email.message.rst:99 msgid "" "the method was changed to use ``utf8=True``, thus producing an :rfc:`6531`-" "like message representation, instead of being a direct alias for :meth:" "`as_string`." msgstr "" +":meth:`as_string` の単なる別名ではなく、``utf8=True`` を使って :rfc:`6531` に" +"似たメッセージ表現を生成するように変わりました。" -#: ../../library/email.message.rst:106 msgid "" "Return the entire message flattened as a bytes object. When optional " "*unixfrom* is true, the envelope header is included in the returned string. " @@ -163,22 +206,34 @@ msgid "" "specified *policy* will be passed to the :class:`~email.generator." "BytesGenerator`." msgstr "" +"メッセージ全体をフラット化した bytes オブジェクトを返します。\n" +"オプションの *unixfrom* が真の場合、戻り値にはエンベロープヘッダーが含まれま" +"す。\n" +"*unixfrom* のデフォルトは ``False`` です。\n" +"*policy* 引数で、メッセージインスタンスから取得するデフォルトのポリシーを上書" +"きできます。\n" +"指定した *policy* は :class:`~email.generator.BytesGenerator` に渡されるた" +"め、メソッドが生成する書式の一部を制御できます。" -#: ../../library/email.message.rst:118 msgid "" "Note that this method is provided as a convenience and may not be the most " "useful way to serialize messages in your application, especially if you are " "dealing with multiple messages. See :class:`email.generator.BytesGenerator` " "for a more flexible API for serializing messages." msgstr "" +"このメソッドは便利な補助機能として提供されており、特に複数のメッセージを扱う" +"場合には、アプリケーションに最適な直列化方法とは限りません。\n" +"より柔軟な直列化 API については :class:`email.generator.BytesGenerator` を参" +"照してください。" -#: ../../library/email.message.rst:127 msgid "" "Equivalent to :meth:`.as_bytes`. Allows ``bytes(msg)`` to produce a bytes " "object containing the serialized message." msgstr "" +":meth:`.as_bytes` と同じです。\n" +"``bytes(msg)`` で、直列化されたメッセージを含む bytes オブジェクトを生成でき" +"るようにします。" -#: ../../library/email.message.rst:133 msgid "" "Return ``True`` if the message's payload is a list of sub-\\ :class:" "`EmailMessage` objects, otherwise return ``False``. When :meth:" @@ -189,12 +244,23 @@ msgid "" "example, ``is_multipart`` will return ``True`` when the :class:" "`EmailMessage` is of type ``message/rfc822``." msgstr "" +"メッセージのペイロードがサブメッセージの :class:`EmailMessage` オブジェクトの" +"リストなら ``True`` を、それ以外なら ``False`` を返します。\n" +":meth:`is_multipart` が ``False`` を返す場合、ペイロードは文字列オブジェクト" +"のはずです (CTE でエンコードされたバイナリのペイロードの場合もあります)。\n" +":meth:`is_multipart` が ``True`` を返しても、``msg.get_content_maintype() == " +"'multipart'`` が ``True`` を返すとは限りません。\n" +"例えば、:class:`EmailMessage` の型が ``message/rfc822`` の場合も " +"``is_multipart()`` は ``True`` を返します。" -#: ../../library/email.message.rst:145 msgid "" "Set the message's envelope header to *unixfrom*, which should be a string. " "(See :class:`~mailbox.mboxMessage` for a brief description of this header.)" msgstr "" +"メッセージのエンベロープヘッダーを *unixfrom* に設定します。\n" +"*unixfrom* は文字列でなければなりません。\n" +"(このヘッダーの簡単な説明は :class:`~mailbox.mboxMessage` を参照してくださ" +"い。)" #: ../../library/email.message.rst:152 msgid "" @@ -218,11 +284,12 @@ msgid "" "list." msgstr "" -#: ../../library/email.message.rst:167 msgid "" "These semantic differences are intentional and are biased toward convenience " "in the most common use cases." msgstr "" +"このような意味の違いは意図的なもので、一般的な用途で便利になるように設計され" +"ています。" #: ../../library/email.message.rst:170 msgid "" @@ -236,39 +303,50 @@ msgstr "" msgid "Return the total number of headers, including duplicates." msgstr "複製されたものもふくめてヘッダ数の合計を返します。" -#: ../../library/email.message.rst:181 msgid "" "Return ``True`` if the message object has a field named *name*. Matching is " "done without regard to case and *name* does not include the trailing colon. " "Used for the ``in`` operator. For example::" msgstr "" +"メッセージオブジェクトに *name* という名前のフィールドがあれば ``True`` を返" +"します。\n" +"照合では大文字・小文字を区別せず、*name* に末尾のコロンは含めません。\n" +"``in`` 演算子で使われます。\n" +"例えば次のようにします。 ::" -#: ../../library/email.message.rst:185 msgid "" "if 'message-id' in myMessage:\n" " print('Message-ID:', myMessage['message-id'])" msgstr "" +"if 'message-id' in myMessage:\n" +" print('Message-ID:', myMessage['message-id'])" -#: ../../library/email.message.rst:191 msgid "" "Return the value of the named header field. *name* does not include the " "colon field separator. If the header is missing, ``None`` is returned; a :" "exc:`KeyError` is never raised." msgstr "" +"指定した名前のヘッダーフィールドの値を返します。\n" +"*name* にフィールド区切りのコロンは含めません。\n" +"ヘッダーがなければ ``None`` を返し、:exc:`KeyError` は送出しません。" -#: ../../library/email.message.rst:195 msgid "" "Note that if the named field appears more than once in the message's " "headers, exactly which of those field values will be returned is undefined. " "Use the :meth:`get_all` method to get the values of all the extant headers " "named *name*." msgstr "" +"指定した名前のフィールドがメッセージのヘッダーに複数ある場合、どの値を返すか" +"は未定義です。\n" +"*name* という名前の既存のヘッダーの値をすべて取得するには、:meth:`get_all` を" +"使ってください。" -#: ../../library/email.message.rst:200 msgid "" "Using the standard (non-``compat32``) policies, the returned value is an " "instance of a subclass of :class:`email.headerregistry.BaseHeader`." msgstr "" +"標準の (``compat32`` 以外の) ポリシーでは、戻り値は :class:`email." +"headerregistry.BaseHeader` のサブクラスのインスタンスです。" #: ../../library/email.message.rst:206 msgid "" @@ -289,13 +367,13 @@ msgstr "" "せん*。もしメッセージが名前 *name* をもつフィールドをひとつしか持たないように" "したければ、最初にそれを除去してください。たとえば::" -#: ../../library/email.message.rst:213 msgid "" "del msg['subject']\n" "msg['subject'] = 'Python roolz!'" msgstr "" +"del msg['subject']\n" +"msg['subject'] = 'Python roolz!'" -#: ../../library/email.message.rst:216 msgid "" "If the :mod:`policy ` defines certain headers to be unique (as " "the standard policies do), this method may raise a :exc:`ValueError` when an " @@ -304,6 +382,12 @@ msgid "" "as we may choose to make such assignments do an automatic deletion of the " "existing header in the future." msgstr "" +"標準のポリシーのように、:mod:`ポリシー ` が特定のヘッダーを一つ" +"しか許さないと定めている場合、そのヘッダーがすでにある状態で値を代入しようと" +"すると、このメソッドは :exc:`ValueError` を送出することがあります。\n" +"一貫性を保つための意図的な動作ですが、将来はこのような代入で既存のヘッダーを" +"自動的に削除するよう変更する可能性があるため、この動作に依存しないでくださ" +"い。" #: ../../library/email.message.rst:226 msgid "" @@ -330,16 +414,17 @@ msgstr "" "メッセージ中にあるすべてのヘッダのフィールド名とその値を 2-タプルのリストとし" "て返します。" -#: ../../library/email.message.rst:249 msgid "" "Return the value of the named header field. This is identical to :meth:" "`~object.__getitem__` except that optional *failobj* is returned if the " "named header is missing (*failobj* defaults to ``None``)." msgstr "" +"指定した名前のヘッダーフィールドの値を返します。\n" +":meth:`~object.__getitem__` と同じですが、ヘッダーがない場合にオプションの " +"*failobj* (デフォルトは ``None``) を返す点が異なります。" -#: ../../library/email.message.rst:254 msgid "Here are some additional useful header related methods:" -msgstr "" +msgstr "ヘッダーに関する便利な追加のメソッドを以下に示します。" #: ../../library/email.message.rst:259 msgid "" @@ -351,18 +436,18 @@ msgstr "" "前のヘッダがメッセージ中に含まれていない場合は *failobj* (デフォルトでは " "``None``) が返されます。" -#: ../../library/email.message.rst:266 msgid "" "Extended header setting. This method is similar to :meth:`__setitem__` " "except that additional header parameters can be provided as keyword " "arguments. *_name* is the header field to add and *_value* is the *primary* " "value for the header." msgstr "" -"拡張ヘッダ設定。このメソッドは :meth:`__setitem__` と似ていますが、追加のヘッ" -"ダ・パラメータをキーワード引数で指定できるところが違っています。 *_name* に追" -"加するヘッダフィールドを、 *_value* にそのヘッダの *最初の* 値を渡します。" +"拡張ヘッダ設定。\n" +"このメソッドは :meth:`__setitem__` と似ていますが、追加のヘッダ・パラメータを" +"キーワード引数で指定できるところが違っています。\n" +"*_name* に追加するヘッダフィールドを、 *_value* にそのヘッダの *主たる* 値を" +"渡します。" -#: ../../library/email.message.rst:271 msgid "" "For each item in the keyword argument dictionary *_params*, the key is taken " "as the parameter name, with underscores converted to dashes (since dashes " @@ -370,8 +455,12 @@ msgid "" "as ``key=\"value\"`` unless the value is ``None``, in which case only the " "key will be added." msgstr "" +"キーワード引数の辞書 *_params* の各項目では、キーをパラメータ名として使い、ア" +"ンダースコアをハイフンに変換します (Python の識別子ではハイフンを使えないため" +"です)。\n" +"通常は ``key=\"value\"`` の形式でパラメータを追加しますが、値が ``None`` の場" +"合はキーだけを追加します。" -#: ../../library/email.message.rst:277 msgid "" "If the value contains non-ASCII characters, the charset and language may be " "explicitly controlled by specifying the value as a three tuple in the format " @@ -383,41 +472,51 @@ msgid "" "automatically encoded in :rfc:`2231` format using a ``CHARSET`` of ``utf-8`` " "and a ``LANGUAGE`` of ``None``." msgstr "" +"値に非 ASCII 文字が含まれる場合、``(CHARSET, LANGUAGE, VALUE)`` 形式の 3 要素" +"タプルを指定することで、文字セットと言語を明示的に制御できます。\n" +"``CHARSET`` は値のエンコードに使う文字セットの名前です。\n" +"``LANGUAGE`` は通常 ``None`` または空文字列にできます (他の指定については :" +"rfc:`2231` を参照してください)。\n" +"``VALUE`` は非 ASCII コードポイントを含む文字列値です。\n" +"3 要素タプルを渡さず、値に非 ASCII 文字が含まれている場合は、``CHARSET`` を " +"``utf-8``、``LANGUAGE`` を ``None`` として :rfc:`2231` 形式で自動的にエンコー" +"ドされます。" #: ../../library/email.message.rst:287 msgid "Here is an example::" msgstr "以下に例を示します。::" -#: ../../library/email.message.rst:289 msgid "msg.add_header('Content-Disposition', 'attachment', filename='bud.gif')" msgstr "" +"msg.add_header('Content-Disposition', 'attachment', filename='bud.gif')" #: ../../library/email.message.rst:291 msgid "This will add a header that looks like ::" msgstr "こうするとヘッダには以下のように追加されます ::" -#: ../../library/email.message.rst:293 msgid "Content-Disposition: attachment; filename=\"bud.gif\"" -msgstr "" +msgstr "Content-Disposition: attachment; filename=\"bud.gif\"" -#: ../../library/email.message.rst:295 msgid "An example of the extended interface with non-ASCII characters::" -msgstr "" +msgstr "拡張インターフェースで非 ASCII 文字を使う例です。 ::" -#: ../../library/email.message.rst:297 msgid "" "msg.add_header('Content-Disposition', 'attachment',\n" " filename=('iso-8859-1', '', 'Fußballer.ppt'))" msgstr "" +"msg.add_header('Content-Disposition', 'attachment',\n" +" filename=('iso-8859-1', '', 'Fußballer.ppt'))" -#: ../../library/email.message.rst:303 msgid "" "Replace a header. Replace the first header found in the message that " "matches *_name*, retaining header order and field name case of the original " "header. If no matching header is found, raise a :exc:`KeyError`." msgstr "" +"ヘッダーを置き換えます。\n" +"*_name* に一致する最初のヘッダーを、元のヘッダーの順序とフィールド名の大文" +"字・小文字を保ったまま置き換えます。\n" +"一致するヘッダーがなければ :exc:`KeyError` を送出します。" -#: ../../library/email.message.rst:311 msgid "" "Return the message's content type, coerced to lower case of the form :" "mimetype:`maintype/subtype`. If there is no :mailheader:`Content-Type` " @@ -425,8 +524,12 @@ msgid "" "`get_default_type`. If the :mailheader:`Content-Type` header is invalid, " "return ``text/plain``." msgstr "" +"メッセージのコンテントタイプを、小文字の :mimetype:`maintype/subtype` 形式で" +"返します。\n" +"メッセージに :mailheader:`Content-Type` ヘッダーがない場合は、:meth:" +"`get_default_type` の戻り値を返します。\n" +":mailheader:`Content-Type` ヘッダーが不正な場合は ``text/plain`` を返します。" -#: ../../library/email.message.rst:317 msgid "" "(According to :rfc:`2045`, messages always have a default type, :meth:" "`get_content_type` will always return a value. :rfc:`2045` defines a " @@ -436,6 +539,13 @@ msgid "" "invalid type specification, :rfc:`2045` mandates that the default type be :" "mimetype:`text/plain`.)" msgstr "" +"(:rfc:`2045` によると、メッセージは常にデフォルトの型を持つため、:meth:" +"`get_content_type` は常に値を返します。\n" +":rfc:`2045` はデフォルトの型を :mimetype:`text/plain` と定めていますが、:" +"mimetype:`multipart/digest` コンテナ内では :mimetype:`message/rfc822` と定め" +"ています。\n" +":mailheader:`Content-Type` ヘッダーの型指定が不正な場合、:rfc:`2045` はデフォ" +"ルトの型を :mimetype:`text/plain` とするよう要求しています。)" #: ../../library/email.message.rst:328 msgid "" @@ -466,7 +576,6 @@ msgstr "" "`multipart/digest` コンテナに含まれているときだけ例外的に :mimetype:`message/" "rfc822` になります。" -#: ../../library/email.message.rst:348 msgid "" "Set the default content type. *ctype* should either be :mimetype:`text/" "plain` or :mimetype:`message/rfc822`, although this is not enforced. The " @@ -474,8 +583,13 @@ msgid "" "so it only affects the return value of the ``get_content_type`` methods when " "no :mailheader:`Content-Type` header is present in the message." msgstr "" +"デフォルトのコンテントタイプを設定します。\n" +"強制はされませんが、*ctype* は :mimetype:`text/plain` または :mimetype:" +"`message/rfc822` にしてください。\n" +"デフォルトのコンテントタイプは :mailheader:`Content-Type` ヘッダーには格納さ" +"れないため、メッセージに :mailheader:`Content-Type` ヘッダーがない場合の " +"``get_content_type()`` の戻り値にだけ影響します。" -#: ../../library/email.message.rst:359 msgid "" "Set a parameter in the :mailheader:`Content-Type` header. If the parameter " "already exists in the header, replace its value with *value*. When *header* " @@ -484,6 +598,13 @@ msgid "" "parameter value. Optional *header* specifies an alternative header to :" "mailheader:`Content-Type`." msgstr "" +":mailheader:`Content-Type` ヘッダーにパラメータを設定します。\n" +"パラメータがすでにあれば、その値を *value* に置き換えます。\n" +"*header* が ``Content-Type`` (デフォルト) で、そのヘッダーがメッセージにまだ" +"ない場合、値を :mimetype:`text/plain` としてヘッダーを追加し、新しいパラメー" +"タ値を付け加えます。\n" +"オプションの *header* は、:mailheader:`Content-Type` の代わりに使うヘッダーを" +"指定します。" #: ../../library/email.message.rst:366 msgid "" @@ -495,25 +616,29 @@ msgid "" "*language*." msgstr "" -#: ../../library/email.message.rst:373 msgid "" "If *replace* is ``False`` (the default) the header is moved to the end of " "the list of headers. If *replace* is ``True``, the header will be updated " "in place." msgstr "" +"*replace* が ``False`` (デフォルト) の場合、ヘッダーはヘッダー一覧の末尾に移" +"動します。\n" +"*replace* が ``True`` の場合は、元の位置で更新されます。" -#: ../../library/email.message.rst:377 ../../library/email.message.rst:394 msgid "" "Use of the *requote* parameter with :class:`EmailMessage` objects is " "deprecated." msgstr "" +":class:`EmailMessage` オブジェクトでの *requote* 引数の使用は非推奨です。" -#: ../../library/email.message.rst:380 msgid "" "Note that existing parameter values of headers may be accessed through the :" "attr:`~email.headerregistry.ParameterizedMIMEHeader.params` attribute of the " "header value (for example, ``msg['Content-Type'].params['charset']``)." msgstr "" +"ヘッダーの既存のパラメータ値には、ヘッダー値の :attr:`~email.headerregistry." +"ParameterizedMIMEHeader.params` 属性からアクセスできます (例えば " +"``msg['Content-Type'].params['charset']``)。" #: ../../library/email.message.rst:384 msgid "``replace`` keyword was added." @@ -570,24 +695,27 @@ msgstr "" "quote します。そのメッセージが :mailheader:`Content-Type` ヘッダを含んでいな" "い場合、 :exc:`~email.errors.HeaderParseError` が発生します。" -#: ../../library/email.message.rst:424 msgid "" "Note that using this method is subtly different from deleting the old :" "mailheader:`Content-Type` header and adding a new one with the new boundary " "via :meth:`add_header`, because :meth:`set_boundary` preserves the order of " "the :mailheader:`Content-Type` header in the list of headers." msgstr "" +":meth:`set_boundary` は、ヘッダー一覧内の :mailheader:`Content-Type` ヘッダー" +"の順序を保持します。\n" +"そのため、古い :mailheader:`Content-Type` ヘッダーを削除し、:meth:" +"`add_header` で新しい境界を持つヘッダーを追加する方法とは少し異なります。" -#: ../../library/email.message.rst:433 msgid "" "Return the ``charset`` parameter of the :mailheader:`Content-Type` header, " "coerced to lower case. If there is no :mailheader:`Content-Type` header, or " "if that header has no ``charset`` parameter, *failobj* is returned." msgstr "" "そのメッセージ中の :mailheader:`Content-Type` ヘッダにある、 ``charset`` パラ" -"メータの値を返します。値はすべて小文字に変換されます。メッセージ中に :" -"mailheader:`Content-Type` がなかったり、このヘッダ中に ``charaset`` パラメー" -"タがない場合には *failobj* が返されます。" +"メータの値を返します。\n" +"値はすべて小文字に変換されます。\n" +"メッセージ中に :mailheader:`Content-Type` がなかったり、このヘッダ中に " +"``charset`` パラメータがない場合には *failobj* が返されます。" #: ../../library/email.message.rst:440 msgid "" @@ -631,19 +759,23 @@ msgstr "" ":meth:`~email.message.Message.is_multipart` との一貫性のために、" "is_attachment が属性からメソッドになりました。" -#: ../../library/email.message.rst:463 msgid "" "Return the lowercased value (without parameters) of the message's :" "mailheader:`Content-Disposition` header if it has one, or ``None``. The " "possible values for this method are *inline*, *attachment* or ``None`` if " "the message follows :rfc:`2183`." msgstr "" +"メッセージに :mailheader:`Content-Disposition` ヘッダーがあれば、パラメータを" +"除いた値を小文字で返し、なければ ``None`` を返します。\n" +"メッセージが :rfc:`2183` に準拠していれば、戻り値は *inline*、*attachment*、" +"``None`` のいずれかです。" -#: ../../library/email.message.rst:471 msgid "" "The following methods relate to interrogating and manipulating the content " "(payload) of the message." msgstr "" +"以下のメソッドは、メッセージのコンテンツ (ペイロード) の情報取得と操作に関す" +"るものです。" #: ../../library/email.message.rst:477 msgid "" @@ -666,7 +798,6 @@ msgstr "" "以下の例は、 multipart メッセージのすべての part において、その MIME タイプを" "表示していくものです。 :" -#: ../../library/email.message.rst:491 msgid "" ">>> for part in msg.walk():\n" "... print(part.get_content_type())\n" @@ -678,16 +809,29 @@ msgid "" "message/rfc822\n" "text/plain" msgstr "" +">>> for part in msg.walk():\n" +"... print(part.get_content_type())\n" +"multipart/report\n" +"text/plain\n" +"message/delivery-status\n" +"text/plain\n" +"text/plain\n" +"message/rfc822\n" +"text/plain" -#: ../../library/email.message.rst:503 msgid "" "``walk`` iterates over the subparts of any part where :meth:`is_multipart` " "returns ``True``, even though ``msg.get_content_maintype() == 'multipart'`` " "may return ``False``. We can see this in our example by making use of the " "``_structure`` debug helper function:" msgstr "" +"``walk()`` は、:meth:`is_multipart` が ``True`` を返すパートのサブパートを反" +"復処理します。\n" +"``msg.get_content_maintype() == 'multipart'`` が ``False`` を返す場合も同様で" +"す。\n" +"デバッグ用の補助関数 ``_structure()`` を使うと、この例でその様子を確認できま" +"す。" -#: ../../library/email.message.rst:509 msgid "" ">>> from email.iterators import _structure\n" ">>> for part in msg.walk():\n" @@ -709,13 +853,35 @@ msgid "" " message/rfc822\n" " text/plain" msgstr "" +">>> from email.iterators import _structure\n" +">>> for part in msg.walk():\n" +"... print(part.get_content_maintype() == 'multipart',\n" +"... part.is_multipart())\n" +"True True\n" +"False False\n" +"False True\n" +"False False\n" +"False False\n" +"False True\n" +"False False\n" +">>> _structure(msg)\n" +"multipart/report\n" +" text/plain\n" +" message/delivery-status\n" +" text/plain\n" +" text/plain\n" +" message/rfc822\n" +" text/plain" -#: ../../library/email.message.rst:531 msgid "" "Here the ``message`` parts are not ``multiparts``, but they do contain " "subparts. ``is_multipart()`` returns ``True`` and ``walk`` descends into the " "subparts." msgstr "" +"ここでは ``message`` パートは ``multipart`` ではありませんが、サブパートを含" +"んでいます。\n" +"``is_multipart()`` は ``True`` を返し、``walk()`` はサブパートの中へ進みま" +"す。" #: ../../library/email.message.rst:538 msgid "" @@ -723,47 +889,56 @@ msgid "" "message." msgstr "メッセージの \"本体\" の最有力候補となる MIME 部を返します。" -#: ../../library/email.message.rst:541 msgid "" "*preferencelist* must be a sequence of strings from the set ``related``, " "``html``, and ``plain``, and indicates the order of preference for the " "content type of the part returned." msgstr "" +"*preferencelist* は ``related``、``html``、``plain`` の中から選んだ文字列の" +"シーケンスでなければならず、返されるパートのコンテントタイプの優先順位を示し" +"ます。" -#: ../../library/email.message.rst:545 msgid "" "Start looking for candidate matches with the object on which the " "``get_body`` method is called." msgstr "" +"``get_body()`` を呼び出したオブジェクトから、一致する候補の検索を始めます。" -#: ../../library/email.message.rst:548 msgid "" "If ``related`` is not included in *preferencelist*, consider the root part " "(or subpart of the root part) of any related encountered as a candidate if " "the (sub-)part matches a preference." msgstr "" +"*preferencelist* に ``related`` が含まれていない場合、見つかった related パー" +"トのルートパート (またはそのサブパート) が優先候補のいずれかに一致すれば、候" +"補として扱います。" -#: ../../library/email.message.rst:552 msgid "" "When encountering a ``multipart/related``, check the ``start`` parameter and " "if a part with a matching :mailheader:`Content-ID` is found, consider only " "it when looking for candidate matches. Otherwise consider only the first " "(default root) part of the ``multipart/related``." msgstr "" +"``multipart/related`` を見つけると ``start`` パラメータを調べ、:mailheader:" +"`Content-ID` が一致するパートがあれば、それだけを一致候補の検索対象としま" +"す。\n" +"なければ、``multipart/related`` の最初のパート (デフォルトのルート) だけを対" +"象とします。" -#: ../../library/email.message.rst:557 msgid "" "If a part has a :mailheader:`Content-Disposition` header, only consider the " "part a candidate match if the value of the header is ``inline``." msgstr "" +"パートに :mailheader:`Content-Disposition` ヘッダーがある場合、その値が " +"``inline`` のときだけ一致候補とします。" -#: ../../library/email.message.rst:560 msgid "" "If none of the candidates matches any of the preferences in " "*preferencelist*, return ``None``." msgstr "" +"どの候補も *preferencelist* のいずれの優先候補にも一致しなければ、``None`` を" +"返します。" -#: ../../library/email.message.rst:563 msgid "" "Notes: (1) For most applications the only *preferencelist* combinations that " "really make sense are ``('plain',)``, ``('html', 'plain')``, and the default " @@ -775,8 +950,17 @@ msgid "" "invalid will be treated as if they are of type ``text/plain``, which may " "occasionally cause ``get_body`` to return unexpected results." msgstr "" +"注意: (1) ほとんどのアプリケーションで意味のある *preferencelist* の組み合わ" +"せは、``('plain',)``、``('html', 'plain')``、デフォルトの ``('related', " +"'html', 'plain')`` だけです。\n" +"(2) 一致の検索は ``get_body()`` を呼び出したオブジェクトから始まるため、" +"``multipart/related`` に対する ``get_body()`` は、*preferencelist* がデフォル" +"ト以外の値でない限り、そのオブジェクト自身を返します。\n" +"(3) :mailheader:`Content-Type` が指定されていないメッセージ (またはパート) " +"や、:mailheader:`Content-Type` ヘッダーが不正なものは、``text/plain`` とみな" +"されます。\n" +"そのため、``get_body()`` が予想外の結果を返すことがあります。" -#: ../../library/email.message.rst:577 msgid "" "Return an iterator over all of the immediate sub-parts of the message that " "are not candidate \"body\" parts. That is, skip the first occurrence of " @@ -790,15 +974,28 @@ msgid "" "ID` of any of the parts). When applied directly to a ``multipart/" "alternative`` or a non-``multipart``, return an empty iterator." msgstr "" +"メッセージの直下のサブパートのうち、「本体」の候補でないものすべてを反復処理" +"するイテレーターを返します。\n" +"つまり、``text/plain``、``text/html``、``multipart/related``、``multipart/" +"alternative`` のそれぞれ最初のパートを除き、残りのパートをすべて返します。\n" +"ただし、:mailheader:`Content-Disposition: attachment` で明示的に添付ファイル" +"とされているパートは除きません。\n" +"``multipart/related`` に直接適用した場合、ルートパート以外の関連パートすべて" +"を反復処理するイテレーターを返します。\n" +"ルートパートは ``start`` パラメータが指すパートで、``start`` がない場合や、ど" +"のパートの :mailheader:`Content-ID` にも一致しない場合は最初のパートです。\n" +"``multipart/alternative`` または ``multipart`` 以外に直接適用すると、空のイテ" +"レーターを返します。" -#: ../../library/email.message.rst:593 msgid "" "Return an iterator over all of the immediate sub-parts of the message, which " "will be empty for a non-``multipart``. (See also :meth:`~email.message." "EmailMessage.walk`.)" msgstr "" +"メッセージの直下のサブパートすべてを反復処理するイテレーターを返します。\n" +"``multipart`` でなければ空になります。\n" +"(:meth:`~email.message.EmailMessage.walk` も参照してください。)" -#: ../../library/email.message.rst:600 msgid "" "Call the :meth:`~email.contentmanager.ContentManager.get_content` method of " "the *content_manager*, passing self as the message object, and passing along " @@ -806,8 +1003,13 @@ msgid "" "*content_manager* is not specified, use the ``content_manager`` specified by " "the current :mod:`~email.policy`." msgstr "" +"*content_manager* の :meth:`~email.contentmanager.ContentManager." +"get_content` を呼び出します。\n" +"メッセージオブジェクトとして ``self`` を渡し、他の引数やキーワード引数も追加" +"の引数としてそのまま渡します。\n" +"*content_manager* が指定されていなければ、現在の :mod:`~email.policy` で指定" +"された ``content_manager`` を使います。" -#: ../../library/email.message.rst:609 msgid "" "Call the :meth:`~email.contentmanager.ContentManager.set_content` method of " "the *content_manager*, passing self as the message object, and passing along " @@ -815,8 +1017,13 @@ msgid "" "*content_manager* is not specified, use the ``content_manager`` specified by " "the current :mod:`~email.policy`." msgstr "" +"*content_manager* の :meth:`~email.contentmanager.ContentManager." +"set_content` を呼び出します。\n" +"メッセージオブジェクトとして ``self`` を渡し、他の引数やキーワード引数も追加" +"の引数としてそのまま渡します。\n" +"*content_manager* が指定されていなければ、現在の :mod:`~email.policy` で指定" +"された ``content_manager`` を使います。" -#: ../../library/email.message.rst:618 msgid "" "Convert a non-``multipart`` message into a ``multipart/related`` message, " "moving any existing :mailheader:`Content-` headers and payload into a (new) " @@ -825,8 +1032,13 @@ msgid "" "automatically created when it is needed (for example, when the message is " "serialized)." msgstr "" +"``multipart`` でないメッセージを ``multipart/related`` に変換し、既存の :" +"mailheader:`Content-` ヘッダーとペイロードを、``multipart`` の新しい最初の" +"パートに移します。\n" +"*boundary* が指定されていれば、マルチパートの境界文字列として使います。\n" +"指定されていなければ、直列化時など、必要になったときに自動的に生成されるよう" +"にします。" -#: ../../library/email.message.rst:628 msgid "" "Convert a non-``multipart`` or a ``multipart/related`` into a ``multipart/" "alternative``, moving any existing :mailheader:`Content-` headers and " @@ -835,6 +1047,12 @@ msgid "" "the boundary to be automatically created when it is needed (for example, " "when the message is serialized)." msgstr "" +"``multipart`` でないメッセージ、または ``multipart/related`` を ``multipart/" +"alternative`` に変換し、既存の :mailheader:`Content-` ヘッダーとペイロード" +"を、``multipart`` の新しい最初のパートに移します。\n" +"*boundary* が指定されていれば、マルチパートの境界文字列として使います。\n" +"指定されていなければ、直列化時など、必要になったときに自動的に生成されるよう" +"にします。" #: ../../library/email.message.rst:638 msgid "" @@ -846,7 +1064,6 @@ msgid "" "it is needed (for example, when the message is serialized)." msgstr "" -#: ../../library/email.message.rst:648 msgid "" "If the message is a ``multipart/related``, create a new message object, pass " "all of the arguments to its :meth:`set_content` method, and :meth:`~email." @@ -857,8 +1074,17 @@ msgid "" "the current :mod:`~email.policy`. If the added part has no :mailheader:" "`Content-Disposition` header, add one with the value ``inline``." msgstr "" +"メッセージが ``multipart/related`` の場合、新しいメッセージオブジェクトを作成" +"し、すべての引数をその :meth:`set_content` に渡して、:meth:`~email.message." +"Message.attach` で ``multipart`` に追加します。\n" +"メッセージが ``multipart`` でなければ、:meth:`make_related` を呼び出してから" +"同じ処理を行います。\n" +"他の型の ``multipart`` の場合は :exc:`TypeError` を送出します。\n" +"*content_manager* が指定されていなければ、現在の :mod:`~email.policy` で指定" +"された ``content_manager`` を使います。\n" +"追加したパートに :mailheader:`Content-Disposition` ヘッダーがなければ、値を " +"``inline`` として追加します。" -#: ../../library/email.message.rst:661 msgid "" "If the message is a ``multipart/alternative``, create a new message object, " "pass all of the arguments to its :meth:`set_content` method, and :meth:" @@ -869,8 +1095,15 @@ msgid "" "specified, use the ``content_manager`` specified by the current :mod:`~email." "policy`." msgstr "" +"メッセージが ``multipart/alternative`` の場合、新しいメッセージオブジェクトを" +"作成し、すべての引数をその :meth:`set_content` に渡して、:meth:`~email." +"message.Message.attach` で ``multipart`` に追加します。\n" +"メッセージが ``multipart`` でない場合、または ``multipart/related`` の場合" +"は、:meth:`make_alternative` を呼び出してから同じ処理を行います。\n" +"他の型の ``multipart`` の場合は :exc:`TypeError` を送出します。\n" +"*content_manager* が指定されていなければ、現在の :mod:`~email.policy` で指定" +"された ``content_manager`` を使います。" -#: ../../library/email.message.rst:673 msgid "" "If the message is a ``multipart/mixed``, create a new message object, pass " "all of the arguments to its :meth:`set_content` method, and :meth:`~email." @@ -884,16 +1117,30 @@ msgid "" "``inline`` attachments (:mailheader:`Content-Disposition: inline`), by " "passing appropriate options to the ``content_manager``." msgstr "" +"メッセージが ``multipart/mixed`` の場合、新しいメッセージオブジェクトを作成" +"し、すべての引数をその :meth:`set_content` に渡して、:meth:`~email.message." +"Message.attach` で ``multipart`` に追加します。\n" +"メッセージが ``multipart`` でない場合、または ``multipart/related`` や " +"``multipart/alternative`` の場合は、:meth:`make_mixed` を呼び出してから同じ処" +"理を行います。\n" +"*content_manager* が指定されていなければ、現在の :mod:`~email.policy` で指定" +"された ``content_manager`` を使います。\n" +"追加したパートに :mailheader:`Content-Disposition` ヘッダーがなければ、値を " +"``attachment`` として追加します。\n" +"``content_manager`` に適切なオプションを渡すことで、明示的な添付ファイル (:" +"mailheader:`Content-Disposition: attachment`) にも、``inline`` の添付ファイ" +"ル (:mailheader:`Content-Disposition: inline`) にも使えます。" #: ../../library/email.message.rst:689 msgid "Remove the payload and all of the headers." msgstr "ペイロードとヘッダの全てを削除します。" -#: ../../library/email.message.rst:694 msgid "" "Remove the payload and all of the :mailheader:`!Content-` headers, leaving " "all other headers intact and in their original order." msgstr "" +"ペイロードとすべての :mailheader:`!Content-` ヘッダーを削除し、他のヘッダーは" +"内容も順序もそのまま残します。" #: ../../library/email.message.rst:698 msgid ":class:`EmailMessage` objects have the following instance attributes:" @@ -944,13 +1191,16 @@ msgstr "" "注意: そのメッセージに preamble がない場合、*preamble* 属性には ``None`` が格" "納されます。" -#: ../../library/email.message.rst:726 msgid "" "The *epilogue* attribute acts the same way as the *preamble* attribute, " "except that it contains text that appears between the last boundary and the " "end of the message. As with the :attr:`~EmailMessage.preamble`, if there is " "no epilog text this attribute will be ``None``." msgstr "" +"*epilogue* 属性は *preamble* 属性と同様に働きますが、最後の境界からメッセージ" +"の末尾までのテキストを含む点が異なります。\n" +":attr:`~EmailMessage.preamble` と同様に、末尾のテキストがなければ ``None`` に" +"なります。" #: ../../library/email.message.rst:734 msgid "" @@ -962,20 +1212,26 @@ msgstr "" "障害) のリストを保持しています。解析中に発見されうる障害についてのより詳細な" "説明は :mod:`email.errors` を参照してください。" -#: ../../library/email.message.rst:741 msgid "" "This class represents a subpart of a MIME message. It is identical to :" "class:`EmailMessage`, except that no :mailheader:`MIME-Version` headers are " "added when :meth:`~EmailMessage.set_content` is called, since sub-parts do " "not need their own :mailheader:`MIME-Version` headers." msgstr "" +"このクラスは MIME メッセージのサブパートを表します。\n" +":class:`EmailMessage` と同じですが、サブパートには独自の :mailheader:`MIME-" +"Version` ヘッダーが不要なため、:meth:`~EmailMessage.set_content` を呼び出して" +"も :mailheader:`MIME-Version` ヘッダーが追加されない点が異なります。" #: ../../library/email.message.rst:748 msgid "Footnotes" msgstr "脚注" -#: ../../library/email.message.rst:749 msgid "" "Originally added in 3.4 as a :term:`provisional module `. Docs for legacy message class moved to :ref:`compat32_message`." msgstr "" +"当初は 3.4 で :term:`暫定モジュール ` として追加されまし" +"た。\n" +"従来のメッセージクラスのドキュメントは :ref:`compat32_message` に移動しまし" +"た。" diff --git a/library/email.mime.po b/library/email.mime.po index 2a6bc204e..edabb99c5 100644 --- a/library/email.mime.po +++ b/library/email.mime.po @@ -17,27 +17,28 @@ msgstr "" "Last-Translator: tomo, 2021\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" -#: ../../library/email.mime.rst:2 msgid ":mod:`!email.mime`: Creating email and MIME objects from scratch" -msgstr "" +msgstr ":mod:`!email.mime`: 電子メールと MIME オブジェクトを一から作成する" #: ../../library/email.mime.rst:7 msgid "**Source code:** :source:`Lib/email/mime/`" msgstr "**ソースコード:** :source:`Lib/email/mime/`" -#: ../../library/email.mime.rst:11 msgid "" "This module is part of the legacy (``Compat32``) email API. Its " "functionality is partially replaced by the :mod:`~email.contentmanager` in " "the new API, but in certain applications these classes may still be useful, " "even in non-legacy code." msgstr "" +"このモジュールは従来の (``Compat32``) email API の一部です。\n" +"新しい API では機能の一部が :mod:`~email.contentmanager` に置き換えられていま" +"すが、用途によっては新しいコードでもこれらのクラスが役立ちます。" #: ../../library/email.mime.rst:16 msgid "" @@ -59,18 +60,16 @@ msgstr "" "す。これは MIME メッセージを切ったりおろしたりするために非常に便利なインター" "フェイスを提供します。" -#: ../../library/email.mime.rst:24 msgid "" "You can create a new object structure by creating :class:`~email.message." "Message` instances, adding attachments and all the appropriate headers " "manually. For MIME messages though, the :mod:`email` package provides some " "convenient subclasses to make things easier." msgstr "" -"新しいメッセージオブジェクト構造は :class:`~email.message.Message` インスタン" -"スを作成することにより作れます。ここに添付ファイルやその他適切なものをすべて" -"手で加えてやればよいのです。MIME メッセージの場合、 :mod:`email` パッケージは" -"これらを簡単におこなえるようにするためにいくつかの便利なサブクラスを提供して" -"います。" +"新しいオブジェクト構造は :class:`~email.message.Message` インスタンスを作成" +"し、添付ファイルと必要なヘッダをすべて手動で追加することで作れます。\n" +"ただし MIME メッセージについては、:mod:`email` パッケージにこの作業を簡単にす" +"る便利なサブクラスが用意されています。" #: ../../library/email.mime.rst:29 msgid "Here are the classes:" @@ -107,11 +106,12 @@ msgstr "" "など)。 *_params* は各パラメータのキーと値を格納した辞書であり、これは直接 :" "meth:`Message.add_header ` に渡されます。" -#: ../../library/email.mime.rst:49 msgid "" "If *policy* is specified, (defaults to the :class:`compat32 ` policy) it will be passed to :class:`~email.message.Message`." msgstr "" +"*policy* を指定すると :class:`~email.message.Message` に渡されます (デフォル" +"トは :class:`compat32 ` ポリシーです)。" #: ../../library/email.mime.rst:53 msgid "" @@ -193,13 +193,12 @@ msgstr "" "はつねに :meth:`Message.attach ` メソッドを使っ" "てそのメッセージに追加できるようになっています。" -#: ../../library/email.mime.rst:98 ../../library/email.mime.rst:131 -#: ../../library/email.mime.rst:165 ../../library/email.mime.rst:200 -#: ../../library/email.mime.rst:223 ../../library/email.mime.rst:254 msgid "" "Optional *policy* argument defaults to :class:`compat32 `." msgstr "" +"オプション引数 *policy* のデフォルトは :class:`compat32 ` です。" #: ../../library/email.mime.rst:100 msgid "" @@ -215,7 +214,6 @@ msgstr "" msgid "Module: :mod:`email.mime.application`" msgstr "モジュール: :mod:`email.mime.application`" -#: ../../library/email.mime.rst:115 msgid "" "A subclass of :class:`~email.mime.nonmultipart.MIMENonMultipart`, the :class:" "`MIMEApplication` class is used to represent MIME message objects of major " @@ -223,6 +221,12 @@ msgid "" "application data. Optional *_subtype* specifies the MIME subtype and " "defaults to :mimetype:`octet-stream`." msgstr "" +":class:`MIMEApplication` クラスは :class:`~email.mime.nonmultipart." +"MIMENonMultipart` のサブクラスで、主形式が :mimetype:`application` の MIME " +"メッセージオブジェクトを表します。\n" +"*_data* は未加工のアプリケーションデータのバイト列です。\n" +"オプション引数 *_subtype* は MIME の副形式を指定し、デフォルトは :mimetype:" +"`octet-stream` です。" #: ../../library/email.mime.rst:121 msgid "" @@ -252,7 +256,6 @@ msgstr "*_params* は基底クラスのコンストラクタにそのまま渡 msgid "Module: :mod:`email.mime.audio`" msgstr "モジュール: :mod:`email.mime.audio`" -#: ../../library/email.mime.rst:146 msgid "" "A subclass of :class:`~email.mime.nonmultipart.MIMENonMultipart`, the :class:" "`MIMEAudio` class is used to create MIME message objects of major type :" @@ -263,6 +266,15 @@ msgid "" "argument. If the minor type could not be guessed and *_subtype* was not " "given, then :exc:`TypeError` is raised." msgstr "" +":class:`MIMEAudio` クラスは :class:`~email.mime.nonmultipart." +"MIMENonMultipart` のサブクラスで、主形式が :mimetype:`audio` の MIME メッセー" +"ジオブジェクトを作成します。\n" +"*_audiodata* は未加工の音声データのバイト列です。\n" +"このデータを au、wav、aiff、aifc としてデコードできる場合、副形式は自動的に :" +"mailheader:`Content-Type` ヘッダに含められます。\n" +"それ以外の場合は *_subtype* 引数で音声の副形式を明示的に指定できます。\n" +"副形式を推測できず、*_subtype* も指定されていない場合は :exc:`TypeError` が送" +"出されます。" #: ../../library/email.mime.rst:155 msgid "" @@ -288,7 +300,6 @@ msgstr "" msgid "Module: :mod:`email.mime.image`" msgstr "モジュール: :mod:`email.mime.image`" -#: ../../library/email.mime.rst:180 msgid "" "A subclass of :class:`~email.mime.nonmultipart.MIMENonMultipart`, the :class:" "`MIMEImage` class is used to create MIME message objects of major type :" @@ -300,6 +311,16 @@ msgid "" "the minor type could not be guessed and *_subtype* was not given, then :exc:" "`TypeError` is raised." msgstr "" +":class:`MIMEImage` クラスは :class:`~email.mime.nonmultipart." +"MIMENonMultipart` のサブクラスで、主形式が :mimetype:`image` の MIME メッセー" +"ジオブジェクトを作成します。\n" +"*_imagedata* は未加工の画像データのバイト列です。\n" +"このデータの形式を検出できる場合 (jpeg、png、gif、tiff、rgb、pbm、pgm、ppm、" +"rast、xbm、bmp、webp、exr の検出を試みます)、副形式は自動的に :mailheader:" +"`Content-Type` ヘッダに含められます。\n" +"それ以外の場合は *_subtype* 引数で画像の副形式を明示的に指定できます。\n" +"副形式を推測できず、*_subtype* も指定されていない場合は :exc:`TypeError` が送" +"出されます。" #: ../../library/email.mime.rst:190 msgid "" @@ -382,7 +403,6 @@ msgstr "" "は ``utf-8`` がデフォルトになっています。 *_charset* パラメータは、文字列と :" "class:`~email.charset.Charset` インスタンスの両方を受け付けます。" -#: ../../library/email.mime.rst:244 msgid "" "Unless the *_charset* argument is explicitly set to ``None``, the MIMEText " "object created will have both a :mailheader:`Content-Type` header with a " @@ -396,13 +416,13 @@ msgid "" msgstr "" "``_charset`` 引数に明示的に ``None`` をセットしない限りは、作成される " "MIMEText オブジェクトは ``charset`` の付いた :mailheader:`Content-Type` ヘッ" -"ダと :mailheader:`Content-Transfer-Endcoding` ヘッダの両方を持ちます。これは" -"後続の ``set_payload`` 呼び出しが、 ``set_payload`` コマンドに charset が渡し" -"たとしてもエンコードされたペイロードにはならないことを意味します。 ``Content-" -"Transfer-Encoding`` ヘッダを削除することでこの振る舞いを「リセット」出来ま" -"す。これにより ``set_payload`` 呼び出しが新たなペイロードを自動的にエンコー" -"ド (そして新たな :mailheader:`Content-Transfer-Encoding` ヘッダを追加) しま" -"す。" +"ダと :mailheader:`Content-Transfer-Encoding` ヘッダの両方を持ちます。\n" +"これは後続の ``set_payload`` 呼び出しが、 ``set_payload`` コマンドに charset " +"を渡したとしてもエンコードされたペイロードにはならないことを意味します。\n" +"``Content-Transfer-Encoding`` ヘッダを削除することでこの振る舞いを「リセッ" +"ト」出来ます。\n" +"これにより ``set_payload`` 呼び出しが新たなペイロードを自動的にエンコード (そ" +"して新たな :mailheader:`Content-Transfer-Encoding` ヘッダを追加) します。" #: ../../library/email.mime.rst:256 msgid "*_charset* also accepts :class:`~email.charset.Charset` instances." diff --git a/library/email.parser.po b/library/email.parser.po index c974887ed..38a32befc 100644 --- a/library/email.parser.po +++ b/library/email.parser.po @@ -17,21 +17,19 @@ msgstr "" "Last-Translator: tomo, 2021\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" -#: ../../library/email.parser.rst:2 msgid ":mod:`!email.parser`: Parsing email messages" -msgstr "" +msgstr ":mod:`!email.parser`: 電子メールメッセージの解析" #: ../../library/email.parser.rst:7 msgid "**Source code:** :source:`Lib/email/parser.py`" msgstr "**ソースコード:** :source:`Lib/email/parser.py`" -#: ../../library/email.parser.rst:11 msgid "" "Message object structures can be created in one of two ways: they can be " "created from whole cloth by creating an :class:`~email.message.EmailMessage` " @@ -40,8 +38,12 @@ msgid "" "or they can be created by parsing a serialized representation of the email " "message." msgstr "" +"メッセージオブジェクトの構造を作成する方法は 2 つあります。\n" +":class:`~email.message.EmailMessage` オブジェクトを作成し、辞書インターフェイ" +"スでヘッダを追加し、:meth:`~email.message.EmailMessage.set_content` や関連メ" +"ソッドでペイロードを追加して一から組み立てる方法と、シリアライズされた電子" +"メールメッセージを解析する方法です。" -#: ../../library/email.parser.rst:18 msgid "" "The :mod:`email` package provides a standard parser that understands most " "email document structures, including MIME documents. You can pass the " @@ -55,8 +57,19 @@ msgid "" "meth:`~email.message.EmailMessage.iter_parts`, and :meth:`~email.message." "EmailMessage.walk`." msgstr "" +":mod:`email` パッケージには、MIME 文書を含むほとんどの電子メール文書の構造を" +"解釈できる標準のパーザがあります。\n" +"パーザにバイト列、文字列、またはファイルオブジェクトを渡すと、オブジェクト構" +"造のルートに当たる :class:`~email.message.EmailMessage` インスタンスが返され" +"ます。\n" +"MIME 形式でない単純なメッセージでは、通常、このルートオブジェクトのペイロード" +"はメッセージのテキストを含む文字列になります。\n" +"MIME メッセージではルートオブジェクトの :meth:`~email.message.EmailMessage." +"is_multipart` メソッドが ``True`` を返し、:meth:`~email.message.EmailMessage." +"get_body`、:meth:`~email.message.EmailMessage.iter_parts`、:meth:`~email." +"message.EmailMessage.walk` などのペイロード操作用メソッドで各部分にアクセスで" +"きます。" -#: ../../library/email.parser.rst:30 msgid "" "There are actually two parser interfaces available for use, the :class:" "`Parser` API and the incremental :class:`FeedParser` API. The :class:" @@ -68,8 +81,17 @@ msgid "" "message incrementally, and only returns the root object when you close the " "parser." msgstr "" +"利用できるパーザインターフェイスは、:class:`Parser` API と逐次解析を行う :" +"class:`FeedParser` API の 2 つです。\n" +":class:`Parser` API は、メッセージ全体のテキストがメモリ内にある場合や、メッ" +"セージ全体がファイルシステム上のファイルに格納されている場合に適していま" +"す。\n" +"追加の入力を待ってブロックする可能性があるストリームからメッセージを読む場合 " +"(例えばソケットから電子メールメッセージを読む場合) は、:class:`FeedParser` の" +"方が適しています。\n" +":class:`FeedParser` はメッセージを少しずつ取り込んで解析でき、パーザを閉じた" +"ときに初めてルートオブジェクトを返します。" -#: ../../library/email.parser.rst:39 msgid "" "Note that the parser can be extended in limited ways, and of course you can " "implement your own parser completely from scratch. All of the logic that " @@ -79,12 +101,18 @@ msgid "" "necessary by implementing custom versions of the appropriate :class:`!" "Policy` methods." msgstr "" +"パーザは限られた範囲で拡張でき、もちろん独自のパーザを一から実装することもで" +"きます。\n" +":mod:`email` パッケージに付属するパーザと :class:`~email.message." +"EmailMessage` クラスを結び付けるロジックはすべて :class:`~email.policy." +"Policy` クラスにまとめられています。\n" +"そのため独自のパーザは、適切な :class:`!Policy` メソッドを独自に実装すること" +"で、必要な方法でメッセージオブジェクトのツリーを作成できます。" #: ../../library/email.parser.rst:49 msgid "FeedParser API" msgstr "FeedParser API" -#: ../../library/email.parser.rst:51 msgid "" "The :class:`BytesFeedParser`, imported from the :mod:`email.feedparser` " "module, provides an API that is conducive to incremental parsing of email " @@ -95,8 +123,16 @@ msgid "" "`BytesParser` API may be more convenient for such use cases. The semantics " "and results of the two parser APIs are identical." msgstr "" +":mod:`email.feedparser` モジュールからインポートする :class:" +"`BytesFeedParser` は、電子メールメッセージを逐次解析するための API を提供しま" +"す。\n" +"これはソケットなど、ブロックする可能性がある入力元から電子メールメッセージの" +"テキストを読む場合に必要になるものです。\n" +":class:`BytesFeedParser` はもちろん、全体が :term:`bytes-like object`、文字" +"列、またはファイルに格納されている電子メールメッセージも解析できますが、その" +"場合は :class:`BytesParser` API の方が便利かもしれません。\n" +"この 2 つのパーザ API の意味と解析結果は同じです。" -#: ../../library/email.parser.rst:60 msgid "" "The :class:`BytesFeedParser`'s API is simple; you create an instance, feed " "it a bunch of bytes until there's no more to feed it, then close the parser " @@ -108,29 +144,36 @@ msgid "" "it found in a message. See the :mod:`email.errors` module for the list of " "defects that it can find." msgstr "" -":class:`BytesFeedParser` API は簡単です。まずインスタンスをつくり、それに " -"bytes を (それ以上 bytes が必要なくなるまで) 流しこみます。その後パーザを " -"close すると根っこ (root) のメッセージオブジェクトが返されます。標準に従った" -"メッセージを解析する場合、 :class:`BytesFeedParser` は非常に正確であり、標準" -"に従っていないメッセージでもちゃんと動きます。そのさい、これはメッセージがど" -"のように壊れていると認識されたかについての情報を残します。これはメッセージオ" -"ブジェクトの :attr:`~email.message.EmailMessage.defects` 属性にリストとして現" -"れ、メッセージ中に発見された問題が記録されます。パーザが検出できる障害 " -"(defect) については :mod:`email.errors` モジュールを参照してください。" +":class:`BytesFeedParser` API は簡単です。\n" +"まずインスタンスをつくり、それに bytes を (渡す bytes がなくなるまで) 流しこ" +"みます。\n" +"その後パーザを close すると根っこ (root) のメッセージオブジェクトが返されま" +"す。\n" +"標準に従ったメッセージを解析する場合、 :class:`BytesFeedParser` は非常に正確" +"であり、標準に従っていないメッセージでもちゃんと動きます。\n" +"そのさい、これはメッセージがどのように壊れていると認識されたかについての情報" +"を残します。\n" +"これはメッセージオブジェクトの :attr:`~email.message.EmailMessage.defects` 属" +"性にリストとして現れ、メッセージ中に発見された問題が記録されます。\n" +"パーザが検出できる障害 (defect) については :mod:`email.errors` モジュールを参" +"照してください。" #: ../../library/email.parser.rst:70 msgid "Here is the API for the :class:`BytesFeedParser`:" msgstr "以下は :class:`BytesFeedParser` の API です:" -#: ../../library/email.parser.rst:75 msgid "" "Create a :class:`BytesFeedParser` instance. Optional *_factory* is a no-" "argument callable; if not specified use the :attr:`~email.policy.Policy." "message_factory` from the *policy*. Call *_factory* whenever a new message " "object is needed." msgstr "" +":class:`BytesFeedParser` インスタンスを作成します。\n" +"オプション引数 *_factory* は引数を取らない呼び出し可能オブジェクトです。\n" +"指定しなければ *policy* の :attr:`~email.policy.Policy.message_factory` を使" +"います。\n" +"新しいメッセージオブジェクトが必要になるたびに *_factory* を呼び出します。" -#: ../../library/email.parser.rst:80 msgid "" "If *policy* is specified use the rules it specifies to update the " "representation of the message. If *policy* is not set, use the :class:" @@ -141,20 +184,30 @@ msgid "" "more information on what else *policy* controls, see the :mod:`~email." "policy` documentation." msgstr "" +"*policy* を指定した場合、そのルールに従ってメッセージの表現を更新します。\n" +"指定しない場合は :class:`compat32 ` ポリシーを使いま" +"す。\n" +"このポリシーは Python 3.2 の email パッケージとの後方互換性を維持し、デフォル" +"トのファクトリとして :class:`~email.message.Message` を提供します。\n" +"その他のポリシーはすべて、デフォルトの *_factory* として :class:`~email." +"message.EmailMessage` を提供します。\n" +"*policy* が制御するその他の内容は :mod:`~email.policy` のドキュメントを参照し" +"てください。" -#: ../../library/email.parser.rst:89 ../../library/email.parser.rst:145 msgid "" "Note: **The policy keyword should always be specified**; The default will " "change to :data:`email.policy.default` in a future version of Python." msgstr "" +"注意: キーワード引数 ``policy`` は **常に指定してください**。\n" +"将来の Python バージョンでは、デフォルトが :data:`email.policy.default` に変" +"更されます。" #: ../../library/email.parser.rst:94 ../../library/email.parser.rst:122 msgid "Added the *policy* keyword." msgstr "キーワード引数 *policy* が追加されました。" -#: ../../library/email.parser.rst:95 msgid "*_factory* defaults to the policy ``message_factory``." -msgstr "" +msgstr "*_factory* のデフォルトがポリシーの ``message_factory`` になりました。" #: ../../library/email.parser.rst:100 msgid "" @@ -170,12 +223,15 @@ msgstr "" "(復帰 CR、改行 LF、または CR+LF) どれかの組み合わせでよく、これらが混在しても" "かまいません。" -#: ../../library/email.parser.rst:109 msgid "" "Complete the parsing of all previously fed data and return the root message " "object. It is undefined what happens if :meth:`~feed` is called after this " "method has been called." msgstr "" +"それまでに渡されたすべてのデータの解析を完了し、ルートのメッセージオブジェク" +"トを返します。\n" +"このメソッドを呼び出した後で :meth:`~feed` を呼び出した場合の動作は未定義で" +"す。" #: ../../library/email.parser.rst:116 msgid "" @@ -186,9 +242,8 @@ msgid "" "``True``, no binary attachments." msgstr "" -#: ../../library/email.parser.rst:126 msgid "Parser API" -msgstr "" +msgstr "Parser API" #: ../../library/email.parser.rst:128 msgid "" @@ -204,12 +259,14 @@ msgid "" "raw body." msgstr "" -#: ../../library/email.parser.rst:141 msgid "" "Create a :class:`BytesParser` instance. The *_class* and *policy* arguments " "have the same meaning and semantics as the *_factory* and *policy* arguments " "of :class:`BytesFeedParser`." msgstr "" +":class:`BytesParser` インスタンスを作成します。\n" +"*_class* 引数と *policy* 引数の意味と動作は、:class:`BytesFeedParser` の " +"*_factory* 引数と *policy* 引数と同じです。" #: ../../library/email.parser.rst:148 msgid "" @@ -218,10 +275,8 @@ msgid "" msgstr "" "2.4 で非推奨になった *strict* 引数の削除。キーワード引数 *policy* の追加。" -#: ../../library/email.parser.rst:151 ../../library/email.parser.rst:200 -#: ../../library/email.parser.rst:280 msgid "*_class* defaults to the policy ``message_factory``." -msgstr "" +msgstr "*_class* のデフォルトがポリシーの ``message_factory`` になりました。" #: ../../library/email.parser.rst:156 msgid "" @@ -250,28 +305,32 @@ msgstr "" "オプション引数 *headersonly* はヘッダを読み終えた後にパースを止めるかを指定す" "るフラグです。デフォルトは ``False`` で、ファイルの内容全体をパースします。" -#: ../../library/email.parser.rst:176 msgid "" "Similar to the :meth:`parse` method, except it takes a :term:`bytes-like " "object` instead of a file-like object. Calling this method on a :term:" "`bytes-like object` is equivalent to wrapping *bytes* in a :class:`~io." "BytesIO` instance first and calling :meth:`parse`." msgstr "" +":meth:`parse` メソッドと似ていますが、ファイル類似オブジェクトではなく :term:" +"`bytes-like object` を受け取ります。\n" +":term:`bytes-like object` に対してこのメソッドを呼び出すことは、*bytes* を :" +"class:`~io.BytesIO` インスタンスに包んで :meth:`parse` を呼び出すことと同じで" +"す。" #: ../../library/email.parser.rst:181 ../../library/email.parser.rst:221 msgid "Optional *headersonly* is as with the :meth:`parse` method." msgstr "オプション引数 *headersonly* は :meth:`parse` メソッドと同じです。" -#: ../../library/email.parser.rst:188 msgid "" "Exactly like :class:`BytesParser`, except that *headersonly* defaults to " "``True``." msgstr "" +"*headersonly* のデフォルトが ``True`` である点を除き、:class:`BytesParser` と" +"まったく同じです。" -#: ../../library/email.parser.rst:196 msgid "" "This class is parallel to :class:`BytesParser`, but handles string input." -msgstr "" +msgstr ":class:`BytesParser` に対応するクラスですが、文字列の入力を扱います。" #: ../../library/email.parser.rst:198 ../../library/email.parser.rst:245 #: ../../library/email.parser.rst:258 ../../library/email.parser.rst:268 @@ -292,11 +351,12 @@ msgstr "" "`~io.TextIOBase.readline` および :meth:`~io.TextIOBase.read` 両方のメソッドを" "サポートしている必要があります。" -#: ../../library/email.parser.rst:210 msgid "" "Other than the text mode requirement, this method operates like :meth:" "`BytesParser.parse`." msgstr "" +"テキストモードが必要な点を除き、このメソッドは :meth:`BytesParser.parse` と同" +"様に動作します。" #: ../../library/email.parser.rst:216 msgid "" @@ -310,10 +370,11 @@ msgstr "" "は、 *text* を :class:`~io.StringIO` インスタンスとして作成して :meth:" "`parse` を適用するのと同じです。" -#: ../../library/email.parser.rst:226 msgid "" "Exactly like :class:`Parser`, except that *headersonly* defaults to ``True``." msgstr "" +"*headersonly* のデフォルトが ``True`` である点を除き、:class:`Parser` とまっ" +"たく同じです。" #: ../../library/email.parser.rst:230 msgid "" @@ -377,11 +438,12 @@ msgstr "" "対話的な Python プロンプトで :func:`message_from_bytes` を使用するとすれば、" "このようになります::" -#: ../../library/email.parser.rst:286 msgid "" ">>> import email\n" ">>> msg = email.message_from_bytes(myBytes)" msgstr "" +">>> import email\n" +">>> msg = email.message_from_bytes(myBytes)" #: ../../library/email.parser.rst:291 msgid "Additional notes" diff --git a/library/email.po b/library/email.po index e345b1055..97e061139 100644 --- a/library/email.po +++ b/library/email.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/email.rst:2 @@ -49,14 +49,14 @@ msgstr "" "ます。 :rfc:`5322` や :rfc:`6532` のほか、:rfc:`2045`、:rfc:`2046`、:rfc:" "`2047`、:rfc:`2183`、:rfc:`2231` などのMIME関連のRFCに対応しています。" -#: ../../library/email.rst:23 msgid "" "The overall structure of the email package can be divided into three major " "components, plus a fourth component that controls the behavior of the other " "components." msgstr "" +"email パッケージの全体構造は、主要な 3 つの構成要素と、それらの動作を制御す" +"る 4 つ目の構成要素に分けられます。" -#: ../../library/email.rst:27 msgid "" "The central component of the package is an \"object model\" that represents " "email messages. An application interacts with the package primarily through " @@ -68,8 +68,17 @@ msgid "" "model is a tree structure of objects that all provide the :class:`~email." "message.EmailMessage` API." msgstr "" +"パッケージの中心となる構成要素は、電子メールメッセージを表現する「オブジェク" +"トモデル」です。\n" +"アプリケーションは主に :mod:`~email.message` サブモジュールで定義されたオブ" +"ジェクトモデルのインターフェースを通じて、このパッケージを利用します。\n" +"この API で、既存の電子メールの情報を調べたり、新しい電子メールを作成したり、" +"同じオブジェクトモデルのインターフェースを持つ構成部分を追加・削除したりでき" +"ます。\n" +"つまり、電子メールメッセージとその MIME 構成部分の性質に合わせて、email のオ" +"ブジェクトモデルは、すべてのオブジェクトが :class:`~email.message." +"EmailMessage` API を提供するツリー構造になっています。" -#: ../../library/email.rst:37 msgid "" "The other two major components of the package are the :mod:`~email.parser` " "and the :mod:`~email.generator`. The parser takes the serialized version of " @@ -80,8 +89,15 @@ msgid "" "but this usage is discouraged as it is too easy to end up with messages that " "are not valid in one way or another.)" msgstr "" +"他の 2 つの主要な構成要素は :mod:`~email.parser` と :mod:`~email.generator` " +"です。\n" +"パーサーは、直列化された電子メールメッセージ (バイトストリーム) を受け取り、:" +"class:`~email.message.EmailMessage` オブジェクトのツリーに変換します。\n" +"ジェネレーターは :class:`~email.message.EmailMessage` を受け取り、直列化され" +"たバイトストリームに戻します。\n" +"(パーサーとジェネレーターはテキストの文字ストリームも扱えますが、何らかの点で" +"不正なメッセージができてしまいやすいため、この使い方は推奨しません。)" -#: ../../library/email.rst:46 msgid "" "The control component is the :mod:`~email.policy` module. Every :class:" "`~email.message.EmailMessage`, every :mod:`~email.generator`, and every :mod:" @@ -95,6 +111,19 @@ msgid "" "from disk, but to serialize it using standard SMTP settings when sending it " "to an email server." msgstr "" +"制御を担当する構成要素は :mod:`~email.policy` モジュールです。\n" +"各 :class:`~email.message.EmailMessage`、:mod:`~email.generator`、:mod:" +"`~email.parser` には、それぞれの動作を制御する :mod:`~email.policy` オブジェ" +"クトが関連付けられています。\n" +"通常、アプリケーションがポリシーを指定する必要があるのは :class:`~email." +"message.EmailMessage` の作成時だけです。\n" +"これには、新しい電子メールのために :class:`~email.message.EmailMessage` を直" +"接インスタンス化する場合と、:mod:`~email.parser` で入力ストリームを解析する場" +"合があります。\n" +"ただし、:mod:`~email.generator` でメッセージを直列化するときにポリシーを変更" +"することもできます。\n" +"例えば、ディスク上の一般的な電子メールメッセージを解析し、メールサーバーへ送" +"信するときは標準の SMTP 設定で直列化できます。" #: ../../library/email.rst:58 msgid "" @@ -123,7 +152,6 @@ msgid "" "components of the library." msgstr "" -#: ../../library/email.rst:78 msgid "" "The next three sections cover the exceptions the package may raise and the " "defects (non-compliance with the RFCs) that the :mod:`~email.parser` may " @@ -134,12 +162,17 @@ msgid "" "messages, but also document their extensibility APIs, which will be of " "interest to advanced applications." msgstr "" +"続く 3 つの節では、パッケージが送出する可能性のある例外と、:mod:`~email." +"parser` が検出する可能性のある欠陥 (RFC に準拠していない点) を説明します。\n" +"その後、ヘッダーとペイロードをそれぞれより細かく操作するための :mod:`~email." +"headerregistry` と :mod:`~email.contentmanager` を取り上げます。\n" +"どちらにも複雑なメッセージの処理や作成に役立つ機能がありますが、高度なアプリ" +"ケーション向けの拡張用 API についても説明します。" -#: ../../library/email.rst:87 msgid "" "Following those is a set of examples of using the fundamental parts of the " "APIs covered in the preceding sections." -msgstr "" +msgstr "続いて、それまでの節で説明した API の基本部分を使う例を示します。" #: ../../library/email.rst:90 msgid "" @@ -154,11 +187,12 @@ msgid "" "compat32` API for backward compatibility reasons." msgstr "" -#: ../../library/email.rst:100 msgid "" "Docs reorganized and rewritten to promote the new :class:`~email.message." "EmailMessage`/:class:`~email.policy.EmailPolicy` API." msgstr "" +"新しい :class:`~email.message.EmailMessage`/:class:`~email.policy." +"EmailPolicy` API の利用を促すため、ドキュメントを再構成し、書き直しました。" #: ../../library/email.rst:105 msgid "Contents of the :mod:`email` package documentation:" @@ -196,8 +230,9 @@ msgstr "IMAP (Internet Message Access Protocol) クライアント" msgid "Module :mod:`mailbox`" msgstr ":mod:`mailbox` モジュール" -#: ../../library/email.rst:145 msgid "" "Tools for creating, reading, and managing collections of messages on disk " "using a variety standard formats." msgstr "" +"さまざまな標準形式でディスク上のメッセージの集まりを作成、読み込み、管理する" +"ためのツール。" diff --git a/library/email.policy.po b/library/email.policy.po index 0307ce661..738ce1163 100644 --- a/library/email.policy.po +++ b/library/email.policy.po @@ -18,21 +18,19 @@ msgstr "" "Last-Translator: Arihiro TAKASE, 2023\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" -#: ../../library/email.policy.rst:2 msgid ":mod:`!email.policy`: Policy Objects" -msgstr "" +msgstr ":mod:`!email.policy`: ポリシーオブジェクト" #: ../../library/email.policy.rst:12 msgid "**Source code:** :source:`Lib/email/policy.py`" msgstr "**ソースコード:** :source:`Lib/email/policy.py`" -#: ../../library/email.policy.rst:16 msgid "" "The :mod:`email` package's prime focus is the handling of email messages as " "described by the various email and MIME RFCs. However, the general format " @@ -46,15 +44,17 @@ msgid "" "the standards, or that implement extensions you want to use in ways that " "violate the standards." msgstr "" -":mod:`email` パッケージの主要な目的は様々なEメールやMIMEのRFCで記述されたE" -"メールメッセージを取り扱うことにあります。しかし、Eメールメッセージの一般的な" -"フォーマット(名前の後にコロンが続き、コロンの後に値が続くという構成の複数の" -"ヘッダーフィールドのブロック、空白行、任意の 'body')はEメールの分野外での用途" -"が見いだされたフォーマットです。これらの用途には主となるEメールのRFCに厳密に" -"従っているものもあれば、そうでないものもあります。Eメールを使ったworkingのと" -"きでさえも、厳密なRFC準拠にしないのが望ましいことがあります。たとえば、基準に" -"従わないEメールサーバーと相互運用するEメールを作成するときや、基準に違反する" -"方法で使用したい拡張機能を実装するEメールを作成するときです。" +":mod:`email` パッケージの主な目的は、メールや MIME に関する各種 RFC に従って" +"メールメッセージを扱うことです。\n" +"しかし、メールの一般的な形式はメール以外の用途でも使われています。\n" +"この形式は、名前、コロン、値からなるヘッダーフィールドを並べたブロックと、そ" +"の後に続く空行、任意の「本文」で構成されます。\n" +"メール以外の用途には、主要なメールの RFC にほぼ準拠するものもあれば、そうでな" +"いものもあります。\n" +"メールを扱う場合でも、RFC への厳密な準拠を避けたいことがあります。\n" +"例えば、規格に従わないメールサーバーとやり取りするメールを生成する場合や、利" +"用したい拡張機能を規格に反する方法で実装しているサーバーとやり取りする場合で" +"す。" #: ../../library/email.policy.rst:28 msgid "" @@ -64,7 +64,6 @@ msgstr "" "これらのばらばらな用途に対応するためPolicyオブジェクトはEメールパッケージに対" "して柔軟性を提供します。" -#: ../../library/email.policy.rst:31 msgid "" "A :class:`Policy` object encapsulates a set of attributes and methods that " "control the behavior of various components of the email package during use. :" @@ -72,8 +71,12 @@ msgid "" "email package to alter the default behavior. The settable values and their " "defaults are described below." msgstr "" +":class:`Policy` オブジェクトは、email パッケージの各部の動作を制御する属性と" +"メソッドをまとめたものです。\n" +"email パッケージの各種クラスやメソッドに :class:`Policy` インスタンスを渡すこ" +"とで、デフォルトの動作を変更できます。\n" +"設定できる値とそのデフォルト値を以下で説明します。" -#: ../../library/email.policy.rst:37 msgid "" "There is a default policy used by all classes in the email package. For all " "of the :mod:`~email.parser` classes and the related convenience functions, " @@ -83,15 +86,22 @@ msgid "" "some cases, including bug compatibility) with the pre-Python3.3 version of " "the email package." msgstr "" +"email パッケージの各クラスにはデフォルトのポリシーがあります。\n" +":mod:`~email.parser` のすべてのクラスと関連する便利な関数、および :class:" +"`~email.message.Message` クラスでは、:class:`Compat32` ポリシーの定義済みイン" +"スタンス :const:`compat32` が使われます。\n" +"このポリシーは Python 3.3 より前の email パッケージと完全な後方互換性を提供し" +"ます (場合によってはバグとの互換性も含みます)。" -#: ../../library/email.policy.rst:44 msgid "" "This default value for the *policy* keyword to :class:`~email.message." "EmailMessage` is the :class:`EmailPolicy` policy, via its pre-defined " "instance :data:`~default`." msgstr "" +":class:`~email.message.EmailMessage` のキーワード引数 *policy* のデフォルト" +"は、:class:`EmailPolicy` ポリシーの定義済みインスタンス :data:`~default` で" +"す。" -#: ../../library/email.policy.rst:48 msgid "" "When a :class:`~email.message.Message` or :class:`~email.message." "EmailMessage` object is created, it acquires a policy. If the message is " @@ -102,8 +112,15 @@ msgid "" "policy from the message by default, but you can also pass a specific policy " "to the generator that will override the one stored on the message object." msgstr "" +":class:`~email.message.Message` または :class:`~email.message.EmailMessage` " +"オブジェクトには、作成時にポリシーが設定されます。\n" +":mod:`~email.parser` でメッセージを作成する場合は、パーザに渡したポリシーがそ" +"のメッセージに使われます。\n" +"プログラムでメッセージを作成する場合は、作成時にポリシーを指定できます。\n" +"メッセージを :mod:`~email.generator` に渡すと、デフォルトではメッセージのポリ" +"シーが使われますが、ジェネレータに特定のポリシーを渡してメッセージオブジェク" +"トに格納されたポリシーの代わりに使うこともできます。" -#: ../../library/email.policy.rst:57 msgid "" "The default value for the *policy* keyword for the :mod:`email.parser` " "classes and the parser convenience functions **will be changing** in a " @@ -111,8 +128,11 @@ msgid "" "which policy you want to use** when calling any of the classes and functions " "described in the :mod:`~email.parser` module." msgstr "" +":mod:`email.parser` のクラスとパーザ用の便利な関数のキーワード引数 *policy* " +"のデフォルト値は、将来の Python バージョンで **変更される予定です**。\n" +"このため :mod:`~email.parser` モジュールで説明するクラスや関数を呼び出すとき" +"は、**使用するポリシーを常に明示的に指定してください**。" -#: ../../library/email.policy.rst:63 msgid "" "The first part of this documentation covers the features of :class:`Policy`, " "an :term:`abstract base class` that defines the features that are common to " @@ -123,21 +143,33 @@ msgid "" "which implement the hooks that provide the standard behavior and the " "backward compatible behavior and features, respectively." msgstr "" +"このドキュメントの前半では、:const:`compat32` を含むすべてのポリシーオブジェ" +"クトに共通の機能を定義する :term:`抽象基底クラス `、:" +"class:`Policy` の機能を説明します。\n" +"これには email パッケージが内部で呼び出すフックメソッドも含まれ、独自のポリ" +"シーでオーバーライドすると動作を変更できます。\n" +"後半では具象クラス :class:`EmailPolicy` と :class:`Compat32` を説明します。\n" +"これらはそれぞれ、標準の動作を提供するフックと、後方互換の動作や機能を提供す" +"るフックを実装します。" -#: ../../library/email.policy.rst:72 msgid "" ":class:`Policy` instances are immutable, but they can be cloned, accepting " "the same keyword arguments as the class constructor and returning a new :" "class:`Policy` instance that is a copy of the original but with the " "specified attributes values changed." msgstr "" +":class:`Policy` インスタンスはイミュータブルですが、複製できます。\n" +"クラスのコンストラクタと同じキーワード引数を受け取り、元のインスタンスをコ" +"ピーして指定された属性の値を変更した新しい :class:`Policy` インスタンスを返し" +"ます。" -#: ../../library/email.policy.rst:77 msgid "" "As an example, the following code could be used to read an email message " "from a file on disk and pass it to the system ``sendmail`` program on a Unix " "system:" msgstr "" +"例えば次のコードは、ディスク上のファイルから電子メールメッセージを読み込み、" +"Unix システムの ``sendmail`` プログラムに渡します:" #: ../../library/email.policy.rst:92 msgid "" @@ -155,15 +187,17 @@ msgid "" ">>> rc = p.wait()" msgstr "" -#: ../../library/email.policy.rst:114 msgid "" "Here we are telling :class:`~email.generator.BytesGenerator` to use the RFC " "correct line separator characters when creating the binary string to feed " "into ``sendmail's`` ``stdin``, where the default policy would use ``\\n`` " "line separators." msgstr "" +"ここでは、``sendmail`` の ``stdin`` に渡すバイナリ文字列を作成するときに、" +"RFC に従った改行文字を使うよう :class:`~email.generator.BytesGenerator` に指" +"定しています。\n" +"デフォルトのポリシーでは改行文字に ``\\n`` を使います。" -#: ../../library/email.policy.rst:119 msgid "" "Some email package methods accept a *policy* keyword argument, allowing the " "policy to be overridden for that method. For example, the following code " @@ -171,14 +205,22 @@ msgid "" "from the previous example and writes the message to a file using the native " "line separators for the platform on which it is running::" msgstr "" +"email パッケージの一部のメソッドはキーワード引数 *policy* を受け取り、そのメ" +"ソッドで使うポリシーを変更できます。\n" +"例えば次のコードは、前の例の *msg* オブジェクトの :meth:`~email.message." +"Message.as_bytes` メソッドを使い、実行しているプラットフォーム固有の改行文字" +"でメッセージをファイルに書き込みます。 ::" -#: ../../library/email.policy.rst:125 msgid "" ">>> import os\n" ">>> with open('converted.txt', 'wb') as f:\n" "... f.write(msg.as_bytes(policy=msg.policy.clone(linesep=os.linesep)))\n" "17" msgstr "" +">>> import os\n" +">>> with open('converted.txt', 'wb') as f:\n" +"... f.write(msg.as_bytes(policy=msg.policy.clone(linesep=os.linesep)))\n" +"17" #: ../../library/email.policy.rst:130 msgid "" @@ -190,12 +232,14 @@ msgstr "" "のオブジェクトの非デフォルト値を組み合わせた設定を持つPolicyオブジェクトを生" "成します::" -#: ../../library/email.policy.rst:134 msgid "" ">>> compat_SMTP = policy.compat32.clone(linesep='\\r\\n')\n" ">>> compat_strict = policy.compat32.clone(raise_on_defect=True)\n" ">>> compat_strict_SMTP = compat_SMTP + compat_strict" msgstr "" +">>> compat_SMTP = policy.compat32.clone(linesep='\\r\\n')\n" +">>> compat_strict = policy.compat32.clone(raise_on_defect=True)\n" +">>> compat_strict_SMTP = compat_SMTP + compat_strict" #: ../../library/email.policy.rst:138 msgid "" @@ -205,7 +249,6 @@ msgstr "" "この操作には交換法則が成り立ちません。つまり、オブジェクトを加える順番に結果" "が依存します。次のように説明できます::" -#: ../../library/email.policy.rst:141 msgid "" ">>> policy100 = policy.compat32.clone(max_line_length=100)\n" ">>> policy80 = policy.compat32.clone(max_line_length=80)\n" @@ -216,16 +259,26 @@ msgid "" ">>> apolicy.max_line_length\n" "100" msgstr "" +">>> policy100 = policy.compat32.clone(max_line_length=100)\n" +">>> policy80 = policy.compat32.clone(max_line_length=80)\n" +">>> apolicy = policy100 + policy80\n" +">>> apolicy.max_line_length\n" +"80\n" +">>> apolicy = policy80 + policy100\n" +">>> apolicy.max_line_length\n" +"100" -#: ../../library/email.policy.rst:153 msgid "" "This is the :term:`abstract base class` for all policy classes. It provides " "default implementations for a couple of trivial methods, as well as the " "implementation of the immutability property, the :meth:`clone` method, and " "the constructor semantics." msgstr "" +"すべてのポリシークラスの :term:`抽象基底クラス ` で" +"す。\n" +"いくつかの単純なメソッドのデフォルト実装に加え、イミュータブルにする仕組み、:" +"meth:`clone` メソッド、コンストラクタの動作を実装しています。" -#: ../../library/email.policy.rst:158 msgid "" "The constructor of a policy class can be passed various keyword arguments. " "The arguments that may be specified are any non-method properties on this " @@ -233,12 +286,18 @@ msgid "" "value specified in the constructor will override the default value for the " "corresponding attribute." msgstr "" +"ポリシークラスのコンストラクタには、さまざまなキーワード引数を渡せます。\n" +"指定できる引数は、このクラスと具象クラスにあるメソッド以外のすべてのプロパ" +"ティです。\n" +"コンストラクタに値を指定すると、対応する属性のデフォルト値が置き換えられま" +"す。" -#: ../../library/email.policy.rst:164 msgid "" "This class defines the following properties, and thus values for the " "following may be passed in the constructor of any policy class:" msgstr "" +"このクラスは以下のプロパティを定義しているため、どのポリシークラスのコンスト" +"ラクタでもこれらの値を指定できます:" #: ../../library/email.policy.rst:170 msgid "" @@ -250,72 +309,91 @@ msgstr "" "トは :rfc:`5322` に従い78となっています。値が ``0`` または :const:`None` の場" "合は行の折り返しを全くしないべきであるということを示します。" -#: ../../library/email.policy.rst:178 msgid "" "The string to be used to terminate lines in serialized output. The default " "is ``\\n`` because that's the internal end-of-line discipline used by " "Python, though ``\\r\\n`` is required by the RFCs." msgstr "" +"シリアライズした出力の行末に使う文字列です。\n" +"RFC では ``\\r\\n`` が必要ですが、Python が内部で使う改行規則に合わせ、デフォ" +"ルトは ``\\n`` です。" -#: ../../library/email.policy.rst:185 msgid "" "Controls the type of Content Transfer Encodings that may be or are required " "to be used. The possible values are:" msgstr "" +"使用可能な、または使用が必要な Content Transfer Encoding の種類を制御しま" +"す。\n" +"指定できる値は次のとおりです:" #: ../../library/email.policy.rst:191 msgid "``7bit``" msgstr "``7bit``" -#: ../../library/email.policy.rst:191 msgid "" "all data must be \"7 bit clean\" (ASCII-only). This means that where " "necessary data will be encoded using either quoted-printable or base64 " "encoding." msgstr "" +"すべてのデータを「7 ビットクリーン」(ASCII のみ) にする必要があります。\n" +"このため必要に応じて quoted-printable または base64 でデータをエンコードしま" +"す。" #: ../../library/email.policy.rst:195 msgid "``8bit``" msgstr "``8bit``" -#: ../../library/email.policy.rst:195 msgid "" "data is not constrained to be 7 bit clean. Data in headers is still " "required to be ASCII-only and so will be encoded (see :meth:`fold_binary` " "and :attr:`~EmailPolicy.utf8` below for exceptions), but body parts may use " "the ``8bit`` CTE." msgstr "" +"データを 7 ビットクリーンにする必要はありません。\n" +"ヘッダ内のデータは依然として ASCII のみに制限されるためエンコードされますが " +"(例外については以下の :meth:`fold_binary` と :attr:`~EmailPolicy.utf8` を参" +"照)、本体の各部分では ``8bit`` の CTE を使えます。" -#: ../../library/email.policy.rst:201 msgid "" "A ``cte_type`` value of ``8bit`` only works with ``BytesGenerator``, not " "``Generator``, because strings cannot contain binary data. If a " "``Generator`` is operating under a policy that specifies ``cte_type=8bit``, " "it will act as if ``cte_type`` is ``7bit``." msgstr "" +"文字列はバイナリデータを含められないため、``cte_type`` の値 ``8bit`` は " +"``BytesGenerator`` でのみ機能し、``Generator`` では機能しません。\n" +"``Generator`` が ``cte_type=8bit`` を指定したポリシーで動作する場合は、" +"``cte_type`` が ``7bit`` であるかのように動作します。" -#: ../../library/email.policy.rst:209 msgid "" "If :const:`True`, any defects encountered will be raised as errors. If :" "const:`False` (the default), defects will be passed to the :meth:" "`register_defect` method." msgstr "" +":const:`True` の場合、見つかった不具合はすべてエラーとして送出されます。\n" +":const:`False` (デフォルト) の場合、不具合は :meth:`register_defect` メソッド" +"に渡されます。" -#: ../../library/email.policy.rst:216 msgid "" "If :const:`True`, lines starting with *\"From \"* in the body are escaped by " "putting a ``>`` in front of them. This parameter is used when the message is " "being serialized by a generator. Default: :const:`False`." msgstr "" +":const:`True` の場合、本体内で *\"From \"* で始まる行は先頭に ``>`` を付けて" +"エスケープされます。\n" +"このパラメータはジェネレータがメッセージをシリアライズするときに使います。\n" +"デフォルトは :const:`False` です。" -#: ../../library/email.policy.rst:226 msgid "" "A factory function for constructing a new empty message object. Used by the " "parser when building messages. Defaults to ``None``, in which case :class:" "`~email.message.Message` is used." msgstr "" +"新しい空のメッセージオブジェクトを作成するファクトリ関数です。\n" +"パーザがメッセージを組み立てるときに使います。\n" +"デフォルトは ``None`` で、この場合は :class:`~email.message.Message` を使いま" +"す。" -#: ../../library/email.policy.rst:235 msgid "" "If ``True`` (the default), the generator will raise :exc:`~email.errors." "HeaderWriteError` instead of writing a header that is improperly folded or " @@ -323,33 +401,47 @@ msgid "" "adjacent data. Such headers can be generated by custom header classes or " "bugs in the ``email`` module." msgstr "" +"``True`` (デフォルト) の場合、折り返しや区切りが不適切で、複数のヘッダとして" +"解析されたり隣接するデータと結合されたりするヘッダを書き込む代わりに、ジェネ" +"レータは :exc:`~email.errors.HeaderWriteError` を送出します。\n" +"このようなヘッダは独自のヘッダクラスや ``email`` モジュールのバグによって生成" +"される可能性があります。" -#: ../../library/email.policy.rst:242 msgid "" "As it's a security feature, this defaults to ``True`` even in the :class:" "`~email.policy.Compat32` policy. For backwards compatible, but unsafe, " "behavior, it must be set to ``False`` explicitly." msgstr "" +"セキュリティ機能であるため、:class:`~email.policy.Compat32` ポリシーでもデ" +"フォルトは ``True`` です。\n" +"安全ではありませんが後方互換の動作にするには、明示的に ``False`` に設定しなけ" +"ればなりません。" -#: ../../library/email.policy.rst:250 msgid "" "The following :class:`Policy` method is intended to be called by code using " "the email library to create policy instances with custom settings:" msgstr "" +"次の :class:`Policy` メソッドは、email ライブラリを使うコードから呼び出して、" +"設定を変更したポリシーのインスタンスを作成するためのものです:" -#: ../../library/email.policy.rst:256 msgid "" "Return a new :class:`Policy` instance whose attributes have the same values " "as the current instance, except where those attributes are given new values " "by the keyword arguments." msgstr "" +"現在のインスタンスと同じ属性値を持つ新しい :class:`Policy` インスタンスを返し" +"ます。\n" +"ただし、キーワード引数で指定された属性は新しい値になります。" -#: ../../library/email.policy.rst:261 msgid "" "The remaining :class:`Policy` methods are called by the email package code, " "and are not intended to be called by an application using the email package. " "A custom policy must implement all of these methods." msgstr "" +"残りの :class:`Policy` メソッドは email パッケージのコードから呼び出すもの" +"で、email パッケージを使うアプリケーションから呼び出すためのものではありませ" +"ん。\n" +"独自のポリシーはこれらのメソッドをすべて実装しなければなりません。" #: ../../library/email.policy.rst:268 msgid "" @@ -357,12 +449,15 @@ msgid "" "*defect* will always be a subclass of :class:`~email.errors.MessageDefect`." msgstr "" -#: ../../library/email.policy.rst:272 msgid "" "The default implementation checks the :attr:`raise_on_defect` flag. If it " "is ``True``, *defect* is raised as an exception. If it is ``False`` (the " "default), *obj* and *defect* are passed to :meth:`register_defect`." msgstr "" +"デフォルトの実装は :attr:`raise_on_defect` フラグを調べます。\n" +"``True`` の場合、*defect* を例外として送出します。\n" +"``False`` (デフォルト) の場合、*obj* と *defect* を :meth:`register_defect` " +"に渡します。" #: ../../library/email.policy.rst:279 msgid "" @@ -370,7 +465,6 @@ msgid "" "a subclass of :class:`~email.errors.MessageDefect`." msgstr "" -#: ../../library/email.policy.rst:282 msgid "" "The default implementation calls the ``append`` method of the ``defects`` " "attribute of *obj*. When the email package calls :attr:`handle_defect`, " @@ -379,20 +473,29 @@ msgid "" "custom ``Message`` objects) should also provide such an attribute, otherwise " "defects in parsed messages will raise unexpected errors." msgstr "" +"デフォルトの実装は、*obj* の ``defects`` 属性の ``append`` メソッドを呼び出し" +"ます。\n" +"email パッケージが :attr:`handle_defect` を呼び出すとき、通常 *obj* には " +"``append`` メソッドを持つ ``defects`` 属性があります。\n" +"email パッケージとともに使う独自のオブジェクト型 (例えば独自の ``Message`` オ" +"ブジェクト) もこの属性を提供する必要があります。\n" +"そうしないと、解析したメッセージの不具合が予期しないエラーを引き起こします。" #: ../../library/email.policy.rst:292 msgid "Return the maximum allowed number of headers named *name*." msgstr "*name* というヘッダに許される最大の数を返します。" -#: ../../library/email.policy.rst:294 msgid "" "Called when a header is added to an :class:`~email.message.EmailMessage` or :" "class:`~email.message.Message` object. If the returned value is not ``0`` " "or ``None``, and there are already a number of headers with the name *name* " "greater than or equal to the value returned, a :exc:`ValueError` is raised." msgstr "" +":class:`~email.message.EmailMessage` または :class:`~email.message.Message` " +"オブジェクトにヘッダを追加するときに呼び出されます。\n" +"返り値が ``0`` でも ``None`` でもなく、*name* という名前のヘッダがすでに返り" +"値以上の個数存在する場合、:exc:`ValueError` が送出されます。" -#: ../../library/email.policy.rst:300 msgid "" "Because the default behavior of ``Message.__setitem__`` is to append the " "value to the list of headers, it is easy to create duplicate headers without " @@ -401,12 +504,17 @@ msgid "" "programmatically. (The limit is not observed by the parser, which will " "faithfully produce as many headers as exist in the message being parsed.)" msgstr "" +"``Message.__setitem__`` のデフォルトの動作はヘッダのリストへの追加であるた" +"め、気付かないうちにヘッダを重複させてしまいがちです。\n" +"このメソッドを使うと、特定のヘッダについて、プログラムから ``Message`` に追加" +"できる個数を制限できます。\n" +"(パーザはこの制限に従わず、解析対象のメッセージにあるヘッダをその個数のまま忠" +"実に生成します。)" #: ../../library/email.policy.rst:308 msgid "The default implementation returns ``None`` for all header names." msgstr "デフォルトの実装は全てのヘッダ名に ``None`` を返します。" -#: ../../library/email.policy.rst:313 msgid "" "The email package calls this method with a list of strings, each string " "ending with the line separation characters found in the source being " @@ -415,8 +523,13 @@ msgid "" "``(name, value)`` tuple that is to be stored in the ``Message`` to represent " "the parsed header." msgstr "" +"email パッケージは文字列のリストを渡してこのメソッドを呼び出します。\n" +"各文字列は解析対象の入力にあった改行文字で終わります。\n" +"最初の行にはヘッダのフィールド名と区切り文字が含まれます。\n" +"入力中の空白文字はすべて保持されます。\n" +"このメソッドは、解析したヘッダを表すために ``Message`` に格納する ``(name, " +"value)`` タプルを返す必要があります。" -#: ../../library/email.policy.rst:320 msgid "" "If an implementation wishes to retain compatibility with the existing email " "package policies, *name* should be the case preserved name (all characters " @@ -424,6 +537,11 @@ msgid "" "(all line separator characters removed, but whitespace kept intact), " "stripped of leading whitespace." msgstr "" +"既存の email パッケージのポリシーとの互換性を維持するには、*name* は大文字・" +"小文字を保持した名前 (区切り文字「``:``」より前のすべての文字) にしてくださ" +"い。\n" +"*value* は折り返しを解除した値 (すべての改行文字を削除し、空白文字は保持した" +"もの) から先頭の空白文字を取り除いたものにしてください。" #: ../../library/email.policy.rst:326 msgid "*sourcelines* may contain surrogateescaped binary data." @@ -436,7 +554,6 @@ msgstr "" msgid "There is no default implementation" msgstr "デフォルトの実装はありません。" -#: ../../library/email.policy.rst:333 msgid "" "The email package calls this method with the name and value provided by the " "application program when the application program is modifying a ``Message`` " @@ -444,15 +561,21 @@ msgid "" "method should return the ``(name, value)`` tuple that is to be stored in the " "``Message`` to represent the header." msgstr "" +"アプリケーションプログラムが ``Message`` をプログラムで変更する場合 (パーザに" +"よる作成とは異なります)、email パッケージはそのプログラムが指定した名前と値を" +"渡してこのメソッドを呼び出します。\n" +"このメソッドは、ヘッダを表すために ``Message`` に格納する ``(name, value)`` " +"タプルを返す必要があります。" -#: ../../library/email.policy.rst:339 msgid "" "If an implementation wishes to retain compatibility with the existing email " "package policies, the *name* and *value* should be strings or string " "subclasses that do not change the content of the passed in arguments." msgstr "" +"既存の email パッケージのポリシーとの互換性を維持するには、*name* と *value* " +"は文字列または文字列のサブクラスで、渡された引数の内容を変更しないものにして" +"ください。" -#: ../../library/email.policy.rst:349 msgid "" "The email package calls this method with the *name* and *value* currently " "stored in the ``Message`` when that header is requested by the application " @@ -462,6 +585,13 @@ msgid "" "method is passed the specific name and value of the header destined to be " "returned to the application." msgstr "" +"アプリケーションプログラムがヘッダを要求すると、email パッケージは現在 " +"``Message`` に格納されている *name* と *value* を渡してこのメソッドを呼び出し" +"ます。\n" +"このメソッドの返り値が、取得するヘッダの値としてアプリケーションに渡されま" +"す。\n" +"``Message`` には同名のヘッダが複数格納されていることがあります。\n" +"このメソッドには、アプリケーションに返す対象のヘッダの名前と値が渡されます。" #: ../../library/email.policy.rst:357 msgid "" @@ -472,7 +602,6 @@ msgstr "" "のメソッドの返り値にはサロゲートエスケープされたバイナリーデータはありませ" "ん。" -#: ../../library/email.policy.rst:365 msgid "" "The email package calls this method with the *name* and *value* currently " "stored in the ``Message`` for a given header. The method should return a " @@ -481,6 +610,12 @@ msgid "" "attr:`linesep` characters at the appropriate places. See :rfc:`5322` for a " "discussion of the rules for folding email headers." msgstr "" +"email パッケージは、対象のヘッダについて現在 ``Message`` に格納されている " +"*name* と *value* を渡してこのメソッドを呼び出します。\n" +"このメソッドは *name* と *value* を組み合わせ、適切な位置に :attr:`linesep` " +"の文字を挿入して、ポリシーの設定に従って正しく「折り返した」ヘッダを表す文字" +"列を返す必要があります。\n" +"電子メールのヘッダの折り返し規則については :rfc:`5322` を参照してください。" #: ../../library/email.policy.rst:372 msgid "" @@ -507,32 +642,40 @@ msgstr "" "*value* はサロゲートエスケープされたバイナリデータを持つことがあります。これ" "らは返されたbytesオブジェクト内でバイナリデータに変換されることがあります。" -#: ../../library/email.policy.rst:388 msgid "" "This concrete :class:`Policy` provides behavior that is intended to be fully " "compliant with the current email RFCs. These include (but are not limited " "to) :rfc:`5322`, :rfc:`2047`, and the current MIME RFCs." msgstr "" +"この具象 :class:`Policy` は、現行の電子メールの RFC に完全に準拠することを意" +"図した動作を提供します。\n" +"対象には :rfc:`5322`、:rfc:`2047`、現行の MIME の RFC などが含まれます。" -#: ../../library/email.policy.rst:392 msgid "" "This policy adds new header parsing and folding algorithms. Instead of " "simple strings, headers are ``str`` subclasses with attributes that depend " "on the type of the field. The parsing and folding algorithm fully " "implement :rfc:`2047` and :rfc:`5322`." msgstr "" +"このポリシーはヘッダの解析と折り返しに新しいアルゴリズムを導入します。\n" +"ヘッダは単純な文字列ではなく、フィールドの種類に応じた属性を持つ ``str`` のサ" +"ブクラスになります。\n" +"解析と折り返しのアルゴリズムは :rfc:`2047` と :rfc:`5322` を完全に実装してい" +"ます。" -#: ../../library/email.policy.rst:397 msgid "" "The default value for the :attr:`~email.policy.Policy.message_factory` " "attribute is :class:`~email.message.EmailMessage`." msgstr "" +":attr:`~email.policy.Policy.message_factory` 属性のデフォルト値は :class:" +"`~email.message.EmailMessage` です。" -#: ../../library/email.policy.rst:400 msgid "" "In addition to the settable attributes listed above that apply to all " "policies, this policy adds the following additional attributes:" msgstr "" +"すべてのポリシーに適用される、上記の設定可能な属性に加え、このポリシーには以" +"下の属性があります:" #: ../../library/email.policy.rst:403 msgid "[1]_" @@ -546,45 +689,46 @@ msgid "" "passed to SMTP servers that support the ``SMTPUTF8`` extension (:rfc:`6531`)." msgstr "" -#: ../../library/email.policy.rst:417 msgid "" "If the value for a header in the ``Message`` object originated from a :mod:" "`~email.parser` (as opposed to being set by a program), this attribute " "indicates whether or not a generator should refold that value when " "transforming the message back into serialized form. The possible values are:" msgstr "" +"``Message`` オブジェクト内のヘッダの値が、プログラムによる設定ではなく :mod:" +"`~email.parser` による解析で得られた場合、この属性はメッセージをシリアライズ" +"された形式に戻す際にジェネレータがその値を折り返し直すかどうかを示します。\n" +"指定できる値は次のとおりです:" #: ../../library/email.policy.rst:424 msgid "``none``" msgstr "``none``" -#: ../../library/email.policy.rst:424 msgid "all source values use original folding" -msgstr "" +msgstr "入力から得られたすべての値について、元の折り返しを使います。" #: ../../library/email.policy.rst:426 msgid "``long``" msgstr "``long``" -#: ../../library/email.policy.rst:426 msgid "" "source values that have any line that is longer than ``max_line_length`` " "will be refolded" msgstr "" +"入力から得られた値に ``max_line_length`` を超える長さの行がある場合、その値を" +"折り返し直します。" #: ../../library/email.policy.rst:429 msgid "``all``" msgstr "``all``" -#: ../../library/email.policy.rst:429 msgid "all values are refolded." -msgstr "" +msgstr "すべての値を折り返し直します。" #: ../../library/email.policy.rst:432 msgid "The default is ``long``." msgstr "デフォルトは ``long`` です。" -#: ../../library/email.policy.rst:437 msgid "" "A callable that takes two arguments, ``name`` and ``value``, where ``name`` " "is a header field name and ``value`` is an unfolded header field value, and " @@ -594,8 +738,14 @@ msgid "" "field types, and the major MIME header field stypes. Support for additional " "custom parsing will be added in the future." msgstr "" +"ヘッダのフィールド名 ``name`` と折り返しを解除したフィールド値 ``value`` の " +"2 つの引数を取り、そのヘッダを表す文字列のサブクラスを返す呼び出し可能オブ" +"ジェクトです。\n" +"デフォルトの ``header_factory`` (:mod:`~email.headerregistry` を参照) は、:" +"RFC:`5322` の各種アドレス・日付ヘッダフィールドと、主要な MIME ヘッダフィール" +"ドに応じた解析をサポートしています。\n" +"今後、さらに独自の解析への対応が追加される予定です。" -#: ../../library/email.policy.rst:448 msgid "" "An object with at least two methods: get_content and set_content. When the :" "meth:`~email.message.EmailMessage.get_content` or :meth:`~email.message." @@ -605,6 +755,16 @@ msgid "" "that were passed to it as additional arguments. By default " "``content_manager`` is set to :data:`~email.contentmanager.raw_data_manager`." msgstr "" +"少なくとも ``get_content`` と ``set_content`` の 2 つのメソッドを持つオブジェ" +"クトです。\n" +":class:`~email.message.EmailMessage` オブジェクトの :meth:`~email.message." +"EmailMessage.get_content` または :meth:`~email.message.EmailMessage." +"set_content` メソッドが呼び出されると、このオブジェクトの対応するメソッドを呼" +"び出します。\n" +"その際、最初の引数としてメッセージオブジェクトを渡し、元の呼び出しで渡された" +"引数やキーワード引数を追加の引数として渡します。\n" +"デフォルトでは ``content_manager`` は :data:`~email.contentmanager." +"raw_data_manager` に設定されています。" #: ../../library/email.policy.rst:460 ../../library/email.policy.rst:618 msgid "" @@ -612,22 +772,24 @@ msgid "" "methods of :class:`Policy`:" msgstr "このクラスは :class:`Policy` の抽象メソッドの具象実装を提供します:" -#: ../../library/email.policy.rst:466 msgid "" "Returns the value of the :attr:`~email.headerregistry.BaseHeader.max_count` " "attribute of the specialized class used to represent the header with the " "given name." msgstr "" +"指定された名前のヘッダを表す専用クラスの :attr:`~email.headerregistry." +"BaseHeader.max_count` 属性の値を返します。" -#: ../../library/email.policy.rst:474 ../../library/email.policy.rst:624 msgid "" "The name is parsed as everything up to the '``:``' and returned unmodified. " "The value is determined by stripping leading whitespace off the remainder of " "the first line, joining all subsequent lines together, and stripping any " "trailing carriage return or linefeed characters." msgstr "" +"名前は「``:``」より前のすべての文字として解析され、そのまま返されます。\n" +"値は、最初の行の残りから先頭の空白文字を取り除き、その後のすべての行を連結" +"し、末尾の復帰文字や改行文字を取り除いて求めます。" -#: ../../library/email.policy.rst:482 msgid "" "The name is returned unchanged. If the input value has a ``name`` attribute " "and it matches *name* ignoring case, the value is returned unchanged. " @@ -635,6 +797,13 @@ msgid "" "resulting header object is returned as the value. In this case a " "``ValueError`` is raised if the input value contains CR or LF characters." msgstr "" +"名前は変更せずに返します。\n" +"入力値に ``name`` 属性があり、大文字・小文字を区別せずに *name* と一致する場" +"合、値はそのまま返します。\n" +"それ以外の場合は *name* と *value* を ``header_factory`` に渡し、得られたヘッ" +"ダオブジェクトを値として返します。\n" +"この場合、入力値に CR または LF 文字が含まれていると ``ValueError`` を送出し" +"ます。" #: ../../library/email.policy.rst:492 msgid "" @@ -645,7 +814,6 @@ msgid "" "character glyph." msgstr "" -#: ../../library/email.policy.rst:501 msgid "" "Header folding is controlled by the :attr:`refold_source` policy setting. A " "value is considered to be a 'source value' if and only if it does not have a " @@ -656,8 +824,15 @@ msgid "" "Folding of a header object is done by calling its ``fold`` method with the " "current policy." msgstr "" +"ヘッダの折り返しはポリシーの :attr:`refold_source` 設定で制御します。\n" +"``name`` 属性を持たない値だけを「入力から得られた値」とみなします (``name`` " +"属性がある場合は何らかのヘッダオブジェクトです)。\n" +"ポリシーに従って入力から得られた値を折り返し直す必要がある場合は、*name* と、" +"CR や LF 文字を取り除いた *value* を ``header_factory`` に渡し、ヘッダオブ" +"ジェクトに変換します。\n" +"ヘッダオブジェクトの折り返しは、現在のポリシーを渡してその ``fold`` メソッド" +"を呼び出すことで行います。" -#: ../../library/email.policy.rst:510 msgid "" "Source values are split into lines using :meth:`~str.splitlines`. If the " "value is not to be refolded, the lines are rejoined using the ``linesep`` " @@ -666,6 +841,12 @@ msgid "" "``refold_source`` setting, which causes the binary data to be CTE encoded " "using the ``unknown-8bit`` charset." msgstr "" +"入力から得られた値は :meth:`~str.splitlines` で行に分割されます。\n" +"折り返し直さない場合は、ポリシーの ``linesep`` を使って行を再び連結し、返しま" +"す。\n" +"ただし非 ASCII のバイナリデータを含む行は例外です。\n" +"この場合は ``refold_source`` の設定にかかわらず値を折り返し直し、" +"``unknown-8bit`` 文字セットを使ってバイナリデータを CTE エンコードします。" #: ../../library/email.policy.rst:520 msgid "" @@ -683,13 +864,16 @@ msgid "" "binary data consists of single byte characters or multibyte characters." msgstr "" -#: ../../library/email.policy.rst:530 msgid "" "The following instances of :class:`EmailPolicy` provide defaults suitable " "for specific application domains. Note that in the future the behavior of " "these instances (in particular the ``HTTP`` instance) may be adjusted to " "conform even more closely to the RFCs relevant to their domains." msgstr "" +"以下の :class:`EmailPolicy` インスタンスは、特定の用途に適したデフォルト値を" +"提供します。\n" +"今後、各用途に関係する RFC にさらに厳密に準拠するよう、これらのインスタンス " +"(特に ``HTTP`` インスタンス) の動作が調整される可能性があります。" #: ../../library/email.policy.rst:538 msgid "" @@ -700,13 +884,14 @@ msgstr "" "デフォルト値を変更していない ``EmailPolicy`` のインスタンスです。このポリシー" "の行末は、 RFC で正しい ``\\r\\n`` ではなく Python の標準の ``\\n`` です。" -#: ../../library/email.policy.rst:545 msgid "" "Suitable for serializing messages in conformance with the email RFCs. Like " "``default``, but with ``linesep`` set to ``\\r\\n``, which is RFC compliant." msgstr "" +"電子メールの RFC に準拠してメッセージをシリアライズするのに適しています。\n" +"``default`` と同様ですが、``linesep`` は RFC に準拠した ``\\r\\n`` に設定され" +"ています。" -#: ../../library/email.policy.rst:552 msgid "" "The same as ``SMTP`` except that :attr:`~EmailPolicy.utf8` is ``True``. " "Useful for serializing messages to a message store without using encoded " @@ -714,49 +899,64 @@ msgid "" "sender or recipient addresses have non-ASCII characters (the :meth:`smtplib." "SMTP.send_message` method handles this automatically)." msgstr "" +":attr:`~EmailPolicy.utf8` が ``True`` である点を除き、``SMTP`` と同じです。\n" +"ヘッダに encoded words を使わず、メッセージの保存先にシリアライズするのに便利" +"です。\n" +"SMTP 送信では、送信者または受信者のアドレスに非 ASCII 文字が含まれる場合だけ" +"使ってください (:meth:`smtplib.SMTP.send_message` メソッドはこれを自動的に処" +"理します)。" -#: ../../library/email.policy.rst:561 msgid "" "Suitable for serializing headers with for use in HTTP traffic. Like " "``SMTP`` except that ``max_line_length`` is set to ``None`` (unlimited)." msgstr "" +"HTTP 通信で使うヘッダのシリアライズに適しています。\n" +"``SMTP`` と同様ですが、``max_line_length`` は ``None`` (無制限) に設定されて" +"います。" -#: ../../library/email.policy.rst:567 msgid "" "Convenience instance. The same as ``default`` except that " "``raise_on_defect`` is set to ``True``. This allows any policy to be made " "strict by writing::" msgstr "" +"便宜的に用意されたインスタンスです。\n" +"``raise_on_defect`` が ``True`` に設定されている点を除き、``default`` と同じ" +"です。\n" +"次のように書くと、任意のポリシーを厳格にできます。 ::" -#: ../../library/email.policy.rst:571 msgid "somepolicy + policy.strict" -msgstr "" +msgstr "somepolicy + policy.strict" -#: ../../library/email.policy.rst:574 msgid "" "With all of these :class:`EmailPolicies <.EmailPolicy>`, the effective API " "of the email package is changed from the Python 3.2 API in the following " "ways:" msgstr "" +"これらの :class:`EmailPolicy <.EmailPolicy>` では、email パッケージの実際の " +"API は Python 3.2 の API から以下のように変わります:" -#: ../../library/email.policy.rst:577 msgid "" "Setting a header on a :class:`~email.message.Message` results in that header " "being parsed and a header object created." msgstr "" +":class:`~email.message.Message` にヘッダを設定すると、そのヘッダが解析されて" +"ヘッダオブジェクトが作成されます。" -#: ../../library/email.policy.rst:580 msgid "" "Fetching a header value from a :class:`~email.message.Message` results in " "that header being parsed and a header object created and returned." msgstr "" +":class:`~email.message.Message` からヘッダの値を取得すると、そのヘッダが解析" +"されてヘッダオブジェクトが作成され、返されます。" -#: ../../library/email.policy.rst:584 msgid "" "Any header object, or any header that is refolded due to the policy " "settings, is folded using an algorithm that fully implements the RFC folding " "algorithms, including knowing where encoded words are required and allowed." msgstr "" +"すべてのヘッダオブジェクトと、ポリシー設定によって折り返し直されるヘッダに" +"は、RFC の折り返しアルゴリズムを完全に実装したアルゴリズムが使われます。\n" +"このアルゴリズムは encoded words が必要な位置と許可される位置も判断します。" #: ../../library/email.policy.rst:589 msgid "" @@ -799,22 +999,28 @@ msgstr "デフォルトは ``True`` です。" msgid "The name and value are returned unmodified." msgstr "名前と値は変更されずに返されます。" -#: ../../library/email.policy.rst:637 msgid "" "If the value contains binary data, it is converted into a :class:`~email." "header.Header` object using the ``unknown-8bit`` charset. Otherwise it is " "returned unmodified." msgstr "" +"値にバイナリデータが含まれる場合、``unknown-8bit`` 文字セットを使って :class:" +"`~email.header.Header` オブジェクトに変換します。\n" +"それ以外の場合はそのまま返します。" -#: ../../library/email.policy.rst:644 msgid "" "Headers are folded using the :class:`~email.header.Header` folding " "algorithm, which preserves existing line breaks in the value, and wraps each " "resulting line to the ``max_line_length``. Non-ASCII binary data are CTE " "encoded using the ``unknown-8bit`` charset." msgstr "" +"ヘッダは :class:`~email.header.Header` の折り返しアルゴリズムで折り返しま" +"す。\n" +"このアルゴリズムは値に含まれる既存の改行を保持し、各行を ``max_line_length`` " +"に収まるように折り返します。\n" +"非 ASCII のバイナリデータは ``unknown-8bit`` 文字セットを使って CTE エンコー" +"ドされます。" -#: ../../library/email.policy.rst:652 msgid "" "Headers are folded using the :class:`~email.header.Header` folding " "algorithm, which preserves existing line breaks in the value, and wraps each " @@ -823,6 +1029,14 @@ msgid "" "Otherwise the original source header is used, with its existing line breaks " "and any (RFC invalid) binary data it may contain." msgstr "" +"ヘッダは :class:`~email.header.Header` の折り返しアルゴリズムで折り返しま" +"す。\n" +"このアルゴリズムは値に含まれる既存の改行を保持し、各行を ``max_line_length`` " +"に収まるように折り返します。\n" +"``cte_type`` が ``7bit`` の場合、非 ASCII のバイナリデータは " +"``unknown-8bit`` 文字セットを使って CTE エンコードされます。\n" +"それ以外の場合は入力のヘッダをそのまま使い、既存の改行と、含まれていればバイ" +"ナリデータ (RFC では無効です) を保持します。" #: ../../library/email.policy.rst:662 msgid "" @@ -836,8 +1050,9 @@ msgstr "" msgid "Footnotes" msgstr "脚注" -#: ../../library/email.policy.rst:668 msgid "" "Originally added in 3.3 as a :term:`provisional feature `." msgstr "" +"当初は 3.3 で :term:`暫定的な機能 ` として追加されまし" +"た。" diff --git a/library/email.utils.po b/library/email.utils.po index bbe463641..4c7c2652d 100644 --- a/library/email.utils.po +++ b/library/email.utils.po @@ -17,15 +17,14 @@ msgstr "" "Last-Translator: tomo, 2021\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" -#: ../../library/email.utils.rst:2 msgid ":mod:`!email.utils`: Miscellaneous utilities" -msgstr "" +msgstr ":mod:`!email.utils`: 各種ユーティリティ" #: ../../library/email.utils.rst:7 msgid "**Source code:** :source:`Lib/email/utils.py`" @@ -48,9 +47,8 @@ msgid "" "``None``), it is assumed to be in local time." msgstr "" -#: ../../library/email.utils.rst:24 msgid "The *isdst* parameter." -msgstr "" +msgstr "*isdst* パラメータ。" #: ../../library/email.utils.rst:29 msgid "" @@ -67,13 +65,15 @@ msgstr "" msgid "Added the *domain* keyword." msgstr "*domain* キーワードが追加されました。" -#: ../../library/email.utils.rst:41 msgid "" "The remaining functions are part of the legacy (``Compat32``) email API. " "There is no need to directly use these with the new API, since the parsing " "and formatting they provide is done automatically by the header parsing " "machinery of the new API." msgstr "" +"以下の関数は従来の (``Compat32``) email API の一部です。\n" +"新しい API ではヘッダの解析機構がこれらの解析や書式化を自動的に行うため、直接" +"使う必要はありません。" #: ../../library/email.utils.rst:49 msgid "" @@ -94,26 +94,27 @@ msgstr "" "がダブルクォートだった場合、それらは取り除かれます。同様に *str* の先頭と末尾" "が角ブラケット (<、>) だった場合もそれらは取り除かれます。" -#: ../../library/email.utils.rst:62 msgid "" "Parse address -- which should be the value of some address-containing field " "such as :mailheader:`To` or :mailheader:`Cc` -- into its constituent " "*realname* and *email address* parts. Returns a tuple of that information, " "unless the parse fails, in which case a 2-tuple of ``('', '')`` is returned." msgstr "" -":mailheader:`To` や :mailheader:`Cc` のようなフィールドを持つアドレスをパース" -"して、構成要素の *実名* と *電子メールアドレス* を取り出します。 パースに成功" -"した場合、これらの情報持つタプルを返します。失敗した場合は 2 要素のタプル " +"アドレスを解析して、構成要素である *実名* と *電子メールアドレス* に分けま" +"す。\n" +"渡すアドレスは :mailheader:`To` や :mailheader:`Cc` など、アドレスを含む" +"フィールドの値です。\n" +"解析に成功した場合はこれらの情報をタプルで返し、失敗した場合は 2 要素タプル " "``('', '')`` を返します。" -#: ../../library/email.utils.rst:67 ../../library/email.utils.rst:95 msgid "" "If *strict* is true, use a strict parser which rejects malformed inputs." -msgstr "" +msgstr "*strict* が真の場合、不正な入力を拒否する厳格なパーザを使います。" -#: ../../library/email.utils.rst:69 ../../library/email.utils.rst:107 msgid "Add *strict* optional parameter and reject malformed inputs by default." msgstr "" +"オプションのパラメータ *strict* が追加され、デフォルトで不正な入力を拒否する" +"ようになりました。" #: ../../library/email.utils.rst:75 msgid "" @@ -148,11 +149,9 @@ msgid "" "be returned by :meth:`Message.get_all `." msgstr "" -#: ../../library/email.utils.rst:97 msgid "Here's a simple example that gets all the recipients of a message::" -msgstr "" +msgstr "メッセージのすべての受信者を取得する簡単な例を示します。 ::" -#: ../../library/email.utils.rst:99 msgid "" "from email.utils import getaddresses\n" "\n" @@ -162,6 +161,13 @@ msgid "" "resent_ccs = msg.get_all('resent-cc', [])\n" "all_recipients = getaddresses(tos + ccs + resent_tos + resent_ccs)" msgstr "" +"from email.utils import getaddresses\n" +"\n" +"tos = msg.get_all('to', [])\n" +"ccs = msg.get_all('cc', [])\n" +"resent_tos = msg.get_all('resent-to', [])\n" +"resent_ccs = msg.get_all('resent-cc', [])\n" +"all_recipients = getaddresses(tos + ccs + resent_tos + resent_ccs)" #: ../../library/email.utils.rst:113 msgid "" @@ -183,7 +189,6 @@ msgstr "" "失敗した場合は ``None`` を返します。\n" "返されるタプルの 6、7、8番目の添字は使用不可なので注意してください。" -#: ../../library/email.utils.rst:124 msgid "" "Performs the same function as :func:`parsedate`, but returns either ``None`` " "or a 10-tuple; the first 9 elements make up a tuple that can be passed " @@ -193,6 +198,15 @@ msgid "" "returned is ``0``, which represents UTC. Note that indexes 6, 7, and 8 of " "the result tuple are not usable." msgstr "" +":func:`parsedate` と同じ処理を行いますが、``None`` または 10 要素タプルを返し" +"ます。\n" +"最初の 9 要素は :func:`time.mktime` に直接渡せるタプルを構成し、10 番目の要素" +"は日付のタイムゾーンの UTC (グリニッジ標準時の正式名称) からのオフセットです " +"[#]_。\n" +"入力文字列にタイムゾーンがなければ、返されるタプルの最後の要素は UTC を表す " +"``0`` です。\n" +"返されたタプルのインデックス 6、7、8 の要素は使用できないことに注意してくださ" +"い。" #: ../../library/email.utils.rst:134 msgid "" @@ -222,9 +236,8 @@ msgstr "" msgid "Returns a date string as per :rfc:`2822`, e.g.::" msgstr "日付を :rfc:`2822` 形式の文字列で返します。例::" -#: ../../library/email.utils.rst:159 msgid "Fri, 09 Nov 2001 01:08:47 -0000" -msgstr "" +msgstr "Fri, 09 Nov 2001 01:08:47 -0000" #: ../../library/email.utils.rst:161 msgid "" @@ -318,13 +331,13 @@ msgstr "" "場合には、これは文字列でなければなりません。その場合にはクォートを除いた文字" "列を返します。" -#: ../../library/email.utils.rst:220 msgid "" "Decode parameters list according to :rfc:`2231`. *params* is a sequence of " "2-tuples containing elements of the form ``(content-type, string-value)``." msgstr "" -":rfc:`2231` に従って引数のリストをデコードします。 *params* は ``(content-" -"type, string-value)`` のような形式の 2 要素タプルです。" +":rfc:`2231` に従ってパラメータのリストをデコードします。\n" +"*params* は ``(content-type, string-value)`` 形式の 2 要素タプルからなるシー" +"ケンスです。" #: ../../library/email.utils.rst:225 msgid "Footnotes" diff --git a/library/ensurepip.po b/library/ensurepip.po index 75c084f9f..122943cdd 100644 --- a/library/ensurepip.po +++ b/library/ensurepip.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: tomo, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/ensurepip.rst:2 @@ -47,18 +47,17 @@ msgstr "" "な安定版が CPython リファレンスインタープリタのメンテナンスリリースや " "feature リリースにバンドルされていることを反映しています。" -#: ../../library/ensurepip.rst:21 msgid "" "In most cases, end users of Python shouldn't need to invoke this module " "directly (as ``pip`` should be bootstrapped by default), but it may be " "needed if installing ``pip`` was skipped when installing Python (or when " "creating a virtual environment) or after explicitly uninstalling ``pip``." msgstr "" -"ほとんどの場合、Python のエンドユーザーがこのモジュールを直接呼び出す必要はな" -"いでしょう(``pip`` はデフォルトでブートストラップされるからです)。しかし、も" -"し Python のインストール時に ``pip`` のインストールをスキップしたり、仮想環境" -"を構築したり、明示的に ``pip`` をアンインストールした場合、直接呼び出す必要が" -"あるかもしれません。" +"通常、``pip`` はデフォルトでブートストラップされるため、Python のエンドユー" +"ザーがこのモジュールを直接呼び出す必要はありません。\n" +"ただし、Python のインストール時や仮想環境の作成時に ``pip`` のインストールを" +"省略した場合や、``pip`` を明示的にアンインストールした場合には、必要になるこ" +"とがあります。" #: ../../library/ensurepip.rst:29 msgid "" @@ -84,15 +83,16 @@ msgstr ":pep:`453`: Python インストールの際の明示的なpipのブー msgid "The original rationale and specification for this module." msgstr "このモジュールのもともとの論拠と仕様。" -#: ../../includes/wasm-mobile-notavail.rst:3 msgid "Availability" -msgstr "" +msgstr "利用可能な環境" #: ../../includes/wasm-mobile-notavail.rst:5 msgid "" "This module is not supported on :ref:`mobile platforms ` or :ref:`WebAssembly platforms `." msgstr "" +"このモジュールは :ref:`モバイルプラットフォーム ` と :" +"ref:`WebAssemblyプラットフォーム ` をサポートしません。" #: ../../library/ensurepip.rst:44 msgid "Command line interface" @@ -109,25 +109,22 @@ msgstr "" msgid "The simplest possible invocation is::" msgstr "最も簡単な起動方法は::" -#: ../../library/ensurepip.rst:52 msgid "python -m ensurepip" -msgstr "" +msgstr "python -m ensurepip" -#: ../../library/ensurepip.rst:54 msgid "" "This invocation will install ``pip`` if it is not already installed, but " "otherwise does nothing. To ensure the installed version of ``pip`` is at " "least as recent as the one available in ``ensurepip``, pass the ``--" "upgrade`` option::" msgstr "" -"この起動方法は ``pip`` をインストールします。既にインストールされていた場合は" -"何もしません。インストールされた ``pip`` のバージョンを ``ensurepip`` で利用" -"できるもののうち、できるだけ新しいものにするためには、``--upgrade`` オプショ" -"ンを追加して::" +"この方法で起動すると、``pip`` が未インストールならインストールし、インストー" +"ル済みなら何もしません。\n" +"インストールされている ``pip`` を、``ensurepip`` に同梱されたものと同じかそれ" +"より新しいバージョンにするには、``--upgrade`` オプションを指定します。 ::" -#: ../../library/ensurepip.rst:59 msgid "python -m ensurepip --upgrade" -msgstr "" +msgstr "python -m ensurepip --upgrade" #: ../../library/ensurepip.rst:61 msgid "" @@ -140,19 +137,23 @@ msgstr "" "イトパッケージ(もしアクティブな仮想環境がなければ)にインストールされます。イ" "ンストール先は2つの追加コマンドラインオプションで制御できます:" -#: ../../library/ensurepip.rst:68 msgid "" "Installs ``pip`` relative to the given root directory rather than the root " "of the currently active virtual environment (if any) or the default root for " "the current Python installation." msgstr "" +"現在有効な仮想環境があればそのルート、なければ現在の Python のデフォルトの" +"ルートではなく、指定されたルートディレクトリを基準に ``pip`` をインストールし" +"ます。" -#: ../../library/ensurepip.rst:74 msgid "" "Installs ``pip`` into the user site packages directory rather than globally " "for the current Python installation (this option is not permitted inside an " "active virtual environment)." msgstr "" +"現在の Python 環境全体ではなく、ユーザーの site-packages ディレクトリに " +"``pip`` をインストールします (有効な仮想環境内ではこのオプションは使えませ" +"ん)。" #: ../../library/ensurepip.rst:78 msgid "" @@ -164,17 +165,19 @@ msgstr "" "``ensurepip`` を起動したPythonのバージョン)。インストールされるスクリプトは2" "つの追加コマンドラインオプションで制御できます:" -#: ../../library/ensurepip.rst:85 msgid "" "If an alternate installation is requested, the ``pipX`` script will *not* be " "installed." msgstr "" +"代替インストールを指定すると、``pipX`` スクリプトはインストール *されません" +"*。" -#: ../../library/ensurepip.rst:90 msgid "" "If a \"default pip\" installation is requested, the ``pip`` script will be " "installed in addition to the two regular scripts." msgstr "" +"「デフォルトの pip」のインストールを指定すると、通常の 2 つのスクリプトに加え" +"て ``pip`` スクリプトもインストールされます。" #: ../../library/ensurepip.rst:93 msgid "" diff --git a/library/enum.po b/library/enum.po index 2c1e46e82..2b61d2c7e 100644 --- a/library/enum.po +++ b/library/enum.po @@ -20,10 +20,10 @@ msgstr "" "Last-Translator: Arihiro TAKASE, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/enum.rst:2 @@ -85,7 +85,6 @@ msgstr "" "列挙型は、:keyword:`class` 構文を使用するか、関数呼び出し構文を使用して作成さ" "れます::" -#: ../../library/enum.rst:38 msgid "" ">>> from enum import Enum\n" "\n" @@ -98,6 +97,16 @@ msgid "" ">>> # functional syntax\n" ">>> Color = Enum('Color', [('RED', 1), ('GREEN', 2), ('BLUE', 3)])" msgstr "" +">>> from enum import Enum\n" +"\n" +">>> # class 構文\n" +">>> class Color(Enum):\n" +"... RED = 1\n" +"... GREEN = 2\n" +"... BLUE = 3\n" +"\n" +">>> # 関数呼び出し構文\n" +">>> Color = Enum('Color', [('RED', 1), ('GREEN', 2), ('BLUE', 3)])" #: ../../library/enum.rst:49 msgid "" @@ -187,7 +196,7 @@ msgid "" "bitwise operations without losing their :class:`Flag` membership." msgstr "" "列挙型定数を作成する基底クラスで、ビット演算を使って組み合わせられ、その結果" -"も :class:`IntFlag` メンバーになります。" +"も :class:`Flag` メンバーになります。" #: ../../library/enum.rst:90 msgid ":class:`IntFlag`" @@ -242,13 +251,13 @@ msgstr "" " ``STRICT``、``CONFORM``、``EJECT``、``KEEP`` の値を持つ列挙型です。列挙型で" "の無効な値の扱いについて、より細かい制御が可能です。" -#: ../../library/enum.rst:113 msgid ":class:`EnumDict`" -msgstr "" +msgstr ":class:`EnumDict`" -#: ../../library/enum.rst:115 msgid "A subclass of :class:`dict` for use when subclassing :class:`EnumType`." msgstr "" +":class:`EnumType` のサブクラスを作成するときに使う :class:`dict` のサブクラス" +"です。" #: ../../library/enum.rst:117 msgid ":class:`auto`" @@ -292,11 +301,12 @@ msgstr "" msgid ":func:`verify`" msgstr ":func:`verify`" -#: ../../library/enum.rst:135 msgid "" "Enum class decorator that checks user-selectable constraints on an " "enumeration." msgstr "" +"列挙型が、利用者の選択した制約を満たすか確認する Enum クラスのデコレータで" +"す。" #: ../../library/enum.rst:138 msgid ":func:`member`" @@ -318,12 +328,14 @@ msgstr "``obj`` をメンバーにしません。デコレータとして使用 msgid ":func:`global_enum`" msgstr ":func:`global_enum`" -#: ../../library/enum.rst:148 msgid "" "Modify the :class:`str() ` and :func:`repr` of an enum to show its " "members as belonging to the module instead of its class, and export the enum " "members to the global namespace." msgstr "" +"列挙型の :class:`str() ` と :func:`repr` を変更し、メンバーがクラスでは" +"なくモジュールに属するように表示します。\n" +"また、列挙型のメンバーをグローバル名前空間に公開します。" #: ../../library/enum.rst:152 msgid ":func:`show_flag_values`" @@ -345,9 +357,8 @@ msgstr "" "``StrEnum``, ``EnumCheck``, ``ReprEnum``, ``FlagBoundary``, ``property``, " "``member``, ``nonmember``, ``global_enum``, ``show_flag_values``" -#: ../../library/enum.rst:159 msgid "``EnumDict``" -msgstr "" +msgstr "``EnumDict``" #: ../../library/enum.rst:164 msgid "Data Types" @@ -363,13 +374,16 @@ msgstr "" "*EnumType* のサブクラスを作成することが可能です -- 詳細は :ref:`EnumTypeのサ" "ブクラスを作る ` を参照してください。" -#: ../../library/enum.rst:173 msgid "" "``EnumType`` is responsible for setting the correct :meth:`!__repr__`, :meth:" "`!__str__`, :meth:`!__format__`, and :meth:`!__reduce__` methods on the " "final *enum*, as well as creating the enum members, properly handling " "duplicates, providing iteration over the enum class, etc." msgstr "" +"``EnumType`` は、最終的な *enum* に正しい :meth:`!__repr__`、:meth:`!" +"__str__`、:meth:`!__format__`、:meth:`!__reduce__` メソッドを設定します。\n" +"また、列挙型のメンバーの作成、重複の適切な処理、列挙型クラスの反復処理の提供" +"なども担当します。" #: ../../library/enum.rst:180 msgid "This method is called in two different ways:" @@ -409,7 +423,7 @@ msgstr "新しく作成するEnumの名前。" #: ../../library/enum.rst:0 msgid "names" -msgstr "names" +msgstr "名前" #: ../../library/enum.rst:192 msgid "The names/values of the members for the new Enum." @@ -427,9 +441,8 @@ msgstr "新しく作成するEnumの属するモジュール名。" msgid "qualname" msgstr "qualname" -#: ../../library/enum.rst:194 msgid "The actual location in the module where this Enum can be found." -msgstr "" +msgstr "この Enum がモジュール内にある実際の位置。" #: ../../library/enum.rst:0 msgid "type" @@ -460,7 +473,6 @@ msgstr "bit演算での範囲外の値の扱い方(:class:`Flag` のみ)。" msgid "Returns ``True`` if member belongs to the ``cls``::" msgstr "メンバーが ``cls`` に属している場合は ``True`` を返します::" -#: ../../library/enum.rst:203 msgid "" ">>> some_var = Color.RED\n" ">>> some_var in Color\n" @@ -468,14 +480,18 @@ msgid "" ">>> Color.RED.value in Color\n" "True" msgstr "" +">>> some_var = Color.RED\n" +">>> some_var in Color\n" +"True\n" +">>> Color.RED.value in Color\n" +"True" -#: ../../library/enum.rst:211 msgid "" "Before Python 3.12, a ``TypeError`` is raised if a non-Enum-member is used " "in a containment check." msgstr "" -"Python 3.12 以前では、非Enumメンバーの包含判定が行われた場合、``TypeError`` " -"が送出されます。" +"Python 3.12 より前では、非Enumメンバーの包含判定が行われた場合、" +"``TypeError`` が送出されます。" #: ../../library/enum.rst:216 msgid "" @@ -485,59 +501,67 @@ msgstr "" "``['__class__', '__doc__', '__members__', '__module__']`` と、 *cls* に属する" "メンバー名を返します::" -#: ../../library/enum.rst:219 msgid "" ">>> dir(Color)\n" "['BLUE', 'GREEN', 'RED', '__class__', '__contains__', '__doc__', " "'__getitem__', '__init_subclass__', '__iter__', '__len__', '__members__', " "'__module__', '__name__', '__qualname__']" msgstr "" +">>> dir(Color)\n" +"['BLUE', 'GREEN', 'RED', '__class__', '__contains__', '__doc__', " +"'__getitem__', '__init_subclass__', '__iter__', '__len__', '__members__', " +"'__module__', '__name__', '__qualname__']" -#: ../../library/enum.rst:224 msgid "" "Returns the Enum member in *cls* matching *name*, or raises a :exc:" "`KeyError`::" -msgstr "*cls* 内の一致するメンバーを返すか、:exc:`KeyError` を送出します::" +msgstr "" +"*cls* 内で *name* に一致する Enum メンバーを返します。\n" +"見つからなければ :exc:`KeyError` を送出します。 ::" -#: ../../library/enum.rst:226 msgid "" ">>> Color['BLUE']\n" "" msgstr "" +">>> Color['BLUE']\n" +"" -#: ../../library/enum.rst:231 msgid "Returns each member in *cls* in definition order::" -msgstr " *cls* 内の各メンバー を定義順に返します::" +msgstr "*cls* 内の各メンバー を定義順に返します::" -#: ../../library/enum.rst:233 msgid "" ">>> list(Color)\n" "[, , ]" msgstr "" +">>> list(Color)\n" +"[, , ]" #: ../../library/enum.rst:238 msgid "Returns the number of member in *cls*::" msgstr "*cls* 内のメンバーの数を返します。::" -#: ../../library/enum.rst:240 msgid "" ">>> len(Color)\n" "3" msgstr "" +">>> len(Color)\n" +"3" -#: ../../library/enum.rst:245 msgid "Returns a mapping of every enum name to its member, including aliases" msgstr "" +"エイリアスも含め、列挙型のすべての名前を対応するメンバーに結び付けるマッピン" +"グを返します。" #: ../../library/enum.rst:249 msgid "Returns each member in *cls* in reverse definition order::" msgstr "*cls* 内の各メンバー を定義順の逆順で返します::" -#: ../../library/enum.rst:251 msgid "" ">>> list(reversed(Color))\n" "[, , ]" msgstr "" +">>> list(reversed(Color))\n" +"[, , ]" #: ../../library/enum.rst:256 msgid "" @@ -551,11 +575,12 @@ msgid "" "`ValueError` if the value is already linked with a different member." msgstr "" -#: ../../library/enum.rst:266 msgid "" "Before 3.11 ``EnumType`` was called ``EnumMeta``, which is still available " "as an alias." msgstr "" +"3.11 より前は ``EnumType`` は ``EnumMeta`` と呼ばれていました。\n" +"この名前は現在もエイリアスとして使えます。" #: ../../library/enum.rst:271 msgid "*Enum* is the base class for all *enum* enumerations." @@ -565,25 +590,28 @@ msgstr "*Enum* は全ての *enum* 列挙型の基底クラスです。" msgid "The name used to define the ``Enum`` member::" msgstr "``Enum`` メンバーを定義するために使用される名前::" -#: ../../library/enum.rst:277 msgid "" ">>> Color.BLUE.name\n" "'BLUE'" msgstr "" +">>> Color.BLUE.name\n" +"'BLUE'" #: ../../library/enum.rst:282 msgid "The value given to the ``Enum`` member::" msgstr "``Enum`` メンバーに与えられた値::" -#: ../../library/enum.rst:284 msgid "" ">>> Color.RED.value\n" "1" msgstr "" +">>> Color.RED.value\n" +"1" -#: ../../library/enum.rst:287 ../../library/enum.rst:307 msgid "Value of the member, can be set in :meth:`~Enum.__new__`." msgstr "" +"メンバーの値です。\n" +":meth:`~Enum.__new__` で設定できます。" #: ../../library/enum.rst:289 msgid "Enum member values" @@ -600,17 +628,19 @@ msgstr "" "値が選ばれます。\n" "詳細は :class:`auto` を参照してください。" -#: ../../library/enum.rst:296 msgid "" "While mutable/unhashable values, such as :class:`dict`, :class:`list` or a " "mutable :class:`~dataclasses.dataclass`, can be used, they will have a " "quadratic performance impact during creation relative to the total number of " "mutable/unhashable values in the enum." msgstr "" +":class:`dict`、:class:`list`、ミュータブルな :class:`~dataclasses.dataclass` " +"など、ミュータブルまたはハッシュ不可能な値も使えます。\n" +"ただし作成時の処理時間には、列挙型内のそのような値の総数に対して二次的に増大" +"する影響があります。" -#: ../../library/enum.rst:303 msgid "Name of the member." -msgstr "" +msgstr "メンバーの名前。" #: ../../library/enum.rst:311 msgid "" @@ -775,16 +805,17 @@ msgstr "" "ラス(例えば ``int`` など)のいずれかで、メンバーに代入されたすべての値が渡さ" "れます。例::" -#: ../../library/enum.rst:413 msgid "" "results in the call ``int('1a', 16)`` and a value of ``26`` for the member." msgstr "" +"この場合は ``int('1a', 16)`` が呼び出され、メンバーの値は ``26`` になります。" -#: ../../library/enum.rst:417 msgid "" "When writing a custom ``__new__``, do not use ``super().__new__`` -- call " "the appropriate ``__new__`` instead." msgstr "" +"独自の ``__new__`` を書く場合、``super().__new__`` を使わず、適切な " +"``__new__`` を直接呼び出してください。" #: ../../library/enum.rst:422 msgid "" @@ -866,13 +897,16 @@ msgstr "" msgid "Added :ref:`enum-dataclass-support`" msgstr ":ref:`enum-dataclass-support` の追加" -#: ../../library/enum.rst:476 msgid "" "*IntEnum* is the same as :class:`Enum`, but its members are also integers " "and can be used anywhere that an integer can be used. If any integer " "operation is performed with an *IntEnum* member, the resulting value loses " "its enumeration status." msgstr "" +"*IntEnum* は :class:`Enum` と同様ですが、メンバーは整数でもあり、整数が使える" +"場所ならどこでも使えます。\n" +"*IntEnum* のメンバーを使って整数演算を行うと、結果の値は列挙型ではなくなりま" +"す。" #: ../../library/enum.rst:497 msgid "" @@ -930,18 +964,19 @@ msgstr "" "するために :meth:`!str.__str__` となりました。 :meth:`~object.__format__` も" "同様に、同じ理由で :meth:`!str.__format__` となりました。" -#: ../../library/enum.rst:533 msgid "" "``Flag`` is the same as :class:`Enum`, but its members support the bitwise " "operators ``&`` (*AND*), ``|`` (*OR*), ``^`` (*XOR*), and ``~`` (*INVERT*); " "the results of those operations are (aliases of) members of the enumeration." msgstr "" +"``Flag`` は :class:`Enum` と同様ですが、メンバーはビット演算子 ``&`` " +"(*AND*)、``|`` (*OR*)、``^`` (*XOR*)、``~`` (*INVERT*) をサポートします。\n" +"これらの演算結果は列挙型のメンバー (のエイリアス) になります。" #: ../../library/enum.rst:539 msgid "Returns *True* if value is in self::" msgstr "値を含む場合に *True* を返します::" -#: ../../library/enum.rst:541 msgid "" ">>> from enum import Flag, auto\n" ">>> class Color(Flag):\n" @@ -960,30 +995,52 @@ msgid "" ">>> white in purple\n" "False" msgstr "" +">>> from enum import Flag, auto\n" +">>> class Color(Flag):\n" +"... RED = auto()\n" +"... GREEN = auto()\n" +"... BLUE = auto()\n" +"...\n" +">>> purple = Color.RED | Color.BLUE\n" +">>> white = Color.RED | Color.GREEN | Color.BLUE\n" +">>> Color.GREEN in purple\n" +"False\n" +">>> Color.GREEN in white\n" +"True\n" +">>> purple in white\n" +"True\n" +">>> white in purple\n" +"False" -#: ../../library/enum.rst:560 msgid "Returns all contained non-alias members::" -msgstr "エイリアスでない、全てのメンバーを返します::" +msgstr "" +"このフラグに含まれるメンバーのうち、エイリアスでないものをすべて返します。 ::" -#: ../../library/enum.rst:562 msgid "" ">>> list(Color.RED)\n" "[]\n" ">>> list(purple)\n" "[, ]" msgstr "" +">>> list(Color.RED)\n" +"[]\n" +">>> list(purple)\n" +"[, ]" #: ../../library/enum.rst:571 msgid "Returns number of members in flag::" msgstr "flag 内のメンバーの数を返します::" -#: ../../library/enum.rst:573 msgid "" ">>> len(Color.GREEN)\n" "1\n" ">>> len(white)\n" "3" msgstr "" +">>> len(Color.GREEN)\n" +"1\n" +">>> len(white)\n" +"3" #: ../../library/enum.rst:582 msgid "Returns *True* if any members in flag, *False* otherwise::" @@ -991,7 +1048,6 @@ msgstr "" "メンバーがflagに含まれている場合は *True* を返し、それ以外の場合は *False* を" "返します::" -#: ../../library/enum.rst:584 msgid "" ">>> bool(Color.GREEN)\n" "True\n" @@ -1001,46 +1057,60 @@ msgid "" ">>> bool(black)\n" "False" msgstr "" +">>> bool(Color.GREEN)\n" +"True\n" +">>> bool(white)\n" +"True\n" +">>> black = Color(0)\n" +">>> bool(black)\n" +"False" #: ../../library/enum.rst:594 msgid "Returns current flag binary or'ed with other::" msgstr "現在のフラグと他のフラグの論理和となるフラグを返します::" -#: ../../library/enum.rst:596 msgid "" ">>> Color.RED | Color.GREEN\n" "" msgstr "" +">>> Color.RED | Color.GREEN\n" +"" #: ../../library/enum.rst:601 msgid "Returns current flag binary and'ed with other::" msgstr "現在のフラグと他のフラグの論理積となるフラグを返します::" -#: ../../library/enum.rst:603 msgid "" ">>> purple & white\n" "\n" ">>> purple & Color.GREEN\n" "" msgstr "" +">>> purple & white\n" +"\n" +">>> purple & Color.GREEN\n" +"" #: ../../library/enum.rst:610 msgid "Returns current flag binary xor'ed with other::" msgstr "現在のフラグと他のフラグの排他的論理和となるフラグを返します::" -#: ../../library/enum.rst:612 msgid "" ">>> purple ^ white\n" "\n" ">>> purple ^ Color.GREEN\n" "" msgstr "" +">>> purple ^ white\n" +"\n" +">>> purple ^ Color.GREEN\n" +"" -#: ../../library/enum.rst:619 msgid "Returns all the flags in *type(self)* that are not in *self*::" msgstr "" +"*type(self)* に含まれるフラグのうち、*self* に含まれないものをすべて返しま" +"す。 ::" -#: ../../library/enum.rst:621 msgid "" ">>> ~white\n" "\n" @@ -1049,12 +1119,20 @@ msgid "" ">>> ~Color.RED\n" "" msgstr "" +">>> ~white\n" +"\n" +">>> ~purple\n" +"\n" +">>> ~Color.RED\n" +"" -#: ../../library/enum.rst:630 msgid "" "Function used to format any remaining unnamed numeric values. Default is " "the value's repr; common choices are :func:`hex` and :func:`oct`." msgstr "" +"名前のない残りの数値を書式化する関数です。\n" +"デフォルトは値の ``repr()`` 結果です。\n" +"よく使われる選択肢は :func:`hex` と :func:`oct` です。" #: ../../library/enum.rst:635 msgid "" @@ -1064,15 +1142,17 @@ msgstr "" ":class:`auto` と :class:`Flag` を一緒に使うと、``1`` から始まる2の累乗の整数" "になります。" -#: ../../library/enum.rst:638 msgid "The *repr()* of zero-valued flags has changed. It is now:" msgstr "" +"値がゼロのフラグの *repr()* が変更されました。\n" +"現在は次のようになります:" -#: ../../library/enum.rst:646 msgid "" "``IntFlag`` is the same as :class:`Flag`, but its members are also integers " "and can be used anywhere that an integer can be used." msgstr "" +"``IntFlag`` は :class:`Flag` と同様ですが、メンバーは整数でもあり、整数が使え" +"る場所ならどこでも使えます。" #: ../../library/enum.rst:660 msgid "" @@ -1082,35 +1162,38 @@ msgstr "" "*IntFlag* のメンバーと整数の演算が行われた場合、結果は *IntFlag* ではありませ" "ん::" -#: ../../library/enum.rst:663 msgid "" ">>> Color.RED + 2\n" "3" msgstr "" +">>> Color.RED + 2\n" +"3" -#: ../../library/enum.rst:666 msgid "If a :class:`Flag` operation is performed with an *IntFlag* member and:" -msgstr "" +msgstr "*IntFlag* のメンバーに対して :class:`Flag` の演算を行うと:" #: ../../library/enum.rst:668 msgid "the result is a valid *IntFlag*: an *IntFlag* is returned" msgstr "結果が有効な *IntFlag*: *IntFlag* が返されます" -#: ../../library/enum.rst:669 msgid "" "the result is not a valid *IntFlag*: the result depends on the :class:" "`FlagBoundary` setting" msgstr "" +"結果が有効な *IntFlag* でない場合、結果は :class:`FlagBoundary` の設定によっ" +"て決まります。" -#: ../../library/enum.rst:671 msgid "The :func:`repr` of unnamed zero-valued flags has changed. It is now::" msgstr "" +"名前がなく値がゼロのフラグの :func:`repr` が変更されました。\n" +"現在は次のようになります。 ::" -#: ../../library/enum.rst:673 msgid "" ">>> Color(0)\n" "" msgstr "" +">>> Color(0)\n" +"" #: ../../library/enum.rst:678 msgid "" @@ -1140,19 +1223,18 @@ msgstr "" "正の値を返すようになりました。これは既存の :class:`Flag` の振る舞いに一致しま" "す。" -#: ../../library/enum.rst:693 msgid "" ":class:`!ReprEnum` uses the :meth:`repr() ` of :class:`Enum`, " "but the :class:`str() ` of the mixed-in data type:" msgstr "" +":class:`!ReprEnum` は :class:`Enum` の :meth:`repr() ` を使い" +"ますが、:class:`str() ` には混ぜ込まれたデータ型のものを使います:" -#: ../../library/enum.rst:696 msgid ":meth:`!int.__str__` for :class:`IntEnum` and :class:`IntFlag`" -msgstr "" +msgstr ":class:`IntEnum` と :class:`IntFlag` では :meth:`!int.__str__`" -#: ../../library/enum.rst:697 msgid ":meth:`!str.__str__` for :class:`StrEnum`" -msgstr "" +msgstr ":class:`StrEnum` では :meth:`!str.__str__`" #: ../../library/enum.rst:699 msgid "" @@ -1164,20 +1246,18 @@ msgstr "" "` を使用する代わりに、mix-inされたデータ型の :class:`str() " "` / :func:`format` を使用します。" -#: ../../library/enum.rst:708 msgid "" "*EnumCheck* contains the options used by the :func:`verify` decorator to " "ensure various constraints; failed constraints result in a :exc:`ValueError`." msgstr "" -"*EnumCheck* には :func:`verify` デコレータやさまざまな制約を保証するために使" -"用されるオプションが含まれています。制約に違反すると :exc:`ValueError` が発生" -"します。" +"*EnumCheck* には、:func:`verify` デコレータが各種の制約を確認するために使うオ" +"プションが含まれています。\n" +"制約を満たさない場合は :exc:`ValueError` が送出されます。" #: ../../library/enum.rst:713 msgid "Ensure that each value has only one name::" msgstr "それぞれの値が1つの名前しか持たないことを確認します::" -#: ../../library/enum.rst:715 msgid "" ">>> from enum import Enum, verify, UNIQUE\n" ">>> @verify(UNIQUE)\n" @@ -1190,6 +1270,16 @@ msgid "" "...\n" "ValueError: aliases found in : CRIMSON -> RED" msgstr "" +">>> from enum import Enum, verify, UNIQUE\n" +">>> @verify(UNIQUE)\n" +"... class Color(Enum):\n" +"... RED = 1\n" +"... GREEN = 2\n" +"... BLUE = 3\n" +"... CRIMSON = 1\n" +"Traceback (most recent call last):\n" +"...\n" +"ValueError: aliases found in : CRIMSON -> RED" #: ../../library/enum.rst:729 msgid "" @@ -1197,7 +1287,6 @@ msgid "" "the highest-valued member::" msgstr "最小値のメンバーと最大値のメンバーの間に欠損値がないことを確認します::" -#: ../../library/enum.rst:732 msgid "" ">>> from enum import Enum, verify, CONTINUOUS\n" ">>> @verify(CONTINUOUS)\n" @@ -1209,16 +1298,24 @@ msgid "" "...\n" "ValueError: invalid enum 'Color': missing values 3, 4" msgstr "" +">>> from enum import Enum, verify, CONTINUOUS\n" +">>> @verify(CONTINUOUS)\n" +"... class Color(Enum):\n" +"... RED = 1\n" +"... GREEN = 2\n" +"... BLUE = 5\n" +"Traceback (most recent call last):\n" +"...\n" +"ValueError: invalid enum 'Color': missing values 3, 4" -#: ../../library/enum.rst:744 msgid "" "Ensure that any flag groups/masks contain only named flags -- useful when " "values are specified instead of being generated by :func:`auto`::" msgstr "" -"任意のフラググループ/マスクが、名前付きフラグのみを含むことを確認します -- 値" -"を指定するのではなく、:func:`auto` によって生成される場合に便利です::" +"フラグのグループやマスクに、名前付きのフラグだけが含まれることを確認しま" +"す。\n" +":func:`auto` で値を生成する代わりに、値を直接指定する場合に便利です。 ::" -#: ../../library/enum.rst:747 msgid "" ">>> from enum import Flag, verify, NAMED_FLAGS\n" ">>> @verify(NAMED_FLAGS)\n" @@ -1233,6 +1330,18 @@ msgid "" "ValueError: invalid Flag 'Color': aliases WHITE and NEON are missing " "combined values of 0x18 [use enum.show_flag_values(value) for details]" msgstr "" +">>> from enum import Flag, verify, NAMED_FLAGS\n" +">>> @verify(NAMED_FLAGS)\n" +"... class Color(Flag):\n" +"... RED = 1\n" +"... GREEN = 2\n" +"... BLUE = 4\n" +"... WHITE = 15\n" +"... NEON = 31\n" +"Traceback (most recent call last):\n" +"...\n" +"ValueError: invalid Flag 'Color': aliases WHITE and NEON are missing " +"combined values of 0x18 [use enum.show_flag_values(value) for details]" #: ../../library/enum.rst:761 msgid "" @@ -1241,11 +1350,12 @@ msgstr "" "CONTINUOUSとNAMED_FLAGSは整数値のメンバーとともに動作するように設計されていま" "す。" -#: ../../library/enum.rst:767 msgid "" "``FlagBoundary`` controls how out-of-range values are handled in :class:" "`Flag` and its subclasses." msgstr "" +"``FlagBoundary`` は :class:`Flag` とそのサブクラスで範囲外の値をどう扱うかを" +"制御します。" #: ../../library/enum.rst:772 msgid "" @@ -1255,7 +1365,6 @@ msgstr "" "範囲外の値は :exc:`ValueError` を送出します。これは :class:`Flag` のデフォル" "トです::" -#: ../../library/enum.rst:775 msgid "" ">>> from enum import Flag, STRICT, auto\n" ">>> class StrictFlag(Flag, boundary=STRICT):\n" @@ -1270,14 +1379,25 @@ msgid "" " given 0b0 10100\n" " allowed 0b0 00111" msgstr "" +">>> from enum import Flag, STRICT, auto\n" +">>> class StrictFlag(Flag, boundary=STRICT):\n" +"... RED = auto()\n" +"... GREEN = auto()\n" +"... BLUE = auto()\n" +"...\n" +">>> StrictFlag(2**2 + 2**4)\n" +"Traceback (most recent call last):\n" +"...\n" +"ValueError: invalid value 20\n" +" given 0b0 10100\n" +" allowed 0b0 00111" -#: ../../library/enum.rst:790 msgid "" "Out-of-range values have invalid values removed, leaving a valid :class:" "`Flag` value::" msgstr "" +"範囲外の値から無効な部分を取り除き、有効な :class:`Flag` の値を残します。 ::" -#: ../../library/enum.rst:793 msgid "" ">>> from enum import Flag, CONFORM, auto\n" ">>> class ConformFlag(Flag, boundary=CONFORM):\n" @@ -1288,20 +1408,29 @@ msgid "" ">>> ConformFlag(2**2 + 2**4)\n" "" msgstr "" +">>> from enum import Flag, CONFORM, auto\n" +">>> class ConformFlag(Flag, boundary=CONFORM):\n" +"... RED = auto()\n" +"... GREEN = auto()\n" +"... BLUE = auto()\n" +"...\n" +">>> ConformFlag(2**2 + 2**4)\n" +"" -#: ../../library/enum.rst:804 msgid "" "Out-of-range values lose their :class:`Flag` membership and revert to :class:" "`int`." msgstr "" +"範囲外の値は :class:`Flag` のメンバーではなくなり、:class:`int` に戻ります。" -#: ../../library/enum.rst:817 msgid "" "Out-of-range values are kept, and the :class:`Flag` membership is kept. This " "is the default for :class:`IntFlag`::" msgstr "" +"範囲外の値をそのまま保持し、:class:`Flag` のメンバーであることも維持しま" +"す。\n" +"これは :class:`IntFlag` のデフォルトです。 ::" -#: ../../library/enum.rst:820 msgid "" ">>> from enum import Flag, KEEP, auto\n" ">>> class KeepFlag(Flag, boundary=KEEP):\n" @@ -1312,8 +1441,15 @@ msgid "" ">>> KeepFlag(2**2 + 2**4)\n" "" msgstr "" +">>> from enum import Flag, KEEP, auto\n" +">>> class KeepFlag(Flag, boundary=KEEP):\n" +"... RED = auto()\n" +"... GREEN = auto()\n" +"... BLUE = auto()\n" +"...\n" +">>> KeepFlag(2**2 + 2**4)\n" +"" -#: ../../library/enum.rst:833 msgid "" "*EnumDict* is a subclass of :class:`dict` that is used as the namespace for " "defining enum classes (see :ref:`prepare`). It is exposed to allow " @@ -1322,18 +1458,27 @@ msgid "" "created, otherwise private names and internal classes will not be handled " "correctly." msgstr "" +"*EnumDict* は :class:`dict` のサブクラスで、列挙型クラスを定義する名前空間と" +"して使います (:ref:`prepare` を参照)。\n" +"メンバーごとに複数の値を持たせるなど、高度な動作を持つ :class:`EnumType` のサ" +"ブクラスを作成できるように公開されています。\n" +"作成する列挙型クラスの名前を渡して呼び出してください。\n" +"そうしないと、プライベートな名前や内部クラスが正しく処理されません。" -#: ../../library/enum.rst:840 msgid "" "Note that only the :class:`~collections.abc.MutableMapping` interface (:meth:" "`~object.__setitem__` and :meth:`~dict.update`) is overridden. It may be " "possible to bypass the checks using other :class:`!dict` operations like :" "meth:`|= `." msgstr "" +"オーバーライドされているのは :class:`~collections.abc.MutableMapping` のイン" +"ターフェイス (:meth:`~object.__setitem__` と :meth:`~dict.update`) だけである" +"ことに注意してください。\n" +":meth:`|= ` など、ほかの :class:`!dict` の操作では検査を回避" +"できる場合があります。" -#: ../../library/enum.rst:847 msgid "A list of member names." -msgstr "" +msgstr "メンバー名のリスト。" #: ../../library/enum.rst:854 msgid "Supported ``__dunder__`` names" @@ -1378,13 +1523,12 @@ msgstr ":attr:`~Enum._name_` -- メンバー名" msgid ":attr:`~Enum._value_` -- value of the member; can be set in ``__new__``" msgstr ":attr:`~Enum._value_` -- メンバーの値; ``__new__`` で設定できます" -#: ../../library/enum.rst:873 msgid "" ":meth:`~Enum._missing_` -- a lookup function used when a value is not found; " "may be overridden" msgstr "" ":meth:`~Enum._missing_` -- 値が見付からなかったときに使われる検索関数; オー" -"バーライドされていることがあります" +"バーライドできます" #: ../../library/enum.rst:875 msgid "" @@ -1402,13 +1546,13 @@ msgid "" "(class attribute, removed during class creation)" msgstr "" -#: ../../library/enum.rst:880 msgid "" ":meth:`~Enum._generate_next_value_` -- used to get an appropriate value for " "an enum member; may be overridden" msgstr "" ":meth:`~Enum._generate_next_value_` -- 列挙型のメンバーの適切な値を取得するの" -"に使われます。オーバーライドされます。" +"に使われます。\n" +"オーバーライドできます。" #: ../../library/enum.rst:885 msgid "" @@ -1425,16 +1569,18 @@ msgid "" msgstr "" ":class:`Flag` クラスでは、次に選ばれる値は、次の最大の2のべき乗となります。" -#: ../../library/enum.rst:891 msgid "" "While ``_sunder_`` names are generally reserved for the further development " "of the :class:`Enum` class and can not be used, some are explicitly allowed:" msgstr "" +"``_sunder_`` 名は通常、:class:`Enum` クラスの今後の開発のために予約されており" +"使えませんが、明示的に許可されているものもあります:" -#: ../../library/enum.rst:894 msgid "" "``_repr_*`` (e.g. ``_repr_html_``), as used in `IPython's rich display`_" msgstr "" +"`IPython のリッチな表示機能 `_ で使われる " +"``_repr_*`` (``_repr_html_`` など)" #: ../../library/enum.rst:896 msgid "``_missing_``, ``_order_``, ``_generate_next_value_``" @@ -1444,9 +1590,8 @@ msgstr "``_missing_``, ``_order_``, ``_generate_next_value_``" msgid "``_ignore_``" msgstr "``_ignore_``" -#: ../../library/enum.rst:898 msgid "``_add_alias_``, ``_add_value_alias_``, ``_repr_*``" -msgstr "" +msgstr "``_add_alias_``, ``_add_value_alias_``, ``_repr_*``" #: ../../library/enum.rst:904 msgid "Utilities and Decorators" @@ -1539,7 +1684,6 @@ msgstr "" "__members__` に別名がないかどうか検索します; 見つかった場合、:exc:" "`ValueError` が詳細情報とともに送出されます::" -#: ../../library/enum.rst:955 msgid "" ">>> from enum import Enum, unique\n" ">>> @unique\n" @@ -1553,6 +1697,17 @@ msgid "" "...\n" "ValueError: duplicate values found in : FOUR -> THREE" msgstr "" +">>> from enum import Enum, unique\n" +">>> @unique\n" +"... class Mistake(Enum):\n" +"... ONE = 1\n" +"... TWO = 2\n" +"... THREE = 3\n" +"... FOUR = 3\n" +"...\n" +"Traceback (most recent call last):\n" +"...\n" +"ValueError: duplicate values found in : FOUR -> THREE" #: ../../library/enum.rst:969 msgid "" @@ -1571,13 +1726,16 @@ msgstr "列挙型で使用するデコレータ: 対象は列挙型のメンバ msgid "A decorator for use in enums: its target will not become a member." msgstr "列挙型で使用するデコレータ: 対象は列挙型のメンバー になりません。" -#: ../../library/enum.rst:989 msgid "" "A decorator to change the :class:`str() ` and :func:`repr` of an enum " "to show its members as belonging to the module instead of its class. Should " "only be used when the enum members are exported to the module global " "namespace (see :class:`re.RegexFlag` for an example)." msgstr "" +"列挙型の :class:`str() ` と :func:`repr` を変更して、メンバーがクラスで" +"はなくモジュールに属するように表示するデコレータです。\n" +"列挙型のメンバーをモジュールのグローバル名前空間に公開している場合だけ使って" +"ください (例は :class:`re.RegexFlag` を参照)。" #: ../../library/enum.rst:999 msgid "Return a list of all power-of-two integers contained in a flag *value*." @@ -1619,20 +1777,24 @@ msgstr "" "もし、そのような制限が必要でない/望まない場合は、``int`` または ``str`` タイ" "プを継承して、カスタムの基底クラスを作成することができます::" -#: ../../library/enum.rst:1021 msgid "" ">>> from enum import Enum\n" ">>> class MyIntEnum(int, Enum):\n" "... pass" msgstr "" +">>> from enum import Enum\n" +">>> class MyIntEnum(int, Enum):\n" +"... pass" #: ../../library/enum.rst:1025 msgid "or you can reassign the appropriate :meth:`str`, etc., in your enum::" msgstr "または列挙型の中で適切な :meth:`str` などを再代入することもできます::" -#: ../../library/enum.rst:1027 msgid "" ">>> from enum import Enum, IntEnum\n" ">>> class MyIntEnum(IntEnum):\n" "... __str__ = Enum.__str__" msgstr "" +">>> from enum import Enum, IntEnum\n" +">>> class MyIntEnum(IntEnum):\n" +"... __str__ = Enum.__str__" diff --git a/library/errno.po b/library/errno.po index 789c7707d..409f945f8 100644 --- a/library/errno.po +++ b/library/errno.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/errno.rst:2 @@ -67,29 +67,33 @@ msgstr "" "errorcode.keys()`` として取得することができます。取得できるシンボルには以下の" "ようなものがあります:" -#: ../../library/errno.rst:30 msgid "" "Operation not permitted. This error is mapped to the exception :exc:" "`PermissionError`." msgstr "" +"操作が許可されていません (Operation not permitted)。\n" +"このエラーは例外 :exc:`PermissionError` に対応します。" -#: ../../library/errno.rst:36 msgid "" "No such file or directory. This error is mapped to the exception :exc:" "`FileNotFoundError`." msgstr "" +"そのようなファイルやディレクトリはありません (No such file or directory)。\n" +"このエラーは例外 :exc:`FileNotFoundError` に対応します。" -#: ../../library/errno.rst:42 msgid "" "No such process. This error is mapped to the exception :exc:" "`ProcessLookupError`." msgstr "" +"そのようなプロセスはありません (No such process)。\n" +"このエラーは例外 :exc:`ProcessLookupError` に対応します。" -#: ../../library/errno.rst:48 msgid "" "Interrupted system call. This error is mapped to the exception :exc:" "`InterruptedError`." msgstr "" +"システムコールが割り込まれました (Interrupted system call)。\n" +"このエラーは例外 :exc:`InterruptedError` に対応します。" #: ../../library/errno.rst:54 msgid "I/O error" @@ -112,26 +116,29 @@ msgstr "実行形式にエラーがあります (Exec format error)" msgid "Bad file number" msgstr "ファイル番号が間違っています (Bad file number)" -#: ../../library/errno.rst:79 msgid "" "No child processes. This error is mapped to the exception :exc:" "`ChildProcessError`." msgstr "" +"子プロセスがありません (No child processes)。\n" +"このエラーは例外 :exc:`ChildProcessError` に対応します。" -#: ../../library/errno.rst:85 msgid "" "Try again. This error is mapped to the exception :exc:`BlockingIOError`." msgstr "" +"再試行してください (Try again)。\n" +"このエラーは例外 :exc:`BlockingIOError` に対応します。" #: ../../library/errno.rst:90 msgid "Out of memory" msgstr "空きメモリがありません (Out of memory)" -#: ../../library/errno.rst:95 msgid "" "Permission denied. This error is mapped to the exception :exc:" "`PermissionError`." msgstr "" +"アクセスが拒否されました (Permission denied)。\n" +"このエラーは例外 :exc:`PermissionError` に対応します。" #: ../../library/errno.rst:101 msgid "Bad address" @@ -145,10 +152,11 @@ msgstr "ブロックデバイスが必要です (Block device required)" msgid "Device or resource busy" msgstr "そのデバイスまたはリソースは使用中です (Device or resource busy)" -#: ../../library/errno.rst:116 msgid "" "File exists. This error is mapped to the exception :exc:`FileExistsError`." msgstr "" +"ファイルが存在します (File exists)。\n" +"このエラーは例外 :exc:`FileExistsError` に対応します。" #: ../../library/errno.rst:122 msgid "Cross-device link" @@ -158,17 +166,19 @@ msgstr "デバイスをまたいだリンクです (Cross-device link)" msgid "No such device" msgstr "そのようなデバイスはありません (No such device)" -#: ../../library/errno.rst:132 msgid "" "Not a directory. This error is mapped to the exception :exc:" "`NotADirectoryError`." msgstr "" +"ディレクトリではありません (Not a directory)。\n" +"このエラーは例外 :exc:`NotADirectoryError` に対応します。" -#: ../../library/errno.rst:138 msgid "" "Is a directory. This error is mapped to the exception :exc:" "`IsADirectoryError`." msgstr "" +"ディレクトリです (Is a directory)。\n" +"このエラーは例外 :exc:`IsADirectoryError` に対応します。" #: ../../library/errno.rst:144 msgid "Invalid argument" @@ -210,10 +220,11 @@ msgstr "リードオンリーのファイルシステムです (Read-only file s msgid "Too many links" msgstr "リンクが多すぎます (Too many links)" -#: ../../library/errno.rst:194 msgid "" "Broken pipe. This error is mapped to the exception :exc:`BrokenPipeError`." msgstr "" +"パイプが壊れています (Broken pipe)。\n" +"このエラーは例外 :exc:`BrokenPipeError` に対応します。" #: ../../library/errno.rst:200 msgid "Math argument out of domain of func" @@ -250,11 +261,12 @@ msgstr "" "これ以上シンボリックリンクを追跡できません (Too many symbolic links " "encountered)" -#: ../../library/errno.rst:240 msgid "" "Operation would block. This error is mapped to the exception :exc:" "`BlockingIOError`." msgstr "" +"操作を進めるにはブロックする必要があります (Operation would block)。\n" +"このエラーは例外 :exc:`BlockingIOError` に対応します。" #: ../../library/errno.rst:246 msgid "No message of desired type" @@ -308,9 +320,8 @@ msgstr "無効な要求記述子です (Invalid request descriptor)" msgid "Exchange full" msgstr "変換テーブルが一杯です (Exchange full)" -#: ../../library/errno.rst:311 msgid "No anode" -msgstr "陰極がありません (No anode)" +msgstr "anode がありません (No anode)。" #: ../../library/errno.rst:316 msgid "Invalid request code" @@ -440,11 +451,10 @@ msgstr "" msgid "Illegal byte sequence" msgstr "不正なバイト列です (Illegal byte sequence)" -#: ../../library/errno.rst:461 msgid "Interrupted system call should be restarted" msgstr "" -"割り込みシステムコールを復帰しなければなりません (Interrupted system call " -"should be restarted)" +"割り込まれたシステムコールを再実行する必要があります (Interrupted system " +"call should be restarted)" #: ../../library/errno.rst:466 msgid "Streams pipe error" @@ -489,9 +499,8 @@ msgstr "" "通信端点に対してサポートされていない操作です (Operation not supported on " "transport endpoint)" -#: ../../library/errno.rst:516 msgid "Operation not supported" -msgstr "" +msgstr "操作がサポートされていません (Operation not supported)。" #: ../../library/errno.rst:523 msgid "Protocol family not supported" @@ -527,17 +536,20 @@ msgstr "" "リセットによってネットワーク接続が切られました (Network dropped connection " "because of reset)" -#: ../../library/errno.rst:558 msgid "" "Software caused connection abort. This error is mapped to the exception :exc:" "`ConnectionAbortedError`." msgstr "" +"ソフトウェアによって接続が中断されました (Software caused connection " +"abort)。\n" +"このエラーは例外 :exc:`ConnectionAbortedError` に対応します。" -#: ../../library/errno.rst:564 msgid "" "Connection reset by peer. This error is mapped to the exception :exc:" "`ConnectionResetError`." msgstr "" +"接続相手によって接続がリセットされました (Connection reset by peer)。\n" +"このエラーは例外 :exc:`ConnectionResetError` に対応します。" #: ../../library/errno.rst:570 msgid "No buffer space available" @@ -552,27 +564,31 @@ msgstr "" msgid "Transport endpoint is not connected" msgstr "通信端点が接続されていません (Transport endpoint is not connected)" -#: ../../library/errno.rst:585 msgid "" "Cannot send after transport endpoint shutdown. This error is mapped to the " "exception :exc:`BrokenPipeError`." msgstr "" +"通信端点をシャットダウンした後は送信できません (Cannot send after transport " +"endpoint shutdown)。\n" +"このエラーは例外 :exc:`BrokenPipeError` に対応します。" #: ../../library/errno.rst:591 msgid "Too many references: cannot splice" msgstr "参照が多すぎます: 接続できません (Too many references: cannot splice)" -#: ../../library/errno.rst:596 msgid "" "Connection timed out. This error is mapped to the exception :exc:" "`TimeoutError`." msgstr "" +"接続がタイムアウトしました (Connection timed out)。\n" +"このエラーは例外 :exc:`TimeoutError` に対応します。" -#: ../../library/errno.rst:602 msgid "" "Connection refused. This error is mapped to the exception :exc:" "`ConnectionRefusedError`." msgstr "" +"接続が拒否されました (Connection refused)。\n" +"このエラーは例外 :exc:`ConnectionRefusedError` に対応します。" #: ../../library/errno.rst:608 msgid "Host is down" @@ -582,21 +598,23 @@ msgstr "ホストはシステムダウンしています (Host is down)" msgid "No route to host" msgstr "ホストへの経路がありません (No route to host)" -#: ../../library/errno.rst:618 msgid "Memory page has hardware error." msgstr "" +"メモリページにハードウェアエラーがあります (Memory page has hardware error)。" -#: ../../library/errno.rst:625 msgid "" "Operation already in progress. This error is mapped to the exception :exc:" "`BlockingIOError`." msgstr "" +"操作はすでに進行中です (Operation already in progress)。\n" +"このエラーは例外 :exc:`BlockingIOError` に対応します。" -#: ../../library/errno.rst:631 msgid "" "Operation now in progress. This error is mapped to the exception :exc:" "`BlockingIOError`." msgstr "" +"操作は現在進行中です (Operation now in progress)。\n" +"このエラーは例外 :exc:`BlockingIOError` に対応します。" #: ../../library/errno.rst:637 msgid "Stale NFS file handle" @@ -626,132 +644,109 @@ msgstr "遠隔側の I/O エラーです (Remote I/O error)" msgid "Quota exceeded" msgstr "ディスククオータを超えました (Quota exceeded)" -#: ../../library/errno.rst:671 msgid "Interface output queue is full" msgstr "" +"インターフェイスの出力キューがいっぱいです (Interface output queue is full)。" -#: ../../library/errno.rst:678 msgid "No medium found" -msgstr "" +msgstr "媒体が見つかりません (No medium found)。" -#: ../../library/errno.rst:683 msgid "Wrong medium type" -msgstr "" +msgstr "媒体の種類が違います (Wrong medium type)。" -#: ../../library/errno.rst:688 msgid "Required key not available" -msgstr "" +msgstr "必要な鍵が利用できません (Required key not available)。" -#: ../../library/errno.rst:693 msgid "Key has expired" -msgstr "" +msgstr "鍵の有効期限が切れています (Key has expired)。" -#: ../../library/errno.rst:698 msgid "Key has been revoked" -msgstr "" +msgstr "鍵が取り消されています (Key has been revoked)。" -#: ../../library/errno.rst:703 msgid "Key was rejected by service" -msgstr "" +msgstr "サービスが鍵を拒否しました (Key was rejected by service)。" -#: ../../library/errno.rst:708 msgid "Operation not possible due to RF-kill" msgstr "" +"RF-kill によって操作できません (Operation not possible due to RF-kill)。" -#: ../../library/errno.rst:713 msgid "Locked lock was unmapped" msgstr "" +"ロック中のロックがマッピング解除されました (Locked lock was unmapped)。" -#: ../../library/errno.rst:718 msgid "Facility is not active" -msgstr "" +msgstr "機能が有効ではありません (Facility is not active)。" -#: ../../library/errno.rst:723 msgid "Authentication error" -msgstr "" +msgstr "認証エラーです (Authentication error)。" -#: ../../library/errno.rst:730 msgid "Bad CPU type in executable" -msgstr "" +msgstr "実行可能ファイルの CPU 型が不正です (Bad CPU type in executable)。" -#: ../../library/errno.rst:737 msgid "Bad executable (or shared library)" msgstr "" +"実行可能ファイルまたは共有ライブラリが不正です (Bad executable (or shared " +"library))。" -#: ../../library/errno.rst:744 msgid "Malformed Mach-o file" -msgstr "" +msgstr "Mach-o ファイルの形式が不正です (Malformed Mach-o file)。" -#: ../../library/errno.rst:751 msgid "Device error" -msgstr "" +msgstr "デバイスエラーです (Device error)。" -#: ../../library/errno.rst:758 msgid "Inappropriate file type or format" msgstr "" +"ファイルの種類または形式が不適切です (Inappropriate file type or format)。" -#: ../../library/errno.rst:765 msgid "Need authenticator" -msgstr "" +msgstr "認証機構が必要です (Need authenticator)。" -#: ../../library/errno.rst:772 msgid "Attribute not found" -msgstr "" +msgstr "属性が見つかりません (Attribute not found)。" -#: ../../library/errno.rst:779 msgid "Policy not found" -msgstr "" +msgstr "ポリシーが見つかりません (Policy not found)。" -#: ../../library/errno.rst:786 msgid "Too many processes" -msgstr "" +msgstr "プロセスが多すぎます (Too many processes)。" -#: ../../library/errno.rst:793 msgid "Bad procedure for program" -msgstr "" +msgstr "プログラムに対する手続きが不正です (Bad procedure for program)。" -#: ../../library/errno.rst:800 msgid "Program version wrong" -msgstr "" +msgstr "プログラムのバージョンが違います (Program version wrong)。" -#: ../../library/errno.rst:807 msgid "RPC prog. not avail" -msgstr "" +msgstr "RPC プログラムが利用できません (RPC prog. not avail)。" -#: ../../library/errno.rst:814 msgid "Device power is off" -msgstr "" +msgstr "デバイスの電源が切れています (Device power is off)。" -#: ../../library/errno.rst:821 msgid "RPC struct is bad" -msgstr "" +msgstr "RPC 構造体が不正です (RPC struct is bad)。" -#: ../../library/errno.rst:828 msgid "RPC version wrong" -msgstr "" +msgstr "RPC のバージョンが違います (RPC version wrong)。" -#: ../../library/errno.rst:835 msgid "Shared library version mismatch" msgstr "" +"共有ライブラリのバージョンが一致しません (Shared library version mismatch)。" -#: ../../library/errno.rst:842 msgid "" "Capabilities insufficient. This error is mapped to the exception :exc:" "`PermissionError`." msgstr "" +"ケーパビリティが不足しています (Capabilities insufficient)。\n" +"このエラーは例外 :exc:`PermissionError` に対応します。" -#: ../../library/errno.rst:845 msgid "Availability" -msgstr "" +msgstr "利用可能な環境" -#: ../../library/errno.rst:852 msgid "Operation canceled" -msgstr "" +msgstr "操作がキャンセルされました (Operation canceled)。" -#: ../../library/errno.rst:859 msgid "Owner died" -msgstr "" +msgstr "所有者が終了しました (Owner died)。" -#: ../../library/errno.rst:866 msgid "State not recoverable" -msgstr "" +msgstr "状態を回復できません (State not recoverable)。" diff --git a/library/exceptions.po b/library/exceptions.po index e5e76a8ed..f72d99222 100644 --- a/library/exceptions.po +++ b/library/exceptions.po @@ -20,10 +20,10 @@ msgstr "" "Last-Translator: Takanori Suzuki , 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/exceptions.rst:4 @@ -92,14 +92,12 @@ msgstr "" msgid "Exception context" msgstr "例外コンテキスト" -#: ../../library/exceptions.rst:46 msgid "" "Three attributes on exception objects provide information about the context " "in which the exception was raised:" msgstr "" -"例外オブジェクトの3つの属性は、例外が送出された常用に関する情報を提供します:" +"例外オブジェクトの3つの属性は、例外が送出された状況に関する情報を提供します:" -#: ../../library/exceptions.rst:53 msgid "" "When raising a new exception while another exception is already being " "handled, the new exception's :attr:`!__context__` attribute is automatically " @@ -107,18 +105,21 @@ msgid "" "`except` or :keyword:`finally` clause, or a :keyword:`with` statement, is " "used." msgstr "" +"別の例外の処理中に新しい例外を送出すると、新しい例外の :attr:`!__context__` " +"属性には、処理中の例外が自動的に設定されます。\n" +"例外の処理は、:keyword:`except` 節、:keyword:`finally` 節、:keyword:`with` 文" +"を使うときに行われることがあります。" -#: ../../library/exceptions.rst:59 msgid "" "This implicit exception context can be supplemented with an explicit cause " "by using :keyword:`!from` with :keyword:`raise`::" msgstr "" +":keyword:`raise` とともに :keyword:`!from` を使うと、この暗黙の例外コンテキス" +"トに明示的な原因を付け加えられます。 ::" -#: ../../library/exceptions.rst:63 msgid "raise new_exc from original_exc" -msgstr "" +msgstr "raise new_exc from original_exc" -#: ../../library/exceptions.rst:65 msgid "" "The expression following :keyword:`from` must be an exception or " "``None``. It will be set as :attr:`!__cause__` on the raised exception. " @@ -129,13 +130,14 @@ msgid "" "while leaving the old exception available in :attr:`!__context__` for " "introspection when debugging." msgstr "" -":keyword:`from ` に続く式は例外か ``None`` でなくてはなりません。\n" -"式は送出される例外の :attr:`!__cause__` として設定されます。\n" -":attr:`!__cause__` を設定することは、 :attr:`!__suppress_context__` 属性を暗" -"黙的に ``True`` に設定することにもなるので、 ``raise new_exc from None`` を使" -"うことで効率的に古い例外を新しいもので置き換えて表示する (例えば、 :exc:" -"`KeyError` を :exc:`AttributeError` に置き換え)、古い例外はデバッグ時の調査で" -"使えるよう :attr:`!__context__` に残すことができます。" +":keyword:`from` に続く式は、例外か ``None`` でなければなりません。\n" +"送出される例外の :attr:`!__cause__` には、その値が設定されます。\n" +":attr:`!__cause__` を設定すると、:attr:`!__suppress_context__` 属性も暗黙的" +"に ``True`` に設定されます。\n" +"そのため、``raise new_exc from None`` を使うと、表示上は古い例外を新しい例外" +"で置き換えられます (例えば :exc:`KeyError` から :exc:`AttributeError` への変" +"換)。\n" +"古い例外はデバッグ時に調べられるよう :attr:`!__context__` に残ります。" #: ../../library/exceptions.rst:74 msgid "" @@ -164,15 +166,17 @@ msgstr "" msgid "Inheriting from built-in exceptions" msgstr "組み込み例外から継承する" -#: ../../library/exceptions.rst:88 msgid "" "User code can create subclasses that inherit from an exception type. It's " "recommended to only subclass one exception type at a time to avoid any " "possible conflicts between how the bases handle the ``args`` attribute, as " "well as due to possible memory layout incompatibilities." msgstr "" +"ユーザコードでは、例外型を継承したサブクラスを作成できます。\n" +"基底クラス間で ``args`` 属性の扱いが衝突したり、メモリレイアウトの互換性に問" +"題が生じたりする可能性があるため、\n" +"一度に継承する例外型は一つだけにすることを推奨します。" -#: ../../library/exceptions.rst:95 msgid "" "Most built-in exceptions are implemented in C for efficiency, see: :source:" "`Objects/exceptions.c`. Some have custom memory layouts which makes it " @@ -181,6 +185,13 @@ msgid "" "between Python versions, leading to new conflicts in the future. Therefore, " "it's recommended to avoid subclassing multiple exception types altogether." msgstr "" +"ほとんどの組み込み例外は効率のために C で実装されています (:source:`Objects/" +"exceptions.c` を参照してください)。\n" +"一部の例外は独自のメモリレイアウトを持つため、そうした例外型の組み合わせでは" +"多重継承できません。\n" +"型のメモリレイアウトは実装の詳細であり、Python のバージョンによって変わり、将" +"来新たな衝突が生じる可能性があります。\n" +"そのため、複数の例外型からの継承は避けることを推奨します。" #: ../../library/exceptions.rst:105 msgid "Base classes" @@ -217,7 +228,6 @@ msgstr "" "`OSError` など) いくつかの引数を必要とし、このタプルの要素に特別な意味を込め" "るものもあります。" -#: ../../library/exceptions.rst:126 msgid "" "This method sets *tb* as the new traceback for the exception and returns the " "exception object. It was more commonly used before the exception chaining " @@ -228,8 +238,17 @@ msgid "" "happened to the traceback of the original ``SomeException`` had we allowed " "it to propagate to the caller. ::" msgstr "" +"このメソッドは、例外の新しいトレースバックに *tb* を設定し、その例外オブジェ" +"クトを返します。\n" +":pep:`3134` の例外連鎖機能が使えるようになる前は、より広く使われていまし" +"た。\n" +"次の例は、トレースバックを保持しながら ``SomeException`` のインスタンスを " +"``OtherException`` のインスタンスに変換する方法を示します。\n" +"``OtherException`` を送出すると、そのトレースバックに現在のフレームが追加され" +"ます。\n" +"元の ``SomeException`` を呼び出し元に伝播させた場合にも、そのトレースバックに" +"同じようにフレームが追加されます。 ::" -#: ../../library/exceptions.rst:135 msgid "" "try:\n" " ...\n" @@ -237,12 +256,19 @@ msgid "" " tb = sys.exception().__traceback__\n" " raise OtherException(...).with_traceback(tb)" msgstr "" +"try:\n" +" ...\n" +"except SomeException:\n" +" tb = sys.exception().__traceback__\n" +" raise OtherException(...).with_traceback(tb)" -#: ../../library/exceptions.rst:143 msgid "" "A writable field that holds the :ref:`traceback object ` " "associated with this exception. See also: :ref:`raise`." msgstr "" +"この例外に関連付けられた :ref:`トレースバックオブジェクト ` を保持する、書き込み可能なフィールドです。\n" +":ref:`raise` も参照してください。" #: ../../library/exceptions.rst:149 msgid "" @@ -360,7 +386,6 @@ msgstr "" "参照してください。この例外は厳密に言えばエラーではないので、 :exc:" "`Exception` ではなく :exc:`BaseException` を直接継承しています。" -#: ../../library/exceptions.rst:237 msgid "" "Raised when the :keyword:`import` statement has troubles trying to load a " "module. Also raised when the \"from list\" in ``from ... import`` has a " @@ -368,8 +393,8 @@ msgid "" msgstr "" ":keyword:`import` 文でモジュールをロードしようとして問題が発生すると送出され" "ます。\n" -"``from ... import`` の中の\"from list\" (訳注:``...`` の部分)の名前が見つか" -"らないときにも送出されます。" +"``from ... import`` の \"from list\" に、見つからない名前が含まれている場合に" +"も送出されます。" #: ../../library/exceptions.rst:241 msgid "" @@ -432,7 +457,6 @@ msgstr "" "を捕捉するコードに誤って捕捉されてインタプリタの終了が阻害されないように、こ" "の例外は :exc:`BaseException` を継承しています。" -#: ../../library/exceptions.rst:290 msgid "" "Catching a :exc:`KeyboardInterrupt` requires special consideration. Because " "it can be raised at unpredictable points, it may, in some circumstances, " @@ -440,6 +464,13 @@ msgid "" "allow :exc:`KeyboardInterrupt` to end the program as quickly as possible or " "avoid raising it entirely. (See :ref:`handlers-and-exceptions`.)" msgstr "" +":exc:`KeyboardInterrupt` の捕捉には特別な配慮が必要です。\n" +"この例外は予測できない箇所で送出される可能性があるため、状況によっては、実行" +"中のプログラムが不整合な状態になることがあります。\n" +"一般には、:exc:`KeyboardInterrupt` によってできるだけ速やかにプログラムを終了" +"させるか、\n" +"この例外の送出自体を避けるのが最善です (:ref:`handlers-and-exceptions` を参照" +"してください)。" #: ../../library/exceptions.rst:300 msgid "" @@ -482,34 +513,38 @@ msgstr "" msgid "Added the :attr:`name` attribute." msgstr ":attr:`name` 属性が追加されました。" -#: ../../library/exceptions.rst:325 msgid "" "This exception is derived from :exc:`RuntimeError`. In user defined base " "classes, abstract methods should raise this exception when they require " "derived classes to override the method, or while the class is being " "developed to indicate that the real implementation still needs to be added." msgstr "" -"この例外は :exc:`RuntimeError` から派生しています。ユーザ定義の基底クラスにお" -"いて、抽象メソッドが派生クラスでオーバライドされることを要求する場合にこの例" -"外を送出しなくてはなりません。またはクラスは実装中であり本来の実装を追加する" -"必要があることを示します。" +"この例外は :exc:`RuntimeError` から派生しています。\n" +"ユーザ定義の基底クラスでは、派生クラスにメソッドのオーバーライドを求める場合" +"に、抽象メソッドからこの例外を送出するべきです。\n" +"また、クラスの開発中に、実際の実装をまだ追加する必要があることを示すためにも" +"送出するべきです。" -#: ../../library/exceptions.rst:332 msgid "" "It should not be used to indicate that an operator or method is not meant to " "be supported at all -- in that case either leave the operator / method " "undefined or, if a subclass, set it to :data:`None`." msgstr "" -"演算子やメソッドがサポートされていないことを示す目的でこの例外を使用するべき" -"ではありません。そのようなケースではオペレータやメソッドを未定義のままとする" -"か、サブクラスの場合は :data:`None` を設定してください。" +"演算子やメソッドをそもそもサポートする意図がないことを示すために、この例外を" +"使うべきではありません。\n" +"その場合は演算子やメソッドを未定義のままにするか、サブクラスであれば :data:" +"`None` を設定してください。" -#: ../../library/exceptions.rst:338 msgid "" ":exc:`!NotImplementedError` and :data:`!NotImplemented` are not " "interchangeable. This exception should only be used as described above; see :" "data:`NotImplemented` for details on correct usage of the built-in constant." msgstr "" +":exc:`!NotImplementedError` と :data:`!NotImplemented` は互いに置き換えられま" +"せん。\n" +"この例外は、上で説明した用途にのみ使ってください。\n" +"組み込み定数の正しい使い方については :data:`NotImplemented` を参照してくださ" +"い。" #: ../../library/exceptions.rst:349 msgid "" @@ -534,7 +569,6 @@ msgstr "" "れた場合、:attr:`~BaseException.args` 属性は最初の2つの要素のみからなるタプル" "を持ちます。" -#: ../../library/exceptions.rst:359 msgid "" "The constructor often actually returns a subclass of :exc:`OSError`, as " "described in `OS exceptions`_ below. The particular subclass depends on the " @@ -542,23 +576,24 @@ msgid "" "exc:`OSError` directly or via an alias, and is not inherited when " "subclassing." msgstr "" -"コンストラクタは実際には、 `OS exceptions`_ で述べられている :exc:`OSError` " -"のサブクラスを返すことがよくあります。特定のサブクラスは最終的な :attr:`." -"errno` 値によります。この挙動は :exc:`OSError` を直接またはエイリアスで構築" -"し、サブクラス化時に継承されなかった場合にのみ発生します。" +"コンストラクタは、下の `OS exceptions`_ で説明する :exc:`OSError` のサブクラ" +"スを実際に返すことがよくあります。\n" +"どのサブクラスを返すかは、最終的な :attr:`.errno` の値によって決まります。\n" +"この挙動は、:exc:`OSError` を直接またはエイリアスを通して構築した場合にのみ発" +"生し、サブクラスには継承されません。" #: ../../library/exceptions.rst:367 msgid "A numeric error code from the C variable :c:data:`errno`." msgstr "C 変数 :c:data:`errno` に由来する数値エラーコードです。" -#: ../../library/exceptions.rst:371 msgid "" "Under Windows, this gives you the native Windows error code. The :attr:`." "errno` attribute is then an approximate translation, in POSIX terms, of that " "native error code." msgstr "" -"Windows において、ネイティブ Windows エラーコードを与えます。そして :attr:" -"`errno` 属性は POSIX でいうネイティブエラーコードへのおよその翻訳です。" +"Windows では、ネイティブの Windows エラーコードを表します。\n" +"この場合、:attr:`.errno` 属性は、そのネイティブエラーコードを POSIX のエラー" +"コードにおおよそ変換した値です。" #: ../../library/exceptions.rst:375 msgid "" @@ -605,17 +640,16 @@ msgstr "" "error`, :exc:`select.error`, :exc:`mmap.error` が :exc:`OSError` に統合されま" "した。コンストラクタはサブクラスを返すかもしれません。" -#: ../../library/exceptions.rst:404 msgid "" "The :attr:`filename` attribute is now the original file name passed to the " "function, instead of the name encoded to or decoded from the :term:" "`filesystem encoding and error handler`. Also, the *filename2* constructor " "argument and attribute was added." msgstr "" -":attr:`filename` 属性が :term:`filesystem encoding and error handler` のエン" -"コーディングでエンコードやデコードされた名前から、関数に渡された元々のファイ" -"ル名になりました。\n" -"また、*filename2* コンストラクタ引数が追加されました。" +":attr:`filename` 属性は、:term:`filesystem encoding and error handler` に従っ" +"てエンコードまたはデコードされた名前ではなく、関数に渡された元のファイル名に" +"なりました。\n" +"また、コンストラクタ引数と属性の *filename2* が追加されました。" #: ../../library/exceptions.rst:413 msgid "" @@ -632,26 +666,27 @@ msgstr "" "出されることがあります。C の浮動小数点演算の例外処理は標準化されていないの" "で、ほとんどの浮動小数点演算もチェックされません。" -#: ../../library/exceptions.rst:423 msgid "" "This exception is derived from :exc:`RuntimeError`. It is raised when an " "operation is blocked during interpreter shutdown also known as :term:`Python " "finalization `." msgstr "" +"この例外は :exc:`RuntimeError` から派生しています。\n" +":term:`Python の終了処理 ` とも呼ばれるインタープリタの" +"シャットダウン中に、操作が阻止された場合に送出されます。" -#: ../../library/exceptions.rst:427 msgid "" "Examples of operations which can be blocked with a :exc:" "`PythonFinalizationError` during the Python finalization:" msgstr "" +"Python の終了処理中に :exc:`PythonFinalizationError` によって阻止されることが" +"ある操作の例:" -#: ../../library/exceptions.rst:430 msgid "Creating a new Python thread." -msgstr "" +msgstr "新しい Python スレッドの作成。" -#: ../../library/exceptions.rst:431 msgid ":meth:`Joining ` a running daemon thread." -msgstr "" +msgstr "実行中のデーモンスレッドの :meth:`終了待機 `。" #: ../../library/exceptions.rst:432 msgid ":func:`os.fork`." @@ -665,9 +700,10 @@ msgstr ":func:`sys.is_finalizing` 関数も参照してください。" msgid "Previously, a plain :exc:`RuntimeError` was raised." msgstr "以前は :exc:`RuntimeError` をそのまま送出していました。" -#: ../../library/exceptions.rst:441 msgid ":meth:`threading.Thread.join` can now raise this exception." msgstr "" +":meth:`threading.Thread.join` がこの例外を送出することがあるようになりまし" +"た。" #: ../../library/exceptions.rst:445 msgid "" @@ -762,24 +798,24 @@ msgstr "" ":pep:`479` が全てのコードでデフォルトで有効化されました: ジェネレータから送出" "された :exc:`StopIteration` は :exc:`RuntimeError` に変換されます。" -#: ../../library/exceptions.rst:503 msgid "" "Must be raised by :meth:`~object.__anext__` method of an :term:`asynchronous " "iterator` object to stop the iteration." msgstr "" -"イテレーションを停止するために、 :term:`asynchronous iterator` オブジェクト" -"の :meth:`~object.__anext__` メソッドによって返される必要があります。" +"イテレーションを停止するために、:term:`asynchronous iterator` オブジェクト" +"の :meth:`~object.__anext__` メソッドから送出しなければなりません。" -#: ../../library/exceptions.rst:510 msgid "" "Raised when the parser encounters a syntax error. This may occur in an :" "keyword:`import` statement, in a call to the built-in functions :func:" "`compile`, :func:`exec`, or :func:`eval`, or when reading the initial script " "or standard input (also interactively)." msgstr "" -"パーザが構文エラーに遭遇した場合に送出されます。この例外は :keyword:`import` " -"文、組み込み関数 :func:`compile`、:func:`exec` や :func:`eval` 、初期化スクリ" -"プトの読み込みや標準入力で (対話的な実行時にも) 起こる可能性があります。" +"パーザが構文エラーに遭遇した場合に送出されます。\n" +"この例外は、:keyword:`import` 文、組み込み関数 :func:`compile`、:func:" +"`exec`、:func:`eval` の呼び出し、\n" +"最初に実行するスクリプトや標準入力の読み込み時 (対話的な実行時も含みます) に" +"起こる可能性があります。" #: ../../library/exceptions.rst:516 msgid "" @@ -857,7 +893,6 @@ msgstr "" "タブとスペースを一貫しない方法でインデントに使っているときに送出されます。こ" "れは :exc:`IndentationError` のサブクラスです。" -#: ../../library/exceptions.rst:569 msgid "" "Raised when the interpreter finds an internal error, but the situation does " "not look so serious to cause it to abandon all hope. The associated value is " @@ -865,8 +900,12 @@ msgid "" "`CPython`, this could be raised by incorrectly using Python's C API, such as " "returning a ``NULL`` value without an exception set." msgstr "" +"インタープリタが内部エラーを検出したものの、実行の継続を断念するほど深刻な状" +"況ではない場合に送出されます。\n" +"関連値は、何が問題だったのかを低水準の用語で示す文字列です。\n" +":term:`CPython` では、例外を設定せずに ``NULL`` 値を返すなど、Python の C " +"API を誤って使うと送出されることがあります。" -#: ../../library/exceptions.rst:575 msgid "" "If you're confident that this exception wasn't your fault, or the fault of a " "package you're using, you should report this to the author or maintainer of " @@ -876,6 +915,13 @@ msgid "" "associated value) and if possible the source of the program that triggered " "the error." msgstr "" +"この例外の原因が自分のコードにも使用中のパッケージにもないと確信できる場合" +"は、\n" +"使用している Python インタープリタの作者やメンテナに報告してください。\n" +"Python インタープリタのバージョン (``sys.version`` の値で、対話型 Python セッ" +"ションの開始時にも表示されます)、\n" +"正確なエラーメッセージ (例外の関連値)、可能であればエラーを引き起こしたプログ" +"ラムのソースを必ず報告してください。" #: ../../library/exceptions.rst:586 msgid "" @@ -923,26 +969,25 @@ msgstr "" "コンストラクタに渡された終了ステータス又はエラーメッセージ。(デフォルトは " "``None``)" -#: ../../library/exceptions.rst:612 msgid "" "Raised when an operation or function is applied to an object of " "inappropriate type. The associated value is a string giving details about " "the type mismatch." msgstr "" -"組み込み演算または関数が適切でない型のオブジェクトに対して適用された際に送出" -"されます。関連値は型の不整合に関して詳細を述べた文字列です。" +"演算や関数を適切でない型のオブジェクトに適用した場合に送出されます。\n" +"関連値は、型の不整合の詳細を示す文字列です。" -#: ../../library/exceptions.rst:615 msgid "" "This exception may be raised by user code to indicate that an attempted " "operation on an object is not supported, and is not meant to be. If an " "object is meant to support a given operation but has not yet provided an " "implementation, :exc:`NotImplementedError` is the proper exception to raise." msgstr "" -"この例外は、そのオブジェクトで実行しようとした操作がサポートされておらず、そ" -"の予定もない場合にユーザーコードから送出されるかもしれません。オブジェクトで" -"その操作をサポートするつもりだが、まだ実装を提供していないのであれば、送出す" -"る適切な例外は :exc:`NotImplementedError` です。" +"そのオブジェクトで実行しようとした操作がサポートされておらず、サポートする意" +"図もないことを示すために、\n" +"ユーザコードからこの例外を送出することもできます。\n" +"操作をサポートする意図はあるものの、まだ実装していない場合には、:exc:" +"`NotImplementedError` を送出するのが適切です。" #: ../../library/exceptions.rst:620 msgid "" @@ -999,11 +1044,12 @@ msgstr "コーデックがエンコードまたはデコードしようとした msgid "The first index of invalid data in :attr:`object`." msgstr ":attr:`object` の最初の無効なデータのインデクスです。" -#: ../../library/exceptions.rst:657 ../../library/exceptions.rst:664 msgid "" "This value should not be negative as it is interpreted as an absolute offset " "but this constraint is not enforced at runtime." msgstr "" +"この値は絶対オフセットとして解釈されるため、負の値にすべきではありませんが、" +"この制約は実行時には強制されません。" #: ../../library/exceptions.rst:662 msgid "The index after the last invalid data in :attr:`object`." @@ -1033,23 +1079,22 @@ msgstr "" "Unicode 関連のエラーが変換中に発生した際に送出されます。 :exc:`UnicodeError` " "のサブクラスです。" -#: ../../library/exceptions.rst:688 msgid "" "Raised when an operation or function receives an argument that has the right " "type but an inappropriate value, and the situation is not described by a " "more precise exception such as :exc:`IndexError`." msgstr "" -"演算子や関数が、正しい型だが適切でない値を持つ引数を受け取ったときや、 :exc:" -"`IndexError` のようなより詳細な例外では記述できない状況で送出されます。" +"演算や関数が、型は正しいものの値が適切でない実引数を受け取り、\n" +"かつ、その状況を :exc:`IndexError` などのより具体的な例外で表せない場合に送出" +"されます。" -#: ../../library/exceptions.rst:695 msgid "" "Raised when the second argument of a division or modulo operation is zero. " "The associated value is a string indicating the type of the operands and the " "operation." msgstr "" -"除算や剰余演算の第二引数が 0 であった場合に送出されます。関連値は文字列で、そ" -"の演算における被演算子と演算子の型を示します。" +"除算や剰余演算の第2引数がゼロの場合に送出されます。\n" +"関連値は、被演算子の型と演算の種類を示す文字列です。" #: ../../library/exceptions.rst:700 msgid "" @@ -1075,17 +1120,16 @@ msgstr "" "以下の例外は :exc:`OSError` のサブクラスで、システムエラーコードに依存して送" "出されます。" -#: ../../library/exceptions.rst:720 msgid "" "Raised when an operation would block on an object (e.g. socket) set for non-" "blocking operation. Corresponds to :c:data:`errno` :py:const:`~errno." "EAGAIN`, :py:const:`~errno.EALREADY`, :py:const:`~errno.EWOULDBLOCK` and :py:" "const:`~errno.EINPROGRESS`." msgstr "" -"ある操作が、ノンブロッキング操作に設定されたオブジェクト (例えばソケット) を" -"ブロックしそうになった場合に送出されます。:c:data:`errno` :py:const:`~errno." -"EAGAIN`, :py:const:`~errno.EALREADY`, :py:const:`~errno.EWOULDBLOCK` および :" -"py:const:`~errno.EINPROGRESS` に対応します。" +"ノンブロッキング操作に設定されたオブジェクト (例えばソケット) に対する操作を" +"すぐに完了できず、待機が必要な場合に送出されます。\n" +":c:data:`errno` :py:const:`~errno.EAGAIN`、:py:const:`~errno.EALREADY`、:py:" +"const:`~errno.EWOULDBLOCK`、:py:const:`~errno.EINPROGRESS` に対応します。" #: ../../library/exceptions.rst:725 msgid "" @@ -1124,17 +1168,18 @@ msgstr "" "サブクラスは :exc:`BrokenPipeError`, :exc:`ConnectionAbortedError`, :exc:" "`ConnectionRefusedError`, :exc:`ConnectionResetError` です。" -#: ../../library/exceptions.rst:748 msgid "" "A subclass of :exc:`ConnectionError`, raised when trying to write on a pipe " "while the other end has been closed, or trying to write on a socket which " "has been shutdown for writing. Corresponds to :c:data:`errno` :py:const:" "`~errno.EPIPE` and :py:const:`~errno.ESHUTDOWN`." msgstr "" -":exc:`ConnectionError` のサブクラスで、もう一方の端が閉じられたパイプに書き込" -"こもうとするか、書き込みのためにシャットダウンされたソケットに書き込こもうと" -"した場合に発生します。 :c:data:`errno` :py:const:`~errno.EPIPE` と :py:" -"const:`~errno.ESHUTDOWN` に対応します。" +":exc:`ConnectionError` のサブクラスです。\n" +"もう一方の端が閉じられたパイプに書き込もうとした場合や、\n" +"書き込み側がシャットダウンされたソケットに書き込もうとした場合に送出されま" +"す。\n" +":c:data:`errno` :py:const:`~errno.EPIPE` と :py:const:`~errno.ESHUTDOWN` に対" +"応します。" #: ../../library/exceptions.rst:755 msgid "" @@ -1180,13 +1225,12 @@ msgstr "" "要求されたファイルやディレクトリが存在しない場合に送出されます。:c:data:" "`errno` :py:const:`~errno.ENOENT` に対応します。" -#: ../../library/exceptions.rst:783 msgid "" "Raised when a system call is interrupted by an incoming signal. Corresponds " "to :c:data:`errno` :py:const:`~errno.EINTR`." msgstr "" -"システムコールが入力信号によって中断された場合に送出されます。:c:data:" -"`errno` :py:const:`~errno.EINTR` に対応します。" +"システムコールが受信したシグナルによって中断された場合に送出されます。\n" +":c:data:`errno` :py:const:`~errno.EINTR` に対応します。" #: ../../library/exceptions.rst:786 msgid "" @@ -1206,7 +1250,6 @@ msgstr "" "ディレクトリに (:func:`os.remove` などの) ファイル操作が要求された場合に送出" "されます。:c:data:`errno` :py:const:`~errno.EISDIR` に対応します。" -#: ../../library/exceptions.rst:799 msgid "" "Raised when a directory operation (such as :func:`os.listdir`) is requested " "on something which is not a directory. On most POSIX platforms, it may also " @@ -1214,10 +1257,12 @@ msgid "" "as if it were a directory. Corresponds to :c:data:`errno` :py:const:`~errno." "ENOTDIR`." msgstr "" -"ディレクトリへの操作(たとえば :func:`os.listdir`)をディレクトリ以外に対して要" -"求された場合に送出されます。多くのPOSIXプラットフォームではディレクトリではな" -"いファイルをディレクトリとして開いたり移動するときにも発生する場合がありま" -"す。:c:data:`errno` :py:const:`~errno.ENOTDIR` に対応します。" +"ディレクトリに対する操作 (例えば :func:`os.listdir`) がディレクトリ以外の対象" +"に要求された場合に送出されます。\n" +"ほとんどの POSIX プラットフォームでは、ディレクトリでないファイルをディレクト" +"リとして開いたり、\n" +"パスをたどろうとしたりした場合にも送出されることがあります。\n" +":c:data:`errno` :py:const:`~errno.ENOTDIR` に対応します。" #: ../../library/exceptions.rst:807 msgid "" @@ -1282,13 +1327,11 @@ msgstr "警告カテゴリの基底クラスです。" msgid "Base class for warnings generated by user code." msgstr "ユーザコードによって生成される警告の基底クラスです。" -#: ../../library/exceptions.rst:855 msgid "" "Base class for warnings about deprecated features when those warnings are " "intended for other Python developers." msgstr "" -"他の Python 開発者へ向けて警告を発するときの、廃止予定の機能についての警告の" -"基底クラスです。" +"非推奨の機能について、他の Python 開発者に向けて発する警告の基底クラスです。" #: ../../library/exceptions.rst:858 msgid "" @@ -1300,27 +1343,24 @@ msgstr "" "化されています。:ref:`Python Development Mode ` を有効にするとこの警" "告が表示されます。" -#: ../../library/exceptions.rst:862 ../../library/exceptions.rst:878 msgid "The deprecation policy is described in :pep:`387`." -msgstr "" +msgstr "非推奨化の方針は :pep:`387` で説明されています。" -#: ../../library/exceptions.rst:867 msgid "" "Base class for warnings about features which are obsolete and expected to be " "deprecated in the future, but are not deprecated at the moment." msgstr "" -"古くなって将来的に廃止される予定だが、今のところは廃止されていない機能につい" -"ての警告の基底クラスです。" +"古くなっており、将来は非推奨になる見込みですが、現時点では非推奨ではない機能" +"についての警告の基底クラスです。" -#: ../../library/exceptions.rst:871 msgid "" "This class is rarely used as emitting a warning about a possible upcoming " "deprecation is unusual, and :exc:`DeprecationWarning` is preferred for " "already active deprecations." msgstr "" -"近々起こる可能性のある機能廃止について警告を発することはまれなので、このクラ" -"スはめったに使われず、既に決まっている廃止については :exc:" -"`DeprecationWarning` が望ましいです。" +"将来、非推奨になる可能性を事前に警告することは一般的ではないため、このクラス" +"はめったに使われません。\n" +"すでに非推奨となっている機能には :exc:`DeprecationWarning` が推奨されます。" #: ../../library/exceptions.rst:875 ../../library/exceptions.rst:901 #: ../../library/exceptions.rst:928 @@ -1331,13 +1371,11 @@ msgstr "" "デフォルトの警告フィルターで無効化されています。:ref:`Python Development " "Mode ` を有効にするとこの警告が表示されます。" -#: ../../library/exceptions.rst:883 msgid "Base class for warnings about dubious syntax." -msgstr "曖昧な構文に対する警告の基底クラスです。" +msgstr "疑わしい構文についての警告の基底クラスです。" -#: ../../library/exceptions.rst:888 msgid "Base class for warnings about dubious runtime behavior." -msgstr "あいまいなランタイム挙動に対する警告の基底クラスです。" +msgstr "疑わしい実行時の動作についての警告の基底クラスです。" #: ../../library/exceptions.rst:893 msgid "" @@ -1389,7 +1427,6 @@ msgstr "" "す。また、:keyword:`except*` によって判別でき、例外グループに含" "まれている例外の型に基づいてサブグループにマッチします。" -#: ../../library/exceptions.rst:948 msgid "" "Both of these exception types wrap the exceptions in the sequence ``excs``. " "The ``msg`` parameter must be a string. The difference between the two " @@ -1399,15 +1436,15 @@ msgid "" "is so that ``except Exception`` catches an :exc:`ExceptionGroup` but not :" "exc:`BaseExceptionGroup`." msgstr "" -"この2つの例外型は一連の例外 ``excs`` を包含します。``msg`` 引数は文字列の必要" -"があります。2つのクラスの異なる点は、:exc:`BaseException` は :exc:" -"`BaseExceptionGroup` を拡張して任意の例外を含められますが、:exc:" -"`ExceptionGroup` は :exc:`Exception` を拡張して :exc:`Exception` のサブクラス" -"のみを含められます。この設計により ``except Exception`` は :exc:" -"`ExceptionGroup` をキャッチしますが、:exc:`BaseExceptionGroup` はキャッチしま" -"せん。" +"どちらの例外型も、シーケンス ``excs`` に含まれる例外をまとめて保持します。\n" +"``msg`` パラメータは文字列でなければなりません。\n" +"2つのクラスの違いは、:exc:`BaseExceptionGroup` が :exc:`BaseException` を拡張" +"して任意の例外を保持できるのに対し、\n" +":exc:`ExceptionGroup` は :exc:`Exception` を拡張し、:exc:`Exception` のサブク" +"ラスの例外のみを保持できることです。\n" +"この設計により、``except Exception`` は :exc:`ExceptionGroup` を捕捉します" +"が、:exc:`BaseExceptionGroup` は捕捉しません。" -#: ../../library/exceptions.rst:956 msgid "" "The :exc:`BaseExceptionGroup` constructor returns an :exc:`ExceptionGroup` " "rather than a :exc:`BaseExceptionGroup` if all contained exceptions are :exc:" @@ -1415,11 +1452,13 @@ msgid "" "The :exc:`ExceptionGroup` constructor, on the other hand, raises a :exc:" "`TypeError` if any contained exception is not an :exc:`Exception` subclass." msgstr "" -":exc:`BaseExceptionGroup` のコンストラクターは含まれる例外がすべて :exc:" -"`Exception` の場合は :exc:`BaseExceptionGroup` ではなく :exc:" -"`ExceptionGroup` を返すように自動的に選択されます。一方 :exc:" -"`ExceptionGroup` コンストラクタは、:exc:`Exception` サブクラス以外の例外を含" -"む場合は :exc:`TypeError` を送出します。" +":exc:`BaseExceptionGroup` のコンストラクタは、保持する例外がすべて :exc:" +"`Exception` のインスタンスである場合、\n" +":exc:`BaseExceptionGroup` ではなく :exc:`ExceptionGroup` を返すので、クラスの" +"選択を自動化するために利用できます。\n" +"一方、:exc:`ExceptionGroup` のコンストラクタは、:exc:`Exception` のサブクラス" +"のインスタンスでない例外が一つでも含まれていると :exc:`TypeError` を送出しま" +"す。" #: ../../library/exceptions.rst:965 msgid "The ``msg`` argument to the constructor. This is a read-only attribute." @@ -1433,15 +1472,14 @@ msgstr "" "コンストラクタに渡された一連の ``excs`` に含まれる例外のタプルです。この属性" "は読み込み専用です。" -#: ../../library/exceptions.rst:974 msgid "" "Returns an exception group that contains only the exceptions from the " "current group that match *condition*, or ``None`` if the result is empty." msgstr "" -"現在のグループで *条件* にマッチする礼儀のみを含む例外グループを返します。結" -"果が空の場合は ``None`` を返します。" +"現在のグループの例外のうち、*condition* にマッチするものだけを含む例外グルー" +"プを返します。\n" +"結果が空の場合は ``None`` を返します。" -#: ../../library/exceptions.rst:977 msgid "" "The condition can be an exception type or tuple of exception types, in which " "case each exception is checked for a match using the same check that is used " @@ -1449,8 +1487,11 @@ msgid "" "type object) that accepts an exception as its single argument and returns " "true for the exceptions that should be in the subgroup." msgstr "" +"条件には例外型または例外型のタプルを指定でき、\n" +"その場合は ``except`` 節と同じ判定方法で各例外がマッチするかを調べます。\n" +"また、例外を唯一の引数として受け取り、サブグループに含めるべき例外に対して真" +"を返す呼び出し可能オブジェクト (型オブジェクトを除く) も指定できます。" -#: ../../library/exceptions.rst:983 msgid "" "The nesting structure of the current exception is preserved in the result, " "as are the values of its :attr:`message`, :attr:`~BaseException." @@ -1458,17 +1499,25 @@ msgid "" "__context__` and :attr:`~BaseException.__notes__` fields. Empty nested " "groups are omitted from the result." msgstr "" +"結果には、現在の例外の入れ子構造と、:attr:`message`、:attr:`~BaseException." +"__traceback__`、:attr:`~BaseException.__cause__`、:attr:`~BaseException." +"__context__`、:attr:`~BaseException.__notes__` の各フィールドの値が保持されま" +"す。\n" +"入れ子になった空のグループは結果から除かれます。" -#: ../../library/exceptions.rst:990 msgid "" "The condition is checked for all exceptions in the nested exception group, " "including the top-level and any nested exception groups. If the condition is " "true for such an exception group, it is included in the result in full." msgstr "" +"条件は、最上位の例外グループと入れ子になったすべての例外グループも含め、\n" +"入れ子の例外グループ内のすべての例外に対して調べられます。\n" +"例外グループに対して条件が真となる場合、そのグループ全体が結果に含まれます。" -#: ../../library/exceptions.rst:994 msgid "``condition`` can be any callable which is not a type object." msgstr "" +"``condition`` に、型オブジェクト以外の任意の呼び出し可能オブジェクトを指定で" +"きるようになりました。" #: ../../library/exceptions.rst:999 msgid "" @@ -1487,13 +1536,17 @@ msgstr "" "同じ :attr:`message` の例外グループを返しますが、``excs`` の例外を含んでいま" "す。" -#: ../../library/exceptions.rst:1008 msgid "" "This method is used by :meth:`subgroup` and :meth:`split`, which are used in " "various contexts to break up an exception group. A subclass needs to " "override it in order to make :meth:`subgroup` and :meth:`split` return " "instances of the subclass rather than :exc:`ExceptionGroup`." msgstr "" +"このメソッドは、さまざまな状況で例外グループを分割するために使われる :meth:" +"`subgroup` と :meth:`split` から呼び出されます。\n" +"サブクラスで :meth:`subgroup` と :meth:`split` が :exc:`ExceptionGroup` では" +"なくそのサブクラスのインスタンスを返すようにするには、\n" +"このメソッドをオーバーライドする必要があります。" #: ../../library/exceptions.rst:1014 msgid "" @@ -1509,7 +1562,6 @@ msgstr "" "返す例外グループにコピーするため、:meth:`derive` ではこれらのフィールドを更新" "する必要がありません。" -#: ../../library/exceptions.rst:1021 msgid "" ">>> class MyGroup(ExceptionGroup):\n" "... def derive(self, excs):\n" @@ -1537,6 +1589,31 @@ msgid "" ">>> exc.__traceback__ is match.__traceback__ is rest.__traceback__\n" "True" msgstr "" +">>> class MyGroup(ExceptionGroup):\n" +"... def derive(self, excs):\n" +"... return MyGroup(self.message, excs)\n" +"...\n" +">>> e = MyGroup(\"eg\", [ValueError(1), TypeError(2)])\n" +">>> e.add_note(\"a note\")\n" +">>> e.__context__ = Exception(\"context\")\n" +">>> e.__cause__ = Exception(\"cause\")\n" +">>> try:\n" +"... raise e\n" +"... except Exception as e:\n" +"... exc = e\n" +"...\n" +">>> match, rest = exc.split(ValueError)\n" +">>> exc, exc.__context__, exc.__cause__, exc.__notes__\n" +"(MyGroup('eg', [ValueError(1), TypeError(2)]), Exception('context'), " +"Exception('cause'), ['a note'])\n" +">>> match, match.__context__, match.__cause__, match.__notes__\n" +"(MyGroup('eg', [ValueError(1)]), Exception('context'), Exception('cause'), " +"['a note'])\n" +">>> rest, rest.__context__, rest.__cause__, rest.__notes__\n" +"(MyGroup('eg', [TypeError(2)]), Exception('context'), Exception('cause'), " +"['a note'])\n" +">>> exc.__traceback__ is match.__traceback__ is rest.__traceback__\n" +"True" #: ../../library/exceptions.rst:1047 msgid "" @@ -1547,7 +1624,6 @@ msgid "" "group's message from it. ::" msgstr "" -#: ../../library/exceptions.rst:1053 msgid "" "class Errors(ExceptionGroup):\n" " def __new__(cls, errors, exit_code):\n" @@ -1558,13 +1634,24 @@ msgid "" " def derive(self, excs):\n" " return Errors(excs, self.exit_code)" msgstr "" +"class Errors(ExceptionGroup):\n" +" def __new__(cls, errors, exit_code):\n" +" self = super().__new__(Errors, f\"exit code: {exit_code}\", errors)\n" +" self.exit_code = exit_code\n" +" return self\n" +"\n" +" def derive(self, excs):\n" +" return Errors(excs, self.exit_code)" -#: ../../library/exceptions.rst:1062 msgid "" "Like :exc:`ExceptionGroup`, any subclass of :exc:`BaseExceptionGroup` which " "is also a subclass of :exc:`Exception` can only wrap instances of :exc:" "`Exception`." msgstr "" +":exc:`ExceptionGroup` と同様に、:exc:`BaseExceptionGroup` のサブクラスであ" +"り、\n" +"かつ :exc:`Exception` のサブクラスでもあるクラスは、:exc:`Exception` のインス" +"タンスのみを保持できます。" #: ../../library/exceptions.rst:1070 msgid "Exception hierarchy" diff --git a/library/faulthandler.po b/library/faulthandler.po index f98949dc4..b6b82f746 100644 --- a/library/faulthandler.po +++ b/library/faulthandler.po @@ -19,17 +19,16 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/faulthandler.rst:2 msgid ":mod:`!faulthandler` --- Dump the Python traceback" msgstr ":mod:`!faulthandler` --- Python トレースバックをダンプする" -#: ../../library/faulthandler.rst:11 msgid "" "This module contains functions to dump Python tracebacks explicitly, on a " "fault, after a timeout, or on a user signal. Call :func:`faulthandler." @@ -39,14 +38,16 @@ msgid "" "setting the :envvar:`PYTHONFAULTHANDLER` environment variable or by using " "the :option:`-X` ``faulthandler`` command line option." msgstr "" -"このモジュールは、例外発生時、タイムアウト時、ユーザシグナルの発生時などのタ" -"イミングでpython tracebackを明示的にダンプするための関数を含んでいます。これ" -"らのシグナル、:const:`~signal.SIGSEGV`、:const:`~signal.SIGFPE`、:const:" -"`~signal.SIGABRT`、:const:`~signal.SIGBUS`、:const:`~signal.SIGILL` に対する" -"フォールトハンドラをインストールするには :func:`faulthandler.enable` を実行し" -"てください。python起動時に有効にするには環境変数 :envvar:" -"`PYTHONFAULTHANDLER` を設定するか、コマンドライン引数に :option:`-X` " -"``faulthandler`` を指定してください。" +"このモジュールには、Python のトレースバックを明示的にダンプしたり、フォールト" +"の発生時、タイムアウト後、ユーザーシグナルの受信時にダンプしたりする関数があ" +"ります。\n" +":const:`~signal.SIGSEGV`、:const:`~signal.SIGFPE`、:const:`~signal." +"SIGABRT`、:const:`~signal.SIGBUS`、:const:`~signal.SIGILL` シグナルに対する" +"フォールトハンドラを登録するには、:func:`faulthandler.enable` を呼び出してく" +"ださい。\n" +"環境変数 :envvar:`PYTHONFAULTHANDLER` を設定するか、コマンドラインオプショ" +"ン :option:`-X` ``faulthandler`` を指定すると、起動時に有効にすることもできま" +"す。" #: ../../library/faulthandler.rst:19 msgid "" @@ -85,20 +86,18 @@ msgstr "" msgid "Each string is limited to 500 characters." msgstr "すべての文字列は500文字以内に制限されています。" -#: ../../library/faulthandler.rst:32 msgid "" "Only the filename, the function name and the line number are displayed. (no " "source code)" msgstr "" -"ファイル名、関数名、行数のみ表示します。(ソースコードの表示はありません)" +"ファイル名、関数名、行番号だけを表示します (ソースコードは表示しません)。" #: ../../library/faulthandler.rst:34 msgid "It is limited to 100 frames and 100 threads." msgstr "100フレーム、100スレッドに制限されています。" -#: ../../library/faulthandler.rst:35 msgid "The order is reversed: the most recent call is shown first." -msgstr "順番は保持されます: 最新の呼び出しが最初に表示されます。" +msgstr "順序は逆で、最も新しい呼び出しから表示します。" #: ../../library/faulthandler.rst:37 msgid "" @@ -119,29 +118,30 @@ msgstr "" "モジュールはC言語で実装されているので、アプリのクラッシュ時でもPythonがデッド" "ロックした場合でもダンプができます。" -#: ../../library/faulthandler.rst:44 msgid "" "The :ref:`Python Development Mode ` calls :func:`faulthandler." "enable` at Python startup." msgstr "" +":ref:`Python 開発モード ` は Python の起動時に :func:`faulthandler." +"enable` を呼び出します。" #: ../../library/faulthandler.rst:49 msgid "Module :mod:`pdb`" -msgstr "" +msgstr ":mod:`pdb` モジュール" -#: ../../library/faulthandler.rst:50 msgid "Interactive source code debugger for Python programs." -msgstr "" +msgstr "Python プログラム用の対話的なソースコードデバッガです。" #: ../../library/faulthandler.rst:52 msgid "Module :mod:`traceback`" msgstr ":mod:`traceback` モジュール" -#: ../../library/faulthandler.rst:53 msgid "" "Standard interface to extract, format and print stack traces of Python " "programs." msgstr "" +"Python プログラムのスタックトレースを抽出・整形・表示する標準インターフェー" +"ス。" #: ../../library/faulthandler.rst:56 msgid "Dumping the traceback" @@ -155,41 +155,38 @@ msgstr "" "全スレッドのtracebackを *file* へダンプします。もし *all_threads* が " "``False`` であれば、現在のスレッドのみダンプします。" -#: ../../library/faulthandler.rst:63 msgid "" ":func:`traceback.print_tb`, which can be used to print a traceback object." -msgstr "" +msgstr "トレースバックオブジェクトの表示に使える :func:`traceback.print_tb`。" -#: ../../library/faulthandler.rst:65 ../../library/faulthandler.rst:119 -#: ../../library/faulthandler.rst:165 ../../library/faulthandler.rst:190 msgid "Added support for passing file descriptor to this function." -msgstr "" +msgstr "この関数にファイル記述子を渡せるようになりました。" -#: ../../library/faulthandler.rst:70 msgid "Dumping the C stack" -msgstr "" +msgstr "C スタックのダンプ" -#: ../../library/faulthandler.rst:76 msgid "Dump the C stack trace of the current thread into *file*." -msgstr "" +msgstr "現在のスレッドの C スタックトレースを *file* にダンプします。" -#: ../../library/faulthandler.rst:78 msgid "" "If the Python build does not support it or the operating system does not " "provide a stack trace, then this prints an error in place of a dumped C " "stack." msgstr "" +"Python のビルドが対応していない場合や、OS がスタックトレースを提供しない場合" +"は、C スタックのダンプの代わりにエラーを表示します。" -#: ../../library/faulthandler.rst:85 msgid "C Stack Compatibility" -msgstr "" +msgstr "C スタックの互換性" -#: ../../library/faulthandler.rst:87 msgid "" "If the system does not support the C-level :manpage:`backtrace(3)` or :" "manpage:`dladdr1(3)`, then C stack dumps will not work. An error will be " "printed instead of the stack." msgstr "" +"システムが C レベルの :manpage:`backtrace(3)` または :manpage:`dladdr1(3)` を" +"サポートしない場合、C スタックのダンプは機能しません。\n" +"スタックの代わりにエラーを表示します。" #: ../../library/faulthandler.rst:91 msgid "" @@ -199,17 +196,17 @@ msgid "" "dumping stacks." msgstr "" -#: ../../library/faulthandler.rst:97 msgid "" "Dumping C stacks can be arbitrarily slow, depending on the DWARF level of " "the binaries in the call stack." msgstr "" +"C スタックのダンプは、呼び出しスタック内のバイナリの DWARF レベルによっては非" +"常に時間がかかる場合があります。" #: ../../library/faulthandler.rst:101 msgid "Fault handler state" msgstr "フォールトハンドラの状態" -#: ../../library/faulthandler.rst:105 msgid "" "Enable the fault handler: install handlers for the :const:`~signal." "SIGSEGV`, :const:`~signal.SIGFPE`, :const:`~signal.SIGABRT`, :const:`~signal." @@ -217,39 +214,51 @@ msgid "" "*all_threads* is ``True``, produce tracebacks for every running thread. " "Otherwise, dump only the current thread." msgstr "" +"フォールトハンドラを有効にします。\n" +"Python のトレースバックをダンプするために、:const:`~signal.SIGSEGV`、:const:" +"`~signal.SIGFPE`、:const:`~signal.SIGABRT`、:const:`~signal.SIGBUS`、:const:" +"`~signal.SIGILL` シグナルのハンドラを登録します。\n" +"*all_threads* が ``True`` の場合は、実行中のすべてのスレッドのトレースバック" +"を出力します。\n" +"それ以外の場合は現在のスレッドだけをダンプします。" -#: ../../library/faulthandler.rst:112 msgid "" "The *file* must be kept open until the fault handler is disabled: see :ref:" "`issue with file descriptors `." msgstr "" +"フォールトハンドラを無効にするまで *file* を開いたままにしておく必要がありま" +"す。\n" +":ref:`ファイル記述子の問題 ` を参照してください。" -#: ../../library/faulthandler.rst:115 msgid "" "If *c_stack* is ``True``, then the C stack trace is printed after the Python " "traceback, unless the system does not support it. See :func:`dump_c_stack` " "for more information on compatibility." msgstr "" +"*c_stack* が ``True`` の場合、システムがサポートしていれば Python のトレース" +"バックの後に C スタックトレースを表示します。\n" +"互換性の詳細は :func:`dump_c_stack` を参照してください。" -#: ../../library/faulthandler.rst:122 msgid "On Windows, a handler for Windows exception is also installed." -msgstr "" +msgstr "Windows では、Windows 例外のハンドラも登録するようになりました。" -#: ../../library/faulthandler.rst:125 msgid "" "The dump now mentions if a garbage collector collection is running if " "*all_threads* is true." msgstr "" +"*all_threads* が真で、ガベージコレクタが回収処理を実行中の場合、そのこともダ" +"ンプに表示するようになりました。" -#: ../../library/faulthandler.rst:129 msgid "" "Only the current thread is dumped if the :term:`GIL` is disabled to prevent " "the risk of data races." msgstr "" +"データ競合の危険を防ぐため、:term:`GIL` が無効の場合は現在のスレッドだけをダ" +"ンプするようになりました。" -#: ../../library/faulthandler.rst:133 msgid "The dump now displays the C stack trace if *c_stack* is true." msgstr "" +"*c_stack* が真の場合、ダンプに C スタックトレースも表示するようになりました。" #: ../../library/faulthandler.rst:138 msgid "" @@ -278,20 +287,20 @@ msgid "" "a sub-second resolution." msgstr "" -#: ../../library/faulthandler.rst:159 msgid "" "The *file* must be kept open until the traceback is dumped or :func:" "`cancel_dump_traceback_later` is called: see :ref:`issue with file " "descriptors `." msgstr "" +"トレースバックがダンプされるか :func:`cancel_dump_traceback_later` が呼び出さ" +"れるまで、*file* を開いたままにしておく必要があります。\n" +":ref:`ファイル記述子の問題 ` を参照してください。" -#: ../../library/faulthandler.rst:163 msgid "This function is implemented using a watchdog thread." -msgstr "" +msgstr "この関数は監視用のスレッドを使って実装されています。" -#: ../../library/faulthandler.rst:168 msgid "This function is now always available." -msgstr "" +msgstr "この関数は常に利用可能になりました。" #: ../../library/faulthandler.rst:173 msgid "Cancel the last call to :func:`dump_traceback_later`." @@ -312,11 +321,13 @@ msgstr "" "れば現在のスレッドのみ *file* にダンプします。もし chain が ``True`` であれば" "以前のハンドラも呼び出します。" -#: ../../library/faulthandler.rst:185 msgid "" "The *file* must be kept open until the signal is unregistered by :func:" "`unregister`: see :ref:`issue with file descriptors `." msgstr "" +":func:`unregister` でシグナルの登録を解除するまで、*file* を開いたままにして" +"おく必要があります。\n" +":ref:`ファイル記述子の問題 ` を参照してください。" #: ../../library/faulthandler.rst:188 ../../library/faulthandler.rst:199 msgid "Not available on Windows." diff --git a/library/fcntl.po b/library/fcntl.po index e9d9976b5..1570d3d2c 100644 --- a/library/fcntl.po +++ b/library/fcntl.po @@ -19,27 +19,30 @@ msgstr "" "Last-Translator: Arihiro TAKASE, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/fcntl.rst:2 msgid ":mod:`!fcntl` --- The ``fcntl`` and ``ioctl`` system calls" msgstr ":mod:`!fcntl` --- ``fcntl`` および ``ioctl`` システムコール" -#: ../../library/fcntl.rst:16 msgid "" "This module performs file and I/O control on file descriptors. It is an " "interface to the :c:func:`fcntl` and :c:func:`ioctl` Unix routines. See the :" "manpage:`fcntl(2)` and :manpage:`ioctl(2)` Unix manual pages for full " "details." msgstr "" +"このモジュールはファイル記述子に対するファイル制御と I/O 制御を行います。\n" +"Unix の :c:func:`fcntl` と :c:func:`ioctl` ルーチンへのインターフェイスで" +"す。\n" +"詳細は Unix のマニュアルページ :manpage:`fcntl(2)` と :manpage:`ioctl(2)` を" +"参照してください。" -#: ../../library/fcntl.rst:21 msgid "Availability" -msgstr "" +msgstr "利用可能な環境" #: ../../library/fcntl.rst:23 msgid "" @@ -63,14 +66,15 @@ msgstr "" "以前は :exc:`IOError` を送出していたこのモジュールの操作が、 :exc:`OSError` " "を送出するようになりました。" -#: ../../library/fcntl.rst:33 msgid "" "The :mod:`!fcntl` module now contains ``F_ADD_SEALS``, ``F_GET_SEALS``, and " "``F_SEAL_*`` constants for sealing of :func:`os.memfd_create` file " "descriptors." msgstr "" +":mod:`!fcntl` モジュールに、:func:`os.memfd_create` のファイル記述子にシール" +"を設定するための定数 ``F_ADD_SEALS``、``F_GET_SEALS``、``F_SEAL_*`` が追加さ" +"れました。" -#: ../../library/fcntl.rst:38 msgid "" "On macOS, the :mod:`!fcntl` module exposes the ``F_GETPATH`` constant, which " "obtains the path of a file from a file descriptor. On Linux(>=3.15), the :" @@ -78,6 +82,11 @@ msgid "" "``F_OFD_SETLKW`` constants, which are used when working with open file " "description locks." msgstr "" +"macOS では、:mod:`!fcntl` モジュールにファイル記述子からファイルのパスを取得" +"する定数 ``F_GETPATH`` が追加されました。\n" +"Linux 3.15 以降では、:mod:`!fcntl` モジュールにオープンファイル記述のロックを" +"扱う定数 ``F_OFD_GETLK``、``F_OFD_SETLK``、``F_OFD_SETLKW`` が追加されまし" +"た。" #: ../../library/fcntl.rst:45 msgid "" @@ -86,12 +95,14 @@ msgid "" "size respectively." msgstr "" -#: ../../library/fcntl.rst:50 msgid "" "On FreeBSD, the :mod:`!fcntl` module exposes the ``F_DUP2FD`` and " "``F_DUP2FD_CLOEXEC`` constants, which allow to duplicate a file descriptor, " "the latter setting ``FD_CLOEXEC`` flag in addition." msgstr "" +"FreeBSD では、:mod:`!fcntl` モジュールにファイル記述子を複製する定数 " +"``F_DUP2FD`` と ``F_DUP2FD_CLOEXEC`` が追加されました。\n" +"後者は ``FD_CLOEXEC`` フラグも設定します。" #: ../../library/fcntl.rst:55 msgid "" @@ -101,7 +112,6 @@ msgid "" "XFS). This behavior is commonly referred to as \"copy-on-write\"." msgstr "" -#: ../../library/fcntl.rst:61 msgid "" "On Linux >= 2.6.32, the :mod:`!fcntl` module exposes the ``F_GETOWN_EX``, " "``F_SETOWN_EX``, ``F_OWNER_TID``, ``F_OWNER_PID``, ``F_OWNER_PGRP`` " @@ -121,6 +131,27 @@ msgid "" "macOS and NetBSD, the :mod:`!fcntl` module exposes the ``F_GETNOSIGPIPE`` " "and ``F_SETNOSIGPIPE`` constant." msgstr "" +"Linux 2.6.32 以降では、:mod:`!fcntl` モジュールに定数 ``F_GETOWN_EX``、" +"``F_SETOWN_EX``、``F_OWNER_TID``、``F_OWNER_PID``、``F_OWNER_PGRP`` が追加さ" +"れました。\n" +"これらを使うと、I/O が可能になったことを知らせるシグナルを特定のスレッド、プ" +"ロセス、プロセスグループに送れます。\n" +"Linux 4.13 以降では、:mod:`!fcntl` モジュールに定数 ``F_GET_RW_HINT``、" +"``F_SET_RW_HINT``、``F_GET_FILE_RW_HINT``、``F_SET_FILE_RW_HINT``、" +"``RWH_WRITE_LIFE_*`` が追加されました。\n" +"これらを使うと、指定した inode や特定のオープンファイル記述を介して書き込む" +"データについて、予想される寿命の相対的な長さをカーネルに伝えられます。\n" +"Linux 5.1 以降と NetBSD では、:mod:`!fcntl` モジュールに ``F_ADD_SEALS`` や " +"``F_GET_SEALS`` 操作で使う定数 ``F_SEAL_FUTURE_WRITE`` が追加されました。\n" +"FreeBSD では、:mod:`!fcntl` モジュールに定数 ``F_READAHEAD``、" +"``F_ISUNIONSTACK``、``F_KINFO`` が追加されました。\n" +"macOS と FreeBSD では、:mod:`!fcntl` モジュールに定数 ``F_RDAHEAD`` が追加さ" +"れました。\n" +"NetBSD と AIX では、:mod:`!fcntl` モジュールに定数 ``F_CLOSEM`` が追加されま" +"した。\n" +"NetBSD では、:mod:`!fcntl` モジュールに定数 ``F_MAXFD`` が追加されました。\n" +"macOS と NetBSD では、:mod:`!fcntl` モジュールに定数 ``F_GETNOSIGPIPE`` と " +"``F_SETNOSIGPIPE`` が追加されました。" #: ../../library/fcntl.rst:82 msgid "" @@ -144,11 +175,11 @@ msgid "" "C documentation." msgstr "" -#: ../../library/fcntl.rst:100 msgid "" "When *arg* is an integer, the function returns the integer return value of " "the C :c:func:`fcntl` call." msgstr "" +"*arg* が整数の場合、C の :c:func:`fcntl` 呼び出しの整数の返り値を返します。" #: ../../library/fcntl.rst:103 msgid "" @@ -161,9 +192,8 @@ msgid "" "the *arg* argument. This is limited to 1024 bytes." msgstr "" -#: ../../library/fcntl.rst:112 msgid "If the :c:func:`fcntl` call fails, an :exc:`OSError` is raised." -msgstr "" +msgstr ":c:func:`fcntl` の呼び出しに失敗すると :exc:`OSError` を送出します。" #: ../../library/fcntl.rst:115 msgid "" @@ -174,19 +204,19 @@ msgid "" "in a segmentation violation or a more subtle data corruption." msgstr "" -#: ../../library/fcntl.rst:122 msgid "" "Raises an :ref:`auditing event ` ``fcntl.fcntl`` with arguments " "``fd``, ``cmd``, ``arg``." msgstr "" "引数 ``fd``, ``cmd``, ``arg`` を指定して :ref:`監査イベント ` " -"``fcntl.fcntl`` を送出します。 " +"``fcntl.fcntl`` を送出します。" -#: ../../library/fcntl.rst:124 msgid "" "Add support of arbitrary :term:`bytes-like objects `, not " "only :class:`bytes`." msgstr "" +":class:`bytes` だけでなく、任意の :term:`bytes-like オブジェクト ` をサポートするようになりました。" #: ../../library/fcntl.rst:131 msgid "" @@ -196,28 +226,35 @@ msgstr "" "この関数は :func:`~fcntl.fcntl` 関数と同じですが、引数の扱いがより複雑である" "ところが異なります。" -#: ../../library/fcntl.rst:134 msgid "" "The *request* parameter is limited to values that can fit in 32-bits or 64-" "bits, depending on the platform. Additional constants of interest for use as " "the *request* argument can be found in the :mod:`termios` module, under the " "same names as used in the relevant C header files." msgstr "" +"*request* パラメータは、プラットフォームに応じて 32 ビットまたは 64 ビットに" +"収まる値に制限されます。\n" +"*request* 引数に使えるその他の定数は :mod:`termios` モジュールに、関連する C " +"ヘッダファイルと同じ名前で用意されています。" -#: ../../library/fcntl.rst:140 msgid "" "The parameter *arg* can be an integer, a :term:`bytes-like object`, or a " "string. The type and size of *arg* must match the type and size of the " "argument of the operation as specified in the relevant C documentation." msgstr "" +"*arg* パラメータには整数、:term:`bytes-like object`、文字列のいずれかを指定で" +"きます。\n" +"*arg* の型とサイズは、関連する C のドキュメントで指定された操作の引数の型とサ" +"イズに一致しなければなりません。" -#: ../../library/fcntl.rst:145 msgid "" "If *arg* does not support the read-write buffer interface or the " "*mutate_flag* is false, behavior is as for the :func:`~fcntl.fcntl` function." msgstr "" +"*arg* が読み書き可能なバッファインターフェイスをサポートしていない場合、また" +"は *mutate_flag* が偽の場合は、:func:`~fcntl.fcntl` 関数と同じ動作になりま" +"す。" -#: ../../library/fcntl.rst:149 msgid "" "If *arg* supports the read-write buffer interface (like :class:`bytearray`) " "and *mutate_flag* is true (the default), then the buffer is (in effect) " @@ -228,11 +265,19 @@ msgid "" "copied into a static buffer 1024 bytes long which is then passed to :func:" "`ioctl` and copied back into the supplied buffer." msgstr "" +"*arg* が :class:`bytearray` のように読み書き可能なバッファインターフェイスを" +"サポートし、*mutate_flag* が真 (デフォルト) の場合、実質的にはそのバッファが" +"基になる :c:func:`!ioctl` システムコールに渡されます。\n" +"システムコールの返り値が呼び出し元の Python に返され、バッファの新しい内容に" +"は :c:func:`ioctl` の処理が反映されます。\n" +"これは少し単純化した説明です。\n" +"実際には、渡したバッファの長さが 1024 バイト未満の場合は、まず長さ 1024 バイ" +"トの静的バッファにコピーしてから :func:`ioctl` に渡し、その後で元のバッファに" +"コピーし直します。" -#: ../../library/fcntl.rst:158 msgid "" "If the :c:func:`ioctl` call fails, an :exc:`OSError` exception is raised." -msgstr "" +msgstr ":c:func:`ioctl` の呼び出しに失敗すると :exc:`OSError` を送出します。" #: ../../library/fcntl.rst:161 msgid "" @@ -248,7 +293,6 @@ msgstr "" msgid "An example::" msgstr "以下に例を示します::" -#: ../../library/fcntl.rst:171 msgid "" ">>> import array, fcntl, struct, termios, os\n" ">>> os.getpgrp()\n" @@ -261,20 +305,30 @@ msgid "" ">>> buf\n" "array('h', [13341])" msgstr "" +">>> import array, fcntl, struct, termios, os\n" +">>> os.getpgrp()\n" +"13341\n" +">>> struct.unpack('h', fcntl.ioctl(0, termios.TIOCGPGRP, \" \"))[0]\n" +"13341\n" +">>> buf = array.array('h', [0])\n" +">>> fcntl.ioctl(0, termios.TIOCGPGRP, buf, 1)\n" +"0\n" +">>> buf\n" +"array('h', [13341])" -#: ../../library/fcntl.rst:182 msgid "" "Raises an :ref:`auditing event ` ``fcntl.ioctl`` with arguments " "``fd``, ``request``, ``arg``." msgstr "" "引数 ``fd``, ``request``, ``arg`` を指定して :ref:`監査イベント ` " -"``fcntl.ioctl`` を送出します。 " +"``fcntl.ioctl`` を送出します。" -#: ../../library/fcntl.rst:184 msgid "" "The GIL is always released during a system call. System calls failing with " "EINTR are automatically retried." msgstr "" +"システムコール中は常に GIL を解放するようになりました。\n" +"EINTR で失敗したシステムコールは自動的に再試行します。" #: ../../library/fcntl.rst:190 msgid "" @@ -288,18 +342,16 @@ msgstr "" "Unix マニュアルの :manpage:`flock(2)` を参照してください (システムによって" "は、この関数は :c:func:`fcntl` を使ってエミュレーションされています)。" -#: ../../library/fcntl.rst:195 msgid "" "If the :c:func:`flock` call fails, an :exc:`OSError` exception is raised." -msgstr "" +msgstr ":c:func:`flock` の呼び出しに失敗すると :exc:`OSError` を送出します。" -#: ../../library/fcntl.rst:197 msgid "" "Raises an :ref:`auditing event ` ``fcntl.flock`` with arguments " "``fd``, ``operation``." msgstr "" "引数 ``fd``, ``operation`` を指定して :ref:`監査イベント ` ``fcntl." -"flock`` を送出します。 " +"flock`` を送出します。" #: ../../library/fcntl.rst:202 msgid "" @@ -313,25 +365,22 @@ msgstr "" "IOBase.fileno` メソッドを提供するファイルオブジェクトも受け付けられます) " "で、 *cmd* は以下の値のうちいずれかになります:" -#: ../../library/fcntl.rst:209 msgid "Release an existing lock." -msgstr "" +msgstr "既存のロックを解放します。" -#: ../../library/fcntl.rst:213 msgid "Acquire a shared lock." -msgstr "" +msgstr "共有ロックを取得します。" -#: ../../library/fcntl.rst:217 msgid "Acquire an exclusive lock." -msgstr "" +msgstr "排他ロックを取得します。" -#: ../../library/fcntl.rst:221 msgid "" "Bitwise OR with any of the other three ``LOCK_*`` constants to make the " "request non-blocking." msgstr "" +"ほかの 3 つの ``LOCK_*`` 定数のいずれかとビット単位の OR を取り、要求を非ブ" +"ロッキングにします。" -#: ../../library/fcntl.rst:224 msgid "" "If :const:`!LOCK_NB` is used and the lock cannot be acquired, an :exc:" "`OSError` will be raised and the exception will have an *errno* attribute " @@ -340,6 +389,13 @@ msgid "" "systems, :const:`!LOCK_EX` can only be used if the file descriptor refers to " "a file opened for writing." msgstr "" +":const:`!LOCK_NB` を使い、ロックを取得できなかった場合は :exc:`OSError` を送" +"出します。\n" +"例外の *errno* 属性には :const:`~errno.EACCES` または :const:`~errno.EAGAIN` " +"が設定されます (OS に依存するため、可搬性を保つには両方の値を確認してくださ" +"い)。\n" +"少なくとも一部のシステムでは、:const:`!LOCK_EX` を使えるのは、書き込み用に開" +"いたファイルを指すファイル記述子の場合だけです。" #: ../../library/fcntl.rst:231 msgid "" @@ -351,17 +407,14 @@ msgstr "" "相対的なバイトオフセット、 *whence* は :func:`io.IOBase.seek` と同じで、具体" "的には:" -#: ../../library/fcntl.rst:235 msgid "``0`` -- relative to the start of the file (:const:`os.SEEK_SET`)" -msgstr "" +msgstr "``0`` -- ファイルの先頭を基準にします (:const:`os.SEEK_SET`)。" -#: ../../library/fcntl.rst:236 msgid "``1`` -- relative to the current buffer position (:const:`os.SEEK_CUR`)" -msgstr "" +msgstr "``1`` -- 現在のバッファ位置を基準にします (:const:`os.SEEK_CUR`)。" -#: ../../library/fcntl.rst:237 msgid "``2`` -- relative to the end of the file (:const:`os.SEEK_END`)" -msgstr "" +msgstr "``2`` -- ファイルの末尾を基準にします (:const:`os.SEEK_END`)。" #: ../../library/fcntl.rst:239 msgid "" @@ -373,19 +426,18 @@ msgstr "" "の標準の値は 0 で、ファイルの終了までロックすることを表します。*whence* の標" "準の値も 0 です。" -#: ../../library/fcntl.rst:243 msgid "" "Raises an :ref:`auditing event ` ``fcntl.lockf`` with arguments " "``fd``, ``cmd``, ``len``, ``start``, ``whence``." msgstr "" "引数 ``fd``, ``cmd``, ``len``, ``start``, ``whence`` を指定して :ref:`監査イ" -"ベント ` ``fcntl.lockf`` を送出します。 " +"ベント ` ``fcntl.lockf`` を送出します。" -#: ../../library/fcntl.rst:245 msgid "Examples (all on a SVR4 compliant system)::" -msgstr "以下に (全ての SVR4 互換システムでの) 例を示します::" +msgstr "" +"以下に例を示します。\n" +"いずれも SVR4 準拠のシステムで実行したものです。 ::" -#: ../../library/fcntl.rst:247 msgid "" "import struct, fcntl, os\n" "\n" @@ -395,6 +447,13 @@ msgid "" "lockdata = struct.pack('hhllhh', fcntl.F_WRLCK, 0, 0, 0, 0, 0)\n" "rv = fcntl.fcntl(f, fcntl.F_SETLKW, lockdata)" msgstr "" +"import struct, fcntl, os\n" +"\n" +"f = open(...)\n" +"rv = fcntl.fcntl(f, fcntl.F_SETFL, os.O_NDELAY)\n" +"\n" +"lockdata = struct.pack('hhllhh', fcntl.F_WRLCK, 0, 0, 0, 0, 0)\n" +"rv = fcntl.fcntl(f, fcntl.F_SETLKW, lockdata)" #: ../../library/fcntl.rst:255 msgid "" @@ -411,20 +470,21 @@ msgstr "" msgid "Module :mod:`os`" msgstr ":mod:`os` モジュール" -#: ../../library/fcntl.rst:264 msgid "" "If the locking flags :const:`~os.O_SHLOCK` and :const:`~os.O_EXLOCK` are " "present in the :mod:`os` module (on BSD only), the :func:`os.open` function " "provides an alternative to the :func:`lockf` and :func:`flock` functions." msgstr "" +"ロック用のフラグ :const:`~os.O_SHLOCK` と :const:`~os.O_EXLOCK` が :mod:`os` " +"モジュールにある場合 (BSD のみ)、:func:`os.open` 関数を :func:`lockf` や :" +"func:`flock` の代わりに使えます。" #: ../../library/fcntl.rst:10 msgid "UNIX" msgstr "UNIX" -#: ../../library/fcntl.rst:10 msgid "file control" -msgstr "" +msgstr "ファイル制御" #: ../../library/fcntl.rst:10 msgid "I/O control" diff --git a/library/filecmp.po b/library/filecmp.po index 47cd9c295..cb3f828d0 100644 --- a/library/filecmp.po +++ b/library/filecmp.po @@ -17,10 +17,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/filecmp.rst:2 @@ -53,18 +53,20 @@ msgstr "" "名前が *f1* および *f2* のファイルを比較し、二つのファイルが同じらしければ " "``True`` を返し、そうでなければ ``False`` を返します。" -#: ../../library/filecmp.rst:25 msgid "" "If *shallow* is true and the :func:`os.stat` signatures (file type, size, " "and modification time) of both files are identical, the files are taken to " "be equal." msgstr "" +"*shallow* が真で、両方のファイルの :func:`os.stat` による特徴 (ファイルの種" +"類、サイズ、更新時刻) が同一であれば、ファイルは同じとみなされます。" -#: ../../library/filecmp.rst:29 msgid "" "Otherwise, the files are treated as different if their sizes or contents " "differ." msgstr "" +"それ以外の場合は、サイズまたは内容が異なればファイルを異なるものとして扱いま" +"す。" #: ../../library/filecmp.rst:31 msgid "" @@ -138,23 +140,27 @@ msgstr "" msgid "The :class:`dircmp` class" msgstr ":class:`dircmp` クラス" -#: ../../library/filecmp.rst:75 msgid "" "Construct a new directory comparison object, to compare the directories *a* " "and *b*. *ignore* is a list of names to ignore, and defaults to :const:" "`filecmp.DEFAULT_IGNORES`. *hide* is a list of names to hide, and defaults " "to ``[os.curdir, os.pardir]``." msgstr "" +"ディレクトリ *a* と *b* を比較する、新しいディレクトリ比較オブジェクトを作成" +"します。\n" +"*ignore* は無視する名前のリストで、デフォルトは :const:`filecmp." +"DEFAULT_IGNORES` です。\n" +"*hide* は隠す名前のリストで、デフォルトは ``[os.curdir, os.pardir]`` です。" -#: ../../library/filecmp.rst:80 msgid "" "The :class:`dircmp` class compares files by doing *shallow* comparisons as " "described for :func:`filecmp.cmp` by default using the *shallow* parameter." msgstr "" +":class:`dircmp` クラスは *shallow* パラメータを使い、デフォルトでは :func:" +"`filecmp.cmp` で説明した浅い比較を行います。" -#: ../../library/filecmp.rst:86 msgid "Added the *shallow* parameter." -msgstr "" +msgstr "*shallow* パラメータが追加されました。" #: ../../library/filecmp.rst:88 msgid "The :class:`dircmp` class provides the following methods:" @@ -179,21 +185,22 @@ msgstr "" "*a* および *b* およびそれらの共通のサブディレクトリ間での比較結果を (再帰的に" "比較して) 出力します。" -#: ../../library/filecmp.rst:104 msgid "" "The :class:`dircmp` class offers a number of interesting attributes that may " "be used to get various bits of information about the directory trees being " "compared." msgstr "" -":class:`dircmp` クラスは、比較されているディレクトリ階層に関する様々な情報の" -"ビットを得るために使用することのできる、興味深い属性を数多く提供しています。" +":class:`dircmp` クラスには、比較するディレクトリツリーについてさまざまな情報" +"を取得できる便利な属性が用意されています。" -#: ../../library/filecmp.rst:108 msgid "" "Note that via :meth:`~object.__getattr__` hooks, all attributes are computed " "lazily, so there is no speed penalty if only those attributes which are " "lightweight to compute are used." msgstr "" +":meth:`~object.__getattr__` フックによって、すべての属性は必要になるまで計算" +"されません。\n" +"そのため計算が軽い属性だけを使う場合、重い計算による速度の低下はありません。" #: ../../library/filecmp.rst:115 msgid "The directory *a*." @@ -259,22 +266,25 @@ msgstr "" "*a* と *b* の両方に存在し、クラスのファイル比較オペレータに基づいて内容が異な" "るファイルです。" -#: ../../library/filecmp.rst:178 msgid "Files which are in both *a* and *b*, but could not be compared." -msgstr "*a* および *b* 両方にあるが、比較されなかったファイルです。" +msgstr "*a* と *b* の両方に存在するものの、比較できなかったファイルです。" -#: ../../library/filecmp.rst:183 msgid "" "A dictionary mapping names in :attr:`common_dirs` to :class:`dircmp` " "instances (or MyDirCmp instances if this instance is of type MyDirCmp, a " "subclass of :class:`dircmp`)." msgstr "" +":attr:`common_dirs` 内の名前を :class:`dircmp` インスタンスに対応付ける辞書で" +"す (このインスタンスの型が :class:`dircmp` のサブクラス ``MyDirCmp`` であれ" +"ば、値も ``MyDirCmp`` インスタンスになります)。" -#: ../../library/filecmp.rst:187 msgid "" "Previously entries were always :class:`dircmp` instances. Now entries are " "the same type as *self*, if *self* is a subclass of :class:`dircmp`." msgstr "" +"以前は各項目が常に :class:`dircmp` インスタンスでした。\n" +"現在は *self* が :class:`dircmp` のサブクラスのインスタンスであれば、各項目" +"も *self* と同じ型になります。" #: ../../library/filecmp.rst:196 msgid "List of directories ignored by :class:`dircmp` by default." @@ -288,7 +298,6 @@ msgstr "" "これは ``subdirs`` 属性を使用して 2 つのディレクトリを再帰的に探索して、共通" "の異なるファイルを示すための単純化された例です::" -#: ../../library/filecmp.rst:202 msgid "" ">>> from filecmp import dircmp\n" ">>> def print_diff_files(dcmp):\n" @@ -301,3 +310,13 @@ msgid "" ">>> dcmp = dircmp('dir1', 'dir2')\n" ">>> print_diff_files(dcmp)" msgstr "" +">>> from filecmp import dircmp\n" +">>> def print_diff_files(dcmp):\n" +"... for name in dcmp.diff_files:\n" +"... print(\"diff_file %s found in %s and %s\" % (name, dcmp.left,\n" +"... dcmp.right))\n" +"... for sub_dcmp in dcmp.subdirs.values():\n" +"... print_diff_files(sub_dcmp)\n" +"...\n" +">>> dcmp = dircmp('dir1', 'dir2')\n" +">>> print_diff_files(dcmp)" diff --git a/library/fileformats.po b/library/fileformats.po index b3f2a36c0..ad67e5e3a 100644 --- a/library/fileformats.po +++ b/library/fileformats.po @@ -16,10 +16,10 @@ msgstr "" "Last-Translator: tomo, 2021\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/fileformats.rst:5 diff --git a/library/fileinput.po b/library/fileinput.po index e2e2ec265..8eb171316 100644 --- a/library/fileinput.po +++ b/library/fileinput.po @@ -20,10 +20,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/fileinput.rst:2 @@ -48,12 +48,14 @@ msgstr "" msgid "The typical use is::" msgstr "典型的な使い方は以下の通りです::" -#: ../../library/fileinput.rst:20 msgid "" "import fileinput\n" "for line in fileinput.input(encoding=\"utf-8\"):\n" " process(line)" msgstr "" +"import fileinput\n" +"for line in fileinput.input(encoding=\"utf-8\"):\n" +" process(line)" #: ../../library/fileinput.rst:24 msgid "" @@ -118,7 +120,6 @@ msgstr "" "ファイルの各行は、各種改行文字まで含めて返されます。ファイルの最後が改行文字" "で終っていない場合には、改行文字で終わらない行が返されます。" -#: ../../library/fileinput.rst:49 msgid "" "You can control how files are opened by providing an opening hook via the " "*openhook* parameter to :func:`fileinput.input` or :func:`FileInput`. The " @@ -128,21 +129,29 @@ msgid "" "keyword arguments. This module provides a :func:`hook_compressed` to support " "compressed files." msgstr "" +":func:`fileinput.input` または :func:`FileInput` の *openhook* パラメータに" +"オープン時のフックを渡すと、ファイルの開き方を制御できます。\n" +"フックは *filename* と *mode* の 2 つの引数を受け取り、それに従って開いたファ" +"イル類似オブジェクトを返す関数でなければなりません。\n" +"*encoding* や *errors* を指定すると、追加のキーワード引数としてフックに渡され" +"ます。\n" +"このモジュールには圧縮ファイルに対応する :func:`hook_compressed` が用意されて" +"います。" #: ../../library/fileinput.rst:56 msgid "The following function is the primary interface of this module:" msgstr "以下の関数がこのモジュールの基本的なインターフェースです:" -#: ../../library/fileinput.rst:61 msgid "" "Create an instance of the :class:`FileInput` class. The instance will be " "used as global state for the functions of this module, and is also returned " "to use during iteration. The parameters to this function will be passed " "along to the constructor of the :class:`FileInput` class." msgstr "" -":class:`FileInput` クラスのインスタンスを作ります。生成されたインスタンスは、" -"このモジュールの関数群が利用するグローバルな状態として利用されます。この関数" -"への引数は :class:`FileInput` クラスのコンストラクタへ渡されます。" +":class:`FileInput` クラスのインスタンスを作成します。\n" +"このインスタンスはモジュール内の関数が使うグローバルな状態になり、反復処理に" +"使えるよう戻り値としても返されます。\n" +"この関数の引数は :class:`FileInput` クラスのコンストラクタに渡されます。" #: ../../library/fileinput.rst:66 msgid "" @@ -155,13 +164,16 @@ msgstr "" "次の例では、仮に例外が生じたとしても :keyword:`!with` 文から抜けた後で " "*input* は閉じられます::" -#: ../../library/fileinput.rst:70 msgid "" "with fileinput.input(files=('spam.txt', 'eggs.txt'), encoding=\"utf-8\") as " "f:\n" " for line in f:\n" " process(line)" msgstr "" +"with fileinput.input(files=('spam.txt', 'eggs.txt'), encoding=\"utf-8\") as " +"f:\n" +" for line in f:\n" +" process(line)" #: ../../library/fileinput.rst:74 ../../library/fileinput.rst:170 msgid "Can be used as a context manager." @@ -172,10 +184,8 @@ msgid "The keyword parameters *mode* and *openhook* are now keyword-only." msgstr "" "キーワード引数 *mode* と *openhook* は、キーワード専用引数になりました。" -#: ../../library/fileinput.rst:80 ../../library/fileinput.rst:176 -#: ../../library/fileinput.rst:210 msgid "The keyword-only parameter *encoding* and *errors* are added." -msgstr "" +msgstr "キーワード専用引数 *encoding* と *errors* が追加されました。" #: ../../library/fileinput.rst:84 msgid "" @@ -303,11 +313,11 @@ msgstr "" "ければなりません。この関数の返り値は、オープンしたファイルオブジェクトとなり" "ます。*inplace* と *openhook* を同時に使うことはできません。" -#: ../../library/fileinput.rst:161 msgid "" "You can specify *encoding* and *errors* that is passed to :func:`open` or " "*openhook*." msgstr "" +":func:`open` または *openhook* に渡す *encoding* と *errors* を指定できます。" #: ../../library/fileinput.rst:163 msgid "" @@ -320,22 +330,24 @@ msgstr "" "次の例では、仮に例外が生じたとしても :keyword:`!with` 文から抜けた後で " "*input* は閉じられます::" -#: ../../library/fileinput.rst:167 msgid "" "with FileInput(files=('spam.txt', 'eggs.txt')) as input:\n" " process(input)" msgstr "" +"with FileInput(files=('spam.txt', 'eggs.txt')) as input:\n" +" process(input)" #: ../../library/fileinput.rst:173 msgid "The keyword parameter *mode* and *openhook* are now keyword-only." msgstr "" "キーワード引数 *mode* と *openhook* は、キーワード専用引数になりました。" -#: ../../library/fileinput.rst:179 msgid "" "The ``'rU'`` and ``'U'`` modes and the :meth:`!__getitem__` method have been " "removed." msgstr "" +"``'rU'`` と ``'U'`` モード、および :meth:`!__getitem__` メソッドが削除されま" +"した。" #: ../../library/fileinput.rst:184 msgid "" @@ -378,11 +390,12 @@ msgstr "" "ます。ファイルの拡張子が ``'.gz'`` や ``'.bz2'`` でない場合は、通常通りファイ" "ルをオープンします (つまり、 :func:`open` をコールする際に伸長を行いません)。" -#: ../../library/fileinput.rst:205 msgid "" "The *encoding* and *errors* values are passed to :class:`io.TextIOWrapper` " "for compressed files and open for normal files." msgstr "" +"*encoding* と *errors* の値は、圧縮ファイルの場合は :class:`io." +"TextIOWrapper` に、通常のファイルの場合は ``open()`` に渡されます。" #: ../../library/fileinput.rst:208 msgid "" @@ -412,8 +425,9 @@ msgstr "" msgid "Added the optional *errors* parameter." msgstr "オプションの *errors* 引数が追加されました。" -#: ../../library/fileinput.rst:226 msgid "" "This function is deprecated since :func:`fileinput.input` and :class:" "`FileInput` now have *encoding* and *errors* parameters." msgstr "" +":func:`fileinput.input` と :class:`FileInput` に *encoding* と *errors* パラ" +"メータが追加されたため、この関数は非推奨になりました。" diff --git a/library/filesys.po b/library/filesys.po index d93c1fb16..2f30414b2 100644 --- a/library/filesys.po +++ b/library/filesys.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/filesys.rst:5 diff --git a/library/fnmatch.po b/library/fnmatch.po index 2930f573e..4250a43e8 100644 --- a/library/fnmatch.po +++ b/library/fnmatch.po @@ -21,10 +21,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/fnmatch.rst:2 @@ -93,7 +93,6 @@ msgstr "" "リテラルにマッチさせるには、メタ文字を括弧に入れてください。例えば、" "``'[?]'`` は文字 ``'?'`` にマッチします。" -#: ../../library/fnmatch.rst:43 msgid "" "Note that the filename separator (``'/'`` on Unix) is *not* special to this " "module. See module :mod:`glob` for pathname expansion (:mod:`glob` uses :" @@ -101,19 +100,24 @@ msgid "" "with a period are not special for this module, and are matched by the ``*`` " "and ``?`` patterns." msgstr "" -"ファイル名の区切り文字 (Unixでは ``'/'``) はこのモジュールに固有なものでは *" -"ない* ことに注意してください。パス名展開については、 :mod:`glob` モジュールを" -"参照してください (:mod:`glob` はパス名の部分にマッチさせるのに :func:`." -"filter` を使っています)。同様に、ピリオドで始まるファイル名はこのモジュールに" -"固有ではなくて、 ``*`` と ``?`` のパターンでマッチします。" +"ファイル名の区切り文字 (Unix では ``'/'``) は、このモジュールでは特別扱い *さ" +"れません*。\n" +"パス名の展開については :mod:`glob` モジュールを参照してください (:mod:`glob` " +"はパス名の各部分の照合に :func:`.filter` を使います)。\n" +"同様に、ピリオドで始まるファイル名も特別扱いされず、``*`` や ``?`` のパターン" +"にマッチします。" -#: ../../library/fnmatch.rst:49 msgid "" "Unless stated otherwise, \"filename string\" and \"pattern string\" either " "refer to :class:`str` or ``ISO-8859-1`` encoded :class:`bytes` objects. Note " "that the functions documented below do not allow to mix a :class:`!bytes` " "pattern with a :class:`!str` filename, and vice-versa." msgstr "" +"特に断りがなければ、「ファイル名文字列」と「パターン文字列」は :class:`str` " +"または ``ISO-8859-1`` でエンコードされた :class:`bytes` オブジェクトを指しま" +"す。\n" +"以下の関数では、:class:`!bytes` のパターンと :class:`!str` のファイル名を混在" +"させることはできず、その逆も同様です。" #: ../../library/fnmatch.rst:54 msgid "" @@ -144,7 +148,6 @@ msgstr "" "次の例では、カレントディレクトリにある、拡張子が ``.txt`` である全てのファイ" "ルを表示しています::" -#: ../../library/fnmatch.rst:70 msgid "" "import fnmatch\n" "import os\n" @@ -153,6 +156,12 @@ msgid "" " if fnmatch.fnmatch(file, '*.txt'):\n" " print(file)" msgstr "" +"import fnmatch\n" +"import os\n" +"\n" +"for file in os.listdir('.'):\n" +" if fnmatch.fnmatch(file, '*.txt'):\n" +" print(file)" #: ../../library/fnmatch.rst:80 msgid "" @@ -164,20 +173,26 @@ msgstr "" "``True`` または ``False`` を返します。比較は大文字、小文字を区別し、 :func:" "`os.path.normcase` は適用しません。" -#: ../../library/fnmatch.rst:87 msgid "" "Construct a list from those elements of the :term:`iterable` of filename " "strings *names* that match the pattern string *pat*. It is the same as ``[n " "for n in names if fnmatch(n, pat)]``, but implemented more efficiently." msgstr "" +"ファイル名文字列の :term:`イテラブル ` *names* のうち、パターン文字" +"列 *pat* にマッチする要素からリストを作成します。\n" +"``[n for n in names if fnmatch(n, pat)]`` と同じですが、より効率的に実装され" +"ています。" -#: ../../library/fnmatch.rst:95 msgid "" "Construct a list from those elements of the :term:`iterable` of filename " "strings *names* that do not match the pattern string *pat*. It is the same " "as ``[n for n in names if not fnmatch(n, pat)]``, but implemented more " "efficiently." msgstr "" +"ファイル名文字列の :term:`イテラブル ` *names* のうち、パターン文字" +"列 *pat* にマッチしない要素からリストを作成します。\n" +"``[n for n in names if not fnmatch(n, pat)]`` と同じですが、より効率的に実装" +"されています。" #: ../../library/fnmatch.rst:105 msgid "" diff --git a/library/fractions.po b/library/fractions.po index 48106deb0..07dfec218 100644 --- a/library/fractions.po +++ b/library/fractions.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/fractions.rst:2 @@ -52,7 +52,6 @@ msgid "" "a :exc:`ZeroDivisionError`." msgstr "" -#: ../../library/fractions.rst:31 msgid "" "The second version requires that *number* is an instance of :class:`numbers." "Rational` or has the :meth:`!as_integer_ratio` method (this includes :class:" @@ -65,16 +64,26 @@ msgid "" "one might expect. (But see the documentation for the :meth:" "`limit_denominator` method below.)" msgstr "" +"2 番目の形式では *number* が :class:`numbers.Rational` のインスタンスである" +"か、:meth:`!as_integer_ratio` メソッドを持つ必要があります (:class:`float` " +"と :class:`decimal.Decimal` はこれに含まれます)。\n" +"まったく同じ値を持つ :class:`Fraction` インスタンスを返します。\n" +":meth:`!as_integer_ratio` メソッドは互いに素な整数のペアを返し、後者が正であ" +"ることを前提としています。\n" +"二進浮動小数点に伴う一般的な問題 (:ref:`tut-fp-issues` を参照) により、" +"``Fraction(1.1)`` の引数は厳密には 11/10 と等しくないため、``Fraction(1.1)`` " +"は期待するかもしれない ``Fraction(11, 10)`` を返すわけでは *ありません*。\n" +"(ただし、以下の :meth:`limit_denominator` メソッドの説明を参照してください。)" -#: ../../library/fractions.rst:43 msgid "" "The last version of the constructor expects a string. The usual form for " "this instance is::" msgstr "" +"最後の形式のコンストラクタは文字列を受け取ります。\n" +"通常は次の形式です。 ::" -#: ../../library/fractions.rst:46 msgid "[sign] numerator ['/' denominator]" -msgstr "" +msgstr "[sign] numerator ['/' denominator]" #: ../../library/fractions.rst:48 msgid "" @@ -93,7 +102,6 @@ msgstr "" "class:`Fraction` コンストラクタでも受け付けられます。どちらの形式でも、入力さ" "れる文字列は前後に空白があって構いません。以下に、いくつかの例を示します::" -#: ../../library/fractions.rst:57 msgid "" ">>> from fractions import Fraction\n" ">>> Fraction(16, -10)\n" @@ -120,6 +128,30 @@ msgid "" ">>> Fraction(Decimal('1.1'))\n" "Fraction(11, 10)" msgstr "" +">>> from fractions import Fraction\n" +">>> Fraction(16, -10)\n" +"Fraction(-8, 5)\n" +">>> Fraction(123)\n" +"Fraction(123, 1)\n" +">>> Fraction()\n" +"Fraction(0, 1)\n" +">>> Fraction('3/7')\n" +"Fraction(3, 7)\n" +">>> Fraction(' -3/7 ')\n" +"Fraction(-3, 7)\n" +">>> Fraction('1.414213 \\t\\n')\n" +"Fraction(1414213, 1000000)\n" +">>> Fraction('-.125')\n" +"Fraction(-1, 8)\n" +">>> Fraction('7e-6')\n" +"Fraction(7, 1000000)\n" +">>> Fraction(2.25)\n" +"Fraction(9, 4)\n" +">>> Fraction(1.1)\n" +"Fraction(2476979795053773, 2251799813685248)\n" +">>> from decimal import Decimal\n" +">>> Fraction(Decimal('1.1'))\n" +"Fraction(11, 10)" #: ../../library/fractions.rst:83 msgid "" @@ -142,29 +174,35 @@ msgstr "" ":class:`Fraction` のコンストラクタが :class:`float` および :class:`decimal." "Decimal` インスタンスを受け付けるようになりました。" -#: ../../library/fractions.rst:93 msgid "" "The :func:`math.gcd` function is now used to normalize the *numerator* and " "*denominator*. :func:`math.gcd` always returns an :class:`int` type. " "Previously, the GCD type depended on *numerator* and *denominator*." msgstr "" +"*numerator* と *denominator* の正規化に :func:`math.gcd` 関数を使うようになり" +"ました。\n" +":func:`math.gcd` は常に :class:`int` 型を返します。\n" +"以前は最大公約数の型が *numerator* と *denominator* に依存していました。" -#: ../../library/fractions.rst:98 msgid "" "Underscores are now permitted when creating a :class:`Fraction` instance " "from a string, following :PEP:`515` rules." msgstr "" +"文字列から :class:`Fraction` インスタンスを作成する際に、:PEP:`515` の規則に" +"従ってアンダースコアを使えるようになりました。" -#: ../../library/fractions.rst:102 msgid "" ":class:`Fraction` implements ``__int__`` now to satisfy ``typing." "SupportsInt`` instance checks." msgstr "" +":class:`Fraction` は、``typing.SupportsInt`` のインスタンス検査を満たすよう " +"``__int__`` を実装しました。" -#: ../../library/fractions.rst:106 msgid "" "Space is allowed around the slash for string inputs: ``Fraction('2 / 3')``." msgstr "" +"文字列の入力で、``Fraction('2 / 3')`` のようにスラッシュの前後に空白を入れら" +"れるようになりました。" #: ../../library/fractions.rst:109 msgid "" @@ -173,17 +211,19 @@ msgid "" "``\"G\"`` and ``\"%\"\"``." msgstr "" -#: ../../library/fractions.rst:114 msgid "" "Formatting of :class:`Fraction` instances without a presentation type now " "supports fill, alignment, sign handling, minimum width and grouping." msgstr "" +"表現型を指定せずに :class:`Fraction` インスタンスを書式化する場合に、埋め文" +"字、配置、符号の処理、最小幅、桁のグループ化をサポートするようになりました。" -#: ../../library/fractions.rst:118 msgid "" "The :class:`Fraction` constructor now accepts any objects with the :meth:`!" "as_integer_ratio` method." msgstr "" +":class:`Fraction` コンストラクタが :meth:`!as_integer_ratio` メソッドを持つ任" +"意のオブジェクトを受け取れるようになりました。" #: ../../library/fractions.rst:124 msgid "Numerator of the Fraction in lowest term." @@ -193,22 +233,25 @@ msgstr "有理数を既約分数で表したときの分子。" msgid "Denominator of the Fraction in lowest term." msgstr "有理数を既約分数で表したときの分母。" -#: ../../library/fractions.rst:133 msgid "" "Return a tuple of two integers, whose ratio is equal to the original " "Fraction. The ratio is in lowest terms and has a positive denominator." msgstr "" +"元の Fraction と等しい比を表す、2 つの整数のタプルを返します。\n" +"この比は既約で、分母は正です。" -#: ../../library/fractions.rst:141 msgid "Return ``True`` if the Fraction is an integer." -msgstr "" +msgstr "Fraction が整数なら ``True`` を返します。" -#: ../../library/fractions.rst:147 msgid "" "Alternative constructor which only accepts instances of :class:`float` or :" "class:`numbers.Integral`. Beware that ``Fraction.from_float(0.3)`` is not " "the same value as ``Fraction(3, 10)``." msgstr "" +":class:`float` または :class:`numbers.Integral` のインスタンスだけを受け取る" +"代替コンストラクタです。\n" +"``Fraction.from_float(0.3)`` は ``Fraction(3, 10)`` と同じ値ではないことに注" +"意してください。" #: ../../library/fractions.rst:153 msgid "" @@ -218,11 +261,12 @@ msgstr "" "Python 3.2 以降では、 :class:`float` から直接 :class:`Fraction` インスタンス" "を構築できるようになりました。" -#: ../../library/fractions.rst:159 msgid "" "Alternative constructor which only accepts instances of :class:`decimal." "Decimal` or :class:`numbers.Integral`." msgstr "" +":class:`decimal.Decimal` または :class:`numbers.Integral` のインスタンスだけ" +"を受け取る代替コンストラクタです。" #: ../../library/fractions.rst:164 msgid "" @@ -232,13 +276,16 @@ msgstr "" "Python 3.2 以降では、 :class:`decimal.Decimal` インスタンスから直接 :class:" "`Fraction` インスタンスを構築できるようになりました。" -#: ../../library/fractions.rst:171 msgid "" "Alternative constructor which only accepts instances of :class:`numbers." "Integral`, :class:`numbers.Rational`, :class:`float` or :class:`decimal." "Decimal`, and objects with the :meth:`!as_integer_ratio` method, but not " "strings." msgstr "" +":class:`numbers.Integral`、:class:`numbers.Rational`、:class:`float`、:class:" +"`decimal.Decimal` のインスタンス、および :meth:`!as_integer_ratio` メソッドを" +"持つオブジェクトだけを受け取る代替コンストラクタです。\n" +"文字列は受け取りません。" #: ../../library/fractions.rst:181 msgid "" @@ -283,14 +330,15 @@ msgstr "" "10**ndigits)`` の倍数 (論理的に、 ``ndigits`` が負なら) を、これも偶数丸めで" "丸めます。 :func:`round` 関数からでもアクセスできます。" -#: ../../library/fractions.rst:227 msgid "" "Provides support for formatting of :class:`Fraction` instances via the :meth:" "`str.format` method, the :func:`format` built-in function, or :ref:" "`Formatted string literals `." msgstr "" +":meth:`str.format` メソッド、組み込み関数 :func:`format`、:ref:`フォーマット" +"済み文字列リテラル ` による :class:`Fraction` インスタンスの書式化" +"をサポートします。" -#: ../../library/fractions.rst:231 msgid "" "If the ``format_spec`` format specification string does not end with one of " "the presentation types ``'e'``, ``'E'``, ``'f'``, ``'F'``, ``'g'``, ``'G'`` " @@ -301,20 +349,29 @@ msgid "" "include an explicit denominator, even when the value being formatted is an " "exact integer. The zero-fill flag ``'0'`` is not supported." msgstr "" +"書式指定文字列 ``format_spec`` が表現型 ``'e'``、``'E'``、``'f'``、``'F'``、" +"``'g'``、``'G'``、``'%'`` のいずれでも終わらない場合は、:ref:`書式指定ミニ言" +"語 ` で説明する埋め文字、配置、符号の処理、最小幅、桁のグループ化" +"の一般的な規則に従って書式化します。\n" +"「別形式」のフラグ ``'#'`` をサポートします。\n" +"これを指定すると、書式化する値が厳密に整数であっても、出力文字列に常に分母を" +"明示します。\n" +"ゼロ埋めのフラグ ``'0'`` はサポートしません。" -#: ../../library/fractions.rst:241 msgid "" "If the ``format_spec`` format specification string ends with one of the " "presentation types ``'e'``, ``'E'``, ``'f'``, ``'F'``, ``'g'``, ``'G'`` or " "``'%'`` then formatting follows the rules outlined for the :class:`float` " "type in the :ref:`formatspec` section." msgstr "" +"書式指定文字列 ``format_spec`` が表現型 ``'e'``、``'E'``、``'f'``、``'F'``、" +"``'g'``、``'G'``、``'%'`` のいずれかで終わる場合は、:ref:`formatspec` 節に記" +"載された :class:`float` 型の規則に従って書式化します。" #: ../../library/fractions.rst:246 msgid "Here are some examples::" msgstr "ここに例があります::" -#: ../../library/fractions.rst:248 msgid "" ">>> from fractions import Fraction\n" ">>> format(Fraction(103993, 33102), '_')\n" @@ -335,6 +392,24 @@ msgid "" ">>> \"{:.2%} price increase\".format(Fraction(new_price, old_price) - 1)\n" "'34.67% price increase'" msgstr "" +">>> from fractions import Fraction\n" +">>> format(Fraction(103993, 33102), '_')\n" +"'103_993/33_102'\n" +">>> format(Fraction(1, 7), '.^+10')\n" +"'...+1/7...'\n" +">>> format(Fraction(3, 1), '')\n" +"'3'\n" +">>> format(Fraction(3, 1), '#')\n" +"'3/1'\n" +">>> format(Fraction(1, 7), '.40g')\n" +"'0.1428571428571428571428571428571428571429'\n" +">>> format(Fraction('1234567.855'), '_.2f')\n" +"'1_234_567.86'\n" +">>> f\"{Fraction(355, 113):*>20.6e}\"\n" +"'********3.141593e+00'\n" +">>> old_price, new_price = 499, 672\n" +">>> \"{:.2%} price increase\".format(Fraction(new_price, old_price) - 1)\n" +"'34.67% price increase'" #: ../../library/fractions.rst:270 msgid "Module :mod:`numbers`" @@ -344,6 +419,5 @@ msgstr ":mod:`numbers` モジュール" msgid "The abstract base classes making up the numeric tower." msgstr "数値の塔を作り上げる抽象基底クラス。" -#: ../../library/fractions.rst:20 msgid "as_integer_ratio()" -msgstr "" +msgstr "as_integer_ratio()" diff --git a/library/frameworks.po b/library/frameworks.po index bd744ed2c..a1d02cfea 100644 --- a/library/frameworks.po +++ b/library/frameworks.po @@ -17,10 +17,10 @@ msgstr "" "Last-Translator: Osamu NAKAMURA, 2021\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/frameworks.rst:5 diff --git a/library/ftplib.po b/library/ftplib.po index 933ab0b83..8c07afdd0 100644 --- a/library/ftplib.po +++ b/library/ftplib.po @@ -21,10 +21,10 @@ msgstr "" "Last-Translator: Takanori Suzuki , 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/ftplib.rst:2 @@ -52,13 +52,11 @@ msgstr "" "使っています。 FTP (File Transfer Protocol)についての詳しい情報はinternet :" "rfc:`959` を参照して下さい。" -#: ../../library/ftplib.rst:22 msgid "The default encoding is UTF-8, following :rfc:`2640`." -msgstr "" +msgstr "デフォルトのエンコーディングは :rfc:`2640` に従い UTF-8 です。" -#: ../../includes/wasm-notavail.rst:3 msgid "Availability" -msgstr "" +msgstr "利用可能な環境" #: ../../includes/wasm-notavail.rst:5 msgid "" @@ -72,7 +70,6 @@ msgstr "" msgid "Here's a sample session using the :mod:`ftplib` module::" msgstr ":mod:`ftplib` モジュールを使ったサンプルを以下に示します::" -#: ../../library/ftplib.rst:28 msgid "" ">>> from ftplib import FTP\n" ">>> ftp = FTP('ftp.us.debian.org') # connect to host, default port\n" @@ -93,6 +90,25 @@ msgid "" ">>> ftp.quit()\n" "'221 Goodbye.'" msgstr "" +">>> from ftplib import FTP\n" +">>> ftp = FTP('ftp.us.debian.org') # デフォルトのポートでホストに接続\n" +">>> ftp.login() # ユーザー名 anonymous、パスワード " +"anonymous@\n" +"'230 Login successful.'\n" +">>> ftp.cwd('debian') # \"debian\" ディレクトリに移動\n" +"'250 Directory successfully changed.'\n" +">>> ftp.retrlines('LIST') # ディレクトリの内容を一覧表示\n" +"-rw-rw-r-- 1 1176 1176 1063 Jun 15 10:18 README\n" +"...\n" +"drwxr-sr-x 5 1176 1176 4096 Dec 19 2000 pool\n" +"drwxr-sr-x 4 1176 1176 4096 Nov 17 2008 project\n" +"drwxr-xr-x 3 1176 1176 4096 Oct 10 2012 tools\n" +"'226 Directory send OK.'\n" +">>> with open('README', 'wb') as fp:\n" +">>> ftp.retrbinary('RETR README', fp.write)\n" +"'226 Transfer complete.'\n" +">>> ftp.quit()\n" +"'221 Goodbye.'" #: ../../library/ftplib.rst:51 msgid "Reference" @@ -102,19 +118,19 @@ msgstr "リファレンス" msgid "FTP objects" msgstr "FTP オブジェクト" -#: ../../library/ftplib.rst:87 msgid "Return a new instance of the :class:`FTP` class." -msgstr "" +msgstr ":class:`FTP` クラスの新しいインスタンスを返します。" #: ../../library/ftplib.rst:0 msgid "Parameters" msgstr "パラメーター" -#: ../../library/ftplib.rst:89 ../../library/ftplib.rst:461 msgid "" "The hostname to connect to. If given, :code:`connect(host)` is implicitly " "called by the constructor." msgstr "" +"接続先のホスト名。\n" +"指定した場合、コンストラクタが暗黙に :code:`connect(host)` を呼び出します。" #: ../../library/ftplib.rst:93 ../../library/ftplib.rst:465 msgid "" @@ -122,30 +138,24 @@ msgid "" "called by the constructor." msgstr "" -#: ../../library/ftplib.rst:98 ../../library/ftplib.rst:212 -#: ../../library/ftplib.rst:470 msgid "|param_doc_passwd|" -msgstr "" +msgstr "|param_doc_passwd|" -#: ../../library/ftplib.rst:101 ../../library/ftplib.rst:215 -#: ../../library/ftplib.rst:473 msgid "|param_doc_acct|" -msgstr "" +msgstr "|param_doc_acct|" -#: ../../library/ftplib.rst:104 msgid "" "A timeout in seconds for blocking operations like :meth:`connect` (default: " "the global default timeout setting)." msgstr "" +":meth:`connect` などのブロックする操作のタイムアウトを秒単位で指定します (デ" +"フォルト: グローバルなデフォルトのタイムアウト設定)。" -#: ../../library/ftplib.rst:109 ../../library/ftplib.rst:183 -#: ../../library/ftplib.rst:488 msgid "|param_doc_source_address|" -msgstr "" +msgstr "|param_doc_source_address|" -#: ../../library/ftplib.rst:113 ../../library/ftplib.rst:492 msgid "|param_doc_encoding|" -msgstr "" +msgstr "|param_doc_encoding|" #: ../../library/ftplib.rst:116 msgid "The :class:`FTP` class supports the :keyword:`with` statement, e.g.:" @@ -159,80 +169,93 @@ msgstr ":keyword:`with` 構文のサポートが追加されました。" msgid "*source_address* parameter was added." msgstr "*source_address* 引数が追加されました。" -#: ../../library/ftplib.rst:136 ../../library/ftplib.rst:505 msgid "" "If the *timeout* parameter is set to be zero, it will raise a :class:" "`ValueError` to prevent the creation of a non-blocking socket. The " "*encoding* parameter was added, and the default was changed from Latin-1 to " "UTF-8 to follow :rfc:`2640`." msgstr "" +"*timeout* 引数にゼロを指定すると、非ブロッキングソケットの作成を防ぐために :" +"class:`ValueError` を送出するようになりました。\n" +"*encoding* 引数が追加され、:rfc:`2640` に従ってデフォルトが Latin-1 から " +"UTF-8 に変更されました。" -#: ../../library/ftplib.rst:142 msgid "" "Several :class:`!FTP` methods are available in two flavors: one for handling " "text files and another for binary files. The methods are named for the " "command which is used followed by ``lines`` for the text version or " "``binary`` for the binary version." msgstr "" +":class:`!FTP` のいくつかのメソッドには、テキストファイル用とバイナリファイル" +"用の 2 種類があります。\n" +"メソッド名は、使用するコマンドに、テキスト用では ``lines``、バイナリ用では " +"``binary`` を付けたものです。" #: ../../library/ftplib.rst:147 msgid ":class:`FTP` instances have the following methods:" msgstr ":class:`FTP` インスタンスには以下のメソッドがあります:" -#: ../../library/ftplib.rst:151 msgid "" "Set the instance's debugging level as an :class:`int`. This controls the " "amount of debugging output printed. The debug levels are:" msgstr "" +"インスタンスのデバッグレベルを :class:`int` で設定します。\n" +"この値はデバッグ出力の量を制御します。\n" +"デバッグレベルは次のとおりです。" -#: ../../library/ftplib.rst:155 msgid "``0`` (default): No debug output." -msgstr "" +msgstr "``0`` (デフォルト): デバッグ出力を行いません。" -#: ../../library/ftplib.rst:156 msgid "" "``1``: Produce a moderate amount of debug output, generally a single line " "per request." msgstr "" +"``1``: 適度な量のデバッグ出力を行います。\n" +"通常はリクエストごとに 1 行です。" -#: ../../library/ftplib.rst:158 msgid "" "``2`` or higher: Produce the maximum amount of debugging output, logging " "each line sent and received on the control connection." msgstr "" +"``2`` 以上: 最大量のデバッグ出力を行い、制御接続で送受信する各行を記録しま" +"す。" -#: ../../library/ftplib.rst:163 msgid "" "Connect to the given host and port. This function should be called only once " "for each instance; it should not be called if a *host* argument was given " "when the :class:`FTP` instance was created. All other :class:`!FTP` methods " "can only be called after a connection has successfully been made." msgstr "" +"指定したホストとポートに接続します。\n" +"この関数はインスタンスごとに 1 回だけ呼び出してください。\n" +":class:`FTP` インスタンスの作成時に *host* 引数を指定した場合は呼び出さないで" +"ください。\n" +"ほかのすべての :class:`!FTP` メソッドは、接続が成功してから呼び出せます。" -#: ../../library/ftplib.rst:170 msgid "The host to connect to." -msgstr "" +msgstr "接続先のホスト。" -#: ../../library/ftplib.rst:173 msgid "" "The TCP port to connect to (default: ``21``, as specified by the FTP " "protocol specification). It is rarely needed to specify a different port " "number." msgstr "" +"接続先の TCP ポート (デフォルト: FTP プロトコルの仕様で定められた ``21``)。\n" +"別のポート番号を指定する必要はほとんどありません。" -#: ../../library/ftplib.rst:178 msgid "" "A timeout in seconds for the connection attempt (default: the global default " "timeout setting)." msgstr "" +"接続試行のタイムアウトを秒単位で指定します (デフォルト: グローバルなデフォル" +"トのタイムアウト設定)。" -#: ../../library/ftplib.rst:187 msgid "" "Raises an :ref:`auditing event ` ``ftplib.connect`` with arguments " "``self``, ``host``, ``port``." msgstr "" "引数 ``self``, ``host``, ``port`` を指定して :ref:`監査イベント ` " -"``ftplib.connect`` を送出します。 " +"``ftplib.connect`` を送出します。" #: ../../library/ftplib.rst:195 msgid "" @@ -244,7 +267,6 @@ msgstr "" "(このメッセージには時に、ユーザにとって重要な免責事項や ヘルプ情報が入ってい" "ます。)" -#: ../../library/ftplib.rst:202 msgid "" "Log on to the connected FTP server. This function should be called only once " "for each instance, after a connection has been established; it should not be " @@ -252,10 +274,14 @@ msgid "" "instance was created. Most FTP commands are only allowed after the client " "has logged in." msgstr "" +"接続中の FTP サーバーにログインします。\n" +"この関数は接続が確立した後、インスタンスごとに 1 回だけ呼び出してください。\n" +":class:`FTP` インスタンスの作成時に *host* と *user* 引数を指定した場合は呼び" +"出さないでください。\n" +"ほとんどの FTP コマンドは、クライアントがログインした後でのみ使用できます。" -#: ../../library/ftplib.rst:209 msgid "|param_doc_user|" -msgstr "" +msgstr "|param_doc_user|" #: ../../library/ftplib.rst:221 msgid "" @@ -270,49 +296,53 @@ msgid "" "Send a simple command string to the server and return the response string." msgstr "シンプルなコマンド文字列をサーバに送信して、受信した文字列を返します。" -#: ../../library/ftplib.rst:229 ../../library/ftplib.rst:238 msgid "" "Raises an :ref:`auditing event ` ``ftplib.sendcmd`` with arguments " "``self``, ``cmd``." msgstr "" "引数 ``self``, ``cmd`` を指定して :ref:`監査イベント ` ``ftplib." -"sendcmd`` を送出します。 " +"sendcmd`` を送出します。" -#: ../../library/ftplib.rst:234 msgid "" "Send a simple command string to the server and handle the response. Return " "the response string if the response code corresponds to success (codes in " "the range 200--299). Raise :exc:`error_reply` otherwise." msgstr "" +"単純なコマンド文字列をサーバーに送信し、応答を処理します。\n" +"応答コードが成功を表す場合 (200〜299 のコード) は応答文字列を返します。\n" +"それ以外の場合は :exc:`error_reply` を送出します。" -#: ../../library/ftplib.rst:243 msgid "Retrieve a file in binary transfer mode." -msgstr "" +msgstr "バイナリ転送モードでファイルを取得します。" -#: ../../library/ftplib.rst:245 msgid "An appropriate ``RETR`` command: :samp:`\"RETR {filename}\"`." -msgstr "" +msgstr "適切な ``RETR`` コマンド: :samp:`\"RETR {filename}\"`。" -#: ../../library/ftplib.rst:248 msgid "" "A single parameter callable that is called for each block of data received, " "with its single argument being the data as :class:`bytes`." msgstr "" +"受信したデータのブロックごとに呼び出される、引数を 1 つ取る呼び出し可能オブ" +"ジェクト。\n" +"その引数には :class:`bytes` としてデータが渡されます。" -#: ../../library/ftplib.rst:254 msgid "" "The maximum chunk size to read on the low-level :class:`~socket.socket` " "object created to do the actual transfer. This also corresponds to the " "largest size of data that will be passed to *callback*. Defaults to ``8192``." msgstr "" +"実際の転送用に作成される低水準の :class:`~socket.socket` オブジェクトから読み" +"取るチャンクの最大サイズ。\n" +"*callback* に渡すデータの最大サイズでもあります。\n" +"デフォルトは ``8192`` です。" -#: ../../library/ftplib.rst:261 ../../library/ftplib.rst:308 msgid "" "A ``REST`` command to be sent to the server. See the documentation for the " "*rest* parameter of the :meth:`transfercmd` method." msgstr "" +"サーバーに送信する ``REST`` コマンド。\n" +":meth:`transfercmd` メソッドの *rest* 引数の説明を参照してください。" -#: ../../library/ftplib.rst:268 msgid "" "Retrieve a file or directory listing in the encoding specified by the " "*encoding* parameter at initialization. *cmd* should be an appropriate " @@ -323,6 +353,16 @@ msgid "" "argument containing the line with the trailing CRLF stripped. The default " "*callback* prints the line to :data:`sys.stdout`." msgstr "" +"初期化時に *encoding* 引数で指定したエンコーディングで、ファイルまたはディレ" +"クトリ一覧を取得します。\n" +"*cmd* には適切な ``RETR`` コマンド (:meth:`retrbinary` を参照)、または " +"``LIST`` や ``NLST`` などのコマンドを指定してください (通常は単に文字列 " +"``'LIST'``)。\n" +"``LIST`` はファイルの一覧とそれらのファイルに関する情報を取得します。\n" +"``NLST`` はファイル名の一覧を取得します。\n" +"各行について *callback* 関数を呼び出し、末尾の CRLF を除いた行を文字列の引数" +"として渡します。\n" +"デフォルトの *callback* は、その行を :data:`sys.stdout` に出力します。" #: ../../library/ftplib.rst:281 msgid "" @@ -332,36 +372,37 @@ msgstr "" "*val* が真の場合 \"パッシブ\" モードを有効化し、偽の場合は無効化します。 デ" "フォルトではパッシブモードです。" -#: ../../library/ftplib.rst:287 msgid "Store a file in binary transfer mode." -msgstr "" +msgstr "バイナリ転送モードでファイルを保存します。" -#: ../../library/ftplib.rst:289 msgid "An appropriate ``STOR`` command: :samp:`\"STOR {filename}\"`." -msgstr "" +msgstr "適切な ``STOR`` コマンド: :samp:`\"STOR {filename}\"`。" -#: ../../library/ftplib.rst:292 msgid "" "A file object (opened in binary mode) which is read until EOF, using its :" "meth:`~io.RawIOBase.read` method in blocks of size *blocksize* to provide " "the data to be stored." msgstr "" +"バイナリモードで開かれたファイルオブジェクト。\n" +":meth:`~io.RawIOBase.read` メソッドで *blocksize* サイズのブロックごとに EOF " +"まで読み取り、保存するデータを供給します。" -#: ../../library/ftplib.rst:298 msgid "The read block size. Defaults to ``8192``." msgstr "" +"読み取るブロックのサイズ。\n" +"デフォルトは ``8192`` です。" -#: ../../library/ftplib.rst:302 msgid "" "A single parameter callable that is called for each block of data sent, with " "its single argument being the data as :class:`bytes`." msgstr "" +"データのブロックを送信するたびに呼び出される、引数を 1 つ取る呼び出し可能オブ" +"ジェクト。\n" +"その引数には :class:`bytes` としてデータが渡されます。" -#: ../../library/ftplib.rst:312 msgid "The *rest* parameter was added." -msgstr "" +msgstr "*rest* 引数が追加されました。" -#: ../../library/ftplib.rst:318 msgid "" "Store a file in line mode. *cmd* should be an appropriate ``STOR`` command " "(see :meth:`storbinary`). Lines are read until EOF from the :term:`file " @@ -369,8 +410,15 @@ msgid "" "method to provide the data to be stored. *callback* is an optional single " "parameter callable that is called on each line after it is sent." msgstr "" +"行モードでファイルを保存します。\n" +"*cmd* には適切な ``STOR`` コマンドを指定してください (:meth:`storbinary` を参" +"照)。\n" +"バイナリモードで開かれた :term:`file object` *fp* の :meth:`~io.IOBase." +"readline` メソッドを使い、EOF まで行を読み取って保存するデータを供給しま" +"す。\n" +"*callback* は引数を 1 つ取る省略可能な呼び出し可能オブジェクトで、各行の送信" +"後に呼び出されます。" -#: ../../library/ftplib.rst:327 msgid "" "Initiate a transfer over the data connection. If the transfer is active, " "send an ``EPRT`` or ``PORT`` command and the transfer command specified by " @@ -378,12 +426,13 @@ msgid "" "``EPSV`` or ``PASV`` command, connect to it, and start the transfer " "command. Either way, return the socket for the connection." msgstr "" -"データ接続中に転送を初期化します。もし転送中なら、``EPRT`` あるいは ``PORT`` " -"コマンドと、*cmd* で指定したコマンドを送信し、接続を続けます。サーバがパッシ" -"ブなら、``EPSV`` あるいは ``PASV`` コマンドを送信して接続し、転送コマンドを開" -"始します。どちらの場合も、接続のためのソケットを返します。" +"データ接続での転送を開始します。\n" +"アクティブモードの場合は ``EPRT`` または ``PORT`` コマンドと、*cmd* で指定さ" +"れた転送コマンドを送信して、接続を受け入れます。\n" +"パッシブモードの場合は ``EPSV`` または ``PASV`` コマンドを送信してサーバーに" +"接続し、転送コマンドを開始します。\n" +"どちらの場合も、その接続のソケットを返します。" -#: ../../library/ftplib.rst:333 msgid "" "If optional *rest* is given, a ``REST`` command is sent to the server, " "passing *rest* as an argument. *rest* is usually a byte offset into the " @@ -395,19 +444,27 @@ msgid "" "command, an :exc:`error_reply` exception will be raised. If this happens, " "simply call :meth:`transfercmd` without a *rest* argument." msgstr "" +"省略可能な *rest* を指定すると、その値を引数として ``REST`` コマンドをサー" +"バーに送信します。\n" +"通常、*rest* は要求するファイル内のバイトオフセットであり、ファイルの先頭部分" +"を飛ばして、指定した位置から送信を再開するようサーバーに指示します。\n" +"ただし :meth:`transfercmd` メソッドは、初期化時の *encoding* 引数を使って " +"*rest* を文字列に変換するだけで、その内容は検査しません。\n" +"サーバーが ``REST`` コマンドを認識しない場合は :exc:`error_reply` 例外を送出" +"します。\n" +"その場合は *rest* 引数を指定せずに :meth:`transfercmd` を呼び出してください。" -#: ../../library/ftplib.rst:346 msgid "" "Like :meth:`transfercmd`, but returns a tuple of the data connection and the " "expected size of the data. If the expected size could not be computed, " "``None`` will be returned as the expected size. *cmd* and *rest* means the " "same thing as in :meth:`transfercmd`." msgstr "" -":meth:`transfercmd` と同様ですが、データと予想されるサイズとのタプルを返しま" -"す。もしサイズが計算できないなら、サイズの代わりに ``None`` が返されます。 " -"*cmd* と *rest* は :meth:`transfercmd` のものと同じです。" +":meth:`transfercmd` と同様ですが、データ接続と転送データの予想サイズのタプル" +"を返します。\n" +"予想サイズを計算できない場合、その要素は ``None`` になります。\n" +"*cmd* と *rest* の意味は :meth:`transfercmd` と同じです。" -#: ../../library/ftplib.rst:354 msgid "" "List a directory in a standardized format by using ``MLSD`` command (:rfc:" "`3659`). If *path* is omitted the current directory is assumed. *facts* is " @@ -418,6 +475,16 @@ msgid "" "name. Content of this dictionary might be limited by the *facts* argument " "but server is not guaranteed to return all requested facts." msgstr "" +"``MLSD`` コマンド (:rfc:`3659`) を使い、標準化された形式でディレクトリを一覧" +"表示します。\n" +"*path* を省略するとカレントディレクトリを対象とします。\n" +"*facts* は必要な情報の種類を表す文字列のリストです (例: ``[\"type\", " +"\"size\", \"perm\"]``)。\n" +"``path`` に見つかったファイルごとに 2 要素のタプルを yield するジェネレータオ" +"ブジェクトを返します。\n" +"最初の要素はファイル名、2 番目の要素はそのファイルの情報を含む辞書です。\n" +"この辞書の内容は *facts* 引数で制限できる場合がありますが、要求したすべての情" +"報をサーバーが返す保証はありません。" #: ../../library/ftplib.rst:368 msgid "" @@ -431,11 +498,11 @@ msgstr "" "トディレクトリです)。 ``NLST`` コマンドに非標準である複数の引数を渡すことが" "できます。" -#: ../../library/ftplib.rst:373 ../../library/ftplib.rst:385 msgid "If your server supports the command, :meth:`mlsd` offers a better API." msgstr "" +"サーバーがこのコマンドをサポートしている場合は、:meth:`mlsd` の方が優れた " +"API を提供します。" -#: ../../library/ftplib.rst:378 msgid "" "Produce a directory listing as returned by the ``LIST`` command, printing it " "to standard output. The optional *argument* is a directory to list (default " @@ -444,20 +511,28 @@ msgid "" "function, it is used as a *callback* function as for :meth:`retrlines`; the " "default prints to :data:`sys.stdout`. This method returns ``None``." msgstr "" +"``LIST`` コマンドが返すディレクトリ一覧を標準出力に表示します。\n" +"省略可能な *argument* は一覧表示するディレクトリです (デフォルトはサーバーの" +"カレントディレクトリ)。\n" +"複数の引数を使って、非標準のオプションを ``LIST`` コマンドに渡せます。\n" +"最後の引数が関数の場合は、:meth:`retrlines` と同様に *callback* 関数として使" +"います。\n" +"デフォルトでは :data:`sys.stdout` に表示します。\n" +"このメソッドは ``None`` を返します。" #: ../../library/ftplib.rst:390 msgid "Rename file *fromname* on the server to *toname*." msgstr "サーバ上のファイルのファイル名 *fromname* を *toname* へ変更します。" -#: ../../library/ftplib.rst:395 msgid "" "Remove the file named *filename* from the server. If successful, returns " "the text of the response, otherwise raises :exc:`error_perm` on permission " "errors or :exc:`error_reply` on other errors." msgstr "" -"サーバからファイル *filename* を削除します。成功したら応答のテキストを返し、" -"そうでないならパーミッションエラーでは :exc:`error_perm` を、他のエラーでは :" -"exc:`error_reply` を返します。" +"サーバーから *filename* という名前のファイルを削除します。\n" +"成功した場合は応答のテキストを返します。\n" +"失敗した場合は、権限のエラーなら :exc:`error_perm`、それ以外のエラーなら :" +"exc:`error_reply` を送出します。" #: ../../library/ftplib.rst:402 msgid "Set the current directory on the server." @@ -486,7 +561,6 @@ msgstr "" "整数で返され、そうでないなら ``None`` が返されます。 ``SIZE`` コマンドは標準" "化されていませんが、多くの普通のサーバで実装されていることに注意して下さい。" -#: ../../library/ftplib.rst:430 msgid "" "Send a ``QUIT`` command to the server and close the connection. This is the " "\"polite\" way to close a connection, but it may raise an exception if the " @@ -494,11 +568,11 @@ msgid "" "to the :meth:`close` method which renders the :class:`FTP` instance useless " "for subsequent calls (see below)." msgstr "" -"サーバに ``QUIT`` コマンドを送信し、接続を閉じます。これは接続を閉じるのに" -"\"礼儀正しい\"方法ですが、 ``QUIT`` コマンドに反応してサーバの例外が発生する" -"かもしれません。この例外は、 :meth:`close` メソッドによって :class:`FTP` イン" -"スタンスに対するその後のコマンド使用が不可になっていることを示しています(下" -"記参照)。" +"サーバーに ``QUIT`` コマンドを送信して接続を閉じます。\n" +"これは接続を閉じる「礼儀正しい」方法ですが、サーバーが ``QUIT`` コマンドにエ" +"ラーを返した場合には例外が送出されることがあります。\n" +"この処理では :meth:`close` メソッドも呼び出されるため、その後は :class:`FTP` " +"インスタンスを使えなくなります (下記参照)。" #: ../../library/ftplib.rst:439 msgid "" @@ -518,54 +592,55 @@ msgstr "" msgid "FTP_TLS objects" msgstr "FTP_TLS オブジェクト" -#: ../../library/ftplib.rst:452 msgid "" "An :class:`FTP` subclass which adds TLS support to FTP as described in :rfc:" "`4217`. Connect to port 21 implicitly securing the FTP control connection " "before authenticating." msgstr "" +":rfc:`4217` に従って FTP に TLS サポートを追加する :class:`FTP` のサブクラス" +"です。\n" +"ポート 21 に接続し、認証前に FTP の制御接続を暗黙に保護します。" -#: ../../library/ftplib.rst:458 msgid "" "The user must explicitly secure the data connection by calling the :meth:" "`prot_p` method." msgstr "" +"データ接続は、利用者が :meth:`prot_p` メソッドを呼び出して明示的に保護する必" +"要があります。" -#: ../../library/ftplib.rst:476 msgid "" "An SSL context object which allows bundling SSL configuration options, " "certificates and private keys into a single, potentially long-lived, " "structure. Please read :ref:`ssl-security` for best practices." msgstr "" +"SSL の設定オプション、証明書、秘密鍵を、長期間使用できる単一の構造にまとめる " +"SSL コンテキストオブジェクトです。\n" +"推奨される使用方法については :ref:`ssl-security` を参照してください。" -#: ../../library/ftplib.rst:483 msgid "" "A timeout in seconds for blocking operations like :meth:`~FTP.connect` " "(default: the global default timeout setting)." msgstr "" +":meth:`~FTP.connect` などのブロックする操作のタイムアウトを秒単位で指定しま" +"す (デフォルト: グローバルなデフォルトのタイムアウト設定)。" -#: ../../library/ftplib.rst:497 msgid "Added the *source_address* parameter." -msgstr "" +msgstr "*source_address* 引数が追加されました。" -#: ../../library/ftplib.rst:500 msgid "" "The class now supports hostname check with :attr:`ssl.SSLContext." "check_hostname` and *Server Name Indication* (see :const:`ssl.HAS_SNI`)." msgstr "" -"このクラスは :attr:`ssl.SSLContext.check_hostname` と *Server Name " -"Indication* でホスト名のチェックをサポートしました。(:const:`ssl.HAS_SNI` を" -"参照してください)。" +"このクラスは :attr:`ssl.SSLContext.check_hostname` によるホスト名の検証と、" +"*Server Name Indication* に対応しました (:const:`ssl.HAS_SNI` を参照)。" #: ../../library/ftplib.rst:511 msgid "The deprecated *keyfile* and *certfile* parameters have been removed." msgstr "非推奨の *keyfile* と *certfile* 引数を削除しました。" -#: ../../library/ftplib.rst:514 msgid "Here's a sample session using the :class:`FTP_TLS` class::" -msgstr ":class:`FTP_TLS` クラスを使ったサンプルセッションはこちらです:" +msgstr ":class:`FTP_TLS` クラスを使ったセッションの例を示します。 ::" -#: ../../library/ftplib.rst:516 msgid "" ">>> ftps = FTP_TLS('ftp.pureftpd.org')\n" ">>> ftps.login()\n" @@ -581,12 +656,26 @@ msgid "" "'public_keys', 'pure-ftpd', 'qscan', 'qtc', 'sharedance', 'skycache', " "'sound', 'tmp', 'ucarp']" msgstr "" +">>> ftps = FTP_TLS('ftp.pureftpd.org')\n" +">>> ftps.login()\n" +"'230 Anonymous user logged in'\n" +">>> ftps.prot_p()\n" +"'200 Data protection level set to \"private\"'\n" +">>> ftps.nlst()\n" +"['6jack', 'OpenBSD', 'antilink', 'blogbench', 'bsdcam', 'clockspeed', " +"'djbdns-jedi', 'docs', 'eaccelerator-jedi', 'favicon.ico', 'francotone', " +"'fugu', 'ignore', 'libpuzzle', 'metalog', 'minidentd', 'misc', 'mysql-udf-" +"global-user-variables', 'php-jenkins-hash', 'php-skein-hash', 'php-webdav', " +"'phpaudit', 'phpbench', 'pincaster', 'ping', 'posto', 'pub', 'public', " +"'public_keys', 'pure-ftpd', 'qscan', 'qtc', 'sharedance', 'skycache', " +"'sound', 'tmp', 'ucarp']" -#: ../../library/ftplib.rst:524 msgid "" ":class:`!FTP_TLS` class inherits from :class:`FTP`, defining these " "additional methods and attributes:" msgstr "" +":class:`!FTP_TLS` クラスは :class:`FTP` を継承し、次のメソッドと属性を追加で" +"定義します。" #: ../../library/ftplib.rst:529 msgid "The SSL version to use (defaults to :data:`ssl.PROTOCOL_SSLv23`)." @@ -600,18 +689,22 @@ msgstr "" ":attr:`ssl_version` 属性で指定されたものに従って、 TLS または SSL を使い、セ" "キュアコントロール接続をセットアップします。" -#: ../../library/ftplib.rst:536 msgid "" "The method now supports hostname check with :attr:`ssl.SSLContext." "check_hostname` and *Server Name Indication* (see :const:`ssl.HAS_SNI`)." msgstr "" +"このメソッドは :attr:`ssl.SSLContext.check_hostname` によるホスト名の検証と、" +"*Server Name Indication* (:const:`ssl.HAS_SNI` を参照) をサポートするようにな" +"りました。" -#: ../../library/ftplib.rst:543 msgid "" "Revert control channel back to plaintext. This can be useful to take " "advantage of firewalls that know how to handle NAT with non-secure FTP " "without opening fixed ports." msgstr "" +"制御チャネルを平文に戻します。\n" +"暗号化されていない FTP の NAT を処理できるファイアウォールで、固定ポートを開" +"かずにその機能を利用する場合に役立ちます。" #: ../../library/ftplib.rst:551 msgid "Set up secure data connection." @@ -654,17 +747,16 @@ msgstr "" "File Transfer Protocol の応答仕様に適合しない、すなわち1--5の数字で始まらない" "応答コードをサーバから受け取った時に発生する例外。" -#: ../../library/ftplib.rst:587 msgid "" "The set of all exceptions (as a tuple) that methods of :class:`FTP` " "instances may raise as a result of problems with the FTP connection (as " "opposed to programming errors made by the caller). This set includes the " "four exceptions listed above as well as :exc:`OSError` and :exc:`EOFError`." msgstr "" -":class:`FTP` インスタンスのメソッド実行時、FTP接続で (プログラミングのエラー" -"と考えられるメソッドの実行によって) 発生する全ての例外 (タプル形式)。この例外" -"には以上の4つのエラーはもちろん、 :exc:`OSError` と :exc:`EOFError` も含まれ" -"ます。" +":class:`FTP` インスタンスのメソッドが FTP 接続の問題によって送出する可能性の" +"ある例外を、すべてまとめたタプルです。\n" +"呼び出し側のプログラミング上の誤りによる例外は含みません。\n" +"上記の 4 つの例外に加え、:exc:`OSError` と :exc:`EOFError` も含まれます。" #: ../../library/ftplib.rst:595 msgid "Module :mod:`netrc`" @@ -688,6 +780,5 @@ msgstr "FTP" msgid "protocol" msgstr "プロトコル" -#: ../../library/ftplib.rst:9 msgid "ftplib (standard module)" -msgstr "" +msgstr "ftplib (標準モジュール)" diff --git a/library/functional.po b/library/functional.po index e7e21278d..e442a705d 100644 --- a/library/functional.po +++ b/library/functional.po @@ -16,23 +16,22 @@ msgstr "" "Last-Translator: tomo, 2021\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/functional.rst:3 msgid "Functional Programming Modules" msgstr "関数型プログラミング用モジュール" -#: ../../library/functional.rst:5 msgid "" "The modules described in this chapter provide functions and classes that " "support a functional programming style, and general operations on callables." msgstr "" -"この章では、関数型プログラミングスタイルをサポートする呼び出し可能で汎用な操" -"作を実現する関数やクラスについて説明します。" +"この章で説明するモジュールは、関数型プログラミングのスタイルをサポートする関" +"数やクラスと、呼び出し可能オブジェクトに対する汎用的な操作を提供します。" #: ../../library/functional.rst:8 msgid "The following modules are documented in this chapter:" diff --git a/library/functions.po b/library/functions.po index 40670be58..84d34f0c6 100644 --- a/library/functions.po +++ b/library/functions.po @@ -33,10 +33,10 @@ msgstr "" "Last-Translator: TENMYO Masakazu, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/functions.rst:5 ../../library/functions.rst:11 @@ -475,7 +475,6 @@ msgid "" msgstr "" "これは組み込みの :func:`next` 関数の非同期版であり、同じように動作します。" -#: ../../library/functions.rst:95 msgid "" "This calls the :meth:`~object.__anext__` method of *async_iterator*, " "returning an :term:`awaitable`. Awaiting this returns the next value of the " @@ -483,10 +482,10 @@ msgid "" "exhausted, otherwise :exc:`StopAsyncIteration` is raised." msgstr "" "これは *async_iterator* の :meth:`~object.__anext__` メソッドを呼び出し、待ち" -"受け可能オブジェクト (:term:`awaitable`) を返します。待ち受けることによりイテ" -"レータの次の値を返します。 *default* が与えられた場合、イテレータが枯渇したと" -"きにその値が返されます。 *default* が与えられない場合は :exc:" -"`StopAsyncIteration` が送出されます。" +"受け可能オブジェクト (:term:`awaitable`) を返します。\n" +"これを待ち受けると、イテレータの次の値が返されます。\n" +"イテレータが枯渇した場合、*default* が指定されていればその値が返され、\n" +"指定されていなければ :exc:`StopAsyncIteration` が送出されます。" #: ../../library/functions.rst:104 msgid "" @@ -510,17 +509,16 @@ msgstr "" " return True\n" " return False" -#: ../../library/functions.rst:116 msgid "" "As :func:`repr`, return a string containing a printable representation of an " "object, but escape the non-ASCII characters in the string returned by :func:" "`repr` using ``\\x``, ``\\u``, or ``\\U`` escapes. This generates a string " "similar to that returned by :func:`repr` in Python 2." msgstr "" -":func:`repr` と同様、オブジェクトの印字可能な表現を含む文字列を返しますが、:" -"func:`repr` によって返された文字列中の非 ASCII 文字は ``\\x`` 、 ``\\u`` 、 " -"``\\U`` エスケープを使ってエスケープされます。これは Python 2 の :func:" -"`repr` によって返されるのと同じ文字列を作ります。" +":func:`repr` と同様に、オブジェクトの印字可能な表現を含む文字列を返します。\n" +"ただし、:func:`repr` が返す文字列中の非 ASCII 文字は、``\\x``、``\\u``、" +"``\\U`` エスケープを使ってエスケープされます。\n" +"これにより、Python 2 の :func:`repr` が返すものと似た文字列が生成されます。" #: ../../library/functions.rst:124 msgid "" @@ -617,17 +615,19 @@ msgstr "" "引数 ``breakpointhook`` 付きで :ref:`監査イベント ` ``builtins." "breakpoint`` を送出します。" -#: ../../library/functions.rst:190 msgid "" "Return a new array of bytes. The :class:`bytearray` class is a mutable " "sequence of integers in the range 0 <= x < 256. It has most of the usual " "methods of mutable sequences, described in :ref:`typesseq-mutable`, as well " "as most methods that the :class:`bytes` type has, see :ref:`bytes-methods`." msgstr "" -"新しいバイト配列を返します。:class:`bytearray` クラスは0 <= x < 256の範囲の整" -"数からなる変更可能な配列です。:ref:`typesseq-mutable` に記述されている変更可" -"能な配列に対する普通のメソッドの大半を備えています。また、:class:`bytes` 型が" -"持つメソッドの大半も備えています(see :ref:`bytes-methods`)。" +"新しいバイト配列を返します。\n" +":class:`bytearray` クラスは、0 <= x < 256 の範囲の整数からなる可変シーケンス" +"です。\n" +":ref:`typesseq-mutable` で説明されている可変シーケンスの通常のメソッドの大半" +"に加え、\n" +":class:`bytes` 型のメソッドの大半も備えています (:ref:`bytes-methods` を参照" +"してください)。" #: ../../library/functions.rst:195 msgid "" @@ -706,7 +706,6 @@ msgid "See also :ref:`binaryseq`, :ref:`typebytes`, and :ref:`bytes-methods`." msgstr "" ":ref:`binaryseq`, :ref:`typebytes`, :ref:`bytes-methods` も参照してください。" -#: ../../library/functions.rst:236 msgid "" "Return :const:`True` if the *object* argument appears callable, :const:" "`False` if not. If this returns ``True``, it is still possible that a call " @@ -714,12 +713,13 @@ msgid "" "that classes are callable (calling a class returns a new instance); " "instances are callable if their class has a :meth:`~object.__call__` method." msgstr "" -"*object* 引数が呼び出し可能オブジェクトであれば :const:`True` を、そうでなけ" -"れば :const:`False` を返します。この関数が ``True`` を返しても、呼び出しは失" -"敗する可能性がありますが、``False`` であれば、 *object* の呼び出しは決して成" -"功しません。なお、クラスは呼び出し可能 (クラスを呼び出すと新しいインスタンス" -"を返します) です。また、インスタンスはクラスが :meth:`~object.__call__` メ" -"ソッドを持つなら呼び出し可能です。" +"*object* 引数が呼び出せそうなオブジェクトであれば :const:`True` を、そうでな" +"ければ :const:`False` を返します。\n" +"この関数が ``True`` を返しても呼び出しが失敗する可能性はありますが、\n" +"``False`` であれば *object* の呼び出しは決して成功しません。\n" +"クラスは呼び出し可能です (クラスを呼び出すと新しいインスタンスを返します)。\n" +"インスタンスは、そのクラスが :meth:`~object.__call__` メソッドを持つ場合に呼" +"び出し可能です。" #: ../../library/functions.rst:242 msgid "" @@ -829,28 +829,28 @@ msgstr "" "クラスメソッドは :func:`property` など、他の :term:`デスクリプタ " "` をラップすることができなくなりました。" -#: ../../library/functions.rst:299 msgid "" "Compile the *source* into a code or AST object. Code objects can be " "executed by :func:`exec` or :func:`eval`. *source* can either be a normal " "string, a byte string, or an AST object. Refer to the :mod:`ast` module " "documentation for information on how to work with AST objects." msgstr "" -"*source* をコードオブジェクト、もしくは、 AST オブジェクトにコンパイルしま" -"す。 コードオブジェクトは :func:`exec` 文で実行したり、 :func:`eval` 呼び出し" -"で評価できます。 *source* は通常の文字列、 バイト列、 AST オブジェクトのいず" -"れでもかまいません。 AST オブジェクトへの、また、 AST オブジェクトからのコン" -"パイルの方法は、 :mod:`ast` モジュールのドキュメントを参照してください。" +"*source* をコードオブジェクトまたは AST オブジェクトにコンパイルします。\n" +"コードオブジェクトは :func:`exec` や :func:`eval` で実行できます。\n" +"*source* には、通常の文字列、バイト列、AST オブジェクトのいずれかを指定できま" +"す。\n" +"AST オブジェクトの扱い方については、:mod:`ast` モジュールのドキュメントを参照" +"してください。" -#: ../../library/functions.rst:304 msgid "" "The *filename* argument should give the file from which the code was read; " "pass some recognizable value if it wasn't read from a file (``''`` " "is commonly used)." msgstr "" -"*filename* 引数には、コードの読み出し元のファイルを与えなければなりません; " -"ファイルから読み出されるのでなければ、認識可能な値を渡して下さい " -"(``''`` が一般的に使われます)。" +"*filename* 引数には、コードの読み出し元のファイルを示す値を指定してくださ" +"い。\n" +"ファイルから読み出していない場合は、識別できる値を渡してください " +"(``''`` がよく使われます)。" #: ../../library/functions.rst:308 msgid "" @@ -1040,7 +1040,6 @@ msgstr "" ">>> complex(-1.23, 4.5)\n" "(-1.23+4.5j)" -#: ../../library/functions.rst:405 msgid "" "If the argument is a string, it must contain either a real part (in the same " "format as for :func:`float`) or an imaginary part (in the same format but " @@ -1056,7 +1055,7 @@ msgid "" msgstr "" "引数が文字列の場合、実数部( :func:`float` と同じ形式)、虚数部(同様の形式" "で ``'j'`` または ``'J'`` 接尾辞)どちらか、あるいは両方(この場合、虚数部の" -"符号は必須)を含まなければなりません。文字列 は空白や括弧 ``'('`` と``')'`` " +"符号は必須)を含まなければなりません。文字列 は空白や括弧 ``'('`` と ``')'`` " "で囲むこともできますが、無視されます。文字列は、 ``'+'`` 、``'-'`` 、 " "``'j'`` または ``'J'`` 接尾辞 、そして10進数の間に空白を含んではなりません。" "たとえば ``complex('1+2j')`` はよいですが、 ``complex('1 + 2j')`` は :exc:" @@ -1101,6 +1100,7 @@ msgid "" "See also :meth:`complex.from_number` which only accepts a single numeric " "argument." msgstr "" +"数値を一つだけ引数にとる :meth:`complex.from_number` も参照してください。" #: ../../library/functions.rst:445 msgid "If all arguments are omitted, returns ``0j``." @@ -1110,10 +1110,8 @@ msgstr "引数がすべて省略された場合は、 ``0j`` を返します。" msgid "The complex type is described in :ref:`typesnumeric`." msgstr "複素数型については :ref:`typesnumeric` に説明があります。" -#: ../../library/functions.rst:449 ../../library/functions.rst:812 -#: ../../library/functions.rst:1054 msgid "Grouping digits with underscores as in code literals is allowed." -msgstr "コードリテラル中で桁をグループ化するのにアンダースコアを利用できます。" +msgstr "コードリテラルと同様に、アンダースコアで桁を区切れるようになりました。" #: ../../library/functions.rst:452 msgid "" @@ -1128,6 +1126,8 @@ msgid "" "Passing a complex number as the *real* or *imag* argument is now deprecated; " "it should only be passed as a single positional argument." msgstr "" +"複素数を *real* 引数または *imag* 引数として渡せる機能は非推奨となりました。" +"単一の位置引数として渡してください。" #: ../../library/functions.rst:463 msgid "" @@ -1196,14 +1196,13 @@ msgstr "" "だけ情報を集めようとします。結果のリストは必ずしも完全ではなく、カスタムの :" "func:`~object.__getattr__` を持つ場合は不正確かもしれません。" -#: ../../library/functions.rst:502 msgid "" "The default :func:`dir` mechanism behaves differently with different types " "of objects, as it attempts to produce the most relevant, rather than " "complete, information:" msgstr "" -"デフォルトの :func:`dir` メカニズムは、完全というより最重要な情報を作成しよう" -"とするため、異なる型のオブジェクトでは異なって振る舞います:" +"デフォルトの :func:`dir` の仕組みは、網羅的な情報よりも関連性の高い情報を返そ" +"うとするため、オブジェクトの型によって異なる動作をします:" #: ../../library/functions.rst:506 msgid "" @@ -1213,13 +1212,12 @@ msgstr "" "オブジェクトがモジュールオブジェクトの場合、リストにはモジュールの属性の名前" "が含まれます。" -#: ../../library/functions.rst:509 msgid "" "If the object is a type or class object, the list contains the names of its " "attributes, and recursively of the attributes of its bases." msgstr "" -"オブジェクトが型オブジェクトやクラスオブジェクトの場合、リストにはその属性の" -"名前と、再帰的にたどったその基底クラスの属性が含まれます。" +"オブジェクトが型オブジェクトまたはクラスオブジェクトの場合、リストにはその属" +"性の名前と、基底クラスを再帰的にたどった属性の名前が含まれます。" #: ../../library/functions.rst:512 msgid "" @@ -1538,36 +1536,37 @@ msgstr "" msgid "Added the *closure* parameter." msgstr "*closure* パラメータが追加されました。" -#: ../../library/functions.rst:734 msgid "" "Construct an iterator from those elements of *iterable* for which *function* " "is true. *iterable* may be either a sequence, a container which supports " "iteration, or an iterator. If *function* is ``None``, the identity function " "is assumed, that is, all elements of *iterable* that are false are removed." msgstr "" -"*iterable* の要素のうち、 *function* が真であるものからイテレータを構築しま" -"す。 *iterable* にはシーケンスか、イテレーションをサポートするコンテナか、イ" -"テレータを渡せます。 *function* が ``None`` のときは恒等関数が指定されたもの" -"として扱われ、 *iterable* のうち偽であるものがすべて取り除かれます。" +"*iterable* の要素のうち、*function* を適用した結果が真になる要素からイテレー" +"タを構築します。\n" +"*iterable* には、シーケンス、イテレーションをサポートするコンテナ、イテレータ" +"のいずれかを指定できます。\n" +"*function* が ``None`` の場合は恒等関数が指定されたものとして扱われ、" +"*iterable* の要素のうち偽であるものがすべて取り除かれます。" -#: ../../library/functions.rst:740 msgid "" "Note that ``filter(function, iterable)`` is equivalent to the generator " "expression ``(item for item in iterable if function(item))`` if function is " "not ``None`` and ``(item for item in iterable if item)`` if function is " "``None``." msgstr "" -"なお、``filter(function, iterable)`` は、関数が ``None`` でなければジェネレー" -"タ式 ``(item for item in iterable if function(item))`` と同等で、関数が " -"``None`` なら ``(item for item in iterable if item)`` と同等です。" +"``filter(function, iterable)`` は、``function`` が ``None`` でなければジェネ" +"レータ式 ``(item for item in iterable if function(item))`` と等価です。\n" +"``function`` が ``None`` なら、``(item for item in iterable if item)`` と等価" +"です。" -#: ../../library/functions.rst:745 msgid "" "See :func:`itertools.filterfalse` for the complementary function that " "returns elements of *iterable* for which *function* is false." msgstr "" -"逆の働きをする関数については、 :func:`itertools.filterfalse` を参照してくださ" -"い。 *iterable* の要素のうち、 *function* が偽であるものを返します。" +"逆の働きをする関数については :func:`itertools.filterfalse` を参照してくださ" +"い。\n" +"*iterable* の要素のうち、*function* を適用した結果が偽になる要素を返します。" #: ../../library/functions.rst:756 msgid "Return a floating-point number constructed from a number or a string." @@ -1597,7 +1596,6 @@ msgstr "" ">>> float('-Infinity')\n" "-inf" -#: ../../library/functions.rst:773 msgid "" "If the argument is a string, it should contain a decimal number, optionally " "preceded by a sign, and optionally embedded in whitespace. The optional " @@ -1607,12 +1605,13 @@ msgid "" "conform to the :token:`~float:floatvalue` production rule in the following " "grammar, after leading and trailing whitespace characters are removed:" msgstr "" -"引数が文字列の場合、10進数でなければなりません。先頭に符号または空白を含んで" -"もかまいません。符号は ``'+'`` か ``'-'`` のいずれかです。正符号 ``'+'`` は生" -"成される値に対して何の効果もありません。引数は NaN (not-a-number) や正または" -"負の無限大をあらわす文字列でもかまいません。より正確にいうと、入力は先頭と末" -"尾の空白文字を除き、以下に示す :token:`~float:floatvalue` の生成規則に従う必" -"要があります:" +"引数が文字列の場合、10進数を含み、必要に応じて先頭に符号を付けたり、前後に空" +"白文字を付けたりできます。\n" +"符号は ``'+'`` または ``'-'`` で、``'+'`` は生成される値に影響しません。\n" +"引数には、NaN (not-a-number)、正または負の無限大を表す文字列も指定できま" +"す。\n" +"より正確には、先頭と末尾の空白文字を取り除いた入力が、以下の文法の :token:" +"`~float:floatvalue` の生成規則に従う必要があります:" #: ../../library/functions.rst:794 msgid "" @@ -1633,20 +1632,20 @@ msgstr "" "値の浮動小数点数が返されます。 引数が Python の浮動小数点数の範囲外なら、 :" "exc:`OverflowError` が送出されます。" -#: ../../library/functions.rst:802 msgid "" "For a general Python object ``x``, ``float(x)`` delegates to ``x." "__float__()``. If :meth:`~object.__float__` is not defined then it falls " "back to :meth:`~object.__index__`." msgstr "" "一般の Python オブジェクト ``x`` に対して、``float(x)`` は ``x.__float__()`` " -"に委譲します。 :meth:`~object.__float__()` が定義されていない場合、:meth:" +"に委譲します。 :meth:`~object.__float__` が定義されていない場合、:meth:" "`~object.__index__` へフォールバックします。" #: ../../library/functions.rst:806 msgid "" "See also :meth:`float.from_number` which only accepts a numeric argument." msgstr "" +"数値型の値のみ引数にとる :meth:`float.from_number` も参照してください。" #: ../../library/functions.rst:808 msgid "If no argument is given, ``0.0`` is returned." @@ -1683,7 +1682,6 @@ msgstr "" "デフォルトの *format_spec* は空の文字列です。それは通常 :func:`str(value) " "` の呼び出しと同じ結果になります。" -#: ../../library/functions.rst:836 msgid "" "A call to ``format(value, format_spec)`` is translated to ``type(value)." "__format__(value, format_spec)`` which bypasses the instance dictionary when " @@ -1692,12 +1690,14 @@ msgid "" "and the *format_spec* is non-empty, or if either the *format_spec* or the " "return value are not strings." msgstr "" -"``format(value, format_spec)`` の呼び出しは、 ``type(value)." -"__format__(value, format_spec)`` に翻訳され、これは value の :meth:`~object." -"__format__` メソッドの検索をするとき、インスタンス辞書を回避します。このメ" -"ソッドの探索が :mod:`object` に到達しても *format_spec* が空にならなかった" -"り、 *format_spec* や返り値が文字列でなかったりした場合、 :exc:`TypeError` が" -"送出されます。" +"``format(value, format_spec)`` の呼び出しは、``type(value).__format__(value, " +"format_spec)`` に置き換えられ、\n" +"``value`` の :meth:`~object.__format__` メソッドを探す際にインスタンスの辞書" +"を参照しません。\n" +"メソッドの探索が :mod:`object` に到達し、かつ *format_spec* が空でない場合" +"や、\n" +"*format_spec* または返り値が文字列でない場合は、:exc:`TypeError` が送出されま" +"す。" #: ../../library/functions.rst:843 msgid "" @@ -1755,15 +1755,14 @@ msgstr "" "名前を持つ属性) の値を :func:`getattr` で取り出すためには、属性名を手動でマン" "グリングする必要があります。" -#: ../../library/functions.rst:881 msgid "" "Return the dictionary implementing the current module namespace. For code " "within functions, this is set when the function is defined and remains the " "same regardless of where the function is called." msgstr "" -"現在のモジュールの名前空間を実装した辞書を返します。関数内のコードに対して" -"は、関数が定義されるときに辞書が設定され、その関数がどこから呼ばれたかにかか" -"わらず同じ内容になります。" +"現在のモジュールの名前空間を実装する辞書を返します。\n" +"関数内のコードでは、この辞書は関数の定義時に決まり、関数がどこから呼び出され" +"ても同じ辞書が使われます。" #: ../../library/functions.rst:888 msgid "" @@ -1826,11 +1825,10 @@ msgstr "" "さい。より詳しい情報は、 :ref:`位置専用引数についての FAQ の項目 ` を参照してください。" -#: ../../library/functions.rst:922 msgid "" "This function is added to the built-in namespace by the :mod:`site` module." msgstr "" -"この関数は、 :mod:`site` モジュールから、組み込みの名前空間に移されました。" +"この関数は :mod:`site` モジュールによって組み込み名前空間に追加されます。" #: ../../library/functions.rst:924 msgid "" @@ -1890,24 +1888,24 @@ msgstr "" msgid "This is the address of the object in memory." msgstr "これはオブジェクトのメモリアドレスです。" -#: ../../library/functions.rst:970 msgid "" "Raises an :ref:`auditing event ` ``builtins.id`` with argument " "``id``." msgstr "" "引数 ``id`` を指定して :ref:`監査イベント ` ``builtins.id`` を送出" -"します。 " +"します。" -#: ../../library/functions.rst:976 msgid "" "If the *prompt* argument is present, it is written to standard output " "without a trailing newline. The function then reads a line from input, " "converts it to a string (stripping a trailing newline), and returns that. " "When EOF is read, :exc:`EOFError` is raised. Example::" msgstr "" -"引数 *prompt* が存在すれば、それが末尾の改行を除いて標準出力に書き出されま" -"す。次に、この関数は入力から 1 行を読み込み、文字列に変換して (末尾の改行を除" -"いて) 返します。 EOF が読み込まれたとき、 :exc:`EOFError` が送出されます。" +"実引数 *prompt* が指定されている場合、その値を末尾に改行を付けずに標準出力に" +"書き出します。\n" +"次に、入力から1行を読み取り、文字列に変換して末尾の改行を取り除き、その文字列" +"を返します。\n" +"EOF を読み取ると :exc:`EOFError` が送出されます。\n" "例::" #: ../../library/functions.rst:981 @@ -1917,6 +1915,10 @@ msgid "" ">>> s\n" "\"Monty Python's Flying Circus\"" msgstr "" +">>> s = input('--> ')\n" +"--> Monty Python's Flying Circus\n" +">>> s\n" +"\"Monty Python's Flying Circus\"" #: ../../library/functions.rst:986 msgid "" @@ -1984,6 +1986,10 @@ msgid "" "__int__()``. If the argument defines :meth:`~object.__index__`, it returns " "``x.__index__()``. For floating-point numbers, this truncates towards zero." msgstr "" +"引数に :meth:`~object.__int__` が定義されている場合は、 ``int(x)`` は ``x." +"__int__()`` を返します。引数に :meth:`~object.__index__` が定義されている場合" +"は、 ``x.__index__()`` を返します。浮動小数点数については、これは 0 に近い側" +"へ切り捨てます。" #: ../../library/functions.rst:1028 msgid "" @@ -2000,7 +2006,6 @@ msgstr "" "の先頭に任意の数のゼロを付けたり、前後に空白文字を付けたり、各桁を単一の下線" "で区切ったりしても有効です。" -#: ../../library/functions.rst:1034 msgid "" "A base-n integer string contains digits, each representing a value from 0 to " "n-1. The values 0--9 can be represented by any Unicode decimal digit. The " @@ -2013,17 +2018,17 @@ msgid "" "prefix. Base 0 also disallows leading zeros: ``int('010', 0)`` is not legal, " "while ``int('010')`` and ``int('010', 8)`` are." msgstr "" -"n-進数の整数文字列は、各桁が0から n-1 の数値で表されます。ユニコードの10進数" -"では、各桁は0から9のいずれかです。また10から35までの値は ``a`` から ``z`` (ま" -"たは ``A`` から ``Z``) で表されます。デフォルトの *base* は10です。基数に指定" -"可能な値は0および2から36までの整数です。2進数、8進数、16進数の文字列は、整数" -"リテラルと同様に、それぞれ ``0b``/``0B``, ``0o``/``0O``, または ``0x``/" -"``0X`` をプレフィックスとして追加することができます。基数を0に指定した場合、" -"文字列は :ref:`コードにおける整数リテラル ` と同じように解釈されま" -"す。すなわち、プレフィックスによって基数が2, 8, 10, または 16 のどれになるか" -"が決まります。基数を0にした場合先頭にゼロを追加することはできません: すなわ" -"ち ``int('010', 0)`` は基数を0に指定しているため不正ですが、 ``int('010')`` " -"や ``int('010', 8)`` は有効です。" +"n 進数の整数文字列は、各桁が 0 から n-1 の値を表す数字で構成されます。\n" +"0 から 9 の値は、任意の Unicode 10進数字で表せます。\n" +"10 から 35 の値は、``a`` から ``z`` (または ``A`` から ``Z``) で表せます。\n" +"*base* のデフォルト値は 10 で、指定できる基数は 0 および 2 から 36 です。\n" +"2 進、8 進、16 進の文字列には、コード中の整数リテラルと同様に、それぞれ " +"``0b``/``0B``、``0o``/``0O``、``0x``/``0X`` という接頭辞を付けられます。\n" +"基数が 0 の場合は、:ref:`コード中の整数リテラル ` と同じように、接" +"頭辞によって実際の基数が 2、8、10、16 のいずれかに決まります。\n" +"基数が 0 の場合は先頭に余分なゼロを付けることもできません。\n" +"``int('010', 0)`` は無効ですが、``int('010')`` と ``int('010', 8)`` は有効で" +"す。" #: ../../library/functions.rst:1045 msgid "The integer type is described in :ref:`typesnumeric`." @@ -2069,10 +2074,11 @@ msgstr "" "`ValueError` が送出されます。詳しくは :ref:`整数文字列の変換における長さ制限 " "` を参照してください。" -#: ../../library/functions.rst:1071 msgid "" ":func:`int` no longer delegates to the :meth:`~object.__trunc__` method." msgstr "" +":func:`int` は :meth:`~object.__trunc__` メソッドに処理を委譲しなくなりまし" +"た。" #: ../../library/functions.rst:1076 msgid "" @@ -2215,20 +2221,19 @@ msgstr "" "モジュール スコープでは、単一の名前空間で :func:`exec` や :func:`eval` を使う" "場合と同じく、この関数は :func:`globals` と同じ名前空間を返します。" -#: ../../library/functions.rst:1165 msgid "" "At class scope, it returns the namespace that will be passed to the " "metaclass constructor." msgstr "" -"クラス スコープでは、メタクラス コンストラクタに渡された名前空間を返します。" +"クラススコープでは、メタクラスのコンストラクタに渡される名前空間を返します。" -#: ../../library/functions.rst:1168 msgid "" "When using ``exec()`` or ``eval()`` with separate local and global " "arguments, it returns the local namespace passed in to the function call." msgstr "" -"``exec()`` や ``eval()`` が引数 local と global が分けて使われてる場合では、" -"関数の呼び出しで渡されたローカル名前空間を返します。" +"ローカル用とグローバル用に別々の実引数を渡して ``exec()`` や ``eval()`` を使" +"う場合、\n" +"その関数呼び出しに渡されたローカル名前空間を返します。" #: ../../library/functions.rst:1171 msgid "" @@ -2316,10 +2321,18 @@ msgid "" "cases where the function inputs are already arranged into argument tuples, " "see :func:`itertools.starmap`." msgstr "" +"*function* を *iterable* の全ての要素に適用した結果を返していくイテレータを返" +"します。追加で *iterables* 引数が渡された場合、 *function* はその数だけの引数" +"を取らなければならず、全てのイテラブルから並行して取り出された要素に適用され" +"ます。複数のイテラブルがあるとき、このイテレータはその中の最短のイテラブルが" +"尽きた時点で止まります。 *strict* が ``True`` の場合は、ある iterable が他の " +"iterable より先に尽きると :exc:`ValueError` 例外が発生します。関数の入力がす" +"でに引数のタプルの形で渡される場合は、 :func:`itertools.starmap` を使用してく" +"ださい。" #: ../../library/functions.rst:1219 msgid "Added the *strict* parameter." -msgstr "" +msgstr "*strict* パラメータが追加されました。" #: ../../library/functions.rst:1227 msgid "" @@ -2328,15 +2341,14 @@ msgid "" msgstr "" "iterable の中で最大の要素、または2つ以上の引数の中で最大のものを返します。" -#: ../../library/functions.rst:1230 msgid "" "If one positional argument is provided, it should be an :term:`iterable`. " "The largest item in the iterable is returned. If two or more positional " "arguments are provided, the largest of the positional arguments is returned." msgstr "" -"位置引数が1つだけ与えられた場合、それは空でない :term:`iterable` でなくてはい" -"けません。その iterable の最大の要素が返されます。2 つ以上のキーワード無しの" -"位置引数が与えられた場合、その位置引数の中で最大のものが返されます。" +"位置引数が1つの場合は、:term:`iterable` を指定します。\n" +"そのイテラブルの最大の要素を返します。\n" +"位置引数が2つ以上の場合は、それらのうち最大のものを返します。" #: ../../library/functions.rst:1235 ../../library/functions.rst:1273 msgid "" @@ -2389,15 +2401,14 @@ msgid "" msgstr "" "iterable の中で最小の要素、または2つ以上の引数の中で最小のものを返します。" -#: ../../library/functions.rst:1268 msgid "" "If one positional argument is provided, it should be an :term:`iterable`. " "The smallest item in the iterable is returned. If two or more positional " "arguments are provided, the smallest of the positional arguments is returned." msgstr "" -"位置引数が1つだけ与えられた場合、それは空でない :term:`iterable` でなくてはい" -"けません。その iterable の最小の要素が返されます。2 つ以上のキーワード無しの" -"位置引数が与えられた場合、その位置引数の中で最小のものが返されます。" +"位置引数が1つの場合は、:term:`iterable` を指定します。\n" +"そのイテラブルの最小の要素を返します。\n" +"位置引数が2つ以上の場合は、それらのうち最小のものを返します。" #: ../../library/functions.rst:1279 msgid "" @@ -2428,12 +2439,19 @@ msgid "" "called, it returns a new featureless object. The constructor does not accept " "any arguments." msgstr "" +"これが、あらゆるクラスに継承される大本のベースクラスです。このクラスが持つメ" +"ソッドは、どの Python クラスのインスタンスにもあります。コンストラクタを呼び" +"出すと、まっさらなオブジェクトが返ります。コンストラクタに引数は指定できませ" +"ん。" #: ../../library/functions.rst:1308 msgid "" ":class:`object` instances do *not* have :attr:`~object.__dict__` attributes, " "so you can't assign arbitrary attributes to an instance of :class:`object`." msgstr "" +":class:`object` インスタンスは :attr:`~object.__dict__` 属性を *持たない* の" +"で、 :class:`object` クラスのインスタンスに任意の属性を代入することはできま" +"せん。" #: ../../library/functions.rst:1315 msgid "" @@ -2466,7 +2484,6 @@ msgstr "" "す。ファイルを開くことができなければ、:exc:`OSError` が送出されます。\n" "この関数の利用例について、 :ref:`tut-files` を参照してください。" -#: ../../library/functions.rst:1346 msgid "" "*file* is a :term:`path-like object` giving the pathname (absolute or " "relative to the current working directory) of the file to be opened or an " @@ -2474,11 +2491,12 @@ msgid "" "given, it is closed when the returned I/O object is closed unless *closefd* " "is set to ``False``.)" msgstr "" -"*file* は :term:`path-like object` で、開くファイルのパス名 (絶対パスまたは現" -"在の作業ディレクトリからの相対パス) あるいはラップするファイルの整数のファイ" -"ルデスクリプタを与えます。 (ファイルデスクリプタが与えられた場合、 *closefd* " -"が ``False`` に設定されていないかぎり、この関数が返す I/O オブジェクトがク" -"ローズされるときにファイルデスクリプタもクローズされます。)" +"*file* には、開くファイルのパス名 (絶対パスまたは現在の作業ディレクトリからの" +"相対パス) を示す :term:`path-like object` か、\n" +"ラップするファイルの整数のファイル記述子を指定します。\n" +"(ファイル記述子を指定した場合、*closefd* が ``False`` に設定されていなけれ" +"ば、\n" +"返された I/O オブジェクトを閉じるときにそのファイル記述子も閉じられます。)" #: ../../library/functions.rst:1352 msgid "" @@ -2568,15 +2586,15 @@ msgstr "``'+'``" msgid "open for updating (reading and writing)" msgstr "更新用に開く (読み込み・書き込み用)" -#: ../../library/functions.rst:1380 msgid "" "The default mode is ``'r'`` (open for reading text, a synonym of ``'rt'``). " "Modes ``'w+'`` and ``'w+b'`` open and truncate the file. Modes ``'r+'`` and " "``'r+b'`` open the file with no truncation." msgstr "" -"デフォルトのモードは ``'r'`` (テキストの読み込み用に開く、 ``'rt'`` と同義) " -"です。 ``'w+'`` と ``'w+b'`` はファイルを開いて上書きします。 ``'r+'`` と " -"``'r+b'`` はファイルを上書きせずに開きます。" +"デフォルトのモードは ``'r'`` です (テキストの読み込み用に開き、``'rt'`` と同" +"義です)。\n" +"モード ``'w+'`` と ``'w+b'`` はファイルを開いて内容を切り詰めます。\n" +"モード ``'r+'`` と ``'r+b'`` は、内容を切り詰めずにファイルを開きます。" #: ../../library/functions.rst:1384 msgid "" @@ -2638,6 +2656,10 @@ msgid "" "size is available. On most systems, the buffer will typically be 128 " "kilobytes long." msgstr "" +"バイナリモードでは、固定サイズのチャンクバッファが使われます。バッファのサイ" +"ズは、デバイスのブロックサイズが取得できる場合は ``max(min(blocksize, 8 " +"MiB), DEFAULT_BUFFER_SIZE)`` です。ほとんどの環境では、このバッファは通常 " +"128 キロバイトです。" #: ../../library/functions.rst:1413 msgid "" @@ -2888,7 +2910,7 @@ msgid "" "``mode``, ``flags``." msgstr "" "引数 ``path``, ``mode``, ``flags`` を指定して :ref:`監査イベント ` " -"``open`` を送出します。 " +"``open`` を送出します。" #: ../../library/functions.rst:1534 msgid "" @@ -2943,13 +2965,12 @@ msgid "Support added to accept objects implementing :class:`os.PathLike`." msgstr "" ":class:`os.PathLike` を実装したオブジェクトを受け入れるようになりました。" -#: ../../library/functions.rst:1559 msgid "" "On Windows, opening a console buffer may return a subclass of :class:`io." "RawIOBase` other than :class:`io.FileIO`." msgstr "" -"Windowsでは、コンソールバッファのオープンは、:class:`io.FileIO` ではなく、:" -"class:`io.RawIOBase` のサブクラスを返すでしょう。" +"Windows では、コンソールバッファを開くと、:class:`io.FileIO` 以外の :class:" +"`io.RawIOBase` のサブクラスが返される場合があります。" #: ../../library/functions.rst:1562 msgid "The ``'U'`` mode has been removed." @@ -2967,16 +2988,16 @@ msgstr "" "``ord('€')`` (ユーロ記号) は ``8364`` を返します。これは :func:`chr` の逆で" "す。" -#: ../../library/functions.rst:1575 msgid "" "Return *base* to the power *exp*; if *mod* is present, return *base* to the " "power *exp*, modulo *mod* (computed more efficiently than ``pow(base, exp) % " "mod``). The two-argument form ``pow(base, exp)`` is equivalent to using the " "power operator: ``base**exp``." msgstr "" -"*base* の *exp* 乗を返します; *mod* があれば、*base* の *exp* 乗に対する " -"*mod* の剰余を返します (``pow(base, exp) % mod`` より効率よく計算されます)。" -"二引数の形式 ``pow(base, exp)`` は、冪乗演算子を使った ``base**exp`` と等価で" +"*base* の *exp* 乗を返します。\n" +"*mod* を指定した場合は、*base* の *exp* 乗を *mod* で割った余りを返します " +"(``pow(base, exp) % mod`` より効率よく計算されます)。\n" +"2引数形式の ``pow(base, exp)`` は、冪乗演算子を使う ``base**exp`` と等価で" "す。" #: ../../library/functions.rst:1580 @@ -3114,9 +3135,8 @@ msgstr "" "です。*fdel* は属性値を削除するための関数です。*doc* は属性の docstring を作" "成します。" -#: ../../library/functions.rst:1648 msgid "A typical use is to define a managed attribute ``x``::" -msgstr "典型的な使用法は、属性 ``x`` の処理の定義です::" +msgstr "典型的な用途は、アクセスを管理する属性 ``x`` を定義することです。 ::" #: ../../library/functions.rst:1650 msgid "" @@ -3266,9 +3286,10 @@ msgstr "" "返される property オブジェクトも、コンストラクタの引数に対応した ``fget``, " "``fset``, および ``fdel`` 属性を持ちます。" -#: ../../library/functions.rst:1720 msgid "The docstrings of property objects are now writeable." -msgstr "属性オブジェクトのドックストリングが書き込み可能になりました。" +msgstr "" +"プロパティオブジェクトのドキュメンテーション文字列が書き込み可能になりまし" +"た。" #: ../../library/functions.rst:1725 msgid "" @@ -3284,7 +3305,6 @@ msgstr "" ":class:`range` は、実際には関数ではなくイミュータブルなシーケンス型で、 :ref:" "`typesseq-range` と :ref:`typesseq` にドキュメント化されています。" -#: ../../library/functions.rst:1742 msgid "" "Return a string containing a printable representation of an object. For " "many types, this function makes an attempt to return a string that would " @@ -3296,14 +3316,16 @@ msgid "" "method. If :func:`sys.displayhook` is not accessible, this function will " "raise :exc:`RuntimeError`." msgstr "" -"オブジェクトの印字可能な表現を含む文字列を返します。この関数は多くの型につい" -"て、 :func:`eval` に渡されたときと同じ値を持つようなオブジェクトを表す文字列" -"を生成しようとします。そうでない場合は、山括弧に囲まれたオブジェクトの型の名" -"前と追加の情報 (大抵の場合はオブジェクトの名前とアドレスを含みます) を返しま" -"す。クラスは、 :meth:`~object.__repr__` メソッドを定義することで、この関数に" -"よりそのクラスのインスタンスが返すものを制御することができます。:func:`sys." -"displayhook` にアクセスできない場合、この関数は :exc:`RuntimeError` を送出し" -"ます。" +"オブジェクトの印字可能な表現を含む文字列を返します。\n" +"多くの型では、:func:`eval` に渡すと元のオブジェクトと同じ値を持つオブジェクト" +"が得られるような文字列を返そうとします。\n" +"それ以外の場合、オブジェクトの型名と追加情報を含む、山括弧で囲まれた文字列を" +"返します。\n" +"追加情報には、オブジェクトの名前やアドレスが含まれることがよくあります。\n" +"クラスに :meth:`~object.__repr__` メソッドを定義すると、そのクラスのインスタ" +"ンスに対してこの関数が返すものを制御できます。\n" +":func:`sys.displayhook` にアクセスできない場合、この関数は :exc:" +"`RuntimeError` を送出します。" #: ../../library/functions.rst:1753 msgid "This class has a custom representation that can be evaluated::" @@ -3367,13 +3389,12 @@ msgstr "" "返り値は *ndigits* が指定されていないか ``None`` の場合は整数、そうでなければ" "返り値は *number* と同じ型です。" -#: ../../library/functions.rst:1787 msgid "" "For a general Python object ``number``, ``round`` delegates to ``number." "__round__``." msgstr "" -"一般的な Python オブジェクト ``number`` に対して、``round`` は処理を `number." -"__round__` に移譲します。" +"一般的な Python オブジェクト ``number`` に対して、``round`` は処理を " +"``number.__round__`` に委譲します。" #: ../../library/functions.rst:1792 msgid "" @@ -3498,14 +3519,13 @@ msgstr "" "2 つのオプション引数があり、これらはキーワード引数として指定されなければなり" "ません。" -#: ../../library/functions.rst:1866 msgid "" "*key* specifies a function of one argument that is used to extract a " "comparison key from each element in *iterable* (for example, ``key=str." "lower``). The default value is ``None`` (compare the elements directly)." msgstr "" -"*key* には 1 引数関数を指定します。これは *iterable* の各要素から比較キーを展" -"開するのに使われます (例えば、 ``key=str.lower`` のように指定します)。\n" +"*key* には、*iterable* の各要素から比較キーを取り出すための1引数関数を指定し" +"ます (例えば ``key=str.lower``)。\n" "デフォルト値は ``None`` です (要素を直接比較します)。" #: ../../library/functions.rst:1870 @@ -3646,13 +3666,17 @@ msgstr "" msgid "For more information on static methods, see :ref:`types`." msgstr "静的メソッドについて詳しい情報は :ref:`types` を参照してください。" -#: ../../library/functions.rst:1929 msgid "" "Static methods now inherit the method attributes (:attr:`~function." "__module__`, :attr:`~function.__name__`, :attr:`~function.__qualname__`, :" "attr:`~function.__doc__` and :attr:`~function.__annotations__`), have a new " "``__wrapped__`` attribute, and are now callable as regular functions." msgstr "" +"静的メソッドは、メソッドの属性 (:attr:`~function.__module__`、:attr:" +"`~function.__name__`、:attr:`~function.__qualname__`、:attr:`~function." +"__doc__`、:attr:`~function.__annotations__`) を継承し、\n" +"新しい ``__wrapped__`` 属性を持つようになりました。\n" +"また、通常の関数として呼び出せるようになりました。" #: ../../library/functions.rst:1945 msgid "" @@ -3669,14 +3693,13 @@ msgstr "" "``str`` は組み込みの文字列 :term:`クラス` です。文字列に関する一般的な" "情報は、:ref:`textseq` を参照してください。" -#: ../../library/functions.rst:1953 msgid "" "Sums *start* and the items of an *iterable* from left to right and returns " "the total. The *iterable*'s items are normally numbers, and the start value " "is not allowed to be a string." msgstr "" -"*start* と *iterable* の要素を左から右へ合計し、総和を返します。 *iterable* " -"の要素は通常は数値で、start の値は文字列であってはなりません。" +"*start* と *iterable* の要素を左から右へ加算し、総和を返します。\n" +"*iterable* の要素は通常は数値で、``start`` の値には文字列を指定できません。" #: ../../library/functions.rst:1957 msgid "" @@ -3698,19 +3721,20 @@ msgstr "" "*start* パラメータをキーワード引数として指定することができるようになりまし" "た。" -#: ../../library/functions.rst:1966 msgid "" "Summation of floats switched to an algorithm that gives higher accuracy and " "better commutativity on most builds." msgstr "" -"浮動小数点数の総和を計算するとき、ほとんどの環境でより高精度な結果とより良い" -"互換性が得られるアルゴリズムを使用するようになりました。" +"浮動小数点数の総和を計算するアルゴリズムが変更され、\n" +"ほとんどのビルドで精度が向上し、加算する順序を入れ替えたときも結果がより一致" +"しやすくなりました。" -#: ../../library/functions.rst:1969 msgid "" "Added specialization for summation of complexes, using same algorithm as for " "summation of floats." msgstr "" +"浮動小数点数の総和と同じアルゴリズムを使う、複素数の総和に特化した処理が追加" +"されました。" #: ../../library/functions.rst:1977 msgid "" @@ -3736,14 +3760,19 @@ msgid "" "> A -> object`` and the value of *type* is ``B``, then :func:`super` " "searches ``C -> A -> object``." msgstr "" +"例えば *object_or_type* の :attr:`~type.__mro__` 属性が ``D -> B -> C -> A -" +"> object`` であり、 *type* の値が ``B`` だとすると、 :func:`super` は ``C -> " +"A -> object`` の順番でメソッドを検索します。" -#: ../../library/functions.rst:1989 msgid "" "The :attr:`~type.__mro__` attribute of the class corresponding to " "*object_or_type* lists the method resolution search order used by both :func:" "`getattr` and :func:`super`. The attribute is dynamic and can change " "whenever the inheritance hierarchy is updated." msgstr "" +"*object_or_type* に対応するクラスの :attr:`~type.__mro__` 属性には、:func:" +"`getattr` と :func:`super` の両方が使うメソッド解決順序が記載されています。\n" +"この属性は動的であり、継承階層が更新されると変わることがあります。" #: ../../library/functions.rst:1994 msgid "" @@ -3784,7 +3813,6 @@ msgstr "" "メンテナンスしやすくなります。この用途は他のプログラミング言語で見られる " "*super* の用途によく似ています。" -#: ../../library/functions.rst:2011 msgid "" "The second use case is to support cooperative multiple inheritance in a " "dynamic execution environment. This use case is unique to Python and is not " @@ -3796,14 +3824,15 @@ msgid "" "changes in the class hierarchy, and because that order can include sibling " "classes that are unknown prior to runtime)." msgstr "" -"2つ目の用途は動的な実行環境において協調的 (cooperative) な多重継承をサポート" -"することです。これは Python に特有の用途で、静的にコンパイルされる言語や、単" -"継承のみをサポートする言語には見られないものです。この機能により、同じ名前の" -"メソッドを実装する複数の基底クラスを使った \"ダイヤモンド型* の継承構造を実装" -"することができます。良い設計は、そのような実装において、どのような場合でも同" -"じ呼び出しシグネチャを持つように強制します。 (理由は呼び出しの順序が実行時に" -"決定されること、呼び出し順序はクラス階層構造の変化に順応すること、そして呼び" -"出し順序が実行時まで未知の兄弟クラスが含まれる場合があることです)。" +"2つ目の用途は、動的な実行環境で協調的な多重継承をサポートすることです。\n" +"これは Python 特有の用途であり、静的にコンパイルされる言語や単継承だけをサ" +"ポートする言語には見られません。\n" +"これにより、複数の基底クラスが同じメソッドを実装する「ダイヤモンド型」の継承" +"構造を実現できます。\n" +"適切に設計するには、これらの実装の呼び出しシグネチャをすべて同じにする必要が" +"あります\n" +"(呼び出しの順序が実行時に決まり、その順序はクラス階層の変化に応じて変わり、\n" +"実行時まで分からない兄弟クラスもその順序に含まれる可能性があるためです)。" #: ../../library/functions.rst:2021 msgid "For both use cases, a typical superclass call looks like this::" @@ -3848,7 +3877,6 @@ msgstr "" "文や ``super()[name]`` のような演算子を使った暗黙の探索向けには定義されていま" "せん。" -#: ../../library/functions.rst:2040 msgid "" "Also note that, aside from the zero argument form, :func:`super` is not " "limited to use inside methods. The two argument form specifies the " @@ -3857,11 +3885,12 @@ msgid "" "necessary details to correctly retrieve the class being defined, as well as " "accessing the current instance for ordinary methods." msgstr "" -"また、 :func:`super` の使用は引数無しの形式を除きメソッド内部に限定されないこ" -"とにも注目して下さい。2引数の形式は、必要な要素を正確に指定するので、適当な参" -"照を作ることができます。クラス定義中における引数無しの形式は、定義されている" -"クラスを取り出すのに必要な詳細を、通常の方法で現在のインスタンスにアクセスす" -"るようにコンパイラが埋めるのではたらきます。" +"引数なしの形式を除き、:func:`super` はメソッドの外でも使えます。\n" +"2引数形式では、引数を明示的に指定し、適切な参照を作成します。\n" +"引数なしの形式がクラス定義内でのみ機能するのは、\n" +"定義中のクラスを正しく取得し、通常のメソッドでは現在のインスタンスにもアクセ" +"スできるように、\n" +"コンパイラが必要な情報を補うためです。" #: ../../library/functions.rst:2047 msgid "" @@ -3878,6 +3907,8 @@ msgid "" ":class:`super` objects are now :mod:`pickleable ` and :mod:" "`copyable `." msgstr "" +":class:`super` オブジェクトは :mod:`pickle 可能 ` かつ :mod:`コピー可" +"能 ` になりました。" #: ../../library/functions.rst:2061 msgid "" @@ -3893,6 +3924,8 @@ msgid "" "type object and generally the same object as returned by :attr:`object." "__class__`." msgstr "" +"引数が1つだけの場合、*object* の型を返します。返り値は型オブジェクトで、一般" +"に :attr:`object.__class__` によって返されるのと同じオブジェクトです。" #: ../../library/functions.rst:2074 msgid "" @@ -3914,18 +3947,24 @@ msgid "" "__dict__` attribute. The following two statements create identical :class:`!" "type` objects:" msgstr "" +"引数が3つの場合、新しい型オブジェクトを返します。これは本質的には :keyword:" +"`class` 文の動的な書式です。 *name* 文字列はクラス名で、 :attr:`~type." +"__name__` 属性になります。 *bases* 基底クラスのタプルで、 :attr:`~type." +"__bases__` 属性になります; 空の場合は全てのクラスの基底クラスである :class:" +"`object` が追加されます。 *dict* は、クラス本体の属性とメソッドの定義を含む辞" +"書です; 辞書は :attr:`~type.__dict__` 属性になる前にコピーされたり、ラップさ" +"れることがあります。以下の2つの文は同じ :class:`!type` オブジェクトを生成しま" +"す:" #: ../../library/functions.rst:2092 msgid "See also:" msgstr "下記を参照してください。" -#: ../../library/functions.rst:2094 msgid "" ":ref:`Documentation on attributes and methods on classes `." msgstr "" -":ref:`Documentation on attributes and methods on classes `." +":ref:`クラスの属性とメソッドに関するドキュメント `。" #: ../../library/functions.rst:2095 msgid ":ref:`bltin-type-objects`" @@ -3951,12 +3990,16 @@ msgid "" "Subclasses of :class:`!type` which don't override ``type.__new__`` may no " "longer use the one-argument form to get the type of an object." msgstr "" +"``type.__new__`` をオーバーライドしていない :class:`!type` のサブクラスは、オ" +"ブジェクトの型を得るのに1引数形式を利用することができません。" #: ../../library/functions.rst:2111 msgid "" "Return the :attr:`~object.__dict__` attribute for a module, class, instance, " "or any other object with a :attr:`!__dict__` attribute." msgstr "" +"モジュール、クラス、インスタンス、あるいはそれ以外の :attr:`!__dict__` 属性を" +"持つオブジェクトの、 :attr:`~object.__dict__` 属性を返します。" #: ../../library/functions.rst:2114 msgid "" @@ -3965,6 +4008,11 @@ msgid "" "their :attr:`!__dict__` attributes (for example, classes use a :class:`types." "MappingProxyType` to prevent direct dictionary updates)." msgstr "" +"モジュールやインスタンスのようなオブジェクトは、更新可能な :attr:`~object." +"__dict__` 属性を持っています。ただし、それ以外のオブジェクトでは :attr:`!" +"__dict__` 属性への書き込みが制限されている場合があります。書き込みに制限があ" +"る例としては、辞書を直接更新されることを防ぐために :class:`types." +"MappingProxyType` を使っているクラスがあります。" #: ../../library/functions.rst:2119 msgid "Without an argument, :func:`vars` acts like :func:`locals`." @@ -4100,15 +4148,14 @@ msgstr "" "しかし、デフォルトの動作と異なり、あるイテラブルが他のイテラブルよりも先に消" "費しきった場合に :exc:`ValueError` 例外を送出します:" -#: ../../library/functions.rst:2193 msgid "" "Without the ``strict=True`` argument, any bug that results in iterables of " "different lengths will be silenced, possibly manifesting as a hard-to-find " "bug in another part of the program." msgstr "" -"``strict=True`` 引数なしの場合、長さの異なるイテラブルを生じる原因となるいか" -"なるバグも、この時点では問題なく処理されます。そして代わりにプログラムの別の" -"場所で、原因を特定しにくいバグとして検出されることになるでしょう。" +"``strict=True`` を指定しないと、イテラブルの長さが異なる原因となるバグが表面" +"化せず、\n" +"プログラムの別の場所で発見しにくいバグとして現れる場合があります。" #: ../../library/functions.rst:2197 msgid "" @@ -4146,12 +4193,11 @@ msgstr "" "``n`` 回呼び出した結果となるよう、 *同じ* イテレータを ``n`` 回繰り返します。" "これは入力を長さ n のチャンクに分割する効果があります。" -#: ../../library/functions.rst:2212 msgid "" ":func:`zip` in conjunction with the ``*`` operator can be used to unzip a " "list::" msgstr "" -":func:`zip` に続けて ``*`` 演算子を使うと、zip したリストを元に戻せます::" +":func:`zip` と ``*`` 演算子を組み合わせると、zip したリストを元に戻せます::" #: ../../library/functions.rst:2215 msgid "" @@ -4203,7 +4249,6 @@ msgstr "" "`__import__` を直接使用することも推奨されず、 :func:`importlib." "import_module` の方が好まれます。" -#: ../../library/functions.rst:2247 msgid "" "The function imports the module *name*, potentially using the given " "*globals* and *locals* to determine how to interpret the name in a package " @@ -4212,14 +4257,14 @@ msgid "" "does not use its *locals* argument at all and uses its *globals* only to " "determine the package context of the :keyword:`import` statement." msgstr "" -"この関数は、モジュール *name* をインポートし、 *globals* と *locals* が与えら" -"れれば、パッケージのコンテキストで名前をどう解釈するか決定するのに使います。 " -"*fromlist* は *name* で与えられるモジュールからインポートされるべきオブジェク" -"トまたはサブモジュールの名前を与ます。標準の実装では *locals* 引数はまったく" -"使われず、 *globals* は :keyword:`import` 文のパッケージコンテキストを決定す" -"るためにのみ使われます。" +"この関数はモジュール *name* をインポートします。\n" +"その際、指定された *globals* と *locals* を使って、パッケージのコンテキストで" +"名前をどう解釈するかを決めることがあります。\n" +"*fromlist* には、*name* が指定するモジュールからインポートするオブジェクトや" +"サブモジュールの名前を指定します。\n" +"標準の実装では *locals* 引数をまったく使わず、:keyword:`import` 文のパッケー" +"ジコンテキストを決めるためにのみ *globals* を使います。" -#: ../../library/functions.rst:2254 msgid "" "*level* specifies whether to use absolute or relative imports. ``0`` (the " "default) means only perform absolute imports. Positive values for *level* " @@ -4227,10 +4272,12 @@ msgid "" "directory of the module calling :func:`__import__` (see :pep:`328` for the " "details)." msgstr "" -"*level* は絶対と相対どちらのインポートを使うかを指定します。 ``0`` (デフォル" -"ト) は絶対インポートのみ実行します。正の *level* の値は、 :func:`__import__` " -"を呼び出したディレクトリから検索対象となる親ディレクトリの数を示します (詳細" -"は :pep:`328` を参照してください)。" +"*level* は、絶対インポートと相対インポートのどちらを使うかを指定します。\n" +"``0`` (デフォルト) は、絶対インポートだけを行うことを意味します。\n" +"正の *level* は、:func:`__import__` を呼び出すモジュールのディレクトリを基準" +"に、\n" +"検索対象となる親ディレクトリの数を示します (詳細は :pep:`328` を参照してくだ" +"さい)。" #: ../../library/functions.rst:2260 msgid "" @@ -4263,14 +4310,12 @@ msgstr "文 ``import spam.ham`` は、この呼び出しになります::" msgid "spam = __import__('spam.ham', globals(), locals(), [], 0)" msgstr "spam = __import__('spam.ham', globals(), locals(), [], 0)" -#: ../../library/functions.rst:2274 msgid "" "Note how :func:`__import__` returns the toplevel module here because this is " "the object that is bound to a name by the :keyword:`import` statement." msgstr "" -"ここで :func:`__import__` がどのように最上位モジュールを返しているかに注意し" -"て下さい。 :keyword:`import` 文により名前が束縛されたオブジェクトになっていま" -"す。" +"ここで :func:`__import__` が最上位のモジュールを返すのは、:keyword:`import` " +"文がそのオブジェクトに名前を束縛するためです。" #: ../../library/functions.rst:2277 msgid "" @@ -4316,13 +4361,12 @@ msgstr "" "負の *level* の値はサポートされなくなりました (デフォルト値の 0 に変更されま" "す)。" -#: ../../library/functions.rst:2295 msgid "" "When the command line options :option:`-E` or :option:`-I` are being used, " "the environment variable :envvar:`PYTHONCASEOK` is now ignored." msgstr "" -"コマンドラインオプション :option:`-E` or :option:`-I` が指定された場合、環境" -"変数 :envvar:`PYTHONCASEOK` は無視されるようになりました。" +"コマンドラインオプション :option:`-E` または :option:`-I` が使われている場" +"合、環境変数 :envvar:`PYTHONCASEOK` は無視されるようになりました。" #: ../../library/functions.rst:2300 msgid "Footnotes" diff --git a/library/functools.po b/library/functools.po index e58e5f765..e7ce1f0dc 100644 --- a/library/functools.po +++ b/library/functools.po @@ -21,10 +21,10 @@ msgstr "" "Last-Translator: Atsuo Ishimoto , 2025\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/functools.rst:2 @@ -87,19 +87,23 @@ msgid "" "479001600" msgstr "" -#: ../../library/functools.rst:52 ../../library/functools.rst:158 msgid "" "The cache is threadsafe so that the wrapped function can be used in multiple " "threads. This means that the underlying data structure will remain coherent " "during concurrent updates." msgstr "" +"キャッシュはスレッドセーフなので、ラップされた関数を複数のスレッドで使用でき" +"ます。\n" +"これは、同時に更新が行われても、内部のデータ構造の整合性が保たれるという意味" +"です。" -#: ../../library/functools.rst:56 ../../library/functools.rst:162 msgid "" "It is possible for the wrapped function to be called more than once if " "another thread makes an additional call before the initial call has been " "completed and cached." msgstr "" +"最初の呼び出しが完了して結果がキャッシュされるまでに別のスレッドから呼び出さ" +"れた場合、ラップされた関数が複数回呼び出される可能性があります。" #: ../../library/functools.rst:65 msgid "" @@ -119,7 +123,6 @@ msgstr "" msgid "Example::" msgstr "以下はプログラム例です::" -#: ../../library/functools.rst:72 msgid "" "class DataSet:\n" "\n" @@ -130,6 +133,14 @@ msgid "" " def stdev(self):\n" " return statistics.stdev(self._data)" msgstr "" +"class DataSet:\n" +"\n" +" def __init__(self, sequence_of_numbers):\n" +" self._data = tuple(sequence_of_numbers)\n" +"\n" +" @cached_property\n" +" def stdev(self):\n" +" return statistics.stdev(self._data)" #: ../../library/functools.rst:81 msgid "" @@ -141,7 +152,6 @@ msgstr "" "プロパティは、セッター (setter) が定義されない限り書き込みを禁止します。対照" "的に、 *cached_property* は書き込みを許します。" -#: ../../library/functools.rst:85 msgid "" "The *cached_property* decorator only runs on lookups and only when an " "attribute of the same name doesn't exist. When it does run, the " @@ -149,10 +159,11 @@ msgid "" "attribute reads and writes take precedence over the *cached_property* method " "and it works like a normal attribute." msgstr "" -"*cached_property* デコレータはルックアップテーブルで、同名の属性が存在しない" -"場合のみ動作します。動作した場合、 *cached_property* は同名の属性に書き込みを" -"行います。その後の属性の読み込みと書き込みは *cached_property* メソッドより優" -"先され、通常の属性のように働きます。" +"*cached_property* デコレータが実行されるのは、属性が検索され、かつ同名の属性" +"がまだ存在しない場合だけです。\n" +"実行されると、*cached_property* は同名の属性に値を書き込みます。\n" +"その後の属性の読み書きは *cached_property* メソッドより優先されるため、通常の" +"属性と同じように動作します。" #: ../../library/functools.rst:91 msgid "" @@ -162,7 +173,6 @@ msgstr "" "キャッシュされた値は属性を削除することで取り除くことができます。これにより " "*cached_property* メソッドを再度実行することが可能になります。" -#: ../../library/functools.rst:94 msgid "" "The *cached_property* does not prevent a possible race condition in multi-" "threaded usage. The getter function could run more than once on the same " @@ -172,15 +182,23 @@ msgid "" "necessary locking inside the decorated getter function or around the cached " "property access." msgstr "" +"*cached_property* は、複数スレッドで使用する際に起こり得る競合状態を防ぎませ" +"ん。\n" +"同じインスタンスに対してゲッター関数が複数回実行され、最後の実行がキャッシュ" +"の値を設定する場合があります。\n" +"キャッシュされるプロパティが冪等であるなど、同じインスタンスで複数回実行して" +"も害がなければ問題ありません。\n" +"同期が必要な場合は、デコレートしたゲッター関数内か、キャッシュされるプロパ" +"ティにアクセスする箇所の前後で、必要なロックを実装してください。" -#: ../../library/functools.rst:102 msgid "" "Note, this decorator interferes with the operation of :pep:`412` key-sharing " "dictionaries. This means that instance dictionaries can take more space " "than usual." msgstr "" -"このデコレータは :pep:`412` のキー共有辞書のインターフェースを持ちます。これ" -"は、インスタンス辞書がより多くのスペースを使う可能性があることを意味します。" +"このデコレータは :pep:`412` のキー共有辞書の動作を妨げる点に注意してくださ" +"い。\n" +"そのため、インスタンスの辞書が通常より多くのメモリを使うことがあります。" #: ../../library/functools.rst:106 msgid "" @@ -243,10 +261,11 @@ msgstr "" "し可能オブジェクトです。key 関数は呼び出し可能オブジェクトで、1つの引数を受け" "取り、ソートキーとして使われる値を返します。" -#: ../../library/functools.rst:144 msgid "" "sorted(iterable, key=cmp_to_key(locale.strcoll)) # locale-aware sort order" msgstr "" +"sorted(iterable, key=cmp_to_key(locale.strcoll)) # ロケールに応じた順序で" +"ソート" #: ../../library/functools.rst:146 msgid "" @@ -272,17 +291,16 @@ msgstr "" "結果のキャッシュには辞書が使われるので、関数の位置引数およびキーワード引数" "は :term:`ハッシュ可能 ` でなくてはなりません。" -#: ../../library/functools.rst:169 msgid "" "Distinct argument patterns may be considered to be distinct calls with " "separate cache entries. For example, ``f(a=1, b=2)`` and ``f(b=2, a=1)`` " "differ in their keyword argument order and may have two separate cache " "entries." msgstr "" -"引数のパターンが異なる場合は、異なる呼び出しと見なされ別々のキャッシュエント" -"リーとなります。\n" -"例えば、 ``f(a=1, b=2)`` と ``f(b=2, a=1)`` はキーワード引数の順序が異なって" -"いるので、2つの別個のキャッシュエントリーになります。" +"引数のパターンが異なると、別の呼び出しとして扱われ、個別のキャッシュエント" +"リーになることがあります。\n" +"例えば、``f(a=1, b=2)`` と ``f(b=2, a=1)`` はキーワード引数の順序が異なるた" +"め、2 つの別々のキャッシュエントリーになる可能性があります。" #: ../../library/functools.rst:174 msgid "" @@ -309,13 +327,16 @@ msgstr "" "*maxsize* が ``None`` に設定された場合は、LRU 機能は無効化され、キャッシュは" "際限無く大きくなります。" -#: ../../library/functools.rst:185 msgid "" "If *typed* is set to true, function arguments of different types will be " "cached separately. If *typed* is false, the implementation will usually " "regard them as equivalent calls and only cache a single result. (Some types " "such as *str* and *int* may be cached separately even when *typed* is false.)" msgstr "" +"*typed* を真にすると、型の異なる関数の引数は別々にキャッシュされます。\n" +"*typed* が偽の場合、通常は同等の呼び出しとして扱われ、結果は 1 つだけキャッ" +"シュされます。\n" +"(*str* や *int* など、*typed* が偽でも別々にキャッシュされる型もあります。)" #: ../../library/functools.rst:191 msgid "" @@ -326,13 +347,15 @@ msgid "" "Fraction(42))`` are treated as equivalent." msgstr "" -#: ../../library/functools.rst:197 msgid "" "The wrapped function is instrumented with a :func:`!cache_parameters` " "function that returns a new :class:`dict` showing the values for *maxsize* " "and *typed*. This is for information purposes only. Mutating the values " "has no effect." msgstr "" +"ラップされた関数には、*maxsize* と *typed* の値を示す新しい :class:`dict` を" +"返す :func:`!cache_parameters` 関数が追加されます。\n" +"これは情報を得るためだけのもので、値を変更しても効果はありません。" #: ../../library/functools.rst:202 msgid "" @@ -353,29 +376,30 @@ msgstr "" "このデコレータは、キャッシュの削除と無効化のための :func:`cache_clear` 関数も" "提供します。" -#: ../../library/functools.rst:210 msgid "" "The original underlying function is accessible through the :attr:" "`__wrapped__` attribute. This is useful for introspection, for bypassing " "the cache, or for rewrapping the function with a different cache." msgstr "" -"元々の基底の関数には、 :attr:`__wrapped__` 属性を通してアクセスできます。これ" -"はキャッシュを回避して、または関数を別のキャッシュでラップして、内観するのに" -"便利です。" +"ラップされた元の関数には :attr:`__wrapped__` 属性でアクセスできます。\n" +"これは内観やキャッシュの回避、別のキャッシュによる関数のラップし直しに便利で" +"す。" -#: ../../library/functools.rst:214 msgid "" "The cache keeps references to the arguments and return values until they age " "out of the cache or until the cache is cleared." msgstr "" +"引数と戻り値への参照は、古くなってキャッシュから削除されるか、キャッシュが消" +"去されるまで保持されます。" -#: ../../library/functools.rst:217 msgid "" "If a method is cached, the ``self`` instance argument is included in the " "cache. See :ref:`faq-cache-method-calls`" msgstr "" +"メソッドをキャッシュする場合、インスタンスの引数 ``self`` もキャッシュに含ま" +"れます。\n" +":ref:`faq-cache-method-calls` を参照してください。" -#: ../../library/functools.rst:220 msgid "" "An `LRU (least recently used) cache `_ works best when the " @@ -384,8 +408,13 @@ msgid "" "cache's size limit assures that the cache does not grow without bound on " "long-running processes such as web servers." msgstr "" +"`LRU (least recently used) キャッシュ `_ は、最近の呼び出しか" +"ら今後の呼び出しをよく予測できる場合に最も効果を発揮します (例えば、ニュース" +"サーバーで人気の記事は日ごとに変わる傾向があります)。\n" +"キャッシュのサイズ制限により、ウェブサーバーなど長時間実行するプロセスでも" +"キャッシュが際限なく増えることを防ぎます。" -#: ../../library/functools.rst:227 msgid "" "In general, the LRU cache should only be used when you want to reuse " "previously computed values. Accordingly, it doesn't make sense to cache " @@ -393,12 +422,16 @@ msgid "" "objects on each call (such as generators and async functions), or impure " "functions such as time() or random()." msgstr "" +"一般に LRU キャッシュは、以前計算した値を再利用したい場合にのみ使ってくださ" +"い。\n" +"したがって、副作用のある関数、呼び出すたびに別のミュータブルなオブジェクトを" +"作る必要のある関数 (ジェネレータや非同期関数など)、time() や random() のよう" +"な純粋でない関数をキャッシュしても意味がありません。" #: ../../library/functools.rst:233 msgid "Example of an LRU cache for static web content::" msgstr "静的 web コンテンツ の LRU キャッシュの例::" -#: ../../library/functools.rst:235 msgid "" "@lru_cache(maxsize=32)\n" "def get_pep(num):\n" @@ -417,6 +450,22 @@ msgid "" ">>> get_pep.cache_info()\n" "CacheInfo(hits=3, misses=8, maxsize=32, currsize=8)" msgstr "" +"@lru_cache(maxsize=32)\n" +"def get_pep(num):\n" +" 'Python Enhancement Proposal のテキストを取得する'\n" +" resource = f'https://peps.python.org/pep-{num:04d}'\n" +" try:\n" +" with urllib.request.urlopen(resource) as s:\n" +" return s.read()\n" +" except urllib.error.HTTPError:\n" +" return 'Not Found'\n" +"\n" +">>> for n in 8, 290, 308, 320, 8, 218, 320, 279, 289, 320, 9991:\n" +"... pep = get_pep(n)\n" +"... print(n, len(pep))\n" +"\n" +">>> get_pep.cache_info()\n" +"CacheInfo(hits=3, misses=8, maxsize=32, currsize=8)" #: ../../library/functools.rst:252 msgid "" @@ -428,7 +477,6 @@ msgstr "" "の技法を実装し、`フィボナッチ数 `_ を効率よく計算する例::" -#: ../../library/functools.rst:258 msgid "" "@lru_cache(maxsize=None)\n" "def fib(n):\n" @@ -442,6 +490,17 @@ msgid "" ">>> fib.cache_info()\n" "CacheInfo(hits=28, misses=16, maxsize=None, currsize=16)" msgstr "" +"@lru_cache(maxsize=None)\n" +"def fib(n):\n" +" if n < 2:\n" +" return n\n" +" return fib(n-1) + fib(n-2)\n" +"\n" +">>> [fib(n) for n in range(16)]\n" +"[0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610]\n" +"\n" +">>> fib.cache_info()\n" +"CacheInfo(hits=28, misses=16, maxsize=None, currsize=16)" #: ../../library/functools.rst:272 msgid "Added the *typed* option." @@ -451,9 +510,8 @@ msgstr "*typed* オプションが追加されました。" msgid "Added the *user_function* option." msgstr "*user_function* オプションが追加されました。" -#: ../../library/functools.rst:278 msgid "Added the function :func:`!cache_parameters`" -msgstr "" +msgstr ":func:`!cache_parameters` 関数が追加されました。" #: ../../library/functools.rst:283 msgid "" @@ -475,7 +533,6 @@ msgstr "" "`__ge__` の中からどれか1つと、 :meth:`__eq__` メソッドを定義する必要がありま" "す。" -#: ../../library/functools.rst:293 msgid "" "@total_ordering\n" "class Student:\n" @@ -493,6 +550,21 @@ msgid "" " return ((self.lastname.lower(), self.firstname.lower()) <\n" " (other.lastname.lower(), other.firstname.lower()))" msgstr "" +"@total_ordering\n" +"class Student:\n" +" def _is_valid_operand(self, other):\n" +" return (hasattr(other, \"lastname\") and\n" +" hasattr(other, \"firstname\"))\n" +" def __eq__(self, other):\n" +" if not self._is_valid_operand(other):\n" +" return NotImplemented\n" +" return ((self.lastname.lower(), self.firstname.lower()) ==\n" +" (other.lastname.lower(), other.firstname.lower()))\n" +" def __lt__(self, other):\n" +" if not self._is_valid_operand(other):\n" +" return NotImplemented\n" +" return ((self.lastname.lower(), self.firstname.lower()) <\n" +" (other.lastname.lower(), other.firstname.lower()))" #: ../../library/functools.rst:311 msgid "" @@ -509,25 +581,30 @@ msgstr "" "つの拡張比較メソッドをすべて実装すれば、簡単にスピードアップを図れるでしょ" "う。" -#: ../../library/functools.rst:320 msgid "" "This decorator makes no attempt to override methods that have been declared " "in the class *or its superclasses*. Meaning that if a superclass defines a " "comparison operator, *total_ordering* will not implement it again, even if " "the original method is abstract." msgstr "" +"このデコレータは、クラス *またはそのスーパークラス* で宣言されているメソッド" +"をオーバーライドしません。\n" +"つまり、スーパークラスが比較演算子を定義している場合は、元のメソッドが抽象メ" +"ソッドであっても *total_ordering* はそれを再実装しません。" -#: ../../library/functools.rst:327 msgid "" "Returning ``NotImplemented`` from the underlying comparison function for " "unrecognised types is now supported." msgstr "" +"認識できない型に対して、元の比較関数が ``NotImplemented`` を返すことをサポー" +"トしました。" -#: ../../library/functools.rst:333 msgid "" "A singleton object used as a sentinel to reserve a place for positional " "arguments when calling :func:`partial` and :func:`partialmethod`." msgstr "" +":func:`partial` や :func:`partialmethod` の呼び出し時に、位置引数の場所を確保" +"するための番兵として使うシングルトンオブジェクトです。" #: ../../library/functools.rst:341 msgid "" @@ -544,7 +621,6 @@ msgstr "" "は、それらで *keywords* を拡張または上書きします。おおよそ次のコードと等価で" "す::" -#: ../../library/functools.rst:348 msgid "" "def partial(func, /, *args, **keywords):\n" " def newfunc(*more_args, **more_keywords):\n" @@ -554,8 +630,14 @@ msgid "" " newfunc.keywords = keywords\n" " return newfunc" msgstr "" +"def partial(func, /, *args, **keywords):\n" +" def newfunc(*more_args, **more_keywords):\n" +" return func(*args, *more_args, **(keywords | more_keywords))\n" +" newfunc.func = func\n" +" newfunc.args = args\n" +" newfunc.keywords = keywords\n" +" return newfunc" -#: ../../library/functools.rst:356 msgid "" "The :func:`!partial` function is used for partial function application which " "\"freezes\" some portion of a function's arguments and/or keywords resulting " @@ -563,16 +645,24 @@ msgid "" "can be used to create a callable that behaves like the :func:`int` function " "where the *base* argument defaults to ``2``:" msgstr "" +":func:`!partial` 関数は関数の部分適用に使います。\n" +"関数の位置引数やキーワード引数の一部を「固定」し、より単純なシグネチャの新し" +"いオブジェクトを作ります。\n" +"例えば :func:`partial` を使うと、*base* 引数のデフォルトが ``2`` である点を除" +"いて :func:`int` 関数と同じように動作する、呼び出し可能オブジェクトを作れま" +"す。" -#: ../../library/functools.rst:362 msgid "" ">>> basetwo = partial(int, base=2)\n" ">>> basetwo.__doc__ = 'Convert base 2 string to an int.'\n" ">>> basetwo('10010')\n" "18" msgstr "" +">>> basetwo = partial(int, base=2)\n" +">>> basetwo.__doc__ = '2 進数の文字列を int に変換する。'\n" +">>> basetwo('10010')\n" +"18" -#: ../../library/functools.rst:369 msgid "" "If :data:`Placeholder` sentinels are present in *args*, they will be filled " "first when :func:`!partial` is called. This makes it possible to pre-fill " @@ -580,26 +670,37 @@ msgid "" "Placeholder`, only the chosen number of leading positional arguments can be " "pre-filled." msgstr "" +"*args* に :data:`Placeholder` の番兵が含まれている場合、:func:`!partial` の呼" +"び出し時にはその位置が先に埋められます。\n" +"これにより、:func:`!partial` の呼び出しで任意の位置引数をあらかじめ埋められま" +"す。\n" +":data:`!Placeholder` がなければ、先頭から指定した個数の位置引数しか埋められま" +"せん。" -#: ../../library/functools.rst:374 msgid "" "If any :data:`!Placeholder` sentinels are present, all must be filled at " "call time:" msgstr "" +":data:`!Placeholder` の番兵が含まれる場合、呼び出し時にすべてを埋める必要があ" +"ります。" -#: ../../library/functools.rst:376 msgid "" ">>> say_to_world = partial(print, Placeholder, Placeholder, \"world!\")\n" ">>> say_to_world('Hello', 'dear')\n" "Hello dear world!" msgstr "" +">>> say_to_world = partial(print, Placeholder, Placeholder, \"world!\")\n" +">>> say_to_world('Hello', 'dear')\n" +"Hello dear world!" -#: ../../library/functools.rst:382 msgid "" "Calling ``say_to_world('Hello')`` raises a :exc:`TypeError`, because only " "one positional argument is provided, but there are two placeholders that " "must be filled in." msgstr "" +"``say_to_world('Hello')`` を呼び出すと :exc:`TypeError` を送出します。\n" +"埋めるべきプレースホルダーが 2 つあるのに、位置引数が 1 つしか渡されていない" +"ためです。" #: ../../library/functools.rst:386 msgid "" @@ -609,7 +710,6 @@ msgid "" "`!Placeholder` sentinel to the place held by a previous :data:`!Placeholder`:" msgstr "" -#: ../../library/functools.rst:392 msgid "" ">>> from functools import partial, Placeholder as _\n" ">>> remove = partial(str.replace, _, _, '')\n" @@ -623,16 +723,27 @@ msgid "" ">>> remove_first_dear(message)\n" "'Hello, dear world!'" msgstr "" +">>> from functools import partial, Placeholder as _\n" +">>> remove = partial(str.replace, _, _, '')\n" +">>> message = 'Hello, dear dear world!'\n" +">>> remove(message, ' dear')\n" +"'Hello, world!'\n" +">>> remove_dear = partial(remove, _, ' dear')\n" +">>> remove_dear(message)\n" +"'Hello, world!'\n" +">>> remove_first_dear = partial(remove_dear, _, 1)\n" +">>> remove_first_dear(message)\n" +"'Hello, dear world!'" -#: ../../library/functools.rst:406 msgid "" ":data:`!Placeholder` cannot be passed to :func:`!partial` as a keyword " "argument." msgstr "" +":data:`!Placeholder` をキーワード引数として :func:`!partial` に渡すことはでき" +"ません。" -#: ../../library/functools.rst:408 msgid "Added support for :data:`Placeholder` in positional arguments." -msgstr "" +msgstr "位置引数での :data:`Placeholder` のサポートが追加されました。" #: ../../library/functools.rst:413 msgid "" @@ -665,7 +776,6 @@ msgstr "" "ンスタンスなど) の場合、 ``__get__`` への呼び出しは下層の記述子に委譲され、返" "り値として適切な :ref:`partial オブジェクト` が返されます。" -#: ../../library/functools.rst:426 msgid "" "When *func* is a non-descriptor callable, an appropriate bound method is " "created dynamically. This behaves like a normal Python function when used as " @@ -673,13 +783,12 @@ msgid "" "argument, even before the *args* and *keywords* supplied to the :class:" "`partialmethod` constructor." msgstr "" -"*func* が記述子以外の呼び出し可能オブジェクトである場合、適切な束縛メソッドが" -"動的に作成されます。この func は、メソッドとして使用された場合、Python の通常" -"の関数と同様に動作します。 :class:`partialmethod` コンストラクタに *args* と " -"*keywords* が渡されるよりも前に、 *self* 引数が最初の位置引数として挿入されま" -"す。" +"*func* が記述子ではない呼び出し可能オブジェクトの場合、適切な束縛メソッドを動" +"的に作成します。\n" +"これは通常の Python 関数をメソッドとして使う場合と同じように動作します。\n" +"*self* 引数は、:class:`partialmethod` コンストラクタに渡した *args* や " +"*keywords* よりも前に、最初の位置引数として挿入されます。" -#: ../../library/functools.rst:434 msgid "" ">>> class Cell:\n" "... def __init__(self):\n" @@ -699,8 +808,24 @@ msgid "" ">>> c.alive\n" "True" msgstr "" +">>> class Cell:\n" +"... def __init__(self):\n" +"... self._alive = False\n" +"... @property\n" +"... def alive(self):\n" +"... return self._alive\n" +"... def set_state(self, state):\n" +"... self._alive = bool(state)\n" +"... set_alive = partialmethod(set_state, True)\n" +"... set_dead = partialmethod(set_state, False)\n" +"...\n" +">>> c = Cell()\n" +">>> c.alive\n" +"False\n" +">>> c.set_alive()\n" +">>> c.alive\n" +"True" -#: ../../library/functools.rst:457 msgid "" "Apply *function* of two arguments cumulatively to the items of *iterable*, " "from left to right, so as to reduce the iterable to a single value. For " @@ -712,6 +837,16 @@ msgid "" "*initial* is not given and *iterable* contains only one item, the first item " "is returned." msgstr "" +"2 つの引数を取る *function* を、*iterable* の要素に左から右へ累積的に適用し、" +"単一の値にまとめます。\n" +"例えば ``reduce(lambda x, y: x+y, [1, 2, 3, 4, 5])`` は " +"``((((1+2)+3)+4)+5)`` を計算します。\n" +"左の引数 *x* は累積した値、右の引数 *y* は *iterable* から得た、更新に使う値" +"です。\n" +"省略可能な *initial* を指定すると、計算時に ``iterable`` の要素より前に置か" +"れ、``iterable`` が空の場合のデフォルト値にもなります。\n" +"*initial* を指定せず、*iterable* に要素が 1 つしかない場合は、その要素を返し" +"ます。" #: ../../library/functools.rst:466 msgid "Roughly equivalent to::" @@ -740,9 +875,8 @@ msgstr "" "全ての中間値を返すイテレータについては :func:`itertools.accumulate` を参照し" "てください。" -#: ../../library/functools.rst:483 msgid "*initial* is now supported as a keyword argument." -msgstr "" +msgstr "*initial* をキーワード引数として指定できるようになりました。" #: ../../library/functools.rst:488 msgid "" @@ -752,14 +886,15 @@ msgstr "" "関数を :term:`シングルディスパッチ ` :term:`ジェネリック関" "数 ` に変換します。" -#: ../../library/functools.rst:491 msgid "" "To define a generic function, decorate it with the ``@singledispatch`` " "decorator. When defining a function using ``@singledispatch``, note that the " "dispatch happens on the type of the first argument::" msgstr "" +"ジェネリック関数を定義するには、``@singledispatch`` デコレータを付けます。\n" +"``@singledispatch`` で関数を定義する場合、ディスパッチは最初の引数の型に基づ" +"く点に注意してください。 ::" -#: ../../library/functools.rst:495 msgid "" ">>> from functools import singledispatch\n" ">>> @singledispatch\n" @@ -768,6 +903,12 @@ msgid "" "... print(\"Let me just say,\", end=\" \")\n" "... print(arg)" msgstr "" +">>> from functools import singledispatch\n" +">>> @singledispatch\n" +"... def fun(arg, verbose=False):\n" +"... if verbose:\n" +"... print(\"Let me just say,\", end=\" \")\n" +"... print(arg)" #: ../../library/functools.rst:502 msgid "" @@ -781,7 +922,6 @@ msgstr "" "型アノテーションが付いている関数については、このデコレータは1つ目の引数の型を" "自動的に推測します。" -#: ../../library/functools.rst:507 msgid "" ">>> @fun.register\n" "... def _(arg: int, verbose=False):\n" @@ -796,12 +936,22 @@ msgid "" "... for i, elem in enumerate(arg):\n" "... print(i, elem)" msgstr "" +">>> @fun.register\n" +"... def _(arg: int, verbose=False):\n" +"... if verbose:\n" +"... print(\"Strength in numbers, eh?\", end=\" \")\n" +"... print(arg)\n" +"...\n" +">>> @fun.register\n" +"... def _(arg: list, verbose=False):\n" +"... if verbose:\n" +"... print(\"Enumerate this:\")\n" +"... for i, elem in enumerate(arg):\n" +"... print(i, elem)" -#: ../../library/functools.rst:520 msgid ":class:`typing.Union` can also be used::" -msgstr "" +msgstr ":class:`typing.Union` も使えます。 ::" -#: ../../library/functools.rst:522 msgid "" ">>> @fun.register\n" "... def _(arg: int | float, verbose=False):\n" @@ -818,6 +968,20 @@ msgid "" "... print(i, elem)\n" "..." msgstr "" +">>> @fun.register\n" +"... def _(arg: int | float, verbose=False):\n" +"... if verbose:\n" +"... print(\"Strength in numbers, eh?\", end=\" \")\n" +"... print(arg)\n" +"...\n" +">>> from typing import Union\n" +">>> @fun.register\n" +"... def _(arg: Union[list, set], verbose=False):\n" +"... if verbose:\n" +"... print(\"Enumerate this:\")\n" +"... for i, elem in enumerate(arg):\n" +"... print(i, elem)\n" +"..." #: ../../library/functools.rst:537 msgid "" @@ -827,7 +991,6 @@ msgstr "" "型アノテーションを使っていないコードについては、デコレータに適切な型引数を明" "示的に渡せます::" -#: ../../library/functools.rst:540 msgid "" ">>> @fun.register(complex)\n" "... def _(arg, verbose=False):\n" @@ -836,16 +999,23 @@ msgid "" "... print(arg.real, arg.imag)\n" "..." msgstr "" +">>> @fun.register(complex)\n" +"... def _(arg, verbose=False):\n" +"... if verbose:\n" +"... print(\"Better than complicated.\", end=\" \")\n" +"... print(arg.real, arg.imag)\n" +"..." -#: ../../library/functools.rst:547 msgid "" "For code that dispatches on a collections type (e.g., ``list``), but wants " "to typehint the items of the collection (e.g., ``list[int]``), the dispatch " "type should be passed explicitly to the decorator itself with the typehint " "going into the function definition::" msgstr "" +"コレクションの型 (例: ``list``) に基づいてディスパッチし、その要素には型ヒン" +"ト (例: ``list[int]``) を付けたい場合は、ディスパッチに使う型をデコレータに明" +"示的に渡し、型ヒントは関数定義に記述してください。 ::" -#: ../../library/functools.rst:552 msgid "" ">>> @fun.register(list)\n" "... def _(arg: list[int], verbose=False):\n" @@ -854,14 +1024,25 @@ msgid "" "... for i, elem in enumerate(arg):\n" "... print(i, elem)" msgstr "" +">>> @fun.register(list)\n" +"... def _(arg: list[int], verbose=False):\n" +"... if verbose:\n" +"... print(\"Enumerate this:\")\n" +"... for i, elem in enumerate(arg):\n" +"... print(i, elem)" -#: ../../library/functools.rst:561 msgid "" "At runtime the function will dispatch on an instance of a list regardless of " "the type contained within the list i.e. ``[1,2,3]`` will be dispatched the " "same as ``[\"foo\", \"bar\", \"baz\"]``. The annotation provided in this " "example is for static type checkers only and has no runtime impact." msgstr "" +"実行時には、リストに含まれる要素の型に関係なく、リストのインスタンスに対して" +"同じ実装を選びます。\n" +"つまり、``[1,2,3]`` と ``[\"foo\", \"bar\", \"baz\"]`` は同じようにディスパッ" +"チされます。\n" +"この例のアノテーションは静的型チェッカーのためだけのもので、実行時には影響し" +"ません。" #: ../../library/functools.rst:567 msgid "" @@ -871,13 +1052,16 @@ msgstr "" ":func:`register` 属性を関数形式で使用すると、:term:`lambda` 関数と既存の関数" "の登録を有効にできます::" -#: ../../library/functools.rst:570 msgid "" ">>> def nothing(arg, verbose=False):\n" "... print(\"Nothing.\")\n" "...\n" ">>> fun.register(type(None), nothing)" msgstr "" +">>> def nothing(arg, verbose=False):\n" +"... print(\"Nothing.\")\n" +"...\n" +">>> fun.register(type(None), nothing)" #: ../../library/functools.rst:575 msgid "" @@ -889,7 +1073,6 @@ msgstr "" "り、複層デコレータ、デコレータの :mod:`pickle 化 `、各変数の独立なユ" "ニットテストの作成が可能です::" -#: ../../library/functools.rst:579 msgid "" ">>> @fun.register(float)\n" "... @fun.register(Decimal)\n" @@ -901,6 +1084,15 @@ msgid "" ">>> fun_num is fun\n" "False" msgstr "" +">>> @fun.register(float)\n" +"... @fun.register(Decimal)\n" +"... def fun_num(arg, verbose=False):\n" +"... if verbose:\n" +"... print(\"Half of your number:\", end=\" \")\n" +"... print(arg / 2)\n" +"...\n" +">>> fun_num is fun\n" +"False" #: ../../library/functools.rst:589 msgid "" @@ -908,7 +1100,6 @@ msgid "" "argument::" msgstr "汎用関数は、呼び出されると 1 つ目の引数の型でディスパッチします::" -#: ../../library/functools.rst:592 msgid "" ">>> fun(\"Hello, world.\")\n" "Hello, world.\n" @@ -927,8 +1118,23 @@ msgid "" ">>> fun(1.23)\n" "0.615" msgstr "" +">>> fun(\"Hello, world.\")\n" +"Hello, world.\n" +">>> fun(\"test.\", verbose=True)\n" +"Let me just say, test.\n" +">>> fun(42, verbose=True)\n" +"Strength in numbers, eh? 42\n" +">>> fun(['spam', 'spam', 'eggs', 'spam'], verbose=True)\n" +"Enumerate this:\n" +"0 spam\n" +"1 spam\n" +"2 eggs\n" +"3 spam\n" +">>> fun(None)\n" +"Nothing.\n" +">>> fun(1.23)\n" +"0.615" -#: ../../library/functools.rst:609 msgid "" "Where there is no registered implementation for a specific type, its method " "resolution order is used to find a more generic implementation. The original " @@ -936,10 +1142,11 @@ msgid "" "class:`object` type, which means it is used if no better implementation is " "found." msgstr "" -"特定の型について登録された実装が存在しない場合、その型のメソッド解決順序が、" -"汎用の実装をさらに検索するために使用されます。``@singledispatch`` でデコレー" -"トされた元の関数は基底の :class:`object` 型に登録されます。これは、他によりよ" -"い実装が見つからないことを意味します。" +"特定の型に対する実装が登録されていない場合、その型のメソッド解決順序に従っ" +"て、より汎用的な実装を探します。\n" +"``@singledispatch`` でデコレートした元の関数は、基底型 :class:`object` に対す" +"る実装として登録されます。\n" +"そのため、より適切な実装が見つからなければ元の関数が使われます。" #: ../../library/functools.rst:615 msgid "" @@ -950,7 +1157,6 @@ msgstr "" "抽象基底クラス (:term:`abstract base class`) に対して実装が登録されると、基底" "クラスの仮想サブクラスに対してもその実装がディスパッチされます::" -#: ../../library/functools.rst:619 msgid "" ">>> from collections.abc import Mapping\n" ">>> @fun.register\n" @@ -963,6 +1169,16 @@ msgid "" ">>> fun({\"a\": \"b\"})\n" "a => b" msgstr "" +">>> from collections.abc import Mapping\n" +">>> @fun.register\n" +"... def _(arg: Mapping, verbose=False):\n" +"... if verbose:\n" +"... print(\"Keys & Values\")\n" +"... for key, value in arg.items():\n" +"... print(key, \"=>\", value)\n" +"...\n" +">>> fun({\"a\": \"b\"})\n" +"a => b" #: ../../library/functools.rst:630 msgid "" @@ -1027,7 +1243,6 @@ msgid "" "argument::" msgstr "" -#: ../../library/functools.rst:670 msgid "" "class Negator:\n" " @singledispatchmethod\n" @@ -1042,6 +1257,18 @@ msgid "" " def _(self, arg: bool):\n" " return not arg" msgstr "" +"class Negator:\n" +" @singledispatchmethod\n" +" def neg(self, arg):\n" +" raise NotImplementedError(\"Cannot negate a\")\n" +"\n" +" @neg.register\n" +" def _(self, arg: int):\n" +" return -arg\n" +"\n" +" @neg.register\n" +" def _(self, arg: bool):\n" +" return not arg" #: ../../library/functools.rst:683 msgid "" @@ -1057,7 +1284,6 @@ msgstr "" "でなければなりません。この ``Negator`` クラスの例では、クラスのインスタンスに" "ではなく、クラスに ``neg`` メソッドが紐付きます::" -#: ../../library/functools.rst:689 msgid "" "class Negator:\n" " @singledispatchmethod\n" @@ -1075,6 +1301,21 @@ msgid "" " def _(cls, arg: bool):\n" " return not arg" msgstr "" +"class Negator:\n" +" @singledispatchmethod\n" +" @classmethod\n" +" def neg(cls, arg):\n" +" raise NotImplementedError(\"Cannot negate a\")\n" +"\n" +" @neg.register\n" +" @classmethod\n" +" def _(cls, arg: int):\n" +" return -arg\n" +"\n" +" @neg.register\n" +" @classmethod\n" +" def _(cls, arg: bool):\n" +" return not arg" #: ../../library/functools.rst:705 msgid "" @@ -1086,7 +1327,6 @@ msgstr "" "`@staticmethod`, :func:`@abstractmethod` な" "ど。" -#: ../../library/functools.rst:714 msgid "" "Update a *wrapper* function to look like the *wrapped* function. The " "optional arguments are tuples to specify which attributes of the original " @@ -1101,6 +1341,17 @@ msgid "" "the wrapper function's :attr:`~function.__dict__`, i.e. the instance " "dictionary)." msgstr "" +"*wrapper* 関数を更新し、*wrapped* 関数と同じ属性を持つようにします。\n" +"省略可能な引数はタプルで、元の関数のどの属性をラッパー関数の同名の属性に直接" +"代入するか、またラッパー関数のどの属性を元の関数の同名の属性で更新するかを指" +"定します。\n" +"これらの引数のデフォルト値はモジュールレベルの定数 ``WRAPPER_ASSIGNMENTS`` " +"と ``WRAPPER_UPDATES`` です。\n" +"前者はラッパー関数の :attr:`~function.__module__`、:attr:`~function." +"__name__`、:attr:`~function.__qualname__`、:attr:`~function." +"__annotations__`、:attr:`~function.__type_params__`、およびドキュメンテーショ" +"ン文字列 :attr:`~function.__doc__` に代入し、後者は :attr:`~function." +"__dict__` (インスタンスの辞書) を更新します。" #: ../../library/functools.rst:726 msgid "" @@ -1140,27 +1391,30 @@ msgstr "" "とは試みられません)。しかし、 *updated* で指名された属性がラッパー関数自身に" "存在しないなら :exc:`AttributeError` が送出されます。" -#: ../../library/functools.rst:743 msgid "" "The ``__wrapped__`` attribute is now automatically added. The :attr:" "`~function.__annotations__` attribute is now copied by default. Missing " "attributes no longer trigger an :exc:`AttributeError`." msgstr "" +"``__wrapped__`` 属性が自動的に追加されるようになりました。\n" +":attr:`~function.__annotations__` 属性がデフォルトでコピーされるようになりま" +"した。\n" +"属性が欠けていても :exc:`AttributeError` を送出しなくなりました。" -#: ../../library/functools.rst:748 msgid "" "The ``__wrapped__`` attribute now always refers to the wrapped function, " "even if that function defined a ``__wrapped__`` attribute. (see :issue:" "`17482`)" msgstr "" -"ラップされた関数が ``__wrapped__`` を定義していない場合でも、 " -"``__wrapped__`` が常にラップされた関数を参照するようになりました。(:issue:" -"`17482` を参照)" +"ラップされた関数が ``__wrapped__`` を定義している場合でも、 ``__wrapped__`` " +"が常にラップされた関数を参照するようになりました。\n" +"(:issue:`17482` を参照)" -#: ../../library/functools.rst:753 msgid "" "The :attr:`~function.__type_params__` attribute is now copied by default." msgstr "" +":attr:`~function.__type_params__` 属性がデフォルトでコピーされるようになりま" +"した。" #: ../../library/functools.rst:759 msgid "" @@ -1173,7 +1427,6 @@ msgstr "" "して呼び出す便宜関数です。これは ``partial(update_wrapper, wrapped=wrapped, " "assigned=assigned, updated=updated)`` と等価です。例えば::" -#: ../../library/functools.rst:764 msgid "" ">>> from functools import wraps\n" ">>> def my_decorator(f):\n" @@ -1196,6 +1449,26 @@ msgid "" ">>> example.__doc__\n" "'Docstring'" msgstr "" +">>> from functools import wraps\n" +">>> def my_decorator(f):\n" +"... @wraps(f)\n" +"... def wrapper(*args, **kwds):\n" +"... print('Calling decorated function')\n" +"... return f(*args, **kwds)\n" +"... return wrapper\n" +"...\n" +">>> @my_decorator\n" +"... def example():\n" +"... \"\"\"Docstring\"\"\"\n" +"... print('Called example function')\n" +"...\n" +">>> example()\n" +"Calling decorated function\n" +"Called example function\n" +">>> example.__name__\n" +"'example'\n" +">>> example.__doc__\n" +"'Docstring'" #: ../../library/functools.rst:785 msgid "" @@ -1242,7 +1515,6 @@ msgid "" msgstr "" ":class:`partial` オブジェクトの呼び出し時に渡されるキーワード引数です。" -#: ../../library/functools.rst:816 msgid "" ":class:`partial` objects are like :ref:`function objects ` in that they are callable, weak referenceable, and can have " @@ -1250,3 +1522,8 @@ msgid "" "`~definition.__name__` and :attr:`~definition.__doc__` attributes are not " "created automatically." msgstr "" +":class:`partial` オブジェクトは、呼び出し可能で、弱参照でき、属性を持てるとい" +"う点で :ref:`関数オブジェクト ` に似ています。\n" +"ただし重要な違いもあります。\n" +"例えば :attr:`~definition.__name__` と :attr:`~definition.__doc__` 属性は自動" +"的には作成されません。" diff --git a/library/gc.po b/library/gc.po index 78c5d3b1e..a7bbd0227 100644 --- a/library/gc.po +++ b/library/gc.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: Arihiro TAKASE, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/gc.rst:2 @@ -103,15 +103,15 @@ msgstr "" "れます。 :class:`float` など、実装によって幾つかの free list では全ての要素が" "解放されるわけではありません。" -#: ../../library/gc.rst:60 msgid "" "The effect of calling ``gc.collect()`` while the interpreter is already " "performing a collection is undefined." msgstr "" +"インタープリタがすでに回収を行っている間に ``gc.collect()`` を呼び出した場合" +"の動作は未定義です。" -#: ../../library/gc.rst:63 msgid "``generation=1`` performs an increment of collection." -msgstr "" +msgstr "``generation=1`` は回収を段階的に進めるようになりました。" #: ../../library/gc.rst:69 msgid "" @@ -150,17 +150,15 @@ msgstr "" msgid "New *generation* parameter." msgstr "新しい *generation* パラメータ。" -#: ../../library/gc.rst:92 msgid "Generation 1 is removed" -msgstr "" +msgstr "世代 1 が削除されました。" -#: ../../library/gc.rst:95 msgid "" "Raises an :ref:`auditing event ` ``gc.get_objects`` with argument " "``generation``." msgstr "" "引数 ``generation`` で :ref:`監査イベント ` ``gc.get_objects`` を送" -"出します。 " +"出します。" #: ../../library/gc.rst:99 msgid "" @@ -241,9 +239,8 @@ msgid "" "garbage_collector>`_ for more information." msgstr "" -#: ../../library/gc.rst:145 msgid "*threshold2* is ignored" -msgstr "" +msgstr "*threshold2* が無視されるようになりました。" #: ../../library/gc.rst:151 msgid "" @@ -294,15 +291,13 @@ msgstr "" "ある場合があるので、利用する際には注意が必要です。 :func:`get_referrers` をデ" "バッグ以外の目的で利用するのは避けてください。" -#: ../../library/gc.rst:179 msgid "" "Raises an :ref:`auditing event ` ``gc.get_referrers`` with " "argument ``objs``." msgstr "" "引数 ``objs`` を指定して :ref:`監査イベント ` ``gc.get_referrers`` " -"を送出します。 " +"を送出します。" -#: ../../library/gc.rst:184 msgid "" "Return a list of objects directly referred to by any of the arguments. The " "referents returned are those objects visited by the arguments' C-level :c:" @@ -313,22 +308,22 @@ msgid "" "example, if an integer is directly reachable from an argument, that integer " "object may or may not appear in the result list." msgstr "" -"引数で指定したオブジェクトのいずれかから参照されている、全てのオブジェクトの" -"リストを返します。参照先のオブジェクトは、引数で指定したオブジェクトの Cレベ" -"ルメソッド :c:member:`~PyTypeObject.tp_traverse` で取得し、全てのオブジェクト" -"が直接到達可能な全てのオブジェクトを返すわけではありません。 :c:member:" -"`~PyTypeObject.tp_traverse` はガベージコレクションをサポートするオブジェクト" -"のみが実装しており、ここで取得できるオブジェクトは循環参照の一部となる可能性" -"のあるオブジェクトのみです。従って、例えば整数オブジェクトが直接到達可能で" -"あっても、このオブジェクトは戻り値には含まれません。" +"引数のいずれかから直接参照されているオブジェクトのリストを返します。\n" +"返される参照先は、各引数の C レベルの :c:member:`~PyTypeObject.tp_traverse` " +"メソッド (存在する場合) がたどったオブジェクトであり、実際に直接到達できるオ" +"ブジェクトがすべて含まれるとは限りません。\n" +":c:member:`~PyTypeObject.tp_traverse` メソッドをサポートするのはガベージコレ" +"クションをサポートするオブジェクトだけで、循環参照に関与し得るオブジェクトだ" +"けをたどることが要求されます。\n" +"例えば、引数から整数オブジェクトに直接到達できる場合、その整数が結果のリスト" +"に含まれることも、含まれないこともあります。" -#: ../../library/gc.rst:192 msgid "" "Raises an :ref:`auditing event ` ``gc.get_referents`` with " "argument ``objs``." msgstr "" "引数 ``objs`` を指定して :ref:`監査イベント ` ``gc.get_referents`` " -"を送出します。 " +"を送出します。" #: ../../library/gc.rst:196 msgid "" @@ -362,13 +357,13 @@ msgid "" "True" msgstr "" -#: ../../library/gc.rst:219 msgid "" "Returns ``True`` if the given object has been finalized by the garbage " "collector, ``False`` otherwise. ::" msgstr "" +"指定したオブジェクトがガベージコレクタによってファイナライズ済みの場合は " +"``True``、そうでなければ ``False`` を返します。 ::" -#: ../../library/gc.rst:222 msgid "" ">>> x = None\n" ">>> class Lazarus:\n" @@ -383,14 +378,26 @@ msgid "" ">>> gc.is_finalized(x)\n" "True" msgstr "" +">>> x = None\n" +">>> class Lazarus:\n" +"... def __del__(self):\n" +"... global x\n" +"... x = self\n" +"...\n" +">>> lazarus = Lazarus()\n" +">>> gc.is_finalized(lazarus)\n" +"False\n" +">>> del lazarus\n" +">>> gc.is_finalized(x)\n" +"True" -#: ../../library/gc.rst:240 msgid "" "Freeze all the objects tracked by the garbage collector; move them to a " "permanent generation and ignore them in all the future collections." msgstr "" +"ガベージコレクタが追跡しているすべてのオブジェクトを凍結します。\n" +"これらのオブジェクトは永続世代に移され、以降のすべての回収で無視されます。" -#: ../../library/gc.rst:243 msgid "" "If a process will ``fork()`` without ``exec()``, avoiding unnecessary copy-" "on-write in child processes will maximize memory sharing and reduce overall " @@ -401,6 +408,14 @@ msgid "" "early in the parent process, ``gc.freeze()`` right before ``fork()``, and " "``gc.enable()`` early in child processes." msgstr "" +"プロセスが ``exec()`` を行わずに ``fork()`` する場合、子プロセスで不要なコ" +"ピーオンライトを避けることで、メモリ共有を最大限に活用し、全体のメモリ使用量" +"を減らせます。\n" +"そのためには、親プロセスのメモリページ内に解放済みの「穴」ができることを避け" +"るとともに、子プロセスの GC が、親プロセス由来の長寿命オブジェクトの " +"``gc_refs`` カウンタに触れないようにする必要があります。\n" +"両方を実現するには、親プロセスの早い段階で ``gc.disable()``、``fork()`` の直" +"前に ``gc.freeze()``、子プロセスの早い段階で ``gc.enable()`` を呼び出します。" #: ../../library/gc.rst:257 msgid "" @@ -414,13 +429,12 @@ msgstr "" msgid "Return the number of objects in the permanent generation." msgstr "Permanent世代領域にあるオブジェクトの数を返します。" -#: ../../library/gc.rst:270 msgid "" "The following variables are provided for read-only access (you can mutate " "the values but should not rebind them):" msgstr "" -"以下の変数は読み出し専用アクセスのために提供されています。(この変数を操作する" -"ことはできますが、その値は記憶されません):" +"以下の変数は読み出し専用で提供されます (参照先の値を変更することはできます" +"が、変数に別の値を再代入すべきではありません):" #: ../../library/gc.rst:275 msgid "" @@ -454,11 +468,12 @@ msgstr "" "す。 :const:`DEBUG_UNCOLLECTABLE` がセットされていると、加えて回収不能オブ" "ジェクトを出力します。" -#: ../../library/gc.rst:289 msgid "" "Following :pep:`442`, objects with a :meth:`~object.__del__` method don't " "end up in :data:`gc.garbage` anymore." msgstr "" +":pep:`442` に従い、:meth:`~object.__del__` メソッドを持つオブジェクトが :" +"data:`gc.garbage` に入らなくなりました。" #: ../../library/gc.rst:295 msgid "" diff --git a/library/getopt.po b/library/getopt.po index ae5857d10..b248d091b 100644 --- a/library/getopt.po +++ b/library/getopt.po @@ -16,21 +16,19 @@ msgstr "" "Last-Translator: tomo, 2021\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" -#: ../../library/getopt.rst:2 msgid ":mod:`!getopt` --- C-style parser for command line options" -msgstr "" +msgstr ":mod:`!getopt` --- C 形式のコマンドラインオプション解析" #: ../../library/getopt.rst:8 msgid "**Source code:** :source:`Lib/getopt.py`" msgstr "**ソースコード:** :source:`Lib/getopt.py`" -#: ../../library/getopt.rst:12 msgid "" "This module is considered feature complete. A more declarative and " "extensible alternative to this API is provided in the :mod:`optparse` " @@ -38,8 +36,12 @@ msgid "" "processing are provided either as third party modules on PyPI, or else as " "features in the :mod:`argparse` module." msgstr "" +"このモジュールは機能が完成したものとされています。\n" +"この API より宣言的で拡張しやすい代替手段として、:mod:`optparse` モジュールが" +"あります。\n" +"コマンドライン引数処理のさらなる機能拡張は、PyPI のサードパーティーモジュール" +"か、:mod:`argparse` モジュールの機能として提供されます。" -#: ../../library/getopt.rst:20 msgid "" "This module helps scripts to parse the command line arguments in ``sys." "argv``. It supports the same conventions as the Unix :c:func:`!getopt` " @@ -47,8 +49,13 @@ msgid "" "and '``--``'). Long options similar to those supported by GNU software may " "be used as well via an optional third argument." msgstr "" +"このモジュールは、スクリプトで ``sys.argv`` のコマンドライン引数を解析する際" +"に役立ちます。\n" +"Unix の :c:func:`!getopt` 関数と同じ規則をサポートします (引数 \"``-``\" と " +"\"``--``\" の特別な意味も含みます)。\n" +"省略可能な第 3 引数により、GNU ソフトウェアがサポートするものと同様の長形式の" +"オプションも使えます。" -#: ../../library/getopt.rst:26 msgid "" "Users who are unfamiliar with the Unix :c:func:`!getopt` function should " "consider using the :mod:`argparse` module instead. Users who are familiar " @@ -57,12 +64,17 @@ msgid "" "should consider using the :mod:`optparse` module. See :ref:`choosing-an-" "argument-parser` for additional details." msgstr "" +"Unix の :c:func:`!getopt` 関数に不慣れな場合は、代わりに :mod:`argparse` モ" +"ジュールの使用を検討してください。\n" +"Unix の :c:func:`!getopt` 関数に慣れていて、同等の動作をより少ないコードで実" +"現し、より適切なヘルプやエラーメッセージを得たい場合は、:mod:`optparse` モ" +"ジュールの使用を検討してください。\n" +"詳しくは :ref:`choosing-an-argument-parser` を参照してください。" #: ../../library/getopt.rst:33 msgid "This module provides two functions and an exception:" msgstr "このモジュールは2つの関数と1つの例外を提供しています:" -#: ../../library/getopt.rst:39 msgid "" "Parses command line options and parameter list. *args* is the argument list " "to be parsed, without the leading reference to the running program. " @@ -72,15 +84,24 @@ msgid "" "argument followed by two colons (``'::'``); i.e., the same format that Unix :" "c:func:`!getopt` uses." msgstr "" +"コマンドラインのオプションと引数のリストを解析します。\n" +"*args* は解析する引数のリストで、先頭にある実行中のプログラムを示す要素は除き" +"ます。\n" +"通常は ``sys.argv[1:]`` です。\n" +"*shortopts* はスクリプトが認識するオプションの文字を並べた文字列です。\n" +"引数が必須のオプションの後ろにはコロン (``':'``) を 1 つ、省略可能な引数を取" +"るオプションの後ろには 2 つ (``'::'``) 付けます。\n" +"これは Unix の :c:func:`!getopt` が使うのと同じ形式です。" -#: ../../library/getopt.rst:48 msgid "" "Unlike GNU :c:func:`!getopt`, after a non-option argument, all further " "arguments are considered also non-options. This is similar to the way non-" "GNU Unix systems work." msgstr "" +"GNU の :c:func:`!getopt` とは異なり、オプションでない引数が現れると、それ以降" +"のすべての引数もオプションではないものとして扱います。\n" +"これは GNU 以外の Unix システムと同様の動作です。" -#: ../../library/getopt.rst:52 msgid "" "*longopts*, if specified, must be a list of strings with the names of the " "long options which should be supported. The leading ``'--'`` characters " @@ -94,6 +115,17 @@ msgid "" "fo`` will match as ``--foo``, but ``--f`` will not match uniquely, so :exc:" "`GetoptError` will be raised." msgstr "" +"*longopts* を指定する場合は、サポートする長形式のオプション名を文字列のリスト" +"として渡してください。\n" +"オプション名には先頭の ``'--'`` を含めません。\n" +"引数が必須の長形式オプションの後ろには等号 (``'='``) を、省略可能な引数を取る" +"ものには等号と疑問符 (``'=?'``) を付けます。\n" +"長形式のオプションだけを受け付けるには、*shortopts* を空文字列にします。\n" +"コマンドライン上の長形式オプションは、その名前の先頭部分だけでも、受け付ける" +"オプションのうちちょうど 1 つに一致すれば認識されます。\n" +"例えば *longopts* が ``['foo', 'frob']`` の場合、``--fo`` は ``--foo`` として" +"認識されますが、``--f`` は一意に決まらないため :exc:`GetoptError` を送出しま" +"す。" #: ../../library/getopt.rst:65 msgid "" @@ -116,9 +148,8 @@ msgstr "" "順に並んでいて、複数回同じオプションを指定できます。長形式と短形式のオプショ" "ンは混在できます。" -#: ../../library/getopt.rst:75 msgid "Optional arguments are supported." -msgstr "" +msgstr "省略可能な引数がサポートされました。" #: ../../library/getopt.rst:81 msgid "" @@ -132,14 +163,15 @@ msgstr "" "混在させることができます。:func:`getopt` 関数はオプションでない引数を見つける" "と解析を停止します。" -#: ../../library/getopt.rst:86 msgid "" "If the first character of the option string is ``'+'``, or if the " "environment variable :envvar:`!POSIXLY_CORRECT` is set, then option " "processing stops as soon as a non-option argument is encountered." msgstr "" +"オプション文字列の最初の文字が ``'+'`` の場合、または環境変数 :envvar:`!" +"POSIXLY_CORRECT` が設定されている場合は、オプションでない引数が現れた時点でオ" +"プションの処理を停止します。" -#: ../../library/getopt.rst:90 msgid "" "If the first character of the option string is ``'-'``, non-option arguments " "that are followed by options are added to the list of option-and-value pairs " @@ -147,13 +179,19 @@ msgid "" "arguments as its second element. The second element of the :func:`!" "gnu_getopt` result is a list of program arguments after the last option." msgstr "" +"オプション文字列の最初の文字が ``'-'`` の場合、後ろにオプションが続く非オプ" +"ション引数は、オプションと値のペアのリストに追加されます。\n" +"このペアの最初の要素は ``None``、2 番目の要素は非オプション引数のリストで" +"す。\n" +":func:`!gnu_getopt` の戻り値の 2 番目の要素は、最後のオプションより後にあるプ" +"ログラム引数のリストになります。" -#: ../../library/getopt.rst:97 msgid "" "Support for returning intermixed options and non-option arguments in order." msgstr "" +"混在するオプションと非オプション引数を順序どおりに返すことをサポートしまし" +"た。" -#: ../../library/getopt.rst:103 msgid "" "This is raised when an unrecognized option is found in the argument list or " "when an option requiring an argument is given none. The argument to the " @@ -163,6 +201,14 @@ msgid "" "give the error message and related option; if there is no specific option to " "which the exception relates, :attr:`!opt` is an empty string." msgstr "" +"引数リストに認識できないオプションがある場合、または必須の引数がオプションに" +"指定されていない場合に送出されます。\n" +"例外の引数はエラーの原因を示す文字列です。\n" +"長形式のオプションでは、引数を取らないオプションに引数が指定された場合もこの" +"例外を送出します。\n" +":attr:`!msg` と :attr:`!opt` 属性は、それぞれエラーメッセージと関連するオプ" +"ションを表します。\n" +"エラーに関連する特定のオプションがなければ、:attr:`!opt` は空文字列です。" #: ../../library/getopt.rst:114 msgid "Alias for :exc:`GetoptError`; for backward compatibility." @@ -173,7 +219,6 @@ msgstr "" msgid "An example using only Unix style options:" msgstr "Unix スタイルのオプションを使った例です:" -#: ../../library/getopt.rst:118 msgid "" ">>> import getopt\n" ">>> args = '-a -b -cfoo -d bar a1 a2'.split()\n" @@ -185,12 +230,20 @@ msgid "" ">>> args\n" "['a1', 'a2']" msgstr "" +">>> import getopt\n" +">>> args = '-a -b -cfoo -d bar a1 a2'.split()\n" +">>> args\n" +"['-a', '-b', '-cfoo', '-d', 'bar', 'a1', 'a2']\n" +">>> optlist, args = getopt.getopt(args, 'abc:d:')\n" +">>> optlist\n" +"[('-a', ''), ('-b', ''), ('-c', 'foo'), ('-d', 'bar')]\n" +">>> args\n" +"['a1', 'a2']" #: ../../library/getopt.rst:130 msgid "Using long option names is equally easy:" msgstr "長形式のオプションを使っても同様です:" -#: ../../library/getopt.rst:132 msgid "" ">>> s = '--condition=foo --testing --output-file abc.def -x a1 a2'\n" ">>> args = s.split()\n" @@ -205,12 +258,22 @@ msgid "" ">>> args\n" "['a1', 'a2']" msgstr "" +">>> s = '--condition=foo --testing --output-file abc.def -x a1 a2'\n" +">>> args = s.split()\n" +">>> args\n" +"['--condition=foo', '--testing', '--output-file', 'abc.def', '-x', 'a1', " +"'a2']\n" +">>> optlist, args = getopt.getopt(args, 'x', [\n" +"... 'condition=', 'output-file=', 'testing'])\n" +">>> optlist\n" +"[('--condition', 'foo'), ('--testing', ''), ('--output-file', 'abc.def'), ('-" +"x', '')]\n" +">>> args\n" +"['a1', 'a2']" -#: ../../library/getopt.rst:145 msgid "Optional arguments should be specified explicitly:" -msgstr "" +msgstr "省略可能な引数は、次のように明示的に指定してください。" -#: ../../library/getopt.rst:147 msgid "" ">>> s = '-Con -C --color=off --color a1 a2'\n" ">>> args = s.split()\n" @@ -222,12 +285,19 @@ msgid "" ">>> args\n" "['a1', 'a2']" msgstr "" +">>> s = '-Con -C --color=off --color a1 a2'\n" +">>> args = s.split()\n" +">>> args\n" +"['-Con', '-C', '--color=off', '--color', 'a1', 'a2']\n" +">>> optlist, args = getopt.getopt(args, 'C::', ['color=?'])\n" +">>> optlist\n" +"[('-C', 'on'), ('-C', ''), ('--color', 'off'), ('--color', '')]\n" +">>> args\n" +"['a1', 'a2']" -#: ../../library/getopt.rst:159 msgid "The order of options and non-option arguments can be preserved:" -msgstr "" +msgstr "オプションと非オプション引数の順序を保持できます。" -#: ../../library/getopt.rst:161 msgid "" ">>> s = 'a1 -x a2 a3 a4 --long a5 a6'\n" ">>> args = s.split()\n" @@ -239,12 +309,19 @@ msgid "" ">>> args\n" "['a6']" msgstr "" +">>> s = 'a1 -x a2 a3 a4 --long a5 a6'\n" +">>> args = s.split()\n" +">>> args\n" +"['a1', '-x', 'a2', 'a3', 'a4', '--long', 'a5', 'a6']\n" +">>> optlist, args = getopt.gnu_getopt(args, '-x:', ['long='])\n" +">>> optlist\n" +"[(None, ['a1']), ('-x', 'a2'), (None, ['a3', 'a4']), ('--long', 'a5')]\n" +">>> args\n" +"['a6']" -#: ../../library/getopt.rst:173 msgid "In a script, typical usage is something like this:" -msgstr "" +msgstr "スクリプトでの典型的な使用例は次のようになります。" -#: ../../library/getopt.rst:175 msgid "" "import getopt, sys\n" "\n" @@ -275,15 +352,42 @@ msgid "" "if __name__ == \"__main__\":\n" " main()" msgstr "" +"import getopt, sys\n" +"\n" +"def main():\n" +" try:\n" +" opts, args = getopt.getopt(sys.argv[1:], \"ho:v\", [\"help\", " +"\"output=\"])\n" +" except getopt.GetoptError as err:\n" +" # ヘルプ情報を表示して終了する:\n" +" print(err) # \"option -a not recognized\" などと表示する\n" +" usage()\n" +" sys.exit(2)\n" +" output = None\n" +" verbose = False\n" +" for o, a in opts:\n" +" if o == \"-v\":\n" +" verbose = True\n" +" elif o in (\"-h\", \"--help\"):\n" +" usage()\n" +" sys.exit()\n" +" elif o in (\"-o\", \"--output\"):\n" +" output = a\n" +" else:\n" +" assert False, \"unhandled option\"\n" +" process(args, output=output, verbose=verbose)\n" +"\n" +"if __name__ == \"__main__\":\n" +" main()" -#: ../../library/getopt.rst:204 msgid "" "Note that an equivalent command line interface could be produced with less " "code and more informative help and error messages by using the :mod:" "`optparse` module:" msgstr "" +":mod:`optparse` モジュールを使うと、同等のコマンドラインインターフェースをよ" +"り少ないコードで作成でき、ヘルプやエラーメッセージもより詳しくなります。" -#: ../../library/getopt.rst:207 msgid "" "import optparse\n" "\n" @@ -294,14 +398,22 @@ msgid "" " opts, args = parser.parse_args()\n" " process(args, output=opts.output, verbose=opts.verbose)" msgstr "" +"import optparse\n" +"\n" +"if __name__ == '__main__':\n" +" parser = optparse.OptionParser()\n" +" parser.add_option('-o', '--output')\n" +" parser.add_option('-v', dest='verbose', action='store_true')\n" +" opts, args = parser.parse_args()\n" +" process(args, output=opts.output, verbose=opts.verbose)" -#: ../../library/getopt.rst:218 msgid "" "A roughly equivalent command line interface for this case can also be " "produced by using the :mod:`argparse` module:" msgstr "" +"この場合は :mod:`argparse` モジュールを使っても、ほぼ同等のコマンドラインイン" +"ターフェースを作成できます。" -#: ../../library/getopt.rst:221 msgid "" "import argparse\n" "\n" @@ -313,26 +425,35 @@ msgid "" " args = parser.parse_args()\n" " process(args.rest, output=args.output, verbose=args.verbose)" msgstr "" +"import argparse\n" +"\n" +"if __name__ == '__main__':\n" +" parser = argparse.ArgumentParser()\n" +" parser.add_argument('-o', '--output')\n" +" parser.add_argument('-v', dest='verbose', action='store_true')\n" +" parser.add_argument('rest', nargs='*')\n" +" args = parser.parse_args()\n" +" process(args.rest, output=args.output, verbose=args.verbose)" -#: ../../library/getopt.rst:233 msgid "" "See :ref:`choosing-an-argument-parser` for details on how the ``argparse`` " "version of this code differs in behaviour from the ``optparse`` (and " "``getopt``) version." msgstr "" +"このコードの ``argparse`` 版と ``optparse`` (および ``getopt``) 版の動作の違" +"いについては、:ref:`choosing-an-argument-parser` を参照してください。" -#: ../../library/getopt.rst:239 msgid "Module :mod:`optparse`" -msgstr "" +msgstr ":mod:`optparse` モジュール" -#: ../../library/getopt.rst:240 msgid "Declarative command line option parsing." -msgstr "" +msgstr "宣言的なコマンドラインオプション解析。" #: ../../library/getopt.rst:242 msgid "Module :mod:`argparse`" msgstr ":mod:`argparse` モジュール" -#: ../../library/getopt.rst:243 msgid "More opinionated command line option and argument parsing library." msgstr "" +"コマンドラインのオプションと引数を、より明確な方針に沿って解析するライブラ" +"リ。" diff --git a/library/getpass.po b/library/getpass.po index 1a904b618..cb335a7e6 100644 --- a/library/getpass.po +++ b/library/getpass.po @@ -17,10 +17,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/getpass.rst:2 @@ -31,9 +31,8 @@ msgstr ":mod:`!getpass` --- 可搬性のあるパスワード入力機構" msgid "**Source code:** :source:`Lib/getpass.py`" msgstr "**ソースコード:** :source:`Lib/getpass.py`" -#: ../../includes/wasm-notavail.rst:3 msgid "Availability" -msgstr "" +msgstr "利用可能な環境" #: ../../includes/wasm-notavail.rst:5 msgid "" @@ -47,7 +46,6 @@ msgstr "" msgid "The :mod:`getpass` module provides two functions:" msgstr ":mod:`getpass` モジュールは二つの関数を提供します:" -#: ../../library/getpass.rst:21 msgid "" "Prompt the user for a password without echoing. The user is prompted using " "the string *prompt*, which defaults to ``'Password: '``. On Unix, the " @@ -56,12 +54,13 @@ msgid "" "dev/tty`) or if that is unavailable to ``sys.stderr`` (this argument is " "ignored on Windows)." msgstr "" -"エコーなしでユーザーにパスワードを入力させるプロンプト。ユーザーは *prompt* " -"の文字列をプロンプトに使え、デフォルトは ``'Password: '`` です。 Unixではプロ" -"ンプトはファイルに似たオブジェクト *stream* へ、必要なら置き換えられたエラー" -"ハンドラを使って出力されます。 *stream* のデフォルトは、制御端末(:file:`/dev/" -"tty`)か、それが利用できない場合は ``sys.stderr`` です (この引数は Windowsでは" -"無視されます)。" +"エコーなしでユーザーにパスワードを入力させるプロンプト。\n" +"ユーザーは *prompt* の文字列をプロンプトに使え、デフォルトは ``'Password: " +"'`` です。\n" +"Unixではプロンプトはファイルに似たオブジェクト *stream* へ、必要なら " +"``replace`` エラーハンドラを使って出力されます。\n" +"*stream* のデフォルトは、制御端末(:file:`/dev/tty`)か、それが利用できない場合" +"は ``sys.stderr`` です (この引数は Windowsでは無視されます)。" #: ../../library/getpass.rst:28 msgid "" @@ -82,23 +81,22 @@ msgstr "" "メッセージを出力し、 ``sys.stdin`` から読み込み、 :exc:`GetPassWarning` 警告" "を発生させます。" -#: ../../library/getpass.rst:39 msgid "" "If you call getpass from within IDLE, the input may be done in the terminal " "you launched IDLE from rather than the idle window itself." msgstr "" -"IDLE から getpass を呼び出した場合、入力はIDLEのウィンドウではなく、IDLE を起" -"動したターミナルから行われます。" +"IDLE 内から ``getpass()`` を呼び出すと、IDLE のウィンドウではなく、IDLE を起" +"動したターミナルで入力することになる場合があります。" -#: ../../library/getpass.rst:42 msgid "Added the *echo_char* parameter for keyboard feedback." msgstr "" +"キーボード入力に視覚的なフィードバックを与える *echo_char* 引数が追加されまし" +"た。" -#: ../../library/getpass.rst:47 msgid "A :exc:`UserWarning` subclass issued when password input may be echoed." msgstr "" -":exc:`UserWarning` のサブクラスで、入力がエコーされてしまった場合に発生しま" -"す。" +"パスワードの入力内容がエコーされる可能性がある場合に発行される、:exc:" +"`UserWarning` のサブクラスです。" #: ../../library/getpass.rst:52 msgid "Return the \"login name\" of the user." @@ -118,9 +116,8 @@ msgstr "" "ム上のパスワードデータベースから返します。それ以外の場合は、 :exc:" "`OSError` が送出されます。" -#: ../../library/getpass.rst:61 msgid "In general, this function should be preferred over :func:`os.getlogin`." -msgstr "" +msgstr "一般に、:func:`os.getlogin` よりもこの関数を使うことを推奨します。" #: ../../library/getpass.rst:63 msgid "Previously, various exceptions beyond just :exc:`OSError` were raised." diff --git a/library/gettext.po b/library/gettext.po index ae95c30fb..65ca1b84c 100644 --- a/library/gettext.po +++ b/library/gettext.po @@ -23,10 +23,10 @@ msgstr "" "Last-Translator: Takeshi Nakazato, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/gettext.rst:2 @@ -121,12 +121,15 @@ msgstr "" "場合には、グローバルドメインに *domain* を設定し、その設定されたグローバルド" "メインを返します。" -#: ../../library/gettext.rst:59 msgid "" "Return the localized translation of *message*, based on the current global " "domain, language, and locale directory. This function is usually aliased " "as :func:`!_` in the local namespace (see examples below)." msgstr "" +"現在のグローバルドメイン、言語、ロケールディレクトリに基づいて、*message* の" +"翻訳を返します。\n" +"通常、この関数はローカル名前空間で :func:`!_` という別名で使います (以下の例" +"を参照)。" #: ../../library/gettext.rst:66 msgid "" @@ -134,18 +137,17 @@ msgid "" msgstr "" ":func:`.gettext` と同様ですが、指定された *domain* からメッセージを探します。" -#: ../../library/gettext.rst:71 msgid "" "Like :func:`.gettext`, but consider plural forms. If a translation is found, " "apply the plural formula to *n*, and return the resulting message (some " "languages have more than two plural forms). If no translation is found, " "return *singular* if *n* is 1; return *plural* otherwise." msgstr "" -":func:`.gettext` と同様ですが、複数形を考慮しています。\n" -"翻訳が見つかった場合、複数形の選択公式を *n* に適用し、その結果得られたメッ" -"セージを返します (言語によっては二つ以上の複数形があります)。\n" -"翻訳が見つからなかった場合、 *n* が 1 なら *singular* を返します; そうでない" -"場合 *plural* を返します。" +":func:`.gettext` と同様ですが、複数形を考慮します。\n" +"翻訳が見つかった場合は、複数形の選択公式を *n* に適用し、その結果に対応する" +"メッセージを返します (言語によっては複数形が 3 種類以上あります)。\n" +"翻訳が見つからなかった場合は、*n* が 1 なら *singular*、それ以外なら " +"*plural* を返します。" #: ../../library/gettext.rst:76 msgid "" @@ -169,24 +171,26 @@ msgid "" msgstr "" ":func:`ngettext` と同様ですが、指定された *domain* からメッセージを探します。" -#: ../../library/gettext.rst:94 msgid "" "Similar to the corresponding functions without the ``p`` in the prefix (that " "is, :func:`gettext`, :func:`dgettext`, :func:`ngettext`, :func:`dngettext`), " "but the translation is restricted to the given message *context*." msgstr "" +"接頭辞 ``p`` のない対応する関数 (:func:`gettext`、:func:`dgettext`、:func:" +"`ngettext`、:func:`dngettext`) と同様ですが、翻訳対象が指定したメッセージの " +"*context* に限定されます。" -#: ../../library/gettext.rst:101 msgid "" "Note that GNU :program:`gettext` also defines a :func:`!dcgettext` method, " "but this was deemed not useful and so it is currently unimplemented." msgstr "" +"GNU :program:`gettext` は :func:`!dcgettext` メソッドも定義していますが、有用" +"ではないと判断されたため、現在は実装されていません。" #: ../../library/gettext.rst:104 msgid "Here's an example of typical usage for this API::" msgstr "以下にこの API の典型的な使用法を示します::" -#: ../../library/gettext.rst:106 msgid "" "import gettext\n" "gettext.bindtextdomain('myapplication', '/path/to/my/language/directory')\n" @@ -195,6 +199,12 @@ msgid "" "# ...\n" "print(_('This is a translatable string.'))" msgstr "" +"import gettext\n" +"gettext.bindtextdomain('myapplication', '/path/to/my/language/directory')\n" +"gettext.textdomain('myapplication')\n" +"_ = gettext.gettext\n" +"# ...\n" +"print(_('This is a translatable string.'))" #: ../../library/gettext.rst:115 msgid "Class-based API" @@ -238,35 +248,31 @@ msgstr "" "`LANGUAGE` 、 :envvar:`LC_ALL` 、 :envvar:`LC_MESSAGES` 、および :envvar:" "`LANG` が検索されます。空でない値を返した最初の候補が *languages* 変数として" "使われます。この環境変数は言語名をコロンで分かち書きしたリストを含んでいなけ" -"ればなりません。 :func:`find` はこの文字列をコロンで分割し、言語コードの候補" -"リストを生成します。" +"ればなりません。 ``find()`` はこの文字列をコロンで分割し、言語コードの候補リ" +"ストを生成します。" -#: ../../library/gettext.rst:140 msgid "" ":func:`find` then expands and normalizes the languages, and then iterates " "through them, searching for an existing file built of these components:" msgstr "" -":func:`find` は次に言語コードを展開および正規化し、リストの各要素について、以" -"下のパス構成:" +":func:`find` は言語コードを展開して正規化し、それらを順にたどりながら、次の要" +"素からなるパスにファイルが存在するか調べます。" #: ../../library/gettext.rst:143 msgid ":file:`{localedir}/{language}/LC_MESSAGES/{domain}.mo`" msgstr ":file:`{localedir}/{language}/LC_MESSAGES/{domain}.mo`" -#: ../../library/gettext.rst:145 msgid "" "The first such file name that exists is returned by :func:`find`. If no such " "file is found, then ``None`` is returned. If *all* is given, it returns a " "list of all file names, in the order in which they appear in the languages " "list or the environment variables." msgstr "" -"からなる実在するファイルの探索を反復的に行います。 :func:`find` は上記のよう" -"な実在するファイルで最初に見つかったものを返します。該当するファイルが見つか" -"らなかった場合、 ``None`` が返されます。 *all* が与えられていれば、全ファイル" -"名のリストが言語リストまたは環境変数で指定されている順番に並べられたものを返" -"します。" +":func:`find` は最初に見つかったファイル名を返します。\n" +"ファイルが見つからなければ ``None`` を返します。\n" +"*all* を指定した場合は、見つかったすべてのファイル名のリストを、言語リストま" +"たは環境変数での順序で返します。" -#: ../../library/gettext.rst:153 msgid "" "Return a ``*Translations`` instance based on the *domain*, *localedir*, and " "*languages*, which are first passed to :func:`find` to get a list of the " @@ -275,6 +281,15 @@ msgid "" "provided, otherwise :class:`GNUTranslations`. The class's constructor must " "take a single :term:`file object` argument." msgstr "" +"*domain*、*localedir*、*languages* に基づいて ``*Translations`` インスタンス" +"を返します。\n" +"これらの引数を最初に :func:`find` に渡し、関連する :file:`.mo` ファイルのパス" +"のリストを取得します。\n" +"同じ :file:`.mo` ファイル名を持つインスタンスはキャッシュされます。\n" +"実際にインスタンス化するクラスは、*class_* が指定されていればそのクラス、そう" +"でなければ :class:`GNUTranslations` です。\n" +"クラスのコンストラクタは :term:`file object` を引数として 1 つ受け取る必要が" +"あります。" #: ../../library/gettext.rst:160 msgid "" @@ -305,16 +320,16 @@ msgstr "" "以前は :exc:`IOError` が送出されました; それは現在 :exc:`OSError` のエイリア" "スです。" -#: ../../library/gettext.rst:172 msgid "*codeset* parameter is removed." -msgstr "" +msgstr "*codeset* 引数が削除されました。" -#: ../../library/gettext.rst:177 msgid "" "This installs the function :func:`!_` in Python's builtins namespace, based " "on *domain* and *localedir* which are passed to the function :func:" "`translation`." msgstr "" +"*domain* と *localedir* を :func:`translation` 関数に渡し、それに基づいて " +"Python の組み込み名前空間に :func:`!_` 関数をインストールします。" #: ../../library/gettext.rst:180 msgid "" @@ -324,27 +339,27 @@ msgstr "" "*names* パラメータについては、翻訳オブジェクトの :meth:`~NullTranslations." "install` メソッドの説明を参照ください。" -#: ../../library/gettext.rst:183 msgid "" "As seen below, you usually mark the strings in your application that are " "candidates for translation, by wrapping them in a call to the :func:`!_` " "function, like this::" msgstr "" +"以下のように、アプリケーションで翻訳候補の文字列をマークするには、通常 :func:" +"`!_` 関数の呼び出しで囲みます。 ::" -#: ../../library/gettext.rst:187 msgid "print(_('This string will be translated.'))" -msgstr "" +msgstr "print(_('This string will be translated.'))" -#: ../../library/gettext.rst:189 msgid "" "For convenience, you want the :func:`!_` function to be installed in " "Python's builtins namespace, so it is easily accessible in all modules of " "your application." msgstr "" +"アプリケーションのすべてのモジュールから簡単にアクセスできるように、:func:`!" +"_` 関数を Python の組み込み名前空間にインストールすると便利です。" -#: ../../library/gettext.rst:193 msgid "*names* is now a keyword-only parameter." -msgstr "" +msgstr "*names* がキーワード専用引数になりました。" #: ../../library/gettext.rst:197 msgid "The :class:`NullTranslations` class" @@ -443,11 +458,10 @@ msgstr "" "転送します。そうでない場合、翻訳されたメッセージを返します。派生クラスで上書" "きするメソッドです。" -#: ../../library/gettext.rst:260 msgid "" "Return a dictionary containing the metadata found in the message catalog " "file." -msgstr "" +msgstr "メッセージカタログファイルから取得したメタデータを含む辞書を返します。" #: ../../library/gettext.rst:266 msgid "Return the encoding of the message catalog file." @@ -461,15 +475,17 @@ msgstr "" "このメソッドは :meth:`.gettext` を組み込み名前空間にインストールし、変数 " "``_`` に束縛します。" -#: ../../library/gettext.rst:274 msgid "" "If the *names* parameter is given, it must be a sequence containing the " "names of functions you want to install in the builtins namespace in addition " "to :func:`!_`. Supported names are ``'gettext'``, ``'ngettext'``, " "``'pgettext'``, and ``'npgettext'``." msgstr "" +"*names* 引数を指定する場合は、:func:`!_` に加えて組み込み名前空間にインストー" +"ルする関数名のシーケンスを渡してください。\n" +"サポートされる名前は ``'gettext'``、``'ngettext'``、``'pgettext'``、" +"``'npgettext'`` です。" -#: ../../library/gettext.rst:279 msgid "" "Note that this is only one way, albeit the most convenient way, to make the :" "func:`!_` function available to your application. Because it affects the " @@ -477,19 +493,27 @@ msgid "" "localized modules should never install :func:`!_`. Instead, they should use " "this code to make :func:`!_` available to their module::" msgstr "" +"これは :func:`!_` 関数をアプリケーションで利用可能にする最も便利な方法です" +"が、唯一の方法ではありません。\n" +"アプリケーション全体、特に組み込み名前空間に影響するため、地域化したモジュー" +"ルでは決して :func:`!_` をインストールしないでください。\n" +"代わりに次のコードで、そのモジュール内で :func:`!_` を利用可能にします。 ::" -#: ../../library/gettext.rst:285 msgid "" "import gettext\n" "t = gettext.translation('mymodule', ...)\n" "_ = t.gettext" msgstr "" +"import gettext\n" +"t = gettext.translation('mymodule', ...)\n" +"_ = t.gettext" -#: ../../library/gettext.rst:289 msgid "" "This puts :func:`!_` only in the module's global namespace and so only " "affects calls within this module." msgstr "" +"これにより :func:`!_` はモジュールのグローバル名前空間だけに置かれるので、こ" +"のモジュール内の呼び出しにだけ影響します。" #: ../../library/gettext.rst:292 msgid "Added ``'pgettext'`` and ``'npgettext'``." @@ -499,15 +523,18 @@ msgstr "``'pgettext'`` と ``'npgettext'`` が追加されました。" msgid "The :class:`GNUTranslations` class" msgstr ":class:`GNUTranslations` クラス" -#: ../../library/gettext.rst:299 msgid "" "The :mod:`!gettext` module provides one additional class derived from :class:" "`NullTranslations`: :class:`GNUTranslations`. This class overrides :meth:`!" "_parse` to enable reading GNU :program:`gettext` format :file:`.mo` files in " "both big-endian and little-endian format." msgstr "" +":mod:`!gettext` モジュールは、:class:`NullTranslations` の派生クラスとして :" +"class:`GNUTranslations` も提供します。\n" +"このクラスは :meth:`!_parse` をオーバーライドし、ビッグエンディアンとリトルエ" +"ンディアンの両方の GNU :program:`gettext` 形式の :file:`.mo` ファイルを読み取" +"れるようにします。" -#: ../../library/gettext.rst:304 msgid "" ":class:`GNUTranslations` parses optional metadata out of the translation " "catalog. It is convention with GNU :program:`gettext` to include metadata as " @@ -519,18 +546,34 @@ msgid "" "then all message ids and message strings read from the catalog are converted " "to Unicode using this encoding, else ASCII is assumed." msgstr "" +":class:`GNUTranslations` は翻訳カタログから省略可能なメタデータを解析しま" +"す。\n" +"GNU :program:`gettext` では、空文字列の翻訳としてメタデータを格納する慣習があ" +"ります。\n" +"このメタデータは :rfc:`822` 形式の ``key: value`` ペアで、``Project-Id-" +"Version`` キーを含める必要があります。\n" +"``Content-Type`` キーがあれば、その ``charset`` プロパティを使って「保護され" +"た」インスタンス変数 :attr:`!_charset` を初期化します。\n" +"見つからなければデフォルトの ``None`` になります。\n" +"文字セットのエンコーディングが指定されていれば、カタログから読み取ったすべて" +"のメッセージ ID とメッセージ文字列をそのエンコーディングで Unicode に変換しま" +"す。\n" +"指定されていなければ ASCII と見なします。" -#: ../../library/gettext.rst:314 msgid "" "Since message ids are read as Unicode strings too, all ``*gettext()`` " "methods will assume message ids as Unicode strings, not byte strings." msgstr "" +"メッセージ ID も Unicode 文字列として読み取るため、すべての ``*gettext()`` メ" +"ソッドは、メッセージ ID がバイト文字列ではなく Unicode 文字列であることを前提" +"とします。" -#: ../../library/gettext.rst:317 msgid "" "The entire set of key/value pairs are placed into a dictionary and set as " "the \"protected\" :attr:`!_info` instance variable." msgstr "" +"キーと値のペア全体を辞書に格納し、「保護された」インスタンス変数 :attr:`!" +"_info` に設定します。" #: ../../library/gettext.rst:320 msgid "" @@ -548,7 +591,6 @@ msgid "" "The following methods are overridden from the base class implementation:" msgstr "以下のメソッドは基底クラスの実装からオーバライドされています:" -#: ../../library/gettext.rst:330 msgid "" "Look up the *message* id in the catalog and return the corresponding message " "string, as a Unicode string. If there is no entry in the catalog for the " @@ -556,22 +598,22 @@ msgid "" "fallback's :meth:`~NullTranslations.gettext` method. Otherwise, the " "*message* id is returned." msgstr "" -"カタログから *message* id を検索して、対応するメッセージ文字列を Unicode でエ" -"ンコードして返します。\n" +"カタログから *message* id を検索して、対応するメッセージ文字列を Unicode 文字" +"列として返します。\n" "*message* id に対応するエントリがカタログに存在せず、フォールバックが設定され" "ている場合、検索処理をフォールバックの :meth:`~NullTranslations.gettext` メ" "ソッドに移譲します。\n" "それ以外の場合は、 *message* id 自体が返されます。" -#: ../../library/gettext.rst:339 msgid "" "Do a plural-forms lookup of a message id. *singular* is used as the message " "id for purposes of lookup in the catalog, while *n* is used to determine " "which plural form to use. The returned message string is a Unicode string." msgstr "" -"メッセージ id に対する複数形を検索します。カタログに対する検索では " -"*singular* がメッセージ id として用いられ、 *n* にはどの複数形を用いるかを指" -"定します。返されるメッセージ文字列は Unicode 文字列です。" +"メッセージ ID に対して複数形の検索を行います。\n" +"カタログの検索では *singular* をメッセージ ID として使い、*n* をもとに使う複" +"数形を決定します。\n" +"返されるメッセージ文字列は Unicode 文字列です。" #: ../../library/gettext.rst:343 msgid "" @@ -590,7 +632,6 @@ msgstr "" msgid "Here is an example::" msgstr "以下に例を示します。::" -#: ../../library/gettext.rst:350 msgid "" "n = len(os.listdir('.'))\n" "cat = GNUTranslations(somefile)\n" @@ -599,8 +640,13 @@ msgid "" " 'There are %(num)d files in this directory',\n" " n) % {'num': n}" msgstr "" +"n = len(os.listdir('.'))\n" +"cat = GNUTranslations(somefile)\n" +"message = cat.ngettext(\n" +" 'There is %(num)d file in this directory',\n" +" 'There are %(num)d files in this directory',\n" +" n) % {'num': n}" -#: ../../library/gettext.rst:360 msgid "" "Look up the *context* and *message* id in the catalog and return the " "corresponding message string, as a Unicode string. If there is no entry in " @@ -608,21 +654,21 @@ msgid "" "the look up is forwarded to the fallback's :meth:`pgettext` method. " "Otherwise, the *message* id is returned." msgstr "" -"カタログから *context* と *message* id を検索して、対応するメッセージ文字列" -"を、 Unicode でエンコードして返します。 *message* id と *context* に対するエ" -"ントリがカタログに存在せず、フォールバックが設定されている場合、フォールバッ" -"ク検索はオブジェクトの :meth:`pgettext` メソッドに転送されます。そうでない場" -"合、 *message* id 自体が返されます。" +"カタログから *context* と *message* ID を検索し、対応するメッセージを " +"Unicode 文字列として返します。\n" +"*message* ID と *context* に対応するエントリがなく、フォールバックが設定され" +"ている場合は、そのフォールバックの :meth:`pgettext` メソッドに検索を委ねま" +"す。\n" +"そうでなければ *message* ID 自体を返します。" -#: ../../library/gettext.rst:371 msgid "" "Do a plural-forms lookup of a message id. *singular* is used as the message " "id for purposes of lookup in the catalog, while *n* is used to determine " "which plural form to use." msgstr "" -"メッセージ id に対する複数形を検索します。カタログに対する検索では " -"*singular* がメッセージ id として用いられ、 *n* にはどの複数形を用いるかを指" -"定します。" +"メッセージ ID に対して複数形の検索を行います。\n" +"カタログの検索では *singular* をメッセージ ID として使い、*n* をもとに使う複" +"数形を決定します。" #: ../../library/gettext.rst:375 msgid "" @@ -663,19 +709,23 @@ msgstr "" "を使っていますが、このバージョンは少し異なった API を持っています。ドキュメン" "トに書かれている利用法は::" -#: ../../library/gettext.rst:399 msgid "" "import gettext\n" "cat = gettext.Catalog(domain, localedir)\n" "_ = cat.gettext\n" "print(_('hello world'))" msgstr "" +"import gettext\n" +"cat = gettext.Catalog(domain, localedir)\n" +"_ = cat.gettext\n" +"print(_('hello world'))" -#: ../../library/gettext.rst:404 msgid "" "For compatibility with this older module, the function :func:`!Catalog` is " "an alias for the :func:`translation` function described above." msgstr "" +"この古いモジュールとの互換性のために、:func:`!Catalog` 関数は、上記の :func:" +"`translation` 関数の別名になっています。" #: ../../library/gettext.rst:407 msgid "" @@ -727,21 +777,28 @@ msgid "" msgstr "" "メッセージ文字列を適切に変換するために :mod:`gettext` モジュールを使います" -#: ../../library/gettext.rst:430 msgid "" "In order to prepare your code for I18N, you need to look at all the strings " "in your files. Any string that needs to be translated should be marked by " "wrapping it in ``_('...')`` --- that is, a call to the function :func:`_ " "`. For example::" msgstr "" +"コードを国際化に対応させるには、ファイル内のすべての文字列を調べる必要があり" +"ます。\n" +"翻訳が必要な文字列は ``_('...')``、つまり :func:`_ ` 関数の呼び出し" +"で囲んでマークしてください。\n" +"例えば次のようにします。 ::" -#: ../../library/gettext.rst:434 msgid "" "filename = 'mylog.txt'\n" "message = _('writing a log message')\n" "with open(filename, 'w') as fp:\n" " fp.write(message)" msgstr "" +"filename = 'mylog.txt'\n" +"message = _('writing a log message')\n" +"with open(filename, 'w') as fp:\n" +" fp.write(message)" #: ../../library/gettext.rst:439 msgid "" @@ -866,24 +923,30 @@ msgstr "" "`gettext` 形式で置かれているとします。この場合、モジュールの最初で以下のよう" "にします::" -#: ../../library/gettext.rst:496 msgid "" "import gettext\n" "t = gettext.translation('spam', '/usr/share/locale')\n" "_ = t.gettext" msgstr "" +"import gettext\n" +"t = gettext.translation('spam', '/usr/share/locale')\n" +"_ = t.gettext" #: ../../library/gettext.rst:502 msgid "Localizing your application" msgstr "アプリケーションを地域化する" -#: ../../library/gettext.rst:504 msgid "" "If you are localizing your application, you can install the :func:`!_` " "function globally into the built-in namespace, usually in the main driver " "file of your application. This will let all your application-specific files " "just use ``_('...')`` without having to explicitly install it in each file." msgstr "" +"アプリケーションを地域化する場合は、:func:`!_` 関数を組み込み名前空間にグロー" +"バルにインストールできます。\n" +"通常はアプリケーションのメインの実行ファイルで行います。\n" +"これにより、アプリケーション固有のすべてのファイルで、ファイルごとに明示的に" +"インストールせずに ``_('...')`` を使えます。" #: ../../library/gettext.rst:509 msgid "" @@ -893,25 +956,26 @@ msgstr "" "単純な場合では、単に以下の短いコードをアプリケーションの主ドライバファイルに" "追加するだけです::" -#: ../../library/gettext.rst:512 msgid "" "import gettext\n" "gettext.install('myapplication')" msgstr "" +"import gettext\n" +"gettext.install('myapplication')" -#: ../../library/gettext.rst:515 msgid "" "If you need to set the locale directory, you can pass it into the :func:" "`install` function::" msgstr "" -"ロケールの辞書を設定する必要がある場合、:func:`install` 関数に渡すことが出来" -"ます::" +"ロケールのディレクトリを設定する必要がある場合は、:func:`install` 関数に渡す" +"ことができます。 ::" -#: ../../library/gettext.rst:518 msgid "" "import gettext\n" "gettext.install('myapplication', '/usr/share/locale')" msgstr "" +"import gettext\n" +"gettext.install('myapplication', '/usr/share/locale')" #: ../../library/gettext.rst:523 msgid "Changing languages on the fly" @@ -927,7 +991,6 @@ msgstr "" "て、例えば以下のコードのように、インスタンスを明示的に切り替えてもかまいませ" "ん。::" -#: ../../library/gettext.rst:529 msgid "" "import gettext\n" "\n" @@ -944,6 +1007,20 @@ msgid "" "# ... more time goes by, user selects language 3\n" "lang3.install()" msgstr "" +"import gettext\n" +"\n" +"lang1 = gettext.translation('myapplication', languages=['en'])\n" +"lang2 = gettext.translation('myapplication', languages=['fr'])\n" +"lang3 = gettext.translation('myapplication', languages=['de'])\n" +"\n" +"# 最初は language1 を使う\n" +"lang1.install()\n" +"\n" +"# ... 時間がたち、ユーザーが言語 2 を選ぶ\n" +"lang2.install()\n" +"\n" +"# ... さらに時間がたち、ユーザーが言語 3 を選ぶ\n" +"lang3.install()" #: ../../library/gettext.rst:546 msgid "Deferred translations" @@ -960,7 +1037,6 @@ msgstr "" "が行われるように遅延させる必要が生じます。古典的な例は以下のようなコートで" "す::" -#: ../../library/gettext.rst:552 msgid "" "animals = ['mollusk',\n" " 'albatross',\n" @@ -971,6 +1047,14 @@ msgid "" "for a in animals:\n" " print(a)" msgstr "" +"animals = ['mollusk',\n" +" 'albatross',\n" +" 'rat',\n" +" 'penguin',\n" +" 'python', ]\n" +"# ...\n" +"for a in animals:\n" +" print(a)" #: ../../library/gettext.rst:561 msgid "" @@ -985,7 +1069,6 @@ msgstr "" msgid "Here is one way you can handle this situation::" msgstr "こうした状況を処理する一つの方法を以下に示します::" -#: ../../library/gettext.rst:567 msgid "" "def _(message): return message\n" "\n" @@ -1001,8 +1084,20 @@ msgid "" "for a in animals:\n" " print(_(a))" msgstr "" +"def _(message): return message\n" +"\n" +"animals = [_('mollusk'),\n" +" _('albatross'),\n" +" _('rat'),\n" +" _('penguin'),\n" +" _('python'), ]\n" +"\n" +"del _\n" +"\n" +"# ...\n" +"for a in animals:\n" +" print(_(a))" -#: ../../library/gettext.rst:581 msgid "" "This works because the dummy definition of :func:`!_` simply returns the " "string unchanged. And this dummy definition will temporarily override any " @@ -1010,19 +1105,25 @@ msgid "" "command). Take care, though if you have a previous definition of :func:`!_` " "in the local namespace." msgstr "" +":func:`!_` の仮の定義は文字列を変更せずに返すだけなので、この方法でうまくいき" +"ます。\n" +"この仮の定義は、組み込み名前空間にある :func:`!_` の定義を一時的に (:keyword:" +"`del` コマンドまで) 覆い隠します。\n" +"ただし、ローカル名前空間ですでに :func:`!_` を定義している場合には注意してく" +"ださい。" -#: ../../library/gettext.rst:587 msgid "" "Note that the second use of :func:`!_` will not identify \"a\" as being " "translatable to the :program:`gettext` program, because the parameter is not " "a string literal." msgstr "" +"2 回目の :func:`!_` の使用では、引数が文字列リテラルではないため、:program:" +"`gettext` プログラムは \"a\" を翻訳対象として認識しません。" #: ../../library/gettext.rst:591 msgid "Another way to handle this is with the following example::" msgstr "もう一つの処理法は、以下の例のようなやり方です::" -#: ../../library/gettext.rst:593 msgid "" "def N_(message): return message\n" "\n" @@ -1036,8 +1137,18 @@ msgid "" "for a in animals:\n" " print(_(a))" msgstr "" +"def N_(message): return message\n" +"\n" +"animals = [N_('mollusk'),\n" +" N_('albatross'),\n" +" N_('rat'),\n" +" N_('penguin'),\n" +" N_('python'), ]\n" +"\n" +"# ...\n" +"for a in animals:\n" +" print(_(a))" -#: ../../library/gettext.rst:605 msgid "" "In this case, you are marking translatable strings with the function :func:`!" "N_`, which won't conflict with any definition of :func:`!_`. However, you " @@ -1048,6 +1159,15 @@ msgid "" "totally arbitrary; it could have just as easily been :func:`!" "MarkThisStringForTranslation`." msgstr "" +"この場合は :func:`!N_` 関数で翻訳対象の文字列をマークするため、:func:`!_` の" +"定義と衝突しません。\n" +"ただし、メッセージ抽出プログラムに、:func:`!N_` でマークされた文字列を探すよ" +"う指定する必要があります。\n" +":program:`xgettext`、:program:`pygettext`、``pybabel extract``、:program:" +"`xpot` は、いずれも :option:`!-k` コマンドラインオプションでこの指定をサポー" +"トします。\n" +"ここで :func:`!N_` という名前を選んだことに特別な意味はありません。\n" +":func:`!MarkThisStringForTranslation` でも同様に使えます。" #: ../../library/gettext.rst:616 msgid "Acknowledgements" @@ -1098,7 +1218,6 @@ msgstr "Gustavo Niemeyer" msgid "Footnotes" msgstr "脚注" -#: ../../library/gettext.rst:639 msgid "" "The default locale directory is system dependent; for example, on Red Hat " "Linux it is :file:`/usr/share/locale`, but on Solaris it is :file:`/usr/lib/" @@ -1108,6 +1227,14 @@ msgid "" "call :func:`bindtextdomain` with an explicit absolute path at the start of " "your application." msgstr "" +"デフォルトのロケールディレクトリはシステムに依存します。\n" +"例えば Red Hat Linux では :file:`/usr/share/locale`、Solaris では :file:`/" +"usr/lib/locale` です。\n" +":mod:`!gettext` モジュールはこうしたシステムごとのデフォルト値には対応せず、" +"代わりに :file:`{sys.base_prefix}/share/locale` をデフォルトとして使います (:" +"data:`sys.base_prefix` を参照)。\n" +"このため、アプリケーションの開始時に明示的な絶対パスを指定して :func:" +"`bindtextdomain` を呼び出すのが最善です。" #: ../../library/gettext.rst:647 msgid "See the footnote for :func:`bindtextdomain` above." diff --git a/library/glob.po b/library/glob.po index 25320f12a..ea740625f 100644 --- a/library/glob.po +++ b/library/glob.po @@ -21,10 +21,10 @@ msgstr "" "Last-Translator: Takeshi Nakazato, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/glob.rst:2 @@ -137,21 +137,19 @@ msgstr "" "*include_hidden* が真の場合、パターン \"``**``\" は隠しディレクトリにマッチし" "ます。" -#: ../../library/glob.rst:71 ../../library/glob.rst:98 msgid "" "Raises an :ref:`auditing event ` ``glob.glob`` with arguments " "``pathname``, ``recursive``." msgstr "" "引数 ``pathname``, ``recursive`` を指定して :ref:`監査イベント ` " -"``glob.glob`` を送出します。 " +"``glob.glob`` を送出します。" -#: ../../library/glob.rst:72 ../../library/glob.rst:99 msgid "" "Raises an :ref:`auditing event ` ``glob.glob/2`` with arguments " "``pathname``, ``recursive``, ``root_dir``, ``dir_fd``." msgstr "" "引数 ``pathname``, ``recursive``, ``root_dir``, ``dir_fd`` を指定して :ref:`" -"監査イベント ` ``glob.glob/2`` を送出します。 " +"監査イベント ` ``glob.glob/2`` を送出します。" #: ../../library/glob.rst:75 msgid "" @@ -264,7 +262,6 @@ msgstr "" msgid "Examples" msgstr "使用例" -#: ../../library/glob.rst:167 msgid "" "Consider a directory containing the following files: :file:`1.gif`, :file:`2." "txt`, :file:`card.gif` and a subdirectory :file:`sub` which contains only " @@ -272,9 +269,9 @@ msgid "" "Notice how any leading components of the path are preserved. ::" msgstr "" "次のファイルを含むディレクトリを考えます: :file:`1.gif`, :file:`2.txt`, :" -"file:`card.gif` および:file:`3.txt` だけを含む :file:`sub` サブディレクトリ。" -"このとき、 :func:`glob` は以下の結果を返します。パスにおける先頭の要素がどの" -"ように保持されるかに注意してください::" +"file:`card.gif` および :file:`3.txt` だけを含む :file:`sub` サブディレクト" +"リ。このとき、 :func:`glob` は以下の結果を返します。パスにおける先頭の要素が" +"どのように保持されるかに注意してください::" #: ../../library/glob.rst:173 msgid "" diff --git a/library/graphlib.po b/library/graphlib.po index 61b00d2b5..44dedf886 100644 --- a/library/graphlib.po +++ b/library/graphlib.po @@ -20,10 +20,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/graphlib.rst:2 @@ -119,13 +119,16 @@ msgstr "" "すぐにグラフのノードをソートした結果が必要で、並行性が不要な場合、便利なメ" "ソッド :meth:`TopologicalSorter.static_order` を直接呼び出すことができます:" -#: ../../library/graphlib.rst:53 msgid "" ">>> graph = {\"D\": {\"B\", \"C\"}, \"C\": {\"A\"}, \"B\": {\"A\"}}\n" ">>> ts = TopologicalSorter(graph)\n" ">>> tuple(ts.static_order())\n" "('A', 'C', 'B', 'D')" msgstr "" +">>> graph = {\"D\": {\"B\", \"C\"}, \"C\": {\"A\"}, \"B\": {\"A\"}}\n" +">>> ts = TopologicalSorter(graph)\n" +">>> tuple(ts.static_order())\n" +"('A', 'C', 'B', 'D')" #: ../../library/graphlib.rst:60 msgid "" @@ -135,7 +138,6 @@ msgstr "" "このクラスは、簡単に準備が整ったノードの並列処理を行えるよう設計されていま" "す。例えば::" -#: ../../library/graphlib.rst:63 msgid "" "topological_sorter = TopologicalSorter()\n" "\n" @@ -159,6 +161,29 @@ msgid "" " node = finalized_tasks_queue.get()\n" " topological_sorter.done(node)" msgstr "" +"topological_sorter = TopologicalSorter()\n" +"\n" +"# 'topological_sorter' にノードを追加する...\n" +"\n" +"topological_sorter.prepare()\n" +"while topological_sorter.is_active():\n" +" for node in topological_sorter.get_ready():\n" +" # ワーカースレッドやプロセスが 'task_queue' キューから\n" +" # 処理するノードを取り出す。\n" +" task_queue.put(node)\n" +"\n" +" # ノードの処理が終わると、ワーカーはそのノードを\n" +" # 'finalized_tasks_queue' に入れる。\n" +" # それによって次の処理対象を得られる。\n" +" # 'is_active()' の定義により、この時点で 'task_queue' に入っていて\n" +" # まだ 'done()' に渡されていないノードが少なくとも 1 つある。\n" +" # したがって、ここでブロックする 'get()' は最終的には成功する。\n" +" # 'done()' の呼び出し後はループの先頭に戻り、再び 'get_ready()' を呼" +"ぶ。\n" +" # これにより、新たに処理可能になったノードを論理的に可能な限り早く\n" +" # 'task_queue' に入れられる。\n" +" node = finalized_tasks_queue.get()\n" +" topological_sorter.done(node)" #: ../../library/graphlib.rst:87 msgid "" @@ -176,13 +201,16 @@ msgstr "" "同じ node 引数で複数回呼び出した場合、依存関係の集合は、それまでに指定した依" "存関係の和集合になります。" -#: ../../library/graphlib.rst:93 msgid "" "It is possible to add a node with no dependencies (*predecessors* is not " "provided) or to provide a dependency twice. If a node that has not been " "provided before is included among *predecessors* it will be automatically " "added to the graph with no predecessors of its own." msgstr "" +"依存先のないノードを追加することも (*predecessors* を指定しない場合)、同じ依" +"存関係を 2 回指定することもできます。\n" +"*predecessors* に、まだ追加していないノードが含まれる場合、そのノードは自身の" +"先行ノードを持たないものとしてグラフに自動的に追加されます。" #: ../../library/graphlib.rst:98 msgid "" @@ -191,7 +219,6 @@ msgstr "" ":meth:`~TopologicalSorter.prepare` を呼び出した後にこのメソッドを呼び出す" "と、:exc:`ValueError` を送出します。" -#: ../../library/graphlib.rst:102 msgid "" "Mark the graph as finished and check for cycles in the graph. If any cycle " "is detected, :exc:`CycleError` will be raised, but :meth:`~TopologicalSorter." @@ -200,20 +227,28 @@ msgid "" "be modified, and therefore no more nodes can be added using :meth:" "`~TopologicalSorter.add`." msgstr "" +"グラフの構築を完了したものとして印を付け、閉路がないか調べます。\n" +"閉路が見つかると :exc:`CycleError` を送出しますが、:meth:`~TopologicalSorter." +"get_ready` は引き続き使えるため、閉路によってそれ以上進めなくなるまで可能な限" +"りノードを取得できます。\n" +"この関数を呼び出した後はグラフを変更できず、:meth:`~TopologicalSorter.add` で" +"ノードを追加することもできません。" -#: ../../library/graphlib.rst:109 msgid "" "A :exc:`ValueError` will be raised if the sort has been started by :meth:`~." "static_order` or :meth:`~.get_ready`." msgstr "" +":meth:`~.static_order` または :meth:`~.get_ready` によってソートが開始されて" +"いる場合は :exc:`ValueError` を送出します。" -#: ../../library/graphlib.rst:114 msgid "" "``prepare()`` can now be called more than once as long as the sort has not " "started. Previously this raised :exc:`ValueError`." msgstr "" +"ソートが開始されていなければ、``prepare()`` を複数回呼び出せるようになりまし" +"た。\n" +"以前は :exc:`ValueError` が送出されていました。" -#: ../../library/graphlib.rst:119 msgid "" "Returns ``True`` if more progress can be made and ``False`` otherwise. " "Progress can be made if cycles do not block the resolution and either there " @@ -222,28 +257,35 @@ msgid "" "`TopologicalSorter.done` is less than the number that have been returned by :" "meth:`TopologicalSorter.get_ready`." msgstr "" +"処理を進められる場合は ``True``、そうでなければ ``False`` を返します。\n" +"閉路によって処理が妨げられておらず、:meth:`TopologicalSorter.get_ready` がま" +"だ返していない処理可能なノードがあるか、:meth:`TopologicalSorter.done` で処理" +"済みとしたノード数が :meth:`TopologicalSorter.get_ready` の返したノード数より" +"少ない場合に、処理を進められます。" -#: ../../library/graphlib.rst:126 msgid "" "The :meth:`~object.__bool__` method of this class defers to this function, " "so instead of::" msgstr "" +"このクラスの :meth:`~object.__bool__` メソッドはこの関数に処理を委ねます。\n" +"そのため、次の書き方は置き換えられます。 ::" -#: ../../library/graphlib.rst:129 msgid "" "if ts.is_active():\n" " ..." msgstr "" +"if ts.is_active():\n" +" ..." -#: ../../library/graphlib.rst:132 msgid "it is possible to simply do::" -msgstr "このように簡単に記述できます:" +msgstr "次のように簡単に書けます。 ::" -#: ../../library/graphlib.rst:134 msgid "" "if ts:\n" " ..." msgstr "" +"if ts:\n" +" ..." #: ../../library/graphlib.rst:137 ../../library/graphlib.rst:160 msgid "" @@ -253,14 +295,17 @@ msgstr "" "前もって :meth:`~TopologicalSorter.prepare` を呼び出さずにこの関数を呼び出す" "と :exc:`ValueError` を送出します。" -#: ../../library/graphlib.rst:142 msgid "" "Marks a set of nodes returned by :meth:`TopologicalSorter.get_ready` as " "processed, unblocking any successor of each node in *nodes* for being " "returned in the future by a call to :meth:`TopologicalSorter.get_ready`." msgstr "" +":meth:`TopologicalSorter.get_ready` が返した一連のノードを処理済みとしま" +"す。\n" +"これにより、*nodes* の各ノードの後続ノードが、それ以降の :meth:" +"`TopologicalSorter.get_ready` の呼び出しで返されるための依存条件が解消されま" +"す。" -#: ../../library/graphlib.rst:146 msgid "" "Raises :exc:`ValueError` if any node in *nodes* has already been marked as " "processed by a previous call to this method or if a node was not added to " @@ -268,8 +313,12 @@ msgid "" "meth:`~TopologicalSorter.prepare` or if node has not yet been returned by :" "meth:`~TopologicalSorter.get_ready`." msgstr "" +"*nodes* のいずれかのノードが、このメソッドの以前の呼び出しですでに処理済みに" +"なっている場合や、:meth:`TopologicalSorter.add` でグラフに追加されていない場" +"合は :exc:`ValueError` を送出します。\n" +":meth:`~TopologicalSorter.prepare` を呼び出す前に呼び出した場合や、ノードがま" +"だ :meth:`~TopologicalSorter.get_ready` から返されていない場合も同様です。" -#: ../../library/graphlib.rst:154 msgid "" "Returns a ``tuple`` with all the nodes that are ready. Initially it returns " "all nodes with no predecessors, and once those are marked as processed by " @@ -277,16 +326,23 @@ msgid "" "nodes that have all their predecessors already processed. Once no more " "progress can be made, empty tuples are returned." msgstr "" +"処理の準備が整ったすべてのノードを ``tuple`` で返します。\n" +"最初は先行ノードのないすべてのノードを返します。\n" +"それらを :meth:`TopologicalSorter.done` で処理済みとすると、以降の呼び出しで" +"は、すべての先行ノードの処理が終わった新たなノードをすべて返します。\n" +"それ以上処理を進められなくなると、空のタプルを返します。" -#: ../../library/graphlib.rst:165 msgid "" "Returns an iterator object which will iterate over nodes in a topological " "order. When using this method, :meth:`~TopologicalSorter.prepare` and :meth:" "`~TopologicalSorter.done` should not be called. This method is equivalent " "to::" msgstr "" +"ノードをトポロジカル順序でたどるイテレータオブジェクトを返します。\n" +"このメソッドを使う場合は、:meth:`~TopologicalSorter.prepare` と :meth:" +"`~TopologicalSorter.done` を呼び出さないでください。\n" +"このメソッドは次と等価です。 ::" -#: ../../library/graphlib.rst:170 msgid "" "def static_order(self):\n" " self.prepare()\n" @@ -295,14 +351,21 @@ msgid "" " yield from node_group\n" " self.done(*node_group)" msgstr "" +"def static_order(self):\n" +" self.prepare()\n" +" while self.is_active():\n" +" node_group = self.get_ready()\n" +" yield from node_group\n" +" self.done(*node_group)" -#: ../../library/graphlib.rst:177 msgid "" "The particular order that is returned may depend on the specific order in " "which the items were inserted in the graph. For example:" msgstr "" +"返される具体的な順序は、グラフに要素を挿入した順序に依存する場合がありま" +"す。\n" +"例えば次のようになります。" -#: ../../library/graphlib.rst:180 msgid "" ">>> ts = TopologicalSorter()\n" ">>> ts.add(3, 2, 1)\n" @@ -316,18 +379,30 @@ msgid "" ">>> print([*ts2.static_order()])\n" "[0, 2, 1, 3]" msgstr "" +">>> ts = TopologicalSorter()\n" +">>> ts.add(3, 2, 1)\n" +">>> ts.add(1, 0)\n" +">>> print([*ts.static_order()])\n" +"[2, 0, 1, 3]\n" +"\n" +">>> ts2 = TopologicalSorter()\n" +">>> ts2.add(1, 0)\n" +">>> ts2.add(3, 2, 1)\n" +">>> print([*ts2.static_order()])\n" +"[0, 2, 1, 3]" -#: ../../library/graphlib.rst:194 msgid "" "This is due to the fact that \"0\" and \"2\" are in the same level in the " "graph (they would have been returned in the same call to :meth:" "`~TopologicalSorter.get_ready`) and the order between them is determined by " "the order of insertion." msgstr "" +"これは、\"0\" と \"2\" がグラフの同じ階層にあり (同じ :meth:" +"`~TopologicalSorter.get_ready` の呼び出しで返される)、両者の間の順序が挿入順" +"で決まるためです。" -#: ../../library/graphlib.rst:200 msgid "If any cycle is detected, :exc:`CycleError` will be raised." -msgstr "" +msgstr "閉路が見つかると :exc:`CycleError` を送出します。" #: ../../library/graphlib.rst:206 msgid "Exceptions" @@ -337,14 +412,17 @@ msgstr "例外" msgid "The :mod:`graphlib` module defines the following exception classes:" msgstr ":mod:`graphlib` モジュールは以下の例外クラスを定義します:" -#: ../../library/graphlib.rst:211 msgid "" "Subclass of :exc:`ValueError` raised by :meth:`TopologicalSorter.prepare` if " "cycles exist in the working graph. If multiple cycles exist, only one " "undefined choice among them will be reported and included in the exception." msgstr "" +"処理対象のグラフに閉路がある場合に :meth:`TopologicalSorter.prepare` が送出す" +"る、:exc:`ValueError` のサブクラスです。\n" +"閉路が複数ある場合は、そのうち 1 つだけが選ばれて報告され、例外に含まれま" +"す。\n" +"どれが選ばれるかは未定義です。" -#: ../../library/graphlib.rst:215 msgid "" "The detected cycle can be accessed via the second element in the :attr:" "`~BaseException.args` attribute of the exception instance and consists in a " @@ -352,3 +430,9 @@ msgid "" "predecessor of the next node in the list. In the reported list, the first " "and the last node will be the same, to make it clear that it is cyclic." msgstr "" +"検出された閉路には、例外インスタンスの :attr:`~BaseException.args` 属性の 2 " +"番目の要素からアクセスできます。\n" +"これはノードのリストで、各ノードはグラフ上でリストの次のノードの直接の先行" +"ノードになっています。\n" +"閉路であることが分かるように、報告されるリストの最初と最後のノードは同じで" +"す。" diff --git a/library/grp.po b/library/grp.po index 1624611dd..c4a2c4149 100644 --- a/library/grp.po +++ b/library/grp.po @@ -19,10 +19,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/grp.rst:2 @@ -37,9 +37,8 @@ msgstr "" "このモジュールでは Unix グループ (group) データベースへのアクセス機構を提供し" "ます。全ての Unix バージョンで利用可能です。" -#: ../../library/grp.rst:13 msgid "Availability" -msgstr "" +msgstr "利用可能な環境" #: ../../library/grp.rst:15 msgid "" @@ -156,9 +155,10 @@ msgstr "" "与えられたグループ名に対するグループデータベースエントリを返します。要求した" "エントリが見つからなかった場合、 :exc:`KeyError` が送出されます。" -#: ../../library/grp.rst:59 msgid "Return a list of all available group entries, in arbitrary order." -msgstr "全ての入手可能なグループエントリを返します。順番は決まっていません。" +msgstr "" +"利用可能なすべてのグループエントリーを、順序の決まっていないリストとして返し" +"ます。" #: ../../library/grp.rst:64 msgid "Module :mod:`pwd`" diff --git a/library/gzip.po b/library/gzip.po index 82363bdcf..a4acdfacf 100644 --- a/library/gzip.po +++ b/library/gzip.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/gzip.rst:2 @@ -142,20 +142,28 @@ msgstr " ``'x'``、``'xb'``、``'xt'`` モードのサポートが追加され msgid "Accepts a :term:`path-like object`." msgstr ":term:`path-like object` を受け入れるようになりました。" -#: ../../library/gzip.rst:64 msgid "" "An exception raised for invalid gzip files. It inherits from :exc:" "`OSError`. :exc:`EOFError` and :exc:`zlib.error` can also be raised for " "invalid gzip files." msgstr "" +"不正な gzip ファイルに対して送出される例外です。\n" +":exc:`OSError` を継承します。\n" +"不正な gzip ファイルに対しては :exc:`EOFError` や :exc:`zlib.error` が送出さ" +"れる場合もあります。" -#: ../../library/gzip.rst:72 msgid "" "Constructor for the :class:`GzipFile` class, which simulates most of the " "methods of a :term:`file object`, with the exception of the :meth:`~io." "IOBase.truncate` method. At least one of *fileobj* and *filename* must be " "given a non-trivial value." msgstr "" +":class:`GzipFile` クラスのコンストラクタです。\n" +"``GzipFile`` オブジェクトは :meth:`~io.IOBase.truncate` メソッドを除くほとん" +"どの :term:`ファイルオブジェクト ` のメソッドをシミュレートしま" +"す。\n" +"*fileobj* と *filename* の少なくとも一方には、有効な値を指定しなければなりま" +"せん。" #: ../../library/gzip.rst:77 msgid "" @@ -183,7 +191,6 @@ msgstr "" "認識可能な場合、規定値は *fileobj* のファイル名です。そうでない場合、規定値は" "空の文字列で、元のファイル名はヘッダにはインクルードされません。" -#: ../../library/gzip.rst:88 msgid "" "The *mode* argument can be any of ``'r'``, ``'rb'``, ``'a'``, ``'ab'``, " "``'w'``, ``'wb'``, ``'x'``, or ``'xb'``, depending on whether the file will " @@ -192,6 +199,12 @@ msgid "" "*fileobj* will not be used. It is better to always specify *mode* for " "writing." msgstr "" +"*mode* 引数には、読み取りか書き込みかに応じて ``'r'``、``'rb'``、``'a'``、" +"``'ab'``、``'w'``、``'wb'``、``'x'``、``'xb'`` のいずれかを指定できます。\n" +"デフォルトは、*fileobj* のモードが分かる場合はそのモード、そうでなければ " +"``'rb'`` です。\n" +"今後の Python のリリースでは *fileobj* のモードを使わなくなります。\n" +"書き込みの場合は、常に *mode* を指定することを推奨します。" #: ../../library/gzip.rst:94 msgid "" @@ -222,10 +235,10 @@ msgid "" "generate a compressed stream that does not depend on creation time." msgstr "" -#: ../../library/gzip.rst:108 msgid "" "See below for the :attr:`mtime` attribute that is set when decompressing." msgstr "" +"展開時に設定される :attr:`mtime` 属性については、以下を参照してください。" #: ../../library/gzip.rst:110 msgid "" @@ -235,6 +248,12 @@ msgid "" "writing as *fileobj*, and retrieve the resulting memory buffer using the :" "class:`io.BytesIO` object's :meth:`~io.BytesIO.getvalue` method." msgstr "" +"圧縮したデータの後ろにさらに何か追加したい場合もあるので、:class:`GzipFile` " +"オブジェクトの :meth:`!close` メソッド呼び出しは *fileobj* を閉じません。\n" +"このため、書き込みのためにオープンした :class:`io.BytesIO` オブジェクトを " +"*fileobj* として渡し、(``GzipFile`` を ``close()`` した後に) :class:`io." +"BytesIO` オブジェクトの :meth:`~io.BytesIO.getvalue` メソッドを使って書き込ん" +"だデータの入っているメモリバッファを取得することができます。" #: ../../library/gzip.rst:116 msgid "" @@ -242,16 +261,20 @@ msgid "" "including iteration and the :keyword:`with` statement. Only the :meth:`~io." "IOBase.truncate` method isn't implemented." msgstr "" +":class:`GzipFile` は、イテレーションと :keyword:`with` 文を含む :class:`io." +"BufferedIOBase` インターフェイスをサポートしています。:meth:`~io.IOBase." +"truncate` メソッドのみ実装されていません。" #: ../../library/gzip.rst:120 msgid ":class:`GzipFile` also provides the following method and attribute:" msgstr ":class:`GzipFile` は以下のメソッドと属性も提供しています:" -#: ../../library/gzip.rst:124 msgid "" "Read *n* uncompressed bytes without advancing the file position. The number " "of bytes returned may be more or less than requested." msgstr "" +"ファイル位置を進めずに、展開後のデータを *n* バイト読み込みます。\n" +"返されるバイト数は要求した数より多くなることも少なくなることもあります。" #: ../../library/gzip.rst:127 msgid "" @@ -267,24 +290,29 @@ msgstr "" msgid "``'rb'`` for reading and ``'wb'`` for writing." msgstr "``'rb'`` は読み込み用、 ``'wb'`` は書き込み用です。" -#: ../../library/gzip.rst:138 msgid "In previous versions it was an integer ``1`` or ``2``." -msgstr "" +msgstr "以前のバージョンでは整数の ``1`` または ``2`` でした。" -#: ../../library/gzip.rst:143 msgid "" "When decompressing, this attribute is set to the last timestamp in the most " "recently read header. It is an integer, holding the number of seconds since " "the Unix epoch (00:00:00 UTC, January 1, 1970). The initial value before " "reading any headers is ``None``." msgstr "" +"展開時、この属性には最後に読み取ったヘッダーのタイムスタンプが設定されま" +"す。\n" +"Unix エポック (1970 年 1 月 1 日 00:00:00 UTC) からの秒数を表す整数です。\n" +"ヘッダーを読み取る前の初期値は ``None`` です。" -#: ../../library/gzip.rst:150 msgid "" "The path to the gzip file on disk, as a :class:`str` or :class:`bytes`. " "Equivalent to the output of :func:`os.fspath` on the original input path, " "with no other normalization, resolution or expansion." msgstr "" +"ディスク上の gzip ファイルへのパスを表す :class:`str` または :class:`bytes` " +"です。\n" +"元の入力パスに :func:`os.fspath` を適用した結果と等しく、それ以外の正規化、解" +"決、展開は行いません。" #: ../../library/gzip.rst:154 msgid "" @@ -317,31 +345,33 @@ msgstr "" "ポートされました。 :meth:`~io.BufferedIOBase.read` メソッドが ``None`` を引数" "として受け取るようになりました。" -#: ../../library/gzip.rst:176 msgid "" "Opening :class:`GzipFile` for writing without specifying the *mode* argument " "is deprecated." msgstr "" +"*mode* 引数を指定せずに :class:`GzipFile` を書き込み用に開くことは非推奨にな" +"りました。" -#: ../../library/gzip.rst:180 msgid "" "Remove the ``filename`` attribute, use the :attr:`~GzipFile.name` attribute " "instead." msgstr "" +"``filename`` 属性が削除されました。\n" +"代わりに :attr:`~GzipFile.name` 属性を使ってください。" -#: ../../library/gzip.rst:187 msgid "" "Compress the *data*, returning a :class:`bytes` object containing the " "compressed data. *compresslevel* and *mtime* have the same meaning as in " "the :class:`GzipFile` constructor above, but *mtime* defaults to 0 for " "reproducible output." msgstr "" +"*data* を圧縮し、圧縮データを含む :class:`bytes` オブジェクトを返します。\n" +"*compresslevel* と *mtime* は上記の :class:`GzipFile` コンストラクタと同じ意" +"味ですが、再現可能な出力を得るために *mtime* のデフォルトは 0 です。" -#: ../../library/gzip.rst:193 msgid "Added the *mtime* parameter for reproducible output." -msgstr "" +msgstr "再現可能な出力を得るための *mtime* 引数が追加されました。" -#: ../../library/gzip.rst:195 msgid "" "Speed is improved by compressing all data at once instead of in a streamed " "fashion. Calls with *mtime* set to ``0`` are delegated to :func:`zlib." @@ -349,20 +379,27 @@ msgid "" "header \"OS\" byte value other than 255 \"unknown\" as supplied by the " "underlying zlib implementation." msgstr "" +"ストリームとして処理する代わりにすべてのデータを一度に圧縮することで、高速化" +"しました。\n" +"*mtime* が ``0`` の呼び出しは、速度を上げるために :func:`zlib.compress` に委" +"譲されます。\n" +"この場合、内部で使う zlib 実装が設定する値により、出力の gzip ヘッダーの " +"\"OS\" バイトが、255 (\"unknown\") 以外になることがあります。" -#: ../../library/gzip.rst:202 msgid "" "The gzip header OS byte is guaranteed to be set to 255 when this function is " "used as was the case in 3.10 and earlier." msgstr "" +"この関数を使った場合、3.10 以前と同様に、gzip ヘッダーの OS バイトが 255 に設" +"定されることを保証するようになりました。" -#: ../../library/gzip.rst:205 msgid "" "The *mtime* parameter now defaults to 0 for reproducible output. For the " "previous behaviour of using the current time, pass ``None`` to *mtime*." msgstr "" +"再現可能な出力を得るために、*mtime* 引数のデフォルトが 0 になりました。\n" +"以前のように現在時刻を使うには、*mtime* に ``None`` を渡してください。" -#: ../../library/gzip.rst:212 msgid "" "Decompress the *data*, returning a :class:`bytes` object containing the " "uncompressed data. This function is capable of decompressing multi-member " @@ -370,12 +407,19 @@ msgid "" "certain to contain only one member the :func:`zlib.decompress` function with " "*wbits* set to 31 is faster." msgstr "" +"*data* を展開し、展開したデータを含む :class:`bytes` オブジェクトを返しま" +"す。\n" +"この関数は、複数のメンバーからなる gzip データ (複数の gzip ブロックを連結し" +"たもの) を展開できます。\n" +"データにメンバーが 1 つしか含まれないことが確実な場合は、*wbits* を 31 に設定" +"した :func:`zlib.decompress` 関数の方が高速です。" -#: ../../library/gzip.rst:219 msgid "" "Speed is improved by decompressing members at once in memory instead of in a " "streamed fashion." msgstr "" +"ストリームとして処理する代わりに、メモリ内でメンバーを一度に展開することで高" +"速化しました。" #: ../../library/gzip.rst:226 msgid "Examples of usage" @@ -385,30 +429,34 @@ msgstr "使い方の例" msgid "Example of how to read a compressed file::" msgstr "圧縮されたファイルを読み込む例::" -#: ../../library/gzip.rst:230 msgid "" "import gzip\n" "with gzip.open('/home/joe/file.txt.gz', 'rb') as f:\n" " file_content = f.read()" msgstr "" +"import gzip\n" +"with gzip.open('/home/joe/file.txt.gz', 'rb') as f:\n" +" file_content = f.read()" #: ../../library/gzip.rst:234 msgid "Example of how to create a compressed GZIP file::" msgstr "GZIP 圧縮されたファイルを作成する例::" -#: ../../library/gzip.rst:236 msgid "" "import gzip\n" "content = b\"Lots of content here\"\n" "with gzip.open('/home/joe/file.txt.gz', 'wb') as f:\n" " f.write(content)" msgstr "" +"import gzip\n" +"content = b\"Lots of content here\"\n" +"with gzip.open('/home/joe/file.txt.gz', 'wb') as f:\n" +" f.write(content)" #: ../../library/gzip.rst:241 msgid "Example of how to GZIP compress an existing file::" msgstr "既存のファイルを GZIP 圧縮する例::" -#: ../../library/gzip.rst:243 msgid "" "import gzip\n" "import shutil\n" @@ -416,17 +464,24 @@ msgid "" " with gzip.open('/home/joe/file.txt.gz', 'wb') as f_out:\n" " shutil.copyfileobj(f_in, f_out)" msgstr "" +"import gzip\n" +"import shutil\n" +"with open('/home/joe/file.txt', 'rb') as f_in:\n" +" with gzip.open('/home/joe/file.txt.gz', 'wb') as f_out:\n" +" shutil.copyfileobj(f_in, f_out)" #: ../../library/gzip.rst:249 msgid "Example of how to GZIP compress a binary string::" msgstr "バイナリ文字列を GZIP 圧縮する例::" -#: ../../library/gzip.rst:251 msgid "" "import gzip\n" "s_in = b\"Lots of content here\"\n" "s_out = gzip.compress(s_in)" msgstr "" +"import gzip\n" +"s_in = b\"Lots of content here\"\n" +"s_out = gzip.compress(s_in)" #: ../../library/gzip.rst:257 msgid "Module :mod:`zlib`" @@ -440,11 +495,12 @@ msgstr "" ":program:`gzip` ファイル形式のサポートを行うために必要な基本ライブラリモ" "ジュール。" -#: ../../library/gzip.rst:261 msgid "" "In case gzip (de)compression is a bottleneck, the `python-isal`_ package " "speeds up (de)compression with a mostly compatible API." msgstr "" +"gzip の圧縮や展開がボトルネックとなる場合、`python-isal`_ パッケージを使う" +"と、ほぼ互換性のある API で圧縮や展開を高速化できます。" #: ../../library/gzip.rst:271 msgid "Command Line Interface" @@ -462,31 +518,28 @@ msgstr "" msgid "Once executed the :mod:`gzip` module keeps the input file(s)." msgstr "" -#: ../../library/gzip.rst:280 msgid "" "Add a new command line interface with a usage. By default, when you will " "execute the CLI, the default compression level is 6." msgstr "" +"使用方法を表示する新しいコマンドラインインターフェースが追加されました。\n" +"CLI 実行時のデフォルトの圧縮レベルは 6 です。" #: ../../library/gzip.rst:284 msgid "Command line options" msgstr "コマンドラインオプション" -#: ../../library/gzip.rst:288 msgid "If *file* is not specified, read from :data:`sys.stdin`." -msgstr "" +msgstr "*file* を指定しない場合は、:data:`sys.stdin` から読み取ります。" -#: ../../library/gzip.rst:292 msgid "Indicates the fastest compression method (less compression)." -msgstr "" +msgstr "最速の圧縮方法 (低い圧縮率) を指定します。" -#: ../../library/gzip.rst:296 msgid "Indicates the slowest compression method (best compression)." -msgstr "" +msgstr "最も遅い圧縮方法 (最も高い圧縮率) を指定します。" -#: ../../library/gzip.rst:300 msgid "Decompress the given file." -msgstr "" +msgstr "指定したファイルを展開します。" #: ../../library/gzip.rst:304 msgid "Show the help message." diff --git a/library/hashlib.po b/library/hashlib.po index 3b7d0661c..97b43528a 100644 --- a/library/hashlib.po +++ b/library/hashlib.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/hashlib.rst:2 @@ -32,7 +32,6 @@ msgstr ":mod:`!hashlib` --- セキュアハッシュとメッセージダイジ msgid "**Source code:** :source:`Lib/hashlib.py`" msgstr "**ソースコード:** :source:`Lib/hashlib.py`" -#: ../../library/hashlib.rst:23 msgid "" "This module implements a common interface to many different hash algorithms. " "Included are the FIPS secure hash algorithms SHA224, SHA256, SHA384, SHA512, " @@ -40,6 +39,12 @@ msgid "" "FIPS 202 standard`_) as well as the legacy algorithms SHA1 (`formerly part " "of FIPS`_) and the MD5 algorithm (defined in internet :rfc:`1321`)." msgstr "" +"このモジュールは、多くの異なるハッシュアルゴリズムに共通のインターフェースを" +"実装しています。\n" +"FIPS のセキュアハッシュアルゴリズム SHA224、SHA256、SHA384、SHA512 (`the " +"FIPS 180-4 standard`_ で定義)、SHA-3 系列 (`the FIPS 202 standard`_ で定義)、" +"および旧来の SHA1 (`formerly part of FIPS`_) と MD5 (インターネット :rfc:" +"`1321` で定義) が含まれます。" #: ../../library/hashlib.rst:31 msgid "" @@ -63,13 +68,23 @@ msgid "" "using the :meth:`digest()` or :meth:`hexdigest()` methods." msgstr "" +"各 :dfn:`hash` の名前が付いたコンストラクタがあります。いずれも同一で簡単なイ" +"ンターフェイスのあるハッシュオブジェクトを返します。例えば、SHA-256 ハッシュ" +"オブジェクトを作るには :func:`sha256` を使います。このオブジェクトには :meth:" +"`update` メソッドを用いて :term:`bytes-like オブジェクト ` (通常 :class:`bytes`) を渡すことができます。:meth:" +"`digest()` や :meth:`hexdigest()` メソッドを用い" +"て、それまでに渡したデータを連結したものの :dfn:`digest` をいつでも要求するこ" +"とができます。" -#: ../../library/hashlib.rst:48 msgid "" "To allow multithreading, the Python :term:`GIL` is released while computing " "a hash supplied more than 2047 bytes of data at once in its constructor or :" "meth:`.update` method." msgstr "" +"複数のスレッドを動作させるため、コンストラクタまたは :meth:`.update ` メソッドに一度に 2047 バイトを超えるデータを渡すと、ハッシュの計算中" +"は Python の :term:`GIL` を解放します。" #: ../../library/hashlib.rst:55 msgid "" @@ -90,21 +105,26 @@ msgid "" "accessible by name via :func:`new`. See :data:`algorithms_available`." msgstr "" -#: ../../library/hashlib.rst:70 msgid "" "Some algorithms have known hash collision weaknesses (including MD5 and " "SHA1). Refer to `Attacks on cryptographic hash algorithms`_ and the `hashlib-" "seealso`_ section at the end of this document." msgstr "" +"一部のアルゴリズム (MD5 と SHA1 を含む) には、ハッシュの衝突に関する既知の弱" +"点があります。\n" +"`Attacks on cryptographic hash algorithms`_ と、このドキュメントの末尾の " +"`hashlib-seealso`_ 節を参照してください。" -#: ../../library/hashlib.rst:74 msgid "" "SHA3 (Keccak) and SHAKE constructors :func:`sha3_224`, :func:`sha3_256`, :" "func:`sha3_384`, :func:`sha3_512`, :func:`shake_128`, :func:`shake_256` were " "added. :func:`blake2b` and :func:`blake2s` were added." msgstr "" +"SHA3 (Keccak) と SHAKE のコンストラクタ :func:`sha3_224`、:func:`sha3_256`、:" +"func:`sha3_384`、:func:`sha3_512`、:func:`shake_128`、:func:`shake_256` が追" +"加されました。\n" +":func:`blake2b` と :func:`blake2s` も追加されました。" -#: ../../library/hashlib.rst:82 msgid "" "All hashlib constructors take a keyword-only argument *usedforsecurity* with " "default value ``True``. A false value allows the use of insecure and blocked " @@ -112,17 +132,26 @@ msgid "" "hashing algorithm is not used in a security context, e.g. as a non-" "cryptographic one-way compression function." msgstr "" +"hashlib のすべてのコンストラクタが、デフォルト値 ``True`` のキーワード専用引" +"数 *usedforsecurity* を受け取るようになりました。\n" +"偽の値を指定すると、制限のある環境で、安全でないアルゴリズムや使用を制限され" +"たハッシュアルゴリズムを使えます。\n" +"``False`` は、例えば暗号用途でない一方向圧縮関数として使う場合など、そのハッ" +"シュアルゴリズムをセキュリティ目的で使わないことを示します。" -#: ../../library/hashlib.rst:89 msgid "Hashlib now uses SHA3 and SHAKE from OpenSSL if it provides it." msgstr "" +"OpenSSL が SHA3 と SHAKE を提供する場合、hashlib はそれらを使うようになりまし" +"た。" -#: ../../library/hashlib.rst:92 msgid "" "For any of the MD5, SHA1, SHA2, or SHA3 algorithms that the linked OpenSSL " "does not provide we fall back to a verified implementation from the `HACL\\* " "project`_." msgstr "" +"MD5、SHA1、SHA2、SHA3 の各アルゴリズムを、リンク先の OpenSSL が提供していない" +"場合は、`HACL\\* project`_ の検証済み実装にフォールバックするようになりまし" +"た。" #: ../../library/hashlib.rst:98 msgid "Usage" @@ -133,8 +162,9 @@ msgid "" "To obtain the digest of the byte string ``b\"Nobody inspects the spammish " "repetition\"``::" msgstr "" +"``b\"Nobody inspects the spammish repetition\"`` というバイト文字列のダイジェ" +"ストを取得するには次のようにします::" -#: ../../library/hashlib.rst:103 msgid "" ">>> import hashlib\n" ">>> m = hashlib.sha256()\n" @@ -147,6 +177,16 @@ msgid "" ">>> m.hexdigest()\n" "'031edd7d41651593c5fe5c006fa5752b37fddff7bc4e843aa6af0c950f4b9406'" msgstr "" +">>> import hashlib\n" +">>> m = hashlib.sha256()\n" +">>> m.update(b\"Nobody inspects\")\n" +">>> m.update(b\" the spammish repetition\")\n" +">>> m.digest()\n" +"b'\\x03\\x1e\\xdd}Ae\\x15\\x93\\xc5\\xfe\\\\" +"\\x00o\\xa5u+7\\xfd\\xdf\\xf7\\xbcN\\x84:" +"\\xa6\\xaf\\x0c\\x95\\x0fK\\x94\\x06'\n" +">>> m.hexdigest()\n" +"'031edd7d41651593c5fe5c006fa5752b37fddff7bc4e843aa6af0c950f4b9406'" #: ../../library/hashlib.rst:112 msgid "More condensed:" @@ -154,7 +194,7 @@ msgstr "もっと簡潔に書くと、このようになります:" #: ../../library/hashlib.rst:118 msgid "Constructors" -msgstr "" +msgstr "コンストラクタ" #: ../../library/hashlib.rst:122 msgid "" @@ -163,24 +203,26 @@ msgid "" "above listed hashes as well as any other algorithms that your OpenSSL " "library may offer." msgstr "" +"一般的なコンストラクタで、第一引数にアルゴリズム名を文字列 *name* で受け取り" +"ます。他にも、前述のハッシュアルゴリズムだけでなく OpenSSL ライブラリーが提供" +"するような他のアルゴリズムにアクセスすることができます。" -#: ../../library/hashlib.rst:127 msgid "Using :func:`new` with an algorithm name:" -msgstr "" +msgstr ":func:`new` にアルゴリズム名を渡す例です。" -#: ../../library/hashlib.rst:146 msgid "" "Named constructors such as these are faster than passing an algorithm name " "to :func:`new`." msgstr "" +"このような名前付きコンストラクタは、:func:`new` にアルゴリズム名を渡すより高" +"速です。" #: ../../library/hashlib.rst:150 msgid "Attributes" msgstr "属性" -#: ../../library/hashlib.rst:152 msgid "Hashlib provides the following constant module attributes:" -msgstr "" +msgstr "hashlib は次の定数をモジュール属性として提供します。" #: ../../library/hashlib.rst:156 msgid "" @@ -207,9 +249,8 @@ msgstr "" "`algorithms_guaranteed` は常にサブセットです。この set の中に同じアルゴリズム" "が違う名前で複数回現れることがあります (OpenSSL 由来)。" -#: ../../library/hashlib.rst:174 msgid "Hash Objects" -msgstr "" +msgstr "ハッシュオブジェクト" #: ../../library/hashlib.rst:176 msgid "" @@ -295,13 +336,18 @@ msgstr "" msgid "SHAKE variable length digests" msgstr "SHAKE 可変長ダイジェスト" -#: ../../library/hashlib.rst:236 msgid "" "The :func:`shake_128` and :func:`shake_256` algorithms provide variable " "length digests with length_in_bits//2 up to 128 or 256 bits of security. As " "such, their digest methods require a length. Maximum length is not limited " "by the SHAKE algorithm." msgstr "" +":func:`shake_128` と :func:`shake_256` アルゴリズムは、可変長のダイジェストを" +"提供します。\n" +"安全性の強度は、ビット単位のダイジェスト長の半分 (length_in_bits//2) で、それ" +"ぞれ最大 128 ビットまたは 256 ビットです。\n" +"そのため、これらの ``digest()`` メソッドには長さの指定が必要です。\n" +"SHAKE アルゴリズム自体には長さの上限はありません。" #: ../../library/hashlib.rst:243 msgid "" @@ -309,6 +355,9 @@ msgid "" "far. This is a bytes object of size *length* which may contain bytes in the " "whole range from 0 to 255." msgstr "" +"これまで :meth:`~hash.update` メソッドに渡されたデータのダイジェスト値を返し" +"ます。これは *length* と同じ長さの、0 から 255 の範囲全てを含み得るバイトの列" +"です。" #: ../../library/hashlib.rst:250 msgid "" @@ -316,27 +365,29 @@ msgid "" "double length, containing only hexadecimal digits. This may be used to " "exchange the value in email or other non-binary environments." msgstr "" +":meth:`digest` と似ていますが、倍の長さの、16進形式文字列を返します。これは、" +"電子メールなどの非バイナリ環境で値を交換する場合に便利です。" #: ../../library/hashlib.rst:254 msgid "Example use:" -msgstr "" +msgstr "使用例:" #: ../../library/hashlib.rst:261 msgid "File hashing" -msgstr "" +msgstr "ファイルのハッシュ化" -#: ../../library/hashlib.rst:263 msgid "" "The hashlib module provides a helper function for efficient hashing of a " "file or file-like object." msgstr "" +"hashlib モジュールは、ファイルやファイルに似たオブジェクトのハッシュを効率よ" +"く計算するための補助関数を提供します。" -#: ../../library/hashlib.rst:268 msgid "" "Return a digest object that has been updated with contents of file object." msgstr "" +"ファイルオブジェクトの内容で更新されたダイジェストオブジェクトを返します。" -#: ../../library/hashlib.rst:270 msgid "" "*fileobj* must be a file-like object opened for reading in binary mode. It " "accepts file objects from builtin :func:`open`, :class:`~io.BytesIO` " @@ -344,20 +395,33 @@ msgid "" "similar. *fileobj* must be opened in blocking mode, otherwise a :exc:" "`BlockingIOError` may be raised." msgstr "" +"*fileobj* はバイナリモードで読み取り用に開かれた、ファイルに似たオブジェクト" +"でなければなりません。\n" +"組み込みの :func:`open` が返すファイルオブジェクト、:class:`~io.BytesIO` イン" +"スタンス、:meth:`socket.socket.makefile` が返す SocketIO オブジェクトなどを受" +"け付けます。\n" +"*fileobj* はブロッキングモードで開いておく必要があり、そうでなければ :exc:" +"`BlockingIOError` が送出される場合があります。" -#: ../../library/hashlib.rst:276 msgid "" "The function may bypass Python's I/O and use the file descriptor from :meth:" "`~io.IOBase.fileno` directly. *fileobj* must be assumed to be in an unknown " "state after this function returns or raises. It is up to the caller to close " "*fileobj*." msgstr "" +"この関数は Python の I/O を経由せず、:meth:`~io.IOBase.fileno` から得たファイ" +"ル記述子を直接使う場合があります。\n" +"この関数が値を返したり例外を送出したりした後の *fileobj* の状態は、不明なもの" +"として扱ってください。\n" +"*fileobj* を閉じるのは呼び出し側の責任です。" -#: ../../library/hashlib.rst:281 msgid "" "*digest* must either be a hash algorithm name as a *str*, a hash " "constructor, or a callable that returns a hash object." msgstr "" +"*digest* には、*str* で表したハッシュアルゴリズム名、ハッシュのコンストラク" +"タ、ハッシュオブジェクトを返す呼び出し可能オブジェクトのいずれかを指定する必" +"要があります。" #: ../../library/hashlib.rst:284 msgid "Example:" @@ -409,7 +473,6 @@ msgstr "" "長さ (例えば 1024) に制限すべきです。 *salt* は :func:`os.urandom` のような適" "切なソースからの、およそ 16 バイトかそれ以上のバイト列にするべきです。" -#: ../../library/hashlib.rst:330 msgid "" "The number of *iterations* should be chosen based on the hash algorithm and " "computing power. As of 2022, hundreds of thousands of iterations of SHA-256 " @@ -417,6 +480,12 @@ msgid "" "your application, read *Appendix A.2.2* of NIST-SP-800-132_. The answers on " "the `stackexchange pbkdf2 iterations question`_ explain in detail." msgstr "" +"*iterations* の回数は、ハッシュアルゴリズムと計算能力に基づいて選んでくださ" +"い。\n" +"2022 年時点では、SHA-256 で数十万回の反復が推奨されています。\n" +"アプリケーションに最適な値を選ぶ方法とその根拠については、NIST-SP-800-132_ " +"の *付録 A.2.2* を参照してください。\n" +"`stackexchange pbkdf2 iterations question`_ の回答にも詳しい説明があります。" #: ../../library/hashlib.rst:336 msgid "" @@ -424,16 +493,22 @@ msgid "" "then the digest size of the hash algorithm *hash_name* is used, e.g. 64 for " "SHA-512." msgstr "" +"*dklen* は、導出されたバイト列の鍵の長さです。 *dklen* が ``None`` の場合、" +"ハッシュアルゴリズム *hash_name* のダイジェストサイズが使われます。例えば " +"SHA-512 では 64 です。" -#: ../../library/hashlib.rst:345 msgid "Function only available when Python is compiled with OpenSSL." msgstr "" +"この関数は、Python が OpenSSL を使ってコンパイルされている場合にのみ利用でき" +"ます。" -#: ../../library/hashlib.rst:349 msgid "" "Function now only available when Python is built with OpenSSL. The slow pure " "Python implementation has been removed." msgstr "" +"この関数は、Python が OpenSSL を使ってビルドされている場合にのみ利用できるよ" +"うになりました。\n" +"低速な純 Python 実装は削除されました。" #: ../../library/hashlib.rst:355 msgid "" @@ -455,40 +530,47 @@ msgstr "" "きです。 *salt* は :func:`os.urandom` のような適切なソースからの、およそ 16 " "バイトかそれ以上のバイト列にするべきです。" -#: ../../library/hashlib.rst:363 msgid "" "*n* is the CPU/Memory cost factor, *r* the block size, *p* parallelization " "factor and *maxmem* limits memory (OpenSSL 1.1.0 defaults to 32 MiB). " "*dklen* is the length of the derived key in bytes." msgstr "" +"*n* は CPU とメモリのコスト係数、*r* はブロックサイズ、*p* は並列化係数で" +"す。\n" +"*maxmem* はメモリ使用量を制限します (OpenSSL 1.1.0 のデフォルトは 32 MiB)。\n" +"*dklen* は導出する鍵のバイト単位の長さです。" #: ../../library/hashlib.rst:373 msgid "BLAKE2" msgstr "BLAKE2" -#: ../../library/hashlib.rst:380 msgid "" "BLAKE2_ is a cryptographic hash function defined in :rfc:`7693` that comes " "in two flavors:" msgstr "" +"BLAKE2_ は :rfc:`7693` で定義された暗号学的ハッシュ関数で、次の 2 種類があり" +"ます。" -#: ../../library/hashlib.rst:383 msgid "" "**BLAKE2b**, optimized for 64-bit platforms and produces digests of any size " "between 1 and 64 bytes," msgstr "" +"**BLAKE2b** は 64 ビットプラットフォーム向けに最適化されており、1〜64 バイト" +"の任意の長さのダイジェストを生成します。" -#: ../../library/hashlib.rst:386 msgid "" "**BLAKE2s**, optimized for 8- to 32-bit platforms and produces digests of " "any size between 1 and 32 bytes." msgstr "" +"**BLAKE2s** は 8〜32 ビットプラットフォーム向けに最適化されており、1〜32 バイ" +"トの任意の長さのダイジェストを生成します。" -#: ../../library/hashlib.rst:389 msgid "" "BLAKE2 supports **keyed mode** (a faster and simpler replacement for HMAC_), " "**salted hashing**, **personalization**, and **tree hashing**." msgstr "" +"BLAKE2 は **鍵付きモード** (HMAC_ より高速で単純な代替手段)、**ソルト付きハッ" +"シュ化**、**パーソナライズ**、**ツリーハッシング** をサポートします。" #: ../../library/hashlib.rst:392 msgid "" @@ -507,39 +589,46 @@ msgid "New hash objects are created by calling constructor functions:" msgstr "" "新しいハッシュオブジェクトは、コンストラクタ関数を呼び出すことで生成されます:" -#: ../../library/hashlib.rst:413 msgid "" "These functions return the corresponding hash objects for calculating " "BLAKE2b or BLAKE2s. They optionally take these general parameters:" msgstr "" +"これらの関数は、BLAKE2b または BLAKE2s を計算するための、対応するハッシュオブ" +"ジェクトを返します。\n" +"次の一般的な引数を任意に指定できます。" -#: ../../library/hashlib.rst:416 msgid "" "*data*: initial chunk of data to hash, which must be :term:`bytes-like " "object`. It can be passed only as positional argument." msgstr "" +"*data*: 最初にハッシュ計算に使うデータのチャンクで、:term:`bytes-like " +"object` でなければなりません。\n" +"位置引数としてのみ渡せます。" #: ../../library/hashlib.rst:419 msgid "*digest_size*: size of output digest in bytes." msgstr "*digest_size*: 出力するダイジェストのバイト数。" -#: ../../library/hashlib.rst:421 msgid "" "*key*: key for keyed hashing (up to 64 bytes for BLAKE2b, up to 32 bytes for " "BLAKE2s)." msgstr "" +"*key*: 鍵付きハッシュ化のための鍵 (BLAKE2b では最大 64 バイト、BLAKE2s では最" +"大 32 バイト)。" -#: ../../library/hashlib.rst:424 msgid "" "*salt*: salt for randomized hashing (up to 16 bytes for BLAKE2b, up to 8 " "bytes for BLAKE2s)." msgstr "" +"*salt*: ランダム化ハッシュ化のためのソルト (BLAKE2b では最大 16 バイト、" +"BLAKE2s では最大 8 バイト)。" -#: ../../library/hashlib.rst:427 msgid "" "*person*: personalization string (up to 16 bytes for BLAKE2b, up to 8 bytes " "for BLAKE2s)." msgstr "" +"*person*: パーソナライズ用の文字列 (BLAKE2b では最大 16 バイト、BLAKE2s では" +"最大 8 バイト)。" #: ../../library/hashlib.rst:430 msgid "The following table shows limits for general parameters (in bytes):" @@ -589,7 +678,6 @@ msgstr "32" msgid "8" msgstr "8" -#: ../../library/hashlib.rst:441 msgid "" "BLAKE2 specification defines constant lengths for salt and personalization " "parameters, however, for convenience, this implementation accepts byte " @@ -598,6 +686,11 @@ msgid "" "example, ``b'salt'`` and ``b'salt\\x00'`` is the same value. (This is not " "the case for *key*.)" msgstr "" +"BLAKE2 の仕様はソルトとパーソナライズ引数の長さを固定していますが、この実装で" +"は利便性のため、規定の長さまでの任意のサイズのバイト文字列を受け付けます。\n" +"引数の長さが規定より短ければゼロで埋めるため、例えば ``b'salt'`` と " +"``b'salt\\x00'`` は同じ値になります。\n" +"(*key* はこのようには扱いません。)" #: ../../library/hashlib.rst:448 msgid "These sizes are available as module `constants`_ described below." @@ -608,56 +701,63 @@ msgid "" "Constructor functions also accept the following tree hashing parameters:" msgstr "コンストラクタ関数は以下のツリーハッシングパラメタを受け付けます:" -#: ../../library/hashlib.rst:452 msgid "*fanout*: fanout (0 to 255, 0 if unlimited, 1 in sequential mode)." msgstr "" +"*fanout*: ファンアウト (0〜255。\n" +"無制限なら 0、逐次モードでは 1)。\n" -#: ../../library/hashlib.rst:454 msgid "" "*depth*: maximal depth of tree (1 to 255, 255 if unlimited, 1 in sequential " "mode)." msgstr "" -"*depth*: ツリーの深さの最大値(1から255までの値で、無制限であれば255、シーケ" -"ンスモードでは1)。" +"*depth*: ツリーの深さの最大値 (1〜255。\n" +"無制限なら 255、逐次モードでは 1)。\n" -#: ../../library/hashlib.rst:457 msgid "" "*leaf_size*: maximal byte length of leaf (0 to ``2**32-1``, 0 if unlimited " "or in sequential mode)." msgstr "" +"*leaf_size*: 葉の最大バイト長 (0〜``2**32-1``。\n" +"無制限の場合や逐次モードでは 0)。\n" -#: ../../library/hashlib.rst:460 msgid "" "*node_offset*: node offset (0 to ``2**64-1`` for BLAKE2b, 0 to ``2**48-1`` " "for BLAKE2s, 0 for the first, leftmost, leaf, or in sequential mode)." msgstr "" +"*node_offset*: ノードのオフセット (BLAKE2b では 0〜``2**64-1``、BLAKE2s では " +"0〜``2**48-1``。\n" +"最初の、つまり最も左の葉や、逐次モードでは 0)。\n" -#: ../../library/hashlib.rst:463 msgid "" "*node_depth*: node depth (0 to 255, 0 for leaves, or in sequential mode)." msgstr "" +"*node_depth*: ノードの深さ (0〜255。\n" +"葉や逐次モードでは 0)。\n" -#: ../../library/hashlib.rst:465 msgid "" "*inner_size*: inner digest size (0 to 64 for BLAKE2b, 0 to 32 for BLAKE2s, 0 " "in sequential mode)." msgstr "" +"*inner_size*: 内部ダイジェストのサイズ (BLAKE2b では 0〜64、BLAKE2s では 0〜" +"32。\n" +"逐次モードでは 0)。\n" -#: ../../library/hashlib.rst:468 msgid "" "*last_node*: boolean indicating whether the processed node is the last one " "(``False`` for sequential mode)." msgstr "" +"*last_node*: 処理中のノードが最後のノードかどうかを示すブール値 (逐次モードで" +"は ``False``)。" -#: ../../library/hashlib.rst:471 msgid "Explanation of tree mode parameters." -msgstr "" +msgstr "ツリーモードのパラメータの説明。" -#: ../../library/hashlib.rst:475 msgid "" "See section 2.10 in `BLAKE2 specification `_ for comprehensive review of tree hashing." msgstr "" +"ツリーハッシングの詳しい説明については、`BLAKE2 の仕様 `_ の 2.10 節を参照してください。" #: ../../library/hashlib.rst:481 msgid "Constants" @@ -667,10 +767,9 @@ msgstr "定数" msgid "Salt length (maximum length accepted by constructors)." msgstr "ソルト長(コンストラクタが受け付けれる最大長)" -#: ../../library/hashlib.rst:492 msgid "" "Personalization string length (maximum length accepted by constructors)." -msgstr "" +msgstr "パーソナライズ用の文字列の長さ (コンストラクタが受け付ける最大長)。" #: ../../library/hashlib.rst:498 msgid "Maximum key size." @@ -688,7 +787,6 @@ msgstr "使用例" msgid "Simple hashing" msgstr "簡単なハッシュ化" -#: ../../library/hashlib.rst:513 msgid "" "To calculate hash of some data, you should first construct a hash object by " "calling the appropriate constructor function (:func:`blake2b` or :func:" @@ -696,22 +794,27 @@ msgid "" "the object, and, finally, get the digest out of the object by calling :meth:" "`~hash.digest` (or :meth:`~hash.hexdigest` for hex-encoded string)." msgstr "" +"データのハッシュを計算するには、まず適切なコンストラクタ関数 (:func:" +"`blake2b` または :func:`blake2s`) でハッシュオブジェクトを作成します。\n" +"次にオブジェクトの :meth:`~hash.update` を呼び出してデータで更新し、最後に :" +"meth:`~hash.digest` (16 進数の文字列を得る場合は :meth:`~hash.hexdigest`) を" +"呼び出してダイジェストを取得します。" -#: ../../library/hashlib.rst:526 msgid "" "As a shortcut, you can pass the first chunk of data to update directly to " "the constructor as the positional argument:" msgstr "" +"手順を短くするために、最初のデータのチャンクをコンストラクタに位置引数として" +"直接渡すこともできます。" -#: ../../library/hashlib.rst:533 msgid "" "You can call :meth:`hash.update` as many times as you need to iteratively " "update the hash:" msgstr "" +":meth:`hash.update` を必要な回数だけ呼び出して、ハッシュを順次更新できます。" -#: ../../library/hashlib.rst:547 msgid "Using different digest sizes" -msgstr "" +msgstr "異なるダイジェストサイズの使用" #: ../../library/hashlib.rst:549 msgid "" @@ -724,32 +827,37 @@ msgstr "" "BLAKE2bで置き換えるには、BLAKE2bに20バイトのダイジェストを生成するように指示" "できます:" -#: ../../library/hashlib.rst:563 msgid "" "Hash objects with different digest sizes have completely different outputs " "(shorter hashes are *not* prefixes of longer hashes); BLAKE2b and BLAKE2s " "produce different outputs even if the output length is the same:" msgstr "" +"ダイジェストサイズが異なるハッシュオブジェクトは、まったく異なる出力を生成し" +"ます (短いハッシュは長いハッシュの先頭部分では *ありません*)。\n" +"BLAKE2b と BLAKE2s は、出力の長さが同じでも異なる出力を生成します。" -#: ../../library/hashlib.rst:579 msgid "Keyed hashing" -msgstr "" +msgstr "鍵付きハッシュ化" -#: ../../library/hashlib.rst:581 msgid "" "Keyed hashing can be used for authentication as a faster and simpler " "replacement for `Hash-based message authentication code `_ (HMAC). BLAKE2 can be securely used in prefix-MAC " "mode thanks to the indifferentiability property inherited from BLAKE." msgstr "" +"鍵付きハッシュ化は、`ハッシュベースのメッセージ認証コード `_ (HMAC) より高速で単純な代替手段として、認証に使え" +"ます。\n" +"BLAKE から受け継いだ強強強識別不可能性 (indifferentiability) により、BLAKE2 " +"は prefix-MAC モードで安全に使えます。" -#: ../../library/hashlib.rst:587 msgid "" "This example shows how to get a (hex-encoded) 128-bit authentication code " "for message ``b'message data'`` with key ``b'pseudorandom key'``::" msgstr "" +"この例では、鍵 ``b'pseudorandom key'`` を使って、メッセージ ``b'message " +"data'`` の 128 ビット認証コードを 16 進数形式で取得します。 ::" -#: ../../library/hashlib.rst:590 msgid "" ">>> from hashlib import blake2b\n" ">>> h = blake2b(key=b'pseudorandom key', digest_size=16)\n" @@ -757,14 +865,19 @@ msgid "" ">>> h.hexdigest()\n" "'3d363ff7401e02026f4a4687d4863ced'" msgstr "" +">>> from hashlib import blake2b\n" +">>> h = blake2b(key=b'pseudorandom key', digest_size=16)\n" +">>> h.update(b'message data')\n" +">>> h.hexdigest()\n" +"'3d363ff7401e02026f4a4687d4863ced'" -#: ../../library/hashlib.rst:597 msgid "" "As a practical example, a web application can symmetrically sign cookies " "sent to users and later verify them to make sure they weren't tampered with::" msgstr "" +"実用例として、ウェブアプリケーションがユーザーに送る Cookie に共通鍵で署名" +"し、後で検証して改ざんされていないことを確認できます。 ::" -#: ../../library/hashlib.rst:600 msgid "" ">>> from hashlib import blake2b\n" ">>> from hmac import compare_digest\n" @@ -792,14 +905,39 @@ msgid "" ">>> verify(cookie, b'0102030405060708090a0b0c0d0e0f00')\n" "False" msgstr "" +">>> from hashlib import blake2b\n" +">>> from hmac import compare_digest\n" +">>>\n" +">>> SECRET_KEY = b'pseudorandomly generated server secret key'\n" +">>> AUTH_SIZE = 16\n" +">>>\n" +">>> def sign(cookie):\n" +"... h = blake2b(digest_size=AUTH_SIZE, key=SECRET_KEY)\n" +"... h.update(cookie)\n" +"... return h.hexdigest().encode('utf-8')\n" +">>>\n" +">>> def verify(cookie, sig):\n" +"... good_sig = sign(cookie)\n" +"... return compare_digest(good_sig, sig)\n" +">>>\n" +">>> cookie = b'user-alice'\n" +">>> sig = sign(cookie)\n" +">>> print(\"{0},{1}\".format(cookie.decode('utf-8'), sig))\n" +"user-alice,b'43b3c982cf697e0c5ab22172d1ca7421'\n" +">>> verify(cookie, sig)\n" +"True\n" +">>> verify(b'user-bob', sig)\n" +"False\n" +">>> verify(cookie, b'0102030405060708090a0b0c0d0e0f00')\n" +"False" -#: ../../library/hashlib.rst:626 msgid "" "Even though there's a native keyed hashing mode, BLAKE2 can, of course, be " "used in HMAC construction with :mod:`hmac` module::" msgstr "" +"BLAKE2 には専用の鍵付きハッシュ化モードがありますが、もちろん :mod:`hmac` モ" +"ジュールを使って HMAC を構成することもできます。 ::" -#: ../../library/hashlib.rst:629 msgid "" ">>> import hmac, hashlib\n" ">>> m = hmac.new(b'secret key', digestmod=hashlib.blake2s)\n" @@ -807,19 +945,24 @@ msgid "" ">>> m.hexdigest()\n" "'e3c8102868d28b5ff85fc35dda07329970d1a01e273c37481326fe0c861c8142'" msgstr "" +">>> import hmac, hashlib\n" +">>> m = hmac.new(b'secret key', digestmod=hashlib.blake2s)\n" +">>> m.update(b'message')\n" +">>> m.hexdigest()\n" +"'e3c8102868d28b5ff85fc35dda07329970d1a01e273c37481326fe0c861c8142'" -#: ../../library/hashlib.rst:637 msgid "Randomized hashing" -msgstr "" +msgstr "ランダム化ハッシュ化" -#: ../../library/hashlib.rst:639 msgid "" "By setting *salt* parameter users can introduce randomization to the hash " "function. Randomized hashing is useful for protecting against collision " "attacks on the hash function used in digital signatures." msgstr "" +"*salt* 引数を設定すると、ハッシュ関数にランダム性を導入できます。\n" +"ランダム化ハッシュ化は、デジタル署名で使うハッシュ関数への衝突攻撃を防ぐのに" +"役立ちます。" -#: ../../library/hashlib.rst:643 msgid "" "Randomized hashing is designed for situations where one party, the message " "preparer, generates all or part of a message to be signed by a second party, " @@ -839,39 +982,58 @@ msgid "" "hashing may reduce the amount of security provided by a digital signature " "when all portions of the message are prepared by the signer." msgstr "" +"ランダム化ハッシュ化は、メッセージ作成者がメッセージの全体または一部を作成" +"し、別の当事者である署名者が署名する状況を想定して設計されています。\n" +"作成者が暗号学的ハッシュ関数の衝突 (同じハッシュ値を生成する 2 つのメッセー" +"ジ) を見つけられる場合、同じハッシュ値とデジタル署名を生成しながら異なる結果" +"をもたらす、意味の通る複数のメッセージを用意できるかもしれません (例えば、口" +"座への送金額を 10 ドルではなく 100 万ドルにするなど)。\n" +"暗号学的ハッシュ関数は衝突耐性を主要な目標として設計されていますが、暗号学的" +"ハッシュ関数への攻撃が現在集中的に研究されているため、特定の関数の衝突耐性が" +"期待を下回る可能性があります。\n" +"ランダム化ハッシュ化は、ハッシュ関数の衝突を現実的に見つけられる場合でも、デ" +"ジタル署名の生成過程で最終的に同じハッシュ値になるメッセージを作成者が複数作" +"れる可能性を減らし、署名者をさらに保護します。\n" +"ただし、メッセージのすべてを署名者自身が作成する場合には、ランダム化ハッシュ" +"化の使用によりデジタル署名の安全性が下がることがあります。" -#: ../../library/hashlib.rst:662 msgid "" "(`NIST SP-800-106 \"Randomized Hashing for Digital Signatures\" `_)" msgstr "" +"(`NIST SP-800-106「デジタル署名のためのランダム化ハッシュ化」 `_)" -#: ../../library/hashlib.rst:665 msgid "" "In BLAKE2 the salt is processed as a one-time input to the hash function " "during initialization, rather than as an input to each compression function." msgstr "" +"BLAKE2 では、ソルトを圧縮関数の毎回の入力としてではなく、初期化時にハッシュ関" +"数への一度だけの入力として処理します。" -#: ../../library/hashlib.rst:670 msgid "" "*Salted hashing* (or just hashing) with BLAKE2 or any other general-purpose " "cryptographic hash function, such as SHA-256, is not suitable for hashing " "passwords. See `BLAKE2 FAQ `_ for more " "information." msgstr "" +"BLAKE2 や SHA-256 などの汎用の暗号学的ハッシュ関数による *ソルト付きハッシュ" +"化* (あるいは単なるハッシュ化) は、パスワードのハッシュ化には適していませ" +"ん。\n" +"詳しくは `BLAKE2 FAQ `_ を参照してください。" -#: ../../library/hashlib.rst:693 msgid "Personalization" -msgstr "" +msgstr "パーソナライズ" -#: ../../library/hashlib.rst:695 msgid "" "Sometimes it is useful to force hash function to produce different digests " "for the same input for different purposes. Quoting the authors of the Skein " "hash function:" msgstr "" +"同じ入力でも用途ごとに異なるダイジェストを生成するようにハッシュ関数を設定す" +"ると、役立つ場合があります。\n" +"Skein ハッシュ関数の作者は次のように述べています。" -#: ../../library/hashlib.rst:699 msgid "" "We recommend that all application designers seriously consider doing this; " "we have seen many protocols where a hash that is computed in one part of the " @@ -880,18 +1042,25 @@ msgid "" "force the application to make the hash inputs the same. Personalizing each " "hash function used in the protocol summarily stops this type of attack." msgstr "" +"すべてのアプリケーション設計者に、この方法を真剣に検討することを勧めます。\n" +"私たちは、プロトコルのある部分で計算したハッシュを、まったく別の部分で使えて" +"しまうプロトコルを数多く見てきました。\n" +"これは、2 つのハッシュ計算が似たデータや関連したデータに対して行われ、攻撃者" +"がアプリケーションに同じデータを入力させられるためです。\n" +"プロトコルで使う各ハッシュ関数をパーソナライズすれば、この種の攻撃を完全に防" +"げます。" -#: ../../library/hashlib.rst:706 msgid "" "(`The Skein Hash Function Family `_, p. 21)" msgstr "" +"(`The Skein Hash Function Family `_、21 ページ)" #: ../../library/hashlib.rst:710 msgid "BLAKE2 can be personalized by passing bytes to the *person* argument::" msgstr "BLAKE2は *person* 引数にバイト列を渡すことでパーソナライズできます::" -#: ../../library/hashlib.rst:712 msgid "" ">>> from hashlib import blake2b\n" ">>> FILES_HASH_PERSON = b'MyApp Files Hash'\n" @@ -905,12 +1074,24 @@ msgid "" ">>> h.hexdigest()\n" "'cf68fb5761b9c44e7878bfb2c4c9aea52264a80b75005e65619778de59f383a3'" msgstr "" +">>> from hashlib import blake2b\n" +">>> FILES_HASH_PERSON = b'MyApp Files Hash'\n" +">>> BLOCK_HASH_PERSON = b'MyApp Block Hash'\n" +">>> h = blake2b(digest_size=32, person=FILES_HASH_PERSON)\n" +">>> h.update(b'the same content')\n" +">>> h.hexdigest()\n" +"'20d9cd024d4fb086aae819a1432dd2466de12947831b75c5a30cf2676095d3b4'\n" +">>> h = blake2b(digest_size=32, person=BLOCK_HASH_PERSON)\n" +">>> h.update(b'the same content')\n" +">>> h.hexdigest()\n" +"'cf68fb5761b9c44e7878bfb2c4c9aea52264a80b75005e65619778de59f383a3'" -#: ../../library/hashlib.rst:724 msgid "" "Personalization together with the keyed mode can also be used to derive " "different keys from a single one." msgstr "" +"パーソナライズと鍵付きモードを組み合わせることで、1 つの鍵から異なる鍵を導出" +"することもできます。" #: ../../library/hashlib.rst:738 msgid "Tree mode" @@ -920,22 +1101,22 @@ msgstr "ツリーモード" msgid "Here's an example of hashing a minimal tree with two leaf nodes::" msgstr "これが二つの葉ノードからなる最小の木をハッシュする例です::" -#: ../../library/hashlib.rst:742 msgid "" " 10\n" " / \\\n" "00 01" msgstr "" +" 10\n" +" / \\\n" +"00 01" -#: ../../library/hashlib.rst:746 msgid "" "This example uses 64-byte internal digests, and returns the 32-byte final " "digest::" msgstr "" -"次の例では、64バイトの内部桁が使われ、32バイトの最終的なダイジェストを返して" -"います::" +"この例では 64 バイトの内部ダイジェストを使い、32 バイトの最終ダイジェストを返" +"します。 ::" -#: ../../library/hashlib.rst:749 msgid "" ">>> from hashlib import blake2b\n" ">>>\n" @@ -963,6 +1144,31 @@ msgid "" ">>> h10.hexdigest()\n" "'3ad2a9b37c6070e374c7a8c508fe20ca86b6ed54e286e93a0318e95e881db5aa'" msgstr "" +">>> from hashlib import blake2b\n" +">>>\n" +">>> FANOUT = 2\n" +">>> DEPTH = 2\n" +">>> LEAF_SIZE = 4096\n" +">>> INNER_SIZE = 64\n" +">>>\n" +">>> buf = bytearray(6000)\n" +">>>\n" +">>> # 左の葉\n" +"... h00 = blake2b(buf[0:LEAF_SIZE], fanout=FANOUT, depth=DEPTH,\n" +"... leaf_size=LEAF_SIZE, inner_size=INNER_SIZE,\n" +"... node_offset=0, node_depth=0, last_node=False)\n" +">>> # 右の葉\n" +"... h01 = blake2b(buf[LEAF_SIZE:], fanout=FANOUT, depth=DEPTH,\n" +"... leaf_size=LEAF_SIZE, inner_size=INNER_SIZE,\n" +"... node_offset=1, node_depth=0, last_node=True)\n" +">>> # 根ノード\n" +"... h10 = blake2b(digest_size=32, fanout=FANOUT, depth=DEPTH,\n" +"... leaf_size=LEAF_SIZE, inner_size=INNER_SIZE,\n" +"... node_offset=0, node_depth=1, last_node=True)\n" +">>> h10.update(h00.digest())\n" +">>> h10.update(h01.digest())\n" +">>> h10.hexdigest()\n" +"'3ad2a9b37c6070e374c7a8c508fe20ca86b6ed54e286e93a0318e95e881db5aa'" #: ../../library/hashlib.rst:776 msgid "Credits" @@ -1013,26 +1219,33 @@ msgstr "" "以下の public domain dedicationが、Cのハッシュ関数実装と、拡張コードと、この" "ドキュメントに適用されます:" -#: ../../library/hashlib.rst:794 msgid "" "To the extent possible under law, the author(s) have dedicated all copyright " "and related and neighboring rights to this software to the public domain " "worldwide. This software is distributed without any warranty." msgstr "" +"法律上可能な範囲で、著作者は、このソフトウェアに関するすべての著作権および関" +"連する権利・著作隣接権を、世界中でパブリックドメインに提供しています。\n" +"このソフトウェアは、いかなる保証もなく配布されています。" -#: ../../library/hashlib.rst:798 msgid "" "You should have received a copy of the CC0 Public Domain Dedication along " "with this software. If not, see https://creativecommons.org/publicdomain/" "zero/1.0/." msgstr "" +"このソフトウェアには CC0 Public Domain Dedication のコピーが同梱されているは" +"ずです。\n" +"ない場合は https://creativecommons.org/publicdomain/zero/1.0/ を参照してくだ" +"さい。" -#: ../../library/hashlib.rst:802 msgid "" "The following people have helped with development or contributed their " "changes to the project and the public domain according to the Creative " "Commons Public Domain Dedication 1.0 Universal:" msgstr "" +"以下の人々は開発を支援し、または Creative Commons Public Domain Dedication " +"1.0 Universal に従って、変更内容をプロジェクトおよびパブリックドメインに提供" +"しました。" #: ../../library/hashlib.rst:806 msgid "*Alexandr Sokolovskiy*" @@ -1055,33 +1268,27 @@ msgid "Another way to encode binary hashes for non-binary environments." msgstr "" "バイナリハッシュを非バイナリ環境用にエンコードするもうひとつの方法です。" -#: ../../library/hashlib.rst:833 msgid "https://nvlpubs.nist.gov/nistpubs/fips/nist.fips.180-4.pdf" -msgstr "" +msgstr "https://nvlpubs.nist.gov/nistpubs/fips/nist.fips.180-4.pdf" -#: ../../library/hashlib.rst:834 msgid "The FIPS 180-4 publication on Secure Hash Algorithms." -msgstr "" +msgstr "セキュアハッシュアルゴリズムに関する FIPS 180-4 の刊行物。" -#: ../../library/hashlib.rst:836 msgid "https://csrc.nist.gov/pubs/fips/202/final" -msgstr "" +msgstr "https://csrc.nist.gov/pubs/fips/202/final" -#: ../../library/hashlib.rst:837 msgid "The FIPS 202 publication on the SHA-3 Standard." -msgstr "" +msgstr "SHA-3 標準に関する FIPS 202 の刊行物。" -#: ../../library/hashlib.rst:839 msgid "https://www.blake2.net/" -msgstr "" +msgstr "https://www.blake2.net/" #: ../../library/hashlib.rst:840 msgid "Official BLAKE2 website." msgstr "BLAKE2 の公式ウェブサイト" -#: ../../library/hashlib.rst:842 msgid "https://en.wikipedia.org/wiki/Cryptographic_hash_function" -msgstr "" +msgstr "https://en.wikipedia.org/wiki/Cryptographic_hash_function" #: ../../library/hashlib.rst:843 msgid "" @@ -1093,39 +1300,36 @@ msgstr "" #: ../../library/hashlib.rst:846 msgid "https://www.ietf.org/rfc/rfc8018.txt" -msgstr "" +msgstr "https://www.ietf.org/rfc/rfc8018.txt" -#: ../../library/hashlib.rst:847 msgid "PKCS #5: Password-Based Cryptography Specification Version 2.1" -msgstr "" +msgstr "PKCS #5: パスワードに基づく暗号仕様 バージョン 2.1" #: ../../library/hashlib.rst:849 msgid "" "https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf" msgstr "" +"https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf" -#: ../../library/hashlib.rst:850 msgid "NIST Recommendation for Password-Based Key Derivation." -msgstr "" +msgstr "パスワードに基づく鍵導出についての NIST の推奨事項。" -#: ../../library/hashlib.rst:12 msgid "message digest, MD5" -msgstr "" +msgstr "メッセージダイジェスト、MD5" -#: ../../library/hashlib.rst:12 msgid "" "secure hash algorithm, SHA1, SHA2, SHA224, SHA256, SHA384, SHA512, SHA3, " "Shake, Blake2" msgstr "" +"セキュアハッシュアルゴリズム、SHA1、SHA2、SHA224、SHA256、SHA384、SHA512、" +"SHA3、Shake、Blake2" #: ../../library/hashlib.rst:53 msgid "OpenSSL" msgstr "OpenSSL" -#: ../../library/hashlib.rst:53 msgid "(use in module hashlib)" -msgstr "" +msgstr "(hashlib モジュールでの使用)" -#: ../../library/hashlib.rst:377 msgid "blake2b, blake2s" -msgstr "" +msgstr "blake2b, blake2s" diff --git a/library/heapq.po b/library/heapq.po index 0c98237fe..c56c332b5 100644 --- a/library/heapq.po +++ b/library/heapq.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/heapq.rst:2 @@ -40,14 +40,14 @@ msgstr "" "このモジュールではヒープキューアルゴリズムの一実装を提供しています。優先度" "キューアルゴリズムとしても知られています。" -#: ../../library/heapq.rst:19 msgid "" "Min-heaps are binary trees for which every parent node has a value less than " "or equal to any of its children. We refer to this condition as the heap " "invariant." msgstr "" +"最小ヒープは、各親ノードの値がそのどの子ノードの値以下でもある二分木です。\n" +"この条件をヒープ不変式と呼びます。" -#: ../../library/heapq.rst:23 msgid "" "For min-heaps, this implementation uses lists for which ``heap[k] <= " "heap[2*k+1]`` and ``heap[k] <= heap[2*k+2]`` for all *k* for which the " @@ -55,6 +55,11 @@ msgid "" "property of a min-heap is that its smallest element is always the root, " "``heap[0]``." msgstr "" +"この実装では最小ヒープをリストで表し、比較する要素が存在するすべての *k* につ" +"いて ``heap[k] <= heap[2*k+1]`` および ``heap[k] <= heap[2*k+2]`` が成り立ち" +"ます。\n" +"要素は 0 から数えます。\n" +"最小ヒープの興味深い性質は、最小の要素が常に根の ``heap[0]`` にあることです。" #: ../../library/heapq.rst:29 msgid "" @@ -66,7 +71,6 @@ msgid "" "max-heap invariant." msgstr "" -#: ../../library/heapq.rst:36 msgid "" "The :mod:`!heapq` API differs from textbook heap algorithms in two aspects: " "(a) We use zero-based indexing. This makes the relationship between the " @@ -76,63 +80,80 @@ msgid "" "implementation favors min-heaps as they better correspond to Python :class:" "`lists `." msgstr "" +":mod:`!heapq` の API は、教科書に載っているヒープアルゴリズムと 2 つの点で異" +"なります。\n" +"(a) インデックスを 0 から数えます。\n" +"これにより、あるノードのインデックスとその子のインデックスの関係がやや分かり" +"にくくなりますが、Python のインデックスは 0 から始まるため、この方が適してい" +"ます。\n" +"(b) 教科書では、その場でのソートに適した最大ヒープを中心に扱うことがよくあり" +"ます。\n" +"この実装では Python の :class:`リスト ` によりよく対応する最小ヒープを" +"中心に扱います。" -#: ../../library/heapq.rst:43 msgid "" "These two aspects make it possible to view the heap as a regular Python list " "without surprises: ``heap[0]`` is the smallest item, and ``heap.sort()`` " "maintains the heap invariant!" msgstr "" +"この 2 つの特徴により、ヒープを通常の Python リストとして自然に扱えます。\n" +"``heap[0]`` が最小の要素で、``heap.sort()`` を実行してもヒープ不変式が保たれ" +"ます!" -#: ../../library/heapq.rst:47 msgid "" "Like :meth:`list.sort`, this implementation uses only the ``<`` operator for " "comparisons, for both min-heaps and max-heaps." msgstr "" +":meth:`list.sort` と同様、この実装では最小ヒープと最大ヒープのどちらでも、比" +"較に ``<`` 演算子だけを使います。" -#: ../../library/heapq.rst:50 msgid "" "In the API below, and in this documentation, the unqualified term *heap* " "generally refers to a min-heap. The API for max-heaps is named using a " "``_max`` suffix." msgstr "" +"以下の API とこのドキュメントでは、単に *ヒープ* と呼ぶ場合は一般に最小ヒープ" +"を指します。\n" +"最大ヒープの API の名前には ``_max`` 接尾辞が付いています。" -#: ../../library/heapq.rst:54 msgid "" "To create a heap, use a list initialized as ``[]``, or transform an existing " "list into a min-heap or max-heap using the :func:`heapify` or :func:" "`heapify_max` functions, respectively." msgstr "" +"ヒープを作るには、``[]`` で初期化したリストを使うか、既存のリストを :func:" +"`heapify` または :func:`heapify_max` 関数でそれぞれ最小ヒープまたは最大ヒープ" +"に変換します。" -#: ../../library/heapq.rst:58 msgid "The following functions are provided for min-heaps:" -msgstr "" +msgstr "最小ヒープには次の関数が用意されています。" -#: ../../library/heapq.rst:63 msgid "" "Push the value *item* onto the *heap*, maintaining the min-heap invariant." -msgstr "" +msgstr "最小ヒープの不変式を保ちながら、値 *item* を *heap* に追加します。" -#: ../../library/heapq.rst:68 msgid "" "Pop and return the smallest item from the *heap*, maintaining the min-heap " "invariant. If the heap is empty, :exc:`IndexError` is raised. To access " "the smallest item without popping it, use ``heap[0]``." msgstr "" +"最小ヒープの不変式を保ちながら、*heap* の最小の要素を取り出して返します。\n" +"ヒープが空の場合は :exc:`IndexError` を送出します。\n" +"最小の要素を削除せずに参照するには ``heap[0]`` を使ってください。" -#: ../../library/heapq.rst:75 msgid "" "Push *item* on the heap, then pop and return the smallest item from the " "*heap*. The combined action runs more efficiently than :func:`heappush` " "followed by a separate call to :func:`heappop`." msgstr "" -"*item* を *heap* に push した後、pop を行って *heap* から最初の要素を返しま" -"す。この一続きの動作を :func:`heappush` に引き続いて :func:`heappop` を別々に" -"呼び出すよりも効率的に実行します。" +"*item* を *heap* に追加し、その後で最小の要素を取り出して返します。\n" +"この操作は、:func:`heappush` に続けて :func:`heappop` を個別に呼び出すより効" +"率的です。" -#: ../../library/heapq.rst:82 msgid "Transform list *x* into a min-heap, in-place, in linear time." msgstr "" +"リスト *x* をその場で最小ヒープに変換します。\n" +"処理時間は要素数に比例します。" #: ../../library/heapq.rst:87 msgid "" @@ -143,16 +164,16 @@ msgstr "" "*heap* から最小の要素を pop して返し、新たに *item* を push します。ヒープの" "サイズは変更されません。ヒープが空の場合、 :exc:`IndexError` が送出されます。" -#: ../../library/heapq.rst:90 msgid "" "This one step operation is more efficient than a :func:`heappop` followed " "by :func:`heappush` and can be more appropriate when using a fixed-size " "heap. The pop/push combination always returns an element from the heap and " "replaces it with *item*." msgstr "" -"この一息の演算は :func:`heappop` に次いで :func:`heappush` を送出するよりも効" -"率的で、固定サイズのヒープを用いている場合にはより適しています。 pop/push の" -"組み合わせは必ずヒープから要素を一つ返し、それを *item* と置き換えます。" +"この 1 回の操作は、:func:`heappop` に続けて :func:`heappush` を呼び出すより効" +"率的で、固定サイズのヒープを使う場合により適していることがあります。\n" +"pop/push の組み合わせは常にヒープから要素を返し、その要素を *item* で置き換え" +"ます。" #: ../../library/heapq.rst:95 msgid "" @@ -165,46 +186,57 @@ msgstr "" "なら、代わりに :func:`heappushpop` を使うことを考えてください。この push/pop " "の組み合わせは二つの値の小さい方を返し、大きい方の値をヒープに残します。" -#: ../../library/heapq.rst:101 msgid "For max-heaps, the following functions are provided:" -msgstr "" +msgstr "最大ヒープには次の関数が用意されています。" -#: ../../library/heapq.rst:106 msgid "Transform list *x* into a max-heap, in-place, in linear time." msgstr "" +"リスト *x* をその場で最大ヒープに変換します。\n" +"処理時間は要素数に比例します。" -#: ../../library/heapq.rst:113 msgid "" "Push the value *item* onto the max-heap *heap*, maintaining the max-heap " "invariant." msgstr "" +"最大ヒープの不変式を保ちながら、値 *item* を最大ヒープ *heap* に追加します。" -#: ../../library/heapq.rst:121 msgid "" "Pop and return the largest item from the max-heap *heap*, maintaining the " "max-heap invariant. If the max-heap is empty, :exc:`IndexError` is raised. " "To access the largest item without popping it, use ``maxheap[0]``." msgstr "" +"最大ヒープの不変式を保ちながら、最大ヒープ *heap* の最大の要素を取り出して返" +"します。\n" +"最大ヒープが空の場合は :exc:`IndexError` を送出します。\n" +"最大の要素を削除せずに参照するには ``maxheap[0]`` を使ってください。" -#: ../../library/heapq.rst:130 msgid "" "Push *item* on the max-heap *heap*, then pop and return the largest item " "from *heap*. The combined action runs more efficiently than :func:" "`heappush_max` followed by a separate call to :func:`heappop_max`." msgstr "" +"*item* を最大ヒープ *heap* に追加し、その後で *heap* の最大の要素を取り出して" +"返します。\n" +"この操作は、:func:`heappush_max` に続けて :func:`heappop_max` を個別に呼び出" +"すより効率的です。" -#: ../../library/heapq.rst:140 msgid "" "Pop and return the largest item from the max-heap *heap* and also push the " "new *item*. The max-heap size doesn't change. If the max-heap is empty, :exc:" "`IndexError` is raised." msgstr "" +"最大ヒープ *heap* の最大の要素を取り出して返すとともに、新たに *item* を追加" +"します。\n" +"最大ヒープのサイズは変わりません。\n" +"最大ヒープが空の場合は :exc:`IndexError` を送出します。" -#: ../../library/heapq.rst:145 msgid "" "The value returned may be smaller than the *item* added. Refer to the " "analogous function :func:`heapreplace` for detailed usage notes." msgstr "" +"返される値は、追加した *item* より小さい場合があります。\n" +"詳しい使い方の注意点については、対応する関数 :func:`heapreplace` を参照してく" +"ださい。" #: ../../library/heapq.rst:151 msgid "The module also offers three general purpose functions based on heaps." @@ -247,17 +279,16 @@ msgstr "" "力の各要素から比較のキーを取り出すのに使われます。デフォルト値は ``None`` で" "す (要素を直接比較します)。" -#: ../../library/heapq.rst:170 msgid "" "*reverse* is a boolean value. If set to ``True``, then the input elements " "are merged as if each comparison were reversed. To achieve behavior similar " "to ``sorted(itertools.chain(*iterables), reverse=True)``, all iterables must " "be sorted from largest to smallest." msgstr "" -"*reverse* は真偽値です。 ``True`` を設定した場合、挿入要素は逆向きに比較され" -"たかのように結合されます。 ``sorted(itertools.chain(*iterables), " -"reverse=True)`` でこれに似た挙動を実現するには、全てのイテラブルは降順で並ん" -"でいなければなりません。" +"*reverse* は真偽値です。\n" +"``True`` の場合は比較の向きを逆にして入力要素をマージします。\n" +"``sorted(itertools.chain(*iterables), reverse=True)`` と同様の動作にするに" +"は、すべての入力イテラブルをあらかじめ降順にソートしておく必要があります。" #: ../../library/heapq.rst:175 msgid "Added the optional *key* and *reverse* parameters." @@ -316,7 +347,6 @@ msgstr "" "ソート `_ を実装できます::" -#: ../../library/heapq.rst:210 msgid "" ">>> def heapsort(iterable):\n" "... h = []\n" @@ -327,6 +357,14 @@ msgid "" ">>> heapsort([1, 3, 5, 7, 9, 2, 4, 6, 8, 0])\n" "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]" msgstr "" +">>> def heapsort(iterable):\n" +"... h = []\n" +"... for value in iterable:\n" +"... heappush(h, value)\n" +"... return [heappop(h) for i in range(len(h))]\n" +"...\n" +">>> heapsort([1, 3, 5, 7, 9, 2, 4, 6, 8, 0])\n" +"[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]" #: ../../library/heapq.rst:219 msgid "" @@ -344,7 +382,6 @@ msgstr "" "ヒープの要素はタプルに出来ます。これは、追跡される主レコードとは別に (タスク" "の優先度のような) 比較値を指定するときに便利です::" -#: ../../library/heapq.rst:225 msgid "" ">>> h = []\n" ">>> heappush(h, (5, 'write code'))\n" @@ -354,6 +391,13 @@ msgid "" ">>> heappop(h)\n" "(1, 'write spec')" msgstr "" +">>> h = []\n" +">>> heappush(h, (5, 'write code'))\n" +">>> heappush(h, (7, 'release product'))\n" +">>> heappush(h, (1, 'write spec'))\n" +">>> heappush(h, (3, 'create tests'))\n" +">>> heappop(h)\n" +"(1, 'write spec')" #: ../../library/heapq.rst:235 msgid "Priority Queue Implementation Notes" @@ -392,13 +436,12 @@ msgstr "" "あるタスクの優先度が変化したら、どうやってそれをヒープの新しい位置に移動させ" "るのでしょうか?" -#: ../../library/heapq.rst:249 msgid "" "Or if a pending task needs to be deleted, how do you find it and remove it " "from the queue?" msgstr "" -"未解決のタスクが削除される必要があるとき、どのようにそれをキューから探して削" -"除するのでしょうか?" +"処理待ちのタスクを削除する必要がある場合、キュー内でどのように見つけて削除す" +"ればよいでしょうか?" #: ../../library/heapq.rst:252 msgid "" @@ -423,7 +466,6 @@ msgstr "" "比較できないタスク問題のもう一つの解決法は、タスクアイテムを無視して優先順序" "フィールドだけで比較するラッパークラスです::" -#: ../../library/heapq.rst:261 msgid "" "from dataclasses import dataclass, field\n" "from typing import Any\n" @@ -433,16 +475,22 @@ msgid "" " priority: int\n" " item: Any=field(compare=False)" msgstr "" +"from dataclasses import dataclass, field\n" +"from typing import Any\n" +"\n" +"@dataclass(order=True)\n" +"class PrioritizedItem:\n" +" priority: int\n" +" item: Any=field(compare=False)" -#: ../../library/heapq.rst:269 msgid "" "The remaining challenges revolve around finding a pending task and making " "changes to its priority or removing it entirely. Finding a task can be done " "with a dictionary pointing to an entry in the queue." msgstr "" -"残りの困難は主に、未解決のタスクを探して、その優先度を変更したり、完全に削除" -"することです。タスクを探すことは、キュー内の項目を指し示す辞書によってなされ" -"ます。" +"残る課題は、処理待ちのタスクを見つけて優先度を変更したり、完全に削除したりす" +"ることです。\n" +"キュー内の項目を参照する辞書を使えば、タスクを見つけられます。" #: ../../library/heapq.rst:273 msgid "" @@ -454,7 +502,6 @@ msgstr "" "るので、もっと難しいです。ですから、可能な解決策は、その項目が無効であるもの" "としてマークし、必要なら変更された優先度の項目を加えることです::" -#: ../../library/heapq.rst:277 msgid "" "pq = [] # list of entries arranged in a heap\n" "entry_finder = {} # mapping of tasks to entries\n" @@ -484,6 +531,37 @@ msgid "" " return task\n" " raise KeyError('pop from an empty priority queue')" msgstr "" +"pq = [] # 項目をヒープ順に並べたリスト\n" +"entry_finder = {} # タスクから項目へのマッピング\n" +"REMOVED = '' # 削除したタスクのプレースホルダー\n" +"counter = itertools.count() # 重複しない連番\n" +"\n" +"def add_task(task, priority=0):\n" +" '新しいタスクを追加するか、既存のタスクの優先度を更新します'\n" +" if task in entry_finder:\n" +" remove_task(task)\n" +" count = next(counter)\n" +" entry = [priority, count, task]\n" +" entry_finder[task] = entry\n" +" heappush(pq, entry)\n" +"\n" +"def remove_task(task):\n" +" \"\"\"既存のタスクを REMOVED とマークします。\n" +" 見つからない場合は KeyError を送出します。\n" +" \"\"\"\n" +" entry = entry_finder.pop(task)\n" +" entry[-1] = REMOVED\n" +"\n" +"def pop_task():\n" +" \"\"\"優先度の値が最小のタスクを削除して返します。\n" +" 空の場合は KeyError を送出します。\n" +" \"\"\"\n" +" while pq:\n" +" priority, count, task = heappop(pq)\n" +" if task is not REMOVED:\n" +" del entry_finder[task]\n" +" return task\n" +" raise KeyError('pop from an empty priority queue')" #: ../../library/heapq.rst:307 msgid "Theory" @@ -522,7 +600,6 @@ msgid "" "15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30" msgstr "" -#: ../../library/heapq.rst:327 msgid "" "In the tree above, each cell *k* is topping ``2*k+1`` and ``2*k+2``. In a " "usual binary tournament we see in sports, each cell is the winner over the " @@ -534,14 +611,16 @@ msgid "" "two cells it tops contain three different items, but the top cell \"wins\" " "over the two topped cells." msgstr "" -"上の木構造では、各セル *k* は ``2*k+1`` および ``2*k+2`` を最大値としていま" -"す。スポーツに見られるような通常の 2 つ組勝ち抜き戦では、各セルはその下にある" -"二つのセルに対する勝者となっていて、個々のセルの勝者を追跡していくことによ" -"り、そのセルに対する全ての相手を見ることができます。しかしながら、このような" -"勝ち抜き戦を使う計算機アプリケーションの多くでは、勝歴を追跡する必要はりませ" -"ん。メモリ効率をより高めるために、勝者が上位に進級した際、下のレベルから持っ" -"てきて置き換えることにすると、あるセルとその下位にある二つのセルは異なる三つ" -"の要素を含み、かつ上位のセルは二つの下位のセルに対して \"勝者と\" なります。" +"上の木構造では、各セル *k* の直下に ``2*k+1`` と ``2*k+2`` があります。\n" +"スポーツで見る通常の勝ち抜き戦では、各セルはその直下の 2 つのセルに対する勝者" +"を表します。\n" +"勝者を木の下方へたどると、それまでに対戦した相手をすべて確認できます。\n" +"しかし、コンピューターでこのような勝ち抜き戦を利用する場合、勝者の履歴をたど" +"る必要がないことも多くあります。\n" +"メモリを節約するため、勝者を上位へ進めたら、空いた場所を下位の別の要素で置き" +"換えます。\n" +"この場合の規則は、あるセルとその直下の 2 つのセルが異なる 3 つの要素を持ち、" +"上のセルが下の 2 つのセルに「勝つ」というものになります。" #: ../../library/heapq.rst:336 msgid "" @@ -595,7 +674,6 @@ msgstr "" "どい速度になるとしても、全体的にはより効率の高い他のデータ構造表現も存在しま" "す。" -#: ../../library/heapq.rst:358 msgid "" "Heaps are also very useful in big disk sorts. You most probably all know " "that a big sort implies producing \"runs\" (which are pre-sorted sequences, " @@ -608,17 +686,18 @@ msgid "" "which are twice the size of the memory for random input, and much better for " "input fuzzily ordered." msgstr "" -"ヒープはまた、巨大なディスクのソートでも非常に有用です。おそらくご存知のよう" -"に、巨大なソートを行うと、複数の \"ラン (run)\" (予めソートされた配列で、その" -"サイズは通常 CPU メモリの量に関係しています) が生成され、続いて統合処理 " -"(merging) がこれらのランを判定します。この統合処理はしばしば非常に巧妙に組織" -"されています [#]_。重要なのは、最初のソートが可能な限り長いランを生成すること" -"です。勝ち抜き戦はこれを達成するための良い方法です。もし利用可能な全てのメモ" -"リを使って勝ち抜き戦を行い、要素を置換および濾過処理して現在のランに収めれ" -"ば、ランダムな入力に対してメモリの二倍のサイズのランを生成することになり、大" -"体順序づけがなされている入力に対してはもっと高い効率になります。" +"ヒープはディスク上の大量のデータのソートにも非常に役立ちます。\n" +"ご存じのように、大規模なソートではまず「ラン」(ソート済みのシーケンスで、その" +"大きさは通常、主記憶の容量に関係します) を生成し、続いてこれらのランをマージ" +"します。\n" +"このマージ処理は非常に巧妙に組み立てられることがよくあります [#]_。\n" +"最初のソートで、できるだけ長いランを生成することが重要です。\n" +"勝ち抜き戦はそのための良い方法です。\n" +"利用可能なメモリをすべて使って勝ち抜き戦を保持し、現在のランに収まる要素を置" +"き換えて木の下方へ移動させると、ランダムな入力に対してはメモリ容量の 2 倍の長" +"さのランを生成できます。\n" +"おおむね順序の揃った入力なら、さらに長いランを生成できます。" -#: ../../library/heapq.rst:368 msgid "" "Moreover, if you output the 0'th item on disk and get an input which may not " "fit in the current tournament (because the value \"wins\" over the last " @@ -628,12 +707,14 @@ msgid "" "the first heap is melting. When the first heap completely vanishes, you " "switch heaps and start a new run. Clever and quite effective!" msgstr "" -"さらに、ディスク上の 0 番目の要素を出力して、現在の勝ち抜き戦に (最後に出力し" -"た値に \"勝って\" しまうために) 収められない入力を得たなら、ヒープには収まら" -"ないため、ヒープのサイズは減少します。解放されたメモリは二つ目のヒープを段階" -"的に構築するために巧妙に再利用することができ、この二つ目のヒープは最初のヒー" -"プが崩壊していくのと同じ速度で成長します。最初のヒープが完全に消滅したら、" -"ヒープを切り替えて新たなランを開始します。なんと巧妙で効率的なのでしょう!" +"さらに、0 番目の要素をディスクに出力して、現在の勝ち抜き戦に (最後に出力した" +"値に \"勝って\" しまうために) 収められない入力を得たなら、ヒープには収まらな" +"いため、ヒープのサイズは減少します。\n" +"解放されたメモリは二つ目のヒープを段階的に構築するために巧妙に再利用すること" +"ができ、この二つ目のヒープは最初のヒープが崩壊していくのと同じ速度で成長しま" +"す。\n" +"最初のヒープが完全に消滅したら、ヒープを切り替えて新たなランを開始します。\n" +"なんと巧妙で効率的なのでしょう!" #: ../../library/heapq.rst:376 msgid "" diff --git a/library/hmac.po b/library/hmac.po index eca7a98f8..f9ffd1c7d 100644 --- a/library/hmac.po +++ b/library/hmac.po @@ -17,10 +17,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/hmac.rst:2 @@ -37,7 +37,6 @@ msgstr "" "このモジュールでは :rfc:`2104` で記述されている HMAC アルゴリズムを実装してい" "ます。" -#: ../../library/hmac.rst:19 msgid "" "Return a new hmac object. *key* is a bytes or bytearray object giving the " "secret key. If *msg* is present, the method call ``update(msg)`` is made. " @@ -45,6 +44,13 @@ msgid "" "object to use. It may be any name suitable to :func:`hashlib.new`. Despite " "its argument position, it is required." msgstr "" +"新しい hmac オブジェクトを返します。\n" +"*key* は秘密鍵を指定する bytes または bytearray オブジェクトです。\n" +"*msg* が指定されていれば、メソッド ``update(msg)`` を呼び出します。\n" +"*digestmod* は HMAC オブジェクトで使うダイジェストの名前、コンストラクタ、ま" +"たはモジュールです。\n" +"名前には :func:`hashlib.new` に指定できるものを使えます。\n" +"引数の位置にかかわらず、指定は必須です。" #: ../../library/hmac.rst:25 msgid "" @@ -56,13 +62,14 @@ msgstr "" "数 *msg* に :mod:`hashlib` がサポートする全てのタイプを渡せるようになりまし" "た。引数 *digestmod* にハッシュアルゴリズム名を渡せるようになりました。" -#: ../../library/hmac.rst:30 msgid "" "The *digestmod* argument is now required. Pass it as a keyword argument to " "avoid awkwardness when you do not have an initial *msg*." msgstr "" +"*digestmod* 引数の指定が必須になりました。\n" +"初期値の *msg* がない場合は、呼び出しが煩雑になるのを避けるためにキーワード引" +"数として渡してください。" -#: ../../library/hmac.rst:37 msgid "" "Return digest of *msg* for given secret *key* and *digest*. The function is " "equivalent to ``HMAC(key, msg, digest).digest()``, but uses an optimized C " @@ -70,20 +77,21 @@ msgid "" "The parameters *key*, *msg*, and *digest* have the same meaning as in :func:" "`~hmac.new`." msgstr "" -"与えられたsecret *key* と *digest* の *msg* のダイジェストを返します。この関" -"数は ``HMAC(key, msg, digest).digest()`` に似ていますが、最適化されたCやイン" -"ラインの実装を使用しており、メモリに収まるメッセージに対しては高速です。パラ" -"メータ *key* 、 *msg* 、および *digest* は、 :func:`~hmac.new` と同じ意味を持" -"ちます。" +"指定された秘密鍵 *key* と *digest* を使って *msg* のダイジェストを返しま" +"す。\n" +"この関数は ``HMAC(key, msg, digest).digest()`` と同等ですが、最適化された C " +"の実装またはインライン実装を使うため、メモリに収まるメッセージではより高速で" +"す。\n" +"引数 *key*、*msg*、*digest* の意味は :func:`~hmac.new` と同じです。" -#: ../../library/hmac.rst:43 msgid "" "CPython implementation detail, the optimized C implementation is only used " "when *digest* is a string and name of a digest algorithm, which is supported " "by OpenSSL." msgstr "" -"CPython実装の詳細、最適化されたC実装は、OpenSSLがサポートするダイジェストアル" -"ゴリズムの文字列と名前が *digest* の場合にのみ使用されます。" +"CPython の実装上の詳細として、最適化された C 実装が使われるのは、*digest* が " +"OpenSSL でサポートされているダイジェストアルゴリズムの名前を表す文字列の場合" +"だけです。" #: ../../library/hmac.rst:50 msgid "An HMAC object has the following methods:" @@ -104,24 +112,27 @@ msgid "Parameter *msg* can be of any type supported by :mod:`hashlib`." msgstr "" "引数 *msg* は :mod:`hashlib` がサポートしているあらゆる型のいずれかです。" -#: ../../library/hmac.rst:64 msgid "" "Return the digest of the bytes passed to the :meth:`update` method so far. " "This bytes object will be the same length as the *digest_size* of the digest " "given to the constructor. It may contain non-ASCII bytes, including NUL " "bytes." msgstr "" -"これまで :meth:`update` メソッドに渡されたバイト列のダイジェスト値を返しま" -"す。これはコンストラクタに与えられた *digest_size* と同じ長さのバイト列で、 " -"NUL バイトを含む非 ASCII 文字が含まれることがあります。" +"これまで :meth:`update` メソッドに渡されたバイト列のダイジェストを返しま" +"す。\n" +"返される bytes オブジェクトの長さは、コンストラクタに指定したダイジェストの " +"*digest_size* と同じです。\n" +"NUL バイトを含め、非 ASCII のバイトが含まれることがあります。" -#: ../../library/hmac.rst:71 msgid "" "When comparing the output of :meth:`digest` to an externally supplied digest " "during a verification routine, it is recommended to use the :func:" "`compare_digest` function instead of the ``==`` operator to reduce the " "vulnerability to timing attacks." msgstr "" +"検証処理で :meth:`digest` の出力を外部から与えられたダイジェストと比較すると" +"きは、タイミング攻撃に対する脆弱性を軽減するため、\n" +"``==`` 演算子の代わりに :func:`compare_digest` 関数を使うことを推奨します。" #: ../../library/hmac.rst:79 msgid "" @@ -132,13 +143,15 @@ msgstr "" ":meth:`digest` と似ていますが、返される文字列は倍の長さとなり、16進形式となり" "ます。これは、電子メールなどの非バイナリ環境で値を交換する場合に便利です。" -#: ../../library/hmac.rst:85 msgid "" "When comparing the output of :meth:`hexdigest` to an externally supplied " "digest during a verification routine, it is recommended to use the :func:" "`compare_digest` function instead of the ``==`` operator to reduce the " "vulnerability to timing attacks." msgstr "" +"検証処理で :meth:`hexdigest` の出力を外部から与えられたダイジェストと比較する" +"ときは、タイミング攻撃に対する脆弱性を軽減するため、\n" +"``==`` 演算子の代わりに :func:`compare_digest` 関数を使うことを推奨します。" #: ../../library/hmac.rst:93 msgid "" @@ -166,11 +179,12 @@ msgstr "内部で使われるハッシュアルゴリズムのブロックのバ msgid "The canonical name of this HMAC, always lowercase, e.g. ``hmac-md5``." msgstr "このHMAC の正規名で、例えば ``hmac-md5`` のように常に小文字です。" -#: ../../library/hmac.rst:116 msgid "" "Removed the undocumented attributes ``HMAC.digest_cons``, ``HMAC.inner``, " "and ``HMAC.outer``." msgstr "" +"ドキュメントに記載されていなかった属性 ``HMAC.digest_cons``、``HMAC.inner``、" +"``HMAC.outer`` を削除しました。" #: ../../library/hmac.rst:120 msgid "This module also provides the following helper function:" @@ -190,20 +204,20 @@ msgstr "" "えば :meth:`HMAC.hexdigest` が返したような ASCII のみの) :class:`str` また" "は :term:`bytes-like object` のどちらか一方。" -#: ../../library/hmac.rst:132 msgid "" "If *a* and *b* are of different lengths, or if an error occurs, a timing " "attack could theoretically reveal information about the types and lengths of " "*a* and *b*—but not their values." msgstr "" -"*a* と *b* が異なる長さであったりエラーが発生した場合には、タイミング攻撃で理" -"論上 *a* と *b* の型と長さについての情報が暴露されますが、その値は明らかにな" -"りません。" +"*a* と *b* の長さが異なる場合やエラーが発生した場合、理論上はタイミング攻撃に" +"よって *a* と *b* の型や長さに関する情報が漏れる可能性がありますが、値は漏れ" +"ません。" -#: ../../library/hmac.rst:140 msgid "" "The function uses OpenSSL's ``CRYPTO_memcmp()`` internally when available." msgstr "" +"OpenSSL の ``CRYPTO_memcmp()`` が利用可能な場合、この関数は内部でそれを使いま" +"す。" #: ../../library/hmac.rst:146 msgid "Module :mod:`hashlib`" diff --git a/library/html.entities.po b/library/html.entities.po index dce2739f5..ee5c2eb24 100644 --- a/library/html.entities.po +++ b/library/html.entities.po @@ -17,10 +17,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/html.entities.rst:2 diff --git a/library/html.parser.po b/library/html.parser.po index 7c32bee84..81f9fd867 100644 --- a/library/html.parser.po +++ b/library/html.parser.po @@ -20,10 +20,10 @@ msgstr "" "Last-Translator: Atsuo Ishimoto , 2025\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/html.parser.rst:2 @@ -58,17 +58,17 @@ msgstr "" "(``script``/``style`` 要素にあるものは除く) は自動的に対応する Unicode 文字に" "変換されます。" -#: ../../library/html.parser.rst:26 msgid "" "An :class:`.HTMLParser` instance is fed HTML data and calls handler methods " "when start tags, end tags, text, comments, and other markup elements are " "encountered. The user should subclass :class:`.HTMLParser` and override its " "methods to implement the desired behavior." msgstr "" -":class:`.HTMLParser` インスタンスは、HTML データが入力されると、開始タグ、終" -"了タグ、およびその他の要素が見つかる度にハンドラーメソッドを呼び出します。各" -"メソッドの挙動を実装するには :class:`.HTMLParser` サブクラスを使ってそれぞれ" -"を上書きして行います。" +":class:`.HTMLParser` インスタンスに HTML データを渡すと、開始タグ、終了タグ、" +"テキスト、コメント、その他のマークアップ要素を見つけるたびにハンドラーメソッ" +"ドを呼び出します。\n" +"利用者は :class:`.HTMLParser` のサブクラスを作り、メソッドをオーバーライドし" +"て必要な動作を実装します。" #: ../../library/html.parser.rst:31 msgid "" @@ -92,14 +92,14 @@ msgstr "*convert_charrefs* のデフォルト値は ``True`` になりました msgid "Example HTML Parser Application" msgstr "HTML パーサーアプリケーションの例" -#: ../../library/html.parser.rst:44 msgid "" "As a basic example, below is a simple HTML parser that uses the :class:" "`HTMLParser` class to print out start tags, end tags, and data as they are " "encountered:" msgstr "" +"基本的な例として、以下は :class:`HTMLParser` クラスを使い、開始タグ、終了タ" +"グ、データを見つけるたびに表示するシンプルな HTML パーサーです。" -#: ../../library/html.parser.rst:48 msgid "" "from html.parser import HTMLParser\n" "\n" @@ -117,12 +117,26 @@ msgid "" "parser.feed('Test'\n" " '

Parse me!

')" msgstr "" +"from html.parser import HTMLParser\n" +"\n" +"class MyHTMLParser(HTMLParser):\n" +" def handle_starttag(self, tag, attrs):\n" +" print(\"Encountered a start tag:\", tag)\n" +"\n" +" def handle_endtag(self, tag):\n" +" print(\"Encountered an end tag :\", tag)\n" +"\n" +" def handle_data(self, data):\n" +" print(\"Encountered some data :\", data)\n" +"\n" +"parser = MyHTMLParser()\n" +"parser.feed('Test'\n" +" '

Parse me!

')" #: ../../library/html.parser.rst:66 msgid "The output will then be:" msgstr "出力は以下のようになります:" -#: ../../library/html.parser.rst:68 msgid "" "Encountered a start tag: html\n" "Encountered a start tag: head\n" @@ -137,6 +151,18 @@ msgid "" "Encountered an end tag : body\n" "Encountered an end tag : html" msgstr "" +"Encountered a start tag: html\n" +"Encountered a start tag: head\n" +"Encountered a start tag: title\n" +"Encountered some data : Test\n" +"Encountered an end tag : title\n" +"Encountered an end tag : head\n" +"Encountered a start tag: body\n" +"Encountered a start tag: h1\n" +"Encountered some data : Parse me!\n" +"Encountered an end tag : h1\n" +"Encountered an end tag : body\n" +"Encountered an end tag : html" #: ../../library/html.parser.rst:85 msgid ":class:`.HTMLParser` Methods" @@ -146,16 +172,15 @@ msgstr ":class:`.HTMLParser` メソッド" msgid ":class:`HTMLParser` instances have the following methods:" msgstr ":class:`HTMLParser` インスタンスは以下のメソッドを提供します:" -#: ../../library/html.parser.rst:92 msgid "" "Feed some text to the parser. It is processed insofar as it consists of " "complete elements; incomplete data is buffered until more data is fed or :" "meth:`close` is called. *data* must be :class:`str`." msgstr "" -"パーサーにテキストを入力します。入力が完全なタグ要素で構成されている場合に限" -"り処理が行われます; 不完全なデータであった場合、新たにデータが入力されるか、:" -"meth:`close` が呼び出されるまでバッファーされます。 *data* は :class:`str` で" -"なければなりません。" +"パーサーにテキストを渡します。\n" +"完全な要素からなる部分までを処理し、不完全なデータは追加のデータが渡される" +"か :meth:`close` が呼ばれるまでバッファーに保持します。\n" +"*data* は :class:`str` でなければなりません。" #: ../../library/html.parser.rst:99 msgid "" @@ -182,17 +207,16 @@ msgstr "" msgid "Return current line number and offset." msgstr "現在の行番号およびオフセット値を返します。" -#: ../../library/html.parser.rst:118 msgid "" "Return the text of the most recently opened start tag. This should not " "normally be needed for structured processing, but may be useful in dealing " "with HTML \"as deployed\" or for re-generating input with minimal changes " "(whitespace between attributes can be preserved, etc.)." msgstr "" -"最も最近開かれた開始タグのテキスト部分を返します。このテキストは必ずしも元" -"データを構造化する上で必須ではありませんが、 \"広く知られている (as " -"deployed)\" HTML を扱ったり、入力を最小限の変更で再生成 (属性間の空白をそのま" -"まにする、など) したりする場合に便利なことがあります。" +"最後に読み込んだ開始タグのテキストを返します。\n" +"構造に基づく処理では通常は不要ですが、実際に使われている HTML を扱ったり、入" +"力を最小限の変更で再生成したりする場合に役立つことがあります (属性間の空白な" +"どを保持できます)。" #: ../../library/html.parser.rst:124 msgid "" @@ -236,12 +260,12 @@ msgstr "" "ドは ``handle_starttag('a', [('href', 'https://www.cwi.nl/')])`` として呼び出" "されます。" -#: ../../library/html.parser.rst:142 msgid "" "All entity references from :mod:`html.entities` are replaced in the " "attribute values." msgstr "" -":mod:`html.entities` からのすべての実態参照は、属性値に置き換えられます。" +"属性値に含まれる実体参照は、:mod:`html.entities` の定義に従ってすべて置換され" +"ます。" #: ../../library/html.parser.rst:148 msgid "" @@ -314,16 +338,16 @@ msgstr "" "例えば、コメント ```` があると。このメソッドを引数 ``' " "comment '`` で呼び出されます。" -#: ../../library/html.parser.rst:191 msgid "" "The content of Internet Explorer conditional comments (condcoms) will also " "be sent to this method, so, for ````, this method will receive ``'[if IE 9]>IE9-specific contentIE9-specific content`` の場合、こ" -"のメソッドは ``'[if IE 9]>IE9-specific contentIE9-specific content`` に対しては、``'[if " +"IE 9]>IE9-specific content>> parser.feed('')\n" "Decl : DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3." "org/TR/html4/strict.dtd\"" msgstr "" +">>> parser.feed('')\n" +"Decl : DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3." +"org/TR/html4/strict.dtd\"" -#: ../../library/html.parser.rst:281 msgid "Parsing an element with a few attributes and a title:" -msgstr "" +msgstr "属性を持つ要素と見出しの解析:" -#: ../../library/html.parser.rst:283 msgid "" ">>> parser.feed('\"The')\n" "Start tag: img\n" @@ -455,6 +510,15 @@ msgid "" "Data : Python\n" "End tag : h1" msgstr "" +">>> parser.feed('\"The')\n" +"Start tag: img\n" +" attr: ('src', 'python-logo.png')\n" +" attr: ('alt', 'The Python logo')\n" +">>>\n" +">>> parser.feed('

Python

')\n" +"Start tag: h1\n" +"Data : Python\n" +"End tag : h1" #: ../../library/html.parser.rst:295 msgid "" @@ -479,25 +543,27 @@ msgid "" "End tag : script" msgstr "" -#: ../../library/html.parser.rst:313 msgid "Parsing comments:" -msgstr "" +msgstr "コメントの解析:" -#: ../../library/html.parser.rst:315 msgid "" ">>> parser.feed(''\n" "... '')\n" "Comment : a comment\n" "Comment : [if IE 9]>IE-specific content>> parser.feed(''\n" +"... '')\n" +"Comment : a comment\n" +"Comment : [if IE 9]>IE-specific content'``):" msgstr "" +"名前付き文字参照と数値文字参照を解析し、対応する文字に変換します (以下の 3 つ" +"の参照はすべて ``'>'`` を表します)。" -#: ../../library/html.parser.rst:325 msgid "" ">>> parser = MyHTMLParser()\n" ">>> parser.feed('>>>')\n" @@ -509,6 +575,15 @@ msgid "" "Num ent : >\n" "Num ent : >" msgstr "" +">>> parser = MyHTMLParser()\n" +">>> parser.feed('>>>')\n" +"Data : >>>\n" +"\n" +">>> parser = MyHTMLParser(convert_charrefs=False)\n" +">>> parser.feed('>>>')\n" +"Named ent: >\n" +"Num ent : >\n" +"Num ent : >" #: ../../library/html.parser.rst:337 msgid "" @@ -517,7 +592,6 @@ msgid "" "*convert_charrefs* is set to ``True``):" msgstr "" -#: ../../library/html.parser.rst:341 msgid "" ">>> for chunk in ['buff', 'ered', ' text']:\n" "... parser.feed(chunk)\n" @@ -528,12 +602,18 @@ msgid "" "Data : text\n" "End tag : span" msgstr "" +">>> for chunk in ['buff', 'ered', ' text']:\n" +"... parser.feed(chunk)\n" +"...\n" +"Start tag: span\n" +"Data : buff\n" +"Data : ered\n" +"Data : text\n" +"End tag : span" -#: ../../library/html.parser.rst:352 msgid "Parsing invalid HTML (e.g. unquoted attributes) also works:" -msgstr "" +msgstr "不正な HTML (引用符で囲まれていない属性など) も解析できます。" -#: ../../library/html.parser.rst:354 msgid "" ">>> parser.feed('

tag soup

')\n" "Start tag: p\n" @@ -544,6 +624,14 @@ msgid "" "End tag : p\n" "End tag : a" msgstr "" +">>> parser.feed('

tag soup

')\n" +"Start tag: p\n" +"Start tag: a\n" +" attr: ('class', 'link')\n" +" attr: ('href', '#main')\n" +"Data : tag soup\n" +"End tag : p\n" +"End tag : a" #: ../../library/html.parser.rst:9 msgid "HTML" diff --git a/library/html.po b/library/html.po index b3f5c8ba5..4965a5185 100644 --- a/library/html.po +++ b/library/html.po @@ -17,10 +17,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/html.rst:2 @@ -49,7 +49,6 @@ msgstr "" "これは例えば ```` など、引用符で括られている HTML 属性値を包" "含する時に役立ちます。" -#: ../../library/html.rst:26 msgid "" "Convert all named and numeric character references (e.g. ``>``, ``>" "``, ``>``) in the string *s* to the corresponding Unicode characters. " @@ -57,11 +56,11 @@ msgid "" "and invalid character references, and the :data:`list of HTML 5 named " "character references `." msgstr "" -"文字列 *s* 中の名前や数字による参照 (例えば ``>``, ``>``, ``>``) " -"を全て対応するユニコード文字に変換します。\n" -"この関数は、 HTML 5 標準規格で定められた有効な文字参照および無効な文字参" -"照、 :data:`list of HTML 5 named character references ` " -"を対象とします。" +"文字列 *s* 内の名前付き文字参照と数値文字参照 (例えば ``>``、``>``、" +"``>``) を、すべて対応する Unicode 文字に変換します。\n" +"この関数は、有効な文字参照にも無効な文字参照にも HTML 5 標準で定められた規則" +"を適用し、:data:`HTML 5 の名前付き文字参照のリスト ` を" +"使います。" #: ../../library/html.rst:36 msgid "Submodules in the ``html`` package are:" diff --git a/library/http.client.po b/library/http.client.po index d0827d6f9..6cd2df8d6 100644 --- a/library/http.client.po +++ b/library/http.client.po @@ -22,10 +22,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/http.client.rst:2 @@ -63,9 +63,8 @@ msgstr "" "HTTPS のサポートは、Python が SSL サポート付きでコンパイルされている場合にの" "み利用できます (:mod:`ssl` モジュールによって)。" -#: ../../includes/wasm-notavail.rst:3 msgid "Availability" -msgstr "" +msgstr "利用可能な環境" #: ../../includes/wasm-notavail.rst:5 msgid "" @@ -115,13 +114,16 @@ msgstr "" "例えば、以下の呼び出しは全て同じサーバの同じポートに接続するインスタンスを生" "成します::" -#: ../../library/http.client.rst:54 msgid "" ">>> h1 = http.client.HTTPConnection('www.python.org')\n" ">>> h2 = http.client.HTTPConnection('www.python.org:80')\n" ">>> h3 = http.client.HTTPConnection('www.python.org', 80)\n" ">>> h4 = http.client.HTTPConnection('www.python.org', 80, timeout=10)" msgstr "" +">>> h1 = http.client.HTTPConnection('www.python.org')\n" +">>> h2 = http.client.HTTPConnection('www.python.org:80')\n" +">>> h3 = http.client.HTTPConnection('www.python.org', 80)\n" +">>> h4 = http.client.HTTPConnection('www.python.org', 80, timeout=10)" #: ../../library/http.client.rst:59 msgid "*source_address* was added." @@ -187,33 +189,37 @@ msgstr "" "りました。 *context* パラメーターに :func:`!ssl._create_unverified_context` " "を渡すことで、昔の、検証を行わない振る舞いに戻すことができます。" -#: ../../library/http.client.rst:98 msgid "" "This class now enables TLS 1.3 :attr:`ssl.SSLContext.post_handshake_auth` " "for the default *context* or when *cert_file* is passed with a custom " "*context*." msgstr "" +"デフォルトの *context* を使う場合、またはカスタムの *context* とともに " +"*cert_file* を渡した場合、このクラスは TLS 1.3 の :attr:`ssl.SSLContext." +"post_handshake_auth` を有効にするようになりました。" -#: ../../library/http.client.rst:103 msgid "" "This class now sends an ALPN extension with protocol indicator ``http/1.1`` " "when no *context* is given. Custom *context* should set ALPN protocols with :" "meth:`~ssl.SSLContext.set_alpn_protocols`." msgstr "" +"*context* を指定しない場合、このクラスはプロトコル識別子 ``http/1.1`` を含む " +"ALPN 拡張を送信するようになりました。\n" +"カスタムの *context* では :meth:`~ssl.SSLContext.set_alpn_protocols` を使っ" +"て ALPN プロトコルを設定してください。" -#: ../../library/http.client.rst:108 msgid "" "The deprecated *key_file*, *cert_file* and *check_hostname* parameters have " "been removed." msgstr "" +"非推奨だった引数 *key_file*、*cert_file*、*check_hostname* を削除しました。" -#: ../../library/http.client.rst:115 msgid "" "Class whose instances are returned upon successful connection. Not " "instantiated directly by user." msgstr "" -"コネクションに成功したときに、このクラスのインスタンスが返されます。ユーザー" -"から直接利用されることはありません。" +"接続に成功すると、このクラスのインスタンスが返されます。\n" +"利用者が直接インスタンス化するクラスではありません。" #: ../../library/http.client.rst:118 msgid "" @@ -234,21 +240,28 @@ msgid "" "text) and must provide a valid :rfc:`2822` style header." msgstr "" -#: ../../library/http.client.rst:130 msgid "" "This function returns an instance of :class:`http.client.HTTPMessage` that " "holds the header fields, but no payload (the same as :attr:`HTTPResponse." "msg` and :attr:`http.server.BaseHTTPRequestHandler.headers`). After " "returning, the file pointer *fp* is ready to read the HTTP body." msgstr "" +"この関数は、ヘッダーフィールドを保持し、ペイロードは持たない :class:`http." +"client.HTTPMessage` インスタンスを返します (:attr:`HTTPResponse.msg` や :" +"attr:`http.server.BaseHTTPRequestHandler.headers` と同様です)。\n" +"関数から戻ると、ファイルポインター *fp* は HTTP 本体を読み込める位置にありま" +"す。" -#: ../../library/http.client.rst:137 msgid "" ":meth:`parse_headers` does not parse the start-line of a HTTP message; it " "only parses the ``Name: value`` lines. The file has to be ready to read " "these field lines, so the first line should already be consumed before " "calling the function." msgstr "" +":meth:`parse_headers` は HTTP メッセージの開始行を解析せず、``Name: value`` " +"形式の行だけを解析します。\n" +"ファイルはこれらのフィールド行を読み込める状態でなければならないため、関数を" +"呼び出す前に最初の行を読み込んでおく必要があります。" #: ../../library/http.client.rst:142 msgid "The following exceptions are raised as appropriate:" @@ -281,43 +294,44 @@ msgstr "" msgid "A subclass of :exc:`ImproperConnectionState`." msgstr ":exc:`ImproperConnectionState` のサブクラスです。" -#: ../../library/http.client.rst:204 msgid "" "A subclass of :exc:`HTTPException`. Raised if a server responds with a HTTP " "status code that we don't understand." msgstr "" -":exc:`HTTPException` のサブクラスです。サーバが理解できない HTTP 状態コードで" -"応答した場合に送出されます。" +":exc:`HTTPException` のサブクラスです。\n" +"サーバーから返された HTTP ステータスコードをクライアントが理解できない場合に" +"送出されます。" -#: ../../library/http.client.rst:210 msgid "" "A subclass of :exc:`HTTPException`. Raised if an excessively long line is " "received in the HTTP protocol from the server." msgstr "" +":exc:`HTTPException` のサブクラスです。\n" +"HTTP プロトコルでサーバーから長すぎる行を受信した場合に送出されます。" -#: ../../library/http.client.rst:216 msgid "" "A subclass of :exc:`ConnectionResetError` and :exc:`BadStatusLine`. Raised " "by :meth:`HTTPConnection.getresponse` when the attempt to read the response " "results in no data read from the connection, indicating that the remote end " "has closed the connection." msgstr "" +":exc:`ConnectionResetError` と :exc:`BadStatusLine` のサブクラスです。\n" +":meth:`HTTPConnection.getresponse` がレスポンスを読み込もうとしても接続から" +"データをまったく読み込めず、相手側が接続を閉じたと分かった場合に送出されま" +"す。" -#: ../../library/http.client.rst:221 msgid "Previously, :exc:`BadStatusLine`\\ ``('')`` was raised." -msgstr "" +msgstr "以前は :exc:`BadStatusLine`\\ ``('')`` を送出していました。" #: ../../library/http.client.rst:225 msgid "The constants defined in this module are:" msgstr "このモジュールで定義されている定数は以下の通りです:" -#: ../../library/http.client.rst:229 msgid "The default port for the HTTP protocol (always ``80``)." -msgstr "HTTP プロトコルの標準のポート (通常は ``80``) です。" +msgstr "HTTP プロトコルのデフォルトポート (常に ``80``) です。" -#: ../../library/http.client.rst:233 msgid "The default port for the HTTPS protocol (always ``443``)." -msgstr "HTTPS プロトコルの標準のポート (通常は ``443``) です。" +msgstr "HTTPS プロトコルのデフォルトポート (常に ``443``) です。" #: ../../library/http.client.rst:237 msgid "This dictionary maps the HTTP 1.1 status codes to the W3C names." @@ -332,11 +346,12 @@ msgstr "" "例: ``http.client.responses[http.client.NOT_FOUND]`` は ``'Not Found'`` を示" "します。" -#: ../../library/http.client.rst:241 msgid "" "See :ref:`http-status-codes` for a list of HTTP status codes that are " "available in this module as constants." msgstr "" +"このモジュールで定数として利用できる HTTP ステータスコードの一覧は :ref:" +"`http-status-codes` を参照してください。" #: ../../library/http.client.rst:248 msgid "HTTPConnection Objects" @@ -346,7 +361,6 @@ msgstr "HTTPConnection オブジェクト" msgid ":class:`HTTPConnection` instances have the following methods:" msgstr ":class:`HTTPConnection` インスタンスには以下のメソッドがあります:" -#: ../../library/http.client.rst:256 msgid "" "This will send a request to the server using the HTTP request method " "*method* and the request URI *url*. The provided *url* must be an absolute " @@ -354,6 +368,11 @@ msgid "" "connecting to an HTTP proxy server or using the ``OPTIONS`` or ``CONNECT`` " "methods)." msgstr "" +"HTTP リクエストメソッド *method* とリクエスト URI *url* を使って、サーバーに" +"リクエストを送信します。\n" +":rfc:`RFC 2616 §5.1.2 <2616#section-5.1.2>` に準拠するため、*url* は絶対パス" +"でなければなりません (HTTP プロキシサーバーへの接続時や、``OPTIONS`` または " +"``CONNECT`` メソッドを使う場合を除きます)。" #: ../../library/http.client.rst:262 msgid "" @@ -370,7 +389,6 @@ msgid "" "iterable is exhausted." msgstr "" -#: ../../library/http.client.rst:274 msgid "" "The *headers* argument should be a mapping of extra HTTP headers to send " "with the request. A :rfc:`Host header <2616#section-14.23>` must be provided " @@ -378,8 +396,12 @@ msgid "" "connecting to an HTTP proxy server or using the ``OPTIONS`` or ``CONNECT`` " "methods)." msgstr "" +"*headers* 引数には、リクエストとともに送信する追加の HTTP ヘッダーのマッピン" +"グを指定します。\n" +":rfc:`RFC 2616 §5.1.2 <2616#section-5.1.2>` に準拠するため、:rfc:`Host ヘッ" +"ダー <2616#section-14.23>` を指定しなければなりません (HTTP プロキシサーバー" +"への接続時や、``OPTIONS`` または ``CONNECT`` メソッドを使う場合を除きます)。" -#: ../../library/http.client.rst:280 msgid "" "If *headers* contains neither Content-Length nor Transfer-Encoding, but " "there is a request body, one of those header fields will be added " @@ -391,21 +413,33 @@ msgid "" "the Transfer-Encoding header will automatically be set instead of Content-" "Length." msgstr "" +"*headers* に Content-Length も Transfer-Encoding も含まれておらず、リクエスト" +"本体がある場合は、どちらかのヘッダーフィールドを自動で追加します。\n" +"*body* が ``None`` の場合、本体を想定するメソッド (``PUT``、``POST``、" +"``PATCH``) では Content-Length ヘッダーを ``0`` に設定します。\n" +"*body* が文字列か、:term:`ファイル ` ではないバイト列類似オブ" +"ジェクトの場合は、Content-Length ヘッダーをその長さに設定します。\n" +"それ以外の型の *body* (ファイルや一般のイテラブル) はチャンク形式でエンコード" +"し、Content-Length の代わりに Transfer-Encoding ヘッダーを自動で設定します。" -#: ../../library/http.client.rst:292 msgid "" "The *encode_chunked* argument is only relevant if Transfer-Encoding is " "specified in *headers*. If *encode_chunked* is ``False``, the " "HTTPConnection object assumes that all encoding is handled by the calling " "code. If it is ``True``, the body will be chunk-encoded." msgstr "" +"*encode_chunked* 引数が関係するのは、*headers* に Transfer-Encoding を指定し" +"た場合だけです。\n" +"*encode_chunked* が ``False`` の場合、HTTPConnection オブジェクトは呼び出し側" +"のコードですべてのエンコードを行うものとみなします。\n" +"``True`` の場合、本体をチャンク形式でエンコードします。" -#: ../../library/http.client.rst:297 msgid "" "For example, to perform a ``GET`` request to ``https://docs.python.org/3/``::" msgstr "" +"例えば、``https://docs.python.org/3/`` への ``GET`` リクエストは次のように実" +"行します。 ::" -#: ../../library/http.client.rst:299 msgid "" ">>> import http.client\n" ">>> host = \"docs.python.org\"\n" @@ -415,26 +449,41 @@ msgid "" ">>> print(response.status, response.reason)\n" "200 OK" msgstr "" +">>> import http.client\n" +">>> host = \"docs.python.org\"\n" +">>> conn = http.client.HTTPSConnection(host)\n" +">>> conn.request(\"GET\", \"/3/\", headers={\"Host\": host})\n" +">>> response = conn.getresponse()\n" +">>> print(response.status, response.reason)\n" +"200 OK" -#: ../../library/http.client.rst:308 msgid "" "Chunked transfer encoding has been added to the HTTP protocol version 1.1. " "Unless the HTTP server is known to handle HTTP 1.1, the caller must either " "specify the Content-Length, or must pass a :class:`str` or bytes-like object " "that is not also a file as the body representation." msgstr "" +"チャンク転送エンコーディングは HTTP プロトコルのバージョン 1.1 で追加されまし" +"た。\n" +"HTTP サーバーが HTTP 1.1 に対応していると分かっていない限り、呼び出し側は " +"Content-Length を指定するか、\n" +"本体として :class:`str` またはファイルではないバイト列類似オブジェクトを渡す" +"必要があります。" -#: ../../library/http.client.rst:314 msgid "*body* can now be an iterable." -msgstr "*body* は iterable オブジェクトとして使用できます。" +msgstr "*body* にイテラブルを指定できるようになりました。" -#: ../../library/http.client.rst:317 msgid "" "If neither Content-Length nor Transfer-Encoding are set in *headers*, file " "and iterable *body* objects are now chunk-encoded. The *encode_chunked* " "argument was added. No attempt is made to determine the Content-Length for " "file objects." msgstr "" +"*headers* に Content-Length も Transfer-Encoding も設定されていない場合、ファ" +"イルやイテラブルの *body* オブジェクトをチャンク形式でエンコードするようにな" +"りました。\n" +"*encode_chunked* 引数を追加しました。\n" +"ファイルオブジェクトの Content-Length を調べることはしません。" #: ../../library/http.client.rst:326 msgid "" @@ -452,20 +501,27 @@ msgstr "" "すべての応答を読み込んでからでなければ新しい要求をサーバに送ることはできない" "ことに注意しましょう。" -#: ../../library/http.client.rst:334 msgid "" "If a :exc:`ConnectionError` or subclass is raised, the :class:" "`HTTPConnection` object will be ready to reconnect when a new request is " "sent." msgstr "" +":exc:`ConnectionError` またはそのサブクラスの例外が送出された場合、:class:" +"`HTTPConnection` オブジェクトは新しいリクエストの送信時に再接続できる状態にな" +"ります。" -#: ../../library/http.client.rst:342 msgid "" "Set the debugging level. The default debug level is ``0``, meaning no " "debugging output is printed. Any value greater than ``0`` will cause all " "currently defined debug output to be printed to stdout. The ``debuglevel`` " "is passed to any new :class:`HTTPResponse` objects that are created." msgstr "" +"デバッグレベルを設定します。\n" +"デフォルトのデバッグレベルは ``0`` で、デバッグ出力は表示しません。\n" +"``0`` より大きい値にすると、現在定義されているすべてのデバッグ出力を標準出力" +"に表示します。\n" +"``debuglevel`` は、新しく作成されるすべての :class:`HTTPResponse` オブジェク" +"トに渡されます。" #: ../../library/http.client.rst:352 msgid "" @@ -475,12 +531,13 @@ msgstr "" "HTTP トンネリング接続のホスト名とポート番号を設定します。これによりプロキシ" "サーバを通しての接続を実行できます。" -#: ../../library/http.client.rst:355 msgid "" "The *host* and *port* arguments specify the endpoint of the tunneled " "connection (i.e. the address included in the CONNECT request, *not* the " "address of the proxy server)." msgstr "" +"引数 *host* と *port* は、トンネル接続の終点を指定します (CONNECT リクエスト" +"に含まれるアドレスであり、プロキシサーバーのアドレスでは *ありません*)。" #: ../../library/http.client.rst:359 msgid "" @@ -488,7 +545,6 @@ msgid "" "with the CONNECT request." msgstr "" -#: ../../library/http.client.rst:362 msgid "" "As HTTP/1.1 is used for HTTP CONNECT tunnelling request, `as per the RFC " "`_, a HTTP " @@ -497,68 +553,90 @@ msgid "" "HTTP ``Host:`` header is not provided via the headers argument, one is " "generated and transmitted automatically." msgstr "" +"HTTP CONNECT のトンネル接続リクエストには HTTP/1.1 を使うため、`RFC の規定 " +"`_ に従い、\n" +"CONNECT リクエストの接続先として指定したリクエストターゲットの authority 形式" +"に一致する HTTP ``Host:`` ヘッダーが必要です。\n" +"``headers`` 引数で HTTP ``Host:`` ヘッダーを指定しなければ、自動で生成して送" +"信します。" -#: ../../library/http.client.rst:369 msgid "" "For example, to tunnel through a HTTPS proxy server running locally on port " "8080, we would pass the address of the proxy to the :class:`HTTPSConnection` " "constructor, and the address of the host that we eventually want to reach to " "the :meth:`~HTTPConnection.set_tunnel` method::" msgstr "" +"例えば、ローカルのポート 8080 で動作する HTTPS プロキシサーバーを経由してトン" +"ネル接続するには、\n" +":class:`HTTPSConnection` コンストラクタにプロキシのアドレスを、:meth:" +"`~HTTPConnection.set_tunnel` メソッドに最終的な接続先ホストのアドレスを渡しま" +"す。 ::" -#: ../../library/http.client.rst:374 msgid "" ">>> import http.client\n" ">>> conn = http.client.HTTPSConnection(\"localhost\", 8080)\n" ">>> conn.set_tunnel(\"www.python.org\")\n" ">>> conn.request(\"HEAD\",\"/index.html\")" msgstr "" +">>> import http.client\n" +">>> conn = http.client.HTTPSConnection(\"localhost\", 8080)\n" +">>> conn.set_tunnel(\"www.python.org\")\n" +">>> conn.request(\"HEAD\",\"/index.html\")" -#: ../../library/http.client.rst:381 msgid "" "HTTP CONNECT tunnelling requests use protocol HTTP/1.1, upgraded from " "protocol HTTP/1.0. ``Host:`` HTTP headers are mandatory for HTTP/1.1, so one " "will be automatically generated and transmitted if not provided in the " "headers argument." msgstr "" +"HTTP CONNECT のトンネル接続リクエストは、HTTP/1.0 に代わって HTTP/1.1 プロト" +"コルを使うようになりました。\n" +"HTTP/1.1 では ``Host:`` HTTP ヘッダーが必須のため、``headers`` 引数で指定しな" +"ければ自動で生成して送信します。" -#: ../../library/http.client.rst:390 msgid "" "Returns a dictionary with the headers of the response received from the " "proxy server to the CONNECT request." msgstr "" +"CONNECT リクエストに対してプロキシサーバーから受信したレスポンスのヘッダーを" +"辞書で返します。" -#: ../../library/http.client.rst:393 msgid "If the CONNECT request was not sent, the method returns ``None``." msgstr "" +"CONNECT リクエストを送信していない場合、このメソッドは ``None`` を返します。" -#: ../../library/http.client.rst:400 msgid "" "Connect to the server specified when the object was created. By default, " "this is called automatically when making a request if the client does not " "already have a connection." msgstr "" +"オブジェクトの作成時に指定したサーバーに接続します。\n" +"デフォルトでは、クライアントがまだ接続していない場合、リクエストの送信時に自" +"動で呼び出されます。" -#: ../../library/http.client.rst:404 msgid "" "Raises an :ref:`auditing event ` ``http.client.connect`` with " "arguments ``self``, ``host``, ``port``." msgstr "" +"引数 ``self``、``host``、``port`` を指定して :ref:`監査イベント ` " +"``http.client.connect`` を送出します。" #: ../../library/http.client.rst:409 msgid "Close the connection to the server." msgstr "サーバへの接続を閉じます。" -#: ../../library/http.client.rst:414 msgid "Buffer size in bytes for sending a file-like message body." msgstr "" +"ファイル類似オブジェクトからメッセージ本体を送信する際のバッファーサイズ (バ" +"イト単位)。" -#: ../../library/http.client.rst:419 msgid "" "As an alternative to using the :meth:`~HTTPConnection.request` method " "described above, you can also send your request step by step, by using the " "four functions below." msgstr "" +"前述の :meth:`~HTTPConnection.request` メソッドの代わりに、以下の 4 つの関数" +"を使ってリクエストを段階的に送信することもできます。" #: ../../library/http.client.rst:426 msgid "" @@ -597,7 +675,6 @@ msgstr "" "*message_body* 引数を、リクエストに関連したメッセージボディを渡すのに使うこと" "が出来ます。" -#: ../../library/http.client.rst:448 msgid "" "If *encode_chunked* is ``True``, the result of each iteration of " "*message_body* will be chunk-encoded as specified in :rfc:`7230`, Section " @@ -609,32 +686,48 @@ msgid "" "read()`` will result in a chunk. The method automatically signals the end of " "the chunk-encoded data immediately after *message_body*." msgstr "" +"*encode_chunked* が ``True`` の場合、*message_body* の各イテレーションの結果" +"を :rfc:`7230` の 3.3.1 節に従ってチャンク形式でエンコードします。\n" +"エンコード方法は *message_body* の型によって異なります。\n" +"*message_body* が :ref:`バッファーインターフェース ` を実装し" +"ている場合、1 つのチャンクになります。\n" +"*message_body* が :class:`collections.abc.Iterable` の場合、各イテレーション" +"の結果が 1 つのチャンクになります。\n" +"*message_body* が :term:`file object` の場合、``.read()`` の各呼び出しの結果" +"が 1 つのチャンクになります。\n" +"このメソッドは、*message_body* の直後にチャンク形式のデータの終わりを自動で通" +"知します。" -#: ../../library/http.client.rst:459 msgid "" "Due to the chunked encoding specification, empty chunks yielded by an " "iterator body will be ignored by the chunk-encoder. This is to avoid " "premature termination of the read of the request by the target server due to " "malformed encoding." msgstr "" +"チャンク形式のエンコーディングの仕様上、リクエスト本体として渡したイテレータ" +"が yield する空のチャンクは、チャンクエンコーダーに無視されます。\n" +"これは、不正なエンコードによって接続先サーバーがリクエストの読み込みを途中で" +"終了するのを防ぐためです。" -#: ../../library/http.client.rst:464 msgid "Added chunked encoding support and the *encode_chunked* parameter." msgstr "" +"チャンク形式のエンコーディングのサポートと *encode_chunked* 引数を追加しまし" +"た。" -#: ../../library/http.client.rst:470 msgid "" "Send data to the server. This should be used directly only after the :meth:" "`endheaders` method has been called and before :meth:`getresponse` is called." msgstr "" -"サーバにデータを送ります。このメソッドは :meth:`endheaders` が呼び出された直" -"後で、かつ :meth:`getresponse` が呼び出される前に使わなければなりません。" +"サーバーにデータを送信します。\n" +"このメソッドを直接使うのは、:meth:`endheaders` を呼び出した後、:meth:" +"`getresponse` を呼び出す前に限ります。" -#: ../../library/http.client.rst:474 msgid "" "Raises an :ref:`auditing event ` ``http.client.send`` with " "arguments ``self``, ``data``." msgstr "" +"引数 ``self``、``data`` を指定して :ref:`監査イベント ` ``http." +"client.send`` を送出します。" #: ../../library/http.client.rst:480 msgid "HTTPResponse Objects" @@ -651,11 +744,12 @@ msgstr "" "きます。レスポンスはイテレート可能なオブジェクトであり、また with文と使うこと" "も可能です。" -#: ../../library/http.client.rst:487 msgid "" "The :class:`io.BufferedIOBase` interface is now implemented and all of its " "reader operations are supported." msgstr "" +":class:`io.BufferedIOBase` インターフェースを実装し、読み込み操作をすべてサ" +"ポートするようになりました。" #: ../../library/http.client.rst:494 msgid "Reads and returns the response body, or up to the next *amt* bytes." @@ -669,13 +763,18 @@ msgstr "" "バッファ *b* にレスポンスボディの次のデータを最大 len(b) バイト読み込みます。" "何バイト読んだかを返します。" -#: ../../library/http.client.rst:505 msgid "" "Return the value of the header *name*, or *default* if there is no header " "matching *name*. If there is more than one header with the name *name*, " "return all of the values joined by ', '. If *default* is any iterable other " "than a single string, its elements are similarly returned joined by commas." msgstr "" +"ヘッダー *name* の値を返します。\n" +"*name* に一致するヘッダーがない場合は *default* を返します。\n" +"*name* という名前のヘッダーが複数ある場合は、すべての値を ', ' で連結して返し" +"ます。\n" +"*default* が単一の文字列以外のイテラブルの場合は、同様にその要素をカンマで連" +"結して返します。" #: ../../library/http.client.rst:512 msgid "Return a list of (header, value) tuples." @@ -685,12 +784,15 @@ msgstr "(header, value) のタプルからなるリストを返します。" msgid "Return the ``fileno`` of the underlying socket." msgstr "ソケットの ``fileno`` を返します。" -#: ../../library/http.client.rst:520 msgid "" "A :class:`http.client.HTTPMessage` instance containing the response " "headers. :class:`http.client.HTTPMessage` is a subclass of :class:`email." "message.Message`." msgstr "" +"レスポンスヘッダーを保持する :class:`http.client.HTTPMessage` インスタンスで" +"す。\n" +":class:`http.client.HTTPMessage` は :class:`email.message.Message` のサブクラ" +"スです。" #: ../../library/http.client.rst:526 msgid "" @@ -721,11 +823,13 @@ msgstr "サーバから返される状態コードです。" msgid "Reason phrase returned by server." msgstr "サーバから返される応答の理由文です。" -#: ../../library/http.client.rst:546 msgid "" "A debugging hook. If :attr:`debuglevel` is greater than zero, messages will " "be printed to stdout as the response is read and parsed." msgstr "" +"デバッグ用のフックです。\n" +":attr:`debuglevel` が 0 より大きい場合、レスポンスの読み込みと解析の際にメッ" +"セージを標準出力に表示します。" #: ../../library/http.client.rst:551 msgid "Is ``True`` if the stream is closed." @@ -751,7 +855,6 @@ msgstr "使用例" msgid "Here is an example session that uses the ``GET`` method::" msgstr "以下は ``GET`` リクエストの送信方法を示した例です::" -#: ../../library/http.client.rst:573 msgid "" ">>> import http.client\n" ">>> conn = http.client.HTTPSConnection(\"www.python.org\")\n" @@ -776,6 +879,28 @@ msgid "" ">>> data2 = r2.read()\n" ">>> conn.close()" msgstr "" +">>> import http.client\n" +">>> conn = http.client.HTTPSConnection(\"www.python.org\")\n" +">>> conn.request(\"GET\", \"/\")\n" +">>> r1 = conn.getresponse()\n" +">>> print(r1.status, r1.reason)\n" +"200 OK\n" +">>> data1 = r1.read() # 内容全体を返します。\n" +">>> # 以下はデータを小分けに読み込む例です。\n" +">>> conn.request(\"GET\", \"/\")\n" +">>> r1 = conn.getresponse()\n" +">>> while chunk := r1.read(200):\n" +"... print(repr(chunk))\n" +"b'\\n'\n" ">>> print(aRepr.repr(example))\n" @@ -243,14 +268,29 @@ msgid "" "-->'ham',\n" "]" msgstr "" +">>> aRepr.indent = '-->'\n" +">>> print(aRepr.repr(example))\n" +"[\n" +"-->1,\n" +"-->'spam',\n" +"-->{\n" +"-->-->'a': 2,\n" +"-->-->'b': 'spam eggs',\n" +"-->-->'c': {\n" +"-->-->-->3: 4.5,\n" +"-->-->-->6: [],\n" +"-->-->},\n" +"-->},\n" +"-->'ham',\n" +"]" -#: ../../library/reprlib.rst:183 msgid "" "Setting :attr:`~Repr.indent` to a positive integer value behaves as if it " "was set to a string with that number of spaces:" msgstr "" +":attr:`~Repr.indent` に正の整数を設定すると、その個数の空白からなる文字列を設" +"定した場合と同じように動作します:" -#: ../../library/reprlib.rst:186 msgid "" ">>> aRepr.indent = 4\n" ">>> print(aRepr.repr(example))\n" @@ -268,6 +308,21 @@ msgid "" " 'ham',\n" "]" msgstr "" +">>> aRepr.indent = 4\n" +">>> print(aRepr.repr(example))\n" +"[\n" +" 1,\n" +" 'spam',\n" +" {\n" +" 'a': 2,\n" +" 'b': 'spam eggs',\n" +" 'c': {\n" +" 3: 4.5,\n" +" 6: [],\n" +" },\n" +" },\n" +" 'ham',\n" +"]" #: ../../library/reprlib.rst:209 msgid "" @@ -310,15 +365,17 @@ msgstr "" msgid "Subclassing Repr Objects" msgstr "Reprオブジェクトをサブクラス化する" -#: ../../library/reprlib.rst:236 msgid "" "The use of dynamic dispatching by :meth:`Repr.repr1` allows subclasses of :" "class:`Repr` to add support for additional built-in object types or to " "modify the handling of types already supported. This example shows how " "special support for file objects could be added:" msgstr "" +":meth:`Repr.repr1` は動的なディスパッチを使うため、:class:`Repr` のサブクラス" +"で別の組み込みオブジェクト型への対応を追加したり、サポート済みの型の扱いを変" +"更したりできます。\n" +"次の例は、ファイルオブジェクト向けの特別な処理を追加する方法を示します:" -#: ../../library/reprlib.rst:241 msgid "" "import reprlib\n" "import sys\n" @@ -333,10 +390,21 @@ msgid "" "aRepr = MyRepr()\n" "print(aRepr.repr(sys.stdin)) # prints ''" msgstr "" +"import reprlib\n" +"import sys\n" +"\n" +"class MyRepr(reprlib.Repr):\n" +"\n" +" def repr_TextIOWrapper(self, obj, level):\n" +" if obj.name in {'', '', ''}:\n" +" return obj.name\n" +" return repr(obj)\n" +"\n" +"aRepr = MyRepr()\n" +"print(aRepr.repr(sys.stdin)) # '' と表示する" -#: ../../library/reprlib.rst:256 msgid "" -msgstr "" +msgstr "" #: ../../library/reprlib.rst:65 msgid "..." diff --git a/library/resource.po b/library/resource.po index 0fc3cf9cd..fee1bba47 100644 --- a/library/resource.po +++ b/library/resource.po @@ -20,10 +20,10 @@ msgstr "" "Last-Translator: Arihiro TAKASE, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/resource.rst:2 @@ -38,14 +38,8 @@ msgstr "" "このモジュールでは、プログラムによって使用されているシステムリソースを計測し" "たり制御するための基本的なメカニズムを提供します。" -#: ../../library/resource.rst:16 ../../library/resource.rst:104 -#: ../../library/resource.rst:180 ../../library/resource.rst:192 -#: ../../library/resource.rst:201 ../../library/resource.rst:210 -#: ../../library/resource.rst:220 ../../library/resource.rst:229 -#: ../../library/resource.rst:239 ../../library/resource.rst:252 -#: ../../library/resource.rst:260 ../../library/resource.rst:268 msgid "Availability" -msgstr "" +msgstr "利用可能な環境" #: ../../library/resource.rst:18 msgid "" @@ -159,13 +153,12 @@ msgstr "" msgid "VxWorks only supports setting :data:`RLIMIT_NOFILE`." msgstr "" -#: ../../library/resource.rst:83 msgid "" "Raises an :ref:`auditing event ` ``resource.setrlimit`` with " "arguments ``resource``, ``limits``." msgstr "" -"引数 ``src``, ``dst`, ``limits`` を指定して :ref:`監査イベント ` " -"``resource.setrlimit`` を送出します。 " +"引数 ``resource``, ``limits`` を指定して :ref:`監査イベント ` " +"``resource.setrlimit`` を送出します。" #: ../../library/resource.rst:88 msgid "" @@ -201,13 +194,12 @@ msgstr "" "*pid* が見付からないときは :exc:`ProcessLookupError` を、ユーザがプロセスの " "``CAP_SYS_RESOURCE`` を持ってないときは :exc:`PermissionError` を送出します。" -#: ../../library/resource.rst:102 msgid "" "Raises an :ref:`auditing event ` ``resource.prlimit`` with " "arguments ``pid``, ``resource``, ``limits``." msgstr "" -"引数 ``pid``, ``dst`, ``limits`` を指定して :ref:`監査イベント ` " -"``resource.prlimit`` を送出します。 " +"引数 ``pid``, ``resource``, ``limits`` を指定して :ref:`監査イベント " +"` ``resource.prlimit`` を送出します。" #: ../../library/resource.rst:109 msgid "" @@ -355,9 +347,8 @@ msgstr "" msgid "The maximum number of pseudo-terminals created by this user id." msgstr "このユーザ ID が作成する擬似端末の数の上限です。" -#: ../../library/resource.rst:266 msgid "The maximum number of kqueues this user id is allowed to create." -msgstr "" +msgstr "このユーザー ID で作成できる kqueue の数の上限です。" #: ../../library/resource.rst:273 msgid "Resource Usage" @@ -367,19 +358,21 @@ msgstr "リソースの使用状態" msgid "These functions are used to retrieve resource usage information:" msgstr "以下の関数はリソース使用情報を取得するために使われます:" -#: ../../library/resource.rst:280 msgid "" "This function returns an object that describes the resources consumed by " "either the current process or its children, as specified by the *who* " "parameter. The *who* parameter should be specified using one of the :const:" "`!RUSAGE_\\*` constants described below." msgstr "" +"*who* 引数の指定に従い、現在のプロセスまたはその子プロセスが消費したリソース" +"を表すオブジェクトを返します。\n" +"*who* 引数には、以下で説明する :const:`!RUSAGE_\\*` 定数のいずれかを指定して" +"ください。" #: ../../library/resource.rst:285 msgid "A simple example::" msgstr "簡単な例::" -#: ../../library/resource.rst:287 msgid "" "from resource import *\n" "import time\n" @@ -393,6 +386,17 @@ msgid "" " _ = 1 + 1\n" "print(getrusage(RUSAGE_SELF))" msgstr "" +"from resource import *\n" +"import time\n" +"\n" +"# CPU に処理速度が制約されないタスク\n" +"time.sleep(3)\n" +"print(getrusage(RUSAGE_SELF))\n" +"\n" +"# CPU に処理速度が制約されるタスク\n" +"for i in range(10 ** 8):\n" +" _ = 1 + 1\n" +"print(getrusage(RUSAGE_SELF))" #: ../../library/resource.rst:299 msgid "" @@ -445,9 +449,8 @@ msgstr "``0``" msgid ":attr:`ru_utime`" msgstr ":attr:`ru_utime`" -#: ../../library/resource.rst:316 msgid "time in user mode (float seconds)" -msgstr "" +msgstr "ユーザーモードでの時間 (浮動小数点数、秒単位)" #: ../../library/resource.rst:318 msgid "``1``" @@ -457,9 +460,8 @@ msgstr "``1``" msgid ":attr:`ru_stime`" msgstr ":attr:`ru_stime`" -#: ../../library/resource.rst:318 msgid "time in system mode (float seconds)" -msgstr "" +msgstr "システムモードでの時間 (浮動小数点数、秒単位)" #: ../../library/resource.rst:320 msgid "``2``" @@ -647,12 +649,13 @@ msgstr "" "システムページ内のバイト数を返します。(ハードウェアページサイズと同じとは限り" "ません。)" -#: ../../library/resource.rst:358 msgid "" "The following :const:`!RUSAGE_\\*` symbols are passed to the :func:" "`getrusage` function to specify which processes information should be " "provided for." msgstr "" +"以下の :const:`!RUSAGE_\\*` シンボルを :func:`getrusage` 関数に渡すことで、ど" +"のプロセスの情報を取得するか指定します。" #: ../../library/resource.rst:364 msgid "" @@ -662,13 +665,12 @@ msgstr "" ":func:`getrusage` に渡すと呼び出し中のプロセスが消費しているリソースを要求し" "ます。そのプロセスの全スレッドが使用するリソースの合計です。" -#: ../../library/resource.rst:370 msgid "" "Pass to :func:`getrusage` to request resources consumed by child processes " "of the calling process which have been terminated and waited for." msgstr "" -"呼び出し元のプロセスの子プロセスが消費するリソースを要求するために、 :func:" -"`getrusage` に渡して終了させ、待機させることができます。" +":func:`getrusage` に渡すと、呼び出し元プロセスの子プロセスのうち、終了して " +"wait による回収も済んだものが消費したリソースを取得できます。" #: ../../library/resource.rst:376 msgid "" diff --git a/library/rlcompleter.po b/library/rlcompleter.po index ed40d8381..3c09c0c87 100644 --- a/library/rlcompleter.po +++ b/library/rlcompleter.po @@ -17,10 +17,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/rlcompleter.rst:2 @@ -31,13 +31,13 @@ msgstr ":mod:`!rlcompleter` --- GNU readline の補完機能" msgid "**Source code:** :source:`Lib/rlcompleter.py`" msgstr "**ソースコード:** :source:`Lib/rlcompleter.py`" -#: ../../library/rlcompleter.rst:13 msgid "" "The :mod:`!rlcompleter` module defines a completion function suitable to be " "passed to :func:`~readline.set_completer` in the :mod:`readline` module." msgstr "" +":mod:`!rlcompleter` モジュールは、:mod:`readline` モジュールの :func:" +"`~readline.set_completer` に渡すのに適した補完関数を定義しています。" -#: ../../library/rlcompleter.rst:16 msgid "" "When this module is imported on a Unix platform with the :mod:`readline` " "module available, an instance of the :class:`Completer` class is " @@ -45,12 +45,17 @@ msgid "" "the :ref:`readline completer `. The method provides " "completion of valid Python :ref:`identifiers and keywords `." msgstr "" +":mod:`readline` モジュールが利用可能な Unix プラットフォームでこのモジュール" +"をインポートすると、:class:`Completer` クラスのインスタンスが自動的に作成さ" +"れ、その :meth:`~Completer.complete` メソッドが :ref:`readline の補完関数 " +"` に設定されます。\n" +"このメソッドは有効な Python の :ref:`識別子とキーワード ` を補完" +"します。" #: ../../library/rlcompleter.rst:22 msgid "Example::" msgstr "以下はプログラム例です::" -#: ../../library/rlcompleter.rst:24 msgid "" ">>> import rlcompleter\n" ">>> import readline\n" @@ -63,14 +68,27 @@ msgid "" "readline.__name__ readline.parse_and_bind(\n" ">>> readline." msgstr "" +">>> import rlcompleter\n" +">>> import readline\n" +">>> readline.parse_and_bind(\"tab: complete\")\n" +">>> readline. \n" +"readline.__doc__ readline.get_line_buffer( readline." +"read_init_file(\n" +"readline.__file__ readline.insert_text( readline." +"set_completer(\n" +"readline.__name__ readline.parse_and_bind(\n" +">>> readline." -#: ../../library/rlcompleter.rst:33 msgid "" "The :mod:`!rlcompleter` module is designed for use with Python's :ref:" "`interactive mode `. Unless Python is run with the :option:" "`-S` option, the module is automatically imported and configured (see :ref:" "`rlcompleter-config`)." msgstr "" +":mod:`!rlcompleter` モジュールは、Python の :ref:`対話モード ` で使うよう設計されています。\n" +":option:`-S` オプション付きで Python を実行した場合を除き、自動的にインポート" +"され、設定されます (:ref:`rlcompleter-config` を参照)。" #: ../../library/rlcompleter.rst:38 msgid "" @@ -84,16 +102,16 @@ msgstr "" msgid "Completer objects have the following method:" msgstr "Completerオブジェクトは以下のメソッドを持っています:" -#: ../../library/rlcompleter.rst:50 msgid "Return the next possible completion for *text*." -msgstr "" +msgstr "*text* の次の補完候補を返します。" -#: ../../library/rlcompleter.rst:52 msgid "" "When called by the :mod:`readline` module, this method is called " "successively with ``state == 0, 1, 2, ...`` until the method returns " "``None``." msgstr "" +":mod:`readline` モジュールから呼び出されるときは、``None`` を返すまで " +"``state == 0, 1, 2, ...`` で順に呼び出されます。" #: ../../library/rlcompleter.rst:56 msgid "" @@ -105,7 +123,6 @@ msgstr "" "`builtins` で定義されている名前か、キーワード (:mod:`keyword` モジュールで定" "義されている) から補完されます。" -#: ../../library/rlcompleter.rst:60 msgid "" "If called for a dotted name, it will try to evaluate anything without " "obvious side-effects (functions will not be evaluated, but it can generate " @@ -114,3 +131,9 @@ msgid "" "evaluation of the expression is caught, silenced and :const:`None` is " "returned." msgstr "" +"ドットで区切られた名前に対して呼び出された場合、明らかな副作用がない範囲で最" +"後の部分より前を評価し、残りの部分にマッチするものを :func:`dir` 関数で探しま" +"す。\n" +"関数は評価しませんが、:meth:`~object.__getattr__` が呼び出されることはありま" +"す。\n" +"式の評価中に発生した例外はすべて捕捉して抑制し、:const:`None` を返します。" diff --git a/library/runpy.po b/library/runpy.po index 5f2f95307..c699217c6 100644 --- a/library/runpy.po +++ b/library/runpy.po @@ -19,10 +19,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/runpy.rst:2 @@ -71,23 +71,28 @@ msgstr "" msgid "The :mod:`runpy` module provides two functions:" msgstr ":mod:`runpy` モジュールは2つの関数を提供しています:" -#: ../../library/runpy.rst:35 msgid "" "Execute the code of the specified module and return the resulting module's " "globals dictionary. The module's code is first located using the standard " "import mechanism (refer to :pep:`302` for details) and then executed in a " "fresh module namespace." msgstr "" +"指定したモジュールのコードを実行し、実行後のモジュールのグローバル変数の辞書" +"を返します。\n" +"まず標準のインポート機構 (詳細は :pep:`302` を参照) でモジュールのコードを探" +"し、新しいモジュール名前空間で実行します。" -#: ../../library/runpy.rst:40 msgid "" "The *mod_name* argument should be an absolute module name. If the module " "name refers to a package rather than a normal module, then that package is " "imported and the :mod:`__main__` submodule within that package is then " "executed and the resulting module globals dictionary returned." msgstr "" +"*mod_name* 引数には絶対モジュール名を指定します。\n" +"モジュール名が通常のモジュールではなくパッケージを指す場合は、そのパッケージ" +"をインポートしてから、パッケージ内の :mod:`__main__` サブモジュールを実行し、" +"実行後のモジュールのグローバル変数の辞書を返します。" -#: ../../library/runpy.rst:46 msgid "" "The optional dictionary argument *init_globals* may be used to pre-populate " "the module's globals dictionary before the code is executed. *init_globals* " @@ -95,6 +100,11 @@ msgid "" "defined in *init_globals*, those definitions are overridden by :func:" "`run_module`." msgstr "" +"省略可能な辞書引数 *init_globals* を使うと、コードの実行前にモジュールのグ" +"ローバル変数の辞書に値を設定できます。\n" +"*init_globals* 自体は変更されません。\n" +"以下の特殊なグローバル変数が *init_globals* に定義されている場合、その定義" +"は :func:`run_module` によって上書きされます。" #: ../../library/runpy.rst:52 ../../library/runpy.rst:127 msgid "" @@ -105,22 +115,23 @@ msgid "" "implementation detail.)" msgstr "" -#: ../../library/runpy.rst:58 msgid "" "``__name__`` is set to *run_name* if this optional argument is not :const:" "`None`, to ``mod_name + '.__main__'`` if the named module is a package and " "to the *mod_name* argument otherwise." msgstr "" -"``__name__`` は、オプション引数 *run_name* が :const:`None` でない場合、指定" -"されたモジュールがパッケージであれば ``mod_name + '.__main__'`` に、そうでな" -"ければ *mod_name* 引数の値がセットされます。" +"``__name__`` は、 *run_name* が :const:`None` でない場合は *run_name* に設定" +"されます。 *run_name* が ``None`` である場合、 *mod_name* がパッケージであれ" +"ば ``mod_name + '.__main__'`` に、それ以外では *mod_name* に設定されます。" -#: ../../library/runpy.rst:62 msgid "" "``__spec__`` will be set appropriately for the *actually* imported module " "(that is, ``__spec__.name`` will always be *mod_name* or ``mod_name + '." "__main__'``, never *run_name*)." msgstr "" +"``__spec__`` には *実際に* インポートするモジュールに適した値を設定します (つ" +"まり、``__spec__.name`` は常に *mod_name* または ``mod_name + '.__main__'`` " +"であり、*run_name* になることはありません)。" #: ../../library/runpy.rst:66 msgid "" @@ -142,13 +153,17 @@ msgstr "" "と ``sys.modules[__name__]`` はどちらも関数が処理を戻す前にもとの値に復旧しま" "す。" -#: ../../library/runpy.rst:75 msgid "" "Note that this manipulation of :mod:`sys` is not thread-safe. Other threads " "may see the partially initialised module, as well as the altered list of " "arguments. It is recommended that the ``sys`` module be left alone when " "invoking this function from threaded code." msgstr "" +"この :mod:`sys` の操作はスレッドセーフではありません。\n" +"他のスレッドからは、初期化途中のモジュールや変更された引数リストが見える場合" +"があります。\n" +"スレッドを使うコードからこの関数を呼び出す場合は、``sys`` モジュールを変更し" +"ないことをお勧めします。" #: ../../library/runpy.rst:81 msgid "" @@ -158,30 +173,36 @@ msgstr "" "コマンドラインから、 :option:`-m` オプションを与えることで同じ機能を実現出来" "ます。" -#: ../../library/runpy.rst:84 msgid "" "Added ability to execute packages by looking for a :mod:`__main__` submodule." msgstr "" +":mod:`__main__` サブモジュールを探してパッケージを実行する機能が追加されまし" +"た。" #: ../../library/runpy.rst:87 msgid "Added ``__cached__`` global variable (see :pep:`3147`)." msgstr "``__cached__`` グローバル変数が追加されました (:pep:`3147` を参照)。" -#: ../../library/runpy.rst:90 msgid "" "Updated to take advantage of the module spec feature added by :pep:`451`. " "This allows ``__cached__`` to be set correctly for modules run this way, as " "well as ensuring the real module name is always accessible as ``__spec__." "name``." msgstr "" +":pep:`451` で追加されたモジュール仕様の機能を活用するよう更新されました。\n" +"これにより、この方法で実行したモジュールの ``__cached__`` を正しく設定できる" +"ようになり、実際のモジュール名を常に ``__spec__.name`` で取得できるようになり" +"ました。" -#: ../../library/runpy.rst:96 msgid "" "The setting of ``__cached__``, ``__loader__``, and ``__package__`` are " "deprecated. See :class:`~importlib.machinery.ModuleSpec` for alternatives." msgstr "" +"``__cached__``、``__loader__``、``__package__`` の設定は非推奨になりまし" +"た。\n" +"代わりの方法については :class:`~importlib.machinery.ModuleSpec` を参照してく" +"ださい。" -#: ../../library/runpy.rst:106 msgid "" "Execute the code at the named filesystem location and return the resulting " "module's globals dictionary. As with a script name supplied to the CPython " @@ -189,8 +210,13 @@ msgid "" "bytecode file or a valid :data:`sys.path` entry containing a :mod:`__main__` " "module (e.g. a zipfile containing a top-level :file:`__main__.py` file)." msgstr "" +"指定したファイルシステム上の場所にあるコードを実行し、実行後のモジュールのグ" +"ローバル変数の辞書を返します。\n" +"CPython のコマンドラインに渡すスクリプト名と同様、*file_path* には Python " +"ソースファイル、コンパイル済みのバイトコードファイル、または :mod:`__main__` " +"モジュールを含む有効な :data:`sys.path` エントリー (例えば最上位に :file:" +"`__main__.py` がある zip ファイル) を指定できます。" -#: ../../library/runpy.rst:113 msgid "" "For a simple script, the specified code is simply executed in a fresh module " "namespace. For a valid :data:`sys.path` entry (typically a zipfile or " @@ -200,8 +226,14 @@ msgid "" "existing ``__main__`` entry located elsewhere on ``sys.path`` if there is no " "such module at the specified location." msgstr "" +"単純なスクリプトの場合は、指定されたコードを新しいモジュール名前空間で実行す" +"るだけです。\n" +"有効な :data:`sys.path` エントリー (通常は zip ファイルまたはディレクトリ) の" +"場合は、まずそのエントリーを ``sys.path`` の先頭に追加します。\n" +"次に、更新されたパスを使って :mod:`__main__` モジュールを探し、実行します。\n" +"指定した場所にそのモジュールがない場合、``sys.path`` 上の別の場所にある既存" +"の ``__main__`` を実行しないようにする特別な保護はありません。" -#: ../../library/runpy.rst:121 msgid "" "The optional dictionary argument *init_globals* may be used to pre-populate " "the module's globals dictionary before the code is executed. *init_globals* " @@ -209,14 +241,20 @@ msgid "" "defined in *init_globals*, those definitions are overridden by :func:" "`run_path`." msgstr "" +"省略可能な辞書引数 *init_globals* を使うと、コードの実行前にモジュールのグ" +"ローバル変数の辞書に値を設定できます。\n" +"*init_globals* 自体は変更されません。\n" +"以下の特殊なグローバル変数が *init_globals* に定義されている場合、その定義" +"は :func:`run_path` によって上書きされます。" #: ../../library/runpy.rst:133 msgid "" "``__name__`` is set to *run_name* if this optional argument is not :const:" "`None` and to ``''`` otherwise." msgstr "" -"``__name__`` は、オプション引数 *run_name* が :const:`None` でない場合、 " -"*run_name* に設定され、それ以外の場合は ``''`` に設定されます。" +"``__name__`` は、オプション引数 *run_name* が :const:`None` でない場合は " +"*run_name* に設定されます。 *run_name* が ``None`` の場合は ``''`` " +"に設定されます。" #: ../../library/runpy.rst:136 msgid "" @@ -235,7 +273,6 @@ msgid "" "ref:`set as normal ` based on the module spec." msgstr "" -#: ../../library/runpy.rst:147 msgid "" "A number of alterations are also made to the :mod:`sys` module. Firstly, :" "data:`sys.path` may be altered as described above. ``sys.argv[0]`` is " @@ -244,8 +281,12 @@ msgid "" "modifications to items in :mod:`sys` are reverted before the function " "returns." msgstr "" +":mod:`sys` モジュールにもいくつかの変更を加えます。\n" +"まず、上述のように :data:`sys.path` を変更する場合があります。\n" +"``sys.argv[0]`` を *file_path* の値に更新し、``sys.modules[__name__]`` を実行" +"対象のモジュールを表す一時的なモジュールオブジェクトに更新します。\n" +":mod:`sys` 内の要素への変更はすべて、関数から戻る前に元に戻します。" -#: ../../library/runpy.rst:154 msgid "" "Note that, unlike :func:`run_module`, the alterations made to :mod:`sys` are " "not optional in this function as these adjustments are essential to allowing " @@ -253,6 +294,12 @@ msgid "" "still apply, use of this function in threaded code should be either " "serialised with the import lock or delegated to a separate process." msgstr "" +":func:`run_module` とは異なり、この関数では :mod:`sys` への変更を省略できませ" +"ん。\n" +":data:`sys.path` エントリーの実行にはこれらの変更が必要なためです。\n" +"スレッドセーフに関する制約も同様にあるため、スレッドを使うコードでこの関数を" +"使う場合は、インポートロックで実行を直列化するか、別のプロセスに実行を委ねて" +"ください。" #: ../../library/runpy.rst:161 msgid "" @@ -262,19 +309,22 @@ msgstr "" "コマンドラインから :ref:`using-on-interface-options` で同じ機能を使えます " "(``python path/to/script``)。" -#: ../../library/runpy.rst:166 msgid "" "Updated to take advantage of the module spec feature added by :pep:`451`. " "This allows ``__cached__`` to be set correctly in the case where " "``__main__`` is imported from a valid :data:`sys.path` entry rather than " "being executed directly." msgstr "" +":pep:`451` で追加されたモジュール仕様の機能を活用するよう更新されました。\n" +"これにより、``__main__`` を直接実行するのではなく有効な :data:`sys.path` エン" +"トリーからインポートする場合に、``__cached__`` を正しく設定できるようになりま" +"した。" -#: ../../library/runpy.rst:172 msgid "" "The setting of ``__cached__``, ``__loader__``, and ``__package__`` are " "deprecated." msgstr "" +"``__cached__``、``__loader__``、``__package__`` の設定は非推奨になりました。" #: ../../library/runpy.rst:178 msgid ":pep:`338` -- Executing modules as scripts" diff --git a/library/sched.po b/library/sched.po index 0f57d8ee2..87f78f8bd 100644 --- a/library/sched.po +++ b/library/sched.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/sched.rst:2 @@ -40,7 +40,6 @@ msgstr "" ":mod:`sched` モジュールは一般的な目的のためのイベントスケジューラを実装するク" "ラスを定義します:" -#: ../../library/sched.rst:20 msgid "" "The :class:`scheduler` class defines a generic interface to scheduling " "events. It needs two functions to actually deal with the \"outside world\" " @@ -52,14 +51,15 @@ msgid "" "to run in multi-threaded applications." msgstr "" ":class:`scheduler` クラスはイベントをスケジュールするための一般的なインター" -"フェースを定義します。それは \"外の世界\" を実際に扱うための2つの関数を必要と" -"します --- *timefunc* は引数なしで呼ばれて 1 つの数値を返す callable オブジェ" -"クトでなければなりません (戻り値は任意の単位で「時間」を表します)。 " +"フェースを定義します。\n" +"それは \"外の世界\" を実際に扱うための2つの関数を必要とします --- *timefunc* " +"は引数なしで呼ばれて 1 つの数値を返す callable オブジェクトでなければなりませ" +"ん (戻り値は任意の単位で「時間」を表します)。\n" "*delayfunc* は 1 つの引数を持つ callable オブジェクトでなければならず、その時" -"間だけ遅延する必要があります (引数は *timefunc* の出力と互換)。 *delayfunc* " -"は、各々のイベントが実行された後に引数 ``0`` で呼ばれることがあります。これ" -"は、マルチスレッドアプリケーションの中で他のスレッドが実行する機会を与えるた" -"めです。" +"間だけ遅延する必要があります (引数は *timefunc* の出力と互換)。\n" +"*delayfunc* は、各々のイベントが実行された後に引数 ``0`` でも呼ばれます。\n" +"これは、マルチスレッドアプリケーションの中で他のスレッドが実行する機会を与え" +"るためです。" #: ../../library/sched.rst:29 msgid "*timefunc* and *delayfunc* parameters are optional." @@ -76,7 +76,6 @@ msgstr "" msgid "Example::" msgstr "以下はプログラム例です::" -#: ../../library/sched.rst:38 msgid "" ">>> import sched, time\n" ">>> s = sched.scheduler(time.time, time.sleep)\n" @@ -106,6 +105,33 @@ msgid "" "From print_time 1652342840.369612 default\n" "1652342840.3697174" msgstr "" +">>> import sched, time\n" +">>> s = sched.scheduler(time.time, time.sleep)\n" +">>> def print_time(a='default'):\n" +"... print(\"From print_time\", time.time(), a)\n" +"...\n" +">>> def print_some_times():\n" +"... print(time.time())\n" +"... s.enter(10, 1, print_time)\n" +"... s.enter(5, 2, print_time, argument=('positional',))\n" +"... # enter() は相対時刻なので、優先度の高い 'keyword' が 'positional' の" +"後に実行される\n" +"... s.enter(5, 1, print_time, kwargs={'a': 'keyword'})\n" +"... s.enterabs(1_650_000_000, 10, print_time, argument=(\"first " +"enterabs\",))\n" +"... s.enterabs(1_650_000_000, 5, print_time, argument=(\"second " +"enterabs\",))\n" +"... s.run()\n" +"... print(time.time())\n" +"...\n" +">>> print_some_times()\n" +"1652342830.3640375\n" +"From print_time 1652342830.3642538 second enterabs\n" +"From print_time 1652342830.3643398 first enterabs\n" +"From print_time 1652342835.3694863 positional\n" +"From print_time 1652342835.3696074 keyword\n" +"From print_time 1652342840.369612 default\n" +"1652342840.3697174" #: ../../library/sched.rst:67 msgid "Scheduler Objects" @@ -156,22 +182,22 @@ msgstr "*argument* 引数が任意になりました。" msgid "*kwargs* parameter was added." msgstr "*kwargs* 引数が追加されました。" -#: ../../library/sched.rst:95 msgid "" "Schedule an event for *delay* more time units. Other than the relative time, " "the other arguments, the effect and the return value are the same as those " "for :meth:`enterabs`." msgstr "" -"時間単位以上の *delay* でイベントをスケジュールします。相対的時間以外の、引" -"数、効果、戻り値は、 :meth:`enterabs` に対するものと同じです。" +"現在から *delay* 時間単位後にイベントをスケジュールします。\n" +"時刻を相対値で指定する点を除き、引数、動作、戻り値は :meth:`enterabs` と同じ" +"です。" -#: ../../library/sched.rst:107 msgid "" "Remove the event from the queue. If *event* is not an event currently in the " "queue, this method will raise a :exc:`ValueError`." msgstr "" -"キューからイベントを消去します。もし *event* がキューにある現在のイベントでな" -"いならば、このメソッドは :exc:`ValueError` を送出します。" +"キューからイベントを消去します。\n" +"もし *event* が現在キューに入っているイベントでないならば、このメソッドは :" +"exc:`ValueError` を送出します。" #: ../../library/sched.rst:113 msgid "Return ``True`` if the event queue is empty." @@ -198,28 +224,27 @@ msgstr "" "(存在する場合) 実行し、スケジューラ内で次にスケジュールされた呼び出しの期限" "を (存在する場合) 返します。 " -#: ../../library/sched.rst:126 msgid "" "Either *action* or *delayfunc* can raise an exception. In either case, the " "scheduler will maintain a consistent state and propagate the exception. If " "an exception is raised by *action*, the event will not be attempted in " "future calls to :meth:`run`." msgstr "" -"*action* あるいは *delayfunc* は例外を投げることができます。いずれの場合も、" -"スケジューラは一貫した状態を維持し、例外を伝播するでしょう。例外が *action* " -"によって投げられる場合、イベントは :meth:`run` への呼出しを未来に行なわないで" -"しょう。" +"*action* または *delayfunc* が例外を送出することがあります。\n" +"どちらの場合もスケジューラーは一貫した状態を保ち、例外を伝播します。\n" +"*action* が例外を送出した場合、その後 :meth:`run` を呼び出しても、そのイベン" +"トを再試行しません。" -#: ../../library/sched.rst:131 msgid "" "If a sequence of events takes longer to run than the time available before " "the next event, the scheduler will simply fall behind. No events will be " "dropped; the calling code is responsible for canceling events which are no " "longer pertinent." msgstr "" -"イベントのシーケンスが、次イベントの前に、利用可能時間より実行時間が長いと、" -"スケジューラは単に遅れることになるでしょう。イベントが落ちることはありませ" -"ん; 呼出しコードはもはや適切でないキャンセルイベントに対して責任があります。" +"一連のイベントの実行時間が次のイベントまでの時間を超えると、スケジューラーの" +"実行が遅れます。\n" +"イベントを破棄することはありません。\n" +"不要になったイベントのキャンセルは、呼び出し側のコードで行う必要があります。" #: ../../library/sched.rst:136 msgid "*blocking* parameter was added." diff --git a/library/secrets.po b/library/secrets.po index 351ff72c6..90e698410 100644 --- a/library/secrets.po +++ b/library/secrets.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/secrets.rst:2 @@ -87,7 +87,7 @@ msgstr "[0, *exclusive_upper_bound*) の範囲のランダムな整数を返し #: ../../library/secrets.rst:55 msgid "Return a non-negative int with *k* random bits." -msgstr "" +msgstr "ランダムな *k* ビットの非負の整数を返します。" #: ../../library/secrets.rst:59 msgid "Generating tokens" @@ -115,6 +115,8 @@ msgid "" ">>> token_bytes(16)\n" "b'\\xebr\\x17D*t\\xae\\xd4\\xe3S\\xb6\\xe2\\xebP1\\x8b'" msgstr "" +">>> token_bytes(16)\n" +"b'\\xebr\\x17D*t\\xae\\xd4\\xe3S\\xb6\\xe2\\xebP1\\x8b'" #: ../../library/secrets.rst:79 msgid "" @@ -131,6 +133,8 @@ msgid "" ">>> token_hex(16)\n" "'f9bf78b9a18ce6d46a0cd2b0b86df9da'" msgstr "" +">>> token_hex(16)\n" +"'f9bf78b9a18ce6d46a0cd2b0b86df9da'" #: ../../library/secrets.rst:90 msgid "" @@ -149,6 +153,8 @@ msgid "" ">>> token_urlsafe(16)\n" "'Drmhze6EPcv0fN_81Bj-nA'" msgstr "" +">>> token_urlsafe(16)\n" +"'Drmhze6EPcv0fN_81Bj-nA'" #: ../../library/secrets.rst:102 msgid "How many bytes should tokens use?" @@ -239,6 +245,10 @@ msgid "" "alphabet = string.ascii_letters + string.digits\n" "password = ''.join(secrets.choice(alphabet) for i in range(8))" msgstr "" +"import string\n" +"import secrets\n" +"alphabet = string.ascii_letters + string.digits\n" +"password = ''.join(secrets.choice(alphabet) for i in range(8))" #: ../../library/secrets.rst:157 msgid "" @@ -250,13 +260,12 @@ msgstr "" "でパスワードを保存 <257>` してはいけません。パスワードは暗号学的に強い一方向 " "(非可逆) ハッシュ関数を用いてソルトしハッシュしなければなりません。" -#: ../../library/secrets.rst:163 msgid "" "Generate a ten-character alphanumeric password with at least one lowercase " "character, at least one uppercase character, and at least three digits:" msgstr "" -"アルファべットと数字からなり、小文字を少なくとも1つと数字を少なくとも3つ含" -"む、10文字のパスワードを生成するには:" +"小文字を少なくとも1つ、大文字を少なくとも1つ、数字を少なくとも3つ含む、英数字" +"10文字のパスワードを生成する例です。 ::" #: ../../library/secrets.rst:167 msgid "" @@ -270,12 +279,20 @@ msgid "" " and sum(c.isdigit() for c in password) >= 3):\n" " break" msgstr "" +"import string\n" +"import secrets\n" +"alphabet = string.ascii_letters + string.digits\n" +"while True:\n" +" password = ''.join(secrets.choice(alphabet) for i in range(10))\n" +" if (any(c.islower() for c in password)\n" +" and any(c.isupper() for c in password)\n" +" and sum(c.isdigit() for c in password) >= 3):\n" +" break" #: ../../library/secrets.rst:180 msgid "Generate an `XKCD-style passphrase `_:" msgstr "`XKCD スタイルのパスフレーズ `_ を生成するには:" -#: ../../library/secrets.rst:182 msgid "" "import secrets\n" "# On standard Linux systems, use a convenient dictionary file.\n" @@ -284,6 +301,13 @@ msgid "" " words = [word.strip() for word in f]\n" " password = ' '.join(secrets.choice(words) for i in range(4))" msgstr "" +"import secrets\n" +"# 標準的な Linux システムでは、利用できる辞書ファイルを使う。\n" +"# 他のプラットフォームでは、単語リストを自分で用意する必要がある場合があ" +"る。\n" +"with open('/usr/share/dict/words') as f:\n" +" words = [word.strip() for word in f]\n" +" password = ' '.join(secrets.choice(words) for i in range(4))" #: ../../library/secrets.rst:192 msgid "" @@ -298,3 +322,5 @@ msgid "" "import secrets\n" "url = 'https://example.com/reset=' + secrets.token_urlsafe()" msgstr "" +"import secrets\n" +"url = 'https://example.com/reset=' + secrets.token_urlsafe()" diff --git a/library/security_warnings.po b/library/security_warnings.po index dd2e3de15..5b569bce0 100644 --- a/library/security_warnings.po +++ b/library/security_warnings.po @@ -16,25 +16,25 @@ msgstr "" "Last-Translator: tomo, 2021\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/security_warnings.rst:6 msgid "Security Considerations" msgstr "セキュリティで考慮すべき点" -#: ../../library/security_warnings.rst:8 msgid "The following modules have specific security considerations:" -msgstr "" +msgstr "以下のモジュールには、特有のセキュリティ上の注意点があります:" -#: ../../library/security_warnings.rst:10 msgid "" ":mod:`base64`: :ref:`base64 security considerations ` in :" "rfc:`4648`" msgstr "" +":mod:`base64`: :rfc:`4648` にある :ref:`base64 のセキュリティ上の注意点 " +"`" #: ../../library/security_warnings.rst:12 msgid "" @@ -43,68 +43,75 @@ msgid "" "usedforsecurity>`" msgstr "" -#: ../../library/security_warnings.rst:15 msgid "" ":mod:`http.server` is not suitable for production use, only implementing " "basic security checks. See the :ref:`security considerations `." msgstr "" +":mod:`http.server` は基本的なセキュリティチェックしか実装していないため、本番" +"環境での使用には適していません。\n" +":ref:`セキュリティ上の注意点 ` を参照してください。" -#: ../../library/security_warnings.rst:17 msgid "" ":mod:`logging`: :ref:`Logging configuration uses eval() `" msgstr "" +":mod:`logging`: :ref:`ロギングの設定は eval() を使います `" -#: ../../library/security_warnings.rst:19 msgid "" ":mod:`multiprocessing`: :ref:`Connection.recv() uses pickle `" msgstr "" +":mod:`multiprocessing`: :ref:`Connection.recv() は pickle を使います " +"`" -#: ../../library/security_warnings.rst:21 msgid ":mod:`pickle`: :ref:`Restricting globals in pickle `" msgstr "" +":mod:`pickle`: :ref:`pickle でグローバル変数を制限する `" -#: ../../library/security_warnings.rst:22 msgid "" ":mod:`random` shouldn't be used for security purposes, use :mod:`secrets` " "instead" msgstr "" +":mod:`random` はセキュリティ目的には使わず、代わりに :mod:`secrets` を使って" +"ください。" -#: ../../library/security_warnings.rst:24 msgid "" ":mod:`shelve`: :ref:`shelve is based on pickle and thus unsuitable for " "dealing with untrusted sources `" msgstr "" +":mod:`shelve`: :ref:`shelve は pickle に基づくため、信頼できない情報源からの" +"データの処理には適していません `" -#: ../../library/security_warnings.rst:26 msgid ":mod:`ssl`: :ref:`SSL/TLS security considerations `" -msgstr "" +msgstr ":mod:`ssl`: :ref:`SSL/TLS のセキュリティ上の注意点 `" -#: ../../library/security_warnings.rst:27 msgid "" ":mod:`subprocess`: :ref:`Subprocess security considerations `" msgstr "" +":mod:`subprocess`: :ref:`サブプロセスのセキュリティ上の注意点 `" -#: ../../library/security_warnings.rst:29 msgid "" ":mod:`tempfile`: :ref:`mktemp is deprecated due to vulnerability to race " "conditions `" msgstr "" +":mod:`tempfile`: :ref:`mktemp は競合状態への脆弱性のため非推奨です `" #: ../../library/security_warnings.rst:31 msgid ":mod:`xml`: :ref:`XML vulnerabilities `" msgstr "" -#: ../../library/security_warnings.rst:32 msgid "" ":mod:`zipfile`: :ref:`maliciously prepared .zip files can cause disk volume " "exhaustion `" msgstr "" +":mod:`zipfile`: :ref:`悪意を持って作成された .zip ファイルはディスク容量を使" +"い切る可能性があります `" -#: ../../library/security_warnings.rst:35 msgid "" "The :option:`-I` command line option can be used to run Python in isolated " "mode. When it cannot be used, the :option:`-P` option or the :envvar:" @@ -112,7 +119,12 @@ msgid "" "potentially unsafe path to :data:`sys.path` such as the current directory, " "the script's directory or an empty string." msgstr "" +":option:`-I` コマンドラインオプションを使うと、Python を隔離モードで実行でき" +"ます。\n" +"これを使えない場合は、:option:`-P` オプションまたは :envvar:`PYTHONSAFEPATH` " +"環境変数を使うと、カレントディレクトリ、スクリプトのディレクトリ、空文字列の" +"ような、危険な可能性のあるパスを :data:`sys.path` の先頭に追加しないようにで" +"きます。" -#: ../../library/security_warnings.rst:3 msgid "security considerations" -msgstr "" +msgstr "セキュリティ上の注意点" diff --git a/library/select.po b/library/select.po index 8a49e8833..2414708f5 100644 --- a/library/select.po +++ b/library/select.po @@ -21,10 +21,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/select.rst:2 @@ -62,9 +62,8 @@ msgstr "" "OS レベルプリミティブを使用した正確な制御を求めない限り、代わりに :mod:" "`selectors` を使用することが推奨されます。" -#: ../../library/select.rst:177 ../../includes/wasm-notavail.rst:3 msgid "Availability" -msgstr "" +msgstr "利用可能な環境" #: ../../includes/wasm-notavail.rst:5 msgid "" @@ -137,20 +136,21 @@ msgid "" "otherwise it has no effect (though its value is still checked)." msgstr "" -#: ../../library/select.rst:68 msgid "" "*flags* is deprecated and completely ignored. However, when supplied, its " "value must be ``0`` or ``select.EPOLL_CLOEXEC``, otherwise ``OSError`` is " "raised." msgstr "" +"*flags* は非推奨で、完全に無視されます。\n" +"ただし指定する場合は ``0`` または ``select.EPOLL_CLOEXEC`` でなければならず、" +"それ以外では ``OSError`` が送出されます。" -#: ../../library/select.rst:72 msgid "" "See the :ref:`epoll-objects` section below for the methods supported by " "epolling objects." msgstr "" -"エッジポーリングオブジェクトが提供しているメソッドについては :ref:`epoll-" -"objects` 節を参照してください。" +"epoll オブジェクトが提供するメソッドについては、後述の :ref:`epoll-objects` " +"節を参照してください。" #: ../../library/select.rst:75 msgid "" @@ -216,13 +216,16 @@ msgstr "" "カーネルイベントオブジェクトが提供しているメソッドについては、 :ref:`kevent-" "objects` 節を参照してください。" -#: ../../library/select.rst:120 msgid "" "This is a straightforward interface to the Unix :c:func:`!select` system " "call. The first three arguments are iterables of 'waitable objects': either " "integers representing file descriptors or objects with a parameterless " "method named :meth:`~io.IOBase.fileno` returning such an integer:" msgstr "" +"Unix の :c:func:`!select` システムコールへの単純なインターフェースです。\n" +"最初の三つの引数は「待機可能なオブジェクト」のイテラブルです。\n" +"各オブジェクトはファイル記述子を表す整数、または引数なしで呼び出せ、そのよう" +"な整数を返す :meth:`~io.IOBase.fileno` メソッドを持つオブジェクトです。" #: ../../library/select.rst:125 msgid "*rlist*: wait until ready for reading" @@ -277,13 +280,15 @@ msgstr "" "の場合、適切な (まったくデタラメな数ではなく本物のファイル記述子を返す) :" "meth:`~io.IOBase.fileno` メソッドを持つ必要があります。" -#: ../../library/select.rst:156 msgid "" "File objects on Windows are not acceptable, but sockets are. On Windows, " "the underlying :c:func:`!select` function is provided by the WinSock " "library, and does not handle file descriptors that don't originate from " "WinSock." msgstr "" +"Windows ではファイルオブジェクトを使えませんが、ソケットは使えます。\n" +"Windows では基盤となる :c:func:`!select` 関数が WinSock ライブラリによって提" +"供され、WinSock 以外に由来するファイル記述子を扱えません。" #: ../../library/select.rst:161 ../../library/select.rst:267 #: ../../library/select.rst:373 ../../library/select.rst:461 @@ -314,17 +319,20 @@ msgstr "この値は POSIX により少なくとも512であることが保証 msgid "``/dev/poll`` Polling Objects" msgstr "``/dev/poll`` ポーリングオブジェクト" -#: ../../library/select.rst:187 msgid "" "Solaris and derivatives have ``/dev/poll``. While :c:func:`!select` is *O*\\ " "(*highest file descriptor*) and :c:func:`!poll` is *O*\\ (*number of file " "descriptors*), ``/dev/poll`` is *O*\\ (*active file descriptors*)." msgstr "" +"Solaris とその派生システムには ``/dev/poll`` があります。\n" +":c:func:`!select` の計算量は *O*\\ (*最大のファイル記述子*)、:c:func:`!poll` " +"は *O*\\ (*ファイル記述子の数*) ですが、``/dev/poll`` は *O*\\ (*アクティブな" +"ファイル記述子の数*) です。" -#: ../../library/select.rst:191 msgid "" "``/dev/poll`` behaviour is very close to the standard :c:func:`!poll` object." msgstr "" +"``/dev/poll`` の動作は標準の :c:func:`!poll` オブジェクトによく似ています。" #: ../../library/select.rst:197 msgid "Close the file descriptor of the polling object." @@ -360,12 +368,15 @@ msgid "" "`POLLPRI`, and :const:`POLLOUT`." msgstr "" -#: ../../library/select.rst:231 msgid "" "Registering a file descriptor that's already registered is not an error, but " "the result is undefined. The appropriate action is to unregister or modify " "it first. This is an important difference compared with :c:func:`!poll`." msgstr "" +"登録済みのファイル記述子を再び登録してもエラーにはなりませんが、結果は未定義" +"です。\n" +"先に登録解除するか、変更するのが適切です。\n" +"これは :c:func:`!poll` との重要な違いです。" #: ../../library/select.rst:239 msgid "" @@ -391,7 +402,6 @@ msgid "" "ignored." msgstr "登録されていないファイル記述子の削除を試みるのは安全に無視されます。" -#: ../../library/select.rst:256 msgid "" "Polls the set of registered file descriptors, and returns a possibly empty " "list containing ``(fd, event)`` 2-tuples for the descriptors that have " @@ -406,15 +416,19 @@ msgid "" msgstr "" "登録されたファイル記述子に対してポーリングを行い、報告すべき I/O イベントまた" "はエラーの発生したファイル記述子毎に 2 要素のタプル ``(fd, event)`` からなる" -"リストを返します。リストは空になることもあります。 *fd* はファイル記述子で、 " -"*event* は該当するファイル記述子について報告されたイベントを表すビットマスク" -"です --- 例えば :const:`POLLIN` は入力待ちを示し、 :const:`POLLOUT` はファイ" -"ル記述子に対する書き込みが可能を示す、などです。空のリストは呼び出しがタイム" -"アウトしたか、報告すべきイベントがどのファイル記述子でも発生しなかったことを" -"示します。 *timeout* が与えられた場合、処理を戻すまで待機する時間の長さをミリ" -"秒単位で指定します。 *timeout* が省略されたり、 -1 であったり、あるいは :" -"const:`None` の場合、そのポーリングオブジェクトが監視している何らかのイベント" -"が発生するまでブロックします。" +"リストを返します。\n" +"リストは空になることもあります。\n" +"*fd* はファイル記述子です。\n" +"*event* は、そのファイル記述子のイベントを表すビットマスクです。\n" +"例えば :const:`POLLIN` は読み込み可能な入力があること、:const:`POLLOUT` は書" +"き込みが可能なことを示します。\n" +"空のリストは報告すべきイベントがどのファイル記述子でも発生しないまま、呼び出" +"しがタイムアウトしたことを示します。\n" +"*timeout* が与えられた場合、処理を戻すまで待機する時間の長さをミリ秒単位で指" +"定します。\n" +"*timeout* が省略されたり、 -1 であったり、あるいは :const:`None` の場合、その" +"ポーリングオブジェクトが監視している何らかのイベントが発生するまでブロックし" +"ます。" #: ../../library/select.rst:277 msgid "Edge and Level Trigger Polling (epoll) Objects" @@ -566,25 +580,25 @@ msgstr ":const:`EPOLLMSG`" msgid "Ignored." msgstr "無視される。" -#: ../../library/select.rst:320 msgid ":const:`EPOLLWAKEUP`" -msgstr "" +msgstr ":const:`EPOLLWAKEUP`" -#: ../../library/select.rst:320 msgid "Prevents sleep during event waiting." -msgstr "" +msgstr "イベントの待機中にスリープするのを防ぐ。" -#: ../../library/select.rst:323 msgid "" ":const:`EPOLLEXCLUSIVE` was added. It's only supported by Linux Kernel 4.5 " "or later." msgstr "" +":const:`EPOLLEXCLUSIVE` が追加されました。\n" +"Linux カーネル 4.5 以降でのみ利用できます。" -#: ../../library/select.rst:327 msgid "" ":const:`EPOLLWAKEUP` was added. It's only supported by Linux Kernel 3.5 or " "later." msgstr "" +":const:`EPOLLWAKEUP` が追加されました。\n" +"Linux カーネル 3.5 以降でのみ利用できます。" #: ../../library/select.rst:333 msgid "Close the control file descriptor of the epoll object." @@ -614,9 +628,8 @@ msgstr "登録されたファイル記述子変更します。" msgid "Remove a registered file descriptor from the epoll object." msgstr "epoll オブジェクトから登録されたファイル記述子 *fd* を削除します。" -#: ../../library/select.rst:365 msgid "The method no longer ignores the :data:`~errno.EBADF` error." -msgstr "" +msgstr "このメソッドは :data:`~errno.EBADF` エラーを無視しなくなりました。" #: ../../library/select.rst:371 msgid "Wait for events. timeout in seconds (float)" @@ -628,7 +641,6 @@ msgstr "" msgid "Polling Objects" msgstr "ポーリングオブジェクト" -#: ../../library/select.rst:385 msgid "" "The :c:func:`!poll` system call, supported on most Unix systems, provides " "better scalability for network servers that service many, many clients at " @@ -639,6 +651,14 @@ msgid "" "*O*\\ (*highest file descriptor*), while :c:func:`!poll` is *O*\\ (*number " "of file descriptors*)." msgstr "" +"ほとんどの Unix システムで利用できる :c:func:`!poll` システムコールは、非常に" +"多数のクライアントに同時にサービスを提供するネットワークサーバーで、より優れ" +"たスケーラビリティを発揮します。\n" +":c:func:`!poll` は対象のファイル記述子を列挙するだけで済みますが、:c:func:`!" +"select` はビットマップを構築して対象のファイル記述子のビットを立て、後でビッ" +"トマップ全体を再び線形に走査する必要があるためです。\n" +":c:func:`!select` の計算量は *O*\\ (*最大のファイル記述子*) ですが、:c:func:" +"`!poll` は *O*\\ (*ファイル記述子の数*) です。" #: ../../library/select.rst:402 msgid "" @@ -740,7 +760,6 @@ msgstr "" "登録されていないファイル記述子を登録解除しようとすると :exc:`KeyError` 例外が" "送出されます。" -#: ../../library/select.rst:450 msgid "" "Polls the set of registered file descriptors, and returns a possibly empty " "list containing ``(fd, event)`` 2-tuples for the descriptors that have " @@ -755,15 +774,19 @@ msgid "" msgstr "" "登録されたファイル記述子に対してポーリングを行い、報告すべき I/O イベントまた" "はエラーの発生したファイル記述子毎に 2 要素のタプル ``(fd, event)`` からなる" -"リストを返します。リストは空になることもあります。 *fd* はファイル記述子で、 " -"*event* は該当するファイル記述子について報告されたイベントを表すビットマスク" -"です --- 例えば :const:`POLLIN` は入力待ちを示し、 :const:`POLLOUT` はファイ" -"ル記述子に対する書き込みが可能を示す、などです。空のリストは呼び出しがタイム" -"アウトしたか、報告すべきイベントがどのファイル記述子でも発生しなかったことを" -"示します。 *timeout* が与えられた場合、処理を戻すまで待機する時間の長さをミリ" -"秒単位で指定します。 *timeout* が省略されたり、負の値であったり、あるいは :" -"const:`None` の場合、そのポーリングオブジェクトが監視している何らかのイベント" -"が発生するまでブロックします。" +"リストを返します。\n" +"リストは空になることもあります。\n" +"*fd* はファイル記述子です。\n" +"*event* は、そのファイル記述子のイベントを表すビットマスクです。\n" +"例えば :const:`POLLIN` は読み込み可能な入力があること、:const:`POLLOUT` は書" +"き込みが可能なことを示します。\n" +"空のリストは報告すべきイベントがどのファイル記述子でも発生しないまま、呼び出" +"しがタイムアウトしたことを示します。\n" +"*timeout* が与えられた場合、処理を戻すまで待機する時間の長さをミリ秒単位で指" +"定します。\n" +"*timeout* が省略されたり、負の値であったり、あるいは :const:`None` の場合、そ" +"のポーリングオブジェクトが監視している何らかのイベントが発生するまでブロック" +"します。" #: ../../library/select.rst:471 msgid "Kqueue Objects" @@ -803,9 +826,8 @@ msgstr "" msgid "Kevent Objects" msgstr "kevent オブジェクト" -#: ../../library/select.rst:514 msgid "https://man.freebsd.org/cgi/man.cgi?query=kqueue&sektion=2" -msgstr "" +msgstr "https://man.freebsd.org/cgi/man.cgi?query=kqueue&sektion=2" #: ../../library/select.rst:518 msgid "" @@ -1145,14 +1167,12 @@ msgstr "フィルタ固有のデータ。" msgid "User defined value." msgstr "ユーザー定義値。" -#: ../../library/select.rst:141 msgid "socket() (in module socket)" -msgstr "" +msgstr "socket() (socket モジュール内)" #: ../../library/select.rst:141 msgid "popen() (in module os)" msgstr "popen() (os モジュール)" -#: ../../library/select.rst:154 msgid "WinSock" -msgstr "" +msgstr "WinSock" diff --git a/library/selectors.po b/library/selectors.po index 1170f412f..dee27424d 100644 --- a/library/selectors.po +++ b/library/selectors.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/selectors.rst:2 @@ -72,17 +72,16 @@ msgstr "" "的な実装の別名になります: これはほとんどのユーザーにとってのデフォルトの選択" "になるはずです。" -#: ../../library/selectors.rst:31 msgid "" "The type of file objects supported depends on the platform: on Windows, " "sockets are supported, but not pipes, whereas on Unix, both are supported " "(some other types may be supported as well, such as fifos or special file " "devices)." msgstr "" -"プラットフォームごとにサポートされているファイルオブジェクトのタイプは異なり" -"ます: Windows ではソケットはサポートされますが、パイプはされません。Unix では" -"両方がサポートされます (その他の fifo やスペシャルファイルデバイスなどのタイ" -"プもサポートされます)。" +"対応するファイルオブジェクトの種類はプラットフォームによって異なります。\n" +"Windows ではソケットに対応していますがパイプには対応していません。\n" +"Unix では両方に対応しています (FIFO や特殊デバイスファイルなど、他の種類にも" +"対応している場合があります)。" #: ../../library/selectors.rst:38 msgid ":mod:`select`" @@ -92,9 +91,8 @@ msgstr ":mod:`select`" msgid "Low-level I/O multiplexing module." msgstr "低水準の I/O 多重化モジュールです。" -#: ../../includes/wasm-notavail.rst:3 msgid "Availability" -msgstr "" +msgstr "利用可能な環境" #: ../../includes/wasm-notavail.rst:5 msgid "" @@ -112,7 +110,6 @@ msgstr "クラス" msgid "Classes hierarchy::" msgstr "クラス階層::" -#: ../../library/selectors.rst:48 msgid "" "BaseSelector\n" "+-- SelectSelector\n" @@ -121,6 +118,12 @@ msgid "" "+-- DevpollSelector\n" "+-- KqueueSelector" msgstr "" +"BaseSelector\n" +"+-- SelectSelector\n" +"+-- PollSelector\n" +"+-- EpollSelector\n" +"+-- DevpollSelector\n" +"+-- KqueueSelector" #: ../../library/selectors.rst:56 msgid "" @@ -148,17 +151,16 @@ msgstr "読み込み可能" msgid "Available for write" msgstr "書き込み可能" -#: ../../library/selectors.rst:71 msgid "" "A :class:`SelectorKey` is a :class:`~collections.namedtuple` used to " "associate a file object to its underlying file descriptor, selected event " "mask and attached data. It is returned by several :class:`BaseSelector` " "methods." msgstr "" -":class:`SelectorKey` はそれの下層のファイルディスクリプタ、選択したイベントマ" -"スク、および付属データへのファイルオブジェクトの関連付けに使用される :class:" -"`~collections.namedtuple` です。いくつかの :class:`BaseSelector` メソッドを返" -"します。" +":class:`SelectorKey` は、ファイルオブジェクトを、そのファイル記述子、選択した" +"イベントマスク、付随するデータに関連付ける :class:`~collections.namedtuple` " +"です。\n" +":class:`BaseSelector` のいくつかのメソッドが返す値です。" #: ../../library/selectors.rst:78 msgid "File object registered." @@ -181,7 +183,6 @@ msgstr "" "です。例えば、これはクライアントごとのセッション ID を格納するために使用でき" "ます。" -#: ../../library/selectors.rst:96 msgid "" "A :class:`BaseSelector` is used to wait for I/O event readiness on multiple " "file objects. It supports file stream registration, unregistration, and a " @@ -193,47 +194,46 @@ msgid "" "implementations support the :term:`context manager` protocol." msgstr "" ":class:`BaseSelector` は複数のファイルオブジェクトの I/O イベントの準備状況の" -"待機に使用されます。これはファイルストリームを登録、登録解除、およびこれらの" -"ストリームでの I/O イベントを待機 (オプションでタイムアウト) するメソッドをサ" -"ポートします。これは抽象基底クラスであるため、インスタンスを作成できません。" -"使用する実装を明示的に指定したい、そしてプラットフォームがそれをサポートして" -"いる場合は、代わりに :class:`DefaultSelector` を使用するか、:class:" -"`SelectSelector` や :class:`KqueueSelector` などの一つを使用します。:class:" -"`BaseSelector` とその具象実装は :term:`コンテキストマネージャー ` プロトコルをサポートしています。" +"待機に使用されます。\n" +"これはファイルストリームを登録、登録解除、およびこれらのストリームでの I/O イ" +"ベントを待機 (オプションでタイムアウト) するメソッドをサポートします。\n" +"これは抽象基底クラスであるため、インスタンスを作成できません。\n" +"代わりに :class:`DefaultSelector` を使用してください。\n" +"特定の実装を明示的に使いたい場合は、そのプラットフォームが対応していれば :" +"class:`SelectSelector` や :class:`KqueueSelector` などを使用できます。\n" +":class:`BaseSelector` とその具象実装は :term:`コンテキストマネージャー " +"` プロトコルをサポートしています。" #: ../../library/selectors.rst:109 msgid "Register a file object for selection, monitoring it for I/O events." msgstr "I/O イベントを監視するファイルオブジェクトをセレクションに登録します。" -#: ../../library/selectors.rst:111 msgid "" "*fileobj* is the file object to monitor. It may either be an integer file " "descriptor or an object with a ``fileno()`` method. *events* is a bitwise " "mask of events to monitor. *data* is an opaque object." msgstr "" -"*fileobj* は監視するファイルオブジェクトです。これは整数のファイル記述子か、" -"``fileno()`` メソッドを持つオブジェクトのどちらかになります。*events* は監視" -"するイベントのビット幅マスクになります。*data* は不透明型 (Opaque) オブジェク" -"トです。" +"*fileobj* は監視するファイルオブジェクトです。\n" +"これは整数のファイル記述子か、``fileno()`` メソッドを持つオブジェクトのどちら" +"かになります。\n" +"*events* は監視するイベントのビットマスクになります。\n" +"*data* は不透明型 (Opaque) オブジェクトです。" -#: ../../library/selectors.rst:116 msgid "" "This returns a new :class:`SelectorKey` instance, or raises a :exc:" "`ValueError` in case of invalid event mask or file descriptor, or :exc:" "`KeyError` if the file object is already registered." msgstr "" -"これは新しい :class:`SelectorKey` インスタンスを返します。不正なイベントマス" -"ク化ファイル記述子のときは :exc:`ValueError` が、ファイルオブジェクトがすでに" -"登録済みのときは :exc:`KeyError` が送出されます。" +"これは新しい :class:`SelectorKey` インスタンスを返します。\n" +"不正なイベントマスクかファイル記述子のときは :exc:`ValueError` が、ファイルオ" +"ブジェクトがすでに登録済みのときは :exc:`KeyError` が送出されます。" -#: ../../library/selectors.rst:123 msgid "" "Unregister a file object from selection, removing it from monitoring. A file " "object shall be unregistered prior to being closed." msgstr "" -"ファイルオブジェクトのセレクション登録を解除し、監視対象から外します。ファイ" -"ルオブジェクトの登録解除はそのクローズより前に行われます。" +"ファイルオブジェクトのセレクション登録を解除し、監視対象から外します。\n" +"ファイルオブジェクトを閉じる前に、登録を解除する必要があります。" #: ../../library/selectors.rst:126 msgid "*fileobj* must be a file object previously registered." @@ -380,17 +380,14 @@ msgstr "" "デフォルトの selector クラスで、現在のプラットフォームで利用できる最も効率的" "な実装を使用しています。大半のユーザはこれをデフォルトにすべきです。" -#: ../../library/selectors.rst:208 msgid ":func:`select.select`-based selector." -msgstr ":func:`select.select` を基底とするセレクタです。" +msgstr ":func:`select.select` を使うセレクタです。" -#: ../../library/selectors.rst:213 msgid ":func:`select.poll`-based selector." -msgstr ":func:`select.poll` を基底とするセレクタです。" +msgstr ":func:`select.poll` を使うセレクタです。" -#: ../../library/selectors.rst:218 msgid ":func:`select.epoll`-based selector." -msgstr ":func:`select.epoll` を基底とするセレクタです。" +msgstr ":func:`select.epoll` を使うセレクタです。" #: ../../library/selectors.rst:222 msgid "" @@ -400,9 +397,8 @@ msgstr "" "下層の :func:`select.epoll` オブジェクトが使用しているファイル記述子を返しま" "す。" -#: ../../library/selectors.rst:227 msgid ":func:`select.devpoll`-based selector." -msgstr ":func:`select.devpoll` を基底とするセレクタです。" +msgstr ":func:`select.devpoll` を使うセレクタです。" #: ../../library/selectors.rst:231 msgid "" @@ -412,9 +408,8 @@ msgstr "" "下層の :func:`select.devpoll` オブジェクトが使用しているファイル記述子を返し" "ます。" -#: ../../library/selectors.rst:238 msgid ":func:`select.kqueue`-based selector." -msgstr ":func:`select.kqueue` を基底とするセレクタです。" +msgstr ":func:`select.kqueue` を使うセレクタです。" #: ../../library/selectors.rst:242 msgid "" @@ -432,7 +427,6 @@ msgstr "使用例" msgid "Here is a simple echo server implementation::" msgstr "簡単なエコーサーバの実装です::" -#: ../../library/selectors.rst:251 msgid "" "import selectors\n" "import socket\n" @@ -467,3 +461,35 @@ msgid "" " callback = key.data\n" " callback(key.fileobj, mask)" msgstr "" +"import selectors\n" +"import socket\n" +"\n" +"sel = selectors.DefaultSelector()\n" +"\n" +"def accept(sock, mask):\n" +" conn, addr = sock.accept() # 準備ができているはず\n" +" print('accepted', conn, 'from', addr)\n" +" conn.setblocking(False)\n" +" sel.register(conn, selectors.EVENT_READ, read)\n" +"\n" +"def read(conn, mask):\n" +" data = conn.recv(1000) # 準備ができているはず\n" +" if data:\n" +" print('echoing', repr(data), 'to', conn)\n" +" conn.send(data) # ブロックしないことを期待\n" +" else:\n" +" print('closing', conn)\n" +" sel.unregister(conn)\n" +" conn.close()\n" +"\n" +"sock = socket.socket()\n" +"sock.bind(('localhost', 1234))\n" +"sock.listen(100)\n" +"sock.setblocking(False)\n" +"sel.register(sock, selectors.EVENT_READ, accept)\n" +"\n" +"while True:\n" +" events = sel.select()\n" +" for key, mask in events:\n" +" callback = key.data\n" +" callback(key.fileobj, mask)" diff --git a/library/shelve.po b/library/shelve.po index 7e396f348..dba86868b 100644 --- a/library/shelve.po +++ b/library/shelve.po @@ -19,10 +19,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/shelve.rst:2 @@ -65,12 +65,14 @@ msgstr "" "*flag* パラメータは :func:`dbm.open` における *flag* パラメータと同様に解釈さ" "れます。" -#: ../../library/shelve.rst:28 msgid "" "By default, pickles created with :const:`pickle.DEFAULT_PROTOCOL` are used " "to serialize values. The version of the pickle protocol can be specified " "with the *protocol* parameter." msgstr "" +"デフォルトでは :const:`pickle.DEFAULT_PROTOCOL` を使って作成した pickle で値" +"を直列化します。\n" +"*protocol* 引数で pickle プロトコルのバージョンを指定できます。" #: ../../library/shelve.rst:32 msgid "" @@ -99,14 +101,15 @@ msgstr "" "るいは実際に変更されたかを決定する方法は存在しないのです) ために、ファイルを" "閉じる操作が非常に低速になります。" -#: ../../library/shelve.rst:44 ../../library/shelve.rst:148 msgid "" ":const:`pickle.DEFAULT_PROTOCOL` is now used as the default pickle protocol." msgstr "" +"デフォルトの pickle プロトコルに :const:`pickle.DEFAULT_PROTOCOL` を使うよう" +"になりました。" -#: ../../library/shelve.rst:48 msgid "Accepts :term:`path-like object` for filename." msgstr "" +"ファイル名として :term:`path-like object` を受け付けるようになりました。" #: ../../library/shelve.rst:53 msgid "" @@ -118,11 +121,12 @@ msgstr "" "常に :meth:`~Shelf.close` を明示的に呼ぶか、 :func:`shelve.open` をコンテキス" "トマネージャとして使用してください::" -#: ../../library/shelve.rst:57 msgid "" "with shelve.open('spam') as db:\n" " db['eggs'] = 'eggs'" msgstr "" +"with shelve.open('spam') as db:\n" +" db['eggs'] = 'eggs'" #: ../../library/shelve.rst:64 msgid "" @@ -158,20 +162,21 @@ msgstr "" "にしてディスク上の永続的な辞書を同期します。このメソッドはシェルフを :meth:" "`close` によって閉じるとき自動的に呼び出されます。" -#: ../../library/shelve.rst:83 msgid "" "Synchronize and close the persistent *dict* object. Operations on a closed " "shelf will fail with a :exc:`ValueError`." msgstr "" -"永続的な *辞書* オブジェクトを同期して閉じます。既に閉じられているシェルフに" -"対して呼び出すと :exc:`ValueError` を出し失敗します。" +"永続的な *辞書* オブジェクトを同期して閉じます。\n" +"閉じたシェルフに対する操作は :exc:`ValueError` で失敗します。" -#: ../../library/shelve.rst:89 msgid "" "`Persistent dictionary recipe `_ with widely supported " "storage formats and having the speed of native dictionaries." msgstr "" +"広くサポートされる保存形式を使い、組み込みの辞書と同じ速さで動作する `永続辞" +"書のレシピ `_。" #: ../../library/shelve.rst:95 msgid "Restrictions" @@ -212,11 +217,13 @@ msgstr "" "バージョン間で異なり、使われているデータベースの実装について知識が必要となり" "ます。" -#: ../../library/shelve.rst:116 msgid "" "On macOS :mod:`dbm.ndbm` can silently corrupt the database file on updates, " "which can cause hard crashes when trying to read from the database." msgstr "" +"macOS では :mod:`dbm.ndbm` が更新時にエラーを報告せずデータベースファイルを破" +"損することがあり、その後の読み込みでプログラムがクラッシュするおそれがありま" +"す。" #: ../../library/shelve.rst:122 msgid "" @@ -226,15 +233,17 @@ msgstr "" ":class:`collections.abc.MutableMapping` のサブクラスで、 *dict* オブジェクト" "内にpickle化された値を保持します。" -#: ../../library/shelve.rst:125 msgid "" "By default, pickles created with :const:`pickle.DEFAULT_PROTOCOL` are used " "to serialize values. The version of the pickle protocol can be specified " "with the *protocol* parameter. See the :mod:`pickle` documentation for a " "discussion of the pickle protocols." msgstr "" +"デフォルトでは :const:`pickle.DEFAULT_PROTOCOL` を使って作成した pickle で値" +"を直列化します。\n" +"*protocol* 引数で pickle プロトコルのバージョンを指定できます。\n" +"pickle プロトコルの説明は :mod:`pickle` のドキュメントを参照してください。" -#: ../../library/shelve.rst:130 msgid "" "If the *writeback* parameter is ``True``, the object will hold a cache of " "all entries accessed and write them back to the *dict* at sync and close " @@ -242,7 +251,7 @@ msgid "" "much more memory and make sync and close take a long time." msgstr "" "*writeback* パラメータが ``True`` に設定されていれば、アクセスされたすべての" -"エントリはメモリ上にキャッシュされ、ファイルを閉じる際に *dict* に書き戻され" +"エントリはメモリ上にキャッシュされ、同期時とクローズ時に *dict* に書き戻され" "ます; この機能により、可変のエントリに対して自然な操作が可能になりますが、さ" "らに多くのメモリを消費し、辞書をファイルと同期して閉じる際に長い時間がかかる" "ようになります。" @@ -316,7 +325,6 @@ msgstr "" "インターフェースは以下のコードに集約されています (``key`` は文字列で、" "``data`` は任意のオブジェクトです)::" -#: ../../library/shelve.rst:185 msgid "" "import shelve\n" "\n" @@ -348,6 +356,36 @@ msgid "" "\n" "d.close() # close it" msgstr "" +"import shelve\n" +"\n" +"d = shelve.open(filename) # 開く -- 下位ライブラリによってファイル名に\n" +" # 拡張子が付く場合がある\n" +"\n" +"d[key] = data # key にデータを保存する (既存のキーなら\n" +" # 古いデータを上書きする)\n" +"data = d[key] # key のデータのコピーを取得する\n" +" # (キーがなければ KeyError を送出する)\n" +"del d[key] # key に保存したデータを削除する\n" +" # (キーがなければ KeyError を送出する)\n" +"\n" +"flag = key in d # キーが存在すれば真\n" +"klist = list(d.keys()) # 既存のキーをすべて含むリスト (遅い!)\n" +"\n" +"# d は writeback=True を指定せずに開いたので注意:\n" +"d['xx'] = [0, 1, 2] # これは期待どおりに動作するが...\n" +"d['xx'].append(3) # これは動作しない! d['xx'] は [0, 1, 2] のま" +"ま!\n" +"\n" +"# writeback=True を指定せずに d を開いた場合、慎重にコードを書く必要がある:\n" +"temp = d['xx'] # コピーを取り出す\n" +"temp.append(5) # コピーを変更する\n" +"d['xx'] = temp # コピーを書き戻して変更を永続化する\n" +"\n" +"# d=shelve.open(filename,writeback=True) としておけば、単に\n" +"# d['xx'].append(5) と書くだけで期待どおりに動作するが、\n" +"# メモリ使用量が増え、d.close() の操作も遅くなる。\n" +"\n" +"d.close() # 閉じる" #: ../../library/shelve.rst:218 msgid "Module :mod:`dbm`" diff --git a/library/shlex.po b/library/shlex.po index 5f82205fa..144f88af1 100644 --- a/library/shlex.po +++ b/library/shlex.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/shlex.rst:2 @@ -32,7 +32,6 @@ msgstr ":mod:`!shlex` --- 単純な字句解析" msgid "**Source code:** :source:`Lib/shlex.py`" msgstr "**ソースコード:** :source:`Lib/shlex.py`" -#: ../../library/shlex.rst:16 msgid "" "The :class:`~shlex.shlex` class makes it easy to write lexical analyzers for " "simple syntaxes resembling that of the Unix shell. This will often be " @@ -40,8 +39,9 @@ msgid "" "Python applications) or for parsing quoted strings." msgstr "" ":class:`~shlex.shlex` クラスは Unix シェルに似た、単純な構文に対する字句解析" -"器を簡単に書けるようにします。このクラスはしばしば、 Python アプリケーション" -"のための実行制御ファイルのような小規模言語を書く上で便利です。" +"器を簡単に書けるようにします。\n" +"このクラスはしばしば、 Python アプリケーションのための実行制御ファイルのよう" +"な小規模言語を書く場合や、引用符で囲まれた文字列を解析する場合に便利です。" #: ../../library/shlex.rst:21 msgid "The :mod:`shlex` module defines the following functions:" @@ -62,23 +62,26 @@ msgstr "" "文字列にします)。この関数はデフォルトでは POSIX モードで動作し、 *posix* 引数" "が偽の場合は非 POSIX モードで動作します。" -#: ../../library/shlex.rst:33 msgid "" "Passing ``None`` for *s* argument now raises an exception, rather than " "reading :data:`sys.stdin`." msgstr "" +"*s* 引数に ``None`` を渡すと、:data:`sys.stdin` から読み込む代わりに例外を送" +"出するようになりました。" -#: ../../library/shlex.rst:39 msgid "" "Concatenate the tokens of the list *split_command* and return a string. This " "function is the inverse of :func:`split`." msgstr "" +"リスト *split_command* のトークンを連結して文字列を返します。\n" +"この関数は :func:`split` の逆の操作を行います。" -#: ../../library/shlex.rst:46 msgid "" "The returned value is shell-escaped to protect against injection " "vulnerabilities (see :func:`quote`)." msgstr "" +"戻り値には、インジェクション脆弱性を防ぐためにシェルのエスケープ処理を施しま" +"す (:func:`quote` を参照)。" #: ../../library/shlex.rst:54 msgid "" @@ -90,23 +93,26 @@ msgstr "" "ケースで、シェルコマンドライン内で一つのトークンとして安全に利用出来る文字列" "です。" -#: ../../library/shlex.rst:62 msgid "The ``shlex`` module is **only designed for Unix shells**." -msgstr "" +msgstr "``shlex`` モジュールは **Unix シェル専用に設計されています**。" -#: ../../library/shlex.rst:64 msgid "" "The :func:`quote` function is not guaranteed to be correct on non-POSIX " "compliant shells or shells from other operating systems such as Windows. " "Executing commands quoted by this module on such shells can open up the " "possibility of a command injection vulnerability." msgstr "" +":func:`quote` 関数は POSIX に準拠していないシェルや Windows など他の OS の" +"シェルでは正しく動作する保証がありません。\n" +"そのようなシェルでこのモジュールによってクォートされたコマンドを実行すると、" +"コマンドインジェクションの脆弱性を生むおそれがあります。" -#: ../../library/shlex.rst:69 msgid "" "Consider using functions that pass command arguments with lists such as :" "func:`subprocess.run` with ``shell=False``." msgstr "" +"``shell=False`` を指定した :func:`subprocess.run` など、コマンドの引数をリス" +"トで渡す関数の利用を検討してください。" #: ../../library/shlex.rst:72 msgid "This idiom would be unsafe:" @@ -124,7 +130,6 @@ msgstr "クォーティングは UNIX シェルならびに :func:`split` と互 msgid "The :mod:`shlex` module defines the following class:" msgstr ":mod:`shlex` モジュールは以下のクラスを定義します。" -#: ../../library/shlex.rst:106 msgid "" "A :class:`~shlex.shlex` instance or subclass instance is a lexical analyzer " "object. The initialization argument, if present, specifies where to read " @@ -150,6 +155,34 @@ msgid "" "*punctuation_chars* can be set only upon :class:`~shlex.shlex` instance " "creation and can't be modified later." msgstr "" +":class:`~shlex.shlex` またはそのサブクラスのインスタンスは字句解析器オブジェ" +"クトです。\n" +"初期化時の最初の引数を指定すると、文字の読み込み元を設定できます。\n" +"この引数は :meth:`~io.TextIOBase.read` メソッドと :meth:`~io.TextIOBase." +"readline` メソッドを持つファイルやストリームに似たオブジェクト、または文字列" +"でなければなりません。\n" +"引数を省略すると ``sys.stdin`` から入力を読み込みます。\n" +"省略可能な二つ目の引数はファイル名の文字列で、:attr:`~shlex.infile` 属性の初" +"期値を設定します。\n" +"*instream* 引数を省略するか ``sys.stdin`` を指定した場合、二つ目の引数のデ" +"フォルトは \"stdin\" です。\n" +"*posix* 引数は動作モードを決めます。\n" +"*posix* が真でない場合 (デフォルト)、:class:`~shlex.shlex` インスタンスは互換" +"モードで動作します。\n" +"POSIX モードでは :class:`~shlex.shlex` はできる限り POSIX シェルの解析規則に" +"従おうとします。\n" +"*punctuation_chars* 引数を使うと、実際のシェルの解析動作にさらに近づけられま" +"す。\n" +"この引数にはいくつかの値を指定できます。\n" +"デフォルトの ``False`` は Python 3.5 以前の動作を維持します。\n" +"``True`` に設定すると文字 ``();<>|&`` の解析が変わり、これらの文字 (区切り記" +"号と見なされます) の連続を一つのトークンとして返します。\n" +"空でない文字列に設定すると、その文字列の各文字を区切り記号として使います。\n" +":attr:`wordchars` 属性内の文字のうち *punctuation_chars* に含まれるものは :" +"attr:`wordchars` から削除されます。\n" +"詳細は :ref:`improved-shell-compatibility` を参照してください。\n" +"*punctuation_chars* は :class:`~shlex.shlex` インスタンスの作成時にのみ設定で" +"き、後から変更できません。" #: ../../library/shlex.rst:131 msgid "The *punctuation_chars* parameter was added." @@ -277,7 +310,6 @@ msgstr "" "最後にプッシュされた入力ソースを入力スタックからポップします。字句解析器がス" "タック上の入力ストリームの EOF に到達した際に利用するメソッドと同じです。" -#: ../../library/shlex.rst:212 msgid "" "This method generates an error message leader in the format of a Unix C " "compiler error label; the format is ``'\"%s\", line %d: '``, where the " @@ -285,10 +317,11 @@ msgid "" "with the current input line number (the optional arguments can be used to " "override these)." msgstr "" -"このメソッドはエラーメッセージの論述部分を Unix C コンパイラエラーラベルの形" -"式で生成します; この書式は ``'\"%s\", line %d: '`` で、 ``%s`` は現在のソース" -"ファイル名で置き換えられ、 ``%d`` は現在の入力行番号で置き換えられます (オプ" -"ションの引数を使ってこれらを上書きすることもできます)。" +"このメソッドは、Unix の C コンパイラーのエラー表示と同じ形式でエラーメッセー" +"ジの冒頭部分を生成します。\n" +"形式は ``'\"%s\", line %d: '`` で、``%s`` は現在のソースファイル名に、``%d`` " +"は現在の入力行番号に置き換えられます (省略可能な引数でこれらを上書きできま" +"す)。" #: ../../library/shlex.rst:217 msgid "" @@ -308,16 +341,15 @@ msgstr "" ":class:`~shlex.shlex` サブクラスのインスタンスは、字句解析を制御したり、デ" "バッグに使えるような public なインスタンス変数を持っています:" -#: ../../library/shlex.rst:227 msgid "" "The string of characters that are recognized as comment beginners. All " "characters from the comment beginner to end of line are ignored. Includes " "just ``'#'`` by default." msgstr "" -"コメントの開始として認識される文字列です。コメントの開始から行末までのすべて" -"のキャラクタ文字は無視されます。標準では単に ``'#'`` が入っています。" +"コメントの開始と認識する文字を並べた文字列です。\n" +"コメント開始文字から行末までは、すべて無視されます。\n" +"デフォルトでは ``'#'`` だけが含まれます。" -#: ../../library/shlex.rst:234 msgid "" "The string of characters that will accumulate into multi-character tokens. " "By default, includes all ASCII alphanumerics and underscore. In POSIX mode, " @@ -329,6 +361,13 @@ msgid "" "there. If :attr:`whitespace_split` is set to ``True``, this will have no " "effect." msgstr "" +"複数文字のトークンを構成する文字を並べた文字列です。\n" +"デフォルトでは ASCII のすべての英数字とアンダースコアを含みます。\n" +"POSIX モードでは Latin-1 のアクセント付き文字も含みます。\n" +":attr:`punctuation_chars` が空でない場合、ファイル名の指定やコマンドライン引" +"数に現れる文字 ``~-./*?=`` もこの属性に追加され、``punctuation_chars`` に含ま" +"れる文字は ``wordchars`` から削除されます。\n" +":attr:`whitespace_split` が ``True`` の場合、この属性は効果を持ちません。" #: ../../library/shlex.rst:247 msgid "" @@ -370,7 +409,6 @@ msgstr "" "字群です。これは POSIX モードでのみ使われ、デフォルトでは ``'\"'`` だけが入っ" "ています。" -#: ../../library/shlex.rst:273 msgid "" "If ``True``, tokens will only be split in whitespaces. This is useful, for " "example, for parsing command lines with :class:`~shlex.shlex`, getting " @@ -378,12 +416,18 @@ msgid "" "attr:`punctuation_chars`, tokens will be split on whitespace in addition to " "those characters." msgstr "" +"``True`` の場合、空白だけでトークンを分割します。\n" +"例えば :class:`~shlex.shlex` でコマンドラインを解析し、シェルの引数と同じよう" +"にトークンを取得する際に便利です。\n" +":attr:`punctuation_chars` と組み合わせた場合は、そこに指定した文字に加えて空" +"白でもトークンを分割します。" -#: ../../library/shlex.rst:279 msgid "" "The :attr:`punctuation_chars` attribute was made compatible with the :attr:" "`whitespace_split` attribute." msgstr "" +":attr:`punctuation_chars` 属性を :attr:`whitespace_split` 属性と併用できるよ" +"うになりました。" #: ../../library/shlex.rst:286 msgid "" @@ -413,11 +457,11 @@ msgid "" "original input stream. Source requests may be stacked any number of levels " "deep." msgstr "" -"このメンバ変数は標準で :const:`None` を取ります。この値に文字列を代入すると、" -"その文字列は多くのシェルにおける ``source`` キーワードに似た、字句解析レベル" -"でのインクルード要求として認識されます。すなわち、その直後に現れるトークンを" -"ファイル名として新たなストリームを開き、そのストリームを入力として、EOF に到" -"達するまで読み込まれます。新たなストリームの EOF に到達した時点で :meth:`~io." +"このメンバ変数は標準で ``None`` を取ります。この値に文字列を代入すると、その" +"文字列は多くのシェルにおける ``source`` キーワードに似た、字句解析レベルでの" +"インクルード要求として認識されます。すなわち、その直後に現れるトークンをファ" +"イル名として新たなストリームを開き、そのストリームを入力として、EOF に到達す" +"るまで読み込まれます。新たなストリームの EOF に到達した時点で :meth:`~io." "IOBase.close` が呼び出され、入力は元の入力ストリームに戻されます。ソースリク" "エストは任意のレベルの深さまでスタックしてかまいません。" @@ -450,7 +494,6 @@ msgstr "" "ファイルの終端を決定するのに使われるトークンです。非 POSIX モードでは空文字" "列 (``''``) 、POSIX モードでは ``None`` が入ります。" -#: ../../library/shlex.rst:333 msgid "" "A read-only property. Characters that will be considered punctuation. Runs " "of punctuation characters will be returned as a single token. However, note " @@ -458,6 +501,12 @@ msgid "" "could be returned as a token, even though it may not be recognised as such " "by shells." msgstr "" +"読み取り専用のプロパティです。\n" +"区切り記号と見なす文字を表します。\n" +"区切り記号の連続は一つのトークンとして返されます。\n" +"ただし意味的に妥当かどうかの検査は行いません。\n" +"例えば、シェルがそのようなトークンとして認識しない場合でも '>>>' をトークンと" +"して返すことがあります。" #: ../../library/shlex.rst:344 msgid "Parsing Rules" @@ -572,11 +621,9 @@ msgstr ":const:`None` で EOF を送出する" msgid "Quoted empty strings (``''``) are allowed." msgstr "引用符に囲まれた空文字列 (``''``) を許す。" -#: ../../library/shlex.rst:397 msgid "Improved Compatibility with Shells" -msgstr "" +msgstr "シェルとの互換性の向上" -#: ../../library/shlex.rst:401 msgid "" "The :class:`shlex` class provides compatibility with the parsing performed " "by common Unix shells like ``bash``, ``dash``, and ``sh``. To take " @@ -590,8 +637,18 @@ msgid "" "than you could otherwise. To illustrate, you can see the difference in the " "following snippet:" msgstr "" +":class:`shlex` クラスは ``bash``、``dash``、``sh`` など一般的な Unix シェルの" +"解析との互換性を提供します。\n" +"この互換性を利用するには、コンストラクターで ``punctuation_chars`` 引数を指定" +"します。\n" +"デフォルトは ``False`` で、3.6 より前の動作を維持します。\n" +"``True`` に設定すると文字 ``();<>|&`` の解析が変わり、これらの文字の連続を一" +"つのトークンとして返します。\n" +"完全なシェルのパーサーではありませんが (シェルは多種多様なので、完全な対応は" +"標準ライブラリの範囲を超えます)、この機能によってコマンドラインの処理をより簡" +"単に行えます。\n" +"次の例で動作の違いを確認できます。" -#: ../../library/shlex.rst:412 msgid "" ">>> import shlex\n" ">>> text = \"a && b; c && d || e; f >'abc'; (def \\\"ghi\\\")\"\n" @@ -605,37 +662,58 @@ msgid "" "['a', '&&', 'b', ';', 'c', '&&', 'd', '||', 'e', ';', 'f', '>', 'abc', ';',\n" "'(', 'def', 'ghi', ')']" msgstr "" +">>> import shlex\n" +">>> text = \"a && b; c && d || e; f >'abc'; (def \\\"ghi\\\")\"\n" +">>> s = shlex.shlex(text, posix=True)\n" +">>> s.whitespace_split = True\n" +">>> list(s)\n" +"['a', '&&', 'b;', 'c', '&&', 'd', '||', 'e;', 'f', '>abc;', '(def', 'ghi)']\n" +">>> s = shlex.shlex(text, posix=True, punctuation_chars=True)\n" +">>> s.whitespace_split = True\n" +">>> list(s)\n" +"['a', '&&', 'b', ';', 'c', '&&', 'd', '||', 'e', ';', 'f', '>', 'abc', ';',\n" +"'(', 'def', 'ghi', ')']" -#: ../../library/shlex.rst:427 msgid "" "Of course, tokens will be returned which are not valid for shells, and " "you'll need to implement your own error checks on the returned tokens." msgstr "" +"もちろん、シェルでは無効なトークンも返されるため、返されたトークンのエラー" +"チェックは自分で実装する必要があります。" -#: ../../library/shlex.rst:430 msgid "" "Instead of passing ``True`` as the value for the punctuation_chars " "parameter, you can pass a string with specific characters, which will be " "used to determine which characters constitute punctuation. For example::" msgstr "" +"``punctuation_chars`` 引数には ``True`` の代わりに特定の文字を並べた文字列を" +"渡すこともできます。\n" +"その文字列に含まれる文字が区切り記号になります。\n" +"例えば次のように使います。 ::" -#: ../../library/shlex.rst:434 msgid "" ">>> import shlex\n" ">>> s = shlex.shlex(\"a && b || c\", punctuation_chars=\"|\")\n" ">>> list(s)\n" "['a', '&', '&', 'b', '||', 'c']" msgstr "" +">>> import shlex\n" +">>> s = shlex.shlex(\"a && b || c\", punctuation_chars=\"|\")\n" +">>> list(s)\n" +"['a', '&', '&', 'b', '||', 'c']" -#: ../../library/shlex.rst:439 msgid "" "When ``punctuation_chars`` is specified, the :attr:`~shlex.wordchars` " "attribute is augmented with the characters ``~-./*?=``. That is because " "these characters can appear in file names (including wildcards) and command-" "line arguments (e.g. ``--color=auto``). Hence::" msgstr "" +"``punctuation_chars`` を指定すると、:attr:`~shlex.wordchars` 属性に文字 " +"``~-./*?=`` が追加されます。\n" +"これらの文字はファイル名 (ワイルドカードを含みます) やコマンドライン引数 (例" +"えば ``--color=auto``) に現れるためです。\n" +"そのため次のようになります。 ::" -#: ../../library/shlex.rst:444 msgid "" ">>> import shlex\n" ">>> s = shlex.shlex('~/a && b-c --color=auto || d *.py?',\n" @@ -643,18 +721,29 @@ msgid "" ">>> list(s)\n" "['~/a', '&&', 'b-c', '--color=auto', '||', 'd', '*.py?']" msgstr "" +">>> import shlex\n" +">>> s = shlex.shlex('~/a && b-c --color=auto || d *.py?',\n" +"... punctuation_chars=True)\n" +">>> list(s)\n" +"['~/a', '&&', 'b-c', '--color=auto', '||', 'd', '*.py?']" -#: ../../library/shlex.rst:450 msgid "" "However, to match the shell as closely as possible, it is recommended to " "always use ``posix`` and :attr:`~shlex.whitespace_split` when using :attr:" "`~shlex.punctuation_chars`, which will negate :attr:`~shlex.wordchars` " "entirely." msgstr "" +"ただし、シェルの動作にできるだけ近づけるには、:attr:`~shlex." +"punctuation_chars` を使うときは常に ``posix`` と :attr:`~shlex." +"whitespace_split` を併用することをお勧めします。\n" +"その場合、:attr:`~shlex.wordchars` はまったく効果を持ちません。" -#: ../../library/shlex.rst:455 msgid "" "For best effect, ``punctuation_chars`` should be set in conjunction with " "``posix=True``. (Note that ``posix=False`` is the default for :class:`~shlex." "shlex`.)" msgstr "" +"最良の結果を得るには、``punctuation_chars`` と一緒に ``posix=True`` も設定し" +"てください。\n" +"(:class:`~shlex.shlex` のデフォルトは ``posix=False`` であることに注意してく" +"ださい。)" diff --git a/library/shutil.po b/library/shutil.po index 6b737fef2..da0952aa5 100644 --- a/library/shutil.po +++ b/library/shutil.po @@ -23,10 +23,10 @@ msgstr "" "Last-Translator: Atsuo Ishimoto , 2025\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/shutil.rst:2 @@ -75,7 +75,6 @@ msgstr "" msgid "Directory and files operations" msgstr "ディレクトリとファイルの操作" -#: ../../library/shutil.rst:42 msgid "" "Copy the contents of the :term:`file-like object ` *fsrc* to " "the file-like object *fdst*. The integer *length*, if given, is the buffer " @@ -85,14 +84,26 @@ msgid "" "file position of the *fsrc* object is not 0, only the contents from the " "current file position to the end of the file will be copied." msgstr "" +":term:`file-like object ` *fsrc* の内容を *fdst* へコピーしま" +"す。\n" +"整数値 *length* は与えられた場合バッファサイズを表します。\n" +"特に *length* が負の場合、コピー元のデータをチャンク単位で繰り返し読み込むこ" +"となく、一度にコピーします。\n" +"デフォルトでは、制御不能なメモリ消費を避けるためにデータはチャンク単位で読み" +"込まれます。\n" +"*fsrc* オブジェクトの現在のファイル位置が0でない場合、現在の位置からファイル" +"終端までの内容のみがコピーされることに注意してください。" -#: ../../library/shutil.rst:53 msgid "" "Copy the contents (no metadata) of the file named *src* to a file named " "*dst* and return *dst* in the most efficient way possible. *src* and *dst* " "are :term:`path-like objects ` or path names given as " "strings." msgstr "" +"*src* という名前のファイルの内容 (メタデータを含まない) を *dst* という名前の" +"ファイルに、できるだけ効率的な方法でコピーし、*dst* を返します。\n" +"*src* と *dst* は :term:`path-like object ` または文字列で" +"パス名を指定します。" #: ../../library/shutil.rst:57 msgid "" @@ -124,14 +135,12 @@ msgstr "" "*follow_symlinks* が偽で *src* がシンボリックリンクの場合、 *src* のリンク先" "をコピーする代わりに新しいシンボリックリンクを作成します。" -#: ../../library/shutil.rst:70 ../../library/shutil.rst:177 -#: ../../library/shutil.rst:208 msgid "" "Raises an :ref:`auditing event ` ``shutil.copyfile`` with " "arguments ``src``, ``dst``." msgstr "" "引数 ``src``, ``dst`` を指定して :ref:`監査イベント ` ``shutil." -"copyfile`` を送出します。 " +"copyfile`` を送出します。" #: ../../library/shutil.rst:72 msgid "" @@ -179,14 +188,21 @@ msgid "" "links on the local platform, and it is asked to do so, it will do nothing " "and return." msgstr "" +"パーミッションを *src* から *dst* にコピーします。ファイルの内容、オーナー、" +"グループには影響しません。 *src* と *dst* は :term:`path-like object ` または文字列でファイルのパス名を指定します。 *follow_symlinks* " +"が偽で、*src* および *dst* がシンボリックリンクの場合、 :func:`copymode` は " +"(リンク先ではなく) *dst* 自体のモードを変更します。この機能は全てのプラット" +"フォームで使えるわけではありません。詳しくは :func:`copystat` を参照してくだ" +"さい。シンボリックリンクの変更をしようとした時、 :func:`copymode` がローカル" +"のプラットフォームでシンボリックリンクを変更できない場合は何もしません。" -#: ../../library/shutil.rst:106 ../../library/shutil.rst:179 msgid "" "Raises an :ref:`auditing event ` ``shutil.copymode`` with " "arguments ``src``, ``dst``." msgstr "" "引数 ``src``, ``dst`` を指定して :ref:`監査イベント ` ``shutil." -"copymode`` を送出します。 " +"copymode`` を送出します。" #: ../../library/shutil.rst:108 msgid "Added *follow_symlinks* argument." @@ -200,6 +216,11 @@ msgid "" "are unaffected. *src* and *dst* are :term:`path-like objects ` or path names given as strings." msgstr "" +"パーミッション、最終アクセス時間、最終変更時間、その他のフラグを *src* から " +"*dst* にコピーします。 Linux では、 :func:`copystat` は可能なら \"拡張属性\" " +"もコピーします。ファイルの内容、オーナー、グループには影響しません。 *src* " +"と *dst* は :term:`path-like object ` または文字列でファイ" +"ルのパス名を指定します。" #: ../../library/shutil.rst:119 msgid "" @@ -263,13 +284,12 @@ msgid "Please see :data:`os.supports_follow_symlinks` for more information." msgstr "" "より詳しい情報は :data:`os.supports_follow_symlinks` を参照して下さい。" -#: ../../library/shutil.rst:153 ../../library/shutil.rst:210 msgid "" "Raises an :ref:`auditing event ` ``shutil.copystat`` with " "arguments ``src``, ``dst``." msgstr "" "引数 ``src``, ``dst`` を指定して :ref:`監査イベント ` ``shutil." -"copystat`` を送出します。 " +"copystat`` を送出します。" #: ../../library/shutil.rst:155 msgid "" @@ -300,18 +320,17 @@ msgstr "" "リックリンクとして作成されます。 *follow_symlinks* が真で *src* がシンボリッ" "クリンクの場合、 *dst* には *src* のリンク先のファイルがコピーされます。" -#: ../../library/shutil.rst:171 msgid "" ":func:`~shutil.copy` copies the file data and the file's permission mode " "(see :func:`os.chmod`). Other metadata, like the file's creation and " "modification times, is not preserved. To preserve all file metadata from the " "original, use :func:`~shutil.copy2` instead." msgstr "" -":func:`~shutil.copy` はファイルのデータとパーミッションをコピーします。 (:" -"func:`os.chmod` を参照)\n" +":func:`~shutil.copy` はファイルのデータとパーミッションをコピーします。\n" +"(:func:`os.chmod` を参照)\n" "その他の、ファイルの作成時間や変更時間などのメタデータはコピーしません。\n" -"コピー元のファイルのメタデータを保存したい場合は、 :func:`~shutils.copy2` を" -"利用してください。" +"コピー元のファイルのメタデータを保存したい場合は、 :func:`~shutil.copy2` を利" +"用してください。" #: ../../library/shutil.rst:181 msgid "" @@ -337,6 +356,13 @@ msgid "" "unavailable, :func:`copy2` will preserve all the metadata it can; :func:" "`copy2` never raises an exception because it cannot preserve file metadata." msgstr "" +"*follow_symlinks* が偽でかつ *src* がシンボリックリンクの場合、 :func:" +"`copy2` は *src* シンボリックリンク全てのメタデータを新たに作成される *dst* " +"シンボリックリンクにコピーしようとします。しかし、この機能は全てのプラット" +"フォームで利用可能なわけではありません。この機能の全部または一部が利用可能で" +"ないプラットフォームにおいては、 :func:`copy2` は可能な限りのメタデータを保存" +"しようとしますが、一方で :func:`copy2` はメタデータを保存できないことを理由" +"とする例外を送出しません。" #: ../../library/shutil.rst:204 msgid "" @@ -368,12 +394,15 @@ msgstr "" "出し可能オブジェクトを作成します。 glob形式の *patterns* にマッチするファイル" "やディレクトリが無視されます。下の例を参照してください。" -#: ../../library/shutil.rst:233 msgid "" "Recursively copy an entire directory tree rooted at *src* to a directory " "named *dst* and return the destination directory. All intermediate " "directories needed to contain *dst* will also be created by default." msgstr "" +"*src* をルートとするディレクトリツリー全体を *dst* というディレクトリに再帰的" +"にコピーし、コピー先のディレクトリを返します。\n" +"デフォルトでは、*dst* を作成するために必要な途中のディレクトリもすべて作成し" +"ます。" #: ../../library/shutil.rst:237 msgid "" @@ -405,6 +434,11 @@ msgid "" "exception. Notice that this option has no effect on platforms that don't " "support :func:`os.symlink`." msgstr "" +"*symlinks* が偽の場合、リンク先のファイルが存在しなければ、コピー処理終了時に" +"送出される :exc:`Error` 例外のエラーリストに例外が追加されます。オプションの " +"*ignore_dangling_symlinks* フラグを真に設定してこのエラーを送出させないことも" +"できます。このオプションは :func:`os.symlink` をサポートしていないプラット" +"フォーム上では効果がないことに注意してください。" #: ../../library/shutil.rst:252 msgid "" @@ -432,7 +466,6 @@ msgid "" "If exception(s) occur, an :exc:`Error` is raised with a list of reasons." msgstr "例外が発生した場合、理由のリストとともに :exc:`Error` を送出します。" -#: ../../library/shutil.rst:264 msgid "" "If *copy_function* is given, it must be a callable that will be used to copy " "each file. It will be called with the source path and the destination path " @@ -440,11 +473,11 @@ msgid "" "that supports the same signature (like :func:`~shutil.copy`) can be used." msgstr "" "*copy_function* は各ファイルをコピーするために利用される呼び出し可能オブジェ" -"クトでなければなりません。*copy_function* はコピー元のパスとコピー先のパスを" -"引数に呼び出されます。デフォルトでは :func:`~shutil.copy2` が利用されますが、" -"同じ特徴を持つ関数 (:func:`shutil.copy` など) ならどれでも利用可能です。" +"クトでなければなりません。\n" +"*copy_function* はコピー元のパスとコピー先のパスを引数に呼び出されます。\n" +"デフォルトでは :func:`~shutil.copy2` が利用されますが、同じシグネチャを持つ関" +"数 (:func:`~shutil.copy` など) ならどれでも利用可能です。" -#: ../../library/shutil.rst:269 msgid "" "If *dirs_exist_ok* is false (the default) and *dst* already exists, a :exc:" "`FileExistsError` is raised. If *dirs_exist_ok* is true, the copying " @@ -452,21 +485,26 @@ msgid "" "within the *dst* tree will be overwritten by corresponding files from the " "*src* tree." msgstr "" +"*dirs_exist_ok* が偽 (デフォルト) で *dst* がすでに存在する場合は、:exc:" +"`FileExistsError` を送出します。\n" +"*dirs_exist_ok* が真の場合は、既存のディレクトリがあってもコピーを続行し、" +"*dst* ツリー内のファイルを *src* ツリー内の対応するファイルで上書きします。" -#: ../../library/shutil.rst:275 msgid "" "Raises an :ref:`auditing event ` ``shutil.copytree`` with " "arguments ``src``, ``dst``." msgstr "" "引数 ``src``, ``dst`` を指定して :ref:`監査イベント ` ``shutil." -"copytree`` を送出します。 " +"copytree`` を送出します。" -#: ../../library/shutil.rst:277 msgid "" "Added the *copy_function* argument to be able to provide a custom copy " "function. Added the *ignore_dangling_symlinks* argument to silence dangling " "symlinks errors when *symlinks* is false." msgstr "" +"独自のコピー関数を指定できるよう、*copy_function* 引数が追加されました。\n" +"*symlinks* が偽の場合にリンク切れのシンボリックリンクによるエラーを抑制できる" +"よう、*ignore_dangling_symlinks* 引数が追加されました。" #: ../../library/shutil.rst:283 msgid "Copy metadata when *symlinks* is false. Now returns *dst*." @@ -476,9 +514,8 @@ msgstr "" #: ../../library/shutil.rst:292 msgid "Added the *dirs_exist_ok* parameter." -msgstr "" +msgstr "引数 *dirs_exist_ok* が追加されました。" -#: ../../library/shutil.rst:299 msgid "" "Delete an entire directory tree; *path* must point to a directory (but not a " "symbolic link to a directory). If *ignore_errors* is true, errors resulting " @@ -486,6 +523,13 @@ msgid "" "handled by calling a handler specified by *onexc* or *onerror* or, if both " "are omitted, exceptions are propagated to the caller." msgstr "" +"ディレクトリツリー全体を削除します。\n" +"*path* はディレクトリを指していなければならず、ディレクトリへのシンボリックリ" +"ンクは指定できません。\n" +"*ignore_errors* が真の場合、削除の失敗によるエラーは無視します。\n" +"偽または省略された場合は、*onexc* または *onerror* で指定したハンドラーを呼び" +"出してエラーを処理します。\n" +"両方とも省略した場合は例外を呼び出し元に伝播させます。" #: ../../library/shutil.rst:305 msgid "" @@ -510,8 +554,8 @@ msgstr "" "それ以外のプラットフォームでは、 :func:`rmtree` の実装はシンボリックリンク攻" "撃の影響を受けます。適当なタイミングと環境で攻撃者はファイルシステム上のシン" "ボリックリンクを操作して、それ以外の方法ではアクセス不可能なファイルを削除す" -"ることが出来ます。アプリケーションは、どちらのバージョンの :func:`rmtree` が" -"利用されているかを知るために関数のデータ属性 :data:`rmtree." +"ることが出来ます。アプリケーションは、どちらのバージョンの ``rmtree()`` が利" +"用されているかを知るために関数のデータ属性 :data:`rmtree." "avoids_symlink_attacks` を利用することができます。" #: ../../library/shutil.rst:318 @@ -519,8 +563,9 @@ msgid "" "If *onexc* is provided, it must be a callable that accepts three parameters: " "*function*, *path*, and *excinfo*." msgstr "" +"*onexc* を指定する場合、 *function*, *path*, *excinfo* の3つの引数を受け取る" +"呼び出し可能オブジェクトでなければなりません。" -#: ../../library/shutil.rst:321 msgid "" "The first parameter, *function*, is the function which raised the exception; " "it depends on the platform and implementation. The second parameter, " @@ -528,20 +573,25 @@ msgid "" "*excinfo*, is the exception that was raised. Exceptions raised by *onexc* " "will not be caught." msgstr "" +"最初の引数 *function* は例外を送出した関数で、プラットフォームや実装によって" +"異なります。\n" +"二つ目の引数 *path* は *function* に渡されたパス名です。\n" +"三つ目の引数 *excinfo* は送出された例外です。\n" +"*onexc* が送出した例外は捕捉しません。" -#: ../../library/shutil.rst:327 msgid "" "The deprecated *onerror* is similar to *onexc*, except that the third " "parameter it receives is the tuple returned from :func:`sys.exc_info`." msgstr "" +"非推奨の *onerror* は *onexc* と似ていますが、三つ目の引数として :func:`sys." +"exc_info` の戻り値であるタプルを受け取ります。" -#: ../../library/shutil.rst:330 msgid "" "Raises an :ref:`auditing event ` ``shutil.rmtree`` with arguments " "``path``, ``dir_fd``." msgstr "" "引数 ``path``, ``dir_fd`` を指定して :ref:`監査イベント ` ``shutil." -"rmtree`` を送出します。 " +"rmtree`` を送出します。" #: ../../library/shutil.rst:332 msgid "" @@ -563,16 +613,18 @@ msgstr "" msgid "Added the *dir_fd* parameter." msgstr "引数 *dir_fd* を追加しました。" -#: ../../library/shutil.rst:343 msgid "Added the *onexc* parameter, deprecated *onerror*." -msgstr "" +msgstr "*onexc* 引数が追加され、*onerror* は非推奨になりました。" -#: ../../library/shutil.rst:346 msgid "" ":func:`!rmtree` now ignores :exc:`FileNotFoundError` exceptions for all but " "the top-level path. Exceptions other than :exc:`OSError` and subclasses of :" "exc:`!OSError` are now always propagated to the caller." msgstr "" +":func:`!rmtree` は最上位のパスを除き、:exc:`FileNotFoundError` 例外を無視する" +"ようになりました。\n" +":exc:`OSError` と :exc:`!OSError` のサブクラス以外の例外は、常に呼び出し元に" +"伝播するようになりました。" #: ../../library/shutil.rst:354 msgid "" @@ -590,19 +642,24 @@ msgid "" "Recursively move a file or directory (*src*) to another location and return " "the destination." msgstr "" +"ファイルまたはディレクトリ (*src*) を再帰的に別の場所に移動して、移動先を返し" +"ます。" -#: ../../library/shutil.rst:366 msgid "" "If *dst* is an existing directory or a symlink to a directory, then *src* is " "moved inside that directory. The destination path in that directory must not " "already exist." msgstr "" +"*dst* が既存のディレクトリまたはディレクトリへのシンボリックリンクの場合、" +"*src* はそのディレクトリ内に移動されます。\n" +"そのディレクトリ内の移動先パスは、あらかじめ存在していてはいけません。" -#: ../../library/shutil.rst:370 msgid "" "If *dst* already exists but is not a directory, it may be overwritten " "depending on :func:`os.rename` semantics." msgstr "" +"*dst* がすでに存在し、ディレクトリではない場合、:func:`os.rename` の動作に応" +"じて上書きされることがあります。" #: ../../library/shutil.rst:373 msgid "" @@ -612,7 +669,6 @@ msgid "" "of *src* will be created as the destination and *src* will be removed." msgstr "" -#: ../../library/shutil.rst:378 msgid "" "If *copy_function* is given, it must be a callable that takes two arguments, " "*src* and the destination, and will be used to copy *src* to the destination " @@ -622,14 +678,22 @@ msgid "" "*copy_function* allows the move to succeed when it is not possible to also " "copy the metadata, at the expense of not copying any of the metadata." msgstr "" +"*copy_function* を指定する場合は、*src* と移動先の二つの引数を受け取る呼び出" +"し可能オブジェクトでなければなりません。\n" +":func:`os.rename` を使えない場合に、*src* を移動先にコピーするために使われま" +"す。\n" +"移動元がディレクトリなら、*copy_function* を渡して :func:`copytree` を呼び出" +"します。\n" +"デフォルトの *copy_function* は :func:`copy2` です。\n" +"*copy_function* に :func:`~shutil.copy` を指定すると、メタデータもコピーする" +"ことが不可能な場合でも、メタデータのコピーを省いて移動を成功させられます。" -#: ../../library/shutil.rst:386 msgid "" "Raises an :ref:`auditing event ` ``shutil.move`` with arguments " "``src``, ``dst``." msgstr "" "引数 ``src``, ``dst`` を指定して :ref:`監査イベント ` ``shutil." -"move`` を送出します。 " +"move`` を送出します。" #: ../../library/shutil.rst:388 msgid "" @@ -661,12 +725,15 @@ msgstr "" "それぞれトータル、使用中、空きの容量をバイト単位で示します。 *path* はファイ" "ルまたはディレクトリです。" -#: ../../library/shutil.rst:413 msgid "" "On Unix filesystems, *path* must point to a path within a **mounted** " "filesystem partition. On those platforms, CPython doesn't attempt to " "retrieve disk usage information from non-mounted filesystems." msgstr "" +"Unix ファイルシステムでは、*path* は **マウントされた** ファイルシステムの" +"パーティション内のパスを指していなければなりません。\n" +"これらのプラットフォームでは、CPython はマウントされていないファイルシステム" +"のディスク使用量を取得しようとしません。" #: ../../library/shutil.rst:419 msgid "On Windows, *path* can now be a file or directory." @@ -674,9 +741,8 @@ msgstr "" "Windowsにおいても *path* にディレクトリだけでなくファイルを指定できるようにな" "りました。" -#: ../../library/shutil.rst:422 ../../library/shutil.rst:436 msgid "Availability" -msgstr "" +msgstr "利用可能な環境" #: ../../library/shutil.rst:427 msgid "Change owner *user* and/or *group* of the given *path*." @@ -694,17 +760,16 @@ msgstr "" msgid "See also :func:`os.chown`, the underlying function." msgstr "内部で利用している :func:`os.chown` も参照してください。" -#: ../../library/shutil.rst:434 msgid "" "Raises an :ref:`auditing event ` ``shutil.chown`` with arguments " "``path``, ``user``, ``group``." msgstr "" "引数 ``path``, ``user``, ``group`` を指定して :ref:`監査イベント ` " -"``shutil.chown`` を送出します。 " +"``shutil.chown`` を送出します。" #: ../../library/shutil.rst:440 msgid "Added *dir_fd* and *follow_symlinks* parameters." -msgstr "" +msgstr "引数 *dir_fd* および *follow_symlinks* が追加されました。" #: ../../library/shutil.rst:446 msgid "" @@ -719,23 +784,29 @@ msgid "" "*mode* is a permission mask passed to :func:`os.access`, by default " "determining if the file exists and is executable." msgstr "" +"*mode* は :func:`os.access` に渡すパーミッションマスクで、デフォルトではファ" +"イルが存在して実行可能であることを確認します。" -#: ../../library/shutil.rst:452 msgid "" "*path* is a \"``PATH`` string\" specifying the directories to look in, " "delimited by :data:`os.pathsep`. When no *path* is specified, the :envvar:" "`PATH` environment variable is read from :data:`os.environ`, falling back " "to :data:`os.defpath` if it is not set." msgstr "" +"*path* は検索するディレクトリを :data:`os.pathsep` で区切って指定する" +"「``PATH`` 文字列」です。\n" +"*path* を指定しない場合は :data:`os.environ` から環境変数 :envvar:`PATH` を読" +"み取り、それも設定されていなければ :data:`os.defpath` を使います。" -#: ../../library/shutil.rst:457 msgid "" "If *cmd* contains a directory component, :func:`!which` only checks the " "specified path directly and does not search the directories listed in *path* " "or in the system's :envvar:`PATH` environment variable." msgstr "" +"*cmd* にディレクトリ部分が含まれている場合、:func:`!which` は指定されたパスだ" +"けを直接調べ、*path* やシステムの :envvar:`PATH` 環境変数に列挙されたディレク" +"トリは検索しません。" -#: ../../library/shutil.rst:461 msgid "" "On Windows, the current directory is prepended to the *path* if *mode* does " "not include ``os.X_OK``. When the *mode* does include ``os.X_OK``, the " @@ -744,8 +815,14 @@ msgid "" "consulting the current working directory for executables: set the " "environment variable ``NoDefaultCurrentDirectoryInExePath``." msgstr "" +"Windows では、*mode* に ``os.X_OK`` が含まれていない場合、カレントディレクト" +"リを *path* の先頭に追加します。\n" +"*mode* に ``os.X_OK`` が含まれている場合は、Windows API の " +"``NeedCurrentDirectoryForExePathW`` に問い合わせて、カレントディレクトリを " +"*path* の先頭に追加するかどうか決めます。\n" +"実行ファイルを探す際にカレントディレクトリを調べないようにするには、環境変数 " +"``NoDefaultCurrentDirectoryInExePath`` を設定してください。" -#: ../../library/shutil.rst:468 msgid "" "Also on Windows, the :envvar:`PATHEXT` environment variable is used to " "resolve commands that may not already include an extension. For example, if " @@ -753,24 +830,34 @@ msgid "" "to know that it should look for ``python.exe`` within the *path* " "directories. For example, on Windows::" msgstr "" +"Windows ではさらに、拡張子が指定されていないコマンドを解決するために :envvar:" +"`PATHEXT` 環境変数を使います。\n" +"例えば ``shutil.which(\"python\")`` を呼び出すと、:func:`which` は " +"``PATHEXT`` を調べて、*path* 内のディレクトリで ``python.exe`` を探すべきだと" +"判断します。\n" +"Windows での例を示します。 ::" #: ../../library/shutil.rst:474 msgid "" ">>> shutil.which(\"python\")\n" "'C:\\\\Python33\\\\python.EXE'" msgstr "" +">>> shutil.which(\"python\")\n" +"'C:\\\\Python33\\\\python.EXE'" -#: ../../library/shutil.rst:477 msgid "" "This is also applied when *cmd* is a path that contains a directory " "component::" msgstr "" +"*cmd* がディレクトリ部分を含むパスである場合にも、この処理が適用されます。 ::" #: ../../library/shutil.rst:480 msgid "" ">>> shutil.which(\"C:\\\\Python33\\\\python\")\n" "'C:\\\\Python33\\\\python.EXE'" msgstr "" +">>> shutil.which(\"C:\\\\Python33\\\\python\")\n" +"'C:\\\\Python33\\\\python.EXE'" #: ../../library/shutil.rst:485 msgid "" @@ -780,7 +867,6 @@ msgstr "" ":class:`bytes` 型も使用できるようになりました。 *cmd* が :class:`bytes` 型の" "場合、戻り値も :class:`bytes` 型です。" -#: ../../library/shutil.rst:489 msgid "" "On Windows, the current directory is no longer prepended to the search path " "if *mode* includes ``os.X_OK`` and WinAPI " @@ -790,6 +876,14 @@ msgid "" "extension that is in ``PATHEXT``; and filenames that have no extension can " "now be found." msgstr "" +"Windows では、*mode* に ``os.X_OK`` が含まれ、WinAPI の " +"``NeedCurrentDirectoryForExePathW(cmd)`` が偽の場合、カレントディレクトリを検" +"索パスの先頭に追加しなくなりました。\n" +"それ以外の場合は、カレントディレクトリがすでに検索パスに含まれていても先頭に" +"追加します。\n" +"*cmd* にディレクトリ部分が含まれている場合や、``PATHEXT`` に含まれる拡張子で" +"終わる場合にも ``PATHEXT`` を使うようになりました。\n" +"また、拡張子のないファイル名も見つけられるようになりました。" #: ../../library/shutil.rst:500 msgid "" @@ -831,10 +925,12 @@ msgstr "" #: ../../library/shutil.rst:519 msgid "On Linux :func:`os.copy_file_range` or :func:`os.sendfile` is used." msgstr "" +"Linux では :func:`os.copy_file_range` または :func:`os.sendfile` が利用されま" +"す。" #: ../../library/shutil.rst:521 msgid "On Solaris :func:`os.sendfile` is used." -msgstr "" +msgstr "Solaris では :func:`os.sendfile` が利用されます。" #: ../../library/shutil.rst:523 msgid "" @@ -856,15 +952,15 @@ msgstr "" "shutil はユーザーへの通知なしでより効率の低い :func:`copyfileobj` 関数に" "フォールバックします。" -#: ../../library/shutil.rst:533 msgid "Solaris now uses :func:`os.sendfile`." -msgstr "" +msgstr "Solaris では :func:`os.sendfile` を使うようになりました。" -#: ../../library/shutil.rst:536 msgid "" "Copy-on-write or server-side copy may be used internally via :func:`os." "copy_file_range` on supported Linux filesystems." msgstr "" +"対応する Linux ファイルシステムでは、:func:`os.copy_file_range` を介してコ" +"ピーオンライトやサーバー側のコピーが内部で使われる場合があります。" #: ../../library/shutil.rst:543 msgid "copytree example" @@ -874,12 +970,14 @@ msgstr "copytree の例" msgid "An example that uses the :func:`ignore_patterns` helper::" msgstr ":func:`ignore_patterns` ヘルパ関数を利用する例です::" -#: ../../library/shutil.rst:547 msgid "" "from shutil import copytree, ignore_patterns\n" "\n" "copytree(source, destination, ignore=ignore_patterns('*.pyc', 'tmp*'))" msgstr "" +"from shutil import copytree, ignore_patterns\n" +"\n" +"copytree(source, destination, ignore=ignore_patterns('*.pyc', 'tmp*'))" #: ../../library/shutil.rst:551 msgid "" @@ -893,7 +991,6 @@ msgstr "" msgid "Another example that uses the *ignore* argument to add a logging call::" msgstr "*ignore* 引数にロギングさせる別の例です。 ::" -#: ../../library/shutil.rst:556 msgid "" "from shutil import copytree\n" "import logging\n" @@ -904,20 +1001,30 @@ msgid "" "\n" "copytree(source, destination, ignore=_logpath)" msgstr "" +"from shutil import copytree\n" +"import logging\n" +"\n" +"def _logpath(path, names):\n" +" logging.info('Working in %s', path)\n" +" return [] # 何も無視しない\n" +"\n" +"copytree(source, destination, ignore=_logpath)" #: ../../library/shutil.rst:569 msgid "rmtree example" msgstr "rmtree の例" -#: ../../library/shutil.rst:571 msgid "" "This example shows how to remove a directory tree on Windows where some of " "the files have their read-only bit set. It uses the onexc callback to clear " "the readonly bit and reattempt the remove. Any subsequent failure will " "propagate. ::" msgstr "" +"この例は、Windows で読み取り専用ビットが設定されたファイルを含むディレクトリ" +"ツリーを削除する方法を示します。\n" +"``onexc`` コールバックで読み取り専用ビットを解除し、削除を再試行します。\n" +"その後に発生したエラーは呼び出し元に伝播します。 ::" -#: ../../library/shutil.rst:576 msgid "" "import os, stat\n" "import shutil\n" @@ -929,6 +1036,15 @@ msgid "" "\n" "shutil.rmtree(directory, onexc=remove_readonly)" msgstr "" +"import os, stat\n" +"import shutil\n" +"\n" +"def remove_readonly(func, path, _):\n" +" \"読み取り専用ビットを解除して削除を再試行する\"\n" +" os.chmod(path, stat.S_IWRITE)\n" +" func(path)\n" +"\n" +"shutil.rmtree(directory, onexc=remove_readonly)" #: ../../library/shutil.rst:589 msgid "Archiving operations" @@ -1029,13 +1145,16 @@ msgstr "" "引数 ``base_name``, ``format``, ``root_dir``, ``base_dir`` を指定して :ref:`" "監査イベント ` ``shutil.make_archive`` を送出します。" -#: ../../library/shutil.rst:639 msgid "" "This function is not thread-safe when custom archivers registered with :func:" "`register_archive_format` do not support the *root_dir* argument. In this " "case it temporarily changes the current working directory of the process to " "*root_dir* to perform archiving." msgstr "" +":func:`register_archive_format` で登録した独自のアーカイバーが *root_dir* 引" +"数に対応していない場合、この関数はスレッドセーフではありません。\n" +"その場合、アーカイブ化のためにプロセスのカレントディレクトリを一時的に " +"*root_dir* に変更します。" #: ../../library/shutil.rst:645 msgid "" @@ -1045,11 +1164,12 @@ msgstr "" "``format=\"tar\"`` で作成されたアーカイブでは、レガシーなGNU形式に代わってモ" "ダンな pax (POSIX.1-2001) 形式が使われます。" -#: ../../library/shutil.rst:649 msgid "" "This function is now made thread-safe during creation of standard ``.zip`` " "and tar archives." msgstr "" +"標準の ``.zip`` アーカイブと tar アーカイブを作成する場合、この関数はスレッド" +"セーフになりました。" #: ../../library/shutil.rst:655 msgid "" @@ -1116,7 +1236,6 @@ msgstr "" "次のキーワード引数として渡されます: *owner*, *group*, *dry_run* ならびに " "*logger* (:func:`make_archive` に渡されます)。" -#: ../../library/shutil.rst:680 msgid "" "If *function* has the custom attribute ``function.supports_root_dir`` set to " "``True``, the *root_dir* argument is passed as a keyword argument. Otherwise " @@ -1124,6 +1243,11 @@ msgid "" "*root_dir* before calling *function*. In this case :func:`make_archive` is " "not thread-safe." msgstr "" +"*function* の独自の属性 ``function.supports_root_dir`` が ``True`` の場合、" +"*root_dir* 引数がキーワード引数として渡されます。\n" +"それ以外の場合は、*function* を呼び出す前にプロセスのカレントディレクトリを一" +"時的に *root_dir* に変更します。\n" +"この場合、:func:`make_archive` はスレッドセーフではありません。" #: ../../library/shutil.rst:686 msgid "" @@ -1142,9 +1266,8 @@ msgstr "" "*description* は、アーカイバのリストを返す :func:`get_archive_formats` で使わ" "れます。デフォルトでは空の文字列です。" -#: ../../library/shutil.rst:692 msgid "Added support for functions supporting the *root_dir* argument." -msgstr "" +msgstr "*root_dir* 引数を受け取る関数への対応が追加されました。" #: ../../library/shutil.rst:698 msgid "Remove the archive format *name* from the list of supported formats." @@ -1179,7 +1302,6 @@ msgstr "" "に対して登録されたアンパッカーを利用します。\n" "アンパッカーが見つからなかった場合、 :exc:`ValueError` を発生させます。" -#: ../../library/shutil.rst:715 msgid "" "The keyword-only *filter* argument is passed to the underlying unpacking " "function. For zip files, *filter* is not accepted. For tar files, it is " @@ -1187,14 +1309,18 @@ msgid "" "features specific to tar and UNIX-like filesystems. (See :ref:`tarfile-" "extraction-filter` for details.)" msgstr "" +"キーワード専用引数 *filter* は、内部で使う展開関数に渡されます。\n" +"zip ファイルでは *filter* を指定できません。\n" +"tar ファイルでは、tar や Unix 系ファイルシステムに固有の機能を使う場合を除" +"き、``'data'`` (Python 3.14 以降のデフォルト) を使うことをお勧めします (詳細" +"は :ref:`tarfile-extraction-filter` を参照)。" -#: ../../library/shutil.rst:721 msgid "" "Raises an :ref:`auditing event ` ``shutil.unpack_archive`` with " "arguments ``filename``, ``extract_dir``, ``format``." msgstr "" "引数 ``filename``, ``extract_dir``, ``format`` を指定して :ref:`監査イベント " -"` ``shutil.unpack_archive`` を送出します。 " +"` ``shutil.unpack_archive`` を送出します。" #: ../../library/shutil.rst:725 msgid "" @@ -1204,13 +1330,16 @@ msgid "" "with \"/\" or filenames with two dots \"..\"." msgstr "" -#: ../../library/shutil.rst:730 msgid "" "Since Python 3.14, the defaults for both built-in formats (zip and tar " "files) will prevent the most dangerous of such security issues, but will not " "prevent *all* unintended behavior. Read the :ref:`tarfile-further-" "verification` section for tar-specific details." msgstr "" +"Python 3.14 以降、組み込みの両形式 (zip ファイルと tar ファイル) のデフォルト" +"設定は、この種のセキュリティ問題のうち最も危険なものを防ぎますが、意図しない" +"動作を *すべて* 防ぐわけではありません。\n" +"tar 固有の詳細は :ref:`tarfile-further-verification` 節を参照してください。" #: ../../library/shutil.rst:736 msgid "Accepts a :term:`path-like object` for *filename* and *extract_dir*." @@ -1220,7 +1349,7 @@ msgstr "" #: ../../library/shutil.rst:739 msgid "Added the *filter* argument." -msgstr "" +msgstr "*filter* 引数が追加されました。" #: ../../library/shutil.rst:744 msgid "" @@ -1232,32 +1361,31 @@ msgstr "" "*extensions* はそのフォーマットに対応する拡張子 (例えば Zip ファイルに対して " "``.zip``) のリストです。" -#: ../../library/shutil.rst:748 msgid "" "*function* is the callable that will be used to unpack archives. The " "callable will receive:" msgstr "" +"*function* はアーカイブの展開に使う呼び出し可能オブジェクトです。\n" +"以下の引数を受け取ります。" -#: ../../library/shutil.rst:751 msgid "the path of the archive, as a positional argument;" -msgstr "" +msgstr "アーカイブのパス (位置引数)。" -#: ../../library/shutil.rst:752 msgid "" "the directory the archive must be extracted to, as a positional argument;" -msgstr "" +msgstr "アーカイブの展開先ディレクトリ (位置引数)。" -#: ../../library/shutil.rst:753 msgid "" "possibly a *filter* keyword argument, if it was given to :func:" "`unpack_archive`;" -msgstr "" +msgstr ":func:`unpack_archive` に指定されていれば、*filter* キーワード引数。" -#: ../../library/shutil.rst:755 msgid "" "additional keyword arguments, specified by *extra_args* as a sequence of " "``(name, value)`` tuples." msgstr "" +"*extra_args* に ``(name, value)`` タプルのシーケンスとして指定された追加の" +"キーワード引数。" #: ../../library/shutil.rst:758 msgid "" @@ -1312,7 +1440,6 @@ msgstr "" "この例では、ユーザの :file:`.ssh` ディレクトリにあるすべてのファイルを含む、 " "gzip された tar ファイルアーカイブを作成します::" -#: ../../library/shutil.rst:794 msgid "" ">>> from shutil import make_archive\n" ">>> import os\n" @@ -1321,12 +1448,17 @@ msgid "" ">>> make_archive(archive_name, 'gztar', root_dir)\n" "'/Users/tarek/myarchive.tar.gz'" msgstr "" +">>> from shutil import make_archive\n" +">>> import os\n" +">>> archive_name = os.path.expanduser(os.path.join('~', 'myarchive'))\n" +">>> root_dir = os.path.expanduser(os.path.join('~', '.ssh'))\n" +">>> make_archive(archive_name, 'gztar', root_dir)\n" +"'/Users/tarek/myarchive.tar.gz'" #: ../../library/shutil.rst:801 msgid "The resulting archive contains:" msgstr "結果のアーカイブは、以下のものを含みます:" -#: ../../library/shutil.rst:803 msgid "" "$ tar -tzvf /Users/tarek/myarchive.tar.gz\n" "drwx------ tarek/staff 0 2010-02-01 16:23:40 ./\n" @@ -1338,6 +1470,15 @@ msgid "" "-rw-r--r-- tarek/staff 397 2008-06-09 13:26:54 ./id_rsa.pub\n" "-rw-r--r-- tarek/staff 37192 2010-02-06 18:23:10 ./known_hosts" msgstr "" +"$ tar -tzvf /Users/tarek/myarchive.tar.gz\n" +"drwx------ tarek/staff 0 2010-02-01 16:23:40 ./\n" +"-rw-r--r-- tarek/staff 609 2008-06-09 13:26:54 ./authorized_keys\n" +"-rwxr-xr-x tarek/staff 65 2008-06-09 13:26:54 ./config\n" +"-rwx------ tarek/staff 668 2008-06-09 13:26:54 ./id_dsa\n" +"-rwxr-xr-x tarek/staff 609 2008-06-09 13:26:54 ./id_dsa.pub\n" +"-rw------- tarek/staff 1675 2008-06-09 13:26:54 ./id_rsa\n" +"-rw-r--r-- tarek/staff 397 2008-06-09 13:26:54 ./id_rsa.pub\n" +"-rw-r--r-- tarek/staff 37192 2010-02-06 18:23:10 ./known_hosts" #: ../../library/shutil.rst:819 msgid "Archiving example with *base_dir*" @@ -1363,14 +1504,21 @@ msgid "" " └── please_add.txt\n" " └── do_not_add.txt" msgstr "" +"$ tree tmp\n" +"tmp\n" +"└── root\n" +" └── structure\n" +" ├── content\n" +" └── please_add.txt\n" +" └── do_not_add.txt" -#: ../../library/shutil.rst:835 msgid "" "In the final archive, :file:`please_add.txt` should be included, but :file:" "`do_not_add.txt` should not. Therefore we use the following::" msgstr "" "作成するアーカイブには :file:`please_add.txt` が含まれますが、いっぽう :file:" -"`do_not_add.txt` は含まないようにします。この場合以下のようにします。" +"`do_not_add.txt` は含まないようにします。\n" +"この場合以下のようにします。 ::" #: ../../library/shutil.rst:838 msgid "" @@ -1396,6 +1544,9 @@ msgid "" "structure/content/\n" "structure/content/please_add.txt" msgstr "" +"$ python -m tarfile -l /Users/tarek/myarchive.tar\n" +"structure/content/\n" +"structure/content/please_add.txt" #: ../../library/shutil.rst:859 msgid "Querying the size of the output terminal" @@ -1449,11 +1600,12 @@ msgstr "" "参考: The Single UNIX Specification, Version 2, `Other Environment " "Variables`_." -#: ../../library/shutil.rst:886 msgid "" "The ``fallback`` values are also used if :func:`os.get_terminal_size` " "returns zeroes." msgstr "" +":func:`os.get_terminal_size` がゼロを返した場合にも ``fallback`` の値を使うよ" +"うになりました。" #: ../../library/shutil.rst:12 msgid "file" diff --git a/library/signal.po b/library/signal.po index 0cb25b4bc..d10059267 100644 --- a/library/signal.po +++ b/library/signal.po @@ -20,10 +20,10 @@ msgstr "" "Last-Translator: Arihiro TAKASE, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/signal.rst:2 @@ -43,7 +43,6 @@ msgstr "" msgid "General rules" msgstr "一般的なルール" -#: ../../library/signal.rst:17 msgid "" "The :func:`signal.signal` function allows defining custom handlers to be " "executed when a signal is received. A small number of default handlers are " @@ -52,12 +51,14 @@ msgid "" "translated into a :exc:`KeyboardInterrupt` exception if the parent process " "has not changed it." msgstr "" -":func:`signal.signal` 関数を使って、シグナルを受信した時に実行されるハンドラ" -"を定義することができます。 Python は標準でごく少数のシグナルハンドラをインス" -"トールしています: :const:`SIGPIPE` は無視され (したがって、 pipe や socket に" -"対する書き込みで生じたエラーは通常の Python 例外として報告されます)、 :const:" -"`SIGINT` は :exc:`KeyboardInterrupt` 例外に変換されます。親プロセスが変更して" -"いない場合は、これらはどれも上書きすることができます。" +":func:`signal.signal` 関数で、シグナルを受信したときに実行するハンドラーを定" +"義できます。\n" +"デフォルトでは少数のハンドラーが設定されています。\n" +":const:`SIGPIPE` は無視されます。\n" +"これにより、パイプやソケットへの書き込みエラーを通常の Python 例外として報告" +"できます。\n" +"親プロセスが処理方法を変更していなければ、:const:`SIGINT` は :exc:" +"`KeyboardInterrupt` 例外に変換されます。" #: ../../library/signal.rst:24 msgid "" @@ -71,12 +72,14 @@ msgstr "" "ターフェースをエミュレートします)。例外は :const:`SIGCHLD` のハンドラで、この" "場合は背後の実装系の仕様に従います。" -#: ../../library/signal.rst:29 msgid "" "On WebAssembly platforms, signals are emulated and therefore behave " "differently. Several functions and signals are not available on these " "platforms." msgstr "" +"WebAssembly プラットフォームではシグナルをエミュレートするため、動作が異なり" +"ます。\n" +"これらのプラットフォームでは一部の関数とシグナルを利用できません。" #: ../../library/signal.rst:34 msgid "Execution of Python signal handlers" @@ -95,7 +98,6 @@ msgstr "" "machine` が対応する Python のシグナルハンドラを後から (例えば次の :term:" "`bytecode` 命令時に) 実行するようにフラグを立てます:" -#: ../../library/signal.rst:42 msgid "" "It makes little sense to catch synchronous errors like :const:`SIGFPE` or :" "const:`SIGSEGV` that are caused by an invalid operation in C code. Python " @@ -104,6 +106,12 @@ msgid "" "onwards, you can use the :mod:`faulthandler` module to report on synchronous " "errors." msgstr "" +"C コードの不正な操作によって生じる :const:`SIGFPE` や :const:`SIGSEGV` などの" +"同期的なエラーを捕捉しても、ほとんど意味がありません。\n" +"シグナルハンドラーから C コードに戻ると同じシグナルが再び発生する可能性が高" +"く、Python が停止したように見えるためです。\n" +"Python 3.3 以降では :mod:`faulthandler` モジュールで同期的なエラーを報告でき" +"ます。" #: ../../library/signal.rst:49 msgid "" @@ -116,12 +124,14 @@ msgstr "" "ど) は、どのシグナルを受信しても中断されないまま長時間実行され続ける可能性が" "あります。Python のシグナルハンドラはその計算が終了してから呼び出されます。" -#: ../../library/signal.rst:54 msgid "" "If the handler raises an exception, it will be raised \"out of thin air\" in " "the main thread. See the :ref:`note below ` for a " "discussion." msgstr "" +"ハンドラーが例外を送出すると、メインスレッドではその時点で実行していた処理と" +"は無関係に例外が発生します。\n" +"詳しくは :ref:`後述の注意事項 ` を参照してください。" #: ../../library/signal.rst:62 msgid "Signals and threads" @@ -163,14 +173,12 @@ msgid "" "class:`Signals` objects." msgstr "" -#: ../../library/signal.rst:85 msgid "The signal module defines three enums:" -msgstr "" +msgstr "signal モジュールは三つの列挙型を定義します。" -#: ../../library/signal.rst:89 msgid "" ":class:`enum.IntEnum` collection of SIG* constants and the CTRL_* constants." -msgstr "" +msgstr "SIG* 定数と CTRL_* 定数を集めた :class:`enum.IntEnum` です。" #: ../../library/signal.rst:95 msgid "" @@ -184,28 +192,15 @@ msgid "" "`SIG_UNBLOCK` and :const:`SIG_SETMASK`." msgstr "" -#: ../../library/signal.rst:103 ../../library/signal.rst:136 -#: ../../library/signal.rst:142 ../../library/signal.rst:148 -#: ../../library/signal.rst:154 ../../library/signal.rst:160 -#: ../../library/signal.rst:166 ../../library/signal.rst:180 -#: ../../library/signal.rst:198 ../../library/signal.rst:206 -#: ../../library/signal.rst:217 ../../library/signal.rst:232 -#: ../../library/signal.rst:238 ../../library/signal.rst:244 -#: ../../library/signal.rst:262 ../../library/signal.rst:272 -#: ../../library/signal.rst:351 ../../library/signal.rst:390 -#: ../../library/signal.rst:414 ../../library/signal.rst:437 -#: ../../library/signal.rst:471 ../../library/signal.rst:501 -#: ../../library/signal.rst:508 ../../library/signal.rst:563 -#: ../../library/signal.rst:605 ../../library/signal.rst:620 -#: ../../library/signal.rst:646 ../../library/signal.rst:666 msgid "Availability" -msgstr "" +msgstr "利用可能な環境" -#: ../../library/signal.rst:105 ../../library/signal.rst:473 msgid "" "See the man page :manpage:`sigprocmask(2)` and :manpage:`pthread_sigmask(3)` " "for further information." msgstr "" +"詳細は :manpage:`sigprocmask(2)` と :manpage:`pthread_sigmask(3)` のマニュア" +"ルページを参照してください。" #: ../../library/signal.rst:111 msgid "The variables defined in the :mod:`signal` module are:" @@ -230,108 +225,94 @@ msgid "" msgstr "" "もう一つの標準シグナル処理オプションで、受け取ったシグナルを単に無視します。" -#: ../../library/signal.rst:130 msgid "Abort signal from :manpage:`abort(3)`." -msgstr "" +msgstr ":manpage:`abort(3)` による中止シグナル。" -#: ../../library/signal.rst:134 msgid "Timer signal from :manpage:`alarm(2)`." -msgstr "" +msgstr ":manpage:`alarm(2)` によるタイマーシグナル。" -#: ../../library/signal.rst:140 msgid "Interrupt from keyboard (CTRL + BREAK)." -msgstr "" +msgstr "キーボードによる割り込み (CTRL + BREAK)。" -#: ../../library/signal.rst:146 msgid "Bus error (bad memory access)." -msgstr "" +msgstr "バスエラー (不正なメモリアクセス)。" -#: ../../library/signal.rst:152 msgid "Child process stopped or terminated." -msgstr "" +msgstr "子プロセスの停止または終了。" #: ../../library/signal.rst:158 msgid "Alias to :data:`SIGCHLD`." msgstr ":data:`SIGCHLD` のエイリアスです。" -#: ../../library/signal.rst:164 msgid "Continue the process if it is currently stopped" -msgstr "" +msgstr "停止中のプロセスの実行を再開する" -#: ../../library/signal.rst:170 msgid "Floating-point exception. For example, division by zero." msgstr "" +"浮動小数点例外。\n" +"例えばゼロによる除算。" -#: ../../library/signal.rst:173 msgid "" ":exc:`ZeroDivisionError` is raised when the second argument of a division or " "modulo operation is zero." msgstr "" +"除算や剰余演算の二つ目の引数がゼロの場合、:exc:`ZeroDivisionError` が送出され" +"ます。" -#: ../../library/signal.rst:178 msgid "" "Hangup detected on controlling terminal or death of controlling process." -msgstr "" +msgstr "制御端末のハングアップの検出、または制御プロセスの終了。" -#: ../../library/signal.rst:184 msgid "Illegal instruction." -msgstr "" +msgstr "不正な命令。" -#: ../../library/signal.rst:188 msgid "Interrupt from keyboard (CTRL + C)." -msgstr "" +msgstr "キーボードによる割り込み (CTRL + C)。" -#: ../../library/signal.rst:190 msgid "Default action is to raise :exc:`KeyboardInterrupt`." -msgstr "" +msgstr "デフォルトの動作は :exc:`KeyboardInterrupt` の送出です。" -#: ../../library/signal.rst:194 msgid "Kill signal." -msgstr "" +msgstr "強制終了シグナル。" -#: ../../library/signal.rst:196 msgid "It cannot be caught, blocked, or ignored." -msgstr "" +msgstr "捕捉、ブロック、無視はできません。" -#: ../../library/signal.rst:202 msgid "Broken pipe: write to pipe with no readers." -msgstr "" +msgstr "パイプの切断: 読み取り側のいないパイプへの書き込み。" -#: ../../library/signal.rst:204 msgid "Default action is to ignore the signal." -msgstr "" +msgstr "デフォルトの動作はシグナルの無視です。" -#: ../../library/signal.rst:210 msgid "Segmentation fault: invalid memory reference." -msgstr "" +msgstr "セグメンテーション違反: 不正なメモリ参照。" -#: ../../library/signal.rst:214 msgid "" "Stack fault on coprocessor. The Linux kernel does not raise this signal: it " "can only be raised in user space." msgstr "" +"コプロセッサーのスタック障害。\n" +"Linux カーネルはこのシグナルを発生させず、ユーザー空間からのみ発生させられま" +"す。" -#: ../../library/signal.rst:219 msgid "" "On architectures where the signal is available. See the man page :manpage:" "`signal(7)` for further information." msgstr "" +"このシグナルを利用できるアーキテクチャーに限ります。\n" +"詳細は :manpage:`signal(7)` のマニュアルページを参照してください。" -#: ../../library/signal.rst:226 msgid "Termination signal." -msgstr "" +msgstr "終了シグナル。" -#: ../../library/signal.rst:230 msgid "User-defined signal 1." -msgstr "" +msgstr "ユーザー定義シグナル 1。" -#: ../../library/signal.rst:236 msgid "User-defined signal 2." -msgstr "" +msgstr "ユーザー定義シグナル 2。" -#: ../../library/signal.rst:242 msgid "Window resize signal." -msgstr "" +msgstr "ウィンドウサイズ変更シグナル。" #: ../../library/signal.rst:248 msgid "" @@ -368,11 +349,12 @@ msgstr "" ":kbd:`CTRL+BREAK` キーストロークに該当するシグナル。このシグナルは :func:`os." "kill` でだけ利用できます。" -#: ../../library/signal.rst:279 msgid "" "One more than the number of the highest signal number. Use :func:" "`valid_signals` to get valid signal numbers." msgstr "" +"最大のシグナル番号に 1 を足した値です。\n" +"有効なシグナル番号を取得するには :func:`valid_signals` を使ってください。" #: ../../library/signal.rst:285 msgid "" @@ -388,7 +370,7 @@ msgid "" "SIGVTALRM upon expiration." msgstr "" "プロセスの実行時間だけデクリメントするインターバルタイマーです。タイマーが発" -"火したときに :const:`SIGVTALRM` を送ります。" +"火したときに ``SIGVTALRM`` を送ります。" #: ../../library/signal.rst:297 msgid "" @@ -400,8 +382,7 @@ msgstr "" "プロセスの実行中と、システムがそのプロセスのために実行している時間だけデクリ" "メントするインターバルタイマーです。ITIMER_VIRTUAL と組み合わせて、このタイ" "マーはよくアプリケーションがユーザー空間とカーネル空間で消費した時間のプロ" -"ファイリングに利用されます。タイマーが発火したときに :const:`SIGPROF` を送り" -"ます。" +"ファイリングに利用されます。タイマーが発火したときに ``SIGPROF`` を送ります。" #: ../../library/signal.rst:305 msgid "" @@ -419,13 +400,12 @@ msgstr "" ":func:`pthread_sigmask` の *how* 引数に渡せる値で、シグナルがブロック解除され" "ることを意味します。" -#: ../../library/signal.rst:319 msgid "" "A possible value for the *how* parameter to :func:`pthread_sigmask` " "indicating that the signal mask is to be replaced." msgstr "" -":func:`pthread_sigmask` の *how* 引数に渡せる値で、シグナルが置換されることを" -"意味します。" +":func:`pthread_sigmask` の *how* 引数に渡せる値で、シグナルマスクが置換される" +"ことを意味します。" #: ../../library/signal.rst:325 msgid "The :mod:`signal` module defines one exception:" @@ -443,13 +423,12 @@ msgstr "" "された場合、このエラーを予期してください。このエラーは :exc:`OSError` を継承" "しています。" -#: ../../library/signal.rst:334 msgid "" "This error used to be a subtype of :exc:`IOError`, which is now an alias of :" "exc:`OSError`." msgstr "" -"このエラーは以前は :exc:`IOError` のサブタイプでしたが、 :exc:`OSError` のエ" -"イリアスになりました。" +"このエラーは以前は :exc:`IOError` のサブタイプでした。\n" +"現在、``IOError`` は :exc:`OSError` のエイリアスです。" #: ../../library/signal.rst:339 msgid "The :mod:`signal` module defines the following functions:" @@ -473,9 +452,8 @@ msgstr "" "いるアラームがキャンセルされます。戻り値がゼロの場合、現在アラームがスケ" "ジュールされていないことを示します。" -#: ../../library/signal.rst:353 msgid "See the man page :manpage:`alarm(2)` for further information." -msgstr "" +msgstr "詳細は :manpage:`alarm(2)` のマニュアルページを参照してください。" #: ../../library/signal.rst:358 msgid "" @@ -495,19 +473,24 @@ msgstr "" "し、 ``None`` はシグナルハンドラがまだ Python によってインストールされていな" "いことを示します。" -#: ../../library/signal.rst:369 msgid "" "Returns the description of signal *signalnum*, such as \"Interrupt\" for :" "const:`SIGINT`. Returns :const:`None` if *signalnum* has no description. " "Raises :exc:`ValueError` if *signalnum* is invalid." msgstr "" +"シグナル *signalnum* の説明を返します (例えば :const:`SIGINT` なら " +"\"Interrupt\")。\n" +"*signalnum* に説明がなければ :const:`None` を返します。\n" +"*signalnum* が無効な場合は :exc:`ValueError` を送出します。" -#: ../../library/signal.rst:378 msgid "" "Return the set of valid signal numbers on this platform. This can be less " "than ``range(1, NSIG)`` if some signals are reserved by the system for " "internal use." msgstr "" +"このプラットフォームで有効なシグナル番号の集合を返します。\n" +"システムが内部使用のために予約しているシグナルがある場合は、``range(1, " +"NSIG)`` より少なくなることがあります。" #: ../../library/signal.rst:387 msgid "" @@ -517,9 +500,8 @@ msgstr "" "シグナルを受け取るまでプロセスを一時停止します; その後、適切なハンドラが呼び" "出されます。戻り値はありません。" -#: ../../library/signal.rst:392 msgid "See the man page :manpage:`signal(2)` for further information." -msgstr "" +msgstr "詳細は :manpage:`signal(2)` のマニュアルページを参照してください。" #: ../../library/signal.rst:394 msgid "" @@ -529,17 +511,21 @@ msgstr "" ":func:`sigwait`, :func:`sigwaitinfo`, :func:`sigtimedwait` :func:" "`sigpending` も参照してください。" -#: ../../library/signal.rst:400 msgid "Sends a signal to the calling process. Returns nothing." msgstr "" +"呼び出し元のプロセスにシグナルを送ります。\n" +"戻り値はありません。" -#: ../../library/signal.rst:407 msgid "" "Send signal *sig* to the process referred to by file descriptor *pidfd*. " "Python does not currently support the *siginfo* parameter; it must be " "``None``. The *flags* argument is provided for future extensions; no flag " "values are currently defined." msgstr "" +"ファイル記述子 *pidfd* が指すプロセスにシグナル *sig* を送ります。\n" +"Python は現在 *siginfo* 引数に対応していないため、``None`` にしなければなりま" +"せん。\n" +"*flags* 引数は将来の拡張用で、現在定義されているフラグ値はありません。" #: ../../library/signal.rst:412 msgid "See the :manpage:`pidfd_send_signal(2)` man page for more information." @@ -558,30 +544,33 @@ msgid "" "running system call to fail with :exc:`InterruptedError`." msgstr "" -#: ../../library/signal.rst:428 msgid "" "Use :func:`threading.get_ident` or the :attr:`~threading.Thread.ident` " "attribute of :class:`threading.Thread` objects to get a suitable value for " "*thread_id*." msgstr "" +"*thread_id* に適した値を取得するには、:func:`threading.get_ident` または :" +"class:`threading.Thread` オブジェクトの :attr:`~threading.Thread.ident` 属性" +"を使ってください。" -#: ../../library/signal.rst:432 msgid "" "If *signalnum* is 0, then no signal is sent, but error checking is still " "performed; this can be used to check if the target thread is still running." msgstr "" +"*signalnum* が 0 の場合、シグナルは送られませんがエラーチェックは行われま" +"す。\n" +"これを使って対象のスレッドがまだ実行中かどうかを確認できます。" -#: ../../library/signal.rst:435 msgid "" "Raises an :ref:`auditing event ` ``signal.pthread_kill`` with " "arguments ``thread_id``, ``signalnum``." msgstr "" "引数 ``thread_id``, ``signalnum`` を指定して :ref:`監査イベント ` " -"``signal.pthread_kill`` を送出します。 " +"``signal.pthread_kill`` を送出します。" -#: ../../library/signal.rst:439 msgid "See the man page :manpage:`pthread_kill(3)` for further information." msgstr "" +"詳細は :manpage:`pthread_kill(3)` のマニュアルページを参照してください。" #: ../../library/signal.rst:441 msgid "See also :func:`os.kill`." @@ -645,9 +634,8 @@ msgstr "" "呼び出しスレッドにセットされたシグナルマスクを問い合わせるには例えば " "``signal.pthread_sigmask(signal.SIG_BLOCK, [])`` とします。" -#: ../../library/signal.rst:469 msgid ":data:`SIGKILL` and :data:`SIGSTOP` cannot be blocked." -msgstr "" +msgstr ":data:`SIGKILL` と :data:`SIGSTOP` はブロックできません。" #: ../../library/signal.rst:476 msgid "See also :func:`pause`, :func:`sigpending` and :func:`sigwait`." @@ -668,18 +656,18 @@ msgstr "" "れば) *interval* 秒間隔で起動するように設定します。 *seconds* に0を指定する" "と、*which* で指定されたタイマーをクリアすることができます。" -#: ../../library/signal.rst:490 msgid "" "When an interval timer fires, a signal is sent to the process. The signal " "sent is dependent on the timer being used; :const:`signal.ITIMER_REAL` will " "deliver :const:`SIGALRM`, :const:`signal.ITIMER_VIRTUAL` sends :const:" "`SIGVTALRM`, and :const:`signal.ITIMER_PROF` will deliver :const:`SIGPROF`." msgstr "" -"インターバルタイマーが起動したとき、シグナルがプロセスに送られます。送られる" -"シグナルは利用されたタイマーの種類に依存します。 :const:`signal.ITIMER_REAL` " -"の場合は :const:`SIGALRM` が、 :const:`signal.ITIMER_VIRTUAL` の場合は :" -"const:`SIGVTALRM` が、 :const:`signal.ITIMER_PROF` の場合は :const:`SIGPROF` " -"が送られます。" +"インターバルタイマーが設定時間に達したとき、シグナルがプロセスに送られま" +"す。\n" +"送られるシグナルは利用されたタイマーの種類に依存します。\n" +":const:`signal.ITIMER_REAL` の場合は :const:`SIGALRM` が、 :const:`signal." +"ITIMER_VIRTUAL` の場合は :const:`SIGVTALRM` が、 :const:`signal.ITIMER_PROF` " +"の場合は :const:`SIGPROF` が送られます。" #: ../../library/signal.rst:496 msgid "The old values are returned as a tuple: (delay, interval)." @@ -696,7 +684,6 @@ msgstr "" msgid "Returns current value of a given interval timer specified by *which*." msgstr "*which* で指定されたインターバルタイマーの現在の値を返します。" -#: ../../library/signal.rst:513 msgid "" "Set the wakeup file descriptor to *fd*. When a signal your program has " "registered a signal handler for is received, the signal number is written as " @@ -705,14 +692,24 @@ msgid "" "This can be used by a library to wakeup a poll or select call, allowing the " "signal to be fully processed." msgstr "" +"待機を解除するためのファイル記述子を *fd* に設定します。\n" +"プログラムがハンドラーを登録したシグナルを受信すると、その番号が 1 バイトとし" +"てこのファイル記述子に書き込まれます。\n" +"対象のシグナルにハンドラーを登録していなければ何も書き込まれません。\n" +"ライブラリはこの仕組みで poll や select の待機を解除し、シグナルを最後まで処" +"理できます。" -#: ../../library/signal.rst:520 msgid "" "The old wakeup fd is returned (or -1 if file descriptor wakeup was not " "enabled). If *fd* is -1, file descriptor wakeup is disabled. If not -1, " "*fd* must be non-blocking. It is up to the library to remove any bytes from " "*fd* before calling poll or select again." msgstr "" +"以前の待機解除用ファイル記述子を返します (有効になっていなければ -1)。\n" +"*fd* が -1 の場合はファイル記述子による待機解除を無効にします。\n" +"-1 でない場合、*fd* は非ブロッキングでなければなりません。\n" +"poll や select を再び呼ぶ前に *fd* のバイトをすべて読み出すのはライブラリの責" +"任です。" #: ../../library/signal.rst:525 ../../library/signal.rst:580 msgid "" @@ -725,14 +722,15 @@ msgstr "" "ド ` からしか実行できません。それ以外のスレッドからこの" "関数を実行しようとすると :exc:`ValueError` 例外が発生します。" -#: ../../library/signal.rst:530 msgid "" "There are two common ways to use this function. In both approaches, you use " "the fd to wake up when a signal arrives, but then they differ in how they " "determine *which* signal or signals have arrived." msgstr "" +"この関数には一般的な使い方が二つあります。\n" +"どちらもシグナルの到着時にファイル記述子で待機を解除しますが、*どの* シグナル" +"が到着したかを判別する方法が異なります。" -#: ../../library/signal.rst:535 msgid "" "In the first approach, we read the data out of the fd's buffer, and the byte " "values give you the signal numbers. This is simple, but in rare cases it can " @@ -742,8 +740,16 @@ msgid "" "you should set ``warn_on_full_buffer=True``, which will at least cause a " "warning to be printed to stderr when signals are lost." msgstr "" +"一つ目の方法では、ファイル記述子のバッファからデータを読み出し、そのバイト値" +"からシグナル番号を取得します。\n" +"これは単純ですが、まれに問題が起こります。\n" +"通常、ファイル記述子のバッファ容量には上限があるため、シグナルが短時間に大量" +"に到着するとバッファがいっぱいになり、一部のシグナルを取りこぼす可能性があり" +"ます。\n" +"この方法を使う場合は ``warn_on_full_buffer=True`` を設定してください。\n" +"そうすれば、少なくともシグナルを取りこぼしたときに標準エラー出力に警告が表示" +"されます。" -#: ../../library/signal.rst:544 msgid "" "In the second approach, we use the wakeup fd *only* for wakeups, and ignore " "the actual byte values. In this case, all we care about is whether the fd's " @@ -752,6 +758,12 @@ msgid "" "``warn_on_full_buffer=False``, so that your users are not confused by " "spurious warning messages." msgstr "" +"二つ目の方法では、ファイル記述子を待機解除のため *だけ* に使い、実際のバイト" +"値は無視します。\n" +"この場合はバッファが空かどうかだけを見ており、バッファがいっぱいになっても問" +"題はありません。\n" +"不要な警告メッセージで利用者を混乱させないよう、この方法では " +"``warn_on_full_buffer=False`` を設定してください。" #: ../../library/signal.rst:551 msgid "On Windows, the function now also supports socket handles." @@ -771,16 +783,18 @@ msgstr "" "合、 *signalnum* シグナルに中断されたシステムコールは再実行されます。それ以外" "の場合、システムコールは中断されます。戻り値はありません。" -#: ../../library/signal.rst:565 msgid "See the man page :manpage:`siginterrupt(3)` for further information." msgstr "" +"詳細は :manpage:`siginterrupt(3)` のマニュアルページを参照してください。" -#: ../../library/signal.rst:567 msgid "" "Note that installing a signal handler with :func:`signal` will reset the " "restart behaviour to interruptible by implicitly calling :c:func:`!" "siginterrupt` with a true *flag* value for the given signal." msgstr "" +":func:`signal` でシグナルハンドラーを登録すると、対象のシグナルに対して " +"*flag* を真にして :c:func:`!siginterrupt` が暗黙に呼び出され、システムコール" +"を中断する動作にリセットされることに注意してください。" #: ../../library/signal.rst:574 msgid "" @@ -810,7 +824,6 @@ msgstr "" "いての記述は :ref:`標準型の階層における説明 ` か、 :mod:" "`inspect` モジュールの属性の説明を参照してください)。" -#: ../../library/signal.rst:590 msgid "" "On Windows, :func:`signal` can only be called with :const:`SIGABRT`, :const:" "`SIGFPE`, :const:`SIGILL`, :const:`SIGINT`, :const:`SIGSEGV`, :const:" @@ -819,6 +832,13 @@ msgid "" "an :exc:`AttributeError` will be raised if a signal name is not defined as " "``SIG*`` module level constant." msgstr "" +"Windows では :func:`signal` に指定できるのは :const:`SIGABRT`、:const:" +"`SIGFPE`、:const:`SIGILL`、:const:`SIGINT`、:const:`SIGSEGV`、:const:" +"`SIGTERM`、:const:`SIGBREAK` だけです。\n" +"他の値では :exc:`ValueError` が送出されます。\n" +"すべてのシステムが同じシグナル名を定義しているわけではなく、``SIG*`` というモ" +"ジュールレベルの定数が定義されていない名前を参照すると :exc:`AttributeError` " +"が送出されます。" #: ../../library/signal.rst:601 msgid "" @@ -829,9 +849,8 @@ msgstr "" "呼び出しスレッドで配送が保留されているシグナル (つまり配送がブロックされてい" "る間に発生したシグナル) の集合を調べます。保留中のシグナルの集合を返します。" -#: ../../library/signal.rst:607 msgid "See the man page :manpage:`sigpending(2)` for further information." -msgstr "" +msgstr "詳細は :manpage:`sigpending(2)` のマニュアルページを参照してください。" #: ../../library/signal.rst:609 msgid "See also :func:`pause`, :func:`pthread_sigmask` and :func:`sigwait`." @@ -849,9 +868,8 @@ msgstr "" "一時停止します。この関数はそのシグナルを受け取ると (それを保留シグナルリスト" "から取り除いて) そのシグナル番号を返します。" -#: ../../library/signal.rst:622 msgid "See the man page :manpage:`sigwait(3)` for further information." -msgstr "" +msgstr "詳細は :manpage:`sigwait(3)` のマニュアルページを参照してください。" #: ../../library/signal.rst:624 msgid "" @@ -880,49 +898,54 @@ msgid "" "`si_band`." msgstr "" -#: ../../library/signal.rst:648 msgid "See the man page :manpage:`sigwaitinfo(2)` for further information." msgstr "" +"詳細は :manpage:`sigwaitinfo(2)` のマニュアルページを参照してください。" #: ../../library/signal.rst:650 msgid "See also :func:`pause`, :func:`sigwait` and :func:`sigtimedwait`." msgstr "" ":func:`pause`, :func:`sigwait`, :func:`sigtimedwait` も参照して下さい。" -#: ../../library/signal.rst:654 msgid "" "The function is now retried if interrupted by a signal not in *sigset* and " "the signal handler does not raise an exception (see :pep:`475` for the " "rationale)." msgstr "" +"*sigset* に含まれないシグナルで中断され、そのハンドラーが例外を送出しなかった" +"場合、関数を再試行するようになりました (理由は :pep:`475` を参照)。" -#: ../../library/signal.rst:662 msgid "" "Like :func:`sigwaitinfo`, but takes an additional *timeout* argument " "specifying a timeout. If *timeout* is specified as ``0``, a poll is " "performed. Returns :const:`None` if a timeout occurs." msgstr "" +":func:`sigwaitinfo` と同様ですが、タイムアウトを指定する *timeout* 引数を追加" +"で受け取ります。\n" +"*timeout* に ``0`` を指定するとポーリングを行います。\n" +"タイムアウトした場合は :const:`None` を返します。" -#: ../../library/signal.rst:668 msgid "See the man page :manpage:`sigtimedwait(2)` for further information." msgstr "" +"詳細は :manpage:`sigtimedwait(2)` のマニュアルページを参照してください。" #: ../../library/signal.rst:670 msgid "See also :func:`pause`, :func:`sigwait` and :func:`sigwaitinfo`." msgstr ":func:`pause`, :func:`sigwait`, :func:`sigwaitinfo` も参照して下さい。" -#: ../../library/signal.rst:674 msgid "" "The function is now retried with the recomputed *timeout* if interrupted by " "a signal not in *sigset* and the signal handler does not raise an exception " "(see :pep:`475` for the rationale)." msgstr "" +"*sigset* に含まれないシグナルで中断され、そのハンドラーが例外を送出しなかった" +"場合、*timeout* を再計算して関数を再試行するようになりました (理由は :pep:" +"`475` を参照)。" #: ../../library/signal.rst:683 msgid "Examples" msgstr "使用例" -#: ../../library/signal.rst:685 msgid "" "Here is a minimal example program. It uses the :func:`alarm` function to " "limit the time spent waiting to open a file; this is useful if the file is " @@ -931,15 +954,15 @@ msgid "" "alarm before opening the file; if the operation takes too long, the alarm " "signal will be sent, and the handler raises an exception. ::" msgstr "" -"以下は最小限のプログラム例です。この例では :func:`alarm` を使ってファイルを開" -"く処理を待つのに費やす時間を制限します; 例えば、電源の入っていないシリアルデ" -"バイスを開こうとすると、通常 :func:`os.open` は未定義の期間ハングアップしてし" -"まいますが、この方法はそうした場合に便利です。ここではファイルを開くまで 5 秒" -"間のアラームを設定することで解決しています; ファイルを開く処理が長くかかりす" -"ぎると、アラームシグナルが送信され、ハンドラが例外を送出するようになっていま" -"す。 ::" +"以下は最小限のプログラム例です。\n" +"この例では :func:`alarm` を使ってファイルを開く処理を待つのに費やす時間を制限" +"します; 例えば、電源の入っていないシリアルデバイスを開こうとすると、通常 :" +"func:`os.open` は無期限にハングしてしまいますが、この方法はそうした場合に便利" +"です。\n" +"ここではファイルを開く前に 5 秒後のアラームを設定することで解決しています; " +"ファイルを開く処理が長くかかりすぎると、アラームシグナルが送信され、ハンドラ" +"が例外を送出するようになっています。 ::" -#: ../../library/signal.rst:692 msgid "" "import signal, os\n" "\n" @@ -957,12 +980,25 @@ msgid "" "\n" "signal.alarm(0) # Disable the alarm" msgstr "" +"import signal, os\n" +"\n" +"def handler(signum, frame):\n" +" signame = signal.Signals(signum).name\n" +" print(f'Signal handler called with signal {signame} ({signum})')\n" +" raise OSError(\"Couldn't open device!\")\n" +"\n" +"# シグナルハンドラーと 5 秒後のアラームを設定する\n" +"signal.signal(signal.SIGALRM, handler)\n" +"signal.alarm(5)\n" +"\n" +"# この open() は無期限に待機する可能性がある\n" +"fd = os.open('/dev/ttyS0', os.O_RDWR)\n" +"\n" +"signal.alarm(0) # アラームを解除する" -#: ../../library/signal.rst:709 msgid "Note on SIGPIPE" -msgstr "" +msgstr "SIGPIPE についての注意" -#: ../../library/signal.rst:711 msgid "" "Piping output of your program to tools like :manpage:`head(1)` will cause a :" "const:`SIGPIPE` signal to be sent to your process when the receiver of its " @@ -970,8 +1006,14 @@ msgid "" "`BrokenPipeError: [Errno 32] Broken pipe`. To handle this case, wrap your " "entry point to catch this exception as follows::" msgstr "" +"プログラムの出力を :manpage:`head(1)` などのツールにパイプで渡していて、標準" +"出力の受け取り側が先に閉じると、プロセスに :const:`SIGPIPE` シグナルが送られ" +"ます。\n" +"この結果、:code:`BrokenPipeError: [Errno 32] Broken pipe` のような例外が発生" +"します。\n" +"この状況に対処するには、次のようにエントリーポイントの処理を囲んで例外を捕捉" +"します。 ::" -#: ../../library/signal.rst:717 msgid "" "import os\n" "import sys\n" @@ -995,20 +1037,41 @@ msgid "" "if __name__ == '__main__':\n" " main()" msgstr "" +"import os\n" +"import sys\n" +"\n" +"def main():\n" +" try:\n" +" # 大量の出力を模擬する (このループを実際のコードに置き換える)\n" +" for x in range(10000):\n" +" print(\"y\")\n" +" # この try ブロック内で SIGPIPE が発生するよう、\n" +" # ここで出力をフラッシュする。\n" +" sys.stdout.flush()\n" +" except BrokenPipeError:\n" +" # Python は終了時に標準ストリームをフラッシュするので、残りの出力を\n" +" # devnull にリダイレクトし、終了時の BrokenPipeError 再発を防ぐ\n" +" devnull = os.open(os.devnull, os.O_WRONLY)\n" +" os.dup2(devnull, sys.stdout.fileno())\n" +" sys.exit(1) # EPIPE では Python はエラーコード 1 で終了する\n" +"\n" +"if __name__ == '__main__':\n" +" main()" -#: ../../library/signal.rst:738 msgid "" "Do not set :const:`SIGPIPE`'s disposition to :const:`SIG_DFL` in order to " "avoid :exc:`BrokenPipeError`. Doing that would cause your program to exit " "unexpectedly whenever any socket connection is interrupted while your " "program is still writing to it." msgstr "" +":exc:`BrokenPipeError` を避けるために :const:`SIGPIPE` の処理方法を :const:" +"`SIG_DFL` に設定しないでください。\n" +"そうすると、ソケットへの書き込み中に接続が切れるたびに、プログラムが予期せず" +"終了してしまいます。" -#: ../../library/signal.rst:747 msgid "Note on Signal Handlers and Exceptions" -msgstr "" +msgstr "シグナルハンドラーと例外についての注意" -#: ../../library/signal.rst:749 msgid "" "If a signal handler raises an exception, the exception will be propagated to " "the main thread and may be raised after any :term:`bytecode` instruction. " @@ -1018,12 +1081,16 @@ msgid "" "exception resulting from a signal handler) may on rare occasions put the " "program in an unexpected state." msgstr "" +"シグナルハンドラーが例外を送出すると、その例外はメインスレッドに伝播し、ど" +"の :term:`bytecode` 命令の実行後にも発生する可能性があります。\n" +"特に :exc:`KeyboardInterrupt` は実行中のどの時点でも発生し得ます。\n" +"標準ライブラリを含むほとんどの Python コードはこれに対して堅牢にできないた" +"め、:exc:`KeyboardInterrupt` (またはシグナルハンドラーによる他の例外) によっ" +"て、まれにプログラムが予期しない状態になることがあります。" -#: ../../library/signal.rst:756 msgid "To illustrate this issue, consider the following code::" -msgstr "" +msgstr "この問題を示す例として、次のコードを考えてください。 ::" -#: ../../library/signal.rst:758 msgid "" "class SpamContext:\n" " def __init__(self):\n" @@ -1040,8 +1107,21 @@ msgid "" " ...\n" " self.lock.release()" msgstr "" +"class SpamContext:\n" +" def __init__(self):\n" +" self.lock = threading.Lock()\n" +"\n" +" def __enter__(self):\n" +" # ここで KeyboardInterrupt が発生しても問題ない\n" +" self.lock.acquire()\n" +" # ここで KeyboardInterrupt が発生すると __exit__ は呼ばれない\n" +" ...\n" +" # 関数から戻る直前に KeyboardInterrupt が発生する可能性もある\n" +"\n" +" def __exit__(self, exc_type, exc_val, exc_tb):\n" +" ...\n" +" self.lock.release()" -#: ../../library/signal.rst:773 msgid "" "For many programs, especially those that merely want to exit on :exc:" "`KeyboardInterrupt`, this is not a problem, but applications that are " @@ -1051,8 +1131,14 @@ msgid "" "own :const:`SIGINT` handler. Below is an example of an HTTP server that " "avoids :exc:`KeyboardInterrupt`::" msgstr "" +"多くのプログラム、特に :exc:`KeyboardInterrupt` で単に終了するだけのプログラ" +"ムでは問題になりませんが、複雑なアプリケーションや高い信頼性が必要なアプリ" +"ケーションではシグナルハンドラーからの例外送出を避けるべきです。\n" +"また、正常に終了処理を行う手段として :exc:`KeyboardInterrupt` を捕捉すること" +"も避けてください。\n" +"代わりに独自の :const:`SIGINT` ハンドラーを登録してください。\n" +"以下は :exc:`KeyboardInterrupt` を発生させない HTTP サーバーの例です。 ::" -#: ../../library/signal.rst:781 msgid "" "import signal\n" "import socket\n" @@ -1084,3 +1170,32 @@ msgid "" "serve_forever(httpd)\n" "print(\"Shutdown...\")" msgstr "" +"import signal\n" +"import socket\n" +"from selectors import DefaultSelector, EVENT_READ\n" +"from http.server import HTTPServer, SimpleHTTPRequestHandler\n" +"\n" +"interrupt_read, interrupt_write = socket.socketpair()\n" +"\n" +"def handler(signum, frame):\n" +" print('Signal handler called with signal', signum)\n" +" interrupt_write.send(b'\\0')\n" +"signal.signal(signal.SIGINT, handler)\n" +"\n" +"def serve_forever(httpd):\n" +" sel = DefaultSelector()\n" +" sel.register(interrupt_read, EVENT_READ)\n" +" sel.register(httpd, EVENT_READ)\n" +"\n" +" while True:\n" +" for key, _ in sel.select():\n" +" if key.fileobj == interrupt_read:\n" +" interrupt_read.recv(1)\n" +" return\n" +" if key.fileobj == httpd:\n" +" httpd.handle_request()\n" +"\n" +"print(\"Serving on port 8000\")\n" +"httpd = HTTPServer(('', 8000), SimpleHTTPRequestHandler)\n" +"serve_forever(httpd)\n" +"print(\"Shutdown...\")" diff --git a/library/site.po b/library/site.po index 85d8b570b..5ca342ac3 100644 --- a/library/site.po +++ b/library/site.po @@ -21,10 +21,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/site.rst:2 @@ -81,12 +81,14 @@ msgstr "" msgid "Support for the \"site-python\" directory has been removed." msgstr "\"site-python\" ディレクトリのサポートは削除されました。" -#: ../../library/site.rst:47 msgid "" "On Unix, :term:`Free threading ` Python installations are " "identified by the \"t\" suffix in the version-specific directory name, such " "as :file:`lib/python3.13t/`." msgstr "" +"Unix では、:term:`フリースレッド ` の Python インストール" +"は、:file:`lib/python3.13t/` のように、バージョン別ディレクトリ名の接尾辞 " +"\"t\" で識別します。" #: ../../library/site.rst:54 msgid "" @@ -170,7 +172,6 @@ msgstr "" "file:`foo.pth` と :file:`bar.pth` をもつと仮定します。 :file:`foo.pth` には以" "下のものが記載されていると想定してください::" -#: ../../library/site.rst:110 msgid "" "# foo package configuration\n" "\n" @@ -178,17 +179,24 @@ msgid "" "bar\n" "bletch" msgstr "" +"# foo パッケージの設定\n" +"\n" +"foo\n" +"bar\n" +"bletch" #: ../../library/site.rst:116 msgid "and :file:`bar.pth` contains::" msgstr "また、 :file:`bar.pth` には::" -#: ../../library/site.rst:118 msgid "" "# bar package configuration\n" "\n" "bar" msgstr "" +"# bar パッケージの設定\n" +"\n" +"bar" #: ../../library/site.rst:122 msgid "" @@ -198,11 +206,12 @@ msgstr "" "が記載されているとします。そのとき、次のバージョンごとのディレクトリが ``sys." "path`` へこの順番で追加されます::" -#: ../../library/site.rst:125 msgid "" "/usr/local/lib/pythonX.Y/site-packages/bar\n" "/usr/local/lib/pythonX.Y/site-packages/foo" msgstr "" +"/usr/local/lib/pythonX.Y/site-packages/bar\n" +"/usr/local/lib/pythonX.Y/site-packages/foo" #: ../../library/site.rst:128 msgid "" @@ -333,7 +342,6 @@ msgstr "" "はグループIDと実効IDの間のミスマッチ)あるいは管理者によって、ユーザサイトディ" "レクトリが無効になっていることを示しています。" -#: ../../library/site.rst:206 msgid "" "Path to the user site-packages for the running Python. Can be ``None`` if :" "func:`getusersitepackages` hasn't been called yet. Default value is :file:" @@ -344,6 +352,15 @@ msgid "" "build. This directory is a site directory, which means that :file:`.pth` " "files in it will be processed." msgstr "" +"実行中の Python のユーザ site-packages ディレクトリへのパスです。\n" +":func:`getusersitepackages` をまだ呼び出していない場合は ``None`` のこともあ" +"ります。\n" +"デフォルトは、UNIX と非フレームワークの macOS ビルドでは :file:`~/.local/lib/" +"python{X.Y}[t]/site-packages`、macOS のフレームワークビルドでは :file:`~/" +"Library/Python/{X.Y}/lib/python/site-packages`、Windows では :file:" +"`{%APPDATA%}\\\\Python\\\\Python{XY}\\\\site-packages` です。\n" +"省略可能な \"t\" はフリースレッドビルドを示します。\n" +"これはサイトディレクトリなので、内部の :file:`.pth` ファイルは処理されます。" #: ../../library/site.rst:218 msgid "" @@ -424,11 +441,12 @@ msgstr "" ":mod:`site` モジュールはユーザディレクトリをコマンドラインから得る手段も提供" "しています:" -#: ../../library/site.rst:281 msgid "" "$ python -m site --user-site\n" "/home/user/.local/lib/python3.11/site-packages" msgstr "" +"$ python -m site --user-site\n" +"/home/user/.local/lib/python3.11/site-packages" #: ../../library/site.rst:286 msgid "" diff --git a/library/smtpd.po b/library/smtpd.po index 9993eebf5..c4cb160c6 100644 --- a/library/smtpd.po +++ b/library/smtpd.po @@ -12,31 +12,35 @@ msgstr "" "PO-Revision-Date: 2024-11-19 01:03+0000\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" -#: ../../library/smtpd.rst:2 msgid ":mod:`!smtpd` --- SMTP Server" -msgstr "" +msgstr ":mod:`!smtpd` --- SMTP サーバ" -#: ../../library/smtpd.rst:10 msgid "" "This module is no longer part of the Python standard library. It was :ref:" "`removed in Python 3.12 ` after being deprecated in " "Python 3.6. The removal was decided in :pep:`594`." msgstr "" +"このモジュールは Python 標準ライブラリから削除されました。\n" +"Python 3.6 で非推奨となり、:ref:`Python 3.12 で削除 ` さ" +"れました。\n" +"削除は :pep:`594` で決定されました。" -#: ../../library/smtpd.rst:14 msgid "" "A possible replacement is the third-party :pypi:`aiosmtpd` library. This " "library is not maintained or supported by the Python core team." msgstr "" +"代替として、サードパーティの :pypi:`aiosmtpd` ライブラリを検討できます。\n" +"このライブラリは Python コアチームによる保守やサポートの対象ではありません。" -#: ../../library/smtpd.rst:17 msgid "" "The last version of Python that provided the :mod:`!smtpd` module was " "`Python 3.11 `_." msgstr "" +":mod:`!smtpd` モジュールを提供していた最後のバージョンは `Python 3.11 " +"`_ です。" diff --git a/library/smtplib.po b/library/smtplib.po index b90ac0507..83a85509f 100644 --- a/library/smtplib.po +++ b/library/smtplib.po @@ -21,10 +21,10 @@ msgstr "" "Last-Translator: tomo, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/smtplib.rst:2 @@ -48,9 +48,8 @@ msgstr "" "詳細は、 :rfc:`821` (Simple Mail Transfer Protocol) や :rfc:`1869` (SMTP " "Service Extensions)を調べてください。" -#: ../../includes/wasm-notavail.rst:3 msgid "Availability" -msgstr "" +msgstr "利用可能な環境" #: ../../includes/wasm-notavail.rst:5 msgid "" @@ -105,17 +104,16 @@ msgstr "" "普通に使う場合は、初期化と接続を行ってから、 :meth:`sendmail` と :meth:`SMTP." "quit` メソッドを呼びます。使用例は先の方で記載しています。" -#: ../../library/smtplib.rst:48 msgid "" "The :class:`SMTP` class supports the :keyword:`with` statement. When used " "like this, the SMTP ``QUIT`` command is issued automatically when the :" "keyword:`!with` statement exits. E.g.::" msgstr "" -" :class:`SMTP` クラスは :keyword:`with` 構文をサポートしています。このように" -"使用すると、 :keyword:`!with` 構文が終了すると、SMTPの ``QUIT`` コマンドが自" -"動的に発行されます。たとえば、" +":class:`SMTP` クラスは :keyword:`with` 構文をサポートしています。\n" +"このように使用すると、 :keyword:`!with` 構文が終了すると、SMTPの ``QUIT`` コ" +"マンドが自動的に発行されます。\n" +"例えば次のように使います。 ::" -#: ../../library/smtplib.rst:52 msgid "" ">>> from smtplib import SMTP\n" ">>> with SMTP(\"domain.org\") as smtp:\n" @@ -124,24 +122,28 @@ msgid "" "(250, b'Ok')\n" ">>>" msgstr "" +">>> from smtplib import SMTP\n" +">>> with SMTP(\"domain.org\") as smtp:\n" +"... smtp.noop()\n" +"...\n" +"(250, b'Ok')\n" +">>>" -#: ../../library/smtplib.rst:59 ../../library/smtplib.rst:61 msgid "" "All commands will raise an :ref:`auditing event ` ``smtplib.SMTP." "send`` with arguments ``self`` and ``data``, where ``data`` is the bytes " "about to be sent to the remote host." msgstr "" "全てのコマンドは引数 ``self`` と ``data`` を指定して :ref:`auditing event " -"` ``smtplib.SMTP.send`` を送出します。ここで ``data`` はリモートホ" -"ストに送信されるバイト数です。" +"` ``smtplib.SMTP.send`` を送出します。\n" +"ここで ``data`` はリモートホストに送信されるバイト列です。" #: ../../library/smtplib.rst:65 msgid "Support for the :keyword:`with` statement was added." msgstr ":keyword:`with` 構文のサポートが追加されました。" -#: ../../library/smtplib.rst:68 msgid "*source_address* argument was added." -msgstr "" +msgstr "*source_address* 引数が追加されました。" #: ../../library/smtplib.rst:71 msgid "The SMTPUTF8 extension (:rfc:`6531`) is now supported." @@ -181,18 +183,15 @@ msgstr "" msgid "*context* was added." msgstr "*context* が追加されました。" -#: ../../library/smtplib.rst:95 msgid "The *source_address* argument was added." -msgstr "" +msgstr "*source_address* 引数が追加されました。" -#: ../../library/smtplib.rst:98 msgid "" "The class now supports hostname check with :attr:`ssl.SSLContext." "check_hostname` and *Server Name Indication* (see :const:`ssl.HAS_SNI`)." msgstr "" -"このクラスは :attr:`ssl.SSLContext.check_hostname` と *Server Name " -"Indication* でホスト名のチェックをサポートしました。(:const:`ssl.HAS_SNI` を" -"参照してください)。" +"このクラスは :attr:`ssl.SSLContext.check_hostname` によるホスト名の検証と、" +"*Server Name Indication* に対応しました (:const:`ssl.HAS_SNI` を参照)。" #: ../../library/smtplib.rst:103 msgid "" @@ -216,15 +215,15 @@ msgid "" "must use an absolute path for *host*, starting with a '/'." msgstr "" -#: ../../library/smtplib.rst:120 msgid "" "Authentication is supported, using the regular SMTP mechanism. When using a " "Unix socket, LMTP generally don't support or require any authentication, but " "your mileage might vary." msgstr "" -"認証は、通常のSMTP機構を利用してサポートされています。 Unixソケットを利用する" -"場合、LMTPは通常認証をサポートしたり要求したりはしません。しかし、あなたが必" -"要であれば、利用することができます。" +"認証は、通常のSMTP機構を利用してサポートされています。\n" +"Unixソケットを利用する場合、LMTPは通常認証をサポートしたり要求したりはしませ" +"ん。\n" +"ただし、環境によって異なる場合があります。" #: ../../library/smtplib.rst:124 msgid "The optional *timeout* parameter was added." @@ -246,14 +245,13 @@ msgstr "" msgid "SMTPException became subclass of :exc:`OSError`" msgstr "SMTPException が :exc:`OSError` の派生クラスになりました。" -#: ../../library/smtplib.rst:142 msgid "" "This exception is raised when the server unexpectedly disconnects, or when " "an attempt is made to use the :class:`SMTP` instance before connecting it to " "a server." msgstr "" -"この例外はサーバが突然接続が切断されるか、:class:`SMTP` インスタンスを生成す" -"る前に接続しようとした場合に送出されます。" +"サーバーとの接続が予期せず切断された場合や、サーバーに接続する前に :class:" +"`SMTP` インスタンスを使おうとした場合に送出されます。" #: ../../library/smtplib.rst:149 msgid "" @@ -266,15 +264,14 @@ msgstr "" "コードを返すときに生成されます。エラーコードは :attr:`smtp_code` 属性に格納さ" "れます。また、 :attr:`smtp_error` 属性にはエラーメッセージが格納されます。" -#: ../../library/smtplib.rst:157 msgid "" "Sender address refused. In addition to the attributes set by on all :exc:" "`SMTPResponseException` exceptions, this sets 'sender' to the string that " "the SMTP server refused." msgstr "" -"送信者のアドレスが弾かれたときに送出される例外です。全ての :exc:" -"`SMTPResponseException` 例外に、 SMTPサーバが弾いた 'sender' アドレスの文字列" -"がセットされます。" +"送信者のアドレスが拒否されたときに送出されます。\n" +":exc:`SMTPResponseException` に共通する属性に加え、``sender`` 属性に SMTP " +"サーバーが拒否したアドレスの文字列が設定されます。" #: ../../library/smtplib.rst:164 msgid "" @@ -361,15 +358,12 @@ msgstr "" msgid "Added debuglevel 2." msgstr "デバッグレベル2が追加されました。" -#: ../../library/smtplib.rst:229 msgid "" "Send a command *cmd* to the server. The optional argument *args* is simply " "concatenated to the command, separated by a space." msgstr "" -"サーバへコマンド *cmd* を送信します。オプション引数 *args* はスペース文字でコ" -"マンドに連結します。戻り値は、整数値のレスポンスコードと、サーバからの応答の" -"値をタプルで返します (サーバからの応答が数行に渡る場合でも一つの大きな文字列" -"で返します)。" +"サーバにコマンド *cmd* を送信します。\n" +"省略可能な *args* 引数は、スペースで区切ってコマンドに単純に連結します。" #: ../../library/smtplib.rst:232 msgid "" @@ -396,7 +390,6 @@ msgstr "" "応答待ちのときにサーバへの接続が切れると :exc:`SMTPServerDisconnected` が送出" "されます。" -#: ../../library/smtplib.rst:245 msgid "" "Connect to a host on a given port. The defaults are to connect to the local " "host at the standard SMTP port (25). If the hostname ends with a colon " @@ -406,31 +399,33 @@ msgid "" "Returns a 2-tuple of the response code and message sent by the server in its " "connection response." msgstr "" -"ホスト名とポート番号をもとに接続します。デフォルトはlocalhostの標準的なSMTP" -"ポート(25番)に接続します。もしホスト名の末尾がコロン(``':'``)で、後に番号がつ" -"いている場合は、「ホスト名:ポート番号」として扱われます。このメソッドはコンス" -"トラクタにホスト名及びポート番号が指定されている場合、自動的に呼び出されま" -"す。戻り値は、この接続の応答内でサーバによって送信された応答コードとメッセー" -"ジの2要素タプルです。" +"ホスト名とポート番号をもとに接続します。\n" +"デフォルトはlocalhostの標準的なSMTPポート(25番)に接続します。\n" +"もしホスト名の末尾がコロン(``':'``)で、後に番号がついている場合は、「ホスト" +"名:ポート番号」として扱われます。\n" +"このメソッドはコンストラクタにホスト名が指定されている場合、自動的に呼び出さ" +"れます。\n" +"戻り値は、この接続の応答内でサーバによって送信された応答コードとメッセージの2" +"要素タプルです。" -#: ../../library/smtplib.rst:253 msgid "" "Raises an :ref:`auditing event ` ``smtplib.connect`` with " "arguments ``self``, ``host``, ``port``." msgstr "" "引数 ``self``, ``host``, ``port`` を指定して :ref:`監査イベント ` " -"``smtplib.connect`` を送出します。 " +"``smtplib.connect`` を送出します。" -#: ../../library/smtplib.rst:258 msgid "" "Identify yourself to the SMTP server using ``HELO``. The hostname argument " "defaults to the fully qualified domain name of the local host. The message " "returned by the server is stored as the :attr:`helo_resp` attribute of the " "object." msgstr "" -"SMTPサーバに ``HELO`` コマンドで身元を示します。デフォルトではhostname引数は" -"ローカルホストを指します。サーバーが返したメッセージは、オブジェクトの :attr:" -"`helo_resp` 属性に格納されます。" +"SMTPサーバに ``HELO`` コマンドで身元を示します。\n" +"ホスト名を指定する引数のデフォルトは、ローカルホストの完全修飾ドメイン名で" +"す。\n" +"サーバーが返したメッセージは、オブジェクトの :attr:`helo_resp` 属性に格納され" +"ます。" #: ../../library/smtplib.rst:263 msgid "" @@ -509,13 +504,11 @@ msgstr "" "合はコード250と完全な :rfc:`822` アドレス (人名を含む) のタプルを返します。そ" "れ以外の場合は、400以上のエラーコードとエラー文字列を返します。" -#: ../../library/smtplib.rst:307 msgid "Many sites disable SMTP ``VRFY`` in order to foil spammers." msgstr "" -"ほとんどのサイトはスパマーの裏をかくためにSMTPの ``VRFY`` は使用不可になって" +"スパマーによる悪用を防ぐため、多くのサイトでは SMTP の ``VRFY`` を無効にして" "います。" -#: ../../library/smtplib.rst:312 msgid "" "Log in on an SMTP server that requires authentication. The arguments are the " "username and the password to authenticate with. If there has been no " @@ -523,11 +516,12 @@ msgid "" "``EHLO`` first. This method will return normally if the authentication was " "successful, or may raise the following exceptions:" msgstr "" -"認証が必要なSMTPサーバにログインします。認証に使用する引数はユーザ名とパス" -"ワードです。まだセッションが無い場合は、 ``EHLO`` または ``HELO`` コマンドで" -"セッションを作ります。ESMTPの場合は ``EHLO`` が先に試されます。認証が成功した" -"場合は通常このメソッドは戻りますが、例外が起こった場合は以下の例外が上がりま" -"す:" +"認証が必要な SMTP サーバにログインします。\n" +"引数は認証に使用するユーザ名とパスワードです。\n" +"このセッションでまだ ``EHLO`` または ``HELO`` コマンドを送信していない場合" +"は、まず ESMTP の ``EHLO`` を試みます。\n" +"認証に成功するとこのメソッドは正常に戻りますが、次の例外を送出する場合があり" +"ます:" #: ../../library/smtplib.rst:321 msgid ":exc:`SMTPAuthenticationError`" @@ -581,29 +575,31 @@ msgstr "" ":exc:`SMTPNotSupportedError` が送出される場合があります。" "*initial_response_ok* 引数が追加されました。" -#: ../../library/smtplib.rst:347 msgid "" "Issue an ``SMTP`` ``AUTH`` command for the specified authentication " "*mechanism*, and handle the challenge response via *authobject*." msgstr "" +"指定した認証方式 *mechanism* で ``SMTP`` の ``AUTH`` コマンドを発行し、" +"*authobject* を通してチャレンジレスポンスを処理します。" -#: ../../library/smtplib.rst:350 msgid "" "*mechanism* specifies which authentication mechanism is to be used as " "argument to the ``AUTH`` command; the valid values are those listed in the " "``auth`` element of :attr:`esmtp_features`." msgstr "" +"*mechanism* は、``AUTH`` コマンドの引数として指定する認証方式です。\n" +"有効な値は :attr:`esmtp_features` の ``auth`` 要素に列挙されているものです。" -#: ../../library/smtplib.rst:354 msgid "" "*authobject* must be a callable object taking an optional single argument::" msgstr "" +"*authobject* は、省略可能な引数を一つ取る呼び出し可能オブジェクトでなければな" +"りません。 ::" #: ../../library/smtplib.rst:356 msgid "data = authobject(challenge=None)" msgstr "data = authobject(challenge=None)" -#: ../../library/smtplib.rst:358 msgid "" "If optional keyword argument *initial_response_ok* is true, ``authobject()`` " "will be called first with no argument. It can return the :rfc:`4954` " @@ -613,8 +609,17 @@ msgid "" "``None`` when called with ``challenge=None``. If *initial_response_ok* is " "false, then ``authobject()`` will not be called first with ``None``." msgstr "" +"省略可能なキーワード引数 *initial_response_ok* が真の場合、まず引数なしで " +"``authobject()`` を呼び出します。\n" +"この呼び出しでは、:rfc:`4954` の「初期応答」を ASCII の ``str`` で返せま" +"す。\n" +"その文字列は、下記のようにエンコードして ``AUTH`` コマンドとともに送信しま" +"す。\n" +"``authobject()`` が初期応答に対応しない場合 (例えばチャレンジが必要な場合) " +"は、``challenge=None`` で呼び出されたときに ``None`` を返してください。\n" +"*initial_response_ok* が偽の場合、最初に ``None`` を指定して " +"``authobject()`` を呼び出すことはありません。" -#: ../../library/smtplib.rst:366 msgid "" "If the initial response check returns ``None``, or if *initial_response_ok* " "is false, ``authobject()`` will be called to process the server's challenge " @@ -622,8 +627,13 @@ msgid "" "should return ASCII ``str`` *data* that will be base64 encoded and sent to " "the server." msgstr "" +"初期応答の確認で ``None`` が返った場合、または *initial_response_ok* が偽の場" +"合は、サーバのチャレンジレスポンスを処理するために ``authobject()`` を呼び出" +"します。\n" +"渡される *challenge* 引数は ``bytes`` です。\n" +"ASCII の ``str`` で *data* を返す必要があり、その値を base64 でエンコードして" +"サーバに送信します。" -#: ../../library/smtplib.rst:372 msgid "" "The ``SMTP`` class provides ``authobjects`` for the ``CRAM-MD5``, ``PLAIN``, " "and ``LOGIN`` mechanisms; they are named ``SMTP.auth_cram_md5``, ``SMTP." @@ -631,6 +641,11 @@ msgid "" "the ``user`` and ``password`` properties of the ``SMTP`` instance are set to " "appropriate values." msgstr "" +"``SMTP`` クラスは、``CRAM-MD5``、``PLAIN``、``LOGIN`` の各方式に対応する " +"``authobjects`` として、それぞれ ``SMTP.auth_cram_md5``、``SMTP." +"auth_plain``、``SMTP.auth_login`` を提供します。\n" +"いずれも、``SMTP`` インスタンスの ``user`` と ``password`` プロパティに適切な" +"値を設定しておく必要があります。" #: ../../library/smtplib.rst:378 msgid "" @@ -641,14 +656,14 @@ msgid "" "by :mod:`smtplib`." msgstr "" -#: ../../library/smtplib.rst:389 msgid "" "Put the SMTP connection in TLS (Transport Layer Security) mode. All SMTP " "commands that follow will be encrypted. You should then call :meth:`ehlo` " "again." msgstr "" -"TLS (Transport Layer Security) モードで SMTP 接続します。続く全てのSMTP コマ" -"ンドは暗号化されます。その後、もう一度 :meth:`ehlo` を呼んでください。" +"SMTP 接続を TLS (Transport Layer Security) モードに切り替えます。\n" +"続く全てのSMTP コマンドは暗号化されます。\n" +"その後、もう一度 :meth:`ehlo` を呼んでください。" #: ../../library/smtplib.rst:393 msgid "" @@ -689,11 +704,12 @@ msgid "" "check_hostname` and *Server Name Indicator* (see :const:`~ssl.HAS_SNI`)." msgstr "" -#: ../../library/smtplib.rst:423 msgid "" "The error raised for lack of STARTTLS support is now the :exc:" "`SMTPNotSupportedError` subclass instead of the base :exc:`SMTPException`." msgstr "" +"STARTTLS に対応していない場合の例外は、基底の :exc:`SMTPException` ではなく、" +"そのサブクラスの :exc:`SMTPNotSupportedError` になりました。" #: ../../library/smtplib.rst:431 msgid "" @@ -716,24 +732,26 @@ msgstr "" "ば、メッセージを送るために :meth:`mail` 、 :meth:`rcpt` 、 :meth:`data` と" "いった下位レベルのメソッドを使う必要があります。)" -#: ../../library/smtplib.rst:442 msgid "" "The *from_addr* and *to_addrs* parameters are used to construct the message " "envelope used by the transport agents. ``sendmail`` does not modify the " "message headers in any way." msgstr "" -"配送エージェントは *from_addr*、*to_addrs* 引数を使い、メッセージのエンベロー" -"プを構成します。``sendmail`` はメッセージヘッダを修正しません。" +"*from_addr* と *to_addrs* 引数は、配送エージェントが使うメッセージエンベロー" +"プの作成に使われます。\n" +"``sendmail`` はメッセージヘッダーを一切変更しません。" -#: ../../library/smtplib.rst:446 msgid "" "*msg* may be a string containing characters in the ASCII range, or a byte " "string. A string is encoded to bytes using the ascii codec, and lone " "``\\r`` and ``\\n`` characters are converted to ``\\r\\n`` characters. A " "byte string is not modified." msgstr "" +"*msg* には、ASCII 範囲の文字からなる文字列、またはバイト列を指定できます。\n" +"文字列は ascii コーデックでバイト列にエンコードし、単独の ``\\r`` と ``\\n`` " +"を ``\\r\\n`` に変換します。\n" +"バイト列は変更しません。" -#: ../../library/smtplib.rst:451 msgid "" "If there has been no previous ``EHLO`` or ``HELO`` command this session, " "this method tries ESMTP ``EHLO`` first. If the server does ESMTP, message " @@ -741,13 +759,12 @@ msgid "" "is in the feature set the server advertises). If ``EHLO`` fails, ``HELO`` " "will be tried and ESMTP options suppressed." msgstr "" -"まだセッションが無い場合は、 ``EHLO`` または ``HELO`` コマンドでセッションを" -"作ります。ESMTPの場合は ``EHLO`` が先に試されます。また、サーバがESMTP対応な" -"らば、メッセージサイズとそれぞれ指定されたオプションも渡します。(featureオプ" -"ションがあればサーバの広告をセットします) ``EHLO`` が失敗した場合は、ESMTPオ" -"プションの無い ``HELO`` が試されます。" +"このセッションでまだ ``EHLO`` または ``HELO`` コマンドを送っていない場合、ま" +"ず ESMTP の ``EHLO`` を試みます。\n" +"サーバーが ESMTP に対応していれば、メッセージサイズと、指定された各オプション" +"のうちサーバーが対応を通知したものを渡します。\n" +"``EHLO`` が失敗すると ``HELO`` を試み、ESMTP オプションは渡しません。" -#: ../../library/smtplib.rst:457 msgid "" "This method will return normally if the mail is accepted for at least one " "recipient. Otherwise it will raise an exception. That is, if this method " @@ -756,11 +773,14 @@ msgid "" "for each recipient that was refused. Each entry contains a tuple of the " "SMTP error code and the accompanying error message sent by the server." msgstr "" -"このメソッドは最低でも1人の受信者にメールが受け取られたときは正常に戻ります。" -"そうでない場合は例外を投げます。つまり、このメソッドが例外を送出しないときは" -"誰かが送信したメールを受け取ったはずです。また、例外を送出しない場合は拒絶さ" -"れた受信者ごとに項目のある辞書を返します。各項目はサーバーが送ったSMTPエラー" -"コードと付随するエラーメッセージのタプルを持ちます。" +"このメソッドは少なくとも 1 人の受信者宛てのメールが受理されたときは正常に戻り" +"ます。\n" +"そうでない場合は例外を投げます。\n" +"つまり、このメソッドが例外を送出しないときは誰かにはメールが届くはずです。\n" +"また、例外を送出しない場合は拒絶された受信者ごとに項目のある辞書を返しま" +"す。\n" +"各項目はサーバーが送ったSMTPエラーコードと付随するエラーメッセージのタプルを" +"持ちます。" #: ../../library/smtplib.rst:464 msgid "" @@ -815,13 +835,12 @@ msgstr "" "*mail_options* に ``SMTPUTF8`` が与えられましたが、サーバがサポートしていませ" "ん。" -#: ../../library/smtplib.rst:489 msgid "" "Unless otherwise noted, the connection will be open even after an exception " "is raised." msgstr "" -"また、この他の注意として、例外が上がった後もコネクションは開いたままになって" -"います。" +"特に記載がない限り、例外が送出された後もコネクションは開いたままになっていま" +"す。" #: ../../library/smtplib.rst:492 msgid "*msg* may be a byte string." @@ -835,15 +854,17 @@ msgstr "" "``SMTPUTF8`` のサポートが追加されました。``SMTPUTF8`` が与えられたが、サーバ" "がサポートしていない場合は :exc:`SMTPNotSupportedError` が送出されます。" -#: ../../library/smtplib.rst:503 msgid "" "This is a convenience method for calling :meth:`sendmail` with the message " "represented by an :class:`email.message.Message` object. The arguments have " "the same meaning as for :meth:`sendmail`, except that *msg* is a ``Message`` " "object." msgstr "" +":class:`email.message.Message` オブジェクトで表されたメッセージを使って :" +"meth:`sendmail` を呼び出すための便利なメソッドです。\n" +"引数の意味は :meth:`sendmail` と同じですが、*msg* は ``Message`` オブジェクト" +"です。" -#: ../../library/smtplib.rst:508 msgid "" "If *from_addr* is ``None`` or *to_addrs* is ``None``, ``send_message`` fills " "those arguments with addresses extracted from the headers of *msg* as " @@ -857,6 +878,18 @@ msgid "" "`ValueError` is raised, since there is no way to unambiguously detect the " "most recent set of :mailheader:`Resent-` headers." msgstr "" +"*from_addr* または *to_addrs* が ``None`` の場合、``send_message`` は :rfc:" +"`5322` に従って *msg* のヘッダーからアドレスを取り出し、その引数を補いま" +"す。\n" +"*from_addr* は、:mailheader:`Sender` フィールドがあればその値、なければ :" +"mailheader:`From` フィールドの値になります。\n" +"*to_addrs* は、*msg* にある :mailheader:`To`、:mailheader:`Cc`、:mailheader:" +"`Bcc` フィールドの値をまとめたものになります。\n" +"メッセージに :mailheader:`Resent-*` ヘッダーの組がちょうど一つあれば、通常の" +"ヘッダーを無視して :mailheader:`Resent-*` ヘッダーを使います。\n" +":mailheader:`Resent-*` ヘッダーの組が複数ある場合、どの :mailheader:`Resent-" +"` ヘッダーの組が最新かを一意に特定できないため、:exc:`ValueError` を送出しま" +"す。" #: ../../library/smtplib.rst:520 msgid "" @@ -911,7 +944,6 @@ msgid "" "headers explicitly::" msgstr "" -#: ../../library/smtplib.rst:561 msgid "" "import smtplib\n" "\n" @@ -940,6 +972,32 @@ msgid "" "server.sendmail(from_addr, to_addrs, msg)\n" "server.quit()" msgstr "" +"import smtplib\n" +"\n" +"def prompt(title):\n" +" return input(title).strip()\n" +"\n" +"from_addr = prompt(\"From: \")\n" +"to_addrs = prompt(\"To: \").split()\n" +"print(\"Enter message, end with ^D (Unix) or ^Z (Windows):\")\n" +"\n" +"# 最初に From: と To: ヘッダーを追加します。\n" +"lines = [f\"From: {from_addr}\", f\"To: {', '.join(to_addrs)}\", \"\"]\n" +"while True:\n" +" try:\n" +" line = input()\n" +" except EOFError:\n" +" break\n" +" else:\n" +" lines.append(line)\n" +"\n" +"msg = \"\\r\\n\".join(lines)\n" +"print(\"Message length is\", len(msg))\n" +"\n" +"server = smtplib.SMTP(\"localhost\")\n" +"server.set_debuglevel(1)\n" +"server.sendmail(from_addr, to_addrs, msg)\n" +"server.quit()" #: ../../library/smtplib.rst:590 msgid "" @@ -951,14 +1009,12 @@ msgstr "" "それを、 :meth:`~smtplib.SMTP.send_message` で送信する、という手順を用いま" "す。 :ref:`email-examples` を参照してください。" -#: ../../library/smtplib.rst:11 msgid "SMTP" -msgstr "" +msgstr "SMTP" #: ../../library/smtplib.rst:11 msgid "protocol" msgstr "プロトコル" -#: ../../library/smtplib.rst:11 msgid "Simple Mail Transfer Protocol" -msgstr "" +msgstr "Simple Mail Transfer Protocol" diff --git a/library/sndhdr.po b/library/sndhdr.po index 1006949d9..af2510f94 100644 --- a/library/sndhdr.po +++ b/library/sndhdr.po @@ -12,15 +12,14 @@ msgstr "" "PO-Revision-Date: 2024-11-19 01:03+0000\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" -#: ../../library/sndhdr.rst:2 msgid ":mod:`!sndhdr` --- Determine type of sound file" -msgstr "" +msgstr ":mod:`!sndhdr` --- 音声ファイルの種類を判定する" #: ../../library/sndhdr.rst:10 msgid "" @@ -28,16 +27,22 @@ msgid "" "`removed in Python 3.13 ` after being deprecated in " "Python 3.11. The removal was decided in :pep:`594`." msgstr "" +"このモジュールは今や Python 標準ライブラリの一部ではありません。このモジュー" +"ルは Python 3.11 で非推奨となったあと、:ref:`Python 3.13 で削除` されました。削除の決定は :pep:`594` でなされました。" -#: ../../library/sndhdr.rst:14 msgid "" "Possible replacements are third-party modules from PyPI: :pypi:`filetype`, :" "pypi:`puremagic`, or :pypi:`python-magic`. These are not supported or " "maintained by the Python core team." msgstr "" +"代替として、PyPI のサードパーティモジュール :pypi:`filetype`、:pypi:" +"`puremagic`、:pypi:`python-magic` を検討できます。\n" +"これらは Python コアチームによるサポートや保守の対象ではありません。" -#: ../../library/sndhdr.rst:18 msgid "" "The last version of Python that provided the :mod:`!sndhdr` module was " "`Python 3.12 `_." msgstr "" +":mod:`!sndhdr` モジュールを提供していた最後のバージョンは `Python 3.12 " +"`_ です。" diff --git a/library/socket.po b/library/socket.po index b129f6a9c..418e75c77 100644 --- a/library/socket.po +++ b/library/socket.po @@ -20,10 +20,10 @@ msgstr "" "Last-Translator: Arihiro TAKASE, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/socket.rst:2 @@ -52,40 +52,8 @@ msgstr "" "いくつかの挙動はプラットフォームに依存します。オペレーティングシステムのソ" "ケットAPIを呼び出しているためです。" -#: ../../library/socket.rst:196 ../../library/socket.rst:206 -#: ../../library/socket.rst:234 ../../library/socket.rst:241 -#: ../../library/socket.rst:258 ../../library/socket.rst:408 -#: ../../library/socket.rst:494 ../../library/socket.rst:511 -#: ../../library/socket.rst:526 ../../library/socket.rst:537 -#: ../../library/socket.rst:546 ../../library/socket.rst:555 -#: ../../library/socket.rst:566 ../../library/socket.rst:578 -#: ../../library/socket.rst:589 ../../library/socket.rst:602 -#: ../../library/socket.rst:630 ../../library/socket.rst:642 -#: ../../library/socket.rst:648 ../../library/socket.rst:680 -#: ../../library/socket.rst:733 ../../library/socket.rst:745 -#: ../../library/socket.rst:754 ../../library/socket.rst:769 -#: ../../library/socket.rst:778 ../../library/socket.rst:786 -#: ../../library/socket.rst:803 ../../library/socket.rst:818 -#: ../../library/socket.rst:828 ../../library/socket.rst:1017 -#: ../../library/socket.rst:1142 ../../library/socket.rst:1158 -#: ../../library/socket.rst:1171 ../../library/socket.rst:1186 -#: ../../library/socket.rst:1203 ../../library/socket.rst:1214 -#: ../../library/socket.rst:1225 ../../library/socket.rst:1236 -#: ../../library/socket.rst:1325 ../../library/socket.rst:1345 -#: ../../library/socket.rst:1371 ../../library/socket.rst:1394 -#: ../../library/socket.rst:1423 ../../library/socket.rst:1434 -#: ../../library/socket.rst:1461 ../../library/socket.rst:1478 -#: ../../library/socket.rst:1495 ../../library/socket.rst:1509 -#: ../../library/socket.rst:1560 ../../library/socket.rst:1607 -#: ../../library/socket.rst:1621 ../../library/socket.rst:1641 -#: ../../library/socket.rst:1688 ../../library/socket.rst:1721 -#: ../../library/socket.rst:1734 ../../library/socket.rst:1859 -#: ../../library/socket.rst:1903 ../../library/socket.rst:2011 -#: ../../library/socket.rst:2029 ../../library/socket.rst:2113 -#: ../../library/socket.rst:2123 ../../library/socket.rst:2135 -#: ../../includes/wasm-notavail.rst:3 msgid "Availability" -msgstr "" +msgstr "利用可能な環境" #: ../../includes/wasm-notavail.rst:5 msgid "" @@ -184,17 +152,17 @@ msgid "Writable :term:`bytes-like object` is now accepted." msgstr "" "書き込み可能な :term:`bytes-like object` を使用できるようになりました。" -#: ../../library/socket.rst:71 msgid "" "A pair ``(host, port)`` is used for the :const:`AF_INET` address family, " "where *host* is a string representing either a hostname in internet domain " "notation like ``'daring.cwi.nl'`` or an IPv4 address like " "``'100.50.200.5'``, and *port* is an integer." msgstr "" -":const:`AF_INET` アドレスファミリーには、 ``(host, port)`` ペアがアドレスとし" -"て利用されます。 *host* はホスト名か ``'daring.cwi.nl'`` のようなインターネッ" -"トドメインか、 ``'100.50.200.5'`` のような IPv4 アドレスで、 *port* は整数で" -"す。" +":const:`AF_INET` アドレスファミリーには、``(host, port)`` のペアを使いま" +"す。\n" +"*host* は、``'daring.cwi.nl'`` のようなインターネットのドメイン表記のホスト" +"名、または ``'100.50.200.5'`` のような IPv4 アドレスを表す文字列です。\n" +"*port* は整数です。" #: ../../library/socket.rst:76 msgid "" @@ -229,12 +197,14 @@ msgstr "" "し、 *scope_id* を省略すると scope された IPv6 アドレスを操作するときに問題が" "起こる場合があることに注意してください。" -#: ../../library/socket.rst:90 msgid "" "For multicast addresses (with *scope_id* meaningful) *address* may not " "contain ``%scope_id`` (or ``zone id``) part. This information is superfluous " "and may be safely omitted (recommended)." msgstr "" +"マルチキャストアドレス (*scope_id* に意味がある場合) では、*address* に " +"``%scope_id`` (または ``zone id``) の部分を含めなくても構いません。\n" +"この情報は冗長なので、安全に省略できます (省略を推奨します)。" #: ../../library/socket.rst:95 msgid ":const:`AF_NETLINK` sockets are represented as pairs ``(pid, groups)``." @@ -280,14 +250,12 @@ msgstr "" "*addr_type* が :const:`TIPC_ADDR_NAME` の場合、 *v1* はサーバータイプ、 *v2* " "はポートID (the port identifier)、そして *v3* は 0 であるべきです。" -#: ../../library/socket.rst:110 msgid "" "If *addr_type* is :const:`TIPC_ADDR_NAMESEQ`, then *v1* is the server type, " "*v2* is the lower port number, and *v3* is the upper port number." msgstr "" "*addr_type* が :const:`TIPC_ADDR_NAMESEQ` の場合、 *v1* はサーバータイプ、 " -"*v2* はポート番号下位(lower port number)、 *v3* はポート番号上位(upper port " -"number) です。" +"*v2* はポート番号の下限、 *v3* はポート番号の上限 です。" #: ../../library/socket.rst:113 msgid "" @@ -345,36 +313,37 @@ msgstr "" ":const:`AF_BLUETOOTH` は以下のプロトコルとアドレスフォーマットをサポートして" "います。" -#: ../../library/socket.rst:140 msgid "" ":const:`BTPROTO_L2CAP` accepts a tuple ``(bdaddr, psm[, cid[, " "bdaddr_type]])`` where:" msgstr "" +":const:`BTPROTO_L2CAP` はタプル ``(bdaddr, psm[, cid[, bdaddr_type]])`` を受" +"け取り、各要素は次の意味です。" -#: ../../library/socket.rst:143 msgid "``bdaddr`` is a string specifying the Bluetooth address." -msgstr "" +msgstr "``bdaddr`` は Bluetooth アドレスを指定する文字列です。" -#: ../../library/socket.rst:144 msgid "``psm`` is an integer specifying the Protocol/Service Multiplexer." -msgstr "" +msgstr "``psm`` は Protocol/Service Multiplexer を指定する整数です。" -#: ../../library/socket.rst:145 msgid "" "``cid`` is an optional integer specifying the Channel Identifier. If not " "given, defaults to zero." msgstr "" +"``cid`` は Channel Identifier を指定する、省略可能な整数です。\n" +"省略した場合はゼロです。" -#: ../../library/socket.rst:147 msgid "" "``bdaddr_type`` is an optional integer specifying the address type; one of :" "const:`BDADDR_BREDR` (default), :const:`BDADDR_LE_PUBLIC`, :const:" "`BDADDR_LE_RANDOM`." msgstr "" +"``bdaddr_type`` はアドレスの種類を指定する、省略可能な整数です。\n" +":const:`BDADDR_BREDR` (デフォルト)、:const:`BDADDR_LE_PUBLIC`、:const:" +"`BDADDR_LE_RANDOM` のいずれかです。" -#: ../../library/socket.rst:151 msgid "Added ``cid`` and ``bdaddr_type`` fields." -msgstr "" +msgstr "``cid`` と ``bdaddr_type`` フィールドが追加されました。" #: ../../library/socket.rst:154 msgid "" @@ -384,43 +353,48 @@ msgstr "" ":const:`BTPROTO_RFCOMM` は ``(bdaddr, channel)`` を受け取ります。\n" "``bdaddr`` は Bluetooth アドレスを表す文字列で、 ``channel`` は整数です。" -#: ../../library/socket.rst:157 msgid ":const:`BTPROTO_HCI` accepts a format that depends on your OS." -msgstr "" +msgstr ":const:`BTPROTO_HCI` が受け取る形式は OS によって異なります。" -#: ../../library/socket.rst:159 msgid "" "On Linux it accepts an integer ``device_id`` or a tuple ``(device_id, " "[channel])`` where ``device_id`` specifies the number of the Bluetooth " "device, and ``channel`` is an optional integer specifying the HCI channel (:" "const:`HCI_CHANNEL_RAW` by default)." msgstr "" +"Linux では、整数 ``device_id`` またはタプル ``(device_id, [channel])`` を受け" +"取ります。\n" +"``device_id`` は Bluetooth デバイスの番号、``channel`` は HCI チャネルを指定" +"する省略可能な整数です (デフォルトは :const:`HCI_CHANNEL_RAW`)。" -#: ../../library/socket.rst:164 msgid "" "On FreeBSD, NetBSD and DragonFly BSD it accepts ``bdaddr`` where ``bdaddr`` " "is the Bluetooth address as a string." msgstr "" +"FreeBSD、NetBSD、DragonFly BSD では、Bluetooth アドレスを表す文字列 " +"``bdaddr`` を受け取ります。" #: ../../library/socket.rst:167 msgid "NetBSD and DragonFlyBSD support added." msgstr "NetBSD と DragonFlyBSD のサポートが追加されました。" -#: ../../library/socket.rst:170 ../../library/socket.rst:181 msgid "FreeBSD support added." -msgstr "" +msgstr "FreeBSD のサポートが追加されました。" -#: ../../library/socket.rst:173 msgid "" "Added ``channel`` field. ``device_id`` not packed in a tuple is now accepted." msgstr "" +"``channel`` フィールドが追加されました。\n" +"タプルに格納されていない ``device_id`` も受け取れるようになりました。" -#: ../../library/socket.rst:177 msgid "" ":const:`BTPROTO_SCO` accepts ``bdaddr`` where ``bdaddr`` is the Bluetooth " "address as a string or a :class:`bytes` object. (ex. ``'12:23:34:45:56:67'`` " "or ``b'12:23:34:45:56:67'``)" msgstr "" +":const:`BTPROTO_SCO` は、Bluetooth アドレスを表す文字列または :class:`bytes` " +"オブジェクト ``bdaddr`` を受け取ります (例えば ``'12:23:34:45:56:67'`` や " +"``b'12:23:34:45:56:67'``)。" #: ../../library/socket.rst:184 msgid "" @@ -457,81 +431,94 @@ msgstr "*feat* と *mask* は、符号を持たない 32 ビットの整数で msgid "Some algorithm types require more recent Kernels." msgstr "一部のアルゴリズムタイプでは、さらに新しいカーネルが必要です。" -#: ../../library/socket.rst:202 msgid "" ":const:`AF_VSOCK` allows communication between virtual machines and their " "hosts. The sockets are represented as a ``(CID, port)`` tuple where the " "context ID or CID and port are integers." msgstr "" +":const:`AF_VSOCK` は、仮想マシンとそのホストとの通信を可能にします。\n" +"ソケットは ``(CID, port)`` タプルで表し、コンテキスト ID (CID) とポートは整数" +"です。" -#: ../../library/socket.rst:208 msgid "See :manpage:`vsock(7)`" -msgstr "" +msgstr ":manpage:`vsock(7)` を参照してください。" -#: ../../library/socket.rst:212 msgid "" ":const:`AF_PACKET` is a low-level interface directly to network devices. The " "addresses are represented by the tuple ``(ifname, proto[, pkttype[, hatype[, " "addr]]])`` where:" msgstr "" +":const:`AF_PACKET` は、ネットワークデバイスへ直接アクセスする低水準インター" +"フェースです。\n" +"アドレスはタプル ``(ifname, proto[, pkttype[, hatype[, addr]]])`` で表し、各" +"要素は次の意味です。" #: ../../library/socket.rst:216 msgid "*ifname* - String specifying the device name." msgstr "*ifname* - デバイス名を指定する文字列。" -#: ../../library/socket.rst:217 msgid "" "*proto* - The Ethernet protocol number. May be :data:`ETH_P_ALL` to capture " "all protocols, one of the :ref:`ETHERTYPE_* constants ` or any other Ethernet protocol number." msgstr "" +"*proto* - Ethernet プロトコル番号です。\n" +"すべてのプロトコルを取得する :data:`ETH_P_ALL`、:ref:`ETHERTYPE_* 定数 " +"` のいずれか、またはその他の Ethernet プロトコル番号を" +"指定できます。" #: ../../library/socket.rst:221 msgid "*pkttype* - Optional integer specifying the packet type:" msgstr "*pkttype* - パケットタイプを指定するオプションの整数:" -#: ../../library/socket.rst:223 msgid "``PACKET_HOST`` (the default) - Packet addressed to the local host." -msgstr "" +msgstr "``PACKET_HOST`` (デフォルト) - ローカルホスト宛てのパケット。" -#: ../../library/socket.rst:224 msgid "``PACKET_BROADCAST`` - Physical-layer broadcast packet." -msgstr "" +msgstr "``PACKET_BROADCAST`` - 物理層のブロードキャストパケット。" -#: ../../library/socket.rst:225 msgid "" "``PACKET_MULTICAST`` - Packet sent to a physical-layer multicast address." msgstr "" +"``PACKET_MULTICAST`` - 物理層のマルチキャストアドレスに送信されたパケット。" -#: ../../library/socket.rst:226 msgid "" "``PACKET_OTHERHOST`` - Packet to some other host that has been caught by a " "device driver in promiscuous mode." msgstr "" +"``PACKET_OTHERHOST`` - プロミスキャスモードのデバイスドライバーが取得した、別" +"のホスト宛てのパケット。" -#: ../../library/socket.rst:228 msgid "" "``PACKET_OUTGOING`` - Packet originating from the local host that is looped " "back to a packet socket." msgstr "" +"``PACKET_OUTGOING`` - ローカルホストから送信され、パケットソケットにループ" +"バックされたパケット。" -#: ../../library/socket.rst:230 msgid "*hatype* - Optional integer specifying the ARP hardware address type." msgstr "" +"*hatype* - ARP ハードウェアアドレスの種類を指定する、省略可能な整数です。" -#: ../../library/socket.rst:231 msgid "" "*addr* - Optional bytes-like object specifying the hardware physical " "address, whose interpretation depends on the device." msgstr "" +"*addr* - ハードウェアの物理アドレスを指定する、省略可能な バイト列類似オブ" +"ジェクトです。\n" +"その解釈はデバイスによって異なります。" -#: ../../library/socket.rst:236 msgid "" ":const:`AF_QIPCRTR` is a Linux-only socket based interface for communicating " "with services running on co-processors in Qualcomm platforms. The address " "family is represented as a ``(node, port)`` tuple where the *node* and " "*port* are non-negative integers." msgstr "" +":const:`AF_QIPCRTR` は、Qualcomm プラットフォームのコプロセッサー上で動作する" +"サービスと通信するための、Linux 限定のソケットベースのインターフェースで" +"す。\n" +"アドレスファミリーは ``(node, port)`` タプルで表し、*node* と *port* は非負の" +"整数です。" #: ../../library/socket.rst:245 msgid "" @@ -544,62 +531,70 @@ msgid "" "of their data. In both cases ``length`` should be in ``range(8, 2**16, 8)``." msgstr "" -#: ../../library/socket.rst:254 msgid "" "Such a socket should be constructed with ``socket(AF_INET, SOCK_DGRAM, " "IPPROTO_UDPLITE)`` for IPv4 or ``socket(AF_INET6, SOCK_DGRAM, " "IPPROTO_UDPLITE)`` for IPv6." msgstr "" +"IPv4 では ``socket(AF_INET, SOCK_DGRAM, IPPROTO_UDPLITE)``、IPv6 では " +"``socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDPLITE)`` で、このソケットを作成しま" +"す。" -#: ../../library/socket.rst:262 msgid "" ":const:`AF_HYPERV` is a Windows-only socket based interface for " "communicating with Hyper-V hosts and guests. The address family is " "represented as a ``(vm_id, service_id)`` tuple where the ``vm_id`` and " "``service_id`` are UUID strings." msgstr "" +":const:`AF_HYPERV` は、Hyper-V のホストとゲストが通信するための、Windows 限定" +"のソケットベースのインターフェースです。\n" +"アドレスファミリーは ``(vm_id, service_id)`` タプルで表し、``vm_id`` と " +"``service_id`` は UUID 文字列です。" -#: ../../library/socket.rst:267 msgid "" "The ``vm_id`` is the virtual machine identifier or a set of known VMID " "values if the target is not a specific virtual machine. Known VMID constants " "defined on ``socket`` are:" msgstr "" +"``vm_id`` は仮想マシンの識別子です。\n" +"対象が特定の仮想マシンでない場合は、あらかじめ定義された VMID 値のいずれかを" +"使います。\n" +"``socket`` で定義されている VMID 定数は次のとおりです。" -#: ../../library/socket.rst:271 msgid "``HV_GUID_ZERO``" -msgstr "" +msgstr "``HV_GUID_ZERO``" -#: ../../library/socket.rst:272 msgid "``HV_GUID_BROADCAST``" -msgstr "" +msgstr "``HV_GUID_BROADCAST``" -#: ../../library/socket.rst:273 msgid "" "``HV_GUID_WILDCARD`` - Used to bind on itself and accept connections from " "all partitions." msgstr "" +"``HV_GUID_WILDCARD`` - 自身にバインドし、すべてのパーティションからの接続を受" +"け付けるために使います。" -#: ../../library/socket.rst:275 msgid "" "``HV_GUID_CHILDREN`` - Used to bind on itself and accept connection from " "child partitions." msgstr "" +"``HV_GUID_CHILDREN`` - 自身にバインドし、子パーティションからの接続を受け付け" +"るために使います。" -#: ../../library/socket.rst:277 msgid "``HV_GUID_LOOPBACK`` - Used as a target to itself." -msgstr "" +msgstr "``HV_GUID_LOOPBACK`` - 自身を接続先として指定するために使います。" -#: ../../library/socket.rst:278 msgid "" "``HV_GUID_PARENT`` - When used as a bind accepts connection from the parent " "partition. When used as an address target it will connect to the parent " "partition." msgstr "" +"``HV_GUID_PARENT`` - バインド先として使うと、親パーティションからの接続を受け" +"付けます。\n" +"接続先アドレスとして使うと、親パーティションへ接続します。" -#: ../../library/socket.rst:281 msgid "The ``service_id`` is the service identifier of the registered service." -msgstr "" +msgstr "``service_id`` は登録されたサービスのサービス識別子です。" #: ../../library/socket.rst:285 msgid "" @@ -678,7 +673,6 @@ msgstr "" msgid "This class was made a subclass of :exc:`OSError`." msgstr "このクラスは :exc:`OSError` のサブクラスになりました。" -#: ../../library/socket.rst:334 msgid "" "A subclass of :exc:`OSError`, this exception is raised for address-related " "errors by :func:`getaddrinfo` and :func:`getnameinfo`. The accompanying " @@ -687,6 +681,13 @@ msgid "" "by the :c:func:`gai_strerror` C function. The numeric *error* value will " "match one of the :const:`!EAI_\\*` constants defined in this module." msgstr "" +":exc:`OSError` のサブクラスで、:func:`getaddrinfo` と :func:`getnameinfo` が" +"アドレス関連のエラーで送出します。\n" +"付随する値は、ライブラリ呼び出しが返したエラーを表す ``(error, string)`` のペ" +"アです。\n" +"*string* は C 関数 :c:func:`gai_strerror` が返す *error* の説明です。\n" +"数値 *error* は、このモジュールで定義された :const:`!EAI_\\*` 定数のいずれか" +"に一致します。" #: ../../library/socket.rst:347 msgid "A deprecated alias of :exc:`TimeoutError`." @@ -722,28 +723,37 @@ msgstr "" "AF_* 定数と SOCK_* 定数は、 :class:`AddressFamily` と :class:`SocketKind` :" "class:`.IntEnum` collection になりました。" -#: ../../library/socket.rst:374 msgid "" "These constants represent the address (and protocol) families, used for the " "first argument to :func:`~socket.socket`. If the :const:`AF_UNIX` constant " "is not defined then this protocol is unsupported. More constants may be " "available depending on the system." msgstr "" +"これらの定数はアドレスファミリー (およびプロトコルファミリー) を表し、:func:" +"`~socket.socket` の最初の引数に使います。\n" +":const:`AF_UNIX` 定数が定義されていない場合、このプロトコルはサポートされてい" +"ません。\n" +"システムによっては、ほかの定数も利用できます。" -#: ../../library/socket.rst:381 msgid "" ":const:`AF_UNSPEC` means that :func:`getaddrinfo` should return socket " "addresses for any address family (either IPv4, IPv6, or any other) that can " "be used." msgstr "" +":const:`AF_UNSPEC` は、利用可能なアドレスファミリー (IPv4、IPv6、その他) を問" +"わず :func:`getaddrinfo` がソケットアドレスを返すことを指定します。" -#: ../../library/socket.rst:391 msgid "" "These constants represent the socket types, used for the second argument to :" "func:`~socket.socket`. More constants may be available depending on the " "system. (Only :const:`SOCK_STREAM` and :const:`SOCK_DGRAM` appear to be " "generally useful.)" msgstr "" +"これらの定数はソケットの種類を表し、:func:`~socket.socket` の 2 番目の引数に" +"使います。\n" +"システムによっては、ほかの定数も利用できます。\n" +"(一般に役立つのは :const:`SOCK_STREAM` と :const:`SOCK_DGRAM` だけのようで" +"す。)" #: ../../library/socket.rst:399 msgid "" @@ -763,7 +773,6 @@ msgstr "" "より完全な説明は `Secure File Descriptor Handling `_ を参照してください。" -#: ../../library/socket.rst:429 msgid "" "Many constants of these forms, documented in the Unix documentation on " "sockets and/or the IP protocol, are also defined in the socket module. They " @@ -772,6 +781,12 @@ msgid "" "symbols that are defined in the Unix header files are defined; for a few " "symbols, default values are provided." msgstr "" +"Unix のソケットや IP プロトコルのドキュメントで説明されている、この形式の定数" +"の多くも socket モジュールで定義されています。\n" +"通常、ソケットオブジェクトの :meth:`~socket.setsockopt` メソッドと :meth:" +"`~socket.getsockopt` メソッドの引数に使います。\n" +"ほとんどの場合、Unix のヘッダーファイルで定義されているシンボルだけが定義され" +"ますが、いくつかのシンボルにはデフォルト値が用意されています。" #: ../../library/socket.rst:436 msgid "" @@ -781,35 +796,39 @@ msgstr "" "``SO_DOMAIN``, ``SO_PROTOCOL``, ``SO_PEERSEC``, ``SO_PASSSEC``, " "``TCP_USER_TIMEOUT``, ``TCP_CONGESTION`` が追加されました。" -#: ../../library/socket.rst:440 msgid "" "Added support for ``TCP_FASTOPEN``, ``TCP_KEEPCNT`` on Windows platforms " "when available." msgstr "" +"Windows プラットフォームで、利用可能な場合に ``TCP_FASTOPEN`` と " +"``TCP_KEEPCNT`` をサポートするようになりました。" #: ../../library/socket.rst:444 msgid "``TCP_NOTSENT_LOWAT`` was added." msgstr "``TCP_NOTSENT_LOWAT`` が追加されました。" -#: ../../library/socket.rst:447 msgid "" "Added support for ``TCP_KEEPIDLE``, ``TCP_KEEPINTVL`` on Windows platforms " "when available." msgstr "" +"Windows プラットフォームで、利用可能な場合に ``TCP_KEEPIDLE`` と " +"``TCP_KEEPINTVL`` をサポートするようになりました。" -#: ../../library/socket.rst:450 msgid "" "``IP_RECVTOS`` was added. Added ``TCP_KEEPALIVE``. On MacOS this constant " "can be used in the same way that ``TCP_KEEPIDLE`` is used on Linux." msgstr "" +"``IP_RECVTOS`` が追加されました。\n" +"``TCP_KEEPALIVE`` が追加されました。\n" +"macOS では、Linux の ``TCP_KEEPIDLE`` と同じようにこの定数を使えます。" -#: ../../library/socket.rst:455 msgid "" "Added ``TCP_CONNECTION_INFO``. On MacOS this constant can be used in the " "same way that ``TCP_INFO`` is used on Linux and BSD." msgstr "" +"``TCP_CONNECTION_INFO`` が追加されました。\n" +"macOS では、Linux や BSD の ``TCP_INFO`` と同じようにこの定数を使えます。" -#: ../../library/socket.rst:459 msgid "" "Added ``SO_RTABLE`` and ``SO_USER_COOKIE``. On OpenBSD and FreeBSD " "respectively those constants can be used in the same way that ``SO_MARK`` is " @@ -824,23 +843,40 @@ msgid "" "``IP_BLOCK_SOURCE``, ``IP_ADD_SOURCE_MEMBERSHIP``, " "``IP_DROP_SOURCE_MEMBERSHIP``." msgstr "" +"``SO_RTABLE`` と ``SO_USER_COOKIE`` が追加されました。\n" +"それぞれ OpenBSD と FreeBSD で、Linux の ``SO_MARK`` と同じように使えます。\n" +"また、欠けていた Linux の TCP ソケットオプションが追加されました: " +"``TCP_MD5SIG``、``TCP_THIN_LINEAR_TIMEOUTS``、``TCP_THIN_DUPACK``、" +"``TCP_REPAIR``、``TCP_REPAIR_QUEUE``、``TCP_QUEUE_SEQ``、" +"``TCP_REPAIR_OPTIONS``、``TCP_TIMESTAMP``、``TCP_CC_INFO``、" +"``TCP_SAVE_SYN``、``TCP_SAVED_SYN``、``TCP_REPAIR_WINDOW``、" +"``TCP_FASTOPEN_CONNECT``、``TCP_ULP``、``TCP_MD5SIG_EXT``、" +"``TCP_FASTOPEN_KEY``、``TCP_FASTOPEN_NO_COOKIE``、``TCP_ZEROCOPY_RECEIVE``、" +"``TCP_INQ``、``TCP_TX_DELAY``。\n" +"``IP_PKTINFO``、``IP_UNBLOCK_SOURCE``、``IP_BLOCK_SOURCE``、" +"``IP_ADD_SOURCE_MEMBERSHIP``、``IP_DROP_SOURCE_MEMBERSHIP`` が追加されまし" +"た。" -#: ../../library/socket.rst:473 msgid "" "Added ``SO_BINDTOIFINDEX``. On Linux this constant can be used in the same " "way that ``SO_BINDTODEVICE`` is used, but with the index of a network " "interface instead of its name." msgstr "" +"``SO_BINDTOIFINDEX`` が追加されました。\n" +"Linux では ``SO_BINDTODEVICE`` と同じように使えますが、ネットワークインター" +"フェースの名前の代わりにインデックスを指定します。" -#: ../../library/socket.rst:478 msgid "" "Added missing ``IP_FREEBIND``, ``IP_RECVERR``, ``IPV6_RECVERR``, " "``IP_RECVTTL``, and ``IP_RECVORIGDSTADDR`` on Linux." msgstr "" +"Linux で欠けていた ``IP_FREEBIND``、``IP_RECVERR``、``IPV6_RECVERR``、" +"``IP_RECVTTL``、``IP_RECVORIGDSTADDR`` が追加されました。" -#: ../../library/socket.rst:482 msgid "Added support for ``TCP_QUICKACK`` on Windows platforms when available." msgstr "" +"Windows プラットフォームで、利用可能な場合に ``TCP_QUICKACK`` をサポートする" +"ようになりました。" #: ../../library/socket.rst:491 ../../library/socket.rst:575 #: ../../library/socket.rst:599 @@ -855,9 +891,8 @@ msgstr "" msgid "NetBSD support was added." msgstr "NetBSD サポートが追加されました。" -#: ../../library/socket.rst:501 msgid "Restored missing ``CAN_RAW_ERR_FILTER`` on Linux." -msgstr "" +msgstr "Linux で欠けていた ``CAN_RAW_ERR_FILTER`` が復元されました。" #: ../../library/socket.rst:507 msgid "" @@ -869,10 +904,10 @@ msgstr "" "ルです。Linuxドキュメントにあるこの形式の定数は、socketモジュールでも定義され" "ています。" -#: ../../library/socket.rst:514 msgid "" "The :data:`CAN_BCM_CAN_FD_FRAME` flag is only available on Linux >= 4.8." msgstr "" +":data:`CAN_BCM_CAN_FD_FRAME` フラグは Linux 4.8 以降でのみ利用できます。" #: ../../library/socket.rst:520 msgid "" @@ -889,40 +924,46 @@ msgstr "" msgid "This constant is documented in the Linux documentation." msgstr "この定数は、 Linux のドキュメンテーションで説明されています。" -#: ../../library/socket.rst:532 msgid "" "Joins the applied CAN filters such that only CAN frames that match all given " "CAN filters are passed to user space." msgstr "" +"適用される CAN フィルターを結合し、指定されたすべての CAN フィルターに一致す" +"る CAN フレームだけをユーザー空間に渡します。" -#: ../../library/socket.rst:543 msgid "" "CAN_ISOTP, in the CAN protocol family, is the ISO-TP (ISO 15765-2) protocol. " "ISO-TP constants, documented in the Linux documentation." msgstr "" +"CAN プロトコルファミリーの CAN_ISOTP は ISO-TP (ISO 15765-2) プロトコルで" +"す。\n" +"ISO-TP の定数は Linux のドキュメントで説明されています。" -#: ../../library/socket.rst:552 msgid "" "CAN_J1939, in the CAN protocol family, is the SAE J1939 protocol. J1939 " "constants, documented in the Linux documentation." msgstr "" +"CAN プロトコルファミリーの CAN_J1939 は SAE J1939 プロトコルです。\n" +"J1939 の定数は Linux のドキュメントで説明されています。" -#: ../../library/socket.rst:563 msgid "" "These two constants, documented in the FreeBSD divert(4) manual page, are " "also defined in the socket module." msgstr "" +"FreeBSD の divert(4) マニュアルページで説明されているこの 2 つの定数も、" +"socket モジュールで定義されています。" -#: ../../library/socket.rst:583 msgid "" ":data:`!ETH_P_ALL` can be used in the :class:`~socket.socket` constructor as " "*proto* for the :const:`AF_PACKET` family in order to capture every packet, " "regardless of protocol." msgstr "" +":const:`AF_PACKET` ファミリーの :class:`~socket.socket` コンストラクターの " +"*proto* に :data:`!ETH_P_ALL` を使うと、プロトコルを問わずすべてのパケットを" +"取得できます。" -#: ../../library/socket.rst:587 msgid "For more information, see the :manpage:`packet(7)` manpage." -msgstr "" +msgstr "詳しくは :manpage:`packet(7)` マニュアルページを参照してください。" #: ../../library/socket.rst:612 msgid "" @@ -948,9 +989,8 @@ msgstr "" msgid "Constants for Linux Kernel cryptography." msgstr "Linux カーネル暗号用の定数です。" -#: ../../library/socket.rst:640 msgid "Constants for Linux host/guest communication." -msgstr "" +msgstr "Linux のホストとゲスト間の通信用の定数です。" #: ../../library/socket.rst:654 msgid "" @@ -958,9 +998,8 @@ msgid "" "on this platform." msgstr "現在のプラットフォームでIPv6がサポートされているか否かを示す真偽値。" -#: ../../library/socket.rst:663 msgid "Integer constants for use with Bluetooth addresses." -msgstr "" +msgstr "Bluetooth アドレスに使う整数定数です。" #: ../../library/socket.rst:668 msgid "" @@ -972,68 +1011,78 @@ msgstr "" "const:`BDADDR_ANY` を使用すると、 :const:`BTPROTO_RFCOMM` で束縛ソケットを指" "定する際に、任意のアドレスを指し示すことができます。" -#: ../../library/socket.rst:677 msgid "" "These constants describe the Bluetooth address type when binding or " "connecting a :const:`BTPROTO_L2CAP` socket." msgstr "" +"これらの定数は、:const:`BTPROTO_L2CAP` ソケットのバインドや接続に使う " +"Bluetooth アドレスの種類を表します。" -#: ../../library/socket.rst:690 msgid "" "Used in the level argument to the :meth:`~socket.setsockopt` and :meth:" "`~socket.getsockopt` methods of Bluetooth socket objects." msgstr "" +"Bluetooth ソケットオブジェクトの :meth:`~socket.setsockopt` メソッドと :meth:" +"`~socket.getsockopt` メソッドの ``level`` 引数に使います。" -#: ../../library/socket.rst:693 msgid "" ":const:`SOL_BLUETOOTH` is only available on Linux. Other constants are " "available if the corresponding protocol is supported." msgstr "" +":const:`SOL_BLUETOOTH` は Linux でのみ利用できます。\n" +"ほかの定数は、対応するプロトコルがサポートされている場合に利用できます。" -#: ../../library/socket.rst:705 msgid "" "Used in the option name and value argument to the :meth:`~socket.setsockopt` " "and :meth:`~socket.getsockopt` methods of Bluetooth socket objects." msgstr "" +"Bluetooth ソケットオブジェクトの :meth:`~socket.setsockopt` メソッドと :meth:" +"`~socket.getsockopt` メソッドで、オプション名や値を指定する引数に使います。" -#: ../../library/socket.rst:708 msgid "" ":const:`!BT_*` and :const:`L2CAP_LM` are only available on Linux. :const:`!" "SO_BTH_*` are only available on Windows. Other constants may be available on " "Linux and various BSD platforms." msgstr "" +":const:`!BT_*` と :const:`L2CAP_LM` は Linux でのみ利用できます。\n" +":const:`!SO_BTH_*` は Windows でのみ利用できます。\n" +"ほかの定数は Linux や各種 BSD プラットフォームで利用できる場合があります。" -#: ../../library/socket.rst:720 msgid "" "Option names for use with :const:`BTPROTO_HCI`. Availability and format of " "the option values depend on platform." msgstr "" +":const:`BTPROTO_HCI` に使うオプション名です。\n" +"利用できるオプションとその値の形式はプラットフォームによって異なります。" -#: ../../library/socket.rst:723 msgid "" "Added :const:`!SO_HCI_EVT_FILTER` and :const:`!SO_HCI_PKT_FILTER` on NetBSD " "and DragonFly BSD. Added :const:`!HCI_DATA_DIR` on FreeBSD, NetBSD and " "DragonFly BSD." msgstr "" +"NetBSD と DragonFly BSD に :const:`!SO_HCI_EVT_FILTER` と :const:`!" +"SO_HCI_PKT_FILTER` が追加されました。\n" +"FreeBSD、NetBSD、DragonFly BSD に :const:`!HCI_DATA_DIR` が追加されました。" -#: ../../library/socket.rst:730 msgid "" "The ``device_id`` value used to create an HCI socket that isn't specific to " "a single Bluetooth adapter." msgstr "" +"単一の Bluetooth アダプターに限定されない HCI ソケットを作成するための " +"``device_id`` の値です。" -#: ../../library/socket.rst:743 msgid "" "Possible values for ``channel`` field in the :const:`BTPROTO_HCI` address." msgstr "" +":const:`BTPROTO_HCI` アドレスの ``channel`` フィールドに指定できる値です。" -#: ../../library/socket.rst:751 msgid "" "Constant for Qualcomm's IPC router protocol, used to communicate with " "service providing remote processors." msgstr "" +"サービスを提供するリモートプロセッサーとの通信に使う、Qualcomm の IPC ルー" +"タープロトコルの定数です。" -#: ../../library/socket.rst:760 msgid "" "LOCAL_CREDS and LOCAL_CREDS_PERSISTENT can be used with SOCK_DGRAM, " "SOCK_STREAM sockets, equivalent to Linux/DragonFlyBSD SO_PASSCRED, while " @@ -1041,33 +1090,39 @@ msgid "" "sends for each read, SCM_CREDS2 must be then used for the latter for the " "message type." msgstr "" +"LOCAL_CREDS と LOCAL_CREDS_PERSISTENT は SOCK_DGRAM ソケットと SOCK_STREAM ソ" +"ケットで使え、Linux や DragonFlyBSD の SO_PASSCRED に相当します。\n" +"LOCAL_CREDS は最初の読み取り時に認証情報を送信し、LOCAL_CREDS_PERSISTENT は読" +"み取りのたびに送信します。\n" +"後者ではメッセージの種類に SCM_CREDS2 を使う必要があります。" -#: ../../library/socket.rst:773 msgid "" "Constant to optimize CPU locality, to be used in conjunction with :data:" "`SO_REUSEPORT`." msgstr "" +"CPU の局所性を最適化するための定数で、:data:`SO_REUSEPORT` と組み合わせて使い" +"ます。" -#: ../../library/socket.rst:782 msgid "" "Constant to enable duplicate address and port bindings with load balancing." -msgstr "" +msgstr "同じアドレスとポートへの複数のバインドと負荷分散を有効にする定数です。" -#: ../../library/socket.rst:801 msgid "Constants for Windows Hyper-V sockets for host/guest communications." -msgstr "" +msgstr "ホストとゲスト間の通信に使う Windows Hyper-V ソケットの定数です。" -#: ../../library/socket.rst:814 msgid "" "`IEEE 802.3 protocol number `_. constants." msgstr "" +"`IEEE 802.3 プロトコル番号 `_ の定数です。" -#: ../../library/socket.rst:826 msgid "" "These constants are used by the :meth:`~socket.socket.shutdown` method of " "socket objects." msgstr "" +"これらの定数はソケットオブジェクトの :meth:`~socket.socket.shutdown` メソッド" +"で使います。" #: ../../library/socket.rst:831 msgid "Functions" @@ -1101,8 +1156,8 @@ msgstr "" "(デフォルト値), :const:`SOCK_DGRAM`, :const:`SOCK_RAW` または他の ``SOCK_`` " "定数の何れかを指定します。プロトコル番号は通常省略するか、または0を指定します" "が、アドレスファミリーに :const:`AF_CAN` を指定した場合は、プロトコル番号に" -"は const:`CAN_RAW`, :const:`CAN_BCM`, :const:`CAN_ISOTP`, :const:`CAN_J1939` " -"のいずれかを指定すべきです。" +"は :const:`CAN_RAW`, :const:`CAN_BCM`, :const:`CAN_ISOTP`, :const:" +"`CAN_J1939` のいずれかを指定すべきです。" #: ../../library/socket.rst:851 msgid "" @@ -1144,25 +1199,31 @@ msgstr "返されるソケットは継承不可になりました。" msgid "The CAN_ISOTP protocol was added." msgstr "CAN_ISOTP プロトコルが追加されました。" -#: ../../library/socket.rst:877 msgid "" "When :const:`SOCK_NONBLOCK` or :const:`SOCK_CLOEXEC` bit flags are applied " "to *type* they are cleared, and :attr:`socket.type` will not reflect them. " "They are still passed to the underlying system ``socket()`` call. Therefore," msgstr "" +"*type* に :const:`SOCK_NONBLOCK` や :const:`SOCK_CLOEXEC` のビットフラグを指" +"定しても、それらはクリアされ、:attr:`socket.type` には反映されません。\n" +"ただし、基盤となるシステムの ``socket()`` 呼び出しには渡されます。\n" +"したがって、" -#: ../../library/socket.rst:885 msgid "" "sock = socket.socket(\n" " socket.AF_INET,\n" " socket.SOCK_STREAM | socket.SOCK_NONBLOCK)" msgstr "" +"sock = socket.socket(\n" +" socket.AF_INET,\n" +" socket.SOCK_STREAM | socket.SOCK_NONBLOCK)" -#: ../../library/socket.rst:889 msgid "" "will still create a non-blocking socket on OSes that support " "``SOCK_NONBLOCK``, but ``sock.type`` will be set to ``socket.SOCK_STREAM``." msgstr "" +"は、``SOCK_NONBLOCK`` をサポートする OS では非ブロッキングソケットを作成しま" +"すが、``sock.type`` は ``socket.SOCK_STREAM`` に設定されます。" #: ../../library/socket.rst:893 msgid "The CAN_J1939 protocol was added." @@ -1238,13 +1299,16 @@ msgstr "" "引数で、指定する場合は ``(host, port)`` の2要素タプルでなければなりません。 " "host や port が '' か 0 だった場合は、OSのデフォルトの動作になります。" -#: ../../library/socket.rst:938 msgid "" "When a connection cannot be created, an exception is raised. By default, it " "is the exception from the last address in the list. If *all_errors* is " "``True``, it is an :exc:`ExceptionGroup` containing the errors of all " "attempts." msgstr "" +"接続を確立できない場合は例外を送出します。\n" +"デフォルトでは、リスト内の最後のアドレスで発生した例外を送出します。\n" +"*all_errors* が ``True`` の場合は、すべての接続試行のエラーを含む :exc:" +"`ExceptionGroup` を送出します。" #: ../../library/socket.rst:943 msgid "*source_address* was added." @@ -1254,21 +1318,25 @@ msgstr "*source_address* が追加されました。" msgid "*all_errors* was added." msgstr "*all_errors* が追加されました" -#: ../../library/socket.rst:952 msgid "" "Convenience function which creates a TCP socket bound to *address* (a 2-" "tuple ``(host, port)``) and returns the socket object." msgstr "" +"*address* (``(host, port)`` という 2 要素のタプル) にバインドされた TCP ソ" +"ケットを作成し、そのソケットオブジェクトを返す便利な関数です。" -#: ../../library/socket.rst:955 msgid "" "*family* should be either :data:`AF_INET` or :data:`AF_INET6`. *backlog* is " "the queue size passed to :meth:`socket.listen`; if not specified , a default " "reasonable value is chosen. *reuse_port* dictates whether to set the :data:" "`SO_REUSEPORT` socket option." msgstr "" +"*family* は :data:`AF_INET` または :data:`AF_INET6` でなければなりません。\n" +"*backlog* は :meth:`socket.listen` に渡すキューのサイズです。\n" +"指定しない場合は、適切なデフォルト値が選ばれます。\n" +"*reuse_port* はソケットオプション :data:`SO_REUSEPORT` を設定するかどうかを指" +"定します。" -#: ../../library/socket.rst:960 msgid "" "If *dualstack_ipv6* is true, *family* is :data:`AF_INET6` and the platform " "supports it the socket will be able to accept both IPv4 and IPv6 " @@ -1280,8 +1348,18 @@ msgid "" "functionality on platforms that enable it by default (e.g. Linux). This " "parameter can be used in conjunction with :func:`has_dualstack_ipv6`:" msgstr "" +"*dualstack_ipv6* が真の場合、*family* が :data:`AF_INET6` でプラットフォーム" +"がこの機能をサポートしていれば、ソケットは IPv4 と IPv6 の両方の接続を受け入" +"れられます。\n" +"そうでなければ :exc:`ValueError` を送出します。\n" +"ほとんどの POSIX プラットフォームと Windows はこの機能をサポートしているはず" +"です。\n" +"この機能が有効な場合、IPv4 接続に対して :meth:`socket.getpeername` が返すアド" +"レスは、IPv4 射影 IPv6 アドレスとして表された IPv6 アドレスになります。\n" +"*dualstack_ipv6* が偽の場合、この機能をデフォルトで有効にするプラットフォー" +"ム (Linux など) でも明示的に無効にします。\n" +"この引数は :func:`has_dualstack_ipv6` と組み合わせて使えます:" -#: ../../library/socket.rst:973 msgid "" "import socket\n" "\n" @@ -1292,19 +1370,30 @@ msgid "" "else:\n" " s = socket.create_server(addr)" msgstr "" +"import socket\n" +"\n" +"addr = (\"\", 8080) # すべてのインターフェース、ポート 8080\n" +"if socket.has_dualstack_ipv6():\n" +" s = socket.create_server(addr, family=socket.AF_INET6, " +"dualstack_ipv6=True)\n" +"else:\n" +" s = socket.create_server(addr)" -#: ../../library/socket.rst:982 msgid "" "On POSIX platforms the :data:`SO_REUSEADDR` socket option is set in order to " "immediately reuse previous sockets which were bound on the same *address* " "and remained in TIME_WAIT state." msgstr "" +"POSIX プラットフォームでは、同じ *address* にバインドされて TIME_WAIT 状態で" +"残っている以前のソケットをすぐに再利用できるよう、ソケットオプション :data:" +"`SO_REUSEADDR` を設定します。" -#: ../../library/socket.rst:990 msgid "" "Return ``True`` if the platform supports creating a TCP socket which can " "handle both IPv4 and IPv6 connections." msgstr "" +"プラットフォームが IPv4 と IPv6 の両方の接続を扱える TCP ソケットの作成をサ" +"ポートしていれば、``True`` を返します。" #: ../../library/socket.rst:997 msgid "" @@ -1350,12 +1439,11 @@ msgid "" "not work for socket file descriptors." msgstr "" -#: ../../library/socket.rst:1044 msgid "" "This function wraps the C function ``getaddrinfo`` of the underlying system." msgstr "" +"この関数は、基盤となるシステムの C 関数 ``getaddrinfo`` をラップします。" -#: ../../library/socket.rst:1046 msgid "" "Translate the *host*/*port* argument into a sequence of 5-tuples that " "contain all the necessary arguments for creating a socket connected to that " @@ -1365,26 +1453,35 @@ msgid "" "and *port*, you can pass ``NULL`` to the underlying C API." msgstr "" "*host* / *port* 引数の指すアドレス情報を、そのサービスに接続されたソケットを" -"作成するために必要な全ての引数が入った 5 要素のタプルに変換します。 *host* は" -"ドメイン名、IPv4/v6アドレスの文字列、または ``None`` です。 *port* は " -"``'http'`` のようなサービス名文字列、ポート番号を表す数値、または ``None`` で" -"す。 *host* と *port* に ``None`` を指定すると C APIに ``NULL`` を渡せます。" +"作成するために必要な全ての引数が入った 5 要素のタプルのシーケンスに変換しま" +"す。\n" +"*host* はドメイン名、IPv4/v6アドレスの文字列、または ``None`` です。\n" +"*port* は ``'http'`` のようなサービス名文字列、ポート番号を表す数値、または " +"``None`` です。\n" +"*host* と *port* に ``None`` を指定すると C APIに ``NULL`` を渡せます。" -#: ../../library/socket.rst:1053 msgid "" "The *family*, *type* and *proto* arguments can be optionally specified in " "order to provide options and limit the list of addresses returned. Pass " "their default values (:data:`AF_UNSPEC`, 0, and 0, respectively) to not " "limit the results. See the note below for details." msgstr "" +"*family*、*type*、*proto* 引数を指定すると、オプションを設定して、返されるア" +"ドレスのリストを制限できます。\n" +"結果を制限しない場合は、それぞれのデフォルト値 (:data:`AF_UNSPEC`、0、0) を渡" +"してください。\n" +"詳しくは後述の注記を参照してください。" -#: ../../library/socket.rst:1058 msgid "" "The *flags* argument can be one or several of the ``AI_*`` constants, and " "will influence how results are computed and returned. For example, :const:" "`AI_NUMERICHOST` will disable domain name resolution and will raise an error " "if *host* is a domain name." msgstr "" +"*flags* 引数には ``AI_*`` 定数を 1 つ、または複数組み合わせて指定でき、結果の" +"計算方法と返し方に影響します。\n" +"例えば :const:`AI_NUMERICHOST` はドメイン名の解決を無効にし、*host* がドメイ" +"ン名の場合にエラーを送出します。" #: ../../library/socket.rst:1063 msgid "The function returns a list of 5-tuples with the following structure:" @@ -1406,7 +1503,6 @@ msgid "" "`AF_INET6`), and is meant to be passed to the :meth:`socket.connect` method." msgstr "" -#: ../../library/socket.rst:1079 msgid "" "If you intend to use results from :func:`!getaddrinfo` to create a socket " "(rather than, for example, retrieve *canonname*), consider limiting the " @@ -1414,14 +1510,19 @@ msgid "" "*proto* (e.g. :data:`IPPROTO_TCP` or :data:`IPPROTO_UDP`) that your " "application can handle." msgstr "" +":func:`!getaddrinfo` の結果を使ってソケットを作成する場合 (例えば " +"*canonname* の取得だけが目的ではない場合) は、\n" +"アプリケーションで扱える *type* (:data:`SOCK_STREAM` や :data:`SOCK_DGRAM` な" +"ど) や *proto* (:data:`IPPROTO_TCP` や :data:`IPPROTO_UDP` など) で結果を制限" +"することを検討してください。" -#: ../../library/socket.rst:1085 msgid "" "The behavior with default values of *family*, *type*, *proto* and *flags* is " "system-specific." msgstr "" +"*family*、*type*、*proto*、*flags* がデフォルト値の場合の動作は、システムに" +"よって異なります。" -#: ../../library/socket.rst:1088 msgid "" "Many systems (for example, most Linux configurations) will return a sorted " "list of all matching addresses. These addresses should generally be tried in " @@ -1430,13 +1531,22 @@ msgid "" "and/or *proto* can help eliminate unsuccessful or unusable connection " "attempts." msgstr "" +"多くのシステム (例えば、ほとんどの Linux 構成) は、一致するすべてのアドレスを" +"ソートしたリストを返します。\n" +"通常、接続が成功するまでこの順序でアドレスへの接続を試みてください (`Happy " +"Eyeballs`_ アルゴリズムなどを使い、並行して試すこともできます)。\n" +"このようなシステムでは、*type* や *proto* を制限すると、失敗する接続や利用で" +"きない接続を試すことを避けやすくなります。" -#: ../../library/socket.rst:1095 msgid "" "Some systems will, however, only return a single address. (For example, this " "was reported on Solaris and AIX configurations.) On these systems, limiting " "the *type* and/or *proto* helps ensure that this address is usable." msgstr "" +"一方、アドレスを 1 つしか返さないシステムもあります (例えば、Solaris や AIX " +"の構成で報告されています)。\n" +"このようなシステムでは、*type* や *proto* を制限すると、利用可能なアドレスを" +"得やすくなります。" #: ../../library/socket.rst:1100 msgid "" @@ -1446,17 +1556,15 @@ msgstr "" "引数 ``host``, ``port``, ``family``, ``type``, ``protocol`` 付きで :ref:`監査" "イベント ` ``socket.getaddrinfo`` を送出します。" -#: ../../library/socket.rst:1102 msgid "" "The following example fetches address information for a hypothetical TCP " "connection to ``example.org`` on port 80 (results may differ on your system " "if IPv6 isn't enabled)::" msgstr "" -"次の例では ``example.org`` の 80 番ポートポートへの TCP 接続を得るためのアド" -"レス情報を取得しようとしています。 (結果は IPv6 をサポートしているかどうかで" -"変わります)::" +"次の例では、``example.org`` の 80 番ポートに TCP 接続するとした場合のアドレス" +"情報を取得します (IPv6 が有効でなければ、システムによって結果が異なることがあ" +"ります)。 ::" -#: ../../library/socket.rst:1106 msgid "" ">>> socket.getaddrinfo(\"example.org\", 80, proto=socket.IPPROTO_TCP)\n" "[(socket.AF_INET6, socket.SOCK_STREAM,\n" @@ -1464,18 +1572,23 @@ msgid "" " (socket.AF_INET, socket.SOCK_STREAM,\n" " 6, '', ('93.184.216.34', 80))]" msgstr "" +">>> socket.getaddrinfo(\"example.org\", 80, proto=socket.IPPROTO_TCP)\n" +"[(socket.AF_INET6, socket.SOCK_STREAM,\n" +" 6, '', ('2606:2800:220:1:248:1893:25c8:1946', 80, 0, 0)),\n" +" (socket.AF_INET, socket.SOCK_STREAM,\n" +" 6, '', ('93.184.216.34', 80))]" #: ../../library/socket.rst:1112 msgid "parameters can now be passed using keyword arguments." msgstr "パラメータをキーワード引数で渡すことができるようになりました。" -#: ../../library/socket.rst:1115 msgid "" "for IPv6 multicast addresses, string representing an address will not " "contain ``%scope_id`` part." msgstr "" +"IPv6 マルチキャストアドレスでは、アドレスを表す文字列に ``%scope_id`` 部分が" +"含まれなくなりました。" -#: ../../library/socket.rst:1123 msgid "" "Return a fully qualified domain name for *name*. If *name* is omitted or " "empty, it is interpreted as the local host. To find the fully qualified " @@ -1485,6 +1598,15 @@ msgid "" "was provided, it is returned unchanged. If *name* was empty or equal to " "``'0.0.0.0'``, the hostname from :func:`gethostname` is returned." msgstr "" +"*name* の完全修飾ドメイン名を返します。\n" +"*name* が省略された場合や空の場合は、ローカルホストと解釈します。\n" +"完全修飾名を探すため、:func:`gethostbyaddr` が返すホスト名を調べ、次にホスト" +"の別名があればそれらを調べます。\n" +"ピリオドを含む最初の名前が選ばれます。\n" +"完全修飾ドメイン名が得られず、*name* が指定されていれば、*name* をそのまま返" +"します。\n" +"*name* が空または ``'0.0.0.0'`` の場合は、:func:`gethostname` が返すホスト名" +"を返します。" #: ../../library/socket.rst:1134 msgid "" @@ -1498,19 +1620,17 @@ msgstr "" "ホスト名を ``'100.50.200.5'`` のようなIPv4形式のアドレスに変換します。ホスト" "名としてIPv4アドレスを指定した場合、その値は変換せずにそのまま返ります。 :" "func:`gethostbyname` APIへのより完全なインターフェイスが必要であれば、 :func:" -"`gethostbyname_ex` を参照してください。 :func:`gethostbyname` は、IPv6名前解" -"決をサポートしていません。IPv4/ v6のデュアルスタックをサポートする場合は :" -"func:`getaddrinfo` を使用します。" +"`gethostbyname_ex` を参照してください。 ``gethostbyname()`` は、IPv6名前解決" +"をサポートしていません。IPv4/ v6のデュアルスタックをサポートする場合は :func:" +"`getaddrinfo` を使用します。" -#: ../../library/socket.rst:1140 ../../library/socket.rst:1156 msgid "" "Raises an :ref:`auditing event ` ``socket.gethostbyname`` with " "argument ``hostname``." msgstr "" "引数 ``hostname`` を指定して :ref:`監査イベント ` ``socket." -"gethostbyname`` を送出します。 " +"gethostbyname`` を送出します。" -#: ../../library/socket.rst:1147 msgid "" "Translate a host name to IPv4 address format, extended interface. Return a 3-" "tuple ``(hostname, aliaslist, ipaddrlist)`` where *hostname* is the host's " @@ -1521,6 +1641,15 @@ msgid "" "resolution, and :func:`getaddrinfo` should be used instead for IPv4/v6 dual " "stack support." msgstr "" +"ホスト名を IPv4 アドレス形式に変換する拡張インターフェースです。\n" +"3 要素のタプル ``(hostname, aliaslist, ipaddrlist)`` を返します。\n" +"*hostname* はそのホストの主なホスト名、*aliaslist* は同じアドレスを指す別のホ" +"スト名のリスト (空の場合もあります)、\n" +"*ipaddrlist* は同じホストの同じインターフェースの IPv4 アドレスのリストです " +"(多くの場合はアドレス 1 つですが、常にそうとは限りません)。\n" +":func:`gethostbyname_ex` は IPv6 の名前解決をサポートしていません。\n" +"IPv4/v6 デュアルスタックをサポートするには、代わりに :func:`getaddrinfo` を" +"使ってください。" #: ../../library/socket.rst:1163 msgid "" @@ -1530,13 +1659,12 @@ msgstr "" "Pythonインタープリタを現在実行しているマシンのホスト名を含む文字列を返しま" "す。" -#: ../../library/socket.rst:1166 msgid "" "Raises an :ref:`auditing event ` ``socket.gethostname`` with no " "arguments." msgstr "" "引数無しで :ref:`監査イベント ` ``socket.gethostname`` を送出しま" -"す。 " +"す。" #: ../../library/socket.rst:1168 msgid "" @@ -1546,7 +1674,6 @@ msgstr "" "注意: :func:`gethostname` は完全修飾ドメイン名を返すとは限りません。完全修飾" "ドメイン名が必要であれば、:func:`getfqdn` を使用してください。" -#: ../../library/socket.rst:1176 msgid "" "Return a 3-tuple ``(hostname, aliaslist, ipaddrlist)`` where *hostname* is " "the primary host name responding to the given *ip_address*, *aliaslist* is a " @@ -1556,43 +1683,53 @@ msgid "" "qualified domain name, use the function :func:`getfqdn`. :func:" "`gethostbyaddr` supports both IPv4 and IPv6." msgstr "" +"3 要素のタプル ``(hostname, aliaslist, ipaddrlist)`` を返します。\n" +"*hostname* は指定された *ip_address* に対応する主なホスト名、*aliaslist* は同" +"じアドレスを指す別のホスト名のリスト (空の場合もあります)、\n" +"*ipaddrlist* は同じホストの同じインターフェースの IPv4/v6 アドレスのリストで" +"す (ほとんどの場合、アドレスは 1 つだけです)。\n" +"完全修飾ドメイン名を得るには :func:`getfqdn` 関数を使ってください。\n" +":func:`gethostbyaddr` は IPv4 と IPv6 の両方をサポートしています。" -#: ../../library/socket.rst:1184 msgid "" "Raises an :ref:`auditing event ` ``socket.gethostbyaddr`` with " "argument ``ip_address``." msgstr "" "引数 ``ip_address`` を指定して :ref:`監査イベント ` ``socket." -"gethostbyaddr`` を送出します。 " +"gethostbyaddr`` を送出します。" -#: ../../library/socket.rst:1191 msgid "" "Translate a socket address *sockaddr* into a 2-tuple ``(host, port)``. " "Depending on the settings of *flags*, the result can contain a fully " "qualified domain name or numeric address representation in *host*. " "Similarly, *port* can contain a string port name or a numeric port number." msgstr "" +"ソケットアドレス *sockaddr* を 2 要素のタプル ``(host, port)`` に変換しま" +"す。\n" +"*flags* の設定に応じて、結果の *host* には完全修飾ドメイン名または数値表記の" +"アドレスが入ります。\n" +"同様に、*port* には文字列のポート名または数値のポート番号が入ります。" -#: ../../library/socket.rst:1196 msgid "" "For IPv6 addresses, ``%scope_id`` is appended to the host part if *sockaddr* " "contains meaningful *scope_id*. Usually this happens for multicast addresses." msgstr "" +"IPv6 アドレスで、*sockaddr* に意味のある *scope_id* が含まれている場合は、ホ" +"スト部分に ``%scope_id`` が追加されます。\n" +"通常、マルチキャストアドレスの場合にこうなります。" -#: ../../library/socket.rst:1199 msgid "" "For more information about *flags* you can consult :manpage:`getnameinfo(3)`." msgstr "" +"*flags* について詳しくは :manpage:`getnameinfo(3)` を参照してください。" -#: ../../library/socket.rst:1201 msgid "" "Raises an :ref:`auditing event ` ``socket.getnameinfo`` with " "argument ``sockaddr``." msgstr "" "引数 ``sockaddr`` を指定して :ref:`監査イベント ` ``socket." -"getnameinfo`` を送出します。 " +"getnameinfo`` を送出します。" -#: ../../library/socket.rst:1208 msgid "" "Translate an internet protocol name (for example, ``'icmp'``) to a constant " "suitable for passing as the (optional) third argument to the :func:`~socket." @@ -1600,6 +1737,12 @@ msgid "" "mode (:const:`SOCK_RAW`); for the normal socket modes, the correct protocol " "is chosen automatically if the protocol is omitted or zero." msgstr "" +"インターネットプロトコル名 (``'icmp'`` など) を、:func:`~socket.socket` 関数" +"の省略可能な 3 番目の引数に渡せる定数に変換します。\n" +"通常、これは \"raw\" モード (:const:`SOCK_RAW`) で開くソケットでのみ必要で" +"す。\n" +"通常のソケットモードでは、プロトコルを省略するかゼロを指定すると、適切なプロ" +"トコルが自動的に選ばれます。" #: ../../library/socket.rst:1219 msgid "" @@ -1611,13 +1754,12 @@ msgstr "" "す。省略可能なプロトコル名として、 ``'tcp'`` か ``'udp'`` のどちらかを指定す" "ることができます。指定がなければどちらのプロトコルにもマッチします。" -#: ../../library/socket.rst:1223 msgid "" "Raises an :ref:`auditing event ` ``socket.getservbyname`` with " "arguments ``servicename``, ``protocolname``." msgstr "" "引数 ``servicename``, ``protocolname`` を指定して :ref:`監査イベント " -"` ``socket.getservbyname`` を送出します。 " +"` ``socket.getservbyname`` を送出します。" #: ../../library/socket.rst:1230 msgid "" @@ -1629,13 +1771,12 @@ msgstr "" "なプロトコル名として、 ``'tcp'`` か ``'udp'`` のどちらかを指定することができ" "ます。指定がなければどちらのプロトコルにもマッチします。" -#: ../../library/socket.rst:1234 msgid "" "Raises an :ref:`auditing event ` ``socket.getservbyport`` with " "arguments ``port``, ``protocolname``." msgstr "" "引数 ``port``, ``protocolname`` を指定して :ref:`監査イベント ` " -"``socket.getservbyport`` を送出します。 " +"``socket.getservbyport`` を送出します。" #: ../../library/socket.rst:1241 msgid "" @@ -1659,10 +1800,11 @@ msgstr "" "シンでは、この関数は何もしません。それ以外の場合は2バイトのスワップを行いま" "す。" -#: ../../library/socket.rst:1252 ../../library/socket.rst:1270 msgid "" "Raises :exc:`OverflowError` if *x* does not fit in a 16-bit unsigned integer." msgstr "" +"*x* が 16 ビット符号なし整数に収まらない場合は、:exc:`OverflowError` を送出し" +"ます。" #: ../../library/socket.rst:1259 msgid "" @@ -1699,22 +1841,22 @@ msgstr "" "値は、標準Cライブラリの :c:struct:`in_addr` 型を使用する関数に渡す事ができま" "す。" -#: ../../library/socket.rst:1283 msgid "" ":func:`inet_aton` also accepts strings with less than three dots; see the " "Unix manual page :manpage:`inet(3)` for details." msgstr "" -":func:`inet_aton` はドットが 3 個以下の文字列も受け取ります; 詳細については " +":func:`inet_aton` はドットが 3 個未満の文字列も受け取ります; 詳細については " "Unix のマニュアル :manpage:`inet(3)` を参照してください。" -#: ../../library/socket.rst:1286 msgid "" "If the IPv4 address string passed to this function is invalid, :exc:" "`OSError` will be raised. Note that exactly what is valid depends on the " "underlying C implementation of :c:func:`inet_aton`." msgstr "" -"IPv4アドレス文字列が不正であれば、 :exc:`OSError` が発生します。このチェック" -"は、この関数で使用しているCの実装 :c:func:`inet_aton` で行われます。" +"この関数に渡した IPv4 アドレス文字列が無効な場合は、:exc:`OSError` を送出しま" +"す。\n" +"具体的にどの文字列が有効かは、基盤となる C の :c:func:`inet_aton` 実装によっ" +"て異なります。" #: ../../library/socket.rst:1290 msgid "" @@ -1724,7 +1866,6 @@ msgstr "" ":func:`inet_aton` は、IPv6をサポートしません。IPv4/v6のデュアルスタックをサ" "ポートする場合は :func:`inet_pton` を使用します。" -#: ../../library/socket.rst:1296 msgid "" "Convert a 32-bit packed IPv4 address (a :term:`bytes-like object` four bytes " "in length) to its standard dotted-quad string representation (for example, " @@ -1734,10 +1875,11 @@ msgid "" "argument." msgstr "" "32 ビットにパックされた IPv4 アドレス (長さ 4 バイトの :term:`bytes-like " -"object`) を、標準的なドット記法による 4 桁の文字列 ('123.45.67.89' など) に変" -"換します。この関数は、:c:struct:`in_addr` 型、つまりこの関数が引数として受け" -"取る 32 ビットにパックされたバイナリデータに対する C の型、を使用する標準 C " -"ライブラリのプログラムとやりとりする場合に便利です。" +"object`) を、4 つの数をドットで区切る標準的な文字列形式 ('123.45.67.89' な" +"ど) に変換します。\n" +"この関数は、:c:struct:`in_addr` 型、つまりこの関数が引数として受け取る 32 " +"ビットにパックされたバイナリデータに対する C の型、を使用する標準 C ライブラ" +"リのプログラムとやりとりする場合に便利です。" #: ../../library/socket.rst:1303 msgid "" @@ -1806,7 +1948,6 @@ msgstr "" "ファミリで適切な長さでない場合、 :exc:`ValueError` が発生します。 :func:" "`inet_ntop` の呼び出しでエラーが起こると、 :exc:`OSError` が発生します。" -#: ../../library/socket.rst:1362 msgid "" "Return the total length, without trailing padding, of an ancillary data item " "with associated data of the given *length*. This value can often be used as " @@ -1816,20 +1957,18 @@ msgid "" "the last in the buffer. Raises :exc:`OverflowError` if *length* is outside " "the permissible range of values." msgstr "" -"指定された *length* にある制御メッセージ(CMSG)から、末尾のパディングを除い" -"た全体の長さを返します。この値は多くの場合、 :meth:`~socket.recvmsg` が制御" -"メッセージの一連の要素を受信するためのバッファサイズとして使用できますが、" -"バッファの末尾が要素である場合であってもパディングは含まれるので、バッファサ" -"イズを取得するには :rfc:`3542` で求められているように、 :func:`CMSG_SPACE` を" -"使用した移植可能なアプリケーションが必要です。通常 *length* は定数であり、許" -"容範囲外の値が指定された場合は :exc:`OverflowError` 例外が送出されます。" +"長さ *length* のデータを伴う制御メッセージ (補助データ) 1 件について、末尾の" +"パディングを除いた全体の長さを返します。\n" +"この値は、:meth:`~socket.recvmsg` で制御メッセージを 1 件受信するためのバッ" +"ファサイズとして使える場合が多くあります。\n" +"ただし :rfc:`3542` では、移植可能なアプリケーションは :func:`CMSG_SPACE` を使" +"い、バッファの最後のメッセージであってもパディング用の領域を含める必要がある" +"と定めています。\n" +"*length* が許容範囲外の場合は :exc:`OverflowError` を送出します。" -#: ../../library/socket.rst:1373 ../../library/socket.rst:1861 -#: ../../library/socket.rst:1905 ../../library/socket.rst:2013 msgid "Most Unix platforms." -msgstr "Unix プラットフォーム。" +msgstr "ほとんどの Unix プラットフォーム。" -#: ../../library/socket.rst:1380 msgid "" "Return the buffer size needed for :meth:`~socket.recvmsg` to receive an " "ancillary data item with associated data of the given *length*, along with " @@ -1838,27 +1977,26 @@ msgid "" "Raises :exc:`OverflowError` if *length* is outside the permissible range of " "values." msgstr "" -"指定された *length* の制御メッセージ(CMSG)の要素を :meth:`~socket.recvmsg` " -"が受信するために必要な、パディングを含めたバッファサイズを返します。複数の項" -"目を受信するために必要なバッファスペースは、 :func:`CMSG_SPACE` が返すそれぞ" -"れの要素の長さの合計です。通常 *length* は定数であり、許容範囲外の値が指定さ" -"れた場合は :exc:`OverflowError` 例外が送出されます。" +"長さ *length* のデータを伴う制御メッセージ (補助データ) 1 件を :meth:" +"`~socket.recvmsg` で受信するために必要な、末尾のパディングを含むバッファサイ" +"ズを返します。\n" +"複数件を受信するには、それぞれのデータ長に対する :func:`CMSG_SPACE` の戻り値" +"を合計したバッファサイズが必要です。\n" +"*length* が許容範囲外の場合は :exc:`OverflowError` を送出します。" -#: ../../library/socket.rst:1388 msgid "" "Note that some systems might support ancillary data without providing this " "function. Also note that setting the buffer size using the results of this " "function may not precisely limit the amount of ancillary data that can be " "received, since additional data may be able to fit into the padding area." msgstr "" -"一部のシステムではこの関数を提供せずに制御メッセージをサポートする可能性があ" -"ることに注意してください。また、この関数の返り値を使用して設定するバッファサ" -"イズは、受信する制御メッセージの量を正確に規定しないことがあり、その後に受信" -"するデータがパディング領域に合う場合があることに注意してください。" +"この関数を提供せずに制御メッセージをサポートするシステムもあります。\n" +"また、パディング領域に追加のデータが収まることがあるため、この関数の結果で" +"バッファサイズを設定しても、受信できる制御メッセージの量を厳密に制限できると" +"は限りません。" -#: ../../library/socket.rst:1396 msgid "most Unix platforms." -msgstr "" +msgstr "ほとんどの Unix プラットフォーム。" #: ../../library/socket.rst:1403 msgid "" @@ -1897,12 +2035,12 @@ msgstr "" "引数 ``name`` を指定して :ref:`監査イベント ` ``socket." "sethostname`` を送出します。" -#: ../../library/socket.rst:1430 msgid "" "Return a list of network interface information (index int, name string) " "tuples. :exc:`OSError` if the system call fails." msgstr "" -"ネットワークインターフェース情報 (index int, name string)のタプルを返します。" +"ネットワークインターフェース情報を表すタプル (インデックスの整数、名前の文字" +"列) のリストを返します。\n" "システムコールが失敗した場合、 :exc:`OSError` 例外を送出します。" #: ../../library/socket.rst:1438 ../../library/socket.rst:1465 @@ -1910,33 +2048,32 @@ msgstr "" msgid "Windows support was added." msgstr "Windows のサポートが追加されました。" -#: ../../library/socket.rst:1443 msgid "" "On Windows network interfaces have different names in different contexts " "(all names are examples):" msgstr "" +"Windows のネットワークインターフェースには、文脈によって異なる名前があります " +"(以下の名前はすべて例です):" #: ../../library/socket.rst:1446 msgid "UUID: ``{FB605B73-AAC2-49A6-9A2F-25416AEA0573}``" msgstr "UUID: ``{FB605B73-AAC2-49A6-9A2F-25416AEA0573}``" -#: ../../library/socket.rst:1447 msgid "name: ``ethernet_32770``" -msgstr "" +msgstr "名前: ``ethernet_32770``" -#: ../../library/socket.rst:1448 msgid "friendly name: ``vEthernet (nat)``" -msgstr "" +msgstr "表示名: ``vEthernet (nat)``" -#: ../../library/socket.rst:1449 msgid "description: ``Hyper-V Virtual Ethernet Adapter``" -msgstr "" +msgstr "説明: ``Hyper-V Virtual Ethernet Adapter``" -#: ../../library/socket.rst:1451 msgid "" "This function returns names of the second form from the list, " "``ethernet_32770`` in this example case." msgstr "" +"この関数は上記の 2 番目の形式の名前を返します。\n" +"この例では ``ethernet_32770`` です。" #: ../../library/socket.rst:1457 msgid "" @@ -1947,9 +2084,8 @@ msgstr "" "クス番号を返します。対応するインターフェースが存在しない場合は :exc:" "`OSError` 例外を送出します。" -#: ../../library/socket.rst:1469 ../../library/socket.rst:1486 msgid "\"Interface name\" is a name as documented in :func:`if_nameindex`." -msgstr "" +msgstr "「インターフェース名」は :func:`if_nameindex` で説明している名前です。" #: ../../library/socket.rst:1474 msgid "" @@ -1960,25 +2096,32 @@ msgstr "" "フェース名を返します。対応するインターフェースが存在しない場合は :exc:" "`OSError` 例外を送出します。" -#: ../../library/socket.rst:1491 msgid "" "Send the list of file descriptors *fds* over an :const:`AF_UNIX` socket " "*sock*. The *fds* parameter is a sequence of file descriptors. Consult :meth:" "`~socket.sendmsg` for the documentation of these parameters." msgstr "" +":const:`AF_UNIX` ソケット *sock* を通じて、ファイル記述子のリスト *fds* を送" +"信します。\n" +"*fds* 引数はファイル記述子のシーケンスです。\n" +"引数の説明は :meth:`~socket.sendmsg` を参照してください。" -#: ../../library/socket.rst:1497 ../../library/socket.rst:1511 msgid "" "Unix platforms supporting :meth:`~socket.sendmsg` and :const:`SCM_RIGHTS` " "mechanism." msgstr "" +":meth:`~socket.sendmsg` と :const:`SCM_RIGHTS` の仕組みをサポートする Unix プ" +"ラットフォーム。" -#: ../../library/socket.rst:1505 msgid "" "Receive up to *maxfds* file descriptors from an :const:`AF_UNIX` socket " "*sock*. Return ``(msg, list(fds), flags, addr)``. Consult :meth:`~socket." "recvmsg` for the documentation of these parameters." msgstr "" +":const:`AF_UNIX` ソケット *sock* から最大 *maxfds* 個のファイル記述子を受信し" +"ます。\n" +"``(msg, list(fds), flags, addr)`` を返します。\n" +"引数の説明は :meth:`~socket.recvmsg` を参照してください。" #: ../../library/socket.rst:1518 msgid "Any truncated integers at the end of the list of file descriptors." @@ -2019,7 +2162,7 @@ msgstr "" #: ../../library/socket.rst:1544 ../../library/socket.rst:1638 msgid "The socket is now non-inheritable." -msgstr "ソケットが :ref:`継承不可 ` になりました。" +msgstr "ソケットが継承不可になりました。" #: ../../library/socket.rst:1547 ../../library/socket.rst:1774 #: ../../library/socket.rst:1788 ../../library/socket.rst:1865 @@ -2043,15 +2186,13 @@ msgstr "" "ません。(*address* のフォーマットはアドレスファミリによって異なります -- 前" "述。)" -#: ../../library/socket.rst:1558 msgid "" "Raises an :ref:`auditing event ` ``socket.bind`` with arguments " "``self``, ``address``." msgstr "" "引数 ``self``, ``address`` を指定して :ref:`監査イベント ` " -"``socket.bind`` を送出します。 " +"``socket.bind`` を送出します。" -#: ../../library/socket.rst:1565 msgid "" "Mark the socket closed. The underlying system resource (e.g. a file " "descriptor) is also closed when all file objects from :meth:`makefile` are " @@ -2059,6 +2200,12 @@ msgid "" "fail. The remote end will receive no more data (after queued data is " "flushed)." msgstr "" +"ソケットを閉じた状態にします。\n" +":meth:`makefile` で作成されたファイルオブジェクトがすべて閉じられると、基盤と" +"なるシステムリソース (ファイル記述子など) も閉じられます。\n" +"それ以降、ソケットオブジェクトへの操作はすべて失敗します。\n" +"相手側は、キューに残ったデータがフラッシュされた後は、それ以上データを受信し" +"ません。" #: ../../library/socket.rst:1571 msgid "" @@ -2078,12 +2225,15 @@ msgstr "" "下層の :c:func:`close` が呼び出される時、:exc:`OSError` が送出されるようにな" "りました。" -#: ../../library/socket.rst:1581 msgid "" ":meth:`close` releases the resource associated with a connection but does " "not necessarily close the connection immediately. If you want to close the " "connection in a timely fashion, call :meth:`shutdown` before :meth:`close`." msgstr "" +":meth:`close` は接続に関連するリソースを解放しますが、接続を直ちに閉じるとは" +"限りません。\n" +"接続を速やかに閉じたい場合は、:meth:`close` の前に :meth:`shutdown` を呼び出" +"してください。" #: ../../library/socket.rst:1589 msgid "" @@ -2109,13 +2259,12 @@ msgstr "" "(あるいは信号ハンドラにより例外が送出された場合)、このメソッドは :exc:" "`InterruptedError` 例外を送出します。" -#: ../../library/socket.rst:1599 ../../library/socket.rst:1619 msgid "" "Raises an :ref:`auditing event ` ``socket.connect`` with arguments " "``self``, ``address``." msgstr "" "引数 ``self``, ``address`` を指定して :ref:`監査イベント ` " -"``socket.connect`` を送出します。 " +"``socket.connect`` を送出します。" #: ../../library/socket.rst:1601 msgid "" @@ -2157,12 +2306,12 @@ msgstr "" msgid "Duplicate the socket." msgstr "ソケットを複製します。" -#: ../../library/socket.rst:1646 msgid "" "Return the socket's file descriptor (a small integer), or -1 on failure. " "This is useful with :func:`select.select`." msgstr "" -"ソケットのファイル記述子を短い整数型で返します。失敗時には、-1 を返します。" +"ソケットのファイル記述子を小さな整数で返します。\n" +"失敗時には、-1 を返します。\n" "ファイル記述子は、 :func:`select.select` などで使用します。" #: ../../library/socket.rst:1649 @@ -2206,7 +2355,6 @@ msgstr "" "べる場合などに使用します。(*address* のフォーマットはアドレスファミリによって" "異なります --- 前述。)" -#: ../../library/socket.rst:1679 msgid "" "Return the value of the given socket option (see the Unix man page :manpage:" "`getsockopt(2)`). The needed symbolic constants (:ref:`SO_\\* etc. `) はこのモ" +"ジュールで定義されています。\n" +"*buflen* を省略すると、整数のオプションと仮定して整数値を返します。\n" +"*buflen* を指定すると、オプションの値を受け取るバッファの最大長となり、その" +"バッファを bytes オブジェクトとして返します。\n" +"バッファの内容のデコードは呼び出し側で行う必要があります (バイト列にエンコー" +"ドされた C の構造体をデコードする方法は、オプションの組み込みモジュール :mod:" +"`struct` を参照してください)。" -#: ../../library/socket.rst:1693 msgid "" "Return ``True`` if socket is in blocking mode, ``False`` if in non-blocking." msgstr "" +"ソケットがブロッキングモードなら ``True``、非ブロッキングモードなら " +"``False`` を返します。" -#: ../../library/socket.rst:1696 msgid "This is equivalent to checking ``socket.gettimeout() != 0``." -msgstr "" +msgstr "これは ``socket.gettimeout() != 0`` の検査と同等です。" #: ../../library/socket.rst:1703 msgid "" @@ -2282,7 +2440,6 @@ msgstr "" msgid "The *backlog* parameter is now optional." msgstr "*backlog* 引数が任意になりました。" -#: ../../library/socket.rst:1745 msgid "" "Return a :term:`file object` associated with the socket. The exact returned " "type depends on the arguments given to :meth:`makefile`. These arguments " @@ -2290,6 +2447,12 @@ msgid "" "except the only supported *mode* values are ``'r'`` (default), ``'w'``, " "``'b'``, or a combination of those." msgstr "" +"ソケットに関連付けられた :term:`ファイルオブジェクト ` を返しま" +"す。\n" +"返される具体的な型は :meth:`makefile` に渡す引数によって異なります。\n" +"引数は組み込み関数 :func:`open` と同じように解釈されますが、サポートされる " +"*mode* の値は ``'r'`` (デフォルト)、``'w'``、``'b'``、またはその組み合わせだ" +"けです。" #: ../../library/socket.rst:1751 msgid "" @@ -2346,12 +2509,14 @@ msgstr "" "manpage:`recv(2)` を参照してください。デフォルトは0です。 (*address* のフォー" "マットはアドレスファミリによって異なります(前述))" -#: ../../library/socket.rst:1793 msgid "" "For multicast IPv6 address, first item of *address* does not contain " "``%scope_id`` part anymore. In order to get full IPv6 address use :func:" "`getnameinfo`." msgstr "" +"IPv6 マルチキャストアドレスでは、*address* の最初の要素に ``%scope_id`` 部分" +"が含まれなくなりました。\n" +"完全な IPv6 アドレスを得るには :func:`getnameinfo` を使ってください。" #: ../../library/socket.rst:1800 msgid "" @@ -2444,7 +2609,6 @@ msgstr "" "ま(無関係な制御メッセージを受信した場合など、予期しない条件は無視します)。 :" "meth:`sendmsg` も参照してください。" -#: ../../library/socket.rst:1848 msgid "" "import socket, array\n" "\n" @@ -2460,8 +2624,20 @@ msgid "" "itemsize)])\n" " return msg, list(fds)" msgstr "" +"import socket, array\n" +"\n" +"def recv_fds(sock, msglen, maxfds):\n" +" fds = array.array(\"i\") # int の配列\n" +" msg, ancdata, flags, addr = sock.recvmsg(msglen, socket.CMSG_LEN(maxfds " +"* fds.itemsize))\n" +" for cmsg_level, cmsg_type, cmsg_data in ancdata:\n" +" if cmsg_level == socket.SOL_SOCKET and cmsg_type == socket." +"SCM_RIGHTS:\n" +" # 末尾の不完全な整数を無視してデータを追加する。\n" +" fds.frombytes(cmsg_data[:len(cmsg_data) - (len(cmsg_data) % fds." +"itemsize)])\n" +" return msg, list(fds)" -#: ../../library/socket.rst:1873 msgid "" "Receive normal data and ancillary data from the socket, behaving as :meth:" "`recvmsg` would, but scatter the non-ancillary data into a series of buffers " @@ -2474,31 +2650,31 @@ msgid "" "arguments have the same meaning as for :meth:`recvmsg`." msgstr "" ":meth:`recvmsg` と同様に動作してソケットから通常のデータと付属的なデータを受" -"信しますが、非付属的データは新しいバイトオブジェクトとして返すのではなく、一" -"連のバッファとして返します。*buffers* 引数は書き込み可能なバッファをエクス" -"ポートするオブジェクトのイテラブルでなければなりません (例: :class:" -"`bytearray` オブジェクト)。これらは、全てに書き込まれるか、残りバッファがなく" -"なるまで、非付属的データの連続チャンクで埋められます。オペレーティングシステ" -"ムによって、使用できるバッファの数が制限 (:func:`~os.sysconf` 値 " -"``SC_IOV_MAX``) されている場合があります。*ancbufsize* 引数と *flags* 引数" -"は、:meth:`recvmsg` での意味と同じ意味を持ちます。" +"信しますが、非付属的データは新しいバイトオブジェクトとして返すのではなく、指" +"定された一連のバッファに分散して書き込みます。\n" +"*buffers* 引数は書き込み可能なバッファをエクスポートするオブジェクトのイテラ" +"ブルでなければなりません (例: :class:`bytearray` オブジェクト)。\n" +"これらは、全てに書き込まれるか、残りバッファがなくなるまで、非付属的データの" +"連続チャンクで埋められます。\n" +"オペレーティングシステムによって、使用できるバッファの数が制限 (:func:`~os." +"sysconf` 値 ``SC_IOV_MAX``) されている場合があります。\n" +"*ancbufsize* 引数と *flags* 引数は、:meth:`recvmsg` での意味と同じ意味を持ち" +"ます。" -#: ../../library/socket.rst:1884 msgid "" "The return value is a 4-tuple: ``(nbytes, ancdata, msg_flags, address)``, " "where *nbytes* is the total number of bytes of non-ancillary data written " "into the buffers, and *ancdata*, *msg_flags* and *address* are the same as " "for :meth:`recvmsg`." msgstr "" -"戻り値は 4 要素のタプル ``(nbytes, ancdata, msg_flags, address)`` です。ここ" -"で、*nbytes* はバッファに書き込まれた非付属的データの総数で、*ancdata*、" -"*msg_flags*、*address* は :meth:`recvmsg` と同様です。" +"戻り値は 4 要素のタプル ``(nbytes, ancdata, msg_flags, address)`` です。\n" +"ここで、*nbytes* はバッファに書き込まれた非付属的データの総バイト数で、" +"*ancdata*、*msg_flags*、*address* は :meth:`recvmsg` と同様です。" #: ../../library/socket.rst:1889 msgid "Example::" msgstr "以下はプログラム例です::" -#: ../../library/socket.rst:1891 msgid "" ">>> import socket\n" ">>> s1, s2 = socket.socketpair()\n" @@ -2512,6 +2688,17 @@ msgid "" ">>> [b1, b2, b3]\n" "[bytearray(b'Mary'), bytearray(b'01 had a 9'), bytearray(b'little lamb---')]" msgstr "" +">>> import socket\n" +">>> s1, s2 = socket.socketpair()\n" +">>> b1 = bytearray(b'----')\n" +">>> b2 = bytearray(b'0123456789')\n" +">>> b3 = bytearray(b'--------------')\n" +">>> s1.send(b'Mary had a little lamb')\n" +"22\n" +">>> s2.recvmsg_into([b1, memoryview(b2)[2:9], b3])\n" +"(22, [], 0, None)\n" +">>> [b1, b2, b3]\n" +"[bytearray(b'Mary'), bytearray(b'01 had a 9'), bytearray(b'little lamb---')]" #: ../../library/socket.rst:1912 msgid "" @@ -2598,13 +2785,12 @@ msgstr "" "`recv` と同じです。戻り値として、送信したバイト数を返します。(*address* の" "フォーマットはアドレスファミリによって異なります --- 前述。)" -#: ../../library/socket.rst:1972 msgid "" "Raises an :ref:`auditing event ` ``socket.sendto`` with arguments " "``self``, ``address``." msgstr "" "引数 ``self``, ``address`` を指定して :ref:`監査イベント ` " -"``socket.sendto`` を送出します。 " +"``socket.sendto`` を送出します。" #: ../../library/socket.rst:1982 msgid "" @@ -2651,7 +2837,6 @@ msgstr "" "ル記述子 *fds* を :const:`AF_UNIX` ソケット経由で送信します。:meth:`recvmsg` " "も参照してください。" -#: ../../library/socket.rst:2006 msgid "" "import socket, array\n" "\n" @@ -2659,14 +2844,18 @@ msgid "" " return sock.sendmsg([msg], [(socket.SOL_SOCKET, socket.SCM_RIGHTS, array." "array(\"i\", fds))])" msgstr "" +"import socket, array\n" +"\n" +"def send_fds(sock, msg, fds):\n" +" return sock.sendmsg([msg], [(socket.SOL_SOCKET, socket.SCM_RIGHTS, array." +"array(\"i\", fds))])" -#: ../../library/socket.rst:2015 msgid "" "Raises an :ref:`auditing event ` ``socket.sendmsg`` with arguments " "``self``, ``address``." msgstr "" "引数 ``self``, ``address`` を指定して :ref:`監査イベント ` " -"``socket.sendmsg`` を送出します。 " +"``socket.sendmsg`` を送出します。" #: ../../library/socket.rst:2026 msgid "" @@ -2678,7 +2867,6 @@ msgstr "" "す。:const:`AF_ALG` ソケットの、モード、IV、AEAD に関連づけられたデータ長、フ" "ラグを設定します。" -#: ../../library/socket.rst:2035 msgid "" "Send a file until EOF is reached by using high-performance :mod:`os." "sendfile` and return the total number of bytes which were sent. *file* must " @@ -2691,24 +2879,27 @@ msgid "" "be used to figure out the number of bytes which were sent. The socket must " "be of :const:`SOCK_STREAM` type. Non-blocking sockets are not supported." msgstr "" -"高性能の :mod:`os.sendfile` を使用して、ファイルを EOF まで送信し、送信された" -"バイトの総数を返します。*file* は、バイナリモードで開かれた標準的なファイルオ" -"ブジェクトです。:mod:`os.sendfile` が使用できない場合 (例: Windows)、または " -"*file* が標準的なファイルでない場合、代わりに :meth:`send` が使用されます。" -"*offset* は、ファイルの読み出し開始位置を指定します。*count* が指定されている" -"場合、ファイルを EOF まで送信するのではなく、転送するバイトの総数を指定しま" -"す。ファイルの位置は、返る時に更新されます。あるいは、エラー時には :meth:" -"`file.tell() `  を使用して送信されたバイトの数を確認すること" -"ができます。ソケットは :const:`SOCK_STREAM` タイプでなければなりません。非ブ" -"ロックソケットはサポートされていません。" +"高性能な :mod:`os.sendfile` を使ってファイルを EOF まで送信し、送信した総バイ" +"ト数を返します。\n" +"*file* はバイナリモードで開いた通常ファイルのオブジェクトでなければなりませ" +"ん。\n" +":mod:`os.sendfile` が利用できない場合 (Windows など) や、*file* が通常ファイ" +"ルでない場合は、代わりに :meth:`send` を使います。\n" +"*offset* はファイルの読み取り開始位置を指定します。\n" +"*count* を指定すると、EOF まで送信する代わりに、指定されたバイト数を送信しま" +"す。\n" +"正常に戻る場合もエラーが起きた場合もファイル位置は更新されます。\n" +"エラー時には :meth:`file.tell() ` で送信したバイト数を調べら" +"れます。\n" +"ソケットは :const:`SOCK_STREAM` 型でなければなりません。\n" +"非ブロッキングソケットはサポートされていません。" -#: ../../library/socket.rst:2051 msgid "" "Set the :ref:`inheritable flag ` of the socket's file " "descriptor or socket's handle." msgstr "" "ソケットのファイル記述子、またはソケットのハンドルの、 :ref:`継承可能フラグ " -"` を立てます。" +"` を設定します。" #: ../../library/socket.rst:2059 msgid "" @@ -2733,11 +2924,11 @@ msgstr "``sock.setblocking(True)`` は ``sock.settimeout(None)`` と等価です msgid "``sock.setblocking(False)`` is equivalent to ``sock.settimeout(0.0)``" msgstr "``sock.setblocking(False)`` は ``sock.settimeout(0.0)`` と等価です" -#: ../../library/socket.rst:2068 msgid "" "The method no longer applies :const:`SOCK_NONBLOCK` flag on :attr:`socket." "type`." msgstr "" +":attr:`socket.type` に :const:`SOCK_NONBLOCK` フラグを適用しなくなりました。" #: ../../library/socket.rst:2075 msgid "" @@ -2757,11 +2948,12 @@ msgstr "" "詳しくは :ref:`ソケットタイムアウトの注意事項 ` を参照してく" "ださい。" -#: ../../library/socket.rst:2084 msgid "" "The method no longer toggles :const:`SOCK_NONBLOCK` flag on :attr:`socket." "type`." msgstr "" +":attr:`socket.type` の :const:`SOCK_NONBLOCK` フラグを切り替えなくなりまし" +"た。" #: ../../library/socket.rst:2097 msgid "" @@ -2915,15 +3107,14 @@ msgstr "" msgid "Timeouts and the ``accept`` method" msgstr "タイムアウトと ``accept`` メソッド" -#: ../../library/socket.rst:2204 msgid "" "If :func:`getdefaulttimeout` is not :const:`None`, sockets returned by the :" "meth:`~socket.accept` method inherit that timeout. Otherwise, the behaviour " "depends on settings of the listening socket:" msgstr "" -":func:`getdefaulttimeout` が :const:`None` でない場合、 :meth:`~socket." -"accept` メソッドが返すソケットでは、そのタイムアウトが継承されます。 :const:" -"`None` である場合、待機中のソケットの設定によって動作は異なります。" +":func:`getdefaulttimeout` の戻り値が :const:`None` でなければ、:meth:" +"`~socket.accept` メソッドが返すソケットはそのタイムアウトを引き継ぎます。\n" +"そうでなければ、動作は接続を待ち受けるソケットの設定によって異なります:" #: ../../library/socket.rst:2208 msgid "" @@ -2950,7 +3141,6 @@ msgstr "" msgid "Example" msgstr "使用例" -#: ../../library/socket.rst:2222 msgid "" "Here are four minimal example programs using the TCP/IP protocol: a server " "that echoes all data that it receives back (servicing only one client), and " @@ -2962,12 +3152,22 @@ msgid "" "`~socket.sendall`/:meth:`~socket.recv` on the socket it is listening on but " "on the new socket returned by :meth:`~socket.accept`." msgstr "" +"以下に TCP/IP プロトコルを使う最小限のサンプルプログラムを 4 つ示します。\n" +"受信したすべてのデータをそのまま送り返すサーバ (クライアント 1 つだけを処理) " +"と、それを使うクライアントです。\n" +"サーバでは :func:`~socket.socket`、:meth:`~socket.bind`、:meth:`~socket." +"listen`、:meth:`~socket.accept` の順に実行する必要があります (複数のクライア" +"ントを処理するには :meth:`~socket.accept` を繰り返します)。\n" +"一方、クライアントで必要なのは :func:`~socket.socket`、:meth:`~socket." +"connect` の順に実行することだけです。\n" +"また、サーバは接続を待ち受けるソケットではなく、:meth:`~socket.accept` が返し" +"た新しいソケットで :meth:`~socket.sendall` と :meth:`~socket.recv` を行うこと" +"にも注意してください。" #: ../../library/socket.rst:2232 msgid "The first two examples support IPv4 only. ::" msgstr "次のクライアントとサーバは、IPv4 のみをサポートしています。 ::" -#: ../../library/socket.rst:2234 msgid "" "# Echo server program\n" "import socket\n" @@ -2985,8 +3185,22 @@ msgid "" " if not data: break\n" " conn.sendall(data)" msgstr "" +"# エコーサーバのプログラム\n" +"import socket\n" +"\n" +"HOST = '' # 利用可能なすべてのインターフェースを表す名前\n" +"PORT = 50007 # 特権を必要としない任意のポート\n" +"with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:\n" +" s.bind((HOST, PORT))\n" +" s.listen(1)\n" +" conn, addr = s.accept()\n" +" with conn:\n" +" print('Connected by', addr)\n" +" while True:\n" +" data = conn.recv(1024)\n" +" if not data: break\n" +" conn.sendall(data)" -#: ../../library/socket.rst:2252 msgid "" "# Echo client program\n" "import socket\n" @@ -2999,8 +3213,17 @@ msgid "" " data = s.recv(1024)\n" "print('Received', repr(data))" msgstr "" +"# エコークライアントのプログラム\n" +"import socket\n" +"\n" +"HOST = 'daring.cwi.nl' # リモートホスト\n" +"PORT = 50007 # サーバが使うポートと同じ番号\n" +"with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:\n" +" s.connect((HOST, PORT))\n" +" s.sendall(b'Hello, world')\n" +" data = s.recv(1024)\n" +"print('Received', repr(data))" -#: ../../library/socket.rst:2263 msgid "" "The next two examples are identical to the above two, but support both IPv4 " "and IPv6. The server side will listen to the first address family available " @@ -3009,8 +3232,14 @@ msgid "" "will try to connect to all the addresses returned as a result of the name " "resolution, and sends traffic to the first one connected successfully. ::" msgstr "" +"次の 2 つの例は上の 2 つと同じですが、IPv4 と IPv6 の両方をサポートします。\n" +"サーバ側は最初に利用できたアドレスファミリーで接続を待ち受けます (本来は両方" +"で待ち受けるべきです)。\n" +"IPv6 対応のほとんどのシステムでは IPv6 が優先されるため、サーバが IPv4 の通信" +"を受け入れないことがあります。\n" +"クライアント側は名前解決で得られたすべてのアドレスへの接続を試み、最初に接続" +"できたアドレスにデータを送信します。 ::" -#: ../../library/socket.rst:2270 msgid "" "# Echo server program\n" "import socket\n" @@ -3046,8 +3275,40 @@ msgid "" " if not data: break\n" " conn.send(data)" msgstr "" +"# エコーサーバのプログラム\n" +"import socket\n" +"import sys\n" +"\n" +"HOST = None # 利用可能なすべてのインターフェースを表す名前\n" +"PORT = 50007 # 特権を必要としない任意のポート\n" +"s = None\n" +"for res in socket.getaddrinfo(HOST, PORT, socket.AF_UNSPEC,\n" +" socket.SOCK_STREAM, 0, socket.AI_PASSIVE):\n" +" af, socktype, proto, canonname, sa = res\n" +" try:\n" +" s = socket.socket(af, socktype, proto)\n" +" except OSError as msg:\n" +" s = None\n" +" continue\n" +" try:\n" +" s.bind(sa)\n" +" s.listen(1)\n" +" except OSError as msg:\n" +" s.close()\n" +" s = None\n" +" continue\n" +" break\n" +"if s is None:\n" +" print('could not open socket')\n" +" sys.exit(1)\n" +"conn, addr = s.accept()\n" +"with conn:\n" +" print('Connected by', addr)\n" +" while True:\n" +" data = conn.recv(1024)\n" +" if not data: break\n" +" conn.send(data)" -#: ../../library/socket.rst:2306 msgid "" "# Echo client program\n" "import socket\n" @@ -3079,6 +3340,35 @@ msgid "" " data = s.recv(1024)\n" "print('Received', repr(data))" msgstr "" +"# エコークライアントのプログラム\n" +"import socket\n" +"import sys\n" +"\n" +"HOST = 'daring.cwi.nl' # リモートホスト\n" +"PORT = 50007 # サーバが使うポートと同じ番号\n" +"s = None\n" +"for res in socket.getaddrinfo(HOST, PORT, socket.AF_UNSPEC, socket." +"SOCK_STREAM):\n" +" af, socktype, proto, canonname, sa = res\n" +" try:\n" +" s = socket.socket(af, socktype, proto)\n" +" except OSError as msg:\n" +" s = None\n" +" continue\n" +" try:\n" +" s.connect(sa)\n" +" except OSError as msg:\n" +" s.close()\n" +" s = None\n" +" continue\n" +" break\n" +"if s is None:\n" +" print('could not open socket')\n" +" sys.exit(1)\n" +"with s:\n" +" s.sendall(b'Hello, world')\n" +" data = s.recv(1024)\n" +"print('Received', repr(data))" #: ../../library/socket.rst:2335 msgid "" @@ -3090,7 +3380,6 @@ msgstr "" "ファーを書きます。このサンプルを実行するには、インターフェースを操作するため" "の管理者権限が必要です::" -#: ../../library/socket.rst:2339 msgid "" "import socket\n" "\n" @@ -3113,20 +3402,39 @@ msgid "" "# disabled promiscuous mode\n" "s.ioctl(socket.SIO_RCVALL, socket.RCVALL_OFF)" msgstr "" +"import socket\n" +"\n" +"# 外部向けのネットワークインターフェース\n" +"HOST = socket.gethostbyname(socket.gethostname())\n" +"\n" +"# raw ソケットを作成し、外部向けのインターフェースにバインドする\n" +"s = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_IP)\n" +"s.bind((HOST, 0))\n" +"\n" +"# IP ヘッダーを含める\n" +"s.setsockopt(socket.IPPROTO_IP, socket.IP_HDRINCL, 1)\n" +"\n" +"# すべてのパケットを受信する\n" +"s.ioctl(socket.SIO_RCVALL, socket.RCVALL_ON)\n" +"\n" +"# パケットを 1 つ受信する\n" +"print(s.recvfrom(65565))\n" +"\n" +"# プロミスキャスモードを無効にする\n" +"s.ioctl(socket.SIO_RCVALL, socket.RCVALL_OFF)" -#: ../../library/socket.rst:2360 msgid "" "The next example shows how to use the socket interface to communicate to a " "CAN network using the raw socket protocol. To use CAN with the broadcast " "manager protocol instead, open a socket with::" msgstr "" "次の例では、ソケットインターフェースを使用してローソケットプロトコルを使用す" -"る CAN ネットワークと通信する方法を説明します。ブロードキャストマネージャプロ" -"トコロルで CAN を使用するには、以下でソケットを開きます。" +"る CAN ネットワークと通信する方法を説明します。\n" +"ブロードキャストマネージャプロトコルで CAN を使用するには、以下でソケットを開" +"きます。 ::" -#: ../../library/socket.rst:2364 msgid "socket.socket(socket.AF_CAN, socket.SOCK_DGRAM, socket.CAN_BCM)" -msgstr "" +msgstr "socket.socket(socket.AF_CAN, socket.SOCK_DGRAM, socket.CAN_BCM)" #: ../../library/socket.rst:2366 msgid "" @@ -3142,7 +3450,6 @@ msgstr "" msgid "This last example might require special privileges::" msgstr "最後の例では、特権が必要になるかもしれません::" -#: ../../library/socket.rst:2372 msgid "" "import socket\n" "import struct\n" @@ -3183,6 +3490,45 @@ msgid "" " except OSError:\n" " print('Error sending CAN frame')" msgstr "" +"import socket\n" +"import struct\n" +"\n" +"\n" +"# CAN フレームのパックとアンパック ( の 'struct can_frame' を参" +"照)\n" +"\n" +"can_frame_fmt = \"=IB3x8s\"\n" +"can_frame_size = struct.calcsize(can_frame_fmt)\n" +"\n" +"def build_can_frame(can_id, data):\n" +" can_dlc = len(data)\n" +" data = data.ljust(8, b'\\x00')\n" +" return struct.pack(can_frame_fmt, can_id, can_dlc, data)\n" +"\n" +"def dissect_can_frame(frame):\n" +" can_id, can_dlc, data = struct.unpack(can_frame_fmt, frame)\n" +" return (can_id, can_dlc, data[:can_dlc])\n" +"\n" +"\n" +"# raw ソケットを作成し、'vcan0' インターフェースにバインドする\n" +"s = socket.socket(socket.AF_CAN, socket.SOCK_RAW, socket.CAN_RAW)\n" +"s.bind(('vcan0',))\n" +"\n" +"while True:\n" +" cf, addr = s.recvfrom(can_frame_size)\n" +"\n" +" print('Received: can_id=%x, can_dlc=%x, data=%s' % " +"dissect_can_frame(cf))\n" +"\n" +" try:\n" +" s.send(cf)\n" +" except OSError:\n" +" print('Error sending CAN frame')\n" +"\n" +" try:\n" +" s.send(build_can_frame(0x01, b'\\x01\\x02\\x03'))\n" +" except OSError:\n" +" print('Error sending CAN frame')" #: ../../library/socket.rst:2410 msgid "" @@ -3192,9 +3538,8 @@ msgstr "" "この例を、ほとんど間を空けずに複数回実行すると、以下のエラーが発生する場合が" "あります::" -#: ../../library/socket.rst:2413 msgid "OSError: [Errno 98] Address already in use" -msgstr "" +msgstr "OSError: [Errno 98] Address already in use" #: ../../library/socket.rst:2415 msgid "" @@ -3210,12 +3555,14 @@ msgid "" "`socket.SO_REUSEADDR`::" msgstr "" -#: ../../library/socket.rst:2421 msgid "" "s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n" "s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)\n" "s.bind((HOST, PORT))" msgstr "" +"s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n" +"s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)\n" +"s.bind((HOST, PORT))" #: ../../library/socket.rst:2425 msgid "" @@ -3226,12 +3573,11 @@ msgstr "" "のタイムアウト期限が自然に切れるのを待つことなく再利用することをカーネルに伝" "えます。" -#: ../../library/socket.rst:2431 msgid "" "For an introduction to socket programming (in C), see the following papers:" msgstr "" "C 言語によるソケットプログラミングの基礎については、以下の資料を参照してくだ" -"さい。 " +"さい。" #: ../../library/socket.rst:2433 msgid "" diff --git a/library/socketserver.po b/library/socketserver.po index 97bfc28be..2a0258a34 100644 --- a/library/socketserver.po +++ b/library/socketserver.po @@ -20,10 +20,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/socketserver.rst:2 @@ -42,9 +42,8 @@ msgstr "" ":mod:`socketserver` モジュールはネットワークサーバを実装するタスクを単純化し" "ます。" -#: ../../includes/wasm-notavail.rst:3 msgid "Availability" -msgstr "" +msgstr "利用可能な環境" #: ../../includes/wasm-notavail.rst:5 msgid "" @@ -58,7 +57,6 @@ msgstr "" msgid "There are four basic concrete server classes:" msgstr "基本的な具象サーバクラスが4つあります:" -#: ../../library/socketserver.rst:20 msgid "" "This uses the internet TCP protocol, which provides for continuous streams " "of data between the client and server. If *bind_and_activate* is true, the " @@ -66,20 +64,32 @@ msgid "" "and :meth:`~BaseServer.server_activate`. The other parameters are passed to " "the :class:`BaseServer` base class." msgstr "" +"クライアントとサーバの間で連続したデータストリームを提供する、インターネット" +"の TCP プロトコルを使います。\n" +"*bind_and_activate* が真の場合、コンストラクターは :meth:`~BaseServer." +"server_bind` と :meth:`~BaseServer.server_activate` を自動的に呼び出そうとし" +"ます。\n" +"ほかの引数は基底クラス :class:`BaseServer` に渡されます。" -#: ../../library/socketserver.rst:30 msgid "" "This uses datagrams, which are discrete packets of information that may " "arrive out of order or be lost while in transit. The parameters are the " "same as for :class:`TCPServer`." msgstr "" +"データグラムを使います。\n" +"データグラムは個々に独立した情報のパケットで、順序が入れ替わって到着したり、" +"転送中に失われたりすることがあります。\n" +"引数は :class:`TCPServer` と同じです。" -#: ../../library/socketserver.rst:38 msgid "" "These more infrequently used classes are similar to the TCP and UDP classes, " "but use Unix domain sockets; they're not available on non-Unix platforms. " "The parameters are the same as for :class:`TCPServer`." msgstr "" +"あまり使われないこれらのクラスは TCP や UDP のクラスと似ていますが、Unix ドメ" +"インソケットを使います。\n" +"Unix 以外のプラットフォームでは利用できません。\n" +"引数は :class:`TCPServer` と同じです。" #: ../../library/socketserver.rst:44 msgid "" @@ -124,7 +134,6 @@ msgstr "" "に、(:keyword:`!with` 文を使っていなかったなら) :meth:`~BaseServer." "server_close` を呼び出してソケットを閉じます。" -#: ../../library/socketserver.rst:64 msgid "" "When inheriting from :class:`ThreadingMixIn` for threaded connection " "behavior, you should explicitly declare how you want your threads to behave " @@ -135,12 +144,14 @@ msgid "" "meaning that Python will not exit until all threads created by :class:" "`ThreadingMixIn` have exited." msgstr "" -":class:`ThreadingMixIn` から継承してスレッドを利用した接続を行う場合、突発的" -"な通信切断時の処理を明示的に指定する必要があります。 :class:`ThreadingMixIn` " -"クラスには *daemon_threads* 属性があり、サーバがスレッドの終了を待ち合わせる" -"かどうかを指定する事ができます。スレッドが独自の処理を行う場合は、このフラグ" -"を明示的に指定します。デフォルトは :const:`False` で、Pythonは :class:" -"`ThreadingMixIn` クラスが起動した全てのスレッドが終了するまで実行し続けます。" +":class:`ThreadingMixIn` から継承してスレッドを利用した接続を行う場合、突然終" +"了する場合のスレッドの動作を明示的に指定する必要があります。\n" +":class:`ThreadingMixIn` クラスには *daemon_threads* 属性があり、サーバがス" +"レッドの終了を待ち合わせるかどうかを指定する事ができます。\n" +"スレッドの終了を待たずに終了させたい場合は、このフラグを明示的に設定してくだ" +"さい。\n" +"デフォルトは :const:`False` で、Pythonは :class:`ThreadingMixIn` クラスが起動" +"した全てのスレッドが終了するまで実行し続けます。" #: ../../library/socketserver.rst:73 msgid "" @@ -161,7 +172,6 @@ msgid "" msgstr "" "継承図にある五つのクラスのうち四つは四種類の同期サーバを表わしています::" -#: ../../library/socketserver.rst:83 msgid "" "+------------+\n" "| BaseServer |\n" @@ -177,6 +187,19 @@ msgid "" "| UDPServer |------->| UnixDatagramServer |\n" "+-----------+ +--------------------+" msgstr "" +"+------------+\n" +"| BaseServer |\n" +"+------------+\n" +" |\n" +" v\n" +"+-----------+ +------------------+\n" +"| TCPServer |------->| UnixStreamServer |\n" +"+-----------+ +------------------+\n" +" |\n" +" v\n" +"+-----------+ +--------------------+\n" +"| UDPServer |------->| UnixDatagramServer |\n" +"+-----------+ +--------------------+" #: ../../library/socketserver.rst:97 msgid "" @@ -198,11 +221,12 @@ msgstr "" "れらのミクシン(mix-in)クラスを使って作ることができます。たとえば、:class:" "`ThreadingUDPServer` は以下のようにして作られます::" -#: ../../library/socketserver.rst:109 msgid "" "class ThreadingUDPServer(ThreadingMixIn, UDPServer):\n" " pass" msgstr "" +"class ThreadingUDPServer(ThreadingMixIn, UDPServer):\n" +" pass" #: ../../library/socketserver.rst:112 msgid "" @@ -214,41 +238,49 @@ msgstr "" "めに、最初に来ます。様々な属性を設定することで元になるサーバ機構の振る舞いを" "変えられます。" -#: ../../library/socketserver.rst:116 msgid "" ":class:`ForkingMixIn` and the Forking classes mentioned below are only " "available on POSIX platforms that support :func:`~os.fork`." msgstr "" +":class:`ForkingMixIn` と以下で説明する Forking クラスは、:func:`~os.fork` を" +"サポートする POSIX プラットフォームでのみ利用できます。" -#: ../../library/socketserver.rst:121 msgid "" ":meth:`ForkingMixIn.server_close ` waits until all " "child processes complete, except if :attr:`block_on_close` attribute is " "``False``." msgstr "" +":meth:`ForkingMixIn.server_close ` は、:attr:" +"`block_on_close` 属性が ``False`` でない限り、すべての子プロセスの終了を待ち" +"ます。" -#: ../../library/socketserver.rst:125 msgid "" ":meth:`ThreadingMixIn.server_close ` waits until " "all non-daemon threads complete, except if :attr:`block_on_close` attribute " "is ``False``." msgstr "" +":meth:`ThreadingMixIn.server_close ` は、:attr:" +"`block_on_close` 属性が ``False`` でない限り、すべての非デーモンスレッドの終" +"了を待ちます。" -#: ../../library/socketserver.rst:131 msgid "" "Specify how many child processes will exist to handle requests at a time " "for :class:`ForkingMixIn`. If the limit is reached, new requests will wait " "until one child process has finished." msgstr "" +":class:`ForkingMixIn` で、同時に要求を処理する子プロセスの最大数を指定しま" +"す。\n" +"上限に達すると、新たな要求は子プロセスが 1 つ終了するまで待機します。" -#: ../../library/socketserver.rst:137 msgid "" "For :class:`ThreadingMixIn` use daemonic threads by setting :data:" "`ThreadingMixIn.daemon_threads ` to ``True`` to not wait " "until threads complete." msgstr "" +":class:`ThreadingMixIn` でスレッドの終了を待たないようにするには、:data:" +"`ThreadingMixIn.daemon_threads ` を ``True`` に設定してデーモ" +"ンスレッドを使ってください。" -#: ../../library/socketserver.rst:143 msgid "" ":meth:`ForkingMixIn.server_close ` and :meth:" "`ThreadingMixIn.server_close ` now waits until all " @@ -256,16 +288,21 @@ msgid "" "`ForkingMixIn.block_on_close ` class attribute to opt-in for " "the pre-3.7 behaviour." msgstr "" +":meth:`ForkingMixIn.server_close ` と :meth:" +"`ThreadingMixIn.server_close ` は、すべての子プロセ" +"スと非デーモンスレッドが終了するまで待つようになりました。\n" +"3.7 より前の動作を選べるよう、クラス属性 :attr:`ForkingMixIn.block_on_close " +"` が追加されました。" -#: ../../library/socketserver.rst:159 msgid "These classes are pre-defined using the mix-in classes." -msgstr "" +msgstr "これらのクラスは、ミクシンクラスを使ってあらかじめ定義されています。" -#: ../../library/socketserver.rst:161 msgid "" "The ``ForkingUnixStreamServer`` and ``ForkingUnixDatagramServer`` classes " "were added." msgstr "" +"``ForkingUnixStreamServer`` クラスと ``ForkingUnixDatagramServer`` クラスが追" +"加されました。" #: ../../library/socketserver.rst:165 msgid "" @@ -329,7 +366,6 @@ msgstr "" "処理方法は同期サーバを使って要求処理クラスの :meth:`~BaseRequestHandler." "handle` メソッドの中で自分でフォークするようにして実装することができます。" -#: ../../library/socketserver.rst:191 msgid "" "Another approach to handling multiple simultaneous requests in an " "environment that supports neither threads nor :func:`~os.fork` (or where " @@ -340,18 +376,29 @@ msgid "" "client can potentially be connected for a long time (if threads or " "subprocesses cannot be used)." msgstr "" +"スレッドも :func:`~os.fork` もサポートされていない環境 (あるいはコストが高す" +"ぎたり、そのサービスに適さなかったりする場合) で複数の要求を同時に処理する方" +"法もあります。\n" +"処理途中の要求を明示的に表で管理し、:mod:`selectors` を使って次に処理する要" +"求 (または新しく届いた要求を処理するかどうか) を決める方法です。\n" +"これは、各クライアントが長時間接続し続ける可能性のあるストリームサービスで、" +"スレッドやサブプロセスを使えない場合に特に重要です。" #: ../../library/socketserver.rst:204 msgid "Server Objects" msgstr "Serverオブジェクト" -#: ../../library/socketserver.rst:208 msgid "" "This is the superclass of all Server objects in the module. It defines the " "interface, given below, but does not implement most of the methods, which is " "done in subclasses. The two parameters are stored in the respective :attr:" "`server_address` and :attr:`RequestHandlerClass` attributes." msgstr "" +"このモジュールのすべてのサーバオブジェクトのスーパークラスです。\n" +"以下のインターフェースを定義しますが、ほとんどのメソッドは実装せず、サブクラ" +"スで実装します。\n" +"2 つの引数は、それぞれ :attr:`server_address` 属性と :attr:" +"`RequestHandlerClass` 属性に格納されます。" #: ../../library/socketserver.rst:216 msgid "" @@ -380,7 +427,6 @@ msgstr "" "attr:`timeout` 秒以内にリクエストが来なかった場合、 :meth:`handle_timeout` が" "呼ばれて、 :meth:`handle_request` が終了します。" -#: ../../library/socketserver.rst:235 msgid "" "Handle requests until an explicit :meth:`shutdown` request. Poll for " "shutdown every *poll_interval* seconds. Ignores the :attr:`timeout` " @@ -389,30 +435,41 @@ msgid "" "example, the :class:`ForkingMixIn` class uses :meth:`service_actions` to " "clean up zombie child processes." msgstr "" +":meth:`shutdown` が明示的に要求されるまで、要求を処理します。\n" +"*poll_interval* 秒ごとに終了要求の有無を調べます。\n" +":attr:`timeout` 属性は無視します。\n" +"また、:meth:`service_actions` も呼び出します。\n" +"サブクラスやミクシンは、このメソッドを使ってサービス固有の処理を行えます。\n" +"例えば :class:`ForkingMixIn` は :meth:`service_actions` を使ってゾンビ状態の" +"子プロセスを回収します。" -#: ../../library/socketserver.rst:243 msgid "Added ``service_actions`` call to the ``serve_forever`` method." msgstr "" +"``serve_forever`` メソッドに ``service_actions`` の呼び出しが追加されました。" -#: ../../library/socketserver.rst:249 msgid "" "This is called in the :meth:`serve_forever` loop. This method can be " "overridden by subclasses or mixin classes to perform actions specific to a " "given service, such as cleanup actions." msgstr "" +":meth:`serve_forever` のループ内で呼び出されます。\n" +"サブクラスやミクシンクラスでオーバーライドして、クリーンアップなどのサービス" +"固有の処理を行えます。" -#: ../../library/socketserver.rst:257 msgid "" "Tell the :meth:`serve_forever` loop to stop and wait until it does. :meth:" "`shutdown` must be called while :meth:`serve_forever` is running in a " "different thread otherwise it will deadlock." msgstr "" +":meth:`serve_forever` のループに停止を指示し、停止するまで待ちます。\n" +":meth:`shutdown` は、:meth:`serve_forever` が別のスレッドで実行されている間に" +"呼び出す必要があります。\n" +"そうしないとデッドロックします。" #: ../../library/socketserver.rst:264 msgid "Clean up the server. May be overridden." msgstr "サーバをクリーンアップします。上書き出来ます。" -#: ../../library/socketserver.rst:269 msgid "" "The family of protocols to which the server's socket belongs. Common " "examples are :const:`socket.AF_INET`, :const:`socket.AF_INET6`, and :const:" @@ -420,6 +477,11 @@ msgid "" "with class attribute ``address_family = AF_INET6`` set if you want IPv6 " "server classes." msgstr "" +"サーバのソケットが属するプロトコルファミリーです。\n" +"よく使われるものには :const:`socket.AF_INET`、:const:`socket.AF_INET6`、:" +"const:`socket.AF_UNIX` があります。\n" +"IPv6 サーバのクラスが必要な場合は、このモジュールの TCP または UDP サーバクラ" +"スを継承し、クラス属性を ``address_family = AF_INET6`` と設定してください。" #: ../../library/socketserver.rst:278 msgid "" @@ -531,9 +593,9 @@ msgstr "" "の動作では標準エラー出力へトレースバックを出力し、後続する要求を継続して処理" "します。" -#: ../../library/socketserver.rst:355 msgid "Now only called for exceptions derived from the :exc:`Exception` class." msgstr "" +":exc:`Exception` クラスから派生した例外に対してのみ呼び出すようになりました。" #: ../../library/socketserver.rst:362 msgid "" @@ -560,12 +622,15 @@ msgstr "" "求を処理することができます; その処理は :class:`ForkingMixIn` または :class:" "`ThreadingMixIn` クラスが行います。" -#: ../../library/socketserver.rst:383 msgid "" "Called by the server's constructor to activate the server. The default " "behavior for a TCP server just invokes :meth:`~socket.socket.listen` on the " "server's socket. May be overridden." msgstr "" +"サーバを有効にするために、サーバのコンストラクターから呼び出されます。\n" +"TCP サーバのデフォルトの動作は、サーバのソケットに対して :meth:`~socket." +"socket.listen` を呼び出すだけです。\n" +"オーバーライドできます。" #: ../../library/socketserver.rst:390 msgid "" @@ -595,17 +660,20 @@ msgstr "" ":term:`context manager` プロトコルのサポートが追加されました。コンテキストマ" "ネージャを終了することは、 :meth:`server_close` を呼ぶことと同一です。" -#: ../../library/socketserver.rst:408 msgid "Request Handler Objects" -msgstr "" +msgstr "要求処理オブジェクト" -#: ../../library/socketserver.rst:412 msgid "" "This is the superclass of all request handler objects. It defines the " "interface, given below. A concrete request handler subclass must define a " "new :meth:`handle` method, and can override any of the other methods. A new " "instance of the subclass is created for each request." msgstr "" +"すべての要求処理オブジェクトのスーパークラスです。\n" +"以下のインターフェースを定義します。\n" +"具象の要求処理サブクラスは :meth:`handle` メソッドを新たに定義する必要があ" +"り、ほかのメソッドもオーバーライドできます。\n" +"要求ごとにサブクラスの新しいインスタンスを作成します。" #: ../../library/socketserver.rst:421 msgid "" @@ -615,7 +683,6 @@ msgstr "" ":meth:`handle` メソッドより前に呼び出され、何らかの必要な初期化処理を行いま" "す。標準の実装では何も行いません。" -#: ../../library/socketserver.rst:427 msgid "" "This function must do all the work required to service a request. The " "default implementation does nothing. Several instance attributes are " @@ -623,13 +690,23 @@ msgid "" "address as :attr:`client_address`; and the server instance as :attr:" "`server`, in case it needs access to per-server information." msgstr "" +"この関数は、要求に応えるために必要なすべての処理を行わなければなりません。\n" +"デフォルトの実装は何もしません。\n" +"いくつかのインスタンス属性を利用できます。\n" +"要求は :attr:`request`、クライアントのアドレスは :attr:`client_address` に格" +"納されています。\n" +"サーバ固有の情報が必要な場合は、:attr:`server` からサーバのインスタンスにアク" +"セスできます。" -#: ../../library/socketserver.rst:433 msgid "" "The type of :attr:`request` is different for datagram or stream services. " "For stream services, :attr:`request` is a socket object; for datagram " "services, :attr:`request` is a pair of string and socket." msgstr "" +":attr:`request` の型は、データグラムサービスとストリームサービスで異なりま" +"す。\n" +"ストリームサービスでは :attr:`request` はソケットオブジェクトです。\n" +"データグラムサービスでは :attr:`request` はバイト列とソケットのペアです。" #: ../../library/socketserver.rst:440 msgid "" @@ -647,38 +724,42 @@ msgid "" "client." msgstr "" -#: ../../library/socketserver.rst:453 msgid "Client address returned by :meth:`BaseServer.get_request`." -msgstr "" +msgstr ":meth:`BaseServer.get_request` が返したクライアントのアドレスです。" -#: ../../library/socketserver.rst:458 msgid ":class:`BaseServer` object used for handling the request." -msgstr "" +msgstr "要求の処理に使う :class:`BaseServer` オブジェクトです。" -#: ../../library/socketserver.rst:464 msgid "" "These :class:`BaseRequestHandler` subclasses override the :meth:" "`~BaseRequestHandler.setup` and :meth:`~BaseRequestHandler.finish` methods, " "and provide :attr:`rfile` and :attr:`wfile` attributes." msgstr "" +"これらの :class:`BaseRequestHandler` のサブクラスは、:meth:" +"`~BaseRequestHandler.setup` メソッドと :meth:`~BaseRequestHandler.finish` メ" +"ソッドをオーバーライドし、:attr:`rfile` 属性と :attr:`wfile` 属性を提供しま" +"す。" -#: ../../library/socketserver.rst:470 msgid "" "A file object from which receives the request is read. Support the :class:" "`io.BufferedIOBase` readable interface." msgstr "" +"受信した要求を読み取るためのファイルオブジェクトです。\n" +":class:`io.BufferedIOBase` の読み取り用インターフェースをサポートします。" -#: ../../library/socketserver.rst:475 msgid "" "A file object to which the reply is written. Support the :class:`io." "BufferedIOBase` writable interface" msgstr "" +"応答を書き込むためのファイルオブジェクトです。\n" +":class:`io.BufferedIOBase` の書き込み用インターフェースをサポートします。" -#: ../../library/socketserver.rst:479 msgid "" ":attr:`wfile` also supports the :class:`io.BufferedIOBase` writable " "interface." msgstr "" +":attr:`wfile` も :class:`io.BufferedIOBase` の書き込み用インターフェースをサ" +"ポートするようになりました。" #: ../../library/socketserver.rst:485 msgid "Examples" @@ -692,7 +773,6 @@ msgstr ":class:`socketserver.TCPServer` の例" msgid "This is the server side::" msgstr "サーバサイドの例です::" -#: ../../library/socketserver.rst:492 msgid "" "import socketserver\n" "\n" @@ -728,6 +808,39 @@ msgid "" " # interrupt the program with Ctrl-C\n" " server.serve_forever()" msgstr "" +"import socketserver\n" +"\n" +"class MyTCPHandler(socketserver.BaseRequestHandler):\n" +" \"\"\"\n" +" このサーバの要求処理クラス。\n" +"\n" +" サーバへの接続ごとに 1 回インスタンス化される。\n" +" handle() メソッドをオーバーライドして、\n" +" クライアントとの通信を実装する必要がある。\n" +" \"\"\"\n" +"\n" +" def handle(self):\n" +" # self.request はクライアントと接続された TCP ソケット\n" +" pieces = [b'']\n" +" total = 0\n" +" while b'\\n' not in pieces[-1] and total < 10_000:\n" +" pieces.append(self.request.recv(2000))\n" +" total += len(pieces[-1])\n" +" self.data = b''.join(pieces)\n" +" print(f\"Received from {self.client_address[0]}:\")\n" +" print(self.data.decode(\"utf-8\"))\n" +" # 同じデータを大文字に変えて送り返す\n" +" self.request.sendall(self.data.upper())\n" +" # このメソッドから戻るとソケットは閉じられる。\n" +"\n" +"if __name__ == \"__main__\":\n" +" HOST, PORT = \"localhost\", 9999\n" +"\n" +" # localhost のポート 9999 にバインドしてサーバを作成する\n" +" with socketserver.TCPServer((HOST, PORT), MyTCPHandler) as server:\n" +" # サーバを起動する。\n" +" # Ctrl-C でプログラムを中断するまで動き続ける。\n" +" server.serve_forever()" #: ../../library/socketserver.rst:526 msgid "" @@ -738,7 +851,6 @@ msgstr "" "別の、ストリーム(標準のファイル型のインターフェースを利用して通信をシンプルに" "したファイルライクオブジェクト)を使うリクエストハンドラクラスの例です::" -#: ../../library/socketserver.rst:529 msgid "" "class MyTCPHandler(socketserver.StreamRequestHandler):\n" "\n" @@ -753,6 +865,18 @@ msgid "" " # to the client\n" " self.wfile.write(self.data.upper())" msgstr "" +"class MyTCPHandler(socketserver.StreamRequestHandler):\n" +"\n" +" def handle(self):\n" +" # self.rfile はハンドラーが作成したファイル類似オブジェクト。\n" +" # recv() を直接呼ぶ代わりに、例えば readline() を使える。\n" +" # 送信側による悪用を防ぐため、10000 バイトに制限する。\n" +" self.data = self.rfile.readline(10000).rstrip()\n" +" print(f\"{self.client_address[0]} wrote:\")\n" +" print(self.data.decode(\"utf-8\"))\n" +" # 同様に、self.wfile はクライアントへの書き込みに使う\n" +" # ファイル類似オブジェクト。\n" +" self.wfile.write(self.data.upper())" #: ../../library/socketserver.rst:542 msgid "" @@ -770,7 +894,6 @@ msgstr "" msgid "This is the client side::" msgstr "クライアントサイドの例::" -#: ../../library/socketserver.rst:554 msgid "" "import socket\n" "import sys\n" @@ -791,6 +914,24 @@ msgid "" "print(\"Sent: \", data)\n" "print(\"Received:\", received)" msgstr "" +"import socket\n" +"import sys\n" +"\n" +"HOST, PORT = \"localhost\", 9999\n" +"data = \" \".join(sys.argv[1:])\n" +"\n" +"# ソケットを作成する (SOCK_STREAM は TCP ソケットを表す)\n" +"with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:\n" +" # サーバに接続してデータを送信する\n" +" sock.connect((HOST, PORT))\n" +" sock.sendall(bytes(data, \"utf-8\"))\n" +" sock.sendall(b\"\\n\")\n" +"\n" +" # サーバからデータを受信して終了する\n" +" received = str(sock.recv(1024), \"utf-8\")\n" +"\n" +"print(\"Sent: \", data)\n" +"print(\"Received:\", received)" #: ../../library/socketserver.rst:574 ../../library/socketserver.rst:700 msgid "The output of the example should look something like this:" @@ -813,7 +954,6 @@ msgstr "" msgid "Client:" msgstr "クライアント:" -#: ../../library/socketserver.rst:588 msgid "" "$ python TCPClient.py hello world with TCP\n" "Sent: hello world with TCP\n" @@ -822,6 +962,12 @@ msgid "" "Sent: python is nice\n" "Received: PYTHON IS NICE" msgstr "" +"$ python TCPClient.py hello world with TCP\n" +"Sent: hello world with TCP\n" +"Received: HELLO WORLD WITH TCP\n" +"$ python TCPClient.py python is nice\n" +"Sent: python is nice\n" +"Received: PYTHON IS NICE" #: ../../library/socketserver.rst:599 msgid ":class:`socketserver.UDPServer` Example" @@ -852,7 +998,6 @@ msgid "" " server.serve_forever()" msgstr "" -#: ../../library/socketserver.rst:627 msgid "" "import socket\n" "import sys\n" @@ -871,6 +1016,22 @@ msgid "" "print(\"Sent: \", data)\n" "print(\"Received:\", received)" msgstr "" +"import socket\n" +"import sys\n" +"\n" +"HOST, PORT = \"localhost\", 9999\n" +"data = \" \".join(sys.argv[1:])\n" +"\n" +"# SOCK_DGRAM は UDP ソケットに使うソケットの種類\n" +"sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n" +"\n" +"# UDP には接続がないため、connect() は呼び出さない。\n" +"# 代わりに sendto() で受信側へ直接データを送信する。\n" +"sock.sendto(bytes(data + \"\\n\", \"utf-8\"), (HOST, PORT))\n" +"received = str(sock.recv(1024), \"utf-8\")\n" +"\n" +"print(\"Sent: \", data)\n" +"print(\"Received:\", received)" #: ../../library/socketserver.rst:644 msgid "" @@ -894,7 +1055,6 @@ msgstr "" msgid "An example for the :class:`ThreadingMixIn` class::" msgstr ":class:`ThreadingMixIn` クラスの利用例::" -#: ../../library/socketserver.rst:655 msgid "" "import socket\n" "import threading\n" @@ -941,8 +1101,51 @@ msgid "" "\n" " server.shutdown()" msgstr "" +"import socket\n" +"import threading\n" +"import socketserver\n" +"\n" +"class ThreadedTCPRequestHandler(socketserver.BaseRequestHandler):\n" +"\n" +" def handle(self):\n" +" data = str(self.request.recv(1024), 'ascii')\n" +" cur_thread = threading.current_thread()\n" +" response = bytes(\"{}: {}\".format(cur_thread.name, data), 'ascii')\n" +" self.request.sendall(response)\n" +"\n" +"class ThreadedTCPServer(socketserver.ThreadingMixIn, socketserver." +"TCPServer):\n" +" pass\n" +"\n" +"def client(ip, port, message):\n" +" with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:\n" +" sock.connect((ip, port))\n" +" sock.sendall(bytes(message, 'ascii'))\n" +" response = str(sock.recv(1024), 'ascii')\n" +" print(\"Received: {}\".format(response))\n" +"\n" +"if __name__ == \"__main__\":\n" +" # ポート 0 は、未使用の任意のポートを選ぶことを意味する\n" +" HOST, PORT = \"localhost\", 0\n" +"\n" +" server = ThreadedTCPServer((HOST, PORT), ThreadedTCPRequestHandler)\n" +" with server:\n" +" ip, port = server.server_address\n" +"\n" +" # サーバを実行するスレッドを開始する。\n" +" # このスレッドが要求ごとにさらに 1 つスレッドを開始する。\n" +" server_thread = threading.Thread(target=server.serve_forever)\n" +" # メインスレッドの終了時にサーバスレッドも終了させる\n" +" server_thread.daemon = True\n" +" server_thread.start()\n" +" print(\"Server loop running in thread:\", server_thread.name)\n" +"\n" +" client(ip, port, \"Hello World 1\")\n" +" client(ip, port, \"Hello World 2\")\n" +" client(ip, port, \"Hello World 3\")\n" +"\n" +" server.shutdown()" -#: ../../library/socketserver.rst:702 msgid "" "$ python ThreadedTCPServer.py\n" "Server loop running in thread: Thread-1\n" @@ -950,6 +1153,11 @@ msgid "" "Received: Thread-3: Hello World 2\n" "Received: Thread-4: Hello World 3" msgstr "" +"$ python ThreadedTCPServer.py\n" +"Server loop running in thread: Thread-1\n" +"Received: Thread-2: Hello World 1\n" +"Received: Thread-3: Hello World 2\n" +"Received: Thread-4: Hello World 3" #: ../../library/socketserver.rst:711 msgid "" diff --git a/library/spwd.po b/library/spwd.po index 7df32f9e8..4bd6502d3 100644 --- a/library/spwd.po +++ b/library/spwd.po @@ -12,15 +12,14 @@ msgstr "" "PO-Revision-Date: 2024-11-19 01:03+0000\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" -#: ../../library/spwd.rst:2 msgid ":mod:`!spwd` --- The shadow password database" -msgstr "" +msgstr ":mod:`!spwd` --- シャドウパスワードデータベース" #: ../../library/spwd.rst:10 msgid "" @@ -28,15 +27,20 @@ msgid "" "`removed in Python 3.13 ` after being deprecated in " "Python 3.11. The removal was decided in :pep:`594`." msgstr "" +"このモジュールは今や Python 標準ライブラリの一部ではありません。このモジュー" +"ルは Python 3.11 で非推奨となったあと、:ref:`Python 3.13 で削除` されました。削除の決定は :pep:`594` でなされました。" -#: ../../library/spwd.rst:14 msgid "" "A possible replacement is the third-party library :pypi:`python-pam`. This " "library is not supported or maintained by the Python core team." msgstr "" +"代替として、サードパーティの :pypi:`python-pam` ライブラリを検討できます。\n" +"このライブラリは Python コアチームによるサポートや保守の対象ではありません。" -#: ../../library/spwd.rst:17 msgid "" "The last version of Python that provided the :mod:`!spwd` module was `Python " "3.12 `_." msgstr "" +":mod:`!spwd` モジュールを提供していた最後のバージョンは `Python 3.12 " +"`_ です。" diff --git a/library/sqlite3.po b/library/sqlite3.po index 61114fc3f..471e24e06 100644 --- a/library/sqlite3.po +++ b/library/sqlite3.po @@ -21,10 +21,10 @@ msgstr "" "Last-Translator: Arihiro TAKASE, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/sqlite3.rst:2 @@ -130,23 +130,24 @@ msgstr "" "(`cursors`_)やトランザクション(`transactions`_)を含むデータベースの基本概念を" "理解していることを前提としています。" -#: ../../library/sqlite3.rst:75 msgid "" "First, we need to create a new database and open a database connection to " "allow :mod:`!sqlite3` to work with it. Call :func:`sqlite3.connect` to " "create a connection to the database :file:`tutorial.db` in the current " "working directory, implicitly creating it if it does not exist:" msgstr "" -"最初に、新しいデータベースを作成し、データベース接続(connection)を開いて :" -"mod:`!sqlite3` が動作できるようにする必要があります。 :func:`sqlite3." -"connect` を呼び出して、データベース :file:`tutorial.db` への接続を現在の作業" -"ディレクトリに作成します。存在しない場合は暗黙的に作成します。" +"まず、新しいデータベースを作り、:mod:`!sqlite3` から扱えるように接続を開きま" +"す。\n" +":func:`sqlite3.connect` を呼び出して、現在の作業ディレクトリにあるデータベー" +"ス :file:`tutorial.db` に接続します。\n" +"このファイルが存在しなければ、暗黙に作成されます。" -#: ../../library/sqlite3.rst:81 msgid "" "import sqlite3\n" "con = sqlite3.connect(\"tutorial.db\")" msgstr "" +"import sqlite3\n" +"con = sqlite3.connect(\"tutorial.db\")" #: ../../library/sqlite3.rst:86 msgid "" @@ -166,9 +167,8 @@ msgstr "" "用する必要があります。 :meth:`con.cursor() ` を呼び出し" "て :class:`Cursor` を作成してください:" -#: ../../library/sqlite3.rst:93 msgid "cur = con.cursor()" -msgstr "" +msgstr "cur = con.cursor()" #: ../../library/sqlite3.rst:97 msgid "" @@ -186,9 +186,8 @@ msgstr "" "指定はオプションになっています。 :meth:`cur.execute(...) ` を" "呼び出して ``CREATE TABLE`` 文を実行してください:" -#: ../../library/sqlite3.rst:106 msgid "cur.execute(\"CREATE TABLE movie(title, year, score)\")" -msgstr "" +msgstr "cur.execute(\"CREATE TABLE movie(title, year, score)\")" #: ../../library/sqlite3.rst:113 msgid "" @@ -206,37 +205,42 @@ msgstr "" "を実行して、その結果を ``res`` に代入し、結果の行(row)を取得するために :meth:" "`res.fetchone() ` を呼び出します:" -#: ../../library/sqlite3.rst:121 msgid "" ">>> res = cur.execute(\"SELECT name FROM sqlite_master\")\n" ">>> res.fetchone()\n" "('movie',)" msgstr "" +">>> res = cur.execute(\"SELECT name FROM sqlite_master\")\n" +">>> res.fetchone()\n" +"('movie',)" -#: ../../library/sqlite3.rst:127 msgid "" "We can see that the table has been created, as the query returns a :class:" "`tuple` containing the table's name. If we query ``sqlite_master`` for a non-" "existent table ``spam``, :meth:`!res.fetchone` will return ``None``:" msgstr "" +"クエリがテーブル名を含む :class:`tuple` を返すことから、テーブルが作成された" +"と分かります。\n" +"存在しないテーブル ``spam`` を ``sqlite_master`` に問い合わせると、:meth:`!" +"res.fetchone` は ``None`` を返します:" -#: ../../library/sqlite3.rst:132 msgid "" ">>> res = cur.execute(\"SELECT name FROM sqlite_master WHERE name='spam'\")\n" ">>> res.fetchone() is None\n" "True" msgstr "" +">>> res = cur.execute(\"SELECT name FROM sqlite_master WHERE name='spam'\")\n" +">>> res.fetchone() is None\n" +"True" -#: ../../library/sqlite3.rst:138 msgid "" "Now, add two rows of data supplied as SQL literals by executing an " "``INSERT`` statement, once again by calling :meth:`cur.execute(...) `:" msgstr "" -"ここで、 INSERT 文を実行して SQL のリテラルとして提供された 2 行のデータを追" -"加し、 再度 :meth:`cur.execute(...) ` を呼び出して追加します:" +"再び :meth:`cur.execute(...) ` を呼び出して ``INSERT`` 文を実" +"行し、SQL リテラルで指定した 2 行のデータを追加します。" -#: ../../library/sqlite3.rst:142 msgid "" "cur.execute(\"\"\"\n" " INSERT INTO movie VALUES\n" @@ -244,6 +248,11 @@ msgid "" " ('And Now for Something Completely Different', 1971, 7.5)\n" "\"\"\")" msgstr "" +"cur.execute(\"\"\"\n" +" INSERT INTO movie VALUES\n" +" ('Monty Python and the Holy Grail', 1975, 8.2),\n" +" ('And Now for Something Completely Different', 1971, 7.5)\n" +"\"\"\")" #: ../../library/sqlite3.rst:150 msgid "" @@ -258,9 +267,8 @@ msgstr "" "(connection object)の :meth:`con.commit() ` を呼び出して下" "さい:" -#: ../../library/sqlite3.rst:156 msgid "con.commit()" -msgstr "" +msgstr "con.commit()" #: ../../library/sqlite3.rst:160 msgid "" @@ -274,20 +282,21 @@ msgstr "" "execute>` を使用して結果を ``res`` に代入し、 :meth:`res.fetchall() ` を呼び出して下さい:" -#: ../../library/sqlite3.rst:166 msgid "" ">>> res = cur.execute(\"SELECT score FROM movie\")\n" ">>> res.fetchall()\n" "[(8.2,), (7.5,)]" msgstr "" +">>> res = cur.execute(\"SELECT score FROM movie\")\n" +">>> res.fetchall()\n" +"[(8.2,), (7.5,)]" -#: ../../library/sqlite3.rst:172 msgid "" "The result is a :class:`list` of two :class:`!tuple`\\s, one per row, each " "containing that row's ``score`` value." msgstr "" -"結果は、2 つの :class:`タプル ` の :class:`リスト ` で、 それぞ" -"れのタプルにその行の ``score`` 値が含まれています。" +"結果は、2 つの :class:`!tuple` の :class:`リスト ` で、 それぞれのタプ" +"ルにその行の ``score`` 値が含まれています。" #: ../../library/sqlite3.rst:175 msgid "" @@ -297,7 +306,6 @@ msgstr "" "ここで、 :meth:`cur.executemany(...) ` を呼び出して、さら" "に 3 行挿入します:" -#: ../../library/sqlite3.rst:178 msgid "" "data = [\n" " (\"Monty Python Live at the Hollywood Bowl\", 1982, 7.9),\n" @@ -307,6 +315,13 @@ msgid "" "cur.executemany(\"INSERT INTO movie VALUES(?, ?, ?)\", data)\n" "con.commit() # Remember to commit the transaction after executing INSERT." msgstr "" +"data = [\n" +" (\"Monty Python Live at the Hollywood Bowl\", 1982, 7.9),\n" +" (\"Monty Python's The Meaning of Life\", 1983, 7.5),\n" +" (\"Monty Python's Life of Brian\", 1979, 8.0),\n" +"]\n" +"cur.executemany(\"INSERT INTO movie VALUES(?, ?, ?)\", data)\n" +"con.commit() # INSERT の実行後にトランザクションをコミットするのを忘れずに。" #: ../../library/sqlite3.rst:188 msgid "" @@ -329,7 +344,6 @@ msgstr "" "``SELECT`` クエリを実行することで、新しい行が挿入されたことを確認できます。今" "回は、クエリの結果を反復処理します:" -#: ../../library/sqlite3.rst:198 msgid "" ">>> for row in cur.execute(\"SELECT year, title FROM movie ORDER BY " "year\"):\n" @@ -340,6 +354,14 @@ msgid "" "(1982, 'Monty Python Live at the Hollywood Bowl')\n" "(1983, \"Monty Python's The Meaning of Life\")" msgstr "" +">>> for row in cur.execute(\"SELECT year, title FROM movie ORDER BY " +"year\"):\n" +"... print(row)\n" +"(1971, 'And Now for Something Completely Different')\n" +"(1975, 'Monty Python and the Holy Grail')\n" +"(1979, \"Monty Python's Life of Brian\")\n" +"(1982, 'Monty Python Live at the Hollywood Bowl')\n" +"(1983, \"Monty Python's The Meaning of Life\")" #: ../../library/sqlite3.rst:208 msgid "" @@ -360,7 +382,6 @@ msgstr "" "ベースに対してクエリを実行して、データベースがディスクに書き込まれたことを確" "認します:" -#: ../../library/sqlite3.rst:216 msgid "" ">>> con.close()\n" ">>> new_con = sqlite3.connect(\"tutorial.db\")\n" @@ -374,6 +395,17 @@ msgid "" "released in 1975\n" ">>> new_con.close()" msgstr "" +">>> con.close()\n" +">>> new_con = sqlite3.connect(\"tutorial.db\")\n" +">>> new_cur = new_con.cursor()\n" +">>> res = new_cur.execute(\"SELECT title, year FROM movie ORDER BY score " +"DESC\")\n" +">>> title, year = res.fetchone()\n" +">>> print(f'The highest scoring Monty Python movie is {title!r}, released in " +"{year}')\n" +"The highest scoring Monty Python movie is 'Monty Python and the Holy Grail', " +"released in 1975\n" +">>> new_con.close()" #: ../../library/sqlite3.rst:227 msgid "" @@ -431,12 +463,14 @@ msgstr "SQLite データベースとの接続(connection)を開きます。" msgid "Parameters" msgstr "パラメーター" -#: ../../library/sqlite3.rst:270 msgid "" "The path to the database file to be opened. You can pass ``\":memory:\"`` to " "create an `SQLite database existing only in memory `_, and open a connection to it." msgstr "" +"開くデータベースファイルのパスです。\n" +"``\":memory:\"`` を渡すと、`メモリ内にのみ存在する SQLite データベース " +"`_ を作成し、接続を開けます。" #: ../../library/sqlite3.rst:277 msgid "" @@ -460,7 +494,6 @@ msgid "" "types if both flags are set. By default (``0``), type detection is disabled." msgstr "" -#: ../../library/sqlite3.rst:295 msgid "" "Control legacy transaction handling behaviour. See :attr:`Connection." "isolation_level` and :ref:`sqlite3-transaction-control-isolation-level` for " @@ -469,6 +502,14 @@ msgid "" "Has no effect unless :attr:`Connection.autocommit` is set to :const:" "`~sqlite3.LEGACY_TRANSACTION_CONTROL` (the default)." msgstr "" +"従来のトランザクション処理の動作を制御します。\n" +"詳しくは :attr:`Connection.isolation_level` と :ref:`sqlite3-transaction-" +"control-isolation-level` を参照してください。\n" +"``\"DEFERRED\"`` (デフォルト)、``\"EXCLUSIVE\"``、``\"IMMEDIATE\"`` のいずれ" +"かを指定できます。\n" +"トランザクションを暗黙に開始しないようにするには ``None`` を指定します。\n" +":attr:`Connection.autocommit` が :const:`~sqlite3." +"LEGACY_TRANSACTION_CONTROL` (デフォルト) でなければ、効果はありません。" #: ../../library/sqlite3.rst:305 msgid "" @@ -516,7 +557,6 @@ msgstr "" "SQLite に渡すことができ、さまざまな :ref:`sqlite3-uri-tricks` が有効になりま" "す。" -#: ../../library/sqlite3.rst:332 msgid "" "Control :pep:`249` transaction handling behaviour. See :attr:`Connection." "autocommit` and :ref:`sqlite3-transaction-control-autocommit` for more " @@ -524,26 +564,30 @@ msgid "" "LEGACY_TRANSACTION_CONTROL`. The default will change to ``False`` in a " "future Python release." msgstr "" +":pep:`249` に従うトランザクション処理の動作を制御します。\n" +"詳しくは :attr:`Connection.autocommit` と :ref:`sqlite3-transaction-control-" +"autocommit` を参照してください。\n" +"現在の *autocommit* のデフォルトは :const:`~sqlite3." +"LEGACY_TRANSACTION_CONTROL` です。\n" +"将来の Python リリースでは、デフォルトが ``False`` に変わります。" #: ../../library/sqlite3.rst:0 msgid "Return type" msgstr "戻り値型" -#: ../../library/sqlite3.rst:343 msgid "" "Raises an :ref:`auditing event ` ``sqlite3.connect`` with argument " "``database``." msgstr "" "引数 ``database`` を指定して :ref:`監査イベント ` ``sqlite3." -"connect`` を送出します。 " +"connect`` を送出します。" -#: ../../library/sqlite3.rst:344 msgid "" "Raises an :ref:`auditing event ` ``sqlite3.connect/handle`` with " "argument ``connection_handle``." msgstr "" "引数 ``connection_handle`` を指定して :ref:`監査イベント ` " -"``sqlite3.connect/handle`` を送出します。 " +"``sqlite3.connect/handle`` を送出します。" #: ../../library/sqlite3.rst:346 msgid "Added the *uri* parameter." @@ -556,13 +600,11 @@ msgstr "" "*database* は、文字列だけでなく、 :term:`path-like object` にすることもできる" "ようになりました。" -#: ../../library/sqlite3.rst:352 msgid "Added the ``sqlite3.connect/handle`` auditing event." -msgstr "" +msgstr "監査イベント ``sqlite3.connect/handle`` が追加されました。" -#: ../../library/sqlite3.rst:355 msgid "Added the *autocommit* parameter." -msgstr "" +msgstr "*autocommit* 引数が追加されました。" #: ../../library/sqlite3.rst:358 msgid "" @@ -586,13 +628,16 @@ msgstr "" msgid "For example:" msgstr "例えば:" -#: ../../library/sqlite3.rst:374 msgid "" ">>> sqlite3.complete_statement(\"SELECT foo FROM bar;\")\n" "True\n" ">>> sqlite3.complete_statement(\"SELECT foo\")\n" "False" msgstr "" +">>> sqlite3.complete_statement(\"SELECT foo FROM bar;\")\n" +"True\n" +">>> sqlite3.complete_statement(\"SELECT foo\")\n" +"False" #: ../../library/sqlite3.rst:381 msgid "" @@ -612,7 +657,6 @@ msgstr "" "実際の使用例については、 :source:`Lib/sqlite3/__main__.py` の :func:`!" "runsource` を参照してください。" -#: ../../library/sqlite3.rst:390 msgid "" "Enable or disable callback tracebacks. By default you will not get any " "tracebacks in user-defined functions, aggregates, converters, authorizer " @@ -620,18 +664,24 @@ msgid "" "*flag* set to ``True``. Afterwards, you will get tracebacks from callbacks " "on :data:`sys.stderr`. Use ``False`` to disable the feature again." msgstr "" -"コールバックのトレースバックを有効または無効にします。 デフォルトでは、ユー" -"ザー定義関数や集計関数や変換関数や authorizer コールバックなどではトレース" -"バックを取得しません。それらをデバッグしたい場合は、 *flag* を ``True`` に設" -"定してこの関数を呼び出し。その後、 :data:`sys.stderr` のコールバックからト" -"レースバックを取得します。 機能を再び無効にするには ``False`` を使用します。" +"コールバックのトレースバックを有効または無効にします。\n" +"デフォルトでは、ユーザー定義関数や集計関数や変換関数や authorizer コールバッ" +"クなどではトレースバックを取得しません。\n" +"それらをデバッグしたい場合は、 *flag* を ``True`` に設定してこの関数を呼び出" +"します。\n" +"その後は、コールバック内の例外のトレースバックが :data:`sys.stderr` に出力さ" +"れます。\n" +"機能を再び無効にするには ``False`` を使用します。" -#: ../../library/sqlite3.rst:399 msgid "" "Errors in user-defined function callbacks are logged as unraisable " "exceptions. Use an :func:`unraisable hook handler ` for " "introspection of the failed callback." msgstr "" +"ユーザー定義関数のコールバックで発生したエラーは、送出できない例外として記録" +"されます。\n" +"失敗したコールバックの情報を調べるには、:func:`送出できない例外のフックハンド" +"ラー ` を使ってください。" #: ../../library/sqlite3.rst:405 msgid "" @@ -721,7 +771,6 @@ msgid "" "const:`!PARSE_COLNAMES` to enforce types for such queries." msgstr "" -#: ../../library/sqlite3.rst:464 msgid "" "Pass this flag value to the *detect_types* parameter of :func:`connect` to " "look up a converter function by using the type name, parsed from the query " @@ -729,6 +778,10 @@ msgid "" "wrapped in double quotes (``\"``) and the type name must be wrapped in " "square brackets (``[]``)." msgstr "" +"このフラグ値を :func:`connect` の *detect_types* 引数に渡すと、クエリの列名か" +"ら型名を読み取り、それを変換関数の辞書のキーとして変換関数を検索します。\n" +"クエリの列名はダブルクォート (``\"``) で囲み、型名は角括弧 (``[]``) で囲む必" +"要があります。" #: ../../library/sqlite3.rst:471 msgid "" @@ -743,13 +796,12 @@ msgstr "" "このフラグは ``|`` (ビット論理和)演算子を使用して :const:`PARSE_DECLTYPES` と" "組み合わせることができます。" -#: ../../library/sqlite3.rst:482 msgid "" "Flags that should be returned by the *authorizer_callback* :term:`callable` " "passed to :meth:`Connection.set_authorizer`, to indicate whether:" msgstr "" ":meth:`Connection.set_authorizer` に渡す :term:`呼び出し可能オブジェクト " -"` が返す必要のあるフラグ。これらは以下の意味です:" +"` *authorizer_callback* が返すフラグで、次のいずれかを示します:" #: ../../library/sqlite3.rst:485 msgid "Access is allowed (:const:`!SQLITE_OK`)," @@ -857,9 +909,8 @@ msgstr "" msgid "SQLite threading mode" msgstr "SQLite スレッド・モード" -#: ../../library/sqlite3.rst:532 msgid ":pep:`threadsafety <0249#threadsafety>`" -msgstr "" +msgstr ":pep:`threadsafety <0249#threadsafety>`" #: ../../library/sqlite3.rst:532 msgid "`SQLITE_THREADSAFE`_" @@ -930,17 +981,14 @@ msgstr "" "これらの定数が利用できるかどうかは、 Python にコンパイルされた SQLite のバー" "ジョンによって異なります。" -#: ../../library/sqlite3.rst:579 msgid "https://www.sqlite.org/c3ref/c_dbconfig_defensive.html" -msgstr "" +msgstr "https://www.sqlite.org/c3ref/c_dbconfig_defensive.html" -#: ../../library/sqlite3.rst:580 msgid "SQLite docs: Database Connection Configuration Options" -msgstr "" +msgstr "SQLite のドキュメント: データベース接続の設定オプション" -#: ../../library/sqlite3.rst:582 msgid "The :data:`!version` and :data:`!version_info` constants." -msgstr "" +msgstr ":data:`!version` 定数と :data:`!version_info` 定数。" #: ../../library/sqlite3.rst:588 msgid "Connection objects" @@ -961,11 +1009,12 @@ msgstr "" msgid ":ref:`sqlite3-connection-shortcuts`" msgstr ":ref:`sqlite3-connection-shortcuts`" -#: ../../library/sqlite3.rst:605 msgid "" "A :exc:`ResourceWarning` is emitted if :meth:`close` is not called before a :" "class:`!Connection` object is deleted." msgstr "" +":class:`!Connection` オブジェクトが削除される前に :meth:`close` が呼び出され" +"ていないと、:exc:`ResourceWarning` を出すようになりました。" #: ../../library/sqlite3.rst:608 msgid "An SQLite database connection has the following attributes and methods:" @@ -1017,9 +1066,8 @@ msgid "" msgstr "" "当該 BLOB が配置されているデータベース名。 デフォルトは ``\"main\"`` です。" -#: ../../library/sqlite3.rst:0 msgid "Raises" -msgstr "" +msgstr "送出される例外" #: ../../library/sqlite3.rst:640 msgid "When trying to open a blob in a ``WITHOUT ROWID`` table." @@ -1059,7 +1107,6 @@ msgstr "" "のメソッドによってロールバックされた場合、新しいトランザクションが暗黙に開か" "れます。" -#: ../../library/sqlite3.rst:670 msgid "" "Close the database connection. If :attr:`autocommit` is ``False``, any " "pending transaction is implicitly rolled back. If :attr:`!autocommit` is " @@ -1067,11 +1114,13 @@ msgid "" "control is executed. Make sure to :meth:`commit` before closing to avoid " "losing pending changes." msgstr "" -"データベース接続を閉じます。 :attr:`autocommit` が ``False`` の場合、保留中の" -"トランザクションは暗黙にロールバックされます。 :attr:`!autocommit` が " -"``True`` または :data:`LEGACY_TRANSACTION_CONTROL` の場合、暗黙のトランザク" -"ション制御は実行されませんので、保留中の変更が失われないように、データベース" -"接続を閉じる前に必ず :meth:`commit` を行ってください。" +"データベース接続を閉じます。\n" +":attr:`autocommit` が ``False`` の場合、保留中のトランザクションは暗黙にロー" +"ルバックされます。\n" +":attr:`!autocommit` が ``True`` または :data:`LEGACY_TRANSACTION_CONTROL` の" +"場合、暗黙のトランザクション制御は実行されません。\n" +"保留中の変更が失われないように、データベース接続を閉じる前に必ず :meth:" +"`commit` を行ってください。" #: ../../library/sqlite3.rst:680 msgid "" @@ -1116,16 +1165,16 @@ msgstr "" "SQL 関数が受け入れることができる引数の数。 ``-1`` を指定すると、任意の数の引" "数を取ることができます。" -#: ../../library/sqlite3.rst:707 msgid "" "A :term:`callable` that is called when the SQL function is invoked. The " "callable must return :ref:`a type natively supported by SQLite `. Set to ``None`` to remove an existing SQL function." msgstr "" -"この SQL 関数が呼び出されたときに起動される :term:`呼び出し可能オブジェクト " -"` 。 この呼び出し可能オブジェクトは、 :ref:`SQLite によってネイティ" -"ブにサポートされる型 ` を返すす必要があります。 既存の SQL 関" -"数を削除するには、 ``None`` に設定します。" +"SQL 関数の呼び出し時に呼び出される :term:`呼び出し可能オブジェクト " +"` です。\n" +":ref:`SQLite がネイティブにサポートする型 ` の値を返す必要があ" +"ります。\n" +"既存の SQL 関数を削除するには ``None`` を指定します。" #: ../../library/sqlite3.rst:714 msgid "" @@ -1137,9 +1186,8 @@ msgstr "" "sqlite.org/deterministic.html>`_ : 入力が同一なら常に同一の答えを返す)として" "マークされ、SQLite が追加の最適化を実行できるようになります。" -#: ../../library/sqlite3.rst:719 msgid "Added the *deterministic* parameter." -msgstr "" +msgstr "*deterministic* 引数が追加されました。" #: ../../library/sqlite3.rst:722 ../../library/sqlite3.rst:766 #: ../../library/sqlite3.rst:834 ../../library/sqlite3.rst:1113 @@ -1147,7 +1195,6 @@ msgstr "" msgid "Example:" msgstr "例:" -#: ../../library/sqlite3.rst:724 msgid "" ">>> import hashlib\n" ">>> def md5sum(t):\n" @@ -1159,6 +1206,15 @@ msgid "" "('acbd18db4cc2f85cedef654fccc4a4d8',)\n" ">>> con.close()" msgstr "" +">>> import hashlib\n" +">>> def md5sum(t):\n" +"... return hashlib.md5(t).hexdigest()\n" +">>> con = sqlite3.connect(\":memory:\")\n" +">>> con.create_function(\"md5\", 1, md5sum)\n" +">>> for row in con.execute(\"SELECT md5(?)\", (b\"foo\",)):\n" +"... print(row)\n" +"('acbd18db4cc2f85cedef654fccc4a4d8',)\n" +">>> con.close()" #: ../../library/sqlite3.rst:738 msgid "" @@ -1182,7 +1238,6 @@ msgstr "" "SQL 集計関数が受け入れることができる引数の数。 ``-1`` を指定すると、任意の数" "の引数を取ることができます。" -#: ../../library/sqlite3.rst:753 msgid "" "A class must implement the following methods: * ``step()``: Add a row to " "the aggregate. * ``finalize()``: Return the final result of the aggregate " @@ -1190,6 +1245,12 @@ msgid "" "of arguments that the ``step()`` method must accept is controlled by " "*n_arg*. Set to ``None`` to remove an existing SQL aggregate function." msgstr "" +"次のメソッドを実装するクラスです。\n" +"``step()`` は行を集計に加えます。\n" +"``finalize()`` は集計の最終結果を :ref:`SQLite がネイティブにサポートする型 " +"` で返します。\n" +"``step()`` メソッドが受け取る引数の数は *n_arg* で指定します。\n" +"既存の SQL 集計関数を削除するには ``None`` を指定します。" #: ../../library/sqlite3.rst:754 msgid "A class must implement the following methods:" @@ -1219,7 +1280,6 @@ msgstr "" msgid "Set to ``None`` to remove an existing SQL aggregate function." msgstr "既存の SQL 集計関数を削除するには、 ``None`` に設定します。" -#: ../../library/sqlite3.rst:768 msgid "" "class MySum:\n" " def __init__(self):\n" @@ -1241,6 +1301,25 @@ msgid "" "\n" "con.close()" msgstr "" +"class MySum:\n" +" def __init__(self):\n" +" self.count = 0\n" +"\n" +" def step(self, value):\n" +" self.count += value\n" +"\n" +" def finalize(self):\n" +" return self.count\n" +"\n" +"con = sqlite3.connect(\":memory:\")\n" +"con.create_aggregate(\"mysum\", 1, MySum)\n" +"cur = con.execute(\"CREATE TABLE test(i)\")\n" +"cur.execute(\"INSERT INTO test(i) VALUES(1)\")\n" +"cur.execute(\"INSERT INTO test(i) VALUES(2)\")\n" +"cur.execute(\"SELECT mysum(i) FROM test\")\n" +"print(cur.fetchone()[0])\n" +"\n" +"con.close()" #: ../../library/sqlite3.rst:797 msgid "" @@ -1312,7 +1391,6 @@ msgstr "" "集計ウィンドウ関数をサポートしていない 3.25.0 より古いバージョンの SQLite で" "使用した場合に送出されます。" -#: ../../library/sqlite3.rst:836 msgid "" "# Example taken from https://www.sqlite.org/windowfunctions.html#udfwinfunc\n" "class WindowSumInt:\n" @@ -1359,6 +1437,50 @@ msgid "" "print(cur.fetchall())\n" "con.close()" msgstr "" +"# https://www.sqlite.org/windowfunctions.html#udfwinfunc から引用した例\n" +"class WindowSumInt:\n" +" def __init__(self):\n" +" self.count = 0\n" +"\n" +" def step(self, value):\n" +" \"\"\"現在のウィンドウに行を加える。\"\"\"\n" +" self.count += value\n" +"\n" +" def value(self):\n" +" \"\"\"集計の現在の値を返す。\"\"\"\n" +" return self.count\n" +"\n" +" def inverse(self, value):\n" +" \"\"\"現在のウィンドウから行を取り除く。\"\"\"\n" +" self.count -= value\n" +"\n" +" def finalize(self):\n" +" \"\"\"集計の最終的な値を返す。\n" +"\n" +" 必要なクリーンアップ処理はここに書く。\n" +" \"\"\"\n" +" return self.count\n" +"\n" +"\n" +"con = sqlite3.connect(\":memory:\")\n" +"cur = con.execute(\"CREATE TABLE test(x, y)\")\n" +"values = [\n" +" (\"a\", 4),\n" +" (\"b\", 5),\n" +" (\"c\", 3),\n" +" (\"d\", 8),\n" +" (\"e\", 1),\n" +"]\n" +"cur.executemany(\"INSERT INTO test VALUES(?, ?)\", values)\n" +"con.create_window_function(\"sumint\", 1, WindowSumInt)\n" +"cur.execute(\"\"\"\n" +" SELECT x, sumint(y) OVER (\n" +" ORDER BY x ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING\n" +" ) AS sum_y\n" +" FROM test ORDER BY x\n" +"\"\"\")\n" +"print(cur.fetchall())\n" +"con.close()" #: ../../library/sqlite3.rst:890 msgid "" @@ -1386,7 +1508,6 @@ msgstr "1 番目の文字列と 2 番目の文字列が同じ順位ならば ``0 msgid "The following example shows a reverse sorting collation:" msgstr "以下は逆順での照合例です:" -#: ../../library/sqlite3.rst:900 msgid "" "def collate_reverse(string1, string2):\n" " if string1 == string2:\n" @@ -1406,6 +1527,23 @@ msgid "" " print(row)\n" "con.close()" msgstr "" +"def collate_reverse(string1, string2):\n" +" if string1 == string2:\n" +" return 0\n" +" elif string1 < string2:\n" +" return 1\n" +" else:\n" +" return -1\n" +"\n" +"con = sqlite3.connect(\":memory:\")\n" +"con.create_collation(\"reverse\", collate_reverse)\n" +"\n" +"cur = con.execute(\"CREATE TABLE test(x)\")\n" +"cur.executemany(\"INSERT INTO test(x) VALUES(?)\", [(\"a\",), (\"b\",)])\n" +"cur.execute(\"SELECT x FROM test ORDER BY x COLLATE reverse\")\n" +"for row in cur:\n" +" print(row)\n" +"con.close()" #: ../../library/sqlite3.rst:926 msgid "Remove a collation function by setting *callable* to ``None``." @@ -1597,19 +1735,17 @@ msgstr "" "能のサポートを得るには、 :program:`configure` に :option:`--enable-loadable-" "sqlite-extensions` オプションを渡す必要があります。" -#: ../../library/sqlite3.rst:1035 msgid "" "Raises an :ref:`auditing event ` ``sqlite3.enable_load_extension`` " "with arguments ``connection``, ``enabled``." msgstr "" "引数 ``connection``, ``enabled`` を指定して :ref:`監査イベント ` " -"``sqlite3.enable_load_extension`` を送出します。 " +"``sqlite3.enable_load_extension`` を送出します。" #: ../../library/sqlite3.rst:1039 msgid "Added the ``sqlite3.enable_load_extension`` auditing event." msgstr "``sqlite3.enable_load_extension`` 監査イベントを追加しました。" -#: ../../library/sqlite3.rst:1045 msgid "" "con.enable_load_extension(True)\n" "\n" @@ -1638,6 +1774,32 @@ msgid "" "name MATCH 'pie'\"):\n" " print(row)" msgstr "" +"con.enable_load_extension(True)\n" +"\n" +"# 全文検索拡張機能を読み込む\n" +"con.execute(\"select load_extension('./fts3.so')\")\n" +"\n" +"# または API 呼び出しで拡張機能を読み込むこともできる:\n" +"# con.load_extension(\"./fts3.so\")\n" +"\n" +"# 拡張機能の読み込みを再び無効にする\n" +"con.enable_load_extension(False)\n" +"\n" +"# SQLite wiki の例\n" +"con.execute(\"CREATE VIRTUAL TABLE recipe USING fts3(name, ingredients)\")\n" +"con.executescript(\"\"\"\n" +" INSERT INTO recipe (name, ingredients) VALUES('broccoli stew', 'broccoli " +"peppers cheese tomatoes');\n" +" INSERT INTO recipe (name, ingredients) VALUES('pumpkin stew', 'pumpkin " +"onions garlic celery');\n" +" INSERT INTO recipe (name, ingredients) VALUES('broccoli pie', 'broccoli " +"cheese onions flour');\n" +" INSERT INTO recipe (name, ingredients) VALUES('pumpkin pie', 'pumpkin " +"sugar flour butter');\n" +" \"\"\")\n" +"for row in con.execute(\"SELECT rowid, name, ingredients FROM recipe WHERE " +"name MATCH 'pie'\"):\n" +" print(row)" #: ../../library/sqlite3.rst:1071 msgid "" @@ -1662,21 +1824,19 @@ msgstr "" "トリ・ポイント名を推測します。 詳細については、SQLite ドキュメント `Loading " "an Extension`_ を参照してください。" -#: ../../library/sqlite3.rst:1088 msgid "" "Raises an :ref:`auditing event ` ``sqlite3.load_extension`` with " "arguments ``connection``, ``path``." msgstr "" "引数 ``connection``, ``path`` を指定して :ref:`監査イベント ` " -"``sqlite3.load_extension`` を送出します。 " +"``sqlite3.load_extension`` を送出します。" #: ../../library/sqlite3.rst:1092 msgid "Added the ``sqlite3.load_extension`` auditing event." msgstr "``sqlite3.load_extension`` 監査イベントを追加しました。" -#: ../../library/sqlite3.rst:1095 msgid "Added the *entrypoint* parameter." -msgstr "" +msgstr "*entrypoint* 引数が追加されました。" #: ../../library/sqlite3.rst:1102 msgid "" @@ -1688,14 +1848,16 @@ msgstr "" "す。 後で復元するためにメモリ内データベースを保存する場合に便利です。 :" "program:`sqlite3` シェルの ``.dump`` コマンドに似ています。" -#: ../../library/sqlite3.rst:1106 msgid "" "An optional ``LIKE`` pattern for database objects to dump, e.g. " "``prefix_%``. If ``None`` (the default), all database objects will be " "included." msgstr "" +"ダンプするデータベースオブジェクトを選ぶ、省略可能な ``LIKE`` パターンで" +"す。\n" +"例えば ``prefix_%`` です。\n" +"``None`` (デフォルト) の場合は、すべてのデータベースオブジェクトを含めます。" -#: ../../library/sqlite3.rst:1115 msgid "" "# Convert file example.db to SQL dump file dump.sql\n" "con = sqlite3.connect('example.db')\n" @@ -1704,10 +1866,15 @@ msgid "" " f.write('%s\\n' % line)\n" "con.close()" msgstr "" +"# ファイル example.db を SQL ダンプファイル dump.sql に変換する\n" +"con = sqlite3.connect('example.db')\n" +"with open('dump.sql', 'w') as f:\n" +" for line in con.iterdump():\n" +" f.write('%s\\n' % line)\n" +"con.close()" -#: ../../library/sqlite3.rst:1126 ../../library/sqlite3.rst:1200 msgid ":ref:`sqlite3-howto-encoding`" -msgstr "" +msgstr ":ref:`sqlite3-howto-encoding`" #: ../../library/sqlite3.rst:1128 msgid "Added the *filter* parameter." @@ -1770,7 +1937,6 @@ msgstr "バックアップの指定ページ数単位の反復ごとにスリー msgid "Example 1, copy an existing database into another:" msgstr "例 1. 既存のデータベースを別のデータベースにコピーします:" -#: ../../library/sqlite3.rst:1169 msgid "" "def progress(status, remaining, total):\n" " print(f'Copied {total-remaining} of {total} pages...')\n" @@ -1782,12 +1948,20 @@ msgid "" "dst.close()\n" "src.close()" msgstr "" +"def progress(status, remaining, total):\n" +" print(f'Copied {total-remaining} of {total} pages...')\n" +"\n" +"src = sqlite3.connect('example.db')\n" +"dst = sqlite3.connect('backup.db')\n" +"with dst:\n" +" src.backup(dst, pages=1, progress=progress)\n" +"dst.close()\n" +"src.close()" #: ../../library/sqlite3.rst:1186 msgid "Example 2, copy an existing database into a transient copy:" msgstr "例 2. 既存のデータベースを臨時コピー(transient copy)にコピーします。" -#: ../../library/sqlite3.rst:1188 msgid "" "src = sqlite3.connect('example.db')\n" "dst = sqlite3.connect(':memory:')\n" @@ -1795,6 +1969,11 @@ msgid "" "dst.close()\n" "src.close()" msgstr "" +"src = sqlite3.connect('example.db')\n" +"dst = sqlite3.connect(':memory:')\n" +"src.backup(dst)\n" +"dst.close()\n" +"src.close()" #: ../../library/sqlite3.rst:1204 msgid "Get a connection runtime limit." @@ -1818,11 +1997,12 @@ msgstr "" "例: :class:`Connection` の ``con`` の SQL 文の最大長を照会します (デフォルト" "は 1000000000 です):" -#: ../../library/sqlite3.rst:1224 msgid "" ">>> con.getlimit(sqlite3.SQLITE_LIMIT_SQL_LENGTH)\n" "1000000000" msgstr "" +">>> con.getlimit(sqlite3.SQLITE_LIMIT_SQL_LENGTH)\n" +"1000000000" #: ../../library/sqlite3.rst:1234 msgid "" @@ -1852,13 +2032,16 @@ msgstr "" ":class:`Connection` の ``con`` に対して、取り付けられるデータベース(attached " "databases)の数を 1 に制限します (デフォルトの制限は 10 です):" -#: ../../library/sqlite3.rst:1254 msgid "" ">>> con.setlimit(sqlite3.SQLITE_LIMIT_ATTACHED, 1)\n" "10\n" ">>> con.getlimit(sqlite3.SQLITE_LIMIT_ATTACHED)\n" "1" msgstr "" +">>> con.setlimit(sqlite3.SQLITE_LIMIT_ATTACHED, 1)\n" +"10\n" +">>> con.getlimit(sqlite3.SQLITE_LIMIT_ATTACHED)\n" +"1" #: ../../library/sqlite3.rst:1272 msgid "Query a boolean connection configuration option." @@ -1951,13 +2134,12 @@ msgstr "" "このメソッドは、 背後の SQLite ライブラリに脱直列化 API がある場合にのみ使用" "できます。" -#: ../../library/sqlite3.rst:1350 msgid "" "This attribute controls :pep:`249`-compliant transaction behaviour. :attr:`!" "autocommit` has three allowed values:" msgstr "" -"この属性は、 :pep:`249` 対応のトランザクションの振る舞いを制御します。 :attr:" -"`!auto​​commit` には以下の 3 つの値が指定できます:" +"この属性は、 :pep:`249` 対応のトランザクションの振る舞いを制御します。\n" +":attr:`!autocommit` には以下の 3 つの値が指定できます:" #: ../../library/sqlite3.rst:1353 msgid "" @@ -1970,9 +2152,8 @@ msgstr "" "します。トランザクションを閉じるには、 :meth:`commit` や :meth:`rollback` を" "使用します。" -#: ../../library/sqlite3.rst:1357 msgid "This is the recommended value of :attr:`!autocommit`." -msgstr "これが :attr:`!auto​​commit` の推奨値です。" +msgstr "これが :attr:`!autocommit` の推奨値です。" #: ../../library/sqlite3.rst:1359 msgid "" @@ -1991,16 +2172,14 @@ msgstr "" "ランザクション制御。 詳細については :attr:`isolation_level` を参照してくださ" "い。" -#: ../../library/sqlite3.rst:1366 msgid "This is currently the default value of :attr:`!autocommit`." -msgstr "これが、今のところは、 :attr:`!auto​​commit` のデフォルト値です。" +msgstr "これが、今のところは、 :attr:`!autocommit` のデフォルト値です。" -#: ../../library/sqlite3.rst:1368 msgid "" "Changing :attr:`!autocommit` to ``False`` will open a new transaction, and " "changing it to ``True`` will commit any pending transaction." msgstr "" -":attr:`!auto​​commit` を ``False`` に変更すると新しいトランザクションが開き、 " +":attr:`!autocommit` を ``False`` に変更すると新しいトランザクションが開き、 " "``True`` に変更すると保留中のトランザクションがコミットされます。" #: ../../library/sqlite3.rst:1371 @@ -2097,9 +2276,8 @@ msgstr "" "型である SQLite 値に対して呼び出されます。 デフォルトでは、 この属性は :" "class:`str` に設定されています。" -#: ../../library/sqlite3.rst:1428 msgid "See :ref:`sqlite3-howto-encoding` for more details." -msgstr "" +msgstr "詳しくは :ref:`sqlite3-howto-encoding` を参照してください。" #: ../../library/sqlite3.rst:1432 msgid "" @@ -2136,21 +2314,24 @@ msgstr "" "``SELECT`` クエリに対して :meth:`~Cursor.execute` した場合、結果の行(rows)を" "取得するためには、カーソルを単純に反復(iterate)できます:" -#: ../../library/sqlite3.rst:1459 msgid "" "for row in cur.execute(\"SELECT t FROM data\"):\n" " print(row)" msgstr "" +"for row in cur.execute(\"SELECT t FROM data\"):\n" +" print(row)" #: ../../library/sqlite3.rst:1473 msgid "A :class:`Cursor` instance has the following attributes and methods." msgstr ":class:`Cursor` インスタンスは以下の属性やメソッドを持ちます。" -#: ../../library/sqlite3.rst:1480 msgid "" "Execute a single SQL statement, optionally binding Python values using :ref:" "`placeholders `." msgstr "" +"単一の SQL 文を実行します。\n" +":ref:`プレースホルダー ` を使って Python の値をバインド" +"することもできます。" #: ../../library/sqlite3.rst:1484 msgid "A single SQL statement." @@ -2232,7 +2413,6 @@ msgid "" "If *sql* contains more than one SQL statement, or is not a DML statement." msgstr "" -#: ../../library/sqlite3.rst:1537 msgid "" "rows = [\n" " (\"row1\",),\n" @@ -2241,6 +2421,12 @@ msgid "" "# cur is an sqlite3.Cursor object\n" "cur.executemany(\"INSERT INTO data VALUES(?)\", rows)" msgstr "" +"rows = [\n" +" (\"row1\",),\n" +" (\"row2\",),\n" +"]\n" +"# cur は sqlite3.Cursor オブジェクト\n" +"cur.executemany(\"INSERT INTO data VALUES(?)\", rows)" #: ../../library/sqlite3.rst:1552 msgid "" @@ -2280,7 +2466,6 @@ msgstr "" msgid "*sql_script* must be a :class:`string `." msgstr "*sql_script* は :class:`文字列 ` でなければなりません。" -#: ../../library/sqlite3.rst:1580 msgid "" "# cur is an sqlite3.Cursor object\n" "cur.executescript(\"\"\"\n" @@ -2291,17 +2476,24 @@ msgid "" " COMMIT;\n" "\"\"\")" msgstr "" +"# cur は sqlite3.Cursor オブジェクト\n" +"cur.executescript(\"\"\"\n" +" BEGIN;\n" +" CREATE TABLE person(firstname, lastname, age);\n" +" CREATE TABLE book(title, author, published);\n" +" CREATE TABLE publisher(name, address);\n" +" COMMIT;\n" +"\"\"\")" -#: ../../library/sqlite3.rst:1593 msgid "" "If :attr:`~Cursor.row_factory` is ``None``, return the next row query result " "set as a :class:`tuple`. Else, pass it to the row factory and return its " "result. Return ``None`` if no more data is available." msgstr "" -":attr:`~Cursor.row_factory` が ``None`` の場合、 次の行のクエリ結果セットを :" -"class:`タプル ` として返します。それ以外の場合は、 それを行工場(row " -"factory)に渡し、 その結果を返します。 これ以上データが無い場合は ``None`` を" -"返します。" +":attr:`~Cursor.row_factory` が ``None`` の場合、 クエリ結果セットの次の 1 行" +"を :class:`タプル ` として返します。\n" +"それ以外の場合は、 それを行工場(row factory)に渡し、 その結果を返します。\n" +"これ以上データが無い場合は ``None`` を返します。" #: ../../library/sqlite3.rst:1601 msgid "" @@ -2383,7 +2575,6 @@ msgstr "" "class:`Cursor` オブジェクトには、*con* を参照する :attr:`connection` 属性があ" "ります:" -#: ../../library/sqlite3.rst:1649 msgid "" ">>> con = sqlite3.connect(\":memory:\")\n" ">>> cur = con.cursor()\n" @@ -2391,6 +2582,11 @@ msgid "" "True\n" ">>> con.close()" msgstr "" +">>> con = sqlite3.connect(\":memory:\")\n" +">>> cur = con.cursor()\n" +">>> cur.connection == con\n" +"True\n" +">>> con.close()" #: ../../library/sqlite3.rst:1659 msgid "" @@ -2431,7 +2627,6 @@ msgstr "``WITHOUT ROWID`` テーブルへの挿入(insert)は記録されませ msgid "Added support for the ``REPLACE`` statement." msgstr "``REPLACE`` 文のサポートが追加されました。" -#: ../../library/sqlite3.rst:1682 msgid "" "Read-only attribute that provides the number of modified rows for " "``INSERT``, ``UPDATE``, ``DELETE``, and ``REPLACE`` statements; is ``-1`` " @@ -2440,13 +2635,15 @@ msgid "" "methods, after the statement has run to completion. This means that any " "resulting rows must be fetched in order for :attr:`!rowcount` to be updated." msgstr "" -"``INSERT`` や ``UPDATE`` や ``DELETE`` や ``REPLACE`` 文で変更された行数を提" -"供する読み取り専用属性。 :abbr:`CTE (共通テーブル式)` クエリを含む他のSQL文" -"は ``-1`` です。 :meth:`execute` と :meth:`executemany` メソッドのみにおい" -"て、 SQL文(statement)実行の完了後に更新されます。 なぜなら :attr:`!rowcount` " -"を更新するためには、結果の行を取得(fetch)しなければならないからです。" +"``INSERT``、``UPDATE``、``DELETE``、``REPLACE`` 文で変更した行数を示す読み取" +"り専用属性です。\n" +":abbr:`CTE (Common Table Expression)` クエリを含む、ほかの文では ``-1`` にな" +"ります。\n" +":meth:`execute` メソッドと :meth:`executemany` メソッドによってのみ、文の実行" +"が完了した後に更新されます。\n" +"そのため、:attr:`!rowcount` が更新されるには、結果の行があればそれを取得する" +"必要があります。" -#: ../../library/sqlite3.rst:1693 msgid "" "Control how a row fetched from this :class:`!Cursor` is represented. If " "``None``, a row is represented as a :class:`tuple`. Can be set to the " @@ -2454,23 +2651,22 @@ msgid "" "arguments, a :class:`Cursor` object and the :class:`!tuple` of row values, " "and returns a custom object representing an SQLite row." msgstr "" -"この :class:`カーソル ` から取得された行の表現方法を制御します。 " -"``None`` の場合、行は :class:`タプル ` として表されます。 :class:" -"`sqlite3.Row` に設定することもできます。 そしてまた、 :class:`Cursor` オブ" -"ジェクトと、 行の値の :class:`タプル ` の、 2 つの引数を受け取り、 " -"SQLite の行(row)を表すカスタム・オブジェクトを返す、 :term:`呼び出し可能オブ" -"ジェクト ` に設定することもできます。" +"この :class:`!Cursor` から取得された行の表現方法を制御します。\n" +"``None`` の場合、行は :class:`タプル ` として表されます。\n" +":class:`sqlite3.Row` に設定することもできます。\n" +"そしてまた、 :class:`Cursor` オブジェクトと、 行の値の :class:`!tuple` の、 " +"2 つの引数を受け取り、 SQLite の行(row)を表すカスタム・オブジェクトを返す、 :" +"term:`呼び出し可能オブジェクト ` に設定することもできます。" -#: ../../library/sqlite3.rst:1700 msgid "" "Defaults to what :attr:`Connection.row_factory` was set to when the :class:`!" "Cursor` was created. Assigning to this attribute does not affect :attr:" "`Connection.row_factory` of the parent connection." msgstr "" -":class:`カーソル・オブジェクト ` の作成時に :attr:`Connection." -"row_factory` の値をこの属性のデフォルト値として設定します。この属性に割り当て" -"ても、親接続(parent connection)の :attr:`Connection.row_factory` には影響しま" -"せん。" +":class:`!Cursor` オブジェクト の作成時に :attr:`Connection.row_factory` の値" +"をこの属性のデフォルト値として設定します。\n" +"この属性に割り当てても、親接続(parent connection)の :attr:`Connection." +"row_factory` には影響しません。" #: ../../library/sqlite3.rst:1716 msgid "Row objects" @@ -2497,15 +2693,14 @@ msgstr "" "列名(column names)と値(values)が全く同一である 2 つの :class:`!Row` オブジェ" "クトを比較すると、等しいと見なされます。" -#: ../../library/sqlite3.rst:1732 msgid "" "Return a :class:`list` of column names as :class:`strings `. " "Immediately after a query, it is the first member of each tuple in :attr:" "`Cursor.description`." msgstr "" -"列名(column names)の :class:`リスト ` を :class:`文字列 ` として返" -"します。 クエリの直後であれば、それは :attr:`Cursor.description` の各タプルの" -"最初のメンバーです。" +":class:`文字列 ` で表した列名の :class:`リスト ` を返します。\n" +"クエリの直後では、列名は :attr:`Cursor.description` の各タプルの最初の要素で" +"す。" #: ../../library/sqlite3.rst:1736 msgid "Added support of slicing." @@ -2535,7 +2730,6 @@ msgstr "" ":class:`Blob` を :term:`コンテキストマネージャ ` として使用" "して、 使用後に Blob ハンドルが確実に閉じられるようにします。" -#: ../../library/sqlite3.rst:1757 msgid "" "con = sqlite3.connect(\":memory:\")\n" "con.execute(\"CREATE TABLE test(blob_col blob)\")\n" @@ -2556,6 +2750,24 @@ msgid "" "print(greeting) # outputs \"b'Hello, world!'\"\n" "con.close()" msgstr "" +"con = sqlite3.connect(\":memory:\")\n" +"con.execute(\"CREATE TABLE test(blob_col blob)\")\n" +"con.execute(\"INSERT INTO test(blob_col) VALUES(zeroblob(13))\")\n" +"\n" +"# 2 回の書き込み操作で BLOB に書き込む:\n" +"with con.blobopen(\"test\", \"blob_col\", 1) as blob:\n" +" blob.write(b\"hello, \")\n" +" blob.write(b\"world.\")\n" +" # BLOB の最初と最後のバイトを変更する\n" +" blob[0] = ord(\"H\")\n" +" blob[-1] = ord(\"!\")\n" +"\n" +"# BLOB の内容を読み取る\n" +"with con.blobopen(\"test\", \"blob_col\", 1) as blob:\n" +" greeting = blob.read()\n" +"\n" +"print(greeting) # \"b'Hello, world!'\" を出力する\n" +"con.close()" #: ../../library/sqlite3.rst:1785 msgid "Close the blob." @@ -2570,18 +2782,17 @@ msgstr "" "この時点から、 BLOB は使用できなくなります。 BLOB に対してさらに操作を試みる" "と、 :class:`~sqlite3.Error` (またはそのサブクラスの) 例外を送出します。" -#: ../../library/sqlite3.rst:1793 msgid "" "Read *length* bytes of data from the blob at the current offset position. If " "the end of the blob is reached, the data up to :abbr:`EOF (End of File)` " "will be returned. When *length* is not specified, or is negative, :meth:" "`~Blob.read` will read until the end of the blob." msgstr "" -"BLOB の現在のオフセット位置から *length* バイトのデータを読み取り返ます。 " -"BLOB の現在のオフセット位置から末尾までの残りが *length* バイトよりも少ない場" -"合、末尾までのデータを読み取ります。 *length* が指定されていない場合、 または" -"負数の場合、 :meth:`~Blob.read` は BLOB の現在のオフセット位置から末尾までの" -"データを読み取ります。" +"現在のオフセット位置から BLOB のデータを *length* バイト読み取ります。\n" +"BLOB の末尾に達した場合は、:abbr:`EOF (End of File)` までのデータを返しま" +"す。\n" +"*length* を省略した場合や負の値を指定した場合、:meth:`~Blob.read` は BLOB の" +"末尾まで読み取ります。" #: ../../library/sqlite3.rst:1801 msgid "" @@ -2597,13 +2808,16 @@ msgstr "" msgid "Return the current access position of the blob." msgstr "BLOBの現在のオフセット位置(current access position)を返します。" -#: ../../library/sqlite3.rst:1811 msgid "" "Set the current access position of the blob to *offset*. The *origin* " "argument defaults to :const:`os.SEEK_SET` (absolute blob positioning). Other " "values for *origin* are :const:`os.SEEK_CUR` (seek relative to the current " "position) and :const:`os.SEEK_END` (seek relative to the blob’s end)." msgstr "" +"BLOB の現在のアクセス位置を *offset* に設定します。\n" +"*origin* 引数のデフォルトは :const:`os.SEEK_SET` (BLOB 内の絶対位置) です。\n" +"*origin* のほかの値は :const:`os.SEEK_CUR` (現在位置からの相対移動) と :" +"const:`os.SEEK_END` (BLOB の末尾からの相対移動) です。" #: ../../library/sqlite3.rst:1819 msgid "PrepareProtocol objects" @@ -2930,9 +3144,8 @@ msgstr "" "リタで :option:`-m` スイッチを使用してスクリプトとして呼び出すことができま" "す。引数は以下のとおりです::" -#: ../../library/sqlite3.rst:2015 msgid "python -m sqlite3 [-h] [-v] [filename] [sql]" -msgstr "" +msgstr "python -m sqlite3 [-h] [-v] [filename] [sql]" #: ../../library/sqlite3.rst:2017 msgid "Type ``.quit`` or CTRL-D to exit the shell." @@ -2967,7 +3180,6 @@ msgstr "" "のように単純にシングルクォートを閉じて ``OR TRUE`` を挿入してすべての行を選択" "できます::" -#: ../../library/sqlite3.rst:2047 msgid "" ">>> # Never do this -- insecure!\n" ">>> symbol = input()\n" @@ -2977,6 +3189,13 @@ msgid "" "SELECT * FROM stocks WHERE symbol = '' OR TRUE; --'\n" ">>> cur.execute(sql)" msgstr "" +">>> # 危険なので、このようにしてはいけない!\n" +">>> symbol = input()\n" +"' OR TRUE; --\n" +">>> sql = \"SELECT * FROM stocks WHERE symbol = '%s'\" % symbol\n" +">>> print(sql)\n" +"SELECT * FROM stocks WHERE symbol = '' OR TRUE; --'\n" +">>> cur.execute(sql)" #: ../../library/sqlite3.rst:2055 msgid "" @@ -3009,7 +3228,6 @@ msgstr "" "があり、すべての名前付きパラメーターのキーが含まれている必要があります。余分" "な項目は無視されます。両方のスタイルの例を以下に示します。" -#: ../../library/sqlite3.rst:2071 msgid "" "con = sqlite3.connect(\":memory:\")\n" "cur = con.execute(\"CREATE TABLE lang(name, first_appeared)\")\n" @@ -3029,6 +3247,23 @@ msgid "" "print(cur.fetchall())\n" "con.close()" msgstr "" +"con = sqlite3.connect(\":memory:\")\n" +"cur = con.execute(\"CREATE TABLE lang(name, first_appeared)\")\n" +"\n" +"# executemany() で名前付きスタイルを使う:\n" +"data = (\n" +" {\"name\": \"C\", \"year\": 1972},\n" +" {\"name\": \"Fortran\", \"year\": 1957},\n" +" {\"name\": \"Python\", \"year\": 1991},\n" +" {\"name\": \"Go\", \"year\": 2009},\n" +")\n" +"cur.executemany(\"INSERT INTO lang VALUES(:name, :year)\", data)\n" +"\n" +"# SELECT クエリで qmark スタイルを使う:\n" +"params = (1972,)\n" +"cur.execute(\"SELECT * FROM lang WHERE first_appeared = ?\", params)\n" +"print(cur.fetchall())\n" +"con.close()" #: ../../library/sqlite3.rst:2098 msgid "" @@ -3088,7 +3323,6 @@ msgstr "" "きます。 *protocol* に渡されるオブジェクトは、 :class:`PrepareProtocol` 型に" "なります。" -#: ../../library/sqlite3.rst:2133 msgid "" "class Point:\n" " def __init__(self, x, y):\n" @@ -3105,6 +3339,20 @@ msgid "" "print(cur.fetchone()[0])\n" "con.close()" msgstr "" +"class Point:\n" +" def __init__(self, x, y):\n" +" self.x, self.y = x, y\n" +"\n" +" def __conform__(self, protocol):\n" +" if protocol is sqlite3.PrepareProtocol:\n" +" return f\"{self.x};{self.y}\"\n" +"\n" +"con = sqlite3.connect(\":memory:\")\n" +"cur = con.cursor()\n" +"\n" +"cur.execute(\"SELECT ?\", (Point(4.0, -3.2),))\n" +"print(cur.fetchone()[0])\n" +"con.close()" #: ../../library/sqlite3.rst:2157 msgid "How to register adapter callables" @@ -3120,7 +3368,6 @@ msgstr "" "ことが挙げられます。 この関数は、 :func:`register_adapter` を使用して登録でき" "ます。" -#: ../../library/sqlite3.rst:2163 msgid "" "class Point:\n" " def __init__(self, x, y):\n" @@ -3138,6 +3385,21 @@ msgid "" "print(cur.fetchone()[0])\n" "con.close()" msgstr "" +"class Point:\n" +" def __init__(self, x, y):\n" +" self.x, self.y = x, y\n" +"\n" +"def adapt_point(point):\n" +" return f\"{point.x};{point.y}\"\n" +"\n" +"sqlite3.register_adapter(Point, adapt_point)\n" +"\n" +"con = sqlite3.connect(\":memory:\")\n" +"cur = con.cursor()\n" +"\n" +"cur.execute(\"SELECT ?\", (Point(1.0, 2.5),))\n" +"print(cur.fetchone()[0])\n" +"con.close()" #: ../../library/sqlite3.rst:2190 msgid "How to convert SQLite values to custom Python types" @@ -3161,13 +3423,12 @@ msgstr "" "それでは :class:`!Point` クラスの話に戻るとしましょう。 先程は x 座標と y 座" "標をセミコロンで区切られた文字列として SQLite に格納しました。" -#: ../../library/sqlite3.rst:2200 msgid "" "First, we'll define a converter function that accepts the string as a " "parameter and constructs a :class:`!Point` object from it." msgstr "" -"まず、 文字列をパラメーターとして受け取り、そこから :class:`!Point` オブジェ" -"クトを構築する変換関数を定義します。" +"まず、バイト列を引数として受け取り、そこから :class:`!Point` オブジェクトを構" +"築する変換関数を定義します。" #: ../../library/sqlite3.rst:2205 msgid "" @@ -3177,22 +3438,24 @@ msgstr "" "変換関数には、基になる SQLite データ型に関係なく、 **常に** :class:`bytes` オ" "ブジェクトで渡されます。" -#: ../../library/sqlite3.rst:2208 msgid "" "def convert_point(s):\n" " x, y = map(float, s.split(b\";\"))\n" " return Point(x, y)" msgstr "" +"def convert_point(s):\n" +" x, y = map(float, s.split(b\";\"))\n" +" return Point(x, y)" -#: ../../library/sqlite3.rst:2214 msgid "" "We now need to tell :mod:`!sqlite3` when it should convert a given SQLite " "value. This is done when connecting to a database, using the *detect_types* " "parameter of :func:`connect`. There are three options:" msgstr "" -"与えられた SQLite 値をどの時点で変換すべきかを :mod:`!sqlite3` に伝える必要が" -"あります。これは、 :func:`connect` の *detect_types* パラメータを使用して、" -"データベースに接続する際に行います。 以下の 3 つの選択肢があります:" +"どの SQLite 値を変換すべきかを :mod:`!sqlite3` に伝える必要があります。\n" +"これは、 :func:`connect` の *detect_types* パラメータを使用して、データベース" +"に接続する際に行います。\n" +"以下の 3 つの選択肢があります:" #: ../../library/sqlite3.rst:2218 msgid "Implicit: set *detect_types* to :const:`PARSE_DECLTYPES`" @@ -3215,7 +3478,6 @@ msgid "The following example illustrates the implicit and explicit approaches:" msgstr "" "以下の例では、暗黙的なアプローチと明示的なアプローチについて表しています:" -#: ../../library/sqlite3.rst:2226 msgid "" "class Point:\n" " def __init__(self, x, y):\n" @@ -3256,6 +3518,44 @@ msgid "" "cur.close()\n" "con.close()" msgstr "" +"class Point:\n" +" def __init__(self, x, y):\n" +" self.x, self.y = x, y\n" +"\n" +" def __repr__(self):\n" +" return f\"Point({self.x}, {self.y})\"\n" +"\n" +"def adapt_point(point):\n" +" return f\"{point.x};{point.y}\"\n" +"\n" +"def convert_point(s):\n" +" x, y = list(map(float, s.split(b\";\")))\n" +" return Point(x, y)\n" +"\n" +"# 適合関数と変換関数を登録する\n" +"sqlite3.register_adapter(Point, adapt_point)\n" +"sqlite3.register_converter(\"point\", convert_point)\n" +"\n" +"# 1) 宣言された型を使って解析する\n" +"p = Point(4.0, -3.2)\n" +"con = sqlite3.connect(\":memory:\", detect_types=sqlite3.PARSE_DECLTYPES)\n" +"cur = con.execute(\"CREATE TABLE test(p point)\")\n" +"\n" +"cur.execute(\"INSERT INTO test(p) VALUES(?)\", (p,))\n" +"cur.execute(\"SELECT p FROM test\")\n" +"print(\"with declared types:\", cur.fetchone()[0])\n" +"cur.close()\n" +"con.close()\n" +"\n" +"# 2) 列名を使って解析する\n" +"con = sqlite3.connect(\":memory:\", detect_types=sqlite3.PARSE_COLNAMES)\n" +"cur = con.execute(\"CREATE TABLE test(p)\")\n" +"\n" +"cur.execute(\"INSERT INTO test(p) VALUES(?)\", (p,))\n" +"cur.execute('SELECT p AS \"p [point]\" FROM test')\n" +"print(\"with column names:\", cur.fetchone()[0])\n" +"cur.close()\n" +"con.close()" #: ../../library/sqlite3.rst:2277 msgid "Adapter and converter recipes" @@ -3326,7 +3626,6 @@ msgstr "" "す。この方法を使えば、 ``SELECT`` 文を実行してその結果について反復すること" "が、 :class:`Connection` オブジェクトに対する呼び出し一つで行なえます。" -#: ../../library/sqlite3.rst:2352 msgid "" "# Create and fill the table.\n" "con = sqlite3.connect(\":memory:\")\n" @@ -3349,6 +3648,26 @@ msgid "" "# the connection object should be closed manually\n" "con.close()" msgstr "" +"# テーブルを作成してデータを入れる。\n" +"con = sqlite3.connect(\":memory:\")\n" +"con.execute(\"CREATE TABLE lang(name, first_appeared)\")\n" +"data = [\n" +" (\"C++\", 1985),\n" +" (\"Objective-C\", 1984),\n" +"]\n" +"con.executemany(\"INSERT INTO lang(name, first_appeared) VALUES(?, ?)\", " +"data)\n" +"\n" +"# テーブルの内容を表示する\n" +"for row in con.execute(\"SELECT name, first_appeared FROM lang\"):\n" +" print(row)\n" +"\n" +"print(\"I just deleted\", con.execute(\"DELETE FROM lang\").rowcount, " +"\"rows\")\n" +"\n" +"# close() はショートカットメソッドではなく、自動では呼び出されない。\n" +"# 接続オブジェクトは手動で閉じる必要がある。\n" +"con.close()" #: ../../library/sqlite3.rst:2384 msgid "How to use the connection context manager" @@ -3366,9 +3685,9 @@ msgid "" "rolling back." msgstr "" ":class:`Connection` オブジェクトは、コンテキスト・マネージャーとして使用で" -"き、コンテキスト・マネージャーとして使用すると、 :keyword:`with` ブロックを離" -"れるときに、開いているトランザクションを自動的にコミットまたはロールバックし" -"ます。 :keyword:`with` 文のブロックが例外なく終了すると、トランザクションはコ" +"き、コンテキスト・マネージャーとして使用すると、 ``with`` ブロックを離れると" +"きに、開いているトランザクションを自動的にコミットまたはロールバックしま" +"す。 :keyword:`with` 文のブロックが例外なく終了すると、トランザクションはコ" "ミットされます。このコミットが失敗した、または、 ``with`` 文のブロックで" "キャッチされなかった例外が発生した場合、トランザクションはロールバックされま" "す。 :attr:`~Connection.autocommit` が ``False`` の場合、コミット後またはロー" @@ -3391,7 +3710,6 @@ msgid "" "`contextlib.closing`." msgstr "" -#: ../../library/sqlite3.rst:2406 msgid "" "con = sqlite3.connect(\":memory:\")\n" "con.execute(\"CREATE TABLE lang(id INTEGER PRIMARY KEY, name VARCHAR " @@ -3414,6 +3732,25 @@ msgid "" "# so the connection object should be closed manually\n" "con.close()" msgstr "" +"con = sqlite3.connect(\":memory:\")\n" +"con.execute(\"CREATE TABLE lang(id INTEGER PRIMARY KEY, name VARCHAR " +"UNIQUE)\")\n" +"\n" +"# 成功すると、後で con.commit() が自動的に呼び出される\n" +"with con:\n" +" con.execute(\"INSERT INTO lang(name) VALUES(?)\", (\"Python\",))\n" +"\n" +"# with ブロックが例外で終了すると、その後に con.rollback() が呼び出される。\n" +"# 例外は引き続き送出されるため、捕捉する必要がある。\n" +"try:\n" +" with con:\n" +" con.execute(\"INSERT INTO lang(name) VALUES(?)\", (\"Python\",))\n" +"except sqlite3.IntegrityError:\n" +" print(\"couldn't add Python twice\")\n" +"\n" +"# 接続オブジェクトをコンテキストマネージャーとして使っても、\n" +"# トランザクションのコミットやロールバックだけなので、接続は手動で閉じる。\n" +"con.close()" #: ../../library/sqlite3.rst:2436 msgid "How to work with SQLite URIs" @@ -3427,7 +3764,6 @@ msgstr "URI の小技をいくつか紹介します:" msgid "Open a database in read-only mode:" msgstr "データベースを読み取り専用で開きます:" -#: ../../library/sqlite3.rst:2442 msgid "" ">>> con = sqlite3.connect(\"file:tutorial.db?mode=ro\", uri=True)\n" ">>> con.execute(\"CREATE TABLE readonly(data)\")\n" @@ -3435,6 +3771,11 @@ msgid "" "OperationalError: attempt to write a readonly database\n" ">>> con.close()" msgstr "" +">>> con = sqlite3.connect(\"file:tutorial.db?mode=ro\", uri=True)\n" +">>> con.execute(\"CREATE TABLE readonly(data)\")\n" +"Traceback (most recent call last):\n" +"OperationalError: attempt to write a readonly database\n" +">>> con.close()" #: ../../library/sqlite3.rst:2450 msgid "" @@ -3445,18 +3786,19 @@ msgstr "" "新しいファイルが作成できない場合には :exc:`~sqlite3.OperationalError` が送出" "されます:" -#: ../../library/sqlite3.rst:2453 msgid "" ">>> con = sqlite3.connect(\"file:nosuchdb.db?mode=rw\", uri=True)\n" "Traceback (most recent call last):\n" "OperationalError: unable to open database file" msgstr "" +">>> con = sqlite3.connect(\"file:nosuchdb.db?mode=rw\", uri=True)\n" +"Traceback (most recent call last):\n" +"OperationalError: unable to open database file" #: ../../library/sqlite3.rst:2460 msgid "Create a shared named in-memory database:" msgstr "共有の名前付きインメモリ・データベースを作成します:" -#: ../../library/sqlite3.rst:2462 msgid "" "db = \"file:mem1?mode=memory&cache=shared\"\n" "con1 = sqlite3.connect(db, uri=True)\n" @@ -3470,6 +3812,17 @@ msgid "" "con1.close()\n" "con2.close()" msgstr "" +"db = \"file:mem1?mode=memory&cache=shared\"\n" +"con1 = sqlite3.connect(db, uri=True)\n" +"con2 = sqlite3.connect(db, uri=True)\n" +"with con1:\n" +" con1.execute(\"CREATE TABLE shared(data)\")\n" +" con1.execute(\"INSERT INTO shared VALUES(28)\")\n" +"res = con2.execute(\"SELECT data FROM shared\")\n" +"assert res.fetchone() == (28,)\n" +"\n" +"con1.close()\n" +"con2.close()" #: ../../library/sqlite3.rst:2476 msgid "" @@ -3483,16 +3836,15 @@ msgstr "" msgid "How to create and use row factories" msgstr "行工場(row factories)の作成方法と使用方法" -#: ../../library/sqlite3.rst:2487 msgid "" "By default, :mod:`!sqlite3` represents each row as a :class:`tuple`. If a :" "class:`!tuple` does not suit your needs, you can use the :class:`sqlite3." "Row` class or a custom :attr:`~Cursor.row_factory`." msgstr "" "デフォルトでは、 :mod:`!sqlite3` は各行(row)を :class:`タプル ` として" -"表します。 :class:`タプル ` があなたのニーズと合わない場合は、 :" -"class:`sqlite3.Row` クラスまたはカスタム :attr:`~Cursor.row_factory` を使用で" -"きます。" +"表します。\n" +":class:`!tuple` があなたのニーズと合わない場合は、 :class:`sqlite3.Row` クラ" +"スまたはカスタム :attr:`~Cursor.row_factory` を使用できます。" #: ../../library/sqlite3.rst:2492 msgid "" @@ -3506,24 +3858,24 @@ msgstr "" "行工場(row factory)を使用するようにするために、 :class:`Connection." "row_factory` を設定することをお勧めします。" -#: ../../library/sqlite3.rst:2497 msgid "" ":class:`!Row` provides indexed and case-insensitive named access to columns, " "with minimal memory overhead and performance impact over a :class:`!tuple`. " "To use :class:`!Row` as a row factory, assign it to the :attr:`!row_factory` " "attribute:" msgstr "" -":class:`!Row` は、 :class:`タプル ` に対してメモリ・オーバーヘッドと" -"パフォーマンスへの影響を最小限に抑えながら、列(row)へのインデックスによるアク" -"セスと、列への(大文字と小文字を区別しない)名前によるアクセスを提供します。 :" -"class:`!Row` を行工場(row factory)として使用するには、 :attr:`!row_factory` " +":class:`!Row` は、 :class:`!tuple` に対してメモリ・オーバーヘッドとパフォーマ" +"ンスへの影響を最小限に抑えながら、列へのインデックスによるアクセスと、列への" +"(大文字と小文字を区別しない)名前によるアクセスを提供します。\n" +":class:`!Row` を行工場(row factory)として使用するには、 :attr:`!row_factory` " "属性に割り当てます:" -#: ../../library/sqlite3.rst:2502 msgid "" ">>> con = sqlite3.connect(\":memory:\")\n" ">>> con.row_factory = sqlite3.Row" msgstr "" +">>> con = sqlite3.connect(\":memory:\")\n" +">>> con.row_factory = sqlite3.Row" #: ../../library/sqlite3.rst:2507 msgid "Queries now return :class:`!Row` objects:" @@ -3531,7 +3883,6 @@ msgstr "" "このように設定すると、クエリは :class:`!Row` オブジェクトを返すようになりま" "す:" -#: ../../library/sqlite3.rst:2509 msgid "" ">>> res = con.execute(\"SELECT 'Earth' AS name, 6378 AS radius\")\n" ">>> row = res.fetchone()\n" @@ -3545,14 +3896,27 @@ msgid "" "6378\n" ">>> con.close()" msgstr "" +">>> res = con.execute(\"SELECT 'Earth' AS name, 6378 AS radius\")\n" +">>> row = res.fetchone()\n" +">>> row.keys()\n" +"['name', 'radius']\n" +">>> row[0] # インデックスによるアクセス。\n" +"'Earth'\n" +">>> row[\"name\"] # 名前によるアクセス。\n" +"'Earth'\n" +">>> row[\"RADIUS\"] # 列名は大文字・小文字を区別しない。\n" +"6378\n" +">>> con.close()" -#: ../../library/sqlite3.rst:2525 msgid "" "The ``FROM`` clause can be omitted in the ``SELECT`` statement, as in the " "above example. In such cases, SQLite returns a single row with columns " "defined by expressions, e.g. literals, with the given aliases ``expr AS " "alias``." msgstr "" +"上の例のように、``SELECT`` 文では ``FROM`` 句を省略できます。\n" +"その場合、SQLite は、リテラルなどの式で列を定義した 1 行を返し、``expr AS " +"alias`` で指定した別名を列名に使います。" #: ../../library/sqlite3.rst:2530 msgid "" @@ -3562,21 +3926,21 @@ msgstr "" "各列名が各値にマップされた :class:`dict` として行を返す、カスタム :attr:" "`~Cursor.row_factory` を作成することもできます:" -#: ../../library/sqlite3.rst:2533 msgid "" "def dict_factory(cursor, row):\n" " fields = [column[0] for column in cursor.description]\n" " return {key: value for key, value in zip(fields, row)}" msgstr "" +"def dict_factory(cursor, row):\n" +" fields = [column[0] for column in cursor.description]\n" +" return {key: value for key, value in zip(fields, row)}" -#: ../../library/sqlite3.rst:2539 msgid "" "Using it, queries now return a :class:`!dict` instead of a :class:`!tuple`:" msgstr "" -"これを使うと、クエリは :class:`タプル ` の代わりに :class:`!dict` を" -"返すようになります:" +"これを使うと、クエリは :class:`!tuple` の代わりに :class:`!dict` を返すように" +"なります:" -#: ../../library/sqlite3.rst:2541 msgid "" ">>> con = sqlite3.connect(\":memory:\")\n" ">>> con.row_factory = dict_factory\n" @@ -3585,13 +3949,18 @@ msgid "" "{'a': 1, 'b': 2}\n" ">>> con.close()" msgstr "" +">>> con = sqlite3.connect(\":memory:\")\n" +">>> con.row_factory = dict_factory\n" +">>> for row in con.execute(\"SELECT 1 AS a, 2 AS b\"):\n" +"... print(row)\n" +"{'a': 1, 'b': 2}\n" +">>> con.close()" #: ../../library/sqlite3.rst:2550 msgid "The following row factory returns a :term:`named tuple`:" msgstr "" "以下の行工場(row factory)は :term:`名前付きタプル ` を返します:" -#: ../../library/sqlite3.rst:2552 msgid "" "from collections import namedtuple\n" "\n" @@ -3600,12 +3969,17 @@ msgid "" " cls = namedtuple(\"Row\", fields)\n" " return cls._make(row)" msgstr "" +"from collections import namedtuple\n" +"\n" +"def namedtuple_factory(cursor, row):\n" +" fields = [column[0] for column in cursor.description]\n" +" cls = namedtuple(\"Row\", fields)\n" +" return cls._make(row)" #: ../../library/sqlite3.rst:2561 msgid ":func:`!namedtuple_factory` can be used as follows:" msgstr ":func:`!namedtuple_factory` は以下のようにして使う事ができます:" -#: ../../library/sqlite3.rst:2563 msgid "" ">>> con = sqlite3.connect(\":memory:\")\n" ">>> con.row_factory = namedtuple_factory\n" @@ -3619,6 +3993,17 @@ msgid "" "2\n" ">>> con.close()" msgstr "" +">>> con = sqlite3.connect(\":memory:\")\n" +">>> con.row_factory = namedtuple_factory\n" +">>> cur = con.execute(\"SELECT 1 AS a, 2 AS b\")\n" +">>> row = cur.fetchone()\n" +">>> row\n" +"Row(a=1, b=2)\n" +">>> row[0] # インデックスによるアクセス。\n" +"1\n" +">>> row.b # 属性によるアクセス。\n" +"2\n" +">>> con.close()" #: ../../library/sqlite3.rst:2577 msgid "" @@ -3630,19 +4015,21 @@ msgstr "" "に :class:`~dataclasses.dataclass` または、その他のカスタム・クラスを使用する" "ように適合(adapt)させることができます。" -#: ../../library/sqlite3.rst:2585 msgid "How to handle non-UTF-8 text encodings" -msgstr "" +msgstr "UTF-8 以外のテキストエンコーディングの扱い方" -#: ../../library/sqlite3.rst:2587 msgid "" "By default, :mod:`!sqlite3` uses :class:`str` to adapt SQLite values with " "the ``TEXT`` data type. This works well for UTF-8 encoded text, but it might " "fail for other encodings and invalid UTF-8. You can use a custom :attr:" "`~Connection.text_factory` to handle such cases." msgstr "" +"デフォルトでは、:mod:`!sqlite3` は :class:`str` を使って SQLite の ``TEXT`` " +"型の値を変換します。\n" +"これは UTF-8 エンコードされたテキストには適していますが、ほかのエンコーディン" +"グや不正な UTF-8 では失敗することがあります。\n" +"そのような場合には、独自の :attr:`~Connection.text_factory` を使えます。" -#: ../../library/sqlite3.rst:2593 msgid "" "Because of SQLite's `flexible typing`_, it is not uncommon to encounter " "table columns with the ``TEXT`` data type containing non-UTF-8 encodings, or " @@ -3652,30 +4039,37 @@ msgid "" "data:`!con` connected to this database, we can decode the Latin-2 encoded " "text using this :attr:`~Connection.text_factory`:" msgstr "" +"SQLite の `flexible typing`_ により、``TEXT`` 型のテーブル列に UTF-8 以外でエ" +"ンコードされたテキストや、任意のデータが含まれていることも珍しくありませ" +"ん。\n" +"例えば、チェコ語・英語辞書の項目を格納するテーブルなど、ISO-8859-2 (Latin-2) " +"でエンコードされたテキストを持つデータベースがあるとします。\n" +"そのデータベースに接続した :class:`Connection` インスタンス :py:data:`!con` " +"があれば、次の :attr:`~Connection.text_factory` を使って Latin-2 のテキストを" +"デコードできます:" -#: ../../library/sqlite3.rst:2602 msgid "con.text_factory = lambda data: str(data, encoding=\"latin2\")" -msgstr "" +msgstr "con.text_factory = lambda data: str(data, encoding=\"latin2\")" -#: ../../library/sqlite3.rst:2606 msgid "" "For invalid UTF-8 or arbitrary data in stored in ``TEXT`` table columns, you " "can use the following technique, borrowed from the :ref:`unicode-howto`:" msgstr "" +"``TEXT`` 型のテーブル列に格納された不正な UTF-8 や任意のデータには、:ref:" +"`unicode-howto` で紹介している次の方法を使えます:" -#: ../../library/sqlite3.rst:2609 msgid "con.text_factory = lambda data: str(data, errors=\"surrogateescape\")" -msgstr "" +msgstr "con.text_factory = lambda data: str(data, errors=\"surrogateescape\")" -#: ../../library/sqlite3.rst:2615 msgid "" "The :mod:`!sqlite3` module API does not support strings containing " "surrogates." msgstr "" +":mod:`!sqlite3` モジュールの API は、サロゲートを含む文字列をサポートしていま" +"せん。" -#: ../../library/sqlite3.rst:2620 msgid ":ref:`unicode-howto`" -msgstr "" +msgstr ":ref:`unicode-howto`" #: ../../library/sqlite3.rst:2626 msgid "Explanation" @@ -3685,31 +4079,30 @@ msgstr "説明" msgid "Transaction control" msgstr "トランザクション制御" -#: ../../library/sqlite3.rst:2634 msgid "" ":mod:`!sqlite3` offers multiple methods of controlling whether, when and how " "database transactions are opened and closed. :ref:`sqlite3-transaction-" "control-autocommit` is recommended, while :ref:`sqlite3-transaction-control-" "isolation-level` retains the pre-Python 3.12 behaviour." msgstr "" -":mod:`!sqlite3` は、データベース・トランザクションを開くかどうか、いつ、どの" -"ように開くかを制御する複数の方法を提供します。 :ref:`sqlite3-transaction-" -"control-autocommit` が推奨されますが、:ref:`sqlite3-transaction-control-" -"isolation-level` は Python 3.12 より前の動作を保持します。" +":mod:`!sqlite3` は、データベース・トランザクションを開閉するかどうか、いつ、" +"どのように開閉するかを制御する複数の方法を提供します。\n" +":ref:`sqlite3-transaction-control-autocommit` が推奨されますが、:ref:" +"`sqlite3-transaction-control-isolation-level` は Python 3.12 より前の動作を保" +"持します。" #: ../../library/sqlite3.rst:2643 msgid "Transaction control via the ``autocommit`` attribute" msgstr "``autocommit`` 属性に依るトランザクション制御" -#: ../../library/sqlite3.rst:2645 msgid "" "The recommended way of controlling transaction behaviour is through the :" "attr:`Connection.autocommit` attribute, which should preferably be set using " "the *autocommit* parameter of :func:`connect`." msgstr "" -"トランザクションの動作を制御する推奨方法は、 :attr:`Connection.autocommit` 属" -"性を使用することです。 この属性は :func:`connect` の *autocommit* パラメータ" -"を使用して設定して頂けるとありがたいです。" +"トランザクションの動作は :attr:`Connection.autocommit` 属性で制御することを推" +"奨します。\n" +"この属性は、できれば :func:`connect` の *autocommit* 引数で設定してください。" #: ../../library/sqlite3.rst:2650 msgid "" @@ -3719,7 +4112,6 @@ msgstr "" "*autocommit* を ``False`` に設定することをお勧めします。そうすると :pep:" "`249` 対応のトランザクション制御を行います。これは以下のことを意味します:" -#: ../../library/sqlite3.rst:2654 msgid "" ":mod:`!sqlite3` ensures that a transaction is always open, so :func:" "`connect`, :meth:`Connection.commit`, and :meth:`Connection.rollback` will " @@ -3727,11 +4119,12 @@ msgid "" "one, for the latter two). :mod:`!sqlite3` uses ``BEGIN DEFERRED`` statements " "when opening transactions." msgstr "" -":mod:`!sqlite3` はトランザクションが常に開いていることを保証します。そのた" -"め、 :func:`connect` や :meth:`Connection.commit` や :meth:`Connection." -"rollback` は暗黙に新しいトランザクションを開きます(1つ目については保留中のト" -"ランザクションを閉じた直後で、後の2つについてはその直後に、です)。 :mod:`!" -"sqlite3` はトランザクションを開くときに ``BEGIN DEFERRED`` 文を使用します。" +":mod:`!sqlite3` はトランザクションが常に開いていることを保証します。\n" +"そのため、 :func:`connect` や :meth:`Connection.commit` や :meth:`Connection." +"rollback` は暗黙に新しいトランザクションを開きます(後者 2 つでは、保留中のト" +"ランザクションを閉じた直後に開きます)。\n" +":mod:`!sqlite3` はトランザクションを開くときに ``BEGIN DEFERRED`` 文を使用し" +"ます。" #: ../../library/sqlite3.rst:2659 msgid "Transactions should be committed explicitly using :meth:`!commit`." @@ -3745,13 +4138,12 @@ msgstr "" "トランザクションは、 :meth:`!rollback` を使用して明示的にロールバックする必要" "があります。" -#: ../../library/sqlite3.rst:2661 msgid "" "An implicit rollback is performed if the database is :meth:`~Connection." "close`-ed with pending changes." msgstr "" -"データベースの保留中に行った変更は :meth:`~Connection.close` された場合、暗黙" -"のロールバックが実行されます。" +"未コミットの変更がある状態でデータベース接続を :meth:`~Connection.close` する" +"と、暗黙のロールバックが実行されます。" #: ../../library/sqlite3.rst:2664 msgid "" @@ -3802,9 +4194,9 @@ msgid "" msgstr "" ":attr:`Connection.autocommit` が :data:`LEGACY_TRANSACTION_CONTROL` (これがデ" "フォルトです)に設定されている場合、トランザクションの振る舞いは :attr:" -"`Connection.isolation_level` 属性を使用して制御されます。 :data:" -"`LEGACY_TRANSACTION_CONTROL` 以外の場合、 :attr:`!isolation_level` は効果があ" -"りません。" +"`Connection.isolation_level` 属性を使用して制御されます。 " +"``LEGACY_TRANSACTION_CONTROL`` 以外の場合、 :attr:`!isolation_level` は効果が" +"ありません。" #: ../../library/sqlite3.rst:2695 msgid "" @@ -3876,9 +4268,8 @@ msgstr "" msgid "? (question mark)" msgstr "? (クエスチョンマーク)" -#: ../../library/sqlite3.rst:1475 ../../library/sqlite3.rst:1476 msgid "in SQL statements" -msgstr "" +msgstr "SQL 文中の" #: ../../library/sqlite3.rst:1476 msgid ": (colon)" diff --git a/library/ssl.po b/library/ssl.po index c06f2fc37..800b86f4f 100644 --- a/library/ssl.po +++ b/library/ssl.po @@ -21,10 +21,10 @@ msgstr "" "Last-Translator: Arihiro TAKASE, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/ssl.rst:2 @@ -51,28 +51,29 @@ msgstr "" "ム、 Windows 、 macOS 、その他幾つかの OpenSSL がインストールされているプラッ" "トフォームで利用できます。" -#: ../../library/ssl.rst:26 msgid "" "Some behavior may be platform dependent, since calls are made to the " "operating system socket APIs. The installed version of OpenSSL may also " "cause variations in behavior. For example, TLSv1.3 comes with OpenSSL " "version 1.1.1." msgstr "" +"OS のソケット API を呼び出すため、一部の動作はプラットフォームに依存する場合" +"があります。\n" +"インストールされている OpenSSL のバージョンによって動作が異なることもありま" +"す。\n" +"例えば TLSv1.3 は OpenSSL バージョン 1.1.1 から利用できます。" -#: ../../library/ssl.rst:32 msgid "" "Don't use this module without reading the :ref:`ssl-security`. Doing so may " "lead to a false sense of security, as the default settings of the ssl module " "are not necessarily appropriate for your application." msgstr "" -":ref:`ssl-security` を読まずにこのモジュールを使用しないでください。SSL のデ" -"フォルト設定はアプリケーションに十分ではないので、読まない場合はセキュリティ" -"に誤った意識を持ってしまうかもしれません。" +":ref:`ssl-security` を読まずにこのモジュールを使用しないでください。\n" +"ssl モジュールのデフォルト設定がアプリケーションに適しているとは限らないた" +"め、読まずに使うと安全だと思い込んでしまうおそれがあります。" -#: ../../library/ssl.rst:454 ../../library/ssl.rst:469 -#: ../../includes/wasm-notavail.rst:3 msgid "Availability" -msgstr "" +msgstr "利用可能な環境" #: ../../includes/wasm-notavail.rst:5 msgid "" @@ -92,7 +93,6 @@ msgstr "" "TLS, SSL, 証明書に関するより一般的な情報は、末尾にある \"See Also\" のセク" "ションを参照してください。" -#: ../../library/ssl.rst:42 msgid "" "This module provides a class, :class:`ssl.SSLSocket`, which is derived from " "the :class:`socket.socket` type, and provides a socket-like wrapper that " @@ -103,6 +103,14 @@ msgid "" "`get_verified_chain`, :meth:`get_unverified_chain` which retrieves " "certificate chain." msgstr "" +"このモジュールは :class:`socket.socket` 型の派生クラス :class:`ssl." +"SSLSocket` を提供します。\n" +"これはソケットのように使えるラッパーで、ソケットを流れるデータの暗号化と復号" +"も SSL で行います。\n" +"接続相手の証明書を取得する :meth:`getpeercert`、安全な接続で使っている暗号方" +"式を取得する :meth:`cipher`、証明書チェインを取得する :meth:" +"`get_verified_chain` や :meth:`get_unverified_chain` などの追加メソッドに対応" +"しています。" #: ../../library/ssl.rst:51 msgid "" @@ -114,9 +122,8 @@ msgstr "" "と証明書の管理の助けとなるでしょう。それは :meth:`SSLContext.wrap_socket` メ" "ソッドを通して SSL ソケットを作成することで引き継がれます。" -#: ../../library/ssl.rst:55 msgid "Updated to support linking with OpenSSL 1.1.0" -msgstr "" +msgstr "OpenSSL 1.1.0 とのリンクに対応しました。" #: ../../library/ssl.rst:60 msgid "" @@ -127,16 +134,16 @@ msgstr "" "ssl モジュールは、将来的に OpenSSL 1.0.2 または 1.1.0 を必要とするようになり" "ます。" -#: ../../library/ssl.rst:66 msgid "" ":pep:`644` has been implemented. The ssl module requires OpenSSL 1.1.1 or " "newer." msgstr "" +":pep:`644` が実装されました。\n" +"ssl モジュールは OpenSSL 1.1.1 以降を必要とします。" -#: ../../library/ssl.rst:69 msgid "" "Use of deprecated constants and functions result in deprecation warnings." -msgstr "" +msgstr "非推奨の定数や関数を使うと、非推奨の警告が出るようになりました。" #: ../../library/ssl.rst:73 msgid "Functions, Constants, and Exceptions" @@ -146,18 +153,21 @@ msgstr "関数、定数、例外" msgid "Socket creation" msgstr "ソケットの作成" -#: ../../library/ssl.rst:79 msgid "" "Instances of :class:`SSLSocket` must be created using the :meth:`SSLContext." "wrap_socket` method. The helper function :func:`create_default_context` " "returns a new context with secure default settings." msgstr "" +":class:`SSLSocket` のインスタンスは :meth:`SSLContext.wrap_socket` メソッドで" +"作成しなければなりません。\n" +"ヘルパー関数 :func:`create_default_context` は、安全なデフォルト設定を持つ新" +"しいコンテキストを返します。" -#: ../../library/ssl.rst:84 msgid "Client socket example with default context and IPv4/IPv6 dual stack::" msgstr "" +"デフォルトのコンテキストと IPv4/IPv6 デュアルスタックを使うクライアントソケッ" +"トの例です。 ::" -#: ../../library/ssl.rst:86 msgid "" "import socket\n" "import ssl\n" @@ -169,12 +179,19 @@ msgid "" " with context.wrap_socket(sock, server_hostname=hostname) as ssock:\n" " print(ssock.version())" msgstr "" +"import socket\n" +"import ssl\n" +"\n" +"hostname = 'www.python.org'\n" +"context = ssl.create_default_context()\n" +"\n" +"with socket.create_connection((hostname, 443)) as sock:\n" +" with context.wrap_socket(sock, server_hostname=hostname) as ssock:\n" +" print(ssock.version())" -#: ../../library/ssl.rst:97 msgid "Client socket example with custom context and IPv4::" -msgstr "" +msgstr "独自のコンテキストと IPv4 を使うクライアントソケットの例です。 ::" -#: ../../library/ssl.rst:99 msgid "" "hostname = 'www.python.org'\n" "# PROTOCOL_TLS_CLIENT requires valid cert chain and hostname\n" @@ -185,12 +202,18 @@ msgid "" " with context.wrap_socket(sock, server_hostname=hostname) as ssock:\n" " print(ssock.version())" msgstr "" +"hostname = 'www.python.org'\n" +"# PROTOCOL_TLS_CLIENT は有効な証明書チェインとホスト名を必要とする\n" +"context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)\n" +"context.load_verify_locations('path/to/cabundle.pem')\n" +"\n" +"with socket.socket(socket.AF_INET, socket.SOCK_STREAM, 0) as sock:\n" +" with context.wrap_socket(sock, server_hostname=hostname) as ssock:\n" +" print(ssock.version())" -#: ../../library/ssl.rst:109 msgid "Server socket example listening on localhost IPv4::" -msgstr "" +msgstr "ローカルホストの IPv4 で接続を待ち受けるサーバーソケットの例です。 ::" -#: ../../library/ssl.rst:111 msgid "" "context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)\n" "context.load_cert_chain('/path/to/certchain.pem', '/path/to/private.key')\n" @@ -202,6 +225,15 @@ msgid "" " conn, addr = ssock.accept()\n" " ..." msgstr "" +"context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)\n" +"context.load_cert_chain('/path/to/certchain.pem', '/path/to/private.key')\n" +"\n" +"with socket.socket(socket.AF_INET, socket.SOCK_STREAM, 0) as sock:\n" +" sock.bind(('127.0.0.1', 8443))\n" +" sock.listen(5)\n" +" with context.wrap_socket(sock, server_side=True) as ssock:\n" +" conn, addr = ssock.accept()\n" +" ..." #: ../../library/ssl.rst:123 msgid "Context creation" @@ -239,7 +271,6 @@ msgstr "" "べてが :const:`None` であれば、この関数は代わりにシステムのデフォルトの CA 証" "明書を信用して選択することができます。" -#: ../../library/ssl.rst:141 msgid "" "The settings are: :data:`PROTOCOL_TLS_CLIENT` or :data:" "`PROTOCOL_TLS_SERVER`, :data:`OP_NO_SSLv2`, and :data:`OP_NO_SSLv3` with " @@ -250,15 +281,24 @@ msgid "" "or uses :meth:`SSLContext.load_default_certs` to load default CA " "certificates." msgstr "" +"設定には :data:`PROTOCOL_TLS_CLIENT` または :data:`PROTOCOL_TLS_SERVER`、:" +"data:`OP_NO_SSLv2`、:data:`OP_NO_SSLv3` を使い、RC4 と認証を行わない暗号ス" +"イートを除いた、強度の高い暗号スイートを選びます。\n" +"*purpose* に :const:`~Purpose.SERVER_AUTH` を渡すと、:data:`~SSLContext." +"verify_mode` を :data:`CERT_REQUIRED` に設定します。\n" +"さらに、*cafile*、*capath*、*cadata* のいずれかが指定されていればその CA 証明" +"書を読み込み、指定されていなければ :meth:`SSLContext.load_default_certs` でデ" +"フォルトの CA 証明書を読み込みます。" -#: ../../library/ssl.rst:150 msgid "" "When :attr:`~SSLContext.keylog_filename` is supported and the environment " "variable :envvar:`SSLKEYLOGFILE` is set, :func:`create_default_context` " "enables key logging." msgstr "" +":attr:`~SSLContext.keylog_filename` に対応していて環境変数 :envvar:" +"`SSLKEYLOGFILE` が設定されている場合、:func:`create_default_context` は鍵のロ" +"グ記録を有効にします。" -#: ../../library/ssl.rst:154 msgid "" "The default settings for this context include :data:" "`VERIFY_X509_PARTIAL_CHAIN` and :data:`VERIFY_X509_STRICT`. These make the " @@ -266,6 +306,10 @@ msgid "" "implementation of :rfc:`5280`, in exchange for a small amount of " "incompatibility with older X.509 certificates." msgstr "" +"このコンテキストのデフォルト設定には :data:`VERIFY_X509_PARTIAL_CHAIN` と :" +"data:`VERIFY_X509_STRICT` が含まれます。\n" +"これにより、基盤となる OpenSSL 実装の動作が :rfc:`5280` により準拠するように" +"なりますが、古い X.509 証明書との互換性がわずかに失われます。" #: ../../library/ssl.rst:161 msgid "" @@ -303,25 +347,30 @@ msgstr "" "それでもまだこの関数を使って、ただし SSL 3.0 接続を許可したいと望むならば、こ" "れをこのように再有効化できます::" -#: ../../library/ssl.rst:178 msgid "" "ctx = ssl.create_default_context(Purpose.CLIENT_AUTH)\n" "ctx.options &= ~ssl.OP_NO_SSLv3" msgstr "" +"ctx = ssl.create_default_context(Purpose.CLIENT_AUTH)\n" +"ctx.options &= ~ssl.OP_NO_SSLv3" -#: ../../library/ssl.rst:182 msgid "" "This context enables :data:`VERIFY_X509_STRICT` by default, which may reject " "pre-:rfc:`5280` or malformed certificates that the underlying OpenSSL " "implementation otherwise would accept. While disabling this is not " "recommended, you can do so using::" msgstr "" +"このコンテキストはデフォルトで :data:`VERIFY_X509_STRICT` を有効にするため、" +"無効にしていれば OpenSSL が受け入れる :rfc:`5280` より前の証明書や不正な形式" +"の証明書を拒否する場合があります。\n" +"無効にすることは推奨しませんが、次のようにすれば無効にできます。 ::" -#: ../../library/ssl.rst:187 msgid "" "ctx = ssl.create_default_context()\n" "ctx.verify_flags &= ~ssl.VERIFY_X509_STRICT" msgstr "" +"ctx = ssl.create_default_context()\n" +"ctx.verify_flags &= ~ssl.VERIFY_X509_STRICT" #: ../../library/ssl.rst:194 msgid "RC4 was dropped from the default cipher string." @@ -335,21 +384,23 @@ msgstr "デフォルトの暗号化文字列に ChaCha20/Poly1305 が追加さ msgid "3DES was dropped from the default cipher string." msgstr "デフォルトの暗号化文字列から 3DES が除かれました。" -#: ../../library/ssl.rst:204 msgid "Support for key logging to :envvar:`SSLKEYLOGFILE` was added." -msgstr "" +msgstr ":envvar:`SSLKEYLOGFILE` への鍵のログ記録に対応しました。" -#: ../../library/ssl.rst:208 msgid "" "The context now uses :data:`PROTOCOL_TLS_CLIENT` or :data:" "`PROTOCOL_TLS_SERVER` protocol instead of generic :data:`PROTOCOL_TLS`." msgstr "" +"このコンテキストは、汎用の :data:`PROTOCOL_TLS` の代わりに :data:" +"`PROTOCOL_TLS_CLIENT` または :data:`PROTOCOL_TLS_SERVER` プロトコルを使うよう" +"になりました。" -#: ../../library/ssl.rst:214 msgid "" "The context now uses :data:`VERIFY_X509_PARTIAL_CHAIN` and :data:" "`VERIFY_X509_STRICT` in its default verify flags." msgstr "" +"このコンテキストのデフォルトの検証フラグに :data:`VERIFY_X509_PARTIAL_CHAIN` " +"と :data:`VERIFY_X509_STRICT` が含まれるようになりました。" #: ../../library/ssl.rst:219 msgid "Exceptions" @@ -393,15 +444,15 @@ msgstr "" "``CERTIFICATE_VERIFY_FAILED`` などです。取り得る値は OpenSSL のバージョンに依" "存します。" -#: ../../library/ssl.rst:251 msgid "" "A subclass of :exc:`SSLError` raised when trying to read or write and the " "SSL connection has been closed cleanly. Note that this doesn't mean that " "the underlying transport (read TCP) has been closed." msgstr "" -"読み出しあるいは書き込みを試みようとした際に SSL コネクションが行儀よく閉じら" -"れてしまった場合に送出される :exc:`SSLError` サブクラス例外です。これは下層の" -"転送(read TCP)が閉じたことは意味しないことに注意してください。" +"SSL 接続が正常に閉じられた後に読み書きを試みたときに送出される :exc:" +"`SSLError` のサブクラスです。\n" +"これは、基盤となるトランスポート (つまり TCP) が閉じられたことを意味するわけ" +"ではありません。" #: ../../library/ssl.rst:259 msgid "" @@ -414,16 +465,14 @@ msgstr "" "socket ` によって送出される :exc:`SSLError` サブクラス例外で" "す。" -#: ../../library/ssl.rst:268 msgid "" "A subclass of :exc:`SSLError` raised by a :ref:`non-blocking SSL socket ` when trying to read or write data, but more data needs to be " "sent on the underlying TCP transport before the request can be fulfilled." msgstr "" -"読み出しあるいは書き込みを試みようとした際に、リクエストが遂行される前に下層" -"の TCP 転送が送信する必要があるデータが不足した場合に :ref:`non-blocking SSL " -"socket ` によって送出される :exc:`SSLError` サブクラス例外で" -"す。" +"読み出しや書き込みを試みた際に、リクエストを完了するために下層の TCP 転送でさ" +"らにデータを送信する必要がある場合に、:ref:`non-blocking SSL socket ` が送出する :exc:`SSLError` のサブクラスです。" #: ../../library/ssl.rst:277 msgid "" @@ -445,18 +494,16 @@ msgstr "" "例外です。一般的に、このエラーが起こったら下層の転送を再利用しようと試みるべ" "きではありません。" -#: ../../library/ssl.rst:293 msgid "" "A subclass of :exc:`SSLError` raised when certificate validation has failed." msgstr "" +"証明書の検証に失敗したときに送出される :exc:`SSLError` のサブクラスです。" -#: ../../library/ssl.rst:300 msgid "A numeric error number that denotes the verification error." -msgstr "" +msgstr "検証エラーを表す数値のエラー番号。" -#: ../../library/ssl.rst:304 msgid "A human readable string of the verification error." -msgstr "" +msgstr "検証エラーを人が読める形で表した文字列。" #: ../../library/ssl.rst:308 msgid "An alias for :exc:`SSLCertVerificationError`." @@ -470,7 +517,6 @@ msgstr "例外は :exc:`SSLCertVerificationError` の別名になりました。 msgid "Random generation" msgstr "乱数生成" -#: ../../library/ssl.rst:319 msgid "" "Return *num* cryptographically strong pseudo-random bytes. Raises an :class:" "`SSLError` if the PRNG has not been seeded with enough data or if the " @@ -478,10 +524,10 @@ msgid "" "can be used to check the status of the PRNG and :func:`RAND_add` can be used " "to seed the PRNG." msgstr "" -"暗号学的に強固な擬似乱数の *num* バイトを返します。擬似乱数生成器に十分なデー" -"タでシードが与えられていない場合や、現在の RANDOM メソッドに操作がサポートさ" -"れていない場合は :class:`SSLError` を送出します。 :func:`RAND_status` を使っ" -"て擬似乱数生成器の状態をチェックできます。\n" +"暗号学的に強固な擬似乱数の *num* バイトを返します。\n" +"擬似乱数生成器に十分なデータでシードが与えられていない場合や、現在の RAND メ" +"ソッドに操作がサポートされていない場合は :class:`SSLError` を送出します。\n" +":func:`RAND_status` を使って擬似乱数生成器の状態をチェックできます。\n" ":func:`RAND_add` を使って擬似乱数生成器にシードを与えることができます。" #: ../../library/ssl.rst:325 @@ -515,13 +561,16 @@ msgstr "" "func:`ssl.RAND_add` を使って擬似乱数生成機にランダム性を加えることができま" "す。" -#: ../../library/ssl.rst:343 msgid "" "Mix the given *bytes* into the SSL pseudo-random number generator. The " "parameter *entropy* (a float) is a lower bound on the entropy contained in " "string (so you can always use ``0.0``). See :rfc:`1750` for more " "information on sources of entropy." msgstr "" +"指定された *bytes* を SSL の擬似乱数生成器に混ぜ込みます。\n" +"*entropy* 引数 (浮動小数点数) は、この文字列に含まれるエントロピーの下限です " +"(そのため常に ``0.0`` を使うこともできます)。\n" +"エントロピー源の詳細は :rfc:`1750` を参照してください。" #: ../../library/ssl.rst:348 msgid "Writable :term:`bytes-like object` is now accepted." @@ -563,17 +612,16 @@ msgstr "" "\"notBefore\" や \"notAfter\" の日付には GMT を使わなければなりません(:rfc:" "`5280`)。" -#: ../../library/ssl.rst:379 msgid "" "Interpret the input time as a time in UTC as specified by 'GMT' timezone in " "the input string. Local timezone was used previously. Return an integer (no " "fractions of a second in the input format)" msgstr "" -"入力文字列に指定された 'GMT' タイムゾーンを UTC として解釈するようになりまし" -"た。以前はローカルタイムで解釈していました。また、整数を返すようになりました" -"(入力に含まれる秒の端数を含まない)。" +"入力文字列の 'GMT' タイムゾーン指定に従い、入力時刻を UTC として解釈するよう" +"になりました。\n" +"以前はローカルタイムゾーンで解釈していました。\n" +"整数を返します (入力形式には秒の小数部分がありません)。" -#: ../../library/ssl.rst:388 msgid "" "Given the address ``addr`` of an SSL-protected server, as a (*hostname*, " "*port-number*) pair, fetches the server's certificate, and returns it as a " @@ -586,6 +634,17 @@ msgid "" "validation attempt fails. A timeout can be specified with the ``timeout`` " "parameter." msgstr "" +"SSL で保護されたサーバーのアドレス ``addr`` を (*hostname*、*port-number*) の" +"対で受け取り、サーバーの証明書を取得して PEM エンコードされた文字列で返しま" +"す。\n" +"``ssl_version`` を指定すると、そのバージョンの SSL プロトコルでサーバーへの接" +"続を試みます。\n" +"*ca_certs* を指定する場合は、:meth:`SSLContext.load_verify_locations` の " +"*cafile* 引数と同じ形式で、ルート証明書のリストを含むファイルを指定してくださ" +"い。\n" +"この関数はそのルート証明書群でサーバー証明書の検証を試み、検証に失敗すると呼" +"び出しも失敗します。\n" +"``timeout`` 引数でタイムアウトを指定できます。" #: ../../library/ssl.rst:399 msgid "This function is now IPv6-compatible." @@ -645,21 +704,19 @@ msgstr "" ":attr:`capath` - capath の解決済みパス、またはディレクトリが存在しない場合は " "``None``" -#: ../../library/ssl.rst:428 msgid "" ":attr:`openssl_cafile_env` - OpenSSL's environment key that points to a " "cafile," -msgstr ":attr:`openssl_cafile_env` - cafile を指す OpenSSL の環境変数" +msgstr ":attr:`openssl_cafile_env` - cafile を指す OpenSSL の環境変数名" #: ../../library/ssl.rst:429 msgid ":attr:`openssl_cafile` - hard coded path to a cafile," msgstr ":attr:`openssl_cafile` - OpenSSL にハードコードされた cafile のパス" -#: ../../library/ssl.rst:430 msgid "" ":attr:`openssl_capath_env` - OpenSSL's environment key that points to a " "capath," -msgstr ":attr:`openssl_capath_env` - capath を指す OpenSSL の環境変数" +msgstr ":attr:`openssl_capath_env` - capath を指す OpenSSL の環境変数名" #: ../../library/ssl.rst:431 msgid ":attr:`openssl_capath` - hard coded path to a capath directory" @@ -694,12 +751,14 @@ msgstr "" msgid "Example::" msgstr "以下はプログラム例です::" -#: ../../library/ssl.rst:450 msgid "" ">>> ssl.enum_certificates(\"CA\")\n" "[(b'data...', 'x509_asn', {'1.3.6.1.5.5.7.3.1', '1.3.6.1.5.5.7.3.2'}),\n" " (b'data...', 'x509_asn', True)]" msgstr "" +">>> ssl.enum_certificates(\"CA\")\n" +"[(b'data...', 'x509_asn', {'1.3.6.1.5.5.7.3.1', '1.3.6.1.5.5.7.3.2'}),\n" +" (b'data...', 'x509_asn', True)]" #: ../../library/ssl.rst:460 msgid "" @@ -733,19 +792,24 @@ msgstr "" "すべての定数が :class:`enum.IntEnum` コレクションまたは :class:`enum." "IntFlag` コレクションになりました。" -#: ../../library/ssl.rst:483 msgid "" "Possible value for :attr:`SSLContext.verify_mode`. Except for :const:" "`PROTOCOL_TLS_CLIENT`, it is the default mode. With client-side sockets, " "just about any cert is accepted. Validation errors, such as untrusted or " "expired cert, are ignored and do not abort the TLS/SSL handshake." msgstr "" +":attr:`SSLContext.verify_mode` に指定できる値です。\n" +":const:`PROTOCOL_TLS_CLIENT` を除き、これがデフォルトのモードです。\n" +"クライアント側のソケットでは、ほぼどのような証明書でも受け入れます。\n" +"信頼されていない証明書や期限切れの証明書などの検証エラーは無視され、TLS/SSL " +"ハンドシェイクを中断しません。" -#: ../../library/ssl.rst:489 msgid "" "In server mode, no certificate is requested from the client, so the client " "does not send any for client cert authentication." msgstr "" +"サーバーモードではクライアントに証明書を要求しないため、クライアントはクライ" +"アント証明書認証用の証明書を送りません。" #: ../../library/ssl.rst:492 ../../library/ssl.rst:2406 msgid "See the discussion of :ref:`ssl-security` below." @@ -753,14 +817,17 @@ msgstr "" "このドキュメントの下の方の、 :ref:`ssl-security` に関する議論を参照してくださ" "い。" -#: ../../library/ssl.rst:496 msgid "" "Possible value for :attr:`SSLContext.verify_mode`. In client mode, :const:" "`CERT_OPTIONAL` has the same meaning as :const:`CERT_REQUIRED`. It is " "recommended to use :const:`CERT_REQUIRED` for client-side sockets instead." msgstr "" +":attr:`SSLContext.verify_mode` に指定できる値です。\n" +"クライアントモードでは :const:`CERT_OPTIONAL` は :const:`CERT_REQUIRED` と同" +"じ意味になります。\n" +"クライアント側のソケットでは、代わりに :const:`CERT_REQUIRED` を使うことをお" +"勧めします。" -#: ../../library/ssl.rst:501 msgid "" "In server mode, a client certificate request is sent to the client. The " "client may either ignore the request or send a certificate in order perform " @@ -768,14 +835,19 @@ msgid "" "certificate, it is verified. Any verification error immediately aborts the " "TLS handshake." msgstr "" +"サーバーモードでは、クライアントに証明書を要求します。\n" +"クライアントは要求を無視することも、TLS のクライアント証明書認証を行うために" +"証明書を送ることもできます。\n" +"クライアントが証明書を送った場合は検証し、検証エラーがあれば直ちに TLS ハンド" +"シェイクを中断します。" -#: ../../library/ssl.rst:507 ../../library/ssl.rst:526 msgid "" "Use of this setting requires a valid set of CA certificates to be passed to :" "meth:`SSLContext.load_verify_locations`." msgstr "" +"この設定を使うには、有効な CA 証明書の組を :meth:`SSLContext." +"load_verify_locations` に渡す必要があります。" -#: ../../library/ssl.rst:512 msgid "" "Possible value for :attr:`SSLContext.verify_mode`. In this mode, " "certificates are required from the other side of the socket connection; an :" @@ -786,13 +858,25 @@ msgid "" "cert. :const:`PROTOCOL_TLS_CLIENT` uses :const:`CERT_REQUIRED` and enables :" "attr:`~SSLContext.check_hostname` by default." msgstr "" +":attr:`SSLContext.verify_mode` に指定できる値です。\n" +"このモードではソケットの接続相手の証明書を必須とし、証明書が提供されない場合" +"や検証に失敗した場合は :class:`SSLError` を送出します。\n" +"ただしホスト名を照合しないため、クライアントモードの証明書検証にはこの設定だ" +"けでは **不十分** です。\n" +"証明書が本物であることを検証するには :attr:`~SSLContext.check_hostname` も有" +"効にしなければなりません。\n" +":const:`PROTOCOL_TLS_CLIENT` はデフォルトで :const:`CERT_REQUIRED` を使い、:" +"attr:`~SSLContext.check_hostname` を有効にします。" -#: ../../library/ssl.rst:522 msgid "" "With server socket, this mode provides mandatory TLS client cert " "authentication. A client certificate request is sent to the client and the " "client must provide a valid and trusted certificate." msgstr "" +"サーバーソケットでは、このモードで TLS のクライアント証明書認証を必須にしま" +"す。\n" +"クライアントに証明書を要求し、クライアントは有効で信頼できる証明書を提供しな" +"ければなりません。" #: ../../library/ssl.rst:531 msgid ":class:`enum.IntEnum` collection of CERT_* constants." @@ -808,7 +892,6 @@ msgstr "" "スト(CRLs)はチェックされません。デフォルトでは OpenSSL は CRLs を必要ともしま" "せんし検証にも使いません。" -#: ../../library/ssl.rst:545 msgid "" "Possible value for :attr:`SSLContext.verify_flags`. In this mode, only the " "peer cert is checked but none of the intermediate CA certificates. The mode " @@ -816,11 +899,12 @@ msgid "" "ancestor CA). If no proper CRL has been loaded with :attr:`SSLContext." "load_verify_locations`, validation will fail." msgstr "" -":attr:`SSLContext.verify_flags` に渡せる値です。このモードでは、接続先の証明" -"書のみがチェックされ、仲介の CA 証明書はチェックされません。接続先証明書の発" -"行者(その CA の直接の祖先)によって署名された妥当な CRL が必要です。 :attr:" -"`SSLContext.load_verify_locations` で相応しい CRL をロードしていなければ、検" -"証は失敗します。" +":attr:`SSLContext.verify_flags` に指定できる値です。\n" +"このモードでは接続先の証明書だけを検証し、中間 CA 証明書は検証しません。\n" +"接続先証明書の発行者 (その証明書の直接の上位 CA) が署名した有効な CRL が必要" +"です。\n" +":attr:`SSLContext.load_verify_locations` で適切な CRL をロードしていない場" +"合、検証に失敗します。" #: ../../library/ssl.rst:555 msgid "" @@ -838,11 +922,12 @@ msgstr "" ":attr:`SSLContext.verify_flags` に渡せる値で、壊れた X.509 証明書に対するワー" "クアラウンドを無効にします。" -#: ../../library/ssl.rst:569 msgid "" "Possible value for :attr:`SSLContext.verify_flags` to enables proxy " "certificate verification." msgstr "" +"プロキシ証明書の検証を有効にする、:attr:`SSLContext.verify_flags` に指定でき" +"る値です。" #: ../../library/ssl.rst:576 msgid "" @@ -854,7 +939,6 @@ msgstr "" "ために信頼チェインを構築する際、信頼できる証明書を選ぶように指示します。これ" "はデフォルトで有効にされています。" -#: ../../library/ssl.rst:584 msgid "" "Possible value for :attr:`SSLContext.verify_flags`. It instructs OpenSSL to " "accept intermediate CAs in the trust store to be treated as trust-anchors, " @@ -862,6 +946,11 @@ msgid "" "possible to trust certificates issued by an intermediate CA without having " "to trust its ancestor root CA." msgstr "" +":attr:`SSLContext.verify_flags` に指定できる値です。\n" +"OpenSSL に対し、信頼ストア内の中間 CA を、自己署名されたルート CA 証明書と同" +"様に信頼の起点として扱うよう指示します。\n" +"これにより、上位のルート CA を信頼せずに、中間 CA が発行した証明書を信頼でき" +"ます。" #: ../../library/ssl.rst:595 msgid ":class:`enum.IntFlag` collection of VERIFY_* constants." @@ -877,26 +966,33 @@ msgstr "" "なものを選択します。名前に反して、このオプションは \"SSL\" と \"TLS\" プロト" "コルのいずれも選択できます。" -#: ../../library/ssl.rst:608 msgid "" "TLS clients and servers require different default settings for secure " "communication. The generic TLS protocol constant is deprecated in favor of :" "data:`PROTOCOL_TLS_CLIENT` and :data:`PROTOCOL_TLS_SERVER`." msgstr "" +"安全に通信するためには、TLS クライアントとサーバーでは異なるデフォルト設定が" +"必要です。\n" +"汎用の TLS プロトコル定数は非推奨となり、代わりに :data:" +"`PROTOCOL_TLS_CLIENT` と :data:`PROTOCOL_TLS_SERVER` を使います。" -#: ../../library/ssl.rst:614 msgid "" "Auto-negotiate the highest protocol version that both the client and server " "support, and configure the context client-side connections. The protocol " "enables :data:`CERT_REQUIRED` and :attr:`~SSLContext.check_hostname` by " "default." msgstr "" +"クライアントとサーバーが共に対応する最も新しいプロトコルバージョンを自動的に" +"ネゴシエートし、コンテキストをクライアント側の接続用に設定します。\n" +"このプロトコルはデフォルトで :data:`CERT_REQUIRED` と :attr:`~SSLContext." +"check_hostname` を有効にします。" -#: ../../library/ssl.rst:623 msgid "" "Auto-negotiate the highest protocol version that both the client and server " "support, and configure the context server-side connections." msgstr "" +"クライアントとサーバーが共に対応する最も新しいプロトコルバージョンを自動的に" +"ネゴシエートし、コンテキストをサーバー側の接続用に設定します。" #: ../../library/ssl.rst:630 msgid "Alias for :data:`PROTOCOL_TLS`." @@ -922,22 +1018,23 @@ msgstr "" msgid "SSL version 3 is insecure. Its use is highly discouraged." msgstr "SSL version 3 は非セキュアです。このプロトコルは強く非推奨です。" -#: ../../library/ssl.rst:649 msgid "" "OpenSSL has deprecated all version specific protocols. Use the default " "protocol :data:`PROTOCOL_TLS_SERVER` or :data:`PROTOCOL_TLS_CLIENT` with :" "attr:`SSLContext.minimum_version` and :attr:`SSLContext.maximum_version` " "instead." msgstr "" +"OpenSSL はバージョン固有のプロトコルをすべて非推奨にしています。\n" +"代わりにデフォルトのプロトコル :data:`PROTOCOL_TLS_SERVER` または :data:" +"`PROTOCOL_TLS_CLIENT` と、:attr:`SSLContext.minimum_version`、:attr:" +"`SSLContext.maximum_version` を使ってください。" #: ../../library/ssl.rst:657 msgid "Selects TLS version 1.0 as the channel encryption protocol." msgstr "チャンネル暗号化プロトコルとしてTLSバージョン1.0を選択します。" -#: ../../library/ssl.rst:661 ../../library/ssl.rst:672 -#: ../../library/ssl.rst:683 msgid "OpenSSL has deprecated all version specific protocols." -msgstr "" +msgstr "OpenSSL はバージョン固有のプロトコルをすべて非推奨にしています。" #: ../../library/ssl.rst:665 msgid "" @@ -955,15 +1052,15 @@ msgstr "" "チャンネル暗号化プロトコルとしてTLSバージョン 1.2 を選択します。 openssl " "version 1.0.1+ のみで利用可能です。" -#: ../../library/ssl.rst:687 msgid "" "Enables workarounds for various bugs present in other SSL implementations. " "This option is set by default. It does not necessarily set the same flags " "as OpenSSL's ``SSL_OP_ALL`` constant." msgstr "" "相手にする SSL 実装のさまざまなバグを回避するためのワークアラウンドを有効にし" -"ます。このオプションはデフォルトで有効です。これを有効にする場合 OpenSSL 用の" -"同じ意味のフラグ ``SSL_OP_ALL`` をセットする必要はありません。" +"ます。\n" +"このオプションはデフォルトで有効です。\n" +"OpenSSL の ``SSL_OP_ALL`` 定数と同じフラグを設定するとは限りません。" #: ../../library/ssl.rst:695 msgid "" @@ -1003,11 +1100,13 @@ msgstr "" "組み合わされている場合にのみ適用されます。ピアがプロトコルバージョンとして " "TLSv1 を選択しないようにします。" -#: ../../library/ssl.rst:725 msgid "" "The option is deprecated since OpenSSL 1.1.0, use the new :attr:`SSLContext." "minimum_version` and :attr:`SSLContext.maximum_version` instead." msgstr "" +"このオプションは OpenSSL 1.1.0 から非推奨です。\n" +"代わりに新しい :attr:`SSLContext.minimum_version` と :attr:`SSLContext." +"maximum_version` を使ってください。" #: ../../library/ssl.rst:732 msgid "" @@ -1020,9 +1119,8 @@ msgstr "" "TLSv1.1 を選択しないようにします。openssl バージョン 1.0.1 以降でのみ利用でき" "ます。" -#: ../../library/ssl.rst:738 ../../library/ssl.rst:749 msgid "The option is deprecated since OpenSSL 1.1.0." -msgstr "" +msgstr "このオプションは OpenSSL 1.1.0 から非推奨です。" #: ../../library/ssl.rst:743 msgid "" @@ -1035,7 +1133,6 @@ msgstr "" "TLSv1.2 を選択しないようにします。openssl バージョン 1.0.1 以降でのみ利用でき" "ます。" -#: ../../library/ssl.rst:754 msgid "" "Prevents a TLSv1.3 connection. This option is only applicable in conjunction " "with :const:`PROTOCOL_TLS`. It prevents the peers from choosing TLSv1.3 as " @@ -1043,18 +1140,27 @@ msgid "" "Python has been compiled against an older version of OpenSSL, the flag " "defaults to *0*." msgstr "" +"TLSv1.3 接続を禁止します。\n" +"このオプションは :const:`PROTOCOL_TLS` と組み合わせた場合にのみ適用され、接続" +"する双方がプロトコルバージョンとして TLSv1.3 を選ばないようにします。\n" +"TLS 1.3 は OpenSSL 1.1.1 以降で利用できます。\n" +"それより古い OpenSSL に対して Python をコンパイルした場合、このフラグのデフォ" +"ルトは *0* です。" -#: ../../library/ssl.rst:762 msgid "" "The option is deprecated since OpenSSL 1.1.0. It was added to 2.7.15 and " "3.6.3 for backwards compatibility with OpenSSL 1.0.2." msgstr "" +"このオプションは OpenSSL 1.1.0 から非推奨です。\n" +"OpenSSL 1.0.2 との後方互換性のため、2.7.15 と 3.6.3 に追加されました。" -#: ../../library/ssl.rst:768 msgid "" "Disable all renegotiation in TLSv1.2 and earlier. Do not send HelloRequest " "messages, and ignore renegotiation requests via ClientHello." msgstr "" +"TLSv1.2 以前で、すべての再ネゴシエーションを無効にします。\n" +"HelloRequest メッセージを送信せず、ClientHello による再ネゴシエーション要求を" +"無視します。" #: ../../library/ssl.rst:771 msgid "This option is only available with OpenSSL 1.1.0h and later." @@ -1069,25 +1175,30 @@ msgstr "" "オプションはクライアントソケットと SSLv2 のサーバソケットでは効果はありませ" "ん。" -#: ../../library/ssl.rst:784 msgid "" "Prevents reuse of the same DH key for distinct SSL sessions. This improves " "forward secrecy but requires more computational resources. This option only " "applies to server sockets." msgstr "" +"異なる SSL セッションで同じ DH 鍵を再利用しないようにします。\n" +"前方秘匿性が高まりますが、より多くの計算リソースが必要になります。\n" +"このオプションはサーバーソケットにのみ適用されます。" -#: ../../library/ssl.rst:792 msgid "" "Prevents reuse of the same ECDH key for distinct SSL sessions. This " "improves forward secrecy but requires more computational resources. This " "option only applies to server sockets." msgstr "" +"異なる SSL セッションで同じ ECDH 鍵を再利用しないようにします。\n" +"前方秘匿性が高まりますが、より多くの計算リソースが必要になります。\n" +"このオプションはサーバーソケットにのみ適用されます。" -#: ../../library/ssl.rst:800 msgid "" "Send dummy Change Cipher Spec (CCS) messages in TLS 1.3 handshake to make a " "TLS 1.3 connection look more like a TLS 1.2 connection." msgstr "" +"TLS 1.3 ハンドシェイクでダミーの Change Cipher Spec (CCS) メッセージを送り、" +"TLS 1.3 接続を TLS 1.2 接続に近く見せます。" #: ../../library/ssl.rst:803 msgid "This option is only available with OpenSSL 1.1.1 and later." @@ -1109,35 +1220,43 @@ msgstr "OP_* 定数の :class:`enum.IntFlag` コレクションです。" msgid "Prevent client side from requesting a session ticket." msgstr "クライアントサイドがセッションチケットをリクエストしないようにします。" -#: ../../library/ssl.rst:826 msgid "Ignore unexpected shutdown of TLS connections." -msgstr "" +msgstr "TLS 接続の予期しない切断を無視します。" #: ../../library/ssl.rst:828 ../../library/ssl.rst:844 msgid "This option is only available with OpenSSL 3.0.0 and later." msgstr "このオプションは OpenSSL 3.0.0以降のみで使用できます。" -#: ../../library/ssl.rst:834 msgid "" "Enable the use of the kernel TLS. To benefit from the feature, OpenSSL must " "have been compiled with support for it, and the negotiated cipher suites and " "extensions must be supported by it (a list of supported ones may vary by " "platform and kernel version)." msgstr "" +"カーネル TLS を有効にします。\n" +"この機能を利用するには、OpenSSL がこの機能を有効にしてコンパイルされている必" +"要があります。\n" +"また、カーネル TLS が、ネゴシエートされた暗号スイートと拡張機能をサポートして" +"いなければなりません (対応するものはプラットフォームやカーネルのバージョンに" +"よって異なります)。" -#: ../../library/ssl.rst:839 msgid "" "Note that with enabled kernel TLS some cryptographic operations are " "performed by the kernel directly and not via any available OpenSSL " "Providers. This might be undesirable if, for example, the application " "requires all cryptographic operations to be performed by the FIPS provider." msgstr "" +"カーネル TLS を有効にすると、一部の暗号操作は利用可能な OpenSSL プロバイダー" +"を経由せず、カーネルが直接行います。\n" +"例えばアプリケーションがすべての暗号操作に FIPS プロバイダーを使うことを要求" +"する場合、これは望ましくない可能性があります。" -#: ../../library/ssl.rst:850 msgid "" "Allow legacy insecure renegotiation between OpenSSL and unpatched servers " "only." msgstr "" +"OpenSSL と未修正のサーバーとの間に限り、従来の安全でない再ネゴシエーションを" +"許可します。" #: ../../library/ssl.rst:857 msgid "" @@ -1147,11 +1266,12 @@ msgstr "" "OpenSSL ライブラリが、組み込みで :rfc:`7301` で記述されている *Application-" "Layer Protocol Negotiation* TLS 拡張をサポートしているかどうか。" -#: ../../library/ssl.rst:864 msgid "" "Whether the OpenSSL library has built-in support not checking subject common " "name and :attr:`SSLContext.hostname_checks_common_name` is writeable." msgstr "" +"OpenSSL ライブラリがサブジェクトの共通名を検査しない機能を組み込みで提供し、:" +"attr:`SSLContext.hostname_checks_common_name` が書き込み可能かどうか。" #: ../../library/ssl.rst:872 msgid "" @@ -1227,13 +1347,11 @@ msgstr "" "OpenSSL ライブラリが、組み込みで TLS 1.3 プロトコルをサポートしているかどう" "か。" -#: ../../library/ssl.rst:933 msgid "Whether the OpenSSL library has built-in support for TLS-PSK." -msgstr "" +msgstr "OpenSSL ライブラリが TLS-PSK を組み込みでサポートしているかどうか。" -#: ../../library/ssl.rst:939 msgid "Whether the OpenSSL library has built-in support for TLS-PHA." -msgstr "" +msgstr "OpenSSL ライブラリが TLS-PHA を組み込みでサポートしているかどうか。" #: ../../library/ssl.rst:945 msgid "" @@ -1248,11 +1366,12 @@ msgid "The version string of the OpenSSL library loaded by the interpreter::" msgstr "" "インタプリタによってロードされた OpenSSL ライブラリのバージョン文字列::" -#: ../../library/ssl.rst:954 msgid "" ">>> ssl.OPENSSL_VERSION\n" "'OpenSSL 1.0.2k 26 Jan 2017'" msgstr "" +">>> ssl.OPENSSL_VERSION\n" +"'OpenSSL 1.0.2k 26 Jan 2017'" #: ../../library/ssl.rst:961 msgid "" @@ -1260,23 +1379,27 @@ msgid "" "library::" msgstr "OpenSSL ライブラリのバージョン情報を表す5つの整数のタプル::" -#: ../../library/ssl.rst:964 msgid "" ">>> ssl.OPENSSL_VERSION_INFO\n" "(1, 0, 2, 11, 15)" msgstr "" +">>> ssl.OPENSSL_VERSION_INFO\n" +"(1, 0, 2, 11, 15)" #: ../../library/ssl.rst:971 msgid "The raw version number of the OpenSSL library, as a single integer::" msgstr "1つの整数の形式の、 OpenSSL ライブラリの生のバージョン番号::" -#: ../../library/ssl.rst:973 msgid "" ">>> ssl.OPENSSL_VERSION_NUMBER\n" "268443839\n" ">>> hex(ssl.OPENSSL_VERSION_NUMBER)\n" "'0x100020bf'" msgstr "" +">>> ssl.OPENSSL_VERSION_NUMBER\n" +"268443839\n" +">>> hex(ssl.OPENSSL_VERSION_NUMBER)\n" +"'0x100020bf'" #: ../../library/ssl.rst:984 msgid "" @@ -1330,28 +1453,31 @@ msgstr "" msgid ":class:`enum.IntEnum` collection of SSL_ERROR_* constants." msgstr "SSL_ERROR_* 定数の :class:`enum.IntEnum` コレクションです。" -#: ../../library/ssl.rst:1025 msgid "" ":class:`enum.IntEnum` collection of SSL and TLS versions for :attr:" "`SSLContext.maximum_version` and :attr:`SSLContext.minimum_version`." msgstr "" +":attr:`SSLContext.maximum_version` と :attr:`SSLContext.minimum_version` で使" +"う SSL/TLS バージョンの :class:`enum.IntEnum` コレクションです。" -#: ../../library/ssl.rst:1033 msgid "" "The minimum or maximum supported SSL or TLS version. These are magic " "constants. Their values don't reflect the lowest and highest available TLS/" "SSL versions." msgstr "" +"サポートされる最小または最大の SSL/TLS バージョンです。\n" +"これらは特別な意味を持つ定数であり、その値自体は利用可能な最小・最大の TLS/" +"SSL バージョンを表していません。" -#: ../../library/ssl.rst:1043 msgid "SSL 3.0 to TLS 1.3." -msgstr "" +msgstr "SSL 3.0 から TLS 1.3。" -#: ../../library/ssl.rst:1047 msgid "" "All :class:`TLSVersion` members except :attr:`TLSVersion.TLSv1_2` and :attr:" "`TLSVersion.TLSv1_3` are deprecated." msgstr "" +":attr:`TLSVersion.TLSv1_2` と :attr:`TLSVersion.TLSv1_3` を除く、すべての :" +"class:`TLSVersion` メンバーは非推奨です。" #: ../../library/ssl.rst:1052 msgid "SSL Sockets" @@ -1361,63 +1487,56 @@ msgstr "SSL ソケット" msgid "SSL sockets provide the following methods of :ref:`socket-objects`:" msgstr "SSL ソケットは :ref:`socket-objects` の以下のメソッドを提供します:" -#: ../../library/ssl.rst:1058 msgid ":meth:`~socket.socket.accept`" -msgstr "" +msgstr ":meth:`~socket.socket.accept`" -#: ../../library/ssl.rst:1059 msgid ":meth:`~socket.socket.bind`" -msgstr "" +msgstr ":meth:`~socket.socket.bind`" -#: ../../library/ssl.rst:1060 msgid ":meth:`~socket.socket.close`" -msgstr "" +msgstr ":meth:`~socket.socket.close`" -#: ../../library/ssl.rst:1061 msgid ":meth:`~socket.socket.connect`" -msgstr "" +msgstr ":meth:`~socket.socket.connect`" -#: ../../library/ssl.rst:1062 msgid ":meth:`~socket.socket.detach`" -msgstr "" +msgstr ":meth:`~socket.socket.detach`" -#: ../../library/ssl.rst:1063 msgid ":meth:`~socket.socket.fileno`" -msgstr "" +msgstr ":meth:`~socket.socket.fileno`" -#: ../../library/ssl.rst:1064 msgid ":meth:`~socket.socket.getpeername`, :meth:`~socket.socket.getsockname`" -msgstr "" +msgstr ":meth:`~socket.socket.getpeername`, :meth:`~socket.socket.getsockname`" -#: ../../library/ssl.rst:1065 msgid ":meth:`~socket.socket.getsockopt`, :meth:`~socket.socket.setsockopt`" -msgstr "" +msgstr ":meth:`~socket.socket.getsockopt`, :meth:`~socket.socket.setsockopt`" -#: ../../library/ssl.rst:1066 msgid "" ":meth:`~socket.socket.gettimeout`, :meth:`~socket.socket.settimeout`, :meth:" "`~socket.socket.setblocking`" msgstr "" +":meth:`~socket.socket.gettimeout`, :meth:`~socket.socket.settimeout`, :meth:" +"`~socket.socket.setblocking`" -#: ../../library/ssl.rst:1068 msgid ":meth:`~socket.socket.listen`" -msgstr "" +msgstr ":meth:`~socket.socket.listen`" -#: ../../library/ssl.rst:1069 msgid ":meth:`~socket.socket.makefile`" -msgstr "" +msgstr ":meth:`~socket.socket.makefile`" -#: ../../library/ssl.rst:1070 msgid "" ":meth:`~socket.socket.recv`, :meth:`~socket.socket.recv_into` (but passing a " "non-zero ``flags`` argument is not allowed)" msgstr "" +":meth:`~socket.socket.recv`、:meth:`~socket.socket.recv_into` (ただし " +"``flags`` 引数にゼロ以外の値は渡せません)" -#: ../../library/ssl.rst:1072 msgid "" ":meth:`~socket.socket.send`, :meth:`~socket.socket.sendall` (with the same " "limitation)" msgstr "" +":meth:`~socket.socket.send`、:meth:`~socket.socket.sendall` (同じ制約がありま" +"す)" #: ../../library/ssl.rst:1074 msgid "" @@ -1425,9 +1544,8 @@ msgid "" "plain-text sockets only, else :meth:`~socket.socket.send` will be used)" msgstr "" -#: ../../library/ssl.rst:1076 msgid ":meth:`~socket.socket.shutdown`" -msgstr "" +msgstr ":meth:`~socket.socket.shutdown`" #: ../../library/ssl.rst:1078 msgid "" @@ -1478,12 +1596,15 @@ msgid "" "directly. This was never documented or officially supported." msgstr "" -#: ../../library/ssl.rst:1104 msgid "" "Python now uses ``SSL_read_ex`` and ``SSL_write_ex`` internally. The " "functions support reading and writing of data larger than 2 GB. Writing zero-" "length data no longer fails with a protocol violation error." msgstr "" +"Python は内部で ``SSL_read_ex`` と ``SSL_write_ex`` を使うようになりまし" +"た。\n" +"これらの関数は 2 GB を超えるデータの読み書きに対応しています。\n" +"長さゼロのデータを書き込んでもプロトコル違反エラーで失敗しなくなりました。" #: ../../library/ssl.rst:1109 msgid "SSL sockets also have the following additional methods and attributes:" @@ -1499,14 +1620,13 @@ msgstr "" "``bytes`` インスタンスで返します。 *buffer* を指定すると、結果は代わりに " "buffer に読み込まれ、読み込んだバイト数を返します。" -#: ../../library/ssl.rst:1117 msgid "" "Raise :exc:`SSLWantReadError` or :exc:`SSLWantWriteError` if the socket is :" "ref:`non-blocking ` and the read would block." msgstr "" -"ソケットが :ref:`non-blocking ` で読み出しがブロックする" -"と、 :exc:`SSLWantReadError` もしくは :exc:`SSLWantWriteError` が送出されま" -"す。" +"ソケットが :ref:`ノンブロッキング ` で、読み出しに待機が必要" +"な場合は、:exc:`SSLWantReadError` もしくは :exc:`SSLWantWriteError` が送出さ" +"れます。" #: ../../library/ssl.rst:1120 msgid "" @@ -1540,14 +1660,13 @@ msgstr "" "*buf* を SSL ソケットに書き込み、書き込んだバイト数を返します。 *buf* 引数は" "バッファインターフェイスをサポートするオブジェクトでなければなりません。" -#: ../../library/ssl.rst:1136 msgid "" "Raise :exc:`SSLWantReadError` or :exc:`SSLWantWriteError` if the socket is :" "ref:`non-blocking ` and the write would block." msgstr "" -"ソケットが :ref:`non-blocking ` で書き込みがブロックする" -"と、 :exc:`SSLWantReadError` もしくは :exc:`SSLWantWriteError` が送出されま" -"す。" +"ソケットが :ref:`ノンブロッキング ` で、書き込みに待機が必要" +"な場合は、:exc:`SSLWantReadError` もしくは :exc:`SSLWantWriteError` が送出さ" +"れます。" #: ../../library/ssl.rst:1139 msgid "" @@ -1572,7 +1691,6 @@ msgstr "" ":meth:`~SSLSocket.write` の代わりに :meth:`~SSLSocket.send` を使用してくださ" "い。" -#: ../../library/ssl.rst:1151 msgid "" "The :meth:`~SSLSocket.read` and :meth:`~SSLSocket.write` methods are the low-" "level methods that read and write unencrypted, application-level data and " @@ -1580,11 +1698,11 @@ msgid "" "active SSL connection, i.e. the handshake was completed and :meth:`SSLSocket." "unwrap` was not called." msgstr "" -":meth:`~SSLSocket.read`, :meth:`~SSLSocket.write` メソッドは下位レベルのメ" -"ソッドであり、暗号化されていないアプリケーションレベルのデータを読み書きし、" -"それを復号/暗号化して暗号化された書き込みレベルのデータにします。これらのメ" -"ソッドはアクティブな SSL 接続つまり、ハンドシェイクが完了していて、 :meth:" -"`SSLSocket.unwrap` が呼ばれていないことを必要とします。" +":meth:`~SSLSocket.read` と :meth:`~SSLSocket.write` は低水準のメソッドで、暗" +"号化されていないアプリケーションレベルのデータを読み書きし、通信路上の暗号化" +"されたデータとの間で復号・暗号化を行います。\n" +"これらのメソッドにはアクティブな SSL 接続、つまりハンドシェイクが完了し、:" +"meth:`SSLSocket.unwrap` が呼ばれていない接続が必要です。" #: ../../library/ssl.rst:1157 msgid "" @@ -1665,7 +1783,6 @@ msgstr "" "したタプルで、各 RDN は name-value ペアのシーケンスです。現実世界での例をお見" "せします::" -#: ../../library/ssl.rst:1200 msgid "" "{'issuer': ((('countryName', 'IL'),),\n" " (('organizationName', 'StartCom Ltd.'),),\n" @@ -1687,6 +1804,25 @@ msgid "" " 'subjectAltName': (('DNS', '*.eff.org'), ('DNS', 'eff.org')),\n" " 'version': 3}" msgstr "" +"{'issuer': ((('countryName', 'IL'),),\n" +" (('organizationName', 'StartCom Ltd.'),),\n" +" (('organizationalUnitName',\n" +" 'Secure Digital Certificate Signing'),),\n" +" (('commonName',\n" +" 'StartCom Class 2 Primary Intermediate Server CA'),)),\n" +" 'notAfter': 'Nov 22 08:15:19 2013 GMT',\n" +" 'notBefore': 'Nov 21 03:09:52 2011 GMT',\n" +" 'serialNumber': '95F0',\n" +" 'subject': ((('description', '571208-SLe257oHY9fVQ07Z'),),\n" +" (('countryName', 'US'),),\n" +" (('stateOrProvinceName', 'California'),),\n" +" (('localityName', 'San Francisco'),),\n" +" (('organizationName', 'Electronic Frontier Foundation, " +"Inc.'),),\n" +" (('commonName', '*.eff.org'),),\n" +" (('emailAddress', 'hostmaster@eff.org'),)),\n" +" 'subjectAltName': (('DNS', '*.eff.org'), ('DNS', 'eff.org')),\n" +" 'version': 3}" #: ../../library/ssl.rst:1219 msgid "" @@ -1721,9 +1857,8 @@ msgstr "" "`CERT_REQUIRED` ではなく) :const:`CERT_NONE` を使用した場合 :meth:" "`getpeercert` は :const:`None` を返します。" -#: ../../library/ssl.rst:1233 msgid "See also :attr:`SSLContext.check_hostname`." -msgstr "" +msgstr ":attr:`SSLContext.check_hostname` も参照してください。" #: ../../library/ssl.rst:1235 msgid "" @@ -1743,22 +1878,25 @@ msgstr "" "返される辞書に ``crlDistributionPoints``, ``caIssuers``, ``OCSP`` URI のよう" "な X509v3 拡張アイテムを含むようになりました。" -#: ../../library/ssl.rst:1244 msgid "IPv6 address strings no longer have a trailing new line." -msgstr "" +msgstr "IPv6 アドレス文字列の末尾に改行が付かなくなりました。" -#: ../../library/ssl.rst:1249 msgid "" "Returns verified certificate chain provided by the other end of the SSL " "channel as a list of DER-encoded bytes. If certificate verification was " "disabled method acts the same as :meth:`~SSLSocket.get_unverified_chain`." msgstr "" +"SSL チャネルの接続相手が提供した検証済みの証明書チェインを、DER エンコードさ" +"れたバイト列のリストとして返します。\n" +"証明書の検証が無効な場合は、:meth:`~SSLSocket.get_unverified_chain` と同じ動" +"作をします。" -#: ../../library/ssl.rst:1258 msgid "" "Returns raw certificate chain provided by the other end of the SSL channel " "as a list of DER-encoded bytes." msgstr "" +"SSL チャネルの接続相手が提供した証明書チェインを、未検証のまま DER エンコード" +"されたバイト列のリストとして返します。" #: ../../library/ssl.rst:1265 msgid "" @@ -1802,13 +1940,13 @@ msgstr "" "上位レベルのプロトコルが自身で圧縮メカニズムをサポートする場合、SSL レベルで" "の圧縮を :data:`OP_NO_COMPRESSION` を使って無効にできます。" -#: ../../library/ssl.rst:1292 msgid "" "Get channel binding data for current connection, as a bytes object. Returns " "``None`` if not connected or the handshake has not been completed." msgstr "" -"現在の接続におけるチャネルバインディングのデータを取得します。未接続あるいは" -"ハンドシェイクが完了していなければ ``None`` を返します。" +"現在の接続のチャネルバインディングデータを bytes オブジェクトとして取得しま" +"す。\n" +"未接続の場合やハンドシェイクが完了していない場合は ``None`` を返します。" #: ../../library/ssl.rst:1295 msgid "" @@ -1848,9 +1986,8 @@ msgstr "" "していない場合、あるいはハンドシェイクがまだ行われていない場合には、 " "``None`` が返されます。" -#: ../../library/ssl.rst:1324 ../../library/ssl.rst:1693 msgid "NPN has been superseded by ALPN" -msgstr "" +msgstr "NPN は ALPN に置き換えられました。" #: ../../library/ssl.rst:1328 msgid "" @@ -1866,32 +2003,41 @@ msgstr "" "す。以降の通信には、オリジナルのソケットではなくこのメソッドが返したソケット" "のみを利用するべきです。" -#: ../../library/ssl.rst:1336 msgid "" "Requests post-handshake authentication (PHA) from a TLS 1.3 client. PHA can " "only be initiated for a TLS 1.3 connection from a server-side socket, after " "the initial TLS handshake and with PHA enabled on both sides, see :attr:" "`SSLContext.post_handshake_auth`." msgstr "" +"TLS 1.3 クライアントにハンドシェイク後認証 (PHA) を要求します。\n" +"PHA を開始できるのは、TLS 1.3 接続の最初の TLS ハンドシェイクが完了しており、" +"両側で PHA が有効になっている場合に限られます。\n" +"開始するのはサーバー側のソケットです。\n" +":attr:`SSLContext.post_handshake_auth` を参照してください。" -#: ../../library/ssl.rst:1341 msgid "" "The method does not perform a cert exchange immediately. The server-side " "sends a CertificateRequest during the next write event and expects the " "client to respond with a certificate on the next read event." msgstr "" +"このメソッドは直ちに証明書を交換するわけではありません。\n" +"サーバー側は次の書き込みイベントで CertificateRequest を送り、次の読み込みイ" +"ベントでクライアントからの証明書による応答を待ちます。" -#: ../../library/ssl.rst:1345 msgid "" "If any precondition isn't met (e.g. not TLS 1.3, PHA not enabled), an :exc:" "`SSLError` is raised." msgstr "" +"前提条件が満たされない場合 (TLS 1.3 でない、PHA が有効でないなど) は :exc:" +"`SSLError` を送出します。" -#: ../../library/ssl.rst:1349 msgid "" "Only available with OpenSSL 1.1.1 and TLS 1.3 enabled. Without TLS 1.3 " "support, the method raises :exc:`NotImplementedError`." msgstr "" +"OpenSSL 1.1.1 で TLS 1.3 を有効にしている場合にのみ利用できます。\n" +"TLS 1.3 をサポートしていなければ、このメソッドは :exc:`NotImplementedError` " +"を送出します。" #: ../../library/ssl.rst:1356 msgid "" @@ -1907,17 +2053,14 @@ msgstr "" "``\"TLSv1.1\"``, ``\"TLSv1.2\"`` などが返ります。最新の OpenSSL はもっと色々" "な値を定義しているかもしれません。" -#: ../../library/ssl.rst:1366 msgid "" "Returns the number of already decrypted bytes available for read, pending on " "the connection." msgstr "" -"接続において既に復号済みで読み出し可能で保留になっているバイト列の数を返しま" -"す。" +"接続上に保留されている、復号済みで読み出し可能なデータのバイト数を返します。" -#: ../../library/ssl.rst:1371 msgid "The :class:`SSLContext` object this SSL socket is tied to." -msgstr "" +msgstr "この SSL ソケットに関連付けられた :class:`SSLContext` オブジェクト。" #: ../../library/ssl.rst:1377 msgid "" @@ -1935,13 +2078,16 @@ msgstr "" "サーバのホスト名: :class:`str` 型、またはサーバサイドのソケットの場合とコンス" "トラクタで hostname が指定されなかった場合は ``None``" -#: ../../library/ssl.rst:1389 msgid "" "The attribute is now always ASCII text. When ``server_hostname`` is an " "internationalized domain name (IDN), this attribute now stores the A-label " "form (``\"xn--pythn-mua.org\"``), rather than the U-label form (``\"pythön." "org\"``)." msgstr "" +"この属性は常に ASCII テキストになりました。\n" +"``server_hostname`` が国際化ドメイン名 (IDN) の場合、U-label 形式 " +"(``\"pythön.org\"``) ではなく A-label 形式 (``\"xn--pythn-mua.org\"``) を保持" +"します。" #: ../../library/ssl.rst:1397 msgid "" @@ -1971,7 +2117,6 @@ msgstr "" "ドソケットの SSL セッションのキャッシュも管理し、同じクライアントからの繰り返" "しの接続時の速度向上に一役買います。" -#: ../../library/ssl.rst:1421 msgid "" "Create a new SSL context. You may pass *protocol* which must be one of the " "``PROTOCOL_*`` constants defined in this module. The parameter specifies " @@ -1981,6 +2126,15 @@ msgid "" "versions. If not specified, the default is :data:`PROTOCOL_TLS`; it " "provides the most compatibility with other versions." msgstr "" +"新しい SSL コンテキストを作成します。\n" +"*protocol* を指定する場合は、このモジュールで定義された ``PROTOCOL_*`` 定数の" +"いずれかでなければなりません。\n" +"この引数は使用する SSL プロトコルのバージョンを指定します。\n" +"通常、サーバーが特定のプロトコルバージョンを選び、クライアントがそれに合わせ" +"る必要があります。\n" +"ほとんどのバージョンは、他のバージョンと相互運用できません。\n" +"省略した場合のデフォルトは :data:`PROTOCOL_TLS` で、他のバージョンとの互換性" +"が最も高くなります。" #: ../../library/ssl.rst:1430 msgid "" @@ -2078,11 +2232,13 @@ msgstr "" ":class:`SSLContext` では、デフォルトで :data:`OP_NO_SSLv3` により SSLv3 が無" "効になっています。" -#: ../../library/ssl.rst:1449 msgid "" "TLS 1.3 protocol will be available with :data:`PROTOCOL_TLS` in OpenSSL >= " "1.1.1. There is no dedicated PROTOCOL constant for just TLS 1.3." msgstr "" +"OpenSSL 1.1.1 以降では :data:`PROTOCOL_TLS` で TLS 1.3 プロトコルを利用できま" +"す。\n" +"TLS 1.3 だけを指定する専用の PROTOCOL 定数はありません。" #: ../../library/ssl.rst:1454 msgid "" @@ -2092,7 +2248,6 @@ msgstr "" ":func:`create_default_context` は :mod:`ssl` モジュールに、目的に合ったセキュ" "リティ設定を選ばせます。" -#: ../../library/ssl.rst:1459 msgid "" "The context is created with secure default values. The options :data:" "`OP_NO_COMPRESSION`, :data:`OP_CIPHER_SERVER_PREFERENCE`, :data:" @@ -2101,15 +2256,23 @@ msgid "" "The initial cipher suite list contains only ``HIGH`` ciphers, no ``NULL`` " "ciphers and no ``MD5`` ciphers." msgstr "" +"コンテキストは安全なデフォルト値で作成されます。\n" +"デフォルトでは :data:`OP_NO_COMPRESSION`、:data:" +"`OP_CIPHER_SERVER_PREFERENCE`、:data:`OP_SINGLE_DH_USE`、:data:" +"`OP_SINGLE_ECDH_USE`、:data:`OP_NO_SSLv2`、:data:`OP_NO_SSLv3` (:data:" +"`PROTOCOL_SSLv3` の場合を除く) が設定されます。\n" +"初期の暗号スイート一覧は ``HIGH`` の暗号だけを含み、``NULL`` や ``MD5`` の暗" +"号は含みません。" -#: ../../library/ssl.rst:1469 msgid "" ":class:`SSLContext` without protocol argument is deprecated. The context " "class will either require :data:`PROTOCOL_TLS_CLIENT` or :data:" "`PROTOCOL_TLS_SERVER` protocol in the future." msgstr "" +"プロトコル引数を指定しない :class:`SSLContext` の作成は非推奨です。\n" +"将来、このクラスには :data:`PROTOCOL_TLS_CLIENT` または :data:" +"`PROTOCOL_TLS_SERVER` の指定が必要になります。" -#: ../../library/ssl.rst:1475 msgid "" "The default cipher suites now include only secure AES and ChaCha20 ciphers " "with forward secrecy and security level 2. RSA and DH keys with less than " @@ -2117,44 +2280,53 @@ msgid "" "`PROTOCOL_TLS`, :data:`PROTOCOL_TLS_CLIENT`, and :data:`PROTOCOL_TLS_SERVER` " "use TLS 1.2 as minimum TLS version." msgstr "" +"デフォルトの暗号スイートは、前方秘匿性とセキュリティレベル 2 を備えた、安全" +"な AES と ChaCha20 の暗号だけになりました。\n" +"2048 ビット未満の RSA 鍵と DH 鍵、および 224 ビット未満の ECC 鍵は禁止されま" +"す。\n" +":data:`PROTOCOL_TLS`、:data:`PROTOCOL_TLS_CLIENT`、:data:" +"`PROTOCOL_TLS_SERVER` は TLS 1.2 を最小の TLS バージョンとして使います。" -#: ../../library/ssl.rst:1483 msgid "" ":class:`SSLContext` only supports limited mutation once it has been used by " "a connection. Adding new certificates to the internal trust store is " "allowed, but changing ciphers, verification settings, or mTLS certificates " "may result in surprising behavior." msgstr "" +":class:`SSLContext` は、一度接続に使った後は変更できる項目が限られます。\n" +"内部の信頼ストアへの証明書の追加は可能ですが、暗号方式、検証設定、mTLS 証明書" +"を変更すると予想外の動作になることがあります。" -#: ../../library/ssl.rst:1490 msgid "" ":class:`SSLContext` is designed to be shared and used by multiple " "connections. Thus, it is thread-safe as long as it is not reconfigured after " "being used by a connection." msgstr "" +":class:`SSLContext` は複数の接続で共有して使うよう設計されています。\n" +"そのため、一度接続に使った後に再設定しなければスレッドセーフです。" #: ../../library/ssl.rst:1495 msgid ":class:`SSLContext` objects have the following methods and attributes:" msgstr ":class:`SSLContext` オブジェクトは以下のメソッドと属性を持っています:" -#: ../../library/ssl.rst:1499 msgid "" "Get statistics about quantities of loaded X.509 certificates, count of X.509 " "certificates flagged as CA certificates and certificate revocation lists as " "dictionary." msgstr "" -"ロードされた X.509 証明書の数、CA 証明書で活性の X.509 証明書の数、証明書失効" -"リストの数、についての統計情報を辞書として取得します。" +"ロードされた X.509 証明書の数、CA 証明書としてフラグが設定された X.509 証明書" +"の数、証明書失効リストの数を辞書として取得します。" #: ../../library/ssl.rst:1503 msgid "Example for a context with one CA cert and one other cert::" msgstr "一つの CA と他の一つの証明書を持ったコンテキストでの例です::" -#: ../../library/ssl.rst:1505 msgid "" ">>> context.cert_store_stats()\n" "{'crl': 0, 'x509_ca': 1, 'x509': 2}" msgstr "" +">>> context.cert_store_stats()\n" +"{'crl': 0, 'x509_ca': 1, 'x509': 2}" #: ../../library/ssl.rst:1513 msgid "" @@ -2173,7 +2345,6 @@ msgstr "" "取得されます。 *certfile* への証明書の格納についての詳細は、 :ref:`ssl-" "certificates` の議論を参照してください。" -#: ../../library/ssl.rst:1522 msgid "" "The *password* argument may be a function to call to get the password for " "decrypting the private key. It will only be called if the private key is " @@ -2185,12 +2356,15 @@ msgid "" "encrypted and no password is needed." msgstr "" "*password* 引数に、秘密鍵を復号するためのパスワードを返す関数を与えることがで" -"きます。その関数は秘密鍵が暗号化されていて、なおかつパスワードが必要な場合に" -"のみ呼び出されます。その関数は引数なしで呼び出され、string, bytes, または " -"bytearray を返さなければなりません。戻り値が string の場合は鍵を復号化するの" -"に使う前に UTF-8 でエンコードされます。string の代わりに bytes や bytearray " -"を返した場合は *password* 引数に直接供給されます。秘密鍵が暗号化されていな" -"かったりパスワードを必要としない場合は、指定は無視されます。" +"きます。\n" +"その関数は秘密鍵が暗号化されていて、なおかつパスワードが必要な場合にのみ呼び" +"出されます。\n" +"その関数は引数なしで呼び出され、文字列、``bytes``、または ``bytearray`` を返" +"さなければなりません。\n" +"戻り値が文字列の場合は、鍵の復号に使う前に UTF-8 でエンコードされます。\n" +"関数の代わりに、文字列、``bytes``、または ``bytearray`` の値を *password* 引" +"数に直接指定することもできます。\n" +"秘密鍵が暗号化されておらず、パスワードが不要な場合は、指定は無視されます。" #: ../../library/ssl.rst:1531 msgid "" @@ -2226,7 +2400,6 @@ msgstr "" "set_default_verify_paths` を呼び出します。将来的にはこのメソッドは、他の場所" "からも CA 証明書をロードするかもしれません。" -#: ../../library/ssl.rst:1549 msgid "" "The *purpose* flag specifies what kind of CA certificates are loaded. The " "default settings :const:`Purpose.SERVER_AUTH` loads certificates, that are " @@ -2234,6 +2407,12 @@ msgid "" "sockets). :const:`Purpose.CLIENT_AUTH` loads CA certificates for client " "certificate verification on the server side." msgstr "" +"*purpose* フラグは、読み込む CA 証明書の種類を指定します。\n" +"デフォルトの :const:`Purpose.SERVER_AUTH` は、TLS Web サーバーの認証用として" +"フラグが設定され、信頼されている証明書を読み込みます (クライアント側のソケッ" +"ト用)。\n" +":const:`Purpose.CLIENT_AUTH` は、サーバー側でクライアント証明書を検証するため" +"の CA 証明書を読み込みます。" #: ../../library/ssl.rst:1559 msgid "" @@ -2267,12 +2446,14 @@ msgstr "" "かについての詳しい情報については、 :ref:`ssl-certificates` の議論を参照してく" "ださい。" -#: ../../library/ssl.rst:1572 msgid "" "The *capath* string, if present, is the path to a directory containing " "several CA certificates in PEM format, following an `OpenSSL specific layout " "`_." msgstr "" +"*capath* 文字列を指定する場合は、`OpenSSL 固有の配置 `_ に従った、PEM 形式の CA 証" +"明書を複数含むディレクトリのパスを渡してください。" #: ../../library/ssl.rst:1577 msgid "" @@ -2352,7 +2533,6 @@ msgid "" " 'symmetric': 'aes-128-gcm'}]" msgstr "" -#: ../../library/ssl.rst:1639 msgid "" "Load a set of default \"certification authority\" (CA) certificates from a " "filesystem path defined when building the OpenSSL library. Unfortunately, " @@ -2361,12 +2541,12 @@ msgid "" "provided as part of the operating system, though, it is likely to be " "configured properly." msgstr "" -"デフォルトの \"認証局\" (CA=certification authority) 証明書を、OpenSSL ライブ" -"ラリがビルドされた際に定義されたファイルシステム上のパスからロードします。残" -"念ながらこのメソッドが成功したかどうかを知るための簡単な方法はありません: 証" -"明書が見つからなくてもエラーは返りません。OpenSSL ライブラリがオペレーティン" -"グシステムの一部として提供されている際にはどうやら適切に構成できるようです" -"が。" +"OpenSSL ライブラリのビルド時に定義されたファイルシステム上のパスから、デフォ" +"ルトの認証局 (CA) 証明書を読み込みます。\n" +"証明書が見つからなくてもエラーを返さないため、このメソッドが成功したかを簡単" +"に知る方法はありません。\n" +"ただし、OpenSSL が OS の一部として提供されている場合は、適切に設定されている" +"可能性が高いでしょう。" #: ../../library/ssl.rst:1648 msgid "" @@ -2414,7 +2594,6 @@ msgstr "" "このメソッドは :data:`HAS_ALPN` が ``False`` の場合 :exc:" "`NotImplementedError` を送出します。" -#: ../../library/ssl.rst:1678 msgid "" "Specify which protocols the socket should advertise during the SSL/TLS " "handshake. It should be a list of strings, like ``['http/1.1', 'spdy/2']``, " @@ -2425,12 +2604,14 @@ msgid "" "`SSLSocket.selected_npn_protocol` method will return the agreed-upon " "protocol." msgstr "" -"SSL/TLS ハンドシェイク時にソケットが提示すべきプロトコルを指定します。 " +"SSL/TLS ハンドシェイク時にソケットが提示すべきプロトコルを指定します。\n" "``['http/1.1', 'spdy/2']`` のような推奨順に並べた文字列のリストでなければなり" -"ません。プロトコルの選択は `Application Layer Protocol Negotiation `_ に従いハンド" -"シェイク中に行われます。ハンドシェイクが正常に終了した後、 :meth:`SSLSocket." -"selected_alpn_protocol` メソッドは合意されたプロトコルを返します。" +"ません。\n" +"プロトコルの選択は `Application Layer Protocol Negotiation `_ に従いハンドシェ" +"イク中に行われます。\n" +"ハンドシェイクが正常に終了した後、 :meth:`SSLSocket.selected_npn_protocol` メ" +"ソッドは合意されたプロトコルを返します。" #: ../../library/ssl.rst:1686 msgid "" @@ -2462,7 +2643,6 @@ msgstr "" "を ``None`` にすればコールバックは無効になります。この関数を続けて呼ぶと、以" "前に登録されたコールバックを上書きします。" -#: ../../library/ssl.rst:1706 msgid "" "The callback function will be called with three arguments; the first being " "the :class:`ssl.SSLSocket`, the second is a string that represents the " @@ -2472,6 +2652,13 @@ msgid "" "internationalized domain name, the server name is an IDN A-label (``\"xn--" "pythn-mua.org\"``)." msgstr "" +"コールバック関数は三つの引数で呼び出されます。\n" +"最初の引数は :class:`ssl.SSLSocket`、二つ目はクライアントが通信しようとしてい" +"るサーバー名の文字列 (TLS Client Hello にサーバー名がなければ :const:" +"`None`)、三つ目は元の :class:`SSLContext` です。\n" +"サーバー名の引数はテキストです。\n" +"国際化ドメイン名の場合、サーバー名は IDN A-label (``\"xn--pythn-mua.org\"``) " +"になります。" #: ../../library/ssl.rst:1714 msgid "" @@ -2483,7 +2670,6 @@ msgstr "" "`SSLSocket.context` 属性を、サーバ名に合致する証明書チェインを持つ新しい :" "class:`SSLContext` オブジェクトに変更することです。" -#: ../../library/ssl.rst:1719 msgid "" "Due to the early negotiation phase of the TLS connection, only limited " "methods and attributes are usable like :meth:`SSLSocket." @@ -2494,6 +2680,13 @@ msgid "" "the TLS Client Hello and therefore will not return meaningful values nor can " "they be called safely." msgstr "" +"TLS 接続のネゴシエーションの初期段階なので、:meth:`SSLSocket." +"selected_alpn_protocol` や :attr:`SSLSocket.context` など限られたメソッドと属" +"性だけを使えます。\n" +":meth:`SSLSocket.getpeercert`、:meth:`SSLSocket.get_verified_chain`、:meth:" +"`SSLSocket.get_unverified_chain`、:meth:`SSLSocket.cipher`、:meth:`SSLSocket." +"compression` は、接続が TLS Client Hello より先に進んでいる必要があるため、意" +"味のある値を返さず、安全に呼び出すこともできません。" #: ../../library/ssl.rst:1728 msgid "" @@ -2526,7 +2719,6 @@ msgstr "" "このメソッドは OpenSSL ライブラリが OPENSSL_NO_TLSEXT を定義してビルドされて" "いる場合、 :exc:`NotImplementedError` を送出します。" -#: ../../library/ssl.rst:1745 msgid "" "This is a legacy API retained for backwards compatibility. When possible, " "you should use :attr:`sni_callback` instead. The given " @@ -2534,15 +2726,20 @@ msgid "" "server hostname is an IDN-encoded internationalized domain name, the " "*server_name_callback* receives a decoded U-label (``\"pythön.org\"``)." msgstr "" +"これは後方互換性のために残されている古い API です。\n" +"可能なら代わりに :attr:`sni_callback` を使ってください。\n" +"指定する *server_name_callback* は *sni_callback* と似ていますが、サーバーホ" +"スト名が IDN エンコードされた国際化ドメイン名の場合、*server_name_callback* " +"はデコード済みの U-label (``\"pythön.org\"``) を受け取ります。" -#: ../../library/ssl.rst:1751 msgid "" "If there is a decoding error on the server name, the TLS connection will " "terminate with an :const:`ALERT_DESCRIPTION_INTERNAL_ERROR` fatal TLS alert " "message to the client." msgstr "" +"サーバー名のデコードエラーが起きると、クライアントに致命的な TLS アラート :" +"const:`ALERT_DESCRIPTION_INTERNAL_ERROR` を送って TLS 接続を終了します。" -#: ../../library/ssl.rst:1759 msgid "" "Load the key generation parameters for Diffie-Hellman (DH) key exchange. " "Using DH key exchange improves forward secrecy at the expense of " @@ -2550,10 +2747,11 @@ msgid "" "parameter should be the path to a file containing DH parameters in PEM " "format." msgstr "" -"ディフィー・ヘルマン(DH)鍵交換のための鍵生成パラメータをロードします。DH 鍵交" -"換を用いることは、(サーバ、クライアントともに)計算機リソースに高い処理負荷を" -"かけますがセキュリティを向上させます。 *dhfile* パラメータは PEM フォーマット" -"の DH パラメータを含んだファイルへのパスでなければなりません。" +"ディフィー・ヘルマン(DH)鍵交換のための鍵生成パラメータをロードします。\n" +"DH 鍵交換を用いることは、(サーバ、クライアントともに)計算機リソースに高い処理" +"負荷をかけますが前方秘匿性を向上させます。\n" +"*dhfile* パラメータは PEM フォーマットの DH パラメータを含んだファイルへのパ" +"スでなければなりません。" #: ../../library/ssl.rst:1765 msgid "" @@ -2588,23 +2786,28 @@ msgstr "" msgid "This method is not available if :data:`HAS_ECDH` is ``False``." msgstr "このメソッドは :data:`HAS_ECDH` が ``False`` の場合は利用できません。" -#: ../../library/ssl.rst:1786 msgid "" "`SSL/TLS & Perfect Forward Secrecy `_" msgstr "" +"`SSL/TLS と完全前方秘匿性 `_" #: ../../library/ssl.rst:1787 msgid "Vincent Bernat." msgstr "Vincent Bernat." -#: ../../library/ssl.rst:1793 msgid "" "Wrap an existing Python socket *sock* and return an instance of :attr:" "`SSLContext.sslsocket_class` (default :class:`SSLSocket`). The returned SSL " "socket is tied to the context, its settings and certificates. *sock* must be " "a :const:`~socket.SOCK_STREAM` socket; other socket types are unsupported." msgstr "" +"既存の Python ソケット *sock* をラップし、:attr:`SSLContext.sslsocket_class` " +"(デフォルトは :class:`SSLSocket`) のインスタンスを返します。\n" +"返された SSL ソケットは、そのコンテキストと設定、証明書に関連付けられます。\n" +"*sock* は :const:`~socket.SOCK_STREAM` ソケットでなければならず、他のソケット" +"種別には対応していません。" #: ../../library/ssl.rst:1799 msgid "" @@ -2680,11 +2883,12 @@ msgstr "" msgid "*session*, see :attr:`~SSLSocket.session`." msgstr "*session*, :attr:`~SSLSocket.session` を参照してください。" -#: ../../library/ssl.rst:1832 msgid "" "To wrap an :class:`SSLSocket` in another :class:`SSLSocket`, use :meth:" "`SSLContext.wrap_bio`." msgstr "" +":class:`SSLSocket` を別の :class:`SSLSocket` でラップするには :meth:" +"`SSLContext.wrap_bio` を使ってください。" #: ../../library/ssl.rst:1835 msgid "" @@ -2698,11 +2902,12 @@ msgstr "" msgid "*session* argument was added." msgstr "*session* 引数が追加されました。" -#: ../../library/ssl.rst:1842 msgid "" "The method returns an instance of :attr:`SSLContext.sslsocket_class` instead " "of hard-coded :class:`SSLSocket`." msgstr "" +"固定の :class:`SSLSocket` ではなく、:attr:`SSLContext.sslsocket_class` のイン" +"スタンスを返すようになりました。" #: ../../library/ssl.rst:1848 msgid "" @@ -2711,13 +2916,16 @@ msgid "" "to return a custom subclass of :class:`SSLSocket`." msgstr "" -#: ../../library/ssl.rst:1857 msgid "" "Wrap the BIO objects *incoming* and *outgoing* and return an instance of :" "attr:`SSLContext.sslobject_class` (default :class:`SSLObject`). The SSL " "routines will read input data from the incoming BIO and write data to the " "outgoing BIO." msgstr "" +"BIO オブジェクト *incoming* と *outgoing* をラップし、:attr:`SSLContext." +"sslobject_class` (デフォルトは :class:`SSLObject`) のインスタンスを返しま" +"す。\n" +"SSL の処理は入力 BIO からデータを読み込み、出力 BIO にデータを書き込みます。" #: ../../library/ssl.rst:1862 msgid "" @@ -2727,20 +2935,23 @@ msgstr "" "*server_side*、 *server_hostname* 、 *session* 引数は、 :meth:`SSLContext." "wrap_socket` での意味と同じ意味を持ちます。" -#: ../../library/ssl.rst:1868 msgid "" "The method returns an instance of :attr:`SSLContext.sslobject_class` instead " "of hard-coded :class:`SSLObject`." msgstr "" +"固定の :class:`SSLObject` ではなく、:attr:`SSLContext.sslobject_class` のイン" +"スタンスを返すようになりました。" -#: ../../library/ssl.rst:1874 msgid "" "The return type of :meth:`SSLContext.wrap_bio`, defaults to :class:" "`SSLObject`. The attribute can be overridden on instance of class in order " "to return a custom subclass of :class:`SSLObject`." msgstr "" +":meth:`SSLContext.wrap_bio` の戻り値の型で、デフォルトは :class:`SSLObject` " +"です。\n" +"クラスのインスタンスでこの属性を上書きすると、独自の :class:`SSLObject` サブ" +"クラスを返すようにできます。" -#: ../../library/ssl.rst:1882 msgid "" "Get statistics about the SSL sessions created or managed by this context. A " "dictionary is returned which maps the names of each `piece of information " @@ -2748,15 +2959,21 @@ msgid "" "numeric values. For example, here is the total number of hits and misses in " "the session cache since the context was created::" msgstr "" +"このコンテキストが作成または管理する SSL セッションの統計を取得します。\n" +"各 `情報項目 `_ の" +"名前を数値に対応付ける辞書を返します。\n" +"例えば次の例は、コンテキスト作成以降のセッションキャッシュのヒット数とミス数" +"の合計です。 ::" -#: ../../library/ssl.rst:1887 msgid "" ">>> stats = context.session_stats()\n" ">>> stats['hits'], stats['misses']\n" "(0, 0)" msgstr "" +">>> stats = context.session_stats()\n" +">>> stats['hits'], stats['misses']\n" +"(0, 0)" -#: ../../library/ssl.rst:1893 msgid "" "Whether to match the peer cert's hostname in :meth:`SSLSocket.do_handshake`. " "The context's :attr:`~SSLContext.verify_mode` must be set to :data:" @@ -2768,8 +2985,18 @@ msgid "" "data:`PROTOCOL_TLS_CLIENT` protocol enables hostname checking by default. " "With other protocols, hostname checking must be enabled explicitly." msgstr "" +":meth:`SSLSocket.do_handshake` で相手の証明書のホスト名を照合するかどうかを指" +"定します。\n" +"ホスト名を照合するには、コンテキストの :attr:`~SSLContext.verify_mode` を :" +"data:`CERT_OPTIONAL` または :data:`CERT_REQUIRED` に設定し、:meth:" +"`~SSLContext.wrap_socket` に *server_hostname* を渡さなければなりません。\n" +"ホスト名の検査を有効にすると、:attr:`~SSLContext.verify_mode` は :data:" +"`CERT_NONE` から :data:`CERT_REQUIRED` に自動的に変更されます。\n" +"ホスト名の検査が有効な間は :data:`CERT_NONE` に戻せません。\n" +":data:`PROTOCOL_TLS_CLIENT` プロトコルはデフォルトでホスト名の検査を有効にし" +"ます。\n" +"他のプロトコルでは明示的に有効にする必要があります。" -#: ../../library/ssl.rst:1906 msgid "" "import socket, ssl\n" "\n" @@ -2782,16 +3009,28 @@ msgid "" "ssl_sock = context.wrap_socket(s, server_hostname='www.verisign.com')\n" "ssl_sock.connect(('www.verisign.com', 443))" msgstr "" +"import socket, ssl\n" +"\n" +"context = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2)\n" +"context.verify_mode = ssl.CERT_REQUIRED\n" +"context.check_hostname = True\n" +"context.load_default_certs()\n" +"\n" +"s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n" +"ssl_sock = context.wrap_socket(s, server_hostname='www.verisign.com')\n" +"ssl_sock.connect(('www.verisign.com', 443))" -#: ../../library/ssl.rst:1921 msgid "" ":attr:`~SSLContext.verify_mode` is now automatically changed to :data:" "`CERT_REQUIRED` when hostname checking is enabled and :attr:`~SSLContext." "verify_mode` is :data:`CERT_NONE`. Previously the same operation would have " "failed with a :exc:`ValueError`." msgstr "" +":attr:`~SSLContext.verify_mode` が :data:`CERT_NONE` のときにホスト名の検査を" +"有効にすると、:attr:`~SSLContext.verify_mode` が :data:`CERT_REQUIRED` に自動" +"的に変更されるようになりました。\n" +"以前はこの操作が :exc:`ValueError` で失敗していました。" -#: ../../library/ssl.rst:1928 msgid "" "Write TLS keys to a keylog file, whenever key material is generated or " "received. The keylog file is designed for debugging purposes only. The file " @@ -2799,14 +3038,24 @@ msgid "" "Wireshark. The log file is opened in append-only mode. Writes are " "synchronized between threads, but not between processes." msgstr "" +"鍵素材を生成または受信するたびに、TLS 鍵を鍵ログファイルに書き込みます。\n" +"このファイルはデバッグ専用です。\n" +"形式は NSS によって規定され、Wireshark など多くの通信解析ツールで使われていま" +"す。\n" +"ログファイルは追記専用モードで開きます。\n" +"書き込みはスレッド間では同期しますが、プロセス間では同期しません。" -#: ../../library/ssl.rst:1938 msgid "" "A :class:`TLSVersion` enum member representing the highest supported TLS " "version. The value defaults to :attr:`TLSVersion.MAXIMUM_SUPPORTED`. The " "attribute is read-only for protocols other than :const:`PROTOCOL_TLS`, :" "const:`PROTOCOL_TLS_CLIENT`, and :const:`PROTOCOL_TLS_SERVER`." msgstr "" +"サポートする TLS バージョンの上限を表す :class:`TLSVersion` 列挙型のメンバー" +"です。\n" +"デフォルト値は :attr:`TLSVersion.MAXIMUM_SUPPORTED` です。\n" +":const:`PROTOCOL_TLS`、:const:`PROTOCOL_TLS_CLIENT`、:const:" +"`PROTOCOL_TLS_SERVER` 以外のプロトコルでは、この属性は読み取り専用です。" #: ../../library/ssl.rst:1943 msgid "" @@ -2818,18 +3067,21 @@ msgid "" "`TLSVersion.TLSv1_2` will not be able to establish a TLS 1.2 connection." msgstr "" -#: ../../library/ssl.rst:1956 msgid "" "Like :attr:`SSLContext.maximum_version` except it is the lowest supported " "version or :attr:`TLSVersion.MINIMUM_SUPPORTED`." msgstr "" +":attr:`SSLContext.maximum_version` と同様ですが、サポートするバージョンの下" +"限、または :attr:`TLSVersion.MINIMUM_SUPPORTED` を表します。" -#: ../../library/ssl.rst:1963 msgid "" "Control the number of TLS 1.3 session tickets of a :const:" "`PROTOCOL_TLS_SERVER` context. The setting has no impact on TLS 1.0 to 1.2 " "connections." msgstr "" +":const:`PROTOCOL_TLS_SERVER` コンテキストの TLS 1.3 セッションチケット数を制" +"御します。\n" +"この設定は TLS 1.0 から 1.2 の接続には影響しません。" #: ../../library/ssl.rst:1971 msgid "" @@ -2846,34 +3098,45 @@ msgid ":attr:`SSLContext.options` returns :class:`Options` flags:" msgstr "" ":attr:`SSLContext.options` は次のように :class:`Options` のフラグを返します。" -#: ../../library/ssl.rst:1983 msgid "" "All ``OP_NO_SSL*`` and ``OP_NO_TLS*`` options have been deprecated since " "Python 3.7. Use :attr:`SSLContext.minimum_version` and :attr:`SSLContext." "maximum_version` instead." msgstr "" +"すべての ``OP_NO_SSL*`` オプションと ``OP_NO_TLS*`` オプションは Python 3.7 " +"から非推奨です。\n" +"代わりに :attr:`SSLContext.minimum_version` と :attr:`SSLContext." +"maximum_version` を使ってください。" -#: ../../library/ssl.rst:1989 msgid "" "Enable TLS 1.3 post-handshake client authentication. Post-handshake auth is " "disabled by default and a server can only request a TLS client certificate " "during the initial handshake. When enabled, a server may request a TLS " "client certificate at any time after the handshake." msgstr "" +"TLS 1.3 のハンドシェイク後クライアント認証を有効にします。\n" +"デフォルトでは無効で、サーバーは最初のハンドシェイク中にだけ TLS クライアント" +"証明書を要求できます。\n" +"有効にすると、ハンドシェイク後の任意の時点で要求できます。" -#: ../../library/ssl.rst:1994 msgid "" "When enabled on client-side sockets, the client signals the server that it " "supports post-handshake authentication." msgstr "" +"クライアント側のソケットで有効にすると、クライアントはハンドシェイク後認証に" +"対応していることをサーバーに通知します。" -#: ../../library/ssl.rst:1997 msgid "" "When enabled on server-side sockets, :attr:`SSLContext.verify_mode` must be " "set to :data:`CERT_OPTIONAL` or :data:`CERT_REQUIRED`, too. The actual " "client cert exchange is delayed until :meth:`SSLSocket." "verify_client_post_handshake` is called and some I/O is performed." msgstr "" +"サーバー側のソケットで有効にする場合は、:attr:`SSLContext.verify_mode` も :" +"data:`CERT_OPTIONAL` または :data:`CERT_REQUIRED` に設定しなければなりませ" +"ん。\n" +"実際のクライアント証明書の交換は、:meth:`SSLSocket." +"verify_client_post_handshake` を呼び出して I/O を行うまで遅延します。" #: ../../library/ssl.rst:2007 msgid "" @@ -2883,25 +3146,31 @@ msgstr "" "コンテキストの構築時に選択されたプロトコルバージョン。この属性は読み出し専用" "です。" -#: ../../library/ssl.rst:2012 msgid "" "Whether :attr:`~SSLContext.check_hostname` falls back to verify the cert's " "subject common name in the absence of a subject alternative name extension " "(default: true)." msgstr "" +":attr:`~SSLContext.check_hostname` が、サブジェクトの別名拡張がない場合に証明" +"書のサブジェクトの共通名を代わりに検証するかどうかを指定します (デフォルトは" +"真)。" -#: ../../library/ssl.rst:2020 msgid "" "The flag had no effect with OpenSSL before version 1.1.1l. Python 3.8.9, " "3.9.3, and 3.10 include workarounds for previous versions." msgstr "" +"OpenSSL 1.1.1l より前ではこのフラグは効果がありませんでした。\n" +"Python 3.8.9、3.9.3、3.10 には、それより前のバージョンに対処する処理が含まれ" +"ています。" -#: ../../library/ssl.rst:2025 msgid "" "An integer representing the `security level `_ for the context. This attribute is read-" "only." msgstr "" +"コンテキストの `セキュリティレベル `_ を表す整数です。\n" +"この属性は読み取り専用です。" #: ../../library/ssl.rst:2033 msgid "" @@ -2935,16 +3204,14 @@ msgstr "" ":attr:`SSLContext.verify_mode` は次のように :class:`VerifyMode` enum (列挙) " "を返します。" -#: ../../library/ssl.rst:2059 msgid "" "Enables TLS-PSK (pre-shared key) authentication on a client-side connection." -msgstr "" +msgstr "クライアント側の接続で TLS-PSK (事前共有鍵) 認証を有効にします。" -#: ../../library/ssl.rst:2061 ../../library/ssl.rst:2110 msgid "" "In general, certificate based authentication should be preferred over this " "method." -msgstr "" +msgstr "一般に、この方式よりも証明書による認証を優先すべきです。" #: ../../library/ssl.rst:2063 msgid "" @@ -2958,21 +3225,18 @@ msgid "" "shared key. Return a zero length PSK to reject the connection." msgstr "" -#: ../../library/ssl.rst:2073 ../../library/ssl.rst:2119 msgid "Setting ``callback`` to :const:`None` removes any existing callback." msgstr "" +"``callback`` を :const:`None` にすると、既存のコールバックを削除します。" -#: ../../library/ssl.rst:2076 msgid "When using TLS 1.3:" -msgstr "" +msgstr "TLS 1.3 を使う場合:" -#: ../../library/ssl.rst:2078 msgid "the ``hint`` parameter is always :const:`None`." -msgstr "" +msgstr "``hint`` 引数は常に :const:`None` です。" -#: ../../library/ssl.rst:2079 msgid "client-identity must be a non-empty string." -msgstr "" +msgstr "client-identity は空でない文字列でなければなりません。" #: ../../library/ssl.rst:2081 ../../library/ssl.rst:2128 msgid "Example usage::" @@ -2999,16 +3263,16 @@ msgid "" "context.set_psk_client_callback(callback)" msgstr "" -#: ../../library/ssl.rst:2101 ../../library/ssl.rst:2146 msgid "" "This method will raise :exc:`NotImplementedError` if :data:`HAS_PSK` is " "``False``." msgstr "" +":data:`HAS_PSK` が ``False`` の場合、このメソッドは :exc:" +"`NotImplementedError` を送出します。" -#: ../../library/ssl.rst:2108 msgid "" "Enables TLS-PSK (pre-shared key) authentication on a server-side connection." -msgstr "" +msgstr "サーバー側の接続で TLS-PSK (事前共有鍵) 認証を有効にします。" #: ../../library/ssl.rst:2112 msgid "" @@ -3020,19 +3284,20 @@ msgid "" "connection." msgstr "" -#: ../../library/ssl.rst:2121 msgid "" "The parameter ``identity_hint`` is an optional identity hint string sent to " "the client. The string must be less than or equal to ``256`` octets when " "UTF-8 encoded." msgstr "" +"``identity_hint`` 引数は、クライアントに送る省略可能な識別情報のヒント文字列" +"です。\n" +"UTF-8 エンコード後に ``256`` オクテット以下でなければなりません。" #: ../../library/ssl.rst:2126 msgid "" "When using TLS 1.3 the ``identity_hint`` parameter is not sent to the client." msgstr "" -#: ../../library/ssl.rst:2130 msgid "" "context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)\n" "context.maximum_version = ssl.TLSVersion.TLSv1_2\n" @@ -3050,6 +3315,21 @@ msgid "" " return psk_table.get(identity, b'')\n" "context.set_psk_server_callback(callback, 'ServerId_1')" msgstr "" +"context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)\n" +"context.maximum_version = ssl.TLSVersion.TLSv1_2\n" +"context.set_ciphers('PSK')\n" +"\n" +"# 単純なラムダ式:\n" +"psk = bytes.fromhex('c0ffee')\n" +"context.set_psk_server_callback(lambda identity: psk)\n" +"\n" +"# クライアントの識別情報を使うテーブル:\n" +"psk_table = { 'ClientId_1': bytes.fromhex('c0ffee'),\n" +" 'ClientId_2': bytes.fromhex('facade')\n" +"}\n" +"def callback(identity):\n" +" return psk_table.get(identity, b'')\n" +"context.set_psk_server_callback(callback, 'ServerId_1')" #: ../../library/ssl.rst:2158 msgid "Certificates" @@ -3093,7 +3373,6 @@ msgstr "" "た、その証明書が有効である期限に関する情報も含んでいます。この期限は " "\"notBefore\" と \"notAfter\" と呼ばれる2つのフィールドで表現されています。" -#: ../../library/ssl.rst:2178 msgid "" "In the Python use of certificates, a client or server can use a certificate " "to prove who they are. The other side of a network connection can also be " @@ -3105,13 +3384,15 @@ msgid "" "does usually need to provide sets of certificates to allow this process to " "take place." msgstr "" -"Python において証明書を利用する場合、クライアントもサーバーも自分を証明するた" -"めに証明書を利用することができます。ネットワーク接続の相手側に証明書の提示を" -"要求する事ができ、そのクライアントやサーバーが認証を必要とするならその証明書" -"を認証することができます。認証が失敗した場合、接続は例外を発生させます。認証" -"は下位層のOpenSSLフレームワークが自動的に行います。アプリケーションは認証機構" -"について意識する必要はありません。しかし、アプリケーションは認証プロセスのた" -"めに幾つかの証明書を提供する必要があるかもしれません。" +"Python では、クライアントもサーバーも証明書を使って自身の身元を証明できま" +"す。\n" +"接続相手に証明書の提示を要求し、要求した側のクライアントやサーバーが必要とす" +"る検証を行うこともできます。\n" +"検証に失敗した場合は接続時に例外を送出するよう設定できます。\n" +"検証は基盤となる OpenSSL が自動的に行うため、アプリケーションがその仕組みを扱" +"う必要はありません。\n" +"ただし通常は、この処理のためにアプリケーションが証明書の組を提供する必要があ" +"ります。" #: ../../library/ssl.rst:2188 msgid "" @@ -3123,12 +3404,14 @@ msgstr "" "`1422` 参照) フォーマットという、ヘッダー行とフッター行の間にbase-64エンコー" "ドされた形をとっている必要があります。 ::" -#: ../../library/ssl.rst:2192 msgid "" "-----BEGIN CERTIFICATE-----\n" "... (certificate in base64 PEM encoding) ...\n" "-----END CERTIFICATE-----" msgstr "" +"-----BEGIN CERTIFICATE-----\n" +"... (base64 PEM エンコードされた証明書) ...\n" +"-----END CERTIFICATE-----" #: ../../library/ssl.rst:2197 msgid "Certificate chains" @@ -3159,7 +3442,6 @@ msgstr "" "ンがある場合、私たちのサーバーの証明書から、私たちのサーバーに署名した認証局" "の証明書、そして認証局の証明書を発行した機関のルート証明書と続きます::" -#: ../../library/ssl.rst:2212 msgid "" "-----BEGIN CERTIFICATE-----\n" "... (certificate for your server)...\n" @@ -3171,6 +3453,15 @@ msgid "" "... (the root certificate for the CA's issuer)...\n" "-----END CERTIFICATE-----" msgstr "" +"-----BEGIN CERTIFICATE-----\n" +"... (自分のサーバーの証明書)...\n" +"-----END CERTIFICATE-----\n" +"-----BEGIN CERTIFICATE-----\n" +"... (CA の証明書)...\n" +"-----END CERTIFICATE-----\n" +"-----BEGIN CERTIFICATE-----\n" +"... (CA の発行者のルート証明書)...\n" +"-----END CERTIFICATE-----" #: ../../library/ssl.rst:2223 msgid "CA certificates" @@ -3199,15 +3490,18 @@ msgstr "" msgid "Combined key and certificate" msgstr "秘密鍵と証明書の組み合わせ" -#: ../../library/ssl.rst:2236 msgid "" "Often the private key is stored in the same file as the certificate; in this " "case, only the ``certfile`` parameter to :meth:`SSLContext.load_cert_chain` " "needs to be passed. If the private key is stored with the certificate, it " "should come before the first certificate in the certificate chain::" msgstr "" +"秘密鍵は証明書と同じファイルに保存されることがよくあります。\n" +"その場合、:meth:`SSLContext.load_cert_chain` には ``certfile`` 引数だけを渡せ" +"ば十分です。\n" +"秘密鍵を証明書と一緒に保存する場合は、証明書チェインの最初の証明書より前に置" +"いてください。 ::" -#: ../../library/ssl.rst:2242 msgid "" "-----BEGIN RSA PRIVATE KEY-----\n" "... (private key in base64 encoding) ...\n" @@ -3216,6 +3510,12 @@ msgid "" "... (certificate in base64 PEM encoding) ...\n" "-----END CERTIFICATE-----" msgstr "" +"-----BEGIN RSA PRIVATE KEY-----\n" +"... (base64 エンコードされた秘密鍵) ...\n" +"-----END RSA PRIVATE KEY-----\n" +"-----BEGIN CERTIFICATE-----\n" +"... (base64 PEM エンコードされた証明書) ...\n" +"-----END CERTIFICATE-----" #: ../../library/ssl.rst:2250 msgid "Self-signed certificates" @@ -3235,7 +3535,6 @@ msgstr "" "ケースもあります。 OpenSSLを使って自己署名証明書を作るには、次のようにしま" "す。 ::" -#: ../../library/ssl.rst:2259 msgid "" "% openssl req -new -x509 -days 365 -nodes -out cert.pem -keyout cert.pem\n" "Generating a 1024 bit RSA private key\n" @@ -3260,6 +3559,28 @@ msgid "" "Email Address []:ops@myserver.mygroup.myorganization.com\n" "%" msgstr "" +"% openssl req -new -x509 -days 365 -nodes -out cert.pem -keyout cert.pem\n" +"Generating a 1024 bit RSA private key\n" +".......++++++\n" +".............................++++++\n" +"writing new private key to 'cert.pem'\n" +"-----\n" +"You are about to be asked to enter information that will be incorporated\n" +"into your certificate request.\n" +"What you are about to enter is what is called a Distinguished Name or a DN.\n" +"There are quite a few fields but you can leave some blank\n" +"For some fields there will be a default value,\n" +"If you enter '.', the field will be left blank.\n" +"-----\n" +"Country Name (2 letter code) [AU]:US\n" +"State or Province Name (full name) [Some-State]:MyState\n" +"Locality Name (eg, city) []:Some City\n" +"Organization Name (eg, company) [Internet Widgits Pty Ltd]:My Organization, " +"Inc.\n" +"Organizational Unit Name (eg, section) []:My Group\n" +"Common Name (eg, YOUR name) []:myserver.mygroup.myorganization.com\n" +"Email Address []:ops@myserver.mygroup.myorganization.com\n" +"%" #: ../../library/ssl.rst:2281 msgid "" @@ -3286,7 +3607,6 @@ msgstr "" "インストールされているPythonがSSLをサポートしているかどうかをテストするため" "に、ユーザーコードは次のイディオムを利用することができます。 ::" -#: ../../library/ssl.rst:2295 msgid "" "try:\n" " import ssl\n" @@ -3295,6 +3615,12 @@ msgid "" "else:\n" " ... # do something that requires SSL support" msgstr "" +"try:\n" +" import ssl\n" +"except ImportError:\n" +" pass\n" +"else:\n" +" ... # SSL が必要な処理を行う" #: ../../library/ssl.rst:2303 msgid "Client-side operation" @@ -3308,9 +3634,8 @@ msgstr "" "この例では、自動的に証明書の検証を行うことを含む望ましいセキュリティ設定でク" "ライアントソケットの SSL コンテキストを作ります::" -#: ../../library/ssl.rst:2308 msgid ">>> context = ssl.create_default_context()" -msgstr "" +msgstr ">>> context = ssl.create_default_context()" #: ../../library/ssl.rst:2310 msgid "" @@ -3320,11 +3645,12 @@ msgstr "" "自分自身でセキュリティ設定を調整したい場合、コンテキストを一から作ることはで" "きます (ただし、正しくない設定をしてしまいがちなことに注意してください)::" -#: ../../library/ssl.rst:2314 msgid "" ">>> context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)\n" ">>> context.load_verify_locations(\"/etc/ssl/certs/ca-bundle.crt\")" msgstr "" +">>> context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)\n" +">>> context.load_verify_locations(\"/etc/ssl/certs/ca-bundle.crt\")" #: ../../library/ssl.rst:2317 msgid "" @@ -3336,15 +3662,19 @@ msgstr "" "ドルされていることを仮定しています; もし違っていればエラーになりますので、適" "宜修正してください)" -#: ../../library/ssl.rst:2321 msgid "" "The :data:`PROTOCOL_TLS_CLIENT` protocol configures the context for cert " "validation and hostname verification. :attr:`~SSLContext.verify_mode` is set " "to :data:`CERT_REQUIRED` and :attr:`~SSLContext.check_hostname` is set to " "``True``. All other protocols create SSL contexts with insecure defaults." msgstr "" +":data:`PROTOCOL_TLS_CLIENT` プロトコルは、証明書とホスト名を検証するようコン" +"テキストを設定します。\n" +":attr:`~SSLContext.verify_mode` は :data:`CERT_REQUIRED`、:attr:`~SSLContext." +"check_hostname` は ``True`` に設定されます。\n" +"それ以外のプロトコルはすべて、安全でないデフォルト設定の SSL コンテキストを作" +"成します。" -#: ../../library/ssl.rst:2326 msgid "" "When you use the context to connect to a server, :const:`CERT_REQUIRED` and :" "attr:`~SSLContext.check_hostname` validate the server certificate: it " @@ -3352,21 +3682,26 @@ msgid "" "certificates, checks the signature for correctness, and verifies other " "properties like validity and identity of the hostname::" msgstr "" +"このコンテキストでサーバーに接続すると、:const:`CERT_REQUIRED` と :attr:" +"`~SSLContext.check_hostname` によってサーバー証明書を検証します。\n" +"具体的には、サーバー証明書が CA 証明書のいずれかで署名されていることと署名の" +"正しさを確認し、有効性やホスト名の一致なども検証します。 ::" -#: ../../library/ssl.rst:2332 msgid "" ">>> conn = context.wrap_socket(socket.socket(socket.AF_INET),\n" "... server_hostname=\"www.python.org\")\n" ">>> conn.connect((\"www.python.org\", 443))" msgstr "" +">>> conn = context.wrap_socket(socket.socket(socket.AF_INET),\n" +"... server_hostname=\"www.python.org\")\n" +">>> conn.connect((\"www.python.org\", 443))" #: ../../library/ssl.rst:2336 msgid "You may then fetch the certificate::" msgstr "そして証明書を持ってくることができます::" -#: ../../library/ssl.rst:2338 msgid ">>> cert = conn.getpeercert()" -msgstr "" +msgstr ">>> cert = conn.getpeercert()" #: ../../library/ssl.rst:2340 msgid "" @@ -3376,7 +3711,6 @@ msgstr "" "証明書が、期待しているサービス (つまり、 HTTPS ホスト ``www.python.org``) の" "身元を特定していることを視覚的に点検してみましょう::" -#: ../../library/ssl.rst:2343 msgid "" ">>> pprint.pprint(cert)\n" "{'OCSP': ('http://ocsp.digicert.com',),\n" @@ -3422,6 +3756,49 @@ msgid "" " ('DNS', 'id.python.org')),\n" " 'version': 3}" msgstr "" +">>> pprint.pprint(cert)\n" +"{'OCSP': ('http://ocsp.digicert.com',),\n" +" 'caIssuers': ('http://cacerts.digicert.com/" +"DigiCertSHA2ExtendedValidationServerCA.crt',),\n" +" 'crlDistributionPoints': ('http://crl3.digicert.com/sha2-ev-server-g1." +"crl',\n" +" 'http://crl4.digicert.com/sha2-ev-server-g1." +"crl'),\n" +" 'issuer': ((('countryName', 'US'),),\n" +" (('organizationName', 'DigiCert Inc'),),\n" +" (('organizationalUnitName', 'www.digicert.com'),),\n" +" (('commonName', 'DigiCert SHA2 Extended Validation Server " +"CA'),)),\n" +" 'notAfter': 'Sep 9 12:00:00 2016 GMT',\n" +" 'notBefore': 'Sep 5 00:00:00 2014 GMT',\n" +" 'serialNumber': '01BB6F00122B177F36CAB49CEA8B6B26',\n" +" 'subject': ((('businessCategory', 'Private Organization'),),\n" +" (('1.3.6.1.4.1.311.60.2.1.3', 'US'),),\n" +" (('1.3.6.1.4.1.311.60.2.1.2', 'Delaware'),),\n" +" (('serialNumber', '3359300'),),\n" +" (('streetAddress', '16 Allen Rd'),),\n" +" (('postalCode', '03894-4801'),),\n" +" (('countryName', 'US'),),\n" +" (('stateOrProvinceName', 'NH'),),\n" +" (('localityName', 'Wolfeboro'),),\n" +" (('organizationName', 'Python Software Foundation'),),\n" +" (('commonName', 'www.python.org'),)),\n" +" 'subjectAltName': (('DNS', 'www.python.org'),\n" +" ('DNS', 'python.org'),\n" +" ('DNS', 'pypi.org'),\n" +" ('DNS', 'docs.python.org'),\n" +" ('DNS', 'testpypi.org'),\n" +" ('DNS', 'bugs.python.org'),\n" +" ('DNS', 'wiki.python.org'),\n" +" ('DNS', 'hg.python.org'),\n" +" ('DNS', 'mail.python.org'),\n" +" ('DNS', 'packaging.python.org'),\n" +" ('DNS', 'pythonhosted.org'),\n" +" ('DNS', 'www.pythonhosted.org'),\n" +" ('DNS', 'test.pythonhosted.org'),\n" +" ('DNS', 'us.pycon.org'),\n" +" ('DNS', 'id.python.org')),\n" +" 'version': 3}" #: ../../library/ssl.rst:2383 msgid "" @@ -3472,7 +3849,6 @@ msgstr "" "開き、ポートにバインドし、そのソケットの :meth:`listen` を呼び、クライアント" "からの接続を待ちます。 ::" -#: ../../library/ssl.rst:2418 msgid "" "import socket, ssl\n" "\n" @@ -3483,6 +3859,14 @@ msgid "" "bindsocket.bind(('myaddr.example.com', 10023))\n" "bindsocket.listen(5)" msgstr "" +"import socket, ssl\n" +"\n" +"context = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)\n" +"context.load_cert_chain(certfile=\"mycertfile\", keyfile=\"mykeyfile\")\n" +"\n" +"bindsocket = socket.socket()\n" +"bindsocket.bind(('myaddr.example.com', 10023))\n" +"bindsocket.listen(5)" #: ../../library/ssl.rst:2427 msgid "" @@ -3494,7 +3878,6 @@ msgstr "" "し、接続のためにサーバサイドの SSL ソケットを、コンテキストの :meth:" "`SSLContext.wrap_socket` メソッドで作ります::" -#: ../../library/ssl.rst:2431 msgid "" "while True:\n" " newsocket, fromaddr = bindsocket.accept()\n" @@ -3505,6 +3888,14 @@ msgid "" " connstream.shutdown(socket.SHUT_RDWR)\n" " connstream.close()" msgstr "" +"while True:\n" +" newsocket, fromaddr = bindsocket.accept()\n" +" connstream = context.wrap_socket(newsocket, server_side=True)\n" +" try:\n" +" deal_with_client(connstream)\n" +" finally:\n" +" connstream.shutdown(socket.SHUT_RDWR)\n" +" connstream.close()" #: ../../library/ssl.rst:2440 msgid "" @@ -3514,7 +3905,6 @@ msgstr "" "そして、 ``connstream`` からデータを読み、クライアントと切断する(あるいはクラ" "イアントが切断してくる)まで何か処理をします。 ::" -#: ../../library/ssl.rst:2443 msgid "" "def deal_with_client(connstream):\n" " data = connstream.recv(1024)\n" @@ -3527,6 +3917,16 @@ msgid "" " data = connstream.recv(1024)\n" " # finished with client" msgstr "" +"def deal_with_client(connstream):\n" +" data = connstream.recv(1024)\n" +" # 空のデータはクライアントとの通信が終わったことを示す\n" +" while data:\n" +" if not do_something(connstream, data):\n" +" # クライアントとの通信が終わると do_something が\n" +" # False を返すものとする\n" +" break\n" +" data = connstream.recv(1024)\n" +" # クライアントとの通信が終了" #: ../../library/ssl.rst:2454 msgid "" @@ -3554,7 +3954,6 @@ msgstr "" "振る舞いをします。ですのでノンブロッキングソケットとともに使う場合、いくつか" "気をつけなければならない事項があります:" -#: ../../library/ssl.rst:2468 msgid "" "Most :class:`SSLSocket` methods will raise either :exc:`SSLWantWriteError` " "or :exc:`SSLWantReadError` instead of :exc:`BlockingIOError` if an I/O " @@ -3565,14 +3964,15 @@ msgid "" "underlying socket first, and attempts to *read* from the SSL socket may " "require a prior *write* to the underlying socket." msgstr "" -"ほとんどの :class:`SSLSocket` のメソッドは I/O 操作がブロックすると :exc:" +"ほとんどの :class:`SSLSocket` のメソッドは、I/O 操作に待機が必要な場合、:exc:" "`BlockingIOError` ではなく :exc:`SSLWantWriteError` か :exc:" -"`SSLWantReadError` のどちらかを送出します。 :exc:`SSLWantReadError` は下層の" -"ソケットで読み出しが必要な場合に送出され、 :exc:`SSLWantWriteError` は下層の" -"ソケットで書き込みが必要な場合に送出されます。SSL ソケットに対して *書き込み" -"* を試みると下層のソケットから最初に *読み出す* 必要があるかもしれず、SSL ソ" -"ケットに対して *読み出し* を試みると下層のソケットに先に *書き込む* 必要があ" -"るかもしれないことに注意してください。" +"`SSLWantReadError` のどちらかを送出します。\n" +":exc:`SSLWantReadError` は下層のソケットで読み出しが必要な場合に送出され、:" +"exc:`SSLWantWriteError` は下層のソケットで書き込みが必要な場合に送出されま" +"す。\n" +"SSL ソケットに対して *書き込み* を試みると下層のソケットから最初に *読み出す" +"* 必要がある場合があり、SSL ソケットに対して *読み出し* を試みると下層のソ" +"ケットに先に *書き込む* 必要がある場合もあることに注意してください。" #: ../../library/ssl.rst:2480 msgid "" @@ -3633,7 +4033,6 @@ msgstr "" "`~select.select` を用いてソケットの準備が整うのを待つためには、およそ以下のよ" "うにします::" -#: ../../library/ssl.rst:2505 msgid "" "while True:\n" " try:\n" @@ -3644,8 +4043,15 @@ msgid "" " except ssl.SSLWantWriteError:\n" " select.select([], [sock], [])" msgstr "" +"while True:\n" +" try:\n" +" sock.do_handshake()\n" +" break\n" +" except ssl.SSLWantReadError:\n" +" select.select([sock], [], [])\n" +" except ssl.SSLWantWriteError:\n" +" select.select([], [sock], [])" -#: ../../library/ssl.rst:2516 msgid "" "The :mod:`asyncio` module supports :ref:`non-blocking SSL sockets ` and provides a higher level :ref:`Streams API ` に対応し、より高水準の :ref:`Streams API ` を" +"提供します。\n" +":mod:`selectors` モジュールでイベントをポーリングし、:exc:" +"`SSLWantWriteError`、:exc:`SSLWantReadError`、:exc:`BlockingIOError` の各例外" +"を処理します。\n" +"SSL ハンドシェイクも非同期に実行します。" #: ../../library/ssl.rst:2525 msgid "Memory BIO Support" @@ -3782,13 +4195,11 @@ msgstr ":meth:`~SSLSocket.write`" msgid ":meth:`~SSLSocket.getpeercert`" msgstr ":meth:`~SSLSocket.getpeercert`" -#: ../../library/ssl.rst:2578 msgid ":meth:`~SSLSocket.get_verified_chain`" -msgstr "" +msgstr ":meth:`~SSLSocket.get_verified_chain`" -#: ../../library/ssl.rst:2579 msgid ":meth:`~SSLSocket.get_unverified_chain`" -msgstr "" +msgstr ":meth:`~SSLSocket.get_unverified_chain`" #: ../../library/ssl.rst:2580 msgid ":meth:`~SSLSocket.selected_alpn_protocol`" @@ -3897,12 +4308,15 @@ msgstr "" "です。例えば、:meth:`~SSLSocket.read` は入力 BIO が持つデータよりも多くのデー" "タを必要とする場合、:exc:`SSLWantReadError` を送出します。" -#: ../../library/ssl.rst:2619 msgid "" ":class:`SSLObject` instances must be created with :meth:`~SSLContext." "wrap_bio`. In earlier versions, it was possible to create instances " "directly. This was never documented or officially supported." msgstr "" +":class:`SSLObject` のインスタンスは :meth:`~SSLContext.wrap_bio` で作成しなけ" +"ればなりません。\n" +"以前のバージョンでは直接作成できましたが、文書化も公式のサポートもされていま" +"せんでした。" #: ../../library/ssl.rst:2625 msgid "" @@ -3932,13 +4346,12 @@ msgid "" "position." msgstr "メモリ BIOが現在ファイルの末尾にあるかを表す真偽値です。" -#: ../../library/ssl.rst:2645 msgid "" "Read up to *n* bytes from the memory buffer. If *n* is not specified or " "negative, all bytes are returned." msgstr "" -"メモリバッファから最大 *n* 読み取ります。*n* が指定されていないか、負値の場" -"合、すべてのバイトが返されます。" +"メモリバッファから最大 *n* バイト読み取ります。\n" +"*n* が指定されていないか負の場合は、すべてのバイトを返します。" #: ../../library/ssl.rst:2650 msgid "" @@ -4004,7 +4417,6 @@ msgstr "" "例として、 :class:`smtplib.SMTP` クラスを使用して SMTP サーバーに対して信頼で" "きるセキュアな接続を行う方法を以下に示します::" -#: ../../library/ssl.rst:2697 msgid "" ">>> import ssl, smtplib\n" ">>> smtp = smtplib.SMTP(\"mail.python.org\", port=587)\n" @@ -4012,6 +4424,11 @@ msgid "" ">>> smtp.starttls(context=context)\n" "(220, b'2.0.0 Ready to start TLS')" msgstr "" +">>> import ssl, smtplib\n" +">>> smtp = smtplib.SMTP(\"mail.python.org\", port=587)\n" +">>> context = ssl.create_default_context()\n" +">>> smtp.starttls(context=context)\n" +"(220, b'2.0.0 Ready to start TLS')" #: ../../library/ssl.rst:2703 msgid "" @@ -4110,7 +4527,6 @@ msgstr "" msgid "Cipher selection" msgstr "暗号の選択" -#: ../../library/ssl.rst:2763 msgid "" "If you have advanced security requirements, fine-tuning of the ciphers " "enabled when negotiating a SSL session is possible through the :meth:" @@ -4122,6 +4538,14 @@ msgid "" "cipher list, use :meth:`SSLContext.get_ciphers` or the ``openssl ciphers`` " "command on your system." msgstr "" +"高度なセキュリティ要件がある場合は、:meth:`SSLContext.set_ciphers` メソッド" +"で SSL セッションのネゴシエーション時に有効な暗号方式を細かく調整できます。\n" +"Python 3.2.3 以降、ssl モジュールは一部の弱い暗号をデフォルトで無効にしていま" +"すが、選択肢をさらに制限したい場合もあるでしょう。\n" +"OpenSSL の `暗号リスト形式 `_ のドキュメントを必ず読んでください。\n" +"指定した暗号リストで有効になる暗号方式を確認するには、:meth:`SSLContext." +"get_ciphers` またはシステムの ``openssl ciphers`` コマンドを使ってください。" #: ../../library/ssl.rst:2774 msgid "Multi-processing" @@ -4142,11 +4566,12 @@ msgstr "" msgid "TLS 1.3" msgstr "TLS 1.3" -#: ../../library/ssl.rst:2792 msgid "" "The TLS 1.3 protocol behaves slightly differently than previous version of " "TLS/SSL. Some new TLS 1.3 features are not yet available." msgstr "" +"TLS 1.3 プロトコルの動作は、それ以前の TLS/SSL と少し異なります。\n" +"TLS 1.3 の新機能の一部はまだ利用できません。" #: ../../library/ssl.rst:2795 msgid "" @@ -4156,12 +4581,15 @@ msgid "" "`SSLContext.get_ciphers` returns them." msgstr "" -#: ../../library/ssl.rst:2799 msgid "" "Session tickets are no longer sent as part of the initial handshake and are " "handled differently. :attr:`SSLSocket.session` and :class:`SSLSession` are " "not compatible with TLS 1.3." msgstr "" +"セッションチケットは最初のハンドシェイクの一部としては送られなくなり、扱いも" +"異なります。\n" +":attr:`SSLSocket.session` と :class:`SSLSession` は TLS 1.3 と互換性がありま" +"せん。" #: ../../library/ssl.rst:2802 msgid "" @@ -4289,9 +4717,8 @@ msgstr "Mozilla" msgid "OpenSSL" msgstr "OpenSSL" -#: ../../library/ssl.rst:12 msgid "(use in module ssl)" -msgstr "" +msgstr "(ssl モジュールで使用)" #: ../../library/ssl.rst:14 msgid "TLS" @@ -4301,18 +4728,15 @@ msgstr "TLS" msgid "SSL" msgstr "SSL" -#: ../../library/ssl.rst:14 msgid "Transport Layer Security" -msgstr "" +msgstr "Transport Layer Security" -#: ../../library/ssl.rst:14 msgid "Secure Sockets Layer" -msgstr "" +msgstr "Secure Sockets Layer" #: ../../library/ssl.rst:2151 msgid "certificates" msgstr "certificates" -#: ../../library/ssl.rst:2153 msgid "X509 certificate" -msgstr "" +msgstr "X509 証明書" diff --git a/library/stat.po b/library/stat.po index bac6ee22c..9b55b92e0 100644 --- a/library/stat.po +++ b/library/stat.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: tomo, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/stat.rst:2 @@ -120,13 +120,13 @@ msgstr "" "は) スティッキービット (sticky bit)、実行グループ ID 設定 (set-group-id) およ" "び実行ユーザ ID 設定 (set-user-id) ビット --- を返します。" -#: ../../library/stat.rst:91 msgid "" "Return the portion of the file's mode that describes the file type (used by " "the :func:`!S_IS\\*` functions above)." msgstr "" +"ファイルのモードのうち、ファイル種別を表す部分を返します (上述の :func:`!" +"S_IS\\*` 関数で使われます)。" -#: ../../library/stat.rst:94 msgid "" "Normally, you would use the :func:`!os.path.is\\*` functions for testing the " "type of a file; the functions here are useful when you are doing multiple " @@ -135,12 +135,17 @@ msgid "" "information about a file that isn't handled by :mod:`os.path`, like the " "tests for block and character devices." msgstr "" +"通常、ファイル種別の判定には :func:`!os.path.is\\*` 関数を使います。\n" +"同じファイルに対して複数の判定を行い、そのたびに :c:func:`stat` システムコー" +"ルを呼び出すオーバーヘッドを避けたい場合は、このモジュールの関数が役立ちま" +"す。\n" +"また、ブロックデバイスやキャラクターデバイスかどうかなど、:mod:`os.path` が扱" +"わないファイル情報を調べる場合にも便利です。" #: ../../library/stat.rst:101 msgid "Example::" msgstr "以下はプログラム例です::" -#: ../../library/stat.rst:103 msgid "" "import os, sys\n" "from stat import *\n" @@ -168,6 +173,31 @@ msgid "" "if __name__ == '__main__':\n" " walktree(sys.argv[1], visitfile)" msgstr "" +"import os, sys\n" +"from stat import *\n" +"\n" +"def walktree(top, callback):\n" +" '''top をルートとするディレクトリツリーを再帰的にたどり、\n" +" 通常のファイルごとにコールバック関数を呼び出す'''\n" +"\n" +" for f in os.listdir(top):\n" +" pathname = os.path.join(top, f)\n" +" mode = os.lstat(pathname).st_mode\n" +" if S_ISDIR(mode):\n" +" # ディレクトリなら再帰的にたどる\n" +" walktree(pathname, callback)\n" +" elif S_ISREG(mode):\n" +" # ファイルならコールバック関数を呼び出す\n" +" callback(pathname)\n" +" else:\n" +" # 不明なファイル種別ならメッセージを表示する\n" +" print('Skipping %s' % pathname)\n" +"\n" +"def visitfile(file):\n" +" print('visiting', file)\n" +"\n" +"if __name__ == '__main__':\n" +" walktree(sys.argv[1], visitfile)" #: ../../library/stat.rst:129 msgid "" @@ -332,11 +362,9 @@ msgid "" "chmod`:" msgstr "以下のフラグは、 :func:`os.chmod` の *mode* 引数に使うこともできます:" -#: ../../library/stat.rst:266 msgid "Set UID bit." -msgstr "UID ビットを設定する。" +msgstr "set-user-ID ビット。" -#: ../../library/stat.rst:270 msgid "" "Set-group-ID bit. This bit has several special uses. For a directory it " "indicates that BSD semantics is to be used for that directory: files created " @@ -346,14 +374,16 @@ msgid "" "execution bit (:data:`S_IXGRP`) set, the set-group-ID bit indicates " "mandatory file/record locking (see also :data:`S_ENFMT`)." msgstr "" -"グループIDビットを設定する。このビットには幾つかの特殊ケースがあります。ディ" -"レクトリに対して設定されていた場合、 BSD のセマンティクスが利用される事を示し" -"ています。すなわち、そこに作成されるファイルは、作成したプロセスの有効グルー" -"プID (effective group ID) ではなくそのディレクトリのグループIDを継承し、そこ" -"に作成されるディレクトリにも :data:`S_ISGID` ビットが設定されます。グループ実" -"行ビット (:data:`S_IXGRP`) が設定されていないファイルに対してこのビットが設定" -"されていた場合、強制ファイル/レコードロックを意味します (:data:`S_ENFMT` も参" -"照してください)。" +"set-group-ID ビット。\n" +"このビットには幾つかの特殊ケースがあります。\n" +"ディレクトリに対して設定されていた場合、 BSD のセマンティクスが利用される事を" +"示しています。\n" +"すなわち、そこに作成されるファイルは、作成したプロセスの有効グループID " +"(effective group ID) ではなくそのディレクトリのグループIDを継承し、そこに作成" +"されるディレクトリにも :data:`S_ISGID` ビットが設定されます。\n" +"グループ実行ビット (:data:`S_IXGRP`) が設定されていないファイルに対してこの" +"ビットが設定されていた場合、強制ファイル/レコードロックを意味します (:data:" +"`S_ENFMT` も参照してください)。" #: ../../library/stat.rst:281 msgid "" @@ -442,21 +472,18 @@ msgid "" "chflags`:" msgstr "以下のフラグを :func:`os.chflags` の *flags* 引数として利用できます:" -#: ../../library/stat.rst:355 msgid "All user settable flags." -msgstr "" +msgstr "ユーザーが設定できるすべてのフラグ。" #: ../../library/stat.rst:361 msgid "Do not dump the file." msgstr "ファイルをダンプしない。" -#: ../../library/stat.rst:365 ../../library/stat.rst:427 msgid "The file may not be changed." -msgstr "ファイルは変更されない。" +msgstr "ファイルを変更してはいけない。" -#: ../../library/stat.rst:369 ../../library/stat.rst:431 msgid "The file may only be appended to." -msgstr "ファイルは追記しかされない。" +msgstr "ファイルへの追記だけを許可する。" #: ../../library/stat.rst:373 msgid "The directory is opaque when viewed through a union stack." @@ -464,61 +491,51 @@ msgstr "" "ユニオンファイルシステムのスタックを通したとき、このディレクトリは不透明で" "す。" -#: ../../library/stat.rst:377 ../../library/stat.rst:441 msgid "The file may not be renamed or deleted." -msgstr "ファイルはリネームや削除されない。" +msgstr "ファイル名の変更や削除を禁止する。" #: ../../library/stat.rst:381 msgid "The file is stored compressed (macOS 10.6+)." msgstr "ファイルは圧縮して保存される (macOS 10.6+)。" -#: ../../library/stat.rst:385 msgid "Used for handling document IDs (macOS)" -msgstr "" +msgstr "ドキュメント ID の処理に使う (macOS)。" -#: ../../library/stat.rst:391 msgid "The file needs an entitlement for reading or writing (macOS 10.13+)" -msgstr "" +msgstr "ファイルの読み書きにエンタイトルメントが必要 (macOS 10.13+)。" #: ../../library/stat.rst:397 msgid "The file should not be displayed in a GUI (macOS 10.5+)." msgstr "ファイルは GUI で表示されるべきでない (macOS 10.5+)。" -#: ../../library/stat.rst:401 msgid "All super-user changeable flags" -msgstr "" +msgstr "スーパーユーザーが変更できるすべてのフラグ。" -#: ../../library/stat.rst:407 msgid "All super-user supported flags" -msgstr "" +msgstr "スーパーユーザーが利用できるすべてのフラグ。" -#: ../../library/stat.rst:409 ../../library/stat.rst:417 msgid "Availability" -msgstr "" +msgstr "利用可能な環境" -#: ../../library/stat.rst:415 msgid "All super-user read-only synthetic flags" -msgstr "" +msgstr "スーパーユーザー用の、読み取り専用の合成フラグすべて。" #: ../../library/stat.rst:423 msgid "The file may be archived." msgstr "ファイルはアーカイブされているかもしれません。" -#: ../../library/stat.rst:435 msgid "The file needs an entitlement to write to (macOS 10.13+)" -msgstr "" +msgstr "ファイルへの書き込みにエンタイトルメントが必要 (macOS 10.13+)。" #: ../../library/stat.rst:445 msgid "The file is a snapshot file." msgstr "このファイルはスナップショットファイルです。" -#: ../../library/stat.rst:449 msgid "The file is a firmlink (macOS 10.15+)" -msgstr "" +msgstr "ファイルが firmlink である (macOS 10.15+)。" -#: ../../library/stat.rst:455 msgid "The file is a dataless object (macOS 10.15+)" -msgstr "" +msgstr "ファイルがデータを持たないオブジェクトである (macOS 10.15+)。" #: ../../library/stat.rst:459 msgid "" diff --git a/library/statistics.po b/library/statistics.po index 9354e7bcd..11e125006 100644 --- a/library/statistics.po +++ b/library/statistics.po @@ -20,10 +20,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/statistics.rst:2 @@ -88,7 +88,6 @@ msgstr "" "``mode()``, ``multimode()``, そして ``quantiles()`` です。 これらの関数を呼" "ぶ前に、 ``NaN`` 値を取り除く必要があります::" -#: ../../library/statistics.rst:47 msgid "" ">>> from statistics import median\n" ">>> from math import isnan\n" @@ -110,16 +109,34 @@ msgid "" ">>> median(clean) # This result is now well defined\n" "18.75" msgstr "" +">>> from statistics import median\n" +">>> from math import isnan\n" +">>> from itertools import filterfalse\n" +"\n" +">>> data = [20.7, float('NaN'),19.2, 18.3, float('NaN'), 14.4]\n" +">>> sorted(data) # 予想外の動作になる\n" +"[20.7, nan, 14.4, 18.3, 19.2, nan]\n" +">>> median(data) # 予想外の結果になる\n" +"16.35\n" +"\n" +">>> sum(map(isnan, data)) # 欠損値の数\n" +"2\n" +">>> clean = list(filterfalse(isnan, data)) # NaN を取り除く\n" +">>> clean\n" +"[20.7, 19.2, 18.3, 14.4]\n" +">>> sorted(clean) # 今度は期待どおりにソートされる\n" +"[14.4, 18.3, 19.2, 20.7]\n" +">>> median(clean) # 今度は結果が適切に定まる\n" +"18.75" #: ../../library/statistics.rst:69 msgid "Averages and measures of central location" msgstr "平均及び中心位置の測度" -#: ../../library/statistics.rst:71 msgid "" "These functions calculate an average or typical value from a population or " "sample." -msgstr "これらの関数は母集団または標本の平均値や標準値を計算します。" +msgstr "これらの関数は、母集団や標本の平均値または代表値を計算します。" #: ../../library/statistics.rst:75 msgid ":func:`mean`" @@ -133,9 +150,8 @@ msgstr "データの算術平均 (いわゆる「平均」) 。" msgid ":func:`fmean`" msgstr ":func:`fmean`" -#: ../../library/statistics.rst:76 msgid "Fast, floating-point arithmetic mean, with optional weighting." -msgstr "" +msgstr "重み付けも指定できる、高速な浮動小数点数の算術平均。" #: ../../library/statistics.rst:77 msgid ":func:`geometric_mean`" @@ -155,19 +171,17 @@ msgstr "データの調和平均。" #: ../../library/statistics.rst:79 msgid ":func:`kde`" -msgstr "" +msgstr ":func:`kde`" -#: ../../library/statistics.rst:79 msgid "Estimate the probability density distribution of the data." -msgstr "" +msgstr "データの確率密度分布の推定。" #: ../../library/statistics.rst:80 msgid ":func:`kde_random`" -msgstr "" +msgstr ":func:`kde_random`" -#: ../../library/statistics.rst:80 msgid "Random sampling from the PDF generated by kde()." -msgstr "" +msgstr "kde() が生成した確率密度関数 (PDF) からのランダムサンプリング。" #: ../../library/statistics.rst:81 msgid ":func:`median`" @@ -197,9 +211,8 @@ msgstr "データの high median。" msgid ":func:`median_grouped`" msgstr ":func:`median_grouped`" -#: ../../library/statistics.rst:84 msgid "Median (50th percentile) of grouped data." -msgstr "" +msgstr "階級にまとめられたデータの中央値 (50 パーセンタイル)。" #: ../../library/statistics.rst:85 msgid ":func:`mode`" @@ -229,13 +242,12 @@ msgstr "データの等確率での分割。" msgid "Measures of spread" msgstr "分散の測度" -#: ../../library/statistics.rst:93 msgid "" "These functions calculate a measure of how much the population or sample " "tends to deviate from the typical or average values." msgstr "" -"これらの関数は母集団または標本が標準値や平均値からどれくらい離れているかにつ" -"いて計算します。" +"これらの関数は、母集団や標本の値が代表値や平均値からどの程度ばらつくかを表す" +"測度を計算します。" #: ../../library/statistics.rst:97 msgid ":func:`pstdev`" @@ -265,9 +277,8 @@ msgstr "データの標本標準偏差。" msgid ":func:`variance`" msgstr ":func:`variance`" -#: ../../library/statistics.rst:100 msgid "Sample variance of data." -msgstr "データの標本標準分散。" +msgstr "データの標本分散。" #: ../../library/statistics.rst:104 msgid "Statistics for relations between two inputs" @@ -340,7 +351,6 @@ msgstr "*data* が空の場合 :exc:`StatisticsError` を送出します。" msgid "Some examples of use:" msgstr "使用例:" -#: ../../library/statistics.rst:134 msgid "" ">>> mean([1, 2, 3, 4, 4])\n" "2.8\n" @@ -355,6 +365,18 @@ msgid "" ">>> mean([D(\"0.5\"), D(\"0.75\"), D(\"0.625\"), D(\"0.375\")])\n" "Decimal('0.5625')" msgstr "" +">>> mean([1, 2, 3, 4, 4])\n" +"2.8\n" +">>> mean([-1.0, 2.5, 3.25, 5.75])\n" +"2.625\n" +"\n" +">>> from fractions import Fraction as F\n" +">>> mean([F(3, 7), F(1, 21), F(5, 3), F(1, 3)])\n" +"Fraction(13, 21)\n" +"\n" +">>> from decimal import Decimal as D\n" +">>> mean([D(\"0.5\"), D(\"0.75\"), D(\"0.625\"), D(\"0.375\")])\n" +"Decimal('0.5625')" #: ../../library/statistics.rst:151 msgid "" @@ -369,7 +391,6 @@ msgstr "" "tendency `_) の尺度について" "は、 :func:`median` を参照してください。" -#: ../../library/statistics.rst:157 msgid "" "The sample mean gives an unbiased estimate of the true population mean, so " "that when taken on average over all the possible samples, ``mean(sample)`` " @@ -377,91 +398,106 @@ msgid "" "the entire population rather than a sample, then ``mean(data)`` is " "equivalent to calculating the true population mean μ." msgstr "" -"標本平均は真の母平均の不偏推定量のため、出来る限り多くの標本から平均を求める" -"と、``mean(sample)`` は真の母平均に収束します (訳注: 大数の法則)。*data* が標" -"本ではなく母集団全体の場合、``mean(data)`` は真の母平均 μ を計算することと等" -"価です。" +"標本平均は真の母平均の不偏推定量です。\n" +"そのため、取り得るすべての標本にわたって ``mean(sample)`` を平均すると、母集" +"団全体の真の平均に収束します。\n" +"*data* が標本ではなく母集団全体を表す場合、``mean(data)`` は真の母平均 μ の計" +"算と同じです。" #: ../../library/statistics.rst:166 msgid "Convert *data* to floats and compute the arithmetic mean." msgstr "*data* を float に変換し、算術平均を計算します。" -#: ../../library/statistics.rst:168 msgid "" "This runs faster than the :func:`mean` function and it always returns a :" "class:`float`. The *data* may be a sequence or iterable. If the input " "dataset is empty, raises a :exc:`StatisticsError`." msgstr "" +":func:`mean` 関数より高速に動作し、常に :class:`float` を返します。\n" +"*data* はシーケンスまたはイテラブルにできます。\n" +"入力データが空の場合は :exc:`StatisticsError` を送出します。" -#: ../../library/statistics.rst:172 msgid "" ">>> fmean([3.5, 4.0, 5.25])\n" "4.25" msgstr "" +">>> fmean([3.5, 4.0, 5.25])\n" +"4.25" -#: ../../library/statistics.rst:177 msgid "" "Optional weighting is supported. For example, a professor assigns a grade " "for a course by weighting quizzes at 20%, homework at 20%, a midterm exam at " "30%, and a final exam at 30%:" msgstr "" +"必要に応じて重み付けを指定できます。\n" +"例えば、教授が小テスト 20%、宿題 20%、中間試験 30%、期末試験 30% の重みで授業" +"の成績を付けるとします。" -#: ../../library/statistics.rst:181 msgid "" ">>> grades = [85, 92, 83, 91]\n" ">>> weights = [0.20, 0.20, 0.30, 0.30]\n" ">>> fmean(grades, weights)\n" "87.6" msgstr "" +">>> grades = [85, 92, 83, 91]\n" +">>> weights = [0.20, 0.20, 0.30, 0.30]\n" +">>> fmean(grades, weights)\n" +"87.6" -#: ../../library/statistics.rst:188 msgid "" "If *weights* is supplied, it must be the same length as the *data* or a :exc:" "`ValueError` will be raised." msgstr "" +"*weights* を指定する場合は *data* と同じ長さでなければならず、異なる場合は :" +"exc:`ValueError` を送出します。" #: ../../library/statistics.rst:193 ../../library/statistics.rst:261 msgid "Added support for *weights*." msgstr "*weights* のサポートが追加されました。" -#: ../../library/statistics.rst:199 msgid "Convert *data* to floats and compute the geometric mean." -msgstr "" +msgstr "*data* を浮動小数点数に変換して幾何平均を計算します。" -#: ../../library/statistics.rst:201 msgid "" "The geometric mean indicates the central tendency or typical value of the " "*data* using the product of the values (as opposed to the arithmetic mean " "which uses their sum)." msgstr "" +"幾何平均は、値の積を使って *data* の中心傾向や代表値を表します (算術平均が和" +"を使うのとは対照的です)。" -#: ../../library/statistics.rst:205 msgid "" "Raises a :exc:`StatisticsError` if the input dataset is empty, if it " "contains a zero, or if it contains a negative value. The *data* may be a " "sequence or iterable." msgstr "" +"入力データが空の場合、ゼロを含む場合、または負の値を含む場合は :exc:" +"`StatisticsError` を送出します。\n" +"*data* はシーケンスまたはイテラブルにできます。" -#: ../../library/statistics.rst:209 msgid "" "No special efforts are made to achieve exact results. (However, this may " "change in the future.)" msgstr "" +"厳密な結果を得るための特別な処理は行いません (将来変更される可能性はありま" +"す)。" -#: ../../library/statistics.rst:212 msgid "" ">>> round(geometric_mean([54, 24, 36]), 1)\n" "36.0" msgstr "" +">>> round(geometric_mean([54, 24, 36]), 1)\n" +"36.0" -#: ../../library/statistics.rst:222 msgid "" "Return the harmonic mean of *data*, a sequence or iterable of real-valued " "numbers. If *weights* is omitted or ``None``, then equal weighting is " "assumed." msgstr "" +"実数のシーケンスまたはイテラブル *data* の調和平均を返します。\n" +"*weights* を省略するか ``None`` にすると、すべての値の重みを同じと見なしま" +"す。" -#: ../../library/statistics.rst:226 msgid "" "The harmonic mean is the reciprocal of the arithmetic :func:`mean` of the " "reciprocals of the data. For example, the harmonic mean of three values *a*, " @@ -469,7 +505,7 @@ msgid "" "values is zero, the result will be zero." msgstr "" "調和平均(harmonic mean)は、データの逆数の算術平均 :func:`mean` の逆数です。" -"例えば、3つの値 *a*, *b*, *c* の調和平均は``3/(1/a + 1/b + 1/c)`` になりま" +"例えば、3つの値 *a*, *b*, *c* の調和平均は ``3/(1/a + 1/b + 1/c)`` になりま" "す。いずれかの値が0の場合、結果は0になります。" #: ../../library/statistics.rst:231 @@ -481,139 +517,164 @@ msgstr "" "調和平均は平均の一種で、データの中心位置の測度です。速度のような比(ratios)や" "率(rates)を平均するときにしばしば適切です。" -#: ../../library/statistics.rst:235 msgid "" "Suppose a car travels 10 km at 40 km/hr, then another 10 km at 60 km/hr. " "What is the average speed?" msgstr "" +"車が最初の 10 km を時速 40 km、次の 10 km を時速 60 km で走るとします。\n" +"平均速度はいくらになるでしょうか。" -#: ../../library/statistics.rst:238 msgid "" ">>> harmonic_mean([40, 60])\n" "48.0" msgstr "" +">>> harmonic_mean([40, 60])\n" +"48.0" -#: ../../library/statistics.rst:243 msgid "" "Suppose a car travels 40 km/hr for 5 km, and when traffic clears, speeds-up " "to 60 km/hr for the remaining 30 km of the journey. What is the average " "speed?" msgstr "" +"車が最初の 5 km を時速 40 km で走り、渋滞を抜けた後は時速 60 km に加速して残" +"りの 30 km を走るとします。\n" +"平均速度はいくらになるでしょうか。" -#: ../../library/statistics.rst:247 msgid "" ">>> harmonic_mean([40, 60], weights=[5, 30])\n" "56.0" msgstr "" +">>> harmonic_mean([40, 60], weights=[5, 30])\n" +"56.0" -#: ../../library/statistics.rst:252 msgid "" ":exc:`StatisticsError` is raised if *data* is empty, any element is less " "than zero, or if the weighted sum isn't positive." msgstr "" +"*data* が空の場合、負の要素がある場合、または重み付きの和が正でない場合は :" +"exc:`StatisticsError` を送出します。" -#: ../../library/statistics.rst:255 msgid "" "The current algorithm has an early-out when it encounters a zero in the " "input. This means that the subsequent inputs are not tested for validity. " "(This behavior may change in the future.)" msgstr "" +"現在のアルゴリズムは、入力にゼロが現れると計算を打ち切ります。\n" +"そのため、それ以降の入力が有効かどうかは検査しません (この動作は将来変更され" +"る可能性があります)。" -#: ../../library/statistics.rst:267 msgid "" "`Kernel Density Estimation (KDE) `_: Create a continuous " "probability density function or cumulative distribution function from " "discrete samples." msgstr "" +"`カーネル密度推定 (KDE) `_: 離散的な標本から連続的な確率密度関" +"数または累積分布関数を作成します。" -#: ../../library/statistics.rst:272 msgid "" "The basic idea is to smooth the data using `a kernel function `_. to help draw inferences about a " "population from a sample." msgstr "" +"基本的な考え方は、`カーネル関数 `_ でデータを平滑化し、標本から母集団について推測できるよ" +"うにすることです。" -#: ../../library/statistics.rst:276 msgid "" "The degree of smoothing is controlled by the scaling parameter *h* which is " "called the bandwidth. Smaller values emphasize local features while larger " "values give smoother results." msgstr "" +"平滑化の度合いは、帯域幅と呼ばれる尺度パラメーター *h* で調整します。\n" +"値が小さいほど局所的な特徴が強調され、大きいほど滑らかな結果になります。" -#: ../../library/statistics.rst:280 msgid "" "The *kernel* determines the relative weights of the sample data points. " "Generally, the choice of kernel shape does not matter as much as the more " "influential bandwidth smoothing parameter." msgstr "" +"*kernel* は標本の各データ点に対する相対的な重みを決めます。\n" +"一般に、カーネルの形状の選択よりも、平滑化を調整する帯域幅の方が大きく影響し" +"ます。" -#: ../../library/statistics.rst:284 msgid "" "Kernels that give some weight to every sample point include *normal* " "(*gauss*), *logistic*, and *sigmoid*." msgstr "" +"すべての標本点に重みを与えるカーネルには、*normal* (*gauss*)、*logistic*、" +"*sigmoid* があります。" -#: ../../library/statistics.rst:287 msgid "" "Kernels that only give weight to sample points within the bandwidth include " "*rectangular* (*uniform*), *triangular*, *parabolic* (*epanechnikov*), " "*quartic* (*biweight*), *triweight*, and *cosine*." msgstr "" +"帯域幅内の標本点だけに重みを与えるカーネルには、*rectangular* (*uniform*)、" +"*triangular*、*parabolic* (*epanechnikov*)、*quartic* (*biweight*)、" +"*triweight*、*cosine* があります。" -#: ../../library/statistics.rst:291 msgid "" "If *cumulative* is true, will return a cumulative distribution function." -msgstr "" +msgstr "*cumulative* が真の場合は累積分布関数を返します。" -#: ../../library/statistics.rst:293 ../../library/statistics.rst:324 msgid "" "A :exc:`StatisticsError` will be raised if the *data* sequence is empty." -msgstr "" +msgstr "*data* シーケンスが空の場合は :exc:`StatisticsError` を送出します。" -#: ../../library/statistics.rst:295 msgid "" "`Wikipedia has an example `_ where we can use :func:`kde` to " "generate and plot a probability density function estimated from a small " "sample:" msgstr "" +"`Wikipedia の例 `_ を使って、:func:`kde` で小さな標本から推" +"定した確率密度関数を生成し、描画できます。" -#: ../../library/statistics.rst:300 msgid "" ">>> sample = [-2.1, -1.3, -0.4, 1.9, 5.1, 6.2]\n" ">>> f_hat = kde(sample, h=1.5)\n" ">>> xarr = [i/100 for i in range(-750, 1100)]\n" ">>> yarr = [f_hat(x) for x in xarr]" msgstr "" +">>> sample = [-2.1, -1.3, -0.4, 1.9, 5.1, 6.2]\n" +">>> f_hat = kde(sample, h=1.5)\n" +">>> xarr = [i/100 for i in range(-750, 1100)]\n" +">>> yarr = [f_hat(x) for x in xarr]" -#: ../../library/statistics.rst:307 msgid "The points in ``xarr`` and ``yarr`` can be used to make a PDF plot:" msgstr "" +"``xarr`` と ``yarr`` の点を使って確率密度関数 (PDF) のグラフを描けます。" -#: ../../library/statistics.rst:309 msgid "Scatter plot of the estimated probability density function." -msgstr "" +msgstr "推定した確率密度関数の散布図。" -#: ../../library/statistics.rst:317 msgid "" "Return a function that makes a random selection from the estimated " "probability density function produced by ``kde(data, h, kernel)``." msgstr "" +"``kde(data, h, kernel)`` が生成する推定確率密度関数に従ってランダムな値を選ぶ" +"関数を返します。" -#: ../../library/statistics.rst:320 msgid "" "Providing a *seed* allows reproducible selections. In the future, the values " "may change slightly as more accurate kernel inverse CDF estimates are " "implemented. The seed may be an integer, float, str, or bytes." msgstr "" +"*seed* を指定すると選択結果を再現できます。\n" +"将来、カーネルの逆累積分布関数の推定精度が向上すると、値がわずかに変わる可能" +"性があります。\n" +"シードには整数、浮動小数点数、str、bytes を使えます。" -#: ../../library/statistics.rst:326 msgid "" "Continuing the example for :func:`kde`, we can use :func:`kde_random` to " "generate new random selections from an estimated probability density " "function:" msgstr "" +":func:`kde` の例に続けて、:func:`kde_random` を使うと、推定した確率密度関数か" +"ら新しい値をランダムに選べます。" #: ../../library/statistics.rst:341 msgid "" @@ -634,11 +695,12 @@ msgstr "" "中央値は外れ値の影響を受けにくいため、中心位置のロバストな測度です。データ数" "が奇数の場合は中央の値を返します:" -#: ../../library/statistics.rst:349 msgid "" ">>> median([1, 3, 5])\n" "3" msgstr "" +">>> median([1, 3, 5])\n" +"3" #: ../../library/statistics.rst:354 msgid "" @@ -647,11 +709,12 @@ msgid "" msgstr "" "データ数が偶数の場合は、中央値は中央に最も近い2値の算術平均で補間されます:" -#: ../../library/statistics.rst:357 msgid "" ">>> median([1, 3, 5, 7])\n" "4.0" msgstr "" +">>> median([1, 3, 5, 7])\n" +"4.0" #: ../../library/statistics.rst:362 msgid "" @@ -660,15 +723,13 @@ msgid "" msgstr "" "データが離散的で、中央値がデータ点にない値でも構わない場合に適しています。" -#: ../../library/statistics.rst:365 msgid "" "If the data is ordinal (supports order operations) but not numeric (doesn't " "support addition), consider using :func:`median_low` or :func:`median_high` " "instead." msgstr "" -"もしあなたのデータが(注文操作をサポートする)序数で、(追加操作をサポートし" -"ない)数値でないならば、代わりに :func:`median_low` または :func:" -"`median_high` の使用を検討してください。" +"データの順序は比較できても、数値ではなく加算できない場合は、代わりに :func:" +"`median_low` または :func:`median_high` の使用を検討してください。" #: ../../library/statistics.rst:371 msgid "" @@ -688,13 +749,16 @@ msgstr "" "low median は必ずデータに含まれています。データ数が奇数の場合は中央の値を返" "し、偶数の場合は中央の2値の小さい方を返します。" -#: ../../library/statistics.rst:378 msgid "" ">>> median_low([1, 3, 5])\n" "3\n" ">>> median_low([1, 3, 5, 7])\n" "3" msgstr "" +">>> median_low([1, 3, 5])\n" +"3\n" +">>> median_low([1, 3, 5, 7])\n" +"3" #: ../../library/statistics.rst:385 msgid "" @@ -722,13 +786,16 @@ msgstr "" "high median は必ずデータに含まれています。データ数が奇数の場合は中央の値を返" "し、偶数の場合は中央の2値の大きい方を返します。" -#: ../../library/statistics.rst:398 msgid "" ">>> median_high([1, 3, 5])\n" "3\n" ">>> median_high([1, 3, 5, 7])\n" "5" msgstr "" +">>> median_high([1, 3, 5])\n" +"3\n" +">>> median_high([1, 3, 5, 7])\n" +"5" #: ../../library/statistics.rst:405 msgid "" @@ -738,31 +805,33 @@ msgstr "" "データが離散的で、中央値が補間値よりもデータ点にある値の方が良い場合に用いて" "ください。" -#: ../../library/statistics.rst:411 msgid "" "Estimates the median for numeric data that has been `grouped or binned " "`_ around the midpoints of " "consecutive, fixed-width intervals." msgstr "" +"連続する一定幅の区間の中点を中心に `階級やビンにまとめられた `_ 数値データの中央値を推定します。" -#: ../../library/statistics.rst:415 msgid "" "The *data* can be any iterable of numeric data with each value being exactly " "the midpoint of a bin. At least one value must be present." msgstr "" +"*data* は数値データの任意のイテラブルで、各値はビンの中点そのものでなければな" +"りません。\n" +"少なくとも一つの値が必要です。" -#: ../../library/statistics.rst:418 msgid "The *interval* is the width of each bin." -msgstr "" +msgstr "*interval* は各ビンの幅です。" -#: ../../library/statistics.rst:420 msgid "" "For example, demographic information may have been summarized into " "consecutive ten-year age groups with each group being represented by the 5-" "year midpoints of the intervals:" msgstr "" +"例えば、人口統計の情報を連続する 10 歳ごとの年齢層にまとめ、各層を区間の下端" +"から 5 歳上の中点で表すとします。" -#: ../../library/statistics.rst:424 msgid "" ">>> from collections import Counter\n" ">>> demographics = Counter({\n" @@ -774,22 +843,35 @@ msgid "" "... })\n" "..." msgstr "" +">>> from collections import Counter\n" +">>> demographics = Counter({\n" +"... 25: 172, # 20 歳から 30 歳\n" +"... 35: 484, # 30 歳から 40 歳\n" +"... 45: 387, # 40 歳から 50 歳\n" +"... 55: 22, # 50 歳から 60 歳\n" +"... 65: 6, # 60 歳から 70 歳\n" +"... })\n" +"..." -#: ../../library/statistics.rst:436 msgid "" "The 50th percentile (median) is the 536th person out of the 1071 member " "cohort. That person is in the 30 to 40 year old age group." msgstr "" +"50 パーセンタイル (中央値) は 1,071 人の集団のうち 536 番目の人です。\n" +"その人は 30 歳から 40 歳の年齢層に属します。" -#: ../../library/statistics.rst:439 msgid "" "The regular :func:`median` function would assume that everyone in the " "tricenarian age group was exactly 35 years old. A more tenable assumption " "is that the 484 members of that age group are evenly distributed between 30 " "and 40. For that, we use :func:`median_grouped`:" msgstr "" +"通常の :func:`median` 関数は、30 代の年齢層の全員がちょうど 35 歳だと仮定しま" +"す。\n" +"その年齢層の 484 人が 30 歳から 40 歳の間に均等に分布していると仮定する方が妥" +"当です。\n" +"そのためには :func:`median_grouped` を使います。" -#: ../../library/statistics.rst:445 msgid "" ">>> data = list(demographics.elements())\n" ">>> median(data)\n" @@ -797,34 +879,46 @@ msgid "" ">>> round(median_grouped(data, interval=10), 1)\n" "37.5" msgstr "" +">>> data = list(demographics.elements())\n" +">>> median(data)\n" +"35\n" +">>> round(median_grouped(data, interval=10), 1)\n" +"37.5" -#: ../../library/statistics.rst:453 msgid "" "The caller is responsible for making sure the data points are separated by " "exact multiples of *interval*. This is essential for getting a correct " "result. The function does not check this precondition." msgstr "" +"データ点同士の間隔が *interval* の正確な整数倍になっていることは、呼び出し側" +"で確認する必要があります。\n" +"正しい結果を得るにはこの条件が不可欠です。\n" +"関数はこの前提条件を検査しません。" -#: ../../library/statistics.rst:457 msgid "" "Inputs may be any numeric type that can be coerced to a float during the " "interpolation step." -msgstr "" +msgstr "入力には、補間の段階で浮動小数点数に変換できる任意の数値型を使えます。" -#: ../../library/statistics.rst:463 msgid "" "Return the single most common data point from discrete or nominal *data*. " "The mode (when it exists) is the most typical value and serves as a measure " "of central location." msgstr "" +"離散データまたは名義尺度データ *data* の中で、最も出現回数が多いデータ点を一" +"つ返します。\n" +"最頻値 (存在する場合) は最も代表的な値であり、中心位置の測度となります。" -#: ../../library/statistics.rst:467 msgid "" "If there are multiple modes with the same frequency, returns the first one " "encountered in the *data*. If the smallest or largest of those is desired " "instead, use ``min(multimode(data))`` or ``max(multimode(data))``. If the " "input *data* is empty, :exc:`StatisticsError` is raised." msgstr "" +"同じ頻度の最頻値が複数ある場合は、*data* で最初に現れたものを返します。\n" +"それらのうち最小値または最大値が欲しい場合は、``min(multimode(data))`` また" +"は ``max(multimode(data))`` を使ってください。\n" +"入力 *data* が空の場合は :exc:`StatisticsError` を送出します。" #: ../../library/statistics.rst:472 msgid "" @@ -834,11 +928,12 @@ msgstr "" "``mode`` は離散データであることを想定していて、1つの値を返します。これは学校" "で教わるような最頻値の標準的な取扱いです:" -#: ../../library/statistics.rst:475 msgid "" ">>> mode([1, 1, 2, 3, 3, 3, 3, 4])\n" "3" msgstr "" +">>> mode([1, 1, 2, 3, 3, 3, 3, 4])\n" +"3" #: ../../library/statistics.rst:480 msgid "" @@ -846,14 +941,15 @@ msgid "" "also applies to nominal (non-numeric) data:" msgstr "" -#: ../../library/statistics.rst:483 msgid "" ">>> mode([\"red\", \"blue\", \"blue\", \"red\", \"green\", \"red\", " "\"red\"])\n" "'red'" msgstr "" +">>> mode([\"red\", \"blue\", \"blue\", \"red\", \"green\", \"red\", " +"\"red\"])\n" +"'red'" -#: ../../library/statistics.rst:488 msgid "" "Only hashable inputs are supported. To handle type :class:`set`, consider " "casting to :class:`frozenset`. To handle type :class:`list`, consider " @@ -861,27 +957,38 @@ msgid "" "slower quadratic algorithm that only depends on equality tests: ``max(data, " "key=data.count)``." msgstr "" +"入力にはハッシュ可能な値だけを使えます。\n" +":class:`set` 型を扱うには :class:`frozenset` への変換を検討してください。\n" +":class:`list` 型を扱うには :class:`tuple` への変換を検討してください。\n" +"型が混在する入力や入れ子の入力では、低速ですが等値比較だけを使う、計算量が二" +"次のアルゴリズム ``max(data, key=data.count)`` を検討してください。" -#: ../../library/statistics.rst:494 msgid "" "Now handles multimodal datasets by returning the first mode encountered. " "Formerly, it raised :exc:`StatisticsError` when more than one mode was found." msgstr "" +"最頻値が複数あるデータセットでも、最初に現れた最頻値を返すようになりまし" +"た。\n" +"以前は最頻値が複数見つかると :exc:`StatisticsError` を送出していました。" -#: ../../library/statistics.rst:502 msgid "" "Return a list of the most frequently occurring values in the order they were " "first encountered in the *data*. Will return more than one result if there " "are multiple modes or an empty list if the *data* is empty:" msgstr "" +"最も出現回数が多い値を、*data* に最初に現れた順序のリストで返します。\n" +"最頻値が複数あれば複数の結果を返し、*data* が空なら空のリストを返します。" -#: ../../library/statistics.rst:506 msgid "" ">>> multimode('aabbbbccddddeeffffgg')\n" "['b', 'd', 'f']\n" ">>> multimode('')\n" "[]" msgstr "" +">>> multimode('aabbbbccddddeeffffgg')\n" +"['b', 'd', 'f']\n" +">>> multimode('')\n" +"[]" #: ../../library/statistics.rst:518 msgid "" @@ -891,11 +998,12 @@ msgstr "" "母標準偏差 (母分散の平方根) を返します。引数や詳細は :func:`pvariance` を参照" "してください。" -#: ../../library/statistics.rst:521 msgid "" ">>> pstdev([1.5, 2.5, 2.5, 2.75, 3.25, 4.75])\n" "0.986893273527251" msgstr "" +">>> pstdev([1.5, 2.5, 2.5, 2.75, 3.25, 4.75])\n" +"0.986893273527251" #: ../../library/statistics.rst:529 msgid "" @@ -910,13 +1018,15 @@ msgstr "" "散が大きいデータはばらつきが大きく、分散が小さいデータは平均値のまわりに固" "まっています。" -#: ../../library/statistics.rst:535 msgid "" "If the optional second argument *mu* is given, it should be the *population* " "mean of the *data*. It can also be used to compute the second moment around " "a point that is not the mean. If it is missing or ``None`` (the default), " "the arithmetic mean is automatically calculated." msgstr "" +"省略可能な二つ目の引数 *mu* を指定する場合、*data* の *母平均* を渡します。\n" +"平均以外の点のまわりの二次モーメントを計算するためにも使えます。\n" +"省略するか ``None`` (デフォルト) にすると、算術平均を自動的に計算します。" #: ../../library/statistics.rst:540 msgid "" @@ -936,12 +1046,14 @@ msgstr "*data* が空の場合 :exc:`StatisticsError` を送出します。" msgid "Examples:" msgstr "例:" -#: ../../library/statistics.rst:548 msgid "" ">>> data = [0.0, 0.25, 0.25, 1.25, 1.5, 1.75, 2.75, 3.25]\n" ">>> pvariance(data)\n" "1.25" msgstr "" +">>> data = [0.0, 0.25, 0.25, 1.25, 1.5, 1.75, 2.75, 3.25]\n" +">>> pvariance(data)\n" +"1.25" #: ../../library/statistics.rst:554 msgid "" @@ -951,18 +1063,19 @@ msgstr "" "既にデータの平均値を計算している場合、それを第2引数 *mu* に渡して再計算を避け" "ることが出来ます:" -#: ../../library/statistics.rst:557 msgid "" ">>> mu = mean(data)\n" ">>> pvariance(data, mu)\n" "1.25" msgstr "" +">>> mu = mean(data)\n" +">>> pvariance(data, mu)\n" +"1.25" #: ../../library/statistics.rst:563 msgid "Decimals and Fractions are supported:" msgstr "Decimal と Fraction がサポートされています:" -#: ../../library/statistics.rst:565 msgid "" ">>> from decimal import Decimal as D\n" ">>> pvariance([D(\"27.5\"), D(\"30.25\"), D(\"30.25\"), D(\"34.5\"), " @@ -973,6 +1086,14 @@ msgid "" ">>> pvariance([F(1, 4), F(5, 4), F(1, 2)])\n" "Fraction(13, 72)" msgstr "" +">>> from decimal import Decimal as D\n" +">>> pvariance([D(\"27.5\"), D(\"30.25\"), D(\"30.25\"), D(\"34.5\"), " +"D(\"41.75\")])\n" +"Decimal('24.815')\n" +"\n" +">>> from fractions import Fraction as F\n" +">>> pvariance([F(1, 4), F(5, 4), F(1, 2)])\n" +"Fraction(13, 72)" #: ../../library/statistics.rst:577 msgid "" @@ -983,7 +1104,6 @@ msgstr "" "母集団全体で呼んだ場合は母分散 σ² を返します。代わりに標本で呼んだ場合は " "biased variance s²、すなわち自由度 N の分散を返します。" -#: ../../library/statistics.rst:581 msgid "" "If you somehow know the true population mean μ, you may use this function to " "calculate the variance of a sample, giving the known population mean as the " @@ -991,6 +1111,10 @@ msgid "" "population, the result will be an unbiased estimate of the population " "variance." msgstr "" +"何らかの方法で真の母平均 μ が分かっている場合、その母平均を二つ目の引数に渡す" +"と、この関数で標本の分散を計算できます。\n" +"データ点が母集団からの無作為標本であれば、結果は母分散の不偏推定量になりま" +"す。" #: ../../library/statistics.rst:590 msgid "" @@ -1000,11 +1124,12 @@ msgstr "" "標本標準偏差 (標本分散の平方根) を返します。引数や詳細は :func:`variance` を" "参照してください。" -#: ../../library/statistics.rst:593 msgid "" ">>> stdev([1.5, 2.5, 2.5, 2.75, 3.25, 4.75])\n" "1.0810874155219827" msgstr "" +">>> stdev([1.5, 2.5, 2.5, 2.75, 3.25, 4.75])\n" +"1.0810874155219827" #: ../../library/statistics.rst:601 msgid "" @@ -1019,12 +1144,14 @@ msgstr "" "いデータはばらつきが大きく、分散が小さいデータは平均値のまわりに固まっていま" "す。" -#: ../../library/statistics.rst:607 msgid "" "If the optional second argument *xbar* is given, it should be the *sample* " "mean of *data*. If it is missing or ``None`` (the default), the mean is " "automatically calculated." msgstr "" +"省略可能な二つ目の引数 *xbar* を指定する場合、*data* の *標本平均* を渡しま" +"す。\n" +"省略するか ``None`` (デフォルト) にすると、平均を自動的に計算します。" #: ../../library/statistics.rst:611 msgid "" @@ -1034,29 +1161,34 @@ msgstr "" "データが母集団の標本であるときに用いてください。母集団全体から分散を計算する" "には :func:`pvariance` を参照してください。" -#: ../../library/statistics.rst:614 msgid "Raises :exc:`StatisticsError` if *data* has fewer than two values." -msgstr "*data* の値が2より少ない場合 :exc:`StatisticsError` を送出します。" +msgstr "" +"*data* に含まれる値が 2 個未満の場合は :exc:`StatisticsError` を送出します。" -#: ../../library/statistics.rst:618 msgid "" ">>> data = [2.75, 1.75, 1.25, 0.25, 0.5, 1.25, 3.5]\n" ">>> variance(data)\n" "1.3720238095238095" msgstr "" +">>> data = [2.75, 1.75, 1.25, 0.25, 0.5, 1.25, 3.5]\n" +">>> variance(data)\n" +"1.3720238095238095" -#: ../../library/statistics.rst:624 msgid "" "If you have already calculated the sample mean of your data, you can pass it " "as the optional second argument *xbar* to avoid recalculation:" msgstr "" +"データの標本平均をすでに計算している場合は、省略可能な二つ目の引数 *xbar* に" +"渡して再計算を避けられます。" -#: ../../library/statistics.rst:627 msgid "" ">>> m = mean(data)\n" ">>> variance(data, m)\n" "1.3720238095238095" msgstr "" +">>> m = mean(data)\n" +">>> variance(data, m)\n" +"1.3720238095238095" #: ../../library/statistics.rst:633 msgid "" @@ -1071,7 +1203,6 @@ msgstr "" msgid "Decimal and Fraction values are supported:" msgstr "Decimal と Fraction がサポートされています:" -#: ../../library/statistics.rst:639 msgid "" ">>> from decimal import Decimal as D\n" ">>> variance([D(\"27.5\"), D(\"30.25\"), D(\"30.25\"), D(\"34.5\"), " @@ -1082,17 +1213,24 @@ msgid "" ">>> variance([F(1, 6), F(1, 2), F(5, 3)])\n" "Fraction(67, 108)" msgstr "" +">>> from decimal import Decimal as D\n" +">>> variance([D(\"27.5\"), D(\"30.25\"), D(\"30.25\"), D(\"34.5\"), " +"D(\"41.75\")])\n" +"Decimal('31.01875')\n" +"\n" +">>> from fractions import Fraction as F\n" +">>> variance([F(1, 6), F(1, 2), F(5, 3)])\n" +"Fraction(67, 108)" -#: ../../library/statistics.rst:651 msgid "" "This is the sample variance s² with Bessel's correction, also known as " "variance with N-1 degrees of freedom. Provided that the data points are " "representative (e.g. independent and identically distributed), the result " "should be an unbiased estimate of the true population variance." msgstr "" -"Bessel 補正済みの標本分散 s²、すなわち自由度 N-1 の分散です。与えられたデータ" -"点が代表的 (たとえば独立で均等に分布) な場合、戻り値は母分散の不偏推定量にな" -"ります。" +"Bessel 補正済みの標本分散 s²、すなわち自由度 N-1 の分散です。\n" +"データ点が母集団を代表している場合 (たとえば独立で同一の分布に従う場合)、戻り" +"値は真の母分散の不偏推定量となります。" #: ../../library/statistics.rst:656 msgid "" @@ -1103,42 +1241,52 @@ msgstr "" "何らかの方法で真の母平均 μ を知っている場合、それを :func:`pvariance` の引" "数 *mu* に渡して標本の分散を計算することが出来ます。" -#: ../../library/statistics.rst:662 msgid "" "Divide *data* into *n* continuous intervals with equal probability. Returns " "a list of ``n - 1`` cut points separating the intervals." msgstr "" +"*data* を等確率の *n* 個の連続する区間に分割します。\n" +"区間を区切る ``n - 1`` 個の分割点のリストを返します。" -#: ../../library/statistics.rst:665 msgid "" "Set *n* to 4 for quartiles (the default). Set *n* to 10 for deciles. Set " "*n* to 100 for percentiles which gives the 99 cuts points that separate " "*data* into 100 equal sized groups. Raises :exc:`StatisticsError` if *n* is " "not least 1." msgstr "" +"四分位数を求めるには *n* を 4 (デフォルト) に、十分位数には 10 に設定しま" +"す。\n" +"パーセンタイルを求めるには *n* を 100 にすると、*data* を同じ大きさの 100 個" +"のグループに分ける 99 個の分割点が得られます。\n" +"*n* が 1 以上でない場合は :exc:`StatisticsError` を送出します。" -#: ../../library/statistics.rst:670 msgid "" "The *data* can be any iterable containing sample data. For meaningful " "results, the number of data points in *data* should be larger than *n*. " "Raises :exc:`StatisticsError` if there is not at least one data point." msgstr "" +"*data* は標本データを含む任意のイテラブルにできます。\n" +"意味のある結果を得るには、*data* のデータ点の数が *n* より多いことが望まれま" +"す。\n" +"データ点が一つもなければ :exc:`StatisticsError` を送出します。" -#: ../../library/statistics.rst:674 msgid "" "The cut points are linearly interpolated from the two nearest data points. " "For example, if a cut point falls one-third of the distance between two " "sample values, ``100`` and ``112``, the cut-point will evaluate to ``104``." msgstr "" +"分割点は最も近い二つのデータ点から線形補間します。\n" +"例えば、標本値 ``100`` と ``112`` の間を 3 分の 1 進んだ位置に分割点がある場" +"合、その値は ``104`` になります。" -#: ../../library/statistics.rst:679 msgid "" "The *method* for computing quantiles can be varied depending on whether the " "*data* includes or excludes the lowest and highest possible values from the " "population." msgstr "" +"分位数の計算方法 *method* は、*data* が母集団の取り得る最小値と最大値を含むか" +"どうかに応じて変えられます。" -#: ../../library/statistics.rst:683 msgid "" "The default *method* is \"exclusive\" and is used for data sampled from a " "population that can have more extreme values than found in the samples. The " @@ -1147,8 +1295,13 @@ msgid "" "them and assigns the following percentiles: 10%, 20%, 30%, 40%, 50%, 60%, " "70%, 80%, 90%." msgstr "" +"デフォルトの *method* は \"exclusive\" で、標本に含まれる値よりも極端な値を取" +"り得る母集団から採取したデータに使います。\n" +"ソート済みの *m* 個のデータ点のうち *i 番目* の点より小さい値を取る母集団の割" +"合を、``i / (m + 1)`` で計算します。\n" +"標本値が九つの場合は、ソートして順に 10%、20%、30%、40%、50%、60%、70%、80%、" +"90% のパーセンタイルを割り当てます。" -#: ../../library/statistics.rst:690 msgid "" "Setting the *method* to \"inclusive\" is used for describing population data " "or for samples that are known to include the most extreme values from the " @@ -1159,8 +1312,15 @@ msgid "" "assigns the following percentiles: 0%, 10%, 20%, 30%, 40%, 50%, 60%, 70%, " "80%, 90%, 100%." msgstr "" +"*method* を \"inclusive\" に設定する方法は、母集団全体のデータを記述する場合" +"や、母集団の最も極端な値を含むと分かっている標本に使います。\n" +"*data* の最小値を 0 パーセンタイル、最大値を 100 パーセンタイルとして扱いま" +"す。\n" +"ソート済みの *m* 個のデータ点のうち *i 番目* の点より小さい値を取る母集団の割" +"合を、``(i - 1) / (m - 1)`` で計算します。\n" +"標本値が 11 個の場合は、ソートして順に 0%、10%、20%、30%、40%、50%、60%、" +"70%、80%、90%、100% のパーセンタイルを割り当てます。" -#: ../../library/statistics.rst:699 msgid "" "# Decile cut points for empirically sampled data\n" ">>> data = [105, 129, 87, 86, 111, 111, 89, 81, 108, 92, 110,\n" @@ -1171,13 +1331,23 @@ msgid "" ">>> [round(q, 1) for q in quantiles(data, n=10)]\n" "[81.0, 86.2, 89.0, 99.4, 102.5, 103.6, 106.0, 109.8, 111.0]" msgstr "" +"# 実測した標本データの十分位数による分割点\n" +">>> data = [105, 129, 87, 86, 111, 111, 89, 81, 108, 92, 110,\n" +"... 100, 75, 105, 103, 109, 76, 119, 99, 91, 103, 129,\n" +"... 106, 101, 84, 111, 74, 87, 86, 103, 103, 106, 86,\n" +"... 111, 75, 87, 102, 121, 111, 88, 89, 101, 106, 95,\n" +"... 103, 107, 101, 81, 109, 104]\n" +">>> [round(q, 1) for q in quantiles(data, n=10)]\n" +"[81.0, 86.2, 89.0, 99.4, 102.5, 103.6, 106.0, 109.8, 111.0]" -#: ../../library/statistics.rst:712 msgid "" "No longer raises an exception for an input with only a single data point. " "This allows quantile estimates to be built up one sample point at a time " "becoming gradually more refined with each new data point." msgstr "" +"入力のデータ点が一つだけの場合にも例外を送出しなくなりました。\n" +"これにより、標本点を一つずつ追加しながら分位数の推定値を求め、新しいデータ点" +"の追加ごとに精度を高められます。" #: ../../library/statistics.rst:719 msgid "" @@ -1185,13 +1355,13 @@ msgid "" "measure of the joint variability of two inputs." msgstr "" -#: ../../library/statistics.rst:722 msgid "" "Both inputs must be of the same length (no less than two), otherwise :exc:" "`StatisticsError` is raised." msgstr "" +"両方の入力は同じ長さ (2 以上) でなければならず、そうでなければ :exc:" +"`StatisticsError` を送出します。" -#: ../../library/statistics.rst:727 msgid "" ">>> x = [1, 2, 3, 4, 5, 6, 7, 8, 9]\n" ">>> y = [1, 2, 3, 1, 2, 3, 1, 2, 3]\n" @@ -1203,6 +1373,15 @@ msgid "" ">>> covariance(z, x)\n" "-7.5" msgstr "" +">>> x = [1, 2, 3, 4, 5, 6, 7, 8, 9]\n" +">>> y = [1, 2, 3, 1, 2, 3, 1, 2, 3]\n" +">>> covariance(x, y)\n" +"0.75\n" +">>> z = [9, 8, 7, 6, 5, 4, 3, 2, 1]\n" +">>> covariance(x, z)\n" +"-7.5\n" +">>> covariance(z, x)\n" +"-7.5" #: ../../library/statistics.rst:743 msgid "" @@ -1212,7 +1391,6 @@ msgid "" "direction of a linear relationship." msgstr "" -#: ../../library/statistics.rst:749 msgid "" "If *method* is \"ranked\", computes `Spearman's rank correlation coefficient " "`_ " @@ -1220,13 +1398,20 @@ msgid "" "equal values receive the same rank. The resulting coefficient measures the " "strength of a monotonic relationship." msgstr "" +"*method* が \"ranked\" の場合、二つの入力の `スピアマンの順位相関係数 " +"`_ " +"を計算します。\n" +"データを順位に置き換え、同じ値には順位の平均を割り当てることで同順位にしま" +"す。\n" +"得られる係数は単調な関係の強さを表します。" -#: ../../library/statistics.rst:755 msgid "" "Spearman's correlation coefficient is appropriate for ordinal data or for " "continuous data that doesn't meet the linear proportion requirement for " "Pearson's correlation coefficient." msgstr "" +"スピアマンの相関係数は、順序尺度データや、ピアソンの相関係数に必要な線形の関" +"係を満たさない連続データに適しています。" #: ../../library/statistics.rst:759 msgid "" @@ -1234,13 +1419,13 @@ msgid "" "be constant, otherwise :exc:`StatisticsError` is raised." msgstr "" -#: ../../library/statistics.rst:762 msgid "" "Example with `Kepler's laws of planetary motion `_:" msgstr "" +"`ケプラーの惑星運動の法則 `_ を使った例です。" -#: ../../library/statistics.rst:765 msgid "" ">>> # Mercury, Venus, Earth, Mars, Jupiter, Saturn, Uranus, and Neptune\n" ">>> orbital_period = [88, 225, 365, 687, 4331, 10_756, 30_687, 60_190] # " @@ -1264,12 +1449,29 @@ msgid "" ">>> round(correlation(period_squared, dist_cubed), 4)\n" "1.0" msgstr "" +">>> # 水星、金星、地球、火星、木星、土星、天王星、海王星\n" +">>> orbital_period = [88, 225, 365, 687, 4331, 10_756, 30_687, 60_190] # " +"日\n" +">>> dist_from_sun = [58, 108, 150, 228, 778, 1_400, 2_900, 4_500] # 百万 km\n" +"\n" +">>> # 完全な単調関係があることを示す\n" +">>> correlation(orbital_period, dist_from_sun, method='ranked')\n" +"1.0\n" +"\n" +">>> # 線形関係は完全ではないことを確認する\n" +">>> round(correlation(orbital_period, dist_from_sun), 4)\n" +"0.9882\n" +"\n" +">>> # ケプラーの第三法則を示す: 公転周期の二乗と\n" +">>> # 太陽からの距離の三乗の間には線形の相関がある。\n" +">>> period_squared = [p * p for p in orbital_period]\n" +">>> dist_cubed = [d * d * d for d in dist_from_sun]\n" +">>> round(correlation(period_squared, dist_cubed), 4)\n" +"1.0" -#: ../../library/statistics.rst:789 msgid "Added support for Spearman's rank correlation coefficient." -msgstr "" +msgstr "スピアマンの順位相関係数に対応しました。" -#: ../../library/statistics.rst:794 msgid "" "Return the slope and intercept of `simple linear regression `_ parameters estimated using " @@ -1277,18 +1479,22 @@ msgid "" "between an independent variable *x* and a dependent variable *y* in terms of " "this linear function:" msgstr "" +"通常の最小二乗法で推定した `単回帰 `_ のパラメーターである傾きと切片を返します。\n" +"単回帰は独立変数 *x* と従属変数 *y* の関係を次の一次関数で記述します。" -#: ../../library/statistics.rst:800 msgid "*y = slope \\* x + intercept + noise*" -msgstr "" +msgstr "*y = slope \\* x + intercept + noise*" -#: ../../library/statistics.rst:802 msgid "" "where ``slope`` and ``intercept`` are the regression parameters that are " "estimated, and ``noise`` represents the variability of the data that was not " "explained by the linear regression (it is equal to the difference between " "predicted and actual values of the dependent variable)." msgstr "" +"``slope`` と ``intercept`` は推定する回帰パラメーターで、``noise`` は線形回帰" +"で説明できなかったデータの変動を表します (従属変数の予測値と実測値の差に相当" +"します)。" #: ../../library/statistics.rst:808 msgid "" @@ -1297,15 +1503,16 @@ msgid "" "`StatisticsError` is raised." msgstr "" -#: ../../library/statistics.rst:812 msgid "" "For example, we can use the `release dates of the Monty Python films " "`_ to predict the " "cumulative number of Monty Python films that would have been produced by " "2019 assuming that they had kept the pace." msgstr "" +"例えば `モンティ・パイソンの映画の公開日 `_ を使うと、同じ制作ペースを維持していた場合に 2019 年ま" +"でに何本の映画が制作されていたかを予測できます。" -#: ../../library/statistics.rst:818 msgid "" ">>> year = [1971, 1975, 1979, 1982, 1983]\n" ">>> films_total = [1, 2, 3, 4, 5]\n" @@ -1313,27 +1520,35 @@ msgid "" ">>> round(slope * 2019 + intercept)\n" "16" msgstr "" +">>> year = [1971, 1975, 1979, 1982, 1983]\n" +">>> films_total = [1, 2, 3, 4, 5]\n" +">>> slope, intercept = linear_regression(year, films_total)\n" +">>> round(slope * 2019 + intercept)\n" +"16" -#: ../../library/statistics.rst:826 msgid "" "If *proportional* is true, the independent variable *x* and the dependent " "variable *y* are assumed to be directly proportional. The data is fit to a " "line passing through the origin. Since the *intercept* will always be 0.0, " "the underlying linear function simplifies to:" msgstr "" +"*proportional* が真の場合、独立変数 *x* と従属変数 *y* は正比例すると仮定しま" +"す。\n" +"データを原点を通る直線に当てはめます。\n" +"*intercept* は常に 0.0 になるため、基になる一次関数は次のように簡単になりま" +"す。" -#: ../../library/statistics.rst:832 msgid "*y = slope \\* x + noise*" -msgstr "" +msgstr "*y = slope \\* x + noise*" -#: ../../library/statistics.rst:834 msgid "" "Continuing the example from :func:`correlation`, we look to see how well a " "model based on major planets can predict the orbital distances for dwarf " "planets:" msgstr "" +":func:`correlation` の例に続けて、惑星に基づくモデルで準惑星の軌道距離をどの" +"程度予測できるかを調べます。" -#: ../../library/statistics.rst:838 msgid "" ">>> model = linear_regression(period_squared, dist_cubed, " "proportional=True)\n" @@ -1348,10 +1563,21 @@ msgid "" ">>> [5_906, 10_152, 6_796, 6_450, 414] # actual distance in million km\n" "[5906, 10152, 6796, 6450, 414]" msgstr "" +">>> model = linear_regression(period_squared, dist_cubed, " +"proportional=True)\n" +">>> slope = model.slope\n" +"\n" +">>> # 準惑星: 冥王星、エリス、マケマケ、ハウメア、ケレス\n" +">>> orbital_periods = [90_560, 204_199, 111_845, 103_410, 1_680] # 日\n" +">>> predicted_dist = [math.cbrt(slope * (p * p)) for p in orbital_periods]\n" +">>> list(map(round, predicted_dist))\n" +"[5912, 10166, 6806, 6459, 414]\n" +"\n" +">>> [5_906, 10_152, 6_796, 6_450, 414] # 実際の距離 (百万 km 単位)\n" +"[5906, 10152, 6796, 6450, 414]" -#: ../../library/statistics.rst:854 msgid "Added support for *proportional*." -msgstr "" +msgstr "*proportional* に対応しました。" #: ../../library/statistics.rst:858 msgid "Exceptions" @@ -1369,70 +1595,83 @@ msgstr "統計関係の例外。:exc:`ValueError` の派生クラス。" msgid ":class:`NormalDist` objects" msgstr ":class:`NormalDist` オブジェクト" -#: ../../library/statistics.rst:870 msgid "" ":class:`NormalDist` is a tool for creating and manipulating normal " "distributions of a `random variable `_. It is a class that treats the mean and " "standard deviation of data measurements as a single entity." msgstr "" +":class:`NormalDist` は `確率変数 `_ の正規分布を作成・操作するためのツールで" +"す。\n" +"測定データの平均と標準偏差を一つにまとめて扱うクラスです。" -#: ../../library/statistics.rst:876 msgid "" "Normal distributions arise from the `Central Limit Theorem `_ and have a wide range of " "applications in statistics." msgstr "" +"正規分布は `中心極限定理 `_ によって現れ、統計学で幅広く応用されています。" -#: ../../library/statistics.rst:882 msgid "" "Returns a new *NormalDist* object where *mu* represents the `arithmetic mean " "`_ and *sigma* represents the " "`standard deviation `_." msgstr "" +"新しい *NormalDist* オブジェクトを返します。\n" +"*mu* は `算術平均 `_、*sigma* " +"は `標準偏差 `_ を表しま" +"す。" #: ../../library/statistics.rst:887 msgid "If *sigma* is negative, raises :exc:`StatisticsError`." msgstr "*sigma* が負の数の場合 :exc:`StatisticsError` を送出します。" -#: ../../library/statistics.rst:891 msgid "" "A read-only property for the `arithmetic mean `_ of a normal distribution." msgstr "" +"正規分布の `算術平均 `_ を表す" +"読み取り専用プロパティです。" -#: ../../library/statistics.rst:897 msgid "" "A read-only property for the `median `_ of a normal distribution." msgstr "" +"正規分布の `中央値 `_ を表す読み取り専" +"用プロパティです。" -#: ../../library/statistics.rst:903 msgid "" "A read-only property for the `mode `_ of a normal distribution." msgstr "" +"正規分布の `最頻値 `_ を表す" +"読み取り専用プロパティです。" -#: ../../library/statistics.rst:909 msgid "" "A read-only property for the `standard deviation `_ of a normal distribution." msgstr "" +"正規分布の `標準偏差 `_ を" +"表す読み取り専用プロパティです。" -#: ../../library/statistics.rst:915 msgid "" "A read-only property for the `variance `_ of a normal distribution. Equal to the square of the standard " "deviation." msgstr "" +"正規分布の `分散 `_ を表す読み取り専" +"用プロパティです。\n" +"標準偏差の二乗に等しくなります。" -#: ../../library/statistics.rst:921 msgid "" "Makes a normal distribution instance with *mu* and *sigma* parameters " "estimated from the *data* using :func:`fmean` and :func:`stdev`." msgstr "" +":func:`fmean` と :func:`stdev` を使って *data* から *mu* と *sigma* を推定" +"し、正規分布のインスタンスを作成します。" -#: ../../library/statistics.rst:924 msgid "" "The *data* can be any :term:`iterable` and should consist of values that can " "be converted to type :class:`float`. If *data* does not contain at least " @@ -1440,51 +1679,67 @@ msgid "" "point to estimate a central value and at least two points to estimate " "dispersion." msgstr "" +"*data* は任意の :term:`iterable` にできますが、各値は :class:`float` 型に変換" +"できなければなりません。\n" +"中心の値の推定には少なくとも一点、散らばりの推定には少なくとも二点が必要なた" +"め、*data* に要素が二つ以上なければ :exc:`StatisticsError` を送出します。" -#: ../../library/statistics.rst:932 msgid "" "Generates *n* random samples for a given mean and standard deviation. " "Returns a :class:`list` of :class:`float` values." msgstr "" +"指定された平均と標準偏差を持つ分布から、*n* 個の無作為標本を生成します。\n" +":class:`float` 値の :class:`list` を返します。" -#: ../../library/statistics.rst:935 msgid "" "If *seed* is given, creates a new instance of the underlying random number " "generator. This is useful for creating reproducible results, even in a " "multi-threading context." msgstr "" +"*seed* を指定すると、内部で使う乱数生成器の新しいインスタンスを作成します。\n" +"マルチスレッド環境でも再現可能な結果を得るのに便利です。" -#: ../../library/statistics.rst:941 msgid "" "Switched to a faster algorithm. To reproduce samples from previous " "versions, use :func:`random.seed` and :func:`random.gauss`." msgstr "" +"より高速なアルゴリズムに切り替わりました。\n" +"以前のバージョンの標本を再現するには :func:`random.seed` と :func:`random." +"gauss` を使ってください。" -#: ../../library/statistics.rst:946 msgid "" "Using a `probability density function (pdf) `_, compute the relative likelihood that a " "random variable *X* will be near the given value *x*. Mathematically, it is " "the limit of the ratio ``P(x <= X < x+dx) / dx`` as *dx* approaches zero." msgstr "" +"`確率密度関数 (PDF) `_ を使い、確率変数 *X* が指定された値 *x* の近" +"くにある相対的な起こりやすさを計算します。\n" +"数学的には、*dx* をゼロに近づけたときの比 ``P(x <= X < x+dx) / dx`` の極限で" +"す。" -#: ../../library/statistics.rst:952 msgid "" "The relative likelihood is computed as the probability of a sample occurring " "in a narrow range divided by the width of the range (hence the word " "\"density\"). Since the likelihood is relative to other points, its value " "can be greater than ``1.0``." msgstr "" +"相対的な起こりやすさは、標本が狭い範囲内に現れる確率をその範囲の幅で割って計" +"算します (そのため「密度」と呼びます)。\n" +"他の点と比較した相対的な値なので、``1.0`` を超えることもあります。" -#: ../../library/statistics.rst:959 msgid "" "Using a `cumulative distribution function (cdf) `_, compute the probability that a " "random variable *X* will be less than or equal to *x*. Mathematically, it " "is written ``P(X <= x)``." msgstr "" +"`累積分布関数 (CDF) `_ を使い、確率変数 *X* が *x* 以下になる確" +"率を計算します。\n" +"数学的には ``P(X <= x)`` と書きます。" -#: ../../library/statistics.rst:966 msgid "" "Compute the inverse cumulative distribution function, also known as the " "`quantile function `_ or " @@ -1492,63 +1747,83 @@ msgid "" "statisticshowto.datasciencecentral.com/inverse-distribution-function/>`_ " "function. Mathematically, it is written ``x : P(X <= x) = p``." msgstr "" +"逆累積分布関数を計算します。\n" +"`分位点関数 `_ や `パーセン" +"ト点 `_ 関数とも呼ばれま" +"す。\n" +"数学的には ``x : P(X <= x) = p`` と書きます。" -#: ../../library/statistics.rst:972 msgid "" "Finds the value *x* of the random variable *X* such that the probability of " "the variable being less than or equal to that value equals the given " "probability *p*." msgstr "" +"確率変数 *X* がある値以下になる確率が、指定された確率 *p* に等しくなるような" +"値 *x* を求めます。" -#: ../../library/statistics.rst:978 msgid "" "Measures the agreement between two normal probability distributions. Returns " "a value between 0.0 and 1.0 giving `the overlapping area for the two " "probability density functions `_." msgstr "" +"二つの正規確率分布の一致の度合いを測ります。\n" +"`二つの確率密度関数の重なり部分の面積 `_ を表す、0.0 から 1.0 の値を返します。" -#: ../../library/statistics.rst:985 msgid "" "Divide the normal distribution into *n* continuous intervals with equal " "probability. Returns a list of (n - 1) cut points separating the intervals." msgstr "" +"正規分布を等確率の *n* 個の連続する区間に分割します。\n" +"区間を区切る (n - 1) 個の分割点のリストを返します。" -#: ../../library/statistics.rst:989 msgid "" "Set *n* to 4 for quartiles (the default). Set *n* to 10 for deciles. Set " "*n* to 100 for percentiles which gives the 99 cuts points that separate the " "normal distribution into 100 equal sized groups." msgstr "" +"四分位数を求めるには *n* を 4 (デフォルト) に、十分位数には 10 に設定しま" +"す。\n" +"パーセンタイルを求めるには *n* を 100 にすると、正規分布を同じ大きさの 100 個" +"のグループに分ける 99 個の分割点が得られます。" -#: ../../library/statistics.rst:995 msgid "" "Compute the `Standard Score `_ describing *x* in terms of the number of standard " "deviations above or below the mean of the normal distribution: ``(x - " "mean) / stdev``." msgstr "" +"*x* が正規分布の平均より標準偏差の何倍だけ上または下にあるかを表す `標準得点 " +"`_ を、" +"``(x - mean) / stdev`` で計算します。" -#: ../../library/statistics.rst:1003 msgid "" "Instances of :class:`NormalDist` support addition, subtraction, " "multiplication and division by a constant. These operations are used for " "translation and scaling. For example:" msgstr "" +":class:`NormalDist` のインスタンスは、定数との加算、減算、乗算、除算に対応し" +"ています。\n" +"これらの操作は平行移動と拡大縮小に使います。\n" +"例えば次のように使えます。" -#: ../../library/statistics.rst:1007 msgid "" ">>> temperature_february = NormalDist(5, 2.5) # Celsius\n" ">>> temperature_february * (9/5) + 32 # Fahrenheit\n" "NormalDist(mu=41.0, sigma=4.5)" msgstr "" +">>> temperature_february = NormalDist(5, 2.5) # 摂氏\n" +">>> temperature_february * (9/5) + 32 # 華氏\n" +"NormalDist(mu=41.0, sigma=4.5)" -#: ../../library/statistics.rst:1013 msgid "" "Dividing a constant by an instance of :class:`NormalDist` is not supported " "because the result wouldn't be normally distributed." msgstr "" +"定数を :class:`NormalDist` のインスタンスで割ることはできません。\n" +"結果が正規分布にならないためです。" -#: ../../library/statistics.rst:1016 msgid "" "Since normal distributions arise from additive effects of independent " "variables, it is possible to `add and subtract two independent normally " @@ -1556,8 +1831,12 @@ msgid "" "Sum_of_normally_distributed_random_variables>`_ represented as instances of :" "class:`NormalDist`. For example:" msgstr "" +"独立した変数の加法的な効果から正規分布が生じるため、:class:`NormalDist` のイ" +"ンスタンスとして表された `独立な二つの正規確率変数を加算・減算できます " +"`_。\n" +"例えば次のように使えます。" -#: ../../library/statistics.rst:1022 msgid "" ">>> birth_weights = NormalDist.from_samples([2.5, 3.1, 2.1, 2.4, 2.7, 3.5])\n" ">>> drug_effects = NormalDist(0.4, 0.15)\n" @@ -1567,20 +1846,24 @@ msgid "" ">>> round(combined.stdev, 1)\n" "0.5" msgstr "" +">>> birth_weights = NormalDist.from_samples([2.5, 3.1, 2.1, 2.4, 2.7, 3.5])\n" +">>> drug_effects = NormalDist(0.4, 0.15)\n" +">>> combined = birth_weights + drug_effects\n" +">>> round(combined.mean, 1)\n" +"3.1\n" +">>> round(combined.stdev, 1)\n" +"0.5" #: ../../library/statistics.rst:1036 msgid "Examples and Recipes" msgstr "例とレシピ" -#: ../../library/statistics.rst:1040 msgid "Classic probability problems" -msgstr "" +msgstr "典型的な確率の問題" -#: ../../library/statistics.rst:1042 msgid ":class:`NormalDist` readily solves classic probability problems." -msgstr "" +msgstr ":class:`NormalDist` を使うと、典型的な確率の問題を簡単に解けます。" -#: ../../library/statistics.rst:1044 msgid "" "For example, given `historical data for SAT exams `_ showing that scores are " @@ -1588,41 +1871,53 @@ msgid "" "determine the percentage of students with test scores between 1100 and 1200, " "after rounding to the nearest whole number:" msgstr "" +"例えば `SAT 試験の過去のデータ `_ によれば、得点は平均 1060、標準偏差 195 の正規分布" +"に従います。\n" +"得点を最も近い整数に丸めたときに、1100 点から 1200 点の間に入る生徒の割合を求" +"めます。" -#: ../../library/statistics.rst:1050 msgid "" ">>> sat = NormalDist(1060, 195)\n" ">>> fraction = sat.cdf(1200 + 0.5) - sat.cdf(1100 - 0.5)\n" ">>> round(fraction * 100.0, 1)\n" "18.4" msgstr "" +">>> sat = NormalDist(1060, 195)\n" +">>> fraction = sat.cdf(1200 + 0.5) - sat.cdf(1100 - 0.5)\n" +">>> round(fraction * 100.0, 1)\n" +"18.4" -#: ../../library/statistics.rst:1057 msgid "" "Find the `quartiles `_ and `deciles " "`_ for the SAT scores:" msgstr "" +"SAT の得点の `四分位数 `_ と `十分位" +"数 `_ を求めます。" -#: ../../library/statistics.rst:1060 msgid "" ">>> list(map(round, sat.quantiles()))\n" "[928, 1060, 1192]\n" ">>> list(map(round, sat.quantiles(n=10)))\n" "[810, 896, 958, 1011, 1060, 1109, 1162, 1224, 1310]" msgstr "" +">>> list(map(round, sat.quantiles()))\n" +"[928, 1060, 1192]\n" +">>> list(map(round, sat.quantiles(n=10)))\n" +"[810, 896, 958, 1011, 1060, 1109, 1162, 1224, 1310]" -#: ../../library/statistics.rst:1069 msgid "Monte Carlo inputs for simulations" -msgstr "" +msgstr "シミュレーション用のモンテカルロ入力" -#: ../../library/statistics.rst:1071 msgid "" "To estimate the distribution for a model that isn't easy to solve " "analytically, :class:`NormalDist` can generate input samples for a `Monte " "Carlo simulation `_:" msgstr "" +"解析的に解くのが難しいモデルの分布を推定するために、:class:`NormalDist` で `" +"モンテカルロシミュレーション `_ の入力標本を生成できます。" -#: ../../library/statistics.rst:1075 msgid "" ">>> def model(x, y, z):\n" "... return (3*x + 7*x*y - 5*y) / (11 * z)\n" @@ -1634,19 +1929,27 @@ msgid "" ">>> quantiles(map(model, X, Y, Z))\n" "[1.4591308524824727, 1.8035946855390597, 2.175091447274739]" msgstr "" +">>> def model(x, y, z):\n" +"... return (3*x + 7*x*y - 5*y) / (11 * z)\n" +"...\n" +">>> n = 100_000\n" +">>> X = NormalDist(10, 2.5).samples(n, seed=3652260728)\n" +">>> Y = NormalDist(15, 1.75).samples(n, seed=4582495471)\n" +">>> Z = NormalDist(50, 1.25).samples(n, seed=6582483453)\n" +">>> quantiles(map(model, X, Y, Z))\n" +"[1.4591308524824727, 1.8035946855390597, 2.175091447274739]" -#: ../../library/statistics.rst:1088 msgid "Approximating binomial distributions" -msgstr "" +msgstr "二項分布の近似" -#: ../../library/statistics.rst:1090 msgid "" "Normal distributions can be used to approximate `Binomial distributions " "`_ when the sample " "size is large and when the probability of a successful trial is near 50%." msgstr "" +"標本サイズが大きく、試行の成功確率が 50% に近い場合は、正規分布で `二項分布 " +"`_ を近似できます。" -#: ../../library/statistics.rst:1095 msgid "" "For example, an open source conference has 750 attendees and two rooms with " "a 500 person capacity. There is a talk about Python and another about Ruby. " @@ -1654,8 +1957,13 @@ msgid "" "talks. Assuming the population preferences haven't changed, what is the " "probability that the Python room will stay within its capacity limits?" msgstr "" +"例えば、あるオープンソースカンファレンスには参加者が 750 人いて、定員 500 人" +"の部屋が二つあるとします。\n" +"一方の部屋では Python の講演、他方では Ruby の講演を行います。\n" +"過去のカンファレンスでは参加者の 65% が Python の講演を選びました。\n" +"参加者の好みが変わっていないとすると、Python の部屋が定員を超えない確率はいく" +"らでしょうか。" -#: ../../library/statistics.rst:1101 msgid "" ">>> n = 750 # Sample size\n" ">>> p = 0.65 # Preference for Python\n" @@ -1678,31 +1986,52 @@ msgid "" ">>> mean(binomialvariate(n, p) <= k for i in range(10_000))\n" "0.8406" msgstr "" +">>> n = 750 # 標本サイズ\n" +">>> p = 0.65 # Python を選ぶ割合\n" +">>> q = 1.0 - p # Ruby を選ぶ割合\n" +">>> k = 500 # 部屋の定員\n" +"\n" +">>> # 正規分布の累積分布関数による近似\n" +">>> from math import sqrt\n" +">>> round(NormalDist(mu=n*p, sigma=sqrt(n*p*q)).cdf(k + 0.5), 4)\n" +"0.8402\n" +"\n" +">>> # 二項分布の累積分布関数による厳密解\n" +">>> from math import comb, fsum\n" +">>> round(fsum(comb(n, r) * p**r * q**(n-r) for r in range(k+1)), 4)\n" +"0.8402\n" +"\n" +">>> # シミュレーションによる近似\n" +">>> from random import seed, binomialvariate\n" +">>> seed(8675309)\n" +">>> mean(binomialvariate(n, p) <= k for i in range(10_000))\n" +"0.8406" -#: ../../library/statistics.rst:1126 msgid "Naive bayesian classifier" -msgstr "" +msgstr "ナイーブベイズ分類器" -#: ../../library/statistics.rst:1128 msgid "Normal distributions commonly arise in machine learning problems." -msgstr "" +msgstr "機械学習の問題には正規分布がよく現れます。" -#: ../../library/statistics.rst:1130 msgid "" "Wikipedia has a `nice example of a Naive Bayesian Classifier `_. The " "challenge is to predict a person's gender from measurements of normally " "distributed features including height, weight, and foot size." msgstr "" +"Wikipedia に `ナイーブベイズ分類器の分かりやすい例 `_ があります。\n" +"身長、体重、足のサイズなど、正規分布に従う特徴の測定値からその人の性別を予測" +"する問題です。" -#: ../../library/statistics.rst:1135 msgid "" "We're given a training dataset with measurements for eight people. The " "measurements are assumed to be normally distributed, so we summarize the " "data with :class:`NormalDist`:" msgstr "" +"8 人分の測定値を持つ訓練データセットが与えられています。\n" +"測定値は正規分布に従うと仮定して、:class:`NormalDist` でデータをまとめます。" -#: ../../library/statistics.rst:1139 msgid "" ">>> height_male = NormalDist.from_samples([6, 5.92, 5.58, 5.92])\n" ">>> height_female = NormalDist.from_samples([5, 5.5, 5.42, 5.75])\n" @@ -1711,19 +2040,27 @@ msgid "" ">>> foot_size_male = NormalDist.from_samples([12, 11, 12, 10])\n" ">>> foot_size_female = NormalDist.from_samples([6, 8, 7, 9])" msgstr "" +">>> height_male = NormalDist.from_samples([6, 5.92, 5.58, 5.92])\n" +">>> height_female = NormalDist.from_samples([5, 5.5, 5.42, 5.75])\n" +">>> weight_male = NormalDist.from_samples([180, 190, 170, 165])\n" +">>> weight_female = NormalDist.from_samples([100, 150, 130, 150])\n" +">>> foot_size_male = NormalDist.from_samples([12, 11, 12, 10])\n" +">>> foot_size_female = NormalDist.from_samples([6, 8, 7, 9])" -#: ../../library/statistics.rst:1148 msgid "" "Next, we encounter a new person whose feature measurements are known but " "whose gender is unknown:" msgstr "" +"次に、特徴の測定値は分かっているものの、性別が不明な新しい人を考えます。" -#: ../../library/statistics.rst:1151 msgid "" ">>> ht = 6.0 # height\n" ">>> wt = 130 # weight\n" ">>> fs = 8 # foot size" msgstr "" +">>> ht = 6.0 # 身長\n" +">>> wt = 130 # 体重\n" +">>> fs = 8 # 足のサイズ" #: ../../library/statistics.rst:1157 msgid "" @@ -1733,7 +2070,6 @@ msgid "" "given the gender:" msgstr "" -#: ../../library/statistics.rst:1162 msgid "" ">>> prior_male = 0.5\n" ">>> prior_female = 0.5\n" @@ -1743,16 +2079,26 @@ msgid "" ">>> posterior_female = (prior_female * height_female.pdf(ht) *\n" "... weight_female.pdf(wt) * foot_size_female.pdf(fs))" msgstr "" +">>> prior_male = 0.5\n" +">>> prior_female = 0.5\n" +">>> posterior_male = (prior_male * height_male.pdf(ht) *\n" +"... weight_male.pdf(wt) * foot_size_male.pdf(fs))\n" +"\n" +">>> posterior_female = (prior_female * height_female.pdf(ht) *\n" +"... weight_female.pdf(wt) * foot_size_female.pdf(fs))" -#: ../../library/statistics.rst:1172 msgid "" "The final prediction goes to the largest posterior. This is known as the " "`maximum a posteriori `_ or MAP:" msgstr "" +"最終的には事後確率が最大になる方を予測結果とします。\n" +"これは `最大事後確率 `_、または MAP と呼ばれます。" -#: ../../library/statistics.rst:1176 msgid "" ">>> 'male' if posterior_male > posterior_female else 'female'\n" "'female'" msgstr "" +">>> 'male' if posterior_male > posterior_female else 'female'\n" +"'female'" diff --git a/library/stdtypes.po b/library/stdtypes.po index 6b29317fb..f13eaf129 100644 --- a/library/stdtypes.po +++ b/library/stdtypes.po @@ -30,10 +30,10 @@ msgstr "" "Last-Translator: tomo, 2025\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/stdtypes.rst:8 @@ -66,7 +66,6 @@ msgstr "" "インプレースに足し、引き、または並べ替えて、特定の要素を返さないメソッドは、" "コレクション自身ではなく ``None`` を返します。" -#: ../../library/stdtypes.rst:22 msgid "" "Some operations are supported by several object types; in particular, " "practically all objects can be compared for equality, tested for truth " @@ -74,10 +73,12 @@ msgid "" "slightly different :func:`str` function). The latter function is implicitly " "used when an object is written by the :func:`print` function." msgstr "" -"演算には、複数の型でサポートされているものがあります; 特に、ほぼ全てのオブ" -"ジェクトは、等価比較でき、真理値を判定でき、 (:func:`repr` 関数や、わずかに異" -"なる :func:`str` 関数によって) 文字列に変換できます。オブジェクトが :func:" -"`print` 関数で印字されるとき、文字列に変換する関数が暗黙に使われます。" +"いくつかの演算は、複数のオブジェクト型でサポートされています。\n" +"特に、ほぼすべてのオブジェクトでは、等価性の比較、真理値の判定、文字列への変" +"換ができます (文字列への変換には :func:`repr` 関数や、それとは少し異なる :" +"func:`str` 関数を使います)。\n" +":func:`print` 関数でオブジェクトを出力する際には、後者の関数が暗黙的に使われ" +"ます。" #: ../../library/stdtypes.rst:32 msgid "Truth Value Testing" @@ -452,17 +453,19 @@ msgid "" "usual mathematical formula, for example::" msgstr "" -#: ../../library/stdtypes.rst:272 msgid "" "x + complex(u, v) = complex(x + u, v)\n" "x * complex(u, v) = complex(x * u, x * v)" msgstr "" +"x + complex(u, v) = complex(x + u, v)\n" +"x * complex(u, v) = complex(x * u, x * v)" -#: ../../library/stdtypes.rst:275 msgid "" "A comparison between numbers of different types behaves as though the exact " "values of those numbers were being compared. [2]_" msgstr "" +"異なる型の数値を比較すると、それぞれの数値の正確な値を比較した場合と同じ結果" +"になります。[2]_" #: ../../library/stdtypes.rst:278 msgid "" @@ -775,15 +778,14 @@ msgstr "" msgid "Bitwise Operations on Integer Types" msgstr "整数型におけるビット単位演算" -#: ../../library/stdtypes.rst:411 msgid "" "Bitwise operations only make sense for integers. The result of bitwise " "operations is calculated as though carried out in two's complement with an " "infinite number of sign bits." msgstr "" -"ビット単位演算は整数についてのみ意味を持ちます。\n" -"ビット単位演算の結果は、あたかも両方の値の先頭を無限個の符号ビットで埋めたも" -"のに対して計算したかのような値になります。" +"ビット単位演算は、整数についてのみ意味を持ちます。\n" +"その結果は、符号ビットを無限個持つ2の補数表現で演算した場合と同じになるよう計" +"算されます。" #: ../../library/stdtypes.rst:415 msgid "" @@ -878,17 +880,16 @@ msgid "" "A right shift by *n* bits is equivalent to floor division by ``pow(2, n)``." msgstr "*n* ビットの右シフトは、 ``pow(2, n)`` による切り捨て除算と等価です。" -#: ../../library/stdtypes.rst:452 msgid "" "Performing these calculations with at least one extra sign extension bit in " "a finite two's complement representation (a working bit-width of ``1 + max(x." "bit_length(), y.bit_length())`` or more) is sufficient to get the same " "result as if there were an infinite number of sign bits." msgstr "" -"桁の長い方の値に少なくとも 1 つ余計に符号ビットを付け加えた幅 (計算するビット" -"幅は ``1 + max(x.bit_length(), y.bit_length())`` かそれ以上) でこれらの計算を" -"行えば、無限個の符号ビットがあるかのように計算したのと同じ結果を得るのに十分" -"です。" +"有限ビット幅の2の補数表現に、少なくとも1ビットの符号拡張ビットを追加してこれ" +"らの計算を行えば、符号ビットを無限個使う場合と同じ結果が得られます。\n" +"計算に使うビット幅は ``1 + max(x.bit_length(), y.bit_length())`` 以上で十分で" +"す。" #: ../../library/stdtypes.rst:459 msgid "Additional Methods on Integer Types" @@ -909,7 +910,6 @@ msgid "" msgstr "" "整数を、符号と先頭の 0 は除いて二進法で表すために必要なビットの数を返します::" -#: ../../library/stdtypes.rst:469 msgid "" ">>> n = -37\n" ">>> bin(n)\n" @@ -917,6 +917,11 @@ msgid "" ">>> n.bit_length()\n" "6" msgstr "" +">>> n = -37\n" +">>> bin(n)\n" +"'-0b100101'\n" +">>> n.bit_length()\n" +"6" #: ../../library/stdtypes.rst:475 msgid "" @@ -936,13 +941,16 @@ msgstr "" msgid "Equivalent to::" msgstr "次と等価です::" -#: ../../library/stdtypes.rst:483 msgid "" "def bit_length(self):\n" " s = bin(self) # binary representation: bin(-37) --> '-0b100101'\n" " s = s.lstrip('-0b') # remove leading zeros and minus sign\n" " return len(s) # len('100101') --> 6" msgstr "" +"def bit_length(self):\n" +" s = bin(self) # 2進表現: bin(-37) --> '-0b100101'\n" +" s = s.lstrip('-0b') # 先頭のゼロと負符号を除去する\n" +" return len(s) # len('100101') --> 6" #: ../../library/stdtypes.rst:492 msgid "" @@ -952,7 +960,6 @@ msgstr "" "整数の絶対値の二進数表現における 1 の数を返します。これは population count と" "しても知られています。 例::" -#: ../../library/stdtypes.rst:496 msgid "" ">>> n = 19\n" ">>> bin(n)\n" @@ -962,12 +969,20 @@ msgid "" ">>> (-n).bit_count()\n" "3" msgstr "" +">>> n = 19\n" +">>> bin(n)\n" +"'0b10011'\n" +">>> n.bit_count()\n" +"3\n" +">>> (-n).bit_count()\n" +"3" -#: ../../library/stdtypes.rst:506 msgid "" "def bit_count(self):\n" " return bin(self).count(\"1\")" msgstr "" +"def bit_count(self):\n" +" return bin(self).count(\"1\")" #: ../../library/stdtypes.rst:513 msgid "Return an array of bytes representing an integer." @@ -1013,11 +1028,12 @@ msgstr "" "上記のデフォルト値は整数を 1 バイトのオブジェクトに適切に変換するのに使うこと" "ができます::" -#: ../../library/stdtypes.rst:543 msgid "" ">>> (65).to_bytes()\n" "b'A'" msgstr "" +">>> (65).to_bytes()\n" +"b'A'" #: ../../library/stdtypes.rst:546 msgid "" @@ -1048,13 +1064,12 @@ msgstr "``length`` と ``byteorder`` 引数にデフォルト値を追加しま msgid "Return the integer represented by the given array of bytes." msgstr "与えられたバイト列の整数表現を返します。" -#: ../../library/stdtypes.rst:580 msgid "" "The argument *bytes* must either be a :term:`bytes-like object` or an " "iterable producing bytes." msgstr "" -"引数 *bytes* は :term:`bytes-like object` か、または bytes を生成する " -"iterable でなければなりません。" +"引数 ``bytes`` は :term:`bytes-like object` か、バイト値を生成するイテラブル" +"でなければなりません。" #: ../../library/stdtypes.rst:583 msgid "" @@ -1132,7 +1147,7 @@ msgstr "" #: ../../library/stdtypes.rst:636 msgid "" "Class method to return a floating-point number constructed from a number *x*." -msgstr "" +msgstr "数 *x* から生成された浮動小数点数を返すクラスメソッドです。" #: ../../library/stdtypes.rst:638 msgid "" @@ -1141,13 +1156,18 @@ msgid "" "returned. If the argument is outside the range of a Python float, an :exc:" "`OverflowError` will be raised." msgstr "" +"引数が整数または浮動小数点数の場合、(Python の浮動小数点数の精度で) 同じ値の" +"浮動小数点数が返されます。 引数が Python の浮動小数点数の範囲外なら、 :exc:" +"`OverflowError` が送出されます。" -#: ../../library/stdtypes.rst:643 msgid "" "For a general Python object ``x``, ``float.from_number(x)`` delegates to ``x." "__float__()``. If :meth:`~object.__float__` is not defined then it falls " "back to :meth:`~object.__index__`." msgstr "" +"一般の Python オブジェクト ``x`` に対して、``float.from_number(x)`` は ``x." +"__float__()`` に委譲します。 :meth:`~object.__float__` が定義されていない場" +"合、:meth:`~object.__index__` へフォールバックします。" #: ../../library/stdtypes.rst:653 msgid "" @@ -1167,15 +1187,17 @@ msgstr "" "浮動小数点数インスタンスが有限の整数値なら ``True`` を、そうでなければ " "``False`` を返します::" -#: ../../library/stdtypes.rst:663 msgid "" ">>> (-2.0).is_integer()\n" "True\n" ">>> (3.2).is_integer()\n" "False" msgstr "" +">>> (-2.0).is_integer()\n" +"True\n" +">>> (3.2).is_integer()\n" +"False" -#: ../../library/stdtypes.rst:668 msgid "" "Two methods support conversion to and from hexadecimal strings. Since " "Python's floats are stored internally as binary numbers, converting a float " @@ -1184,11 +1206,11 @@ msgid "" "of floating-point numbers. This can be useful when debugging, and in " "numerical work." msgstr "" -"16 進表記の文字列へ、または、 16 進表記からの変換をサポートする二つのメソッド" -"があります。 Python の浮動小数点数は内部的には2進数で保持されるので、浮動小数" -"点数の *10進数* へまたは *10進数* からの変換には若干の丸め誤差があります。そ" -"れに対し、16 進表記では、浮動小数点数を正確に表現できます。これはデバッグのと" -"きや、数学的な用途 (numerical work) に便利でしょう。" +"16進文字列との相互変換をサポートするメソッドが二つあります。\n" +"Python の浮動小数点数は内部では2進数として格納されるため、浮動小数点数と *10" +"進文字列* との相互変換では通常、小さな丸め誤差が生じます。\n" +"一方、16進文字列では浮動小数点数を正確に表現したり指定したりできます。\n" +"これはデバッグや数値計算に役立つことがあります。" #: ../../library/stdtypes.rst:679 msgid "" @@ -1221,7 +1243,7 @@ msgstr "16 進文字列表現は以下の書式となります::" #: ../../library/stdtypes.rst:697 msgid "[sign] ['0x'] integer ['.' fraction] ['p' exponent]" -msgstr "" +msgstr "[sign] ['0x'] integer ['.' fraction] ['p' exponent]" #: ../../library/stdtypes.rst:699 msgid "" @@ -1256,11 +1278,12 @@ msgstr "" "えます。例えば、16 進文字列 ``0x3.a7p10`` は浮動小数点数 ``(3 + 10./16 + " "7./16**2) * 2.0**10`` すなわち ``3740.0`` を表します::" -#: ../../library/stdtypes.rst:718 msgid "" ">>> float.fromhex('0x3.a7p10')\n" "3740.0" msgstr "" +">>> float.fromhex('0x3.a7p10')\n" +"3740.0" #: ../../library/stdtypes.rst:722 msgid "" @@ -1270,15 +1293,16 @@ msgstr "" "逆変換を ``3740.0`` に適用すると、同じ数を表す異なる 16 進文字列表現を返しま" "す::" -#: ../../library/stdtypes.rst:725 msgid "" ">>> float.hex(3740.0)\n" "'0x1.d380000000000p+11'" msgstr "" +">>> float.hex(3740.0)\n" +"'0x1.d380000000000p+11'" #: ../../library/stdtypes.rst:730 msgid "Additional Methods on Complex" -msgstr "" +msgstr "複素数に対する追加のメソッド" #: ../../library/stdtypes.rst:732 msgid "" @@ -1286,10 +1310,13 @@ msgid "" "`abstract base class`. :class:`!complex` also has the following additional " "methods." msgstr "" +":class:`!complex` 型は、 :class:`numbers.Complex` :term:`抽象基底クラス " +"` を実装しています。:class:`!complex` 型はまた、以下の追" +"加のメソッドを持ちます。" #: ../../library/stdtypes.rst:738 msgid "Class method to convert a number to a complex number." -msgstr "" +msgstr "数値を複素数に変換するクラスメソッドです。" #: ../../library/stdtypes.rst:740 msgid "" @@ -1298,6 +1325,11 @@ msgid "" "falls back to :meth:`~object.__float__`. If :meth:`!__float__` is not " "defined then it falls back to :meth:`~object.__index__`." msgstr "" +"一般的な Python オブジェクト ``x`` に対して、 ``complex.from_number(x)`` は " +"``x.__complex__()`` に処理を委譲します。 :meth:`~object.__complex__` が定義さ" +"れていない場合は :meth:`~object.__float__` にフォールバックします。 :meth:`!" +"__float__` も定義されていない場合は :meth:`~object.__index__` にフォールバッ" +"クします。" #: ../../library/stdtypes.rst:751 msgid "Hashing of numeric types" @@ -1394,17 +1426,15 @@ msgstr "" "``range(-2**(sys.hash_info.width - 1), 2**(sys.hash_info.width - 1))`` に収ま" "ります。再び、結果が ``-1`` なら、 ``-2`` で置き換えられます。" -#: ../../library/stdtypes.rst:798 msgid "" "To clarify the above rules, here's some example Python code, equivalent to " "the built-in hash, for computing the hash of a rational number, :class:" "`float`, or :class:`complex`::" msgstr "" -"上述の規則をわかりやすくするため、有理数 :class:`float` や、 :class:" -"`complex` のハッシュを計算する組み込みのハッシュと等価な Python コードの例を" -"挙げます::" +"上の規則を明確にするため、有理数、:class:`float`、:class:`complex` のハッシュ" +"を計算する Python コードの例を示します。\n" +"このコードは組み込みのハッシュ計算と等価です::" -#: ../../library/stdtypes.rst:803 msgid "" "import sys, math\n" "\n" @@ -1455,6 +1485,53 @@ msgid "" " hash_value = -2\n" " return hash_value" msgstr "" +"import sys, math\n" +"\n" +"def hash_fraction(m, n):\n" +" \"\"\"有理数 m / n のハッシュを計算する。\n" +"\n" +" m と n は整数で、n は正と仮定する。\n" +" hash(fractions.Fraction(m, n)) と等価。\n" +"\n" +" \"\"\"\n" +" P = sys.hash_info.modulus\n" +" # P の共通因子を除く (m と n がすでに互いに素なら不要)。\n" +" while m % P == n % P == 0:\n" +" m, n = m // P, n // P\n" +"\n" +" if n % P == 0:\n" +" hash_value = sys.hash_info.inf\n" +" else:\n" +" # フェルマーの小定理により pow(n, P-1, P) は1なので、\n" +" # pow(n, P-2, P) は P を法とする n の逆数を与える。\n" +" hash_value = (abs(m) % P) * pow(n, P - 2, P) % P\n" +" if m < 0:\n" +" hash_value = -hash_value\n" +" if hash_value == -1:\n" +" hash_value = -2\n" +" return hash_value\n" +"\n" +"def hash_float(x):\n" +" \"\"\"浮動小数点数 x のハッシュを計算する。\"\"\"\n" +"\n" +" if math.isnan(x):\n" +" return object.__hash__(x)\n" +" elif math.isinf(x):\n" +" return sys.hash_info.inf if x > 0 else -sys.hash_info.inf\n" +" else:\n" +" return hash_fraction(*x.as_integer_ratio())\n" +"\n" +"def hash_complex(z):\n" +" \"\"\"複素数 z のハッシュを計算する。\"\"\"\n" +"\n" +" hash_value = hash_float(z.real) + sys.hash_info.imag * hash_float(z." +"imag)\n" +" # 2**sys.hash_info.width を法として、符号付きの剰余に還元する\n" +" M = 2**(sys.hash_info.width - 1)\n" +" hash_value = (hash_value & (M - 1)) - (hash_value & M)\n" +" if hash_value == -1:\n" +" hash_value = -2\n" +" return hash_value" #: ../../library/stdtypes.rst:854 msgid "Boolean Type - :class:`bool`" @@ -1490,11 +1567,12 @@ msgstr "" "ブール値を返します。しかしながら、論理演算子 ``and``, ``or`` および ``!=`` を" "使うほうが ``&``, ``|`` や ``^`` を使うよりも好ましいです。" -#: ../../library/stdtypes.rst:876 msgid "" "The use of the bitwise inversion operator ``~`` is deprecated and will raise " "an error in Python 3.16." msgstr "" +"ビット反転演算子 ``~`` の使用は非推奨となり、Python 3.16 ではエラーが送出され" +"るようになります。" #: ../../library/stdtypes.rst:879 msgid "" @@ -1620,6 +1698,13 @@ msgid "" "generators can be found in :ref:`the documentation for the yield expression " "`." msgstr "" +"Python における :term:`generator` (ジェネレータ) は、イテレータプロトコルを実" +"装する便利な方法を提供します。コンテナオブジェクトの :meth:`~object." +"__iter__` メソッドがジェネレータとして実装されていれば、そのメソッドは :meth:" +"`~iterator.__iter__` および :meth:`~generator.__next__` メソッドを提供するイ" +"テレータオブジェクト (厳密にはジェネレータオブジェクト) を自動的に返します。" +"ジェネレータに関する詳細な情報は、 :ref:`yield 式のドキュメント ` " +"にあります。" #: ../../library/stdtypes.rst:963 msgid "Sequence Types --- :class:`list`, :class:`tuple`, :class:`range`" @@ -1640,17 +1725,16 @@ msgstr "" msgid "Common Sequence Operations" msgstr "共通のシーケンス演算" -#: ../../library/stdtypes.rst:978 msgid "" "The operations in the following table are supported by most sequence types, " "both mutable and immutable. The :class:`collections.abc.Sequence` ABC is " "provided to make it easier to correctly implement these operations on custom " "sequence types." msgstr "" -"以下の表にある演算は、ほとんどのミュータブル、イミュータブル両方のシーケンス" -"でサポートされています。カスタムのシーケンス型にこれらの演算を完全に実装する" -"のが簡単になるように、 :class:`collections.abc.Sequence` ABC が提供されていま" -"す。" +"以下の表にある演算は、ミュータブルとイミュータブルの両方を含む、ほとんどの" +"シーケンス型でサポートされています。\n" +"独自のシーケンス型でこれらの演算を正しく実装しやすくするために、:class:" +"`collections.abc.Sequence` ABC が提供されています。" #: ../../library/stdtypes.rst:983 msgid "" @@ -1831,25 +1915,26 @@ msgstr "" "class:`str`, :class:`bytes`, :class:`bytearray` のような) 特殊なシーケンスで" "は部分シーケンス判定にも使われます::" -#: ../../library/stdtypes.rst:1066 msgid "" ">>> \"gg\" in \"eggs\"\n" "True" msgstr "" +">>> \"gg\" in \"eggs\"\n" +"True" -#: ../../library/stdtypes.rst:1070 msgid "" "Values of *n* less than ``0`` are treated as ``0`` (which yields an empty " "sequence of the same type as *s*). Note that items in the sequence *s* are " "not copied; they are referenced multiple times. This often haunts new " "Python programmers; consider::" msgstr "" -"``0`` 未満の値 *n* は ``0`` として扱われます (これは *s* と同じ型の空のシーケ" -"ンスを表します)。シーケンス *s* の要素はコピーされないので注意してください; " -"コピーではなく要素に対する参照カウントが増えます。これは Python に慣れていな" -"いプログラマをよく悩ませます。例えば以下のコードを考えます:" +"``0`` 未満の *n* は ``0`` として扱われます (結果は *s* と同じ型の空のシーケン" +"スになります)。\n" +"シーケンス *s* の要素はコピーされず、同じ要素が複数回参照されることに注意して" +"ください。\n" +"これは Python に慣れていないプログラマをよく悩ませます。\n" +"次のコードを考えてみてください::" -#: ../../library/stdtypes.rst:1075 msgid "" ">>> lists = [[]] * 3\n" ">>> lists\n" @@ -1858,6 +1943,12 @@ msgid "" ">>> lists\n" "[[3], [3], [3]]" msgstr "" +">>> lists = [[]] * 3\n" +">>> lists\n" +"[[], [], []]\n" +">>> lists[0].append(3)\n" +">>> lists\n" +"[[3], [3], [3]]" #: ../../library/stdtypes.rst:1082 msgid "" @@ -1871,7 +1962,6 @@ msgstr "" "と、その一つのリストが変更されます。別々のリストのリストを作るにはこうしま" "す::" -#: ../../library/stdtypes.rst:1087 msgid "" ">>> lists = [[] for i in range(3)]\n" ">>> lists[0].append(3)\n" @@ -1880,6 +1970,12 @@ msgid "" ">>> lists\n" "[[3], [5], [7]]" msgstr "" +">>> lists = [[] for i in range(3)]\n" +">>> lists[0].append(3)\n" +">>> lists[1].append(5)\n" +">>> lists[2].append(7)\n" +">>> lists\n" +"[[3], [5], [7]]" #: ../../library/stdtypes.rst:1094 msgid "" @@ -2041,15 +2137,14 @@ msgstr "" msgid "Mutable Sequence Types" msgstr "ミュータブルなシーケンス型" -#: ../../library/stdtypes.rst:1186 msgid "" "The operations in the following table are defined on mutable sequence types. " "The :class:`collections.abc.MutableSequence` ABC is provided to make it " "easier to correctly implement these operations on custom sequence types." msgstr "" -"以下のテーブルにある演算は、ほとんどのミュータブルなシーケンスでサポートされ" -"ています。カスタムのシーケンス型にこれらの演算を完全に実装するのが簡単になる" -"ように、 :class:`collections.abc.MutableSequence` ABC が提供されています。" +"以下の表にある演算は、ミュータブルなシーケンス型で定義されています。\n" +"独自のシーケンス型でこれらの演算を正しく実装しやすくするために、:class:" +"`collections.abc.MutableSequence` ABC が提供されています。" #: ../../library/stdtypes.rst:1190 msgid "" @@ -2234,18 +2329,16 @@ msgstr "" msgid ":meth:`clear` and :meth:`!copy` methods." msgstr ":meth:`clear` および :meth:`!copy` メソッド。" -#: ../../library/stdtypes.rst:1291 msgid "" "The value *n* is an integer, or an object implementing :meth:`~object." "__index__`. Zero and negative values of *n* clear the sequence. Items in " "the sequence are not copied; they are referenced multiple times, as " "explained for ``s * n`` under :ref:`typesseq-common`." msgstr "" -"値 *n* は整数であるか、:meth:`~object.__index__` を実装したオブジェクトで" -"す。 *n* の値がゼロまたは負数の場合、シーケンスをクリアします。:ref:" -"`typesseq-common` で ``s * n`` について説明したとおり、シーケンスの要素はコ" -"ピーされないので注意してください; コピーではなく要素に対する参照カウントが増" -"えます。" +"*n* は整数または :meth:`~object.__index__` を実装したオブジェクトです。\n" +"*n* がゼロまたは負の値の場合、シーケンスを空にします。\n" +":ref:`typesseq-common` の ``s * n`` の説明と同様に、シーケンスの要素はコピー" +"されず、同じ要素が複数回参照されます。" #: ../../library/stdtypes.rst:1300 msgid "Lists" @@ -2394,17 +2487,17 @@ msgid "" msgstr "" "ソートの例と簡単なチュートリアルは :ref:`sortinghowto` を参照して下さい。" -#: ../../library/stdtypes.rst:1370 msgid "" "While a list is being sorted, the effect of attempting to mutate, or even " "inspect, the list is undefined. The C implementation of Python makes the " "list appear empty for the duration, and raises :exc:`ValueError` if it can " "detect that the list has been mutated during a sort." msgstr "" -"リストがソートされている間、または変更しようとする試みの影響中、あるいは検査" -"中でさえ、リストは未定義です。Python の C 実装では、それらが続いている間、リ" -"ストは空として出力され、リストがソート中に変更されていることを検知できたら :" -"exc:`ValueError` を送出します。" +"リストのソート中にそのリストを変更したり、内容を調べたりしようとした場合の動" +"作は未定義です。\n" +"Python の C 実装では、ソート中はリストが空に見えるようにし、\n" +"ソート中にリストが変更されたことを検出できた場合は :exc:`ValueError` を送出し" +"ます。" #: ../../library/stdtypes.rst:1379 msgid "Tuples" @@ -2558,7 +2651,6 @@ msgstr "" msgid "Range examples::" msgstr "range の例::" -#: ../../library/stdtypes.rst:1459 msgid "" ">>> list(range(10))\n" "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\n" @@ -2575,6 +2667,20 @@ msgid "" ">>> list(range(1, 0))\n" "[]" msgstr "" +">>> list(range(10))\n" +"[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\n" +">>> list(range(1, 11))\n" +"[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n" +">>> list(range(0, 30, 5))\n" +"[0, 5, 10, 15, 20, 25]\n" +">>> list(range(0, 10, 3))\n" +"[0, 3, 6, 9]\n" +">>> list(range(0, -10, -1))\n" +"[0, -1, -2, -3, -4, -5, -6, -7, -8, -9]\n" +">>> list(range(0))\n" +"[]\n" +">>> list(range(1, 0))\n" +"[]" #: ../../library/stdtypes.rst:1474 msgid "" @@ -2678,15 +2784,15 @@ msgstr "" "numbers-linspace/>`_ は浮動小数点数向けの遅延評価版 range を実装する方法を紹" "介しています。" -#: ../../library/stdtypes.rst:1554 msgid "Text and Binary Sequence Type Methods Summary" -msgstr "" +msgstr "テキストおよびバイナリシーケンス型のメソッド一覧" -#: ../../library/stdtypes.rst:1555 msgid "" "The following table summarizes the text and binary sequence types methods by " "category." msgstr "" +"次の表は、テキストおよびバイナリシーケンス型のメソッドを分類ごとにまとめたも" +"のです。" #: ../../library/stdtypes.rst:1560 msgid "Category" @@ -2694,23 +2800,22 @@ msgstr "カテゴリ" #: ../../library/stdtypes.rst:1560 msgid ":class:`str` methods" -msgstr "" +msgstr ":class:`str` メソッド" #: ../../library/stdtypes.rst:1560 msgid ":class:`bytes` and :class:`bytearray` methods" -msgstr "" +msgstr ":class:`bytes` または :class:`bytearray` メソッド" -#: ../../library/stdtypes.rst:1562 msgid "Formatting" -msgstr "" +msgstr "書式化" #: ../../library/stdtypes.rst:1562 msgid ":meth:`str.format`" -msgstr "" +msgstr ":meth:`str.format`" #: ../../library/stdtypes.rst:1564 msgid ":meth:`str.format_map`" -msgstr "" +msgstr ":meth:`str.format_map`" #: ../../library/stdtypes.rst:1566 msgid ":ref:`f-strings`" @@ -2722,339 +2827,333 @@ msgstr ":ref:`old-string-formatting`" #: ../../library/stdtypes.rst:1568 msgid ":ref:`bytes-formatting`" -msgstr "" +msgstr ":ref:`bytes-formatting`" -#: ../../library/stdtypes.rst:1570 msgid "Searching and Replacing" -msgstr "" +msgstr "検索と置換" #: ../../library/stdtypes.rst:1570 msgid ":meth:`str.find`" -msgstr "" +msgstr ":meth:`str.find`" #: ../../library/stdtypes.rst:1570 msgid ":meth:`str.rfind`" -msgstr "" +msgstr ":meth:`str.rfind`" #: ../../library/stdtypes.rst:1570 msgid ":meth:`bytes.find`" -msgstr "" +msgstr ":meth:`bytes.find`" #: ../../library/stdtypes.rst:1570 msgid ":meth:`bytes.rfind`" -msgstr "" +msgstr ":meth:`bytes.rfind`" #: ../../library/stdtypes.rst:1572 msgid ":meth:`str.index`" -msgstr "" +msgstr ":meth:`str.index`" #: ../../library/stdtypes.rst:1572 msgid ":meth:`str.rindex`" -msgstr "" +msgstr ":meth:`str.rindex`" #: ../../library/stdtypes.rst:1572 msgid ":meth:`bytes.index`" -msgstr "" +msgstr ":meth:`bytes.index`" #: ../../library/stdtypes.rst:1572 msgid ":meth:`bytes.rindex`" -msgstr "" +msgstr ":meth:`bytes.rindex`" #: ../../library/stdtypes.rst:1574 msgid ":meth:`str.startswith`" -msgstr "" +msgstr ":meth:`str.startswith`" #: ../../library/stdtypes.rst:1574 msgid ":meth:`bytes.startswith`" -msgstr "" +msgstr ":meth:`bytes.startswith`" #: ../../library/stdtypes.rst:1576 msgid ":meth:`str.endswith`" -msgstr "" +msgstr ":meth:`str.endswith`" #: ../../library/stdtypes.rst:1576 msgid ":meth:`bytes.endswith`" -msgstr "" +msgstr ":meth:`bytes.endswith`" #: ../../library/stdtypes.rst:1578 msgid ":meth:`str.count`" -msgstr "" +msgstr ":meth:`str.count`" #: ../../library/stdtypes.rst:1578 msgid ":meth:`bytes.count`" -msgstr "" +msgstr ":meth:`bytes.count`" #: ../../library/stdtypes.rst:1580 msgid ":meth:`str.replace`" -msgstr "" +msgstr ":meth:`str.replace`" #: ../../library/stdtypes.rst:1580 msgid ":meth:`bytes.replace`" -msgstr "" +msgstr ":meth:`bytes.replace`" -#: ../../library/stdtypes.rst:1582 msgid "Splitting and Joining" -msgstr "" +msgstr "分割と結合" #: ../../library/stdtypes.rst:1582 msgid ":meth:`str.split`" -msgstr "" +msgstr ":meth:`str.split`" #: ../../library/stdtypes.rst:1582 msgid ":meth:`str.rsplit`" -msgstr "" +msgstr ":meth:`str.rsplit`" #: ../../library/stdtypes.rst:1582 msgid ":meth:`bytes.split`" -msgstr "" +msgstr ":meth:`bytes.split`" #: ../../library/stdtypes.rst:1582 msgid ":meth:`bytes.rsplit`" -msgstr "" +msgstr ":meth:`bytes.rsplit`" #: ../../library/stdtypes.rst:1584 msgid ":meth:`str.splitlines`" -msgstr "" +msgstr ":meth:`str.splitlines`" #: ../../library/stdtypes.rst:1584 msgid ":meth:`bytes.splitlines`" -msgstr "" +msgstr ":meth:`bytes.splitlines`" #: ../../library/stdtypes.rst:1586 msgid ":meth:`str.partition`" -msgstr "" +msgstr ":meth:`str.partition`" #: ../../library/stdtypes.rst:1586 msgid ":meth:`bytes.partition`" -msgstr "" +msgstr ":meth:`bytes.partition`" #: ../../library/stdtypes.rst:1588 msgid ":meth:`str.rpartition`" -msgstr "" +msgstr ":meth:`str.rpartition`" #: ../../library/stdtypes.rst:1588 msgid ":meth:`bytes.rpartition`" -msgstr "" +msgstr ":meth:`bytes.rpartition`" #: ../../library/stdtypes.rst:1590 msgid ":meth:`str.join`" -msgstr "" +msgstr ":meth:`str.join`" #: ../../library/stdtypes.rst:1590 msgid ":meth:`bytes.join`" -msgstr "" +msgstr ":meth:`bytes.join`" -#: ../../library/stdtypes.rst:1592 msgid "String Classification" -msgstr "" +msgstr "文字列の分類" #: ../../library/stdtypes.rst:1592 msgid ":meth:`str.isalpha`" -msgstr "" +msgstr ":meth:`str.isalpha`" #: ../../library/stdtypes.rst:1592 msgid ":meth:`bytes.isalpha`" -msgstr "" +msgstr ":meth:`bytes.isalpha`" #: ../../library/stdtypes.rst:1594 msgid ":meth:`str.isdecimal`" -msgstr "" +msgstr ":meth:`str.isdecimal`" #: ../../library/stdtypes.rst:1596 msgid ":meth:`str.isdigit`" -msgstr "" +msgstr ":meth:`str.isdigit`" #: ../../library/stdtypes.rst:1596 msgid ":meth:`bytes.isdigit`" -msgstr "" +msgstr ":meth:`bytes.isdigit`" #: ../../library/stdtypes.rst:1598 msgid ":meth:`str.isnumeric`" -msgstr "" +msgstr ":meth:`str.isnumeric`" #: ../../library/stdtypes.rst:1600 msgid ":meth:`str.isalnum`" -msgstr "" +msgstr ":meth:`str.isalnum`" #: ../../library/stdtypes.rst:1600 msgid ":meth:`bytes.isalnum`" -msgstr "" +msgstr ":meth:`bytes.isalnum`" #: ../../library/stdtypes.rst:1602 msgid ":meth:`str.isidentifier`" -msgstr "" +msgstr ":meth:`str.isidentifier`" #: ../../library/stdtypes.rst:1604 msgid ":meth:`str.islower`" -msgstr "" +msgstr ":meth:`str.islower`" #: ../../library/stdtypes.rst:1604 msgid ":meth:`bytes.islower`" -msgstr "" +msgstr ":meth:`bytes.islower`" #: ../../library/stdtypes.rst:1606 msgid ":meth:`str.isupper`" -msgstr "" +msgstr ":meth:`str.isupper`" #: ../../library/stdtypes.rst:1606 msgid ":meth:`bytes.isupper`" -msgstr "" +msgstr ":meth:`bytes.isupper`" #: ../../library/stdtypes.rst:1608 msgid ":meth:`str.istitle`" -msgstr "" +msgstr ":meth:`str.istitle`" #: ../../library/stdtypes.rst:1608 msgid ":meth:`bytes.istitle`" -msgstr "" +msgstr ":meth:`bytes.istitle`" #: ../../library/stdtypes.rst:1610 msgid ":meth:`str.isspace`" -msgstr "" +msgstr ":meth:`str.isspace`" #: ../../library/stdtypes.rst:1610 msgid ":meth:`bytes.isspace`" -msgstr "" +msgstr ":meth:`bytes.isspace`" #: ../../library/stdtypes.rst:1612 msgid ":meth:`str.isprintable`" -msgstr "" +msgstr ":meth:`str.isprintable`" -#: ../../library/stdtypes.rst:1614 msgid "Case Manipulation" -msgstr "" +msgstr "大文字と小文字の操作" #: ../../library/stdtypes.rst:1614 msgid ":meth:`str.lower`" -msgstr "" +msgstr ":meth:`str.lower`" #: ../../library/stdtypes.rst:1614 msgid ":meth:`bytes.lower`" -msgstr "" +msgstr ":meth:`bytes.lower`" #: ../../library/stdtypes.rst:1616 msgid ":meth:`str.upper`" -msgstr "" +msgstr ":meth:`str.upper`" #: ../../library/stdtypes.rst:1616 msgid ":meth:`bytes.upper`" -msgstr "" +msgstr ":meth:`bytes.upper`" #: ../../library/stdtypes.rst:1618 msgid ":meth:`str.casefold`" -msgstr "" +msgstr ":meth:`str.casefold`" #: ../../library/stdtypes.rst:1620 msgid ":meth:`str.capitalize`" -msgstr "" +msgstr ":meth:`str.capitalize`" #: ../../library/stdtypes.rst:1620 msgid ":meth:`bytes.capitalize`" -msgstr "" +msgstr ":meth:`bytes.capitalize`" #: ../../library/stdtypes.rst:1622 msgid ":meth:`str.title`" -msgstr "" +msgstr ":meth:`str.title`" #: ../../library/stdtypes.rst:1622 msgid ":meth:`bytes.title`" -msgstr "" +msgstr ":meth:`bytes.title`" #: ../../library/stdtypes.rst:1624 msgid ":meth:`str.swapcase`" -msgstr "" +msgstr ":meth:`str.swapcase`" #: ../../library/stdtypes.rst:1624 msgid ":meth:`bytes.swapcase`" -msgstr "" +msgstr ":meth:`bytes.swapcase`" -#: ../../library/stdtypes.rst:1626 msgid "Padding and Stripping" -msgstr "" +msgstr "パディングと除去" #: ../../library/stdtypes.rst:1626 msgid ":meth:`str.ljust`" -msgstr "" +msgstr ":meth:`str.ljust`" #: ../../library/stdtypes.rst:1626 msgid ":meth:`str.rjust`" -msgstr "" +msgstr ":meth:`str.rjust`" #: ../../library/stdtypes.rst:1626 msgid ":meth:`bytes.ljust`" -msgstr "" +msgstr ":meth:`bytes.ljust`" #: ../../library/stdtypes.rst:1626 msgid ":meth:`bytes.rjust`" -msgstr "" +msgstr ":meth:`bytes.rjust`" #: ../../library/stdtypes.rst:1628 msgid ":meth:`str.center`" -msgstr "" +msgstr ":meth:`str.center`" #: ../../library/stdtypes.rst:1628 msgid ":meth:`bytes.center`" -msgstr "" +msgstr ":meth:`bytes.center`" #: ../../library/stdtypes.rst:1630 msgid ":meth:`str.expandtabs`" -msgstr "" +msgstr ":meth:`str.expandtabs`" #: ../../library/stdtypes.rst:1630 msgid ":meth:`bytes.expandtabs`" -msgstr "" +msgstr ":meth:`bytes.expandtabs`" #: ../../library/stdtypes.rst:1632 msgid ":meth:`str.strip`" -msgstr "" +msgstr ":meth:`str.strip`" #: ../../library/stdtypes.rst:1632 msgid ":meth:`bytes.strip`" -msgstr "" +msgstr ":meth:`bytes.strip`" #: ../../library/stdtypes.rst:1634 msgid ":meth:`str.lstrip`" -msgstr "" +msgstr ":meth:`str.lstrip`" #: ../../library/stdtypes.rst:1634 msgid ":meth:`str.rstrip`" -msgstr "" +msgstr ":meth:`str.rstrip`" #: ../../library/stdtypes.rst:1634 msgid ":meth:`bytes.lstrip`" -msgstr "" +msgstr ":meth:`bytes.lstrip`" #: ../../library/stdtypes.rst:1634 msgid ":meth:`bytes.rstrip`" -msgstr "" +msgstr ":meth:`bytes.rstrip`" -#: ../../library/stdtypes.rst:1636 msgid "Translation and Encoding" -msgstr "" +msgstr "変換とエンコーディング" #: ../../library/stdtypes.rst:1636 msgid ":meth:`str.translate`" -msgstr "" +msgstr ":meth:`str.translate`" #: ../../library/stdtypes.rst:1636 msgid ":meth:`bytes.translate`" -msgstr "" +msgstr ":meth:`bytes.translate`" #: ../../library/stdtypes.rst:1638 msgid ":meth:`str.maketrans`" -msgstr "" +msgstr ":meth:`str.maketrans`" #: ../../library/stdtypes.rst:1638 msgid ":meth:`bytes.maketrans`" -msgstr "" +msgstr ":meth:`bytes.maketrans`" #: ../../library/stdtypes.rst:1640 msgid ":meth:`str.encode`" -msgstr "" +msgstr ":meth:`str.encode`" #: ../../library/stdtypes.rst:1642 msgid ":meth:`bytes.decode`" -msgstr "" +msgstr ":meth:`bytes.decode`" #: ../../library/stdtypes.rst:1648 msgid "Text Sequence Type --- :class:`str`" @@ -3130,14 +3229,13 @@ msgstr "" "指定を行うと長さ 1 の文字列を作成します。つまり、空でない文字列 *s* に対し、" "``s[0] == s[0:1]`` です。" -#: ../../library/stdtypes.rst:1679 msgid "" "There is also no mutable string type, but :meth:`str.join` or :class:`io." "StringIO` can be used to efficiently construct strings from multiple " "fragments." msgstr "" -"ミュータブルな文字列型もありませんが、ミュータブルな断片から効率よく文字列を" -"構成するのに :meth:`str.join` や :class:`io.StringIO` が使えます。" +"ミュータブルな文字列型もありませんが、複数の断片から効率よく文字列を構築する" +"には :meth:`str.join` や :class:`io.StringIO` を使えます。" #: ../../library/stdtypes.rst:1683 msgid "" @@ -3206,23 +3304,24 @@ msgstr "" "`str` に渡すと、略式の文字列表現を返す 1 つ目の場合に該当します。(Python のコ" "マンドラインオプション :option:`-b` も参照してください) 例えば::" -#: ../../library/stdtypes.rst:1725 msgid "" ">>> str(b'Zoot!')\n" "\"b'Zoot!'\"" msgstr "" +">>> str(b'Zoot!')\n" +"\"b'Zoot!'\"" -#: ../../library/stdtypes.rst:1728 msgid "" "For more information on the ``str`` class and its methods, see :ref:" "`textseq` and the :ref:`string-methods` section below. To output formatted " "strings, see the :ref:`f-strings` and :ref:`formatstrings` sections. In " "addition, see the :ref:`stringservices` section." msgstr "" -"``str`` クラスとそのメソッドについて詳しくは、 :ref:`テキストシーケンス型 — " -"str ` や :ref:`string-methods` の節を参照してください。フォーマット" -"された文字列を出力するには、 :ref:`f-strings` と :ref:`string-formatting` の" -"節を参照してください。加えて、 :ref:`stringservices` の節も参照してください。" +"``str`` クラスとそのメソッドについて詳しくは、:ref:`textseq` と後述の :ref:" +"`string-methods` 節を参照してください。\n" +"書式化した文字列の出力については、:ref:`f-strings` と :ref:`formatstrings` の" +"節を参照してください。\n" +"また、:ref:`stringservices` 節も参照してください。" #: ../../library/stdtypes.rst:1740 msgid "String Methods" @@ -3305,14 +3404,17 @@ msgid "" "Unicode16.0.0/core-spec/chapter-3/#G33992>`__." msgstr "" -#: ../../library/stdtypes.rst:1789 msgid "" "Return centered in a string of length *width*. Padding is done using the " "specified *fillchar* (default is an ASCII space). The original string is " "returned if *width* is less than or equal to ``len(s)``. For example::" msgstr "" +"長さ ``width`` の文字列の中央に配置して返します。\n" +"パディングには指定された ``fillchar`` (デフォルトは ASCII スペース) を使いま" +"す。\n" +"``width`` が ``len(s)`` 以下の場合は元の文字列を返します。\n" +"例えば、次のようになります。 ::" -#: ../../library/stdtypes.rst:1793 msgid "" ">>> 'Python'.center(10)\n" "' Python '\n" @@ -3321,6 +3423,12 @@ msgid "" ">>> 'Python'.center(4)\n" "'Python'" msgstr "" +">>> 'Python'.center(10)\n" +"' Python '\n" +">>> 'Python'.center(10, '-')\n" +"'--Python--'\n" +">>> 'Python'.center(4)\n" +"'Python'" #: ../../library/stdtypes.rst:1803 msgid "" @@ -3338,7 +3446,6 @@ msgid "" "which is the length of the string plus one. For example::" msgstr "" -#: ../../library/stdtypes.rst:1810 msgid "" ">>> 'spam, spam, spam'.count('spam')\n" "3\n" @@ -3351,6 +3458,16 @@ msgid "" ">>> 'spam, spam, spam'.count('')\n" "17" msgstr "" +">>> 'spam, spam, spam'.count('spam')\n" +"3\n" +">>> 'spam, spam, spam'.count('spam', 5)\n" +"2\n" +">>> 'spam, spam, spam'.count('spam', 5, 10)\n" +"1\n" +">>> 'spam, spam, spam'.count('eggs')\n" +"0\n" +">>> 'spam, spam, spam'.count('')\n" +"17" #: ../../library/stdtypes.rst:1823 msgid "Return the string encoded to :class:`bytes`." @@ -3458,11 +3575,12 @@ msgstr "" "す。 *sub* が部分文字列であるかどうかのみを調べるには、 :keyword:`in` 演算子" "を使ってください::" -#: ../../library/stdtypes.rst:1889 msgid "" ">>> 'Py' in 'Python'\n" "True" msgstr "" +">>> 'Py' in 'Python'\n" +"True" #: ../../library/stdtypes.rst:1895 msgid "" @@ -3487,7 +3605,6 @@ msgstr "" "書式指定のオプションについては、書式指定文字列を規定する :ref:" "`formatstrings` を参照してください。" -#: ../../library/stdtypes.rst:1909 msgid "" "When formatting a number (:class:`int`, :class:`float`, :class:`complex`, :" "class:`decimal.Decimal` and subclasses) with the ``n`` type (ex: ``'{:n}'." @@ -3497,21 +3614,22 @@ msgid "" "and the ``LC_NUMERIC`` locale is different than the ``LC_CTYPE`` locale. " "This temporary change affects other threads." msgstr "" -"数値 (:class:`int`, :class:`float`, :class:`complex`, :class:`decimal." -"Decimal` とサブクラス) を ``n`` の整数表現型 (例: ``'{:n}'.format(1234)``) で" -"フォーマットするとき、``LC_CTYPE`` ロケールと ``LC_NUMERIC`` ロケールの一方ま" -"たは両方が 1 バイトより長い非 ASCII 文字であると同時に異なる値である場合、こ" -"の関数は :c:func:`localeconv` の ``decimal_point`` と ``thousands_sep`` " -"フィールドを読み取るため一時的に ``LC_CTYPE`` ロケールに ``LC_NUMERIC`` のロ" -"ケール値を設定します。この一時的な変更は他のスレッドの動作に影響します。" +"数値 (:class:`int`、:class:`float`、:class:`complex`、:class:`decimal." +"Decimal` とそのサブクラス) を ``n`` 型で書式化する場合 (例: ``'{:n}'." +"format(1234)``)、\n" +":c:func:`localeconv` の ``decimal_point`` または ``thousands_sep`` フィールド" +"が非 ASCII 文字を含むか1バイトより長く、\n" +"かつ ``LC_NUMERIC`` ロケールが ``LC_CTYPE`` ロケールと異なるときは、\n" +"それらのフィールドをデコードするために、一時的に ``LC_CTYPE`` ロケールを " +"``LC_NUMERIC`` ロケールに設定します。\n" +"この一時的な変更は他のスレッドにも影響します。" -#: ../../library/stdtypes.rst:1918 msgid "" "When formatting a number with the ``n`` type, the function sets temporarily " "the ``LC_CTYPE`` locale to the ``LC_NUMERIC`` locale in some cases." msgstr "" -"数値を ``n`` の整数表現型でフォーマットするとき、この関数は一時的に " -"``LC_CTYPE`` ロケールに ``LC_NUMERIC`` のロケール値を設定する場合があります。" +"数値を ``n`` 型で書式化するとき、一時的に ``LC_CTYPE`` ロケールを " +"``LC_NUMERIC`` ロケールに設定する場合があります。" #: ../../library/stdtypes.rst:1926 msgid "" @@ -3613,7 +3731,6 @@ msgstr "" msgid "Example: ::" msgstr "例: ::" -#: ../../library/stdtypes.rst:2005 msgid "" ">>> from keyword import iskeyword\n" "\n" @@ -3622,6 +3739,12 @@ msgid "" ">>> 'def'.isidentifier(), iskeyword('def')\n" "(True, True)" msgstr "" +">>> from keyword import iskeyword\n" +"\n" +">>> 'hello'.isidentifier(), iskeyword('hello')\n" +"(True, False)\n" +">>> 'def'.isidentifier(), iskeyword('def')\n" +"(True, True)" #: ../../library/stdtypes.rst:2015 msgid "" @@ -3647,21 +3770,26 @@ msgstr "" "FIFTH)。正式には、数を表す文字は、プロパティ値 Numeric_Type=Digit、 " "Numeric_Type=Decimal または Numeric_Type=Numeric を持つものです。" -#: ../../library/stdtypes.rst:2031 msgid "" "Return ``True`` if all characters in the string are printable, ``False`` if " "it contains at least one non-printable character." msgstr "" +"文字列内のすべての文字が表示可能な場合は ``True`` を、表示できない文字が一つ" +"でも含まれる場合は ``False`` を返します。" -#: ../../library/stdtypes.rst:2034 msgid "" "Here \"printable\" means the character is suitable for :func:`repr` to use " "in its output; \"non-printable\" means that :func:`repr` on built-in types " "will hex-escape the character. It has no bearing on the handling of strings " "written to :data:`sys.stdout` or :data:`sys.stderr`." msgstr "" +"ここで「表示可能」とは、その文字を :func:`repr` の出力にそのまま使えることを" +"意味します。\n" +"「表示できない」とは、組み込み型に対する :func:`repr` がその文字を16進エス" +"ケープで表すことを意味します。\n" +":data:`sys.stdout` や :data:`sys.stderr` に書き出す文字列の扱いには関係ありま" +"せん。" -#: ../../library/stdtypes.rst:2039 msgid "" "The printable characters are those which in the Unicode character database " "(see :mod:`unicodedata`) have a general category in group Letter, Mark, " @@ -3669,6 +3797,11 @@ msgid "" "0x20. Nonprintable characters are those in group Separator or Other (Z or " "C), except the ASCII space." msgstr "" +"表示可能な文字は、Unicode 文字データベース (:mod:`unicodedata` を参照) で一般" +"カテゴリが Letter、Mark、Number、Punctuation、Symbol のグループ (L、M、N、P、" +"S) に属する文字と、ASCII スペース 0x20 です。\n" +"表示できない文字は、ASCII スペースを除く、Separator または Other のグループ " +"(Z、C) に属する文字です。" #: ../../library/stdtypes.rst:2048 msgid "" @@ -3678,7 +3811,6 @@ msgstr "" "文字列が空白文字だけからなり、かつ 1 文字以上ある場合には ``True`` を返し、そ" "うでない場合は ``False`` を返します。" -#: ../../library/stdtypes.rst:2051 msgid "" "A character is *whitespace* if in the Unicode character database (see :mod:" "`unicodedata`), either its general category is ``Zs`` (\"Separator, " @@ -3686,7 +3818,7 @@ msgid "" msgstr "" "Unicode 文字データベース (:mod:`unicodedata` を参照) で一般カテゴリが ``Zs`` " "(\"Seperator, space\") であるか、 双方向クラスが ``WS``、``B``、 ``S`` のい" -"ずれかである場合、その文字は *空白文字(whitespace)* です。 " +"ずれかである場合、その文字は *空白文字(whitespace)* です。" #: ../../library/stdtypes.rst:2059 msgid "" @@ -3758,13 +3890,16 @@ msgstr "" "除去されます。 *chars* 文字列は接頭辞ではなく、その値に含まれる文字の組み合わ" "せ全てがはぎ取られます::" -#: ../../library/stdtypes.rst:2114 msgid "" ">>> ' spacious '.lstrip()\n" "'spacious '\n" ">>> 'www.example.com'.lstrip('cmowz.')\n" "'example.com'" msgstr "" +">>> ' spacious '.lstrip()\n" +"'spacious '\n" +">>> 'www.example.com'.lstrip('cmowz.')\n" +"'example.com'" #: ../../library/stdtypes.rst:2119 msgid "" @@ -3774,13 +3909,16 @@ msgstr "" "文字の集合全てではなく、指定した文字列そのものを接頭辞として削除するメソッド" "については、 :meth:`str.removeprefix` を参照してください。使用例::" -#: ../../library/stdtypes.rst:2122 msgid "" ">>> 'Arthur: three!'.lstrip('Arthur: ')\n" "'ee!'\n" ">>> 'Arthur: three!'.removeprefix('Arthur: ')\n" "'three!'" msgstr "" +">>> 'Arthur: three!'.lstrip('Arthur: ')\n" +"'ee!'\n" +">>> 'Arthur: three!'.removeprefix('Arthur: ')\n" +"'three!'" #: ../../library/stdtypes.rst:2130 msgid "" @@ -3832,13 +3970,16 @@ msgstr "" "文字列が *prefix* で始まる場合、 ``string[len(prefix):]`` を返します。それ以" "外の場合、元の文字列のコピーを返します::" -#: ../../library/stdtypes.rst:2157 msgid "" ">>> 'TestHook'.removeprefix('Test')\n" "'Hook'\n" ">>> 'BaseTestCase'.removeprefix('Test')\n" "'BaseTestCase'" msgstr "" +">>> 'TestHook'.removeprefix('Test')\n" +"'Hook'\n" +">>> 'BaseTestCase'.removeprefix('Test')\n" +"'BaseTestCase'" #: ../../library/stdtypes.rst:2167 msgid "" @@ -3849,13 +3990,16 @@ msgstr "" "文字列が *suffix* で終わる場合、 ``string[:-len(suffix)]`` を返します。それ以" "外の場合、元の文字列のコピーを返します::" -#: ../../library/stdtypes.rst:2171 msgid "" ">>> 'MiscTests'.removesuffix('Tests')\n" "'Misc'\n" ">>> 'TmpDirMixin'.removesuffix('Tests')\n" "'TmpDirMixin'" msgstr "" +">>> 'MiscTests'.removesuffix('Tests')\n" +"'Misc'\n" +">>> 'TmpDirMixin'.removesuffix('Tests')\n" +"'TmpDirMixin'" #: ../../library/stdtypes.rst:2181 msgid "" @@ -3940,13 +4084,16 @@ msgstr "" "されます。 *chars* 文字列は接尾語ではなく、そこに含まれる文字の組み合わせ全て" "がはぎ取られます::" -#: ../../library/stdtypes.rst:2233 msgid "" ">>> ' spacious '.rstrip()\n" "' spacious'\n" ">>> 'mississippi'.rstrip('ipz')\n" "'mississ'" msgstr "" +">>> ' spacious '.rstrip()\n" +"' spacious'\n" +">>> 'mississippi'.rstrip('ipz')\n" +"'mississ'" #: ../../library/stdtypes.rst:2238 msgid "" @@ -3956,13 +4103,16 @@ msgstr "" "文字の集合全てではなく、指定した文字列そのものを接尾辞として削除するメソッド" "については :meth:`str.removesuffix` を参照してください。使用例::" -#: ../../library/stdtypes.rst:2241 msgid "" ">>> 'Monty Python'.rstrip(' Python')\n" "'M'\n" ">>> 'Monty Python'.removesuffix(' Python')\n" "'Monty'" msgstr "" +">>> 'Monty Python'.rstrip(' Python')\n" +"'M'\n" +">>> 'Monty Python'.removesuffix(' Python')\n" +"'Monty'" #: ../../library/stdtypes.rst:2248 msgid "" @@ -4005,7 +4155,6 @@ msgstr "" msgid "For example::" msgstr "例えば::" -#: ../../library/stdtypes.rst:2263 msgid "" ">>> '1,2,3'.split(',')\n" "['1', '2', '3']\n" @@ -4016,7 +4165,15 @@ msgid "" ">>> '1<>2<>3<4'.split('<>')\n" "['1', '2', '3<4']" msgstr "" - +">>> '1,2,3'.split(',')\n" +"['1', '2', '3']\n" +">>> '1,2,3'.split(',', maxsplit=1)\n" +"['1', '2,3']\n" +">>> '1,2,,3,'.split(',')\n" +"['1', '2', '', '3', '']\n" +">>> '1<>2<>3<4'.split('<>')\n" +"['1', '2', '3<4']" + #: ../../library/stdtypes.rst:2272 msgid "" "If *sep* is not specified or is ``None``, a different splitting algorithm is " @@ -4031,7 +4188,6 @@ msgstr "" "末尾に空白があっても、結果の最初や最後に空文字列は含まれません。よって、空文" "字列や空白だけの文字列を ``None`` デリミタで分割すると ``[]`` が返されます。" -#: ../../library/stdtypes.rst:2281 msgid "" ">>> '1 2 3'.split()\n" "['1', '2', '3']\n" @@ -4040,14 +4196,20 @@ msgid "" ">>> ' 1 2 3 '.split()\n" "['1', '2', '3']" msgstr "" +">>> '1 2 3'.split()\n" +"['1', '2', '3']\n" +">>> '1 2 3'.split(maxsplit=1)\n" +"['1', '2 3']\n" +">>> ' 1 2 3 '.split()\n" +"['1', '2', '3']" -#: ../../library/stdtypes.rst:2288 msgid "" "If *sep* is not specified or is ``None`` and *maxsplit* is ``0``, only " "leading runs of consecutive whitespace are considered." msgstr "" +"``sep`` を指定しないか ``None`` を指定し、かつ ``maxsplit`` が ``0`` の場合" +"は、先頭の連続する空白文字だけを扱います。" -#: ../../library/stdtypes.rst:2293 msgid "" ">>> \"\".split(None, 0)\n" "[]\n" @@ -4056,6 +4218,12 @@ msgid "" ">>> \" foo \".split(maxsplit=0)\n" "['foo ']" msgstr "" +">>> \"\".split(None, 0)\n" +"[]\n" +">>> \" \".split(None, 0)\n" +"[]\n" +">>> \" foo \".split(maxsplit=0)\n" +"['foo ']" #: ../../library/stdtypes.rst:2306 msgid "" @@ -4102,9 +4270,8 @@ msgstr "復帰" msgid "``\\r\\n``" msgstr "``\\r\\n``" -#: ../../library/stdtypes.rst:2320 msgid "Carriage Return + Line Feed" -msgstr "改行 + 復帰" +msgstr "復帰 + 改行" #: ../../library/stdtypes.rst:2322 msgid "``\\v`` or ``\\x0b``" @@ -4174,42 +4341,51 @@ msgstr "段落区切り" msgid "``\\v`` and ``\\f`` added to list of line boundaries." msgstr "``\\v`` と ``\\f`` が行境界のリストに追加されました。" -#: ../../library/stdtypes.rst:2345 msgid "" ">>> 'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines()\n" "['ab c', '', 'de fg', 'kl']\n" ">>> 'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines(keepends=True)\n" "['ab c\\n', '\\n', 'de fg\\r', 'kl\\r\\n']" msgstr "" +">>> 'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines()\n" +"['ab c', '', 'de fg', 'kl']\n" +">>> 'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines(keepends=True)\n" +"['ab c\\n', '\\n', 'de fg\\r', 'kl\\r\\n']" -#: ../../library/stdtypes.rst:2350 msgid "" "Unlike :meth:`~str.split` when a delimiter string *sep* is given, this " "method returns an empty list for the empty string, and a terminal line break " "does not result in an extra line::" msgstr "" -":meth:`~str.split` とは違って、デリミタ文字列 *sep* が与えられたとき、このメ" -"ソッドは空文字列に空リストを返し、終末の改行は結果に行を追加しません::" +"区切り文字列 *sep* を指定した :meth:`~str.split` とは異なり、\n" +"このメソッドは空文字列に対して空のリストを返し、末尾に改行があっても余分な行" +"を追加しません::" -#: ../../library/stdtypes.rst:2354 msgid "" ">>> \"\".splitlines()\n" "[]\n" ">>> \"One line\\n\".splitlines()\n" "['One line']" msgstr "" +">>> \"\".splitlines()\n" +"[]\n" +">>> \"One line\\n\".splitlines()\n" +"['One line']" #: ../../library/stdtypes.rst:2359 msgid "For comparison, ``split('\\n')`` gives::" msgstr "比較のために ``split('\\n')`` は以下のようになります::" -#: ../../library/stdtypes.rst:2361 msgid "" ">>> ''.split('\\n')\n" "['']\n" ">>> 'Two lines\\n'.split('\\n')\n" "['Two lines', '']" msgstr "" +">>> ''.split('\\n')\n" +"['']\n" +">>> 'Two lines\\n'.split('\\n')\n" +"['Two lines', '']" #: ../../library/stdtypes.rst:2369 msgid "" @@ -4236,13 +4412,16 @@ msgstr "" "文字が除去されます。 *chars* 文字列は接頭語でも接尾語でもなく、そこに含まれる" "文字の組み合わせ全てがはぎ取られます::" -#: ../../library/stdtypes.rst:2383 msgid "" ">>> ' spacious '.strip()\n" "'spacious'\n" ">>> 'www.example.com'.strip('cmowz.')\n" "'example'" msgstr "" +">>> ' spacious '.strip()\n" +"'spacious'\n" +">>> 'www.example.com'.strip('cmowz.')\n" +"'example'" #: ../../library/stdtypes.rst:2388 msgid "" @@ -4256,12 +4435,14 @@ msgstr "" "す。文字列の末尾に対しても同様の操作が行われます。例えば、次のようになりま" "す::" -#: ../../library/stdtypes.rst:2394 msgid "" ">>> comment_string = '#....... Section 3.2.1 Issue #32 .......'\n" ">>> comment_string.strip('.#! ')\n" "'Section 3.2.1 Issue #32'" msgstr "" +">>> comment_string = '#....... Section 3.2.1 Issue #32 .......'\n" +">>> comment_string.strip('.#! ')\n" +"'Section 3.2.1 Issue #32'" #: ../../library/stdtypes.rst:2401 msgid "" @@ -4280,11 +4461,12 @@ msgstr "" "文字列を、単語ごとに大文字から始まり、残りの文字のうち大小文字の区別があるも" "のは全て小文字にする、タイトルケースにして返します。" -#: ../../library/stdtypes.rst:2413 msgid "" ">>> 'Hello world'.title()\n" "'Hello World'" msgstr "" +">>> 'Hello world'.title()\n" +"'Hello World'" #: ../../library/stdtypes.rst:2416 ../../library/stdtypes.rst:3822 msgid "" @@ -4298,11 +4480,12 @@ msgstr "" "アポストロフィが単語の境界になってしまい、望みの結果を得られない場合がありま" "す::" -#: ../../library/stdtypes.rst:2421 msgid "" ">>> \"they're bill's friends from the UK\".title()\n" "\"They'Re Bill'S Friends From The Uk\"" msgstr "" +">>> \"they're bill's friends from the UK\".title()\n" +"\"They'Re Bill'S Friends From The Uk\"" #: ../../library/stdtypes.rst:2424 msgid "" @@ -4318,7 +4501,6 @@ msgid "" "expressions::" msgstr "または、正規表現を使うことでアポストロフィに対応できます::" -#: ../../library/stdtypes.rst:2430 msgid "" ">>> import re\n" ">>> def titlecase(s):\n" @@ -4329,6 +4511,14 @@ msgid "" ">>> titlecase(\"they're bill's friends.\")\n" "\"They're Bill's Friends.\"" msgstr "" +">>> import re\n" +">>> def titlecase(s):\n" +"... return re.sub(r\"[A-Za-z]+('[A-Za-z]+)?\",\n" +"... lambda mo: mo.group(0).capitalize(),\n" +"... s)\n" +"...\n" +">>> titlecase(\"they're bill's friends.\")\n" +"\"They're Bill's Friends.\"" #: ../../library/stdtypes.rst:2442 msgid "" @@ -4387,45 +4577,49 @@ msgid "" "Unicode16.0.0/core-spec/chapter-3/#G33992>`__." msgstr "" -#: ../../library/stdtypes.rst:2473 msgid "" "Return a copy of the string left filled with ASCII ``'0'`` digits to make a " "string of length *width*. A leading sign prefix (``'+'``/``'-'``) is handled " "by inserting the padding *after* the sign character rather than before. The " "original string is returned if *width* is less than or equal to ``len(s)``." msgstr "" -"長さが *width* になるよう ASCII ``'0'`` で左詰めした文字列のコピーを返しま" -"す。先頭が符号接頭辞 (``'+'``/``'-'``) だった場合、 ``'0'`` は符号の前ではな" -"く *後* に挿入されます。*width* が ``len(s)`` 以下の場合元の文字列を返しま" -"す。" +"長さが ``width`` になるよう、左側を ASCII ``'0'`` で埋めた文字列のコピーを返" +"します。\n" +"先頭に符号接頭辞 (``'+'``/``'-'``) がある場合は、符号文字の前ではなく *後* に" +"パディングを挿入します。\n" +"``width`` が ``len(s)`` 以下の場合は元の文字列を返します。" -#: ../../library/stdtypes.rst:2481 msgid "" ">>> \"42\".zfill(5)\n" "'00042'\n" ">>> \"-42\".zfill(5)\n" "'-0042'" msgstr "" +">>> \"42\".zfill(5)\n" +"'00042'\n" +">>> \"-42\".zfill(5)\n" +"'-0042'" -#: ../../library/stdtypes.rst:2502 msgid "Formatted String Literals (f-strings)" -msgstr "" +msgstr "フォーマット済み文字列リテラル (f-string)" -#: ../../library/stdtypes.rst:2505 msgid "" "The :keyword:`await` and :keyword:`async for` can be used in expressions " "within f-strings." msgstr "" +"f-string 内の式で :keyword:`await` と :keyword:`async for` を使えるようになり" +"ました。" #: ../../library/stdtypes.rst:2508 msgid "Added the debugging operator (``=``)" msgstr "" -#: ../../library/stdtypes.rst:2510 msgid "" "Many restrictions on expressions within f-strings have been removed. " "Notably, nested strings, comments, and backslashes are now permitted." msgstr "" +"f-string 内の式に対する多くの制限が取り除かれました。\n" +"特に、文字列の入れ子、コメント、バックスラッシュが使えるようになりました。" #: ../../library/stdtypes.rst:2514 msgid "" @@ -4437,13 +4631,16 @@ msgid "" "into regular :class:`str` objects. For example:" msgstr "" -#: ../../library/stdtypes.rst:2522 msgid "" ">>> who = 'nobody'\n" ">>> nationality = 'Spanish'\n" ">>> f'{who.title()} expects the {nationality} Inquisition!'\n" "'Nobody expects the Spanish Inquisition!'" msgstr "" +">>> who = 'nobody'\n" +">>> nationality = 'Spanish'\n" +">>> f'{who.title()} expects the {nationality} Inquisition!'\n" +"'Nobody expects the Spanish Inquisition!'" #: ../../library/stdtypes.rst:2529 msgid "It is also possible to use a multi line f-string:" @@ -4630,11 +4827,12 @@ msgstr "" "の ``%`` による変換の指定は0こ以上の *values* の要素で置き換えられます。この" "動作は C 言語における :c:func:`sprintf` 関数の利用方法に似ています。使用例:" -#: ../../library/stdtypes.rst:2659 msgid "" ">>> print('%s has %d quote types.' % ('Python', 2))\n" "Python has 2 quote types." msgstr "" +">>> print('%s has %d quote types.' % ('Python', 2))\n" +"Python has 2 quote types." #: ../../library/stdtypes.rst:2664 msgid "" @@ -4696,9 +4894,8 @@ msgstr "" "``'*'`` (アスタリスク) を指定した場合、精度の桁数は *values* タプルの次の要素" "から読み出されます。タプルには精度指定の後に変換したい値がくるようにします。" -#: ../../library/stdtypes.rst:2694 ../../library/stdtypes.rst:3953 msgid "Length modifier (optional)." -msgstr "精度長変換子 (オプション)。" +msgstr "長さ修飾子 (省略可能)。" #: ../../library/stdtypes.rst:2696 ../../library/stdtypes.rst:3955 msgid "Conversion type." @@ -4765,13 +4962,12 @@ msgstr "" msgid "``' '``" msgstr "``' '``" -#: ../../library/stdtypes.rst:2729 ../../library/stdtypes.rst:3988 msgid "" "(a space) A blank should be left before a positive number (or empty string) " "produced by a signed conversion." msgstr "" -"(スペース) 符号付きの変換で正の数の場合、前に一つスペースを空けます (そうでな" -"い場合は空文字になります) 。" +"(スペース) 符号付き変換で生成された正の数 (または空文字列) の前に、空白を一つ" +"置きます。" #: ../../library/stdtypes.rst:2732 ../../library/stdtypes.rst:3991 msgid "``'+'``" @@ -4785,13 +4981,13 @@ msgstr "" "変換の先頭に符号文字 (``'+'`` または ``'-'``) を付けます(\"スペース\" フラグ" "を上書きします) 。" -#: ../../library/stdtypes.rst:2736 ../../library/stdtypes.rst:3995 msgid "" "A length modifier (``h``, ``l``, or ``L``) may be present, but is ignored as " "it is not necessary for Python -- so e.g. ``%ld`` is identical to ``%d``." msgstr "" -"精度長変換子(``h``, ``l``,または ``L``) を使うことができますが、 Python では" -"必要ないため無視されます。 -- つまり、例えば ``%ld`` は ``%d`` と等価です。" +"長さ修飾子 (``h``、``l``、``L``) を指定しても構いませんが、Python では必要な" +"いため無視されます。\n" +"例えば、``%ld`` は ``%d`` と同じです。" #: ../../library/stdtypes.rst:2739 ../../library/stdtypes.rst:3998 msgid "The conversion types are:" @@ -4875,25 +5071,25 @@ msgstr "``'F'``" msgid "``'g'``" msgstr "``'g'``" -#: ../../library/stdtypes.rst:2764 ../../library/stdtypes.rst:4023 msgid "" "Floating-point format. Uses lowercase exponential format if exponent is less " "than -4 or not less than precision, decimal format otherwise." msgstr "" -"浮動小数点数。指数部が -4 以上または精度以下の場合には小文字指数表記、それ以" -"外の場合には10進表記。" +"浮動小数点数の書式。\n" +"指数が -4 未満または指定精度以上の場合は小文字の指数表記を使い、それ以外は10" +"進表記を使います。" #: ../../library/stdtypes.rst:2768 ../../library/stdtypes.rst:4027 msgid "``'G'``" msgstr "``'G'``" -#: ../../library/stdtypes.rst:2768 ../../library/stdtypes.rst:4027 msgid "" "Floating-point format. Uses uppercase exponential format if exponent is less " "than -4 or not less than precision, decimal format otherwise." msgstr "" -"浮動小数点数。指数部が -4 以上または精度以下の場合には大文字指数表記、それ以" -"外の場合には10進表記。" +"浮動小数点数の書式。\n" +"指数が -4 未満または指定精度以上の場合は大文字の指数表記を使い、それ以外は10" +"進表記を使います。" #: ../../library/stdtypes.rst:2772 ../../library/stdtypes.rst:4031 msgid "``'c'``" @@ -5135,16 +5331,15 @@ msgstr "既存のバイナリデータからバッファプロトコルでコピ msgid "Also see the :ref:`bytes ` built-in." msgstr ":ref:`bytes ` ビルトイン関数も参照してください。" -#: ../../library/stdtypes.rst:2898 msgid "" "Since 2 hexadecimal digits correspond precisely to a single byte, " "hexadecimal numbers are a commonly used format for describing binary data. " "Accordingly, the bytes type has an additional class method to read data in " "that format:" msgstr "" -"16 進数で 2 桁の数は正確に 1 バイトに相当するため、16 進整はバイナリデータを" -"表現する形式として広く使われています。 従って、 bytes 型にはその形式でデータ" -"を読み取るための追加のクラスメソッドがあります。" +"16進数字2桁がちょうど1バイトに対応するため、16進数はバイナリデータを表す形式" +"としてよく使われます。\n" +"そのため、bytes 型にはその形式のデータを読み取るクラスメソッドもあります:" #: ../../library/stdtypes.rst:2904 msgid "" @@ -5164,11 +5359,12 @@ msgstr "" ":meth:`bytes.fromhex` は文字列にある空白だけでなく、 ASCII の空白文字全てをス" "キップするようになりました。" -#: ../../library/stdtypes.rst:2915 msgid "" ":meth:`bytes.fromhex` now accepts ASCII :class:`bytes` and :term:`bytes-like " "objects ` as input." msgstr "" +":meth:`bytes.fromhex` が入力として ASCII の :class:`bytes` および :term:" +"`bytes-like オブジェクト ` を受け付けるようになりました。" #: ../../library/stdtypes.rst:2919 msgid "" @@ -5178,13 +5374,11 @@ msgstr "" "bytes オブジェクトをその 16 進表記に変換するための、反対向きの変換関数があり" "ます。" -#: ../../library/stdtypes.rst:2924 ../../library/stdtypes.rst:3013 msgid "" "Return a string object containing two hexadecimal digits for each byte in " "the instance." msgstr "" -"インスタンス内の 1 バイトにつき 2 つの 16 進数を含む、文字列オブジェクトを返" -"します。" +"インスタンス内の各バイトを2桁の16進数字で表した文字列オブジェクトを返します。" #: ../../library/stdtypes.rst:2930 msgid "" @@ -5283,16 +5477,15 @@ msgstr "" msgid "Also see the :ref:`bytearray ` built-in." msgstr ":ref:`bytearray ` ビルトイン関数も参照してください。" -#: ../../library/stdtypes.rst:2987 msgid "" "Since 2 hexadecimal digits correspond precisely to a single byte, " "hexadecimal numbers are a commonly used format for describing binary data. " "Accordingly, the bytearray type has an additional class method to read data " "in that format:" msgstr "" -"16 進数で 2 桁の数は正確に 1 バイトに相当するため、16 進整はバイナリデータを" -"表現する形式として広く使われています。 従って、 bytearray 型にはその形式で" -"データを読み取るための追加のクラスメソッドがあります。" +"16進数字2桁がちょうど1バイトに対応するため、16進数はバイナリデータを表す形式" +"としてよく使われます。\n" +"そのため、bytearray 型にはその形式のデータを読み取るクラスメソッドもあります:" #: ../../library/stdtypes.rst:2993 msgid "" @@ -5312,11 +5505,12 @@ msgstr "" ":meth:`bytearray.fromhex` は文字列にある空白だけでなく、 ASCII の空白文字全て" "をスキップするようになりました。" -#: ../../library/stdtypes.rst:3004 msgid "" ":meth:`bytearray.fromhex` now accepts ASCII :class:`bytes` and :term:`bytes-" "like objects ` as input." msgstr "" +":meth:`bytearray.fromhex` が入力として ASCII の :class:`bytes` および :term:" +"`bytes-like オブジェクト ` を受け付けるようになりました。" #: ../../library/stdtypes.rst:3008 msgid "" @@ -5336,16 +5530,18 @@ msgstr "" "分割するセパレータを挿入するためのオプションパラメータ *sep* と " "*bytes_per_sep* をサポートするようになりました。" -#: ../../library/stdtypes.rst:3028 msgid "" "Resize the :class:`bytearray` to contain *size* bytes. *size* must be " "greater than or equal to 0." msgstr "" +":class:`bytearray` のサイズを ``size`` バイトに変更します。\n" +"``size`` は0以上でなければなりません。" -#: ../../library/stdtypes.rst:3031 msgid "" "If the :class:`bytearray` needs to shrink, bytes beyond *size* are truncated." msgstr "" +":class:`bytearray` を縮小する場合は、``size`` を超える部分のバイトを切り捨て" +"ます。" #: ../../library/stdtypes.rst:3033 msgid "" @@ -5353,9 +5549,8 @@ msgid "" "will be set to null bytes." msgstr "" -#: ../../library/stdtypes.rst:3037 msgid "This is equivalent to:" -msgstr "" +msgstr "これは次と等価です:" #: ../../library/stdtypes.rst:3045 msgid "Examples:" @@ -5389,7 +5584,6 @@ msgstr "" msgid "Bytes and Bytearray Operations" msgstr "bytes と bytearray の操作" -#: ../../library/stdtypes.rst:3077 msgid "" "Both bytes and bytearray objects support the :ref:`common ` " "sequence operations. They interoperate not just with operands of the same " @@ -5397,11 +5591,13 @@ msgid "" "can be freely mixed in operations without causing errors. However, the " "return type of the result may depend on the order of operands." msgstr "" -"bytes と bytearray は両方共 :ref:`一般のシーケンス操作 ` を" -"サポートしています。また、両方とも :term:`bytes-like object` をサポートしてい" -"る任意のオブジェクトを対象に操作することもできます。この柔軟性により bytes " -"と bytearray を自由に混ぜてもエラーを起こすことなく扱うことができます。ただ" -"し、操作の結果のオブジェクトはその操作の順序に依存することになります。" +"bytes オブジェクトと bytearray オブジェクトは、どちらも :ref:`共通のシーケン" +"ス演算 ` をサポートします。\n" +"同じ型のオペランドだけでなく、任意の :term:`bytes-like object` とも相互に演算" +"できます。\n" +"この柔軟性により、これらの型を演算で自由に混在させてもエラーにはなりませ" +"ん。\n" +"ただし、結果の型はオペランドの順序によって異なる場合があります。" #: ../../library/stdtypes.rst:3085 msgid "" @@ -5413,31 +5609,32 @@ msgstr "" "と bytearray オブジェクトのメソッドは引数として文字列を受け付けません。例え" "ば、以下のように書かなければなりません::" -#: ../../library/stdtypes.rst:3089 msgid "" "a = \"abc\"\n" "b = a.replace(\"a\", \"f\")" msgstr "" +"a = \"abc\"\n" +"b = a.replace(\"a\", \"f\")" #: ../../library/stdtypes.rst:3092 msgid "and::" msgstr "および::" -#: ../../library/stdtypes.rst:3094 msgid "" "a = b\"abc\"\n" "b = a.replace(b\"a\", b\"f\")" msgstr "" +"a = b\"abc\"\n" +"b = a.replace(b\"a\", b\"f\")" -#: ../../library/stdtypes.rst:3097 msgid "" "Some bytes and bytearray operations assume the use of ASCII compatible " "binary formats, and hence should be avoided when working with arbitrary " "binary data. These restrictions are covered below." msgstr "" -"いくつかの bytes と bytearray の操作は ASCII と互換性のあるバイナリフォーマッ" -"トが使われていると仮定していますので、フォーマットの不明なバイナリデータに対" -"して使うことは避けるべきです。こうした制約については以下で説明します。" +"bytes と bytearray の一部の操作は、ASCII 互換のバイナリ形式を前提としているた" +"め、任意のバイナリデータを扱う際には避けるべきです。\n" +"これらの制約については後述します。" #: ../../library/stdtypes.rst:3102 msgid "" @@ -5499,13 +5696,16 @@ msgstr "" "バリナリーデータが文字列 *prefix* で始まる場合、 ``bytes[len(prefix):]`` を" "返します。それ以外の場合、元のバイナリーデータのコピーを返します::" -#: ../../library/stdtypes.rst:3132 msgid "" ">>> b'TestHook'.removeprefix(b'Test')\n" "b'Hook'\n" ">>> b'BaseTestCase'.removeprefix(b'Test')\n" "b'BaseTestCase'" msgstr "" +">>> b'TestHook'.removeprefix(b'Test')\n" +"b'Hook'\n" +">>> b'BaseTestCase'.removeprefix(b'Test')\n" +"b'BaseTestCase'" #: ../../library/stdtypes.rst:3137 msgid "The *prefix* may be any :term:`bytes-like object`." @@ -5537,13 +5737,16 @@ msgstr "" "``bytes[:-len(suffix)]`` を返します。それ以外の場合、元のバイナリーデータのコ" "ピーを返します::" -#: ../../library/stdtypes.rst:3154 msgid "" ">>> b'MiscTests'.removesuffix(b'Tests')\n" "b'Misc'\n" ">>> b'TmpDirMixin'.removesuffix(b'Tests')\n" "b'TmpDirMixin'" msgstr "" +">>> b'MiscTests'.removesuffix(b'Tests')\n" +"b'Misc'\n" +">>> b'TmpDirMixin'.removesuffix(b'Tests')\n" +"b'TmpDirMixin'" #: ../../library/stdtypes.rst:3159 msgid "The *suffix* may be any :term:`bytes-like object`." @@ -5625,11 +5828,12 @@ msgstr "" "す。 *sub* が部分文字列 (訳注: おそらく原文の誤り、正しくは部分シーケンス) で" "あるかどうかのみを調べるには、 :keyword:`in` 演算子を使ってください::" -#: ../../library/stdtypes.rst:3229 msgid "" ">>> b'Py' in b'Python'\n" "True" msgstr "" +">>> b'Py' in b'Python'\n" +"True" #: ../../library/stdtypes.rst:3239 msgid "" @@ -5654,17 +5858,17 @@ msgstr "" "が送出されます。なお要素間のセパレータは、このメソッドを提供する bytes また" "は bytearray オブジェクトとなります。" -#: ../../library/stdtypes.rst:3263 msgid "" "This static method returns a translation table usable for :meth:`bytes." "translate` that will map each character in *from* into the character at the " "same position in *to*; *from* and *to* must both be :term:`bytes-like " "objects ` and have the same length." msgstr "" -"この静的メソッドは、 :func:`bytes.translate` に渡すのに適した変換テーブルを返" -"します。このテーブルは、 *from* 中の各バイトを *to* の同じ位置にあるバイトに" -"マッピングします。 *from* と *to* は両方とも同じ長さの :term:`bytes-like " -"objects ` でなければなりません。" +"この静的メソッドは、:meth:`bytes.translate` に使える変換テーブルを返しま" +"す。\n" +"このテーブルは ``from`` の各文字を ``to`` の同じ位置の文字にマップします。\n" +"``from`` と ``to`` は両方とも :term:`bytes-like オブジェクト ` で、同じ長さでなければなりません。" #: ../../library/stdtypes.rst:3274 msgid "" @@ -5778,11 +5982,12 @@ msgid "" msgstr "" "文字を削除するだけの変換には、 *table* 引数を ``None`` に設定してください::" -#: ../../library/stdtypes.rst:3366 msgid "" ">>> b'read this short text'.translate(None, b'aeiou')\n" "b'rd ths shrt txt'" msgstr "" +">>> b'read this short text'.translate(None, b'aeiou')\n" +"b'rd ths shrt txt'" #: ../../library/stdtypes.rst:3369 msgid "*delete* is now supported as a keyword argument." @@ -5842,13 +6047,16 @@ msgstr "" "`bytearray.isspace` を参照) が除去されます。なお *chars* 引数と一致する接頭辞" "が除去されるのではなく、それに含まれるバイトの組み合わせ全てが除去されます::" -#: ../../library/stdtypes.rst:3417 msgid "" ">>> b' spacious '.lstrip()\n" "b'spacious '\n" ">>> b'www.example.com'.lstrip(b'cmowz.')\n" "b'example.com'" msgstr "" +">>> b' spacious '.lstrip()\n" +"b'spacious '\n" +">>> b'www.example.com'.lstrip(b'cmowz.')\n" +"b'example.com'" #: ../../library/stdtypes.rst:3422 msgid "" @@ -5861,13 +6069,16 @@ msgstr "" "した文字列そのものを接頭辞として削除するメソッドについては、 :meth:`~bytes." "removeprefix` を参照してください。使用例::" -#: ../../library/stdtypes.rst:3427 msgid "" ">>> b'Arthur: three!'.lstrip(b'Arthur: ')\n" "b'ee!'\n" ">>> b'Arthur: three!'.removeprefix(b'Arthur: ')\n" "b'three!'" msgstr "" +">>> b'Arthur: three!'.lstrip(b'Arthur: ')\n" +"b'ee!'\n" +">>> b'Arthur: three!'.removeprefix(b'Arthur: ')\n" +"b'three!'" #: ../../library/stdtypes.rst:3441 msgid "" @@ -5912,13 +6123,16 @@ msgstr "" "`bytearray.isspace` を参照) が除去されます。なお *chars* 引数と一致する接尾辞" "が除去されるのではなく、それに含まれるバイトの組み合わせ全てが除去されます::" -#: ../../library/stdtypes.rst:3473 msgid "" ">>> b' spacious '.rstrip()\n" "b' spacious'\n" ">>> b'mississippi'.rstrip(b'ipz')\n" "b'mississ'" msgstr "" +">>> b' spacious '.rstrip()\n" +"b' spacious'\n" +">>> b'mississippi'.rstrip(b'ipz')\n" +"b'mississ'" #: ../../library/stdtypes.rst:3478 msgid "" @@ -5931,13 +6145,16 @@ msgstr "" "した文字列そのものを接尾辞として削除するメソッドについては、 :meth:`~bytes." "removesuffix` を参照してください。使用例::" -#: ../../library/stdtypes.rst:3483 msgid "" ">>> b'Monty Python'.rstrip(b' Python')\n" "b'M'\n" ">>> b'Monty Python'.removesuffix(b' Python')\n" "b'Monty'" msgstr "" +">>> b'Monty Python'.rstrip(b' Python')\n" +"b'M'\n" +">>> b'Monty Python'.removesuffix(b' Python')\n" +"b'Monty'" #: ../../library/stdtypes.rst:3497 msgid "" @@ -5953,7 +6170,6 @@ msgstr "" "す)。 *maxsplit* が指定されていないか ``-1`` のとき、分割の回数に制限はありま" "せん (可能なだけ分割されます)。" -#: ../../library/stdtypes.rst:3503 msgid "" "If *sep* is given, consecutive delimiters are not grouped together and are " "deemed to delimit empty subsequences (for example, ``b'1,,2'.split(b',')`` " @@ -5963,14 +6179,14 @@ msgid "" "the type of object being split. The *sep* argument may be any :term:`bytes-" "like object`." msgstr "" -"*sep* が与えられた場合、連続した区切り用バイト値はまとめられず、空の部分シー" -"ケンスを区切っていると判断されます(例えば ``b'1,,2'.split(b',')`` は " -"``[b'1', b'', b'2']`` を返します)。引数 *sep* は複数バイトのシーケンスを1つの" -"区切り文字にもできます。空のシーケンスを分割すると、分割するオブジェクトの型" -"によって ``[b'']`` または ``[bytearray(b'')]`` が返ります。引数 *sep* には、" -"あらゆる :term:`bytes-like object` を指定できます。" +"*sep* を指定した場合、連続する区切りは一つにまとめられず、空の部分シーケンス" +"を区切るものとみなされます (例えば ``b'1,,2'.split(b',')`` は ``[b'1', b'', " +"b'2']`` を返します)。\n" +"*sep* には、複数バイトのシーケンスを一つの区切りとして指定できます。\n" +"区切りを指定して空のシーケンスを分割すると、分割するオブジェクトの型に応じて " +"``[b'']`` または ``[bytearray(b'')]`` が返されます。\n" +"*sep* には、任意の :term:`bytes-like object` を指定できます。" -#: ../../library/stdtypes.rst:3513 msgid "" ">>> b'1,2,3'.split(b',')\n" "[b'1', b'2', b'3']\n" @@ -5981,6 +6197,14 @@ msgid "" ">>> b'1<>2<>3<4'.split(b'<>')\n" "[b'1', b'2', b'3<4']" msgstr "" +">>> b'1,2,3'.split(b',')\n" +"[b'1', b'2', b'3']\n" +">>> b'1,2,3'.split(b',', maxsplit=1)\n" +"[b'1', b'2,3']\n" +">>> b'1,2,,3,'.split(b',')\n" +"[b'1', b'2', b'', b'3', b'']\n" +">>> b'1<>2<>3<4'.split(b'<>')\n" +"[b'1', b'2', b'3<4']" #: ../../library/stdtypes.rst:3522 msgid "" @@ -5997,7 +6221,6 @@ msgstr "" "がって区切りを指定せずに空のシーケンスや ASCII 空白文字だけのシーケンスを分割" "すると、 ``[]`` が返されます。" -#: ../../library/stdtypes.rst:3532 msgid "" ">>> b'1 2 3'.split()\n" "[b'1', b'2', b'3']\n" @@ -6006,6 +6229,12 @@ msgid "" ">>> b' 1 2 3 '.split()\n" "[b'1', b'2', b'3']" msgstr "" +">>> b'1 2 3'.split()\n" +"[b'1', b'2', b'3']\n" +">>> b'1 2 3'.split(maxsplit=1)\n" +"[b'1', b'2 3']\n" +">>> b' 1 2 3 '.split()\n" +"[b'1', b'2', b'3']" #: ../../library/stdtypes.rst:3543 msgid "" @@ -6024,13 +6253,16 @@ msgstr "" "する接頭辞および接尾辞が除去されるのではなく、それに含まれるバイトの組み合わ" "せ全てが除去されます::" -#: ../../library/stdtypes.rst:3551 msgid "" ">>> b' spacious '.strip()\n" "b'spacious'\n" ">>> b'www.example.com'.strip(b'cmowz.')\n" "b'example'" msgstr "" +">>> b' spacious '.strip()\n" +"b'spacious'\n" +">>> b'www.example.com'.strip(b'cmowz.')\n" +"b'example'" #: ../../library/stdtypes.rst:3556 msgid "" @@ -6090,13 +6322,16 @@ msgstr "" "ト値の表示のされ方(訳注: 全角、半角など)に関わらず現桁位置を 1 つ増加させま" "す::" -#: ../../library/stdtypes.rst:3600 msgid "" ">>> b'01\\t012\\t0123\\t01234'.expandtabs()\n" "b'01 012 0123 01234'\n" ">>> b'01\\t012\\t0123\\t01234'.expandtabs(4)\n" "b'01 012 0123 01234'" msgstr "" +">>> b'01\\t012\\t0123\\t01234'.expandtabs()\n" +"b'01 012 0123 01234'\n" +">>> b'01\\t012\\t0123\\t01234'.expandtabs(4)\n" +"b'01 012 0123 01234'" #: ../../library/stdtypes.rst:3614 msgid "" @@ -6112,13 +6347,16 @@ msgstr "" "``b'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'`` に含まれるバイト" "値です。 ASCII 文字の数字とは ``b'0123456789'`` に含まれるバイト値です。" -#: ../../library/stdtypes.rst:3622 msgid "" ">>> b'ABCabc1'.isalnum()\n" "True\n" ">>> b'ABC abc1'.isalnum()\n" "False" msgstr "" +">>> b'ABCabc1'.isalnum()\n" +"True\n" +">>> b'ABC abc1'.isalnum()\n" +"False" #: ../../library/stdtypes.rst:3631 msgid "" @@ -6133,13 +6371,16 @@ msgstr "" "``b'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'`` に含まれるバイト" "値です。" -#: ../../library/stdtypes.rst:3638 msgid "" ">>> b'ABCabc'.isalpha()\n" "True\n" ">>> b'ABCabc1'.isalpha()\n" "False" msgstr "" +">>> b'ABCabc'.isalpha()\n" +"True\n" +">>> b'ABCabc1'.isalpha()\n" +"False" #: ../../library/stdtypes.rst:3647 msgid "" @@ -6160,13 +6401,16 @@ msgstr "" "``True`` を、そうでなければ ``False`` を返します。ここでの ASCII 文字の数字と" "は ``b'0123456789'`` に含まれるバイト値です。" -#: ../../library/stdtypes.rst:3663 msgid "" ">>> b'1234'.isdigit()\n" "True\n" ">>> b'1.23'.isdigit()\n" "False" msgstr "" +">>> b'1234'.isdigit()\n" +"True\n" +">>> b'1.23'.isdigit()\n" +"False" #: ../../library/stdtypes.rst:3672 msgid "" @@ -6177,13 +6421,16 @@ msgstr "" "ファベットの ASCII 文字が一つも無い場合に ``True`` を返します。そうでなけれ" "ば ``False`` を返します。" -#: ../../library/stdtypes.rst:3677 msgid "" ">>> b'hello world'.islower()\n" "True\n" ">>> b'Hello world'.islower()\n" "False" msgstr "" +">>> b'hello world'.islower()\n" +"True\n" +">>> b'Hello world'.islower()\n" +"False" #: ../../library/stdtypes.rst:3682 ../../library/stdtypes.rst:3724 #: ../../library/stdtypes.rst:3740 ../../library/stdtypes.rst:3790 @@ -6219,13 +6466,16 @@ msgstr "" "``True`` を、そうでなければ ``False`` を返します。「タイトルケース文字列」の" "定義については :meth:`bytes.title` を参照してください。" -#: ../../library/stdtypes.rst:3705 msgid "" ">>> b'Hello World'.istitle()\n" "True\n" ">>> b'Hello world'.istitle()\n" "False" msgstr "" +">>> b'Hello World'.istitle()\n" +"True\n" +">>> b'Hello world'.istitle()\n" +"False" #: ../../library/stdtypes.rst:3714 msgid "" @@ -6237,13 +6487,16 @@ msgstr "" "ファベットの ASCII 文字が一つも無い場合に ``True`` を返します。そうでなけれ" "ば ``False`` を返します。" -#: ../../library/stdtypes.rst:3719 msgid "" ">>> b'HELLO WORLD'.isupper()\n" "True\n" ">>> b'Hello world'.isupper()\n" "False" msgstr "" +">>> b'HELLO WORLD'.isupper()\n" +"True\n" +">>> b'Hello world'.isupper()\n" +"False" #: ../../library/stdtypes.rst:3732 msgid "" @@ -6253,11 +6506,12 @@ msgstr "" "シーケンスに含まれる大文字アルファベットの ASCII 文字を全て小文字アルファベッ" "トに変換したシーケンスのコピーを返します。" -#: ../../library/stdtypes.rst:3737 msgid "" ">>> b'Hello World'.lower()\n" "b'hello world'" msgstr "" +">>> b'Hello World'.lower()\n" +"b'hello world'" #: ../../library/stdtypes.rst:3757 msgid "" @@ -6271,54 +6525,61 @@ msgstr "" "*keepends* 引数に真を与えた場合を除き、改行コードは結果のリストに含まれませ" "ん。" -#: ../../library/stdtypes.rst:3764 msgid "" ">>> b'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines()\n" "[b'ab c', b'', b'de fg', b'kl']\n" ">>> b'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines(keepends=True)\n" "[b'ab c\\n', b'\\n', b'de fg\\r', b'kl\\r\\n']" msgstr "" +">>> b'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines()\n" +"[b'ab c', b'', b'de fg', b'kl']\n" +">>> b'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines(keepends=True)\n" +"[b'ab c\\n', b'\\n', b'de fg\\r', b'kl\\r\\n']" -#: ../../library/stdtypes.rst:3769 msgid "" "Unlike :meth:`~bytes.split` when a delimiter string *sep* is given, this " "method returns an empty list for the empty string, and a terminal line break " "does not result in an extra line::" msgstr "" -":meth:`~bytes.split` とは違って、空シーケンスに対して区切り *sep* を与えて呼" -"び出すと空のリストを返します。またシーケンス末尾に改行コードがある場合、(訳" -"註: その後ろに空行があるとは判断せず)余分な行を生成することはありません::" +"区切り文字列 *sep* を指定した :meth:`~bytes.split` とは異なり、\n" +"このメソッドは空のシーケンスに対して空のリストを返し、末尾に改行があっても余" +"分な行を追加しません::" -#: ../../library/stdtypes.rst:3773 msgid "" ">>> b\"\".split(b'\\n'), b\"Two lines\\n\".split(b'\\n')\n" "([b''], [b'Two lines', b''])\n" ">>> b\"\".splitlines(), b\"One line\\n\".splitlines()\n" "([], [b'One line'])" msgstr "" +">>> b\"\".split(b'\\n'), b\"Two lines\\n\".split(b'\\n')\n" +"([b''], [b'Two lines', b''])\n" +">>> b\"\".splitlines(), b\"One line\\n\".splitlines()\n" +"([], [b'One line'])" -#: ../../library/stdtypes.rst:3782 msgid "" "Return a copy of the sequence with all the lowercase ASCII characters " "converted to their corresponding uppercase counterpart and vice-versa." msgstr "" -"シーケンスに含まれる小文字アルファベットの ASCII 文字を全て大文字アルファベッ" -"トに変換し、さらに大文字アルファベットを同様に小文字アルファベットに変換した" -"シーケンスのコピーを返します。" +"シーケンス内の小文字の ASCII 文字を対応する大文字に、大文字の ASCII 文字を対" +"応する小文字に変換したコピーを返します。" -#: ../../library/stdtypes.rst:3787 msgid "" ">>> b'Hello World'.swapcase()\n" "b'hELLO wORLD'" msgstr "" +">>> b'Hello World'.swapcase()\n" +"b'hELLO wORLD'" -#: ../../library/stdtypes.rst:3794 msgid "" "Unlike :func:`str.swapcase`, it is always the case that ``bin.swapcase()." "swapcase() == bin`` for the binary versions. Case conversions are " "symmetrical in ASCII, even though that is not generally true for arbitrary " "Unicode code points." msgstr "" +":func:`str.swapcase` とは異なり、バイナリ版では ``bin.swapcase().swapcase() " +"== bin`` が常に成り立ちます。\n" +"任意の Unicode コードポイントについては一般に成り立ちませんが、ASCII では大文" +"字と小文字の変換が対称だからです。" #: ../../library/stdtypes.rst:3808 msgid "" @@ -6331,11 +6592,12 @@ msgstr "" "なっているシーケンスが返ります。大文字小文字の区別が無いバイト値については変" "更されずそのままになります。" -#: ../../library/stdtypes.rst:3814 msgid "" ">>> b'Hello world'.title()\n" "b'Hello World'" msgstr "" +">>> b'Hello world'.title()\n" +"b'Hello World'" #: ../../library/stdtypes.rst:3817 msgid "" @@ -6349,18 +6611,18 @@ msgstr "" "に含まれるバイト値です。その他のバイト値については、大文字小文字の区別はあり" "ません。" -#: ../../library/stdtypes.rst:3827 msgid "" ">>> b\"they're bill's friends from the UK\".title()\n" "b\"They'Re Bill'S Friends From The Uk\"" msgstr "" +">>> b\"they're bill's friends from the UK\".title()\n" +"b\"They'Re Bill'S Friends From The Uk\"" #: ../../library/stdtypes.rst:3830 msgid "" "A workaround for apostrophes can be constructed using regular expressions::" msgstr "正規表現を使うことでアポストロフィに対応できます::" -#: ../../library/stdtypes.rst:3832 msgid "" ">>> import re\n" ">>> def titlecase(s):\n" @@ -6372,6 +6634,15 @@ msgid "" ">>> titlecase(b\"they're bill's friends.\")\n" "b\"They're Bill's Friends.\"" msgstr "" +">>> import re\n" +">>> def titlecase(s):\n" +"... return re.sub(rb\"[A-Za-z]+('[A-Za-z]+)?\",\n" +"... lambda mo: mo.group(0)[0:1].upper() +\n" +"... mo.group(0)[1:].lower(),\n" +"... s)\n" +"...\n" +">>> titlecase(b\"they're bill's friends.\")\n" +"b\"They're Bill's Friends.\"" #: ../../library/stdtypes.rst:3851 msgid "" @@ -6381,13 +6652,13 @@ msgstr "" "シーケンスに含まれる小文字アルファベットの ASCII 文字を全て大文字アルファベッ" "トに変換したシーケンスのコピーを返します。" -#: ../../library/stdtypes.rst:3856 msgid "" ">>> b'Hello World'.upper()\n" "b'HELLO WORLD'" msgstr "" +">>> b'Hello World'.upper()\n" +"b'HELLO WORLD'" -#: ../../library/stdtypes.rst:3872 msgid "" "Return a copy of the sequence left filled with ASCII ``b'0'`` digits to make " "a sequence of length *width*. A leading sign prefix (``b'+'``/ ``b'-'``) is " @@ -6395,18 +6666,23 @@ msgid "" "before. For :class:`bytes` objects, the original sequence is returned if " "*width* is less than or equal to ``len(seq)``." msgstr "" -"長さが *width* になるよう ASCII ``b'0'`` で左詰めしたシーケンスのコピーを返し" -"ます。先頭が符号接頭辞 (``b'+'``/``b'-'``) だった場合、 ``b'0'`` は符号の前で" -"はなく *後* に挿入されます。 :class:`bytes` オブジェクトの場合、 *width* が " -"``len(seq)`` 以下であれば元のシーケンスが返ります。" +"長さが ``width`` になるよう、左側を ASCII ``b'0'`` で埋めたシーケンスのコピー" +"を返します。\n" +"先頭に符号接頭辞 (``b'+'``/ ``b'-'``) がある場合は、符号文字の前ではなく *後" +"* にパディングを挿入します。\n" +":class:`bytes` オブジェクトの場合、``width`` が ``len(seq)`` 以下なら元のシー" +"ケンスを返します。" -#: ../../library/stdtypes.rst:3880 msgid "" ">>> b\"42\".zfill(5)\n" "b'00042'\n" ">>> b\"-42\".zfill(5)\n" "b'-0042'" msgstr "" +">>> b\"42\".zfill(5)\n" +"b'00042'\n" +">>> b\"-42\".zfill(5)\n" +"b'-0042'" #: ../../library/stdtypes.rst:3894 msgid "``printf``-style Bytes Formatting" @@ -6568,13 +6844,12 @@ msgstr "" "tolist` の長さと等しくなります。ビューが ``view.ndim = 1`` を満たす場合は" "ビューの要素数とも等しくなります。" -#: ../../library/stdtypes.rst:4122 msgid "" "If ``view.ndim == 0``, ``len(view)`` now raises :exc:`TypeError` instead of " "returning 1." msgstr "" -"``view.ndim == 0`` で ``len(view)`` の場合、1の代わりに :exc:`TypeError` を返" -"すようになりました。" +"``view.ndim == 0`` の場合、``len(view)`` は 1 を返す代わりに :exc:" +"`TypeError` を送出するようになりました。" #: ../../library/stdtypes.rst:4125 msgid "" @@ -6590,7 +6865,6 @@ msgstr "" ":class:`memoryview` はスライスおよびインデックス指定で内容を取得できます。一" "次元のスライスは部分ビューになります::" -#: ../../library/stdtypes.rst:4131 msgid "" ">>> v = memoryview(b'abcefg')\n" ">>> v[1]\n" @@ -6602,6 +6876,15 @@ msgid "" ">>> bytes(v[1:4])\n" "b'bce'" msgstr "" +">>> v = memoryview(b'abcefg')\n" +">>> v[1]\n" +"98\n" +">>> v[-1]\n" +"103\n" +">>> v[1:4]\n" +"\n" +">>> bytes(v[1:4])\n" +"b'bce'" #: ../../library/stdtypes.rst:4141 msgid "" @@ -6623,9 +6906,8 @@ msgstr "" #: ../../library/stdtypes.rst:4150 msgid "Here is an example with a non-byte format::" -msgstr ":class:`~memoryview.format` が単バイト単位ではない例を示します::" +msgstr "``format`` が単バイト単位ではない例を示します::" -#: ../../library/stdtypes.rst:4152 msgid "" ">>> import array\n" ">>> a = array.array('l', [-11111111, 22222222, -33333333, 44444444])\n" @@ -6637,6 +6919,15 @@ msgid "" ">>> m[::2].tolist()\n" "[-11111111, -33333333]" msgstr "" +">>> import array\n" +">>> a = array.array('l', [-11111111, 22222222, -33333333, 44444444])\n" +">>> m = memoryview(a)\n" +">>> m[0]\n" +"-11111111\n" +">>> m[-1]\n" +"44444444\n" +">>> m[::2].tolist()\n" +"[-11111111, -33333333]" #: ../../library/stdtypes.rst:4162 msgid "" @@ -6646,7 +6937,6 @@ msgstr "" "メモリビューの参照しているオブジェクトが書き込み可能であれば、一次元スライス" "での代入が可能です。ただしサイズの変更はできません::" -#: ../../library/stdtypes.rst:4165 msgid "" ">>> data = bytearray(b'abcefg')\n" ">>> v = memoryview(data)\n" @@ -6667,6 +6957,24 @@ msgid "" ">>> data\n" "bytearray(b'z1spam')" msgstr "" +">>> data = bytearray(b'abcefg')\n" +">>> v = memoryview(data)\n" +">>> v.readonly\n" +"False\n" +">>> v[0] = ord(b'z')\n" +">>> data\n" +"bytearray(b'zbcefg')\n" +">>> v[1:4] = b'123'\n" +">>> data\n" +"bytearray(b'z123fg')\n" +">>> v[2:3] = b'spam'\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"ValueError: memoryview assignment: lvalue and rvalue have different " +"structures\n" +">>> v[2:6] = b'spam'\n" +">>> data\n" +"bytearray(b'z1spam')" #: ../../library/stdtypes.rst:4183 msgid "" @@ -6678,7 +6986,6 @@ msgstr "" "み出し専用の) 型の1次元メモリビューもまた、ハッシュ可能です。ハッシュは " "``hash(m) == hash(m.tobytes())`` として定義されています::" -#: ../../library/stdtypes.rst:4187 msgid "" ">>> v = memoryview(b'abcefg')\n" ">>> hash(v) == hash(b'abcefg')\n" @@ -6688,6 +6995,13 @@ msgid "" ">>> hash(v[::-2]) == hash(b'abcefg'[::-2])\n" "True" msgstr "" +">>> v = memoryview(b'abcefg')\n" +">>> hash(v) == hash(b'abcefg')\n" +"True\n" +">>> hash(v[2:4]) == hash(b'ce')\n" +"True\n" +">>> hash(v[::-2]) == hash(b'abcefg'[::-2])\n" +"True" #: ../../library/stdtypes.rst:4195 msgid "" @@ -6710,9 +7024,8 @@ msgstr "" msgid "memoryviews can now be indexed with tuple of integers." msgstr "メモリビューは整数のタプルでインデックス指定できるようになりました。" -#: ../../library/stdtypes.rst:4206 msgid "memoryview is now a :term:`generic type`." -msgstr "" +msgstr "memoryview が :term:`ジェネリック型 ` になりました。" #: ../../library/stdtypes.rst:4209 msgid ":class:`memoryview` has several methods:" @@ -6735,7 +7048,6 @@ msgstr "" ":meth:`tolist` がサポートしている :mod:`struct` フォーマットの一部では、 ``v." "tolist() == w.tolist()`` が成り立つときに ``v`` == ``w`` になります::" -#: ../../library/stdtypes.rst:4220 msgid "" ">>> import array\n" ">>> a = array.array('I', [1, 2, 3, 4, 5])\n" @@ -6753,6 +7065,21 @@ msgid "" ">>> z.tolist() == c.tolist()\n" "True" msgstr "" +">>> import array\n" +">>> a = array.array('I', [1, 2, 3, 4, 5])\n" +">>> b = array.array('d', [1.0, 2.0, 3.0, 4.0, 5.0])\n" +">>> c = array.array('b', [5, 3, 1])\n" +">>> x = memoryview(a)\n" +">>> y = memoryview(b)\n" +">>> x == a == y == b\n" +"True\n" +">>> x.tolist() == a.tolist() == y.tolist() == b.tolist()\n" +"True\n" +">>> z = y[::-2]\n" +">>> z == c\n" +"True\n" +">>> z.tolist() == c.tolist()\n" +"True" #: ../../library/stdtypes.rst:4236 msgid "" @@ -6764,7 +7091,6 @@ msgstr "" "(書式文字列とバッファの内容が同一でも) オブジェクトは常に等しくないものとして" "比較されます::" -#: ../../library/stdtypes.rst:4240 msgid "" ">>> from ctypes import BigEndianStructure, c_long\n" ">>> class BEPoint(BigEndianStructure):\n" @@ -6778,6 +7104,17 @@ msgid "" ">>> a == b\n" "False" msgstr "" +">>> from ctypes import BigEndianStructure, c_long\n" +">>> class BEPoint(BigEndianStructure):\n" +"... _fields_ = [(\"x\", c_long), (\"y\", c_long)]\n" +"...\n" +">>> point = BEPoint(100, 200)\n" +">>> a = memoryview(point)\n" +">>> b = memoryview(point)\n" +">>> a == point\n" +"False\n" +">>> a == b\n" +"False" #: ../../library/stdtypes.rst:4252 msgid "" @@ -6803,7 +7140,6 @@ msgstr "" "バッファ中のデータをバイト文字列として返します。これはメモリビューに対して :" "class:`bytes` コンストラクタを呼び出すのと同等です。 ::" -#: ../../library/stdtypes.rst:4264 msgid "" ">>> m = memoryview(b\"abc\")\n" ">>> m.tobytes()\n" @@ -6811,6 +7147,11 @@ msgid "" ">>> bytes(m)\n" "b'abc'" msgstr "" +">>> m = memoryview(b\"abc\")\n" +">>> m.tobytes()\n" +"b'abc'\n" +">>> bytes(m)\n" +"b'abc'" #: ../../library/stdtypes.rst:4270 msgid "" @@ -6838,18 +7179,20 @@ msgstr "" "連続なデータに対するビューの場合、データはまず C のデータ並びに変換されま" "す。 *order=None* は *order='C'* と同じです。" -#: ../../library/stdtypes.rst:4284 msgid "" "Return a string object containing two hexadecimal digits for each byte in " "the buffer. ::" -msgstr "バッファ中の各バイトを 2 つの 16 進数で表した文字列を返します::" +msgstr "" +"バッファ内の各バイトを2桁の16進数字で表した文字列オブジェクトを返します。 ::" -#: ../../library/stdtypes.rst:4287 msgid "" ">>> m = memoryview(b\"abc\")\n" ">>> m.hex()\n" "'616263'" msgstr "" +">>> m = memoryview(b\"abc\")\n" +">>> m.hex()\n" +"'616263'" #: ../../library/stdtypes.rst:4293 msgid "" @@ -6865,7 +7208,6 @@ msgstr "" msgid "Return the data in the buffer as a list of elements. ::" msgstr "バッファ中のデータを要素のリストとして返します。 ::" -#: ../../library/stdtypes.rst:4302 msgid "" ">>> memoryview(b'abc').tolist()\n" "[97, 98, 99]\n" @@ -6875,6 +7217,13 @@ msgid "" ">>> m.tolist()\n" "[1.1, 2.2, 3.3]" msgstr "" +">>> memoryview(b'abc').tolist()\n" +"[97, 98, 99]\n" +">>> import array\n" +">>> a = array.array('d', [1.1, 2.2, 3.3])\n" +">>> m = memoryview(a)\n" +">>> m.tolist()\n" +"[1.1, 2.2, 3.3]" #: ../../library/stdtypes.rst:4310 msgid "" @@ -6892,7 +7241,6 @@ msgstr "" "読み込み専用のメモリビューオブジェクトを返します。元のメモリビューオブジェク" "トは変更されません。 ::" -#: ../../library/stdtypes.rst:4320 msgid "" ">>> m = memoryview(bytearray(b'abc'))\n" ">>> mm = m.toreadonly()\n" @@ -6906,6 +7254,17 @@ msgid "" ">>> mm.tolist()\n" "[43, 98, 99]" msgstr "" +">>> m = memoryview(bytearray(b'abc'))\n" +">>> mm = m.toreadonly()\n" +">>> mm.tolist()\n" +"[97, 98, 99]\n" +">>> mm[0] = 42\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"TypeError: cannot modify read-only memory\n" +">>> m[0] = 43\n" +">>> mm.tolist()\n" +"[43, 98, 99]" #: ../../library/stdtypes.rst:4336 msgid "" @@ -6928,7 +7287,6 @@ msgid "" "multiple times)::" msgstr "" -#: ../../library/stdtypes.rst:4346 msgid "" ">>> m = memoryview(b'abc')\n" ">>> m.release()\n" @@ -6937,6 +7295,12 @@ msgid "" " File \"\", line 1, in \n" "ValueError: operation forbidden on released memoryview object" msgstr "" +">>> m = memoryview(b'abc')\n" +">>> m.release()\n" +">>> m[0]\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"ValueError: operation forbidden on released memoryview object" #: ../../library/stdtypes.rst:4353 msgid "" @@ -6946,7 +7310,6 @@ msgstr "" "コンテキストマネージャプロトコルは、 ``with`` 文を使って同様の効果を得るのに" "使えます::" -#: ../../library/stdtypes.rst:4356 msgid "" ">>> with memoryview(b'abc') as m:\n" "... m[0]\n" @@ -6957,8 +7320,15 @@ msgid "" " File \"\", line 1, in \n" "ValueError: operation forbidden on released memoryview object" msgstr "" +">>> with memoryview(b'abc') as m:\n" +"... m[0]\n" +"...\n" +"97\n" +">>> m[0]\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"ValueError: operation forbidden on released memoryview object" -#: ../../library/stdtypes.rst:4369 msgid "" "Cast a memoryview to a new format or shape. *shape* defaults to " "``[byte_length//new_itemsize]``, which means that the result view will be " @@ -6966,30 +7336,31 @@ msgid "" "is not copied. Supported casts are 1D -> C-:term:`contiguous` and C-" "contiguous -> 1D." msgstr "" -"memoryview を新しいフォーマットか shape にキャストします。 *shape* はデフォル" -"トで ``[byte_length//new_itemsize]`` で、 1次元配列になります。戻り値は " -"memoryview ですが、バッファー自体はコピーされません。サポートされている変換" -"は 1次元配列 -> C言語型の連続配列 と C言語型の連続配列 -> 1次元配列 です(参" -"考: :term:`contiguous`)。" +"memoryview を新しいフォーマットまたは形状にキャストします。\n" +"*shape* のデフォルト値は ``[byte_length//new_itemsize]`` で、結果のビューは1" +"次元になります。\n" +"返り値は新しい memoryview ですが、バッファ自体はコピーされません。\n" +"サポートされるキャストは、1次元から C-:term:`連続 ` への変換と、" +"C-連続から1次元への変換です。" -#: ../../library/stdtypes.rst:4375 msgid "" "The destination format is restricted to a single element native format in :" "mod:`struct` syntax. One of the formats must be a byte format ('B', 'b' or " "'c'). The byte length of the result must be the same as the original length. " "Note that all byte lengths may depend on the operating system." msgstr "" -"キャスト後のフォーマットは単一要素のネイティブフォーマットに限定され、 :mod:" -"`struct` の文法で指定します。利用可能なフォーマットのひとつはバイトフォーマッ" -"ト ('B', 'b' または 'c') です。キャスト後のバイト長は元の長さと同じでなけれ" -"ばなりません。全てのフォーマットのバイト長は、オペレーティングシステムに依存" -"することに注意してください。" +"変換先のフォーマットは、:mod:`struct` の構文による単一要素のネイティブフォー" +"マットに限定されます。\n" +"変換元と変換先のフォーマットの少なくとも一方は、バイトフォーマット " +"('B'、'b'、'c') でなければなりません。\n" +"結果のバイト長は元の長さと同じでなければなりません。\n" +"各フォーマットのバイト長はオペレーティングシステムによって異なる場合があるこ" +"とに注意してください。" #: ../../library/stdtypes.rst:4381 msgid "Cast 1D/long to 1D/unsigned bytes::" msgstr "1次元 long から 1次元 unsigned byte へのキャスト::" -#: ../../library/stdtypes.rst:4383 msgid "" ">>> import array\n" ">>> a = array.array('l', [1,2,3])\n" @@ -7012,12 +7383,31 @@ msgid "" ">>> y.nbytes\n" "24" msgstr "" +">>> import array\n" +">>> a = array.array('l', [1,2,3])\n" +">>> x = memoryview(a)\n" +">>> x.format\n" +"'l'\n" +">>> x.itemsize\n" +"8\n" +">>> len(x)\n" +"3\n" +">>> x.nbytes\n" +"24\n" +">>> y = x.cast('B')\n" +">>> y.format\n" +"'B'\n" +">>> y.itemsize\n" +"1\n" +">>> len(y)\n" +"24\n" +">>> y.nbytes\n" +"24" #: ../../library/stdtypes.rst:4404 msgid "Cast 1D/unsigned bytes to 1D/char::" msgstr "1次元 unsigned byte から 1次元 char へのキャスト::" -#: ../../library/stdtypes.rst:4406 msgid "" ">>> b = bytearray(b'zyz')\n" ">>> x = memoryview(b)\n" @@ -7030,12 +7420,21 @@ msgid "" ">>> b\n" "bytearray(b'ayz')" msgstr "" +">>> b = bytearray(b'zyz')\n" +">>> x = memoryview(b)\n" +">>> x[0] = b'a'\n" +"Traceback (most recent call last):\n" +" ...\n" +"TypeError: memoryview: invalid type for format 'B'\n" +">>> y = x.cast('c')\n" +">>> y[0] = b'a'\n" +">>> b\n" +"bytearray(b'ayz')" #: ../../library/stdtypes.rst:4417 msgid "Cast 1D/bytes to 3D/ints to 1D/signed char::" msgstr "1次元 byte から 3次元 int へ、そして 1次元 signed char へのキャスト::" -#: ../../library/stdtypes.rst:4419 msgid "" ">>> import struct\n" ">>> buf = struct.pack(\"i\"*12, *list(range(12)))\n" @@ -7061,12 +7460,34 @@ msgid "" ">>> z.nbytes\n" "48" msgstr "" +">>> import struct\n" +">>> buf = struct.pack(\"i\"*12, *list(range(12)))\n" +">>> x = memoryview(buf)\n" +">>> y = x.cast('i', shape=[2,2,3])\n" +">>> y.tolist()\n" +"[[[0, 1, 2], [3, 4, 5]], [[6, 7, 8], [9, 10, 11]]]\n" +">>> y.format\n" +"'i'\n" +">>> y.itemsize\n" +"4\n" +">>> len(y)\n" +"2\n" +">>> y.nbytes\n" +"48\n" +">>> z = y.cast('b')\n" +">>> z.format\n" +"'b'\n" +">>> z.itemsize\n" +"1\n" +">>> len(z)\n" +"48\n" +">>> z.nbytes\n" +"48" #: ../../library/stdtypes.rst:4443 msgid "Cast 1D/unsigned long to 2D/unsigned long::" msgstr "1次元 unsigned long から 2次元 unsigned long へのキャスト::" -#: ../../library/stdtypes.rst:4445 msgid "" ">>> buf = struct.pack(\"L\"*6, *list(range(6)))\n" ">>> x = memoryview(buf)\n" @@ -7078,6 +7499,15 @@ msgid "" ">>> y.tolist()\n" "[[0, 1, 2], [3, 4, 5]]" msgstr "" +">>> buf = struct.pack(\"L\"*6, *list(range(6)))\n" +">>> x = memoryview(buf)\n" +">>> y = x.cast('L', shape=[2,3])\n" +">>> len(y)\n" +"2\n" +">>> y.nbytes\n" +"48\n" +">>> y.tolist()\n" +"[[0, 1, 2], [3, 4, 5]]" #: ../../library/stdtypes.rst:4457 msgid "The source format is no longer restricted when casting to a byte view." @@ -7085,19 +7515,18 @@ msgstr "" "単バイトのビューへキャストする場合、キャスト元のフォーマットについて制約は無" "くなりました。" -#: ../../library/stdtypes.rst:4462 msgid "Count the number of occurrences of *value*." -msgstr "" +msgstr "``value`` の出現回数を数えます。" -#: ../../library/stdtypes.rst:4468 msgid "" "Return the index of the first occurrence of *value* (at or after index " "*start* and before index *stop*)." msgstr "" +"``value`` が最初に出現する位置のインデックスを返します (インデックス " +"``start`` 以上、``stop`` 未満の範囲で検索します)。" -#: ../../library/stdtypes.rst:4471 msgid "Raises a :exc:`ValueError` if *value* cannot be found." -msgstr "" +msgstr "``value`` が見つからない場合は :exc:`ValueError` を送出します。" #: ../../library/stdtypes.rst:4475 msgid "There are also several readonly attributes available:" @@ -7107,25 +7536,42 @@ msgstr "読み出し専用の属性もいくつか使えます:" msgid "The underlying object of the memoryview::" msgstr "memoryview が参照しているオブジェクト::" -#: ../../library/stdtypes.rst:4481 msgid "" ">>> b = bytearray(b'xyz')\n" ">>> m = memoryview(b)\n" ">>> m.obj is b\n" "True" msgstr "" +">>> b = bytearray(b'xyz')\n" +">>> m = memoryview(b)\n" +">>> m.obj is b\n" +"True" -#: ../../library/stdtypes.rst:4490 msgid "" "``nbytes == product(shape) * itemsize == len(m.tobytes())``. This is the " "amount of space in bytes that the array would use in a contiguous " "representation. It is not necessarily equal to ``len(m)``::" msgstr "" -"``nbytes == product(shape) * itemsize == len(m.tobytes())``. その配列が連続表" -"現において利用するスペースです。これは ``len(m)`` と一致するとは限りません::" - -#: ../../library/stdtypes.rst:4494 -msgid "" +"``nbytes == product(shape) * itemsize == len(m.tobytes())`` です。\n" +"これは、配列を連続した表現にした場合に使う領域のバイト数です。\n" +"``len(m)`` と等しいとは限りません。 ::" + +msgid "" +">>> import array\n" +">>> a = array.array('i', [1,2,3,4,5])\n" +">>> m = memoryview(a)\n" +">>> len(m)\n" +"5\n" +">>> m.nbytes\n" +"20\n" +">>> y = m[::2]\n" +">>> len(y)\n" +"3\n" +">>> y.nbytes\n" +"12\n" +">>> len(y.tobytes())\n" +"12" +msgstr "" ">>> import array\n" ">>> a = array.array('i', [1,2,3,4,5])\n" ">>> m = memoryview(a)\n" @@ -7140,13 +7586,11 @@ msgid "" "12\n" ">>> len(y.tobytes())\n" "12" -msgstr "" #: ../../library/stdtypes.rst:4509 msgid "Multi-dimensional arrays::" msgstr "多次元配列::" -#: ../../library/stdtypes.rst:4511 msgid "" ">>> import struct\n" ">>> buf = struct.pack(\"d\"*12, *[1.5*x for x in range(12)])\n" @@ -7159,6 +7603,16 @@ msgid "" ">>> y.nbytes\n" "96" msgstr "" +">>> import struct\n" +">>> buf = struct.pack(\"d\"*12, *[1.5*x for x in range(12)])\n" +">>> x = memoryview(buf)\n" +">>> y = x.cast('d', shape=[3,4])\n" +">>> y.tolist()\n" +"[[0.0, 1.5, 3.0, 4.5], [6.0, 7.5, 9.0, 10.5], [12.0, 13.5, 15.0, 16.5]]\n" +">>> len(y)\n" +"3\n" +">>> y.nbytes\n" +"96" #: ../../library/stdtypes.rst:4526 msgid "A bool indicating whether the memory is read only." @@ -7188,7 +7642,6 @@ msgstr "" msgid "The size in bytes of each element of the memoryview::" msgstr "memoryview の各要素のバイト単位の大きさ::" -#: ../../library/stdtypes.rst:4543 msgid "" ">>> import array, struct\n" ">>> m = memoryview(array.array('H', [32000, 32001, 32002]))\n" @@ -7199,6 +7652,14 @@ msgid "" ">>> struct.calcsize('H') == m.itemsize\n" "True" msgstr "" +">>> import array, struct\n" +">>> m = memoryview(array.array('H', [32000, 32001, 32002]))\n" +">>> m.itemsize\n" +"2\n" +">>> m[0]\n" +"32000\n" +">>> struct.calcsize('H') == m.itemsize\n" +"True" #: ../../library/stdtypes.rst:4554 msgid "" @@ -7269,17 +7730,18 @@ msgstr "" "(他のコンテナについては組み込みの :class:`dict`, :class:`list`, :class:" "`tuple` クラスや :mod:`collections` モジュールを参照してください。)" -#: ../../library/stdtypes.rst:4610 msgid "" "Like other collections, sets support ``x in set``, ``len(set)``, and ``for x " "in set``. Being an unordered collection, sets do not record element " "position or order of insertion. Accordingly, sets do not support indexing, " "slicing, or other sequence-like behavior." msgstr "" -"集合は、他のコレクションと同様、 ``x in set``, ``len(set)``, ``for x in " -"set`` をサポートします。コレクションには順序がないので、集合は挿入の順序や要" -"素の位置を記録しません。従って、集合はインデクシング、スライシング、その他の" -"シーケンス的な振舞いをサポートしません。" +"集合は他のコレクションと同様に、``x in set``、``len(set)``、``for x in set`` " +"をサポートします。\n" +"集合は順序を持たないコレクションなので、要素の位置や挿入順序を記録しませ" +"ん。\n" +"そのため、インデックス指定やスライスなど、シーケンスのような動作はサポートし" +"ません。" #: ../../library/stdtypes.rst:4615 msgid "" @@ -7306,9 +7768,9 @@ msgid "" "list of elements within braces, for example: ``{'jack', 'sjoerd'}``, in " "addition to the :class:`set` constructor." msgstr "" -"空でない :class:`set` (:class:`frozenset` ではない) は、:class:`set` コンスト" -"ラクタに加え、要素を波括弧中にカンマで区切って列挙することでも生成できます。" -"例: ``{'jack', 'sjoerd'}``。" +"空でない ``set`` (``frozenset`` ではない) は、:class:`set` コンストラクタに加" +"え、要素を波括弧中にカンマで区切って列挙することでも生成できます。例: " +"``{'jack', 'sjoerd'}``。" #: ../../library/stdtypes.rst:4627 msgid "The constructors for both classes work the same:" @@ -7321,11 +7783,11 @@ msgid "" "sets of sets, the inner sets must be :class:`frozenset` objects. If " "*iterable* is not specified, a new empty set is returned." msgstr "" -"*iterable* から要素を取り込んだ、新しい :class:`set` もしくは :class:" -"`frozenset` オブジェクトを返します。 集合の要素は :term:`ハッシュ可能 " -"` なものでなくてはなりません。集合の集合を表現するためには、内側の" -"集合は :class:`frozenset` オブジェクトでなくてはなりません。*iterable* が指定" -"されない場合、新しい空の集合が返されます。" +"*iterable* から要素を取り込んだ、新しい ``set`` もしくは ``frozenset`` オブ" +"ジェクトを返します。 集合の要素は :term:`ハッシュ可能 ` なものでな" +"くてはなりません。集合の集合を表現するためには、内側の集合は :class:" +"`frozenset` オブジェクトでなくてはなりません。*iterable* が指定されない場合、" +"新しい空の集合が返されます。" #: ../../library/stdtypes.rst:4638 msgid "Sets can be created by several means:" @@ -7494,15 +7956,15 @@ msgstr "" "集合の要素は、辞書のキーのように、 :term:`ハッシュ可能 ` でなければ" "なりません。" -#: ../../library/stdtypes.rst:4737 msgid "" "Binary operations that mix :class:`set` instances with :class:`frozenset` " "return the type of the first operand. For example: ``frozenset('ab') | " "set('bc')`` returns an instance of :class:`frozenset`." msgstr "" -":class:`set` インスタンスと :class:`frozenset` インスタンスを取り混ぜての二項" -"演算は、第一被演算子の型を返します。例えば: ``frozenset('ab') | set('bc')`` " -"は :class:`frozenset` インスタンスを返します。" +":class:`set` と :class:`frozenset` のインスタンスを混在させた二項演算は、最初" +"のオペランドと同じ型のオブジェクトを返します。\n" +"例えば、``frozenset('ab') | set('bc')`` は :class:`frozenset` のインスタンス" +"を返します。" #: ../../library/stdtypes.rst:4741 msgid "" @@ -7597,7 +8059,6 @@ msgstr "" "す。 (他のコンテナについては組み込みの :class:`list`, :class:`set`, および :" "class:`tuple` クラスと、 :mod:`collections` モジュールを参照してください。)" -#: ../../library/stdtypes.rst:4817 msgid "" "A dictionary's keys are *almost* arbitrary values. Values that are not :" "term:`hashable`, that is, values containing lists, dictionaries or other " @@ -7605,12 +8066,12 @@ msgid "" "may not be used as keys. Values that compare equal (such as ``1``, ``1.0``, " "and ``True``) can be used interchangeably to index the same dictionary entry." msgstr "" -"辞書のキーには、 *ほぼ* どんな値も使うことができます。\n" -"キーとして使えないのは、 :term:`hashable` (ハッシュ可能) でない値、すなわちリ" -"ストや辞書のようなミュータブルな型 (内包する値ではなくオブジェクト自体が同一" -"であるかによって比較が行われるような型)です。\n" -"比較した際に等しいとみなされる値 (例えば ``1`` と ``1.0`` と ``True``) は、ど" -"れを使っても同じエントリーに関連付けられます。" +"辞書のキーには、*ほぼ* 任意の値を使えます。\n" +":term:`ハッシュ可能 ` でない値、すなわちリスト、辞書、その他の" +"ミュータブルな型 (オブジェクトの同一性ではなく値によって比較されるもの) を含" +"む値は、キーとして使えません。\n" +"比較すると等しい値 (例えば ``1``、``1.0``、``True``) は、どれを使っても同じ辞" +"書の項目にアクセスできます。" #: ../../library/stdtypes.rst:4828 msgid "" @@ -7644,7 +8105,6 @@ msgstr "" "型コンストラクタを使う: ``dict()``, ``dict([('foo', 100), ('bar', 200)])``, " "``dict(foo=100, bar=200)``" -#: ../../library/stdtypes.rst:4839 msgid "" "If no positional argument is given, an empty dictionary is created. If a " "positional argument is given and it defines a ``keys()`` method, a " @@ -7656,6 +8116,18 @@ msgid "" "corresponding value. If a key occurs more than once, the last value for " "that key becomes the corresponding value in the new dictionary." msgstr "" +"位置引数を指定しない場合は、空の辞書を作成します。\n" +"位置引数を指定し、そのオブジェクトに ``keys()`` メソッドが定義されている場合" +"は、そのメソッドが返す各キーを使って位置引数の :meth:`~object.__getitem__` を" +"呼び出し、辞書を作成します。\n" +"それ以外の場合、位置引数は :term:`イテラブル ` オブジェクトでなけれ" +"ばなりません。\n" +"そのイテラブル内の各要素も、それぞれちょうど二つの要素を持つイテラブルでなけ" +"ればなりません。\n" +"各要素の1番目の値が新しい辞書のキーとなり、2番目の値が対応する値となりま" +"す。\n" +"同じキーが複数回出現した場合は、そのキーの最後の値が新しい辞書での対応する値" +"となります。" #: ../../library/stdtypes.rst:4849 msgid "" @@ -7677,7 +8149,6 @@ msgstr "" "でなければなりません。それ以外の方法では、辞書のキーとして有効などんなキーで" "も使えます。" -#: ../../library/stdtypes.rst:4857 msgid "" "Dictionaries compare equal if and only if they have the same ``(key, " "value)`` pairs (regardless of ordering). Order comparisons ('<', '<=', '>=', " @@ -7685,8 +8156,12 @@ msgid "" "equality, the following examples all return a dictionary equal to " "``{\"one\": 1, \"two\": 2, \"three\": 3}``::" msgstr "" +"辞書同士は、順序に関係なく同じ ``(key, value)`` 対を持つ場合に限り等しいとみ" +"なされます。\n" +"順序比較 ('<'、'<='、'>='、'>') は :exc:`TypeError` を送出します。\n" +"辞書の作成と等価性を示す次の例は、すべて ``{\"one\": 1, \"two\": 2, " +"\"three\": 3}`` と等しい辞書を返します。 ::" -#: ../../library/stdtypes.rst:4863 msgid "" ">>> a = dict(one=1, two=2, three=3)\n" ">>> b = {'one': 1, 'two': 2, 'three': 3}\n" @@ -7697,6 +8172,14 @@ msgid "" ">>> a == b == c == d == e == f\n" "True" msgstr "" +">>> a = dict(one=1, two=2, three=3)\n" +">>> b = {'one': 1, 'two': 2, 'three': 3}\n" +">>> c = dict(zip(['one', 'two', 'three'], [1, 2, 3]))\n" +">>> d = dict([('two', 2), ('one', 1), ('three', 3)])\n" +">>> e = dict({'three': 3, 'one': 1, 'two': 2})\n" +">>> f = dict({'one': 1, 'three': 3}, two=2)\n" +">>> a == b == c == d == e == f\n" +"True" #: ../../library/stdtypes.rst:4875 msgid "" @@ -7707,7 +8190,6 @@ msgstr "" "キーの更新は順序には影響が無いことに注意してください。\n" "いったん削除されてから再度追加されたキーは末尾に挿入されます。::" -#: ../../library/stdtypes.rst:4878 msgid "" ">>> d = {\"one\": 1, \"two\": 2, \"three\": 3, \"four\": 4}\n" ">>> d\n" @@ -7724,6 +8206,20 @@ msgid "" ">>> d\n" "{'one': 42, 'three': 3, 'four': 4, 'two': None}" msgstr "" +">>> d = {\"one\": 1, \"two\": 2, \"three\": 3, \"four\": 4}\n" +">>> d\n" +"{'one': 1, 'two': 2, 'three': 3, 'four': 4}\n" +">>> list(d)\n" +"['one', 'two', 'three', 'four']\n" +">>> list(d.values())\n" +"[1, 2, 3, 4]\n" +">>> d[\"one\"] = 42\n" +">>> d\n" +"{'one': 42, 'two': 2, 'three': 3, 'four': 4}\n" +">>> del d[\"two\"]\n" +">>> d[\"two\"] = None\n" +">>> d\n" +"{'one': 42, 'three': 3, 'four': 4, 'two': None}" #: ../../library/stdtypes.rst:4893 msgid "" @@ -7775,7 +8271,6 @@ msgstr "" "場合、 :exc:`KeyError` が送出されます。 :meth:`__missing__` はメソッドでなけ" "ればならず、インスタンス変数であってはなりません::" -#: ../../library/stdtypes.rst:4923 msgid "" ">>> class Counter(dict):\n" "... def __missing__(self, key):\n" @@ -7788,6 +8283,16 @@ msgid "" ">>> c['red']\n" "1" msgstr "" +">>> class Counter(dict):\n" +"... def __missing__(self, key):\n" +"... return 0\n" +"...\n" +">>> c = Counter()\n" +">>> c['red']\n" +"0\n" +">>> c['red'] += 1\n" +">>> c['red']\n" +"1" #: ../../library/stdtypes.rst:4934 msgid "" @@ -7894,13 +8399,12 @@ msgstr "" "*default* を返します。 *default* が与えられず、かつ *key* が辞書に存在しなけ" "れば :exc:`KeyError` を送出します。" -#: ../../library/stdtypes.rst:5002 msgid "" "Remove and return a ``(key, value)`` pair from the dictionary. Pairs are " "returned in :abbr:`LIFO (last-in, first-out)` order." msgstr "" -"任意の ``(key, value)`` 対を辞書から消去して返します。\n" -"対は :abbr:`LIFO (後入れ、先出し)` の順序で返却されます。" +"辞書から ``(key, value)`` 対を削除し、その対を返します。\n" +"対は :abbr:`LIFO (後入れ、先出し)` の順序で返されます。" #: ../../library/stdtypes.rst:5005 msgid "" @@ -7946,7 +8450,6 @@ msgstr "" "辞書の内容を *other* のキーと値で更新します。既存のキーは上書きされます。返り" "値は ``None`` です。" -#: ../../library/stdtypes.rst:5031 msgid "" ":meth:`update` accepts either another object with a ``keys()`` method (in " "which case :meth:`~object.__getitem__` is called with every key returned " @@ -7954,6 +8457,13 @@ msgid "" "iterables of length two). If keyword arguments are specified, the dictionary " "is then updated with those key/value pairs: ``d.update(red=1, blue=2)``." msgstr "" +":meth:`update` は、``keys()`` メソッドを持つ別のオブジェクトか、キーと値の対" +"のイテラブル (各対はタプル、または長さ2のその他のイテラブル) を受け付けま" +"す。\n" +"前者の場合、そのメソッドが返す各キーを使って :meth:`~object.__getitem__` を呼" +"び出します。\n" +"キーワード引数を指定した場合は、続いてそれらのキーと値の対で辞書を更新しま" +"す: ``d.update(red=1, blue=2)``。" #: ../../library/stdtypes.rst:5039 msgid "" @@ -7973,21 +8483,23 @@ msgstr "" "が返ります。\n" "``dict.values()`` どうしを比較したときも同様です::" -#: ../../library/stdtypes.rst:5046 msgid "" ">>> d = {'a': 1}\n" ">>> d.values() == d.values()\n" "False" msgstr "" +">>> d = {'a': 1}\n" +">>> d.values() == d.values()\n" +"False" -#: ../../library/stdtypes.rst:5052 msgid "" "Create a new dictionary with the merged keys and values of *d* and *other*, " "which must both be dictionaries. The values of *other* take priority when " "*d* and *other* share keys." msgstr "" "*d* と *other* のキーと値を統合した新しい辞書を作成します。\n" -"*d* と *other* のキーに重複がある場合は、 *other* の方の値が優先されます。" +"*d* と *other* は両方とも辞書でなければなりません。\n" +"*d* と *other* でキーが重複する場合は、*other* の値が優先されます。" #: ../../library/stdtypes.rst:5060 msgid "" @@ -8004,7 +8516,6 @@ msgstr "" msgid "Dictionaries and dictionary views are reversible. ::" msgstr "辞書と辞書のビューは ``reversed()`` で順序を逆にすることができます::" -#: ../../library/stdtypes.rst:5068 msgid "" ">>> d = {\"one\": 1, \"two\": 2, \"three\": 3, \"four\": 4}\n" ">>> d\n" @@ -8016,6 +8527,15 @@ msgid "" ">>> list(reversed(d.items()))\n" "[('four', 4), ('three', 3), ('two', 2), ('one', 1)]" msgstr "" +">>> d = {\"one\": 1, \"two\": 2, \"three\": 3, \"four\": 4}\n" +">>> d\n" +"{'one': 1, 'two': 2, 'three': 3, 'four': 4}\n" +">>> list(reversed(d))\n" +"['four', 'three', 'two', 'one']\n" +">>> list(reversed(d.values()))\n" +"[4, 3, 2, 1]\n" +">>> list(reversed(d.items()))\n" +"[('four', 4), ('three', 3), ('two', 2), ('one', 1)]" #: ../../library/stdtypes.rst:5078 msgid "Dictionaries are now reversible." @@ -8097,13 +8617,12 @@ msgstr "" "*x* が元の辞書のキー、値、または項目 (項目の場合、 *x* は ``(key, value)`` タ" "プルです) にあるとき ``True`` を返します。" -#: ../../library/stdtypes.rst:5127 msgid "" "Return a reverse iterator over the keys, values or items of the dictionary. " "The view will be iterated in reverse order of the insertion." msgstr "" -"辞書のキーもしくは値、項目の順序を逆にしたイテレーターを返します。\n" -"戻り値のビューは、挿入された順とは逆の順でイテレートします。" +"辞書のキー、値、または項目を逆順にたどるイテレータを返します。\n" +"ビューは挿入順序とは逆の順序で反復されます。" #: ../../library/stdtypes.rst:5130 msgid "Dictionary views are now reversible." @@ -8117,7 +8636,6 @@ msgstr "" "ビューの参照先の辞書をラップする :class:`types.MappingProxyType` オブジェク" "ト を返します。" -#: ../../library/stdtypes.rst:5140 msgid "" "Keys views are set-like since their entries are unique and :term:`hashable`. " "Items views also have set-like operations since the (key, value) pairs are " @@ -8139,13 +8657,12 @@ msgstr "" "れた全ての演算が利用可能です (たとえば ``==``, ``<`` や ``^`` など)。 集合演" "算に対しては、集合はオペランドとして集合しか取ることができないのに対して、こ" "れら集合の特性を持つビューはオペランドとして任意のイテラブルを取ることができ" -"ます。 " +"ます。" #: ../../library/stdtypes.rst:5152 msgid "An example of dictionary view usage::" msgstr "辞書ビューの使用法の例::" -#: ../../library/stdtypes.rst:5154 msgid "" ">>> dishes = {'eggs': 2, 'sausage': 1, 'bacon': 1, 'spam': 500}\n" ">>> keys = dishes.keys()\n" @@ -8185,6 +8702,43 @@ msgid "" ">>> values.mapping['spam']\n" "500" msgstr "" +">>> dishes = {'eggs': 2, 'sausage': 1, 'bacon': 1, 'spam': 500}\n" +">>> keys = dishes.keys()\n" +">>> values = dishes.values()\n" +"\n" +">>> # 反復\n" +">>> n = 0\n" +">>> for val in values:\n" +"... n += val\n" +"...\n" +">>> print(n)\n" +"504\n" +"\n" +">>> # キーと値は同じ順序 (挿入順序) で反復される\n" +">>> list(keys)\n" +"['eggs', 'sausage', 'bacon', 'spam']\n" +">>> list(values)\n" +"[2, 1, 1, 500]\n" +"\n" +">>> # ビューオブジェクトは動的で、辞書の変更を反映する\n" +">>> del dishes['eggs']\n" +">>> del dishes['sausage']\n" +">>> list(keys)\n" +"['bacon', 'spam']\n" +"\n" +">>> # 集合演算\n" +">>> keys & {'eggs', 'bacon', 'salad'}\n" +"{'bacon'}\n" +">>> keys ^ {'sausage', 'juice'} == {'juice', 'sausage', 'bacon', 'spam'}\n" +"True\n" +">>> keys | ['juice', 'juice', 'juice'] == {'bacon', 'spam', 'juice'}\n" +"True\n" +"\n" +">>> # 元の辞書の読み出し専用プロキシを取得する\n" +">>> values.mapping\n" +"mappingproxy({'bacon': 1, 'spam': 500})\n" +">>> values.mapping['spam']\n" +"500" #: ../../library/stdtypes.rst:5196 msgid "Context Manager Types" @@ -8202,16 +8756,16 @@ msgstr "" "文の終わりで脱出する実行時コンテキストを、ユーザ定義クラスが定義できるように" "する一対のメソッドで実装されます:" -#: ../../library/stdtypes.rst:5211 msgid "" "Enter the runtime context and return either this object or another object " "related to the runtime context. The value returned by this method is bound " "to the identifier in the :keyword:`!as` clause of :keyword:`with` statements " "using this context manager." msgstr "" -"実行時コンテキストに入り、このオブジェクトまたは他の実行時コンテキストに関連" -"したオブジェクトを返します。このメソッドが返す値はこのコンテキストマネージャ" -"を使う :keyword:`with` 文の :keyword:`!as` 節の識別子に束縛されます。" +"実行時コンテキストに入り、このオブジェクト自体か、実行時コンテキストに関連す" +"る別のオブジェクトを返します。\n" +"このメソッドの返り値は、このコンテキストマネージャを使う :keyword:`with` 文" +"の :keyword:`!as` 節の識別子に束縛されます。" #: ../../library/stdtypes.rst:5216 msgid "" @@ -8304,12 +8858,11 @@ msgid "" "rather than the iterator produced by an undecorated generator function." msgstr "" "Python の :term:`ジェネレータ ` と :class:`contextlib." -"contextmanager` :term:`デコレータ ` はこのプロトコルの簡便な実装" -"方法を提供します。ジェネレータ関数を :class:`contextlib.contextmanager` デコ" -"レータでデコレートすると、デコレートされないジェネレータ関数が作成するイテ" -"レータの代わりに、必要な :meth:`~contextmanager.__enter__` および :meth:" -"`~contextmanager.__exit__` メソッドを実装したコンテキストマネージャを返すよう" -"になります。" +"contextmanager` デコレータはこのプロトコルの簡便な実装方法を提供します。ジェ" +"ネレータ関数を :class:`contextlib.contextmanager` デコレータでデコレートする" +"と、デコレートされないジェネレータ関数が作成するイテレータの代わりに、必要" +"な :meth:`~contextmanager.__enter__` および :meth:`~contextmanager.__exit__` " +"メソッドを実装したコンテキストマネージャを返すようになります。" #: ../../library/stdtypes.rst:5261 msgid "" @@ -8454,11 +9007,12 @@ msgstr "" "す。たとえば、 :class:`float` 型の要素を含む :class:`list` を引数にとる関数の" "型アノテーションは次のようになります::" -#: ../../library/stdtypes.rst:5338 msgid "" "def average(values: list[float]) -> float:\n" " return sum(values) / len(values)" msgstr "" +"def average(values: list[float]) -> float:\n" +" return sum(values) / len(values)" #: ../../library/stdtypes.rst:5341 msgid "" @@ -8472,11 +9026,12 @@ msgstr "" "ています。この例では、関数はキーが :class:`str` 型、値が :class:`int` 型であ" "るような ``dict`` を引数にとります::" -#: ../../library/stdtypes.rst:5346 msgid "" "def send_post_request(url: str, body: dict[str, int]) -> None:\n" " ..." msgstr "" +"def send_post_request(url: str, body: dict[str, int]) -> None:\n" +" ..." #: ../../library/stdtypes.rst:5349 msgid "" @@ -8486,13 +9041,16 @@ msgstr "" "組み込み関数 :func:`isinstance` と :func:`issubclass` は第二引数として " "``GenericAlias`` 型を指定することはできません::" -#: ../../library/stdtypes.rst:5352 msgid "" ">>> isinstance([1, 2], list[str])\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" "TypeError: isinstance() argument 2 cannot be a parameterized generic" msgstr "" +">>> isinstance([1, 2], list[str])\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"TypeError: isinstance() argument 2 cannot be a parameterized generic" #: ../../library/stdtypes.rst:5357 msgid "" @@ -8508,12 +9066,14 @@ msgstr "" "せん。たとえば、以下のコードは推奨されませんが、エラーになることなく実行でき" "ます::" -#: ../../library/stdtypes.rst:5363 msgid "" ">>> t = list[str]\n" ">>> t([1, 2, 3])\n" "[1, 2, 3]" msgstr "" +">>> t = list[str]\n" +">>> t([1, 2, 3])\n" +"[1, 2, 3]" #: ../../library/stdtypes.rst:5367 msgid "" @@ -8523,7 +9083,6 @@ msgstr "" "しかも、パラメータ付きジェネリック型は、オブジェクト生成時にパラメータの型情" "報を削除します::" -#: ../../library/stdtypes.rst:5370 msgid "" ">>> t = list[str]\n" ">>> type(t)\n" @@ -8533,16 +9092,21 @@ msgid "" ">>> type(l)\n" "" msgstr "" +">>> t = list[str]\n" +">>> type(t)\n" +"\n" +"\n" +">>> l = t()\n" +">>> type(l)\n" +"" -#: ../../library/stdtypes.rst:5378 msgid "" "Calling :func:`repr` or :func:`str` on a generic shows the parameterized " "type::" msgstr "" -":func:`repr` や :func:`str` のジェネリック型に対する呼び出しは、パラメータ型" -"を表示します::" +"パラメータ付きジェネリック型に :func:`repr` や :func:`str` を呼び出すと、パラ" +"メータを含む型が表示されます::" -#: ../../library/stdtypes.rst:5380 msgid "" ">>> repr(list[int])\n" "'list[int]'\n" @@ -8550,6 +9114,11 @@ msgid "" ">>> str(list[int])\n" "'list[int]'" msgstr "" +">>> repr(list[int])\n" +"'list[int]'\n" +"\n" +">>> str(list[int])\n" +"'list[int]'" #: ../../library/stdtypes.rst:5386 msgid "" @@ -8559,43 +9128,48 @@ msgstr "" "ジェネリックコンテナ型の :meth:`~object.__getitem__` メソッドは、 ``dict[str]" "[str]`` のようなミスを許さないように、例外を送出します::" -#: ../../library/stdtypes.rst:5389 msgid "" ">>> dict[str][str]\n" "Traceback (most recent call last):\n" " ...\n" "TypeError: dict[str] is not a generic class" msgstr "" +">>> dict[str][str]\n" +"Traceback (most recent call last):\n" +" ...\n" +"TypeError: dict[str] is not a generic class" -#: ../../library/stdtypes.rst:5394 msgid "" "However, such expressions are valid when :ref:`type variables ` " "are used. The index must have as many elements as there are type variable " "items in the ``GenericAlias`` object's :attr:`~genericalias.__args__`. ::" msgstr "" "一方で、同様の式は :ref:`型変数 ` が使われた場合は有効です。添字の" -"数は``GenericAlias`` オブジェクトの :attr:`~genericalias.__args__` 属性におけ" -"る型変数の数と同じでなければなりません::" +"数は ``GenericAlias`` オブジェクトの :attr:`~genericalias.__args__` 属性にお" +"ける型変数の数と同じでなければなりません::" -#: ../../library/stdtypes.rst:5398 msgid "" ">>> from typing import TypeVar\n" ">>> Y = TypeVar('Y')\n" ">>> dict[str, Y][int]\n" "dict[str, int]" msgstr "" +">>> from typing import TypeVar\n" +">>> Y = TypeVar('Y')\n" +">>> dict[str, Y][int]\n" +"dict[str, int]" #: ../../library/stdtypes.rst:5405 msgid "Standard Generic Classes" msgstr "標準ジェネリッククラス" -#: ../../library/stdtypes.rst:5407 msgid "" "The following standard library classes support parameterized generics. This " "list is non-exhaustive." msgstr "" -"以下の標準ライブラリクラスは、パラメータ付きジェネリック型をサポートします。" -"このリストは完全に網羅されていない可能性があります。" +"以下の標準ライブラリのクラスは、パラメータ付きジェネリック型をサポートしてい" +"ます。\n" +"このリストはすべてを網羅しているわけではありません。" #: ../../library/stdtypes.rst:5410 msgid ":class:`tuple`" @@ -8621,13 +9195,11 @@ msgstr ":class:`frozenset`" msgid ":class:`type`" msgstr ":class:`type`" -#: ../../library/stdtypes.rst:5416 msgid ":class:`asyncio.Future`" -msgstr "" +msgstr ":class:`asyncio.Future`" -#: ../../library/stdtypes.rst:5417 msgid ":class:`asyncio.Task`" -msgstr "" +msgstr ":class:`asyncio.Task`" #: ../../library/stdtypes.rst:5418 msgid ":class:`collections.deque`" @@ -8649,9 +9221,8 @@ msgstr ":class:`collections.Counter`" msgid ":class:`collections.ChainMap`" msgstr ":class:`collections.ChainMap`" -#: ../../library/stdtypes.rst:5423 msgid ":class:`collections.abc.Awaitable`" -msgstr "’’:class:`collections.abc.Awaitable`" +msgstr ":class:`collections.abc.Awaitable`" #: ../../library/stdtypes.rst:5424 msgid ":class:`collections.abc.Coroutine`" @@ -8831,36 +9402,36 @@ msgstr "" msgid "This attribute points at the non-parameterized generic class::" msgstr "この属性は、対応するパラメータ付きでないジェネリッククラスを指します::" -#: ../../library/stdtypes.rst:5477 msgid "" ">>> list[int].__origin__\n" "" msgstr "" +">>> list[int].__origin__\n" +"" -#: ../../library/stdtypes.rst:5483 msgid "" "This attribute is a :class:`tuple` (possibly of length 1) of generic types " "passed to the original :meth:`~object.__class_getitem__` of the generic " "class::" msgstr "" "この属性は、ジェネリッククラスの元の :meth:`~object.__class_getitem__` に渡さ" -"れた :class:`tuple` です (長さが1の場合もあります)::" +"れたジェネリック型を要素とする :class:`tuple` です (長さが1の場合もありま" +"す)::" -#: ../../library/stdtypes.rst:5487 msgid "" ">>> dict[str, list[int]].__args__\n" "(, list[int])" msgstr "" +">>> dict[str, list[int]].__args__\n" +"(, list[int])" -#: ../../library/stdtypes.rst:5493 msgid "" "This attribute is a lazily computed tuple (possibly empty) of unique type " "variables found in ``__args__``::" msgstr "" -"この属性は、 ``__args__`` にある固有の型変数のタプルで、必要に応じて遅延計算" -"されます (空の可能性もあります)::" +"この属性は、``__args__`` に含まれる型変数を重複なく集めた、遅延計算されるタプ" +"ルです (空の場合もあります)。 ::" -#: ../../library/stdtypes.rst:5496 msgid "" ">>> from typing import TypeVar\n" "\n" @@ -8868,16 +9439,21 @@ msgid "" ">>> list[T].__parameters__\n" "(~T,)" msgstr "" +">>> from typing import TypeVar\n" +"\n" +">>> T = TypeVar('T')\n" +">>> list[T].__parameters__\n" +"(~T,)" -#: ../../library/stdtypes.rst:5504 msgid "" "A ``GenericAlias`` object with :class:`typing.ParamSpec` parameters may not " "have correct ``__parameters__`` after substitution because :class:`typing." "ParamSpec` is intended primarily for static type checking." msgstr "" -":class:`typing.ParamSpec` パラメータを含む ``GenericAlias`` オブジェクトは、" -"代入後に正しい ``__parameters__`` を持たない可能性があります。これは :class:" -"`typing.ParamSpec` が主に静的な型チェックを目的としているためです。" +":class:`typing.ParamSpec` パラメータを持つ ``GenericAlias`` オブジェクトは、" +"置換後の ``__parameters__`` が正しくない場合があります。\n" +"これは :class:`typing.ParamSpec` が主に静的な型チェックを目的としているためで" +"す。" #: ../../library/stdtypes.rst:5511 msgid "" @@ -8930,7 +9506,6 @@ msgstr "" msgid "Union Type" msgstr "Union 型" -#: ../../library/stdtypes.rst:5543 msgid "" "A union object holds the value of the ``|`` (bitwise or) operation on " "multiple :ref:`type objects `. These types are intended " @@ -8938,24 +9513,30 @@ msgid "" "expression enables cleaner type hinting syntax compared to subscripting :" "class:`typing.Union`." msgstr "" +"ユニオンオブジェクトは、複数の :ref:`型オブジェクト ` に" +"対する ``|`` (ビット単位の論理和) 演算の値を保持します。\n" +"これらの型は主に :term:`型アノテーション ` で使うことを想定してい" +"ます。\n" +"ユニオン型の式を使うと、:class:`typing.Union` の添字表記よりも簡潔な型ヒント" +"の構文で書けます。" -#: ../../library/stdtypes.rst:5550 msgid "" "Defines a union object which holds types *X*, *Y*, and so forth. ``X | Y`` " "means either X or Y. It is equivalent to ``typing.Union[X, Y]``. For " "example, the following function expects an argument of type :class:`int` or :" "class:`float`::" msgstr "" -"*X* と *Y* などの型を保持するUnionオブジェクトを定義すします。``X | Y`` はXと" -"Yのいずれかを意味します。これは ``typing.Union[X, Y]`` と等価です。たとえば、" -"以下の関数は引数として :class:`int` 型または :class:`float` 型を想定していま" -"す。::" +"*X*、*Y* などの型を保持するユニオンオブジェクトを定義します。\n" +"``X | Y`` は X または Y を意味し、``typing.Union[X, Y]`` と等価です。\n" +"例えば、次の関数は :class:`int` 型または :class:`float` 型の引数を想定してい" +"ます。 ::" -#: ../../library/stdtypes.rst:5555 msgid "" "def square(number: int | float) -> int | float:\n" " return number ** 2" msgstr "" +"def square(number: int | float) -> int | float:\n" +" return number ** 2" #: ../../library/stdtypes.rst:5560 msgid "" @@ -8978,61 +9559,56 @@ msgstr "" "Unionオブジェクトは他のUnionオブジェクトとの等価性をテストできます。以下は詳" "細です:" -#: ../../library/stdtypes.rst:5570 msgid "Unions of unions are flattened::" -msgstr "ユニオン型のユニオン型は平滑化されます::" +msgstr "ユニオンのユニオンは平坦化されます。 ::" -#: ../../library/stdtypes.rst:5572 msgid "(int | str) | float == int | str | float" -msgstr "" +msgstr "(int | str) | float == int | str | float" #: ../../library/stdtypes.rst:5574 msgid "Redundant types are removed::" msgstr "余分な型は削除されます::" -#: ../../library/stdtypes.rst:5576 msgid "int | str | int == int | str" -msgstr "" +msgstr "int | str | int == int | str" #: ../../library/stdtypes.rst:5578 msgid "When comparing unions, the order is ignored::" msgstr "ユニオン型を比較すると順序は無視されます::" -#: ../../library/stdtypes.rst:5580 msgid "int | str == str | int" -msgstr "" +msgstr "int | str == str | int" -#: ../../library/stdtypes.rst:5582 msgid "It creates instances of :class:`typing.Union`::" -msgstr "" +msgstr ":class:`typing.Union` のインスタンスを作成します。 ::" -#: ../../library/stdtypes.rst:5584 msgid "" "int | str == typing.Union[int, str]\n" "type(int | str) is typing.Union" msgstr "" +"int | str == typing.Union[int, str]\n" +"type(int | str) is typing.Union" #: ../../library/stdtypes.rst:5587 msgid "Optional types can be spelled as a union with ``None``::" msgstr "Optional型は ``None`` とのUnion型で記述できます::" -#: ../../library/stdtypes.rst:5589 msgid "str | None == typing.Optional[str]" -msgstr "" +msgstr "str | None == typing.Optional[str]" -#: ../../library/stdtypes.rst:5594 msgid "" "Calls to :func:`isinstance` and :func:`issubclass` are also supported with a " "union object::" msgstr "" -":func:`isinstance` と :func:`issubclass` の呼び出しはどちらもUnionオブジェク" -"トをサポートしています。 " +"ユニオンオブジェクトを使った :func:`isinstance` と :func:`issubclass` の呼び" +"出しもサポートされています。 ::" -#: ../../library/stdtypes.rst:5597 msgid "" ">>> isinstance(\"\", int | str)\n" "True" msgstr "" +">>> isinstance(\"\", int | str)\n" +"True" #: ../../library/stdtypes.rst:5600 msgid "" @@ -9042,7 +9618,6 @@ msgstr "" "しかし、Unionオブジェクトの中の :ref:`parameterized generics ` はチェックできません::" -#: ../../library/stdtypes.rst:5603 msgid "" ">>> isinstance(1, int | list[int]) # short-circuit evaluation\n" "True\n" @@ -9051,14 +9626,21 @@ msgid "" " ...\n" "TypeError: isinstance() argument 2 cannot be a parameterized generic" msgstr "" +">>> isinstance(1, int | list[int]) # 短絡評価\n" +"True\n" +">>> isinstance([1], int | list[int])\n" +"Traceback (most recent call last):\n" +" ...\n" +"TypeError: isinstance() argument 2 cannot be a parameterized generic" -#: ../../library/stdtypes.rst:5610 msgid "" "The user-exposed type for the union object can be accessed from :class:" "`typing.Union` and used for :func:`isinstance` checks::" msgstr "" +"利用者がユニオンオブジェクトの型にアクセスするには :class:`typing.Union` を使" +"います。\n" +":func:`isinstance` による検査にも使えます。 ::" -#: ../../library/stdtypes.rst:5613 msgid "" ">>> import typing\n" ">>> isinstance(int | str, typing.Union)\n" @@ -9068,6 +9650,13 @@ msgid "" " File \"\", line 1, in \n" "TypeError: cannot create 'typing.Union' instances" msgstr "" +">>> import typing\n" +">>> isinstance(int | str, typing.Union)\n" +"True\n" +">>> typing.Union()\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"TypeError: cannot create 'typing.Union' instances" #: ../../library/stdtypes.rst:5622 msgid "" @@ -9079,7 +9668,6 @@ msgstr "" "が追加されました。メタクラスで :meth:`!__or__` を実装するとUnionをオーバーラ" "イドする場合があります::" -#: ../../library/stdtypes.rst:5626 msgid "" ">>> class M(type):\n" "... def __or__(self, other):\n" @@ -9093,17 +9681,30 @@ msgid "" ">>> int | C\n" "int | C" msgstr "" +">>> class M(type):\n" +"... def __or__(self, other):\n" +"... return \"Hello\"\n" +"...\n" +">>> class C(metaclass=M):\n" +"... pass\n" +"...\n" +">>> C | int\n" +"'Hello'\n" +">>> int | C\n" +"int | C" #: ../../library/stdtypes.rst:5642 msgid ":pep:`604` -- PEP proposing the ``X | Y`` syntax and the Union type." msgstr ":pep:`604` -- ``X | Y`` 構文とUnion型を提案しているPEP" -#: ../../library/stdtypes.rst:5648 msgid "" "Union objects are now instances of :class:`typing.Union`. Previously, they " "were instances of :class:`types.UnionType`, which remains an alias for :" "class:`typing.Union`." msgstr "" +"ユニオンオブジェクトは :class:`typing.Union` のインスタンスになりました。\n" +"以前は :class:`types.UnionType` のインスタンスでしたが、この型名は :class:" +"`typing.Union` のエイリアスとして残っています。" #: ../../library/stdtypes.rst:5655 msgid "Other Built-in Types" @@ -9258,7 +9859,6 @@ msgstr "" "ためには、次のようにその下層の関数オブジェクトに明示的に設定する必要がありま" "す::" -#: ../../library/stdtypes.rst:5740 msgid "" ">>> class C:\n" "... def method(self):\n" @@ -9273,6 +9873,19 @@ msgid "" ">>> c.method.whoami\n" "'my name is method'" msgstr "" +">>> class C:\n" +"... def method(self):\n" +"... pass\n" +"...\n" +">>> c = C()\n" +">>> c.method.whoami = 'my name is method' # メソッドに設定することはできな" +"い\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"AttributeError: 'method' object has no attribute 'whoami'\n" +">>> c.method.__func__.whoami = 'my name is method'\n" +">>> c.method.whoami\n" +"'my name is method'" #: ../../library/stdtypes.rst:5755 msgid "See :ref:`instance-methods` for more information." @@ -9298,15 +9911,14 @@ msgstr "" "の :attr:`~function.__code__` 属性として取り出せます。 :mod:`code` モジュール" "も参照してください。" -#: ../../library/stdtypes.rst:5776 msgid "" "Accessing :attr:`~function.__code__` raises an :ref:`auditing event " "` ``object.__getattr__`` with arguments ``obj`` and " "``\"__code__\"``." msgstr "" -":attr:`~function.__code__` へのアクセスは ``object.__getattr__`` に ``obj`` " -"と ``\"__code__\"`` を渡して行いますが、 :ref:`監査イベント ` を送" -"出します。" +":attr:`~function.__code__` にアクセスすると、実引数 ``obj`` と " +"``\"__code__\"`` を伴う :ref:`監査イベント ` ``object." +"__getattr__`` が送出されます。" #: ../../library/stdtypes.rst:5783 msgid "" @@ -9439,21 +10051,23 @@ msgstr "" "クラス、関数、メソッド、デスクリプタ、ジェネレータインスタンスの :term:`修飾" "名 ` です。" -#: ../../library/stdtypes.rst:5881 msgid "The name of the module in which a class or function was defined." -msgstr "" +msgstr "クラスまたは関数が定義されたモジュールの名前。" -#: ../../library/stdtypes.rst:5886 msgid "" "The documentation string of a class or function, or ``None`` if undefined." msgstr "" +"クラスまたは関数のドキュメンテーション文字列。\n" +"未定義の場合は ``None``。" -#: ../../library/stdtypes.rst:5891 msgid "" "The :ref:`type parameters ` of generic classes, functions, and :" "ref:`type aliases `. For classes and functions that are not " "generic, this will be an empty tuple." msgstr "" +"ジェネリッククラスや関数、および :ref:`型エイリアス ` の :ref:`" +"型パラメータ `。\n" +"ジェネリックでないクラスや関数では空のタプルになります。" #: ../../library/stdtypes.rst:5901 msgid "Integer string conversion length limitation" @@ -9471,7 +10085,6 @@ msgstr "" "に *のみ* 適用されます。16進数、8進数と2進数は制限がありません。上限値は設定" "できます。" -#: ../../library/stdtypes.rst:5908 msgid "" "The :class:`int` type in CPython is an arbitrary length number stored in " "binary form (commonly known as a \"bignum\"). There exists no algorithm that " @@ -9480,13 +10093,13 @@ msgid "" "algorithms for base 10 have sub-quadratic complexity. Converting a large " "value such as ``int('1' * 500_000)`` can take over a second on a fast CPU." msgstr "" -"CPython の :class:`int` 型は、任意の長さの数をバイナリ形式で保存したものです " -"(一般に \"bignum\" または多倍長整数として知られています)。基数が2のべき乗でな" -"い限り、線形の時間で文字列をバイナリ整数に、あるいはバイナリ整数を文字列に変" -"換できるアルゴリズムは存在しません。10進数に対するアルゴリズムでは、最もよく" -"知られているものでさえ、2次に近い (sub-quadratic) 複雑さになります。高速な " -"CPU でも、 ``int('1' * 500_000)`` のような大きな数の変換は1秒以上かかる可能性" -"があります。" +"CPython の :class:`int` 型は、任意の長さの数を2進形式で格納します (一般に" +"「bignum」と呼ばれます)。\n" +"基数が2のべき乗でない限り、文字列と2進整数を線形時間で相互変換できるアルゴリ" +"ズムは存在しません。\n" +"10進数に対する既知の最良のアルゴリズムでも、計算量は二次未満です。\n" +"``int('1' * 500_000)`` のような大きな値の変換には、高速な CPU でも1秒を超える" +"時間が掛かる場合があります。" #: ../../library/stdtypes.rst:5915 msgid "" @@ -9509,7 +10122,6 @@ msgid "" "When an operation would exceed the limit, a :exc:`ValueError` is raised:" msgstr "演算の結果が制限を超えると、:exc:`ValueError` が送出されます:" -#: ../../library/stdtypes.rst:5923 msgid "" ">>> import sys\n" ">>> sys.set_int_max_str_digits(4300) # Illustrative, this is the default.\n" @@ -9532,6 +10144,26 @@ msgid "" "7144\n" ">>> assert int(hex(i_squared), base=16) == i*i # Hexadecimal is unlimited." msgstr "" +">>> import sys\n" +">>> sys.set_int_max_str_digits(4300) # 例示用。これはデフォルト値。\n" +">>> _ = int('2' * 5432)\n" +"Traceback (most recent call last):\n" +"...\n" +"ValueError: Exceeds the limit (4300 digits) for integer string conversion: " +"value has 5432 digits; use sys.set_int_max_str_digits() to increase the " +"limit\n" +">>> i = int('2' * 4300)\n" +">>> len(str(i))\n" +"4300\n" +">>> i_squared = i*i\n" +">>> len(str(i_squared))\n" +"Traceback (most recent call last):\n" +"...\n" +"ValueError: Exceeds the limit (4300 digits) for integer string conversion; " +"use sys.set_int_max_str_digits() to increase the limit\n" +">>> len(hex(i_squared))\n" +"7144\n" +">>> assert int(hex(i_squared), base=16) == i*i # 16進数は制限されない。" #: ../../library/stdtypes.rst:5943 msgid "" @@ -9549,7 +10181,6 @@ msgstr "" msgid "Verification:" msgstr "確認:" -#: ../../library/stdtypes.rst:5950 msgid "" ">>> import sys\n" ">>> assert sys.int_info.default_max_str_digits == 4300, sys.int_info\n" @@ -9559,6 +10190,13 @@ msgid "" "... '571186405732').to_bytes(53, 'big')\n" "..." msgstr "" +">>> import sys\n" +">>> assert sys.int_info.default_max_str_digits == 4300, sys.int_info\n" +">>> assert sys.int_info.str_digits_check_threshold == 640, sys.int_info\n" +">>> msg = int('578966293710682886880994035146873798396722250538762761564'\n" +"... '9252925514383915483333812743580549779436104706260696366600'\n" +"... '571186405732').to_bytes(53, 'big')\n" +"..." #: ../../library/stdtypes.rst:5963 msgid "Affected APIs" @@ -9588,13 +10226,12 @@ msgstr "``str(integer)``" msgid "``repr(integer)``." msgstr "``repr(integer)``" -#: ../../library/stdtypes.rst:5972 msgid "" "any other string conversion to base 10, for example ``f\"{integer}\"``, " "``\"{}\".format(integer)``, or ``b\"%d\" % integer``." msgstr "" "他の10進数での文字列変換。たとえば ``f\"{integer}\"``、``\"{}\"." -"format(integer)`` や ``b\"%d\" % integer``。 " +"format(integer)`` や ``b\"%d\" % integer``。" #: ../../library/stdtypes.rst:5975 msgid "The limitations do not apply to functions with a linear algorithm:" @@ -9709,7 +10346,6 @@ msgstr "" ":data:`sys.int_info.str_digits_check_threshold ` は上限値として" "指定できる最低の値です(0の場合は無効になります)。" -#: ../../library/stdtypes.rst:6019 msgid "" "Setting a low limit *can* lead to problems. While rare, code exists that " "contains integer constants in decimal in their source that exceed the " @@ -9720,14 +10356,15 @@ msgid "" "exist for the code. A workaround for source that contains such large " "constants is to convert them to ``0x`` hexadecimal form as it has no limit." msgstr "" -"小さな上限値を設定することで、問題が起きる *可能性があります* 。まれではあり" -"ますが、ソースコード内で閾値を超える定数が10進数の整数として存在するコードが" -"存在します。値に制限をつけることの帰結は、10進数の整数リテラルで制限を超える" -"長さを持つ定数を含むコードのパース時、すなわち通常は起動時、モジュールのイン" -"ポート時、またはインストール時など、そのコードのための ``.pyc`` ファイルが作" -"られるまでのどこかの時点でのエラーです。大きな定数を含むソースコードに対する" -"回避策は、その定数を、 ``0x`` を使って値の制限を持たない16進数の値に変換する" -"ことです。" +"小さな上限値を設定すると、問題が起きる *可能性があります* 。\n" +"まれですが、ソース内に最小の閾値を超える10進整数定数を含むコードが存在しま" +"す。\n" +"上限値を設定すると、その上限より長い10進整数リテラルを含む Python ソースコー" +"ドのパース時にエラーが発生します。\n" +"これは、通常は起動時やインポート時、場合によってはインストール時など、その" +"コードに対応する最新の ``.pyc`` がまだ存在しないときに起こります。\n" +"このような大きな定数を含むソースでは、制限のない ``0x`` 形式の16進数へ定数を" +"変換することで回避できます。" #: ../../library/stdtypes.rst:6028 msgid "" @@ -9763,7 +10400,6 @@ msgstr "" msgid "Example::" msgstr "以下はプログラム例です::" -#: ../../library/stdtypes.rst:6043 msgid "" ">>> import sys\n" ">>> if hasattr(sys, \"set_int_max_str_digits\"):\n" @@ -9775,6 +10411,15 @@ msgid "" "... elif current_limit < lower_bound:\n" "... sys.set_int_max_str_digits(lower_bound)" msgstr "" +">>> import sys\n" +">>> if hasattr(sys, \"set_int_max_str_digits\"):\n" +"... upper_bound = 68000\n" +"... lower_bound = 4004\n" +"... current_limit = sys.get_int_max_str_digits()\n" +"... if current_limit == 0 or current_limit > upper_bound:\n" +"... sys.set_int_max_str_digits(upper_bound)\n" +"... elif current_limit < lower_bound:\n" +"... sys.set_int_max_str_digits(lower_bound)" #: ../../library/stdtypes.rst:6053 msgid "If you need to disable it entirely, set it to ``0``." @@ -9800,11 +10445,10 @@ msgstr "" "この結果として、リスト ``[1, 2]`` は ``[1.0, 2.0]`` と等しいと見なされます。" "タプルの場合も同様です。" -#: ../../library/stdtypes.rst:6064 msgid "They must have since the parser can't tell the type of the operands." msgstr "" -"パーザが演算対象の型を識別できるようにするために、このような優先順位でなけれ" -"ばならないのです。" +"パーザはオペランドの型を判別できないため、これらの演算子の優先順位は対応する" +"数値演算子と同じでなければなりません。" #: ../../library/stdtypes.rst:6066 msgid "" @@ -10046,9 +10690,8 @@ msgstr "16進数" msgid "octal" msgstr "8進数" -#: ../../library/stdtypes.rst:229 msgid "binary" -msgstr "2進数" +msgstr "二項" #: ../../library/stdtypes.rst:249 msgid "arithmetic" @@ -10399,49 +11042,39 @@ msgstr "universal newlines" msgid "str.splitlines method" msgstr "str.splitlines メソッド" -#: ../../library/stdtypes.rst:2487 msgid "! formatted string literal" -msgstr "" +msgstr "! フォーマット済み文字列リテラル" -#: ../../library/stdtypes.rst:2487 msgid "formatted string literals" -msgstr "" +msgstr "フォーマット済み文字列リテラル" -#: ../../library/stdtypes.rst:2487 msgid "! f-string" -msgstr "" +msgstr "! f-string" -#: ../../library/stdtypes.rst:2487 msgid "f-strings" -msgstr "" +msgstr "f-strings" -#: ../../library/stdtypes.rst:2487 msgid "fstring" -msgstr "" +msgstr "fstring" -#: ../../library/stdtypes.rst:2487 msgid "interpolated string literal" -msgstr "" +msgstr "補間文字列リテラル" -#: ../../library/stdtypes.rst:2487 msgid "formatted literal" -msgstr "" +msgstr "フォーマット済みリテラル" -#: ../../library/stdtypes.rst:2487 msgid "interpolated literal" -msgstr "" +msgstr "補間リテラル" #: ../../library/stdtypes.rst:2487 msgid "{} (curly brackets)" msgstr "{} (波括弧)" -#: ../../library/stdtypes.rst:2487 msgid "in formatted string literal" -msgstr "" +msgstr "フォーマット済み文字列リテラル内" -#: ../../library/stdtypes.rst:2487 msgid "! (exclamation mark)" -msgstr "" +msgstr "! (感嘆符)" #: ../../library/stdtypes.rst:2487 msgid ": (colon)" @@ -10451,9 +11084,8 @@ msgstr ": (コロン)" msgid "= (equals)" msgstr "= (等号)" -#: ../../library/stdtypes.rst:2487 msgid "for help in debugging using string literals" -msgstr "" +msgstr "文字列リテラルを使ったデバッグの補助" #: ../../library/stdtypes.rst:2633 msgid "formatting, string (%)" @@ -10566,7 +11198,7 @@ msgstr "コンテキスト管理" #: ../../library/stdtypes.rst:5271 msgid "annotation" -msgstr "注釈" +msgstr "annotation" #: ../../library/stdtypes.rst:5271 msgid "type annotation; type hint" diff --git a/library/string.po b/library/string.po index d18801509..b60a2d84f 100644 --- a/library/string.po +++ b/library/string.po @@ -22,10 +22,10 @@ msgstr "" "Last-Translator: Takeshi Nakazato, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/string.rst:2 @@ -97,29 +97,32 @@ msgstr "" "``C`` ロケールにおいて、区切り文字 (punctuation characters) として扱われる " "ASCII 文字の文字列です: ``!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~``." -#: ../../library/string.rst:65 msgid "" "String of ASCII characters which are considered printable by Python. This is " "a combination of :const:`digits`, :const:`ascii_letters`, :const:" "`punctuation`, and :const:`whitespace`." msgstr "" +"Python が表示可能とみなす ASCII 文字からなる文字列です。\n" +":const:`digits`、:const:`ascii_letters`、:const:`punctuation`、:const:" +"`whitespace` を組み合わせたものです。" -#: ../../library/string.rst:71 msgid "" "By design, :meth:`string.printable.isprintable() ` returns :" "const:`False`. In particular, ``string.printable`` is not printable in the " "POSIX sense (see :manpage:`LC_CTYPE `)." msgstr "" +"仕様上、:meth:`string.printable.isprintable() ` は :const:" +"`False` を返します。\n" +"特に、``string.printable`` は POSIX の意味で表示可能な文字列ではありません (:" +"manpage:`LC_CTYPE ` を参照)。" -#: ../../library/string.rst:78 msgid "" "A string containing all ASCII characters that are considered whitespace. " "This includes the characters space, tab, linefeed, return, formfeed, and " "vertical tab." msgstr "" -"空白 (whitespace) として扱われる ASCII 文字全てを含む文字列です。ほとんどのシ" -"ステムでは、これはスペース (space)、タブ (tab)、改行 (linefeed)、復帰 " -"(return)、改頁 (formfeed)、垂直タブ (vertical tab) です。" +"空白として扱われるすべての ASCII 文字を含む文字列です。\n" +"スペース、タブ、改行、復帰、改ページ、垂直タブが含まれます。" #: ../../library/string.rst:86 msgid "Custom String Formatting" @@ -196,7 +199,6 @@ msgstr "" "が文字列を文字としての文字データや置換フィールドに展開するために使用されま" "す。" -#: ../../library/string.rst:129 msgid "" "The values in the tuple conceptually represent a span of literal text " "followed by a single replacement field. If there is no literal text (which " @@ -206,8 +208,15 @@ msgid "" "be ``None``. The value of *field_name* is unmodified and auto-numbering of " "non-numbered positional fields is done by :meth:`vformat`." msgstr "" +"タプルの各値は、概念的には文字列のリテラル部分と、それに続く 1 つの置換フィー" +"ルドを表します。\n" +"リテラル部分がない場合 (2 つの置換フィールドが連続する場合など)、" +"*literal_text* は長さ 0 の文字列になります。\n" +"置換フィールドがない場合、*field_name*、*format_spec*、*conversion* の値は " +"``None`` になります。\n" +"*field_name* の値は変更されず、番号のない位置フィールドへの自動的な番号付け" +"は :meth:`vformat` が行います。" -#: ../../library/string.rst:139 msgid "" "Given *field_name*, convert it to an object to be formatted. Auto-numbering " "of *field_name* returned from :meth:`parse` is done by :meth:`vformat` " @@ -217,17 +226,25 @@ msgid "" "meth:`vformat`. The return value *used_key* has the same meaning as the " "*key* parameter to :meth:`get_value`." msgstr "" +"指定された *field_name* を、書式化するオブジェクトに変換します。\n" +":meth:`parse` が返す *field_name* の自動的な番号付けは、このメソッドが呼ばれ" +"る前に :meth:`vformat` が行います。\n" +"タプル (obj, used_key) を返します。\n" +"デフォルトの実装は、\"0[name]\" や \"label.title\" など、:pep:`3101` で定義さ" +"れた形式の文字列を受け取ります。\n" +"*args* と *kwargs* は :meth:`vformat` に渡されたものです。\n" +"戻り値の *used_key* は、:meth:`get_value` の引数 *key* と同じ意味を持ちます。" -#: ../../library/string.rst:149 msgid "" "Retrieve a given field value. The *key* argument will be either an integer " "or a string. If it is an integer, it represents the index of the positional " "argument in *args*; if it is a string, then it represents a named argument " "in *kwargs*." msgstr "" -"与えられたフィールドの値を取り出します。 *key* 引数は整数でも文字列でも構いま" -"せん。整数の場合は、位置引数 *args* のインデックス番号を示します。文字列の場" -"合は、名前付きの引数 *kwargs* を意味します。" +"指定したフィールドの値を取得します。\n" +"*key* 引数は整数または文字列です。\n" +"整数なら *args* 内の位置引数のインデックスを表し、文字列なら *kwargs* 内の" +"キーワード引数の名前を表します。" #: ../../library/string.rst:154 msgid "" @@ -238,26 +255,25 @@ msgstr "" "*args* 引数は、 :meth:`vformat` への位置引数のリストに設定され、 *kwargs* 引" "数は、キーワード引数の辞書に設定されます。" -#: ../../library/string.rst:158 msgid "" "For compound field names, these functions are only called for the first " "component of the field name; subsequent components are handled through " "normal attribute and indexing operations." msgstr "" -"フィールド名が (ピリオドで区切られた) いくつかの要素からなっている場合、最初" -"の要素のみがこれらの関数に渡されます。残りの要素に関しては、通常の属性または" -"インデックスアクセスと同様に処理されます。" +"複数の要素からなるフィールド名では、これらの関数は最初の要素についてだけ呼び" +"出されます。\n" +"後続の要素は、通常の属性アクセスとインデックス操作で処理されます。" -#: ../../library/string.rst:162 msgid "" "So for example, the field expression '0.name' would cause :meth:`get_value` " "to be called with a *key* argument of 0. The ``name`` attribute will be " "looked up after :meth:`get_value` returns by calling the built-in :func:" "`getattr` function." msgstr "" -"つまり、例えば、フィールドが '0.name' と表現されるとき、 :meth:`get_value` " -"は、 *key* 引数が 0 として呼び出されます。属性 ``name`` は、組み込みの :func:" -"`getattr` 関数が呼び出され、 :meth:`get_value` が返されたのちに検索されます。" +"例えば、フィールド式 '0.name' では *key* 引数を 0 として :meth:`get_value` を" +"呼び出します。\n" +":meth:`get_value` が返った後、組み込み関数 :func:`getattr` を呼び出して " +"``name`` 属性を検索します。" #: ../../library/string.rst:167 msgid "" @@ -283,13 +299,12 @@ msgstr "" "`check_unused_args` は、確認の結果が偽である場合に例外を送出するものとみなさ" "れます。" -#: ../../library/string.rst:182 msgid "" ":meth:`format_field` simply calls the global :func:`format` built-in. The " "method is provided so that subclasses can override it." msgstr "" -":meth:`format_field` は単純に組み込みのグローバル関数 :func:`format` を呼び出" -"します。このメソッドは、サブクラスをオーバーライドするために提供されます。" +":meth:`format_field` は組み込み関数 :func:`format` を呼び出すだけです。\n" +"サブクラスでこのメソッドをオーバーライドできるように用意されています。" #: ../../library/string.rst:187 msgid "" @@ -424,7 +439,6 @@ msgstr "" "\"Units destroyed: {players[0]}\" # First element of keyword argument " "'players'." -#: ../../library/string.rst:267 msgid "" "The *conversion* field causes a type coercion before formatting. Normally, " "the job of formatting a value is done by the :meth:`~object.__format__` " @@ -433,11 +447,13 @@ msgid "" "formatting. By converting the value to a string before calling :meth:" "`~object.__format__`, the normal formatting logic is bypassed." msgstr "" -"*置換 (conversion)* フィールドにより書式変換前に型の強制変換が実施されます。" -"通常、値の書式変換は :meth:`~object.__format__` によって実施されます。しかし" -"ながら、場合によっては、文字列として変換することを強制したり、書式指定の定義" -"をオーバーライドしたくなることもあります。 :meth:`~object.__format__` の呼び" -"出し前に値を文字列に変換すると、通常の書式変換の処理は飛ばされます。" +"*conversion* フィールドは、書式化の前に型を強制変換します。\n" +"通常、値の書式化はその値自身の :meth:`~object.__format__` メソッドが行いま" +"す。\n" +"しかし場合によっては、その型が定義する書式化処理を使わず、文字列として書式化" +"したいことがあります。\n" +":meth:`~object.__format__` を呼び出す前に値を文字列に変換すると、通常の書式化" +"処理を回避できます。" #: ../../library/string.rst:274 msgid "" @@ -462,16 +478,16 @@ msgstr "" "\"Bring out the holy {name!r}\" # Calls repr() on the argument first\n" "\"More {!a}\" # Calls ascii() on the argument first" -#: ../../library/string.rst:284 msgid "" "The *format_spec* field contains a specification of how the value should be " "presented, including such details as field width, alignment, padding, " "decimal precision and so on. Each value type can define its own " "\"formatting mini-language\" or interpretation of the *format_spec*." msgstr "" -"*format_spec* フィールドは、フィールド幅、文字揃え、埋め方、精度などの、値を" -"表現する仕様を含みます。それぞれの値の型は、 \"formatting mini-language\" 、" -"または、 *format_spec* の実装で定義されます。" +"*format_spec* フィールドは、フィールド幅、文字揃え、埋め文字、10 進数の精度な" +"ど、値の表示方法を指定します。\n" +"それぞれの値の型は、独自の「書式指定ミニ言語」、つまり *format_spec* の解釈を" +"定義できます。" #: ../../library/string.rst:289 msgid "" @@ -592,19 +608,15 @@ msgstr "" msgid "``'>'``" msgstr "``'>'``" -#: ../../library/string.rst:361 msgid "" "Forces the field to be right-aligned within the available space (this is the " "default for numbers)." -msgstr "" -"利用可能なスペースにおいて、右詰めを強制します (いくつかのオブジェクトにおい" -"てのデフォルト)。" +msgstr "利用可能なスペース内で右詰めにします (数値のデフォルトです)。" #: ../../library/string.rst:364 msgid "``'='``" msgstr "``'='``" -#: ../../library/string.rst:364 msgid "" "Forces the padding to be placed after the sign (if any) but before the " "digits. This is used for printing fields in the form '+000000120'. This " @@ -612,6 +624,11 @@ msgid "" "`complex`. It becomes the default for numbers when '0' immediately precedes " "the field width." msgstr "" +"埋め文字を、符号があればその後、かつ数字の前に配置します。\n" +"'+000000120' のような形式でフィールドを表示するために使います。\n" +"この配置オプションは :class:`complex` を除く数値型でのみ有効です。\n" +"フィールド幅の直前に '0' を指定すると、数値にはこの配置がデフォルトで使われま" +"す。" #: ../../library/string.rst:371 msgid "``'^'``" @@ -643,41 +660,37 @@ msgstr "" msgid "``'+'``" msgstr "``'+'``" -#: ../../library/string.rst:390 msgid "" "Indicates that a sign should be used for both positive as well as negative " "numbers." -msgstr "" +msgstr "正の数にも負の数にも符号を付けます。" #: ../../library/string.rst:393 msgid "``'-'``" msgstr "``'-'``" -#: ../../library/string.rst:393 msgid "" "Indicates that a sign should be used only for negative numbers (this is the " "default behavior)." -msgstr "" +msgstr "負の数にだけ符号を付けます (デフォルトの動作です)。" #: ../../library/string.rst:382 ../../library/string.rst:396 msgid "space" msgstr "空白" -#: ../../library/string.rst:396 msgid "" "Indicates that a leading space should be used on positive numbers, and a " "minus sign on negative numbers." -msgstr "" +msgstr "正の数の先頭には空白を、負の数にはマイナス符号を付けます。" -#: ../../library/string.rst:403 msgid "" "The ``'z'`` option coerces negative zero floating-point values to positive " "zero after rounding to the format precision. This option is only valid for " "floating-point presentation types." msgstr "" -"``'z'`` オプションはマイナス0の浮動小数点数をフォーマットの制度で丸めたあとに" -"プラス0に強制的に変換します。このオプションは浮動小数点数型に対してのみ有効で" -"す。" +"``'z'`` オプションは、書式で指定した精度に丸めた後、浮動小数点数の負のゼロを" +"正のゼロに変換します。\n" +"このオプションは浮動小数点数の表現型でのみ有効です。" #: ../../library/string.rst:407 msgid "Added the ``'z'`` option (see also :pep:`682`)." @@ -705,20 +718,25 @@ msgstr "" "にのみ小数点文字がこれらの変換結果に現われます。さらに、``'g'`` と ``'G'`` の" "変換については、最後の 0 は結果から取り除かれません。" -#: ../../library/string.rst:424 msgid "" "The *width* is a decimal integer defining the minimum total field width, " "including any prefixes, separators, and other formatting characters. If not " "specified, then the field width will be determined by the content." msgstr "" +"*width* は、接頭辞、区切り文字、そのほかの書式化のための文字も含めた、フィー" +"ルド全体の最小幅を定義する 10 進整数です。\n" +"指定しなければ、フィールド幅は内容によって決まります。" -#: ../../library/string.rst:428 msgid "" "When no explicit alignment is given, preceding the *width* field by a zero " "(``'0'``) character enables sign-aware zero-padding for numeric types, " "excluding :class:`complex`. This is equivalent to a *fill* character of " "``'0'`` with an *alignment* type of ``'='``." msgstr "" +"配置を明示的に指定せずに *width* フィールドの前にゼロ (``'0'``) を置くと、:" +"class:`complex` を除く数値型では符号を考慮してゼロで埋めます。\n" +"これは *fill* 文字を ``'0'``、*alignment* の種類を ``'='`` にするのと同じで" +"す。" #: ../../library/string.rst:433 msgid "" @@ -744,29 +762,30 @@ msgstr "" "の内容から何文字が使用されるかを示します。*precision* は整数の表現型には使用" "できません。" -#: ../../library/string.rst:445 msgid "" "The *grouping* option after *width* and *precision* fields specifies a digit " "group separator for the integral and fractional parts of a number " "respectively. It can be one of the following:" msgstr "" +"*width* フィールドの後の *grouping* オプションは整数部の桁区切り文字を、" +"*precision* フィールドの後のものは小数部の桁区切り文字を指定します。\n" +"次のいずれかを指定できます:" -#: ../../library/string.rst:456 msgid "``','``" -msgstr "" +msgstr "``','``" -#: ../../library/string.rst:456 msgid "" "Inserts a comma every 3 digits for integer presentation type ``'d'`` and " "floating-point presentation types, excluding ``'n'``. For other presentation " "types, this option is not supported." msgstr "" +"整数の表現型 ``'d'`` と、``'n'`` を除く浮動小数点数の表現型では、3 桁ごとにカ" +"ンマを挿入します。\n" +"そのほかの表現型では、このオプションを使えません。" -#: ../../library/string.rst:462 msgid "``'_'``" -msgstr "" +msgstr "``'_'``" -#: ../../library/string.rst:462 msgid "" "Inserts an underscore every 3 digits for integer presentation type ``'d'`` " "and floating-point presentation types, excluding ``'n'``. For integer " @@ -774,6 +793,11 @@ msgid "" "inserted every 4 digits. For other presentation types, this option is not " "supported." msgstr "" +"整数の表現型 ``'d'`` と、``'n'`` を除く浮動小数点数の表現型では、3 桁ごとにア" +"ンダースコアを挿入します。\n" +"整数の表現型 ``'b'``、``'o'``、``'x'``、``'X'`` では、4 桁ごとにアンダースコ" +"アを挿入します。\n" +"そのほかの表現型では、このオプションを使えません。" #: ../../library/string.rst:472 msgid "" @@ -788,9 +812,8 @@ msgstr "``','`` オプションが追加されました (:pep:`378` も参照) msgid "Added the ``'_'`` option (see also :pep:`515`)." msgstr "``'_'`` オプションが追加されました (:pep:`515` も参照)。" -#: ../../library/string.rst:480 msgid "Support the *grouping* option for the fractional part." -msgstr "" +msgstr "小数部で *grouping* オプションを使えるようになりました。" #: ../../library/string.rst:483 msgid "Finally, the *type* determines how the data should be presented." @@ -809,9 +832,10 @@ msgstr "型" msgid "``'s'``" msgstr "``'s'``" -#: ../../library/string.rst:490 msgid "String format. This is the default type for strings and may be omitted." -msgstr "文字列。これがデフォルトの値で、多くの場合省略されます。" +msgstr "" +"文字列表記です。\n" +"文字列のデフォルトの表現型であり、省略できます。" #: ../../library/string.rst:493 ../../library/string.rst:522 #: ../../library/string.rst:608 @@ -923,7 +947,6 @@ msgstr "" msgid "``'e'``" msgstr "``'e'``" -#: ../../library/string.rst:536 msgid "" "Scientific notation. For a given precision ``p``, formats the number in " "scientific notation with the letter 'e' separating the coefficient from the " @@ -934,6 +957,14 @@ msgid "" "Decimal`. If ``p=0``, the decimal point is omitted unless the ``#`` option " "is used." msgstr "" +"科学的表記です。\n" +"精度 ``p`` を指定すると、係数と指数を文字 'e' で区切る科学的表記で数値を書式" +"化します。\n" +"係数は小数点の前に 1 桁、後に ``p`` 桁を持ち、有効桁数は計 ``p + 1`` 桁で" +"す。\n" +"精度を指定しなければ、:class:`float` では小数点以下 ``6`` 桁を使い、:class:" +"`~decimal.Decimal` では係数の全桁を表示します。\n" +"``p=0`` の場合、``#`` オプションを使わない限り小数点を省略します。" #: ../../library/string.rst:547 msgid "``'E'``" @@ -949,7 +980,6 @@ msgstr "指数表記です。大文字の 'E' を使うことを除いては、 msgid "``'f'``" msgstr "``'f'``" -#: ../../library/string.rst:550 msgid "" "Fixed-point notation. For a given precision ``p``, formats the number as a " "decimal number with exactly ``p`` digits following the decimal point. With " @@ -958,6 +988,12 @@ msgid "" "coefficient digits for :class:`~decimal.Decimal`. If ``p=0``, the decimal " "point is omitted unless the ``#`` option is used." msgstr "" +"固定小数点表記です。\n" +"精度 ``p`` を指定すると、小数点以下がちょうど ``p`` 桁の 10 進数として数値を" +"書式化します。\n" +"精度を指定しなければ、:class:`float` では小数点以下 ``6`` 桁を使い、:class:" +"`~decimal.Decimal` では係数の全桁を表示するのに十分な精度を使います。\n" +"``p=0`` の場合、``#`` オプションを使わない限り小数点を省略します。" #: ../../library/string.rst:559 msgid "``'F'``" @@ -986,7 +1022,6 @@ msgstr "" "``p`` に丸めた上で、数値の大きさに応じて固定小数点表記または科学的表記で表し" "ます。精度 ``0`` は精度 ``1`` と同じものと取り扱われます。" -#: ../../library/string.rst:569 msgid "" "The precise rules are as follows: suppose that the result formatted with " "presentation type ``'e'`` and precision ``p-1`` would have exponent " @@ -999,15 +1034,16 @@ msgid "" "unless the ``'#'`` option is used." msgstr "" "正確なルールは次の通りです: 書式 ``'e'`` 型および精度 ``p-1`` 桁で数値を" -"フォーマットした結果、指数部が ``exp`` になったと仮定します。このとき ``m <= " -"exp < p`` ならば、数値は書式 ``'f'`` 型および精度 ``p-1-exp`` 桁でフォーマッ" -"トされます。ただし ``m`` は浮動小数点数では -4 であり、 :class:`Decimals " -"` に対しては -6 です。それ以外の場合、数値は書式 ``'e'`` 型" -"および精度 ``p-1`` 桁でフォーマットされます。どちらの場合でも、仮数部の有効で" -"ない末尾のゼロは取り除かれます。また小数点以下に表示する桁が無い場合、 " -"``'#'`` オプションが使われた場合をのぞき、小数点は除去されます。" +"フォーマットした結果、指数部が ``exp`` になったと仮定します。\n" +"このとき ``m <= exp < p`` ならば、数値は書式 ``'f'`` 型および精度 ``p-1-" +"exp`` 桁でフォーマットされます。\n" +"ただし ``m`` は浮動小数点数では -4 であり、 :class:`Decimals ` に対しては -6 です。\n" +"それ以外の場合、数値は書式 ``'e'`` 型および精度 ``p-1`` 桁でフォーマットされ" +"ます。\n" +"どちらの場合も、``'#'`` オプションが使われていなければ、仮数部の有効でない末" +"尾のゼロを取り除き、小数点以下に桁が残らなければ小数点も取り除きます。" -#: ../../library/string.rst:582 msgid "" "With no precision given, uses a precision of ``6`` significant digits for :" "class:`float`. For :class:`~decimal.Decimal`, the coefficient of the result " @@ -1016,11 +1052,12 @@ msgid "" "place value of the least significant digit is larger than 1, and fixed-point " "notation is used otherwise." msgstr "" -"精度が指定されない場合、 :class:`float` に対しては有効桁数として ``6`` 桁を適" -"用します。 :class:`~decimal.Decimal` では、フォーマット結果の係数部は実際の" -"値の桁数によって決まります; 絶対値が ``1e-6`` より小さい値や、最下位桁の値が1" -"より大きい値では科学的表記が使われます。それ以外の場合は固定小数点表記が使わ" -"れます。" +"精度が指定されていない場合、:class:`float` には有効桁数 ``6`` 桁を使用しま" +"す。\n" +":class:`~decimal.Decimal` では、元の値の係数の各桁から結果の係数を構成しま" +"す。\n" +"絶対値が ``1e-6`` より小さい値や、最下位桁が十の位以上にある値には科学的表記" +"を使用し、それ以外には固定小数点表記を使用します。" #: ../../library/string.rst:591 msgid "" @@ -1062,7 +1099,6 @@ msgstr "" "パーセンテージです。数値は 100 倍され、固定小数点数フォーマット (``'f'``) で" "パーセント記号付きで表示されます。" -#: ../../library/string.rst:608 msgid "" "For :class:`float` this is like the ``'g'`` type, except that when fixed-" "point notation is used to format the result, it always includes at least one " @@ -1070,6 +1106,10 @@ msgid "" "``exp >= p - 1``. When the precision is not specified, the latter will be " "as large as needed to represent the given value faithfully." msgstr "" +":class:`float` では ``'g'`` とほぼ同じですが、固定小数点表記で書式化する場合" +"には常に小数点以下が少なくとも 1 桁あり、``exp >= p - 1`` のとき科学的表記に" +"切り替わります。\n" +"精度を指定しなければ、与えられた値を忠実に表すのに必要な精度を使います。" #: ../../library/string.rst:616 msgid "" @@ -1097,7 +1137,6 @@ msgid "" "mode of the current :ref:`context ` will be used." msgstr "" -#: ../../library/string.rst:629 msgid "" "The available presentation types for :class:`complex` are the same as those " "for :class:`float` (``'%'`` is not allowed). Both the real and imaginary " @@ -1108,6 +1147,14 @@ msgid "" "output of :func:`str` (complex numbers with a non-zero real part are also " "surrounded by parentheses), possibly altered by other format modifiers." msgstr "" +":class:`complex` で使える表現型は :class:`float` と同じです (``'%'`` は使えま" +"せん)。\n" +"複素数の実部と虚部はそれぞれ、指定した表現型に従って浮動小数点数として書式化" +"します。\n" +"実部と虚部の間には必須の虚部の符号を置き、虚部の末尾に ``j`` を付けます。\n" +"表現型を省略すると、結果は :func:`str` の出力に一致します (実部がゼロでない複" +"素数は丸括弧でも囲まれます) が、ほかの書式修正指定によって変更されることがあ" +"ります。" #: ../../library/string.rst:642 msgid "Format examples" @@ -1121,15 +1168,14 @@ msgstr "" "この節では、 :meth:`str.format` 構文の例を紹介し、さらに従来の ``%``-書式と比" "較します。" -#: ../../library/string.rst:647 msgid "" "In most of the cases the syntax is similar to the old ``%``-formatting, with " "the addition of the ``{}`` and with ``:`` used instead of ``%``. For " "example, ``'%03.2f'`` can be translated to ``'{:03.2f}'``." msgstr "" -"多くの場合、新構文に ``{}`` を加え、 ``%`` の代わりに ``:`` を使うことで、古" -"い ``%``-書式に類似した書式になります。例えば、``'%03.2f'`` は " -"``'{:03.2f}'`` と変換できます。" +"多くの場合、この構文は従来の ``%`` 書式化に似ていますが、``{}`` を追加し、" +"``%`` の代わりに ``:`` を使います。\n" +"例えば ``'%03.2f'`` は ``'{:03.2f}'`` に書き換えられます。" #: ../../library/string.rst:651 msgid "" @@ -1318,11 +1364,9 @@ msgstr "" ">>> \"int: {0:d}; hex: {0:#x}; oct: {0:#o}; bin: {0:#b}\".format(42)\n" "'int: 42; hex: 0x2a; oct: 0o52; bin: 0b101010'" -#: ../../library/string.rst:730 msgid "Using the comma or the underscore as a digit group separator::" -msgstr "" +msgstr "カンマやアンダースコアを桁区切り文字として使う例です。 ::" -#: ../../library/string.rst:732 msgid "" ">>> '{:,}'.format(1234567890)\n" "'1,234,567,890'\n" @@ -1339,6 +1383,20 @@ msgid "" ">>> '{:,._}'.format(123456789.123456789)\n" "'123,456,789.123_456_79'" msgstr "" +">>> '{:,}'.format(1234567890)\n" +"'1,234,567,890'\n" +">>> '{:_}'.format(1234567890)\n" +"'1_234_567_890'\n" +">>> '{:_b}'.format(1234567890)\n" +"'100_1001_1001_0110_0000_0010_1101_0010'\n" +">>> '{:_x}'.format(1234567890)\n" +"'4996_02d2'\n" +">>> '{:_}'.format(123456789.123456789)\n" +"'123_456_789.12345679'\n" +">>> '{:.,}'.format(123456789.123456789)\n" +"'123456789.123,456,79'\n" +">>> '{:,._}'.format(123456789.123456789)\n" +"'123,456,789.123_456_79'" #: ../../library/string.rst:747 msgid "Expressing a percentage::" @@ -1376,7 +1434,6 @@ msgstr "" msgid "Nesting arguments and more complex examples::" msgstr "引数をネストする、さらに複雑な例::" -#: ../../library/string.rst:763 msgid "" ">>> for align, text in zip('<^>', ['left', 'center', 'right']):\n" "... '{0:{fill}{align}16}'.format(text, fill=align, align=align)\n" @@ -1406,6 +1463,33 @@ msgid "" " 10 A 12 1010\n" " 11 B 13 1011" msgstr "" +">>> for align, text in zip('<^>', ['left', 'center', 'right']):\n" +"... '{0:{fill}{align}16}'.format(text, fill=align, align=align)\n" +"...\n" +"'left<<<<<<<<<<<<'\n" +"'^^^^^center^^^^^'\n" +"'>>>>>>>>>>>right'\n" +">>>\n" +">>> octets = [192, 168, 0, 1]\n" +">>> '{:02X}{:02X}{:02X}{:02X}'.format(*octets)\n" +"'C0A80001'\n" +">>> int(_, 16)\n" +"3232235521\n" +">>>\n" +">>> width = 5\n" +">>> for num in range(5,12):\n" +"... for base in 'dXob':\n" +"... print('{0:{width}{base}}'.format(num, base=base, width=width), " +"end=' ')\n" +"... print()\n" +"...\n" +" 5 5 5 101\n" +" 6 6 6 110\n" +" 7 7 7 111\n" +" 8 8 10 1000\n" +" 9 9 11 1001\n" +" 10 A 12 1010\n" +" 11 B 13 1011" #: ../../library/string.rst:795 msgid "Template strings" @@ -1441,7 +1525,6 @@ msgstr "" msgid "``$$`` is an escape; it is replaced with a single ``$``." msgstr "``$$`` はエスケープ文字です; ``$`` 一つに置換されます。" -#: ../../library/string.rst:811 msgid "" "``$identifier`` names a substitution placeholder matching a mapping key of " "``\"identifier\"``. By default, ``\"identifier\"`` is restricted to any " @@ -1450,12 +1533,13 @@ msgid "" "character after the ``$`` character terminates this placeholder " "specification." msgstr "" -"``$identifier`` は ``\"identifier\"`` のマッピングキーに合致する置換プレース" -"ホルダーを指定します。デフォルトでは、 ``\"identifier\"`` は大文字と小文字を" -"区別しない ASCII 英数字 (アンダースコアを含む) からなら文字列に制限されていま" -"す。文字列はアンダースコアか ASCII 文字から始まるものでなければなりません。" -"``$`` の後に識別子に使えない文字が出現すると、そこでプレースホルダ名の指定が" -"終わります。" +"``$identifier`` は、マッピングのキー ``\"identifier\"`` に対応する置換プレー" +"スホルダーを指定します。\n" +"デフォルトでは ``\"identifier\"`` に使えるのは、大文字・小文字を区別しない " +"ASCII の英数字とアンダースコアからなる文字列で、先頭はアンダースコアまたは " +"ASCII の英字でなければなりません。\n" +"``$`` の後で最初に現れる識別子に使えない文字が、プレースホルダー指定の終わり" +"を示します。" #: ../../library/string.rst:818 msgid "" @@ -1530,11 +1614,12 @@ msgstr "" "レースホルダ名を含むような不正なテンプレートを何も警告せずに無視するため、安" "全とはいえないのです。" -#: ../../library/string.rst:861 msgid "" "Returns ``False`` if the template has invalid placeholders that will cause :" "meth:`substitute` to raise :exc:`ValueError`." msgstr "" +"テンプレートに、:meth:`substitute` が :exc:`ValueError` を送出する原因となる" +"無効なプレースホルダーがある場合、``False`` を返します。" #: ../../library/string.rst:869 msgid "" @@ -1607,7 +1692,6 @@ msgstr "" "の書式、区切り文字、テンプレート文字列の解釈に使われている正規表現全体をカス" "タマイズできます。こうした作業には、以下のクラス属性をオーバライドします:" -#: ../../library/string.rst:904 msgid "" "*delimiter* -- This is the literal string describing a placeholder " "introducing delimiter. The default value is ``$``. Note that this should " @@ -1616,13 +1700,13 @@ msgid "" "delimiter after class creation (i.e. a different delimiter must be set in " "the subclass's class namespace)." msgstr "" -"*delimiter* -- プレースホルダの開始を示すリテラル文字列です。\n" -"デフォルトの値は ``$`` です。\n" -"実装系はこの文字列に対して必要に応じて :meth:`re.escape` を呼び出すので、正規" -"表現になってしまうような文字列にしては *なりません* 。\n" -"さらにクラスを作成した後に delimiter を変更できない (つまり、別の delimiter " -"を設定したいのであれば、サブクラスの名前空間で行わなければならない) ことに注" -"意してください。" +"*delimiter* -- プレースホルダーの開始を示すリテラル文字列です。\n" +"デフォルト値は ``$`` です。\n" +"実装は必要に応じてこの文字列に :meth:`re.escape` を適用するので、正規表現とし" +"て指定しては *なりません* 。\n" +"クラスの作成後に区切り文字を変更することはできません。\n" +"別の区切り文字を使うには、サブクラスのクラス名前空間で設定する必要がありま" +"す。" #: ../../library/string.rst:911 msgid "" @@ -1667,7 +1751,6 @@ msgstr "" "*braceidpattern* を使うと、波括弧付きと波括弧なしのプレースホルダーにそれぞれ" "異なるパターンを定義することができます。" -#: ../../library/string.rst:934 msgid "" "*flags* -- The regular expression flags that will be applied when compiling " "the regular expression used for recognizing substitutions. The default " @@ -1675,10 +1758,10 @@ msgid "" "to the flags, so custom *idpattern*\\ s must follow conventions for verbose " "regular expressions." msgstr "" -"*flags* -- 代入の認識のために使用される正規表現をコンパイルする際に適用される" -"正規表現フラグ。デフォルト値は ``re.IGNORECASE`` です。``re.VERBOSE`` が常に" -"フラグに追加されるということに注意してください。したがって、カスタムな " -"*idpattern* は verbose 正規表現の規約に従わなければなりません。" +"*flags* -- 置換箇所を認識する正規表現のコンパイル時に適用するフラグです。\n" +"デフォルト値は ``re.IGNORECASE`` です。\n" +"``re.VERBOSE`` は常に追加されるため、独自の *idpattern* は verbose モードの正" +"規表現の規則に従う必要があります。" #: ../../library/string.rst:942 msgid "" @@ -1710,13 +1793,12 @@ msgstr "" "*named* -- このグループは波括弧でくくらないプレースホルダ名に対応します; キャ" "プチャグループに区切り文字を含めてはなりません。" -#: ../../library/string.rst:954 msgid "" "*braced* -- This group matches the brace enclosed placeholder name; it " "should not include either the delimiter or braces in the capturing group." msgstr "" -"*braced* -- このグループは波括弧でくくったプレースホルダ名に対応します; キャ" -"プチャグループに区切り文字を含めてはなりません。" +"*braced* -- このグループは波括弧で囲んだプレースホルダー名に対応します。\n" +"キャプチャグループには区切り文字も波括弧も含めてはなりません。" #: ../../library/string.rst:957 msgid "" @@ -1813,7 +1895,7 @@ msgstr "# (hash)" #: ../../library/string.rst:449 msgid ", (comma)" -msgstr ", (カンマ)" +msgstr ", (comma)" #: ../../library/string.rst:449 msgid "_ (underscore)" diff --git a/library/stringprep.po b/library/stringprep.po index 1fb946d18..bfdf5bdec 100644 --- a/library/stringprep.po +++ b/library/stringprep.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/stringprep.rst:2 @@ -103,11 +103,10 @@ msgstr "" "*code* がテーブル A.1 (Unicode 3.2 における未割り当てコードポイント: " "unassigned code point) かどうか判定します。" -#: ../../library/stringprep.rst:49 msgid "Determine whether *code* is in tableB.1 (Commonly mapped to nothing)." msgstr "" -"*code* がテーブル B.1 (一般には何にも対応付けられていない: commonly mapped " -"to nothing) かどうか判定します。" +"*code* がテーブル B.1 (通常、空文字列に対応付けて削除する文字) に含まれるかど" +"うかを判定します。" #: ../../library/stringprep.rst:54 msgid "" @@ -169,9 +168,9 @@ msgstr "" "*code* がテーブル C.4 (非文字コードポイント: non-character code points) かど" "うか判定します。" -#: ../../library/stringprep.rst:108 msgid "Determine whether *code* is in tableC.5 (Surrogate codes)." -msgstr "*code* がテーブル C.5 (サロゲーションコード) かどうか判定します。" +msgstr "" +"*code* がテーブル C.5 (サロゲートコード) に含まれるかどうかを判定します。" #: ../../library/stringprep.rst:113 msgid "" @@ -187,12 +186,12 @@ msgstr "" "*code* がテーブル C.7 (標準表現:canonical representation として不適切) かど" "うか判定します。" -#: ../../library/stringprep.rst:124 msgid "" "Determine whether *code* is in tableC.8 (Change display properties or are " "deprecated)." msgstr "" -"*code* がテーブル C.8 (表示プロパティの変更または撤廃) かどうか判定します。" +"*code* がテーブル C.8 (表示属性を変更する文字、または非推奨の文字) に含まれる" +"かどうかを判定します。" #: ../../library/stringprep.rst:130 msgid "Determine whether *code* is in tableC.9 (Tagging characters)." diff --git a/library/struct.po b/library/struct.po index ca0cb22c2..5c7fc9ce3 100644 --- a/library/struct.po +++ b/library/struct.po @@ -23,10 +23,10 @@ msgstr "" "Last-Translator: Nozomu Kaneko , 2025\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/struct.rst:2 @@ -37,7 +37,6 @@ msgstr ":mod:`!struct` --- バイト列をパックされたバイナリデー msgid "**Source code:** :source:`Lib/struct.py`" msgstr "**ソースコード:** :source:`Lib/struct.py`" -#: ../../library/struct.rst:19 msgid "" "This module converts between Python values and C structs represented as " "Python :class:`bytes` objects. Compact :ref:`format strings ` で、Python の値との変換方法" +"を記述します。\n" +"このモジュールの関数とオブジェクトには、大きく分けて 2 つの用途があります。\n" +"外部のデータ源 (ファイルやネットワーク接続) とのデータ交換と、Python アプリ" +"ケーションと C の層との間のデータ転送です。" -#: ../../library/struct.rst:29 msgid "" "When no prefix character is given, native mode is the default. It packs or " "unpacks data based on the platform and compiler on which the Python " @@ -59,6 +64,15 @@ msgid "" "for defining byte ordering and padding between elements. See :ref:`struct-" "alignment` for details." msgstr "" +"接頭文字を指定しなければ、デフォルトはネイティブモードです。\n" +"Python インタープリタのビルドに使われたプラットフォームとコンパイラに基づいて" +"データをパックまたはアンパックします。\n" +"C の構造体をパックした結果には、各 C 型の適切なアラインメントを維持するパディ" +"ングバイトが含まれます。\n" +"アンパック時も同様にアラインメントを考慮します。\n" +"一方、外部のデータ源とのデータ通信では、バイトオーダと要素間のパディングをプ" +"ログラマーが定義する必要があります。\n" +"詳しくは :ref:`struct-alignment` を参照してください。" #: ../../library/struct.rst:39 msgid "" @@ -93,15 +107,14 @@ msgid "" msgstr "" "様々な状況で送出される例外です。引数は何が問題なのかを記述する文字列です。" -#: ../../library/struct.rst:61 msgid "" "Return a bytes object containing the values *v1*, *v2*, ... packed according " "to the format string *format*. The arguments must match the values required " "by the format exactly." msgstr "" -"フォーマット文字列 *format* に従い値 *v1*, *v2*, ... をパックして、バイト列" -"オブジェクトを返します。引数は指定したフォーマットが要求する型と正確に一致し" -"ていなければなりません。" +"書式文字列 *format* に従って値 *v1*、*v2*、... をパックしたバイト列オブジェク" +"トを返します。\n" +"引数は、書式が要求する値に正確に対応していなければなりません。" #: ../../library/struct.rst:68 msgid "" @@ -170,7 +183,6 @@ msgstr "" msgid "Format Strings" msgstr "書式文字列" -#: ../../library/struct.rst:113 msgid "" "Format strings describe the data layout when packing and unpacking data. " "They are built up from :ref:`format characters`, which " @@ -180,12 +192,18 @@ msgid "" "which describes the overall properties of the data and one or more format " "characters which describe the actual data values and padding." msgstr "" +"書式文字列は、パックとアンパックの際のデータの配置を記述します。\n" +"パックまたはアンパックするデータの型を指定する :ref:`書式指定文字 ` を組み合わせて作ります。\n" +"さらに、特殊な文字で :ref:`バイトオーダ、サイズ、アラインメント ` を制御します。\n" +"各書式文字列は、データ全体の性質を記述する省略可能な接頭文字と、実際の値やパ" +"ディングを記述する 1 つ以上の書式指定文字からなります。" #: ../../library/struct.rst:125 msgid "Byte Order, Size, and Alignment" msgstr "バイトオーダ、サイズ、アラインメント" -#: ../../library/struct.rst:127 msgid "" "By default, C types are represented in the machine's native format and byte " "order, and properly aligned by skipping pad bytes if necessary (according to " @@ -194,6 +212,13 @@ msgid "" "corresponding C struct. Whether to use native byte ordering and padding or " "standard formats depends on the application." msgstr "" +"デフォルトでは、C の型をマシンのネイティブな形式とバイトオーダで表し、必要に" +"応じてパディングバイトを挟んで適切に配置します (C コンパイラの規則に従いま" +"す)。\n" +"この動作によって、パックされた構造体のバイト列は、対応する C の構造体のメモリ" +"配置と正確に一致します。\n" +"ネイティブのバイトオーダとパディングを使うか、標準の形式を使うかは用途により" +"ます。" #: ../../library/struct.rst:143 msgid "" @@ -273,19 +298,16 @@ msgstr "" "フォーマット文字列の最初の文字が上のいずれかでない場合、``'@'`` であるとみな" "されます。" -#: ../../library/struct.rst:165 msgid "" "The number 1023 (``0x3ff`` in hexadecimal) has the following byte " "representations:" -msgstr "" +msgstr "数値 1023 (16 進数では ``0x3ff``) は、次のバイト列で表されます:" -#: ../../library/struct.rst:167 msgid "``03 ff`` in big-endian (``>``)" -msgstr "" +msgstr "ビッグエンディアン (``>``) では ``03 ff``" -#: ../../library/struct.rst:168 msgid "``ff 03`` in little-endian (``<``)" -msgstr "" +msgstr "リトルエンディアン (``<``) では ``ff 03``" #: ../../library/struct.rst:170 msgid "Python example:" @@ -329,11 +351,13 @@ msgstr "" "``'@'`` と ``'='`` の違いに注意してください: 両方ともネイティブのバイトオーダ" "ですが、後者のバイトサイズとアラインメントは標準のものに合わせてあります。" -#: ../../library/struct.rst:192 msgid "" "The form ``'!'`` represents the network byte order which is always big-" "endian as defined in `IETF RFC 1700 `_." msgstr "" +"``'!'`` はネットワークバイトオーダを表します。\n" +"`IETF RFC 1700 `_ で定義されているとおり、常にビッグエンディ" +"アンです。" #: ../../library/struct.rst:195 msgid "" @@ -378,7 +402,6 @@ msgstr "" msgid "Format Characters" msgstr "書式指定文字" -#: ../../library/struct.rst:216 msgid "" "Format characters have the following meaning; the conversion between C and " "Python values should be obvious given their types. The 'Standard size' " @@ -387,12 +410,13 @@ msgid "" "``'!'`` or ``'='``. When using native size, the size of the packed value is " "platform-dependent." msgstr "" -"フォーマット文字 (format character) は以下の意味を持っています; C と Python " -"の間の変換では、値は正確に以下に指定された型でなくてはなりません: 「標準のサ" -"イズ」列は standard サイズ使用時にパックされた値が何バイトかを示します。つま" -"り、フォーマット文字列が ``'<'``, ``'>'``, ``'!'``, ``'='`` のいずれかで始" -"まっている場合のものです。native サイズ使用時にはパックされた値の大きさはプ" -"ラットフォーム依存です。" +"書式指定文字には以下の意味があります。\n" +"C と Python の値の変換関係は、表に示すそれぞれの型から分かります。\n" +"「標準のサイズ」列は standard サイズ使用時にパックされた値が何バイトかを示し" +"ます。\n" +"つまり、フォーマット文字列が ``'<'``, ``'>'``, ``'!'``, ``'='`` のいずれかで" +"始まっている場合のものです。\n" +"native サイズ使用時にはパックされた値の大きさはプラットフォーム依存です。" #: ../../library/struct.rst:224 msgid "Format" @@ -451,9 +475,8 @@ msgstr "1" msgid "``b``" msgstr "``b``" -#: ../../library/struct.rst:230 msgid ":c:expr:`signed char`" -msgstr "" +msgstr ":c:expr:`signed char`" #: ../../library/struct.rst:230 ../../library/struct.rst:232 #: ../../library/struct.rst:236 ../../library/struct.rst:238 @@ -491,7 +514,7 @@ msgstr "``?``" #: ../../library/struct.rst:234 msgid ":c:expr:`_Bool`" -msgstr "" +msgstr ":c:expr:`_Bool`" #: ../../library/struct.rst:234 msgid "bool" @@ -564,9 +587,8 @@ msgstr ":c:expr:`unsigned long`" msgid "``q``" msgstr "``q``" -#: ../../library/struct.rst:248 msgid ":c:expr:`long long`" -msgstr "" +msgstr ":c:expr:`long long`" #: ../../library/struct.rst:248 ../../library/struct.rst:250 #: ../../library/struct.rst:261 ../../library/struct.rst:263 @@ -577,9 +599,8 @@ msgstr "8" msgid "``Q``" msgstr "``Q``" -#: ../../library/struct.rst:250 msgid ":c:expr:`unsigned long long`" -msgstr "" +msgstr ":c:expr:`unsigned long long`" #: ../../library/struct.rst:253 msgid "``n``" @@ -639,25 +660,22 @@ msgstr ":c:expr:`double`" msgid "``F``" msgstr "" -#: ../../library/struct.rst:263 msgid ":c:expr:`float complex`" -msgstr "" +msgstr ":c:expr:`float complex`" #: ../../library/struct.rst:263 ../../library/struct.rst:265 msgid "complex" msgstr "複素数" -#: ../../library/struct.rst:263 ../../library/struct.rst:265 msgid "\\(10)" -msgstr "" +msgstr "\\(10)" #: ../../library/struct.rst:265 msgid "``D``" msgstr "" -#: ../../library/struct.rst:265 msgid ":c:expr:`double complex`" -msgstr "" +msgstr ":c:expr:`double complex`" #: ../../library/struct.rst:265 msgid "16" @@ -669,7 +687,7 @@ msgstr "``s``" #: ../../library/struct.rst:267 ../../library/struct.rst:269 msgid ":c:expr:`char[]`" -msgstr "" +msgstr ":c:expr:`char[]`" #: ../../library/struct.rst:267 ../../library/struct.rst:269 msgid "bytes" @@ -691,9 +709,8 @@ msgstr "\\(8)" msgid "``P``" msgstr "``P``" -#: ../../library/struct.rst:271 msgid ":c:expr:`void \\*`" -msgstr "" +msgstr ":c:expr:`void \\*`" #: ../../library/struct.rst:271 msgid "\\(5)" @@ -707,26 +724,30 @@ msgstr "``'n'`` および ``'N'`` フォーマットのサポートが追加さ msgid "Added support for the ``'e'`` format." msgstr "``'e'`` フォーマットのサポートが追加されました。" -#: ../../library/struct.rst:280 msgid "Added support for the ``'F'`` and ``'D'`` formats." -msgstr "" +msgstr "``'F'`` と ``'D'`` の書式がサポートされました。" -#: ../../library/struct.rst:289 msgid "" "The ``'?'`` conversion code corresponds to the :c:expr:`_Bool` type defined " "by C standards since C99. In standard mode, it is represented by one byte." msgstr "" +"``'?'`` 変換コードは、C99 以降の C 規格で定義されている :c:expr:`_Bool` 型に" +"対応します。\n" +"標準モードでは 1 バイトで表します。" -#: ../../library/struct.rst:294 msgid "" "When attempting to pack a non-integer using any of the integer conversion " "codes, if the non-integer has a :meth:`~object.__index__` method then that " "method is called to convert the argument to an integer before packing." msgstr "" +"整数の変換コードで整数以外の値をパックしようとした場合、その値に :meth:" +"`~object.__index__` メソッドがあれば、パックする前にそのメソッドを呼び出して" +"引数を整数に変換します。" -#: ../../library/struct.rst:298 msgid "Added use of the :meth:`~object.__index__` method for non-integers." msgstr "" +"整数以外の値に対して :meth:`~object.__index__` メソッドを使うようになりまし" +"た。" #: ../../library/struct.rst:302 msgid "" @@ -752,7 +773,6 @@ msgstr "" "binary16(``'e'`` の場合) フォーマットが、プラットフォームにおける浮動小数点数" "のフォーマットに関係なく使われます。" -#: ../../library/struct.rst:314 msgid "" "The ``'P'`` format character is only available for the native byte ordering " "(selected as the default or with the ``'@'`` byte order character). The byte " @@ -761,9 +781,9 @@ msgid "" "ordering, so the ``'P'`` format is not available." msgstr "" "``'P'`` フォーマット文字はネイティブバイトオーダでのみ利用可能です (デフォル" -"トのネットワークバイトオーダに設定するか、``'@'`` バイトオーダ指定文字を指定" -"しなければなりません)。``'='`` を指定した場合、ホスト計算機のバイトオーダに基" -"づいてリトルエンディアンとビッグエンディアンのどちらを使うかを決めます。" +"トの設定を使うか、``'@'`` バイトオーダ指定文字を指定しなければなりません)。\n" +"``'='`` を指定した場合、ホスト計算機のバイトオーダに基づいてリトルエンディア" +"ンとビッグエンディアンのどちらを使うかを決めます。\n" "struct モジュールはこの設定をネイティブのオーダ設定として解釈しないので、" "``'P'`` を使うことはできません。" @@ -788,9 +808,8 @@ msgstr "" "詳しいことは Wikipedia の `half-precision floating-point format `_ のページを参照してください。" -#: ../../library/struct.rst:331 msgid "When packing, ``'x'`` inserts one NUL byte." -msgstr "" +msgstr "パック時に ``'x'`` は NUL バイトを 1 つ挿入します。" #: ../../library/struct.rst:334 msgid "" @@ -870,13 +889,12 @@ msgstr "" "き ``x`` がフォーマットの適切な値の範囲に無い場合、 :exc:`struct.error` が送" "出されます。" -#: ../../library/struct.rst:380 msgid "" "Previously, some of the integer formats wrapped out-of-range values and " "raised :exc:`DeprecationWarning` instead of :exc:`struct.error`." msgstr "" -"以前は、いくつかの整数フォーマットが適切な範囲にない値を覆い隠して、 :exc:" -"`struct.error` の代わりに :exc:`DeprecationWarning` を送出していました。" +"以前は、一部の整数フォーマットでは範囲外の値を範囲内に折り返し、:exc:`struct." +"error` の代わりに :exc:`DeprecationWarning` を送出していました。" #: ../../library/struct.rst:386 msgid "" @@ -894,20 +912,21 @@ msgstr "" msgid "Examples" msgstr "使用例" -#: ../../library/struct.rst:399 msgid "" "Native byte order examples (designated by the ``'@'`` format prefix or lack " "of any prefix character) may not match what the reader's machine produces as " "that depends on the platform and compiler." msgstr "" +"ネイティブのバイトオーダを使う例 (書式の接頭文字が ``'@'``、または接頭文字が" +"ない場合) の結果は、プラットフォームとコンパイラに依存するため、読者のマシン" +"での結果と一致しないことがあります。" -#: ../../library/struct.rst:404 msgid "" "Pack and unpack integers of three different sizes, using big endian " "ordering::" msgstr "" +"ビッグエンディアンで、3 種類のサイズの整数をパック、アンパックします。 ::" -#: ../../library/struct.rst:407 msgid "" ">>> from struct import *\n" ">>> pack(\">bhl\", 1, 2, 3)\n" @@ -917,31 +936,42 @@ msgid "" ">>> calcsize('>bhl')\n" "7" msgstr "" +">>> from struct import *\n" +">>> pack(\">bhl\", 1, 2, 3)\n" +"b'\\x01\\x00\\x02\\x00\\x00\\x00\\x03'\n" +">>> unpack('>bhl', b'\\x01\\x00\\x02\\x00\\x00\\x00\\x03')\n" +"(1, 2, 3)\n" +">>> calcsize('>bhl')\n" +"7" -#: ../../library/struct.rst:415 msgid "Attempt to pack an integer which is too large for the defined field::" -msgstr "" +msgstr "指定したフィールドには大きすぎる整数をパックしようとする例です。 ::" -#: ../../library/struct.rst:417 msgid "" ">>> pack(\">h\", 99999)\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" "struct.error: 'h' format requires -32768 <= number <= 32767" msgstr "" +">>> pack(\">h\", 99999)\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"struct.error: 'h' format requires -32768 <= number <= 32767" -#: ../../library/struct.rst:422 msgid "" "Demonstrate the difference between ``'s'`` and ``'c'`` format characters::" -msgstr "" +msgstr "``'s'`` と ``'c'`` 書式指定文字の違いを示します。 ::" -#: ../../library/struct.rst:425 msgid "" ">>> pack(\"@ccc\", b'1', b'2', b'3')\n" "b'123'\n" ">>> pack(\"@3s\", b'123')\n" "b'123'" msgstr "" +">>> pack(\"@ccc\", b'1', b'2', b'3')\n" +"b'123'\n" +">>> pack(\"@3s\", b'123')\n" +"b'123'" #: ../../library/struct.rst:430 msgid "" @@ -951,7 +981,6 @@ msgstr "" "アンパックした結果のフィールドは、変数に割り当てるか named tuple でラップする" "ことによって名前を付けることができます::" -#: ../../library/struct.rst:433 msgid "" ">>> record = b'raymond \\x32\\x12\\x08\\x01\\x08'\n" ">>> name, serialnum, school, gradelevel = unpack('<10sHHb', record)\n" @@ -961,8 +990,14 @@ msgid "" ">>> Student._make(unpack('<10sHHb', record))\n" "Student(name=b'raymond ', serialnum=4658, school=264, gradelevel=8)" msgstr "" +">>> record = b'raymond \\x32\\x12\\x08\\x01\\x08'\n" +">>> name, serialnum, school, gradelevel = unpack('<10sHHb', record)\n" +"\n" +">>> from collections import namedtuple\n" +">>> Student = namedtuple('Student', 'name serialnum school gradelevel')\n" +">>> Student._make(unpack('<10sHHb', record))\n" +"Student(name=b'raymond ', serialnum=4658, school=264, gradelevel=8)" -#: ../../library/struct.rst:441 msgid "" "The ordering of format characters may have an impact on size in native mode " "since padding is implicit. In standard mode, the user is responsible for " @@ -971,8 +1006,14 @@ msgid "" "integer on a four-byte boundary. In this example, the output was produced on " "a little endian machine::" msgstr "" +"ネイティブモードではパディングが暗黙的に行われるため、書式指定文字の順序がサ" +"イズに影響することがあります。\n" +"標準モードでは、必要なパディングを利用者が挿入しなければなりません。\n" +"以下の最初の ``pack`` 呼び出しでは、続く整数を 4 バイト境界にそろえるため、" +"パックされた ``'#'`` の後に 3 つの NUL バイトが追加されていることに注目してく" +"ださい。\n" +"この例の出力はリトルエンディアンのマシンで生成しました。 ::" -#: ../../library/struct.rst:449 msgid "" ">>> pack('@ci', b'#', 0x12131415)\n" "b'#\\x00\\x00\\x00\\x15\\x14\\x13\\x12'\n" @@ -983,18 +1024,28 @@ msgid "" ">>> calcsize('@ic')\n" "5" msgstr "" +">>> pack('@ci', b'#', 0x12131415)\n" +"b'#\\x00\\x00\\x00\\x15\\x14\\x13\\x12'\n" +">>> pack('@ic', 0x12131415, b'#')\n" +"b'\\x15\\x14\\x13\\x12#'\n" +">>> calcsize('@ci')\n" +"8\n" +">>> calcsize('@ic')\n" +"5" -#: ../../library/struct.rst:458 msgid "" "The following format ``'llh0l'`` results in two pad bytes being added at the " "end, assuming the platform's longs are aligned on 4-byte boundaries::" msgstr "" +"以下の書式 ``'llh0l'`` では、このプラットフォームの long が 4 バイト境界に配" +"置されるとすると、末尾にパディングバイトが 2 つ追加されます。 ::" -#: ../../library/struct.rst:461 msgid "" ">>> pack('@llh0l', 1, 2, 3)\n" "b'\\x00\\x00\\x00\\x01\\x00\\x00\\x00\\x02\\x00\\x03\\x00\\x00'" msgstr "" +">>> pack('@llh0l', 1, 2, 3)\n" +"b'\\x00\\x00\\x00\\x01\\x00\\x00\\x00\\x02\\x00\\x03\\x00\\x00'" #: ../../library/struct.rst:467 msgid "Module :mod:`array`" @@ -1008,21 +1059,19 @@ msgstr "一様なデータ型からなるバイナリ記録データのパック msgid "Module :mod:`json`" msgstr ":mod:`json` モジュール" -#: ../../library/struct.rst:471 msgid "JSON encoder and decoder." -msgstr "" +msgstr "JSON のエンコーダーとデコーダー。" #: ../../library/struct.rst:473 msgid "Module :mod:`pickle`" msgstr ":mod:`pickle` モジュール" -#: ../../library/struct.rst:474 msgid "Python object serialization." -msgstr "" +msgstr "Python オブジェクトのシリアライズ。" #: ../../library/struct.rst:480 msgid "Applications" -msgstr "" +msgstr "アプリケーション" #: ../../library/struct.rst:482 msgid "" @@ -1034,11 +1083,9 @@ msgid "" "speaking, the format strings constructed for these two domains are distinct." msgstr "" -#: ../../library/struct.rst:493 msgid "Native Formats" -msgstr "" +msgstr "ネイティブの形式" -#: ../../library/struct.rst:495 msgid "" "When constructing format strings which mimic native layouts, the compiler " "and machine architecture determine byte ordering and padding. In such cases, " @@ -1048,50 +1095,64 @@ msgid "" "format string to round up to the correct byte boundary for proper alignment " "of consecutive chunks of data." msgstr "" +"ネイティブのメモリ配置を再現する書式文字列を作る場合、バイトオーダとパディン" +"グはコンパイラとマシンのアーキテクチャによって決まります。\n" +"この場合、``@`` 書式指定文字でネイティブのバイトオーダとデータサイズを指定し" +"てください。\n" +"内部のパディングバイトは通常、自動的に挿入されます。\n" +"データの塊を続けて配置するときに適切なアラインメントにするには、正しいバイト" +"境界まで切り上げるため、書式文字列の末尾に繰り返し回数がゼロの書式コードが必" +"要になることがあります。" -#: ../../library/struct.rst:503 msgid "" "Consider these two simple examples (on a 64-bit, little-endian machine)::" msgstr "" +"64 ビットのリトルエンディアンのマシンで、次の 2 つの簡単な例を考えます。 ::" -#: ../../library/struct.rst:506 msgid "" ">>> calcsize('@lhl')\n" "24\n" ">>> calcsize('@llh')\n" "18" msgstr "" +">>> calcsize('@lhl')\n" +"24\n" +">>> calcsize('@llh')\n" +"18" -#: ../../library/struct.rst:511 msgid "" "Data is not padded to an 8-byte boundary at the end of the second format " "string without the use of extra padding. A zero-repeat format code solves " "that problem::" msgstr "" +"2 番目の書式文字列では、パディングを追加しない限り、データの末尾は 8 バイト境" +"界にそろいません。\n" +"繰り返し回数がゼロの書式コードでこの問題を解決できます。 ::" -#: ../../library/struct.rst:515 msgid "" ">>> calcsize('@llh0l')\n" "24" msgstr "" +">>> calcsize('@llh0l')\n" +"24" -#: ../../library/struct.rst:518 msgid "" "The ``'x'`` format code can be used to specify the repeat, but for native " "formats it is better to use a zero-repeat format like ``'0l'``." msgstr "" +"``'x'`` 書式コードの繰り返しでも指定できますが、ネイティブの形式では " +"``'0l'`` のような繰り返し回数がゼロの書式を使う方が適切です。" -#: ../../library/struct.rst:521 msgid "" "By default, native byte ordering and alignment is used, but it is better to " "be explicit and use the ``'@'`` prefix character." msgstr "" +"デフォルトではネイティブのバイトオーダとアラインメントを使いますが、接頭文字 " +"``'@'`` で明示する方がよいでしょう。" -#: ../../library/struct.rst:528 msgid "Standard Formats" -msgstr "" +msgstr "標準の形式" -#: ../../library/struct.rst:530 msgid "" "When exchanging data beyond your process such as networking or storage, be " "precise. Specify the exact byte order, size, and alignment. Do not assume " @@ -1104,8 +1165,19 @@ msgid "" "must explicitly add ``'x'`` pad bytes where needed. Revisiting the examples " "from the previous section, we have::" msgstr "" +"ネットワークやストレージなど、プロセスの外部とデータをやり取りするときは、バ" +"イトオーダ、サイズ、アラインメントを正確に指定してください。\n" +"特定のマシンのネイティブの形式と一致するとは仮定しないでください。\n" +"例えば、ネットワークバイトオーダはビッグエンディアンですが、多くの普及した " +"CPU はリトルエンディアンです。\n" +"これらを明示的に定義すれば、コードの実行環境の詳細を気にせずに済みます。\n" +"通常、最初の文字には ``<`` または ``>`` (あるいは ``!``) を使います。\n" +"パディングはプログラマーが行う必要があります。\n" +"繰り返し回数がゼロの書式指定文字は役に立ちません。\n" +"代わりに、必要な場所に ``'x'`` のパディングバイトを明示的に追加しなければなり" +"ません。\n" +"前の節の例を見直すと、次のようになります。 ::" -#: ../../library/struct.rst:542 msgid "" ">>> calcsize('>> pack('@llh0l', 1, 2, 3) == pack('>> calcsize('>> pack('>> calcsize('@llh')\n" +"18\n" +">>> pack('@llh', 1, 2, 3) == pack('>> calcsize('>> calcsize('@llh0l')\n" +"24\n" +">>> pack('@llh0l', 1, 2, 3) == pack('>> calcsize('>> pack('@llh0l', 1, 2, 3) == pack('>> calcsize('>> calcsize('@llh0l')\n" +"12\n" +">>> pack('@llh0l', 1, 2, 3) == pack('` or :ref:`WebAssembly platforms `." msgstr "" +"このモジュールは :ref:`モバイルプラットフォーム ` と :" +"ref:`WebAssemblyプラットフォーム ` をサポートしません。" #: ../../library/subprocess.rst:31 msgid "Using the :mod:`subprocess` Module" msgstr ":mod:`subprocess` モジュールを使う" -#: ../../library/subprocess.rst:33 msgid "" "The recommended approach to invoking subprocesses is to use the :func:`run` " "function for all use cases it can handle. For more advanced use cases, the " "underlying :class:`Popen` interface can be used directly." msgstr "" -"サブプロセスを起動するために推奨される方法は、すべての用法を扱える :func:" -"`run` 関数を使用することです。より高度な用法では下層の :class:`Popen` イン" -"ターフェースを直接使用することもできます。" +"サブプロセスの起動には、:func:`run` 関数で対応できる用途であればこの関数を使" +"うことを推奨します。\n" +"より高度な用途では、下層の :class:`Popen` インターフェースを直接使用できま" +"す。" #: ../../library/subprocess.rst:43 msgid "" @@ -102,7 +101,6 @@ msgstr "" "*args* で指定されたコマンドを実行します。コマンドの完了を待って、:class:" "`CompletedProcess` インスタンスを返します。" -#: ../../library/subprocess.rst:46 msgid "" "The arguments shown above are merely the most common ones, described below " "in :ref:`frequently-used-arguments` (hence the use of keyword-only notation " @@ -113,12 +111,13 @@ msgid "" msgstr "" "上記の引数は、もっともよく使われるものだけ示しており、後述の :ref:" "`frequently-used-arguments` で説明されています (そのためここではキーワード専" -"用引数の表記に省略されています)。関数の完全な使用法を説明しても大部分が :" -"class:`Popen` コンストラクターの内容と同じになります - この関数のほとんどの引" -"数は :class:`Popen` インターフェイスに渡されます。(*timeout*、*input* および " -"*check* は除く。)" +"用引数の表記に省略されています)。\n" +"関数の完全な使用法を説明しても大部分が :class:`Popen` コンストラクターの内容" +"と同じになります - この関数のほとんどの引数は ``Popen`` インターフェイスに渡" +"されます。\n" +"(*timeout*、*input*、*check*、*capture_output* は除きます。\n" +")" -#: ../../library/subprocess.rst:53 msgid "" "If *capture_output* is true, stdout and stderr will be captured. When used, " "the internal :class:`Popen` object is automatically created with *stdout* " @@ -128,8 +127,14 @@ msgid "" "`~subprocess.PIPE` and *stderr* to :data:`~subprocess.STDOUT`, instead of " "using *capture_output*." msgstr "" +"*capture_output* が真なら、標準出力と標準エラー出力を捕捉します。\n" +"この指定を使うと、内部の :class:`Popen` オブジェクトは *stdout* と *stderr* " +"の両方を :data:`~subprocess.PIPE` に設定して自動的に作成されます。\n" +"*stdout* や *stderr* 引数は *capture_output* と同時には指定できません。\n" +"両方のストリームをまとめて捕捉するには、*capture_output* を使わず、*stdout* " +"を :data:`~subprocess.PIPE`、*stderr* を :data:`~subprocess.STDOUT` に設定し" +"てください。" -#: ../../library/subprocess.rst:62 msgid "" "A *timeout* may be specified in seconds, it is internally passed on to :meth:" "`Popen.communicate`. If the timeout expires, the child process will be " @@ -138,8 +143,14 @@ msgid "" "cannot be interrupted on many platform APIs so you are not guaranteed to see " "a timeout exception until at least after however long process creation takes." msgstr "" +"*timeout* には秒数を指定でき、内部で :meth:`Popen.communicate` に渡されま" +"す。\n" +"タイムアウトすると子プロセスを強制終了させ、その終了を待ちます。\n" +"子プロセスが終了した後に :exc:`TimeoutExpired` 例外を再送出します。\n" +"多くのプラットフォームの API では最初のプロセス作成自体を中断できないため、少" +"なくともプロセス作成にかかる時間が経過するまでは、タイムアウト例外が発生する" +"保証はありません。" -#: ../../library/subprocess.rst:70 msgid "" "The *input* argument is passed to :meth:`Popen.communicate` and thus to the " "subprocess's stdin. If used it must be a byte sequence, or a string if " @@ -147,6 +158,13 @@ msgid "" "internal :class:`Popen` object is automatically created with *stdin* set to :" "data:`~subprocess.PIPE`, and the *stdin* argument may not be used as well." msgstr "" +"*input* 引数は :meth:`Popen.communicate` に渡され、サブプロセスの標準入力に送" +"られます。\n" +"指定する場合はバイト列にする必要がありますが、*encoding* または *errors* を指" +"定するか *text* が真なら文字列にします。\n" +"この指定を使うと、内部の :class:`Popen` オブジェクトは *stdin* を :data:" +"`~subprocess.PIPE` に設定して自動的に作成されるため、*stdin* 引数は併用できま" +"せん。" #: ../../library/subprocess.rst:77 msgid "" @@ -160,7 +178,6 @@ msgstr "" "この例外の属性には、引数、終了コード、標準出力および標準エラー出力が捕捉でき" "た場合に格納されます。" -#: ../../library/subprocess.rst:82 msgid "" "If *encoding* or *errors* are specified, or *text* is true, file objects for " "stdin, stdout and stderr are opened in text mode using the specified " @@ -168,15 +185,14 @@ msgid "" "*universal_newlines* argument is equivalent to *text* and is provided for " "backwards compatibility. By default, file objects are opened in binary mode." msgstr "" -"*encoding* または *errors* 引数が指定されるか、*text* 引数が true である場" -"合、stdin, stdout および stderr のためのファイルオブジェクトはテキストモード" -"でオープンされます。 その際には指定された *encoding* および *errors* が使われ" -"るか、デフォルトの :class:`io.TextIOWrapper` になります。" -"*universal_newlines* 引数は *text* 引数と等価であり、後方互換性のために提供さ" -"れています。そうでない場合、デフォルトでこれらのファイルオブジェクトはバイナ" -"リモードでオープンされます。" +"*encoding* または *errors* を指定するか、*text* が真なら、標準入力、標準出" +"力、標準エラー出力のファイルオブジェクトをテキストモードで開きます。\n" +"その際には、指定された *encoding* と *errors*、または :class:`io." +"TextIOWrapper` のデフォルト値を使います。\n" +"*universal_newlines* 引数は *text* と同じ意味で、後方互換性のために用意されて" +"います。\n" +"デフォルトでは、ファイルオブジェクトをバイナリモードで開きます。" -#: ../../library/subprocess.rst:88 msgid "" "If *env* is not ``None``, it must be a mapping that defines the environment " "variables for the new process; these are used instead of the default " @@ -185,17 +201,20 @@ msgid "" "or bytes to bytes on POSIX platforms much like :data:`os.environ` or :data:" "`os.environb`." msgstr "" -"*env* が ``None`` 以外の場合、これは新しいプロセスでの環境変数を定義します。" -"デフォルトでは、子プロセスは現在のプロセスの環境変数を引き継ぎます。 :class:" -"`Popen` に直接渡されます。あらゆるプラットフォームで :data:`os.environ` のよ" -"うに文字列から文字列へ、またPOSIX プラットフォームにおいては :data:`os." -"environb` のようにバイトからバイトへも、定義すること出来ます。" +"*env* が ``None`` でない場合は、新しいプロセスの環境変数を定義するマッピング" +"を指定します。\n" +"現在のプロセスの環境を継承するデフォルトの動作に代わり、このマッピングが使用" +"されます。\n" +":class:`Popen` に直接渡されます。\n" +":data:`os.environ` と同様に、どのプラットフォームでも文字列から文字列へのマッ" +"ピングを使用できます。\n" +"POSIX では :data:`os.environb` と同様に、バイト列からバイト列へのマッピングも" +"使用できます。" #: ../../library/subprocess.rst:95 msgid "Examples::" msgstr "例::" -#: ../../library/subprocess.rst:97 msgid "" ">>> subprocess.run([\"ls\", \"-l\"]) # doesn't capture output\n" "CompletedProcess(args=['ls', '-l'], returncode=0)\n" @@ -210,10 +229,21 @@ msgid "" "CompletedProcess(args=['ls', '-l', '/dev/null'], returncode=0,\n" "stdout=b'crw-rw-rw- 1 root root 1, 3 Jan 23 16:23 /dev/null\\n', stderr=b'')" msgstr "" +">>> subprocess.run([\"ls\", \"-l\"]) # 出力を捕捉しない\n" +"CompletedProcess(args=['ls', '-l'], returncode=0)\n" +"\n" +">>> subprocess.run(\"exit 1\", shell=True, check=True)\n" +"Traceback (most recent call last):\n" +" ...\n" +"subprocess.CalledProcessError: Command 'exit 1' returned non-zero exit " +"status 1\n" +"\n" +">>> subprocess.run([\"ls\", \"-l\", \"/dev/null\"], capture_output=True)\n" +"CompletedProcess(args=['ls', '-l', '/dev/null'], returncode=0,\n" +"stdout=b'crw-rw-rw- 1 root root 1, 3 Jan 23 16:23 /dev/null\\n', stderr=b'')" -#: ../../library/subprocess.rst:113 msgid "Added *encoding* and *errors* parameters" -msgstr "*encoding* と *error* が引数に追加されました。" +msgstr "*encoding* と *errors* が引数に追加されました。" #: ../../library/subprocess.rst:117 msgid "" @@ -265,15 +295,15 @@ msgstr "" "負の値 ``-N`` は子プロセスがシグナル ``N`` により中止させられたことを示しま" "す (POSIX のみ)。" -#: ../../library/subprocess.rst:146 msgid "" "Captured stdout from the child process. A bytes sequence, or a string if :" "func:`run` was called with an encoding, errors, or text=True. ``None`` if " "stdout was not captured." msgstr "" -"子プロセスから補足された標準出力です。バイト列、もしくは :func:`run` でエン" -"コーディングが指定された場合、エラーの場合、text=True が指定された場合は文字" -"列です。標準出力が補足できなかったら ``None`` になります。" +"子プロセスから捕捉した標準出力です。\n" +"通常はバイト列ですが、:func:`run` に ``encoding`` または ``errors`` を指定し" +"た場合や、``text=True`` で呼び出した場合は文字列になります。\n" +"標準出力を捕捉していない場合は ``None`` です。" #: ../../library/subprocess.rst:150 msgid "" @@ -284,15 +314,15 @@ msgstr "" "ラー出力が混合されたものがこの属性に格納され、:attr:`stderr` は ``None`` にな" "ります。" -#: ../../library/subprocess.rst:156 msgid "" "Captured stderr from the child process. A bytes sequence, or a string if :" "func:`run` was called with an encoding, errors, or text=True. ``None`` if " "stderr was not captured." msgstr "" -"子プロセスから補足された標準エラー出力です。バイト列、もしくは :func:`run` で" -"エンコーディングが指定された場合、エラーの場合、text=True が指定された場合は" -"文字列です。標準エラー出力が補足できなかったら ``None`` になります。" +"子プロセスから捕捉した標準エラー出力です。\n" +"通常はバイト列ですが、:func:`run` に ``encoding`` または ``errors`` を指定し" +"た場合や、``text=True`` で呼び出した場合は文字列になります。\n" +"標準エラー出力を捕捉していない場合は ``None`` です。" #: ../../library/subprocess.rst:162 msgid "If :attr:`returncode` is non-zero, raise a :exc:`CalledProcessError`." @@ -347,7 +377,6 @@ msgstr "子プロセスの生成に使用されるコマンド本文。" msgid "Timeout in seconds." msgstr "タイムアウト秒数。" -#: ../../library/subprocess.rst:211 msgid "" "Output of the child process if it was captured by :func:`run` or :func:" "`check_output`. Otherwise, ``None``. This is always :class:`bytes` when " @@ -357,23 +386,23 @@ msgstr "" ":func:`run` にまたは :func:`check_output` によって捕捉された場合は、子プロセ" "スの出力となり、それ以外の場合は ``None`` となります。``text=True`` の設定に" "関係なく、出力が捕捉された場合は常に :class:`bytes` となります。出力がない場" -"合は ``b''`` の代わりに``None`` のままになることがあります。" +"合は ``b''`` の代わりに ``None`` のままになることがあります。" #: ../../library/subprocess.rst:219 ../../library/subprocess.rst:256 msgid "Alias for output, for symmetry with :attr:`stderr`." msgstr "output の別名。:attr:`stderr` と対になります。" -#: ../../library/subprocess.rst:223 msgid "" "Stderr output of the child process if it was captured by :func:`run`. " "Otherwise, ``None``. This is always :class:`bytes` when stderr output was " "captured regardless of the ``text=True`` setting. It may remain ``None`` " "instead of ``b''`` when no stderr output was observed." msgstr "" -":func:`run` によって捕捉された場合、子プロセスの標準エラー出力が表示され、そ" -"れ以外の場合は ``None`` となります。``text=True`` の設定に関係なく、標準エ" -"ラー出力を捕捉した場合は常に :class:`bytes` となります。標準エラー出力がない" -"場合は、``b''`` の代わりに ``None`` のままになることがあります。" +":func:`run` が捕捉した子プロセスの標準エラー出力です。\n" +"捕捉していなければ ``None`` です。\n" +"標準エラー出力を捕捉した場合、``text=True`` の設定にかかわらず常に :class:" +"`bytes` です。\n" +"出力がなければ ``b''`` の代わりに ``None`` のままになることがあります。" #: ../../library/subprocess.rst:230 ../../library/subprocess.rst:263 msgid "*stdout* and *stderr* attributes added" @@ -459,13 +488,17 @@ msgid "" "captured into the same file handle as for *stdout*." msgstr "" -#: ../../library/subprocess.rst:299 msgid "" "If *encoding* or *errors* are specified, or *text* (also known as " "*universal_newlines*) is true, the file objects *stdin*, *stdout* and " "*stderr* will be opened in text mode using the *encoding* and *errors* " "specified in the call or the defaults for :class:`io.TextIOWrapper`." msgstr "" +"*encoding* または *errors* を指定するか、*text* (*universal_newlines* とも呼" +"びます) が真なら、ファイルオブジェクト *stdin*、*stdout*、*stderr* をテキスト" +"モードで開きます。\n" +"呼び出し時に指定した *encoding* と *errors*、または :class:`io." +"TextIOWrapper` のデフォルト値を使います。" #: ../../library/subprocess.rst:305 msgid "" @@ -481,30 +514,31 @@ msgstr "" "のドキュメントでコンストラクターの引数 *newline* が ``None`` である場合を参照" "してください。" -#: ../../library/subprocess.rst:311 msgid "" "If text mode is not used, *stdin*, *stdout* and *stderr* will be opened as " "binary streams. No encoding or line ending conversion is performed." msgstr "" +"テキストモードを使わなければ、*stdin*、*stdout*、*stderr* はバイナリストリー" +"ムとして開かれます。\n" +"エンコーディングや行末の変換は行いません。" #: ../../library/subprocess.rst:314 ../../library/subprocess.rst:1503 #: ../../library/subprocess.rst:1521 msgid "Added the *encoding* and *errors* parameters." -msgstr "" +msgstr "*encoding* と *errors* が引数に追加されました。" #: ../../library/subprocess.rst:317 msgid "Added the *text* parameter as an alias for *universal_newlines*." msgstr "*universal_newlines* の別名として、*text* 引数が追加されました。" -#: ../../library/subprocess.rst:322 msgid "" "The newlines attribute of the file objects :attr:`Popen.stdin`, :attr:`Popen." "stdout` and :attr:`Popen.stderr` are not updated by the :meth:`Popen." "communicate` method." msgstr "" -"ファイルオブジェクト :attr:`Popen.stdin`、:attr:`Popen.stdout` ならびに :" -"attr:`Popen.stderr` の改行属性は :meth:`Popen.communicate` メソッドで更新され" -"ません。" +"ファイルオブジェクト :attr:`Popen.stdin`、:attr:`Popen.stdout`、:attr:`Popen." +"stderr` の ``newlines`` 属性は、:meth:`Popen.communicate` メソッドでは更新さ" +"れません。" #: ../../library/subprocess.rst:326 msgid "" @@ -566,7 +600,7 @@ msgid "" msgstr "" "このモジュールの中で、根底のプロセス生成と管理は :class:`Popen` クラスによっ" "て扱われます。簡易関数によってカバーされないあまり一般的でないケースを開発者" -"が扱えるように、:class:`Popen` クラスは多くの柔軟性を提供しています。" +"が扱えるように、 ``Popen`` クラスは多くの柔軟性を提供しています。" #: ../../library/subprocess.rst:368 msgid "" @@ -597,7 +631,6 @@ msgstr "" "いについては *shell* および *executable* 引数を参照してください。特に明記され" "ない限り、*args* をシーケンスとして渡すことが推奨されます。" -#: ../../library/subprocess.rst:383 msgid "" "For maximum reliability, use a fully qualified path for the executable. To " "search for an unqualified name on :envvar:`PATH`, use :meth:`shutil.which`. " @@ -605,8 +638,14 @@ msgid "" "launch the current Python interpreter again, and use the ``-m`` command-line " "format to launch an installed module." msgstr "" +"最も確実なのは、実行ファイルに完全なパスを指定することです。\n" +"パスの付いていない名前を :envvar:`PATH` 上で検索するには :meth:`shutil." +"which` を使ってください。\n" +"どのプラットフォームでも、現在の Python インタープリタをもう一度起動するに" +"は :data:`sys.executable` を渡すことを推奨します。\n" +"インストール済みのモジュールを起動するには、コマンドラインの ``-m`` 形式を" +"使ってください。" -#: ../../library/subprocess.rst:389 msgid "" "Resolving the path of *executable* (or the first item of *args*) is platform " "dependent. For POSIX, see :meth:`os.execvpe`, and note that when resolving " @@ -619,16 +658,25 @@ msgid "" "the ``PATH`` environment variable. Using a full path avoids all of these " "variations." msgstr "" +"*executable* (または *args* の最初の要素) のパス解決はプラットフォームに依存" +"します。\n" +"POSIX については :meth:`os.execvpe` を参照してください。\n" +"実行ファイルのパスを解決または検索するとき、*cwd* はカレント作業ディレクトリ" +"を変更し、*env* で環境変数 ``PATH`` を変更できます。\n" +"Windows については、WinAPI の ``CreateProcess`` の引数 ``lpApplicationName`` " +"と ``lpCommandLine`` のドキュメントを参照してください。\n" +"``shell=False`` で実行ファイルのパスを解決または検索するとき、パスの解決・検" +"索に使うカレント作業ディレクトリは *cwd* では変更できず、*env* で環境変数 " +"``PATH`` を変更することもできません。\n" +"完全なパスを使うと、こうした違いをすべて避けられます。" -#: ../../library/subprocess.rst:400 msgid "" "An example of passing some arguments to an external program as a sequence " "is::" -msgstr "" +msgstr "外部プログラムへの引数をシーケンスで渡す例です。 ::" -#: ../../library/subprocess.rst:403 msgid "Popen([\"/usr/bin/git\", \"commit\", \"-m\", \"Fixes a bug.\"])" -msgstr "" +msgstr "Popen([\"/usr/bin/git\", \"commit\", \"-m\", \"Fixes a bug.\"])" #: ../../library/subprocess.rst:405 msgid "" @@ -640,14 +688,15 @@ msgstr "" "たはパスとして解釈されます。しかし、これはプログラムに引数を渡さない場合にの" "み可能です。" -#: ../../library/subprocess.rst:411 msgid "" "It may not be obvious how to break a shell command into a sequence of " "arguments, especially in complex cases. :meth:`shlex.split` can illustrate " "how to determine the correct tokenization for *args*::" msgstr "" +"特に複雑な場合、シェルコマンドを引数のシーケンスにどう分けるかは明らかでない" +"かもしれません。\n" +":meth:`shlex.split` を使うと、*args* を適切に分割する方法を確認できます。 ::" -#: ../../library/subprocess.rst:415 msgid "" ">>> import shlex, subprocess\n" ">>> command_line = input()\n" @@ -659,6 +708,15 @@ msgid "" "\"echo '$MONEY'\"]\n" ">>> p = subprocess.Popen(args) # Success!" msgstr "" +">>> import shlex, subprocess\n" +">>> command_line = input()\n" +"/bin/vikings -input eggs.txt -output \"spam spam.txt\" -cmd \"echo " +"'$MONEY'\"\n" +">>> args = shlex.split(command_line)\n" +">>> print(args)\n" +"['/bin/vikings', '-input', 'eggs.txt', '-output', 'spam spam.txt', '-cmd', " +"\"echo '$MONEY'\"]\n" +">>> p = subprocess.Popen(args) # 成功!" #: ../../library/subprocess.rst:423 msgid "" @@ -683,17 +741,21 @@ msgstr "" "に記述された方法で文字列に変換されます。これは根底の ``CreateProcess()`` が文" "字列上で動作するからです。" -#: ../../library/subprocess.rst:433 msgid "" "*args* parameter accepts a :term:`path-like object` if *shell* is ``False`` " "and a sequence containing path-like objects on POSIX." msgstr "" +"POSIX では、*shell* が ``False`` の場合に *args* 引数が :term:`path-like " +"object`、およびパス類似オブジェクトを含むシーケンスを受け付けるようになりまし" +"た。" -#: ../../library/subprocess.rst:437 msgid "" "*args* parameter accepts a :term:`path-like object` if *shell* is ``False`` " "and a sequence containing bytes and path-like objects on Windows." msgstr "" +"Windows では、*shell* が ``False`` の場合に *args* 引数が :term:`path-like " +"object`、およびバイト列やパス類似オブジェクトを含むシーケンスを受け付けるよう" +"になりました。" #: ../../library/subprocess.rst:442 msgid "" @@ -724,9 +786,8 @@ msgstr "" "は、最初の要素はコマンド名を表わす文字列として、残りの要素は追加の引数として" "シェルに渡されます。つまり、以下の :class:`Popen` と等価ということです::" -#: ../../library/subprocess.rst:455 msgid "Popen(['/bin/sh', '-c', args[0], args[1], ...])" -msgstr "" +msgstr "Popen(['/bin/sh', '-c', args[0], args[1], ...])" #: ../../library/subprocess.rst:457 msgid "" @@ -750,17 +811,19 @@ msgstr "" "*bufsize* は標準入力/標準出力/標準エラー出力パイプファイルオブジェクトを生成" "するときに :func:`open` 関数の対応する引数に渡されます:" -#: ../../library/subprocess.rst:471 msgid "" "``0`` means unbuffered (read and write are one system call and can return " "short)" msgstr "" +"``0`` はバッファリングなしを意味します (読み書きは 1 回のシステムコールで行わ" +"れ、要求した量より少ないデータで戻ることがあります)。" -#: ../../library/subprocess.rst:473 msgid "" "``1`` means line buffered (only usable if ``text=True`` or " "``universal_newlines=True``)" msgstr "" +"``1`` は行バッファリングを意味します (``text=True`` または " +"``universal_newlines=True`` の場合にだけ使えます)。" #: ../../library/subprocess.rst:475 msgid "any other positive value means use a buffer of approximately that size" @@ -774,7 +837,6 @@ msgstr "" "負のサイズ (デフォルト) は io.DEFAULT_BUFFER_SIZE のシステムデフォルトが使用" "されることを意味します。" -#: ../../library/subprocess.rst:480 msgid "" "*bufsize* now defaults to -1 to enable buffering by default to match the " "behavior that most code expects. In versions prior to Python 3.2.4 and " @@ -782,6 +844,14 @@ msgid "" "short reads. This was unintentional and did not match the behavior of " "Python 2 as most code expected." msgstr "" +"*bufsize* のデフォルトが -1 になりました。\n" +"これにより、多くのコードが期待する動作に合わせ、デフォルトでバッファリングが" +"有効になります。\n" +"Python 3.2.4 および 3.3.1 より前のバージョンでは、誤ってデフォルトが ``0`` に" +"なっており、バッファリングなしで要求した量より少ない読み出しが起こり得まし" +"た。\n" +"これは意図したものではなく、多くのコードが期待する Python 2 の動作とも異なっ" +"ていました。" #: ../../library/subprocess.rst:487 msgid "" @@ -811,13 +881,12 @@ msgstr "" "*executable* 引数が POSIX で :term:`path-like object` を受け付けるようになり" "ました。" -#: ../../library/subprocess.rst:500 msgid "" "*executable* parameter accepts a bytes and :term:`path-like object` on " "Windows." msgstr "" -"*executable* 引数が Windows で :term:`path-like object` を受け付けるようにな" -"りました。" +"Windows で *executable* 引数がバイト列と :term:`path-like object` を受け付け" +"るようになりました。" #: ../../library/subprocess.rst:512 msgid "" @@ -851,36 +920,48 @@ msgstr "" "るのは**安全ではありません**。exec が呼ばれる前に子プロセスがデッドロックを起" "こすことがあります。" -#: ../../library/subprocess.rst:535 msgid "" "If you need to modify the environment for the child use the *env* parameter " "rather than doing it in a *preexec_fn*. The *start_new_session* and " "*process_group* parameters should take the place of code using *preexec_fn* " "to call :func:`os.setsid` or :func:`os.setpgid` in the child." msgstr "" +"子プロセスの環境を変更する場合は、*preexec_fn* 内で行う代わりに *env* 引数を" +"使ってください。\n" +"*preexec_fn* を使って子プロセスで :func:`os.setsid` や :func:`os.setpgid` を" +"呼び出すコードは、*start_new_session* や *process_group* 引数で置き換えてくだ" +"さい。" -#: ../../library/subprocess.rst:542 msgid "" "The *preexec_fn* parameter is no longer supported in subinterpreters. The " "use of the parameter in a subinterpreter raises :exc:`RuntimeError`. The new " "restriction may affect applications that are deployed in mod_wsgi, uWSGI, " "and other embedded environments." msgstr "" +"サブインタープリタでは *preexec_fn* 引数を使えなくなりました。\n" +"サブインタープリタでこの引数を使うと :exc:`RuntimeError` を送出します。\n" +"この新しい制限は、mod_wsgi、uWSGI、その他の埋め込み環境に配置されたアプリケー" +"ションに影響することがあります。" -#: ../../library/subprocess.rst:547 msgid "" "If *close_fds* is true, all file descriptors except ``0``, ``1`` and ``2`` " "will be closed before the child process is executed. Otherwise when " "*close_fds* is false, file descriptors obey their inheritable flag as " "described in :ref:`fd_inheritance`." msgstr "" +"*close_fds* が真なら、子プロセスの実行前に ``0``、``1``、``2`` を除くすべての" +"ファイル記述子を閉じます。\n" +"*close_fds* が偽なら、ファイル記述子は :ref:`fd_inheritance` で説明されている" +"継承可能フラグに従います。" -#: ../../library/subprocess.rst:552 msgid "" "On Windows, if *close_fds* is true then no handles will be inherited by the " "child process unless explicitly passed in the ``handle_list`` element of :" "attr:`STARTUPINFO.lpAttributeList`, or by standard handle redirection." msgstr "" +"Windows では *close_fds* が真の場合、:attr:`STARTUPINFO.lpAttributeList` の " +"``handle_list`` 要素で明示的に渡したハンドルと、標準ハンドルのリダイレクトで" +"渡したものを除き、子プロセスはハンドルを継承しません。" #: ../../library/subprocess.rst:556 msgid "" @@ -889,12 +970,15 @@ msgid "" msgstr "" "*close_fds* のデフォルトは、:const:`False` から上記のものに変更されました。" -#: ../../library/subprocess.rst:560 msgid "" "On Windows the default for *close_fds* was changed from :const:`False` to :" "const:`True` when redirecting the standard handles. It's now possible to set " "*close_fds* to :const:`True` when redirecting the standard handles." msgstr "" +"Windows では、標準ハンドルをリダイレクトするときの *close_fds* のデフォルト" +"が :const:`False` から :const:`True` に変わりました。\n" +"標準ハンドルをリダイレクトするときも *close_fds* を :const:`True` に設定でき" +"るようになりました。" #: ../../library/subprocess.rst:565 msgid "" @@ -910,7 +994,6 @@ msgstr "" msgid "The *pass_fds* parameter was added." msgstr "*pass_fds* 引数が追加されました。" -#: ../../library/subprocess.rst:572 msgid "" "If *cwd* is not ``None``, the function changes the working directory to " "*cwd* before executing the child. *cwd* can be a string, bytes or :term:" @@ -918,6 +1001,12 @@ msgid "" "*executable* (or for the first item in *args*) relative to *cwd* if the " "executable path is a relative path." msgstr "" +"*cwd* が ``None`` でなければ、子プロセスを実行する前に作業ディレクトリを " +"*cwd* に変更します。\n" +"*cwd* には文字列、バイト列、:term:`パス類似オブジェクト ` " +"を指定できます。\n" +"POSIX では、実行ファイルのパスが相対パスなら、*executable* (または *args* の" +"最初の要素) を *cwd* からの相対パスとして検索します。" #: ../../library/subprocess.rst:578 msgid "*cwd* parameter accepts a :term:`path-like object` on POSIX." @@ -935,43 +1024,42 @@ msgid "*cwd* parameter accepts a bytes object on Windows." msgstr "" "*cwd* 引数が Windows で bytes オブジェクトを受け付けるようになりました。" -#: ../../library/subprocess.rst:587 msgid "" "If *restore_signals* is true (the default) all signals that Python has set " "to SIG_IGN are restored to SIG_DFL in the child process before the exec. " "Currently this includes the SIGPIPE, SIGXFZ and SIGXFSZ signals. (POSIX only)" msgstr "" -"*restore_signals* が真の場合 (デフォルト)、Python が SIG_IGN に設定したすべて" -"のシグナルは子プロセスが exec される前に子プロセスの SIG_DFL に格納されます。" -"現在これには SIGPIPE, SIGXFZ および SIGXFSZ シグナルが含まれています。(POSIX " -"のみ)" +"*restore_signals* が真の場合 (デフォルト)、Python が ``SIG_IGN`` に設定したす" +"べてのシグナルの処理を、子プロセスで exec を実行する前に ``SIG_DFL`` に戻しま" +"す。\n" +"現在の対象は ``SIGPIPE``、``SIGXFZ``、``SIGXFSZ`` です (POSIX のみ)。" #: ../../library/subprocess.rst:592 msgid "*restore_signals* was added." msgstr "*restore_signals* が追加されました。" -#: ../../library/subprocess.rst:595 msgid "" "If *start_new_session* is true the ``setsid()`` system call will be made in " "the child process prior to the execution of the subprocess." msgstr "" +"*start_new_session* が真なら、サブプロセスを実行する前に子プロセス内で " +"``setsid()`` システムコールを呼び出します。" #: ../../library/subprocess.rst:599 msgid "*start_new_session* was added." msgstr "*start_new_session* が追加されました。" -#: ../../library/subprocess.rst:602 msgid "" "If *process_group* is a non-negative integer, the ``setpgid(0, value)`` " "system call will be made in the child process prior to the execution of the " "subprocess." msgstr "" +"*process_group* が非負の整数なら、サブプロセスを実行する前に子プロセス内で " +"``setpgid(0, value)`` システムコールを呼び出します。" -#: ../../library/subprocess.rst:606 msgid "*process_group* was added." -msgstr "" +msgstr "*process_group* が追加されました。" -#: ../../library/subprocess.rst:609 msgid "" "If *group* is not ``None``, the setregid() system call will be made in the " "child process prior to the execution of the subprocess. If the provided " @@ -979,8 +1067,12 @@ msgid "" "value in ``gr_gid`` will be used. If the value is an integer, it will be " "passed verbatim. (POSIX only)" msgstr "" +"*group* が ``None`` でなければ、サブプロセスを実行する前に子プロセス内で " +"``setregid()`` システムコールを呼び出します。\n" +"指定した値が文字列なら :func:`grp.getgrnam` で検索し、``gr_gid`` の値を使いま" +"す。\n" +"整数ならそのまま渡します (POSIX のみ)。" -#: ../../library/subprocess.rst:618 msgid "" "If *extra_groups* is not ``None``, the setgroups() system call will be made " "in the child process prior to the execution of the subprocess. Strings " @@ -988,8 +1080,12 @@ msgid "" "the values in ``gr_gid`` will be used. Integer values will be passed " "verbatim. (POSIX only)" msgstr "" +"*extra_groups* が ``None`` でなければ、サブプロセスを実行する前に子プロセス内" +"で ``setgroups()`` システムコールを呼び出します。\n" +"*extra_groups* に含まれる文字列は :func:`grp.getgrnam` で検索し、``gr_gid`` " +"の値を使います。\n" +"整数はそのまま渡します (POSIX のみ)。" -#: ../../library/subprocess.rst:627 msgid "" "If *user* is not ``None``, the setreuid() system call will be made in the " "child process prior to the execution of the subprocess. If the provided " @@ -997,14 +1093,19 @@ msgid "" "value in ``pw_uid`` will be used. If the value is an integer, it will be " "passed verbatim. (POSIX only)" msgstr "" +"*user* が ``None`` でなければ、サブプロセスを実行する前に子プロセス内で " +"``setreuid()`` システムコールを呼び出します。\n" +"指定した値が文字列なら :func:`pwd.getpwnam` で検索し、``pw_uid`` の値を使いま" +"す。\n" +"整数ならそのまま渡します (POSIX のみ)。" -#: ../../library/subprocess.rst:636 msgid "" "If *umask* is not negative, the umask() system call will be made in the " "child process prior to the execution of the subprocess." msgstr "" +"*umask* が負でなければ、サブプロセスを実行する前に子プロセス内で ``umask()`` " +"システムコールを呼び出します。" -#: ../../library/subprocess.rst:642 msgid "" "If *env* is not ``None``, it must be a mapping that defines the environment " "variables for the new process; these are used instead of the default " @@ -1012,11 +1113,14 @@ msgid "" "str to str on any platform or bytes to bytes on POSIX platforms much like :" "data:`os.environ` or :data:`os.environb`." msgstr "" -"*env* が ``None`` 以外の場合、これは新しいプロセスでの環境変数を定義します。" -"デフォルトでは、子プロセスは現在のプロセスの環境変数を引き継ぎます。あらゆる" -"プラットフォームで :data:`os.environ` のように文字列から文字列へ、またPOSIX " -"プラットフォームにおいては :data:`os.environb` のようにバイトからバイトへも、" -"定義すること出来ます。" +"*env* が ``None`` でない場合は、新しいプロセスの環境変数を定義するマッピング" +"を指定します。\n" +"現在のプロセスの環境を継承するデフォルトの動作に代わり、このマッピングが使用" +"されます。\n" +":data:`os.environ` と同様に、どのプラットフォームでも文字列から文字列へのマッ" +"ピングを使用できます。\n" +"POSIX では :data:`os.environb` と同様に、バイト列からバイト列へのマッピングも" +"使用できます。" #: ../../library/subprocess.rst:650 msgid "" @@ -1029,7 +1133,6 @@ msgstr "" "実行するためには、*env* は正しい :envvar:`SystemRoot` を **含まなければなりま" "せん** 。" -#: ../../library/subprocess.rst:656 msgid "" "If *encoding* or *errors* are specified, or *text* is true, the file objects " "*stdin*, *stdout* and *stderr* are opened in text mode with the specified " @@ -1038,6 +1141,13 @@ msgid "" "is provided for backwards compatibility. By default, file objects are opened " "in binary mode." msgstr "" +"*encoding* または *errors* を指定するか *text* が真なら、前述の :ref:" +"`frequently-used-arguments` のとおり、ファイルオブジェクト *stdin*、" +"*stdout*、*stderr* は指定した *encoding* と *errors* を使うテキストモードで開" +"かれます。\n" +"*universal_newlines* 引数は *text* と同じ意味で、後方互換性のために用意されて" +"います。\n" +"デフォルトでは、ファイルオブジェクトはバイナリモードで開かれます。" #: ../../library/subprocess.rst:662 msgid "*encoding* and *errors* were added." @@ -1048,15 +1158,15 @@ msgid "*text* was added as a more readable alias for *universal_newlines*." msgstr "" "*text* が、*universal_newlines* のより読みやすい別名として追加されました。" -#: ../../library/subprocess.rst:668 msgid "" "If given, *startupinfo* will be a :class:`STARTUPINFO` object, which is " "passed to the underlying ``CreateProcess`` function." msgstr "" +"*startupinfo* を指定する場合は :class:`STARTUPINFO` オブジェクトにします。\n" +"内部の ``CreateProcess`` 関数に渡されます。" -#: ../../library/subprocess.rst:671 msgid "If given, *creationflags*, can be one or more of the following flags:" -msgstr "" +msgstr "*creationflags* には、次のフラグを 1 つ以上指定できます:" #: ../../library/subprocess.rst:673 msgid ":data:`CREATE_NEW_CONSOLE`" @@ -1106,17 +1216,20 @@ msgstr ":data:`CREATE_DEFAULT_ERROR_MODE`" msgid ":data:`CREATE_BREAKAWAY_FROM_JOB`" msgstr ":data:`CREATE_BREAKAWAY_FROM_JOB`" -#: ../../library/subprocess.rst:686 msgid "" "*pipesize* can be used to change the size of the pipe when :data:`PIPE` is " "used for *stdin*, *stdout* or *stderr*. The size of the pipe is only changed " "on platforms that support this (only Linux at this time of writing). Other " "platforms will ignore this parameter." msgstr "" +"*stdin*、*stdout*、*stderr* に :data:`PIPE` を使う場合、*pipesize* でパイプの" +"サイズを変更できます。\n" +"サイズが変更されるのは、この機能に対応するプラットフォームだけです (執筆時点" +"では Linux のみ)。\n" +"ほかのプラットフォームでは、この引数は無視されます。" -#: ../../library/subprocess.rst:691 msgid "Added the *pipesize* parameter." -msgstr "" +msgstr "*pipesize* 引数が追加されました。" #: ../../library/subprocess.rst:694 msgid "" @@ -1128,31 +1241,36 @@ msgstr "" "サポートされます: 終了時には標準ファイル記述子が閉じられ、プロセスを待機しま" "す::" -#: ../../library/subprocess.rst:698 msgid "" "with Popen([\"ifconfig\"], stdout=PIPE) as proc:\n" " log.write(proc.stdout.read())" msgstr "" +"with Popen([\"ifconfig\"], stdout=PIPE) as proc:\n" +" log.write(proc.stdout.read())" -#: ../../library/subprocess.rst:701 ../../library/subprocess.rst:703 msgid "" "Popen and the other functions in this module that use it raise an :ref:" "`auditing event ` ``subprocess.Popen`` with arguments " "``executable``, ``args``, ``cwd``, and ``env``. The value for ``args`` may " "be a single string or a list of strings, depending on platform." msgstr "" +"``Popen`` と、それを使うこのモジュールのほかの関数は、引数 ``executable``、" +"``args``、``cwd``、``env`` を持つ :ref:`監査イベント ` " +"``subprocess.Popen`` を発生させます。\n" +"プラットフォームによって、``args`` の値は単一の文字列または文字列のリストにな" +"ります。" #: ../../library/subprocess.rst:708 msgid "Added context manager support." msgstr "コンテキストマネージャーサポートが追加されました。" -#: ../../library/subprocess.rst:711 msgid "" "Popen destructor now emits a :exc:`ResourceWarning` warning if the child " "process is still running." msgstr "" +"子プロセスがまだ実行中の場合、``Popen`` のデストラクタが :exc:" +"`ResourceWarning` 警告を出すようになりました。" -#: ../../library/subprocess.rst:715 msgid "" "Popen can use :func:`os.posix_spawn` in some cases for better performance. " "On Windows Subsystem for Linux and QEMU User Emulation, Popen constructor " @@ -1160,16 +1278,24 @@ msgid "" "missing program, but the child process fails with a non-zero :attr:`~Popen." "returncode`." msgstr "" +"``Popen`` は、性能を向上させるため、一部の場合に :func:`os.posix_spawn` を使" +"えるようになりました。\n" +"Windows Subsystem for Linux と QEMU User Emulation では、:func:`os." +"posix_spawn` を使う ``Popen`` コンストラクタは、プログラムが見つからないなど" +"のエラーでも例外を送出しなくなりました。\n" +"代わりに、子プロセスが失敗し、:attr:`~Popen.returncode` がゼロ以外の値になり" +"ます。" #: ../../library/subprocess.rst:724 msgid "Exceptions" msgstr "例外" -#: ../../library/subprocess.rst:726 msgid "" "Exceptions raised in the child process, before the new program has started " "to execute, will be re-raised in the parent." msgstr "" +"子プロセスで新しいプログラムの実行開始前に送出された例外は、親プロセスで再送" +"出されます。" #: ../../library/subprocess.rst:729 msgid "" @@ -1197,12 +1323,14 @@ msgstr "" "呼び出されたプロセスが非ゼロのリターンコードを返した場合 :func:`check_call` " "や :func:`check_output` は :exc:`CalledProcessError` を送出します。" -#: ../../library/subprocess.rst:743 msgid "" "All of the functions and methods that accept a *timeout* parameter, such as :" "func:`run` and :meth:`Popen.communicate` will raise :exc:`TimeoutExpired` if " "the timeout expires before the process exits." msgstr "" +":func:`run` や :meth:`Popen.communicate` など、*timeout* 引数を受け取るすべて" +"の関数とメソッドは、プロセスが終了する前にタイムアウトすると :exc:" +"`TimeoutExpired` を送出します。" #: ../../library/subprocess.rst:747 msgid "" @@ -1219,7 +1347,6 @@ msgstr ":exc:`SubprocessError` 基底クラスが追加されました。" msgid "Security Considerations" msgstr "セキュリティで考慮すべき点" -#: ../../library/subprocess.rst:757 msgid "" "Unlike some other popen functions, this library will not implicitly choose " "to call a system shell. This means that all characters, including shell " @@ -1231,8 +1358,17 @@ msgid "" "`, it is possible to use :func:`shlex.quote` for this " "escaping." msgstr "" +"ほかの一部の popen 関数と異なり、このライブラリは暗黙的にシステムのシェルを呼" +"び出しません。\n" +"そのため、シェルのメタ文字を含め、すべての文字を安全に子プロセスへ渡せま" +"す。\n" +"``shell=True`` で明示的にシェルを呼び出す場合は、`シェルインジェクション " +"`_ の脆弱性を" +"避けるため、アプリケーション側ですべての空白やメタ文字を適切にクォートする必" +"要があります。\n" +":ref:`一部のプラットフォーム ` では、このエスケープに :" +"func:`shlex.quote` を使えます。" -#: ../../library/subprocess.rst:767 msgid "" "On Windows, batch files (:file:`*.bat` or :file:`*.cmd`) may be launched by " "the operating system in a system shell regardless of the arguments passed to " @@ -1242,6 +1378,15 @@ msgid "" "passing ``shell=True`` to allow Python to escape special characters. See :gh:" "`114539` for additional discussion." msgstr "" +"Windows では、このライブラリに渡す引数にかかわらず、バッチファイル (:file:`*." +"bat` または :file:`*.cmd`) が OS によってシステムのシェル内で起動されることが" +"あります。\n" +"その場合、Python によるエスケープが追加されないまま、シェルの規則に従って引数" +"が解析される可能性があります。\n" +"信頼できない情報源からの引数を使って意図的にバッチファイルを起動する場合、" +"Python に特殊文字をエスケープさせるため、``shell=True`` を渡すことを検討して" +"ください。\n" +"詳しい議論は :gh:`114539` を参照してください。" #: ../../library/subprocess.rst:777 msgid "Popen Objects" @@ -1277,17 +1422,17 @@ msgstr "" "プロセスが *timeout* 秒後に終了してない場合、:exc:`TimeoutExpired` 例外を送出" "します。この例外を捕捉して wait を再試行するのは安全です。" -#: ../../library/subprocess.rst:799 msgid "" "This will deadlock when using ``stdout=PIPE`` or ``stderr=PIPE`` and the " "child process generates enough output to a pipe such that it blocks waiting " "for the OS pipe buffer to accept more data. Use :meth:`Popen.communicate` " "when using pipes to avoid that." msgstr "" -"``stdout=PIPE`` や ``stderr=PIPE`` を使っていて、より多くのデータを受け入れる" -"ために OS のパイプバッファーをブロックしているパイプに子プロセスが十分な出力" -"を生成した場合、デッドロックが発生します。これを避けるには :meth:`Popen." -"communicate` を使用してください。" +"``stdout=PIPE`` または ``stderr=PIPE`` を使っていると、子プロセスがパイプに大" +"量の出力を生成し、OS のパイプバッファがデータを受け入れられるようになるまで待" +"つ状態でブロックして、デッドロックすることがあります。\n" +"パイプを使う場合は、この問題を避けるため :meth:`Popen.communicate` を使ってく" +"ださい。" #: ../../library/subprocess.rst:806 msgid "" @@ -1303,7 +1448,6 @@ msgstr "" msgid "*timeout* was added." msgstr "*timeout* が追加されました" -#: ../../library/subprocess.rst:816 msgid "" "Interact with process: Send data to stdin. Read data from stdout and " "stderr, until end-of-file is reached. Wait for process to terminate and set " @@ -1312,12 +1456,22 @@ msgid "" "should be sent to the child. If streams were opened in text mode, *input* " "must be a string. Otherwise, it must be bytes." msgstr "" +"プロセスと通信します。\n" +"標準入力にデータを送り、標準出力と標準エラー出力を EOF まで読み取ります。\n" +"プロセスの終了を待ち、:attr:`~Popen.returncode` 属性を設定します。\n" +"省略可能な *input* 引数には子プロセスに送るデータを指定し、送るデータがなけれ" +"ば ``None`` にします。\n" +"ストリームをテキストモードで開いた場合、*input* は文字列でなければなりませ" +"ん。\n" +"それ以外の場合はバイト列でなければなりません。" -#: ../../library/subprocess.rst:823 msgid "" ":meth:`communicate` returns a tuple ``(stdout_data, stderr_data)``. The data " "will be strings if streams were opened in text mode; otherwise, bytes." msgstr "" +":meth:`communicate` はタプル ``(stdout_data, stderr_data)`` を返します。\n" +"ストリームをテキストモードで開いた場合、データは文字列です。\n" +"それ以外の場合はバイト列です。" #: ../../library/subprocess.rst:827 msgid "" @@ -1350,7 +1504,6 @@ msgstr "" "リーンアップを行うために、正常に動作するアプリケーションは子プロセスを kill " "して通信を終了すべきです::" -#: ../../library/subprocess.rst:840 msgid "" "proc = subprocess.Popen(...)\n" "try:\n" @@ -1359,6 +1512,12 @@ msgid "" " proc.kill()\n" " outs, errs = proc.communicate()" msgstr "" +"proc = subprocess.Popen(...)\n" +"try:\n" +" outs, errs = proc.communicate(timeout=15)\n" +"except TimeoutExpired:\n" +" proc.kill()\n" +" outs, errs = proc.communicate()" #: ../../library/subprocess.rst:849 msgid "" @@ -1372,9 +1531,8 @@ msgstr "" msgid "Sends the signal *signal* to the child." msgstr "*signal* シグナルを子プロセスに送ります。" -#: ../../library/subprocess.rst:860 msgid "Do nothing if the process completed." -msgstr "" +msgstr "プロセスが終了していれば何もしません。" #: ../../library/subprocess.rst:864 msgid "" @@ -1386,12 +1544,15 @@ msgstr "" "CTRL_BREAK_EVENT を、``CREATE_NEW_PROCESS_GROUP`` を含む *creationflags* で始" "まった、プロセスに送れます。" -#: ../../library/subprocess.rst:871 msgid "" "Stop the child. On POSIX OSs the method sends :py:const:`~signal.SIGTERM` to " "the child. On Windows the Win32 API function :c:func:`!TerminateProcess` is " "called to stop the child." msgstr "" +"子プロセスを終了させます。\n" +"POSIX OS では、子プロセスに :py:const:`~signal.SIGTERM` を送ります。\n" +"Windows では Win32 API の :c:func:`!TerminateProcess` 関数を呼び出して子プロ" +"セスを終了させます。" #: ../../library/subprocess.rst:878 msgid "" @@ -1401,11 +1562,12 @@ msgstr "" "子プロセスを kill します。POSIX OS では SIGKILL シグナルを子プロセスに送りま" "す。Windows では、:meth:`kill` は :meth:`terminate` の別名です。" -#: ../../library/subprocess.rst:882 msgid "" "The following attributes are also set by the class for you to access. " "Reassigning them to new values is unsupported:" msgstr "" +"このクラスは、利用者が参照できるように次の属性も設定します。\n" +"これらの属性に新しい値を代入することはサポートされていません:" #: ../../library/subprocess.rst:887 msgid "" @@ -1415,7 +1577,6 @@ msgstr "" ":class:`Popen` に渡された引数 *args* です -- プログラム引数のシーケンスまた" "は 1 個の文字列になります。" -#: ../../library/subprocess.rst:894 msgid "" "If the *stdin* argument was :data:`PIPE`, this attribute is a writeable " "stream object as returned by :func:`open`. If the *encoding* or *errors* " @@ -1423,8 +1584,13 @@ msgid "" "``True``, the stream is a text stream, otherwise it is a byte stream. If the " "*stdin* argument was not :data:`PIPE`, this attribute is ``None``." msgstr "" +"*stdin* 引数が :data:`PIPE` なら、この属性は :func:`open` が返すような書き込" +"み可能なストリームオブジェクトです。\n" +"*encoding* または *errors* 引数を指定するか、*text* または " +"*universal_newlines* 引数が ``True`` ならテキストストリームになり、それ以外で" +"はバイトストリームになります。\n" +"*stdin* 引数が :data:`PIPE` でなければ、この属性は ``None`` です。" -#: ../../library/subprocess.rst:903 msgid "" "If the *stdout* argument was :data:`PIPE`, this attribute is a readable " "stream object as returned by :func:`open`. Reading from the stream provides " @@ -1433,8 +1599,14 @@ msgid "" "stream is a text stream, otherwise it is a byte stream. If the *stdout* " "argument was not :data:`PIPE`, this attribute is ``None``." msgstr "" +"*stdout* 引数が :data:`PIPE` なら、この属性は :func:`open` が返すような読み取" +"り可能なストリームオブジェクトです。\n" +"このストリームから子プロセスの出力を読み取れます。\n" +"*encoding* または *errors* 引数を指定するか、*text* または " +"*universal_newlines* 引数が ``True`` ならテキストストリームになり、それ以外で" +"はバイトストリームになります。\n" +"*stdout* 引数が :data:`PIPE` でなければ、この属性は ``None`` です。" -#: ../../library/subprocess.rst:913 msgid "" "If the *stderr* argument was :data:`PIPE`, this attribute is a readable " "stream object as returned by :func:`open`. Reading from the stream provides " @@ -1443,6 +1615,13 @@ msgid "" "the stream is a text stream, otherwise it is a byte stream. If the *stderr* " "argument was not :data:`PIPE`, this attribute is ``None``." msgstr "" +"*stderr* 引数が :data:`PIPE` なら、この属性は :func:`open` が返すような読み取" +"り可能なストリームオブジェクトです。\n" +"このストリームから子プロセスのエラー出力を読み取れます。\n" +"*encoding* または *errors* 引数を指定するか、*text* または " +"*universal_newlines* 引数が ``True`` ならテキストストリームになり、それ以外で" +"はバイトストリームになります。\n" +"*stderr* 引数が :data:`PIPE` でなければ、この属性は ``None`` です。" #: ../../library/subprocess.rst:922 msgid "" @@ -1468,18 +1647,22 @@ msgstr "" "*shell* 引数を ``True`` に設定した場合は、生成されたシェルのプロセス ID にな" "ります。" -#: ../../library/subprocess.rst:938 msgid "" "The child return code. Initially ``None``, :attr:`returncode` is set by a " "call to the :meth:`poll`, :meth:`wait`, or :meth:`communicate` methods if " "they detect that the process has terminated." msgstr "" +"子プロセスの終了コードです。\n" +"初期値は ``None`` です。\n" +":meth:`poll`、:meth:`wait`、:meth:`communicate` の呼び出しでプロセスの終了を" +"検出すると、:attr:`returncode` が設定されます。" -#: ../../library/subprocess.rst:942 msgid "" "A ``None`` value indicates that the process hadn't yet terminated at the " "time of the last method call." msgstr "" +"値が ``None`` なら、直前のメソッド呼び出しの時点ではプロセスがまだ終了してい" +"なかったことを示します。" #: ../../library/subprocess.rst:950 msgid "Windows Popen Helpers" @@ -1492,13 +1675,16 @@ msgid "" msgstr "" ":class:`STARTUPINFO` クラスと以下の定数は、Windows のみで利用できます。" -#: ../../library/subprocess.rst:958 msgid "" "Partial support of the Windows `STARTUPINFO `__ structure is used for :class:`Popen` " "creation. The following attributes can be set by passing them as keyword-" "only arguments." msgstr "" +"Windows の `STARTUPINFO `__ 構造体を部分的にサポートし、:class:`Popen` の作成" +"に使います。\n" +"次の属性は、キーワード専用引数として渡すことで設定できます。" #: ../../library/subprocess.rst:963 msgid "Keyword-only argument support was added." @@ -1512,44 +1698,45 @@ msgstr "" "特定の :class:`STARTUPINFO` の属性が、プロセスがウィンドウを生成するときに使" "われるかを決定するビットフィールドです::" -#: ../../library/subprocess.rst:971 msgid "" "si = subprocess.STARTUPINFO()\n" "si.dwFlags = subprocess.STARTF_USESTDHANDLES | subprocess." "STARTF_USESHOWWINDOW" msgstr "" +"si = subprocess.STARTUPINFO()\n" +"si.dwFlags = subprocess.STARTF_USESTDHANDLES | subprocess." +"STARTF_USESHOWWINDOW" -#: ../../library/subprocess.rst:976 msgid "" "If :attr:`dwFlags` specifies :data:`STARTF_USESTDHANDLES`, this attribute is " "the standard input handle for the process. If :data:`STARTF_USESTDHANDLES` " "is not specified, the default for standard input is the keyboard buffer." msgstr "" ":attr:`dwFlags` が :data:`STARTF_USESTDHANDLES` を指定すれば、この属性がプロ" -"セスの標準入力処理です。:data:`STARTF_USESTDHANDLES` が指定されなければ、標準" -"入力のデフォルトはキーボードバッファーです。" +"セスの標準入力ハンドルです。\n" +":data:`STARTF_USESTDHANDLES` が指定されなければ、標準入力のデフォルトはキー" +"ボードバッファーです。" -#: ../../library/subprocess.rst:983 msgid "" "If :attr:`dwFlags` specifies :data:`STARTF_USESTDHANDLES`, this attribute is " "the standard output handle for the process. Otherwise, this attribute is " "ignored and the default for standard output is the console window's buffer." msgstr "" ":attr:`dwFlags` が :data:`STARTF_USESTDHANDLES` を指定すれば、この属性がプロ" -"セスの標準出力処理です。そうでなければ、この属性は無視され、標準出力のデフォ" -"ルトはコンソールウィンドウのバッファーです。" +"セスの標準出力ハンドルです。\n" +"そうでなければ、この属性は無視され、標準出力のデフォルトはコンソールウィンド" +"ウのバッファーです。" -#: ../../library/subprocess.rst:990 msgid "" "If :attr:`dwFlags` specifies :data:`STARTF_USESTDHANDLES`, this attribute is " "the standard error handle for the process. Otherwise, this attribute is " "ignored and the default for standard error is the console window's buffer." msgstr "" ":attr:`dwFlags` が :data:`STARTF_USESTDHANDLES` を指定すれば、この属性がプロ" -"セスの標準エラー処理です。そうでなければ、この属性は無視され、標準エラー出力" -"のデフォルトはコンソールウィンドウのバッファーです。" +"セスの標準エラーハンドルです。\n" +"そうでなければ、この属性は無視され、標準エラー出力のデフォルトはコンソール" +"ウィンドウのバッファーです。" -#: ../../library/subprocess.rst:996 msgid "" "If :attr:`dwFlags` specifies :data:`STARTF_USESHOWWINDOW`, this attribute " "can be any of the values that can be specified in the ``nCmdShow`` parameter " @@ -1560,7 +1747,8 @@ msgstr "" ":attr:`dwFlags` が :data:`STARTF_USESHOWWINDOW` を指定すれば、この属性は " "`ShowWindow `__ 関数の ``nCmdShow`` 引数で指定された値なら、 ``SW_SHOWDEFAULT`` 以外" -"の任意のものにできます。しかし、この属性は無視されます。" +"の任意のものにできます。\n" +"それ以外の場合、この属性は無視されます。" #: ../../library/subprocess.rst:1003 msgid "" @@ -1570,36 +1758,40 @@ msgstr "" "この属性には :data:`SW_HIDE` が提供されています。これは、:class:`Popen` が " "``shell=True`` として呼び出されたときに使われます。" -#: ../../library/subprocess.rst:1008 msgid "" "A dictionary of additional attributes for process creation as given in " "``STARTUPINFOEX``, see `UpdateProcThreadAttribute `__." msgstr "" +"``STARTUPINFOEX`` で指定する、プロセス作成用の追加属性の辞書です。\n" +"`UpdateProcThreadAttribute `__ を参照してください。" -#: ../../library/subprocess.rst:1012 msgid "Supported attributes:" -msgstr "" +msgstr "サポートする属性:" #: ../../library/subprocess.rst:1014 msgid "**handle_list**" msgstr "**handle_list**" -#: ../../library/subprocess.rst:1015 msgid "" "Sequence of handles that will be inherited. *close_fds* must be true if non-" "empty." msgstr "" +"継承するハンドルのシーケンスです。\n" +"空でなければ *close_fds* を真にする必要があります。" -#: ../../library/subprocess.rst:1018 msgid "" "The handles must be temporarily made inheritable by :func:`os." "set_handle_inheritable` when passed to the :class:`Popen` constructor, else :" "class:`OSError` will be raised with Windows error " "``ERROR_INVALID_PARAMETER`` (87)." msgstr "" +"これらのハンドルを :class:`Popen` コンストラクタに渡すときは、:func:`os." +"set_handle_inheritable` で一時的に継承可能にしておく必要があります。\n" +"そうしないと、Windows エラー ``ERROR_INVALID_PARAMETER`` (87) を伴う :class:" +"`OSError` を送出します。" -#: ../../library/subprocess.rst:1025 msgid "" "In a multithreaded process, use caution to avoid leaking handles that are " "marked inheritable when combining this feature with concurrent calls to " @@ -1607,10 +1799,14 @@ msgid "" "system`. This also applies to standard handle redirection, which " "temporarily creates inheritable handles." msgstr "" +"マルチスレッドのプロセスでは、この機能と並行して :func:`os.system` などのすべ" +"てのハンドルを継承するプロセス作成関数を呼び出すとき、継承可能にしたハンドル" +"が漏れ出さないように注意してください。\n" +"一時的に継承可能なハンドルを作成する標準ハンドルのリダイレクトでも同じ注意が" +"必要です。" -#: ../../library/subprocess.rst:1035 msgid "Windows Constants" -msgstr "" +msgstr "Windows の定数" #: ../../library/subprocess.rst:1037 msgid "The :mod:`subprocess` module exposes the following constants." @@ -1660,18 +1856,21 @@ msgid "" msgstr "" "追加情報を保持する、 :attr:`STARTUPINFO.wShowWindow` 属性を指定します。" -#: ../../library/subprocess.rst:1071 msgid "" "A :attr:`STARTUPINFO.dwFlags` parameter to specify that the *Working in " "Background* mouse cursor will be displayed while a process is launching. " "This is the default behavior for GUI processes." msgstr "" +"プロセスの起動中に「バックグラウンドで作業中」のマウスカーソルを表示するよう" +"指定する、:attr:`STARTUPINFO.dwFlags` の値です。\n" +"GUI プロセスではこれがデフォルトの動作です。" -#: ../../library/subprocess.rst:1080 msgid "" "A :attr:`STARTUPINFO.dwFlags` parameter to specify that the mouse cursor " "will not be changed when launching a process." msgstr "" +"プロセスの起動時にマウスカーソルを変更しないよう指定する、:attr:`STARTUPINFO." +"dwFlags` の値です。" #: ../../library/subprocess.rst:1087 msgid "" @@ -1696,37 +1895,41 @@ msgid "This flag is ignored if :data:`CREATE_NEW_CONSOLE` is specified." msgstr "" ":data:`CREATE_NEW_CONSOLE` が指定されていたら、このフラグは無視されます。" -#: ../../library/subprocess.rst:1100 msgid "" "A :class:`Popen` ``creationflags`` parameter to specify that a new process " "will have an above average priority." msgstr "" +"新しいプロセスの優先度を通常より高くするよう指定する、:class:`Popen` の " +"``creationflags`` 引数の値です。" -#: ../../library/subprocess.rst:1107 msgid "" "A :class:`Popen` ``creationflags`` parameter to specify that a new process " "will have a below average priority." msgstr "" +"新しいプロセスの優先度を通常より低くするよう指定する、:class:`Popen` の " +"``creationflags`` 引数の値です。" -#: ../../library/subprocess.rst:1114 msgid "" "A :class:`Popen` ``creationflags`` parameter to specify that a new process " "will have a high priority." msgstr "" +"新しいプロセスの優先度を高くするよう指定する、:class:`Popen` の " +"``creationflags`` 引数の値です。" -#: ../../library/subprocess.rst:1121 msgid "" "A :class:`Popen` ``creationflags`` parameter to specify that a new process " "will have an idle (lowest) priority." msgstr "" +"新しいプロセスの優先度をアイドル (最低) にするよう指定する、:class:`Popen` " +"の ``creationflags`` 引数の値です。" -#: ../../library/subprocess.rst:1128 msgid "" "A :class:`Popen` ``creationflags`` parameter to specify that a new process " "will have a normal priority. (default)" msgstr "" +"新しいプロセスの優先度を通常にするよう指定する、:class:`Popen` の " +"``creationflags`` 引数の値です (デフォルト)。" -#: ../../library/subprocess.rst:1135 msgid "" "A :class:`Popen` ``creationflags`` parameter to specify that a new process " "will have realtime priority. You should almost never use " @@ -1735,33 +1938,48 @@ msgid "" "appropriate for applications that \"talk\" directly to hardware or that " "perform brief tasks that should have limited interruptions." msgstr "" +"新しいプロセスの優先度をリアルタイムにするよう指定する、:class:`Popen` の " +"``creationflags`` 引数の値です。\n" +"マウス入力、キーボード入力、バックグラウンドでのディスクのフラッシュを管理す" +"るシステムスレッドの処理を妨げるため、``REALTIME_PRIORITY_CLASS`` は原則とし" +"て使わないでください。\n" +"ハードウェアと直接やり取りするアプリケーションや、割り込みを制限する必要があ" +"る短い処理を行うアプリケーションでは、このクラスが適切なこともあります。" -#: ../../library/subprocess.rst:1146 msgid "" "A :class:`Popen` ``creationflags`` parameter to specify that a new process " "will not create a window." msgstr "" +"新しいプロセスがウィンドウを作成しないよう指定する、:class:`Popen` の " +"``creationflags`` 引数の値です。" -#: ../../library/subprocess.rst:1153 msgid "" "A :class:`Popen` ``creationflags`` parameter to specify that a new process " "will not inherit its parent's console. This value cannot be used with " "CREATE_NEW_CONSOLE." msgstr "" +"新しいプロセスが親プロセスのコンソールを継承しないよう指定する、:class:" +"`Popen` の ``creationflags`` 引数の値です。\n" +"``CREATE_NEW_CONSOLE`` と併用することはできません。" -#: ../../library/subprocess.rst:1161 msgid "" "A :class:`Popen` ``creationflags`` parameter to specify that a new process " "does not inherit the error mode of the calling process. Instead, the new " "process gets the default error mode. This feature is particularly useful for " "multithreaded shell applications that run with hard errors disabled." msgstr "" +"新しいプロセスが呼び出し元プロセスのエラーモードを継承しないよう指定する、:" +"class:`Popen` の ``creationflags`` 引数の値です。\n" +"新しいプロセスには代わりにデフォルトのエラーモードを設定します。\n" +"ハードエラーを無効にして実行するマルチスレッドのシェルアプリケーションで特に" +"便利です。" -#: ../../library/subprocess.rst:1171 msgid "" "A :class:`Popen` ``creationflags`` parameter to specify that a new process " "is not associated with the job." msgstr "" +"新しいプロセスをジョブに関連付けないよう指定する、:class:`Popen` の " +"``creationflags`` 引数の値です。" #: ../../library/subprocess.rst:1179 msgid "Older high-level API" @@ -1785,18 +2003,18 @@ msgstr "" "*args* で指定されたコマンドを実行します。コマンドの終了を待ち、:attr:`~Popen." "returncode` 属性を返します。" -#: ../../library/subprocess.rst:1191 ../../library/subprocess.rst:1231 msgid "" "Code needing to capture stdout or stderr should use :func:`run` instead::" msgstr "" +"標準出力や標準エラー出力を捕捉する必要があるコードでは、代わりに :func:`run` " +"を使ってください。 ::" -#: ../../library/subprocess.rst:1193 msgid "run(...).returncode" -msgstr "" +msgstr "run(...).returncode" -#: ../../library/subprocess.rst:1195 ../../library/subprocess.rst:1235 msgid "To suppress stdout or stderr, supply a value of :data:`DEVNULL`." msgstr "" +"標準出力や標準エラー出力を抑制するには、:data:`DEVNULL` を指定してください。" #: ../../library/subprocess.rst:1197 ../../library/subprocess.rst:1237 msgid "" @@ -1820,7 +2038,6 @@ msgstr "" "生成した場合、パイプからは読み込まれないので、子プロセスがブロックされること" "があります。" -#: ../../library/subprocess.rst:1224 msgid "" "Run command with arguments. Wait for command to complete. If the return " "code was zero then return, otherwise raise :exc:`CalledProcessError`. The :" @@ -1828,10 +2045,16 @@ msgid "" "`~CalledProcessError.returncode` attribute. If :func:`check_call` was unable " "to start the process it will propagate the exception that was raised." msgstr "" +"引数を指定してコマンドを実行し、完了を待ちます。\n" +"終了コードがゼロなら戻り、それ以外なら :exc:`CalledProcessError` を送出しま" +"す。\n" +":exc:`CalledProcessError` オブジェクトの :attr:`~CalledProcessError." +"returncode` 属性には終了コードが入ります。\n" +":func:`check_call` がプロセスを起動できなかった場合は、発生した例外をそのまま" +"伝播させます。" -#: ../../library/subprocess.rst:1233 msgid "run(..., check=True)" -msgstr "" +msgstr "run(..., check=True)" #: ../../library/subprocess.rst:1266 msgid "Run command with arguments and return its output." @@ -1853,11 +2076,9 @@ msgstr "" msgid "This is equivalent to::" msgstr "これは次と等価です::" -#: ../../library/subprocess.rst:1275 msgid "run(..., check=True, stdout=PIPE).stdout" -msgstr "" +msgstr "run(..., check=True, stdout=PIPE).stdout" -#: ../../library/subprocess.rst:1277 msgid "" "The arguments shown above are merely some common ones. The full function " "signature is largely the same as that of :func:`run` - most arguments are " @@ -1866,6 +2087,12 @@ msgid "" "``input=b''`` (or ``input=''``, depending on other arguments) rather than " "using the parent's standard input file handle." msgstr "" +"上に示したのは、よく使われる引数の一部だけです。\n" +"完全な関数シグネチャは :func:`run` とほぼ同じで、ほとんどの引数はそのまま渡さ" +"れます。\n" +":func:`run` の動作と異なる点が 1 つあります。\n" +"``input=None`` を渡すと、親プロセスの標準入力のファイルハンドルを使わず、" +"``input=b''`` (他の引数によっては ``input=''``) と同じ動作になります。" #: ../../library/subprocess.rst:1284 msgid "" @@ -1904,9 +2131,10 @@ msgstr "" msgid "Support for the *input* keyword argument was added." msgstr "キーワード引数 *input* が追加されました。" -#: ../../library/subprocess.rst:1309 msgid "*encoding* and *errors* were added. See :func:`run` for details." msgstr "" +"*encoding* と *errors* が追加されました。\n" +"詳しくは :func:`run` を参照してください。" #: ../../library/subprocess.rst:1327 msgid "Replacing Older Functions with the :mod:`subprocess` Module" @@ -1949,46 +2177,46 @@ msgstr "" "以下の例では、適切な関数が :mod:`subprocess` モジュールからすでにインポートさ" "れていることを前提としています。" -#: ../../library/subprocess.rst:1347 msgid "Replacing :program:`/bin/sh` shell command substitution" -msgstr "" +msgstr ":program:`/bin/sh` シェルのコマンド置換を置き換える" -#: ../../library/subprocess.rst:1349 msgid "output=$(mycmd myarg)" -msgstr "" +msgstr "output=$(mycmd myarg)" #: ../../library/subprocess.rst:1353 ../../library/subprocess.rst:1364 #: ../../library/subprocess.rst:1381 msgid "becomes::" msgstr "これは以下のようになります::" -#: ../../library/subprocess.rst:1355 msgid "output = check_output([\"mycmd\", \"myarg\"])" -msgstr "" +msgstr "output = check_output([\"mycmd\", \"myarg\"])" #: ../../library/subprocess.rst:1358 msgid "Replacing shell pipeline" msgstr "シェルのパイプラインを置き換える" -#: ../../library/subprocess.rst:1360 ../../library/subprocess.rst:1377 msgid "output=$(dmesg | grep hda)" -msgstr "" +msgstr "output=$(dmesg | grep hda)" -#: ../../library/subprocess.rst:1366 msgid "" "p1 = Popen([\"dmesg\"], stdout=PIPE)\n" "p2 = Popen([\"grep\", \"hda\"], stdin=p1.stdout, stdout=PIPE)\n" "p1.stdout.close() # Allow p1 to receive a SIGPIPE if p2 exits.\n" "output = p2.communicate()[0]" msgstr "" +"p1 = Popen([\"dmesg\"], stdout=PIPE)\n" +"p2 = Popen([\"grep\", \"hda\"], stdin=p1.stdout, stdout=PIPE)\n" +"p1.stdout.close() # p2 が終了したときに p1 が SIGPIPE を受け取れるようにす" +"る。\n" +"output = p2.communicate()[0]" -#: ../../library/subprocess.rst:1371 msgid "" "The ``p1.stdout.close()`` call after starting the p2 is important in order " "for p1 to receive a SIGPIPE if p2 exits before p1." msgstr "" -"p2 を開始した後の ``p1.stdout.close()`` の呼び出しは、p1 が p2 の前に存在した" -"場合に、p1 が SIGPIPE を受け取るために重要です。" +"``p2`` の開始後に ``p1.stdout.close()`` を呼び出すことが重要です。\n" +"これにより、``p2`` が ``p1`` より先に終了したとき、``p1`` が ``SIGPIPE`` を受" +"け取れるようになります。" #: ../../library/subprocess.rst:1374 msgid "" @@ -1998,20 +2226,21 @@ msgstr "" "あるいは、信頼された入力に対しては、シェル自身のパイプラインサポートを直接使" "用することもできます:" -#: ../../library/subprocess.rst:1383 msgid "output = check_output(\"dmesg | grep hda\", shell=True)" -msgstr "" +msgstr "output = check_output(\"dmesg | grep hda\", shell=True)" #: ../../library/subprocess.rst:1387 msgid "Replacing :func:`os.system`" msgstr ":func:`os.system` を置き換える" -#: ../../library/subprocess.rst:1391 msgid "" "sts = os.system(\"mycmd\" + \" myarg\")\n" "# becomes\n" "retcode = call(\"mycmd\" + \" myarg\", shell=True)" msgstr "" +"sts = os.system(\"mycmd\" + \" myarg\")\n" +"# 次のように置き換える。\n" +"retcode = call(\"mycmd\" + \" myarg\", shell=True)" #: ../../library/subprocess.rst:1395 msgid "Notes:" @@ -2021,11 +2250,12 @@ msgstr "注釈:" msgid "Calling the program through the shell is usually not required." msgstr "このプログラムは普通シェル経由で呼び出す必要はありません。" -#: ../../library/subprocess.rst:1398 msgid "" "The :func:`call` return value is encoded differently to that of :func:`os." "system`." msgstr "" +":func:`call` の戻り値と :func:`os.system` の戻り値では、終了ステータスの表し" +"方が異なります。" #: ../../library/subprocess.rst:1401 msgid "" @@ -2038,7 +2268,6 @@ msgstr "" msgid "A more realistic example would look like this::" msgstr "より現実的な例ではこうなるでしょう::" -#: ../../library/subprocess.rst:1407 msgid "" "try:\n" " retcode = call(\"mycmd\" + \" myarg\", shell=True)\n" @@ -2050,6 +2279,15 @@ msgid "" "except OSError as e:\n" " print(\"Execution failed:\", e, file=sys.stderr)" msgstr "" +"try:\n" +" retcode = call(\"mycmd\" + \" myarg\", shell=True)\n" +" if retcode < 0:\n" +" print(\"Child was terminated by signal\", -retcode, file=sys." +"stderr)\n" +" else:\n" +" print(\"Child returned\", retcode, file=sys.stderr)\n" +"except OSError as e:\n" +" print(\"Execution failed:\", e, file=sys.stderr)" #: ../../library/subprocess.rst:1418 msgid "Replacing the :func:`os.spawn ` family" @@ -2059,34 +2297,40 @@ msgstr ":func:`os.spawn ` 関数群を置き換える" msgid "P_NOWAIT example::" msgstr "P_NOWAIT の例::" -#: ../../library/subprocess.rst:1422 msgid "" "pid = os.spawnlp(os.P_NOWAIT, \"/bin/mycmd\", \"mycmd\", \"myarg\")\n" "==>\n" "pid = Popen([\"/bin/mycmd\", \"myarg\"]).pid" msgstr "" +"pid = os.spawnlp(os.P_NOWAIT, \"/bin/mycmd\", \"mycmd\", \"myarg\")\n" +"==>\n" +"pid = Popen([\"/bin/mycmd\", \"myarg\"]).pid" #: ../../library/subprocess.rst:1426 msgid "P_WAIT example::" msgstr "P_WAIT の例::" -#: ../../library/subprocess.rst:1428 msgid "" "retcode = os.spawnlp(os.P_WAIT, \"/bin/mycmd\", \"mycmd\", \"myarg\")\n" "==>\n" "retcode = call([\"/bin/mycmd\", \"myarg\"])" msgstr "" +"retcode = os.spawnlp(os.P_WAIT, \"/bin/mycmd\", \"mycmd\", \"myarg\")\n" +"==>\n" +"retcode = call([\"/bin/mycmd\", \"myarg\"])" #: ../../library/subprocess.rst:1432 msgid "Vector example::" msgstr "シーケンスを使った例::" -#: ../../library/subprocess.rst:1434 msgid "" "os.spawnvp(os.P_NOWAIT, path, args)\n" "==>\n" "Popen([path] + args[1:])" msgstr "" +"os.spawnvp(os.P_NOWAIT, path, args)\n" +"==>\n" +"Popen([path] + args[1:])" #: ../../library/subprocess.rst:1438 msgid "Environment example::" @@ -2099,9 +2343,8 @@ msgid "" "Popen([\"/bin/mycmd\", \"myarg\"], env={\"PATH\": \"/usr/bin\"})" msgstr "" -#: ../../library/subprocess.rst:1447 msgid "Replacing :func:`os.popen`" -msgstr "" +msgstr ":func:`os.popen` を置き換える" #: ../../library/subprocess.rst:1449 msgid "Return code handling translates as follows::" @@ -2150,13 +2393,14 @@ msgid "" "details." msgstr "" -#: ../../library/subprocess.rst:1481 msgid "" "A trailing newline is stripped from the output. The exit code for the " "command can be interpreted as the return code of subprocess. Example::" msgstr "" +"出力の末尾の改行は取り除かれます。\n" +"コマンドの終了コードは、subprocess の終了コードとして解釈できます。\n" +"例を示します。 ::" -#: ../../library/subprocess.rst:1485 msgid "" ">>> subprocess.getstatusoutput('ls /bin/ls')\n" "(0, '/bin/ls')\n" @@ -2167,17 +2411,27 @@ msgid "" ">>> subprocess.getstatusoutput('/bin/kill $$')\n" "(-15, '')" msgstr "" +">>> subprocess.getstatusoutput('ls /bin/ls')\n" +"(0, '/bin/ls')\n" +">>> subprocess.getstatusoutput('cat /bin/junk')\n" +"(1, 'cat: /bin/junk: No such file or directory')\n" +">>> subprocess.getstatusoutput('/bin/junk')\n" +"(127, 'sh: /bin/junk: not found')\n" +">>> subprocess.getstatusoutput('/bin/kill $$')\n" +"(-15, '')" #: ../../library/subprocess.rst:1496 msgid "Windows support was added." msgstr "Windows のサポートが追加されました。" -#: ../../library/subprocess.rst:1499 msgid "" "The function now returns (exitcode, output) instead of (status, output) as " "it did in Python 3.3.3 and earlier. exitcode has the same value as :attr:" "`~Popen.returncode`." msgstr "" +"Python 3.3.3 以前の (status, output) に代わり、(exitcode, output) を返すよう" +"になりました。\n" +"exitcode は :attr:`~Popen.returncode` と同じ値です。" #: ../../library/subprocess.rst:1508 msgid "Return output (stdout and stderr) of executing *cmd* in a shell." @@ -2191,11 +2445,12 @@ msgstr "" ":func:`getstatusoutput` に似ていますが、終了コードは無視され、コマンドの出力" "のみを返します。例えば::" -#: ../../library/subprocess.rst:1513 msgid "" ">>> subprocess.getoutput('ls /bin/ls')\n" "'/bin/ls'" msgstr "" +">>> subprocess.getoutput('ls /bin/ls')\n" +"'/bin/ls'" #: ../../library/subprocess.rst:1518 msgid "Windows support added" @@ -2205,32 +2460,37 @@ msgstr "Windowsで利用可能になりました" msgid "Notes" msgstr "注釈" -#: ../../library/subprocess.rst:1531 msgid "Timeout Behavior" -msgstr "" +msgstr "タイムアウトの動作" -#: ../../library/subprocess.rst:1533 msgid "" "When using the ``timeout`` parameter in functions like :func:`run`, :meth:" "`Popen.wait`, or :meth:`Popen.communicate`, users should be aware of the " "following behaviors:" msgstr "" +":func:`run`、:meth:`Popen.wait`、:meth:`Popen.communicate` などで " +"``timeout`` 引数を使う場合は、次の動作に注意してください:" -#: ../../library/subprocess.rst:1537 msgid "" "**Process Creation Delay**: The initial process creation itself cannot be " "interrupted on many platform APIs. This means that even when specifying a " "timeout, you are not guaranteed to see a timeout exception until at least " "after however long process creation takes." msgstr "" +"**プロセス作成による遅延**: 多くのプラットフォームの API では、最初のプロセス" +"作成自体を中断できません。\n" +"そのため、タイムアウトを指定しても、少なくともプロセス作成にかかる時間が経過" +"するまではタイムアウト例外が発生する保証はありません。" -#: ../../library/subprocess.rst:1542 msgid "" "**Extremely Small Timeout Values**: Setting very small timeout values (such " "as a few milliseconds) may result in almost immediate :exc:`TimeoutExpired` " "exceptions because process creation and system scheduling inherently require " "time." msgstr "" +"**非常に短いタイムアウト**: プロセス作成やシステムのスケジューリングには時間" +"がかかるため、数ミリ秒などの非常に短いタイムアウトを設定すると、ほぼ直ちに :" +"exc:`TimeoutExpired` 例外が発生することがあります。" #: ../../library/subprocess.rst:1549 msgid "Converting an argument sequence to a string on Windows" @@ -2296,9 +2556,8 @@ msgid "Module which provides function to parse and escape command lines." msgstr "" "コマンドラインを解析したりエスケープしたりする関数を提供するモジュール。" -#: ../../library/subprocess.rst:1585 msgid "Disable use of ``posix_spawn()``" -msgstr "" +msgstr "``posix_spawn()`` の使用を無効にする" #: ../../library/subprocess.rst:1587 msgid "" @@ -2307,28 +2566,33 @@ msgid "" "improves performance." msgstr "" -#: ../../library/subprocess.rst:1593 msgid "subprocess._USE_POSIX_SPAWN = False # See CPython issue gh-NNNNNN." msgstr "" +"subprocess._USE_POSIX_SPAWN = False # CPython の issue gh-NNNNNN を参照。" -#: ../../library/subprocess.rst:1595 msgid "" "It is safe to set this to false on any Python version. It will have no " "effect on older or newer versions where unsupported. Do not assume the " "attribute is available to read. Despite the name, a true value does not " "indicate the corresponding function will be used, only that it may be." msgstr "" +"どの Python バージョンでも、この値を偽に設定して問題ありません。\n" +"対応していない古いバージョンや新しいバージョンでは、効果がありません。\n" +"この属性が存在して読み出せるとは仮定しないでください。\n" +"名前とは異なり、値が真でも対応する関数を使うとは限らず、使う可能性があること" +"だけを示します。" -#: ../../library/subprocess.rst:1600 msgid "" "Please file issues any time you have to use these private knobs with a way " "to reproduce the issue you were seeing. Link to that issue from a comment in " "your code." msgstr "" +"これらの非公開の設定を使う必要がある場合は、その都度、問題を再現する方法を添" +"えて issue を報告してください。\n" +"コード内のコメントから、その issue にリンクしてください。" -#: ../../library/subprocess.rst:1604 msgid "``_USE_POSIX_SPAWN``" -msgstr "" +msgstr "``_USE_POSIX_SPAWN``" #: ../../library/subprocess.rst:296 msgid "universal newlines" diff --git a/library/sunau.po b/library/sunau.po index c174c9167..1f449a1ca 100644 --- a/library/sunau.po +++ b/library/sunau.po @@ -12,15 +12,14 @@ msgstr "" "PO-Revision-Date: 2024-11-19 01:03+0000\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" -#: ../../library/sunau.rst:2 msgid ":mod:`!sunau` --- Read and write Sun AU files" -msgstr "" +msgstr ":mod:`!sunau` --- Sun AU ファイルの読み書き" #: ../../library/sunau.rst:10 msgid "" @@ -28,9 +27,13 @@ msgid "" "`removed in Python 3.13 ` after being deprecated in " "Python 3.11. The removal was decided in :pep:`594`." msgstr "" +"このモジュールは今や Python 標準ライブラリの一部ではありません。このモジュー" +"ルは Python 3.11 で非推奨となったあと、:ref:`Python 3.13 で削除` されました。削除の決定は :pep:`594` でなされました。" -#: ../../library/sunau.rst:14 msgid "" "The last version of Python that provided the :mod:`!sunau` module was " "`Python 3.12 `_." msgstr "" +":mod:`!sunau` モジュールを提供していた最後の Python バージョンは `Python " +"3.12 `_ です。" diff --git a/library/superseded.po b/library/superseded.po index 83baf2fee..4f029aa6d 100644 --- a/library/superseded.po +++ b/library/superseded.po @@ -16,24 +16,24 @@ msgstr "" "Last-Translator: tomo, 2021\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/superseded.rst:5 msgid "Superseded Modules" msgstr "取って代わられたモジュール群" -#: ../../library/superseded.rst:7 msgid "" "The modules described in this chapter have been superseded by other modules " "for most use cases, and are retained primarily to preserve backwards " "compatibility." msgstr "" +"この章で説明するモジュールは、ほとんどの用途で他のモジュールに置き換えられて" +"おり、主に後方互換性を保つために残されています。" -#: ../../library/superseded.rst:10 msgid "" "Modules may appear in this chapter because they only cover a limited subset " "of a problem space, and a more generally applicable solution is available " @@ -42,6 +42,12 @@ msgid "" "rather than the broader command line option parsing and argument parsing " "capabilities offered by :mod:`optparse` and :mod:`argparse`)." msgstr "" +"この章には、問題の限られた範囲だけを扱い、標準ライブラリの別の場所にもっと広" +"く適用できる解決策があるモジュールが含まれることがあります。\n" +"例えば :mod:`getopt` は「C の :c:func:`!getopt` API を Python で模倣する」と" +"いう限定的な用途を扱います。\n" +":mod:`optparse` や :mod:`argparse` が提供する、より幅広いコマンドラインオプ" +"ションや引数の解析機能を提供するものではありません。" #: ../../library/superseded.rst:17 msgid "" diff --git a/library/symtable.po b/library/symtable.po index 789ee6037..bb1098257 100644 --- a/library/symtable.po +++ b/library/symtable.po @@ -19,10 +19,10 @@ msgstr "" "Last-Translator: tomo, 2025\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/symtable.rst:2 @@ -62,84 +62,84 @@ msgstr "" msgid "Examining Symbol Tables" msgstr "記号表の検査" -#: ../../library/symtable.rst:36 msgid "An enumeration indicating the type of a :class:`SymbolTable` object." -msgstr "" +msgstr ":class:`SymbolTable` オブジェクトの種類を示す列挙型です。" -#: ../../library/symtable.rst:41 msgid "Used for the symbol table of a module." -msgstr "" +msgstr "モジュールの記号表に使われます。" -#: ../../library/symtable.rst:46 msgid "Used for the symbol table of a function." -msgstr "" +msgstr "関数の記号表に使われます。" -#: ../../library/symtable.rst:51 msgid "Used for the symbol table of a class." -msgstr "" +msgstr "クラスの記号表に使われます。" -#: ../../library/symtable.rst:53 msgid "" "The following members refer to different flavors of :ref:`annotation scopes " "`." msgstr "" +"次のメンバーは、:ref:`アノテーションスコープ ` の種類を表" +"します。" #: ../../library/symtable.rst:59 msgid "" "Used for annotations if ``from __future__ import annotations`` is active." msgstr "" -#: ../../library/symtable.rst:64 msgid "Used for the symbol table of :keyword:`type` constructions." -msgstr "" +msgstr ":keyword:`type` 構文の記号表に使われます。" -#: ../../library/symtable.rst:69 msgid "" "Used for the symbol table of :ref:`generic functions ` " "or :ref:`generic classes `." msgstr "" +":ref:`ジェネリック関数 ` または :ref:`ジェネリッククラス " +"` の記号表に使われます。" -#: ../../library/symtable.rst:75 msgid "" "Used for the symbol table of the bound, the constraint tuple or the default " "value of a single type variable in the formal sense, i.e., a TypeVar, a " "TypeVarTuple or a ParamSpec object (the latter two do not support a bound or " "a constraint tuple)." msgstr "" +"型変数、つまり TypeVar、TypeVarTuple、ParamSpec のいずれかのオブジェクト 1 つ" +"について、その上限境界、制約タプル、デフォルト値の記号表に使われます (後ろの " +"2 つは上限境界や制約タプルをサポートしません)。" #: ../../library/symtable.rst:84 msgid "A namespace table for a block. The constructor is not public." msgstr "" "ブロックに対する名前空間の記号表。コンストラクタはパブリックではありません。" -#: ../../library/symtable.rst:88 msgid "" "Return the type of the symbol table. Possible values are members of the :" "class:`SymbolTableType` enumeration." msgstr "" +"記号表の種類を返します。\n" +"戻り値は :class:`SymbolTableType` 列挙型のメンバーです。" -#: ../../library/symtable.rst:91 msgid "" "Added ``'annotation'``, ``'TypeVar bound'``, ``'type alias'``, and ``'type " "parameter'`` as possible return values." msgstr "" +"戻り値として ``'annotation'``、``'TypeVar bound'``、``'type alias'``、" +"``'type parameter'`` が追加されました。" -#: ../../library/symtable.rst:95 msgid "Return values are members of the :class:`SymbolTableType` enumeration." -msgstr "" +msgstr "戻り値が :class:`SymbolTableType` 列挙型のメンバーになりました。" -#: ../../library/symtable.rst:98 msgid "" "The exact values of the returned string may change in the future, and thus, " "it is recommended to use :class:`SymbolTableType` members instead of hard-" "coded strings." msgstr "" +"返される文字列の具体的な値は将来変わる可能性があるため、文字列を直接書くので" +"はなく :class:`SymbolTableType` のメンバーを使うことを推奨します。" #: ../../library/symtable.rst:104 msgid "Return the table's identifier." msgstr "記号表の識別子を返します。" -#: ../../library/symtable.rst:108 msgid "" "Return the table's name. This is the name of the class if the table is for " "a class, the name of the function if the table is for a function, or " @@ -149,6 +149,14 @@ msgid "" "alias. For type alias scopes, it is the name of the type alias. For :class:" "`~typing.TypeVar` bound scopes, it is the name of the ``TypeVar``." msgstr "" +"記号表の名前を返します。\n" +"クラスの記号表ならクラス名、関数の記号表なら関数名、グローバルな記号表 (:" +"meth:`get_type` が ``'module'`` を返すもの) なら ``'top'`` です。\n" +"ジェネリッククラス、関数、型エイリアスで使う型パラメータースコープの場合は、" +"対応するクラス、関数、型エイリアスの名前です。\n" +"型エイリアススコープの場合は型エイリアスの名前です。\n" +":class:`~typing.TypeVar` の上限境界スコープの場合は、その ``TypeVar`` の名前" +"です。" #: ../../library/symtable.rst:118 msgid "Return the number of the first line in the block this table represents." @@ -171,11 +179,12 @@ msgstr "" "ブロックが入れ子の名前空間を含んでいるならば ``True`` を返します。入れ子の名" "前空間は :meth:`get_children` で得られます。" -#: ../../library/symtable.rst:135 msgid "" "Return a view object containing the names of symbols in the table. See the :" "ref:`documentation of view objects `." msgstr "" +"記号表内の記号の名前を含むビューオブジェクトを返します。\n" +":ref:`ビューオブジェクトのドキュメント ` を参照してください。" #: ../../library/symtable.rst:140 msgid "Lookup *name* in the table and return a :class:`Symbol` instance." @@ -191,11 +200,12 @@ msgstr "記号表中の名前を表す :class:`Symbol` インスタンスのリ msgid "Return a list of the nested symbol tables." msgstr "入れ子になった記号表のリストを返します。" -#: ../../library/symtable.rst:153 msgid "" "A namespace for a function or method. This class inherits from :class:" "`SymbolTable`." msgstr "" +"関数またはメソッドの名前空間です。\n" +"このクラスは :class:`SymbolTable` を継承します。" #: ../../library/symtable.rst:158 msgid "Return a tuple containing names of parameters to this function." @@ -209,45 +219,46 @@ msgstr "この関数のローカル変数の名前からなるタプルを返し msgid "Return a tuple containing names of globals in this function." msgstr "この関数のグローバル変数の名前からなるタプルを返します。" -#: ../../library/symtable.rst:170 msgid "" "Return a tuple containing names of explicitly declared nonlocals in this " "function." -msgstr "" +msgstr "この関数内で明示的に nonlocal と宣言された名前のタプルを返します。" -#: ../../library/symtable.rst:174 msgid "" "Return a tuple containing names of :term:`free (closure) variables ` in this function." msgstr "" +"この関数内の :term:`自由 (クロージャー) 変数 ` の名前のタプ" +"ルを返します。" -#: ../../library/symtable.rst:180 msgid "A namespace of a class. This class inherits from :class:`SymbolTable`." msgstr "" +"クラスの名前空間です。\n" +"このクラスは :class:`SymbolTable` を継承します。" -#: ../../library/symtable.rst:184 msgid "" "Return a tuple containing the names of method-like functions declared in the " "class." -msgstr "" +msgstr "クラス内で宣言された、メソッドに相当する関数の名前のタプルを返します。" -#: ../../library/symtable.rst:187 msgid "" "Here, the term 'method' designates *any* function defined in the class body " "via :keyword:`def` or :keyword:`async def`." msgstr "" +"ここで「メソッド」とは、クラス本体で :keyword:`def` または :keyword:`async " +"def` によって定義された *すべての* 関数を指します。" -#: ../../library/symtable.rst:190 msgid "" "Functions defined in a deeper scope (e.g., in an inner class) are not picked " "up by :meth:`get_methods`." msgstr "" +"より深いスコープ (内部クラスなど) で定義された関数は、:meth:`get_methods` の" +"結果には含まれません。" #: ../../library/symtable.rst:193 msgid "For example:" msgstr "例えば:" -#: ../../library/symtable.rst:206 msgid "" ">>> import symtable\n" ">>> st = symtable.symtable('''\n" @@ -269,12 +280,32 @@ msgid "" ">>> class_A.get_methods()\n" "('f', 'g', 'h')" msgstr "" +">>> import symtable\n" +">>> st = symtable.symtable('''\n" +"... def outer(): pass\n" +"...\n" +"... class A:\n" +"... def f():\n" +"... def w(): pass\n" +"...\n" +"... def g(self): pass\n" +"...\n" +"... @classmethod\n" +"... async def h(cls): pass\n" +"...\n" +"... global outer\n" +"... def outer(self): pass\n" +"... ''', 'test', 'exec')\n" +">>> class_A = st.get_children()[2]\n" +">>> class_A.get_methods()\n" +"('f', 'g', 'h')" -#: ../../library/symtable.rst:228 msgid "" "Although ``A().f()`` raises :exc:`TypeError` at runtime, ``A.f`` is still " "considered as a method-like function." msgstr "" +"``A().f()`` は実行時に :exc:`TypeError` を送出しますが、``A.f`` はそれでもメ" +"ソッドに相当する関数とみなされます。" #: ../../library/symtable.rst:236 msgid "" @@ -300,9 +331,8 @@ msgstr "記号が import 文で作られたものならば ``True`` を返しま msgid "Return ``True`` if the symbol is a parameter." msgstr "記号がパラメータならば ``True`` を返します。" -#: ../../library/symtable.rst:257 msgid "Return ``True`` if the symbol is a type parameter." -msgstr "" +msgstr "記号が型パラメーターであれば ``True`` を返します。" #: ../../library/symtable.rst:263 msgid "Return ``True`` if the symbol is global." @@ -335,17 +365,16 @@ msgstr "" "記号がそのブロックの中で参照されていて、しかし代入は行われないならば " "``True`` を返します。" -#: ../../library/symtable.rst:290 msgid "" "Return *True* if a class-scoped symbol is free from the perspective of a " "method." msgstr "" +"クラススコープの記号がメソッドから見て自由変数である場合、*True* を返します。" #: ../../library/symtable.rst:293 msgid "Consider the following example::" msgstr "次に示す例について考えてみてください。::" -#: ../../library/symtable.rst:295 msgid "" "def f():\n" " x = 1 # function-scoped\n" @@ -354,25 +383,31 @@ msgid "" " def method(self):\n" " return x" msgstr "" +"def f():\n" +" x = 1 # 関数スコープ\n" +" class C:\n" +" x = 2 # クラススコープ\n" +" def method(self):\n" +" return x" -#: ../../library/symtable.rst:302 msgid "" "In this example, the class-scoped symbol ``x`` is considered to be free from " "the perspective of ``C.method``, thereby allowing the latter to return *1* " "at runtime and not *2*." msgstr "" +"この例では、クラススコープの記号 ``x`` は ``C.method`` から見て自由変数とみな" +"されます。\n" +"そのため、``C.method`` は実行時に *2* ではなく *1* を返せます。" #: ../../library/symtable.rst:310 msgid "Return ``True`` if the symbol is assigned to in its block." msgstr "記号がそのブロックの中で代入されているならば ``True`` を返します。" -#: ../../library/symtable.rst:314 msgid "Return ``True`` if the symbol is a comprehension iteration variable." -msgstr "" +msgstr "記号が内包表記の反復変数であれば ``True`` を返します。" -#: ../../library/symtable.rst:320 msgid "Return ``True`` if the symbol is a cell in an inlined comprehension." -msgstr "" +msgstr "記号がインライン化された内包表記のセルであれば ``True`` を返します。" #: ../../library/symtable.rst:326 msgid "Return ``True`` if name binding introduces new namespace." @@ -388,13 +423,16 @@ msgstr "名前が関数または class 文のターゲットとして使われ msgid "For example::" msgstr "例えば::" -#: ../../library/symtable.rst:333 msgid "" ">>> table = symtable.symtable(\"def some_func(): pass\", \"string\", " "\"exec\")\n" ">>> table.lookup(\"some_func\").is_namespace()\n" "True" msgstr "" +">>> table = symtable.symtable(\"def some_func(): pass\", \"string\", " +"\"exec\")\n" +">>> table.lookup(\"some_func\").is_namespace()\n" +"True" #: ../../library/symtable.rst:337 msgid "" @@ -428,12 +466,12 @@ msgid "" "The :mod:`symtable` module can be executed as a script from the command line." msgstr "" -#: ../../library/symtable.rst:360 msgid "python -m symtable [infile...]" -msgstr "" +msgstr "python -m symtable [infile...]" -#: ../../library/symtable.rst:364 msgid "" "Symbol tables are generated for the specified Python source files and dumped " "to stdout. If no input file is specified, the content is read from stdin." msgstr "" +"指定した Python ソースファイルの記号表を生成し、標準出力に書き出します。\n" +"入力ファイルを指定しない場合は、標準入力から内容を読み込みます。" diff --git a/library/sys.po b/library/sys.po index abd6a5a94..57e02dc12 100644 --- a/library/sys.po +++ b/library/sys.po @@ -23,23 +23,26 @@ msgstr "" "Last-Translator: tomo, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/sys.rst:2 msgid ":mod:`!sys` --- System-specific parameters and functions" msgstr ":mod:`!sys` --- システム固有のパラメーターと関数" -#: ../../library/sys.rst:9 msgid "" "This module provides access to some variables used or maintained by the " "interpreter and to functions that interact strongly with the interpreter. It " "is always available. Unless explicitly noted otherwise, all variables are " "read-only." msgstr "" +"このモジュールは、インタープリタが使用または管理する変数と、インタープリタに" +"密接に関わる関数を提供します。\n" +"常に利用できます。\n" +"特に明記されていない限り、すべての変数は読み出し専用です。" #: ../../library/sys.rst:16 msgid "" @@ -57,14 +60,8 @@ msgstr "" "デフォルトのフラグは空文字列になりました。 (pymalloc のための ``m`` フラグが" "取り除かれました)" -#: ../../library/sys.rst:25 ../../library/sys.rst:298 ../../library/sys.rst:368 -#: ../../library/sys.rst:789 ../../library/sys.rst:807 -#: ../../library/sys.rst:1054 ../../library/sys.rst:1648 -#: ../../library/sys.rst:1891 ../../library/sys.rst:1906 -#: ../../library/sys.rst:1914 ../../library/sys.rst:1936 -#: ../../library/sys.rst:1952 ../../library/sys.rst:2196 msgid "Availability" -msgstr "" +msgstr "利用可能な環境" #: ../../library/sys.rst:30 msgid "" @@ -74,7 +71,6 @@ msgstr "" "呼び出し可能な *hook* を現在の(サブ)インタープリタのアクティブな監査用フック" "のリストに加えます。" -#: ../../library/sys.rst:33 msgid "" "When an auditing event is raised through the :func:`sys.audit` function, " "each hook will be called in the order it was added with the event name and " @@ -83,8 +79,13 @@ msgid "" "Hooks can then log the event, raise an exception to abort the operation, or " "terminate the process entirely." msgstr "" +":func:`sys.audit` 関数で監査イベントが発生すると、追加された順に各フックを呼" +"び出し、イベント名と引数のタプルを渡します。\n" +"まず :c:func:`PySys_AddAuditHook` で追加したネイティブのフックを呼び出し、次" +"に現在の (サブ) インタープリタで追加したフックを呼び出します。\n" +"フックは、イベントを記録したり、例外を送出して操作を中止したり、プロセス全体" +"を終了させたりできます。" -#: ../../library/sys.rst:40 msgid "" "Note that audit hooks are primarily for collecting information about " "internal or otherwise unobservable actions, whether by Python or libraries " @@ -95,8 +96,16 @@ msgid "" "runtime, and any modules allowing arbitrary memory modification (such as :" "mod:`ctypes`) should be completely removed or closely monitored." msgstr "" +"監査フックの主な用途は、Python や Python で書かれたライブラリが行う内部的な動" +"作など、ほかの方法では観測できない動作の情報を集めることです。\n" +"「サンドボックス」の実装には適していません。\n" +"特に、この関数で追加したフックは悪意のあるコードによって簡単に無効化または回" +"避され得ます。\n" +"セキュリティに関わるフックは、少なくともランタイムの初期化前に C API の :c:" +"func:`PySys_AddAuditHook` を使って追加する必要があります。\n" +"また、任意のメモリ変更を許すモジュール (:mod:`ctypes` など) は完全に取り除く" +"か、厳密に監視する必要があります。" -#: ../../library/sys.rst:49 ../../library/sys.rst:51 msgid "" "Calling :func:`sys.addaudithook` will itself raise an auditing event named " "``sys.addaudithook`` with no arguments. If any existing hooks raise an " @@ -104,12 +113,19 @@ msgid "" "and the exception suppressed. As a result, callers cannot assume that their " "hook has been added unless they control all existing hooks." msgstr "" +":func:`sys.addaudithook` の呼び出し自体も、引数のない ``sys.addaudithook`` と" +"いう監査イベントを発生させます。\n" +"既存のフックが :class:`RuntimeError` の派生例外を送出すると、新しいフックは追" +"加されず、その例外は抑制されます。\n" +"そのため、既存のフックをすべて制御していない限り、呼び出し側は自分のフックが" +"追加されたとは仮定できません。" -#: ../../library/sys.rst:58 msgid "" "See the :ref:`audit events table ` for all events raised by " "CPython, and :pep:`578` for the original design discussion." msgstr "" +"CPython が発生させるイベントの一覧は :ref:`監査イベントの表 `、" +"当初の設計に関する議論は :pep:`578` を参照してください。" #: ../../library/sys.rst:65 msgid "" @@ -118,12 +134,15 @@ msgid "" msgstr "" ":class:`RuntimeError` ではない :class:`Exception` は抑制されなくなりました。" -#: ../../library/sys.rst:70 msgid "" "When tracing is enabled (see :func:`settrace`), Python hooks are only traced " "if the callable has a ``__cantrace__`` member that is set to a true value. " "Otherwise, trace functions will skip the hook." msgstr "" +"トレースが有効な場合 (:func:`settrace` を参照)、Python のフックがトレースされ" +"るのは、その呼び出し可能オブジェクトに真の値を持つ ``__cantrace__`` メンバー" +"がある場合だけです。\n" +"それ以外の場合、トレース関数はそのフックをスキップします。" #: ../../library/sys.rst:77 msgid "" @@ -148,9 +167,8 @@ msgstr "" "標準入力もしくはコマンドライン引数で指定されたファイルのリストに渡ってループ" "するには、 :mod:`fileinput` モジュールを参照してください。" -#: ../../library/sys.rst:86 msgid "See also :data:`sys.orig_argv`." -msgstr "" +msgstr ":data:`sys.orig_argv` も参照してください。" #: ../../library/sys.rst:89 msgid "" @@ -165,7 +183,6 @@ msgstr "" "オリジナルのバイト列が必要なときには、 ``[os.fsencode(arg) for arg in sys." "argv]`` で取得できます。" -#: ../../library/sys.rst:101 msgid "" "Raise an auditing event and trigger any active auditing hooks. *event* is a " "string identifying the event, and *args* may contain optional arguments with " @@ -173,14 +190,20 @@ msgid "" "given event are considered a public and stable API and should not be " "modified between releases." msgstr "" +"監査イベントを発生させ、有効な監査フックを呼び出します。\n" +"*event* はイベントを識別する文字列です。\n" +"*args* には、そのイベントの詳しい情報を持つ引数を任意に含められます。\n" +"各イベントの引数の数と型は安定した公開 API とみなされ、リリース間で変更すべき" +"ではありません。" -#: ../../library/sys.rst:107 msgid "" "For example, one auditing event is named ``os.chdir``. This event has one " "argument called *path* that will contain the requested new working directory." msgstr "" +"例えば、監査イベントの 1 つに ``os.chdir`` があります。\n" +"このイベントは *path* という引数を 1 つ持ち、要求された新しい作業ディレクトリ" +"が入ります。" -#: ../../library/sys.rst:111 msgid "" ":func:`sys.audit` will call the existing auditing hooks, passing the event " "name and arguments, and will re-raise the first exception from any hook. In " @@ -189,32 +212,42 @@ msgid "" "implementations to decide how to respond to particular events: they can " "merely log the event or abort the operation by raising an exception." msgstr "" +":func:`sys.audit` は既存の監査フックをイベント名と引数を渡して呼び出し、いず" +"れかのフックで最初に発生した例外を再送出します。\n" +"一般に、例外が送出された場合は処理せず、できるだけ速やかにプロセスを終了させ" +"るべきです。\n" +"これによってフックの実装が、特定のイベントへの対応を決められます。\n" +"イベントを記録するだけにすることも、例外を送出して操作を中止することもできま" +"す。" -#: ../../library/sys.rst:119 msgid "" "Hooks are added using the :func:`sys.addaudithook` or :c:func:" "`PySys_AddAuditHook` functions." msgstr "" +"フックは :func:`sys.addaudithook` または :c:func:`PySys_AddAuditHook` 関数で" +"追加します。" -#: ../../library/sys.rst:122 msgid "" "The native equivalent of this function is :c:func:`PySys_Audit`. Using the " "native function is preferred when possible." msgstr "" +"この関数に対応するネイティブ関数は :c:func:`PySys_Audit` です。\n" +"可能ならネイティブ関数を使うことを推奨します。" -#: ../../library/sys.rst:125 msgid "" "See the :ref:`audit events table ` for all events raised by " "CPython." msgstr "" +"CPython が発生させるイベントの一覧は :ref:`監査イベントの表 ` " +"を参照してください。" -#: ../../library/sys.rst:133 msgid "" "Equivalent to :data:`exec_prefix`, but referring to the base Python " "installation." msgstr "" +":data:`exec_prefix` と同等ですが、基になる Python のインストール先を参照しま" +"す。" -#: ../../library/sys.rst:135 msgid "" "When running under :ref:`sys-path-init-virtual-environments`, :data:" "`exec_prefix` gets overwritten to the virtual environment prefix. :data:" @@ -222,13 +255,17 @@ msgid "" "base Python installation. Refer to :ref:`sys-path-init-virtual-environments` " "for more information." msgstr "" +":ref:`sys-path-init-virtual-environments` で実行すると、:data:`exec_prefix` " +"は仮想環境のプレフィックスに上書きされます。\n" +"一方、:data:`base_exec_prefix` は変わらず、常に基になる Python のインストール" +"先を指します。\n" +"詳しくは :ref:`sys-path-init-virtual-environments` を参照してください。" -#: ../../library/sys.rst:146 msgid "" "Equivalent to :data:`prefix`, but referring to the base Python installation." msgstr "" +":data:`prefix` と同等ですが、基になる Python のインストール先を参照します。" -#: ../../library/sys.rst:148 msgid "" "When running under :ref:`virtual environment `, :data:`prefix` " "gets overwritten to the virtual environment prefix. :data:`base_prefix`, " @@ -236,6 +273,11 @@ msgid "" "installation. Refer to :ref:`sys-path-init-virtual-environments` for more " "information." msgstr "" +":ref:`仮想環境 ` で実行すると、:data:`prefix` は仮想環境のプレ" +"フィックスに上書きされます。\n" +"一方、:data:`base_prefix` は変わらず、常に基になる Python のインストール先を" +"指します。\n" +"詳しくは :ref:`sys-path-init-virtual-environments` を参照してください。" #: ../../library/sys.rst:159 msgid "" @@ -257,23 +299,27 @@ msgstr "" "列のタプル(この情報は、他の手段では取得することができません。 ``modules." "keys()`` は、インポートされたモジュールのみのリストを返します。)" -#: ../../library/sys.rst:170 msgid "See also the :data:`sys.stdlib_module_names` list." -msgstr "" +msgstr ":data:`sys.stdlib_module_names` の一覧も参照してください。" -#: ../../library/sys.rst:175 msgid "" "Call ``func(*args)``, while tracing is enabled. The tracing state is saved, " "and restored afterwards. This is intended to be called from a debugger from " "a checkpoint, to recursively debug or profile some other code." msgstr "" +"トレースを有効にして ``func(*args)`` を呼び出します。\n" +"トレースの状態は保存され、呼び出し後に復元されます。\n" +"デバッガのチェックポイントから呼び出し、ほかのコードを再帰的にデバッグまたは" +"プロファイルするためのものです。" -#: ../../library/sys.rst:179 msgid "" "Tracing is suspended while calling a tracing function set by :func:" "`settrace` or :func:`setprofile` to avoid infinite recursion. :func:`!" "call_tracing` enables explicit recursion of the tracing function." msgstr "" +"無限再帰を避けるため、:func:`settrace` または :func:`setprofile` で設定したト" +"レース関数を呼び出している間、トレースは一時停止します。\n" +":func:`!call_tracing` を使うと、明示的にトレース関数を再帰呼び出しできます。" #: ../../library/sys.rst:186 msgid "A string containing the copyright pertaining to the Python interpreter." @@ -295,15 +341,17 @@ msgid "" "This function should be used for internal and specialized purposes only." msgstr "この関数は、内部的かつ特殊な目的にのみ利用されるべきです。" -#: ../../library/sys.rst:197 msgid "Use the more general :func:`_clear_internal_caches` function instead." msgstr "" +"代わりに、より汎用的な :func:`_clear_internal_caches` 関数を使ってください。" -#: ../../library/sys.rst:203 msgid "" "Clear all internal performance-related caches. Use this function *only* to " "release unnecessary references and memory blocks when hunting for leaks." msgstr "" +"性能向上のための内部キャッシュをすべてクリアします。\n" +"この関数は、リークを調べるときに不要な参照やメモリブロックを解放するため *だ" +"け* に使ってください。" #: ../../library/sys.rst:211 msgid "" @@ -331,39 +379,39 @@ msgstr "" "については、そのフレームを調べるコードを呼んだ時にはそのスレッドの現在の実行" "状況とは関係ないところを指し示しているかもしれません。" -#: ../../library/sys.rst:224 msgid "" "Raises an :ref:`auditing event ` ``sys._current_frames`` with no " "arguments." msgstr "" "引数無しで :ref:`監査イベント ` ``sys._current_frames`` を送出しま" -"す。 " +"す。" -#: ../../library/sys.rst:228 msgid "" "Return a dictionary mapping each thread's identifier to the topmost " "exception currently active in that thread at the time the function is " "called. If a thread is not currently handling an exception, it is not " "included in the result dictionary." msgstr "" +"各スレッドの識別子を、関数の呼び出し時点でそのスレッドの最も内側で処理中の例" +"外に対応付ける辞書を返します。\n" +"例外を処理していないスレッドは、結果の辞書に含まれません。" -#: ../../library/sys.rst:233 msgid "This is most useful for statistical profiling." -msgstr "" +msgstr "統計的プロファイリングで特に便利です。" -#: ../../library/sys.rst:237 msgid "" "Raises an :ref:`auditing event ` ``sys._current_exceptions`` with " "no arguments." msgstr "" "引数無しで :ref:`監査イベント ` ``sys._current_exceptions`` を送出" -"します。 " +"します。" -#: ../../library/sys.rst:239 msgid "" "Each value in the dictionary is now a single exception instance, rather than " "a 3-tuple as returned from ``sys.exc_info()``." msgstr "" +"辞書の各値が、``sys.exc_info()`` が返すような 3 要素のタプルではなく、単一の" +"例外インスタンスになりました。" #: ../../library/sys.rst:245 msgid "" @@ -448,12 +496,14 @@ msgstr "" "CPython のメモリアロケータの状態に関する低レベルの情報を標準エラー出力に出力" "します。" -#: ../../library/sys.rst:282 msgid "" "If Python is :ref:`built in debug mode ` (:option:`configure --" "with-pydebug option <--with-pydebug>`), it also performs some expensive " "internal consistency checks." msgstr "" +"Python が :ref:`デバッグモードでビルド ` されている場合 (:" +"option:`configure の --with-pydebug オプション <--with-pydebug>`)、コストの高" +"い内部整合性の検査も行います。" #: ../../library/sys.rst:290 msgid "" @@ -467,7 +517,6 @@ msgstr "" msgid "Integer specifying the handle of the Python DLL." msgstr "Python DLLのハンドルを示す整数です。" -#: ../../library/sys.rst:303 msgid "" "If *value* is not ``None``, this function prints ``repr(value)`` to ``sys." "stdout``, and saves *value* in ``builtins._``. If ``repr(value)`` is not " @@ -476,10 +525,11 @@ msgid "" "encoding`` with ``'backslashreplace'`` error handler." msgstr "" "*value* が ``None`` 以外の時、``repr(value)`` を ``sys.stdout`` に出力し、" -"``builtins._`` に保存します。``repr(value)`` がエラーハンドラを ``sys.stdout." -"errors`` (おそらく ``'strict'``) として ``sys.stdout.encoding`` にエンコード" -"できない場合、エラーハンドラを ``'backslashreplace'`` として ``sys.stdout." -"encoding`` にエンコードします。" +"*value* を ``builtins._`` に保存します。\n" +"``repr(value)`` がエラーハンドラを ``sys.stdout.errors`` (おそらく " +"``'strict'``) として ``sys.stdout.encoding`` にエンコードできない場合、エラー" +"ハンドラを ``'backslashreplace'`` として ``sys.stdout.encoding`` にエンコード" +"します。" #: ../../library/sys.rst:309 msgid "" @@ -496,7 +546,6 @@ msgstr "" msgid "Pseudo-code::" msgstr "擬似コード::" -#: ../../library/sys.rst:315 msgid "" "def displayhook(value):\n" " if value is None:\n" @@ -516,12 +565,28 @@ msgid "" " sys.stdout.write(\"\\n\")\n" " builtins._ = value" msgstr "" +"def displayhook(value):\n" +" if value is None:\n" +" return\n" +" # 再帰を避けるため '_' を None に設定する。\n" +" builtins._ = None\n" +" text = repr(value)\n" +" try:\n" +" sys.stdout.write(text)\n" +" except UnicodeEncodeError:\n" +" bytes = text.encode(sys.stdout.encoding, 'backslashreplace')\n" +" if hasattr(sys.stdout, 'buffer'):\n" +" sys.stdout.buffer.write(bytes)\n" +" else:\n" +" text = bytes.decode(sys.stdout.encoding, 'strict')\n" +" sys.stdout.write(text)\n" +" sys.stdout.write(\"\\n\")\n" +" builtins._ = value" -#: ../../library/sys.rst:333 msgid "Use ``'backslashreplace'`` error handler on :exc:`UnicodeEncodeError`." msgstr "" -":exc:`UnicodeEncodeError` には ``'backslashreplace'`` エラーハンドラを指定し" -"てください。" +":exc:`UnicodeEncodeError` が発生した場合は ``'backslashreplace'`` エラーハン" +"ドラを使用するようになりました。" #: ../../library/sys.rst:339 msgid "" @@ -537,34 +602,39 @@ msgstr "" "``False`` に設定されますが、実行時にこの変数を変更してバイトコード生成を制御" "することもできます。" -#: ../../library/sys.rst:348 msgid "" "A :term:`named tuple` holding information about the environment on the " "*wasm32-emscripten* platform. The named tuple is provisional and may change " "in the future." msgstr "" +"*wasm32-emscripten* プラットフォームの環境に関する情報を持つ :term:`名前付き" +"タプル ` です。\n" +"この名前付きタプルは暫定的なもので、将来変更される可能性があります。" -#: ../../library/sys.rst:354 msgid "" "Emscripten version as tuple of ints (major, minor, micro), e.g. ``(3, 1, " "8)``." msgstr "" +"Emscripten のバージョンを表す整数のタプル (major, minor, micro) です。\n" +"例えば ``(3, 1, 8)`` です。" -#: ../../library/sys.rst:358 msgid "" "Runtime string, e.g. browser user agent, ``'Node.js v14.18.2'``, or " "``'UNKNOWN'``." msgstr "" +"ランタイムを表す文字列です。\n" +"例えばブラウザのユーザーエージェント、``'Node.js v14.18.2'``、``'UNKNOWN'`` " +"などです。" -#: ../../library/sys.rst:362 msgid "``True`` if Python is compiled with Emscripten pthreads support." msgstr "" +"Python が Emscripten の pthreads に対応するようコンパイルされていれば " +"``True`` です。" -#: ../../library/sys.rst:366 msgid "``True`` if Python is compiled with shared memory support." msgstr "" +"Python が共有メモリに対応するようコンパイルされていれば ``True`` です。" -#: ../../library/sys.rst:375 msgid "" "If this is set (not ``None``), Python will write bytecode-cache ``.pyc`` " "files to (and read them from) a parallel directory tree rooted at this " @@ -574,26 +644,35 @@ msgid "" "you use :mod:`compileall` as a pre-build step, you must ensure you run it " "with the same pycache prefix (if any) that you will use at runtime." msgstr "" +"これを設定すると (``None`` 以外にすると)、Python はソースコードツリー内の " +"``__pycache__`` ディレクトリの代わりに、指定したディレクトリを根とする並行し" +"たディレクトリツリーで、バイトコードキャッシュの ``.pyc`` ファイルを読み書き" +"します。\n" +"ソースコードツリー内の ``__pycache__`` ディレクトリはすべて無視され、新しい " +"``.pyc`` ファイルは指定した pycache プレフィックス内に書き込まれます。\n" +"したがって、ビルドの前処理として :mod:`compileall` を使う場合は、実行時に使う" +"ものと同じ pycache プレフィックス (指定する場合) で実行する必要があります。" -#: ../../library/sys.rst:383 msgid "" "A relative path is interpreted relative to the current working directory." -msgstr "" +msgstr "相対パスはカレント作業ディレクトリからの相対パスとして解釈されます。" -#: ../../library/sys.rst:385 msgid "" "This value is initially set based on the value of the :option:`-X` " "``pycache_prefix=PATH`` command-line option or the :envvar:" "`PYTHONPYCACHEPREFIX` environment variable (command-line takes precedence). " "If neither are set, it is ``None``." msgstr "" +"この値は、:option:`-X` ``pycache_prefix=PATH`` コマンドラインオプション、また" +"は環境変数 :envvar:`PYTHONPYCACHEPREFIX` に基づいて初期設定されます (コマンド" +"ラインが優先されます)。\n" +"どちらも設定されていなければ ``None`` です。" #: ../../library/sys.rst:395 msgid "" "This function prints out a given traceback and exception to ``sys.stderr``." msgstr "指定したトレースバックと例外を ``sys.stderr`` に出力します。" -#: ../../library/sys.rst:397 msgid "" "When an exception other than :exc:`SystemExit` is raised and uncaught, the " "interpreter calls ``sys.excepthook`` with three arguments, the exception " @@ -603,8 +682,14 @@ msgid "" "such top-level exceptions can be customized by assigning another three-" "argument function to ``sys.excepthook``." msgstr "" +":exc:`SystemExit` 以外の例外が送出されて捕捉されなかった場合、インタープリタ" +"は例外クラス、例外インスタンス、トレースバックオブジェクトの 3 つを引数とし" +"て ``sys.excepthook`` を呼び出します。\n" +"対話セッションではプロンプトに制御を戻す直前、Python プログラムではプログラム" +"の終了直前に呼び出します。\n" +"``sys.excepthook`` に引数を 3 つ取る別の関数を代入すると、このような最上位の" +"例外の処理をカスタマイズできます。" -#: ../../library/sys.rst:404 ../../library/sys.rst:406 msgid "" "Raise an auditing event ``sys.excepthook`` with arguments ``hook``, " "``type``, ``value``, ``traceback`` when an uncaught exception occurs. If no " @@ -613,13 +698,21 @@ msgid "" "Otherwise, the audit hook exception will be reported as unraisable and ``sys." "excepthook`` will be called." msgstr "" +"捕捉されない例外が発生すると、引数 ``hook``、``type``、``value``、" +"``traceback`` を持つ監査イベント ``sys.excepthook`` を発生させます。\n" +"フックが設定されていなければ ``hook`` は ``None`` のことがあります。\n" +"いずれかの監査フックが :class:`RuntimeError` の派生例外を送出すると、例外フッ" +"クの呼び出しを抑制します。\n" +"それ以外の場合は、監査フックの例外を送出不能な例外として報告した後、``sys." +"excepthook`` を呼び出します。" -#: ../../library/sys.rst:415 msgid "" "The :func:`sys.unraisablehook` function handles unraisable exceptions and " "the :func:`threading.excepthook` function handles exception raised by :func:" "`threading.Thread.run`." msgstr "" +"送出不能な例外は :func:`sys.unraisablehook` 関数が処理し、:func:`threading." +"Thread.run` が送出した例外は :func:`threading.excepthook` 関数が処理します。" #: ../../library/sys.rst:425 msgid "" @@ -643,19 +736,20 @@ msgstr "__breakpointhook__" msgid "__unraisablehook__" msgstr "__unraisablehook__" -#: ../../library/sys.rst:440 msgid "" "This function, when called while an exception handler is executing (such as " "an ``except`` or ``except*`` clause), returns the exception instance that " "was caught by this handler. When exception handlers are nested within one " "another, only the exception handled by the innermost handler is accessible." msgstr "" +"この関数を例外ハンドラ (``except`` 節や ``except*`` 節など) の実行中に呼び出" +"すと、そのハンドラが捕捉した例外インスタンスを返します。\n" +"例外ハンドラが入れ子になっている場合、最も内側のハンドラが処理している例外だ" +"けを取得できます。" -#: ../../library/sys.rst:445 msgid "If no exception handler is executing, this function returns ``None``." -msgstr "" +msgstr "例外ハンドラが実行中でなければ、この関数は ``None`` を返します。" -#: ../../library/sys.rst:452 msgid "" "This function returns the old-style representation of the handled exception. " "If an exception ``e`` is currently handled (so :func:`exception` would " @@ -665,20 +759,30 @@ msgid "" "`traceback object ` which typically encapsulates the call " "stack at the point where the exception last occurred." msgstr "" +"処理中の例外を旧形式で返します。\n" +"現在例外 ``e`` を処理している場合 (:func:`exception` が ``e`` を返す場合)、:" +"func:`exc_info` はタプル ``(type(e), e, e.__traceback__)`` を返します。\n" +"つまり、例外の型 (:exc:`BaseException` のサブクラス)、例外自体、および通常は" +"例外が最後に発生した時点のコールスタックを保持する :ref:`トレースバックオブ" +"ジェクト ` を含むタプルです。" -#: ../../library/sys.rst:463 msgid "" "If no exception is being handled anywhere on the stack, this function return " "a tuple containing three ``None`` values." msgstr "" +"スタック内のどこでも例外を処理していなければ、``None`` を 3 つ含むタプルを返" +"します。" -#: ../../library/sys.rst:466 msgid "" "The ``type`` and ``traceback`` fields are now derived from the ``value`` " "(the exception instance), so when an exception is modified while it is being " "handled, the changes are reflected in the results of subsequent calls to :" "func:`exc_info`." msgstr "" +"``type`` と ``traceback`` のフィールドは ``value`` (例外インスタンス) から得" +"られるようになりました。\n" +"そのため、処理中に例外を変更すると、その後の :func:`exc_info` の呼び出し結果" +"に変更が反映されます。" #: ../../library/sys.rst:474 msgid "" @@ -699,15 +803,18 @@ msgstr "" "`{exec_prefix}/lib/python{X.Y}/lib-dynload` にインストールされます (*X.Y* は " "``3.2`` のような Python のバージョン番号)。" -#: ../../library/sys.rst:485 msgid "" "If a :ref:`virtual environment ` is in effect, this :data:" "`exec_prefix` will point to the virtual environment. The value for the " "Python installation will still be available, via :data:`base_exec_prefix`. " "Refer to :ref:`sys-path-init-virtual-environments` for more information." msgstr "" +":ref:`仮想環境 ` が有効な場合、:data:`exec_prefix` はその仮想環境を" +"指します。\n" +"基になる Python のインストール先の値は、引き続き :data:`base_exec_prefix` で" +"取得できます。\n" +"詳しくは :ref:`sys-path-init-virtual-environments` を参照してください。" -#: ../../library/sys.rst:492 ../../library/sys.rst:1613 msgid "" "When running under a :ref:`virtual environment `, :data:`prefix` " "and :data:`exec_prefix` are now set to the virtual environment prefix by " @@ -715,6 +822,11 @@ msgid "" "means that :data:`prefix` and :data:`exec_prefix` always point to the " "virtual environment, even when :mod:`site` is disabled (:option:`-S`)." msgstr "" +":ref:`仮想環境 ` での実行時に、:data:`prefix` と :data:" +"`exec_prefix` が :mod:`site` ではなく :ref:`パスの初期化 ` に" +"よって仮想環境のプレフィックスに設定されるようになりました。\n" +"そのため、:mod:`site` が無効でも (:option:`-S`)、:data:`prefix` と :data:" +"`exec_prefix` は常に仮想環境を指します。" #: ../../library/sys.rst:501 msgid "" @@ -728,11 +840,11 @@ msgstr "" "得できない場合、:data:`sys.executable` は空の文字列または ``None`` になりま" "す。" -#: ../../library/sys.rst:509 msgid "" "Raise a :exc:`SystemExit` exception, signaling an intention to exit the " "interpreter." msgstr "" +":exc:`SystemExit` 例外を送出し、インタープリタを終了する意図を示します。" #: ../../library/sys.rst:511 msgid "" @@ -770,22 +882,24 @@ msgid "" "an outer level." msgstr "" -#: ../../library/sys.rst:529 msgid "" "If an error occurs in the cleanup after the Python interpreter has caught :" "exc:`SystemExit` (such as an error flushing buffered data in the standard " "streams), the exit status is changed to 120." msgstr "" -"Python インタープリタが (バッファされたデータを標準ストリームに吐き出すときの" -"エラーなどの) :exc:`SystemExit` を捕捉した後の後始末でエラーが起きた場合、終" -"了ステータスは 120 に変更されます。" +"Python インタープリタが :exc:`SystemExit` を捕捉した後の後始末でエラーが起き" +"た場合、終了ステータスは 120 に変更されます。\n" +"標準ストリームのバッファにあるデータを書き出す際のエラーなどが該当します。" -#: ../../library/sys.rst:537 msgid "" "The :term:`named tuple` *flags* exposes the status of command line flags. " "Flags should only be accessed only by name and not by index. The attributes " "are read only." msgstr "" +":term:`名前付きタプル ` *flags* はコマンドラインフラグの状態を公" +"開します。\n" +"各フラグにはインデックスではなく、名前でアクセスしてください。\n" +"属性は読み出し専用です。" #: ../../library/sys.rst:544 msgid ":option:`-d`" @@ -835,43 +949,42 @@ msgstr ":option:`-q`" msgid ":option:`-R`" msgstr ":option:`-R`" -#: ../../library/sys.rst:583 msgid ":option:`-X dev <-X>` (:ref:`Python Development Mode `)" -msgstr "" +msgstr ":option:`-X dev <-X>` (:ref:`Python 開発モード `)" #: ../../library/sys.rst:586 msgid ":option:`-X utf8 <-X>`" msgstr ":option:`-X utf8 <-X>`" -#: ../../library/sys.rst:589 msgid ":option:`-P`" -msgstr "" +msgstr ":option:`-P`" -#: ../../library/sys.rst:592 msgid "" ":option:`-X int_max_str_digits <-X>` (:ref:`integer string conversion length " "limitation `)" msgstr "" +":option:`-X int_max_str_digits <-X>` (:ref:`整数文字列変換の長さ制限 " +"`)" -#: ../../library/sys.rst:596 msgid ":option:`-X warn_default_encoding <-X>`" -msgstr "" +msgstr ":option:`-X warn_default_encoding <-X>`" -#: ../../library/sys.rst:599 msgid ":option:`-X gil <-X>` and :envvar:`PYTHON_GIL`" -msgstr "" +msgstr ":option:`-X gil <-X>` と :envvar:`PYTHON_GIL`" -#: ../../library/sys.rst:602 msgid "" ":option:`-X thread_inherit_context <-X>` and :envvar:" "`PYTHON_THREAD_INHERIT_CONTEXT`" msgstr "" +":option:`-X thread_inherit_context <-X>` と :envvar:" +"`PYTHON_THREAD_INHERIT_CONTEXT`" -#: ../../library/sys.rst:606 msgid "" ":option:`-X context_aware_warnings <-X>` and :envvar:" "`PYTHON_CONTEXT_AWARE_WARNINGS`" msgstr "" +":option:`-X context_aware_warnings <-X>` と :envvar:" +"`PYTHON_CONTEXT_AWARE_WARNINGS`" #: ../../library/sys.rst:610 msgid "Added ``quiet`` attribute for the new :option:`-q` flag." @@ -899,31 +1012,27 @@ msgstr "" "新しい :ref:`Python 開発モード ` 向けに ``dev_mode`` 属性が、新し" "い :option:`-X` ``utf8`` フラグ向けに ``utf8_mode`` 属性が追加されました。" -#: ../../library/sys.rst:627 msgid "" "Added ``warn_default_encoding`` attribute for :option:`-X` " "``warn_default_encoding`` flag." msgstr "" +":option:`-X` ``warn_default_encoding`` フラグに対応する " +"``warn_default_encoding`` 属性が追加されました。" -#: ../../library/sys.rst:630 msgid "Added the ``safe_path`` attribute for :option:`-P` option." -msgstr "" +msgstr ":option:`-P` オプションに対応する ``safe_path`` 属性が追加されました。" -#: ../../library/sys.rst:633 msgid "Added the ``int_max_str_digits`` attribute." -msgstr "" +msgstr "``int_max_str_digits`` 属性が追加されました。" -#: ../../library/sys.rst:636 msgid "Added the ``gil`` attribute." -msgstr "" +msgstr "``gil`` 属性が追加されました。" -#: ../../library/sys.rst:639 msgid "Added the ``thread_inherit_context`` attribute." -msgstr "" +msgstr "``thread_inherit_context`` 属性が追加されました。" -#: ../../library/sys.rst:642 msgid "Added the ``context_aware_warnings`` attribute." -msgstr "" +msgstr "``context_aware_warnings`` 属性が追加されました。" #: ../../library/sys.rst:648 msgid "" @@ -940,9 +1049,8 @@ msgstr "" "しています。詳細は 1999 ISO/IEC C standard [C99]_ の 5.2.4.2.2 節 " "'Characteristics of floating types' を参照してください。" -#: ../../library/sys.rst:655 msgid "Attributes of the :data:`!float_info` :term:`named tuple`" -msgstr "" +msgstr ":term:`名前付きタプル ` :data:`!float_info` の属性" #: ../../library/sys.rst:658 msgid "attribute" @@ -956,143 +1064,124 @@ msgstr "float.h のマクロ" msgid "explanation" msgstr "説明" -#: ../../library/sys.rst:663 msgid ":c:macro:`!DBL_EPSILON`" -msgstr "" +msgstr ":c:macro:`!DBL_EPSILON`" -#: ../../library/sys.rst:664 msgid "" "difference between 1.0 and the least value greater than 1.0 that is " "representable as a float." -msgstr "" +msgstr "1.0 と、それより大きい float で表現可能な最小の値との差。" #: ../../library/sys.rst:667 msgid "See also :func:`math.ulp`." msgstr ":func:`math.ulp` を参照してください。" -#: ../../library/sys.rst:670 msgid ":c:macro:`!DBL_DIG`" -msgstr "" +msgstr ":c:macro:`!DBL_DIG`" -#: ../../library/sys.rst:671 msgid "" "The maximum number of decimal digits that can be faithfully represented in a " "float; see below." msgstr "" +"float で忠実に表現できる 10 進の最大桁数。\n" +"下の説明を参照してください。" -#: ../../library/sys.rst:675 msgid ":c:macro:`!DBL_MANT_DIG`" -msgstr "" +msgstr ":c:macro:`!DBL_MANT_DIG`" -#: ../../library/sys.rst:676 msgid "" "Float precision: the number of base-``radix`` digits in the significand of a " "float." msgstr "" +"float の精度。\n" +"基数を ``radix`` としたときの仮数部の桁数です。" -#: ../../library/sys.rst:680 msgid ":c:macro:`!DBL_MAX`" -msgstr "" +msgstr ":c:macro:`!DBL_MAX`" -#: ../../library/sys.rst:681 msgid "The maximum representable positive finite float." -msgstr "" +msgstr "float で表現可能な正の有限値の最大値。" -#: ../../library/sys.rst:684 msgid ":c:macro:`!DBL_MAX_EXP`" -msgstr "" +msgstr ":c:macro:`!DBL_MAX_EXP`" -#: ../../library/sys.rst:685 msgid "" "The maximum integer *e* such that ``radix**(e-1)`` is a representable finite " "float." -msgstr "" +msgstr "``radix**(e-1)`` が float で表現可能な有限値となる最大の整数 *e*。" -#: ../../library/sys.rst:689 msgid ":c:macro:`!DBL_MAX_10_EXP`" -msgstr "" +msgstr ":c:macro:`!DBL_MAX_10_EXP`" -#: ../../library/sys.rst:690 msgid "" "The maximum integer *e* such that ``10**e`` is in the range of representable " "finite floats." -msgstr "" +msgstr "``10**e`` が float で表現可能な有限値の範囲内となる最大の整数 *e*。" -#: ../../library/sys.rst:694 msgid ":c:macro:`!DBL_MIN`" -msgstr "" +msgstr ":c:macro:`!DBL_MIN`" -#: ../../library/sys.rst:695 msgid "The minimum representable positive *normalized* float." -msgstr "" +msgstr "float で表現可能な正の *正規化数* の最小値。" -#: ../../library/sys.rst:697 msgid "" "Use :func:`math.ulp(0.0) ` to get the smallest positive " "*denormalized* representable float." msgstr "" +"float で表現可能な正の *非正規化数* の最小値を得るには :func:`math.ulp(0.0) " +"` を使ってください。" -#: ../../library/sys.rst:701 msgid ":c:macro:`!DBL_MIN_EXP`" -msgstr "" +msgstr ":c:macro:`!DBL_MIN_EXP`" -#: ../../library/sys.rst:702 msgid "" "The minimum integer *e* such that ``radix**(e-1)`` is a normalized float." -msgstr "" +msgstr "``radix**(e-1)`` が正規化された float となる最小の整数 *e*。" -#: ../../library/sys.rst:706 msgid ":c:macro:`!DBL_MIN_10_EXP`" -msgstr "" +msgstr ":c:macro:`!DBL_MIN_10_EXP`" -#: ../../library/sys.rst:707 msgid "The minimum integer *e* such that ``10**e`` is a normalized float." -msgstr "" +msgstr "``10**e`` が正規化された float となる最小の整数 *e*。" -#: ../../library/sys.rst:710 msgid ":c:macro:`!FLT_RADIX`" -msgstr "" +msgstr ":c:macro:`!FLT_RADIX`" -#: ../../library/sys.rst:711 msgid "The radix of exponent representation." -msgstr "" +msgstr "指数表現の基数。" -#: ../../library/sys.rst:714 msgid ":c:macro:`!FLT_ROUNDS`" -msgstr "" +msgstr ":c:macro:`!FLT_ROUNDS`" -#: ../../library/sys.rst:715 msgid "" "An integer representing the rounding mode for floating-point arithmetic. " "This reflects the value of the system :c:macro:`!FLT_ROUNDS` macro at " "interpreter startup time:" msgstr "" +"浮動小数点演算の丸めモードを表す整数です。\n" +"インタープリタ起動時のシステムの :c:macro:`!FLT_ROUNDS` マクロの値を反映しま" +"す:" -#: ../../library/sys.rst:719 msgid "``-1``: indeterminable" -msgstr "" +msgstr "``-1``: 不定" -#: ../../library/sys.rst:720 msgid "``0``: toward zero" -msgstr "" +msgstr "``0``: ゼロ方向" -#: ../../library/sys.rst:721 msgid "``1``: to nearest" -msgstr "" +msgstr "``1``: 最近接値" -#: ../../library/sys.rst:722 msgid "``2``: toward positive infinity" -msgstr "" +msgstr "``2``: 正の無限大方向" -#: ../../library/sys.rst:723 msgid "``3``: toward negative infinity" -msgstr "" +msgstr "``3``: 負の無限大方向" -#: ../../library/sys.rst:725 msgid "" "All other values for :c:macro:`!FLT_ROUNDS` characterize implementation-" "defined rounding behavior." msgstr "" +":c:macro:`!FLT_ROUNDS` のそれ以外の値は、実装が定義する丸め動作を表します。" #: ../../library/sys.rst:728 msgid "" @@ -1102,7 +1191,6 @@ msgid "" "back again will recover a string representing the same decimal value::" msgstr "" -#: ../../library/sys.rst:734 msgid "" ">>> import sys\n" ">>> sys.float_info.dig\n" @@ -1111,6 +1199,12 @@ msgid "" ">>> format(float(s), '.15g') # convert to float and back -> same value\n" "'3.14159265358979'" msgstr "" +">>> import sys\n" +">>> sys.float_info.dig\n" +"15\n" +">>> s = '3.14159265358979' # 有効桁数 15 桁の 10 進文字列\n" +">>> format(float(s), '.15g') # float に変換してから戻すと同じ値になる。\n" +"'3.14159265358979'" #: ../../library/sys.rst:741 msgid "" @@ -1120,12 +1214,14 @@ msgstr "" "ただし、文字列が有効桁数 :attr:`sys.float_info.dig` より大きい場合には、常に" "復元されるとは限りません::" -#: ../../library/sys.rst:744 msgid "" ">>> s = '9876543211234567' # 16 significant digits is too many!\n" ">>> format(float(s), '.16g') # conversion changes value\n" "'9876543211234568'" msgstr "" +">>> s = '9876543211234567' # 有効桁数 16 桁は多すぎる!\n" +">>> format(float(s), '.16g') # 変換で値が変わる。\n" +"'9876543211234568'" #: ../../library/sys.rst:750 msgid "" @@ -1143,7 +1239,6 @@ msgstr "" "``float_repr_style`` は値 ``'legacy'`` を持ち、``repr(x)`` は 3.1 以前のバー" "ジョンの Python と同じように振る舞います。" -#: ../../library/sys.rst:763 msgid "" "Return the number of memory blocks currently allocated by the interpreter, " "regardless of their size. This function is mainly useful for tracking and " @@ -1152,38 +1247,50 @@ msgid "" "`_clear_internal_caches` and :func:`gc.collect` to get more predictable " "results." msgstr "" +"インタープリタが現在割り当てているメモリブロックの数を、サイズによらず返しま" +"す。\n" +"主にメモリリークの追跡やデバッグに役立ちます。\n" +"インタープリタの内部キャッシュにより結果は呼び出しごとに変わり得るため、より" +"予測しやすい結果を得るには :func:`_clear_internal_caches` と :func:`gc." +"collect` を呼び出す必要があることがあります。" -#: ../../library/sys.rst:770 msgid "" "If a Python build or implementation cannot reasonably compute this " "information, :func:`getallocatedblocks` is allowed to return 0 instead." msgstr "" +"Python のビルドや実装によって、この情報を妥当な方法で計算できない場合、:func:" +"`getallocatedblocks` は代わりに 0 を返しても構いません。" -#: ../../library/sys.rst:778 msgid "Return the number of unicode objects that have been interned." -msgstr "" +msgstr "インターンされた Unicode オブジェクトの数を返します。" -#: ../../library/sys.rst:785 msgid "" "Return the build-time API level of Android as an integer. This represents " "the minimum version of Android this build of Python can run on. For runtime " "version information, see :func:`platform.android_ver`." msgstr "" +"ビルド時の Android API レベルを整数として返します。\n" +"この Python ビルドを実行できる Android の最小バージョンを表します。\n" +"実行時のバージョン情報については :func:`platform.android_ver` を参照してくだ" +"さい。" -#: ../../library/sys.rst:796 msgid "" "Return ``'utf-8'``. This is the name of the default string encoding, used in " "methods like :meth:`str.encode`." msgstr "" +"``'utf-8'`` を返します。\n" +":meth:`str.encode` などのメソッドで使うデフォルトの文字列エンコーディングの名" +"前です。" -#: ../../library/sys.rst:802 msgid "" "Return the current value of the flags that are used for :c:func:`dlopen` " "calls. Symbolic names for the flag values can be found in the :mod:`os` " "module (:samp:`RTLD_{xxx}` constants, e.g. :const:`os.RTLD_LAZY`)." msgstr "" +":c:func:`dlopen` 呼び出しに使うフラグの現在の値を返します。\n" +"フラグの値を表すシンボル名は :mod:`os` モジュールにあります (:const:`os." +"RTLD_LAZY` などの :samp:`RTLD_{xxx}` 定数)。" -#: ../../library/sys.rst:812 msgid "" "Get the :term:`filesystem encoding `: " "the encoding used with the :term:`filesystem error handler ` を取得します。\n" +"これは、Unicode のファイル名とバイト列のファイル名を相互に変換するために、:" +"term:`ファイルシステムエラーハンドラ ` とともに使うエンコーディングです。\n" +"ファイルシステムエラーハンドラは :func:`getfilesystemencodeerrors` が返しま" +"す。" #: ../../library/sys.rst:818 msgid "" @@ -1219,6 +1333,11 @@ msgid "" "filesystem_encoding` and :c:member:`~PyConfig.filesystem_errors` members of :" "c:type:`PyConfig`." msgstr "" +":term:`ファイルシステムのエンコーディングとエラーハンドラ ` は、Python の開始時に :c:func:`PyConfig_Read` 関" +"数により設定されます。 :c:type:`PyConfig` のメンバー :c:member:`~PyConfig." +"filesystem_encoding` と :c:member:`~PyConfig.filesystem_errors` を参照してく" +"ださい。" #: ../../library/sys.rst:831 msgid ":func:`getfilesystemencoding` result cannot be ``None`` anymore." @@ -1240,7 +1359,6 @@ msgid "" msgstr "" ":ref:`Python UTF-8 モード ` が有効なら ``\"utf-8\"`` を返します。" -#: ../../library/sys.rst:845 msgid "" "Get the :term:`filesystem error handler `: the error handler used with the :term:`filesystem encoding " @@ -1248,12 +1366,19 @@ msgid "" "filenames and bytes filenames. The filesystem encoding is returned from :" "func:`getfilesystemencoding`." msgstr "" +":term:`ファイルシステムエラーハンドラ ` を取得します。\n" +"これは、Unicode のファイル名とバイト列のファイル名を相互に変換するために、:" +"term:`ファイルシステムエンコーディング ` とともに使うエラーハンドラです。\n" +"ファイルシステムエンコーディングは :func:`getfilesystemencoding` が返します。" -#: ../../library/sys.rst:863 msgid "" "Returns the current value for the :ref:`integer string conversion length " "limitation `. See also :func:`set_int_max_str_digits`." msgstr "" +":ref:`整数文字列変換の長さ制限 ` の現在の値を返します。\n" +":func:`set_int_max_str_digits` も参照してください。" #: ../../library/sys.rst:870 msgid "" @@ -1277,17 +1402,18 @@ msgstr "" "`immortal`) であり、実際の参照の数を反映しない非常に高い参照数を持ちます。し" "たがって、 0 か 1 の値以外では、正確な戻り値に頼らないでください。" -#: ../../library/sys.rst:882 msgid "" ":term:`Immortal ` objects with a large reference count can be " "identified via :func:`_is_immortal`." msgstr "" +"参照カウントが大きい :term:`永続 ` オブジェクトは、:func:" +"`_is_immortal` で識別できます。" -#: ../../library/sys.rst:885 msgid "" "Immortal objects have very large refcounts that do not match the actual " "number of references to the object." msgstr "" +"永続オブジェクトの参照カウントは非常に大きく、実際の参照数とは一致しません。" #: ../../library/sys.rst:891 msgid "" @@ -1327,29 +1453,32 @@ msgstr "" "オブジェクトがサイズを取得する手段を提供していない時は *default* が返されま" "す。*default* が指定されていない場合は :exc:`TypeError` が送出されます。" -#: ../../library/sys.rst:910 msgid "" ":func:`getsizeof` calls the object's ``__sizeof__`` method and adds an " "additional garbage collector overhead if the object is managed by the " "garbage collector." msgstr "" -":func:`getsizeof` は *object* の ``__sizeof__`` メソッドを呼び出し、そのオブ" -"ジェクトがガベージコレクタに管理されていた場合はガベージコレクタのオーバー" -"ヘッドを増やします。" +":func:`getsizeof` はオブジェクトの ``__sizeof__`` メソッドを呼び出します。\n" +"オブジェクトがガベージコレクタに管理されている場合は、ガベージコレクタの管理" +"に必要な追加のメモリ量を結果に加算します。" -#: ../../library/sys.rst:914 msgid "" "See `recursive sizeof recipe `_ for an example of " "using :func:`getsizeof` recursively to find the size of containers and all " "their contents." msgstr "" +"コンテナとその内容すべてのサイズを調べるために :func:`getsizeof` を再帰的に使" +"う例は、`recursive sizeof recipe `_ を参照" +"してください。" -#: ../../library/sys.rst:920 msgid "" "Return the interpreter's \"thread switch interval\" in seconds; see :func:" "`setswitchinterval`." msgstr "" +"インタープリタの「スレッド切り替え間隔」を秒単位で返します。\n" +":func:`setswitchinterval` を参照してください。" #: ../../library/sys.rst:928 msgid "" @@ -1365,13 +1494,12 @@ msgstr "" "す。 *depth* のデフォルト値は 0 で、この場合はコールスタックのトップのフレー" "ムを返します。" -#: ../../library/sys.rst:933 msgid "" "Raises an :ref:`auditing event ` ``sys._getframe`` with argument " "``frame``." msgstr "" "引数 ``frame`` で :ref:`監査イベント ` ``sys._getframe`` を送出しま" -"す。 " +"す。" #: ../../library/sys.rst:937 ../../library/sys.rst:953 msgid "" @@ -1381,7 +1509,6 @@ msgstr "" "この関数は、内部的かつ特殊な目的にのみ利用されるべきです。全ての Python 実装" "で存在することが保証されているわけではありません。" -#: ../../library/sys.rst:943 msgid "" "Return the name of a module from the call stack. If optional integer " "*depth* is given, return the module that many calls below the top of the " @@ -1389,27 +1516,38 @@ msgid "" "unidentifiable, ``None`` is returned. The default for *depth* is zero, " "returning the module at the top of the call stack." msgstr "" +"コールスタックからモジュール名を返します。\n" +"省略可能な整数 *depth* を指定すると、スタックの先頭からその回数だけ呼び出しを" +"さかのぼった位置のモジュールを返します。\n" +"コールスタックより深い位置を指定した場合や、モジュールを識別できない場合は " +"``None`` を返します。\n" +"*depth* のデフォルトはゼロで、コールスタックの先頭のモジュールを返します。" -#: ../../library/sys.rst:949 msgid "" "Raises an :ref:`auditing event ` ``sys._getframemodulename`` with " "argument ``depth``." msgstr "" +"引数 ``depth`` を持つ :ref:`監査イベント ` ``sys." +"_getframemodulename`` を発生させます。" -#: ../../library/sys.rst:959 msgid "" "This function only exists if CPython was built using the specialized " "configure option :option:`--with-trace-refs`. It is intended only for " "debugging garbage-collection issues." msgstr "" +"この関数は、特殊な configure オプション :option:`--with-trace-refs` を使って " +"CPython をビルドした場合にだけ存在します。\n" +"ガベージコレクションの問題をデバッグするためだけのものです。" -#: ../../library/sys.rst:963 msgid "" "Return a list of up to *limit* dynamically allocated Python objects. If " "*type* is given, only objects of that exact type (not subtypes) are included." msgstr "" +"動的に割り当てられた Python オブジェクトを最大 *limit* 個含むリストを返しま" +"す。\n" +"*type* を指定した場合、その型に正確に一致するオブジェクトだけを含めます (サブ" +"タイプは含みません)。" -#: ../../library/sys.rst:967 msgid "" "Objects from the list are not safe to use. Specifically, the result will " "include objects from all interpreters that share their object allocator " @@ -1418,16 +1556,24 @@ msgid "" "ref:`main interpreter `). Mixing objects from " "different interpreters may lead to crashes or other unexpected behavior." msgstr "" +"このリスト内のオブジェクトを使うのは安全ではありません。\n" +"特に、結果にはオブジェクトアロケータの状態を共有するすべてのインタープリタの" +"オブジェクトが含まれます。\n" +"具体的には、:c:member:`PyInterpreterConfig.use_main_obmalloc` を 1 にして作成" +"したインタープリタ、:c:func:`Py_NewInterpreter` で作成したインタープリタ、お" +"よび :ref:`メインインタープリタ ` です。\n" +"異なるインタープリタのオブジェクトを混在させると、クラッシュや予期しない動作" +"につながることがあります。" -#: ../../library/sys.rst:978 ../../library/sys.rst:1370 msgid "" "This function should be used for specialized purposes only. It is not " "guaranteed to exist in all implementations of Python." msgstr "" +"この関数は特殊な目的にだけ使ってください。\n" +"すべての Python 実装に存在する保証はありません。" -#: ../../library/sys.rst:983 msgid "The result may include objects from other interpreters." -msgstr "" +msgstr "結果に、ほかのインタープリタのオブジェクトが含まれることがあります。" #: ../../library/sys.rst:992 msgid "Get the profiler function as set by :func:`setprofile`." @@ -1471,9 +1617,8 @@ msgstr "" "先行のバージョンとの互換性のため、最初の 5 要素のみが添字の指定で取得できま" "す。" -#: ../../library/sys.rst:1024 msgid "*platform* will be ``2`` (VER_PLATFORM_WIN32_NT)." -msgstr "" +msgstr "*platform* は ``2`` (VER_PLATFORM_WIN32_NT) です。" #: ../../library/sys.rst:1026 msgid "*product_type* may be one of the following values:" @@ -1487,36 +1632,35 @@ msgstr "定数" msgid "Meaning" msgstr "意味" -#: ../../library/sys.rst:1031 msgid "``1`` (VER_NT_WORKSTATION)" -msgstr "" +msgstr "``1`` (VER_NT_WORKSTATION)" #: ../../library/sys.rst:1031 msgid "The system is a workstation." msgstr "システムはワークステーションです。" -#: ../../library/sys.rst:1033 msgid "``2`` (VER_NT_DOMAIN_CONTROLLER)" -msgstr "" +msgstr "``2`` (VER_NT_DOMAIN_CONTROLLER)" #: ../../library/sys.rst:1033 msgid "The system is a domain controller." msgstr "システムはドメインコントローラです。" -#: ../../library/sys.rst:1036 msgid "``3`` (VER_NT_SERVER)" -msgstr "" +msgstr "``3`` (VER_NT_SERVER)" #: ../../library/sys.rst:1036 msgid "The system is a server, but not a domain controller." msgstr "システムはサーバですが、ドメインコントローラではありません。" -#: ../../library/sys.rst:1040 msgid "" "This function wraps the Win32 :c:func:`!GetVersionEx` function; see the " "Microsoft documentation on :c:func:`!OSVERSIONINFOEX` for more information " "about these fields." msgstr "" +"この関数は Win32 の :c:func:`!GetVersionEx` 関数をラップします。\n" +"各フィールドについて詳しくは、Microsoft の :c:func:`!OSVERSIONINFOEX` のド" +"キュメントを参照してください。" #: ../../library/sys.rst:1044 msgid "" @@ -1530,12 +1674,14 @@ msgstr "" "ナンバーを返します。\n" "この関数は機能の検知ではなくロギングで使うためのものです。" -#: ../../library/sys.rst:1050 msgid "" "*platform_version* derives the version from kernel32.dll which can be of a " "different version than the OS version. Please use :mod:`platform` module for " "achieving accurate OS version." msgstr "" +"*platform_version* は kernel32.dll からバージョンを取得しますが、そのバージョ" +"ンは OS のバージョンと異なることがあります。\n" +"正確な OS のバージョンを得るには :mod:`platform` モジュールを使ってください。" #: ../../library/sys.rst:1056 msgid "" @@ -1549,7 +1695,6 @@ msgstr "" msgid "Added *platform_version*" msgstr "*platform_version* の追加" -#: ../../library/sys.rst:1066 msgid "" "Returns an *asyncgen_hooks* object, which is similar to a :class:" "`~collections.namedtuple` of the form ``(firstiter, finalizer)``, where " @@ -1558,33 +1703,37 @@ msgid "" "are used to schedule finalization of an asynchronous generator by an event " "loop." msgstr "" -"*asyncgen_hooks* オブジェクトを返します。このオブジェクトは ``(firstiter, " -"finalizer)`` という形の :class:`~collections.namedtuple` に似た形をしていま" -"す。 *firstiter* と *finalizer* は両方とも ``None`` か、 :term:`asynchronous " -"generator iterator` を引数に取る関数と、イベントループが非同期ジェネレータの" -"終了処理をスケジューリングするのに使う関数であることが求められます。" +"*asyncgen_hooks* オブジェクトを返します。\n" +"これは ``(firstiter, finalizer)`` という形の :class:`~collections." +"namedtuple` に似たオブジェクトです。\n" +"*firstiter* と *finalizer* は、それぞれ ``None`` または :term:`非同期ジェネ" +"レータイテレータ ` を引数に取る関数であるこ" +"とを想定しています。\n" +"これらは、イベントループが非同期ジェネレータの終了処理をスケジュールするため" +"に使います。" #: ../../library/sys.rst:1073 msgid "See :pep:`525` for more details." msgstr "より詳しくは :pep:`525` を参照してください。" -#: ../../library/sys.rst:1077 ../../library/sys.rst:1860 msgid "" "This function has been added on a provisional basis (see :pep:`411` for " "details.)" -msgstr "" +msgstr "この関数は暫定的に追加されました (詳しくは :pep:`411` を参照)。" -#: ../../library/sys.rst:1083 msgid "" "Get the current coroutine origin tracking depth, as set by :func:" "`set_coroutine_origin_tracking_depth`." msgstr "" +":func:`set_coroutine_origin_tracking_depth` で設定した、現在のコルーチン生成" +"元の追跡の深さを取得します。" -#: ../../library/sys.rst:1089 ../../library/sys.rst:1881 msgid "" "This function has been added on a provisional basis (see :pep:`411` for " "details.) Use it only for debugging purposes." msgstr "" +"この関数は暫定的に追加されました (詳しくは :pep:`411` を参照)。\n" +"デバッグ目的でのみ使ってください。" #: ../../library/sys.rst:1095 msgid "" @@ -1594,54 +1743,45 @@ msgstr "" "数値のハッシュ実装のパラメータを与える :term:`named tuple` です。数値型のハッ" "シュ化についての詳細は :ref:`numeric-hash` を参照してください。" -#: ../../library/sys.rst:1101 msgid "The width in bits used for hash values" -msgstr "" +msgstr "ハッシュ値に使うビット幅。" -#: ../../library/sys.rst:1105 msgid "The prime modulus P used for numeric hash scheme" -msgstr "" +msgstr "数値のハッシュ計算で剰余の法として使う素数 P。" -#: ../../library/sys.rst:1109 msgid "The hash value returned for a positive infinity" -msgstr "" +msgstr "正の無限大に対して返すハッシュ値。" -#: ../../library/sys.rst:1113 msgid "(This attribute is no longer used)" -msgstr "" +msgstr "(この属性は現在使われていません)" -#: ../../library/sys.rst:1117 msgid "The multiplier used for the imaginary part of a complex number" -msgstr "" +msgstr "複素数の虚部に使う乗数。" -#: ../../library/sys.rst:1121 msgid "The name of the algorithm for hashing of str, bytes, and memoryview" -msgstr "" +msgstr "str、bytes、memoryview のハッシュに使うアルゴリズムの名前。" -#: ../../library/sys.rst:1125 msgid "The internal output size of the hash algorithm" -msgstr "" +msgstr "ハッシュアルゴリズムの内部の出力サイズ。" -#: ../../library/sys.rst:1129 msgid "The size of the seed key of the hash algorithm" -msgstr "" +msgstr "ハッシュアルゴリズムのシードキーのサイズ。" #: ../../library/sys.rst:1133 msgid "Added *algorithm*, *hash_bits* and *seed_bits*" msgstr "*algorithm*、*hash_bits*、*seed_bits* を追加" -#: ../../library/sys.rst:1139 msgid "" "The version number encoded as a single integer. This is guaranteed to " "increase with each version, including proper support for non-production " "releases. For example, to test that the Python interpreter is at least " "version 1.5.2, use::" msgstr "" -"単精度整数にエンコードされたバージョン番号。この値は新バージョン(正規リリース" -"以外であっても)ごとにかならず増加します。例えば、Python 1.5.2 以降でのみ動作" -"するプログラムでは、以下のようなチェックを行います。 ::" +"一つの整数にエンコードされたバージョン番号。\n" +"この値は新バージョン(正規リリース以外であっても)ごとにかならず増加します。\n" +"例えば、Python 1.5.2 以降でのみ動作するプログラムでは、以下のようなチェックを" +"行います。 ::" -#: ../../library/sys.rst:1143 msgid "" "if sys.hexversion >= 0x010502F0:\n" " # use some advanced feature\n" @@ -1650,17 +1790,23 @@ msgid "" " # use an alternative implementation or warn the user\n" " ..." msgstr "" +"if sys.hexversion >= 0x010502F0:\n" +" # 新しい機能を使う。\n" +" ...\n" +"else:\n" +" # 代替実装を使うか、利用者に警告する。\n" +" ..." -#: ../../library/sys.rst:1150 msgid "" "This is called ``hexversion`` since it only really looks meaningful when " "viewed as the result of passing it to the built-in :func:`hex` function. " "The :term:`named tuple` :data:`sys.version_info` may be used for a more " "human-friendly encoding of the same information." msgstr "" -"``hexversion`` は :func:`hex` 関数を使って 16 進数に変換しなければ値の意味を" -"持ちません。より読みやすいバージョン番号が必要な場合には :term:`named " -"tuple` :data:`sys.version_info` を使用してください。" +"組み込み関数 :func:`hex` に渡した結果として表示すると意味が分かるため、" +"``hexversion`` と呼ばれています。\n" +"同じ情報をより人間に読みやすい形式で取得するには、:term:`named tuple` の :" +"data:`sys.version_info` を使用できます。" #: ../../library/sys.rst:1155 msgid "More details of ``hexversion`` can be found at :ref:`apiabiversion`." @@ -1745,11 +1891,12 @@ msgstr "" "のバージョン間についてはその限りではありません)。詳細は :pep:`421` を参照して" "ください。" -#: ../../library/sys.rst:1199 msgid "" "The addition of new required attributes must go through the normal PEP " "process. See :pep:`421` for more information." msgstr "" +"必須の属性を新しく追加するには、通常の PEP の手続きを経る必要があります。\n" +"詳しくは :pep:`421` を参照してください。" #: ../../library/sys.rst:1204 msgid "" @@ -1759,33 +1906,37 @@ msgstr "" "Python における整数の内部表現に関する情報を保持する、:term:`named tuple` で" "す。この属性は読み出し専用です。" -#: ../../library/sys.rst:1209 msgid "" "The number of bits held in each digit. Python integers are stored internally " "in base ``2**int_info.bits_per_digit``." msgstr "" +"各桁に格納するビット数です。\n" +"Python の整数は内部的に ``2**int_info.bits_per_digit`` を基数として格納されま" +"す。" -#: ../../library/sys.rst:1214 msgid "The size in bytes of the C type used to represent a digit." -msgstr "" +msgstr "1 桁を表すために使う C の型のサイズ (バイト単位) です。" -#: ../../library/sys.rst:1218 msgid "" "The default value for :func:`sys.get_int_max_str_digits` when it is not " "otherwise explicitly configured." msgstr "" +"明示的に設定していない場合の :func:`sys.get_int_max_str_digits` のデフォルト" +"値です。" -#: ../../library/sys.rst:1223 msgid "" "The minimum non-zero value for :func:`sys.set_int_max_str_digits`, :envvar:" "`PYTHONINTMAXSTRDIGITS`, or :option:`-X int_max_str_digits <-X>`." msgstr "" +":func:`sys.set_int_max_str_digits`、:envvar:`PYTHONINTMAXSTRDIGITS`、:option:" +"`-X int_max_str_digits <-X>` に指定できる、ゼロ以外の最小値です。" -#: ../../library/sys.rst:1230 msgid "" "Added :attr:`~int_info.default_max_str_digits` and :attr:`~int_info." "str_digits_check_threshold`." msgstr "" +":attr:`~int_info.default_max_str_digits` と :attr:`~int_info." +"str_digits_check_threshold` が追加されました。" #: ../../library/sys.rst:1236 msgid "" @@ -1801,13 +1952,13 @@ msgstr "" "ることが出来ます。:mod:`site` モジュールで :ref:`設定します `。" -#: ../../library/sys.rst:1242 ../../library/sys.rst:1244 msgid "" "Raises an :ref:`auditing event ` ``cpython.run_interactivehook`` " "with the hook object as the argument when the hook is called on startup." msgstr "" +"起動時にフックを呼び出す際、フックオブジェクトを引数とする :ref:`監査イベン" +"ト ` ``cpython.run_interactivehook`` を発生させます。" -#: ../../library/sys.rst:1253 msgid "" "Enter *string* in the table of \"interned\" strings and return the interned " "string -- which is *string* itself or a copy. Interning strings is useful to " @@ -1818,13 +1969,13 @@ msgid "" "interned, and the dictionaries used to hold module, class or instance " "attributes have interned keys." msgstr "" -"*string* を \"隔離\" された文字列のテーブルに入力し、隔離された文字列を返しま" -"す -- この文字列は *string* 自体かコピーです。隔離された文字列は辞書検索のパ" -"フォーマンスを少しだけ向上させるのに有効です -- 辞書中のキーが隔離されてお" -"り、検索するキーが隔離されている場合、(ハッシュ化後の) キーの比較は文字列の比" -"較ではなくポインタの比較で行うことができるからです。通常、Python プログラム内" -"で利用されている名前は自動的に隔離され、モジュール、クラス、またはインスタン" -"ス属性を保持するための辞書は隔離されたキーを持っています。" +"*string* を「インターンされた」文字列のテーブルに登録し、インターンされた文字" +"列 (*string* 自体またはそのコピー) を返します。\n" +"文字列のインターンは、辞書の検索性能を少し向上させるのに役立ちます。\n" +"辞書のキーと検索に使うキーの両方がインターンされていれば、ハッシュ計算後の" +"キーの比較を文字列の比較ではなくポインタの比較で行えるためです。\n" +"通常、Python プログラムで使う名前は自動的にインターンされ、モジュール、クラ" +"ス、インスタンスの属性を保持する辞書のキーもインターンされています。" #: ../../library/sys.rst:1261 msgid "" @@ -1832,46 +1983,50 @@ msgid "" "return value of :func:`intern` around to benefit from it." msgstr "" -#: ../../library/sys.rst:1267 msgid "" "Return :const:`True` if the :term:`GIL` is enabled and :const:`False` if it " "is disabled." msgstr "" +":term:`GIL` が有効なら :const:`True`、無効なら :const:`False` を返します。" -#: ../../library/sys.rst:1274 ../../library/sys.rst:1382 msgid "It is not guaranteed to exist in all implementations of Python." -msgstr "" +msgstr "すべての Python 実装に存在する保証はありません。" -#: ../../library/sys.rst:1278 msgid "" "Return :const:`True` if the main Python interpreter is :term:`shutting down " "`. Return :const:`False` otherwise." msgstr "" +"メインの Python インタープリタが :term:`終了処理中 ` な" +"ら :const:`True` を返します。\n" +"それ以外の場合は :const:`False` を返します。" -#: ../../library/sys.rst:1281 msgid "See also the :exc:`PythonFinalizationError` exception." -msgstr "" +msgstr ":exc:`PythonFinalizationError` 例外も参照してください。" -#: ../../library/sys.rst:1287 msgid "Utilities for observing just-in-time compilation." -msgstr "" +msgstr "実行時コンパイル (JIT コンパイル) の状態を調べるための機能です。" -#: ../../library/sys.rst:1291 msgid "" "JIT compilation is an *experimental implementation detail* of CPython. ``sys." "_jit`` is not guaranteed to exist or behave the same way in all Python " "implementations, versions, or build configurations." msgstr "" +"JIT コンパイルは CPython の *実験的な実装の詳細* です。\n" +"``sys._jit`` は、すべての Python の実装、バージョン、ビルド構成に存在する保証" +"も、同じ動作をする保証もありません。" -#: ../../library/sys.rst:1299 msgid "" "Return ``True`` if the current Python executable supports JIT compilation, " "and ``False`` otherwise. This can be controlled by building CPython with " "the ``--experimental-jit`` option on Windows, and the :option:`--enable-" "experimental-jit` option on all other platforms." msgstr "" +"現在の Python 実行ファイルが JIT コンパイルに対応していれば ``True``、そうで" +"なければ ``False`` を返します。\n" +"Windows では ``--experimental-jit``、それ以外のすべてのプラットフォームでは :" +"option:`--enable-experimental-jit` オプションを使って CPython をビルドするこ" +"とで制御できます。" -#: ../../library/sys.rst:1306 msgid "" "Return ``True`` if JIT compilation is enabled for the current Python process " "(implies :func:`sys._jit.is_available`), and ``False`` otherwise. If JIT " @@ -1879,28 +2034,37 @@ msgid "" "`PYTHON_JIT` environment variable to ``0`` (disabled) or ``1`` (enabled) at " "interpreter startup." msgstr "" +"現在の Python プロセスで JIT コンパイルが有効なら ``True``、そうでなければ " +"``False`` を返します (有効なら :func:`sys._jit.is_available` も真です)。\n" +"JIT コンパイルを利用できる場合、インタープリタ起動時に環境変数 :envvar:" +"`PYTHON_JIT` を ``0`` (無効) または ``1`` (有効) に設定して制御できます。" -#: ../../library/sys.rst:1314 msgid "" "Return ``True`` if the topmost Python frame is currently executing JIT code " "(implies :func:`sys._jit.is_enabled`), and ``False`` otherwise." msgstr "" +"最上位の Python フレームが現在 JIT コードを実行していれば ``True``、そうでな" +"ければ ``False`` を返します (実行していれば :func:`sys._jit.is_enabled` も真" +"です)。" -#: ../../library/sys.rst:1319 msgid "" "This function is intended for testing and debugging the JIT itself. It " "should be avoided for any other purpose." msgstr "" +"この関数は JIT 自体のテストとデバッグ用です。\n" +"ほかの目的では使わないでください。" -#: ../../library/sys.rst:1324 msgid "" "Due to the nature of tracing JIT compilers, repeated calls to this function " "may give surprising results. For example, branching on its return value will " "likely lead to unexpected behavior (if doing so causes JIT code to be " "entered or exited):" msgstr "" +"トレーシング JIT コンパイラの性質上、この関数を繰り返し呼び出すと予想外の結果" +"になることがあります。\n" +"例えば、戻り値によって分岐し、その分岐が JIT コードへの移行や JIT コードから" +"の離脱を引き起こす場合は、予期しない動作につながりやすくなります:" -#: ../../library/sys.rst:1329 msgid "" ">>> for warmup in range(BIG_NUMBER):\n" "... # This line is \"hot\", and is eventually JIT-compiled:\n" @@ -1914,8 +2078,18 @@ msgid "" " ~~~~~~~~~~~~~~~~~~^^\n" "AssertionError" msgstr "" +">>> for warmup in range(BIG_NUMBER):\n" +"... # この行は頻繁に実行され、やがて JIT コンパイルされる。\n" +"... if sys._jit.is_active():\n" +"... # この行はめったに実行されず、インタープリタで実行される。\n" +"... assert sys._jit.is_active()\n" +"...\n" +"Traceback (most recent call last):\n" +" File \"\", line 5, in \n" +" assert sys._jit.is_active()\n" +" ~~~~~~~~~~~~~~~~~~^^\n" +"AssertionError" -#: ../../library/sys.rst:1345 msgid "" "This variable is not always defined; it is set to the exception instance " "when an exception is not handled and the interpreter prints an error message " @@ -1925,32 +2099,46 @@ msgid "" "pdb; pdb.pm()`` to enter the post-mortem debugger; see :mod:`pdb` module for " "more information.)" msgstr "" +"この変数は常に定義されているわけではありません。\n" +"例外が処理されず、インタープリタがエラーメッセージとスタックのトレースバック" +"を表示したとき、その例外インスタンスが設定されます。\n" +"対話的な利用者が、エラーを起こしたコマンドを再実行せずにデバッガモジュールを" +"インポートして、事後デバッグを始められるようにするためのものです。\n" +"典型的には ``import pdb; pdb.pm()`` で事後デバッガに入ります。\n" +"詳しくは :mod:`pdb` モジュールを参照してください。" -#: ../../library/sys.rst:1357 msgid "" "Return :const:`True` if the given object is :term:`immortal`, :const:`False` " "otherwise." msgstr "" +"指定したオブジェクトが :term:`永続 ` なら :const:`True`、そうでなけ" +"れば :const:`False` を返します。" -#: ../../library/sys.rst:1362 msgid "" "Objects that are immortal (and thus return ``True`` upon being passed to " "this function) are not guaranteed to be immortal in future versions, and " "vice versa for mortal objects." msgstr "" +"永続オブジェクト (この関数に渡すと ``True`` を返すオブジェクト) が将来のバー" +"ジョンでも永続である保証はありません。\n" +"逆に、永続でないオブジェクトが将来も永続でない保証もありません。" -#: ../../library/sys.rst:1375 msgid "" "Return :const:`True` if the given string is \"interned\", :const:`False` " "otherwise." msgstr "" +"指定した文字列が「インターンされている」なら :const:`True`、そうでなければ :" +"const:`False` を返します。" -#: ../../library/sys.rst:1389 msgid "" "These three variables are deprecated; use :data:`sys.last_exc` instead. They " "hold the legacy representation of ``sys.last_exc``, as returned from :func:" "`exc_info` above." msgstr "" +"これら 3 つの変数は非推奨です。\n" +"代わりに :data:`sys.last_exc` を使ってください。\n" +"これらは、前述の :func:`exc_info` が返すような旧形式で ``sys.last_exc`` を保" +"持します。" #: ../../library/sys.rst:1395 msgid "" @@ -1980,7 +2168,6 @@ msgstr "" "らを指定したかによって、 ``sys.maxunicode`` の値は ``0xFFFF`` が " "``0x10FFFF`` になっていました。" -#: ../../library/sys.rst:1413 msgid "" "A list of :term:`meta path finder` objects that have their :meth:`~importlib." "abc.MetaPathFinder.find_spec` methods called to see if one of the objects " @@ -1992,41 +2179,55 @@ msgid "" "passed in as a second argument. The method returns a :term:`module spec`, or " "``None`` if the module cannot be found." msgstr "" +":term:`メタパスファインダ ` オブジェクトのリストです。\n" +"各オブジェクトの :meth:`~importlib.abc.MetaPathFinder.find_spec` メソッドを呼" +"び出し、インポートするモジュールを見つけられるか調べます。\n" +"デフォルトでは、Python の標準のインポート動作を実装する項目が入っています。\n" +":meth:`~importlib.abc.MetaPathFinder.find_spec` には、少なくともインポート対" +"象のモジュールの絶対名を渡します。\n" +"モジュールがパッケージ内にある場合は、親パッケージの :attr:`~module." +"__path__` 属性を第 2 引数として渡します。\n" +"このメソッドは :term:`モジュール仕様 ` を返し、モジュールが見つ" +"からなければ ``None`` を返します。" #: ../../library/sys.rst:1426 msgid ":class:`importlib.abc.MetaPathFinder`" msgstr ":class:`importlib.abc.MetaPathFinder`" -#: ../../library/sys.rst:1427 msgid "" "The abstract base class defining the interface of finder objects on :data:" "`meta_path`." msgstr "" +":data:`meta_path` 上のファインダオブジェクトのインターフェースを定義する抽象" +"基底クラスです。" #: ../../library/sys.rst:1429 msgid ":class:`importlib.machinery.ModuleSpec`" msgstr ":class:`importlib.machinery.ModuleSpec`" -#: ../../library/sys.rst:1430 msgid "" "The concrete class which :meth:`~importlib.abc.MetaPathFinder.find_spec` " "should return instances of." msgstr "" +":meth:`~importlib.abc.MetaPathFinder.find_spec` がインスタンスを返すべき具象" +"クラスです。" -#: ../../library/sys.rst:1436 msgid "" ":term:`Module specs ` were introduced in Python 3.4, by :pep:" "`451`." msgstr "" +":term:`モジュール仕様 ` は、:pep:`451` によって Python 3.4 で導" +"入されました。" -#: ../../library/sys.rst:1441 msgid "" "Removed the fallback that looked for a :meth:`!find_module` method if a :" "data:`meta_path` entry didn't have a :meth:`~importlib.abc.MetaPathFinder." "find_spec` method." msgstr "" +":data:`meta_path` の項目に :meth:`~importlib.abc.MetaPathFinder.find_spec` メ" +"ソッドがない場合に :meth:`!find_module` メソッドを探す代替処理を削除しまし" +"た。" -#: ../../library/sys.rst:1447 msgid "" "This is a dictionary that maps module names to modules which have already " "been loaded. This can be manipulated to force reloading of modules and " @@ -2037,20 +2238,30 @@ msgid "" "size may change during iteration as a side effect of code or activity in " "other threads." msgstr "" +"モジュール名を、ロード済みのモジュールに対応付ける辞書です。\n" +"これを操作して、モジュールを強制的に再ロードするなどの処理ができます。\n" +"ただし、辞書自体を置き換えても期待どおりに動くとは限らず、必須の項目を削除す" +"ると Python が動作しなくなることがあります。\n" +"このグローバルな辞書を反復処理する場合は、常に ``sys.modules.copy()`` または " +"``tuple(sys.modules)`` を使ってください。\n" +"コードの副作用や別のスレッドの動作によって反復処理中にサイズが変わり、例外が" +"発生することを避けるためです。" -#: ../../library/sys.rst:1459 msgid "" "The list of the original command line arguments passed to the Python " "executable." -msgstr "" +msgstr "Python の実行ファイルに渡された、元のコマンドライン引数のリストです。" -#: ../../library/sys.rst:1462 msgid "" "The elements of :data:`sys.orig_argv` are the arguments to the Python " "interpreter, while the elements of :data:`sys.argv` are the arguments to the " "user's program. Arguments consumed by the interpreter itself will be present " "in :data:`sys.orig_argv` and missing from :data:`sys.argv`." msgstr "" +":data:`sys.orig_argv` の要素は Python インタープリタへの引数で、:data:`sys." +"argv` の要素は利用者のプログラムへの引数です。\n" +"インタープリタ自体が消費する引数は :data:`sys.orig_argv` に含まれ、:data:" +"`sys.argv` には含まれません。" #: ../../library/sys.rst:1474 msgid "" @@ -2061,35 +2272,43 @@ msgstr "" "モジュールを検索するパスを示す文字列のリスト。 :envvar:`PYTHONPATH` 環境変数" "と、インストール時に指定したデフォルトパスで初期化されます。" -#: ../../library/sys.rst:1478 msgid "" "By default, as initialized upon program startup, a potentially unsafe path " "is prepended to :data:`sys.path` (*before* the entries inserted as a result " "of :envvar:`PYTHONPATH`):" msgstr "" +"デフォルトでは、プログラム起動時の初期化で、安全でない可能性があるパスを :" +"data:`sys.path` の先頭に追加します (:envvar:`PYTHONPATH` によって挿入する項目" +"より *前* です):" -#: ../../library/sys.rst:1482 msgid "" "``python -m module`` command line: prepend the current working directory." msgstr "" +"コマンドラインが ``python -m module`` の場合: カレント作業ディレクトリを先頭" +"に追加します。" -#: ../../library/sys.rst:1484 msgid "" "``python script.py`` command line: prepend the script's directory. If it's a " "symbolic link, resolve symbolic links." msgstr "" +"コマンドラインが ``python script.py`` の場合: スクリプトのディレクトリを先頭" +"に追加します。\n" +"スクリプトがシンボリックリンクなら、リンクを解決します。" -#: ../../library/sys.rst:1486 msgid "" "``python -c code`` and ``python`` (REPL) command lines: prepend an empty " "string, which means the current working directory." msgstr "" +"コマンドラインが ``python -c code`` または ``python`` (REPL) の場合: カレント" +"作業ディレクトリを意味する空文字列を先頭に追加します。" -#: ../../library/sys.rst:1489 msgid "" "To not prepend this potentially unsafe path, use the :option:`-P` command " "line option or the :envvar:`PYTHONSAFEPATH` environment variable." msgstr "" +"安全でない可能性があるこのパスを先頭に追加しないようにするには、:option:`-P` " +"コマンドラインオプションまたは環境変数 :envvar:`PYTHONSAFEPATH` を使ってくだ" +"さい。" #: ../../library/sys.rst:1492 msgid "" @@ -2136,9 +2355,10 @@ msgstr "" "が正常なファイルシステムパスであり、finder が :data:`sys.path_hooks` 上に見つ" "からない場合は ``None`` が格納されます。" -#: ../../library/sys.rst:1523 msgid "A string containing a platform identifier. Known values are:" msgstr "" +"プラットフォーム識別子を含む文字列です。\n" +"既知の値は次のとおりです:" #: ../../library/sys.rst:1526 msgid "System" @@ -2156,37 +2376,30 @@ msgstr "AIX" msgid "``'aix'``" msgstr "``'aix'``" -#: ../../library/sys.rst:1529 msgid "Android" -msgstr "" +msgstr "Android" -#: ../../library/sys.rst:1529 msgid "``'android'``" -msgstr "" +msgstr "``'android'``" -#: ../../library/sys.rst:1530 msgid "Emscripten" -msgstr "" +msgstr "Emscripten" -#: ../../library/sys.rst:1530 msgid "``'emscripten'``" -msgstr "" +msgstr "``'emscripten'``" -#: ../../library/sys.rst:1531 msgid "FreeBSD" -msgstr "" +msgstr "FreeBSD" -#: ../../library/sys.rst:1531 msgid "``'freebsd'``" -msgstr "" +msgstr "``'freebsd'``" #: ../../library/sys.rst:1532 msgid "iOS" msgstr "iOS" -#: ../../library/sys.rst:1532 msgid "``'ios'``" -msgstr "" +msgstr "``'ios'``" #: ../../library/sys.rst:1533 msgid "Linux" @@ -2220,15 +2433,12 @@ msgstr "Windows/Cygwin" msgid "``'cygwin'``" msgstr "``'cygwin'``" -#: ../../library/sys.rst:1537 msgid "WASI" -msgstr "" +msgstr "WASI" -#: ../../library/sys.rst:1537 msgid "``'wasi'``" -msgstr "" +msgstr "``'wasi'``" -#: ../../library/sys.rst:1540 msgid "" "On Unix systems not listed in the table, the value is the lowercased OS name " "as returned by ``uname -s``, with the first part of the version as returned " @@ -2236,42 +2446,55 @@ msgid "" "built*. Unless you want to test for a specific system version, it is " "therefore recommended to use the following idiom::" msgstr "" +"表にない Unix システムでは、*Python のビルド時* に ``uname -s`` が返した OS " +"名を小文字にし、``uname -r`` が返したバージョンの最初の部分を付けた値になりま" +"す。\n" +"例えば ``'sunos5'`` です。\n" +"そのため、特定のシステムバージョンを判別したいのでなければ、次の書き方を推奨" +"します。 ::" -#: ../../library/sys.rst:1546 msgid "" "if sys.platform.startswith('sunos'):\n" " # SunOS-specific code here..." msgstr "" +"if sys.platform.startswith('sunos'):\n" +" # ここに SunOS 固有のコードを書く。" -#: ../../library/sys.rst:1549 msgid "" "On Linux, :data:`sys.platform` doesn't contain the major version anymore. It " "is always ``'linux'``, instead of ``'linux2'`` or ``'linux3'``." msgstr "" +"Linux では :data:`sys.platform` がメジャーバージョンを含まなくなりました。\n" +"``'linux2'`` や ``'linux3'`` ではなく、常に ``'linux'`` です。" -#: ../../library/sys.rst:1553 msgid "" "On AIX, :data:`sys.platform` doesn't contain the major version anymore. It " "is always ``'aix'``, instead of ``'aix5'`` or ``'aix7'``." msgstr "" +"AIX では :data:`sys.platform` がメジャーバージョンを含まなくなりました。\n" +"``'aix5'`` や ``'aix7'`` ではなく、常に ``'aix'`` です。" -#: ../../library/sys.rst:1557 msgid "" "On Android, :data:`sys.platform` now returns ``'android'`` rather than " "``'linux'``." msgstr "" +"Android では :data:`sys.platform` が ``'linux'`` ではなく ``'android'`` を返" +"すようになりました。" -#: ../../library/sys.rst:1561 msgid "" "On FreeBSD, :data:`sys.platform` doesn't contain the major version anymore. " "It is always ``'freebsd'``, instead of ``'freebsd13'`` or ``'freebsd14'``." msgstr "" +"FreeBSD では :data:`sys.platform` がメジャーバージョンを含まなくなりまし" +"た。\n" +"``'freebsd13'`` や ``'freebsd14'`` ではなく、常に ``'freebsd'`` です。" -#: ../../library/sys.rst:1567 msgid "" ":data:`os.name` has a coarser granularity. :func:`os.uname` gives system-" "dependent version information." msgstr "" +":data:`os.name` はより粗い分類を提供します。\n" +":func:`os.uname` はシステムに依存したバージョン情報を提供します。" #: ../../library/sys.rst:1570 msgid "" @@ -2281,45 +2504,53 @@ msgstr "" ":mod:`platform` モジュールはシステムの詳細な識別情報をチェックする機能を提供" "しています。" -#: ../../library/sys.rst:1576 msgid "" "Name of the platform-specific library directory. It is used to build the " "path of standard library and the paths of installed extension modules." msgstr "" +"プラットフォーム固有のライブラリディレクトリの名前です。\n" +"標準ライブラリや、インストール済みの拡張モジュールのパスを組み立てるために使" +"います。" -#: ../../library/sys.rst:1579 msgid "" "It is equal to ``\"lib\"`` on most platforms. On Fedora and SuSE, it is " "equal to ``\"lib64\"`` on 64-bit platforms which gives the following ``sys." "path`` paths (where ``X.Y`` is the Python ``major.minor`` version):" msgstr "" +"ほとんどのプラットフォームでは ``\"lib\"`` です。\n" +"Fedora と SuSE の 64 ビットプラットフォームでは ``\"lib64\"`` になり、``sys." +"path`` には次のパスが入ります (``X.Y`` は Python の ``major.minor`` バージョ" +"ンです):" -#: ../../library/sys.rst:1583 msgid "" "``/usr/lib64/pythonX.Y/``: Standard library (like ``os.py`` of the :mod:`os` " "module)" msgstr "" +"``/usr/lib64/pythonX.Y/``: 標準ライブラリ (:mod:`os` モジュールの ``os.py`` " +"など)" -#: ../../library/sys.rst:1585 msgid "" "``/usr/lib64/pythonX.Y/lib-dynload/``: C extension modules of the standard " "library (like the :mod:`errno` module, the exact filename is platform " "specific)" msgstr "" +"``/usr/lib64/pythonX.Y/lib-dynload/``: 標準ライブラリの C 拡張モジュール (:" +"mod:`errno` モジュールなど。正確なファイル名はプラットフォームに依存します)" -#: ../../library/sys.rst:1588 msgid "" "``/usr/lib/pythonX.Y/site-packages/`` (always use ``lib``, not :data:`sys." "platlibdir`): Third-party modules" msgstr "" +"``/usr/lib/pythonX.Y/site-packages/`` (:data:`sys.platlibdir` ではなく、常に " +"``lib`` を使用): サードパーティーモジュール" -#: ../../library/sys.rst:1590 msgid "" "``/usr/lib64/pythonX.Y/site-packages/``: C extension modules of third-party " "packages" msgstr "" +"``/usr/lib64/pythonX.Y/site-packages/``: サードパーティーパッケージの C 拡張" +"モジュール" -#: ../../library/sys.rst:1598 msgid "" "A string giving the site-specific directory prefix where the platform " "independent Python files are installed; on Unix, the default is :file:`/usr/" @@ -2327,14 +2558,24 @@ msgid "" "to the :program:`configure` script. See :ref:`installation_paths` for " "derived paths." msgstr "" +"プラットフォームに依存しない Python のファイルがインストールされている、サイ" +"ト固有のディレクトリプレフィックスを表す文字列です。\n" +"Unix でのデフォルトは :file:`/usr/local` です。\n" +"ビルド時に :program:`configure` スクリプトの :option:`--prefix` 引数で設定で" +"きます。\n" +"これを基にしたパスについては :ref:`installation_paths` を参照してください。" -#: ../../library/sys.rst:1606 msgid "" "If a :ref:`virtual environment ` is in effect, this :data:`prefix` " "will point to the virtual environment. The value for the Python installation " "will still be available, via :data:`base_prefix`. Refer to :ref:`sys-path-" "init-virtual-environments` for more information." msgstr "" +":ref:`仮想環境 ` が有効な場合、:data:`prefix` はその仮想環境を指し" +"ます。\n" +"基になる Python のインストール先の値は、引き続き :data:`base_prefix` で取得で" +"きます。\n" +"詳しくは :ref:`sys-path-init-virtual-environments` を参照してください。" #: ../../library/sys.rst:1630 msgid "" @@ -2362,14 +2603,15 @@ msgid "" "g. :const:`os.RTLD_LAZY`)." msgstr "" -#: ../../library/sys.rst:1652 msgid "" "Set the :ref:`integer string conversion length limitation " "` used by this interpreter. See also :func:" "`get_int_max_str_digits`." msgstr "" +"このインタープリタが使う :ref:`整数文字列変換の長さ制限 " +"` を設定します。\n" +":func:`get_int_max_str_digits` も参照してください。" -#: ../../library/sys.rst:1664 msgid "" "Set the system's profile function, which allows you to implement a Python " "source code profiler in Python. See chapter :ref:`profile` for more " @@ -2383,13 +2625,27 @@ msgid "" "Also, its return value is not used, so it can simply return ``None``. Error " "in the profile function will cause itself unset." msgstr "" +"システムのプロファイル関数を設定します。\n" +"Python のソースコード用のプロファイラを Python で実装するために使えます。\n" +"Python プロファイラについて詳しくは :ref:`profile` の章を参照してください。\n" +"システムのプロファイル関数はトレース関数 (:func:`settrace` を参照) と同じよう" +"に呼び出されますが、受け取るイベントが異なります。\n" +"例えば、実行するコードの行ごとには呼び出されず、呼び出しと復帰のときだけ呼ば" +"れます (ただし例外が発生していても復帰イベントは通知されます)。\n" +"この関数はスレッド固有ですが、プロファイラはスレッド間のコンテキスト切り替え" +"を知ることができないため、複数のスレッドがある状況でこれを使っても意味があり" +"ません。\n" +"戻り値は使われないため、単に ``None`` を返して構いません。\n" +"プロファイル関数でエラーが起きると、その関数の設定が解除されます。" -#: ../../library/sys.rst:1676 msgid "" "The same tracing mechanism is used for :func:`!setprofile` as :func:" "`settrace`. To trace calls with :func:`!setprofile` inside a tracing " "function (e.g. in a debugger breakpoint), see :func:`call_tracing`." msgstr "" +":func:`!setprofile` は :func:`settrace` と同じトレースの仕組みを使います。\n" +"トレース関数の内部 (例えばデバッガのブレークポイント) で :func:`!setprofile` " +"によって呼び出しを追跡する方法は、:func:`call_tracing` を参照してください。" #: ../../library/sys.rst:1680 msgid "" @@ -2461,12 +2717,11 @@ msgstr "``'c_exception'``" msgid "A C function has raised an exception. *arg* is the C function object." msgstr "C 関数が例外を発生させた。 *arg* は C の関数オブジェクト。" -#: ../../library/sys.rst:1706 msgid "" "Raises an :ref:`auditing event ` ``sys.setprofile`` with no " "arguments." msgstr "" -"引数無しで :ref:`監査イベント ` ``sys.setprofile`` を送出します。 " +"引数無しで :ref:`監査イベント ` ``sys.setprofile`` を送出します。" #: ../../library/sys.rst:1711 msgid "" @@ -2489,17 +2744,19 @@ msgstr "" "合にはプラットフォームがサポートしている範囲内でより大きな値を指定することが" "できますが、この値が大きすぎればクラッシュするので注意が必要です。" -#: ../../library/sys.rst:1720 msgid "" "If the new limit is too low at the current recursion depth, a :exc:" "`RecursionError` exception is raised." msgstr "" +"現在の再帰の深さに対して新しい上限が低すぎる場合、:exc:`RecursionError` 例外" +"を送出します。" -#: ../../library/sys.rst:1723 msgid "" "A :exc:`RecursionError` exception is now raised if the new limit is too low " "at the current recursion depth." msgstr "" +"現在の再帰の深さに対して新しい上限が低すぎる場合、:exc:`RecursionError` 例外" +"を送出するようになりました。" #: ../../library/sys.rst:1730 msgid "" @@ -2518,7 +2775,6 @@ msgstr "" "ケジュールされる(次に実行される)かはオペレーティングシステムが決定します。" "インタプリタは自身のスケジューラを持ちません。" -#: ../../library/sys.rst:1747 msgid "" "Set the system's trace function, which allows you to implement a Python " "source code debugger in Python. The function is thread-specific; for a " @@ -2526,6 +2782,12 @@ msgid "" "using :func:`settrace` for each thread being debugged or use :func:" "`threading.settrace`." msgstr "" +"システムのトレース関数を設定します。\n" +"Python のソースコード用のデバッガを Python で実装するために使えます。\n" +"この関数はスレッド固有です。\n" +"複数のスレッドに対応するデバッガでは、デバッグする各スレッドで :func:" +"`settrace` を使ってトレース関数を登録するか、:func:`threading.settrace` を使" +"う必要があります。" #: ../../library/sys.rst:1752 msgid "" @@ -2550,23 +2812,27 @@ msgstr "" "に入るたびに呼ばれます。この場合、新しいスコープで利用するローカルの trace 関" "数への参照か、そのスコープを trace しないのであれば ``None`` を返します。" -#: ../../library/sys.rst:1762 msgid "" "The local trace function should return a reference to itself, or to another " "function which would then be used as the local trace function for the scope." msgstr "" +"ローカルのトレース関数は、自分自身、またはそのスコープの新しいローカルトレー" +"ス関数として使う別の関数への参照を返す必要があります。" -#: ../../library/sys.rst:1765 msgid "" "If there is any error occurred in the trace function, it will be unset, just " "like ``settrace(None)`` is called." msgstr "" +"トレース関数でエラーが発生すると、``settrace(None)`` を呼んだときと同様に、ト" +"レース関数の設定が解除されます。" -#: ../../library/sys.rst:1769 msgid "" "Tracing is disabled while calling the trace function (e.g. a function set " "by :func:`!settrace`). For recursive tracing see :func:`call_tracing`." msgstr "" +"トレース関数 (例えば :func:`!settrace` で設定した関数) を呼び出している間、ト" +"レースは無効になります。\n" +"再帰的なトレースについては :func:`call_tracing` を参照してください。" #: ../../library/sys.rst:1775 msgid "" @@ -2620,7 +2886,6 @@ msgstr "" msgid "``'opcode'``" msgstr "``'opcode'``" -#: ../../library/sys.rst:1801 msgid "" "The interpreter is about to execute a new opcode (see :mod:`dis` for opcode " "details). The local trace function is called; *arg* is ``None``; the return " @@ -2629,6 +2894,13 @@ msgid "" "`~frame.f_trace_opcodes` to :const:`True` on the :ref:`frame `." msgstr "" +"インタープリタが新しいオペコードを実行しようとしています (オペコードについて" +"は :mod:`dis` を参照)。\n" +"ローカルのトレース関数を呼び出し、*arg* には ``None`` を渡します。\n" +"戻り値で新しいローカルトレース関数を指定します。\n" +"オペコードごとのイベントはデフォルトでは発生しません。\n" +":ref:`フレーム ` の :attr:`~frame.f_trace_opcodes` を :const:" +"`True` に設定して、明示的に要求する必要があります。" #: ../../library/sys.rst:1808 msgid "" @@ -2638,7 +2910,6 @@ msgstr "" "例外が呼び出しチェインを辿って伝播していくことに注意してください。 " "``'exception'`` イベントは各レベルで発生します。" -#: ../../library/sys.rst:1811 msgid "" "For more fine-grained usage, it's possible to set a trace function by " "assigning ``frame.f_trace = tracefunc`` explicitly, rather than relying on " @@ -2651,18 +2922,26 @@ msgid "" "tracing function that simply returns ``None`` to disable itself immediately " "on each frame)." msgstr "" +"より細かく制御するには、登録済みのトレース関数の戻り値による間接的な設定に頼" +"らず、``frame.f_trace = tracefunc`` と明示的に代入してトレース関数を設定でき" +"ます。\n" +"現在のフレームでトレース関数を有効にする場合にも、この代入が必要です。\n" +":func:`settrace` は現在のフレームでは有効にしません。\n" +"ただし、これが動作するには、実行時のトレース機構を有効にするため、:func:" +"`settrace` でグローバルなトレース関数を登録しておく必要があります。\n" +"同じトレース関数である必要はなく、例えば各フレームで単に ``None`` を返して直" +"ちに自身を無効にする、オーバーヘッドの小さい関数でも構いません。" #: ../../library/sys.rst:1822 msgid "For more information on code and frame objects, refer to :ref:`types`." msgstr "" "code と frame オブジェクトについては、 :ref:`types` を参照してください。" -#: ../../library/sys.rst:1824 msgid "" "Raises an :ref:`auditing event ` ``sys.settrace`` with no " "arguments." msgstr "" -"引数無しで :ref:`監査イベント ` ``sys.settrace`` を送出します。 " +"引数無しで :ref:`監査イベント ` ``sys.settrace`` を送出します。" #: ../../library/sys.rst:1828 msgid "" @@ -2675,13 +2954,13 @@ msgstr "" "だけのものです。この関数の挙動は言語定義よりも実装プラットフォームの分野の問" "題で、全ての Python 実装で利用できるとは限りません。" -#: ../../library/sys.rst:1835 msgid "" "``'opcode'`` event type added; :attr:`~frame.f_trace_lines` and :attr:" "`~frame.f_trace_opcodes` attributes added to frames" msgstr "" +"``'opcode'`` イベントを追加し、フレームに :attr:`~frame.f_trace_lines` 属性" +"と :attr:`~frame.f_trace_opcodes` 属性を追加しました。" -#: ../../library/sys.rst:1840 msgid "" "Accepts two optional keyword arguments which are callables that accept an :" "term:`asynchronous generator iterator` as an argument. The *firstiter* " @@ -2689,28 +2968,33 @@ msgid "" "first time. The *finalizer* will be called when an asynchronous generator is " "about to be garbage collected." msgstr "" +"省略可能な 2 つのキーワード引数を受け取ります。\n" +"それぞれ :term:`非同期ジェネレータイテレータ ` を引数に取る呼び出し可能オブジェクトです。\n" +"*firstiter* は、非同期ジェネレータを初めて反復するときに呼び出されます。\n" +"*finalizer* は、非同期ジェネレータがガベージコレクションで回収されようとする" +"ときに呼び出されます。" -#: ../../library/sys.rst:1846 msgid "" "Raises an :ref:`auditing event ` ``sys." "set_asyncgen_hooks_firstiter`` with no arguments." msgstr "" "引数無しで :ref:`監査イベント ` ``sys." -"set_asyncgen_hooks_firstiter`` を送出します。 " +"set_asyncgen_hooks_firstiter`` を送出します。" -#: ../../library/sys.rst:1848 msgid "" "Raises an :ref:`auditing event ` ``sys." "set_asyncgen_hooks_finalizer`` with no arguments." msgstr "" "引数無しで :ref:`監査イベント ` ``sys." -"set_asyncgen_hooks_finalizer`` を送出します。 " +"set_asyncgen_hooks_finalizer`` を送出します。" -#: ../../library/sys.rst:1850 msgid "" "Two auditing events are raised because the underlying API consists of two " "calls, each of which must raise its own event." msgstr "" +"内部の API は 2 つの呼び出しからなり、それぞれがイベントを発生させる必要があ" +"るため、監査イベントも 2 つ発生します。" #: ../../library/sys.rst:1853 msgid "" @@ -2719,7 +3003,6 @@ msgid "" "shutdown_asyncgens`` in :source:`Lib/asyncio/base_events.py`" msgstr "" -#: ../../library/sys.rst:1865 msgid "" "Allows enabling or disabling coroutine origin tracking. When enabled, the " "``cr_origin`` attribute on coroutine objects will contain a tuple of " @@ -2727,54 +3010,56 @@ msgid "" "the coroutine object was created, with the most recent call first. When " "disabled, ``cr_origin`` will be ``None``." msgstr "" +"コルーチンの生成元の追跡を有効または無効にします。\n" +"有効にすると、コルーチンオブジェクトの ``cr_origin`` 属性に、そのオブジェクト" +"が作成された場所のトレースバックを表す (ファイル名、行番号、関数名) のタプル" +"を並べたタプルが入ります。\n" +"最も新しい呼び出しが先頭です。\n" +"無効にすると、``cr_origin`` は ``None`` になります。" -#: ../../library/sys.rst:1872 msgid "" "To enable, pass a *depth* value greater than zero; this sets the number of " "frames whose information will be captured. To disable, set *depth* to zero." msgstr "" +"有効にするには、ゼロより大きい *depth* を渡します。\n" +"これが、情報を取得するフレーム数になります。\n" +"無効にするには *depth* をゼロにします。" -#: ../../library/sys.rst:1876 msgid "This setting is thread-specific." -msgstr "" +msgstr "この設定はスレッド固有です。" -#: ../../library/sys.rst:1886 msgid "" "Activate the stack profiler trampoline *backend*. The only supported backend " "is ``\"perf\"``." msgstr "" +"スタックプロファイラのトランポリンの *backend* を有効にします。\n" +"サポートするバックエンドは ``\"perf\"`` だけです。" -#: ../../library/sys.rst:1889 msgid "Stack trampolines cannot be activated if the JIT is active." -msgstr "" +msgstr "JIT が有効な場合、スタックトランポリンは有効にできません。" -#: ../../library/sys.rst:1897 msgid ":ref:`perf_profiling`" -msgstr "" +msgstr ":ref:`perf_profiling`" -#: ../../library/sys.rst:1898 msgid "https://perf.wiki.kernel.org" -msgstr "" +msgstr "https://perf.wiki.kernel.org" -#: ../../library/sys.rst:1902 msgid "Deactivate the current stack profiler trampoline backend." -msgstr "" +msgstr "現在のスタックプロファイラのトランポリンのバックエンドを無効にします。" -#: ../../library/sys.rst:1904 msgid "If no stack profiler is activated, this function has no effect." -msgstr "" +msgstr "スタックプロファイラが有効でなければ、この関数は何もしません。" -#: ../../library/sys.rst:1912 msgid "Return ``True`` if a stack profiler trampoline is active." -msgstr "" +msgstr "スタックプロファイラのトランポリンが有効なら ``True`` を返します。" -#: ../../library/sys.rst:1921 msgid "" "Executes *script*, a file containing Python code in the remote process with " "the given *pid*." msgstr "" +"指定した *pid* のリモートプロセスで、Python コードを含むファイル *script* を" +"実行します。" -#: ../../library/sys.rst:1924 msgid "" "This function returns immediately, and the code will be executed by the " "target process's main thread at the next available opportunity, similarly to " @@ -2783,47 +3068,62 @@ msgid "" "still exists whenever the remote process tries to read it and that it hasn't " "been overwritten." msgstr "" +"この関数はすぐに戻り、対象プロセスのメインスレッドが次に実行可能なタイミング" +"でコードを実行します。\n" +"シグナルの処理に似た動作です。\n" +"コードがいつ実行されたかを調べるインターフェースはありません。\n" +"リモートプロセスが読み取ろうとするときまでファイルが存在し、上書きされていな" +"いことを、呼び出し側が保証する必要があります。" -#: ../../library/sys.rst:1931 msgid "" "The remote process must be running a CPython interpreter of the same major " "and minor version as the local process. If either the local or remote " "interpreter is pre-release (alpha, beta, or release candidate) then the " "local and remote interpreters must be the same exact version." msgstr "" +"リモートプロセスは、ローカルプロセスと同じメジャー・マイナーバージョンの " +"CPython インタープリタを実行している必要があります。\n" +"どちらかのインタープリタがプレリリース (アルファ、ベータ、リリース候補) な" +"ら、両者のバージョンは完全に一致しなければなりません。" -#: ../../library/sys.rst:1942 msgid "" "Changes the :term:`filesystem encoding and error handler` to 'mbcs' and " "'replace' respectively, for consistency with versions of Python prior to 3.6." msgstr "" +"Python 3.6 より前のバージョンとの互換性を保つため、:term:`ファイルシステムの" +"エンコーディングとエラーハンドラ ` を" +"それぞれ 'mbcs' と 'replace' に変更します。" -#: ../../library/sys.rst:1946 msgid "" "This is equivalent to defining the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` " "environment variable before launching Python." msgstr "" +"これは、Python の起動前に環境変数 :envvar:`PYTHONLEGACYWINDOWSFSENCODING` を" +"定義することと同じです。" -#: ../../library/sys.rst:1949 msgid "" "See also :func:`sys.getfilesystemencoding` and :func:`sys." "getfilesystemencodeerrors`." msgstr "" +":func:`sys.getfilesystemencoding` と :func:`sys.getfilesystemencodeerrors` も" +"参照してください。" -#: ../../library/sys.rst:1955 msgid "" "Changing the filesystem encoding after Python startup is risky because the " "old fsencoding or paths encoded by the old fsencoding may be cached " "somewhere. Use :envvar:`PYTHONLEGACYWINDOWSFSENCODING` instead." msgstr "" +"Python の起動後にファイルシステムエンコーディングを変更するのは危険です。\n" +"以前のエンコーディング自体や、それでエンコードしたパスが、どこかにキャッシュ" +"されている可能性があるためです。\n" +"代わりに :envvar:`PYTHONLEGACYWINDOWSFSENCODING` を使ってください。" #: ../../library/sys.rst:1959 msgid "See :pep:`529` for more details." msgstr "より詳しくは :pep:`529` を参照してください。" -#: ../../library/sys.rst:1962 msgid "Use :envvar:`PYTHONLEGACYWINDOWSFSENCODING` instead." -msgstr "" +msgstr "代わりに :envvar:`PYTHONLEGACYWINDOWSFSENCODING` を使ってください。" #: ../../library/sys.rst:1969 msgid "" @@ -2880,14 +3180,16 @@ msgid "" "initially attached to a console." msgstr "" -#: ../../library/sys.rst:1994 msgid "" "The special behaviour of the console can be overridden by setting the " "environment variable PYTHONLEGACYWINDOWSSTDIO before starting Python. In " "that case, the console codepages are used as for any other character device." msgstr "" +"Python の起動前に環境変数 ``PYTHONLEGACYWINDOWSSTDIO`` を設定すると、コンソー" +"ル固有の動作を変更できます。\n" +"その場合は、ほかの文字デバイスと同じようにコンソールのコードページを使いま" +"す。" -#: ../../library/sys.rst:1999 msgid "" "Under all platforms, you can override the character encoding by setting the :" "envvar:`PYTHONIOENCODING` environment variable before starting Python or by " @@ -2895,8 +3197,13 @@ msgid "" "`PYTHONUTF8` environment variable. However, for the Windows console, this " "only applies when :envvar:`PYTHONLEGACYWINDOWSSTDIO` is also set." msgstr "" +"すべてのプラットフォームで、Python の起動前に環境変数 :envvar:" +"`PYTHONIOENCODING` を設定するか、新しい :option:`-X` ``utf8`` コマンドライン" +"オプションや環境変数 :envvar:`PYTHONUTF8` を使うことで、文字エンコーディング" +"を変更できます。\n" +"ただし Windows のコンソールでは、:envvar:`PYTHONLEGACYWINDOWSSTDIO` も設定し" +"た場合にだけ適用されます。" -#: ../../library/sys.rst:2006 msgid "" "When interactive, the ``stdout`` stream is line-buffered. Otherwise, it is " "block-buffered like regular text files. The ``stderr`` stream is line-" @@ -2904,11 +3211,19 @@ msgid "" "the :option:`-u` command-line option or setting the :envvar:" "`PYTHONUNBUFFERED` environment variable." msgstr "" +"対話的な場合、``stdout`` ストリームは行バッファリングを使います。\n" +"それ以外の場合は、通常のテキストファイルと同じブロックバッファリングを使いま" +"す。\n" +"``stderr`` ストリームはどちらの場合も行バッファリングです。\n" +":option:`-u` コマンドラインオプションを渡すか、環境変数 :envvar:" +"`PYTHONUNBUFFERED` を設定すると、両方のストリームのバッファリングを無効にでき" +"ます。" -#: ../../library/sys.rst:2012 msgid "" "Non-interactive ``stderr`` is now line-buffered instead of fully buffered." msgstr "" +"非対話的な ``stderr`` が、完全バッファリングではなく行バッファリングになりま" +"した。" #: ../../library/sys.rst:2018 msgid "" @@ -2917,17 +3232,19 @@ msgid "" "write bytes to :data:`stdout`, use ``sys.stdout.buffer.write(b'abc')``." msgstr "" "標準ストリームにバイナリーデータの読み書きを行うには下位のバイナリー :data:" -"`~io.TextIOBase.buffer` オブジェクトを使用してください。例えば :class:" -"`bytes` を :data:`stdout` に書き出す場合は ``sys.stdout.buffer." -"write(b'abc')`` を使用してください。" +"`~io.TextIOBase.buffer` オブジェクトを使用してください。例えば ``bytes`` を :" +"data:`stdout` に書き出す場合は ``sys.stdout.buffer.write(b'abc')`` を使用して" +"ください。" -#: ../../library/sys.rst:2022 msgid "" "However, if you are writing a library (and do not control in which context " "its code will be executed), be aware that the standard streams may be " "replaced with file-like objects like :class:`io.StringIO` which do not " "support the :attr:`!buffer` attribute." msgstr "" +"ただし、ライブラリを作成していて、そのコードが実行される状況を制御できない場" +"合は、標準ストリームが :class:`io.StringIO` のような :attr:`!buffer` 属性を持" +"たないファイル類似オブジェクトに置き換えられている可能性に注意してください。" #: ../../library/sys.rst:2032 msgid "" @@ -2952,7 +3269,6 @@ msgstr "" "のファイルを復元するために利用することもできます。しかし、明示的に置き換え前" "のストリームを保存しておき、そのオブジェクトを復元する事を推奨します。" -#: ../../library/sys.rst:2043 msgid "" "Under some conditions ``stdin``, ``stdout`` and ``stderr`` as well as the " "original values ``__stdin__``, ``__stdout__`` and ``__stderr__`` can be " @@ -2961,64 +3277,66 @@ msgid "" msgstr "" "一部の条件下では、``stdin``, ``stdout``, ``stderr`` も、オリジナルの " "``__stdin__``, ``__stdout__``, ``__stderr__`` も ``None`` になることがありま" -"す。これはコンソールに接続しない Windows GUI アプリケーションであり、かつ :" -"program:`pythonw` で起動された Python アプリケーションが該当します。" +"す。\n" +"これはコンソールに接続しない Windows GUI アプリケーションや、:program:" +"`pythonw` で起動された Python アプリケーションでよく見られます。" -#: ../../library/sys.rst:2051 msgid "" "A frozenset of strings containing the names of standard library modules." -msgstr "" +msgstr "標準ライブラリのモジュール名を表す文字列の frozenset です。" -#: ../../library/sys.rst:2053 msgid "" "It is the same on all platforms. Modules which are not available on some " "platforms and modules disabled at Python build are also listed. All module " "kinds are listed: pure Python, built-in, frozen and extension modules. Test " "modules are excluded." msgstr "" +"すべてのプラットフォームで同じ値です。\n" +"一部のプラットフォームでは利用できないモジュールや、Python のビルド時に無効に" +"したモジュールも含みます。\n" +"純粋な Python、組み込み、凍結、拡張のすべての種類のモジュールを含みます。\n" +"テスト用のモジュールは含みません。" -#: ../../library/sys.rst:2058 msgid "" "For packages, only the main package is listed: sub-packages and sub-modules " "are not listed. For example, the ``email`` package is listed, but the " "``email.mime`` sub-package and the ``email.message`` sub-module are not " "listed." msgstr "" +"パッケージについては最上位のパッケージだけを含み、サブパッケージやサブモ" +"ジュールは含みません。\n" +"例えば ``email`` パッケージは含みますが、``email.mime`` サブパッケージや " +"``email.message`` サブモジュールは含みません。" -#: ../../library/sys.rst:2063 msgid "See also the :data:`sys.builtin_module_names` list." -msgstr "" +msgstr ":data:`sys.builtin_module_names` の一覧も参照してください。" #: ../../library/sys.rst:2070 msgid "" "A :term:`named tuple` holding information about the thread implementation." msgstr "スレッドの実装に関する情報が格納された :term:`named tuple` です。" -#: ../../library/sys.rst:2075 msgid "The name of the thread implementation:" -msgstr "" +msgstr "スレッド実装の名前:" -#: ../../library/sys.rst:2077 msgid "``\"nt\"``: Windows threads" -msgstr "" +msgstr "``\"nt\"``: Windows スレッド" -#: ../../library/sys.rst:2078 msgid "``\"pthread\"``: POSIX threads" -msgstr "" +msgstr "``\"pthread\"``: POSIX スレッド" -#: ../../library/sys.rst:2079 msgid "" "``\"pthread-stubs\"``: stub POSIX threads (on WebAssembly platforms without " "threading support)" msgstr "" +"``\"pthread-stubs\"``: スタブの POSIX スレッド (スレッドに対応していない " +"WebAssembly プラットフォーム)" -#: ../../library/sys.rst:2081 msgid "``\"solaris\"``: Solaris threads" -msgstr "" +msgstr "``\"solaris\"``: Solaris スレッド" -#: ../../library/sys.rst:2085 msgid "The name of the lock implementation:" -msgstr "" +msgstr "ロック実装の名前:" #: ../../library/sys.rst:2087 msgid "``\"semaphore\"``: a lock uses a semaphore" @@ -3032,11 +3350,12 @@ msgstr "" msgid "``None`` if this information is unknown" msgstr "``None`` この情報が不明の場合" -#: ../../library/sys.rst:2093 msgid "" "The name and version of the thread library. It is a string, or ``None`` if " "this information is unknown." msgstr "" +"スレッドライブラリの名前とバージョンです。\n" +"文字列で、情報が不明なら ``None`` です。" #: ../../library/sys.rst:2101 msgid "" @@ -3050,40 +3369,43 @@ msgstr "" "定する整数値(デフォルト値は ``1000``)。 ``0`` 以下の値が設定された場合、ト" "レースバック情報は出力されず例外型と例外値のみが出力されます。" -#: ../../library/sys.rst:2109 msgid "Handle an unraisable exception." -msgstr "" +msgstr "送出不能な例外を処理します。" -#: ../../library/sys.rst:2111 msgid "" "Called when an exception has occurred but there is no way for Python to " "handle it. For example, when a destructor raises an exception or during " "garbage collection (:func:`gc.collect`)." msgstr "" +"例外が発生しても Python がそれを処理する方法がない場合に呼び出されます。\n" +"例えば、デストラクタが例外を送出した場合や、ガベージコレクション (:func:`gc." +"collect`) 中に例外が発生した場合です。" -#: ../../library/sys.rst:2115 msgid "The *unraisable* argument has the following attributes:" -msgstr "" +msgstr "*unraisable* 引数は次の属性を持ちます:" -#: ../../library/sys.rst:2117 msgid ":attr:`!exc_type`: Exception type." -msgstr "" +msgstr ":attr:`!exc_type`: 例外の型。" -#: ../../library/sys.rst:2118 msgid ":attr:`!exc_value`: Exception value, can be ``None``." msgstr "" +":attr:`!exc_value`: 例外の値。\n" +"``None`` のこともあります。" -#: ../../library/sys.rst:2119 msgid ":attr:`!exc_traceback`: Exception traceback, can be ``None``." msgstr "" +":attr:`!exc_traceback`: 例外のトレースバック。\n" +"``None`` のこともあります。" -#: ../../library/sys.rst:2120 msgid ":attr:`!err_msg`: Error message, can be ``None``." msgstr "" +":attr:`!err_msg`: エラーメッセージ。\n" +"``None`` のこともあります。" -#: ../../library/sys.rst:2121 msgid ":attr:`!object`: Object causing the exception, can be ``None``." msgstr "" +":attr:`!object`: 例外の原因となったオブジェクト。\n" +"``None`` のこともあります。" #: ../../library/sys.rst:2123 msgid "" @@ -3092,37 +3414,46 @@ msgid "" "attr:`!err_msg` is ``None``." msgstr "" -#: ../../library/sys.rst:2127 msgid "" ":func:`sys.unraisablehook` can be overridden to control how unraisable " "exceptions are handled." msgstr "" +":func:`sys.unraisablehook` を置き換えることで、送出不能な例外の処理を制御でき" +"ます。" -#: ../../library/sys.rst:2132 msgid ":func:`excepthook` which handles uncaught exceptions." -msgstr "" +msgstr "捕捉されない例外を処理する :func:`excepthook`。" -#: ../../library/sys.rst:2136 msgid "" "Storing :attr:`!exc_value` using a custom hook can create a reference cycle. " "It should be cleared explicitly to break the reference cycle when the " "exception is no longer needed." msgstr "" +"独自のフックで :attr:`!exc_value` を保存すると、循環参照が生じることがありま" +"す。\n" +"例外が不要になったら、保存した参照を明示的にクリアして循環参照を解消してくだ" +"さい。" -#: ../../library/sys.rst:2140 msgid "" "Storing :attr:`!object` using a custom hook can resurrect it if it is set to " "an object which is being finalized. Avoid storing :attr:`!object` after the " "custom hook completes to avoid resurrecting objects." msgstr "" +"独自のフックで :attr:`!object` を保存すると、それが終了処理中のオブジェクト" +"だった場合、そのオブジェクトを復活させる可能性があります。\n" +"オブジェクトの復活を避けるため、独自のフックの完了後まで :attr:`!object` を保" +"持しないでください。" -#: ../../library/sys.rst:2144 ../../library/sys.rst:2146 msgid "" "Raise an auditing event ``sys.unraisablehook`` with arguments *hook*, " "*unraisable* when an exception that cannot be handled occurs. The " "*unraisable* object is the same as what will be passed to the hook. If no " "hook has been set, *hook* may be ``None``." msgstr "" +"処理できない例外が発生すると、引数 *hook*、*unraisable* を持つ監査イベント " +"``sys.unraisablehook`` を発生させます。\n" +"*unraisable* オブジェクトは、フックに渡されるものと同じです。\n" +"フックが設定されていなければ *hook* は ``None`` のことがあります。" #: ../../library/sys.rst:2155 msgid "" @@ -3166,14 +3497,14 @@ msgstr "" msgid "Added named component attributes." msgstr "名前を使った要素アクセスがサポートされました。" -#: ../../library/sys.rst:2183 msgid "" "This is an implementation detail of the warnings framework; do not modify " "this value. Refer to the :mod:`warnings` module for more information on the " "warnings framework." msgstr "" -"この値は、warnings フレームワーク内部のみ使用され、変更することはできません。" -"詳細は :mod:`warnings` を参照してください。" +"これは warnings の仕組みの実装の詳細です。\n" +"この値を変更しないでください。\n" +"警告の仕組みについて詳しくは :mod:`warnings` モジュールを参照してください。" #: ../../library/sys.rst:2190 msgid "" @@ -3184,11 +3515,13 @@ msgid "" "has no effect on the registry keys used by Python." msgstr "" -#: ../../library/sys.rst:2202 msgid "" "Namespace containing functions and constants for register callbacks and " "controlling monitoring events. See :mod:`sys.monitoring` for details." msgstr "" +"コールバックの登録やモニタリングイベントの制御を行う関数と定数を含む名前空間" +"です。\n" +"詳しくは :mod:`sys.monitoring` を参照してください。" #: ../../library/sys.rst:2208 msgid "" @@ -3200,7 +3533,6 @@ msgstr "" "です。オプション名にはその値が明示されていればそれが、それ以外の場合は :" "const:`True` がマップされます。例えば:" -#: ../../library/sys.rst:2212 msgid "" "$ ./python -Xa=b -Xc\n" "Python 3.2a3+ (py3k, Oct 16 2010, 20:14:50)\n" @@ -3211,16 +3543,23 @@ msgid "" ">>> sys._xoptions\n" "{'a': 'b', 'c': True}" msgstr "" +"$ ./python -Xa=b -Xc\n" +"Python 3.2a3+ (py3k, Oct 16 2010, 20:14:50)\n" +"[GCC 4.4.3] on linux2\n" +"Type \"help\", \"copyright\", \"credits\" or \"license\" for more " +"information.\n" +">>> import sys\n" +">>> sys._xoptions\n" +"{'a': 'b', 'c': True}" -#: ../../library/sys.rst:2224 msgid "" "This is a CPython-specific way of accessing options passed through :option:`-" "X`. Other implementations may export them through other means, or not at " "all." msgstr "" -"この :option:`-X` によって渡されたオプションにアクセスする方法は CPython 固有" -"です。他の実装ではそれらは他の意味でエクスポートされるか、あるいは何もしませ" -"ん。" +"これは、:option:`-X` で渡されたオプションにアクセスする CPython 固有の方法で" +"す。\n" +"ほかの実装では別の方法で公開することも、まったく公開しないこともあります。" #: ../../library/sys.rst:2232 msgid "Citations" @@ -3236,9 +3575,8 @@ msgstr "" "フトが参照できます: https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256." "pdf\\ 。" -#: ../../library/sys.rst:99 msgid "auditing" -msgstr "" +msgstr "監査" #: ../../library/sys.rst:461 msgid "object" @@ -3288,9 +3626,8 @@ msgstr "prompts, interpreter" msgid ">>>" msgstr ">>>" -#: ../../library/sys.rst:1624 msgid "interpreter prompt" -msgstr "" +msgstr "インタープリタのプロンプト" #: ../../library/sys.rst:1624 msgid "..." diff --git a/library/sys_path_init.po b/library/sys_path_init.po index f6cc27b72..c278b5c38 100644 --- a/library/sys_path_init.po +++ b/library/sys_path_init.po @@ -17,10 +17,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/sys_path_init.rst:4 @@ -35,30 +35,39 @@ msgstr "" "モジュール検索パスは Python の開始時に初期化されます。このモジュール検索パス" "は、 :data:`sys.path` でアクセス可能です。" -#: ../../library/sys_path_init.rst:9 msgid "" "The first entry in the module search path is the directory that contains the " "input script, if there is one. Otherwise, the first entry is the current " "directory, which is the case when executing the interactive shell, a :option:" "`-c` command, or :option:`-m` module." msgstr "" +"実行するスクリプトがある場合、モジュール検索パスの最初の項目は、そのスクリプ" +"トがあるディレクトリです。\n" +"そうでなければ最初の項目はカレントディレクトリです。\n" +"対話型シェル、:option:`-c` コマンド、:option:`-m` モジュールを実行する場合が" +"これに当たります。" -#: ../../library/sys_path_init.rst:14 msgid "" "The :envvar:`PYTHONPATH` environment variable is often used to add " "directories to the search path. If this environment variable is found then " "the contents are added to the module search path." msgstr "" +":envvar:`PYTHONPATH` 環境変数は、検索パスにディレクトリを追加するためによく使" +"われます。\n" +"この環境変数が見つかると、その内容をモジュール検索パスに追加します。" -#: ../../library/sys_path_init.rst:20 msgid "" ":envvar:`PYTHONPATH` will affect all installed Python versions/environments. " "Be wary of setting this in your shell profile or global environment " "variables. The :mod:`site` module offers more nuanced techniques as " "mentioned below." msgstr "" +":envvar:`PYTHONPATH` は、インストールされているすべての Python のバージョンと" +"環境に影響します。\n" +"シェルのプロファイルやグローバルな環境変数で設定する場合は注意してくださ" +"い。\n" +"後述するように、:mod:`site` モジュールではより細かな方法で設定できます。" -#: ../../library/sys_path_init.rst:24 msgid "" "The next items added are the directories containing standard Python modules " "as well as any :term:`extension module`\\s that these modules depend on. " @@ -67,8 +76,13 @@ msgid "" "called ``prefix``. The directory with the extension modules is called " "``exec_prefix``." msgstr "" +"次に、標準の Python モジュールと、それらが依存する :term:`拡張モジュール " +"` を含むディレクトリを追加します。\n" +"拡張モジュールは Windows では ``.pyd`` ファイル、ほかのプラットフォームでは " +"``.so`` ファイルです。\n" +"プラットフォームに依存しない Python モジュールのあるディレクトリを " +"``prefix``、拡張モジュールのあるディレクトリを ``exec_prefix`` と呼びます。" -#: ../../library/sys_path_init.rst:30 msgid "" "The :envvar:`PYTHONHOME` environment variable may be used to set the " "``prefix`` and ``exec_prefix`` locations. Otherwise these directories are " @@ -77,8 +91,14 @@ msgid "" "are followed so the real Python executable location is used as the search " "starting point. The Python executable location is called ``home``." msgstr "" +":envvar:`PYTHONHOME` 環境変数で ``prefix`` と ``exec_prefix`` の場所を設定で" +"きます。\n" +"設定されていなければ、Python 実行ファイルを起点に、目印となる各種のファイルや" +"ディレクトリを探して、これらのディレクトリを特定します。\n" +"シンボリックリンクはたどるため、検索の起点は Python 実行ファイルの実際の場所" +"になります。\n" +"Python 実行ファイルの場所を ``home`` と呼びます。" -#: ../../library/sys_path_init.rst:37 msgid "" "Once ``home`` is determined, the ``prefix`` directory is found by first " "looking for :file:`python{majorversion}{minorversion}.zip` (``python311." @@ -95,14 +115,30 @@ msgid "" "`lib64` or another value, see :data:`sys.platlibdir` and :envvar:" "`PYTHONPLATLIBDIR`." msgstr "" +"``home`` が決まると、まず :file:`python{majorversion}{minorversion}.zip` " +"(``python311.zip``) を探して ``prefix`` ディレクトリを特定します。\n" +"Windows では ``home`` 内を探し、Unix では :file:`lib` 内にアーカイブがあると" +"想定します。\n" +"アーカイブが存在しなくても、想定される zip アーカイブの場所はモジュール検索パ" +"スに追加されます。\n" +"アーカイブが見つからなければ、Windows の Python は :file:`Lib\\\\os.py` を探" +"して ``prefix`` の検索を続けます。\n" +"Unix の Python は :file:`lib/python{majorversion}.{minorversion}/os.py` " +"(``lib/python3.11/os.py``) を探します。\n" +"Windows では ``prefix`` と ``exec_prefix`` は同じですが、ほかのプラットフォー" +"ムでは :file:`lib/python{majorversion}.{minorversion}/lib-dynload` (``lib/" +"python3.11/lib-dynload``) を探し、``exec_prefix`` を特定する基準にします。\n" +"プラットフォームによっては :file:`lib` が :file:`lib64` や別の値になる場合が" +"あります。\n" +":data:`sys.platlibdir` と :envvar:`PYTHONPLATLIBDIR` を参照してください。" -#: ../../library/sys_path_init.rst:50 msgid "" "Once found, ``prefix`` and ``exec_prefix`` are available at :data:`sys." "base_prefix` and :data:`sys.base_exec_prefix` respectively." msgstr "" +"見つかった ``prefix`` と ``exec_prefix`` は、それぞれ :data:`sys." +"base_prefix` と :data:`sys.base_exec_prefix` で取得できます。" -#: ../../library/sys_path_init.rst:53 msgid "" "If :envvar:`PYTHONHOME` is not set, and a ``pyvenv.cfg`` file is found " "alongside the main executable, or in its parent directory, :data:`sys." @@ -111,6 +147,13 @@ msgid "" "base_prefix` and :data:`sys.base_exec_prefix`, respectively. This is used " "by :ref:`sys-path-init-virtual-environments`." msgstr "" +":envvar:`PYTHONHOME` が設定されておらず、メインの実行ファイルと同じディレクト" +"リか、その親ディレクトリに ``pyvenv.cfg`` が見つかると、\n" +":data:`sys.prefix` と :data:`sys.exec_prefix` は ``pyvenv.cfg`` のあるディレ" +"クトリに設定されます。\n" +"そうでなければ、それぞれ :data:`sys.base_prefix` と :data:`sys." +"base_exec_prefix` と同じ値になります。\n" +"これは :ref:`sys-path-init-virtual-environments` で利用されます。" #: ../../library/sys_path_init.rst:60 msgid "" @@ -126,41 +169,47 @@ msgid "" "option:`-E`, :option:`-I`, :option:`-s` and :option:`-S` for further details." msgstr "" -#: ../../library/sys_path_init.rst:72 msgid "" ":data:`sys.prefix` and :data:`sys.exec_prefix` are now set to the ``pyvenv." "cfg`` directory during the path initialization. This was previously done by :" "mod:`site`, therefore affected by :option:`-S`." msgstr "" +":data:`sys.prefix` と :data:`sys.exec_prefix` は、パスの初期化時に ``pyvenv." +"cfg`` のあるディレクトリに設定されるようになりました。\n" +"以前は :mod:`site` が行っていたため、:option:`-S` の影響を受けていました。" -#: ../../library/sys_path_init.rst:79 msgid "Virtual Environments" -msgstr "" +msgstr "仮想環境" -#: ../../library/sys_path_init.rst:81 msgid "" "Virtual environments place a ``pyvenv.cfg`` file in their prefix, which " "causes :data:`sys.prefix` and :data:`sys.exec_prefix` to point to them, " "instead of the base installation." msgstr "" +"仮想環境は、そのプレフィックスに ``pyvenv.cfg`` ファイルを置きます。\n" +"これにより、:data:`sys.prefix` と :data:`sys.exec_prefix` は基となるインス" +"トール先ではなく、仮想環境を指します。" -#: ../../library/sys_path_init.rst:85 msgid "" "The ``prefix`` and ``exec_prefix`` values of the base installation are " "available at :data:`sys.base_prefix` and :data:`sys.base_exec_prefix`." msgstr "" +"基となるインストール先の ``prefix`` と ``exec_prefix`` は、:data:`sys." +"base_prefix` と :data:`sys.base_exec_prefix` で取得できます。" -#: ../../library/sys_path_init.rst:88 msgid "" "As well as being used as a marker to identify virtual environments, ``pyvenv." "cfg`` may also be used to configure the :mod:`site` initialization. Please " "refer to :mod:`site`'s :ref:`virtual environments documentation `." msgstr "" +"``pyvenv.cfg`` は仮想環境を識別する目印として使われるだけでなく、:mod:`site` " +"の初期化の設定にも使えます。\n" +":mod:`site` の :ref:`仮想環境のドキュメント ` を参照してください。" -#: ../../library/sys_path_init.rst:95 msgid ":envvar:`PYTHONHOME` overrides the ``pyvenv.cfg`` detection." -msgstr "" +msgstr ":envvar:`PYTHONHOME` は ``pyvenv.cfg`` の検出より優先されます。" #: ../../library/sys_path_init.rst:99 msgid "" @@ -171,11 +220,9 @@ msgid "" "diverge from it." msgstr "" -#: ../../library/sys_path_init.rst:106 msgid "_pth files" -msgstr "" +msgstr "_pth ファイル" -#: ../../library/sys_path_init.rst:108 msgid "" "To completely override :data:`sys.path` create a ``._pth`` file with the " "same name as the shared library or executable (``python._pth`` or " @@ -185,8 +232,18 @@ msgid "" "the shared library name overrides the one based on the executable, which " "allows paths to be restricted for any program loading the runtime if desired." msgstr "" +":data:`sys.path` を完全に上書きするには、共有ライブラリや実行ファイルと同じ名" +"前の ``._pth`` ファイル (``python._pth`` や ``python311._pth``) を作成しま" +"す。\n" +"Windows では共有ライブラリのパスは常に分かりますが、ほかのプラットフォームで" +"は取得できない場合があります。\n" +"``._pth`` ファイルでは、:data:`sys.path` に追加するパスを 1 行に 1 つずつ指定" +"します。\n" +"共有ライブラリ名に基づくファイルは、実行ファイル名に基づくファイルより優先さ" +"れます。\n" +"これにより、必要ならランタイムを読み込むあらゆるプログラムのパスを制限できま" +"す。" -#: ../../library/sys_path_init.rst:116 msgid "" "When the file exists, all registry and environment variables are ignored, " "isolated mode is enabled, and :mod:`site` is not imported unless one line in " @@ -196,10 +253,11 @@ msgid "" "arbitrary code cannot be specified." msgstr "" "ファイルが存在したときは、全てのレジストリと環境変数は無視され、隔離モードに" -"なり、そのファイルに ``import site`` と指定していない限りは :mod:`site` がイ" -"ンポートできなくなります。\n" +"なり、そのファイルに ``import site`` と指定していない限りは :mod:`site` はイ" +"ンポートされません。\n" "空行と ``#`` で始まる行は無視されます。\n" -"それぞれのパスはファイルの場所を指す絶対パスあるいは相対パスです。\n" +"それぞれのパスには絶対パスか、このファイルの場所を基準とした相対パスを指定で" +"きます。\n" "``site`` 以外のインポート文は許可されておらず、任意のコードも書けません。" #: ../../library/sys_path_init.rst:123 diff --git a/library/sysconfig.po b/library/sysconfig.po index e8b31b543..9209599bd 100644 --- a/library/sysconfig.po +++ b/library/sysconfig.po @@ -19,10 +19,10 @@ msgstr "" "Last-Translator: Takanori Suzuki , 2025\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/sysconfig.rst:2 @@ -79,24 +79,22 @@ msgstr "" "引数がない場合、現在のプラットフォームに関するすべての構成変数の辞書を返しま" "す。" -#: ../../library/sysconfig.rst:41 msgid "" "With arguments, return a list of values that result from looking up each " "argument in the configuration variable dictionary." msgstr "" -"引数がある場合、各引数を構成変数辞書から検索した結果の変数のリストを返しま" -"す。" +"引数がある場合は、各引数を構成変数の辞書で検索して得た値のリストを返します。" #: ../../library/sysconfig.rst:44 msgid "For each argument, if the value is not found, return ``None``." msgstr "各引数において、変数が見つからなかった場合は ``None`` が返されます。" -#: ../../library/sysconfig.rst:49 msgid "" "Return the value of a single variable *name*. Equivalent to " "``get_config_vars().get(name)``." msgstr "" -"1つの変数 *name* を返します。``get_config_vars().get(name)`` と同じです。" +"*name* という変数の値を返します。\n" +"``get_config_vars().get(name)`` と同等です。" #: ../../library/sysconfig.rst:52 msgid "If *name* is not found, return ``None``." @@ -106,7 +104,6 @@ msgstr "*name* が見つからない場合、``None`` を返します。" msgid "Example of usage::" msgstr "Example of usage::" -#: ../../library/sysconfig.rst:56 msgid "" ">>> import sysconfig\n" ">>> sysconfig.get_config_var('Py_ENABLE_SHARED')\n" @@ -116,6 +113,13 @@ msgid "" ">>> sysconfig.get_config_vars('AR', 'CXX')\n" "['ar', 'g++']" msgstr "" +">>> import sysconfig\n" +">>> sysconfig.get_config_var('Py_ENABLE_SHARED')\n" +"0\n" +">>> sysconfig.get_config_var('LIBDIR')\n" +"'/usr/local/lib'\n" +">>> sysconfig.get_config_vars('AR', 'CXX')\n" +"['ar', 'g++']" #: ../../library/sysconfig.rst:68 msgid "Installation paths" @@ -143,51 +147,59 @@ msgstr "" "す。これは Python やコンポーネントをインストールするときに使われるデフォルト" "のスキームです。" -#: ../../library/sysconfig.rst:79 msgid "" "*posix_home*: scheme for POSIX platforms, when the *home* option is used. " "This scheme defines paths located under a specific home prefix." msgstr "" +"*posix_home*: *home* オプションを使う場合の POSIX プラットフォーム用スキーム" +"です。\n" +"指定されたホームプレフィックス配下のパスを定義します。" -#: ../../library/sysconfig.rst:81 msgid "" "*posix_user*: scheme for POSIX platforms, when the *user* option is used. " "This scheme defines paths located under the user's home directory (:const:" "`site.USER_BASE`)." msgstr "" +"*posix_user*: *user* オプションを使う場合の POSIX プラットフォーム用スキーム" +"です。\n" +"ユーザーのホームディレクトリ (:const:`site.USER_BASE`) 配下のパスを定義しま" +"す。" -#: ../../library/sysconfig.rst:84 msgid "" "*posix_venv*: scheme for :mod:`Python virtual environments ` on POSIX " "platforms; by default it is the same as *posix_prefix*." msgstr "" +"*posix_venv*: POSIX プラットフォームの :mod:`Python 仮想環境 ` 用スキー" +"ムです。\n" +"デフォルトでは *posix_prefix* と同じです。" -#: ../../library/sysconfig.rst:86 msgid "" "*nt*: scheme for Windows. This is the default scheme used when Python or a " "component is installed." msgstr "" +"*nt*: Windows 用のスキームです。\n" +"Python やコンポーネントをインストールするときに使うデフォルトのスキームです。" -#: ../../library/sysconfig.rst:88 msgid "*nt_user*: scheme for Windows, when the *user* option is used." -msgstr "" +msgstr "*nt_user*: *user* オプションを使う場合の Windows 用スキームです。" -#: ../../library/sysconfig.rst:89 msgid "" "*nt_venv*: scheme for :mod:`Python virtual environments ` on Windows; " "by default it is the same as *nt*." msgstr "" +"*nt_venv*: Windows の :mod:`Python 仮想環境 ` 用スキームです。\n" +"デフォルトでは *nt* と同じです。" -#: ../../library/sysconfig.rst:91 msgid "" "*venv*: a scheme with values from either *posix_venv* or *nt_venv* depending " "on the platform Python runs on." msgstr "" +"*venv*: Python が動作するプラットフォームに応じて、*posix_venv* または " +"*nt_venv* の値を使うスキームです。" -#: ../../library/sysconfig.rst:93 msgid "*osx_framework_user*: scheme for macOS, when the *user* option is used." msgstr "" -"*osx_framework_user* オプションが利用された場合の、macOS 用のスキームです。" +"*osx_framework_user*: *user* オプションを使う場合の macOS 用スキームです。" #: ../../library/sysconfig.rst:95 msgid "" @@ -219,23 +231,26 @@ msgstr "" "*platlib*: プラットフォーム依存の、site ごとのファイルを格納するディレクト" "リ。" -#: ../../library/sysconfig.rst:103 msgid "" "*purelib*: directory for site-specific, non-platform-specific files ('pure' " "Python)." msgstr "" +"*purelib*: サイト固有で、プラットフォームに依存しないファイル (純粋な " +"Python) のためのディレクトリです。" -#: ../../library/sysconfig.rst:104 msgid "" "*include*: directory for non-platform-specific header files for the Python C-" "API." msgstr "" +"*include*: Python C API のプラットフォーム非依存のヘッダーファイル用ディレク" +"トリです。" -#: ../../library/sysconfig.rst:106 msgid "" "*platinclude*: directory for platform-specific header files for the Python C-" "API." msgstr "" +"*platinclude*: Python C API のプラットフォーム依存のヘッダーファイル用ディレ" +"クトリです。" #: ../../library/sysconfig.rst:108 msgid "*scripts*: directory for script files." @@ -245,34 +260,34 @@ msgstr "*scripts*: スクリプトファイルのためのディレクトリ。" msgid "*data*: directory for data files." msgstr "*data*: データファイルのためのディレクトリ。" -#: ../../library/sysconfig.rst:115 msgid "User scheme" -msgstr "" +msgstr "ユーザースキーム" -#: ../../library/sysconfig.rst:117 msgid "" "This scheme is designed to be the most convenient solution for users that " "don't have write permission to the global site-packages directory or don't " "want to install into it." msgstr "" +"このスキームは、グローバルな site-packages ディレクトリへの書き込み権限がない" +"ユーザーや、そこへインストールしたくないユーザーにとって、最も便利な方法にな" +"るように設計されています。" -#: ../../library/sysconfig.rst:121 msgid "" "Files will be installed into subdirectories of :const:`site.USER_BASE` " "(written as :file:`{userbase}` hereafter). This scheme installs pure Python " "modules and extension modules in the same location (also known as :const:" "`site.USER_SITE`)." msgstr "" +"ファイルは :const:`site.USER_BASE` (以下では :file:`{userbase}` と表記) のサ" +"ブディレクトリにインストールされます。\n" +"このスキームでは、純粋な Python のモジュールと拡張モジュールを同じ場所 (:" +"const:`site.USER_SITE` としても知られています) にインストールします。" -#: ../../library/sysconfig.rst:126 msgid "``posix_user``" -msgstr "" +msgstr "``posix_user``" -#: ../../library/sysconfig.rst:129 ../../library/sysconfig.rst:144 -#: ../../library/sysconfig.rst:159 ../../library/sysconfig.rst:187 -#: ../../library/sysconfig.rst:229 ../../library/sysconfig.rst:245 msgid "Path" -msgstr "" +msgstr "パス" #: ../../library/sysconfig.rst:129 ../../library/sysconfig.rst:144 #: ../../library/sysconfig.rst:159 ../../library/sysconfig.rst:187 @@ -280,47 +295,30 @@ msgstr "" msgid "Installation directory" msgstr "インストールディレクトリ" -#: ../../library/sysconfig.rst:131 ../../library/sysconfig.rst:146 -#: ../../library/sysconfig.rst:161 ../../library/sysconfig.rst:189 -#: ../../library/sysconfig.rst:231 ../../library/sysconfig.rst:247 msgid "*stdlib*" -msgstr "" +msgstr "*stdlib*" -#: ../../library/sysconfig.rst:131 ../../library/sysconfig.rst:132 msgid ":file:`{userbase}/lib/python{X.Y}`" -msgstr "" +msgstr ":file:`{userbase}/lib/python{X.Y}`" -#: ../../library/sysconfig.rst:132 ../../library/sysconfig.rst:147 -#: ../../library/sysconfig.rst:162 ../../library/sysconfig.rst:190 -#: ../../library/sysconfig.rst:232 ../../library/sysconfig.rst:248 msgid "*platstdlib*" -msgstr "" +msgstr "*platstdlib*" -#: ../../library/sysconfig.rst:133 ../../library/sysconfig.rst:148 -#: ../../library/sysconfig.rst:163 ../../library/sysconfig.rst:191 -#: ../../library/sysconfig.rst:233 ../../library/sysconfig.rst:249 msgid "*platlib*" -msgstr "" +msgstr "*platlib*" #: ../../library/sysconfig.rst:133 ../../library/sysconfig.rst:134 msgid ":file:`{userbase}/lib/python{X.Y}/site-packages`" msgstr ":file:`{userbase}/lib/python{X.Y}/site-packages`" -#: ../../library/sysconfig.rst:134 ../../library/sysconfig.rst:149 -#: ../../library/sysconfig.rst:164 ../../library/sysconfig.rst:192 -#: ../../library/sysconfig.rst:234 ../../library/sysconfig.rst:250 msgid "*purelib*" -msgstr "" +msgstr "*purelib*" -#: ../../library/sysconfig.rst:135 ../../library/sysconfig.rst:150 -#: ../../library/sysconfig.rst:165 ../../library/sysconfig.rst:193 -#: ../../library/sysconfig.rst:235 ../../library/sysconfig.rst:251 msgid "*include*" -msgstr "" +msgstr "*include*" -#: ../../library/sysconfig.rst:135 ../../library/sysconfig.rst:165 msgid ":file:`{userbase}/include/python{X.Y}`" -msgstr "" +msgstr ":file:`{userbase}/include/python{X.Y}`" #: ../../library/sysconfig.rst:136 ../../library/sysconfig.rst:151 #: ../../library/sysconfig.rst:166 ../../library/sysconfig.rst:195 @@ -343,41 +341,35 @@ msgstr "*data*" msgid ":file:`{userbase}`" msgstr ":file:`{userbase}`" -#: ../../library/sysconfig.rst:141 msgid "``nt_user``" -msgstr "" +msgstr "``nt_user``" -#: ../../library/sysconfig.rst:146 ../../library/sysconfig.rst:147 msgid ":file:`{userbase}\\\\Python{XY}`" -msgstr "" +msgstr ":file:`{userbase}\\\\Python{XY}`" #: ../../library/sysconfig.rst:148 ../../library/sysconfig.rst:149 msgid ":file:`{userbase}\\\\Python{XY}\\\\site-packages`" msgstr ":file:`{userbase}\\\\Python{XY}\\\\site-packages`" -#: ../../library/sysconfig.rst:150 msgid ":file:`{userbase}\\\\Python{XY}\\\\Include`" -msgstr "" +msgstr ":file:`{userbase}\\\\Python{XY}\\\\Include`" #: ../../library/sysconfig.rst:151 msgid ":file:`{userbase}\\\\Python{XY}\\\\Scripts`" msgstr ":file:`{userbase}\\\\Python{XY}\\\\Scripts`" -#: ../../library/sysconfig.rst:156 msgid "``osx_framework_user``" -msgstr "" +msgstr "``osx_framework_user``" #: ../../library/sysconfig.rst:161 ../../library/sysconfig.rst:162 msgid ":file:`{userbase}/lib/python`" -msgstr "" +msgstr ":file:`{userbase}/lib/python`" -#: ../../library/sysconfig.rst:163 ../../library/sysconfig.rst:164 msgid ":file:`{userbase}/lib/python/site-packages`" -msgstr "" +msgstr ":file:`{userbase}/lib/python/site-packages`" -#: ../../library/sysconfig.rst:174 msgid "Home scheme" -msgstr "" +msgstr "ホームスキーム" #: ../../library/sysconfig.rst:176 msgid "" @@ -395,23 +387,19 @@ msgstr "" "トするのはよくあることだからです。とはいえ、このスキームはどのオペレーティン" "グシステムのユーザでも使えます。" -#: ../../library/sysconfig.rst:184 msgid "``posix_home``" -msgstr "" +msgstr "``posix_home``" #: ../../library/sysconfig.rst:189 ../../library/sysconfig.rst:190 #: ../../library/sysconfig.rst:191 ../../library/sysconfig.rst:192 msgid ":file:`{home}/lib/python`" msgstr ":file:`{home}/lib/python`" -#: ../../library/sysconfig.rst:193 ../../library/sysconfig.rst:194 msgid ":file:`{home}/include/python`" -msgstr "" +msgstr ":file:`{home}/include/python`" -#: ../../library/sysconfig.rst:194 ../../library/sysconfig.rst:236 -#: ../../library/sysconfig.rst:252 msgid "*platinclude*" -msgstr "" +msgstr "*platinclude*" #: ../../library/sysconfig.rst:195 msgid ":file:`{home}/bin`" @@ -421,11 +409,9 @@ msgstr ":file:`{home}/bin`" msgid ":file:`{home}`" msgstr ":file:`{home}`" -#: ../../library/sysconfig.rst:203 msgid "Prefix scheme" -msgstr "" +msgstr "プレフィックススキーム" -#: ../../library/sysconfig.rst:205 msgid "" "The \"prefix scheme\" is useful when you wish to use one Python installation " "to perform the build/install (i.e., to run the setup script), but install " @@ -435,15 +421,14 @@ msgid "" "and home schemes come before. However, there are at least two known cases " "where the prefix scheme will be useful." msgstr "" -"あるインストール済みの Python を使ってモジュールのビルド/インストールを (例え" -"ば setup スクリプトを実行して) 行いたいけれども、 別のインストール済みの " -"Python のサードパーティ製モジュール置き場 (あるいは、そう見えるようなディレク" -"トリ構造) に、ビルドされた モジュールをインストールしたい場合には、\"prefix " -"スキーム\" が便利です。そんな作業はまったくありえそうにない、と思うなら、確か" -"にその通りです --- \"home スキーム\" を先に説明したのもそのためです。とはい" -"え、prefix スキームが有用なケースは少なくとも二つあります。" +"ある Python 環境を使ってビルドやインストール (setup スクリプトの実行) を行い" +"ながら、別の Python 環境のサードパーティーモジュール用ディレクトリ (またはそ" +"れに似た構成のディレクトリ) にモジュールをインストールしたい場合、プレフィッ" +"クススキームが便利です。\n" +"少し変わった使い方に思えるかもしれませんが、その通りです。\n" +"そのため、ユーザースキームとホームスキームを先に説明しました。\n" +"それでも、プレフィックススキームが役立つ場面は少なくとも 2 つあります。" -#: ../../library/sysconfig.rst:212 msgid "" "First, consider that many Linux distributions put Python in :file:`/usr`, " "rather than the more traditional :file:`/usr/local`. This is entirely " @@ -452,8 +437,14 @@ msgid "" "source, you probably want them to go in :file:`/usr/local/lib/python2.{X}` " "rather than :file:`/usr/lib/python2.{X}`." msgstr "" +"まず、多くの Linux ディストリビューションは、従来の :file:`/usr/local` ではな" +"く :file:`/usr` に Python を配置します。\n" +"この場合の Python はローカルに追加したものではなく「システム」の一部なので、" +"これはまったく適切です。\n" +"ただし、Python モジュールをソースからインストールする場合は、:file:`/usr/lib/" +"python2.{X}` ではなく :file:`/usr/local/lib/python2.{X}` に配置したいでしょ" +"う。" -#: ../../library/sysconfig.rst:219 msgid "" "Another possibility is a network filesystem where the name used to write to " "a remote directory is different from the name used to read it: for example, " @@ -462,22 +453,25 @@ msgid "" "would have to be installed to, say, :file:`/mnt/{@server}/export/lib/python2." "{X}`." msgstr "" +"もう 1 つは、リモートディレクトリへの書き込み時と読み取り時で、使う名前が異な" +"るネットワークファイルシステムの場合です。\n" +"例えば、:file:`/usr/local/bin/python` としてアクセスする Python インタープリ" +"タが :file:`/usr/local/lib/python2.{X}` でモジュールを検索しても、\n" +"そのモジュールのインストール先には :file:`/mnt/{@server}/export/lib/python2." +"{X}` などを指定する必要がある場合です。" -#: ../../library/sysconfig.rst:226 msgid "``posix_prefix``" -msgstr "" +msgstr "``posix_prefix``" -#: ../../library/sysconfig.rst:231 ../../library/sysconfig.rst:232 msgid ":file:`{prefix}/lib/python{X.Y}`" -msgstr "" +msgstr ":file:`{prefix}/lib/python{X.Y}`" #: ../../library/sysconfig.rst:233 ../../library/sysconfig.rst:234 msgid ":file:`{prefix}/lib/python{X.Y}/site-packages`" msgstr ":file:`{prefix}/lib/python{X.Y}/site-packages`" -#: ../../library/sysconfig.rst:235 ../../library/sysconfig.rst:236 msgid ":file:`{prefix}/include/python{X.Y}`" -msgstr "" +msgstr ":file:`{prefix}/include/python{X.Y}`" #: ../../library/sysconfig.rst:237 msgid ":file:`{prefix}/bin`" @@ -487,29 +481,25 @@ msgstr ":file:`{prefix}/bin`" msgid ":file:`{prefix}`" msgstr ":file:`{prefix}`" -#: ../../library/sysconfig.rst:242 msgid "``nt``" -msgstr "" +msgstr "``nt``" -#: ../../library/sysconfig.rst:247 ../../library/sysconfig.rst:248 msgid ":file:`{prefix}\\\\Lib`" -msgstr "" +msgstr ":file:`{prefix}\\\\Lib`" #: ../../library/sysconfig.rst:249 ../../library/sysconfig.rst:250 msgid ":file:`{prefix}\\\\Lib\\\\site-packages`" msgstr ":file:`{prefix}\\\\Lib\\\\site-packages`" -#: ../../library/sysconfig.rst:251 ../../library/sysconfig.rst:252 msgid ":file:`{prefix}\\\\Include`" -msgstr "" +msgstr ":file:`{prefix}\\\\Include`" #: ../../library/sysconfig.rst:253 msgid ":file:`{prefix}\\\\Scripts`" msgstr ":file:`{prefix}\\\\Scripts`" -#: ../../library/sysconfig.rst:259 msgid "Installation path functions" -msgstr "" +msgstr "インストールパスの関数" #: ../../library/sysconfig.rst:261 msgid "" @@ -525,29 +515,29 @@ msgstr "" "現在 :mod:`sysconfig` でサポートされているすべてのスキームを格納したタプルを" "返します。" -#: ../../library/sysconfig.rst:271 msgid "Return the default scheme name for the current platform." -msgstr "" +msgstr "現在のプラットフォームのデフォルトのスキーム名を返します。" -#: ../../library/sysconfig.rst:273 msgid "" "This function was previously named ``_get_default_scheme()`` and considered " "an implementation detail." msgstr "" +"以前、この関数は ``_get_default_scheme()`` という名前で、実装の詳細とされてい" +"ました。" -#: ../../library/sysconfig.rst:277 msgid "" "When Python runs from a virtual environment, the *venv* scheme is returned." msgstr "" +"Python を仮想環境で実行している場合、*venv* スキームを返すようになりました。" -#: ../../library/sysconfig.rst:283 msgid "" "Return a preferred scheme name for an installation layout specified by *key*." -msgstr "" +msgstr "*key* で指定したインストール構成に適したスキーム名を返します。" -#: ../../library/sysconfig.rst:285 msgid "*key* must be either ``\"prefix\"``, ``\"home\"``, or ``\"user\"``." msgstr "" +"*key* は ``\"prefix\"``、``\"home\"``、``\"user\"`` のいずれかでなければなり" +"ません。" #: ../../library/sysconfig.rst:287 msgid "" @@ -556,13 +546,13 @@ msgid "" "as :func:`get_paths`." msgstr "" -#: ../../library/sysconfig.rst:293 msgid "" "When Python runs from a virtual environment and ``key=\"prefix\"``, the " "*venv* scheme is returned." msgstr "" +"Python を仮想環境で実行していて ``key=\"prefix\"`` の場合、*venv* スキームを" +"返すようになりました。" -#: ../../library/sysconfig.rst:300 msgid "" "Return a dict containing preferred scheme names on the current platform. " "Python implementers and redistributors may add their preferred schemes to " @@ -571,12 +561,20 @@ msgid "" "and language package managers to use, so packages installed by either do not " "mix with those by the other." msgstr "" +"現在のプラットフォームに適したスキーム名を格納した辞書を返します。\n" +"Python の実装者や再配布者は、モジュールレベルのグローバル値 " +"``_INSTALL_SCHEMES`` に独自のスキームを追加し、この関数がそれらの名前を返すよ" +"うに変更できます。\n" +"例えば、システムのパッケージマネージャーと言語のパッケージマネージャーに別々" +"のスキームを用意し、一方がインストールしたパッケージと他方のパッケージが混在" +"しないようにできます。" -#: ../../library/sysconfig.rst:307 msgid "" "End users should not use this function, but :func:`get_default_scheme` and :" "func:`get_preferred_scheme` instead." msgstr "" +"エンドユーザーはこの関数ではなく、:func:`get_default_scheme` と :func:" +"`get_preferred_scheme` を使ってください。" #: ../../library/sysconfig.rst:315 msgid "" @@ -611,15 +609,15 @@ msgstr "" "数に従って格納します。例えば、*nt* スキームでの *stdlib* パスは ``{base}/" "Lib`` になります。" -#: ../../library/sysconfig.rst:330 msgid "" ":func:`get_path` will use the variables returned by :func:`get_config_vars` " "to expand the path. All variables have default values for each platform so " "one may call this function and get the default value." msgstr "" -":func:`get_path` はパスを展開するのに :func:`get_config_vars` が返す変数を利" -"用します。すべての変数は各プラットフォームにおいてデフォルト値を持っていて、" -"この関数を呼び出したときにデフォルト値を取得する場合があります。" +":func:`get_path` は :func:`get_config_vars` が返す変数を使ってパスを展開しま" +"す。\n" +"すべての変数にはプラットフォームごとのデフォルト値があるため、この関数を呼び" +"出せばデフォルトのパスを取得できます。" #: ../../library/sysconfig.rst:334 msgid "" @@ -631,11 +629,12 @@ msgstr "" "でなければなりません。指定されなかった場合は、現在のプラットフォームでのデ" "フォルトスキームが利用されます。" -#: ../../library/sysconfig.rst:338 msgid "" "If *vars* is provided, it must be a dictionary of variables that will update " "the dictionary returned by :func:`get_config_vars`." msgstr "" +"*vars* を指定する場合は、:func:`get_config_vars` が返す辞書を更新する変数の辞" +"書でなければなりません。" #: ../../library/sysconfig.rst:341 msgid "" @@ -700,7 +699,6 @@ msgstr "" msgid "Return a string that identifies the current platform." msgstr "現在のプラットフォームを識別するための文字列を返します。" -#: ../../library/sysconfig.rst:377 msgid "" "This is used mainly to distinguish platform-specific build directories and " "platform-specific built distributions. Typically includes the OS name and " @@ -708,6 +706,11 @@ msgid "" "exact information included depends on the OS; e.g., on Linux, the kernel " "version isn't particularly important." msgstr "" +"主に、プラットフォーム固有のビルドディレクトリや、プラットフォーム固有のビル" +"ド済み配布物を区別するために使われます。\n" +"通常、OS の名前、バージョン、アーキテクチャ (:func:`os.uname` で得られるも" +"の) を含みますが、具体的にどの情報が含まれるかは OS によって異なります。\n" +"例えば Linux では、カーネルのバージョンは特に重要ではありません。" #: ../../library/sysconfig.rst:383 msgid "Examples of returned values:" @@ -729,13 +732,11 @@ msgstr "solaris-2.6-sun4u" msgid "Windows will return one of:" msgstr "Windows では以下のどれかを返します:" -#: ../../library/sysconfig.rst:391 msgid "win-amd64 (64-bit Windows on AMD64, aka x86_64, Intel64, and EM64T)" -msgstr "" +msgstr "win-amd64 (AMD64、別名 x86_64、Intel64、EM64T 上の 64 ビット Windows)" -#: ../../library/sysconfig.rst:392 msgid "win-arm64 (64-bit Windows on ARM64, aka AArch64)" -msgstr "" +msgstr "win-arm64 (ARM64、別名 AArch64 上の 64 ビット Windows)" #: ../../library/sysconfig.rst:393 msgid "win32 (all others - specifically, sys.platform is returned)" @@ -768,16 +769,15 @@ msgstr "" "その他の非 POSIX プラットフォームでは、現在のところ単に :data:`sys.platform` " "を返します。" -#: ../../library/sysconfig.rst:407 msgid "" "Return ``True`` if the running Python interpreter was built from source and " "is being run from its built location, and not from a location resulting from " "e.g. running ``make install`` or installing via a binary installer." msgstr "" -"実行中の Python インタプリタがソースからビルドされ、かつそのビルドされた場所" -"から実行されている場合に ``True`` を返します。\n" -"``make install`` を実行した場所からの実行やバイナリインストーラによるインス" -"トールではいけません。" +"実行中の Python インタープリタがソースからビルドされ、そのビルド場所から実行" +"されている場合は ``True`` を返します。\n" +"``make install`` やバイナリインストーラによるインストール先から実行されている" +"場合は該当しません。" #: ../../library/sysconfig.rst:414 msgid "Parse a :file:`config.h`\\-style file." @@ -818,7 +818,6 @@ msgstr "" "Python の *-m* オプションを使えば、:mod:`sysconfig` をスクリプトとして使用で" "きます:" -#: ../../library/sysconfig.rst:439 msgid "" "$ python -m sysconfig\n" "Platform: \"macosx-10.4-i386\"\n" @@ -842,6 +841,27 @@ msgid "" " ARFLAGS = \"rc\"\n" " ..." msgstr "" +"$ python -m sysconfig\n" +"Platform: \"macosx-10.4-i386\"\n" +"Python version: \"3.2\"\n" +"Current installation scheme: \"posix_prefix\"\n" +"\n" +"Paths:\n" +" data = \"/usr/local\"\n" +" include = \"/Users/tarek/Dev/svn.python.org/py3k/Include\"\n" +" platinclude = \".\"\n" +" platlib = \"/usr/local/lib/python3.2/site-packages\"\n" +" platstdlib = \"/usr/local/lib/python3.2\"\n" +" purelib = \"/usr/local/lib/python3.2/site-packages\"\n" +" scripts = \"/usr/local/bin\"\n" +" stdlib = \"/usr/local/lib/python3.2\"\n" +"\n" +"Variables:\n" +" AC_APPLE_UNIVERSAL_BUILD = \"0\"\n" +" AIX_GENUINE_CPLUSPLUS = \"0\"\n" +" AR = \"ar\"\n" +" ARFLAGS = \"rc\"\n" +" ..." #: ../../library/sysconfig.rst:463 msgid "" diff --git a/library/syslog.po b/library/syslog.po index 55db6f562..0bec13ac4 100644 --- a/library/syslog.po +++ b/library/syslog.po @@ -20,29 +20,27 @@ msgstr "" "Last-Translator: 渋川よしき , 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/syslog.rst:2 msgid ":mod:`!syslog` --- Unix syslog library routines" msgstr ":mod:`!syslog` --- Unix syslog ライブラリルーチン群" -#: ../../library/syslog.rst:10 msgid "" "This module provides an interface to the Unix ``syslog`` library routines. " "Refer to the Unix manual pages for a detailed description of the ``syslog`` " "facility." msgstr "" -"このモジュールでは Unix ``syslog`` ライブラリルーチン群へのインターフェースを" -"提供します。``syslog`` の便宜レベルに関する詳細な記述は Unix マニュアルページ" -"を参照してください。" +"このモジュールは Unix の ``syslog`` ライブラリルーチンへのインターフェースを" +"提供します。\n" +"``syslog`` の機能の詳しい説明は、Unix のマニュアルページを参照してください。" -#: ../../library/syslog.rst:14 msgid "Availability" -msgstr "" +msgstr "利用可能な環境" #: ../../library/syslog.rst:16 msgid "" @@ -58,7 +56,6 @@ msgstr "" msgid "The module defines the following functions:" msgstr "このモジュールには、以下の関数が定義されています:" -#: ../../library/syslog.rst:26 msgid "" "Send the string *message* to the system logger. A trailing newline is added " "if necessary. Each message is tagged with a priority composed of a " @@ -67,12 +64,13 @@ msgid "" "not encoded in *priority* using logical-or (``LOG_INFO | LOG_USER``), the " "value given in the :func:`openlog` call is used." msgstr "" -"文字列 *message* をシステムログ機構に送信します。末尾の改行文字は必要に応じて" -"追加されます。各メッセージは *facility* および *level* からなる優先度でタグ付" -"けされます。オプションの *priority* 引数はメッセージの優先度を定義します。標" -"準の値は :const:`LOG_INFO` です。 *priority* 中に、便宜レベルが (``LOG_INFO " -"| LOG_USER`` のように) 論理和を使ってコード化されていない場合、 :func:" -"`openlog` を呼び出した際の値が使われます。" +"文字列 *message* をシステムロガーに送信します。\n" +"必要に応じて末尾に改行を追加します。\n" +"各メッセージには、*facility* と *level* からなる優先度が付けられます。\n" +"省略可能な *priority* 引数がメッセージの優先度を指定し、デフォルトは :const:" +"`LOG_INFO` です。\n" +"``LOG_INFO | LOG_USER`` のように論理和を使って *priority* にファシリティを組" +"み込んでいなければ、:func:`openlog` の呼び出しで指定した値を使います。" #: ../../library/syslog.rst:33 msgid "" @@ -82,22 +80,22 @@ msgstr "" ":func:`syslog` が呼び出される前に :func:`openlog` が呼び出されなかった場" "合、 :func:`openlog` が引数なしで呼び出されます。" -#: ../../library/syslog.rst:36 msgid "" "Raises an :ref:`auditing event ` ``syslog.syslog`` with arguments " "``priority``, ``message``." msgstr "" "引数 ``priority``, ``message`` を指定して :ref:`監査イベント ` " -"``syslog.syslog`` を送出します。 " +"``syslog.syslog`` を送出します。" -#: ../../library/syslog.rst:38 msgid "" "In previous versions, :func:`openlog` would not be called automatically if " "it wasn't called prior to the call to :func:`syslog`, deferring to the " "syslog implementation to call ``openlog()``." msgstr "" +"以前のバージョンでは、:func:`syslog` より前に :func:`openlog` を呼び出してい" +"なくても、自動では呼び出されませんでした。\n" +"``openlog()`` の呼び出しは syslog の実装に任されていました。" -#: ../../library/syslog.rst:43 msgid "" "This function is restricted in subinterpreters. (Only code that runs in " "multiple interpreters is affected and the restriction is not relevant for " @@ -105,6 +103,11 @@ msgid "" "func:`syslog` may be used in a subinterpreter. Otherwise it will raise :exc:" "`RuntimeError`." msgstr "" +"この関数のサブインタープリタでの使用には制限があります (複数のインタープリタ" +"で実行されるコードだけが影響を受け、ほとんどのユーザーには関係ありません)。\n" +"サブインタープリタで :func:`syslog` を使う前に、メインインタープリタで :func:" +"`openlog` を呼び出す必要があります。\n" +"そうしないと :exc:`RuntimeError` を送出します。" #: ../../library/syslog.rst:53 msgid "" @@ -132,27 +135,28 @@ msgstr "" "ワード引数 (デフォルトは :const:`LOG_USER`) は明示的に facility が encode さ" "れていないメッセージに設定される facility です。" -#: ../../library/syslog.rst:64 msgid "" "Raises an :ref:`auditing event ` ``syslog.openlog`` with arguments " "``ident``, ``logoption``, ``facility``." msgstr "" -"引数 ``ident``, `logoptiona``, ``facility`` を指定して :ref:`監査イベント " -"` ``syslog.openlog`` を送出します。 " +"引数 ``ident``, ``logoption``, ``facility`` を指定して :ref:`監査イベント " +"` ``syslog.openlog`` を送出します。" -#: ../../library/syslog.rst:66 msgid "" "In previous versions, keyword arguments were not allowed, and *ident* was " "required." -msgstr "" +msgstr "以前のバージョンではキーワード引数を使えず、*ident* は必須でした。" -#: ../../library/syslog.rst:70 ../../library/syslog.rst:89 msgid "" "This function is restricted in subinterpreters. (Only code that runs in " "multiple interpreters is affected and the restriction is not relevant for " "most users.) This may only be called in the main interpreter. It will raise :" "exc:`RuntimeError` if called in a subinterpreter." msgstr "" +"この関数のサブインタープリタでの使用には制限があります (複数のインタープリタ" +"で実行されるコードだけが影響を受け、ほとんどのユーザーには関係ありません)。\n" +"メインインタープリタでのみ呼び出せます。\n" +"サブインタープリタで呼び出すと :exc:`RuntimeError` を送出します。" #: ../../library/syslog.rst:80 msgid "" @@ -173,12 +177,11 @@ msgstr "" "したときに、 :func:`openlog` が呼び出され、 *ident* やその他の :func:" "`openlog` の引数はデフォルト値にリセットされます。" -#: ../../library/syslog.rst:87 msgid "" "Raises an :ref:`auditing event ` ``syslog.closelog`` with no " "arguments." msgstr "" -"引数無しで :ref:`監査イベント ` ``syslog.closelog`` を送出します。 " +"引数無しで :ref:`監査イベント ` ``syslog.closelog`` を送出します。" #: ../../library/syslog.rst:99 msgid "" @@ -195,12 +198,11 @@ msgstr "" "*pri* に対する優先度マスクを計算します。関数 ``LOG_UPTO(pri)`` は優先度 " "*pri* までの全ての優先度を含むようなマスクを計算します。" -#: ../../library/syslog.rst:106 msgid "" "Raises an :ref:`auditing event ` ``syslog.setlogmask`` with " "argument ``maskpri``." msgstr "" -"引数 ``maskpri`` を指定して :ref:`監査イベント ` ``socket." +"引数 ``maskpri`` を指定して :ref:`監査イベント ` ``syslog." "setlogmask`` を送出します。" #: ../../library/syslog.rst:108 @@ -211,24 +213,30 @@ msgstr "このモジュールでは以下の定数を定義しています:" msgid "Priority levels (high to low)." msgstr "優先度 (高いものから低いもの) 。" -#: ../../library/syslog.rst:149 msgid "" "Facilities, depending on availability in ```` for :const:" "`LOG_AUTHPRIV`, :const:`LOG_FTP`, :const:`LOG_NETINFO`, :const:" "`LOG_REMOTEAUTH`, :const:`LOG_INSTALL` and :const:`LOG_RAS`." msgstr "" +"ファシリティです。\n" +":const:`LOG_AUTHPRIV`、:const:`LOG_FTP`、:const:`LOG_NETINFO`、:const:" +"`LOG_REMOTEAUTH`、:const:`LOG_INSTALL`、:const:`LOG_RAS` は、```` " +"に定義されている場合に利用できます。" -#: ../../library/syslog.rst:153 msgid "" "Added :const:`LOG_FTP`, :const:`LOG_NETINFO`, :const:`LOG_REMOTEAUTH`, :" "const:`LOG_INSTALL`, :const:`LOG_RAS`, and :const:`LOG_LAUNCHD`." msgstr "" +":const:`LOG_FTP`、:const:`LOG_NETINFO`、:const:`LOG_REMOTEAUTH`、:const:" +"`LOG_INSTALL`、:const:`LOG_RAS`、:const:`LOG_LAUNCHD` が追加されました。" -#: ../../library/syslog.rst:164 msgid "" "Log options, depending on availability in ```` for :const:" "`LOG_ODELAY`, :const:`LOG_NOWAIT` and :const:`LOG_PERROR`." msgstr "" +"ログオプションです。\n" +":const:`LOG_ODELAY`、:const:`LOG_NOWAIT`、:const:`LOG_PERROR` は、```` に定義されている場合に利用できます。" #: ../../library/syslog.rst:169 msgid "Examples" @@ -242,7 +250,6 @@ msgstr "シンプルな例" msgid "A simple set of examples::" msgstr "1つ目のシンプルな例::" -#: ../../library/syslog.rst:176 msgid "" "import syslog\n" "\n" @@ -250,6 +257,11 @@ msgid "" "if error:\n" " syslog.syslog(syslog.LOG_ERR, 'Processing started')" msgstr "" +"import syslog\n" +"\n" +"syslog.syslog('Processing started')\n" +"if error:\n" +" syslog.syslog(syslog.LOG_ERR, 'Processing started')" #: ../../library/syslog.rst:182 msgid "" @@ -260,8 +272,9 @@ msgstr "" "いくつかのログオプションを設定する例。ログメッセージにプロセスIDを含み、メッ" "セージをメールのログ用の facility にメッセージを書きます::" -#: ../../library/syslog.rst:186 msgid "" "syslog.openlog(logoption=syslog.LOG_PID, facility=syslog.LOG_MAIL)\n" "syslog.syslog('E-mail processing initiated...')" msgstr "" +"syslog.openlog(logoption=syslog.LOG_PID, facility=syslog.LOG_MAIL)\n" +"syslog.syslog('E-mail processing initiated...')" diff --git a/library/tabnanny.po b/library/tabnanny.po index a23e53890..b6ac45469 100644 --- a/library/tabnanny.po +++ b/library/tabnanny.po @@ -17,10 +17,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/tabnanny.rst:2 diff --git a/library/tarfile.po b/library/tarfile.po index 2314b8e0d..ab40d4870 100644 --- a/library/tarfile.po +++ b/library/tarfile.po @@ -19,10 +19,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/tarfile.rst:2 @@ -75,34 +75,40 @@ msgstr "" msgid "read/write support for the POSIX.1-2001 (pax) format." msgstr "POSIX.1-2001 (pax) フォーマットの読み書きをサポートしています。" -#: ../../library/tarfile.rst:32 msgid "" "handles directories, regular files, hardlinks, symbolic links, fifos, " "character devices and block devices and is able to acquire and restore file " "information like timestamp, access permissions and owner." msgstr "" -"ディレクトリ、一般ファイル、ハードリンク、シンボリックリンク、fifo、キャラク" -"ターデバイスおよびブロックデバイスを処理します。また、タイムスタンプ、アクセ" -"ス許可や所有者のようなファイル情報の取得および保存が可能です。" +"ディレクトリ、通常ファイル、ハードリンク、シンボリックリンク、FIFO、キャラク" +"ターデバイス、ブロックデバイスを扱えます。\n" +"また、タイムスタンプ、アクセス権、所有者などのファイル情報を取得・復元できま" +"す。" #: ../../library/tarfile.rst:36 msgid "Added support for :mod:`lzma` compression." msgstr ":mod:`lzma` 圧縮をサポートしました。" -#: ../../library/tarfile.rst:39 msgid "" "Archives are extracted using a :ref:`filter `, " "which makes it possible to either limit surprising/dangerous features, or to " "acknowledge that they are expected and the archive is fully trusted." msgstr "" +"アーカイブの展開には :ref:`フィルター ` を使いま" +"す。\n" +"これにより、予想外の動作を招く機能や危険な機能を制限したり、それらの機能が想" +"定内でアーカイブを完全に信頼していると明示したりできます。" -#: ../../library/tarfile.rst:44 msgid "" "Set the default extraction filter to :func:`data `, which " "disallows some dangerous features such as links to absolute paths or paths " "outside of the destination. Previously, the filter strategy was equivalent " "to :func:`fully_trusted `." msgstr "" +"デフォルトの展開フィルターが :func:`data ` になりました。\n" +"絶対パスや展開先の外部を指すリンクなど、危険な機能の一部を許可しません。\n" +"以前のフィルターの動作は :func:`fully_trusted ` と同等" +"でした。" #: ../../library/tarfile.rst:52 msgid "" @@ -143,9 +149,8 @@ msgstr "圧縮方法に関して透過的に、読み込み用にオープンし msgid "``'r:'``" msgstr "``'r:'``" -#: ../../library/tarfile.rst:65 msgid "Open for reading exclusively without compression." -msgstr "非圧縮で読み込み用に排他的にオープンします。" +msgstr "非圧縮のアーカイブだけを読み込み用に開きます。" #: ../../library/tarfile.rst:68 msgid "``'r:gz'``" @@ -291,6 +296,9 @@ msgid "" "bz2'``, :func:`tarfile.open` accepts the keyword argument *compresslevel* " "(default ``9``) to specify the compression level of the file." msgstr "" +"``'w:gz'``、``'x:gz'``、``'w|gz'``、``'w:bz2'``、``'x:bz2'``、``'w|bz2'`` " +"モードの場合、:func:`tarfile.open` はファイルの圧縮レベルを指定するキーワード" +"引数 *compresslevel* (デフォルトは ``9``) を受け付けます。" #: ../../library/tarfile.rst:115 msgid "" @@ -298,8 +306,9 @@ msgid "" "accepts the keyword argument *preset* to specify the compression level of " "the file." msgstr "" +"``'w:xz'``、``'x:xz'`` および ``'w|xz'`` モードの場合、:func:`tarfile.open` " +"はファイルの圧縮レベルを指定するキーワード引数 *preset* を受け付けます。" -#: ../../library/tarfile.rst:118 msgid "" "For special purposes, there is a second format for *mode*: ``'filemode|" "[compression]'``. :func:`tarfile.open` will return a :class:`TarFile` " @@ -312,6 +321,21 @@ msgid "" "However, such a :class:`TarFile` object is limited in that it does not allow " "random access, see :ref:`tar-examples`. The currently possible modes:" msgstr "" +"特別な用途のため、*mode* にはもう 1 つの形式 ``'filemode|[compression]'`` が" +"あります。\n" +":func:`tarfile.open` は、データをブロックのストリームとして処理する :class:" +"`TarFile` オブジェクトを返します。\n" +"ファイル内のランダムなシークは行いません。\n" +"*fileobj* を指定する場合は、バイト列を扱う :meth:`~io.RawIOBase.read` また" +"は :meth:`~io.RawIOBase.write` メソッド (*mode* による) を持つオブジェクトな" +"ら何でも使えます。\n" +"*bufsize* はブロックサイズを指定し、デフォルトは ``20 * 512`` バイトです。\n" +"この形式は、例えば ``sys.stdin.buffer``、ソケットの :term:`ファイルオブジェク" +"ト `、テープデバイスと組み合わせて使います。\n" +"ただし、このような :class:`TarFile` オブジェクトはランダムアクセスができない" +"という制約があります。\n" +":ref:`tar-examples` を参照してください。\n" +"現在使えるモードは次のとおりです:" #: ../../library/tarfile.rst:132 msgid "Mode" @@ -405,13 +429,11 @@ msgid "The *name* parameter accepts a :term:`path-like object`." msgstr "" "*name* パラメタが :term:`path-like object` を受け付けるようになりました。" -#: ../../library/tarfile.rst:167 msgid "The *compresslevel* keyword argument also works for streams." -msgstr "" +msgstr "*compresslevel* キーワード引数がストリームにも使えるようになりました。" -#: ../../library/tarfile.rst:170 msgid "The *preset* keyword argument also works for streams." -msgstr "" +msgstr "*preset* キーワード引数がストリームにも使えるようになりました。" #: ../../library/tarfile.rst:177 msgid "" @@ -482,38 +504,39 @@ msgstr "" ":meth:`TarInfo.frombuf` メソッドが取得したバッファーが不正だったときに送出さ" "れます。" -#: ../../library/tarfile.rst:229 msgid "" "Base class for members :ref:`refused ` by filters." msgstr "" +"フィルターがメンバーを :ref:`拒否 ` したときの例外" +"の基底クラスです。" -#: ../../library/tarfile.rst:234 msgid "" "Information about the member that the filter refused to extract, as :ref:" "`TarInfo `." msgstr "" +"フィルターが展開を拒否したメンバーの情報を表す :ref:`TarInfo ` です。" -#: ../../library/tarfile.rst:239 msgid "Raised to refuse extracting a member with an absolute path." -msgstr "" +msgstr "絶対パスを持つメンバーの展開を拒否するために送出されます。" -#: ../../library/tarfile.rst:243 msgid "Raised to refuse extracting a member outside the destination directory." msgstr "" +"展開先ディレクトリの外部へのメンバーの展開を拒否するために送出されます。" -#: ../../library/tarfile.rst:247 msgid "Raised to refuse extracting a special file (e.g. a device or pipe)." msgstr "" +"特殊ファイル (デバイスやパイプなど) の展開を拒否するために送出されます。" -#: ../../library/tarfile.rst:251 msgid "Raised to refuse extracting a symbolic link with an absolute path." -msgstr "" +msgstr "絶対パスを指すシンボリックリンクの展開を拒否するために送出されます。" -#: ../../library/tarfile.rst:255 msgid "" "Raised to refuse extracting a symbolic link pointing outside the destination " "directory." msgstr "" +"展開先ディレクトリの外部を指すシンボリックリンクの展開を拒否するために送出さ" +"れます。" #: ../../library/tarfile.rst:259 msgid "The following constants are available at the module level:" @@ -527,49 +550,38 @@ msgstr "" "既定の文字エンコーディング。Windows では ``'utf-8'`` 、それ以外では :func:" "`sys.getfilesystemencoding` の返り値です。" -#: ../../library/tarfile.rst:269 msgid "A regular file :attr:`~TarInfo.type`." -msgstr "" +msgstr "通常ファイルを表す :attr:`~TarInfo.type`。" -#: ../../library/tarfile.rst:273 msgid "A link (inside tarfile) :attr:`~TarInfo.type`." -msgstr "" +msgstr "アーカイブ内のリンクを表す :attr:`~TarInfo.type`。" -#: ../../library/tarfile.rst:277 msgid "A symbolic link :attr:`~TarInfo.type`." -msgstr "" +msgstr "シンボリックリンクを表す :attr:`~TarInfo.type`。" -#: ../../library/tarfile.rst:281 msgid "A character special device :attr:`~TarInfo.type`." -msgstr "" +msgstr "キャラクター特殊デバイスを表す :attr:`~TarInfo.type`。" -#: ../../library/tarfile.rst:285 msgid "A block special device :attr:`~TarInfo.type`." -msgstr "" +msgstr "ブロック特殊デバイスを表す :attr:`~TarInfo.type`。" -#: ../../library/tarfile.rst:289 msgid "A directory :attr:`~TarInfo.type`." -msgstr "" +msgstr "ディレクトリを表す :attr:`~TarInfo.type`。" -#: ../../library/tarfile.rst:293 msgid "A FIFO special device :attr:`~TarInfo.type`." -msgstr "" +msgstr "FIFO 特殊デバイスを表す :attr:`~TarInfo.type`。" -#: ../../library/tarfile.rst:297 msgid "A contiguous file :attr:`~TarInfo.type`." -msgstr "" +msgstr "連続ファイルを表す :attr:`~TarInfo.type`。" -#: ../../library/tarfile.rst:301 msgid "A GNU tar longname :attr:`~TarInfo.type`." -msgstr "" +msgstr "GNU tar の longname を表す :attr:`~TarInfo.type`。" -#: ../../library/tarfile.rst:305 msgid "A GNU tar longlink :attr:`~TarInfo.type`." -msgstr "" +msgstr "GNU tar の longlink を表す :attr:`~TarInfo.type`。" -#: ../../library/tarfile.rst:309 msgid "A GNU tar sparse file :attr:`~TarInfo.type`." -msgstr "" +msgstr "GNU tar のスパースファイルを表す :attr:`~TarInfo.type`。" #: ../../library/tarfile.rst:312 msgid "" @@ -683,12 +695,15 @@ msgid "" msgstr "" "以下のすべての引数はオプションで、インスタンス属性としてもアクセスできます。" -#: ../../library/tarfile.rst:379 msgid "" "*name* is the pathname of the archive. *name* may be a :term:`path-like " "object`. It can be omitted if *fileobj* is given. In this case, the file " "object's :attr:`!name` attribute is used if it exists." msgstr "" +"*name* はアーカイブのパス名で、:term:`パス類似オブジェクト ` も指定できます。\n" +"*fileobj* を指定した場合は省略できます。\n" +"その場合、ファイルオブジェクトに :attr:`!name` 属性があればそれを使います。" #: ../../library/tarfile.rst:383 msgid "" @@ -748,17 +763,17 @@ msgstr "" "るファイルの内容がアーカイブに追加されます。シンボリックリンクをサポートして" "いないシステムでは効果がありません。" -#: ../../library/tarfile.rst:407 msgid "" "If *ignore_zeros* is :const:`False`, treat an empty block as the end of the " "archive. If it is :const:`True`, skip empty (and invalid) blocks and try to " "get as many members as possible. This is only useful for reading " "concatenated or damaged archives." msgstr "" -"*ignore_zeros* が :const:`False` だった場合、空ブロックをアーカイブの終端とし" -"て扱います。:const:`True` だった場合、空の (無効な) ブロックをスキップして、" -"可能な限り多くのメンバーを取得しようとします。このオプションは、連結された" -"り、壊れたアーカイブファイルを扱うときにのみ、意味があります。" +"*ignore_zeros* が :const:`False` の場合、空のブロックをアーカイブの終端として" +"扱います。\n" +":const:`True` の場合は、空のブロックと不正なブロックをスキップし、できる限り" +"多くのメンバーを取得しようとします。\n" +"これは、連結されたアーカイブや破損したアーカイブの読み取りにのみ役立ちます。" #: ../../library/tarfile.rst:411 msgid "" @@ -768,23 +783,23 @@ msgstr "" "*debug* は ``0`` (デバッグメッセージ無し) から ``3`` (全デバッグメッセージ) " "まで設定できます。このメッセージは ``sys.stderr`` に書き込まれます。" -#: ../../library/tarfile.rst:414 msgid "" "*errorlevel* controls how extraction errors are handled, see :attr:`the " "corresponding attribute `." msgstr "" +"*errorlevel* は展開時のエラーの処理方法を制御します。\n" +":attr:`対応する属性 ` を参照してください。" -#: ../../library/tarfile.rst:417 msgid "" "The *encoding* and *errors* arguments define the character encoding to be " "used for reading or writing the archive and how conversion errors are going " "to be handled. The default settings will work for most users. See section :" "ref:`tar-unicode` for in-depth information." msgstr "" -"引数 *encoding* および *errors* にはアーカイブの読み書きやエラー文字列の変換" -"に使用する文字エンコーディングを指定します。ほとんどのユーザーはデフォルト設" -"定のままで動作します。詳細に関しては :ref:`tar-unicode` 節を参照してくださ" -"い。" +"*encoding* 引数はアーカイブの読み書きに使う文字エンコーディングを、*errors* " +"引数は文字変換エラーの処理方法を指定します。\n" +"ほとんどのユーザーはデフォルト設定のまま利用できます。\n" +"詳細は :ref:`tar-unicode` 節を参照してください。" #: ../../library/tarfile.rst:422 msgid "" @@ -794,19 +809,19 @@ msgstr "" "引数 *pax_headers* は、オプションの文字列辞書で、*format* が :const:" "`PAX_FORMAT` だった場合に pax グローバルヘッダーに追加されます。" -#: ../../library/tarfile.rst:425 msgid "" "If *stream* is set to :const:`True` then while reading the archive info " "about files in the archive are not cached, saving memory." msgstr "" +"*stream* を :const:`True` にすると、アーカイブの読み取り中に内部のファイルの" +"情報をキャッシュせず、メモリを節約します。" #: ../../library/tarfile.rst:428 ../../library/tarfile.rst:751 msgid "Use ``'surrogateescape'`` as the default for the *errors* argument." msgstr "引数 *errors* のデフォルトが ``'surrogateescape'`` になりました。" -#: ../../library/tarfile.rst:437 msgid "Add the *stream* parameter." -msgstr "" +msgstr "*stream* 引数が追加されました。" #: ../../library/tarfile.rst:442 msgid "" @@ -824,21 +839,20 @@ msgstr "" "メンバー *name* に対する :class:`TarInfo` オブジェクトを返します。*name* が" "アーカイブに見つからなければ、:exc:`KeyError` が送出されます。" -#: ../../library/tarfile.rst:453 msgid "" "If a member occurs more than once in the archive, its last occurrence is " "assumed to be the most up-to-date version." msgstr "" -"アーカイブ内にメンバーが複数ある場合は、最後に出現するものが最新のバージョン" -"とみなされます。" +"アーカイブ内に同じメンバーが複数回現れる場合は、最後に現れるものを最新のバー" +"ジョンとみなします。" -#: ../../library/tarfile.rst:459 msgid "" "Return the members of the archive as a list of :class:`TarInfo` objects. The " "list has the same order as the members in the archive." msgstr "" -":class:`TarInfo` アーカイブのメンバーをオブジェクトのリストとして返します。こ" -"のリストはアーカイブ内のメンバーと同じ順番です。" +"アーカイブのメンバーを :class:`TarInfo` オブジェクトのリストとして返しま" +"す。\n" +"リストの順序は、アーカイブ内のメンバーの順序と同じです。" #: ../../library/tarfile.rst:465 msgid "" @@ -903,7 +917,6 @@ msgstr "" "たファイルのオーナー/グループを設定するために使用されます。False の場合、" "tarfile の名前付きの値が使用されます。" -#: ../../library/tarfile.rst:501 msgid "" "The *filter* argument specifies how ``members`` are modified or rejected " "before extraction. See :ref:`tarfile-extraction-filter` for details. It is " @@ -911,18 +924,27 @@ msgid "" "required, or as ``filter='data'`` to support Python versions with a less " "secure default (3.13 and lower)." msgstr "" +"*filter* 引数は、展開前に ``members`` をどのように変更または拒否するかを指定" +"します。\n" +"詳しくは :ref:`tarfile-extraction-filter` を参照してください。\n" +"この引数を明示的に設定するのは、特定の *tar* の機能が必要な場合、またはデフォ" +"ルトの安全性が低い Python (3.13 以前) に対応するため ``filter='data'`` とする" +"場合だけにすることを推奨します。" -#: ../../library/tarfile.rst:510 msgid "Never extract archives from untrusted sources without prior inspection." -msgstr "" +msgstr "信頼できない提供元のアーカイブは、事前に調べずに展開してはいけません。" -#: ../../library/tarfile.rst:512 msgid "" "Since Python 3.14, the default (:func:`data `) will prevent the " "most dangerous security issues. However, it will not prevent *all* " "unintended or insecure behavior. Read the :ref:`tarfile-extraction-filter` " "section for details." msgstr "" +"Python 3.14 以降、デフォルトの :func:`data ` は最も危険なセキュ" +"リティ上の問題を防ぎます。\n" +"ただし、意図しない動作や安全でない動作の *すべて* を防ぐものではありませ" +"ん。\n" +"詳しくは :ref:`tarfile-extraction-filter` 節を参照してください。" #: ../../library/tarfile.rst:517 ../../library/tarfile.rst:554 msgid "Added the *numeric_owner* parameter." @@ -938,9 +960,8 @@ msgstr "" msgid "Added the *filter* parameter." msgstr "*filter* パラメータが追加されました。" -#: ../../library/tarfile.rst:526 msgid "The *filter* parameter now defaults to ``'data'``." -msgstr "" +msgstr "*filter* 引数のデフォルトが ``'data'`` になりました。" #: ../../library/tarfile.rst:532 msgid "" @@ -957,11 +978,10 @@ msgstr "" "*set_attrs* が false でない限り、ファイルの属性 (所有者、最終更新時刻、モー" "ド) は設定されます。" -#: ../../library/tarfile.rst:538 msgid "" "The *numeric_owner* and *filter* arguments are the same as for :meth:" "`extractall`." -msgstr "" +msgstr "*numeric_owner* 引数と *filter* 引数は :meth:`extractall` と同じです。" #: ../../library/tarfile.rst:543 msgid "" @@ -971,11 +991,12 @@ msgstr "" ":meth:`extract` メソッドはいくつかの展開に関する問題を扱いません。ほとんどの" "場合、:meth:`extractall` メソッドの利用を考慮するべきです。" -#: ../../library/tarfile.rst:548 msgid "" "Never extract archives from untrusted sources without prior inspection. See " "the warning for :meth:`extractall` for details." msgstr "" +"信頼できない提供元のアーカイブは、事前に調べずに展開してはいけません。\n" +"詳しくは :meth:`extractall` の警告を参照してください。" #: ../../library/tarfile.rst:551 msgid "Added the *set_attrs* parameter." @@ -994,20 +1015,19 @@ msgstr "" "*member* が一般ファイルまたはリンクの場合、:class:`io.BufferedReader` オブ" "ジェクトが返されます。\n" "存在するそれ以外のメンバーでは、 :const:`None` が返されます。\n" -"それ以外の場合、:const:`None` が返されます。\n" "アーカイブに *member* が存在しない場合は :exc:`KeyError` が送出されます。" #: ../../library/tarfile.rst:572 msgid "Return an :class:`io.BufferedReader` object." msgstr "戻り値が :class:`io.BufferedReader` オブジェクトになりました。" -#: ../../library/tarfile.rst:575 msgid "" "The returned :class:`io.BufferedReader` object has the :attr:`!mode` " "attribute which is always equal to ``'rb'``." msgstr "" +"返される :class:`io.BufferedReader` オブジェクトに、常に ``'rb'`` となる :" +"attr:`!mode` 属性が追加されました。" -#: ../../library/tarfile.rst:582 msgid "" "If *errorlevel* is ``0``, errors are ignored when using :meth:`TarFile." "extract` and :meth:`TarFile.extractall`. Nevertheless, they appear as error " @@ -1016,44 +1036,60 @@ msgid "" "`FilterError` exceptions. If ``2``, all *non-fatal* errors are raised as :" "exc:`TarError` exceptions as well." msgstr "" +"*errorlevel* が ``0`` の場合、:meth:`TarFile.extract` と :meth:`TarFile." +"extractall` の使用時のエラーを無視します。\n" +"ただし、*debug* が 0 より大きければ、デバッグ出力にエラーメッセージを表示しま" +"す。\n" +"``1`` (デフォルト) の場合は、すべての *致命的な* エラーを :exc:`OSError` また" +"は :exc:`FilterError` 例外として送出します。\n" +"``2`` の場合は、*致命的でない* エラーもすべて :exc:`TarError` 例外として送出" +"します。" -#: ../../library/tarfile.rst:590 msgid "" "Some exceptions, e.g. ones caused by wrong argument types or data " "corruption, are always raised." msgstr "" +"引数の型の誤りやデータの破損によるものなど、常に送出される例外もあります。" -#: ../../library/tarfile.rst:593 msgid "" "Custom :ref:`extraction filters ` should raise :" "exc:`FilterError` for *fatal* errors and :exc:`ExtractError` for *non-fatal* " "ones." msgstr "" +"独自の :ref:`展開フィルター ` は、*致命的な* エ" +"ラーでは :exc:`FilterError` を、*致命的でない* エラーでは :exc:" +"`ExtractError` を送出する必要があります。" -#: ../../library/tarfile.rst:597 msgid "" "Note that when an exception is raised, the archive may be partially " "extracted. It is the user’s responsibility to clean up." msgstr "" +"例外が送出された時点で、アーカイブの一部が展開済みになっている場合がありま" +"す。\n" +"クリーンアップは利用者が行う必要があります。" -#: ../../library/tarfile.rst:604 msgid "" "The :ref:`extraction filter ` used as a default " "for the *filter* argument of :meth:`~TarFile.extract` and :meth:`~TarFile." "extractall`." msgstr "" +":meth:`~TarFile.extract` と :meth:`~TarFile.extractall` の *filter* 引数のデ" +"フォルトとして使う :ref:`展開フィルター ` です。" -#: ../../library/tarfile.rst:608 msgid "" "The attribute may be ``None`` or a callable. String names are not allowed " "for this attribute, unlike the *filter* argument to :meth:`~TarFile.extract`." msgstr "" +"この属性には ``None`` または呼び出し可能オブジェクトを指定できます。\n" +":meth:`~TarFile.extract` の *filter* 引数と異なり、文字列の名前は指定できませ" +"ん。" -#: ../../library/tarfile.rst:612 msgid "" "If ``extraction_filter`` is ``None`` (the default), extraction methods will " "use the :func:`data ` filter by default." msgstr "" +"``extraction_filter`` が ``None`` (デフォルト) の場合、展開メソッドはデフォル" +"トで :func:`data ` フィルターを使います。" #: ../../library/tarfile.rst:615 msgid "" @@ -1065,13 +1101,16 @@ msgid "" "wrapped in :func:`staticmethod` to prevent injection of a ``self`` argument." msgstr "" -#: ../../library/tarfile.rst:625 msgid "" "The default filter is set to :func:`data `, which disallows " "some dangerous features such as links to absolute paths or paths outside of " "the destination. Previously, the default was equivalent to :func:" "`fully_trusted `." msgstr "" +"デフォルトのフィルターが :func:`data ` になりました。\n" +"絶対パスや展開先の外部を指すリンクなど、危険な機能の一部を許可しません。\n" +"以前のデフォルトは :func:`fully_trusted ` と同等でし" +"た。" #: ../../library/tarfile.rst:633 msgid "" @@ -1104,7 +1143,6 @@ msgstr "" msgid "Recursion adds entries in sorted order." msgstr "再帰処理はソートされた順序でエントリーを追加するようになりました。" -#: ../../library/tarfile.rst:653 msgid "" "Add the :class:`TarInfo` object *tarinfo* to the archive. If *tarinfo* " "represents a non zero-size regular file, the *fileobj* argument should be a :" @@ -1112,12 +1150,17 @@ msgid "" "the archive. You can create :class:`TarInfo` objects directly, or by using :" "meth:`gettarinfo`." msgstr "" +":class:`TarInfo` オブジェクト *tarinfo* をアーカイブに追加します。\n" +"*tarinfo* がサイズのゼロでない通常ファイルを表す場合は、*fileobj* 引数に :" +"term:`バイナリファイル ` を指定する必要があり、そこから " +"``tarinfo.size`` バイトを読み取ってアーカイブに追加します。\n" +":class:`TarInfo` オブジェクトは直接作成することも、:meth:`gettarinfo` を使っ" +"て作成することもできます。" -#: ../../library/tarfile.rst:660 msgid "*fileobj* must be given for non-zero-sized regular files." msgstr "" +"サイズのゼロでない通常ファイルには *fileobj* の指定が必須になりました。" -#: ../../library/tarfile.rst:665 msgid "" "Create a :class:`TarInfo` object from the result of :func:`os.stat` or " "equivalent on an existing file. The file is either named by *name*, or " @@ -1127,15 +1170,16 @@ msgid "" "from *fileobj*’s :attr:`~io.FileIO.name` attribute, or the *name* argument. " "The name should be a text string." msgstr "" -":func:`os.stat` の結果か、既存のファイルに相当するものから、:class:`TarInfo` " -"オブジェクトを作成します。このファイルは、*name* で名付けられるか、ファイル記" -"述子を持つ :term:`file object` *fileobj* として指定されます。*name* は :term:" -"`path-like object` でも構いません。 *arcname* が与えられた場合、アーカイブ内" -"のファイルに対して代替名を指定します。与えられない場合、名前は *fileobj* の :" -"attr:`~io.FileIO.name` 属性 *name* 属性から取られます。名前はテキスト文字列に" -"してください。" +"既存のファイルに対する :func:`os.stat` または同等の処理の結果から :class:" +"`TarInfo` オブジェクトを作成します。\n" +"ファイルは *name* で指定するか、ファイル記述子を持つ :term:`file object` を " +"*fileobj* に渡して指定します。\n" +"*name* には :term:`path-like object` も指定できます。\n" +"*arcname* を指定すると、アーカイブ内ではその名前を使用します。\n" +"指定しない場合は、*fileobj* の :attr:`~io.FileIO.name` 属性または *name* 引数" +"から名前を取得します。\n" +"名前はテキスト文字列にしてください。" -#: ../../library/tarfile.rst:674 msgid "" "You can modify some of the :class:`TarInfo`’s attributes before you add it " "using :meth:`addfile`. If the file object is not an ordinary file object " @@ -1144,12 +1188,14 @@ msgid "" "`~gzip.GzipFile`. The :attr:`~TarInfo.name` may also be modified, in which " "case *arcname* could be a dummy string." msgstr "" -":class:`TarInfo` の属性の一部は、:meth:`addfile` を使用して追加する前に修正で" -"きます。ファイルオブジェクトが、ファイルの先頭にある通常のファイルオブジェク" -"トでない場合、 :attr:`~TarInfo.size` などの属性は修正が必要かもしれません。こ" -"れは、 :class:`~gzip.GzipFile` などの属性に当てはまります。:attr:`~TarInfo." -"name` も修正できるかもしれず、この場合、*arcname* はダミーの文字列にすること" -"ができます。" +":meth:`addfile` で追加する前に、:class:`TarInfo` の属性の一部を変更できま" +"す。\n" +"ファイルオブジェクトが、ファイルの先頭に位置する通常のファイルオブジェクトで" +"ない場合は、:attr:`~TarInfo.size` などの属性を変更する必要があるかもしれませ" +"ん。\n" +":class:`~gzip.GzipFile` のようなオブジェクトがこれに当たります。\n" +":attr:`~TarInfo.name` も変更できます。\n" +"その場合、*arcname* はダミーの文字列で構いません。" #: ../../library/tarfile.rst:688 msgid "" @@ -1180,14 +1226,15 @@ msgstr "" "つかのメソッドを提供します。これにはファイルのデータそのものは *含まれません" "* 。" -#: ../../library/tarfile.rst:709 msgid "" ":class:`TarInfo` objects are returned by :class:`TarFile`'s methods :meth:" "`~TarFile.getmember`, :meth:`~TarFile.getmembers` and :meth:`~TarFile." "gettarinfo`." msgstr "" +":class:`TarInfo` オブジェクトは、:class:`TarFile` の :meth:`~TarFile." +"getmember`、:meth:`~TarFile.getmembers`、:meth:`~TarFile.gettarinfo` メソッド" +"が返します。" -#: ../../library/tarfile.rst:713 msgid "" "Modifying the objects returned by :meth:`~TarFile.getmember` or :meth:" "`~TarFile.getmembers` will affect all subsequent operations on the archive. " @@ -1195,6 +1242,10 @@ msgid "" "call the :meth:`~TarInfo.replace` method to create a modified copy in one " "step." msgstr "" +":meth:`~TarFile.getmember` や :meth:`~TarFile.getmembers` が返すオブジェクト" +"を変更すると、その後のアーカイブに対するすべての操作に影響します。\n" +"これを避けたい場合は :mod:`copy.copy() ` を使うか、:meth:`~TarInfo." +"replace` メソッドを呼び出して、変更を加えたコピーを一度に作成できます。" #: ../../library/tarfile.rst:719 msgid "" @@ -1203,28 +1254,27 @@ msgid "" "``None`` differently:" msgstr "" -#: ../../library/tarfile.rst:723 msgid "" "The :meth:`~TarFile.extract` or :meth:`~TarFile.extractall` methods will " "ignore the corresponding metadata, leaving it set to a default." msgstr "" +":meth:`~TarFile.extract` と :meth:`~TarFile.extractall` は、対応するメタデー" +"タを無視し、デフォルト値のままにします。" -#: ../../library/tarfile.rst:725 msgid ":meth:`~TarFile.addfile` will fail." -msgstr "" +msgstr ":meth:`~TarFile.addfile` は失敗します。" -#: ../../library/tarfile.rst:726 msgid ":meth:`~TarFile.list` will print a placeholder string." -msgstr "" +msgstr ":meth:`~TarFile.list` は代わりの文字列を表示します。" #: ../../library/tarfile.rst:730 msgid "Create a :class:`TarInfo` object." msgstr ":class:`TarInfo` オブジェクトを作成します。" -#: ../../library/tarfile.rst:735 msgid "Create and return a :class:`TarInfo` object from string buffer *buf*." msgstr "" -":class:`TarInfo` オブジェクトを文字列バッファー *buf* から作成して返します。" +"バイト列バッファー *buf* から :class:`TarInfo` オブジェクトを作成して返しま" +"す。" #: ../../library/tarfile.rst:737 msgid "Raises :exc:`HeaderError` if the buffer is invalid." @@ -1238,13 +1288,12 @@ msgstr "" ":class:`TarFile` オブジェクトの *tarfile* から、次のメンバーを読み込んで、そ" "れを :class:`TarInfo` オブジェクトとして返します。" -#: ../../library/tarfile.rst:748 msgid "" "Create a string buffer from a :class:`TarInfo` object. For information on " "the arguments see the constructor of the :class:`TarFile` class." msgstr "" -":class:`TarInfo` オブジェクトから文字列バッファーを作成します。引数についての" -"情報は、:class:`TarFile` クラスのコンストラクターを参照してください。" +":class:`TarInfo` オブジェクトからバイト列バッファーを作成します。\n" +"引数については :class:`TarFile` クラスのコンストラクターを参照してください。" #: ../../library/tarfile.rst:755 msgid "A ``TarInfo`` object has the following public data attributes:" @@ -1258,23 +1307,22 @@ msgstr "アーカイブメンバーの名前。" msgid "Size in bytes." msgstr "バイト単位でのサイズ。" -#: ../../library/tarfile.rst:773 msgid "" "Time of last modification in seconds since the :ref:`epoch `, as in :" "attr:`os.stat_result.st_mtime`." msgstr "" +":attr:`os.stat_result.st_mtime` と同じ、:ref:`エポック ` からの秒数で" +"表した最終変更時刻です。" -#: ../../library/tarfile.rst:778 ../../library/tarfile.rst:789 -#: ../../library/tarfile.rst:821 ../../library/tarfile.rst:832 -#: ../../library/tarfile.rst:843 ../../library/tarfile.rst:854 msgid "" "Can be set to ``None`` for :meth:`~TarFile.extract` and :meth:`~TarFile." "extractall`, causing extraction to skip applying this attribute." msgstr "" +":meth:`~TarFile.extract` と :meth:`~TarFile.extractall` では ``None`` に設定" +"でき、その場合は展開時にこの属性を適用しません。" -#: ../../library/tarfile.rst:785 msgid "Permission bits, as for :func:`os.chmod`." -msgstr "" +msgstr ":func:`os.chmod` と同じアクセス権のビットです。" #: ../../library/tarfile.rst:795 msgid "" @@ -1298,12 +1346,15 @@ msgstr "" "リンク先ファイルの名前。これはタイプ :const:`LNKTYPE` と :const:`SYMTYPE` " "の :class:`TarInfo` オブジェクトにだけ存在します。" -#: ../../library/tarfile.rst:808 msgid "" "For symbolic links (``SYMTYPE``), the *linkname* is relative to the " "directory that contains the link. For hard links (``LNKTYPE``), the " "*linkname* is relative to the root of the archive." msgstr "" +"シンボリックリンク (``SYMTYPE``) の *linkname* は、そのリンクを含むディレクト" +"リからの相対パスです。\n" +"ハードリンク (``LNKTYPE``) の *linkname* は、アーカイブのルートからの相対パス" +"です。" #: ../../library/tarfile.rst:817 msgid "User ID of the user who originally stored this member." @@ -1321,52 +1372,50 @@ msgstr "ファイルメンバーを保存した元のユーザーのユーザー msgid "Group name." msgstr "ファイルメンバーを保存した元のユーザーのグループ名。" -#: ../../library/tarfile.rst:861 msgid "Header checksum." -msgstr "" +msgstr "ヘッダーのチェックサム。" -#: ../../library/tarfile.rst:867 msgid "Device major number." -msgstr "" +msgstr "デバイスのメジャー番号。" -#: ../../library/tarfile.rst:873 msgid "Device minor number." -msgstr "" +msgstr "デバイスのマイナー番号。" -#: ../../library/tarfile.rst:879 msgid "The tar header starts here." -msgstr "" +msgstr "tar ヘッダーの開始位置。" -#: ../../library/tarfile.rst:885 msgid "The file's data starts here." -msgstr "" +msgstr "ファイルデータの開始位置。" -#: ../../library/tarfile.rst:890 msgid "Sparse member information." -msgstr "" +msgstr "スパースなメンバーの情報。" #: ../../library/tarfile.rst:896 msgid "" "A dictionary containing key-value pairs of an associated pax extended header." msgstr "pax 拡張ヘッダーに関連付けられた、key-value ペアの辞書。" -#: ../../library/tarfile.rst:904 msgid "" "Return a *new* copy of the :class:`!TarInfo` object with the given " "attributes changed. For example, to return a ``TarInfo`` with the group name " "set to ``'staff'``, use::" msgstr "" +"指定された属性を変更した、:class:`!TarInfo` オブジェクトの *新しい* コピーを" +"返します。\n" +"例えば、グループ名を ``'staff'`` にした ``TarInfo`` を返すには、次のようにし" +"ます。 ::" -#: ../../library/tarfile.rst:908 msgid "new_tarinfo = old_tarinfo.replace(gname='staff')" -msgstr "" +msgstr "new_tarinfo = old_tarinfo.replace(gname='staff')" -#: ../../library/tarfile.rst:910 msgid "" "By default, a deep copy is made. If *deep* is false, the copy is shallow, i." "e. ``pax_headers`` and any custom attributes are shared with the original " "``TarInfo`` object." msgstr "" +"デフォルトでは深いコピーを作成します。\n" +"*deep* が偽の場合は浅いコピーとなり、``pax_headers`` や独自の属性は元の " +"``TarInfo`` オブジェクトと共有されます。" #: ../../library/tarfile.rst:914 msgid "A :class:`TarInfo` object also provides some convenient query methods:" @@ -1374,9 +1423,10 @@ msgstr "" ":class:`TarInfo` オブジェクトは便利な照会用のメソッドもいくつか提供していま" "す:" -#: ../../library/tarfile.rst:919 msgid "Return :const:`True` if the :class:`TarInfo` object is a regular file." msgstr "" +":class:`TarInfo` オブジェクトが通常ファイルを表す場合、:const:`True` を返しま" +"す。" #: ../../library/tarfile.rst:924 msgid "Same as :meth:`isfile`." @@ -1413,11 +1463,9 @@ msgstr "" "キャラクターデバイス、ブロックデバイスあるいは FIFO のいずれかの場合に :" "const:`True` を返します。" -#: ../../library/tarfile.rst:965 msgid "Extraction filters" -msgstr "" +msgstr "展開フィルター" -#: ../../library/tarfile.rst:969 msgid "" "The *tar* format is designed to capture all details of a UNIX-like " "filesystem, which makes it very powerful. Unfortunately, the features make " @@ -1426,225 +1474,266 @@ msgid "" "arbitrary files in various ways (e.g. by using absolute paths, ``..`` path " "components, or symlinks that affect later members)." msgstr "" +"*tar* 形式は、UNIX 系ファイルシステムのあらゆる詳細を記録できるよう設計されて" +"おり、非常に強力です。\n" +"しかし、その機能により、展開時に意図しない動作や、悪意のある動作を引き起こす " +"tar ファイルを簡単に作れてしまいます。\n" +"例えば、絶対パス、パスの ``..`` 要素、後続のメンバーに影響するシンボリックリ" +"ンクなど、さまざまな方法で任意のファイルを上書きできます。" -#: ../../library/tarfile.rst:977 msgid "" "In most cases, the full functionality is not needed. Therefore, *tarfile* " "supports extraction filters: a mechanism to limit functionality, and thus " "mitigate some of the security issues." msgstr "" +"ほとんどの場合、すべての機能は必要ありません。\n" +"そこで *tarfile* は、機能を制限してセキュリティ上の問題の一部を軽減する仕組み" +"として、展開フィルターをサポートしています。" -#: ../../library/tarfile.rst:983 msgid "" "None of the available filters blocks *all* dangerous archive features. Never " "extract archives from untrusted sources without prior inspection. See also :" "ref:`tarfile-further-verification`." msgstr "" +"利用可能なフィルターのどれも、危険なアーカイブの機能を *すべて* 防げるわけで" +"はありません。\n" +"信頼できない提供元のアーカイブは、事前に調べずに展開してはいけません。\n" +":ref:`tarfile-further-verification` も参照してください。" #: ../../library/tarfile.rst:989 msgid ":pep:`706`" -msgstr "" +msgstr ":pep:`706`" -#: ../../library/tarfile.rst:990 msgid "Contains further motivation and rationale behind the design." -msgstr "" +msgstr "設計の動機と根拠をさらに詳しく説明しています。" -#: ../../library/tarfile.rst:992 msgid "" "The *filter* argument to :meth:`TarFile.extract` or :meth:`~TarFile." "extractall` can be:" msgstr "" +":meth:`TarFile.extract` と :meth:`~TarFile.extractall` の *filter* 引数には、" +"次のものを指定できます:" -#: ../../library/tarfile.rst:995 msgid "" "the string ``'fully_trusted'``: Honor all metadata as specified in the " "archive. Should be used if the user trusts the archive completely, or " "implements their own complex verification." msgstr "" +"文字列 ``'fully_trusted'``: アーカイブに指定されたすべてのメタデータをそのま" +"ま適用します。\n" +"利用者がアーカイブを完全に信頼している場合や、独自の複雑な検証を実装している" +"場合に使ってください。" -#: ../../library/tarfile.rst:1000 msgid "" "the string ``'tar'``: Honor most *tar*-specific features (i.e. features of " "UNIX-like filesystems), but block features that are very likely to be " "surprising or malicious. See :func:`tar_filter` for details." msgstr "" +"文字列 ``'tar'``: *tar* 固有の機能 (UNIX 系ファイルシステムの機能) の大部分を" +"そのまま適用しますが、予想外の動作や悪意のある動作につながる可能性が非常に高" +"い機能は拒否します。\n" +"詳しくは :func:`tar_filter` を参照してください。" -#: ../../library/tarfile.rst:1004 msgid "" "the string ``'data'``: Ignore or block most features specific to UNIX-like " "filesystems. Intended for extracting cross-platform data archives. See :func:" "`data_filter` for details." msgstr "" +"文字列 ``'data'``: UNIX 系ファイルシステムに固有の機能の大部分を無視または拒" +"否します。\n" +"クロスプラットフォームのデータアーカイブの展開を想定しています。\n" +"詳しくは :func:`data_filter` を参照してください。" -#: ../../library/tarfile.rst:1008 msgid "``None`` (default): Use :attr:`TarFile.extraction_filter`." -msgstr "" +msgstr "``None`` (デフォルト): :attr:`TarFile.extraction_filter` を使います。" -#: ../../library/tarfile.rst:1010 msgid "" "If that is also ``None`` (the default), the ``'data'`` filter will be used." msgstr "" +"それも ``None`` (デフォルト) の場合は、``'data'`` フィルターを使います。" -#: ../../library/tarfile.rst:1014 msgid "" "The default filter is set to :func:`data `. Previously, the " "default was equivalent to :func:`fully_trusted `." msgstr "" +"デフォルトのフィルターが :func:`data ` になりました。\n" +"以前のデフォルトは :func:`fully_trusted ` と同等でし" +"た。" -#: ../../library/tarfile.rst:1018 msgid "" "A callable which will be called for each extracted member with a :ref:" "`TarInfo ` describing the member and the destination path " "to where the archive is extracted (i.e. the same path is used for all " "members)::" msgstr "" +"展開するメンバーごとに呼び出される、呼び出し可能オブジェクト。\n" +"メンバーを表す :ref:`TarInfo ` と、アーカイブを展開する先の" +"パスを受け取ります (すべてのメンバーに同じパスが渡されます)。 ::" -#: ../../library/tarfile.rst:1023 msgid "filter(member: TarInfo, path: str, /) -> TarInfo | None" -msgstr "" +msgstr "filter(member: TarInfo, path: str, /) -> TarInfo | None" -#: ../../library/tarfile.rst:1025 msgid "" "The callable is called just before each member is extracted, so it can take " "the current state of the disk into account. It can:" msgstr "" +"この呼び出し可能オブジェクトは、各メンバーを展開する直前に呼ばれるため、その" +"時点のディスクの状態を考慮できます。\n" +"次のいずれかの動作を行えます:" -#: ../../library/tarfile.rst:1029 msgid "" "return a :class:`TarInfo` object which will be used instead of the metadata " "in the archive, or" msgstr "" +"アーカイブ内のメタデータの代わりに使う :class:`TarInfo` オブジェクトを返す。" -#: ../../library/tarfile.rst:1031 msgid "return ``None``, in which case the member will be skipped, or" -msgstr "" +msgstr "``None`` を返して、そのメンバーをスキップする。" -#: ../../library/tarfile.rst:1032 msgid "" "raise an exception to abort the operation or skip the member, depending on :" "attr:`~TarFile.errorlevel`. Note that when extraction is aborted, :meth:" "`~TarFile.extractall` may leave the archive partially extracted. It does not " "attempt to clean up." msgstr "" +"例外を送出する。\n" +":attr:`~TarFile.errorlevel` に応じて、処理が中止されるか、そのメンバーがス" +"キップされます。\n" +"展開を中止した場合、:meth:`~TarFile.extractall` はアーカイブの一部を展開した" +"まま残すことがあります。\n" +"クリーンアップは行いません。" -#: ../../library/tarfile.rst:1038 msgid "Default named filters" -msgstr "" +msgstr "組み込みの名前付きフィルター" -#: ../../library/tarfile.rst:1040 msgid "" "The pre-defined, named filters are available as functions, so they can be " "reused in custom filters:" msgstr "" +"あらかじめ定義された名前付きフィルターは関数として利用できるため、独自のフィ" +"ルターで再利用できます:" -#: ../../library/tarfile.rst:1045 msgid "Return *member* unchanged." -msgstr "" +msgstr "*member* を変更せずに返します。" -#: ../../library/tarfile.rst:1047 msgid "This implements the ``'fully_trusted'`` filter." -msgstr "" +msgstr "``'fully_trusted'`` フィルターを実装します。" -#: ../../library/tarfile.rst:1051 msgid "Implements the ``'tar'`` filter." -msgstr "" +msgstr "``'tar'`` フィルターを実装します。" -#: ../../library/tarfile.rst:1053 msgid "Strip leading slashes (``/`` and :data:`os.sep`) from filenames." msgstr "" +"ファイル名の先頭のスラッシュ (``/`` と :data:`os.sep`) を取り除きます。" -#: ../../library/tarfile.rst:1054 msgid "" ":ref:`Refuse ` to extract files with absolute " "paths (in case the name is absolute even after stripping slashes, e.g. ``C:/" "foo`` on Windows). This raises :class:`~tarfile.AbsolutePathError`." msgstr "" +"絶対パスを持つファイルの展開を :ref:`拒否 ` しま" +"す (Windows の ``C:/foo`` など、スラッシュを取り除いても絶対パスである場" +"合)。\n" +":class:`~tarfile.AbsolutePathError` を送出します。" -#: ../../library/tarfile.rst:1058 msgid "" ":ref:`Refuse ` to extract files whose absolute " "path (after following symlinks) would end up outside the destination. This " "raises :class:`~tarfile.OutsideDestinationError`." msgstr "" +"シンボリックリンクをたどった後の絶対パスが展開先の外部になるファイルは、展開" +"を :ref:`拒否 ` します。\n" +":class:`~tarfile.OutsideDestinationError` を送出します。" -#: ../../library/tarfile.rst:1061 msgid "" "Clear high mode bits (setuid, setgid, sticky) and group/other write bits (:" "const:`~stat.S_IWGRP` | :const:`~stat.S_IWOTH`)." msgstr "" +"モードの上位ビット (setuid、setgid、sticky) と、グループおよびその他のユー" +"ザーの書き込みビット (:const:`~stat.S_IWGRP` | :const:`~stat.S_IWOTH`) をクリ" +"アします。" -#: ../../library/tarfile.rst:1064 ../../library/tarfile.rst:1097 msgid "Return the modified ``TarInfo`` member." -msgstr "" +msgstr "変更後の ``TarInfo`` メンバーを返します。" -#: ../../library/tarfile.rst:1068 msgid "" "Implements the ``'data'`` filter. In addition to what ``tar_filter`` does:" msgstr "" +"``'data'`` フィルターを実装します。\n" +"``tar_filter`` の処理に加え、次の処理を行います:" -#: ../../library/tarfile.rst:1071 msgid "" ":ref:`Refuse ` to extract links (hard or soft) " "that link to absolute paths, or ones that link outside the destination." msgstr "" +"絶対パスや展開先の外部を指すリンク (ハードリンクまたはシンボリックリンク) " +"は、展開を :ref:`拒否 ` します。" -#: ../../library/tarfile.rst:1074 msgid "" "This raises :class:`~tarfile.AbsoluteLinkError` or :class:`~tarfile." "LinkOutsideDestinationError`." msgstr "" +":class:`~tarfile.AbsoluteLinkError` または :class:`~tarfile." +"LinkOutsideDestinationError` を送出します。" -#: ../../library/tarfile.rst:1077 msgid "" "Note that such files are refused even on platforms that do not support " "symbolic links." msgstr "" +"シンボリックリンクをサポートしないプラットフォームでも、これらのファイルは拒" +"否されます。" -#: ../../library/tarfile.rst:1080 msgid "" ":ref:`Refuse ` to extract device files (including " "pipes). This raises :class:`~tarfile.SpecialFileError`." msgstr "" +"デバイスファイル (パイプを含む) の展開を :ref:`拒否 ` します。\n" +":class:`~tarfile.SpecialFileError` を送出します。" -#: ../../library/tarfile.rst:1084 msgid "For regular files, including hard links:" -msgstr "" +msgstr "ハードリンクを含む通常ファイルについては:" -#: ../../library/tarfile.rst:1086 msgid "" "Set the owner read and write permissions (:const:`~stat.S_IRUSR` | :const:" "`~stat.S_IWUSR`)." msgstr "" +"所有者の読み取り・書き込み権限 (:const:`~stat.S_IRUSR` | :const:`~stat." +"S_IWUSR`) を設定します。" -#: ../../library/tarfile.rst:1088 msgid "" "Remove the group & other executable permission (:const:`~stat.S_IXGRP` | :" "const:`~stat.S_IXOTH`) if the owner doesn’t have it (:const:`~stat.S_IXUSR`)." msgstr "" +"所有者に実行権限 (:const:`~stat.S_IXUSR`) がなければ、グループとその他のユー" +"ザーの実行権限 (:const:`~stat.S_IXGRP` | :const:`~stat.S_IXOTH`) を取り除きま" +"す。" -#: ../../library/tarfile.rst:1092 msgid "" "For other files (directories), set ``mode`` to ``None``, so that extraction " "methods skip applying permission bits." msgstr "" +"ほかのファイル (ディレクトリ) については、``mode`` を ``None`` に設定し、展開" +"メソッドがアクセス権のビットを適用しないようにします。" -#: ../../library/tarfile.rst:1094 msgid "" "Set user and group info (``uid``, ``gid``, ``uname``, ``gname``) to " "``None``, so that extraction methods skip setting it." msgstr "" +"ユーザーとグループの情報 (``uid``、``gid``、``uname``、``gname``) を " +"``None`` に設定し、展開メソッドがそれらを設定しないようにします。" -#: ../../library/tarfile.rst:1099 msgid "" "Note that this filter does not block *all* dangerous archive features. See :" "ref:`tarfile-further-verification` for details." msgstr "" +"このフィルターは、危険なアーカイブの機能を *すべて* 防ぐものではありませ" +"ん。\n" +"詳しくは :ref:`tarfile-further-verification` を参照してください。" -#: ../../library/tarfile.rst:1106 msgid "Filter errors" -msgstr "" +msgstr "フィルターのエラー" -#: ../../library/tarfile.rst:1108 msgid "" "When a filter refuses to extract a file, it will raise an appropriate " "exception, a subclass of :class:`~tarfile.FilterError`. This will abort the " @@ -1652,142 +1741,163 @@ msgid "" "the error will be logged and the member will be skipped, but extraction will " "continue." msgstr "" +"フィルターがファイルの展開を拒否すると、:class:`~tarfile.FilterError` のサブ" +"クラスである適切な例外を送出します。\n" +":attr:`TarFile.errorlevel` が 1 以上なら、これによって展開を中止します。\n" +"``errorlevel=0`` の場合は、エラーを記録してそのメンバーをスキップし、展開を続" +"けます。" -#: ../../library/tarfile.rst:1118 msgid "Hints for further verification" -msgstr "" +msgstr "追加の検証のヒント" -#: ../../library/tarfile.rst:1120 msgid "" "Even with ``filter='data'``, *tarfile* is not suited for extracting " "untrusted files without prior inspection. Among other issues, the pre-" "defined filters do not prevent denial-of-service attacks. Users should do " "additional checks." msgstr "" +"``filter='data'`` を使っても、*tarfile* は信頼できないファイルを事前の検査な" +"しに展開する用途には適していません。\n" +"特に、あらかじめ定義されたフィルターはサービス拒否攻撃を防ぎません。\n" +"利用者が追加の検査を行う必要があります。" -#: ../../library/tarfile.rst:1125 msgid "Here is an incomplete list of things to consider:" -msgstr "" +msgstr "検討すべき事項の一部を挙げます:" -#: ../../library/tarfile.rst:1127 msgid "" "Extract to a :func:`new temporary directory ` to prevent e." "g. exploiting pre-existing links, and to make it easier to clean up after a " "failed extraction." msgstr "" +":func:`新しい一時ディレクトリ ` に展開してください。\n" +"既存のリンクの悪用などを防げるほか、展開に失敗した後のクリーンアップも容易に" +"なります。" -#: ../../library/tarfile.rst:1130 msgid "" "When working with untrusted data, use external (e.g. OS-level) limits on " "disk, memory and CPU usage." msgstr "" +"信頼できないデータを扱う場合は、ディスク、メモリ、CPU の使用量を外部 (OS レベ" +"ルなど) で制限してください。" -#: ../../library/tarfile.rst:1132 msgid "" "Check filenames against an allow-list of characters (to filter out control " "characters, confusables, foreign path separators, and so on)." msgstr "" +"許可する文字のリストでファイル名を検査してください (制御文字、見分けにくい文" +"字、ほかの環境のパス区切り文字などを除外するため)。" -#: ../../library/tarfile.rst:1135 msgid "" "Check that filenames have expected extensions (discouraging files that " "execute when you “click on them”, or extension-less files like Windows " "special device names)." msgstr "" +"ファイル名の拡張子が想定どおりか確認してください (「クリックすると」実行され" +"るファイルや、Windows の特殊デバイス名のように拡張子のないファイルを避けるた" +"め)。" -#: ../../library/tarfile.rst:1138 msgid "" "Limit the number of extracted files, total size of extracted data, filename " "length (including symlink length), and size of individual files." msgstr "" +"展開するファイル数、展開するデータの合計サイズ、ファイル名の長さ (シンボリッ" +"クリンクの長さを含む)、個々のファイルのサイズを制限してください。" -#: ../../library/tarfile.rst:1140 msgid "Check for files that would be shadowed on case-insensitive filesystems." msgstr "" +"大文字・小文字を区別しないファイルシステムで、ほかのファイルと名前が衝突して" +"隠れてしまうファイルがないか確認してください。" -#: ../../library/tarfile.rst:1142 msgid "Also note that:" -msgstr "" +msgstr "次の点にも注意してください:" -#: ../../library/tarfile.rst:1144 msgid "" "Tar files may contain multiple versions of the same file. Later ones are " "expected to overwrite any earlier ones. This feature is crucial to allow " "updating tape archives, but can be abused maliciously." msgstr "" +"tar ファイルには、同じファイルの複数のバージョンを含められます。\n" +"後のバージョンが前のバージョンを上書きすることを想定しています。\n" +"この機能はテープアーカイブの更新に不可欠ですが、悪用される可能性があります。" -#: ../../library/tarfile.rst:1148 msgid "" "*tarfile* does not protect against issues with “live” data, e.g. an attacker " "tinkering with the destination (or source) directory while extraction (or " "archiving) is in progress." msgstr "" +"*tarfile* は、処理中に変化するデータに起因する問題からは保護しません。\n" +"例えば、展開やアーカイブ作成の途中で、攻撃者が展開先 (または元) のディレクト" +"リを操作する場合です。" -#: ../../library/tarfile.rst:1154 msgid "Supporting older Python versions" -msgstr "" +msgstr "古い Python バージョンへの対応" -#: ../../library/tarfile.rst:1156 msgid "" "Extraction filters were added to Python 3.12, but may be backported to older " "versions as security updates. To check whether the feature is available, use " "e.g. ``hasattr(tarfile, 'data_filter')`` rather than checking the Python " "version." msgstr "" +"展開フィルターは Python 3.12 で追加されましたが、セキュリティ更新として古い" +"バージョンにバックポートされる場合があります。\n" +"機能が利用できるか確認するには、Python のバージョンを調べるのではなく、例え" +"ば ``hasattr(tarfile, 'data_filter')`` を使ってください。" -#: ../../library/tarfile.rst:1161 msgid "" "The following examples show how to support Python versions with and without " "the feature. Note that setting ``extraction_filter`` will affect any " "subsequent operations." msgstr "" +"以下に、この機能がある Python とない Python の両方に対応する例を示します。\n" +"``extraction_filter`` の設定は、その後のすべての操作に影響することに注意して" +"ください。" -#: ../../library/tarfile.rst:1165 msgid "Fully trusted archive::" -msgstr "" +msgstr "完全に信頼するアーカイブの場合。 ::" -#: ../../library/tarfile.rst:1167 msgid "" "my_tarfile.extraction_filter = (lambda member, path: member)\n" "my_tarfile.extractall()" msgstr "" +"my_tarfile.extraction_filter = (lambda member, path: member)\n" +"my_tarfile.extractall()" -#: ../../library/tarfile.rst:1170 msgid "" "Use the ``'data'`` filter if available, but revert to Python 3.11 behavior " "(``'fully_trusted'``) if this feature is not available::" msgstr "" +"``'data'`` フィルターがあれば使い、この機能がなければ Python 3.11 の動作 " +"(``'fully_trusted'``) に戻す場合。 ::" -#: ../../library/tarfile.rst:1173 msgid "" "my_tarfile.extraction_filter = getattr(tarfile, 'data_filter',\n" " (lambda member, path: member))\n" "my_tarfile.extractall()" msgstr "" +"my_tarfile.extraction_filter = getattr(tarfile, 'data_filter',\n" +" (lambda member, path: member))\n" +"my_tarfile.extractall()" -#: ../../library/tarfile.rst:1177 msgid "Use the ``'data'`` filter; *fail* if it is not available::" -msgstr "" +msgstr "``'data'`` フィルターを使い、利用できなければ *失敗させる* 場合。 ::" -#: ../../library/tarfile.rst:1179 msgid "my_tarfile.extractall(filter=tarfile.data_filter)" -msgstr "" +msgstr "my_tarfile.extractall(filter=tarfile.data_filter)" #: ../../library/tarfile.rst:1181 msgid "or::" msgstr "もしくは::" -#: ../../library/tarfile.rst:1183 msgid "" "my_tarfile.extraction_filter = tarfile.data_filter\n" "my_tarfile.extractall()" msgstr "" +"my_tarfile.extraction_filter = tarfile.data_filter\n" +"my_tarfile.extractall()" -#: ../../library/tarfile.rst:1186 msgid "Use the ``'data'`` filter; *warn* if it is not available::" -msgstr "" +msgstr "``'data'`` フィルターを使い、利用できなければ *警告する* 場合。 ::" -#: ../../library/tarfile.rst:1188 msgid "" "if hasattr(tarfile, 'data_filter'):\n" " my_tarfile.extractall(filter='data')\n" @@ -1796,29 +1906,37 @@ msgid "" " warn_the_user('Extracting may be unsafe; consider updating Python')\n" " my_tarfile.extractall()" msgstr "" +"if hasattr(tarfile, 'data_filter'):\n" +" my_tarfile.extractall(filter='data')\n" +"else:\n" +" # 必要がなくなったら、この処理を削除する\n" +" warn_the_user('Extracting may be unsafe; consider updating Python')\n" +" my_tarfile.extractall()" -#: ../../library/tarfile.rst:1197 msgid "Stateful extraction filter example" -msgstr "" +msgstr "状態を持つ展開フィルターの例" -#: ../../library/tarfile.rst:1199 msgid "" "While *tarfile*'s extraction methods take a simple *filter* callable, custom " "filters may be more complex objects with an internal state. It may be useful " "to write these as context managers, to be used like this::" msgstr "" +"*tarfile* の展開メソッドは単純な *filter* 呼び出し可能オブジェクトを受け取り" +"ますが、独自のフィルターは内部状態を持つ、より複雑なオブジェクトにもできま" +"す。\n" +"コンテキストマネージャーとして実装し、次のように使うと便利な場合がありま" +"す。 ::" -#: ../../library/tarfile.rst:1203 msgid "" "with StatefulFilter() as filter_func:\n" " tar.extractall(path, filter=filter_func)" msgstr "" +"with StatefulFilter() as filter_func:\n" +" tar.extractall(path, filter=filter_func)" -#: ../../library/tarfile.rst:1206 msgid "Such a filter can be written as, for example::" -msgstr "" +msgstr "このようなフィルターは、例えば次のように書けます。 ::" -#: ../../library/tarfile.rst:1208 msgid "" "class StatefulFilter:\n" " def __init__(self):\n" @@ -1834,6 +1952,19 @@ msgid "" " def __exit__(self, *exc_info):\n" " print(f'{self.file_count} files extracted')" msgstr "" +"class StatefulFilter:\n" +" def __init__(self):\n" +" self.file_count = 0\n" +"\n" +" def __enter__(self):\n" +" return self\n" +"\n" +" def __call__(self, member, path):\n" +" self.file_count += 1\n" +" return member\n" +"\n" +" def __exit__(self, *exc_info):\n" +" print(f'{self.file_count} files extracted')" #: ../../library/tarfile.rst:1228 msgid "Command-Line Interface" @@ -1847,25 +1978,22 @@ msgstr "" ":mod:`tarfile` モジュールは、 tar アーカイブを操作するための簡単なコマンドラ" "インインターフェースを提供しています。" -#: ../../library/tarfile.rst:1235 msgid "" "If you want to create a new tar archive, specify its name after the :option:" "`-c` option and then list the filename(s) that should be included:" msgstr "" -"tar アーカイブを新規に作成したい場合、:option:`-c` オプションの後にまとめたい" -"ファイル名のリストを指定してください:" +"新しい tar アーカイブを作成するには、:option:`-c` オプションの直後にアーカイ" +"ブ名を指定し、その後に格納するファイル名を並べます。" -#: ../../library/tarfile.rst:1238 msgid "$ python -m tarfile -c monty.tar spam.txt eggs.txt" -msgstr "" +msgstr "$ python -m tarfile -c monty.tar spam.txt eggs.txt" #: ../../library/tarfile.rst:1242 msgid "Passing a directory is also acceptable:" msgstr "ディレクトリを渡すこともできます:" -#: ../../library/tarfile.rst:1244 msgid "$ python -m tarfile -c monty.tar life-of-brian_1979/" -msgstr "" +msgstr "$ python -m tarfile -c monty.tar life-of-brian_1979/" #: ../../library/tarfile.rst:1248 msgid "" @@ -1875,9 +2003,8 @@ msgstr "" "tar アーカイブをカレントディレクトリに展開したい場合、:option:`-e` オプション" "を使用してください:" -#: ../../library/tarfile.rst:1251 msgid "$ python -m tarfile -e monty.tar" -msgstr "" +msgstr "$ python -m tarfile -e monty.tar" #: ../../library/tarfile.rst:1255 msgid "" @@ -1887,18 +2014,16 @@ msgstr "" "ディレクトリ名を渡すことで tar アーカイブを別のディレクトリに取り出すこともで" "きます:" -#: ../../library/tarfile.rst:1258 msgid "$ python -m tarfile -e monty.tar other-dir/" -msgstr "" +msgstr "$ python -m tarfile -e monty.tar other-dir/" #: ../../library/tarfile.rst:1262 msgid "For a list of the files in a tar archive, use the :option:`-l` option:" msgstr "" "tar アーカイブ内のファイル一覧を表示するには :option:`-l` を使用してください:" -#: ../../library/tarfile.rst:1264 msgid "$ python -m tarfile -l monty.tar" -msgstr "" +msgstr "$ python -m tarfile -l monty.tar" #: ../../library/tarfile.rst:1270 msgid "Command-line options" @@ -1927,12 +2052,14 @@ msgstr "tarfile が有効かどうか調べます。" msgid "Verbose output." msgstr "詳細も出力します。" -#: ../../library/tarfile.rst:1298 msgid "" "Specifies the *filter* for ``--extract``. See :ref:`tarfile-extraction-" "filter` for details. Only string names are accepted (that is, " "``fully_trusted``, ``tar``, and ``data``)." msgstr "" +"``--extract`` の *filter* を指定します。\n" +"詳しくは :ref:`tarfile-extraction-filter` を参照してください。\n" +"文字列の名前 (``fully_trusted``、``tar``、``data``) だけを受け付けます。" #: ../../library/tarfile.rst:1306 msgid "Examples" @@ -1942,13 +2069,16 @@ msgstr "使用例" msgid "How to extract an entire tar archive to the current working directory::" msgstr "tar アーカイブから現在のディレクトリにすべて抽出する方法::" -#: ../../library/tarfile.rst:1310 msgid "" "import tarfile\n" "tar = tarfile.open(\"sample.tar.gz\")\n" "tar.extractall(filter='data')\n" "tar.close()" msgstr "" +"import tarfile\n" +"tar = tarfile.open(\"sample.tar.gz\")\n" +"tar.extractall(filter='data')\n" +"tar.close()" #: ../../library/tarfile.rst:1315 msgid "" @@ -1958,7 +2088,6 @@ msgstr "" "tar アーカイブの一部を、リストの代わりにジェネレーター関数を利用して :meth:" "`TarFile.extractall` で展開する方法::" -#: ../../library/tarfile.rst:1318 msgid "" "import os\n" "import tarfile\n" @@ -1972,12 +2101,22 @@ msgid "" "tar.extractall(members=py_files(tar))\n" "tar.close()" msgstr "" +"import os\n" +"import tarfile\n" +"\n" +"def py_files(members):\n" +" for tarinfo in members:\n" +" if os.path.splitext(tarinfo.name)[1] == \".py\":\n" +" yield tarinfo\n" +"\n" +"tar = tarfile.open(\"sample.tar.gz\")\n" +"tar.extractall(members=py_files(tar))\n" +"tar.close()" #: ../../library/tarfile.rst:1330 msgid "How to create an uncompressed tar archive from a list of filenames::" msgstr "非圧縮 tar アーカイブをファイル名のリストから作成する方法::" -#: ../../library/tarfile.rst:1332 msgid "" "import tarfile\n" "tar = tarfile.open(\"sample.tar\", \"w\")\n" @@ -1985,27 +2124,34 @@ msgid "" " tar.add(name)\n" "tar.close()" msgstr "" +"import tarfile\n" +"tar = tarfile.open(\"sample.tar\", \"w\")\n" +"for name in [\"foo\", \"bar\", \"quux\"]:\n" +" tar.add(name)\n" +"tar.close()" #: ../../library/tarfile.rst:1338 msgid "The same example using the :keyword:`with` statement::" msgstr ":keyword:`with` 文を利用した同じ例::" -#: ../../library/tarfile.rst:1340 msgid "" "import tarfile\n" "with tarfile.open(\"sample.tar\", \"w\") as tar:\n" " for name in [\"foo\", \"bar\", \"quux\"]:\n" " tar.add(name)" msgstr "" +"import tarfile\n" +"with tarfile.open(\"sample.tar\", \"w\") as tar:\n" +" for name in [\"foo\", \"bar\", \"quux\"]:\n" +" tar.add(name)" -#: ../../library/tarfile.rst:1345 msgid "" "How to read a gzip compressed tar archive and display some member " "information::" msgstr "" -"gzip 圧縮 tar アーカイブを作成してメンバー情報のいくつかを表示する方法::" +"gzip 圧縮された tar アーカイブを読み取り、メンバーの情報の一部を表示する方" +"法。 ::" -#: ../../library/tarfile.rst:1347 msgid "" "import tarfile\n" "tar = tarfile.open(\"sample.tar.gz\", \"r:gz\")\n" @@ -2020,6 +2166,18 @@ msgid "" " print(\"something else.\")\n" "tar.close()" msgstr "" +"import tarfile\n" +"tar = tarfile.open(\"sample.tar.gz\", \"r:gz\")\n" +"for tarinfo in tar:\n" +" print(tarinfo.name, \"is\", tarinfo.size, \"bytes in size and is \", " +"end=\"\")\n" +" if tarinfo.isreg():\n" +" print(\"a regular file.\")\n" +" elif tarinfo.isdir():\n" +" print(\"a directory.\")\n" +" else:\n" +" print(\"something else.\")\n" +"tar.close()" #: ../../library/tarfile.rst:1359 msgid "" @@ -2029,7 +2187,6 @@ msgstr "" ":meth:`TarFile.add` 関数の *filter* 引数を利用してユーザー情報をリセットしな" "がらアーカイブを作成する方法::" -#: ../../library/tarfile.rst:1362 msgid "" "import tarfile\n" "def reset(tarinfo):\n" @@ -2040,6 +2197,14 @@ msgid "" "tar.add(\"foo\", filter=reset)\n" "tar.close()" msgstr "" +"import tarfile\n" +"def reset(tarinfo):\n" +" tarinfo.uid = tarinfo.gid = 0\n" +" tarinfo.uname = tarinfo.gname = \"root\"\n" +" return tarinfo\n" +"tar = tarfile.open(\"sample.tar.gz\", \"w:gz\")\n" +"tar.add(\"foo\", filter=reset)\n" +"tar.close()" #: ../../library/tarfile.rst:1375 msgid "Supported tar formats" @@ -2077,7 +2242,6 @@ msgstr "" "ルは長いファイル名を完全にサポートしています。 スパースファイルは読み込みのみ" "サポートしています。" -#: ../../library/tarfile.rst:1389 msgid "" "The POSIX.1-2001 pax format (:const:`PAX_FORMAT`). It is the most flexible " "format with virtually no limits. It supports long filenames and linknames, " @@ -2087,8 +2251,17 @@ msgid "" "but should treat *pax* archives as if they were in the universally supported " "*ustar* format. It is the current default format for new archives." msgstr "" +"POSIX.1-2001 pax 形式 (:const:`PAX_FORMAT`)。\n" +"最も柔軟で、事実上制限のない形式です。\n" +"長いファイル名とリンク名、大きなファイルをサポートし、移植性のある方法でパス" +"名を格納します。\n" +"GNU tar、bsdtar/libarchive、star を含む現代の tar 実装は、拡張された *pax* の" +"機能を完全にサポートします。\n" +"古いライブラリや保守されていないライブラリにはサポートしないものもあります" +"が、*pax* アーカイブを、広くサポートされている *ustar* 形式として扱うはずで" +"す。\n" +"現在、新しいアーカイブのデフォルトの形式です。" -#: ../../library/tarfile.rst:1397 msgid "" "It extends the existing *ustar* format with extra headers for information " "that cannot be stored otherwise. There are two flavours of pax headers: " @@ -2096,6 +2269,12 @@ msgid "" "valid for the complete archive and affect all following files. All the data " "in a pax header is encoded in *UTF-8* for portability reasons." msgstr "" +"既存の *ustar* 形式を拡張し、そのままでは格納できない情報を追加のヘッダーに格" +"納します。\n" +"pax ヘッダーには 2 種類あります。\n" +"拡張ヘッダーは直後のファイルヘッダーにのみ影響し、グローバルヘッダーはアーカ" +"イブ全体に有効で、後続のすべてのファイルに影響します。\n" +"pax ヘッダーのデータは、移植性のためすべて *UTF-8* でエンコードされます。" #: ../../library/tarfile.rst:1403 msgid "" @@ -2130,7 +2309,6 @@ msgstr "" msgid "Unicode issues" msgstr "Unicode に関する問題" -#: ../../library/tarfile.rst:1419 msgid "" "The tar format was originally conceived to make backups on tape drives with " "the main focus on preserving file system information. Nowadays tar archives " @@ -2144,17 +2322,19 @@ msgid "" "encoding of an archive. The pax format was designed to solve this problem. " "It stores non-ASCII metadata using the universal character encoding *UTF-8*." msgstr "" -"tar フォーマットは、もともとテープドライブにファイルシステムのバックアップを" -"とる目的で設計されました。現在、tarアーカイブはファイルを配布する際に一般的に" -"用いられ、ネットワーク上で交換されています。オリジナルフォーマットが抱える一" -"つの問題は (他の多くのフォーマットでも同じですが)、様々な文字エンコーディング" -"のサポートについて考慮していないことです。例えば、*UTF-8* システム上で作成さ" -"れた通常の tar アーカイブは、非 *ASCII* 文字を含んでいた場合、*Latin-1* シス" -"テムでは正しく読み取ることができません。テキストのメタデータ (ファイル名、リ" -"ンク名、ユーザー/グループ名など) は破壊されます。残念なことに、アーカイブのエ" -"ンコーディングを自動検出する方法はありません。pax フォーマットはこの問題を解" -"決するために設計されました。これは非 ASCII メタデータをユニバーサル文字エン" -"コーディング *UTF-8* を使用して格納します。" +"tar 形式は、ファイルシステムの情報の保持を主な目的として、テープドライブに" +"バックアップを作成するために考案されました。\n" +"現在、tar アーカイブはファイルの配布やネットワーク上でのアーカイブの交換によ" +"く使われます。\n" +"元の形式 (ほかのすべての形式の基になったもの) の問題の 1 つは、異なる文字エン" +"コーディングを扱う概念がないことです。\n" +"例えば *UTF-8* のシステムで作成された通常の tar アーカイブに非 *ASCII* 文字が" +"含まれていると、*Latin-1* のシステムでは正しく読み取れません。\n" +"ファイル名、リンク名、ユーザー名、グループ名などのテキストのメタデータが文字" +"化けして見えます。\n" +"残念ながら、アーカイブのエンコーディングを自動検出する方法はありません。\n" +"pax 形式はこの問題を解決するために設計され、非 ASCII のメタデータを共通の文字" +"エンコーディング *UTF-8* で格納します。" #: ../../library/tarfile.rst:1431 msgid "" @@ -2178,17 +2358,17 @@ msgstr "" "デコードまたはエンコードしなければなりません。*encoding* に適切な値が設定され" "ていない場合、その変換は失敗することがあります。" -#: ../../library/tarfile.rst:1440 msgid "" "The *errors* argument defines how characters are treated that cannot be " "converted. Possible values are listed in section :ref:`error-handlers`. The " "default scheme is ``'surrogateescape'`` which Python also uses for its file " "system calls, see :ref:`os-filenames`." msgstr "" -"引数 *errors* は文字を変換できない時の扱いを指定します。指定できる値は :ref:" -"`error-handlers` 節を参照してください。デフォルトのスキームは " -"``'surrogateescape'`` で、Python はそのファイルシステムの呼び出しも使用しま" -"す。:ref:`os-filenames` を参照してください。" +"*errors* 引数は、変換できない文字の扱い方を指定します。\n" +"指定できる値は :ref:`error-handlers` 節を参照してください。\n" +"デフォルトは ``'surrogateescape'`` で、Python のファイルシステム操作でも使わ" +"れます。\n" +":ref:`os-filenames` を参照してください。" #: ../../library/tarfile.rst:1445 msgid "" diff --git a/library/telnetlib.po b/library/telnetlib.po index 9995582c8..3bc5402f0 100644 --- a/library/telnetlib.po +++ b/library/telnetlib.po @@ -12,15 +12,14 @@ msgstr "" "PO-Revision-Date: 2024-11-19 01:03+0000\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" -#: ../../library/telnetlib.rst:2 msgid ":mod:`!telnetlib` --- Telnet client" -msgstr "" +msgstr ":mod:`!telnetlib` --- Telnet クライアント" #: ../../library/telnetlib.rst:10 msgid "" @@ -28,16 +27,22 @@ msgid "" "`removed in Python 3.13 ` after being deprecated in " "Python 3.11. The removal was decided in :pep:`594`." msgstr "" +"このモジュールは今や Python 標準ライブラリの一部ではありません。このモジュー" +"ルは Python 3.11 で非推奨となったあと、:ref:`Python 3.13 で削除` されました。削除の決定は :pep:`594` でなされました。" -#: ../../library/telnetlib.rst:14 msgid "" "Possible replacements are third-party libraries from PyPI: :pypi:" "`telnetlib3` or :pypi:`Exscript`. These are not supported or maintained by " "the Python core team." msgstr "" +"代替として、PyPI のサードパーティーライブラリ :pypi:`telnetlib3` や :pypi:" +"`Exscript` があります。\n" +"これらは Python コアチームがサポート・保守しているものではありません。" -#: ../../library/telnetlib.rst:18 msgid "" "The last version of Python that provided the :mod:`!telnetlib` module was " "`Python 3.12 `_." msgstr "" +":mod:`!telnetlib` モジュールを提供していた最後のバージョンは `Python 3.12 " +"`_ です。" diff --git a/library/tempfile.po b/library/tempfile.po index e58667768..f2e2bdee3 100644 --- a/library/tempfile.po +++ b/library/tempfile.po @@ -20,10 +20,10 @@ msgstr "" "Last-Translator: Takanori Suzuki , 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/tempfile.rst:2 @@ -43,6 +43,14 @@ msgid "" "managers `. :func:`mkstemp` and :func:`mkdtemp` are lower-" "level functions which require manual cleanup." msgstr "" +"このモジュールは一時ファイルやディレクトリを作成します。\n" +"サポートされている全てのプラットフォームで動作します。\n" +":class:`TemporaryFile`、:class:`NamedTemporaryFile`、:class:" +"`TemporaryDirectory`、 :class:`SpooledTemporaryFile` は自動的に後始末をし、:" +"term:`context managers コンテキストマネージャ` として使うこ" +"との出来る高水準のインターフェイスです。\n" +":func:`mkstemp` と :func:`mkdtemp` は手動で後始末をしなければならない低水準の" +"関数です。" #: ../../library/tempfile.rst:24 msgid "" @@ -95,6 +103,10 @@ msgid "" "`tempfile-examples`). On completion of the context or destruction of the " "file object the temporary file will be removed from the filesystem." msgstr "" +"返されたオブジェクトを :term:`コンテキストマネージャ ` とし" +"て使うことができます (:ref:`tempfile-examples` を参照してください)。\n" +"コンテキストの完了やファイルオブジェクトの破壊で、一時ファイルはファイルシス" +"テムから削除されます。" #: ../../library/tempfile.rst:49 msgid "" @@ -135,51 +147,52 @@ msgid "" "The :py:const:`os.O_TMPFILE` flag is used if it is available and works " "(Linux-specific, requires Linux kernel 3.11 or later)." msgstr "" +":py:const:`os.O_TMPFILE` フラグは、利用可能で動作する場合に用いられます " +"(Linux 固有で、Linux kernel 3.11 以降)。" #: ../../library/tempfile.rst:65 msgid "" "On platforms that are neither Posix nor Cygwin, TemporaryFile is an alias " "for NamedTemporaryFile." msgstr "" +"プラットフォームが Posix でも Cygwin でもない場合は、TemporaryFile は " +"NamedTemporaryFile の別名です。" -#: ../../library/tempfile.rst:68 ../../library/tempfile.rst:137 -#: ../../library/tempfile.rst:264 msgid "" "Raises an :ref:`auditing event ` ``tempfile.mkstemp`` with " "argument ``fullpath``." msgstr "" "引数 ``fullpath`` を指定して :ref:`監査イベント ` ``tempfile." -"mkstemp`` を送出します。 " +"mkstemp`` を送出します。" #: ../../library/tempfile.rst:72 msgid "The :py:const:`os.O_TMPFILE` flag is now used if available." -msgstr "" +msgstr "利用可能であれば :py:const:`os.O_TMPFILE` フラグが使用されます。" #: ../../library/tempfile.rst:74 ../../library/tempfile.rst:139 #: ../../library/tempfile.rst:169 msgid "Added *errors* parameter." msgstr "*errors* 引数が追加されました。" -#: ../../library/tempfile.rst:80 msgid "" "This function operates exactly as :func:`TemporaryFile` does, except the " "following differences:" -msgstr "" +msgstr "以下の点を除き、:func:`TemporaryFile` と同じように動作します:" -#: ../../library/tempfile.rst:83 msgid "" "This function returns a file that is guaranteed to have a visible name in " "the file system." -msgstr "" +msgstr "返されるファイルには、ファイルシステム上で見える名前が必ずあります。" -#: ../../library/tempfile.rst:85 msgid "" "To manage the named file, it extends the parameters of :func:`TemporaryFile` " "with *delete* and *delete_on_close* parameters that determine whether and " "how the named file should be automatically deleted." msgstr "" +"名前付きファイルを管理するために、:func:`TemporaryFile` の引数に *delete* と " +"*delete_on_close* を追加しています。\n" +"これらは、名前付きファイルを自動で削除するかどうかと、その方法を指定します。" -#: ../../library/tempfile.rst:89 msgid "" "The returned object is always a :term:`file-like object` whose :attr:`!file` " "attribute is the underlying true file object. This file-like object can be " @@ -189,8 +202,14 @@ msgid "" "the directory entry does not get unlinked immediately after the file " "creation." msgstr "" +"戻り値は常に :term:`ファイル類似オブジェクト ` で、その :" +"attr:`!file` 属性が基となる実際のファイルオブジェクトです。\n" +"通常のファイルと同じように :keyword:`with` 文で使えます。\n" +"一時ファイルの名前は、返されたファイル類似オブジェクトの :attr:`!name` 属性か" +"ら取得できます。\n" +"Unix では :func:`TemporaryFile` と異なり、ファイルの作成直後にディレクトリエ" +"ントリが削除されることはありません。" -#: ../../library/tempfile.rst:97 msgid "" "If *delete* is true (the default) and *delete_on_close* is true (the " "default), the file is deleted as soon as it is closed. If *delete* is true " @@ -199,8 +218,15 @@ msgid "" "not always guaranteed in this case (see :meth:`object.__del__`). If *delete* " "is false, the value of *delete_on_close* is ignored." msgstr "" +"*delete* が真 (デフォルト) で *delete_on_close* も真 (デフォルト) の場合、" +"ファイルを閉じるとすぐに削除します。\n" +"*delete* が真で *delete_on_close* が偽の場合は、コンテキストマネージャーを終" +"了するとき、または :term:`ファイル類似オブジェクト ` をファ" +"イナライズするときに削除します。\n" +"この場合、削除は常に保証されるわけではありません (:meth:`object.__del__` を参" +"照)。\n" +"*delete* が偽の場合、*delete_on_close* の値は無視します。" -#: ../../library/tempfile.rst:104 msgid "" "Therefore to use the name of the temporary file to reopen the file after " "closing it, either make sure not to delete the file upon closure (set the " @@ -209,34 +235,37 @@ msgid "" "false. The latter approach is recommended as it provides assistance in " "automatic cleaning of the temporary file upon the context manager exit." msgstr "" +"したがって、一時ファイルを閉じた後で、その名前を使って再び開くには、閉じる際" +"に削除しないようにする (*delete* 引数を偽にする) か、\n" +":keyword:`with` 文で一時ファイルを作成する場合は *delete_on_close* 引数を偽に" +"してください。\n" +"後者ではコンテキストマネージャーの終了時に一時ファイルの自動クリーンアップが" +"行われるため、この方法を推奨します。" -#: ../../library/tempfile.rst:111 msgid "" "Opening the temporary file again by its name while it is still open works as " "follows:" msgstr "" +"一時ファイルを開いたまま、その名前を使って再び開く場合の動作は次のとおりです:" -#: ../../library/tempfile.rst:114 msgid "On POSIX the file can always be opened again." -msgstr "" +msgstr "POSIX では常に再び開けます。" -#: ../../library/tempfile.rst:115 msgid "" "On Windows, make sure that at least one of the following conditions are " "fulfilled:" -msgstr "" +msgstr "Windows では、次の条件のうち少なくとも 1 つを満たす必要があります:" -#: ../../library/tempfile.rst:118 msgid "*delete* is false" -msgstr "" +msgstr "*delete* が偽である" -#: ../../library/tempfile.rst:119 msgid "" "additional open shares delete access (e.g. by calling :func:`os.open` with " "the flag ``O_TEMPORARY``)" msgstr "" +"追加のオープンが削除アクセスを共有する (例えば、``O_TEMPORARY`` フラグを指定" +"して :func:`os.open` を呼び出す)" -#: ../../library/tempfile.rst:121 msgid "" "*delete* is true but *delete_on_close* is false. Note, that in this case the " "additional opens that do not share delete access (e.g. created via builtin :" @@ -244,8 +273,13 @@ msgid "" "func:`os.unlink` call on context manager exit will fail with a :exc:" "`PermissionError`." msgstr "" +"*delete* が真で *delete_on_close* が偽である。\n" +"ただし、この場合は、削除アクセスを共有せずに追加で開いたファイル (例えば、組" +"み込み関数 :func:`open` で開いたもの) を、コンテキストマネージャーを終了する" +"前に閉じる必要があります。\n" +"そうしないと、終了時の :func:`os.unlink` 呼び出しが :exc:`PermissionError` で" +"失敗します。" -#: ../../library/tempfile.rst:127 msgid "" "On Windows, if *delete_on_close* is false, and the file is created in a " "directory for which the user lacks delete access, then the :func:`os.unlink` " @@ -254,16 +288,24 @@ msgid "" "requested by the open, which fails immediately if the requested access is " "not granted." msgstr "" +"Windows では、*delete_on_close* が偽で、ユーザーに削除アクセス権のないディレ" +"クトリにファイルを作成した場合、\n" +"コンテキストマネージャーの終了時の :func:`os.unlink` 呼び出しが :exc:" +"`PermissionError` で失敗します。\n" +"*delete_on_close* が真の場合は、ファイルを開く際に削除アクセスを要求し、それ" +"が許可されなければ直ちに失敗するため、この問題は起こりません。" -#: ../../library/tempfile.rst:134 msgid "" "On POSIX (only), a process that is terminated abruptly with SIGKILL cannot " "automatically delete any NamedTemporaryFiles it created." msgstr "" +"POSIX では、SIGKILL で突然終了させられたプロセスは、作成した " +"NamedTemporaryFile を自動的に削除できません。\n" +"これは POSIX に限った話です。" #: ../../library/tempfile.rst:142 msgid "Added *delete_on_close* parameter." -msgstr "" +msgstr "*delete_on_close* 引数が追加されました。" #: ../../library/tempfile.rst:148 msgid "" @@ -273,12 +315,20 @@ msgid "" "contents are written to disk and operation proceeds as with :func:" "`TemporaryFile`." msgstr "" +"このクラスはファイルサイズが *max_size* を超えるかファイルの :func:`~io." +"IOBase.fileno` メソッドが呼ばれるまで、データがメモリにスプールされる点以外" +"は :func:`TemporaryFile` と正確に同じことを行います。\n" +"上記条件を満たすと内容はディスクに書き込まれ、操作は :func:`TemporaryFile` と" +"同様に進みます。" #: ../../library/tempfile.rst:156 msgid "" "The resulting file has one additional method, :meth:`!rollover`, which " "causes the file to roll over to an on-disk file regardless of its size." msgstr "" +"この関数が返すファイルは、追加で1つのメソッド :meth:`!rollover` を持っていま" +"す。このメソッドが呼ばれると、(サイズに関係なく)メモリからディスクへのロール" +"オーバーが実行されます。" #: ../../library/tempfile.rst:159 msgid "" @@ -288,17 +338,26 @@ msgid "" "depending on whether :meth:`rollover` has been called. This file-like " "object can be used in a :keyword:`with` statement, just like a normal file." msgstr "" +"返されたオブジェクトはファイル様オブジェクトで、その :attr:`!_file` 属性は " +"(バイナリかテキスト *mode* が指定されたかどうかに依存して) :class:`io." +"BytesIO` か :class:`io.TextIOWrapper` オブジェクト、あるいは :meth:" +"`rollover` が呼ばれたかどうかに依存して本物のファイルオブジェクトになりま" +"す。\n" +"このファイル様オブジェクトは、通常のファイルオブジェクトと同じように :" +"keyword:`with` 文中で使用することが出来ます。" #: ../../library/tempfile.rst:166 msgid "the truncate method now accepts a *size* argument." -msgstr "" +msgstr "truncate メソッドが *size* 引数を受け取るようになりました。" -#: ../../library/tempfile.rst:172 msgid "" "Fully implements the :class:`io.BufferedIOBase` and :class:`io.TextIOBase` " "abstract base classes (depending on whether binary or text *mode* was " "specified)." msgstr "" +"バイナリとテキストのどちらの *mode* を指定したかに応じて、抽象基底クラス :" +"class:`io.BufferedIOBase` または :class:`io.TextIOBase` を完全に実装するよう" +"になりました。" #: ../../library/tempfile.rst:180 msgid "" @@ -308,6 +367,11 @@ msgid "" "destruction of the temporary directory object, the newly created temporary " "directory and all its contents are removed from the filesystem." msgstr "" +"このクラスは :func:`mkdtemp` と同じルールを使用して安全に一時ディレクトリを作" +"成します。返されたオブジェクトは、:term:`コンテキストマネージャ ` として使用することができます (:ref:`tempfile-examples` を参照)。コ" +"ンテキストの完了や一時ディレクトリオブジェクトを破壊すると、新規作成された一" +"時ディレクトリとその中身はファイルシステムから削除されます。" #: ../../library/tempfile.rst:188 msgid "" @@ -316,8 +380,11 @@ msgid "" "manager`, the :attr:`!name` will be assigned to the target of the :keyword:`!" "as` clause in the :keyword:`with` statement, if there is one." msgstr "" +"ディレクトリ名は返されたオブジェクトの :attr:`!name` 属性から取得できます。返" +"されたオブジェクトが :term:`コンテキストマネージャ ` として" +"使用された場合、 :attr:`!name` は :keyword:`with` 文内の :keyword:`!as` 節の" +"ターゲットがあればそれに割り当てられます。" -#: ../../library/tempfile.rst:195 msgid "" "The directory can be explicitly cleaned up by calling the :meth:`!cleanup` " "method. If *ignore_cleanup_errors* is true, any unhandled exceptions during " @@ -328,8 +395,15 @@ msgid "" "manager, when the object is garbage-collected or during interpreter " "shutdown)." msgstr "" +":meth:`!cleanup` メソッドを呼び出して、ディレクトリを明示的にクリーンアップで" +"きます。\n" +"*ignore_cleanup_errors* が真の場合、明示的または暗黙のクリーンアップ中に処理" +"されなかった例外 (Windows で開いたファイルを削除する際の :exc:" +"`PermissionError` など) を無視し、残りの項目も削除できる限り削除します。\n" +"そうでなければ、クリーンアップが行われた文脈 (:meth:`!cleanup` の呼び出し、コ" +"ンテキストマネージャーの終了、オブジェクトのガベージコレクション、インタープ" +"リタの終了) でエラーを送出します。" -#: ../../library/tempfile.rst:204 msgid "" "The *delete* parameter can be used to disable cleanup of the directory tree " "upon exiting the context. While it may seem unusual for a context manager " @@ -337,14 +411,18 @@ msgid "" "during debugging or when you need your cleanup behavior to be conditional " "based on other logic." msgstr "" +"*delete* 引数を使うと、コンテキストの終了時にディレクトリツリーをクリーンアッ" +"プしないようにできます。\n" +"コンテキストマネージャーが終了時の処理を無効にできるのは変わって見えるかもし" +"れませんが、デバッグ中や、ほかのロジックに応じてクリーンアップを行うかどうか" +"を決めたい場合に役立ちます。" -#: ../../library/tempfile.rst:210 ../../library/tempfile.rst:290 msgid "" "Raises an :ref:`auditing event ` ``tempfile.mkdtemp`` with " "argument ``fullpath``." msgstr "" "引数 ``fullpath`` を指定して :ref:`監査イベント ` ``tempfile." -"mkdtemp`` を送出します。 " +"mkdtemp`` を送出します。" #: ../../library/tempfile.rst:214 msgid "Added *ignore_cleanup_errors* parameter." @@ -352,7 +430,7 @@ msgstr "*ignore_cleanup_errors* 引数が追加されました。" #: ../../library/tempfile.rst:217 msgid "Added the *delete* parameter." -msgstr "" +msgstr "*delete* パラメータが追加されました。" #: ../../library/tempfile.rst:223 msgid "" @@ -500,11 +578,11 @@ msgstr "" msgid ":func:`mkdtemp` returns the absolute pathname of the new directory." msgstr ":func:`mkdtemp` は新たに生成されたディレクトリの絶対パス名を返します。" -#: ../../library/tempfile.rst:301 msgid "" ":func:`mkdtemp` now always returns an absolute path, even if *dir* is " "relative." msgstr "" +"*dir* が相対パスでも、:func:`mkdtemp` は常に絶対パスを返すようになりました。" #: ../../library/tempfile.rst:307 msgid "" @@ -567,11 +645,13 @@ msgstr "" "この検索の結果はキャッシュされます。以下の :data:`tempdir` の記述を参照してく" "ださい。" -#: ../../library/tempfile.rst:335 msgid "" "Always returns a str. Previously it would return any :data:`tempdir` value " "regardless of type so long as it was not ``None``." msgstr "" +"常に str を返すようになりました。\n" +"以前は :data:`tempdir` が ``None`` でなければ、その型を問わず値を返していまし" +"た。" #: ../../library/tempfile.rst:340 msgid "Same as :func:`gettempdir` but the return value is in bytes." @@ -589,7 +669,6 @@ msgstr "" msgid "Same as :func:`gettempprefix` but the return value is in bytes." msgstr ":func:`gettempprefix` と同じですが返り値は bytes です。" -#: ../../library/tempfile.rst:355 msgid "" "The module uses a global variable to store the name of the directory used " "for temporary files returned by :func:`gettempdir`. It can be set directly " @@ -598,13 +677,23 @@ msgid "" "directory. This is the recommended approach that does not surprise other " "unsuspecting code by changing global API behavior." msgstr "" +"このモジュールは、:func:`gettempdir` が返す一時ファイル用ディレクトリの名前を" +"グローバル変数に格納します。\n" +"直接設定してディレクトリの選択処理を上書きできますが、推奨しません。\n" +"このモジュールのすべての関数には、ディレクトリを指定する *dir* 引数がありま" +"す。\n" +"こちらを使う方法を推奨します。\n" +"API 全体の動作を変えずに済むため、その変更を想定していないほかのコードに影響" +"を及ぼしません。" -#: ../../library/tempfile.rst:364 msgid "" "When set to a value other than ``None``, this variable defines the default " "value for the *dir* argument to the functions defined in this module, " "including its type, bytes or str. It cannot be a :term:`path-like object`." msgstr "" +"この変数を ``None`` 以外に設定すると、このモジュールの関数の *dir* 引数のデ" +"フォルト値を、bytes または str という型も含めて指定します。\n" +":term:`パス類似オブジェクト ` は指定できません。" #: ../../library/tempfile.rst:369 msgid "" @@ -616,7 +705,6 @@ msgstr "" "上記のいずれかの関数を呼び出す際は常に :func:`gettempdir` で述べられているア" "ルゴリズムによって初期化されます。" -#: ../../library/tempfile.rst:375 msgid "" "Beware that if you set ``tempdir`` to a bytes value, there is a nasty side " "effect: The global default return type of :func:`mkstemp` and :func:" @@ -625,6 +713,13 @@ msgid "" "expecting or depending on this. This awkward behavior is maintained for " "compatibility with the historical implementation." msgstr "" +"``tempdir`` を bytes の値に設定すると、厄介な副作用があることに注意してくださ" +"い。\n" +"str 型の ``prefix``、``suffix``、``dir`` 引数を明示的に指定しなかった場合、:" +"func:`mkstemp` と :func:`mkdtemp` の戻り値のデフォルトの型が、全体として " +"bytes に変わります。\n" +"この動作を期待したり、この動作に依存したりするコードは書かないでください。\n" +"この扱いづらい動作は、過去の実装との互換性のために維持されています。" #: ../../library/tempfile.rst:386 msgid "Examples" @@ -634,7 +729,6 @@ msgstr "使用例" msgid "Here are some examples of typical usage of the :mod:`tempfile` module::" msgstr ":mod:`tempfile` モジュールの典型的な使用法のいくつかの例を挙げます::" -#: ../../library/tempfile.rst:390 msgid "" ">>> import tempfile\n" "\n" @@ -676,6 +770,45 @@ msgid "" ">>>\n" "# directory and contents have been removed" msgstr "" +">>> import tempfile\n" +"\n" +"# 一時ファイルを作成してデータを書き込む\n" +">>> fp = tempfile.TemporaryFile()\n" +">>> fp.write(b'Hello world!')\n" +"# ファイルからデータを読み取る\n" +">>> fp.seek(0)\n" +">>> fp.read()\n" +"b'Hello world!'\n" +"# ファイルを閉じると削除される\n" +">>> fp.close()\n" +"\n" +"# コンテキストマネージャーを使って一時ファイルを作成する\n" +">>> with tempfile.TemporaryFile() as fp:\n" +"... fp.write(b'Hello world!')\n" +"... fp.seek(0)\n" +"... fp.read()\n" +"b'Hello world!'\n" +">>>\n" +"# ファイルは閉じられ、削除されている\n" +"\n" +"# コンテキストマネージャーを使って一時ファイルを作成する\n" +"# ファイルを閉じ、名前を使って再び開く\n" +">>> with tempfile.NamedTemporaryFile(delete_on_close=False) as fp:\n" +"... fp.write(b'Hello world!')\n" +"... fp.close()\n" +"... # ファイルは閉じられているが、削除されていない\n" +"... # 名前を使ってファイルを再び開く\n" +"... with open(fp.name, mode='rb') as f:\n" +"... f.read()\n" +"b'Hello world!'\n" +">>>\n" +"# ファイルは削除されている\n" +"\n" +"# コンテキストマネージャーを使って一時ディレクトリを作成する\n" +">>> with tempfile.TemporaryDirectory() as tmpdirname:\n" +"... print('created temporary directory', tmpdirname)\n" +">>>\n" +"# ディレクトリとその内容は削除されている" #: ../../library/tempfile.rst:433 msgid "Deprecated functions and variables" @@ -743,6 +876,15 @@ msgid "" ">>> os.path.exists(f.name)\n" "False" msgstr "" +">>> f = NamedTemporaryFile(delete=False)\n" +">>> f.name\n" +"'/tmp/tmptjujjt'\n" +">>> f.write(b\"Hello World!\\n\")\n" +"13\n" +">>> f.close()\n" +">>> os.unlink(f.name)\n" +">>> os.path.exists(f.name)\n" +"False" #: ../../library/tempfile.rst:11 msgid "temporary" diff --git a/library/termios.po b/library/termios.po index fa506291f..76d4b5ea9 100644 --- a/library/termios.po +++ b/library/termios.po @@ -19,10 +19,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/termios.rst:2 @@ -42,9 +42,8 @@ msgstr "" "*termios* 形式の端末制御をサポートしていてインストール時に有効にした Unix の" "バージョンでのみ利用可能です。" -#: ../../library/termios.rst:19 msgid "Availability" -msgstr "" +msgstr "利用可能な環境" #: ../../library/termios.rst:21 msgid "" @@ -56,17 +55,17 @@ msgstr "" "この値は、 ``sys.stdin.fileno()`` が返すような整数のファイル記述子でも、 " "``sys.stdin`` 自体のような :term:`file object` でもかまいません。" -#: ../../library/termios.rst:25 msgid "" "This module also defines all the constants needed to work with the functions " "provided here; these have the same name as their counterparts in C. Please " "refer to your system documentation for more information on using these " "terminal control interfaces." msgstr "" -"このモジュールではまた、モジュールで提供されている関数を使う上で必要となる全" -"ての定数を定義しています; これらの定数は C の対応する関数と同じ名前を持ってい" -"ます。これらの端末制御インターフェースを利用する上でのさらなる情報について" -"は、あなたのシステムのドキュメンテーションを参考にしてください。" +"このモジュールでは、ここで提供する関数を使うために必要なすべての定数も定義し" +"ています。\n" +"定数の名前は C の対応する定数と同じです。\n" +"これらの端末制御インターフェースの使い方については、システムのドキュメントを" +"参照してください。" #: ../../library/termios.rst:30 msgid "The module defines the following functions:" @@ -90,26 +89,27 @@ msgstr "" "は、 :mod:`termios` で定義されているシンボル定数を使って行わなければなりませ" "ん。" -#: ../../library/termios.rst:46 msgid "" "Set the tty attributes for file descriptor *fd* from the *attributes*, which " "is a list like the one returned by :func:`tcgetattr`. The *when* argument " "determines when the attributes are changed:" msgstr "" +"ファイル記述子 *fd* の tty 属性を *attributes* に設定します。\n" +"*attributes* は :func:`tcgetattr` が返すものと同じ形式のリストです。\n" +"属性を変更するタイミングは *when* 引数で指定します。" -#: ../../library/termios.rst:52 msgid "Change attributes immediately." -msgstr "" +msgstr "属性を直ちに変更します。" -#: ../../library/termios.rst:56 msgid "Change attributes after transmitting all queued output." -msgstr "" +msgstr "キューにある出力をすべて送信してから属性を変更します。" -#: ../../library/termios.rst:60 msgid "" "Change attributes after transmitting all queued output and discarding all " "queued input." msgstr "" +"キューにある出力をすべて送信し、キューにある入力をすべて破棄してから属性を変" +"更します。" #: ../../library/termios.rst:66 msgid "" @@ -125,15 +125,15 @@ msgid "" "Wait until all output written to file descriptor *fd* has been transmitted." msgstr "ファイル記述子 *fd* に書き込まれた全ての出力が転送されるまで待ちます。" -#: ../../library/termios.rst:77 msgid "" "Discard queued data on file descriptor *fd*. The *queue* selector specifies " "which queue: :const:`TCIFLUSH` for the input queue, :const:`TCOFLUSH` for " "the output queue, or :const:`TCIOFLUSH` for both queues." msgstr "" -"ファイル記述子 *fd* にキューされたデータを無視します。どのキューかは *queue* " -"セレクタで指定します: :const:`TCIFLUSH` は入力キュー、 :const:`TCOFLUSH` は出" -"力キュー、 :const:`TCIOFLUSH` は両方のキューです。" +"ファイル記述子 *fd* にキューに入っているデータを破棄します。\n" +"どのキューかは *queue* セレクタで指定します: :const:`TCIFLUSH` は入力" +"キュー、 :const:`TCOFLUSH` は出力キュー、 :const:`TCIOFLUSH` は両方のキューで" +"す。" #: ../../library/termios.rst:84 msgid "" @@ -146,14 +146,15 @@ msgstr "" "る :const:`TCOON` 、入力をサスペンドする :const:`TCIOFF` 、入力をレジュームす" "る :const:`TCION` をとることができます。" -#: ../../library/termios.rst:91 msgid "" "Return a tuple ``(ws_row, ws_col)`` containing the tty window size for file " "descriptor *fd*. Requires :const:`termios.TIOCGWINSZ` or :const:`termios." "TIOCGSIZE`." msgstr "" +"ファイル記述子 *fd* の tty ウィンドウサイズを表すタプル ``(ws_row, ws_col)`` " +"を返します。\n" +":const:`termios.TIOCGWINSZ` または :const:`termios.TIOCGSIZE` が必要です。" -#: ../../library/termios.rst:100 msgid "" "Set the tty window size for file descriptor *fd* from *winsize*, which is a " "two-item tuple ``(ws_row, ws_col)`` like the one returned by :func:" @@ -161,6 +162,12 @@ msgid "" "TIOCGWINSZ`, :const:`termios.TIOCSWINSZ`); (:const:`termios.TIOCGSIZE`, :" "const:`termios.TIOCSSIZE`) to be defined." msgstr "" +"ファイル記述子 *fd* の tty ウィンドウサイズを *winsize* に設定します。\n" +"*winsize* は :func:`tcgetwinsize` が返すものと同じ形式の、2 要素のタプル " +"``(ws_row, ws_col)`` です。\n" +"(:const:`termios.TIOCGWINSZ`, :const:`termios.TIOCSWINSZ`) と (:const:" +"`termios.TIOCGSIZE`, :const:`termios.TIOCSSIZE`) のうち、少なくとも一方の組が" +"定義されている必要があります。" #: ../../library/termios.rst:111 msgid "Module :mod:`tty`" @@ -174,18 +181,17 @@ msgstr "一般的な端末制御操作のための便利な関数。" msgid "Example" msgstr "使用例" -#: ../../library/termios.rst:120 msgid "" "Here's a function that prompts for a password with echoing turned off. Note " "the technique using a separate :func:`tcgetattr` call and a :keyword:" "`try` ... :keyword:`finally` statement to ensure that the old tty attributes " "are restored exactly no matter what happens::" msgstr "" -"以下はエコーバックを切った状態でパスワード入力を促す関数です。ユーザの入力に" -"関わらず以前の端末属性を正確に回復するために、二つの :func:`tcgetattr` と :" -"keyword:`try` ... :keyword:`finally` 文によるテクニックが使われています::" +"以下はエコーバックを切った状態でパスワード入力を促す関数です。\n" +"何が起きても元の tty 属性を正確に復元できるように、:func:`tcgetattr` を別々に" +"呼び出し、:keyword:`try` ... :keyword:`finally` 文を使う手法に注目してくださ" +"い。 ::" -#: ../../library/termios.rst:125 msgid "" "def getpass(prompt=\"Password: \"):\n" " import termios, sys\n" @@ -200,6 +206,18 @@ msgid "" " termios.tcsetattr(fd, termios.TCSADRAIN, old)\n" " return passwd" msgstr "" +"def getpass(prompt=\"Password: \"):\n" +" import termios, sys\n" +" fd = sys.stdin.fileno()\n" +" old = termios.tcgetattr(fd)\n" +" new = termios.tcgetattr(fd)\n" +" new[3] = new[3] & ~termios.ECHO # lflags\n" +" try:\n" +" termios.tcsetattr(fd, termios.TCSADRAIN, new)\n" +" passwd = input(prompt)\n" +" finally:\n" +" termios.tcsetattr(fd, termios.TCSADRAIN, old)\n" +" return passwd" #: ../../library/termios.rst:8 msgid "POSIX" diff --git a/library/test.po b/library/test.po index f4e79a060..bfccea0eb 100644 --- a/library/test.po +++ b/library/test.po @@ -20,15 +20,14 @@ msgstr "" "Last-Translator: tomo, 2023\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" -#: ../../library/test.rst:2 msgid ":mod:`!test` --- Regression tests package for Python" -msgstr "" +msgstr ":mod:`!test` --- Python の回帰テストパッケージ" #: ../../library/test.rst:10 msgid "" @@ -90,7 +89,6 @@ msgstr "ドキュメンテーション文字列に埋め込まれたテスト。 msgid "Writing Unit Tests for the :mod:`test` package" msgstr ":mod:`test` パッケージのためのユニットテストを書く" -#: ../../library/test.rst:44 msgid "" "It is preferred that tests that use the :mod:`unittest` module follow a few " "guidelines. One is to name the test module by starting it with ``test_`` and " @@ -104,21 +102,24 @@ msgid "" "exist and thus what test is being run is not stated." msgstr "" ":mod:`unittest` モジュールを使ってテストを書く場合、幾つかのガイドラインに従" -"うことが推奨されます。 1つは、テストモジュールの名前を、 ``test_`` で始め、テ" -"スト対象となるモジュール名で終えることです。テストモジュール中のテストメソッ" -"ドは名前を ``test_`` で始めて、そのメソッドが何をテストしているかという説明で" -"終えます。これはテスト実行プログラムが、そのメソッドをテストメソッドとして認" -"識するために必要です。また、テストメソッドにはドキュメンテーション文字列を入" -"れるべきではありません。コメント(例えば ``# True あるいは False だけを返すテ" -"スト関数`` )を使用して、テストメソッドのドキュメントを記述してください。これ" -"は、ドキュメンテーション文字列が存在する場合はその内容が出力されてしまうた" -"め、どのテストを実行しているのかをいちいち表示したくないからです。" +"うことが推奨されます。\n" +"1つは、テストモジュールの名前を、 ``test_`` で始め、テスト対象となるモジュー" +"ル名で終えることです。\n" +"テストモジュール中のテストメソッドは名前を ``test_`` で始めて、そのメソッドが" +"何をテストしているかという説明で終えます。\n" +"これはテスト実行プログラムが、そのメソッドをテストメソッドとして認識するため" +"に必要です。\n" +"また、テストメソッドにはドキュメンテーション文字列を入れるべきではありませ" +"ん。\n" +"コメント(例えば ``# 関数が True または False だけを返すことをテストする`` )" +"を使用して、テストメソッドのドキュメントを記述してください。\n" +"ドキュメンテーション文字列があると、その内容が出力され、どのテストを実行して" +"いるかが表示されなくなるためです。" #: ../../library/test.rst:55 msgid "A basic boilerplate is often used::" msgstr "以下のような決まり文句を使います::" -#: ../../library/test.rst:57 msgid "" "import unittest\n" "from test import support\n" @@ -151,6 +152,36 @@ msgid "" "if __name__ == '__main__':\n" " unittest.main()" msgstr "" +"import unittest\n" +"from test import support\n" +"\n" +"class MyTestCase1(unittest.TestCase):\n" +"\n" +" # setUp() と tearDown() は必要な場合だけ使う\n" +"\n" +" def setUp(self):\n" +" ... code to execute in preparation for tests ...\n" +"\n" +" def tearDown(self):\n" +" ... code to execute to clean up after tests ...\n" +"\n" +" def test_feature_one(self):\n" +" # 機能その1をテストする\n" +" ... testing code ...\n" +"\n" +" def test_feature_two(self):\n" +" # 機能その2をテストする\n" +" ... testing code ...\n" +"\n" +" ... more test methods ...\n" +"\n" +"class MyTestCase2(unittest.TestCase):\n" +" ... same structure as MyTestCase1 ...\n" +"\n" +"... more test classes ...\n" +"\n" +"if __name__ == '__main__':\n" +" unittest.main()" #: ../../library/test.rst:88 msgid "" @@ -163,13 +194,12 @@ msgstr "" "プトとして自分自身を起動したり、 ``python -m unittest`` というコマンドライン" "インターフェースを通して起動したりできます。" -#: ../../library/test.rst:92 msgid "" "The goal for regression testing is to try to break code. This leads to a few " "guidelines to be followed:" msgstr "" -"回帰テストの目的はコードを解き明かすことです。そのためには以下のいくつかのガ" -"イドラインに従ってください:" +"回帰テストの目的は、コードが正しく動作しないケースを見つけることです。\n" +"そのため、以下のガイドラインに従ってください。" #: ../../library/test.rst:95 msgid "" @@ -245,18 +275,16 @@ msgstr "" "行ってください。そうすることで、テストの外部依存性を最小限にし、モジュールの" "インポートによる副作用から生じる変則的な動作を最小限にできます。" -#: ../../library/test.rst:125 msgid "" "Try to maximize code reuse. On occasion, tests will vary by something as " "small as what type of input is used. Minimize code duplication by " "subclassing a basic test class with a class that specifies the input::" msgstr "" -"できる限りテストコードを再利用するようにしましょう。時として、入力の違いだけ" -"を記述すれば良くなるくらい、テストコードを小さくすることができます。例えば以" -"下のように、サブクラスで入力を指定することで、コードの重複を最小化することが" -"できます::" +"コードをできる限り再利用してください。\n" +"テスト同士の違いが、使う入力の型といった小さな点だけということもあります。\n" +"以下のように、基本となるテストクラスを継承し、サブクラスで入力を指定すること" +"で、コードの重複を最小限に抑えてください。 ::" -#: ../../library/test.rst:129 msgid "" "class TestFuncAcceptsSequencesMixin:\n" "\n" @@ -274,8 +302,22 @@ msgid "" "class AcceptTuples(TestFuncAcceptsSequencesMixin, unittest.TestCase):\n" " arg = (1, 2, 3)" msgstr "" +"class TestFuncAcceptsSequencesMixin:\n" +"\n" +" func = mySuperWhammyFunction\n" +"\n" +" def test_func(self):\n" +" self.func(self.arg)\n" +"\n" +"class AcceptLists(TestFuncAcceptsSequencesMixin, unittest.TestCase):\n" +" arg = [1, 2, 3]\n" +"\n" +"class AcceptStrings(TestFuncAcceptsSequencesMixin, unittest.TestCase):\n" +" arg = 'abc'\n" +"\n" +"class AcceptTuples(TestFuncAcceptsSequencesMixin, unittest.TestCase):\n" +" arg = (1, 2, 3)" -#: ../../library/test.rst:145 msgid "" "When using this pattern, remember that all classes that inherit from :class:" "`unittest.TestCase` are run as tests. The :class:`!" @@ -283,6 +325,10 @@ msgid "" "data and so can't be run by itself, thus it does not inherit from :class:" "`unittest.TestCase`." msgstr "" +"このパターンを使うときは、:class:`unittest.TestCase` を継承するクラスがすべて" +"テストとして実行されることに注意してください。\n" +"上の例の :class:`!TestFuncAcceptsSequencesMixin` クラスにはデータがなく、単独" +"では実行できないため、:class:`unittest.TestCase` を継承していません。" #: ../../library/test.rst:153 msgid "Test Driven Development" @@ -363,11 +409,12 @@ msgstr "" "program:`make test` を実行できます。 Windows上では、 :file:`PCbuild` ディレク" "トリから :program:`rt.bat` を実行すると、すべての回帰テストを実行します。" -#: ../../library/test.rst:195 msgid "" "Output is colorized by default and can be :ref:`controlled using environment " "variables `." msgstr "" +"出力はデフォルトで色付きになり、:ref:`環境変数で制御できます `。" #: ../../library/test.rst:201 msgid ":mod:`test.support` --- Utilities for the Python test suite" @@ -397,15 +444,15 @@ msgstr "" msgid "This module defines the following exceptions:" msgstr "このモジュールは次の例外を定義しています:" -#: ../../library/test.rst:221 msgid "" "Exception to be raised when a test fails. This is deprecated in favor of :" "mod:`unittest`\\ -based tests and :class:`unittest.TestCase`'s assertion " "methods." msgstr "" -"テストが失敗したとき送出される例外です。これは、 :mod:`unittest` ベースのテス" -"トでは廃止予定で、 :class:`unittest.TestCase` の assertXXX メソッドが推奨され" -"ます。" +"テストが失敗したときに送出する例外です。\n" +"この例外は非推奨です。\n" +"代わりに :mod:`unittest` に基づくテストと :class:`unittest.TestCase` のアサー" +"ションメソッドを使ってください。" #: ../../library/test.rst:228 msgid "" @@ -435,51 +482,55 @@ msgstr "" msgid "``True`` if the running interpreter is Jython." msgstr "実行中のインタプリタが Jython ならば ``True`` になります。" -#: ../../library/test.rst:249 msgid "``True`` if ``sys.platform`` is ``android``." -msgstr "" +msgstr "``sys.platform`` が ``android`` の場合は ``True`` です。" -#: ../../library/test.rst:254 msgid "``True`` if ``sys.platform`` is ``emscripten``." -msgstr "" +msgstr "``sys.platform`` が ``emscripten`` の場合は ``True`` です。" -#: ../../library/test.rst:259 msgid "``True`` if ``sys.platform`` is ``wasi``." -msgstr "" +msgstr "``sys.platform`` が ``wasi`` の場合は ``True`` です。" -#: ../../library/test.rst:264 msgid "``True`` if ``sys.platform`` is ``ios``, ``tvos``, or ``watchos``." msgstr "" +"``sys.platform`` が ``ios``、``tvos``、``watchos`` のいずれかの場合は " +"``True`` です。" -#: ../../library/test.rst:269 msgid "" "``True`` if ``sys.platform`` is ``darwin`` or ``is_apple_mobile`` is " "``True``." msgstr "" +"``sys.platform`` が ``darwin``、または ``is_apple_mobile`` が ``True`` の場合" +"は ``True`` です。" #: ../../library/test.rst:274 msgid "Path for shell if not on Windows; otherwise ``None``." msgstr "Windows 以外ではシェルのパスです; そうでない場合は ``None`` です。" -#: ../../library/test.rst:279 msgid "" "Timeout in seconds for tests using a network server listening on the network " "local loopback interface like ``127.0.0.1``." msgstr "" +"``127.0.0.1`` などのローカルループバックインターフェースで待ち受けるネット" +"ワークサーバーを使うテストの、秒単位のタイムアウトです。" -#: ../../library/test.rst:282 msgid "" "The timeout is long enough to prevent test failure: it takes into account " "that the client and the server can run in different threads or even " "different processes." msgstr "" +"このタイムアウトは、テストの失敗を防ぐのに十分な長さになっています。\n" +"クライアントとサーバーが別のスレッドや別のプロセスで動作する可能性を考慮して" +"います。" -#: ../../library/test.rst:286 msgid "" "The timeout should be long enough for :meth:`~socket.socket.connect`, :meth:" "`~socket.socket.recv` and :meth:`~socket.socket.send` methods of :class:" "`socket.socket`." msgstr "" +"このタイムアウトは :class:`socket.socket` の :meth:`~socket.socket." +"connect`、:meth:`~socket.socket.recv`、:meth:`~socket.socket.send` メソッドに" +"対して十分な長さであるはずです。" #: ../../library/test.rst:290 msgid "Its default value is 5 seconds." @@ -489,22 +540,25 @@ msgstr "デフォルト値は5秒です。" msgid "See also :data:`INTERNET_TIMEOUT`." msgstr ":data:`INTERNET_TIMEOUT` も参照してください。" -#: ../../library/test.rst:297 msgid "Timeout in seconds for network requests going to the internet." msgstr "" +"インターネットへのネットワークリクエストに対する、秒単位のタイムアウトです。" -#: ../../library/test.rst:299 msgid "" "The timeout is short enough to prevent a test to wait for too long if the " "internet request is blocked for whatever reason." msgstr "" +"何らかの理由でインターネットへのリクエストがブロックされたときに、テストが長" +"時間待ち続けないよう、十分短いタイムアウトになっています。" -#: ../../library/test.rst:302 msgid "" "Usually, a timeout using :data:`INTERNET_TIMEOUT` should not mark a test as " "failed, but skip the test instead: see :func:`~test.support.socket_helper." "transient_internet`." msgstr "" +"通常、:data:`INTERNET_TIMEOUT` によるタイムアウトでは、テストを失敗させるので" +"はなくスキップしてください。\n" +":func:`~test.support.socket_helper.transient_internet` を参照してください。" #: ../../library/test.rst:306 msgid "Its default value is 1 minute." @@ -514,47 +568,55 @@ msgstr "デフォルト値は1分です。" msgid "See also :data:`LOOPBACK_TIMEOUT`." msgstr ":data:`LOOPBACK_TIMEOUT` も参照してください。" -#: ../../library/test.rst:313 msgid "" "Timeout in seconds to mark a test as failed if the test takes \"too long\"." msgstr "" +"テストに「時間がかかりすぎる」場合に失敗と判定するための、秒単位のタイムアウ" +"トです。" -#: ../../library/test.rst:315 msgid "" "The timeout value depends on the regrtest ``--timeout`` command line option." msgstr "" +"タイムアウトの値は regrtest のコマンドラインオプション ``--timeout`` に依存し" +"ます。" -#: ../../library/test.rst:317 msgid "" "If a test using :data:`SHORT_TIMEOUT` starts to fail randomly on slow " "buildbots, use :data:`LONG_TIMEOUT` instead." msgstr "" +":data:`SHORT_TIMEOUT` を使うテストが低速な buildbot で不規則に失敗するように" +"なった場合は、代わりに :data:`LONG_TIMEOUT` を使ってください。" #: ../../library/test.rst:320 msgid "Its default value is 30 seconds." msgstr "デフォルト値は30秒です。" -#: ../../library/test.rst:325 msgid "Timeout in seconds to detect when a test hangs." -msgstr "" +msgstr "テストがハングしたことを検出するための、秒単位のタイムアウトです。" -#: ../../library/test.rst:327 msgid "" "It is long enough to reduce the risk of test failure on the slowest Python " "buildbots. It should not be used to mark a test as failed if the test takes " "\"too long\". The timeout value depends on the regrtest ``--timeout`` " "command line option." msgstr "" +"最も低速な Python buildbot でもテストが失敗するリスクを減らせるよう、十分な長" +"さになっています。\n" +"テストに「時間がかかりすぎる」という理由で失敗と判定するために使わないでくだ" +"さい。\n" +"タイムアウトの値は regrtest のコマンドラインオプション ``--timeout`` に依存し" +"ます。" #: ../../library/test.rst:332 msgid "Its default value is 5 minutes." msgstr "デフォルト値は5分です。" -#: ../../library/test.rst:334 msgid "" "See also :data:`LOOPBACK_TIMEOUT`, :data:`INTERNET_TIMEOUT` and :data:" "`SHORT_TIMEOUT`." msgstr "" +":data:`LOOPBACK_TIMEOUT`、:data:`INTERNET_TIMEOUT`、:data:`SHORT_TIMEOUT` も" +"参照してください。" #: ../../library/test.rst:340 msgid "Set when tests can be skipped when they are not useful for PGO." @@ -570,11 +632,12 @@ msgstr "" "書き込みをブロックするための、基底にある OS のパイプバッファサイズより大きい" "であろう定数。" -#: ../../library/test.rst:351 msgid "" "``True`` if Python was built with the :c:macro:`Py_DEBUG` macro defined, " "that is, if Python was :ref:`built in debug mode `." msgstr "" +"Python が :c:macro:`Py_DEBUG` マクロを定義してビルドされている場合、つまり :" +"ref:`デバッグモードでビルドされている ` 場合は ``True`` です。" #: ../../library/test.rst:360 msgid "" @@ -600,102 +663,109 @@ msgstr "テストパッケージ内の ``data`` ディレクトリを設定し msgid "Set to :data:`sys.maxsize` for big memory tests." msgstr "大量のメモリを使うテストのための :data:`sys.maxsize` を設定します。" -#: ../../library/test.rst:386 msgid "" "Set by :func:`set_memlimit` as the memory limit for big memory tests. " "Limited by :data:`MAX_Py_ssize_t`." msgstr "" -"大量のメモリを使うテストのためのメモリ上限となる :func:`set_memlimit` を設定" -"します。\n" -":data:`MAX_Py_ssize_t` が設定上限です。" +"大量のメモリを使うテストのメモリ上限として、:func:`set_memlimit` によって設定" +"されます。\n" +"上限は :data:`MAX_Py_ssize_t` です。" -#: ../../library/test.rst:392 msgid "" "Set by :func:`set_memlimit` as the memory limit for big memory tests. Not " "limited by :data:`MAX_Py_ssize_t`." msgstr "" -"大量のメモリを使うテストのためのメモリ上限となる :func:`set_memlimit` を設定" -"します。\n" -":data:`MAX_Py_ssize_t` の設定上限はありません。" +"大量のメモリを使うテストのメモリ上限として、:func:`set_memlimit` によって設定" +"されます。\n" +":data:`MAX_Py_ssize_t` による上限はありません。" -#: ../../library/test.rst:398 msgid "" "Set to ``True`` if Python is built without docstrings (the :c:macro:" "`WITH_DOC_STRINGS` macro is not defined). See the :option:`configure --" "without-doc-strings <--without-doc-strings>` option." msgstr "" +"Python がドキュメンテーション文字列なしでビルドされている場合 (:c:macro:" +"`WITH_DOC_STRINGS` マクロが定義されていない場合) は ``True`` に設定されま" +"す。\n" +":option:`configure --without-doc-strings <--without-doc-strings>` オプション" +"を参照してください。" -#: ../../library/test.rst:402 msgid "See also the :data:`HAVE_DOCSTRINGS` variable." -msgstr "" +msgstr ":data:`HAVE_DOCSTRINGS` 変数も参照してください。" -#: ../../library/test.rst:407 msgid "" "Set to ``True`` if function docstrings are available. See the :option:" "`python -OO <-O>` option, which strips docstrings of functions implemented " "in Python." msgstr "" +"関数のドキュメンテーション文字列を利用できる場合は ``True`` に設定されま" +"す。\n" +"Python で実装された関数のドキュメンテーション文字列を除去する :option:" +"`python -OO <-O>` オプションを参照してください。" -#: ../../library/test.rst:410 msgid "See also the :data:`MISSING_C_DOCSTRINGS` variable." -msgstr "" +msgstr ":data:`MISSING_C_DOCSTRINGS` 変数も参照してください。" #: ../../library/test.rst:415 msgid "Define the URL of a dedicated HTTP server for the network tests." msgstr "ネットワークテスト専用の HTTP サーバーの URL を定義します。" -#: ../../library/test.rst:420 msgid "Object that is equal to anything. Used to test mixed type comparison." msgstr "" +"何と比較しても等しいオブジェクトです。\n" +"異なる型同士の比較のテストに使います。" -#: ../../library/test.rst:425 msgid "" "Object that is not equal to anything (even to :data:`ALWAYS_EQ`). Used to " "test mixed type comparison." msgstr "" +":data:`ALWAYS_EQ` も含め、何と比較しても等しくないオブジェクトです。\n" +"異なる型同士の比較のテストに使います。" -#: ../../library/test.rst:431 msgid "" "Object that is greater than anything (except itself). Used to test mixed " "type comparison." msgstr "" +"自身を除く何と比較しても大きいオブジェクトです。\n" +"異なる型同士の比較のテストに使います。" -#: ../../library/test.rst:437 msgid "" "Object that is less than anything (except itself). Used to test mixed type " "comparison." msgstr "" +"自身を除く何と比較しても小さいオブジェクトです。\n" +"異なる型同士の比較のテストに使います。" #: ../../library/test.rst:441 msgid "The :mod:`test.support` module defines the following functions:" msgstr ":mod:`test.support` モジュールでは、以下の関数を定義しています:" -#: ../../library/test.rst:445 msgid "Run the loop body until ``break`` stops the loop." -msgstr "" +msgstr "``break`` でループを停止するまでループ本体を実行します。" -#: ../../library/test.rst:447 msgid "" "After *timeout* seconds, raise an :exc:`AssertionError` if *error* is true, " "or just stop the loop if *error* is false." msgstr "" +"*timeout* 秒が経過すると、*error* が真の場合は :exc:`AssertionError` を送出" +"し、偽の場合は単にループを停止します。" #: ../../library/test.rst:450 msgid "Example::" msgstr "以下はプログラム例です::" -#: ../../library/test.rst:452 msgid "" "for _ in support.busy_retry(support.SHORT_TIMEOUT):\n" " if check():\n" " break" msgstr "" +"for _ in support.busy_retry(support.SHORT_TIMEOUT):\n" +" if check():\n" +" break" -#: ../../library/test.rst:456 ../../library/test.rst:480 msgid "Example of error=False usage::" -msgstr "" +msgstr "``error=False`` の使用例です。 ::" -#: ../../library/test.rst:458 msgid "" "for _ in support.busy_retry(support.SHORT_TIMEOUT, error=False):\n" " if check():\n" @@ -703,34 +773,40 @@ msgid "" "else:\n" " raise RuntimeError('my custom error')" msgstr "" +"for _ in support.busy_retry(support.SHORT_TIMEOUT, error=False):\n" +" if check():\n" +" break\n" +"else:\n" +" raise RuntimeError('my custom error')" -#: ../../library/test.rst:466 msgid "Wait strategy that applies exponential backoff." -msgstr "" +msgstr "指数バックオフを適用する待機方法です。" -#: ../../library/test.rst:468 msgid "" "Run the loop body until ``break`` stops the loop. Sleep at each loop " "iteration, but not at the first iteration. The sleep delay is doubled at " "each iteration (up to *max_delay* seconds)." msgstr "" +"``break`` でループを停止するまでループ本体を実行します。\n" +"最初の反復を除き、各反復でスリープします。\n" +"スリープ時間は反復のたびに倍増し、最大 *max_delay* 秒になります。" -#: ../../library/test.rst:472 msgid "See :func:`busy_retry` documentation for the parameters usage." msgstr "" +"引数の使い方については :func:`busy_retry` のドキュメントを参照してください。" -#: ../../library/test.rst:474 msgid "Example raising an exception after SHORT_TIMEOUT seconds::" -msgstr "" +msgstr "``SHORT_TIMEOUT`` 秒後に例外を送出する例です。 ::" -#: ../../library/test.rst:476 msgid "" "for _ in support.sleeping_retry(support.SHORT_TIMEOUT):\n" " if check():\n" " break" msgstr "" +"for _ in support.sleeping_retry(support.SHORT_TIMEOUT):\n" +" if check():\n" +" break" -#: ../../library/test.rst:482 msgid "" "for _ in support.sleeping_retry(support.SHORT_TIMEOUT, error=False):\n" " if check():\n" @@ -738,6 +814,11 @@ msgid "" "else:\n" " raise RuntimeError('my custom error')" msgstr "" +"for _ in support.sleeping_retry(support.SHORT_TIMEOUT, error=False):\n" +" if check():\n" +" break\n" +"else:\n" +" raise RuntimeError('my custom error')" #: ../../library/test.rst:490 msgid "" @@ -748,9 +829,10 @@ msgstr "" "*resource* が有効で利用可能ならば ``True`` を返します。利用可能なリソースのリ" "ストは、 :mod:`test.regrtest` がテストを実行している間のみ設定されます。" -#: ../../library/test.rst:497 msgid "Return ``True`` if Python was not built with ``-O0`` or ``-Og``." msgstr "" +"Python が ``-O0`` も ``-Og`` も指定せずにビルドされている場合は ``True`` を返" +"します。" #: ../../library/test.rst:502 msgid "Return :const:`_testcapi.WITH_PYMALLOC`." @@ -768,9 +850,8 @@ msgstr "" "``'__main__'`` である関数にから呼び出された場合には常に ``True`` を返します。" "テストを :mod:`test.regrtest` から実行するときに使われます。" -#: ../../library/test.rst:515 msgid "Return a repr of *dict* with keys sorted." -msgstr "" +msgstr "キーでソートした *dict* の ``repr()`` 結果を返します。" #: ../../library/test.rst:520 msgid "" @@ -790,59 +871,70 @@ msgstr "" "*subdir* を設定することで、パスのディレクトリを直接見に行くのではなく、相対パ" "スを使って見付けにいくように指示できます。" -#: ../../library/test.rst:530 msgid "Get size of a page in bytes." -msgstr "" +msgstr "ページのサイズをバイト単位で取得します。" -#: ../../library/test.rst:537 msgid "" "Set the :func:`sys.setswitchinterval` to the given *interval*. Defines a " "minimum interval for Android systems to prevent the system from hanging." msgstr "" +":func:`sys.setswitchinterval` を使って、指定された *interval* を設定しま" +"す。\n" +"Android システムでは、ハングを防ぐために最小の間隔を定めています。" -#: ../../library/test.rst:543 msgid "" "Use this check to guard CPython's implementation-specific tests or to run " "them only on the implementations guarded by the arguments. This function " "returns ``True`` or ``False`` depending on the host platform. Example usage::" msgstr "" +"CPython の実装に固有のテストを制限したり、引数で指定した実装でだけテストを実" +"行したりするには、このチェックを使ってください。\n" +"実行環境に応じて ``True`` または ``False`` を返します。\n" +"使用例です。 ::" -#: ../../library/test.rst:548 msgid "" "check_impl_detail() # Only on CPython (default).\n" "check_impl_detail(jython=True) # Only on Jython.\n" "check_impl_detail(cpython=False) # Everywhere except CPython." msgstr "" +"check_impl_detail() # CPython のみ (デフォルト)\n" +"check_impl_detail(jython=True) # Jython のみ\n" +"check_impl_detail(cpython=False) # CPython 以外のすべて" -#: ../../library/test.rst:555 msgid "" "Set the values for :data:`max_memuse` and :data:`real_max_memuse` for big " "memory tests." msgstr "" +"大量のメモリを使うテストのために、:data:`max_memuse` と :data:" +"`real_max_memuse` の値を設定します。" -#: ../../library/test.rst:561 msgid "" "Store the value from *stdout*. It is meant to hold the stdout at the time " "the regrtest began." msgstr "" +"*stdout* の値を保存します。\n" +"regrtest が開始した時点の標準出力を保持するための関数です。" -#: ../../library/test.rst:567 msgid "" "Return the original stdout set by :func:`record_original_stdout` or ``sys." "stdout`` if it's not set." msgstr "" +":func:`record_original_stdout` で設定された元の標準出力を返します。\n" +"設定されていなければ ``sys.stdout`` を返します。" -#: ../../library/test.rst:573 msgid "" "Return a list of command line arguments reproducing the current settings in " "``sys.flags`` and ``sys.warnoptions``." msgstr "" +"``sys.flags`` と ``sys.warnoptions`` の現在の設定を再現するコマンドライン引数" +"のリストを返します。" -#: ../../library/test.rst:579 msgid "" "Return a list of command line arguments reproducing the current optimization " "settings in ``sys.flags``." msgstr "" +"``sys.flags`` の現在の最適化設定を再現するコマンドライン引数のリストを返しま" +"す。" #: ../../library/test.rst:587 msgid "" @@ -856,7 +948,6 @@ msgstr "" msgid "Example use with output streams::" msgstr "出力ストリームの使用例::" -#: ../../library/test.rst:592 msgid "" "with captured_stdout() as stdout, captured_stderr() as stderr:\n" " print(\"hello\")\n" @@ -864,12 +955,16 @@ msgid "" "assert stdout.getvalue() == \"hello\\n\"\n" "assert stderr.getvalue() == \"error\\n\"" msgstr "" +"with captured_stdout() as stdout, captured_stderr() as stderr:\n" +" print(\"hello\")\n" +" print(\"error\", file=sys.stderr)\n" +"assert stdout.getvalue() == \"hello\\n\"\n" +"assert stderr.getvalue() == \"error\\n\"" #: ../../library/test.rst:598 msgid "Example use with input stream::" msgstr "入力ストリ-ムの使用例::" -#: ../../library/test.rst:600 msgid "" "with captured_stdin() as stdin:\n" " stdin.write('hello\\n')\n" @@ -878,116 +973,144 @@ msgid "" " captured = input()\n" "self.assertEqual(captured, \"hello\")" msgstr "" +"with captured_stdin() as stdin:\n" +" stdin.write('hello\\n')\n" +" stdin.seek(0)\n" +" # sys.stdin から入力を読み取るテストコードを呼び出す\n" +" captured = input()\n" +"self.assertEqual(captured, \"hello\")" -#: ../../library/test.rst:610 msgid "A context manager that temporary disables :mod:`faulthandler`." -msgstr "" +msgstr ":mod:`faulthandler` を一時的に無効にするコンテキストマネージャです。" -#: ../../library/test.rst:615 msgid "" "Force as many objects as possible to be collected. This is needed because " "timely deallocation is not guaranteed by the garbage collector. This means " "that ``__del__`` methods may be called later than expected and weakrefs may " "remain alive for longer than expected." msgstr "" +"できる限り多くのオブジェクトを強制的に回収します。\n" +"ガベージコレクタは適切なタイミングでの解放を保証しないため、この処理が必要で" +"す。\n" +"つまり、``__del__`` メソッドが予想より遅く呼ばれたり、弱参照が予想より長く生" +"存したりすることがあります。" -#: ../../library/test.rst:623 msgid "" "A context manager that disables the garbage collector on entry. On exit, the " "garbage collector is restored to its prior state." msgstr "" +"開始時にガベージコレクタを無効にするコンテキストマネージャです。\n" +"終了時にはガベージコレクタを元の状態に戻します。" -#: ../../library/test.rst:629 msgid "Context manager to swap out an attribute with a new object." -msgstr "" +msgstr "属性を新しいオブジェクトに置き換えるコンテキストマネージャです。" #: ../../library/test.rst:631 ../../library/test.rst:649 #: ../../library/test.rst:904 ../../library/test.rst:1370 msgid "Usage::" msgstr "使い方::" -#: ../../library/test.rst:633 msgid "" "with swap_attr(obj, \"attr\", 5):\n" " ..." msgstr "" +"with swap_attr(obj, \"attr\", 5):\n" +" ..." -#: ../../library/test.rst:636 msgid "" "This will set ``obj.attr`` to 5 for the duration of the ``with`` block, " "restoring the old value at the end of the block. If ``attr`` doesn't exist " "on ``obj``, it will be created and then deleted at the end of the block." msgstr "" +"``with`` ブロックの間だけ ``obj.attr`` を 5 に設定し、ブロックの終了時に元の" +"値に戻します。\n" +"``obj`` に ``attr`` が存在しない場合は作成し、ブロックの終了時に削除します。" -#: ../../library/test.rst:641 ../../library/test.rst:659 msgid "" "The old value (or ``None`` if it doesn't exist) will be assigned to the " "target of the \"as\" clause, if there is one." msgstr "" +"\"as\" 節がある場合は、その代入先に元の値 (存在しない場合は ``None``) を代入" +"します。" -#: ../../library/test.rst:647 msgid "Context manager to swap out an item with a new object." -msgstr "" +msgstr "要素を新しいオブジェクトに置き換えるコンテキストマネージャです。" -#: ../../library/test.rst:651 msgid "" "with swap_item(obj, \"item\", 5):\n" " ..." msgstr "" +"with swap_item(obj, \"item\", 5):\n" +" ..." -#: ../../library/test.rst:654 msgid "" "This will set ``obj[\"item\"]`` to 5 for the duration of the ``with`` block, " "restoring the old value at the end of the block. If ``item`` doesn't exist " "on ``obj``, it will be created and then deleted at the end of the block." msgstr "" +"``with`` ブロックの間だけ ``obj[\"item\"]`` を 5 に設定し、ブロックの終了時に" +"元の値に戻します。\n" +"``obj`` に ``item`` が存在しない場合は作成し、ブロックの終了時に削除します。" -#: ../../library/test.rst:665 msgid "" "Call the ``flush()`` method on :data:`sys.stdout` and then on :data:`sys." "stderr`. It can be used to make sure that the logs order is consistent " "before writing into stderr." msgstr "" +":data:`sys.stdout`、:data:`sys.stderr` の順に ``flush()`` メソッドを呼び出し" +"ます。\n" +"標準エラー出力への書き込み前にログの順序を揃えるために使えます。" -#: ../../library/test.rst:674 msgid "" "Print a warning into :data:`sys.__stderr__`. Format the message as: " "``f\"Warning -- {msg}\"``. If *msg* is made of multiple lines, add " "``\"Warning -- \"`` prefix to each line." msgstr "" +":data:`sys.__stderr__` に警告を出力します。\n" +"メッセージは ``f\"Warning -- {msg}\"`` の形式になります。\n" +"*msg* が複数行の場合は、各行の先頭に ``\"Warning -- \"`` を追加します。" -#: ../../library/test.rst:683 msgid "" "Wait until process *pid* completes and check that the process exit code is " "*exitcode*." msgstr "" +"プロセス *pid* が終了するまで待ち、終了コードが *exitcode* であることを確認し" +"ます。" -#: ../../library/test.rst:686 msgid "" "Raise an :exc:`AssertionError` if the process exit code is not equal to " "*exitcode*." msgstr "" +"プロセスの終了コードが *exitcode* と等しくない場合は :exc:`AssertionError` を" +"送出します。" -#: ../../library/test.rst:689 msgid "" "If the process runs longer than *timeout* seconds (:data:`SHORT_TIMEOUT` by " "default), kill the process and raise an :exc:`AssertionError`. The timeout " "feature is not available on Windows." msgstr "" +"プロセスが *timeout* 秒 (デフォルトは :data:`SHORT_TIMEOUT`) を超えて実行され" +"続けた場合は、プロセスを強制終了して :exc:`AssertionError` を送出します。\n" +"Windows ではタイムアウト機能を利用できません。" -#: ../../library/test.rst:698 msgid "" "Return the size of the :c:type:`PyObject` whose structure members are " "defined by *fmt*. The returned value includes the size of the Python object " "header and alignment." msgstr "" +"構造体のメンバが *fmt* で定義される :c:type:`PyObject` のサイズを返します。\n" +"返される値には Python オブジェクトのヘッダのサイズとアラインメントが含まれま" +"す。" -#: ../../library/test.rst:704 msgid "" "Return the size of the :c:type:`PyVarObject` whose structure members are " "defined by *fmt*. The returned value includes the size of the Python object " "header and alignment." msgstr "" +"構造体のメンバが *fmt* で定義される :c:type:`PyVarObject` のサイズを返しま" +"す。\n" +"返される値には Python オブジェクトのヘッダのサイズとアラインメントが含まれま" +"す。" #: ../../library/test.rst:710 msgid "" @@ -1006,11 +1129,12 @@ msgstr "" "このデコレータを使うときはいつも、関連する問題を指し示すコメントを付けておく" "べきです。" -#: ../../library/test.rst:723 msgid "" "A decorator that skips the decorated test on TLS certification validation " "failures." msgstr "" +"TLS 証明書の検証に失敗した場合に、装飾したテストをスキップするデコレータで" +"す。" #: ../../library/test.rst:728 msgid "" @@ -1026,123 +1150,132 @@ msgstr "" "渡された *locales* が順々に試され、一番最初に出てきた妥当なロケールが使われま" "す。" -#: ../../library/test.rst:736 msgid "" "A decorator for running a function in a specific timezone, correctly " "resetting it after it has finished." msgstr "" +"指定したタイムゾーンで関数を実行し、終了後に元の状態へ正しく戻すデコレータで" +"す。" -#: ../../library/test.rst:742 msgid "" "Decorator for the minimum version when running test on FreeBSD. If the " "FreeBSD version is less than the minimum, the test is skipped." msgstr "" +"FreeBSD でテストを実行するときの最小バージョンを指定するデコレータです。\n" +"FreeBSD のバージョンがこれより古い場合は、テストをスキップします。" -#: ../../library/test.rst:748 msgid "" "Decorator for the minimum version when running test on Linux. If the Linux " "version is less than the minimum, the test is skipped." msgstr "" +"Linux でテストを実行するときの最小バージョンを指定するデコレータです。\n" +"Linux のバージョンがこれより古い場合は、テストをスキップします。" -#: ../../library/test.rst:754 msgid "" "Decorator for the minimum version when running test on macOS. If the macOS " "version is less than the minimum, the test is skipped." msgstr "" +"macOS でテストを実行するときの最小バージョンを指定するデコレータです。\n" +"macOS のバージョンがこれより古い場合は、テストをスキップします。" -#: ../../library/test.rst:760 msgid "" "Decorator for skipping tests on the free-threaded build. If the :term:`GIL` " "is disabled, the test is skipped." msgstr "" +"フリースレッドビルドでテストをスキップするデコレータです。\n" +":term:`GIL` が無効の場合は、テストをスキップします。" -#: ../../library/test.rst:766 msgid "Decorator for skipping tests on non-IEEE 754 platforms." msgstr "" +"IEEE 754 に準拠しないプラットフォームでテストをスキップするデコレータです。" -#: ../../library/test.rst:771 msgid "Decorator for skipping tests if :mod:`zlib` doesn't exist." -msgstr "" +msgstr ":mod:`zlib` が存在しない場合にテストをスキップするデコレータです。" -#: ../../library/test.rst:776 msgid "Decorator for skipping tests if :mod:`gzip` doesn't exist." -msgstr "" +msgstr ":mod:`gzip` が存在しない場合にテストをスキップするデコレータです。" -#: ../../library/test.rst:781 msgid "Decorator for skipping tests if :mod:`bz2` doesn't exist." -msgstr "" +msgstr ":mod:`bz2` が存在しない場合にテストをスキップするデコレータです。" -#: ../../library/test.rst:786 msgid "Decorator for skipping tests if :mod:`lzma` doesn't exist." -msgstr "" +msgstr ":mod:`lzma` が存在しない場合にテストをスキップするデコレータです。" -#: ../../library/test.rst:791 msgid "Decorator for skipping tests if *resource* is not available." -msgstr "" +msgstr "*resource* が利用できない場合にテストをスキップするデコレータです。" -#: ../../library/test.rst:796 msgid "Decorator for only running the test if :data:`HAVE_DOCSTRINGS`." msgstr "" +":data:`HAVE_DOCSTRINGS` が真の場合にだけテストを実行するデコレータです。" -#: ../../library/test.rst:801 msgid "" "Decorator for only running the test if :ref:`Limited C API ` " "is available." msgstr "" +":ref:`Limited C API ` が利用できる場合にだけテストを実行するデ" +"コレータです。" -#: ../../library/test.rst:807 msgid "Decorator for tests only applicable to CPython." -msgstr "" +msgstr "CPython にだけ適用できるテストのためのデコレータです。" -#: ../../library/test.rst:812 msgid "" "Decorator for invoking :func:`check_impl_detail` on *guards*. If that " "returns ``False``, then uses *msg* as the reason for skipping the test." msgstr "" +"*guards* を渡して :func:`check_impl_detail` を呼び出すデコレータです。\n" +"``False`` が返された場合は、*msg* を理由としてテストをスキップします。" -#: ../../library/test.rst:817 msgid "" "Decorator for marking tests as thread-unsafe. This test always runs in one " "thread even when invoked with ``--parallel-threads``." msgstr "" +"テストがスレッドセーフでないことを示すデコレータです。\n" +"このテストは ``--parallel-threads`` を指定して実行しても、常に 1 つのスレッド" +"で実行されます。" -#: ../../library/test.rst:823 msgid "Decorator to temporarily turn off tracing for the duration of the test." -msgstr "" +msgstr "テストの実行中、一時的にトレースを無効にするデコレータです。" -#: ../../library/test.rst:828 msgid "" "Decorator for tests which involve reference counting. The decorator does " "not run the test if it is not run by CPython. Any trace function is unset " "for the duration of the test to prevent unexpected refcounts caused by the " "trace function." msgstr "" +"参照カウントに関わるテストのためのデコレータです。\n" +"CPython 以外で実行される場合はテストを実行しません。\n" +"トレース関数による予期しない参照カウントの変化を防ぐため、テストの実行中はト" +"レース関数の設定を解除します。" -#: ../../library/test.rst:836 msgid "Decorator for bigmem tests." -msgstr "" +msgstr "大量のメモリを使うテストのためのデコレータです。" -#: ../../library/test.rst:838 msgid "" "*size* is a requested size for the test (in arbitrary, test-interpreted " "units.) *memuse* is the number of bytes per unit for the test, or a good " "estimate of it. For example, a test that needs two byte buffers, of 4 GiB " "each, could be decorated with ``@bigmemtest(size=_4G, memuse=2)``." msgstr "" +"*size* はテストに要求するサイズです (単位は任意で、テスト側で解釈します)。\n" +"*memuse* はテストで使う単位あたりのバイト数、またはその適切な推定値です。\n" +"例えば、それぞれ 4 GiB のバイトバッファが 2 つ必要なテストには、" +"``@bigmemtest(size=_4G, memuse=2)`` を付けられます。" -#: ../../library/test.rst:843 msgid "" "The *size* argument is normally passed to the decorated test method as an " "extra argument. If *dry_run* is ``True``, the value passed to the test " "method may be less than the requested value. If *dry_run* is ``False``, it " "means the test doesn't support dummy runs when ``-M`` is not specified." msgstr "" +"通常、*size* 引数は装飾したテストメソッドに追加の引数として渡されます。\n" +"*dry_run* が ``True`` の場合、テストメソッドに渡される値は要求した値より小さ" +"くなることがあります。\n" +"*dry_run* が ``False`` の場合は、``-M`` が指定されていないときのダミー実行を" +"テストがサポートしないことを意味します。" -#: ../../library/test.rst:851 msgid "Decorator for tests that fill the address space." -msgstr "" +msgstr "アドレス空間を埋め尽くすテストのためのデコレータです。" -#: ../../library/test.rst:856 msgid "" "Return ``False`` if there is no evidence the interpreter was compiled with " "``musl``, otherwise return a version triple, either ``(0, 0, 0)`` if the " @@ -1150,8 +1283,14 @@ msgid "" "in ``skip`` decorators. ``emscripten`` and ``wasi`` are assumed to be " "compiled with ``musl``; otherwise ``platform.libc_ver`` is checked." msgstr "" +"インタープリタが ``musl`` を使ってコンパイルされたことを示す情報がなければ " +"``False`` を返します。\n" +"それ以外の場合はバージョンを表す 3 要素のタプルを返し、バージョンが不明なら " +"``(0, 0, 0)``、判明していれば実際のバージョンになります。\n" +"``skip`` デコレータで使うことを想定しています。\n" +"``emscripten`` と ``wasi`` は ``musl`` を使ってコンパイルされたと仮定し、それ" +"以外では ``platform.libc_ver`` を調べます。" -#: ../../library/test.rst:865 msgid "" "Test for syntax errors in *statement* by attempting to compile *statement*. " "*testcase* is the :mod:`unittest` instance for the test. *errtext* is the " @@ -1160,6 +1299,12 @@ msgid "" "line of the exception. If *offset* is not ``None``, compares to the offset " "of the exception." msgstr "" +"*statement* のコンパイルを試み、構文エラーをテストします。\n" +"*testcase* はテストに使う :mod:`unittest` のインスタンスです。\n" +"*errtext* は送出された :exc:`SyntaxError` の文字列表現にマッチすべき正規表現" +"です。\n" +"*lineno* が ``None`` でなければ、例外の行番号と比較します。\n" +"*offset* が ``None`` でなければ、例外のオフセットと比較します。" #: ../../library/test.rst:875 msgid "Open *url*. If open fails, raises :exc:`TestFailed`." @@ -1172,33 +1317,39 @@ msgid "" "resources and create problems when looking for refleaks." msgstr "" -#: ../../library/test.rst:887 msgid "" "Get an attribute, raising :exc:`unittest.SkipTest` if :exc:`AttributeError` " "is raised." msgstr "" +"属性を取得します。\n" +":exc:`AttributeError` が発生した場合は :exc:`unittest.SkipTest` を送出しま" +"す。" -#: ../../library/test.rst:893 msgid "" "Context manager catching unraisable exception using :func:`sys." "unraisablehook`." msgstr "" +":func:`sys.unraisablehook` を使い、送出できない例外を捕捉するコンテキストマ" +"ネージャです。" -#: ../../library/test.rst:896 msgid "" "Storing the exception value (``cm.unraisable.exc_value``) creates a " "reference cycle. The reference cycle is broken explicitly when the context " "manager exits." msgstr "" +"例外の値 (``cm.unraisable.exc_value``) を保存すると循環参照ができます。\n" +"コンテキストマネージャの終了時に、この循環参照を明示的に断ち切ります。" -#: ../../library/test.rst:900 msgid "" "Storing the object (``cm.unraisable.object``) can resurrect it if it is set " "to an object which is being finalized. Exiting the context manager clears " "the stored object." msgstr "" +"オブジェクト (``cm.unraisable.object``) を保存した際、その値がファイナライズ" +"中のオブジェクトである場合は、そのオブジェクトを復活させる可能性がありま" +"す。\n" +"コンテキストマネージャの終了時に、保存したオブジェクトを消去します。" -#: ../../library/test.rst:906 msgid "" "with support.catch_unraisable_exception() as cm:\n" " # code creating an \"unraisable exception\"\n" @@ -1210,8 +1361,16 @@ msgid "" "# cm.unraisable attribute no longer exists at this point\n" "# (to break a reference cycle)" msgstr "" +"with support.catch_unraisable_exception() as cm:\n" +" # 「送出できない例外」を発生させるコード\n" +" ...\n" +"\n" +" # cm.unraisable を使って送出できない例外を調べる\n" +" ...\n" +"\n" +"# この時点では cm.unraisable 属性は存在しない\n" +"# (循環参照を断ち切るため)" -#: ../../library/test.rst:921 msgid "" "Generic implementation of the :mod:`unittest` ``load_tests`` protocol for " "use in test packages. *pkg_dir* is the root directory of the package; " @@ -1219,8 +1378,13 @@ msgid "" "``load_tests``. In simple cases, the test package's ``__init__.py`` can be " "the following::" msgstr "" +"テストパッケージで使うための、:mod:`unittest` の ``load_tests`` プロトコルの" +"汎用実装です。\n" +"*pkg_dir* はパッケージのルートディレクトリです。\n" +"*loader*、*standard_tests*、*pattern* は ``load_tests`` が受け取る引数で" +"す。\n" +"単純な場合、テストパッケージの ``__init__.py`` は次のように書けます。 ::" -#: ../../library/test.rst:927 msgid "" "import os\n" "from test.support import load_package_tests\n" @@ -1228,82 +1392,104 @@ msgid "" "def load_tests(*args):\n" " return load_package_tests(os.path.dirname(__file__), *args)" msgstr "" +"import os\n" +"from test.support import load_package_tests\n" +"\n" +"def load_tests(*args):\n" +" return load_package_tests(os.path.dirname(__file__), *args)" -#: ../../library/test.rst:936 msgid "" "Returns the set of attributes, functions or methods of *ref_api* not found " "on *other_api*, except for a defined list of items to be ignored in this " "check specified in *ignore*." msgstr "" +"*ref_api* の属性、関数、メソッドのうち、*other_api* にないものの集合を返しま" +"す。\n" +"ただし、*ignore* に指定した、このチェックで無視する要素は除外します。" -#: ../../library/test.rst:940 msgid "" "By default this skips private attributes beginning with '_' but includes all " "magic methods, i.e. those starting and ending in '__'." msgstr "" +"デフォルトでは、'_' で始まる非公開属性を除外しますが、'__' で始まり '__' で終" +"わるすべての特殊メソッドを含めます。" -#: ../../library/test.rst:948 msgid "" "Override *object_to_patch.attr_name* with *new_value*. Also add cleanup " "procedure to *test_instance* to restore *object_to_patch* for *attr_name*. " "The *attr_name* should be a valid attribute for *object_to_patch*." msgstr "" +"*object_to_patch.attr_name* を *new_value* で置き換えます。\n" +"また、*object_to_patch* の *attr_name* を元に戻す後始末の処理を " +"*test_instance* に追加します。\n" +"*attr_name* は *object_to_patch* の有効な属性でなければなりません。" -#: ../../library/test.rst:956 msgid "" "Run *code* in subinterpreter. Raise :exc:`unittest.SkipTest` if :mod:" "`tracemalloc` is enabled." msgstr "" +"*code* をサブインタープリタで実行します。\n" +":mod:`tracemalloc` が有効な場合は :exc:`unittest.SkipTest` を送出します。" -#: ../../library/test.rst:962 msgid "Assert instances of *cls* are deallocated after iterating." -msgstr "" +msgstr "反復後に *cls* のインスタンスが解放されることを検証します。" -#: ../../library/test.rst:967 msgid "" "Check for the existence of the compiler executables whose names are listed " "in *cmd_names* or all the compiler executables when *cmd_names* is empty and " "return the first missing executable or ``None`` when none is found missing." msgstr "" +"*cmd_names* に列挙されたコンパイラの実行ファイルが存在するか調べます。\n" +"*cmd_names* が空の場合は、すべてのコンパイラの実行ファイルを調べます。\n" +"最初に見つかった存在しない実行ファイルを返し、すべて存在する場合は ``None`` " +"を返します。" -#: ../../library/test.rst:975 msgid "" "Assert that the ``__all__`` variable of *module* contains all public names." msgstr "" +"*module* の ``__all__`` 変数にすべての公開名が含まれることを検証します。" -#: ../../library/test.rst:977 msgid "" "The module's public names (its API) are detected automatically based on " "whether they match the public name convention and were defined in *module*." msgstr "" +"モジュールの公開名 (API) は、公開名の命名規則に一致するかどうかと、*module* " +"内で定義されたかどうかに基づいて自動的に検出されます。" -#: ../../library/test.rst:981 msgid "" "The *name_of_module* argument can specify (as a string or tuple thereof) " "what module(s) an API could be defined in order to be detected as a public " "API. One case for this is when *module* imports part of its public API from " "other modules, possibly a C backend (like ``csv`` and its ``_csv``)." msgstr "" +"*name_of_module* 引数には、どのモジュールで定義された API を公開 API として検" +"出するかを、文字列または文字列のタプルで指定できます。\n" +"例えば、*module* が公開 API の一部を他のモジュールからインポートしている場合" +"に使います。\n" +"インポート元は C のバックエンドであることもあります (``csv`` と ``_csv`` な" +"ど)。" -#: ../../library/test.rst:986 msgid "" "The *extra* argument can be a set of names that wouldn't otherwise be " "automatically detected as \"public\", like objects without a proper :attr:" "`~definition.__module__` attribute. If provided, it will be added to the " "automatically detected ones." msgstr "" +"*extra* 引数には、適切な :attr:`~definition.__module__` 属性を持たないオブ" +"ジェクトなど、自動的には「公開」と検出されない名前の集合を指定できます。\n" +"指定した名前は、自動検出された名前に追加されます。" -#: ../../library/test.rst:990 msgid "" "The *not_exported* argument can be a set of names that must not be treated " "as part of the public API even though their names indicate otherwise." msgstr "" +"*not_exported* 引数には、名前の形式が公開名を示していても公開 API の一部とし" +"て扱ってはいけない名前の集合を指定できます。" #: ../../library/test.rst:993 ../../library/test.rst:1623 msgid "Example use::" msgstr "使用例::" -#: ../../library/test.rst:995 msgid "" "import bar\n" "import foo\n" @@ -1322,6 +1508,22 @@ msgid "" " support.check__all__(self, bar, ('bar', '_bar'),\n" " extra=extra, not_exported=not_exported)" msgstr "" +"import bar\n" +"import foo\n" +"import unittest\n" +"from test import support\n" +"\n" +"class MiscTestCase(unittest.TestCase):\n" +" def test__all__(self):\n" +" support.check__all__(self, foo)\n" +"\n" +"class OtherTestCase(unittest.TestCase):\n" +" def test__all__(self):\n" +" extra = {'BAR_CONST', 'FOO_CONST'}\n" +" not_exported = {'baz'} # ドキュメントに記載されていない名前\n" +" # bar は API の一部を _bar からインポートする\n" +" support.check__all__(self, bar, ('bar', '_bar'),\n" +" extra=extra, not_exported=not_exported)" #: ../../library/test.rst:1016 msgid "" @@ -1330,69 +1532,77 @@ msgid "" "an :exc:`OSError`." msgstr "" -#: ../../library/test.rst:1025 msgid "Assert that type *tp* cannot be instantiated using *args* and *kwds*." msgstr "" +"*args* と *kwds* を使って型 *tp* のインスタンスを作成できないことを検証しま" +"す。" -#: ../../library/test.rst:1032 msgid "" "This function returns a context manager that will change the global :func:" "`sys.set_int_max_str_digits` setting for the duration of the context to " "allow execution of test code that needs a different limit on the number of " "digits when converting between an integer and string." msgstr "" +"コンテキストの実行中、グローバルな :func:`sys.set_int_max_str_digits` の設定" +"を変更するコンテキストマネージャを返します。\n" +"整数と文字列の相互変換で、桁数の上限を変更する必要があるテストコードを実行で" +"きるようにします。" #: ../../library/test.rst:1040 msgid "The :mod:`test.support` module defines the following classes:" msgstr ":mod:`test.support` モジュールでは、以下のクラスを定義しています:" -#: ../../library/test.rst:1045 msgid "" "A context manager used to try to prevent crash dialog popups on tests that " "are expected to crash a subprocess." msgstr "" +"サブプロセスのクラッシュが想定されるテストで、クラッシュを通知するダイアログ" +"の表示を抑えようとするコンテキストマネージャです。" -#: ../../library/test.rst:1048 msgid "" "On Windows, it disables Windows Error Reporting dialogs using `SetErrorMode " "`_." msgstr "" +"Windows では `SetErrorMode `_ を使い、Windows エラー報告のダイアログを無効にしま" +"す。" -#: ../../library/test.rst:1051 msgid "" "On UNIX, :func:`resource.setrlimit` is used to set :const:`resource." "RLIMIT_CORE`'s soft limit to 0 to prevent coredump file creation." msgstr "" +"UNIX では :func:`resource.setrlimit` を使って :const:`resource.RLIMIT_CORE` " +"のソフトリミットを 0 に設定し、コアダンプファイルが作成されることを防ぎます。" -#: ../../library/test.rst:1055 msgid "" "On both platforms, the old value is restored by :meth:`~object.__exit__`." msgstr "" +"どちらのプラットフォームでも、:meth:`~object.__exit__` で元の値に戻します。" -#: ../../library/test.rst:1060 msgid "" "Class to save and restore signal handlers registered by the Python signal " "handler." msgstr "" +"Python のシグナルハンドラによって登録されたシグナルハンドラを保存し、復元する" +"クラスです。" -#: ../../library/test.rst:1065 msgid "" "Save the signal handlers to a dictionary mapping signal numbers to the " "current signal handler." msgstr "" +"シグナル番号から現在のシグナルハンドラへのマッピングを辞書に保存します。" -#: ../../library/test.rst:1070 msgid "" "Set the signal numbers from the :meth:`save` dictionary to the saved handler." msgstr "" +":meth:`save` が作成した辞書のシグナル番号に、保存したハンドラを設定します。" -#: ../../library/test.rst:1078 msgid "Try to match a single dict with the supplied arguments." -msgstr "" +msgstr "1 つの辞書が指定された引数と一致するか調べます。" -#: ../../library/test.rst:1083 msgid "Try to match a single stored value (*dv*) with a supplied value (*v*)." msgstr "" +"保存されている 1 つの値 (*dv*) が、指定された値 (*v*) と一致するか調べます。" #: ../../library/test.rst:1087 msgid ":mod:`test.support.socket_helper` --- Utilities for socket tests" @@ -1404,9 +1614,10 @@ msgid "" "tests." msgstr "" -#: ../../library/test.rst:1100 msgid "Set to ``True`` if IPv6 is enabled on this host, ``False`` otherwise." msgstr "" +"このホストで IPv6 が有効な場合は ``True``、それ以外の場合は ``False`` に設定" +"されます。" #: ../../library/test.rst:1105 msgid "" @@ -1419,7 +1630,6 @@ msgid "" "port is returned." msgstr "" -#: ../../library/test.rst:1114 msgid "" "Either this method or :func:`bind_port` should be used for any tests where a " "server socket needs to be bound to a particular port for the duration of the " @@ -1431,8 +1641,16 @@ msgid "" "since it can make multiple instances of the test impossible to run " "simultaneously, which is a problem for buildbots." msgstr "" +"テストの実行中、サーバーソケットを特定のポートにバインドする必要があるテスト" +"では、この関数または :func:`bind_port` を使ってください。\n" +"どちらを使うかは、呼び出し側のコードが Python のソケットを作成するのか、それ" +"ともコンストラクタや外部プログラムに未使用のポートを渡す必要があるのか (例え" +"ば openssl の s_server モードの ``-accept`` 引数) によって決まります。\n" +"可能な場合は、常に :func:`find_unused_port` より :func:`bind_port` を優先して" +"ください。\n" +"ポート番号を固定すると、同じテストを複数同時に実行できなくなることがあり、" +"buildbot で問題になるため、推奨しません。" -#: ../../library/test.rst:1128 msgid "" "Bind the socket to a free port and return the port number. Relies on " "ephemeral ports in order to ensure we are using an unbound port. This is " @@ -1444,33 +1662,51 @@ msgid "" "options for TCP/IP sockets. The only case for setting these options is " "testing multicasting via multiple UDP sockets." msgstr "" +"ソケットを空いているポートにバインドし、ポート番号を返します。\n" +"エフェメラルポートを使うことで、まだバインドされていないポートであることを保" +"証します。\n" +"特に buildbot 環境では多くのテストが同時に実行される可能性があるため、これは" +"重要です。\n" +"``sock.family`` が :const:`~socket.AF_INET` かつ ``sock.type`` が :const:" +"`~socket.SOCK_STREAM` で、ソケットに :const:`~socket.SO_REUSEADDR` または :" +"const:`~socket.SO_REUSEPORT` が設定されている場合は、例外を送出します。\n" +"テストでは、TCP/IP ソケットにこれらのオプションを設定してはいけません。\n" +"これらを設定するのは、複数の UDP ソケットでマルチキャストをテストする場合だけ" +"です。" -#: ../../library/test.rst:1139 msgid "" "Additionally, if the :const:`~socket.SO_EXCLUSIVEADDRUSE` socket option is " "available (i.e. on Windows), it will be set on the socket. This will " "prevent anyone else from binding to our host/port for the duration of the " "test." msgstr "" +"さらに、:const:`~socket.SO_EXCLUSIVEADDRUSE` ソケットオプションが利用できる場" +"合 (Windows など) は、これをソケットに設定します。\n" +"これにより、テストの実行中に他のソケットが同じホストとポートにバインドするこ" +"とを防ぎます。" -#: ../../library/test.rst:1147 msgid "" "Bind a Unix socket, raising :exc:`unittest.SkipTest` if :exc:" "`PermissionError` is raised." msgstr "" +"Unix ソケットをバインドします。\n" +":exc:`PermissionError` が発生した場合は :exc:`unittest.SkipTest` を送出しま" +"す。" -#: ../../library/test.rst:1153 msgid "" "A decorator for running tests that require a functional ``bind()`` for Unix " "sockets." msgstr "" +"Unix ソケットで ``bind()`` が機能することを必要とするテストを実行するためのデ" +"コレータです。" -#: ../../library/test.rst:1159 msgid "" "A context manager that raises :exc:`~test.support.ResourceDenied` when " "various issues with the internet connection manifest themselves as " "exceptions." msgstr "" +"インターネット接続のさまざまな問題が例外として発生した場合に、:exc:`~test." +"support.ResourceDenied` を送出するコンテキストマネージャです。" #: ../../library/test.rst:1165 msgid "" @@ -1484,25 +1720,31 @@ msgid "" "script execution tests." msgstr "" -#: ../../library/test.rst:1176 msgid "" "Return ``True`` if ``sys.executable interpreter`` requires environment " "variables in order to be able to run at all." msgstr "" +"``sys.executable`` が指すインタープリタの実行に環境変数が必要な場合は、" +"``True`` を返します。" -#: ../../library/test.rst:1179 msgid "" "This is designed to be used with ``@unittest.skipIf()`` to annotate tests " "that need to use an ``assert_python*()`` function to launch an isolated mode " "(``-I``) or no environment mode (``-E``) sub-interpreter process." msgstr "" +"``assert_python*()`` 関数を使って隔離モード (``-I``) または環境変数を無視する" +"モード (``-E``) で子インタープリタプロセスを起動する必要があるテストに対し、" +"``@unittest.skipIf()`` と組み合わせて使うことを想定しています。" -#: ../../library/test.rst:1183 msgid "" "A normal build & test does not run into this situation but it can happen " "when trying to run the standard library test suite from an interpreter that " "doesn't have an obvious home with Python's current home finding logic." msgstr "" +"通常のビルドとテストではこの状況にはなりません。\n" +"ただし、Python の現在のホームディレクトリ検出処理ではホームを特定できないイン" +"タープリタから、標準ライブラリのテストスイートを実行しようとすると発生するこ" +"とがあります。" #: ../../library/test.rst:1187 msgid "" @@ -1512,30 +1754,33 @@ msgid "" "interpreter can start." msgstr "" -#: ../../library/test.rst:1195 msgid "" "Set up the environment based on *env_vars* for running the interpreter in a " "subprocess. The values can include ``__isolated``, ``__cleanenv``, " "``__cwd``, and ``TERM``." msgstr "" +"サブプロセスでインタープリタを実行するため、*env_vars* に基づいて環境を設定し" +"ます。\n" +"``__isolated``、``__cleanenv``、``__cwd``、``TERM`` を指定できます。" -#: ../../library/test.rst:1199 ../../library/test.rst:1215 -#: ../../library/test.rst:1227 msgid "The function no longer strips whitespaces from *stderr*." -msgstr "" +msgstr "*stderr* から空白を除去しなくなりました。" -#: ../../library/test.rst:1205 msgid "" "Assert that running the interpreter with *args* and optional environment " "variables *env_vars* succeeds (``rc == 0``) and return a ``(return code, " "stdout, stderr)`` tuple." msgstr "" +"*args* と省略可能な環境変数 *env_vars* を使ったインタープリタの実行が成功す" +"る (``rc == 0``) ことを検証し、``(return code, stdout, stderr)`` タプルを返し" +"ます。" -#: ../../library/test.rst:1209 msgid "" "If the *__cleanenv* keyword-only parameter is set, *env_vars* is used as a " "fresh environment." msgstr "" +"キーワード専用引数 *__cleanenv* を設定すると、*env_vars* を新しい環境として使" +"います。" #: ../../library/test.rst:1212 msgid "" @@ -1543,54 +1788,63 @@ msgid "" "the *__isolated* keyword-only parameter is set to ``False``." msgstr "" -#: ../../library/test.rst:1221 msgid "" "Assert that running the interpreter with *args* and optional environment " "variables *env_vars* fails (``rc != 0``) and return a ``(return code, " "stdout, stderr)`` tuple." msgstr "" +"*args* と省略可能な環境変数 *env_vars* を使ったインタープリタの実行が失敗す" +"る (``rc != 0``) ことを検証し、``(return code, stdout, stderr)`` タプルを返し" +"ます。" -#: ../../library/test.rst:1225 msgid "See :func:`assert_python_ok` for more options." msgstr "" +"その他のオプションについては :func:`assert_python_ok` を参照してください。" -#: ../../library/test.rst:1233 msgid "Run a Python subprocess with the given arguments." -msgstr "" +msgstr "指定された引数で Python のサブプロセスを実行します。" -#: ../../library/test.rst:1235 msgid "" "*kw* is extra keyword args to pass to :func:`subprocess.Popen`. Returns a :" "class:`subprocess.Popen` object." msgstr "" +"*kw* は :func:`subprocess.Popen` に渡す追加のキーワード引数です。\n" +":class:`subprocess.Popen` オブジェクトを返します。" -#: ../../library/test.rst:1241 msgid "" "Run the given :class:`subprocess.Popen` process until completion and return " "stdout." msgstr "" +"指定された :class:`subprocess.Popen` のプロセスが完了するまで実行し、標準出力" +"を返します。" -#: ../../library/test.rst:1247 msgid "" "Create script containing *source* in path *script_dir* and " "*script_basename*. If *omit_suffix* is ``False``, append ``.py`` to the " "name. Return the full script path." msgstr "" +"*script_dir* と *script_basename* で指定したパスに、*source* を内容とするスク" +"リプトを作成します。\n" +"*omit_suffix* が ``False`` の場合は、名前に ``.py`` を追加します。\n" +"スクリプトの完全なパスを返します。" -#: ../../library/test.rst:1254 msgid "" "Create zip file at *zip_dir* and *zip_basename* with extension ``zip`` which " "contains the files in *script_name*. *name_in_zip* is the archive name. " "Return a tuple containing ``(full path, full path of archive name)``." msgstr "" +"*zip_dir* と *zip_basename* で指定した場所に、*script_name* のファイルを含" +"む、拡張子が ``zip`` の zip ファイルを作成します。\n" +"*name_in_zip* はアーカイブ内の名前です。\n" +"``(完全なパス, アーカイブ内の名前の完全なパス)`` のタプルを返します。" -#: ../../library/test.rst:1261 msgid "" "Create a directory named *pkg_dir* containing an ``__init__`` file with " "*init_source* as its contents." msgstr "" +"*pkg_dir* という名前のディレクトリを作成し、その中に *init_source* を内容とす" +"る ``__init__`` ファイルを作成します。" -#: ../../library/test.rst:1268 msgid "" "Create a zip package directory with a path of *zip_dir* and *zip_basename* " "containing an empty ``__init__`` file and a file *script_basename* " @@ -1598,6 +1852,13 @@ msgid "" "be compiled and added to the zip package. Return a tuple of the full zip " "path and the archive name for the zip file." msgstr "" +"*zip_dir* と *zip_basename* をパスとする zip パッケージディレクトリを作成しま" +"す。\n" +"空の ``__init__`` ファイルと、*source* を内容とする *script_basename* ファイ" +"ルを含めます。\n" +"*compiled* が ``True`` の場合は、両方のソースファイルをコンパイルして zip " +"パッケージに追加します。\n" +"zip の完全なパスと、zip ファイル内のアーカイブ名のタプルを返します。" #: ../../library/test.rst:1276 msgid "" @@ -1611,26 +1872,25 @@ msgid "" "and inspecting bytecode generation." msgstr "" -#: ../../library/test.rst:1286 msgid "The module defines the following class:" -msgstr "" +msgstr "このモジュールは次のクラスを定義しています。" -#: ../../library/test.rst:1290 msgid "This class has custom assertion methods for inspecting bytecode." msgstr "" +"このクラスは、バイトコードを検査するための独自のアサーションメソッドを持ちま" +"す。" -#: ../../library/test.rst:1294 msgid "Return the disassembly of *co* as string." -msgstr "" +msgstr "*co* を逆アセンブルした結果を文字列で返します。" -#: ../../library/test.rst:1299 msgid "" "Return instr if *opname* is found, otherwise throws :exc:`AssertionError`." msgstr "" +"*opname* が見つかった場合は命令を返し、それ以外の場合は :exc:" +"`AssertionError` を送出します。" -#: ../../library/test.rst:1304 msgid "Throws :exc:`AssertionError` if *opname* is found." -msgstr "" +msgstr "*opname* が見つかった場合は :exc:`AssertionError` を送出します。" #: ../../library/test.rst:1308 msgid ":mod:`test.support.threading_helper` --- Utilities for threading tests" @@ -1642,49 +1902,57 @@ msgid "" "threading tests." msgstr "" -#: ../../library/test.rst:1320 msgid "" "Join a *thread* within *timeout*. Raise an :exc:`AssertionError` if thread " "is still alive after *timeout* seconds." msgstr "" +"*thread* を *timeout* 以内に join します。\n" +"*timeout* 秒後もスレッドが生存している場合は、:exc:`AssertionError` を送出し" +"ます。" -#: ../../library/test.rst:1326 msgid "Decorator to ensure the threads are cleaned up even if the test fails." msgstr "" +"テストが失敗してもスレッドが確実に後始末されるようにするデコレータです。" -#: ../../library/test.rst:1331 msgid "" "Context manager to start *threads*, which is a sequence of threads. *unlock* " "is a function called after the threads are started, even if an exception was " "raised; an example would be :meth:`threading.Event.set`. ``start_threads`` " "will attempt to join the started threads upon exit." msgstr "" +"スレッドのシーケンス *threads* を開始するコンテキストマネージャです。\n" +"*unlock* はスレッドの開始後に呼び出す関数で、例外が発生しても呼び出されま" +"す。\n" +"例えば :meth:`threading.Event.set` を指定できます。\n" +"``start_threads`` は終了時に、開始したスレッドを join しようとします。" -#: ../../library/test.rst:1339 msgid "" "Cleanup up threads not specified in *original_values*. Designed to emit a " "warning if a test leaves running threads in the background." msgstr "" +"*original_values* に含まれないスレッドを後始末します。\n" +"テストがバックグラウンドで動作するスレッドを残した場合に、警告を出すための関" +"数です。" -#: ../../library/test.rst:1345 msgid "Return current thread count and copy of dangling threads." -msgstr "" +msgstr "現在のスレッド数と、残存するスレッドの集合のコピーを返します。" -#: ../../library/test.rst:1350 msgid "" "Context manager to wait until all threads created in the ``with`` statement " "exit." msgstr "" +"``with`` 文内で作成されたすべてのスレッドが終了するまで待つコンテキストマネー" +"ジャです。" -#: ../../library/test.rst:1356 msgid "" "Context manager catching :class:`threading.Thread` exception using :func:" "`threading.excepthook`." msgstr "" +":func:`threading.excepthook` を使って :class:`threading.Thread` の例外を捕捉" +"するコンテキストマネージャです。" -#: ../../library/test.rst:1359 msgid "Attributes set when an exception is caught:" -msgstr "" +msgstr "例外を捕捉したときに設定される属性です。" #: ../../library/test.rst:1361 msgid "``exc_type``" @@ -1702,15 +1970,12 @@ msgstr "``exc_traceback``" msgid "``thread``" msgstr "``thread``" -#: ../../library/test.rst:1366 msgid "See :func:`threading.excepthook` documentation." -msgstr "" +msgstr ":func:`threading.excepthook` のドキュメントを参照してください。" -#: ../../library/test.rst:1368 msgid "These attributes are deleted at the context manager exit." -msgstr "" +msgstr "これらの属性は、コンテキストマネージャの終了時に削除されます。" -#: ../../library/test.rst:1372 msgid "" "with threading_helper.catch_threading_exception() as cm:\n" " # code spawning a thread which raises an exception\n" @@ -1724,6 +1989,17 @@ msgid "" "# exists at this point\n" "# (to avoid reference cycles)" msgstr "" +"with threading_helper.catch_threading_exception() as cm:\n" +" # 例外を送出するスレッドを起動するコード\n" +" ...\n" +"\n" +" # cm の次の属性を使ってスレッドの例外を調べる:\n" +" # exc_type, exc_value, exc_traceback, thread\n" +" ...\n" +"\n" +"# この時点では cm の exc_type, exc_value, exc_traceback, thread 属性は存在し" +"ない\n" +"# (循環参照を避けるため)" #: ../../library/test.rst:1388 msgid ":mod:`test.support.os_helper` --- Utilities for os tests" @@ -1749,13 +2025,18 @@ msgstr "" "テンポラリファイルの名前として安全に利用できる名前に設定されます。作成した一" "時ファイルは全て閉じ、unlink (削除) しなければなりません。" -#: ../../library/test.rst:1416 msgid "" "Set to a filename containing the :data:`FS_NONASCII` character, if it " "exists. This guarantees that if the filename exists, it can be encoded and " "decoded with the default filesystem encoding. This allows tests that require " "a non-ASCII filename to be easily skipped on platforms where they can't work." msgstr "" +":data:`FS_NONASCII` 文字が存在する場合は、その文字を含むファイル名に設定され" +"ます。\n" +"このファイル名が定義されていれば、デフォルトのファイルシステムエンコーディン" +"グでエンコードとデコードが可能であることが保証されます。\n" +"そのため、非 ASCII のファイル名を必要とするテストを、それが動作しないプラット" +"フォームで簡単にスキップできます。" #: ../../library/test.rst:1424 msgid "" @@ -1777,9 +2058,8 @@ msgstr "" "(bytes型)に設定します。そのようなファイル名を生成できない場合は、 ``None`` " "になる可能性があります。" -#: ../../library/test.rst:1438 msgid "Set to a non-ASCII name for a temporary file." -msgstr "非 ASCII 名を一時ファイルに設定します。" +msgstr "一時ファイル用の非 ASCII の名前に設定されます。" #: ../../library/test.rst:1443 msgid "" @@ -1799,12 +2079,15 @@ msgstr "" msgid "Added dictionary interface." msgstr "辞書のインターフェースを追加しました。" -#: ../../library/test.rst:1455 msgid "" "Simple :term:`path-like object`. It implements the :meth:`~os.PathLike." "__fspath__` method which just returns the *path* argument. If *path* is an " "exception, it will be raised in :meth:`!__fspath__`." msgstr "" +"単純な :term:`path-like object` です。\n" +"*path* 引数をそのまま返す :meth:`~os.PathLike.__fspath__` メソッドを実装して" +"います。\n" +"*path* が例外の場合は、:meth:`!__fspath__` でその例外を送出します。" #: ../../library/test.rst:1463 msgid "" @@ -1812,13 +2095,11 @@ msgid "" "``value``." msgstr "一時的に、 ``envvar`` を ``value`` にセットします。" -#: ../../library/test.rst:1469 msgid "Temporarily unset one or more environment variables." -msgstr "" +msgstr "1 つ以上の環境変数の設定を一時的に解除します。" -#: ../../library/test.rst:1471 msgid "More than one environment variable can be unset." -msgstr "" +msgstr "複数の環境変数の設定を解除できるようになりました。" #: ../../library/test.rst:1477 msgid "Return ``True`` if the OS supports symbolic links, ``False`` otherwise." @@ -1826,9 +2107,10 @@ msgstr "" "OS がシンボリックリンクをサポートする場合 ``True`` を返し、その他の場合は " "``False`` を返します。" -#: ../../library/test.rst:1483 msgid "Return ``True`` if the OS supports xattr, ``False`` otherwise." msgstr "" +"OS が xattr をサポートする場合は ``True``、それ以外の場合は ``False`` を返し" +"ます。" #: ../../library/test.rst:1489 msgid "" @@ -1849,18 +2131,19 @@ msgstr "" "それ以外の場合には、警告を出すだけでカレントディレクトリは同じままにしておき" "ます。" -#: ../../library/test.rst:1499 msgid "" "Create an empty file with *filename*. If it already exists, truncate it." msgstr "" +"*filename* という名前の空のファイルを作成します。\n" +"すでに存在する場合は、長さを 0 に切り詰めます。" -#: ../../library/test.rst:1504 msgid "Count the number of open file descriptors." -msgstr "" +msgstr "開かれているファイル記述子の数を数えます。" -#: ../../library/test.rst:1509 msgid "Return ``True`` if the file system for *directory* is case-insensitive." msgstr "" +"*directory* のファイルシステムが大文字と小文字を区別しない場合は ``True`` を" +"返します。" #: ../../library/test.rst:1514 msgid "" @@ -1870,29 +2153,34 @@ msgstr "" "一時ファイルを開いた後に閉じ、そのファイル記述子を返すことで無効な記述子を作" "成します。" -#: ../../library/test.rst:1520 msgid "" "Call :func:`os.rmdir` on *filename*. On Windows platforms, this is wrapped " "with a wait loop that checks for the existence of the file, which is needed " "due to antivirus programs that can hold files open and prevent deletion." msgstr "" +"*filename* に対して :func:`os.rmdir` を呼び出します。\n" +"Windows では、ファイルの存在を確認する待機ループでこの処理を囲みます。\n" +"ウイルス対策プログラムがファイルを開いたままにして削除を妨げることがあるた" +"め、この処理が必要です。" -#: ../../library/test.rst:1528 msgid "" "Call :func:`shutil.rmtree` on *path* or call :func:`os.lstat` and :func:`os." "rmdir` to remove a path and its contents. As with :func:`rmdir`, on Windows " "platforms this is wrapped with a wait loop that checks for the existence of " "the files." msgstr "" +"*path* に対して :func:`shutil.rmtree` を呼び出すか、:func:`os.lstat` と :" +"func:`os.rmdir` を使って、パスとその内容を削除します。\n" +":func:`rmdir` と同様に、Windows ではファイルの存在を確認する待機ループでこの" +"処理を囲みます。" #: ../../library/test.rst:1536 msgid "A decorator for running tests that require support for symbolic links." msgstr "" "シンボリックリンクのサポートが必要なテストを実行することを表すデコレータ。" -#: ../../library/test.rst:1541 msgid "A decorator for running tests that require support for xattr." -msgstr "" +msgstr "xattr のサポートを必要とするテストを実行するためのデコレータです。" #: ../../library/test.rst:1546 msgid "" @@ -1930,24 +2218,30 @@ msgid "" "the directory." msgstr "*path* に一時ディレクトリを作成し与えるコンテキストマネージャです。" -#: ../../library/test.rst:1564 msgid "" "If *path* is ``None``, the temporary directory is created using :func:" "`tempfile.mkdtemp`. If *quiet* is ``False``, the context manager raises an " "exception on error. Otherwise, if *path* is specified and cannot be " "created, only a warning is issued." msgstr "" +"*path* が ``None`` の場合は、:func:`tempfile.mkdtemp` を使って一時ディレクト" +"リを作成します。\n" +"*quiet* が ``False`` の場合、コンテキストマネージャはエラー時に例外を送出しま" +"す。\n" +"それ以外では、指定された *path* を作成できなかった場合に警告だけを出します。" #: ../../library/test.rst:1572 msgid "A context manager that temporarily sets the process umask." msgstr "一時的にプロセスの umask を設定するコンテキストマネージャ。" -#: ../../library/test.rst:1577 msgid "" "Call :func:`os.unlink` on *filename*. As with :func:`rmdir`, on Windows " "platforms, this is wrapped with a wait loop that checks for the existence of " "the file." msgstr "" +"*filename* に対して :func:`os.unlink` を呼び出します。\n" +":func:`rmdir` と同様に、Windows ではファイルの存在を確認する待機ループでこの" +"処理を囲みます。" #: ../../library/test.rst:1583 msgid ":mod:`test.support.import_helper` --- Utilities for import tests" @@ -2022,7 +2316,6 @@ msgstr "" "指定したモジュールがインポートできなかった場合に、この関数は :exc:" "`ImportError` を送出します。" -#: ../../library/test.rst:1625 msgid "" "# Get copies of the warnings module for testing without affecting the\n" "# version being used by the rest of the test suite. One copy uses the\n" @@ -2031,6 +2324,13 @@ msgid "" "py_warnings = import_fresh_module('warnings', blocked=['_warnings'])\n" "c_warnings = import_fresh_module('warnings', fresh=['_warnings'])" msgstr "" +"# テストスイートの他の部分が使うモジュールに影響を与えずにテストできるよ" +"う、\n" +"# warnings モジュールのコピーを取得する。\n" +"# 一方は C の実装を使い、もう一方はフォールバック用の純 Python 実装を\n" +"# 強制的に使う\n" +"py_warnings = import_fresh_module('warnings', blocked=['_warnings'])\n" +"c_warnings = import_fresh_module('warnings', fresh=['_warnings'])" #: ../../library/test.rst:1637 msgid "" @@ -2042,66 +2342,83 @@ msgstr "" "ポートと異なり、この関数はモジュールをインポートできなかった場合に :exc:" "`unittest.SkipTest` 例外を発生させます。" -#: ../../library/test.rst:1641 msgid "" "Module and package deprecation messages are suppressed during this import if " "*deprecated* is ``True``. If a module is required on a platform but " "optional for others, set *required_on* to an iterable of platform prefixes " "which will be compared against :data:`sys.platform`." msgstr "" +"*deprecated* が ``True`` の場合、このインポート中はモジュールやパッケージの非" +"推奨メッセージを抑制します。\n" +"あるプラットフォームでは必須で、他では省略可能なモジュールの場合は、" +"*required_on* にプラットフォーム名の接頭辞のイテラブルを指定してください。\n" +"これらは :data:`sys.platform` と比較されます。" -#: ../../library/test.rst:1651 msgid "Return a copy of :data:`sys.modules`." -msgstr "" +msgstr ":data:`sys.modules` のコピーを返します。" -#: ../../library/test.rst:1656 msgid "" "Remove modules except for *oldmodules* and ``encodings`` in order to " "preserve internal cache." msgstr "" +"内部キャッシュを保持するために、*oldmodules* と ``encodings`` 以外のモジュー" +"ルを削除します。" #: ../../library/test.rst:1662 msgid "Delete *name* from ``sys.modules``." msgstr "``sys.modules`` から *name* を削除します。" -#: ../../library/test.rst:1667 msgid "" "Move a :pep:`3147`/:pep:`488` pyc file to its legacy pyc location and return " "the file system path to the legacy pyc file. The *source* value is the file " "system path to the source file. It does not need to exist, however the PEP " "3147/488 pyc file must exist." msgstr "" +":pep:`3147`/:pep:`488` 形式の pyc ファイルを従来の pyc ファイルの場所に移動" +"し、移動先のファイルシステム上のパスを返します。\n" +"*source* はソースファイルのファイルシステム上のパスです。\n" +"ソースファイルは存在しなくてもかまいませんが、PEP 3147/488 形式の pyc ファイ" +"ルは存在しなければなりません。" -#: ../../library/test.rst:1675 msgid "" "A context manager to force import to return a new module reference. This is " "useful for testing module-level behaviors, such as the emission of a :exc:" "`DeprecationWarning` on import. Example usage::" msgstr "" +"インポートで新しいモジュールの参照を返すように強制するコンテキストマネージャ" +"です。\n" +"インポート時の :exc:`DeprecationWarning` の発生など、モジュールレベルの動作の" +"テストに便利です。\n" +"使用例です。 ::" -#: ../../library/test.rst:1679 msgid "" "with CleanImport('foo'):\n" " importlib.import_module('foo') # New reference." msgstr "" +"with CleanImport('foo'):\n" +" importlib.import_module('foo') # 新しい参照" -#: ../../library/test.rst:1685 msgid "A context manager to temporarily add directories to :data:`sys.path`." msgstr "" +":data:`sys.path` にディレクトリを一時的に追加するコンテキストマネージャです。" -#: ../../library/test.rst:1687 msgid "" "This makes a copy of :data:`sys.path`, appends any directories given as " "positional arguments, then reverts :data:`sys.path` to the copied settings " "when the context ends." msgstr "" +":data:`sys.path` のコピーを作成し、位置引数で指定したディレクトリを末尾に追加" +"します。\n" +"コンテキストの終了時に、:data:`sys.path` をコピーした設定に戻します。" -#: ../../library/test.rst:1691 msgid "" "Note that *all* :data:`sys.path` modifications in the body of the context " "manager, including replacement of the object, will be reverted at the end of " "the block." msgstr "" +"コンテキストマネージャの本体で行った :data:`sys.path` への *すべての* 変更" +"は、オブジェクトの置き換えも含めて、ブロックの終了時に元に戻ることに注意して" +"ください。" #: ../../library/test.rst:1697 msgid ":mod:`test.support.warnings_helper` --- Utilities for warnings tests" @@ -2113,29 +2430,38 @@ msgid "" "tests." msgstr "" -#: ../../library/test.rst:1709 msgid "" "Suppress warnings that are instances of *category*, which must be :exc:" "`Warning` or a subclass. Roughly equivalent to :func:`warnings." "catch_warnings` with :meth:`warnings.simplefilter('ignore', " "category=category) `. For example::" msgstr "" +"*category* のインスタンスである警告を抑制します。\n" +"*category* は :exc:`Warning` またはそのサブクラスでなければなりません。\n" +":func:`warnings.catch_warnings` と :meth:`warnings.simplefilter('ignore', " +"category=category) ` を組み合わせるのとおおむね同等で" +"す。\n" +"例えば次のように使います。 ::" -#: ../../library/test.rst:1715 msgid "" "@warning_helper.ignore_warnings(category=DeprecationWarning)\n" "def test_suppress_warning():\n" " # do something" msgstr "" +"@warning_helper.ignore_warnings(category=DeprecationWarning)\n" +"def test_suppress_warning():\n" +" # 何らかの処理を行う" -#: ../../library/test.rst:1724 msgid "" "Context manager to check that no :exc:`ResourceWarning` was raised. You " "must remove the object which may emit :exc:`ResourceWarning` before the end " "of the context manager." msgstr "" +":exc:`ResourceWarning` が発生しなかったことを確認するコンテキストマネージャで" +"す。\n" +":exc:`ResourceWarning` を発生させる可能性があるオブジェクトは、コンテキストマ" +"ネージャの終了前に除去しなければなりません。" -#: ../../library/test.rst:1731 msgid "" "Test for syntax warning in *statement* by attempting to compile *statement*. " "Test also that the :exc:`SyntaxWarning` is emitted only once, and that it " @@ -2146,8 +2472,15 @@ msgid "" "compares to the line of the warning and exception. If *offset* is not " "``None``, compares to the offset of the exception." msgstr "" +"*statement* のコンパイルを試み、構文警告をテストします。\n" +":exc:`SyntaxWarning` が一度だけ発生することと、警告をエラーとして扱う設定で" +"は :exc:`SyntaxError` になることもテストします。\n" +"*testcase* はテストに使う :mod:`unittest` のインスタンスです。\n" +"*errtext* は、発生した :exc:`SyntaxWarning` と送出された :exc:`SyntaxError` " +"の文字列表現にマッチすべき正規表現です。\n" +"*lineno* が ``None`` でなければ、警告と例外の行番号と比較します。\n" +"*offset* が ``None`` でなければ、例外のオフセットと比較します。" -#: ../../library/test.rst:1745 msgid "" "A convenience wrapper for :func:`warnings.catch_warnings` that makes it " "easier to test that a warning was correctly raised. It is approximately " @@ -2155,6 +2488,11 @@ msgid "" "`warnings.simplefilter` set to ``always`` and with the option to " "automatically validate the results that are recorded." msgstr "" +"警告が正しく発生したことを簡単にテストできるようにする、:func:`warnings." +"catch_warnings` の便利なラッパーです。\n" +":meth:`warnings.simplefilter` を ``always`` に設定して ``warnings." +"catch_warnings(record=True)`` を呼び出すのとほぼ同等で、記録した結果を自動的" +"に検証するオプションもあります。" #: ../../library/test.rst:1751 msgid "" @@ -2179,13 +2517,11 @@ msgstr "" msgid "If no arguments are specified, it defaults to::" msgstr "引数が1つもない場合、デフォルトでは次のようになります::" -#: ../../library/test.rst:1762 msgid "check_warnings((\"\", Warning), quiet=True)" -msgstr "" +msgstr "check_warnings((\"\", Warning), quiet=True)" -#: ../../library/test.rst:1764 msgid "In this case all warnings are caught and no errors are raised." -msgstr "この場合、全ての警告は補足され、エラーは発生しません。" +msgstr "この場合、すべての警告が捕捉され、エラーは発生しません。" #: ../../library/test.rst:1766 msgid "" @@ -2216,20 +2552,22 @@ msgstr "" msgid "The context manager is designed to be used like this::" msgstr "コンテキストマネージャーは次のようにして使います::" -#: ../../library/test.rst:1780 msgid "" "with check_warnings((\"assertion is always true\", SyntaxWarning),\n" " (\"\", UserWarning)):\n" " exec('assert(False, \"Hey!\")')\n" " warnings.warn(UserWarning(\"Hide me!\"))" msgstr "" +"with check_warnings((\"assertion is always true\", SyntaxWarning),\n" +" (\"\", UserWarning)):\n" +" exec('assert(False, \"Hey!\")')\n" +" warnings.warn(UserWarning(\"Hide me!\"))" -#: ../../library/test.rst:1785 msgid "" "In this case if either warning was not raised, or some other warning was " "raised, :func:`check_warnings` would raise an error." msgstr "" -"この場合、どちらの警告も発生しなかった場合や、それ以外の警告が発生した場合" +"この場合、いずれかの警告が発生しなかった場合や、それ以外の警告が発生した場合" "は、 :func:`check_warnings` はエラーを発生させます。" #: ../../library/test.rst:1788 diff --git a/library/text.po b/library/text.po index 6012bea70..4b0afa76d 100644 --- a/library/text.po +++ b/library/text.po @@ -16,10 +16,10 @@ msgstr "" "Last-Translator: tomo, 2021\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/text.rst:6 @@ -34,12 +34,12 @@ msgstr "" "この章で説明するモジュールは幅広い文字列操作や様々なテキスト処理サービスを提" "供しています。" -#: ../../library/text.rst:11 msgid "" "The :mod:`codecs` module described under :ref:`binaryservices` is also " "highly relevant to text processing. In addition, see the documentation for " "Python's built-in string type in :ref:`textseq`." msgstr "" -":mod:`codecs` モジュールはテキスト処理と高い関連性を持った :ref:" -"`binaryservices` のなかで説明されています。加えて Python の組み込み文字列型" -"の :ref:`textseq` のドキュメントも参照して下さい。" +":ref:`binaryservices` で説明する :mod:`codecs` モジュールも、テキスト処理と深" +"く関係しています。\n" +"Python の組み込み文字列型については :ref:`textseq` のドキュメントも参照してく" +"ださい。" diff --git a/library/textwrap.po b/library/textwrap.po index f23acd4e9..6b204cafa 100644 --- a/library/textwrap.po +++ b/library/textwrap.po @@ -20,10 +20,10 @@ msgstr "" "Last-Translator: tomo, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/textwrap.rst:2 @@ -47,15 +47,14 @@ msgstr "" "fill するだけの場合は便利関数で十分ですが、多くの処理を行う場合は効率のため" "に :class:`TextWrapper` のインスタンスを使うべきでしょう。" -#: ../../library/textwrap.rst:27 msgid "" "Wraps the single paragraph in *text* (a string) so every line is at most " "*width* characters long. Returns a list of output lines, without final " "newlines." msgstr "" -"*text* (文字列)内の段落を一つだけ折り返しを行います。したがって、すべての行が" -"高々 *width* 文字の長さになります。最後に改行が付かない出力行のリストを返しま" -"す。" +"*text* (文字列) に含まれる 1 つの段落を、各行が最大 *width* 文字になるように" +"折り返します。\n" +"行末に改行文字を含まない出力行のリストを返します。" #: ../../library/textwrap.rst:31 msgid "" @@ -73,17 +72,16 @@ msgstr "" ":func:`wrap` の動作についての詳細は :meth:`TextWrapper.wrap` メソッドを参照し" "てください。" -#: ../../library/textwrap.rst:45 msgid "" "Wraps the single paragraph in *text*, and returns a single string containing " "the wrapped paragraph. :func:`fill` is shorthand for ::" msgstr "" -"*text* 内の段落を一つだけ折り返しを行い、折り返しが行われた段落を含む一つの文" -"字列を返します。 :func:`fill` はこれの省略表現です ::" +"*text* に含まれる 1 つの段落を折り返し、折り返した段落を 1 つの文字列として返" +"します。\n" +":func:`fill` は次の処理を簡略化したものです。 ::" -#: ../../library/textwrap.rst:48 msgid "\"\\n\".join(wrap(text, ...))" -msgstr "" +msgstr "\"\\n\".join(wrap(text, ...))" #: ../../library/textwrap.rst:50 msgid "" @@ -111,7 +109,6 @@ msgstr "" "に収まらない場合、残りの文字数と *placeholder* との和が *width* 内に収まる" "ように、末尾から単語が切り捨てられます::" -#: ../../library/textwrap.rst:65 msgid "" ">>> textwrap.shorten(\"Hello world!\", width=12)\n" "'Hello world!'\n" @@ -120,6 +117,12 @@ msgid "" ">>> textwrap.shorten(\"Hello world\", width=10, placeholder=\"...\")\n" "'Hello...'" msgstr "" +">>> textwrap.shorten(\"Hello world!\", width=12)\n" +"'Hello world!'\n" +">>> textwrap.shorten(\"Hello world!\", width=11)\n" +"'Hello [...]'\n" +">>> textwrap.shorten(\"Hello world\", width=10, placeholder=\"...\")\n" +"'Hello...'" #: ../../library/textwrap.rst:72 msgid "" @@ -170,7 +173,6 @@ msgstr "" msgid "For example::" msgstr "例えば::" -#: ../../library/textwrap.rst:96 msgid "" "def test():\n" " # end first line with \\ to avoid the empty line!\n" @@ -181,6 +183,14 @@ msgid "" " print(repr(s)) # prints ' hello\\n world\\n '\n" " print(repr(dedent(s))) # prints 'hello\\n world\\n'" msgstr "" +"def test():\n" +" # 空行を避けるため、最初の行を \\ で終える\n" +" s = '''\\\n" +" hello\n" +" world\n" +" '''\n" +" print(repr(s)) # 表示結果: ' hello\\n world\\n '\n" +" print(repr(dedent(s))) # 表示結果: 'hello\\n world\\n'" #: ../../library/textwrap.rst:108 msgid "Add *prefix* to the beginning of selected lines in *text*." @@ -198,12 +208,14 @@ msgstr "" "デフォルトでは、(改行文字を含む)空白文字だけの行を除いてすべての行に " "*prefix* を追加します。" -#: ../../library/textwrap.rst:117 msgid "" ">>> s = 'hello\\n\\n \\nworld'\n" ">>> indent(s, ' ')\n" "' hello\\n\\n \\n world'" msgstr "" +">>> s = 'hello\\n\\n \\nworld'\n" +">>> indent(s, ' ')\n" +"' hello\\n\\n \\n world'" #: ../../library/textwrap.rst:121 msgid "" @@ -215,7 +227,6 @@ msgstr "" "できます。例えば、空行や空白文字のみの行にも *prefix* を追加するのは簡単で" "す::" -#: ../../library/textwrap.rst:125 msgid "" ">>> print(indent(s, '+ ', lambda line: True))\n" "+ hello\n" @@ -223,6 +234,11 @@ msgid "" "+\n" "+ world" msgstr "" +">>> print(indent(s, '+ ', lambda line: True))\n" +"+ hello\n" +"+\n" +"+\n" +"+ world" #: ../../library/textwrap.rst:134 msgid "" @@ -258,28 +274,28 @@ msgstr "" "け取ります。それぞれのキーワード引数は一つのインスタンス属性に対応します。し" "たがって、例えば ::" -#: ../../library/textwrap.rst:150 msgid "wrapper = TextWrapper(initial_indent=\"* \")" -msgstr "" +msgstr "wrapper = TextWrapper(initial_indent=\"* \")" #: ../../library/textwrap.rst:152 msgid "is the same as ::" msgstr "はこれと同じです ::" -#: ../../library/textwrap.rst:154 msgid "" "wrapper = TextWrapper()\n" "wrapper.initial_indent = \"* \"" msgstr "" +"wrapper = TextWrapper()\n" +"wrapper.initial_indent = \"* \"" -#: ../../library/textwrap.rst:157 msgid "" "You can reuse the same :class:`TextWrapper` object many times, and you can " "change any of its options through direct assignment to instance attributes " "between uses." msgstr "" -"同じ :class:`TextWrapper` オブジェクトは何回も再利用できます。また、使用中に" -"インスタンス属性へ代入することでそのオプションのどれでも変更できます。" +"同じ :class:`TextWrapper` オブジェクトは何度も再利用できます。\n" +"また、次に使うまでの間にインスタンス属性へ直接代入して、どのオプションでも変" +"更できます。" #: ../../library/textwrap.rst:161 msgid "" @@ -379,7 +395,6 @@ msgstr "" "(デフォルト: ``''``) 一行目以外の折り返しが行われる出力のすべての行の先頭に付" "けられる文字列。一行目以外の各行の折り返しまでの長さにカウントされます。" -#: ../../library/textwrap.rst:235 msgid "" "(default: ``False``) If true, :class:`TextWrapper` attempts to detect " "sentence endings and ensure that sentences are always separated by exactly " @@ -390,25 +405,24 @@ msgid "" "followed by a space. One problem with this algorithm is that it is unable " "to detect the difference between \"Dr.\" in ::" msgstr "" -"(デフォルト: ``False``) もし真ならば、 :class:`TextWrapper` は文の終わりを見" -"つけようとし、確実に文がちょうど二つの空白で常に区切られているようにします。" -"これは一般的に固定スペースフォントのテキストに対して望ましいです。しかし、文" -"の検出アルゴリズムは完全ではありません: 文の終わりには、後ろに空白がある " -"``'.'``, ``'!'`` または ``'?'`` の中の一つ、ことによると ``'\"'`` あるいは " -"``\"'\"`` が付随する小文字があると仮定しています。このアルゴリズムに伴う一つ" -"の問題は下記の\"Dr.\"と ::" +"(デフォルト: ``False``) 真の場合、:class:`TextWrapper` は文の終わりを検出し、" +"文の間を常にちょうど 2 個のスペースで区切ろうとします。\n" +"これは通常、等幅フォントのテキストで望まれる形式です。\n" +"ただし、文を検出するアルゴリズムは完全ではありません。\n" +"文の終わりは、小文字の後に ``'.'``、``'!'``、``'?'`` のいずれかが続き、必要に" +"応じて ``'\"'`` または ``\"'\"`` が続き、その後にスペースがあるものと仮定しま" +"す。\n" +"このアルゴリズムには、次の例の \"Dr.\" と ::" -#: ../../library/textwrap.rst:244 msgid "[...] Dr. Frankenstein's monster [...]" -msgstr "" +msgstr "[...] Dr. Frankenstein's monster [...]" #: ../../library/textwrap.rst:246 msgid "and \"Spot.\" in ::" msgstr "下記の\"Spot.\"の間の差異を検出できないことです ::" -#: ../../library/textwrap.rst:248 msgid "[...] See Spot. See Spot run [...]" -msgstr "" +msgstr "[...] See Spot. See Spot run [...]" #: ../../library/textwrap.rst:250 msgid ":attr:`fix_sentence_endings` is false by default." @@ -439,7 +453,6 @@ msgstr "" "ん。 (:attr:`width` を超える分を最小にするために、長い語は単独で一行に置かれ" "るでしょう。)" -#: ../../library/textwrap.rst:269 msgid "" "(default: ``True``) If true, wrapping will occur preferably on whitespaces " "and right after hyphens in compound words, as it is customary in English. If " @@ -448,20 +461,20 @@ msgid "" "want truly insecable words. Default behaviour in previous versions was to " "always allow breaking hyphenated words." msgstr "" -"(デフォルト: ``True``) 真の場合、英語で一般的なように、ラップ処理は空白か合成" -"語に含まれるハイフンの直後で行われます。偽の場合、空白だけが改行に適した位置" -"として判断されます。ただし、本当に語の途中で改行が行われないようにするために" -"は、 :attr:`break_long_words` 属性を真に設定する必要があります。過去のバー" -"ジョンでのデフォルトの振る舞いは、常にハイフンの直後での改行を許していまし" +"(デフォルト: ``True``) 真の場合、英語で一般的なように、ラップ処理はなるべく空" +"白か合成語に含まれるハイフンの直後で行われます。\n" +"偽の場合、空白だけが改行に適した位置として判断されます。\n" +"ただし、語の途中でまったく改行しないようにするには、:attr:`break_long_words` " +"属性も偽に設定する必要があります。\n" +"過去のバージョンでは、デフォルトで常にハイフンの直後での改行を許していまし" "た。" -#: ../../library/textwrap.rst:279 msgid "" "(default: ``None``) If not ``None``, then the output will contain at most " "*max_lines* lines, with *placeholder* appearing at the end of the output." msgstr "" -"(デフォルト ``None``) ``None`` 以外の場合、出力は行数 *max_lines* を超えない" -"ようにされ、切り詰める際には出力の最後の行を *placeholder* に置き換えます。" +"(デフォルト: ``None``) ``None`` でない場合、出力は最大 *max_lines* 行になり、" +"切り詰めた場合は出力の末尾に *placeholder* が付きます。" #: ../../library/textwrap.rst:289 msgid "" @@ -491,13 +504,12 @@ msgstr "" "取得します。結果の、行末に改行のない行のリストを返します。出力の内容が空にな" "る場合は、返すリストも空になります。" -#: ../../library/textwrap.rst:309 msgid "" "Wraps the single paragraph in *text*, and returns a single string containing " "the wrapped paragraph." msgstr "" -"*text* 内の段落を一つだけ折り返しを行い、折り返しが行われた段落を含む一つの文" -"字列を返します。" +"*text* に含まれる 1 つの段落を折り返し、折り返した段落を 1 つの文字列として返" +"します。" #: ../../library/textwrap.rst:285 msgid "..." diff --git a/library/threading.po b/library/threading.po index 1f72bd7ff..5f747a946 100644 --- a/library/threading.po +++ b/library/threading.po @@ -22,10 +22,10 @@ msgstr "" "Last-Translator: tomo, 2025\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/threading.rst:2 @@ -44,10 +44,8 @@ msgstr "" "このモジュールでは、高水準のスレッドインターフェースをより低水準 な :mod:" "`_thread` モジュールの上に構築しています。" -#: ../../library/threading.rst:194 ../../library/threading.rst:293 -#: ../../library/threading.rst:678 ../../includes/wasm-notavail.rst:3 msgid "Availability" -msgstr "" +msgstr "利用可能な環境" #: ../../includes/wasm-notavail.rst:5 msgid "" @@ -61,7 +59,6 @@ msgstr "" msgid "Introduction" msgstr "はじめに" -#: ../../library/threading.rst:19 msgid "" "The :mod:`!threading` module provides a way to run multiple `threads " "`_ (smaller units of a " @@ -71,15 +68,24 @@ msgid "" "bound, such as file operations or making network requests, where much of the " "time is spent waiting for external resources." msgstr "" +":mod:`!threading` モジュールを使うと、1 つのプロセス内で複数の `スレッド " +"`_ (プロセスより小さな実行" +"単位) を並行して実行できます。\n" +"スレッドの作成と管理ができ、メモリ空間を共有しながらタスクを並列に実行できま" +"す。\n" +"スレッドは、ファイル操作やネットワークリクエストなど、外部リソースを待つ時間" +"が大部分を占める I/O バウンドのタスクで特に役立ちます。" -#: ../../library/threading.rst:27 msgid "" "A typical use case for :mod:`!threading` includes managing a pool of worker " "threads that can process multiple tasks concurrently. Here's a basic " "example of creating and starting threads using :class:`~threading.Thread`::" msgstr "" +":mod:`!threading` の典型的な用途には、複数のタスクを並行して処理するワーカー" +"スレッドのプールの管理があります。\n" +"以下は :class:`~threading.Thread` を使ってスレッドを作成し、開始する基本的な" +"例です。 ::" -#: ../../library/threading.rst:31 msgid "" "import threading\n" "import time\n" @@ -111,6 +117,34 @@ msgid "" "for t in threads:\n" " t.join()" msgstr "" +"import threading\n" +"import time\n" +"\n" +"def crawl(link, delay=3):\n" +" print(f\"crawl started for {link}\")\n" +" time.sleep(delay) # ブロックする I/O (ネットワークリクエストを模擬)\n" +" print(f\"crawl ended for {link}\")\n" +"\n" +"links = [\n" +" \"https://python.org\",\n" +" \"https://docs.python.org\",\n" +" \"https://peps.python.org\",\n" +"]\n" +"\n" +"# 各リンクのスレッドを開始する\n" +"threads = []\n" +"for link in links:\n" +" # 位置引数は args、キーワード引数は kwargs で渡す\n" +" t = threading.Thread(target=crawl, args=(link,), kwargs={\"delay\": 2})\n" +" threads.append(t)\n" +"\n" +"# 各スレッドを開始する\n" +"for t in threads:\n" +" t.start()\n" +"\n" +"# すべてのスレッドの終了を待つ\n" +"for t in threads:\n" +" t.join()" #: ../../library/threading.rst:60 msgid "This module used to be optional, it is now always available." @@ -118,32 +152,39 @@ msgstr "" "このモジュールは以前はオプションでしたが、常に利用可能なモジュールとなりまし" "た。" -#: ../../library/threading.rst:65 msgid "" ":class:`concurrent.futures.ThreadPoolExecutor` offers a higher level " "interface to push tasks to a background thread without blocking execution of " "the calling thread, while still being able to retrieve their results when " "needed." msgstr "" +":class:`concurrent.futures.ThreadPoolExecutor` は、呼び出し側のスレッドをブ" +"ロックせずにバックグラウンドのスレッドへタスクを渡し、必要なときに結果を取得" +"できる、より高水準のインターフェースを提供します。" -#: ../../library/threading.rst:69 msgid "" ":mod:`queue` provides a thread-safe interface for exchanging data between " "running threads." msgstr "" +":mod:`queue` は、実行中のスレッド間でデータを交換するためのスレッドセーフなイ" +"ンターフェースを提供します。" -#: ../../library/threading.rst:72 msgid "" ":mod:`asyncio` offers an alternative approach to achieving task level " "concurrency without requiring the use of multiple operating system threads." msgstr "" +":mod:`asyncio` は、オペレーティングシステムのスレッドを複数使わずに、タスクレ" +"ベルの並行処理を実現する別の方法を提供します。" -#: ../../library/threading.rst:77 msgid "" "In the Python 2.x series, this module contained ``camelCase`` names for some " "methods and functions. These are deprecated as of Python 3.10, but they are " "still supported for compatibility with Python 2.5 and lower." msgstr "" +"Python 2.x 系では、このモジュールの一部のメソッドや関数に ``camelCase`` 形式" +"の名前がありました。\n" +"これらは Python 3.10 以降では非推奨ですが、Python 2.5 以前との互換性のため、" +"引き続きサポートされています。" #: ../../library/threading.rst:84 msgid "" @@ -163,11 +204,9 @@ msgstr "" "ProcessPoolExecutor` の利用をお勧めします。 ただし、I/Oバウンドなタスクを並行" "して複数走らせたい場合においては、 マルチスレッドは正しい選択肢です。" -#: ../../library/threading.rst:95 msgid "GIL and performance considerations" -msgstr "" +msgstr "GIL とパフォーマンスに関する考慮事項" -#: ../../library/threading.rst:97 msgid "" "Unlike the :mod:`multiprocessing` module, which uses separate processes to " "bypass the :term:`global interpreter lock` (GIL), the threading module " @@ -177,6 +216,13 @@ msgid "" "bytecode at a time. Despite this, threads remain a useful tool for achieving " "concurrency in many scenarios." msgstr "" +"別々のプロセスを使って :term:`グローバルインタープリタロック ` (GIL) を回避する :mod:`multiprocessing` モジュールとは異な" +"り、threading モジュールは 1 つのプロセス内で動作するため、すべてのスレッドが" +"同じメモリ空間を共有します。\n" +"ただし、一度に Python バイトコードを実行できるのは 1 つのスレッドだけなので、" +"CPU バウンドのタスクでは GIL によってスレッドによる性能向上が制限されます。\n" +"それでも、多くの場面でスレッドは並行処理を実現する有用な手段です。" #: ../../library/threading.rst:105 msgid "" @@ -201,21 +247,22 @@ msgstr "" "生存中の :class:`Thread` オブジェクトの数を返します。この数は :func:`." "enumerate` の返すリストの長さと同じです。" -#: ../../library/threading.rst:122 msgid "The function ``activeCount`` is a deprecated alias for this function." -msgstr "関数``activeCount``はこの関数の非推奨エイリアスです。" +msgstr "関数 ``activeCount`` はこの関数の非推奨エイリアスです。" -#: ../../library/threading.rst:127 msgid "" "Return the current :class:`Thread` object, corresponding to the caller's " "thread of control. If the caller's thread of control was not created " "through the :mod:`!threading` module, a dummy thread object with limited " "functionality is returned." msgstr "" +"呼び出し元の実行スレッドに対応する、現在の :class:`Thread` オブジェクトを返し" +"ます。\n" +"呼び出し元のスレッドが :mod:`!threading` モジュールを使って作成されたものでな" +"ければ、機能が制限されたダミーのスレッドオブジェクトを返します。" -#: ../../library/threading.rst:132 msgid "The function ``currentThread`` is a deprecated alias for this function." -msgstr "関数``currentThread``はこの関数の非推奨エイリアスです。" +msgstr "関数 ``currentThread`` はこの関数の非推奨エイリアスです。" #: ../../library/threading.rst:137 msgid "Handle uncaught exception raised by :func:`Thread.run`." @@ -233,56 +280,66 @@ msgstr "*exc_type*: 例外の型" msgid "*exc_value*: Exception value, can be ``None``." msgstr "*exc_value*: 例外の値、``None`` の可能性がある。" -#: ../../library/threading.rst:143 msgid "*exc_traceback*: Exception traceback, can be ``None``." msgstr "" +"*exc_traceback*: 例外のトレースバック。\n" +"``None`` の場合もあります。" -#: ../../library/threading.rst:144 msgid "*thread*: Thread which raised the exception, can be ``None``." msgstr "" +"*thread*: 例外を送出したスレッド。\n" +"``None`` の場合もあります。" -#: ../../library/threading.rst:146 msgid "" "If *exc_type* is :exc:`SystemExit`, the exception is silently ignored. " "Otherwise, the exception is printed out on :data:`sys.stderr`." msgstr "" +"*exc_type* が :exc:`SystemExit` の場合は、何も表示せずに例外を無視します。\n" +"それ以外の場合は、:data:`sys.stderr` に例外を出力します。" -#: ../../library/threading.rst:149 msgid "" "If this function raises an exception, :func:`sys.excepthook` is called to " "handle it." msgstr "" +"この関数が例外を送出した場合は、その例外を処理するために :func:`sys." +"excepthook` が呼び出されます。" -#: ../../library/threading.rst:152 msgid "" ":func:`threading.excepthook` can be overridden to control how uncaught " "exceptions raised by :func:`Thread.run` are handled." msgstr "" +":func:`threading.excepthook` を置き換えることで、:func:`Thread.run` から送出" +"されて捕捉されなかった例外の処理方法を制御できます。" -#: ../../library/threading.rst:155 msgid "" "Storing *exc_value* using a custom hook can create a reference cycle. It " "should be cleared explicitly to break the reference cycle when the exception " "is no longer needed." msgstr "" +"独自のフックで *exc_value* を保存すると、循環参照ができることがあります。\n" +"例外が不要になったときに明示的に消去して、循環参照を断ち切ってください。" -#: ../../library/threading.rst:159 msgid "" "Storing *thread* using a custom hook can resurrect it if it is set to an " "object which is being finalized. Avoid storing *thread* after the custom " "hook completes to avoid resurrecting objects." msgstr "" +"独自のフックで *thread* を保存した際、その値がファイナライズ中のオブジェクト" +"である場合は、そのオブジェクトを復活させる可能性があります。\n" +"オブジェクトの復活を避けるため、独自のフックの完了後まで *thread* を保存しな" +"いでください。" -#: ../../library/threading.rst:164 msgid ":func:`sys.excepthook` handles uncaught exceptions." -msgstr "" +msgstr ":func:`sys.excepthook` は捕捉されなかった例外を処理します。" -#: ../../library/threading.rst:170 msgid "" "Holds the original value of :func:`threading.excepthook`. It is saved so " "that the original value can be restored in case they happen to get replaced " "with broken or alternative objects." msgstr "" +":func:`threading.excepthook` の元の値を保持します。\n" +"壊れたオブジェクトや別のオブジェクトに置き換えられた場合に元の値を復元できる" +"よう、保存されています。" #: ../../library/threading.rst:178 msgid "" @@ -297,17 +354,19 @@ msgstr "" "な、マジッククッキーとして意図されています。スレッドが終了し、他のスレッドが" "作られたとき、スレッド ID は再利用されるかもしれません。" -#: ../../library/threading.rst:189 msgid "" "Return the native integral Thread ID of the current thread assigned by the " "kernel. This is a non-negative integer. Its value may be used to uniquely " "identify this particular thread system-wide (until the thread terminates, " "after which the value may be recycled by the OS)." msgstr "" +"カーネルが割り当てた、現在のスレッドのネイティブなスレッド ID を返します。\n" +"これは非負の整数です。\n" +"この値で、システム全体においてこのスレッドを一意に識別できます (スレッドが終" +"了するまでで、その後は OS が値を再利用することがあります)。" -#: ../../library/threading.rst:198 msgid "Added support for GNU/kFreeBSD." -msgstr "" +msgstr "GNU/kFreeBSD のサポートが追加されました。" #: ../../library/threading.rst:204 msgid "" @@ -331,18 +390,22 @@ msgstr "" "main :class:`Thread` オブジェクトを返します。通常の条件では、メインスレッドは" "Pythonインタプリタが起動したスレッドを指します。" -#: ../../library/threading.rst:224 msgid "" "Set a trace function for all threads started from the :mod:`!threading` " "module. The *func* will be passed to :func:`sys.settrace` for each thread, " "before its :meth:`~Thread.run` method is called." msgstr "" +":mod:`!threading` モジュールから開始するすべてのスレッドにトレース関数を設定" +"します。\n" +"各スレッドの :meth:`~Thread.run` メソッドが呼ばれる前に、*func* が :func:" +"`sys.settrace` に渡されます。" -#: ../../library/threading.rst:230 msgid "" "Set a trace function for all threads started from the :mod:`!threading` " "module and all Python threads that are currently executing." msgstr "" +":mod:`!threading` モジュールから開始するすべてのスレッドと、現在実行中のすべ" +"ての Python スレッドにトレース関数を設定します。" #: ../../library/threading.rst:233 msgid "" @@ -354,18 +417,22 @@ msgstr "" msgid "Get the trace function as set by :func:`settrace`." msgstr ":func:`settrace` 関数で設定したトレース関数を取得します。" -#: ../../library/threading.rst:253 msgid "" "Set a profile function for all threads started from the :mod:`!threading` " "module. The *func* will be passed to :func:`sys.setprofile` for each " "thread, before its :meth:`~Thread.run` method is called." msgstr "" +":mod:`!threading` モジュールから開始するすべてのスレッドにプロファイル関数を" +"設定します。\n" +"各スレッドの :meth:`~Thread.run` メソッドが呼ばれる前に、*func* が :func:" +"`sys.setprofile` に渡されます。" -#: ../../library/threading.rst:259 msgid "" "Set a profile function for all threads started from the :mod:`!threading` " "module and all Python threads that are currently executing." msgstr "" +":mod:`!threading` モジュールから開始するすべてのスレッドと、現在実行中のすべ" +"ての Python スレッドにプロファイル関数を設定します。" #: ../../library/threading.rst:262 msgid "" @@ -410,24 +477,22 @@ msgstr "" "トフォームに関する情報がない場合は 4096 の整数倍のスタックサイズを選ぶといい" "かもしれません)。" -#: ../../library/threading.rst:295 msgid "Unix platforms with POSIX threads support." -msgstr "" +msgstr "POSIX スレッドをサポートする Unix プラットフォーム。" #: ../../library/threading.rst:298 msgid "This module also defines the following constant:" msgstr "このモジュールでは以下の定数も定義しています:" -#: ../../library/threading.rst:302 msgid "" "The maximum value allowed for the *timeout* parameter of blocking functions " "(:meth:`Lock.acquire`, :meth:`RLock.acquire`, :meth:`Condition.wait`, etc.). " "Specifying a timeout greater than this value will raise an :exc:" "`OverflowError`." msgstr "" -"ブロックする関数 (:meth:`Lock.acquire`, :meth:`RLock.acquire`, :meth:" -"`Condition.wait` など) の *timeout* 引数に許される最大値。これ以上の値を " -"timeout に指定すると :exc:`OverflowError` が発生します。" +"ブロックする関数 (:meth:`Lock.acquire`、:meth:`RLock.acquire`、:meth:" +"`Condition.wait` など) の *timeout* 引数に指定できる最大値です。\n" +"この値を超えるタイムアウトを指定すると :exc:`OverflowError` が送出されます。" #: ../../library/threading.rst:310 msgid "" @@ -460,30 +525,32 @@ msgstr "" msgid "All of the methods described below are executed atomically." msgstr "以下に説明するメソッドは全て原子的 (atomic) に実行されます。" -#: ../../library/threading.rst:325 msgid "Thread-local data" -msgstr "" +msgstr "スレッドローカルデータ" -#: ../../library/threading.rst:327 msgid "" "Thread-local data is data whose values are thread specific. If you have data " "that you want to be local to a thread, create a :class:`local` object and " "use its attributes::" msgstr "" +"スレッドローカルデータは、スレッドごとに固有の値を持つデータです。\n" +"スレッド内だけで使いたいデータがある場合は、:class:`local` オブジェクトを作成" +"し、その属性を使ってください。 ::" -#: ../../library/threading.rst:331 msgid "" ">>> mydata = local()\n" ">>> mydata.number = 42\n" ">>> mydata.number\n" "42" msgstr "" +">>> mydata = local()\n" +">>> mydata.number = 42\n" +">>> mydata.number\n" +"42" -#: ../../library/threading.rst:336 msgid "You can also access the :class:`local`-object's dictionary::" -msgstr "" +msgstr ":class:`local` オブジェクトの辞書にもアクセスできます。 ::" -#: ../../library/threading.rst:338 msgid "" ">>> mydata.__dict__\n" "{'number': 42}\n" @@ -492,12 +559,16 @@ msgid "" ">>> mydata.widgets\n" "[]" msgstr "" +">>> mydata.__dict__\n" +"{'number': 42}\n" +">>> mydata.__dict__.setdefault('widgets', [])\n" +"[]\n" +">>> mydata.widgets\n" +"[]" -#: ../../library/threading.rst:345 msgid "If we access the data in a different thread::" -msgstr "" +msgstr "別のスレッドからデータにアクセスすると、次のようになります。 ::" -#: ../../library/threading.rst:347 msgid "" ">>> log = []\n" ">>> def f():\n" @@ -513,20 +584,35 @@ msgid "" ">>> log\n" "[[], 11]" msgstr "" +">>> log = []\n" +">>> def f():\n" +"... items = sorted(mydata.__dict__.items())\n" +"... log.append(items)\n" +"... mydata.number = 11\n" +"... log.append(mydata.number)\n" +"\n" +">>> import threading\n" +">>> thread = threading.Thread(target=f)\n" +">>> thread.start()\n" +">>> thread.join()\n" +">>> log\n" +"[[], 11]" -#: ../../library/threading.rst:361 msgid "" "we get different data. Furthermore, changes made in the other thread don't " "affect data seen in this thread::" msgstr "" +"異なるデータが得られます。\n" +"また、別のスレッドで変更しても、このスレッドから見えるデータには影響しませ" +"ん。 ::" -#: ../../library/threading.rst:364 msgid "" ">>> mydata.number\n" "42" msgstr "" +">>> mydata.number\n" +"42" -#: ../../library/threading.rst:367 msgid "" "Of course, values you get from a :class:`local` object, including their :" "attr:`~object.__dict__` attribute, are for whatever thread was current at " @@ -534,14 +620,18 @@ msgid "" "to save these values across threads, as they apply only to the thread they " "came from." msgstr "" +":attr:`~object.__dict__` 属性を含め、:class:`local` オブジェクトから取得した" +"値は、その属性を読み出したときのスレッドのものです。\n" +"値は取得元のスレッドだけに属するため、一般にはスレッドをまたいで保存しない方" +"がよいでしょう。" -#: ../../library/threading.rst:373 msgid "" "You can create custom :class:`local` objects by subclassing the :class:" "`local` class::" msgstr "" +":class:`local` クラスを継承して、独自の :class:`local` オブジェクトを作成でき" +"ます。 ::" -#: ../../library/threading.rst:376 msgid "" ">>> class MyLocal(local):\n" "... number = 2\n" @@ -550,59 +640,65 @@ msgid "" "... def squared(self):\n" "... return self.number ** 2" msgstr "" +">>> class MyLocal(local):\n" +"... number = 2\n" +"... def __init__(self, /, **kw):\n" +"... self.__dict__.update(kw)\n" +"... def squared(self):\n" +"... return self.number ** 2" -#: ../../library/threading.rst:383 msgid "" "This can be useful to support default values, methods and initialization. " "Note that if you define an :py:meth:`~object.__init__` method, it will be " "called each time the :class:`local` object is used in a separate thread. " "This is necessary to initialize each thread's dictionary." msgstr "" +"これはデフォルト値、メソッド、初期化をサポートするのに便利です。\n" +":py:meth:`~object.__init__` メソッドを定義すると、各スレッドで :class:" +"`local` オブジェクトを初めて使うときに呼び出されることに注意してください。\n" +"各スレッドの辞書を初期化するために必要な動作です。" -#: ../../library/threading.rst:389 msgid "Now if we create a :class:`local` object::" -msgstr "" +msgstr "この :class:`local` オブジェクトを作成すると、次のようになります。 ::" -#: ../../library/threading.rst:391 msgid ">>> mydata = MyLocal(color='red')" -msgstr "" +msgstr ">>> mydata = MyLocal(color='red')" -#: ../../library/threading.rst:393 msgid "we have a default number::" -msgstr "" +msgstr "``number`` にはデフォルト値があります。 ::" -#: ../../library/threading.rst:395 msgid "" ">>> mydata.number\n" "2" msgstr "" +">>> mydata.number\n" +"2" -#: ../../library/threading.rst:398 msgid "an initial color::" -msgstr "" +msgstr "``color`` には初期値があります。 ::" -#: ../../library/threading.rst:400 msgid "" ">>> mydata.color\n" "'red'\n" ">>> del mydata.color" msgstr "" +">>> mydata.color\n" +"'red'\n" +">>> del mydata.color" -#: ../../library/threading.rst:404 msgid "And a method that operates on the data::" -msgstr "" +msgstr "データを操作するメソッドもあります。 ::" -#: ../../library/threading.rst:406 msgid "" ">>> mydata.squared()\n" "4" msgstr "" +">>> mydata.squared()\n" +"4" -#: ../../library/threading.rst:409 msgid "As before, we can access the data in a separate thread::" -msgstr "" +msgstr "先ほどと同じように、別のスレッドからデータにアクセスできます。 ::" -#: ../../library/threading.rst:411 msgid "" ">>> log = []\n" ">>> thread = threading.Thread(target=f)\n" @@ -611,12 +707,16 @@ msgid "" ">>> log\n" "[[('color', 'red')], 11]" msgstr "" +">>> log = []\n" +">>> thread = threading.Thread(target=f)\n" +">>> thread.start()\n" +">>> thread.join()\n" +">>> log\n" +"[[('color', 'red')], 11]" -#: ../../library/threading.rst:418 msgid "without affecting this thread's data::" -msgstr "" +msgstr "このスレッドのデータには影響しません。 ::" -#: ../../library/threading.rst:420 msgid "" ">>> mydata.number\n" "2\n" @@ -625,14 +725,21 @@ msgid "" "...\n" "AttributeError: 'MyLocal' object has no attribute 'color'" msgstr "" +">>> mydata.number\n" +"2\n" +">>> mydata.color\n" +"Traceback (most recent call last):\n" +"...\n" +"AttributeError: 'MyLocal' object has no attribute 'color'" -#: ../../library/threading.rst:427 msgid "" "Note that subclasses can define :term:`__slots__`, but they are not thread " "local. They are shared across threads::" msgstr "" +"サブクラスでは :term:`__slots__` を定義できますが、スロットはスレッドローカル" +"ではありません。\n" +"スレッド間で共有されます。 ::" -#: ../../library/threading.rst:430 msgid "" ">>> class MyLocal(local):\n" "... __slots__ = 'number'\n" @@ -641,37 +748,42 @@ msgid "" ">>> mydata.number = 42\n" ">>> mydata.color = 'red'" msgstr "" +">>> class MyLocal(local):\n" +"... __slots__ = 'number'\n" +"\n" +">>> mydata = MyLocal()\n" +">>> mydata.number = 42\n" +">>> mydata.color = 'red'" -#: ../../library/threading.rst:437 msgid "So, the separate thread::" -msgstr "" +msgstr "そのため、別のスレッドを実行すると、次のようになります。 ::" -#: ../../library/threading.rst:439 msgid "" ">>> thread = threading.Thread(target=f)\n" ">>> thread.start()\n" ">>> thread.join()" msgstr "" +">>> thread = threading.Thread(target=f)\n" +">>> thread.start()\n" +">>> thread.join()" -#: ../../library/threading.rst:443 msgid "affects what we see::" -msgstr "" +msgstr "このスレッドから見える値にも影響します。 ::" -#: ../../library/threading.rst:445 msgid "" ">>> mydata.number\n" "11" msgstr "" +">>> mydata.number\n" +"11" #: ../../library/threading.rst:451 msgid "A class that represents thread-local data." msgstr "スレッドローカルデータを表現するクラス。" -#: ../../library/threading.rst:457 msgid "Thread objects" -msgstr "" +msgstr "Thread オブジェクト" -#: ../../library/threading.rst:459 msgid "" "The :class:`Thread` class represents an activity that is run in a separate " "thread of control. There are two ways to specify the activity: by passing a " @@ -680,16 +792,24 @@ msgid "" "be overridden in a subclass. In other words, *only* override the " "``__init__()`` and :meth:`~Thread.run` methods of this class." msgstr "" +":class:`Thread` クラスは、別の実行スレッドで行う処理を表します。\n" +"処理を指定する方法は 2 つあります。\n" +"呼び出し可能オブジェクトをコンストラクタに渡すか、サブクラスで :meth:" +"`~Thread.run` メソッドをオーバーライドします。\n" +"サブクラスでは、コンストラクタを除く他のメソッドをオーバーライドしてはいけま" +"せん。\n" +"つまり、このクラスの ``__init__()`` と :meth:`~Thread.run` メソッド *だけ* を" +"オーバーライドしてください。" -#: ../../library/threading.rst:466 msgid "" "Once a thread object is created, its activity must be started by calling the " "thread's :meth:`~Thread.start` method. This invokes the :meth:`~Thread.run` " "method in a separate thread of control." msgstr "" "ひとたびスレッドオブジェクトを生成すると、スレッドの :meth:`~Thread.start` メ" -"ソッドを呼び出して活動を開始しなければなりません。 :meth:`start` メソッド は" -"それぞれのスレッドの :meth:`~Thread.run` メソッドを起動します。" +"ソッドを呼び出して活動を開始しなければなりません。\n" +"これにより、別のスレッドでそのオブジェクトの :meth:`~Thread.run` メソッドが呼" +"び出されます。" #: ../../library/threading.rst:470 msgid "" @@ -780,10 +900,10 @@ msgstr "" "\"ダミースレッドオブジェクト (dummy thread objects)\" が作成される場合があり" "ます。ダミースレッドは、 \"外来スレッド (alien thread)\" に相当するスレッドオ" "ブジェクトです。ダミースレッドは、C コードから直接生成されたスレッドのよう" -"な、 :mod:`threading` モジュールの外で開始された処理スレッドです。ダミース" -"レッドオブジェクトには限られた機能しかなく、常に生存中、かつデーモンスレッド" -"であるとみなされ、 :ref:`join ` できません。また、外来ス" -"レッドの終了を検出するのは不可能なので、ダミースレッドは削除できません。" +"な、 ``threading`` モジュールの外で開始された処理スレッドです。ダミースレッド" +"オブジェクトには限られた機能しかなく、常に生存中、かつデーモンスレッドである" +"とみなされ、 :ref:`join ` できません。また、外来スレッドの" +"終了を検出するのは不可能なので、ダミースレッドは削除できません。" #: ../../library/threading.rst:512 msgid "" @@ -807,7 +927,6 @@ msgstr "" "*target* は :meth:`run` メソッドによって起動される呼び出し可能オブジェクトで" "す。デフォルトでは何も呼び出さないことを示す ``None`` になっています。" -#: ../../library/threading.rst:521 msgid "" "*name* is the thread name. By default, a unique name is constructed of the " "form \"Thread-*N*\" where *N* is a small decimal number, or \"Thread-*N* " @@ -815,8 +934,8 @@ msgid "" "is specified." msgstr "" "*name*はスレッド名です。デフォルトでは、\"Thread-*N*\"(*N*は小さな10進数)、ま" -"たは*target*引数が指定された場合\"Thread-*N* (target)\"(\"target\"は``target." -"__name__``)という形式でユニークな名前が構成される。" +"たは*target*引数が指定された場合\"Thread-*N* (target)\"(\"target\"は " +"``target.__name__``)という形式でユニークな名前が構成される。" #: ../../library/threading.rst:526 msgid "" @@ -844,7 +963,6 @@ msgstr "" "す。``None`` の場合 (デフォルト)、デーモン属性は現在のスレッドから継承されま" "す。" -#: ../../library/threading.rst:535 msgid "" "*context* is the :class:`~contextvars.Context` value to use when starting " "the thread. The default value is ``None`` which indicates that the :data:" @@ -856,20 +974,29 @@ msgid "" "context, pass the value from :func:`~contextvars.copy_context`. The flag " "defaults true on free-threaded builds and false otherwise." msgstr "" +"*context* はスレッドの開始時に使う :class:`~contextvars.Context` の値です。\n" +"デフォルト値は ``None`` で、:data:`sys.flags.thread_inherit_context` フラグが" +"動作を制御します。\n" +"フラグが真の場合、スレッドは :meth:`~Thread.start` の呼び出し元のコンテキスト" +"のコピーで開始します。\n" +"偽の場合は空のコンテキストで開始します。\n" +"空のコンテキストで開始することを明示するには、新しい :class:`~contextvars." +"Context()` インスタンスを渡してください。\n" +"現在のコンテキストのコピーで開始することを明示するには、:func:`~contextvars." +"copy_context` の戻り値を渡してください。\n" +"このフラグのデフォルトは、フリースレッドビルドでは真、それ以外では偽です。" -#: ../../library/threading.rst:545 msgid "" "If the subclass overrides the constructor, it must make sure to invoke the " "base class constructor (``Thread.__init__()``) before doing anything else to " "the thread." msgstr "" -"サブクラスでコンストラクタをオーバライドした場合、必ずスレッドが何かを始める" -"前に基底クラスのコンストラクタ (``Thread.__init__()``) を呼び出しておかなくて" -"はなりません。" +"サブクラスでコンストラクタをオーバーライドする場合は、そのスレッドオブジェク" +"トに対して他の処理を行う前に、必ず基底クラスのコンストラクタ (``Thread." +"__init__()``) を呼び出してください。" -#: ../../library/threading.rst:549 msgid "Added the *daemon* parameter." -msgstr "" +msgstr "*daemon* 引数が追加されました。" #: ../../library/threading.rst:552 msgid "Use the *target* name if *name* argument is omitted." @@ -889,9 +1016,9 @@ msgid "" "object's :meth:`~Thread.run` method to be invoked in a separate thread of " "control." msgstr "" -"このメソッドは、スレッドオブジェクトあたり一度しか呼び出してはなりません。 :" -"meth:`~Thread.start` は、オブジェクトの :meth:`~Thread.run` メソッドが個別の" -"処理スレッド中で呼び出されるように調整します。" +"このメソッドは、スレッドオブジェクトあたり一度しか呼び出してはなりません。 " +"``start()`` は、オブジェクトの :meth:`~Thread.run` メソッドが個別の処理スレッ" +"ド中で呼び出されるように調整します。" #: ../../library/threading.rst:566 msgid "" @@ -901,16 +1028,18 @@ msgstr "" "同じスレッドオブジェクトに対し、このメソッドを2回以上呼び出した場合、 :exc:" "`RuntimeError` を送出します。" -#: ../../library/threading.rst:569 msgid "" "If supported, set the operating system thread name to :attr:`threading." "Thread.name`. The name can be truncated depending on the operating system " "thread name limits." msgstr "" +"サポートされている場合、オペレーティングシステム上のスレッド名を :attr:" +"`threading.Thread.name` に設定します。\n" +"名前は、オペレーティングシステムのスレッド名の長さ制限に応じて切り詰められる" +"ことがあります。" -#: ../../library/threading.rst:573 msgid "Set the operating system thread name." -msgstr "" +msgstr "オペレーティングシステム上のスレッド名を設定するようになりました。" #: ../../library/threading.rst:578 msgid "Method representing the thread's activity." @@ -940,7 +1069,6 @@ msgstr "" msgid "Example::" msgstr "以下はプログラム例です::" -#: ../../library/threading.rst:590 msgid "" ">>> from threading import Thread\n" ">>> t = Thread(target=print, args=[1])\n" @@ -950,6 +1078,13 @@ msgid "" ">>> t.run()\n" "1" msgstr "" +">>> from threading import Thread\n" +">>> t = Thread(target=print, args=[1])\n" +">>> t.run()\n" +"1\n" +">>> t = Thread(target=print, args=(1,))\n" +">>> t.run()\n" +"1" #: ../../library/threading.rst:602 msgid "" @@ -1004,9 +1139,8 @@ msgid "" "a :exc:`PythonFinalizationError`." msgstr "" -#: ../../library/threading.rst:630 msgid "May raise :exc:`PythonFinalizationError`." -msgstr "" +msgstr ":exc:`PythonFinalizationError` を送出する場合があります。" #: ../../library/threading.rst:634 msgid "" @@ -1018,20 +1152,26 @@ msgstr "" "ありません。複数のスレッドに同じ名前をつけてもかまいません。名前の初期値はコ" "ンストラクタで設定されます。" -#: ../../library/threading.rst:638 msgid "" "On some platforms, the thread name is set at the operating system level when " "the thread starts, so that it is visible in task managers. This name may be " "truncated to fit in a system-specific limit (for example, 15 bytes on Linux " "or 63 bytes on macOS)." msgstr "" +"一部のプラットフォームでは、スレッドの開始時にオペレーティングシステム上のス" +"レッド名も設定され、タスクマネージャに表示されます。\n" +"この名前は、システム固有の制限 (例えば Linux では 15 バイト、macOS では 63 バ" +"イト) に収まるように切り詰められることがあります。" -#: ../../library/threading.rst:643 msgid "" "Changes to *name* are only reflected at the OS level when the currently " "running thread is renamed. (Setting the *name* attribute of a different " "thread only updates the Python Thread object.)" msgstr "" +"*name* の変更が OS に反映されるのは、現在実行しているスレッド自身の名前を変更" +"した場合だけです。\n" +"別のスレッドの *name* 属性を設定しても、Python の Thread オブジェクトだけが更" +"新されます。" #: ../../library/threading.rst:650 msgid "" @@ -1054,7 +1194,6 @@ msgstr "" "が終了した後、新たなスレッドが生成された場合、再利用され得ます。スレッド識別" "子は、スレッドが終了した後でも利用できます。" -#: ../../library/threading.rst:665 msgid "" "The Thread ID (``TID``) of this thread, as assigned by the OS (kernel). This " "is a non-negative integer, or ``None`` if the thread has not been started. " @@ -1062,13 +1201,19 @@ msgid "" "identify this particular thread system-wide (until the thread terminates, " "after which the value may be recycled by the OS)." msgstr "" +"OS (カーネル) が割り当てた、このスレッドのスレッド ID (``TID``) です。\n" +"非負の整数で、スレッドがまだ開始されていない場合は ``None`` です。\n" +":func:`get_native_id` を参照してください。\n" +"この値で、システム全体においてこのスレッドを一意に識別できます (スレッドが終" +"了するまでで、その後は OS が値を再利用することがあります)。" -#: ../../library/threading.rst:674 msgid "" "Similar to Process IDs, Thread IDs are only valid (guaranteed unique system-" "wide) from the time the thread is created until the thread has been " "terminated." msgstr "" +"プロセス ID と同様に、スレッド ID が有効である (システム全体で一意であると保" +"証される) のは、スレッドが作成されてから終了するまでの間だけです。" #: ../../library/threading.rst:684 msgid "Return whether the thread is alive." @@ -1115,9 +1260,8 @@ msgstr "" ":attr:`~Thread.daemon` に対する非推奨 getter/setter API; 代わりにプロパティを" "直接使用してください。" -#: ../../library/threading.rst:713 msgid "Lock objects" -msgstr "" +msgstr "Lock オブジェクト" #: ../../library/threading.rst:715 msgid "" @@ -1188,11 +1332,13 @@ msgstr "" "レッドが一度ロックを獲得すると、それ以後のロック獲得の試みはロックが解放され" "るまでブロックします。どのスレッドでもロックを解放できます。" -#: ../../library/threading.rst:747 msgid "" "``Lock`` is now a class. In earlier Pythons, ``Lock`` was a factory function " "which returned an instance of the underlying private lock type." msgstr "" +"``Lock`` はクラスになりました。\n" +"以前の Python では、``Lock`` は内部の非公開ロック型のインスタンスを返すファク" +"トリ関数でした。" #: ../../library/threading.rst:755 ../../library/threading.rst:849 msgid "Acquire a lock, blocking or non-blocking." @@ -1244,15 +1390,15 @@ msgstr "" msgid "The *timeout* parameter is new." msgstr "新しい *timeout* 引数。" -#: ../../library/threading.rst:776 msgid "" "Lock acquisition can now be interrupted by signals on POSIX if the " "underlying threading implementation supports it." msgstr "" +"POSIX で、内部のスレッド実装がサポートしていれば、ロックの獲得をシグナルで中" +"断できるようになりました。" -#: ../../library/threading.rst:780 msgid "Lock acquisition can now be interrupted by signals on Windows." -msgstr "" +msgstr "Windows でロックの獲得をシグナルで中断できるようになりました。" #: ../../library/threading.rst:786 msgid "" @@ -1286,9 +1432,8 @@ msgstr "戻り値はありません。" msgid "Return ``True`` if the lock is acquired." msgstr "ロック状態のとき ``True`` を返します。" -#: ../../library/threading.rst:806 msgid "RLock objects" -msgstr "" +msgstr "RLock オブジェクト" #: ../../library/threading.rst:808 msgid "" @@ -1311,13 +1456,17 @@ msgid "" "meth:`~Lock.release` method to unlock it." msgstr "" -#: ../../library/threading.rst:819 msgid "" "Reentrant locks support the :ref:`context management protocol `, " "so it is recommended to use :keyword:`with` instead of manually calling :" "meth:`~RLock.acquire` and :meth:`~RLock.release` to handle acquiring and " "releasing the lock for a block of code." msgstr "" +"再入可能ロックは :ref:`コンテキスト管理プロトコル ` をサポートし" +"ています。\n" +"そのため、コードブロックでのロックの獲得と解放には、:meth:`~RLock.acquire` " +"と :meth:`~RLock.release` を手動で呼び出すよりも :keyword:`with` を使うことを" +"推奨します。" #: ../../library/threading.rst:824 msgid "" @@ -1328,13 +1477,17 @@ msgid "" "in :meth:`~RLock.acquire` to proceed." msgstr "" -#: ../../library/threading.rst:830 msgid "" ":meth:`~RLock.acquire`/:meth:`~RLock.release` must be used in pairs: each " "acquire must have a release in the thread that has acquired the lock. " "Failing to call release as many times the lock has been acquired can lead to " "deadlock." msgstr "" +":meth:`~RLock.acquire` と :meth:`~RLock.release` は対にして使わなければなりま" +"せん。\n" +"ロックを獲得するたびに、獲得したスレッドで解放する必要があります。\n" +"獲得した回数と同じ回数だけ解放しないと、デッドロックにつながる可能性がありま" +"す。" #: ../../library/threading.rst:837 msgid "" @@ -1358,24 +1511,23 @@ msgstr "" "率的なバージョンの具体的な RLock クラスのインスタンスを返すことに注意してくだ" "さい。" -#: ../../library/threading.rst:853 msgid ":ref:`Using RLock as a context manager `" -msgstr "" +msgstr ":ref:`RLock をコンテキストマネージャとして使う `" -#: ../../library/threading.rst:854 msgid "" "Recommended over manual :meth:`!acquire` and :meth:`release` calls whenever " "practical." msgstr "" +"実用上可能なら、:meth:`!acquire` と :meth:`release` を手動で呼び出すよりも推" +"奨されます。" -#: ../../library/threading.rst:858 msgid "" "When invoked with the *blocking* argument set to ``True`` (the default):" -msgstr "" +msgstr "*blocking* 引数を ``True`` (デフォルト) にして呼び出した場合:" -#: ../../library/threading.rst:860 ../../library/threading.rst:872 msgid "If no thread owns the lock, acquire the lock and return immediately." msgstr "" +"どのスレッドもロックを所有していなければ、ロックを獲得して直ちに戻ります。" #: ../../library/threading.rst:862 msgid "" @@ -1383,41 +1535,49 @@ msgid "" "*timeout*, if set to a positive float value." msgstr "" -#: ../../library/threading.rst:865 msgid "" "If the same thread owns the lock, acquire the lock again, and return " "immediately. This is the difference between :class:`Lock` and :class:`!" "RLock`; :class:`Lock` handles this case the same as the previous, blocking " "until the lock can be acquired." msgstr "" +"同じスレッドがロックを所有している場合は、再びロックを獲得して直ちに戻りま" +"す。\n" +"この点が :class:`Lock` と :class:`!RLock` の違いです。\n" +":class:`Lock` はこの場合も前項と同様に扱い、ロックを獲得できるまでブロックし" +"ます。" -#: ../../library/threading.rst:870 msgid "When invoked with the *blocking* argument set to ``False``:" -msgstr "" +msgstr "*blocking* 引数を ``False`` にして呼び出した場合:" -#: ../../library/threading.rst:874 msgid "If another thread owns the lock, return immediately." -msgstr "" +msgstr "別のスレッドがロックを所有している場合は、直ちに戻ります。" -#: ../../library/threading.rst:876 msgid "" "If the same thread owns the lock, acquire the lock again and return " "immediately." msgstr "" +"同じスレッドがロックを所有している場合は、再びロックを獲得して直ちに戻りま" +"す。" -#: ../../library/threading.rst:879 msgid "" "In all cases, if the thread was able to acquire the lock, return ``True``. " "If the thread was unable to acquire the lock (i.e. if not blocking or the " "timeout was reached) return ``False``." msgstr "" +"いずれの場合も、スレッドがロックを獲得できれば ``True`` を返します。\n" +"獲得できなければ (ブロックしない場合やタイムアウトに達した場合など)、" +"``False`` を返します。" -#: ../../library/threading.rst:883 msgid "" "If called multiple times, failing to call :meth:`~RLock.release` as many " "times may lead to deadlock. Consider using :class:`!RLock` as a context " "manager rather than calling acquire/release directly." msgstr "" +"複数回呼び出した場合、同じ回数だけ :meth:`~RLock.release` を呼び出さないと、" +"デッドロックにつながる可能性があります。\n" +"acquire/release を直接呼び出す代わりに、:class:`!RLock` をコンテキストマネー" +"ジャとして使うことを検討してください。" #: ../../library/threading.rst:893 msgid "" @@ -1434,20 +1594,21 @@ msgstr "" "す。デクリメント後も再帰レベルがゼロでない場合、ロックの状態はロックのまま" "で、呼び出し側のスレッドに所有されたままになります。" -#: ../../library/threading.rst:899 msgid "" "Only call this method when the calling thread owns the lock. A :exc:" "`RuntimeError` is raised if this method is called when the lock is not " "acquired." msgstr "" +"このメソッドは、呼び出し元のスレッドがロックを所有している場合にだけ呼び出し" +"てください。\n" +"ロックを獲得していないときに呼び出すと、:exc:`RuntimeError` を送出します。" -#: ../../library/threading.rst:908 ../../library/threading.rst:1007 msgid "Return a boolean indicating whether this object is locked right now." msgstr "" +"このオブジェクトが現在ロックされているかどうかを示すブール値を返します。" -#: ../../library/threading.rst:916 msgid "Condition objects" -msgstr "" +msgstr "Condition オブジェクト" #: ../../library/threading.rst:918 msgid "" @@ -1535,7 +1696,6 @@ msgstr "" "す。例えば、以下のコードは無制限のバッファ容量のときの一般的な生産者-消費者問" "題です::" -#: ../../library/threading.rst:954 msgid "" "# Consume one item\n" "with cv:\n" @@ -1548,6 +1708,16 @@ msgid "" " make_an_item_available()\n" " cv.notify()" msgstr "" +"# 要素を 1 つ消費する\n" +"with cv:\n" +" while not an_item_is_available():\n" +" cv.wait()\n" +" get_an_available_item()\n" +"\n" +"# 要素を 1 つ生成する\n" +"with cv:\n" +" make_an_item_available()\n" +" cv.notify()" #: ../../library/threading.rst:965 msgid "" @@ -1565,13 +1735,16 @@ msgstr "" "`~Condition.wait_for` メソッドを使うことができ、それはタイムアウトの計算を簡" "略化します::" -#: ../../library/threading.rst:972 msgid "" "# Consume an item\n" "with cv:\n" " cv.wait_for(an_item_is_available)\n" " get_an_available_item()" msgstr "" +"# 要素を 1 つ消費する\n" +"with cv:\n" +" cv.wait_for(an_item_is_available)\n" +" get_an_available_item()" #: ../../library/threading.rst:977 msgid "" @@ -1637,17 +1810,16 @@ msgstr "" "ドがロックを獲得していないときにこのメソッドを呼び出すと :exc:`RuntimeError` " "が送出されます。" -#: ../../library/threading.rst:1017 msgid "" "This method releases the underlying lock, and then blocks until it is " "awakened by a :meth:`notify` or :meth:`notify_all` call for the same " "condition variable in another thread, or until the optional timeout occurs. " "Once awakened or timed out, it re-acquires the lock and returns." msgstr "" -"このメソッドは根底にあるロックを解放し、他のスレッドが同じ条件変数に対して :" -"meth:`notify` または :meth:`notify_all` を呼び出して現在のスレッドを起こす" -"か、オプションのタイムアウトが発生するまでブロックします。一度スレッドが起こ" -"されると、再度ロックを獲得して処理を戻します。" +"このメソッドは内部のロックを解放し、他のスレッドが同じ条件変数の :meth:" +"`notify` または :meth:`notify_all` を呼び出して起こすか、指定されたタイムアウ" +"トが発生するまでブロックします。\n" +"起こされた場合もタイムアウトした場合も、ロックを再び獲得してから戻ります。" #: ../../library/threading.rst:1022 msgid "" @@ -1667,7 +1839,7 @@ msgid "" msgstr "" "根底にあるロックが :class:`RLock` である場合、 :meth:`release` メソッドでは" "ロックは解放されません。というのも、ロックが再帰的に複数回獲得されている場合" -"には、 :meth:`release` によって実際にアンロックが行われないかもしれないからで" +"には、 ``release()`` によって実際にアンロックが行われないかもしれないからで" "す。その代わり、ロックが再帰的に複数回獲得されていても確実にアンロックを行え" "る :class:`RLock` クラスの内部インターフェースを使います。その後ロックを再獲" "得する時に、もう一つの内部インターフェースを使ってロックの再帰レベルを復帰し" @@ -1715,11 +1887,12 @@ msgstr "" "タイムアウト機能を無視すれば、このメソッドの呼び出しは以下のように書くのとほ" "ぼ等価です::" -#: ../../library/threading.rst:1054 msgid "" "while not predicate():\n" " cv.wait()" msgstr "" +"while not predicate():\n" +" cv.wait()" #: ../../library/threading.rst:1057 msgid "" @@ -1741,15 +1914,13 @@ msgstr "" "のスレッドがロックを獲得していないときにこのメソッドを呼び出すと :exc:" "`RuntimeError` が送出されます。" -#: ../../library/threading.rst:1069 msgid "" "This method wakes up at most *n* of the threads waiting for the condition " "variable; it is a no-op if no threads are waiting." msgstr "" -"何らかの待機中スレッドがある場合、そのうち *n* スレッドを起こします。待機中の" -"スレッドがなければ何もしません。" +"この条件変数を待っているスレッドを最大 *n* 個起こします。\n" +"待機中のスレッドがなければ何もしません。" -#: ../../library/threading.rst:1072 msgid "" "The current implementation wakes up exactly *n* threads, if at least *n* " "threads are waiting. However, it's not safe to rely on this behavior. A " @@ -1757,8 +1928,10 @@ msgid "" "threads." msgstr "" "現在の実装では、少なくとも *n* スレッドが待機中であれば、ちょうど *n* スレッ" -"ドを起こします。とはいえ、この挙動に依存するのは安全ではありません。将来、実" -"装の最適化によって、複数のスレッドを起こすようになるかもしれないからです。" +"ドを起こします。\n" +"とはいえ、この挙動に依存するのは安全ではありません。\n" +"将来、実装の最適化によって、*n* 個を超えるスレッドを起こすことがあるかもしれ" +"ないからです。" #: ../../library/threading.rst:1077 msgid "" @@ -1767,8 +1940,8 @@ msgid "" "lock, its caller should." msgstr "" "注意: 起こされたスレッドは実際にロックを再獲得できるまで :meth:`wait` 呼び出" -"しから戻りません。 :meth:`notify` はロックを解放しないので、 :meth:`notify` " -"呼び出し側は明示的にロックを解放しなければなりません。" +"しから戻りません。 :meth:`notify` はロックを解放しないので、 ``notify()`` 呼" +"び出し側は明示的にロックを解放しなければなりません。" #: ../../library/threading.rst:1083 msgid "" @@ -1782,13 +1955,11 @@ msgstr "" "す。呼び出し側のスレッドがロックを獲得していない場合、 :exc:`RuntimeError` が" "送出されます。" -#: ../../library/threading.rst:1088 msgid "The method ``notifyAll`` is a deprecated alias for this method." -msgstr "関数``notifyAll``はこの関数の非推奨エイリアスです。" +msgstr "メソッド ``notifyAll`` は、このメソッドの非推奨エイリアスです。" -#: ../../library/threading.rst:1094 msgid "Semaphore objects" -msgstr "" +msgstr "Semaphore オブジェクト" #: ../../library/threading.rst:1096 msgid "" @@ -1823,7 +1994,6 @@ msgstr "" "セマフォは :ref:`コンテキストマネージメントプロトコル ` もサポー" "トします。" -#: ../../library/threading.rst:1112 msgid "" "This class implements semaphore objects. A semaphore manages an atomic " "counter representing the number of :meth:`release` calls minus the number " @@ -1831,10 +2001,11 @@ msgid "" "blocks if necessary until it can return without making the counter negative. " "If not given, *value* defaults to 1." msgstr "" -"このクラスはセマフォ (semaphore) オブジェクトを実装します。セマフォは、 :" -"meth:`release` を呼び出した数から :meth:`acquire` を呼び出した数を引き、初期" -"値を足した値を表す極小のカウンタを管理します。 :meth:`acquire` メソッドは、カ" -"ウンタの値を負にせずに処理を戻せるまで必要ならば処理をブロックします。 " +"このクラスはセマフォ (semaphore) オブジェクトを実装します。\n" +"セマフォは、:meth:`release` を呼び出した回数から :meth:`acquire` を呼び出した" +"回数を引き、初期値を足した値を表すアトミックなカウンタを管理します。\n" +":meth:`acquire` メソッドは、カウンタの値を負にせずに処理を戻せるまで、必要に" +"応じてブロックします。\n" "*value* を指定しない場合、デフォルトの値は 1 になります。" #: ../../library/threading.rst:1118 @@ -1851,15 +2022,15 @@ msgstr "" msgid "Acquire a semaphore." msgstr "セマフォを獲得します。" -#: ../../library/threading.rst:1129 msgid "When invoked without arguments:" -msgstr "" +msgstr "引数なしで呼び出した場合:" -#: ../../library/threading.rst:1131 msgid "" "If the internal counter is larger than zero on entry, decrement it by one " "and return ``True`` immediately." msgstr "" +"呼び出し時に内部カウンタが 0 より大きければ、1 減らして直ちに ``True`` を返し" +"ます。" #: ../../library/threading.rst:1133 msgid "" @@ -1898,16 +2069,14 @@ msgid "" "zero on entry and other threads are waiting for it to become larger than " "zero again, wake up *n* of those threads." msgstr "" -"内部カウンタを *n* インクリメントして、セマフォを解放します。 :meth:" -"`release` 処理に入ったときにカウンタがゼロであり、カウンタの値がゼロより大き" -"くなるのを待っている別のスレッドがあった場合、それらのスレッドから *n* 個を起" -"こします。" +"内部カウンタを *n* インクリメントして、セマフォを解放します。 ``release()`` " +"処理に入ったときにカウンタがゼロであり、カウンタの値がゼロより大きくなるのを" +"待っている別のスレッドがあった場合、それらのスレッドから *n* 個を起こします。" #: ../../library/threading.rst:1156 msgid "Added the *n* parameter to release multiple waiting threads at once." msgstr "複数の待機中のスレッドを一度に解放する *n* パラメータを追加しました。" -#: ../../library/threading.rst:1162 msgid "" "Class implementing bounded semaphore objects. A bounded semaphore checks to " "make sure its current value doesn't exceed its initial value. If it does, :" @@ -1915,16 +2084,16 @@ msgid "" "resources with limited capacity. If the semaphore is released too many " "times it's a sign of a bug. If not given, *value* defaults to 1." msgstr "" -"有限セマフォ (bounded semaphore) オブジェクトを実装しているクラスです。有限セ" -"マフォは、現在の値が初期値を超過しないようチェックを行います。超過を起こした" -"場合、 :exc:`ValueError` を送出します。たいていの場合、セマフォは限られた容量" -"のリソースを保護するために使われるものです。従って、あまりにも頻繁なセマフォ" -"の解放はバグが生じているしるしです。 *value* を指定しない場合、デフォルトの値" -"は 1 になります。" +"有限セマフォ (bounded semaphore) オブジェクトを実装しているクラスです。\n" +"有限セマフォは、現在の値が初期値を超過しないようチェックを行います。\n" +"超過を起こした場合、 :exc:`ValueError` を送出します。\n" +"たいていの場合、セマフォは限られた容量のリソースを保護するために使われるもの" +"です。\n" +"従って、セマフォを必要以上の回数解放することはバグが生じているしるしです。\n" +"*value* を指定しない場合、デフォルトの値は 1 になります。" -#: ../../library/threading.rst:1175 msgid ":class:`Semaphore` example" -msgstr "" +msgstr ":class:`Semaphore` の使用例" #: ../../library/threading.rst:1177 msgid "" @@ -1938,12 +2107,14 @@ msgstr "" "ばなりません。主スレッドは、作業スレッドを立ち上げる前にセマフォを初期化しま" "す::" -#: ../../library/threading.rst:1182 msgid "" "maxconnections = 5\n" "# ...\n" "pool_sema = BoundedSemaphore(value=maxconnections)" msgstr "" +"maxconnections = 5\n" +"# ...\n" +"pool_sema = BoundedSemaphore(value=maxconnections)" #: ../../library/threading.rst:1186 msgid "" @@ -1951,9 +2122,8 @@ msgid "" "methods when they need to connect to the server::" msgstr "" "作業スレッドは、ひとたび立ち上がると、サーバへ接続する必要が生じたときにセマ" -"フォの :meth:`acquire` および :meth:`release` メソッドを呼び出します::" +"フォの ``acquire()`` および ``release()`` メソッドを呼び出します::" -#: ../../library/threading.rst:1189 msgid "" "with pool_sema:\n" " conn = connectdb()\n" @@ -1962,6 +2132,12 @@ msgid "" " finally:\n" " conn.close()" msgstr "" +"with pool_sema:\n" +" conn = connectdb()\n" +" try:\n" +" # ... 接続を使う ...\n" +" finally:\n" +" conn.close()" #: ../../library/threading.rst:1196 msgid "" @@ -1972,9 +2148,8 @@ msgstr "" "有限セマフォを使うと、セマフォを獲得回数以上に解放してしまうというプログラム" "上の間違いを見逃しにくくします。" -#: ../../library/threading.rst:1203 msgid "Event objects" -msgstr "" +msgstr "Event オブジェクト" #: ../../library/threading.rst:1205 msgid "" @@ -1995,18 +2170,18 @@ msgstr "" "セットします。 :meth:`~Event.wait` メソッドはフラグが true になるまでブロック" "します。" -#: ../../library/threading.rst:1215 msgid "" "Class implementing event objects. An event manages a flag that can be set " "to true with the :meth:`~Event.set` method and reset to false with the :meth:" "`clear` method. The :meth:`wait` method blocks until the flag is true. The " "flag is initially false." msgstr "" -"イベントオブジェクトを実装しているクラスです。イベントは :meth:`~Event.set` " -"メソッドを使うと :const:`True` に、 :meth:`clear` メソッドを使うと :const:" -"`False` にセットされるようなフラグを管理します。 :meth:`wait` メソッドは、全" -"てのフラグが true になるまでブロックするようになっています。フラグの初期値は " -"false です。" +"イベントオブジェクトを実装しているクラスです。\n" +"イベントは :meth:`~Event.set` メソッドを使うと ``True`` に、 :meth:`clear` メ" +"ソッドを使うと ``False`` にセットされるようなフラグを管理します。\n" +":meth:`wait` メソッドは、そのフラグが true になるまでブロックするようになって" +"います。\n" +"フラグの初期値は false です。" #: ../../library/threading.rst:1225 msgid "Return ``True`` if and only if the internal flag is true." @@ -2036,7 +2211,6 @@ msgstr "" "び内部フラグの値を true にセットするまで、 :meth:`wait` を呼び出したスレッド" "はブロックするようになります。" -#: ../../library/threading.rst:1243 msgid "" "Block as long as the internal flag is false and the timeout, if given, has " "not expired. The return value represents the reason that this blocking " @@ -2044,6 +2218,11 @@ msgid "" "true, or ``False`` if a timeout is given and the internal flag did not " "become true within the given wait time." msgstr "" +"内部フラグが偽で、タイムアウトが指定されている場合はその時間が経過していない" +"間、ブロックします。\n" +"戻り値は、このブロックするメソッドが処理を戻した理由を示します。\n" +"内部フラグが真になって戻った場合は ``True``、タイムアウトが指定されており、そ" +"の待ち時間内に内部フラグが真にならなかった場合は ``False`` です。" #: ../../library/threading.rst:1249 msgid "" @@ -2052,9 +2231,8 @@ msgid "" "fractions thereof." msgstr "" -#: ../../library/threading.rst:1260 msgid "Timer objects" -msgstr "" +msgstr "Timer オブジェクト" #: ../../library/threading.rst:1262 msgid "" @@ -2067,7 +2245,6 @@ msgstr "" "す。 :class:`Timer` は :class:`Thread` のサブクラスであり、自作のスレッドを構" "築した一例でもあります。" -#: ../../library/threading.rst:1266 msgid "" "Timers are started, as with threads, by calling their :meth:`Timer.start " "` method. The timer can be stopped (before its action has " @@ -2075,12 +2252,17 @@ msgid "" "will wait before executing its action may not be exactly the same as the " "interval specified by the user." msgstr "" +"タイマは、スレッドと同様に :meth:`Timer.start ` メソッドを呼び" +"出して開始します。\n" +":meth:`~Timer.cancel` メソッドを呼び出すと、処理を開始する前であればタイマを" +"停止できます。\n" +"処理の実行前にタイマが待つ時間は、指定された時間と厳密には一致しない場合があ" +"ります。" #: ../../library/threading.rst:1272 msgid "For example::" msgstr "例えば::" -#: ../../library/threading.rst:1274 msgid "" "def hello():\n" " print(\"hello, world\")\n" @@ -2088,6 +2270,11 @@ msgid "" "t = Timer(30.0, hello)\n" "t.start() # after 30 seconds, \"hello, world\" will be printed" msgstr "" +"def hello():\n" +" print(\"hello, world\")\n" +"\n" +"t = Timer(30.0, hello)\n" +"t.start() # 30 秒後に \"hello, world\" が表示される" #: ../../library/threading.rst:1283 msgid "" @@ -2108,9 +2295,8 @@ msgstr "" "タイマをストップして、その動作の実行をキャンセルします。このメソッドはタイマ" "がまだ活動待ち状態にある場合にのみ動作します。" -#: ../../library/threading.rst:1298 msgid "Barrier objects" -msgstr "" +msgstr "Barrier オブジェクト" #: ../../library/threading.rst:1302 msgid "" @@ -2139,7 +2325,6 @@ msgstr "" "例として、クライアントとサーバの間でスレッドを同期させる単純な方法を紹介しま" "す::" -#: ../../library/threading.rst:1312 msgid "" "b = Barrier(2, timeout=5)\n" "\n" @@ -2156,18 +2341,32 @@ msgid "" " connection = make_connection()\n" " process_client_connection(connection)" msgstr "" +"b = Barrier(2, timeout=5)\n" +"\n" +"def server():\n" +" start_server()\n" +" b.wait()\n" +" while True:\n" +" connection = accept_connection()\n" +" process_server_connection(connection)\n" +"\n" +"def client():\n" +" b.wait()\n" +" while True:\n" +" connection = make_connection()\n" +" process_client_connection(connection)" -#: ../../library/threading.rst:1330 msgid "" "Create a barrier object for *parties* number of threads. An *action*, when " "provided, is a callable to be called by one of the threads when they are " "released. *timeout* is the default timeout value if none is specified for " "the :meth:`wait` method." msgstr "" -"*parties* 個のスレッドのためのバリアオブジェクトを作成します。 *action* は、" -"もし提供されるなら呼び出し可能オブジェクトで、スレッドが解放される時にそのう" -"ちの1つによって呼ばれます。 *timeout* は、 :meth:`wait` メソッドに対して " -"none が指定された場合のデフォルトのタイムアウト値です。" +"*parties* 個のスレッドのためのバリアオブジェクトを作成します。\n" +"*action* を指定する場合は、スレッドの解放時に、そのうちの 1 つから呼び出され" +"る呼び出し可能オブジェクトにしてください。\n" +"*timeout* は、:meth:`wait` メソッドでタイムアウトを指定しなかった場合に使うデ" +"フォルト値です。" #: ../../library/threading.rst:1337 msgid "" @@ -2190,13 +2389,16 @@ msgstr "" "ります。これは、特別な後始末 (housekeeping) を行うスレッドを選択するために使" "用することができます。例えば::" -#: ../../library/threading.rst:1346 msgid "" "i = barrier.wait()\n" "if i == 0:\n" " # Only one thread needs to print this\n" " print(\"passed the barrier\")" msgstr "" +"i = barrier.wait()\n" +"if i == 0:\n" +" # 1 つのスレッドだけが表示すればよい\n" +" print(\"passed the barrier\")" #: ../../library/threading.rst:1351 msgid "" @@ -2283,7 +2485,6 @@ msgid "" "Using locks, conditions, and semaphores in the :keyword:`!with` statement" msgstr ":keyword:`!with` 文でのロック・条件変数・セマフォの使い方" -#: ../../library/threading.rst:1404 msgid "" "All of the objects provided by this module that have ``acquire`` and " "``release`` methods can be used as context managers for a :keyword:`with` " @@ -2291,18 +2492,24 @@ msgid "" "and ``release`` will be called when the block is exited. Hence, the " "following snippet::" msgstr "" +"このモジュールが提供するオブジェクトのうち、``acquire`` メソッドと " +"``release`` メソッドを持つものはすべて、:keyword:`with` 文のコンテキストマ" +"ネージャとして使えます。\n" +"ブロックに入るときに ``acquire``、ブロックを出るときに ``release`` が呼ばれま" +"す。\n" +"したがって、次のコードは ::" -#: ../../library/threading.rst:1410 msgid "" "with some_lock:\n" " # do something..." msgstr "" +"with some_lock:\n" +" # 何らかの処理を行う..." #: ../../library/threading.rst:1413 msgid "is equivalent to::" msgstr "は、以下と同じです ::" -#: ../../library/threading.rst:1415 msgid "" "some_lock.acquire()\n" "try:\n" @@ -2310,6 +2517,11 @@ msgid "" "finally:\n" " some_lock.release()" msgstr "" +"some_lock.acquire()\n" +"try:\n" +" # 何らかの処理を行う...\n" +"finally:\n" +" some_lock.release()" #: ../../library/threading.rst:1421 msgid "" diff --git a/library/time.po b/library/time.po index 7f568b398..7aa60ae39 100644 --- a/library/time.po +++ b/library/time.po @@ -23,10 +23,10 @@ msgstr "" "Last-Translator: tomo, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/time.rst:2 @@ -59,11 +59,13 @@ msgstr "" msgid "An explanation of some terminology and conventions is in order." msgstr "まずいくつかの用語の説明と慣習について整理します。" -#: ../../library/time.rst:24 msgid "" "The :dfn:`epoch` is the point where the time starts, the return value of " "``time.gmtime(0)``. It is January 1, 1970, 00:00:00 (UTC) on all platforms." msgstr "" +"時刻の起点である :dfn:`エポック` は、``time.gmtime(0)`` の戻り値で表されま" +"す。\n" +"すべてのプラットフォームで 1970 年 1 月 1 日 00:00:00 (UTC) です。" #: ../../library/time.rst:31 msgid "" @@ -76,16 +78,16 @@ msgstr "" "ん。\n" "全ての POSIX 互換のプラットフォームで、うるう秒はこの総秒数には含まれません。" -#: ../../library/time.rst:38 msgid "" "The functions in this module may not handle dates and times before the " "epoch_ or far in the future. The cut-off point in the future is determined " "by the C library; for 32-bit systems, it is typically in 2038." msgstr "" "このモジュールの中の関数は、エポック (epoch_) 以前あるいは遠い未来の日付や時" -"刻を扱うことができません。将来カットオフ(関数が正しく日付や時刻を扱えなくな" -"る)が起きる時点は、C ライブラリによって決まります。32-bit システムではカット" -"オフは通常 2038 年です。" +"刻を扱えない場合があります。\n" +"将来カットオフ(関数が正しく日付や時刻を扱えなくなる)が起きる時点は、C ライ" +"ブラリによって決まります。\n" +"32-bit システムではカットオフは通常 2038 年です。" #: ../../library/time.rst:45 msgid "" @@ -99,15 +101,18 @@ msgstr "" "換されます: 69-99 の西暦年は 1969-1999 となり、0–68 の西暦年は 2000–2068 にな" "ります。" -#: ../../library/time.rst:55 msgid "" "UTC is `Coordinated Universal Time`_ and superseded `Greenwich Mean Time`_ " "or GMT as the basis of international timekeeping. The acronym UTC is not a " "mistake but conforms to an earlier, language-agnostic naming scheme for time " "standards such as UT0, UT1, and UT2." msgstr "" +"UTC は `Coordinated Universal Time`_ (協定世界時) のことで、国際的な時刻の基" +"準として `Greenwich Mean Time`_ (グリニッジ標準時、GMT) に取って代わりまし" +"た。\n" +"UTC という略称は誤りではなく、UT0、UT1、UT2 など、以前からある言語に依存しな" +"い時刻標準の命名方式に従っています。" -#: ../../library/time.rst:65 msgid "" "DST is Daylight Saving Time, an adjustment of the timezone by (usually) one " "hour during part of the year. DST rules are magic (determined by local law) " @@ -115,11 +120,13 @@ msgid "" "local rules (often it is read from a system file for flexibility) and is the " "only source of True Wisdom in this respect." msgstr "" -"DST は夏時間 (Daylight Saving Time) のことで、一年のうちの一定期間に 1 時間タ" -"イムゾーンを修正することです。DST のルールは不可思議で (地域ごとに法律で定め" -"られています)、年ごとに変わることもあります。C ライブラリはローカルルールを記" -"したテーブルを持っており (柔軟に対応するため、たいていはシステムファイルから" -"読み込まれます)、この点に関しては唯一の真実の知識の源です。" +"DST は夏時間 (Daylight Saving Time) のことで、一年のうちの一定期間に、通常は " +"1 時間、タイムゾーンを調整します。\n" +"DST の規則は不可思議で (地域ごとの法律で決まります)、年ごとに変わることもあり" +"ます。\n" +"C ライブラリは地域ごとの規則を記したテーブルを持っており (柔軟に対応するた" +"め、たいていはシステムファイルから読み込みます)、この点に関して唯一の信頼でき" +"る情報源です。" #: ../../library/time.rst:71 msgid "" @@ -141,6 +148,11 @@ msgid "" "time with a nonzero fraction (Unix :c:func:`!select` is used to implement " "this, where available)." msgstr "" +"一方、:func:`.time` および :func:`sleep` は Unix の同等の関数よりましな精度を" +"持っています。時刻は浮動小数点数で表され、:func:`.time` は可能なかぎり最も正" +"確な時刻を (Unix の :c:func:`!gettimeofday` があればそれを使って) 返します。" +"また :func:`sleep` にはゼロでない端数を与えることができます (Unix の :c:func:" +"`!select` があれば、それを使って実装しています)。" #: ../../library/time.rst:82 msgid "" @@ -167,12 +179,17 @@ msgid "" "`~struct_time.tm_gmtoff` and :attr:`~struct_time.tm_zone` attributes when " "platform supports corresponding ``struct tm`` members." msgstr "" +":class:`struct_time` オブジェクトは、プラットフォームが、対応する ``struct " +"tm`` メンバーをサポートしている場合、:attr:`~struct_time.tm_gmtoff` および :" +"attr:`~struct_time.tm_zone` 属性が拡張されるようになりました。" #: ../../library/time.rst:96 msgid "" "The :class:`struct_time` attributes :attr:`~struct_time.tm_gmtoff` and :attr:" "`~struct_time.tm_zone` are now available on all platforms." msgstr "" +":class:`struct_time` の属性 :attr:`~struct_time.tm_gmtoff` および :attr:" +"`~struct_time.tm_zone` が全てのプラットフォームで利用できるようになりました。" #: ../../library/time.rst:101 msgid "Use the following functions to convert between time representations:" @@ -245,38 +262,31 @@ msgid "" msgstr "" "同名の C の関数と違って、:func:`asctime` は末尾に改行文字を加えません。" -#: ../../library/time.rst:143 msgid "" "Return the *clk_id* of the thread-specific CPU-time clock for the specified " "*thread_id*." msgstr "" +"指定された *thread_id* のスレッド固有の CPU 時間クロックの *clk_id* を返しま" +"す。" -#: ../../library/time.rst:145 msgid "" "Use :func:`threading.get_ident` or the :attr:`~threading.Thread.ident` " "attribute of :class:`threading.Thread` objects to get a suitable value for " "*thread_id*." msgstr "" +"*thread_id* に適した値を取得するには、:func:`threading.get_ident` または :" +"class:`threading.Thread` オブジェクトの :attr:`~threading.Thread.ident` 属性" +"を使ってください。" -#: ../../library/time.rst:150 msgid "" "Passing an invalid or expired *thread_id* may result in undefined behavior, " "such as segmentation fault." msgstr "" +"無効な *thread_id* や有効期限が切れた *thread_id* を渡すと、セグメンテーショ" +"ン違反などの未定義の動作が起こる可能性があります。" -#: ../../library/time.rst:153 ../../library/time.rst:165 -#: ../../library/time.rst:178 ../../library/time.rst:187 -#: ../../library/time.rst:200 ../../library/time.rst:209 -#: ../../library/time.rst:747 ../../library/time.rst:771 -#: ../../library/time.rst:867 ../../library/time.rst:878 -#: ../../library/time.rst:888 ../../library/time.rst:898 -#: ../../library/time.rst:907 ../../library/time.rst:916 -#: ../../library/time.rst:925 ../../library/time.rst:936 -#: ../../library/time.rst:944 ../../library/time.rst:955 -#: ../../library/time.rst:966 ../../library/time.rst:975 -#: ../../library/time.rst:988 msgid "Availability" -msgstr "" +msgstr "利用可能な環境" #: ../../library/time.rst:155 msgid "" @@ -302,11 +312,12 @@ msgstr "" "指定された *clk_id* クロックの時刻を返します。 *clk_id* として受け付けられる" "値の一覧は :ref:`time-clock-id-constants` を参照してください。" -#: ../../library/time.rst:175 msgid "" "Use :func:`clock_gettime_ns` to avoid the precision loss caused by the :" "class:`float` type." msgstr "" +":class:`float` 型による精度の損失を避けるには :func:`clock_gettime_ns` を使っ" +"てください。" #: ../../library/time.rst:185 msgid "Similar to :func:`clock_gettime` but return time as nanoseconds." @@ -320,11 +331,12 @@ msgstr "" "指定された *clk_id* クロックの時刻を設定します。\n" "現在、 :data:`CLOCK_REALTIME` は *clk_id* が受け付ける唯一の値です。" -#: ../../library/time.rst:197 msgid "" "Use :func:`clock_settime_ns` to avoid the precision loss caused by the :" "class:`float` type." msgstr "" +":class:`float` 型による精度の損失を避けるには :func:`clock_settime_ns` を使っ" +"てください。" #: ../../library/time.rst:207 msgid "Similar to :func:`clock_settime` but set time with nanoseconds." @@ -435,7 +447,6 @@ msgstr "" "か :const:`None` を指定した場合、:func:`.time` が返す値を現在の時刻として使用" "します。DST が適用されている場合は dst フラグには ``1`` が設定されます。" -#: ../../library/time.rst:268 msgid "" ":func:`localtime` may raise :exc:`OverflowError`, if the timestamp is " "outside the range of values supported by the platform C :c:func:`localtime` " @@ -443,6 +454,12 @@ msgid "" "c:func:`gmtime` failure. It's common for this to be restricted to years " "between 1970 and 2038." msgstr "" +"タイムスタンプがプラットフォームの C 関数 :c:func:`localtime` または :c:func:" +"`gmtime` のサポート範囲外の場合、:func:`localtime` は :exc:`OverflowError` を" +"送出することがあります。\n" +"また、:c:func:`localtime` または :c:func:`gmtime` が失敗した場合は :exc:" +"`OSError` を送出することがあります。\n" +"この範囲は通常、1970 年から 2038 年までに制限されています。" #: ../../library/time.rst:277 msgid "" @@ -456,6 +473,14 @@ msgid "" "libraries). The earliest date for which it can generate a time is platform-" "dependent." msgstr "" +":func:`localtime` の逆を行う関数です。引数は :class:`struct_time` か 9 個の要" +"素すべての値を持つ完全なタプル (dst フラグも必要です; 時刻に DST が適用される" +"か不明の場合は ``-1`` を使用してください) で、UTC ではなく *ローカル* 時間を" +"指定します。戻り値は :func:`.time` との互換性のために浮動小数点数になります。" +"入力した値を正しい時刻として表現できない場合、例外 :exc:`OverflowError` また" +"は :exc:`ValueError` が送出されます (どちらが送出されるかは、無効な値を受け" +"取ったのが Python と下層の C ライブラリのどちらなのかによって決まります)。こ" +"の関数で時刻を生成できる最も古い日付はプラットフォームに依存します。" #: ../../library/time.rst:289 msgid "" @@ -468,37 +493,36 @@ msgstr "" "す。このクロックはシステムクロックの更新の影響を受けません。戻り値の基準点は" "定義されていないので、二回の呼び出しの結果の差だけが有効です。" -#: ../../library/time.rst:294 ../../library/time.rst:713 msgid "Clock:" -msgstr "" +msgstr "使用するクロック:" -#: ../../library/time.rst:296 msgid "" "On Windows, call ``QueryPerformanceCounter()`` and " "``QueryPerformanceFrequency()``." msgstr "" +"Windows では ``QueryPerformanceCounter()`` と " +"``QueryPerformanceFrequency()`` を呼び出します。" -#: ../../library/time.rst:298 msgid "On macOS, call ``mach_absolute_time()`` and ``mach_timebase_info()``." msgstr "" +"macOS では ``mach_absolute_time()`` と ``mach_timebase_info()`` を呼び出しま" +"す。" -#: ../../library/time.rst:299 msgid "On HP-UX, call ``gethrtime()``." -msgstr "" +msgstr "HP-UX では ``gethrtime()`` を呼び出します。" -#: ../../library/time.rst:300 msgid "Call ``clock_gettime(CLOCK_HIGHRES)`` if available." -msgstr "" +msgstr "利用可能なら ``clock_gettime(CLOCK_HIGHRES)`` を呼び出します。" -#: ../../library/time.rst:301 msgid "Otherwise, call ``clock_gettime(CLOCK_MONOTONIC)``." -msgstr "" +msgstr "それ以外の場合は ``clock_gettime(CLOCK_MONOTONIC)`` を呼び出します。" -#: ../../library/time.rst:303 msgid "" "Use :func:`monotonic_ns` to avoid the precision loss caused by the :class:" "`float` type." msgstr "" +":class:`float` 型による精度の損失を避けるには :func:`monotonic_ns` を使ってく" +"ださい。" #: ../../library/time.rst:308 msgid "The function is now always available and always system-wide." @@ -525,31 +549,31 @@ msgstr "" "み、システムワイドです。戻り値の基準点は定義されていないので、二回の呼び出し" "の結果の差だけが有効です。" -#: ../../library/time.rst:334 msgid "" "On CPython, use the same clock as :func:`time.monotonic` and is a monotonic " "clock, i.e. a clock that cannot go backwards." msgstr "" +"CPython では :func:`time.monotonic` と同じクロックを使い、後戻りしない単調ク" +"ロックになっています。" -#: ../../library/time.rst:337 msgid "" "Use :func:`perf_counter_ns` to avoid the precision loss caused by the :class:" "`float` type." msgstr "" +":class:`float` 型による精度の損失を避けるには :func:`perf_counter_ns` を使っ" +"てください。" #: ../../library/time.rst:342 msgid "On Windows, the function is now system-wide." msgstr "" -#: ../../library/time.rst:345 msgid "Use the same clock as :func:`time.monotonic`." -msgstr "" +msgstr ":func:`time.monotonic` と同じクロックを使うようになりました。" #: ../../library/time.rst:351 msgid "Similar to :func:`perf_counter`, but return time as nanoseconds." msgstr ":func:`perf_counter` に似ていますが、ナノ秒単位の時刻を返します。" -#: ../../library/time.rst:363 msgid "" "Return the value (in fractional seconds) of the sum of the system and user " "CPU time of the current process. It does not include time elapsed during " @@ -557,15 +581,18 @@ msgid "" "returned value is undefined, so that only the difference between the results " "of two calls is valid." msgstr "" -"現在のプロセスのシステムおよびユーザー CPU 時間の値を (小数秒で) 返します。こ" -"れはスリープ中の経過時間を含みません。これは定義上プロセスワイドです。戻り値" -"の基準点は定義されていないので、二回の呼び出しの結果の差だけが有効です。" +"現在のプロセスのシステム CPU 時間とユーザー CPU 時間の合計を、秒単位の小数で" +"返します。\n" +"スリープ中の経過時間は含みません。\n" +"これは定義上、プロセス全体の値です。\n" +"戻り値の基準点は未定義なので、2 回の呼び出し結果の差だけが有効です。" -#: ../../library/time.rst:369 msgid "" "Use :func:`process_time_ns` to avoid the precision loss caused by the :class:" "`float` type." msgstr "" +":class:`float` 型による精度の損失を避けるには :func:`process_time_ns` を使っ" +"てください。" #: ../../library/time.rst:376 msgid "Similar to :func:`process_time` but return time as nanoseconds." @@ -578,21 +605,22 @@ msgid "" "time." msgstr "" -#: ../../library/time.rst:386 msgid "" "If the sleep is interrupted by a signal and no exception is raised by the " "signal handler, the sleep is restarted with a recomputed timeout." msgstr "" +"シグナルによりスリープが中断され、シグナルハンドラーが例外を送出しなかった場" +"合は、タイムアウトを再計算してスリープを再開します。" -#: ../../library/time.rst:389 msgid "" "The suspension time may be longer than requested by an arbitrary amount, " "because of the scheduling of other activity in the system." msgstr "" +"システム内の他の処理のスケジューリングによっては、停止時間が指定時間より長く" +"なることがあり、その超過時間に上限はありません。" -#: ../../library/time.rst:393 msgid "Windows implementation" -msgstr "" +msgstr "Windows での実装" #: ../../library/time.rst:394 msgid "" @@ -605,38 +633,40 @@ msgid "" "nanoseconds. If *secs* is zero, ``Sleep(0)`` is used." msgstr "" -#: ../../library/time.rst:403 msgid "Unix implementation" -msgstr "" +msgstr "Unix での実装" -#: ../../library/time.rst:404 msgid "Use ``clock_nanosleep()`` if available (resolution: 1 nanosecond);" -msgstr "" +msgstr "利用可能なら ``clock_nanosleep()`` を使います (分解能: 1 ナノ秒)。" -#: ../../library/time.rst:405 msgid "Or use ``nanosleep()`` if available (resolution: 1 nanosecond);" msgstr "" +"そうでなければ、利用可能なら ``nanosleep()`` を使います (分解能: 1 ナノ秒)。" -#: ../../library/time.rst:406 msgid "Or use ``select()`` (resolution: 1 microsecond)." -msgstr "" +msgstr "それ以外の場合は ``select()`` を使います (分解能: 1 マイクロ秒)。" -#: ../../library/time.rst:410 msgid "" "To emulate a \"no-op\", use :keyword:`pass` instead of ``time.sleep(0)``." msgstr "" +"何もしない操作を行うには、``time.sleep(0)`` ではなく :keyword:`pass` を使って" +"ください。" -#: ../../library/time.rst:412 msgid "" "To voluntarily relinquish the CPU, specify a real-time :ref:`scheduling " "policy ` and use :func:`os.sched_yield` instead." msgstr "" +"自発的に CPU を譲るには、リアルタイムの :ref:`スケジューリングポリシー ` を指定し、代わりに :func:`os.sched_yield` を使ってくださ" +"い。" #: ../../library/time.rst:415 msgid "" "Raises an :ref:`auditing event ` ``time.sleep`` with argument " "``secs``." msgstr "" +"引数 ``secs`` を指定して :ref:`監査イベント ` ``time.sleep`` を送出" +"します。 " #: ../../library/time.rst:417 msgid "" @@ -648,15 +678,16 @@ msgstr "" "くとも *secs* だけスリープするようになりました (論拠については :pep:`475` を" "参照してください)。" -#: ../../library/time.rst:422 msgid "" "On Unix, the ``clock_nanosleep()`` and ``nanosleep()`` functions are now " "used if available. On Windows, a waitable timer is now used." msgstr "" +"Unix では、利用可能なら ``clock_nanosleep()`` 関数と ``nanosleep()`` 関数を使" +"うようになりました。\n" +"Windows では待機可能タイマーを使うようになりました。" -#: ../../library/time.rst:426 msgid "Raises an auditing event." -msgstr "" +msgstr "監査イベントを送出するようになりました。" #: ../../library/time.rst:434 msgid "" @@ -754,13 +785,12 @@ msgstr "月中の日にちの 10 進表記になります [01,31]。" msgid "``%f``" msgstr "``%f``" -#: ../../library/time.rst:466 msgid "Microseconds as a decimal number" -msgstr "" +msgstr "マイクロ秒の 10 進表記" #: ../../library/time.rst:467 msgid "[000000,999999]." -msgstr "" +msgstr "[000000,999999]." #: ../../library/time.rst:466 msgid "\\(1)" @@ -834,15 +864,15 @@ msgstr "\\(3)" msgid "``%U``" msgstr "``%U``" -#: ../../library/time.rst:491 msgid "" "Week number of the year (Sunday as the first day of the week) as a decimal " "number [00,53]. All days in a new year preceding the first Sunday are " "considered to be in week 0." msgstr "" "年の初めから何週目か (日曜を週の始まりとします) を表す 10 進数になります " -"[00,53]。年が明けてから最初の日曜日までのすべての曜日は 0 週目に属すると見な" -"されます。" +"[00,53]。\n" +"年が明けてから最初の日曜日の前日までのすべての曜日は 0 週目に属すると見なされ" +"ます。" #: ../../library/time.rst:491 ../../library/time.rst:505 msgid "\\(4)" @@ -852,9 +882,8 @@ msgstr "\\(4)" msgid "``%u``" msgstr "``%u``" -#: ../../library/time.rst:499 msgid "Day of the week (Monday is 1; Sunday is 7) as a decimal number [1, 7]." -msgstr "" +msgstr "曜日の 10 進表記です (月曜日が 1、日曜日が 7) [1, 7]。" #: ../../library/time.rst:502 msgid "``%w``" @@ -868,15 +897,15 @@ msgstr "曜日の 10 進表記になります [0 (日曜日),6]。" msgid "``%W``" msgstr "``%W``" -#: ../../library/time.rst:505 msgid "" "Week number of the year (Monday as the first day of the week) as a decimal " "number [00,53]. All days in a new year preceding the first Monday are " "considered to be in week 0." msgstr "" "年の初めから何週目か (月曜を週の始まりとします) を表す 10 進数になります " -"[00,53]。年が明けてから最初の月曜日までの全ての曜日は 0 週目に属すると見なさ" -"れます。" +"[00,53]。\n" +"年が明けてから最初の月曜日の前日までの全ての曜日は 0 週目に属すると見なされま" +"す。" #: ../../library/time.rst:513 msgid "``%x``" @@ -937,23 +966,27 @@ msgstr "" msgid "``%G``" msgstr "``%G``" -#: ../../library/time.rst:534 msgid "" "ISO 8601 year (similar to ``%Y`` but follows the rules for the ISO 8601 " "calendar year). The year starts with the week that contains the first " "Thursday of the calendar year." msgstr "" +"ISO 8601 の年です (``%Y`` と似ていますが、ISO 8601 の暦年の規則に従いま" +"す)。\n" +"年の最初の木曜日を含む週から、その年が始まります。" #: ../../library/time.rst:539 msgid "``%V``" msgstr "``%V``" -#: ../../library/time.rst:539 msgid "" "ISO 8601 week number (as a decimal number [01,53]). The first week of the " "year is the one that contains the first Thursday of the year. Weeks start on " "Monday." msgstr "" +"ISO 8601 の週番号です (10 進表記 [01,53])。\n" +"年の最初の木曜日を含む週が、その年の第 1 週です。\n" +"週は月曜日から始まります。" #: ../../library/time.rst:544 msgid "``%%``" @@ -967,13 +1000,17 @@ msgstr "文字 ``'%'`` を表します。" msgid "Notes:" msgstr "注釈:" -#: ../../library/time.rst:550 msgid "" "The ``%f`` format directive only applies to :func:`strptime`, not to :func:" "`strftime`. However, see also :meth:`datetime.datetime.strptime` and :meth:" "`datetime.datetime.strftime` where the ``%f`` format directive :ref:`applies " "to microseconds `." msgstr "" +"書式ディレクティブ ``%f`` は :func:`strptime` にだけ適用され、:func:" +"`strftime` には適用されません。\n" +"ただし、:meth:`datetime.datetime.strptime` と :meth:`datetime.datetime." +"strftime` では、書式ディレクティブ ``%f`` が :ref:`マイクロ秒に適用される " +"` ので、こちらも参照してください。" #: ../../library/time.rst:556 msgid "" @@ -1009,12 +1046,14 @@ msgstr "" "以下に :rfc:`2822` インターネット電子メール標準で定義されている日付表現と互換" "の書式の例を示します。 [1]_ ::" -#: ../../library/time.rst:573 msgid "" ">>> from time import gmtime, strftime\n" ">>> strftime(\"%a, %d %b %Y %H:%M:%S +0000\", gmtime())\n" "'Thu, 28 Jun 2001 14:17:15 +0000'" msgstr "" +">>> from time import gmtime, strftime\n" +">>> strftime(\"%a, %d %b %Y %H:%M:%S +0000\", gmtime())\n" +"'Thu, 28 Jun 2001 14:17:15 +0000'" #: ../../library/time.rst:577 msgid "" @@ -1061,9 +1100,9 @@ msgstr "" "ます; このパラメーターの値はデフォルトでは ``\"%a %b %d %H:%M:%S %Y\"`` で、:" "func:`ctime` が返すフォーマットに一致します。*string* が *format* に従って解" "釈できなかった場合、例外 :exc:`ValueError` が送出されます。解析しようとする " -"*string* が解析後に余分なデータを持っていた場合、:exc:`ValueError` が送出され" -"ます。欠落したデータについて、適切な値を推測できない場合はデフォルトの値で埋" -"められ、その値は ``(1900, 1, 1, 0, 0, 0, 0, 1, -1)`` です。*string* も " +"*string* が解析後に余分なデータを持っていた場合、 ``ValueError`` が送出されま" +"す。欠落したデータについて、適切な値を推測できない場合はデフォルトの値で埋め" +"られ、その値は ``(1900, 1, 1, 0, 0, 0, 0, 1, -1)`` です。*string* も " "*format* も文字列でなければなりません。" #: ../../library/time.rst:605 @@ -1082,7 +1121,6 @@ msgstr "" "いと考えられている) UTC や GMT を認識する時以外はプラットフォーム固有の動作に" "なります。" -#: ../../library/time.rst:617 msgid "" "Only the directives specified in the documentation are supported. Because " "``strftime()`` is implemented per platform it can sometimes offer more " @@ -1090,11 +1128,11 @@ msgid "" "platform and thus does not necessarily support all directives available that " "are not documented as supported." msgstr "" -"ドキュメント内で説明されているディレクティブだけがサポートされています。" -"``strftime()`` はプラットフォームごとに実装されているので、説明されていない" -"ディレクティブも利用できるかもしれません。しかし、``strptime()`` はプラット" -"フォーム非依存なので、ドキュメント内でサポートされているとされているディレク" -"ティブ以外は利用できません。" +"ドキュメントに記載されたディレクティブだけがサポートされています。\n" +"``strftime()`` の実装はプラットフォームごとに異なるため、ここに記載された以外" +"のディレクティブを提供することがあります。\n" +"一方、``strptime()`` はプラットフォームに依存しないため、サポートされると記載" +"されていないディレクティブを、すべてサポートするとは限りません。" #: ../../library/time.rst:626 msgid "" @@ -1172,9 +1210,8 @@ msgstr "" msgid "6" msgstr "6" -#: ../../library/time.rst:663 msgid "range [0, 6]; Monday is 0" -msgstr "" +msgstr "[0, 6] の範囲。月曜日は 0" #: ../../library/time.rst:665 msgid "7" @@ -1212,27 +1249,23 @@ msgstr "" "C の構造体とは異なり、月の値は [0, 11] ではなく [1, 12] であることに注意して" "ください。" -#: ../../library/time.rst:684 msgid "" "In calls to :func:`mktime`, :attr:`tm_isdst` may be set to 1 when daylight " "savings time is in effect, and 0 when it is not. A value of -1 indicates " "that this is not known, and will usually result in the correct state being " "filled in." msgstr "" -":func:`mktime` の呼び出し時に、:attr:`tm_isdst` は夏時間が有効な場合は 1、そ" -"うでない場合は 0 に設定されることがあります。\n" -"値が -1 の場合は夏時間について不明なことを表していて、普通 :attr:`tm_isdst` " -"は正しい状態に設定されます。" +":func:`mktime` を呼び出す際は、夏時間が有効なら :attr:`tm_isdst` に 1、そうで" +"なければ 0 を設定できます。\n" +"-1 は夏時間かどうかが不明であることを表し、通常は正しい状態が補われます。" -#: ../../library/time.rst:688 msgid "" "When a tuple with an incorrect length is passed to a function expecting a :" "class:`struct_time`, or having elements of the wrong type, a :exc:" "`TypeError` is raised." msgstr "" -":class:`struct_time` を引数とする関数に正しくない長さの :class:`struct_time` " -"や要素の型が正しくない :class:`struct_time` を与えた場合には、 :exc:" -"`TypeError` が送出されます。" +":class:`struct_time` を受け取る関数に、長さが正しくないタプルや要素の型が正し" +"くないタプルを渡すと、:exc:`TypeError` が送出されます。" #: ../../library/time.rst:694 msgid "" @@ -1242,6 +1275,12 @@ msgid "" "the epoch_. This is commonly referred to as `Unix time `_." msgstr "" +"エポック (epoch_) からの秒数を浮動小数点数で返します。\n" +"うるう秒 (`leap seconds`_) の扱いはプラットフォーム依存です。\n" +"Windows とほとんどの Unix システムでは、うるう秒はエポック (epoch_) 秒の時間" +"の勘定には入りません。\n" +"これは一般に `Unix 時間 `_ と呼ばれ" +"ています。" #: ../../library/time.rst:700 msgid "" @@ -1251,8 +1290,12 @@ msgid "" "lower value than a previous call if the system clock has been set back " "between the two calls." msgstr "" +"時刻は常に浮動小数点数で返されますが、すべてのシステムが 1 秒より高い精度で時" +"刻を提供するとは限らないので注意してください。\n" +"この関数が返す値は通常減少していくことはありませんが、この関数を 2 回呼び出" +"し、その呼び出しの間にシステムクロックの時刻を巻き戻して設定した場合には、以" +"前の呼び出しよりも低い値が返ることがあります。" -#: ../../library/time.rst:706 msgid "" "The number returned by :func:`.time` may be converted into a more common " "time format (i.e. year, month, day, hour, etc...) in UTC by passing it to :" @@ -1261,29 +1304,28 @@ msgid "" "returned, from which the components of the calendar date may be accessed as " "attributes." msgstr "" -":func:`.time` が返す数値は、 :func:`gmtime` 関数に渡されて UTC の、あるいは :" -"func:`localtime` 関数に渡されて現地時間の、より一般的な時間のフォーマット (つ" -"まり、年、月、日、時間など) に変換されているかもしれません。\n" -"どちらの場合でも :class:`struct_time` オブジェクトが返され、このオブジェクト" -"の属性としてカレンダー日付の構成要素へアクセスできます。" +":func:`.time` が返す数値は、:func:`gmtime` に渡すと UTC の、:func:" +"`localtime` に渡すとローカル時間の、より一般的な時刻の形式 (年、月、日、時な" +"ど) に変換できます。\n" +"どちらも :class:`struct_time` オブジェクトを返し、日付や時刻の各要素を属性と" +"して取得できます。" #: ../../library/time.rst:715 msgid "On Windows, call ``GetSystemTimeAsFileTime()``." msgstr "" -#: ../../library/time.rst:716 msgid "Call ``clock_gettime(CLOCK_REALTIME)`` if available." -msgstr "" +msgstr "利用可能なら ``clock_gettime(CLOCK_REALTIME)`` を呼び出します。" -#: ../../library/time.rst:717 msgid "Otherwise, call ``gettimeofday()``." -msgstr "" +msgstr "それ以外の場合は ``gettimeofday()`` を呼び出します。" -#: ../../library/time.rst:719 msgid "" "Use :func:`time_ns` to avoid the precision loss caused by the :class:`float` " "type." msgstr "" +":class:`float` 型による精度の損失を避けるには :func:`time_ns` を使ってくださ" +"い。" #: ../../library/time.rst:725 msgid "" @@ -1293,7 +1335,6 @@ msgstr "" ":func:`~time.time` に似ていますが、時刻を epoch_ を基点としたナノ秒単位の整数" "で返します。" -#: ../../library/time.rst:738 msgid "" "Return the value (in fractional seconds) of the sum of the system and user " "CPU time of the current thread. It does not include time elapsed during " @@ -1301,26 +1342,27 @@ msgid "" "returned value is undefined, so that only the difference between the results " "of two calls in the same thread is valid." msgstr "" -"現在のスレッドのシステムおよびユーザー CPU 時間の値を (小数秒で) 返します。こ" -"れはスリープ中の経過時間を含みません。これは定義上スレッド固有です。戻り値の" -"基準点は定義されていないので、同一スレッドにおける二回の呼び出しの結果の差だ" -"けが有効です。" +"現在のスレッドのシステム CPU 時間とユーザー CPU 時間の合計を、秒単位の小数で" +"返します。\n" +"スリープ中の経過時間は含みません。\n" +"これは定義上、スレッド固有の値です。\n" +"戻り値の基準点は未定義なので、同一スレッドでの 2 回の呼び出し結果の差だけが有" +"効です。" -#: ../../library/time.rst:744 msgid "" "Use :func:`thread_time_ns` to avoid the precision loss caused by the :class:" "`float` type." msgstr "" +":class:`float` 型による精度の損失を避けるには :func:`thread_time_ns` を使って" +"ください。" -#: ../../library/time.rst:749 msgid "Unix systems supporting ``CLOCK_THREAD_CPUTIME_ID``." -msgstr "" +msgstr "``CLOCK_THREAD_CPUTIME_ID`` をサポートする Unix システム。" #: ../../library/time.rst:756 msgid "Similar to :func:`thread_time` but return time as nanoseconds." msgstr ":func:`thread_time` に似ていますが、ナノ秒単位の時刻を返します。" -#: ../../library/time.rst:763 msgid "" "Reset the time conversion rules used by the library routines. The " "environment variable :envvar:`TZ` specifies how this is done. It will also " @@ -1330,16 +1372,22 @@ msgid "" "saving time rules, or to nonzero if there is a time, past, present or future " "when daylight saving time applies)." msgstr "" +"ライブラリの関数が使う時刻変換の規則を再設定します。\n" +"再設定の内容は環境変数 :envvar:`TZ` で指定します。\n" +"また、``tzname`` (:envvar:`TZ` 環境変数に基づく値)、``timezone`` (夏時間でな" +"い場合の UTC から西向きの秒数)、\n" +"``altzone`` (夏時間の場合の UTC から西向きの秒数)、``daylight`` (このタイム" +"ゾーンに夏時間の規則がなければ 0、過去・現在・未来に夏時間が適用される期間が" +"あればゼロ以外) も設定します。" -#: ../../library/time.rst:775 msgid "" "Although in many cases, changing the :envvar:`TZ` environment variable may " "affect the output of functions like :func:`localtime` without calling :func:" "`tzset`, this behavior should not be relied on." msgstr "" -"多くの場合、環境変数 :envvar:`TZ` を変更すると、 :func:`tzset` を呼ばない限" -"り :func:`localtime` のような関数の出力に影響を及ぼすため、値が信頼できなく" -"なってしまいます。" +"多くの場合、:envvar:`TZ` 環境変数を変更すると :func:`tzset` を呼び出さなくて" +"も :func:`localtime` などの関数の出力が変わりますが、この動作を当てにしてはい" +"けません。" #: ../../library/time.rst:779 msgid "The :envvar:`TZ` environment variable should contain no whitespace." @@ -1353,9 +1401,8 @@ msgstr "" "環境変数 :envvar:`TZ` の標準的な書式は以下の通りです (分かりやすいように空白" "を入れています)::" -#: ../../library/time.rst:784 msgid "std offset [dst [offset [,start[/time], end[/time]]]]" -msgstr "" +msgstr "std offset [dst [offset [,start[/time], end[/time]]]]" #: ../../library/time.rst:786 msgid "Where the components are:" @@ -1430,17 +1477,18 @@ msgstr "" msgid ":samp:`M{m}.{n}.{d}`" msgstr ":samp:`M{m}.{n}.{d}`" -#: ../../library/time.rst:811 msgid "" "The *d*'th day (0 <= *d* <= 6) of week *n* of month *m* of the year (1 <= " "*n* <= 5, 1 <= *m* <= 12, where week 5 means \"the last *d* day in month " "*m*\" which may occur in either the fourth or the fifth week). Week 1 is the " "first week in which the *d*'th day occurs. Day zero is a Sunday." msgstr "" -"*m* 月の週 *n* における *d* 番目の日 (0 <= *d* <= 6, 1 <= *n* <= 5, 1 <= *m* " -"<= 12) を表します。週 5 は月 *m* における最終週の *d* 番目の日を表し、第 4 週" -"か第 5 週のどちらかになります。週 1 は日 *d* が最初に現れる日を指します。日 " -"0 は日曜日です。" +"*m* 月の第 *n* 週の曜日 *d* (0 <= *d* <= 6) を表します (1 <= *n* <= 5、1 <= " +"*m* <= 12)。\n" +"第 5 週は「*m* 月の最後の曜日 *d*」を意味し、第 4 週または第 5 週に当たりま" +"す。\n" +"第 1 週は曜日 *d* が初めて現れる週です。\n" +"曜日 0 は日曜日です。" #: ../../library/time.rst:817 msgid "" @@ -1462,6 +1510,14 @@ msgid "" ">>> time.strftime('%X %x %Z')\n" "'16:08:12 05/08/03 AEST'" msgstr "" +">>> os.environ['TZ'] = 'EST+05EDT,M4.1.0,M10.5.0'\n" +">>> time.tzset()\n" +">>> time.strftime('%X %x %Z')\n" +"'02:07:36 05/08/03 EDT'\n" +">>> os.environ['TZ'] = 'AEST-10AEDT-11,M10.5.0,M3.5.0'\n" +">>> time.tzset()\n" +">>> time.strftime('%X %x %Z')\n" +"'16:08:12 05/08/03 AEST'" #: ../../library/time.rst:831 msgid "" @@ -1493,40 +1549,51 @@ msgid "" ">>> time.tzname\n" "('EET', 'EEST')" msgstr "" +">>> os.environ['TZ'] = 'US/Eastern'\n" +">>> time.tzset()\n" +">>> time.tzname\n" +"('EST', 'EDT')\n" +">>> os.environ['TZ'] = 'Egypt'\n" +">>> time.tzset()\n" +">>> time.tzname\n" +"('EET', 'EEST')" -#: ../../library/time.rst:852 msgid "Clock ID Constants" -msgstr "" +msgstr "クロック ID 定数" -#: ../../library/time.rst:854 msgid "" "These constants are used as parameters for :func:`clock_getres` and :func:" "`clock_gettime`." msgstr "" +"これらの定数は :func:`clock_getres` と :func:`clock_gettime` の引数として使い" +"ます。" -#: ../../library/time.rst:859 msgid "" "Identical to :data:`CLOCK_MONOTONIC`, except it also includes any time that " "the system is suspended." msgstr "" +":data:`CLOCK_MONOTONIC` と同じですが、システムがサスペンドしていた時間も含み" +"ます。" -#: ../../library/time.rst:862 msgid "" "This allows applications to get a suspend-aware monotonic clock without " "having to deal with the complications of :data:`CLOCK_REALTIME`, which may " "have discontinuities if the time is changed using ``settimeofday()`` or " "similar." msgstr "" +"これにより、アプリケーションはサスペンド時間を考慮した単調クロックを利用でき" +"ます。\n" +"``settimeofday()`` などで時刻を変更すると不連続になることがある :data:" +"`CLOCK_REALTIME` の複雑さに対処する必要はありません。" -#: ../../library/time.rst:874 msgid "" "The Solaris OS has a ``CLOCK_HIGHRES`` timer that attempts to use an optimal " "hardware source, and may give close to nanosecond resolution. " "``CLOCK_HIGHRES`` is the nonadjustable, high-resolution clock." msgstr "" -"Solaris OS は任意のハードウェアソースの使用を試み、ナノ秒レベルの分解能を提供" -"する ``CLOCK_HIGHRES`` タイマーを具備しています。``CLOCK_HIGHRES`` は変更不可" -"で、高分解能のクロックです。" +"Solaris OS の ``CLOCK_HIGHRES`` タイマーは、最適なハードウェアソースの使用を" +"試み、ナノ秒に近い分解能を提供することがあります。\n" +"``CLOCK_HIGHRES`` は調整不可の高分解能クロックです。" #: ../../library/time.rst:885 msgid "" @@ -1544,11 +1611,12 @@ msgstr "" ":data:`CLOCK_MONOTONIC` と似ていますが、NTP の影響を受けていない、ハードウェ" "アベースの時刻へのアクセスを提供します。" -#: ../../library/time.rst:904 msgid "" "Similar to :data:`CLOCK_MONOTONIC_RAW`, but reads a value cached by the " "system at context switch and hence has less accuracy." msgstr "" +":data:`CLOCK_MONOTONIC_RAW` と似ていますが、コンテキストスイッチ時にシステム" +"がキャッシュした値を読むため、精度は低くなります。" #: ../../library/time.rst:914 ../../library/time.rst:923 msgid "High-resolution per-process timer from the CPU." @@ -1560,40 +1628,44 @@ msgid "" "division/nist-time-frequently-asked-questions-faq#tai>`_" msgstr "" -#: ../../library/time.rst:933 msgid "" "The system must have a current leap second table in order for this to give " "the correct answer. PTP or NTP software can maintain a leap second table." msgstr "" +"正しい値を得るには、システムに最新のうるう秒テーブルが必要です。\n" +"PTP または NTP ソフトウェアでうるう秒テーブルを維持できます。" #: ../../library/time.rst:942 msgid "Thread-specific CPU-time clock." msgstr "スレッド固有の CPU タイムクロックです。" -#: ../../library/time.rst:951 msgid "" "Time whose absolute value is the time the system has been running and not " "suspended, providing accurate uptime measurement, both absolute and interval." msgstr "" +"システムがサスペンドせずに動作していた時間を絶対値として持つ時刻です。\n" +"起動後の稼働時間と、ある区間の稼働時間のどちらも正確に測定できます。" -#: ../../library/time.rst:962 msgid "" "Clock that increments monotonically, tracking the time since an arbitrary " "point, unaffected by frequency or time adjustments and not incremented while " "the system is asleep." msgstr "" +"任意の時点からの経過時間を追跡する、単調増加するクロックです。\n" +"周波数や時刻の調整の影響を受けず、システムがスリープしている間は増加しませ" +"ん。" -#: ../../library/time.rst:972 msgid "" "Like :data:`CLOCK_UPTIME_RAW`, but the value is cached by the system at " "context switches and therefore has less accuracy." msgstr "" +":data:`CLOCK_UPTIME_RAW` と似ていますが、値がコンテキストスイッチ時にシステム" +"によってキャッシュされるため、精度は低くなります。" -#: ../../library/time.rst:979 msgid "" "The following constant is the only parameter that can be sent to :func:" "`clock_settime`." -msgstr "" +msgstr "次の定数は :func:`clock_settime` に渡せる唯一のクロック ID です。" #: ../../library/time.rst:985 msgid "" @@ -1603,21 +1675,21 @@ msgstr "" "システム全体のリアルタイムクロックです。このクロックを設定するには適切な権限" "が必要です。" -#: ../../library/time.rst:996 msgid "Timezone Constants" -msgstr "" +msgstr "タイムゾーン定数" -#: ../../library/time.rst:1000 msgid "" "The offset of the local DST timezone, in seconds west of UTC, if one is " "defined. This is negative if the local DST timezone is east of UTC (as in " "Western Europe, including the UK). Only use this if ``daylight`` is " "nonzero. See note below." msgstr "" -"ローカルの夏時間タイムゾーンにおける UTC からの時刻オフセットで、西に行くほど" -"増加する、秒で表した値です (ほとんどの西ヨーロッパでは負になり、アメリカでは" -"正、イギリスではゼロになります)。``daylight`` がゼロでないときのみ使用してく" -"ださい。以下の注釈を参照してください。" +"ローカルの夏時間タイムゾーンが定義されている場合、その UTC から西向きのオフ" +"セットを秒単位で表します。\n" +"英国を含む西ヨーロッパのように夏時間タイムゾーンが UTC より東側にある場合、こ" +"の値は負になります。\n" +"``daylight`` がゼロでない場合にのみ使用してください。\n" +"以下の注釈を参照してください。" #: ../../library/time.rst:1006 msgid "Nonzero if a DST timezone is defined. See note below." @@ -1646,7 +1718,6 @@ msgstr "" "ていない場合。二つ目の文字列を使うべきではありません。以下の注釈を参照してく" "ださい。" -#: ../../library/time.rst:1021 msgid "" "For the above Timezone constants (:data:`altzone`, :data:`daylight`, :data:" "`timezone`, and :data:`tzname`), the value is determined by the timezone " @@ -1655,6 +1726,13 @@ msgid "" "attr:`~struct_time.tm_gmtoff` and :attr:`~struct_time.tm_zone` results from :" "func:`localtime` to obtain timezone information." msgstr "" +"上記のタイムゾーン定数 (:data:`altzone`、:data:`daylight`、:data:" +"`timezone`、:data:`tzname`) の値は、モジュール読み込み時または最後の :func:" +"`tzset` 呼び出し時に有効なタイムゾーン規則によって決まるため、過去の時刻には" +"正しくない場合があります。\n" +"タイムゾーン情報を取得するには、:func:`localtime` の結果の :attr:" +"`~struct_time.tm_gmtoff` と :attr:`~struct_time.tm_zone` を使うことを推奨しま" +"す。" #: ../../library/time.rst:1030 msgid "Module :mod:`datetime`" @@ -1719,9 +1797,8 @@ msgstr "エポック" msgid "Year 2038" msgstr "2038年" -#: ../../library/time.rst:42 msgid "2-digit years" -msgstr "" +msgstr "2 桁の年" #: ../../library/time.rst:50 msgid "UTC" @@ -1756,6 +1833,5 @@ msgstr "プロセッサー時間" msgid "% (percent)" msgstr "% (パーセント)" -#: ../../library/time.rst:429 ../../library/time.rst:588 msgid "datetime format" -msgstr "" +msgstr "日時の書式" diff --git a/library/timeit.po b/library/timeit.po index 8c3cdf3e2..b74c980f0 100644 --- a/library/timeit.po +++ b/library/timeit.po @@ -20,10 +20,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/timeit.rst:2 @@ -34,7 +34,6 @@ msgstr ":mod:`!timeit` --- 小さなコードスニペットの実行時間計 msgid "**Source code:** :source:`Lib/timeit.py`" msgstr "**ソースコード:** :source:`Lib/timeit.py`" -#: ../../library/timeit.rst:15 msgid "" "This module provides a simple way to time small bits of Python code. It has " "both a :ref:`timeit-command-line-interface` as well as a :ref:`callable " @@ -42,11 +41,13 @@ msgid "" "execution times. See also Tim Peters' introduction to the \"Algorithms\" " "chapter in the second edition of *Python Cookbook*, published by O'Reilly." msgstr "" -"このモジュールは小さい Python コードをの時間を計測するシンプルな手段を提供し" -"ています。:ref:`timeit-command-line-interface` の他 :ref:`呼び出しも可能 " -"` です。このモジュールは実行時間を計測するときに共通するい" -"くつかの罠を回避します。O'Reilly 出版の *Python Cookbook* 第2版にある、Tim " -"Peter による \"Algorithms\" 章も参照してください。" +"このモジュールは、小さな Python コードの実行時間を簡単に計測する手段を提供し" +"ます。\n" +":ref:`timeit-command-line-interface` と、:ref:`Python から呼び出せるインター" +"フェース ` の両方があります。\n" +"実行時間の計測で陥りがちな問題の多くを回避できます。\n" +"O'Reilly 刊 *Python Cookbook* 第 2 版の「Algorithms」章にある Tim Peters によ" +"る導入も参照してください。" #: ../../library/timeit.rst:23 msgid "Basic Examples" @@ -69,6 +70,12 @@ msgid "" "$ python -m timeit \"'-'.join(map(str, range(100)))\"\n" "10000 loops, best of 5: 23.2 usec per loop" msgstr "" +"$ python -m timeit \"'-'.join(str(n) for n in range(100))\"\n" +"10000 loops, best of 5: 30.2 usec per loop\n" +"$ python -m timeit \"'-'.join([str(n) for n in range(100)])\"\n" +"10000 loops, best of 5: 27.5 usec per loop\n" +"$ python -m timeit \"'-'.join(map(str, range(100)))\"\n" +"10000 loops, best of 5: 23.2 usec per loop" #: ../../library/timeit.rst:37 msgid "This can be achieved from the :ref:`python-interface` with::" @@ -84,6 +91,13 @@ msgid "" ">>> timeit.timeit('\"-\".join(map(str, range(100)))', number=10000)\n" "0.23702679807320237" msgstr "" +">>> import timeit\n" +">>> timeit.timeit('\"-\".join(str(n) for n in range(100))', number=10000)\n" +"0.3018611848820001\n" +">>> timeit.timeit('\"-\".join([str(n) for n in range(100)])', number=10000)\n" +"0.2727368790656328\n" +">>> timeit.timeit('\"-\".join(map(str, range(100)))', number=10000)\n" +"0.23702679807320237" #: ../../library/timeit.rst:47 msgid "A callable can also be passed from the :ref:`python-interface`::" @@ -95,6 +109,8 @@ msgid "" ">>> timeit.timeit(lambda: \"-\".join(map(str, range(100))), number=10000)\n" "0.19665591977536678" msgstr "" +">>> timeit.timeit(lambda: \"-\".join(map(str, range(100))), number=10000)\n" +"0.19665591977536678" #: ../../library/timeit.rst:52 msgid "" @@ -114,33 +130,32 @@ msgstr "Python インターフェイス" msgid "The module defines three convenience functions and a public class:" msgstr "このモジュールは 3 つの有用な関数と 1 つの公開クラスを持っています:" -#: ../../library/timeit.rst:67 msgid "" "Create a :class:`Timer` instance with the given statement, *setup* code and " "*timer* function and run its :meth:`.timeit` method with *number* " "executions. The optional *globals* argument specifies a namespace in which " "to execute the code." msgstr "" -"与えられた文、*setup* コードおよび *timer* 関数で :class:`Timer` インスタンス" -"を作成し、その :meth:`.timeit` メソッドを *number* 回実行します。\n" -"任意の *globals* 引数はコードを実行する名前空間を指定します。" +"指定された文、*setup* コード、*timer* 関数で :class:`Timer` インスタンスを作" +"成し、:meth:`.timeit` メソッドでその文を *number* 回実行する時間を計測しま" +"す。\n" +"オプションの *globals* 引数には、コードを実行する名前空間を指定します。" #: ../../library/timeit.rst:72 ../../library/timeit.rst:83 #: ../../library/timeit.rst:122 msgid "The optional *globals* parameter was added." msgstr "任意の *globals* 引数が追加されました。" -#: ../../library/timeit.rst:78 msgid "" "Create a :class:`Timer` instance with the given statement, *setup* code and " "*timer* function and run its :meth:`.repeat` method with the given *repeat* " "count and *number* executions. The optional *globals* argument specifies a " "namespace in which to execute the code." msgstr "" -"与えられた文、*setup* コードおよび *timer* 関数で :class:`Timer` インスタンス" -"を作成し、その :meth:`.repeat` メソッドを *repeat* 回繰り返すのを *number* 回" -"実行します。\n" -"任意の *globals* 引数はコードを実行する名前空間を指定します。" +"指定された文、*setup* コード、*timer* 関数で :class:`Timer` インスタンスを作" +"成し、:meth:`.repeat` メソッドを実行します。\n" +"文を *number* 回実行する計測を *repeat* 回繰り返します。\n" +"オプションの *globals* 引数には、コードを実行する名前空間を指定します。" #: ../../library/timeit.rst:86 ../../library/timeit.rst:183 msgid "Default value of *repeat* changed from 3 to 5." @@ -244,7 +259,7 @@ msgstr "" #: ../../library/timeit.rst:143 msgid "timeit.Timer('for i in range(10): oct(i)', 'gc.enable()').timeit()" -msgstr "" +msgstr "timeit.Timer('for i in range(10): oct(i)', 'gc.enable()').timeit()" #: ../../library/timeit.rst:148 msgid "Automatically determine how many times to call :meth:`.timeit`." @@ -313,7 +328,6 @@ msgstr "計測対象コードのトレースバックを出力するためのヘ msgid "Typical use::" msgstr "利用例::" -#: ../../library/timeit.rst:193 msgid "" "t = Timer(...) # outside the try/except\n" "try:\n" @@ -321,6 +335,11 @@ msgid "" "except Exception:\n" " t.print_exc()" msgstr "" +"t = Timer(...) # try/except の外側\n" +"try:\n" +" t.timeit(...) # または t.repeat(...)\n" +"except Exception:\n" +" t.print_exc()" #: ../../library/timeit.rst:199 msgid "" @@ -345,6 +364,7 @@ msgstr "コマンドラインからプログラムとして呼び出す場合は msgid "" "python -m timeit [-n N] [-r N] [-u U] [-s S] [-p] [-v] [-h] [statement ...]" msgstr "" +"python -m timeit [-n N] [-r N] [-u U] [-s S] [-p] [-v] [-h] [statement ...]" #: ../../library/timeit.rst:213 msgid "Where the following options are understood:" @@ -378,9 +398,10 @@ msgstr "" "timer 出力の時間の単位を指定します。 ``nsec``、``usec``、``msec``、``sec`` を" "選択できます。" -#: ../../library/timeit.rst:244 msgid "print raw timing results; repeat for more digits precision" -msgstr "時間計測の結果をそのまま詳細な数値でくり返し表示する" +msgstr "" +"計測結果の生の値を表示します。\n" +"このオプションを繰り返し指定すると表示の桁数が増えます。" #: ../../library/timeit.rst:248 msgid "print a short usage message and exit" @@ -454,6 +475,12 @@ msgid "" "find(char)\"\n" "1000000 loops, best of 5: 0.342 usec per loop" msgstr "" +"$ python -m timeit -s \"text = 'sample string'; char = 'g'\" \"char in " +"text\"\n" +"5000000 loops, best of 5: 0.0877 usec per loop\n" +"$ python -m timeit -s \"text = 'sample string'; char = 'g'\" \"text." +"find(char)\"\n" +"1000000 loops, best of 5: 0.342 usec per loop" #: ../../library/timeit.rst:287 msgid "" @@ -479,6 +506,13 @@ msgid "" "\"g\"')\n" "1.7246671520006203" msgstr "" +">>> import timeit\n" +">>> timeit.timeit('char in text', setup='text = \"sample string\"; char = " +"\"g\"')\n" +"0.41440500499993504\n" +">>> timeit.timeit('text.find(char)', setup='text = \"sample string\"; char = " +"\"g\"')\n" +"1.7246671520006203" #: ../../library/timeit.rst:302 msgid "The same can be done using the :class:`Timer` class and its methods::" @@ -496,6 +530,14 @@ msgid "" "[0.40183617287970225, 0.37027556854118704, 0.38344867356679524, " "0.3712595970846668, 0.37866875250654886]" msgstr "" +">>> import timeit\n" +">>> t = timeit.Timer('char in text', setup='text = \"sample string\"; char = " +"\"g\"')\n" +">>> t.timeit()\n" +"0.3955516149999312\n" +">>> t.repeat()\n" +"[0.40183617287970225, 0.37027556854118704, 0.38344867356679524, " +"0.3712595970846668, 0.37866875250654886]" #: ../../library/timeit.rst:312 msgid "" @@ -521,8 +563,18 @@ msgid "" "$ python -m timeit \"if hasattr(int, '__bool__'): pass\"\n" "100000 loops, best of 5: 2.23 usec per loop" msgstr "" +"$ python -m timeit \"try:\" \" str.__bool__\" \"except AttributeError:\" " +"\" pass\"\n" +"20000 loops, best of 5: 15.7 usec per loop\n" +"$ python -m timeit \"if hasattr(str, '__bool__'): pass\"\n" +"50000 loops, best of 5: 4.26 usec per loop\n" +"\n" +"$ python -m timeit \"try:\" \" int.__bool__\" \"except AttributeError:\" " +"\" pass\"\n" +"200000 loops, best of 5: 1.43 usec per loop\n" +"$ python -m timeit \"if hasattr(int, '__bool__'): pass\"\n" +"100000 loops, best of 5: 2.23 usec per loop" -#: ../../library/timeit.rst:330 msgid "" ">>> import timeit\n" ">>> # attribute is missing\n" @@ -551,6 +603,32 @@ msgid "" ">>> timeit.timeit(stmt=s, number=100000)\n" "0.08588060699912603" msgstr "" +">>> import timeit\n" +">>> # 属性が存在しない場合\n" +">>> s = \"\"\"\\\n" +"... try:\n" +"... str.__bool__\n" +"... except AttributeError:\n" +"... pass\n" +"... \"\"\"\n" +">>> timeit.timeit(stmt=s, number=100000)\n" +"0.9138244460009446\n" +">>> s = \"if hasattr(str, '__bool__'): pass\"\n" +">>> timeit.timeit(stmt=s, number=100000)\n" +"0.5829014980008651\n" +">>>\n" +">>> # 属性が存在する場合\n" +">>> s = \"\"\"\\\n" +"... try:\n" +"... int.__bool__\n" +"... except AttributeError:\n" +"... pass\n" +"... \"\"\"\n" +">>> timeit.timeit(stmt=s, number=100000)\n" +"0.04215312199994514\n" +">>> s = \"if hasattr(int, '__bool__'): pass\"\n" +">>> timeit.timeit(stmt=s, number=100000)\n" +"0.08588060699912603" #: ../../library/timeit.rst:358 msgid "" @@ -560,7 +638,6 @@ msgstr "" "定義した関数に :mod:`timeit` モジュールがアクセスできるようにするために、 " "import 文の入った *setup* パラメータを渡すことができます::" -#: ../../library/timeit.rst:361 msgid "" "def test():\n" " \"\"\"Stupid test function\"\"\"\n" @@ -570,16 +647,23 @@ msgid "" " import timeit\n" " print(timeit.timeit(\"test()\", setup=\"from __main__ import test\"))" msgstr "" +"def test():\n" +" \"\"\"単純なテスト関数\"\"\"\n" +" L = [i for i in range(100)]\n" +"\n" +"if __name__ == '__main__':\n" +" import timeit\n" +" print(timeit.timeit(\"test()\", setup=\"from __main__ import test\"))" -#: ../../library/timeit.rst:369 msgid "" "Another option is to pass :func:`globals` to the *globals* parameter, which " "will cause the code to be executed within your current global namespace. " "This can be more convenient than individually specifying imports::" msgstr "" -"他のオプションは :func:`globals` を *globals* 引数に渡すことです。\n" -"これによりコードはあなたのグローバル名前空間内で実行されます。\n" -"これはそれぞれでインポートするより 便利です::" +"もう 1 つの方法は、*globals* 引数に :func:`globals` の戻り値を渡すことで" +"す。\n" +"これにより、現在のグローバル名前空間内でコードを実行できます。\n" +"インポートする対象を 1 つずつ指定するより便利な場合があります。 ::" #: ../../library/timeit.rst:373 msgid "" @@ -593,6 +677,15 @@ msgid "" "import timeit\n" "print(timeit.timeit('[func(42) for func in (f,g,h)]', globals=globals()))" msgstr "" +"def f(x):\n" +" return x**2\n" +"def g(x):\n" +" return x**4\n" +"def h(x):\n" +" return x**8\n" +"\n" +"import timeit\n" +"print(timeit.timeit('[func(42) for func in (f,g,h)]', globals=globals()))" #: ../../library/timeit.rst:9 msgid "Benchmarking" diff --git a/library/tk.po b/library/tk.po index bb8eb8196..de1e19ab8 100644 --- a/library/tk.po +++ b/library/tk.po @@ -17,10 +17,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/tk.rst:5 @@ -39,7 +39,6 @@ msgstr "" "グラマは :mod:`tkinter` パッケージやその拡張の :mod:`tkinter.ttk` モジュール" "を使って利用できます。" -#: ../../library/tk.rst:17 msgid "" "The :mod:`tkinter` package is a thin object-oriented layer on top of Tcl/Tk. " "To use :mod:`tkinter`, you don't need to write Tcl code, but you will need " @@ -47,11 +46,12 @@ msgid "" "mod:`tkinter` is a set of wrappers that implement the Tk widgets as Python " "classes." msgstr "" -":mod:`tkinter` パッケージはオブジェクトの薄い層で作ったTcl/Tkの最上層です。:" -"mod:`tkinter` を使うには、Tcl のコードを書く必要はありませんが、Tk のドキュメ" -"ント、またはときどき、Tcl のドキュメントを調べる\n" -"必要が出て来ます。:mod:`tkinter` は Python クラスとして実装した Tk ウィジェッ" -"トのラッパーの集合です。" +":mod:`tkinter` パッケージは、Tcl/Tk 上に設けられた薄いオブジェクト指向の層で" +"す。\n" +":mod:`tkinter` を使うために Tcl のコードを書く必要はありませんが、Tk のドキュ" +"メントや、ときには Tcl のドキュメントを参照する必要があります。\n" +":mod:`tkinter` は、Tk ウィジェットを Python クラスとして実装するラッパーの集" +"合です。" #: ../../library/tk.rst:23 msgid "" diff --git a/library/tkinter.colorchooser.po b/library/tkinter.colorchooser.po index 0bbcad6e1..22ad7b8bf 100644 --- a/library/tkinter.colorchooser.po +++ b/library/tkinter.colorchooser.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/tkinter.colorchooser.rst:2 diff --git a/library/tkinter.dnd.po b/library/tkinter.dnd.po index ca2324bfd..b863d2894 100644 --- a/library/tkinter.dnd.po +++ b/library/tkinter.dnd.po @@ -17,10 +17,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/tkinter.dnd.rst:2 @@ -31,11 +31,11 @@ msgstr ":mod:`!tkinter.dnd` --- ドラッグアンドドロップのサポート msgid "**Source code:** :source:`Lib/tkinter/dnd.py`" msgstr "**ソースコード:** :source:`Lib/tkinter/dnd.py`" -#: ../../library/tkinter.dnd.rst:12 msgid "" "This is experimental and due to be deprecated when it is replaced with the " "Tk DND." msgstr "" +"これは実験的な機能で、Tk DND に置き換えられた時点で非推奨になる予定です。" #: ../../library/tkinter.dnd.rst:15 msgid "" @@ -49,9 +49,8 @@ msgid "" "your callback function)." msgstr "" -#: ../../library/tkinter.dnd.rst:23 msgid "Selection of a target object occurs as follows:" -msgstr "" +msgstr "対象オブジェクトは次のように選択されます:" #: ../../library/tkinter.dnd.rst:25 msgid "Top-down search of area under mouse for target widget" @@ -94,21 +93,19 @@ msgid "" "ButtonRelease events on the root of the event widget." msgstr "" -#: ../../library/tkinter.dnd.rst:44 msgid "Cancel the drag-and-drop process." -msgstr "" +msgstr "ドラッグアンドドロップ処理をキャンセルします。" -#: ../../library/tkinter.dnd.rst:48 msgid "Execute end of drag-and-drop functions." -msgstr "" +msgstr "ドラッグアンドドロップの終了処理を行う関数を実行します。" #: ../../library/tkinter.dnd.rst:52 msgid "Inspect area below mouse for target objects while drag is performed." msgstr "" -#: ../../library/tkinter.dnd.rst:56 msgid "Signal end of drag when the release pattern is triggered." msgstr "" +"ボタンを離すイベントのパターンに一致すると、ドラッグの終了を通知します。" #: ../../library/tkinter.dnd.rst:60 msgid "Factory function for drag-and-drop process." @@ -116,4 +113,4 @@ msgstr "" #: ../../library/tkinter.dnd.rst:64 msgid ":ref:`Bindings-and-Events`" -msgstr "" +msgstr ":ref:`Bindings-and-Events`" diff --git a/library/tkinter.font.po b/library/tkinter.font.po index 7250d8a80..6bb5eb4d9 100644 --- a/library/tkinter.font.po +++ b/library/tkinter.font.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/tkinter.font.rst:2 @@ -40,11 +40,9 @@ msgstr "" ":mod:`tkinter.font` モジュールは名前付きフォントを作成、使用するための :" "class:`Font` クラスを提供します。" -#: ../../library/tkinter.font.rst:15 msgid "The different font weights and slants are:" -msgstr "" +msgstr "フォントの太さと傾きには次の種類があります:" -#: ../../library/tkinter.font.rst:24 msgid "" "The :class:`Font` class represents a named font. *Font* instances are given " "unique names and can be specified by their family, size, and style " @@ -52,70 +50,61 @@ msgid "" "as a single object, rather than specifying a font by its attributes with " "each occurrence." msgstr "" +":class:`Font` クラスは名前付きフォントを表します。\n" +"*Font* インスタンスには一意の名前が付き、ファミリー、サイズ、スタイルの設定で" +"指定できます。\n" +"名前付きフォントは、使うたびに属性でフォントを指定する代わりに、1 つのオブ" +"ジェクトとしてフォントを作成して識別する Tk の仕組みです。" -#: ../../library/tkinter.font.rst:30 msgid "arguments:" -msgstr "" +msgstr "引数:" -#: ../../library/tkinter.font.rst:0 msgid "*font* - font specifier tuple (family, size, options)" -msgstr "" +msgstr "*font* - フォントを指定するタプル (family, size, options)" -#: ../../library/tkinter.font.rst:0 msgid "*name* - unique font name" -msgstr "" +msgstr "*name* - フォントの一意の名前" -#: ../../library/tkinter.font.rst:0 msgid "*exists* - self points to existing named font if true" -msgstr "" +msgstr "*exists* - 真なら、``self`` は既存の名前付きフォントを指します。" -#: ../../library/tkinter.font.rst:36 msgid "additional keyword options (ignored if *font* is specified):" -msgstr "" +msgstr "追加のキーワードオプション (*font* を指定した場合は無視されます):" #: ../../library/tkinter.font.rst:0 msgid "*family* - font family i.e. Courier, Times" msgstr "" -#: ../../library/tkinter.font.rst:0 msgid "*size* - font size" -msgstr "" +msgstr "*size* - フォントサイズ" -#: ../../library/tkinter.font.rst:0 msgid "If *size* is positive it is interpreted as size in points." -msgstr "" +msgstr "*size* が正なら、ポイント単位のサイズとして解釈します。" -#: ../../library/tkinter.font.rst:0 msgid "If *size* is a negative number its absolute value is treated" -msgstr "" +msgstr "*size* が負なら、その絶対値を" -#: ../../library/tkinter.font.rst:0 msgid "as size in pixels." -msgstr "" +msgstr "ピクセル単位のサイズとして扱います。" -#: ../../library/tkinter.font.rst:0 msgid "*weight* - font emphasis (NORMAL, BOLD)" -msgstr "" +msgstr "*weight* - フォントの太さ (NORMAL、BOLD)" -#: ../../library/tkinter.font.rst:0 msgid "*slant* - ROMAN, ITALIC" -msgstr "" +msgstr "*slant* - ROMAN、ITALIC" -#: ../../library/tkinter.font.rst:0 msgid "*underline* - font underlining (0 - none, 1 - underline)" -msgstr "" +msgstr "*underline* - フォントの下線 (0 - なし、1 - 下線あり)" -#: ../../library/tkinter.font.rst:0 msgid "*overstrike* - font strikeout (0 - none, 1 - strikeout)" -msgstr "" +msgstr "*overstrike* - フォントの取り消し線 (0 - なし、1 - 取り消し線あり)" #: ../../library/tkinter.font.rst:50 msgid "Return the attributes of the font." msgstr "" -#: ../../library/tkinter.font.rst:54 msgid "Retrieve an attribute of the font." -msgstr "" +msgstr "フォントの属性を取得します。" #: ../../library/tkinter.font.rst:58 msgid "Modify attributes of the font." @@ -156,9 +145,8 @@ msgstr "" msgid "characters of the font that ensures no vertical overlap between lines." msgstr "" -#: ../../library/tkinter.font.rst:84 msgid "*fixed* - 1 if font is fixed-width else 0" -msgstr "" +msgstr "*fixed* - 固定幅フォントなら 1、それ以外は 0" #: ../../library/tkinter.font.rst:88 msgid "Return the different font families." @@ -172,6 +160,5 @@ msgstr "" msgid "Return a :class:`Font` representation of a tk named font." msgstr "" -#: ../../library/tkinter.font.rst:98 msgid "The *root* parameter was added." -msgstr "" +msgstr "*root* 引数が追加されました。" diff --git a/library/tkinter.messagebox.po b/library/tkinter.messagebox.po index 71aec156e..449b4094d 100644 --- a/library/tkinter.messagebox.po +++ b/library/tkinter.messagebox.po @@ -17,10 +17,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/tkinter.messagebox.rst:2 @@ -41,150 +41,166 @@ msgid "" "limited to:" msgstr "" -#: ../../library/tkinter.messagebox.rst:23 msgid "" "Create a message window with an application-specified message, an icon and a " "set of buttons. Each of the buttons in the message window is identified by a " "unique symbolic name (see the *type* options)." msgstr "" +"アプリケーションが指定するメッセージ、アイコン、一組のボタンを持つメッセージ" +"ウィンドウを作成します。\n" +"ウィンドウ内の各ボタンは、一意のシンボル名で識別します (*type* オプションを参" +"照)。" -#: ../../library/tkinter.messagebox.rst:27 msgid "The following options are supported:" -msgstr "" +msgstr "次のオプションをサポートします:" -#: ../../library/tkinter.messagebox.rst:29 msgid "*command*" -msgstr "" +msgstr "*command*" -#: ../../library/tkinter.messagebox.rst:30 msgid "" "Specifies the function to invoke when the user closes the dialog. The name " "of the button clicked by the user to close the dialog is passed as argument. " "This is only available on macOS." msgstr "" +"利用者がダイアログを閉じたときに呼び出す関数を指定します。\n" +"閉じるためにクリックしたボタンの名前を引数として渡します。\n" +"macOS でのみ利用できます。" -#: ../../library/tkinter.messagebox.rst:35 msgid "*default*" -msgstr "" +msgstr "*default*" -#: ../../library/tkinter.messagebox.rst:36 msgid "" "Gives the :ref:`symbolic name ` of the default button " "for this message window (:data:`OK`, :data:`CANCEL`, and so on). If this " "option is not specified, the first button in the dialog will be made the " "default." msgstr "" +"このメッセージウィンドウのデフォルトのボタンの :ref:`シンボル名 ` (:data:`OK`、:data:`CANCEL` など) を指定します。\n" +"このオプションを指定しなければ、ダイアログの最初のボタンがデフォルトになりま" +"す。" -#: ../../library/tkinter.messagebox.rst:41 msgid "*detail*" -msgstr "" +msgstr "*detail*" -#: ../../library/tkinter.messagebox.rst:42 msgid "" "Specifies an auxiliary message to the main message given by the *message* " "option. The message detail will be presented beneath the main message and, " "where supported by the OS, in a less emphasized font than the main message." msgstr "" +"*message* オプションで指定した主メッセージを補足するメッセージを指定しま" +"す。\n" +"この詳細メッセージは主メッセージの下に表示し、OS が対応している場合は主メッ" +"セージより控えめなフォントを使います。" -#: ../../library/tkinter.messagebox.rst:48 msgid "*icon*" -msgstr "" +msgstr "*icon*" -#: ../../library/tkinter.messagebox.rst:49 msgid "" "Specifies an :ref:`icon ` to display. If this option is " "not specified, then the :data:`INFO` icon will be displayed." msgstr "" +"表示する :ref:`アイコン ` を指定します。\n" +"指定しなければ :data:`INFO` アイコンを表示します。" -#: ../../library/tkinter.messagebox.rst:53 msgid "*message*" -msgstr "" +msgstr "*message*" -#: ../../library/tkinter.messagebox.rst:54 msgid "" "Specifies the message to display in this message box. The default value is " "an empty string." msgstr "" +"このメッセージボックスに表示するメッセージを指定します。\n" +"デフォルト値は空文字列です。" -#: ../../library/tkinter.messagebox.rst:57 msgid "*parent*" -msgstr "" +msgstr "*parent*" -#: ../../library/tkinter.messagebox.rst:58 msgid "" "Makes the specified window the logical parent of the message box. The " "message box is displayed on top of its parent window." msgstr "" +"指定したウィンドウを、メッセージボックスの論理的な親にします。\n" +"メッセージボックスは親ウィンドウの手前に表示されます。" -#: ../../library/tkinter.messagebox.rst:61 msgid "*title*" -msgstr "" +msgstr "*title*" -#: ../../library/tkinter.messagebox.rst:62 msgid "" "Specifies a string to display as the title of the message box. This option " "is ignored on macOS, where platform guidelines forbid the use of a title on " "this kind of dialog." msgstr "" +"メッセージボックスのタイトルとして表示する文字列を指定します。\n" +"macOS では、この種類のダイアログにタイトルを使うことをプラットフォームのガイ" +"ドラインが禁止しているため、このオプションは無視されます。" -#: ../../library/tkinter.messagebox.rst:66 msgid "*type*" -msgstr "" +msgstr "*type*" -#: ../../library/tkinter.messagebox.rst:67 msgid "" "Arranges for a :ref:`predefined set of buttons ` to be " "displayed." msgstr "" +":ref:`定義済みのボタンの組 ` を表示するように指定します。" -#: ../../library/tkinter.messagebox.rst:72 msgid "" "Display a message window and wait for the user to select one of the buttons. " "Then return the symbolic name of the selected button. Keyword arguments can " "override options specified in the constructor." msgstr "" +"メッセージウィンドウを表示し、利用者がボタンを選ぶまで待ちます。\n" +"その後、選んだボタンのシンボル名を返します。\n" +"キーワード引数で、コンストラクタに指定したオプションを上書きできます。" #: ../../library/tkinter.messagebox.rst:76 msgid "**Information message box**" msgstr "**情報メッセージボックス**" -#: ../../library/tkinter.messagebox.rst:80 msgid "" "Creates and displays an information message box with the specified title and " "message." msgstr "" +"指定したタイトルとメッセージを持つ情報メッセージボックスを作成して表示しま" +"す。" #: ../../library/tkinter.messagebox.rst:83 msgid "**Warning message boxes**" msgstr "**警告メッセージボックス**" -#: ../../library/tkinter.messagebox.rst:87 msgid "" "Creates and displays a warning message box with the specified title and " "message." msgstr "" +"指定したタイトルとメッセージを持つ警告メッセージボックスを作成して表示しま" +"す。" -#: ../../library/tkinter.messagebox.rst:92 msgid "" "Creates and displays an error message box with the specified title and " "message." msgstr "" +"指定したタイトルとメッセージを持つエラーメッセージボックスを作成して表示しま" +"す。" #: ../../library/tkinter.messagebox.rst:95 msgid "**Question message boxes**" msgstr "**質問メッセージボックス**" -#: ../../library/tkinter.messagebox.rst:99 msgid "" "Ask a question. By default shows buttons :data:`YES` and :data:`NO`. Returns " "the symbolic name of the selected button." msgstr "" +"質問します。\n" +"デフォルトでは :data:`YES` と :data:`NO` のボタンを表示します。\n" +"選んだボタンのシンボル名を返します。" -#: ../../library/tkinter.messagebox.rst:104 msgid "" "Ask if operation should proceed. Shows buttons :data:`OK` and :data:" "`CANCEL`. Returns ``True`` if the answer is ok and ``False`` otherwise." msgstr "" +"操作を続けるか質問します。\n" +":data:`OK` と :data:`CANCEL` のボタンを表示します。\n" +"OK を選ぶと ``True``、それ以外は ``False`` を返します。" #: ../../library/tkinter.messagebox.rst:109 msgid "" @@ -192,59 +208,61 @@ msgid "" "`CANCEL`. Return ``True`` if the answer is yes and ``False`` otherwise." msgstr "" -#: ../../library/tkinter.messagebox.rst:114 msgid "" "Ask a question. Shows buttons :data:`YES` and :data:`NO`. Returns ``True`` " "if the answer is yes and ``False`` otherwise." msgstr "" +"質問します。\n" +":data:`YES` と :data:`NO` のボタンを表示します。\n" +"「はい」を選ぶと ``True``、それ以外は ``False`` を返します。" -#: ../../library/tkinter.messagebox.rst:119 msgid "" "Ask a question. Shows buttons :data:`YES`, :data:`NO` and :data:`CANCEL`. " "Return ``True`` if the answer is yes, ``None`` if cancelled, and ``False`` " "otherwise." msgstr "" +"質問します。\n" +":data:`YES`、:data:`NO`、:data:`CANCEL` のボタンを表示します。\n" +"「はい」を選ぶと ``True``、キャンセルすると ``None``、それ以外は ``False`` を" +"返します。" -#: ../../library/tkinter.messagebox.rst:126 msgid "Symbolic names of buttons:" -msgstr "" +msgstr "ボタンのシンボル名:" -#: ../../library/tkinter.messagebox.rst:145 msgid "Predefined sets of buttons:" -msgstr "" +msgstr "定義済みのボタンの組:" -#: ../../library/tkinter.messagebox.rst:150 msgid "" "Displays three buttons whose symbolic names are :data:`ABORT`, :data:`RETRY` " "and :data:`IGNORE`." msgstr "" +"シンボル名が :data:`ABORT`、:data:`RETRY`、:data:`IGNORE` の 3 つのボタンを表" +"示します。" -#: ../../library/tkinter.messagebox.rst:157 msgid "Displays one button whose symbolic name is :data:`OK`." -msgstr "" +msgstr "シンボル名が :data:`OK` のボタンを 1 つ表示します。" -#: ../../library/tkinter.messagebox.rst:162 msgid "" "Displays two buttons whose symbolic names are :data:`OK` and :data:`CANCEL`." msgstr "" +"シンボル名が :data:`OK` と :data:`CANCEL` の 2 つのボタンを表示します。" -#: ../../library/tkinter.messagebox.rst:168 msgid "" "Displays two buttons whose symbolic names are :data:`RETRY` and :data:" "`CANCEL`." msgstr "" +"シンボル名が :data:`RETRY` と :data:`CANCEL` の 2 つのボタンを表示します。" -#: ../../library/tkinter.messagebox.rst:174 msgid "" "Displays two buttons whose symbolic names are :data:`YES` and :data:`NO`." -msgstr "" +msgstr "シンボル名が :data:`YES` と :data:`NO` の 2 つのボタンを表示します。" -#: ../../library/tkinter.messagebox.rst:180 msgid "" "Displays three buttons whose symbolic names are :data:`YES`, :data:`NO` and :" "data:`CANCEL`." msgstr "" +"シンボル名が :data:`YES`、:data:`NO`、:data:`CANCEL` の 3 つのボタンを表示し" +"ます。" -#: ../../library/tkinter.messagebox.rst:185 msgid "Icon images:" -msgstr "" +msgstr "アイコン画像:" diff --git a/library/tkinter.po b/library/tkinter.po index d967950f2..acb189b9c 100644 --- a/library/tkinter.po +++ b/library/tkinter.po @@ -19,10 +19,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/tkinter.rst:2 @@ -65,6 +65,10 @@ msgid "" "threaded. See the source code for the :mod:`_tkinter` module for more " "information about supported versions." msgstr "" +"Tcl/Tkにはスレッド(並行処理)に対応しているものとそうでないものがあり、" +"tkinterはどちらのTcl/Tkにも対応しています。公式 Python にはスレッド対応版 " +"Tcl/Tk 8.6 が含まれています。対応バージョンについてさらに知りたい場合は :mod:" +"`_tkinter` モジュールのソースコードを参照してください。" #: ../../library/tkinter.rst:27 msgid "" @@ -73,6 +77,9 @@ msgid "" "these additions and changes, and refer to the official Tcl/Tk documentation " "for details that are unchanged." msgstr "" +"Tkinter は単なるラッパーではなく、Python らしい使用感を実現するための独自の仕" +"組みを備えています。本ドキュメントでは追加・変更された機能を中心に解説し、変" +"更のない部分については Tcl/Tk の公式ドキュメントを参照します。" #: ../../library/tkinter.rst:34 msgid "" @@ -91,6 +98,8 @@ msgid "" "Extensive tutorial on creating user interfaces with Tkinter. Explains key " "concepts, and illustrates recommended approaches using the modern API." msgstr "" +"Tkinterを使ったユーザインタフェースの作成に関する広範なチュートリアルです。主" +"要な概念を説明し、最新のAPI を使用した推奨されるアプローチを説明します。" #: ../../library/tkinter.rst:45 msgid "" @@ -98,64 +107,67 @@ msgid "" msgstr "" "`Tkinter 8.5 reference: a GUI for Python `_" -#: ../../library/tkinter.rst:46 msgid "" "Reference documentation for Tkinter 8.5 detailing available classes, " "methods, and options." msgstr "" +"利用できるクラス、メソッド、オプションを詳しく説明した Tkinter 8.5 のリファレ" +"ンスドキュメントです。" #: ../../library/tkinter.rst:48 msgid "Tcl/Tk Resources:" -msgstr "" +msgstr "Tcl/Tk リソース:" #: ../../library/tkinter.rst:50 msgid "`Tk commands `_" msgstr "`Tk commands `_" -#: ../../library/tkinter.rst:51 msgid "" "Comprehensive reference to each of the underlying Tcl/Tk commands used by " "Tkinter." -msgstr "" +msgstr "Tkinter が内部で使う Tcl/Tk コマンドを網羅したリファレンスです。" #: ../../library/tkinter.rst:53 msgid "`Tcl/Tk Home Page `_" msgstr "`Tcl/Tk ホームページ `_" -#: ../../library/tkinter.rst:54 msgid "Additional documentation, and links to Tcl/Tk core development." -msgstr "" +msgstr "追加のドキュメントと、Tcl/Tk 本体の開発へのリンクがあります。" -#: ../../library/tkinter.rst:56 msgid "Books:" -msgstr "" +msgstr "書籍:" -#: ../../library/tkinter.rst:58 msgid "" "`Modern Tkinter for Busy Python Developers `_" msgstr "" +"`Modern Tkinter for Busy Python Developers `_" -#: ../../library/tkinter.rst:59 msgid "By Mark Roseman. (ISBN 978-1999149567)" msgstr "" +"Mark Roseman 著。\n" +"(ISBN 978-1999149567)" -#: ../../library/tkinter.rst:61 msgid "" "`Python GUI programming with Tkinter `_" msgstr "" +"`Python GUI programming with Tkinter `_" -#: ../../library/tkinter.rst:62 msgid "By Alan D. Moore. (ISBN 978-1788835886)" msgstr "" +"Alan D. Moore 著。\n" +"(ISBN 978-1788835886)" #: ../../library/tkinter.rst:64 msgid "`Programming Python `_" msgstr "`Programming Python `_" -#: ../../library/tkinter.rst:65 msgid "By Mark Lutz; has excellent coverage of Tkinter. (ISBN 978-0596158101)" msgstr "" +"Mark Lutz 著。\n" +"Tkinter について優れた解説があります。\n" +"(ISBN 978-0596158101)" #: ../../library/tkinter.rst:67 msgid "" @@ -165,29 +177,30 @@ msgstr "" "`Tcl and the Tk Toolkit (2nd edition) `_" -#: ../../library/tkinter.rst:68 msgid "" "By John Ousterhout, inventor of Tcl/Tk, and Ken Jones; does not cover " "Tkinter. (ISBN 978-0321336330)" msgstr "" +"Tcl/Tk の考案者 John Ousterhout と Ken Jones の共著。\n" +"Tkinter は扱っていません。\n" +"(ISBN 978-0321336330)" -#: ../../library/tkinter.rst:72 msgid "Architecture" -msgstr "" +msgstr "アーキテクチャ" -#: ../../library/tkinter.rst:74 msgid "" "Tcl/Tk is not a single library but rather consists of a few distinct " "modules, each with separate functionality and its own official " "documentation. Python's binary releases also ship an add-on module together " "with it." msgstr "" +"Tcl/Tk は単一のライブラリではなく、機能の異なる複数のモジュールで構成され、そ" +"れぞれに公式ドキュメントがあります。\n" +"Python のバイナリリリースには、追加のモジュールも一緒に同梱されています。" -#: ../../library/tkinter.rst:79 msgid "Tcl" -msgstr "" +msgstr "Tcl" -#: ../../library/tkinter.rst:80 msgid "" "Tcl is a dynamic interpreted programming language, just like Python. Though " "it can be used on its own as a general-purpose programming language, it is " @@ -200,12 +213,24 @@ msgid "" "designed around cooperative multitasking, and Tkinter bridges this " "difference (see `Threading model`_ for details)." msgstr "" +"Tcl は Python と同様に、インタープリタで実行する動的プログラミング言語で" +"す。\n" +"汎用プログラミング言語として単独でも使えますが、通常はスクリプトエンジンや " +"Tk ツールキットへのインターフェースとして C アプリケーションに組み込まれま" +"す。\n" +"Tcl ライブラリには、Tcl インタープリタのインスタンスを 1 つ以上作成して管理" +"し、そこで Tcl コマンドやスクリプトを実行したり、Tcl や C で実装した独自のコ" +"マンドを追加したりする C インターフェースがあります。\n" +"各インタープリタはイベントキューを持ち、そこにイベントを送り、処理する機能が" +"用意されています。\n" +"Python とは異なり、Tcl の実行モデルは協調的マルチタスクを中心に設計されてお" +"り、Tkinter はこの違いを橋渡しします (詳しくは `Threading model`_ (スレッドモ" +"デル) を参照)。" #: ../../library/tkinter.rst:92 ../../library/tkinter.rst:907 msgid "Tk" msgstr "Tk" -#: ../../library/tkinter.rst:93 msgid "" "Tk is a `Tcl package `_ implemented in C " "that adds custom commands to create and manipulate GUI widgets. Each :class:" @@ -213,18 +238,26 @@ msgid "" "Tk's widgets are very customizable, though at the cost of a dated " "appearance. Tk uses Tcl's event queue to generate and process GUI events." msgstr "" +"Tk は C で実装された `Tcl パッケージ `_ で、" +"GUI ウィジェットを作成・操作する独自のコマンドを追加します。\n" +"各 :class:`Tk` オブジェクトには、Tk を読み込んだ専用の Tcl インタープリタのイ" +"ンスタンスが組み込まれています。\n" +"Tk のウィジェットは外観こそ古めかしいものの、柔軟にカスタマイズできます。\n" +"Tk は Tcl のイベントキューを使って GUI イベントを生成・処理します。" -#: ../../library/tkinter.rst:99 msgid "Ttk" -msgstr "" +msgstr "Ttk" -#: ../../library/tkinter.rst:100 msgid "" "Themed Tk (Ttk) is a newer family of Tk widgets that provide a much better " "appearance on different platforms than many of the classic Tk widgets. Ttk " "is distributed as part of Tk, starting with Tk version 8.5. Python bindings " "are provided in a separate module, :mod:`tkinter.ttk`." msgstr "" +"Themed Tk (Ttk) は新しい Tk ウィジェット群で、多くの従来の Tk ウィジェットよ" +"りも、各プラットフォームに適した優れた外観を提供します。\n" +"Ttk は Tk 8.5 以降、Tk の一部として配布されています。\n" +"Python バインディングは別のモジュール :mod:`tkinter.ttk` で提供されています。" #: ../../library/tkinter.rst:105 msgid "" @@ -253,11 +286,12 @@ msgid "" "module, which provides the modern themed widget set and API::" msgstr "" -#: ../../library/tkinter.rst:123 msgid "" "from tkinter import *\n" "from tkinter import ttk" msgstr "" +"from tkinter import *\n" +"from tkinter import ttk" #: ../../library/tkinter.rst:129 msgid "" @@ -266,65 +300,67 @@ msgid "" "instance has its own associated Tcl interpreter." msgstr "" -#: ../../library/tkinter.rst:133 msgid "" "The :class:`Tk` class is typically instantiated using all default values. " "However, the following keyword arguments are currently recognized:" msgstr "" +":class:`Tk` は通常、すべてデフォルト値でインスタンス化します。\n" +"ただし、現在は次のキーワード引数を受け付けます。" -#: ../../library/tkinter.rst:136 msgid "*screenName*" -msgstr "" +msgstr "*screenName*" -#: ../../library/tkinter.rst:137 msgid "" "When given (as a string), sets the :envvar:`DISPLAY` environment variable. " "(X11 only)" msgstr "" +"文字列を指定すると、:envvar:`DISPLAY` 環境変数を設定します (X11 のみ)。" -#: ../../library/tkinter.rst:139 msgid "*baseName*" -msgstr "" +msgstr "*baseName*" -#: ../../library/tkinter.rst:140 msgid "" "Name of the profile file. By default, *baseName* is derived from the " "program name (``sys.argv[0]``)." msgstr "" +"プロファイルファイルの名前です。\n" +"デフォルトでは、*baseName* はプログラム名 (``sys.argv[0]``) から生成されま" +"す。" -#: ../../library/tkinter.rst:142 msgid "*className*" -msgstr "" +msgstr "*className*" -#: ../../library/tkinter.rst:143 msgid "" "Name of the widget class. Used as a profile file and also as the name with " "which Tcl is invoked (*argv0* in *interp*)." msgstr "" +"ウィジェットクラスの名前です。\n" +"プロファイルファイルの名前と、Tcl を起動する名前 (*interp* 内の *argv0*) とし" +"ても使います。" -#: ../../library/tkinter.rst:145 msgid "*useTk*" -msgstr "" +msgstr "*useTk*" -#: ../../library/tkinter.rst:146 msgid "" "If ``True``, initialize the Tk subsystem. The :func:`tkinter.Tcl() ` " "function sets this to ``False``." msgstr "" +"``True`` の場合は Tk サブシステムを初期化します。\n" +":func:`tkinter.Tcl() ` 関数はこれを ``False`` に設定します。" -#: ../../library/tkinter.rst:148 msgid "*sync*" -msgstr "" +msgstr "*sync*" -#: ../../library/tkinter.rst:149 msgid "" "If ``True``, execute all X server commands synchronously, so that errors are " "reported immediately. Can be used for debugging. (X11 only)" msgstr "" +"``True`` の場合は X サーバーのすべてのコマンドを同期的に実行し、エラーが直ち" +"に報告されるようにします。\n" +"デバッグに使えます (X11 のみ)。" -#: ../../library/tkinter.rst:151 msgid "*use*" -msgstr "" +msgstr "*use*" #: ../../library/tkinter.rst:152 msgid "" @@ -334,13 +370,13 @@ msgid "" "widgets (that is, it has a form like that returned by :meth:`winfo_id`)." msgstr "" -#: ../../library/tkinter.rst:158 msgid "" "Note that on some platforms this will only work correctly if *id* refers to " "a Tk frame or toplevel that has its -container option enabled." msgstr "" +"一部のプラットフォームでは、*id* が -container オプションを有効にした Tk のフ" +"レームまたはトップレベルウィンドウを指す場合にだけ、正しく動作します。" -#: ../../library/tkinter.rst:161 msgid "" ":class:`Tk` reads and interprets profile files, named :file:`.{className}." "tcl` and :file:`.{baseName}.tcl`, into the Tcl interpreter and calls :func:" @@ -348,13 +384,23 @@ msgid "" "py`. The path for the profile files is the :envvar:`HOME` environment " "variable or, if that isn't defined, then :data:`os.curdir`." msgstr "" +":class:`Tk` は :file:`.{className}.tcl` と :file:`.{baseName}.tcl` というプロ" +"ファイルファイルを読み込み、Tcl インタープリタで解釈します。\n" +"また、:file:`.{className}.py` と :file:`.{baseName}.py` の内容に対して :func:" +"`exec` を呼び出します。\n" +"プロファイルファイルの場所は :envvar:`HOME` 環境変数で指定され、未定義なら :" +"data:`os.curdir` です。" -#: ../../library/tkinter.rst:170 msgid "" "The Tk application object created by instantiating :class:`Tk`. This " "provides access to the Tcl interpreter. Each widget that is attached the " "same instance of :class:`Tk` has the same value for its :attr:`tk` attribute." msgstr "" +":class:`Tk` のインスタンス化によって作成される Tk アプリケーションオブジェク" +"トです。\n" +"Tcl インタープリタへのアクセスを提供します。\n" +"同じ :class:`Tk` インスタンスに属するすべてのウィジェットは、:attr:`tk` 属性" +"に同じ値を持ちます。" #: ../../library/tkinter.rst:177 msgid "" @@ -367,11 +413,12 @@ msgid "" "structure." msgstr "" -#: ../../library/tkinter.rst:187 msgid "" "The immediate descendants of this widget as a :class:`dict` with the child " "widget names as the keys and the child instance objects as the values." msgstr "" +"このウィジェットの直接の子を表す :class:`dict` で、子ウィジェットの名前が" +"キー、子のインスタンスオブジェクトが値です。" #: ../../library/tkinter.rst:194 msgid "" @@ -392,17 +439,15 @@ msgstr "" "meth:`loadtk` メソッドを呼び出せば、トップレベルウィンドウを作成 (して、Tk サ" "ブシステムを初期化) します。" -#: ../../library/tkinter.rst:203 msgid "The modules that provide Tk support include:" -msgstr "" +msgstr "Tk をサポートするモジュールには、次のものがあります。" #: ../../library/tkinter.rst:205 msgid ":mod:`tkinter`" -msgstr "" +msgstr ":mod:`tkinter`" -#: ../../library/tkinter.rst:206 msgid "Main Tkinter module." -msgstr "" +msgstr "Tkinter のメインモジュールです。" #: ../../library/tkinter.rst:208 msgid ":mod:`tkinter.colorchooser`" @@ -464,7 +509,7 @@ msgstr "基本的なダイアログと便宜関数 (convenience function) です #: ../../library/tkinter.rst:229 msgid ":mod:`tkinter.ttk`" -msgstr "" +msgstr ":mod:`tkinter.ttk`" #: ../../library/tkinter.rst:230 msgid "" @@ -472,13 +517,12 @@ msgid "" "many of the classic widgets in the main :mod:`tkinter` module." msgstr "" -#: ../../library/tkinter.rst:233 msgid "Additional modules:" -msgstr "" +msgstr "その他のモジュール:" #: ../../library/tkinter.rst:238 msgid ":mod:`_tkinter`" -msgstr "" +msgstr ":mod:`_tkinter`" #: ../../library/tkinter.rst:239 msgid "" @@ -491,7 +535,7 @@ msgstr "" #: ../../library/tkinter.rst:245 msgid ":mod:`idlelib`" -msgstr "" +msgstr ":mod:`idlelib`" #: ../../library/tkinter.rst:246 msgid "" @@ -501,7 +545,7 @@ msgstr "" #: ../../library/tkinter.rst:249 msgid ":mod:`tkinter.constants`" -msgstr "" +msgstr ":mod:`tkinter.constants`" #: ../../library/tkinter.rst:250 msgid "" @@ -532,7 +576,6 @@ msgstr "Tk ウィンドウ上でタートルグラフィックスを実現しま msgid "Tkinter Life Preserver" msgstr "Tkinter お助け手帳" -#: ../../library/tkinter.rst:265 msgid "" "This section is not designed to be an exhaustive tutorial on either Tk or " "Tkinter. For that, refer to one of the external resources noted earlier. " @@ -540,27 +583,34 @@ msgid "" "application looks like, identifies foundational Tk concepts, and explains " "how the Tkinter wrapper is structured." msgstr "" +"この節は Tk や Tkinter の網羅的なチュートリアルではありません。\n" +"チュートリアルについては、前述の外部資料を参照してください。\n" +"ここでは Tkinter アプリケーションの概要を手短に示し、Tk の基本概念と Tkinter " +"ラッパーの構造を説明します。" -#: ../../library/tkinter.rst:271 msgid "" "The remainder of this section will help you to identify the classes, " "methods, and options you'll need in your Tkinter application, and where to " "find more detailed documentation on them, including in the official Tcl/Tk " "reference manual." msgstr "" +"この節の残りの部分では、Tkinter アプリケーションに必要なクラス、メソッド、オ" +"プションを見つける方法と、公式 Tcl/Tk リファレンスマニュアルを含め、それらの" +"詳しいドキュメントを探す場所を説明します。" #: ../../library/tkinter.rst:278 msgid "A Hello World Program" msgstr "" -#: ../../library/tkinter.rst:280 msgid "" "We'll start by walking through a \"Hello World\" application in Tkinter. " "This isn't the smallest one we could write, but has enough to illustrate " "some key concepts you'll need to know." msgstr "" +"まず Tkinter の「Hello World」アプリケーションを見ていきましょう。\n" +"最小限のプログラムではありませんが、知っておくべき重要な概念を説明するのに十" +"分な内容を含んでいます。" -#: ../../library/tkinter.rst:286 msgid "" "from tkinter import *\n" "from tkinter import ttk\n" @@ -571,21 +621,34 @@ msgid "" "ttk.Button(frm, text=\"Quit\", command=root.destroy).grid(column=1, row=0)\n" "root.mainloop()" msgstr "" +"from tkinter import *\n" +"from tkinter import ttk\n" +"root = Tk()\n" +"frm = ttk.Frame(root, padding=10)\n" +"frm.grid()\n" +"ttk.Label(frm, text=\"Hello World!\").grid(column=0, row=0)\n" +"ttk.Button(frm, text=\"Quit\", command=root.destroy).grid(column=1, row=0)\n" +"root.mainloop()" -#: ../../library/tkinter.rst:296 msgid "" "After the imports, the next line creates an instance of the :class:`Tk` " "class, which initializes Tk and creates its associated Tcl interpreter. It " "also creates a toplevel window, known as the root window, which serves as " "the main window of the application." msgstr "" +"インポートの次の行では :class:`Tk` クラスのインスタンスを作成し、Tk を初期化" +"して、対応する Tcl インタープリタを作成します。\n" +"また、ルートウィンドウと呼ばれるトップレベルウィンドウを作成し、これがアプリ" +"ケーションのメインウィンドウになります。" -#: ../../library/tkinter.rst:301 msgid "" "The following line creates a frame widget, which in this case will contain a " "label and a button we'll create next. The frame is fit inside the root " "window." msgstr "" +"続く行ではフレームウィジェットを作成します。\n" +"この例では、次に作成するラベルとボタンをその中に配置します。\n" +"フレームはルートウィンドウ内に収まります。" #: ../../library/tkinter.rst:305 msgid "" @@ -600,103 +663,117 @@ msgid "" "pressed, it will call the :meth:`destroy` method of the root window." msgstr "" -#: ../../library/tkinter.rst:312 msgid "" "Finally, the :meth:`mainloop` method puts everything on the display, and " "responds to user input until the program terminates." msgstr "" +"最後に :meth:`mainloop` メソッドがすべてを画面に表示し、プログラムが終了する" +"までユーザーの入力に応答します。" #: ../../library/tkinter.rst:318 msgid "Important Tk Concepts" msgstr "" -#: ../../library/tkinter.rst:320 msgid "Even this simple program illustrates the following key Tk concepts:" -msgstr "" +msgstr "この簡単なプログラムにも、次の重要な Tk の概念が現れています。" -#: ../../library/tkinter.rst:322 msgid "widgets" -msgstr "" +msgstr "ウィジェット" -#: ../../library/tkinter.rst:323 msgid "" "A Tkinter user interface is made up of individual *widgets*. Each widget is " "represented as a Python object, instantiated from classes like :class:`ttk." "Frame`, :class:`ttk.Label`, and :class:`ttk.Button`." msgstr "" +"Tkinter のユーザーインターフェースは、個々の *ウィジェット* から構成されま" +"す。\n" +"各ウィジェットは :class:`ttk.Frame`、:class:`ttk.Label`、:class:`ttk.Button` " +"などのクラスから作成された Python オブジェクトとして表されます。" -#: ../../library/tkinter.rst:327 msgid "widget hierarchy" -msgstr "" +msgstr "ウィジェットの階層" -#: ../../library/tkinter.rst:328 msgid "" "Widgets are arranged in a *hierarchy*. The label and button were contained " "within a frame, which in turn was contained within the root window. When " "creating each *child* widget, its *parent* widget is passed as the first " "argument to the widget constructor." msgstr "" +"ウィジェットは *階層* をなします。\n" +"ラベルとボタンはフレームの中にあり、そのフレームはルートウィンドウの中にあり" +"ました。\n" +"各 *子* ウィジェットを作成するとき、ウィジェットのコンストラクターの最初の引" +"数として *親* ウィジェットを渡します。" -#: ../../library/tkinter.rst:333 msgid "configuration options" -msgstr "" +msgstr "設定オプション" -#: ../../library/tkinter.rst:334 msgid "" "Widgets have *configuration options*, which modify their appearance and " "behavior, such as the text to display in a label or button. Different " "classes of widgets will have different sets of options." msgstr "" +"ウィジェットには *設定オプション* があり、ラベルやボタンに表示するテキストな" +"ど、外観や動作を変更できます。\n" +"利用できるオプションはウィジェットのクラスによって異なります。" -#: ../../library/tkinter.rst:338 msgid "geometry management" -msgstr "" +msgstr "ジオメトリ管理" -#: ../../library/tkinter.rst:339 msgid "" "Widgets aren't automatically added to the user interface when they are " "created. A *geometry manager* like ``grid`` controls where in the user " "interface they are placed." msgstr "" +"ウィジェットは作成しただけではユーザーインターフェースに追加されません。\n" +"``grid`` などの *ジオメトリマネージャー* が、ユーザーインターフェース内の配置" +"場所を制御します。" -#: ../../library/tkinter.rst:343 msgid "event loop" -msgstr "" +msgstr "イベントループ" -#: ../../library/tkinter.rst:344 msgid "" "Tkinter reacts to user input, changes from your program, and even refreshes " "the display only when actively running an *event loop*. If your program " "isn't running the event loop, your user interface won't update." msgstr "" +"Tkinter がユーザーの入力やプログラムによる変更に応答し、画面を更新するのは、*" +"イベントループ* が実行されているときだけです。\n" +"プログラムがイベントループを実行していなければ、ユーザーインターフェースは更" +"新されません。" #: ../../library/tkinter.rst:350 msgid "Understanding How Tkinter Wraps Tcl/Tk" msgstr "" -#: ../../library/tkinter.rst:352 msgid "" "When your application uses Tkinter's classes and methods, internally Tkinter " "is assembling strings representing Tcl/Tk commands, and executing those " "commands in the Tcl interpreter attached to your application's :class:`Tk` " "instance." msgstr "" +"アプリケーションが Tkinter のクラスやメソッドを使うと、Tkinter は内部で Tcl/" +"Tk コマンドを表す文字列を組み立て、アプリケーションの :class:`Tk` インスタン" +"スに対応する Tcl インタープリタで実行します。" -#: ../../library/tkinter.rst:357 msgid "" "Whether it's trying to navigate reference documentation, trying to find the " "right method or option, adapting some existing code, or debugging your " "Tkinter application, there are times that it will be useful to understand " "what those underlying Tcl/Tk commands look like." msgstr "" +"リファレンスドキュメントを調べるとき、適切なメソッドやオプションを探すとき、" +"既存のコードを応用するとき、Tkinter アプリケーションをデバッグするときなど" +"に、内部の Tcl/Tk コマンドがどのようなものかを理解していると役立つことがあり" +"ます。" -#: ../../library/tkinter.rst:362 msgid "" "To illustrate, here is the Tcl/Tk equivalent of the main part of the Tkinter " "script above." msgstr "" +"例として、前述の Tkinter スクリプトの主要部分に対応する Tcl/Tk コードを示しま" +"す。" -#: ../../library/tkinter.rst:367 msgid "" "ttk::frame .frm -padding 10\n" "grid .frm\n" @@ -704,40 +781,54 @@ msgid "" "grid [ttk::button .frm.btn -text \"Quit\" -command \"destroy .\"] -column 1 -" "row 0" msgstr "" +"ttk::frame .frm -padding 10\n" +"grid .frm\n" +"grid [ttk::label .frm.lbl -text \"Hello World!\"] -column 0 -row 0\n" +"grid [ttk::button .frm.btn -text \"Quit\" -command \"destroy .\"] -column 1 -" +"row 0" -#: ../../library/tkinter.rst:373 msgid "" "Tcl's syntax is similar to many shell languages, where the first word is the " "command to be executed, with arguments to that command following it, " "separated by spaces. Without getting into too many details, notice the " "following:" msgstr "" +"Tcl の構文は多くのシェル言語と似ていて、先頭の単語が実行するコマンド、その後" +"に空白で区切って並べたものがコマンドの引数です。\n" +"詳細に立ち入らず、次の点に注目してください。" -#: ../../library/tkinter.rst:377 msgid "" "The commands used to create widgets (like ``ttk::frame``) correspond to " "widget classes in Tkinter." msgstr "" +"ウィジェットを作成するコマンド (``ttk::frame`` など) は、Tkinter のウィジェッ" +"トクラスに対応します。" -#: ../../library/tkinter.rst:380 msgid "" "Tcl widget options (like ``-text``) correspond to keyword arguments in " "Tkinter." msgstr "" +"Tcl のウィジェットのオプション (``-text`` など) は、Tkinter のキーワード引数" +"に対応します。" -#: ../../library/tkinter.rst:383 msgid "" "Widgets are referred to by a *pathname* in Tcl (like ``.frm.btn``), whereas " "Tkinter doesn't use names but object references." msgstr "" +"Tcl は *パス名* (``.frm.btn`` など) でウィジェットを参照しますが、Tkinter は" +"名前ではなくオブジェクトへの参照を使います。" -#: ../../library/tkinter.rst:386 msgid "" "A widget's place in the widget hierarchy is encoded in its (hierarchical) " "pathname, which uses a ``.`` (dot) as a path separator. The pathname for the " "root window is just ``.`` (dot). In Tkinter, the hierarchy is defined not by " "pathname but by specifying the parent widget when creating each child widget." msgstr "" +"ウィジェットの階層内での位置は、``.`` (ドット) を区切り文字とする (階層的な) " +"パス名で表されます。\n" +"ルートウィンドウのパス名は ``.`` (ドット) だけです。\n" +"Tkinter では、パス名ではなく、子ウィジェットを作成するときに親ウィジェットを" +"指定することで階層を定義します。" #: ../../library/tkinter.rst:392 msgid "" @@ -748,32 +839,38 @@ msgid "" "in Tkinter." msgstr "" -#: ../../library/tkinter.rst:400 msgid "How do I...? What option does...?" -msgstr "" +msgstr "どうすればいい? どのオプションを使う?" -#: ../../library/tkinter.rst:402 msgid "" "If you're not sure how to do something in Tkinter, and you can't immediately " "find it in the tutorial or reference documentation you're using, there are a " "few strategies that can be helpful." msgstr "" +"Tkinter で何かをする方法が分からず、使っているチュートリアルやリファレンスド" +"キュメントでもすぐに見つからない場合は、役立つ探し方がいくつかあります。" -#: ../../library/tkinter.rst:406 msgid "" "First, remember that the details of how individual widgets work may vary " "across different versions of both Tkinter and Tcl/Tk. If you're searching " "documentation, make sure it corresponds to the Python and Tcl/Tk versions " "installed on your system." msgstr "" +"まず、個々のウィジェットの細かな動作は、Tkinter と Tcl/Tk のバージョンによっ" +"て変わることを覚えておいてください。\n" +"ドキュメントを探す際は、システムにインストールされた Python と Tcl/Tk のバー" +"ジョンに対応していることを確認してください。" -#: ../../library/tkinter.rst:411 msgid "" "When searching for how to use an API, it helps to know the exact name of the " "class, option, or method that you're using. Introspection, either in an " "interactive Python shell or with :func:`print`, can help you identify what " "you need." msgstr "" +"API の使い方を調べるときは、使っているクラス、オプション、メソッドの正確な名" +"前が分かると役立ちます。\n" +"Python の対話型シェルや :func:`print` を使ってオブジェクトを調べると、必要な" +"ものを特定できます。" #: ../../library/tkinter.rst:416 msgid "" @@ -783,37 +880,44 @@ msgid "" "values. Use :meth:`keys` to get just the names of each option." msgstr "" -#: ../../library/tkinter.rst:423 msgid "" "btn = ttk.Button(frm, ...)\n" "print(btn.configure().keys())" msgstr "" +"btn = ttk.Button(frm, ...)\n" +"print(btn.configure().keys())" -#: ../../library/tkinter.rst:426 msgid "" "As most widgets have many configuration options in common, it can be useful " "to find out which are specific to a particular widget class. Comparing the " "list of options to that of a simpler widget, like a frame, is one way to do " "that." msgstr "" +"多くのウィジェットは共通の設定オプションを持つため、そのウィジェットクラスに" +"固有のオプションがどれかを調べると役立ちます。\n" +"その方法の一つは、フレームなどの単純なウィジェットとオプションの一覧を比較す" +"ることです。" -#: ../../library/tkinter.rst:433 msgid "print(set(btn.configure().keys()) - set(frm.configure().keys()))" -msgstr "" +msgstr "print(set(btn.configure().keys()) - set(frm.configure().keys()))" -#: ../../library/tkinter.rst:435 msgid "" "Similarly, you can find the available methods for a widget object using the " "standard :func:`dir` function. If you try it, you'll see there are over 200 " "common widget methods, so again identifying those specific to a widget class " "is helpful." msgstr "" +"同様に、ウィジェットオブジェクトで利用できるメソッドは標準の :func:`dir` 関数" +"で調べられます。\n" +"試してみると分かるように、共通のウィジェットメソッドは 200 個以上あるため、こ" +"こでもそのウィジェットクラスに固有のものを特定すると役立ちます。" -#: ../../library/tkinter.rst:442 msgid "" "print(dir(btn))\n" "print(set(dir(btn)) - set(dir(frm)))" msgstr "" +"print(dir(btn))\n" +"print(set(dir(btn)) - set(dir(frm)))" #: ../../library/tkinter.rst:447 msgid "Navigating the Tcl/Tk Reference Manual" @@ -836,25 +940,30 @@ msgid "" "parameters, e.g." msgstr "" -#: ../../library/tkinter.rst:461 msgid "" "destroy .\n" "grid .frm.btn -column 0 -row 0" msgstr "" +"destroy .\n" +"grid .frm.btn -column 0 -row 0" -#: ../../library/tkinter.rst:464 msgid "" "Others, however, look more like methods called on a widget object (in fact, " "when you create a widget in Tcl/Tk, it creates a Tcl command with the name " "of the widget pathname, with the first parameter to that command being the " "name of a method to call)." msgstr "" +"一方、ウィジェットオブジェクトのメソッドを呼び出すような形式のものもあります " +"(実際には、Tcl/Tk でウィジェットを作成すると、そのパス名を名前に持つ Tcl コマ" +"ンドが作成されます。\n" +"このコマンドの最初の引数は、呼び出すメソッドの名前です)。" -#: ../../library/tkinter.rst:471 msgid "" ".frm.btn invoke\n" ".frm.lbl configure -text \"Goodbye\"" msgstr "" +".frm.btn invoke\n" +".frm.lbl configure -text \"Goodbye\"" #: ../../library/tkinter.rst:475 msgid "" @@ -882,7 +991,6 @@ msgid "" "TkCmd/winfo.htm>`_ man page." msgstr "" -#: ../../library/tkinter.rst:494 msgid "" "Somewhat confusingly, there are also methods on all Tkinter widgets that " "don't actually operate on the widget, but operate at a global scope, " @@ -890,10 +998,16 @@ msgid "" "or the system bell. (They happen to be implemented as methods in the base :" "class:`Widget` class that all Tkinter widgets inherit from)." msgstr "" +"少し紛らわしいのですが、Tkinter のすべてのウィジェットには、そのウィジェット" +"を操作するのではなく、どのウィジェットにも依存しないグローバルな操作を行うメ" +"ソッドもあります。\n" +"クリップボードやシステムのベルにアクセスするメソッドがその例です。\n" +"(これらは、Tkinter のすべてのウィジェットが継承する基底クラス :class:" +"`Widget` のメソッドとして実装されています。\n" +")" -#: ../../library/tkinter.rst:503 msgid "Threading model" -msgstr "" +msgstr "スレッドモデル" #: ../../library/tkinter.rst:505 msgid "" @@ -901,7 +1015,6 @@ msgid "" "tries to bridge. If you use threads, you may need to be aware of this." msgstr "" -#: ../../library/tkinter.rst:508 msgid "" "A Python interpreter may have many threads associated with it. In Tcl, " "multiple threads can be created, but each thread has a separate Tcl " @@ -909,6 +1022,11 @@ msgid "" "one interpreter instance, though each interpreter instance can be used only " "by the one thread that created it." msgstr "" +"Python インタープリタには多くのスレッドを関連付けることができます。\n" +"Tcl でも複数のスレッドを作成できますが、各スレッドには別々の Tcl インタープリ" +"タのインスタンスが対応します。\n" +"スレッドは複数のインタープリタのインスタンスを作成することもできますが、各イ" +"ンスタンスを使えるのはそれを作成したスレッドだけです。" #: ../../library/tkinter.rst:513 msgid "" @@ -940,9 +1058,8 @@ msgid "" "Tcl interpreter will fail." msgstr "" -#: ../../library/tkinter.rst:533 msgid "A number of special cases exist:" -msgstr "" +msgstr "例外的な場合がいくつかあります。" #: ../../library/tkinter.rst:535 msgid "" @@ -962,13 +1079,18 @@ msgid "" "running a thread-aware Tcl/Tk build." msgstr "" -#: ../../library/tkinter.rst:546 msgid "" "Blocking event handlers are not the only way to prevent the Tcl interpreter " "from reentering the event loop. It is even possible to run multiple nested " "event loops or abandon the event loop entirely. If you're doing anything " "tricky when it comes to events or threads, be aware of these possibilities." msgstr "" +"Tcl インタープリタがイベントループに戻れなくなる原因は、ブロックするイベント" +"ハンドラーだけではありません。\n" +"複数のイベントループを入れ子で実行したり、イベントループを完全に抜けたりする" +"ことも可能です。\n" +"イベントやスレッドについて込み入った処理をする場合は、こうした可能性を考慮し" +"てください。" #: ../../library/tkinter.rst:551 msgid "" @@ -996,19 +1118,19 @@ msgstr "" msgid "At object creation time, using keyword arguments" msgstr "オブジェクト生成時、キーワード引数を使用する" -#: ../../library/tkinter.rst:570 msgid "fred = Button(self, fg=\"red\", bg=\"blue\")" -msgstr "" +msgstr "fred = Button(self, fg=\"red\", bg=\"blue\")" #: ../../library/tkinter.rst:572 msgid "After object creation, treating the option name like a dictionary index" msgstr "オブジェクト生成後、オプション名を辞書インデックスのように扱う" -#: ../../library/tkinter.rst:575 msgid "" "fred[\"fg\"] = \"red\"\n" "fred[\"bg\"] = \"blue\"" msgstr "" +"fred[\"fg\"] = \"red\"\n" +"fred[\"bg\"] = \"blue\"" #: ../../library/tkinter.rst:578 msgid "" @@ -1016,9 +1138,8 @@ msgid "" "creation" msgstr "オブジェクト生成後に、config()メソッドを使って複数の属性を更新する" -#: ../../library/tkinter.rst:581 msgid "fred.config(fg=\"red\", bg=\"blue\")" -msgstr "" +msgstr "fred.config(fg=\"red\", bg=\"blue\")" #: ../../library/tkinter.rst:583 msgid "" @@ -1156,11 +1277,12 @@ msgstr "``'groove'``" msgid "Example::" msgstr "以下はプログラム例です::" -#: ../../library/tkinter.rst:626 msgid "" ">>> print(fred.config())\n" "{'relief': ('relief', 'relief', 'Relief', 'raised', 'groove')}" msgstr "" +">>> print(fred.config())\n" +"{'relief': ('relief', 'relief', 'Relief', 'raised', 'groove')}" #: ../../library/tkinter.rst:629 msgid "" @@ -1488,7 +1610,7 @@ msgstr "" #: ../../library/tkinter.rst:802 msgid "boolean" -msgstr "boolean" +msgstr "ブール値" #: ../../library/tkinter.rst:803 msgid "You can pass integers 0 or 1 or the strings ``\"yes\"`` or ``\"no\"``." @@ -1504,12 +1626,14 @@ msgstr "callback" msgid "This is any Python function that takes no arguments. For example::" msgstr "これは引数を取らない Python 関数ならどれでも構いません。例えば::" -#: ../../library/tkinter.rst:808 msgid "" "def print_it():\n" " print(\"hi there\")\n" "fred[\"command\"] = print_it" msgstr "" +"def print_it():\n" +" print(\"hi there\")\n" +"fred[\"command\"] = print_it" #: ../../library/tkinter.rst:812 msgid "color" @@ -1630,13 +1754,12 @@ msgstr "" msgid "scrollcommand" msgstr "scrollcommand" -#: ../../library/tkinter.rst:855 msgid "" "This is almost always the :meth:`!set` method of some scrollbar widget, but " "can be any widget method that takes a single argument." msgstr "" "これはほとんどの場合スクロールバーウィジェットの :meth:`!set` メソッドです" -"が、1 個の引数を取るあらゆるウィジェットにもなりえます。" +"が、1 個の引数を取る任意のウィジェットのメソッドも指定できます。" #: ../../library/tkinter.rst:858 msgid "wrap" @@ -1662,9 +1785,8 @@ msgstr "" "そのイベント型が起きたときにコールバック関数を呼び出すことができるようになり" "ます。 bind メソッドの形式は::" -#: ../../library/tkinter.rst:874 msgid "def bind(self, sequence, func, add=''):" -msgstr "" +msgstr "def bind(self, sequence, func, add=''):" #: ../../library/tkinter.rst:876 msgid "where:" @@ -1711,13 +1833,16 @@ msgstr "" "ます。 ``'+'`` を使う仕方は、この関数がこのイベント型にバインドされる関数のリ" "ストに追加されることを意味しています。" -#: ../../library/tkinter.rst:896 msgid "" "def turn_red(self, event):\n" " event.widget[\"activeforeground\"] = \"red\"\n" "\n" "self.button.bind(\"\", self.turn_red)" msgstr "" +"def turn_red(self, event):\n" +" event.widget[\"activeforeground\"] = \"red\"\n" +"\n" +"self.button.bind(\"\", self.turn_red)" #: ../../library/tkinter.rst:901 msgid "" @@ -1757,9 +1882,8 @@ msgstr "char" msgid "%h" msgstr "%h" -#: ../../library/tkinter.rst:911 msgid "height" -msgstr "高さ" +msgstr "``height``" #: ../../library/tkinter.rst:911 msgid "%E" @@ -1821,9 +1945,8 @@ msgstr "type" msgid "%w" msgstr "%w" -#: ../../library/tkinter.rst:919 msgid "width" -msgstr "幅" +msgstr "``width``" #: ../../library/tkinter.rst:919 msgid "%W" @@ -1920,11 +2043,10 @@ msgstr "" "す。メニューインデックスはオプションまたはパラメータのために必要とされるとき" "はいつでも、以下のものを渡すことができます:" -#: ../../library/tkinter.rst:947 msgid "" "an integer which refers to the numeric position of the entry in the widget, " "counted from the top, starting with 0;" -msgstr "ウィジェット内の数字の先頭からの位置を指す整数。先頭は 0。" +msgstr "ウィジェット内の項目の位置を、上から 0 を起点に数えた整数。" #: ../../library/tkinter.rst:950 msgid "" @@ -1944,16 +2066,15 @@ msgstr "" "``@6`` のような ``@`` が前に来る整数。ここでは、整数がメニューの座標系におけ" "る y ピクセル座標として解釈されます。" -#: ../../library/tkinter.rst:958 msgid "" "the string ``\"none\"``, which indicates no menu entry at all, most often " "used with menu.activate() to deactivate all entries, and finally," msgstr "" -"文字列 ``\"none\"``。どんなメニューエントリもまったく指しておらず、ほとんどの" -"場合、すべてのエントリの動作を停止させるために menu.activate() と一緒に使われ" -"ます。そして、最後に、" +"文字列 ``\"none\"`` は、どのメニュー項目も指さないことを示します。\n" +"通常、すべての項目のアクティブ状態を解除するために ``menu.activate()`` ととも" +"に使用します。\n" +"最後に、" -#: ../../library/tkinter.rst:961 msgid "" "a text string that is pattern matched against the label of the menu entry, " "as scanned from the top of the menu to the bottom. Note that this index " @@ -1961,11 +2082,11 @@ msgid "" "items labelled ``last``, ``active``, or ``none`` may be interpreted as the " "above literals, instead." msgstr "" -"メニューの先頭から一番下までスキャンしたときに、メニューエントリのラベルに一" -"致したパターンであるテキスト文字列。このインデックス型は他すべての後に考慮さ" -"れることに注意してください。その代わりに、それは ``last`` 、 ``active`` また" -"は ``none`` とラベル付けされたメニュー項目への一致は上のリテラルとして解釈さ" -"れることを意味します。" +"メニューの上から下へ順に、項目のラベルとのパターンマッチングに使うテキスト文" +"字列。\n" +"このインデックス形式は、他のすべての形式を調べた後に考慮されます。\n" +"そのため、``last``、``active``、``none`` というラベルを持つ項目を指定するつも" +"りでも、代わりに前述の特別な値として解釈されることがあります。" #: ../../library/tkinter.rst:969 msgid "Images" @@ -1999,7 +2120,6 @@ msgstr "" "画像のどちらの型でも ``file`` または ``data`` オプションを使って作られます " "(その上、他のオプションも利用できます)。" -#: ../../library/tkinter.rst:982 msgid "" "Added the :class:`!PhotoImage` method :meth:`!copy_replace` to copy a region " "from one image to other image, possibly with pixel zooming and/or " @@ -2007,6 +2127,13 @@ msgid "" "meth:`!copy`, :meth:`!zoom` and :meth:`!subsample`. Add *zoom* and " "*subsample* parameters to :class:`!PhotoImage` method :meth:`!copy`." msgstr "" +"画像の一部を別の画像にコピーする :class:`!PhotoImage` の :meth:`!" +"copy_replace` メソッドが追加されました。\n" +"必要に応じてピクセルの拡大や間引きもできます。\n" +":class:`!PhotoImage` の :meth:`!copy`、:meth:`!zoom`、:meth:`!subsample` メ" +"ソッドに *from_coords* 引数が追加されました。\n" +":class:`!PhotoImage` の :meth:`!copy` メソッドに *zoom* と *subsample* 引数が" +"追加されました。" #: ../../library/tkinter.rst:991 msgid "" @@ -2022,11 +2149,12 @@ msgstr "" "Python の参照が削除されたときに、画像データも削除されます。そして、どこで画像" "が使われていようとも、Tk は空の箱を表示します。" -#: ../../library/tkinter.rst:999 msgid "" "The `Pillow `_ package adds support for formats " "such as BMP, JPEG, TIFF, and WebP, among others." msgstr "" +"`Pillow `_ パッケージを使うと、BMP、JPEG、TIFF、" +"WebP などの形式もサポートされます。" #: ../../library/tkinter.rst:1005 msgid "File Handlers" @@ -2043,7 +2171,6 @@ msgstr "" "ファイルディスクリプタ1つにつき、1つだけハンドラは登録されます。コード例で" "す::" -#: ../../library/tkinter.rst:1011 msgid "" "import tkinter\n" "widget = tkinter.Tk()\n" @@ -2052,6 +2179,12 @@ msgid "" "...\n" "widget.tk.deletefilehandler(file)" msgstr "" +"import tkinter\n" +"widget = tkinter.Tk()\n" +"mask = tkinter.READABLE | tkinter.WRITABLE\n" +"widget.tk.createfilehandler(file, mask, callback)\n" +"...\n" +"widget.tk.deletefilehandler(file)" #: ../../library/tkinter.rst:1018 msgid "This feature is not available on Windows." @@ -2089,9 +2222,8 @@ msgstr "" "以下にある3つの定数の組み合わせの OR を取ったものです。コールバックは次のよう" "に呼ばれます::" -#: ../../library/tkinter.rst:1037 msgid "callback(file, mask)" -msgstr "" +msgstr "callback(file, mask)" #: ../../library/tkinter.rst:1042 msgid "Unregisters a file handler." diff --git a/library/tkinter.scrolledtext.po b/library/tkinter.scrolledtext.po index ec27c1e44..230498192 100644 --- a/library/tkinter.scrolledtext.po +++ b/library/tkinter.scrolledtext.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/tkinter.scrolledtext.rst:2 diff --git a/library/tkinter.tix.po b/library/tkinter.tix.po index 8c5b5d978..69dd2f03e 100644 --- a/library/tkinter.tix.po +++ b/library/tkinter.tix.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: Arihiro TAKASE, 2023\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/tkinter.tix.rst:2 diff --git a/library/tkinter.ttk.po b/library/tkinter.ttk.po index 9fb005d2d..ae1cc3329 100644 --- a/library/tkinter.ttk.po +++ b/library/tkinter.ttk.po @@ -19,10 +19,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/tkinter.ttk.rst:2 @@ -72,9 +72,8 @@ msgstr "Ttk を使う" msgid "To start using Ttk, import its module::" msgstr "Ttk を使い始めるために、モジュールをインポートします::" -#: ../../library/tkinter.ttk.rst:36 msgid "from tkinter import ttk" -msgstr "" +msgstr "from tkinter import ttk" #: ../../library/tkinter.ttk.rst:38 msgid "" @@ -83,11 +82,12 @@ msgstr "" "基本的な Tk ウィジェットを上書きするため、次のように Tk のインポートに続けて" "インポートを行います::" -#: ../../library/tkinter.ttk.rst:40 msgid "" "from tkinter import *\n" "from tkinter.ttk import *" msgstr "" +"from tkinter import *\n" +"from tkinter.ttk import *" #: ../../library/tkinter.ttk.rst:43 msgid "" @@ -166,17 +166,17 @@ msgstr "" msgid "Tk code::" msgstr "Tk のコード ::" -#: ../../library/tkinter.ttk.rst:80 msgid "" "l1 = tkinter.Label(text=\"Test\", fg=\"black\", bg=\"white\")\n" "l2 = tkinter.Label(text=\"Test\", fg=\"black\", bg=\"white\")" msgstr "" +"l1 = tkinter.Label(text=\"Test\", fg=\"black\", bg=\"white\")\n" +"l2 = tkinter.Label(text=\"Test\", fg=\"black\", bg=\"white\")" #: ../../library/tkinter.ttk.rst:84 msgid "Ttk code::" msgstr "Ttk のコード::" -#: ../../library/tkinter.ttk.rst:86 msgid "" "style = ttk.Style()\n" "style.configure(\"BW.TLabel\", foreground=\"black\", background=\"white\")\n" @@ -184,6 +184,11 @@ msgid "" "l1 = ttk.Label(text=\"Test\", style=\"BW.TLabel\")\n" "l2 = ttk.Label(text=\"Test\", style=\"BW.TLabel\")" msgstr "" +"style = ttk.Style()\n" +"style.configure(\"BW.TLabel\", foreground=\"black\", background=\"white\")\n" +"\n" +"l1 = ttk.Label(text=\"Test\", style=\"BW.TLabel\")\n" +"l2 = ttk.Label(text=\"Test\", style=\"BW.TLabel\")" #: ../../library/tkinter.ttk.rst:92 msgid "" @@ -434,10 +439,8 @@ msgid "none: the default. display the image if present, otherwise the text." msgstr "" "none: デフォルト。もしあれば画像を表示し、そうでなければテキストを表示する。" -#: ../../library/tkinter.ttk.rst:201 ../../library/tkinter.ttk.rst:347 -#: ../../library/tkinter.ttk.rst:491 msgid "width" -msgstr "幅" +msgstr "``width``" #: ../../library/tkinter.ttk.rst:201 msgid "" @@ -694,10 +697,8 @@ msgstr "" "ウィジェットの中でテキストをどう配置するかを指定します。 \"left\", " "\"center\", \"right\" のうちのどれか 1 つです。" -#: ../../library/tkinter.ttk.rst:326 ../../library/tkinter.ttk.rst:481 -#: ../../library/tkinter.ttk.rst:818 msgid "height" -msgstr "高さ" +msgstr "``height``" #: ../../library/tkinter.ttk.rst:326 msgid "Specifies the height of the pop-down listbox, in rows." @@ -788,9 +789,8 @@ msgstr "コンボボックスの現在の値を返します。" msgid "Sets the value of the combobox to *value*." msgstr "コンボボックスの値を *value* に設定します。" -#: ../../library/tkinter.ttk.rst:383 msgid "Spinbox" -msgstr "" +msgstr "スピンボックス" #: ../../library/tkinter.ttk.rst:384 msgid "" @@ -819,90 +819,100 @@ msgstr "" msgid "from" msgstr "from" -#: ../../library/tkinter.ttk.rst:405 msgid "" "Float value. If set, this is the minimum value to which the decrement " "button will decrement. Must be spelled as ``from_`` when used as an " "argument, since ``from`` is a Python keyword." msgstr "" +"浮動小数点数です。\n" +"設定すると、減少ボタンで減らせる最小値になります。\n" +"``from`` は Python のキーワードなので、引数として使う場合は ``from_`` と綴る" +"必要があります。" #: ../../library/tkinter.ttk.rst:410 msgid "to" msgstr "to" -#: ../../library/tkinter.ttk.rst:410 msgid "" "Float value. If set, this is the maximum value to which the increment " "button will increment." msgstr "" +"浮動小数点数です。\n" +"設定すると、増加ボタンで増やせる最大値になります。" -#: ../../library/tkinter.ttk.rst:413 msgid "increment" -msgstr "" +msgstr "increment" -#: ../../library/tkinter.ttk.rst:413 msgid "" "Float value. Specifies the amount which the increment/decrement buttons " "change the value. Defaults to 1.0." msgstr "" +"浮動小数点数です。\n" +"増減ボタンで値をどれだけ変えるかを指定します。\n" +"デフォルトは 1.0 です。" -#: ../../library/tkinter.ttk.rst:417 msgid "" "Sequence of string or float values. If specified, the increment/decrement " "buttons will cycle through the items in this sequence rather than " "incrementing or decrementing numbers." msgstr "" +"文字列または浮動小数点数のシーケンスです。\n" +"指定すると、増減ボタンは数値を増減させる代わりに、このシーケンスの項目を順に" +"切り替えます。" #: ../../library/tkinter.ttk.rst:423 msgid "wrap" msgstr "wrap" -#: ../../library/tkinter.ttk.rst:423 msgid "" "Boolean value. If ``True``, increment and decrement buttons will cycle from " "the ``to`` value to the ``from`` value or the ``from`` value to the ``to`` " "value, respectively." msgstr "" +"真偽値です。\n" +"``True`` なら、増加ボタンでは ``to`` から ``from`` に、減少ボタンでは " +"``from`` から ``to`` に循環します。" #: ../../library/tkinter.ttk.rst:428 msgid "format" msgstr "format" -#: ../../library/tkinter.ttk.rst:428 msgid "" "String value. This specifies the format of numbers set by the increment/" "decrement buttons. It must be in the form \"%W.Pf\", where W is the padded " "width of the value, P is the precision, and '%' and 'f' are literal." msgstr "" +"文字列です。\n" +"増減ボタンで設定する数値の書式を指定します。\n" +"\"%W.Pf\" という形式でなければなりません。\n" +"W は埋め文字を含む値の幅、P は精度で、'%' と 'f' はそのままの文字です。" -#: ../../library/tkinter.ttk.rst:434 msgid "command" -msgstr "" +msgstr "command" -#: ../../library/tkinter.ttk.rst:434 msgid "" "Python callable. Will be called with no arguments whenever either of the " "increment or decrement buttons are pressed." msgstr "" +"Python の呼び出し可能オブジェクトです。\n" +"増加ボタンか減少ボタンを押すたびに、引数なしで呼び出します。" -#: ../../library/tkinter.ttk.rst:444 msgid "" "The spinbox widget generates an **<>** virtual event when the " "user presses , and a **<>** virtual event when the user " "presses ." msgstr "" +"スピンボックスウィジェットは、利用者が を押すと **<>** 仮想イ" +"ベントを、 を押すと **<>** 仮想イベントを生成します。" -#: ../../library/tkinter.ttk.rst:449 msgid "ttk.Spinbox" -msgstr "" +msgstr "ttk.Spinbox" -#: ../../library/tkinter.ttk.rst:455 msgid "Returns the current value of the spinbox." -msgstr "" +msgstr "スピンボックスの現在の値を返します。" -#: ../../library/tkinter.ttk.rst:460 msgid "Sets the value of the spinbox to *value*." -msgstr "" +msgstr "スピンボックスの値を *value* に設定します。" #: ../../library/tkinter.ttk.rst:464 msgid "Notebook" @@ -918,15 +928,14 @@ msgstr "" "表示します。それぞれの子ウィンドウはタブの関連付けられていて、ユーザはそれを" "選択して表示されているウィンドウを切り替えます。" -#: ../../library/tkinter.ttk.rst:481 msgid "" "If present and greater than zero, specifies the desired height of the pane " "area (not including internal padding or tabs). Otherwise, the maximum height " "of all panes is used." msgstr "" "0 より大きな値が設定されている場合、 (内部のパディングやタブを含まない) ペイ" -"ン領域に必要な高さを指定します。設定されていない場合、全てのペインの高さの最" -"大値が使われます。" +"ン領域に必要な高さを指定します。\n" +"それ以外の場合、全てのペインの高さの最大値が使われます。" #: ../../library/tkinter.ttk.rst:485 ../../library/tkinter.ttk.rst:517 #: ../../library/tkinter.ttk.rst:822 @@ -944,15 +953,14 @@ msgstr "" "の長さ指定のリストです: 左、上、右、下の順で指定します。4 個より少ない場合、" "デフォルトで下は上と、右は左と、上は左と同じ値が、それぞれ使われます。" -#: ../../library/tkinter.ttk.rst:491 msgid "" "If present and greater than zero, specified the desired width of the pane " "area (not including internal padding). Otherwise, the maximum width of all " "panes is used." msgstr "" "0 より大きな値が指定されている場合、(内部のパディングを含まない) ペイン領域に" -"必要な幅を指定します。設定されていない場合、全てのペインの幅の最大値が使われ" -"ます。" +"必要な幅を指定します。\n" +"それ以外の場合、全てのペインの幅の最大値が使われます。" #: ../../library/tkinter.ttk.rst:498 msgid "Tab Options" @@ -1117,12 +1125,12 @@ msgstr "" "れていて、その設定も記憶されています。隠れたタブは :meth:`add` コマンドで復元" "できます。" -#: ../../library/tkinter.ttk.rst:590 msgid "" "Returns the name of the tab element at position *x*, *y*, or the empty " "string if none." msgstr "" -"*x* *y* の位置にあるタブの名前を、そこにタブが無ければ空文字列を返します。" +"位置 *x*、*y* にあるタブの構成要素の名前を返します。\n" +"構成要素がなければ空文字列を返します。" #: ../../library/tkinter.ttk.rst:596 msgid "" @@ -1285,17 +1293,17 @@ msgstr "最大値を数値で指定します。デフォルトは 100 です。" msgid "value" msgstr "value" -#: ../../library/tkinter.ttk.rst:681 msgid "" "The current value of the progress bar. In \"determinate\" mode, this " "represents the amount of work completed. In \"indeterminate\" mode, it is " "interpreted as modulo *maximum*; that is, the progress bar completes one " "\"cycle\" when its value increases by *maximum*." msgstr "" -"プログレスバーの現在値です。決定的 (\"determinate\") モードでは、完了した処理" -"の量を表します。非決定的 (\"indeterminate\") モードでは、 *maximum* を法とし" -"て解釈され、値が *maximum* に達したときにプログレスバーは 1 \"サイクル\" を完" -"了したことになります。" +"プログレスバーの現在値です。\n" +"確定 (\"determinate\") モードでは、完了した作業量を表します。\n" +"不確定 (\"indeterminate\") モードでは、*maximum* を法とする剰余として解釈しま" +"す。\n" +"つまり、値が *maximum* だけ増えるとプログレスバーは 1 サイクルを完了します。" #: ../../library/tkinter.ttk.rst:687 msgid "variable" @@ -1416,8 +1424,8 @@ msgid "" "will just mask the widget." msgstr "" "macOS では、最上位のウィンドウにはデフォルトで組み込みのサイズグリップが含ま" -"れています。組み込みのグリップが :class:`Sizegrip` を隠してしまうので、 :" -"class:`Sizegrip` を追加しても問題ありません。" +"れています。組み込みのグリップが :class:`Sizegrip` を隠してしまうので、 " +"``Sizegrip`` を追加しても問題ありません。" #: ../../library/tkinter.ttk.rst:766 msgid "Bugs" @@ -1537,26 +1545,24 @@ msgstr "" msgid "selectmode" msgstr "selectmode" -#: ../../library/tkinter.ttk.rst:825 msgid "" "Controls how the built-in class bindings manage the selection. One of " "\"extended\", \"browse\" or \"none\". If set to \"extended\" (the default), " "multiple items may be selected. If \"browse\", only a single item will be " "selected at a time. If \"none\", the selection will not be changed." msgstr "" -"組み込みのクラスバインディングが選択状態をどう管理するかを指定します。設定す" -"る値は \"extended\", \"browse\", \"none\" のどれか 1 つです。 \"extended\" に" -"設定した場合 (デフォルト)、複数の要素が選択できます。 \"browse\" に設定した場" -"合、同時に 1 つの要素しか選択できません。 \"none\" に設定した場合、選択を変更" -"することはできません。" +"組み込みのクラスバインディングによる選択状態の管理方法を指定します。\n" +"\"extended\"、\"browse\"、\"none\" のいずれかです。\n" +"\"extended\" (デフォルト) では複数の要素を選択できます。\n" +"\"browse\" では一度に 1 つの要素だけを選択します。\n" +"\"none\" では、組み込みのバインディングは選択状態を変更しません。" -#: ../../library/tkinter.ttk.rst:832 msgid "" "Note that the application code and tag bindings can set the selection " "however they wish, regardless of the value of this option." msgstr "" -"このオプションの値によらず、アプリケーションのコードと関連付けられているタグ" -"からは好きなように選択状態を設定できます。" +"このオプションの値にかかわらず、アプリケーションのコードやタグのイベントバイ" +"ンディングからは、選択状態を自由に設定できます。" #: ../../library/tkinter.ttk.rst:836 msgid "show" @@ -1614,16 +1620,16 @@ msgstr "ラベルの左に表示される Tk 画像です。" msgid "The list of values associated with the item." msgstr "要素に関連付けられている値のリストです。" -#: ../../library/tkinter.ttk.rst:867 msgid "" "Each item should have the same number of values as the widget option " "columns. If there are fewer values than columns, the remaining values are " "assumed empty. If there are more values than columns, the extra values are " "ignored." msgstr "" -"それぞれの要素はウィジェットの columns オプションと同じ数の値を持たなければい" -"けません。 columns オプションより少ない場合、残りの値は空として扱われます。 " -"columns オプションより多い場合、余計な値は無視されます。" +"各要素の値の数は、ウィジェットの ``columns`` オプションのカラム数に合わせるこ" +"とを想定しています。\n" +"値の数がカラム数より少なければ、残りは空として扱います。\n" +"多ければ、余分な値は無視します。" #: ../../library/tkinter.ttk.rst:872 msgid "open" @@ -1839,17 +1845,15 @@ msgstr "" msgid "The valid options/values are:" msgstr "設定できるオプションとその値は次の通りです:" -#: ../../library/tkinter.ttk.rst:989 msgid "*id*" -msgstr "" +msgstr "*id*" #: ../../library/tkinter.ttk.rst:990 msgid "Returns the column name. This is a read-only option." msgstr "カラム名を返します。これは読み出し専用のオプションです。" -#: ../../library/tkinter.ttk.rst:991 msgid "*anchor*: One of the standard Tk anchor values." -msgstr "" +msgstr "*anchor*: 標準の Tk アンカー値のいずれか。" #: ../../library/tkinter.ttk.rst:992 msgid "" @@ -1857,9 +1861,8 @@ msgid "" "cell." msgstr "このカラムでセルに対してテキストをどう配置するかを指定します。" -#: ../../library/tkinter.ttk.rst:994 msgid "*minwidth*: width" -msgstr "" +msgstr "*minwidth*: 幅" #: ../../library/tkinter.ttk.rst:995 msgid "" @@ -1871,9 +1874,8 @@ msgstr "" "ウィジェットのサイズが変更されたりカラムをユーザがドラッグして移動させたりし" "たときに、このオプションで指定した幅より狭くすることはありません。" -#: ../../library/tkinter.ttk.rst:998 msgid "*stretch*: ``True``/``False``" -msgstr "" +msgstr "*stretch*: ``True``/``False``" #: ../../library/tkinter.ttk.rst:999 msgid "" @@ -1883,9 +1885,8 @@ msgstr "" "ウィジェットがサイズ変更されたとき、カラムの幅をそれに合わせるかどうかを指定" "します。" -#: ../../library/tkinter.ttk.rst:1001 msgid "*width*: width" -msgstr "" +msgstr "*width*: 幅" #: ../../library/tkinter.ttk.rst:1002 msgid "The width of the column in pixels." @@ -1901,9 +1902,8 @@ msgstr "" msgid "Delete all specified *items* and all their descendants." msgstr "指定された *items* とその子孫たち全てを削除します。" -#: ../../library/tkinter.ttk.rst:1010 msgid "The root item may not be deleted." -msgstr "ルート要素は削除されません。" +msgstr "ルート要素は削除できません。" #: ../../library/tkinter.ttk.rst:1015 msgid "Unlinks all of the specified *items* from the tree." @@ -1917,9 +1917,8 @@ msgstr "" "その要素と子孫たちは依然として存在していて、ツリーの別の場所に再度挿入するこ" "とができますが、隠された状態になり表示はされません。" -#: ../../library/tkinter.ttk.rst:1020 msgid "The root item may not be detached." -msgstr "ルート要素は切り離されません。" +msgstr "ルート要素は切り離せません。" #: ../../library/tkinter.ttk.rst:1025 msgid "Returns ``True`` if the specified *item* is present in the tree." @@ -1950,25 +1949,22 @@ msgstr "" "*option* が指定されている場合は、 *option* の値が返されます。それ以外の場合" "は、オプションに値を設定します。" -#: ../../library/tkinter.ttk.rst:1044 msgid "*text*: text" -msgstr "" +msgstr "*text*: テキスト" #: ../../library/tkinter.ttk.rst:1045 msgid "The text to display in the column heading." msgstr "カラムの見出しに表示するテキスト。" -#: ../../library/tkinter.ttk.rst:1046 msgid "*image*: imageName" -msgstr "" +msgstr "*image*: 画像名" #: ../../library/tkinter.ttk.rst:1047 msgid "Specifies an image to display to the right of the column heading." msgstr "カラムの見出しの右に表示する画像を指定します。" -#: ../../library/tkinter.ttk.rst:1048 msgid "*anchor*: anchor" -msgstr "" +msgstr "*anchor*: アンカー" #: ../../library/tkinter.ttk.rst:1049 msgid "" @@ -1977,9 +1973,8 @@ msgid "" msgstr "" "見出しのテキストをどう配置するかを指定します。標準の Tk anchor の値です。" -#: ../../library/tkinter.ttk.rst:1051 msgid "*command*: callback" -msgstr "" +msgstr "*command*: コールバック" #: ../../library/tkinter.ttk.rst:1052 msgid "A callback to be invoked when the heading label is pressed." @@ -2097,9 +2092,8 @@ msgstr "" "す; *iid* はまだツリーに存在していないものに限ります。それ以外の場合は、一意" "な識別子が生成されます。" -#: ../../library/tkinter.ttk.rst:1121 msgid "See `Item Options`_ for the list of available options." -msgstr "" +msgstr "指定できるオプションの一覧は `Item Options`_ を参照してください。" #: ../../library/tkinter.ttk.rst:1126 msgid "Query or modify the options for the specified *item*." @@ -2162,23 +2156,22 @@ msgstr ":meth:`Treeview.move` のエイリアスです。" msgid "Ensure that *item* is visible." msgstr "*item* を見える状態にします。" -#: ../../library/tkinter.ttk.rst:1171 msgid "" "Sets all of *item*'s ancestors open option to ``True``, and scrolls the " "widget if necessary so that *item* is within the visible portion of the tree." msgstr "" -"*item* の全ての子孫の open オプションを ``True`` にし、必要であれば *item* が" -"ツリーの見える範囲に来るようにウィジェットをスクロールさせます。" +"*item* の全ての祖先の ``open`` オプションを ``True`` にし、必要であれば " +"*item* がツリーの見える範囲に来るようにウィジェットをスクロールさせます。" -#: ../../library/tkinter.ttk.rst:1178 msgid "Returns a tuple of selected items." -msgstr "" +msgstr "選択されている要素をタプルで返します。" -#: ../../library/tkinter.ttk.rst:1180 msgid "" "``selection()`` no longer takes arguments. For changing the selection state " "use the following selection methods." msgstr "" +"``selection()`` は引数を受け取らなくなりました。\n" +"選択状態を変更するには、以下の選択用メソッドを使用してください。" #: ../../library/tkinter.ttk.rst:1187 msgid "*items* becomes the new selection." @@ -2318,7 +2311,6 @@ msgstr "" "例えば、全てのデフォルトのボタンをパディングのある平らな見た目にし、背景の色" "を変更するには以下のようにします::" -#: ../../library/tkinter.ttk.rst:1294 msgid "" "from tkinter import ttk\n" "import tkinter\n" @@ -2333,6 +2325,18 @@ msgid "" "\n" "root.mainloop()" msgstr "" +"from tkinter import ttk\n" +"import tkinter\n" +"\n" +"root = tkinter.Tk()\n" +"\n" +"ttk.Style().configure(\"TButton\", padding=6, relief=\"flat\",\n" +" background=\"#ccc\")\n" +"\n" +"btn = ttk.Button(text=\"Sample\")\n" +"btn.pack()\n" +"\n" +"root.mainloop()" #: ../../library/tkinter.ttk.rst:1310 msgid "Query or sets dynamic values of the specified option(s) in *style*." @@ -2353,7 +2357,6 @@ msgstr "" msgid "An example may make it more understandable::" msgstr "以下のように、例を示す方がわかりやすいでしょう::" -#: ../../library/tkinter.ttk.rst:1319 msgid "" "import tkinter\n" "from tkinter import ttk\n" @@ -2370,6 +2373,20 @@ msgid "" "\n" "root.mainloop()" msgstr "" +"import tkinter\n" +"from tkinter import ttk\n" +"\n" +"root = tkinter.Tk()\n" +"\n" +"style = ttk.Style()\n" +"style.map(\"C.TButton\",\n" +" foreground=[('pressed', 'red'), ('active', 'blue')],\n" +" background=[('pressed', '!disabled', 'black'), ('active', 'white')]\n" +" )\n" +"\n" +"colored_btn = ttk.Button(text=\"Test\", style=\"C.TButton\").pack()\n" +"\n" +"root.mainloop()" #: ../../library/tkinter.ttk.rst:1335 msgid "" @@ -2403,12 +2420,14 @@ msgstr "" "デフォルトでボタンがどのフォントを使うかを調べるには、以下のように実行しま" "す::" -#: ../../library/tkinter.ttk.rst:1351 msgid "" "from tkinter import ttk\n" "\n" "print(ttk.Style().lookup(\"TButton\", \"font\"))" msgstr "" +"from tkinter import ttk\n" +"\n" +"print(ttk.Style().lookup(\"TButton\", \"font\"))" #: ../../library/tkinter.ttk.rst:1358 msgid "" @@ -2430,15 +2449,13 @@ msgstr "" "要素とし、2 番目の要素は `Layouts`_ で説明されているフォーマットである必要が" "あります。" -#: ../../library/tkinter.ttk.rst:1366 msgid "" "To understand the format, see the following example (it is not intended to " "do anything useful)::" msgstr "" -"フォーマットを理解するために以下の例を見てください (何かを使い易くするための" -"例ではありません)::" +"形式を理解するには、以下の例を参照してください。\n" +"この例は実用的な処理を行うためのものではありません。 ::" -#: ../../library/tkinter.ttk.rst:1369 msgid "" "from tkinter import ttk\n" "import tkinter\n" @@ -2462,13 +2479,36 @@ msgid "" "mbtn.pack()\n" "root.mainloop()" msgstr "" +"from tkinter import ttk\n" +"import tkinter\n" +"\n" +"root = tkinter.Tk()\n" +"\n" +"style = ttk.Style()\n" +"style.layout(\"TMenubutton\", [\n" +" (\"Menubutton.background\", None),\n" +" (\"Menubutton.button\", {\"children\":\n" +" [(\"Menubutton.focus\", {\"children\":\n" +" [(\"Menubutton.padding\", {\"children\":\n" +" [(\"Menubutton.label\", {\"side\": \"left\", \"expand\": " +"1})]\n" +" })]\n" +" })]\n" +" }),\n" +"])\n" +"\n" +"mbtn = ttk.Menubutton(text='Text')\n" +"mbtn.pack()\n" +"root.mainloop()" -#: ../../library/tkinter.ttk.rst:1393 msgid "" "Create a new element in the current theme, of the given *etype* which is " "expected to be either \"image\", \"from\" or \"vsapi\". The latter is only " "available in Tk 8.6 on Windows." msgstr "" +"現在のテーマに、指定された *etype* の新しい要素を作成します。\n" +"*etype* は \"image\"、\"from\"、\"vsapi\" のいずれかである必要があります。\n" +"\"vsapi\" は Windows の Tk 8.6 でのみ使用できます。" #: ../../library/tkinter.ttk.rst:1397 msgid "" @@ -2556,7 +2596,6 @@ msgid "" " border=(2, 4), sticky='we')" msgstr "" -#: ../../library/tkinter.ttk.rst:1431 msgid "" "If \"from\" is used as the value of *etype*, :meth:`element_create` will " "clone an existing element. *args* is expected to contain a themename, from " @@ -2564,18 +2603,20 @@ msgid "" "If this element to clone from is not specified, an empty element will be " "used. *kw* is discarded." msgstr "" -"*etype* の値として \"from\" が使われた場合は、 :meth:`element_create` が現在" -"の要素を複製します。 *args* は要素の複製元のテーマの名前と、オプションで複製" -"する要素を含んでいる必要があります。複製元の要素が指定されていなかった場合、" -"空要素が使用され、 *kw* は破棄されます。" +"*etype* に \"from\" を指定すると、:meth:`element_create` は既存の要素を複製し" +"ます。\n" +"*args* には複製元のテーマ名を指定し、必要に応じてその後に複製元の要素を指定し" +"ます。\n" +"複製元の要素を省略すると空の要素が使われます。\n" +"*kw* は破棄されます。" -#: ../../library/tkinter.ttk.rst:1440 msgid "" "style = ttk.Style(root)\n" "style.element_create('plain.background', 'from', 'default')" msgstr "" +"style = ttk.Style(root)\n" +"style.element_create('plain.background', 'from', 'default')" -#: ../../library/tkinter.ttk.rst:1443 msgid "" "If \"vsapi\" is used as the value of *etype*, :meth:`element_create` will " "create a new element in the current theme whose visual appearance is drawn " @@ -2585,8 +2626,16 @@ msgid "" "optional sequence of tuples of ttk states and the corresponding Visual " "Styles API state value. *kw* may have the following options:" msgstr "" +"*etype* に \"vsapi\" を指定すると、:meth:`element_create` は現在のテーマに新" +"しい要素を作成します。\n" +"要素の外観は、Windows XP と Vista のテーマ付きスタイルを担う Microsoft " +"Visual Styles API で描画されます。\n" +"*args* には Microsoft のドキュメントに記載された Visual Styles のクラスとパー" +"ツを指定します。\n" +"その後に、ttk の状態とそれに対応する Visual Styles API の状態値を組にしたタプ" +"ルのシーケンスを指定することもできます。\n" +"*kw* には以下のオプションを指定できます:" -#: ../../library/tkinter.ttk.rst:1454 msgid "" "Specify the element's interior padding. *padding* is a list of up to four " "integers specifying the left, top, right and bottom padding quantities " @@ -2597,31 +2646,45 @@ msgid "" "number specifies the same padding all the way around the widget. This option " "may not be mixed with any other options." msgstr "" +"要素の内部のパディングを指定します。\n" +"*padding* は 4 個以下の整数のリストで、それぞれ左、上、右、下のパディングの量" +"を指定します。\n" +"4 個未満の場合、下は上、右は左、上は左の値がデフォルトになります。\n" +"つまり、3 個の数値なら左・上下・右、2 個なら左右・上下のパディングを指定し、" +"1 個ならウィジェットの周囲すべてに同じパディングを指定します。\n" +"このオプションは他のオプションと併用できません。" -#: ../../library/tkinter.ttk.rst:1465 msgid "margins=padding" -msgstr "" +msgstr "margins=padding" -#: ../../library/tkinter.ttk.rst:1466 msgid "" "Specifies the elements exterior padding. *padding* is a list of up to four " "integers specifying the left, top, right and bottom padding quantities " "respectively. This option may not be mixed with any other options." msgstr "" +"要素の外側のパディングを指定します。\n" +"*padding* は 4 個以下の整数のリストで、それぞれ左、上、右、下のパディングの量" +"を指定します。\n" +"このオプションは他のオプションと併用できません。" -#: ../../library/tkinter.ttk.rst:1472 msgid "" "Specifies the width for the element. If this option is set then the Visual " "Styles API will not be queried for the recommended size or the part. If this " "option is set then *height* should also be set. The *width* and *height* " "options cannot be mixed with the *padding* or *margins* options." msgstr "" +"要素の幅を指定します。\n" +"このオプションを設定すると、パーツの推奨サイズを Visual Styles API に問い合わ" +"せなくなります。\n" +"このオプションを設定する場合は *height* も設定する必要があります。\n" +"*width* と *height* のオプションは、*padding* や *margins* のオプションと併用" +"できません。" -#: ../../library/tkinter.ttk.rst:1480 msgid "Specifies the height of the element. See the comments for *width*." msgstr "" +"要素の高さを指定します。\n" +"*width* の説明を参照してください。" -#: ../../library/tkinter.ttk.rst:1485 msgid "" "style = ttk.Style(root)\n" "style.element_create('pin', 'vsapi', 'EXPLORERBAR', 3, [\n" @@ -2636,10 +2699,21 @@ msgid "" "pin = ttk.Checkbutton(style='Explorer.Pin')\n" "pin.pack(expand=True, fill='both')" msgstr "" +"style = ttk.Style(root)\n" +"style.element_create('pin', 'vsapi', 'EXPLORERBAR', 3, [\n" +" ('pressed', '!selected', 3),\n" +" ('active', '!selected', 2),\n" +" ('pressed', 'selected', 6),\n" +" ('active', 'selected', 5),\n" +" ('selected', 4),\n" +" ('', 1)])\n" +"style.layout('Explorer.Pin',\n" +" [('Explorer.Pin.pin', {'sticky': 'news'})])\n" +"pin = ttk.Checkbutton(style='Explorer.Pin')\n" +"pin.pack(expand=True, fill='both')" -#: ../../library/tkinter.ttk.rst:1498 msgid "Added support of the \"vsapi\" element factory." -msgstr "" +msgstr "\"vsapi\" 要素ファクトリへの対応を追加しました。" #: ../../library/tkinter.ttk.rst:1503 msgid "Returns the list of elements defined in the current theme." @@ -2690,7 +2764,6 @@ msgstr "" msgid "As an example, let's change the Combobox for the default theme a bit::" msgstr "例として、コンボボックスの default テーマを少し変更してみましょう ::" -#: ../../library/tkinter.ttk.rst:1534 msgid "" "from tkinter import ttk\n" "import tkinter\n" @@ -2715,6 +2788,28 @@ msgid "" "\n" "root.mainloop()" msgstr "" +"from tkinter import ttk\n" +"import tkinter\n" +"\n" +"root = tkinter.Tk()\n" +"\n" +"style = ttk.Style()\n" +"style.theme_settings(\"default\", {\n" +" \"TCombobox\": {\n" +" \"configure\": {\"padding\": 5},\n" +" \"map\": {\n" +" \"background\": [(\"active\", \"green2\"),\n" +" (\"!disabled\", \"green4\")],\n" +" \"fieldbackground\": [(\"!disabled\", \"green3\")],\n" +" \"foreground\": [(\"focus\", \"OliveDrab1\"),\n" +" (\"!disabled\", \"OliveDrab2\")]\n" +" }\n" +" }\n" +"})\n" +"\n" +"combo = ttk.Combobox().pack()\n" +"\n" +"root.mainloop()" #: ../../library/tkinter.ttk.rst:1560 msgid "Returns a list of all known themes." @@ -2734,17 +2829,19 @@ msgstr "" msgid "Layouts" msgstr "レイアウト" -#: ../../library/tkinter.ttk.rst:1573 msgid "" "A layout can be just ``None``, if it takes no options, or a dict of options " "specifying how to arrange the element. The layout mechanism uses a " "simplified version of the pack geometry manager: given an initial cavity, " "each element is allocated a parcel." msgstr "" +"レイアウトは、オプションを持たなければ ``None``、持つ場合は要素の配置を指定す" +"るオプションの辞書にできます。\n" +"レイアウトの仕組みは pack ジオメトリマネージャーの簡略版です。\n" +"最初に空間が与えられ、各要素にその一部の領域が割り当てられます。" -#: ../../library/tkinter.ttk.rst:1580 msgid "*side*: whichside" -msgstr "" +msgstr "*side*: 配置する側" #: ../../library/tkinter.ttk.rst:1581 msgid "" @@ -2754,42 +2851,36 @@ msgstr "" "要素を空間のどちら側に配置するかを指定します; top, right, bottom, left のどれ" "か 1 つです。省略された場合は、要素は空間全体を占めます。" -#: ../../library/tkinter.ttk.rst:1585 msgid "*sticky*: nswe" -msgstr "" +msgstr "*sticky*: nswe" #: ../../library/tkinter.ttk.rst:1586 msgid "Specifies where the element is placed inside its allocated parcel." msgstr "配分された空間の内部に要素をどう配置するかを指定します。" -#: ../../library/tkinter.ttk.rst:1588 msgid "*unit*: 0 or 1" -msgstr "" +msgstr "*unit*: 0 または 1" -#: ../../library/tkinter.ttk.rst:1589 msgid "" "If set to 1, causes the element and all of its descendants to be treated as " "a single element for the purposes of :meth:`Widget.identify` et al. It's " "used for things like scrollbar thumbs with grips." msgstr "" -"1 に設定されると、 :meth:`Widget.identify` などには要素とその子で単一の要素と" -"して扱われます。これは、グリップのついたスクロールバーサムのようなものに使わ" -"れます。" +"1 に設定すると、:meth:`Widget.identify` などでは、その要素とすべての子孫を単" +"一の要素として扱います。\n" +"グリップ付きのスクロールバーのつまみなどに使います。" -#: ../../library/tkinter.ttk.rst:1593 msgid "*children*: [sublayout... ]" -msgstr "" +msgstr "*children*: [サブレイアウト... ]" -#: ../../library/tkinter.ttk.rst:1594 msgid "" "Specifies a list of elements to place inside the element. Each element is a " "tuple (or other sequence type) where the first item is the layout name, and " "the other is a `Layout`_." msgstr "" -"要素の内部に配置する要素のリストを指定します。リストのそれぞれの要素はタプル " -"(もしくは他のシーケンス型) で、それの 1 番目の要素はレイアウト名でそれ以降は " -"`Layout`_ です。" +"要素の内部に配置する要素のリストを指定します。\n" +"リスト内の各要素はタプル (または他のシーケンス型) で、1 番目の項目がレイアウ" +"ト名、2 番目の項目が `Layout`_ です。" -#: ../../library/tkinter.ttk.rst:11 msgid "ttk" -msgstr "" +msgstr "ttk" diff --git a/library/token.po b/library/token.po index 121c238c1..6b322aaff 100644 --- a/library/token.po +++ b/library/token.po @@ -19,10 +19,10 @@ msgstr "" "Last-Translator: tomo, 2025\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/token.rst:2 @@ -33,7 +33,6 @@ msgstr ":mod:`!token` --- Python 解析木で使われる定数" msgid "**Source code:** :source:`Lib/token.py`" msgstr "**ソースコード:** :source:`Lib/token.py`" -#: ../../library/token.rst:13 msgid "" "This module provides constants which represent the numeric values of leaf " "nodes of the parse tree (terminal tokens). Refer to the file :file:`Grammar/" @@ -43,8 +42,8 @@ msgid "" msgstr "" "このモジュールは解析木の葉ノード(終端記号)の数値を表す定数を提供します。言語" "の文法のコンテキストにおける名前の定義については、 Python ディストリビュー" -"ションのファイル file:`Grammar/Tokens` を参照してください。名前がマップする特" -"定の数値は Python のバージョン間で変わります。" +"ションのファイル :file:`Grammar/Tokens` を参照してください。名前がマップする" +"特定の数値は Python のバージョン間で変わります。" #: ../../library/token.rst:19 msgid "" @@ -92,9 +91,8 @@ msgid "" "keywords are also initially tokenized an ``NAME`` tokens." msgstr "" -#: ../../library/token.rst:58 msgid "Token value that indicates a :ref:`numeric literal `" -msgstr "" +msgstr ":ref:`数値リテラル ` を示すトークン値です。" #: ../../library/token.rst:62 msgid "" @@ -105,108 +103,119 @@ msgid "" "sequences." msgstr "" -#: ../../library/token.rst:70 msgid "" "A generic token value that indicates an :ref:`operator ` or :ref:" "`delimiter `." msgstr "" +":ref:`演算子 ` または :ref:`区切り文字 ` を示す汎用的" +"なトークン値です。" -#: ../../library/token.rst:75 msgid "" "This value is only reported by the :mod:`tokenize` module. Internally, the " "tokenizer uses :ref:`exact token types ` instead." msgstr "" +"この値を報告するのは :mod:`tokenize` モジュールだけです。\n" +"内部のトークナイザは、代わりに :ref:`個別のトークン型 " +"` を使います。" -#: ../../library/token.rst:81 msgid "" "Token value used to indicate a comment. The parser ignores :data:`!COMMENT` " "tokens." msgstr "" +"コメントを示すトークン値です。\n" +"パーサーは :data:`!COMMENT` トークンを無視します。" -#: ../../library/token.rst:86 msgid "" "Token value that indicates the end of a :ref:`logical line `." -msgstr "" +msgstr ":ref:`論理行 ` の終わりを示すトークン値です。" -#: ../../library/token.rst:90 msgid "" "Token value used to indicate a non-terminating newline. :data:`!NL` tokens " "are generated when a logical line of code is continued over multiple " "physical lines. The parser ignores :data:`!NL` tokens." msgstr "" +"論理行を終わらせない改行を示すトークン値です。\n" +"コードの 1 論理行が複数の物理行に続く場合に :data:`!NL` トークンが生成されま" +"す。\n" +"パーサーは :data:`!NL` トークンを無視します。" -#: ../../library/token.rst:96 msgid "" "Token value used at the beginning of a :ref:`logical line ` " "to indicate the start of an :ref:`indented block `." msgstr "" +":ref:`論理行 ` の先頭で、:ref:`インデントされたブロック " +"` の開始を示すトークン値です。" -#: ../../library/token.rst:101 msgid "" "Token value used at the beginning of a :ref:`logical line ` " "to indicate the end of an :ref:`indented block `." msgstr "" +":ref:`論理行 ` の先頭で、:ref:`インデントされたブロック " +"` の終了を示すトークン値です。" -#: ../../library/token.rst:106 msgid "" "Token value used to indicate the beginning of an :ref:`f-string literal `." -msgstr "" +msgstr ":ref:`f 文字列リテラル ` の開始を示すトークン値です。" -#: ../../library/token.rst:111 ../../library/token.rst:140 msgid "" "The token string includes the prefix and the opening quote(s), but none of " "the contents of the literal." msgstr "" +"トークン文字列は接頭辞と開始の引用符を含みますが、リテラルの内容は含みませ" +"ん。" -#: ../../library/token.rst:116 msgid "" "Token value used for literal text inside an :ref:`f-string literal `, including format specifications." msgstr "" +"書式指定を含む、:ref:`f 文字列リテラル ` 内のリテラル部分に使う" +"トークン値です。" -#: ../../library/token.rst:121 msgid "" "Replacement fields (that is, the non-literal parts of f-strings) use the " "same tokens as other expressions, and are delimited by :data:`LBRACE`, :data:" "`RBRACE`, :data:`EXCLAMATION` and :data:`COLON` tokens." msgstr "" +"置換フィールド (f 文字列のリテラルでない部分) は、ほかの式と同じトークンを使" +"い、:data:`LBRACE`、:data:`RBRACE`、:data:`EXCLAMATION`、:data:`COLON` トーク" +"ンで区切られます。" -#: ../../library/token.rst:128 msgid "Token value used to indicate the end of a :ref:`f-string `." -msgstr "" +msgstr ":ref:`f 文字列 ` の終了を示すトークン値です。" -#: ../../library/token.rst:132 ../../library/token.rst:165 msgid "The token string contains the closing quote(s)." -msgstr "" +msgstr "トークン文字列は終了の引用符を含みます。" -#: ../../library/token.rst:136 msgid "" "Token value used to indicate the beginning of a template string literal." -msgstr "" +msgstr "テンプレート文字列リテラルの開始を示すトークン値です。" -#: ../../library/token.rst:147 msgid "" "Token value used for literal text inside a template string literal including " "format specifications." msgstr "" +"書式指定を含む、テンプレート文字列リテラル内のリテラル部分に使うトークン値で" +"す。" -#: ../../library/token.rst:152 msgid "" "Replacement fields (that is, the non-literal parts of t-strings) use the " "same tokens as other expressions, and are delimited by :data:`LBRACE`, :data:" "`RBRACE`, :data:`EXCLAMATION` and :data:`COLON` tokens." msgstr "" +"置換フィールド (t 文字列のリテラルでない部分) は、ほかの式と同じトークンを使" +"い、:data:`LBRACE`、:data:`RBRACE`、:data:`EXCLAMATION`、:data:`COLON` トーク" +"ンで区切られます。" -#: ../../library/token.rst:161 msgid "Token value used to indicate the end of a template string literal." -msgstr "" +msgstr "テンプレート文字列リテラルの終了を示すトークン値です。" -#: ../../library/token.rst:171 msgid "" "Token value that indicates the end of input. Used in :ref:`top-level grammar " "rules `." msgstr "" +"入力の終わりを示すトークン値です。\n" +":ref:`最上位の文法規則 ` で使います。" #: ../../library/token.rst:176 msgid "" @@ -218,302 +227,266 @@ msgstr "" "トークン値。:func:`tokenize.tokenize` は常に最初に ENCODING トークンを返しま" "す。" -#: ../../library/token.rst:182 msgid "" "This token type isn't used by the C tokenizer but is needed for the :mod:" "`tokenize` module." msgstr "" +"このトークン型は C のトークナイザでは使いませんが、:mod:`tokenize` モジュール" +"に必要です。" -#: ../../library/token.rst:186 msgid "" "The following token types are not produced by the :mod:`tokenize` module, " "and are defined for special uses in the tokenizer or parser:" msgstr "" +"次のトークン型は :mod:`tokenize` モジュールでは生成されず、トークナイザやパー" +"サーでの特別な用途のために定義されています:" -#: ../../library/token.rst:191 msgid "" "Token value indicating that a ``type: ignore`` comment was recognized. Such " "tokens are produced instead of regular :data:`COMMENT` tokens only with the :" "data:`~ast.PyCF_TYPE_COMMENTS` flag." msgstr "" +"``type: ignore`` コメントを認識したことを示すトークン値です。\n" +":data:`~ast.PyCF_TYPE_COMMENTS` フラグが有効な場合にだけ、通常の :data:" +"`COMMENT` トークンの代わりに生成されます。" -#: ../../library/token.rst:197 msgid "" "Token value indicating that a type comment was recognized. Such tokens are " "produced instead of regular :data:`COMMENT` tokens only with the :data:`~ast." "PyCF_TYPE_COMMENTS` flag." msgstr "" +"型コメントを認識したことを示すトークン値です。\n" +":data:`~ast.PyCF_TYPE_COMMENTS` フラグが有効な場合にだけ、通常の :data:" +"`COMMENT` トークンの代わりに生成されます。" -#: ../../library/token.rst:203 msgid "Token value indicating a :ref:`soft keyword `." -msgstr "" +msgstr ":ref:`ソフトキーワード ` を示すトークン値です。" -#: ../../library/token.rst:205 msgid "" "The tokenizer never produces this value. To check for a soft keyword, pass " "a :data:`NAME` token's string to :func:`keyword.issoftkeyword`." msgstr "" +"トークナイザはこの値を生成しません。\n" +"ソフトキーワードかどうかを調べるには、:data:`NAME` トークンの文字列を :func:" +"`keyword.issoftkeyword` に渡してください。" -#: ../../library/token.rst:211 msgid "Token value used to indicate wrong input." -msgstr "" +msgstr "不正な入力を示すトークン値です。" -#: ../../library/token.rst:213 msgid "" "The :mod:`tokenize` module generally indicates errors by raising exceptions " "instead of emitting this token. It can also emit tokens such as :data:`OP` " "or :data:`NAME` with strings that are later rejected by the parser." msgstr "" +":mod:`tokenize` モジュールは通常、このトークンを生成する代わりに例外を送出し" +"てエラーを示します。\n" +"また、後でパーサーに拒否される文字列を持つ :data:`OP` や :data:`NAME` などの" +"トークンを生成することもあります。" -#: ../../library/token.rst:221 msgid "" "The remaining tokens represent specific :ref:`operators ` and :" "ref:`delimiters `. (The :mod:`tokenize` module reports these as :" "data:`OP`; see ``exact_type`` in the :mod:`tokenize` documentation for " "details.)" msgstr "" +"残りのトークンは、個々の :ref:`演算子 ` や :ref:`区切り文字 " +"` を表します。\n" +":mod:`tokenize` モジュールでは、これらを :data:`OP` として報告します。\n" +"詳しくは :mod:`tokenize` のドキュメントの ``exact_type`` を参照してください。" -#: ../../library/token-list.inc:7 msgid "Token" -msgstr "" +msgstr "トークン" #: ../../library/token-list.inc:8 msgid "Value" msgstr "値" -#: ../../library/token-list.inc:10 msgid "``\"(\"``" -msgstr "" +msgstr "``\"(\"``" -#: ../../library/token-list.inc:12 msgid "``\")\"``" -msgstr "" +msgstr "``\")\"``" -#: ../../library/token-list.inc:14 msgid "``\"[\"``" -msgstr "" +msgstr "``\"[\"``" -#: ../../library/token-list.inc:16 msgid "``\"]\"``" -msgstr "" +msgstr "``\"]\"``" -#: ../../library/token-list.inc:18 msgid "``\":\"``" -msgstr "" +msgstr "``\":\"``" -#: ../../library/token-list.inc:20 msgid "``\",\"``" -msgstr "" +msgstr "``\",\"``" -#: ../../library/token-list.inc:22 msgid "``\";\"``" -msgstr "" +msgstr "``\";\"``" -#: ../../library/token-list.inc:24 msgid "``\"+\"``" -msgstr "" +msgstr "``\"+\"``" -#: ../../library/token-list.inc:26 msgid "``\"-\"``" -msgstr "" +msgstr "``\"-\"``" -#: ../../library/token-list.inc:28 msgid "``\"*\"``" -msgstr "" +msgstr "``\"*\"``" -#: ../../library/token-list.inc:30 msgid "``\"/\"``" -msgstr "" +msgstr "``\"/\"``" -#: ../../library/token-list.inc:32 msgid "``\"|\"``" -msgstr "" +msgstr "``\"|\"``" -#: ../../library/token-list.inc:34 msgid "``\"&\"``" -msgstr "" +msgstr "``\"&\"``" -#: ../../library/token-list.inc:36 msgid "``\"<\"``" -msgstr "" +msgstr "``\"<\"``" -#: ../../library/token-list.inc:38 msgid "``\">\"``" -msgstr "" +msgstr "``\">\"``" -#: ../../library/token-list.inc:40 msgid "``\"=\"``" -msgstr "" +msgstr "``\"=\"``" -#: ../../library/token-list.inc:42 msgid "``\".\"``" -msgstr "" +msgstr "``\".\"``" -#: ../../library/token-list.inc:44 msgid "``\"%\"``" -msgstr "" +msgstr "``\"%\"``" -#: ../../library/token-list.inc:46 msgid "``\"{\"``" -msgstr "" +msgstr "``\"{\"``" -#: ../../library/token-list.inc:48 msgid "``\"}\"``" -msgstr "" +msgstr "``\"}\"``" -#: ../../library/token-list.inc:50 msgid "``\"==\"``" -msgstr "" +msgstr "``\"==\"``" -#: ../../library/token-list.inc:52 msgid "``\"!=\"``" -msgstr "" +msgstr "``\"!=\"``" -#: ../../library/token-list.inc:54 msgid "``\"<=\"``" -msgstr "" +msgstr "``\"<=\"``" -#: ../../library/token-list.inc:56 msgid "``\">=\"``" -msgstr "" +msgstr "``\">=\"``" -#: ../../library/token-list.inc:58 msgid "``\"~\"``" -msgstr "" +msgstr "``\"~\"``" -#: ../../library/token-list.inc:60 msgid "``\"^\"``" -msgstr "" +msgstr "``\"^\"``" -#: ../../library/token-list.inc:62 msgid "``\"<<\"``" -msgstr "" +msgstr "``\"<<\"``" -#: ../../library/token-list.inc:64 msgid "``\">>\"``" -msgstr "" +msgstr "``\">>\"``" -#: ../../library/token-list.inc:66 msgid "``\"**\"``" -msgstr "" +msgstr "``\"**\"``" -#: ../../library/token-list.inc:68 msgid "``\"+=\"``" -msgstr "" +msgstr "``\"+=\"``" -#: ../../library/token-list.inc:70 msgid "``\"-=\"``" -msgstr "" +msgstr "``\"-=\"``" -#: ../../library/token-list.inc:72 msgid "``\"*=\"``" -msgstr "" +msgstr "``\"*=\"``" -#: ../../library/token-list.inc:74 msgid "``\"/=\"``" -msgstr "" +msgstr "``\"/=\"``" -#: ../../library/token-list.inc:76 msgid "``\"%=\"``" -msgstr "" +msgstr "``\"%=\"``" -#: ../../library/token-list.inc:78 msgid "``\"&=\"``" -msgstr "" +msgstr "``\"&=\"``" -#: ../../library/token-list.inc:80 msgid "``\"|=\"``" -msgstr "" +msgstr "``\"|=\"``" -#: ../../library/token-list.inc:82 msgid "``\"^=\"``" -msgstr "" +msgstr "``\"^=\"``" -#: ../../library/token-list.inc:84 msgid "``\"<<=\"``" -msgstr "" +msgstr "``\"<<=\"``" -#: ../../library/token-list.inc:86 msgid "``\">>=\"``" -msgstr "" +msgstr "``\">>=\"``" -#: ../../library/token-list.inc:88 msgid "``\"**=\"``" -msgstr "" +msgstr "``\"**=\"``" -#: ../../library/token-list.inc:90 msgid "``\"//\"``" -msgstr "" +msgstr "``\"//\"``" -#: ../../library/token-list.inc:92 msgid "``\"//=\"``" -msgstr "" +msgstr "``\"//=\"``" -#: ../../library/token-list.inc:94 msgid "``\"@\"``" -msgstr "" +msgstr "``\"@\"``" -#: ../../library/token-list.inc:96 msgid "``\"@=\"``" -msgstr "" +msgstr "``\"@=\"``" -#: ../../library/token-list.inc:98 msgid "``\"->\"``" -msgstr "" +msgstr "``\"->\"``" -#: ../../library/token-list.inc:100 msgid "``\"...\"``" -msgstr "" +msgstr "``\"...\"``" -#: ../../library/token-list.inc:102 msgid "``\":=\"``" -msgstr "" +msgstr "``\":=\"``" -#: ../../library/token-list.inc:104 msgid "``\"!\"``" -msgstr "" +msgstr "``\"!\"``" -#: ../../library/token.rst:229 msgid "The following non-token constants are provided:" -msgstr "" +msgstr "トークン以外に、次の定数を提供します:" -#: ../../library/token.rst:233 msgid "The number of token types defined in this module." -msgstr "" +msgstr "このモジュールで定義しているトークン型の数です。" -#: ../../library/token.rst:240 msgid "" "A dictionary mapping the string representation of a token to its numeric " "code." -msgstr "" +msgstr "トークンの文字列表現を数値コードに対応付ける辞書です。" -#: ../../library/token.rst:245 msgid "Added :data:`!AWAIT` and :data:`!ASYNC` tokens." -msgstr "" +msgstr ":data:`!AWAIT` トークンと :data:`!ASYNC` トークンが追加されました。" #: ../../library/token.rst:248 msgid "Added :data:`COMMENT`, :data:`NL` and :data:`ENCODING` tokens." msgstr "" ":data:`COMMENT` 、:data:`NL`、:data:`ENCODING` トークンが追加されました。" -#: ../../library/token.rst:251 msgid "" "Removed :data:`!AWAIT` and :data:`!ASYNC` tokens. \"async\" and \"await\" " "are now tokenized as :data:`NAME` tokens." msgstr "" +":data:`!AWAIT` トークンと :data:`!ASYNC` トークンが削除されました。\n" +"\"async\" と \"await\" は :data:`NAME` トークンとして扱われるようになりまし" +"た。" -#: ../../library/token.rst:255 msgid "" "Added :data:`TYPE_COMMENT`, :data:`TYPE_IGNORE`, :data:`COLONEQUAL`. Added :" "data:`!AWAIT` and :data:`!ASYNC` tokens back (they're needed to support " "parsing older Python versions for :func:`ast.parse` with ``feature_version`` " "set to 6 or lower)." msgstr "" +":data:`TYPE_COMMENT`、:data:`TYPE_IGNORE`、:data:`COLONEQUAL` が追加されまし" +"た。\n" +":data:`!AWAIT` と :data:`!ASYNC` のトークンも再び追加されました (:func:`ast." +"parse` で ``feature_version`` を 6 以下に設定し、古い Python バージョンの構文" +"を解析するために必要です)。" -#: ../../library/token.rst:261 msgid "Added :data:`EXCLAMATION`." -msgstr "" +msgstr ":data:`EXCLAMATION` が追加されました。" -#: ../../library/token.rst:264 msgid "Removed :data:`!AWAIT` and :data:`!ASYNC` tokens again." msgstr "" +":data:`!AWAIT` トークンと :data:`!ASYNC` トークンが再び削除されました。" diff --git a/library/tokenize.po b/library/tokenize.po index c9a9d786e..c72ebecef 100644 --- a/library/tokenize.po +++ b/library/tokenize.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/tokenize.rst:2 @@ -58,7 +58,6 @@ msgstr "" "す。正確な型は :func:`tokenize.tokenize` が返す :term:`named tuple` の " "``exact_type`` プロパティをチェックすれば解ります。" -#: ../../library/tokenize.rst:28 msgid "" "Note that the functions in this module are only designed to parse " "syntactically valid Python code (code that does not raise when parsed using :" @@ -66,6 +65,10 @@ msgid "" "**undefined** when providing invalid Python code and it can change at any " "point." msgstr "" +"このモジュールの関数は、構文的に有効な Python コード (:func:`ast.parse` で解" +"析しても例外を送出しないコード) を解析するためだけに設計されています。\n" +"不正な Python コードを与えた場合の動作は **未定義** であり、いつでも変わる可" +"能性があります。" #: ../../library/tokenize.rst:35 msgid "Tokenizing Input" @@ -132,16 +135,18 @@ msgstr "" ":func:`.tokenize` は :pep:`263` にしたがって、ソースのエンコーディングを " "UTF-8 BOM か encoding cookie を見つけて決定します。" -#: ../../library/tokenize.rst:71 msgid "Tokenize a source reading unicode strings instead of bytes." -msgstr "" +msgstr "バイト列ではなく Unicode 文字列を読み取り、ソースをトークン化します。" -#: ../../library/tokenize.rst:73 msgid "" "Like :func:`.tokenize`, the *readline* argument is a callable returning a " "single line of input. However, :func:`generate_tokens` expects *readline* to " "return a str object rather than bytes." msgstr "" +":func:`.tokenize` と同じく、*readline* 引数は入力を 1 行返す呼び出し可能オブ" +"ジェクトです。\n" +"ただし :func:`generate_tokens` では、*readline* は bytes ではなく str オブ" +"ジェクトを返す必要があります。" #: ../../library/tokenize.rst:77 msgid "" @@ -177,20 +182,25 @@ msgstr "" "の要素、トークンタイプおよびトークン文字列、からなるシーケンスを返さなければ" "いけません。 その他のシーケンスの要素は無視されます。" -#: ../../library/tokenize.rst:94 msgid "" "The result is guaranteed to tokenize back to match the input so that the " "conversion is lossless and round-trips are assured. The guarantee applies " "only to the token type and token string as the spacing between tokens " "(column positions) may change." msgstr "" +"結果を再びトークン化すると入力と一致することが保証されるため、情報を失わずに" +"往復変換できます。\n" +"ただし保証されるのはトークン型とトークン文字列だけで、トークン間の空白 (列位" +"置) は変わることがあります。" -#: ../../library/tokenize.rst:99 msgid "" "It returns bytes, encoded using the :data:`~token.ENCODING` token, which is " "the first token sequence output by :func:`.tokenize`. If there is no " "encoding token in the input, it returns a str instead." msgstr "" +":func:`.tokenize` が最初に出力するトークンである :data:`~token.ENCODING` を" +"使ってエンコードしたバイト列を返します。\n" +"入力にエンコーディングのトークンがなければ、代わりに str を返します。" #: ../../library/tokenize.rst:104 msgid "" @@ -211,13 +221,12 @@ msgstr "" "エンコーディングを検出するために使われます。 :func:`.tokenize` ジェネレータと" "同じ readline を引数として取ります。" -#: ../../library/tokenize.rst:113 msgid "" "It will call readline a maximum of twice, and return the encoding used (as a " "string) and a list of any lines (not decoded from bytes) it has read in." msgstr "" -"readline を最大2回呼び出し、利用するエンコーディング (文字列として) と、読み" -"込んだ行を (bytes からデコードされないままの状態で) 返します。" +"``readline`` を最大 2 回呼び出し、使うエンコーディング (文字列) と、読み込ん" +"だ行のリスト (バイト列からデコードしないまま) を返します。" #: ../../library/tokenize.rst:117 msgid "" @@ -263,22 +272,25 @@ msgstr "" "docstring や複数行にわたることが許される式がファイル内のどこかで終わっていな" "い場合に送出されます。例えば::" -#: ../../library/tokenize.rst:141 msgid "" "\"\"\"Beginning of\n" "docstring" msgstr "" +"\"\"\"docstring の\n" +"始まり" #: ../../library/tokenize.rst:144 msgid "or::" msgstr "もしくは::" -#: ../../library/tokenize.rst:146 msgid "" "[1,\n" " 2,\n" " 3" msgstr "" +"[1,\n" +" 2,\n" +" 3" #: ../../library/tokenize.rst:153 msgid "Command-Line Usage" @@ -292,9 +304,8 @@ msgstr "" ":mod:`tokenize` モジュールはコマンドラインからスクリプトとして実行することが" "できます。次のようにシンプルに利用できます:" -#: ../../library/tokenize.rst:160 msgid "python -m tokenize [-e] [filename.py]" -msgstr "" +msgstr "python -m tokenize [-e] [filename.py]" #: ../../library/tokenize.rst:164 msgid "The following options are accepted:" @@ -375,13 +386,16 @@ msgstr "" msgid "Example of tokenizing from the command line. The script::" msgstr "コマンドラインからトークナイズする例。次のスクリプトが::" -#: ../../library/tokenize.rst:226 msgid "" "def say_hello():\n" " print(\"Hello, World!\")\n" "\n" "say_hello()" msgstr "" +"def say_hello():\n" +" print(\"Hello, World!\")\n" +"\n" +"say_hello()" #: ../../library/tokenize.rst:231 msgid "" @@ -394,7 +408,6 @@ msgstr "" "/カラム、次のカラムはトークンの名前、最後のカラムは (あれば) トークンの値で" "す" -#: ../../library/tokenize.rst:235 msgid "" "$ python -m tokenize hello.py\n" "0,0-0,0: ENCODING 'utf-8'\n" @@ -418,13 +431,33 @@ msgid "" "4,11-4,12: NEWLINE '\\n'\n" "5,0-5,0: ENDMARKER ''" msgstr "" +"$ python -m tokenize hello.py\n" +"0,0-0,0: ENCODING 'utf-8'\n" +"1,0-1,3: NAME 'def'\n" +"1,4-1,13: NAME 'say_hello'\n" +"1,13-1,14: OP '('\n" +"1,14-1,15: OP ')'\n" +"1,15-1,16: OP ':'\n" +"1,16-1,17: NEWLINE '\\n'\n" +"2,0-2,4: INDENT ' '\n" +"2,4-2,9: NAME 'print'\n" +"2,9-2,10: OP '('\n" +"2,10-2,25: STRING '\"Hello, World!\"'\n" +"2,25-2,26: OP ')'\n" +"2,26-2,27: NEWLINE '\\n'\n" +"3,0-3,1: NL '\\n'\n" +"4,0-4,0: DEDENT ''\n" +"4,0-4,9: NAME 'say_hello'\n" +"4,9-4,10: OP '('\n" +"4,10-4,11: OP ')'\n" +"4,11-4,12: NEWLINE '\\n'\n" +"5,0-5,0: ENDMARKER ''" #: ../../library/tokenize.rst:259 msgid "" "The exact token type names can be displayed using the :option:`-e` option:" msgstr "トークンの exact_type 名は :option:`-e` オプションで表示できます:" -#: ../../library/tokenize.rst:261 msgid "" "$ python -m tokenize -e hello.py\n" "0,0-0,0: ENCODING 'utf-8'\n" @@ -448,14 +481,35 @@ msgid "" "4,11-4,12: NEWLINE '\\n'\n" "5,0-5,0: ENDMARKER ''" msgstr "" +"$ python -m tokenize -e hello.py\n" +"0,0-0,0: ENCODING 'utf-8'\n" +"1,0-1,3: NAME 'def'\n" +"1,4-1,13: NAME 'say_hello'\n" +"1,13-1,14: LPAR '('\n" +"1,14-1,15: RPAR ')'\n" +"1,15-1,16: COLON ':'\n" +"1,16-1,17: NEWLINE '\\n'\n" +"2,0-2,4: INDENT ' '\n" +"2,4-2,9: NAME 'print'\n" +"2,9-2,10: LPAR '('\n" +"2,10-2,25: STRING '\"Hello, World!\"'\n" +"2,25-2,26: RPAR ')'\n" +"2,26-2,27: NEWLINE '\\n'\n" +"3,0-3,1: NL '\\n'\n" +"4,0-4,0: DEDENT ''\n" +"4,0-4,9: NAME 'say_hello'\n" +"4,9-4,10: LPAR '('\n" +"4,10-4,11: RPAR ')'\n" +"4,11-4,12: NEWLINE '\\n'\n" +"5,0-5,0: ENDMARKER ''" -#: ../../library/tokenize.rst:285 msgid "" "Example of tokenizing a file programmatically, reading unicode strings " "instead of bytes with :func:`generate_tokens`::" msgstr "" +"バイト列ではなく Unicode 文字列を読み取り、:func:`generate_tokens` でプログラ" +"ムからファイルをトークン化する例です。 ::" -#: ../../library/tokenize.rst:288 msgid "" "import tokenize\n" "\n" @@ -464,12 +518,16 @@ msgid "" " for token in tokens:\n" " print(token)" msgstr "" +"import tokenize\n" +"\n" +"with tokenize.open('hello.py') as f:\n" +" tokens = tokenize.generate_tokens(f.readline)\n" +" for token in tokens:\n" +" print(token)" -#: ../../library/tokenize.rst:295 msgid "Or reading bytes directly with :func:`.tokenize`::" -msgstr "" +msgstr "または、:func:`.tokenize` でバイト列を直接読み取ります。 ::" -#: ../../library/tokenize.rst:297 msgid "" "import tokenize\n" "\n" @@ -478,3 +536,9 @@ msgid "" " for token in tokens:\n" " print(token)" msgstr "" +"import tokenize\n" +"\n" +"with open('hello.py', 'rb') as f:\n" +" tokens = tokenize.tokenize(f.readline)\n" +" for token in tokens:\n" +" print(token)" diff --git a/library/tomllib.po b/library/tomllib.po index 65682cc85..72a5f0dd4 100644 --- a/library/tomllib.po +++ b/library/tomllib.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: tomo, 2025\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/tomllib.rst:2 @@ -38,6 +38,9 @@ msgid "" "Minimal Language, `https://toml.io `_). This module " "does not support writing TOML." msgstr "" +"このモジュールはTOML 1.0.0(Tom's Obvious Minimal Language, `https://toml.io " +"`_)を解析するインターフェースを提供します。このモジュー" +"ルはTOMLの書き出しはサポートしません。" #: ../../library/tomllib.rst:22 msgid "" @@ -116,11 +119,11 @@ msgstr "フォーマットされていないエラーメッセージです。" #: ../../library/tomllib.rst:73 msgid "The TOML document being parsed." -msgstr "" +msgstr "パース対象の TOML ドキュメントです。" #: ../../library/tomllib.rst:77 msgid "The index of *doc* where parsing failed." -msgstr "" +msgstr "*doc* の解析に失敗したインデクスです。" #: ../../library/tomllib.rst:81 msgid "The line corresponding to *pos*." @@ -130,15 +133,16 @@ msgstr "*pos* に対応する行です。" msgid "The column corresponding to *pos*." msgstr "*pos* に対応する列です。" -#: ../../library/tomllib.rst:87 msgid "" "Added the *msg*, *doc* and *pos* parameters. Added the :attr:`msg`, :attr:" "`doc`, :attr:`pos`, :attr:`lineno` and :attr:`colno` attributes." msgstr "" +"*msg*、*doc*、*pos* 引数を追加しました。\n" +":attr:`msg`、:attr:`doc`、:attr:`pos`、:attr:`lineno`、:attr:`colno` 属性を追" +"加しました。" -#: ../../library/tomllib.rst:91 msgid "Passing free-form positional arguments is deprecated." -msgstr "" +msgstr "自由な形式の位置引数を渡すことは非推奨になりました。" #: ../../library/tomllib.rst:96 msgid "Examples" @@ -155,6 +159,10 @@ msgid "" "with open(\"pyproject.toml\", \"rb\") as f:\n" " data = tomllib.load(f)" msgstr "" +"import tomllib\n" +"\n" +"with open(\"pyproject.toml\", \"rb\") as f:\n" +" data = tomllib.load(f)" #: ../../library/tomllib.rst:105 msgid "Parsing a TOML string::" @@ -171,6 +179,14 @@ msgid "" "\n" "data = tomllib.loads(toml_str)" msgstr "" +"import tomllib\n" +"\n" +"toml_str = \"\"\"\n" +"python-version = \"3.11.0\"\n" +"python-implementation = \"CPython\"\n" +"\"\"\"\n" +"\n" +"data = tomllib.loads(toml_str)" #: ../../library/tomllib.rst:118 msgid "Conversion Table" @@ -199,7 +215,7 @@ msgstr "string" #: ../../library/tomllib.rst:127 msgid "str" -msgstr "str" +msgstr "文字列" #: ../../library/tomllib.rst:129 msgid "integer" @@ -215,11 +231,11 @@ msgstr "浮動小数点数" #: ../../library/tomllib.rst:131 msgid "float (configurable with *parse_float*)" -msgstr "float (*parse_float* で設定可能)" +msgstr "浮動小数点数(*parse_float* で設定可能)" #: ../../library/tomllib.rst:133 msgid "boolean" -msgstr "boolean" +msgstr "ブール値" #: ../../library/tomllib.rst:133 msgid "bool" @@ -227,7 +243,7 @@ msgstr "真偽値型(bool)" #: ../../library/tomllib.rst:135 msgid "offset date-time" -msgstr "オフセット付きの日時に日地" +msgstr "オフセット付きの日時" #: ../../library/tomllib.rst:135 msgid "" @@ -263,11 +279,11 @@ msgstr "datetime.time" #: ../../library/tomllib.rst:143 msgid "array" -msgstr "配列" +msgstr "array" #: ../../library/tomllib.rst:143 msgid "list" -msgstr "リスト" +msgstr "list" #: ../../library/tomllib.rst:145 msgid "table" diff --git a/library/trace.po b/library/trace.po index 80bbc7042..6b91fea4a 100644 --- a/library/trace.po +++ b/library/trace.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/trace.rst:2 @@ -68,9 +68,8 @@ msgstr "" ":mod:`trace` モジュールはコマンドラインから起動することができます。これは次の" "ように簡単です ::" -#: ../../library/trace.rst:30 msgid "python -m trace --count -C . somefile.py ..." -msgstr "" +msgstr "python -m trace --count -C . somefile.py ..." #: ../../library/trace.rst:32 msgid "" @@ -225,7 +224,6 @@ msgstr "" msgid "Programmatic Interface" msgstr "プログラミングインターフェース" -#: ../../library/trace.rst:145 msgid "" "Create an object to trace execution of a single statement or expression. " "All parameters are optional. *count* enables counting of line numbers. " @@ -239,14 +237,18 @@ msgid "" "was started to be displayed." msgstr "" "文 (statement) や式 (expression) の実行をトレースするオブジェクトを作成しま" -"す。引数は全てオプションです。*count* は行数を数えます。*trace* は行実行のト" -"レースを行います。*countfuncs* は実行中に呼ばれた関数を列挙します。" -"*countcallers* は呼び出しの関係を追跡します。*ignoremods* は無視するモジュー" -"ルやパッケージのリストです。*ignoredirs* は無視するパッケージやモジュールを含" -"むディレクトリのリストです。*infile* は保存された集計 (count) 情報を読むファ" -"イルの名前です。*outfile* は更新された集計 (count) 情報を書き出すファイルの名" -"前です。*timing* は、タイムスタンプをトレース開始時点からの相対秒数で表示しま" -"す。" +"す。\n" +"引数は全てオプションです。\n" +"*count* は各行の実行回数の集計を有効にします。\n" +"*trace* は行実行のトレースを行います。\n" +"*countfuncs* は実行中に呼ばれた関数を列挙します。\n" +"*countcallers* は呼び出しの関係を追跡します。\n" +"*ignoremods* は無視するモジュールやパッケージのリストです。\n" +"*ignoredirs* は無視するパッケージやモジュールを含むディレクトリのリストで" +"す。\n" +"*infile* は保存された集計 (count) 情報を読むファイルの名前です。\n" +"*outfile* は更新された集計 (count) 情報を書き出すファイルの名前です。\n" +"*timing* は、タイムスタンプをトレース開始時点からの相対秒数で表示します。" #: ../../library/trace.rst:158 msgid "" @@ -268,13 +270,12 @@ msgstr "" "メータに基づいてその実行から統計情報を集めます。定義しない場合、*globals* と " "*locals* はデフォルトで空の辞書となります。" -#: ../../library/trace.rst:171 msgid "" "Call *func* with the given arguments under control of the :class:`Trace` " "object with the current tracing parameters." msgstr "" -"与えられた引数の *func* を、 :class:`Trace` オブジェクトのコントロール下で現" -"在のトレースパラメタのもとに呼び出します。" +"指定された引数を渡して *func* を呼び出します。\n" +":class:`Trace` オブジェクトの制御下で、現在のトレース設定を使います。" #: ../../library/trace.rst:176 msgid "" @@ -330,7 +331,6 @@ msgstr "*ignore_missing_files* 引数が追加されました。" msgid "A simple example demonstrating the use of the programmatic interface::" msgstr "簡単な例でプログラミングインターフェースの使い方を見てみましょう::" -#: ../../library/trace.rst:208 msgid "" "import sys\n" "import trace\n" @@ -349,3 +349,20 @@ msgid "" "r = tracer.results()\n" "r.write_results(show_missing=True, coverdir=\".\")" msgstr "" +"import sys\n" +"import trace\n" +"\n" +"# Trace オブジェクトを作成し、無視する対象と、トレース・行の実行回数の集計" +"の\n" +"# どちらか、または両方を行うかを指定する\n" +"tracer = trace.Trace(\n" +" ignoredirs=[sys.prefix, sys.exec_prefix],\n" +" trace=0,\n" +" count=1)\n" +"\n" +"# 指定したトレーサを使って新しいコマンドを実行する\n" +"tracer.run('main()')\n" +"\n" +"# レポートを作成し、カレントディレクトリに出力する\n" +"r = tracer.results()\n" +"r.write_results(show_missing=True, coverdir=\".\")" diff --git a/library/traceback.po b/library/traceback.po index cbc3756d7..fc50532cd 100644 --- a/library/traceback.po +++ b/library/traceback.po @@ -20,10 +20,10 @@ msgstr "" "Last-Translator: tomo, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/traceback.rst:2 @@ -34,7 +34,6 @@ msgstr ":mod:`!traceback` --- スタックトレースの表示または取得" msgid "**Source code:** :source:`Lib/traceback.py`" msgstr "**ソースコード:** :source:`Lib/traceback.py`" -#: ../../library/traceback.rst:11 msgid "" "This module provides a standard interface to extract, format and print stack " "traces of Python programs. It is more flexible than the interpreter's " @@ -45,44 +44,55 @@ msgid "" "of large objects graph, this utility can significantly improve memory " "management." msgstr "" +"このモジュールは、Python プログラムのスタックトレースを抽出、書式化、表示する" +"標準的なインターフェースを提供します。\n" +"インタープリタのデフォルトのトレースバック表示より柔軟で、出力の一部をカスタ" +"マイズできます。\n" +"また、実際の例外への参照を保存せずに、後で表示するために十分な情報を取得する" +"ユーティリティもあります。\n" +"例外は、多数のオブジェクトが参照でつながった構造の起点になることがあるため、" +"このユーティリティを使うとメモリ管理を大幅に改善できます。" -#: ../../library/traceback.rst:23 msgid "" "The module uses :ref:`traceback objects ` --- these are " "objects of type :class:`types.TracebackType`, which are assigned to the :" "attr:`~BaseException.__traceback__` field of :class:`BaseException` " "instances." msgstr "" +"このモジュールは :ref:`トレースバックオブジェクト ` を使い" +"ます。\n" +"これは :class:`types.TracebackType` 型のオブジェクトで、:class:" +"`BaseException` インスタンスの :attr:`~BaseException.__traceback__` フィール" +"ドに代入されます。" #: ../../library/traceback.rst:30 msgid "Module :mod:`faulthandler`" msgstr ":mod:`faulthandler` モジュール" -#: ../../library/traceback.rst:31 msgid "" "Used to dump Python tracebacks explicitly, on a fault, after a timeout, or " "on a user signal." msgstr "" +"明示的な呼び出し時、障害発生時、タイムアウト後、またはユーザーシグナルの受信" +"時に、Python のトレースバックを出力するために使います。" #: ../../library/traceback.rst:33 msgid "Module :mod:`pdb`" -msgstr "" +msgstr ":mod:`pdb` モジュール" -#: ../../library/traceback.rst:34 msgid "Interactive source code debugger for Python programs." -msgstr "" +msgstr "Python プログラム用の対話的なソースコードデバッガです。" -#: ../../library/traceback.rst:36 msgid "The module's API can be divided into two parts:" -msgstr "" +msgstr "モジュールの API は 2 つに分けられます。" -#: ../../library/traceback.rst:38 msgid "" "Module-level functions offering basic functionality, which are useful for " "interactive inspection of exceptions and tracebacks." msgstr "" +"基本的な機能を提供するモジュールレベルの関数。\n" +"例外やトレースバックを対話的に調べるときに便利です。" -#: ../../library/traceback.rst:41 msgid "" ":class:`TracebackException` class and its helper classes :class:" "`StackSummary` and :class:`FrameSummary`. These offer both more flexibility " @@ -90,18 +100,23 @@ msgid "" "for later formatting without holding references to actual exception and " "traceback objects." msgstr "" +":class:`TracebackException` クラスと、それを補助する :class:`StackSummary` お" +"よび :class:`FrameSummary` クラス。\n" +"生成する出力をより柔軟に制御できるほか、実際の例外オブジェクトやトレースバッ" +"クオブジェクトへの参照を保持せずに、後で書式化するために必要な情報を保存でき" +"ます。" -#: ../../library/traceback.rst:47 msgid "" "Output is colorized by default and can be :ref:`controlled using environment " "variables `." msgstr "" +"出力はデフォルトで色付きになり、:ref:`環境変数で制御できます `。" #: ../../library/traceback.rst:53 msgid "Module-Level Functions" msgstr "モジュールレベルの関数" -#: ../../library/traceback.rst:57 msgid "" "Print up to *limit* stack trace entries from :ref:`traceback object " "` *tb* (starting from the caller's frame) if *limit* is " @@ -111,14 +126,25 @@ msgid "" "open :term:`file ` or :term:`file-like object` to receive the " "output." msgstr "" +"*limit* が正の場合、:ref:`トレースバックオブジェクト ` " +"*tb* から、呼び出し元のフレームを先頭に最大 *limit* 個のスタックトレース項目" +"を出力します。\n" +"それ以外の場合は、末尾の ``abs(limit)`` 個の項目を出力します。\n" +"*limit* を省略するか ``None`` を指定すると、すべての項目を出力します。\n" +"*file* を省略するか ``None`` を指定すると、:data:`sys.stderr` に出力しま" +"す。\n" +"それ以外の場合は、出力を受け取る開かれた :term:`ファイル ` また" +"は :term:`file-like object` を指定してください。" -#: ../../library/traceback.rst:68 msgid "" "The meaning of the *limit* parameter is different than the meaning of :const:" "`sys.tracebacklimit`. A negative *limit* value corresponds to a positive " "value of :const:`!sys.tracebacklimit`, whereas the behaviour of a positive " "*limit* value cannot be achieved with :const:`!sys.tracebacklimit`." msgstr "" +"*limit* 引数の意味は :const:`sys.tracebacklimit` とは異なります。\n" +"負の *limit* は正の :const:`!sys.tracebacklimit` に相当しますが、正の " +"*limit* の動作は :const:`!sys.tracebacklimit` では実現できません。" #: ../../library/traceback.rst:74 ../../library/traceback.rst:139 msgid "Added negative *limit* support." @@ -130,6 +156,9 @@ msgid "" "object ` *tb* to *file*. This differs from :func:" "`print_tb` in the following ways:" msgstr "" +":ref:`トレースバックオブジェクト ` *tb* から例外の情報とス" +"タックトレースの項目を *file* に出力します。\n" +"この関数は以下の点で :func:`print_tb` と異なります:" #: ../../library/traceback.rst:86 msgid "" @@ -141,7 +170,7 @@ msgstr "" #: ../../library/traceback.rst:89 msgid "it prints the exception type and *value* after the stack trace" -msgstr "" +msgstr "スタックトレースの後に例外タイプと *value* を出力します" #: ../../library/traceback.rst:93 msgid "" @@ -153,12 +182,14 @@ msgstr "" "ば、そのエラーのおおよその位置を示すマークと共にシンタックスエラーが発生した" "行が表示されます。" -#: ../../library/traceback.rst:97 msgid "" "Since Python 3.10, instead of passing *value* and *tb*, an exception object " "can be passed as the first argument. If *value* and *tb* are provided, the " "first argument is ignored in order to provide backwards compatibility." msgstr "" +"Python 3.10 以降では、*value* と *tb* を渡す代わりに、最初の引数として例外オ" +"ブジェクトを渡せます。\n" +"*value* と *tb* を指定した場合は、後方互換性のために最初の引数を無視します。" #: ../../library/traceback.rst:101 msgid "" @@ -168,21 +199,26 @@ msgid "" "of the exception) will be printed as well, like the interpreter itself does " "when printing an unhandled exception." msgstr "" +"オプション引数 *limit* の意味は :func:`print_tb` のものと同じです。\n" +"*chain* が真の場合 (デフォルト)、連鎖した例外 (例外の :attr:`~BaseException." +"__cause__` か :attr:`~BaseException.__context__` 属性) も出力されます。\n" +"これはインタープリタ自身が処理されていない例外を出力するときと同じです。" #: ../../library/traceback.rst:108 ../../library/traceback.rst:219 msgid "The *etype* argument is ignored and inferred from the type of *value*." msgstr "引数 *etype* は無視され、 *value* の型から推論されます。" -#: ../../library/traceback.rst:111 ../../library/traceback.rst:199 msgid "" "The *etype* parameter has been renamed to *exc* and is now positional-only." -msgstr "" +msgstr "*etype* 引数は *exc* に名前が変わり、位置専用引数になりました。" #: ../../library/traceback.rst:118 msgid "" "This is a shorthand for ``print_exception(sys.exception(), limit=limit, " "file=file, chain=chain)``." msgstr "" +"``print_exception(sys.exception(), limit=limit, file=file, chain=chain)`` の" +"省略表現です。" #: ../../library/traceback.rst:124 msgid "" @@ -190,8 +226,11 @@ msgid "" "file=file, chain=chain)``. In general it will work only after an exception " "has reached an interactive prompt (see :data:`sys.last_exc`)." msgstr "" +"``print_exception(sys.last_exc, limit=limit, file=file, chain=chain)`` の省略" +"表現です。\n" +"一般に、例外が対話的なプロンプトに達した後にのみ機能します (:data:`sys." +"last_exc` 参照)。" -#: ../../library/traceback.rst:131 msgid "" "Print up to *limit* stack trace entries (starting from the invocation point) " "if *limit* is positive. Otherwise, print the last ``abs(limit)`` entries. " @@ -200,6 +239,14 @@ msgid "" "objects>` to start. The optional *file* argument has the same meaning as " "for :func:`print_tb`." msgstr "" +"*limit* が正の場合、呼び出し地点からさかのぼった最大 *limit* 個のスタックト" +"レース項目を出力します。\n" +"0 以下の場合は、スタックをさかのぼった末尾側の ``abs(limit)`` 個、つまり最も" +"古い側の項目を出力します。\n" +"*limit* が省略されるか ``None`` の場合は、すべての項目を出力します。\n" +"オプションの *f* 引数で、開始する :ref:`スタックフレーム ` を" +"指定できます。\n" +"オプションの *file* 引数は :func:`print_tb` の場合と同じ意味です。" #: ../../library/traceback.rst:145 msgid "" @@ -213,6 +260,14 @@ msgid "" "`~FrameSummary.line` representing the information that is usually printed " "for a stack trace." msgstr "" +":ref:`トレースバックオブジェクト ` *tb* から取り出された " +"\"前処理済み\" スタックトレース項目のリストを表す :class:`StackSummary` オブ" +"ジェクトを返します。これはスタックトレースの異なる書式化を行うために役に立ち" +"ます。オプションの *limit* 引数は :func:`print_tb` の *limit* 引数と同様の意" +"味を持っています。 \"前処理済み\" スタックトレース項目は 属性 :attr:" +"`~FrameSummary.filename`, :attr:`~FrameSummary.lineno`, :attr:`~FrameSummary." +"name`, および :attr:`~FrameSummary.line` を含む :class:`FrameSummary` オブ" +"ジェクトで、スタックトレースに対して通常出力される情報を表しています。" #: ../../library/traceback.rst:158 msgid "" @@ -221,6 +276,9 @@ msgid "" "The optional *f* and *limit* arguments have the same meaning as for :func:" "`print_stack`." msgstr "" +"現在の :ref:`スタックフレーム ` から生のトレースバックを取り出" +"します。戻り値は :func:`extract_tb` と同じ形式です。オプションの *f* と " +"*limit* 引数は :func:`print_stack` と同じ意味を持ちます。" #: ../../library/traceback.rst:166 msgid "" @@ -229,7 +287,6 @@ msgid "" "``None``, the output is written to :data:`sys.stderr`." msgstr "" -#: ../../library/traceback.rst:173 msgid "" "Given a list of tuples or :class:`FrameSummary` objects as returned by :func:" "`extract_tb` or :func:`extract_stack`, return a list of strings ready for " @@ -238,12 +295,13 @@ msgid "" "strings may contain internal newlines as well, for those items whose source " "text line is not ``None``." msgstr "" -":func:`extract_tb` または :func:`extract_stack` が返すタプルのリストまたは :" -"class:`FrameSummary` オブジェクトが与えられると、出力の準備を整えた文字列のリ" -"ストを返します。結果として生じるリストの中の各文字列は、引数リストの中の同じ" -"インデックスの要素に対応します。各文字列は末尾に改行が付いています。さらに、" -"ソーステキスト行が ``None`` でないそれらの要素に対しては、文字列は内部に改行" -"を含んでいるかもしれません。" +":func:`extract_tb` または :func:`extract_stack` が返すような、タプルまたは :" +"class:`FrameSummary` オブジェクトからなるリストを受け取り、表示用に整えた文字" +"列のリストを返します。\n" +"戻り値の各文字列は、引数のリストの同じインデックスにある要素に対応します。\n" +"各文字列の末尾には改行が付きます。\n" +"ソースコード行が ``None`` でない要素については、文字列の途中にも改行が含まれ" +"ることがあります。" #: ../../library/traceback.rst:183 msgid "" @@ -256,29 +314,34 @@ msgid "" "contains the exception's :attr:`notes `." msgstr "" -#: ../../library/traceback.rst:191 msgid "" "Since Python 3.10, instead of passing *value*, an exception object can be " "passed as the first argument. If *value* is provided, the first argument is " "ignored in order to provide backwards compatibility." msgstr "" +"Python 3.10 以降では、*value* を渡す代わりに、最初の引数として例外オブジェク" +"トを渡せます。\n" +"*value* を指定した場合は、後方互換性のために最初の引数を無視します。" -#: ../../library/traceback.rst:195 ../../library/traceback.rst:431 msgid "" "When *show_group* is ``True``, and the exception is an instance of :exc:" "`BaseExceptionGroup`, the nested exceptions are included as well, " "recursively, with indentation relative to their nesting depth." msgstr "" +"*show_group* が ``True`` で、例外が :exc:`BaseExceptionGroup` のインスタンス" +"である場合は、ネストした例外も再帰的に含め、ネストの深さに応じてインデントし" +"ます。" -#: ../../library/traceback.rst:203 msgid "" "The returned list now includes any :attr:`notes ` " "attached to the exception." msgstr "" +"返されるリストに、例外に付けられた :attr:`注釈 ` も" +"含まれるようになりました。" #: ../../library/traceback.rst:207 msgid "*show_group* parameter was added." -msgstr "" +msgstr "*show_group* 引数が追加されました。" #: ../../library/traceback.rst:213 msgid "" @@ -293,11 +356,10 @@ msgstr "" "改行で終わり、そのいくつかは内部に改行を含みます。これらの行が連結されて出力" "される場合は、厳密に :func:`print_exception` と同じテキストが出力されます。" -#: ../../library/traceback.rst:222 msgid "" "This function's behavior and signature were modified to match :func:" "`print_exception`." -msgstr "" +msgstr "動作とシグネチャが :func:`print_exception` に合わせて変更されました。" #: ../../library/traceback.rst:229 msgid "" @@ -315,39 +377,48 @@ msgstr "``format_list(extract_tb(tb, limit))`` の省略表現です。" msgid "A shorthand for ``format_list(extract_stack(f, limit))``." msgstr "``format_list(extract_stack(f, limit))`` の省略表現です。" -#: ../../library/traceback.rst:244 msgid "" "Clears the local variables of all the stack frames in a :ref:`traceback " "` *tb* by calling the :meth:`~frame.clear` method of " "each :ref:`frame object `." msgstr "" +":ref:`トレースバック ` *tb* の各 :ref:`フレームオブジェク" +"ト ` の :meth:`~frame.clear` メソッドを呼び出し、すべてのス" +"タックフレームのローカル変数を消去します。" -#: ../../library/traceback.rst:253 msgid "" "Walk a stack following :attr:`f.f_back ` from the given frame, " "yielding the frame and line number for each frame. If *f* is ``None``, the " "current stack is used. This helper is used with :meth:`StackSummary.extract`." msgstr "" +"指定されたフレームから :attr:`f.f_back ` をたどってスタックを走" +"査し、各フレームとその行番号を生成します。\n" +"*f* が ``None`` の場合は現在のスタックを使います。\n" +"この補助関数は :meth:`StackSummary.extract` と組み合わせて使います。" -#: ../../library/traceback.rst:260 msgid "" "This function previously returned a generator that would walk the stack when " "first iterated over. The generator returned now is the state of the stack " "when ``walk_stack`` is called." msgstr "" +"以前は、最初に反復されたときにスタックを走査するジェネレータを返していまし" +"た。\n" +"現在返されるジェネレータは、``walk_stack`` が呼ばれた時点のスタックの状態を表" +"します。" -#: ../../library/traceback.rst:267 msgid "" "Walk a traceback following :attr:`~traceback.tb_next` yielding the frame and " "line number for each frame. This helper is used with :meth:`StackSummary." "extract`." msgstr "" +":attr:`~traceback.tb_next` をたどってトレースバックを走査し、各フレームとその" +"行番号を生成します。\n" +"この補助関数は :meth:`StackSummary.extract` と組み合わせて使います。" #: ../../library/traceback.rst:275 msgid ":class:`!TracebackException` Objects" msgstr ":class:`!TracebackException` オブジェクト" -#: ../../library/traceback.rst:279 msgid "" ":class:`!TracebackException` objects are created from actual exceptions to " "capture data for later printing. They offer a more lightweight method of " @@ -356,21 +427,32 @@ msgid "" "addition, they expose more options to configure the output compared to the " "module-level functions described above." msgstr "" +":class:`!TracebackException` オブジェクトは、実際の例外から作成され、後で表示" +"するためのデータを保持します。\n" +":ref:`トレースバック ` オブジェクトや :ref:`フレーム " +"` オブジェクトへの参照を保持せず、より軽量に情報を保存できま" +"す。\n" +"また、上記のモジュールレベルの関数よりも多くの出力設定オプションがあります。" -#: ../../library/traceback.rst:288 msgid "" "Capture an exception for later rendering. The meaning of *limit*, " "*lookup_lines* and *capture_locals* are as for the :class:`StackSummary` " "class." msgstr "" +"後で表示するために例外の情報を取得します。\n" +"*limit*、*lookup_lines*、*capture_locals* の意味は :class:`StackSummary` クラ" +"スと同じです。" -#: ../../library/traceback.rst:292 msgid "" "If *compact* is true, only data that is required by :class:`!" "TracebackException`'s :meth:`format` method is saved in the class " "attributes. In particular, the :attr:`__context__` field is calculated only " "if :attr:`__cause__` is ``None`` and :attr:`__suppress_context__` is false." msgstr "" +"*compact* が真の場合は、:class:`!TracebackException` の :meth:`format` メソッ" +"ドに必要なデータだけをクラスの属性に保存します。\n" +"特に、:attr:`__context__` フィールドを計算するのは、:attr:`__cause__` が " +"``None`` かつ :attr:`__suppress_context__` が偽の場合だけです。" #: ../../library/traceback.rst:298 ../../library/traceback.rst:399 msgid "" @@ -379,7 +461,6 @@ msgstr "" "局所変数がキャプチャされたとき、それらはトレースバックに表示されることに注意" "してください。" -#: ../../library/traceback.rst:300 msgid "" "*max_group_width* and *max_group_depth* control the formatting of exception " "groups (see :exc:`BaseExceptionGroup`). The depth refers to the nesting " @@ -387,6 +468,11 @@ msgid "" "group's exceptions array. The formatted output is truncated when either " "limit is exceeded." msgstr "" +"*max_group_width* と *max_group_depth* は例外グループの書式化を制御します (:" +"exc:`BaseExceptionGroup` を参照)。\n" +"深さはグループのネストの段数、幅は 1 つの例外グループの例外配列のサイズを指し" +"ます。\n" +"どちらかの上限を超えると、書式化された出力を切り詰めます。" #: ../../library/traceback.rst:306 msgid "Added the *compact* parameter." @@ -394,19 +480,21 @@ msgstr "*compact* 引数が追加されました。" #: ../../library/traceback.rst:309 msgid "Added the *max_group_width* and *max_group_depth* parameters." -msgstr "" +msgstr "*max_group_width* と *max_group_depth* 引数が追加されました。" #: ../../library/traceback.rst:314 msgid "" "A :class:`!TracebackException` of the original :attr:`~BaseException." "__cause__`." msgstr "" +"元々の :attr:`~BaseException.__cause__` の :class:`!TracebackException`。" #: ../../library/traceback.rst:319 msgid "" "A :class:`!TracebackException` of the original :attr:`~BaseException." "__context__`." msgstr "" +"元々の :attr:`~BaseException.__context__` の :class:`!TracebackException`。" #: ../../library/traceback.rst:324 msgid "" @@ -419,14 +507,17 @@ msgstr "" msgid "" "The :attr:`~BaseException.__suppress_context__` value from the original " "exception." -msgstr "" +msgstr "元々の例外からの :attr:`~BaseException.__suppress_context__`。" -#: ../../library/traceback.rst:337 msgid "" "The :attr:`~BaseException.__notes__` value from the original exception, or " "``None`` if the exception does not have any notes. If it is not ``None`` is " "it formatted in the traceback after the exception string." msgstr "" +"元の例外の :attr:`~BaseException.__notes__` の値で、例外に注釈がなければ " +"``None`` です。\n" +"``None`` でなければ、トレースバック内で例外の文字列の後に書式化して表示しま" +"す。" #: ../../library/traceback.rst:346 msgid "A :class:`StackSummary` representing the traceback." @@ -436,9 +527,8 @@ msgstr "トレースバックを表す :class:`StackSummary`。" msgid "The class of the original traceback." msgstr "元々のトレースバックのクラス。" -#: ../../library/traceback.rst:356 msgid "String display of the class of the original exception." -msgstr "" +msgstr "元の例外のクラスの表示用文字列。" #: ../../library/traceback.rst:362 msgid "For syntax errors - the file name where the error occurred." @@ -448,11 +538,12 @@ msgstr "構文エラー用 - エラーが発生したファイルの名前。" msgid "For syntax errors - the line number where the error occurred." msgstr "構文エラー用 - エラーが発生した行番号。" -#: ../../library/traceback.rst:370 msgid "" "For syntax errors - the end line number where the error occurred. Can be " "``None`` if not present." msgstr "" +"構文エラー用 - エラーが発生した範囲の末尾の行番号。\n" +"情報がない場合は ``None`` になることがあります。" #: ../../library/traceback.rst:377 msgid "For syntax errors - the text where the error occurred." @@ -462,11 +553,12 @@ msgstr "構文エラー用 - エラーが発生したテクスト。" msgid "For syntax errors - the offset into the text where the error occurred." msgstr "構文エラー用 - エラーが発生したテクストへのオフセット。" -#: ../../library/traceback.rst:385 msgid "" "For syntax errors - the end offset into the text where the error occurred. " "Can be ``None`` if not present." msgstr "" +"構文エラー用 - エラーが発生した範囲のテキスト内の末尾のオフセット。\n" +"情報がない場合は ``None`` になることがあります。" #: ../../library/traceback.rst:392 msgid "For syntax errors - the compiler error message." @@ -481,11 +573,12 @@ msgstr "" "*limit*、*lookup_lines*、*capture_locals* は :class:`StackSummary` class のも" "のです。" -#: ../../library/traceback.rst:403 msgid "" "Print to *file* (default ``sys.stderr``) the exception information returned " "by :meth:`format`." msgstr "" +":meth:`format` が返す例外情報を *file* (デフォルトは ``sys.stderr``) に出力し" +"ます。" #: ../../library/traceback.rst:410 msgid "Format the exception." @@ -496,6 +589,8 @@ msgid "" "If *chain* is not ``True``, :attr:`__cause__` and :attr:`__context__` will " "not be formatted." msgstr "" +"*chain* が ``True`` でない場合 :attr:`__cause__` と :attr:`__context__` は書" +"式化されません。" #: ../../library/traceback.rst:415 msgid "" @@ -516,7 +611,6 @@ msgstr "トレースバックの例外部を書式化します。" msgid "The return value is a generator of strings, each ending in a newline." msgstr "返り値は文字列のジェネレータで、それぞれ改行で終わります。" -#: ../../library/traceback.rst:425 msgid "" "When *show_group* is ``False``, the generator emits the exception's message " "followed by its notes (if it has any). The exception message is normally a " @@ -524,16 +618,21 @@ msgid "" "several lines that (when printed) display detailed information about where " "the syntax error occurred." msgstr "" +"*show_group* が ``False`` の場合、ジェネレータは例外のメッセージと、存在する" +"場合はその注釈を順に生成します。\n" +"例外のメッセージは通常 1 つの文字列ですが、:exc:`SyntaxError` の場合は、構文" +"エラーの位置についての詳細を表示する複数行からなります。" -#: ../../library/traceback.rst:435 msgid "" "The exception's :attr:`notes ` are now included in " "the output." msgstr "" +"例外の :attr:`注釈 ` が出力に含まれるようになりまし" +"た。" #: ../../library/traceback.rst:439 msgid "Added the *show_group* parameter." -msgstr "" +msgstr "*show_group* パラメータが追加されました。" #: ../../library/traceback.rst:444 msgid ":class:`!StackSummary` Objects" @@ -543,14 +642,17 @@ msgstr ":class:`!StackSummary` オブジェクト" msgid "" ":class:`!StackSummary` objects represent a call stack ready for formatting." msgstr "" +":class:`!StackSummary` オブジェクトは書式化の準備ができているコールスタックを" +"表します。" #: ../../library/traceback.rst:454 msgid "" "Construct a :class:`!StackSummary` object from a frame generator (such as is " "returned by :func:`~traceback.walk_stack` or :func:`~traceback.walk_tb`)." msgstr "" +"ジェネレータ (例えば :func:`~traceback.walk_stack` や :func:`~traceback." +"walk_tb` が返すもの) から :class:`!StackSummary` を構築します。" -#: ../../library/traceback.rst:458 msgid "" "If *limit* is supplied, only this many frames are taken from *frame_gen*. If " "*lookup_lines* is ``False``, the returned :class:`FrameSummary` objects will " @@ -559,58 +661,76 @@ msgid "" "formatted). If *capture_locals* is ``True`` the local variables in each :" "class:`!FrameSummary` are captured as object representations." msgstr "" +"*limit* を指定すると、*frame_gen* からその数のフレームだけを取得します。\n" +"*lookup_lines* が ``False`` の場合、返される :class:`FrameSummary` オブジェク" +"トはまだソースコード行を読み込んでいないため、:class:`!StackSummary` の作成コ" +"ストを抑えられます (実際には書式化しない可能性がある場合に役立ちます)。\n" +"*capture_locals* が ``True`` の場合、各 :class:`!FrameSummary` のローカル変数" +"を、オブジェクトの ``repr()`` の結果として保存します。" -#: ../../library/traceback.rst:466 msgid "" "Exceptions raised from :func:`repr` on a local variable (when " "*capture_locals* is ``True``) are no longer propagated to the caller." msgstr "" +"ローカル変数の :func:`repr` が送出する例外が、呼び出し元へ伝播しなくなりまし" +"た (*capture_locals* が ``True`` の場合)。" -#: ../../library/traceback.rst:472 msgid "" "Construct a :class:`!StackSummary` object from a supplied list of :class:" "`FrameSummary` objects or old-style list of tuples. Each tuple should be a " "4-tuple with *filename*, *lineno*, *name*, *line* as the elements." msgstr "" +"指定された :class:`FrameSummary` オブジェクトのリスト、または従来のタプルのリ" +"ストから :class:`!StackSummary` オブジェクトを構築します。\n" +"各タプルは、*filename*、*lineno*、*name*、*line* を要素とする 4 要素のタプル" +"にしてください。" -#: ../../library/traceback.rst:479 msgid "" "Returns a list of strings ready for printing. Each string in the resulting " "list corresponds to a single :ref:`frame ` from the stack. " "Each string ends in a newline; the strings may contain internal newlines as " "well, for those items with source text lines." msgstr "" +"表示用に整えた文字列のリストを返します。\n" +"各文字列は、スタック内の 1 つの :ref:`フレーム ` に対応しま" +"す。\n" +"各文字列の末尾には改行が付きます。\n" +"ソースコード行を含む項目では、文字列の途中にも改行が含まれることがあります。" -#: ../../library/traceback.rst:485 msgid "" "For long sequences of the same frame and line, the first few repetitions are " "shown, followed by a summary line stating the exact number of further " "repetitions." msgstr "" +"同じフレームと行が長く繰り返される場合は、最初の数回を表示し、続いて残りの繰" +"り返し回数を正確に示す要約行を表示します。" -#: ../../library/traceback.rst:489 msgid "Long sequences of repeated frames are now abbreviated." -msgstr "" +msgstr "フレームの長い繰り返しが省略されるようになりました。" -#: ../../library/traceback.rst:494 msgid "" "Returns a string for printing one of the :ref:`frames ` " "involved in the stack. This method is called for each :class:`FrameSummary` " "object to be printed by :meth:`StackSummary.format`. If it returns ``None``, " "the frame is omitted from the output." msgstr "" +"スタック内の 1 つの :ref:`フレーム ` を表示するための文字列を" +"返します。\n" +":meth:`StackSummary.format` が表示する各 :class:`FrameSummary` オブジェクトに" +"対して呼び出されます。\n" +"``None`` を返した場合、そのフレームは出力から除外されます。" #: ../../library/traceback.rst:504 msgid ":class:`!FrameSummary` Objects" msgstr ":class:`!FrameSummary` オブジェクト" -#: ../../library/traceback.rst:508 msgid "" "A :class:`!FrameSummary` object represents a single :ref:`frame ` in a :ref:`traceback `." msgstr "" +":class:`!FrameSummary` オブジェクトは、:ref:`トレースバック ` 内の 1 つの :ref:`フレーム ` を表します。" -#: ../../library/traceback.rst:515 msgid "" "Represents a single :ref:`frame ` in the :ref:`traceback " "` or stack that is being formatted or printed. It may " @@ -623,27 +743,39 @@ msgid "" "supplied the variable representations are stored in the summary for later " "display." msgstr "" +"書式化または表示する :ref:`トレースバック ` やスタック内" +"の、1 つの :ref:`フレーム ` を表します。\n" +"必要に応じて、そのフレームのローカル変数を文字列にしたものも含められます。\n" +"*lookup_line* が ``False`` の場合、:class:`!FrameSummary` の :attr:" +"`~FrameSummary.line` 属性にアクセスするまでソースコードを取得しません (:" +"class:`tuple` への変換時にも、この属性へのアクセスが発生します)。\n" +":attr:`~FrameSummary.line` を直接指定すると、ソースコード行の取得を完全に避け" +"られます。\n" +"*locals* は省略可能なローカル変数のマッピングです。\n" +"指定すると、後で表示するために変数の ``repr()`` の結果を保存します。" #: ../../library/traceback.rst:526 msgid ":class:`!FrameSummary` instances have the following attributes:" -msgstr "" +msgstr ":class:`!FrameSummary` インスタンスは以下の属性を持ちます:" -#: ../../library/traceback.rst:530 msgid "" "The filename of the source code for this frame. Equivalent to accessing :" "attr:`f.f_code.co_filename ` on a :ref:`frame object " "` *f*." msgstr "" +"このフレームのソースコードのファイル名。\n" +":ref:`フレームオブジェクト ` *f* の :attr:`f.f_code." +"co_filename ` へのアクセスと同等です。" -#: ../../library/traceback.rst:536 msgid "The line number of the source code for this frame." -msgstr "" +msgstr "このフレームのソースコードの行番号。" -#: ../../library/traceback.rst:540 msgid "" "Equivalent to accessing :attr:`f.f_code.co_name ` on a :" "ref:`frame object ` *f*." msgstr "" +":ref:`フレームオブジェクト ` *f* の :attr:`f.f_code.co_name " +"` へのアクセスと同等です。" #: ../../library/traceback.rst:545 msgid "" @@ -651,31 +783,32 @@ msgid "" "trailing whitespace stripped. If the source is not available, it is ``None``." msgstr "" -#: ../../library/traceback.rst:551 msgid "" "The last line number of the source code for this frame. By default, it is " "set to ``lineno`` and indexation starts from 1." msgstr "" +"このフレームのソースコードの末尾の行番号。\n" +"デフォルトは ``lineno`` で、行番号は 1 から始まります。" -#: ../../library/traceback.rst:554 msgid "The default value changed from ``None`` to ``lineno``." -msgstr "" +msgstr "デフォルト値が ``None`` から ``lineno`` に変わりました。" -#: ../../library/traceback.rst:559 msgid "" "The column number of the source code for this frame. By default, it is " "``None`` and indexation starts from 0." msgstr "" +"このフレームのソースコードの列番号。\n" +"デフォルトは ``None`` で、列番号は 0 から始まります。" -#: ../../library/traceback.rst:564 msgid "" "The last column number of the source code for this frame. By default, it is " "``None`` and indexation starts from 0." msgstr "" +"このフレームのソースコードの末尾の列番号。\n" +"デフォルトは ``None`` で、列番号は 0 から始まります。" -#: ../../library/traceback.rst:571 msgid "Examples of Using the Module-Level Functions" -msgstr "" +msgstr "モジュールレベルの関数の使用例" #: ../../library/traceback.rst:573 msgid "" @@ -689,7 +822,6 @@ msgstr "" "りません。インタープリタループのより完全な実装については、 :mod:`code` モ" "ジュールを参照してください。 ::" -#: ../../library/traceback.rst:578 msgid "" "import sys, traceback\n" "\n" @@ -707,14 +839,29 @@ msgid "" "while True:\n" " run_user_code(envdir)" msgstr "" +"import sys, traceback\n" +"\n" +"def run_user_code(envdir):\n" +" source = input(\">>> \")\n" +" try:\n" +" exec(source, envdir)\n" +" except Exception:\n" +" print(\"Exception in user code:\")\n" +" print(\"-\"*60)\n" +" traceback.print_exc(file=sys.stdout)\n" +" print(\"-\"*60)\n" +"\n" +"envdir = {}\n" +"while True:\n" +" run_user_code(envdir)" -#: ../../library/traceback.rst:595 msgid "" "The following example demonstrates the different ways to print and format " "the exception and traceback:" -msgstr "次の例は例外とトレースバックの出力並びに形式が異なることを示します:" +msgstr "" +"次の例は、例外とトレースバックを表示したり書式化したりするさまざまな方法を示" +"します。" -#: ../../library/traceback.rst:598 msgid "" "import sys, traceback\n" "\n" @@ -745,12 +892,39 @@ msgid "" " print(repr(traceback.format_tb(exc.__traceback__)))\n" " print(\"*** tb_lineno:\", exc.__traceback__.tb_lineno)" msgstr "" +"import sys, traceback\n" +"\n" +"def lumberjack():\n" +" bright_side_of_life()\n" +"\n" +"def bright_side_of_life():\n" +" return tuple()[0]\n" +"\n" +"try:\n" +" lumberjack()\n" +"except IndexError as exc:\n" +" print(\"*** print_tb:\")\n" +" traceback.print_tb(exc.__traceback__, limit=1, file=sys.stdout)\n" +" print(\"*** print_exception:\")\n" +" traceback.print_exception(exc, limit=2, file=sys.stdout)\n" +" print(\"*** print_exc:\")\n" +" traceback.print_exc(limit=2, file=sys.stdout)\n" +" print(\"*** format_exc, first and last line:\")\n" +" formatted_lines = traceback.format_exc().splitlines()\n" +" print(formatted_lines[0])\n" +" print(formatted_lines[-1])\n" +" print(\"*** format_exception:\")\n" +" print(repr(traceback.format_exception(exc)))\n" +" print(\"*** extract_tb:\")\n" +" print(repr(traceback.extract_tb(exc.__traceback__)))\n" +" print(\"*** format_tb:\")\n" +" print(repr(traceback.format_tb(exc.__traceback__)))\n" +" print(\"*** tb_lineno:\", exc.__traceback__.tb_lineno)" #: ../../library/traceback.rst:629 msgid "The output for the example would look similar to this:" msgstr "この例の出力は次のようになります:" -#: ../../library/traceback.rst:631 msgid "" "*** print_tb:\n" " File \"\", line 10, in \n" @@ -799,12 +973,58 @@ msgid "" "return tuple()[0]\\n ~~~~~~~^^^\\n']\n" "*** tb_lineno: 10" msgstr "" +"*** print_tb:\n" +" File \"\", line 10, in \n" +" lumberjack()\n" +" ~~~~~~~~~~^^\n" +"*** print_exception:\n" +"Traceback (most recent call last):\n" +" File \"\", line 10, in \n" +" lumberjack()\n" +" ~~~~~~~~~~^^\n" +" File \"\", line 4, in lumberjack\n" +" bright_side_of_life()\n" +" ~~~~~~~~~~~~~~~~~~~^^\n" +"IndexError: tuple index out of range\n" +"*** print_exc:\n" +"Traceback (most recent call last):\n" +" File \"\", line 10, in \n" +" lumberjack()\n" +" ~~~~~~~~~~^^\n" +" File \"\", line 4, in lumberjack\n" +" bright_side_of_life()\n" +" ~~~~~~~~~~~~~~~~~~~^^\n" +"IndexError: tuple index out of range\n" +"*** format_exc, first and last line:\n" +"Traceback (most recent call last):\n" +"IndexError: tuple index out of range\n" +"*** format_exception:\n" +"['Traceback (most recent call last):\\n',\n" +" ' File \"\", line 10, in \\n " +"lumberjack()\\n ~~~~~~~~~~^^\\n',\n" +" ' File \"\", line 4, in lumberjack\\n " +"bright_side_of_life()\\n ~~~~~~~~~~~~~~~~~~~^^\\n',\n" +" ' File \"\", line 7, in bright_side_of_life\\n " +"return tuple()[0]\\n ~~~~~~~^^^\\n',\n" +" 'IndexError: tuple index out of range\\n']\n" +"*** extract_tb:\n" +"[, line 10 in >,\n" +" , line 4 in lumberjack>,\n" +" , line 7 in bright_side_of_life>]\n" +"*** format_tb:\n" +"[' File \"\", line 10, in \\n " +"lumberjack()\\n ~~~~~~~~~~^^\\n',\n" +" ' File \"\", line 4, in lumberjack\\n " +"bright_side_of_life()\\n ~~~~~~~~~~~~~~~~~~~^^\\n',\n" +" ' File \"\", line 7, in bright_side_of_life\\n " +"return tuple()[0]\\n ~~~~~~~^^^\\n']\n" +"*** tb_lineno: 10" -#: ../../library/traceback.rst:676 msgid "" "The following example shows the different ways to print and format the " "stack::" -msgstr "次の例は、スタックの print と format の違いを示しています::" +msgstr "" +"次の例は、スタックを表示したり書式化したりするさまざまな方法を示します。 ::" #: ../../library/traceback.rst:678 msgid "" @@ -838,7 +1058,6 @@ msgstr "" msgid "This last example demonstrates the final few formatting functions:" msgstr "最後の例は、残りの幾つかの関数のデモをします:" -#: ../../library/traceback.rst:704 msgid "" ">>> import traceback\n" ">>> traceback.format_list([('spam.py', 3, '', 'spam.eggs()'),\n" @@ -849,14 +1068,20 @@ msgid "" ">>> traceback.format_exception_only(an_error)\n" "['IndexError: tuple index out of range\\n']" msgstr "" +">>> import traceback\n" +">>> traceback.format_list([('spam.py', 3, '', 'spam.eggs()'),\n" +"... ('eggs.py', 42, 'eggs', 'return \"bacon\"')])\n" +"[' File \"spam.py\", line 3, in \\n spam.eggs()\\n',\n" +" ' File \"eggs.py\", line 42, in eggs\\n return \"bacon\"\\n']\n" +">>> an_error = IndexError('tuple index out of range')\n" +">>> traceback.format_exception_only(an_error)\n" +"['IndexError: tuple index out of range\\n']" -#: ../../library/traceback.rst:718 msgid "Examples of Using :class:`TracebackException`" -msgstr "" +msgstr ":class:`TracebackException` の使用例" -#: ../../library/traceback.rst:720 msgid "With the helper class, we have more options::" -msgstr "" +msgstr "補助クラスを使うと、さらに多くのオプションを利用できます。 ::" #: ../../library/traceback.rst:722 msgid "" @@ -950,6 +1175,5 @@ msgstr "traceback" msgid "^ (caret)" msgstr "^ (キャレット)" -#: ../../library/traceback.rst:91 msgid "marker" -msgstr "" +msgstr "マーカー" diff --git a/library/tracemalloc.po b/library/tracemalloc.po index 89f266661..e40fa5cd9 100644 --- a/library/tracemalloc.po +++ b/library/tracemalloc.po @@ -19,10 +19,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/tracemalloc.rst:2 @@ -95,7 +95,6 @@ msgstr "上位10を表示する" msgid "Display the 10 files allocating the most memory::" msgstr "最も多くのメモリを割り当てているファイル10を表示します::" -#: ../../library/tracemalloc.rst:41 msgid "" "import tracemalloc\n" "\n" @@ -110,12 +109,23 @@ msgid "" "for stat in top_stats[:10]:\n" " print(stat)" msgstr "" +"import tracemalloc\n" +"\n" +"tracemalloc.start()\n" +"\n" +"# ... アプリケーションを実行する ...\n" +"\n" +"snapshot = tracemalloc.take_snapshot()\n" +"top_stats = snapshot.statistics('lineno')\n" +"\n" +"print(\"[ Top 10 ]\")\n" +"for stat in top_stats[:10]:\n" +" print(stat)" #: ../../library/tracemalloc.rst:55 ../../library/tracemalloc.rst:225 msgid "Example of output of the Python test suite::" msgstr "Python テストスイートの出力例です::" -#: ../../library/tracemalloc.rst:57 msgid "" "[ Top 10 ]\n" ":716: size=4855 KiB, count=39328, average=126 " @@ -133,16 +143,30 @@ msgid "" ":5: size=49.7 KiB, count=148, average=344 B\n" "/usr/lib/python3.4/sysconfig.py:411: size=48.0 KiB, count=1, average=48.0 KiB" msgstr "" +"[ Top 10 ]\n" +":716: size=4855 KiB, count=39328, average=126 " +"B\n" +":284: size=521 KiB, count=3199, average=167 B\n" +"/usr/lib/python3.4/collections/__init__.py:368: size=244 KiB, count=2315, " +"average=108 B\n" +"/usr/lib/python3.4/unittest/case.py:381: size=185 KiB, count=779, " +"average=243 B\n" +"/usr/lib/python3.4/unittest/case.py:402: size=154 KiB, count=378, " +"average=416 B\n" +"/usr/lib/python3.4/abc.py:133: size=88.7 KiB, count=347, average=262 B\n" +":1446: size=70.4 KiB, count=911, average=79 B\n" +":1454: size=52.0 KiB, count=25, average=2131 B\n" +":5: size=49.7 KiB, count=148, average=344 B\n" +"/usr/lib/python3.4/sysconfig.py:411: size=48.0 KiB, count=1, average=48.0 KiB" -#: ../../library/tracemalloc.rst:69 msgid "" "We can see that Python loaded ``4855 KiB`` data (bytecode and constants) " "from modules and that the :mod:`collections` module allocated ``244 KiB`` to " "build :class:`~collections.namedtuple` types." msgstr "" -"Python がモジュールから ``4855 KiB`` のデータ (バイトコードで定数) を読み込ん" -"でいることと、:mod:`collections` モジュールが :class:`~collections." -"namedtuple` 型をビルドするのに ``244 KiB`` を割り当てていることが分かります。" +"Python がモジュールから ``4855 KiB`` のデータ (バイトコードと定数) を読み込" +"み、:mod:`collections` モジュールが :class:`~collections.namedtuple` の型を作" +"成するために ``244 KiB`` を割り当てたことが分かります。" #: ../../library/tracemalloc.rst:73 ../../library/tracemalloc.rst:250 msgid "See :meth:`Snapshot.statistics` for more options." @@ -157,7 +181,6 @@ msgstr "差を計算する" msgid "Take two snapshots and display the differences::" msgstr "スナップショットを2つ取り、差を表示します::" -#: ../../library/tracemalloc.rst:81 msgid "" "import tracemalloc\n" "tracemalloc.start()\n" @@ -173,13 +196,25 @@ msgid "" "for stat in top_stats[:10]:\n" " print(stat)" msgstr "" +"import tracemalloc\n" +"tracemalloc.start()\n" +"# ... アプリケーションを開始する ...\n" +"\n" +"snapshot1 = tracemalloc.take_snapshot()\n" +"# ... メモリリークが起きる関数を呼び出す ...\n" +"snapshot2 = tracemalloc.take_snapshot()\n" +"\n" +"top_stats = snapshot2.compare_to(snapshot1, 'lineno')\n" +"\n" +"print(\"[ Top 10 differences ]\")\n" +"for stat in top_stats[:10]:\n" +" print(stat)" #: ../../library/tracemalloc.rst:95 msgid "" "Example of output before/after running some tests of the Python test suite::" msgstr "Python テストスイートのテストを実行する前後の出力例です::" -#: ../../library/tracemalloc.rst:97 msgid "" "[ Top 10 differences ]\n" ":716: size=8173 KiB (+4428 KiB), count=71332 " @@ -203,6 +238,27 @@ msgid "" "/usr/lib/python3.4/contextlib.py:38: size=67.2 KiB (+67.2 KiB), count=126 " "(+126), average=546 B" msgstr "" +"[ Top 10 differences ]\n" +":716: size=8173 KiB (+4428 KiB), count=71332 " +"(+39369), average=117 B\n" +"/usr/lib/python3.4/linecache.py:127: size=940 KiB (+940 KiB), count=8106 " +"(+8106), average=119 B\n" +"/usr/lib/python3.4/unittest/case.py:571: size=298 KiB (+298 KiB), count=589 " +"(+589), average=519 B\n" +":284: size=1005 KiB (+166 KiB), count=7423 " +"(+1526), average=139 B\n" +"/usr/lib/python3.4/mimetypes.py:217: size=112 KiB (+112 KiB), count=1334 " +"(+1334), average=86 B\n" +"/usr/lib/python3.4/http/server.py:848: size=96.0 KiB (+96.0 KiB), count=1 " +"(+1), average=96.0 KiB\n" +"/usr/lib/python3.4/inspect.py:1465: size=83.5 KiB (+83.5 KiB), count=109 " +"(+109), average=784 B\n" +"/usr/lib/python3.4/unittest/mock.py:491: size=77.7 KiB (+77.7 KiB), " +"count=143 (+143), average=557 B\n" +"/usr/lib/python3.4/urllib/parse.py:476: size=71.8 KiB (+71.8 KiB), count=969 " +"(+969), average=76 B\n" +"/usr/lib/python3.4/contextlib.py:38: size=67.2 KiB (+67.2 KiB), count=126 " +"(+126), average=546 B" #: ../../library/tracemalloc.rst:109 msgid "" @@ -265,7 +321,6 @@ msgstr "" "Python テストスイートの出力例です (トレースバックは 25 フレームに制限されてい" "ます)::" -#: ../../library/tracemalloc.rst:143 msgid "" "903 memory blocks: 870.1 KiB\n" " File \"\", line 716\n" @@ -302,8 +357,41 @@ msgid "" " File \"/usr/lib/python3.4/runpy.py\", line 160\n" " \"__main__\", fname, loader, pkg_name)" msgstr "" +"903 memory blocks: 870.1 KiB\n" +" File \"\", line 716\n" +" File \"\", line 1036\n" +" File \"\", line 934\n" +" File \"\", line 1068\n" +" File \"\", line 619\n" +" File \"\", line 1581\n" +" File \"\", line 1614\n" +" File \"/usr/lib/python3.4/doctest.py\", line 101\n" +" import pdb\n" +" File \"\", line 284\n" +" File \"\", line 938\n" +" File \"\", line 1068\n" +" File \"\", line 619\n" +" File \"\", line 1581\n" +" File \"\", line 1614\n" +" File \"/usr/lib/python3.4/test/support/__init__.py\", line 1728\n" +" import doctest\n" +" File \"/usr/lib/python3.4/test/test_pickletools.py\", line 21\n" +" support.run_doctest(pickletools)\n" +" File \"/usr/lib/python3.4/test/regrtest.py\", line 1276\n" +" test_runner()\n" +" File \"/usr/lib/python3.4/test/regrtest.py\", line 976\n" +" display_failure=not verbose)\n" +" File \"/usr/lib/python3.4/test/regrtest.py\", line 761\n" +" match_tests=ns.match_tests)\n" +" File \"/usr/lib/python3.4/test/regrtest.py\", line 1563\n" +" main()\n" +" File \"/usr/lib/python3.4/test/__main__.py\", line 3\n" +" regrtest.main_in_temp_cwd()\n" +" File \"/usr/lib/python3.4/runpy.py\", line 73\n" +" exec(code, run_globals)\n" +" File \"/usr/lib/python3.4/runpy.py\", line 160\n" +" \"__main__\", fname, loader, pkg_name)" -#: ../../library/tracemalloc.rst:178 msgid "" "We can see that the most memory was allocated in the :mod:`importlib` module " "to load data (bytecode and constants) from modules: ``870.1 KiB``. The " @@ -311,6 +399,12 @@ msgid "" "``import pdb`` line of the :mod:`doctest` module. The traceback may change " "if a new module is loaded." msgstr "" +"モジュールのデータ (バイトコードと定数) を読み込むために :mod:`importlib` モ" +"ジュールが割り当てたメモリが最も多く、``870.1 KiB`` であることが分かりま" +"す。\n" +"トレースバックは :mod:`importlib` が直近にデータを読み込んだ場所、つまり :" +"mod:`doctest` モジュールの ``import pdb`` 行を示しています。\n" +"新しいモジュールを読み込むと、トレースバックが変わることがあります。" #: ../../library/tracemalloc.rst:186 msgid "Pretty top" @@ -324,7 +418,6 @@ msgstr "" "```` および ```` ファイルを無視して、\n" "メモリ割り当て量の上位10を整形化して表示するコードです::" -#: ../../library/tracemalloc.rst:191 msgid "" "import linecache\n" "import os\n" @@ -360,8 +453,40 @@ msgid "" "snapshot = tracemalloc.take_snapshot()\n" "display_top(snapshot)" msgstr "" +"import linecache\n" +"import os\n" +"import tracemalloc\n" +"\n" +"def display_top(snapshot, key_type='lineno', limit=10):\n" +" snapshot = snapshot.filter_traces((\n" +" tracemalloc.Filter(False, \"\"),\n" +" tracemalloc.Filter(False, \"\"),\n" +" ))\n" +" top_stats = snapshot.statistics(key_type)\n" +"\n" +" print(\"Top %s lines\" % limit)\n" +" for index, stat in enumerate(top_stats[:limit], 1):\n" +" frame = stat.traceback[0]\n" +" print(\"#%s: %s:%s: %.1f KiB\"\n" +" % (index, frame.filename, frame.lineno, stat.size / 1024))\n" +" line = linecache.getline(frame.filename, frame.lineno).strip()\n" +" if line:\n" +" print(' %s' % line)\n" +"\n" +" other = top_stats[limit:]\n" +" if other:\n" +" size = sum(stat.size for stat in other)\n" +" print(\"%s other: %.1f KiB\" % (len(other), size / 1024))\n" +" total = sum(stat.size for stat in top_stats)\n" +" print(\"Total allocated size: %.1f KiB\" % (total / 1024))\n" +"\n" +"tracemalloc.start()\n" +"\n" +"# ... アプリケーションを実行する ...\n" +"\n" +"snapshot = tracemalloc.take_snapshot()\n" +"display_top(snapshot)" -#: ../../library/tracemalloc.rst:227 msgid "" "Top 10 lines\n" "#1: Lib/base64.py:414: 419.8 KiB\n" @@ -386,12 +511,32 @@ msgid "" "6220 other: 3602.8 KiB\n" "Total allocated size: 5303.1 KiB" msgstr "" +"Top 10 lines\n" +"#1: Lib/base64.py:414: 419.8 KiB\n" +" _b85chars2 = [(a + b) for a in _b85chars for b in _b85chars]\n" +"#2: Lib/base64.py:306: 419.8 KiB\n" +" _a85chars2 = [(a + b) for a in _a85chars for b in _a85chars]\n" +"#3: collections/__init__.py:368: 293.6 KiB\n" +" exec(class_definition, namespace)\n" +"#4: Lib/abc.py:133: 115.2 KiB\n" +" cls = super().__new__(mcls, name, bases, namespace)\n" +"#5: unittest/case.py:574: 103.1 KiB\n" +" testMethod()\n" +"#6: Lib/linecache.py:127: 95.4 KiB\n" +" lines = fp.readlines()\n" +"#7: urllib/parse.py:476: 71.8 KiB\n" +" for a in _hexdig for b in _hexdig}\n" +"#8: :5: 62.0 KiB\n" +"#9: Lib/_weakrefset.py:37: 60.0 KiB\n" +" self.data = set()\n" +"#10: Lib/base64.py:142: 59.8 KiB\n" +" _b32tab2 = [a + b for a in _b32tab for b in _b32tab]\n" +"6220 other: 3602.8 KiB\n" +"Total allocated size: 5303.1 KiB" -#: ../../library/tracemalloc.rst:253 msgid "Record the current and peak size of all traced memory blocks" -msgstr "" +msgstr "トレース中の全メモリブロックの現在のサイズとピーク時のサイズを記録する" -#: ../../library/tracemalloc.rst:255 msgid "" "The following code computes two sums like ``0 + 1 + 2 + ...`` inefficiently, " "by creating a list of those numbers. This list consumes a lot of memory " @@ -399,8 +544,12 @@ msgid "" "observe the small memory usage after the sum is computed as well as the peak " "memory usage during the computations::" msgstr "" +"次のコードは、``0 + 1 + 2 + ...`` のような和を 2 回計算します。\n" +"数値のリストを作成する非効率な方法で、このリストは一時的に多くのメモリを消費" +"します。\n" +":func:`get_traced_memory` と :func:`reset_peak` を使うと、和を計算した後の小" +"さなメモリ使用量と、計算中のピーク時のメモリ使用量の両方を確認できます。 ::" -#: ../../library/tracemalloc.rst:261 msgid "" "import tracemalloc\n" "\n" @@ -421,18 +570,36 @@ msgid "" "print(f\"{first_size=}, {first_peak=}\")\n" "print(f\"{second_size=}, {second_peak=}\")" msgstr "" +"import tracemalloc\n" +"\n" +"tracemalloc.start()\n" +"\n" +"# コード例: 大きな一時リストを使って和を計算する\n" +"large_sum = sum(list(range(100000)))\n" +"\n" +"first_size, first_peak = tracemalloc.get_traced_memory()\n" +"\n" +"tracemalloc.reset_peak()\n" +"\n" +"# コード例: 小さな一時リストを使って和を計算する\n" +"small_sum = sum(list(range(1000)))\n" +"\n" +"second_size, second_peak = tracemalloc.get_traced_memory()\n" +"\n" +"print(f\"{first_size=}, {first_peak=}\")\n" +"print(f\"{second_size=}, {second_peak=}\")" #: ../../library/tracemalloc.rst:280 ../../library/tracemalloc.rst:759 msgid "Output::" msgstr "出力::" -#: ../../library/tracemalloc.rst:282 msgid "" "first_size=664, first_peak=3592984\n" "second_size=804, second_peak=29704" msgstr "" +"first_size=664, first_peak=3592984\n" +"second_size=804, second_peak=29704" -#: ../../library/tracemalloc.rst:285 msgid "" "Using :func:`reset_peak` ensured we could accurately record the peak during " "the computation of ``small_sum``, even though it is much smaller than the " @@ -443,6 +610,15 @@ msgid "" "we could optimise (by removing the unnecessary call to :class:`list`, and " "writing ``sum(range(...))``)." msgstr "" +":func:`reset_peak` を使ったことで、``small_sum`` の計算中のピークを正確に記録" +"できました。\n" +"このピークは :func:`start` の呼び出し以降のメモリブロック全体のピークサイズよ" +"りもはるかに小さい値です。\n" +":func:`reset_peak` を呼び出さなければ、``second_peak`` は ``large_sum`` の計" +"算中のピークのままです (つまり ``first_peak`` と等しくなります)。\n" +"この例では、どちらのピークも最終的なメモリ使用量を大幅に上回っています。\n" +"これは、不要な :class:`list` の呼び出しをなくして ``sum(range(...))`` と書く" +"ことで、最適化できることを示唆しています。" #: ../../library/tracemalloc.rst:295 msgid "API" @@ -514,13 +690,16 @@ msgid "" "allocations." msgstr "" -#: ../../library/tracemalloc.rst:341 msgid "" "This function only modifies the recorded peak size, and does not modify or " "clear any traces, unlike :func:`clear_traces`. Snapshots taken with :func:" "`take_snapshot` before a call to :func:`reset_peak` can be meaningfully " "compared to snapshots taken after the call." msgstr "" +"この関数は、記録されたピークサイズだけを変更します。\n" +":func:`clear_traces` とは異なり、トレースを変更したり消去したりしません。\n" +":func:`reset_peak` を呼び出す前に :func:`take_snapshot` で取得したスナップ" +"ショットは、呼び出し後に取得したスナップショットと有意義に比較できます。" #: ../../library/tracemalloc.rst:346 msgid "See also :func:`get_traced_memory`." @@ -560,11 +739,12 @@ msgstr "" "り上限は ``1`` です。\n" "*nframe* は ``1`` 以上でなければなりません。" -#: ../../library/tracemalloc.rst:373 msgid "" "You can still read the original number of total frames that composed the " "traceback by looking at the :attr:`Traceback.total_nframe` attribute." msgstr "" +":attr:`Traceback.total_nframe` 属性を調べると、元のトレースバックを構成してい" +"たフレームの総数も取得できます。" #: ../../library/tracemalloc.rst:376 msgid "" @@ -669,29 +849,31 @@ msgstr "" msgid "See also the :func:`get_object_traceback` function." msgstr ":func:`get_object_traceback` 関数を参照してください。" -#: ../../library/tracemalloc.rst:423 msgid "DomainFilter" -msgstr "" +msgstr "DomainFilter" -#: ../../library/tracemalloc.rst:427 msgid "Filter traces of memory blocks by their address space (domain)." msgstr "" +"メモリブロックのトレースを、アドレス空間 (ドメイン) でフィルタリングします。" -#: ../../library/tracemalloc.rst:433 msgid "" "If *inclusive* is ``True`` (include), match memory blocks allocated in the " "address space :attr:`domain`." msgstr "" +"*inclusive* が ``True`` (含める) の場合は、アドレス空間 :attr:`domain` に割り" +"当てられたメモリブロックにマッチします。" -#: ../../library/tracemalloc.rst:436 msgid "" "If *inclusive* is ``False`` (exclude), match memory blocks not allocated in " "the address space :attr:`domain`." msgstr "" +"*inclusive* が ``False`` (除外する) の場合は、アドレス空間 :attr:`domain` 以" +"外に割り当てられたメモリブロックにマッチします。" -#: ../../library/tracemalloc.rst:441 ../../library/tracemalloc.rst:693 msgid "Address space of a memory block (``int``). Read-only property." msgstr "" +"メモリブロックのアドレス空間 (``int``)。\n" +"読み出し専用のプロパティです。" #: ../../library/tracemalloc.rst:445 msgid "Filter" @@ -713,13 +895,12 @@ msgstr "" msgid "Examples:" msgstr "例:" -#: ../../library/tracemalloc.rst:457 msgid "" "``Filter(True, subprocess.__file__)`` only includes traces of the :mod:" "`subprocess` module" msgstr "" -"``Filter(True, subprocess.__file__)`` は :mod:`subprocess` モジュールのみを含" -"みます" +"``Filter(True, subprocess.__file__)`` は :mod:`subprocess` モジュールのトレー" +"スだけを含めます。" #: ../../library/tracemalloc.rst:459 msgid "" @@ -742,29 +923,34 @@ msgstr "" msgid "Added the :attr:`domain` attribute." msgstr ":attr:`domain` 属性が追加されました。" -#: ../../library/tracemalloc.rst:473 msgid "Address space of a memory block (``int`` or ``None``)." -msgstr "" +msgstr "メモリブロックのアドレス空間 (``int`` または ``None``)。" -#: ../../library/tracemalloc.rst:475 ../../library/tracemalloc.rst:695 msgid "" "tracemalloc uses the domain ``0`` to trace memory allocations made by " "Python. C extensions can use other domains to trace other resources." msgstr "" +"tracemalloc はドメイン ``0`` を使って Python のメモリ割り当てをトレースしま" +"す。\n" +"C 拡張は他のドメインを使って、他のリソースをトレースできます。" -#: ../../library/tracemalloc.rst:480 msgid "" "If *inclusive* is ``True`` (include), only match memory blocks allocated in " "a file with a name matching :attr:`filename_pattern` at line number :attr:" "`lineno`." msgstr "" +"*inclusive* が ``True`` (含める) の場合は、ファイル名が :attr:" +"`filename_pattern` にマッチするファイルの、行番号 :attr:`lineno` で割り当てら" +"れたメモリブロックだけにマッチします。" -#: ../../library/tracemalloc.rst:484 msgid "" "If *inclusive* is ``False`` (exclude), ignore memory blocks allocated in a " "file with a name matching :attr:`filename_pattern` at line number :attr:" "`lineno`." msgstr "" +"*inclusive* が ``False`` (除外する) の場合は、ファイル名が :attr:" +"`filename_pattern` にマッチするファイルの、行番号 :attr:`lineno` で割り当てら" +"れたメモリブロックを無視します。" #: ../../library/tracemalloc.rst:490 msgid "" @@ -866,24 +1052,31 @@ msgstr "スナップショットをファイルに書き込みます。" msgid "Use :meth:`load` to reload the snapshot." msgstr "スナップショットをリロードするには :meth:`load` を使用します。" -#: ../../library/tracemalloc.rst:557 msgid "" "Create a new :class:`Snapshot` instance with a filtered :attr:`traces` " "sequence, *filters* is a list of :class:`DomainFilter` and :class:`Filter` " "instances. If *filters* is an empty list, return a new :class:`Snapshot` " "instance with a copy of the traces." msgstr "" +"フィルタリングした :attr:`traces` シーケンスを持つ新しい :class:`Snapshot` イ" +"ンスタンスを作成します。\n" +"*filters* は :class:`DomainFilter` および :class:`Filter` インスタンスのリス" +"トです。\n" +"*filters* が空のリストの場合は、トレースをコピーした新しい :class:`Snapshot` " +"インスタンスを返します。" -#: ../../library/tracemalloc.rst:562 msgid "" "All inclusive filters are applied at once, a trace is ignored if no " "inclusive filters match it. A trace is ignored if at least one exclusive " "filter matches it." msgstr "" +"包含フィルタはすべてまとめて適用され、どの包含フィルタにもマッチしないトレー" +"スは無視されます。\n" +"また、少なくとも 1 つの除外フィルタにマッチするトレースは無視されます。" -#: ../../library/tracemalloc.rst:566 msgid ":class:`DomainFilter` instances are now also accepted in *filters*." msgstr "" +"*filters* に :class:`DomainFilter` インスタンスも指定できるようになりました。" #: ../../library/tracemalloc.rst:572 msgid "Load a snapshot from a file." @@ -1075,9 +1268,8 @@ msgstr "" msgid "Trace" msgstr "Trace" -#: ../../library/tracemalloc.rst:683 msgid "Trace of a memory block." -msgstr "メモリブロックをトレースします。" +msgstr "メモリブロックのトレース。" #: ../../library/tracemalloc.rst:685 msgid "" @@ -1095,18 +1287,21 @@ msgstr "メモリブロックのバイト単位のサイズ (``int``)。" msgid "Traceback" msgstr "Traceback" -#: ../../library/tracemalloc.rst:713 msgid "" "Sequence of :class:`Frame` instances sorted from the oldest frame to the " "most recent frame." msgstr "" +"最も古いフレームから最新のフレームの順に並んだ、:class:`Frame` インスタンスの" +"シーケンス。" -#: ../../library/tracemalloc.rst:716 msgid "" "A traceback contains at least ``1`` frame. If the ``tracemalloc`` module " "failed to get a frame, the filename ``\"\"`` at line number ``0`` " "is used." msgstr "" +"トレースバックには少なくとも ``1`` フレームが含まれます。\n" +"``tracemalloc`` モジュールがフレームを取得できなかった場合は、ファイル名 " +"``\"\"``、行番号 ``0`` を使います。" #: ../../library/tracemalloc.rst:720 msgid "" @@ -1123,23 +1318,22 @@ msgid "" "instance." msgstr ":attr:`Trace.traceback` 属性は :class:`Traceback` のインスタンスです。" -#: ../../library/tracemalloc.rst:729 msgid "" "Frames are now sorted from the oldest to the most recent, instead of most " "recent to oldest." -msgstr "" +msgstr "フレームの順序が、最新から最古ではなく、最古から最新になりました。" -#: ../../library/tracemalloc.rst:734 msgid "" "Total number of frames that composed the traceback before truncation. This " "attribute can be set to ``None`` if the information is not available." msgstr "" +"切り詰められる前のトレースバックを構成していたフレームの総数。\n" +"情報が利用できない場合は ``None`` になることがあります。" #: ../../library/tracemalloc.rst:738 msgid "The :attr:`Traceback.total_nframe` attribute was added." msgstr ":attr:`Traceback.total_nframe` 属性が追加されました。" -#: ../../library/tracemalloc.rst:743 msgid "" "Format the traceback as a list of lines. Use the :mod:`linecache` module to " "retrieve lines from the source code. If *limit* is set, format the *limit* " @@ -1148,12 +1342,19 @@ msgid "" "of the formatted frames is reversed, returning the most recent frame first " "instead of last." msgstr "" +"トレースバックを書式化し、行のリストとして返します。\n" +"ソースコード行の取得には :mod:`linecache` モジュールを使います。\n" +"*limit* が指定されていて正の場合は、最新の *limit* フレームを書式化します。\n" +"*limit* が 0 以下の場合は、最も古い ``abs(limit)`` フレームを書式化します。\n" +"*most_recent_first* が ``True`` の場合は、書式化したフレームの順序を逆にし、" +"最新のフレームを最後ではなく最初に返します。" -#: ../../library/tracemalloc.rst:750 msgid "" "Similar to the :func:`traceback.format_tb` function, except that :meth:`." "format` does not include newlines." msgstr "" +":func:`traceback.format_tb` に似ていますが、:meth:`.format` は改行文字を含め" +"ません。" #: ../../library/tracemalloc.rst:753 msgid "Example::" diff --git a/library/tty.po b/library/tty.po index ce6904a2e..20c88729c 100644 --- a/library/tty.po +++ b/library/tty.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/tty.rst:2 @@ -40,9 +40,8 @@ msgstr "" ":mod:`tty` モジュールは端末を cbreak および raw モードにするための関数を定義" "しています。" -#: ../../library/tty.rst:18 msgid "Availability" -msgstr "" +msgstr "利用可能な環境" #: ../../library/tty.rst:20 msgid "" @@ -55,63 +54,78 @@ msgstr "" msgid "The :mod:`tty` module defines the following functions:" msgstr ":mod:`tty` モジュールでは、以下の関数を定義しています:" -#: ../../library/tty.rst:27 msgid "" "Convert the tty attribute list *mode*, which is a list like the one returned " "by :func:`termios.tcgetattr`, to that of a tty in raw mode." msgstr "" +"tty 属性のリスト *mode* を、raw モードの tty の属性に変換します。\n" +"*mode* は :func:`termios.tcgetattr` が返すものと同じ形式のリストです。" -#: ../../library/tty.rst:35 msgid "" "Convert the tty attribute list *mode*, which is a list like the one returned " "by :func:`termios.tcgetattr`, to that of a tty in cbreak mode." msgstr "" +"tty 属性のリスト *mode* を、cbreak モードの tty の属性に変換します。\n" +"*mode* は :func:`termios.tcgetattr` が返すものと同じ形式のリストです。" -#: ../../library/tty.rst:38 msgid "" "This clears the ``ECHO`` and ``ICANON`` local mode flags in *mode* as well " "as setting the minimum input to 1 byte with no delay." msgstr "" +"*mode* のローカルモードフラグ ``ECHO`` と ``ICANON`` を解除し、最小入力を 1 " +"バイト、遅延なしに設定します。" -#: ../../library/tty.rst:43 msgid "" "The ``ICRNL`` flag is no longer cleared. This matches Linux and macOS ``stty " "cbreak`` behavior and what :func:`setcbreak` historically did." msgstr "" +"``ICRNL`` フラグを解除しなくなりました。\n" +"これは Linux と macOS の ``stty cbreak`` の動作、および従来の :func:" +"`setcbreak` の動作と一致します。" -#: ../../library/tty.rst:50 msgid "" "Change the mode of the file descriptor *fd* to raw. If *when* is omitted, it " "defaults to :const:`termios.TCSAFLUSH`, and is passed to :func:`termios." "tcsetattr`. The return value of :func:`termios.tcgetattr` is saved before " "setting *fd* to raw mode; this value is returned." msgstr "" +"ファイル記述子 *fd* のモードを raw に変更します。\n" +"*when* のデフォルトは :const:`termios.TCSAFLUSH` で、:func:`termios." +"tcsetattr` に渡されます。\n" +"*fd* を raw モードにする前に :func:`termios.tcgetattr` の戻り値を保存し、その" +"値を返します。" -#: ../../library/tty.rst:55 ../../library/tty.rst:69 msgid "" "The return value is now the original tty attributes, instead of ``None``." -msgstr "" +msgstr "``None`` の代わりに、元の tty 属性を返すようになりました。" -#: ../../library/tty.rst:61 msgid "" "Change the mode of file descriptor *fd* to cbreak. If *when* is omitted, it " "defaults to :const:`termios.TCSAFLUSH`, and is passed to :func:`termios." "tcsetattr`. The return value of :func:`termios.tcgetattr` is saved before " "setting *fd* to cbreak mode; this value is returned." msgstr "" +"ファイル記述子 *fd* のモードを cbreak に変更します。\n" +"*when* のデフォルトは :const:`termios.TCSAFLUSH` で、:func:`termios." +"tcsetattr` に渡されます。\n" +"*fd* を cbreak モードにする前に :func:`termios.tcgetattr` の戻り値を保存し、" +"その値を返します。" -#: ../../library/tty.rst:66 msgid "" "This clears the ``ECHO`` and ``ICANON`` local mode flags as well as setting " "the minimum input to 1 byte with no delay." msgstr "" +"ローカルモードフラグ ``ECHO`` と ``ICANON`` を解除し、最小入力を 1 バイト、遅" +"延なしに設定します。" -#: ../../library/tty.rst:72 msgid "" "The ``ICRNL`` flag is no longer cleared. This restores the behavior of " "Python 3.11 and earlier as well as matching what Linux, macOS, & BSDs " "describe in their ``stty(1)`` man pages regarding cbreak mode." msgstr "" +"``ICRNL`` フラグを解除しなくなりました。\n" +"これにより Python 3.11 以前の動作に戻り、Linux、macOS、BSD 系の ``stty(1)`` " +"マニュアルページに記載されている cbreak モードの動作とも一致します。" #: ../../library/tty.rst:80 msgid "Module :mod:`termios`" diff --git a/library/turtle.po b/library/turtle.po index 41292a2ac..c5f62d719 100644 --- a/library/turtle.po +++ b/library/turtle.po @@ -19,15 +19,14 @@ msgstr "" "Last-Translator: 秘湯 , 2025\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" -#: ../../library/turtle.rst:3 msgid ":mod:`!turtle` --- Turtle graphics" -msgstr "" +msgstr ":mod:`!turtle` --- タートルグラフィックス" #: ../../library/turtle.rst:10 msgid "**Source code:** :source:`Lib/turtle.py`" @@ -61,10 +60,9 @@ msgstr "" "を向けている方向に動き、動きに沿って線を引きます。 ``turtle.left(25)`` という" "命令を出すと、今度はその場で25度反時計回りに回ります。" -#: ../../library/turtle.rst:43 msgid "" "Turtle can draw intricate shapes using programs that repeat simple moves." -msgstr "" +msgstr "単純な動きを繰り返すプログラムで、タートルは複雑な図形を描けます。" #: ../../library/turtle.rst:49 msgid "" @@ -92,23 +90,23 @@ msgstr "" msgid "Tutorial" msgstr "チュートリアル" -#: ../../library/turtle.rst:68 msgid "" "New users should start here. In this tutorial we'll explore some of the " "basics of turtle drawing." msgstr "" +"初めて使う方はここから始めてください。\n" +"このチュートリアルでは、タートルによる描画の基本をいくつか学びます。" -#: ../../library/turtle.rst:73 msgid "Starting a turtle environment" -msgstr "" +msgstr "タートルの環境を起動する" -#: ../../library/turtle.rst:75 msgid "In a Python shell, import all the objects of the ``turtle`` module::" msgstr "" +"Python シェルで、``turtle`` モジュールのすべてのオブジェクトをインポートしま" +"す。 ::" -#: ../../library/turtle.rst:77 msgid "from turtle import *" -msgstr "" +msgstr "from turtle import *" #: ../../library/turtle.rst:79 msgid "" @@ -116,17 +114,14 @@ msgid "" "install the :mod:`Tk interface package ` on your system." msgstr "" -#: ../../library/turtle.rst:84 msgid "Basic drawing" -msgstr "" +msgstr "基本的な描画" -#: ../../library/turtle.rst:86 msgid "Send the turtle forward 100 steps::" -msgstr "" +msgstr "タートルを 100 歩前進させます。 ::" -#: ../../library/turtle.rst:88 msgid "forward(100)" -msgstr "" +msgstr "forward(100)" #: ../../library/turtle.rst:90 msgid "" @@ -135,26 +130,27 @@ msgid "" "turns 120 degrees left (anti-clockwise)::" msgstr "" -#: ../../library/turtle.rst:94 msgid "left(120)" -msgstr "" +msgstr "left(120)" -#: ../../library/turtle.rst:96 msgid "Let's continue by drawing a triangle::" -msgstr "" +msgstr "続けて三角形を描いてみましょう。 ::" -#: ../../library/turtle.rst:98 msgid "" "forward(100)\n" "left(120)\n" "forward(100)" msgstr "" +"forward(100)\n" +"left(120)\n" +"forward(100)" -#: ../../library/turtle.rst:102 msgid "" "Notice how the turtle, represented by an arrow, points in different " "directions as you steer it." msgstr "" +"方向を指示すると、矢印で表されたタートルの向きが変わることに注目してくださ" +"い。" #: ../../library/turtle.rst:105 msgid "" @@ -166,65 +162,61 @@ msgstr "" msgid "Pen control" msgstr "Pen の制御" -#: ../../library/turtle.rst:112 msgid "" "Try changing the color - for example, ``color('blue')`` - and width of the " "line - for example, ``width(3)`` - and then drawing again." msgstr "" +"例えば ``color('blue')`` で色を、``width(3)`` で線の幅を変えて、もう一度描い" +"てみてください。" -#: ../../library/turtle.rst:115 msgid "" "You can also move the turtle around without drawing, by lifting up the pen: " "``up()`` before moving. To start drawing again, use ``down()``." msgstr "" +"移動前に ``up()`` でペンを上げると、線を描かずにタートルを移動することもでき" +"ます。\n" +"再び描き始めるには ``down()`` を使います。" -#: ../../library/turtle.rst:120 msgid "The turtle's position" -msgstr "" +msgstr "タートルの位置" -#: ../../library/turtle.rst:122 msgid "" "Send your turtle back to its starting-point (useful if it has disappeared " "off-screen)::" msgstr "" +"タートルを開始位置に戻します (画面の外に出て見えなくなったときに便利で" +"す)。 ::" -#: ../../library/turtle.rst:125 msgid "home()" -msgstr "" +msgstr "home()" -#: ../../library/turtle.rst:127 msgid "" "The home position is at the center of the turtle's screen. If you ever need " "to know them, get the turtle's x-y coordinates with::" msgstr "" +"開始位置はタートルの画面の中央です。\n" +"タートルの x-y 座標を知りたいときは、次のように取得できます。 ::" -#: ../../library/turtle.rst:130 msgid "pos()" -msgstr "" +msgstr "pos()" -#: ../../library/turtle.rst:132 msgid "Home is at ``(0, 0)``." -msgstr "" +msgstr "開始位置は ``(0, 0)`` です。" -#: ../../library/turtle.rst:134 msgid "" "And after a while, it will probably help to clear the window so we can start " "anew::" -msgstr "" +msgstr "しばらく試したら、画面を消去してやり直すとよいでしょう。 ::" -#: ../../library/turtle.rst:137 msgid "clearscreen()" -msgstr "" +msgstr "clearscreen()" -#: ../../library/turtle.rst:141 msgid "Making algorithmic patterns" -msgstr "" +msgstr "アルゴリズムで模様を描く" -#: ../../library/turtle.rst:143 msgid "Using loops, it's possible to build up geometric patterns::" -msgstr "" +msgstr "ループを使うと、幾何学的な模様を描けます。 ::" -#: ../../library/turtle.rst:145 msgid "" "for steps in range(100):\n" " for c in ('blue', 'red', 'green'):\n" @@ -232,36 +224,41 @@ msgid "" " forward(steps)\n" " right(30)" msgstr "" +"for steps in range(100):\n" +" for c in ('blue', 'red', 'green'):\n" +" color(c)\n" +" forward(steps)\n" +" right(30)" -#: ../../library/turtle.rst:152 msgid "\\ - which of course, are limited only by the imagination!" -msgstr "" +msgstr "どんな模様ができるかは、もちろん想像力次第です!" -#: ../../library/turtle.rst:154 msgid "" "Let's draw the star shape at the top of this page. We want red lines, filled " "in with yellow::" msgstr "" +"このページの一番上にある星形を描いてみましょう。\n" +"赤い線で描き、中を黄色で塗りつぶします。 ::" -#: ../../library/turtle.rst:157 msgid "" "color('red')\n" "fillcolor('yellow')" msgstr "" +"color('red')\n" +"fillcolor('yellow')" -#: ../../library/turtle.rst:160 msgid "" "Just as ``up()`` and ``down()`` determine whether lines will be drawn, " "filling can be turned on and off::" msgstr "" +"``up()`` と ``down()`` で線を描くかどうかを切り替えるのと同じように、塗りつぶ" +"しも開始・終了できます。 ::" -#: ../../library/turtle.rst:163 msgid "begin_fill()" -msgstr "" +msgstr "begin_fill()" -#: ../../library/turtle.rst:165 msgid "Next we'll create a loop::" -msgstr "" +msgstr "次にループを作ります。 ::" #: ../../library/turtle.rst:167 msgid "" @@ -278,27 +275,24 @@ msgid "" "position." msgstr "" -#: ../../library/turtle.rst:176 msgid "Finally, complete the filling::" -msgstr "" +msgstr "最後に塗りつぶしを完了します。 ::" -#: ../../library/turtle.rst:178 msgid "end_fill()" -msgstr "" +msgstr "end_fill()" -#: ../../library/turtle.rst:180 msgid "" "(Note that filling only actually takes place when you give the " "``end_fill()`` command.)" msgstr "" +"(実際に塗りつぶされるのは、``end_fill()`` コマンドを実行したときだけです。)" #: ../../library/turtle.rst:187 msgid "How to..." msgstr "" -#: ../../library/turtle.rst:189 msgid "This section covers some typical turtle use-cases and approaches." -msgstr "" +msgstr "この節では、タートルの典型的な用途と使い方をいくつか紹介します。" #: ../../library/turtle.rst:193 msgid "Get started as quickly as possible" @@ -338,14 +332,16 @@ msgstr "" msgid "Automatically begin and end filling" msgstr "" -#: ../../library/turtle.rst:219 msgid "" "Starting with Python 3.14, you can use the :func:`fill` :term:`context " "manager` instead of :func:`begin_fill` and :func:`end_fill` to automatically " "begin and end fill. Here is an example::" msgstr "" +"Python 3.14 以降では、:func:`begin_fill` と :func:`end_fill` の代わりに、:" +"func:`fill` :term:`コンテキストマネージャ ` を使って塗りつぶ" +"しを自動的に開始・終了できます。\n" +"使用例を示します。 ::" -#: ../../library/turtle.rst:223 msgid "" "with fill():\n" " for i in range(4):\n" @@ -354,12 +350,16 @@ msgid "" "\n" "forward(200)" msgstr "" +"with fill():\n" +" for i in range(4):\n" +" forward(100)\n" +" right(90)\n" +"\n" +"forward(200)" -#: ../../library/turtle.rst:230 msgid "The code above is equivalent to::" -msgstr "" +msgstr "上のコードは、次と同等です。 ::" -#: ../../library/turtle.rst:232 msgid "" "begin_fill()\n" "for i in range(4):\n" @@ -369,12 +369,18 @@ msgid "" "\n" "forward(200)" msgstr "" +"begin_fill()\n" +"for i in range(4):\n" +" forward(100)\n" +" right(90)\n" +"end_fill()\n" +"\n" +"forward(200)" #: ../../library/turtle.rst:242 msgid "Use the ``turtle`` module namespace" msgstr "" -#: ../../library/turtle.rst:244 msgid "" "Using ``from turtle import *`` is convenient - but be warned that it imports " "a rather large collection of objects, and if you're doing anything but " @@ -382,26 +388,37 @@ msgid "" "an issue if you're using turtle graphics in a script where other modules " "might be imported)." msgstr "" +"``from turtle import *`` は便利ですが、多数のオブジェクトをインポートする点に" +"は注意してください。\n" +"タートルグラフィックス以外の処理も行う場合は、名前が衝突するおそれがありま" +"す。\n" +"特に、他のモジュールもインポートする可能性があるスクリプトでタートルグラ" +"フィックスを使う場合は、問題になりやすくなります。" -#: ../../library/turtle.rst:250 msgid "" "The solution is to use ``import turtle`` - ``fd()`` becomes ``turtle.fd()``, " "``width()`` becomes ``turtle.width()`` and so on. (If typing \"turtle\" over " "and over again becomes tedious, use for example ``import turtle as t`` " "instead.)" msgstr "" +"解決策は ``import turtle`` を使うことです。\n" +"``fd()`` は ``turtle.fd()``、``width()`` は ``turtle.width()`` というように書" +"きます。\n" +"(\"turtle\" を何度も入力するのが面倒であれば、例えば ``import turtle as t`` " +"を使ってください。)" #: ../../library/turtle.rst:257 msgid "Use turtle graphics in a script" msgstr "" -#: ../../library/turtle.rst:259 msgid "" "It's recommended to use the ``turtle`` module namespace as described " "immediately above, for example::" msgstr "" +"すぐ上で説明したように、``turtle`` モジュールの名前空間を使うことを推奨しま" +"す。\n" +"例えば、次のように書きます。 ::" -#: ../../library/turtle.rst:262 msgid "" "import turtle as t\n" "from random import random\n" @@ -412,53 +429,67 @@ msgid "" " t.right(angle)\n" " t.fd(steps)" msgstr "" +"import turtle as t\n" +"from random import random\n" +"\n" +"for i in range(100):\n" +" steps = int(random() * 100)\n" +" angle = int(random() * 360)\n" +" t.right(angle)\n" +" t.fd(steps)" -#: ../../library/turtle.rst:271 msgid "" "Another step is also required though - as soon as the script ends, Python " "will also close the turtle's window. Add::" msgstr "" +"ただし、もう 1 つ手順が必要です。\n" +"スクリプトが終わると、Python はタートルのウィンドウもすぐに閉じてしまいま" +"す。\n" +"次の行を ::" -#: ../../library/turtle.rst:274 msgid "t.mainloop()" -msgstr "" +msgstr "t.mainloop()" -#: ../../library/turtle.rst:276 msgid "" "to the end of the script. The script will now wait to be dismissed and will " "not exit until it is terminated, for example by closing the turtle graphics " "window." msgstr "" +"スクリプトの最後に追加してください。\n" +"これでスクリプトは終了の操作を待つようになり、タートルグラフィックスのウィン" +"ドウを閉じるなどして終了させるまで動作し続けます。" #: ../../library/turtle.rst:282 msgid "Use object-oriented turtle graphics" msgstr "" -#: ../../library/turtle.rst:284 msgid "" ":ref:`Explanation of the object-oriented interface `" -msgstr "" +msgstr ":ref:`オブジェクト指向インターフェースの説明 `" -#: ../../library/turtle.rst:286 msgid "" "Other than for very basic introductory purposes, or for trying things out as " "quickly as possible, it's more usual and much more powerful to use the " "object-oriented approach to turtle graphics. For example, this allows " "multiple turtles on screen at once." msgstr "" +"ごく基本的な入門や、すぐに試してみたい場合を除けば、タートルグラフィックスで" +"はオブジェクト指向の方法の方が一般的で、はるかに多くのことができます。\n" +"例えば、画面に複数のタートルを同時に表示できます。" -#: ../../library/turtle.rst:291 msgid "" "In this approach, the various turtle commands are methods of objects (mostly " "of ``Turtle`` objects). You *can* use the object-oriented approach in the " "shell, but it would be more typical in a Python script." msgstr "" +"この方法では、さまざまなタートルのコマンドが、主に ``Turtle`` オブジェクトの" +"メソッドになります。\n" +"シェルでもオブジェクト指向の方法を *使えます* が、通常は Python スクリプトで" +"使います。" -#: ../../library/turtle.rst:295 msgid "The example above then becomes::" -msgstr "" +msgstr "上の例は次のようになります。 ::" -#: ../../library/turtle.rst:297 msgid "" "from turtle import Turtle\n" "from random import random\n" @@ -472,23 +503,39 @@ msgid "" "\n" "t.screen.mainloop()" msgstr "" +"from turtle import Turtle\n" +"from random import random\n" +"\n" +"t = Turtle()\n" +"for i in range(100):\n" +" steps = int(random() * 100)\n" +" angle = int(random() * 360)\n" +" t.right(angle)\n" +" t.fd(steps)\n" +"\n" +"t.screen.mainloop()" -#: ../../library/turtle.rst:309 msgid "" "Note the last line. ``t.screen`` is an instance of the :class:`Screen` that " "a Turtle instance exists on; it's created automatically along with the " "turtle." msgstr "" +"最後の行に注目してください。\n" +"``t.screen`` は、Turtle インスタンスが置かれている :class:`Screen` のインスタ" +"ンスです。\n" +"タートルとともに自動的に作成されます。" -#: ../../library/turtle.rst:313 msgid "The turtle's screen can be customised, for example::" msgstr "" +"タートルの画面はカスタマイズできます。\n" +"例えば次のようにします。 ::" -#: ../../library/turtle.rst:315 msgid "" "t.screen.title('Object-oriented turtle demo')\n" "t.screen.bgcolor(\"orange\")" msgstr "" +"t.screen.title('Object-oriented turtle demo')\n" +"t.screen.bgcolor(\"orange\")" #: ../../library/turtle.rst:320 msgid "Turtle graphics reference" @@ -992,7 +1039,6 @@ msgid "" msgstr "" "タートルが頭を向けている方へ、タートルを距離 *distance* だけ前進させます。" -#: ../../library/turtle.rst:485 msgid "" ">>> turtle.position()\n" "(0.00,0.00)\n" @@ -1003,6 +1049,14 @@ msgid "" ">>> turtle.position()\n" "(-50.00,0.00)" msgstr "" +">>> turtle.position()\n" +"(0.00,0.00)\n" +">>> turtle.forward(25)\n" +">>> turtle.position()\n" +"(25.00,0.00)\n" +">>> turtle.forward(-75)\n" +">>> turtle.position()\n" +"(-50.00,0.00)" #: ../../library/turtle.rst:502 ../../library/turtle.rst:744 #: ../../library/turtle.rst:1011 ../../library/turtle.rst:1542 @@ -1017,7 +1071,6 @@ msgstr "" "タートルが頭を向けている方と反対方向へ、タートルを距離 *distance* だけ後退さ" "せます。 タートルの向きは変えません。" -#: ../../library/turtle.rst:512 msgid "" ">>> turtle.position()\n" "(0.00,0.00)\n" @@ -1025,6 +1078,11 @@ msgid "" ">>> turtle.position()\n" "(-30.00,0.00)" msgstr "" +">>> turtle.position()\n" +"(0.00,0.00)\n" +">>> turtle.backward(30)\n" +">>> turtle.position()\n" +"(-30.00,0.00)" #: ../../library/turtle.rst:527 msgid "" @@ -1036,7 +1094,6 @@ msgstr "" "func:`degrees` と :func:`radians` 関数を使って設定できます。) 角度の向きは" "タートルのモードによって意味が変わります。 :func:`mode` を参照してください。" -#: ../../library/turtle.rst:537 msgid "" ">>> turtle.heading()\n" "22.0\n" @@ -1044,6 +1101,11 @@ msgid "" ">>> turtle.heading()\n" "337.0" msgstr "" +">>> turtle.heading()\n" +"22.0\n" +">>> turtle.right(45)\n" +">>> turtle.heading()\n" +"337.0" #: ../../library/turtle.rst:552 msgid "" @@ -1055,7 +1117,6 @@ msgstr "" "func:`degrees` と :func:`radians` 関数を使って設定できます。) 角度の向きは" "タートルのモードによって意味が変わります。 :func:`mode` を参照してください。" -#: ../../library/turtle.rst:562 msgid "" ">>> turtle.heading()\n" "22.0\n" @@ -1063,6 +1124,11 @@ msgid "" ">>> turtle.heading()\n" "67.0" msgstr "" +">>> turtle.heading()\n" +"22.0\n" +">>> turtle.left(45)\n" +">>> turtle.heading()\n" +"67.0" #: ../../library/turtle.rst:576 msgid "a number or a pair/vector of numbers" @@ -1119,7 +1185,6 @@ msgid "" "barrier like in goto(x, y)." msgstr "" -#: ../../library/turtle.rst:627 msgid "" ">>> tp = turtle.pos()\n" ">>> tp\n" @@ -1134,13 +1199,24 @@ msgid "" ">>> turtle.pos()\n" "(20.00,30.00)" msgstr "" +">>> tp = turtle.pos()\n" +">>> tp\n" +"(0.00,0.00)\n" +">>> turtle.teleport(60)\n" +">>> turtle.pos()\n" +"(60.00,0.00)\n" +">>> turtle.teleport(y=10)\n" +">>> turtle.pos()\n" +"(60.00,10.00)\n" +">>> turtle.teleport(20, 30)\n" +">>> turtle.pos()\n" +"(20.00,30.00)" #: ../../library/turtle.rst:650 msgid "" "Set the turtle's first coordinate to *x*, leave second coordinate unchanged." msgstr "タートルの第一座標を *x* にします。第二座標は変わりません。" -#: ../../library/turtle.rst:659 msgid "" ">>> turtle.position()\n" "(0.00,240.00)\n" @@ -1148,13 +1224,17 @@ msgid "" ">>> turtle.position()\n" "(10.00,240.00)" msgstr "" +">>> turtle.position()\n" +"(0.00,240.00)\n" +">>> turtle.setx(10)\n" +">>> turtle.position()\n" +"(10.00,240.00)" #: ../../library/turtle.rst:673 msgid "" "Set the turtle's second coordinate to *y*, leave first coordinate unchanged." msgstr "タートルの第二座標を *y* にします。第一座標は変わりません。" -#: ../../library/turtle.rst:681 msgid "" ">>> turtle.position()\n" "(0.00,40.00)\n" @@ -1162,6 +1242,11 @@ msgid "" ">>> turtle.position()\n" "(0.00,-10.00)" msgstr "" +">>> turtle.position()\n" +"(0.00,40.00)\n" +">>> turtle.sety(-10)\n" +">>> turtle.position()\n" +"(0.00,-10.00)" #: ../../library/turtle.rst:696 msgid "" @@ -1211,12 +1296,14 @@ msgstr "270 - 南" msgid "270 - west" msgstr "270 - 西" -#: ../../library/turtle.rst:708 msgid "" ">>> turtle.setheading(90)\n" ">>> turtle.heading()\n" "90.0" msgstr "" +">>> turtle.setheading(90)\n" +">>> turtle.heading()\n" +"90.0" #: ../../library/turtle.rst:718 msgid "" @@ -1226,7 +1313,6 @@ msgstr "" "タートルを原点 -- 座標 (0, 0) -- に移動し、向きを開始方向に設定します (開始方" "向はモードに依って違います。 :func:`mode` を参照してください)。" -#: ../../library/turtle.rst:728 msgid "" ">>> turtle.heading()\n" "90.0\n" @@ -1238,6 +1324,15 @@ msgid "" ">>> turtle.heading()\n" "0.0" msgstr "" +">>> turtle.heading()\n" +"90.0\n" +">>> turtle.position()\n" +"(0.00,-10.00)\n" +">>> turtle.home()\n" +">>> turtle.position()\n" +"(0.00,0.00)\n" +">>> turtle.heading()\n" +"0.0" #: ../../library/turtle.rst:745 msgid "a number (or ``None``)" @@ -1274,7 +1369,6 @@ msgstr "" "します。この値は与えられなければ自動的に計算されます。また、これを正多角形の" "描画に利用することもできます。" -#: ../../library/turtle.rst:760 msgid "" ">>> turtle.home()\n" ">>> turtle.position()\n" @@ -1292,6 +1386,21 @@ msgid "" ">>> turtle.heading()\n" "180.0" msgstr "" +">>> turtle.home()\n" +">>> turtle.position()\n" +"(0.00,0.00)\n" +">>> turtle.heading()\n" +"0.0\n" +">>> turtle.circle(50)\n" +">>> turtle.position()\n" +"(-0.00,0.00)\n" +">>> turtle.heading()\n" +"0.0\n" +">>> turtle.circle(120, 180) # 半円を描く\n" +">>> turtle.position()\n" +"(0.00,240.00)\n" +">>> turtle.heading()\n" +"180.0" #: ../../library/turtle.rst:782 msgid "an integer >= 1 (if given)" @@ -1309,7 +1418,6 @@ msgstr "" "直径 *size* の丸い点を *color* で指定された色で描きます。 *size* が与えられな" "かった場合、pensize+4 と 2*pensize の大きい方が使われます。" -#: ../../library/turtle.rst:789 msgid "" ">>> turtle.home()\n" ">>> turtle.dot()\n" @@ -1319,6 +1427,13 @@ msgid "" ">>> turtle.heading()\n" "0.0" msgstr "" +">>> turtle.home()\n" +">>> turtle.dot()\n" +">>> turtle.fd(50); turtle.dot(20, \"blue\"); turtle.fd(50)\n" +">>> turtle.position()\n" +"(100.00,-0.00)\n" +">>> turtle.heading()\n" +"0.0" #: ../../library/turtle.rst:803 msgid "" @@ -1330,12 +1445,14 @@ msgstr "" "ンコに対して stamp_id が返されますが、これを使うと後で " "``clearstamp(stamp_id)`` のように呼び出して消すことができます。" -#: ../../library/turtle.rst:807 msgid "" ">>> turtle.color(\"blue\")\n" ">>> stamp_id = turtle.stamp()\n" ">>> turtle.fd(50)" msgstr "" +">>> turtle.color(\"blue\")\n" +">>> stamp_id = turtle.stamp()\n" +">>> turtle.fd(50)" #: ../../library/turtle.rst:817 msgid "an integer, must be return value of previous :func:`stamp` call" @@ -1345,7 +1462,6 @@ msgstr "整数で、先立つ :func:`stamp` 呼出しで返された値でなけ msgid "Delete stamp with given *stampid*." msgstr "*stampid* に対応するハンコを消します。" -#: ../../library/turtle.rst:822 msgid "" ">>> turtle.position()\n" "(150.00,-0.00)\n" @@ -1358,6 +1474,16 @@ msgid "" ">>> turtle.position()\n" "(200.00,-0.00)" msgstr "" +">>> turtle.position()\n" +"(150.00,-0.00)\n" +">>> turtle.color(\"blue\")\n" +">>> astamp = turtle.stamp()\n" +">>> turtle.fd(50)\n" +">>> turtle.position()\n" +"(200.00,-0.00)\n" +">>> turtle.clearstamp(astamp)\n" +">>> turtle.position()\n" +"(200.00,-0.00)" #: ../../library/turtle.rst:841 msgid "" @@ -1369,7 +1495,6 @@ msgstr "" "合、全てのハンコを消します。 *n* が正の場合には最初の *n* 個、 *n* が負の場合" "には最後の *n* 個を消します。" -#: ../../library/turtle.rst:845 msgid "" ">>> for i in range(8):\n" "... unused_stamp_id = turtle.stamp()\n" @@ -1378,6 +1503,12 @@ msgid "" ">>> turtle.clearstamps(-2)\n" ">>> turtle.clearstamps()" msgstr "" +">>> for i in range(8):\n" +"... unused_stamp_id = turtle.stamp()\n" +"... turtle.fd(30)\n" +">>> turtle.clearstamps(2)\n" +">>> turtle.clearstamps(-2)\n" +">>> turtle.clearstamps()" #: ../../library/turtle.rst:857 msgid "" @@ -1387,7 +1518,6 @@ msgstr "" "最後の(繰り返すことにより複数の)タートルの動きを取り消します。取り消しできる" "動きの最大数は undobuffer のサイズによって決まります。" -#: ../../library/turtle.rst:860 msgid "" ">>> for i in range(4):\n" "... turtle.fd(50); turtle.lt(80)\n" @@ -1395,6 +1525,11 @@ msgid "" ">>> for i in range(8):\n" "... turtle.undo()" msgstr "" +">>> for i in range(4):\n" +"... turtle.fd(50); turtle.lt(80)\n" +"...\n" +">>> for i in range(8):\n" +"... turtle.undo()" #: ../../library/turtle.rst:872 msgid "an integer in the range 0..10 or a speedstring (see below)" @@ -1452,7 +1587,6 @@ msgstr "" "注意: *speed* = 0 はアニメーションを無くします。forward/backward ではタートル" "がジャンプし、left/right では瞬時に方向を変えます。" -#: ../../library/turtle.rst:893 msgid "" ">>> turtle.speed()\n" "3\n" @@ -1463,17 +1597,26 @@ msgid "" ">>> turtle.speed()\n" "9" msgstr "" +">>> turtle.speed()\n" +"3\n" +">>> turtle.speed('normal')\n" +">>> turtle.speed()\n" +"6\n" +">>> turtle.speed(9)\n" +">>> turtle.speed()\n" +"9" #: ../../library/turtle.rst:912 msgid "" "Return the turtle's current location (x,y) (as a :class:`Vec2D` vector)." msgstr "タートルの現在位置を (:class:`Vec2D` のベクトルとして) 返します。" -#: ../../library/turtle.rst:914 msgid "" ">>> turtle.pos()\n" "(440.00,-0.00)" msgstr "" +">>> turtle.pos()\n" +"(440.00,-0.00)" #: ../../library/turtle.rst:923 ../../library/turtle.rst:986 msgid "a number or a pair/vector of numbers or a turtle instance" @@ -1494,18 +1637,19 @@ msgstr "" "の開始方向にそして開始方向はモード (\"standard\"/\"world\" または \"logo\") " "に依存します。" -#: ../../library/turtle.rst:930 msgid "" ">>> turtle.goto(10, 10)\n" ">>> turtle.towards(0,0)\n" "225.0" msgstr "" +">>> turtle.goto(10, 10)\n" +">>> turtle.towards(0,0)\n" +"225.0" #: ../../library/turtle.rst:940 msgid "Return the turtle's x coordinate." msgstr "タートルの x 座標を返します。" -#: ../../library/turtle.rst:942 msgid "" ">>> turtle.home()\n" ">>> turtle.left(50)\n" @@ -1515,12 +1659,18 @@ msgid "" ">>> print(round(turtle.xcor(), 5))\n" "64.27876" msgstr "" +">>> turtle.home()\n" +">>> turtle.left(50)\n" +">>> turtle.forward(100)\n" +">>> turtle.pos()\n" +"(64.28,76.60)\n" +">>> print(round(turtle.xcor(), 5))\n" +"64.27876" #: ../../library/turtle.rst:956 msgid "Return the turtle's y coordinate." msgstr "タートルの y 座標を返します。" -#: ../../library/turtle.rst:958 msgid "" ">>> turtle.home()\n" ">>> turtle.left(60)\n" @@ -1530,6 +1680,13 @@ msgid "" ">>> print(round(turtle.ycor(), 5))\n" "86.60254" msgstr "" +">>> turtle.home()\n" +">>> turtle.left(60)\n" +">>> turtle.forward(100)\n" +">>> print(turtle.pos())\n" +"(50.00,86.60)\n" +">>> print(round(turtle.ycor(), 5))\n" +"86.60254" #: ../../library/turtle.rst:972 msgid "" @@ -1539,13 +1696,16 @@ msgstr "" "タートルの現在の向きを返します (返される値はタートルのモードに依存します。 :" "func:`mode` を参照してください)。" -#: ../../library/turtle.rst:975 msgid "" ">>> turtle.home()\n" ">>> turtle.left(67)\n" ">>> turtle.heading()\n" "67.0" msgstr "" +">>> turtle.home()\n" +">>> turtle.left(67)\n" +">>> turtle.heading()\n" +"67.0" #: ../../library/turtle.rst:989 msgid "" @@ -1555,7 +1715,6 @@ msgstr "" "タートルから与えられた (x,y) あるいはベクトルあるいは渡されたタートルへの距離" "を、タートルのステップを単位として測った値を返します。" -#: ../../library/turtle.rst:992 msgid "" ">>> turtle.home()\n" ">>> turtle.distance(30,40)\n" @@ -1567,10 +1726,18 @@ msgid "" ">>> turtle.distance(joe)\n" "77.0" msgstr "" +">>> turtle.home()\n" +">>> turtle.distance(30,40)\n" +"50.0\n" +">>> turtle.distance((30,40))\n" +"50.0\n" +">>> joe = Turtle()\n" +">>> joe.forward(77)\n" +">>> turtle.distance(joe)\n" +"77.0" -#: ../../library/turtle.rst:1007 msgid "Settings for measurement" -msgstr "設定と計測" +msgstr "測定の設定" #: ../../library/turtle.rst:1013 msgid "" @@ -1580,7 +1747,6 @@ msgstr "" "角度を計る単位「度」を、円周を何等分するかという値に指定します。デフォルトは" "360等分で通常の意味での度です。" -#: ../../library/turtle.rst:1016 msgid "" ">>> turtle.home()\n" ">>> turtle.left(90)\n" @@ -1596,6 +1762,19 @@ msgid "" ">>> turtle.heading()\n" "90.0" msgstr "" +">>> turtle.home()\n" +">>> turtle.left(90)\n" +">>> turtle.heading()\n" +"90.0\n" +"\n" +">>> # 角度の単位を grad に変更する (gon、grade、gradian とも呼ばれ、\n" +">>> # 直角の 1/100 に相当する)\n" +">>> turtle.degrees(400.0)\n" +">>> turtle.heading()\n" +"100.0\n" +">>> turtle.degrees(360)\n" +">>> turtle.heading()\n" +"90.0" #: ../../library/turtle.rst:1036 msgid "" @@ -1604,7 +1783,6 @@ msgid "" msgstr "" "角度を計る単位をラジアンにします。 ``degrees(2*math.pi)`` と同じ意味です。" -#: ../../library/turtle.rst:1039 msgid "" ">>> turtle.home()\n" ">>> turtle.left(90)\n" @@ -1614,6 +1792,13 @@ msgid "" ">>> turtle.heading()\n" "1.5707963267948966" msgstr "" +">>> turtle.home()\n" +">>> turtle.left(90)\n" +">>> turtle.heading()\n" +"90.0\n" +">>> turtle.radians()\n" +">>> turtle.heading()\n" +"1.5707963267948966" #: ../../library/turtle.rst:1067 msgid "Pull the pen down -- drawing when moving." @@ -1637,20 +1822,20 @@ msgstr "" "\"auto\" でタートルの形が多角形の場合、その多角形も同じ太さで描画されます。引" "数が渡されなければ、現在の pensize が返されます。" -#: ../../library/turtle.rst:1086 msgid "" ">>> turtle.pensize()\n" "1\n" ">>> turtle.pensize(10) # from here on lines of width 10 are drawn" msgstr "" +">>> turtle.pensize()\n" +"1\n" +">>> turtle.pensize(10) # これ以降は幅 10 の線を描く" -#: ../../library/turtle.rst:1096 msgid "a dictionary with some or all of the below listed keys" -msgstr "以下にリストされたキーをもった辞書" +msgstr "以下のキーの一部またはすべてを持つ辞書" -#: ../../library/turtle.rst:1097 msgid "one or more keyword-arguments with the below listed keys as keywords" -msgstr "以下にリストされたキーをキーワードとするキーワード引数" +msgstr "以下のキーをキーワードとする、1 つ以上のキーワード引数" #: ../../library/turtle.rst:1099 msgid "" @@ -1711,7 +1896,6 @@ msgstr "" "きます。さらに一つ以上の属性をキーワード引数として渡すこともできます。一つの" "文で幾つものペンの属性を設定するのに使えます。" -#: ../../library/turtle.rst:1118 msgid "" ">>> turtle.pen(fillcolor=\"black\", pencolor=\"red\", pensize=10)\n" ">>> sorted(turtle.pen().items())\n" @@ -1728,13 +1912,26 @@ msgid "" ">>> sorted(turtle.pen().items())[:3]\n" "[('fillcolor', 'green'), ('outline', 1), ('pencolor', 'red')]" msgstr "" +">>> turtle.pen(fillcolor=\"black\", pencolor=\"red\", pensize=10)\n" +">>> sorted(turtle.pen().items())\n" +"[('fillcolor', 'black'), ('outline', 1), ('pencolor', 'red'),\n" +" ('pendown', True), ('pensize', 10), ('resizemode', 'noresize'),\n" +" ('shearfactor', 0.0), ('shown', True), ('speed', 9),\n" +" ('stretchfactor', (1.0, 1.0)), ('tilt', 0.0)]\n" +">>> penstate=turtle.pen()\n" +">>> turtle.color(\"yellow\", \"\")\n" +">>> turtle.penup()\n" +">>> sorted(turtle.pen().items())[:3]\n" +"[('fillcolor', ''), ('outline', 1), ('pencolor', 'yellow')]\n" +">>> turtle.pen(penstate, fillcolor=\"green\")\n" +">>> sorted(turtle.pen().items())[:3]\n" +"[('fillcolor', 'green'), ('outline', 1), ('pencolor', 'red')]" #: ../../library/turtle.rst:1139 msgid "Return ``True`` if pen is down, ``False`` if it's up." msgstr "" "もしペンが下りていれば ``True`` を、上がっていれば ``False`` を返します。" -#: ../../library/turtle.rst:1141 msgid "" ">>> turtle.penup()\n" ">>> turtle.isdown()\n" @@ -1743,6 +1940,12 @@ msgid "" ">>> turtle.isdown()\n" "True" msgstr "" +">>> turtle.penup()\n" +">>> turtle.isdown()\n" +"False\n" +">>> turtle.pendown()\n" +">>> turtle.isdown()\n" +"True" #: ../../library/turtle.rst:1157 msgid "Return or set the pencolor." @@ -1810,7 +2013,6 @@ msgstr "" "タートルの形(turtleshape)が多角形の場合、多角形の外側が新しく設定された色で描" "かれます。" -#: ../../library/turtle.rst:1182 msgid "" ">>> colormode()\n" "1.0\n" @@ -1830,6 +2032,23 @@ msgid "" ">>> turtle.pencolor()\n" "(50.0, 193.0, 143.0)" msgstr "" +">>> colormode()\n" +"1.0\n" +">>> turtle.pencolor()\n" +"'red'\n" +">>> turtle.pencolor(\"brown\")\n" +">>> turtle.pencolor()\n" +"'brown'\n" +">>> tup = (0.2, 0.8, 0.55)\n" +">>> turtle.pencolor(tup)\n" +">>> turtle.pencolor()\n" +"(0.2, 0.8, 0.5490196078431373)\n" +">>> colormode(255)\n" +">>> turtle.pencolor()\n" +"(51.0, 204.0, 140.0)\n" +">>> turtle.pencolor('#32c18f')\n" +">>> turtle.pencolor()\n" +"(50.0, 193.0, 143.0)" #: ../../library/turtle.rst:1206 msgid "Return or set the fillcolor." @@ -1894,7 +2113,6 @@ msgstr "" "タートルの形(turtleshape)が多角形の場合、多角形の内側が新しく設定された色で描" "かれます。" -#: ../../library/turtle.rst:1231 msgid "" ">>> turtle.fillcolor(\"violet\")\n" ">>> turtle.fillcolor()\n" @@ -1908,6 +2126,17 @@ msgid "" ">>> turtle.fillcolor()\n" "(255.0, 255.0, 255.0)" msgstr "" +">>> turtle.fillcolor(\"violet\")\n" +">>> turtle.fillcolor()\n" +"'violet'\n" +">>> turtle.pencolor()\n" +"(50.0, 193.0, 143.0)\n" +">>> turtle.fillcolor((50, 193, 143)) # 浮動小数点数ではなく整数\n" +">>> turtle.fillcolor()\n" +"(50.0, 193.0, 143.0)\n" +">>> turtle.fillcolor('#ffffff')\n" +">>> turtle.fillcolor()\n" +"(255.0, 255.0, 255.0)" #: ../../library/turtle.rst:1249 msgid "Return or set pencolor and fillcolor." @@ -1968,7 +2197,6 @@ msgstr "" "タートルの形(turtleshape)が多角形の場合、多角形の内側も外側も新しく設定された" "色で描かれます。" -#: ../../library/turtle.rst:1270 msgid "" ">>> turtle.color(\"red\", \"green\")\n" ">>> turtle.color()\n" @@ -1977,6 +2205,12 @@ msgid "" ">>> color()\n" "((40.0, 80.0, 120.0), (160.0, 200.0, 240.0))" msgstr "" +">>> turtle.color(\"red\", \"green\")\n" +">>> turtle.color()\n" +"('red', 'green')\n" +">>> color(\"#285078\", \"#a0c8f0\")\n" +">>> color()\n" +"((40.0, 80.0, 120.0), (160.0, 200.0, 240.0))" #: ../../library/turtle.rst:1281 msgid "See also: Screen method :func:`colormode`." @@ -1986,56 +2220,68 @@ msgstr "こちらも参照: スクリーンのメソッド :func:`colormode` 。 msgid "Return fillstate (``True`` if filling, ``False`` else)." msgstr "" -#: ../../library/turtle.rst:1297 msgid "" ">>> turtle.begin_fill()\n" ">>> if turtle.filling():\n" "... turtle.pensize(5)\n" "... else:\n" "... turtle.pensize(3)" -msgstr "" +msgstr "" +">>> turtle.begin_fill()\n" +">>> if turtle.filling():\n" +"... turtle.pensize(5)\n" +"... else:\n" +"... turtle.pensize(3)" -#: ../../library/turtle.rst:1308 msgid "Fill the shape drawn in the ``with turtle.fill():`` block." -msgstr "" +msgstr "``with turtle.fill():`` ブロック内で描いた図形を塗りつぶします。" -#: ../../library/turtle.rst:1310 msgid "" ">>> turtle.color(\"black\", \"red\")\n" ">>> with turtle.fill():\n" "... turtle.circle(80)" msgstr "" +">>> turtle.color(\"black\", \"red\")\n" +">>> with turtle.fill():\n" +"... turtle.circle(80)" -#: ../../library/turtle.rst:1317 msgid "" "Using :func:`!fill` is equivalent to adding the :func:`begin_fill` before " "the fill-block and :func:`end_fill` after the fill-block:" msgstr "" +":func:`!fill` を使うことは、塗りつぶしのブロックの前に :func:`begin_fill`、後" +"に :func:`end_fill` を追加するのと同等です。" -#: ../../library/turtle.rst:1320 ../../library/turtle.rst:1345 msgid "" ">>> turtle.color(\"black\", \"red\")\n" ">>> turtle.begin_fill()\n" ">>> turtle.circle(80)\n" ">>> turtle.end_fill()" msgstr "" +">>> turtle.color(\"black\", \"red\")\n" +">>> turtle.begin_fill()\n" +">>> turtle.circle(80)\n" +">>> turtle.end_fill()" -#: ../../library/turtle.rst:1333 msgid "To be called just before drawing a shape to be filled." -msgstr "" +msgstr "塗りつぶす図形を描く直前に呼び出します。" #: ../../library/turtle.rst:1338 msgid "Fill the shape drawn after the last call to :func:`begin_fill`." msgstr "" "最後に呼び出された :func:`begin_fill` の後に描かれた図形を塗りつぶします。" -#: ../../library/turtle.rst:1340 msgid "" "Whether or not overlap regions for self-intersecting polygons or multiple " "shapes are filled depends on the operating system graphics, type of overlap, " "and number of overlaps. For example, the Turtle star above may be either " "all yellow or have some white regions." msgstr "" +"自己交差する多角形や複数の図形で、重なった領域が塗りつぶされるかどうかは、オ" +"ペレーティングシステムの描画機能や重なり方、重なった回数によって変わりま" +"す。\n" +"例えば、上のタートルで描いた星形は、全体が黄色になる場合もあれば、白い領域が" +"残る場合もあります。" #: ../../library/turtle.rst:1359 msgid "" @@ -2045,7 +2291,6 @@ msgstr "" "タートルの描いたものをスクリーンから消し、タートルを中心に戻して、全ての変数" "をデフォルト値に設定し直します。" -#: ../../library/turtle.rst:1362 msgid "" ">>> turtle.goto(0,-22)\n" ">>> turtle.left(100)\n" @@ -2059,6 +2304,17 @@ msgid "" ">>> turtle.heading()\n" "0.0" msgstr "" +">>> turtle.goto(0,-22)\n" +">>> turtle.left(100)\n" +">>> turtle.position()\n" +"(0.00,-22.00)\n" +">>> turtle.heading()\n" +"100.0\n" +">>> turtle.reset()\n" +">>> turtle.position()\n" +"(0.00,0.00)\n" +">>> turtle.heading()\n" +"0.0" #: ../../library/turtle.rst:1380 msgid "" @@ -2145,7 +2401,6 @@ msgstr "" "についての扱いを学ぶには Screen のメソッド :func:`register_shape` を参照して" "下さい。" -#: ../../library/turtle.rst:1455 msgid "" ">>> turtle.shape()\n" "'classic'\n" @@ -2153,6 +2408,11 @@ msgid "" ">>> turtle.shape()\n" "'turtle'" msgstr "" +">>> turtle.shape()\n" +"'classic'\n" +">>> turtle.shape(\"turtle\")\n" +">>> turtle.shape()\n" +"'turtle'" #: ../../library/turtle.rst:1467 msgid "one of the strings \"auto\", \"user\", \"noresize\"" @@ -2195,7 +2455,6 @@ msgstr "" "``resizemode(\"user\")`` は :func:`shapesize` に引数を渡したときに呼び出され" "ます。" -#: ../../library/turtle.rst:1481 msgid "" ">>> turtle.resizemode()\n" "'noresize'\n" @@ -2203,6 +2462,11 @@ msgid "" ">>> turtle.resizemode()\n" "'auto'" msgstr "" +">>> turtle.resizemode()\n" +"'noresize'\n" +">>> turtle.resizemode(\"auto\")\n" +">>> turtle.resizemode()\n" +"'auto'" #: ../../library/turtle.rst:1494 ../../library/turtle.rst:1495 #: ../../library/turtle.rst:1496 @@ -2225,7 +2489,6 @@ msgstr "" "*stretch_len* は進行方向に沿ったの伸長係数、 *outline* は形のアウトラインの幅" "を決めるものです。" -#: ../../library/turtle.rst:1505 msgid "" ">>> turtle.shapesize()\n" "(1.0, 1.0, 1)\n" @@ -2237,13 +2500,19 @@ msgid "" ">>> turtle.shapesize()\n" "(5, 5, 8)" msgstr "" +">>> turtle.shapesize()\n" +"(1.0, 1.0, 1)\n" +">>> turtle.resizemode(\"user\")\n" +">>> turtle.shapesize(5, 5, 12)\n" +">>> turtle.shapesize()\n" +"(5, 5, 12)\n" +">>> turtle.shapesize(outline=8)\n" +">>> turtle.shapesize()\n" +"(5, 5, 8)" -#: ../../library/turtle.rst:1521 ../../library/turtle.rst:2193 -#: ../../library/turtle.rst:2194 ../../library/turtle.rst:2195 msgid "number (optional)" -msgstr "" +msgstr "数 (省略可能)" -#: ../../library/turtle.rst:1523 msgid "" "Set or return the current shearfactor. Shear the turtleshape according to " "the given shearfactor shear, which is the tangent of the shear angle. Do " @@ -2251,8 +2520,13 @@ msgid "" "given: return the current shearfactor, i. e. the tangent of the shear angle, " "by which lines parallel to the heading of the turtle are sheared." msgstr "" +"現在のせん断係数を設定または取得します。\n" +"せん断角の正接である係数 ``shear`` に従って、タートルの形状をせん断変形しま" +"す。\n" +"タートルの向き (進行方向) は *変わりません*。\n" +"``shear`` を指定しなければ、現在のせん断係数、つまりタートルの進行方向に平行" +"な線のせん断角の正接を返します。" -#: ../../library/turtle.rst:1530 msgid "" ">>> turtle.shape(\"circle\")\n" ">>> turtle.shapesize(5,2)\n" @@ -2260,6 +2534,11 @@ msgid "" ">>> turtle.shearfactor()\n" "0.5" msgstr "" +">>> turtle.shape(\"circle\")\n" +">>> turtle.shapesize(5,2)\n" +">>> turtle.shearfactor(0.5)\n" +">>> turtle.shearfactor()\n" +"0.5" #: ../../library/turtle.rst:1544 msgid "" @@ -2269,7 +2548,6 @@ msgstr "" "タートルの形(turtleshape)を現在の傾斜角から角度(*angle*)だけ回転します。この" "ときタートルの進む方向は *変わりません* 。" -#: ../../library/turtle.rst:1547 msgid "" ">>> turtle.reset()\n" ">>> turtle.shape(\"circle\")\n" @@ -2279,14 +2557,17 @@ msgid "" ">>> turtle.tilt(30)\n" ">>> turtle.fd(50)" msgstr "" +">>> turtle.reset()\n" +">>> turtle.shape(\"circle\")\n" +">>> turtle.shapesize(5,2)\n" +">>> turtle.tilt(30)\n" +">>> turtle.fd(50)\n" +">>> turtle.tilt(30)\n" +">>> turtle.fd(50)" -#: ../../library/turtle.rst:1561 ../../library/turtle.rst:1584 -#: ../../library/turtle.rst:1585 ../../library/turtle.rst:1586 -#: ../../library/turtle.rst:1587 msgid "a number (optional)" -msgstr "" +msgstr "数 (省略可能)" -#: ../../library/turtle.rst:1563 msgid "" "Set or return the current tilt-angle. If angle is given, rotate the " "turtleshape to point in the direction specified by angle, regardless of its " @@ -2295,8 +2576,13 @@ msgid "" "angle between the orientation of the turtleshape and the heading of the " "turtle (its direction of movement)." msgstr "" +"現在の傾斜角を設定または取得します。\n" +"``angle`` を指定すると、現在の傾斜角にかかわらず、タートルの形状を ``angle`` " +"の方向に回転させます。\n" +"タートルの向き (進行方向) は *変わりません*。\n" +"``angle`` を指定しなければ、現在の傾斜角、つまりタートルの形状の向きと進行方" +"向との間の角度を返します。" -#: ../../library/turtle.rst:1571 msgid "" ">>> turtle.reset()\n" ">>> turtle.shape(\"circle\")\n" @@ -2305,12 +2591,16 @@ msgid "" ">>> turtle.tiltangle()\n" "45.0" msgstr "" +">>> turtle.reset()\n" +">>> turtle.shape(\"circle\")\n" +">>> turtle.shapesize(5,2)\n" +">>> turtle.tilt(45)\n" +">>> turtle.tiltangle()\n" +"45.0" -#: ../../library/turtle.rst:1589 msgid "Set or return the current transformation matrix of the turtle shape." -msgstr "" +msgstr "タートルの形状の現在の変換行列を設定または取得します。" -#: ../../library/turtle.rst:1591 msgid "" "If none of the matrix elements are given, return the transformation matrix " "as a tuple of 4 elements. Otherwise set the given elements and transform the " @@ -2319,8 +2609,13 @@ msgid "" "otherwise an error is raised. Modify stretchfactor, shearfactor and " "tiltangle according to the given matrix." msgstr "" +"行列の要素を何も指定しなければ、変換行列を 4 要素のタプルとして返します。\n" +"指定した場合はその要素を設定し、第 1 行が ``t11``、``t12``、第 2 行が " +"``t21``、``t22`` の行列に従ってタートルの形状を変換します。\n" +"行列式 ``t11 * t22 - t12 * t21`` は 0 であってはならず、0 の場合はエラーを送" +"出します。\n" +"指定された行列に応じて、伸縮率、せん断係数、傾斜角を変更します。" -#: ../../library/turtle.rst:1600 msgid "" ">>> turtle = Turtle()\n" ">>> turtle.shape(\"square\")\n" @@ -2329,20 +2624,30 @@ msgid "" ">>> turtle.shapetransform()\n" "(4.0, -1.0, -0.0, 2.0)" msgstr "" +">>> turtle = Turtle()\n" +">>> turtle.shape(\"square\")\n" +">>> turtle.shapesize(4,2)\n" +">>> turtle.shearfactor(-0.5)\n" +">>> turtle.shapetransform()\n" +"(4.0, -1.0, -0.0, 2.0)" -#: ../../library/turtle.rst:1613 msgid "" "Return the current shape polygon as tuple of coordinate pairs. This can be " "used to define a new shape or components of a compound shape." msgstr "" +"現在の形状の多角形を、座標ペアのタプルとして返します。\n" +"新しい形状や、複合形状の構成要素を定義するために使えます。" -#: ../../library/turtle.rst:1616 msgid "" ">>> turtle.shape(\"square\")\n" ">>> turtle.shapetransform(4, -1, 0, 2)\n" ">>> turtle.get_shapepoly()\n" "((50, -20), (30, 20), (-50, 20), (-30, -20))" msgstr "" +">>> turtle.shape(\"square\")\n" +">>> turtle.shapetransform(4, -1, 0, 2)\n" +">>> turtle.get_shapepoly()\n" +"((50, -20), (30, 20), (-50, 20), (-30, -20))" #: ../../library/turtle.rst:1631 ../../library/turtle.rst:1653 #: ../../library/turtle.rst:1678 ../../library/turtle.rst:2117 @@ -2377,7 +2682,6 @@ msgstr "" "``None`` ならば、既存の束縛が取り除かれます。無名タートル、つまり手続き的なや" "り方の例です:" -#: ../../library/turtle.rst:1641 msgid "" ">>> def turn(x, y):\n" "... left(180)\n" @@ -2385,6 +2689,11 @@ msgid "" ">>> onclick(turn) # Now clicking into the turtle will turn it.\n" ">>> onclick(None) # event-binding will be removed" msgstr "" +">>> def turn(x, y):\n" +"... left(180)\n" +"...\n" +">>> onclick(turn) # タートルをクリックすると向きが変わる\n" +">>> onclick(None) # イベントの束縛を削除する" #: ../../library/turtle.rst:1659 msgid "" @@ -2394,7 +2703,6 @@ msgstr "" "*fun* をタートルのマウスボタンリリース(mouse-button-release)イベントに束縛し" "ます。 *fun* が ``None`` ならば、既存の束縛が取り除かれます。" -#: ../../library/turtle.rst:1662 msgid "" ">>> class MyTurtle(Turtle):\n" "... def glow(self,x,y):\n" @@ -2407,6 +2715,16 @@ msgid "" "red,\n" ">>> turtle.onrelease(turtle.unglow) # releasing turns it to transparent." msgstr "" +">>> class MyTurtle(Turtle):\n" +"... def glow(self,x,y):\n" +"... self.fillcolor(\"red\")\n" +"... def unglow(self,x,y):\n" +"... self.fillcolor(\"\")\n" +"...\n" +">>> turtle = MyTurtle()\n" +">>> turtle.onclick(turtle.glow) # タートルをクリックすると塗りつぶしの色" +"が赤になり、\n" +">>> turtle.onrelease(turtle.unglow) # ボタンを離すと透明になる" #: ../../library/turtle.rst:1684 msgid "" @@ -2424,9 +2742,8 @@ msgstr "" "注意: 全てのマウスムーブイベントのシーケンスに先立ってマウスクリックイベント" "が起こります。" -#: ../../library/turtle.rst:1690 msgid ">>> turtle.ondrag(turtle.goto)" -msgstr "" +msgstr ">>> turtle.ondrag(turtle.goto)" #: ../../library/turtle.rst:1695 msgid "" @@ -2436,19 +2753,23 @@ msgstr "" "この後、タートルをクリックしてドラッグするとタートルはスクリーン上を動きそれ" "によって(ペンが下りていれば)手書きの線ができあがります。" -#: ../../library/turtle.rst:1705 msgid "" "Record the vertices of a polygon drawn in the ``with turtle.poly():`` block. " "The first and last vertices will be connected." msgstr "" +"``with turtle.poly():`` ブロック内で描いた多角形の頂点を記録します。\n" +"最初と最後の頂点は結ばれます。" -#: ../../library/turtle.rst:1708 msgid "" ">>> with turtle.poly():\n" "... turtle.forward(100)\n" "... turtle.right(60)\n" "... turtle.forward(100)" msgstr "" +">>> with turtle.poly():\n" +"... turtle.forward(100)\n" +"... turtle.right(60)\n" +"... turtle.forward(100)" #: ../../library/turtle.rst:1721 msgid "" @@ -2468,7 +2789,6 @@ msgstr "" msgid "Return the last recorded polygon." msgstr "最後に記録された多角形を返します。" -#: ../../library/turtle.rst:1735 msgid "" ">>> turtle.home()\n" ">>> turtle.begin_poly()\n" @@ -2481,6 +2801,16 @@ msgid "" ">>> p = turtle.get_poly()\n" ">>> register_shape(\"myFavouriteShape\", p)" msgstr "" +">>> turtle.home()\n" +">>> turtle.begin_poly()\n" +">>> turtle.fd(100)\n" +">>> turtle.left(20)\n" +">>> turtle.fd(30)\n" +">>> turtle.left(60)\n" +">>> turtle.fd(50)\n" +">>> turtle.end_poly()\n" +">>> p = turtle.get_poly()\n" +">>> register_shape(\"myFavouriteShape\", p)" #: ../../library/turtle.rst:1752 msgid "" @@ -2504,13 +2834,16 @@ msgstr "" "Turtle オブジェクトそのものを返します。唯一の意味のある使い方: 無名タートルを" "返す関数として使う:" -#: ../../library/turtle.rst:1768 msgid "" ">>> pet = getturtle()\n" ">>> pet.fd(50)\n" ">>> pet\n" "" msgstr "" +">>> pet = getturtle()\n" +">>> pet.fd(50)\n" +">>> pet\n" +"" #: ../../library/turtle.rst:1779 msgid "" @@ -2520,13 +2853,16 @@ msgstr "" "タートルが描画中の :class:`TurtleScreen` オブジェクトを返します。 " "TurtleScreen のメソッドをそのオブジェクトに対して呼び出すことができます。" -#: ../../library/turtle.rst:1782 msgid "" ">>> ts = turtle.getscreen()\n" ">>> ts\n" "\n" ">>> ts.bgcolor(\"pink\")" msgstr "" +">>> ts = turtle.getscreen()\n" +">>> ts\n" +"\n" +">>> ts.bgcolor(\"pink\")" #: ../../library/turtle.rst:1793 msgid "an integer or ``None``" @@ -2544,19 +2880,19 @@ msgstr "" "func:`undo` メソッド/関数で取り消せるかの最大数を与えます。 *size* が " "``None`` ならば、アンドゥバッファは無効化されます。" -#: ../../library/turtle.rst:1800 msgid ">>> turtle.setundobuffer(42)" -msgstr "" +msgstr ">>> turtle.setundobuffer(42)" #: ../../library/turtle.rst:1808 msgid "Return number of entries in the undobuffer." msgstr "アンドゥバッファのエントリー数を返します。" -#: ../../library/turtle.rst:1810 msgid "" ">>> while undobufferentries():\n" "... undo()" msgstr "" +">>> while undobufferentries():\n" +"... undo()" #: ../../library/turtle.rst:1821 msgid "Compound shapes" @@ -2601,11 +2937,12 @@ msgid "Now add the Shape to the Screen's shapelist and use it:" msgstr "" "こうして作った Shape を Screen の形のリスト(shapelist) に追加して使います:" -#: ../../library/turtle.rst:1844 msgid "" ">>> register_shape(\"myshape\", s)\n" ">>> shape(\"myshape\")" msgstr "" +">>> register_shape(\"myshape\", s)\n" +">>> shape(\"myshape\")" #: ../../library/turtle.rst:1853 msgid "" @@ -2641,7 +2978,6 @@ msgstr "" msgid "Set or return background color of the TurtleScreen." msgstr "TurtleScreen の背景色を設定するかまたは返します。" -#: ../../library/turtle.rst:1881 msgid "" ">>> screen.bgcolor(\"orange\")\n" ">>> screen.bgcolor()\n" @@ -2650,12 +2986,19 @@ msgid "" ">>> screen.bgcolor()\n" "(128.0, 0.0, 128.0)" msgstr "" +">>> screen.bgcolor(\"orange\")\n" +">>> screen.bgcolor()\n" +"'orange'\n" +">>> screen.bgcolor(\"#800080\")\n" +">>> screen.bgcolor()\n" +"(128.0, 0.0, 128.0)" -#: ../../library/turtle.rst:1894 msgid "" "a string, name of an image file (PNG, GIF, PGM, and PPM) or ``\"nopic\"``, " "or ``None``" msgstr "" +"画像ファイル (PNG、GIF、PGM、PPM) の名前を表す文字列、``\"nopic\"``、または " +"``None``" #: ../../library/turtle.rst:1897 msgid "" @@ -2774,7 +3117,6 @@ msgid "" "distorted." msgstr "**重要なお知らせ**: ユーザー定義座標系では角度が歪むかもしれません。" -#: ../../library/turtle.rst:1974 msgid "" ">>> screen.reset()\n" ">>> screen.setworldcoordinates(-50,-7.5,50,7.5)\n" @@ -2784,6 +3126,13 @@ msgid "" ">>> for _ in range(8):\n" "... left(45); fd(2) # a regular octagon" msgstr "" +">>> screen.reset()\n" +">>> screen.setworldcoordinates(-50,-7.5,50,7.5)\n" +">>> for _ in range(72):\n" +"... left(10)\n" +"...\n" +">>> for _ in range(8):\n" +"... left(45); fd(2) # 正八角形" #: ../../library/turtle.rst:1999 msgid "" @@ -2792,13 +3141,16 @@ msgid "" "the drawing will appear." msgstr "" -#: ../../library/turtle.rst:2003 msgid "" ">>> with screen.no_animation():\n" "... for dist in range(2, 400, 2):\n" "... fd(dist)\n" "... rt(90)" msgstr "" +">>> with screen.no_animation():\n" +"... for dist in range(2, 400, 2):\n" +"... fd(dist)\n" +"... rt(90)" #: ../../library/turtle.rst:2016 msgid "positive integer" @@ -2818,7 +3170,6 @@ msgstr "" msgid "Optional argument:" msgstr "オプション引数:" -#: ../../library/turtle.rst:2024 msgid "" ">>> screen.delay()\n" "10\n" @@ -2826,6 +3177,11 @@ msgid "" ">>> screen.delay()\n" "5" msgstr "" +">>> screen.delay()\n" +"10\n" +">>> screen.delay(5)\n" +">>> screen.delay()\n" +"5" #: ../../library/turtle.rst:2036 ../../library/turtle.rst:2037 msgid "nonnegative integer" @@ -2845,7 +3201,6 @@ msgstr "" "現在保存されている n の値を返します。二つ目の引数は遅延の値を設定します(:" "func:`delay` も参照)。" -#: ../../library/turtle.rst:2046 msgid "" ">>> screen.tracer(8, 25)\n" ">>> dist = 2\n" @@ -2854,6 +3209,12 @@ msgid "" "... rt(90)\n" "... dist += 2" msgstr "" +">>> screen.tracer(8, 25)\n" +">>> dist = 2\n" +">>> for i in range(200):\n" +"... fd(dist)\n" +"... rt(90)\n" +"... dist += 2" #: ../../library/turtle.rst:2059 msgid "Perform a TurtleScreen update. To be used when tracer is turned off." @@ -2891,7 +3252,6 @@ msgstr "" "できるようにするためには TurtleScreen はフォーカスを持っていないとなりません" "(:func:`listen` を参照)。" -#: ../../library/turtle.rst:2083 msgid "" ">>> def f():\n" "... fd(50)\n" @@ -2900,13 +3260,22 @@ msgid "" ">>> screen.onkey(f, \"Up\")\n" ">>> screen.listen()" msgstr "" +">>> def f():\n" +"... fd(50)\n" +"... lt(60)\n" +"...\n" +">>> screen.onkey(f, \"Up\")\n" +">>> screen.listen()" -#: ../../library/turtle.rst:2099 msgid "" "Bind *fun* to key-press event of key if key is given, or to any key-press-" "event if no key is given. Remark: in order to be able to register key-" "events, TurtleScreen must have focus. (See method :func:`listen`.)" msgstr "" +"``key`` を指定した場合はそのキーの押下イベントに、指定しなければ任意のキーの" +"押下イベントに *fun* を束縛します。\n" +"キーイベントを受け取るには、TurtleScreen にフォーカスが必要です (:func:" +"`listen` を参照)。" #: ../../library/turtle.rst:2104 msgid "" @@ -2933,7 +3302,6 @@ msgstr "" "Example for a ``screen`` という名の TurtleScreen インスタンスと ``turtle`` と" "いう名前の Turtle インスタンスの例:" -#: ../../library/turtle.rst:2129 msgid "" ">>> screen.onclick(turtle.goto) # Subsequently clicking into the " "TurtleScreen will\n" @@ -2941,6 +3309,9 @@ msgid "" "point.\n" ">>> screen.onclick(None) # remove event binding again" msgstr "" +">>> screen.onclick(turtle.goto) # これ以降、TurtleScreen をクリックすると\n" +">>> # その点にタートルが移動する\n" +">>> screen.onclick(None) # イベントの束縛を削除する" #: ../../library/turtle.rst:2137 msgid "" @@ -2964,7 +3335,6 @@ msgstr "数 >= 0" msgid "Install a timer that calls *fun* after *t* milliseconds." msgstr "*t* ミリ秒後に *fun* を呼び出すタイマーを仕掛けます。" -#: ../../library/turtle.rst:2149 msgid "" ">>> running = True\n" ">>> def f():\n" @@ -2975,6 +3345,14 @@ msgid "" ">>> f() ### makes the turtle march around\n" ">>> running = False" msgstr "" +">>> running = True\n" +">>> def f():\n" +"... if running:\n" +"... fd(50)\n" +"... lt(60)\n" +"... screen.ontimer(f, 250)\n" +">>> f() ### タートルを歩き回らせる\n" +">>> running = False" #: ../../library/turtle.rst:2165 msgid "" @@ -3001,9 +3379,8 @@ msgid "" "``None``. ::" msgstr "" -#: ../../library/turtle.rst:2186 msgid ">>> screen.textinput(\"NIM\", \"Name of first player:\")" -msgstr "" +msgstr ">>> screen.textinput(\"NIM\", \"Name of first player:\")" #: ../../library/turtle.rst:2197 msgid "" @@ -3016,11 +3393,12 @@ msgid "" "return ``None``. ::" msgstr "" -#: ../../library/turtle.rst:2206 msgid "" ">>> screen.numinput(\"Poker\", \"Your stakes:\", 1000, minval=10, " "maxval=10000)" msgstr "" +">>> screen.numinput(\"Poker\", \"Your stakes:\", 1000, minval=10, " +"maxval=10000)" #: ../../library/turtle.rst:2214 msgid "one of the strings \"standard\", \"logo\" or \"world\"" @@ -3102,7 +3480,6 @@ msgstr "" "定した後は、色トリプルの *r*, *g*, *b* 値は 0 から *cmode* の範囲になければな" "りません。" -#: ../../library/turtle.rst:2246 msgid "" ">>> screen.colormode(1)\n" ">>> turtle.pencolor(240, 160, 80)\n" @@ -3116,6 +3493,17 @@ msgid "" "255\n" ">>> turtle.pencolor(240,160,80)" msgstr "" +">>> screen.colormode(1)\n" +">>> turtle.pencolor(240, 160, 80)\n" +"Traceback (most recent call last):\n" +" ...\n" +"TurtleGraphicsError: bad color sequence: (240, 160, 80)\n" +">>> screen.colormode()\n" +"1.0\n" +">>> screen.colormode(255)\n" +">>> screen.colormode()\n" +"255\n" +">>> turtle.pencolor(240,160,80)" #: ../../library/turtle.rst:2264 msgid "" @@ -3125,36 +3513,38 @@ msgstr "" "この TurtleScreen の Canvas を返します。Tkinter の Canvas を使って何をするか" "知っている人には有用です。" -#: ../../library/turtle.rst:2267 msgid "" ">>> cv = screen.getcanvas()\n" ">>> cv\n" "" msgstr "" +">>> cv = screen.getcanvas()\n" +">>> cv\n" +"" -#: ../../library/turtle.rst:2277 msgid "Return a list of names of all currently available turtle shapes." -msgstr "現在使うことのできる全てのタートルの形のリストを返します。" +msgstr "現在利用できるすべてのタートルの形状の名前を、リストで返します。" -#: ../../library/turtle.rst:2279 msgid "" ">>> screen.getshapes()\n" "['arrow', 'blank', 'circle', ..., 'turtle']" msgstr "" +">>> screen.getshapes()\n" +"['arrow', 'blank', 'circle', ..., 'turtle']" #: ../../library/turtle.rst:2289 msgid "There are four different ways to call this function:" msgstr "" -#: ../../library/turtle.rst:2291 msgid "" "*name* is the name of an image file (PNG, GIF, PGM, and PPM) and *shape* is " "``None``: Install the corresponding image shape. ::" msgstr "" +"*name* が画像ファイル (PNG、GIF、PGM、PPM) の名前で *shape* が ``None`` の場" +"合: 対応する画像の形状を登録します。 ::" -#: ../../library/turtle.rst:2294 msgid ">>> screen.register_shape(\"turtle.gif\")" -msgstr "" +msgstr ">>> screen.register_shape(\"turtle.gif\")" #: ../../library/turtle.rst:2297 ../../library/turtle.rst:2306 msgid "" @@ -3164,15 +3554,15 @@ msgstr "" "画像の形はタートルが向きを変えても *回転しません* ので、タートルがどちらを向" "いているか見ても判りません!" -#: ../../library/turtle.rst:2300 msgid "" "*name* is an arbitrary string and *shape* is the name of an image file (PNG, " "GIF, PGM, and PPM): Install the corresponding image shape. ::" msgstr "" +"*name* が任意の文字列で *shape* が画像ファイル (PNG、GIF、PGM、PPM) の名前の" +"場合: 対応する画像の形状を登録します。 ::" -#: ../../library/turtle.rst:2303 msgid ">>> screen.register_shape(\"turtle\", \"turtle.gif\")" -msgstr "" +msgstr ">>> screen.register_shape(\"turtle\", \"turtle.gif\")" #: ../../library/turtle.rst:2309 msgid "" @@ -3182,9 +3572,8 @@ msgstr "" "*name* が任意の文字列で *shape* が座標ペアのタプル: 対応する多角形を取り込み" "ます。" -#: ../../library/turtle.rst:2312 msgid ">>> screen.register_shape(\"triangle\", ((5,-3), (0,5), (-5,-3)))" -msgstr "" +msgstr ">>> screen.register_shape(\"triangle\", ((5,-3), (0,5), (-5,-3)))" #: ../../library/turtle.rst:2317 msgid "" @@ -3202,41 +3591,45 @@ msgstr "" "タートルの形を TurtleScreen の形リスト(shapelist)に加えます。このように登録さ" "れた形だけが ``shape(shapename)`` コマンドに使えます。" -#: ../../library/turtle.rst:2323 msgid "" "Added support for PNG, PGM, and PPM image formats. Both a shape name and an " "image file name can be specified." msgstr "" +"PNG、PGM、PPM の画像形式のサポートが追加されました。\n" +"形状名と画像ファイル名の両方を指定できるようになりました。" #: ../../library/turtle.rst:2330 msgid "Return the list of turtles on the screen." msgstr "スクリーン上のタートルのリストを返します。" -#: ../../library/turtle.rst:2332 msgid "" ">>> for turtle in screen.turtles():\n" "... turtle.color(\"red\")" msgstr "" +">>> for turtle in screen.turtles():\n" +"... turtle.color(\"red\")" #: ../../library/turtle.rst:2341 msgid "Return the height of the turtle window. ::" msgstr "タートルウィンドウの高さを返します。 ::" -#: ../../library/turtle.rst:2343 msgid "" ">>> screen.window_height()\n" "480" msgstr "" +">>> screen.window_height()\n" +"480" #: ../../library/turtle.rst:2349 msgid "Return the width of the turtle window. ::" msgstr "タートルウィンドウの幅を返します。 ::" -#: ../../library/turtle.rst:2351 msgid "" ">>> screen.window_width()\n" "640" msgstr "" +">>> screen.window_width()\n" +"640" #: ../../library/turtle.rst:2358 msgid "Methods specific to Screen, not inherited from TurtleScreen" @@ -3264,26 +3657,29 @@ msgstr "" "``True`` とされているべきです。この場合、IDLE のメインループもクライアントス" "クリプトから見てアクティブです。" -#: ../../library/turtle.rst:2379 msgid "Save the current turtle drawing (and turtles) as a PostScript file." msgstr "" +"現在のタートルの描画内容 (タートル自身も含む) を PostScript ファイルとして保" +"存します。" -#: ../../library/turtle.rst:2381 msgid "the path of the saved PostScript file" -msgstr "" +msgstr "保存する PostScript ファイルのパス" -#: ../../library/turtle.rst:2382 msgid "" "if ``False`` and there already exists a file with the given filename, then " "the function will raise a ``FileExistsError``. If it is ``True``, the file " "will be overwritten." msgstr "" +"``False`` で、指定された名前のファイルがすでに存在する場合は、" +"``FileExistsError`` を送出します。\n" +"``True`` の場合は、ファイルを上書きします。" -#: ../../library/turtle.rst:2387 msgid "" ">>> screen.save(\"my_drawing.ps\")\n" ">>> screen.save(\"my_drawing.ps\", overwrite=True)" msgstr "" +">>> screen.save(\"my_drawing.ps\")\n" +">>> screen.save(\"my_drawing.ps\", overwrite=True)" #: ../../library/turtle.rst:2397 msgid "" @@ -3326,13 +3722,16 @@ msgstr "" "正の数ならばスクリーンの上端からピクセル単位で測った開始位置、 負の数ならば下" "端から、``None`` ならば垂直方向に真ん中" -#: ../../library/turtle.rst:2412 msgid "" ">>> screen.setup (width=200, height=200, startx=0, starty=0)\n" ">>> # sets window to 200x200 pixels, in upper left of screen\n" ">>> screen.setup(width=.75, height=0.5, startx=None, starty=None)\n" ">>> # sets window to 75% of screen by 50% of screen and centers" msgstr "" +">>> screen.setup (width=200, height=200, startx=0, starty=0)\n" +">>> # 画面の左上に 200x200 ピクセルのウィンドウを設定する\n" +">>> screen.setup(width=.75, height=0.5, startx=None, starty=None)\n" +">>> # 画面の幅の75%、高さの50%のウィンドウを中央に設定する" #: ../../library/turtle.rst:2423 msgid "a string that is shown in the titlebar of the turtle graphics window" @@ -3342,19 +3741,18 @@ msgstr "タートルグラフィックスウィンドウのタイトルバーに msgid "Set title of turtle window to *titlestring*." msgstr "ウインドウのタイトルを *titlestring* に設定します。" -#: ../../library/turtle.rst:2428 msgid ">>> screen.title(\"Welcome to the turtle zoo!\")" -msgstr "" +msgstr ">>> screen.title(\"Welcome to the turtle zoo!\")" -#: ../../library/turtle.rst:2435 msgid "Public classes" -msgstr "" +msgstr "公開クラス" -#: ../../library/turtle.rst:2441 msgid "" "a :class:`!tkinter.Canvas`, a :class:`ScrolledCanvas` or a :class:" "`TurtleScreen`" msgstr "" +":class:`!tkinter.Canvas`、:class:`ScrolledCanvas`、または :class:" +"`TurtleScreen`" #: ../../library/turtle.rst:2444 msgid "" @@ -3372,9 +3770,8 @@ msgstr "" "RawTurtle のサブクラスで同じインターフェイスを持ちますが、最初に必要になった" "とき自動的に作られる :class:`Screen` オブジェクトに描画します。" -#: ../../library/turtle.rst:2456 msgid "a :class:`!tkinter.Canvas`" -msgstr "" +msgstr ":class:`!tkinter.Canvas`" #: ../../library/turtle.rst:2458 msgid "" @@ -3524,28 +3921,34 @@ msgstr "``a.rotate(angle)`` 回転" msgid "Explanation" msgstr "説明" -#: ../../library/turtle.rst:2531 msgid "" "A turtle object draws on a screen object, and there a number of key classes " "in the turtle object-oriented interface that can be used to create them and " "relate them to each other." msgstr "" +"タートルオブジェクトは画面オブジェクト上に描画します。\n" +"タートルのオブジェクト指向インターフェースには、これらを作成して関連付けるた" +"めの主要なクラスがいくつかあります。" -#: ../../library/turtle.rst:2535 msgid "" "A :class:`Turtle` instance will automatically create a :class:`Screen` " "instance if one is not already present." msgstr "" +":class:`Turtle` インスタンスは、まだ :class:`Screen` インスタンスがなければ、" +"自動的に作成します。" -#: ../../library/turtle.rst:2538 msgid "" "``Turtle`` is a subclass of :class:`RawTurtle`, which *doesn't* " "automatically create a drawing surface - a *canvas* will need to be provided " "or created for it. The *canvas* can be a :class:`!tkinter.Canvas`, :class:" "`ScrolledCanvas` or :class:`TurtleScreen`." msgstr "" +"``Turtle`` は :class:`RawTurtle` のサブクラスです。\n" +"RawTurtle は描画領域を自動的には作成 *しない* ため、*canvas* を渡すか作成する" +"必要があります。\n" +"*canvas* には :class:`!tkinter.Canvas`、:class:`ScrolledCanvas`、:class:" +"`TurtleScreen` を使えます。" -#: ../../library/turtle.rst:2544 msgid "" ":class:`TurtleScreen` is the basic drawing surface for a turtle. :class:" "`Screen` is a subclass of ``TurtleScreen``, and includes :ref:`some " @@ -3553,8 +3956,13 @@ msgid "" "size and title) and behaviour. ``TurtleScreen``'s constructor needs a :class:" "`!tkinter.Canvas` or a :class:`ScrolledCanvas` as an argument." msgstr "" +":class:`TurtleScreen` はタートルの基本的な描画領域です。\n" +":class:`Screen` は ``TurtleScreen`` のサブクラスで、サイズやタイトルを含む見" +"た目と動作を管理するための :ref:`追加のメソッド ` を備えてい" +"ます。\n" +"``TurtleScreen`` のコンストラクタには、:class:`!tkinter.Canvas` または :" +"class:`ScrolledCanvas` を引数として渡す必要があります。" -#: ../../library/turtle.rst:2551 msgid "" "The functional interface for turtle graphics uses the various methods of " "``Turtle`` and ``TurtleScreen``/``Screen``. Behind the scenes, a screen " @@ -3562,12 +3970,19 @@ msgid "" "``Screen`` method is called. Similarly, a turtle object is automatically " "created whenever any of the functions derived from a Turtle method is called." msgstr "" +"タートルグラフィックスの関数インターフェースは、``Turtle`` と " +"``TurtleScreen``/``Screen`` のさまざまなメソッドを使っています。\n" +"内部では、``Screen`` のメソッドに由来する関数を呼び出すと、画面オブジェクトが" +"自動的に作成されます。\n" +"同様に、Turtle のメソッドに由来する関数を呼び出すと、タートルオブジェクトが自" +"動的に作成されます。" -#: ../../library/turtle.rst:2557 msgid "" "To use multiple turtles on a screen, the object-oriented interface must be " "used." msgstr "" +"1 つの画面で複数のタートルを使うには、オブジェクト指向インターフェースを使う" +"必要があります。" #: ../../library/turtle.rst:2562 msgid "Help and configuration" @@ -3639,7 +4054,6 @@ msgid "" "modified form::" msgstr "メソッドに由来する関数のドキュメント文字列は変更された形をとります::" -#: ../../library/turtle.rst:2608 msgid "" ">>> help(bgcolor)\n" "Help on function bgcolor in module turtle:\n" @@ -3672,6 +4086,36 @@ msgid "" " Example:\n" " >>> penup()" msgstr "" +">>> help(bgcolor)\n" +"Help on function bgcolor in module turtle:\n" +"\n" +"bgcolor(*args)\n" +" Set or return backgroundcolor of the TurtleScreen.\n" +"\n" +" Arguments (if given): a color string or three numbers\n" +" in the range 0..colormode or a 3-tuple of such numbers.\n" +"\n" +" Example::\n" +"\n" +" >>> bgcolor(\"orange\")\n" +" >>> bgcolor()\n" +" \"orange\"\n" +" >>> bgcolor(0.5,0,0.5)\n" +" >>> bgcolor()\n" +" \"#800080\"\n" +"\n" +">>> help(penup)\n" +"Help on function penup in module turtle:\n" +"\n" +"penup()\n" +" Pull the pen up -- no drawing when moving.\n" +"\n" +" Aliases: penup | pu | up\n" +"\n" +" No argument\n" +"\n" +" Example:\n" +" >>> penup()" #: ../../library/turtle.rst:2639 msgid "" @@ -3770,7 +4214,6 @@ msgid "" "The built in configuration would correspond to the following ``turtle.cfg``:" msgstr "初期設定は以下の ``turtle.cfg`` に対応します:" -#: ../../library/turtle.rst:2685 msgid "" "width = 0.5\n" "height = 0.75\n" @@ -3793,6 +4236,26 @@ msgid "" "title = Python Turtle Graphics\n" "using_IDLE = False" msgstr "" +"width = 0.5\n" +"height = 0.75\n" +"leftright = None\n" +"topbottom = None\n" +"canvwidth = 400\n" +"canvheight = 300\n" +"mode = standard\n" +"colormode = 1.0\n" +"delay = 10\n" +"undobuffersize = 1000\n" +"shape = classic\n" +"pencolor = black\n" +"fillcolor = black\n" +"resizemode = noresize\n" +"visible = True\n" +"language = english\n" +"exampleturtle = turtle\n" +"examplescreen = screen\n" +"title = Python Turtle Graphics\n" +"using_IDLE = False" #: ../../library/turtle.rst:2708 msgid "Short explanation of selected entries:" @@ -3902,30 +4365,27 @@ msgstr "" "のスクリプトは以下のように、付属のデモビューアを使用して実行および表示できま" "す::" -#: ../../library/turtle.rst:2750 msgid "python -m turtledemo" -msgstr "" +msgstr "python -m turtledemo" #: ../../library/turtle.rst:2752 msgid "" "Alternatively, you can run the demo scripts individually. For example, ::" msgstr "あるいは、個別にデモスクリプトを実行できます。たとえば 、::" -#: ../../library/turtle.rst:2754 msgid "python -m turtledemo.bytedesign" -msgstr "" +msgstr "python -m turtledemo.bytedesign" #: ../../library/turtle.rst:2756 msgid "The :mod:`turtledemo` package directory contains:" msgstr ":mod:`turtledemo` パッケージのディレクトリには次のものが含まれます:" -#: ../../library/turtle.rst:2758 msgid "" "A demo viewer :file:`__main__.py` which can be used to view the sourcecode " "of the scripts and run them at the same time." msgstr "" "ソースコードを眺めつつスクリプトを実行できるデモビュワー :file:`__main__." -"py` 。 " +"py` 。" #: ../../library/turtle.rst:2760 msgid "" @@ -4010,13 +4470,11 @@ msgstr "r, g, b の実験" msgid "forest" msgstr "" -#: ../../library/turtle.rst:2789 msgid "3 breadth-first trees" -msgstr "" +msgstr "幅優先で描く 3 本の木" -#: ../../library/turtle.rst:2789 msgid "randomization" -msgstr "" +msgstr "ランダム化" #: ../../library/turtle.rst:2791 msgid "fractalcurves" @@ -4058,14 +4516,12 @@ msgstr "ハノイ盤として正方形のタートル (shape, shapesize)" msgid "nim" msgstr "" -#: ../../library/turtle.rst:2800 msgid "" "play the classical nim game with three heaps of sticks against the computer." -msgstr "" +msgstr "棒の山を 3 つ使う古典的なニムゲームで、コンピュータと対戦します。" -#: ../../library/turtle.rst:2800 msgid "turtles as nimsticks, event driven (mouse, keyboard)" -msgstr "" +msgstr "タートルをニムの棒として使用、イベント駆動 (マウス、キーボード)" #: ../../library/turtle.rst:2804 msgid "paint" @@ -4123,9 +4579,8 @@ msgstr ":func:`clone`, :func:`undo`" msgid "round_dance" msgstr "" -#: ../../library/turtle.rst:2819 msgid "dancing turtles rotating pairwise in opposite direction" -msgstr "" +msgstr "ペアごとに逆向きに回転しながら踊るタートル" #: ../../library/turtle.rst:2819 msgid "compound shapes, clone shapesize, tilt, get_shapepoly, update" @@ -4135,13 +4590,11 @@ msgstr "" msgid "sorting_animate" msgstr "" -#: ../../library/turtle.rst:2823 msgid "visual demonstration of different sorting methods" -msgstr "" +msgstr "さまざまなソート方法を視覚的に実演" -#: ../../library/turtle.rst:2823 msgid "simple alignment, randomization" -msgstr "" +msgstr "単純な整列、ランダム化" #: ../../library/turtle.rst:2826 msgid "tree" @@ -4155,13 +4608,11 @@ msgstr "(図形的) 幅優先木 (ジェネレータを使って)" msgid "two_canvases" msgstr "" -#: ../../library/turtle.rst:2829 msgid "simple design" -msgstr "" +msgstr "単純な図柄" -#: ../../library/turtle.rst:2829 msgid "turtles on two canvases" -msgstr "" +msgstr "2 つのキャンバス上のタートル" #: ../../library/turtle.rst:2832 msgid "yinyang" diff --git a/library/types.po b/library/types.po index cadac3e25..875e7c025 100644 --- a/library/types.po +++ b/library/types.po @@ -22,10 +22,10 @@ msgstr "" "Last-Translator: Takanori Suzuki , 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/types.rst:2 @@ -54,13 +54,12 @@ msgstr "" "`int` や :class:`str` のように組み込みとして公開されていないようないくつかの" "オブジェクト型の名前を定義しています。" -#: ../../library/types.rst:18 msgid "" "Finally, it provides some additional type-related utility classes and " "functions that are not fundamental enough to be builtins." msgstr "" -"最後に、組み込みになるほど基本的でないような追加の型関連のユーティリティと関" -"数をいくつか提供しています。" +"さらに、組み込みにするほど基本的ではない、型に関連する補助的なユーティリティ" +"クラスや関数も提供します。" #: ../../library/types.rst:23 msgid "Dynamic Type Creation" @@ -147,11 +146,9 @@ msgstr ":pep:`3115` - Metaclasses in Python 3000" msgid "Introduced the ``__prepare__`` namespace hook" msgstr "``__prepare__`` 名前空間フックの導入" -#: ../../library/types.rst:74 msgid "Resolve MRO entries dynamically as specified by :pep:`560`." -msgstr "" +msgstr ":pep:`560` の規定に従って MRO の項目を動的に解決します。" -#: ../../library/types.rst:76 msgid "" "This function looks for items in *bases* that are not instances of :class:" "`type`, and returns a tuple where each such object that has an :meth:" @@ -160,28 +157,40 @@ msgid "" "it doesn't have an :meth:`!__mro_entries__` method, then it is included in " "the return tuple unchanged." msgstr "" +"この関数は *bases* から :class:`type` のインスタンスでない項目を探します。\n" +"そのようなオブジェクトが :meth:`~object.__mro_entries__` メソッドを持つ場合" +"は、このメソッドの呼び出し結果を展開して置き換えたタプルを返します。\n" +"*bases* の項目が :class:`type` のインスタンスであるか、:meth:`!" +"__mro_entries__` メソッドを持たない場合は、変更せずに戻り値のタプルに含めま" +"す。" -#: ../../library/types.rst:87 msgid "" "Return the tuple of objects originally given as the bases of *cls* before " "the :meth:`~object.__mro_entries__` method has been called on any bases " "(following the mechanisms laid out in :pep:`560`). This is useful for " "introspecting :ref:`Generics `." msgstr "" +":pep:`560` の仕組みに従って各基底の :meth:`~object.__mro_entries__` メソッド" +"が呼び出される前に、*cls* の基底として最初に指定されたオブジェクトのタプルを" +"返します。\n" +":ref:`ジェネリック ` のイントロスペクションに役立ちま" +"す。" -#: ../../library/types.rst:92 msgid "" "For classes that have an ``__orig_bases__`` attribute, this function returns " "the value of ``cls.__orig_bases__``. For classes without the " "``__orig_bases__`` attribute, :attr:`cls.__bases__ ` is " "returned." msgstr "" +"クラスが ``__orig_bases__`` 属性を持つ場合は、``cls.__orig_bases__`` の値を返" +"します。\n" +"``__orig_bases__`` 属性を持たない場合は、:attr:`cls.__bases__ ` を返します。" #: ../../library/types.rst:97 msgid "Examples::" msgstr "例::" -#: ../../library/types.rst:99 msgid "" "from typing import TypeVar, Generic, NamedTuple, TypedDict\n" "\n" @@ -207,6 +216,29 @@ msgid "" "assert int.__bases__ == (object,)\n" "assert get_original_bases(int) == (object,)" msgstr "" +"from typing import TypeVar, Generic, NamedTuple, TypedDict\n" +"\n" +"T = TypeVar(\"T\")\n" +"class Foo(Generic[T]): ...\n" +"class Bar(Foo[int], float): ...\n" +"class Baz(list[str]): ...\n" +"Eggs = NamedTuple(\"Eggs\", [(\"a\", int), (\"b\", str)])\n" +"Spam = TypedDict(\"Spam\", {\"a\": int, \"b\": str})\n" +"\n" +"assert Bar.__bases__ == (Foo, float)\n" +"assert get_original_bases(Bar) == (Foo[int], float)\n" +"\n" +"assert Baz.__bases__ == (list,)\n" +"assert get_original_bases(Baz) == (list[str],)\n" +"\n" +"assert Eggs.__bases__ == (tuple,)\n" +"assert get_original_bases(Eggs) == (NamedTuple,)\n" +"\n" +"assert Spam.__bases__ == (dict,)\n" +"assert get_original_bases(Spam) == (TypedDict,)\n" +"\n" +"assert int.__bases__ == (object,)\n" +"assert get_original_bases(int) == (object,)" #: ../../library/types.rst:127 msgid ":pep:`560` - Core support for typing module and generic types" @@ -259,13 +291,12 @@ msgid "" msgstr "" "ユーザ定義の関数と :keyword:`lambda` 式によって生成された関数の型です。" -#: ../../library/types.rst:159 msgid "" "Raises an :ref:`auditing event ` ``function.__new__`` with " "argument ``code``." msgstr "" "引数 ``code`` を指定して :ref:`監査イベント ` ``function.__new__`` " -"を送出します。 " +"を送出します。" #: ../../library/types.rst:161 msgid "" @@ -283,13 +314,12 @@ msgstr "" "ジェネレータ関数によって生成された :term:`ジェネレータ ` イテレー" "タオブジェクトの型です。" -#: ../../library/types.rst:173 msgid "" "The type of :term:`coroutine` objects, created by :keyword:`async def` " "functions." msgstr "" ":keyword:`async def` 関数に生成される :term:`コルーチン ` オブジェ" -"クトです。" +"クトの型です。" #: ../../library/types.rst:181 msgid "" @@ -299,13 +329,13 @@ msgstr "" "非同期ジェネレータ関数によって作成された :term:`非同期ジェネレータ " "` イテレータオブジェクトの型です。" -#: ../../library/types.rst:191 msgid "" "The type of :ref:`code objects ` such as returned by :func:" "`compile`." msgstr "" +":func:`compile` が返すものなど、:ref:`コードオブジェクト ` の型" +"です。" -#: ../../library/types.rst:193 msgid "" "Raises an :ref:`auditing event ` ``code.__new__`` with arguments " "``code``, ``filename``, ``name``, ``argcount``, ``posonlyargcount``, " @@ -313,20 +343,25 @@ msgid "" msgstr "" "引数 ``code``, ``filename``, ``name``, ``argcount``, ``posonlyargcount``, " "``kwonlyargcount``, ``nlocals``, ``stacksize``, ``flags`` を指定して :ref:`監" -"査イベント ` ``code.__new__`` を送出します。 " +"査イベント ` ``code.__new__`` を送出します。" -#: ../../library/types.rst:195 msgid "" "Note that the audited arguments may not match the names or positions " "required by the initializer. The audit event only occurs for direct " "instantiation of code objects, and is not raised for normal compilation." msgstr "" +"監査の対象となる引数の名前や位置は、初期化子が要求するものと一致しない場合が" +"あります。\n" +"この監査イベントはコードオブジェクトを直接インスタンス化したときにのみ発生" +"し、通常のコンパイル時には発生しません。" -#: ../../library/types.rst:201 msgid "" "The type for cell objects: such objects are used as containers for a " "function's :term:`closure variables `." msgstr "" +"セルオブジェクトの型です。\n" +"セルオブジェクトは、関数の :term:`クロージャ変数 ` を格納す" +"るコンテナとして使われます。" #: ../../library/types.rst:209 msgid "The type of methods of user-defined class instances." @@ -342,32 +377,34 @@ msgstr "" "の型です。 (ここでは \"組み込み\" という単語を \"Cで書かれた\" という意味で" "使っています)" -#: ../../library/types.rst:222 msgid "" "The type of methods of some built-in data types and base classes such as :" "meth:`object.__init__` or :meth:`object.__lt__`." msgstr "" +":meth:`object.__init__` や :meth:`object.__lt__` など、一部の組み込みデータ型" +"や基底クラスのメソッドの型です。" -#: ../../library/types.rst:230 msgid "" "The type of *bound* methods of some built-in data types and base classes. " "For example it is the type of :code:`object().__str__`." msgstr "" +"一部の組み込みデータ型や基底クラスの *束縛された* メソッドの型です。\n" +"例えば :code:`object().__str__` の型がこれに当たります。" #: ../../library/types.rst:238 msgid "The type of :data:`NotImplemented`." msgstr ":data:`NotImplemented` の型です。" -#: ../../library/types.rst:245 msgid "" "The type of methods of some built-in data types such as :meth:`str.join`." -msgstr "" +msgstr ":meth:`str.join` など、一部の組み込みデータ型のメソッドの型です。" -#: ../../library/types.rst:252 msgid "" "The type of *unbound* class methods of some built-in data types such as " "``dict.__dict__['fromkeys']``." msgstr "" +"``dict.__dict__['fromkeys']`` など、一部の組み込みデータ型の *束縛されていな" +"い* クラスメソッドの型です。" #: ../../library/types.rst:260 msgid "" @@ -377,21 +414,19 @@ msgstr "" ":term:`module` の型です。コンストラクタは生成するモジュールの名前と任意でそ" "の :term:`docstring` を受け取ります。" -#: ../../library/types.rst:265 msgid ":ref:`Documentation on module objects `" -msgstr "" +msgstr ":ref:`モジュールオブジェクトのドキュメント `" -#: ../../library/types.rst:266 msgid "" "Provides details on the special attributes that can be found on instances " "of :class:`!ModuleType`." msgstr "" +":class:`!ModuleType` のインスタンスが持つ特殊属性について詳しく説明していま" +"す。" -#: ../../library/types.rst:269 msgid ":func:`importlib.util.module_from_spec`" -msgstr "" +msgstr ":func:`importlib.util.module_from_spec`" -#: ../../library/types.rst:270 msgid "" "Modules created using the :class:`!ModuleType` constructor are created with " "many of their special attributes unset or set to default values. :func:`!" @@ -399,25 +434,32 @@ msgid "" "ModuleType` instances which ensures the various attributes are set " "appropriately." msgstr "" +":class:`!ModuleType` コンストラクタで作成したモジュールでは、多くの特殊属性が" +"未設定かデフォルト値のままです。\n" +":func:`!module_from_spec` を使うと、各種属性が適切に設定される、より確実な方" +"法で :class:`!ModuleType` のインスタンスを作成できます。" #: ../../library/types.rst:278 msgid "The type of :data:`Ellipsis`." msgstr ":data:`Ellipsis` の型です。" -#: ../../library/types.rst:284 msgid "" "The type of :ref:`parameterized generics ` such as " "``list[int]``." msgstr "" +"``list[int]`` など、:ref:`パラメータ化されたジェネリック ` の型です。" -#: ../../library/types.rst:287 msgid "" "``t_origin`` should be a non-parameterized generic class, such as ``list``, " "``tuple`` or ``dict``. ``t_args`` should be a :class:`tuple` (possibly of " "length 1) of types which parameterize ``t_origin``::" msgstr "" +"``t_origin`` は ``list``、``tuple``、``dict`` などのパラメータ化されていない" +"ジェネリッククラスである必要があります。\n" +"``t_args`` は ``t_origin`` をパラメータ化する型の :class:`tuple` です (長さ" +"が 1 でも構いません)。 ::" -#: ../../library/types.rst:291 msgid "" ">>> from types import GenericAlias\n" "\n" @@ -426,35 +468,36 @@ msgid "" ">>> dict[str, int] == GenericAlias(dict, (str, int))\n" "True" msgstr "" +">>> from types import GenericAlias\n" +"\n" +">>> list[int] == GenericAlias(list, (int,))\n" +"True\n" +">>> dict[str, int] == GenericAlias(dict, (str, int))\n" +"True" -#: ../../library/types.rst:300 msgid "This type can now be subclassed." -msgstr "" +msgstr "この型のサブクラスを作成できるようになりました。" -#: ../../library/types.rst:305 msgid ":ref:`Generic Alias Types`" -msgstr "" +msgstr ":ref:`ジェネリックエイリアス型 `" -#: ../../library/types.rst:306 msgid "In-depth documentation on instances of :class:`!types.GenericAlias`" msgstr "" +":class:`!types.GenericAlias` のインスタンスについて詳しく説明したドキュメント" #: ../../library/types.rst:308 msgid ":pep:`585` - Type Hinting Generics In Standard Collections" msgstr "" ":pep:`585` - 標準コレクション型の型ヒントにおける総称型 (generics) の使用" -#: ../../library/types.rst:309 msgid "Introducing the :class:`!types.GenericAlias` class" -msgstr "" +msgstr ":class:`!types.GenericAlias` クラスの導入" -#: ../../library/types.rst:313 msgid "The type of :ref:`union type expressions`." -msgstr "" +msgstr ":ref:`ユニオン型の式 ` の型です。" -#: ../../library/types.rst:319 msgid "This is now an alias for :class:`typing.Union`." -msgstr "" +msgstr ":class:`typing.Union` のエイリアスになりました。" #: ../../library/types.rst:323 msgid "" @@ -464,20 +507,22 @@ msgstr "" "``sys.exception().__traceback__`` に含まれるようなトレースバックオブジェクト" "の型です。" -#: ../../library/types.rst:325 msgid "" "See :ref:`the language reference ` for details of the " "available attributes and operations, and guidance on creating tracebacks " "dynamically." msgstr "" +"利用できる属性と操作の詳細、およびトレースバックを動的に作成する方法は、:ref:" +"`言語リファレンス ` を参照してください。" -#: ../../library/types.rst:332 msgid "" "The type of :ref:`frame objects ` such as found in :attr:`tb." "tb_frame ` if ``tb`` is a traceback object." msgstr "" +"``tb`` がトレースバックオブジェクトである場合の :attr:`tb.tb_frame " +"` など、:ref:`フレームオブジェクト ` の型" +"です。" -#: ../../library/types.rst:338 msgid "" "The type of objects defined in extension modules with ``PyGetSetDef``, such " "as :attr:`FrameType.f_locals ` or ``array.array.typecode``. " @@ -485,8 +530,13 @@ msgid "" "purpose as the :class:`property` type, but for classes defined in extension " "modules." msgstr "" +":attr:`FrameType.f_locals ` や ``array.array.typecode`` な" +"ど、拡張モジュールで ``PyGetSetDef`` を使って定義されたオブジェクトの型で" +"す。\n" +"この型はオブジェクトの属性のデスクリプタとして使われます。\n" +":class:`property` 型と同じ目的を持ちますが、拡張モジュールで定義されたクラス" +"用です。" -#: ../../library/types.rst:347 msgid "" "The type of objects defined in extension modules with ``PyMemberDef``, such " "as ``datetime.timedelta.days``. This type is used as descriptor for simple " @@ -494,18 +544,24 @@ msgid "" "purpose as the :class:`property` type, but for classes defined in extension " "modules." msgstr "" -"``datetime.timedelta.days`` のような、拡張モジュールにおいて ``PyMemberDef`` " -"によって定義されたオブジェクトの型です。この型は、標準の変換関数を利用するよ" -"うな、Cのシンプルなデータメンバで利用されます。 :class:`property` 型と同じ目" -"的を持った型ですが、こちらは拡張モジュールで定義された型のためのものです。" +"``datetime.timedelta.days`` など、拡張モジュールで ``PyMemberDef`` を使って定" +"義されたオブジェクトの型です。\n" +"この型は、標準の変換関数を利用する単純な C データメンバーのデスクリプタとして" +"使われます。\n" +":class:`property` 型と同じ目的を持ちますが、拡張モジュールで定義されたクラス" +"用です。" -#: ../../library/types.rst:352 msgid "" "In addition, when a class is defined with a :attr:`~object.__slots__` " "attribute, then for each slot, an instance of :class:`!MemberDescriptorType` " "will be added as an attribute on the class. This allows the slot to appear " "in the class's :attr:`~type.__dict__`." msgstr "" +"また、クラスが :attr:`~object.__slots__` 属性を使って定義されている場合は、各" +"スロットに対して :class:`!MemberDescriptorType` のインスタンスがクラス属性と" +"して追加されます。\n" +"これにより、スロットがクラスの :attr:`~type.__dict__` に現れるようになりま" +"す。" #: ../../library/types.rst:358 msgid "" @@ -525,11 +581,12 @@ msgstr "" "ビューを提供します。つまり、マッピングが変わった場合にビューがこれらの変更を" "反映するということです。" -#: ../../library/types.rst:371 msgid "" "Updated to support the new union (``|``) operator from :pep:`584`, which " "simply delegates to the underlying mapping." msgstr "" +":pep:`584` の新しい和集合演算子 (``|``) に対応しました。\n" +"演算はそのまま元になったマッピングに委譲します。" #: ../../library/types.rst:376 msgid "" @@ -588,17 +645,14 @@ msgstr "元になったマッピングの keys に対する新しいビューを msgid "Return a new view of the underlying mapping's values." msgstr "元になったマッピングの values に対する新しいビューを返します。" -#: ../../library/types.rst:418 msgid "Return a reverse iterator over the keys of the underlying mapping." -msgstr "" +msgstr "元になったマッピングのキーを逆順にたどるイテレータを返します。" -#: ../../library/types.rst:424 msgid "Return a hash of the underlying mapping." -msgstr "" +msgstr "元になったマッピングのハッシュ値を返します。" -#: ../../library/types.rst:430 msgid "The type of :ref:`capsule objects `." -msgstr "" +msgstr ":ref:`カプセルオブジェクト ` の型です。" #: ../../library/types.rst:436 msgid "Additional Utility Classes and Functions" @@ -612,13 +666,13 @@ msgstr "" "名前空間への属性アクセスに加えて意味のある repr を提供するための、単純な :" "class:`object` サブクラスです。" -#: ../../library/types.rst:443 msgid "" "Unlike :class:`object`, with :class:`!SimpleNamespace` you can add and " "remove attributes." msgstr "" +":class:`object` とは異なり、:class:`!SimpleNamespace` では属性を追加したり削" +"除したりできます。" -#: ../../library/types.rst:446 msgid "" ":py:class:`SimpleNamespace` objects may be initialized in the same way as :" "class:`dict`: either with keyword arguments, with a single positional " @@ -628,12 +682,20 @@ msgid "" "key-value pairs from that argument (either a mapping object or an :term:" "`iterable` object producing key-value pairs). All such keys must be strings." msgstr "" +":py:class:`SimpleNamespace` オブジェクトは :class:`dict` と同じように、キー" +"ワード引数、単一の位置引数、またはその両方で初期化できます。\n" +"キーワード引数で初期化する場合は、それらが内部の名前空間に直接追加されま" +"す。\n" +"位置引数で初期化する場合は、その引数から得られるキーと値のペアで内部の名前空" +"間を更新します。\n" +"位置引数には、マッピングオブジェクトか、キーと値のペアを生成する :term:`イテ" +"ラブル ` オブジェクトを指定できます。\n" +"これらのキーはすべて文字列でなければなりません。" #: ../../library/types.rst:457 msgid "The type is roughly equivalent to the following code::" msgstr "この型は以下のコードとほぼ等価です::" -#: ../../library/types.rst:459 msgid "" "class SimpleNamespace:\n" " def __init__(self, mapping_or_iterable=(), /, **kwargs):\n" @@ -650,6 +712,20 @@ msgid "" " return self.__dict__ == other.__dict__\n" " return NotImplemented" msgstr "" +"class SimpleNamespace:\n" +" def __init__(self, mapping_or_iterable=(), /, **kwargs):\n" +" self.__dict__.update(mapping_or_iterable)\n" +" self.__dict__.update(kwargs)\n" +"\n" +" def __repr__(self):\n" +" items = (f\"{k}={v!r}\" for k, v in self.__dict__.items())\n" +" return \"{}({})\".format(type(self).__name__, \", \".join(items))\n" +"\n" +" def __eq__(self, other):\n" +" if isinstance(self, SimpleNamespace) and isinstance(other, " +"SimpleNamespace):\n" +" return self.__dict__ == other.__dict__\n" +" return NotImplemented" #: ../../library/types.rst:473 msgid "" @@ -661,20 +737,21 @@ msgstr "" "ません。ですが、構造化されたレコード型に対しては、これよりはむしろ :func:" "`~collections.namedtuple` を使用してください。" -#: ../../library/types.rst:477 msgid "" ":class:`!SimpleNamespace` objects are supported by :func:`copy.replace`." msgstr "" +":func:`copy.replace` は :class:`!SimpleNamespace` オブジェクトに対応していま" +"す。" -#: ../../library/types.rst:481 msgid "" "Attribute order in the repr changed from alphabetical to insertion (like " "``dict``)." msgstr "" +"repr での属性の順序が、アルファベット順から (``dict`` と同じ) 挿入順に変わり" +"ました。" -#: ../../library/types.rst:485 msgid "Added support for an optional positional argument." -msgstr "" +msgstr "省略可能な位置引数に対応しました。" #: ../../library/types.rst:490 msgid "Route attribute access on a class to __getattr__." @@ -705,7 +782,6 @@ msgstr "" msgid "Coroutine Utility Functions" msgstr "コルーチンユーティリティ関数" -#: ../../library/types.rst:508 msgid "" "This function transforms a :term:`generator` function into a :term:" "`coroutine function` which returns a generator-based coroutine. The " @@ -714,15 +790,17 @@ msgid "" "However, it may not necessarily implement the :meth:`~object.__await__` " "method." msgstr "" -"この関数は、 :term:`generator` 関数を、ジェネレータベースのコルーチンを返す :" -"term:`coroutine function` に変換します。返されるジェネレータベースのコルーチ" -"ンは依然として :term:`generator iterator` ですが、同時に :term:`coroutine` オ" -"ブジェクトかつ :term:`awaitable` であるとみなされます。ただし、必ずしも :" -"meth:`~object.__await__` メソッドを実装する必要はありません。" +"この関数は :term:`ジェネレータ ` 関数を、ジェネレータベースのコ" +"ルーチンを返す :term:`コルーチン関数 ` に変換します。\n" +"ジェネレータベースのコルーチンは依然として :term:`ジェネレータイテレータ " +"` ですが、:term:`コルーチン ` オブジェクトか" +"つ :term:`awaitable` ともみなされます。\n" +"ただし、必ずしも :meth:`~object.__await__` メソッドを実装しているとは限りませ" +"ん。" -#: ../../library/types.rst:515 msgid "If *gen_func* is a generator function, it will be modified in-place." -msgstr "*gen_func* はジェネレータ関数で、インプレースに変更されます。" +msgstr "" +"*gen_func* がジェネレータ関数の場合、その関数をインプレースに変更します。" #: ../../library/types.rst:517 msgid "" diff --git a/library/typing.po b/library/typing.po index 1c3f87736..3a3791852 100644 --- a/library/typing.po +++ b/library/typing.po @@ -23,15 +23,15 @@ msgstr "" "Last-Translator: tomo, 2025\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/typing.rst:3 msgid ":mod:`!typing` --- Support for type hints" -msgstr "" +msgstr ":mod:`!typing` --- 型ヒントのサポート" #: ../../library/typing.rst:16 msgid "**Source code:** :source:`Lib/typing.py`" @@ -161,9 +161,9 @@ msgid "" "an instance of :class:`TypeAliasType`. In this example, ``Vector`` and " "``list[float]`` will be treated equivalently by static type checkers::" msgstr "" -"型エイリアスは :keyword:`type` 文を用いて定義され、 :class:`TypeAliasType` イ" -"ンスタンスが生成されます。 この例では、静的型チェッカーは ``Vector`` と " -"``list[float]`` を等しいものとして扱います" +"型エイリアスは :keyword:`type` 文を用いて定義され、これにより :class:" +"`TypeAliasType` インスタンスが生成されます。 以下の例では、 ``Vector`` と " +"``list[float]`` は静的型チェッカーによって同じ型とみなされます::" #: ../../library/typing.rst:79 msgid "" @@ -225,25 +225,23 @@ msgstr "" ") -> None:\n" " ..." -#: ../../library/typing.rst:106 msgid "" "The :keyword:`type` statement is new in Python 3.12. For backwards " "compatibility, type aliases can also be created through simple assignment::" msgstr "" -":keyword:`type` 文はPython3.12で新しく導入されました。後方互換性のために、単" -"に代入によって型エイリアスを作成することもできます:" +":keyword:`type` 文はPython 3.12で新しく導入されました。\n" +"後方互換性のために、単に代入によって型エイリアスを作成することもできます。 ::" #: ../../library/typing.rst:109 msgid "Vector = list[float]" msgstr "Vector = list[float]" -#: ../../library/typing.rst:111 msgid "" "Or marked with :data:`TypeAlias` to make it explicit that this is a type " "alias, not a normal variable assignment::" msgstr "" "あるいは、 :data:`TypeAlias` でマークすることで、これが通常の変数代入ではな" -"く、型エイリアスであることを明示できます" +"く、型エイリアスであることを明示できます。 ::" #: ../../library/typing.rst:114 msgid "" @@ -275,13 +273,12 @@ msgstr "" "UserId = NewType('UserId', int)\n" "some_id = UserId(524313)" -#: ../../library/typing.rst:130 msgid "" "The static type checker will treat the new type as if it were a subclass of " "the original type. This is useful in helping catch logical errors::" msgstr "" -"静的型チェッカーは新しい型を元々の型のサブクラスのように扱います。この振る舞" -"いは論理的な誤りを見つける手助けとして役に立ちます。" +"静的型チェッカーは新しい型を元々の型のサブクラスのように扱います。\n" +"この振る舞いは論理的な誤りを見つける手助けとして役に立ちます。 ::" #: ../../library/typing.rst:133 msgid "" @@ -303,7 +300,6 @@ msgstr "" "# 型チェックに失敗する。int型はUserId型ではないため。\n" "user_b = get_user_name(-1)" -#: ../../library/typing.rst:142 msgid "" "You may still perform all ``int`` operations on a variable of type " "``UserId``, but the result will always be of type ``int``. This lets you " @@ -313,7 +309,7 @@ msgstr "" "``UserId`` 型の変数も ``int`` の全ての演算が行えますが、その結果は常に " "``int`` 型になります。\n" "この振る舞いにより、 ``int`` が期待されるところに ``UserId`` を渡せますが、不" -"正な方法で ``UserId`` を作ってしまうことを防ぎます。" +"正な方法で ``UserId`` を作ってしまうことを防ぎます。 ::" #: ../../library/typing.rst:147 msgid "" @@ -323,7 +319,6 @@ msgstr "" "# 'output' は'int'型となる。'UserId'型にはならない。\n" "output = UserId(23413) + UserId(54341)" -#: ../../library/typing.rst:150 msgid "" "Note that these checks are enforced only by the static type checker. At " "runtime, the statement ``Derived = NewType('Derived', Base)`` will make " @@ -331,12 +326,11 @@ msgid "" "it. That means the expression ``Derived(some_value)`` does not create a new " "class or introduce much overhead beyond that of a regular function call." msgstr "" -"これらのチェックは静的型チェッカーのみによって強制されるということに注意して" -"ください。\n" -"実行時に ``Derived = NewType('Derived', Base)`` という文は渡された仮引数をた" -"だちに返す ``Derived`` callable を作ります。\n" -"つまり ``Derived(some_value)`` という式は新しいクラスを作ることはなく、通常の" -"関数呼び出しより多くのオーバーヘッドがないということを意味します。" +"これらのチェックは静的型チェッカーだけが行うことに注意してください。\n" +"実行時に ``Derived = NewType('Derived', Base)`` を実行すると、渡した引数をそ" +"のまま返す呼び出し可能オブジェクト ``Derived`` が作成されます。\n" +"つまり、``Derived(some_value)`` という式は新しいクラスを作成せず、通常の関数" +"呼び出しと比べても大きなオーバーヘッドは生じません。" #: ../../library/typing.rst:156 msgid "" @@ -346,9 +340,8 @@ msgstr "" "より正確に言うと、式 ``some_value is Derived(some_value)`` は実行時に常に真を" "返します。" -#: ../../library/typing.rst:159 msgid "It is invalid to create a subtype of ``Derived``::" -msgstr "``Derived`` のサブタイプを作成することはできません" +msgstr "``Derived`` のサブタイプを作成することはできません。 ::" #: ../../library/typing.rst:161 msgid "" @@ -374,7 +367,6 @@ msgstr "" "しかし、 'derived' である ``NewType`` をもとにした :class:`NewType` は作るこ" "とが出来ます::" -#: ../../library/typing.rst:170 msgid "" "from typing import NewType\n" "\n" @@ -382,6 +374,11 @@ msgid "" "\n" "ProUserId = NewType('ProUserId', UserId)" msgstr "" +"from typing import NewType\n" +"\n" +"UserId = NewType('UserId', int)\n" +"\n" +"ProUserId = NewType('ProUserId', UserId)" #: ../../library/typing.rst:176 msgid "and typechecking for ``ProUserId`` will work as expected." @@ -398,10 +395,10 @@ msgid "" "checker treat ``Alias`` as being *exactly equivalent* to ``Original`` in all " "cases. This is useful when you want to simplify complex type signatures." msgstr "" -"型エイリアスの使用は、2つの型が互いに等価であることを宣言することを思い出して" -"ください。 ``type Alias = Original`` とすると、静的型チェッカーは ``Alias`` " -"を ``Original`` と\"正確に等価な\"ものとして扱います。これは、複雑な型シグネ" -"チャを単純化したい場合に便利です。" +"先述の通り、型エイリアスは、2つの型が互いに等価であることを宣言します。 " +"``type Alias = Original`` とすると、静的型チェッカーは ``Alias`` を " +"``Original`` と\"完全に等価な\"ものとして扱います。これは、複雑な型シグネチャ" +"を単純化したい場合に便利です。" #: ../../library/typing.rst:187 msgid "" @@ -413,11 +410,11 @@ msgid "" "errors with minimal runtime cost." msgstr "" "これに対し、 ``NewType`` はある型をもう一方の型の *サブタイプ* として宣言しま" -"す。 ``Derived = NewType('Derived', Original)`` とすると静的型検査器は " +"す。 ``Derived = NewType('Derived', Original)`` とすると静的型チェッカーは " "``Derived`` を ``Original`` の *サブクラス* として扱います。つまり " "``Original`` 型の値は ``Derived`` 型の値が期待される場所で使うことが出来ない" -"ということです。これは論理的な誤りを最小の実行時のコストで防ぎたい時に有用で" -"す。" +"ということです。これにより、実行パフォーマンスをほとんど犠牲にせずに論理エ" +"ラーを防ぐことができます。" #: ../../library/typing.rst:196 msgid "" @@ -439,17 +436,17 @@ msgstr "" msgid "Annotating callable objects" msgstr "呼び出し可能オブジェクトのアノテーション" -#: ../../library/typing.rst:210 msgid "" "Functions -- or other :term:`callable` objects -- can be annotated using :" "class:`collections.abc.Callable` or deprecated :data:`typing.Callable`. " "``Callable[[int], str]`` signifies a function that takes a single parameter " "of type :class:`int` and returns a :class:`str`." msgstr "" -"関数、または他の :term:`callable` なオブジェクトは、 :class:`collections.abc." -"Callable` または :data:`typing.Callable` を使ってアノテーションすることができ" -"ます。 ``Callable[[int], str]`` は、 :class:`int` 型のパラメータを1つ受け取" -"り、 :class:`str` を返す関数を意味します。" +"関数や他の :term:`呼び出し可能 ` オブジェクトには、:class:" +"`collections.abc.Callable` または非推奨の :data:`typing.Callable` を使ってア" +"ノテーションできます。\n" +"``Callable[[int], str]`` は、:class:`int` 型の引数を 1 つ取り、:class:`str` " +"を返す関数を表します。" #: ../../library/typing.rst:215 ../../library/typing.rst:3281 #: ../../library/typing.rst:3461 @@ -472,6 +469,19 @@ msgid "" "\n" "callback: Callable[[str], Awaitable[None]] = on_update" msgstr "" +"from collections.abc import Callable, Awaitable\n" +"\n" +"def feeder(get_next_item: Callable[[], str]) -> None:\n" +" ... # Body\n" +"\n" +"def async_query(on_success: Callable[[int], None],\n" +" on_error: Callable[[int, Exception], None]) -> None:\n" +" ... # Body\n" +"\n" +"async def on_update(value: str) -> None:\n" +" ... # Body\n" +"\n" +"callback: Callable[[str], Awaitable[None]] = on_update" #: ../../library/typing.rst:233 msgid "" @@ -523,7 +533,6 @@ msgstr "" "しかし、:class:`Protocol` クラスとその :meth:`~object.__call__` メソッドを定" "義すれば表現することができます:" -#: ../../library/typing.rst:256 msgid "" "from collections.abc import Iterable\n" "from typing import Protocol\n" @@ -546,8 +555,27 @@ msgid "" "of\n" " # different name and kind in the callback" msgstr "" +"from collections.abc import Iterable\n" +"from typing import Protocol\n" +"\n" +"class Combiner(Protocol):\n" +" def __call__(self, *vals: bytes, maxlen: int | None = None) -> " +"list[bytes]: ...\n" +"\n" +"def batch_proc(data: Iterable[bytes], cb_results: Combiner) -> bytes:\n" +" for item in data:\n" +" ...\n" +"\n" +"def good_cb(*vals: bytes, maxlen: int | None = None) -> list[bytes]:\n" +" ...\n" +"def bad_cb(*vals: bytes, maxitems: int | None) -> list[bytes]:\n" +" ...\n" +"\n" +"batch_proc([], good_cb) # OK\n" +"batch_proc([], bad_cb) # エラー! コールバックのパラメータ名と種類が異なるた" +"め、\n" +" # 第2引数の型が適合しない" -#: ../../library/typing.rst:277 msgid "" "Callables which take other callables as arguments may indicate that their " "parameter types are dependent on each other using :class:`ParamSpec`. " @@ -557,13 +585,14 @@ msgid "" "``Callable[Concatenate[Arg1Type, Arg2Type, ..., ParamSpecVariable], " "ReturnType]`` respectively." msgstr "" -"callable が別の callable を引数に取る場合は、:class:`ParamSpec` を使えば両者" -"のパラメータ引数の依存関係を表現することができます。\n" -"さらに、ある callable が別の callable から引数を追加したり削除したりする場合" -"は、 :data:`Concatenate` 演算子を使うことで表現できます。\n" -"その場合、callable の型は ``Callable[ParamSpecVariable, ReturnType]`` と " +"他の呼び出し可能オブジェクトを引数に取る呼び出し可能オブジェクトでは、:class:" +"`ParamSpec` を使って、それらのパラメータの型が互いに依存することを示せま" +"す。\n" +"さらに、受け取った呼び出し可能オブジェクトの引数を追加または削除する場合は、:" +"data:`Concatenate` 演算子を使えます。\n" +"それぞれ ``Callable[ParamSpecVariable, ReturnType]`` と " "``Callable[Concatenate[Arg1Type, Arg2Type, ..., ParamSpecVariable], " -"ReturnType]`` という形になります。" +"ReturnType]`` の形式を取ります。" #: ../../library/typing.rst:285 ../../library/typing.rst:3970 msgid "" @@ -608,12 +637,24 @@ msgid "" "def notify_by_email(employees: Sequence[Employee],\n" " overrides: Mapping[str, str]) -> None: ..." msgstr "" +"from collections.abc import Mapping, Sequence\n" +"\n" +"class Employee: ...\n" +"\n" +"# Sequence[Employee] はシーケンスの要素がすべて \"Employee\" の\n" +"# インスタンスでなければならないということを表します。\n" +"# Mapping[str, str] は mapping に含まれるキーとバリューが\n" +"# すべて文字列である必要があることを表します。\n" +"def notify_by_email(employees: Sequence[Employee],\n" +" overrides: Mapping[str, str]) -> None: ..." #: ../../library/typing.rst:315 msgid "" "Generic functions and classes can be parameterized by using :ref:`type " "parameter syntax `::" msgstr "" +"ジェネリック関数およびクラスは以下の通り、 :ref:`型引数構文 ` を" +"使うことでパラメータ化できます::" #: ../../library/typing.rst:318 msgid "" @@ -623,10 +664,15 @@ msgid "" "\"T\"\n" " return l[0]" msgstr "" +"from collections.abc import Sequence\n" +"\n" +"def first[T](l: Sequence[T]) -> T: # この関数は型変数 \"T\" に関してジェネ" +"リックです\n" +" return l[0]" #: ../../library/typing.rst:323 msgid "Or by using the :class:`TypeVar` factory directly::" -msgstr "" +msgstr "もしくは、 :class:`TypeVar` のコンストラクタを使うこともできます::" #: ../../library/typing.rst:325 msgid "" @@ -639,10 +685,17 @@ msgid "" "\"U\"\n" " return l[1]" msgstr "" +"from collections.abc import Sequence\n" +"from typing import TypeVar\n" +"\n" +"U = TypeVar('U') # 型引数 \"U\" を宣言\n" +"\n" +"def second(l: Sequence[U]) -> U: # 型引数 \"U\" に関してジェネリックな関数\n" +" return l[1]" #: ../../library/typing.rst:333 msgid "Syntactic support for generics is new in Python 3.12." -msgstr "" +msgstr "ジェネリックが構文としてサポートされたのは Python 3.12 が初めてです。" #: ../../library/typing.rst:339 msgid "Annotating tuples" @@ -653,6 +706,8 @@ msgid "" "For most containers in Python, the typing system assumes that all elements " "in the container will be of the same type. For example::" msgstr "" +"Python のコンテナのほとんどは、すべての要素が同じ型であると型システムが想定す" +"るようになっています。例えば::" #: ../../library/typing.rst:344 msgid "" @@ -668,6 +723,17 @@ msgid "" "# and that all values in ``z`` are meant to be either strings or ints\n" "z: Mapping[str, str | int] = {}" msgstr "" +"from collections.abc import Mapping\n" +"\n" +"# ``x`` の要素がすべて int であると型チェッカーが推定する\n" +"x: list[int] = []\n" +"\n" +"# 型チェッカーエラー: ``list`` は一つの引数しか受け付けない\n" +"y: list[int, str] = [1, 'foo']\n" +"\n" +"# ``z`` のキーはすべて文字列であり、バリューは文字列か int のどちらか\n" +"# であると型チェッカーが推定する\n" +"z: Mapping[str, str | int] = {}" #: ../../library/typing.rst:356 msgid "" @@ -680,7 +746,6 @@ msgstr "" "への代入でエラーを出力します。同様に、:class:`~collections.abc.Mapping` は引" "数に2つの型のみ受け入れます。1つ目はキーの型を示し、2つ目は値の型を示します。" -#: ../../library/typing.rst:362 msgid "" "Unlike most other Python containers, however, it is common in idiomatic " "Python code for tuples to have elements which are not all of the same type. " @@ -688,8 +753,9 @@ msgid "" "`tuple` accepts *any number* of type arguments::" msgstr "" "しかし、他の多くのPythonのコンテナとは異なり、タプルがすべて同じ型ではない要" -"素を持つことは、慣用的なPythonコードでは一般的です。このため、タプルはPython" -"の型システムの中でも特殊です。:class:`tuple` は任意の数の引数を受け入れます" +"素を持つことは、慣用的なPythonコードでは一般的です。\n" +"このため、タプルはPythonの型システムの中でも特殊です。\n" +":class:`tuple` は任意の数の型引数を受け入れます。 ::" #: ../../library/typing.rst:367 msgid "" @@ -705,6 +771,16 @@ msgid "" "# but ``z`` has been assigned to a tuple of length 3\n" "z: tuple[int] = (1, 2, 3)" msgstr "" +"# OK: ``x`` に代入されるのは長さ1のタプルで、要素は int\n" +"x: tuple[int] = (5,)\n" +"\n" +"# OK: ``y`` に代入されるのは長さ2のタプルで、\n" +"# 第1要素は int、第2要素は文字列\n" +"y: tuple[int, str] = (5, \"foo\")\n" +"\n" +"# エラー: 型アノテーションでは長さ1のタプルとなっているが、\n" +"# ``z`` には長さ3のタプルが代入されている\n" +"z: tuple[int] = (1, 2, 3)" #: ../../library/typing.rst:378 msgid "" @@ -736,31 +812,49 @@ msgid "" "z = (1, 2, 3)\n" "z = ()" msgstr "" +"x: tuple[int, ...] = (1, 2)\n" +"# 以下の再代入は OK: ``tuple[int, ...]`` は x の長さが任意であることを表す\n" +"x = (1, 2, 3)\n" +"x = ()\n" +"# 以下の再代入はエラー: ``x`` のすべての要素が int である必要がある\n" +"x = (\"foo\", \"bar\")\n" +"\n" +"# ``y`` に代入できるのは空のタプルのみ\n" +"y: tuple[()] = ()\n" +"\n" +"z: tuple = (\"foo\", \"bar\")\n" +"# 以下の再代入は OK: ``tuple`` は ``tuple[Any, ...]`` と等価\n" +"z = (1, 2, 3)\n" +"z = ()" #: ../../library/typing.rst:401 msgid "The type of class objects" msgstr "クラスオブジェクトの型" -#: ../../library/typing.rst:403 msgid "" "A variable annotated with ``C`` may accept a value of type ``C``. In " "contrast, a variable annotated with ``type[C]`` (or deprecated :class:" "`typing.Type[C] `) may accept values that are classes themselves -- " "specifically, it will accept the *class object* of ``C``. For example::" msgstr "" +"``C`` でアノテーションされた変数には、``C`` 型の値を代入できます。\n" +"一方、``type[C]`` (または非推奨の :class:`typing.Type[C] `) でアノテー" +"ションされた変数には、クラス自体を値として代入できます。\n" +"具体的には、``C`` の *クラスオブジェクト* を受け入れます。\n" +"例えば次のようになります。 ::" -#: ../../library/typing.rst:409 msgid "" "a = 3 # Has type ``int``\n" "b = int # Has type ``type[int]``\n" "c = type(a) # Also has type ``type[int]``" msgstr "" +"a = 3 # 型は ``int``\n" +"b = int # 型は ``type[int]``\n" +"c = type(a) # これも型は ``type[int]``" -#: ../../library/typing.rst:413 msgid "Note that ``type[C]`` is covariant::" -msgstr "" +msgstr "``type[C]`` は共変であることに注意してください。 ::" -#: ../../library/typing.rst:415 msgid "" "class User: ...\n" "class ProUser(User): ...\n" @@ -778,12 +872,30 @@ msgid "" "make_new_user(int) # Error: ``type[int]`` is not a subtype of " "``type[User]``" msgstr "" +"class User: ...\n" +"class ProUser(User): ...\n" +"class TeamUser(User): ...\n" +"\n" +"def make_new_user(user_class: type[User]) -> User:\n" +" # ...\n" +" return user_class()\n" +"\n" +"make_new_user(User) # OK\n" +"make_new_user(ProUser) # これも OK: ``type[ProUser]`` は ``type[User]`` の" +"サブタイプ\n" +"make_new_user(TeamUser) # これも問題ない\n" +"make_new_user(User()) # エラー: ``type[User]`` が必要だが ``User`` が渡さ" +"れた\n" +"make_new_user(int) # エラー: ``type[int]`` は ``type[User]`` のサブタイ" +"プではない" -#: ../../library/typing.rst:429 msgid "" "The only legal parameters for :class:`type` are classes, :data:`Any`, :ref:" "`type variables `, and unions of any of these types. For example::" msgstr "" +":class:`type` の型引数として指定できるのは、クラス、:data:`Any`、:ref:`型変" +"数 `、およびこれらの型のユニオンだけです。\n" +"例えば次のようになります。 ::" #: ../../library/typing.rst:433 msgid "" @@ -796,24 +908,25 @@ msgid "" "new_non_team_user(User) # Also an error" msgstr "" -#: ../../library/typing.rst:441 msgid "" "``type[Any]`` is equivalent to :class:`type`, which is the root of Python's :" "ref:`metaclass hierarchy `." msgstr "" +"``type[Any]`` は :class:`type` と同じで、Python の :ref:`メタクラス階層 " +"` の根に当たります。" -#: ../../library/typing.rst:448 msgid "Annotating generators and coroutines" -msgstr "" +msgstr "ジェネレータとコルーチンのアノテーション" -#: ../../library/typing.rst:450 msgid "" "A generator can be annotated using the generic type :class:" "`Generator[YieldType, SendType, ReturnType] `. " "For example::" msgstr "" +"ジェネレータには、ジェネリック型 :class:`Generator[YieldType, SendType, " +"ReturnType] ` を使ってアノテーションできます。\n" +"例えば次のようになります。 ::" -#: ../../library/typing.rst:454 msgid "" "def echo_round() -> Generator[int, float, str]:\n" " sent = yield 0\n" @@ -821,63 +934,83 @@ msgid "" " sent = yield round(sent)\n" " return 'Done'" msgstr "" +"def echo_round() -> Generator[int, float, str]:\n" +" sent = yield 0\n" +" while sent >= 0:\n" +" sent = yield round(sent)\n" +" return 'Done'" -#: ../../library/typing.rst:460 msgid "" "Note that unlike many other generic classes in the standard library, the " "``SendType`` of :class:`~collections.abc.Generator` behaves contravariantly, " "not covariantly or invariantly." msgstr "" +"標準ライブラリの他の多くのジェネリッククラスとは異なり、:class:`~collections." +"abc.Generator` の ``SendType`` は共変や不変ではなく、反変であることに注意して" +"ください。" -#: ../../library/typing.rst:464 msgid "" "The ``SendType`` and ``ReturnType`` parameters default to :const:`!None`::" -msgstr "" +msgstr "``SendType`` と ``ReturnType`` のデフォルトは :const:`!None` です。 ::" -#: ../../library/typing.rst:466 msgid "" "def infinite_stream(start: int) -> Generator[int]:\n" " while True:\n" " yield start\n" " start += 1" msgstr "" +"def infinite_stream(start: int) -> Generator[int]:\n" +" while True:\n" +" yield start\n" +" start += 1" -#: ../../library/typing.rst:471 msgid "It is also possible to set these types explicitly::" -msgstr "" +msgstr "これらの型を明示的に設定することもできます。 ::" -#: ../../library/typing.rst:473 msgid "" "def infinite_stream(start: int) -> Generator[int, None, None]:\n" " while True:\n" " yield start\n" " start += 1" msgstr "" +"def infinite_stream(start: int) -> Generator[int, None, None]:\n" +" while True:\n" +" yield start\n" +" start += 1" -#: ../../library/typing.rst:478 msgid "" "Simple generators that only ever yield values can also be annotated as " "having a return type of either :class:`Iterable[YieldType] ` or :class:`Iterator[YieldType] `::" msgstr "" +"値を yield するだけの単純なジェネレータでは、戻り値の型を :class:" +"`Iterable[YieldType] ` または :class:" +"`Iterator[YieldType] ` としてアノテーションすること" +"もできます。 ::" -#: ../../library/typing.rst:483 msgid "" "def infinite_stream(start: int) -> Iterator[int]:\n" " while True:\n" " yield start\n" " start += 1" msgstr "" +"def infinite_stream(start: int) -> Iterator[int]:\n" +" while True:\n" +" yield start\n" +" start += 1" -#: ../../library/typing.rst:488 msgid "" "Async generators are handled in a similar fashion, but don't expect a " "``ReturnType`` type argument (:class:`AsyncGenerator[YieldType, SendType] " "`). The ``SendType`` argument defaults to :" "const:`!None`, so the following definitions are equivalent::" msgstr "" +"非同期ジェネレータも同じように扱えますが、型引数 ``ReturnType`` は受け取りま" +"せん (:class:`AsyncGenerator[YieldType, SendType] `)。\n" +"``SendType`` のデフォルトは :const:`!None` なので、以下の定義は同じ意味で" +"す。 ::" -#: ../../library/typing.rst:494 msgid "" "async def infinite_stream(start: int) -> AsyncGenerator[int]:\n" " while True:\n" @@ -889,30 +1022,46 @@ msgid "" " yield start\n" " start = await increment(start)" msgstr "" +"async def infinite_stream(start: int) -> AsyncGenerator[int]:\n" +" while True:\n" +" yield start\n" +" start = await increment(start)\n" +"\n" +"async def infinite_stream(start: int) -> AsyncGenerator[int, None]:\n" +" while True:\n" +" yield start\n" +" start = await increment(start)" -#: ../../library/typing.rst:504 msgid "" "As in the synchronous case, :class:`AsyncIterable[YieldType] ` and :class:`AsyncIterator[YieldType] ` are available as well::" msgstr "" +"同期ジェネレータの場合と同じように、:class:`AsyncIterable[YieldType] " +"` と :class:`AsyncIterator[YieldType] " +"` も使用できます。 ::" -#: ../../library/typing.rst:509 msgid "" "async def infinite_stream(start: int) -> AsyncIterator[int]:\n" " while True:\n" " yield start\n" " start = await increment(start)" msgstr "" +"async def infinite_stream(start: int) -> AsyncIterator[int]:\n" +" while True:\n" +" yield start\n" +" start = await increment(start)" -#: ../../library/typing.rst:514 msgid "" "Coroutines can be annotated using :class:`Coroutine[YieldType, SendType, " "ReturnType] `. Generic arguments correspond to " "those of :class:`~collections.abc.Generator`, for example::" msgstr "" +"コルーチンには :class:`Coroutine[YieldType, SendType, ReturnType] " +"` を使ってアノテーションできます。\n" +"型引数は :class:`~collections.abc.Generator` の型引数に対応します。\n" +"例えば次のようになります。 ::" -#: ../../library/typing.rst:519 msgid "" "from collections.abc import Coroutine\n" "c: Coroutine[list[str], str, int] # Some coroutine defined elsewhere\n" @@ -920,6 +1069,11 @@ msgid "" "async def bar() -> None:\n" " y = await c # Inferred type of 'y' is int" msgstr "" +"from collections.abc import Coroutine\n" +"c: Coroutine[list[str], str, int] # 別の場所で定義されたコルーチン\n" +"x = c.send('hi') # 'x' の推論された型は list[str]\n" +"async def bar() -> None:\n" +" y = await c # 'y' の推論された型は int" #: ../../library/typing.rst:528 msgid "User-defined generic types" @@ -929,7 +1083,6 @@ msgstr "ユーザー定義のジェネリック型" msgid "A user-defined class can be defined as a generic class." msgstr "ユーザー定義のクラスを、ジェネリッククラスとして定義できます。" -#: ../../library/typing.rst:534 msgid "" "from logging import Logger\n" "\n" @@ -950,22 +1103,43 @@ msgid "" " def log(self, message: str) -> None:\n" " self.logger.info('%s: %s', self.name, message)" msgstr "" +"from logging import Logger\n" +"\n" +"class LoggedVar[T]:\n" +" def __init__(self, value: T, name: str, logger: Logger) -> None:\n" +" self.name = name\n" +" self.logger = logger\n" +" self.value = value\n" +"\n" +" def set(self, new: T) -> None:\n" +" self.log('Set ' + repr(self.value))\n" +" self.value = new\n" +"\n" +" def get(self) -> T:\n" +" self.log('Get ' + repr(self.value))\n" +" return self.value\n" +"\n" +" def log(self, message: str) -> None:\n" +" self.logger.info('%s: %s', self.name, message)" -#: ../../library/typing.rst:553 msgid "" "This syntax indicates that the class ``LoggedVar`` is parameterised around a " "single :ref:`type variable ` ``T`` . This also makes ``T`` valid as " "a type within the class body." msgstr "" +"この構文は、クラス ``LoggedVar`` が単一の :ref:`型変数 ` ``T`` でパ" +"ラメータ化されていることを示します。\n" +"また、クラス本体で ``T`` を型として使用できるようになります。" -#: ../../library/typing.rst:557 msgid "" "Generic classes implicitly inherit from :class:`Generic`. For compatibility " "with Python 3.11 and lower, it is also possible to inherit explicitly from :" "class:`Generic` to indicate a generic class::" msgstr "" +"ジェネリッククラスは暗黙的に :class:`Generic` を継承します。\n" +"Python 3.11 以前との互換性のために、:class:`Generic` を明示的に継承してジェネ" +"リッククラスであることを示す方法も使えます。 ::" -#: ../../library/typing.rst:561 msgid "" "from typing import TypeVar, Generic\n" "\n" @@ -974,14 +1148,20 @@ msgid "" "class LoggedVar(Generic[T]):\n" " ..." msgstr "" +"from typing import TypeVar, Generic\n" +"\n" +"T = TypeVar('T')\n" +"\n" +"class LoggedVar(Generic[T]):\n" +" ..." -#: ../../library/typing.rst:568 msgid "" "Generic classes have :meth:`~object.__class_getitem__` methods, meaning they " "can be parameterised at runtime (e.g. ``LoggedVar[int]`` below)::" msgstr "" +"ジェネリッククラスは :meth:`~object.__class_getitem__` メソッドを持つため、実" +"行時にパラメータ化できます (下の ``LoggedVar[int]`` など)。 ::" -#: ../../library/typing.rst:571 msgid "" "from collections.abc import Iterable\n" "\n" @@ -989,14 +1169,19 @@ msgid "" " for var in vars:\n" " var.set(0)" msgstr "" +"from collections.abc import Iterable\n" +"\n" +"def zero_all_vars(vars: Iterable[LoggedVar[int]]) -> None:\n" +" for var in vars:\n" +" var.set(0)" -#: ../../library/typing.rst:577 msgid "" "A generic type can have any number of type variables. All varieties of :" "class:`TypeVar` are permissible as parameters for a generic type::" msgstr "" +"ジェネリック型は任意の数の型変数を持てます。\n" +"どの種類の :class:`TypeVar` も、ジェネリック型の型引数として使用できます。 ::" -#: ../../library/typing.rst:580 msgid "" "from typing import TypeVar, Generic, Sequence\n" "\n" @@ -1010,6 +1195,17 @@ msgid "" "class OldWeirdTrio(Generic[OldT, OldB, OldS]):\n" " ..." msgstr "" +"from typing import TypeVar, Generic, Sequence\n" +"\n" +"class WeirdTrio[T, B: Sequence[bytes], S: (int, str)]:\n" +" ...\n" +"\n" +"OldT = TypeVar('OldT', contravariant=True)\n" +"OldB = TypeVar('OldB', bound=Sequence[bytes], covariant=True)\n" +"OldS = TypeVar('OldS', int, str)\n" +"\n" +"class OldWeirdTrio(Generic[OldT, OldB, OldS]):\n" +" ..." #: ../../library/typing.rst:592 msgid "" @@ -1019,7 +1215,6 @@ msgstr "" ":class:`Generic` の引数のそれぞれの型変数は別のものでなければなりません。この" "ため次のクラス定義は無効です::" -#: ../../library/typing.rst:595 msgid "" "from typing import TypeVar, Generic\n" "...\n" @@ -1032,56 +1227,77 @@ msgid "" "class Pair(Generic[T, T]): # INVALID\n" " ..." msgstr "" +"from typing import TypeVar, Generic\n" +"...\n" +"\n" +"class Pair[M, M]: # SyntaxError\n" +" ...\n" +"\n" +"T = TypeVar('T')\n" +"\n" +"class Pair(Generic[T, T]): # 無効\n" +" ..." -#: ../../library/typing.rst:606 msgid "Generic classes can also inherit from other classes::" -msgstr "" +msgstr "ジェネリッククラスは他のクラスを継承することもできます。 ::" -#: ../../library/typing.rst:608 msgid "" "from collections.abc import Sized\n" "\n" "class LinkedList[T](Sized):\n" " ..." msgstr "" +"from collections.abc import Sized\n" +"\n" +"class LinkedList[T](Sized):\n" +" ..." -#: ../../library/typing.rst:613 msgid "" "When inheriting from generic classes, some type parameters could be fixed::" msgstr "" +"ジェネリッククラスを継承するときに、一部の型引数を固定することもできます。 ::" -#: ../../library/typing.rst:615 msgid "" "from collections.abc import Mapping\n" "\n" "class MyDict[T](Mapping[str, T]):\n" " ..." msgstr "" +"from collections.abc import Mapping\n" +"\n" +"class MyDict[T](Mapping[str, T]):\n" +" ..." #: ../../library/typing.rst:620 msgid "In this case ``MyDict`` has a single parameter, ``T``." msgstr "この場合では ``MyDict`` は仮引数 ``T`` を 1 つとります。" -#: ../../library/typing.rst:622 msgid "" "Using a generic class without specifying type parameters assumes :data:`Any` " "for each position. In the following example, ``MyIterable`` is not generic " "but implicitly inherits from ``Iterable[Any]``:" msgstr "" +"型引数を指定せずにジェネリッククラスを使うと、各位置に :data:`Any` を指定した" +"ものとして扱われます。\n" +"以下の例の ``MyIterable`` はジェネリックではなく、暗黙的に ``Iterable[Any]`` " +"を継承します:" -#: ../../library/typing.rst:626 msgid "" "from collections.abc import Iterable\n" "\n" "class MyIterable(Iterable): # Same as Iterable[Any]\n" " ..." msgstr "" +"from collections.abc import Iterable\n" +"\n" +"class MyIterable(Iterable): # Iterable[Any] と同じ\n" +" ..." -#: ../../library/typing.rst:633 msgid "User-defined generic type aliases are also supported. Examples::" msgstr "" +"ユーザー定義のジェネリック型エイリアスにも対応しています。\n" +"例を示します。 ::" -#: ../../library/typing.rst:635 msgid "" "from collections.abc import Iterable\n" "\n" @@ -1097,14 +1313,26 @@ msgid "" "Iterable[tuple[T, T]]\n" " return sum(x*y for x, y in v)" msgstr "" +"from collections.abc import Iterable\n" +"\n" +"type Response[S] = Iterable[S] | int\n" +"\n" +"# ここの戻り値の型は Iterable[str] | int と同じ\n" +"def response(query: str) -> Response[str]:\n" +" ...\n" +"\n" +"type Vec[T] = Iterable[tuple[T, T]]\n" +"\n" +"def inproduct[T: (int, float, complex)](v: Vec[T]) -> T: # Iterable[tuple[T, " +"T]] と同じ\n" +" return sum(x*y for x, y in v)" -#: ../../library/typing.rst:648 msgid "" "For backward compatibility, generic type aliases can also be created through " "a simple assignment::" msgstr "" +"後方互換性のために、ジェネリック型エイリアスは単純な代入でも作成できます。 ::" -#: ../../library/typing.rst:651 msgid "" "from collections.abc import Iterable\n" "from typing import TypeVar\n" @@ -1112,19 +1340,25 @@ msgid "" "S = TypeVar(\"S\")\n" "Response = Iterable[S] | int" msgstr "" +"from collections.abc import Iterable\n" +"from typing import TypeVar\n" +"\n" +"S = TypeVar(\"S\")\n" +"Response = Iterable[S] | int" #: ../../library/typing.rst:657 msgid ":class:`Generic` no longer has a custom metaclass." msgstr ":class:`Generic` にあった独自のメタクラスは無くなりました。" -#: ../../library/typing.rst:660 msgid "" "Syntactic support for generics and type aliases is new in version 3.12. " "Previously, generic classes had to explicitly inherit from :class:`Generic` " "or contain a type variable in one of their bases." msgstr "" +"ジェネリックと型エイリアスの構文はバージョン 3.12 で導入されました。\n" +"それ以前のジェネリッククラスは、:class:`Generic` を明示的に継承するか、基底ク" +"ラスのいずれかに型変数を含める必要がありました。" -#: ../../library/typing.rst:665 msgid "" "User-defined generics for parameter expressions are also supported via " "parameter specification variables in the form ``[**P]``. The behavior is " @@ -1133,22 +1367,31 @@ msgid "" "variable. The one exception to this is that a list of types can be used to " "substitute a :class:`ParamSpec`::" msgstr "" +"``[**P]`` 形式のパラメータ仕様変数を使い、パラメータ式を受け取るユーザー定義" +"のジェネリックを作成することもできます。\n" +":mod:`!typing` モジュールはパラメータ仕様変数を特別な型変数として扱うため、上" +"で説明した型変数と同じように動作します。\n" +"ただし例外として、:class:`ParamSpec` には型のリストを代入できます。 ::" -#: ../../library/typing.rst:671 msgid "" ">>> class Z[T, **P]: ... # T is a TypeVar; P is a ParamSpec\n" "...\n" ">>> Z[int, [dict, float]]\n" "__main__.Z[int, [dict, float]]" msgstr "" +">>> class Z[T, **P]: ... # T は TypeVar、P は ParamSpec\n" +"...\n" +">>> Z[int, [dict, float]]\n" +"__main__.Z[int, [dict, float]]" -#: ../../library/typing.rst:676 msgid "" "Classes generic over a :class:`ParamSpec` can also be created using explicit " "inheritance from :class:`Generic`. In this case, ``**`` is not used::" msgstr "" +":class:`Generic` を明示的に継承して、:class:`ParamSpec` を引数とするジェネ" +"リッククラスを作成することもできます。\n" +"この場合は ``**`` を使いません。 ::" -#: ../../library/typing.rst:679 msgid "" "from typing import ParamSpec, Generic\n" "\n" @@ -1157,8 +1400,13 @@ msgid "" "class Z(Generic[P]):\n" " ..." msgstr "" +"from typing import ParamSpec, Generic\n" +"\n" +"P = ParamSpec('P')\n" +"\n" +"class Z(Generic[P]):\n" +" ..." -#: ../../library/typing.rst:686 msgid "" "Another difference between :class:`TypeVar` and :class:`ParamSpec` is that a " "generic with only one parameter specification variable will accept parameter " @@ -1166,8 +1414,12 @@ msgid "" "Type2, ...]`` for aesthetic reasons. Internally, the latter is converted to " "the former, so the following are equivalent::" msgstr "" +":class:`TypeVar` と :class:`ParamSpec` のもう 1 つの違いとして、パラメータ仕" +"様変数が 1 つだけのジェネリックでは、\n" +"見た目を簡潔にするため、パラメータリストを ``X[[Type1, Type2, ...]]`` と " +"``X[Type1, Type2, ...]`` のどちらの形式でも指定できます。\n" +"内部では後者を前者に変換するため、以下は同じ意味です。 ::" -#: ../../library/typing.rst:692 msgid "" ">>> class X[**P]: ...\n" "...\n" @@ -1176,27 +1428,40 @@ msgid "" ">>> X[[int, str]]\n" "__main__.X[[int, str]]" msgstr "" +">>> class X[**P]: ...\n" +"...\n" +">>> X[int, str]\n" +"__main__.X[[int, str]]\n" +">>> X[[int, str]]\n" +"__main__.X[[int, str]]" -#: ../../library/typing.rst:699 msgid "" "Note that generics with :class:`ParamSpec` may not have correct " "``__parameters__`` after substitution in some cases because they are " "intended primarily for static type checking." msgstr "" +":class:`ParamSpec` を使うジェネリックは、主に静的型チェックを目的としているた" +"め、代入後に正しい ``__parameters__`` を持たない場合があります。" -#: ../../library/typing.rst:703 msgid "" ":class:`Generic` can now be parameterized over parameter expressions. See :" "class:`ParamSpec` and :pep:`612` for more details." msgstr "" +":class:`Generic` をパラメータ式でパラメータ化できるようになりました。\n" +"詳細は :class:`ParamSpec` と :pep:`612` を参照してください。" -#: ../../library/typing.rst:707 msgid "" "A user-defined generic class can have ABCs as base classes without a " "metaclass conflict. Generic metaclasses are not supported. The outcome of " "parameterizing generics is cached, and most types in the :mod:`!typing` " "module are :term:`hashable` and comparable for equality." msgstr "" +"ユーザー定義のジェネリッククラスは、メタクラスの衝突を起こさずに抽象基底クラ" +"ス (ABC) を基底クラスにできます。\n" +"ジェネリックなメタクラスには対応していません。\n" +"ジェネリックをパラメータ化した結果はキャッシュされます。\n" +":mod:`!typing` モジュールのほとんどの型は :term:`ハッシュ可能 ` " +"で、等価比較もできます。" #: ../../library/typing.rst:714 msgid "The :data:`Any` type" @@ -1211,15 +1476,13 @@ msgstr "" ":data:`Any` は特別な種類の型です。静的型検査器はすべての型を :data:`Any` と互" "換として扱い、 :data:`Any` をすべての型と互換として扱います。" -#: ../../library/typing.rst:720 msgid "" "This means that it is possible to perform any operation or method call on a " "value of type :data:`Any` and assign it to any variable::" msgstr "" -"これは、 :data:`Any` 型の値では、任意の演算やメソッドの呼び出しが行えることを" -"意味します::" +"これは、:data:`Any` 型の値に対して任意の演算やメソッド呼び出しを行え、どの変" +"数にも代入できることを意味します。 ::" -#: ../../library/typing.rst:723 msgid "" "from typing import Any\n" "\n" @@ -1236,6 +1499,21 @@ msgid "" " item.bar()\n" " ..." msgstr "" +"from typing import Any\n" +"\n" +"a: Any = None\n" +"a = [] # OK\n" +"a = 2 # OK\n" +"\n" +"s: str = ''\n" +"s = a # OK\n" +"\n" +"def foo(item: Any) -> int:\n" +" # 型チェックを通過する。\n" +" # 'item' はどの型でもよく、\n" +" # その型には 'bar' メソッドがあるかもしれない\n" +" item.bar()\n" +" ..." #: ../../library/typing.rst:738 msgid "" @@ -1250,15 +1528,13 @@ msgstr "" "class:`str` 型として宣言されていて実行時に :class:`int` の値を受け取るとして" "も、エラーを報告しません。" -#: ../../library/typing.rst:744 msgid "" "Furthermore, all functions without a return type or parameter types will " "implicitly default to using :data:`Any`::" msgstr "" -"さらに、返り値や引数の型のないすべての関数は暗黙的に :data:`Any` を使用しま" -"す。" +"さらに、戻り値や引数に型アノテーションのない関数は、暗黙的に :data:`Any` を使" +"います。 ::" -#: ../../library/typing.rst:747 msgid "" "def legacy_parser(text):\n" " ...\n" @@ -1270,6 +1546,15 @@ msgid "" " ...\n" " return data" msgstr "" +"def legacy_parser(text):\n" +" ...\n" +" return data\n" +"\n" +"# 静的型チェッカーは上記のシグネチャを\n" +"# 次のものと同じように扱う:\n" +"def legacy_parser(text: Any) -> Any:\n" +" ...\n" +" return data" #: ../../library/typing.rst:757 msgid "" @@ -1323,14 +1608,12 @@ msgid "" "hash_b(\"foo\")" msgstr "" -#: ../../library/typing.rst:787 msgid "" "Use :class:`object` to indicate that a value could be any type in a typesafe " "manner. Use :data:`Any` to indicate that a value is dynamically typed." msgstr "" -":class:`object` は、ある値が型安全な方法で任意の型として使えることを示すため" -"に使用します。 :data:`Any` はある値が動的に型付けられることを示すために使用し" -"ます。" +"値がどの型でもよいことを型安全に表すには :class:`object` を使います。\n" +"値が動的に型付けされることを示すには :data:`Any` を使います。" #: ../../library/typing.rst:792 msgid "Nominal vs structural subtyping" @@ -1348,7 +1631,6 @@ msgstr "" "れるのは ``A`` が ``B`` のサブクラスの場合かつその場合に限る、ということで" "す。" -#: ../../library/typing.rst:798 msgid "" "This requirement previously also applied to abstract base classes, such as :" "class:`~collections.abc.Iterable`. The problem with this approach is that a " @@ -1356,14 +1638,14 @@ msgid "" "unlike what one would normally do in idiomatic dynamically typed Python " "code. For example, this conforms to :pep:`484`::" msgstr "" -"前出の必要条件は、:class:`~collections.abc.Iterable` などの抽象基底クラスにも" -"当て嵌まります。\n" -"この型付け手法の問題は、この手法をサポートするためにクラスに明確な型付けを行" -"う必要があることで、これは pythonic ではなく、普段行っている 慣用的な Python " -"コードへの動的型付けとは似ていません。\n" -"例えば、次のコードは :pep:`484` に従ったものです ::" +"この要件は以前、:class:`~collections.abc.Iterable` などの抽象基底クラスにも適" +"用されていました。\n" +"この方法では、抽象基底クラスに対応していることをクラスに明示する必要がある点" +"が問題です。\n" +"これは Python らしくなく、慣用的な動的型付けの Python コードで通常行うことと" +"も異なります。\n" +"例えば、次のコードは :pep:`484` に従っています。 ::" -#: ../../library/typing.rst:804 msgid "" "from collections.abc import Sized, Iterable, Iterator\n" "\n" @@ -1372,6 +1654,12 @@ msgid "" " def __len__(self) -> int: ...\n" " def __iter__(self) -> Iterator[int]: ..." msgstr "" +"from collections.abc import Sized, Iterable, Iterator\n" +"\n" +"class Bucket(Sized, Iterable[int]):\n" +" ...\n" +" def __len__(self) -> int: ...\n" +" def __iter__(self) -> Iterator[int]: ..." #: ../../library/typing.rst:811 msgid "" @@ -1388,7 +1676,6 @@ msgstr "" "これは *structural subtyping (構造的部分型)* (あるいは、静的ダックタイピン" "グ) として知られています::" -#: ../../library/typing.rst:817 msgid "" "from collections.abc import Iterator, Iterable\n" "\n" @@ -1400,6 +1687,15 @@ msgid "" "def collect(items: Iterable[int]) -> int: ...\n" "result = collect(Bucket()) # Passes type check" msgstr "" +"from collections.abc import Iterator, Iterable\n" +"\n" +"class Bucket: # 注意: 基底クラスの指定はない\n" +" ...\n" +" def __len__(self) -> int: ...\n" +" def __iter__(self) -> Iterator[int]: ...\n" +"\n" +"def collect(items: Iterable[int]) -> int: ...\n" +"result = collect(Bucket()) # 型チェックを通過する" #: ../../library/typing.rst:827 msgid "" @@ -1414,11 +1710,10 @@ msgstr "" msgid "Module contents" msgstr "モジュールの内容" -#: ../../library/typing.rst:834 msgid "" "The ``typing`` module defines the following classes, functions and " "decorators." -msgstr "" +msgstr "``typing`` モジュールは以下のクラス、関数、デコレータを定義します。" #: ../../library/typing.rst:837 msgid "Special typing primitives" @@ -1428,11 +1723,12 @@ msgstr "特殊型付けプリミティブ" msgid "Special types" msgstr "特殊型" -#: ../../library/typing.rst:842 msgid "" "These can be used as types in annotations. They do not support subscription " "using ``[]``." msgstr "" +"アノテーション内で型として使用できます。\n" +"``[]`` を使った添字表記には対応していません。" #: ../../library/typing.rst:847 msgid "Special type indicating an unconstrained type." @@ -1446,30 +1742,30 @@ msgstr "任意の型は :data:`Any` と互換です。" msgid ":data:`Any` is compatible with every type." msgstr ":data:`Any` は任意の型と互換です。" -#: ../../library/typing.rst:852 msgid "" ":data:`Any` can now be used as a base class. This can be useful for avoiding " "type checker errors with classes that can duck type anywhere or are highly " "dynamic." msgstr "" +":data:`Any` を基底クラスとして使えるようになりました。\n" +"あらゆる場面でダックタイピングに対応するクラスや、非常に動的なクラスで型" +"チェッカーのエラーを避けるのに役立ちます。" -#: ../../library/typing.rst:859 msgid "A :ref:`constrained type variable `." -msgstr "" +msgstr ":ref:`制約付き型変数 ` です。" -#: ../../library/typing.rst:861 msgid "Definition::" -msgstr "" +msgstr "定義は次のとおりです。 ::" -#: ../../library/typing.rst:863 msgid "AnyStr = TypeVar('AnyStr', str, bytes)" -msgstr "" +msgstr "AnyStr = TypeVar('AnyStr', str, bytes)" -#: ../../library/typing.rst:865 msgid "" "``AnyStr`` is meant to be used for functions that may accept :class:`str` " "or :class:`bytes` arguments but cannot allow the two to mix." msgstr "" +"``AnyStr`` は、引数として :class:`str` または :class:`bytes` を受け取れるもの" +"の、両者の混在は許さない関数で使うためのものです。" #: ../../library/typing.rst:868 ../../library/typing.rst:986 #: ../../library/typing.rst:1043 ../../library/typing.rst:1223 @@ -1479,7 +1775,6 @@ msgstr "" msgid "For example::" msgstr "例えば::" -#: ../../library/typing.rst:870 msgid "" "def concat(a: AnyStr, b: AnyStr) -> AnyStr:\n" " return a + b\n" @@ -1488,15 +1783,22 @@ msgid "" "concat(b\"foo\", b\"bar\") # OK, output has type 'bytes'\n" "concat(\"foo\", b\"bar\") # Error, cannot mix str and bytes" msgstr "" +"def concat(a: AnyStr, b: AnyStr) -> AnyStr:\n" +" return a + b\n" +"\n" +"concat(\"foo\", \"bar\") # OK、戻り値の型は 'str'\n" +"concat(b\"foo\", b\"bar\") # OK、戻り値の型は 'bytes'\n" +"concat(\"foo\", b\"bar\") # エラー、str と bytes は混在できない" -#: ../../library/typing.rst:877 msgid "" "Note that, despite its name, ``AnyStr`` has nothing to do with the :class:" "`Any` type, nor does it mean \"any string\". In particular, ``AnyStr`` and " "``str | bytes`` are different from each other and have different use cases::" msgstr "" +"名前から連想されるかもしれませんが、``AnyStr`` は :class:`Any` 型とは無関係" +"で、「任意の文字列」という意味でもありません。\n" +"特に、``AnyStr`` と ``str | bytes`` は異なるもので、用途も異なります。 ::" -#: ../../library/typing.rst:882 msgid "" "# Invalid use of AnyStr:\n" "# The type variable is used only once in the function signature,\n" @@ -1508,39 +1810,55 @@ msgid "" "def greet_proper(cond: bool) -> str | bytes:\n" " return \"hi there!\" if cond else b\"greetings!\"" msgstr "" - -#: ../../library/typing.rst:892 -msgid "" +"# AnyStr の無効な使い方:\n" +"# 型変数が関数のシグネチャに 1 回しか現れないため、\n" +"# 型チェッカーが型を「解決」できない\n" +"def greet_bad(cond: bool) -> AnyStr:\n" +" return \"hi there!\" if cond else b\"greetings!\"\n" +"\n" +"# この関数のより適切なアノテーション:\n" +"def greet_proper(cond: bool) -> str | bytes:\n" +" return \"hi there!\" if cond else b\"greetings!\"" + +msgid "" "Deprecated in favor of the new :ref:`type parameter syntax `. " "Use ``class A[T: (str, bytes)]: ...`` instead of importing ``AnyStr``. See :" "pep:`695` for more details." msgstr "" +"新しい :ref:`型引数構文 ` に置き換えられ、非推奨となりました。\n" +"``AnyStr`` をインポートする代わりに ``class A[T: (str, bytes)]: ...`` を使っ" +"てください。\n" +"詳細は :pep:`695` を参照してください。" -#: ../../library/typing.rst:897 msgid "" "In Python 3.16, ``AnyStr`` will be removed from ``typing.__all__``, and " "deprecation warnings will be emitted at runtime when it is accessed or " "imported from ``typing``. ``AnyStr`` will be removed from ``typing`` in " "Python 3.18." msgstr "" +"Python 3.16 では ``AnyStr`` が ``typing.__all__`` から削除され、``typing`` か" +"らのアクセスやインポート時に実行時の非推奨警告が発生するようになります。\n" +"Python 3.18 では ``AnyStr`` が ``typing`` から削除されます。" -#: ../../library/typing.rst:904 msgid "Special type that includes only literal strings." -msgstr "" +msgstr "リテラル文字列だけを含む特殊な型です。" -#: ../../library/typing.rst:906 msgid "" "Any string literal is compatible with ``LiteralString``, as is another " "``LiteralString``. However, an object typed as just ``str`` is not. A string " "created by composing ``LiteralString``-typed objects is also acceptable as a " "``LiteralString``." msgstr "" +"どの文字列リテラルも、また他の ``LiteralString`` も、``LiteralString`` と互換" +"性があります。\n" +"ただし、単に ``str`` 型とされたオブジェクトには互換性がありません。\n" +"``LiteralString`` 型のオブジェクトを組み合わせて作った文字列も、" +"``LiteralString`` として受け入れられます。" #: ../../library/typing.rst:912 ../../library/typing.rst:2243 msgid "Example:" msgstr "例:" -#: ../../library/typing.rst:914 msgid "" "def run_query(sql: LiteralString) -> None:\n" " ...\n" @@ -1554,46 +1872,64 @@ msgid "" " f\"SELECT * FROM students WHERE name = {arbitrary_string}\"\n" " )" msgstr "" +"def run_query(sql: LiteralString) -> None:\n" +" ...\n" +"\n" +"def caller(arbitrary_string: str, literal_string: LiteralString) -> None:\n" +" run_query(\"SELECT * FROM students\") # OK\n" +" run_query(literal_string) # OK\n" +" run_query(\"SELECT * FROM \" + literal_string) # OK\n" +" run_query(arbitrary_string) # 型チェッカーのエラー\n" +" run_query( # 型チェッカーのエラー\n" +" f\"SELECT * FROM students WHERE name = {arbitrary_string}\"\n" +" )" -#: ../../library/typing.rst:928 msgid "" "``LiteralString`` is useful for sensitive APIs where arbitrary user-" "generated strings could generate problems. For example, the two cases above " "that generate type checker errors could be vulnerable to an SQL injection " "attack." msgstr "" +"``LiteralString`` は、ユーザーが生成した任意の文字列を渡すと問題が生じる可能" +"性のある、注意を要する API で役立ちます。\n" +"例えば、上の型チェッカーのエラーになる 2 つのケースには、SQL インジェクション" +"攻撃に対する脆弱性があるかもしれません。" #: ../../library/typing.rst:933 msgid "See :pep:`675` for more details." msgstr "より詳しくは :pep:`675` を参照してください。" -#: ../../library/typing.rst:940 msgid "" ":data:`!Never` and :data:`!NoReturn` represent the `bottom type `_, a type that has no members." msgstr "" +":data:`!Never` と :data:`!NoReturn` は、値を 1 つも持たない型である `ボトム" +"型 `_ を表します。" -#: ../../library/typing.rst:944 msgid "" "They can be used to indicate that a function never returns, such as :func:" "`sys.exit`::" msgstr "" +":func:`sys.exit` のように、関数が決して戻らないことを示すために使えます。 ::" -#: ../../library/typing.rst:947 msgid "" "from typing import Never # or NoReturn\n" "\n" "def stop() -> Never:\n" " raise RuntimeError('no way')" msgstr "" +"from typing import Never # または NoReturn\n" +"\n" +"def stop() -> Never:\n" +" raise RuntimeError('no way')" -#: ../../library/typing.rst:952 msgid "" "Or to define a function that should never be called, as there are no valid " "arguments, such as :func:`assert_never`::" msgstr "" +"また、:func:`assert_never` のように、有効な引数が存在しないため決して呼び出さ" +"れるべきでない関数を定義するためにも使えます。 ::" -#: ../../library/typing.rst:956 msgid "" "from typing import Never # or NoReturn\n" "\n" @@ -1610,26 +1946,37 @@ msgid "" " case _:\n" " never_call_me(arg) # OK, arg is of type Never (or NoReturn)" msgstr "" +"from typing import Never # または NoReturn\n" +"\n" +"def never_call_me(arg: Never) -> None:\n" +" pass\n" +"\n" +"def int_or_str(arg: int | str) -> None:\n" +" never_call_me(arg) # 型チェッカーのエラー\n" +" match arg:\n" +" case int():\n" +" print(\"It's an int\")\n" +" case str():\n" +" print(\"It's a str\")\n" +" case _:\n" +" never_call_me(arg) # OK、arg の型は Never (または NoReturn)" -#: ../../library/typing.rst:971 msgid "" ":data:`!Never` and :data:`!NoReturn` have the same meaning in the type " "system and static type checkers treat both equivalently." msgstr "" +":data:`!Never` と :data:`!NoReturn` は型システム上で同じ意味を持ち、静的型" +"チェッカーは両者を同じように扱います。" -#: ../../library/typing.rst:976 msgid "Added :data:`NoReturn`." -msgstr "" +msgstr ":data:`NoReturn` を追加しました。" -#: ../../library/typing.rst:980 msgid "Added :data:`Never`." -msgstr "" +msgstr ":data:`Never` を追加しました。" -#: ../../library/typing.rst:984 msgid "Special type to represent the current enclosed class." -msgstr "" +msgstr "それを囲む現在のクラスを表す特殊な型です。" -#: ../../library/typing.rst:988 msgid "" "from typing import Self, reveal_type\n" "\n" @@ -1644,14 +1991,25 @@ msgid "" "reveal_type(SubclassOfFoo().return_self()) # Revealed type is " "\"SubclassOfFoo\"" msgstr "" +"from typing import Self, reveal_type\n" +"\n" +"class Foo:\n" +" def return_self(self) -> Self:\n" +" ...\n" +" return self\n" +"\n" +"class SubclassOfFoo(Foo): pass\n" +"\n" +"reveal_type(Foo().return_self()) # 表示される型は \"Foo\"\n" +"reveal_type(SubclassOfFoo().return_self()) # 表示される型は " +"\"SubclassOfFoo\"" -#: ../../library/typing.rst:1000 msgid "" "This annotation is semantically equivalent to the following, albeit in a " "more succinct fashion::" msgstr "" +"このアノテーションは、以下の書き方と同じ意味をより簡潔に表したものです。 ::" -#: ../../library/typing.rst:1003 msgid "" "from typing import TypeVar\n" "\n" @@ -1662,8 +2020,15 @@ msgid "" " ...\n" " return self" msgstr "" +"from typing import TypeVar\n" +"\n" +"Self = TypeVar(\"Self\", bound=\"Foo\")\n" +"\n" +"class Foo:\n" +" def return_self(self: Self) -> Self:\n" +" ...\n" +" return self" -#: ../../library/typing.rst:1012 msgid "" "In general, if something returns ``self``, as in the above examples, you " "should use ``Self`` as the return annotation. If ``Foo.return_self`` was " @@ -1671,28 +2036,32 @@ msgid "" "object returned from ``SubclassOfFoo.return_self`` as being of type ``Foo`` " "rather than ``SubclassOfFoo``." msgstr "" +"一般に、上の例のように ``self`` を返す場合は、戻り値のアノテーションに " +"``Self`` を使うべきです。\n" +"``Foo.return_self`` の戻り値を ``\"Foo\"`` とアノテーションすると、型チェッ" +"カーは ``SubclassOfFoo.return_self`` の戻り値の型を ``SubclassOfFoo`` ではな" +"く ``Foo`` と推論します。" -#: ../../library/typing.rst:1018 msgid "Other common use cases include:" -msgstr "" +msgstr "他によくある用途として、以下があります:" -#: ../../library/typing.rst:1020 msgid "" ":class:`classmethod`\\s that are used as alternative constructors and return " "instances of the ``cls`` parameter." msgstr "" +"代替コンストラクタとして使われ、``cls`` 引数のインスタンスを返す :class:" +"`classmethod`。" -#: ../../library/typing.rst:1022 msgid "Annotating an :meth:`~object.__enter__` method which returns self." -msgstr "" +msgstr "``self`` を返す :meth:`~object.__enter__` メソッドのアノテーション。" -#: ../../library/typing.rst:1024 msgid "" "You should not use ``Self`` as the return annotation if the method is not " "guaranteed to return an instance of a subclass when the class is subclassed::" msgstr "" +"クラスを継承したときに、メソッドがそのサブクラスのインスタンスを返す保証がな" +"ければ、戻り値のアノテーションに ``Self`` を使うべきではありません。 ::" -#: ../../library/typing.rst:1028 msgid "" "class Eggs:\n" " # Self would be an incorrect return annotation here,\n" @@ -1701,32 +2070,42 @@ msgid "" " def returns_eggs(self) -> \"Eggs\":\n" " return Eggs()" msgstr "" +"class Eggs:\n" +" # サブクラスでも常に Eggs のインスタンスを返すため、\n" +" # ここの戻り値のアノテーションに Self を使うのは\n" +" # 誤りになる\n" +" def returns_eggs(self) -> \"Eggs\":\n" +" return Eggs()" #: ../../library/typing.rst:1035 msgid "See :pep:`673` for more details." msgstr "より詳しくは :pep:`673` を参照してください。" -#: ../../library/typing.rst:1041 msgid "" "Special annotation for explicitly declaring a :ref:`type alias `." msgstr "" +":ref:`型エイリアス ` を明示的に宣言するための特殊なアノテーショ" +"ンです。" -#: ../../library/typing.rst:1045 msgid "" "from typing import TypeAlias\n" "\n" "Factors: TypeAlias = list[int]" msgstr "" +"from typing import TypeAlias\n" +"\n" +"Factors: TypeAlias = list[int]" -#: ../../library/typing.rst:1049 msgid "" "``TypeAlias`` is particularly useful on older Python versions for annotating " "aliases that make use of forward references, as it can be hard for type " "checkers to distinguish these from normal variable assignments:" msgstr "" +"古いバージョンの Python では、型チェッカーが前方参照を使うエイリアスと通常の" +"変数代入を区別しにくい場合があります。\n" +"そのようなエイリアスのアノテーションには ``TypeAlias`` が特に役立ちます:" -#: ../../library/typing.rst:1053 msgid "" "from typing import Generic, TypeAlias, TypeVar\n" "\n" @@ -1743,12 +2122,24 @@ msgid "" " @classmethod\n" " def make_box_of_strings(cls) -> BoxOfStrings: ..." msgstr "" +"from typing import Generic, TypeAlias, TypeVar\n" +"\n" +"T = TypeVar(\"T\")\n" +"\n" +"# \"Box\" はまだ存在しないため、Python 3.12 未満では\n" +"# 前方参照をクォートで囲む必要がある。\n" +"# ``TypeAlias`` により、文字列を変数に代入するのではなく\n" +"# 型エイリアスを宣言していることが型チェッカーに伝わる。\n" +"BoxOfStrings: TypeAlias = \"Box[str]\"\n" +"\n" +"class Box(Generic[T]):\n" +" @classmethod\n" +" def make_box_of_strings(cls) -> BoxOfStrings: ..." #: ../../library/typing.rst:1069 msgid "See :pep:`613` for more details." msgstr "より詳しくは、 :pep:`613` をご覧ください。" -#: ../../library/typing.rst:1073 msgid "" ":data:`TypeAlias` is deprecated in favor of the :keyword:`type` statement, " "which creates instances of :class:`TypeAliasType` and which natively " @@ -1758,6 +2149,13 @@ msgid "" "`TypeAlias` is not currently planned, but users are encouraged to migrate " "to :keyword:`type` statements." msgstr "" +":data:`TypeAlias` は非推奨です。\n" +"代わりに、:class:`TypeAliasType` のインスタンスを作成し、前方参照に直接対応し" +"ている :keyword:`type` 文を使ってください。\n" +":data:`TypeAlias` と :class:`TypeAliasType` は用途や名前が似ていますが、別の" +"ものであり、後者は前者の型ではありません。\n" +"現時点では :data:`TypeAlias` の削除予定はありませんが、:keyword:`type` 文への" +"移行が推奨されます。" #: ../../library/typing.rst:1084 msgid "Special forms" @@ -1778,11 +2176,14 @@ msgid "" msgstr "" "ユニオン型; ``Union[X, Y]`` は ``X | Y`` と等価で X または Y を表します。" -#: ../../library/typing.rst:1093 msgid "" "To define a union, use e.g. ``Union[int, str]`` or the shorthand ``int | " "str``. Using that shorthand is recommended. Details:" msgstr "" +"ユニオンを定義するには、例えば ``Union[int, str]`` または省略形の ``int | " +"str`` を使います。\n" +"省略形の使用を推奨します。\n" +"詳細は次のとおりです:" #: ../../library/typing.rst:1095 msgid "The arguments must be types and there must be at least one." @@ -1792,45 +2193,44 @@ msgstr "引数は型でなければならず、少なくとも一つ必要です msgid "Unions of unions are flattened, e.g.::" msgstr "ユニオン型のユニオン型は平滑化されます。例えば::" -#: ../../library/typing.rst:1099 msgid "Union[Union[int, str], float] == Union[int, str, float]" -msgstr "" +msgstr "Union[Union[int, str], float] == Union[int, str, float]" -#: ../../library/typing.rst:1101 msgid "" "However, this does not apply to unions referenced through a type alias, to " "avoid forcing evaluation of the underlying :class:`TypeAliasType`::" msgstr "" +"ただし、型エイリアスを介して参照されるユニオンにはこの処理は適用されませ" +"ん。\n" +"元の :class:`TypeAliasType` を強制的に評価することを避けるためです。 ::" -#: ../../library/typing.rst:1104 msgid "" "type A = Union[int, str]\n" "Union[A, float] != Union[int, str, float]" msgstr "" +"type A = Union[int, str]\n" +"Union[A, float] != Union[int, str, float]" #: ../../library/typing.rst:1107 msgid "Unions of a single argument vanish, e.g.::" msgstr "引数が一つのユニオン型は消えます。例えば::" -#: ../../library/typing.rst:1109 msgid "Union[int] == int # The constructor actually returns int" -msgstr "" +msgstr "Union[int] == int # コンストラクタは実際に int を返す" #: ../../library/typing.rst:1111 ../../library/typing.rst:1253 msgid "Redundant arguments are skipped, e.g.::" msgstr "冗長な実引数は飛ばされます。例えば::" -#: ../../library/typing.rst:1113 msgid "Union[int, str, int] == Union[int, str] == int | str" -msgstr "" +msgstr "Union[int, str, int] == Union[int, str] == int | str" #: ../../library/typing.rst:1115 msgid "When comparing unions, the argument order is ignored, e.g.::" msgstr "ユニオン型を比較するとき引数の順序は無視されます。例えば::" -#: ../../library/typing.rst:1117 msgid "Union[int, str] == Union[str, int]" -msgstr "" +msgstr "Union[int, str] == Union[str, int]" #: ../../library/typing.rst:1119 msgid "You cannot subclass or instantiate a ``Union``." @@ -1854,7 +2254,6 @@ msgstr "" "ユニオン型は ``X | Y`` のように書けるようになりました。 :ref:`union型の表現 " "` を参照ください。" -#: ../../library/typing.rst:1130 msgid "" ":class:`types.UnionType` is now an alias for :class:`Union`, and both " "``Union[int, str]`` and ``int | str`` create instances of the same class. To " @@ -1862,29 +2261,35 @@ msgid "" "Union)``. For compatibility with earlier versions of Python, use " "``get_origin(obj) is typing.Union or get_origin(obj) is types.UnionType``." msgstr "" +":class:`types.UnionType` は :class:`Union` のエイリアスとなり、``Union[int, " +"str]`` と ``int | str`` は同じクラスのインスタンスを作成するようになりまし" +"た。\n" +"実行時にオブジェクトが ``Union`` かどうかを調べるには、``isinstance(obj, " +"Union)`` を使ってください。\n" +"以前のバージョンの Python との互換性を保つには、``get_origin(obj) is typing." +"Union or get_origin(obj) is types.UnionType`` を使ってください。" #: ../../library/typing.rst:1140 msgid "``Optional[X]`` is equivalent to ``X | None`` (or ``Union[X, None]``)." msgstr "``Optional[X]`` は ``X | None`` (や ``Union[X, None]``) と同等です。" -#: ../../library/typing.rst:1142 msgid "" "Note that this is not the same concept as an optional argument, which is one " "that has a default. An optional argument with a default does not require " "the ``Optional`` qualifier on its type annotation just because it is " "optional. For example::" msgstr "" -"これがデフォルト値を持つオプション引数とは同じ概念ではないということに注意し" -"てください。\n" -"デフォルト値を持つオプション引数はオプション引数であるために、型アノテーショ" -"ンに ``Optional`` 修飾子は必要ありません。\n" -"例えば次のようになります::" +"これは、デフォルト値を持つ省略可能な引数とは別の概念です。\n" +"デフォルト値があり省略可能というだけで、その引数の型アノテーションに " +"``Optional`` が必要になるわけではありません。\n" +"例えば次のようになります。 ::" -#: ../../library/typing.rst:1147 msgid "" "def foo(arg: int = 0) -> None:\n" " ..." msgstr "" +"def foo(arg: int = 0) -> None:\n" +" ..." #: ../../library/typing.rst:1150 msgid "" @@ -1896,23 +2301,23 @@ msgstr "" "数がオプションであろうとなかろうと、 ``Optional`` を使うのが好ましいです。\n" "例えば次のようになります::" -#: ../../library/typing.rst:1154 msgid "" "def foo(arg: Optional[int] = None) -> None:\n" " ..." msgstr "" +"def foo(arg: Optional[int] = None) -> None:\n" +" ..." #: ../../library/typing.rst:1157 msgid "" "Optional can now be written as ``X | None``. See :ref:`union type " "expressions`." msgstr "" -"Optionalは ``X | None`` のように書けるようになりました。 ref:`union型の表現 " +"Optionalは ``X | None`` のように書けるようになりました。 :ref:`union型の表現 " "` を参照ください。" -#: ../../library/typing.rst:1163 msgid "Special form for annotating higher-order functions." -msgstr "" +msgstr "高階関数をアノテーションするための特殊形式です。" #: ../../library/typing.rst:1165 msgid "" @@ -1925,7 +2330,6 @@ msgid "" "``Concatenate`` must be a :class:`ParamSpec` or ellipsis (``...``)." msgstr "" -#: ../../library/typing.rst:1174 msgid "" "For example, to annotate a decorator ``with_lock`` which provides a :class:" "`threading.Lock` to the decorated function, ``Concatenate`` can be used to " @@ -1935,8 +2339,15 @@ msgid "" "parameter types are dependent on the parameter types of the callable being " "passed in::" msgstr "" +"例えば、デコレートした関数に :class:`threading.Lock` を渡すデコレータ " +"``with_lock`` にアノテーションを付ける場合を考えます。\n" +"``Concatenate`` を使うと、``with_lock`` が最初の引数に ``Lock`` を取る呼び出" +"し可能オブジェクトを受け取り、\n" +"異なる型シグネチャの呼び出し可能オブジェクトを返すことを示せます。\n" +"この場合、:class:`ParamSpec` は、返される呼び出し可能オブジェクトのパラメータ" +"の型が、渡された呼び出し可能オブジェクトのパラメータの型に依存することを示し" +"ます。 ::" -#: ../../library/typing.rst:1182 msgid "" "from collections.abc import Callable\n" "from threading import Lock\n" @@ -1963,32 +2374,54 @@ msgid "" "# We don't need to pass in the lock ourselves thanks to the decorator.\n" "sum_threadsafe([1.1, 2.2, 3.3])" msgstr "" +"from collections.abc import Callable\n" +"from threading import Lock\n" +"from typing import Concatenate\n" +"\n" +"# このロックを使い、どの時点でも関数を実行するスレッドが\n" +"# 1 つだけになるようにする。\n" +"my_lock = Lock()\n" +"\n" +"def with_lock[**P, R](f: Callable[Concatenate[Lock, P], R]) -> Callable[P, " +"R]:\n" +" '''ロックを渡す型安全なデコレータ。'''\n" +" def inner(*args: P.args, **kwargs: P.kwargs) -> R:\n" +" # 最初の引数としてロックを渡す。\n" +" return f(my_lock, *args, **kwargs)\n" +" return inner\n" +"\n" +"@with_lock\n" +"def sum_threadsafe(lock: Lock, numbers: list[float]) -> float:\n" +" '''数値のリストをスレッドセーフな方法で合計する。'''\n" +" with lock:\n" +" return sum(numbers)\n" +"\n" +"# デコレータがあるので、ロックを自分で渡す必要はない。\n" +"sum_threadsafe([1.1, 2.2, 3.3])" -#: ../../library/typing.rst:1210 ../../library/typing.rst:2211 msgid "" ":pep:`612` -- Parameter Specification Variables (the PEP which introduced " "``ParamSpec`` and ``Concatenate``)" msgstr "" +":pep:`612` -- パラメータ仕様変数 (``ParamSpec`` と ``Concatenate`` を導入し" +"た PEP)" -#: ../../library/typing.rst:1212 msgid ":class:`ParamSpec`" -msgstr "" +msgstr ":class:`ParamSpec`" -#: ../../library/typing.rst:1213 ../../library/typing.rst:2214 msgid ":ref:`annotating-callables`" -msgstr "" +msgstr ":ref:`annotating-callables`" -#: ../../library/typing.rst:1217 msgid "Special typing form to define \"literal types\"." -msgstr "" +msgstr "「リテラル型」を定義するための特殊な型付け形式です。" -#: ../../library/typing.rst:1219 msgid "" "``Literal`` can be used to indicate to type checkers that the annotated " "object has a value equivalent to one of the provided literals." msgstr "" +"``Literal`` は、アノテーションを付けたオブジェクトの値が、指定したリテラルの" +"いずれかと等しいことを型チェッカーに示すために使えます。" -#: ../../library/typing.rst:1225 msgid "" "def validate_simple(data: Any) -> Literal[True]: # always returns True\n" " ...\n" @@ -2000,6 +2433,15 @@ msgid "" "open_helper('/some/path', 'r') # Passes type check\n" "open_helper('/other/path', 'typo') # Error in type checker" msgstr "" +"def validate_simple(data: Any) -> Literal[True]: # 常に True を返す\n" +" ...\n" +"\n" +"type Mode = Literal['r', 'rb', 'w', 'wb']\n" +"def open_helper(file: str, mode: Mode) -> str:\n" +" ...\n" +"\n" +"open_helper('/some/path', 'r') # 型チェックを通過する\n" +"open_helper('/other/path', 'typo') # 型チェッカーのエラー" #: ../../library/typing.rst:1235 msgid "" @@ -2012,53 +2454,51 @@ msgstr "" "が制約を課すことがあります。\n" "リテラル型についてより詳しいことは :pep:`586` を参照してください。" -#: ../../library/typing.rst:1239 msgid "Additional details:" -msgstr "" +msgstr "その他の詳細:" -#: ../../library/typing.rst:1241 msgid "The arguments must be literal values and there must be at least one." -msgstr "" +msgstr "引数はリテラル値でなければならず、少なくとも 1 つ必要です。" -#: ../../library/typing.rst:1243 msgid "Nested ``Literal`` types are flattened, e.g.::" msgstr "" +"入れ子の ``Literal`` 型は平坦化されます。\n" +"例えば次のようになります。 ::" -#: ../../library/typing.rst:1245 msgid "assert Literal[Literal[1, 2], 3] == Literal[1, 2, 3]" -msgstr "" +msgstr "assert Literal[Literal[1, 2], 3] == Literal[1, 2, 3]" -#: ../../library/typing.rst:1247 msgid "" "However, this does not apply to ``Literal`` types referenced through a type " "alias, to avoid forcing evaluation of the underlying :class:`TypeAliasType`::" msgstr "" +"ただし、型エイリアスを介して参照される ``Literal`` 型にはこの処理は適用されま" +"せん。\n" +"元の :class:`TypeAliasType` を強制的に評価することを避けるためです。 ::" -#: ../../library/typing.rst:1250 msgid "" "type A = Literal[1, 2]\n" "assert Literal[A, 3] != Literal[1, 2, 3]" msgstr "" +"type A = Literal[1, 2]\n" +"assert Literal[A, 3] != Literal[1, 2, 3]" -#: ../../library/typing.rst:1255 msgid "assert Literal[1, 2, 1] == Literal[1, 2]" -msgstr "" +msgstr "assert Literal[1, 2, 1] == Literal[1, 2]" -#: ../../library/typing.rst:1257 msgid "When comparing literals, the argument order is ignored, e.g.::" msgstr "" +"リテラル型を比較するとき、引数の順序は無視されます。\n" +"例えば次のようになります。 ::" -#: ../../library/typing.rst:1259 msgid "assert Literal[1, 2] == Literal[2, 1]" -msgstr "" +msgstr "assert Literal[1, 2] == Literal[2, 1]" -#: ../../library/typing.rst:1261 msgid "You cannot subclass or instantiate a ``Literal``." -msgstr "" +msgstr "``Literal`` のサブクラスやインスタンスは作成できません。" -#: ../../library/typing.rst:1263 msgid "You cannot write ``Literal[X][Y]``." -msgstr "" +msgstr "``Literal[X][Y]`` とは書けません。" #: ../../library/typing.rst:1267 msgid "" @@ -2086,16 +2526,18 @@ msgstr "" "て、ある属性はクラス変数として使うつもりであり、そのクラスのインスタンスから" "設定すべきではないということを示せます。使い方は次のようになります::" -#: ../../library/typing.rst:1281 msgid "" "class Starship:\n" " stats: ClassVar[dict[str, int]] = {} # class variable\n" " damage: int = 10 # instance variable" msgstr "" +"class Starship:\n" +" stats: ClassVar[dict[str, int]] = {} # クラス変数\n" +" damage: int = 10 # インスタンス変数" -#: ../../library/typing.rst:1285 msgid ":data:`ClassVar` accepts only types and cannot be further subscribed." -msgstr ":data:`ClassVar` は型のみを受け入れ、それ以外は受け付けられません。" +msgstr "" +":data:`ClassVar` は型だけを受け入れ、さらに添字付けすることはできません。" #: ../../library/typing.rst:1287 msgid "" @@ -2117,21 +2559,23 @@ msgid "" "Starship.stats = {} # This is OK" msgstr "" -#: ../../library/typing.rst:1301 msgid ":data:`ClassVar` can now be nested in :data:`Final` and vice versa." msgstr "" +":data:`ClassVar` を :data:`Final` の内側に入れることも、その逆も可能になりま" +"した。" -#: ../../library/typing.rst:1305 msgid "Special typing construct to indicate final names to type checkers." msgstr "" +"再代入できない名前であることを型チェッカーに示すための特殊な型構築子です。" -#: ../../library/typing.rst:1307 msgid "" "Final names cannot be reassigned in any scope. Final names declared in class " "scopes cannot be overridden in subclasses." msgstr "" +"final とされた名前は、どのスコープでも再代入できません。\n" +"クラススコープで宣言された final な名前は、サブクラスでオーバーライドできませ" +"ん。" -#: ../../library/typing.rst:1312 msgid "" "MAX_SIZE: Final = 9000\n" "MAX_SIZE += 1 # Error reported by type checker\n" @@ -2142,6 +2586,14 @@ msgid "" "class FastConnector(Connection):\n" " TIMEOUT = 1 # Error reported by type checker" msgstr "" +"MAX_SIZE: Final = 9000\n" +"MAX_SIZE += 1 # 型チェッカーがエラーを報告する\n" +"\n" +"class Connection:\n" +" TIMEOUT: Final[int] = 10\n" +"\n" +"class FastConnector(Connection):\n" +" TIMEOUT = 1 # 型チェッカーがエラーを報告する" #: ../../library/typing.rst:1321 ../../library/typing.rst:3234 msgid "" @@ -2151,35 +2603,39 @@ msgstr "" "この機能は実行時には検査されません。詳細については :pep:`591` を参照してくだ" "さい。" -#: ../../library/typing.rst:1328 msgid ":data:`Final` can now be nested in :data:`ClassVar` and vice versa." msgstr "" +":data:`Final` を :data:`ClassVar` の内側に入れることも、その逆も可能になりま" +"した。" -#: ../../library/typing.rst:1332 msgid "Special typing construct to mark a :class:`TypedDict` key as required." msgstr "" +":class:`TypedDict` のキーが必須であることを示すための特殊な型構築子です。" -#: ../../library/typing.rst:1334 msgid "" "This is mainly useful for ``total=False`` TypedDicts. See :class:`TypedDict` " "and :pep:`655` for more details." msgstr "" +"主に ``total=False`` の TypedDict で役立ちます。\n" +"詳細は :class:`TypedDict` と :pep:`655` を参照してください。" -#: ../../library/typing.rst:1341 msgid "" "Special typing construct to mark a :class:`TypedDict` key as potentially " "missing." msgstr "" +":class:`TypedDict` のキーが存在しない場合もあることを示すための特殊な型構築子" +"です。" #: ../../library/typing.rst:1344 msgid "See :class:`TypedDict` and :pep:`655` for more details." msgstr "より詳しくは、 :class:`TypedDict` と :pep:`655` を参照してください。" -#: ../../library/typing.rst:1350 msgid "" "A special typing construct to mark an item of a :class:`TypedDict` as read-" "only." msgstr "" +":class:`TypedDict` の項目が読み取り専用であることを示すための特殊な型構築子で" +"す。" #: ../../library/typing.rst:1354 msgid "" @@ -2192,27 +2648,28 @@ msgid "" " m[\"title\"] = \"The Matrix\" # typechecker error" msgstr "" -#: ../../library/typing.rst:1362 msgid "There is no runtime checking for this property." -msgstr "" +msgstr "この性質は実行時には検査されません。" -#: ../../library/typing.rst:1364 msgid "See :class:`TypedDict` and :pep:`705` for more details." -msgstr "" +msgstr "詳細は :class:`TypedDict` と :pep:`705` を参照してください。" -#: ../../library/typing.rst:1370 msgid "Special typing form to add context-specific metadata to an annotation." msgstr "" +"アノテーションに文脈固有のメタデータを追加するための特殊な型付け形式です。" -#: ../../library/typing.rst:1372 msgid "" "Add metadata ``x`` to a given type ``T`` by using the annotation " "``Annotated[T, x]``. Metadata added using ``Annotated`` can be used by " "static analysis tools or at runtime. At runtime, the metadata is stored in " "a :attr:`!__metadata__` attribute." msgstr "" +"``Annotated[T, x]`` というアノテーションを使って、型 ``T`` にメタデータ " +"``x`` を追加します。\n" +"``Annotated`` で追加したメタデータは、静的解析ツールでも実行時にも利用できま" +"す。\n" +"実行時には、メタデータは :attr:`!__metadata__` 属性に格納されます。" -#: ../../library/typing.rst:1377 msgid "" "If a library or tool encounters an annotation ``Annotated[T, x]`` and has no " "special logic for the metadata, it should ignore the metadata and simply " @@ -2220,6 +2677,11 @@ msgid "" "that wants to use annotations for purposes outside Python's static typing " "system." msgstr "" +"ライブラリやツールが ``Annotated[T, x]`` というアノテーションを処理するとき、" +"メタデータに対する特別な処理を持たなければ、\n" +"メタデータを無視してアノテーションを単に ``T`` として扱うべきです。\n" +"このため、``Annotated`` は Python の静的型システム以外の目的でアノテーション" +"を利用するコードに役立ちます。" #: ../../library/typing.rst:1383 msgid "" @@ -2231,21 +2693,26 @@ msgid "" "for a function or class." msgstr "" -#: ../../library/typing.rst:1390 msgid "" "The responsibility of how to interpret the metadata lies with the tool or " "library encountering an ``Annotated`` annotation. A tool or library " "encountering an ``Annotated`` type can scan through the metadata elements to " "determine if they are of interest (e.g., using :func:`isinstance`)." msgstr "" +"メタデータをどう解釈するかは、``Annotated`` アノテーションを処理するツールや" +"ライブラリの責任です。\n" +"``Annotated`` 型を処理するツールやライブラリは、メタデータの各要素を調べ" +"て、\n" +"自分が扱うべきものかどうかを判定できます (例えば :func:`isinstance` を使いま" +"す)。" -#: ../../library/typing.rst:1398 msgid "" "Here is an example of how you might use ``Annotated`` to add metadata to " "type annotations if you were doing range analysis:" msgstr "" +"範囲解析を行う場合に、``Annotated`` を使って型アノテーションにメタデータを追" +"加する例を示します:" -#: ../../library/typing.rst:1401 msgid "" "@dataclass\n" "class ValueRange:\n" @@ -2255,15 +2722,24 @@ msgid "" "T1 = Annotated[int, ValueRange(-10, 5)]\n" "T2 = Annotated[T1, ValueRange(-20, 3)]" msgstr "" +"@dataclass\n" +"class ValueRange:\n" +" lo: int\n" +" hi: int\n" +"\n" +"T1 = Annotated[int, ValueRange(-10, 5)]\n" +"T2 = Annotated[T1, ValueRange(-20, 3)]" -#: ../../library/typing.rst:1411 msgid "" "The first argument to ``Annotated`` must be a valid type. Multiple metadata " "elements can be supplied as ``Annotated`` supports variadic arguments. The " "order of the metadata elements is preserved and matters for equality checks::" msgstr "" +"``Annotated`` の最初の引数は有効な型でなければなりません。\n" +"``Annotated`` は可変長引数に対応しているため、複数のメタデータ要素を指定でき" +"ます。\n" +"メタデータ要素の順序は保持され、等価比較の結果にも影響します。 ::" -#: ../../library/typing.rst:1415 msgid "" "@dataclass\n" "class ctype:\n" @@ -2274,59 +2750,78 @@ msgid "" "\n" "assert a1 != a2 # Order matters" msgstr "" +"@dataclass\n" +"class ctype:\n" +" kind: str\n" +"\n" +"a1 = Annotated[int, ValueRange(3, 10), ctype(\"char\")]\n" +"a2 = Annotated[int, ctype(\"char\"), ValueRange(3, 10)]\n" +"\n" +"assert a1 != a2 # 順序が影響する" -#: ../../library/typing.rst:1424 msgid "" "It is up to the tool consuming the annotations to decide whether the client " "is allowed to add multiple metadata elements to one annotation and how to " "merge those annotations." msgstr "" +"利用者が 1 つのアノテーションに複数のメタデータ要素を追加してよいかどうかや、" +"それらのアノテーションをどう統合するかは、アノテーションを利用するツールが決" +"めます。" -#: ../../library/typing.rst:1428 msgid "" "Nested ``Annotated`` types are flattened. The order of the metadata elements " "starts with the innermost annotation::" msgstr "" +"入れ子の ``Annotated`` 型は平坦化されます。\n" +"メタデータ要素は、最も内側のアノテーションから順に並びます。 ::" -#: ../../library/typing.rst:1431 msgid "" "assert Annotated[Annotated[int, ValueRange(3, 10)], ctype(\"char\")] == " "Annotated[\n" " int, ValueRange(3, 10), ctype(\"char\")\n" "]" msgstr "" +"assert Annotated[Annotated[int, ValueRange(3, 10)], ctype(\"char\")] == " +"Annotated[\n" +" int, ValueRange(3, 10), ctype(\"char\")\n" +"]" -#: ../../library/typing.rst:1435 msgid "" "However, this does not apply to ``Annotated`` types referenced through a " "type alias, to avoid forcing evaluation of the underlying :class:" "`TypeAliasType`::" msgstr "" +"ただし、型エイリアスを介して参照される ``Annotated`` 型にはこの処理は適用され" +"ません。\n" +"元の :class:`TypeAliasType` を強制的に評価することを避けるためです。 ::" -#: ../../library/typing.rst:1438 msgid "" "type From3To10[T] = Annotated[T, ValueRange(3, 10)]\n" "assert Annotated[From3To10[int], ctype(\"char\")] != Annotated[\n" " int, ValueRange(3, 10), ctype(\"char\")\n" "]" msgstr "" +"type From3To10[T] = Annotated[T, ValueRange(3, 10)]\n" +"assert Annotated[From3To10[int], ctype(\"char\")] != Annotated[\n" +" int, ValueRange(3, 10), ctype(\"char\")\n" +"]" -#: ../../library/typing.rst:1443 msgid "Duplicated metadata elements are not removed::" -msgstr "" +msgstr "重複するメタデータ要素は取り除かれません。 ::" -#: ../../library/typing.rst:1445 msgid "" "assert Annotated[int, ValueRange(3, 10)] != Annotated[\n" " int, ValueRange(3, 10), ValueRange(3, 10)\n" "]" msgstr "" +"assert Annotated[int, ValueRange(3, 10)] != Annotated[\n" +" int, ValueRange(3, 10), ValueRange(3, 10)\n" +"]" -#: ../../library/typing.rst:1449 msgid "``Annotated`` can be used with nested and generic aliases:" msgstr "" +"``Annotated`` は、入れ子のエイリアスやジェネリックなエイリアスで使えます:" -#: ../../library/typing.rst:1451 msgid "" "@dataclass\n" "class MaxLen:\n" @@ -2339,30 +2834,41 @@ msgid "" "# ``Annotated[list[tuple[int, int]], MaxLen(10)]``:\n" "type V = Vec[int]" msgstr "" +"@dataclass\n" +"class MaxLen:\n" +" value: int\n" +"\n" +"type Vec[T] = Annotated[list[tuple[T, T]], MaxLen(10)]\n" +"\n" +"# 型アノテーションで使うと、型チェッカーは \"V\" を\n" +"# ``Annotated[list[tuple[int, int]], MaxLen(10)]`` と同じように扱う:\n" +"type V = Vec[int]" -#: ../../library/typing.rst:1463 msgid "``Annotated`` cannot be used with an unpacked :class:`TypeVarTuple`::" -msgstr "" +msgstr "``Annotated`` は、展開された :class:`TypeVarTuple` では使えません。 ::" -#: ../../library/typing.rst:1465 msgid "" "type Variadic[*Ts] = Annotated[*Ts, Ann1] = Annotated[T1, T2, T3, ..., " "Ann1] # NOT valid" msgstr "" +"type Variadic[*Ts] = Annotated[*Ts, Ann1] = Annotated[T1, T2, T3, ..., " +"Ann1] # 無効" -#: ../../library/typing.rst:1467 msgid "" "where ``T1``, ``T2``, ... are :class:`TypeVars `. This is invalid " "as only one type should be passed to Annotated." msgstr "" +"ここで ``T1``、``T2``、... は :class:`TypeVar ` です。\n" +"Annotated に渡す型は 1 つだけでなければならないため、この書き方は無効です。" -#: ../../library/typing.rst:1470 msgid "" "By default, :func:`get_type_hints` strips the metadata from annotations. " "Pass ``include_extras=True`` to have the metadata preserved:" msgstr "" +"デフォルトでは :func:`get_type_hints` はアノテーションからメタデータを取り除" +"きます。\n" +"メタデータを保持するには ``include_extras=True`` を渡してください:" -#: ../../library/typing.rst:1473 msgid "" ">>> from typing import Annotated, get_type_hints\n" ">>> def func(x: Annotated[int, \"metadata\"]) -> None: pass\n" @@ -2372,14 +2878,21 @@ msgid "" ">>> get_type_hints(func, include_extras=True)\n" "{'x': typing.Annotated[int, 'metadata'], 'return': }" msgstr "" +">>> from typing import Annotated, get_type_hints\n" +">>> def func(x: Annotated[int, \"metadata\"]) -> None: pass\n" +"...\n" +">>> get_type_hints(func)\n" +"{'x': , 'return': }\n" +">>> get_type_hints(func, include_extras=True)\n" +"{'x': typing.Annotated[int, 'metadata'], 'return': }" -#: ../../library/typing.rst:1483 msgid "" "At runtime, the metadata associated with an ``Annotated`` type can be " "retrieved via the :attr:`!__metadata__` attribute:" msgstr "" +"実行時には、``Annotated`` 型に関連付けられたメタデータを :attr:`!" +"__metadata__` 属性から取得できます:" -#: ../../library/typing.rst:1486 msgid "" ">>> from typing import Annotated\n" ">>> X = Annotated[int, \"very\", \"important\", \"metadata\"]\n" @@ -2388,53 +2901,65 @@ msgid "" ">>> X.__metadata__\n" "('very', 'important', 'metadata')" msgstr "" +">>> from typing import Annotated\n" +">>> X = Annotated[int, \"very\", \"important\", \"metadata\"]\n" +">>> X\n" +"typing.Annotated[int, 'very', 'important', 'metadata']\n" +">>> X.__metadata__\n" +"('very', 'important', 'metadata')" -#: ../../library/typing.rst:1495 msgid "" "If you want to retrieve the original type wrapped by ``Annotated``, use the :" "attr:`!__origin__` attribute:" msgstr "" +"``Annotated`` でラップされた元の型を取得するには、:attr:`!__origin__` 属性を" +"使ってください:" -#: ../../library/typing.rst:1498 msgid "" ">>> from typing import Annotated, get_origin\n" ">>> Password = Annotated[str, \"secret\"]\n" ">>> Password.__origin__\n" "" msgstr "" +">>> from typing import Annotated, get_origin\n" +">>> Password = Annotated[str, \"secret\"]\n" +">>> Password.__origin__\n" +"" -#: ../../library/typing.rst:1505 msgid "Note that using :func:`get_origin` will return ``Annotated`` itself:" msgstr "" +":func:`get_origin` を使うと ``Annotated`` 自体が返されることに注意してくださ" +"い:" -#: ../../library/typing.rst:1507 msgid "" ">>> get_origin(Password)\n" "typing.Annotated" msgstr "" +">>> get_origin(Password)\n" +"typing.Annotated" -#: ../../library/typing.rst:1514 msgid ":pep:`593` - Flexible function and variable annotations" -msgstr "" +msgstr ":pep:`593` - 関数と変数の柔軟なアノテーション" -#: ../../library/typing.rst:1515 msgid "The PEP introducing ``Annotated`` to the standard library." -msgstr "" +msgstr "``Annotated`` を標準ライブラリに導入した PEP です。" -#: ../../library/typing.rst:1522 ../../library/typing.rst:1606 msgid "" "Special typing construct for marking user-defined type predicate functions." -msgstr "" +msgstr "ユーザー定義の型述語関数であることを示すための特殊な型構築子です。" -#: ../../library/typing.rst:1524 msgid "" "``TypeIs`` can be used to annotate the return type of a user-defined type " "predicate function. ``TypeIs`` only accepts a single type argument. At " "runtime, functions marked this way should return a boolean and take at least " "one positional argument." msgstr "" +"``TypeIs`` は、ユーザー定義の型述語関数の戻り値の型をアノテーションするために" +"使えます。\n" +"``TypeIs`` が受け取る型引数は 1 つだけです。\n" +"このようにアノテーションされた関数は、実行時に少なくとも 1 つの位置引数を受け" +"取り、ブール値を返す必要があります。" -#: ../../library/typing.rst:1529 msgid "" "``TypeIs`` aims to benefit *type narrowing* -- a technique used by static " "type checkers to determine a more precise type of an expression within a " @@ -2443,8 +2968,13 @@ msgid "" "conditional expression here is sometimes referred to as a \"type " "predicate\"::" msgstr "" +"``TypeIs`` は *型の絞り込み* に役立つように設計されています。\n" +"これは、静的型チェッカーがプログラムの制御フロー内で式の型をより具体的に特定" +"する手法です。\n" +"通常は条件分岐を解析し、その結果に基づいてコードブロック内の型を絞り込みま" +"す。\n" +"ここで使われる条件式を「型述語」と呼ぶことがあります。 ::" -#: ../../library/typing.rst:1535 msgid "" "def is_str(val: str | float):\n" " # \"isinstance\" type predicate\n" @@ -2455,8 +2985,15 @@ msgid "" " # Else, type of ``val`` is narrowed to ``float``.\n" " ..." msgstr "" +"def is_str(val: str | float):\n" +" # \"isinstance\" による型述語\n" +" if isinstance(val, str):\n" +" # ``val`` の型を ``str`` に絞り込む\n" +" ...\n" +" else:\n" +" # そうでなければ、``val`` の型を ``float`` に絞り込む。\n" +" ..." -#: ../../library/typing.rst:1544 msgid "" "Sometimes it would be convenient to use a user-defined boolean function as a " "type predicate. Such a function should use ``TypeIs[...]`` or :data:" @@ -2466,30 +3003,39 @@ msgid "" "incompatible (e.g., ``list[object]`` to ``list[int]``) or when the function " "does not return ``True`` for all instances of the narrowed type." msgstr "" +"ブール値を返すユーザー定義関数を型述語として使うと便利な場合があります。\n" +"そのような関数では、静的型チェッカーに意図を伝えるため、戻り値の型に " +"``TypeIs[...]`` または :data:`TypeGuard` を使うべきです。\n" +"``TypeIs`` は通常 ``TypeGuard`` より直感的に動作しますが、\n" +"入力の型と絞り込む先の型に互換性がない場合 (``list[object]`` から " +"``list[int]`` など) や、\n" +"絞り込む先の型のすべてのインスタンスに対して ``True`` を返す関数でない場合に" +"は使えません。" -#: ../../library/typing.rst:1552 msgid "" "Using ``-> TypeIs[NarrowedType]`` tells the static type checker that for a " "given function:" msgstr "" +"``-> TypeIs[NarrowedType]`` と指定すると、静的型チェッカーに関数の以下の性質" +"を伝えられます:" -#: ../../library/typing.rst:1555 ../../library/typing.rst:1616 msgid "The return value is a boolean." -msgstr "" +msgstr "戻り値はブール値です。" -#: ../../library/typing.rst:1556 msgid "" "If the return value is ``True``, the type of its argument is the " "intersection of the argument's original type and ``NarrowedType``." msgstr "" +"戻り値が ``True`` なら、引数の型は、元の引数の型と ``NarrowedType`` の共通部" +"分になります。" -#: ../../library/typing.rst:1558 msgid "" "If the return value is ``False``, the type of its argument is narrowed to " "exclude ``NarrowedType``." msgstr "" +"戻り値が ``False`` なら、引数の型は ``NarrowedType`` を除外するように絞り込ま" +"れます。" -#: ../../library/typing.rst:1563 msgid "" "from typing import assert_type, final, TypeIs\n" "\n" @@ -2512,8 +3058,27 @@ msgid "" " # so only ``Unrelated`` is left.\n" " assert_type(arg, Unrelated)" msgstr "" +"from typing import assert_type, final, TypeIs\n" +"\n" +"class Parent: pass\n" +"class Child(Parent): pass\n" +"@final\n" +"class Unrelated: pass\n" +"\n" +"def is_parent(val: object) -> TypeIs[Parent]:\n" +" return isinstance(val, Parent)\n" +"\n" +"def run(arg: Child | Unrelated):\n" +" if is_parent(arg):\n" +" # ``arg`` の型を ``Parent`` と ``Child`` の共通部分に\n" +" # 絞り込む。\n" +" # これは ``Child`` と同じ。\n" +" assert_type(arg, Child)\n" +" else:\n" +" # ``arg`` の型から ``Parent`` を除外するように絞り込むので、\n" +" # ``Unrelated`` だけが残る。\n" +" assert_type(arg, Unrelated)" -#: ../../library/typing.rst:1584 msgid "" "The type inside ``TypeIs`` must be consistent with the type of the " "function's argument; if it is not, static type checkers will raise an " @@ -2521,54 +3086,67 @@ msgid "" "behavior in the type system; it is the user's responsibility to write such " "functions in a type-safe manner." msgstr "" +"``TypeIs`` の内側の型は、関数の引数の型と整合していなければなりません。\n" +"整合していなければ、静的型チェッカーがエラーを報告します。\n" +"``TypeIs`` 関数を誤って書くと型システムの健全性が損なわれるおそれがあり、その" +"ような関数を型安全に書くのは利用者の責任です。" -#: ../../library/typing.rst:1590 msgid "" "If a ``TypeIs`` function is a class or instance method, then the type in " "``TypeIs`` maps to the type of the second parameter (after ``cls`` or " "``self``)." msgstr "" +"``TypeIs`` 関数がクラスメソッドまたはインスタンスメソッドの場合、``TypeIs`` " +"内の型は (``cls`` または ``self`` の後の) 2 番目のパラメータの型に対応しま" +"す。" -#: ../../library/typing.rst:1594 msgid "" "In short, the form ``def foo(arg: TypeA) -> TypeIs[TypeB]: ...``, means that " "if ``foo(arg)`` returns ``True``, then ``arg`` is an instance of ``TypeB``, " "and if it returns ``False``, it is not an instance of ``TypeB``." msgstr "" +"つまり、``def foo(arg: TypeA) -> TypeIs[TypeB]: ...`` という形式は、\n" +"``foo(arg)`` が ``True`` を返したら ``arg`` は ``TypeB`` のインスタンスであ" +"り、\n" +"``False`` を返したら ``TypeB`` のインスタンスではないことを意味します。" -#: ../../library/typing.rst:1598 msgid "" "``TypeIs`` also works with type variables. For more information, see :pep:" "`742` (Narrowing types with ``TypeIs``)." msgstr "" +"``TypeIs`` は型変数でも使えます。\n" +"詳細は :pep:`742` (``TypeIs`` による型の絞り込み) を参照してください。" -#: ../../library/typing.rst:1608 msgid "" "Type predicate functions are user-defined functions that return whether " "their argument is an instance of a particular type. ``TypeGuard`` works " "similarly to :data:`TypeIs`, but has subtly different effects on type " "checking behavior (see below)." msgstr "" +"型述語関数は、引数が特定の型のインスタンスであるかどうかを返すユーザー定義関" +"数です。\n" +"``TypeGuard`` は :data:`TypeIs` と同じように動作しますが、型チェックへの効果" +"には細かな違いがあります (下記を参照)。" -#: ../../library/typing.rst:1613 msgid "" "Using ``-> TypeGuard`` tells the static type checker that for a given " "function:" msgstr "" +"``-> TypeGuard`` と指定すると、静的型チェッカーに関数の以下の性質を伝えられま" +"す:" -#: ../../library/typing.rst:1617 msgid "" "If the return value is ``True``, the type of its argument is the type inside " "``TypeGuard``." -msgstr "" +msgstr "戻り値が ``True`` なら、引数の型は ``TypeGuard`` 内の型になります。" -#: ../../library/typing.rst:1620 msgid "" "``TypeGuard`` also works with type variables. See :pep:`647` for more " "details." msgstr "" +"``TypeGuard`` は型変数でも使えます。\n" +"詳細は :pep:`647` を参照してください。" -#: ../../library/typing.rst:1624 msgid "" "def is_str_list(val: list[object]) -> TypeGuard[list[str]]:\n" " '''Determines whether all objects in the list are strings'''\n" @@ -2582,20 +3160,33 @@ msgid "" " # Type of ``val`` remains as ``list[object]``.\n" " print(\"Not a list of strings!\")" msgstr "" +"def is_str_list(val: list[object]) -> TypeGuard[list[str]]:\n" +" '''リスト内のすべてのオブジェクトが文字列かどうかを判定する'''\n" +" return all(isinstance(x, str) for x in val)\n" +"\n" +"def func1(val: list[object]):\n" +" if is_str_list(val):\n" +" # ``val`` の型を ``list[str]`` に絞り込む。\n" +" print(\" \".join(val))\n" +" else:\n" +" # ``val`` の型は ``list[object]`` のまま。\n" +" print(\"Not a list of strings!\")" -#: ../../library/typing.rst:1636 msgid "``TypeIs`` and ``TypeGuard`` differ in the following ways:" -msgstr "" +msgstr "``TypeIs`` と ``TypeGuard`` には以下の違いがあります:" -#: ../../library/typing.rst:1638 msgid "" "``TypeIs`` requires the narrowed type to be a subtype of the input type, " "while ``TypeGuard`` does not. The main reason is to allow for things like " "narrowing ``list[object]`` to ``list[str]`` even though the latter is not a " "subtype of the former, since ``list`` is invariant." msgstr "" +"``TypeIs`` は、絞り込む先の型が入力の型のサブタイプであることを要求しますが、" +"``TypeGuard`` は要求しません。\n" +"主な理由は、``list[object]`` から ``list[str]`` への絞り込みなどを可能にする" +"ためです。\n" +"``list`` は不変なので、後者は前者のサブタイプではありません。" -#: ../../library/typing.rst:1642 msgid "" "When a ``TypeGuard`` function returns ``True``, type checkers narrow the " "type of the variable to exactly the ``TypeGuard`` type. When a ``TypeIs`` " @@ -2603,43 +3194,56 @@ msgid "" "combining the previously known type of the variable with the ``TypeIs`` " "type. (Technically, this is known as an intersection type.)" msgstr "" +"``TypeGuard`` 関数が ``True`` を返すと、型チェッカーは変数の型を " +"``TypeGuard`` に指定された型そのものに絞り込みます。\n" +"``TypeIs`` 関数が ``True`` を返す場合は、変数についてすでに分かっている型と " +"``TypeIs`` に指定された型を組み合わせて、\n" +"型チェッカーはより具体的な型を推論できます (専門的には交差型と呼びます)。" -#: ../../library/typing.rst:1646 msgid "" "When a ``TypeGuard`` function returns ``False``, type checkers cannot narrow " "the type of the variable at all. When a ``TypeIs`` function returns " "``False``, type checkers can narrow the type of the variable to exclude the " "``TypeIs`` type." msgstr "" +"``TypeGuard`` 関数が ``False`` を返した場合、型チェッカーは変数の型をまったく" +"絞り込めません。\n" +"``TypeIs`` 関数が ``False`` を返した場合は、``TypeIs`` に指定された型を除外す" +"るように変数の型を絞り込めます。" -#: ../../library/typing.rst:1655 msgid "Typing operator to conceptually mark an object as having been unpacked." -msgstr "" +msgstr "オブジェクトが展開済みであることを概念的に示すための型付け演算子です。" -#: ../../library/typing.rst:1657 msgid "" "For example, using the unpack operator ``*`` on a :ref:`type variable tuple " "` is equivalent to using ``Unpack`` to mark the type variable " "tuple as having been unpacked::" msgstr "" +"例えば、:ref:`型変数タプル ` に展開演算子 ``*`` を適用すること" +"は、``Unpack`` を使ってその型変数タプルを展開済みと示すことと同じです。 ::" -#: ../../library/typing.rst:1661 msgid "" "Ts = TypeVarTuple('Ts')\n" "tup: tuple[*Ts]\n" "# Effectively does:\n" "tup: tuple[Unpack[Ts]]" msgstr "" +"Ts = TypeVarTuple('Ts')\n" +"tup: tuple[*Ts]\n" +"# 実質的に次と同じ:\n" +"tup: tuple[Unpack[Ts]]" -#: ../../library/typing.rst:1666 msgid "" "In fact, ``Unpack`` can be used interchangeably with ``*`` in the context " "of :class:`typing.TypeVarTuple ` and :class:`builtins.tuple " "` types. You might see ``Unpack`` being used explicitly in older " "versions of Python, where ``*`` couldn't be used in certain places::" msgstr "" +"実際、:class:`typing.TypeVarTuple ` や :class:`builtins.tuple " +"` の型を扱う場合、``Unpack`` と ``*`` は互いに置き換えられます。\n" +"古いバージョンの Python では ``*`` を使えない箇所があったため、``Unpack`` を" +"明示的に使う書き方も見られます。 ::" -#: ../../library/typing.rst:1672 msgid "" "# In older versions of Python, TypeVarTuple and Unpack\n" "# are located in the `typing_extensions` backports package.\n" @@ -2649,14 +3253,21 @@ msgid "" "tup: tuple[*Ts] # Syntax error on Python <= 3.10!\n" "tup: tuple[Unpack[Ts]] # Semantically equivalent, and backwards-compatible" msgstr "" +"# 古いバージョンの Python では、TypeVarTuple と Unpack は\n" +"# バックポート用の `typing_extensions` パッケージに含まれる。\n" +"from typing_extensions import TypeVarTuple, Unpack\n" +"\n" +"Ts = TypeVarTuple('Ts')\n" +"tup: tuple[*Ts] # Python 3.10 以下では構文エラー!\n" +"tup: tuple[Unpack[Ts]] # 意味は同じで、後方互換性もある" -#: ../../library/typing.rst:1680 msgid "" "``Unpack`` can also be used along with :class:`typing.TypedDict` for typing " "``**kwargs`` in a function signature::" msgstr "" +"``Unpack`` は :class:`typing.TypedDict` と組み合わせて、関数シグネチャの " +"``**kwargs`` の型を指定するためにも使えます。 ::" -#: ../../library/typing.rst:1683 msgid "" "from typing import TypedDict, Unpack\n" "\n" @@ -2668,60 +3279,78 @@ msgid "" "# and `year` of type `int`.\n" "def foo(**kwargs: Unpack[Movie]): ..." msgstr "" +"from typing import TypedDict, Unpack\n" +"\n" +"class Movie(TypedDict):\n" +" name: str\n" +" year: int\n" +"\n" +"# この関数は 2 つのキーワード引数を取る。\n" +"# `str` 型の `name` と `int` 型の `year`。\n" +"def foo(**kwargs: Unpack[Movie]): ..." -#: ../../library/typing.rst:1693 msgid "" "See :pep:`692` for more details on using ``Unpack`` for ``**kwargs`` typing." msgstr "" +"``Unpack`` で ``**kwargs`` の型を指定する方法の詳細は :pep:`692` を参照してく" +"ださい。" -#: ../../library/typing.rst:1698 msgid "Building generic types and type aliases" -msgstr "" +msgstr "ジェネリック型と型エイリアスの構築" -#: ../../library/typing.rst:1700 msgid "" "The following classes should not be used directly as annotations. Their " "intended purpose is to be building blocks for creating generic types and " "type aliases." msgstr "" +"以下のクラスをアノテーションとして直接使うべきではありません。\n" +"これらはジェネリック型や型エイリアスを作成するための構成要素として使うもので" +"す。" -#: ../../library/typing.rst:1704 msgid "" "These objects can be created through special syntax (:ref:`type parameter " "lists ` and the :keyword:`type` statement). For compatibility " "with Python 3.11 and earlier, they can also be created without the dedicated " "syntax, as documented below." msgstr "" +"これらのオブジェクトは、専用の構文 (:ref:`型引数リスト ` と :" +"keyword:`type` 文) で作成できます。\n" +"Python 3.11 以前との互換性のために、以下で説明するように専用の構文を使わずに" +"作成することもできます。" #: ../../library/typing.rst:1711 msgid "Abstract base class for generic types." msgstr "ジェネリック型のための抽象基底クラスです。" -#: ../../library/typing.rst:1713 msgid "" "A generic type is typically declared by adding a list of type parameters " "after the class name::" msgstr "" +"通常、ジェネリック型はクラス名の後に型引数のリストを追加して宣言します。 ::" -#: ../../library/typing.rst:1716 msgid "" "class Mapping[KT, VT]:\n" " def __getitem__(self, key: KT) -> VT:\n" " ...\n" " # Etc." msgstr "" +"class Mapping[KT, VT]:\n" +" def __getitem__(self, key: KT) -> VT:\n" +" ...\n" +" # など。" -#: ../../library/typing.rst:1721 msgid "" "Such a class implicitly inherits from ``Generic``. The runtime semantics of " "this syntax are discussed in the :ref:`Language Reference `." msgstr "" +"このようなクラスは暗黙的に ``Generic`` を継承します。\n" +"この構文の実行時の意味は :ref:`言語リファレンス ` で説明して" +"います。" #: ../../library/typing.rst:1725 msgid "This class can then be used as follows::" msgstr "このクラスは次のように使用することが出来ます::" -#: ../../library/typing.rst:1727 msgid "" "def lookup_name[X, Y](mapping: Mapping[X, Y], key: X, default: Y) -> Y:\n" " try:\n" @@ -2729,21 +3358,28 @@ msgid "" " except KeyError:\n" " return default" msgstr "" +"def lookup_name[X, Y](mapping: Mapping[X, Y], key: X, default: Y) -> Y:\n" +" try:\n" +" return mapping[key]\n" +" except KeyError:\n" +" return default" -#: ../../library/typing.rst:1733 msgid "" "Here the brackets after the function name indicate a :ref:`generic function " "`." msgstr "" +"ここでは、関数名の後の角括弧が :ref:`ジェネリック関数 ` で" +"あることを示します。" -#: ../../library/typing.rst:1736 msgid "" "For backwards compatibility, generic classes can also be declared by " "explicitly inheriting from ``Generic``. In this case, the type parameters " "must be declared separately::" msgstr "" +"後方互換性のために、``Generic`` を明示的に継承してジェネリッククラスを宣言す" +"ることもできます。\n" +"この場合、型引数は別途宣言する必要があります。 ::" -#: ../../library/typing.rst:1741 msgid "" "KT = TypeVar('KT')\n" "VT = TypeVar('VT')\n" @@ -2753,31 +3389,40 @@ msgid "" " ...\n" " # Etc." msgstr "" +"KT = TypeVar('KT')\n" +"VT = TypeVar('VT')\n" +"\n" +"class Mapping(Generic[KT, VT]):\n" +" def __getitem__(self, key: KT) -> VT:\n" +" ...\n" +" # など。" #: ../../library/typing.rst:1753 msgid "Type variable." msgstr "型変数です。" -#: ../../library/typing.rst:1755 msgid "" "The preferred way to construct a type variable is via the dedicated syntax " "for :ref:`generic functions `, :ref:`generic classes " "`, and :ref:`generic type aliases `::" msgstr "" +"型変数を作成するには、:ref:`ジェネリック関数 `、:ref:`ジェ" +"ネリッククラス `、\n" +":ref:`ジェネリック型エイリアス ` の専用構文を使う方法が" +"推奨されます。 ::" -#: ../../library/typing.rst:1760 msgid "" "class Sequence[T]: # T is a TypeVar\n" " ..." msgstr "" +"class Sequence[T]: # T は TypeVar\n" +" ..." -#: ../../library/typing.rst:1763 msgid "" "This syntax can also be used to create bounded and constrained type " "variables::" -msgstr "" +msgstr "この構文では、上限付きや制約付きの型変数も作成できます。 ::" -#: ../../library/typing.rst:1766 msgid "" "class StrSequence[S: str]: # S is a TypeVar with a `str` upper bound;\n" " ... # we can say that S is \"bounded by `str`\"\n" @@ -2787,29 +3432,42 @@ msgid "" "str or bytes\n" " ..." msgstr "" +"class StrSequence[S: str]: # S は `str` を上限とする TypeVar\n" +" ... # S は「`str` を上限とする」と言える\n" +"\n" +"\n" +"class StrOrBytesSequence[A: (str, bytes)]: # A は str または bytes に制約さ" +"れた TypeVar\n" +" ..." -#: ../../library/typing.rst:1773 msgid "" "However, if desired, reusable type variables can also be constructed " "manually, like so::" msgstr "" +"ただし、必要であれば、再利用可能な型変数を以下のように明示的に作成することも" +"できます。 ::" -#: ../../library/typing.rst:1775 msgid "" "T = TypeVar('T') # Can be anything\n" "S = TypeVar('S', bound=str) # Can be any subtype of str\n" "A = TypeVar('A', str, bytes) # Must be exactly str or bytes" msgstr "" +"T = TypeVar('T') # どの型でもよい\n" +"S = TypeVar('S', bound=str) # str の任意のサブタイプ\n" +"A = TypeVar('A', str, bytes) # str または bytes そのものでなければならない" -#: ../../library/typing.rst:1779 msgid "" "Type variables exist primarily for the benefit of static type checkers. " "They serve as the parameters for generic types as well as for generic " "function and type alias definitions. See :class:`Generic` for more " "information on generic types. Generic functions work as follows::" msgstr "" +"型変数は、主に静的型チェッカーで利用するためのものです。\n" +"ジェネリック型の型引数や、ジェネリック関数や型エイリアスの定義の型引数として" +"使われます。\n" +"ジェネリック型の詳細は :class:`Generic` を参照してください。\n" +"ジェネリック関数は以下のように動作します。 ::" -#: ../../library/typing.rst:1785 msgid "" "def repeat[T](x: T, n: int) -> Sequence[T]:\n" " \"\"\"Return a list containing n references to x.\"\"\"\n" @@ -2826,14 +3484,28 @@ msgid "" " \"\"\"Add two strings or bytes objects together.\"\"\"\n" " return x + y" msgstr "" +"def repeat[T](x: T, n: int) -> Sequence[T]:\n" +" \"\"\"x への参照を n 個含むリストを返す。\"\"\"\n" +" return [x]*n\n" +"\n" +"\n" +"def print_capitalized[S: str](x: S) -> S:\n" +" \"\"\"x の先頭を大文字にして表示し、x を返す。\"\"\"\n" +" print(x.capitalize())\n" +" return x\n" +"\n" +"\n" +"def concatenate[A: (str, bytes)](x: A, y: A) -> A:\n" +" \"\"\"2 つの文字列または bytes オブジェクトを連結する。\"\"\"\n" +" return x + y" -#: ../../library/typing.rst:1800 msgid "" "Note that type variables can be *bounded*, *constrained*, or neither, but " "cannot be both bounded *and* constrained." msgstr "" +"型変数には *上限* を設けるか、*制約* を設けるか、どちらも設けないかを選べます" +"が、上限 *と* 制約の両方を設けることはできません。" -#: ../../library/typing.rst:1803 msgid "" "The variance of type variables is inferred by type checkers when they are " "created through the :ref:`type parameter syntax ` or when " @@ -2842,15 +3514,23 @@ msgid "" "or ``contravariant=True``. By default, manually created type variables are " "invariant. See :pep:`484` and :pep:`695` for more details." msgstr "" +":ref:`型引数構文 ` で作成した型変数や、``infer_variance=True`` " +"を指定した型変数では、型チェッカーが変性を推論します。\n" +"明示的に作成する型変数は、``covariant=True`` または ``contravariant=True`` を" +"渡して共変または反変と指定できます。\n" +"明示的に作成する型変数は、デフォルトでは不変です。\n" +"詳細は :pep:`484` と :pep:`695` を参照してください。" -#: ../../library/typing.rst:1811 msgid "" "Bounded type variables and constrained type variables have different " "semantics in several important ways. Using a *bounded* type variable means " "that the ``TypeVar`` will be solved using the most specific type possible::" msgstr "" +"上限付き型変数と制約付き型変数は、意味の面でいくつかの重要な違いがありま" +"す。\n" +"*上限付き* 型変数を使うと、``TypeVar`` は可能な限り具体的な型に解決されま" +"す。 ::" -#: ../../library/typing.rst:1815 msgid "" "x = print_capitalized('a string')\n" "reveal_type(x) # revealed type is str\n" @@ -2863,14 +3543,24 @@ msgid "" "\n" "z = print_capitalized(45) # error: int is not a subtype of str" msgstr "" +"x = print_capitalized('a string')\n" +"reveal_type(x) # 表示される型は str\n" +"\n" +"class StringSubclass(str):\n" +" pass\n" +"\n" +"y = print_capitalized(StringSubclass('another string'))\n" +"reveal_type(y) # 表示される型は StringSubclass\n" +"\n" +"z = print_capitalized(45) # エラー: int は str のサブタイプではない" -#: ../../library/typing.rst:1826 msgid "" "The upper bound of a type variable can be a concrete type, abstract type " "(ABC or Protocol), or even a union of types::" msgstr "" +"型変数の上限には、具象型、抽象型 (ABC やプロトコル)、さらには型のユニオンも指" +"定できます。 ::" -#: ../../library/typing.rst:1829 msgid "" "# Can be anything with an __abs__ method\n" "def print_abs[T: SupportsAbs](arg: T) -> None:\n" @@ -2880,14 +3570,20 @@ msgid "" "bytes\n" "V = TypeVar('V', bound=SupportsAbs) # Can be anything with an __abs__ method" msgstr "" +"# __abs__ メソッドを持つ型なら何でもよい\n" +"def print_abs[T: SupportsAbs](arg: T) -> None:\n" +" print(\"Absolute value:\", abs(arg))\n" +"\n" +"U = TypeVar('U', bound=str|bytes) # ユニオン str|bytes の任意のサブタイプ\n" +"V = TypeVar('V', bound=SupportsAbs) # __abs__ メソッドを持つ型なら何でもよい" -#: ../../library/typing.rst:1838 msgid "" "Using a *constrained* type variable, however, means that the ``TypeVar`` can " "only ever be solved as being exactly one of the constraints given::" msgstr "" +"一方、*制約付き* 型変数では、``TypeVar`` は指定した制約のいずれかの型そのもの" +"にしか解決されません。 ::" -#: ../../library/typing.rst:1841 msgid "" "a = concatenate('one', 'two')\n" "reveal_type(a) # revealed type is str\n" @@ -2899,40 +3595,43 @@ msgid "" "c = concatenate('one', b'two') # error: type variable 'A' can be either str " "or bytes in a function call, but not both" msgstr "" +"a = concatenate('one', 'two')\n" +"reveal_type(a) # 表示される型は str\n" +"\n" +"b = concatenate(StringSubclass('one'), StringSubclass('two'))\n" +"reveal_type(b) # StringSubclass を渡しても、表示される型は str\n" +"\n" +"c = concatenate('one', b'two') # エラー: 1 回の関数呼び出しで型変数 'A' は " +"str か bytes のいずれかであり、両方にはできない" -#: ../../library/typing.rst:1849 msgid "At runtime, ``isinstance(x, T)`` will raise :exc:`TypeError`." -msgstr "" +msgstr "実行時には ``isinstance(x, T)`` は :exc:`TypeError` を送出します。" -#: ../../library/typing.rst:1853 msgid "The name of the type variable." -msgstr "" +msgstr "型変数の名前です。" -#: ../../library/typing.rst:1857 msgid "Whether the type var has been explicitly marked as covariant." -msgstr "" +msgstr "型変数が明示的に共変と指定されているかどうかです。" -#: ../../library/typing.rst:1861 msgid "Whether the type var has been explicitly marked as contravariant." -msgstr "" +msgstr "型変数が明示的に反変と指定されているかどうかです。" -#: ../../library/typing.rst:1865 msgid "" "Whether the type variable's variance should be inferred by type checkers." -msgstr "" +msgstr "型チェッカーが型変数の変性を推論するかどうかです。" -#: ../../library/typing.rst:1871 msgid "The upper bound of the type variable, if any." -msgstr "" +msgstr "型変数の上限です (設定されている場合)。" -#: ../../library/typing.rst:1875 msgid "" "For type variables created through :ref:`type parameter syntax `, the bound is evaluated only when the attribute is accessed, not " "when the type variable is created (see :ref:`lazy-evaluation`)." msgstr "" +":ref:`型引数構文 ` で作成された型変数では、上限は型変数の作成時" +"には評価されず、属性へのアクセス時に初めて評価されます (:ref:`lazy-" +"evaluation` を参照)。" -#: ../../library/typing.rst:1881 msgid "" "An :term:`evaluate function` corresponding to the :attr:`~TypeVar.__bound__` " "attribute. When called directly, this method supports only the :attr:" @@ -2941,19 +3640,26 @@ msgid "" "passed to :func:`annotationlib.call_evaluate_function` to evaluate the value " "in a different format." msgstr "" +":attr:`~TypeVar.__bound__` 属性に対応する :term:`評価関数 ` です。\n" +"このメソッドを直接呼び出す場合は :attr:`~annotationlib.Format.VALUE` 形式だけ" +"に対応しており、:attr:`~TypeVar.__bound__` 属性に直接アクセスするのと同じで" +"す。\n" +"ただし、メソッドオブジェクトを :func:`annotationlib.call_evaluate_function` " +"に渡すと、別の形式で値を評価できます。" -#: ../../library/typing.rst:1891 msgid "A tuple containing the constraints of the type variable, if any." -msgstr "" +msgstr "型変数の制約があれば、それらを格納したタプルです。" -#: ../../library/typing.rst:1895 msgid "" "For type variables created through :ref:`type parameter syntax `, the constraints are evaluated only when the attribute is accessed, " "not when the type variable is created (see :ref:`lazy-evaluation`)." msgstr "" +":ref:`型引数構文 ` で作成された型変数では、制約は型変数の作成時" +"には評価されず、属性へのアクセス時に初めて評価されます (:ref:`lazy-" +"evaluation` を参照)。" -#: ../../library/typing.rst:1901 msgid "" "An :term:`evaluate function` corresponding to the :attr:`~TypeVar." "__constraints__` attribute. When called directly, this method supports only " @@ -2962,14 +3668,21 @@ msgid "" "method object can be passed to :func:`annotationlib.call_evaluate_function` " "to evaluate the value in a different format." msgstr "" +":attr:`~TypeVar.__constraints__` 属性に対応する :term:`評価関数 ` です。\n" +"このメソッドを直接呼び出す場合は :attr:`~annotationlib.Format.VALUE` 形式だけ" +"に対応しており、:attr:`~TypeVar.__constraints__` 属性に直接アクセスするのと同" +"じです。\n" +"ただし、メソッドオブジェクトを :func:`annotationlib.call_evaluate_function` " +"に渡すと、別の形式で値を評価できます。" -#: ../../library/typing.rst:1911 msgid "" "The default value of the type variable, or :data:`typing.NoDefault` if it " "has no default." msgstr "" +"型変数のデフォルト値です。\n" +"デフォルト値がなければ :data:`typing.NoDefault` です。" -#: ../../library/typing.rst:1918 msgid "" "An :term:`evaluate function` corresponding to the :attr:`~TypeVar." "__default__` attribute. When called directly, this method supports only the :" @@ -2978,51 +3691,63 @@ msgid "" "can be passed to :func:`annotationlib.call_evaluate_function` to evaluate " "the value in a different format." msgstr "" +":attr:`~TypeVar.__default__` 属性に対応する :term:`評価関数 ` です。\n" +"このメソッドを直接呼び出す場合は :attr:`~annotationlib.Format.VALUE` 形式だけ" +"に対応しており、:attr:`~TypeVar.__default__` 属性に直接アクセスするのと同じで" +"す。\n" +"ただし、メソッドオブジェクトを :func:`annotationlib.call_evaluate_function` " +"に渡すと、別の形式で値を評価できます。" -#: ../../library/typing.rst:1928 msgid "" "Return whether or not the type variable has a default value. This is " "equivalent to checking whether :attr:`__default__` is not the :data:`typing." "NoDefault` singleton, except that it does not force evaluation of the :ref:" "`lazily evaluated ` default value." msgstr "" +"型変数にデフォルト値があるかどうかを返します。\n" +":attr:`__default__` が :data:`typing.NoDefault` シングルトンでないことを調べ" +"るのと同じですが、:ref:`遅延評価 ` されるデフォルト値を強制" +"的に評価しません。" -#: ../../library/typing.rst:1937 msgid "" "Type variables can now be declared using the :ref:`type parameter ` syntax introduced by :pep:`695`. The ``infer_variance`` parameter " "was added." msgstr "" +":pep:`695` で導入された :ref:`型引数 ` 構文で型変数を宣言できる" +"ようになりました。\n" +"``infer_variance`` パラメータが追加されました。" -#: ../../library/typing.rst:1943 ../../library/typing.rst:2092 -#: ../../library/typing.rst:2204 msgid "Support for default values was added." -msgstr "" +msgstr "デフォルト値に対応しました。" -#: ../../library/typing.rst:1949 msgid "" "Type variable tuple. A specialized form of :ref:`type variable ` " "that enables *variadic* generics." msgstr "" +"型変数タプルです。\n" +"*可変長* ジェネリックを可能にする特殊な :ref:`型変数 ` です。" -#: ../../library/typing.rst:1952 msgid "" "Type variable tuples can be declared in :ref:`type parameter lists ` using a single asterisk (``*``) before the name::" msgstr "" +":ref:`型引数リスト ` 内で、名前の前にアスタリスクを 1 つ " +"(``*``) 付けて型変数タプルを宣言できます。 ::" -#: ../../library/typing.rst:1955 msgid "" "def move_first_element_to_last[T, *Ts](tup: tuple[T, *Ts]) -> tuple[*Ts, " "T]:\n" " return (*tup[1:], tup[0])" msgstr "" +"def move_first_element_to_last[T, *Ts](tup: tuple[T, *Ts]) -> tuple[*Ts, " +"T]:\n" +" return (*tup[1:], tup[0])" -#: ../../library/typing.rst:1958 msgid "Or by explicitly invoking the ``TypeVarTuple`` constructor::" -msgstr "" +msgstr "``TypeVarTuple`` コンストラクタを明示的に呼び出すこともできます。 ::" -#: ../../library/typing.rst:1960 msgid "" "T = TypeVar(\"T\")\n" "Ts = TypeVarTuple(\"Ts\")\n" @@ -3030,16 +3755,23 @@ msgid "" "def move_first_element_to_last(tup: tuple[T, *Ts]) -> tuple[*Ts, T]:\n" " return (*tup[1:], tup[0])" msgstr "" +"T = TypeVar(\"T\")\n" +"Ts = TypeVarTuple(\"Ts\")\n" +"\n" +"def move_first_element_to_last(tup: tuple[T, *Ts]) -> tuple[*Ts, T]:\n" +" return (*tup[1:], tup[0])" -#: ../../library/typing.rst:1966 msgid "" "A normal type variable enables parameterization with a single type. A type " "variable tuple, in contrast, allows parameterization with an *arbitrary* " "number of types by acting like an *arbitrary* number of type variables " "wrapped in a tuple. For example::" msgstr "" +"通常の型変数は 1 つの型でパラメータ化します。\n" +"これに対して型変数タプルは、*任意の数* の型変数をタプルにまとめたように振る舞" +"い、*任意の数* の型でパラメータ化できます。\n" +"例えば次のようになります。 ::" -#: ../../library/typing.rst:1971 msgid "" "# T is bound to int, Ts is bound to ()\n" "# Return value is (1,), which has type tuple[int]\n" @@ -3058,8 +3790,23 @@ msgid "" "# (at least one element is required)\n" "move_first_element_to_last(tup=())" msgstr "" +"# T は int に、Ts は () に束縛される\n" +"# 戻り値は (1,) で、型は tuple[int]\n" +"move_first_element_to_last(tup=(1,))\n" +"\n" +"# T は int に、Ts は (str,) に束縛される\n" +"# 戻り値は ('spam', 1) で、型は tuple[str, int]\n" +"move_first_element_to_last(tup=(1, 'spam'))\n" +"\n" +"# T は int に、Ts は (str, float) に束縛される\n" +"# 戻り値は ('spam', 3.0, 1) で、型は tuple[str, float, int]\n" +"move_first_element_to_last(tup=(1, 'spam', 3.0))\n" +"\n" +"# tuple[()] は tuple[T, *Ts] と互換性がないため、\n" +"# 型チェックにも実行時にも失敗する\n" +"# (少なくとも 1 つの要素が必要)\n" +"move_first_element_to_last(tup=())" -#: ../../library/typing.rst:1988 msgid "" "Note the use of the unpacking operator ``*`` in ``tuple[T, *Ts]``. " "Conceptually, you can think of ``Ts`` as a tuple of type variables ``(T1, " @@ -3068,40 +3815,51 @@ msgid "" "older versions of Python, you might see this written using :data:`Unpack " "` instead, as ``Unpack[Ts]``.)" msgstr "" +"``tuple[T, *Ts]`` で展開演算子 ``*`` を使っている点に注意してください。\n" +"概念的には、``Ts`` は型変数のタプル ``(T1, T2, ...)`` と考えられます。\n" +"すると ``tuple[T, *Ts]`` は ``tuple[T, *(T1, T2, ...)]`` となり、``tuple[T, " +"T1, T2, ...]`` と同じ意味です。\n" +"古いバージョンの Python では、代わりに :data:`Unpack ` を使って " +"``Unpack[Ts]`` と書かれている場合もあります。" -#: ../../library/typing.rst:1996 msgid "" "Type variable tuples must *always* be unpacked. This helps distinguish type " "variable tuples from normal type variables::" msgstr "" +"型変数タプルは *必ず* 展開しなければなりません。\n" +"これにより、型変数タプルを通常の型変数と区別しやすくなります。 ::" -#: ../../library/typing.rst:1999 msgid "" "x: Ts # Not valid\n" "x: tuple[Ts] # Not valid\n" "x: tuple[*Ts] # The correct way to do it" msgstr "" +"x: Ts # 無効\n" +"x: tuple[Ts] # 無効\n" +"x: tuple[*Ts] # 正しい書き方" -#: ../../library/typing.rst:2003 msgid "" "Type variable tuples can be used in the same contexts as normal type " "variables. For example, in class definitions, arguments, and return types::" msgstr "" +"型変数タプルは、通常の型変数と同じ文脈で使えます。\n" +"例えばクラス定義、引数、戻り値の型などです。 ::" -#: ../../library/typing.rst:2006 msgid "" "class Array[*Shape]:\n" " def __getitem__(self, key: tuple[*Shape]) -> float: ...\n" " def __abs__(self) -> \"Array[*Shape]\": ...\n" " def get_shape(self) -> tuple[*Shape]: ..." msgstr "" +"class Array[*Shape]:\n" +" def __getitem__(self, key: tuple[*Shape]) -> float: ...\n" +" def __abs__(self) -> \"Array[*Shape]\": ...\n" +" def get_shape(self) -> tuple[*Shape]: ..." -#: ../../library/typing.rst:2011 msgid "" "Type variable tuples can be happily combined with normal type variables:" -msgstr "" +msgstr "型変数タプルは通常の型変数と組み合わせて使えます:" -#: ../../library/typing.rst:2013 msgid "" "class Array[DType, *Shape]: # This is fine\n" " pass\n" @@ -3115,27 +3873,41 @@ msgid "" "float_array_1d: Array[float, Height] = Array() # Totally fine\n" "int_array_2d: Array[int, Height, Width] = Array() # Yup, fine too" msgstr "" +"class Array[DType, *Shape]: # これは問題ない\n" +" pass\n" +"\n" +"class Array2[*Shape, DType]: # これも問題ない\n" +" pass\n" +"\n" +"class Height: ...\n" +"class Width: ...\n" +"\n" +"float_array_1d: Array[float, Height] = Array() # 問題ない\n" +"int_array_2d: Array[int, Height, Width] = Array() # これも問題ない" -#: ../../library/typing.rst:2027 msgid "" "However, note that at most one type variable tuple may appear in a single " "list of type arguments or type parameters::" msgstr "" +"ただし、型引数を指定または宣言する 1 つのリスト内には、型変数タプルを最大 1 " +"つしか含められません。 ::" -#: ../../library/typing.rst:2030 msgid "" "x: tuple[*Ts, *Ts] # Not valid\n" "class Array[*Shape, *Shape]: # Not valid\n" " pass" msgstr "" +"x: tuple[*Ts, *Ts] # 無効\n" +"class Array[*Shape, *Shape]: # 無効\n" +" pass" -#: ../../library/typing.rst:2034 msgid "" "Finally, an unpacked type variable tuple can be used as the type annotation " "of ``*args``::" msgstr "" +"最後に、展開された型変数タプルは ``*args`` の型アノテーションとして使えま" +"す。 ::" -#: ../../library/typing.rst:2037 msgid "" "def call_soon[*Ts](\n" " callback: Callable[[*Ts], None],\n" @@ -3144,8 +3916,13 @@ msgid "" " ...\n" " callback(*args)" msgstr "" +"def call_soon[*Ts](\n" +" callback: Callable[[*Ts], None],\n" +" *args: *Ts\n" +") -> None:\n" +" ...\n" +" callback(*args)" -#: ../../library/typing.rst:2044 msgid "" "In contrast to non-unpacked annotations of ``*args`` - e.g. ``*args: int``, " "which would specify that *all* arguments are ``int`` - ``*args: *Ts`` " @@ -3153,22 +3930,25 @@ msgid "" "Here, this allows us to ensure the types of the ``*args`` passed to " "``call_soon`` match the types of the (positional) arguments of ``callback``." msgstr "" +"展開しない ``*args`` のアノテーション (例えば ``*args: int`` は *すべての* 引" +"数を ``int`` と指定します) とは異なり、\n" +"``*args: *Ts`` では ``*args`` の *個々の* 引数の型を参照できます。\n" +"この例では、``call_soon`` に渡される ``*args`` の型と ``callback`` の (位置) " +"引数の型の一致を保証できます。" -#: ../../library/typing.rst:2051 msgid "See :pep:`646` for more details on type variable tuples." -msgstr "" +msgstr "型変数タプルの詳細は :pep:`646` を参照してください。" -#: ../../library/typing.rst:2055 msgid "The name of the type variable tuple." -msgstr "" +msgstr "型変数タプルの名前です。" -#: ../../library/typing.rst:2059 msgid "" "The default value of the type variable tuple, or :data:`typing.NoDefault` if " "it has no default." msgstr "" +"型変数タプルのデフォルト値です。\n" +"デフォルト値がなければ :data:`typing.NoDefault` です。" -#: ../../library/typing.rst:2066 msgid "" "An :term:`evaluate function` corresponding to the :attr:`~TypeVarTuple." "__default__` attribute. When called directly, this method supports only the :" @@ -3177,48 +3957,59 @@ msgid "" "object can be passed to :func:`annotationlib.call_evaluate_function` to " "evaluate the value in a different format." msgstr "" +":attr:`~TypeVarTuple.__default__` 属性に対応する :term:`評価関数 ` です。\n" +"このメソッドを直接呼び出す場合は :attr:`~annotationlib.Format.VALUE` 形式だけ" +"に対応しており、:attr:`~TypeVarTuple.__default__` 属性に直接アクセスするのと" +"同じです。\n" +"ただし、メソッドオブジェクトを :func:`annotationlib.call_evaluate_function` " +"に渡すと、別の形式で値を評価できます。" -#: ../../library/typing.rst:2076 msgid "" "Return whether or not the type variable tuple has a default value. This is " "equivalent to checking whether :attr:`__default__` is not the :data:`typing." "NoDefault` singleton, except that it does not force evaluation of the :ref:" "`lazily evaluated ` default value." msgstr "" +"型変数タプルにデフォルト値があるかどうかを返します。\n" +":attr:`__default__` が :data:`typing.NoDefault` シングルトンでないことを調べ" +"るのと同じですが、:ref:`遅延評価 ` されるデフォルト値を強制" +"的に評価しません。" -#: ../../library/typing.rst:2087 msgid "" "Type variable tuples can now be declared using the :ref:`type parameter " "` syntax introduced by :pep:`695`." msgstr "" +":pep:`695` で導入された :ref:`型引数 ` 構文で型変数タプルを宣言" +"できるようになりました。" -#: ../../library/typing.rst:2096 msgid "" "Parameter specification variable. A specialized version of :ref:`type " "variables `." msgstr "" +"パラメータ仕様変数です。\n" +"特殊な :ref:`型変数 ` です。" -#: ../../library/typing.rst:2099 msgid "" "In :ref:`type parameter lists `, parameter specifications can " "be declared with two asterisks (``**``)::" msgstr "" +":ref:`型引数リスト ` 内で、アスタリスクを 2 つ (``**``) 付けてパ" +"ラメータ仕様を宣言できます。 ::" -#: ../../library/typing.rst:2102 msgid "type IntFunc[**P] = Callable[P, int]" -msgstr "" +msgstr "type IntFunc[**P] = Callable[P, int]" -#: ../../library/typing.rst:2104 msgid "" "For compatibility with Python 3.11 and earlier, ``ParamSpec`` objects can " "also be created as follows::" msgstr "" +"Python 3.11 以前との互換性のために、``ParamSpec`` オブジェクトは以下のように" +"作成することもできます。 ::" -#: ../../library/typing.rst:2107 msgid "P = ParamSpec('P')" -msgstr "" +msgstr "P = ParamSpec('P')" -#: ../../library/typing.rst:2109 msgid "" "Parameter specification variables exist primarily for the benefit of static " "type checkers. They are used to forward the parameter types of one callable " @@ -3227,16 +4018,26 @@ msgid "" "first argument to ``Callable``, or as parameters for user-defined Generics. " "See :class:`Generic` for more information on generic types." msgstr "" +"パラメータ仕様変数は、主に静的型チェッカーで利用するためのものです。\n" +"ある呼び出し可能オブジェクトのパラメータの型を、別の呼び出し可能オブジェクト" +"へ引き継ぐために使います。\n" +"これは高階関数やデコレータによく見られるパターンです。\n" +"パラメータ仕様変数を使えるのは、``Concatenate`` の中、``Callable`` の最初の引" +"数、またはユーザー定義のジェネリックの型引数だけです。\n" +"ジェネリック型の詳細は :class:`Generic` を参照してください。" -#: ../../library/typing.rst:2116 msgid "" "For example, to add basic logging to a function, one can create a decorator " "``add_logging`` to log function calls. The parameter specification variable " "tells the type checker that the callable passed into the decorator and the " "new callable returned by it have inter-dependent type parameters::" msgstr "" +"例えば、関数に基本的なログ出力を追加するには、関数の呼び出しを記録するデコ" +"レータ ``add_logging`` を作れます。\n" +"パラメータ仕様変数は、デコレータに渡した呼び出し可能オブジェクトと、それが返" +"す新しい呼び出し可能オブジェクトの型引数が互いに依存していることを型チェッ" +"カーに伝えます。 ::" -#: ../../library/typing.rst:2121 msgid "" "from collections.abc import Callable\n" "import logging\n" @@ -3253,26 +4054,46 @@ msgid "" " '''Add two numbers together.'''\n" " return x + y" msgstr "" +"from collections.abc import Callable\n" +"import logging\n" +"\n" +"def add_logging[T, **P](f: Callable[P, T]) -> Callable[P, T]:\n" +" '''関数にログ出力を追加する型安全なデコレータ。'''\n" +" def inner(*args: P.args, **kwargs: P.kwargs) -> T:\n" +" logging.info(f'{f.__name__} was called')\n" +" return f(*args, **kwargs)\n" +" return inner\n" +"\n" +"@add_logging\n" +"def add_two(x: float, y: float) -> float:\n" +" '''2 つの数値を足し合わせる。'''\n" +" return x + y" -#: ../../library/typing.rst:2136 msgid "" "Without ``ParamSpec``, the simplest way to annotate this previously was to " "use a :class:`TypeVar` with upper bound ``Callable[..., Any]``. However " "this causes two problems:" msgstr "" +"``ParamSpec`` がなかった頃、このような関数にアノテーションを付ける最も簡単な" +"方法は、上限を ``Callable[..., Any]`` とした :class:`TypeVar` を使うことでし" +"た。\n" +"ただし、この方法には 2 つの問題があります:" -#: ../../library/typing.rst:2140 msgid "" "The type checker can't type check the ``inner`` function because ``*args`` " "and ``**kwargs`` have to be typed :data:`Any`." msgstr "" +"``*args`` と ``**kwargs`` の型を :data:`Any` としなければならないため、型" +"チェッカーは ``inner`` 関数の型チェックを行えません。" -#: ../../library/typing.rst:2142 msgid "" ":func:`~cast` may be required in the body of the ``add_logging`` decorator " "when returning the ``inner`` function, or the static type checker must be " "told to ignore the ``return inner``." msgstr "" +"``add_logging`` デコレータの本体で ``inner`` 関数を返すときに :func:`~cast` " +"が必要になるか、静的型チェッカーに ``return inner`` を無視するように指示しな" +"ければなりません。" #: ../../library/typing.rst:2149 msgid "" @@ -3287,17 +4108,16 @@ msgid "" "`ParamSpecKwargs`." msgstr "" -#: ../../library/typing.rst:2161 msgid "The name of the parameter specification." -msgstr "" +msgstr "パラメータ仕様の名前です。" -#: ../../library/typing.rst:2165 msgid "" "The default value of the parameter specification, or :data:`typing." "NoDefault` if it has no default." msgstr "" +"パラメータ仕様のデフォルト値です。\n" +"デフォルト値がなければ :data:`typing.NoDefault` です。" -#: ../../library/typing.rst:2172 msgid "" "An :term:`evaluate function` corresponding to the :attr:`~ParamSpec." "__default__` attribute. When called directly, this method supports only the :" @@ -3306,16 +4126,25 @@ msgid "" "can be passed to :func:`annotationlib.call_evaluate_function` to evaluate " "the value in a different format." msgstr "" +":attr:`~ParamSpec.__default__` 属性に対応する :term:`評価関数 ` です。\n" +"このメソッドを直接呼び出す場合は :attr:`~annotationlib.Format.VALUE` 形式だけ" +"に対応しており、:attr:`~ParamSpec.__default__` 属性に直接アクセスするのと同じ" +"です。\n" +"ただし、メソッドオブジェクトを :func:`annotationlib.call_evaluate_function` " +"に渡すと、別の形式で値を評価できます。" -#: ../../library/typing.rst:2182 msgid "" "Return whether or not the parameter specification has a default value. This " "is equivalent to checking whether :attr:`__default__` is not the :data:" "`typing.NoDefault` singleton, except that it does not force evaluation of " "the :ref:`lazily evaluated ` default value." msgstr "" +"パラメータ仕様にデフォルト値があるかどうかを返します。\n" +":attr:`__default__` が :data:`typing.NoDefault` シングルトンでないことを調べ" +"るのと同じですが、:ref:`遅延評価 ` されるデフォルト値を強制" +"的に評価しません。" -#: ../../library/typing.rst:2189 msgid "" "Parameter specification variables created with ``covariant=True`` or " "``contravariant=True`` can be used to declare covariant or contravariant " @@ -3323,38 +4152,47 @@ msgid "" "`TypeVar`. However the actual semantics of these keywords are yet to be " "decided." msgstr "" +"``covariant=True`` または ``contravariant=True`` を指定して作成したパラメータ" +"仕様変数は、共変または反変のジェネリック型を宣言するために使えます。\n" +":class:`TypeVar` と同様に ``bound`` 引数も受け取れます。\n" +"ただし、これらのキーワードの実際の意味はまだ決まっていません。" -#: ../../library/typing.rst:2199 msgid "" "Parameter specifications can now be declared using the :ref:`type parameter " "` syntax introduced by :pep:`695`." msgstr "" +":pep:`695` で導入された :ref:`型引数 ` 構文でパラメータ仕様を宣" +"言できるようになりました。" -#: ../../library/typing.rst:2207 msgid "" "Only parameter specification variables defined in global scope can be " "pickled." msgstr "" +"pickle 化できるのは、グローバルスコープで定義されたパラメータ仕様変数だけで" +"す。" -#: ../../library/typing.rst:2213 msgid ":data:`Concatenate`" -msgstr "" +msgstr ":data:`Concatenate`" -#: ../../library/typing.rst:2219 msgid "" "Arguments and keyword arguments attributes of a :class:`ParamSpec`. The ``P." "args`` attribute of a ``ParamSpec`` is an instance of ``ParamSpecArgs``, and " "``P.kwargs`` is an instance of ``ParamSpecKwargs``. They are intended for " "runtime introspection and have no special meaning to static type checkers." msgstr "" +":class:`ParamSpec` の位置引数とキーワード引数を表す属性です。\n" +"``ParamSpec`` の ``P.args`` 属性は ``ParamSpecArgs`` のインスタンス、``P." +"kwargs`` は ``ParamSpecKwargs`` のインスタンスです。\n" +"これらは実行時のイントロスペクション用であり、静的型チェッカーにとって特別な" +"意味はありません。" -#: ../../library/typing.rst:2224 msgid "" "Calling :func:`get_origin` on either of these objects will return the " "original ``ParamSpec``:" msgstr "" +"どちらのオブジェクトでも、:func:`get_origin` を呼び出すと元の ``ParamSpec`` " +"が返されます:" -#: ../../library/typing.rst:2227 msgid "" ">>> from typing import ParamSpec, get_origin\n" ">>> P = ParamSpec(\"P\")\n" @@ -3363,47 +4201,57 @@ msgid "" ">>> get_origin(P.kwargs) is P\n" "True" msgstr "" +">>> from typing import ParamSpec, get_origin\n" +">>> P = ParamSpec(\"P\")\n" +">>> get_origin(P.args) is P\n" +"True\n" +">>> get_origin(P.kwargs) is P\n" +"True" -#: ../../library/typing.rst:2241 msgid "The type of type aliases created through the :keyword:`type` statement." -msgstr "" +msgstr ":keyword:`type` 文で作成される型エイリアスの型です。" -#: ../../library/typing.rst:2245 msgid "" ">>> type Alias = int\n" ">>> type(Alias)\n" "" msgstr "" +">>> type Alias = int\n" +">>> type(Alias)\n" +"" -#: ../../library/typing.rst:2255 msgid "The name of the type alias:" -msgstr "" +msgstr "型エイリアスの名前です:" -#: ../../library/typing.rst:2257 msgid "" ">>> type Alias = int\n" ">>> Alias.__name__\n" "'Alias'" msgstr "" +">>> type Alias = int\n" +">>> Alias.__name__\n" +"'Alias'" #: ../../library/typing.rst:2265 msgid "The module in which the type alias was defined::" msgstr "" -#: ../../library/typing.rst:2267 msgid "" ">>> type Alias = int\n" ">>> Alias.__module__\n" "'__main__'" msgstr "" +">>> type Alias = int\n" +">>> Alias.__module__\n" +"'__main__'" -#: ../../library/typing.rst:2273 msgid "" "The type parameters of the type alias, or an empty tuple if the alias is not " "generic:" msgstr "" +"型エイリアスの型引数です。\n" +"ジェネリックでないエイリアスの場合は空のタプルです:" -#: ../../library/typing.rst:2276 msgid "" ">>> type ListOrSet[T] = list[T] | set[T]\n" ">>> ListOrSet.__type_params__\n" @@ -3412,15 +4260,22 @@ msgid "" ">>> NotGeneric.__type_params__\n" "()" msgstr "" +">>> type ListOrSet[T] = list[T] | set[T]\n" +">>> ListOrSet.__type_params__\n" +"(T,)\n" +">>> type NotGeneric = int\n" +">>> NotGeneric.__type_params__\n" +"()" -#: ../../library/typing.rst:2287 msgid "" "The type alias's value. This is :ref:`lazily evaluated `, " "so names used in the definition of the alias are not resolved until the " "``__value__`` attribute is accessed:" msgstr "" +"型エイリアスの値です。\n" +":ref:`遅延評価 ` されるため、エイリアスの定義で使われる名前" +"は ``__value__`` 属性にアクセスするまで解決されません:" -#: ../../library/typing.rst:2291 msgid "" ">>> type Mutually = Recursive\n" ">>> type Recursive = Mutually\n" @@ -3433,8 +4288,17 @@ msgid "" ">>> Recursive.__value__\n" "Mutually" msgstr "" +">>> type Mutually = Recursive\n" +">>> type Recursive = Mutually\n" +">>> Mutually\n" +"Mutually\n" +">>> Recursive\n" +"Recursive\n" +">>> Mutually.__value__\n" +"Recursive\n" +">>> Recursive.__value__\n" +"Mutually" -#: ../../library/typing.rst:2306 msgid "" "An :term:`evaluate function` corresponding to the :attr:`__value__` " "attribute. When called directly, this method supports only the :attr:" @@ -3443,8 +4307,13 @@ msgid "" "func:`annotationlib.call_evaluate_function` to evaluate the value in a " "different format:" msgstr "" +":attr:`__value__` 属性に対応する :term:`評価関数 ` で" +"す。\n" +"このメソッドを直接呼び出す場合は :attr:`~annotationlib.Format.VALUE` 形式だけ" +"に対応しており、:attr:`__value__` 属性に直接アクセスするのと同じです。\n" +"ただし、メソッドオブジェクトを :func:`annotationlib.call_evaluate_function` " +"に渡すと、別の形式で値を評価できます:" -#: ../../library/typing.rst:2312 msgid "" ">>> type Alias = undefined\n" ">>> Alias.__value__\n" @@ -3459,35 +4328,51 @@ msgid "" ">>> call_evaluate_function(Alias.evaluate_value, Format.FORWARDREF)\n" "ForwardRef('undefined')" msgstr "" +">>> type Alias = undefined\n" +">>> Alias.__value__\n" +"Traceback (most recent call last):\n" +"...\n" +"NameError: name 'undefined' is not defined\n" +">>> from annotationlib import Format, call_evaluate_function\n" +">>> Alias.evaluate_value(Format.VALUE)\n" +"Traceback (most recent call last):\n" +"...\n" +"NameError: name 'undefined' is not defined\n" +">>> call_evaluate_function(Alias.evaluate_value, Format.FORWARDREF)\n" +"ForwardRef('undefined')" #: ../../library/typing.rst:2330 msgid "Unpacking" msgstr "展開" -#: ../../library/typing.rst:2331 msgid "" "Type aliases support star unpacking using the ``*Alias`` syntax. This is " "equivalent to using ``Unpack[Alias]`` directly:" msgstr "" +"型エイリアスは ``*Alias`` 構文によるアスタリスクでの展開に対応しています。\n" +"これは ``Unpack[Alias]`` を直接使うのと同じです:" -#: ../../library/typing.rst:2334 msgid "" ">>> type Alias = tuple[int, str]\n" ">>> type Unpacked = tuple[bool, *Alias]\n" ">>> Unpacked.__value__\n" "tuple[bool, typing.Unpack[Alias]]" msgstr "" +">>> type Alias = tuple[int, str]\n" +">>> type Unpacked = tuple[bool, *Alias]\n" +">>> Unpacked.__value__\n" +"tuple[bool, typing.Unpack[Alias]]" -#: ../../library/typing.rst:2345 msgid "Other special directives" -msgstr "" +msgstr "その他の特殊な指示" -#: ../../library/typing.rst:2347 msgid "" "These functions and classes should not be used directly as annotations. " "Their intended purpose is to be building blocks for creating and declaring " "types." msgstr "" +"これらの関数やクラスをアノテーションとして直接使うべきではありません。\n" +"型を作成したり宣言したりするための構成要素として使うものです。" #: ../../library/typing.rst:2353 msgid "Typed version of :func:`collections.namedtuple`." @@ -3498,27 +4383,27 @@ msgstr ":func:`collections.namedtuple` の型付き版です。" msgid "Usage::" msgstr "使い方::" -#: ../../library/typing.rst:2357 msgid "" "class Employee(NamedTuple):\n" " name: str\n" " id: int" msgstr "" +"class Employee(NamedTuple):\n" +" name: str\n" +" id: int" #: ../../library/typing.rst:2361 msgid "This is equivalent to::" msgstr "これは次と等価です::" -#: ../../library/typing.rst:2363 msgid "Employee = collections.namedtuple('Employee', ['name', 'id'])" -msgstr "" +msgstr "Employee = collections.namedtuple('Employee', ['name', 'id'])" #: ../../library/typing.rst:2365 msgid "" "To give a field a default value, you can assign to it in the class body::" msgstr "フィールドにデフォルト値を与えるにはクラス本体で代入してください::" -#: ../../library/typing.rst:2367 msgid "" "class Employee(NamedTuple):\n" " name: str\n" @@ -3527,6 +4412,12 @@ msgid "" "employee = Employee('Guido')\n" "assert employee.id == 3" msgstr "" +"class Employee(NamedTuple):\n" +" name: str\n" +" id: int = 3\n" +"\n" +"employee = Employee('Guido')\n" +"assert employee.id == 3" #: ../../library/typing.rst:2374 msgid "" @@ -3552,7 +4443,6 @@ msgstr "" msgid "``NamedTuple`` subclasses can also have docstrings and methods::" msgstr "``NamedTuple`` のサブクラスは docstring やメソッドも持てます::" -#: ../../library/typing.rst:2384 msgid "" "class Employee(NamedTuple):\n" " \"\"\"Represents an employee.\"\"\"\n" @@ -3562,23 +4452,30 @@ msgid "" " def __repr__(self) -> str:\n" " return f''" msgstr "" +"class Employee(NamedTuple):\n" +" \"\"\"従業員を表す。\"\"\"\n" +" name: str\n" +" id: int = 3\n" +"\n" +" def __repr__(self) -> str:\n" +" return f''" -#: ../../library/typing.rst:2392 msgid "``NamedTuple`` subclasses can be generic::" -msgstr "" +msgstr "``NamedTuple`` のサブクラスはジェネリックにもできます。 ::" -#: ../../library/typing.rst:2394 msgid "" "class Group[T](NamedTuple):\n" " key: T\n" " group: list[T]" msgstr "" +"class Group[T](NamedTuple):\n" +" key: T\n" +" group: list[T]" #: ../../library/typing.rst:2398 msgid "Backward-compatible usage::" msgstr "後方互換な使用法::" -#: ../../library/typing.rst:2400 msgid "" "# For creating a generic NamedTuple on Python 3.11\n" "T = TypeVar(\"T\")\n" @@ -3590,6 +4487,15 @@ msgid "" "# A functional syntax is also supported\n" "Employee = NamedTuple('Employee', [('name', str), ('id', int)])" msgstr "" +"# Python 3.11 でジェネリックな NamedTuple を作成する方法\n" +"T = TypeVar(\"T\")\n" +"\n" +"class Group(NamedTuple, Generic[T]):\n" +" key: T\n" +" group: list[T]\n" +"\n" +"# 関数呼び出し形式にも対応している\n" +"Employee = NamedTuple('Employee', [('name', str), ('id', int)])" #: ../../library/typing.rst:2410 msgid "Added support for :pep:`526` variable annotation syntax." @@ -3616,16 +4522,17 @@ msgstr "" "``_field_types`` 属性は削除されました。代わりに同じ情報を持つより標準的な " "``__annotations__`` 属性を使ってください。" -#: ../../library/typing.rst:2424 msgid "Added support for generic namedtuples." -msgstr "" +msgstr "ジェネリックな名前付きタプルに対応しました。" -#: ../../library/typing.rst:2427 msgid "" "Using :func:`super` (and the ``__class__`` :term:`closure variable`) in " "methods of ``NamedTuple`` subclasses is unsupported and causes a :class:" "`TypeError`." msgstr "" +"``NamedTuple`` サブクラスのメソッド内での :func:`super` (および " +"``__class__`` :term:`クロージャ変数 `) の使用には対応してお" +"らず、:class:`TypeError` が発生します。" #: ../../library/typing.rst:2431 msgid "" @@ -3644,9 +4551,10 @@ msgid "" "NT(NamedTuple): pass`` or ``NT = NamedTuple(\"NT\", [])``." msgstr "" -#: ../../library/typing.rst:2446 msgid "Helper class to create low-overhead :ref:`distinct types `." msgstr "" +"オーバーヘッドの小さい :ref:`別個の型 ` を作成するためのヘルパーク" +"ラスです。" #: ../../library/typing.rst:2448 msgid "" @@ -3654,43 +4562,41 @@ msgid "" "however, calling a ``NewType`` returns its argument unchanged." msgstr "" -#: ../../library/typing.rst:2453 msgid "" "UserId = NewType('UserId', int) # Declare the NewType \"UserId\"\n" "first_user = UserId(1) # \"UserId\" returns the argument unchanged at " "runtime" msgstr "" +"UserId = NewType('UserId', int) # NewType の \"UserId\" を宣言する\n" +"first_user = UserId(1) # 実行時には \"UserId\" は引数をそのまま返す" #: ../../library/typing.rst:2458 msgid "The module in which the new type is defined." msgstr "" -#: ../../library/typing.rst:2462 msgid "The name of the new type." -msgstr "" +msgstr "新しい型の名前です。" -#: ../../library/typing.rst:2466 msgid "The type that the new type is based on." -msgstr "" +msgstr "新しい型の基になる型です。" -#: ../../library/typing.rst:2470 msgid "``NewType`` is now a class rather than a function." -msgstr "" +msgstr "``NewType`` は関数ではなくクラスになりました。" -#: ../../library/typing.rst:2475 msgid "Base class for protocol classes." -msgstr "" +msgstr "プロトコルクラスの基底クラスです。" -#: ../../library/typing.rst:2477 msgid "Protocol classes are defined like this::" -msgstr "" +msgstr "プロトコルクラスは以下のように定義します。 ::" -#: ../../library/typing.rst:2479 msgid "" "class Proto(Protocol):\n" " def meth(self) -> int:\n" " ..." msgstr "" +"class Proto(Protocol):\n" +" def meth(self) -> int:\n" +" ..." #: ../../library/typing.rst:2483 msgid "" @@ -3700,7 +4606,6 @@ msgstr "" "このようなクラスは主に構造的部分型 (静的ダックタイピング) を認識する静的型" "チェッカーが使います。例えば::" -#: ../../library/typing.rst:2486 msgid "" "class C:\n" " def meth(self) -> int:\n" @@ -3711,6 +4616,14 @@ msgid "" "\n" "func(C()) # Passes static type check" msgstr "" +"class C:\n" +" def meth(self) -> int:\n" +" return 0\n" +"\n" +"def func(x: Proto) -> int:\n" +" return x.meth()\n" +"\n" +"func(C()) # 静的型チェックを通過する" #: ../../library/typing.rst:2495 msgid "" @@ -3725,20 +4638,22 @@ msgstr "" msgid "Protocol classes can be generic, for example::" msgstr "プロトコルクラスはジェネリックにもできます。例えば::" -#: ../../library/typing.rst:2503 msgid "" "class GenProto[T](Protocol):\n" " def meth(self) -> T:\n" " ..." msgstr "" +"class GenProto[T](Protocol):\n" +" def meth(self) -> T:\n" +" ..." -#: ../../library/typing.rst:2507 msgid "" "In code that needs to be compatible with Python 3.11 or older, generic " "Protocols can be written as follows::" msgstr "" +"Python 3.11 以前との互換性が必要なコードでは、ジェネリックなプロトコルを以下" +"のように書けます。 ::" -#: ../../library/typing.rst:2510 msgid "" "T = TypeVar(\"T\")\n" "\n" @@ -3746,10 +4661,14 @@ msgid "" " def meth(self) -> T:\n" " ..." msgstr "" +"T = TypeVar(\"T\")\n" +"\n" +"class GenProto(Protocol[T]):\n" +" def meth(self) -> T:\n" +" ..." -#: ../../library/typing.rst:2520 msgid "Mark a protocol class as a runtime protocol." -msgstr "" +msgstr "プロトコルクラスを実行時プロトコルとして指定します。" #: ../../library/typing.rst:2522 msgid "" @@ -3758,9 +4677,21 @@ msgid "" "ponies\" in :mod:`collections.abc` such as :class:`~collections.abc." "Iterable`. For example::" msgstr "" - -#: ../../library/typing.rst:2526 -msgid "" + +msgid "" +"@runtime_checkable\n" +"class Closable(Protocol):\n" +" def close(self): ...\n" +"\n" +"assert isinstance(open('/some/file'), Closable)\n" +"\n" +"@runtime_checkable\n" +"class Named(Protocol):\n" +" name: str\n" +"\n" +"import threading\n" +"assert isinstance(threading.Thread(name='Bob'), Named)" +msgstr "" "@runtime_checkable\n" "class Closable(Protocol):\n" " def close(self): ...\n" @@ -3773,12 +4704,12 @@ msgid "" "\n" "import threading\n" "assert isinstance(threading.Thread(name='Bob'), Named)" -msgstr "" -#: ../../library/typing.rst:2539 msgid "" "This decorator raises :exc:`TypeError` when applied to a non-protocol class." msgstr "" +"このデコレータをプロトコルでないクラスに適用すると、:exc:`TypeError` が発生し" +"ます。" #: ../../library/typing.rst:2543 msgid "" @@ -3791,15 +4722,18 @@ msgid "" "(instantiate) :class:`ssl.SSLObject`." msgstr "" -#: ../../library/typing.rst:2554 msgid "" "An :func:`isinstance` check against a runtime-checkable protocol can be " "surprisingly slow compared to an ``isinstance()`` check against a non-" "protocol class. Consider using alternative idioms such as :func:`hasattr` " "calls for structural checks in performance-sensitive code." msgstr "" +"実行時検査可能なプロトコルに対する :func:`isinstance` の検査は、プロトコルで" +"ないクラスに対する ``isinstance()`` の検査と比べて著しく遅いことがありま" +"す。\n" +"性能が重要なコードでは、構造検査に :func:`hasattr` の呼び出しなど別の方法を使" +"うことを検討してください。" -#: ../../library/typing.rst:2562 msgid "" "The internal implementation of :func:`isinstance` checks against runtime-" "checkable protocols now uses :func:`inspect.getattr_static` to look up " @@ -3808,6 +4742,13 @@ msgid "" "longer be considered instances of that protocol on Python 3.12+, and vice " "versa. Most users are unlikely to be affected by this change." msgstr "" +"実行時検査可能なプロトコルに対する :func:`isinstance` の検査の内部実装は、属" +"性の検索に :func:`inspect.getattr_static` を使うようになりました (以前は :" +"func:`hasattr` を使っていました)。\n" +"その結果、以前は実行時検査可能なプロトコルのインスタンスとみなされていたオブ" +"ジェクトが、Python 3.12 以降ではそうみなされなくなる場合があり、その逆もあり" +"ます。\n" +"ほとんどの利用者はこの変更の影響を受けないでしょう。" #: ../../library/typing.rst:2571 msgid "" @@ -3837,7 +4778,6 @@ msgstr "" "この期待は実行時にはチェックされず、型チェッカーでのみ強制されます。\n" "使用方法は次の通りです::" -#: ../../library/typing.rst:2591 msgid "" "class Point2D(TypedDict):\n" " x: int\n" @@ -3849,26 +4789,37 @@ msgid "" "\n" "assert Point2D(x=1, y=2, label='first') == dict(x=1, y=2, label='first')" msgstr "" +"class Point2D(TypedDict):\n" +" x: int\n" +" y: int\n" +" label: str\n" +"\n" +"a: Point2D = {'x': 1, 'y': 2, 'label': 'good'} # OK\n" +"b: Point2D = {'z': 3, 'label': 'bad'} # 型チェックに失敗する\n" +"\n" +"assert Point2D(x=1, y=2, label='first') == dict(x=1, y=2, label='first')" -#: ../../library/typing.rst:2601 msgid "" "An alternative way to create a ``TypedDict`` is by using function-call " "syntax. The second argument must be a literal :class:`dict`::" msgstr "" +"関数呼び出し形式で ``TypedDict`` を作成する方法もあります。\n" +"2 番目の引数は :class:`dict` リテラルでなければなりません。 ::" -#: ../../library/typing.rst:2604 msgid "Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': str})" -msgstr "" +msgstr "Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': str})" -#: ../../library/typing.rst:2606 msgid "" "This functional syntax allows defining keys which are not valid :ref:" "`identifiers `, for example because they are keywords or " "contain hyphens, or when key names must not be :ref:`mangled ` like regular private names::" msgstr "" +"この関数呼び出し形式なら、キーワードである、ハイフンを含むなどの理由で有効" +"な :ref:`識別子 ` ではないキーも定義できます。\n" +"通常のプライベート名のような :ref:`名前の変換 ` を避け" +"る必要があるキー名にも使えます。 ::" -#: ../../library/typing.rst:2611 msgid "" "# raises SyntaxError\n" "class Point2D(TypedDict):\n" @@ -3882,14 +4833,26 @@ msgid "" "Point2D = TypedDict('Point2D', {'in': int, 'x-y': int})\n" "Definition = TypedDict('Definition', {'__schema': str}) # not mangled" msgstr "" +"# SyntaxError が発生する\n" +"class Point2D(TypedDict):\n" +" in: int # 'in' はキーワード\n" +" x-y: int # ハイフンを含む名前\n" +"\n" +"class Definition(TypedDict):\n" +" __schema: str # `_Definition__schema` に変換される\n" +"\n" +"# OK、関数呼び出し形式\n" +"Point2D = TypedDict('Point2D', {'in': int, 'x-y': int})\n" +"Definition = TypedDict('Definition', {'__schema': str}) # 名前が変換されない" -#: ../../library/typing.rst:2623 msgid "" "By default, all keys must be present in a ``TypedDict``. It is possible to " "mark individual keys as non-required using :data:`NotRequired`::" msgstr "" +"デフォルトでは ``TypedDict`` のすべてのキーが必須です。\n" +":data:`NotRequired` を使うと、個々のキーを必須でないものとして指定できま" +"す。 ::" -#: ../../library/typing.rst:2626 msgid "" "class Point2D(TypedDict):\n" " x: int\n" @@ -3900,20 +4863,27 @@ msgid "" "Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': " "NotRequired[str]})" msgstr "" +"class Point2D(TypedDict):\n" +" x: int\n" +" y: int\n" +" label: NotRequired[str]\n" +"\n" +"# 別の構文\n" +"Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': " +"NotRequired[str]})" -#: ../../library/typing.rst:2634 msgid "" "This means that a ``Point2D`` ``TypedDict`` can have the ``label`` key " "omitted." -msgstr "" +msgstr "つまり、``Point2D`` ``TypedDict`` では ``label`` キーを省略できます。" -#: ../../library/typing.rst:2637 msgid "" "It is also possible to mark all keys as non-required by default by " "specifying a totality of ``False``::" msgstr "" +"``total=False`` を指定し、デフォルトですべてのキーを必須でなくすることもでき" +"ます。 ::" -#: ../../library/typing.rst:2640 msgid "" "class Point2D(TypedDict, total=False):\n" " x: int\n" @@ -3922,22 +4892,31 @@ msgid "" "# Alternative syntax\n" "Point2D = TypedDict('Point2D', {'x': int, 'y': int}, total=False)" msgstr "" +"class Point2D(TypedDict, total=False):\n" +" x: int\n" +" y: int\n" +"\n" +"# 別の構文\n" +"Point2D = TypedDict('Point2D', {'x': int, 'y': int}, total=False)" -#: ../../library/typing.rst:2647 msgid "" "This means that a ``Point2D`` ``TypedDict`` can have any of the keys " "omitted. A type checker is only expected to support a literal ``False`` or " "``True`` as the value of the ``total`` argument. ``True`` is the default, " "and makes all items defined in the class body required." msgstr "" +"つまり、``Point2D`` ``TypedDict`` ではどのキーも省略できます。\n" +"型チェッカーが ``total`` 引数の値として対応する必要があるのは、リテラルの " +"``False`` と ``True`` だけです。\n" +"デフォルトは ``True`` で、クラス本体で定義したすべての項目を必須にします。" -#: ../../library/typing.rst:2652 msgid "" "Individual keys of a ``total=False`` ``TypedDict`` can be marked as required " "using :data:`Required`::" msgstr "" +":data:`Required` を使うと、``total=False`` の ``TypedDict`` の個々のキーを必" +"須にできます。 ::" -#: ../../library/typing.rst:2655 msgid "" "class Point2D(TypedDict, total=False):\n" " x: Required[int]\n" @@ -3951,18 +4930,32 @@ msgid "" " 'label': str\n" "}, total=False)" msgstr "" +"class Point2D(TypedDict, total=False):\n" +" x: Required[int]\n" +" y: Required[int]\n" +" label: str\n" +"\n" +"# 別の構文\n" +"Point2D = TypedDict('Point2D', {\n" +" 'x': Required[int],\n" +" 'y': Required[int],\n" +" 'label': str\n" +"}, total=False)" -#: ../../library/typing.rst:2667 msgid "" "It is possible for a ``TypedDict`` type to inherit from one or more other " "``TypedDict`` types using the class-based syntax. Usage::" msgstr "" +"クラス定義形式では、``TypedDict`` 型は他の 1 つ以上の ``TypedDict`` 型を継承" +"できます。\n" +"使用例を示します。 ::" -#: ../../library/typing.rst:2671 msgid "" "class Point3D(Point2D):\n" " z: int" msgstr "" +"class Point3D(Point2D):\n" +" z: int" #: ../../library/typing.rst:2674 msgid "" @@ -3978,13 +4971,14 @@ msgid "" " z: int" msgstr "" -#: ../../library/typing.rst:2682 msgid "" "A ``TypedDict`` cannot inherit from a non-\\ ``TypedDict`` class, except " "for :class:`Generic`. For example::" msgstr "" +"``TypedDict`` は、:class:`Generic` を除いて ``TypedDict`` でないクラスを継承" +"できません。\n" +"例えば次のようになります。 ::" -#: ../../library/typing.rst:2685 msgid "" "class X(TypedDict):\n" " x: int\n" @@ -3998,25 +4992,37 @@ msgid "" "\n" "class XZ(X, Z): pass # raises TypeError" msgstr "" +"class X(TypedDict):\n" +" x: int\n" +"\n" +"class Y(TypedDict):\n" +" y: int\n" +"\n" +"class Z(object): pass # TypedDict でないクラス\n" +"\n" +"class XY(X, Y): pass # OK\n" +"\n" +"class XZ(X, Z): pass # TypeError が発生する" -#: ../../library/typing.rst:2697 msgid "A ``TypedDict`` can be generic::" -msgstr "" +msgstr "``TypedDict`` はジェネリックにもできます。 ::" -#: ../../library/typing.rst:2699 msgid "" "class Group[T](TypedDict):\n" " key: T\n" " group: list[T]" msgstr "" +"class Group[T](TypedDict):\n" +" key: T\n" +" group: list[T]" -#: ../../library/typing.rst:2703 msgid "" "To create a generic ``TypedDict`` that is compatible with Python 3.11 or " "lower, inherit from :class:`Generic` explicitly:" msgstr "" +"Python 3.11 以前と互換性のあるジェネリックな ``TypedDict`` を作成するには、:" +"class:`Generic` を明示的に継承します:" -#: ../../library/typing.rst:2706 msgid "" "T = TypeVar(\"T\")\n" "\n" @@ -4024,6 +5030,11 @@ msgid "" " key: T\n" " group: list[T]" msgstr "" +"T = TypeVar(\"T\")\n" +"\n" +"class Group(TypedDict, Generic[T]):\n" +" key: T\n" +" group: list[T]" #: ../../library/typing.rst:2714 msgid "" @@ -4032,12 +5043,12 @@ msgid "" "attr:`__total__`, :attr:`__required_keys__`, and :attr:`__optional_keys__`." msgstr "" -#: ../../library/typing.rst:2720 msgid "" "``Point2D.__total__`` gives the value of the ``total`` argument. Example:" msgstr "" +"``Point2D.__total__`` は ``total`` 引数の値を示します。\n" +"例を示します:" -#: ../../library/typing.rst:2723 msgid "" ">>> from typing import TypedDict\n" ">>> class Point2D(TypedDict): pass\n" @@ -4050,8 +5061,17 @@ msgid "" ">>> Point3D.__total__\n" "True" msgstr "" +">>> from typing import TypedDict\n" +">>> class Point2D(TypedDict): pass\n" +">>> Point2D.__total__\n" +"True\n" +">>> class Point2D(TypedDict, total=False): pass\n" +">>> Point2D.__total__\n" +"False\n" +">>> class Point3D(Point2D): pass\n" +">>> Point3D.__total__\n" +"True" -#: ../../library/typing.rst:2736 msgid "" "This attribute reflects *only* the value of the ``total`` argument to the " "current ``TypedDict`` class, not whether the class is semantically total. " @@ -4061,20 +5081,29 @@ msgid "" "use :attr:`__required_keys__` and :attr:`__optional_keys__` for " "introspection." msgstr "" +"この属性が反映するのは、現在の ``TypedDict`` クラスに渡された ``total`` 引数" +"の値 *だけ* であり、すべてのキーが実際に必須かどうかではありません。\n" +"例えば、``__total__`` が ``True`` の ``TypedDict`` に :data:`NotRequired` の" +"キーがあったり、\n" +"``total=False`` の別の ``TypedDict`` を継承していたりする場合があります。\n" +"したがって、イントロスペクションには通常 :attr:`__required_keys__` と :attr:" +"`__optional_keys__` を使う方が適切です。" -#: ../../library/typing.rst:2749 msgid "" "``Point2D.__required_keys__`` and ``Point2D.__optional_keys__`` return :" "class:`frozenset` objects containing required and non-required keys, " "respectively." msgstr "" +"``Point2D.__required_keys__`` と ``Point2D.__optional_keys__`` は、それぞれ必" +"須のキーと必須でないキーを含む :class:`frozenset` オブジェクトを返します。" -#: ../../library/typing.rst:2752 msgid "" "Keys marked with :data:`Required` will always appear in " "``__required_keys__`` and keys marked with :data:`NotRequired` will always " "appear in ``__optional_keys__``." msgstr "" +":data:`Required` で指定したキーは必ず ``__required_keys__`` に含まれ、:data:" +"`NotRequired` で指定したキーは必ず ``__optional_keys__`` に含まれます。" #: ../../library/typing.rst:2755 msgid "" @@ -4085,7 +5114,6 @@ msgid "" "``TypedDict`` with a different value for ``total``:" msgstr "" -#: ../../library/typing.rst:2762 msgid "" ">>> class Point2D(TypedDict, total=False):\n" "... x: int\n" @@ -4099,8 +5127,18 @@ msgid "" ">>> Point3D.__optional_keys__ == frozenset({'x', 'y'})\n" "True" msgstr "" +">>> class Point2D(TypedDict, total=False):\n" +"... x: int\n" +"... y: int\n" +"...\n" +">>> class Point3D(Point2D):\n" +"... z: int\n" +"...\n" +">>> Point3D.__required_keys__ == frozenset({'z'})\n" +"True\n" +">>> Point3D.__optional_keys__ == frozenset({'x', 'y'})\n" +"True" -#: ../../library/typing.rst:2780 msgid "" "If ``from __future__ import annotations`` is used or if annotations are " "given as strings, annotations are not evaluated when the ``TypedDict`` is " @@ -4108,45 +5146,54 @@ msgid "" "``__optional_keys__`` rely on may not work properly, and the values of the " "attributes may be incorrect." msgstr "" +"``from __future__ import annotations`` を使っている場合や、アノテーションを文" +"字列で指定した場合は、``TypedDict`` の定義時にアノテーションが評価されませ" +"ん。\n" +"そのため、``__required_keys__`` と ``__optional_keys__`` が利用する実行時のイ" +"ントロスペクションが正しく機能せず、属性の値が誤っている場合があります。" #: ../../library/typing.rst:2786 msgid "Support for :data:`ReadOnly` is reflected in the following attributes:" msgstr "" -#: ../../library/typing.rst:2790 msgid "" "A :class:`frozenset` containing the names of all read-only keys. Keys are " "read-only if they carry the :data:`ReadOnly` qualifier." msgstr "" +"すべての読み取り専用のキーの名前を含む :class:`frozenset` です。\n" +":data:`ReadOnly` 修飾子を持つキーが読み取り専用です。" -#: ../../library/typing.rst:2797 msgid "" "A :class:`frozenset` containing the names of all mutable keys. Keys are " "mutable if they do not carry the :data:`ReadOnly` qualifier." msgstr "" +"すべての変更可能なキーの名前を含む :class:`frozenset` です。\n" +":data:`ReadOnly` 修飾子を持たないキーが変更可能です。" -#: ../../library/typing.rst:2802 msgid "" "See the `TypedDict `_ section in the typing documentation for more examples and " "detailed rules." msgstr "" +"さらに例や詳しい規則を知りたい場合は、型付けのドキュメントの `TypedDict " +"`_ の節を" +"参照してください。" -#: ../../library/typing.rst:2806 msgid "" "Added support for marking individual keys as :data:`Required` or :data:" "`NotRequired`. See :pep:`655`." msgstr "" +"個々のキーを :data:`Required` または :data:`NotRequired` と指定できるようにな" +"りました。\n" +":pep:`655` を参照してください。" -#: ../../library/typing.rst:2810 msgid "Added support for generic ``TypedDict``\\ s." -msgstr "" +msgstr "ジェネリックな ``TypedDict`` に対応しました。" -#: ../../library/typing.rst:2813 msgid "" "Removed support for the keyword-argument method of creating ``TypedDict``\\ " "s." -msgstr "" +msgstr "キーワード引数で ``TypedDict`` を作成する方法は使えなくなりました。" #: ../../library/typing.rst:2816 msgid "Support for the :data:`ReadOnly` qualifier was added." @@ -4204,48 +5251,57 @@ msgid "" "return type." msgstr "返り値の型と共変な抽象メソッド ``__round__`` を備えた ABC です。" -#: ../../library/typing.rst:2868 msgid "ABCs and Protocols for working with I/O" -msgstr "" +msgstr "入出力を扱うための抽象基底クラスとプロトコル" -#: ../../library/typing.rst:2874 msgid "" "Generic class ``IO[AnyStr]`` and its subclasses ``TextIO(IO[str])`` and " "``BinaryIO(IO[bytes])`` represent the types of I/O streams such as returned " "by :func:`open`. Please note that these classes are not protocols, and their " "interface is fairly broad." msgstr "" +"ジェネリッククラス ``IO[AnyStr]`` と、そのサブクラス ``TextIO(IO[str])`` およ" +"び ``BinaryIO(IO[bytes])`` は、\n" +":func:`open` が返すものなどの入出力ストリームの型を表します。\n" +"これらのクラスはプロトコルではなく、インターフェースもかなり広い範囲にわたる" +"ことに注意してください。" -#: ../../library/typing.rst:2880 msgid "" "The protocols :class:`io.Reader` and :class:`io.Writer` offer a simpler " "alternative for argument types, when only the ``read()`` or ``write()`` " "methods are accessed, respectively::" msgstr "" +"``read()`` または ``write()`` メソッドだけを使う場合、引数の型には、それぞ" +"れ :class:`io.Reader` や :class:`io.Writer` のプロトコルをより簡潔な代替手段" +"として使えます。 ::" -#: ../../library/typing.rst:2884 msgid "" "def read_and_write(reader: Reader[str], writer: Writer[bytes]):\n" " data = reader.read()\n" " writer.write(data.encode())" msgstr "" +"def read_and_write(reader: Reader[str], writer: Writer[bytes]):\n" +" data = reader.read()\n" +" writer.write(data.encode())" -#: ../../library/typing.rst:2888 msgid "" "Also consider using :class:`collections.abc.Iterable` for iterating over the " "lines of an input stream::" msgstr "" +"入力ストリームの行を反復処理する場合は、:class:`collections.abc.Iterable` の" +"使用も検討してください。 ::" -#: ../../library/typing.rst:2891 msgid "" "def read_config(stream: Iterable[str]):\n" " for line in stream:\n" " ..." msgstr "" +"def read_config(stream: Iterable[str]):\n" +" for line in stream:\n" +" ..." -#: ../../library/typing.rst:2896 msgid "Functions and decorators" -msgstr "" +msgstr "関数とデコレータ" #: ../../library/typing.rst:2900 msgid "Cast a value to a type." @@ -4262,38 +5318,44 @@ msgstr "" "には意図的に何も検査しません。\n" "(その理由は、処理をできる限り速くしたかったためです。)" -#: ../../library/typing.rst:2909 msgid "" "Ask a static type checker to confirm that *val* has an inferred type of " "*typ*." msgstr "" +"*val* の推論された型が *typ* であることを確認するよう、静的型チェッカーに要求" +"します。" -#: ../../library/typing.rst:2911 msgid "" "At runtime this does nothing: it returns the first argument unchanged with " "no checks or side effects, no matter the actual type of the argument." msgstr "" +"実行時には何もしません。\n" +"引数の実際の型にかかわらず、検査や副作用を伴わずに最初の引数をそのまま返しま" +"す。" -#: ../../library/typing.rst:2914 msgid "" "When a static type checker encounters a call to ``assert_type()``, it emits " "an error if the value is not of the specified type::" msgstr "" +"静的型チェッカーは ``assert_type()`` の呼び出しを検出すると、値が指定された型" +"でなければエラーを報告します。 ::" -#: ../../library/typing.rst:2917 msgid "" "def greet(name: str) -> None:\n" " assert_type(name, str) # OK, inferred type of `name` is `str`\n" " assert_type(name, int) # type checker error" msgstr "" +"def greet(name: str) -> None:\n" +" assert_type(name, str) # OK、`name` の推論された型は `str`\n" +" assert_type(name, int) # 型チェッカーのエラー" -#: ../../library/typing.rst:2921 msgid "" "This function is useful for ensuring the type checker's understanding of a " "script is in line with the developer's intentions::" msgstr "" +"この関数は、型チェッカーによるスクリプトの解釈が開発者の意図と一致しているこ" +"とを確認するのに役立ちます。 ::" -#: ../../library/typing.rst:2924 msgid "" "def complex_function(arg: object):\n" " # Do some complex type-narrowing logic,\n" @@ -4302,17 +5364,22 @@ msgid "" " # Test whether the type checker correctly understands our function\n" " assert_type(arg, int)" msgstr "" +"def complex_function(arg: object):\n" +" # 複雑な型の絞り込み処理を行い、\n" +" # その結果、型が `int` と推論されることを期待する\n" +" ...\n" +" # 型チェッカーが関数を正しく理解しているかを検査する\n" +" assert_type(arg, int)" -#: ../../library/typing.rst:2935 msgid "" "Ask a static type checker to confirm that a line of code is unreachable." msgstr "" +"あるコード行に到達しないことを確認するよう、静的型チェッカーに要求します。" #: ../../library/typing.rst:2937 msgid "Example::" msgstr "以下はプログラム例です::" -#: ../../library/typing.rst:2939 msgid "" "def int_or_str(arg: int | str) -> None:\n" " match arg:\n" @@ -4323,15 +5390,25 @@ msgid "" " case _ as unreachable:\n" " assert_never(unreachable)" msgstr "" +"def int_or_str(arg: int | str) -> None:\n" +" match arg:\n" +" case int():\n" +" print(\"It's an int\")\n" +" case str():\n" +" print(\"It's a str\")\n" +" case _ as unreachable:\n" +" assert_never(unreachable)" -#: ../../library/typing.rst:2948 msgid "" "Here, the annotations allow the type checker to infer that the last case can " "never execute, because ``arg`` is either an :class:`int` or a :class:`str`, " "and both options are covered by earlier cases." msgstr "" +"この例では、アノテーションによって、型チェッカーは最後の case が決して実行さ" +"れないと推論できます。\n" +"``arg`` は :class:`int` または :class:`str` のいずれかで、どちらも前の case " +"で処理されるためです。" -#: ../../library/typing.rst:2953 msgid "" "If a type checker finds that a call to ``assert_never()`` is reachable, it " "will emit an error. For example, if the type annotation for ``arg`` was " @@ -4340,46 +5417,57 @@ msgid "" "``assert_never`` to pass type checking, the inferred type of the argument " "passed in must be the bottom type, :data:`Never`, and nothing else." msgstr "" +"型チェッカーが ``assert_never()`` の呼び出しに到達可能と判断すると、エラーを" +"報告します。\n" +"例えば ``arg`` の型アノテーションが ``int | str | float`` だった場合、型" +"チェッカーは ``unreachable`` が :class:`float` 型であるというエラーを報告しま" +"す。\n" +"``assert_never`` の呼び出しが型チェックを通過するには、渡した引数の推論された" +"型がボトム型の :data:`Never` でなければならず、他の型ではいけません。" -#: ../../library/typing.rst:2961 msgid "At runtime, this throws an exception when called." -msgstr "" +msgstr "実行時に呼び出すと例外を送出します。" -#: ../../library/typing.rst:2964 msgid "" "`Unreachable Code and Exhaustiveness Checking `__ has more information about exhaustiveness " "checking with static typing." msgstr "" +"静的型付けによる網羅性検査の詳細は、`Unreachable Code and Exhaustiveness " +"Checking `__ を" +"参照してください。" -#: ../../library/typing.rst:2972 msgid "Ask a static type checker to reveal the inferred type of an expression." -msgstr "" +msgstr "式の推論された型を表示するよう、静的型チェッカーに要求します。" -#: ../../library/typing.rst:2974 msgid "" "When a static type checker encounters a call to this function, it emits a " "diagnostic with the inferred type of the argument. For example::" msgstr "" +"静的型チェッカーは、この関数の呼び出しを検出すると、引数の推論された型を診断" +"メッセージとして出力します。\n" +"例えば次のようになります。 ::" -#: ../../library/typing.rst:2977 msgid "" "x: int = 1\n" "reveal_type(x) # Revealed type is \"builtins.int\"" msgstr "" +"x: int = 1\n" +"reveal_type(x) # 表示される型は \"builtins.int\"" -#: ../../library/typing.rst:2980 msgid "" "This can be useful when you want to debug how your type checker handles a " "particular piece of code." msgstr "" +"型チェッカーが特定のコードをどう扱うかをデバッグしたいときに役立ちます。" -#: ../../library/typing.rst:2983 msgid "" "At runtime, this function prints the runtime type of its argument to :data:" "`sys.stderr` and returns the argument unchanged (allowing the call to be " "used within an expression)::" msgstr "" +"実行時には、引数の実際の型を :data:`sys.stderr` に表示し、引数をそのまま返し" +"ます (そのため、式の中で呼び出せます)。 ::" #: ../../library/typing.rst:2987 msgid "" @@ -4387,25 +5475,30 @@ msgid "" "print(x) # prints \"1\"" msgstr "" -#: ../../library/typing.rst:2990 msgid "" "Note that the runtime type may be different from (more or less specific " "than) the type statically inferred by a type checker." msgstr "" +"実行時の型は、型チェッカーが静的に推論した型と異なる場合があります (より具体" +"的な場合も、より一般的な場合もあります)。" -#: ../../library/typing.rst:2993 msgid "" "Most type checkers support ``reveal_type()`` anywhere, even if the name is " "not imported from ``typing``. Importing the name from ``typing``, however, " "allows your code to run without runtime errors and communicates intent more " "clearly." msgstr "" +"ほとんどの型チェッカーは、``typing`` から名前をインポートしていなくても、どこ" +"でも ``reveal_type()`` を使えます。\n" +"ただし、``typing`` からインポートしておくと、実行時エラーを起こさずにコードを" +"実行でき、意図もより明確になります。" -#: ../../library/typing.rst:3004 msgid "" "Decorator to mark an object as providing :func:`dataclass `-like behavior." msgstr "" +"オブジェクトが :func:`dataclass ` のような振る舞いを提" +"供することを示すデコレータです。" #: ../../library/typing.rst:3007 msgid "" @@ -4416,11 +5509,9 @@ msgid "" "to :func:`@dataclasses.dataclass `." msgstr "" -#: ../../library/typing.rst:3014 msgid "Example usage with a decorator function:" -msgstr "" +msgstr "デコレータ関数での使用例:" -#: ../../library/typing.rst:3016 msgid "" "@dataclass_transform()\n" "def create_model[T](cls: type[T]) -> type[T]:\n" @@ -4432,12 +5523,19 @@ msgid "" " id: int\n" " name: str" msgstr "" +"@dataclass_transform()\n" +"def create_model[T](cls: type[T]) -> type[T]:\n" +" ...\n" +" return cls\n" +"\n" +"@create_model\n" +"class CustomerModel:\n" +" id: int\n" +" name: str" -#: ../../library/typing.rst:3028 msgid "On a base class::" -msgstr "" +msgstr "基底クラスでの使用例です。 ::" -#: ../../library/typing.rst:3030 msgid "" "@dataclass_transform()\n" "class ModelBase: ...\n" @@ -4446,12 +5544,16 @@ msgid "" " id: int\n" " name: str" msgstr "" +"@dataclass_transform()\n" +"class ModelBase: ...\n" +"\n" +"class CustomerModel(ModelBase):\n" +" id: int\n" +" name: str" -#: ../../library/typing.rst:3037 msgid "On a metaclass::" -msgstr "" +msgstr "メタクラスでの使用例です。 ::" -#: ../../library/typing.rst:3039 msgid "" "@dataclass_transform()\n" "class ModelMeta(type): ...\n" @@ -4462,6 +5564,14 @@ msgid "" " id: int\n" " name: str" msgstr "" +"@dataclass_transform()\n" +"class ModelMeta(type): ...\n" +"\n" +"class ModelBase(metaclass=ModelMeta): ...\n" +"\n" +"class CustomerModel(ModelBase):\n" +" id: int\n" +" name: str" #: ../../library/typing.rst:3048 msgid "" @@ -4492,23 +5602,29 @@ msgstr "" msgid "Parameters" msgstr "パラメーター" -#: ../../library/typing.rst:3066 msgid "" "Indicates whether the ``eq`` parameter is assumed to be ``True`` or " "``False`` if it is omitted by the caller. Defaults to ``True``." msgstr "" +"呼び出し側が ``eq`` パラメータを省略したときに、``True`` と ``False`` のどち" +"らとみなすかを示します。\n" +"デフォルトは ``True`` です。" -#: ../../library/typing.rst:3071 msgid "" "Indicates whether the ``order`` parameter is assumed to be ``True`` or " "``False`` if it is omitted by the caller. Defaults to ``False``." msgstr "" +"呼び出し側が ``order`` パラメータを省略したときに、``True`` と ``False`` のど" +"ちらとみなすかを示します。\n" +"デフォルトは ``False`` です。" -#: ../../library/typing.rst:3076 msgid "" "Indicates whether the ``kw_only`` parameter is assumed to be ``True`` or " "``False`` if it is omitted by the caller. Defaults to ``False``." msgstr "" +"呼び出し側が ``kw_only`` パラメータを省略したときに、``True`` と ``False`` の" +"どちらとみなすかを示します。\n" +"デフォルトは ``False`` です。" #: ../../library/typing.rst:3081 msgid "" @@ -4517,79 +5633,81 @@ msgid "" "versionadded:: 3.12" msgstr "" -#: ../../library/typing.rst:3082 msgid "" "Indicates whether the ``frozen`` parameter is assumed to be ``True`` or " "``False`` if it is omitted by the caller. Defaults to ``False``." msgstr "" +"呼び出し側が ``frozen`` パラメータを省略したときに、``True`` と ``False`` の" +"どちらとみなすかを示します。\n" +"デフォルトは ``False`` です。" -#: ../../library/typing.rst:3088 msgid "" "Specifies a static list of supported classes or functions that describe " "fields, similar to :func:`dataclasses.field`. Defaults to ``()``." msgstr "" +":func:`dataclasses.field` と同じようにフィールドを記述する、対応可能なクラス" +"や関数の静的なリストを指定します。\n" +"デフォルトは ``()`` です。" -#: ../../library/typing.rst:3094 msgid "" "Arbitrary other keyword arguments are accepted in order to allow for " "possible future extensions." -msgstr "" +msgstr "将来の拡張を可能にするために、他の任意のキーワード引数も受け取れます。" -#: ../../library/typing.rst:3098 msgid "" "Type checkers recognize the following optional parameters on field " "specifiers:" msgstr "" +"型チェッカーは、フィールド指定子の以下の省略可能なパラメータを認識します:" -#: ../../library/typing.rst:3101 msgid "**Recognised parameters for field specifiers**" -msgstr "" +msgstr "**フィールド指定子で認識されるパラメータ**" -#: ../../library/typing.rst:3105 msgid "Parameter name" -msgstr "" +msgstr "パラメータ名" #: ../../library/typing.rst:3106 msgid "Description" msgstr "説明" -#: ../../library/typing.rst:3107 msgid "``init``" -msgstr "" +msgstr "``init``" -#: ../../library/typing.rst:3108 msgid "" "Indicates whether the field should be included in the synthesized " "``__init__`` method. If unspecified, ``init`` defaults to ``True``." msgstr "" +"自動生成される ``__init__`` メソッドにフィールドを含めるかどうかを示しま" +"す。\n" +"指定しなければ、``init`` のデフォルトは ``True`` です。" #: ../../library/typing.rst:3111 msgid "``default``" msgstr "``default``" -#: ../../library/typing.rst:3112 msgid "Provides the default value for the field." -msgstr "" +msgstr "フィールドのデフォルト値を指定します。" #: ../../library/typing.rst:3113 msgid "``default_factory``" msgstr "``default_factory``" -#: ../../library/typing.rst:3114 msgid "" "Provides a runtime callback that returns the default value for the field. If " "neither ``default`` nor ``default_factory`` are specified, the field is " "assumed to have no default value and must be provided a value when the class " "is instantiated." msgstr "" +"実行時にフィールドのデフォルト値を返すコールバックを指定します。\n" +"``default`` も ``default_factory`` も指定しない場合、フィールドにはデフォルト" +"値がないものとみなされ、クラスのインスタンス化時に値を渡す必要があります。" #: ../../library/typing.rst:3119 msgid "``factory``" msgstr "``factory``" -#: ../../library/typing.rst:3120 msgid "An alias for the ``default_factory`` parameter on field specifiers." -msgstr "" +msgstr "フィールド指定子の ``default_factory`` パラメータのエイリアスです。" #: ../../library/typing.rst:3121 msgid "``kw_only``" @@ -4605,40 +5723,43 @@ msgid "" "will be used." msgstr "" -#: ../../library/typing.rst:3128 msgid "``alias``" -msgstr "" +msgstr "``alias``" -#: ../../library/typing.rst:3129 msgid "" "Provides an alternative name for the field. This alternative name is used in " "the synthesized ``__init__`` method." msgstr "" +"フィールドの別名を指定します。\n" +"この別名は、自動生成される ``__init__`` メソッドで使われます。" -#: ../../library/typing.rst:3132 msgid "" "At runtime, this decorator records its arguments in the " "``__dataclass_transform__`` attribute on the decorated object. It has no " "other runtime effect." msgstr "" +"実行時には、このデコレータは引数をデコレートしたオブジェクトの " +"``__dataclass_transform__`` 属性に記録します。\n" +"それ以外の実行時の効果はありません。" #: ../../library/typing.rst:3136 msgid "See :pep:`681` for more details." msgstr "より詳しくは :pep:`681` を参照してください。" -#: ../../library/typing.rst:3144 msgid "Decorator for creating overloaded functions and methods." -msgstr "" +msgstr "オーバーロードされた関数やメソッドを作成するデコレータです。" -#: ../../library/typing.rst:3146 msgid "" "The ``@overload`` decorator allows describing functions and methods that " "support multiple different combinations of argument types. A series of " "``@overload``-decorated definitions must be followed by exactly one non-" "``@overload``-decorated definition (for the same function/method)." msgstr "" +"``@overload`` デコレータは、引数の型の複数の組み合わせに対応する関数やメソッ" +"ドを記述できます。\n" +"一連の ``@overload`` 付き定義の後には、同じ関数またはメソッドの " +"``@overload`` のない定義を 1 つだけ置く必要があります。" -#: ../../library/typing.rst:3151 msgid "" "``@overload``-decorated definitions are for the benefit of the type checker " "only, since they will be overwritten by the non-``@overload``-decorated " @@ -4647,14 +5768,20 @@ msgid "" "calling an ``@overload``-decorated function directly will raise :exc:" "`NotImplementedError`." msgstr "" +"``@overload`` 付きの定義は、その後の ``@overload`` のない定義で上書きされるた" +"め、型チェッカーのためだけに使われます。\n" +"一方、``@overload`` のない定義は実行時に使われますが、型チェッカーは呼び出し" +"に対応するシグネチャの判定ではこの定義を使いません。\n" +"実行時に ``@overload`` 付きの関数を直接呼び出すと、:exc:" +"`NotImplementedError` が発生します。" -#: ../../library/typing.rst:3159 msgid "" "An example of overload that gives a more precise type than can be expressed " "using a union or a type variable:" msgstr "" +"ユニオンや型変数では表現できない、より正確な型をオーバーロードで記述する例で" +"す:" -#: ../../library/typing.rst:3162 msgid "" "@overload\n" "def process(response: None) -> None:\n" @@ -4668,17 +5795,29 @@ msgid "" "def process(response):\n" " ... # actual implementation goes here" msgstr "" +"@overload\n" +"def process(response: None) -> None:\n" +" ...\n" +"@overload\n" +"def process(response: int) -> tuple[int, str]:\n" +" ...\n" +"@overload\n" +"def process(response: bytes) -> str:\n" +" ...\n" +"def process(response):\n" +" ... # 実際の実装をここに書く" #: ../../library/typing.rst:3176 msgid "" "See :pep:`484` for more details and comparison with other typing semantics." msgstr "詳細と他の型付け意味論との比較は :pep:`484` を参照してください。" -#: ../../library/typing.rst:3178 msgid "" "Overloaded functions can now be introspected at runtime using :func:" "`get_overloads`." msgstr "" +":func:`get_overloads` を使い、実行時にオーバーロードされた関数を調べられるよ" +"うになりました。" #: ../../library/typing.rst:3185 msgid "" @@ -4696,32 +5835,32 @@ msgid "" "returns an empty sequence." msgstr "" -#: ../../library/typing.rst:3195 msgid "" "``get_overloads()`` can be used for introspecting an overloaded function at " "runtime." msgstr "" +"``get_overloads()`` は、実行時にオーバーロードされた関数を調べるために使えま" +"す。" -#: ../../library/typing.rst:3203 msgid "Clear all registered overloads in the internal registry." -msgstr "" +msgstr "内部レジストリに登録されたすべてのオーバーロードを消去します。" -#: ../../library/typing.rst:3205 msgid "This can be used to reclaim the memory used by the registry." -msgstr "" +msgstr "レジストリが使用するメモリを解放するために使えます。" -#: ../../library/typing.rst:3212 msgid "Decorator to indicate final methods and final classes." -msgstr "" +msgstr "メソッドやクラスが final であることを示すデコレータです。" -#: ../../library/typing.rst:3214 msgid "" "Decorating a method with ``@final`` indicates to a type checker that the " "method cannot be overridden in a subclass. Decorating a class with " "``@final`` indicates that it cannot be subclassed." msgstr "" +"メソッドを ``@final`` でデコレートすると、サブクラスでオーバーライドできない" +"ことを型チェッカーに伝えます。\n" +"クラスを ``@final`` でデコレートすると、サブクラスを作成できないことを伝えま" +"す。" -#: ../../library/typing.rst:3220 msgid "" "class Base:\n" " @final\n" @@ -4737,8 +5876,20 @@ msgid "" "class Other(Leaf): # Error reported by type checker\n" " ..." msgstr "" +"class Base:\n" +" @final\n" +" def done(self) -> None:\n" +" ...\n" +"class Sub(Base):\n" +" def done(self) -> None: # 型チェッカーがエラーを報告する\n" +" ...\n" +"\n" +"@final\n" +"class Leaf:\n" +" ...\n" +"class Other(Leaf): # 型チェッカーがエラーを報告する\n" +" ..." -#: ../../library/typing.rst:3239 msgid "" "The decorator will now attempt to set a ``__final__`` attribute to ``True`` " "on the decorated object. Thus, a check like ``if getattr(obj, \"__final__\", " @@ -4747,22 +5898,33 @@ msgid "" "attributes, the decorator returns the object unchanged without raising an " "exception." msgstr "" +"このデコレータは、デコレートしたオブジェクトの ``__final__`` 属性を ``True`` " +"に設定しようとするようになりました。\n" +"そのため、実行時に ``if getattr(obj, \"__final__\", False)`` などの検査で、オ" +"ブジェクト ``obj`` が final と指定されているかどうかを調べられます。\n" +"デコレートしたオブジェクトが属性の設定に対応していなければ、例外を送出せずに" +"そのオブジェクトをそのまま返します。" #: ../../library/typing.rst:3250 msgid "Decorator to indicate that annotations are not type hints." msgstr "アノテーションが型ヒントでないことを示すデコレータです。" -#: ../../library/typing.rst:3252 msgid "" "This works as a class or function :term:`decorator`. With a class, it " "applies recursively to all methods and classes defined in that class (but " "not to methods defined in its superclasses or subclasses). Type checkers " "will ignore all annotations in a function or class with this decorator." msgstr "" +"クラスまたは関数の :term:`デコレータ ` として使えます。\n" +"クラスの場合、そのクラス内で定義されたすべてのメソッドとクラスに再帰的に適用" +"されます (スーパークラスやサブクラスで定義されたメソッドには適用されませ" +"ん)。\n" +"型チェッカーは、このデコレータを付けた関数やクラスのすべてのアノテーションを" +"無視します。" -#: ../../library/typing.rst:3258 msgid "``@no_type_check`` mutates the decorated object in place." msgstr "" +"``@no_type_check`` は、デコレートしたオブジェクトをインプレースに変更します。" #: ../../library/typing.rst:3262 msgid "Decorator to give another decorator the :func:`no_type_check` effect." @@ -4782,20 +5944,23 @@ msgid "" "therefore deprecated, and will be removed in Python 3.15." msgstr "" -#: ../../library/typing.rst:3273 msgid "" "Decorator to indicate that a method in a subclass is intended to override a " "method or attribute in a superclass." msgstr "" +"サブクラスのメソッドが、スーパークラスのメソッドや属性をオーバーライドする意" +"図を示すデコレータです。" -#: ../../library/typing.rst:3276 msgid "" "Type checkers should emit an error if a method decorated with ``@override`` " "does not, in fact, override anything. This helps prevent bugs that may occur " "when a base class is changed without an equivalent change to a child class." msgstr "" +"``@override`` でデコレートされたメソッドが実際には何もオーバーライドしていな" +"ければ、型チェッカーはエラーを報告すべきです。\n" +"これにより、基底クラスを変更したのに子クラスに対応する変更を加えなかった場合" +"のバグを防ぎやすくなります。" -#: ../../library/typing.rst:3283 msgid "" "class Base:\n" " def log_status(self) -> None:\n" @@ -4810,12 +5975,23 @@ msgid "" " def done(self) -> None: # Error reported by type checker\n" " ..." msgstr "" +"class Base:\n" +" def log_status(self) -> None:\n" +" ...\n" +"\n" +"class Sub(Base):\n" +" @override\n" +" def log_status(self) -> None: # OK: Base.log_status をオーバーライドす" +"る\n" +" ...\n" +"\n" +" @override\n" +" def done(self) -> None: # 型チェッカーがエラーを報告する\n" +" ..." -#: ../../library/typing.rst:3298 msgid "There is no runtime checking of this property." -msgstr "" +msgstr "この性質は実行時には検査されません。" -#: ../../library/typing.rst:3300 msgid "" "The decorator will attempt to set an ``__override__`` attribute to ``True`` " "on the decorated object. Thus, a check like ``if getattr(obj, " @@ -4824,14 +6000,19 @@ msgid "" "not support setting attributes, the decorator returns the object unchanged " "without raising an exception." msgstr "" +"このデコレータは、デコレートしたオブジェクトの ``__override__`` 属性を " +"``True`` に設定しようとします。\n" +"そのため、実行時に ``if getattr(obj, \"__override__\", False)`` などの検査" +"で、オブジェクト ``obj`` がオーバーライドと指定されているかどうかを調べられま" +"す。\n" +"デコレートしたオブジェクトが属性の設定に対応していなければ、例外を送出せずに" +"そのオブジェクトをそのまま返します。" -#: ../../library/typing.rst:3307 msgid "See :pep:`698` for more details." -msgstr "" +msgstr "詳細は :pep:`698` を参照してください。" -#: ../../library/typing.rst:3314 msgid "Decorator to mark a class or function as unavailable at runtime." -msgstr "" +msgstr "クラスや関数が実行時には使えないことを示すデコレータです。" #: ../../library/typing.rst:3316 msgid "" @@ -4843,7 +6024,6 @@ msgstr "" "このデコレータは主に、実装がプライベートクラスのインスタンスを返す場合に、型" "スタブファイルに定義されているクラスに対して印を付けるためのものです::" -#: ../../library/typing.rst:3320 msgid "" "@type_check_only\n" "class Response: # private or not available at runtime\n" @@ -4852,6 +6032,12 @@ msgid "" "\n" "def fetch_response() -> Response: ..." msgstr "" +"@type_check_only\n" +"class Response: # プライベート、または実行時には利用できない\n" +" code: int\n" +" def get_header(self, name: str) -> str: ...\n" +"\n" +"def fetch_response() -> Response: ..." #: ../../library/typing.rst:3327 msgid "" @@ -4861,9 +6047,8 @@ msgstr "" "プライベートクラスのインスタンスを返すのは推奨されません。\n" "そのようなクラスは公開クラスにするのが望ましいです。" -#: ../../library/typing.rst:3331 msgid "Introspection helpers" -msgstr "" +msgstr "イントロスペクション用のヘルパー" #: ../../library/typing.rst:3335 msgid "" @@ -4879,7 +6064,6 @@ msgid "" "the following changes to the annotations dictionary:" msgstr "" -#: ../../library/typing.rst:3341 msgid "" "Forward references encoded as string literals or :class:`ForwardRef` objects " "are handled by evaluating them in *globalns*, *localns*, and (where " @@ -4887,10 +6071,15 @@ msgid "" "*globalns* or *localns* is not given, appropriate namespace dictionaries are " "inferred from *obj*." msgstr "" +"文字列リテラルや :class:`ForwardRef` オブジェクトとして記述された前方参照は、" +"*globalns*、*localns*、\n" +"該当する場合は *obj* の :ref:`型引数 ` の名前空間で評価して処理" +"します。\n" +"*globalns* や *localns* を指定しなければ、*obj* から適切な名前空間の辞書を推" +"定します。" -#: ../../library/typing.rst:3346 msgid "``None`` is replaced with :class:`types.NoneType`." -msgstr "" +msgstr "``None`` を :class:`types.NoneType` に置き換えます。" #: ../../library/typing.rst:3347 msgid "" @@ -4930,38 +6119,45 @@ msgid "" "imported under :data:`if TYPE_CHECKING `." msgstr "" -#: ../../library/typing.rst:3371 msgid "" "Added ``include_extras`` parameter as part of :pep:`593`. See the " "documentation on :data:`Annotated` for more information." msgstr "" +":pep:`593` の一部として ``include_extras`` パラメータを追加しました。\n" +"詳細は :data:`Annotated` のドキュメントを参照してください。" -#: ../../library/typing.rst:3375 msgid "" "Previously, ``Optional[t]`` was added for function and method annotations if " "a default value equal to ``None`` was set. Now the annotation is returned " "unchanged." msgstr "" +"以前は、関数やメソッドの引数に ``None`` と等しいデフォルト値が設定されている" +"と、アノテーションに ``Optional[t]`` が追加されていました。\n" +"現在はアノテーションを変更せずに返します。" -#: ../../library/typing.rst:3382 msgid "" "Get the unsubscripted version of a type: for a typing object of the form " "``X[Y, Z, ...]`` return ``X``." msgstr "" +"型から添字を取り除いたものを取得します。\n" +"``X[Y, Z, ...]`` の形式の型付けオブジェクトに対して ``X`` を返します。" -#: ../../library/typing.rst:3385 msgid "" "If ``X`` is a typing-module alias for a builtin or :mod:`collections` class, " "it will be normalized to the original class. If ``X`` is an instance of :" "class:`ParamSpecArgs` or :class:`ParamSpecKwargs`, return the underlying :" "class:`ParamSpec`. Return ``None`` for unsupported objects." msgstr "" +"``X`` が、組み込みクラスや :mod:`collections` のクラスに対する typing モ" +"ジュールのエイリアスなら、元のクラスに正規化します。\n" +"``X`` が :class:`ParamSpecArgs` または :class:`ParamSpecKwargs` のインスタン" +"スなら、元の :class:`ParamSpec` を返します。\n" +"対応していないオブジェクトでは ``None`` を返します。" #: ../../library/typing.rst:3391 ../../library/typing.rst:3415 msgid "Examples:" msgstr "例:" -#: ../../library/typing.rst:3393 msgid "" "assert get_origin(str) is None\n" "assert get_origin(Dict[str, int]) is dict\n" @@ -4971,33 +6167,46 @@ msgid "" "assert get_origin(P.args) is P\n" "assert get_origin(P.kwargs) is P" msgstr "" +"assert get_origin(str) is None\n" +"assert get_origin(Dict[str, int]) is dict\n" +"assert get_origin(Union[int, str]) is Union\n" +"assert get_origin(Annotated[str, \"metadata\"]) is Annotated\n" +"P = ParamSpec('P')\n" +"assert get_origin(P.args) is P\n" +"assert get_origin(P.kwargs) is P" -#: ../../library/typing.rst:3407 msgid "" "Get type arguments with all substitutions performed: for a typing object of " "the form ``X[Y, Z, ...]`` return ``(Y, Z, ...)``." msgstr "" +"すべての代入を適用した型引数を取得します。\n" +"``X[Y, Z, ...]`` の形式の型付けオブジェクトに対して ``(Y, Z, ...)`` を返しま" +"す。" -#: ../../library/typing.rst:3410 msgid "" "If ``X`` is a union or :class:`Literal` contained in another generic type, " "the order of ``(Y, Z, ...)`` may be different from the order of the original " "arguments ``[Y, Z, ...]`` due to type caching. Return ``()`` for unsupported " "objects." msgstr "" +"``X`` が他のジェネリック型の中に含まれるユニオンまたは :class:`Literal` の場" +"合、型のキャッシュにより、\n" +"``(Y, Z, ...)`` の順序が元の引数 ``[Y, Z, ...]`` の順序と異なる場合がありま" +"す。\n" +"対応していないオブジェクトでは ``()`` を返します。" -#: ../../library/typing.rst:3417 msgid "" "assert get_args(int) == ()\n" "assert get_args(Dict[int, str]) == (int, str)\n" "assert get_args(Union[int, str]) == (int, str)" msgstr "" +"assert get_args(int) == ()\n" +"assert get_args(Dict[int, str]) == (int, str)\n" +"assert get_args(Union[int, str]) == (int, str)" -#: ../../library/typing.rst:3427 msgid "Return the set of members defined in a :class:`Protocol`." -msgstr "" +msgstr ":class:`Protocol` に定義されたメンバーの集合を返します。" -#: ../../library/typing.rst:3429 msgid "" ">>> from typing import Protocol, get_protocol_members\n" ">>> class P(Protocol):\n" @@ -5006,14 +6215,18 @@ msgid "" ">>> get_protocol_members(P) == frozenset({'a', 'b'})\n" "True" msgstr "" +">>> from typing import Protocol, get_protocol_members\n" +">>> class P(Protocol):\n" +"... def a(self) -> str: ...\n" +"... b: int\n" +">>> get_protocol_members(P) == frozenset({'a', 'b'})\n" +"True" -#: ../../library/typing.rst:3438 msgid "Raise :exc:`TypeError` for arguments that are not Protocols." -msgstr "" +msgstr "引数がプロトコルでなければ :exc:`TypeError` を送出します。" -#: ../../library/typing.rst:3444 msgid "Determine if a type is a :class:`Protocol`." -msgstr "" +msgstr "型が :class:`Protocol` であるかどうかを判定します。" #: ../../library/typing.rst:3448 msgid "" @@ -5025,11 +6238,9 @@ msgid "" "is_protocol(int) # => False" msgstr "" -#: ../../library/typing.rst:3459 msgid "Check if a type is a :class:`TypedDict`." -msgstr "" +msgstr "型が :class:`TypedDict` であるかどうかを調べます。" -#: ../../library/typing.rst:3463 msgid "" "class Film(TypedDict):\n" " title: str\n" @@ -5042,18 +6253,30 @@ msgid "" "# not a typed dict itself\n" "assert not is_typeddict(TypedDict)" msgstr "" +"class Film(TypedDict):\n" +" title: str\n" +" year: int\n" +"\n" +"assert is_typeddict(Film)\n" +"assert not is_typeddict(list | str)\n" +"\n" +"# TypedDict は型付き辞書を作成するファクトリであり、\n" +"# それ自体が型付き辞書ではない\n" +"assert not is_typeddict(TypedDict)" -#: ../../library/typing.rst:3480 msgid "" "Class used for internal typing representation of string forward references." -msgstr "" +msgstr "文字列の前方参照を型付けの内部で表現するためのクラスです。" -#: ../../library/typing.rst:3482 msgid "" "For example, ``List[\"SomeClass\"]`` is implicitly transformed into " "``List[ForwardRef(\"SomeClass\")]``. :class:`!ForwardRef` should not be " "instantiated by a user, but may be used by introspection tools." msgstr "" +"例えば、``List[\"SomeClass\"]`` は暗黙的に " +"``List[ForwardRef(\"SomeClass\")]`` に変換されます。\n" +"利用者が :class:`!ForwardRef` を直接インスタンス化するべきではありませんが、" +"イントロスペクションツールでは利用できます。" #: ../../library/typing.rst:3487 msgid "" @@ -5062,16 +6285,20 @@ msgid "" "will not automatically resolve to ``list[SomeClass]``." msgstr "" -#: ../../library/typing.rst:3493 msgid "" "This is now an alias for :class:`annotationlib.ForwardRef`. Several " "undocumented behaviors of this class have been changed; for example, after a " "``ForwardRef`` has been evaluated, the evaluated value is no longer cached." msgstr "" +":class:`annotationlib.ForwardRef` のエイリアスになりました。\n" +"このクラスの文書化されていない挙動の一部が変更されています。\n" +"例えば、``ForwardRef`` を評価した後に、評価結果がキャッシュされなくなりまし" +"た。" -#: ../../library/typing.rst:3500 msgid "Evaluate an :class:`annotationlib.ForwardRef` as a :term:`type hint`." msgstr "" +":class:`annotationlib.ForwardRef` を :term:`型ヒント ` として評価" +"します。" #: ../../library/typing.rst:3502 msgid "" @@ -5109,13 +6336,13 @@ msgid "" "class:`annotationlib.Format` enum." msgstr "" -#: ../../library/typing.rst:3522 msgid "" "A sentinel object used to indicate that a type parameter has no default " "value. For example:" msgstr "" +"型引数にデフォルト値がないことを示すセンチネルオブジェクトです。\n" +"例えば次のように使います:" -#: ../../library/typing.rst:3525 msgid "" ">>> T = TypeVar(\"T\")\n" ">>> T.__default__ is typing.NoDefault\n" @@ -5124,6 +6351,12 @@ msgid "" ">>> S.__default__ is None\n" "True" msgstr "" +">>> T = TypeVar(\"T\")\n" +">>> T.__default__ is typing.NoDefault\n" +"True\n" +">>> S = TypeVar(\"S\", default=None)\n" +">>> S.__default__ is None\n" +"True" #: ../../library/typing.rst:3537 msgid "Constant" @@ -5172,7 +6405,6 @@ msgstr "" msgid "Deprecated aliases" msgstr "非推奨のエイリアス" -#: ../../library/typing.rst:3573 msgid "" "This module defines several deprecated aliases to pre-existing standard " "library classes. These were originally included in the :mod:`!typing` module " @@ -5180,43 +6412,57 @@ msgid "" "However, the aliases became redundant in Python 3.9 when the corresponding " "pre-existing classes were enhanced to support ``[]`` (see :pep:`585`)." msgstr "" +"このモジュールは、既存の標準ライブラリクラスに対する非推奨のエイリアスをいく" +"つか定義しています。\n" +"これらは、ジェネリッククラスを ``[]`` でパラメータ化できるようにするため、" +"元々 :mod:`!typing` モジュールに追加されました。\n" +"しかし Python 3.9 で、対応する既存クラスが ``[]`` に対応したため、エイリアス" +"は不要になりました (:pep:`585` を参照)。" -#: ../../library/typing.rst:3580 msgid "" "The redundant types are deprecated as of Python 3.9. However, while the " "aliases may be removed at some point, removal of these aliases is not " "currently planned. As such, no deprecation warnings are currently issued by " "the interpreter for these aliases." msgstr "" +"これらの不要になった型は Python 3.9 以降、非推奨です。\n" +"ただし、将来削除される可能性はあるものの、現時点では削除予定はありません。\n" +"そのため、これらのエイリアスについてインタープリタは現在、非推奨警告を出して" +"いません。" -#: ../../library/typing.rst:3585 msgid "" "If at some point it is decided to remove these deprecated aliases, a " "deprecation warning will be issued by the interpreter for at least two " "releases prior to removal. The aliases are guaranteed to remain in the :mod:" "`!typing` module without deprecation warnings until at least Python 3.14." msgstr "" +"将来、これらの非推奨エイリアスを削除すると決まった場合は、削除の少なくとも 2 " +"リリース前からインタープリタが非推奨警告を出すことになります。\n" +"少なくとも Python 3.14 までは、非推奨警告なしで :mod:`!typing` モジュールに残" +"ることが保証されています。" -#: ../../library/typing.rst:3590 msgid "" "Type checkers are encouraged to flag uses of the deprecated types if the " "program they are checking targets a minimum Python version of 3.9 or newer." msgstr "" +"検査対象のプログラムが Python 3.9 以降を最低対応バージョンとしている場合、型" +"チェッカーは非推奨の型の使用を報告することが推奨されます。" -#: ../../library/typing.rst:3596 msgid "Aliases to built-in types" -msgstr "" +msgstr "組み込み型のエイリアス" #: ../../library/typing.rst:3600 msgid "Deprecated alias to :class:`dict`." msgstr ":class:`dict` の非推奨なエイリアス。" -#: ../../library/typing.rst:3602 msgid "" "Note that to annotate arguments, it is preferred to use an abstract " "collection type such as :class:`~collections.abc.Mapping` rather than to " "use :class:`dict` or :class:`!typing.Dict`." msgstr "" +"引数のアノテーションには、:class:`dict` や :class:`!typing.Dict` よりも、:" +"class:`~collections.abc.Mapping` などの抽象コレクション型を使う方が望ましいこ" +"とに注意してください。" #: ../../library/typing.rst:3606 msgid "" @@ -5231,13 +6477,15 @@ msgstr "" msgid "Deprecated alias to :class:`list`." msgstr ":class:`list` の非推奨なエイリアス。" -#: ../../library/typing.rst:3614 msgid "" "Note that to annotate arguments, it is preferred to use an abstract " "collection type such as :class:`~collections.abc.Sequence` or :class:" "`~collections.abc.Iterable` rather than to use :class:`list` or :class:`!" "typing.List`." msgstr "" +"引数のアノテーションには、:class:`list` や :class:`!typing.List` よりも、:" +"class:`~collections.abc.Sequence` や :class:`~collections.abc.Iterable` など" +"の抽象コレクション型を使う方が望ましいことに注意してください。" #: ../../library/typing.rst:3619 msgid "" @@ -5247,16 +6495,17 @@ msgstr "" ":class:`builtins.list ` は添字表記 (``[]``) をサポートするようになりま" "した。:pep:`585` と :ref:`types-genericalias` を参照してください。" -#: ../../library/typing.rst:3625 msgid "Deprecated alias to :class:`builtins.set `." -msgstr "" +msgstr ":class:`builtins.set ` の非推奨のエイリアスです。" -#: ../../library/typing.rst:3627 msgid "" "Note that to annotate arguments, it is preferred to use an abstract " "collection type such as :class:`collections.abc.Set` rather than to use :" "class:`set` or :class:`typing.Set`." msgstr "" +"引数のアノテーションには、:class:`set` や :class:`typing.Set` よりも、:class:" +"`collections.abc.Set` などの抽象コレクション型を使う方が望ましいことに注意し" +"てください。" #: ../../library/typing.rst:3631 msgid "" @@ -5267,9 +6516,8 @@ msgstr "" "た。\n" ":pep:`585` と :ref:`types-genericalias` を参照してください。" -#: ../../library/typing.rst:3637 msgid "Deprecated alias to :class:`builtins.frozenset `." -msgstr "" +msgstr ":class:`builtins.frozenset ` の非推奨のエイリアスです。" #: ../../library/typing.rst:3639 msgid "" @@ -5284,11 +6532,12 @@ msgstr "" msgid "Deprecated alias for :class:`tuple`." msgstr ":class:`tuple` の非推奨なエイリアス。" -#: ../../library/typing.rst:3648 msgid "" ":class:`tuple` and ``Tuple`` are special-cased in the type system; see :ref:" "`annotating-tuples` for more details." msgstr "" +":class:`tuple` と ``Tuple`` は型システムで特別に扱われます。\n" +"詳細は :ref:`annotating-tuples` を参照してください。" #: ../../library/typing.rst:3651 msgid "" @@ -5303,11 +6552,12 @@ msgstr "" msgid "Deprecated alias to :class:`type`." msgstr ":class:`type` の非推奨なエイリアス。" -#: ../../library/typing.rst:3659 msgid "" "See :ref:`type-of-class-objects` for details on using :class:`type` or " "``typing.Type`` in type annotations." msgstr "" +"型アノテーションで :class:`type` や ``typing.Type`` を使う方法の詳細は、:ref:" +"`type-of-class-objects` を参照してください。" #: ../../library/typing.rst:3664 msgid "" @@ -5318,9 +6568,8 @@ msgstr "" "した。\n" ":pep:`585` と :ref:`types-genericalias` を参照してください。" -#: ../../library/typing.rst:3671 msgid "Aliases to types in :mod:`collections`" -msgstr "" +msgstr ":mod:`collections` の型のエイリアス" #: ../../library/typing.rst:3675 msgid "Deprecated alias to :class:`collections.defaultdict`." @@ -5387,9 +6636,8 @@ msgstr "" "た。\n" ":pep:`585` と :ref:`types-genericalias` を参照してください。" -#: ../../library/typing.rst:3726 msgid "Aliases to other concrete types" -msgstr "" +msgstr "その他の具象型のエイリアス" #: ../../library/typing.rst:3731 msgid "" @@ -5397,54 +6645,61 @@ msgid "" "and :func:`re.match`." msgstr "" -#: ../../library/typing.rst:3734 msgid "" "These types (and the corresponding functions) are generic over :data:" "`AnyStr`. ``Pattern`` can be specialised as ``Pattern[str]`` or " "``Pattern[bytes]``; ``Match`` can be specialised as ``Match[str]`` or " "``Match[bytes]``." msgstr "" +"これらの型 (および対応する関数) は :data:`AnyStr` を型引数とするジェネリック" +"です。\n" +"``Pattern`` は ``Pattern[str]`` または ``Pattern[bytes]`` に、``Match`` は " +"``Match[str]`` または ``Match[bytes]`` に特殊化できます。" -#: ../../library/typing.rst:3739 msgid "" "Classes ``Pattern`` and ``Match`` from :mod:`re` now support ``[]``. See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" +":mod:`re` の ``Pattern`` クラスと ``Match`` クラスが ``[]`` に対応しまし" +"た。\n" +":pep:`585` と :ref:`types-genericalias` を参照してください。" -#: ../../library/typing.rst:3745 msgid "Deprecated alias for :class:`str`." -msgstr "" +msgstr ":class:`str` の非推奨のエイリアスです。" -#: ../../library/typing.rst:3747 msgid "" "``Text`` is provided to supply a forward compatible path for Python 2 code: " "in Python 2, ``Text`` is an alias for ``unicode``." msgstr "" +"``Text`` は Python 2 のコードに前方互換性を持たせるために提供されています。\n" +"Python 2 では ``Text`` は ``unicode`` のエイリアスです。" -#: ../../library/typing.rst:3751 msgid "" "Use ``Text`` to indicate that a value must contain a unicode string in a " "manner that is compatible with both Python 2 and Python 3::" msgstr "" -"``Text`` は Python 2 と Python 3 の両方と互換性のある方法で値が unicode 文字" -"列を含んでいなければならない場合に使用してください。" +"Python 2 と Python 3 の両方に対応する形で、値が Unicode 文字列でなければなら" +"ないことを示すには ``Text`` を使います。 ::" -#: ../../library/typing.rst:3754 msgid "" "def add_unicode_checkmark(text: Text) -> Text:\n" " return text + u' \\u2713'" msgstr "" +"def add_unicode_checkmark(text: Text) -> Text:\n" +" return text + u' \\u2713'" -#: ../../library/typing.rst:3759 msgid "" "Python 2 is no longer supported, and most type checkers also no longer " "support type checking Python 2 code. Removal of the alias is not currently " "planned, but users are encouraged to use :class:`str` instead of ``Text``." msgstr "" +"Python 2 のサポートは終了しており、ほとんどの型チェッカーも Python 2 コードの" +"型チェックに対応しなくなりました。\n" +"このエイリアスの削除予定は現時点ではありませんが、``Text`` の代わりに :class:" +"`str` を使うことが推奨されます。" -#: ../../library/typing.rst:3769 msgid "Aliases to container ABCs in :mod:`collections.abc`" -msgstr "" +msgstr ":mod:`collections.abc` のコンテナ抽象基底クラスのエイリアス" #: ../../library/typing.rst:3773 msgid "Deprecated alias to :class:`collections.abc.Set`." @@ -5602,19 +6857,20 @@ msgstr "" "なりました。\n" ":pep:`585` と :ref:`types-genericalias` を参照してください。" -#: ../../library/typing.rst:3874 msgid "Aliases to asynchronous ABCs in :mod:`collections.abc`" -msgstr "" +msgstr ":mod:`collections.abc` の非同期処理用の抽象基底クラスのエイリアス" #: ../../library/typing.rst:3878 msgid "Deprecated alias to :class:`collections.abc.Coroutine`." msgstr ":class:`collections.abc.Coroutine` の非推奨なエイリアス。" -#: ../../library/typing.rst:3880 msgid "" "See :ref:`annotating-generators-and-coroutines` for details on using :class:" "`collections.abc.Coroutine` and ``typing.Coroutine`` in type annotations." msgstr "" +"型アノテーションで :class:`collections.abc.Coroutine` と ``typing." +"Coroutine`` を使う方法の詳細は、:ref:`annotating-generators-and-coroutines` " +"を参照してください。" #: ../../library/typing.rst:3886 msgid "" @@ -5629,12 +6885,14 @@ msgstr "" msgid "Deprecated alias to :class:`collections.abc.AsyncGenerator`." msgstr ":class:`collections.abc.AsyncGenerator` の非推奨なエイリアス。" -#: ../../library/typing.rst:3894 msgid "" "See :ref:`annotating-generators-and-coroutines` for details on using :class:" "`collections.abc.AsyncGenerator` and ``typing.AsyncGenerator`` in type " "annotations." msgstr "" +"型アノテーションで :class:`collections.abc.AsyncGenerator` と ``typing." +"AsyncGenerator`` を使う方法の詳細は、:ref:`annotating-generators-and-" +"coroutines` を参照してください。" #: ../../library/typing.rst:3900 msgid "" @@ -5645,9 +6903,8 @@ msgstr "" "うになりました。\n" ":pep:`585` と :ref:`types-genericalias` を参照してください。" -#: ../../library/typing.rst:3905 msgid "The ``SendType`` parameter now has a default." -msgstr "" +msgstr "``SendType`` 型引数にデフォルト値が追加されました。" #: ../../library/typing.rst:3910 msgid "Deprecated alias to :class:`collections.abc.AsyncIterable`." @@ -5688,9 +6945,8 @@ msgstr "" "りました。\n" ":pep:`585` と :ref:`types-genericalias` を参照してください。" -#: ../../library/typing.rst:3941 msgid "Aliases to other ABCs in :mod:`collections.abc`" -msgstr "" +msgstr ":mod:`collections.abc` のその他の抽象基底クラスのエイリアス" #: ../../library/typing.rst:3945 msgid "Deprecated alias to :class:`collections.abc.Iterable`." @@ -5722,11 +6978,12 @@ msgstr "" msgid "Deprecated alias to :class:`collections.abc.Callable`." msgstr ":class:`collections.abc.Callable` の非推奨なエイリアス。" -#: ../../library/typing.rst:3963 msgid "" "See :ref:`annotating-callables` for details on how to use :class:" "`collections.abc.Callable` and ``typing.Callable`` in type annotations." msgstr "" +"型アノテーションで :class:`collections.abc.Callable` と ``typing.Callable`` " +"を使う方法の詳細は、:ref:`annotating-callables` を参照してください。" #: ../../library/typing.rst:3966 msgid "" @@ -5741,11 +6998,13 @@ msgstr "" msgid "Deprecated alias to :class:`collections.abc.Generator`." msgstr ":class:`collections.abc.Generator` の非推奨なエイリアス。" -#: ../../library/typing.rst:3978 msgid "" "See :ref:`annotating-generators-and-coroutines` for details on using :class:" "`collections.abc.Generator` and ``typing.Generator`` in type annotations." msgstr "" +"型アノテーションで :class:`collections.abc.Generator` と ``typing." +"Generator`` を使う方法の詳細は、:ref:`annotating-generators-and-coroutines` " +"を参照してください。" #: ../../library/typing.rst:3982 msgid "" @@ -5756,9 +7015,8 @@ msgstr "" "りました。\n" ":pep:`585` と :ref:`types-genericalias` を参照してください。" -#: ../../library/typing.rst:3986 msgid "Default values for the send and return types were added." -msgstr "" +msgstr "送信する値の型と戻り値の型にデフォルト値が追加されました。" #: ../../library/typing.rst:3991 msgid "Deprecated alias to :class:`collections.abc.Hashable`." @@ -5789,21 +7047,23 @@ msgstr ":class:`collections.abc.Sized` の非推奨なエイリアス。" msgid "Use :class:`collections.abc.Sized` directly instead." msgstr "代わりに :class:`collections.abc.Sized` を直接使用してください。" -#: ../../library/typing.rst:4014 msgid "Aliases to :mod:`contextlib` ABCs" -msgstr "" +msgstr ":mod:`contextlib` の抽象基底クラスのエイリアス" #: ../../library/typing.rst:4018 msgid "Deprecated alias to :class:`contextlib.AbstractContextManager`." msgstr ":class:`contextlib.AbstractContextManager` の非推奨なエイリアス。" -#: ../../library/typing.rst:4020 msgid "" "The first type parameter, ``T_co``, represents the type returned by the :" "meth:`~object.__enter__` method. The optional second type parameter, " "``ExitT_co``, which defaults to ``bool | None``, represents the type " "returned by the :meth:`~object.__exit__` method." msgstr "" +"最初の型引数 ``T_co`` は、:meth:`~object.__enter__` メソッドが返す値の型を表" +"します。\n" +"省略可能な 2 番目の型引数 ``ExitT_co`` は、:meth:`~object.__exit__` メソッド" +"が返す値の型を表し、デフォルトは ``bool | None`` です。" #: ../../library/typing.rst:4027 msgid "" @@ -5814,21 +7074,23 @@ msgstr "" "ようになりました。\n" ":pep:`585` と :ref:`types-genericalias` を参照してください。" -#: ../../library/typing.rst:4032 msgid "Added the optional second type parameter, ``ExitT_co``." -msgstr "" +msgstr "省略可能な 2 番目の型引数 ``ExitT_co`` を追加しました。" #: ../../library/typing.rst:4037 msgid "Deprecated alias to :class:`contextlib.AbstractAsyncContextManager`." msgstr ":class:`contextlib.AbstractAsyncContextManager` の非推奨なエイリアス。" -#: ../../library/typing.rst:4039 msgid "" "The first type parameter, ``T_co``, represents the type returned by the :" "meth:`~object.__aenter__` method. The optional second type parameter, " "``AExitT_co``, which defaults to ``bool | None``, represents the type " "returned by the :meth:`~object.__aexit__` method." msgstr "" +"最初の型引数 ``T_co`` は、:meth:`~object.__aenter__` メソッドが返す値の型を表" +"します。\n" +"省略可能な 2 番目の型引数 ``AExitT_co`` は、:meth:`~object.__aexit__` メソッ" +"ドが返す値の型を表し、デフォルトは ``bool | None`` です。" #: ../../library/typing.rst:4046 msgid "" @@ -5839,9 +7101,8 @@ msgstr "" "トするようになりました。\n" ":pep:`585` と :ref:`types-genericalias` を参照してください。" -#: ../../library/typing.rst:4051 msgid "Added the optional second type parameter, ``AExitT_co``." -msgstr "" +msgstr "省略可能な 2 番目の型引数 ``AExitT_co`` を追加しました。" #: ../../library/typing.rst:4055 msgid "Deprecation Timeline of Major Features" @@ -5936,22 +7197,18 @@ msgstr "" msgid "3.13" msgstr "3.13" -#: ../../library/typing.rst:4086 msgid "3.15" -msgstr "" +msgstr "3.15" #: ../../library/typing.rst:4087 msgid ":gh:`106309`" msgstr "" -#: ../../library/typing.rst:4088 msgid ":data:`typing.AnyStr`" -msgstr "" +msgstr ":data:`typing.AnyStr`" -#: ../../library/typing.rst:4090 msgid "3.18" -msgstr "" +msgstr "3.18" -#: ../../library/typing.rst:4091 msgid ":gh:`105578`" -msgstr "" +msgstr ":gh:`105578`" diff --git a/library/undoc.po b/library/undoc.po index 441501c1a..e42bb4d8e 100644 --- a/library/undoc.po +++ b/library/undoc.po @@ -2,10 +2,10 @@ # Copyright (C) 2001-2021, Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. -# +# # Translators: # tomo, 2021 -# +# #, fuzzy msgid "" msgstr "" @@ -14,11 +14,12 @@ msgstr "" "POT-Creation-Date: 2021-06-29 12:56+0000\n" "PO-Revision-Date: 2021-06-28 01:16+0000\n" "Last-Translator: tomo, 2021\n" -"Language-Team: Japanese (https://www.transifex.com/python-doc/teams/5390/ja/)\n" +"Language-Team: Japanese (https://www.transifex.com/python-doc/teams/5390/" +"ja/)\n" +"Language: 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" #: ../../library/undoc.rst:5 @@ -31,15 +32,18 @@ msgid "" "should be documented. Feel free to contribute documentation for them! " "(Send via email to docs@python.org.)" msgstr "" -"現在ドキュメント化されていないが、ドキュメント化すべきモジュールを以下にざっと列挙します。どうぞこれらのドキュメントを寄稿してください! (電子メールで" -" docs@python.org に送ってください。)" +"現在ドキュメント化されていないが、ドキュメント化すべきモジュールを以下にざっ" +"と列挙します。どうぞこれらのドキュメントを寄稿してください! (電子メールで " +"docs@python.org に送ってください。)" #: ../../library/undoc.rst:11 msgid "" -"The idea and original contents for this chapter were taken from a posting by" -" Fredrik Lundh; the specific contents of this chapter have been " -"substantially revised." -msgstr "この章のアイデアと元の文章内容は Fredrik Lundh のポストによるものです; この章の特定の内容は実際には改訂されてきています。" +"The idea and original contents for this chapter were taken from a posting by " +"Fredrik Lundh; the specific contents of this chapter have been substantially " +"revised." +msgstr "" +"この章のアイデアと元の文章内容は Fredrik Lundh のポストによるものです; この章" +"の特定の内容は実際には改訂されてきています。" #: ../../library/undoc.rst:17 msgid "Platform specific modules" @@ -50,8 +54,9 @@ msgid "" "These modules are used to implement the :mod:`os.path` module, and are not " "documented beyond this mention. There's little need to document these." msgstr "" -"これらのモジュールは :mod:`os.path` " -"モジュールを実装するために用いられていますが、ここで触れる内容を超えてドキュメントされていません。これらはもう少しドキュメント化する必要があります。" +"これらのモジュールは :mod:`os.path` モジュールを実装するために用いられていま" +"すが、ここで触れる内容を超えてドキュメントされていません。これらはもう少しド" +"キュメント化する必要があります。" #: ../../library/undoc.rst:23 msgid ":mod:`ntpath`" diff --git a/library/unicodedata.po b/library/unicodedata.po index 7c0a7db8b..31a1d32de 100644 --- a/library/unicodedata.po +++ b/library/unicodedata.po @@ -20,10 +20,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/unicodedata.rst:2 @@ -205,14 +205,13 @@ msgstr "" "なわち、すべての互換文字を、等価な文字で置換します。正規形 KC (NFKC) は、互換" "分解を適用してから、標準分解を適用します。" -#: ../../library/unicodedata.rst:132 msgid "" "Even if two unicode strings are normalized and look the same to a human " "reader, if one has combining characters and the other doesn't, they may not " "compare equal." msgstr "" -"2つのunicode文字列が正規化されていて人間の目に同じに見えても、片方が結合文字" -"を持っていてもう片方が持っていない場合、それらは完全に同じではありません。" +"2 つの Unicode 文字列が正規化されていて、人間の目には同じに見えても、一方に結" +"合文字があり他方にはない場合は、比較して等しいと判定されないことがあります。" #: ../../library/unicodedata.rst:138 msgid "" diff --git a/library/unittest.mock-examples.po b/library/unittest.mock-examples.po index 17252c578..d0f2f6270 100644 --- a/library/unittest.mock-examples.po +++ b/library/unittest.mock-examples.po @@ -20,10 +20,10 @@ msgstr "" "Last-Translator: Arihiro TAKASE, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/unittest.mock-examples.rst:2 @@ -170,7 +170,6 @@ msgstr "" "に置き換えます。 ``Foo`` のインスタンスはモックを呼び出して作られるので、モッ" "クの :attr:`~Mock.return_value` を変更することでカスタマイズできます。::" -#: ../../library/unittest.mock-examples.rst:118 msgid "" ">>> def some_function():\n" "... instance = module.Foo()\n" @@ -182,6 +181,15 @@ msgid "" "... result = some_function()\n" "... assert result == 'the result'" msgstr "" +">>> def some_function():\n" +"... instance = module.Foo()\n" +"... return instance.method()\n" +"...\n" +">>> with patch('module.Foo') as mock:\n" +"... instance = mock.return_value\n" +"... instance.method.return_value = 'the result'\n" +"... result = some_function()\n" +"... assert result == 'the result'" #: ../../library/unittest.mock-examples.rst:130 msgid "Naming your mocks" @@ -231,12 +239,15 @@ msgstr "" "``mock_calls`` と比較するリストを作るために :data:`call` オブジェクトを利用で" "きます:" -#: ../../library/unittest.mock-examples.rst:170 msgid "" "However, parameters to calls that return mocks are not recorded, which means " "it is not possible to track nested calls where the parameters used to create " "ancestors are important:" msgstr "" +"ただし、モックを返す呼び出しの引数は、その後の入れ子の呼び出しには記録されま" +"せん。\n" +"そのため、祖先を作成した呼び出しの引数が重要な場合、その情報を含めて入れ子の" +"呼び出しを追跡することはできません。" #: ../../library/unittest.mock-examples.rst:181 msgid "Setting Return Values and Attributes" @@ -391,16 +402,14 @@ msgstr "" "AttributeError を発生させます。定義となるクラスの実装を変更した場合、テストの" "中でそのクラスをインスタンス化させなくても、テストを失敗させる事ができます。" -#: ../../library/unittest.mock-examples.rst:344 msgid "" "Using a specification also enables a smarter matching of calls made to the " "mock, regardless of whether some parameters were passed as positional or " "named arguments::" msgstr "" -"また、定義を指定することで、パラメータが位置引数と名前付き引数のどちらで渡さ" -"れたかに関わらず、モックへの呼び出しをよりスマートに照合することができます。" +"spec を指定すると、モックへの呼び出しをより柔軟に照合でき、引数が位置引数とし" +"て渡されたか、名前を指定して渡されたかを問いません。 ::" -#: ../../library/unittest.mock-examples.rst:348 msgid "" ">>> def f(a, b, c): pass\n" "...\n" @@ -409,6 +418,12 @@ msgid "" "\n" ">>> mock.assert_called_with(a=1, b=2, c=3)" msgstr "" +">>> def f(a, b, c): pass\n" +"...\n" +">>> mock = Mock(spec=f)\n" +">>> mock(1, 2, 3)\n" +"\n" +">>> mock.assert_called_with(a=1, b=2, c=3)" #: ../../library/unittest.mock-examples.rst:355 msgid "" @@ -427,18 +442,19 @@ msgstr "" "任意の属性の参照だけでなく代入も禁止するより強い定義を利用したい場合は、" "*spec* の代わりに *spec_set* を使います。" -#: ../../library/unittest.mock-examples.rst:364 msgid "Using side_effect to return per file content" -msgstr "" +msgstr "side_effect でファイルごとに異なる内容を返す" -#: ../../library/unittest.mock-examples.rst:366 msgid "" ":func:`mock_open` is used to patch :func:`open` method. :attr:`~Mock." "side_effect` can be used to return a new Mock object per call. This can be " "used to return different contents per file stored in a dictionary::" msgstr "" +":func:`mock_open` は :func:`open` にパッチを適用するために使います。\n" +":attr:`~Mock.side_effect` を使うと、呼び出しのたびに新しい Mock オブジェクト" +"を返せます。\n" +"これを利用して、辞書に保存した異なる内容をファイルごとに返せます。 ::" -#: ../../library/unittest.mock-examples.rst:370 msgid "" "DEFAULT = \"default\"\n" "data_dict = {\"file1\": \"data1\",\n" @@ -457,6 +473,22 @@ msgid "" " with open(\"file3\") as file2:\n" " assert file2.read() == \"default\"" msgstr "" +"DEFAULT = \"default\"\n" +"data_dict = {\"file1\": \"data1\",\n" +" \"file2\": \"data2\"}\n" +"\n" +"def open_side_effect(name):\n" +" return mock_open(read_data=data_dict.get(name, DEFAULT))()\n" +"\n" +"with patch(\"builtins.open\", side_effect=open_side_effect):\n" +" with open(\"file1\") as file1:\n" +" assert file1.read() == \"data1\"\n" +"\n" +" with open(\"file2\") as file2:\n" +" assert file2.read() == \"data2\"\n" +"\n" +" with open(\"file3\") as file2:\n" +" assert file2.read() == \"default\"" #: ../../library/unittest.mock-examples.rst:389 msgid "Patch Decorators" @@ -469,8 +501,7 @@ msgid "" "read :ref:`where to patch `." msgstr "" ":func:`patch` では探索される名前空間内のオブジェクトにパッチをあてることが重" -"要です。通常は単純ですが、クイックガイドには :ref:`where-to-patch` を読んでく" -"ださい。" +"要です。通常は単純ですが、詳しくは :ref:`where-to-patch` を参照してください。" #: ../../library/unittest.mock-examples.rst:398 msgid "" @@ -507,7 +538,6 @@ msgstr "" msgid "``patch.object``::" msgstr "``patch.object``::" -#: ../../library/unittest.mock-examples.rst:414 msgid "" ">>> original = SomeClass.attribute\n" ">>> @patch.object(SomeClass, 'attribute', sentinel.attribute)\n" @@ -524,6 +554,20 @@ msgid "" "...\n" ">>> test()" msgstr "" +">>> original = SomeClass.attribute\n" +">>> @patch.object(SomeClass, 'attribute', sentinel.attribute)\n" +"... def test():\n" +"... assert SomeClass.attribute == sentinel.attribute\n" +"...\n" +">>> test()\n" +">>> assert SomeClass.attribute == original\n" +"\n" +">>> @patch('package.module.attribute', sentinel.attribute)\n" +"... def test():\n" +"... from package.module import attribute\n" +"... assert attribute is sentinel.attribute\n" +"...\n" +">>> test()" #: ../../library/unittest.mock-examples.rst:429 msgid "" @@ -540,7 +584,6 @@ msgstr "" "モジュール名は必要に応じて ``package.module`` のようにドットを含むことができ" "ます::" -#: ../../library/unittest.mock-examples.rst:441 msgid "" ">>> @patch('package.module.ClassName.attribute', sentinel.attribute)\n" "... def test():\n" @@ -549,6 +592,12 @@ msgid "" "...\n" ">>> test()" msgstr "" +">>> @patch('package.module.ClassName.attribute', sentinel.attribute)\n" +"... def test():\n" +"... from package.module import ClassName\n" +"... assert ClassName.attribute == sentinel.attribute\n" +"...\n" +">>> test()" #: ../../library/unittest.mock-examples.rst:448 msgid "A nice pattern is to actually decorate test methods themselves:" @@ -568,7 +617,6 @@ msgstr "" msgid "You can stack up multiple patch decorators using this pattern::" msgstr "次のパターンのように patch デコレータを重ねることができます::" -#: ../../library/unittest.mock-examples.rst:473 msgid "" ">>> class MyTest(unittest.TestCase):\n" "... @patch('package.module.ClassName1')\n" @@ -579,6 +627,14 @@ msgid "" "...\n" ">>> MyTest('test_something').test_something()" msgstr "" +">>> class MyTest(unittest.TestCase):\n" +"... @patch('package.module.ClassName1')\n" +"... @patch('package.module.ClassName2')\n" +"... def test_something(self, MockClass2, MockClass1):\n" +"... self.assertIs(package.module.ClassName1, MockClass1)\n" +"... self.assertIs(package.module.ClassName2, MockClass2)\n" +"...\n" +">>> MyTest('test_something').test_something()" #: ../../library/unittest.mock-examples.rst:482 msgid "" @@ -707,11 +763,12 @@ msgstr "" "するモックの response オブジェクトを作成します。最終的な ``start_call`` の返" "り値として response をセットすると、このようにすることができます::" -#: ../../library/unittest.mock-examples.rst:573 msgid "" "mock_backend.get_endpoint.return_value.create_call.return_value.start_call." "return_value = mock_response" msgstr "" +"mock_backend.get_endpoint.return_value.create_call.return_value.start_call." +"return_value = mock_response" #: ../../library/unittest.mock-examples.rst:575 msgid "" @@ -739,11 +796,12 @@ msgstr "" "これらによって「モックの backend」をその場で monkey patch して、実際の呼び出" "しを行うことができます::" -#: ../../library/unittest.mock-examples.rst:587 msgid "" ">>> something.backend = mock_backend\n" ">>> something.method()" msgstr "" +">>> something.backend = mock_backend\n" +">>> something.method()" #: ../../library/unittest.mock-examples.rst:590 msgid "" @@ -758,13 +816,16 @@ msgstr "" "リーがあるでしょう。 :meth:`call.call_list` を使用することで、この呼び出しの" "リストを作成することができます::" -#: ../../library/unittest.mock-examples.rst:595 msgid "" ">>> chained = call.get_endpoint('foobar').create_call('spam', 'eggs')." "start_call()\n" ">>> call_list = chained.call_list()\n" ">>> assert mock_backend.mock_calls == call_list" msgstr "" +">>> chained = call.get_endpoint('foobar').create_call('spam', 'eggs')." +"start_call()\n" +">>> call_list = chained.call_list()\n" +">>> assert mock_backend.mock_calls == call_list" #: ../../library/unittest.mock-examples.rst:601 msgid "Partial mocking" @@ -902,7 +963,6 @@ msgstr "" "するには、``foo.iter()`` の呼び出しで返されるオブジェクトを設定する必要があ" "る。" -#: ../../library/unittest.mock-examples.rst:675 msgid "" "There are also generator expressions and more `advanced uses `_ of generators, but we aren't concerned " @@ -910,7 +970,7 @@ msgid "" "they are is: `Generator Tricks for Systems Programmers `_." msgstr "" -"ジェネレータ式やジェネレータのより`高度な使い方 `_ もありますが、ここではそれらについては触れません。" "ジェネレータとその強力さについての非常に良い紹介記事があります: `Generator " "Tricks for Systems Programmers `_。" @@ -919,7 +979,6 @@ msgstr "" msgid "Applying the same patch to every test method" msgstr "同じパッチを全てのメソッドに適用する" -#: ../../library/unittest.mock-examples.rst:685 msgid "" "If you want several patches in place for multiple test methods the obvious " "way is to apply the patch decorators to every method. This can feel like " @@ -928,14 +987,13 @@ msgid "" "methods on the class. A test method is identified by methods whose names " "start with ``test``::" msgstr "" -"複数のテストメソッドに複数のパッチを適用したい場合、当然のことながらすべての" -"メソッドにパッチデコレータを適用することになります。これは不要な繰り返しのよ" -"うに感じられます。代わりに、(あらゆる形態の) :func:`patch` をクラスデコレータ" -"として使用することができます。これはそのクラスのすべてのテストメソッドにパッ" -"チを適用します。テストメソッドは名前が ``test`` で始まるメソッドで識別されま" -"す。" +"複数のテストメソッドに複数のパッチを適用するには、各メソッドに patch デコレー" +"タを付ける方法が考えられますが、同じ記述を繰り返すことになります。\n" +"代わりに :func:`patch` (およびその各種の形式) をクラスデコレータとして使えま" +"す。\n" +"これにより、クラス内のすべてのテストメソッドにパッチを適用します。\n" +"名前が ``test`` で始まるメソッドをテストメソッドとみなします。 ::" -#: ../../library/unittest.mock-examples.rst:692 msgid "" ">>> @patch('mymodule.SomeClass')\n" "... class MyTest(unittest.TestCase):\n" @@ -954,18 +1012,32 @@ msgid "" ">>> MyTest('test_two').not_a_test()\n" "'something'" msgstr "" +">>> @patch('mymodule.SomeClass')\n" +"... class MyTest(unittest.TestCase):\n" +"...\n" +"... def test_one(self, MockSomeClass):\n" +"... self.assertIs(mymodule.SomeClass, MockSomeClass)\n" +"...\n" +"... def test_two(self, MockSomeClass):\n" +"... self.assertIs(mymodule.SomeClass, MockSomeClass)\n" +"...\n" +"... def not_a_test(self):\n" +"... return 'something'\n" +"...\n" +">>> MyTest('test_one').test_one()\n" +">>> MyTest('test_two').test_two()\n" +">>> MyTest('test_two').not_a_test()\n" +"'something'" -#: ../../library/unittest.mock-examples.rst:709 msgid "" "An alternative way of managing patches is to use the :ref:`start-and-stop`. " "These allow you to move the patching into your ``setUp`` and ``tearDown`` " "methods. ::" msgstr "" -"パッチを管理する別の方法として、:ref:`start-and-stop`.を使用する方法がありま" -"す。これらを使うと、パッチを ``setUp`` と``tearDown``メソッドに移すことができ" -"ます。" +"パッチを管理する別の方法として :ref:`start-and-stop` も使えます。\n" +"これらを使うと、パッチを適用・解除する処理を ``setUp`` メソッドと " +"``tearDown`` メソッドに移せます。 ::" -#: ../../library/unittest.mock-examples.rst:713 msgid "" ">>> class MyTest(unittest.TestCase):\n" "... def setUp(self):\n" @@ -980,6 +1052,18 @@ msgid "" "...\n" ">>> MyTest('test_foo').run()" msgstr "" +">>> class MyTest(unittest.TestCase):\n" +"... def setUp(self):\n" +"... self.patcher = patch('mymodule.foo')\n" +"... self.mock_foo = self.patcher.start()\n" +"...\n" +"... def test_foo(self):\n" +"... self.assertIs(mymodule.foo, self.mock_foo)\n" +"...\n" +"... def tearDown(self):\n" +"... self.patcher.stop()\n" +"...\n" +">>> MyTest('test_foo').run()" #: ../../library/unittest.mock-examples.rst:726 msgid "" @@ -993,7 +1077,6 @@ msgstr "" "は意外に面倒です。 :meth:`unittest.TestCase.addCleanup` を使うと簡単にできま" "す::" -#: ../../library/unittest.mock-examples.rst:731 msgid "" ">>> class MyTest(unittest.TestCase):\n" "... def setUp(self):\n" @@ -1006,6 +1089,16 @@ msgid "" "...\n" ">>> MyTest('test_foo').run()" msgstr "" +">>> class MyTest(unittest.TestCase):\n" +"... def setUp(self):\n" +"... patcher = patch('mymodule.foo')\n" +"... self.addCleanup(patcher.stop)\n" +"... self.mock_foo = patcher.start()\n" +"...\n" +"... def test_foo(self):\n" +"... self.assertIs(mymodule.foo, self.mock_foo)\n" +"...\n" +">>> MyTest('test_foo').run()" #: ../../library/unittest.mock-examples.rst:744 msgid "Mocking Unbound Methods" @@ -1057,12 +1150,14 @@ msgstr "" "モックには、モックオブジェクトがどのように使用されるかをアサートするための素" "晴らしいAPIがあります。" -#: ../../library/unittest.mock-examples.rst:792 msgid "" "If your mock is only being called once you can use the :meth:`~Mock." "assert_called_once_with` method that also asserts that the :attr:`~Mock." "call_count` is one." msgstr "" +"モックが一度だけ呼び出されるなら、:meth:`~Mock.assert_called_once_with` メ" +"ソッドを使えます。\n" +"このメソッドは :attr:`~Mock.call_count` が 1 であることもアサートします。" #: ../../library/unittest.mock-examples.rst:804 msgid "" @@ -1076,7 +1171,6 @@ msgstr "" "呼び出しに対してアサートしたい場合には :attr:`~Mock.call_args_list` を使用す" "ることができます:" -#: ../../library/unittest.mock-examples.rst:816 msgid "" "The :data:`call` helper makes it easy to make assertions about these calls. " "You can build up a list of expected calls and compare it to " @@ -1084,14 +1178,13 @@ msgid "" "``call_args_list``:" msgstr "" ":data:`call` ヘルパーを使えば、これらの呼び出しについて簡単にアサートすること" -"ができます。予想される呼び出しのリストを作成し、それを``call_args_list``と比" -"較することができます。これは``call_args_list``のreprと驚くほど似ています:" +"ができます。予想される呼び出しのリストを作成し、それを ``call_args_list`` と" +"比較することができます。これは ``call_args_list`` のreprと驚くほど似ています:" #: ../../library/unittest.mock-examples.rst:826 msgid "Coping with mutable arguments" msgstr "ミュータブルな引数に対処する" -#: ../../library/unittest.mock-examples.rst:828 msgid "" "Another situation is rare, but can bite you, is when your mock is called " "with mutable arguments. ``call_args`` and ``call_args_list`` store " @@ -1100,17 +1193,17 @@ msgid "" "when the mock was called." msgstr "" "稀ではありますが、問題となることがあるのはミュータブルな引数でモックが呼び出" -"された場合です。``call_args`` や``call_args_list`` は引数への*参照*を保存しま" -"す。もしテスト対象のコードによって引数が変更されてしまうと、モックが呼び出さ" -"れた時の値をアサートすることはできなくなります。" +"された場合です。``call_args`` や ``call_args_list`` は引数への*参照*を保存し" +"ます。もしテスト対象のコードによって引数が変更されてしまうと、モックが呼び出" +"された時の値をアサートすることはできなくなります。" -#: ../../library/unittest.mock-examples.rst:833 msgid "" "Here's some example code that shows the problem. Imagine the following " "functions defined in 'mymodule'::" -msgstr "この問題を示すサンプルコードを示します。" +msgstr "" +"この問題を示すコード例を見てみましょう。\n" +"次の関数が「mymodule」に定義されているとします。 ::" -#: ../../library/unittest.mock-examples.rst:836 msgid "" "def frob(val):\n" " pass\n" @@ -1120,14 +1213,20 @@ msgid "" " frob(val)\n" " val.clear()" msgstr "" +"def frob(val):\n" +" pass\n" +"\n" +"def grob(val):\n" +" \"まず frob を呼び出し、その後 val を空にする。\"\n" +" frob(val)\n" +" val.clear()" -#: ../../library/unittest.mock-examples.rst:844 msgid "" "When we try to test that ``grob`` calls ``frob`` with the correct argument " "look what happens::" msgstr "" -"``grob`` が``frob``を正しい引数で呼び出していることをテストしようとすると何が" -"起こるか見てみましょう::" +"``grob`` が ``frob`` を正しい引数で呼び出していることをテストしようとすると何" +"が起こるか見てみましょう::" #: ../../library/unittest.mock-examples.rst:847 msgid "" @@ -1165,7 +1264,6 @@ msgid "" "me. ::" msgstr "" -#: ../../library/unittest.mock-examples.rst:871 msgid "" ">>> from copy import deepcopy\n" ">>> from unittest.mock import Mock, patch, DEFAULT\n" @@ -1188,6 +1286,26 @@ msgid "" ">>> new_mock.call_args\n" "call({6})" msgstr "" +">>> from copy import deepcopy\n" +">>> from unittest.mock import Mock, patch, DEFAULT\n" +">>> def copy_call_args(mock):\n" +"... new_mock = Mock()\n" +"... def side_effect(*args, **kwargs):\n" +"... args = deepcopy(args)\n" +"... kwargs = deepcopy(kwargs)\n" +"... new_mock(*args, **kwargs)\n" +"... return DEFAULT\n" +"... mock.side_effect = side_effect\n" +"... return new_mock\n" +"...\n" +">>> with patch('mymodule.frob') as mock_frob:\n" +"... new_mock = copy_call_args(mock_frob)\n" +"... val = {6}\n" +"... mymodule.grob(val)\n" +"...\n" +">>> new_mock.assert_called_with({6})\n" +">>> new_mock.call_args\n" +"call({6})" #: ../../library/unittest.mock-examples.rst:892 msgid "" @@ -1199,15 +1317,14 @@ msgstr "" "関数はアサーションで使用するための新しいモックを返します。``side_effect`` 関" "数は引数のコピーを作成し、そのコピーを使って ``new_mock`` を呼び出します。" -#: ../../library/unittest.mock-examples.rst:898 msgid "" "If your mock is only going to be used once there is an easier way of " "checking arguments at the point they are called. You can simply do the " "checking inside a ``side_effect`` function." msgstr "" "もしモックが一度しか使われないのであれば、呼び出された時点で引数をチェックす" -"る簡単な方法があります。単純に``side_effect``関数の中でチェックを行えばいいの" -"です。" +"る簡単な方法があります。単純に ``side_effect`` 関数の中でチェックを行えばいい" +"のです。" #: ../../library/unittest.mock-examples.rst:912 msgid "" @@ -1219,26 +1336,28 @@ msgstr "" "class:`Mock` や :class:`MagicMock` のサブクラスを作成する方法があります。以下" "に実装例を示します。" -#: ../../library/unittest.mock-examples.rst:937 msgid "" "When you subclass ``Mock`` or ``MagicMock`` all dynamically created " "attributes, and the ``return_value`` will use your subclass automatically. " "That means all children of a ``CopyingMock`` will also have the type " "``CopyingMock``." msgstr "" +"``Mock`` または ``MagicMock`` をサブクラス化すると、動的に作成されるすべての" +"属性と ``return_value`` に、自動的にそのサブクラスが使われます。\n" +"従って、``CopyingMock`` の子モックもすべて ``CopyingMock`` 型になります。" #: ../../library/unittest.mock-examples.rst:943 msgid "Nesting Patches" msgstr "patch をネストする" -#: ../../library/unittest.mock-examples.rst:945 msgid "" "Using patch as a context manager is nice, but if you do multiple patches you " "can end up with nested with statements indenting further and further to the " "right::" msgstr "" +"patch をコンテキストマネージャとして使うと便利ですが、複数のパッチを適用する" +"と with 文が入れ子になり、インデントが次第に深くなります。 ::" -#: ../../library/unittest.mock-examples.rst:949 msgid "" ">>> class MyTest(unittest.TestCase):\n" "...\n" @@ -1254,16 +1373,31 @@ msgid "" ">>> MyTest('test_foo').test_foo()\n" ">>> assert mymodule.Foo is original" msgstr "" +">>> class MyTest(unittest.TestCase):\n" +"...\n" +"... def test_foo(self):\n" +"... with patch('mymodule.Foo') as mock_foo:\n" +"... with patch('mymodule.Bar') as mock_bar:\n" +"... with patch('mymodule.Spam') as mock_spam:\n" +"... assert mymodule.Foo is mock_foo\n" +"... assert mymodule.Bar is mock_bar\n" +"... assert mymodule.Spam is mock_spam\n" +"...\n" +">>> original = mymodule.Foo\n" +">>> MyTest('test_foo').test_foo()\n" +">>> assert mymodule.Foo is original" -#: ../../library/unittest.mock-examples.rst:963 msgid "" "With unittest ``cleanup`` functions and the :ref:`start-and-stop` we can " "achieve the same effect without the nested indentation. A simple helper " "method, ``create_patch``, puts the patch in place and returns the created " "mock for us::" msgstr "" +"unittest の ``cleanup`` 関数と :ref:`start-and-stop` を使うと、インデントを入" +"れ子にせず同じことを実現できます。\n" +"単純なヘルパーメソッド ``create_patch`` で、パッチを適用して作成したモックを" +"返します。 ::" -#: ../../library/unittest.mock-examples.rst:968 msgid "" ">>> class MyTest(unittest.TestCase):\n" "...\n" @@ -1286,75 +1420,109 @@ msgid "" ">>> MyTest('test_foo').run()\n" ">>> assert mymodule.Foo is original" msgstr "" +">>> class MyTest(unittest.TestCase):\n" +"...\n" +"... def create_patch(self, name):\n" +"... patcher = patch(name)\n" +"... thing = patcher.start()\n" +"... self.addCleanup(patcher.stop)\n" +"... return thing\n" +"...\n" +"... def test_foo(self):\n" +"... mock_foo = self.create_patch('mymodule.Foo')\n" +"... mock_bar = self.create_patch('mymodule.Bar')\n" +"... mock_spam = self.create_patch('mymodule.Spam')\n" +"...\n" +"... assert mymodule.Foo is mock_foo\n" +"... assert mymodule.Bar is mock_bar\n" +"... assert mymodule.Spam is mock_spam\n" +"...\n" +">>> original = mymodule.Foo\n" +">>> MyTest('test_foo').run()\n" +">>> assert mymodule.Foo is original" #: ../../library/unittest.mock-examples.rst:991 msgid "Mocking a dictionary with MagicMock" msgstr "MagicMock で辞書をモックする" -#: ../../library/unittest.mock-examples.rst:993 msgid "" "You may want to mock a dictionary, or other container object, recording all " "access to it whilst having it still behave like a dictionary." msgstr "" +"辞書や他のコンテナをモックに置き換え、辞書としての振る舞いを保ちながら、すべ" +"てのアクセスを記録したい場合があります。" -#: ../../library/unittest.mock-examples.rst:996 msgid "" "We can do this with :class:`MagicMock`, which will behave like a dictionary, " "and using :data:`~Mock.side_effect` to delegate dictionary access to a real " "underlying dictionary that is under our control." msgstr "" +":class:`MagicMock` を辞書のように振る舞わせ、:data:`~Mock.side_effect` で辞書" +"へのアクセスを、自分で管理する本物の辞書に委譲すると実現できます。" -#: ../../library/unittest.mock-examples.rst:1000 msgid "" "When the :meth:`~object.__getitem__` and :meth:`~object.__setitem__` methods " "of our ``MagicMock`` are called (normal dictionary access) then " "``side_effect`` is called with the key (and in the case of ``__setitem__`` " "the value too). We can also control what is returned." msgstr "" +"``MagicMock`` の :meth:`~object.__getitem__` メソッドや :meth:`~object." +"__setitem__` メソッドが呼び出されると (通常の辞書アクセス)、\n" +"``side_effect`` にキーが渡されます (``__setitem__`` の場合は値も渡されま" +"す)。\n" +"戻り値も制御できます。" -#: ../../library/unittest.mock-examples.rst:1005 msgid "" "After the ``MagicMock`` has been used we can use attributes like :data:" "`~Mock.call_args_list` to assert about how the dictionary was used:" msgstr "" +"``MagicMock`` を使った後、:data:`~Mock.call_args_list` などの属性で、辞書がど" +"う使われたかをアサートできます。" -#: ../../library/unittest.mock-examples.rst:1021 msgid "" "An alternative to using ``MagicMock`` is to use ``Mock`` and *only* provide " "the magic methods you specifically want:" msgstr "" +"``MagicMock`` の代わりに ``Mock`` を使い、必要な特殊メソッド *だけ* を用意す" +"ることもできます。" -#: ../../library/unittest.mock-examples.rst:1028 msgid "" "A *third* option is to use ``MagicMock`` but passing in ``dict`` as the " "*spec* (or *spec_set*) argument so that the ``MagicMock`` created only has " "dictionary magic methods available:" msgstr "" +"*3 つ目* の方法は、``MagicMock`` の *spec* (または *spec_set*) 引数に " +"``dict`` を渡すことです。\n" +"これにより、作成した ``MagicMock`` で使える特殊メソッドを辞書のものだけに制限" +"できます。" -#: ../../library/unittest.mock-examples.rst:1036 msgid "" "With these side effect functions in place, the ``mock`` will behave like a " "normal dictionary but recording the access. It even raises a :exc:`KeyError` " "if you try to access a key that doesn't exist." msgstr "" +"これらの side_effect 関数を設定すると、``mock`` は通常の辞書のように振る舞い" +"ながらアクセスを記録します。\n" +"存在しないキーにアクセスしようとすると、:exc:`KeyError` も送出します。" -#: ../../library/unittest.mock-examples.rst:1055 msgid "" "After it has been used you can make assertions about the access using the " "normal mock methods and attributes:" msgstr "" +"使用後は、通常のモックのメソッドと属性を使ってアクセスをアサートできます。" #: ../../library/unittest.mock-examples.rst:1067 msgid "Mock subclasses and their attributes" msgstr "Mock のサブクラスと属性" -#: ../../library/unittest.mock-examples.rst:1069 msgid "" "There are various reasons why you might want to subclass :class:`Mock`. One " "reason might be to add helper methods. Here's a silly example:" msgstr "" +":class:`Mock` をサブクラス化したい理由はいろいろあります。\n" +"例えばヘルパーメソッドを追加するためです。\n" +"単純な例を見てみましょう。" -#: ../../library/unittest.mock-examples.rst:1085 msgid "" "The standard behaviour for ``Mock`` instances is that attributes and the " "return value mocks are of the same type as the mock they are accessed on. " @@ -1363,16 +1531,26 @@ msgid "" "methods then they'll also be available on the attributes and return value " "mock of instances of your subclass." msgstr "" +"``Mock`` インスタンスの標準的な振る舞いでは、属性と戻り値のモックは、それらに" +"アクセスした元のモックと同じ型になります。\n" +"このため、``Mock`` の属性は ``Mock``、``MagicMock`` の属性は ``MagicMock`` に" +"なります [#]_。\n" +"従って、サブクラス化してヘルパーメソッドを追加すると、\n" +"そのサブクラスのインスタンスの属性や戻り値のモックでもヘルパーメソッドを使え" +"ます。" -#: ../../library/unittest.mock-examples.rst:1101 msgid "" "Sometimes this is inconvenient. For example, `one user `_ is subclassing mock to created a `Twisted " "adaptor `_. Having this applied to attributes too actually causes errors." msgstr "" +"これが不便な場合もあります。\n" +"例えば、`ある利用者 `_ " +"は、モックをサブクラス化して `Twisted アダプター `_ を作成しています。\n" +"そのサブクラスが属性にも使われると、エラーが起きてしまいます。" -#: ../../library/unittest.mock-examples.rst:1107 msgid "" "``Mock`` (in all its flavours) uses a method called ``_get_child_mock`` to " "create these \"sub-mocks\" for attributes and return values. You can prevent " @@ -1380,26 +1558,37 @@ msgid "" "signature is that it takes arbitrary keyword arguments (``**kwargs``) which " "are then passed onto the mock constructor:" msgstr "" +"``Mock`` (およびその各種のクラス) は、属性や戻り値の「子モック」を作成するた" +"めに ``_get_child_mock`` メソッドを使います。\n" +"このメソッドをオーバーライドすると、属性に自分のサブクラスが使われるのを防げ" +"ます。\n" +"シグネチャは任意のキーワード引数 (``**kwargs``) を受け取り、それらをモックの" +"コンストラクタに渡す形です。" -#: ../../library/unittest.mock-examples.rst:1124 msgid "" "An exception to this rule are the non-callable mocks. Attributes use the " "callable variant because otherwise non-callable mocks couldn't have callable " "methods." msgstr "" +"この規則の例外は、呼び出し不可能なモックです。\n" +"属性には呼び出し可能なクラスを使います。\n" +"そうしないと、呼び出し不可能なモックに呼び出し可能なメソッドを持たせられない" +"ためです。" #: ../../library/unittest.mock-examples.rst:1130 msgid "Mocking imports with patch.dict" msgstr "patch.dict で import をモックする" -#: ../../library/unittest.mock-examples.rst:1132 msgid "" "One situation where mocking can be hard is where you have a local import " "inside a function. These are harder to mock because they aren't using an " "object from the module namespace that we can patch out." msgstr "" +"モックへの置き換えが難しくなる状況の 1 つが、関数内でローカルにインポートして" +"いる場合です。\n" +"パッチで置き換えられるモジュールの名前空間のオブジェクトを使っていないため、" +"置き換えにくくなります。" -#: ../../library/unittest.mock-examples.rst:1136 msgid "" "Generally local imports are to be avoided. They are sometimes done to " "prevent circular dependencies, for which there is *usually* a much better " @@ -1408,8 +1597,15 @@ msgid "" "an unconditional local import (store the module as a class or module " "attribute and only do the import on first use)." msgstr "" +"一般に、ローカルなインポートは避ける方がよいでしょう。\n" +"循環依存を防ぐために使われることもありますが、*通常は* コードをリファクタリン" +"グするという、もっとよい解決策があります。\n" +"また、インポートを遅らせて「初期コスト」を避けるために使われることもありま" +"す。\n" +"これも無条件のローカルなインポートよりよい方法で解決できます\n" +"(モジュールをクラスやモジュールの属性に保存し、最初に使うときだけインポートし" +"ます)。" -#: ../../library/unittest.mock-examples.rst:1143 msgid "" "That aside there is a way to use ``mock`` to affect the results of an " "import. Importing fetches an *object* from the :data:`sys.modules` " @@ -1418,8 +1614,13 @@ msgid "" "in ``sys.modules``, so usually when you import something you get a module " "back. This need not be the case however." msgstr "" +"その点はさておき、``mock`` を使ってインポートの結果を変える方法があります。\n" +"インポートは :data:`sys.modules` 辞書から *オブジェクト* を取得します。\n" +"取得するのは *オブジェクト* であって、モジュールとは限りません。\n" +"モジュールを初めてインポートするとモジュールオブジェクトが ``sys.modules`` に" +"格納されるため、通常はインポートするとモジュールが得られます。\n" +"しかし、必ずしもそうである必要はありません。" -#: ../../library/unittest.mock-examples.rst:1150 msgid "" "This means you can use :func:`patch.dict` to *temporarily* put a mock in " "place in :data:`sys.modules`. Any imports whilst this patch is active will " @@ -1427,59 +1628,69 @@ msgid "" "the with statement body is complete or ``patcher.stop()`` is called) then " "whatever was there previously will be restored safely." msgstr "" +"つまり、:func:`patch.dict` を使って :data:`sys.modules` に *一時的に* モック" +"を配置できます。\n" +"パッチが有効な間にそのモジュールをインポートすると、モックが取得されます。\n" +"パッチが終了すると (デコレートした関数が終了する、with 文の本体が完了する、ま" +"たは ``patcher.stop()`` が呼ばれると)、以前の内容が安全に復元されます。" -#: ../../library/unittest.mock-examples.rst:1156 msgid "Here's an example that mocks out the 'fooble' module." -msgstr "" +msgstr "「fooble」モジュールをモックに置き換える例です。" -#: ../../library/unittest.mock-examples.rst:1168 msgid "" "As you can see the ``import fooble`` succeeds, but on exit there is no " "'fooble' left in :data:`sys.modules`." msgstr "" +"このように ``import fooble`` は成功しますが、終了時には :data:`sys.modules` " +"に「fooble」は残っていません。" -#: ../../library/unittest.mock-examples.rst:1171 msgid "This also works for the ``from module import name`` form:" -msgstr "" +msgstr "``from module import name`` の形式でも同じように動作します。" -#: ../../library/unittest.mock-examples.rst:1181 msgid "With slightly more work you can also mock package imports:" -msgstr "" +msgstr "少し手を加えると、パッケージのインポートもモックに置き換えられます。" -#: ../../library/unittest.mock-examples.rst:1194 msgid "Tracking order of calls and less verbose call assertions" -msgstr "" +msgstr "呼び出し順序の追跡と簡潔な呼び出しのアサート" -#: ../../library/unittest.mock-examples.rst:1196 msgid "" "The :class:`Mock` class allows you to track the *order* of method calls on " "your mock objects through the :attr:`~Mock.method_calls` attribute. This " "doesn't allow you to track the order of calls between separate mock objects, " "however we can use :attr:`~Mock.mock_calls` to achieve the same effect." msgstr "" +":class:`Mock` クラスでは、:attr:`~Mock.method_calls` 属性でモックオブジェクト" +"のメソッドの呼び出し *順序* を追跡できます。\n" +"これでは別々のモックオブジェクト間の呼び出し順序を追跡できませんが、:attr:" +"`~Mock.mock_calls` を使うと同じことを実現できます。" -#: ../../library/unittest.mock-examples.rst:1201 msgid "" "Because mocks track calls to child mocks in ``mock_calls``, and accessing an " "arbitrary attribute of a mock creates a child mock, we can create our " "separate mocks from a parent one. Calls to those child mock will then all be " "recorded, in order, in the ``mock_calls`` of the parent:" msgstr "" +"モックは子モックへの呼び出しを ``mock_calls`` に記録し、任意の属性にアクセス" +"すると子モックを作成します。\n" +"そこで、1 つの親モックから個々のモックを作成できます。\n" +"子モックへの呼び出しはすべて、親の ``mock_calls`` に順に記録されます。" -#: ../../library/unittest.mock-examples.rst:1218 msgid "" "We can then assert about the calls, including the order, by comparing with " "the ``mock_calls`` attribute on the manager mock:" msgstr "" +"管理用モックの ``mock_calls`` 属性と比較することで、順序を含めて呼び出しをア" +"サートできます。" -#: ../../library/unittest.mock-examples.rst:1225 msgid "" "If ``patch`` is creating, and putting in place, your mocks then you can " "attach them to a manager mock using the :meth:`~Mock.attach_mock` method. " "After attaching calls will be recorded in ``mock_calls`` of the manager. ::" msgstr "" +"``patch`` でモックを作成して配置する場合は、:meth:`~Mock.attach_mock` メソッ" +"ドで管理用モックに取り付けられます。\n" +"取り付けた後の呼び出しは、管理用モックの ``mock_calls`` に記録されます。 ::" -#: ../../library/unittest.mock-examples.rst:1229 msgid "" ">>> manager = MagicMock()\n" ">>> with patch('mymodule.Class1') as MockClass1:\n" @@ -1496,8 +1707,21 @@ msgid "" "call.MockClass2(),\n" "call.MockClass2().bar()]" msgstr "" +">>> manager = MagicMock()\n" +">>> with patch('mymodule.Class1') as MockClass1:\n" +"... with patch('mymodule.Class2') as MockClass2:\n" +"... manager.attach_mock(MockClass1, 'MockClass1')\n" +"... manager.attach_mock(MockClass2, 'MockClass2')\n" +"... MockClass1().foo()\n" +"... MockClass2().bar()\n" +"\n" +"\n" +">>> manager.mock_calls\n" +"[call.MockClass1(),\n" +"call.MockClass1().foo(),\n" +"call.MockClass2(),\n" +"call.MockClass2().bar()]" -#: ../../library/unittest.mock-examples.rst:1244 msgid "" "If many calls have been made, but you're only interested in a particular " "sequence of them then an alternative is to use the :meth:`~Mock." @@ -1505,32 +1729,40 @@ msgid "" "data:`call` object). If that sequence of calls are in :attr:`~Mock." "mock_calls` then the assert succeeds." msgstr "" +"多くの呼び出しがあっても、そのうちの特定の一連の呼び出しだけを調べたい場合" +"は、:meth:`~Mock.assert_has_calls` メソッドも使えます。\n" +"このメソッドは、:data:`call` オブジェクトで作成した呼び出しのリストを受け取り" +"ます。\n" +"その一連の呼び出しが :attr:`~Mock.mock_calls` に含まれていれば、アサートは成" +"功します。" -#: ../../library/unittest.mock-examples.rst:1258 msgid "" "Even though the chained call ``m.one().two().three()`` aren't the only calls " "that have been made to the mock, the assert still succeeds." msgstr "" +"モックに対する呼び出しが ``m.one().two().three()`` という連鎖した呼び出しだけ" +"でなくても、アサートは成功します。" -#: ../../library/unittest.mock-examples.rst:1261 msgid "" "Sometimes a mock may have several calls made to it, and you are only " "interested in asserting about *some* of those calls. You may not even care " "about the order. In this case you can pass ``any_order=True`` to " "``assert_has_calls``:" msgstr "" +"モックに複数回の呼び出しがあっても、その *一部* だけをアサートしたい場合があ" +"ります。\n" +"順序も問わない場合は、``assert_has_calls`` に ``any_order=True`` を渡せます。" -#: ../../library/unittest.mock-examples.rst:1273 msgid "More complex argument matching" -msgstr "" +msgstr "より複雑な引数の照合" -#: ../../library/unittest.mock-examples.rst:1275 msgid "" "Using the same basic concept as :data:`ANY` we can implement matchers to do " "more complex assertions on objects used as arguments to mocks." msgstr "" +":data:`ANY` と同じ基本的な考え方でマッチャーを実装し、モックに引数として渡さ" +"れたオブジェクトに対して、より複雑なアサートを行えます。" -#: ../../library/unittest.mock-examples.rst:1278 msgid "" "Suppose we expect some object to be passed to a mock that by default " "compares equal based on object identity (which is the Python default for " @@ -1539,29 +1771,36 @@ msgid "" "attributes of this object then we can create a matcher that will check these " "attributes for us." msgstr "" +"オブジェクトの同一性に基づいて等価性を比較するオブジェクトが、モックに渡され" +"ることを期待しているとします\n" +"(Python のユーザー定義クラスのデフォルトの比較方法です)。\n" +":meth:`~Mock.assert_called_with` を使うには、まったく同じオブジェクトを渡す必" +"要があります。\n" +"そのオブジェクトの一部の属性だけを調べたい場合は、それらの属性を検査するマッ" +"チャーを作成できます。" -#: ../../library/unittest.mock-examples.rst:1285 msgid "" "You can see in this example how a 'standard' call to ``assert_called_with`` " "isn't sufficient:" msgstr "" +"この例では、``assert_called_with`` の「通常の」呼び出しでは不十分であることが" +"わかります。" -#: ../../library/unittest.mock-examples.rst:1301 msgid "" "A comparison function for our ``Foo`` class might look something like this:" -msgstr "" +msgstr "``Foo`` クラスの比較関数は、例えば次のようになります。" -#: ../../library/unittest.mock-examples.rst:1313 msgid "" "And a matcher object that can use comparison functions like this for its " "equality operation would look something like this:" msgstr "" +"このような比較関数を等価性の判定に使うマッチャーオブジェクトは、例えば次のよ" +"うになります。" #: ../../library/unittest.mock-examples.rst:1324 msgid "Putting all this together:" msgstr "全てをつなぎ合わせて:" -#: ../../library/unittest.mock-examples.rst:1329 msgid "" "The ``Matcher`` is instantiated with our compare function and the ``Foo`` " "object we want to compare against. In ``assert_called_with`` the ``Matcher`` " @@ -1570,14 +1809,21 @@ msgid "" "``assert_called_with`` passes, and if they don't an :exc:`AssertionError` is " "raised:" msgstr "" +"``Matcher`` は、比較関数と、比較対象の ``Foo`` オブジェクトを渡してインスタン" +"ス化します。\n" +"``assert_called_with`` の中で ``Matcher`` の等価性比較メソッドが呼ばれ、\n" +"モックに渡されたオブジェクトと、マッチャーの作成時に指定したオブジェクトを比" +"較します。\n" +"一致すれば ``assert_called_with`` は成功し、一致しなければ :exc:" +"`AssertionError` を送出します。" -#: ../../library/unittest.mock-examples.rst:1342 msgid "" "With a bit of tweaking you could have the comparison function raise the :exc:" "`AssertionError` directly and provide a more useful failure message." msgstr "" +"少し変更すれば、比較関数から直接 :exc:`AssertionError` を送出し、より役立つ失" +"敗メッセージを示すこともできます。" -#: ../../library/unittest.mock-examples.rst:1345 msgid "" "As of version 1.5, the Python testing library `PyHamcrest `_ provides similar functionality, that may be " @@ -1585,3 +1831,9 @@ msgid "" "integration.match_equality `_)." msgstr "" +"Python のテストライブラリ `PyHamcrest `_ " +"は、バージョン 1.5 以降、\n" +"等価性マッチャー (`hamcrest.library.integration.match_equality `_) として同様の機能を提供しており、ここで" +"役立つかもしれません。" diff --git a/library/unittest.mock.po b/library/unittest.mock.po index 64d908256..af8cfaf7d 100644 --- a/library/unittest.mock.po +++ b/library/unittest.mock.po @@ -22,10 +22,10 @@ msgstr "" "Last-Translator: Atsuo Ishimoto , 2025\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/unittest.mock.rst:2 @@ -87,6 +87,8 @@ msgid "" "There is a backport of :mod:`unittest.mock` for earlier versions of Python, " "available as :pypi:`mock` on PyPI." msgstr "" +"以前の Python バージョン向けにバックポートされた :mod:`unittest.mock` があ" +"り、 :pypi:`mock` on PyPIとして利用可能です。" #: ../../library/unittest.mock.rst:41 msgid "Quick Guide" @@ -101,14 +103,16 @@ msgid "" msgstr "" ":class:`Mock` および :class:`MagicMock` オブジェクトはアクセスしたすべての属" "性とメソッドを作成し、どのように使用されたかについての詳細な情報を格納しま" -"す。戻り値を指定したり利用できる属性を制限するために :class:`Mock` および :" -"class:`MagicMock` を設定でき、どのよう使用されたかについてアサートできます:" +"す。戻り値を指定したり利用できる属性を制限するために ``Mock`` および " +"``MagicMock`` を設定でき、どのよう使用されたかについてアサートできます:" #: ../../library/unittest.mock.rst:71 msgid "" ":attr:`~Mock.side_effect` allows you to perform side effects, including " "raising an exception when a mock is called:" msgstr "" +":attr:`~Mock.side_effect` によって、モック呼び出し時の例外発生などの副作用を" +"実行できます:" #: ../../library/unittest.mock.rst:92 msgid "" @@ -133,7 +137,6 @@ msgstr "" "はテスト中はモック (または別のオブジェクト) に置換され、テスト終了時に復元さ" "れます::" -#: ../../library/unittest.mock.rst:101 msgid "" ">>> from unittest.mock import patch\n" ">>> @patch('module.ClassName2')\n" @@ -148,6 +151,18 @@ msgid "" "...\n" ">>> test()" msgstr "" +">>> from unittest.mock import patch\n" +">>> @patch('module.ClassName2')\n" +"... @patch('module.ClassName1')\n" +"... def test(MockClass1, MockClass2):\n" +"... module.ClassName1()\n" +"... module.ClassName2()\n" +"... assert MockClass1 is module.ClassName1\n" +"... assert MockClass2 is module.ClassName2\n" +"... assert MockClass1.called\n" +"... assert MockClass2.called\n" +"...\n" +">>> test()" #: ../../library/unittest.mock.rst:116 msgid "" @@ -197,17 +212,16 @@ msgstr "" "しています。 マジックメソッドのもっとも簡単な利用法は :class:`MagicMock` クラ" "スと使うことです。以下のように利用します:" -#: ../../library/unittest.mock.rst:156 msgid "" "Mock allows you to assign functions (or other Mock instances) to magic " "methods and they will be called appropriately. The :class:`MagicMock` class " "is just a Mock variant that has all of the magic methods pre-created for you " "(well, all the useful ones anyway)." msgstr "" -"mock によってマジックメソッドに関数 (あるいは他の Mock インスタンス) を割り当" -"てることができ、それらは適切に呼び出されます。\n" -":class:`MagicMock` クラスは、すべてのマジックメソッドがあらかじめ作成されてい" -"る点を除けば :class:`Mock` クラスと一緒です (まあ、とにかく便利ってこと)。" +"Mock ではマジックメソッドに関数 (または別の Mock インスタンス) を代入でき、そ" +"れらは適切に呼び出されます。\n" +":class:`MagicMock` クラスは、すべてのマジックメソッド (少なくとも、役立つもの" +"すべて) があらかじめ作成されている Mock の一種です。" #: ../../library/unittest.mock.rst:161 msgid "" @@ -322,6 +336,9 @@ msgid "" "__class__` returns the class of the spec object. This allows mocks to pass :" "func:`isinstance` tests." msgstr "" +"*spec* が (文字列のリストではなく) オブジェクトの場合、 :attr:`~object." +"__class__` はスペックオブジェクトのクラスを返します。これによってモックが :" +"func:`isinstance` テストに通るようになります。" #: ../../library/unittest.mock.rst:245 msgid "" @@ -376,13 +393,16 @@ msgstr "" "クセスされた際に生成される) 新しい Mock を返します。 :attr:`return_value` を" "参照してください。" -#: ../../library/unittest.mock.rst:267 msgid "" "*unsafe*: By default, accessing any attribute whose name starts with " "*assert*, *assret*, *asert*, *aseert* or *assrt* will raise an :exc:" "`AttributeError`. Passing ``unsafe=True`` will allow access to these " "attributes." msgstr "" +"*unsafe*: デフォルトでは、名前が *assert*、*assret*、*asert*、*aseert*、" +"*assrt* のいずれかで始まる属性にアクセスすると :exc:`AttributeError` が送出さ" +"れます。\n" +"``unsafe=True`` を渡すと、これらの属性へのアクセスを許可します。" #: ../../library/unittest.mock.rst:274 msgid "" @@ -407,13 +427,14 @@ msgstr "" "モックが明示的に *return_value* を設定されていると、呼び出しはラップされたオ" "ブジェクトに渡されず、代わりに *return_value* が返されます。" -#: ../../library/unittest.mock.rst:284 msgid "" "*name*: If the mock has a name then it will be used in the repr of the mock. " "This can be useful for debugging. The name is propagated to child mocks." msgstr "" -"*name*: モックに名前があるなら、それがモックの repr として使われます。これは" -"デバッグの際に役立つでしょう。この名前は子のモックにも伝播します。" +"*name*: モックに名前がある場合、その名前はモックの ``repr()`` の結果に使われ" +"ます。\n" +"デバッグに役立つことがあります。\n" +"名前は子モックにも伝播します。" #: ../../library/unittest.mock.rst:288 msgid "" @@ -433,11 +454,12 @@ msgstr "モックが少なくとも一度は呼び出されたことをアサー msgid "Assert that the mock was called exactly once." msgstr "モックが一度だけ呼び出されたことをアサートします。" -#: ../../library/unittest.mock.rst:324 msgid "" "This method is a convenient way of asserting that the last call has been " "made in a particular way:" msgstr "" +"このメソッドを使うと、最後の呼び出しが特定の引数で行われたことを簡単にアサー" +"トできます。" #: ../../library/unittest.mock.rst:334 msgid "" @@ -451,13 +473,17 @@ msgstr "" msgid "assert the mock has been called with the specified arguments." msgstr "モックが特定の引数で呼び出されたことがあるのをアサートします。" -#: ../../library/unittest.mock.rst:351 msgid "" "The assert passes if the mock has *ever* been called, unlike :meth:" "`assert_called_with` and :meth:`assert_called_once_with` that only pass if " "the call is the most recent one, and in the case of :meth:" "`assert_called_once_with` it must also be the only call." msgstr "" +"指定した引数で *一度でも* 呼び出されていれば、アサートは成功します。\n" +"これに対し、:meth:`assert_called_with` と :meth:`assert_called_once_with` " +"は、最後の呼び出しが指定した引数で行われていなければ成功しません。\n" +"さらに :meth:`assert_called_once_with` では、それが唯一の呼び出しである必要が" +"あります。" #: ../../library/unittest.mock.rst:364 msgid "" @@ -491,7 +517,6 @@ msgstr "モックが一度も呼ばれなかったことをアサートします msgid "The reset_mock method resets all the call attributes on a mock object:" msgstr "モックオブジェクトのすべての呼び出し属性をリセットします:" -#: ../../library/unittest.mock.rst:404 msgid "" ">>> mock = Mock(return_value=None)\n" ">>> mock('hello')\n" @@ -501,19 +526,25 @@ msgid "" ">>> mock.called\n" "False" msgstr "" +">>> mock = Mock(return_value=None)\n" +">>> mock('hello')\n" +">>> mock.called\n" +"True\n" +">>> mock.reset_mock()\n" +">>> mock.called\n" +"False" -#: ../../library/unittest.mock.rst:414 msgid "" "This can be useful where you want to make a series of assertions that reuse " "the same object." -msgstr "" +msgstr "同じオブジェクトを再利用して一連のアサートを行いたい場合に役立ちます。" -#: ../../library/unittest.mock.rst:417 msgid "" "*return_value* parameter when set to ``True`` resets :attr:`return_value`:" msgstr "" +"*return_value* 引数を ``True`` にすると、:attr:`return_value` をリセットしま" +"す。" -#: ../../library/unittest.mock.rst:419 msgid "" ">>> mock = Mock(return_value=5)\n" ">>> mock('hello')\n" @@ -522,13 +553,19 @@ msgid "" ">>> mock('hello')\n" "" msgstr "" +">>> mock = Mock(return_value=5)\n" +">>> mock('hello')\n" +"5\n" +">>> mock.reset_mock(return_value=True)\n" +">>> mock('hello')\n" +"" -#: ../../library/unittest.mock.rst:428 msgid "" "*side_effect* parameter when set to ``True`` resets :attr:`side_effect`:" msgstr "" +"*side_effect* 引数を ``True`` にすると、:attr:`side_effect` をリセットしま" +"す。" -#: ../../library/unittest.mock.rst:430 msgid "" ">>> mock = Mock(side_effect=ValueError)\n" ">>> mock('hello')\n" @@ -539,30 +576,37 @@ msgid "" ">>> mock('hello')\n" "" msgstr "" +">>> mock = Mock(side_effect=ValueError)\n" +">>> mock('hello')\n" +"Traceback (most recent call last):\n" +" ...\n" +"ValueError\n" +">>> mock.reset_mock(side_effect=True)\n" +">>> mock('hello')\n" +"" -#: ../../library/unittest.mock.rst:441 msgid "" "Note that :meth:`reset_mock` *doesn't* clear the :attr:`return_value`, :attr:" "`side_effect` or any child attributes you have set using normal assignment " "by default." msgstr "" +"デフォルトでは :meth:`reset_mock` は :attr:`return_value`、:attr:" +"`side_effect`、および通常の代入で設定した子の属性をクリア *しません*。" -#: ../../library/unittest.mock.rst:445 msgid "Child mocks are reset as well." -msgstr "" +msgstr "子モックもリセットされます。" #: ../../library/unittest.mock.rst:447 msgid "Added two keyword-only arguments to the reset_mock function." msgstr "2つのキーワード専用引数が reset_mock 関数に追加されました。" -#: ../../library/unittest.mock.rst:452 msgid "" "Add a spec to a mock. *spec* can either be an object or a list of strings. " "Only attributes on the *spec* can be fetched as attributes from the mock." msgstr "" -"モックに仕様を追加します。 *spec* にはオブジェクトもしくは文字列のリストを指" -"定してください。 *spec* で設定した属性は、モックの属性としてのみアクセスでき" -"ます。" +"モックに仕様を追加します。\n" +"*spec* にはオブジェクトまたは文字列のリストを指定できます。\n" +"モックの属性として取得できるのは、*spec* にある属性だけです。" #: ../../library/unittest.mock.rst:456 msgid "If *spec_set* is true then only attributes on the spec can be set." @@ -601,15 +645,14 @@ msgstr "" ":meth:`configure_mock` は、モック生成後のコンフィギュレーションを容易に行うた" "めに存在します。" -#: ../../library/unittest.mock.rst:503 msgid "" ":class:`Mock` objects limit the results of ``dir(some_mock)`` to useful " "results. For mocks with a *spec* this includes all the permitted attributes " "for the mock." msgstr "" -":class:`Mock` オブジェクトは、有用な結果を得るために ``dir(some_mock)`` の結" -"果を制限します。 *spec* を設定したモックに対しては、許可された属性のみを含み" -"ます。" +":class:`Mock` オブジェクトは、``dir(some_mock)`` の結果を有用なものに絞りま" +"す。\n" +"*spec* を指定したモックでは、モックに許可された属性がすべて含まれます。" #: ../../library/unittest.mock.rst:507 msgid "" @@ -619,15 +662,15 @@ msgstr "" "このフィルタが何をしていて、どのように停止させるかは、 :data:`FILTER_DIR` を" "参照してください。" -#: ../../library/unittest.mock.rst:513 msgid "" "Create the child mocks for attributes and return value. By default child " "mocks will be the same type as the parent. Subclasses of Mock may want to " "override this to customize the way child mocks are made." msgstr "" -"子のモックを作成し、その値を返すようにしてください。デフォルトでは親と同じタ" -"イプで作成されます。サブクラスで子モックの作成される方法をカスタマイズしたい" -"場合には、このメソッドをオーバーライドします。" +"属性用と戻り値用の子モックを作成します。\n" +"デフォルトでは、子モックは親と同じ型になります。\n" +"Mock のサブクラスで子モックの作成方法をカスタマイズしたい場合は、このメソッド" +"をオーバーライドできます。" #: ../../library/unittest.mock.rst:518 msgid "" @@ -681,17 +724,16 @@ msgstr "" "りはその関数の戻り値が返されます。関数が :data:`DEFAULT` を返した場合は ( :" "attr:`return_value` によって) モックの通常の値を返します。" -#: ../../library/unittest.mock.rst:583 msgid "" "If you pass in an iterable, it is used to retrieve an iterator which must " "yield a value on every call. This value can either be an exception instance " "to be raised, or a value to be returned from the call to the mock (:data:" "`DEFAULT` handling is identical to the function case)." msgstr "" -"iterable が渡された場合、その値はイテレータを取り出すために使用されます。イテ" -"レータは毎回の呼び出しにおいて値を yield しなければなりません。この値は、送出" -"される例外インスタンスか、呼び出しからモックに返される値のいずれかです (:" -"data:`DEFAULT` の処理は関数の場合と同一です)。" +"iterable が渡された場合、その値はイテレータを取り出すために使用されます。\n" +"イテレータは毎回の呼び出しにおいて値を yield しなければなりません。\n" +"この値は、送出される例外インスタンスか、モックの呼び出しから返される値のいず" +"れかです (:data:`DEFAULT` の処理は関数の場合と同一です)。" #: ../../library/unittest.mock.rst:588 msgid "" @@ -731,18 +773,17 @@ msgid "" "is any keyword arguments (or an empty dictionary)." msgstr "" -#: ../../library/unittest.mock.rst:672 msgid "" ":attr:`call_args`, along with members of the lists :attr:`call_args_list`, :" "attr:`method_calls` and :attr:`mock_calls` are :data:`call` objects. These " "are tuples, so they can be unpacked to get at the individual arguments and " "make more complex assertions. See :ref:`calls as tuples `." msgstr "" -":attr:`call_args` は、 :attr:`call_args_list` や :attr:`method_calls` 、 :" -"attr:`mock_calls` と同様、 :data:`call` オブジェクトです。これらはタプルとし" -"てアンパックすることで個別に取り出すことができます。そして、より複雑なアサー" -"ションを行うことができます。 :ref:`calls as tuples ` を参照" -"してください。" +":attr:`call_args` と、:attr:`call_args_list`、:attr:`method_calls`、:attr:" +"`mock_calls` の各リストの要素は :data:`call` オブジェクトです。\n" +"これらはタプルなので、アンパックして個々の引数を取り出し、より複雑なアサー" +"ションを行えます。\n" +":ref:`calls as tuples ` を参照してください。" #: ../../library/unittest.mock.rst:678 msgid "Added ``args`` and ``kwargs`` properties." @@ -807,26 +848,35 @@ msgstr "" "パックすることで個別に取り出すことができます。 :ref:`calls as tuples ` を参照してください。" -#: ../../library/unittest.mock.rst:749 msgid "" "The way :attr:`mock_calls` are recorded means that where nested calls are " "made, the parameters of ancestor calls are not recorded and so will always " "compare equal:" msgstr "" +":attr:`mock_calls` の記録方法により、入れ子の呼び出しでは祖先の呼び出しの引数" +"が記録されません。\n" +"そのため、祖先の呼び出しの引数が異なっても、比較すると常に等しいと判定されま" +"す。" -#: ../../library/unittest.mock.rst:763 msgid "" "Normally the :attr:`!__class__` attribute of an object will return its type. " "For a mock object with a :attr:`!spec`, :attr:`!__class__` returns the spec " "class instead. This allows mock objects to pass :func:`isinstance` tests for " "the object they are replacing / masquerading as:" msgstr "" +"通常、オブジェクトの :attr:`!__class__` 属性はその型を返します。\n" +":attr:`!spec` を指定したモックオブジェクトでは、:attr:`!__class__` は代わりに" +"仕様に指定したクラスを返します。\n" +"このため、モックオブジェクトは置き換えたり、なりすましたりしているオブジェク" +"トに対する :func:`isinstance` の検査に通ります。" #: ../../library/unittest.mock.rst:772 msgid "" ":attr:`!__class__` is assignable to, this allows a mock to pass an :func:" "`isinstance` check without forcing you to use a spec:" msgstr "" +":attr:`!__class__` は書き換え可能で、 :func:`isinstance` を通るために必ず " +"spec を使う必要はありません:" #: ../../library/unittest.mock.rst:782 msgid "" @@ -842,6 +892,8 @@ msgid "" "Mock objects that use a class or an instance as a :attr:`!spec` or :attr:`!" "spec_set` are able to pass :func:`isinstance` tests:" msgstr "" +":attr:`!spec` か :attr:`!spec_set` にクラスかインスタンスを渡した mock は :" +"func:`isinstance` テストをパスします:" #: ../../library/unittest.mock.rst:796 msgid "" @@ -872,19 +924,17 @@ msgstr "" "直接ドットのついた名前を使用できないので、作成した辞書を ``**`` でアンパック" "する必要があります:" -#: ../../library/unittest.mock.rst:825 msgid "" "A callable mock which was created with a *spec* (or a *spec_set*) will " "introspect the specification object's signature when matching calls to the " "mock. Therefore, it can match the actual call's arguments regardless of " "whether they were passed positionally or by name::" msgstr "" -"*spec* (または *spec_set*) によって作成された呼び出し可能なモックは、モックへ" -"の呼び出しがマッチしたときに仕様オブジェクトのシグネチャを内省します。した" -"がって、引数を位置引数として渡したか名前で渡したかどうかに関わらず、実際の呼" -"び出しの引数とマッチすることができます::" +"*spec* (または *spec_set*) を指定して作成した呼び出し可能なモックは、呼び出し" +"を照合するときに仕様となるオブジェクトのシグネチャを調べます。\n" +"そのため、実際の呼び出しの引数が位置引数として渡されたか、名前を指定して渡さ" +"れたかにかかわらず照合できます。 ::" -#: ../../library/unittest.mock.rst:830 msgid "" ">>> def f(a, b, c): pass\n" "...\n" @@ -894,18 +944,25 @@ msgid "" ">>> mock.assert_called_with(1, 2, 3)\n" ">>> mock.assert_called_with(a=1, b=2, c=3)" msgstr "" +">>> def f(a, b, c): pass\n" +"...\n" +">>> mock = Mock(spec=f)\n" +">>> mock(1, 2, c=3)\n" +"\n" +">>> mock.assert_called_with(1, 2, 3)\n" +">>> mock.assert_called_with(a=1, b=2, c=3)" -#: ../../library/unittest.mock.rst:838 msgid "" "This applies to :meth:`~Mock.assert_called_with`, :meth:`~Mock." "assert_called_once_with`, :meth:`~Mock.assert_has_calls` and :meth:`~Mock." "assert_any_call`. When :ref:`auto-speccing`, it will also apply to method " "calls on the mock object." msgstr "" -"これは :meth:`~Mock.assert_called_with`, :meth:`~Mock." -"assert_called_once_with`, :meth:`~Mock.assert_has_calls` and :meth:`~Mock." -"assert_any_call` にも適用されます。 :ref:`auto-speccing` と、 モックオブジェ" -"クトのメソッド呼び出しにも適用されます。" +"これは :meth:`~Mock.assert_called_with`、:meth:`~Mock." +"assert_called_once_with`、:meth:`~Mock.assert_has_calls`、:meth:`~Mock." +"assert_any_call` に適用されます。\n" +":ref:`auto-speccing` を使う場合は、モックオブジェクトのメソッド呼び出しにも適" +"用されます。" #: ../../library/unittest.mock.rst:843 msgid "Added signature introspection on specced and autospecced mock objects." @@ -920,6 +977,9 @@ msgid "" "__get__` and :meth:`~object.__set__` methods so you can specify a return " "value when it is fetched." msgstr "" +":class:`property` もしくは :term:`デスクリプタ ` として使われるた" +"めのモックです。 :class:`PropertyMock` は、 :meth:`~object.__get__` と :meth:" +"`~object.__set__` メソッドを提供し、戻り値を指定することができます。" #: ../../library/unittest.mock.rst:854 msgid "" @@ -930,7 +990,6 @@ msgstr "" "与えないモックの呼び出しに相当します。設定は、 設定する値を伴った呼び出しにな" "ります。::" -#: ../../library/unittest.mock.rst:857 msgid "" ">>> class Foo:\n" "... @property\n" @@ -950,6 +1009,23 @@ msgid "" ">>> mock_foo.mock_calls\n" "[call(), call(6)]" msgstr "" +">>> class Foo:\n" +"... @property\n" +"... def foo(self):\n" +"... return 'something'\n" +"... @foo.setter\n" +"... def foo(self, value):\n" +"... pass\n" +"...\n" +">>> with patch('__main__.Foo.foo', new_callable=PropertyMock) as mock_foo:\n" +"... mock_foo.return_value = 'mockity-mock'\n" +"... this_foo = Foo()\n" +"... print(this_foo.foo)\n" +"... this_foo.foo = 6\n" +"...\n" +"mockity-mock\n" +">>> mock_foo.mock_calls\n" +"[call(), call(6)]" #: ../../library/unittest.mock.rst:875 msgid "" @@ -960,7 +1036,6 @@ msgstr "" ":class:`PropertyMock` を直接モックに取り付ける方法は、モックの属性を保存する" "方法によりうまく動作しません。代わりに、モック型に取り付けてください::" -#: ../../library/unittest.mock.rst:879 msgid "" ">>> m = MagicMock()\n" ">>> p = PropertyMock(return_value=3)\n" @@ -969,15 +1044,22 @@ msgid "" "3\n" ">>> p.assert_called_once_with()" msgstr "" +">>> m = MagicMock()\n" +">>> p = PropertyMock(return_value=3)\n" +">>> type(m).foo = p\n" +">>> m.foo\n" +"3\n" +">>> p.assert_called_once_with()" -#: ../../library/unittest.mock.rst:888 msgid "" "If an :exc:`AttributeError` is raised by :class:`PropertyMock`, it will be " "interpreted as a missing descriptor and :meth:`~object.__getattr__` will be " "called on the parent mock::" msgstr "" +":class:`PropertyMock` が :exc:`AttributeError` を送出すると、デスクリプタがな" +"いものと解釈され、親モックの :meth:`~object.__getattr__` が呼び出されま" +"す。 ::" -#: ../../library/unittest.mock.rst:892 msgid "" ">>> m = MagicMock()\n" ">>> no_attribute = PropertyMock(side_effect=AttributeError)\n" @@ -985,17 +1067,24 @@ msgid "" ">>> m.my_property\n" "" msgstr "" +">>> m = MagicMock()\n" +">>> no_attribute = PropertyMock(side_effect=AttributeError)\n" +">>> type(m).my_property = no_attribute\n" +">>> m.my_property\n" +"" #: ../../library/unittest.mock.rst:898 msgid "See :meth:`~object.__getattr__` for details." -msgstr "" +msgstr "詳細は :meth:`~object.__getattr__` を参照してください。" -#: ../../library/unittest.mock.rst:903 msgid "" "An asynchronous version of :class:`MagicMock`. The :class:`AsyncMock` object " "will behave so the object is recognized as an async function, and the result " "of a call is an awaitable." msgstr "" +":class:`MagicMock` の非同期版です。\n" +":class:`AsyncMock` オブジェクトは非同期関数として認識されるように振る舞い、呼" +"び出した結果は await 可能です。" #: ../../library/unittest.mock.rst:913 msgid "" @@ -1003,17 +1092,16 @@ msgid "" "``side_effect`` or ``return_value`` after it has been awaited:" msgstr "" -#: ../../library/unittest.mock.rst:916 msgid "" "if ``side_effect`` is a function, the async function will return the result " "of that function," msgstr "" +"``side_effect`` が関数の場合、この非同期関数はその関数の結果を返します。" -#: ../../library/unittest.mock.rst:918 msgid "" "if ``side_effect`` is an exception, the async function will raise the " "exception," -msgstr "" +msgstr "``side_effect`` が例外の場合、この非同期関数はその例外を送出します。" #: ../../library/unittest.mock.rst:920 msgid "" @@ -1022,20 +1110,22 @@ msgid "" "``StopAsyncIteration`` is raised immediately," msgstr "" -#: ../../library/unittest.mock.rst:923 msgid "" "if ``side_effect`` is not defined, the async function will return the value " "defined by ``return_value``, hence, by default, the async function returns a " "new :class:`AsyncMock` object." msgstr "" +"``side_effect`` を定義していない場合、この非同期関数は ``return_value`` に定" +"義した値を返します。\n" +"従って、デフォルトでは新しい :class:`AsyncMock` オブジェクトを返します。" -#: ../../library/unittest.mock.rst:928 msgid "" "Setting the *spec* of a :class:`Mock` or :class:`MagicMock` to an async " "function will result in a coroutine object being returned after calling." msgstr "" +":class:`Mock` または :class:`MagicMock` の *spec* に非同期関数を指定すると、" +"呼び出した結果としてコルーチンオブジェクトを返します。" -#: ../../library/unittest.mock.rst:940 msgid "" "Setting the *spec* of a :class:`Mock`, :class:`MagicMock`, or :class:" "`AsyncMock` to a class with asynchronous and synchronous functions will " @@ -1044,124 +1134,143 @@ msgid "" "or :class:`Mock` (if the parent mock is :class:`Mock`). All asynchronous " "functions will be :class:`AsyncMock`." msgstr "" +":class:`Mock`、:class:`MagicMock`、:class:`AsyncMock` の *spec* に、非同期関" +"数と同期関数を持つクラスを指定すると、同期関数を自動的に検出します。\n" +"同期関数には、親モックが :class:`AsyncMock` または :class:`MagicMock` なら :" +"class:`MagicMock`、親モックが :class:`Mock` なら :class:`Mock` を設定しま" +"す。\n" +"非同期関数はすべて :class:`AsyncMock` になります。" -#: ../../library/unittest.mock.rst:968 msgid "" "Assert that the mock was awaited at least once. Note that this is separate " "from the object having been called, the ``await`` keyword must be used:" msgstr "" +"モックが少なくとも一度 await されたことをアサートします。\n" +"オブジェクトが呼び出されたこととは別であり、``await`` キーワードを使う必要が" +"あります。" -#: ../../library/unittest.mock.rst:987 msgid "Assert that the mock was awaited exactly once." -msgstr "" +msgstr "モックがちょうど一度 await されたことをアサートします。" -#: ../../library/unittest.mock.rst:1003 msgid "Assert that the last await was with the specified arguments." -msgstr "" +msgstr "最後の await が指定した引数で行われたことをアサートします。" -#: ../../library/unittest.mock.rst:1020 msgid "" "Assert that the mock was awaited exactly once and with the specified " "arguments." msgstr "" +"モックがちょうど一度、指定した引数で await されたことをアサートします。" -#: ../../library/unittest.mock.rst:1037 msgid "Assert the mock has ever been awaited with the specified arguments." -msgstr "" +msgstr "モックが指定した引数で一度でも await されたことをアサートします。" -#: ../../library/unittest.mock.rst:1053 msgid "" "Assert the mock has been awaited with the specified calls. The :attr:" "`await_args_list` list is checked for the awaits." msgstr "" +"モックが指定した呼び出しで await されたことをアサートします。\n" +"await は :attr:`await_args_list` リストで確認します。" -#: ../../library/unittest.mock.rst:1056 msgid "" "If *any_order* is false then the awaits must be sequential. There can be " "extra calls before or after the specified awaits." msgstr "" +"*any_order* が偽の場合、await は連続している必要があります。\n" +"指定した await の前後には、他の呼び出しがあっても構いません。" -#: ../../library/unittest.mock.rst:1060 msgid "" "If *any_order* is true then the awaits can be in any order, but they must " "all appear in :attr:`await_args_list`." msgstr "" +"*any_order* が真の場合、await の順序は問いませんが、すべてが :attr:" +"`await_args_list` に含まれる必要があります。" -#: ../../library/unittest.mock.rst:1080 msgid "Assert that the mock was never awaited." -msgstr "" +msgstr "モックが一度も await されていないことをアサートします。" -#: ../../library/unittest.mock.rst:1087 msgid "" "See :func:`Mock.reset_mock`. Also sets :attr:`await_count` to 0, :attr:" "`await_args` to None, and clears the :attr:`await_args_list`." msgstr "" +":func:`Mock.reset_mock` を参照してください。\n" +"加えて、:attr:`await_count` を 0、:attr:`await_args` を None に設定し、:attr:" +"`await_args_list` を空にします。" -#: ../../library/unittest.mock.rst:1092 msgid "" "An integer keeping track of how many times the mock object has been awaited." -msgstr "" +msgstr "モックオブジェクトが await された回数を記録する整数です。" -#: ../../library/unittest.mock.rst:1107 msgid "" "This is either ``None`` (if the mock hasn’t been awaited), or the arguments " "that the mock was last awaited with. Functions the same as :attr:`Mock." "call_args`." msgstr "" +"モックがまだ await されていなければ ``None``、されていれば最後に await された" +"ときの引数です。\n" +":attr:`Mock.call_args` と同じように機能します。" -#: ../../library/unittest.mock.rst:1125 msgid "" "This is a list of all the awaits made to the mock object in sequence (so the " "length of the list is the number of times it has been awaited). Before any " "awaits have been made it is an empty list." msgstr "" +"モックオブジェクトに対するすべての await を順に記録したリストです (従って、リ" +"ストの長さは await された回数です)。\n" +"一度も await されていなければ空のリストです。" -#: ../../library/unittest.mock.rst:1145 msgid "" "A version of :class:`MagicMock` for multithreading tests. The :class:" "`ThreadingMock` object provides extra methods to wait for a call to be " "invoked, rather than assert on it immediately." msgstr "" +"マルチスレッドのテスト用の :class:`MagicMock` です。\n" +":class:`ThreadingMock` オブジェクトは、呼び出しがあったかを即座にアサートする" +"代わりに、呼び出されるまで待機するメソッドを追加で提供します。" -#: ../../library/unittest.mock.rst:1149 msgid "" "The default timeout is specified by the ``timeout`` argument, or if unset by " "the :attr:`ThreadingMock.DEFAULT_TIMEOUT` attribute, which defaults to " "blocking (``None``)." msgstr "" +"デフォルトのタイムアウトは ``timeout`` 引数で指定します。\n" +"指定しない場合は :attr:`ThreadingMock.DEFAULT_TIMEOUT` 属性を使い、そのデフォ" +"ルト値は無期限にブロックする ``None`` です。" -#: ../../library/unittest.mock.rst:1152 msgid "" "You can configure the global default timeout by setting :attr:`ThreadingMock." "DEFAULT_TIMEOUT`." msgstr "" +":attr:`ThreadingMock.DEFAULT_TIMEOUT` を設定すると、全体のデフォルトのタイム" +"アウトを変更できます。" -#: ../../library/unittest.mock.rst:1156 msgid "Waits until the mock is called." -msgstr "" +msgstr "モックが呼び出されるまで待機します。" -#: ../../library/unittest.mock.rst:1158 msgid "" "If a timeout was passed at the creation of the mock or if a timeout argument " "is passed to this function, the function raises an :exc:`AssertionError` if " "the call is not performed in time." msgstr "" +"モックの作成時またはこの関数の ``timeout`` 引数にタイムアウトを指定した場" +"合、\n" +"制限時間内に呼び出されなければ :exc:`AssertionError` を送出します。" -#: ../../library/unittest.mock.rst:1170 msgid "Waits until the mock is called with the specified arguments." -msgstr "" +msgstr "モックが指定した引数で呼び出されるまで待機します。" -#: ../../library/unittest.mock.rst:1172 msgid "" "If a timeout was passed at the creation of the mock the function raises an :" "exc:`AssertionError` if the call is not performed in time." msgstr "" +"モックの作成時にタイムアウトを指定した場合、制限時間内に呼び出されなければ :" +"exc:`AssertionError` を送出します。" -#: ../../library/unittest.mock.rst:1183 msgid "" "Global default timeout in seconds to create instances of :class:" "`ThreadingMock`." msgstr "" +":class:`ThreadingMock` のインスタンスを作成するときに使う、秒単位のグローバル" +"なデフォルトのタイムアウトです。" #: ../../library/unittest.mock.rst:1189 msgid "Calling" @@ -1189,12 +1298,14 @@ msgstr "" "呼び出しはオブジェクトとして :attr:`~Mock.call_args` や :attr:`~Mock." "call_args_list` に記録されます。" -#: ../../library/unittest.mock.rst:1200 msgid "" "If :attr:`~Mock.side_effect` is set then it will be called after the call " "has been recorded, so if :attr:`!side_effect` raises an exception the call " "is still recorded." msgstr "" +":attr:`~Mock.side_effect` を設定している場合は、呼び出しを記録した後に実行し" +"ます。\n" +"そのため、:attr:`!side_effect` が例外を送出しても、呼び出しは記録されます。" #: ../../library/unittest.mock.rst:1204 msgid "" @@ -1204,27 +1315,34 @@ msgstr "" "呼び出された際に例外を発生させるモックを作成するためには、 :attr:`~Mock." "side_effect` を例外クラスかインスタンスにする方法が最もシンプルです:" -#: ../../library/unittest.mock.rst:1222 msgid "" "If :attr:`~Mock.side_effect` is a function then whatever that function " "returns is what calls to the mock return. The :attr:`!side_effect` function " "is called with the same arguments as the mock. This allows you to vary the " "return value of the call dynamically, based on the input:" msgstr "" +":attr:`~Mock.side_effect` が関数の場合、モックを呼び出すとその関数の戻り値を" +"返します。\n" +":attr:`!side_effect` 関数には、モックと同じ引数が渡されます。\n" +"これにより、入力に応じて呼び出しの戻り値を動的に変えられます。" -#: ../../library/unittest.mock.rst:1238 msgid "" "If you want the mock to still return the default return value (a new mock), " "or any set return value, then there are two ways of doing this. Either " "return :attr:`~Mock.return_value` from inside :attr:`~Mock.side_effect`, or " "return :data:`DEFAULT`:" msgstr "" +"デフォルトの戻り値 (新しいモック) や、設定した戻り値をそのまま返したい場合" +"は、2 つの方法があります。\n" +":attr:`~Mock.side_effect` 内から :attr:`~Mock.return_value` を返すか、:data:" +"`DEFAULT` を返します。" -#: ../../library/unittest.mock.rst:1257 msgid "" "To remove a :attr:`~Mock.side_effect`, and return to the default behaviour, " "set the :attr:`!side_effect` to ``None``:" msgstr "" +":attr:`~Mock.side_effect` を取り除いてデフォルトの動作に戻すには、:attr:`!" +"side_effect` を ``None`` に設定します。" #: ../../library/unittest.mock.rst:1271 msgid "" @@ -1241,7 +1359,6 @@ msgstr "" "もしイテレート可能オブジェクトの要素が例外だった場合には、戻り値として返され" "る代わりに例外が発生します::" -#: ../../library/unittest.mock.rst:1290 msgid "" ">>> iterable = (33, ValueError, 66)\n" ">>> m = MagicMock(side_effect=iterable)\n" @@ -1254,6 +1371,16 @@ msgid "" ">>> m()\n" "66" msgstr "" +">>> iterable = (33, ValueError, 66)\n" +">>> m = MagicMock(side_effect=iterable)\n" +">>> m()\n" +"33\n" +">>> m()\n" +"Traceback (most recent call last):\n" +" ...\n" +"ValueError\n" +">>> m()\n" +"66" #: ../../library/unittest.mock.rst:1305 msgid "Deleting Attributes" @@ -1267,21 +1394,23 @@ msgstr "" "モックオブジェクトは要求に応じて属性を生成することで,任意のオブジェクトとし" "て振る舞うことができます。" -#: ../../library/unittest.mock.rst:1310 msgid "" "You may want a mock object to return ``False`` to a :func:`hasattr` call, or " "raise an :exc:`AttributeError` when an attribute is fetched. You can do this " "by providing an object as a :attr:`!spec` for a mock, but that isn't always " "convenient." msgstr "" +":func:`hasattr` に対して ``False`` を返したり、属性を取得しようとすると :exc:" +"`AttributeError` を送出したりするモックオブジェクトが必要な場合があります。\n" +"モックの :attr:`!spec` にオブジェクトを指定することでも実現できますが、それが" +"常に便利とは限りません。" -#: ../../library/unittest.mock.rst:1314 msgid "" "You \"block\" attributes by deleting them. Once deleted, accessing an " "attribute will raise an :exc:`AttributeError`." msgstr "" -"属性を削除することで, :exc:`AttributeError` を発生させ,アクセスを \"妨げる" -"\" ようになります." +"属性を削除すると、その属性へのアクセスを禁止できます。\n" +"削除後にその属性にアクセスすると :exc:`AttributeError` が発生します。" #: ../../library/unittest.mock.rst:1331 msgid "Mock names and the name attribute" @@ -1299,13 +1428,16 @@ msgstr "" "つの選択肢があります。1つのオプションは :meth:`~Mock.configure_mock` を使用す" "ることです::" -#: ../../library/unittest.mock.rst:1338 msgid "" ">>> mock = MagicMock()\n" ">>> mock.configure_mock(name='my_name')\n" ">>> mock.name\n" "'my_name'" msgstr "" +">>> mock = MagicMock()\n" +">>> mock.configure_mock(name='my_name')\n" +">>> mock.name\n" +"'my_name'" #: ../../library/unittest.mock.rst:1343 msgid "" @@ -1315,11 +1447,12 @@ msgstr "" "より単純なオプションはモックの生成後に単に \"name\" 属性をセットすることで" "す::" -#: ../../library/unittest.mock.rst:1345 msgid "" ">>> mock = MagicMock()\n" ">>> mock.name = \"foo\"" msgstr "" +">>> mock = MagicMock()\n" +">>> mock.name = \"foo\"" #: ../../library/unittest.mock.rst:1350 msgid "Attaching Mocks as Attributes" @@ -1341,13 +1474,13 @@ msgstr "" "を設定する際に有用です。また、親に対して設定したすべての子の呼び出しを記録す" "るため、それらの間の順番を確認する際にも有用です:" -#: ../../library/unittest.mock.rst:1370 msgid "" "The exception to this is if the mock has a name. This allows you to prevent " "the \"parenting\" if for some reason you don't want it to happen." msgstr "" -"モックが名前をもつ場合は、例外的に扱われます。何らかの理由で \"子守り\" が発" -"生してほしくないときに、それを防ぐことができます。" +"例外はモックに名前が付いている場合です。\n" +"何らかの理由で親子関係を設定したくない場合は、名前を付けることで設定を防げま" +"す。" #: ../../library/unittest.mock.rst:1381 msgid "" @@ -1359,7 +1492,6 @@ msgstr "" "持つモックを設定したい場合には、親に対して :meth:`~Mock.attach_mock` メソッド" "を呼び出します::" -#: ../../library/unittest.mock.rst:1385 msgid "" ">>> thing1 = object()\n" ">>> thing2 = object()\n" @@ -1374,8 +1506,19 @@ msgid "" ">>> parent.mock_calls\n" "[call.child1('one'), call.child2('two')]" msgstr "" +">>> thing1 = object()\n" +">>> thing2 = object()\n" +">>> parent = MagicMock()\n" +">>> with patch('__main__.thing1', return_value=None) as child1:\n" +"... with patch('__main__.thing2', return_value=None) as child2:\n" +"... parent.attach_mock(child1, 'child1')\n" +"... parent.attach_mock(child2, 'child2')\n" +"... child1('one')\n" +"... child2('two')\n" +"...\n" +">>> parent.mock_calls\n" +"[call.child1('one'), call.child2('two')]" -#: ../../library/unittest.mock.rst:1399 msgid "" "The only exceptions are magic methods and attributes (those that have " "leading and trailing double underscores). Mock doesn't create these but " @@ -1384,26 +1527,29 @@ msgid "" "a new Mock object when it expects a magic method. If you need magic method " "support see :ref:`magic methods `." msgstr "" -"例外は特殊メソッドと属性だけです (これらは2つのアンダースコアで開始・終了しま" -"す)。モックはこれらの代わりに :exc:`AttributeError` を発生させます。これは、" -"インタープリタが暗黙的にこれらのメソッドを要求するためであり、特殊メソッドを" -"予測する際に *非常に* 混乱してしまいます。もし特殊メソッドのサポートが必要な" -"場合は、 :ref:`magic methods ` を参照してください。" +"例外は特殊メソッドと特殊属性 (名前の先頭と末尾が二重アンダースコアのもの) で" +"す。\n" +"Mock はこれらを作成せず、:exc:`AttributeError` を送出します。\n" +"インタープリタはこれらのメソッドを暗黙的に要求することが多く、特殊メソッドを" +"期待しているのに新しい Mock オブジェクトを受け取ると *大きく* 混乱するためで" +"す。\n" +"特殊メソッドのサポートが必要な場合は :ref:`特殊メソッド ` を参" +"照してください。" #: ../../library/unittest.mock.rst:1408 msgid "The patchers" msgstr "patcher" -#: ../../library/unittest.mock.rst:1410 msgid "" "The patch decorators are used for patching objects only within the scope of " "the function they decorate. They automatically handle the unpatching for " "you, even if exceptions are raised. All of these functions can also be used " "in with statements or as class decorators." msgstr "" -"patch デコレータは、その関数のスコープ内でパッチを適用するオブジェクトに対し" -"て使用されます。たとえ例外が発生したとしても、パッチは自動的に解除されます。" -"これらすべての機能は文やクラスのデコレータとしても使用できます。" +"patch デコレータは、デコレートした関数の実行中だけオブジェクトを置き換えるた" +"めに使います。\n" +"例外が発生しても自動的にパッチを解除します。\n" +"これらの関数はすべて with 文やクラスデコレータとしても使用できます。" #: ../../library/unittest.mock.rst:1417 msgid "patch" @@ -1428,7 +1574,6 @@ msgstr "" "して利用できます。関数や with 文の body では、 *target* は *new* オブジェクト" "にパッチされます。関数/with 文が終了すると、パッチは元に戻されます。" -#: ../../library/unittest.mock.rst:1430 msgid "" "If *new* is omitted, then the target is replaced with an :class:`AsyncMock` " "if the patched object is an async function or a :class:`MagicMock` " @@ -1437,6 +1582,12 @@ msgid "" "If :func:`patch` is used as a context manager the created mock is returned " "by the context manager." msgstr "" +"*new* を省略すると、パッチ対象が非同期関数なら :class:`AsyncMock`、それ以外な" +"ら :class:`MagicMock` に置き換えます。\n" +":func:`patch` をデコレータとして使い、*new* を省略した場合、作成したモックは" +"デコレートした関数に追加の引数として渡されます。\n" +":func:`patch` をコンテキストマネージャとして使う場合は、そのコンテキストマ" +"ネージャが作成したモックを返します。" #: ../../library/unittest.mock.rst:1438 msgid "" @@ -1458,7 +1609,7 @@ msgid "" "`MagicMock` if patch is creating one for you." msgstr "" "patch が :class:`MagicMock` を生成する場合、 *spec* と *spec_set* キーワード" -"引数は :class:`MagicMock` に渡されます。" +"引数は ``MagicMock`` に渡されます。" #: ../../library/unittest.mock.rst:1447 msgid "" @@ -1468,12 +1619,15 @@ msgstr "" "加えて、 ``spec=True`` もしくは ``spec_set=True`` を渡すことで、モック対象の" "オブジェクトが spec/spec_set に渡されます。" -#: ../../library/unittest.mock.rst:1450 msgid "" "*new_callable* allows you to specify a different class, or callable object, " "that will be called to create the *new* object. By default :class:" "`AsyncMock` is used for async functions and :class:`MagicMock` for the rest." msgstr "" +"*new_callable* には、*new* オブジェクトを作成するために呼び出す別のクラスや呼" +"び出し可能オブジェクトを指定できます。\n" +"デフォルトでは、非同期関数には :class:`AsyncMock`、それ以外には :class:" +"`MagicMock` を使います。" #: ../../library/unittest.mock.rst:1454 msgid "" @@ -1503,7 +1657,6 @@ msgstr "" "``autospec=True`` の代わりに、 ``autospec=some_object`` と指定することができ" "ます。" -#: ../../library/unittest.mock.rst:1467 msgid "" "By default :func:`patch` will fail to replace attributes that don't exist. " "If you pass in ``create=True``, and the attribute doesn't exist, patch will " @@ -1513,6 +1666,14 @@ msgid "" "off by default because it can be dangerous. With it switched on you can " "write passing tests against APIs that don't actually exist!" msgstr "" +"デフォルトでは、:func:`patch` は存在しない属性を置き換えようとすると失敗しま" +"す。\n" +"``create=True`` を渡した場合、属性が存在しなければ、パッチを適用した関数が呼" +"び出されたときにその属性を作成し、関数の終了後に削除します。\n" +"製品コードが実行時に作成する属性のテストを書く場合に便利です。\n" +"ただし、危険を伴うためデフォルトでは無効になっています。\n" +"有効にすると、実際には存在しない API に対して成功するテストを書けてしまいま" +"す。" #: ../../library/unittest.mock.rst:1477 msgid "" @@ -1522,7 +1683,6 @@ msgstr "" "モジュールのビルトインにパッチを当てようとしているなら、 ``create=True`` を渡" "す必要はありません。それはデフォルトで追加されます。" -#: ../../library/unittest.mock.rst:1481 msgid "" "Patch can be used as a :class:`~unittest.TestCase` class decorator. It works " "by decorating each test method in the class. This reduces the boilerplate " @@ -1532,6 +1692,14 @@ msgid "" "`unittest` finds tests. You can specify an alternative prefix by setting " "``patch.TEST_PREFIX``." msgstr "" +"patch は :class:`~unittest.TestCase` のクラスデコレータとして使えます。\n" +"クラス内の各テストメソッドをデコレートすることで機能します。\n" +"複数のテストメソッドで共通のパッチを使う場合、定型的なコードを減らせます。\n" +":func:`patch` は ``patch.TEST_PREFIX`` で始まる名前のメソッドを探してテストを" +"見つけます。\n" +"デフォルト値は ``'test'`` で、:mod:`unittest` のテストの探し方と一致しま" +"す。\n" +"``patch.TEST_PREFIX`` を設定して別の接頭辞を指定できます。" #: ../../library/unittest.mock.rst:1488 msgid "" @@ -1545,12 +1713,15 @@ msgstr "" "\"as\" に続いて指定した変数にパッチされたオブジェクトが代入されます。これは :" "func:`patch` が mock オブジェクトを生成するときに便利です。" -#: ../../library/unittest.mock.rst:1493 msgid "" ":func:`patch` takes arbitrary keyword arguments. These will be passed to :" "class:`AsyncMock` if the patched object is asynchronous, to :class:" "`MagicMock` otherwise or to *new_callable* if specified." msgstr "" +":func:`patch` は任意のキーワード引数を受け取ります。\n" +"これらは、*new_callable* を指定していればそこへ渡します。\n" +"指定していなければ、パッチ対象が非同期の場合は :class:`AsyncMock`、それ以外" +"は :class:`MagicMock` に渡します。" #: ../../library/unittest.mock.rst:1497 msgid "" @@ -1568,7 +1739,6 @@ msgstr "" ":func:`patch` を関数デコレータとして利用し、 mock を生成してそれをデコレート" "された関数に渡します::" -#: ../../library/unittest.mock.rst:1503 msgid "" ">>> @patch('__main__.SomeClass')\n" "... def function(normal_argument, mock_class):\n" @@ -1577,6 +1747,12 @@ msgid "" ">>> function(None)\n" "True" msgstr "" +">>> @patch('__main__.SomeClass')\n" +"... def function(normal_argument, mock_class):\n" +"... print(mock_class is SomeClass)\n" +"...\n" +">>> function(None)\n" +"True" #: ../../library/unittest.mock.rst:1510 msgid "" @@ -1598,13 +1774,14 @@ msgstr "" "毎回新しい mock を返すようにできます。もしくは、 *return_value* に、何でも好" "きなものを設定できます。" -#: ../../library/unittest.mock.rst:1518 msgid "" "To configure return values on methods of *instances* on the patched class " "you must do this on the :attr:`~Mock.return_value`. For example::" msgstr "" +"パッチを適用したクラスの *インスタンス* のメソッドに戻り値を設定するには、:" +"attr:`~Mock.return_value` に対して設定する必要があります。\n" +"例えば次のようにします。 ::" -#: ../../library/unittest.mock.rst:1521 msgid "" ">>> class Class:\n" "... def method(self):\n" @@ -1617,6 +1794,16 @@ msgid "" "... assert Class().method() == 'foo'\n" "..." msgstr "" +">>> class Class:\n" +"... def method(self):\n" +"... pass\n" +"...\n" +">>> with patch('__main__.Class') as MockClass:\n" +"... instance = MockClass.return_value\n" +"... instance.method.return_value = 'foo'\n" +"... assert Class() is instance\n" +"... assert Class().method() == 'foo'\n" +"..." #: ../../library/unittest.mock.rst:1532 msgid "" @@ -1626,7 +1813,6 @@ msgstr "" "*spec* か *spec_set* を指定し、 :func:`patch` が *クラス* を置換するとき、生" "成された mock の戻り値は同じ spec を持ちます。::" -#: ../../library/unittest.mock.rst:1535 msgid "" ">>> Original = Class\n" ">>> patcher = patch('__main__.Class', spec=True)\n" @@ -1635,6 +1821,12 @@ msgid "" ">>> assert isinstance(instance, Original)\n" ">>> patcher.stop()" msgstr "" +">>> Original = Class\n" +">>> patcher = patch('__main__.Class', spec=True)\n" +">>> MockClass = patcher.start()\n" +">>> instance = MockClass()\n" +">>> assert isinstance(instance, Original)\n" +">>> patcher.stop()" #: ../../library/unittest.mock.rst:1542 msgid "" @@ -1646,7 +1838,6 @@ msgstr "" "モックとして生成したい場合に便利です。例えば、 :class:`NonCallableMock` を利" "用したい場合::" -#: ../../library/unittest.mock.rst:1546 msgid "" ">>> thing = object()\n" ">>> with patch('__main__.thing', new_callable=NonCallableMock) as " @@ -1658,6 +1849,15 @@ msgid "" " ...\n" "TypeError: 'NonCallableMock' object is not callable" msgstr "" +">>> thing = object()\n" +">>> with patch('__main__.thing', new_callable=NonCallableMock) as " +"mock_thing:\n" +"... assert thing is mock_thing\n" +"... thing()\n" +"...\n" +"Traceback (most recent call last):\n" +" ...\n" +"TypeError: 'NonCallableMock' object is not callable" #: ../../library/unittest.mock.rst:1555 msgid "" @@ -1667,7 +1867,6 @@ msgstr "" "別のユースケースとしては、オブジェクトを :class:`io.StringIO` インスタンスで" "置き換えることがあります::" -#: ../../library/unittest.mock.rst:1557 msgid "" ">>> from io import StringIO\n" ">>> def foo():\n" @@ -1680,6 +1879,16 @@ msgid "" "...\n" ">>> test()" msgstr "" +">>> from io import StringIO\n" +">>> def foo():\n" +"... print('Something')\n" +"...\n" +">>> @patch('sys.stdout', new_callable=StringIO)\n" +"... def test(mock_stdout):\n" +"... foo()\n" +"... assert mock_stdout.getvalue() == 'Something\\n'\n" +"...\n" +">>> test()" #: ../../library/unittest.mock.rst:1568 msgid "" @@ -1692,7 +1901,6 @@ msgstr "" "をセットアップすることです。幾らかのセットアップは patch の呼び出しから行うこ" "とができます。任意のキーワード引数が、生成された mock の属性に設定されます::" -#: ../../library/unittest.mock.rst:1573 msgid "" ">>> patcher = patch('__main__.thing', first='one', second='two')\n" ">>> mock_thing = patcher.start()\n" @@ -1701,6 +1909,12 @@ msgid "" ">>> mock_thing.second\n" "'two'" msgstr "" +">>> patcher = patch('__main__.thing', first='one', second='two')\n" +">>> mock_thing = patcher.start()\n" +">>> mock_thing.first\n" +"'one'\n" +">>> mock_thing.second\n" +"'two'" #: ../../library/unittest.mock.rst:1580 msgid "" @@ -1715,7 +1929,6 @@ msgstr "" "では直接指定できませんが、それらをキーとする辞書を ``**`` を使って :func:" "`patch` に渡すことができます::" -#: ../../library/unittest.mock.rst:1586 msgid "" ">>> config = {'method.return_value': 3, 'other.side_effect': KeyError}\n" ">>> patcher = patch('__main__.thing', **config)\n" @@ -1727,15 +1940,24 @@ msgid "" " ...\n" "KeyError" msgstr "" +">>> config = {'method.return_value': 3, 'other.side_effect': KeyError}\n" +">>> patcher = patch('__main__.thing', **config)\n" +">>> mock_thing = patcher.start()\n" +">>> mock_thing.method()\n" +"3\n" +">>> mock_thing.other()\n" +"Traceback (most recent call last):\n" +" ...\n" +"KeyError" -#: ../../library/unittest.mock.rst:1596 msgid "" "By default, attempting to patch a function in a module (or a method or an " "attribute in a class) that does not exist will fail with :exc:" "`AttributeError`::" msgstr "" +"デフォルトでは、モジュールに存在しない関数 (またはクラスに存在しないメソッド" +"や属性) にパッチを適用しようとすると :exc:`AttributeError` で失敗します。 ::" -#: ../../library/unittest.mock.rst:1599 msgid "" ">>> @patch('sys.non_existing_attribute', 42)\n" "... def test():\n" @@ -1747,12 +1969,22 @@ msgid "" "AttributeError: does not have the attribute " "'non_existing_attribute'" msgstr "" +">>> @patch('sys.non_existing_attribute', 42)\n" +"... def test():\n" +"... assert sys.non_existing_attribute == 42\n" +"...\n" +">>> test()\n" +"Traceback (most recent call last):\n" +" ...\n" +"AttributeError: does not have the attribute " +"'non_existing_attribute'" -#: ../../library/unittest.mock.rst:1608 msgid "" "but adding ``create=True`` in the call to :func:`patch` will make the " "previous example work as expected::" msgstr "" +"ただし、:func:`patch` の呼び出しに ``create=True`` を追加すると、上の例は期待" +"どおりに動作します。 ::" #: ../../library/unittest.mock.rst:1611 msgid "" @@ -1763,11 +1995,12 @@ msgid "" ">>> test()" msgstr "" -#: ../../library/unittest.mock.rst:1619 msgid "" ":func:`patch` now returns an :class:`AsyncMock` if the target is an async " "function." msgstr "" +"対象が非同期関数の場合、:func:`patch` は :class:`AsyncMock` を返すようになり" +"ました。" #: ../../library/unittest.mock.rst:1623 msgid "patch.object" @@ -1834,12 +2067,14 @@ msgstr "" msgid "patch.dict" msgstr "patch.dict" -#: ../../library/unittest.mock.rst:1663 msgid "" "Patch a dictionary, or dictionary like object, and restore the dictionary to " "its original state after the test, where the restored dictionary is a copy " "of the dictionary as it was before the test." msgstr "" +"辞書または辞書のようなオブジェクトにパッチを適用し、テスト後に元の状態に戻し" +"ます。\n" +"復元には、テスト前の辞書のコピーを使います。" #: ../../library/unittest.mock.rst:1667 msgid "" @@ -1879,30 +2114,35 @@ msgid "" msgstr "" ":func:`patch.dict` はまた、任意のキーワード引数を受け取って辞書に設定します。" -#: ../../library/unittest.mock.rst:1685 msgid "" ":func:`patch.dict` now returns the patched dictionary when used as a context " "manager." msgstr "" +":func:`patch.dict` をコンテキストマネージャとして使うと、パッチを適用した辞書" +"を返すようになりました。" -#: ../../library/unittest.mock.rst:1688 msgid "" ":func:`patch.dict` can be used as a context manager, decorator or class " "decorator:" msgstr "" +":func:`patch.dict` はコンテキストマネージャ、デコレータ、クラスデコレータとし" +"て使えます。" -#: ../../library/unittest.mock.rst:1699 msgid "" "When used as a class decorator :func:`patch.dict` honours ``patch." "TEST_PREFIX`` (default to ``'test'``) for choosing which methods to wrap:" msgstr "" +"クラスデコレータとして使う場合、:func:`patch.dict` は ``patch.TEST_PREFIX`` " +"(デフォルトは ``'test'``) に従ってラップするメソッドを選びます。" -#: ../../library/unittest.mock.rst:1710 msgid "" "If you want to use a different prefix for your test, you can inform the " "patchers of the different prefix by setting ``patch.TEST_PREFIX``. For more " "details about how to change the value of see :ref:`test-prefix`." msgstr "" +"テストに別の接頭辞を使いたい場合は、``patch.TEST_PREFIX`` を設定してパッチ処" +"理に知らせることができます。\n" +"値の変更方法の詳細は :ref:`test-prefix` を参照してください。" #: ../../library/unittest.mock.rst:1714 msgid "" @@ -1946,11 +2186,12 @@ msgstr "" "のオブジェクトをインポートするための文字列) と、パッチ用のキーワード引数を取" "ります::" -#: ../../library/unittest.mock.rst:1783 msgid "" "with patch.multiple(settings, FIRST_PATCH='one', SECOND_PATCH='two'):\n" " ..." msgstr "" +"with patch.multiple(settings, FIRST_PATCH='one', SECOND_PATCH='two'):\n" +" ..." #: ../../library/unittest.mock.rst:1786 msgid "" @@ -1997,7 +2238,6 @@ msgstr "" "場合生成されたモックはデコレート対象の関数にキーワード引数として渡されま" "す。::" -#: ../../library/unittest.mock.rst:1803 msgid "" ">>> thing = object()\n" ">>> other = object()\n" @@ -2009,6 +2249,15 @@ msgid "" "...\n" ">>> test_function()" msgstr "" +">>> thing = object()\n" +">>> other = object()\n" +"\n" +">>> @patch.multiple('__main__', thing=DEFAULT, other=DEFAULT)\n" +"... def test_function(thing, other):\n" +"... assert isinstance(thing, MagicMock)\n" +"... assert isinstance(other, MagicMock)\n" +"...\n" +">>> test_function()" #: ../../library/unittest.mock.rst:1813 msgid "" @@ -2020,7 +2269,6 @@ msgstr "" "が、キーワード引数は :func:`patch` によって作られる通常の引数の *後ろ* で受け" "取る必要があります::" -#: ../../library/unittest.mock.rst:1816 msgid "" ">>> @patch('sys.exit')\n" "... @patch.multiple('__main__', thing=DEFAULT, other=DEFAULT)\n" @@ -2031,6 +2279,14 @@ msgid "" "...\n" ">>> test_function()" msgstr "" +">>> @patch('sys.exit')\n" +"... @patch.multiple('__main__', thing=DEFAULT, other=DEFAULT)\n" +"... def test_function(mock_exit, other, thing):\n" +"... assert 'other' in repr(other)\n" +"... assert 'thing' in repr(thing)\n" +"... assert 'exit' in repr(mock_exit)\n" +"...\n" +">>> test_function()" #: ../../library/unittest.mock.rst:1825 msgid "" @@ -2042,7 +2298,6 @@ msgstr "" "キストマネージャーが返す値は、名前がキーで値が生成された mock となる辞書で" "す::" -#: ../../library/unittest.mock.rst:1828 msgid "" ">>> with patch.multiple('__main__', thing=DEFAULT, other=DEFAULT) as " "values:\n" @@ -2052,25 +2307,39 @@ msgid "" "... assert values['other'] is other\n" "..." msgstr "" +">>> with patch.multiple('__main__', thing=DEFAULT, other=DEFAULT) as " +"values:\n" +"... assert 'other' in repr(values['other'])\n" +"... assert 'thing' in repr(values['thing'])\n" +"... assert values['thing'] is thing\n" +"... assert values['other'] is other\n" +"..." #: ../../library/unittest.mock.rst:1839 msgid "patch methods: start and stop" msgstr "patch のメソッド: start と stop" -#: ../../library/unittest.mock.rst:1841 msgid "" "All the patchers have :meth:`!start` and :meth:`!stop` methods. These make " "it simpler to do patching in ``setUp`` methods or where you want to do " "multiple patches without nesting decorators or with statements." msgstr "" +"すべてのパッチ処理オブジェクトには :meth:`!start` メソッドと :meth:`!stop` メ" +"ソッドがあります。\n" +"``setUp`` メソッド内でパッチを適用したい場合や、デコレータや with 文を入れ子" +"にせず複数のパッチを適用したい場合に便利です。" -#: ../../library/unittest.mock.rst:1845 msgid "" "To use them call :func:`patch`, :func:`patch.object` or :func:`patch.dict` " "as normal and keep a reference to the returned ``patcher`` object. You can " "then call :meth:`!start` to put the patch in place and :meth:`!stop` to undo " "it." msgstr "" +"これらを使うには、通常どおり :func:`patch`、:func:`patch.object`、:func:" +"`patch.dict` のいずれかを呼び出し、戻り値の ``patcher`` オブジェクトへの参照" +"を保持します。\n" +"その後、:meth:`!start` を呼び出してパッチを適用し、:meth:`!stop` を呼び出して" +"元に戻せます。" #: ../../library/unittest.mock.rst:1849 msgid "" @@ -2080,7 +2349,6 @@ msgstr "" ":func:`patch` に mock を生成させる場合、 ``patcher.start`` の呼び出しの戻り値" "として mock を受け取れます。::" -#: ../../library/unittest.mock.rst:1852 msgid "" ">>> patcher = patch('package.module.ClassName')\n" ">>> from package import module\n" @@ -2092,14 +2360,23 @@ msgid "" ">>> assert module.ClassName is original\n" ">>> assert module.ClassName is not new_mock" msgstr "" +">>> patcher = patch('package.module.ClassName')\n" +">>> from package import module\n" +">>> original = module.ClassName\n" +">>> new_mock = patcher.start()\n" +">>> assert module.ClassName is not original\n" +">>> assert module.ClassName is new_mock\n" +">>> patcher.stop()\n" +">>> assert module.ClassName is original\n" +">>> assert module.ClassName is not new_mock" -#: ../../library/unittest.mock.rst:1863 msgid "" "A typical use case for this might be for doing multiple patches in the " "``setUp`` method of a :class:`~unittest.TestCase`::" msgstr "" +"典型的な用途として、:class:`~unittest.TestCase` の ``setUp`` メソッド内で複数" +"のパッチを適用する場合が挙げられます。 ::" -#: ../../library/unittest.mock.rst:1866 msgid "" ">>> class MyTest(unittest.TestCase):\n" "... def setUp(self):\n" @@ -2118,6 +2395,22 @@ msgid "" "...\n" ">>> MyTest('test_something').run()" msgstr "" +">>> class MyTest(unittest.TestCase):\n" +"... def setUp(self):\n" +"... self.patcher1 = patch('package.module.Class1')\n" +"... self.patcher2 = patch('package.module.Class2')\n" +"... self.MockClass1 = self.patcher1.start()\n" +"... self.MockClass2 = self.patcher2.start()\n" +"...\n" +"... def tearDown(self):\n" +"... self.patcher1.stop()\n" +"... self.patcher2.stop()\n" +"...\n" +"... def test_something(self):\n" +"... assert package.module.Class1 is self.MockClass1\n" +"... assert package.module.Class2 is self.MockClass2\n" +"...\n" +">>> MyTest('test_something').run()" #: ../../library/unittest.mock.rst:1885 msgid "" @@ -2131,7 +2424,6 @@ msgstr "" "で、これは意外に面倒です。 :meth:`unittest.TestCase.addCleanup` を使うと簡単" "にできます::" -#: ../../library/unittest.mock.rst:1890 msgid "" ">>> class MyTest(unittest.TestCase):\n" "... def setUp(self):\n" @@ -2143,6 +2435,15 @@ msgid "" "... assert package.module.Class is self.MockClass\n" "..." msgstr "" +">>> class MyTest(unittest.TestCase):\n" +"... def setUp(self):\n" +"... patcher = patch('package.module.Class')\n" +"... self.MockClass = patcher.start()\n" +"... self.addCleanup(patcher.stop)\n" +"...\n" +"... def test_something(self):\n" +"... assert package.module.Class is self.MockClass\n" +"..." #: ../../library/unittest.mock.rst:1900 msgid "" @@ -2178,7 +2479,6 @@ msgstr "" "モジュール内の任意のビルトインに対してパッチを当てることができます。以下の例" "はビルトインの :func:`ord` を修正します::" -#: ../../library/unittest.mock.rst:1918 msgid "" ">>> @patch('__main__.ord')\n" "... def test(mock_ord):\n" @@ -2188,6 +2488,13 @@ msgid "" ">>> test()\n" "101" msgstr "" +">>> @patch('__main__.ord')\n" +"... def test(mock_ord):\n" +"... mock_ord.return_value = 101\n" +"... print(ord('c'))\n" +"...\n" +">>> test()\n" +"101" #: ../../library/unittest.mock.rst:1930 msgid "TEST_PREFIX" @@ -2214,7 +2521,6 @@ msgstr "" "他の prefix を使う事もできます。その場合、 patcher にその prefix を ``patch." "TEST_PREFIX`` に設定することで教えることができます::" -#: ../../library/unittest.mock.rst:1940 msgid "" ">>> patch.TEST_PREFIX = 'foo'\n" ">>> value = 3\n" @@ -2234,6 +2540,23 @@ msgid "" ">>> value\n" "3" msgstr "" +">>> patch.TEST_PREFIX = 'foo'\n" +">>> value = 3\n" +">>>\n" +">>> @patch('__main__.value', 'not three')\n" +"... class Thing:\n" +"... def foo_one(self):\n" +"... print(value)\n" +"... def foo_two(self):\n" +"... print(value)\n" +"...\n" +">>>\n" +">>> Thing().foo_one()\n" +"not three\n" +">>> Thing().foo_two()\n" +"not three\n" +">>> value\n" +"3" #: ../../library/unittest.mock.rst:1960 msgid "Nesting Patch Decorators" @@ -2293,7 +2616,6 @@ msgstr "" "次のような構造を持ったプロジェクトをテストしようとしていると仮定してくださ" "い::" -#: ../../library/unittest.mock.rst:2002 msgid "" "a.py\n" " -> Defines SomeClass\n" @@ -2302,8 +2624,13 @@ msgid "" " -> from a import SomeClass\n" " -> some_function instantiates SomeClass" msgstr "" +"a.py\n" +" -> SomeClass を定義する\n" +"\n" +"b.py\n" +" -> from a import SomeClass\n" +" -> some_function が SomeClass をインスタンス化する" -#: ../../library/unittest.mock.rst:2009 msgid "" "Now we want to test ``some_function`` but we want to mock out ``SomeClass`` " "using :func:`patch`. The problem is that when we import module b, which we " @@ -2312,6 +2639,14 @@ msgid "" "module b already has a reference to the *real* ``SomeClass`` and it looks " "like our patching had no effect." msgstr "" +"ここで ``some_function`` をテストするため、:func:`patch` で ``SomeClass`` を" +"モックに置き換えたいとします。\n" +"問題は、テストに必要なモジュール b をインポートすると、b がモジュール a から " +"``SomeClass`` をインポートすることです。\n" +":func:`patch` で ``a.SomeClass`` をモックに置き換えても、テストには影響しませ" +"ん。\n" +"モジュール b はすでに *本物の* ``SomeClass`` への参照を持っているため、パッチ" +"が効いていないように見えます。" #: ../../library/unittest.mock.rst:2016 msgid "" @@ -2325,9 +2660,8 @@ msgstr "" "ンポートされた ``SomeClass`` をルックアップしています。なのでパッチは次のよう" "にしなければなりません::" -#: ../../library/unittest.mock.rst:2020 msgid "@patch('b.SomeClass')" -msgstr "" +msgstr "@patch('b.SomeClass')" #: ../../library/unittest.mock.rst:2022 msgid "" @@ -2343,9 +2677,8 @@ msgstr "" "はそのモジュールからルックアップされているので、 ``a.SomeClass`` をパッチする" "必要があります::" -#: ../../library/unittest.mock.rst:2027 msgid "@patch('a.SomeClass')" -msgstr "" +msgstr "@patch('a.SomeClass')" #: ../../library/unittest.mock.rst:2031 msgid "Patching Descriptors and Proxy Objects" @@ -2375,12 +2708,15 @@ msgstr "MagicMock と magic method のサポート" msgid "Mocking Magic Methods" msgstr "Magic Method をモックする" -#: ../../library/unittest.mock.rst:2048 msgid "" ":class:`Mock` supports mocking the Python protocol methods, also known as :" "term:`\"magic methods\" `. This allows mock objects to replace " "containers or other objects that implement Python protocols." msgstr "" +":class:`Mock` は、:term:`特殊メソッド ` とも呼ばれる Python の" +"プロトコルメソッドのモックをサポートしています。\n" +"これにより、コンテナや、Python のプロトコルを実装した他のオブジェクトをモック" +"オブジェクトで置き換えられます。" #: ../../library/unittest.mock.rst:2052 msgid "" @@ -2462,23 +2798,27 @@ msgstr "" "``__contains__``, ``__len__``, ``__iter__``, ``__reversed__``, " "``__missing__``" -#: ../../library/unittest.mock.rst:2110 msgid "" "Context manager: ``__enter__``, ``__exit__``, ``__aenter__`` and " "``__aexit__``" msgstr "" +"コンテキストマネージャ: ``__enter__``、``__exit__``、``__aenter__``、" +"``__aexit__``" #: ../../library/unittest.mock.rst:2111 msgid "Unary numeric methods: ``__neg__``, ``__pos__`` and ``__invert__``" msgstr "単項算術メソッド: ``__neg__``, ``__pos__``, ``__invert__``" -#: ../../library/unittest.mock.rst:2112 msgid "" "The numeric methods (including right hand and in-place variants): " "``__add__``, ``__sub__``, ``__mul__``, ``__matmul__``, ``__truediv__``, " "``__floordiv__``, ``__mod__``, ``__divmod__``, ``__lshift__``, " "``__rshift__``, ``__and__``, ``__xor__``, ``__or__``, and ``__pow__``" msgstr "" +"数値演算メソッド (右側のオペランド用とインプレース演算用のものも含む): " +"``__add__``、``__sub__``、``__mul__``、``__matmul__``、``__truediv__``、" +"``__floordiv__``、``__mod__``、``__divmod__``、``__lshift__``、" +"``__rshift__``、``__and__``、``__xor__``、``__or__``、``__pow__``" #: ../../library/unittest.mock.rst:2116 msgid "" @@ -2499,23 +2839,20 @@ msgstr "" "pickle: ``__reduce__``, ``__reduce_ex__``, ``__getinitargs__``, " "``__getnewargs__``, ``__getstate__``, ``__setstate__``" -#: ../../library/unittest.mock.rst:2121 msgid "File system path representation: ``__fspath__``" -msgstr "" +msgstr "ファイルシステムのパス表現: ``__fspath__``" -#: ../../library/unittest.mock.rst:2122 msgid "Asynchronous iteration methods: ``__aiter__`` and ``__anext__``" -msgstr "" +msgstr "非同期イテレーションのメソッド: ``__aiter__``、``__anext__``" -#: ../../library/unittest.mock.rst:2124 msgid "Added support for :func:`os.PathLike.__fspath__`." -msgstr "" +msgstr ":func:`os.PathLike.__fspath__` に対応しました。" -#: ../../library/unittest.mock.rst:2127 msgid "" "Added support for ``__aenter__``, ``__aexit__``, ``__aiter__`` and " "``__anext__``." msgstr "" +"``__aenter__``、``__aexit__``、``__aiter__``、``__anext__`` に対応しました。" #: ../../library/unittest.mock.rst:2131 msgid "" @@ -2547,12 +2884,14 @@ msgstr "" "``MagicMock`` 系のクラスは2種類あります: :class:`MagicMock` と :class:" "`NonCallableMagicMock` です。" -#: ../../library/unittest.mock.rst:2147 msgid "" "``MagicMock`` is a subclass of :class:`Mock` with default implementations of " "most of the :term:`magic methods `. You can use ``MagicMock`` " "without having to configure the magic methods yourself." msgstr "" +"``MagicMock`` は、:term:`特殊メソッド ` の大半についてデフォル" +"トの実装を備えた :class:`Mock` のサブクラスです。\n" +"特殊メソッドを自分で設定せずに ``MagicMock`` を使えます。" #: ../../library/unittest.mock.rst:2151 msgid "The constructor parameters have the same meaning as for :class:`Mock`." @@ -2605,21 +2944,17 @@ msgstr "" msgid "Methods and their defaults:" msgstr "メソッドとそのデフォルト値:" -#: ../../library/unittest.mock.rst:2183 msgid "``__lt__``: :data:`NotImplemented`" -msgstr "" +msgstr "``__lt__``: :data:`NotImplemented`" -#: ../../library/unittest.mock.rst:2184 msgid "``__gt__``: :data:`!NotImplemented`" -msgstr "" +msgstr "``__gt__``: :data:`!NotImplemented`" -#: ../../library/unittest.mock.rst:2185 msgid "``__le__``: :data:`!NotImplemented`" -msgstr "" +msgstr "``__le__``: :data:`!NotImplemented`" -#: ../../library/unittest.mock.rst:2186 msgid "``__ge__``: :data:`!NotImplemented`" -msgstr "" +msgstr "``__ge__``: :data:`!NotImplemented`" #: ../../library/unittest.mock.rst:2187 msgid "``__int__``: ``1``" @@ -2677,15 +3012,17 @@ msgstr "``__sizeof__``: mock のデフォルトの sizeof" msgid "For example:" msgstr "例えば:" -#: ../../library/unittest.mock.rst:2213 msgid "" "The two equality methods, :meth:`!__eq__` and :meth:`!__ne__`, are special. " "They do the default equality comparison on identity, using the :attr:`~Mock." "side_effect` attribute, unless you change their return value to return " "something else::" msgstr "" +"等価性を比較する 2 つのメソッド :meth:`!__eq__` と :meth:`!__ne__` は特別で" +"す。\n" +"戻り値を別の値に変更しない限り、:attr:`~Mock.side_effect` 属性を使って、オブ" +"ジェクトの同一性に基づくデフォルトの等価性比較を行います。 ::" -#: ../../library/unittest.mock.rst:2218 msgid "" ">>> MagicMock() == 3\n" "False\n" @@ -2696,6 +3033,14 @@ msgid "" ">>> mock == 3\n" "True" msgstr "" +">>> MagicMock() == 3\n" +"False\n" +">>> MagicMock() != 3\n" +"True\n" +">>> mock = MagicMock()\n" +">>> mock.__eq__.return_value = True\n" +">>> mock == 3\n" +"True" #: ../../library/unittest.mock.rst:2227 msgid "" @@ -2713,15 +3058,14 @@ msgstr "" "return_value が iterator であった場合、最初のイテレートでその iterator を消費" "してしまい、2回目以降のイテレートの結果が空になってしまいます:" -#: ../../library/unittest.mock.rst:2246 msgid "" "``MagicMock`` has all of the supported magic methods configured except for " "some of the obscure and obsolete ones. You can still set these up if you " "want." msgstr "" -"``MagicMock`` はいくつかの曖昧であったり時代遅れなものをのぞいて、対応してい" -"る magic method を事前にセットアップします。自動でセットアップされていないも" -"のも必要なら手動でセットアップすることができます。" +"``MagicMock`` では、あまり使われないものや廃れたものの一部を除き、サポートし" +"ている特殊メソッドがすべて設定済みです。\n" +"必要であれば、それらのメソッドも設定できます。" #: ../../library/unittest.mock.rst:2249 msgid "" @@ -2759,9 +3103,8 @@ msgstr "" "``__reduce__``, ``__reduce_ex__``, ``__getinitargs__``, ``__getnewargs__``, " "``__getstate__``, ``__setstate__``" -#: ../../library/unittest.mock.rst:2258 msgid "``__getformat__``" -msgstr "" +msgstr "``__getformat__``" #: ../../library/unittest.mock.rst:2262 msgid "" @@ -2808,11 +3151,12 @@ msgstr "" "必ず同じオブジェクトが返されます。返されるオブジェクトは、テスト失敗のメッ" "セージがわかりやすくなるように気が利いた repr を持ちます。" -#: ../../library/unittest.mock.rst:2285 msgid "" "The ``sentinel`` attributes now preserve their identity when they are :mod:" "`copied ` or :mod:`pickled `." msgstr "" +"``sentinel`` の属性は、:mod:`コピー ` や :mod:`pickle 化 ` の際" +"にも同一性を保つようになりました。" #: ../../library/unittest.mock.rst:2289 msgid "" @@ -3018,21 +3362,20 @@ msgstr "" "きます。そうすると、 :meth:`~Mock.assert_called_with` と :meth:`~Mock." "assert_called_once_with` は、実際の引数が何であったかに関わらず成功します。" -#: ../../library/unittest.mock.rst:2456 msgid "" ":data:`ANY` can also be used in comparisons with call lists like :attr:" "`~Mock.mock_calls`:" msgstr "" -":attr:`~Mock.mock_calls` などの call list との比較に :attr:`ANY` を使うことも" -"できます:" +":data:`ANY` は :attr:`~Mock.mock_calls` のような呼び出しリストとの比較にも使" +"えます。" -#: ../../library/unittest.mock.rst:2466 msgid "" ":data:`ANY` is not limited to comparisons with call objects and so can also " "be used in test assertions::" msgstr "" +":data:`ANY` は call オブジェクトとの比較に限らず、テストのアサートにも使えま" +"す。 ::" -#: ../../library/unittest.mock.rst:2469 msgid "" "class TestStringMethods(unittest.TestCase):\n" "\n" @@ -3040,6 +3383,11 @@ msgid "" " s = 'hello world'\n" " self.assertEqual(s.split(), ['hello', ANY])" msgstr "" +"class TestStringMethods(unittest.TestCase):\n" +"\n" +" def test_split(self):\n" +" s = 'hello world'\n" +" self.assertEqual(s.split(), ['hello', ANY])" #: ../../library/unittest.mock.rst:2477 msgid "FILTER_DIR" @@ -3072,7 +3420,6 @@ msgstr "" "て(もちろん *autospec* でも)生成された場合、元のオブジェクトのすべての属性" "が、まだアクセスされていなかったとしても、表示されます。" -#: ../../library/unittest.mock.rst:2493 msgid "" ">>> dir(Mock())\n" "['assert_any_call',\n" @@ -3092,6 +3439,23 @@ msgid "" " 'BaseHandler',\n" " ..." msgstr "" +">>> dir(Mock())\n" +"['assert_any_call',\n" +" 'assert_called',\n" +" 'assert_called_once',\n" +" 'assert_called_once_with',\n" +" 'assert_called_with',\n" +" 'assert_has_calls',\n" +" 'assert_not_called',\n" +" 'attach_mock',\n" +" ...\n" +">>> from urllib import request\n" +">>> dir(Mock(spec=request))\n" +"['AbstractBasicAuthHandler',\n" +" 'AbstractDigestAuthHandler',\n" +" 'AbstractHTTPHandler',\n" +" 'BaseHandler',\n" +" ..." #: ../../library/unittest.mock.rst:2514 msgid "" @@ -3107,7 +3471,6 @@ msgstr "" "の動作が嫌な場合は、モジュールレベルの :data:`FILTER_DIR` スイッチを設定する" "ことでフィルターを切ることができます。" -#: ../../library/unittest.mock.rst:2520 msgid "" ">>> from unittest import mock\n" ">>> mock.FILTER_DIR = False\n" @@ -3121,13 +3484,26 @@ msgid "" " '__class__',\n" " ..." msgstr "" +">>> from unittest import mock\n" +">>> mock.FILTER_DIR = False\n" +">>> dir(mock.Mock())\n" +"['_NonCallableMock__get_return_value',\n" +" '_NonCallableMock__get_side_effect',\n" +" '_NonCallableMock__return_value_doc',\n" +" '_NonCallableMock__set_return_value',\n" +" '_NonCallableMock__set_side_effect',\n" +" '__call__',\n" +" '__class__',\n" +" ..." -#: ../../library/unittest.mock.rst:2535 msgid "" "Alternatively you can just use ``vars(my_mock)`` (instance members) and " "``dir(type(my_mock))`` (type members) to bypass the filtering irrespective " "of :const:`FILTER_DIR`." msgstr "" +"また、``vars(my_mock)`` (インスタンスのメンバー) と ``dir(type(my_mock))`` " +"(型のメンバー) を使えば、:const:`FILTER_DIR` の値にかかわらずフィルタリングを" +"回避できます。" #: ../../library/unittest.mock.rst:2541 msgid "mock_open" @@ -3152,7 +3528,6 @@ msgstr "" "常のファイルハンドルと同じ属性やメソッドにAPIが制限された :class:`MagicMock` " "が生成されます。" -#: ../../library/unittest.mock.rst:2552 msgid "" "*read_data* is a string for the :meth:`~io.RawIOBase.read`, :meth:`~io." "IOBase.readline`, and :meth:`~io.IOBase.readlines` methods of the file " @@ -3164,24 +3539,39 @@ msgid "" "one of the in-memory filesystem packages on `PyPI `_ can " "offer a realistic filesystem for testing." msgstr "" +"*read_data* は、ファイルハンドルの :meth:`~io.RawIOBase.read`、:meth:`~io." +"IOBase.readline`、:meth:`~io.IOBase.readlines` メソッドが返す文字列です。\n" +"これらのメソッドを呼び出すと、*read_data* が尽きるまでデータを取り出しま" +"す。\n" +"これらのメソッドのモックは単純なもので、*mock* を呼び出すたびに *read_data* " +"の読み取り位置が先頭に戻ります。\n" +"テスト対象のコードに渡すデータをもっと細かく制御したい場合は、このモックを自" +"分でカスタマイズする必要があります。\n" +"それでも不十分な場合は、`PyPI `_ にあるメモリ上のファイルシ" +"ステムを実装したパッケージを使うと、テスト用の現実的なファイルシステムを用意" +"できます。" -#: ../../library/unittest.mock.rst:2562 msgid "" "Added :meth:`~io.IOBase.readline` and :meth:`~io.IOBase.readlines` support. " "The mock of :meth:`~io.RawIOBase.read` changed to consume *read_data* rather " "than returning it on each call." msgstr "" +":meth:`~io.IOBase.readline` と :meth:`~io.IOBase.readlines` に対応しまし" +"た。\n" +":meth:`~io.RawIOBase.read` のモックは、呼び出しのたびに *read_data* をそのま" +"ま返すのではなく、消費するようになりました。" #: ../../library/unittest.mock.rst:2567 msgid "*read_data* is now reset on each call to the *mock*." msgstr "" "*read_data* は *mock* を呼び出す度に毎回リセットされるようになりました。" -#: ../../library/unittest.mock.rst:2570 msgid "" "Added :meth:`~container.__iter__` to implementation so that iteration (such " "as in for loops) correctly consumes *read_data*." msgstr "" +"実装に :meth:`~container.__iter__` を追加し、for ループなどのイテレーション" +"で *read_data* が正しく消費されるようになりました。" #: ../../library/unittest.mock.rst:2574 msgid "" @@ -3191,18 +3581,22 @@ msgstr "" ":func:`open` をコンテキストマネージャーとして使う方法は、ファイルが必ず適切に" "閉じられるようにする素晴らしい方法で、今では一般的になっています::" -#: ../../library/unittest.mock.rst:2577 msgid "" "with open('/some/path', 'w') as f:\n" " f.write('something')" msgstr "" +"with open('/some/path', 'w') as f:\n" +" f.write('something')" -#: ../../library/unittest.mock.rst:2580 msgid "" "The issue is that even if you mock out the call to :func:`open` it is the " "*returned object* that is used as a context manager (and has :meth:`~object." "__enter__` and :meth:`~object.__exit__` called)." msgstr "" +":func:`open` の呼び出しをモックに置き換えても、コンテキストマネージャとして使" +"われるのは *戻り値のオブジェクト* である点に注意が必要です\n" +"(:meth:`~object.__enter__` と :meth:`~object.__exit__` が呼び出されるのもその" +"オブジェクトです)。" #: ../../library/unittest.mock.rst:2584 msgid "" @@ -3212,7 +3606,6 @@ msgstr "" "コンテキストマネージャーを :class:`MagicMock` でモックするのは一般的かつ面倒" "なので、ヘルパー関数を用意しています。::" -#: ../../library/unittest.mock.rst:2587 msgid "" ">>> m = mock_open()\n" ">>> with patch('__main__.open', m):\n" @@ -3228,12 +3621,24 @@ msgid "" ">>> handle = m()\n" ">>> handle.write.assert_called_once_with('some stuff')" msgstr "" +">>> m = mock_open()\n" +">>> with patch('__main__.open', m):\n" +"... with open('foo', 'w') as h:\n" +"... h.write('some stuff')\n" +"...\n" +">>> m.mock_calls\n" +"[call('foo', 'w'),\n" +" call().__enter__(),\n" +" call().write('some stuff'),\n" +" call().__exit__(None, None, None)]\n" +">>> m.assert_called_once_with('foo', 'w')\n" +">>> handle = m()\n" +">>> handle.write.assert_called_once_with('some stuff')" #: ../../library/unittest.mock.rst:2601 msgid "And for reading files::" msgstr "ファイルの読み込みをモックする例::" -#: ../../library/unittest.mock.rst:2603 msgid "" ">>> with patch('__main__.open', mock_open(read_data='bibble')) as m:\n" "... with open('foo') as h:\n" @@ -3242,12 +3647,17 @@ msgid "" ">>> m.assert_called_once_with('foo')\n" ">>> assert result == 'bibble'" msgstr "" +">>> with patch('__main__.open', mock_open(read_data='bibble')) as m:\n" +"... with open('foo') as h:\n" +"... result = h.read()\n" +"...\n" +">>> m.assert_called_once_with('foo')\n" +">>> assert result == 'bibble'" #: ../../library/unittest.mock.rst:2614 msgid "Autospeccing" msgstr "autospec を使う" -#: ../../library/unittest.mock.rst:2616 msgid "" "Autospeccing is based on the existing :attr:`!spec` feature of mock. It " "limits the api of mocks to the api of an original object (the spec), but it " @@ -3256,6 +3666,12 @@ msgid "" "methods have the same call signature as the original so they raise a :exc:" "`TypeError` if they are called incorrectly." msgstr "" +"autospec は、既存のモックの :attr:`!spec` 機能を基盤にしています。\n" +"モックの API を元のオブジェクト (spec) の API に制限しますが、これを再帰的に" +"行う (遅延処理で実装されている) ため、\n" +"モックの属性も spec の対応する属性と同じ API だけを持ちます。\n" +"さらに、モックに置き換えた関数やメソッドは元と同じ呼び出しシグネチャを持ち、" +"誤った呼び出しに対して :exc:`TypeError` を送出します。" #: ../../library/unittest.mock.rst:2623 msgid "Before I explain how auto-speccing works, here's why it is needed." @@ -3263,7 +3679,6 @@ msgstr "" "autospec の動作について説明する前に、それが必要となる背景から説明していきま" "す。" -#: ../../library/unittest.mock.rst:2625 msgid "" ":class:`Mock` is a very powerful and flexible object, but it suffers from a " "flaw which is general to mocking. If you refactor some of your code, rename " @@ -3271,23 +3686,32 @@ msgid "" "uses mocks instead of the real objects will still pass. This means your " "tests can all pass even though your code is broken." msgstr "" +":class:`Mock` は非常に強力で柔軟なオブジェクトですが、モックに共通する弱点が" +"あります。\n" +"コードの一部をリファクタリングしてメンバーの名前を変更しても、\n" +"*古い API* を使い続けているコードのテストで本物のオブジェクトの代わりにモック" +"を使っていると、テストは成功し続けます。\n" +"つまり、コードが壊れていてもテストがすべて成功する可能性があります。" -#: ../../library/unittest.mock.rst:2633 msgid "" "Before 3.5, tests with a typo in the word assert would silently pass when " "they should raise an error. You can still achieve this behavior by passing " "``unsafe=True`` to Mock." msgstr "" +"3.5 より前では、assert の綴りを間違えたテストが、エラーになるべきなのに何も知" +"らせず成功していました。\n" +"Mock に ``unsafe=True`` を渡すと、今でもこの動作にできます。" -#: ../../library/unittest.mock.rst:2636 msgid "" "Note that this is another reason why you need integration tests as well as " "unit tests. Testing everything in isolation is all fine and dandy, but if " "you don't test how your units are \"wired together\" there is still lots of " "room for bugs that tests might have caught." msgstr "" -"各ユニットが互いにどのように接続されるかをテストしない場合、依然としてテスト" -"で見つけることができるバグの余地が多く残っています。" +"これも、単体テストだけでなく結合テストが必要な理由の 1 つです。\n" +"すべてを個別にテストするのはよいことですが、各部分が「どうつながるか」をテス" +"トしなければ、\n" +"テストで発見できたはずのバグが入り込む余地が依然として多く残ります。" #: ../../library/unittest.mock.rst:2641 msgid "" @@ -3335,7 +3759,6 @@ msgstr "" msgid "Here's an example of it in use::" msgstr "autospec の利用例::" -#: ../../library/unittest.mock.rst:2672 msgid "" ">>> from urllib import request\n" ">>> patcher = patch('__main__.request', autospec=True)\n" @@ -3345,13 +3768,23 @@ msgid "" ">>> mock_request.Request\n" "" msgstr "" +">>> from urllib import request\n" +">>> patcher = patch('__main__.request', autospec=True)\n" +">>> mock_request = patcher.start()\n" +">>> request is mock_request\n" +"True\n" +">>> mock_request.Request\n" +"" -#: ../../library/unittest.mock.rst:2680 msgid "" "You can see that :class:`!request.Request` has a spec. :class:`!request." "Request` takes two arguments in the constructor (one of which is *self*). " "Here's what happens if we try to call it incorrectly::" msgstr "" +":class:`!request.Request` に spec が設定されていることがわかります。\n" +":class:`!request.Request` のコンストラクタには 2 つの必須引数があり、そのう" +"ち 1 つは *self* です。\n" +"誤った呼び出しをすると、次のようになります。 ::" #: ../../library/unittest.mock.rst:2684 msgid "" @@ -3369,22 +3802,27 @@ msgstr "" "spec はクラスがインスタンス化されたとき (つまり spec が適用された mock の戻り" "値) にも適用されます::" -#: ../../library/unittest.mock.rst:2692 msgid "" ">>> req = request.Request('foo')\n" ">>> req\n" "" msgstr "" +">>> req = request.Request('foo')\n" +">>> req\n" +"" -#: ../../library/unittest.mock.rst:2696 msgid "" ":class:`!Request` objects are not callable, so the return value of " "instantiating our mocked out :class:`!request.Request` is a non-callable " "mock. With the spec in place any typos in our asserts will raise the correct " "error::" msgstr "" +":class:`!Request` オブジェクトは呼び出し可能ではないため、モックに置き換え" +"た :class:`!request.Request` をインスタンス化した結果も、呼び出し不可能なモッ" +"クになります。\n" +"spec を設定しておくと、アサートの綴りを間違えた場合に適切なエラーが発生しま" +"す。 ::" -#: ../../library/unittest.mock.rst:2700 msgid "" ">>> req.add_header('spam', 'eggs')\n" "\n" @@ -3394,6 +3832,13 @@ msgid "" "AttributeError: Mock object has no attribute 'assret_called_with'\n" ">>> req.add_header.assert_called_with('spam', 'eggs')" msgstr "" +">>> req.add_header('spam', 'eggs')\n" +"\n" +">>> req.add_header.assret_called_with # 意図的な綴り間違いです。\n" +"Traceback (most recent call last):\n" +" ...\n" +"AttributeError: Mock object has no attribute 'assret_called_with'\n" +">>> req.add_header.assert_called_with('spam', 'eggs')" #: ../../library/unittest.mock.rst:2708 msgid "" @@ -3412,7 +3857,6 @@ msgstr "" ":func:`patch` を経由する以外にも、 :func:`create_autospec` を使って " "*autospec* が適用された mock を直接作る方法もあります:" -#: ../../library/unittest.mock.rst:2720 msgid "" "This isn't without caveats and limitations however, which is why it is not " "the default behaviour. In order to know what attributes are available on the " @@ -3423,24 +3867,27 @@ msgid "" "be able to use autospec. On the other hand it is much better to design your " "objects so that introspection is safe [#]_." msgstr "" -"とはいえ、autospec には注意しなければならない点や制限があり、そのためデフォル" -"トでは無効になっています。spec オブジェクトでどんな属性が使えるかどうかを調べ" -"るために、autospec は spec オブジェクトをイントロスペクト (実際に属性にアクセ" -"スする) 必要があります。mock の属性を利用するとき、水面下で元のオブジェクトに" -"対しても同じ属性の探索が行われます。spec したオブジェクトのどれかがコードを実" -"行するプロパティやデスクリプタを持っている場合、autospec は正しく動きません。" -"もしくは、イントロスペクションしても安全なようにオブジェクトを設計するのがよ" +"ただし、注意点や制限があるため、これはデフォルトの動作にはなっていません。\n" +"spec オブジェクトで使える属性を知るには、autospec は spec を調べる (属性にア" +"クセスする) 必要があります。\n" +"モックの属性をたどると、内部では元のオブジェクトの対応する属性もたどりま" +"す。\n" +"spec に指定したオブジェクトに、コードの実行を引き起こすプロパティやデスクリプ" +"タがある場合は、autospec を使えないことがあります。\n" +"一方で、こうした内部調査を安全に行えるようにオブジェクトを設計する方が望まし" "いでしょう [#]_。" -#: ../../library/unittest.mock.rst:2729 msgid "" "A more serious problem is that it is common for instance attributes to be " "created in the :meth:`~object.__init__` method and not to exist on the class " "at all. *autospec* can't know about any dynamically created attributes and " "restricts the api to visible attributes. ::" msgstr "" +"さらに大きな問題は、インスタンス属性を :meth:`~object.__init__` メソッド内で" +"作成し、クラス自体には持たせないことがよくある点です。\n" +"*autospec* は動的に作成される属性を把握できず、API を見える属性に制限しま" +"す。 ::" -#: ../../library/unittest.mock.rst:2734 msgid "" ">>> class Something:\n" "... def __init__(self):\n" @@ -3454,8 +3901,18 @@ msgid "" " ...\n" "AttributeError: Mock object has no attribute 'a'" msgstr "" +">>> class Something:\n" +"... def __init__(self):\n" +"... self.a = 33\n" +"...\n" +">>> with patch('__main__.Something', autospec=True):\n" +"... thing = Something()\n" +"... thing.a\n" +"...\n" +"Traceback (most recent call last):\n" +" ...\n" +"AttributeError: Mock object has no attribute 'a'" -#: ../../library/unittest.mock.rst:2746 msgid "" "There are a few different ways of resolving this problem. The easiest, but " "not necessarily the least annoying, way is to simply set the required " @@ -3463,18 +3920,22 @@ msgid "" "you to fetch attributes that don't exist on the spec it doesn't prevent you " "setting them::" msgstr "" -"この問題を解決するためにいくつかの方法があります。一番簡単な、ただし一番面倒" -"でないとは限らない方法は、必要とされる属性を mock が生成された後に設定するこ" -"とです。 *autospec* は属性を参照することを禁止しますが、設定することは禁止し" -"ていません::" +"この問題を解決するためにいくつかの方法があります。\n" +"一番簡単な、ただし一番面倒でないとは限らない方法は、必要とされる属性を mock " +"が生成された後に設定することです。\n" +"*autospec* は spec に存在しない属性の取得を禁止しますが、その属性の設定は禁止" +"しません::" -#: ../../library/unittest.mock.rst:2752 msgid "" ">>> with patch('__main__.Something', autospec=True):\n" "... thing = Something()\n" "... thing.a = 33\n" "..." msgstr "" +">>> with patch('__main__.Something', autospec=True):\n" +"... thing = Something()\n" +"... thing.a = 33\n" +"..." #: ../../library/unittest.mock.rst:2757 msgid "" @@ -3487,7 +3948,6 @@ msgstr "" "の設定も禁止します。これはコードが正しい属性にのみ代入することを保証したいと" "きに便利ですが、もちろん先ほどの方法も制限されてしまいます:" -#: ../../library/unittest.mock.rst:2770 msgid "" "Probably the best way of solving the problem is to add class attributes as " "default values for instance members initialised in :meth:`~object.__init__`. " @@ -3495,12 +3955,18 @@ msgid "" "then providing them via class attributes (shared between instances of " "course) is faster too. e.g." msgstr "" +"おそらく最善の解決策は、:meth:`~object.__init__` で初期化するインスタンスのメ" +"ンバーに、デフォルト値としてクラス属性を追加することです。\n" +":meth:`!__init__` で属性にデフォルト値を設定するだけなら、クラス属性として用" +"意する (もちろんインスタンス間で共有されます) 方が速くもなります。\n" +"例えば次のようにします。" -#: ../../library/unittest.mock.rst:2776 msgid "" "class Something:\n" " a = 33" msgstr "" +"class Something:\n" +" a = 33" #: ../../library/unittest.mock.rst:2781 msgid "" @@ -3537,7 +4003,6 @@ msgstr "" "替オブジェクトを利用することが必要です。 :func:`patch` はこれをサポートしてい" "て、 *autospec* 引数に代替オブジェクトを渡すことができます::" -#: ../../library/unittest.mock.rst:2804 msgid "" ">>> class Something:\n" "... def __init__(self):\n" @@ -3551,6 +4016,17 @@ msgid "" ">>> mock.a\n" "" msgstr "" +">>> class Something:\n" +"... def __init__(self):\n" +"... self.a = 33\n" +"...\n" +">>> class SomethingForTest(Something):\n" +"... a = 33\n" +"...\n" +">>> p = patch('__main__.Something', autospec=SomethingForTest)\n" +">>> mock = p.start()\n" +">>> mock.a\n" +"" #: ../../library/unittest.mock.rst:2817 msgid "" @@ -3563,25 +4039,27 @@ msgstr "" "のインスタンスは生成されません。\n" "mock は属性を - :func:`dir` を呼び出して - 検索するだけです。" -#: ../../library/unittest.mock.rst:2822 msgid "Sealing mocks" -msgstr "" +msgstr "モックの封印" -#: ../../library/unittest.mock.rst:2831 msgid "" "Seal will disable the automatic creation of mocks when accessing an " "attribute of the mock being sealed or any of its attributes that are already " "mocks recursively." msgstr "" +"seal は、封印するモックの属性にアクセスした際のモックの自動作成を無効にしま" +"す。\n" +"すでにモックになっている属性についても再帰的に同じ処理を行います。" -#: ../../library/unittest.mock.rst:2834 msgid "" "If a mock instance with a name or a spec is assigned to an attribute it " "won't be considered in the sealing chain. This allows one to prevent seal " "from fixing part of the mock object. ::" msgstr "" +"名前または spec を持つモックインスタンスを属性に代入した場合、そのモックは再" +"帰的な封印の対象になりません。\n" +"これにより、モックオブジェクトの一部が seal で固定されるのを防げます。 ::" -#: ../../library/unittest.mock.rst:2838 msgid "" ">>> mock = Mock()\n" ">>> mock.submock.attribute1 = 2\n" @@ -3591,30 +4069,31 @@ msgid "" ">>> mock.submock.attribute2 # This will raise AttributeError.\n" ">>> mock.not_submock.attribute2 # This won't raise." msgstr "" +">>> mock = Mock()\n" +">>> mock.submock.attribute1 = 2\n" +">>> mock.not_submock = mock.Mock(name=\"sample_name\")\n" +">>> seal(mock)\n" +">>> mock.new_attribute # AttributeError が発生します。\n" +">>> mock.submock.attribute2 # AttributeError が発生します。\n" +">>> mock.not_submock.attribute2 # 例外は発生しません。" -#: ../../library/unittest.mock.rst:2850 msgid "" "Order of precedence of :attr:`!side_effect`, :attr:`!return_value` and " "*wraps*" -msgstr "" +msgstr ":attr:`!side_effect`、:attr:`!return_value`、*wraps* の優先順位" -#: ../../library/unittest.mock.rst:2852 msgid "The order of their precedence is:" -msgstr "" +msgstr "優先順位は次のとおりです。" -#: ../../library/unittest.mock.rst:2854 msgid ":attr:`~Mock.side_effect`" -msgstr "" +msgstr ":attr:`~Mock.side_effect`" -#: ../../library/unittest.mock.rst:2855 msgid ":attr:`~Mock.return_value`" -msgstr "" +msgstr ":attr:`~Mock.return_value`" -#: ../../library/unittest.mock.rst:2856 msgid "*wraps*" -msgstr "" +msgstr "*wraps*" -#: ../../library/unittest.mock.rst:2858 msgid "" "If all three are set, mock will return the value from :attr:`~Mock." "side_effect`, ignoring :attr:`~Mock.return_value` and the wrapped object " @@ -3622,53 +4101,67 @@ msgid "" "return the value. Regardless of the order of which was set first, the order " "of precedence remains unchanged." msgstr "" +"3 つすべてを設定すると、モックは :attr:`~Mock.return_value` とラップしたオブ" +"ジェクトをどちらも無視し、:attr:`~Mock.side_effect` から得た値を返します。\n" +"2 つを設定した場合は、優先順位が高い方から値を返します。\n" +"どれを先に設定したかにかかわらず、優先順位は変わりません。" -#: ../../library/unittest.mock.rst:2876 msgid "" "As ``None`` is the default value of :attr:`~Mock.side_effect`, if you " "reassign its value back to ``None``, the order of precedence will be checked " "between :attr:`~Mock.return_value` and the wrapped object, ignoring :attr:" "`~Mock.side_effect`." msgstr "" +":attr:`~Mock.side_effect` のデフォルト値は ``None`` なので、値を ``None`` に" +"戻すと、\n" +":attr:`~Mock.side_effect` は無視され、:attr:`~Mock.return_value` とラップした" +"オブジェクトの間で優先順位が判断されます。" -#: ../../library/unittest.mock.rst:2885 msgid "" "If the value being returned by :attr:`~Mock.side_effect` is :data:`DEFAULT`, " "it is ignored and the order of precedence moves to the successor to obtain " "the value to return." msgstr "" +":attr:`~Mock.side_effect` が返す値が :data:`DEFAULT` の場合、その値は無視さ" +"れ、優先順位が次のものから戻り値を取得します。" -#: ../../library/unittest.mock.rst:2894 msgid "" "When :class:`Mock` wraps an object, the default value of :attr:`~Mock." "return_value` will be :data:`DEFAULT`." msgstr "" +":class:`Mock` がオブジェクトをラップする場合、:attr:`~Mock.return_value` のデ" +"フォルト値は :data:`DEFAULT` になります。" -#: ../../library/unittest.mock.rst:2903 msgid "" "The order of precedence will ignore this value and it will move to the last " "successor which is the wrapped object." msgstr "" +"この値は優先順位の判断で無視され、最後の候補であるラップしたオブジェクトに進" +"みます。" -#: ../../library/unittest.mock.rst:2906 msgid "" "As the real call is being made to the wrapped object, creating an instance " "of this mock will return the real instance of the class. The positional " "arguments, if any, required by the wrapped object must be passed." msgstr "" +"ラップしたオブジェクトが実際に呼び出されるため、このモックをインスタンス化す" +"ると、そのクラスの本物のインスタンスを返します。\n" +"ラップしたオブジェクトが位置引数を必要とする場合は、それらを渡す必要がありま" +"す。" -#: ../../library/unittest.mock.rst:2924 msgid "" "But if you assign ``None`` to it, this will not be ignored as it is an " "explicit assignment. So, the order of precedence will not move to the " "wrapped object." msgstr "" +"ただし、``None`` を代入した場合は明示的な代入なので無視されません。\n" +"そのため、ラップしたオブジェクトには進みません。" -#: ../../library/unittest.mock.rst:2932 msgid "" "Even if you set all three at once when initializing the mock, the order of " "precedence remains the same:" msgstr "" +"モックの初期化時に 3 つすべてを一度に設定しても、優先順位は変わりません。" #: ../../library/unittest.mock.rst:2949 msgid "" diff --git a/library/unittest.po b/library/unittest.po index a411c5845..60587f4f9 100644 --- a/library/unittest.po +++ b/library/unittest.po @@ -25,10 +25,10 @@ msgstr "" "Last-Translator: tomo, 2025\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/unittest.rst:2 @@ -103,13 +103,13 @@ msgstr "" msgid "test suite" msgstr "テストスイート (test suite)" -#: ../../library/unittest.rst:40 msgid "" "A :dfn:`test suite` is a collection of test cases, test suites, or both. It " "is used to aggregate tests that should be executed together." msgstr "" -"テストスイート (:dfn:`test suite`) はテストケースとテストスイートの集まりで、" -"同時に実行しなければならないテストをまとめる場合に使用します。" +"テストスイート (:dfn:`test suite`) は、テストケース、テストスイート、またはそ" +"の両方の集まりです。\n" +"まとめて実行するテストを集約するために使います。" #: ../../library/unittest.rst:43 msgid "test runner" @@ -230,7 +230,6 @@ msgstr "" msgid "Here is a short script to test three string methods::" msgstr "以下は、三つの文字列メソッドをテストするスクリプトです::" -#: ../../library/unittest.rst:90 msgid "" "import unittest\n" "\n" @@ -253,6 +252,26 @@ msgid "" "if __name__ == '__main__':\n" " unittest.main()" msgstr "" +"import unittest\n" +"\n" +"class TestStringMethods(unittest.TestCase):\n" +"\n" +" def test_upper(self):\n" +" self.assertEqual('foo'.upper(), 'FOO')\n" +"\n" +" def test_isupper(self):\n" +" self.assertTrue('FOO'.isupper())\n" +" self.assertFalse('Foo'.isupper())\n" +"\n" +" def test_split(self):\n" +" s = 'hello world'\n" +" self.assertEqual(s.split(), ['hello', 'world'])\n" +" # 区切りが文字列でない場合に s.split が失敗することを確認する\n" +" with self.assertRaises(TypeError):\n" +" s.split(2)\n" +"\n" +"if __name__ == '__main__':\n" +" unittest.main()" #: ../../library/unittest.rst:112 msgid "" @@ -261,6 +280,9 @@ msgid "" "``test``. This naming convention informs the test runner about which " "methods represent tests." msgstr "" +"テストケースは、 :class:`unittest.TestCase` のサブクラスとして作成します。メ" +"ソッド名が ``test`` で始まる三つのメソッドがテストです。テストランナーはこの" +"命名規約によってテストを行うメソッドを検索します。" #: ../../library/unittest.rst:117 msgid "" @@ -307,6 +329,11 @@ msgid "" "\n" "OK" msgstr "" +"...\n" +"----------------------------------------------------------------------\n" +"Ran 3 tests in 0.000s\n" +"\n" +"OK" #: ../../library/unittest.rst:138 msgid "" @@ -317,7 +344,6 @@ msgstr "" "``-v`` オプションをテストスクリプトに渡すことで :func:`unittest.main` はより" "冗長になり、以下のような出力をします::" -#: ../../library/unittest.rst:141 msgid "" "test_isupper (__main__.TestStringMethods.test_isupper) ... ok\n" "test_split (__main__.TestStringMethods.test_split) ... ok\n" @@ -328,6 +354,14 @@ msgid "" "\n" "OK" msgstr "" +"test_isupper (__main__.TestStringMethods.test_isupper) ... ok\n" +"test_split (__main__.TestStringMethods.test_split) ... ok\n" +"test_upper (__main__.TestStringMethods.test_upper) ... ok\n" +"\n" +"----------------------------------------------------------------------\n" +"Ran 3 tests in 0.001s\n" +"\n" +"OK" #: ../../library/unittest.rst:150 msgid "" @@ -338,13 +372,12 @@ msgstr "" "上の例が :mod:`unittest` モジュールで最もよく使われる機能で、ほとんどのテスト" "ではこれで十分です。以下では全ての機能を一から解説しています。" -#: ../../library/unittest.rst:154 msgid "" "The behavior of returning a value from a test method (other than the default " "``None`` value), is now deprecated." msgstr "" -"テストメソッドが(デフォルトの``None``以外の)戻り値を返す挙動は現在非推奨で" -"す。" +"テストメソッドが(デフォルトの ``None`` 以外の)戻り値を返す挙動は現在非推奨" +"です。" #: ../../library/unittest.rst:162 msgid "Command-Line Interface" @@ -364,6 +397,9 @@ msgid "" "python -m unittest test_module.TestClass\n" "python -m unittest test_module.TestClass.test_method" msgstr "" +"python -m unittest test_module1 test_module2\n" +"python -m unittest test_module.TestClass\n" +"python -m unittest test_module.TestClass.test_method" #: ../../library/unittest.rst:171 msgid "" @@ -379,7 +415,7 @@ msgstr "テストモジュールはファイルパスで指定することも出 #: ../../library/unittest.rst:176 msgid "python -m unittest tests/test_something.py" -msgstr "" +msgstr "python -m unittest tests/test_something.py" #: ../../library/unittest.rst:178 msgid "" @@ -403,7 +439,7 @@ msgstr "テスト実行時に (より冗長な) 詳細を表示するには -v #: ../../library/unittest.rst:186 msgid "python -m unittest -v test_module" -msgstr "" +msgstr "python -m unittest -v test_module" #: ../../library/unittest.rst:188 msgid "" @@ -412,7 +448,7 @@ msgstr "引数無しで実行すると :ref:`unittest-test-discovery` が開始 #: ../../library/unittest.rst:190 msgid "python -m unittest" -msgstr "" +msgstr "python -m unittest" #: ../../library/unittest.rst:192 msgid "For a list of all the command-line options::" @@ -420,7 +456,7 @@ msgstr "コマンドラインプションの一覧を表示するには以下の #: ../../library/unittest.rst:194 msgid "python -m unittest -h" -msgstr "" +msgstr "python -m unittest -h" #: ../../library/unittest.rst:196 msgid "" @@ -430,11 +466,12 @@ msgstr "" "以前のバージョンでは、個々のテストメソッドしか実行することができず、モジュー" "ル単位やクラス単位で実行することは不可能でした。" -#: ../../library/unittest.rst:200 msgid "" "Output is colorized by default and can be :ref:`controlled using environment " "variables `." msgstr "" +"出力はデフォルトで色付きになり、:ref:`環境変数で制御できます `。" #: ../../library/unittest.rst:205 msgid "Command-line options" @@ -474,15 +511,15 @@ msgstr "" msgid "Stop the test run on the first error or failure." msgstr "初回のエラーもしくは失敗の時にテストを停止します。" -#: ../../library/unittest.rst:231 msgid "" "Only run test methods and classes that match the pattern or substring. This " "option may be used multiple times, in which case all test cases that match " "any of the given patterns are included." msgstr "" -"パターンや部分文字列にマッチするテストメソッドとテストクラスのみ実行します。" -"このオプションは複数回使うことができ、その場合はすべてのパターンにマッチする" -"テストケースが実行対象に含まれます。" +"パターンや部分文字列にマッチするテストメソッドとテストクラスのみ実行しま" +"す。\n" +"このオプションは複数回使うことができ、その場合は指定したパターンのいずれかに" +"マッチするすべてのテストケースが実行対象に含まれます。" #: ../../library/unittest.rst:235 msgid "" @@ -516,9 +553,10 @@ msgstr "" msgid "Show local variables in tracebacks." msgstr "トレースバック内の局所変数を表示します。" -#: ../../library/unittest.rst:251 msgid "Show the N slowest test cases (N=0 for all)." msgstr "" +"実行に時間がかかったテストケースを、遅い順に N 件表示します (N=0 ですべて表" +"示)。" #: ../../library/unittest.rst:253 msgid "The command-line options ``-b``, ``-c`` and ``-f`` were added." @@ -534,7 +572,7 @@ msgstr "コマンドラインオプション ``-k``。" #: ../../library/unittest.rst:262 msgid "The command-line option ``--durations``." -msgstr "" +msgstr "コマンドラインオプション ``--durations``。" #: ../../library/unittest.rst:265 msgid "" @@ -548,7 +586,6 @@ msgstr "" msgid "Test Discovery" msgstr "テストディスカバリ" -#: ../../library/unittest.rst:275 msgid "" "Unittest supports simple test discovery. In order to be compatible with test " "discovery, all of the test files must be :ref:`modules ` or :" @@ -556,12 +593,11 @@ msgid "" "project (this means that their filenames must be valid :ref:`identifiers " "`)." msgstr "" -"unittest はシンプルなテストディスカバリをサポートします。このテストディスカバ" -"リに対応するために、テストが定義された全ファイルは :ref:`modules ` もしくは :ref:`packages ` としてプロジェクトの最上位" -"のディスカバリでインポート可能である必要があります (つまり、これらのファイル" -"は :ref:`identifiers ` として有効である必要があるということで" -"す)。" +"unittest はシンプルなテストディスカバリをサポートします。\n" +"テストディスカバリを利用するには、すべてのテストファイルがプロジェクトの最上" +"位ディレクトリからインポート可能な :ref:`モジュール ` または :" +"ref:`パッケージ ` でなければなりません。\n" +"つまり、ファイル名は有効な :ref:`識別子 ` である必要があります。" #: ../../library/unittest.rst:281 msgid "" @@ -576,6 +612,8 @@ msgid "" "cd project_directory\n" "python -m unittest discover" msgstr "" +"cd project_directory\n" +"python -m unittest discover" #: ../../library/unittest.rst:289 msgid "" @@ -623,6 +661,8 @@ msgid "" "python -m unittest discover -s project_directory -p \"*_test.py\"\n" "python -m unittest discover project_directory \"*_test.py\"" msgstr "" +"python -m unittest discover -s project_directory -p \"*_test.py\"\n" +"python -m unittest discover project_directory \"*_test.py\"" #: ../../library/unittest.rst:320 msgid "" @@ -683,26 +723,34 @@ msgstr "" "ディスカバリが :term:`名前空間パッケージ ` をサポートしま" "した。" -#: ../../library/unittest.rst:347 msgid "" "Test discovery dropped the :term:`namespace packages ` " "support. It has been broken since Python 3.7. Start directory and its " "subdirectories containing tests must be regular package that have ``__init__." "py`` file." msgstr "" +"テストディスカバリでの :term:`名前空間パッケージ ` のサ" +"ポートが削除されました。\n" +"この機能は Python 3.7 以降、正常に動作していませんでした。\n" +"開始ディレクトリと、テストを含むそのサブディレクトリは、``__init__.py`` ファ" +"イルを持つ通常のパッケージでなければなりません。" -#: ../../library/unittest.rst:353 msgid "" "If the start directory is the dotted name of the package, the ancestor " "packages can be namespace packages." msgstr "" +"開始ディレクトリをパッケージのドット区切りの名前で指定する場合、上位のパッ" +"ケージは名前空間パッケージでもかまいません。" -#: ../../library/unittest.rst:356 msgid "" "Test discovery supports :term:`namespace package` as start directory again. " "To avoid scanning directories unrelated to Python, tests are not searched in " "subdirectories that do not contain ``__init__.py``." msgstr "" +"開始ディレクトリとして :term:`名前空間パッケージ ` を再び" +"サポートするようになりました。\n" +"Python と無関係なディレクトリの走査を避けるため、``__init__.py`` のないサブ" +"ディレクトリ内ではテストを検索しません。" #: ../../library/unittest.rst:365 msgid "Organizing test code" @@ -744,7 +792,6 @@ msgstr "" "のテストメソッド (すなわち名前が ``test`` で始まるメソッド) を実装するだけで" "簡単に書くことができます::" -#: ../../library/unittest.rst:381 msgid "" "import unittest\n" "\n" @@ -753,6 +800,12 @@ msgid "" " widget = Widget('The widget')\n" " self.assertEqual(widget.size(), (50, 50))" msgstr "" +"import unittest\n" +"\n" +"class DefaultWidgetSizeTestCase(unittest.TestCase):\n" +" def test_default_widget_size(self):\n" +" widget = Widget('The widget')\n" +" self.assertEqual(widget.size(), (50, 50))" #: ../../library/unittest.rst:388 msgid "" @@ -762,6 +815,11 @@ msgid "" "and :mod:`unittest` will identify the test case as a :dfn:`failure`. Any " "other exceptions will be treated as :dfn:`errors`." msgstr "" +"何らかのテストを行うには、 :class:`TestCase` ベースクラスが提供する :ref:" +"`assert\\* メソッド ` のうちの一つを使用してください。\n" +"テストが失敗した場合は、例外が説明のメッセージとともに送出され、 :mod:" +"`unittest` はテスト結果を :dfn:`failure` とします。\n" +"その他の例外は :dfn:`error` として扱われます。" #: ../../library/unittest.rst:394 msgid "" @@ -773,10 +831,8 @@ msgstr "" "テストは多くなり、それらの設定は繰り返しになるかもしれません。\n" "幸いにも、:meth:`~TestCase.setUp` メソッドを実装することで設定コードをくくり" "出すことができます。\n" -"テストフレームワークは実行するテストごとに自動的に :meth:`~TestCase.setUp` を" -"呼びます::" +"テストフレームワークは実行するテストごとに自動的に ``setUp()`` を呼びます::" -#: ../../library/unittest.rst:399 msgid "" "import unittest\n" "\n" @@ -793,6 +849,20 @@ msgid "" " self.assertEqual(self.widget.size(), (100,150),\n" " 'wrong size after resize')" msgstr "" +"import unittest\n" +"\n" +"class WidgetTestCase(unittest.TestCase):\n" +" def setUp(self):\n" +" self.widget = Widget('The widget')\n" +"\n" +" def test_default_widget_size(self):\n" +" self.assertEqual(self.widget.size(), (50,50),\n" +" 'incorrect default size')\n" +"\n" +" def test_widget_resize(self):\n" +" self.widget.resize(100,150)\n" +" self.assertEqual(self.widget.size(), (100,150),\n" +" 'wrong size after resize')" #: ../../library/unittest.rst:415 msgid "" @@ -819,7 +889,6 @@ msgstr "" "同様に、テストメソッド実行後に片付けをする :meth:`~TestCase.tearDown` メソッ" "ドを提供出来ます::" -#: ../../library/unittest.rst:426 msgid "" "import unittest\n" "\n" @@ -830,6 +899,14 @@ msgid "" " def tearDown(self):\n" " self.widget.dispose()" msgstr "" +"import unittest\n" +"\n" +"class WidgetTestCase(unittest.TestCase):\n" +" def setUp(self):\n" +" self.widget = Widget('The widget')\n" +"\n" +" def tearDown(self):\n" +" self.widget.dispose()" #: ../../library/unittest.rst:435 msgid "" @@ -878,7 +955,6 @@ msgstr "" "しかし、テストスイートの構築をカスタマイズしたい場合、自分ですることができま" "す::" -#: ../../library/unittest.rst:454 msgid "" "def suite():\n" " suite = unittest.TestSuite()\n" @@ -890,6 +966,15 @@ msgid "" " runner = unittest.TextTestRunner()\n" " runner.run(suite())" msgstr "" +"def suite():\n" +" suite = unittest.TestSuite()\n" +" suite.addTest(WidgetTestCase('test_default_widget_size'))\n" +" suite.addTest(WidgetTestCase('test_widget_resize'))\n" +" return suite\n" +"\n" +"if __name__ == '__main__':\n" +" runner = unittest.TextTestRunner()\n" +" runner.run(suite())" #: ../../library/unittest.rst:464 msgid "" @@ -924,9 +1009,8 @@ msgid "" "Test code should be modified much less frequently than the code it tests." msgstr "テストコードは、テスト対象コードほど頻繁に変更されない。" -#: ../../library/unittest.rst:478 msgid "Tested code can be refactored more easily." -msgstr "テストコードをより簡単にリファクタリングすることができる。" +msgstr "テスト対象のコードをより簡単にリファクタリングできる。" #: ../../library/unittest.rst:480 msgid "" @@ -969,13 +1053,16 @@ msgstr "" msgid "Given the following test function::" msgstr "以下のテストコードがあった場合::" -#: ../../library/unittest.rst:501 msgid "" "def testSomething():\n" " something = makeSomething()\n" " assert something.name is not None\n" " # ..." msgstr "" +"def testSomething():\n" +" something = makeSomething()\n" +" assert something.name is not None\n" +" # ..." #: ../../library/unittest.rst:506 msgid "" @@ -985,12 +1072,14 @@ msgstr "" "オプションの set-up と tear-down メソッドを持った同等のテストケースインスタン" "スは次のように作成します::" -#: ../../library/unittest.rst:509 msgid "" "testcase = unittest.FunctionTestCase(testSomething,\n" " setUp=makeSomethingDB,\n" " tearDown=deleteSomethingDB)" msgstr "" +"testcase = unittest.FunctionTestCase(testSomething,\n" +" setUp=makeSomethingDB,\n" +" tearDown=deleteSomethingDB)" #: ../../library/unittest.rst:515 msgid "" @@ -1048,7 +1137,6 @@ msgstr "" msgid "Basic skipping looks like this::" msgstr "基本的なスキップは以下のようになります::" -#: ../../library/unittest.rst:544 msgid "" "class MyTestCase(unittest.TestCase):\n" "\n" @@ -1074,6 +1162,29 @@ msgid "" " # test code that depends on the external resource\n" " pass" msgstr "" +"class MyTestCase(unittest.TestCase):\n" +"\n" +" @unittest.skip(\"demonstrating skipping\")\n" +" def test_nothing(self):\n" +" self.fail(\"shouldn't happen\")\n" +"\n" +" @unittest.skipIf(mylib.__version__ < (1, 3),\n" +" \"not supported in this library version\")\n" +" def test_format(self):\n" +" # ライブラリの特定のバージョンでだけ動作するテスト\n" +" pass\n" +"\n" +" @unittest.skipUnless(sys.platform.startswith(\"win\"), \"requires " +"Windows\")\n" +" def test_windows_support(self):\n" +" # Windows 固有のテストコード\n" +" pass\n" +"\n" +" def test_maybe_skipped(self):\n" +" if not external_resource_available():\n" +" self.skipTest(\"external resource not available\")\n" +" # 外部リソースに依存するテストコード\n" +" pass" #: ../../library/unittest.rst:567 msgid "This is the output of running the example above in verbose mode::" @@ -1096,25 +1207,26 @@ msgid "" "OK (skipped=4)" msgstr "" -#: ../../library/unittest.rst:579 msgid "Classes can be skipped just like methods::" -msgstr "テストクラスは以下のようにメソッドをスキップすることができます::" +msgstr "メソッドと同じように、クラス全体もスキップできます。 ::" -#: ../../library/unittest.rst:581 msgid "" "@unittest.skip(\"showing class skipping\")\n" "class MySkippedTestCase(unittest.TestCase):\n" " def test_not_run(self):\n" " pass" msgstr "" +"@unittest.skip(\"showing class skipping\")\n" +"class MySkippedTestCase(unittest.TestCase):\n" +" def test_not_run(self):\n" +" pass" -#: ../../library/unittest.rst:586 msgid "" ":meth:`TestCase.setUp` can also skip the test. This is useful when a " "resource that needs to be set up is not available." msgstr "" -":meth:`TestCase.setUp` もスキップすることができます。この機能はセットアップの" -"対象のリソースが使用不可能な時に便利です。" +":meth:`TestCase.setUp` からもテストをスキップできます。\n" +"準備が必要なリソースを利用できない場合に便利です。" #: ../../library/unittest.rst:589 msgid "Expected failures use the :func:`expectedFailure` decorator. ::" @@ -1122,13 +1234,16 @@ msgstr "" "予期された失敗の機能を使用するには :func:`expectedFailure` デコレータを使いま" "す。 ::" -#: ../../library/unittest.rst:591 msgid "" "class ExpectedFailureTestCase(unittest.TestCase):\n" " @unittest.expectedFailure\n" " def test_fail(self):\n" " self.assertEqual(1, 0, \"broken\")" msgstr "" +"class ExpectedFailureTestCase(unittest.TestCase):\n" +" @unittest.expectedFailure\n" +" def test_fail(self):\n" +" self.assertEqual(1, 0, \"broken\")" #: ../../library/unittest.rst:596 msgid "" @@ -1140,13 +1255,16 @@ msgstr "" "のスキップしたい時点で :func:`skip` を呼び出します。 以下のデコレータはオブ" "ジェクトに指定した属性が無い場合にテストをスキップします::" -#: ../../library/unittest.rst:600 msgid "" "def skipUnlessHasattr(obj, attr):\n" " if hasattr(obj, attr):\n" " return lambda func: func\n" " return unittest.skip(\"{!r} doesn't have {!r}\".format(obj, attr))" msgstr "" +"def skipUnlessHasattr(obj, attr):\n" +" if hasattr(obj, attr):\n" +" return lambda func: func\n" +" return unittest.skip(\"{!r} doesn't have {!r}\".format(obj, attr))" #: ../../library/unittest.rst:605 msgid "" @@ -1171,17 +1289,16 @@ msgstr "*condition* が真の場合、デコレートしたテストをスキッ msgid "Skip the decorated test unless *condition* is true." msgstr "*condition* が偽の場合、デコレートしたテストをスキップします。" -#: ../../library/unittest.rst:622 msgid "" "Mark the test as an expected failure or error. If the test fails or errors " "in the test function itself (rather than in one of the :dfn:`test fixture` " "methods) then it will be considered a success. If the test passes, it will " "be considered a failure." msgstr "" -"失敗またはエラーが予測されるものとしてテストをマークします。テストが失敗する" -"か (:dfn:`test fixture` メソッドのいずれかではなく、) テスト関数そのものでエ" -"ラーとなった場合に成功したとみなされます。テストが成功した場合は失敗とみなさ" -"れます。" +"失敗またはエラーが予期されるテストとしてマークします。\n" +":dfn:`test fixture` のメソッドではなくテスト関数自体で失敗またはエラーが起き" +"た場合は、成功とみなされます。\n" +"テストが成功した場合は、失敗とみなされます。" #: ../../library/unittest.rst:629 msgid "This exception is raised to skip a test." @@ -1195,18 +1312,18 @@ msgstr "" "ふつうはこれを直接送出する代わりに :meth:`TestCase.skipTest` やスキッピングデ" "コレータの一つを使用出来ます。" -#: ../../library/unittest.rst:634 msgid "" "Skipped tests will not have :meth:`~TestCase.setUp` or :meth:`~TestCase." "tearDown` run around them. Skipped classes will not have :meth:`~TestCase." "setUpClass` or :meth:`~TestCase.tearDownClass` run. Skipped modules will not " "have :func:`setUpModule` or :func:`tearDownModule` run." msgstr "" -"スキップしたテストの前後では、 :meth:`~TestCase.setUp` および :meth:" -"`~TestCase.tearDown` は実行されません。同様に、スキップしたクラスの前後で" -"は、 :meth:`~TestCase.setUpClass` および :meth:`~TestCase.tearDownClass` は実" -"行されません。スキップしたモジュールの前後では、 :meth:`setUpModule` および :" -"meth:`tearDownModule` は実行されません。" +"スキップされるテストでは、前後の :meth:`~TestCase.setUp` と :meth:`~TestCase." +"tearDown` は実行されません。\n" +"スキップされるクラスでは、:meth:`~TestCase.setUpClass` と :meth:`~TestCase." +"tearDownClass` は実行されません。\n" +"スキップされるモジュールでは、:func:`setUpModule` と :func:`tearDownModule` " +"は実行されません。" #: ../../library/unittest.rst:642 msgid "Distinguishing test iterations using subtests" @@ -1226,7 +1343,6 @@ msgstr "" msgid "For example, the following test::" msgstr "例えば以下のテストは::" -#: ../../library/unittest.rst:652 msgid "" "class NumbersTest(unittest.TestCase):\n" "\n" @@ -1238,12 +1354,20 @@ msgid "" " with self.subTest(i=i):\n" " self.assertEqual(i % 2, 0)" msgstr "" +"class NumbersTest(unittest.TestCase):\n" +"\n" +" def test_even(self):\n" +" \"\"\"\n" +" Test that numbers between 0 and 5 are all even.\n" +" \"\"\"\n" +" for i in range(0, 6):\n" +" with self.subTest(i=i):\n" +" self.assertEqual(i % 2, 0)" #: ../../library/unittest.rst:662 msgid "will produce the following output::" msgstr "以下の出力をします::" -#: ../../library/unittest.rst:664 msgid "" "======================================================================\n" "FAIL: test_even (__main__.NumbersTest.test_even) (i=1)\n" @@ -1275,6 +1399,35 @@ msgid "" " ^^^^^^^^^^^^^^^^^^^^^^^^^^\n" "AssertionError: 1 != 0" msgstr "" +"======================================================================\n" +"FAIL: test_even (__main__.NumbersTest.test_even) (i=1)\n" +"Test that numbers between 0 and 5 are all even.\n" +"----------------------------------------------------------------------\n" +"Traceback (most recent call last):\n" +" File \"subtests.py\", line 11, in test_even\n" +" self.assertEqual(i % 2, 0)\n" +" ^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +"AssertionError: 1 != 0\n" +"\n" +"======================================================================\n" +"FAIL: test_even (__main__.NumbersTest.test_even) (i=3)\n" +"Test that numbers between 0 and 5 are all even.\n" +"----------------------------------------------------------------------\n" +"Traceback (most recent call last):\n" +" File \"subtests.py\", line 11, in test_even\n" +" self.assertEqual(i % 2, 0)\n" +" ^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +"AssertionError: 1 != 0\n" +"\n" +"======================================================================\n" +"FAIL: test_even (__main__.NumbersTest.test_even) (i=5)\n" +"Test that numbers between 0 and 5 are all even.\n" +"----------------------------------------------------------------------\n" +"Traceback (most recent call last):\n" +" File \"subtests.py\", line 11, in test_even\n" +" self.assertEqual(i % 2, 0)\n" +" ^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +"AssertionError: 1 != 0" #: ../../library/unittest.rst:694 msgid "" @@ -1285,7 +1438,6 @@ msgstr "" "サブテスト無しの場合、最初の失敗で実行は停止し、``i`` の値が表示されないため" "エラーの原因を突き止めるのは困難になります::" -#: ../../library/unittest.rst:698 msgid "" "======================================================================\n" "FAIL: test_even (__main__.NumbersTest.test_even)\n" @@ -1295,6 +1447,13 @@ msgid "" " self.assertEqual(i % 2, 0)\n" "AssertionError: 1 != 0" msgstr "" +"======================================================================\n" +"FAIL: test_even (__main__.NumbersTest.test_even)\n" +"----------------------------------------------------------------------\n" +"Traceback (most recent call last):\n" +" File \"subtests.py\", line 32, in test_even\n" +" self.assertEqual(i % 2, 0)\n" +"AssertionError: 1 != 0" #: ../../library/unittest.rst:710 msgid "Classes and functions" @@ -1344,14 +1503,13 @@ msgstr "" "なりました。これにより対話的インタプリタから :class:`TestCase` を簡単に試せる" "ようになりました。" -#: ../../library/unittest.rst:739 msgid "" ":class:`TestCase` instances provide three groups of methods: one group used " "to run the test, another used by the test implementation to check conditions " "and report failures, and some inquiry methods allowing information about the " "test itself to be gathered." msgstr "" -":class:`TestCase` のインスタンスのメソッドは3種類のグループを提供します。 \n" +":class:`TestCase` のインスタンスのメソッドは3種類のグループを提供します。\n" "1つ目のグループはテストの実行で使用されます。\n" "2つ目のグループは条件のチェックおよび失敗のレポートを行うテストの実装で使用さ" "れます。\n" @@ -1407,12 +1565,14 @@ msgstr "" "``setUpClass`` はクラスを唯一の引数として取り、 :func:`classmethod` でデコ" "レートされていなければなりません::" -#: ../../library/unittest.rst:773 msgid "" "@classmethod\n" "def setUpClass(cls):\n" " ..." msgstr "" +"@classmethod\n" +"def setUpClass(cls):\n" +" ..." #: ../../library/unittest.rst:777 ../../library/unittest.rst:792 msgid "See `Class and Module Fixtures`_ for more details." @@ -1428,12 +1588,14 @@ msgstr "" "``tearDownClass`` はクラスを唯一の引数として取り、 :func:`classmethod` でデコ" "レートされていなければなりません::" -#: ../../library/unittest.rst:788 msgid "" "@classmethod\n" "def tearDownClass(cls):\n" " ..." msgstr "" +"@classmethod\n" +"def tearDownClass(cls):\n" +" ..." #: ../../library/unittest.rst:799 msgid "" @@ -1459,27 +1621,26 @@ msgid "" "Previous versions of ``run`` did not return the result. Neither did calling " "an instance." msgstr "" -"以前のバージョンの ``run`` は結果オブジェクトを返しませんでした。また :class:" -"`TestCase` インスタンスを呼び出した場合も同様でした。" +"以前のバージョンの ``run`` は結果オブジェクトを返しませんでした。また " +"``TestCase`` インスタンスを呼び出した場合も同様でした。" -#: ../../library/unittest.rst:814 msgid "" "Calling this during a test method or :meth:`setUp` skips the current test. " "See :ref:`unittest-skipping` for more information." msgstr "" -"テストメソッドや :meth:`setUp` が現在のテストをスキップする間に呼ばれます。詳" -"細については、 :ref:`unittest-skipping` を参照してください。" +"テストメソッドや :meth:`setUp` の中で呼び出すと、現在のテストをスキップしま" +"す。\n" +"詳しくは :ref:`unittest-skipping` を参照してください。" -#: ../../library/unittest.rst:822 msgid "" "Return a context manager which executes the enclosed code block as a " "subtest. *msg* and *params* are optional, arbitrary values which are " "displayed whenever a subtest fails, allowing you to identify them clearly." msgstr "" -"このメソッドを囲っているブロックをサブテストとして実行するコンテキストマネー" -"ジャを返します。\n" -"*msg* と *params* はサブテストが失敗したときに表示されるオプションの任意の値" -"で、どんな値が使われたかを明確にするものです。" +"with ブロック内のコードをサブテストとして実行するコンテキストマネージャを返し" +"ます。\n" +"*msg* と *params* は省略可能な任意の値で、サブテストが失敗すると表示されるた" +"め、サブテストを明確に識別できます。" #: ../../library/unittest.rst:827 msgid "" @@ -1644,11 +1805,11 @@ msgstr "``not isinstance(a, b)``" #: ../../library/unittest.rst:886 msgid ":meth:`assertIsSubclass(a, b) `" -msgstr "" +msgstr ":meth:`assertIsSubclass(a, b) `" #: ../../library/unittest.rst:886 msgid "``issubclass(a, b)``" -msgstr "" +msgstr "``issubclass(a, b)``" #: ../../library/unittest.rst:886 ../../library/unittest.rst:889 #: ../../library/unittest.rst:1228 ../../library/unittest.rst:1231 @@ -1659,11 +1820,11 @@ msgstr "3.14" #: ../../library/unittest.rst:889 msgid ":meth:`assertNotIsSubclass(a, b) `" -msgstr "" +msgstr ":meth:`assertNotIsSubclass(a, b) `" #: ../../library/unittest.rst:889 msgid "``not issubclass(a, b)``" -msgstr "" +msgstr "``not issubclass(a, b)``" #: ../../library/unittest.rst:893 msgid "" @@ -1687,7 +1848,6 @@ msgstr "" "*first* と *second* が等しいことをテストします。両者が等しくない場合、テスト" "は失敗です。" -#: ../../library/unittest.rst:904 msgid "" "In addition, if *first* and *second* are the exact same type and one of " "list, tuple, dict, set, frozenset or str or any type that a subclass " @@ -1696,11 +1856,12 @@ msgid "" "message (see also the :ref:`list of type-specific methods `)." msgstr "" -"さらに、 *first* と *second* が厳密に同じ型であり、list、tuple、dict、set、" -"frozenset もしくは str のいずれか、またはサブクラスが :meth:" -"`addTypeEqualityFunc` に登録されている任意の型の場合、より有用なデフォルトの" -"エラーメッセージを生成するために、その型特有の比較関数が呼ばれます(:ref:`型" -"固有のメソッドの一覧 ` も参照してください)。" +"さらに、*first* と *second* が厳密に同じ型であり、\n" +"その型が list、tuple、dict、set、frozenset、str のいずれか、\n" +"またはサブクラスが :meth:`addTypeEqualityFunc` で登録した型の場合は、\n" +"より有用なデフォルトのエラーメッセージを生成するために、その型に固有の等価性" +"判定関数が呼ばれます\n" +"(:ref:`型固有のメソッドの一覧 ` も参照してください)。" #: ../../library/unittest.rst:911 msgid "Added the automatic calling of type-specific equality function." @@ -1769,12 +1930,17 @@ msgstr "" "スのタプルである必要があります)。正確な型をチェックするためには、 :func:" "`assertIs(type(obj), cls) ` を使用してください。" -#: ../../library/unittest.rst:973 msgid "" "Test that *cls* is (or is not) a subclass of *superclass* (which can be a " "class or a tuple of classes, as supported by :func:`issubclass`). To check " "for the exact type, use :func:`assertIs(cls, superclass) `." msgstr "" +"*cls* が *superclass* のサブクラスであること (またはそうでないこと) をテスト" +"します。\n" +"*superclass* には :func:`issubclass` と同様に、クラスまたはクラスのタプルを指" +"定できます。\n" +"型が厳密に一致するか調べるには :func:`assertIs(cls, superclass) ` " +"を使ってください。" #: ../../library/unittest.rst:980 msgid "" @@ -1832,9 +1998,8 @@ msgstr "" msgid ":meth:`assertLogs(logger, level) `" msgstr ":meth:`assertLogs(logger, level) `" -#: ../../library/unittest.rst:998 msgid "The ``with`` block logs on *logger* with minimum *level*" -msgstr "``with`` ブロックが 最低 *level* で *logger* を使用する" +msgstr "``with`` ブロックが *logger* に *level* 以上のレベルでログを出力する" #: ../../library/unittest.rst:998 msgid "3.4" @@ -1844,13 +2009,11 @@ msgstr "3.4" msgid ":meth:`assertNoLogs(logger, level) `" msgstr ":meth:`assertNoLogs(logger, level) `" -#: ../../library/unittest.rst:1001 msgid "The ``with`` block does not log on" -msgstr "" +msgstr "``with`` ブロックがログを出力しない:" -#: ../../library/unittest.rst:1002 msgid "*logger* with minimum *level*" -msgstr "" +msgstr "*logger* に *level* 以上のレベルで" #: ../../library/unittest.rst:1001 msgid "3.10" @@ -1881,11 +2044,12 @@ msgstr "" "テキストマネージャが返されます。これにより関数名を渡す形式ではなく、インライ" "ンでテスト対象のコードを書くことができます::" -#: ../../library/unittest.rst:1019 msgid "" "with self.assertRaises(SomeException):\n" " do_something()" msgstr "" +"with self.assertRaises(SomeException):\n" +" do_something()" #: ../../library/unittest.rst:1022 msgid "" @@ -1904,7 +2068,6 @@ msgstr "" "このコンテキストマネージャは :attr:`exception` で指定されたオブジェクトを格納" "します。これにより、例外発生時の詳細な確認をおこなうことができます::" -#: ../../library/unittest.rst:1029 msgid "" "with self.assertRaises(SomeException) as cm:\n" " do_something()\n" @@ -1912,6 +2075,11 @@ msgid "" "the_exception = cm.exception\n" "self.assertEqual(the_exception.error_code, 3)" msgstr "" +"with self.assertRaises(SomeException) as cm:\n" +" do_something()\n" +"\n" +"the_exception = cm.exception\n" +"self.assertEqual(the_exception.error_code, 3)" #: ../../library/unittest.rst:1035 msgid "Added the ability to use :meth:`assertRaises` as a context manager." @@ -1941,21 +2109,23 @@ msgstr "" "える正規表現が書かれた文字列である必要があります。例えば以下のようになりま" "す::" -#: ../../library/unittest.rst:1053 msgid "" "self.assertRaisesRegex(ValueError, \"invalid literal for.*XYZ'$\",\n" " int, 'XYZ')" msgstr "" +"self.assertRaisesRegex(ValueError, \"invalid literal for.*XYZ'$\",\n" +" int, 'XYZ')" #: ../../library/unittest.rst:1056 ../../library/unittest.rst:1124 msgid "or::" msgstr "もしくは::" -#: ../../library/unittest.rst:1058 msgid "" "with self.assertRaisesRegex(ValueError, 'literal'):\n" " int('XYZ')" msgstr "" +"with self.assertRaisesRegex(ValueError, 'literal'):\n" +" int('XYZ')" #: ../../library/unittest.rst:1061 msgid "Added under the name ``assertRaisesRegexp``." @@ -1989,11 +2159,12 @@ msgstr "" "キストマネージャが返されます。これにより関数名を渡す形式ではなく、インライン" "でテスト対象のコードを書くことができます::" -#: ../../library/unittest.rst:1085 msgid "" "with self.assertWarns(SomeWarning):\n" " do_something()" msgstr "" +"with self.assertWarns(SomeWarning):\n" +" do_something()" #: ../../library/unittest.rst:1088 msgid "" @@ -2015,7 +2186,6 @@ msgstr "" "納します。これは警告発生時に捕捉された警告に対して追加の確認を行いたい場合に" "便利です::" -#: ../../library/unittest.rst:1097 msgid "" "with self.assertWarns(SomeWarning) as cm:\n" " do_something()\n" @@ -2023,6 +2193,11 @@ msgid "" "self.assertIn('myfile.py', cm.filename)\n" "self.assertEqual(320, cm.lineno)" msgstr "" +"with self.assertWarns(SomeWarning) as cm:\n" +" do_something()\n" +"\n" +"self.assertIn('myfile.py', cm.filename)\n" +"self.assertEqual(320, cm.lineno)" #: ../../library/unittest.rst:1103 msgid "" @@ -2041,18 +2216,21 @@ msgstr "" "テストします。 *regex* は正規表現オブジェクトか、 :func:`re.search` が扱える" "正規表現が書かれた文字列である必要があります。例えば以下のようになります::" -#: ../../library/unittest.rst:1120 msgid "" "self.assertWarnsRegex(DeprecationWarning,\n" " r'legacy_function\\(\\) is deprecated',\n" " legacy_function, 'XYZ')" msgstr "" +"self.assertWarnsRegex(DeprecationWarning,\n" +" r'legacy_function\\(\\) is deprecated',\n" +" legacy_function, 'XYZ')" -#: ../../library/unittest.rst:1126 msgid "" "with self.assertWarnsRegex(RuntimeWarning, 'unsafe frobnicating'):\n" " frobnicate('/etc/passwd')" msgstr "" +"with self.assertWarnsRegex(RuntimeWarning, 'unsafe frobnicating'):\n" +" frobnicate('/etc/passwd')" #: ../../library/unittest.rst:1136 msgid "" @@ -2062,13 +2240,16 @@ msgstr "" "*logger* かその子ロガーのうちの1つに、少なくとも1つのログメッセージが少なくと" "も与えられた *level* で出力されることをテストするコンテキストマネージャです。" -#: ../../library/unittest.rst:1140 msgid "" "If given, *logger* should be a :class:`logging.Logger` object or a :class:" "`str` giving the name of a logger. The default is the root logger, which " "will catch all messages that were not blocked by a non-propagating " "descendent logger." msgstr "" +"*logger* を指定する場合は、:class:`logging.Logger` オブジェクトか、ロガーの名" +"前を表す :class:`str` を渡します。\n" +"デフォルトはルートロガーで、メッセージを伝播しない子孫ロガーによって遮断され" +"たものを除き、すべてのメッセージを捕捉します。" #: ../../library/unittest.rst:1145 ../../library/unittest.rst:1186 msgid "" @@ -2076,6 +2257,9 @@ msgid "" "equivalent (for example either ``\"ERROR\"`` or :const:`logging.ERROR`). " "The default is :const:`logging.INFO`." msgstr "" +"*level* が与えられた場合、ログレベルを表す数値もしくはそれに相当する文字列 " +"(例えば ``\"ERROR\"`` もしくは :const:`logging.ERROR`) であるべきです。\n" +"デフォルトは :const:`logging.INFO` です。" #: ../../library/unittest.rst:1149 msgid "" @@ -2113,7 +2297,6 @@ msgstr "" msgid "Example::" msgstr "以下はプログラム例です::" -#: ../../library/unittest.rst:1168 msgid "" "with self.assertLogs('foo', level='INFO') as cm:\n" " logging.getLogger('foo').info('first message')\n" @@ -2121,12 +2304,18 @@ msgid "" "self.assertEqual(cm.output, ['INFO:foo:first message',\n" " 'ERROR:foo.bar:second message'])" msgstr "" +"with self.assertLogs('foo', level='INFO') as cm:\n" +" logging.getLogger('foo').info('first message')\n" +" logging.getLogger('foo.bar').error('second message')\n" +"self.assertEqual(cm.output, ['INFO:foo:first message',\n" +" 'ERROR:foo.bar:second message'])" -#: ../../library/unittest.rst:1178 msgid "" "A context manager to test that no messages are logged on the *logger* or one " "of its children, with at least the given *level*." msgstr "" +"*logger* またはその子ロガーに、指定した *level* 以上のレベルでメッセージが一" +"切出力されないことをテストするコンテキストマネージャです。" #: ../../library/unittest.rst:1182 msgid "" @@ -2225,51 +2414,51 @@ msgstr "*a* と *b* に、順番によらず同じ要素が同じ数だけある #: ../../library/unittest.rst:1228 msgid ":meth:`assertStartsWith(a, b) `" -msgstr "" +msgstr ":meth:`assertStartsWith(a, b) `" #: ../../library/unittest.rst:1228 msgid "``a.startswith(b)``" -msgstr "" +msgstr "``a.startswith(b)``" #: ../../library/unittest.rst:1231 msgid ":meth:`assertNotStartsWith(a, b) `" -msgstr "" +msgstr ":meth:`assertNotStartsWith(a, b) `" #: ../../library/unittest.rst:1231 msgid "``not a.startswith(b)``" -msgstr "" +msgstr "``not a.startswith(b)``" #: ../../library/unittest.rst:1234 msgid ":meth:`assertEndsWith(a, b) `" -msgstr "" +msgstr ":meth:`assertEndsWith(a, b) `" #: ../../library/unittest.rst:1234 msgid "``a.endswith(b)``" -msgstr "" +msgstr "``a.endswith(b)``" #: ../../library/unittest.rst:1237 msgid ":meth:`assertNotEndsWith(a, b) `" -msgstr "" +msgstr ":meth:`assertNotEndsWith(a, b) `" #: ../../library/unittest.rst:1237 msgid "``not a.endswith(b)``" -msgstr "" +msgstr "``not a.endswith(b)``" #: ../../library/unittest.rst:1240 msgid ":meth:`assertHasAttr(a, b) `" -msgstr "" +msgstr ":meth:`assertHasAttr(a, b) `" #: ../../library/unittest.rst:1240 msgid "``hastattr(a, b)``" -msgstr "" +msgstr "``hastattr(a, b)``" #: ../../library/unittest.rst:1243 msgid ":meth:`assertNotHasAttr(a, b) `" -msgstr "" +msgstr ":meth:`assertNotHasAttr(a, b) `" #: ../../library/unittest.rst:1243 msgid "``not hastattr(a, b)``" -msgstr "" +msgstr "``not hastattr(a, b)``" #: ../../library/unittest.rst:1251 msgid "" @@ -2284,13 +2473,12 @@ msgstr "" "行われます。これらのメソッドは (:func:`round` と同様に) *小数位* を指定するの" "であって、*有効桁数* を指定するのではないことに注意してください。" -#: ../../library/unittest.rst:1257 msgid "" "If *delta* is supplied instead of *places* then the difference between " "*first* and *second* must be less or equal to (or greater than) *delta*." msgstr "" "*places* の代わりに *delta* が渡された場合には、*first* と *second* の差分が " -"*delta* 以下 (以上) であることをテストします。" +"*delta* 以下 (または *delta* より大きい) であることをテストします。" #: ../../library/unittest.rst:1260 msgid "Supplying both *delta* and *places* raises a :exc:`TypeError`." @@ -2353,43 +2541,48 @@ msgstr "" msgid ":meth:`.assertNotRegex`." msgstr ":meth:`.assertNotRegex`。" -#: ../../library/unittest.rst:1302 msgid "" "Test that sequence *first* contains the same elements as *second*, " "regardless of their order. When they don't, an error message listing the " "differences between the sequences will be generated." msgstr "" -"シーケンス *first* が *second* と同じ要素を含んでいることをテストします。要素" -"の順序はテスト結果に影響しません。要素が含まれていない場合には、シーケンスの" -"差分がエラーメッセージとして表示されます。" +"シーケンス *first* が *second* と同じ要素を含むことを、順序を無視してテストし" +"ます。\n" +"同じ要素を含まない場合は、シーケンス間の違いを列挙したエラーメッセージを生成" +"します。" -#: ../../library/unittest.rst:1306 msgid "" "Duplicate elements are *not* ignored when comparing *first* and *second*. It " "verifies whether each element has the same count in both sequences. " "Equivalent to: ``assertEqual(Counter(list(first)), Counter(list(second)))`` " "but works with sequences of unhashable objects as well." msgstr "" -"*first* と *second* の比較では、重複した要素は無視 *されません*。両者に同じ数" -"の要素が含まれていることを検証します。このメソッドは " -"``assertEqual(Counter(list(first)), Counter(list(second)))`` と同等に振る舞う" -"ことに加えて、ハッシュ化できないオブジェクトのシーケンスでも動作します。" +"*first* と *second* の比較では、重複した要素は無視 *されません*。\n" +"各要素の出現回数が両方のシーケンスで等しいことを検証します。\n" +"このメソッドは ``assertEqual(Counter(list(first)), Counter(list(second)))`` " +"と同等に振る舞うことに加えて、ハッシュ化できないオブジェクトのシーケンスでも" +"動作します。" -#: ../../library/unittest.rst:1318 msgid "" "Test that the Unicode or byte string *s* starts (or does not start) with a " "*prefix*. *prefix* can also be a tuple of strings to try." msgstr "" +"Unicode 文字列またはバイト文字列 *s* が *prefix* で始まること (または始まらな" +"いこと) をテストします。\n" +"*prefix* には、候補となる文字列のタプルも指定できます。" -#: ../../library/unittest.rst:1328 msgid "" "Test that the Unicode or byte string *s* ends (or does not end) with a " "*suffix*. *suffix* can also be a tuple of strings to try." msgstr "" +"Unicode 文字列またはバイト文字列 *s* が *suffix* で終わること (または終わらな" +"いこと) をテストします。\n" +"*suffix* には、候補となる文字列のタプルも指定できます。" -#: ../../library/unittest.rst:1338 msgid "Test that the object *obj* has (or has not) an attribute *name*." msgstr "" +"オブジェクト *obj* が *name* という属性を持つこと (または持たないこと) をテス" +"トします。" #: ../../library/unittest.rst:1345 msgid "" @@ -2516,17 +2709,17 @@ msgstr "" "このメソッドは直接 :meth:`assertEqual` からは呼ばれませんが、 :meth:" "`assertListEqual` と :meth:`assertTupleEqual` の実装で使われています。" -#: ../../library/unittest.rst:1418 msgid "" "Tests that two lists or tuples are equal. If not, an error message is " "constructed that shows only the differences between the two. An error is " "also raised if either of the parameters are of the wrong type. These methods " "are used by default when comparing lists or tuples with :meth:`assertEqual`." msgstr "" -"2つのリストまたはタプルが等しいかどうかをテストします。等しくない場合には、両" -"者の差分を表示します。2つのパラメータの型が異なる場合にはテストがエラーになり" -"ます。このメソッドは、デフォルトで、 :meth:`assertEqual` が list または " -"tuple を比較するときに自動的に使用します。" +"2つのリストまたはタプルが等しいかどうかをテストします。\n" +"等しくない場合には、両者の差分を表示します。\n" +"どちらかの引数が要求される型でない場合にもエラーになります。\n" +"このメソッドは、デフォルトで、 :meth:`assertEqual` が list または tuple を比" +"較するときに自動的に使用します。" #: ../../library/unittest.rst:1429 msgid "" @@ -2577,9 +2770,9 @@ msgid "" "fair\" with the framework. The initial value of this attribute is :exc:" "`AssertionError`." msgstr "" -":meth:`test` メソッドが送出する例外を指定するクラス属性です。例えばテストフ" -"レームワークで追加情報を付した特殊な例外が必要になる場合、この例外のサブクラ" -"スとして作成します。この属性の初期値は :exc:`AssertionError` です。" +"テストメソッドが送出する例外を指定するクラス属性です。例えばテストフレーム" +"ワークで追加情報を付した特殊な例外が必要になる場合、この例外のサブクラスとし" +"て作成します。この属性の初期値は :exc:`AssertionError` です。" #: ../../library/unittest.rst:1472 msgid "" @@ -2663,13 +2856,12 @@ msgstr "" "タンスですので、 :class:`TestCase` のサブクラスでは必要に応じてこのメソッドを" "オーバライドしてください。" -#: ../../library/unittest.rst:1525 msgid "" "Return a string identifying the specific test case. This is usually the " "full name of the test method, including the module and class name." msgstr "" -"テストケースを特定する文字列を返します。通常、*id* はモジュール名・クラス名を" -"含む、テストメソッドのフルネームを指定します。" +"特定のテストケースを識別する文字列を返します。\n" +"通常は、モジュール名とクラス名を含むテストメソッドの完全な名前です。" #: ../../library/unittest.rst:1531 msgid "" @@ -2713,12 +2905,15 @@ msgstr "" ":meth:`setUp` が失敗した場合、つまり :meth:`tearDown` が呼ばれなかった場合で" "も、追加されたクリーンアップ関数は呼び出されます。" -#: ../../library/unittest.rst:1559 msgid "" "Enter the supplied :term:`context manager`. If successful, also add its :" "meth:`~object.__exit__` method as a cleanup function by :meth:`addCleanup` " "and return the result of the :meth:`~object.__enter__` method." msgstr "" +"指定した :term:`context manager` に入ります。\n" +"成功した場合は :meth:`addCleanup` で :meth:`~object.__exit__` メソッドをク" +"リーンアップ関数として追加し、:meth:`~object.__enter__` メソッドの結果を返し" +"ます。" #: ../../library/unittest.rst:1569 msgid "" @@ -2768,13 +2963,16 @@ msgstr "" ":meth:`setUpClass` が失敗した場合、つまり :meth:`tearDownClass` が呼ばれな" "かった場合でも、追加されたクリーンアップ関数は呼び出されます。" -#: ../../library/unittest.rst:1599 msgid "" "Enter the supplied :term:`context manager`. If successful, also add its :" "meth:`~object.__exit__` method as a cleanup function by :meth:" "`addClassCleanup` and return the result of the :meth:`~object.__enter__` " "method." msgstr "" +"指定した :term:`context manager` に入ります。\n" +"成功した場合は :meth:`addClassCleanup` で :meth:`~object.__exit__` メソッドを" +"クリーンアップ関数として追加し、:meth:`~object.__enter__` メソッドの結果を返" +"します。" #: ../../library/unittest.rst:1609 msgid "" @@ -2810,11 +3008,13 @@ msgstr "" "このクラスは :class:`TestCase` と似たAPIを提供し、テスト関数としてコルーチン" "も許容します。" -#: ../../library/unittest.rst:1632 msgid "" "The *loop_factory* passed to :class:`asyncio.Runner`. Override in subclasses " "with :class:`asyncio.EventLoop` to avoid using the asyncio policy system." msgstr "" +":class:`asyncio.Runner` に渡す *loop_factory* です。\n" +"asyncio のポリシーシステムを使わないようにするには、サブクラスでこの属性を :" +"class:`asyncio.EventLoop` に置き換えてください。" #: ../../library/unittest.rst:1641 msgid "" @@ -2856,13 +3056,16 @@ msgid "This method accepts a coroutine that can be used as a cleanup function." msgstr "" "このメソッドはクリーンアップ関数として使用できるコルーチンを受け入れます。" -#: ../../library/unittest.rst:1667 msgid "" "Enter the supplied :term:`asynchronous context manager`. If successful, " "also add its :meth:`~object.__aexit__` method as a cleanup function by :meth:" "`addAsyncCleanup` and return the result of the :meth:`~object.__aenter__` " "method." msgstr "" +"指定した :term:`asynchronous context manager` に入ります。\n" +"成功した場合は :meth:`addAsyncCleanup` で :meth:`~object.__aexit__` メソッド" +"をクリーンアップ関数として追加し、:meth:`~object.__aenter__` メソッドの結果を" +"返します。" #: ../../library/unittest.rst:1677 msgid "" @@ -2880,9 +3083,8 @@ msgstr "" "resultオブジェクトは :meth:`run` の呼び出し元に返されます。テスト終了時には、" "イベントループ内のすべてのタスクがキャンセルされます。" -#: ../../library/unittest.rst:1685 msgid "An example illustrating the order::" -msgstr "順番を示す例です:" +msgstr "実行順序を示す例です。 ::" #: ../../library/unittest.rst:1687 msgid "" @@ -2961,18 +3163,15 @@ msgstr "" "を備えています。 :class:`TestSuite` インスタンスを実行することはスイートをイ" "テレートして得られる個々のテストを実行することと同じです。" -#: ../../library/unittest.rst:1745 msgid "" "If *tests* is given, it must be an iterable of individual test cases or " "other test suites that will be used to build the suite initially. Additional " "methods are provided to add test cases and suites to the collection later on." msgstr "" -"引数 *tests* が指定された場合、それはテストケースに亘る繰り返し可能オブジェク" -"トまたは内部でスイートを組み立てるための他のテストスイートでなければなりませ" -"ん。後からテストケースやスイートをコレクションに付け加えるためのメソッドも提" -"供されています。" +"*tests* を指定する場合は、スイートを最初に構築するための個々のテストケースや" +"他のテストスイートを要素とするイテラブルでなければなりません。\n" +"後からテストケースやスイートを追加するためのメソッドも用意されています。" -#: ../../library/unittest.rst:1749 msgid "" ":class:`TestSuite` objects behave much like :class:`TestCase` objects, " "except they do not actually implement a test. Instead, they are used to " @@ -2980,10 +3179,11 @@ msgid "" "additional methods are available to add tests to :class:`TestSuite` " "instances:" msgstr "" -":class:`TestSuite` は :class:`TestCase` オブジェクトのように振る舞います。違" -"いは、スイートにはテストを実装しない点にあります。代わりに、テストをまとめて" -"グループ化して、同時に実行します。 :class:`TestSuite` のインスタンスにテスト" -"追加するためのメソッドが用意されています:" +":class:`TestSuite` オブジェクトは、実際にはテストを実装していない点を除き、:" +"class:`TestCase` オブジェクトとよく似た振る舞いをします。\n" +"テストを実装する代わりに、まとめて実行するテストをグループ化するために使いま" +"す。\n" +":class:`TestSuite` インスタンスにテストを追加するためのメソッドもあります。" #: ../../library/unittest.rst:1757 msgid "Add a :class:`TestCase` or :class:`TestSuite` to the suite." @@ -3058,6 +3258,9 @@ msgid "" "than through iteration, so overriding :meth:`!__iter__` wasn't sufficient " "for providing tests." msgstr "" +"以前のバージョンでは :class:`TestSuite` はイテレータではなく、直接テストにア" +"クセスしていました。そのため、 :meth:`!__iter__` をオーバーラードしてもテスト" +"にアクセスできませんでした。" #: ../../library/unittest.rst:1809 msgid "" @@ -3100,7 +3303,6 @@ msgstr "" msgid ":class:`TestLoader` objects have the following attributes:" msgstr ":class:`TestLoader` オブジェクトには以下の属性があります:" -#: ../../library/unittest.rst:1834 msgid "" "A list of the non-fatal errors encountered while loading tests. Not reset by " "the loader at any point. Fatal errors are signalled by the relevant method " @@ -3110,7 +3312,8 @@ msgstr "" "テストの読み込み中に起きた致命的でないエラーのリストです。\n" "どの時点でもローダーからリセットされることはありません。\n" "致命的なエラーは適切なメソッドが例外を送出して、呼び出し元に通知します。\n" -"致命的でないエラーも、実行したときのエラーを総合テストが通知してくれます。" +"致命的でないエラーについても、実行すると元のエラーを送出するテストが生成さ" +"れ、エラーが通知されます。" #: ../../library/unittest.rst:1843 msgid ":class:`TestLoader` objects have the following methods:" @@ -3149,7 +3352,6 @@ msgstr "" "は *module* 内の :class:`TestCase` 派生クラスを検索し、見つかったクラスのテス" "トメソッドごとにクラスのインスタンスを作成します。" -#: ../../library/unittest.rst:1867 msgid "" "While using a hierarchy of :class:`TestCase`\\ -derived classes can be " "convenient in sharing fixtures and helper functions, defining test methods " @@ -3157,11 +3359,12 @@ msgid "" "play well with this method. Doing so, however, can be useful when the " "fixtures are different and defined in subclasses." msgstr "" -":class:`TestCase` クラスを基底クラスとしてクラス階層を構築するとテストフィク" -"スチャや補助的な関数をうまく共用することができますが、基底クラスに直接インス" -"タンス化できないテストメソッドがあると、この :meth:`loadTestsFromModule` を使" -"うことができません。この場合でも、 fixture が全て別々で定義がサブクラスにある" -"場合は使用することができます。" +":class:`TestCase` から派生したクラス階層は、フィクスチャやヘルパー関数を共有" +"するのに便利ですが、\n" +"直接インスタンス化するつもりのない基底クラスにテストメソッドを定義すると、こ" +"のメソッドではうまく扱えません。\n" +"ただし、サブクラスごとに異なるフィクスチャを定義する場合には、こうしたテスト" +"メソッドの定義が役立つこともあります。" #: ../../library/unittest.rst:1873 msgid "" @@ -3180,14 +3383,12 @@ msgstr "" msgid "Support for ``load_tests`` added." msgstr "``load_tests`` のサポートが追加されました。" -#: ../../library/unittest.rst:1881 msgid "Support for a keyword-only argument *pattern* has been added." -msgstr "" +msgstr "キーワード専用引数 *pattern* に対応しました。" -#: ../../library/unittest.rst:1884 msgid "" "The undocumented and unofficial *use_load_tests* parameter has been removed." -msgstr "" +msgstr "文書化されていなかった非公式の引数 *use_load_tests* が削除されました。" #: ../../library/unittest.rst:1891 msgid "Return a suite of all test cases given a string specifier." @@ -3284,6 +3485,9 @@ msgid "" "the start directory is not the top level directory then *top_level_dir* must " "be specified separately." msgstr "" +"すべてのテストモジュールはプロジェクトのトップレベルからインポート可能である" +"必要があります。開始ディレクトリがトップレベルディレクトリでない場合は、" +"*top_level_dir* を個別に指定しなければなりません。" #: ../../library/unittest.rst:1945 msgid "" @@ -3314,27 +3518,30 @@ msgstr "" "テストの検索の実行では、たとえ load_tests 関数自身が ``loader.discover`` を呼" "んだとしても、パッケージのチェックは1回のみとなることが保証されています。" -#: ../../library/unittest.rst:1958 msgid "" "If ``load_tests`` exists then discovery does *not* recurse into the package, " "``load_tests`` is responsible for loading all tests in the package." msgstr "" -"``load_tests`` が存在して、ディスカバリがパッケージ内を再帰的な検索を続けてい" -"る途中で *ない* 場合、``load_tests`` はそのパッケージ内の全てのテストをロード" -"する責務を担います。" +"``load_tests`` が存在する場合、ディスカバリはそのパッケージ内を再帰的に検索し" +"ません。\n" +"パッケージ内のすべてのテストの読み込みは ``load_tests`` が担当します。" -#: ../../library/unittest.rst:1962 msgid "" "The pattern is deliberately not stored as a loader attribute so that " "packages can continue discovery themselves." msgstr "" +"パッケージ自身が探索を続けられるように、パターンは意図的にローダーの属性に保" +"存していません。" -#: ../../library/unittest.rst:1965 msgid "" "*top_level_dir* is stored internally, and used as a default to any nested " "calls to ``discover()``. That is, if a package's ``load_tests`` calls " "``loader.discover()``, it does not need to pass this argument." msgstr "" +"*top_level_dir* は内部に保存され、入れ子になった ``discover()`` の呼び出しで" +"デフォルト値として使われます。\n" +"つまり、パッケージの ``load_tests`` が ``loader.discover()`` を呼び出す場合、" +"この引数を渡す必要はありません。" #: ../../library/unittest.rst:1969 msgid "*start_dir* can be a dotted module name as well as a directory." @@ -3372,19 +3579,22 @@ msgstr "" "*pattern* に適合するかどうかに関係無く、見付けたパッケージに ``load_tests`` " "があるかをチェックするようになりました。" -#: ../../library/unittest.rst:1988 msgid "" "*start_dir* can not be a :term:`namespace packages `. It " "has been broken since Python 3.7, and Python 3.11 officially removes it." msgstr "" +"*start_dir* に :term:`名前空間パッケージ ` を指定できなく" +"なりました。\n" +"この機能は Python 3.7 以降動作しておらず、Python 3.11 で正式に削除されまし" +"た。" -#: ../../library/unittest.rst:1992 msgid "*top_level_dir* is only stored for the duration of *discover* call." msgstr "" +"*top_level_dir* は *discover* の呼び出し中だけ保存されるようになりました。" -#: ../../library/unittest.rst:1995 msgid "*start_dir* can once again be a :term:`namespace package`." msgstr "" +"*start_dir* に再び :term:`namespace package` を指定できるようになりました。" #: ../../library/unittest.rst:1998 msgid "" @@ -3406,12 +3616,16 @@ msgstr "" msgid "" "This affects :meth:`getTestCaseNames` and all the ``loadTestsFrom*`` methods." msgstr "" +"この値は :meth:`getTestCaseNames` と全ての ``loadTestsFrom*`` メソッドに影響" +"を与えます。" #: ../../library/unittest.rst:2013 msgid "" "Function to be used to compare method names when sorting them in :meth:" "`getTestCaseNames` and all the ``loadTestsFrom*`` methods." msgstr "" +":meth:`getTestCaseNames` および全ての ``loadTestsFrom*`` メソッドでメソッド名" +"をソートする際に使用する比較関数。" #: ../../library/unittest.rst:2019 msgid "" @@ -3424,7 +3638,7 @@ msgstr "" #: ../../library/unittest.rst:2023 ../../library/unittest.rst:2036 msgid "This affects all the ``loadTestsFrom*`` methods." -msgstr "" +msgstr "この値は全ての ``loadTestsFrom*`` メソッドに影響を与えます。" #: ../../library/unittest.rst:2027 msgid "" @@ -3502,6 +3716,9 @@ msgid "" "holding formatted tracebacks. Each tuple represents a test where a failure " "was explicitly signalled using the :ref:`assert\\* methods `." msgstr "" +":class:`TestCase` と例外のトレースバック情報をフォーマットした文字列の 2 要素" +"タプルからなるリスト。それぞれのタプルは :ref:`assert\\* メソッド ` を使って見つけ出した失敗に対応します。" #: ../../library/unittest.rst:2074 msgid "" @@ -3529,22 +3746,23 @@ msgstr "" "予期された失敗とされていながら成功してしまった :class:`TestCase` のインスタン" "スのリスト。" -#: ../../library/unittest.rst:2092 msgid "" "A list containing 2-tuples of test case names and floats representing the " "elapsed time of each test which was run." msgstr "" +"実行した各テストについて、テストケース名と経過時間を表す浮動小数点数からなる " +"2 要素タプルを格納したリストです。" -#: ../../library/unittest.rst:2099 msgid "" "Set to ``True`` when the execution of tests should stop by :meth:`stop`." -msgstr "``True`` が設定されると :meth:`stop` によりテストの実行が停止します。" +msgstr "" +":meth:`stop` によってテストの実行を停止すべき状態になると、``True`` に設定さ" +"れます。" #: ../../library/unittest.rst:2103 msgid "The total number of tests run so far." msgstr "これまでに実行したテストの総数です。" -#: ../../library/unittest.rst:2107 msgid "" "If set to true, ``sys.stdout`` and ``sys.stderr`` will be buffered in " "between :meth:`startTest` and :meth:`stopTest` being called. Collected " @@ -3553,10 +3771,11 @@ msgid "" "error message." msgstr "" "``True`` が設定されると、 ``sys.stdout`` と ``sys.stderr`` は、 :meth:" -"`startTest` から :meth:`stopTest` が呼ばれるまでの間バッファリングされます。" +"`startTest` から :meth:`stopTest` が呼ばれるまでの間バッファリングされま" +"す。\n" "実際に、結果が ``sys.stdout`` と ``sys.stderr`` に出力されるのは、テストが失" -"敗するかエラーが発生した時になります。表示の際には、全ての失敗 / エラーメッ" -"セージが表示されます。" +"敗するかエラーが発生した時になります。\n" +"出力は失敗やエラーのメッセージにも添付されます。" #: ../../library/unittest.rst:2116 msgid "" @@ -3745,15 +3964,14 @@ msgstr "" "*subtest* はサブテストを記述するカスタムの :class:`TestCase` インスタンスで" "す。" -#: ../../library/unittest.rst:2239 msgid "" "If *outcome* is :const:`None`, the subtest succeeded. Otherwise, it failed " "with an exception where *outcome* is a tuple of the form returned by :func:" "`sys.exc_info`: ``(type, value, traceback)``." msgstr "" -"*outcome* が :const:`None` の場合サブテストは成功です。\n" -"それ以外の場合は失敗で、:func:`sys.exc_info` が返す形式 ``(type, value, " -"traceback)`` の *outcome* を持つ例外を伴います。" +"*outcome* が :const:`None` の場合、サブテストは成功です。\n" +"それ以外の場合は例外によって失敗しており、*outcome* は :func:`sys.exc_info` " +"が返す形式のタプル ``(type, value, traceback)`` です。" #: ../../library/unittest.rst:2243 msgid "" @@ -3763,22 +3981,25 @@ msgstr "" "結果が成功の場合デフォルトの実装では何もせず、サブテストの失敗を通常の失敗と" "して報告します。" -#: ../../library/unittest.rst:2250 msgid "" "Called when the test case finishes. *elapsed* is the time represented in " "seconds, and it includes the execution of cleanup functions." msgstr "" +"テストケースが終了したときに呼び出されます。\n" +"*elapsed* は秒単位の経過時間で、クリーンアップ関数の実行時間も含みます。" -#: ../../library/unittest.rst:2257 msgid "" "A concrete implementation of :class:`TestResult` used by the :class:" "`TextTestRunner`. Subclasses should accept ``**kwargs`` to ensure " "compatibility as the interface changes." msgstr "" +":class:`TextTestRunner` が使う :class:`TestResult` の具体的な実装です。\n" +"インターフェースが変更されたときの互換性を保つため、サブクラスは " +"``**kwargs`` を受け取るようにしてください。" #: ../../library/unittest.rst:2263 msgid "Added the *durations* keyword parameter." -msgstr "" +msgstr "*durations* キーワード引数が追加されました。" #: ../../library/unittest.rst:2268 msgid "" @@ -3787,8 +4008,8 @@ msgid "" "used instead of repeatedly creating new instances." msgstr "" ":class:`TestLoader` のインスタンスで、共用することが目的です。 :class:" -"`TestLoader` をカスタマイズする必要がなければ、新しい :class:`TestLoader` オ" -"ブジェクトを作らずにこのインスタンスを使用します。" +"`TestLoader` をカスタマイズする必要がなければ、新しい ``TestLoader`` オブジェ" +"クトを作らずにこのインスタンスを使用します。" #: ../../library/unittest.rst:2277 msgid "" @@ -3822,7 +4043,7 @@ msgstr "" #: ../../library/unittest.rst:2292 msgid "Added the *warnings* parameter." -msgstr "" +msgstr "*warnings* 引数が追加されました。" #: ../../library/unittest.rst:2295 msgid "" @@ -3834,11 +4055,11 @@ msgstr "" #: ../../library/unittest.rst:2299 msgid "Added the *tb_locals* parameter." -msgstr "" +msgstr "*tb_locals* 引数が追加されました。" #: ../../library/unittest.rst:2302 msgid "Added the *durations* parameter." -msgstr "" +msgstr "*durations* 引数が追加されました。" #: ../../library/unittest.rst:2307 msgid "" @@ -3863,9 +4084,8 @@ msgstr "" "`TextTestResult` が使用されます。結果のクラスは以下の引数が渡されインスタンス" "化されます::" -#: ../../library/unittest.rst:2316 msgid "stream, descriptions, verbosity" -msgstr "" +msgstr "stream, descriptions, verbosity" #: ../../library/unittest.rst:2320 msgid "" @@ -3891,11 +4111,12 @@ msgstr "" "この関数を使えば、簡単に実行可能なテストモジュールを作成する事ができます。一" "番簡単なこの関数の使い方は、以下の行をテストスクリプトの最後に置くことです::" -#: ../../library/unittest.rst:2336 msgid "" "if __name__ == '__main__':\n" " unittest.main()" msgstr "" +"if __name__ == '__main__':\n" +" unittest.main()" #: ../../library/unittest.rst:2339 msgid "" @@ -3903,11 +4124,12 @@ msgid "" "argument::" msgstr "より詳細な情報は verbosity 引数を指定して実行すると得られます::" -#: ../../library/unittest.rst:2342 msgid "" "if __name__ == '__main__':\n" " unittest.main(verbosity=2)" msgstr "" +"if __name__ == '__main__':\n" +" unittest.main(verbosity=2)" #: ../../library/unittest.rst:2345 msgid "" @@ -3931,13 +4153,17 @@ msgstr "" "ラム名のままで渡せます。指定しないか ``None`` の場合は :data:`sys.argv` が使" "われます。" -#: ../../library/unittest.rst:2354 msgid "" "The *testRunner* argument can either be a test runner class or an already " "created instance of it. By default ``main`` calls :func:`sys.exit` with an " "exit code indicating success (0) or failure (1) of the tests run. An exit " "code of 5 indicates that no tests were run or skipped." msgstr "" +"*testRunner* 引数には、テストランナーのクラスか、すでに作成したそのインスタン" +"スを指定できます。\n" +"デフォルトでは ``main`` は :func:`sys.exit` を呼び出し、実行したテストの成功 " +"(0) または失敗 (1) を示す終了コードを渡します。\n" +"終了コード 5 は、実行もスキップもされたテストがなかったことを示します。" #: ../../library/unittest.rst:2359 msgid "" @@ -3957,11 +4183,12 @@ msgstr "" "ともできます。この引数を指定すると、 :func:`sys.exit` を呼ばずに、結果のみを" "出力します::" -#: ../../library/unittest.rst:2366 msgid "" ">>> from unittest import main\n" ">>> main(module='test_module', exit=False)" msgstr "" +">>> from unittest import main\n" +">>> main(module='test_module', exit=False)" #: ../../library/unittest.rst:2369 msgid "" @@ -3971,7 +4198,6 @@ msgstr "" "*failfast*, *catchbreak*, *buffer* は、`コマンドラインオプション`_ にある同名" "のオプションと同じ効果のあるパラメータです。" -#: ../../library/unittest.rst:2372 msgid "" "The *warnings* argument specifies the :ref:`warning filter ` " "that should be used while running the tests. If it's not specified, it will " @@ -3982,15 +4208,16 @@ msgstr "" "*warnings* 引数では、テストの実行中に使うべき :ref:`警告フィルタ ` を指定します。\n" "この引数が指定されない場合には、 :option:`!-W` オプションが :program:" -"`python` に渡されていなければ ``None`` のまま (:ref:`警告の制御 ` を参照してください) で、そうでなければ ``'default'`` が設定されま" "す。" -#: ../../library/unittest.rst:2378 msgid "" "Calling ``main`` returns an object with the ``result`` attribute that " "contains the result of the tests run as a :class:`unittest.TestResult`." msgstr "" +"``main`` を呼び出すと、実行したテストの結果を :class:`unittest.TestResult` と" +"して保持する ``result`` 属性を持つオブジェクトを返します。" #: ../../library/unittest.rst:2381 msgid "The *exit* parameter was added." @@ -4032,9 +4259,8 @@ msgstr "" "テストモジュールが ``load_tests`` を定義していると、それが :meth:`TestLoader." "loadTestsFromModule` から呼ばれます。引数は以下です::" -#: ../../library/unittest.rst:2406 ../../library/unittest.rst:2438 msgid "load_tests(loader, standard_tests, pattern)" -msgstr "" +msgstr "load_tests(loader, standard_tests, pattern)" #: ../../library/unittest.rst:2408 msgid "" @@ -4070,7 +4296,6 @@ msgstr "" "特定の :class:`TestCase` クラスのセットからテストをロードする典型的な " "``load_tests`` 関数は、このようになります::" -#: ../../library/unittest.rst:2422 msgid "" "test_cases = (TestCase1, TestCase2, TestCase3)\n" "\n" @@ -4081,6 +4306,14 @@ msgid "" " suite.addTests(tests)\n" " return suite" msgstr "" +"test_cases = (TestCase1, TestCase2, TestCase3)\n" +"\n" +"def load_tests(loader, tests, pattern):\n" +" suite = TestSuite()\n" +" for test_class in test_cases:\n" +" tests = loader.loadTestsFromTestCase(test_class)\n" +" suite.addTests(tests)\n" +" return suite" #: ../../library/unittest.rst:2431 msgid "" @@ -4119,7 +4352,6 @@ msgstr "" "リを継続 (必要なら変更) できます。テストパッケージに '何もしない' " "``load_tests`` 関数は次のようになります::" -#: ../../library/unittest.rst:2448 msgid "" "def load_tests(loader, standard_tests, pattern):\n" " # top level directory cached on loader instance\n" @@ -4128,6 +4360,13 @@ msgid "" " standard_tests.addTests(package_tests)\n" " return standard_tests" msgstr "" +"def load_tests(loader, standard_tests, pattern):\n" +" # トップレベルのディレクトリはローダーのインスタンスにキャッシュされてい" +"る\n" +" this_dir = os.path.dirname(__file__)\n" +" package_tests = loader.discover(start_dir=this_dir, pattern=pattern)\n" +" standard_tests.addTests(package_tests)\n" +" return standard_tests" #: ../../library/unittest.rst:2455 msgid "" @@ -4231,7 +4470,6 @@ msgstr "setUpClass と tearDownClass" msgid "These must be implemented as class methods::" msgstr "これらはクラスメソッドとして実装されなければなりません::" -#: ../../library/unittest.rst:2503 msgid "" "import unittest\n" "\n" @@ -4244,6 +4482,16 @@ msgid "" " def tearDownClass(cls):\n" " cls._connection.destroy()" msgstr "" +"import unittest\n" +"\n" +"class Test(unittest.TestCase):\n" +" @classmethod\n" +" def setUpClass(cls):\n" +" cls._connection = createExpensiveConnectionObject()\n" +"\n" +" @classmethod\n" +" def tearDownClass(cls):\n" +" cls._connection.destroy()" #: ../../library/unittest.rst:2514 msgid "" @@ -4275,7 +4523,6 @@ msgstr "setUpModule と tearDownModule" msgid "These should be implemented as functions::" msgstr "これらは関数として実装されなければなりません::" -#: ../../library/unittest.rst:2530 msgid "" "def setUpModule():\n" " createConnection()\n" @@ -4283,6 +4530,11 @@ msgid "" "def tearDownModule():\n" " closeConnection()" msgstr "" +"def setUpModule():\n" +" createConnection()\n" +"\n" +"def tearDownModule():\n" +" closeConnection()" #: ../../library/unittest.rst:2536 msgid "" @@ -4295,13 +4547,12 @@ msgstr "" "``tearDownModule`` も実行されません。例外が :exc:`SkipTest` 例外であれば、そ" "のモジュールはエラーではなくスキップされたものとして報告されます。" -#: ../../library/unittest.rst:2541 msgid "" "To add cleanup code that must be run even in the case of an exception, use " "``addModuleCleanup``:" msgstr "" "例外が発生した場合でも実行しなければならないクリーンアップコードを追加するに" -"は``addModuleCleanup``を使用します:" +"は ``addModuleCleanup`` を使用します:" #: ../../library/unittest.rst:2547 msgid "" @@ -4325,13 +4576,16 @@ msgstr "" ":meth:`setUpModule` が失敗した場合、つまり :func:`tearDownModule` が呼ばれな" "かった場合でも、追加されたクリーンアップ関数は呼び出されます。" -#: ../../library/unittest.rst:2561 msgid "" "Enter the supplied :term:`context manager`. If successful, also add its :" "meth:`~object.__exit__` method as a cleanup function by :func:" "`addModuleCleanup` and return the result of the :meth:`~object.__enter__` " "method." msgstr "" +"指定した :term:`context manager` に入ります。\n" +"成功した場合は :func:`addModuleCleanup` で :meth:`~object.__exit__` メソッド" +"をクリーンアップ関数として追加し、:meth:`~object.__enter__` メソッドの結果を" +"返します。" #: ../../library/unittest.rst:2571 msgid "" @@ -4372,8 +4626,13 @@ msgid "" "complete, and the test run will then end and report all the results so far. " "A second control-c will raise a :exc:`KeyboardInterrupt` in the usual way." msgstr "" +"unittest の :option:`-c/--catch ` コマンドラインオプションや、 :" +"func:`unittest.main` の ``catchbreak`` パラメタは、テスト実行中の control-C " +"の処理をよりフレンドリーにします。中断捕捉動作を有効である場合、 control-C が" +"押されると、現在実行されているテストまで完了され、そのテストランが終わると今" +"までの結果が報告されます。control-C がもう一度押されると、通常通り :exc:" +"`KeyboardInterrupt` が送出されます。" -#: ../../library/unittest.rst:2597 msgid "" "The control-c handling signal handler attempts to remain compatible with " "code or tests that install their own :const:`signal.SIGINT` handler. If the " @@ -4384,14 +4643,17 @@ msgid "" "to it. For individual tests that need ``unittest`` control-c handling " "disabled the :func:`removeHandler` decorator can be used." msgstr "" -"シグナルハンドラを処理する control-c は、独自の :const:`signal.SIGINT` ハンド" -"ラをインストールするコードやテストの互換性を保とうとします。 ``unittest`` ハ" -"ンドラが呼ばれ、それがインストールされた :const:`signal.SIGINT` ハンドラで *" -"なければ* 、すなわちテスト中のシステムに置き換えられて移譲されたなら、それは" -"デフォルトのハンドラを呼び出します。インストールされたハンドラを置き換えて委" -"譲するようなコードは、通常その動作を期待するからです。 ``unittest`` の " -"control-c 処理を無効にしたいような個別のテストには、 :func:`removeHandler` デ" -"コレータが使えます。" +"control-c を処理するシグナルハンドラは、独自の :const:`signal.SIGINT` ハンド" +"ラを登録するコードやテストとの互換性を保つように動作します。\n" +"``unittest`` のハンドラが呼び出されたとき、その時点で登録されている :const:" +"`signal.SIGINT` ハンドラが自身で *なければ*、デフォルトのハンドラを呼び出しま" +"す。\n" +"これは、テスト対象のシステムがハンドラを置き換え、元のハンドラに処理を委譲し" +"た場合に当たります。\n" +"通常、登録済みのハンドラを置き換えて元のハンドラに委譲するコードが期待するの" +"は、この動作です。\n" +"個々のテストで ``unittest`` の control-c 処理を無効にする必要がある場合は、:" +"func:`removeHandler` デコレータを使えます。" #: ../../library/unittest.rst:2606 msgid "" @@ -4440,19 +4702,20 @@ msgstr "" "その結果オブジェクトに対して :meth:`~TestResult.stop` が呼び出されなくなりま" "す。" -#: ../../library/unittest.rst:2636 msgid "" "When called without arguments this function removes the control-c handler if " "it has been installed. This function can also be used as a test decorator to " "temporarily remove the handler while the test is being executed::" msgstr "" -"引数なしで呼び出されると、この関数はCtrl+Cのシグナルハンドラを(それがインス" -"トールされていた場合)削除します。また、この関数はテストが実行されている間、" -"Ctrl+Cのハンドラを一時的に削除するテストデコレーターとしても使用できます。" +"引数なしで呼び出すと、登録されている control-c ハンドラを削除します。\n" +"この関数は、テストの実行中だけハンドラを一時的に削除するテストデコレータとし" +"ても使えます。 ::" -#: ../../library/unittest.rst:2640 msgid "" "@unittest.removeHandler\n" "def test_signal_handling(self):\n" " ..." msgstr "" +"@unittest.removeHandler\n" +"def test_signal_handling(self):\n" +" ..." diff --git a/library/unix.po b/library/unix.po index 7b0b86494..21955efd2 100644 --- a/library/unix.po +++ b/library/unix.po @@ -17,10 +17,10 @@ msgstr "" "Last-Translator: Osamu NAKAMURA, 2021\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/unix.rst:5 diff --git a/library/urllib.error.po b/library/urllib.error.po index 8165c1fb1..7e2ad4341 100644 --- a/library/urllib.error.po +++ b/library/urllib.error.po @@ -17,10 +17,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/urllib.error.rst:2 @@ -59,25 +59,24 @@ msgid "" "instance." msgstr "このエラーの理由。メッセージ文字列あるいは他の例外インスタンスです。" -#: ../../library/urllib.error.rst:29 msgid "" ":exc:`URLError` used to be a subtype of :exc:`IOError`, which is now an " "alias of :exc:`OSError`." msgstr "" -":exc:`URLError` は以前は :exc:`IOError` のサブタイプでしたが、 :exc:" -"`OSError` のエイリアスになりました。" +":exc:`URLError` は以前は :exc:`IOError` のサブタイプでした。\n" +"現在では、``IOError`` は :exc:`OSError` のエイリアスです。" -#: ../../library/urllib.error.rst:36 msgid "" "Though being an exception (a subclass of :exc:`URLError`), an :exc:" "`HTTPError` can also function as a non-exceptional file-like return value " "(the same thing that :func:`~urllib.request.urlopen` returns). This is " "useful when handling exotic HTTP errors, such as requests for authentication." msgstr "" -":exc:`HTTPError` は例外 (:exc:`URLError` のサブクラス) ですが、同時に例外では" -"ない file-like な戻り値を返す関数でもあります (:func:`~urllib.request." -"urlopen` の戻り値と同じです)。これは、例えばサーバからの認証リクエストのよう" -"に、変わった HTTP エラーを処理するのに役立ちます。" +":exc:`HTTPError` は例外 (:exc:`URLError` のサブクラス) ですが、通常のファイル" +"のような戻り値 (:func:`~urllib.request.urlopen` が返すものと同じもの) として" +"も機能します。\n" +"これは、例えば認証の要求のような、特殊な HTTP エラーを処理する際に役立ちま" +"す。" #: ../../library/urllib.error.rst:44 msgid "Contains the request URL. An alias for *filename* attribute." diff --git a/library/urllib.parse.po b/library/urllib.parse.po index 3d3e34798..84860fdf2 100644 --- a/library/urllib.parse.po +++ b/library/urllib.parse.po @@ -23,10 +23,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/urllib.parse.rst:2 @@ -59,8 +59,14 @@ msgid "" "``rtsps``, ``rtspu``, ``sftp``, ``shttp``, ``sip``, ``sips``, ``snews``, " "``svn``, ``svn+ssh``, ``telnet``, ``wais``, ``ws``, ``wss``." msgstr "" +"このモジュールは Relative Uniform Resource Locators (相対 URL) に関するイン" +"ターネット RFC に適合するよう設計されており、次の URL スキームをサポートして" +"います: ``file``, ``ftp``, ``gopher``, ``hdl``, ``http``, ``https``, " +"``imap``, ``itms-services``, ``mailto``, ``mms``, ``news``, ``nntp``, " +"``prospero``, ``rsync``, ``rtsp``, ``rtsps``, ``rtspu``, ``sftp``, " +"``shttp``, ``sip``, ``sips``, ``snews``, ``svn``, ``svn+ssh``, ``telnet``, " +"``wais``, ``ws``, ``wss``" -#: ../../library/urllib.parse.rst:32 msgid "" "The inclusion of the ``itms-services`` URL scheme can prevent an app from " "passing Apple's App Store review process for the macOS and iOS App Stores. " @@ -68,6 +74,11 @@ msgid "" "macOS, it *may* be removed if CPython has been built with the :option:`--" "with-app-store-compliance` option." msgstr "" +"``itms-services`` URL スキームが含まれていると、macOS や iOS 向け App Store " +"の審査にアプリが通らなくなる場合があります。\n" +"iOS では ``itms-services`` スキームの処理が常に除去されます。\n" +"macOS では、CPython を :option:`--with-app-store-compliance` オプション付きで" +"ビルドした場合に除去される *ことがあります*。" #: ../../library/urllib.parse.rst:38 msgid "" @@ -78,13 +89,17 @@ msgstr "" ":mod:`urllib.parse` モジュールは、大きく分けると URL の解析を行う関数と URL " "のクオートを行う関数を定義しています。以下にこれらの詳細を説明します。" -#: ../../library/urllib.parse.rst:42 msgid "" "This module's functions use the deprecated term ``netloc`` (or ``net_loc``), " "which was introduced in :rfc:`1808`. However, this term has been obsoleted " "by :rfc:`3986`, which introduced the term ``authority`` as its replacement. " "The use of ``netloc`` is continued for backward compatibility." msgstr "" +"このモジュールの関数では、:rfc:`1808` で導入された非推奨の用語 ``netloc`` (ま" +"たは ``net_loc``) を使っています。\n" +"ただし、この用語は :rfc:`3986` で廃止され、代わりに ``authority`` が導入され" +"ています。\n" +"後方互換性のため、``netloc`` を引き続き使っています。" #: ../../library/urllib.parse.rst:48 msgid "URL Parsing" @@ -364,13 +379,16 @@ msgstr "" ":attr:`netloc` 属性にマッチしなかった角括弧があると :exc:`ValueError` を送出" "します。" -#: ../../library/urllib.parse.rst:153 ../../library/urllib.parse.rst:343 msgid "" "Characters in the :attr:`netloc` attribute that decompose under NFKC " "normalization (as used by the IDNA encoding) into any of ``/``, ``?``, " "``#``, ``@``, or ``:`` will raise a :exc:`ValueError`. If the URL is " "decomposed before parsing, no error will be raised." msgstr "" +"IDNA エンコーディングで使われる NFKC 正規化により ``/``、``?``、``#``、" +"``@``、``:`` のいずれかに分解される文字が :attr:`netloc` 属性に含まれている" +"と、:exc:`ValueError` を送出します。\n" +"解析前に URL を分解した場合、エラーは送出されません。" #: ../../library/urllib.parse.rst:158 msgid "" @@ -404,12 +422,14 @@ msgstr "" msgid "Added IPv6 URL parsing capabilities." msgstr "IPv6 URL の解析も行えるようになりました。" -#: ../../library/urllib.parse.rst:183 msgid "" "The fragment is now parsed for all URL schemes (unless *allow_fragments* is " "false), in accordance with :rfc:`3986`. Previously, an allowlist of schemes " "that support fragments existed." msgstr "" +":rfc:`3986` に従い、*allow_fragments* が偽でない限り、すべての URL スキームで" +"フラグメントを解析するようになりました。\n" +"以前は、フラグメントをサポートするスキームの許可リストがありました。" #: ../../library/urllib.parse.rst:188 ../../library/urllib.parse.rst:357 msgid "" @@ -419,11 +439,12 @@ msgstr "" "範囲外のポート番号を指定すると、 :const:`None` を返す代わりに、:exc:" "`ValueError` を送出するようになりました。" -#: ../../library/urllib.parse.rst:192 ../../library/urllib.parse.rst:361 msgid "" "Characters that affect netloc parsing under NFKC normalization will now " "raise :exc:`ValueError`." msgstr "" +"NFKC 正規化により netloc の解析に影響する文字があると、:exc:`ValueError` を送" +"出するようになりました。" #: ../../library/urllib.parse.rst:199 msgid "" @@ -470,18 +491,21 @@ msgstr "" "ケンスを Unicode 文字にデコードする方法を指定します。これは :meth:`bytes." "decode` メソッドに渡されます。" -#: ../../library/urllib.parse.rst:218 ../../library/urllib.parse.rst:267 msgid "" "The optional argument *max_num_fields* is the maximum number of fields to " "read. If set, then throws a :exc:`ValueError` if there are more than " "*max_num_fields* fields read." msgstr "" +"任意の引数 *max_num_fields* は読み込むフィールド数の上限です。\n" +"指定した場合、読み込むフィールド数が *max_num_fields* を超えると :exc:" +"`ValueError` を送出します。" -#: ../../library/urllib.parse.rst:222 ../../library/urllib.parse.rst:271 msgid "" "The optional argument *separator* is the symbol to use for separating the " "query arguments. It defaults to ``&``." msgstr "" +"任意の引数 *separator* はクエリ引数を区切るための記号です。\n" +"デフォルトは ``&`` です。" #: ../../library/urllib.parse.rst:225 msgid "" @@ -499,19 +523,25 @@ msgstr "*encoding* および *errors* パラメータが追加されました。 msgid "Added *max_num_fields* parameter." msgstr "*max_num_fields* パラメータが追加されました。" -#: ../../library/urllib.parse.rst:236 ../../library/urllib.parse.rst:283 msgid "" "Added *separator* parameter with the default value of ``&``. Python versions " "earlier than Python 3.10 allowed using both ``;`` and ``&`` as query " "parameter separator. This has been changed to allow only a single separator " "key, with ``&`` as the default separator." msgstr "" +"*separator* パラメータが追加されました。\n" +"デフォルト値は ``&`` です。\n" +"Python 3.10 より前のバージョンでは、クエリパラメータの区切り文字として ``;`` " +"と ``&`` の両方を使えました。\n" +"この仕様を変更し、区切り文字として使えるのは一種類だけになりました。\n" +"デフォルトの区切り文字は ``&`` です。" -#: ../../library/urllib.parse.rst:242 ../../library/urllib.parse.rst:761 msgid "" "Accepting objects with false values (like ``0`` and ``[]``) except empty " "strings and byte-like objects and ``None`` is now deprecated." msgstr "" +"空の文字列やバイト列類似オブジェクト、および ``None`` を除き、偽となる値を持" +"つオブジェクト (``0`` や ``[]`` など) を受け付けることは非推奨になりました。" #: ../../library/urllib.parse.rst:249 msgid "" @@ -579,20 +609,20 @@ msgid "" "tab ``\\t`` characters are removed from the URL at any position." msgstr "" -#: ../../library/urllib.parse.rst:354 msgid "" ":func:`urlsplit` does not perform validation. See :ref:`URL parsing " "security ` for details." msgstr "" +":func:`urlsplit` は妥当性を検証しません。\n" +"詳しくは :ref:`URL 解析のセキュリティ ` を参照してくだ" +"さい。" -#: ../../library/urllib.parse.rst:365 msgid "ASCII newline and tab characters are stripped from the URL." -msgstr "" +msgstr "URL から ASCII の改行文字とタブ文字を取り除くようになりました。" -#: ../../library/urllib.parse.rst:368 msgid "" "Leading WHATWG C0 control and space characters are stripped from the URL." -msgstr "" +msgstr "先頭にある WHATWG の C0 制御文字と空白文字を取り除くようになりました。" #: ../../library/urllib.parse.rst:375 msgid "" @@ -643,6 +673,9 @@ msgid "" "... '//www.python.org/%7Eguido')\n" "'http://www.python.org/%7Eguido'" msgstr "" +">>> urljoin('http://www.cwi.nl/%7Eguido/Python.html',\n" +"... '//www.python.org/%7Eguido')\n" +"'http://www.python.org/%7Eguido'" #: ../../library/urllib.parse.rst:407 msgid "" @@ -652,7 +685,6 @@ msgstr "" "もしこの動作が望みのものでない場合は、 *url* を :func:`urlsplit` と :func:" "`urlunsplit` で先に処理して、 *scheme* と *netloc* を削除してください。" -#: ../../library/urllib.parse.rst:412 msgid "" "Because an absolute URL may be passed as the ``url`` parameter, it is " "generally **not secure** to use ``urljoin`` with an attacker-controlled " @@ -660,6 +692,10 @@ msgid "" "username)``, if ``username`` can contain an absolute URL, the result of " "``urljoin`` will be the absolute URL." msgstr "" +"``url`` パラメータには絶対 URL も渡せるため、攻撃者が制御できる ``url`` を " +"``urljoin`` に渡すことは一般に **安全ではありません**。\n" +"例えば ``urljoin(\"https://website.com/users/\", username)`` で ``username`` " +"に絶対 URL が含まれ得る場合、``urljoin`` の結果はその絶対 URL になります。" #: ../../library/urllib.parse.rst:422 msgid "Behavior updated to match the semantics defined in :rfc:`3986`." @@ -700,19 +736,20 @@ msgid "Result is a structured object rather than a simple 2-tuple." msgstr "" "結果はシンプルな 2 要素のタプルから構造化オブジェクトに変更されました。" -#: ../../library/urllib.parse.rst:451 msgid "" "Extract the url from a wrapped URL (that is, a string formatted as ````, ````, ``URL:scheme://host/path`` " "or ``scheme://host/path``). If *url* is not a wrapped URL, it is returned " "without changes." msgstr "" +"ラップされた URL (````、````、" +"``URL:scheme://host/path``、``scheme://host/path`` のいずれかの形式の文字列) " +"から URL を取り出します。\n" +"*url* がラップされた URL でなければ、そのまま返します。" -#: ../../library/urllib.parse.rst:459 msgid "URL parsing security" -msgstr "" +msgstr "URL 解析のセキュリティ" -#: ../../library/urllib.parse.rst:461 msgid "" "The :func:`urlsplit` and :func:`urlparse` APIs do not perform **validation** " "of inputs. They may not raise errors on inputs that other applications " @@ -720,6 +757,12 @@ msgid "" "considered URLs elsewhere. Their purpose is for practical functionality " "rather than purity." msgstr "" +":func:`urlsplit` と :func:`urlparse` の API は入力の **妥当性を検証しません" +"**。\n" +"他のアプリケーションが無効と見なす入力に対して、エラーを送出しないことがあり" +"ます。\n" +"他では URL と見なされない入力でも、解析が成功する場合があります。\n" +"これらの API は厳密さよりも実用的な機能を目的としています。" #: ../../library/urllib.parse.rst:467 msgid "" @@ -728,7 +771,6 @@ msgid "" "perhaps they should." msgstr "" -#: ../../library/urllib.parse.rst:471 msgid "" "We recommend that users of these APIs where the values may be used anywhere " "with security implications code defensively. Do some verification within " @@ -736,8 +778,12 @@ msgid "" "make sense? Is that a sensible ``path``? Is there anything strange about " "that ``hostname``? etc." msgstr "" +"これらの API の返す値をセキュリティに影響する場面で使う可能性がある場合は、防" +"御的なコードを書くことを推奨します。\n" +"返された構成要素を信用する前に、自分のコードで検証してください。\n" +"例えば、``scheme`` は適切か、``path`` は妥当か、``hostname`` に不審な点はない" +"か、といったことを確認してください。" -#: ../../library/urllib.parse.rst:477 msgid "" "What constitutes a URL is not universally well defined. Different " "applications have different needs and desired constraints. For instance the " @@ -748,6 +794,16 @@ msgid "" "behaviors predate both standards leading us to be very cautious about making " "API behavior changes." msgstr "" +"何を URL とするかについて、普遍的で明確な定義はありません。\n" +"アプリケーションごとに要件や求める制約は異なります。\n" +"例えば、随時更新される `WHATWG spec`_ は Web ブラウザなどの利用者向け Web ク" +"ライアントに必要な仕様を記述していますが、:rfc:`3986` はより一般的な仕様で" +"す。\n" +"これらの関数は両方の仕様の一部を取り入れていますが、どちらにも準拠していると" +"は言えません。\n" +"API や、特定の動作を期待する既存の利用者コードは、どちらの標準よりも前から存" +"在しています。\n" +"そのため、API の動作の変更には非常に慎重になっています。" #: ../../library/urllib.parse.rst:488 msgid "Parsing ASCII Encoded Bytes" @@ -788,7 +844,6 @@ msgstr "" "た :class:`str` を渡した場合、:exc:`TypeError` が、非 ASCII バイト値が渡され" "た場合 :exc:`UnicodeDecodeError` が送出されます。" -#: ../../library/urllib.parse.rst:505 msgid "" "To support easier conversion of result objects between :class:`str` and :" "class:`bytes`, all return values from URL parsing functions provide either " @@ -800,14 +855,15 @@ msgid "" "contains either :class:`bytes` data (for :meth:`encode` methods) or :class:" "`str` data (for :meth:`decode` methods)." msgstr "" -":class:`str` と :class:`bytes` 間で容易に変換を行えるよう、すべての URL 解析" -"関数は :meth:`encode` メソッド (結果に :class:`str` データが含まれる時用) " -"か :meth:`decode` メソッド (結果に :class:`bytes` データが含まれる時用) のど" -"ちらかを提供しています。これらメソッドの動作は対応する :class:`str` と :" -"class:`bytes` メソッドが持つものと同じです (ただしデフォルトのエンコーディン" -"グは ``'utf-8'`` ではなく ``'ascii'`` になります)。それぞれは :meth:`encode` " -"メソッドを持つ :class:`bytes` データか :meth:`decode` メソッドを持つ :class:" -"`str` データのどちらかに対応した型を生成します。" +"結果オブジェクトを :class:`str` と :class:`bytes` の間で変換しやすくするた" +"め、URL 解析関数のすべての戻り値には、:class:`str` データを含む場合は :meth:" +"`encode` メソッド、:class:`bytes` データを含む場合は :meth:`decode` メソッド" +"があります。\n" +"これらのメソッドのシグネチャは、対応する :class:`str` および :class:`bytes` " +"のメソッドと同じです (ただし、デフォルトのエンコーディングは ``'utf-8'`` では" +"なく ``'ascii'`` です)。\n" +":meth:`encode` は :class:`bytes` データを含む対応する型の値を生成し、:meth:" +"`decode` は :class:`str` データを含む対応する型の値を生成します。" #: ../../library/urllib.parse.rst:516 msgid "" @@ -874,11 +930,12 @@ msgstr "" "func:`urlsplit` および :func:`urlparse` の戻り値では、このメソッドが返す URL " "には説明されているすべての変更が加えられます。" -#: ../../library/urllib.parse.rst:551 msgid "" "The result of this method remains unchanged if passed back through the " "original parsing function:" -msgstr "加えた解析関数を逆に行えばこのメソッドの戻り値は元の URL になります:" +msgstr "" +"このメソッドの結果を元の解析関数で再び解析しても、このメソッドの結果は変わり" +"ません。" #: ../../library/urllib.parse.rst:564 msgid "" @@ -888,29 +945,26 @@ msgstr "" "以下のクラスは :class:`str` オブジェクトを操作した場合、構造化された解析結果" "の実装を提供します:" -#: ../../library/urllib.parse.rst:569 msgid "" "Concrete class for :func:`urldefrag` results containing :class:`str` data. " "The :meth:`encode` method returns a :class:`DefragResultBytes` instance." msgstr "" -":func:`urldefrag` の具象クラスの結果には :class:`str` データが含まれます。:" -"meth:`encode` メソッドは :class:`DefragResultBytes` インスタンスを返します。" +":class:`str` データを含む :func:`urldefrag` の戻り値を表す具象クラスです。\n" +":meth:`encode` メソッドは :class:`DefragResultBytes` インスタンスを返します。" -#: ../../library/urllib.parse.rst:577 msgid "" "Concrete class for :func:`urlparse` results containing :class:`str` data. " "The :meth:`encode` method returns a :class:`ParseResultBytes` instance." msgstr "" -":func:`urlparse` の具象クラスの結果には :class:`str` データが含まれます。:" -"meth:`encode` メソッドは :class:`ParseResultBytes` インスタンスを返します。" +":class:`str` データを含む :func:`urlparse` の戻り値を表す具象クラスです。\n" +":meth:`encode` メソッドは :class:`ParseResultBytes` インスタンスを返します。" -#: ../../library/urllib.parse.rst:583 msgid "" "Concrete class for :func:`urlsplit` results containing :class:`str` data. " "The :meth:`encode` method returns a :class:`SplitResultBytes` instance." msgstr "" -":func:`urlsplit` の具象クラスの結果には :class:`str` データが含まれます。:" -"meth:`encode` メソッドは :class:`SplitResultBytes` インスタンスを返します。" +":class:`str` データを含む :func:`urlsplit` の戻り値を表す具象クラスです。\n" +":meth:`encode` メソッドは :class:`SplitResultBytes` インスタンスを返します。" #: ../../library/urllib.parse.rst:588 msgid "" @@ -920,29 +974,27 @@ msgstr "" "以下のクラスは :class:`bytes` または :class:`bytearray` オブジェクトを操作し" "た時に解析結果の実装を提供します:" -#: ../../library/urllib.parse.rst:593 msgid "" "Concrete class for :func:`urldefrag` results containing :class:`bytes` data. " "The :meth:`decode` method returns a :class:`DefragResult` instance." msgstr "" -":func:`urldefrag` の具象クラスの結果には :class:`bytes` データが含まれます。:" -"meth:`decode` メソッドは :class:`DefragResult` インスタンスを返します。" +":class:`bytes` データを含む :func:`urldefrag` の戻り値を表す具象クラスで" +"す。\n" +":meth:`decode` メソッドは :class:`DefragResult` インスタンスを返します。" -#: ../../library/urllib.parse.rst:601 msgid "" "Concrete class for :func:`urlparse` results containing :class:`bytes` data. " "The :meth:`decode` method returns a :class:`ParseResult` instance." msgstr "" -":func:`urlparse` の具象クラスの結果には :class:`bytes` が含まれます。:meth:" -"`decode` メソッドは :class:`ParseResult` インスタンスを返します。" +":class:`bytes` データを含む :func:`urlparse` の戻り値を表す具象クラスです。\n" +":meth:`decode` メソッドは :class:`ParseResult` インスタンスを返します。" -#: ../../library/urllib.parse.rst:609 msgid "" "Concrete class for :func:`urlsplit` results containing :class:`bytes` data. " "The :meth:`decode` method returns a :class:`SplitResult` instance." msgstr "" -":func:`urlsplit` の具象クラスの結果には :class:`bytes` データが含まれます。:" -"meth:`decode` メソッドは :class:`SplitResult` インスタンスを返します。" +":class:`bytes` データを含む :func:`urlsplit` の戻り値を表す具象クラスです。\n" +":meth:`decode` メソッドは :class:`SplitResult` インスタンスを返します。" #: ../../library/urllib.parse.rst:617 msgid "URL Quoting" @@ -961,7 +1013,6 @@ msgstr "" "ます。これらは上述の URL 解析関数でカバーされていない URL 構成要素からオリジ" "ナルデータの再作成もサポートしています。" -#: ../../library/urllib.parse.rst:627 msgid "" "Replace special characters in *string* using the :samp:`%{xx}` escape. " "Letters, digits, and the characters ``'_.-~'`` are never quoted. By default, " @@ -969,6 +1020,13 @@ msgid "" "optional *safe* parameter specifies additional ASCII characters that should " "not be quoted --- its default value is ``'/'``." msgstr "" +"*string* 内の特殊文字を :samp:`%{xx}` を使用してエスケープします。\n" +"英字、数字、および ``'_.-~'`` はクオートされません。\n" +"デフォルトでは、この関数は URL のパス部分のクオートのために用意されていま" +"す。\n" +"任意のパラメータ *safe* を指定すると、指定した ASCII 文字もクオートされませ" +"ん。\n" +"デフォルトは ``'/'`` です。" #: ../../library/urllib.parse.rst:633 ../../library/urllib.parse.rst:679 #: ../../library/urllib.parse.rst:708 @@ -976,11 +1034,12 @@ msgid "*string* may be either a :class:`str` or a :class:`bytes` object." msgstr "" "*string* に使用できるのは :class:`str` か :class:`bytes` オブジェクトです。" -#: ../../library/urllib.parse.rst:635 msgid "" "Moved from :rfc:`2396` to :rfc:`3986` for quoting URL strings. \"~\" is now " "included in the set of unreserved characters." msgstr "" +"URL 文字列のクオートの規則を :rfc:`2396` から :rfc:`3986` に変更しました。\n" +"\"~\" が非予約文字に含まれるようになりました。" #: ../../library/urllib.parse.rst:639 msgid "" @@ -1010,13 +1069,17 @@ msgstr "" msgid "Example: ``quote('/El Niño/')`` yields ``'/El%20Ni%C3%B1o/'``." msgstr "例: ``quote('/El Niño/')`` は ``'/El%20Ni%C3%B1o/'`` を返します。" -#: ../../library/urllib.parse.rst:655 msgid "" "Like :func:`quote`, but also replace spaces with plus signs, as required for " "quoting HTML form values when building up a query string to go into a URL. " "Plus signs in the original string are escaped unless they are included in " "*safe*. It also does not have *safe* default to ``'/'``." msgstr "" +":func:`quote` と似ていますが、URL に含めるクエリ文字列を作る際に HTML フォー" +"ムの値をクオートするために必要な処理として、空白をプラス記号にも置き換えま" +"す。\n" +"元の文字列のプラス記号は、*safe* に含まれていなければエスケープされます。\n" +"また、*safe* のデフォルト値は ``'/'`` ではありません。" #: ../../library/urllib.parse.rst:660 msgid "Example: ``quote_plus('/El Niño/')`` yields ``'%2FEl+Ni%C3%B1o%2F'``." @@ -1042,6 +1105,10 @@ msgid "" "encoded sequences into Unicode characters, as accepted by the :meth:`bytes." "decode` method." msgstr "" +"エスケープされた :samp:`%{xx}` をそれに対応した単一文字に置き換えます。オプ" +"ション引数の *encoding* と *errors* は :meth:`bytes.decode` メソッドで受け付" +"けられるパーセントエンコードされたシーケンスから Unicode 文字へのデコード法を" +"指定します。" #: ../../library/urllib.parse.rst:681 msgid "" @@ -1055,10 +1122,11 @@ msgstr "" msgid "Example: ``unquote('/El%20Ni%C3%B1o/')`` yields ``'/El Niño/'``." msgstr "例: ``unquote('/El%20Ni%C3%B1o/')`` は ``'/El Niño/'`` を返します。" -#: ../../library/urllib.parse.rst:687 msgid "" "*string* parameter supports bytes and str objects (previously only str)." msgstr "" +"*string* パラメータが bytes と str の両方のオブジェクトをサポートするようにな" +"りました (以前は str だけでした)。" #: ../../library/urllib.parse.rst:695 msgid "" @@ -1076,11 +1144,12 @@ msgstr "*string* は :class:`str` でなければなりません。" msgid "Example: ``unquote_plus('/El+Ni%C3%B1o/')`` yields ``'/El Niño/'``." msgstr "例: ``unquote_plus('/El+Ni%C3%B1o/')`` は ``'/El Niño/'`` を返します。" -#: ../../library/urllib.parse.rst:705 msgid "" "Replace :samp:`%{xx}` escapes with their single-octet equivalent, and return " "a :class:`bytes` object." msgstr "" +"エスケープ表記 :samp:`%{xx}` を対応する 1 オクテットの値に置き換え、:class:" +"`bytes` オブジェクトを返します。" #: ../../library/urllib.parse.rst:710 msgid "" @@ -1150,15 +1219,14 @@ msgstr "" "エンコードされた文字列内のパラメーターの順序はシーケンス内のパラメータータプ" "ルの順序と一致します。" -#: ../../library/urllib.parse.rst:744 msgid "" "The *safe*, *encoding*, and *errors* parameters are passed down to " "*quote_via* (the *encoding* and *errors* parameters are only passed when a " "query element is a :class:`str`)." msgstr "" -"*safe*, *encoding*, および *errors* パラメータは *quote_via* にそのまま渡され" -"ます (クエリ要素が :class:`str` の場合は、 *encoding* と *errors* パラメータ" -"だけが渡されます)。" +"*safe*、*encoding*、*errors* パラメータは *quote_via* に渡されます。\n" +"ただし、*encoding* と *errors* が渡されるのはクエリの要素が :class:`str` の場" +"合だけです。" #: ../../library/urllib.parse.rst:748 msgid "" @@ -1185,17 +1253,17 @@ msgstr "*query* はバイト列と文字列オブジェクトをサポートし #: ../../library/urllib.parse.rst:758 msgid "Added the *quote_via* parameter." -msgstr "" +msgstr "*quote_via* パラメータが追加されました。" -#: ../../library/urllib.parse.rst:768 msgid "`WHATWG`_ - URL Living standard" -msgstr "" +msgstr "`WHATWG`_ - 随時更新される URL 標準" -#: ../../library/urllib.parse.rst:769 msgid "" "Working Group for the URL Standard that defines URLs, domains, IP addresses, " "the application/x-www-form-urlencoded format, and their API." msgstr "" +"URL、ドメイン、IP アドレス、application/x-www-form-urlencoded 形式、およびそ" +"れらの API を定義する URL 標準の作業部会。" #: ../../library/urllib.parse.rst:772 msgid ":rfc:`3986` - Uniform Resource Identifiers" diff --git a/library/urllib.po b/library/urllib.po index 2d7fe957e..2681271ce 100644 --- a/library/urllib.po +++ b/library/urllib.po @@ -17,10 +17,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/urllib.rst:2 diff --git a/library/urllib.request.po b/library/urllib.request.po index bb4e1bede..366fa7158 100644 --- a/library/urllib.request.po +++ b/library/urllib.request.po @@ -23,15 +23,14 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" -#: ../../library/urllib.request.rst:2 msgid ":mod:`!urllib.request` --- Extensible library for opening URLs" -msgstr ":mod:`!urllib.request` --- URL を開くための大規模なライブラリ" +msgstr ":mod:`!urllib.request` --- URL を開くための拡張可能なライブラリ" #: ../../library/urllib.request.rst:11 msgid "**Source code:** :source:`Lib/urllib/request.py`" @@ -55,17 +54,20 @@ msgstr "" "より高水準のHTTPクライアントインターフェースとして `Requestsパッケージ " "`_ がお奨めです。" -#: ../../library/urllib.request.rst:26 msgid "" "On macOS it is unsafe to use this module in programs using :func:`os.fork` " "because the :func:`getproxies` implementation for macOS uses a higher-level " "system API. Set the environment variable ``no_proxy`` to ``*`` to avoid this " "problem (e.g. ``os.environ[\"no_proxy\"] = \"*\"``)." msgstr "" +"macOS 向けの :func:`getproxies` の実装は高水準のシステム API を使うため、" +"macOS で :func:`os.fork` を使うプログラムからこのモジュールを利用するのは安全" +"ではありません。\n" +"この問題を避けるには、環境変数 ``no_proxy`` を ``*`` に設定してください (例: " +"``os.environ[\"no_proxy\"] = \"*\"``)。" -#: ../../includes/wasm-notavail.rst:3 msgid "Availability" -msgstr "" +msgstr "利用可能な環境" #: ../../includes/wasm-notavail.rst:5 msgid "" @@ -79,11 +81,13 @@ msgstr "" msgid "The :mod:`urllib.request` module defines the following functions:" msgstr ":mod:`urllib.request` モジュールでは以下の関数を定義しています:" -#: ../../library/urllib.request.rst:39 msgid "" "Open *url*, which can be either a string containing a valid, properly " "encoded URL, or a :class:`Request` object." msgstr "" +"*url* を開きます。\n" +"*url* には、適切にエンコードされた有効な URL を含む文字列か、:class:" +"`Request` オブジェクトを指定できます。" #: ../../library/urllib.request.rst:42 msgid "" @@ -155,6 +159,8 @@ msgid "" "For FTP, file, and data URLs, this function returns a :class:`urllib." "response.addinfourl` object." msgstr "" +"FTP 、ファイルおよびデータURLの場合、この関数は :class:`urllib.response." +"addinfourl` オブジェクトを返します。" #: ../../library/urllib.request.rst:73 msgid "Raises :exc:`~urllib.error.URLError` on protocol errors." @@ -178,6 +184,10 @@ msgid "" "`ProxyHandler` is default installed and makes sure the requests are handled " "through the proxy." msgstr "" +"さらに、プロキシ設定が検出された場合(例えば :envvar:`!http_proxy` のような " +"``*_proxy`` 環境変数がセットされているなど)には :class:`ProxyHandler` がデ" +"フォルトでインストールされ、これがプロキシを通してリクエストを処理するように" +"しています。" #: ../../library/urllib.request.rst:84 msgid "" @@ -192,12 +202,14 @@ msgstr "" "urlopen`` において辞書型オブジェクトで渡していたプロキシの扱いは、:class:" "`ProxyHandler` オブジェクトを使用して取得できます。" -#: ../../library/urllib.request.rst:90 ../../library/urllib.request.rst:92 msgid "" "The default opener raises an :ref:`auditing event ` ``urllib." "Request`` with arguments ``fullurl``, ``data``, ``headers``, ``method`` " "taken from the request object." msgstr "" +"デフォルトの opener は、リクエストオブジェクトから取得した引数 ``fullurl``、" +"``data``、``headers``、``method`` とともに、:ref:`監査イベント ` " +"``urllib.Request`` を発生させます。" #: ../../library/urllib.request.rst:96 msgid "*cafile* and *capath* were added." @@ -208,6 +220,8 @@ msgid "" "HTTPS virtual hosts are now supported if possible (that is, if :const:`ssl." "HAS_SNI` is true)." msgstr "" +"HTTPS バーチャルホストがサポートされました (:const:`ssl.HAS_SNI` が真の場合の" +"み)。" #: ../../library/urllib.request.rst:102 msgid "*data* can be an iterable object." @@ -221,18 +235,22 @@ msgstr "*cadefault* が追加されました。" msgid "*context* was added." msgstr "*context* が追加されました。" -#: ../../library/urllib.request.rst:110 msgid "" "HTTPS connection now send an ALPN extension with protocol indicator " "``http/1.1`` when no *context* is given. Custom *context* should set ALPN " "protocols with :meth:`~ssl.SSLContext.set_alpn_protocols`." msgstr "" +"*context* が指定されていない場合、HTTPS 接続でプロトコル識別子 ``http/1.1`` " +"を含む ALPN 拡張を送信するようになりました。\n" +"独自の *context* を指定する場合は、:meth:`~ssl.SSLContext." +"set_alpn_protocols` で ALPN プロトコルを設定してください。" -#: ../../library/urllib.request.rst:115 msgid "" "Remove *cafile*, *capath* and *cadefault* parameters: use the *context* " "parameter instead." msgstr "" +"*cafile*、*capath*、*cadefault* パラメータが削除されました。\n" +"代わりに *context* パラメータを使ってください。" #: ../../library/urllib.request.rst:122 msgid "" @@ -250,7 +268,6 @@ msgstr "" "どうかはチェックしません。適切なインターフェースを持った任意のクラスを利用す" "ることができます。" -#: ../../library/urllib.request.rst:132 msgid "" "Return an :class:`OpenerDirector` instance, which chains the handlers in the " "order given. *handler*\\s can be either instances of :class:`BaseHandler`, " @@ -264,15 +281,16 @@ msgid "" "`HTTPErrorProcessor`." msgstr "" "与えられた順番に URL ハンドラを連鎖させる :class:`OpenerDirector` のインスタ" -"ンスを返します。 *handler* は :class:`BaseHandler` または :class:" -"`BaseHandler` のサブクラスのインスタンスのどちらかです (どちらの場合も、コン" -"ストラクトは引数無しで呼び出せるようになっていなければなりません) 。クラス :" -"class:`ProxyHandler` (proxy 設定が検出された場合), :class:`UnknownHandler`, :" -"class:`HTTPHandler`, :class:`HTTPDefaultErrorHandler`, :class:" -"`HTTPRedirectHandler`, :class:`FTPHandler`, :class:`FileHandler`, :class:" -"`HTTPErrorProcessor` については、そのクラスのインスタンスか、そのサブクラスの" -"インスタンスが *handler* に含まれていない限り、 *handler* よりも先に連鎖しま" -"す。" +"ンスを返します。\n" +"*handler* には :class:`BaseHandler` のインスタンスか、:class:`BaseHandler` の" +"サブクラスを指定できます (サブクラスの場合、引数なしでコンストラクタを呼び出" +"せる必要があります)。\n" +"クラス :class:`ProxyHandler` (proxy 設定が検出された場合), :class:" +"`UnknownHandler`, :class:`HTTPHandler`, :class:`HTTPDefaultErrorHandler`, :" +"class:`HTTPRedirectHandler`, :class:`FTPHandler`, :class:`FileHandler`, :" +"class:`HTTPErrorProcessor` については、そのクラスのインスタンスか、そのサブク" +"ラスのインスタンスが *handler* に含まれていない限り、 *handler* よりも先に連" +"鎖します。" #: ../../library/urllib.request.rst:142 msgid "" @@ -291,63 +309,74 @@ msgstr "" ":class:`BaseHandler` サブクラスでも :attr:`handler_order` メンバー変数を変更" "して、ハンドラーリスト内での場所を変更できます。" -#: ../../library/urllib.request.rst:151 msgid "" "Convert the given local path to a ``file:`` URL. This function uses :func:" "`~urllib.parse.quote` function to encode the path." msgstr "" +"指定されたローカルパスを ``file:`` URL に変換します。\n" +"この関数は :func:`~urllib.parse.quote` を使ってパスをエンコードします。" -#: ../../library/urllib.request.rst:154 msgid "" "If *add_scheme* is false (the default), the return value omits the ``file:`` " "scheme prefix. Set *add_scheme* to true to return a complete URL." msgstr "" +"*add_scheme* が偽 (デフォルト) の場合、戻り値から ``file:`` スキームの接頭辞" +"を省きます。\n" +"完全な URL を返すには *add_scheme* を真に設定してください。" -#: ../../library/urllib.request.rst:157 ../../library/urllib.request.rst:195 msgid "This example shows the function being used on Windows::" -msgstr "" +msgstr "次は Windows でこの関数を使う例です。 ::" -#: ../../library/urllib.request.rst:159 msgid "" ">>> from urllib.request import pathname2url\n" ">>> path = 'C:\\\\Program Files'\n" ">>> pathname2url(path, add_scheme=True)\n" "'file:///C:/Program%20Files'" msgstr "" +">>> from urllib.request import pathname2url\n" +">>> path = 'C:\\\\Program Files'\n" +">>> pathname2url(path, add_scheme=True)\n" +"'file:///C:/Program%20Files'" -#: ../../library/urllib.request.rst:164 ../../library/urllib.request.rst:202 msgid "" "Windows drive letters are no longer converted to uppercase, and ``:`` " "characters not following a drive letter no longer cause an :exc:`OSError` " "exception to be raised on Windows." msgstr "" +"Windows のドライブ文字を大文字に変換しなくなりました。\n" +"また、Windows でドライブ文字の直後以外にある ``:`` に対して :exc:`OSError` を" +"送出しなくなりました。" -#: ../../library/urllib.request.rst:169 msgid "" "Paths beginning with a slash are converted to URLs with authority sections. " "For example, the path ``/etc/hosts`` is converted to the URL ``///etc/" "hosts``." msgstr "" +"スラッシュで始まるパスは authority 部を持つ URL に変換されます。\n" +"例えば、パス ``/etc/hosts`` は URL ``///etc/hosts`` に変換されます。" #: ../../library/urllib.request.rst:174 msgid "The *add_scheme* parameter was added." -msgstr "" +msgstr "*add_scheme* パラメータが追加されました。" -#: ../../library/urllib.request.rst:180 msgid "" "Convert the given ``file:`` URL to a local path. This function uses :func:" "`~urllib.parse.unquote` to decode the URL." msgstr "" +"指定された ``file:`` URL をローカルパスに変換します。\n" +"この関数は :func:`~urllib.parse.unquote` を使って URL をデコードします。" -#: ../../library/urllib.request.rst:183 msgid "" "If *require_scheme* is false (the default), the given value should omit a " "``file:`` scheme prefix. If *require_scheme* is set to true, the given value " "should include the prefix; a :exc:`~urllib.error.URLError` is raised if it " "doesn't." msgstr "" +"*require_scheme* が偽 (デフォルト) の場合、渡す値から ``file:`` スキームの接" +"頭辞を省いてください。\n" +"*require_scheme* を真に設定した場合は、渡す値にこの接頭辞を含めてください。\n" +"含まれていないと :exc:`~urllib.error.URLError` を送出します。" -#: ../../library/urllib.request.rst:188 msgid "" "The URL authority is discarded if it is empty, ``localhost``, or the local " "hostname. Otherwise, if *resolve_host* is set to true, the authority is " @@ -356,26 +385,40 @@ msgid "" "authority is still unhandled, then on Windows a UNC path is returned, and on " "other platforms a :exc:`~urllib.error.URLError` is raised." msgstr "" +"URL の authority が空、``localhost``、またはローカルホスト名の場合は、" +"authority を取り除きます。\n" +"それ以外の場合、*resolve_host* を真に設定すると :func:`socket.gethostbyname` " +"で authority を名前解決し、ローカルの IP アドレスと一致すれば取り除きます (:" +"rfc:`RFC 8089 §3 <8089#section-3>` に従います)。\n" +"それでも authority が処理されなかった場合、Windows では UNC パスを返し、他の" +"プラットフォームでは :exc:`~urllib.error.URLError` を送出します。" -#: ../../library/urllib.request.rst:197 msgid "" ">>> from urllib.request import url2pathname\n" ">>> url = 'file:///C:/Program%20Files'\n" ">>> url2pathname(url, require_scheme=True)\n" "'C:\\\\Program Files'" msgstr "" +">>> from urllib.request import url2pathname\n" +">>> url = 'file:///C:/Program%20Files'\n" +">>> url2pathname(url, require_scheme=True)\n" +"'C:\\\\Program Files'" -#: ../../library/urllib.request.rst:207 msgid "" "The URL authority is discarded if it matches the local hostname. Otherwise, " "if the authority isn't empty or ``localhost``, then on Windows a UNC path is " "returned (as before), and on other platforms a :exc:`~urllib.error.URLError` " "is raised." msgstr "" +"URL の authority がローカルホスト名と一致する場合は、authority を取り除くよう" +"になりました。\n" +"一致せず、authority が空でも ``localhost`` でもない場合は、Windows では従来ど" +"おり UNC パスを返し、他のプラットフォームでは :exc:`~urllib.error.URLError` " +"を送出します。" #: ../../library/urllib.request.rst:213 msgid "The *require_scheme* and *resolve_host* parameters were added." -msgstr "" +msgstr "*require_scheme* および *resolve_host* パラメータが追加されました。" #: ../../library/urllib.request.rst:219 msgid "" @@ -419,11 +462,10 @@ msgstr "以下のクラスが提供されています:" msgid "This class is an abstraction of a URL request." msgstr "このクラスは URL リクエストを抽象化したものです。" -#: ../../library/urllib.request.rst:244 msgid "*url* should be a string containing a valid, properly encoded URL." msgstr "" +"*url* は、適切にエンコードされた有効な URL を含む文字列でなければなりません。" -#: ../../library/urllib.request.rst:246 msgid "" "*data* must be an object specifying additional data to send to the server, " "or ``None`` if no such data is needed. Currently HTTP requests are the only " @@ -435,6 +477,17 @@ msgid "" "specified in :rfc:`7230`, Section 3.3.1 will be used to send files and other " "iterables." msgstr "" +"*data* はサーバーに送信する追加データを指定するオブジェクト、追加データが不要" +"な場合は ``None`` でなければなりません。\n" +"現在、*data* を使うのは HTTP リクエストだけです。\n" +"サポートされるオブジェクトの型には、bytes、ファイルライクオブジェクト、バイト" +"列類似オブジェクトのイテラブルがあります。\n" +"``Content-Length`` ヘッダーフィールドも ``Transfer-Encoding`` ヘッダーフィー" +"ルドも指定されていない場合、:class:`HTTPHandler` は *data* の型に応じてこれら" +"のヘッダーを設定します。\n" +"bytes オブジェクトの送信には ``Content-Length`` を使い、ファイルやその他のイ" +"テラブルの送信には :rfc:`7230` の 3.3.1 節で規定された ``Transfer-Encoding: " +"chunked`` を使います。" #: ../../library/urllib.request.rst:256 msgid "" @@ -472,13 +525,15 @@ msgstr "" "mod:`urllib` はデフォルトで ``\"Python-urllib/2.6\"`` (Python 2.6の場合) と設" "定します。headersのすべてのキーはキャメルケースで送信されます。" -#: ../../library/urllib.request.rst:273 msgid "" "An appropriate ``Content-Type`` header should be included if the *data* " "argument is present. If this header has not been provided and *data* is not " "``None``, ``Content-Type: application/x-www-form-urlencoded`` will be added " "as a default." msgstr "" +"*data* 引数がある場合は、適切な ``Content-Type`` ヘッダーを含めてください。\n" +"このヘッダーが指定されておらず、*data* が ``None`` でない場合、デフォルトで " +"``Content-Type: application/x-www-form-urlencoded`` が追加されます。" #: ../../library/urllib.request.rst:278 msgid "" @@ -528,8 +583,13 @@ msgid "" "indicate a different default method by setting the :attr:`~Request.method` " "attribute in the class itself." msgstr "" +"*method* は使用される HTTP リクエストメソッド (例: ``'HEAD'``) を示す文字列で" +"なければなりません。もし与えられた場合、この値は属性 :attr:`~Request.method` " +"に格納され、 :meth:`get_method` で使用されます。デフォルトは *data* が " +"``None`` であれば ``'GET'`` で、そうでなければ ``'POST'`` です。サブクラス" +"は :attr:`~Request.method` 属性をクラス自身に設定して、異なるデフォルトメソッ" +"ドを示すことができます。" -#: ../../library/urllib.request.rst:304 msgid "" "The request will not work as expected if the data object is unable to " "deliver its content more than once (e.g. a file or an iterable that can " @@ -538,6 +598,11 @@ msgid "" "the headers. There is no support for a 100-continue expectation in the " "library." msgstr "" +"データオブジェクトが内容を複数回提供できない場合 (ファイルや、一度しか内容を" +"生成できないイテラブルなど)、HTTP リダイレクトや認証のためにリクエストを再試" +"行すると、期待どおりに動作しません。\n" +"*data* はヘッダーの直後に HTTP サーバーに送られます。\n" +"このライブラリは 100-continue による待機をサポートしていません。" #: ../../library/urllib.request.rst:311 msgid ":attr:`Request.method` argument is added to the Request class." @@ -549,12 +614,14 @@ msgstr "" ":attr:`Request.method` のデフォルト値はクラスレベルで指定されることがありま" "す。" -#: ../../library/urllib.request.rst:317 msgid "" "Do not raise an error if the ``Content-Length`` has not been provided and " "*data* is neither ``None`` nor a bytes object. Fall back to use chunked " "transfer encoding instead." msgstr "" +"``Content-Length`` が指定されておらず、*data* が ``None`` でも bytes オブジェ" +"クトでもない場合に、エラーを送出しなくなりました。\n" +"代わりにチャンク転送エンコーディングを使います。" #: ../../library/urllib.request.rst:324 msgid "" @@ -737,9 +804,8 @@ msgstr "" "しなければならないインターフェースについての情報はセクション :ref:`http-" "password-mgr` を参照してください。" -#: ../../library/urllib.request.rst:443 msgid "Added support for HTTP digest authentication algorithm ``SHA-256``." -msgstr "" +msgstr "HTTP Digest 認証の ``SHA-256`` アルゴリズムをサポートしました。" #: ../../library/urllib.request.rst:449 msgid "" @@ -950,13 +1016,12 @@ msgstr "" msgid "Add a header that will not be added to a redirected request." msgstr "リダイレクトされたリクエストには追加されないヘッダーを追加します。" -#: ../../library/urllib.request.rst:614 msgid "" "Return whether the instance has the named header (checks both regular and " "unredirected)." msgstr "" -"インスタンスが名前つきヘッダーであるかどうかを (通常のヘッダーと非リダイレク" -"トヘッダの両方を調べて) 返します。" +"インスタンスが指定された名前のヘッダーを持つかどうかを返します (通常のヘッ" +"ダーと非リダイレクトヘッダーの両方を調べます)。" #: ../../library/urllib.request.rst:620 msgid "" @@ -1017,7 +1082,6 @@ msgstr "OpenerDirector オブジェクト" msgid ":class:`OpenerDirector` instances have the following methods:" msgstr ":class:`OpenerDirector` インスタンスは以下のメソッドを持っています:" -#: ../../library/urllib.request.rst:668 msgid "" "*handler* should be an instance of :class:`BaseHandler`. The following " "methods are searched, and added to the possible chains (note that HTTP " @@ -1027,12 +1091,21 @@ msgid "" "should be replaced with the actual HTTP code, for example :meth:" "`http_error_404` would handle HTTP 404 errors." msgstr "" +"*handler* は :class:`BaseHandler` のインスタンスでなければなりません。\n" +"次のメソッドを探し、対応するハンドラーの連鎖に追加します (HTTP エラーは特別扱" +"いされることに注意してください)。\n" +"以下の *protocol* は処理対象の実際のプロトコルに置き換えてください。\n" +"例えば :meth:`http_response` は HTTP プロトコルのレスポンスハンドラーになりま" +"す。\n" +"また、*type* は実際の HTTP コードに置き換えてください。\n" +"例えば :meth:`http_error_404` は HTTP 404 エラーを処理します。" -#: ../../library/urllib.request.rst:676 msgid "" ":meth:`!_open` --- signal that the handler knows how to open " "*protocol* URLs." msgstr "" +":meth:`!_open` --- ハンドラーが *protocol* の URL を開く方法を知っ" +"ていることを示します。" #: ../../library/urllib.request.rst:679 msgid "See |protocol_open|_ for more information." @@ -1043,6 +1116,8 @@ msgid "" ":meth:`!http_error_\\` --- signal that the handler knows how to " "handle HTTP errors with HTTP error code *type*." msgstr "" +":meth:`!http_error_\\` --- ハンドラーが HTTP エラーコード *type* の処" +"理方法を知っていることを示すシグナルです。" #: ../../library/urllib.request.rst:684 msgid "See |http_error_nnn|_ for more information." @@ -1053,22 +1128,27 @@ msgid "" ":meth:`!_error` --- signal that the handler knows how to handle " "errors from (non-\\ ``http``) *protocol*." msgstr "" +":meth:`!_error` --- ハンドラーが (``http`` でない) *protocol* のエ" +"ラーを処理する方法を知っていることを示すシグナルです。" #: ../../library/urllib.request.rst:689 msgid "" ":meth:`!_request` --- signal that the handler knows how to pre-" "process *protocol* requests." msgstr "" +":meth:`!_request` --- ハンドラーが *protocol* リクエストのプリプロ" +"セス方法を知っていることを示すシグナルです。" #: ../../library/urllib.request.rst:692 msgid "See |protocol_request|_ for more information." msgstr "詳細は、 |protocol_request|_ を参照してください。" -#: ../../library/urllib.request.rst:694 msgid "" ":meth:`!_response` --- signal that the handler knows how to post-" "process *protocol* responses." msgstr "" +":meth:`!_response` --- ハンドラーが *protocol* レスポンスのポストプ" +"ロセス方法を知っていることを示すシグナルです。" #: ../../library/urllib.request.rst:697 msgid "See |protocol_response|_ for more information." @@ -1087,7 +1167,7 @@ msgid "" msgstr "" "与えられた *url* (リクエストオブジェクトでも文字列でもかまいません) を開きま" "す。オプションとして *data* を与えることができます。 引数、戻り値、および送出" -"される例外は :func:`urlopen` と同じです (:func:`urlopen` の場合、標準でインス" +"される例外は :func:`urlopen` と同じです (``urlopen()`` の場合、標準でインス" "トールされている グローバルな :class:`OpenerDirector` の :meth:`open` メソッ" "ドを呼び出します) 。 オプションの *timeout* 引数は、接続開始のようなブロック" "する処理におけるタイムアウト時間を 秒数で指定します。(指定しなかった場合は、" @@ -1102,6 +1182,11 @@ msgid "" "code to determine the specific error handler; refer to the :meth:`!" "http_error_\\` methods of the handler classes." msgstr "" +"与えられたプロトコルにおけるエラーを処理します。このメソッドは与えられたプロ" +"トコルにおける登録済みのエラーハンドラを (プロトコル固有の) 引数で呼び出しま" +"す。 HTTP プロトコルは特殊なケースで、特定のエラーハンドラを選び出すのに " +"HTTP レスポンスコードを使います; ハンドラクラスの :meth:`!" +"http_error_\\` メソッドを参照してください。" #: ../../library/urllib.request.rst:724 msgid "" @@ -1113,27 +1198,33 @@ msgid "OpenerDirector objects open URLs in three stages:" msgstr "" "OpenerDirector オブジェクトは、以下の 3 つのステージに分けて URL を開きます:" -#: ../../library/urllib.request.rst:728 msgid "" "The order in which these methods are called within each stage is determined " "by sorting the handler instances." msgstr "" -"各ステージで OpenerDirector オブジェクトのメソッドがどのような順で呼び出され" -"るかは、ハンドラインスタンスの並び方で決まります。" +"各ステージでこれらのメソッドを呼び出す順序は、ハンドラーのインスタンスをソー" +"トして決めます。" #: ../../library/urllib.request.rst:731 msgid "" "Every handler with a method named like :meth:`!_request` has that " "method called to pre-process the request." msgstr "" +":meth:`!_request` 形式のメソッドを持つすべてのハンドラーに対してそ" +"のメソッドを呼び出し、リクエストのプリプロセスを行います。" -#: ../../library/urllib.request.rst:734 msgid "" "Handlers with a method named like :meth:`!_open` are called to " "handle the request. This stage ends when a handler either returns a non-\\ :" "const:`None` value (ie. a response), or raises an exception (usually :exc:" "`~urllib.error.URLError`). Exceptions are allowed to propagate." msgstr "" +":meth:`!_open` のような名前のメソッドを持つハンドラーが呼び出され、" +"リクエストを処理します。\n" +"このステージは、ハンドラーが :const:`None` 以外の値 (つまりレスポンス) を返す" +"か、\n" +"例外 (通常は :exc:`~urllib.error.URLError`) を送出すると終了します。\n" +"例外はそのまま伝播します。" #: ../../library/urllib.request.rst:739 msgid "" @@ -1143,22 +1234,27 @@ msgid "" "all such methods return :const:`None`, the algorithm is repeated for methods " "named :meth:`~BaseHandler.unknown_open`." msgstr "" +"実際には、上のアルゴリズムではまず :meth:`~BaseHandler.default_open` という名" +"前のメソッドを呼び出します。このメソッドがすべて :const:`None` を返す場合、同" +"じアルゴリズムを繰り返して、今度は :meth:`!_open` 形式のメソッドを" +"試します。メソッドがすべて :const:`None` を返すと、さらに同じアルゴリズムを繰" +"り返して :meth:`~BaseHandler.unknown_open` を呼び出します。" -#: ../../library/urllib.request.rst:745 msgid "" "Note that the implementation of these methods may involve calls of the " "parent :class:`OpenerDirector` instance's :meth:`~OpenerDirector.open` and :" "meth:`~OpenerDirector.error` methods." msgstr "" "これらのメソッドの実装には、親となる :class:`OpenerDirector` インスタンスの :" -"meth:`~OpenDirector.open` や :meth:`~OpenDirector.error` といったメソッド呼び" -"出しが入る場合があるので注意してください。" +"meth:`~OpenerDirector.open` や :meth:`~OpenerDirector.error` といったメソッド" +"呼び出しが入る場合があるので注意してください。" -#: ../../library/urllib.request.rst:749 msgid "" "Every handler with a method named like :meth:`!_response` has that " "method called to post-process the response." msgstr "" +":meth:`!_response` 形式のメソッドを持つすべてのハンドラーに対してそ" +"のメソッドを呼び出し、レスポンスのポストプロセスを行います。" #: ../../library/urllib.request.rst:756 msgid "BaseHandler Objects" @@ -1182,13 +1278,12 @@ msgstr "親オブジェクトとして、 ``director`` を追加します。" msgid "Remove any parents." msgstr "全ての親オブジェクトを削除します。" -#: ../../library/urllib.request.rst:772 msgid "" "The following attribute and methods should only be used by classes derived " "from :class:`BaseHandler`." msgstr "" -"以下の属性およびメソッドは :class:`BaseHandler` から派生したクラスでのみ使わ" -"れます。" +"以下の属性とメソッドは、:class:`BaseHandler` から派生したクラスでのみ使うべき" +"です。" #: ../../library/urllib.request.rst:777 msgid "" @@ -1196,6 +1291,9 @@ msgid "" "_request` or :meth:`!_response` methods are named :class:" "`!\\*Processor`; all others are named :class:`!\\*Handler`." msgstr "" +"慣習的に、 :meth:`!_request` や :meth:`!_response` といっ" +"たメソッドを定義している サブクラスは :class:`!\\*Processor`と名づけ、その他" +"は :class:`!\\*Handler` と名づけることになっています" #: ../../library/urllib.request.rst:784 msgid "" @@ -1213,7 +1311,6 @@ msgstr "" "このメソッドは :class:`BaseHandler` では定義されて *いません* 。しかし、全て" "の URL をキャッチさせたいなら、サブクラスで定義する 必要があります。" -#: ../../library/urllib.request.rst:793 msgid "" "This method, if implemented, will be called by the parent :class:" "`OpenerDirector`. It should return a file-like object as described in the " @@ -1222,6 +1319,13 @@ msgid "" "URLError`, unless a truly exceptional thing happens (for example, :exc:" "`MemoryError` should not be mapped to :exc:`~urllib.error.URLError`)." msgstr "" +"このメソッドが実装されていれば、親となる :class:`OpenerDirector` によって呼び" +"出されます。\n" +"これは :class:`OpenerDirector` の :meth:`~OpenerDirector.open` の戻り値で表さ" +"れるファイルライクオブジェクトか、または ``None`` を返さなければならず、真に" +"想定外の事態が発生した場合を除き、:exc:`~urllib.error.URLError` を送出しなけ" +"ればなりません (例えば、:exc:`MemoryError` は :exc:`~urllib.error.URLError` " +"にマップしてはなりません)。" #: ../../library/urllib.request.rst:800 msgid "This method will be called before any protocol-specific open method." @@ -1243,6 +1347,8 @@ msgid "" "`OpenerDirector`. Return values should be the same as for :meth:" "`~BaseHandler.default_open`." msgstr "" +"このメソッドが定義されていた場合、 :class:`OpenerDirector` から呼び出されま" +"す。戻り値は :meth:`~BaseHandler.default_open` と同じでなければなりません。" #: ../../library/urllib.request.rst:816 msgid "" @@ -1318,6 +1424,8 @@ msgid "" "Arguments, return values and exceptions raised should be the same as for :" "meth:`~BaseHandler.http_error_default`." msgstr "" +"引数、返される値、および送出される例外は :meth:`~BaseHandler." +"http_error_default` と同じものでなければなりません。" #: ../../library/urllib.request.rst:858 msgid "" @@ -1338,13 +1446,12 @@ msgstr "" "れます。その際、 *req* は :class:`Request` オブジェクトになります。戻り値は :" "class:`Request` オブジェクトでなければなりません。" -#: ../../library/urllib.request.rst:870 msgid "" "This method is *not* defined in :class:`BaseHandler`, but subclasses should " "define it if they want to post-process responses of the given protocol." msgstr "" "このメソッドは :class:`BaseHandler` では *定義されていません* が、サブクラス" -"で特定のプロトコルのリクエストのポストプロセスを行いたい場合には定義する必要" +"で特定のプロトコルのレスポンスのポストプロセスを行いたい場合には定義する必要" "があります。" #: ../../library/urllib.request.rst:873 @@ -1365,16 +1472,15 @@ msgstr "" msgid "HTTPRedirectHandler Objects" msgstr "HTTPRedirectHandler オブジェクト" -#: ../../library/urllib.request.rst:887 msgid "" "Some HTTP redirections require action from this module's client code. If " "this is the case, :exc:`~urllib.error.HTTPError` is raised. See :rfc:`2616` " "for details of the precise meanings of the various redirection codes." msgstr "" -"一部の HTTP リクエストはこのモジュールのクライアントモードからの操作を要求し" -"ます。その場合、:exc:`~urllib.error.HTTPError` が送出されます。さまざまなリダ" -"イレクションコードの正確な意味についての詳細は :rfc:`2616` を参照してくださ" -"い。" +"HTTP リダイレクトの中には、このモジュールを利用するコードでの対応が必要なもの" +"があります。\n" +"その場合は :exc:`~urllib.error.HTTPError` が送出されます。\n" +"各リダイレクトコードの正確な意味については :rfc:`2616` を参照してください。" #: ../../library/urllib.request.rst:891 msgid "" @@ -1382,8 +1488,10 @@ msgid "" "consideration if the HTTPRedirectHandler is presented with a redirected URL " "which is not an HTTP, HTTPS or FTP URL." msgstr "" +"セキュリティ上の配慮として、HTTPRedirectHandler に HTTP、HTTPS、あるいは FTP " +"の URL ではないリダイレクトされた URL が存在した場合、:exc:`~urllib.error." +"HTTPError` 例外が送出されます。" -#: ../../library/urllib.request.rst:898 msgid "" "Return a :class:`Request` or ``None`` in response to a redirect. This is " "called by the default implementations of the :meth:`!http_error_30\\*` " @@ -1393,6 +1501,16 @@ msgid "" "exc:`~urllib.error.HTTPError` if no other handler should try to handle this " "URL, or return ``None`` if you can't but another handler might." msgstr "" +"リダイレクトに応じて :class:`Request` または ``None`` を返します。\n" +"サーバーからリダイレクトを受信すると、:meth:`!http_error_30\\*` メソッドのデ" +"フォルトの実装がこのメソッドを呼び出します。\n" +"リダイレクトを行う場合は、:meth:`!http_error_30\\*` が *newurl* へのリダイレ" +"クトを実行できるように、\n" +"新しい :class:`Request` を返します。\n" +"それ以外の場合、この URL をほかのハンドラーに処理させるべきでなければ :exc:" +"`~urllib.error.HTTPError` を送出し、\n" +"このハンドラーでは処理できなくてもほかのハンドラーなら処理できる可能性があれ" +"ば ``None`` を返します。" #: ../../library/urllib.request.rst:908 msgid "" @@ -1433,19 +1551,23 @@ msgstr "" ":meth:`http_error_301` と同じですが、'see other' レスポンスに対して呼び出され" "ます。" -#: ../../library/urllib.request.rst:933 msgid "" "The same as :meth:`http_error_301`, but called for the 'temporary redirect' " "response. It does not allow changing the request method from ``POST`` to " "``GET``." msgstr "" +":meth:`http_error_301` と同じですが、'temporary redirect' レスポンスに対して" +"呼び出されます。\n" +"リクエストメソッドを ``POST`` から ``GET`` に変更することは認めません。" -#: ../../library/urllib.request.rst:940 msgid "" "The same as :meth:`http_error_301`, but called for the 'permanent redirect' " "response. It does not allow changing the request method from ``POST`` to " "``GET``." msgstr "" +":meth:`http_error_301` と同じですが、'permanent redirect' レスポンスに対して" +"呼び出されます。\n" +"リクエストメソッドを ``POST`` から ``GET`` に変更することは認めません。" #: ../../library/urllib.request.rst:950 msgid "HTTPCookieProcessor Objects" @@ -1472,6 +1594,12 @@ msgid "" "calling ``request.set_proxy()``, and call the next handler in the chain to " "actually execute the protocol." msgstr "" +":class:`ProxyHandler` は、コンストラクターで与えた辞書 *proxies* にプロキシが" +"設定されているような *protocol* すべてについて、メソッド :meth:`!" +"_open` を持つことになります。このメソッドは ``request." +"set_proxy()`` を呼び出して、リクエストがプロキシを通過できるように修正しま" +"す。その後連鎖するハンドラーの中から次のハンドラーを呼び出して実際にプロトコ" +"ルを実行します。" #: ../../library/urllib.request.rst:978 msgid "HTTPPasswordMgr Objects" @@ -1519,15 +1647,13 @@ msgstr "" msgid "HTTPPasswordMgrWithPriorAuth Objects" msgstr "HTTPPasswordMgrWithPriorAuth オブジェクト" -#: ../../library/urllib.request.rst:1006 msgid "" "This password manager extends :class:`HTTPPasswordMgrWithDefaultRealm` to " "support tracking URIs for which authentication credentials should always be " "sent." msgstr "" "このパスワードマネージャは :class:`HTTPPasswordMgrWithDefaultRealm` を継承し" -"て、認証の証明書を常に送らないといけない URI を追跡する機能をサポートしていま" -"す。" +"て、認証情報を常に送らないといけない URI を追跡する機能をサポートしています。" #: ../../library/urllib.request.rst:1013 msgid "" @@ -1548,11 +1674,10 @@ msgstr "" ":class:`HTTPPasswordMgrWithDefaultRealm` オブジェクトに対する同名のメソッドと" "同じです。" -#: ../../library/urllib.request.rst:1027 msgid "" "Update the ``is_authenticated`` flag for the given *uri* or list of URIs." msgstr "" -"与えられた *url* や URI のリストの ``is_authenticated`` フラグを更新します。" +"与えられた *uri* や URI のリストの ``is_authenticated`` フラグを更新します。" #: ../../library/urllib.request.rst:1033 msgid "" @@ -1636,6 +1761,8 @@ msgid "" "Send an HTTP request, which can be either GET or POST, depending on ``req." "data``." msgstr "" +"HTTP リクエストを送ります。 ``req.data`` に応じて、 GET または POST のどちら" +"でも送ることができます。" #: ../../library/urllib.request.rst:1130 msgid "HTTPSHandler Objects" @@ -1646,6 +1773,8 @@ msgid "" "Send an HTTPS request, which can be either GET or POST, depending on ``req." "data``." msgstr "" +"HTTPS リクエストを送ります。 ``req.data`` に応じて、 GET または POST のどちら" +"でも送ることができます。" #: ../../library/urllib.request.rst:1142 msgid "FileHandler Objects" @@ -1664,12 +1793,13 @@ msgid "" "This method is applicable only for local hostnames. When a remote hostname " "is given, a :exc:`~urllib.error.URLError` is raised." msgstr "" +"このメソッドはローカルのホスト名に対してのみ適用可能です。リモートホスト名が" +"与えられた場合、:exc:`~urllib.error.URLError` が送出されます。" #: ../../library/urllib.request.rst:1158 msgid "DataHandler Objects" msgstr "DataHandler オブジェクト" -#: ../../library/urllib.request.rst:1162 msgid "" "Read a data URL. This kind of URL contains the content encoded in the URL " "itself. The data URL syntax is specified in :rfc:`2397`. This implementation " @@ -1678,6 +1808,13 @@ msgid "" "mind about a missing padding at the end of a base64 encoded data URL, this " "implementation will raise a :exc:`ValueError` in that case." msgstr "" +"data URL を読み込みます。\n" +"この種類の URL は、URL 自体にエンコードされた内容を含みます。\n" +"data URL の構文は :rfc:`2397` で規定されています。\n" +"この実装は base64 エンコードされた data URL 内の空白文字を無視するため、URL " +"を記述するソースファイル内で折り返しても構いません。\n" +"ただし、一部のブラウザとは異なり、base64 エンコードされた data URL の末尾のパ" +"ディングが欠けていると、この実装は :exc:`ValueError` を送出します。" #: ../../library/urllib.request.rst:1173 msgid "FTPHandler Objects" @@ -1734,6 +1871,10 @@ msgid "" "Eventually, :class:`HTTPDefaultErrorHandler` will raise an :exc:`~urllib." "error.HTTPError` if no other handler handles the error." msgstr "" +"200 以外のエラーコードの場合、これは単に :meth:`!http_error_\\` ハン" +"ドラーメソッドに :meth:`OpenerDirector.error` 経由で処理を渡します。他にその" +"エラーを処理するハンドラーがない場合、:class:`HTTPDefaultErrorHandler` は最後" +"に :exc:`~urllib.error.HTTPError` を送出します。" #: ../../library/urllib.request.rst:1231 msgid "Process HTTPS error responses." @@ -1758,6 +1899,8 @@ msgid "" "This example gets the python.org main page and displays the first 300 bytes " "of it::" msgstr "" +"以下の例では、python.org のメインページを取得して、その最初の 300 バイト分を" +"表示します。 ::" #: ../../library/urllib.request.rst:1247 msgid "" @@ -1784,24 +1927,30 @@ msgstr "" "できないためです。一般に、返された bytes オブジェクトを文字列にデコードするた" "めのエンコーディングの決定あるいは推測はプログラム側が行います。" -#: ../../library/urllib.request.rst:1259 msgid "" "The following HTML spec document, https://html.spec.whatwg.org/#charset, " "lists the various ways in which an HTML or an XML document could have " "specified its encoding information." msgstr "" +"以下の HTML の仕様ドキュメント https://html.spec.whatwg.org/#charset には " +"HTML や XML ドキュメントでそのエンコーディング情報を指定するさまざまな方法の" +"一覧があります。" -#: ../../library/urllib.request.rst:1263 msgid "" "For additional information, see the W3C document: https://www.w3.org/" "International/questions/qa-html-encoding-declarations." msgstr "" +"追加の情報は、W3C の文書 https://www.w3.org/International/questions/qa-html-" +"encoding-declarations を参照してください。" #: ../../library/urllib.request.rst:1265 msgid "" "As the python.org website uses *utf-8* encoding as specified in its meta " "tag, we will use the same for decoding the bytes object::" msgstr "" +"python.org ウェブサイトでは *utf-8* エンコーディングを使用しており、それをそ" +"の meta タグで指定していますので、bytes オブジェクトのデコードも同様に行いま" +"す。 ::" #: ../../library/urllib.request.rst:1268 msgid "" @@ -1819,6 +1968,8 @@ msgid "" "It is also possible to achieve the same result without using the :term:" "`context manager` approach::" msgstr "" +":term:`コンテキストマネージャー ` を使用しないアプローチでも" +"同様の結果を得ることができます。 ::" #: ../../library/urllib.request.rst:1278 msgid "" @@ -1845,7 +1996,6 @@ msgstr "" "込みます。この例は Python が SSL をサポートするように設定してインストールされ" "ている場合のみ動作します。 ::" -#: ../../library/urllib.request.rst:1293 msgid "" ">>> import urllib.request\n" ">>> req = urllib.request.Request(url='https://localhost/cgi-bin/test.cgi',\n" @@ -1855,24 +2005,33 @@ msgid "" "...\n" "Got Data: \"This data is passed to stdin of the CGI\"" msgstr "" +">>> import urllib.request\n" +">>> req = urllib.request.Request(url='https://localhost/cgi-bin/test.cgi',\n" +"... data=b'This data is passed to stdin of the CGI')\n" +">>> with urllib.request.urlopen(req) as f:\n" +"... print(f.read().decode('utf-8'))\n" +"...\n" +"Got Data: \"This data is passed to stdin of the CGI\"" #: ../../library/urllib.request.rst:1301 msgid "The code for the sample CGI used in the above example is::" msgstr "上の例で使われているサンプルの CGI は以下のようになっています::" -#: ../../library/urllib.request.rst:1303 msgid "" "#!/usr/bin/env python\n" "import sys\n" "data = sys.stdin.read()\n" "print('Content-type: text/plain\\n\\nGot Data: \"%s\"' % data)" msgstr "" +"#!/usr/bin/env python\n" +"import sys\n" +"data = sys.stdin.read()\n" +"print('Content-type: text/plain\\n\\nGot Data: \"%s\"' % data)" #: ../../library/urllib.request.rst:1308 msgid "Here is an example of doing a ``PUT`` request using :class:`Request`::" msgstr "これは :class:`Request` を使った ``PUT`` リクエストの例です::" -#: ../../library/urllib.request.rst:1310 msgid "" "import urllib.request\n" "DATA = b'some data'\n" @@ -1883,12 +2042,19 @@ msgid "" "print(f.status)\n" "print(f.reason)" msgstr "" +"import urllib.request\n" +"DATA = b'some data'\n" +"req = urllib.request.Request(url='http://localhost:8080', data=DATA, " +"method='PUT')\n" +"with urllib.request.urlopen(req) as f:\n" +" pass\n" +"print(f.status)\n" +"print(f.reason)" #: ../../library/urllib.request.rst:1318 msgid "Use of Basic HTTP Authentication::" msgstr "以下はベーシック HTTP 認証の例です::" -#: ../../library/urllib.request.rst:1320 msgid "" "import urllib.request\n" "# Create an OpenerDirector with support for Basic HTTP Authentication...\n" @@ -1903,6 +2069,18 @@ msgid "" "with urllib.request.urlopen('http://www.example.com/login.html') as f:\n" " print(f.read().decode('utf-8'))" msgstr "" +"import urllib.request\n" +"# Basic HTTP 認証に対応する OpenerDirector を作成する。\n" +"auth_handler = urllib.request.HTTPBasicAuthHandler()\n" +"auth_handler.add_password(realm='PDQ Application',\n" +" uri='https://mahler:8092/site-updates.py',\n" +" user='klem',\n" +" passwd='kadidd!ehopper')\n" +"opener = urllib.request.build_opener(auth_handler)\n" +"# urlopen で使えるようにグローバルにインストールする。\n" +"urllib.request.install_opener(opener)\n" +"with urllib.request.urlopen('http://www.example.com/login.html') as f:\n" +" print(f.read().decode('utf-8'))" #: ../../library/urllib.request.rst:1333 msgid "" @@ -1912,6 +2090,11 @@ msgid "" "involved. For example, the :envvar:`!http_proxy` environment variable is " "read to obtain the HTTP proxy's URL." msgstr "" +":func:`build_opener` はデフォルトで沢山のハンドラを提供しており、その中に :" +"class:`ProxyHandler` があります。デフォルトでは、 :class:`ProxyHandler` は " +"``_proxy`` という環境変数を使います。 ここで ```` は URL ス" +"キームです。例えば、 HTTP プロキシの URL を得るには、環境変数 :envvar:`!" +"http_proxy` を読み出します。" #: ../../library/urllib.request.rst:1339 msgid "" @@ -1923,7 +2106,6 @@ msgstr "" "したプロキシ URL を使うようにし、 :class:`ProxyBasicAuthHandler` でプロキシ認" "証サポートを追加します。 ::" -#: ../../library/urllib.request.rst:1343 msgid "" "proxy_handler = urllib.request.ProxyHandler({'http': 'http://www.example." "com:3128/'})\n" @@ -1935,6 +2117,15 @@ msgid "" "with opener.open('http://www.example.com/login.html') as f:\n" " print(f.read().decode('utf-8'))" msgstr "" +"proxy_handler = urllib.request.ProxyHandler({'http': 'http://www.example." +"com:3128/'})\n" +"proxy_auth_handler = urllib.request.ProxyBasicAuthHandler()\n" +"proxy_auth_handler.add_password('realm', 'host', 'username', 'password')\n" +"\n" +"opener = urllib.request.build_opener(proxy_handler, proxy_auth_handler)\n" +"# 今回は OpenerDirector をインストールせず、直接使う。\n" +"with opener.open('http://www.example.com/login.html') as f:\n" +" print(f.read().decode('utf-8'))" #: ../../library/urllib.request.rst:1352 msgid "Adding HTTP headers:" @@ -1965,7 +2156,6 @@ msgstr "" ":class:`OpenerDirector` は全ての :class:`Request` に :mailheader:`User-" "Agent` ヘッダーを自動的に追加します。これを変更するには以下のようにします::" -#: ../../library/urllib.request.rst:1368 msgid "" "import urllib.request\n" "opener = urllib.request.build_opener()\n" @@ -1973,6 +2163,11 @@ msgid "" "with opener.open('http://www.example.com/') as f:\n" " print(f.read().decode('utf-8'))" msgstr "" +"import urllib.request\n" +"opener = urllib.request.build_opener()\n" +"opener.addheaders = [('User-agent', 'Mozilla/5.0')]\n" +"with opener.open('http://www.example.com/') as f:\n" +" print(f.read().decode('utf-8'))" #: ../../library/urllib.request.rst:1374 msgid "" @@ -2066,15 +2261,14 @@ msgstr "" msgid "Legacy interface" msgstr "レガシーインターフェース" -#: ../../library/urllib.request.rst:1425 msgid "" "The following functions and classes are ported from the Python 2 module " "``urllib`` (as opposed to ``urllib2``). They might become deprecated at " "some point in the future." msgstr "" -"以下の関数およびクラスは、Python 2 のモジュール ``urllib`` (``urllib2`` では" -"ありません) から移植されたものです。これらは将来的に廃止されるかもしれませ" -"ん。" +"以下の関数とクラスは、Python 2 の ``urllib`` モジュール (``urllib2`` ではあり" +"ません) から移植されたものです。\n" +"将来のいずれかの時点で非推奨になる可能性があります。" #: ../../library/urllib.request.rst:1431 msgid "" @@ -2085,8 +2279,14 @@ msgid "" "meth:`!info` method of the object returned by :func:`urlopen` returned (for " "a remote object). Exceptions are the same as for :func:`urlopen`." msgstr "" +"URL で表されるネットワークオブジェクトをローカルファイルにコピーします。 URL " +"がローカルファイルを示している場合は、ファイル名が与えられない限りオブジェク" +"トはコピーされません。戻り値はタプル ``(filename, headers)`` になり、 " +"*filename* はオブジェクトが保存されたローカルファイル名、 *headers* は (リ" +"モートオブジェクトに対しては) :func:`urlopen` が返したオブジェクトの :meth:`!" +"info` メソッドが返すものすべてになります。例外は :func:`urlopen` のものと同じ" +"になります。" -#: ../../library/urllib.request.rst:1438 msgid "" "The second argument, if present, specifies the file location to copy to (if " "absent, the location will be a tempfile with a generated name). The third " @@ -2097,6 +2297,15 @@ msgid "" "The third argument may be ``-1`` on older FTP servers which do not return a " "file size in response to a retrieval request." msgstr "" +"第 2 引数を指定すると、コピー先のファイルの場所になります (省略すると、生成さ" +"れた名前を持つ一時ファイルになります)。\n" +"第 3 引数を指定する場合は、呼び出し可能オブジェクトにしてください。\n" +"ネットワーク接続が確立したときに一度、その後はブロックを読み込むたびに一度呼" +"び出されます。\n" +"このオブジェクトには、それまでに転送したブロック数、バイト単位のブロックサイ" +"ズ、ファイルの合計サイズの三つの引数が渡されます。\n" +"取得リクエストに対してファイルサイズを返さない古い FTP サーバーでは、この第 " +"3 引数が ``-1`` になる場合があります。" #: ../../library/urllib.request.rst:1447 msgid "The following example illustrates the most common usage scenario::" @@ -2132,6 +2341,10 @@ msgid "" "expected amount (which is the size reported by a *Content-Length* header). " "This can occur, for example, when the download is interrupted." msgstr "" +":func:`urlretrieve` は、予想 (これは *Content-Length* ヘッダーにより通知され" +"るサイズです) よりも取得できるデータ量が少ないことを検知した場合、 :exc:" +"`~urllib.error.ContentTooShortError` を発生します。これは、例えば、ダウンロー" +"ドが中断された場合などに発生します。" #: ../../library/urllib.request.rst:1465 msgid "" @@ -2148,6 +2361,8 @@ msgid "" "You can still retrieve the downloaded data in this case, it is stored in " "the :attr:`!content` attribute of the exception instance." msgstr "" +"このような場合にもダウンロードされたデータを取得することは可能で、これは " +"exception インスタンスの :attr:`!content` 属性に保存されています。" #: ../../library/urllib.request.rst:1472 msgid "" @@ -2252,6 +2467,17 @@ msgid "" "file. If fine-grained control is needed, consider using the :mod:`ftplib` " "module." msgstr "" +"FTP プロトコルを扱うコードでは、ファイルとディレクトリを区別できません。この" +"ことから、アクセスできないファイルを指している URL からデータを読み出そうとす" +"ると、予期しない動作を引き起こす場合があります。 URL が ``/`` で終わっていれ" +"ば、ディレクトリを指しているものとみなして、それに適した処理を行います。しか" +"し、ファイルの読み出し操作が 550 エラー (URL が存在しないか、主にパーミッショ" +"ンの理由でアクセスできない) になった場合、 URL がディレクトリを指していて、末" +"尾の ``/`` を忘れたケースを処理するため、パスをディレクトリとして扱います。こ" +"のために、パーミッションのためにアクセスできないファイルを fetch しようとする" +"と、FTP コードはそのファイルを開こうとして 550 エラーに陥り、次にディレクトリ" +"一覧を表示しようとするため、誤解を生むような結果を引き起こす可能性があるので" +"す。よく調整された制御が必要なら、 :mod:`ftplib` モジュールを使用します。" #: ../../library/urllib.request.rst:1537 msgid ":mod:`urllib.response` --- Response classes used by urllib" diff --git a/library/urllib.robotparser.po b/library/urllib.robotparser.po index 001a5b950..053d8dbd7 100644 --- a/library/urllib.robotparser.po +++ b/library/urllib.robotparser.po @@ -21,10 +21,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/urllib.robotparser.rst:2 @@ -49,13 +49,12 @@ msgstr "" "txt` ファイルの構造に関する詳細は http://www.robotstxt.org/orig.html を参照し" "てください。" -#: ../../library/urllib.robotparser.rst:28 msgid "" "This class provides methods to read, parse and answer questions about the :" "file:`robots.txt` file at *url*." msgstr "" -"*url* の :file:`robots.txt` に対し読み込み、パーズ、応答するメソッドを提供し" -"ます。" +"*url* の :file:`robots.txt` ファイルを読み取り、解析し、その内容についての問" +"い合わせに答えるメソッドを提供するクラスです。" #: ../../library/urllib.robotparser.rst:33 msgid "Sets the URL referring to a :file:`robots.txt` file." @@ -92,30 +91,27 @@ msgid "" "Sets the time the ``robots.txt`` file was last fetched to the current time." msgstr "``robots.txt`` ファイルを最後に取得した時刻を現在の時刻に設定します。" -#: ../../library/urllib.robotparser.rst:62 msgid "" "Returns the value of the ``Crawl-delay`` parameter from ``robots.txt`` for " "the *useragent* in question. If there is no such parameter or it doesn't " "apply to the *useragent* specified or the ``robots.txt`` entry for this " "parameter has invalid syntax, return ``None``." msgstr "" -"当該の *ユーザーエージェント* 用の ``robots.txt`` の ``Crawl-delay`` パラメー" -"ターの値を返します。そのようなパラメーターが存在しないか、指定された *ユー" -"ザーエージェント* にあてはまらない、もしくは ``robots.txt`` のこのパラメー" -"ターのエントリの構文が無効な場合は、 ``None`` を返します。" +"``robots.txt`` から、指定した *useragent* に対応する ``Crawl-delay`` パラメー" +"タの値を返します。\n" +"パラメータがない、指定した *useragent* に適用されない、または ``robots.txt`` " +"の該当エントリーの構文が無効な場合は、``None`` を返します。" -#: ../../library/urllib.robotparser.rst:71 msgid "" "Returns the contents of the ``Request-rate`` parameter from ``robots.txt`` " "as a :term:`named tuple` ``RequestRate(requests, seconds)``. If there is no " "such parameter or it doesn't apply to the *useragent* specified or the " "``robots.txt`` entry for this parameter has invalid syntax, return ``None``." msgstr "" -"``robots.txt`` の ``Request-rate`` パラメーターの内容を :term:`named tuple` " -"``RequestRate(requests, seconds)`` として返します。そのようなパラメーターが存" -"在しないか、指定された *ユーザーエージェント* にあてはまらない、もしくは " -"``robots.txt`` のこのパラメーターのエントリの構文が無効な場合は、 ``None`` を" -"返します。" +"``robots.txt`` の ``Request-rate`` パラメータの内容を、:term:`名前付きタプル " +"` ``RequestRate(requests, seconds)`` として返します。\n" +"パラメータがない、指定した *useragent* に適用されない、または ``robots.txt`` " +"の該当エントリーの構文が無効な場合は、``None`` を返します。" #: ../../library/urllib.robotparser.rst:81 msgid "" diff --git a/library/uu.po b/library/uu.po index ac278bc0c..a8ffbac79 100644 --- a/library/uu.po +++ b/library/uu.po @@ -12,15 +12,14 @@ msgstr "" "PO-Revision-Date: 2024-11-19 01:03+0000\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" -#: ../../library/uu.rst:2 msgid ":mod:`!uu` --- Encode and decode uuencode files" -msgstr "" +msgstr ":mod:`!uu` --- uuencode ファイルのエンコードとデコード" #: ../../library/uu.rst:10 msgid "" @@ -28,9 +27,13 @@ msgid "" "`removed in Python 3.13 ` after being deprecated in " "Python 3.11. The removal was decided in :pep:`594`." msgstr "" +"このモジュールは今や Python 標準ライブラリの一部ではありません。このモジュー" +"ルは Python 3.11 で非推奨となったあと、:ref:`Python 3.13 で削除` されました。削除の決定は :pep:`594` でなされました。" -#: ../../library/uu.rst:14 msgid "" "The last version of Python that provided the :mod:`!uu` module was `Python " "3.12 `_." msgstr "" +":mod:`!uu` モジュールが提供されていた最後のバージョンは `Python 3.12 " +"`_ です。" diff --git a/library/uuid.po b/library/uuid.po index 416b28a18..d0bb53d9d 100644 --- a/library/uuid.po +++ b/library/uuid.po @@ -18,21 +18,20 @@ msgstr "" "Last-Translator: tomo, 2023\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/uuid.rst:2 msgid ":mod:`!uuid` --- UUID objects according to :rfc:`9562`" -msgstr "" +msgstr ":mod:`!uuid` --- :rfc:`9562` に基づく UUID オブジェクト" #: ../../library/uuid.rst:9 msgid "**Source code:** :source:`Lib/uuid.py`" msgstr "**ソースコード:** :source:`Lib/uuid.py`" -#: ../../library/uuid.rst:13 msgid "" "This module provides immutable :class:`UUID` objects (the :class:`UUID` " "class) and :ref:`functions ` for generating UUIDs " @@ -41,6 +40,13 @@ msgid "" "func:`uuid3` for UUID version 3, and so on. Note that UUID version 2 is " "deliberately omitted as it is outside the scope of the RFC." msgstr "" +"このモジュールは、イミュータブルな :class:`UUID` オブジェクト (:class:`UUID` " +"クラス) と、\n" +":rfc:`9562` (:rfc:`4122` を置き換える RFC) で規定された特定のバージョンの " +"UUID を生成する :ref:`関数 ` を提供します。\n" +"例えば :func:`uuid1` はバージョン 1、:func:`uuid3` はバージョン 3 の UUID を" +"生成します。\n" +"UUID バージョン 2 は RFC の対象外であるため、意図的に省かれています。" #: ../../library/uuid.rst:19 msgid "" @@ -54,7 +60,6 @@ msgstr "" "アドレスを含む UUID を生成するためにプライバシーを侵害するかもしれない点に注" "意してください。 :func:`uuid4` はランダムな UUID を生成します。" -#: ../../library/uuid.rst:24 msgid "" "Depending on support from the underlying platform, :func:`uuid1` may or may " "not return a \"safe\" UUID. A safe UUID is one which is generated using " @@ -63,14 +68,19 @@ msgid "" "attribute which relays any information about the UUID's safety, using this " "enumeration:" msgstr "" +":func:`uuid1` が「安全な」UUID を返すかどうかは、基盤となるプラットフォームの" +"対応状況によります。\n" +"安全な UUID とは、2 つのプロセスが同じ UUID を取得しないよう保証する同期手段" +"を使って生成されたものです。\n" +":class:`UUID` のすべてのインスタンスは :attr:`~UUID.is_safe` 属性を持ち、以下" +"の列挙値によって UUID の安全性についての情報を伝えます:" -#: ../../library/uuid.rst:36 msgid "The UUID was generated by the platform in a multiprocessing-safe way." -msgstr "UUID は並列処理に対して安全なプラットフォームで生成された" +msgstr "" +"プラットフォームが複数プロセスでの利用に対して安全な方法で UUID を生成した。" -#: ../../library/uuid.rst:40 msgid "The UUID was not generated in a multiprocessing-safe way." -msgstr "UUID は並列処理に対して安全なプラットフォームで生成されなかった" +msgstr "UUID は複数プロセスでの利用に対して安全な方法では生成されなかった。" #: ../../library/uuid.rst:44 msgid "" @@ -98,7 +108,6 @@ msgstr "" "を生成します。16 進数が与えられた時、波括弧、ハイフン、それと URN 接頭辞は無" "視されます。例えば、これらの表現は全て同じ UUID を払い出します:: " -#: ../../library/uuid.rst:59 msgid "" "UUID('{12345678-1234-5678-1234-567812345678}')\n" "UUID('12345678123456781234567812345678')\n" @@ -109,14 +118,28 @@ msgid "" "UUID(fields=(0x12345678, 0x1234, 0x5678, 0x12, 0x34, 0x567812345678))\n" "UUID(int=0x12345678123456781234567812345678)" msgstr "" +"UUID('{12345678-1234-5678-1234-567812345678}')\n" +"UUID('12345678123456781234567812345678')\n" +"UUID('urn:uuid:12345678-1234-5678-1234-567812345678')\n" +"UUID(bytes=b'\\x12\\x34\\x56\\x78'*4)\n" +"UUID(bytes_le=b'\\x78\\x56\\x34\\x12\\x34\\x12\\x78\\x56' +\n" +" b'\\x12\\x34\\x56\\x78\\x12\\x34\\x56\\x78')\n" +"UUID(fields=(0x12345678, 0x1234, 0x5678, 0x12, 0x34, 0x567812345678))\n" +"UUID(int=0x12345678123456781234567812345678)" -#: ../../library/uuid.rst:68 msgid "" "Exactly one of *hex*, *bytes*, *bytes_le*, *fields*, or *int* must be given. " "The *version* argument is optional; if given, the resulting UUID will have " "its variant and version number set according to :rfc:`9562`, overriding bits " "in the given *hex*, *bytes*, *bytes_le*, *fields*, or *int*." msgstr "" +"*hex*、*bytes*、*bytes_le*、*fields*、*int* のうち、必ず 1 つだけを指定しなけ" +"ればなりません。\n" +"*version* 引数は省略可能です。\n" +"指定すると、生成される UUID のバリアントとバージョン番号が :rfc:`9562` に従っ" +"て設定され、\n" +"指定した *hex*、*bytes*、*bytes_le*、*fields*、*int* の該当ビットを上書きしま" +"す。" #: ../../library/uuid.rst:73 msgid "" @@ -127,13 +150,12 @@ msgstr "" "2つのUUIDオブジェクトの比較は、:attr:`UUID.int` 属性の比較によって行われま" "す。UUIDではないオブジェクトとの比較は、 :exc:`TypeError` を送出します。" -#: ../../library/uuid.rst:77 msgid "" "``str(uuid)`` returns a string in the form " "``12345678-1234-5678-1234-567812345678`` where the 32 hexadecimal digits " "represent the UUID." msgstr "" -"``str(uuid)`` は 32桁の16進でUUIDを表す" +"``str(uuid)`` は 32桁の16進でUUIDを表す " "``12345678-1234-5678-1234-567812345678`` 形式の文字列を返します。" #: ../../library/uuid.rst:81 @@ -172,32 +194,39 @@ msgstr "フィールド" msgid "Meaning" msgstr "意味" -#: ../../library/uuid.rst:106 msgid "The first 32 bits of the UUID. Only relevant to version 1." msgstr "" +"UUID の最初の 32 ビットです。\n" +"バージョン 1 にだけ関係します。" -#: ../../library/uuid.rst:109 ../../library/uuid.rst:112 msgid "The next 16 bits of the UUID. Only relevant to version 1." msgstr "" +"UUID の次の 16 ビットです。\n" +"バージョン 1 にだけ関係します。" -#: ../../library/uuid.rst:115 ../../library/uuid.rst:118 msgid "The next 8 bits of the UUID. Only relevant to versions 1 and 6." msgstr "" +"UUID の次の 8 ビットです。\n" +"バージョン 1 と 6 にだけ関係します。" #: ../../library/uuid.rst:121 msgid "The last 48 bits of the UUID. Only relevant to version 1." msgstr "" -#: ../../library/uuid.rst:124 msgid "" "The 60-bit timestamp as a count of 100-nanosecond intervals since Gregorian " "epoch (1582-10-15 00:00:00) for versions 1 and 6, or the 48-bit timestamp in " "milliseconds since Unix epoch (1970-01-01 00:00:00) for version 7." msgstr "" +"バージョン 1 と 6 では、グレゴリオ暦の起点 (1582-10-15 00:00:00) からの経過時" +"間を 100 ナノ秒単位で表す 60 ビットのタイムスタンプです。\n" +"バージョン 7 では、Unix エポック (1970-01-01 00:00:00) からの経過時間をミリ秒" +"単位で表す 48 ビットのタイムスタンプです。" -#: ../../library/uuid.rst:130 msgid "The 14-bit sequence number. Only relevant to versions 1 and 6." msgstr "" +"14 ビットのシーケンス番号です。\n" +"バージョン 1 と 6 にだけ関係します。" #: ../../library/uuid.rst:135 msgid "The UUID as a 32-character lowercase hexadecimal string." @@ -207,9 +236,8 @@ msgstr "32 文字の小文字 16 進数文字列での UUID。" msgid "The UUID as a 128-bit integer." msgstr "128 ビット整数での UUID。" -#: ../../library/uuid.rst:145 msgid "The UUID as a URN as specified in :rfc:`9562`." -msgstr "" +msgstr ":rfc:`9562` で規定された URN としての UUID です。" #: ../../library/uuid.rst:150 msgid "" @@ -221,29 +249,27 @@ msgstr "" "`RESERVED_NCS`, :const:`RFC_4122`, :const:`RESERVED_MICROSOFT`, :const:" "`RESERVED_FUTURE` のいずれかです。" -#: ../../library/uuid.rst:157 msgid "" "The UUID version number (1 through 8, meaningful only when the variant is :" "const:`RFC_4122`)." msgstr "" +"UUID のバージョン番号です (1 から 8 までで、バリアントが :const:`RFC_4122` の" +"場合にだけ意味を持ちます)。" -#: ../../library/uuid.rst:160 msgid "Added UUID versions 6, 7 and 8." -msgstr "" +msgstr "UUID バージョン 6、7、8 を追加しました。" -#: ../../library/uuid.rst:166 msgid "" "An enumeration of :class:`SafeUUID` which indicates whether the platform " "generated the UUID in a multiprocessing-safe way." msgstr "" -":class:`SafeUUID` の列挙で、UUID は並列処理に対して安全なプラットフォームで生" -"成されたかを示す。" +"プラットフォームが複数プロセスでの利用に対して安全な方法で UUID を生成したか" +"どうかを示す :class:`SafeUUID` の列挙値。" #: ../../library/uuid.rst:171 msgid "The :mod:`uuid` module defines the following functions:" msgstr "The :mod:`uuid` モジュールには以下の関数があります:" -#: ../../library/uuid.rst:176 msgid "" "Get the hardware address as a 48-bit positive integer. The first time this " "runs, it may launch a separate program, which could be quite slow. If all " @@ -255,15 +281,18 @@ msgid "" "least significant bit of the first octet is *unset*) will be preferred over " "locally administered MAC addresses, but with no other ordering guarantees." msgstr "" -"48 ビットの正の整数としてハードウェアアドレスを取得します。最初にこれを起動す" -"ると、別個のプログラムが立ち上がって非常に遅くなることがあります。もしハード" -"ウェアを取得する試みが全て失敗すると、ランダムな 48 ビットを、:rfc:`4122` で" -"推奨されているように、マルチキャストビット (最初のオクテットの最下位ビット) " -"を 1 に設定して使います。\"ハードウェアアドレス\" とはネットワークインター" -"フェースの MAC アドレスを指します。複数のネットワークインターフェースを持つマ" -"シンの場合、全域管理されたMACアドレス (最初のオクテットの下位より2番目のビッ" -"トが *設定されていない* MACアドレス) が、他の個別管理アドレスよりも優先的に使" -"用されます。この優先順序は保証されません。" +"48 ビットの正の整数としてハードウェアアドレスを取得します。\n" +"最初にこれを起動すると、別個のプログラムが立ち上がって非常に遅くなることがあ" +"ります。\n" +"もしハードウェアを取得する試みが全て失敗すると、ランダムな 48 ビットを、:rfc:" +"`4122` で推奨されているように、マルチキャストビット (最初のオクテットの最下位" +"ビット) を 1 に設定して使います。\n" +"\"ハードウェアアドレス\" とはネットワークインターフェースの MAC アドレスを指" +"します。\n" +"複数のネットワークインターフェースを持つマシンの場合、全域管理されたMACアドレ" +"ス (最初のオクテットの下位より2番目のビットが *設定されていない* MACアドレ" +"ス) が、他の個別管理アドレスよりも優先的に使用されます。\n" +"それ以外の順序は保証されません。" #: ../../library/uuid.rst:186 msgid "" @@ -318,30 +347,35 @@ msgid "" "not specified, a pseudo-random 14-bit positive integer is generated." msgstr "" -#: ../../library/uuid.rst:231 msgid "" "If *node* or *clock_seq* exceed their expected bit count, only their least " "significant bits are kept." msgstr "" +"*node* または *clock_seq* が想定されたビット数を超える場合は、下位のビットだ" +"けを保持します。" -#: ../../library/uuid.rst:239 msgid "" "Generate a time-based UUID according to :rfc:`RFC 9562, §5.7 " "<9562#section-5.7>`." msgstr "" +":rfc:`RFC 9562, §5.7 <9562#section-5.7>` に従い、時刻に基づく UUID を生成しま" +"す。" -#: ../../library/uuid.rst:242 msgid "" "For portability across platforms lacking sub-millisecond precision, UUIDs " "produced by this function embed a 48-bit timestamp and use a 42-bit counter " "to guarantee monotonicity within a millisecond." msgstr "" +"ミリ秒未満の精度を持たないプラットフォームでも使えるように、この関数が生成す" +"る UUID は 48 ビットのタイムスタンプを埋め込み、\n" +"42 ビットのカウンターによって同一ミリ秒内での単調性を保証します。" -#: ../../library/uuid.rst:251 msgid "" "Generate a pseudo-random UUID according to :rfc:`RFC 9562, §5.8 " "<9562#section-5.8>`." msgstr "" +":rfc:`RFC 9562, §5.8 <9562#section-5.8>` に従い、疑似乱数の UUID を生成しま" +"す。" #: ../../library/uuid.rst:254 msgid "" @@ -391,12 +425,14 @@ msgstr "" msgid "Reserved for NCS compatibility." msgstr "NCS 互換性のために予約されています。" -#: ../../library/uuid.rst:299 msgid "" "Specifies the UUID layout given in :rfc:`4122`. This constant is kept for " "backward compatibility even though :rfc:`4122` has been superseded by :rfc:" "`9562`." msgstr "" +":rfc:`4122` で規定された UUID のレイアウトを指定します。\n" +":rfc:`4122` は :rfc:`9562` に置き換えられましたが、後方互換性のためにこの定数" +"は残されています。" #: ../../library/uuid.rst:306 msgid "Reserved for Microsoft compatibility." @@ -410,21 +446,22 @@ msgstr "将来のために予約されています。" msgid "The :mod:`uuid` module defines the special Nil and Max UUID values:" msgstr "" -#: ../../library/uuid.rst:319 msgid "" "A special form of UUID that is specified to have all 128 bits set to zero " "according to :rfc:`RFC 9562, §5.9 <9562#section-5.9>`." msgstr "" +":rfc:`RFC 9562, §5.9 <9562#section-5.9>` に従い、128 ビットすべてを 0 に設定" +"するよう規定された特殊な形式の UUID です。" -#: ../../library/uuid.rst:327 msgid "" "A special form of UUID that is specified to have all 128 bits set to one " "according to :rfc:`RFC 9562, §5.10 <9562#section-5.10>`." msgstr "" +":rfc:`RFC 9562, §5.10 <9562#section-5.10>` に従い、128 ビットすべてを 1 に設" +"定するよう規定された特殊な形式の UUID です。" -#: ../../library/uuid.rst:335 msgid ":rfc:`9562` - A Universally Unique IDentifier (UUID) URN Namespace" -msgstr "" +msgstr ":rfc:`9562` - 汎用一意識別子 (UUID) の URN 名前空間" #: ../../library/uuid.rst:336 msgid "" @@ -443,11 +480,12 @@ msgid "" "The :mod:`uuid` module can be executed as a script from the command line." msgstr "" -#: ../../library/uuid.rst:349 msgid "" "python -m uuid [-h] [-u {uuid1,uuid3,uuid4,uuid5,uuid6,uuid7,uuid8}] [-n " "NAMESPACE] [-N NAME]" msgstr "" +"python -m uuid [-h] [-u {uuid1,uuid3,uuid4,uuid5,uuid6,uuid7,uuid8}] [-n " +"NAMESPACE] [-N NAME]" #: ../../library/uuid.rst:353 msgid "The following options are accepted:" @@ -457,33 +495,36 @@ msgstr "以下のオプションが使用できます:" msgid "Show the help message and exit." msgstr "ヘルプメッセージを表示して終了します。" -#: ../../library/uuid.rst:364 msgid "" "Specify the function name to use to generate the uuid. By default :func:" "`uuid4` is used." msgstr "" +"UUID の生成に使う関数名を指定します。\n" +"デフォルトでは :func:`uuid4` を使います。" -#: ../../library/uuid.rst:367 msgid "Allow generating UUID versions 6, 7 and 8." -msgstr "" +msgstr "UUID バージョン 6、7、8 を生成できるようになりました。" -#: ../../library/uuid.rst:373 msgid "" "The namespace is a ``UUID``, or ``@ns`` where ``ns`` is a well-known " "predefined UUID addressed by namespace name. Such as ``@dns``, ``@url``, " "``@oid``, and ``@x500``. Only required for :func:`uuid3` / :func:`uuid5` " "functions." msgstr "" +"名前空間には ``UUID``、または名前空間名で指定する既知の定義済み UUID を表す " +"``@ns`` を指定します。\n" +"例えば ``@dns``、``@url``、``@oid``、``@x500`` です。\n" +":func:`uuid3` と :func:`uuid5` の関数でだけ必要です。" -#: ../../library/uuid.rst:380 msgid "" "The name used as part of generating the uuid. Only required for :func:" "`uuid3` / :func:`uuid5` functions." msgstr "" +"UUID の生成に使う名前です。\n" +":func:`uuid3` と :func:`uuid5` の関数でだけ必要です。" -#: ../../library/uuid.rst:386 msgid "Generate *num* fresh UUIDs." -msgstr "" +msgstr "新しい UUID を *num* 個生成します。" #: ../../library/uuid.rst:394 msgid "Example" @@ -546,9 +587,8 @@ msgid "" "datetime.datetime(...)" msgstr "" -#: ../../library/uuid.rst:452 msgid "Command-Line Example" -msgstr "" +msgstr "コマンドラインでの使用例" #: ../../library/uuid.rst:454 msgid "" @@ -556,7 +596,6 @@ msgid "" "interface:" msgstr "" -#: ../../library/uuid.rst:456 msgid "" "# generate a random UUID - by default uuid4() is used\n" "$ python -m uuid\n" @@ -570,3 +609,15 @@ msgid "" "# generate 42 random UUIDs\n" "$ python -m uuid -C 42" msgstr "" +"# ランダムな UUID を生成する。\n" +"# デフォルトでは uuid4() を使用する\n" +"$ python -m uuid\n" +"\n" +"# uuid1() で UUID を生成する\n" +"$ python -m uuid -u uuid1\n" +"\n" +"# uuid5 で UUID を生成する\n" +"$ python -m uuid -u uuid5 -n @url -N example.com\n" +"\n" +"# ランダムな UUID を 42 個生成する\n" +"$ python -m uuid -C 42" diff --git a/library/venv.po b/library/venv.po index 80e2d8104..40825ac0d 100644 --- a/library/venv.po +++ b/library/venv.po @@ -21,10 +21,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/venv.rst:2 @@ -57,40 +57,48 @@ msgstr "" "仮想環境の中から使われると、 :pypi:`pip` のような一般的なインストールツールは" "明示的に指定しなくても仮想環境に Python パッケージをインストールします。" -#: ../../library/venv.rst:36 msgid "A virtual environment is (amongst other things):" -msgstr "" +msgstr "仮想環境には、以下のような特徴があります:" -#: ../../library/venv.rst:38 msgid "" "Used to contain a specific Python interpreter and software libraries and " "binaries which are needed to support a project (library or application). " "These are by default isolated from software in other virtual environments " "and Python interpreters and libraries installed in the operating system." msgstr "" +"プロジェクト (ライブラリやアプリケーション) に必要な、特定の Python インター" +"プリタ、ソフトウェアライブラリ、バイナリを格納します。\n" +"デフォルトでは、他の仮想環境のソフトウェアや、オペレーティングシステムにイン" +"ストールされた Python インタープリタやライブラリから隔離されます。" -#: ../../library/venv.rst:43 msgid "" "Contained in a directory, conventionally named ``.venv`` or ``venv`` in the " "project directory, or under a container directory for lots of virtual " "environments, such as ``~/.virtualenvs``." msgstr "" +"1 つのディレクトリに格納されます。\n" +"慣習的には、プロジェクト内の ``.venv`` や ``venv`` という名前のディレクト" +"リ、\n" +"または ``~/.virtualenvs`` など、多数の仮想環境をまとめるディレクトリの下に作" +"成します。" -#: ../../library/venv.rst:47 msgid "Not checked into source control systems such as Git." -msgstr "" +msgstr "Git などのソース管理システムには登録しません。" -#: ../../library/venv.rst:49 msgid "" "Considered as disposable -- it should be simple to delete and recreate it " "from scratch. You don't place any project code in the environment." msgstr "" +"使い捨て可能なものとして扱います。\n" +"削除して最初から簡単に作り直せるようにすべきです。\n" +"プロジェクトのコードは環境内に置きません。" -#: ../../library/venv.rst:52 msgid "" "Not considered as movable or copyable -- you just recreate the same " "environment in the target location." msgstr "" +"移動やコピーをするものとは考えません。\n" +"目的の場所に同じ環境を作り直します。" #: ../../library/venv.rst:55 msgid "See :pep:`405` for more background on Python virtual environments." @@ -107,29 +115,30 @@ msgstr "" "`__" -#: ../../includes/wasm-mobile-notavail.rst:3 msgid "Availability" -msgstr "" +msgstr "利用可能な環境" #: ../../includes/wasm-mobile-notavail.rst:5 msgid "" "This module is not supported on :ref:`mobile platforms ` or :ref:`WebAssembly platforms `." msgstr "" +"このモジュールは :ref:`モバイルプラットフォーム ` と :" +"ref:`WebAssemblyプラットフォーム ` をサポートしません。" #: ../../library/venv.rst:65 msgid "Creating virtual environments" msgstr "仮想環境の作成" -#: ../../library/venv.rst:67 msgid "" ":ref:`Virtual environments ` are created by executing the ``venv`` " "module:" msgstr "" +":ref:`仮想環境 ` は、``venv`` モジュールを実行して作成します:" #: ../../library/venv.rst:70 msgid "python -m venv /path/to/new/virtual/environment" -msgstr "" +msgstr "python -m venv /path/to/new/virtual/environment" #: ../../library/venv.rst:74 msgid "" @@ -148,19 +157,21 @@ msgid "" "The use of ``venv`` is now recommended for creating virtual environments." msgstr "仮想環境の作成には、 ``venv`` の使用が今は推奨されています。" -#: ../../library/venv.rst:87 msgid "" ":program:`pyvenv` was the recommended tool for creating virtual environments " "for Python 3.3 and 3.4, and replaced in 3.5 by executing ``venv`` directly." msgstr "" +"Python 3.3 と 3.4 では、仮想環境の作成に :program:`pyvenv` が推奨されていまし" +"た。\n" +"3.5 では、代わりに ``venv`` を直接実行する方法になりました。" #: ../../library/venv.rst:93 msgid "On Windows, invoke the ``venv`` command as follows:" -msgstr "" +msgstr "Windows では、 ``venv`` コマンドは次のように実行します:" #: ../../library/venv.rst:95 msgid "PS> python -m venv C:\\path\\to\\new\\virtual\\environment" -msgstr "" +msgstr "PS> python -m venv C:\\path\\to\\new\\virtual\\environment" #: ../../library/venv.rst:99 msgid "The command, if run with ``-h``, will show the available options::" @@ -212,6 +223,8 @@ msgid "" "Installs pip by default, added the ``--without-pip`` and ``--copies`` " "options." msgstr "" +"デフォルトで pip をインストールします。``--without-pip`` と ``--copies`` オプ" +"ションを追加しました。" #: ../../library/venv.rst:143 msgid "" @@ -222,23 +235,24 @@ msgstr "" "clear`` オプションや ``--upgrade`` オプションを付けない限りはエラーを送出して" "いました。" -#: ../../library/venv.rst:147 msgid "" "Add ``--upgrade-deps`` option to upgrade pip + setuptools to the latest on " "PyPI." msgstr "" +"pip と setuptools を PyPI の最新版に更新する ``--upgrade-deps`` オプションを" +"追加しました。" -#: ../../library/venv.rst:152 msgid "``setuptools`` is no longer a core venv dependency." -msgstr "" +msgstr "``setuptools`` は venv の中核となる依存パッケージではなくなりました。" #: ../../library/venv.rst:156 msgid "Added the ``--without-scm-ignore-files`` option." -msgstr "" +msgstr "``--without-scm-ignore-files`` オプションが追加されました。" -#: ../../library/venv.rst:157 msgid "``venv`` now creates a :file:`.gitignore` file for Git by default." msgstr "" +"``venv`` はデフォルトで Git 用の :file:`.gitignore` ファイルを作成するように" +"なりました。" #: ../../library/venv.rst:161 msgid "" @@ -282,14 +296,16 @@ msgid "" "packages`` key, set to ``true`` if ``venv`` is run with the ``--system-site-" "packages`` option, ``false`` otherwise." msgstr "" +"作成された :file:`pyvenv.cfg` ファイルには、``include-system-site-packages`` " +"キーも含まれます。これは ``venv`` が ``--system-site-packages`` オプションを" +"つけて実行されたなら ``true`` で、そうでなければ ``false`` です。" -#: ../../library/venv.rst:182 msgid "" "Unless the ``--without-pip`` option is given, :mod:`ensurepip` will be " "invoked to bootstrap ``pip`` into the virtual environment." msgstr "" -"``--without-pip`` オプションが与えられない限り、``pip`` を仮想環境でブートす" -"るために :mod:`ensurepip` が呼ばれます。" +"``--without-pip`` オプションを指定しない限り、仮想環境に ``pip`` をインストー" +"ルするために :mod:`ensurepip` が呼び出されます。" #: ../../library/venv.rst:185 msgid "" @@ -319,7 +335,6 @@ msgstr "" "ス Python のディレクトリを指し示します。``sys.prefix != sys.base_prefix`` を" "調べれば、現在のインタプリタが仮想環境で実行しているかを判定できます。" -#: ../../library/venv.rst:203 msgid "" "A virtual environment may be \"activated\" using a script in its binary " "directory (``bin`` on POSIX; ``Scripts`` on Windows). This will prepend that " @@ -329,6 +344,13 @@ msgid "" "activation script is platform-specific (:samp:`{}` must be replaced by " "the path to the directory containing the virtual environment):" msgstr "" +"仮想環境は、そのバイナリディレクトリ (POSIX では ``bin``、Windows では " +"``Scripts``) 内のスクリプトで「有効化」できます。\n" +"この操作は、ディレクトリを :envvar:`PATH` の先頭に追加します。\n" +"その結果、:program:`python` を実行するとその環境の Python インタープリタが起" +"動し、インストール済みのスクリプトもフルパスを指定せずに実行できます。\n" +"有効化スクリプトの呼び出し方法はプラットフォームによって異なります (:samp:" +"`{}` は仮想環境のディレクトリのパスに置き換えてください):" #: ../../library/venv.rst:213 msgid "Platform" @@ -372,7 +394,7 @@ msgstr ":samp:`$ source {}/bin/activate.csh`" #: ../../library/venv.rst:221 msgid "pwsh" -msgstr "" +msgstr "pwsh" #: ../../library/venv.rst:221 msgid ":samp:`$ {}/bin/Activate.ps1`" @@ -433,6 +455,14 @@ msgid "" "window should run it with the correct interpreter without the environment " "needing to be activated or on the :envvar:`PATH`." msgstr "" +"これを達成するため、仮想環境にインストールされたスクリプトは、仮想環境の " +"Python インタープリターを指し示す \"shebang\" の行 :samp:`#!/{}/bin/python` を含みます。つまり、:envvar:`PATH` の値に関係なくそのスク" +"リプトはそのインタープリターを使って実行されます。Windows では、\"shebang\" " +"の行の処理は :ref:`launcher` がインストールされていれば可能です。したがって、" +"Windows のエクスプローラのウィンドウで、インストールされたスクリプトをダブル" +"クリックすると、仮想環境をアクティベートしたり :envvar:`PATH` を編集したりし" +"なくても、正しいインタープリターでスクリプトが実行されるはずです。" #: ../../library/venv.rst:250 msgid "" @@ -513,18 +543,24 @@ msgid "" "*system_site_packages* -- a boolean value indicating that the system Python " "site-packages should be available to the environment (defaults to ``False``)." msgstr "" +"*system_site_packages* -- 真偽値で、システムの Python の site-packages を仮想" +"環境から利用できるかどうかを示します (デフォルト: ``False``)。" #: ../../library/venv.rst:297 msgid "" "*clear* -- a boolean value which, if true, will delete the contents of any " "existing target directory, before creating the environment." msgstr "" +"*clear* -- 真偽値で、真の場合環境を作成する前に既存の対象ディレクトリの中身を" +"削除します。" #: ../../library/venv.rst:300 msgid "" "*symlinks* -- a boolean value indicating whether to attempt to symlink the " "Python binary rather than copying." msgstr "" +"*symlinks* -- 真偽値で、Python のバイナリをコピーせずにシンボリックの作成を試" +"みるかどうかを示します。" #: ../../library/venv.rst:303 msgid "" @@ -532,6 +568,9 @@ msgid "" "environment with the running Python - for use when that Python has been " "upgraded in-place (defaults to ``False``)." msgstr "" +"*upgrade* -- 真偽値で、真の場合実行中の Python で既存の環境をアップグレードし" +"ます。その Python がインプレースでアップグレードされたときに用います。デフォ" +"ルトは ``False`` です。" #: ../../library/venv.rst:307 msgid "" @@ -539,6 +578,8 @@ msgid "" "the virtual environment. This uses :mod:`ensurepip` with the ``--default-" "pip`` option." msgstr "" +"*with_pip* -- 真偽値で、真の場合仮想環境に pip がインストールされていることを" +"保証します。``--default-pip`` オプションで :mod:`ensurepip` を使用します。" #: ../../library/venv.rst:311 msgid "" @@ -547,18 +588,29 @@ msgid "" "used). If the special string ``\".\"`` is provided, the basename of the " "current directory is used as the prompt." msgstr "" +"*prompt* -- 仮想環境がアクティベートされたときに使う文字列(デフォルトは " +"``None`` のため、仮想環境のディレクトリ名が使われます)。もし特殊な文字列 " +"``\".\"`` が渡された場合、カレントディレクトリのベース名がプロンプトとして用" +"いられます。" #: ../../library/venv.rst:316 msgid "*upgrade_deps* -- Update the base venv modules to the latest on PyPI" msgstr "" +"*upgrade_deps* -- venv のベースのモジュールを PyPI での最新版にアップデートし" +"ます。" -#: ../../library/venv.rst:318 msgid "" "*scm_ignore_files* -- Create ignore files based for the specified source " "control managers (SCM) in the iterable. Support is defined by having a " "method named ``create_{scm}_ignore_file``. The only value supported by " "default is ``\"git\"`` via :meth:`create_git_ignore_file`." msgstr "" +"*scm_ignore_files* -- イテラブルで指定されたソース管理システム (SCM) の除外" +"ファイルを作成します。\n" +"``create_{scm}_ignore_file`` という名前のメソッドを定義すると、対応する SCM " +"を扱えるようになります。\n" +"デフォルトで対応している値は :meth:`create_git_ignore_file` による " +"``\"git\"`` だけです。" #: ../../library/venv.rst:324 msgid "Added the ``with_pip`` parameter" @@ -574,11 +626,10 @@ msgstr "``upgrade_deps`` 引数が追加されました。" #: ../../library/venv.rst:333 msgid "Added the ``scm_ignore_files`` parameter" -msgstr "" +msgstr "``scm_ignore_files`` 引数が追加されました。" -#: ../../library/venv.rst:336 msgid ":class:`EnvBuilder` may be used as a base class." -msgstr "" +msgstr ":class:`EnvBuilder` は基底クラスとして使えます。" #: ../../library/venv.rst:340 msgid "" @@ -600,7 +651,6 @@ msgstr "" ":class:`EnvBuilder` クラスの ``create`` メソッドは、サブクラスのカスタマイズ" "に使えるフックを説明します::" -#: ../../library/venv.rst:349 msgid "" "def create(self, env_dir):\n" " \"\"\"\n" @@ -614,6 +664,17 @@ msgid "" " self.setup_scripts(context)\n" " self.post_setup(context)" msgstr "" +"def create(self, env_dir):\n" +" \"\"\"\n" +" ディレクトリに Python 仮想環境を作成する。\n" +" env_dir は環境を作成する対象ディレクトリ。\n" +" \"\"\"\n" +" env_dir = os.path.abspath(env_dir)\n" +" context = self.ensure_directories(env_dir)\n" +" self.create_configuration(context)\n" +" self.setup_python(context)\n" +" self.setup_scripts(context)\n" +" self.post_setup(context)" #: ../../library/venv.rst:361 msgid "" @@ -763,16 +824,19 @@ msgid "" msgstr "" "プラットフォームに対応した有効化スクリプトを仮想環境にインストールします。" -#: ../../library/venv.rst:436 msgid "" "Upgrades the core venv dependency packages (currently :pypi:`pip`) in the " "environment. This is done by shelling out to the ``pip`` executable in the " "environment." msgstr "" +"仮想環境内で、venv の中核となる依存パッケージ (現在は :pypi:`pip`) を更新しま" +"す。\n" +"この処理は、環境内の ``pip`` 実行ファイルを外部コマンドとして呼び出して行いま" +"す。" -#: ../../library/venv.rst:443 msgid ":pypi:`setuptools` is no longer a core venv dependency." msgstr "" +":pypi:`setuptools` は venv の中核となる依存パッケージではなくなりました。" #: ../../library/venv.rst:447 msgid "" @@ -784,12 +848,13 @@ msgstr "" "ソッドをオーバーライドして、仮想環境構築後にパッケージのプリインストールなど" "のステップを実装できます。" -#: ../../library/venv.rst:453 msgid "" "This method can be called from :meth:`setup_scripts` or :meth:`post_setup` " "in subclasses to assist in installing custom scripts into the virtual " "environment." msgstr "" +"サブクラスの :meth:`setup_scripts` や :meth:`post_setup` からこのメソッドを呼" +"び出すと、仮想環境への独自スクリプトのインストールに役立ちます。" #: ../../library/venv.rst:457 msgid "" @@ -799,6 +864,10 @@ msgid "" "directory corresponding to :data:`os.name` are copied after some text " "replacement of placeholders:" msgstr "" +"*path* は ``common``, ``posix``, ``nt`` ディレクトリを格納したディレクトリへ" +"のパスです。各サブディレクトリには仮想環境の ``bin`` ディレクトリにインストー" +"ルするスクリプトを格納します。 ``common`` の中身と、 :data:`os.name` に一致す" +"るディレクトリの中身を、以下の置換処理を行いながらコピーします:" #: ../../library/venv.rst:463 msgid "" @@ -844,24 +913,23 @@ msgid "" "being upgraded)." msgstr "(既存環境のアップグレード中は) ディレクトリは存在しても構いません。" -#: ../../library/venv.rst:483 msgid "" "Creates a ``.gitignore`` file within the virtual environment that causes the " "entire directory to be ignored by the Git source control manager." msgstr "" +"仮想環境内に ``.gitignore`` ファイルを作成し、そのディレクトリ全体がソース管" +"理システムの Git で無視されるようにします。" -#: ../../library/venv.rst:488 msgid "" "Windows now uses redirector scripts for ``python[w].exe`` instead of copying " "the actual binaries. In 3.7.2 only :meth:`setup_python` does nothing unless " "running from a build in the source tree." msgstr "" -"Windows では、バイナリそのものをコピーするのではなく、``python[w].exe`` にリ" -"ダイレクトを行うスクリプトを使うようになりました。\n" -"3.7.2 でのみ、ソース群でビルドを実行しているのでなければ :meth:" -"`setup_python` だけは何もしません。" +"Windows では、実際のバイナリをコピーする代わりに、``python[w].exe`` としてリ" +"ダイレクト用スクリプトを使うようになりました。\n" +"3.7.2 に限り、ソースツリー内でビルドした Python を実行している場合を除き、:" +"meth:`setup_python` は何もしません。" -#: ../../library/venv.rst:493 msgid "" "Windows copies the redirector scripts as part of :meth:`setup_python` " "instead of :meth:`setup_scripts`. This was not the case in 3.7.2. When using " @@ -870,7 +938,7 @@ msgstr "" "Windows では、 :meth:`setup_scripts` の代わりに :meth:`setup_python` の一部と" "してリダイレクトを行うスクリプトをコピーします。\n" "これは 3.7.2 には当てはまりません。\n" -"シンボリックリンクを使ったときは、オリジナルの実行ファイルをコピーします。" +"シンボリックリンクを使ったときは、元の実行ファイルへのリンクを作成します。" #: ../../library/venv.rst:498 msgid "There is also a module-level convenience function:" @@ -886,19 +954,19 @@ msgstr "" #: ../../library/venv.rst:509 msgid "Added the *with_pip* parameter" -msgstr "" +msgstr "*with_pip* 引数が追加されました。" #: ../../library/venv.rst:512 msgid "Added the *prompt* parameter" -msgstr "" +msgstr "*prompt* 引数が追加されました。" #: ../../library/venv.rst:515 msgid "Added the *upgrade_deps* parameter" -msgstr "" +msgstr "*upgrade_deps* 引数が追加されました。" #: ../../library/venv.rst:518 msgid "Added the *scm_ignore_files* parameter" -msgstr "" +msgstr "*scm_ignore_files* 引数が追加されました。" #: ../../library/venv.rst:522 msgid "An example of extending ``EnvBuilder``" diff --git a/library/warnings.po b/library/warnings.po index 077ff3b14..892ccd03d 100644 --- a/library/warnings.po +++ b/library/warnings.po @@ -21,10 +21,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/warnings.rst:2 @@ -277,13 +277,16 @@ msgstr "" "リソースの使用に関連した警告カテゴリの基底クラスです (デフォルトでは無視され" "ます)。" -#: ../../library/warnings.rst:111 msgid "" "Previously :exc:`DeprecationWarning` and :exc:`FutureWarning` were " "distinguished based on whether a feature was being removed entirely or " "changing its behaviour. They are now distinguished based on their intended " "audience and the way they're handled by the default warnings filters." msgstr "" +"以前は、機能を完全に削除するか、動作を変更するかに基づいて :exc:" +"`DeprecationWarning` と :exc:`FutureWarning` を区別していました。\n" +"現在は、警告の対象となる利用者と、デフォルトの警告フィルタでの扱いに基づいて" +"区別しています。" #: ../../library/warnings.rst:122 msgid "The Warnings Filter" @@ -327,11 +330,12 @@ msgstr "処理方法" msgid "``\"default\"``" msgstr "``\"default\"``" -#: ../../library/warnings.rst:138 msgid "" "print the first occurrence of matching warnings for each location (module + " "line number) where the warning is issued" msgstr "" +"警告の発生箇所 (モジュールと行番号) ごとに、一致する警告の最初の一回を出力し" +"ます" #: ../../library/warnings.rst:142 msgid "``\"error\"``" @@ -357,23 +361,22 @@ msgstr "``\"always\"``" msgid "always print matching warnings" msgstr "一致した警告を常に出力します" -#: ../../library/warnings.rst:148 msgid "``\"all\"``" -msgstr "" +msgstr "``\"all\"``" -#: ../../library/warnings.rst:148 msgid "alias to \"always\"" -msgstr "" +msgstr "\"always\" の別名です" #: ../../library/warnings.rst:150 msgid "``\"module\"``" msgstr "``\"module\"``" -#: ../../library/warnings.rst:150 msgid "" "print the first occurrence of matching warnings for each module where the " "warning is issued (regardless of line number)" msgstr "" +"警告が発生するモジュールごとに、行番号にかかわらず、一致する警告の最初の一回" +"を出力します" #: ../../library/warnings.rst:154 msgid "``\"once\"``" @@ -395,13 +398,13 @@ msgid "" "at the start or end of *message*." msgstr "" -#: ../../library/warnings.rst:164 msgid "" "*category* is a class (a subclass of :exc:`Warning`) of which the warning " "category must be a subclass in order to match." msgstr "" -"*category* はクラス (:exc:`Warning` のサブクラス) です。警告クラスはこのクラ" -"スのサブクラスに一致しなければなりません。" +"*category* はクラス (:exc:`Warning` のサブクラス) です。\n" +"警告が一致するには、その警告カテゴリが *category* のサブクラスでなければなり" +"ません。" #: ../../library/warnings.rst:167 msgid "" @@ -429,43 +432,46 @@ msgstr "" "で、警告をエラーに変換するには単に ``category(message)`` を ``raise`` しま" "す。" -#: ../../library/warnings.rst:179 msgid "" "If a warning is reported and doesn't match any registered filter then the " "\"default\" action is applied (hence its name)." msgstr "" +"発せられた警告が登録済みのどのフィルタにも一致しない場合は、その名のとおり " +"\"default\" アクションが適用されます。" -#: ../../library/warnings.rst:187 msgid "Repeated Warning Suppression Criteria" -msgstr "" +msgstr "警告の繰り返しを抑制する基準" -#: ../../library/warnings.rst:189 msgid "" "The filters that suppress repeated warnings apply the following criteria to " "determine if a warning is considered a repeat:" msgstr "" +"警告の繰り返しを抑制するフィルタは、次の基準で警告が繰り返しかどうかを判断し" +"ます:" -#: ../../library/warnings.rst:191 msgid "" "``\"default\"``: A warning is considered a repeat only if the (*message*, " "*category*, *module*, *lineno*) are all the same." msgstr "" +"``\"default\"``: (*message*, *category*, *module*, *lineno*) がすべて同じ場合" +"に限り、警告を繰り返しと見なします。" -#: ../../library/warnings.rst:192 msgid "" "``\"module\"``: A warning is considered a repeat if the (*message*, " "*category*, *module*) are the same, ignoring the line number." msgstr "" +"``\"module\"``: 行番号を無視し、(*message*, *category*, *module*) が同じであ" +"れば、警告を繰り返しと見なします。" -#: ../../library/warnings.rst:193 msgid "" "``\"once\"``: A warning is considered a repeat if the (*message*, " "*category*) are the same, ignoring the module and line number." msgstr "" +"``\"once\"``: モジュールと行番号を無視し、(*message*, *category*) が同じであ" +"れば、警告を繰り返しと見なします。" -#: ../../library/warnings.rst:199 msgid "Describing Warning Filters" -msgstr "" +msgstr "警告フィルタの指定方法" #: ../../library/warnings.rst:201 msgid "" @@ -477,17 +483,15 @@ msgid "" "after printing a message to :data:`sys.stderr`)." msgstr "" -#: ../../library/warnings.rst:208 msgid "" "Individual warnings filters are specified as a sequence of fields separated " "by colons::" msgstr "" +"個々の警告フィルタは、コロンで区切ったフィールドの列として指定します。 ::" -#: ../../library/warnings.rst:211 msgid "action:message:category:module:line" -msgstr "" +msgstr "action:message:category:module:line" -#: ../../library/warnings.rst:213 msgid "" "The meaning of each of these fields is as described in :ref:`warning-" "filter`. When listing multiple filters on a single line (as for :envvar:" @@ -496,15 +500,22 @@ msgid "" "they're applied left-to-right, and the most recently applied filters take " "precedence over earlier ones)." msgstr "" +"各フィールドの意味は :ref:`warning-filter` で説明しています。\n" +":envvar:`PYTHONWARNINGS` のように複数のフィルタを一行に並べる場合は、フィルタ" +"をカンマで区切ります。\n" +"後に記述したフィルタが、それより前に記述したフィルタより優先されます (左から" +"右へ適用され、後から適用したフィルタが先に適用したものより優先されるためで" +"す)。" -#: ../../library/warnings.rst:220 msgid "" "Commonly used warning filters apply to either all warnings, warnings in a " "particular category, or warnings raised by particular modules or packages. " "Some examples::" msgstr "" +"よく使う警告フィルタは、すべての警告、特定のカテゴリの警告、または特定のモ" +"ジュールやパッケージが発する警告に適用するものです。\n" +"例を示します。 ::" -#: ../../library/warnings.rst:224 msgid "" "default # Show all warnings (even those ignored by " "default)\n" @@ -516,6 +527,15 @@ msgid "" "\"mymodule\"\n" "error:::mymodule # Convert warnings to errors in \"mymodule\"" msgstr "" +"default # すべての警告を表示する (デフォルトで無視される" +"ものも含む)\n" +"ignore # すべての警告を無視する\n" +"error # すべての警告をエラーにする\n" +"error::ResourceWarning # ResourceWarning のメッセージをエラーとして扱" +"う\n" +"default::DeprecationWarning # DeprecationWarning のメッセージを表示する\n" +"ignore,default:::mymodule # \"mymodule\" が発する警告だけを表示する\n" +"error:::mymodule # \"mymodule\" の警告をエラーにする" #: ../../library/warnings.rst:236 msgid "Default Warning Filter" @@ -531,13 +551,13 @@ msgstr "" "option:`-W` コマンドラインオプション、:envvar:`PYTHONWARNINGS` 環境変数また" "は :func:`filterwarnings` の呼び出しでオーバーライドできます。" -#: ../../library/warnings.rst:242 msgid "" "In regular release builds, the default warning filter has the following " "entries (in order of precedence)::" msgstr "" +"通常のリリースビルドでは、デフォルトの警告フィルタに次のエントリーが優先順に" +"含まれています。 ::" -#: ../../library/warnings.rst:245 msgid "" "default::DeprecationWarning:__main__\n" "ignore::DeprecationWarning\n" @@ -545,12 +565,18 @@ msgid "" "ignore::ImportWarning\n" "ignore::ResourceWarning" msgstr "" +"default::DeprecationWarning:__main__\n" +"ignore::DeprecationWarning\n" +"ignore::PendingDeprecationWarning\n" +"ignore::ImportWarning\n" +"ignore::ResourceWarning" -#: ../../library/warnings.rst:251 msgid "" "In a :ref:`debug build `, the list of default warning filters " "is empty." msgstr "" +":ref:`デバッグビルド ` では、デフォルトの警告フィルタのリストは" +"空です。" #: ../../library/warnings.rst:253 msgid "" @@ -560,24 +586,25 @@ msgstr "" ":exc:`PendingDeprecationWarning` に加えて、 :exc:`DeprecationWarning` もデ" "フォルトで無視されるようになりました。" -#: ../../library/warnings.rst:257 msgid "" ":exc:`DeprecationWarning` is once again shown by default when triggered " "directly by code in ``__main__``." msgstr "" +"``__main__`` 内のコードが直接発する :exc:`DeprecationWarning` は、再びデフォ" +"ルトで表示されるようになりました。" -#: ../../library/warnings.rst:261 msgid "" ":exc:`BytesWarning` no longer appears in the default filter list and is " "instead configured via :data:`sys.warnoptions` when :option:`-b` is " "specified twice." msgstr "" +":exc:`BytesWarning` がデフォルトのフィルタリストから除かれ、代わりに :option:" +"`-b` を二回指定したときに :data:`sys.warnoptions` を通じて設定されるようにな" +"りました。" -#: ../../library/warnings.rst:270 msgid "Overriding the default filter" -msgstr "" +msgstr "デフォルトのフィルタの上書き" -#: ../../library/warnings.rst:272 msgid "" "Developers of applications written in Python may wish to hide *all* Python " "level warnings from their users by default, and only display them when " @@ -586,8 +613,12 @@ msgid "" "can be used as a marker to indicate whether or not warnings should be " "disabled::" msgstr "" +"Python で書いたアプリケーションの開発者は、Python レベルの *すべての* 警告を" +"デフォルトでは利用者に表示せず、テストやその他の開発作業のときだけ表示したい" +"場合があります。\n" +"フィルタ設定をインタープリタに渡すための :data:`sys.warnoptions` 属性を、警告" +"を無効にすべきかどうかの目印に使えます。 ::" -#: ../../library/warnings.rst:278 msgid "" "import sys\n" "\n" @@ -595,15 +626,21 @@ msgid "" " import warnings\n" " warnings.simplefilter(\"ignore\")" msgstr "" +"import sys\n" +"\n" +"if not sys.warnoptions:\n" +" import warnings\n" +" warnings.simplefilter(\"ignore\")" -#: ../../library/warnings.rst:284 msgid "" "Developers of test runners for Python code are advised to instead ensure " "that *all* warnings are displayed by default for the code under test, using " "code like::" msgstr "" +"一方、Python コードのテストランナーを開発する場合は、次のようなコードを使い、" +"テスト対象のコードについてはデフォルトで *すべての* 警告を表示することを推奨" +"します。 ::" -#: ../../library/warnings.rst:288 msgid "" "import sys\n" "\n" @@ -612,6 +649,12 @@ msgid "" " warnings.simplefilter(\"default\") # Change the filter in this process\n" " os.environ[\"PYTHONWARNINGS\"] = \"default\" # Also affect subprocesses" msgstr "" +"import sys\n" +"\n" +"if not sys.warnoptions:\n" +" import os, warnings\n" +" warnings.simplefilter(\"default\") # このプロセス内のフィルタを変更する\n" +" os.environ[\"PYTHONWARNINGS\"] = \"default\" # 子プロセスにも反映する" #: ../../library/warnings.rst:295 msgid "" @@ -621,26 +664,30 @@ msgid "" "``user_ns`` is the module used to execute code entered interactively)::" msgstr "" -#: ../../library/warnings.rst:300 msgid "" "import warnings\n" "warnings.filterwarnings(\"default\", category=DeprecationWarning,\n" " module=user_ns.get(\"__name__\"))" msgstr "" +"import warnings\n" +"warnings.filterwarnings(\"default\", category=DeprecationWarning,\n" +" module=user_ns.get(\"__name__\"))" #: ../../library/warnings.rst:308 msgid "Temporarily Suppressing Warnings" msgstr "一時的に警告を抑制する" -#: ../../library/warnings.rst:310 msgid "" "If you are using code that you know will raise a warning, such as a " "deprecated function, but do not want to see the warning (even when warnings " "have been explicitly configured via the command line), then it is possible " "to suppress the warning using the :class:`catch_warnings` context manager::" msgstr "" +"非推奨の関数など、警告を発することが分かっているコードを使う際に、その警告を" +"表示したくない場合は、:class:`catch_warnings` コンテキストマネージャーで抑制" +"できます。\n" +"コマンドラインで警告が明示的に設定されていても抑制できます。 ::" -#: ../../library/warnings.rst:315 msgid "" "import warnings\n" "\n" @@ -651,22 +698,34 @@ msgid "" " warnings.simplefilter(\"ignore\")\n" " fxn()" msgstr "" +"import warnings\n" +"\n" +"def fxn():\n" +" warnings.warn(\"deprecated\", DeprecationWarning)\n" +"\n" +"with warnings.catch_warnings():\n" +" warnings.simplefilter(\"ignore\")\n" +" fxn()" -#: ../../library/warnings.rst:324 msgid "" "While within the context manager all warnings will simply be ignored. This " "allows you to use known-deprecated code without having to see the warning " "while not suppressing the warning for other code that might not be aware of " "its use of deprecated code." msgstr "" +"このコンテキストマネージャー内では、すべての警告が無視されます。\n" +"これにより、非推奨と分かっているコードを警告を見ることなく使えます。\n" +"その一方で、非推奨のコードを使っていることを認識していないかもしれない、他の" +"コードに対する警告は抑制しません。" -#: ../../library/warnings.rst:331 ../../library/warnings.rst:373 -#: ../../library/warnings.rst:623 msgid "" "See :ref:`warning-concurrent-safe` for details on the concurrency-safety of " "the :class:`catch_warnings` context manager when used in programs using " "multiple threads or async functions." msgstr "" +"複数のスレッドや非同期関数を使うプログラムで :class:`catch_warnings` コンテキ" +"ストマネージャーを使う際の、並行処理の安全性については :ref:`warning-" +"concurrent-safe` を参照してください。" #: ../../library/warnings.rst:338 msgid "Testing Warnings" @@ -684,7 +743,6 @@ msgstr "" "作してテストに利用できます。例えば、次のコードでは、発生したすべての警告を取" "得してチェックしています::" -#: ../../library/warnings.rst:345 msgid "" "import warnings\n" "\n" @@ -701,6 +759,20 @@ msgid "" " assert issubclass(w[-1].category, DeprecationWarning)\n" " assert \"deprecated\" in str(w[-1].message)" msgstr "" +"import warnings\n" +"\n" +"def fxn():\n" +" warnings.warn(\"deprecated\", DeprecationWarning)\n" +"\n" +"with warnings.catch_warnings(record=True) as w:\n" +" # すべての警告を常に発生させる。\n" +" warnings.simplefilter(\"always\")\n" +" # 警告を発生させる。\n" +" fxn()\n" +" # いくつかの項目を検証する\n" +" assert len(w) == 1\n" +" assert issubclass(w[-1].category, DeprecationWarning)\n" +" assert \"deprecated\" in str(w[-1].message)" #: ../../library/warnings.rst:360 msgid "" @@ -715,13 +787,16 @@ msgstr "" "ルールによって発生した警告は、フィルタに何をセットしているかにかかわらず、警" "告レジストリをクリアしない限りは 2度と発生しません。" -#: ../../library/warnings.rst:366 msgid "" "Once the context manager exits, the warnings filter is restored to its state " "when the context was entered. This prevents tests from changing the warnings " "filter in unexpected ways between tests and leading to indeterminate test " "results." msgstr "" +"コンテキストマネージャーを抜けると、警告フィルタはコンテキストに入ったときの" +"状態に戻ります。\n" +"これにより、テスト間で警告フィルタが予期せず変更され、テスト結果が不定になる" +"ことを防ぎます。" #: ../../library/warnings.rst:377 msgid "" @@ -737,18 +812,17 @@ msgstr "" "各操作が例外を発生させることを確認したり、警告リストの長さが各操作で増加して" "いることを確認したり、警告リストを各操作の前に毎回クリアする事ができます)。" -#: ../../library/warnings.rst:388 msgid "Updating Code For New Versions of Dependencies" -msgstr "" +msgstr "依存先の新しいバージョンに合わせたコードの更新" -#: ../../library/warnings.rst:390 msgid "" "Warning categories that are primarily of interest to Python developers " "(rather than end users of applications written in Python) are ignored by " "default." msgstr "" +"主に Python 開発者向けの警告カテゴリ (Python で書かれたアプリケーションのエン" +"ドユーザー向けではないもの) は、デフォルトで無視されます。" -#: ../../library/warnings.rst:393 msgid "" "Notably, this \"ignored by default\" list includes :exc:`DeprecationWarning` " "(for every module except ``__main__``), which means developers should make " @@ -756,15 +830,22 @@ msgid "" "order to receive timely notifications of future breaking API changes " "(whether in the standard library or third party packages)." msgstr "" +"特に、この「デフォルトで無視する」リストには、``__main__`` 以外のすべてのモ" +"ジュールの :exc:`DeprecationWarning` が含まれます。\n" +"そのため開発者は、通常は無視される警告を表示するようにしてコードをテストする" +"必要があります。\n" +"そうすれば、標準ライブラリやサードパーティのパッケージで将来行われる、互換性" +"を損なう API の変更を早めに把握できます。" -#: ../../library/warnings.rst:399 msgid "" "In the ideal case, the code will have a suitable test suite, and the test " "runner will take care of implicitly enabling all warnings when running tests " "(the test runner provided by the :mod:`unittest` module does this)." msgstr "" +"理想的には、コードに適切なテストスイートが用意されており、テスト実行時にはテ" +"ストランナーが暗黙にすべての警告を有効にします (:mod:`unittest` モジュールが" +"提供するテストランナーは、このように動作します)。" -#: ../../library/warnings.rst:403 msgid "" "In less ideal cases, applications can be checked for use of deprecated " "interfaces by passing :option:`-Wd <-W>` to the Python interpreter (this is " @@ -775,12 +856,20 @@ msgid "" "W` (e.g. :option:`!-W error`). See the :option:`-W` flag for more details on " "what is possible." msgstr "" +"そうした環境が整っていない場合でも、Python インタープリタに :option:`-Wd <-" +"W>` (:option:`!-W default` の省略形) を渡すか、環境変数 " +"``PYTHONWARNINGS=default`` を設定すれば、アプリケーションが非推奨のインター" +"フェースを使っていないか確認できます。\n" +"これにより、デフォルトでは無視される警告も含め、すべての警告にデフォルトの処" +"理が適用されます。\n" +"警告が発生したときの動作を変えるには、:option:`-W` に渡す引数を変更します " +"(例: :option:`!-W error`)。\n" +"設定できる内容の詳細は :option:`-W` フラグを参照してください。" #: ../../library/warnings.rst:416 msgid "Available Functions" msgstr "利用可能な関数" -#: ../../library/warnings.rst:421 msgid "" "Issue a warning, or maybe ignore it or raise an exception. The *category* " "argument, if given, must be a :ref:`warning category class `. The *stacklevel* argument can be used by wrapper " "functions written in Python, like this::" msgstr "" -"警告を発するか、無視するか、あるいは例外を送出します。 *category* 引数が与え" -"られた場合、 :ref:`警告カテゴリクラス ` でなければなりま" -"せん; 標準の値は :exc:`UserWarning` です。 *message* を :exc:`Warning` インス" -"タンスで代用することもできますが、この場合 *category* は無視され、 ``message." -"__class__`` が使われ、メッセージ文は ``str(message)`` になります。発された例" -"外が前述した :ref:`警告フィルタ ` によってエラーに変更された" -"場合、この関数は例外を送出します。引数 *stacklevel* は Python でラッパー関数" -"を書く際に利用することができます。例えば::" +"警告を発しますが、無視するか例外を送出する場合もあります。\n" +"*category* 引数を指定する場合は :ref:`警告カテゴリクラス ` でなければなりません。\n" +"デフォルトは :exc:`UserWarning` です。\n" +"あるいは *message* に :exc:`Warning` のインスタンスを指定することもでき、その" +"場合は *category* を無視して ``message.__class__`` を使います。\n" +"この場合のメッセージのテキストは ``str(message)`` になります。\n" +"発した警告が :ref:`警告フィルタ ` によってエラーに変更される" +"場合、この関数は例外を送出します。\n" +"*stacklevel* 引数は Python で書くラッパー関数で次のように使えます。 ::" -#: ../../library/warnings.rst:430 msgid "" "def deprecated_api(message):\n" " warnings.warn(message, DeprecationWarning, stacklevel=2)" msgstr "" +"def deprecated_api(message):\n" +" warnings.warn(message, DeprecationWarning, stacklevel=2)" -#: ../../library/warnings.rst:433 msgid "" "This makes the warning refer to ``deprecated_api``'s caller, rather than to " "the source of ``deprecated_api`` itself (since the latter would defeat the " "purpose of the warning message)." msgstr "" +"これにより、警告は ``deprecated_api`` 自体のソースではなく、" +"``deprecated_api`` の呼び出し元を指すようになります (関数自体を指しては警告" +"メッセージの目的を果たせないためです)。" -#: ../../library/warnings.rst:437 msgid "" "The *skip_file_prefixes* keyword argument can be used to indicate which " "stack frames are ignored when counting stack levels. This can be useful when " @@ -825,6 +918,16 @@ msgid "" "stacklevel)``. To cause a warning to be attributed to the caller from " "outside of the current package you might write::" msgstr "" +"キーワード引数 *skip_file_prefixes* では、スタックレベルを数える際に無視する" +"スタックフレームを指定できます。\n" +"一定の *stacklevel* ではすべての呼び出し経路に対応できない場合や、その値の保" +"守が難しい場合に、常にパッケージの外の呼び出し箇所を警告の発生箇所とするのに" +"役立ちます。\n" +"指定する場合は文字列のタプルでなければなりません。\n" +"接頭辞を指定すると、``stacklevel`` は暗黙に ``max(2, stacklevel)`` に置き換え" +"られます。\n" +"現在のパッケージの外から呼び出した箇所に警告を対応させるには、次のように書け" +"ます。 ::" #: ../../library/warnings.rst:446 msgid "" @@ -862,9 +965,8 @@ msgstr "" msgid "Added *source* parameter." msgstr "*source* 引数を追加しました。" -#: ../../library/warnings.rst:470 msgid "Added *skip_file_prefixes*." -msgstr "" +msgstr "*skip_file_prefixes* が追加されました。" #: ../../library/warnings.rst:476 msgid "" @@ -975,23 +1077,25 @@ msgstr "" "ションによるもの :func:`simplefilter` 呼び出しによるものを含め、 :func:" "`filterwarnings` の呼び出しによる影響はすべて無効化されます。" -#: ../../library/warnings.rst:547 msgid "Decorator to indicate that a class, function or overload is deprecated." msgstr "" +"クラス、関数、またはオーバーロードが非推奨であることを示すデコレータです。" -#: ../../library/warnings.rst:549 msgid "" "When this decorator is applied to an object, deprecation warnings may be " "emitted at runtime when the object is used. :term:`static type checkers " "` will also generate a diagnostic on usage of the " "deprecated object." msgstr "" +"このデコレータをオブジェクトに適用すると、そのオブジェクトを使ったときに実行" +"時に非推奨の警告が発せられることがあります。\n" +":term:`静的型チェッカー ` も、非推奨のオブジェクトの使用" +"に対して診断メッセージを出します。" #: ../../library/warnings.rst:554 msgid "Usage::" msgstr "使い方::" -#: ../../library/warnings.rst:556 msgid "" "from warnings import deprecated\n" "from typing import overload\n" @@ -1010,8 +1114,23 @@ msgid "" "@overload\n" "def g(x: str) -> int: ..." msgstr "" +"from warnings import deprecated\n" +"from typing import overload\n" +"\n" +"@deprecated(\"Use B instead\")\n" +"class A:\n" +" pass\n" +"\n" +"@deprecated(\"Use g instead\")\n" +"def f():\n" +" pass\n" +"\n" +"@overload\n" +"@deprecated(\"int support is deprecated\")\n" +"def g(x: int) -> int: ...\n" +"@overload\n" +"def g(x: str) -> int: ..." -#: ../../library/warnings.rst:573 msgid "" "The warning specified by *category* will be emitted at runtime on use of " "deprecated objects. For functions, that happens on calls; for classes, on " @@ -1022,6 +1141,16 @@ msgid "" "further up the stack. Static type checker behavior is not affected by the " "*category* and *stacklevel* arguments." msgstr "" +"非推奨のオブジェクトを使ったときに、*category* で指定した警告を実行時に発しま" +"す。\n" +"関数の場合は呼び出し時、クラスの場合はインスタンス化時とサブクラスの作成時に" +"発します。\n" +"*category* が ``None`` の場合、実行時の警告は発しません。\n" +"*stacklevel* は警告の発生箇所を決めます。\n" +"``1`` (デフォルト) の場合、非推奨のオブジェクトを直接呼び出した箇所で警告を発" +"します。\n" +"値を大きくすると、スタック上でより上位の箇所になります。\n" +"*category* と *stacklevel* 引数は、静的型チェッカーの動作には影響しません。" #: ../../library/warnings.rst:584 msgid "" @@ -1032,9 +1161,8 @@ msgid "" "by :func:`typing.get_overloads`." msgstr "" -#: ../../library/warnings.rst:591 msgid "See :pep:`702`." -msgstr "" +msgstr ":pep:`702` を参照してください。" #: ../../library/warnings.rst:596 msgid "Available Context Managers" @@ -1068,28 +1196,27 @@ msgstr "" "`warnings` を import して得られるモジュールの代わりに利用されます。この引数" "は、主に :mod:`warnings` モジュール自体をテストする目的で追加されました。" -#: ../../library/warnings.rst:614 msgid "" "If the *action* argument is not ``None``, the remaining arguments are passed " "to :func:`simplefilter` as if it were called immediately on entering the " "context." msgstr "" +"*action* 引数が ``None`` でない場合、残りの引数を :func:`simplefilter` に渡" +"し、コンテキストに入った直後に呼び出した場合と同じ処理を行います。" -#: ../../library/warnings.rst:618 msgid "" "See :ref:`warning-filter` for the meaning of the *category* and *lineno* " "parameters." msgstr "" +"*category* と *lineno* パラメータの意味は :ref:`warning-filter` を参照してく" +"ださい。" -#: ../../library/warnings.rst:630 msgid "Added the *action*, *category*, *lineno*, and *append* parameters." -msgstr "" +msgstr "*action*、*category*、*lineno*、*append* パラメータが追加されました。" -#: ../../library/warnings.rst:636 msgid "Concurrent safety of Context Managers" -msgstr "" +msgstr "コンテキストマネージャーの並行処理の安全性" -#: ../../library/warnings.rst:638 msgid "" "The behavior of :class:`catch_warnings` context manager depends on the :data:" "`sys.flags.context_aware_warnings` flag. If the flag is true, the context " @@ -1099,6 +1226,14 @@ msgid "" "predictable in a multi-threaded program. The flag defaults to true for free-" "threaded builds and false otherwise." msgstr "" +":class:`catch_warnings` コンテキストマネージャーの動作は、:data:`sys.flags." +"context_aware_warnings` フラグに依存します。\n" +"このフラグが真なら並行処理で安全に動作し、偽なら安全ではありません。\n" +"並行処理で安全とは、スレッドセーフであり、:ref:`asyncio のコルーチン " +"` やタスク内でも安全に使えるという意味です。\n" +"スレッドセーフとは、マルチスレッドのプログラムで動作が予測可能であるという意" +"味です。\n" +"このフラグのデフォルト値は、フリースレッドビルドでは真、それ以外では偽です。" #: ../../library/warnings.rst:646 msgid "" @@ -1119,13 +1254,17 @@ msgid "" "safe." msgstr "" -#: ../../library/warnings.rst:659 msgid "" "The *record* parameter of the context handler also behaves differently " "depending on the value of the flag. When *record* is true and the flag is " "false, the context manager works by replacing and then later restoring the " "module's :func:`showwarning` function. That is not concurrent-safe." msgstr "" +"コンテキストマネージャーの *record* パラメータの動作も、フラグの値によって異" +"なります。\n" +"*record* が真でフラグが偽の場合、コンテキストマネージャーはモジュールの :" +"func:`showwarning` 関数を置き換え、後で元に戻すことで動作します。\n" +"これは並行処理で安全ではありません。" #: ../../library/warnings.rst:664 msgid "" @@ -1135,14 +1274,15 @@ msgid "" "function will not be restored when exiting the context handler." msgstr "" -#: ../../library/warnings.rst:669 msgid "" "The :data:`~sys.flags.context_aware_warnings` flag can be set the :option:`-" "X context_aware_warnings<-X>` command-line option or by the :envvar:" "`PYTHON_CONTEXT_AWARE_WARNINGS` environment variable." msgstr "" +":data:`~sys.flags.context_aware_warnings` フラグは、コマンドラインオプショ" +"ン :option:`-X context_aware_warnings<-X>` または環境変数 :envvar:" +"`PYTHON_CONTEXT_AWARE_WARNINGS` で設定できます。" -#: ../../library/warnings.rst:675 msgid "" "It is likely that most programs that desire thread-safe behaviour of the " "warnings module will also want to set the :data:`~sys.flags." @@ -1154,13 +1294,26 @@ msgid "" "variable, meaning that any filtering that was established by a :class:" "`catch_warnings` context manager will no longer be active." msgstr "" +"warnings モジュールをスレッドセーフに使いたいプログラムの多くでは、:data:" +"`~sys.flags.thread_inherit_context` フラグも真に設定することが望ましいでしょ" +"う。\n" +"このフラグを設定すると、:class:`threading.Thread` で作成したスレッドは、その" +"スレッドを開始したスレッドのコンテキスト変数のコピーを持って開始します。\n" +"真の場合、あるスレッド内で :class:`catch_warnings` によって設定したコンテキス" +"トは、そのスレッドが開始する新しいスレッドにも適用されます。\n" +"偽の場合、新しいスレッドは空の警告コンテキスト変数を持って開始するため、:" +"class:`catch_warnings` コンテキストマネージャーで設定したフィルタは有効ではな" +"くなります。" -#: ../../library/warnings.rst:688 msgid "" "Added the :data:`sys.flags.context_aware_warnings` flag and the use of a " "context variable for :class:`catch_warnings` if the flag is true. Previous " "versions of Python acted as if the flag was always set to false." msgstr "" +":data:`sys.flags.context_aware_warnings` フラグが追加されました。\n" +"このフラグが真の場合、:class:`catch_warnings` はコンテキスト変数を使いま" +"す。\n" +"以前の Python は、常にこのフラグを偽に設定した場合と同じ動作をしていました。" #: ../../library/warnings.rst:9 msgid "warnings" diff --git a/library/wave.po b/library/wave.po index ea6e6eacf..5714cd3e2 100644 --- a/library/wave.po +++ b/library/wave.po @@ -17,10 +17,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/wave.rst:2 @@ -38,11 +38,12 @@ msgid "" "are supported." msgstr "" -#: ../../library/wave.rst:20 msgid "" "Support for ``WAVE_FORMAT_EXTENSIBLE`` headers was added, provided that the " "extended format is ``KSDATAFORMAT_SUBTYPE_PCM``." msgstr "" +"拡張形式が ``KSDATAFORMAT_SUBTYPE_PCM`` の場合に、``WAVE_FORMAT_EXTENSIBLE`` " +"ヘッダに対応するようになりました。" #: ../../library/wave.rst:23 msgid "The :mod:`wave` module defines the following function and exception:" @@ -90,19 +91,23 @@ msgstr "" "file-like オブジェクトが *file* として渡されると、 ``file.mode`` が *mode* の" "デフォルト値として使われます。" -#: ../../library/wave.rst:44 msgid "" "If you pass in a file-like object, the wave object will not close it when " "its ``close()`` method is called; it is the caller's responsibility to close " "the file object." msgstr "" +"ファイルライクオブジェクトを渡した場合、wave オブジェクトの ``close()`` メ" +"ソッドを呼び出しても、そのファイルオブジェクトは閉じません。\n" +"ファイルオブジェクトを閉じるのは呼び出し側の責任です。" -#: ../../library/wave.rst:48 msgid "" "The :func:`.open` function may be used in a :keyword:`with` statement. When " "the :keyword:`!with` block completes, the :meth:`Wave_read.close` or :meth:" "`Wave_write.close` method is called." msgstr "" +":func:`.open` 関数は :keyword:`with` 文で使えます。\n" +":keyword:`!with` ブロックが終了すると、:meth:`Wave_read.close` または :meth:" +"`Wave_write.close` メソッドが呼び出されます。" #: ../../library/wave.rst:52 ../../library/wave.rst:184 msgid "Added support for unseekable files." @@ -120,9 +125,8 @@ msgstr "" msgid "Wave_read Objects" msgstr "Wave_read オブジェクト" -#: ../../library/wave.rst:68 msgid "Read a WAV file." -msgstr "" +msgstr "WAV ファイルを読み込みます。" #: ../../library/wave.rst:70 msgid "" @@ -170,12 +174,14 @@ msgstr "" ":meth:`getcomptype` を人に判読可能な形にしたものです。通常、 ``'NONE'`` に対" "して ``'not compressed'`` が返されます。" -#: ../../library/wave.rst:112 msgid "" "Returns a :func:`~collections.namedtuple` ``(nchannels, sampwidth, " "framerate, nframes, comptype, compname)``, equivalent to output of the " "``get*()`` methods." msgstr "" +"``get*()`` メソッドの戻り値に相当する、:func:`~collections.namedtuple` の " +"``(nchannels, sampwidth, framerate, nframes, comptype, compname)`` を返しま" +"す。" #: ../../library/wave.rst:119 msgid "" @@ -208,13 +214,12 @@ msgstr "" msgid "Raise an error." msgstr "エラーを発生します。" -#: ../../library/wave.rst:147 msgid "" "The following two methods define a term \"position\" which is compatible " "between them, and is otherwise implementation dependent." msgstr "" -"以下の2つのメソッドは共通の\"位置\"を定義しています。\"位置\"は他の関数とは独" -"立して実装されています。" +"以下の 2 つのメソッドが扱う「位置」は互いに互換性がありますが、それ以外の点で" +"は実装依存です。" #: ../../library/wave.rst:153 msgid "Set the file pointer to the specified position." @@ -228,15 +233,12 @@ msgstr "ファイルの現在のポインタ位置を返します。" msgid "Wave_write Objects" msgstr "Wave_write オブジェクト" -#: ../../library/wave.rst:168 msgid "Write a WAV file." -msgstr "" +msgstr "WAV ファイルを書き込みます。" -#: ../../library/wave.rst:170 msgid "Wave_write objects, as returned by :func:`.open`." -msgstr "" +msgstr ":func:`.open` が返す Wave_write オブジェクトです。" -#: ../../library/wave.rst:172 msgid "" "For seekable output streams, the ``wave`` header will automatically be " "updated to reflect the number of frames actually written. For unseekable " @@ -249,10 +251,21 @@ msgid "" "`writeframes` will calculate the number of frames in the data and set " "*nframes* accordingly before writing the frame data." msgstr "" +"シーク可能な出力ストリームでは、実際に書き込まれたフレーム数を反映するように " +"``wave`` ヘッダが自動更新されます。\n" +"シーク不能なストリームでは、最初のフレームデータを書き込む時点で *nframes* の" +"値が正確でなければなりません。\n" +"正確な *nframes* を設定する方法は 2 つあります。\n" +"1 つは、:meth:`close` を呼び出すまでに書き込むフレーム数を指定して :meth:" +"`setnframes` または :meth:`setparams` を呼び出し、\n" +"その後 :meth:`writeframesraw` でフレームデータを書き込む方法です。\n" +"もう 1 つは、書き込むすべてのフレームデータを指定して :meth:`writeframes` を" +"呼び出す方法です。\n" +"後者では、:meth:`writeframes` がフレームデータを書き込む前にデータ内のフレー" +"ム数を計算し、それに合わせて *nframes* を設定します。" -#: ../../library/wave.rst:187 msgid "Wave_write objects have the following methods:" -msgstr "" +msgstr "Wave_write オブジェクトには以下のメソッドがあります:" #: ../../library/wave.rst:191 msgid "" @@ -324,16 +337,15 @@ msgstr "*nframes* の修正なしにオーディオフレームを書き込み msgid "Any :term:`bytes-like object` is now accepted." msgstr "どのような :term:`bytes-like object` も使用できるようになりました。" -#: ../../library/wave.rst:252 msgid "" "Write audio frames and make sure *nframes* is correct. It will raise an " "error if the output stream is not seekable and the total number of frames " "that have been written after *data* has been written does not match the " "previously set value for *nframes*." msgstr "" -"出力ストリームが seek 不可能で、 *data* が書き込まれた後でそれ以前に " -"*nframes* に設定された値と書き込まれた全フレーム数が一致しなければ、エラーを" -"送出します。" +"オーディオフレームを書き込み、*nframes* が正しい値になるようにします。\n" +"出力ストリームがシーク不能で、*data* の書き込み後の総フレーム数が事前に設定し" +"た *nframes* と一致しない場合は、エラーを送出します。" #: ../../library/wave.rst:260 msgid "" diff --git a/library/weakref.po b/library/weakref.po index 8bf50cf1f..7fb10a3e0 100644 --- a/library/weakref.po +++ b/library/weakref.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: Arihiro TAKASE, 2023\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/weakref.rst:4 @@ -141,7 +141,6 @@ msgstr "" "ん。低レベルな機構は、より進んだ使い方をするために :mod:`weakref` モジュール" "として公開されています。" -#: ../../library/weakref.rst:68 msgid "" "Not all objects can be weakly referenced. Objects which support weak " "references include class instances, functions written in Python (but not in " @@ -149,12 +148,13 @@ msgid "" "object>`, :term:`generators `, type objects, sockets, arrays, " "deques, regular expression pattern objects, and code objects." msgstr "" -"全てのオブジェクトが弱参照で参照できるわけではありません。弱参照をサポートす" -"るオブジェクトは、クラスインスタンス、(C ではなく) Python で書かれた関数、イ" -"ンスタンスメソッド、set オブジェクト、frozenset オブジェクト、 :term:`file オ" -"ブジェクト ` 、 :term:`generators ` 型のオブジェク" -"ト、socket オブジェクト、array オジェクト、deque オブジェクト、正規表現パター" -"ンオブジェクト、code オブジェクトです。" +"すべてのオブジェクトを弱参照できるわけではありません。\n" +"弱参照に対応するオブジェクトには、クラスインスタンス、(C ではなく) Python で" +"書かれた関数、インスタンスメソッド、\n" +"set、frozenset、一部の :term:`ファイルオブジェクト `、:term:`" +"ジェネレータ `、型オブジェクト、\n" +"ソケット、配列、deque、正規表現パターンオブジェクト、コードオブジェクトがあり" +"ます。" #: ../../library/weakref.rst:74 msgid "Added support for thread.lock, threading.Lock, and code objects." @@ -169,13 +169,16 @@ msgstr "" ":class:`list` や :class:`dict` など、いくつかの組み込み型は弱参照を直接サポー" "トしませんが、以下のようにサブクラス化を行えばサポートを追加できます::" -#: ../../library/weakref.rst:80 msgid "" "class Dict(dict):\n" " pass\n" "\n" "obj = Dict(red=1, green=2, blue=3) # this object is weak referenceable" msgstr "" +"class Dict(dict):\n" +" pass\n" +"\n" +"obj = Dict(red=1, green=2, blue=3) # このオブジェクトは弱参照できる" #: ../../library/weakref.rst:87 msgid "" @@ -201,7 +204,6 @@ msgid "" "documentation ` for details." msgstr "" -#: ../../library/weakref.rst:100 msgid "" "Return a weak reference to *object*. The original object can be retrieved " "by calling the reference object if the referent is still alive; if the " @@ -212,12 +214,16 @@ msgid "" "passed as the only parameter to the callback; the referent will no longer be " "available." msgstr "" -"*object* への弱参照を返します。リファレントがまだ生きているならば、元のオブ" -"ジェクトは参照オブジェクトの呼び出しで取り出せす。リファレントがもはや生きて" -"いないならば、参照オブジェクトを呼び出したときに :const:`None` を返します。 " -"*callback* に :const:`None` 以外の値を与えた場合、オブジェクトをまさに後始末" -"処理しようとするときに呼び出します。このとき弱参照オブジェクトは *callback* " -"の唯一のパラメタとして渡されます。リファレントはもはや利用できません。" +"*object* への弱参照を返します。\n" +"リファレントがまだ生きていれば、参照オブジェクトを呼び出すことで元のオブジェ" +"クトを取り出せます。\n" +"リファレントが生きていなければ、参照オブジェクトを呼び出すと :const:`None` が" +"返ります。\n" +"*callback* に :const:`None` 以外の値が指定され、返された弱参照オブジェクトが" +"まだ生きている場合、リファレントの後始末処理の直前にコールバックが呼び出され" +"ます。\n" +"コールバックには弱参照オブジェクトが唯一の引数として渡されますが、その時点で" +"リファレントは利用できません。" #: ../../library/weakref.rst:108 msgid "" @@ -229,12 +235,15 @@ msgstr "" "登録されたコールバックは、もっとも新しく登録されたコールバックからもっとも古" "いものへと呼び出されます。" -#: ../../library/weakref.rst:112 msgid "" "Exceptions raised by the callback will be noted on the standard error " "output, but cannot be propagated; they are handled in exactly the same way " "as exceptions raised from an object's :meth:`~object.__del__` method." msgstr "" +"コールバックで発生した例外は標準エラー出力に表示されますが、呼び出し元には伝" +"播しません。\n" +"オブジェクトの :meth:`~object.__del__` メソッドで発生した例外とまったく同じよ" +"うに扱われます。" #: ../../library/weakref.rst:116 msgid "" @@ -248,7 +257,6 @@ msgstr "" "*object* が削除されてから初めて :func:`hash` が呼び出された場合に、その呼び出" "しは :exc:`TypeError` を発生させます。" -#: ../../library/weakref.rst:121 msgid "" "Weak references support tests for equality, but not ordering. If the " "referents are still alive, two references have the same equality " @@ -256,14 +264,14 @@ msgid "" "referent has been deleted, the references are equal only if the reference " "objects are the same object." msgstr "" -"弱参照は等価性のテストをサポートしていますが、順序をサポートしていません。参" -"照がまだ生きているならば、 *callback* に関係なく二つの参照はそれらのリファレ" -"ントと同じ等価関係を持ちます。リファレントのどちらか一方が削除された場合、参" -"照オブジェクトが同一である場合に限り、その参照は等価です。" +"弱参照は等価性のテストをサポートしていますが、順序をサポートしていません。\n" +"リファレントがまだ生きているならば、 *callback* に関係なく二つの参照はそれら" +"のリファレントと同じ等価関係を持ちます。\n" +"リファレントのどちらか一方が削除された場合、参照オブジェクトが同一である場合" +"に限り、その参照は等価です。" -#: ../../library/weakref.rst:126 msgid "This is a subclassable type rather than a factory function." -msgstr "これはサブクラス化可能な型というよりファクトリ関数です。" +msgstr "これはファクトリ関数ではなく、サブクラス化可能な型です。" #: ../../library/weakref.rst:130 msgid "" @@ -302,17 +310,19 @@ msgstr "" "不能型であっても、プロキシはリファレントが消えるという状態の変更があるため" "に、変更可能型です。---)" -#: ../../library/weakref.rst:149 msgid "" "Accessing an attribute of the proxy object after the referent is garbage " "collected raises :exc:`ReferenceError`." msgstr "" +"リファレントがガベージコレクションで回収された後にプロキシオブジェクトの属性" +"にアクセスすると、:exc:`ReferenceError` が発生します。" -#: ../../library/weakref.rst:152 msgid "" "Extended the operator support on proxy objects to include the matrix " "multiplication operators ``@`` and ``@=``." msgstr "" +"プロキシオブジェクトで使える演算子に、行列乗算演算子 ``@`` と ``@=`` を追加し" +"ました。" #: ../../library/weakref.rst:159 msgid "" @@ -340,15 +350,16 @@ msgstr "" "ことができます。これは属性へのアクセスをオーバーライドするオブジェクトに特に" "便利です。" -#: ../../library/weakref.rst:175 msgid "" "Note that when a key with equal value to an existing key (but not equal " "identity) is inserted into the dictionary, it replaces the value but does " "not replace the existing key. Due to this, when the reference to the " "original key is deleted, it also deletes the entry in the dictionary::" msgstr "" +"既存のキーと等しい値を持つ別のオブジェクトをキーとして辞書に挿入すると、値は" +"置き換わりますが、既存のキーは置き換わりません。\n" +"そのため、元のキーへの参照を削除すると、辞書のエントリーも削除されます。 ::" -#: ../../library/weakref.rst:180 msgid "" ">>> class T(str): pass\n" "...\n" @@ -358,12 +369,17 @@ msgid "" ">>> d[k2] = 2 # d = {k1: 2}\n" ">>> del k1 # d = {}" msgstr "" +">>> class T(str): pass\n" +"...\n" +">>> k1, k2 = T(), T()\n" +">>> d = weakref.WeakKeyDictionary()\n" +">>> d[k1] = 1 # d = {k1: 1}\n" +">>> d[k2] = 2 # d = {k1: 2}\n" +">>> del k1 # d = {}" -#: ../../library/weakref.rst:188 msgid "A workaround would be to remove the key prior to reassignment::" -msgstr "" +msgstr "再代入する前にキーを削除すれば回避できます。 ::" -#: ../../library/weakref.rst:190 msgid "" ">>> class T(str): pass\n" "...\n" @@ -374,6 +390,14 @@ msgid "" ">>> d[k2] = 2 # d = {k2: 2}\n" ">>> del k1 # d = {k2: 2}" msgstr "" +">>> class T(str): pass\n" +"...\n" +">>> k1, k2 = T(), T()\n" +">>> d = weakref.WeakKeyDictionary()\n" +">>> d[k1] = 1 # d = {k1: 1}\n" +">>> del d[k1]\n" +">>> d[k2] = 2 # d = {k2: 2}\n" +">>> del k1 # d = {k2: 2}" #: ../../library/weakref.rst:199 ../../library/weakref.rst:220 msgid "" @@ -382,7 +406,6 @@ msgstr "" ":pep:`584` で規定されている ``|`` 演算子と ``|=`` 演算子のサポートを追加しま" "した。" -#: ../../library/weakref.rst:202 msgid "" ":class:`WeakKeyDictionary` objects have an additional method that exposes " "the internal references directly. The references are not guaranteed to be " @@ -391,11 +414,11 @@ msgid "" "references that will cause the garbage collector to keep the keys around " "longer than needed." msgstr "" -":class:`WeakKeyDictionary` オブジェクトは、追加のメソッドを持ちます。このメ" -"ソッドは、内部の参照を直接公開します。その参照は、利用される時に生存している" -"とは限りません。なので、参照を利用する前に、その参照をチェックする必要があり" -"ます。これにより、必要なくなったキーの参照が残っているために、ガベージコレク" -"タがそのキーを削除できなくなる事態を避ける事ができます。" +":class:`WeakKeyDictionary` オブジェクトには、内部の弱参照を直接公開する追加の" +"メソッドがあります。\n" +"その参照先が利用時にも生きている保証はないため、弱参照を呼び出した結果を確認" +"してから使用する必要があります。\n" +"このメソッドを使うと、キーを必要以上に長く生存させる参照を作らずに済みます。" #: ../../library/weakref.rst:212 msgid "Return an iterable of the weak references to the keys." @@ -409,11 +432,12 @@ msgstr "" "値を弱参照するマッピングクラス。値への強参照が存在しなくなったときに、辞書の" "エントリは捨てられます。" -#: ../../library/weakref.rst:223 msgid "" ":class:`WeakValueDictionary` objects have an additional method that has the " "same issues as the :meth:`WeakKeyDictionary.keyrefs` method." msgstr "" +":class:`WeakValueDictionary` オブジェクトには、:meth:`WeakKeyDictionary." +"keyrefs` メソッドと同じ注意点を持つ追加のメソッドがあります。" #: ../../library/weakref.rst:229 msgid "Return an iterable of the weak references to the values." @@ -427,7 +451,6 @@ msgstr "" "要素への弱参照を持つ集合型。要素への強参照が無くなったときに、その要素は削除" "されます。" -#: ../../library/weakref.rst:240 msgid "" "A custom :class:`ref` subclass which simulates a weak reference to a bound " "method (i.e., a method defined on a class and looked up on an instance). " @@ -435,13 +458,12 @@ msgid "" "hold of it. :class:`WeakMethod` has special code to recreate the bound " "method until either the object or the original function dies::" msgstr "" -"拡張された :class:`ref` のサブクラスで、束縛されたメソッドへの弱参照をシミュ" -"レートします (つまり、クラスで定義され、インスタンスにあるメソッド)。\n" -"束縛されたメソッドは短命なので、標準の弱参照では保持し続けられません。\n" -":class:`WeakMethod` には、オブジェクトと元々の関数が死ぬまで束縛されたメソッ" -"ドを再作成する特別なコードがあります::" +"束縛されたメソッド (クラスで定義され、インスタンスから取得されるメソッド) へ" +"の弱参照をシミュレートする、:class:`ref` のカスタムサブクラスです。\n" +"束縛されたメソッドは短命なので、通常の弱参照では保持し続けられません。\n" +":class:`WeakMethod` には、オブジェクトまたは元の関数のどちらか一方が破棄され" +"るまで、束縛されたメソッドを再作成するための特別なコードがあります。 ::" -#: ../../library/weakref.rst:246 msgid "" ">>> class C:\n" "... def method(self):\n" @@ -461,12 +483,28 @@ msgid "" ">>> r()\n" ">>>" msgstr "" +">>> class C:\n" +"... def method(self):\n" +"... print(\"method called!\")\n" +"...\n" +">>> c = C()\n" +">>> r = weakref.ref(c.method)\n" +">>> r()\n" +">>> r = weakref.WeakMethod(c.method)\n" +">>> r()\n" +">\n" +">>> r()()\n" +"method called!\n" +">>> del c\n" +">>> gc.collect()\n" +"0\n" +">>> r()\n" +">>>" -#: ../../library/weakref.rst:264 msgid "" "*callback* is the same as the parameter of the same name to the :func:`ref` " "function." -msgstr "" +msgstr "*callback* は :func:`ref` 関数の同名のパラメータと同じです。" #: ../../library/weakref.rst:270 msgid "" @@ -493,13 +531,16 @@ msgstr "" "果を返します。一方、死んでいるファイナライザを呼び出すと :const:`None` を返し" "ます。" -#: ../../library/weakref.rst:280 msgid "" "Exceptions raised by finalizer callbacks during garbage collection will be " "shown on the standard error output, but cannot be propagated. They are " "handled in the same way as exceptions raised from an object's :meth:`~object." "__del__` method or a weak reference's callback." msgstr "" +"ガベージコレクション中にファイナライザのコールバックで発生した例外は標準エ" +"ラー出力に表示されますが、呼び出し元には伝播しません。\n" +"オブジェクトの :meth:`~object.__del__` メソッドや弱参照のコールバックで発生し" +"た例外と同じように扱われます。" #: ../../library/weakref.rst:286 msgid "" @@ -511,30 +552,39 @@ msgstr "" "`atexit` 属性が偽に設定されるまで呼び出され続けます。\n" "ファイナライザは生成された順序の逆順で呼び出されます。" -#: ../../library/weakref.rst:290 msgid "" "A finalizer will never invoke its callback during the later part of the :" "term:`interpreter shutdown` when module globals are liable to have been " "replaced by :const:`None`." msgstr "" +":term:`インタープリタのシャットダウン ` の後半では、モ" +"ジュールのグローバル変数が :const:`None` に置き換えられている可能性がありま" +"す。\n" +"ファイナライザは、この段階では決してコールバックを呼び出しません。" -#: ../../library/weakref.rst:296 msgid "" "If *self* is alive then mark it as dead and return the result of calling " "``func(*args, **kwargs)``. If *self* is dead then return :const:`None`." msgstr "" +"*self* が生きている場合は、死んだ状態にして ``func(*args, **kwargs)`` の呼び" +"出し結果を返します。\n" +"*self* が死んでいる場合は :const:`None` を返します。" -#: ../../library/weakref.rst:302 msgid "" "If *self* is alive then mark it as dead and return the tuple ``(obj, func, " "args, kwargs)``. If *self* is dead then return :const:`None`." msgstr "" +"*self* が生きている場合は、死んだ状態にしてタプル ``(obj, func, args, " +"kwargs)`` を返します。\n" +"*self* が死んでいる場合は :const:`None` を返します。" -#: ../../library/weakref.rst:308 msgid "" "If *self* is alive then return the tuple ``(obj, func, args, kwargs)``. If " "*self* is dead then return :const:`None`." msgstr "" +"*self* が生きている場合は、タプル ``(obj, func, args, kwargs)`` を返しま" +"す。\n" +"*self* が死んでいる場合は :const:`None` を返します。" #: ../../library/weakref.rst:313 msgid "Property which is true if the finalizer is alive, false otherwise." @@ -548,13 +598,16 @@ msgid "" "true. They are called in reverse order of creation." msgstr "" -#: ../../library/weakref.rst:324 msgid "" "It is important to ensure that *func*, *args* and *kwargs* do not own any " "references to *obj*, either directly or indirectly, since otherwise *obj* " "will never be garbage collected. In particular, *func* should not be a " "bound method of *obj*." msgstr "" +"*func*、*args*、*kwargs* が、直接にも間接にも *obj* への参照を持たないことが" +"重要です。\n" +"参照を持っていると、*obj* はガベージコレクションで回収されなくなります。\n" +"特に、*func* を *obj* の束縛されたメソッドにしてはいけません。" #: ../../library/weakref.rst:334 msgid "The type object for weak references objects." @@ -594,12 +647,14 @@ msgstr "" msgid "Weak Reference Objects" msgstr "弱参照オブジェクト" -#: ../../library/weakref.rst:366 msgid "" "Weak reference objects have no methods and no attributes besides :attr:`ref." "__callback__`. A weak reference object allows the referent to be obtained, " "if it still exists, by calling it:" msgstr "" +"弱参照オブジェクトにはメソッドはなく、:attr:`ref.__callback__` 以外の属性もあ" +"りません。\n" +"弱参照オブジェクトを呼び出すと、リファレントがまだ存在していれば取得できます:" #: ../../library/weakref.rst:380 msgid "" @@ -619,7 +674,6 @@ msgstr "" "None`` を用いて行われます。通常、参照オブジェクトを使う必要があるアプリケー" "ションコードはこのパターンに従います::" -#: ../../library/weakref.rst:391 msgid "" "# r is a weak reference object\n" "o = r()\n" @@ -630,6 +684,14 @@ msgid "" " print(\"Object is still live!\")\n" " o.do_something_useful()" msgstr "" +"# r は弱参照オブジェクト\n" +"o = r()\n" +"if o is None:\n" +" # リファレントはガベージコレクションで回収された\n" +" print(\"Object has been deallocated; can't frobnicate.\")\n" +"else:\n" +" print(\"Object is still live!\")\n" +" o.do_something_useful()" #: ../../library/weakref.rst:400 msgid "" @@ -660,17 +722,15 @@ msgstr "" "に追加情報を関連付けたい場合に便利ですし、リファレントを取り出すための呼び出" "し時に何らかの追加処理を行いたい場合にも使えます。" -#: ../../library/weakref.rst:411 msgid "" "This example shows how a subclass of :class:`ref` can be used to store " "additional information about an object and affect the value that's returned " "when the referent is accessed::" msgstr "" -"以下の例では、 :class:`ref` のサブクラスを使って、あるオブジェクトに追加情報" -"を保存し、リファレントがアクセスされたときにその値に作用をできるようにするた" -"めの方法を示しています::" +"以下の例は、:class:`ref` のサブクラスを使ってオブジェクトに関する追加情報を保" +"存し、\n" +"リファレントへのアクセス時に返す値を変更する方法を示しています。 ::" -#: ../../library/weakref.rst:415 msgid "" "import weakref\n" "\n" @@ -691,24 +751,40 @@ msgid "" " ob = (ob, self.__counter)\n" " return ob" msgstr "" +"import weakref\n" +"\n" +"class ExtendedRef(weakref.ref):\n" +" def __init__(self, ob, callback=None, /, **annotations):\n" +" super().__init__(ob, callback)\n" +" self.__counter = 0\n" +" for k, v in annotations.items():\n" +" setattr(self, k, v)\n" +"\n" +" def __call__(self):\n" +" \"\"\"リファレントと、この参照が呼び出された回数のペアを返す。\n" +" \"\"\"\n" +" ob = super().__call__()\n" +" if ob is not None:\n" +" self.__counter += 1\n" +" ob = (ob, self.__counter)\n" +" return ob" #: ../../library/weakref.rst:438 msgid "Example" msgstr "使用例" -#: ../../library/weakref.rst:440 msgid "" "This simple example shows how an application can use object IDs to retrieve " "objects that it has seen before. The IDs of the objects can then be used in " "other data structures without forcing the objects to remain alive, but the " "objects can still be retrieved by ID if they do." msgstr "" -"この簡単な例では、アプリケーションが以前に参照したオブジェクトを取り出すため" -"にオブジェクトIDを利用する方法を示します。オブジェクトに生きたままであること" -"を強制することなく、オブジェクトの IDを他のデータ構造の中で使うことができ、必" -"要に応じてIDからオブジェクトを取り出せます。" +"この簡単な例では、アプリケーションが以前に参照したオブジェクトを、オブジェク" +"ト ID を使って取り出す方法を示します。\n" +"オブジェクトを生存させ続けることなく、その ID を他のデータ構造で使用できま" +"す。\n" +"オブジェクトがまだ生きていれば、ID から取り出すこともできます。" -#: ../../library/weakref.rst:449 msgid "" "import weakref\n" "\n" @@ -722,17 +798,30 @@ msgid "" "def id2obj(oid):\n" " return _id2obj_dict[oid]" msgstr "" +"import weakref\n" +"\n" +"_id2obj_dict = weakref.WeakValueDictionary()\n" +"\n" +"def remember(obj):\n" +" oid = id(obj)\n" +" _id2obj_dict[oid] = obj\n" +" return oid\n" +"\n" +"def id2obj(oid):\n" +" return _id2obj_dict[oid]" #: ../../library/weakref.rst:465 msgid "Finalizer Objects" msgstr "ファイナライザオブジェクト" -#: ../../library/weakref.rst:467 msgid "" "The main benefit of using :class:`finalize` is that it makes it simple to " "register a callback without needing to preserve the returned finalizer " "object. For instance" msgstr "" +":class:`finalize` を使う主な利点は、返されたファイナライザオブジェクトを保持" +"せずに、簡単にコールバックを登録できることです。\n" +"例えば次のようになります。" #: ../../library/weakref.rst:481 msgid "" @@ -742,21 +831,24 @@ msgstr "" "ファイナライザは直接呼び出すこともできます。ただし、ファイナライザはコール" "バックを最大でも一度しか呼び出しません。" -#: ../../library/weakref.rst:497 msgid "" "You can unregister a finalizer using its :meth:`~finalize.detach` method. " "This kills the finalizer and returns the arguments passed to the constructor " "when it was created." msgstr "" +":meth:`~finalize.detach` メソッドでファイナライザの登録を解除できます。\n" +"ファイナライザは死んだ状態になり、作成時にコンストラクタへ渡した引数が返され" +"ます。" -#: ../../library/weakref.rst:511 msgid "" "Unless you set the :attr:`~finalize.atexit` attribute to :const:`False`, a " "finalizer will be called when the program exits if it is still alive. For " "instance" msgstr "" +":attr:`~finalize.atexit` 属性を :const:`False` に設定しない限り、ファイナライ" +"ザがまだ生きていればプログラム終了時に呼び出されます。\n" +"例えば次のようになります。" -#: ../../library/weakref.rst:515 msgid "" ">>> obj = Object()\n" ">>> weakref.finalize(obj, print, \"obj dead or exiting\")\n" @@ -764,10 +856,14 @@ msgid "" ">>> exit()\n" "obj dead or exiting" msgstr "" +">>> obj = Object()\n" +">>> weakref.finalize(obj, print, \"obj dead or exiting\")\n" +"\n" +">>> exit()\n" +"obj dead or exiting" -#: ../../library/weakref.rst:526 msgid "Comparing finalizers with :meth:`~object.__del__` methods" -msgstr "" +msgstr "ファイナライザと :meth:`~object.__del__` メソッドの比較" #: ../../library/weakref.rst:528 msgid "" @@ -783,21 +879,20 @@ msgstr "" msgid "the object is garbage collected," msgstr "オブジェクトのガベージコレクションが行われた場合" -#: ../../library/weakref.rst:533 msgid "the object's :meth:`!remove` method is called, or" -msgstr "" +msgstr "オブジェクトの :meth:`!remove` メソッドが呼び出される、または" #: ../../library/weakref.rst:534 msgid "the program exits." msgstr "プログラムが終了した場合" -#: ../../library/weakref.rst:536 msgid "" "We might try to implement the class using a :meth:`~object.__del__` method " "as follows::" msgstr "" +":meth:`~object.__del__` メソッドを使って、以下のようにクラスを実装しようとす" +"るかもしれません。 ::" -#: ../../library/weakref.rst:539 msgid "" "class TempDir:\n" " def __init__(self):\n" @@ -815,6 +910,21 @@ msgid "" " def __del__(self):\n" " self.remove()" msgstr "" +"class TempDir:\n" +" def __init__(self):\n" +" self.name = tempfile.mkdtemp()\n" +"\n" +" def remove(self):\n" +" if self.name is not None:\n" +" shutil.rmtree(self.name)\n" +" self.name = None\n" +"\n" +" @property\n" +" def removed(self):\n" +" return self.name is None\n" +"\n" +" def __del__(self):\n" +" self.remove()" #: ../../library/weakref.rst:555 msgid "" @@ -824,21 +934,22 @@ msgid "" "code should work without any issues on CPython." msgstr "" -#: ../../library/weakref.rst:560 msgid "" "However, handling of :meth:`~object.__del__` methods is notoriously " "implementation specific, since it depends on internal details of the " "interpreter's garbage collector implementation." msgstr "" +"ただし、:meth:`~object.__del__` メソッドの扱いは、インタープリタのガベージコ" +"レクタの内部実装に依存するため、実装ごとの差が大きいことが知られています。" -#: ../../library/weakref.rst:564 msgid "" "A more robust alternative can be to define a finalizer which only references " "the specific functions and objects that it needs, rather than having access " "to the full state of the object::" msgstr "" +"より堅牢な方法として、オブジェクトの状態全体にアクセスする代わりに、\n" +"必要な特定の関数やオブジェクトだけを参照するファイナライザを定義できます。 ::" -#: ../../library/weakref.rst:568 msgid "" "class TempDir:\n" " def __init__(self):\n" @@ -852,20 +963,36 @@ msgid "" " def removed(self):\n" " return not self._finalizer.alive" msgstr "" +"class TempDir:\n" +" def __init__(self):\n" +" self.name = tempfile.mkdtemp()\n" +" self._finalizer = weakref.finalize(self, shutil.rmtree, self.name)\n" +"\n" +" def remove(self):\n" +" self._finalizer()\n" +"\n" +" @property\n" +" def removed(self):\n" +" return not self._finalizer.alive" -#: ../../library/weakref.rst:580 msgid "" "Defined like this, our finalizer only receives a reference to the details it " "needs to clean up the directory appropriately. If the object never gets " "garbage collected the finalizer will still be called at exit." msgstr "" +"このように定義すると、ファイナライザが受け取る参照は、ディレクトリを適切に削" +"除するために必要なものだけになります。\n" +"オブジェクトがガベージコレクションで回収されない場合でも、終了時にファイナラ" +"イザが呼び出されます。" -#: ../../library/weakref.rst:584 msgid "" "The other advantage of weakref based finalizers is that they can be used to " "register finalizers for classes where the definition is controlled by a " "third party, such as running code when a module is unloaded::" msgstr "" +"弱参照を使ったファイナライザのもう 1 つの利点は、第三者が定義を管理するクラス" +"にもファイナライザを登録できることです。\n" +"例えば、モジュールがアンロードされたときにコードを実行できます。 ::" #: ../../library/weakref.rst:588 msgid "" @@ -875,10 +1002,13 @@ msgid "" "weakref.finalize(sys.modules[__name__], unloading_module)" msgstr "" -#: ../../library/weakref.rst:596 msgid "" "If you create a finalizer object in a daemonic thread just as the program " "exits then there is the possibility that the finalizer does not get called " "at exit. However, in a daemonic thread :func:`atexit.register`, ``try: ... " "finally: ...`` and ``with: ...`` do not guarantee that cleanup occurs either." msgstr "" +"プログラムが終了する直前にデーモンスレッド内でファイナライザオブジェクトを作" +"成すると、終了時に呼び出されない可能性があります。\n" +"ただし、デーモンスレッド内では :func:`atexit.register`、``try: ... " +"finally: ...``、``with: ...`` もクリーンアップの実行を保証しません。" diff --git a/library/webbrowser.po b/library/webbrowser.po index 77cb5a65d..958cd5d0f 100644 --- a/library/webbrowser.po +++ b/library/webbrowser.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: tomo, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/webbrowser.rst:2 @@ -42,19 +42,18 @@ msgstr "" "とてもハイレベルなインターフェースが定義されています。たいていの環境では、こ" "のモジュールの :func:`.open` を呼び出すだけで正しく動作します。" -#: ../../library/webbrowser.rst:18 msgid "" "Under Unix, graphical browsers are preferred under X11, but text-mode " "browsers will be used if graphical browsers are not available or an X11 " "display isn't available. If text-mode browsers are used, the calling " "process will block until the user exits the browser." msgstr "" -"Unixでは、X11上でグラフィカルなブラウザが選択されますが、グラフィカルなブラウ" -"ザが利用できなかったり、X11が利用できない場合はテキストモードのブラウザが使わ" -"れます。もしテキストモードのブラウザが使われたら、ユーザがブラウザから抜け出" -"すまでプロセスの呼び出しはブロックされます。" +"Unix では、X11 上でグラフィカルなブラウザが優先されます。\n" +"グラフィカルなブラウザや X11 のディスプレイが利用できない場合は、テキストモー" +"ドのブラウザを使います。\n" +"テキストモードのブラウザを使う場合、ユーザーがブラウザを終了するまで、呼び出" +"し元のプロセスはブロックされます。" -#: ../../library/webbrowser.rst:23 msgid "" "If the environment variable :envvar:`BROWSER` exists, it is interpreted as " "the :data:`os.pathsep`-separated list of browsers to try ahead of the " @@ -65,13 +64,24 @@ msgid "" "to the front of the search list; if the part does not contain ``%s``, it is " "simply interpreted as the name of the browser to launch. [1]_" msgstr "" +"環境変数 :envvar:`BROWSER` がある場合、その値は :data:`os.pathsep` で区切られ" +"たブラウザのリストとして解釈され、プラットフォームのデフォルトより先に試され" +"ます。\n" +"リストの項目に文字列 ``%s`` が含まれる場合は、その項目をブラウザのコマンドラ" +"インとして扱い、``%s`` を引数の URL に置き換えて使います。\n" +"項目が登録済みブラウザのいずれかを指す単一の語であれば、そのブラウザを検索リ" +"ストの先頭に追加します。\n" +"``%s`` を含まない項目は、単に起動するブラウザの名前と解釈されます。 [1]_" -#: ../../library/webbrowser.rst:34 msgid "" "The :envvar:`BROWSER` variable can now also be used to reorder the list of " "platform defaults. This is particularly useful on macOS where the platform " "defaults do not refer to command-line tools on :envvar:`PATH`." msgstr "" +":envvar:`BROWSER` 変数で、プラットフォームのデフォルトのリストを並べ替えるこ" +"ともできるようになりました。\n" +"これは特に、プラットフォームのデフォルトが :envvar:`PATH` 上のコマンドライン" +"ツールを指していない macOS で役立ちます。" #: ../../library/webbrowser.rst:39 msgid "" @@ -112,25 +122,22 @@ msgstr "" "フェースとして利用可能です。これは引数として URL を受け入れます。また、次のオ" "プションのパラメーターを受け入れます。" -#: ../../library/webbrowser.rst:60 msgid "Opens the URL in a new browser window, if possible." -msgstr "" +msgstr "可能であれば、新しいブラウザウィンドウで URL を開きます。" -#: ../../library/webbrowser.rst:64 msgid "Opens the URL in a new browser tab." -msgstr "" +msgstr "新しいブラウザタブで URL を開きます。" -#: ../../library/webbrowser.rst:66 msgid "The options are, naturally, mutually exclusive. Usage example:" msgstr "" +"これらのオプションは互いに排他的です。\n" +"使用例を示します:" -#: ../../library/webbrowser.rst:68 msgid "python -m webbrowser -t \"https://www.python.org\"" -msgstr "" +msgstr "python -m webbrowser -t \"https://www.python.org\"" -#: ../../library/webbrowser.rst:72 msgid "Availability" -msgstr "" +msgstr "利用可能な環境" #: ../../library/webbrowser.rst:74 msgid "The following exception is defined:" @@ -144,7 +151,6 @@ msgstr "ブラウザのコントロールエラーが起こると発生する例 msgid "The following functions are defined:" msgstr "以下の関数が定義されています:" -#: ../../library/webbrowser.rst:86 msgid "" "Display *url* using the default browser. If *new* is 0, the *url* is opened " "in the same browser window if possible. If *new* is 1, a new browser window " @@ -153,28 +159,26 @@ msgid "" "possible (note that under many window managers this will occur regardless of " "the setting of this variable)." msgstr "" -"デフォルトのブラウザで *url* を表示します。*new* が 0 なら、*url* はブラウザ" -"の今までと同じウィンドウで開きます。*new* が 1 なら、可能であればブラウザの新" -"しいウィンドウが開きます。*new* が 2 なら、可能であればブラウザの新しいタブが" -"開きます。*autoraise* が ``True`` なら、可能であればウィンドウが前面に表示さ" -"れます(多くのウィンドウマネージャではこの変数の設定に関わらず、前面に表示さ" -"れます)。" - -#: ../../library/webbrowser.rst:93 ../../library/webbrowser.rst:107 -#: ../../library/webbrowser.rst:115 +"デフォルトのブラウザで *url* を表示します。\n" +"*new* が 0 なら、可能であれば同じブラウザウィンドウで *url* を開きます。\n" +"*new* が 1 なら、可能であれば新しいブラウザウィンドウを開きます。\n" +"*new* が 2 なら、可能であれば新しいブラウザページ (「タブ」) を開きます。\n" +"*autoraise* が ``True`` なら、可能であればウィンドウを前面に表示します (多く" +"のウィンドウマネージャーでは、この値にかかわらず前面に表示されます)。" + msgid "" "Returns ``True`` if a browser was successfully launched, ``False`` otherwise." msgstr "" +"ブラウザの起動に成功した場合は ``True`` を、それ以外は ``False`` を返します。" -#: ../../library/webbrowser.rst:95 msgid "" "Note that on some platforms, trying to open a filename using this function, " "may work and start the operating system's associated program. However, this " "is neither supported nor portable." msgstr "" -"幾つかのプラットフォームにおいて、ファイル名をこの関数で開こうとすると、OSに" -"よって関連付けられたプログラムが起動されます。しかし、この動作はポータブルで" -"はありませんし、サポートされていません。" +"プラットフォームによっては、この関数でファイル名を開こうとすると、オペレー" +"ティングシステムが関連付けたプログラムを起動できる場合があります。\n" +"ただし、この動作はサポートされておらず、移植性もありません。" #: ../../library/webbrowser.rst:99 msgid "" @@ -485,7 +489,6 @@ msgstr "iOS のサポートが追加されました。" msgid "Here are some simple examples::" msgstr "簡単な例を示します::" -#: ../../library/webbrowser.rst:224 msgid "" "url = 'https://docs.python.org/'\n" "\n" @@ -495,16 +498,24 @@ msgid "" "# Open URL in new window, raising the window if possible.\n" "webbrowser.open_new(url)" msgstr "" +"url = 'https://docs.python.org/'\n" +"\n" +"# ブラウザウィンドウがすでに開いていれば、新しいタブで URL を開く。\n" +"webbrowser.open_new_tab(url)\n" +"\n" +"# 新しいウィンドウで URL を開き、可能なら前面に表示する。\n" +"webbrowser.open_new(url)" #: ../../library/webbrowser.rst:236 msgid "Browser Controller Objects" msgstr "ブラウザコントローラーオブジェクト" -#: ../../library/webbrowser.rst:238 msgid "" "Browser controllers provide the :attr:`~controller.name` attribute, and the " "following three methods which parallel module-level convenience functions:" msgstr "" +"ブラウザコントローラーは :attr:`~controller.name` 属性と、モジュールレベルの" +"便利な関数に対応する以下の 3 つのメソッドを提供します:" #: ../../library/webbrowser.rst:244 msgid "System-dependent name for the browser." diff --git a/library/windows.po b/library/windows.po index ae1c27e45..e3706ea56 100644 --- a/library/windows.po +++ b/library/windows.po @@ -16,10 +16,10 @@ msgstr "" "Last-Translator: tomo, 2021\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/windows.rst:5 diff --git a/library/winreg.po b/library/winreg.po index ebe5dcd73..7b0660f68 100644 --- a/library/winreg.po +++ b/library/winreg.po @@ -19,10 +19,10 @@ msgstr "" "Last-Translator: Arihiro TAKASE, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/winreg.rst:2 @@ -103,13 +103,12 @@ msgstr "" "戻り値は開かれたキーのハンドルです。関数が失敗した場合、 :exc:`OSError` 例外" "が送出されます。" -#: ../../library/winreg.rst:56 msgid "" "Raises an :ref:`auditing event ` ``winreg.ConnectRegistry`` with " "arguments ``computer_name``, ``key``." msgstr "" "引数 ``computer_name``, ``key`` を指定して :ref:`監査イベント ` " -"``winreg.ConnectRegistry`` を送出します。 " +"``winreg.ConnectRegistry`` を送出します。" #: ../../library/winreg.rst:58 ../../library/winreg.rst:84 #: ../../library/winreg.rst:118 ../../library/winreg.rst:139 @@ -158,22 +157,19 @@ msgstr "" msgid "If the key already exists, this function opens the existing key." msgstr "キーがすでに存在する場合、この関数はその既存のキーを開きます。" -#: ../../library/winreg.rst:80 ../../library/winreg.rst:112 msgid "" "Raises an :ref:`auditing event ` ``winreg.CreateKey`` with " "arguments ``key``, ``sub_key``, ``access``." msgstr "" "引数 ``key``, ``sub_key``, ``access`` を指定して :ref:`監査イベント " -"` ``winreg.CreateKey`` を送出します。 " +"` ``winreg.CreateKey`` を送出します。" -#: ../../library/winreg.rst:82 ../../library/winreg.rst:114 -#: ../../library/winreg.rst:324 msgid "" "Raises an :ref:`auditing event ` ``winreg.OpenKey/result`` with " "argument ``key``." msgstr "" "引数 ``key`` を指定して :ref:`監査イベント ` ``winreg.OpenKey/" -"result`` を送出します。 " +"result`` を送出します。" #: ../../library/winreg.rst:98 ../../library/winreg.rst:154 msgid "" @@ -196,15 +192,14 @@ msgstr "" msgid "Deletes the specified key." msgstr "指定されたキーを削除します。" -#: ../../library/winreg.rst:129 msgid "" "*sub_key* is a string that must be a subkey of the key identified by the " "*key* parameter. This value must not be ``None``, and the key may not have " "subkeys." msgstr "" -"*sub_key* は文字列で、*key* 引数によって指定されたキーのサブキーでなければな" -"りません。この値は ``None`` であってはならず、キーはサブキーを持っていなくて" -"もかまいません。" +"*sub_key* は、*key* 引数で指定されたキーのサブキー名を表す文字列です。\n" +"この値は ``None`` であってはならず、削除対象のキーはサブキーを持っていてはな" +"りません。" #: ../../library/winreg.rst:132 ../../library/winreg.rst:161 msgid "*This method can not delete keys with subkeys.*" @@ -218,21 +213,21 @@ msgstr "" "このメソッドの実行が成功すると、キー全体が、その値すべてを含めて削除されま" "す。このメソッドが失敗した場合、 :exc:`OSError` 例外が送出されます。" -#: ../../library/winreg.rst:137 ../../library/winreg.rst:168 msgid "" "Raises an :ref:`auditing event ` ``winreg.DeleteKey`` with " "arguments ``key``, ``sub_key``, ``access``." msgstr "" +"引数 ``key``、``sub_key``、``access`` を伴う :ref:`監査イベント ` " +"``winreg.DeleteKey`` を送出します。" -#: ../../library/winreg.rst:150 msgid "" "*sub_key* is a string that must be a subkey of the key identified by the " "*key* parameter. This value must not be ``None``, and the key may not have " "subkeys." msgstr "" -"*sub_key* は *key* 引数によって指定された key の subkey でなければなりませ" -"ん。この値は ``None`` であってはなりません。また、key は subkey を持たないか" -"もしれません。" +"*sub_key* は、*key* 引数で指定されたキーのサブキー名を表す文字列です。\n" +"この値は ``None`` であってはならず、削除対象のキーはサブキーを持っていてはな" +"りません。" #: ../../library/winreg.rst:156 msgid "" @@ -260,13 +255,12 @@ msgstr "レジストリキーから指定された名前つきの値を削除し msgid "*value* is a string that identifies the value to remove." msgstr "*value* は削除したい値を指定するための文字列です。" -#: ../../library/winreg.rst:185 msgid "" "Raises an :ref:`auditing event ` ``winreg.DeleteValue`` with " "arguments ``key``, ``value``." msgstr "" "引数 ``key``, ``value`` を指定して :ref:`監査イベント ` ``winreg." -"DeleteValue`` を送出します。 " +"DeleteValue`` を送出します。" #: ../../library/winreg.rst:190 msgid "Enumerates subkeys of an open registry key, returning a string." @@ -286,13 +280,12 @@ msgstr "" "常、これ以上値がないことを示す :exc:`OSError` 例外が送出されるまで繰り返し呼" "び出されます。" -#: ../../library/winreg.rst:201 msgid "" "Raises an :ref:`auditing event ` ``winreg.EnumKey`` with arguments " "``key``, ``index``." msgstr "" "引数 ``key``, ``index`` を指定して :ref:`監査イベント ` ``winreg." -"EnumKey`` を送出します。 " +"EnumKey`` を送出します。" #: ../../library/winreg.rst:209 msgid "Enumerates values of an open registry key, returning a tuple." @@ -361,13 +354,12 @@ msgstr "" "値のデータ型を指定する整数です (:meth:`SetValueEx` のドキュメント内のテーブル" "を参照してください)" -#: ../../library/winreg.rst:236 msgid "" "Raises an :ref:`auditing event ` ``winreg.EnumValue`` with " "arguments ``key``, ``index``." msgstr "" "引数 ``key``, ``index`` を指定して :ref:`監査イベント ` ``winreg." -"EnumValue`` を送出します。 " +"EnumValue`` を送出します。" #: ../../library/winreg.rst:247 msgid "" @@ -377,19 +369,19 @@ msgstr "" ":const:`REG_EXPAND_SZ` のように、環境変数プレースホルダ ``%NAME%`` を文字列で" "展開します::" -#: ../../library/winreg.rst:250 msgid "" ">>> ExpandEnvironmentStrings('%windir%')\n" "'C:\\\\Windows'" msgstr "" +">>> ExpandEnvironmentStrings('%windir%')\n" +"'C:\\\\Windows'" -#: ../../library/winreg.rst:253 msgid "" "Raises an :ref:`auditing event ` ``winreg." "ExpandEnvironmentStrings`` with argument ``str``." msgstr "" "引数 ``str`` を指定して :ref:`監査イベント ` ``winreg." -"ExpandEnvironmentStrings`` を送出します。 " +"ExpandEnvironmentStrings`` を送出します。" #: ../../library/winreg.rst:258 msgid "Writes all the attributes of a key to the registry." @@ -451,30 +443,31 @@ msgstr "" "当てテーブル (FAT) ファイルシステム下では、ファイル名は拡張子を持っていてはな" "りません。" -#: ../../library/winreg.rst:290 msgid "" "A call to :func:`LoadKey` fails if the calling process does not have the :c:" "data:`!SE_RESTORE_PRIVILEGE` privilege. Note that privileges are different " "from permissions -- see the `RegLoadKey documentation `__ for more details." msgstr "" +"呼び出し元のプロセスに :c:data:`!SE_RESTORE_PRIVILEGE` 特権がない場合、:func:" +"`LoadKey` の呼び出しは失敗します。\n" +"特権とアクセス許可は異なります。\n" +"詳細は `RegLoadKey のドキュメント `__ を参照してください。" -#: ../../library/winreg.rst:296 msgid "" "If *key* is a handle returned by :func:`ConnectRegistry`, then the path " "specified in *file_name* is relative to the remote computer." msgstr "" -"*key* が :func:`ConnectRegistry` によって返されたハンドルの場合、 " -"*file_name* に指定されたパスはリモートコンピュータに対する相対パス名になりま" -"す。" +"*key* が :func:`ConnectRegistry` の返したハンドルの場合、*file_name* に指定し" +"たパスはリモートコンピュータ上のパスとして解釈されます。" -#: ../../library/winreg.rst:299 msgid "" "Raises an :ref:`auditing event ` ``winreg.LoadKey`` with arguments " "``key``, ``sub_key``, ``file_name``." msgstr "" "引数 ``key``, ``sub_key``, ``file_name`` を指定して :ref:`監査イベント " -"` ``winreg.LoadKey`` を送出します。 " +"` ``winreg.LoadKey`` を送出します。" #: ../../library/winreg.rst:305 msgid "" @@ -512,13 +505,12 @@ msgstr "指定されたキーへの新しいハンドルが返されます。" msgid "If the function fails, :exc:`OSError` is raised." msgstr "この関数が失敗すると、 :exc:`OSError` が送出されます。" -#: ../../library/winreg.rst:322 msgid "" "Raises an :ref:`auditing event ` ``winreg.OpenKey`` with arguments " "``key``, ``sub_key``, ``access``." msgstr "" "引数 ``key``, ``sub_key``, ``access`` を指定して :ref:`監査イベント " -"` ``winreg.OpenKey`` を送出します。 " +"` ``winreg.OpenKey`` を送出します。" #: ../../library/winreg.rst:326 msgid "Allow the use of named arguments." @@ -544,13 +536,12 @@ msgstr "" "最後のキーの変更が (あれば) いつだったかを表す整数で、1601 年 1 月 1 日から" "の 100 ナノ秒単位で数えたもの。" -#: ../../library/winreg.rst:356 msgid "" "Raises an :ref:`auditing event ` ``winreg.QueryInfoKey`` with " "argument ``key``." msgstr "" "引数 ``key`` を指定して :ref:`監査イベント ` ``winreg." -"QueryInfoKey`` を送出します。 " +"QueryInfoKey`` を送出します。" #: ../../library/winreg.rst:361 msgid "Retrieves the unnamed value for a key, as a string." @@ -579,13 +570,12 @@ msgstr "" "API 呼び出しは型情報を返しません。なので、可能ならいつでも :func:" "`QueryValueEx` を使うべきです。" -#: ../../library/winreg.rst:375 ../../library/winreg.rst:400 msgid "" "Raises an :ref:`auditing event ` ``winreg.QueryValue`` with " "arguments ``key``, ``sub_key``, ``value_name``." msgstr "" "引数 ``key``, ``sub_key``, ``value_name`` を指定して :ref:`監査イベント " -"` ``winreg.QueryValue`` を送出します。 " +"` ``winreg.QueryValue`` を送出します。" #: ../../library/winreg.rst:380 msgid "" @@ -619,18 +609,17 @@ msgstr "" msgid "Saves the specified key, and all its subkeys to the specified file." msgstr "指定されたキーと、そのサブキー全てを指定したファイルに保存します。" -#: ../../library/winreg.rst:410 msgid "" "*file_name* is the name of the file to save registry data to. This file " "cannot already exist. If this filename includes an extension, it cannot be " "used on file allocation table (FAT) file systems by the :meth:`LoadKey` " "method." msgstr "" -"*file_name* はレジストリデータを保存するファイルの名前です、このファイルはす" -"でに存在していてはいけません。このファイル名が拡張子を含んでいる場合、 :meth:" -"`LoadKey` メソッドは、FAT ファイルシステムを使うことができません。" +"*file_name* はレジストリデータの保存先ファイル名です。\n" +"このファイルは既に存在していてはなりません。\n" +"ファイル名に拡張子が含まれている場合、FAT ファイルシステム上では :meth:" +"`LoadKey` メソッドでそのファイルを使用できません。" -#: ../../library/winreg.rst:415 msgid "" "If *key* represents a key on a remote computer, the path described by " "*file_name* is relative to the remote computer. The caller of this method " @@ -639,18 +628,25 @@ msgid "" "Rights and Permissions documentation `__ for more details." msgstr "" +"*key* がリモートコンピュータ上のキーを表す場合、*file_name* のパスはリモート" +"コンピュータ上のパスとして解釈されます。\n" +"このメソッドの呼び出し元は **SeBackupPrivilege** セキュリティ特権を持つ必要が" +"あります。\n" +"特権とアクセス許可は異なります。\n" +"詳細は `ユーザー権利とアクセス許可の競合に関するドキュメント `__ を参照してくださ" +"い。" #: ../../library/winreg.rst:423 msgid "This function passes ``NULL`` for *security_attributes* to the API." msgstr "この関数は *security_attributes* を ``NULL`` にして API に渡します。" -#: ../../library/winreg.rst:425 msgid "" "Raises an :ref:`auditing event ` ``winreg.SaveKey`` with arguments " "``key``, ``file_name``." msgstr "" "引数 ``key``, ``file_name`` を指定して :ref:`監査イベント ` " -"``winreg.SaveKey`` を送出します。 " +"``winreg.SaveKey`` を送出します。" #: ../../library/winreg.rst:430 msgid "Associates a value with a specified key." @@ -701,13 +697,12 @@ msgstr "" "*key* 引数に指定されたキーは :const:`KEY_SET_VALUE` アクセスで開かれていなけ" "ればなりません。" -#: ../../library/winreg.rst:453 ../../library/winreg.rst:483 msgid "" "Raises an :ref:`auditing event ` ``winreg.SetValue`` with " "arguments ``key``, ``sub_key``, ``type``, ``value``." msgstr "" "引数 ``key``, ``sub_key``, ``type``, ``value`` を指定して :ref:`監査イベント " -"` ``winreg.SetValue`` を送出します。 " +"` ``winreg.SetValue`` を送出します。" #: ../../library/winreg.rst:458 msgid "Stores data in the value field of an open registry key." @@ -772,13 +767,12 @@ msgstr "" "ん。あるキーのリフレクションを無効にしても、そのキーのサブキーのリフレクショ" "ンには全く影響しません。" -#: ../../library/winreg.rst:501 msgid "" "Raises an :ref:`auditing event ` ``winreg.DisableReflectionKey`` " "with argument ``key``." msgstr "" "引数 ``key`` を指定して :ref:`監査イベント ` ``winreg." -"DisableReflectionKey`` を送出します。 " +"DisableReflectionKey`` を送出します。" #: ../../library/winreg.rst:506 msgid "Restores registry reflection for the specified disabled key." @@ -792,13 +786,12 @@ msgid "" msgstr "" "あるキーのリフレクションを再開しても、その全てのサブキーには影響しません。" -#: ../../library/winreg.rst:516 msgid "" "Raises an :ref:`auditing event ` ``winreg.EnableReflectionKey`` " "with argument ``key``." msgstr "" "引数 ``key`` を指定して :ref:`監査イベント ` ``winreg." -"EnableReflectionKey`` を送出します。 " +"EnableReflectionKey`` を送出します。" #: ../../library/winreg.rst:521 msgid "Determines the reflection state for the specified key." @@ -808,13 +801,12 @@ msgstr "指定されたキーのリフレクション状態を確認します。 msgid "Returns ``True`` if reflection is disabled." msgstr "リフレクションが無効になっている場合、``True`` を返します。" -#: ../../library/winreg.rst:531 msgid "" "Raises an :ref:`auditing event ` ``winreg.QueryReflectionKey`` " "with argument ``key``." msgstr "" "引数 ``key`` を指定して :ref:`監査イベント ` ``winreg." -"QueryReflectionKey`` を送出します。 " +"QueryReflectionKey`` を送出します。" #: ../../library/winreg.rst:537 msgid "Constants" @@ -887,9 +879,8 @@ msgstr "" "ローカルコンピュータシステムの現在のハードウェアプロファイルに関する情報を含" "みます。" -#: ../../library/winreg.rst:587 msgid "This key is not used in versions of Windows after 98." -msgstr "このキーは Windows の 98 以降のバージョンでは利用されていません。" +msgstr "このキーは Windows 98 より後のバージョンでは使われていません。" #: ../../library/winreg.rst:593 msgid "Access Rights" @@ -904,32 +895,29 @@ msgstr "" "microsoft.com/en-us/library/ms724878%28v=VS.85%29.aspx>`__ を参照してくださ" "い。" -#: ../../library/winreg.rst:600 msgid "" "Combines the STANDARD_RIGHTS_REQUIRED, :const:`KEY_QUERY_VALUE`, :const:" "`KEY_SET_VALUE`, :const:`KEY_CREATE_SUB_KEY`, :const:" "`KEY_ENUMERATE_SUB_KEYS`, :const:`KEY_NOTIFY`, and :const:`KEY_CREATE_LINK` " "access rights." msgstr "" -"STANDARD_RIGHTS_REQUIRED (:const:`KEY_QUERY_VALUE`, :const:`KEY_SET_VALUE`, :" +"STANDARD_RIGHTS_REQUIRED、:const:`KEY_QUERY_VALUE`, :const:`KEY_SET_VALUE`, :" "const:`KEY_CREATE_SUB_KEY`, :const:`KEY_ENUMERATE_SUB_KEYS`, :const:" -"`KEY_NOTIFY`, :const:`KEY_CREATE_LINK`) アクセス権限の組み合わせ。" +"`KEY_NOTIFY`, :const:`KEY_CREATE_LINK` のアクセス権限の組み合わせ。" -#: ../../library/winreg.rst:607 msgid "" "Combines the STANDARD_RIGHTS_WRITE, :const:`KEY_SET_VALUE`, and :const:" "`KEY_CREATE_SUB_KEY` access rights." msgstr "" -"STANDARD_RIGHTS_WRITE (:const:`KEY_SET_VALUE`, :const:`KEY_CREATE_SUB_KEY`) " +"STANDARD_RIGHTS_WRITE、:const:`KEY_SET_VALUE`, :const:`KEY_CREATE_SUB_KEY` の" "アクセス権限の組み合わせ。" -#: ../../library/winreg.rst:612 msgid "" "Combines the STANDARD_RIGHTS_READ, :const:`KEY_QUERY_VALUE`, :const:" "`KEY_ENUMERATE_SUB_KEYS`, and :const:`KEY_NOTIFY` values." msgstr "" -"STANDARD_RIGHTS_READ (:const:`KEY_QUERY_VALUE`, :const:" -"`KEY_ENUMERATE_SUB_KEYS`, :const:`KEY_NOTIFY`) アクセス権限の組み合わせ。" +"STANDARD_RIGHTS_READ、:const:`KEY_QUERY_VALUE`, :const:" +"`KEY_ENUMERATE_SUB_KEYS`, :const:`KEY_NOTIFY` のアクセス権限の組み合わせ。" #: ../../library/winreg.rst:617 msgid "Equivalent to :const:`KEY_READ`." @@ -1095,16 +1083,18 @@ msgstr "" "このモジュールのレジストリ関数でハンドルオブジェクトを受理するものは全て整数" "も受理しますが、ハンドルオブジェクトを利用することを推奨します。" -#: ../../library/winreg.rst:748 msgid "" "Handle objects provide semantics for :meth:`~object.__bool__` -- thus ::" msgstr "" +"ハンドルオブジェクトは :meth:`~object.__bool__` に対応しています。\n" +"例えば次のコードは、 ::" -#: ../../library/winreg.rst:750 msgid "" "if handle:\n" " print(\"Yes\")" msgstr "" +"if handle:\n" +" print(\"Yes\")" #: ../../library/winreg.rst:753 msgid "" @@ -1167,11 +1157,12 @@ msgstr "" "ありません。背後の Win32 ハンドルがハンドルオブジェクトよりも長く維持される必" "要がある場合にはこの関数を呼び出すとよいでしょう。" -#: ../../library/winreg.rst:784 msgid "" "Raises an :ref:`auditing event ` ``winreg.PyHKEY.Detach`` with " "argument ``key``." msgstr "" +"引数 ``key`` を伴う :ref:`監査イベント ` ``winreg.PyHKEY.Detach`` " +"を送出します。" #: ../../library/winreg.rst:790 msgid "" @@ -1183,11 +1174,12 @@ msgstr "" "ソッドを実装していて、 :keyword:`with` 文のためのコンテキストプロトコルをサ" "ポートしています::" -#: ../../library/winreg.rst:794 msgid "" "with OpenKey(HKEY_LOCAL_MACHINE, \"foo\") as key:\n" " ... # work with key" msgstr "" +"with OpenKey(HKEY_LOCAL_MACHINE, \"foo\") as key:\n" +" ... # key を使って処理する" #: ../../library/winreg.rst:797 msgid "" @@ -1200,6 +1192,5 @@ msgstr "" msgid "% (percent)" msgstr "% (パーセント)" -#: ../../library/winreg.rst:242 msgid "environment variables expansion (Windows)" -msgstr "" +msgstr "環境変数の展開 (Windows)" diff --git a/library/winsound.po b/library/winsound.po index 8519fb2b6..3de211603 100644 --- a/library/winsound.po +++ b/library/winsound.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/winsound.rst:2 @@ -169,7 +169,6 @@ msgstr "Question" msgid "For example::" msgstr "例えば::" -#: ../../library/winsound.rst:79 msgid "" "import winsound\n" "# Play Windows exit sound.\n" @@ -179,6 +178,13 @@ msgid "" "# \"*\" probably isn't the registered name of any sound).\n" "winsound.PlaySound(\"*\", winsound.SND_ALIAS)" msgstr "" +"import winsound\n" +"# Windows の終了音を再生する。\n" +"winsound.PlaySound(\"SystemExit\", winsound.SND_ALIAS)\n" +"\n" +"# 登録されていれば、おそらく Windows のデフォルトの音を再生する。\n" +"# \"*\" という名前の音声は登録されていない可能性が高いため。\n" +"winsound.PlaySound(\"*\", winsound.SND_ALIAS)" #: ../../library/winsound.rst:90 msgid "" @@ -235,24 +241,26 @@ msgstr "現在鳴っている音声を中断させないようにします。" msgid "Return immediately if the sound driver is busy." msgstr "サウンドドライバがビジー状態にある場合、関数がすぐ返るようにします。" -#: ../../library/winsound.rst:140 msgid "" "The *sound* parameter is an application-specific alias in the registry. This " "flag can be combined with the :const:`SND_ALIAS` flag to specify an " "application-defined sound alias." msgstr "" +"*sound* 引数が、レジストリに登録されたアプリケーション固有のエイリアスである" +"ことを示します。\n" +"このフラグを :const:`SND_ALIAS` フラグと組み合わせると、アプリケーションが定" +"義した音声エイリアスを指定できます。" -#: ../../library/winsound.rst:147 msgid "Triggers a SoundSentry event when the sound is played." -msgstr "" +msgstr "音声の再生時に SoundSentry イベントを発生させます。" -#: ../../library/winsound.rst:154 msgid "The sound is played synchronously. This is the default behavior." msgstr "" +"音声を同期的に再生します。\n" +"これがデフォルトの動作です。" -#: ../../library/winsound.rst:161 msgid "Assign the sound to the audio session for system notification sounds." -msgstr "" +msgstr "音声をシステム通知音用のオーディオセッションに割り当てます。" #: ../../library/winsound.rst:168 ../../library/winsound.rst:188 #: ../../library/winsound.rst:200 diff --git a/library/wsgiref.po b/library/wsgiref.po index 059fde2dc..f66f85b27 100644 --- a/library/wsgiref.po +++ b/library/wsgiref.po @@ -20,10 +20,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/wsgiref.rst:2 @@ -234,13 +234,13 @@ msgstr "" "WSGI サーバやアプリケーションで使うべきではありません。なぜならこのデータは偽" "物なのです!" -#: ../../library/wsgiref.rst:122 msgid "" "Example usage (see also :func:`~wsgiref.simple_server.demo_app` for another " "example)::" msgstr "" +"使用例を示します (別の例は :func:`~wsgiref.simple_server.demo_app` を参" +"照)。 ::" -#: ../../library/wsgiref.rst:125 msgid "" "from wsgiref.util import setup_testing_defaults\n" "from wsgiref.simple_server import make_server\n" @@ -263,6 +263,26 @@ msgid "" " print(\"Serving on port 8000...\")\n" " httpd.serve_forever()" msgstr "" +"from wsgiref.util import setup_testing_defaults\n" +"from wsgiref.simple_server import make_server\n" +"\n" +"# 比較的単純な WSGI アプリケーション。\n" +"# setup_testing_defaults で更新した環境辞書を出力する。\n" +"def simple_app(environ, start_response):\n" +" setup_testing_defaults(environ)\n" +"\n" +" status = '200 OK'\n" +" headers = [('Content-type', 'text/plain; charset=utf-8')]\n" +"\n" +" start_response(status, headers)\n" +"\n" +" ret = [(\"%s: %s\\n\" % (key, value)).encode(\"utf-8\")\n" +" for key, value in environ.items()]\n" +" return ret\n" +"\n" +"with make_server('', 8000, simple_app) as httpd:\n" +" print(\"Serving on port 8000...\")\n" +" httpd.serve_forever()" #: ../../library/wsgiref.rst:147 msgid "" @@ -305,7 +325,6 @@ msgstr "" msgid "Example usage::" msgstr "使用例::" -#: ../../library/wsgiref.rst:173 msgid "" "from io import StringIO\n" "from wsgiref.util import FileWrapper\n" @@ -317,6 +336,15 @@ msgid "" "for chunk in wrapper:\n" " print(chunk)" msgstr "" +"from io import StringIO\n" +"from wsgiref.util import FileWrapper\n" +"\n" +"# ファイル類似オブジェクトとして StringIO バッファを使う。\n" +"filelike = StringIO(\"This is an example file-like object\"*10)\n" +"wrapper = FileWrapper(filelike, blksize=5)\n" +"\n" +"for chunk in wrapper:\n" +" print(chunk)" #: ../../library/wsgiref.rst:183 msgid "Support for :meth:`~object.__getitem__` method has been removed." @@ -344,7 +372,6 @@ msgstr "" "定義されるようなヘッダの名前/値のタプルのリストです。 *headers* のデフォルト" "値は空のリストです。" -#: ../../library/wsgiref.rst:204 msgid "" ":class:`Headers` objects support typical mapping operations including :meth:" "`~object.__getitem__`, :meth:`~dict.get`, :meth:`~object.__setitem__`, :meth:" @@ -356,6 +383,15 @@ msgid "" "Headers' existing order is generally maintained, with new headers added to " "the end of the wrapped list." msgstr "" +":class:`Headers` オブジェクトは、:meth:`~object.__getitem__`、:meth:`~dict." +"get`、:meth:`~object.__setitem__`、:meth:`~dict.setdefault`、:meth:`~object." +"__delitem__`、:meth:`~object.__contains__` など、典型的なマッピング操作をサ" +"ポートしています。\n" +"各メソッドのキーはヘッダ名で、大文字・小文字を区別しません。\n" +"値は、そのヘッダ名に関連付けられた最初の値です。\n" +"ヘッダを設定すると、そのヘッダの既存の値をすべて削除し、ラップしているヘッダ" +"リストの末尾に新しい値を追加します。\n" +"通常、既存のヘッダの順序は保たれ、新しいヘッダはリストの末尾に追加されます。" #: ../../library/wsgiref.rst:214 msgid "" @@ -434,7 +470,6 @@ msgstr "" "(複数の値を持つ可能性のある) ヘッダを、キーワード引数を通じて指定するオプショ" "ンの MIME パラメータと共に追加します。" -#: ../../library/wsgiref.rst:252 msgid "" "*name* is the header field to add. Keyword arguments can be used to set " "MIME parameters for the header field. Each parameter must be a string or " @@ -445,26 +480,28 @@ msgid "" "only the parameter name is added. (This is used for MIME parameters without " "a value.) Example usage::" msgstr "" -"*name* は追加するヘッダフィールドです。このヘッダフィールドに MIME パラメータ" -"を設定するためにキーワード引数を使うことができます。それぞれのパラメータは文" -"字列か ``None`` でなければいけません。パラメータ中のアンダースコアはダッシュ " -"(-) に変換されます。これは、ダッシュが Python の識別子としては不正なのです" -"が、多くの MIME パラメータはダッシュを含むためです。パラメータ値が文字列の場" -"合、これはヘッダ値のパラメータに ``name=\"value\"`` の形で追加されます。この" -"値がもし ``None`` の場合、パラメータ名だけが追加されます。(これは値なしの " -"MIME パラメータの場合に使われます。)使い方の例は::" +"*name* は追加するヘッダフィールドです。\n" +"このヘッダフィールドに MIME パラメータを設定するためにキーワード引数を使うこ" +"とができます。\n" +"それぞれのパラメータは文字列か ``None`` でなければいけません。\n" +"パラメータ名中のアンダースコアはダッシュ (-) に変換されます。\n" +"これは、ダッシュが Python の識別子としては不正なのですが、多くの MIME パラ" +"メータはダッシュを含むためです。\n" +"パラメータ値が文字列の場合、これはヘッダ値のパラメータに ``name=\"value\"`` " +"の形で追加されます。\n" +"この値がもし ``None`` の場合、パラメータ名だけが追加されます。\n" +"(これは値なしの MIME パラメータの場合に使われます。\n" +")使い方の例は::" -#: ../../library/wsgiref.rst:260 msgid "h.add_header('content-disposition', 'attachment', filename='bud.gif')" -msgstr "" +msgstr "h.add_header('content-disposition', 'attachment', filename='bud.gif')" #: ../../library/wsgiref.rst:262 msgid "The above will add a header that looks like this::" msgstr "上記はこのようなヘッダを追加します::" -#: ../../library/wsgiref.rst:264 msgid "Content-Disposition: attachment; filename=\"bud.gif\"" -msgstr "" +msgstr "Content-Disposition: attachment; filename=\"bud.gif\"" #: ../../library/wsgiref.rst:267 msgid "*headers* parameter is optional." @@ -505,7 +542,6 @@ msgstr "" "*handler_class* を使ってリクエストを処理します。 *app* は :pep:`3333` で定義" "されるところの WSGI アプリケーションでなければいけません。" -#: ../../library/wsgiref.rst:296 msgid "" "from wsgiref.simple_server import make_server, demo_app\n" "\n" @@ -518,6 +554,16 @@ msgid "" " # Alternative: serve one request, then exit\n" " httpd.handle_request()" msgstr "" +"from wsgiref.simple_server import make_server, demo_app\n" +"\n" +"with make_server('', 8000, demo_app) as httpd:\n" +" print(\"Serving HTTP on port 8000...\")\n" +"\n" +" # プロセスが終了させられるまでリクエストに応答する。\n" +" httpd.serve_forever()\n" +"\n" +" # 別の方法: リクエストを 1 件処理して終了する。\n" +" httpd.handle_request()" #: ../../library/wsgiref.rst:310 msgid "" @@ -533,11 +579,12 @@ msgstr "" "がシンプルな WSGI アプリケーションを正しく実行できるかを確かめるのに便利で" "す。" -#: ../../library/wsgiref.rst:316 msgid "" "The *start_response* callable should follow the :class:`.StartResponse` " "protocol." msgstr "" +"呼び出し可能オブジェクト *start_response* は、:class:`.StartResponse` プロト" +"コルに従う必要があります。" #: ../../library/wsgiref.rst:321 msgid "" @@ -576,9 +623,9 @@ msgstr "" "呼び出し可能 (callable) な *application* をリクエストを受け取る WSGI アプリ" "ケーションとして設定します。" -#: ../../library/wsgiref.rst:342 msgid "Returns the currently set application callable." msgstr "" +"現在設定されているアプリケーションの呼び出し可能オブジェクトを返します。" #: ../../library/wsgiref.rst:344 msgid "" @@ -590,15 +637,14 @@ msgstr "" "`set_app` は普通は :func:`make_server` によって呼ばれ、 :meth:`get_app` は主" "にリクエストハンドラインスタンスの便宜上存在するからです。" -#: ../../library/wsgiref.rst:351 msgid "" "Create an HTTP handler for the given *request* (i.e. a socket), " "*client_address* (a ``(host,port)`` tuple), and *server* (:class:" "`WSGIServer` instance)." msgstr "" -"与えられた *request* (すなわちソケット)の HTTP ハンドラ、 *client_address* " -"(``(host,port)`` のタプル)、 *server* (:class:`WSGIServer` インスタンス) の " -"HTTP ハンドラを作成します。" +"指定された *request* (ソケット)、*client_address* (``(host,port)`` タプル)、" +"*server* (:class:`WSGIServer` インスタンス) に対する HTTP ハンドラを作成しま" +"す。" #: ../../library/wsgiref.rst:354 msgid "" @@ -637,15 +683,14 @@ msgstr "" "``wsgi.errors`` ストリームとして使われるオブジェクトを返します。デフォルト実" "装では単に ``sys.stderr`` を返します。" -#: ../../library/wsgiref.rst:380 msgid "" "Process the HTTP request. The default implementation creates a handler " "instance using a :mod:`wsgiref.handlers` class to implement the actual WSGI " "application interface." msgstr "" -"HTTP リクエストを処理します。デフォルト実装では実際の WGI アプリケーションイ" -"ンターフェースを実装するのに :mod:`wsgiref.handlers` クラスを使ってハンドライ" -"ンスタンスを作成します。" +"HTTP リクエストを処理します。\n" +"デフォルトの実装では、:mod:`wsgiref.handlers` のクラスでハンドラインスタンス" +"を作成し、実際の WSGI アプリケーションインターフェースを実装します。" #: ../../library/wsgiref.rst:386 msgid ":mod:`wsgiref.validate` --- WSGI conformance checker" @@ -806,14 +851,16 @@ msgstr "" "の allowPathInfoForScriptMappings を設定せずに Microsoft の IIS Web サーバに" "デプロイするときに使う、 :class:`CGIHandler` クラス以外の専用の選択肢です。" -#: ../../library/wsgiref.rst:485 msgid "" "By default, IIS gives a ``PATH_INFO`` that duplicates the ``SCRIPT_NAME`` at " "the front, causing problems for WSGI applications that wish to implement " "routing. This handler strips any such duplicated path." msgstr "" +"デフォルトでは、IIS は ``SCRIPT_NAME`` を先頭に重複して含む ``PATH_INFO`` を" +"渡します。\n" +"このため、ルーティングを実装する WSGI アプリケーションで問題が起こります。\n" +"このハンドラは、そうした重複部分を取り除きます。" -#: ../../library/wsgiref.rst:489 msgid "" "IIS can be configured to pass the correct ``PATH_INFO``, but this causes " "another bug where ``PATH_TRANSLATED`` is wrong. Luckily this variable is " @@ -823,14 +870,26 @@ msgid "" "IIS<7 is almost never deployed with the fix (Even IIS7 rarely uses it " "because there is still no UI for it.)." msgstr "" +"IIS を設定して正しい ``PATH_INFO`` を渡すこともできますが、その場合は " +"``PATH_TRANSLATED`` が不正になる別のバグが起こります。\n" +"幸い、この変数はほとんど使われず、WSGI でも保証されていません。\n" +"ただし、IIS 7 より前では仮想ホスト単位でしか設定できず、他のすべてのスクリプ" +"トマッピングに影響し、\n" +"その多くは ``PATH_TRANSLATED`` のバグによって動作しなくなります。\n" +"このため、IIS 7 より前では、この修正を適用した構成でデプロイされることはほぼ" +"ありません\n" +"(IIS 7 でも、設定用の UI がまだないため、ほとんど使われません)。" -#: ../../library/wsgiref.rst:497 msgid "" "There is no way for CGI code to tell whether the option was set, so a " "separate handler class is provided. It is used in the same way as :class:" "`CGIHandler`, i.e., by calling ``IISCGIHandler().run(app)``, where ``app`` " "is the WSGI application object you wish to invoke." msgstr "" +"CGI コードからは、このオプションが設定されているかどうかを判別できないため、" +"別のハンドラクラスを用意しています。\n" +"使い方は :class:`CGIHandler` と同じで、実行したい WSGI アプリケーションオブ" +"ジェクトを ``app`` として ``IISCGIHandler().run(app)`` を呼び出します。" #: ../../library/wsgiref.rst:507 msgid "" @@ -869,7 +928,6 @@ msgstr "" "れています。もしあなたが HTTP サーバ実装を書いている場合、おそらく :class:" "`BaseCGIHandler` ではなくこのクラスをサブクラス化するとよいでしょう。" -#: ../../library/wsgiref.rst:526 msgid "" "This class is a subclass of :class:`BaseHandler`. It overrides the :meth:`!" "__init__`, :meth:`~BaseHandler.get_stdin`, :meth:`~BaseHandler.get_stderr`, :" @@ -879,12 +937,21 @@ msgid "" "stored in the :attr:`stdin`, :attr:`stdout`, :attr:`stderr`, and :attr:" "`environ` attributes." msgstr "" +"このクラスは :class:`BaseHandler` のサブクラスです。\n" +":meth:`!__init__`、:meth:`~BaseHandler.get_stdin`、:meth:`~BaseHandler." +"get_stderr`、:meth:`~BaseHandler.add_cgi_vars`、:meth:`~BaseHandler." +"_write`、:meth:`~BaseHandler._flush` の各メソッドをオーバーライドし、\n" +"コンストラクタを通じて環境とストリームを明示的に設定できるようにしていま" +"す。\n" +"指定した環境とストリームは、:attr:`stdin`、:attr:`stdout`、:attr:`stderr`、:" +"attr:`environ` の各属性に保存されます。" -#: ../../library/wsgiref.rst:535 msgid "" "The :meth:`~io.BufferedIOBase.write` method of *stdout* should write each " "chunk in full, like :class:`io.BufferedIOBase`." msgstr "" +"*stdout* の :meth:`~io.BufferedIOBase.write` メソッドは、:class:`io." +"BufferedIOBase` と同様に、各チャンクを全量書き込む必要があります。" #: ../../library/wsgiref.rst:541 msgid "" @@ -942,19 +1009,21 @@ msgstr "" "バッファされたデータをクライアントに強制的に転送します。このメソッドは何もし" "なくても OK です(すなわち、 :meth:`_write` が実際にデータを送る場合)。" -#: ../../library/wsgiref.rst:575 msgid "" "Return an object compatible with :class:`~wsgiref.types.InputStream` " "suitable for use as the ``wsgi.input`` of the request currently being " "processed." msgstr "" +"現在処理しているリクエストの ``wsgi.input`` として使うのに適した、:class:" +"`~wsgiref.types.InputStream` と互換性のあるオブジェクトを返します。" -#: ../../library/wsgiref.rst:582 msgid "" "Return an object compatible with :class:`~wsgiref.types.ErrorStream` " "suitable for use as the ``wsgi.errors`` of the request currently being " "processed." msgstr "" +"現在処理しているリクエストの ``wsgi.errors`` として使うのに適した、:class:" +"`~wsgiref.types.ErrorStream` と互換性のあるオブジェクトを返します。" #: ../../library/wsgiref.rst:589 msgid "" @@ -1110,7 +1179,6 @@ msgstr "" "す。これはクライアントにヘッダが送出される前にエラーが発生した場合にのみ呼び" "出されます。" -#: ../../library/wsgiref.rst:683 msgid "" "This method can access the current error using ``sys.exception()``, and " "should pass that information to *start_response* when calling it (as " @@ -1118,6 +1186,11 @@ msgid "" "the *start_response* callable should follow the :class:`.StartResponse` " "protocol." msgstr "" +"このメソッドは ``sys.exception()`` で現在のエラーにアクセスできます。\n" +":pep:`3333` の「Error Handling」節に記載されているとおり、*start_response* を" +"呼び出す際にその情報を渡す必要があります。\n" +"特に、呼び出し可能オブジェクト *start_response* は :class:`.StartResponse` プ" +"ロトコルに従う必要があります。" #: ../../library/wsgiref.rst:689 msgid "" @@ -1178,12 +1251,14 @@ msgstr "" ":pep:`3333` の \"オプションのプラットフォーム固有のファイルハンドリング\" 機" "能のためのメソッドと属性:" -#: ../../library/wsgiref.rst:724 msgid "" "A ``wsgi.file_wrapper`` factory, compatible with :class:`wsgiref.types." "FileWrapper`, or ``None``. The default value of this attribute is the :" "class:`wsgiref.util.FileWrapper` class." msgstr "" +":class:`wsgiref.types.FileWrapper` と互換性のある ``wsgi.file_wrapper`` ファ" +"クトリ、または ``None`` です。\n" +"この属性のデフォルト値は :class:`wsgiref.util.FileWrapper` クラスです。" #: ../../library/wsgiref.rst:731 msgid "" @@ -1233,7 +1308,6 @@ msgstr "" "ンスセットの HTTP バージョンの設定に使われます。デフォルトは ``\"1.0\"`` で" "す。" -#: ../../library/wsgiref.rst:760 msgid "" "Transcode CGI variables from ``os.environ`` to :pep:`3333` \"bytes in " "unicode\" strings, returning a new dictionary. This function is used by :" @@ -1244,69 +1318,87 @@ msgid "" "bytes, but the system encoding used by Python to decode it is anything other " "than ISO-8859-1 (e.g. Unix systems using UTF-8)." msgstr "" +"``os.environ`` の CGI 変数を、:pep:`3333` の「bytes in unicode」形式の文字列" +"に変換し、新しい辞書を返します。\n" +":class:`CGIHandler` と :class:`IISCGIHandler` は、``os.environ`` を直接使う代" +"わりにこの関数を使います。\n" +"Python 3 を使うすべてのプラットフォームや Web サーバで、``os.environ`` が " +"WSGI に準拠しているとは限らないためです。\n" +"具体的には、OS の実際の環境変数が Unicode である場合 (Windows) や、\n" +"環境変数がバイト列であっても、Python がそのデコードに使うシステムエンコーディ" +"ングが ISO-8859-1 以外である場合 (UTF-8 を使う Unix システムなど) が該当しま" +"す。" -#: ../../library/wsgiref.rst:769 msgid "" "If you are implementing a CGI-based handler of your own, you probably want " "to use this routine instead of just copying values out of ``os.environ`` " "directly." msgstr "" +"独自の CGI ベースのハンドラを実装する場合は、``os.environ`` から直接値をコ" +"ピーする代わりに、このルーチンを使うとよいでしょう。" #: ../../library/wsgiref.rst:777 msgid ":mod:`wsgiref.types` -- WSGI types for static type checking" msgstr "" -#: ../../library/wsgiref.rst:783 msgid "" "This module provides various types for static type checking as described in :" "pep:`3333`." msgstr "" +"このモジュールは、:pep:`3333` に記載されたインターフェースの静的型検査用に、" +"さまざまな型を提供します。" -#: ../../library/wsgiref.rst:791 msgid "" "A :class:`typing.Protocol` describing :pep:`start_response() <3333#the-start-" "response-callable>` callables (:pep:`3333`)." msgstr "" +":pep:`start_response() <3333#the-start-response-callable>` の呼び出し可能オブ" +"ジェクト (:pep:`3333`) を記述する :class:`typing.Protocol` です。" -#: ../../library/wsgiref.rst:797 msgid "A type alias describing a WSGI environment dictionary." -msgstr "" +msgstr "WSGI 環境辞書を記述する型エイリアスです。" -#: ../../library/wsgiref.rst:801 msgid "A type alias describing a WSGI application callable." msgstr "" +"WSGI アプリケーションの呼び出し可能オブジェクトを記述する型エイリアスです。" -#: ../../library/wsgiref.rst:805 msgid "" "A :class:`typing.Protocol` describing a :pep:`WSGI Input Stream <3333#input-" "and-error-streams>`." msgstr "" +":pep:`WSGI 入力ストリーム <3333#input-and-error-streams>` を記述する :class:" +"`typing.Protocol` です。" -#: ../../library/wsgiref.rst:810 msgid "" "A :class:`typing.Protocol` describing a :pep:`WSGI Error Stream <3333#input-" "and-error-streams>`." msgstr "" +":pep:`WSGI エラーストリーム <3333#input-and-error-streams>` を記述する :" +"class:`typing.Protocol` です。" -#: ../../library/wsgiref.rst:815 msgid "" "A :class:`typing.Protocol` describing a :pep:`file wrapper <3333#optional-" "platform-specific-file-handling>`. See :class:`wsgiref.util.FileWrapper` for " "a concrete implementation of this protocol." msgstr "" +":pep:`ファイルラッパー <3333#optional-platform-specific-file-handling>` を記" +"述する :class:`typing.Protocol` です。\n" +"このプロトコルの具体的な実装は :class:`wsgiref.util.FileWrapper` を参照してく" +"ださい。" #: ../../library/wsgiref.rst:822 msgid "Examples" msgstr "使用例" -#: ../../library/wsgiref.rst:824 msgid "" "This is a working \"Hello World\" WSGI application, where the " "*start_response* callable should follow the :class:`.StartResponse` " "protocol::" msgstr "" +"実際に動作する「Hello World」WSGI アプリケーションです。\n" +"呼び出し可能オブジェクト *start_response* は :class:`.StartResponse` プロトコ" +"ルに従う必要があります。 ::" -#: ../../library/wsgiref.rst:827 msgid "" "\"\"\"\n" "Every WSGI application must have an application object - a callable\n" @@ -1334,12 +1426,38 @@ msgid "" " # Serve until process is killed\n" " httpd.serve_forever()" msgstr "" +"\"\"\"\n" +"すべての WSGI アプリケーションには、2 つの引数を受け取る呼び出し可能な\n" +"アプリケーションオブジェクトが必要です。\n" +"ここでは関数を使います (関数に限らず、例えばクラスも使えます)。\n" +"関数に渡す最初の引数は CGI 形式の環境変数を含む辞書で、\n" +"2 番目の引数は呼び出し可能オブジェクトです。\n" +"\"\"\"\n" +"from wsgiref.simple_server import make_server\n" +"\n" +"\n" +"def hello_world_app(environ, start_response):\n" +" status = \"200 OK\" # HTTP ステータス\n" +" headers = [(\"Content-type\", \"text/plain; charset=utf-8\")] # HTTP " +"ヘッダ\n" +" start_response(status, headers)\n" +"\n" +" # 戻り値のオブジェクトが出力される。\n" +" return [b\"Hello World\"]\n" +"\n" +"with make_server(\"\", 8000, hello_world_app) as httpd:\n" +" print(\"Serving on port 8000...\")\n" +"\n" +" # プロセスが終了させられるまで処理する。\n" +" httpd.serve_forever()" -#: ../../library/wsgiref.rst:854 msgid "" "Example of a WSGI application serving the current directory, accept optional " "directory and port number (default: 8000) on the command line::" msgstr "" +"カレントディレクトリのファイルを配信する WSGI アプリケーションの例です。\n" +"コマンドラインでディレクトリとポート番号 (デフォルトは 8000) を指定することも" +"できます。 ::" #: ../../library/wsgiref.rst:857 msgid "" diff --git a/library/xdrlib.po b/library/xdrlib.po index c01451495..c5b46e364 100644 --- a/library/xdrlib.po +++ b/library/xdrlib.po @@ -12,15 +12,14 @@ msgstr "" "PO-Revision-Date: 2024-11-19 01:03+0000\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" -#: ../../library/xdrlib.rst:2 msgid ":mod:`!xdrlib` --- Encode and decode XDR data" -msgstr "" +msgstr ":mod:`!xdrlib` --- XDR データのエンコードとデコード" #: ../../library/xdrlib.rst:10 msgid "" @@ -28,9 +27,13 @@ msgid "" "`removed in Python 3.13 ` after being deprecated in " "Python 3.11. The removal was decided in :pep:`594`." msgstr "" +"このモジュールは今や Python 標準ライブラリの一部ではありません。このモジュー" +"ルは Python 3.11 で非推奨となったあと、:ref:`Python 3.13 で削除` されました。削除の決定は :pep:`594` でなされました。" -#: ../../library/xdrlib.rst:14 msgid "" "The last version of Python that provided the :mod:`!xdrlib` module was " "`Python 3.12 `_." msgstr "" +":mod:`!xdrlib` モジュールを提供していた最後のバージョンは `Python 3.12 " +"`_ です。" diff --git a/library/xml.dom.minidom.po b/library/xml.dom.minidom.po index 31a95cb3c..04a2897f7 100644 --- a/library/xml.dom.minidom.po +++ b/library/xml.dom.minidom.po @@ -20,10 +20,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/xml.dom.minidom.rst:2 @@ -66,7 +66,6 @@ msgstr "" "DOM アプリケーションは通常、XML を DOM に解析 (parse) することで開始しま" "す。 :mod:`xml.dom.minidom` では、以下のような解析用の関数を介して行います::" -#: ../../library/xml.dom.minidom.rst:32 msgid "" "from xml.dom.minidom import parse, parseString\n" "\n" @@ -77,6 +76,15 @@ msgid "" "\n" "dom3 = parseString('Some data some more data')" msgstr "" +"from xml.dom.minidom import parse, parseString\n" +"\n" +"dom1 = parse('c:\\\\temp\\\\mydata.xml') # ファイル名を指定して XML ファイル" +"を解析する\n" +"\n" +"datasource = open('c:\\\\temp\\\\mydata.xml')\n" +"dom2 = parse(datasource) # 開いているファイルを解析する\n" +"\n" +"dom3 = parseString('Some data some more data')" #: ../../library/xml.dom.minidom.rst:41 msgid "" @@ -156,7 +164,6 @@ msgstr "" "取得できます。 :class:`Document` を取得したら、DOM を構成するために子ノードを" "追加していくことができます::" -#: ../../library/xml.dom.minidom.rst:77 msgid "" "from xml.dom.minidom import getDOMImplementation\n" "\n" @@ -167,8 +174,15 @@ msgid "" "text = newdoc.createTextNode('Some textual content.')\n" "top_element.appendChild(text)" msgstr "" +"from xml.dom.minidom import getDOMImplementation\n" +"\n" +"impl = getDOMImplementation()\n" +"\n" +"newdoc = impl.createDocument(None, \"some_tag\", None)\n" +"top_element = newdoc.documentElement\n" +"text = newdoc.createTextNode('Some textual content.')\n" +"top_element.appendChild(text)" -#: ../../library/xml.dom.minidom.rst:86 msgid "" "Once you have a DOM document object, you can access the parts of your XML " "document through its properties and methods. These properties are defined " @@ -176,17 +190,19 @@ msgid "" "attr:`documentElement` property. It gives you the main element in the XML " "document: the one that holds all others. Here is an example program::" msgstr "" -"DOM 文書オブジェクトを手にしたら、XML 文書のプロパティやメソッドを使って、文" -"書の一部にアクセスすることができます。これらのプロパティは DOM 仕様で定義され" -"ています。文書オブジェクトの主要なプロパティは :attr:`documentElement` プロパ" -"ティです。このプロパティは XML 文書の主要な要素、つまり他の全ての要素を保持す" -"る要素を与えます。以下にプログラム例を示します。" +"DOM 文書オブジェクトを取得すると、そのプロパティとメソッドを使って XML 文書の" +"各部分にアクセスできます。\n" +"これらのプロパティは DOM 仕様で定義されています。\n" +"文書オブジェクトの主要なプロパティは :attr:`documentElement` です。\n" +"このプロパティは、XML 文書の他のすべての要素を含む主要な要素を返します。\n" +"プログラム例を示します。 ::" -#: ../../library/xml.dom.minidom.rst:92 msgid "" "dom3 = parseString(\"Some data\")\n" "assert dom3.documentElement.tagName == \"myxml\"" msgstr "" +"dom3 = parseString(\"Some data\")\n" +"assert dom3.documentElement.tagName == \"myxml\"" #: ../../library/xml.dom.minidom.rst:95 msgid "" @@ -257,11 +273,12 @@ msgstr "" "いようにできます。 :keyword:`!with` ブロックから出る時に自動的に次のコードが " "*dom* を unlink します::" -#: ../../library/xml.dom.minidom.rst:131 msgid "" "with xml.dom.minidom.parse(datasource) as dom:\n" " ... # Work with dom." msgstr "" +"with xml.dom.minidom.parse(datasource) as dom:\n" +" ... # dom を使って処理する。" #: ../../library/xml.dom.minidom.rst:138 msgid "" @@ -302,13 +319,12 @@ msgstr "" "され、それ以外の場合 ``\"no\"`` が設定されます。引数を指定しない場合は文書か" "ら宣言が省略されます。" -#: ../../library/xml.dom.minidom.rst:155 msgid "" "The :meth:`writexml` method now preserves the attribute order specified by " "the user." msgstr "" ":meth:`writexml` メソッドはユーザーが指定した属性の順序を保持するようになりま" -"した。 " +"した。" #: ../../library/xml.dom.minidom.rst:159 ../../library/xml.dom.minidom.rst:180 #: ../../library/xml.dom.minidom.rst:199 @@ -385,7 +401,6 @@ msgstr "" "以下のプログラム例は、単純なプログラムのかなり現実的な例です。特にこの例に関" "しては、DOM の柔軟性をあまり活用してはいません。" -#: ../../library/xml.dom.minidom.rst:210 msgid "" "import xml.dom.minidom\n" "\n" @@ -452,6 +467,70 @@ msgid "" "\n" "handleSlideshow(dom)\n" msgstr "" +"import xml.dom.minidom\n" +"\n" +"document = \"\"\"\\\n" +"\n" +"Demo slideshow\n" +"Slide title\n" +"This is a demo\n" +"Of a program for processing slides\n" +"\n" +"\n" +"Another demo slide\n" +"It is important\n" +"To have more than\n" +"one slide\n" +"\n" +"\n" +"\"\"\"\n" +"\n" +"dom = xml.dom.minidom.parseString(document)\n" +"\n" +"def getText(nodelist):\n" +" rc = []\n" +" for node in nodelist:\n" +" if node.nodeType == node.TEXT_NODE:\n" +" rc.append(node.data)\n" +" return ''.join(rc)\n" +"\n" +"def handleSlideshow(slideshow):\n" +" print(\"\")\n" +" handleSlideshowTitle(slideshow.getElementsByTagName(\"title\")[0])\n" +" slides = slideshow.getElementsByTagName(\"slide\")\n" +" handleToc(slides)\n" +" handleSlides(slides)\n" +" print(\"\")\n" +"\n" +"def handleSlides(slides):\n" +" for slide in slides:\n" +" handleSlide(slide)\n" +"\n" +"def handleSlide(slide):\n" +" handleSlideTitle(slide.getElementsByTagName(\"title\")[0])\n" +" handlePoints(slide.getElementsByTagName(\"point\"))\n" +"\n" +"def handleSlideshowTitle(title):\n" +" print(f\"{getText(title.childNodes)}\")\n" +"\n" +"def handleSlideTitle(title):\n" +" print(f\"

{getText(title.childNodes)}

\")\n" +"\n" +"def handlePoints(points):\n" +" print(\"
    \")\n" +" for point in points:\n" +" handlePoint(point)\n" +" print(\"
\")\n" +"\n" +"def handlePoint(point):\n" +" print(f\"
  • {getText(point.childNodes)}
  • \")\n" +"\n" +"def handleToc(slides):\n" +" for slide in slides:\n" +" title = slide.getElementsByTagName(\"title\")[0]\n" +" print(f\"

    {getText(title.childNodes)}

    \")\n" +"\n" +"handleSlideshow(dom)\n" #: ../../library/xml.dom.minidom.rst:216 msgid "minidom and the DOM standard" diff --git a/library/xml.dom.po b/library/xml.dom.po index 2e3d1f673..80c686230 100644 --- a/library/xml.dom.po +++ b/library/xml.dom.po @@ -21,10 +21,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/xml.dom.rst:2 @@ -51,7 +51,6 @@ msgstr "" "す。さらに、前述の構造に対して、よく知られたインターフェースをもつ一連のオブ" "ジェクトを通したアクセス手段も提供します。" -#: ../../library/xml.dom.rst:20 msgid "" "The DOM is extremely useful for random-access applications. SAX only allows " "you a view of one bit of the document at a time. If you are looking at one " @@ -61,25 +60,27 @@ msgid "" "document somewhere in your own code. SAX does not do it for you. Also, if " "you need to look ahead in the XML document, you are just out of luck." msgstr "" -"DOM はランダムアクセスを行うアプリケーションで非常に有用です。SAX では、一度" -"に閲覧することができるのはドキュメントのほんの一部分です。ある SAX 要素に注目" -"している際には、別の要素をアクセスすることはできません。またテキストノードに" -"注目しているときには、その中に入っている要素をアクセスすることができません。" +"DOM はランダムアクセスを行うアプリケーションで非常に有用です。\n" +"SAX では、一度に閲覧することができるのはドキュメントのほんの一部分です。\n" +"ある SAX 要素に注目している際には、別の要素をアクセスすることはできません。\n" +"またテキストノードに注目しているときには、そのテキストノードを含む要素にアク" +"セスすることができません。\n" "SAX によるアプリケーションを書くときには、プログラムがドキュメント内のどこを" -"処理しているのかを追跡するよう、コードのどこかに記述する必要があります。SAX " -"自体がその作業を行ってくれることはありません。さらに、XML ドキュメントに対す" -"る先読み (look ahead) が必要だとすると不運なことになります。" +"処理しているのかを追跡するよう、コードのどこかに記述する必要があります。\n" +"SAX 自体がその作業を行ってくれることはありません。\n" +"さらに、XML ドキュメントに対する先読み (look ahead) が必要だとすると不運なこ" +"とになります。" -#: ../../library/xml.dom.rst:28 msgid "" "Some applications are simply impossible in an event driven model with no " "access to a tree. Of course you could build some sort of tree yourself in " "SAX events, but the DOM allows you to avoid writing that code. The DOM is a " "standard tree representation for XML data." msgstr "" -"アプリケーションによっては、ツリーにアクセスできなければイベント駆動モデルを" -"実現できません。もちろん、何らかのツリーを SAX イベントに応じて自分で構築する" -"こともできるでしょうが、DOM ではそのようなコードを書かなくてもよくなります。" +"ツリーにアクセスできないイベント駆動モデルでは実現できないアプリケーションも" +"あります。\n" +"もちろん、何らかのツリーを SAX イベントに応じて自分で構築することもできるで" +"しょうが、DOM ではそのようなコードを書かなくてもよくなります。\n" "DOM は XML データに対する標準的なツリー表現なのです。" #: ../../library/xml.dom.rst:33 @@ -478,7 +479,6 @@ msgstr "" "機能名 *feature* とバージョン番号 *version* で識別される機能(feature)が実装" "されていれば ``True`` を返します。" -#: ../../library/xml.dom.rst:219 msgid "" "Return a new :class:`Document` object (the root of the DOM), with a child :" "class:`Element` object having the given *namespaceUri* and *qualifiedName*. " @@ -487,13 +487,13 @@ msgid "" "arguments can also be ``None`` in order to indicate that no :class:`Element` " "child is to be created." msgstr "" -"新たな(DOMのスーパークラスである) :class:`Document` クラスのオブジェクトを返" -"します。このクラスは *namespaceUri* と *qualifiedName* が設定された子クラス :" -"class:`Element` のオブジェクトを所有しています。 *doctype* は :meth:" -"`createDocumentType` によって生成された :class:`DocumentType` クラスのオブ" -"ジェクト、または ``None`` である必要があります。 Python DOM APIでは、子クラス" -"である :class:`Element` を作成しないことを示すために、はじめの2つの引数を " -"``None`` に設定することができます。" +"指定された *namespaceUri* と *qualifiedName* を持つ :class:`Element` オブジェ" +"クトを子ノードとして含む、新しい :class:`Document` オブジェクト (DOM のルー" +"ト) を返します。\n" +"*doctype* は :meth:`createDocumentType` で作成した :class:`DocumentType` オブ" +"ジェクトか、``None`` でなければなりません。\n" +"Python DOM API では、:class:`Element` の子ノードを作成しないことを示すため" +"に、最初の 2 つの引数を ``None`` にすることもできます。" #: ../../library/xml.dom.rst:229 msgid "" @@ -660,15 +660,14 @@ msgstr "ノードが何らかの属性を持っている場合に ``True`` を msgid "Return ``True`` if the node has any child nodes." msgstr "ノードが何らかの子ノードを持っている場合に ``True`` を返します。" -#: ../../library/xml.dom.rst:348 msgid "" "Return ``True`` if *other* refers to the same node as this node. This is " "especially useful for DOM implementations which use any sort of proxy " "architecture (because more than one object can refer to the same node)." msgstr "" -"*other* がこのノードと同じノードを参照している場合に ``True`` を返します。こ" -"のメソッドは、何らかのプロキシ (proxy) 機構を利用するような DOM 実装で特に便" -"利です (一つ以上のオブジェクトが同じノードを参照するかもしれないからです)。" +"*other* がこのノードと同じノードを参照していれば ``True`` を返します。\n" +"複数のオブジェクトが同じノードを参照する場合があるため、プロキシ機構を使う " +"DOM 実装で特に役立ちます。" #: ../../library/xml.dom.rst:354 msgid "" @@ -909,8 +908,8 @@ msgid "" "Remember that it inherits properties from :class:`Node`." msgstr "" ":class:`Document` は XML ドキュメント全体を表現し、その構成要素である要素、属" -"性、処理命令、コメント等を持ちます。 :class:`Document` は :class:`Node` から" -"プロパティを継承していることを思い出してください。" +"性、処理命令、コメント等を持ちます。 ``Document`` は :class:`Node` からプロパ" +"ティを継承していることを思い出してください。" #: ../../library/xml.dom.rst:512 msgid "The one and only root element of the document." @@ -1020,8 +1019,8 @@ msgid "" ":class:`Element` is a subclass of :class:`Node`, so inherits all the " "attributes of that class." msgstr "" -":class:`Element` は :class:`Node` のサブクラスです。このため :class:`Node` ク" -"ラスの全ての属性を継承します。" +":class:`Element` は :class:`Node` のサブクラスです。このため ``Node`` クラス" +"の全ての属性を継承します。" #: ../../library/xml.dom.rst:591 msgid "" @@ -1150,18 +1149,18 @@ msgid "" msgstr "" ":class:`Attr` は :class:`Node` を継承しており、全ての属性を継承しています。" -#: ../../library/xml.dom.rst:694 msgid "" "The attribute name. In a namespace-using document it may include a colon." msgstr "" -"要素型名です。名前空間使用の文書では、要素型名中にコロンが含まれるかもしれま" -"せん。" +"属性名です。\n" +"名前空間を使用する文書では、コロンを含むことがあります。" -#: ../../library/xml.dom.rst:700 msgid "" "The part of the name following the colon if there is one, else the entire " "name. This is a read-only attribute." -msgstr "名前にコロンがあればコロン以降の部分に、なければ名前全体になります。" +msgstr "" +"名前にコロンがあればその後の部分、なければ名前全体です。\n" +"読み出し専用の属性です。" #: ../../library/xml.dom.rst:707 msgid "" @@ -1378,16 +1377,16 @@ msgstr "" "パラメタまたは操作が根底にあるオブジェクトでサポートされていない場合に送出さ" "れます。" -#: ../../library/xml.dom.rst:861 msgid "" "This exception is raised when a string parameter contains a character that " "is not permitted in the context it's being used in by the XML 1.0 " "recommendation. For example, attempting to create an :class:`Element` node " "with a space in the element type name will cause this error to be raised." msgstr "" -"この例外は、文字列パラメタが、現在使われているコンテキストで XML 1.0 勧告に" -"よって許可されていない場合に送出されます。例えば、要素型に空白の入った :" -"class:`Element` ノードを生成しようとすると、このエラーが送出されます。" +"文字列引数に、その使用箇所では XML 1.0 勧告が許可していない文字が含まれる場合" +"に送出されます。\n" +"例えば、要素型名に空白を含む :class:`Element` ノードを作成しようとすると、こ" +"のエラーが送出されます。" #: ../../library/xml.dom.rst:869 msgid "Raised when an attempt is made to modify the type of a node." @@ -1421,12 +1420,11 @@ msgstr "" "す。例えば、 :meth:`NamedNodeMap.removeNamedItem` は渡されたノードがノード" "マップ中に存在しない場合にこの例外を送出します。" -#: ../../library/xml.dom.rst:894 msgid "" "Raised when the implementation does not support the requested type of object " "or operation." msgstr "" -"要求された方のオブジェクトや操作が実装でサポートされていない場合に送出されま" +"要求された型のオブジェクトや操作を実装がサポートしていない場合に送出されま" "す。" #: ../../library/xml.dom.rst:900 @@ -1675,11 +1673,12 @@ msgstr "" "定義を、Java による対応付けが行うのとほとんど同じように行います。IDL 宣言の対" "応付け ::" -#: ../../library/xml.dom.rst:1005 msgid "" "readonly attribute string someValue;\n" " attribute string anotherValue;" msgstr "" +"readonly attribute string someValue;\n" +" attribute string anotherValue;" #: ../../library/xml.dom.rst:1008 msgid "" diff --git a/library/xml.dom.pulldom.po b/library/xml.dom.pulldom.po index b33cd0b48..bd3dda04c 100644 --- a/library/xml.dom.pulldom.po +++ b/library/xml.dom.pulldom.po @@ -17,10 +17,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/xml.dom.pulldom.rst:2 @@ -62,17 +62,16 @@ msgstr "" "はありません。信頼できないデータや認証されていないデータをパースする必要があ" "る場合は :ref:`xml-vulnerabilities` を参照してください。" -#: ../../library/xml.dom.pulldom.rst:30 msgid "" "The SAX parser no longer processes general external entities by default to " "increase security by default. To enable processing of external entities, " "pass a custom parser instance in::" msgstr "" -"SAXパーサーは、デフォルトでセキュリティーを向上させるために、一般的な外部エン" -"ティティーをデフォルトでは処理しなくなりました。外部エンティティの処理を有効" -"にするには、次の場所にカスタムパーサーインスタンスを渡します::" +"セキュリティを向上させるため、SAX パーサーはデフォルトでは外部一般エンティ" +"ティを処理しなくなりました。\n" +"外部エンティティの処理を有効にするには、次のようにカスタムのパーサーインスタ" +"ンスを渡します。 ::" -#: ../../library/xml.dom.pulldom.rst:34 msgid "" "from xml.dom.pulldom import parse\n" "from xml.sax import make_parser\n" @@ -82,12 +81,18 @@ msgid "" "parser.setFeature(feature_external_ges, True)\n" "parse(filename, parser=parser)" msgstr "" +"from xml.dom.pulldom import parse\n" +"from xml.sax import make_parser\n" +"from xml.sax.handler import feature_external_ges\n" +"\n" +"parser = make_parser()\n" +"parser.setFeature(feature_external_ges, True)\n" +"parse(filename, parser=parser)" #: ../../library/xml.dom.pulldom.rst:43 msgid "Example::" msgstr "以下はプログラム例です::" -#: ../../library/xml.dom.pulldom.rst:45 msgid "" "from xml.dom import pulldom\n" "\n" @@ -98,6 +103,14 @@ msgid "" " doc.expandNode(node)\n" " print(node.toxml())" msgstr "" +"from xml.dom import pulldom\n" +"\n" +"doc = pulldom.parse('sales_items.xml')\n" +"for event, node in doc:\n" +" if event == pulldom.START_ELEMENT and node.tagName == 'item':\n" +" if int(node.getAttribute('price')) > 50:\n" +" doc.expandNode(node)\n" +" print(node.toxml())" #: ../../library/xml.dom.pulldom.rst:54 msgid "``event`` is a constant and can be one of:" @@ -143,7 +156,6 @@ msgstr "" "``node`` は型 :class:`xml.dom.minidom.Document`、 :class:`xml.dom.minidom." "Element` または :class:`xml.dom.minidom.Text` のオブジェクトです。" -#: ../../library/xml.dom.pulldom.rst:68 msgid "" "Since the document is treated as a \"flat\" stream of events, the document " "\"tree\" is implicitly traversed and the desired elements are found " @@ -154,12 +166,14 @@ msgid "" "in the document at any given point) or to make use of the :func:" "`DOMEventStream.expandNode` method and switch to DOM-related processing." msgstr "" -"文書はイベントの *フラットな* 流れとして扱われるため、文書の \"木\" は暗黙の" -"うちに全て読み込まれ、目的の要素は木の中の深さに依らずに見つけられます。つま" -"り、文書ノードの再帰的な検索のような階層的な問題を考える必要はありません。し" -"かしながら要素の前後関係が重要な場合は、前後関係の状態を維持する (すなわち文" -"章中の任意の点の場所を記憶する) か、 :func:`DOMEventStream.expandNode` メソッ" -"ドを使用して DOM 関連の処理に切り替える必要があります。" +"文書を「平坦な」イベントの流れとして扱うため、文書の「木」は暗黙的に走査さ" +"れ、木の中の深さにかかわらず目的の要素を見つけられます。\n" +"つまり、文書ノードを再帰的に検索するなど、階層構造を考慮する必要はありませ" +"ん。\n" +"ただし、要素の文脈が重要な場合は、文脈に関する状態を管理する (文書中のどの位" +"置にいるかを常に記憶する) か、\n" +":func:`DOMEventStream.expandNode` メソッドを使って DOM による処理に切り替える" +"必要があります。" #: ../../library/xml.dom.pulldom.rst:80 ../../library/xml.dom.pulldom.rst:85 msgid "Subclass of :class:`xml.sax.handler.ContentHandler`." @@ -235,7 +249,6 @@ msgstr "" msgid "Expands all children of *node* into *node*. Example::" msgstr "*node* の全子ノードを *node* に展開します。例::" -#: ../../library/xml.dom.pulldom.rst:134 msgid "" "from xml.dom import pulldom\n" "\n" @@ -251,3 +264,16 @@ msgid "" "text
    and more

    '\n" " print(node.toxml())" msgstr "" +"from xml.dom import pulldom\n" +"\n" +"xml = 'Foo

    Some text

    and more

    '\n" +"doc = pulldom.parseString(xml)\n" +"for event, node in doc:\n" +" if event == pulldom.START_ELEMENT and node.tagName == 'p':\n" +" # 次の文は '

    ' だけを表示する。\n" +" print(node.toxml())\n" +" doc.expandNode(node)\n" +" # 次の文はすべての子を含むノード '

    Some text

    and more
    ' を表示する。\n" +" print(node.toxml())" diff --git a/library/xml.etree.elementtree.po b/library/xml.etree.elementtree.po index ccf23a3c0..71b7aefdf 100644 --- a/library/xml.etree.elementtree.po +++ b/library/xml.etree.elementtree.po @@ -21,10 +21,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/xml.etree.elementtree.rst:2 @@ -100,11 +100,12 @@ msgstr "" msgid "Parsing XML" msgstr "XML の解析" -#: ../../library/xml.etree.elementtree.rst:52 msgid "" "We'll be using the fictive :file:`country_data.xml` XML document as the " "sample data for this section:" msgstr "" +"この節では、架空の XML 文書 :file:`country_data.xml` をサンプルデータとして使" +"います。" #: ../../library/xml.etree.elementtree.rst:54 msgid "" @@ -132,25 +133,49 @@ msgid "" " \n" "" msgstr "" +"\n" +"\n" +" \n" +" 1\n" +" 2008\n" +" 141100\n" +" \n" +" \n" +" \n" +" \n" +" 4\n" +" 2011\n" +" 59900\n" +" \n" +" \n" +" \n" +" 68\n" +" 2011\n" +" 13600\n" +" \n" +" \n" +" \n" +"" #: ../../library/xml.etree.elementtree.rst:80 msgid "We can import this data by reading from a file::" msgstr "ファイルを読み込むことでこのデータをインポートすることが出来ます::" -#: ../../library/xml.etree.elementtree.rst:82 msgid "" "import xml.etree.ElementTree as ET\n" "tree = ET.parse('country_data.xml')\n" "root = tree.getroot()" msgstr "" +"import xml.etree.ElementTree as ET\n" +"tree = ET.parse('country_data.xml')\n" +"root = tree.getroot()" #: ../../library/xml.etree.elementtree.rst:86 msgid "Or directly from a string::" msgstr "文字列から直接インポートすることも出来ます::" -#: ../../library/xml.etree.elementtree.rst:88 msgid "root = ET.fromstring(country_data_as_string)" -msgstr "" +msgstr "root = ET.fromstring(country_data_as_string)" #: ../../library/xml.etree.elementtree.rst:90 msgid "" @@ -159,8 +184,8 @@ msgid "" "functions may create an :class:`ElementTree`. Check the documentation to be " "sure." msgstr "" -":func:`fromstring` は XML を文字列から :class:`Element` に直接パースします。:" -"class:`Element` はパースされた木のルート要素です。他のパース関数は :class:" +":func:`fromstring` は XML を文字列から :class:`Element` に直接パースします。 " +"``Element`` はパースされた木のルート要素です。他のパース関数は :class:" "`ElementTree` を作成するかもしれません。ドキュメントをきちんと確認してくださ" "い。" @@ -169,19 +194,21 @@ msgid "" "As an :class:`Element`, ``root`` has a tag and a dictionary of attributes::" msgstr ":class:`Element` として、``root`` はタグと属性の辞書を持ちます::" -#: ../../library/xml.etree.elementtree.rst:96 msgid "" ">>> root.tag\n" "'data'\n" ">>> root.attrib\n" "{}" msgstr "" +">>> root.tag\n" +"'data'\n" +">>> root.attrib\n" +"{}" #: ../../library/xml.etree.elementtree.rst:101 msgid "It also has children nodes over which we can iterate::" msgstr "さらにイテレート可能な子ノードも持ちます::" -#: ../../library/xml.etree.elementtree.rst:103 msgid "" ">>> for child in root:\n" "... print(child.tag, child.attrib)\n" @@ -190,6 +217,12 @@ msgid "" "country {'name': 'Singapore'}\n" "country {'name': 'Panama'}" msgstr "" +">>> for child in root:\n" +"... print(child.tag, child.attrib)\n" +"...\n" +"country {'name': 'Liechtenstein'}\n" +"country {'name': 'Singapore'}\n" +"country {'name': 'Panama'}" #: ../../library/xml.etree.elementtree.rst:110 msgid "Children are nested, and we can access specific child nodes by index::" @@ -197,11 +230,12 @@ msgstr "" "子ノードは入れ子になっており、インデックスで子ノードを指定してアクセスできま" "す::" -#: ../../library/xml.etree.elementtree.rst:112 msgid "" ">>> root[0][1].text\n" "'2008'" msgstr "" +">>> root[0][1].text\n" +"'2008'" #: ../../library/xml.etree.elementtree.rst:118 msgid "" @@ -243,20 +277,19 @@ msgstr "" "全に出来上がった :class:`Element` オブジェクトを便利に使いながら、操作をブ" "ロックすることなく XML のパースをインクリメンタルに行えることです。" -#: ../../library/xml.etree.elementtree.rst:142 msgid "" "The most powerful tool for doing this is :class:`XMLPullParser`. It does " "not require a blocking read to obtain the XML data, and is instead fed with " "data incrementally with :meth:`XMLPullParser.feed` calls. To get the parsed " "XML elements, call :meth:`XMLPullParser.read_events`. Here is an example::" msgstr "" -"これを行うための最も強力なツールは、 :class:`XMLPullParser` です。XML データ" -"を取得するためにブロックするような読み込みは必要なく、 :meth:`XMLPullParser." -"feed` を呼び出して、インクリメンタルにデータを読みます。パースされた XML 要素" -"を取得するには、:meth:`XMLPullParser.read_events` を呼び出します。以下に、例" -"を示します。" +"これを行うための最も強力なツールは :class:`XMLPullParser` です。\n" +"XML データを取得するためにブロックする読み込みは行わず、:meth:`XMLPullParser." +"feed` を呼び出してデータを少しずつ渡します。\n" +"解析された XML 要素を取得するには :meth:`XMLPullParser.read_events` を呼び出" +"します。\n" +"以下に例を示します。 ::" -#: ../../library/xml.etree.elementtree.rst:147 msgid "" ">>> parser = ET.XMLPullParser(['start', 'end'])\n" ">>> parser.feed('sometext')\n" @@ -270,6 +303,17 @@ msgid "" "end\n" "mytag text= sometext more text" msgstr "" +">>> parser = ET.XMLPullParser(['start', 'end'])\n" +">>> parser.feed('sometext')\n" +">>> list(parser.read_events())\n" +"[('start', )]\n" +">>> parser.feed(' more text')\n" +">>> for event, elem in parser.read_events():\n" +"... print(event)\n" +"... print(elem.tag, 'text=', elem.text)\n" +"...\n" +"end\n" +"mytag text= sometext more text" #: ../../library/xml.etree.elementtree.rst:159 msgid "" @@ -296,12 +340,14 @@ msgstr "" "合、:func:`iterparse` を参照してください。大きな XML ドキュメントを読んでい" "て、全てメモリ上にあるという状態にしたくない場合に有用です。" -#: ../../library/xml.etree.elementtree.rst:169 msgid "" "Where *immediate* feedback through events is wanted, calling method :meth:" "`XMLPullParser.flush` can help reduce delay; please make sure to study the " "related security notes." msgstr "" +"イベントによる *即時の* フィードバックが必要な場合は、:meth:`XMLPullParser." +"flush` メソッドを呼ぶことで遅延を減らせます。\n" +"関連するセキュリティ上の注意を必ず確認してください。" #: ../../library/xml.etree.elementtree.rst:175 msgid "Finding interesting elements" @@ -317,7 +363,6 @@ msgstr "" "や孫ノードなど) の部分木全体を再帰的にイテレートするいくつかの役立つメソッド" "を持っています::" -#: ../../library/xml.etree.elementtree.rst:181 msgid "" ">>> for neighbor in root.iter('neighbor'):\n" "... print(neighbor.attrib)\n" @@ -328,6 +373,14 @@ msgid "" "{'name': 'Costa Rica', 'direction': 'W'}\n" "{'name': 'Colombia', 'direction': 'E'}" msgstr "" +">>> for neighbor in root.iter('neighbor'):\n" +"... print(neighbor.attrib)\n" +"...\n" +"{'name': 'Austria', 'direction': 'E'}\n" +"{'name': 'Switzerland', 'direction': 'W'}\n" +"{'name': 'Malaysia', 'direction': 'N'}\n" +"{'name': 'Costa Rica', 'direction': 'W'}\n" +"{'name': 'Colombia', 'direction': 'E'}" #: ../../library/xml.etree.elementtree.rst:190 msgid "" @@ -341,7 +394,6 @@ msgstr "" "text` は要素のテキストコンテンツにアクセスします。 :meth:`Element.get` は要素" "の属性にアクセスします::" -#: ../../library/xml.etree.elementtree.rst:195 msgid "" ">>> for country in root.findall('country'):\n" "... rank = country.find('rank').text\n" @@ -352,6 +404,14 @@ msgid "" "Singapore 4\n" "Panama 68" msgstr "" +">>> for country in root.findall('country'):\n" +"... rank = country.find('rank').text\n" +"... name = country.get('name')\n" +"... print(name, rank)\n" +"...\n" +"Liechtenstein 1\n" +"Singapore 4\n" +"Panama 68" #: ../../library/xml.etree.elementtree.rst:204 msgid "" @@ -393,7 +453,6 @@ msgstr "" "例えば各 country の rank に 1 を足して、rank 要素に ``updated`` 属性を追加し" "たい場合::" -#: ../../library/xml.etree.elementtree.rst:221 msgid "" ">>> for rank in root.iter('rank'):\n" "... new_rank = int(rank.text) + 1\n" @@ -402,13 +461,18 @@ msgid "" "...\n" ">>> tree.write('output.xml')" msgstr "" +">>> for rank in root.iter('rank'):\n" +"... new_rank = int(rank.text) + 1\n" +"... rank.text = str(new_rank)\n" +"... rank.set('updated', 'yes')\n" +"...\n" +">>> tree.write('output.xml')" #: ../../library/xml.etree.elementtree.rst:228 #: ../../library/xml.etree.elementtree.rst:272 msgid "Our XML now looks like this:" msgstr "XML はこのようになります:" -#: ../../library/xml.etree.elementtree.rst:230 msgid "" "\n" "\n" @@ -434,6 +498,29 @@ msgid "" " \n" "" msgstr "" +"\n" +"\n" +" \n" +" 2\n" +" 2008\n" +" 141100\n" +" \n" +" \n" +" \n" +" \n" +" 5\n" +" 2011\n" +" 59900\n" +" \n" +" \n" +" \n" +" 69\n" +" 2011\n" +" 13600\n" +" \n" +" \n" +" \n" +"" #: ../../library/xml.etree.elementtree.rst:256 msgid "" @@ -443,7 +530,6 @@ msgstr "" ":meth:`Element.remove` を使って要素を削除することが出来ます。例えば rank が " "50 より大きい全ての country を削除したい場合::" -#: ../../library/xml.etree.elementtree.rst:259 msgid "" ">>> for country in root.findall('country'):\n" "... # using root.findall() to avoid removal during traversal\n" @@ -453,16 +539,25 @@ msgid "" "...\n" ">>> tree.write('output.xml')" msgstr "" +">>> for country in root.findall('country'):\n" +"... # 走査中の削除を避けるため root.findall() を使う\n" +"... rank = int(country.find('rank').text)\n" +"... if rank > 50:\n" +"... root.remove(country)\n" +"...\n" +">>> tree.write('output.xml')" -#: ../../library/xml.etree.elementtree.rst:267 msgid "" "Note that concurrent modification while iterating can lead to problems, just " "like when iterating and modifying Python lists or dicts. Therefore, the " "example first collects all matching elements with ``root.findall()``, and " "only then iterates over the list of matches." msgstr "" +"Python のリストや辞書と同様、イテレートしながら変更すると問題が起こることがあ" +"ります。\n" +"そのため、この例ではまず ``root.findall()`` で一致するすべての要素を集め、そ" +"の結果のリストをイテレートしています。" -#: ../../library/xml.etree.elementtree.rst:274 msgid "" "\n" "\n" @@ -481,6 +576,22 @@ msgid "" " \n" "" msgstr "" +"\n" +"\n" +" \n" +" 2\n" +" 2008\n" +" 141100\n" +" \n" +" \n" +" \n" +" \n" +" 5\n" +" 2011\n" +" 59900\n" +" \n" +" \n" +"" #: ../../library/xml.etree.elementtree.rst:294 msgid "Building XML documents" @@ -494,7 +605,6 @@ msgstr "" ":func:`SubElement` 関数は、与えられた要素に新しい子要素を作成する便利な手段も" "提供しています::" -#: ../../library/xml.etree.elementtree.rst:299 msgid "" ">>> a = ET.Element('a')\n" ">>> b = ET.SubElement(a, 'b')\n" @@ -503,6 +613,12 @@ msgid "" ">>> ET.dump(a)\n" "
    " msgstr "" +">>> a = ET.Element('a')\n" +">>> b = ET.SubElement(a, 'b')\n" +">>> c = ET.SubElement(a, 'c')\n" +">>> d = ET.SubElement(c, 'd')\n" +">>> ET.dump(a)\n" +"" #: ../../library/xml.etree.elementtree.rst:307 msgid "Parsing XML with Namespaces" @@ -532,7 +648,6 @@ msgstr "" "ひとつは接頭辞 \"fictional\" でもうひとつがデフォルト名前空間で提供された、 " "2 つの名前空間を組み込んだ XML の例をここにお見せします:" -#: ../../library/xml.etree.elementtree.rst:320 msgid "" "\n" "\n" "" msgstr "" +"\n" +"\n" +" \n" +" John Cleese\n" +" Lancelot\n" +" Archie Leach\n" +" \n" +" \n" +" Eric Idle\n" +" Sir Robin\n" +" Gunther\n" +" Commander Clement\n" +" \n" +"" #: ../../library/xml.etree.elementtree.rst:338 msgid "" @@ -561,7 +691,6 @@ msgstr "" "`~Element.find` や :meth:`~Element.findall` に渡す xpath で全てのタグや属性に" "手作業で URI を付けてまわる手があります::" -#: ../../library/xml.etree.elementtree.rst:342 msgid "" "root = fromstring(xml_text)\n" "for actor in root.findall('{http://people.example.com}actor'):\n" @@ -570,6 +699,12 @@ msgid "" " for char in actor.findall('{http://characters.example.com}character'):\n" " print(' |-->', char.text)" msgstr "" +"root = fromstring(xml_text)\n" +"for actor in root.findall('{http://people.example.com}actor'):\n" +" name = actor.find('{http://people.example.com}name')\n" +" print(name.text)\n" +" for char in actor.findall('{http://characters.example.com}character'):\n" +" print(' |-->', char.text)" #: ../../library/xml.etree.elementtree.rst:349 msgid "" @@ -578,7 +713,6 @@ msgid "" msgstr "" "もっと良い方法があります。接頭辞の辞書を作り、これを検索関数で使うことです::" -#: ../../library/xml.etree.elementtree.rst:352 msgid "" "ns = {'real_person': 'http://people.example.com',\n" " 'role': 'http://characters.example.com'}\n" @@ -589,12 +723,19 @@ msgid "" " for char in actor.findall('role:character', ns):\n" " print(' |-->', char.text)" msgstr "" +"ns = {'real_person': 'http://people.example.com',\n" +" 'role': 'http://characters.example.com'}\n" +"\n" +"for actor in root.findall('real_person:actor', ns):\n" +" name = actor.find('real_person:name', ns)\n" +" print(name.text)\n" +" for char in actor.findall('role:character', ns):\n" +" print(' |-->', char.text)" #: ../../library/xml.etree.elementtree.rst:361 msgid "These two approaches both output::" msgstr "どちらのアプローチでも同じ結果です::" -#: ../../library/xml.etree.elementtree.rst:363 msgid "" "John Cleese\n" " |--> Lancelot\n" @@ -604,6 +745,13 @@ msgid "" " |--> Gunther\n" " |--> Commander Clement" msgstr "" +"John Cleese\n" +" |--> Lancelot\n" +" |--> Archie Leach\n" +"Eric Idle\n" +" |--> Sir Robin\n" +" |--> Gunther\n" +" |--> Commander Clement" #: ../../library/xml.etree.elementtree.rst:375 msgid "XPath support" @@ -657,17 +805,19 @@ msgid "" "root.findall(\".//neighbor[2]\")" msgstr "" -#: ../../library/xml.etree.elementtree.rst:409 msgid "" "For XML with namespaces, use the usual qualified ``{namespace}tag`` " "notation::" msgstr "" +"名前空間を持つ XML では、通常の修飾された ``{namespace}tag`` 記法を使いま" +"す。 ::" -#: ../../library/xml.etree.elementtree.rst:411 msgid "" "# All dublin-core \"title\" tags in the document\n" "root.findall(\".//{http://purl.org/dc/elements/1.1/}title\")" msgstr "" +"# 文書内のすべての Dublin Core の \"title\" タグ\n" +"root.findall(\".//{http://purl.org/dc/elements/1.1/}title\")" #: ../../library/xml.etree.elementtree.rst:416 msgid "Supported XPath syntax" @@ -685,7 +835,6 @@ msgstr "意味" msgid "``tag``" msgstr "``tag``" -#: ../../library/xml.etree.elementtree.rst:423 msgid "" "Selects all child elements with the given tag. For example, ``spam`` selects " "all child elements named ``spam``, and ``spam/egg`` selects all " @@ -694,20 +843,27 @@ msgid "" "``spam`` in any (or no) namespace, and ``{}*`` only selects tags that are " "not in a namespace." msgstr "" +"指定されたタグを持つすべての子要素を選択します。\n" +"例えば ``spam`` は名前が ``spam`` のすべての子要素を選択し、``spam/egg`` は名" +"前が ``spam`` のすべての子要素に含まれる、名前が ``egg`` のすべての孫要素を選" +"択します。\n" +"``{namespace}*`` は指定された名前空間のすべてのタグを選択します。\n" +"``{*}spam`` は名前空間を問わず (名前空間がないものも含めて) 名前が ``spam`` " +"のタグを選択し、``{}*`` は名前空間に属さないタグだけを選択します。" -#: ../../library/xml.etree.elementtree.rst:432 msgid "Support for star-wildcards was added." -msgstr "" +msgstr "アスタリスクのワイルドカードをサポートしました。" #: ../../library/xml.etree.elementtree.rst:435 msgid "``*``" msgstr "``*``" -#: ../../library/xml.etree.elementtree.rst:435 msgid "" "Selects all child elements, including comments and processing instructions. " "For example, ``*/egg`` selects all grandchildren named ``egg``." msgstr "" +"コメントや処理命令を含む、すべての子要素を選択します。\n" +"例えば ``*/egg`` は名前が ``egg`` のすべての孫要素を選択します。" #: ../../library/xml.etree.elementtree.rst:439 msgid "``.``" @@ -767,13 +923,15 @@ msgstr "" #: ../../library/xml.etree.elementtree.rst:457 msgid "``[@attrib!='value']``" -msgstr "" +msgstr "``[@attrib!='value']``" #: ../../library/xml.etree.elementtree.rst:457 msgid "" "Selects all elements for which the given attribute does not have the given " "value. The value cannot contain quotes." msgstr "" +"与えられた属性が与えられた値を持たない全ての要素を選択します。\n" +"値に引用符は含められません。" #: ../../library/xml.etree.elementtree.rst:463 msgid "``[tag]``" @@ -791,23 +949,23 @@ msgstr "" msgid "``[.='text']``" msgstr "``[.='text']``" -#: ../../library/xml.etree.elementtree.rst:466 msgid "" "Selects all elements whose complete text content, including descendants, " "equals the given ``text``." msgstr "" -"子孫のうち、与えられた ``text`` とテキスト全体が等しい全ての要素を選択しま" -"す。" +"子孫のテキストも含めたテキスト全体が、指定された ``text`` と等しいすべての要" +"素を選択します。" #: ../../library/xml.etree.elementtree.rst:471 msgid "``[.!='text']``" -msgstr "" +msgstr "``[.!='text']``" -#: ../../library/xml.etree.elementtree.rst:471 msgid "" "Selects all elements whose complete text content, including descendants, " "does not equal the given ``text``." msgstr "" +"子孫のテキストも含めたテキスト全体が、指定された ``text`` と等しくないすべて" +"の要素を選択します。" #: ../../library/xml.etree.elementtree.rst:477 msgid "``[tag='text']``" @@ -823,13 +981,15 @@ msgstr "" #: ../../library/xml.etree.elementtree.rst:481 msgid "``[tag!='text']``" -msgstr "" +msgstr "``[tag!='text']``" #: ../../library/xml.etree.elementtree.rst:481 msgid "" "Selects all elements that have a child named ``tag`` whose complete text " "content, including descendants, does not equal the given ``text``." msgstr "" +"子孫を含む完全なテキストコンテンツと与えられた ``text`` が一致しない、 " +"``tag`` と名付けられた子要素を持つすべての要素を選択します。" #: ../../library/xml.etree.elementtree.rst:487 msgid "``[position]``" @@ -866,11 +1026,9 @@ msgstr "リファレンス" msgid "Functions" msgstr "関数" -#: ../../library/xml.etree.elementtree.rst:508 msgid "`C14N 2.0 `_ transformation function." -msgstr "" +msgstr "`C14N 2.0 `_ 変換を行う関数です。" -#: ../../library/xml.etree.elementtree.rst:510 msgid "" "Canonicalization is a way to normalise XML output in a way that allows byte-" "by-byte comparisons and digital signatures. It reduces the freedom that XML " @@ -878,8 +1036,11 @@ msgid "" "representation. The main restrictions regard the placement of namespace " "declarations, the ordering of attributes, and ignorable whitespace." msgstr "" +"正規化とは、バイト単位の比較やデジタル署名ができるように XML 出力を一定の形式" +"に揃える方法です。\n" +"XML のシリアライズ時の自由度を減らし、より制約の強い XML 表現を生成します。\n" +"主な制約は、名前空間宣言の配置、属性の順序、無視できる空白に関するものです。" -#: ../../library/xml.etree.elementtree.rst:516 msgid "" "This function takes an XML data string (*xml_data*) or a file path or file-" "like object (*from_file*) as input, converts it to the canonical form, and " @@ -887,12 +1048,18 @@ msgid "" "as a text string if not. The output file receives text, not bytes. It " "should therefore be opened in text mode with ``utf-8`` encoding." msgstr "" +"この関数は XML データの文字列 (*xml_data*)、またはファイルパスやファイル類似" +"オブジェクト (*from_file*) を入力として受け取り、正規化した形式に変換しま" +"す。\n" +"*out* にファイルオブジェクトまたはファイル類似オブジェクトが指定されていれば" +"そこに書き込み、指定されていなければテキスト文字列として返します。\n" +"出力先のファイルに書き込まれるのはバイト列ではなくテキストなので、エンコー" +"ディングを ``utf-8`` にしてテキストモードで開いてください。" #: ../../library/xml.etree.elementtree.rst:523 msgid "Typical uses::" -msgstr "" +msgstr "利用例::" -#: ../../library/xml.etree.elementtree.rst:525 msgid "" "xml_data = \"...\"\n" "print(canonicalize(xml_data))\n" @@ -903,58 +1070,60 @@ msgid "" "with open(\"c14n_output.xml\", mode='w', encoding='utf-8') as out_file:\n" " canonicalize(from_file=\"inputfile.xml\", out=out_file)" msgstr "" +"xml_data = \"...\"\n" +"print(canonicalize(xml_data))\n" +"\n" +"with open(\"c14n_output.xml\", mode='w', encoding='utf-8') as out_file:\n" +" canonicalize(xml_data, out=out_file)\n" +"\n" +"with open(\"c14n_output.xml\", mode='w', encoding='utf-8') as out_file:\n" +" canonicalize(from_file=\"inputfile.xml\", out=out_file)" -#: ../../library/xml.etree.elementtree.rst:534 msgid "The configuration *options* are as follows:" -msgstr "" +msgstr "設定用の *options* は次のとおりです。" -#: ../../library/xml.etree.elementtree.rst:536 msgid "*with_comments*: set to true to include comments (default: false)" -msgstr "" +msgstr "*with_comments*: 真にするとコメントを含めます (デフォルトは偽)。" -#: ../../library/xml.etree.elementtree.rst:537 msgid "" "*strip_text*: set to true to strip whitespace before and after text content" -msgstr "" +msgstr "*strip_text*: 真にするとテキストの前後の空白を除去します。" #: ../../library/xml.etree.elementtree.rst:538 #: ../../library/xml.etree.elementtree.rst:540 msgid "(default: false)" -msgstr "" +msgstr "(デフォルト: false)" -#: ../../library/xml.etree.elementtree.rst:539 msgid "" "*rewrite_prefixes*: set to true to replace namespace prefixes by " "\"n{number}\"" msgstr "" +"*rewrite_prefixes*: 真にすると名前空間の接頭辞を \"n{number}\" に置き換えま" +"す。" -#: ../../library/xml.etree.elementtree.rst:541 msgid "*qname_aware_tags*: a set of qname aware tag names in which prefixes" -msgstr "" +msgstr "*qname_aware_tags*: 修飾名を含むタグの名前の集合。" -#: ../../library/xml.etree.elementtree.rst:542 -#: ../../library/xml.etree.elementtree.rst:544 msgid "should be replaced in text content (default: empty)" -msgstr "" +msgstr "テキスト中の接頭辞を置き換えます (デフォルトは空)。" -#: ../../library/xml.etree.elementtree.rst:543 msgid "" "*qname_aware_attrs*: a set of qname aware attribute names in which prefixes" -msgstr "" +msgstr "*qname_aware_attrs*: 修飾名を含む属性の名前の集合。" -#: ../../library/xml.etree.elementtree.rst:545 msgid "*exclude_attrs*: a set of attribute names that should not be serialised" -msgstr "" +msgstr "*exclude_attrs*: シリアライズしない属性の名前の集合。" -#: ../../library/xml.etree.elementtree.rst:546 msgid "*exclude_tags*: a set of tag names that should not be serialised" -msgstr "" +msgstr "*exclude_tags*: シリアライズしないタグの名前の集合。" -#: ../../library/xml.etree.elementtree.rst:548 msgid "" "In the option list above, \"a set\" refers to any collection or iterable of " "strings, no ordering is expected." msgstr "" +"上のオプション一覧で「集合」とあるものには、文字列のコレクションやイテラブル" +"を使えます。\n" +"順序は問いません。" #: ../../library/xml.etree.elementtree.rst:556 msgid "" @@ -1005,6 +1174,7 @@ msgid "" "The :func:`dump` function now preserves the attribute order specified by the " "user." msgstr "" +":func:`dump` 関数はユーザーが指定した属性の順序を保持するようになりました。" #: ../../library/xml.etree.elementtree.rst:584 msgid "" @@ -1031,7 +1201,6 @@ msgstr "" "の :class:`XMLParser` パーザが使用されます。 :class:`Element` インスタンスを" "返します。" -#: ../../library/xml.etree.elementtree.rst:602 msgid "" "Appends whitespace to the subtree to indent the tree visually. This can be " "used to generate pretty-printed XML output. *tree* can be an Element or " @@ -1040,6 +1209,13 @@ msgid "" "partial subtrees inside of an already indented tree, pass the initial " "indentation level as *level*." msgstr "" +"部分木に空白を追加して、木をインデントで見やすくします。\n" +"XML を整形して出力するために使えます。\n" +"*tree* には Element または ElementTree を指定できます。\n" +"*space* はインデントの各レベルに挿入する空白文字列で、デフォルトはスペース 2 " +"個です。\n" +"すでにインデントされている木の一部分をインデントする場合は、最初のインデント" +"レベルを *level* に渡してください。" #: ../../library/xml.etree.elementtree.rst:614 msgid "" @@ -1106,9 +1282,8 @@ msgstr "*parser* 引数。" msgid "The ``comment`` and ``pi`` events were added." msgstr "イベント ``comment``, ``pi`` が追加されました。" -#: ../../library/xml.etree.elementtree.rst:657 msgid "Added the :meth:`!close` method." -msgstr "" +msgstr ":meth:`!close` メソッドを追加しました。" #: ../../library/xml.etree.elementtree.rst:663 msgid "" @@ -1176,7 +1351,6 @@ msgstr "" "*attrib* はオプションで要素の属性を含む辞書を指定します。 *extra* は追加の属" "性で、キーワード引数として与えます。要素インスタンスを返します。" -#: ../../library/xml.etree.elementtree.rst:709 msgid "" "Generates a string representation of an XML element, including all " "subelements. *element* is an :class:`Element` instance. *encoding* [1]_ is " @@ -1187,14 +1361,16 @@ msgid "" "*short_empty_elements* has the same meaning as in :meth:`ElementTree.write`. " "Returns an (optionally) encoded string containing the XML data." msgstr "" -"XML 要素を全ての子要素を含めて表現する文字列を生成します。 *element* は :" -"class:`Element` のインスタンスです。 *encoding* [1]_ は出力エンコーディング" -"(デフォルトは US-ASCII)です。Unicode 文字列を生成するには、" -"``encoding=\"unicode\"`` を使用してください。 *method* は ``\"xml\"``, " -"``\"html\"``, ``\"text\"`` のいずれか(デフォルトは ``\"xml\"``) です。 " +"XML 要素を全ての子要素を含めて表現する文字列を生成します。\n" +"*element* は :class:`Element` のインスタンスです。\n" +"*encoding* [1]_ は出力エンコーディング(デフォルトは US-ASCII)です。\n" +"Unicode 文字列を生成するには ``encoding=\"unicode\"`` を使用してください。\n" +"それ以外の場合はバイト列を生成します。\n" +"*method* は ``\"xml\"``, ``\"html\"``, ``\"text\"`` のいずれか(デフォルトは " +"``\"xml\"``) です。\n" "*xml_declaration*, *default_namespace*, *short_empty_elements* は、 :meth:" -"`ElementTree.write` での意味と同じ意味を持ちます。 XML データを含んだ (オプ" -"ションで) エンコードされた文字列を返します。" +"`ElementTree.write` での意味と同じ意味を持ちます。\n" +"XML データを含んだ (オプションで) エンコードされた文字列を返します。" #: ../../library/xml.etree.elementtree.rst:718 #: ../../library/xml.etree.elementtree.rst:745 @@ -1202,18 +1378,16 @@ msgstr "" msgid "Added the *short_empty_elements* parameter." msgstr "*short_empty_elements* 引数を追加しました。" -#: ../../library/xml.etree.elementtree.rst:721 -#: ../../library/xml.etree.elementtree.rst:748 msgid "Added the *xml_declaration* and *default_namespace* parameters." -msgstr "" +msgstr "*xml_declaration* 引数と *default_namespace* 引数を追加しました。" -#: ../../library/xml.etree.elementtree.rst:724 msgid "" "The :func:`tostring` function now preserves the attribute order specified by " "the user." msgstr "" +":func:`tostring` 関数はユーザーが指定した属性の順序を保持するようになりまし" +"た。" -#: ../../library/xml.etree.elementtree.rst:733 msgid "" "Generates a string representation of an XML element, including all " "subelements. *element* is an :class:`Element` instance. *encoding* [1]_ is " @@ -1226,16 +1400,19 @@ msgid "" "does not guarantee any specific sequence, except that ``b\"\"." "join(tostringlist(element)) == tostring(element)``." msgstr "" -"XML 要素を全ての子要素を含めて表現する文字列を生成します。 *element* は :" -"class:`Element` のインスタンスです。 *encoding* [1]_ は出力エンコーディング" -"(デフォルトは US-ASCII)です。Unicode 文字列を生成するには、" -"``encoding=\"unicode\"`` を使用してください。 *method* は ``\"xml\"``, " -"``\"html\"``, ``\"text\"`` のいずれか(デフォルトは ``\"xml\"``) です。 " -"xml_declaration*, *default_namespace*, *short_empty_elements* は、 :meth:" -"`ElementTree.write` での意味と同じ意味を持ちます。 XML データを含んだ (オプ" -"ションで) エンコードされた文字列のリストを返します。``b\"\"." -"join(tostringlist(element)) == tostring(element)`` となること以外、特定の順序" -"になる保証はありません。" +"XML 要素を全ての子要素を含めて表現する文字列を生成します。\n" +"*element* は :class:`Element` のインスタンスです。\n" +"*encoding* [1]_ は出力エンコーディング(デフォルトは US-ASCII)です。\n" +"Unicode 文字列を生成するには ``encoding=\"unicode\"`` を使用してください。\n" +"それ以外の場合はバイト列を生成します。\n" +"*method* は ``\"xml\"``, ``\"html\"``, ``\"text\"`` のいずれか(デフォルトは " +"``\"xml\"``) です。\n" +"*xml_declaration*, *default_namespace*, *short_empty_elements* は、 :meth:" +"`ElementTree.write` での意味と同じ意味を持ちます。\n" +"XML データを含んだ (オプションで) エンコードされた文字列のリストを返しま" +"す。\n" +"``b\"\".join(tostringlist(element)) == tostring(element)`` となること以外、特" +"定の順序になる保証はありません。" #: ../../library/xml.etree.elementtree.rst:751 msgid "" @@ -1276,36 +1453,48 @@ msgstr "" msgid "XInclude support" msgstr "XInclude サポート" -#: ../../library/xml.etree.elementtree.rst:778 msgid "" "This module provides limited support for `XInclude directives `_, via the :mod:`xml.etree.ElementInclude` helper " "module. This module can be used to insert subtrees and text strings into " "element trees, based on information in the tree." msgstr "" +"このモジュールは、補助モジュール :mod:`xml.etree.ElementInclude` を通じて " +"`XInclude ディレクティブ `_ を限定的にサポー" +"トします。\n" +"木の中の情報に基づいて、部分木やテキスト文字列を要素の木に挿入できます。" -#: ../../library/xml.etree.elementtree.rst:784 msgid "" "Here's an example that demonstrates use of the XInclude module. To include " "an XML document in the current document, use the ``{http://www.w3.org/2001/" "XInclude}include`` element and set the **parse** attribute to ``\"xml\"``, " "and use the **href** attribute to specify the document to include." msgstr "" +"次の例は XInclude モジュールの使い方を示します。\n" +"現在の文書に XML 文書を取り込むには、``{http://www.w3.org/2001/XInclude}" +"include`` 要素を使い、**parse** 属性を ``\"xml\"`` に設定し、**href** 属性で" +"取り込む文書を指定します。" -#: ../../library/xml.etree.elementtree.rst:786 msgid "" "\n" "\n" " \n" "" msgstr "" +"\n" +"\n" +" \n" +"" -#: ../../library/xml.etree.elementtree.rst:793 msgid "" "By default, the **href** attribute is treated as a file name. You can use " "custom loaders to override this behaviour. Also note that the standard " "helper does not support XPointer syntax." msgstr "" +"デフォルトでは **href** 属性をファイル名として扱います。\n" +"カスタムのローダを使えばこの動作を変更できます。\n" +"標準の補助モジュールは XPointer 構文をサポートしないことにも注意してくださ" +"い。" #: ../../library/xml.etree.elementtree.rst:795 msgid "" @@ -1313,7 +1502,6 @@ msgid "" "mod:`xml.etree.ElementTree` module:" msgstr "" -#: ../../library/xml.etree.elementtree.rst:797 msgid "" "from xml.etree import ElementTree, ElementInclude\n" "\n" @@ -1322,51 +1510,67 @@ msgid "" "\n" "ElementInclude.include(root)" msgstr "" +"from xml.etree import ElementTree, ElementInclude\n" +"\n" +"tree = ElementTree.parse(\"document.xml\")\n" +"root = tree.getroot()\n" +"\n" +"ElementInclude.include(root)" -#: ../../library/xml.etree.elementtree.rst:806 msgid "" "The ElementInclude module replaces the ``{http://www.w3.org/2001/XInclude}" "include`` element with the root element from the **source.xml** document. " "The result might look something like this:" msgstr "" +"ElementInclude モジュールは ``{http://www.w3.org/2001/XInclude}include`` 要素" +"を、**source.xml** 文書のルート要素で置き換えます。\n" +"結果は例えば次のようになります。" -#: ../../library/xml.etree.elementtree.rst:808 msgid "" "\n" " This is a paragraph.\n" "" msgstr "" +"\n" +" This is a paragraph.\n" +"" -#: ../../library/xml.etree.elementtree.rst:814 msgid "" "If the **parse** attribute is omitted, it defaults to \"xml\". The href " "attribute is required." msgstr "" +"**parse** 属性を省略すると、デフォルト値の \"xml\" を使います。\n" +"href 属性は必須です。" -#: ../../library/xml.etree.elementtree.rst:816 msgid "" "To include a text document, use the ``{http://www.w3.org/2001/XInclude}" "include`` element, and set the **parse** attribute to \"text\":" msgstr "" +"テキスト文書を取り込むには、``{http://www.w3.org/2001/XInclude}include`` 要素" +"を使い、**parse** 属性を \"text\" に設定します。" -#: ../../library/xml.etree.elementtree.rst:818 msgid "" "\n" "\n" " Copyright (c) .\n" "" msgstr "" +"\n" +"\n" +" Copyright (c) .\n" +"" -#: ../../library/xml.etree.elementtree.rst:825 msgid "The result might look something like:" -msgstr "" +msgstr "結果は例えば次のようになります。" -#: ../../library/xml.etree.elementtree.rst:827 msgid "" "\n" " Copyright (c) 2003.\n" "" msgstr "" +"\n" +" Copyright (c) 2003.\n" +"" #: ../../library/xml.etree.elementtree.rst:845 msgid "" @@ -1379,7 +1583,6 @@ msgid "" "``None`` or raise an exception." msgstr "" -#: ../../library/xml.etree.elementtree.rst:856 msgid "" "This function expands XInclude directives in-place in tree pointed by " "*elem*. *elem* is either the root :class:`~xml.etree.ElementTree.Element` or " @@ -1391,22 +1594,36 @@ msgid "" "the maximum number of recursive inclusions. Limited to reduce the risk of " "malicious content explosion. Pass ``None`` to disable the limitation." msgstr "" +"この関数は *elem* が指す木の XInclude ディレクティブを、その場で展開しま" +"す。\n" +"*elem* はルートの :class:`~xml.etree.ElementTree.Element`、またはそのルートを" +"取得するための :class:`~xml.etree.ElementTree.ElementTree` インスタンスで" +"す。\n" +"*loader* は省略可能なリソースローダです。\n" +"省略すると :func:`default_loader` を使います。\n" +"指定する場合は :func:`default_loader` と同じインターフェースを実装する呼び出" +"し可能オブジェクトでなければなりません。\n" +"*base_url* は元のファイルのベース URL で、取り込むファイルへの相対参照を解決" +"するために使います。\n" +"*max_depth* は再帰的な取り込みの最大深度です。\n" +"悪意のある内容によるデータの爆発的な増大のリスクを減らすために制限していま" +"す。\n" +"``None`` を渡すと制限を無効にします。" -#: ../../library/xml.etree.elementtree.rst:866 msgid "Added the *base_url* and *max_depth* parameters." -msgstr "" +msgstr "*base_url* 引数と *max_depth* 引数を追加しました。" #: ../../library/xml.etree.elementtree.rst:873 msgid "Element Objects" msgstr "Element オブジェクト" -#: ../../library/xml.etree.elementtree.rst:881 msgid "" "Element class. This class defines the Element interface, and provides a " "reference implementation of this interface." msgstr "" -"要素クラスです。この関数は Element インターフェースを定義すると同時に、そのリ" -"ファレンス実装を提供します。" +"要素クラスです。\n" +"このクラスは Element インターフェースを定義し、そのリファレンス実装を提供しま" +"す。" #: ../../library/xml.etree.elementtree.rst:884 msgid "" @@ -1444,9 +1661,8 @@ msgstr "" "し、 *tail* 属性は要素の終了タグと次のタグまでのテキストか、あるいは " "``None`` を保持します。このような XML データ" -#: ../../library/xml.etree.elementtree.rst:907 msgid "1234" -msgstr "" +msgstr "1234" #: ../../library/xml.etree.elementtree.rst:911 msgid "" @@ -1538,13 +1754,13 @@ msgstr "" "要素 *subelement* を、要素の子要素の内部リストの末尾に追加します。" "*subelement* :class:`Element` でない場合、:exc:`TypeError` を送出します。" -#: ../../library/xml.etree.elementtree.rst:974 msgid "" "Appends *subelements* from an iterable of elements. Raises :exc:`TypeError` " "if a subelement is not an :class:`Element`." msgstr "" +"イテラブル *subelements* に含まれる要素を末尾に追加します。\n" +"子要素が :class:`Element` でなければ :exc:`TypeError` を送出します。" -#: ../../library/xml.etree.elementtree.rst:982 msgid "" "Finds the first subelement matching *match*. *match* may be a tag name or " "a :ref:`path `. Returns an element instance or " @@ -1552,8 +1768,14 @@ msgid "" "name. Pass ``''`` as prefix to move all unprefixed tag names in the " "expression into the given namespace." msgstr "" +"*match* に一致する最初の子要素を探します。\n" +"*match* はタグ名または :ref:`パス ` です。\n" +"要素インスタンスまたは ``None`` を返します。\n" +"*namespaces* は省略可能なマッピングで、名前空間の接頭辞を完全な名前に対応付け" +"ます。\n" +"接頭辞として ``''`` を渡すと、式の中の接頭辞がないすべてのタグ名を、指定され" +"た名前空間に属するものとして扱います。" -#: ../../library/xml.etree.elementtree.rst:991 msgid "" "Finds all matching subelements, by tag name or :ref:`path `. Returns a list containing all matching elements in document " @@ -1561,8 +1783,14 @@ msgid "" "name. Pass ``''`` as prefix to move all unprefixed tag names in the " "expression into the given namespace." msgstr "" +"タグ名または :ref:`パス ` に一致するすべての子要素を探しま" +"す。\n" +"一致するすべての要素を文書内の順序で格納したリストを返します。\n" +"*namespaces* は省略可能なマッピングで、名前空間の接頭辞を完全な名前に対応付け" +"ます。\n" +"接頭辞として ``''`` を渡すと、式の中の接頭辞がないすべてのタグ名を、指定され" +"た名前空間に属するものとして扱います。" -#: ../../library/xml.etree.elementtree.rst:1000 msgid "" "Finds text for the first subelement matching *match*. *match* may be a tag " "name or a :ref:`path `. Returns the text content of the " @@ -1572,6 +1800,15 @@ msgid "" "Pass ``''`` as prefix to move all unprefixed tag names in the expression " "into the given namespace." msgstr "" +"*match* に一致する最初の子要素のテキストを探します。\n" +"*match* はタグ名または :ref:`パス ` です。\n" +"最初に一致した要素のテキスト内容を返します。\n" +"要素が見つからなければ *default* を返します。\n" +"一致した要素にテキストがなければ、空文字列を返すことに注意してください。\n" +"*namespaces* は省略可能なマッピングで、名前空間の接頭辞を完全な名前に対応付け" +"ます。\n" +"接頭辞として ``''`` を渡すと、式の中の接頭辞がないすべてのタグ名を、指定され" +"た名前空間に属するものとして扱います。" #: ../../library/xml.etree.elementtree.rst:1011 msgid "" @@ -1642,15 +1879,18 @@ msgstr "" "するためにサポートします: :meth:`~object.__delitem__`, :meth:`~object." "__getitem__`, :meth:`~object.__setitem__`, :meth:`~object.__len__`." -#: ../../library/xml.etree.elementtree.rst:1062 msgid "" "Caution: Elements with no subelements will test as ``False``. In a future " "release of Python, all elements will test as ``True`` regardless of whether " "subelements exist. Instead, prefer explicit ``len(elem)`` or ``elem is not " "None`` tests.::" msgstr "" +"注意: 子要素を持たない要素は真偽値の判定で ``False`` になります。\n" +"Python の将来のリリースでは、子要素の有無によらず、すべての要素が ``True`` に" +"なります。\n" +"代わりに ``len(elem)`` や ``elem is not None`` を明示的に使うことを推奨しま" +"す。 ::" -#: ../../library/xml.etree.elementtree.rst:1067 msgid "" "element = root.find('foo')\n" "\n" @@ -1660,12 +1900,17 @@ msgid "" "if element is None:\n" " print(\"element not found\")" msgstr "" +"element = root.find('foo')\n" +"\n" +"if not element: # 注意!\n" +" print(\"element not found, or element has no subelements\")\n" +"\n" +"if element is None:\n" +" print(\"element not found\")" -#: ../../library/xml.etree.elementtree.rst:1075 msgid "Testing the truth value of an Element emits :exc:`DeprecationWarning`." -msgstr "" +msgstr "Element の真偽値を判定すると :exc:`DeprecationWarning` を出します。" -#: ../../library/xml.etree.elementtree.rst:1078 msgid "" "Prior to Python 3.8, the serialisation order of the XML attributes of " "elements was artificially made predictable by sorting the attributes by " @@ -1673,8 +1918,11 @@ msgid "" "reordering was removed in Python 3.8 to preserve the order in which " "attributes were originally parsed or created by user code." msgstr "" +"Python 3.8 より前は、XML 要素の属性を名前順にソートしてからシリアライズするこ" +"とで、出力の順序を予測可能にしていました。\n" +"辞書の順序が保証されるようになったため、Python 3.8 ではこの並べ替えを廃止し、" +"元の解析時やユーザーのコードでの作成時の属性の順序を保持するようにしました。" -#: ../../library/xml.etree.elementtree.rst:1084 msgid "" "In general, user code should try not to depend on a specific ordering of " "attributes, given that the `XML Information Set `_ は属性の順序に意" +"味を持たせないことを明示しているため、一般にユーザーのコードは特定の属性の順" +"序に依存しないようにすべきです。\n" +"入力時には、どのような順序でも扱えるようにしてください。\n" +"暗号署名やテストデータなど、一定の XML 出力が必要な場合は、:func:" +"`canonicalize` 関数で正規化したシリアライズを行えます。" -#: ../../library/xml.etree.elementtree.rst:1092 msgid "" "In cases where canonical output is not applicable but a specific attribute " "order is still desirable on output, code should aim for creating the " @@ -1694,8 +1947,12 @@ msgid "" "like the following can be applied prior to serialisation to enforce an order " "independently from the Element creation::" msgstr "" +"正規化した出力は使えないものの、特定の属性の順序で出力したい場合は、望む順序" +"で属性を直接作成するようにしてください。\n" +"コードを読む人が想定する順序との食い違いを避けられます。\n" +"それが難しい場合は、シリアライズの前に次のような処理を行うと、Element を作成" +"したときとは独立に順序を指定できます。 ::" -#: ../../library/xml.etree.elementtree.rst:1099 msgid "" "def reorder_attributes(root):\n" " for el in root.iter():\n" @@ -1706,6 +1963,14 @@ msgid "" " attrib.clear()\n" " attrib.update(attribs)" msgstr "" +"def reorder_attributes(root):\n" +" for el in root.iter():\n" +" attrib = el.attrib\n" +" if len(attrib) > 1:\n" +" # ソートなどで属性の順序を調整する\n" +" attribs = sorted(attrib.items())\n" +" attrib.clear()\n" +" attrib.update(attribs)" #: ../../library/xml.etree.elementtree.rst:1112 msgid "ElementTree Objects" @@ -1780,7 +2045,6 @@ msgstr "" "インスタンスを指定します。パーザが指定されない場合、標準の :class:" "`XMLParser` パーザが使用されます。断片の根要素を返します。" -#: ../../library/xml.etree.elementtree.rst:1178 msgid "" "Writes the element tree to a file, as XML. *file* is a file name, or a :" "term:`file object` opened for writing. *encoding* [1]_ is the output " @@ -1795,7 +2059,7 @@ msgid "" "are emitted as a pair of start/end tags." msgstr "" "要素の木をファイルに XML として書き込みます。\n" -"*file* は、書き込み用に開かれたファイル名または :term:`ファイルオブジェクト " +"*file* は、ファイル名または書き込み用に開かれた :term:`ファイルオブジェクト " "` です。\n" "*encoding* [1]_ は出力エンコーディング(デフォルトは US-ASCII)です。\n" "*xml_declaration* は、 XML 宣言がファイルに書かれるかどうかを制御します。\n" @@ -1806,10 +2070,10 @@ msgstr "" "す。\n" "*method* は ``\"xml\"``, ``\"html\"``, ``\"text\"`` のいずれかです (デフォル" "トは ``\"xml\"`` です)。\n" -"キーワード専用の *short_empty_elements* 引数は、内容がない属性のフォーマット" +"キーワード専用の *short_empty_elements* 引数は、内容がない要素のフォーマット" "を制御します。\n" "``True`` (既定) の場合、単一の空要素タグとして書かれ、``False`` の場合、開始" -"タグと終了タグのペアとしてかかれます。" +"タグと終了タグのペアとして書かれます。" #: ../../library/xml.etree.elementtree.rst:1192 msgid "" @@ -1826,19 +2090,17 @@ msgstr "" "` の場合、型が衝突する場合があります。文字列をバイト列ファイルへ" "書き込んだり、その逆を行わないよう注意してください。" -#: ../../library/xml.etree.elementtree.rst:1202 msgid "" "The :meth:`write` method now preserves the attribute order specified by the " "user." msgstr "" ":meth:`write` メソッドはユーザーが指定した属性の順序を保持するようになりまし" -"た。 " +"た。" #: ../../library/xml.etree.elementtree.rst:1207 msgid "This is the XML file that is going to be manipulated::" msgstr "以下はこれから操作する XML ファイルです::" -#: ../../library/xml.etree.elementtree.rst:1209 msgid "" "\n" " \n" @@ -1850,6 +2112,15 @@ msgid "" " \n" "" msgstr "" +"\n" +" \n" +" Example page\n" +" \n" +" \n" +"

    Moved to example.org\n" +" or example.com.

    \n" +" \n" +"" #: ../../library/xml.etree.elementtree.rst:1219 msgid "" @@ -1857,7 +2128,6 @@ msgid "" "paragraph::" msgstr "第 1 段落のすべてのリンクの \"target\" 属性を変更する例::" -#: ../../library/xml.etree.elementtree.rst:1221 msgid "" ">>> from xml.etree.ElementTree import ElementTree\n" ">>> tree = ElementTree()\n" @@ -1874,6 +2144,20 @@ msgid "" "...\n" ">>> tree.write(\"output.xhtml\")" msgstr "" +">>> from xml.etree.ElementTree import ElementTree\n" +">>> tree = ElementTree()\n" +">>> tree.parse(\"index.xhtml\")\n" +"\n" +">>> p = tree.find(\"body/p\") # body 内の最初の p タグを探す\n" +">>> p\n" +"\n" +">>> links = list(p.iter(\"a\")) # すべてのリンクのリストを返す\n" +">>> links\n" +"[, ]\n" +">>> for i in links: # 見つかったすべてのリンクをイテレートする\n" +"... i.attrib[\"target\"] = \"blank\"\n" +"...\n" +">>> tree.write(\"output.xhtml\")" #: ../../library/xml.etree.elementtree.rst:1239 msgid "QName Objects" @@ -1913,14 +2197,15 @@ msgstr "" "器、または他の XML に似た形式の構文解析器を使って、要素構造を作り出すことがで" "きます。" -#: ../../library/xml.etree.elementtree.rst:1267 msgid "" "*element_factory*, when given, must be a callable accepting two positional " "arguments: a tag and a dict of attributes. It is expected to return a new " "element instance." msgstr "" +"*element_factory* を指定する場合は、タグと属性の辞書という 2 つの位置引数を受" +"け取る呼び出し可能オブジェクトでなければなりません。\n" +"新しい要素インスタンスを返す必要があります。" -#: ../../library/xml.etree.elementtree.rst:1271 msgid "" "The *comment_factory* and *pi_factory* functions, when given, should behave " "like the :func:`Comment` and :func:`ProcessingInstruction` functions to " @@ -1929,6 +2214,12 @@ msgid "" "comments/pis will be inserted into the tree if they appear within the root " "element (but not outside of it)." msgstr "" +"*comment_factory* 関数と *pi_factory* 関数を指定する場合は、コメントや処理命" +"令を作成する :func:`Comment` 関数や :func:`ProcessingInstruction` 関数と同じ" +"ように動作する必要があります。\n" +"指定しなければデフォルトのファクトリを使います。\n" +"*insert_comments* や *insert_pis* が真の場合は、ルート要素の内側にあるコメン" +"トや処理命令を木に挿入します (ルート要素の外側にあるものは挿入しません)。" #: ../../library/xml.etree.elementtree.rst:1280 msgid "" @@ -1961,17 +2252,19 @@ msgstr "" "新しい要素を開きます。 *tag* は要素の名前です。 *attrs* は要素の属性を保持し" "た辞書です。開かれた要素を返します。" -#: ../../library/xml.etree.elementtree.rst:1304 msgid "" "Creates a comment with the given *text*. If ``insert_comments`` is true, " "this will also add it to the tree." msgstr "" +"*text* を内容とするコメントを作成します。\n" +"``insert_comments`` が真なら、木にも追加します。" -#: ../../library/xml.etree.elementtree.rst:1312 msgid "" "Creates a process instruction with the given *target* name and *text*. If " "``insert_pis`` is true, this will also add it to the tree." msgstr "" +"*target* という名前と *text* を内容とする処理命令を作成します。\n" +"``insert_pis`` が真なら、木にも追加します。" #: ../../library/xml.etree.elementtree.rst:1318 msgid "" @@ -1981,30 +2274,35 @@ msgstr "" "加えて、カスタムの :class:`TreeBuilder` オブジェクトは以下のメソッドを提供で" "きます:" -#: ../../library/xml.etree.elementtree.rst:1323 msgid "" "Handles a doctype declaration. *name* is the doctype name. *pubid* is the " "public identifier. *system* is the system identifier. This method does not " "exist on the default :class:`TreeBuilder` class." msgstr "" -"doctype 宣言を処理します。 *name* は doctype 名です。 *pubid* は公式の識別子" -"です。 *system* はシステム識別子です。このメソッドはデフォルトの :class:" -"`TreeBuilder` クラスには存在しません。" +"文書型宣言を処理します。\n" +"*name* は文書型名です。\n" +"*pubid* は公開識別子、*system* はシステム識別子です。\n" +"デフォルトの :class:`TreeBuilder` クラスにはこのメソッドはありません。" -#: ../../library/xml.etree.elementtree.rst:1331 msgid "" "Is called whenever the parser encounters a new namespace declaration, before " "the ``start()`` callback for the opening element that defines it. *prefix* " "is ``''`` for the default namespace and the declared namespace prefix name " "otherwise. *uri* is the namespace URI." msgstr "" +"パーザが新しい名前空間宣言に遭遇するたびに、その名前空間を定義する要素の開始" +"を示す ``start()`` コールバックより前に呼び出されます。\n" +"*prefix* はデフォルトの名前空間では ``''``、それ以外では宣言された名前空間の" +"接頭辞です。\n" +"*uri* は名前空間 URI です。" -#: ../../library/xml.etree.elementtree.rst:1340 msgid "" "Is called after the ``end()`` callback of an element that declared a " "namespace prefix mapping, with the name of the *prefix* that went out of " "scope." msgstr "" +"名前空間の接頭辞の対応付けを宣言した要素の ``end()`` コールバックの後に、ス" +"コープを外れた *prefix* の名前を渡して呼び出されます。" #: ../../library/xml.etree.elementtree.rst:1352 msgid "" @@ -2036,11 +2334,12 @@ msgstr "" "*encoding* [1]_ が指定された場合、このあたいは XML ファイル内で指定されたエン" "コーディングを上書きします。" -#: ../../library/xml.etree.elementtree.rst:1376 msgid "" "Parameters are now :ref:`keyword-only `. The *html* " "argument is no longer supported." msgstr "" +"引数が :ref:`キーワード専用 ` になりました。\n" +"*html* 引数のサポートを終了しました。" #: ../../library/xml.etree.elementtree.rst:1383 msgid "" @@ -2056,8 +2355,6 @@ msgstr "" msgid "Feeds data to the parser. *data* is encoded data." msgstr "パーザへデータを入力します。 *data* はエンコードされたデータです。" -#: ../../library/xml.etree.elementtree.rst:1395 -#: ../../library/xml.etree.elementtree.rst:1473 msgid "" "Triggers parsing of any previously fed unparsed data, which can be used to " "ensure more immediate feedback, in particular with Expat >=2.6.0. The " @@ -2066,6 +2363,13 @@ msgid "" "deferral has security consequences; please see :meth:`xml.parsers.expat." "xmlparser.SetReparseDeferralEnabled` for details." msgstr "" +"すでに渡されている未解析のデータを解析します。\n" +"特に Expat 2.6.0 以降で、フィードバックをより早く得るために使えます。\n" +":meth:`flush` の実装は、Expat の再解析の延期が有効な場合にこれを一時的に無効" +"化し、再解析を開始します。\n" +"再解析の延期を無効にするとセキュリティに影響があります。\n" +"詳細は :meth:`xml.parsers.expat.xmlparser.SetReparseDeferralEnabled` を参照し" +"てください。" #: ../../library/xml.etree.elementtree.rst:1402 #: ../../library/xml.etree.elementtree.rst:1480 @@ -2075,7 +2379,6 @@ msgid "" "func:`hasattr` if used in code running across a variety of Python versions." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1410 msgid "" ":meth:`XMLParser.feed` calls *target*\\'s ``start(tag, attrs_dict)`` method " "for each opening tag, its ``end(tag)`` method for each closing tag, and data " @@ -2085,15 +2388,15 @@ msgid "" "building a tree structure. This is an example of counting the maximum depth " "of an XML file::" msgstr "" -":meth:`XMLParser.feed` は *target* の ``start(tag, attrs_dict)`` メソッドをそ" -"れぞれの開始タグに対して呼び、また ``end(tag)`` メソッドを終了タグに対して呼" -"び、そしてデータを ``data(data)`` メソッドで処理します。サポートされているそ" -"の他のコールバックメソッドについては、 :class:`TreeBuilder` クラスを参照して" -"ください。:meth:`XMLParser.close` は *target* の ``close()`` メソッドを呼びま" -"す。 :class:`XMLParser` は木構造を構築する以外にも使えます。以下の例では、" -"XML ファイルの最高の深さを数えます。" +":meth:`XMLParser.feed` は、開始タグごとに *target* の ``start(tag, " +"attrs_dict)`` メソッドを、終了タグごとに ``end(tag)`` メソッドを呼び出し、" +"データは ``data(data)`` メソッドで処理します。\n" +"サポートするその他のコールバックメソッドについては :class:`TreeBuilder` クラ" +"スを参照してください。\n" +":meth:`XMLParser.close` は *target* の ``close()`` メソッドを呼び出します。\n" +":class:`XMLParser` は木構造の構築以外にも使えます。\n" +"次の例では XML ファイルの最大の深さを数えます。 ::" -#: ../../library/xml.etree.elementtree.rst:1418 msgid "" ">>> from xml.etree.ElementTree import XMLParser\n" ">>> class MaxDepth: # The target object of the parser\n" @@ -2127,6 +2430,37 @@ msgid "" ">>> parser.close()\n" "4" msgstr "" +">>> from xml.etree.ElementTree import XMLParser\n" +">>> class MaxDepth: # パーザのターゲットオブジェクト\n" +"... maxDepth = 0\n" +"... depth = 0\n" +"... def start(self, tag, attrib): # 開始タグごとに呼び出される。\n" +"... self.depth += 1\n" +"... if self.depth > self.maxDepth:\n" +"... self.maxDepth = self.depth\n" +"... def end(self, tag): # 終了タグごとに呼び出される。\n" +"... self.depth -= 1\n" +"... def data(self, data):\n" +"... pass # データを処理する必要はない。\n" +"... def close(self): # すべてのデータを解析すると呼び出される。\n" +"... return self.maxDepth\n" +"...\n" +">>> target = MaxDepth()\n" +">>> parser = XMLParser(target=target)\n" +">>> exampleXml = \"\"\"\n" +"... \n" +"... \n" +"... \n" +"... \n" +"... \n" +"... \n" +"... \n" +"... \n" +"... \n" +"... \"\"\"\n" +">>> parser.feed(exampleXml)\n" +">>> parser.close()\n" +"4" #: ../../library/xml.etree.elementtree.rst:1454 msgid "XMLPullParser Objects" @@ -2156,19 +2490,18 @@ msgstr "" msgid "Feed the given bytes data to the parser." msgstr "指定したバイトデータをパーザに与えます。" -#: ../../library/xml.etree.elementtree.rst:1489 msgid "" "Signal the parser that the data stream is terminated. Unlike :meth:" "`XMLParser.close`, this method always returns :const:`None`. Any events not " "yet retrieved when the parser is closed can still be read with :meth:" "`read_events`." msgstr "" -"パーザに、データストリームが終了したことを伝えます。:meth:`XMLParser.close` " -"とは異なり、このメソッドは常に :const:`None` を返します。パーザがクローズした" -"時にまだ帰って来ていないイベントは、まだ :meth:`read_events` で読むことができ" -"ます。" +"パーザにデータストリームの終了を知らせます。\n" +":meth:`XMLParser.close` と異なり、このメソッドは常に :const:`None` を返しま" +"す。\n" +"パーザを閉じた時点でまだ取得していないイベントは、その後も :meth:" +"`read_events` で読み出せます。" -#: ../../library/xml.etree.elementtree.rst:1496 msgid "" "Return an iterator over the events which have been encountered in the data " "fed to the parser. The iterator yields ``(event, elem)`` pairs, where " @@ -2176,24 +2509,27 @@ msgid "" "*elem* is the encountered :class:`Element` object, or other context value as " "follows." msgstr "" +"パーザに渡されたデータ内で発生したイベントのイテレータを返します。\n" +"イテレータは ``(event, elem)`` のペアを yield します。\n" +"*event* はイベントの種類を表す文字列 (例えば ``\"end\"``) で、*elem* はイベン" +"トに対応する :class:`Element` オブジェクト、または以下のようなその他の状況を" +"表す値です。" -#: ../../library/xml.etree.elementtree.rst:1502 msgid "``start``, ``end``: the current Element." -msgstr "" +msgstr "``start``、``end``: 現在の Element。" -#: ../../library/xml.etree.elementtree.rst:1503 msgid "``comment``, ``pi``: the current comment / processing instruction" -msgstr "" +msgstr "``comment``、``pi``: 現在のコメントまたは処理命令。" -#: ../../library/xml.etree.elementtree.rst:1504 msgid "" "``start-ns``: a tuple ``(prefix, uri)`` naming the declared namespace " "mapping." msgstr "" +"``start-ns``: 宣言された名前空間の対応付けを表すタプル ``(prefix, uri)``。" -#: ../../library/xml.etree.elementtree.rst:1506 msgid "``end-ns``: :const:`None` (this may change in a future version)" msgstr "" +"``end-ns``: :const:`None` (将来のバージョンでは変わる可能性があります)。" #: ../../library/xml.etree.elementtree.rst:1508 msgid "" @@ -2208,7 +2544,6 @@ msgstr "" "消費されるため、:meth:`read_events` から取得されたイテレータに対して複数の読" "み出しを並行して反復的に行うと、予期せぬ結果が引き起こされます。" -#: ../../library/xml.etree.elementtree.rst:1516 msgid "" ":class:`XMLPullParser` only guarantees that it has seen the \">\" character " "of a starting tag when it emits a \"start\" event, so the attributes are " @@ -2216,10 +2551,11 @@ msgid "" "that point. The same applies to the element children; they may or may not " "be present." msgstr "" -":class:`XMLPullParser` は \"start\" イベントを発行した時に開始タグの文字 " -"\">\" が現れたことだけを保証します。そのため、属性は定義されますが、その時点" -"ではテキストの内容も tail 属性も定義されていません。子要素にもそれが存在す" -"る、しないにかかわらず同じ物が適用されます。" +":class:`XMLPullParser` が \"start\" イベントを発行した時点では、開始タグの " +"\">\" を読み取ったことだけが保証されます。\n" +"そのため属性は定義されていますが、text 属性と tail 属性の内容はまだ未定義で" +"す。\n" +"子要素も同様に、その時点では存在する場合と存在しない場合があります。" #: ../../library/xml.etree.elementtree.rst:1531 msgid "Exceptions" diff --git a/library/xml.po b/library/xml.po index fd2417457..3b9361f26 100644 --- a/library/xml.po +++ b/library/xml.po @@ -19,10 +19,10 @@ msgstr "" "Last-Translator: Takeshi Nakazato, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/xml.rst:4 @@ -196,9 +196,8 @@ msgstr "decompression bomb" msgid "**Vulnerable**" msgstr "**脆弱**" -#: ../../library/xml.rst:71 ../../library/xml.rst:123 msgid "large tokens" -msgstr "" +msgstr "大きなトークン" #: ../../library/xml.rst:71 msgid "**Vulnerable** (6)" @@ -305,26 +304,29 @@ msgstr "" "ローカルの場所から読み込みます。\n" "この機能には外部エンティティ展開の問題と同じことが予想されます。" -#: ../../library/xml.rst:117 msgid "" "Decompression bombs (aka `ZIP bomb`_) apply to all XML libraries that can " "parse compressed XML streams such as gzipped HTTP streams or LZMA-compressed " "files. For an attacker it can reduce the amount of transmitted data by three " "magnitudes or more." msgstr "" -"解凍爆弾 (あるいは `ZIP 爆弾 `_) " -"は、gzip 圧縮 HTTP ストリームや LZMA 圧縮ファイルなどの圧縮された XML スト" -"リームをパースできる全ての XML ライブラリに対し行われます。\n" -"攻撃者は送信データ量を1/3以下に減らすことができます。" +"解凍爆弾 (あるいは `ZIP 爆弾 `_) は、gzip 圧縮 HTTP ストリームや " +"LZMA 圧縮ファイルなどの圧縮された XML ストリームをパースできる全ての XML ライ" +"ブラリに対し行われます。\n" +"攻撃者は送信データ量を1,000 分の 1 以下に減らすことができます。" -#: ../../library/xml.rst:124 msgid "" "Expat needs to re-parse unfinished tokens; without the protection introduced " "in Expat 2.6.0, this can lead to quadratic runtime that can be used to cause " "denial of service in the application parsing XML. The issue is known as :cve:" "`2023-52425`." msgstr "" +"Expat は未完了のトークンを再解析する必要があります。\n" +"Expat 2.6.0 で導入された防御策がない場合、実行時間が入力サイズの二乗に比例し" +"て増大する可能性があり、\n" +"XML を解析するアプリケーションに対するサービス拒否攻撃に悪用されることがあり" +"ます。\n" +"この問題は :cve:`2023-52425` として知られています。" #: ../../library/xml.rst:129 msgid "" diff --git a/library/xml.sax.handler.po b/library/xml.sax.handler.po index 538582ece..bc7d4313b 100644 --- a/library/xml.sax.handler.po +++ b/library/xml.sax.handler.po @@ -17,10 +17,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/xml.sax.handler.rst:2 @@ -84,11 +84,12 @@ msgstr "" "ターフェースです。このオブジェクトのメソッドが、エラーをただちに例外に変換す" "るか、あるいは別の方法で処理するかの制御をしています。" -#: ../../library/xml.sax.handler.rst:53 msgid "" "Interface used by the parser to represent low frequency events which may not " "be of interest to many applications." msgstr "" +"多くのアプリケーションでは関心のない、発生頻度の低いイベントを通知するために" +"パーサが使うインターフェースです。" #: ../../library/xml.sax.handler.rst:56 msgid "" @@ -106,13 +107,12 @@ msgstr "値: ``\"http://xml.org/sax/features/namespaces\"``" msgid "true: Perform Namespace processing." msgstr "真: 名前空間を処理します。" -#: ../../library/xml.sax.handler.rst:65 msgid "" "false: Optionally do not perform Namespace processing (implies namespace-" "prefixes; default)." msgstr "" -"偽: オプションで名前空間を処理しません (暗黙に名前空間接頭辞も無効にします; " -"デフォルト)。" +"偽: 名前空間処理を行わないことを許可します (namespace-prefixes が有効であるこ" +"とを意味します; デフォルト)。" #: ../../library/xml.sax.handler.rst:66 ../../library/xml.sax.handler.rst:76 #: ../../library/xml.sax.handler.rst:85 ../../library/xml.sax.handler.rst:94 @@ -163,13 +163,12 @@ msgstr "" msgid "value: ``\"http://xml.org/sax/features/validation\"``" msgstr "値: ``\"http://xml.org/sax/features/validation\"``" -#: ../../library/xml.sax.handler.rst:92 msgid "" "true: Report all validation errors (implies external-general-entities and " "external-parameter-entities)." msgstr "" -"真: 全ての妥当性検査エラーを報告します (外部一般エンティティと外部変数エン" -"ティティが暗示されます)。" +"真: すべての妥当性検査エラーを報告します (external-general-entities と " +"external-parameter-entities が有効であることを意味します)。" #: ../../library/xml.sax.handler.rst:93 msgid "false: Do not report validation errors." @@ -191,19 +190,19 @@ msgstr "偽: 外部一般エンティティを取り込みません。" msgid "value: ``\"http://xml.org/sax/features/external-parameter-entities\"``" msgstr "値: ``\"http://xml.org/sax/features/external-parameter-entities\"``" -#: ../../library/xml.sax.handler.rst:109 msgid "" "true: Include all external parameter entities, including the external DTD " "subset." msgstr "" -"真: 外部 DTD サブセットを含む全ての外部変数エンティティを取り込みます。" +"真: 外部 DTD サブセットを含むすべての外部パラメータエンティティを取り込みま" +"す。" -#: ../../library/xml.sax.handler.rst:111 msgid "" "false: Do not include any external parameter entities, even the external DTD " "subset." msgstr "" -"偽: 外部 DTD サブセットであっても外部変数エンティティを取り込みません。" +"偽: 外部 DTD サブセットも含め、外部パラメータエンティティを一切取り込みませ" +"ん。" #: ../../library/xml.sax.handler.rst:117 msgid "List of all features." @@ -262,9 +261,8 @@ msgstr "" msgid "value: ``\"http://xml.org/sax/properties/xml-string\"``" msgstr "値: ``\"http://xml.org/sax/properties/xml-string\"``" -#: ../../library/xml.sax.handler.rst:150 msgid "data type: Bytes" -msgstr "" +msgstr "データ型: バイト列" #: ../../library/xml.sax.handler.rst:152 msgid "" @@ -379,7 +377,6 @@ msgstr "" "``feature_namespaces`` 機能が有効な場合 (デフォルト)、要素と属性名の接頭辞を" "自動的に置換します。" -#: ../../library/xml.sax.handler.rst:220 msgid "" "There are cases, however, when applications need to use prefixes in " "character data or in attribute values, where they cannot safely be expanded " @@ -387,11 +384,11 @@ msgid "" "events supply the information to the application to expand prefixes in those " "contexts itself, if necessary." msgstr "" -"しかしながら、接頭辞の自動展開を安全に行えないために、アプリケーションが文字" -"データや属性値の中で接頭辞を使わなければならない場合があります。\n" -"必要ならば :meth:`startPrefixMapping` や :meth:`endPrefixMapping` イベントは" -"アプリケーションにコンテキスト自身の中で接頭辞を展開するための情報を提供しま" -"す。" +"ただし、アプリケーションが文字データや属性値の中で接頭辞を使う場合、それらを" +"自動で安全に展開することはできません。\n" +":meth:`startPrefixMapping` イベントと :meth:`endPrefixMapping` イベントは、\n" +"アプリケーションが必要に応じてこうした箇所の接頭辞を自分で展開するための情報" +"を提供します。" #: ../../library/xml.sax.handler.rst:228 msgid "" @@ -634,21 +631,19 @@ msgstr "未パースのエンティティ宣言イベントの通知を扱いま msgid "EntityResolver Objects" msgstr "EntityResolver オブジェクト" -#: ../../library/xml.sax.handler.rst:380 msgid "" "Resolve the system identifier of an entity and return either the system " "identifier to read from as a string, or an InputSource to read from. The " "default implementation returns *systemId*." msgstr "" -"エンティティのシステム識別子を解決し、文字列として読み込んだシステム識別子あ" -"るいは InputSource オブジェクトのいずれかを返します。デフォルトの実装では " -"*systemId* を返します。" +"エンティティのシステム識別子を解決し、読み込み先のシステム識別子を文字列とし" +"て返すか、読み込み元の InputSource を返します。\n" +"デフォルトの実装では *systemId* を返します。" #: ../../library/xml.sax.handler.rst:388 msgid "ErrorHandler Objects" msgstr "ErrorHandler オブジェクト" -#: ../../library/xml.sax.handler.rst:390 msgid "" "Objects with this interface are used to receive error and warning " "information from the :class:`~xml.sax.xmlreader.XMLReader`. If you create " @@ -660,8 +655,16 @@ msgid "" "parameter. Errors and warnings may be converted to an exception by raising " "the passed-in exception object." msgstr "" +"このインターフェースを持つオブジェクトは、:class:`~xml.sax.xmlreader." +"XMLReader` からエラーと警告の情報を受け取るために使います。\n" +"このインターフェースを実装したオブジェクトを作成して :class:`~xml.sax." +"xmlreader.XMLReader` に登録すると、\n" +"パーサはそのメソッドを呼び出してすべての警告とエラーを報告します。\n" +"エラーには、警告、回復できる可能性のあるエラー、回復不能なエラーの 3 つのレベ" +"ルがあります。\n" +"どのメソッドも :exc:`~xml.sax.SAXParseException` だけを引数に取ります。\n" +"渡された例外オブジェクトを送出することで、エラーや警告を例外に変換できます。" -#: ../../library/xml.sax.handler.rst:403 msgid "" "Called when the parser encounters a recoverable error. If this method does " "not raise an exception, parsing may continue, but further document " @@ -669,10 +672,10 @@ msgid "" "to continue may allow additional errors to be discovered in the input " "document." msgstr "" -"パーサが回復可能なエラーに遭遇すると呼び出されます。このメソッドが例外を送出" -"しない場合パースは継続されますが、アプリケーションは更なるドキュメント情報を" -"期待すべきではありません。パーサの処理を継続を認めることで入力ドキュメント内" -"の他のエラーを見つけることができます。" +"パーサが回復可能なエラーに遭遇したときに呼び出されます。\n" +"このメソッドが例外を送出しなければ解析を続ける場合がありますが、アプリケー" +"ションはそれ以上の文書情報が得られると期待すべきではありません。\n" +"解析の継続を許すと、入力文書の他のエラーを発見できることがあります。" #: ../../library/xml.sax.handler.rst:411 msgid "" @@ -694,13 +697,11 @@ msgstr "" "ケーションに送り続けられます。このメソッドでの例外の送出はパースを終了しま" "す。" -#: ../../library/xml.sax.handler.rst:426 msgid "LexicalHandler Objects" -msgstr "" +msgstr "LexicalHandler オブジェクト" -#: ../../library/xml.sax.handler.rst:427 msgid "Optional SAX2 handler for lexical events." -msgstr "" +msgstr "字句イベント用の省略可能な SAX2 ハンドラです。" #: ../../library/xml.sax.handler.rst:429 msgid "" @@ -711,38 +712,37 @@ msgid "" "used in the same manner as content handlers." msgstr "" -#: ../../library/xml.sax.handler.rst:435 msgid "" "Set the LexicalHandler of an XMLReader by using the setProperty method with " "the property identifier ``'http://xml.org/sax/properties/lexical-handler'``." msgstr "" +"``XMLReader`` の ``LexicalHandler`` を設定するには、``setProperty()`` メソッ" +"ドにプロパティ識別子 ``'http://xml.org/sax/properties/lexical-handler'`` を指" +"定します。" -#: ../../library/xml.sax.handler.rst:442 msgid "" "Reports a comment anywhere in the document (including the DTD and outside " "the document element)." msgstr "" +"文書内のあらゆる場所にあるコメントを報告します (DTD 内や文書要素の外も含みま" +"す)。" -#: ../../library/xml.sax.handler.rst:447 msgid "" "Reports the start of the DTD declarations if the document has an associated " "DTD." -msgstr "" +msgstr "文書に DTD が関連付けられている場合、DTD 宣言の開始を報告します。" -#: ../../library/xml.sax.handler.rst:452 msgid "Reports the end of DTD declaration." -msgstr "" +msgstr "DTD 宣言の終了を報告します。" -#: ../../library/xml.sax.handler.rst:456 msgid "Reports the start of a CDATA marked section." -msgstr "" +msgstr "CDATA セクションの開始を報告します。" -#: ../../library/xml.sax.handler.rst:458 msgid "" "The contents of the CDATA marked section will be reported through the " "characters handler." msgstr "" +"CDATA セクションの内容は、``characters()`` ハンドラを通じて報告されます。" -#: ../../library/xml.sax.handler.rst:463 msgid "Reports the end of a CDATA marked section." -msgstr "" +msgstr "CDATA セクションの終了を報告します。" diff --git a/library/xml.sax.po b/library/xml.sax.po index bed1d5ae3..5176c2ef2 100644 --- a/library/xml.sax.po +++ b/library/xml.sax.po @@ -18,15 +18,14 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" -#: ../../library/xml.sax.rst:2 msgid ":mod:`!xml.sax` --- Support for SAX2 parsers" -msgstr ":mod:`!xml.sax` --- SAX2 バーサーのサポート" +msgstr ":mod:`!xml.sax` --- SAX2 パーサーのサポート" #: ../../library/xml.sax.rst:11 msgid "**Source code:** :source:`Lib/xml/sax/__init__.py`" @@ -53,7 +52,6 @@ msgstr "" "せん。信頼できないデータや認証されていないデータをパースする必要がある場合" "は :ref:`xml-vulnerabilities` を参照してください。" -#: ../../library/xml.sax.rst:29 msgid "" "The SAX parser no longer processes general external entities by default to " "increase security. Before, the parser created network connections to fetch " @@ -62,13 +60,14 @@ msgid "" "xmlreader.XMLReader.setFeature` on the parser object and argument :data:" "`~xml.sax.handler.feature_external_ges`." msgstr "" -"SAXパーサーは、セキュリティーを向上させるために、デフォルトで一般的な外部エン" -"ティティーを処理しなくなりました。以前は、パーサーは、DTDおよびエンティティ用" -"にファイルシステムからリモートファイルまたはロードされたローカルファイルを" -"フェッチするためのネットワーク接続を作成していました。この機能は parser オブ" -"ジェクトと(実) 引数 :data:`~xml.sax.handler.feature_external_ges` の :meth:" -"`~xml.sax.xmlreader.XMLReader.setFeature` メソッドで再度有効にすることができ" -"ます。" +"セキュリティを向上させるため、SAX パーサーはデフォルトでは外部一般エンティ" +"ティを処理しなくなりました。\n" +"以前は DTD やエンティティを処理するために、ネットワークに接続してリモートファ" +"イルを取得したり、ファイルシステムからローカルファイルを読み込んだりしていま" +"した。\n" +"この機能を再び有効にするには、パーサーオブジェクトの :meth:`~xml.sax." +"xmlreader.XMLReader.setFeature` メソッドに :data:`~xml.sax.handler." +"feature_external_ges` を引数として渡します。" #: ../../library/xml.sax.rst:36 msgid "The convenience functions are:" @@ -242,16 +241,17 @@ msgstr "" "ションや拡張モジュールにおいて同様の目的にこのクラスを利用することもできま" "す。" -#: ../../library/xml.sax.rst:136 msgid "" "Subclass of :exc:`SAXException` raised when a SAX :class:`~xml.sax.xmlreader." "XMLReader` is asked to enable a feature that is not supported, or to set a " "property to a value that the implementation does not support. SAX " "applications and extensions may use this class for similar purposes." msgstr "" -"SAX :class:`~xml.sax.xmlreader.XMLReader` が要求された機能をサポートしていな" -"いとき発生させる :exc:`SAXException` のサブクラスです。 SAX アプリケーション" -"や拡張モジュールにおいて同様の目的にこのクラスを利用することもできます。" +"SAX の :class:`~xml.sax.xmlreader.XMLReader` が、サポートしていない機能の有効" +"化や、\n" +"実装がサポートしない値へのプロパティの設定を要求されたときに送出する :exc:" +"`SAXException` のサブクラスです。\n" +"SAX アプリケーションや拡張でも、同様の目的にこのクラスを使えます。" #: ../../library/xml.sax.rst:145 msgid "`SAX: The Simple API for XML `_" diff --git a/library/xml.sax.reader.po b/library/xml.sax.reader.po index e724b348f..9a5aa23d1 100644 --- a/library/xml.sax.reader.po +++ b/library/xml.sax.reader.po @@ -19,10 +19,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/xml.sax.reader.rst:2 @@ -49,7 +49,6 @@ msgstr "" msgid "Base class which can be inherited by SAX parsers." msgstr "SAX パーサが継承可能な基底クラスです。" -#: ../../library/xml.sax.reader.rst:27 msgid "" "In some cases, it is desirable not to parse an input source at once, but to " "feed chunks of the document as they get available. Note that the reader will " @@ -58,31 +57,31 @@ msgid "" "interfaces should be used if the blocking behaviour of :meth:`parse` is not " "desirable." msgstr "" -"入力ソースを一度にパースするのではなく、ドキュメントのチャンクが利用可能にな" -"るごとに取得したいことがあります。SAX リーダは通常、ファイル全体を一気に読み" -"込まず、チャンク単位で処理するのですが、全体の処理が終わるまで :meth:`parse` " -"は返りません。そのため、 :meth:`parse` の排他的挙動を望まないときにこれらのイ" -"ンターフェースを使用してください。" +"入力ソースを一度にパースせず、文書のチャンクが利用可能になるたびにパーサに渡" +"したい場合があります。\n" +"リーダも通常はファイル全体を一度に読み込まず、チャンク単位で読み込みますが、:" +"meth:`parse` は文書全体の処理が終わるまで戻りません。\n" +"そのため、:meth:`parse` のブロックする動作が望ましくない場合は、これらのイン" +"ターフェースを使ってください。" -#: ../../library/xml.sax.reader.rst:33 msgid "" "When the parser is instantiated it is ready to begin accepting data from the " "feed method immediately. After parsing has been finished with a call to " "close the reset method must be called to make the parser ready to accept new " "data, either from feed or using the parse method." msgstr "" -"パーサのインスタンスが作成されるとすぐに、feed メソッドを通じてデータを受け入" -"れられるようになります。パースが完了して閉じるための呼び出しが行われた後、" -"パーサがフィードからまたはパースメソッドを使用して新しいデータを受け入れられ" -"るように、reset メソッドが呼び出される必要があります。" +"パーサのインスタンスを作成すると、すぐに ``feed()`` メソッドからデータを受け" +"入れられる状態になります。\n" +"``close()`` を呼び出してパースを終えた後、``feed()`` または ``parse()`` で新" +"しいデータを受け入れられるようにするには、``reset()`` メソッドを呼び出す必要" +"があります。" -#: ../../library/xml.sax.reader.rst:38 msgid "" "Note that these methods must *not* be called during parsing, that is, after " "parse has been called and before it returns." msgstr "" -"これらのメソッドをパース処理の途中で呼び出すことはできません。つまり、パース" -"が実行された後で、パーサから return する前に呼び出す必要があるのです。" +"これらのメソッドはパース処理中、つまり ``parse()`` を呼び出してから戻るまでの" +"間に呼び出しては *いけません*。" #: ../../library/xml.sax.reader.rst:41 msgid "" @@ -142,7 +141,6 @@ msgstr "" "リケーションから渡された :class:`InputSource` オブジェクトの変更を許可されて" "いませんが、コピーを作ってそれを変更することは可能です。" -#: ../../library/xml.sax.reader.rst:74 msgid "" "This is an implementation of the :class:`Attributes` interface (see section :" "ref:`attributes-objects`). This is a dictionary-like object which " @@ -152,14 +150,15 @@ msgid "" "instantiated by readers; *attrs* must be a dictionary-like object containing " "a mapping from attribute names to attribute values." msgstr "" -":class:`Attributes` インターフェース (:ref:`attributes-objects` 参照) の実装" -"です。これは辞書風のオブジェクトで、 :meth:`startElement` 内で要素の属性を表" -"示します。最も有用な辞書操作に加え、インターフェースに記述されているメソッド" -"を多数サポートしています。このクラスのオブジェクトはリーダによってインスタン" -"ス化されなければなりません。*attrs* は属性名と属性値の対応付けを含む辞書風オ" -"ブジェクトでなければなりません。" +":class:`Attributes` インターフェースの実装です (:ref:`attributes-objects` を" +"参照)。\n" +":meth:`startElement` の呼び出しで要素の属性を表す辞書風オブジェクトです。\n" +"よく使われる辞書操作に加え、インターフェースに記載されているさまざまなメソッ" +"ドをサポートします。\n" +"このクラスのオブジェクトはリーダがインスタンス化するものです。\n" +"*attrs* は属性名から属性値へのマッピングを含む辞書風オブジェクトでなければな" +"りません。" -#: ../../library/xml.sax.reader.rst:85 msgid "" "Namespace-aware variant of :class:`AttributesImpl`, which will be passed to :" "meth:`startElementNS`. It is derived from :class:`AttributesImpl`, but " @@ -169,11 +168,13 @@ msgid "" "`AttributesNS` interface (see section :ref:`attributes-ns-objects`)." msgstr "" ":class:`AttributesImpl` を名前空間認識型に改良したクラスで、 :meth:" -"`startElementNS` に渡されます。 :class:`AttributesImpl` の派生クラスですが、 " -"*namespaceURI* と *localname* の2要素のタプルを解釈します。さらに、元の文書に" -"出てくる修飾名を返す多くのメソッドを提供します。このクラスは :class:" -"`AttributesNS` インターフェース (:ref:`attributes-ns-objects` 参照) の実装で" -"す。" +"`startElementNS` に渡されます。\n" +":class:`AttributesImpl` の派生クラスですが、 *namespaceURI* と *localname* の" +"2要素のタプルを解釈します。\n" +"さらに、元の文書に出てくる修飾名を引数として受け取る多くのメソッドを提供しま" +"す。\n" +"このクラスは :class:`AttributesNS` インターフェース (:ref:`attributes-ns-" +"objects` 参照) の実装です。" #: ../../library/xml.sax.reader.rst:96 msgid "XMLReader Objects" @@ -183,7 +184,6 @@ msgstr "XMLReader オブジェクト" msgid "The :class:`XMLReader` interface supports the following methods:" msgstr ":class:`XMLReader` は次のメソッドをサポートします:" -#: ../../library/xml.sax.reader.rst:103 msgid "" "Process an input source, producing SAX events. The *source* object can be a " "system identifier (a string identifying the input source -- typically a file " @@ -192,12 +192,13 @@ msgid "" "returns, the input is completely processed, and the parser object can be " "discarded or reset." msgstr "" -"入力ソースを処理し、SAX イベントを作成します。 *source* オブジェクトはシステ" -"ム識別子 (入力ソースを特定する文字列 -- 一般にファイル名や URL)、 :class:" -"`pathlib.Path` オブジェクトか :term:`path-like ` オブジェク" -"トまたは :class:`InputSource` オブジェクトです。 :meth:`parse` が return した" -"とき、入力データの処理は完了し、パーサ・オブジェクトは破棄ないしリセットされ" -"ます。" +"入力ソースを処理して SAX イベントを生成します。\n" +"*source* オブジェクトには、システム識別子 (入力ソースを識別する文字列で、通常" +"はファイル名または URL)、:class:`pathlib.Path` または :term:`パス風 ` オブジェクト、:class:`InputSource` オブジェクトを指定できま" +"す。\n" +":meth:`parse` が戻ると入力の処理は完了しており、パーサオブジェクトを破棄また" +"はリセットできます。" #: ../../library/xml.sax.reader.rst:110 msgid "Added support of character streams." @@ -224,29 +225,29 @@ msgstr "" msgid "Return the current :class:`~xml.sax.handler.DTDHandler`." msgstr "現在の :class:`~xml.sax.handler.DTDHandler` を返します。" -#: ../../library/xml.sax.reader.rst:136 msgid "" "Set the current :class:`~xml.sax.handler.DTDHandler`. If no :class:`~xml." "sax.handler.DTDHandler` is set, DTD events will be discarded." msgstr "" -"現在の :class:`~xml.sax.handler.DTDHandler` を返します。 :class:`~xml.sax." -"handler.DTDHandler` が設定されていな場合、DTD イベントは破棄されます。" +"現在の :class:`~xml.sax.handler.DTDHandler` を設定します。\n" +":class:`~xml.sax.handler.DTDHandler` が設定されていない場合、DTD イベントは破" +"棄されます。" #: ../../library/xml.sax.reader.rst:143 msgid "Return the current :class:`~xml.sax.handler.EntityResolver`." msgstr "現在の :class:`~xml.sax.handler.EntityResolver` を返します。" -#: ../../library/xml.sax.reader.rst:148 msgid "" "Set the current :class:`~xml.sax.handler.EntityResolver`. If no :class:" "`~xml.sax.handler.EntityResolver` is set, attempts to resolve an external " "entity will result in opening the system identifier for the entity, and fail " "if it is not available." msgstr "" -"現在の :class:`~xml.sax.handler.EntityResolver` を返します。 :class:`~xml." -"sax.handler.EntityResolver` が設定されていない場合、外部エンティティの解決を" -"試行することでエンティティのシステム識別子が開かれます。利用できない場合は失" -"敗します。" +"現在の :class:`~xml.sax.handler.EntityResolver` を設定します。\n" +":class:`~xml.sax.handler.EntityResolver` が設定されていない場合、外部エンティ" +"ティの解決を試みると、\n" +"エンティティのシステム識別子が開かれます。\n" +"利用できない場合は失敗します。" #: ../../library/xml.sax.reader.rst:156 msgid "Return the current :class:`~xml.sax.handler.ErrorHandler`." @@ -294,8 +295,8 @@ msgid "" msgstr "" "機能名 *featurename* に値 *value* を設定します。その機能が認識できないとき" "は、 :exc:`SAXNotRecognizedException` を送出します。また、パーサが指定された" -"機能や設定をサポートしていないときは、 :exc:`SAXNotSupportedException` を送出" -"します。" +"機能や設定をサポートしていないときは、 ``SAXNotSupportedException`` を送出し" +"ます。" #: ../../library/xml.sax.reader.rst:190 msgid "" @@ -315,8 +316,8 @@ msgid "" msgstr "" "属性名 *propertyname* に値 *value* を設定します。その機能が認識できないとき" "は、 :exc:`SAXNotRecognizedException` を送出します。また、パーサが指定された" -"機能や設定をサポートしていないときは、 :exc:`SAXNotSupportedException` を送出" -"します。" +"機能や設定をサポートしていないときは、 ``SAXNotSupportedException`` を送出し" +"ます。" #: ../../library/xml.sax.reader.rst:205 msgid "IncrementalParser Objects" @@ -333,24 +334,24 @@ msgstr "" msgid "Process a chunk of *data*." msgstr "*data* のチャンクを処理します。" -#: ../../library/xml.sax.reader.rst:217 msgid "" "Assume the end of the document. That will check well-formedness conditions " "that can be checked only at the end, invoke handlers, and may clean up " "resources allocated during parsing." msgstr "" -"文書の終端を決定します。文書の適格性を調べ (終端でのみ可能)、ハンドラを起動" -"し、パース時に割り当てた資源を解放します。" +"文書が終わったものとして処理します。\n" +"終端でのみ確認できる整形式の条件を検査し、ハンドラを呼び出します。\n" +"また、パース中に割り当てたリソースを解放する場合があります。" -#: ../../library/xml.sax.reader.rst:224 msgid "" "This method is called after close has been called to reset the parser so " "that it is ready to parse new documents. The results of calling parse or " "feed after close without calling reset are undefined." msgstr "" -"このメソッドは close が呼び出された後、新しい文書をパースできるように、パーサ" -"をリセットするのに呼び出されます。close 後 reset を呼び出さずに parse や " -"feed を呼び出した場合の戻り値は未定義です。" +"``close()`` を呼び出した後、新しい文書をパースできるようにパーサをリセットす" +"るためのメソッドです。\n" +"``close()`` の後で ``reset()`` を呼ばずに ``parse()`` や ``feed()`` を呼び出" +"した場合の動作は未定義です。" #: ../../library/xml.sax.reader.rst:232 msgid "Locator Objects" @@ -424,14 +425,15 @@ msgstr "この InputSource の文字エンコーディングを取得します msgid "Set the byte stream (a :term:`binary file`) for this input source." msgstr "この入力ソースのバイトストリーム (:term:`binary file`) を設定します。" -#: ../../library/xml.sax.reader.rst:303 msgid "" "The SAX parser will ignore this if there is also a character stream " "specified, but it will use a byte stream in preference to opening a URI " "connection itself." msgstr "" -"文字ストリームも指定されている場合、SAX パーサはこのバイトストリームを無視し" -"ますが、URI 接続自体を開くときには優先してバイトストリームを使います。" +"文字ストリームも指定されている場合、SAX パーサーはこのバイトストリームを無視" +"します。\n" +"それ以外の場合は、自ら URI への接続を開くよりも、指定されたバイトストリームを" +"優先して使います。" #: ../../library/xml.sax.reader.rst:306 msgid "" diff --git a/library/xml.sax.utils.po b/library/xml.sax.utils.po index a657c7e29..6a31d51ae 100644 --- a/library/xml.sax.utils.po +++ b/library/xml.sax.utils.po @@ -17,10 +17,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/xml.sax.utils.rst:2 @@ -85,7 +85,6 @@ msgstr "" "値に置換されます。*entities* が与えられている場合でも、``'&'``, " "``'<'``, and ``'>'`` は常に元の文字に戻されます。" -#: ../../library/xml.sax.utils.rst:46 msgid "" "Similar to :func:`escape`, but also prepares *data* to be used as an " "attribute value. The return value is a quoted version of *data* with any " @@ -96,18 +95,20 @@ msgid "" "*data* will be wrapped in double-quotes. The resulting string can be used " "directly as an attribute value::" msgstr "" -":func:`escape` に似ていますが、 *data* は属性値の作成に使われます。戻り値は" -"クォート済みの *data* で、置換する文字の追加も可能です。 :func:`quoteattr` は" -"クォートすべき文字を *data* の文脈から判断し、クォートすべき文字を残さないよ" -"うに文字列をエンコードします。 *data* の中にシングル・クォート、ダブル・" -"クォートがあれば、両方ともエンコードし、全体をダブルクォートで囲みます。戻り" -"値の文字列はそのままで属性値として利用できます::" +":func:`escape` と似ていますが、*data* を属性値として使える形にします。\n" +"必要な置換を加え、引用符で囲んだ *data* を返します。\n" +":func:`quoteattr` は *data* の内容に応じて、文字列内の引用符をなるべくエン" +"コードしなくて済むように、外側を囲む引用符を選びます。\n" +"*data* にシングルクォートとダブルクォートの両方が含まれている場合は、ダブル" +"クォートをエンコードし、全体をダブルクォートで囲みます。\n" +"結果の文字列はそのまま属性値として使用できます。 ::" -#: ../../library/xml.sax.utils.rst:55 msgid "" ">>> print(\"\" % quoteattr(\"ab ' cd \\\" ef\"))\n" "" msgstr "" +">>> print(\"\" % quoteattr(\"ab ' cd \\\" ef\"))\n" +"" #: ../../library/xml.sax.utils.rst:58 msgid "" @@ -160,7 +161,6 @@ msgstr "" "工せず渡すだけです。しかし、サブクラスでメソッドをオーバーライドすると、イベ" "ント・ストリームやリクエストを加工してから渡すように変更可能です。" -#: ../../library/xml.sax.utils.rst:90 msgid "" "This function takes an input source and an optional base URL and returns a " "fully resolved :class:`~xml.sax.xmlreader.InputSource` object ready for " @@ -169,8 +169,9 @@ msgid "" "function to implement the polymorphic *source* argument to their :meth:`~xml." "sax.xmlreader.XMLReader.parse` method." msgstr "" -"この関数は引数に入力ソース、オプションとして URL を取り、読み取り可能な解決済" -"み :class:`~xml.sax.xmlreader.InputSource` オブジェクトを返します。入力ソース" -"は文字列、ファイル風オブジェクト、 :class:`~xml.sax.xmlreader.InputSource` の" -"いずれでも良く、この関数を使うことで、パーサは様々な *source* 引数を :meth:" -"`~xml.sax.xmlreader.XMLReader.parse` メソッドに実装することが可能になります。" +"入力ソースと省略可能なベース URL を受け取り、必要な解決をすべて行った読み取り" +"可能な :class:`~xml.sax.xmlreader.InputSource` オブジェクトを返します。\n" +"入力ソースには文字列、ファイル風オブジェクト、:class:`~xml.sax.xmlreader." +"InputSource` オブジェクトを指定できます。\n" +"パーサはこの関数を使い、:meth:`~xml.sax.xmlreader.XMLReader.parse` メソッド" +"の *source* 引数が複数の型を受け取れるように実装します。" diff --git a/library/xmlrpc.client.po b/library/xmlrpc.client.po index d8d2081ce..707e3e5bc 100644 --- a/library/xmlrpc.client.po +++ b/library/xmlrpc.client.po @@ -20,10 +20,10 @@ msgstr "" "Last-Translator: Arihiro TAKASE, 2025\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/xmlrpc.client.rst:2 @@ -66,9 +66,8 @@ msgstr "" "HTTPS URI の場合、 :mod:`xmlrpc.client` は必要な証明書検証とホスト名チェック" "を全てデフォルトで行います。" -#: ../../includes/wasm-notavail.rst:3 msgid "Availability" -msgstr "" +msgstr "利用可能な環境" #: ../../includes/wasm-notavail.rst:5 msgid "" @@ -78,7 +77,6 @@ msgstr "" "このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、:ref:" "`wasm-availability` を見てください。" -#: ../../library/xmlrpc.client.rst:41 msgid "" "A :class:`ServerProxy` instance is an object that manages communication with " "a remote XML-RPC server. The required first argument is a URI (Uniform " @@ -96,9 +94,8 @@ msgstr "" "ジュール内部の :class:`SafeTransport` インスタンスを使用し、それ以外の場合に" "はモジュール内部の :class:`Transport` インスタンスを使用します。オプションの " "3 番目の引数はエンコード方法で、デフォルトでは UTF-8 です。オプションの 4 番" -"目の引数はデバッグフラグです。 " +"目の引数はデバッグフラグです。" -#: ../../library/xmlrpc.client.rst:49 msgid "" "The following parameters govern the use of the returned proxy instance. If " "*allow_none* is true, the Python constant ``None`` will be translated into " @@ -119,6 +116,27 @@ msgid "" "flag is similar to *use_builtin_types* but it applies only to date/time " "values." msgstr "" +"以下の引数は、返されるプロキシインスタンスの動作を制御します。\n" +"*allow_none* が真の場合、Python の定数 ``None`` は XML に変換されます。\n" +"デフォルトでは ``None`` を渡すと :exc:`TypeError` が送出されます。\n" +"これは XML-RPC 仕様のよく使われる拡張ですが、すべてのクライアントやサーバーが" +"サポートしているわけではありません。\n" +"説明は `http://ontosys.com/xml-rpc/extensions.php `_ を参照してく" +"ださい。\n" +"*use_builtin_types* フラグを使うと、日時の値を :class:`datetime.datetime` オ" +"ブジェクト、バイナリデータを :class:`bytes` オブジェクトとして受け取れま" +"す。\n" +"このフラグのデフォルトは偽です。\n" +"呼び出しには :class:`datetime.datetime`、:class:`bytes`、:class:`bytearray` " +"オブジェクトを渡せます。\n" +"*headers* は各リクエストで送信する HTTP ヘッダーを指定する省略可能な引数で、" +"ヘッダー名と値を表す 2 要素のタプルのシーケンス (例えば ``[('Header-Name', " +"'value')]``) で指定します。\n" +"HTTPS URL を指定した場合、*context* に :class:`ssl.SSLContext` を指定して、内" +"部の HTTPS 接続の SSL 設定を構成できます。\n" +"旧式の *use_datetime* フラグは *use_builtin_types* と似ていますが、日時の値に" +"だけ適用されます。" #: ../../library/xmlrpc.client.rst:69 ../../library/xmlrpc.client.rst:549 msgid "The *use_builtin_types* flag was added." @@ -185,19 +203,21 @@ msgstr ":class:`bool`" msgid "``int``, ``i1``, ``i2``, ``i4``, ``i8`` or ``biginteger``" msgstr "``int``, ``i1``, ``i2``, ``i4``, ``i8`` または ``biginteger``" -#: ../../library/xmlrpc.client.rst:99 msgid "" ":class:`int` in range from -2147483648 to 2147483647. Values get the " "```` tag." msgstr "" +"-2147483648 から 2147483647 までの範囲の :class:`int`。\n" +"値には ```` タグが付けられます。" #: ../../library/xmlrpc.client.rst:104 msgid "``double`` or ``float``" msgstr "``double`` または ``float``" -#: ../../library/xmlrpc.client.rst:104 msgid ":class:`float`. Values get the ```` tag." msgstr "" +":class:`float`。\n" +"値には ```` タグが付けられます。" #: ../../library/xmlrpc.client.rst:107 msgid "``string``" @@ -223,15 +243,15 @@ msgstr "" msgid "``struct``" msgstr "``struct``" -#: ../../library/xmlrpc.client.rst:113 msgid "" ":class:`dict`. Keys must be strings, values may be any conformable type. " "Objects of user-defined classes can be passed in; only their :attr:`~object." "__dict__` attribute is transmitted." msgstr "" -":class:`dict` 。キーは文字列のみ。全ての値は変換可能でなくてはならない。ユー" -"ザー定義型を渡すこともできます。 :attr:`~object.__dict__` の属性のみ転送され" -"ます。" +":class:`dict`。\n" +"キーは文字列でなければならず、値には変換可能な任意の型を使用できます。\n" +"ユーザー定義クラスのインスタンスも渡せますが、転送されるのは :attr:`~object." +"__dict__` 属性だけです。" #: ../../library/xmlrpc.client.rst:118 msgid "``dateTime.iso8601``" @@ -270,11 +290,11 @@ msgstr "``None`` 定数。 *allow_none* が真の場合にのみ渡すことが msgid "``bigdecimal``" msgstr "``bigdecimal``" -#: ../../library/xmlrpc.client.rst:129 msgid ":class:`decimal.Decimal`. Returned type only." msgstr "" +":class:`decimal.Decimal`。\n" +"返される値としてのみ使われます。" -#: ../../library/xmlrpc.client.rst:132 msgid "" "This is the full set of data types supported by XML-RPC. Method calls may " "also raise a special :exc:`Fault` instance, used to signal XML-RPC server " @@ -283,12 +303,14 @@ msgid "" "base class called :exc:`Error`. Note that the xmlrpc client module " "currently does not marshal instances of subclasses of built-in types." msgstr "" -"上記のXML-RPCでサポートする全データ型を使用することができます。メソッド呼び出" -"し時、XML- RPCサーバエラーが発生すると :exc:`Fault` インスタンスを送出し、" -"HTTP/HTTPSトランスポート層でエラーが発生した場合には :exc:`ProtocolError` を" -"送出します。 :exc:`Error` をベースとする :exc:`Fault` と :exc:" -"`ProtocolError` の両方が発生します。現在のところxmlrpclibでは組み込み型のサブ" -"クラスのインスタンスをマーシャルすることはできません。" +"以上が XML-RPC でサポートされるデータ型のすべてです。\n" +"メソッド呼び出しでは、XML-RPC サーバーのエラーを表す :exc:`Fault` インスタン" +"スや、HTTP/HTTPS トランスポート層のエラーを表す :exc:`ProtocolError` が送出さ" +"れることもあります。\n" +":exc:`Fault` と :exc:`ProtocolError` は、どちらも :exc:`Error` という基底クラ" +"スから派生しています。\n" +"現在の xmlrpc クライアントモジュールは、組み込み型のサブクラスのインスタンス" +"をマーシャルできないことに注意してください。" #: ../../library/xmlrpc.client.rst:139 msgid "" @@ -320,7 +342,6 @@ msgstr "" msgid "Added the *context* argument." msgstr "*context* 引数が追加されました。" -#: ../../library/xmlrpc.client.rst:154 msgid "" "Added support of type tags with prefixes (e.g. ``ex:nil``). Added support of " "unmarshalling additional types used by Apache XML-RPC implementation for " @@ -328,6 +349,11 @@ msgid "" "``bigdecimal``. See https://ws.apache.org/xmlrpc/types.html for a " "description." msgstr "" +"接頭辞付きの型タグ (``ex:nil`` など) をサポートしました。\n" +"Apache の XML-RPC 実装が数値に使う追加の型 ``i1``、``i2``、``i8``、" +"``biginteger``、``float``、``bigdecimal`` のアンマーシャルをサポートしまし" +"た。\n" +"説明は https://ws.apache.org/xmlrpc/types.html を参照してください。" #: ../../library/xmlrpc.client.rst:164 msgid "`XML-RPC HOWTO `_" @@ -343,10 +369,10 @@ msgstr "" "アの素晴らしい説明が掲載されています。 XML- RPCクライアントの開発者が知ってお" "くべきことがほとんど全て記載されています。" -#: ../../library/xmlrpc.client.rst:168 msgid "" "`XML-RPC Introspection `_" msgstr "" +"`XML-RPC Introspection `_" #: ../../library/xmlrpc.client.rst:169 msgid "Describes the XML-RPC protocol extension for introspection." @@ -381,13 +407,12 @@ msgstr "" "バロードされます)。RPC実行後、変換された値を返すか、または :class:`Fault` オ" "ブジェクトもしくは :class:`ProtocolError` オブジェクトでエラーを通知します。" -#: ../../library/xmlrpc.client.rst:186 msgid "" "Servers that support the XML introspection API support some common methods " "grouped under the reserved :attr:`~ServerProxy.system` attribute:" msgstr "" -"予約属性 :attr:`~ServerProxy.system` から、XMLイントロスペクションAPIの一般的" -"なメソッドを利用する事ができます:" +"XML イントロスペクション API をサポートするサーバーは、予約された :attr:" +"`~ServerProxy.system` 属性の下にまとめられた共通のメソッドを提供します。" #: ../../library/xmlrpc.client.rst:192 msgid "" @@ -438,28 +463,29 @@ msgstr "" "メソッドにシグネチャが定義されていない場合、配列以外の値が返ります。 Pythonで" "は、この値はlist以外の値となります。" -#: ../../library/xmlrpc.client.rst:218 msgid "" "This method takes one parameter, the name of a method implemented by the XML-" "RPC server. It returns a documentation string describing the use of that " "method. If no such string is available, an empty string is returned. The " "documentation string may contain HTML markup." msgstr "" -"XML-RPCサーバで実装されているメソッドの名前を指定し、そのメソッドを解説する文" -"書文字列を取得します。文書文字列を取得できない場合は空文字列を返します。文書" -"文字列にはHTMLマークアップが含まれます。" +"XML-RPC サーバーが実装するメソッドの名前を引数として 1 つ受け取り、そのメソッ" +"ドの使い方を説明する文書文字列を返します。\n" +"そのような文字列がない場合は空文字列を返します。\n" +"文書文字列には HTML マークアップが含まれることがあります。" -#: ../../library/xmlrpc.client.rst:225 msgid "" "Instances of :class:`ServerProxy` support the :term:`context manager` " "protocol for closing the underlying transport." msgstr "" +":class:`ServerProxy` インスタンスは、内部のトランスポートを閉じるための :" +"term:`コンテキストマネージャー ` プロトコルをサポートしまし" +"た。" #: ../../library/xmlrpc.client.rst:229 ../../library/xmlrpc.client.rst:276 msgid "A working example follows. The server code::" msgstr "以下は、動作する例です。サーバ側のコード::" -#: ../../library/xmlrpc.client.rst:231 msgid "" "from xmlrpc.server import SimpleXMLRPCServer\n" "\n" @@ -471,13 +497,21 @@ msgid "" "server.register_function(is_even, \"is_even\")\n" "server.serve_forever()" msgstr "" +"from xmlrpc.server import SimpleXMLRPCServer\n" +"\n" +"def is_even(n):\n" +" return n % 2 == 0\n" +"\n" +"server = SimpleXMLRPCServer((\"localhost\", 8000))\n" +"print(\"Listening on port 8000...\")\n" +"server.register_function(is_even, \"is_even\")\n" +"server.serve_forever()" #: ../../library/xmlrpc.client.rst:241 ../../library/xmlrpc.client.rst:291 #: ../../library/xmlrpc.client.rst:401 ../../library/xmlrpc.client.rst:507 msgid "The client code for the preceding server::" msgstr "上記のサーバーに対するクライアントコード::" -#: ../../library/xmlrpc.client.rst:243 msgid "" "import xmlrpc.client\n" "\n" @@ -485,12 +519,16 @@ msgid "" " print(\"3 is even: %s\" % str(proxy.is_even(3)))\n" " print(\"100 is even: %s\" % str(proxy.is_even(100)))" msgstr "" +"import xmlrpc.client\n" +"\n" +"with xmlrpc.client.ServerProxy(\"http://localhost:8000/\") as proxy:\n" +" print(\"3 is even: %s\" % str(proxy.is_even(3)))\n" +" print(\"100 is even: %s\" % str(proxy.is_even(100)))" #: ../../library/xmlrpc.client.rst:252 msgid "DateTime Objects" msgstr "DateTime オブジェクト" -#: ../../library/xmlrpc.client.rst:256 msgid "" "This class may be initialized with seconds since the epoch, a time tuple, an " "ISO 8601 time/date string, or a :class:`datetime.datetime` instance. It has " @@ -498,9 +536,10 @@ msgid "" "unmarshalling code:" msgstr "" "このクラスは、エポックからの秒数、タプルで表現された時刻、ISO 8601形式の時間/" -"日付文字列、 :class:`datetime.datetime`, のインスタンスのいずれかで初期化する" -"ことができます。このクラスには以下のメソッドがあり、主にコードをマーシャル/ア" -"ンマーシャルするための内部処理を行います:" +"日付文字列、 :class:`datetime.datetime` のインスタンスのいずれかで初期化する" +"ことができます。\n" +"このクラスには以下のメソッドがあり、主にマーシャル/アンマーシャルを行うコード" +"から内部的に使用されます:" #: ../../library/xmlrpc.client.rst:264 msgid "Accept a string as the instance's new time value." @@ -514,11 +553,12 @@ msgstr "" "出力ストリームオブジェクト *out* に、XML-RPCエンコーディングの :class:" "`DateTime` 値を出力します。" -#: ../../library/xmlrpc.client.rst:272 msgid "" "It also supports certain of Python's built-in operators through :meth:`rich " "comparison ` and :meth:`~object.__repr__` methods." msgstr "" +":meth:`拡張比較 ` メソッドと :meth:`~object.__repr__` メソッド" +"を通じて、Python の組み込み演算子の一部もサポートしています。" #: ../../library/xmlrpc.client.rst:278 msgid "" @@ -604,11 +644,12 @@ msgstr "" "ある通り、76文字ごとに改行されます。これは、XMC-RPC仕様が作成された時のデ・" "ファクト・スタンダードのbase64です。" -#: ../../library/xmlrpc.client.rst:338 msgid "" "It also supports certain of Python's built-in operators through :meth:" "`~object.__eq__` and :meth:`~object.__ne__` methods." msgstr "" +":meth:`~object.__eq__` メソッドと :meth:`~object.__ne__` メソッドを通じて、" +"Python の組み込み演算子の一部もサポートしています。" #: ../../library/xmlrpc.client.rst:341 msgid "" @@ -616,7 +657,6 @@ msgid "" "XMLRPC::" msgstr "バイナリオブジェクトの使用例です。 XML-RPCごしに画像を転送します。 ::" -#: ../../library/xmlrpc.client.rst:344 msgid "" "from xmlrpc.server import SimpleXMLRPCServer\n" "import xmlrpc.client\n" @@ -631,12 +671,23 @@ msgid "" "\n" "server.serve_forever()" msgstr "" +"from xmlrpc.server import SimpleXMLRPCServer\n" +"import xmlrpc.client\n" +"\n" +"def python_logo():\n" +" with open(\"python_logo.jpg\", \"rb\") as handle:\n" +" return xmlrpc.client.Binary(handle.read())\n" +"\n" +"server = SimpleXMLRPCServer((\"localhost\", 8000))\n" +"print(\"Listening on port 8000...\")\n" +"server.register_function(python_logo, 'python_logo')\n" +"\n" +"server.serve_forever()" #: ../../library/xmlrpc.client.rst:357 msgid "The client gets the image and saves it to a file::" msgstr "クライアントは画像を取得して、ファイルに保存します。 ::" -#: ../../library/xmlrpc.client.rst:359 msgid "" "import xmlrpc.client\n" "\n" @@ -644,6 +695,11 @@ msgid "" "with open(\"fetched_python_logo.jpg\", \"wb\") as handle:\n" " handle.write(proxy.python_logo().data)" msgstr "" +"import xmlrpc.client\n" +"\n" +"proxy = xmlrpc.client.ServerProxy(\"http://localhost:8000/\")\n" +"with open(\"fetched_python_logo.jpg\", \"wb\") as handle:\n" +" handle.write(proxy.python_logo().data)" #: ../../library/xmlrpc.client.rst:368 msgid "Fault Objects" @@ -673,7 +729,6 @@ msgstr "" "以下のサンプルでは、複素数型のオブジェクトを返そうとして、故意に :exc:" "`Fault` を起こしています。 ::" -#: ../../library/xmlrpc.client.rst:388 msgid "" "from xmlrpc.server import SimpleXMLRPCServer\n" "\n" @@ -688,8 +743,18 @@ msgid "" "\n" "server.serve_forever()" msgstr "" +"from xmlrpc.server import SimpleXMLRPCServer\n" +"\n" +"# 複素数を返すため、マーシャル時にエラーが発生する\n" +"def add(x, y):\n" +" return x+y+0j\n" +"\n" +"server = SimpleXMLRPCServer((\"localhost\", 8000))\n" +"print(\"Listening on port 8000...\")\n" +"server.register_function(add, 'add')\n" +"\n" +"server.serve_forever()" -#: ../../library/xmlrpc.client.rst:403 msgid "" "import xmlrpc.client\n" "\n" @@ -701,6 +766,15 @@ msgid "" " print(\"Fault code: %d\" % err.faultCode)\n" " print(\"Fault string: %s\" % err.faultString)" msgstr "" +"import xmlrpc.client\n" +"\n" +"proxy = xmlrpc.client.ServerProxy(\"http://localhost:8000/\")\n" +"try:\n" +" proxy.add(2, 5)\n" +"except xmlrpc.client.Fault as err:\n" +" print(\"A fault occurred\")\n" +" print(\"Fault code: %d\" % err.faultCode)\n" +" print(\"Fault string: %s\" % err.faultString)" #: ../../library/xmlrpc.client.rst:418 msgid "ProtocolError Objects" @@ -728,11 +802,10 @@ msgstr "エラーコード。" msgid "The error message or diagnostic string." msgstr "エラーメッセージまたは診断文字列。" -#: ../../library/xmlrpc.client.rst:444 msgid "" "A dict containing the headers of the HTTP/HTTPS request that triggered the " "error." -msgstr "エラーの原因となったHTTP/HTTPSリクエストを含む辞書。" +msgstr "エラーの原因となった HTTP/HTTPS リクエストのヘッダーを含む辞書。" #: ../../library/xmlrpc.client.rst:447 msgid "" @@ -742,7 +815,6 @@ msgstr "" "次の例では、不適切な URI を利用して、故意に :exc:`ProtocolError` を発生させて" "います::" -#: ../../library/xmlrpc.client.rst:450 msgid "" "import xmlrpc.client\n" "\n" @@ -758,6 +830,19 @@ msgid "" " print(\"Error code: %d\" % err.errcode)\n" " print(\"Error message: %s\" % err.errmsg)" msgstr "" +"import xmlrpc.client\n" +"\n" +"# XMLRPC リクエストに応答しない URI で ServerProxy を作成する\n" +"proxy = xmlrpc.client.ServerProxy(\"http://google.com/\")\n" +"\n" +"try:\n" +" proxy.some_method()\n" +"except xmlrpc.client.ProtocolError as err:\n" +" print(\"A protocol error occurred\")\n" +" print(\"URL: %s\" % err.url)\n" +" print(\"HTTP/HTTPS headers: %s\" % err.headers)\n" +" print(\"Error code: %d\" % err.errcode)\n" +" print(\"Error message: %s\" % err.errmsg)" #: ../../library/xmlrpc.client.rst:465 msgid "MultiCall Objects" @@ -794,7 +879,6 @@ msgstr "" msgid "A usage example of this class follows. The server code::" msgstr "以下は、このクラスの使用例です。サーバ側のコード::" -#: ../../library/xmlrpc.client.rst:483 msgid "" "from xmlrpc.server import SimpleXMLRPCServer\n" "\n" @@ -820,8 +904,30 @@ msgid "" "server.register_function(divide, 'divide')\n" "server.serve_forever()" msgstr "" +"from xmlrpc.server import SimpleXMLRPCServer\n" +"\n" +"def add(x, y):\n" +" return x + y\n" +"\n" +"def subtract(x, y):\n" +" return x - y\n" +"\n" +"def multiply(x, y):\n" +" return x * y\n" +"\n" +"def divide(x, y):\n" +" return x // y\n" +"\n" +"# 簡単な算術関数を持つシンプルなサーバー\n" +"server = SimpleXMLRPCServer((\"localhost\", 8000))\n" +"print(\"Listening on port 8000...\")\n" +"server.register_multicall_functions()\n" +"server.register_function(add, 'add')\n" +"server.register_function(subtract, 'subtract')\n" +"server.register_function(multiply, 'multiply')\n" +"server.register_function(divide, 'divide')\n" +"server.serve_forever()" -#: ../../library/xmlrpc.client.rst:509 msgid "" "import xmlrpc.client\n" "\n" @@ -835,6 +941,17 @@ msgid "" "\n" "print(\"7+3=%d, 7-3=%d, 7*3=%d, 7//3=%d\" % tuple(result))" msgstr "" +"import xmlrpc.client\n" +"\n" +"proxy = xmlrpc.client.ServerProxy(\"http://localhost:8000/\")\n" +"multicall = xmlrpc.client.MultiCall(proxy)\n" +"multicall.add(7, 3)\n" +"multicall.subtract(7, 3)\n" +"multicall.multiply(7, 3)\n" +"multicall.divide(7, 3)\n" +"result = multicall()\n" +"\n" +"print(\"7+3=%d, 7-3=%d, 7*3=%d, 7//3=%d\" % tuple(result))" #: ../../library/xmlrpc.client.rst:523 msgid "Convenience Functions" @@ -890,7 +1007,6 @@ msgstr "" msgid "Example of Client Usage" msgstr "クライアントのサンプル" -#: ../../library/xmlrpc.client.rst:560 msgid "" "# simple test program (from the XML-RPC specification)\n" "from xmlrpc.client import ServerProxy, Error\n" @@ -905,6 +1021,18 @@ msgid "" " except Error as v:\n" " print(\"ERROR\", v)" msgstr "" +"# 簡単なテストプログラム (XML-RPC 仕様から引用)\n" +"from xmlrpc.client import ServerProxy, Error\n" +"\n" +"# server = ServerProxy(\"http://localhost:8000\") # ローカルサーバー\n" +"with ServerProxy(\"http://betty.userland.com\") as proxy:\n" +"\n" +" print(proxy)\n" +"\n" +" try:\n" +" print(proxy.examples.getStateName(41))\n" +" except Error as v:\n" +" print(\"ERROR\", v)" #: ../../library/xmlrpc.client.rst:573 msgid "" @@ -914,7 +1042,6 @@ msgstr "" "XML-RPC サーバに HTTP プロキシを経由して接続する場合、カスタムトランスポート" "を定義する必要があります。以下に例を示します::" -#: ../../library/xmlrpc.client.rst:576 msgid "" "import http.client\n" "import xmlrpc.client\n" @@ -937,6 +1064,26 @@ msgid "" "transport=transport)\n" "print(server.examples.getStateName(41))" msgstr "" +"import http.client\n" +"import xmlrpc.client\n" +"\n" +"class ProxiedTransport(xmlrpc.client.Transport):\n" +"\n" +" def set_proxy(self, host, port=None, headers=None):\n" +" self.proxy = host, port\n" +" self.proxy_headers = headers\n" +"\n" +" def make_connection(self, host):\n" +" connection = http.client.HTTPConnection(*self.proxy)\n" +" connection.set_tunnel(host, headers=self.proxy_headers)\n" +" self._connection = host, connection\n" +" return connection\n" +"\n" +"transport = ProxiedTransport()\n" +"transport.set_proxy('proxy-server', 8080)\n" +"server = xmlrpc.client.ServerProxy('http://betty.userland.com', " +"transport=transport)\n" +"print(server.examples.getStateName(41))" #: ../../library/xmlrpc.client.rst:598 msgid "Example of Client and Server Usage" diff --git a/library/xmlrpc.po b/library/xmlrpc.po index 1206a39b7..601395dc2 100644 --- a/library/xmlrpc.po +++ b/library/xmlrpc.po @@ -17,10 +17,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/xmlrpc.rst:2 diff --git a/library/xmlrpc.server.po b/library/xmlrpc.server.po index 9514d00a7..d7fa6a04a 100644 --- a/library/xmlrpc.server.po +++ b/library/xmlrpc.server.po @@ -19,10 +19,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/xmlrpc.server.rst:2 @@ -55,9 +55,8 @@ msgstr "" "ありません。信頼できないデータや認証されていないデータを解析する必要がある場" "合は、 :ref:`xml-vulnerabilities` を参照してください。" -#: ../../includes/wasm-notavail.rst:3 msgid "Availability" -msgstr "" +msgstr "利用可能な環境" #: ../../includes/wasm-notavail.rst:5 msgid "" @@ -67,7 +66,6 @@ msgstr "" "このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、:ref:" "`wasm-availability` を見てください。" -#: ../../library/xmlrpc.server.rst:32 msgid "" "Create a new server instance. This class provides methods for registration " "of functions that can be called by the XML-RPC protocol. The " @@ -101,7 +99,7 @@ msgstr "" "*bind_and_activate* 引数はコンストラクタが直ちに :meth:`server_bind` と :" "meth:`server_activate` を呼ぶかどうかを制御します。デフォルトでは真です。\n" "この引数に ``False`` を設定することで、アドレスを束縛する前に " -"*allow_reuse_address* クラス変数を操作することが出来ます。 \n" +"*allow_reuse_address* クラス変数を操作することが出来ます。\n" "*use_builtin_types* 引数は :func:`~xmlrpc.client.loads` 関数に渡されます。\n" "この引数は日付/時刻の値やバイナリデータを受け取ったときにどの型が処理されるか" "を制御します。デフォルトでは偽です。" @@ -201,8 +199,8 @@ msgstr "" "タスクを実行するのに下層の関数を呼び出す場合、その関数は ``func(*params)`` の" "ように引数リストを展開して呼び出されます。\n" ":meth:`_dispatch` の返り値は結果としてクライアントに返されます。\n" -"*instance* に :meth:`_dispatch` メソッドがない場合、リクエストされたメソッド" -"名にマッチする属性を検索します。" +"*instance* に ``_dispatch()`` メソッドがない場合、リクエストされたメソッド名" +"にマッチする属性を検索します。" #: ../../library/xmlrpc.server.rst:111 msgid "" @@ -264,7 +262,6 @@ msgstr "SimpleXMLRPCServer の例" msgid "Server code::" msgstr "サーバーのコード::" -#: ../../library/xmlrpc.server.rst:150 msgid "" "from xmlrpc.server import SimpleXMLRPCServer\n" "from xmlrpc.server import SimpleXMLRPCRequestHandler\n" @@ -298,6 +295,38 @@ msgid "" " # Run the server's main loop\n" " server.serve_forever()" msgstr "" +"from xmlrpc.server import SimpleXMLRPCServer\n" +"from xmlrpc.server import SimpleXMLRPCRequestHandler\n" +"\n" +"# 特定のパスに制限する\n" +"class RequestHandler(SimpleXMLRPCRequestHandler):\n" +" rpc_paths = ('/RPC2',)\n" +"\n" +"# サーバーを作成する\n" +"with SimpleXMLRPCServer(('localhost', 8000),\n" +" requestHandler=RequestHandler) as server:\n" +" server.register_introspection_functions()\n" +"\n" +" # pow() 関数を登録する。\n" +" # 名前には pow.__name__ の値、つまり 'pow' が使われる。\n" +" server.register_function(pow)\n" +"\n" +" # 別の名前で関数を登録する\n" +" def adder_function(x, y):\n" +" return x + y\n" +" server.register_function(adder_function, 'add')\n" +"\n" +" # インスタンスを登録する。\n" +" # そのすべてのメソッド (この場合は 'mul' だけ) が XML-RPC メソッドとして" +"公開される。\n" +" class MyFuncs:\n" +" def mul(self, x, y):\n" +" return x * y\n" +"\n" +" server.register_instance(MyFuncs())\n" +"\n" +" # サーバーのメインループを実行する\n" +" server.serve_forever()" #: ../../library/xmlrpc.server.rst:182 msgid "" @@ -307,7 +336,6 @@ msgstr "" "以下のクライアントコードは上のサーバーで使えるようになったメソッドを呼び出し" "ます::" -#: ../../library/xmlrpc.server.rst:185 msgid "" "import xmlrpc.client\n" "\n" @@ -319,16 +347,24 @@ msgid "" "# Print list of available methods\n" "print(s.system.listMethods())" msgstr "" +"import xmlrpc.client\n" +"\n" +"s = xmlrpc.client.ServerProxy('http://localhost:8000')\n" +"print(s.pow(2,3)) # 2**3 = 8 を返す\n" +"print(s.add(2,3)) # 5 を返す\n" +"print(s.mul(5,2)) # 5*2 = 10 を返す\n" +"\n" +"# 利用可能なメソッドの一覧を表示する\n" +"print(s.system.listMethods())" -#: ../../library/xmlrpc.server.rst:195 msgid "" ":meth:`register_function` can also be used as a decorator. The previous " "server example can register functions in a decorator way::" msgstr "" -":meth:`register_function` はデコレーターとしても使用できます。前のサーバーの" -"例は、デコレーターの方法で関数を登録することもできます。" +":meth:`register_function` はデコレーターとしても使えます。\n" +"先ほどのサーバーの例では、デコレーターを使って関数を登録することもできま" +"す。 ::" -#: ../../library/xmlrpc.server.rst:198 msgid "" "from xmlrpc.server import SimpleXMLRPCServer\n" "from xmlrpc.server import SimpleXMLRPCRequestHandler\n" @@ -358,6 +394,33 @@ msgid "" "\n" " server.serve_forever()" msgstr "" +"from xmlrpc.server import SimpleXMLRPCServer\n" +"from xmlrpc.server import SimpleXMLRPCRequestHandler\n" +"\n" +"class RequestHandler(SimpleXMLRPCRequestHandler):\n" +" rpc_paths = ('/RPC2',)\n" +"\n" +"with SimpleXMLRPCServer(('localhost', 8000),\n" +" requestHandler=RequestHandler) as server:\n" +" server.register_introspection_functions()\n" +"\n" +" # pow() 関数を登録する。\n" +" # 名前には pow.__name__ の値、つまり 'pow' が使われる。\n" +" server.register_function(pow)\n" +"\n" +" # register_function をデコレーターとして使い、別の名前で関数を登録す" +"る。\n" +" # *name* はキーワード引数としてのみ指定できる。\n" +" @server.register_function(name='add')\n" +" def adder_function(x, y):\n" +" return x + y\n" +"\n" +" # function.__name__ という名前で関数を登録する。\n" +" @server.register_function\n" +" def mul(x, y):\n" +" return x * y\n" +"\n" +" server.serve_forever()" #: ../../library/xmlrpc.server.rst:226 msgid "" @@ -408,9 +471,8 @@ msgid "This ExampleService demo can be invoked from the command line::" msgstr "" "この ExampleService デモはコマンドラインから起動することができます。 ::" -#: ../../library/xmlrpc.server.rst:262 msgid "python -m xmlrpc.server" -msgstr "" +msgstr "python -m xmlrpc.server" #: ../../library/xmlrpc.server.rst:265 msgid "" @@ -420,7 +482,6 @@ msgstr "" "上記のサーバとやりとりするクライアントは ``Lib/xmlrpc/client.py`` にありま" "す::" -#: ../../library/xmlrpc.server.rst:268 msgid "" "server = ServerProxy(\"http://localhost:8000\")\n" "\n" @@ -439,6 +500,22 @@ msgid "" "except Error as v:\n" " print(\"ERROR\", v)" msgstr "" +"server = ServerProxy(\"http://localhost:8000\")\n" +"\n" +"try:\n" +" print(server.currentTime.getCurrentTime())\n" +"except Error as v:\n" +" print(\"ERROR\", v)\n" +"\n" +"multi = MultiCall(server)\n" +"multi.getData()\n" +"multi.pow(2,9)\n" +"multi.add(1,2)\n" +"try:\n" +" for response in multi():\n" +" print(response)\n" +"except Error as v:\n" +" print(\"ERROR\", v)" #: ../../library/xmlrpc.server.rst:285 msgid "" @@ -446,9 +523,8 @@ msgid "" msgstr "" "デモ XMLRPC サーバとやりとりするクライアントは以下のように呼び出します::" -#: ../../library/xmlrpc.server.rst:287 msgid "python -m xmlrpc.client" -msgstr "" +msgstr "python -m xmlrpc.client" #: ../../library/xmlrpc.server.rst:291 msgid "CGIXMLRPCRequestHandler" @@ -462,7 +538,6 @@ msgstr "" ":class:`CGIXMLRPCRequestHandler` クラスは、Python の CGI スクリプトに送られ" "た XML-RPC リクエストを処理するときに使用できます。" -#: ../../library/xmlrpc.server.rst:314 msgid "" "Register an object which is used to expose method names which have not been " "registered using :meth:`register_function`. If instance contains a :meth:" @@ -482,10 +557,10 @@ msgstr "" "*instance* に :meth:`_dispatch` メソッドがあった場合、リクエストされたメソッ" "ド名と引数で :meth:`_dispatch` を呼び出します。\n" "返り値は結果としてクライアントに返されます。\n" -"*instance* に :meth:`_dispatch` メソッドがなかった場合、リクエストされたメ" -"ソッド名にマッチする属性を検索します。\n" -"リクエストされたメソッド名がピリオドを含む場合、モジュール名の各要素が個々に" -"検索され、簡単な階層的検索が実行されます。\n" +"*instance* に ``_dispatch()`` メソッドがなかった場合、リクエストされたメソッ" +"ド名にマッチする属性を検索します。\n" +"リクエストされたメソッド名がピリオドを含む場合、メソッド名の各要素が個々に検" +"索され、簡単な階層的検索が実行されます。\n" "その検索で発見された値をリクエストの引数で呼び出し、クライアントに返り値を返" "します。" @@ -515,7 +590,6 @@ msgstr "" msgid "Example::" msgstr "以下はプログラム例です::" -#: ../../library/xmlrpc.server.rst:344 msgid "" "class MyFuncs:\n" " def mul(self, x, y):\n" @@ -529,23 +603,32 @@ msgid "" "handler.register_instance(MyFuncs())\n" "handler.handle_request()" msgstr "" +"class MyFuncs:\n" +" def mul(self, x, y):\n" +" return x * y\n" +"\n" +"\n" +"handler = CGIXMLRPCRequestHandler()\n" +"handler.register_function(pow)\n" +"handler.register_function(lambda x,y: x+y, 'add')\n" +"handler.register_introspection_functions()\n" +"handler.register_instance(MyFuncs())\n" +"handler.handle_request()" #: ../../library/xmlrpc.server.rst:358 msgid "Documenting XMLRPC server" msgstr "XMLRPC サーバの文書化" -#: ../../library/xmlrpc.server.rst:360 msgid "" "These classes extend the above classes to serve HTML documentation in " "response to HTTP GET requests. Servers can either be free standing, using :" "class:`DocXMLRPCServer`, or embedded in a CGI environment, using :class:" "`DocCGIXMLRPCRequestHandler`." msgstr "" -"これらのクラスは HTTP GET 要求への応答内で HTML 文書となるよう上記クラスを拡" -"張します。\n" -"サーバは独立していても CGI 環境に埋め込まれていてもかまいません。\n" -"前者では :class:`DocXMLRPCServer` を、後者では :class:" -"`DocCGIXMLRPCRequestHandler` を使用します。" +"これらのクラスは上記のクラスを拡張し、HTTP GET リクエストに対して HTML ドキュ" +"メントを返します。\n" +":class:`DocXMLRPCServer` を使うと独立したサーバーを作成でき、:class:" +"`DocCGIXMLRPCRequestHandler` を使うと CGI 環境に組み込めます。" #: ../../library/xmlrpc.server.rst:370 msgid "" diff --git a/library/zipapp.po b/library/zipapp.po index e80d0a859..1672d27e6 100644 --- a/library/zipapp.po +++ b/library/zipapp.po @@ -19,10 +19,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/zipapp.rst:2 @@ -63,56 +63,54 @@ msgstr "" "示します。アーカイブは実行時にアーカイブ内の ``myapp`` モジュールから " "``main`` 関数を実行します。" -#: ../../library/zipapp.rst:30 msgid "" "$ python -m zipapp myapp -m \"myapp:main\"\n" "$ python myapp.pyz\n" "" msgstr "" +"$ python -m zipapp myapp -m \"myapp:main\"\n" +"$ python myapp.pyz\n" +"" #: ../../library/zipapp.rst:40 msgid "Command-Line Interface" msgstr "コマンドラインインターフェイス" -#: ../../library/zipapp.rst:42 msgid "" "When called as a program from the command line, the following form is used:" msgstr "" -"コマンドラインからプログラムとして呼び出す場合は、次の形式を使用います:" +"コマンドラインからプログラムとして呼び出す場合は、次の形式を使用します。" -#: ../../library/zipapp.rst:44 msgid "$ python -m zipapp source [options]" -msgstr "" +msgstr "$ python -m zipapp source [options]" -#: ../../library/zipapp.rst:48 msgid "" "If *source* is a directory, this will create an archive from the contents of " "*source*. If *source* is a file, it should be an archive, and it will be " "copied to the target archive (or the contents of its shebang line will be " "displayed if the --info option is specified)." msgstr "" -"*source* がディレクトリである場合、 *source* ディレクトリの内容からアーカイブ" -"を作成します。\n" -"*source* がファイルである場合、 *source* ファイル自身をアーカイブ化し、保存先" -"アーカイブへコピーします。(または --info オプションが指定されている場合はファ" -"イルのシェバン行が表示されます。)" +"*source* がディレクトリの場合、その内容からアーカイブを作成します。\n" +"*source* がファイルの場合は既存のアーカイブでなければならず、出力先のアーカイ" +"ブへコピーされます (``--info`` オプションが指定されている場合は、代わりにシェ" +"バン行の内容が表示されます)。" #: ../../library/zipapp.rst:53 msgid "The following options are understood:" msgstr "以下のオプションが解釈されます:" -#: ../../library/zipapp.rst:59 msgid "" "Write the output to a file named *output*. If this option is not specified, " "the output filename will be the same as the input *source*, with the " "extension ``.pyz`` added. If an explicit filename is given, it is used as " "is (so a ``.pyz`` extension should be included if required)." msgstr "" -"出力を *output* に指定した名前のファイルへ書込みます。このオプションが指定さ" -"れていない場合、出力先ファイル名は入力元 *source* と同じになり、 ``.pyz`` 拡" -"張子が付与されます。\n" -"ファイル名が明示的に指定されている場合は、指定されたファイル名を使用します。" -"(必要であれば ``.pyz`` 拡張子が含まれます。)" +"出力を *output* に指定した名前のファイルへ書込みます。\n" +"このオプションが指定されていない場合、出力先ファイル名は入力元 *source* と同" +"じになり、 ``.pyz`` 拡張子が付与されます。\n" +"ファイル名が明示的に指定されている場合は、指定されたファイル名をそのまま使い" +"ます。\n" +"必要であれば ``.pyz`` 拡張子を含めてください。" #: ../../library/zipapp.rst:64 msgid "" @@ -134,29 +132,28 @@ msgstr "" "また、POSIX では書庫を実行可能にします。\n" "デフォルトでは ``#!`` 行を書かず、ファイルを実行可能にはしません。" -#: ../../library/zipapp.rst:75 msgid "" "Write a ``__main__.py`` file to the archive that executes *mainfn*. The " "*mainfn* argument should have the form \"pkg.mod:fn\", where \"pkg.mod\" is " "a package/module in the archive, and \"fn\" is a callable in the given " "module. The ``__main__.py`` file will execute that callable." msgstr "" -"*mainfn* を実行するアーカイブへ ``__main__.py`` ファイルを書込んでくださ" -"い。\n" +"*mainfn* を実行する ``__main__.py`` ファイルをアーカイブに書き込みます。\n" "*mainfn* 引数は \"pkg.mod:fn\" の形式で指定します。\n" -"\"pkg.mod\" の場所はアーカイブ内の package/module です。\n" -"\"fn\" は指定した module から呼出すことのできる関数です。\n" -"``__main__.py`` ファイルが module から呼出すことのできる関数を実行します。" +"\"pkg.mod\" はアーカイブ内のパッケージまたはモジュールで、\"fn\" はそのモ" +"ジュール内の呼び出し可能オブジェクトです。\n" +"``__main__.py`` ファイルはそのオブジェクトを呼び出します。" #: ../../library/zipapp.rst:80 msgid ":option:`--main` cannot be specified when copying an archive." msgstr "書庫をコピーする際、 :option:`--main` を指定することは出来ません。" -#: ../../library/zipapp.rst:84 msgid "" "Compress files with the deflate method, reducing the size of the output " "file. By default, files are stored uncompressed in the archive." msgstr "" +"ファイルを deflate 方式で圧縮し、出力ファイルのサイズを小さくします。\n" +"デフォルトではファイルは圧縮せずにアーカイブに格納されます。" #: ../../library/zipapp.rst:87 msgid ":option:`--compress` has no effect when copying an archive." @@ -192,38 +189,35 @@ msgstr "" "*source* からアプリケーション書庫を作成します。\n" "ソースは以下のいずれかです:" -#: ../../library/zipapp.rst:115 msgid "" "The name of a directory, or a :term:`path-like object` referring to a " "directory, in which case a new application archive will be created from the " "content of that directory." msgstr "" -"ディレクトリ名、または\n" -"新しいアプリケーションアーカイブがディレクトリのコンテンツから作成される場合" -"に\n" -":term:`path-like object` オブジェクトが参照するディレクトリ。" +"ディレクトリ名、またはディレクトリを指す :term:`path-like object`。\n" +"この場合、そのディレクトリの内容から新しいアプリケーションアーカイブを作成し" +"ます。" -#: ../../library/zipapp.rst:118 msgid "" "The name of an existing application archive file, or a :term:`path-like " "object` referring to such a file, in which case the file is copied to the " "target (modifying it to reflect the value given for the *interpreter* " "argument). The file name should include the ``.pyz`` extension, if required." msgstr "" -"既存のアプリケーションアーカイブファイルの名前、\n" -"または(*interpreter* 引数に指定した値を反映し、修正する)アーカイブへ\n" -"ファイルがコピーされる場合に :term:`path-like object` オブジェクトが参照する" -"ファイル。" +"既存のアプリケーションアーカイブのファイル名、またはそのファイルを指す :term:" +"`path-like object`。\n" +"この場合、*interpreter* 引数の値を反映するよう変更して、ファイルを出力先へコ" +"ピーします。\n" +"必要に応じて、ファイル名には ``.pyz`` 拡張子を含めてください。" -#: ../../library/zipapp.rst:122 msgid "" "A file object open for reading in bytes mode. The content of the file " "should be an application archive, and the file object is assumed to be " "positioned at the start of the archive." msgstr "" -"バイトモードの読込みで開くファイルオブジェクト。\n" -"ファイルの内容がアプリケーションアーカイブとなり、\n" -"ファイルオブジェクトがアーカイブの起点となります。" +"バイナリモードで読み込み用に開かれたファイルオブジェクト。\n" +"ファイルの内容はアプリケーションアーカイブでなければならず、ファイル位置は" +"アーカイブの先頭にあるものとします。" #: ../../library/zipapp.rst:126 msgid "" @@ -238,13 +232,12 @@ msgstr "" "ファイル名、または :term:`path-like object` オブジェクトを指定した場合、アー" "カイブは指定したファイルへ書き込まれます。" -#: ../../library/zipapp.rst:131 msgid "" "If it is an open file object, the archive will be written to that file " "object, which must be open for writing in bytes mode." msgstr "" "開いているファイルオブジェクトを指定した場合、\n" -"アーカイブはそのファイルオブジェクトへ書込みを行ないます。 \n" +"アーカイブはそのファイルオブジェクトへ書込みを行ないます。\n" "ファイルオブジェクトは必ずバイトモードの書込みで開いてください。" #: ../../library/zipapp.rst:133 @@ -257,7 +250,6 @@ msgstr "" "ればならず、target は source のファイル名に ``.pyz`` 拡張子を付与したファイル" "名となります。" -#: ../../library/zipapp.rst:137 msgid "" "The *interpreter* argument specifies the name of the Python interpreter with " "which the archive will be executed. It is written as a \"shebang\" line at " @@ -272,11 +264,10 @@ msgstr "" "インタープリタ名は \"シェバン\" 行としてアーカイブの起点に書込まれます。\n" "POSIX では OS によってシェバンが解釈され、\n" "Windows では Python ランチャーによって扱われます。\n" -"シェバン行が書込まれていない場合は *interpreter* の結果を無視します。\n" +"*interpreter* を省略すると、シェバン行は書き込まれません。\n" "interpreter が指定されており、 target がファイル名である場合、\n" "target ファイルの実行可能ビットが設定されます。" -#: ../../library/zipapp.rst:145 msgid "" "The *main* argument specifies the name of a callable which will be used as " "the main program for the archive. It can only be specified if the source is " @@ -287,31 +278,38 @@ msgid "" "a directory and does not contain a ``__main__.py`` file, as otherwise the " "resulting archive would not be executable." msgstr "" -"*main* 引数はアーカイブのメインプログラムとして使用する callable の名前を指定" -"します。\n" -"*main* 引数は source がディレクトリであり、 source が既に ``__main__.py`` " -"ファイルを保持していない場合に限り、指定することができます。\n" -"*main* 引数は \"pkg.module:callable\" の形式を取り、\n" -"アーカイブは \"pkg.module\" をインポートして実行され、\n" -"指定した callable を引数なしで実行します。\n" -"source がディレクトリであり、 ``__main__.py`` が含まれていない場合、\n" -"*main* は無視すべきエラーとなり、\n" -"作成されたアーカイブには実行可能ビットが設定されません。" +"*main* 引数は、アーカイブのメインプログラムとして使う呼び出し可能オブジェクト" +"の名前を指定します。\n" +"``source`` がディレクトリで、そこに ``__main__.py`` がまだない場合にのみ指定" +"できます。\n" +"*main* 引数は \"pkg.module:callable\" の形式で指定します。\n" +"アーカイブの実行時には \"pkg.module\" をインポートし、指定された呼び出し可能" +"オブジェクトを引数なしで呼び出します。\n" +"``source`` がディレクトリで ``__main__.py`` がない場合、*main* を省略するとエ" +"ラーになります。\n" +"省略を許すと、作成されるアーカイブを実行できないためです。" -#: ../../library/zipapp.rst:155 msgid "" "The optional *filter* argument specifies a callback function that is passed " "a Path object representing the path to the file being added (relative to the " "source directory). It should return ``True`` if the file is to be added." msgstr "" +"省略可能な *filter* 引数にはコールバック関数を指定します。\n" +"追加するファイルへのパス (元のディレクトリからの相対パス) を表す Path オブ" +"ジェクトがこの関数に渡されます。\n" +"ファイルを追加する場合は ``True`` を返す必要があります。" -#: ../../library/zipapp.rst:160 msgid "" "The optional *compressed* argument determines whether files are compressed. " "If set to ``True``, files in the archive are compressed with the deflate " "method; otherwise, files are stored uncompressed. This argument has no " "effect when copying an existing archive." msgstr "" +"省略可能な *compressed* 引数はファイルを圧縮するかどうかを指定します。\n" +"``True`` に設定すると、アーカイブ内のファイルは deflate 方式で圧縮されま" +"す。\n" +"それ以外の場合は圧縮せずに格納されます。\n" +"既存のアーカイブをコピーする場合、この引数は効果がありません。" #: ../../library/zipapp.rst:165 msgid "" @@ -321,61 +319,60 @@ msgstr "" "*source* または *target* へファイルオブジェクトを指定した場合、\n" "caller が create_archive の呼出し後にオブジェクトを閉じます。" -#: ../../library/zipapp.rst:168 msgid "" "When copying an existing archive, file objects supplied only need ``read`` " "and ``readline``, or ``write`` methods. When creating an archive from a " "directory, if the target is a file object it will be passed to the ``zipfile." "ZipFile`` class, and must supply the methods needed by that class." msgstr "" -"既存のアーカイブをコピーする際、ファイルオブジェクトは ``read`` , " -"``readline`` , ``write`` メソッドのみを提供します。\n" -"アーカイブをディレクトリから作成する際、 target がファイルオブジェクトである" -"場合は、\n" -"``zipfile.ZipFile`` クラスへ渡されます。必ずクラスが必要とするメソッドを提供" -"してください。" +"既存のアーカイブをコピーする場合、渡すファイルオブジェクトに必要なのは、読み" +"込み元なら ``read()`` と ``readline()``、書き込み先なら ``write()`` メソッド" +"だけです。\n" +"ディレクトリからアーカイブを作成する場合、``target`` がファイルオブジェクトな" +"ら ``zipfile.ZipFile`` クラスに渡されるため、そのクラスが必要とするメソッドを" +"備えていなければなりません。" -#: ../../library/zipapp.rst:174 msgid "Added the *filter* and *compressed* parameters." -msgstr "" +msgstr "*filter* と *compressed* 引数を追加しました。" -#: ../../library/zipapp.rst:179 msgid "" "Return the interpreter specified in the ``#!`` line at the start of the " "archive. If there is no ``#!`` line, return :const:`None`. The *archive* " "argument can be a filename or a file-like object open for reading in bytes " "mode. It is assumed to be at the start of the archive." msgstr "" -"アーカイブの最初の行の ``#!`` に指定されたインタープリタを返します。\n" -"``#!`` が無い場合は :const:`None` を返します。\n" -"*archive* 引数は、ファイル名またはバイトモードの読込みで開いた\n" -"ファイルに準じるオブジェクトを指定することができ、アーカイブの起点で決定され" -"ます。" +"アーカイブの先頭の ``#!`` 行で指定されたインタープリタを返します。\n" +"``#!`` 行がない場合は :const:`None` を返します。\n" +"*archive* 引数には、ファイル名またはバイナリモードで読み込み用に開かれたファ" +"イルライクオブジェクトを指定できます。\n" +"ファイル位置はアーカイブの先頭にあるものとします。" #: ../../library/zipapp.rst:188 msgid "Examples" msgstr "使用例" -#: ../../library/zipapp.rst:190 msgid "Pack up a directory into an archive, and run it." -msgstr "ディレクトリを書庫に圧縮し、実行します。" +msgstr "ディレクトリをアーカイブにまとめて実行します。" -#: ../../library/zipapp.rst:192 msgid "" "$ python -m zipapp myapp\n" "$ python myapp.pyz\n" "" msgstr "" +"$ python -m zipapp myapp\n" +"$ python myapp.pyz\n" +"" #: ../../library/zipapp.rst:198 msgid "The same can be done using the :func:`create_archive` function::" msgstr "同じことを :func:`create_archive` 関数を使用して行うことができます::" -#: ../../library/zipapp.rst:200 msgid "" ">>> import zipapp\n" ">>> zipapp.create_archive('myapp', 'myapp.pyz')" msgstr "" +">>> import zipapp\n" +">>> zipapp.create_archive('myapp', 'myapp.pyz')" #: ../../library/zipapp.rst:203 msgid "" @@ -385,29 +382,31 @@ msgstr "" "POSIX でアプリケーションを直接実行可能にするには使用するインタープリタを指定" "します。" -#: ../../library/zipapp.rst:206 msgid "" "$ python -m zipapp myapp -p \"/usr/bin/env python\"\n" "$ ./myapp.pyz\n" "" msgstr "" +"$ python -m zipapp myapp -p \"/usr/bin/env python\"\n" +"$ ./myapp.pyz\n" +"" -#: ../../library/zipapp.rst:212 msgid "" "To replace the shebang line on an existing archive, create a modified " "archive using the :func:`create_archive` function::" msgstr "" -"シバン行を既存の書庫で置換するには、 :func:`create_archive` function: を使用" -"して変更された書庫を作成します:" +"既存のアーカイブのシェバン行を置き換えるには、:func:`create_archive` 関数で変" +"更済みのアーカイブを作成します。 ::" -#: ../../library/zipapp.rst:215 msgid "" ">>> import zipapp\n" ">>> zipapp.create_archive('old_archive.pyz', 'new_archive.pyz', '/usr/bin/" "python3')" msgstr "" +">>> import zipapp\n" +">>> zipapp.create_archive('old_archive.pyz', 'new_archive.pyz', '/usr/bin/" +"python3')" -#: ../../library/zipapp.rst:218 msgid "" "To update the file in place, do the replacement in memory using a :class:" "`~io.BytesIO` object, and then overwrite the source afterwards. Note that " @@ -416,8 +415,8 @@ msgid "" "errors, but production code should do so. Also, this method will only work " "if the archive fits in memory::" msgstr "" -"アーカイブ内のファイルを更新するには :class:`~io.BytesIO` オブジェクトを使用" -"してメモリーへ格納し、\n" +"アーカイブファイル自体を上書き更新するには :class:`~io.BytesIO` オブジェクト" +"を使用してメモリーへ格納し、\n" "元のファイルを上書きして置換してください。\n" "ファイルを上書きする際にエラーが発生し、元のファイルが失われる危険性があるこ" "とに注意してください。\n" @@ -439,45 +438,56 @@ msgstr "" msgid "Specifying the Interpreter" msgstr "インタープリタの指定" -#: ../../library/zipapp.rst:238 msgid "" "Note that if you specify an interpreter and then distribute your application " "archive, you need to ensure that the interpreter used is portable. The " "Python launcher for Windows supports most common forms of POSIX ``#!`` line, " "but there are other issues to consider:" msgstr "" +"インタープリタを指定してアプリケーションアーカイブを配布する場合、そのイン" +"タープリタの指定に移植性があることを確認してください。\n" +"Windows 用の Python ランチャーは POSIX の ``#!`` 行の一般的な形式をほぼサポー" +"トしていますが、ほかにも考慮すべき点があります。" -#: ../../library/zipapp.rst:243 msgid "" "If you use \"/usr/bin/env python\" (or other forms of the \"python\" " "command, such as \"/usr/bin/python\"), you need to consider that your users " "may have either Python 2 or Python 3 as their default, and write your code " "to work under both versions." msgstr "" +"\"/usr/bin/env python\" (または \"/usr/bin/python\" などの \"python\" コマン" +"ドの形式) を使う場合、ユーザーのデフォルトが Python 2 と Python 3 のどちらの" +"可能性もあることを考慮し、両方のバージョンで動作するコードを書く必要がありま" +"す。" -#: ../../library/zipapp.rst:247 msgid "" "If you use an explicit version, for example \"/usr/bin/env python3\" your " "application will not work for users who do not have that version. (This may " "be what you want if you have not made your code Python 2 compatible)." msgstr "" +"例えば \"/usr/bin/env python3\" のようにバージョンを明示すると、そのバージョ" +"ンを持たないユーザーはアプリケーションを実行できません (コードを Python 2 対" +"応にしていなければ、これは望ましい動作かもしれません)。" -#: ../../library/zipapp.rst:250 msgid "" "There is no way to say \"python X.Y or later\", so be careful of using an " "exact version like \"/usr/bin/env python3.4\" as you will need to change " "your shebang line for users of Python 3.5, for example." msgstr "" +"「Python X.Y 以降」と指定する方法はありません。\n" +"そのため、\"/usr/bin/env python3.4\" のような厳密なバージョンの指定には注意し" +"てください。\n" +"例えば Python 3.5 のユーザー向けにはシェバン行を変更する必要があります。" -#: ../../library/zipapp.rst:254 msgid "" "Typically, you should use an \"/usr/bin/env python2\" or \"/usr/bin/env " "python3\", depending on whether your code is written for Python 2 or 3." msgstr "" +"通常は、コードが Python 2 用か Python 3 用かに応じて \"/usr/bin/env " +"python2\" または \"/usr/bin/env python3\" を使ってください。" -#: ../../library/zipapp.rst:259 msgid "Creating Standalone Applications with zipapp" -msgstr "" +msgstr "zipapp による単独で使えるアプリケーションの作成" #: ../../library/zipapp.rst:261 msgid "" @@ -488,50 +498,53 @@ msgid "" "along with the application code." msgstr "" -#: ../../library/zipapp.rst:267 msgid "The steps to create a standalone archive are as follows:" -msgstr "" +msgstr "単独で使えるアーカイブを作成する手順は次のとおりです。" -#: ../../library/zipapp.rst:269 msgid "" "Create your application in a directory as normal, so you have a ``myapp`` " "directory containing a ``__main__.py`` file, and any supporting application " "code." msgstr "" +"通常どおりディレクトリ内でアプリケーションを作成し、``__main__.py`` ファイル" +"と必要なアプリケーションコードを含む ``myapp`` ディレクトリを用意します。" -#: ../../library/zipapp.rst:273 msgid "" "Install all of your application's dependencies into the ``myapp`` directory, " "using pip:" msgstr "" +"pip を使い、アプリケーションの依存パッケージをすべて ``myapp`` ディレクトリに" +"インストールします。" -#: ../../library/zipapp.rst:276 msgid "$ python -m pip install -r requirements.txt --target myapp" -msgstr "" +msgstr "$ python -m pip install -r requirements.txt --target myapp" -#: ../../library/zipapp.rst:280 msgid "" "(this assumes you have your project requirements in a ``requirements.txt`` " "file - if not, you can just list the dependencies manually on the pip " "command line)." msgstr "" +"(ここでは、プロジェクトの依存パッケージが ``requirements.txt`` ファイルに記載" +"されているものとします。\n" +"そうでなければ pip のコマンドラインで依存パッケージを直接列挙しても構いませ" +"ん。)" -#: ../../library/zipapp.rst:284 msgid "Package the application using:" -msgstr "" +msgstr "次のコマンドでアプリケーションをパッケージ化します。" -#: ../../library/zipapp.rst:286 msgid "$ python -m zipapp -p \"interpreter\" myapp" -msgstr "" +msgstr "$ python -m zipapp -p \"interpreter\" myapp" -#: ../../library/zipapp.rst:290 msgid "" "This will produce a standalone executable, which can be run on any machine " "with the appropriate interpreter available. See :ref:`zipapp-specifying-the-" "interpreter` for details. It can be shipped to users as a single file." msgstr "" +"これにより、適切なインタープリタが利用できるマシンならどこでも実行できる、単" +"独で使える実行ファイルが作成されます。\n" +"詳細は :ref:`zipapp-specifying-the-interpreter` を参照してください。\n" +"1 つのファイルとしてユーザーに配布できます。" -#: ../../library/zipapp.rst:294 msgid "" "On Unix, the ``myapp.pyz`` file is executable as it stands. You can rename " "the file to remove the ``.pyz`` extension if you prefer a \"plain\" command " @@ -539,12 +552,15 @@ msgid "" "fact that the Python interpreter registers the ``.pyz`` and ``.pyzw`` file " "extensions when installed." msgstr "" +"Unix では ``myapp.pyz`` ファイルをそのまま実行できます。\n" +"通常のコマンド名にしたければ、ファイル名を変更して ``.pyz`` 拡張子を削除でき" +"ます。\n" +"Windows では、Python インタープリタのインストール時に ``.pyz`` と ``.pyzw`` " +"の拡張子が登録されるため、``myapp.pyz[w]`` ファイルを実行できます。" -#: ../../library/zipapp.rst:302 msgid "Caveats" -msgstr "" +msgstr "注意点" -#: ../../library/zipapp.rst:304 msgid "" "If your application depends on a package that includes a C extension, that " "package cannot be run from a zip file (this is an OS limitation, as " @@ -557,12 +573,20 @@ msgid "" "(and potentially pick the correct version to add to ``sys.path`` at runtime, " "based on the user's machine)." msgstr "" +"アプリケーションが C 拡張を含むパッケージに依存している場合、そのパッケージ" +"は zip ファイルから実行できません (OS のローダーが読み込む実行可能コードは" +"ファイルシステム上になければならないという、OS の制約によるものです)。\n" +"この場合、その依存パッケージを zip ファイルから除外し、ユーザーにインストール" +"してもらうか、zip ファイルと別に同梱します。\n" +"同梱する場合は、展開したモジュールを含むディレクトリを ``sys.path`` に追加す" +"るコードを ``__main__.py`` に加えてください。\n" +"その際、対象とするアーキテクチャに適したバイナリを確実に配布する必要がありま" +"す (場合によっては、実行時にユーザーのマシンに応じて適切なバージョンを選んで " +"``sys.path`` に追加する必要もあります)。" -#: ../../library/zipapp.rst:316 msgid "The Python Zip Application Archive Format" -msgstr "" +msgstr "Python zip アプリケーションアーカイブ形式" -#: ../../library/zipapp.rst:318 msgid "" "Python has been able to execute zip files which contain a ``__main__.py`` " "file since version 2.6. In order to be executed by Python, an application " @@ -572,19 +596,28 @@ msgid "" "be placed on :data:`sys.path` and thus further modules can be imported from " "the zip file." msgstr "" +"Python はバージョン 2.6 から、``__main__.py`` ファイルを含む zip ファイルを実" +"行できます。\n" +"Python で実行するには、アプリケーションアーカイブが、エントリーポイントとして" +"実行する ``__main__.py`` ファイルを含む標準的な zip ファイルであれば十分で" +"す。\n" +"ほかの Python スクリプトと同様に、スクリプトの親 (この場合は zip ファイル) " +"が :data:`sys.path` に追加されるため、zip ファイル内のほかのモジュールもイン" +"ポートできます。" -#: ../../library/zipapp.rst:325 msgid "" "The zip file format allows arbitrary data to be prepended to a zip file. " "The zip application format uses this ability to prepend a standard POSIX " "\"shebang\" line to the file (``#!/path/to/interpreter``)." msgstr "" +"zip ファイル形式では、ファイルの先頭に任意のデータを付けられます。\n" +"zip アプリケーション形式はこの機能を使い、標準的な POSIX のシェバン行 (``#!/" +"path/to/interpreter``) を先頭に付けます。" -#: ../../library/zipapp.rst:329 msgid "Formally, the Python zip application format is therefore:" msgstr "" +"したがって、Python zip アプリケーション形式は正式には次の構成になります。" -#: ../../library/zipapp.rst:331 msgid "" "An optional shebang line, containing the characters ``b'#!'`` followed by an " "interpreter name, and then a newline (``b'\\n'``) character. The " @@ -593,28 +626,41 @@ msgid "" "encoded in UTF-8 on Windows, and in :func:`sys.getfilesystemencoding` on " "POSIX." msgstr "" +"省略可能なシェバン行で、文字 ``b'#!'`` にインタープリタ名、改行文字 " +"(``b'\\n'``) が続きます。\n" +"インタープリタ名には、OS のシェバン処理、または Windows の Python ランチャー" +"が受け付けるものを指定できます。\n" +"Windows では UTF-8、POSIX では :func:`sys.getfilesystemencoding` が返すエン" +"コーディングでインタープリタ名をエンコードしてください。" -#: ../../library/zipapp.rst:336 msgid "" "Standard zipfile data, as generated by the :mod:`zipfile` module. The " "zipfile content *must* include a file called ``__main__.py`` (which must be " "in the \"root\" of the zipfile - i.e., it cannot be in a subdirectory). The " "zipfile data can be compressed or uncompressed." msgstr "" +":mod:`zipfile` モジュールが生成するような標準的な zip ファイルのデータで" +"す。\n" +"zip ファイルには ``__main__.py`` というファイルを *必ず* 含めます (zip ファイ" +"ルのルートになければならず、サブディレクトリには置けません)。\n" +"zip ファイルのデータは圧縮しても、圧縮しなくても構いません。" -#: ../../library/zipapp.rst:341 msgid "" "If an application archive has a shebang line, it may have the executable bit " "set on POSIX systems, to allow it to be executed directly." msgstr "" +"アプリケーションアーカイブにシェバン行がある場合、POSIX システムでは実行可能" +"ビットを設定して直接実行できるようにしても構いません。" -#: ../../library/zipapp.rst:344 msgid "" "There is no requirement that the tools in this module are used to create " "application archives - the module is a convenience, but archives in the " "above format created by any means are acceptable to Python." msgstr "" +"アプリケーションアーカイブをこのモジュールのツールで作成する必要はありませ" +"ん。\n" +"このモジュールは便利な手段を提供するものですが、どのような方法で作成しても、" +"上記の形式のアーカイブであれば Python は受け付けます。" -#: ../../library/zipapp.rst:11 msgid "Executable Zip Files" -msgstr "" +msgstr "実行可能な zip ファイル" diff --git a/library/zipfile.po b/library/zipfile.po index 9f692f2c8..1f422ffe4 100644 --- a/library/zipfile.po +++ b/library/zipfile.po @@ -20,10 +20,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/zipfile.rst:2 @@ -126,22 +126,24 @@ msgstr "" "ルドのタプルでなければなりません; フィールドは :ref:`zipinfo-objects` 節で説" "明されています。" -#: ../../library/zipfile.rst:82 msgid "" "A public :attr:`!compress_level` attribute has been added to expose the " "formerly protected :attr:`!_compresslevel`. The older protected name " "continues to work as a property for backwards compatibility." msgstr "" +"これまで保護された属性だった :attr:`!_compresslevel` を公開する :attr:`!" +"compress_level` 属性を追加しました。\n" +"後方互換性のため、以前の保護された名前もプロパティとして引き続き使えます。" -#: ../../library/zipfile.rst:90 msgid "" "Resolve the date_time, compression attributes, and external attributes to " "suitable defaults as used by :meth:`ZipFile.writestr`." msgstr "" +":meth:`ZipFile.writestr` で使う適切なデフォルト値を ``date_time``、圧縮関連の" +"属性、外部属性に設定します。" -#: ../../library/zipfile.rst:93 msgid "Returns self for chaining." -msgstr "" +msgstr "呼び出しを連結できるように、自身を返します。" #: ../../library/zipfile.rst:100 msgid "" @@ -210,9 +212,8 @@ msgstr "" "ZIP ファイルフォーマットおよびアルゴリズムを作成した Phil Katz によるドキュメ" "ント。" -#: ../../library/zipfile.rst:147 msgid "`Info-ZIP Home Page `_" -msgstr "" +msgstr "`Info-ZIP Home Page `_" #: ../../library/zipfile.rst:148 msgid "" @@ -234,7 +235,6 @@ msgstr "" "ZIP ファイルを開きます。 *file* はファイルのパス (文字列) か、ファイルライク" "オブジェクト、 :term:`path-like object` のいずれかです。" -#: ../../library/zipfile.rst:165 msgid "" "The *mode* parameter should be ``'r'`` to read an existing file, ``'w'`` to " "truncate and write a new file, ``'a'`` to append to an existing file, or " @@ -247,16 +247,16 @@ msgid "" "``'a'`` and the file does not exist at all, it is created. If *mode* is " "``'r'`` or ``'a'``, the file should be seekable." msgstr "" -"*mode* パラメータには、既存のファイルを読み込む場合は ``'r'`` 、内容を消去し" -"て新しいファイルに書き込む場合は ``'w'`` 、既存のファイルの末尾に追加する場" -"合は ``'a'`` 、ファイルが存在しない場合にのみファイルを作成して書き込む場合" -"は ``'x'`` を指定します。\n" -"*mode* が ``'x'`` で *file* が既存のファイルを指している場合、 :exc:" -"`FileExistsError` が発生します。\n" -"*mode* が ``'a'`` で *file* が既存の ZIP ファイルを指している場合、新しい " -"ZIP アーカイブがそのファイルに追加されます。\n" -"*file* が ZIP ファイルでない場合は、ファイルの末尾にあたらしい ZIP アーカイブ" -"が追加されます。\n" +"*mode* 引数には、既存のファイルを読み込む場合は ``'r'``、内容を消去して新しい" +"ファイルとして書き込む場合は ``'w'``、既存のファイルの末尾に追加する場合は " +"``'a'``、ファイルが存在しない場合にのみファイルを作成して書き込む場合は " +"``'x'`` を指定します。\n" +"*mode* が ``'x'`` で *file* が既存のファイルを指している場合、:exc:" +"`FileExistsError` が送出されます。\n" +"*mode* が ``'a'`` で *file* が既存の ZIP ファイルを指している場合、その ZIP " +"ファイルにファイルが追加されます。\n" +"*file* が ZIP ファイルでない場合は、ファイルの末尾に新しい ZIP アーカイブが追" +"加されます。\n" "これは、既存のファイル (例えば :file:`python.exe`) に ZIP アーカイブを付け加" "える用途を想定したものです。\n" "*mode* が ``'a'`` で *file* が存在しない場合は、ファイルが作成されます。\n" @@ -292,20 +292,24 @@ msgid "" "accepted (see :class:`bz2 ` for more information)." msgstr "" -#: ../../library/zipfile.rst:198 ../../library/zipfile.rst:787 msgid "" "The *strict_timestamps* argument, when set to ``False``, allows to zip files " "older than 1980-01-01 at the cost of setting the timestamp to 1980-01-01. " "Similar behavior occurs with files newer than 2107-12-31, the timestamp is " "also set to the limit." msgstr "" +"*strict_timestamps* 引数を ``False`` にすると、1980-01-01 より前のファイルを " +"ZIP に格納できますが、タイムスタンプは 1980-01-01 に設定されます。\n" +"2107-12-31 より後のファイルも同様に扱われ、タイムスタンプは上限の日時に設定さ" +"れます。" -#: ../../library/zipfile.rst:204 msgid "" "When mode is ``'r'``, *metadata_encoding* may be set to the name of a codec, " "which will be used to decode metadata such as the names of members and ZIP " "comments." msgstr "" +"``mode`` が ``'r'`` の場合、*metadata_encoding* にコーデックの名前を設定し、" +"メンバーの名前や ZIP コメントなどのメタデータのデコードに使うことができます。" #: ../../library/zipfile.rst:208 msgid "" @@ -327,11 +331,12 @@ msgstr "" "ポートしています。次の例では、*myzip* は :keyword:`!with` 文のブロックが終了" "したときに、(たとえ例外が発生したとしても) クローズされます::" -#: ../../library/zipfile.rst:216 msgid "" "with ZipFile('spam.zip', 'w') as myzip:\n" " myzip.write('eggs.txt')" msgstr "" +"with ZipFile('spam.zip', 'w') as myzip:\n" +" myzip.write('eggs.txt')" #: ../../library/zipfile.rst:221 msgid "" @@ -339,7 +344,6 @@ msgid "" "currently possible to set this on a per-member basis." msgstr "" -#: ../../library/zipfile.rst:224 msgid "" "This attribute is a workaround for legacy implementations which produce " "archives with names in the current locale encoding or code page (mostly on " @@ -348,6 +352,12 @@ msgid "" "archive header. That flag takes precedence over *metadata_encoding*, which " "is a Python-specific extension." msgstr "" +"この属性は、現在のロケールのエンコーディングやコードページを名前に使ってアー" +"カイブを作成する古い実装 (主に Windows) に対処するためのものです。\n" +".ZIP 標準では、アーカイブヘッダーのフラグによってメタデータのエンコーディング" +"を IBM コードページ (デフォルト) または UTF-8 に指定できます。\n" +"このフラグは、Python 独自の拡張である *metadata_encoding* よりも優先されま" +"す。" #: ../../library/zipfile.rst:232 msgid "Added the ability to use :class:`ZipFile` as a context manager." @@ -362,19 +372,19 @@ msgstr ":mod:`bzip2 ` および :mod:`lzma` 圧縮をサポートしまし msgid "ZIP64 extensions are enabled by default." msgstr "ZIP64 拡張がデフォルトで有効になりました。" -#: ../../library/zipfile.rst:241 msgid "" "Added support for writing to unseekable streams. Added support for the " "``'x'`` mode." msgstr "" -"seek 出来ないストリームのサポートが追加されました。``'x'`` モードのサポートが" -"追加されました。" +"シークできないストリームへの書き込みをサポートしました。\n" +"``'x'`` モードをサポートしました。" -#: ../../library/zipfile.rst:245 msgid "" "Previously, a plain :exc:`RuntimeError` was raised for unrecognized " "compression values." msgstr "" +"以前は、認識できない圧縮方式の値に対して単なる :exc:`RuntimeError` が送出され" +"ていました。" #: ../../library/zipfile.rst:249 msgid "The *file* parameter accepts a :term:`path-like object`." @@ -384,15 +394,15 @@ msgstr "*file* 引数が :term:`path-like object` を受け入れるようにな msgid "Add the *compresslevel* parameter." msgstr "*compresslevel* パラメータが追加されました。" -#: ../../library/zipfile.rst:255 msgid "The *strict_timestamps* keyword-only parameter." -msgstr "" +msgstr "キーワード専用引数 *strict_timestamps* を追加しました。" -#: ../../library/zipfile.rst:258 msgid "" "Added support for specifying member name encoding for reading metadata in " "the zipfile's directory and file headers." msgstr "" +"zip ファイルのディレクトリとファイルヘッダーのメタデータを読み込む際、メン" +"バー名のエンコーディングを指定できるようになりました。" #: ../../library/zipfile.rst:265 msgid "" @@ -427,7 +437,6 @@ msgstr "" msgid "Return a list of archive members by name." msgstr "アーカイブメンバの名前のリストを返します。" -#: ../../library/zipfile.rst:290 msgid "" "Access a member of the archive as a binary file-like object. *name* can be " "either the name of a file within the archive or a :class:`ZipInfo` object. " @@ -435,6 +444,14 @@ msgid "" "``'w'``. *pwd* is the password used to decrypt encrypted ZIP files as a :" "class:`bytes` object." msgstr "" +"アーカイブ内のメンバーに、バイナリのファイル風オブジェクトとしてアクセスしま" +"す。\n" +"*name* にはアーカイブ内のファイル名または :class:`ZipInfo` オブジェクトを指定" +"できます。\n" +"*mode* 引数を指定する場合は ``'r'`` (デフォルト) または ``'w'`` でなければな" +"りません。\n" +"*pwd* は暗号化された ZIP ファイルの復号に使うパスワードを表す :class:`bytes` " +"オブジェクトです。" #: ../../library/zipfile.rst:296 msgid "" @@ -444,14 +461,15 @@ msgstr "" ":meth:`~ZipFile.open` はコンテキストマネージャでもあるので :keyword:`with` 文" "をサポートしています::" -#: ../../library/zipfile.rst:299 msgid "" "with ZipFile('spam.zip') as myzip:\n" " with myzip.open('eggs.txt') as myfile:\n" " print(myfile.read())" msgstr "" +"with ZipFile('spam.zip') as myzip:\n" +" with myzip.open('eggs.txt') as myfile:\n" +" print(myfile.read())" -#: ../../library/zipfile.rst:303 msgid "" "With *mode* ``'r'`` the file-like object (``ZipExtFile``) is read-only and " "provides the following methods: :meth:`~io.BufferedIOBase.read`, :meth:`~io." @@ -459,23 +477,33 @@ msgid "" "meth:`~io.IOBase.tell`, :meth:`~container.__iter__`, :meth:`~iterator." "__next__`. These objects can operate independently of the ZipFile." msgstr "" +"*mode* が ``'r'`` の場合、ファイル風オブジェクト (``ZipExtFile``) は読み取り" +"専用で、:meth:`~io.BufferedIOBase.read`、:meth:`~io.IOBase.readline`、:meth:" +"`~io.IOBase.readlines`、:meth:`~io.IOBase.seek`、:meth:`~io.IOBase.tell`、:" +"meth:`~container.__iter__`、:meth:`~iterator.__next__` メソッドを提供しま" +"す。\n" +"これらのオブジェクトは ZipFile とは独立して動作できます。" -#: ../../library/zipfile.rst:310 msgid "" "With ``mode='w'``, a writable file handle is returned, which supports the :" "meth:`~io.BufferedIOBase.write` method. While a writable file handle is " "open, attempting to read or write other files in the ZIP file will raise a :" "exc:`ValueError`." msgstr "" +"``mode='w'`` の場合、:meth:`~io.BufferedIOBase.write` メソッドをサポートする" +"書き込み可能なファイルハンドルを返します。\n" +"書き込み可能なファイルハンドルが開いている間に、ZIP ファイル内のほかのファイ" +"ルの読み書きを試みると :exc:`ValueError` が送出されます。" -#: ../../library/zipfile.rst:315 msgid "" "In both cases the file-like object has also attributes :attr:`!name`, which " "is equivalent to the name of a file within the archive, and :attr:`!mode`, " "which is ``'rb'`` or ``'wb'`` depending on the input mode." msgstr "" +"いずれの場合も、ファイル風オブジェクトにはアーカイブ内のファイル名に等しい :" +"attr:`!name` 属性と、指定したモードに応じて ``'rb'`` または ``'wb'`` になる :" +"attr:`!mode` 属性があります。" -#: ../../library/zipfile.rst:319 msgid "" "When writing a file, if the file size is not known in advance but may exceed " "2 GiB, pass ``force_zip64=True`` to ensure that the header format is capable " @@ -483,6 +511,11 @@ msgid "" "a :class:`ZipInfo` object with :attr:`~ZipInfo.file_size` set, and use that " "as the *name* parameter." msgstr "" +"書き込むファイルのサイズが事前に分からず、2 GiB を超える可能性がある場合は、" +"``force_zip64=True`` を渡して大きなファイルに対応するヘッダー形式が使われるよ" +"うにしてください。\n" +"サイズが事前に分かる場合は、:attr:`~ZipInfo.file_size` を設定した :class:" +"`ZipInfo` オブジェクトを作成し、*name* 引数に渡してください。" #: ../../library/zipfile.rst:327 msgid "" @@ -494,32 +527,39 @@ msgstr "" "または :class:`ZipInfo` オブジェクトを指定できます。これは重複する名前のメン" "バを含む ZIP ファイルを読み込むときにそのメリットを享受できるでしょう。" -#: ../../library/zipfile.rst:331 msgid "" "Removed support of ``mode='U'``. Use :class:`io.TextIOWrapper` for reading " "compressed text files in :term:`universal newlines` mode." msgstr "" +"``mode='U'`` のサポートを削除しました。\n" +"圧縮されたテキストファイルを :term:`ユニバーサル改行 ` " +"モードで読み込むには :class:`io.TextIOWrapper` を使ってください。" -#: ../../library/zipfile.rst:335 msgid "" ":meth:`ZipFile.open` can now be used to write files into the archive with " "the ``mode='w'`` option." msgstr "" +"``mode='w'`` オプションを指定して :meth:`ZipFile.open` を呼び出し、アーカイブ" +"にファイルを書き込めるようになりました。" -#: ../../library/zipfile.rst:339 msgid "" "Calling :meth:`.open` on a closed ZipFile will raise a :exc:`ValueError`. " "Previously, a :exc:`RuntimeError` was raised." msgstr "" +"閉じた ZipFile の :meth:`.open` を呼び出すと :exc:`ValueError` が送出されるよ" +"うになりました。\n" +"以前は :exc:`RuntimeError` が送出されていました。" -#: ../../library/zipfile.rst:343 msgid "" "Added attributes :attr:`!name` and :attr:`!mode` for the writeable file-like " "object. The value of the :attr:`!mode` attribute for the readable file-like " "object was changed from ``'r'`` to ``'rb'``." msgstr "" +"書き込み可能なファイル風オブジェクトに :attr:`!name` 属性と :attr:`!mode` 属" +"性を追加しました。\n" +"読み取り可能なファイル風オブジェクトの :attr:`!mode` 属性の値を ``'r'`` から " +"``'rb'`` に変更しました。" -#: ../../library/zipfile.rst:352 msgid "" "Extract a member from the archive to the current working directory; *member* " "must be its full name or a :class:`ZipInfo` object. Its file information is " @@ -527,12 +567,19 @@ msgid "" "to extract to. *member* can be a filename or a :class:`ZipInfo` object. " "*pwd* is the password used for encrypted files as a :class:`bytes` object." msgstr "" +"アーカイブ内のメンバーを現在の作業ディレクトリに展開します。\n" +"*member* はメンバーの完全な名前または :class:`ZipInfo` オブジェクトでなければ" +"なりません。\n" +"ファイル情報は可能な限り正確に復元されます。\n" +"*path* には別の展開先ディレクトリを指定します。\n" +"*member* にはファイル名または :class:`ZipInfo` オブジェクトを指定できます。\n" +"*pwd* は暗号化されたファイルに使うパスワードを表す :class:`bytes` オブジェク" +"トです。" #: ../../library/zipfile.rst:358 msgid "Returns the normalized path created (a directory or new file)." msgstr "作成された (ディレクトリか新ファイルの) 正規化されたパスを返します。" -#: ../../library/zipfile.rst:362 msgid "" "If a member filename is an absolute path, a drive/UNC sharepoint and leading " "(back)slashes will be stripped, e.g.: ``///foo/bar`` becomes ``foo/bar`` on " @@ -543,31 +590,40 @@ msgid "" "(``_``)." msgstr "" "メンバのファイル名が絶対パスなら、ドライブ/UNC sharepoint および先頭の (バッ" -"ク) スラッシュは取り除かれます。例えば、Unix で ``///foo/bar`` は ``foo/" -"bar`` となり、Window で ``C:\\foo\\bar`` は ``foo\\bar`` となります。また、メ" -"ンバのファイル名に含まれる全ての ``\"..\"`` は取り除かれます。例えば、" -"``../../foo../../ba..r`` は ``foo../ba..r`` となります。Windows では、不正な" -"文字 (``:``, ``<``, ``>``, ``|``, ``\"``, ``?``, および ``*``) はアンダースコ" -"ア (``_``) で置き換えられます。" +"ク) スラッシュは取り除かれます。\n" +"例えば、Unix で ``///foo/bar`` は ``foo/bar`` となり、Windows で ``C:" +"\\foo\\bar`` は ``foo\\bar`` となります。\n" +"また、メンバのファイル名に含まれる ``\"..\"`` というパス要素はすべて取り除か" +"れます。\n" +"例えば、``../../foo../../ba..r`` は ``foo../ba..r`` となります。\n" +"Windows では、不正な文字 (``:``, ``<``, ``>``, ``|``, ``\"``, ``?``, および " +"``*``) はアンダースコア (``_``) で置き換えられます。" -#: ../../library/zipfile.rst:370 msgid "" "Calling :meth:`extract` on a closed ZipFile will raise a :exc:`ValueError`. " "Previously, a :exc:`RuntimeError` was raised." msgstr "" +"閉じた ZipFile の :meth:`extract` を呼び出すと :exc:`ValueError` が送出される" +"ようになりました。\n" +"以前は :exc:`RuntimeError` が送出されていました。" #: ../../library/zipfile.rst:374 ../../library/zipfile.rst:397 msgid "The *path* parameter accepts a :term:`path-like object`." msgstr "" "*path* パラメタが :term:`path-like object` を受け付けるようになりました。" -#: ../../library/zipfile.rst:380 msgid "" "Extract all members from the archive to the current working directory. " "*path* specifies a different directory to extract to. *members* is optional " "and must be a subset of the list returned by :meth:`namelist`. *pwd* is the " "password used for encrypted files as a :class:`bytes` object." msgstr "" +"アーカイブ内のすべてのメンバーを現在の作業ディレクトリに展開します。\n" +"*path* には別の展開先ディレクトリを指定します。\n" +"*members* は省略可能で、指定する場合は :meth:`namelist` が返すリストの部分集" +"合でなければなりません。\n" +"*pwd* は暗号化されたファイルに使うパスワードを表す :class:`bytes` オブジェク" +"トです。" #: ../../library/zipfile.rst:387 msgid "" @@ -582,21 +638,24 @@ msgstr "" "を持つファイル名などの場合です。このモジュールはそれを避けようとします。 :" "meth:`extract` の注釈を参照してください。" -#: ../../library/zipfile.rst:393 msgid "" "Calling :meth:`extractall` on a closed ZipFile will raise a :exc:" "`ValueError`. Previously, a :exc:`RuntimeError` was raised." msgstr "" +"閉じた ZipFile の :meth:`extractall` を呼び出すと :exc:`ValueError` が送出さ" +"れるようになりました。\n" +"以前は :exc:`RuntimeError` が送出されていました。" #: ../../library/zipfile.rst:403 msgid "Print a table of contents for the archive to ``sys.stdout``." msgstr "アーカイブの内容の一覧を ``sys.stdout`` に出力します。" -#: ../../library/zipfile.rst:408 msgid "" "Set *pwd* (a :class:`bytes` object) as default password to extract encrypted " "files." msgstr "" +"暗号化されたファイルを展開する際のデフォルトのパスワードとして、:class:" +"`bytes` オブジェクトの *pwd* を設定します。" #: ../../library/zipfile.rst:413 msgid "" @@ -611,25 +670,31 @@ msgid "" "compression module is not available." msgstr "" -#: ../../library/zipfile.rst:422 msgid "" "Calling :meth:`read` on a closed ZipFile will raise a :exc:`ValueError`. " "Previously, a :exc:`RuntimeError` was raised." msgstr "" +"閉じた ZipFile の :meth:`read` を呼び出すと :exc:`ValueError` が送出されるよ" +"うになりました。\n" +"以前は :exc:`RuntimeError` が送出されていました。" -#: ../../library/zipfile.rst:429 msgid "" "Read all the files in the archive and check their CRC's and file headers. " "Return the name of the first bad file, or else return ``None``." msgstr "" +"アーカイブ内のすべてのファイルを読み込み、CRC とファイルヘッダーを検査しま" +"す。\n" +"最初に見つかった不正なファイルの名前を返し、不正なファイルがなければ " +"``None`` を返します。" -#: ../../library/zipfile.rst:432 msgid "" "Calling :meth:`testzip` on a closed ZipFile will raise a :exc:`ValueError`. " "Previously, a :exc:`RuntimeError` was raised." msgstr "" +"閉じた ZipFile の :meth:`testzip` を呼び出すと :exc:`ValueError` が送出される" +"ようになりました。\n" +"以前は :exc:`RuntimeError` が送出されていました。" -#: ../../library/zipfile.rst:440 msgid "" "Write the file named *filename* to the archive, giving it the archive name " "*arcname* (by default, this will be the same as *filename*, but without a " @@ -639,8 +704,16 @@ msgid "" "the constructor if given. The archive must be open with mode ``'w'``, " "``'x'`` or ``'a'``." msgstr "" +"*filename* で指定したファイルを、アーカイブ内の名前を *arcname* として書き込" +"みます。\n" +"デフォルトの名前は *filename* からドライブ文字と先頭のパス区切り文字を取り除" +"いたものです。\n" +"*compress_type* を指定すると、新しいエントリーにはコンストラクタの " +"*compression* 引数の値よりも優先して使われます。\n" +"同様に、*compresslevel* を指定するとコンストラクタの値よりも優先されます。\n" +"アーカイブは ``'w'``、``'x'``、``'a'`` のいずれかのモードで開いていなければな" +"りません。" -#: ../../library/zipfile.rst:450 msgid "" "The ZIP file standard historically did not specify a metadata encoding, but " "strongly recommended CP437 (the original IBM PC encoding) for " @@ -649,6 +722,14 @@ msgid "" "contain any non-ASCII characters. It is not possible to write member names " "in any encoding other than ASCII or UTF-8." msgstr "" +"ZIP ファイルの標準は、以前はメタデータのエンコーディングを規定していませんで" +"したが、相互運用性のために CP437 (初代 IBM PC のエンコーディング) を強く推奨" +"していました。\n" +"最近のバージョンでは UTF-8 (のみ) も使えます。\n" +"このモジュールは、メンバー名に非 ASCII 文字が含まれる場合、自動的に UTF-8 で" +"書き込みます。\n" +"ASCII または UTF-8 以外のエンコーディングでメンバー名を書き込むことはできませ" +"ん。" #: ../../library/zipfile.rst:459 msgid "" @@ -668,18 +749,21 @@ msgstr "" "byte を含むなら、アーカイブ中のファイルのファイル名は、null byte までで切り詰" "められます。" -#: ../../library/zipfile.rst:469 msgid "" "A leading slash in the filename may lead to the archive being impossible to " "open in some zip programs on Windows systems." msgstr "" +"ファイル名の先頭にスラッシュがあると、Windows 上の一部の zip プログラムでアー" +"カイブを開けなくなる場合があります。" -#: ../../library/zipfile.rst:472 msgid "" "Calling :meth:`write` on a ZipFile created with mode ``'r'`` or a closed " "ZipFile will raise a :exc:`ValueError`. Previously, a :exc:`RuntimeError` " "was raised." msgstr "" +"モード ``'r'`` で作成した ZipFile、または閉じた ZipFile の :meth:`write` を呼" +"び出すと :exc:`ValueError` が送出されるようになりました。\n" +"以前は :exc:`RuntimeError` が送出されていました。" #: ../../library/zipfile.rst:481 msgid "" @@ -692,13 +776,16 @@ msgid "" "must be opened with mode ``'w'``, ``'x'`` or ``'a'``." msgstr "" -#: ../../library/zipfile.rst:489 msgid "" "If given, *compress_type* overrides the value given for the *compression* " "parameter to the constructor for the new entry, or in the *zinfo_or_arcname* " "(if that is a :class:`ZipInfo` instance). Similarly, *compresslevel* will " "override the constructor if given." msgstr "" +"*compress_type* を指定すると、新しいエントリーにはコンストラクタの " +"*compression* 引数の値、または :class:`ZipInfo` インスタンスとして渡した " +"*zinfo_or_arcname* の値よりも優先して使われます。\n" +"同様に、*compresslevel* を指定するとコンストラクタの値よりも優先されます。" #: ../../library/zipfile.rst:496 msgid "" @@ -716,24 +803,31 @@ msgstr "" msgid "The *compress_type* argument." msgstr "引数 *compress_type* を追加しました。" -#: ../../library/zipfile.rst:504 msgid "" "Calling :meth:`writestr` on a ZipFile created with mode ``'r'`` or a closed " "ZipFile will raise a :exc:`ValueError`. Previously, a :exc:`RuntimeError` " "was raised." msgstr "" +"モード ``'r'`` で作成した ZipFile、または閉じた ZipFile の :meth:`writestr` " +"を呼び出すと :exc:`ValueError` が送出されるようになりました。\n" +"以前は :exc:`RuntimeError` が送出されていました。" -#: ../../library/zipfile.rst:511 msgid "" "Create a directory inside the archive. If *zinfo_or_directory* is a string, " "a directory is created inside the archive with the mode that is specified in " "the *mode* argument. If, however, *zinfo_or_directory* is a :class:`ZipInfo` " "instance then the *mode* argument is ignored." msgstr "" +"アーカイブ内にディレクトリを作成します。\n" +"*zinfo_or_directory* が文字列の場合、*mode* 引数で指定したモードでアーカイブ" +"内にディレクトリを作成します。\n" +"*zinfo_or_directory* が :class:`ZipInfo` インスタンスの場合は *mode* 引数を無" +"視します。" -#: ../../library/zipfile.rst:516 msgid "The archive must be opened with mode ``'w'``, ``'x'`` or ``'a'``." msgstr "" +"アーカイブは ``'w'``、``'x'``、``'a'`` のいずれかのモードで開いていなければな" +"りません。" #: ../../library/zipfile.rst:521 msgid "The following data attributes are also available:" @@ -777,18 +871,22 @@ msgstr "" msgid "Path Objects" msgstr "Path オブジェクト" -#: ../../library/zipfile.rst:557 msgid "" "Construct a Path object from a ``root`` zipfile (which may be a :class:" "`ZipFile` instance or ``file`` suitable for passing to the :class:`ZipFile` " "constructor)." msgstr "" +"zip ファイルを表す ``root`` から Path オブジェクトを作成します。\n" +"``root`` には :class:`ZipFile` インスタンス、または :class:`ZipFile` コンスト" +"ラクタの ``file`` 引数に渡せるものを指定できます。" -#: ../../library/zipfile.rst:561 msgid "" "``at`` specifies the location of this Path within the zipfile, e.g. 'dir/" "file.txt', 'dir/', or ''. Defaults to the empty string, indicating the root." msgstr "" +"``at`` は zip ファイル内でのこの Path の位置を指定します。\n" +"例えば 'dir/file.txt'、'dir/'、'' などです。\n" +"デフォルトはルートを示す空文字列です。" #: ../../library/zipfile.rst:566 msgid "" @@ -801,18 +899,17 @@ msgid "" "directory with :func:`os.path.commonpath`." msgstr "" -#: ../../library/zipfile.rst:573 msgid "" "Path objects expose the following features of :mod:`pathlib.Path` objects:" msgstr "" +"Path オブジェクトは :mod:`pathlib.Path` オブジェクトの以下の機能を提供しま" +"す。" -#: ../../library/zipfile.rst:576 msgid "Path objects are traversable using the ``/`` operator or ``joinpath``." -msgstr "" +msgstr "Path オブジェクトは ``/`` 演算子または ``joinpath`` でたどれます。" -#: ../../library/zipfile.rst:580 msgid "The final path component." -msgstr "" +msgstr "パスの最後の要素。" #: ../../library/zipfile.rst:584 msgid "" @@ -823,107 +920,114 @@ msgid "" "``pwd`` parameter to :meth:`ZipFile.open`." msgstr "" -#: ../../library/zipfile.rst:593 msgid "" "Added support for text and binary modes for open. Default mode is now text." msgstr "" +"open でテキストモードとバイナリモードをサポートしました。\n" +"デフォルトはテキストモードになりました。" -#: ../../library/zipfile.rst:597 ../../library/zipfile.rst:658 msgid "" "The ``encoding`` parameter can be supplied as a positional argument without " "causing a :exc:`TypeError`. As it could in 3.9. Code needing to be " "compatible with unpatched 3.10 and 3.11 versions must pass all :class:`io." "TextIOWrapper` arguments, ``encoding`` included, as keywords." msgstr "" +"3.9 と同様に、``encoding`` 引数を位置引数で渡しても :exc:`TypeError` が発生し" +"なくなりました。\n" +"修正前の 3.10 や 3.11 との互換性が必要なコードでは、``encoding`` を含む :" +"class:`io.TextIOWrapper` の引数をすべてキーワード引数として渡してください。" -#: ../../library/zipfile.rst:605 msgid "Enumerate the children of the current directory." -msgstr "" +msgstr "現在のディレクトリの子を列挙します。" -#: ../../library/zipfile.rst:609 msgid "Return ``True`` if the current context references a directory." -msgstr "" +msgstr "現在の対象がディレクトリを指していれば ``True`` を返します。" -#: ../../library/zipfile.rst:613 msgid "Return ``True`` if the current context references a file." -msgstr "" +msgstr "現在の対象がファイルを指していれば ``True`` を返します。" -#: ../../library/zipfile.rst:617 msgid "Return ``True`` if the current context references a symbolic link." -msgstr "" +msgstr "現在の対象がシンボリックリンクを指していれば ``True`` を返します。" -#: ../../library/zipfile.rst:621 msgid "Previously, ``is_symlink`` would unconditionally return ``False``." -msgstr "" +msgstr "以前は ``is_symlink`` は無条件に ``False`` を返していました。" -#: ../../library/zipfile.rst:626 msgid "" "Return ``True`` if the current context references a file or directory in the " "zip file." msgstr "" +"現在の対象が zip ファイル内のファイルまたはディレクトリを指していれば " +"``True`` を返します。" -#: ../../library/zipfile.rst:631 msgid "" "The last dot-separated portion of the final component, if any. This is " "commonly called the file extension." msgstr "" +"パスの最後の要素にドットが含まれる場合、その最後のドットから後ろの部分で" +"す。\n" +"一般にファイル拡張子と呼ばれます。" -#: ../../library/zipfile.rst:634 msgid "Added :data:`Path.suffix` property." -msgstr "" +msgstr ":data:`Path.suffix` プロパティを追加しました。" -#: ../../library/zipfile.rst:639 msgid "The final path component, without its suffix." -msgstr "" +msgstr "パスの最後の要素から拡張子を取り除いたもの。" -#: ../../library/zipfile.rst:641 msgid "Added :data:`Path.stem` property." -msgstr "" +msgstr ":data:`Path.stem` プロパティを追加しました。" -#: ../../library/zipfile.rst:646 msgid "A list of the path’s suffixes, commonly called file extensions." msgstr "" +"パスのサフィックスのリストです。\n" +"サフィックスは一般にファイル拡張子と呼ばれます。" -#: ../../library/zipfile.rst:648 msgid "Added :data:`Path.suffixes` property." -msgstr "" +msgstr ":data:`Path.suffixes` プロパティを追加しました。" -#: ../../library/zipfile.rst:653 msgid "" "Read the current file as unicode text. Positional and keyword arguments are " "passed through to :class:`io.TextIOWrapper` (except ``buffer``, which is " "implied by the context)." msgstr "" +"現在のファイルを Unicode テキストとして読み込みます。\n" +"位置引数とキーワード引数は :class:`io.TextIOWrapper` に渡されます " +"(``buffer`` は現在の対象から決まるため除きます)。" -#: ../../library/zipfile.rst:666 msgid "Read the current file as bytes." -msgstr "" +msgstr "現在のファイルをバイト列として読み込みます。" -#: ../../library/zipfile.rst:670 msgid "" "Return a new Path object with each of the *other* arguments joined. The " "following are equivalent::" msgstr "" +"各 *other* 引数を結合した新しい Path オブジェクトを返します。\n" +"次の記述は同じ意味です。 ::" -#: ../../library/zipfile.rst:673 msgid "" ">>> Path(...).joinpath('child').joinpath('grandchild')\n" ">>> Path(...).joinpath('child', 'grandchild')\n" ">>> Path(...) / 'child' / 'grandchild'" msgstr "" +">>> Path(...).joinpath('child').joinpath('grandchild')\n" +">>> Path(...).joinpath('child', 'grandchild')\n" +">>> Path(...) / 'child' / 'grandchild'" -#: ../../library/zipfile.rst:677 msgid "" "Prior to 3.10, ``joinpath`` was undocumented and accepted exactly one " "parameter." msgstr "" +"3.10 より前では ``joinpath`` はドキュメント化されておらず、引数を 1 つだけ受" +"け付けていました。" -#: ../../library/zipfile.rst:681 msgid "" "The :pypi:`zipp` project provides backports of the latest path object " "functionality to older Pythons. Use ``zipp.Path`` in place of ``zipfile." "Path`` for early access to changes." msgstr "" +":pypi:`zipp` プロジェクトは、最新の Path オブジェクトの機能を古い Python に" +"バックポートしています。\n" +"変更をいち早く利用するには、``zipfile.Path`` の代わりに ``zipp.Path`` を使っ" +"てください。" #: ../../library/zipfile.rst:689 msgid "PyZipFile Objects" @@ -937,9 +1041,8 @@ msgstr "" ":class:`PyZipFile` コンストラクタは :class:`ZipFile` コンストラクタと同じパラ" "メータに加え、*optimize* パラメータをとります。" -#: ../../library/zipfile.rst:697 msgid "Added the *optimize* parameter." -msgstr "" +msgstr "*optimize* 引数を追加しました。" #: ../../library/zipfile.rst:703 msgid "" @@ -948,12 +1051,11 @@ msgstr "" "インスタンスは :class:`ZipFile` オブジェクトのメソッドの他に、追加のメソッド" "を 1 個持ちます:" -#: ../../library/zipfile.rst:707 msgid "" "Search for files :file:`\\*.py` and add the corresponding file to the " "archive." msgstr "" -":file:`\\*.py` ファイルを探し、一致するファイルをアーカイブに追加します。" +":file:`\\*.py` ファイルを探し、対応するファイルをアーカイブに追加します。" #: ../../library/zipfile.rst:710 msgid "" @@ -974,7 +1076,6 @@ msgstr "" "場合、それを最適化レベル (:func:`compile` 参照) とするファイルのみが、必要に" "応じてコンパイルされアーカイブに追加されます。" -#: ../../library/zipfile.rst:717 msgid "" "If *pathname* is a file, the filename must end with :file:`.py`, and just " "the (corresponding :file:`\\*.pyc`) file is added at the top level (no path " @@ -986,12 +1087,21 @@ msgid "" "subdirectories are package directories, all of these are added recursively " "in sorted order." msgstr "" +"*pathname* がファイルの場合、ファイル名は :file:`.py` で終わる必要があり、対" +"応する :file:`\\*.pyc` ファイルだけがパス情報なしで最上位に追加されます。\n" +"*pathname* が :file:`.py` で終わらないファイルの場合は :exc:`RuntimeError` が" +"送出されます。\n" +"ディレクトリであって、パッケージディレクトリではない場合は、すべての :file:" +"`\\*.pyc` ファイルが最上位に追加されます。\n" +"パッケージディレクトリの場合は、パッケージ名をパスとしてその下にすべての :" +"file:`\\*.pyc` ファイルが追加されます。\n" +"サブディレクトリもパッケージディレクトリであれば、ソート順で再帰的に追加され" +"ます。" #: ../../library/zipfile.rst:727 msgid "*basename* is intended for internal use only." msgstr "*basename* は内部が使用するためだけのものです。" -#: ../../library/zipfile.rst:729 msgid "" "*filterfunc*, if given, must be a function taking a single string argument. " "It will be passed each path (including each individual full file path) " @@ -1001,11 +1111,13 @@ msgid "" "directories or start with the string ``test_``, we can use a *filterfunc* to " "exclude them::" msgstr "" -"*filterfunc* を与える場合、単一の文字列引数を取る関数を渡してください。これに" -"は(個々のフルパスを含む)それぞれのパスがアーカイブに加えられる前に渡されま" -"す。 *filterfunc* が偽を返せば、そのパスはアーカイブに追加されず、ディレクト" -"リだった場合はその中身が無視されます。例として、私たちのテストファイルが全て " -"``test`` ディレクトリの中にあるか、 ``test`` 文字列で始まるとしましょう。 " +"*filterfunc* を与える場合、単一の文字列引数を取る関数を渡してください。\n" +"これには(個々のフルパスを含む)それぞれのパスがアーカイブに加えられる前に渡さ" +"れます。\n" +"*filterfunc* が偽を返せば、そのパスはアーカイブに追加されず、ディレクトリだっ" +"た場合はその中身が無視されます。\n" +"例として、私たちのテストファイルが全て ``test`` ディレクトリの中にあるか、 " +"``test_`` 文字列で始まるとしましょう。\n" "*filterfunc* を使ってそれらを除外出来ます::" #: ../../library/zipfile.rst:737 @@ -1023,7 +1135,6 @@ msgid "The :meth:`writepy` method makes archives with file names like this::" msgstr "" ":meth:`writepy` メソッドは以下のようなファイル名でアーカイブを作成します::" -#: ../../library/zipfile.rst:747 msgid "" "string.pyc # Top level name\n" "test/__init__.pyc # Package directory\n" @@ -1031,19 +1142,22 @@ msgid "" "test/bogus/__init__.pyc # Subpackage directory\n" "test/bogus/myfile.pyc # Submodule test.bogus.myfile" msgstr "" +"string.pyc # 最上位の名前\n" +"test/__init__.pyc # パッケージディレクトリ\n" +"test/testall.pyc # モジュール test.testall\n" +"test/bogus/__init__.pyc # サブパッケージディレクトリ\n" +"test/bogus/myfile.pyc # サブモジュール test.bogus.myfile" -#: ../../library/zipfile.rst:753 msgid "Added the *filterfunc* parameter." -msgstr "" +msgstr "*filterfunc* 引数を追加しました。" #: ../../library/zipfile.rst:756 msgid "The *pathname* parameter accepts a :term:`path-like object`." msgstr "" "*pathname* 引数が :term:`path-like object` を受け付けるようになりました。" -#: ../../library/zipfile.rst:759 msgid "Recursion sorts directory entries." -msgstr "" +msgstr "再帰処理でディレクトリエントリーをソートするようになりました。" #: ../../library/zipfile.rst:766 msgid "ZipInfo Objects" @@ -1059,37 +1173,41 @@ msgstr "" "meth:`.getinfo` および :meth:`.infolist` メソッドによって返されます。各オブ" "ジェクトは ZIP アーカイブ内の 1 個のメンバに関する情報を格納します。" -#: ../../library/zipfile.rst:772 msgid "" "There is one classmethod to make a :class:`ZipInfo` instance for a " "filesystem file:" msgstr "" +"ファイルシステム上のファイルから :class:`ZipInfo` インスタンスを作成するクラ" +"スメソッドが 1 つあります。" -#: ../../library/zipfile.rst:778 msgid "" "Construct a :class:`ZipInfo` instance for a file on the filesystem, in " "preparation for adding it to a zip file." msgstr "" +"zip ファイルに追加する準備として、ファイルシステム上のファイルに対する :" +"class:`ZipInfo` インスタンスを作成します。" -#: ../../library/zipfile.rst:781 msgid "*filename* should be the path to a file or directory on the filesystem." msgstr "" +"*filename* はファイルシステム上のファイルまたはディレクトリへのパスでなければ" +"なりません。" -#: ../../library/zipfile.rst:783 msgid "" "If *arcname* is specified, it is used as the name within the archive. If " "*arcname* is not specified, the name will be the same as *filename*, but " "with any drive letter and leading path separators removed." msgstr "" +"*arcname* を指定した場合は、アーカイブ内の名前として使われます。\n" +"指定しない場合は *filename* からドライブ文字と先頭のパス区切り文字を取り除い" +"た名前が使われます。" #: ../../library/zipfile.rst:795 msgid "The *filename* parameter accepts a :term:`path-like object`." msgstr "" "*filename* 引数が :term:`path-like object` を受け入れるようになりました。" -#: ../../library/zipfile.rst:798 msgid "Added the *strict_timestamps* keyword-only parameter." -msgstr "" +msgstr "キーワード専用引数 *strict_timestamps* を追加しました。" #: ../../library/zipfile.rst:802 msgid "Instances have the following methods and attributes:" @@ -1099,9 +1217,10 @@ msgstr "インスタンスは以下のメソッドと属性を持ちます:" msgid "Return ``True`` if this archive member is a directory." msgstr "アーカイブのメンバーがディレクトリの場合に ``True`` を返します。" -#: ../../library/zipfile.rst:808 msgid "This uses the entry's name: directories should always end with ``/``." msgstr "" +"エントリーの名前で判定します。\n" +"ディレクトリの名前は常に ``/`` で終わる必要があります。" #: ../../library/zipfile.rst:815 msgid "Name of the file in the archive." @@ -1179,9 +1298,8 @@ msgstr "" msgid "Type of compression for the archive member." msgstr "アーカイブメンバの圧縮形式。" -#: ../../library/zipfile.rst:851 msgid "Comment for the individual archive member as a :class:`bytes` object." -msgstr "" +msgstr "個々のアーカイブメンバーのコメントを表す :class:`bytes` オブジェクト。" #: ../../library/zipfile.rst:856 msgid "" @@ -1192,9 +1310,8 @@ msgstr "" "拡張フィールドデータ。この :class:`bytes` オブジェクトに含まれているデータの" "内部構成については、`PKZIP Application Note`_ でコメントされています。" -#: ../../library/zipfile.rst:863 msgid "System which created ZIP archive." -msgstr "ZIP アーカイブを作成したシステムを記述する文字列。" +msgstr "ZIP アーカイブを作成したシステム。" #: ../../library/zipfile.rst:868 msgid "PKZIP version which created ZIP archive." @@ -1252,25 +1369,22 @@ msgstr "" ":mod:`zipfile` モジュールは、 ZIP アーカイブを操作するための簡単なコマンドラ" "インインターフェースを提供しています。" -#: ../../library/zipfile.rst:930 msgid "" "If you want to create a new ZIP archive, specify its name after the :option:" "`-c` option and then list the filename(s) that should be included:" msgstr "" -"ZIP アーカイブを新規に作成したい場合、:option:`-c` オプションの後にまとめたい" -"ファイルを列挙してください:" +"新しい ZIP アーカイブを作成するには、:option:`-c` オプションの直後にアーカイ" +"ブ名を指定し、その後に含めるファイル名を列挙します。" -#: ../../library/zipfile.rst:933 msgid "$ python -m zipfile -c monty.zip spam.txt eggs.txt" -msgstr "" +msgstr "$ python -m zipfile -c monty.zip spam.txt eggs.txt" #: ../../library/zipfile.rst:937 msgid "Passing a directory is also acceptable:" msgstr "ディレクトリを渡すこともできます:" -#: ../../library/zipfile.rst:939 msgid "$ python -m zipfile -c monty.zip life-of-brian_1979/" -msgstr "" +msgstr "$ python -m zipfile -c monty.zip life-of-brian_1979/" #: ../../library/zipfile.rst:943 msgid "" @@ -1280,18 +1394,16 @@ msgstr "" "ZIP アーカイブを特定のディレクトリに展開したい場合、:option:`-e` オプションを" "使用してください:" -#: ../../library/zipfile.rst:946 msgid "$ python -m zipfile -e monty.zip target-dir/" -msgstr "" +msgstr "$ python -m zipfile -e monty.zip target-dir/" #: ../../library/zipfile.rst:950 msgid "For a list of the files in a ZIP archive, use the :option:`-l` option:" msgstr "" "ZIP アーカイブ内のファイル一覧を表示するには :option:`-l` を使用してください:" -#: ../../library/zipfile.rst:952 msgid "$ python -m zipfile -l monty.zip" -msgstr "" +msgstr "$ python -m zipfile -l monty.zip" #: ../../library/zipfile.rst:958 msgid "Command-line options" @@ -1313,73 +1425,77 @@ msgstr "zipfile を対象となるディレクトリに展開します。" msgid "Test whether the zipfile is valid or not." msgstr "zipfile が有効かどうか調べます。" -#: ../../library/zipfile.rst:982 msgid "" "Specify encoding of member names for :option:`-l`, :option:`-e` and :option:" "`-t`." msgstr "" +":option:`-l`、:option:`-e`、:option:`-t` で使うメンバー名のエンコーディングを" +"指定します。" -#: ../../library/zipfile.rst:989 msgid "Decompression pitfalls" -msgstr "" +msgstr "展開時の注意点" -#: ../../library/zipfile.rst:991 msgid "" "The extraction in zipfile module might fail due to some pitfalls listed " "below." msgstr "" +"zipfile モジュールによる展開は、以下のような問題によって失敗する場合がありま" +"す。" -#: ../../library/zipfile.rst:994 msgid "From file itself" -msgstr "" +msgstr "ファイル自体の問題" -#: ../../library/zipfile.rst:996 msgid "" "Decompression may fail due to incorrect password / CRC checksum / ZIP format " "or unsupported compression method / decryption." msgstr "" +"パスワード、CRC チェックサム、ZIP 形式の誤りや、サポートされていない圧縮方式" +"または復号方式によって展開に失敗する場合があります。" #: ../../library/zipfile.rst:1000 msgid "File System limitations" msgstr "" -#: ../../library/zipfile.rst:1002 msgid "" "Exceeding limitations on different file systems can cause decompression " "failed. Such as allowable characters in the directory entries, length of the " "file name, length of the pathname, size of a single file, and number of " "files, etc." msgstr "" +"ファイルシステムごとの制限を超えると、展開に失敗する場合があります。\n" +"ディレクトリエントリーに使用できる文字、ファイル名やパス名の長さ、単一ファイ" +"ルのサイズ、ファイル数などの制限があります。" -#: ../../library/zipfile.rst:1009 msgid "Resources limitations" -msgstr "" +msgstr "リソースの制限" -#: ../../library/zipfile.rst:1011 msgid "" "The lack of memory or disk volume would lead to decompression failed. For " "example, decompression bombs (aka `ZIP bomb`_) apply to zipfile library that " "can cause disk volume exhaustion." msgstr "" +"メモリやディスク容量が不足すると展開に失敗します。\n" +"例えば、zipfile ライブラリでも展開爆弾 (別名 `ZIP bomb`_) によってディスク容" +"量が使い果たされる可能性があります。" -#: ../../library/zipfile.rst:1016 msgid "Interruption" -msgstr "" +msgstr "中断" -#: ../../library/zipfile.rst:1018 msgid "" "Interruption during the decompression, such as pressing control-C or killing " "the decompression process may result in incomplete decompression of the " "archive." msgstr "" +"Control-C を押す、展開を行うプロセスを終了させるなど、展開中に処理が中断され" +"ると、アーカイブの展開が不完全な状態になる場合があります。" -#: ../../library/zipfile.rst:1022 msgid "Default behaviors of extraction" -msgstr "" +msgstr "展開時のデフォルトの動作" -#: ../../library/zipfile.rst:1024 msgid "" "Not knowing the default extraction behaviors can cause unexpected " "decompression results. For example, when extracting the same archive twice, " "it overwrites files without asking." msgstr "" +"展開時のデフォルトの動作を知らないと、予想外の結果になることがあります。\n" +"例えば同じアーカイブを 2 回展開すると、確認せずにファイルを上書きします。" diff --git a/library/zipimport.po b/library/zipimport.po index 3712ff722..1dd09fa82 100644 --- a/library/zipimport.po +++ b/library/zipimport.po @@ -19,10 +19,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/zipimport.rst:2 @@ -82,9 +82,8 @@ msgstr "" "`.pyc` がない場合は、インポートが多少遅くなるかもしれないので注意してくださ" "い。" -#: ../../library/zipimport.rst:33 msgid "ZIP64 is supported" -msgstr "" +msgstr "ZIP64 をサポートしました。" #: ../../library/zipimport.rst:36 msgid "Previously, ZIP archives with an archive comment were not supported." @@ -125,12 +124,12 @@ msgstr "" #: ../../library/zipimport.rst:50 msgid ":mod:`importlib` - The implementation of the import machinery" -msgstr ":mod:`importlib` - :keyword:`import` の実装" +msgstr ":mod:`importlib` - ``import`` の実装" -#: ../../library/zipimport.rst:51 msgid "" "Package providing the relevant protocols for all importers to implement." msgstr "" +"すべてのインポーターが実装するための関連プロトコルを提供するパッケージ。" #: ../../library/zipimport.rst:55 msgid "This module defines an exception:" @@ -174,17 +173,20 @@ msgstr "" "*archivepath* が有効な ZIP アーカイブを指していない場合、 :exc:" "`ZipImportError` を送出します。" -#: ../../library/zipimport.rst:82 msgid "" "Methods ``find_loader()`` and ``find_module()``, deprecated in 3.10 are now " "removed. Use :meth:`find_spec` instead." msgstr "" +"3.10 で非推奨になった ``find_loader()`` メソッドと ``find_module()`` メソッド" +"を削除しました。\n" +"代わりに :meth:`find_spec` を使ってください。" -#: ../../library/zipimport.rst:87 msgid "" "Implementation of :meth:`importlib.abc.Loader.create_module` that returns :" "const:`None` to explicitly request the default semantics." msgstr "" +":meth:`importlib.abc.Loader.create_module` の実装で、:const:`None` を返してデ" +"フォルトの動作を明示的に要求します。" #: ../../library/zipimport.rst:95 msgid "Implementation of :meth:`importlib.abc.Loader.exec_module`." @@ -254,11 +256,12 @@ msgstr "" msgid "Use :meth:`exec_module` instead." msgstr "代わりに :meth:`exec_module` を使用してください。" -#: ../../library/zipimport.rst:158 msgid "" "Clear out the internal cache of information about files found within the ZIP " "archive." msgstr "" +"ZIP アーカイブ内のファイルに関する情報を保持する内部キャッシュをクリアしま" +"す。" #: ../../library/zipimport.rst:166 msgid "" diff --git a/library/zlib.po b/library/zlib.po index 9c0f9c16f..5926debe3 100644 --- a/library/zlib.po +++ b/library/zlib.po @@ -20,10 +20,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/zlib.rst:2 @@ -93,9 +93,8 @@ msgstr "" "やデジタル署名などに用いるべきではありません。また、チェックサムアルゴリズム" "として設計されているため、汎用のハッシュアルゴリズムには向きません。" -#: ../../library/zlib.rst:44 ../../library/zlib.rst:136 msgid "The result is always unsigned." -msgstr "" +msgstr "結果は常に符号なしになりました。" #: ../../library/zlib.rst:49 msgid "" @@ -117,40 +116,44 @@ msgid "" "defaulting to ``15`` (MAX_WBITS):" msgstr "" -#: ../../library/zlib.rst:63 msgid "" "+9 to +15: The base-two logarithm of the window size, which therefore ranges " "between 512 and 32768. Larger values produce better compression at the " "expense of greater memory usage. The resulting output will include a zlib-" "specific header and trailer." msgstr "" +"+9 から +15: ウィンドウサイズの 2 を底とする対数です。\n" +"ウィンドウサイズは 512 から 32768 の範囲になります。\n" +"大きい値ほど圧縮率が高くなりますが、より多くのメモリを消費します。\n" +"出力には zlib 固有のヘッダーとトレーラーが含まれます。" -#: ../../library/zlib.rst:68 msgid "" "−9 to −15: Uses the absolute value of *wbits* as the window size logarithm, " "while producing a raw output stream with no header or trailing checksum." msgstr "" +"−9 から −15: *wbits* の絶対値をウィンドウサイズの対数として使い、ヘッダーや末" +"尾のチェックサムを含まない生のストリームを出力します。" -#: ../../library/zlib.rst:72 msgid "" "+25 to +31 = 16 + (9 to 15): Uses the low 4 bits of the value as the window " "size logarithm, while including a basic :program:`gzip` header and trailing " "checksum in the output." msgstr "" +"+25 から +31 = 16 + (9 から 15): 値の下位 4 ビットをウィンドウサイズの対数と" +"して使い、基本的な :program:`gzip` ヘッダーと末尾のチェックサムを出力に含めま" +"す。" -#: ../../library/zlib.rst:76 msgid "Raises the :exc:`error` exception if any error occurs." -msgstr "" +msgstr "エラーが発生すると :exc:`error` 例外を送出します。" -#: ../../library/zlib.rst:78 msgid "*level* can now be used as a keyword parameter." -msgstr "" +msgstr "*level* をキーワード引数として使えるようになりました。" -#: ../../library/zlib.rst:81 msgid "" "The *wbits* parameter is now available to set window bits and compression " "type." msgstr "" +"*wbits* 引数でウィンドウのビット数と圧縮形式を設定できるようになりました。" #: ../../library/zlib.rst:87 msgid "" @@ -185,12 +188,14 @@ msgstr "" "*method* は圧縮アルゴリズムです。現在、 :const:`DEFLATED` のみサポートされて" "います。" -#: ../../library/zlib.rst:100 msgid "" "The *wbits* parameter controls the size of the history buffer (or the " "\"window size\"), and what header and trailer format will be used. It has " "the same meaning as `described for compress() <#compress-wbits>`__." msgstr "" +"*wbits* 引数は、履歴バッファのサイズ (ウィンドウサイズ) と、使用するヘッダー" +"とトレーラーの形式を制御します。\n" +"`compress() の説明 <#compress-wbits>`__ と同じ意味です。" #: ../../library/zlib.rst:104 msgid "" @@ -248,7 +253,6 @@ msgstr "" "ムアルゴリズムとして設計されているため、汎用のハッシュアルゴリズムには向きま" "せん。" -#: ../../library/zlib.rst:141 msgid "" "Decompresses the bytes in *data*, returning a bytes object containing the " "uncompressed data. The *wbits* parameter depends on the format of *data*, " @@ -256,45 +260,58 @@ msgid "" "initial size of the output buffer. Raises the :exc:`error` exception if any " "error occurs." msgstr "" +"*data* のバイト列を展開し、展開済みのデータを含む bytes オブジェクトを返しま" +"す。\n" +"*wbits* 引数の値は *data* の形式に依存します。\n" +"詳細は後述します。\n" +"*bufsize* を指定すると、出力バッファの初期サイズとして使われます。\n" +"エラーが発生すると :exc:`error` 例外を送出します。" -#: ../../library/zlib.rst:149 msgid "" "The *wbits* parameter controls the size of the history buffer (or \"window " "size\"), and what header and trailer format is expected. It is similar to " "the parameter for :func:`compressobj`, but accepts more ranges of values:" msgstr "" +"*wbits* 引数は、履歴バッファのサイズ (ウィンドウサイズ) と、入力に想定する" +"ヘッダーとトレーラーの形式を制御します。\n" +":func:`compressobj` の引数と似ていますが、より多くの範囲の値を受け付けます。" -#: ../../library/zlib.rst:154 msgid "" "+8 to +15: The base-two logarithm of the window size. The input must " "include a zlib header and trailer." msgstr "" +"+8 から +15: ウィンドウサイズの 2 を底とする対数です。\n" +"入力には zlib のヘッダーとトレーラーが含まれていなければなりません。" -#: ../../library/zlib.rst:157 msgid "" "0: Automatically determine the window size from the zlib header. Only " "supported since zlib 1.2.3.5." msgstr "" +"0: zlib ヘッダーからウィンドウサイズを自動的に判定します。\n" +"zlib 1.2.3.5 以降でのみサポートされています。" -#: ../../library/zlib.rst:160 msgid "" "−8 to −15: Uses the absolute value of *wbits* as the window size logarithm. " "The input must be a raw stream with no header or trailer." msgstr "" +"−8 から −15: *wbits* の絶対値をウィンドウサイズの対数として使います。\n" +"入力はヘッダーやトレーラーを含まない生のストリームでなければなりません。" -#: ../../library/zlib.rst:163 msgid "" "+24 to +31 = 16 + (8 to 15): Uses the low 4 bits of the value as the window " "size logarithm. The input must include a gzip header and trailer." msgstr "" +"+24 から +31 = 16 + (8 から 15): 値の下位 4 ビットをウィンドウサイズの対数と" +"して使います。\n" +"入力には gzip のヘッダーとトレーラーが含まれていなければなりません。" -#: ../../library/zlib.rst:167 msgid "" "+40 to +47 = 32 + (8 to 15): Uses the low 4 bits of the value as the window " "size logarithm, and automatically accepts either the zlib or gzip format." msgstr "" +"+40 から +47 = 32 + (8 から 15): 値の下位 4 ビットをウィンドウサイズの対数と" +"して使い、zlib 形式と gzip 形式の両方を自動的に受け付けます。" -#: ../../library/zlib.rst:171 msgid "" "When decompressing a stream, the window size must not be smaller than the " "size originally used to compress the stream; using a too-small value may " @@ -302,6 +319,11 @@ msgid "" "to the largest window size and requires a zlib header and trailer to be " "included." msgstr "" +"ストリームを展開する際、ウィンドウサイズは圧縮時に使われたサイズ以上でなけれ" +"ばなりません。\n" +"小さすぎる値を使うと :exc:`error` 例外が発生する場合があります。\n" +"*wbits* のデフォルト値は最大のウィンドウサイズに対応し、入力には zlib のヘッ" +"ダーとトレーラーが必要です。" #: ../../library/zlib.rst:177 msgid "" @@ -315,9 +337,8 @@ msgstr "" "要はありません。この値のチューニングでできることは、:c:func:`malloc` が呼ばれ" "る回数を数回減らすことぐらいです。" -#: ../../library/zlib.rst:182 msgid "*wbits* and *bufsize* can be used as keyword arguments." -msgstr "" +msgstr "*wbits* と *bufsize* をキーワード引数として使えるようになりました。" #: ../../library/zlib.rst:187 msgid "" @@ -327,12 +348,14 @@ msgstr "" "一度にメモリ上に置くことができないようなデータストリームを展開するための展開" "オブジェクトを返します。" -#: ../../library/zlib.rst:190 msgid "" "The *wbits* parameter controls the size of the history buffer (or the " "\"window size\"), and what header and trailer format is expected. It has " "the same meaning as `described for decompress() <#decompress-wbits>`__." msgstr "" +"*wbits* 引数は、履歴バッファのサイズ (ウィンドウサイズ) と、入力に想定する" +"ヘッダーとトレーラーの形式を制御します。\n" +"`decompress() の説明 <#decompress-wbits>`__ と同じ意味です。" #: ../../library/zlib.rst:194 msgid "" @@ -362,17 +385,17 @@ msgstr "パラメータに *zdict* を追加しました。" msgid "Compression objects support the following methods:" msgstr "圧縮オブジェクトは以下のメソッドをサポートしています:" -#: ../../library/zlib.rst:213 msgid "" "Compress *data*, returning a bytes object containing compressed data for at " "least part of the data in *data*. This data should be concatenated to the " "output produced by any preceding calls to the :meth:`compress` method. Some " "input may be kept in internal buffers for later processing." msgstr "" -"*data* を圧縮し、圧縮されたデータを含むバイト列オブジェクトを返します。この文" -"字列は少なくとも *data* の一部分のデータに対する圧縮データを含みます。この" -"データは以前に呼んだ :meth:`compress` が返した出力と結合することができます。" -"入力の一部は以後の処理のために内部バッファに保存されることもあります。" +"*data* を圧縮し、その少なくとも一部に対応する圧縮データを含むバイト列オブジェ" +"クトを返します。\n" +"返されたデータは、以前の :meth:`compress` メソッドの呼び出しで得た出力に連結" +"する必要があります。\n" +"入力の一部は、後で処理するために内部バッファに保持されることがあります。" #: ../../library/zlib.rst:221 msgid "" @@ -406,11 +429,12 @@ msgstr "" "圧縮オブジェクトのコピーを返します。これを使うと先頭部分が共通している複数の" "データを効率的に圧縮することができます。" -#: ../../library/zlib.rst:238 msgid "" "Added :func:`copy.copy` and :func:`copy.deepcopy` support to compression " "objects." msgstr "" +"圧縮オブジェクトで :func:`copy.copy` と :func:`copy.deepcopy` をサポートしま" +"した。" #: ../../library/zlib.rst:243 msgid "Decompression objects support the following methods and attributes:" @@ -456,7 +480,6 @@ msgstr "" "これは、正常な形式の圧縮ストリームと、不完全あるいは切り詰められたストリーム" "とを区別することを可能にします。" -#: ../../library/zlib.rst:276 msgid "" "Decompress *data*, returning a bytes object containing the uncompressed data " "corresponding to at least part of the data in *string*. This data should be " @@ -464,10 +487,12 @@ msgid "" "`decompress` method. Some of the input data may be preserved in internal " "buffers for later processing." msgstr "" -"*data* を展開し、少なくとも *string* の一部分に対応する展開されたデータを含む" -"バイト列オブジェクトを返します。このデータは以前に :meth:`decompress` メソッ" -"ドを呼んだ時に返された出力と結合することができます。入力データの一部分が以後" -"の処理のために内部バッファに保存されることもあります。" +"*data* を展開し、少なくとも *string* の一部に対応する展開済みデータを含む " +"bytes オブジェクトを返します。\n" +"このデータは、以前の :meth:`decompress` 呼び出しで得た出力に連結する必要があ" +"ります。\n" +"入力データの一部は、後で処理するために内部バッファに保持される場合がありま" +"す。" #: ../../library/zlib.rst:282 msgid "" @@ -486,21 +511,20 @@ msgstr "" "の :meth:`decompress` 呼び出しに渡さなくてはなりません。 *max_length* が 0 の" "場合、全ての入力が展開され、 :attr:`unconsumed_tail` 属性は空になります。" -#: ../../library/zlib.rst:289 msgid "*max_length* can be used as a keyword argument." -msgstr "" +msgstr "*max_length* をキーワード引数として使えるようになりました。" -#: ../../library/zlib.rst:295 msgid "" "All pending input is processed, and a bytes object containing the remaining " "uncompressed output is returned. After calling :meth:`flush`, the :meth:" "`decompress` method cannot be called again; the only realistic action is to " "delete the object." msgstr "" -"未処理の入力データをすべて処理し、最終的に圧縮されなかった残りの出力バイト列" -"オブジェクトを返します。:meth:`flush` を呼んだ後、:meth:`decompress` を再度呼" -"ぶべきではありません。このときできる唯一の現実的な操作はオブジェクトの削除だ" -"けです。" +"未処理の入力をすべて処理し、残りの展開済みデータを含むバイト列オブジェクトを" +"返します。\n" +":meth:`flush` を呼び出した後は :meth:`decompress` を再度呼び出すことはできま" +"せん。\n" +"その後にできる現実的な操作は、オブジェクトを削除することだけです。" #: ../../library/zlib.rst:300 msgid "" @@ -517,11 +541,12 @@ msgstr "" "展開オブジェクトの状態を保存でき、未来のある時点で行なわれるストリームのラン" "ダムなシークをスピードアップするのに利用できます。" -#: ../../library/zlib.rst:310 msgid "" "Added :func:`copy.copy` and :func:`copy.deepcopy` support to decompression " "objects." msgstr "" +"展開オブジェクトで :func:`copy.copy` と :func:`copy.deepcopy` をサポートしま" +"した。" #: ../../library/zlib.rst:315 msgid "" @@ -545,18 +570,21 @@ msgid "" "The version string of the zlib library actually loaded by the interpreter." msgstr "インタプリタが読み込んだ実際の zlib ライブラリのバージョン文字列です。" -#: ../../library/zlib.rst:335 msgid "" "The version string of the zlib-ng library that was used for building the " "module if zlib-ng was used. When present, the :data:`ZLIB_VERSION` and :data:" "`ZLIB_RUNTIME_VERSION` constants reflect the version of the zlib API " "provided by zlib-ng." msgstr "" +"zlib-ng を使ってこのモジュールをビルドした場合、その zlib-ng ライブラリのバー" +"ジョン文字列です。\n" +"この定数がある場合、:data:`ZLIB_VERSION` 定数と :data:`ZLIB_RUNTIME_VERSION` " +"定数は zlib-ng が提供する zlib API のバージョンを表します。" -#: ../../library/zlib.rst:340 msgid "" "If zlib-ng was not used to build the module, this constant will be absent." msgstr "" +"zlib-ng を使わずにこのモジュールをビルドした場合、この定数は存在しません。" #: ../../library/zlib.rst:347 msgid "Module :mod:`gzip`" @@ -584,11 +612,12 @@ msgid "" "functions." msgstr "zlib ライブラリの多くの関数の意味と使い方を解説したマニュアル。" -#: ../../library/zlib.rst:357 msgid "" "In case gzip (de)compression is a bottleneck, the `python-isal`_ package " "speeds up (de)compression with a mostly compatible API." msgstr "" +"gzip の圧縮や展開がボトルネックとなる場合、`python-isal`_ パッケージを使う" +"と、ほぼ互換性のある API で圧縮や展開を高速化できます。" #: ../../library/zlib.rst:123 msgid "Cyclic Redundancy Check" diff --git a/library/zoneinfo.po b/library/zoneinfo.po index cac01ea31..d8d7ddac7 100644 --- a/library/zoneinfo.po +++ b/library/zoneinfo.po @@ -19,10 +19,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../library/zoneinfo.rst:2 @@ -71,9 +71,8 @@ msgstr "" "CPythonコアデベロッパーによってメンテナンスされているファーストパーティーの" "パッケージ。タイムゾーンデータを供給し、PyPIで配布されている。" -#: ../../includes/wasm-notavail.rst:3 msgid "Availability" -msgstr "" +msgstr "利用可能な環境" #: ../../includes/wasm-notavail.rst:5 msgid "" @@ -87,7 +86,6 @@ msgstr "" msgid "Using ``ZoneInfo``" msgstr "``ZoneInfo`` を使用する" -#: ../../library/zoneinfo.rst:37 msgid "" ":class:`ZoneInfo` is a concrete implementation of the :class:`datetime." "tzinfo` abstract base class, and is intended to be attached to ``tzinfo``, " @@ -95,10 +93,11 @@ msgid "" "replace>` method or :meth:`datetime.astimezone `::" msgstr "" -":class:`ZoneInfo` は :class:`datetime.tzinfo` 抽象基底クラスの具体的な実装で" -"あり、``tzinfo`` に指定することを想定しています。コンストラクタ、:meth:" -"`datetime.replace ` メソッド、:meth:`datetime." -"astimezone ` メソッドのいずれかで指定します。" +":class:`ZoneInfo` は :class:`datetime.tzinfo` 抽象基底クラスの具象実装であ" +"り、``tzinfo`` に指定することを想定しています。\n" +"コンストラクタ、:meth:`datetime.replace ` メソッ" +"ド、:meth:`datetime.astimezone ` メソッドのいず" +"れかで指定します。 ::" #: ../../library/zoneinfo.rst:42 msgid "" @@ -114,11 +113,12 @@ msgid "" "'PDT'" msgstr "" -#: ../../library/zoneinfo.rst:52 msgid "" "Datetimes constructed in this way are compatible with datetime arithmetic " "and handle daylight saving time transitions with no further intervention::" msgstr "" +"このように作成した datetime は日時の演算に対応し、追加の処理なしで夏時間への" +"移行や夏時間からの移行を扱えます。 ::" #: ../../library/zoneinfo.rst:55 msgid "" @@ -131,7 +131,6 @@ msgid "" "'PST'" msgstr "" -#: ../../library/zoneinfo.rst:63 msgid "" "These time zones also support the :attr:`~datetime.datetime.fold` attribute " "introduced in :pep:`495`. During offset transitions which induce ambiguous " @@ -139,6 +138,12 @@ msgid "" "offset from *before* the transition is used when ``fold=0``, and the offset " "*after* the transition is used when ``fold=1``, for example::" msgstr "" +"これらのタイムゾーンは :pep:`495` で導入された :attr:`~datetime.datetime." +"fold` 属性もサポートしています。\n" +"夏時間から標準時への移行のように、オフセットの変更によって曖昧な時刻が生じる" +"場合、``fold=0`` では変更 *前* のオフセット、``fold=1`` では変更 *後* のオフ" +"セットが使われます。\n" +"例えば次のようになります。 ::" #: ../../library/zoneinfo.rst:69 msgid "" @@ -150,11 +155,10 @@ msgid "" "2020-11-01 01:00:00-08:00" msgstr "" -#: ../../library/zoneinfo.rst:76 msgid "" "When converting from another time zone, the fold will be set to the correct " "value::" -msgstr "" +msgstr "別のタイムゾーンから変換すると、``fold`` は正しい値に設定されます。 ::" #: ../../library/zoneinfo.rst:79 msgid "" @@ -175,7 +179,6 @@ msgstr "" msgid "Data sources" msgstr "データソース" -#: ../../library/zoneinfo.rst:94 msgid "" "The ``zoneinfo`` module does not directly provide time zone data, and " "instead pulls time zone information from the system time zone database or " @@ -186,42 +189,53 @@ msgid "" "system data nor tzdata are available, all calls to :class:`ZoneInfo` will " "raise :exc:`ZoneInfoNotFoundError`." msgstr "" +"``zoneinfo`` モジュールはタイムゾーンデータを直接提供せず、システムのタイム" +"ゾーンデータベース、または利用可能であれば PyPI 上の公式パッケージ :pypi:" +"`tzdata` からタイムゾーン情報を取得します。\n" +"特に Windows など、一部のシステムでは IANA データベースを利用できません。\n" +"そのため、複数のプラットフォームへの対応を目指し、タイムゾーンデータを必要と" +"するプロジェクトでは、tzdata への依存関係を宣言することを推奨します。\n" +"システムのデータも tzdata も利用できない場合、:class:`ZoneInfo` の呼び出しは" +"すべて :exc:`ZoneInfoNotFoundError` を送出します。" -#: ../../library/zoneinfo.rst:106 msgid "Configuring the data sources" -msgstr "" +msgstr "データソースの設定" -#: ../../library/zoneinfo.rst:108 msgid "" "When ``ZoneInfo(key)`` is called, the constructor first searches the " "directories specified in :data:`TZPATH` for a file matching ``key``, and on " "failure looks for a match in the tzdata package. This behavior can be " "configured in three ways:" msgstr "" +"``ZoneInfo(key)`` を呼び出すと、コンストラクタはまず :data:`TZPATH` で指定さ" +"れたディレクトリから ``key`` に一致するファイルを探し、見つからなければ " +"tzdata パッケージから探します。\n" +"この動作は 3 通りの方法で設定できます。" -#: ../../library/zoneinfo.rst:113 msgid "" "The default :data:`TZPATH` when not otherwise specified can be configured " "at :ref:`compile time `." msgstr "" +"ほかに指定がない場合のデフォルトの :data:`TZPATH` は、:ref:`コンパイル時 " +"` に設定できます。" -#: ../../library/zoneinfo.rst:115 msgid "" ":data:`TZPATH` can be configured using :ref:`an environment variable " "`." msgstr "" +":data:`TZPATH` は :ref:`環境変数 ` で設定でき" +"ます。" -#: ../../library/zoneinfo.rst:117 msgid "" "At :ref:`runtime `, the search path can be " "manipulated using the :func:`reset_tzpath` function." msgstr "" +":ref:`実行時 ` には、:func:`reset_tzpath` 関数" +"で検索パスを操作できます。" -#: ../../library/zoneinfo.rst:123 msgid "Compile-time configuration" -msgstr "" +msgstr "コンパイル時の設定" -#: ../../library/zoneinfo.rst:125 msgid "" "The default :data:`TZPATH` includes several common deployment locations for " "the time zone database (except on Windows, where there are no \"well-known\" " @@ -232,26 +246,35 @@ msgid "" "tzpath <--with-tzpath>`), which should be a string delimited by :data:`os." "pathsep`." msgstr "" +":data:`TZPATH` のデフォルト値には、タイムゾーンデータベースが一般に配置される" +"場所がいくつか含まれます (タイムゾーンデータの定番の配置場所がない Windows を" +"除きます)。\n" +"POSIX システムでは、システムのタイムゾーンデータの配置場所が分かっている配布" +"者や Python をソースからビルドする人は、コンパイル時のオプション ``TZPATH`` " +"(通常は :option:`configure フラグ --with-tzpath <--with-tzpath>`) を指定して" +"デフォルトのタイムゾーンパスを変更できます。\n" +"値は :data:`os.pathsep` で区切った文字列でなければなりません。" -#: ../../library/zoneinfo.rst:134 msgid "" "On all platforms, the configured value is available as the ``TZPATH`` key " "in :func:`sysconfig.get_config_var`." msgstr "" +"すべてのプラットフォームで、設定された値は :func:`sysconfig.get_config_var` " +"に ``TZPATH`` キーを渡して取得できます。" -#: ../../library/zoneinfo.rst:140 msgid "Environment configuration" -msgstr "" +msgstr "環境変数による設定" -#: ../../library/zoneinfo.rst:142 msgid "" "When initializing :data:`TZPATH` (either at import time or whenever :func:" "`reset_tzpath` is called with no arguments), the ``zoneinfo`` module will " "use the environment variable ``PYTHONTZPATH``, if it exists, to set the " "search path." msgstr "" +"``zoneinfo`` モジュールは :data:`TZPATH` を初期化するとき (インポート時や、引" +"数なしで :func:`reset_tzpath` が呼び出されるたびに)、環境変数 " +"``PYTHONTZPATH`` があればその値を検索パスの設定に使います。" -#: ../../library/zoneinfo.rst:149 msgid "" "This is an :data:`os.pathsep`-separated string containing the time zone " "search path to use. It must consist of only absolute rather than relative " @@ -261,18 +284,23 @@ msgid "" "other implementations are free to silently ignore the erroneous component or " "raise an exception." msgstr "" +"使用するタイムゾーンの検索パスを :data:`os.pathsep` で区切った文字列です。\n" +"相対パスを含めず、絶対パスのみで構成しなければなりません。\n" +"``PYTHONTZPATH`` に指定された相対パスの要素は使われませんが、それ以外の動作は" +"実装依存です。\n" +"CPython は :exc:`InvalidTZPathWarning` を発生させますが、ほかの実装は不正な要" +"素を黙って無視しても、例外を送出しても構いません。" -#: ../../library/zoneinfo.rst:157 msgid "" "To set the system to ignore the system data and use the tzdata package " "instead, set ``PYTHONTZPATH=\"\"``." msgstr "" +"システムのデータを無視して代わりに tzdata パッケージを使うには、" +"``PYTHONTZPATH=\"\"`` と設定してください。" -#: ../../library/zoneinfo.rst:163 msgid "Runtime configuration" -msgstr "" +msgstr "実行時の設定" -#: ../../library/zoneinfo.rst:165 msgid "" "The TZ search path can also be configured at runtime using the :func:" "`reset_tzpath` function. This is generally not an advisable operation, " @@ -280,12 +308,16 @@ msgid "" "a specific time zone path (or require disabling access to the system time " "zones)." msgstr "" +"タイムゾーンの検索パスは :func:`reset_tzpath` 関数で実行時にも設定できま" +"す。\n" +"通常は推奨されませんが、特定のタイムゾーンパスを使う必要があるテスト関数や、" +"システムのタイムゾーンへのアクセスを無効にする必要があるテスト関数では妥当な" +"使い方です。" #: ../../library/zoneinfo.rst:172 msgid "The ``ZoneInfo`` class" msgstr "``ZoneInfo`` クラス" -#: ../../library/zoneinfo.rst:176 msgid "" "A concrete :class:`datetime.tzinfo` subclass that represents an IANA time " "zone specified by the string ``key``. Calls to the primary constructor will " @@ -293,25 +325,31 @@ msgid "" "cache invalidation via :meth:`ZoneInfo.clear_cache`, for all values of " "``key``, the following assertion will always be true:" msgstr "" -"文字列 ``key`` でIANAタイムゾーンを指定した、具体的な :class:`datetime." -"tzinfo` のサブクラス。Calls to the primary constructor will always return " -"objects that compare identically; put another way, barring cache " -"invalidation via :meth:`ZoneInfo.clear_cache`, for all values of ``key``, " -"the following assertion will always be true:" +"文字列 ``key`` で指定した IANA タイムゾーンを表す、:class:`datetime.tzinfo` " +"の具象サブクラスです。\n" +"同じキーで通常のコンストラクタを呼び出すと、常に同一のオブジェクトを返しま" +"す。\n" +"言い換えると、:meth:`ZoneInfo.clear_cache` でキャッシュを無効にしない限り、ど" +"の ``key`` に対しても次のアサーションは常に成立します。" -#: ../../library/zoneinfo.rst:182 msgid "" "a = ZoneInfo(key)\n" "b = ZoneInfo(key)\n" "assert a is b" msgstr "" +"a = ZoneInfo(key)\n" +"b = ZoneInfo(key)\n" +"assert a is b" -#: ../../library/zoneinfo.rst:188 msgid "" "``key`` must be in the form of a relative, normalized POSIX path, with no up-" "level references. The constructor will raise :exc:`ValueError` if a non-" "conforming key is passed." msgstr "" +"``key`` は上位ディレクトリへの参照を含まない、正規化された POSIX 形式の相対パ" +"スでなければなりません。\n" +"この形式に従わないキーを渡すと、コンストラクタは :exc:`ValueError` を送出しま" +"す。" #: ../../library/zoneinfo.rst:192 msgid "" @@ -325,21 +363,22 @@ msgstr "" msgid "The ``ZoneInfo`` class has two alternate constructors:" msgstr "``ZoneInfo`` クラスには2つの別のコンストラクターがあります:" -#: ../../library/zoneinfo.rst:200 msgid "" "Constructs a ``ZoneInfo`` object from a file-like object returning bytes (e." "g. a file opened in binary mode or an :class:`io.BytesIO` object). Unlike " "the primary constructor, this always constructs a new object." msgstr "" -"file-like オブジェクトが返すbytes(バイナリーモードで開いたファイルや :class:" -"`io.BytesIO` オブジェクト)から ``ZoneInfo`` オブジェクトを構築します。一次" -"コンストラクタと異なり、常に新規オブジェクトを構築します。" +"バイト列を返すファイルライクオブジェクト (バイナリモードで開かれたファイル" +"や :class:`io.BytesIO` オブジェクトなど) から ``ZoneInfo`` オブジェクトを構築" +"します。\n" +"通常のコンストラクタとは異なり、常に新しいオブジェクトを構築します。" -#: ../../library/zoneinfo.rst:204 msgid "" "The ``key`` parameter sets the name of the zone for the purposes of :py:meth:" "`~object.__str__` and :py:meth:`~object.__repr__`." msgstr "" +"``key`` 引数は、:py:meth:`~object.__str__` と :py:meth:`~object.__repr__` で" +"使うタイムゾーンの名前を設定します。" #: ../../library/zoneinfo.rst:207 msgid "" @@ -348,7 +387,6 @@ msgstr "" "このコンストラクタで生成したオブジェクトはpickle化できません(`pickling`_ を" "参照)。" -#: ../../library/zoneinfo.rst:211 msgid "" "An alternate constructor that bypasses the constructor's cache. It is " "identical to the primary constructor, but returns a new object on each call. " @@ -356,63 +394,79 @@ msgid "" "it can also be used to create a system with a different cache invalidation " "strategy." msgstr "" +"コンストラクタのキャッシュを使わない代替コンストラクタです。\n" +"通常のコンストラクタと同じですが、呼び出すたびに新しいオブジェクトを返しま" +"す。\n" +"主にテストやデモに役立ちますが、異なるキャッシュ無効化戦略を持つシステムを作" +"ることもできます。" -#: ../../library/zoneinfo.rst:217 msgid "" "Objects created via this constructor will also bypass the cache of a " "deserializing process when unpickled." msgstr "" +"このコンストラクタで作成したオブジェクトは、アンピクル時にもデシリアライズす" +"るプロセスのキャッシュを使いません。" -#: ../../library/zoneinfo.rst:224 msgid "" "Using this constructor may change the semantics of your datetimes in " "surprising ways, only use it if you know that you need to." msgstr "" +"このコンストラクタを使うと、datetime の動作が予想外に変わる場合があります。\n" +"必要性が分かっている場合にのみ使ってください。" #: ../../library/zoneinfo.rst:227 msgid "The following class methods are also available:" msgstr "次のクラスメソッドもサポートされています:" -#: ../../library/zoneinfo.rst:231 msgid "" "A method for invalidating the cache on the ``ZoneInfo`` class. If no " "arguments are passed, all caches are invalidated and the next call to the " "primary constructor for each key will return a new instance." msgstr "" +"``ZoneInfo`` クラスのキャッシュを無効にするメソッドです。\n" +"引数を渡さない場合はすべてのキャッシュが無効になり、各キーで次に通常のコンス" +"トラクタを呼び出すと新しいインスタンスが返されます。" -#: ../../library/zoneinfo.rst:235 msgid "" "If an iterable of key names is passed to the ``only_keys`` parameter, only " "the specified keys will be removed from the cache. Keys passed to " "``only_keys`` but not found in the cache are ignored." msgstr "" +"``only_keys`` 引数にキー名のイテラブルを渡すと、指定したキーだけがキャッシュ" +"から削除されます。\n" +"``only_keys`` に渡したキーがキャッシュにない場合は無視されます。" -#: ../../library/zoneinfo.rst:243 msgid "" "Invoking this function may change the semantics of datetimes using " "``ZoneInfo`` in surprising ways; this modifies module state and thus may " "have wide-ranging effects. Only use it if you know that you need to." msgstr "" +"この関数を呼び出すと、``ZoneInfo`` を使う datetime の動作が予想外に変わる場合" +"があります。\n" +"モジュールの状態を変更するため、広範囲に影響する可能性があります。\n" +"必要性が分かっている場合にのみ使ってください。" -#: ../../library/zoneinfo.rst:248 msgid "The class has one attribute:" -msgstr "" +msgstr "このクラスには属性が 1 つあります。" -#: ../../library/zoneinfo.rst:252 msgid "" "This is a read-only :term:`attribute` that returns the value of ``key`` " "passed to the constructor, which should be a lookup key in the IANA time " "zone database (e.g. ``America/New_York``, ``Europe/Paris`` or ``Asia/" "Tokyo``)." msgstr "" +"コンストラクタに渡した ``key`` の値を返す読み取り専用の :term:`属性 " +"` です。\n" +"``key`` には IANA タイムゾーンデータベースの検索キー (``America/New_York``、" +"``Europe/Paris``、``Asia/Tokyo`` など) を指定します。" -#: ../../library/zoneinfo.rst:257 msgid "" "For zones constructed from file without specifying a ``key`` parameter, this " "will be set to ``None``." msgstr "" +"``key`` 引数を指定せずにファイルから作成したタイムゾーンでは、``None`` になり" +"ます。" -#: ../../library/zoneinfo.rst:262 msgid "" "Although it is a somewhat common practice to expose these to end users, " "these values are designed to be primary keys for representing the relevant " @@ -420,17 +474,24 @@ msgid "" "Unicode Common Locale Data Repository) can be used to get more user-friendly " "strings from these keys." msgstr "" +"これらの値をエンドユーザーに表示することは比較的よく行われますが、関連するタ" +"イムゾーンを表す主キーとして設計されており、必ずしもユーザーに見せるためのも" +"のではありません。\n" +"CLDR (Unicode Common Locale Data Repository) などのプロジェクトを使うと、これ" +"らのキーからユーザーに分かりやすい文字列を取得できます。" #: ../../library/zoneinfo.rst:269 msgid "String representations" msgstr "文字列表現" -#: ../../library/zoneinfo.rst:271 msgid "" "The string representation returned when calling :py:class:`str` on a :class:" "`ZoneInfo` object defaults to using the :attr:`ZoneInfo.key` attribute (see " "the note on usage in the attribute documentation)::" msgstr "" +":class:`ZoneInfo` オブジェクトに :py:class:`str` を呼び出したときの文字列表現" +"には、デフォルトでは :attr:`ZoneInfo.key` 属性が使われます (属性のドキュメン" +"トにある使用上の注記を参照してください)。 ::" #: ../../library/zoneinfo.rst:275 msgid "" @@ -443,28 +504,32 @@ msgid "" "'2020-04-01T03:15:00+12:00 [Pacific/Kwajalein]'" msgstr "" -#: ../../library/zoneinfo.rst:283 msgid "" "For objects constructed from a file without specifying a ``key`` parameter, " "``str`` falls back to calling :func:`repr`. ``ZoneInfo``'s ``repr`` is " "implementation-defined and not necessarily stable between versions, but it " "is guaranteed not to be a valid ``ZoneInfo`` key." msgstr "" +"``key`` 引数を指定せずにファイルから作成したオブジェクトでは、``str`` は代わ" +"りに :func:`repr` を呼び出します。\n" +"``ZoneInfo`` の ``repr`` の結果は実装依存で、バージョン間で変わらないとは限り" +"ませんが、有効な ``ZoneInfo`` キーにはならないことが保証されます。" -#: ../../library/zoneinfo.rst:291 msgid "Pickle serialization" -msgstr "" +msgstr "pickle によるシリアライズ" -#: ../../library/zoneinfo.rst:293 msgid "" "Rather than serializing all transition data, ``ZoneInfo`` objects are " "serialized by key, and ``ZoneInfo`` objects constructed from files (even " "those with a value for ``key`` specified) cannot be pickled." msgstr "" +"``ZoneInfo`` オブジェクトは、オフセット変更のデータ全体ではなくキーでシリアラ" +"イズされます。\n" +"ファイルから作成した ``ZoneInfo`` オブジェクトは、``key`` の値を指定した場合" +"でもピクル化できません。" -#: ../../library/zoneinfo.rst:297 msgid "The behavior of a ``ZoneInfo`` file depends on how it was constructed:" -msgstr "" +msgstr "``ZoneInfo`` の振る舞いは、どのように作成したかによって異なります。" #: ../../library/zoneinfo.rst:299 msgid "" @@ -477,15 +542,17 @@ msgid "" "following behavior:" msgstr "" -#: ../../library/zoneinfo.rst:307 msgid "" ">>> a = ZoneInfo(\"Europe/Berlin\")\n" ">>> b = pickle.loads(europe_berlin_pkl)\n" ">>> a is b\n" "True" msgstr "" +">>> a = ZoneInfo(\"Europe/Berlin\")\n" +">>> b = pickle.loads(europe_berlin_pkl)\n" +">>> a is b\n" +"True" -#: ../../library/zoneinfo.rst:314 msgid "" "``ZoneInfo.no_cache(key)``: When constructed from the cache-bypassing " "constructor, the ``ZoneInfo`` object is also serialized by key, but when " @@ -494,14 +561,22 @@ msgid "" "constructed from ``ZoneInfo.no_cache(\"Europe/Berlin\")``, one would expect " "the following behavior:" msgstr "" +"``ZoneInfo.no_cache(key)``: キャッシュを使わないコンストラクタで作成した " +"``ZoneInfo`` オブジェクトもキーでシリアライズされますが、デシリアライズ時にも" +"キャッシュを使わないコンストラクタが使われます。\n" +"``europe_berlin_pkl_nc`` が ``ZoneInfo.no_cache(\"Europe/Berlin\")`` から作成" +"した pickle のバイト列であれば、次の動作が期待されます。" -#: ../../library/zoneinfo.rst:321 msgid "" ">>> a = ZoneInfo(\"Europe/Berlin\")\n" ">>> b = pickle.loads(europe_berlin_pkl_nc)\n" ">>> a is b\n" "False" msgstr "" +">>> a = ZoneInfo(\"Europe/Berlin\")\n" +">>> b = pickle.loads(europe_berlin_pkl_nc)\n" +">>> a is b\n" +"False" #: ../../library/zoneinfo.rst:328 msgid "" @@ -512,7 +587,6 @@ msgid "" "key or storing the contents of the file object and serializing that." msgstr "" -#: ../../library/zoneinfo.rst:334 msgid "" "This method of serialization requires that the time zone data for the " "required key be available on both the serializing and deserializing side, " @@ -522,17 +596,24 @@ msgid "" "a ``ZoneInfo`` pickled in an environment with a different version of the " "time zone data." msgstr "" +"このシリアライズ方式では、シリアライズ側とデシリアライズ側の両方で、必要な" +"キーのタイムゾーンデータを利用できなければなりません。\n" +"クラスや関数への参照が両方の環境に存在することを期待するのと同様です。\n" +"また、異なるバージョンのタイムゾーンデータを持つ環境でピクル化した " +"``ZoneInfo`` をアンピクルする場合、結果の一貫性は保証されません。" #: ../../library/zoneinfo.rst:342 msgid "Functions" msgstr "関数" -#: ../../library/zoneinfo.rst:346 msgid "" "Get a set containing all the valid keys for IANA time zones available " "anywhere on the time zone path. This is recalculated on every call to the " "function." msgstr "" +"タイムゾーンの検索パス上で利用可能な IANA タイムゾーンの、有効なキーをすべて" +"含む集合を取得します。\n" +"関数を呼び出すたびに再計算されます。" #: ../../library/zoneinfo.rst:350 msgid "" @@ -541,86 +622,108 @@ msgid "" "directories, or the ``posixrules`` zone." msgstr "" -#: ../../library/zoneinfo.rst:356 msgid "" "This function may open a large number of files, as the best way to determine " "if a file on the time zone path is a valid time zone is to read the \"magic " "string\" at the beginning." msgstr "" +"タイムゾーンの検索パス上のファイルが有効なタイムゾーンかどうかを判定するに" +"は、先頭のマジック文字列を読むのが最適なため、この関数は大量のファイルを開く" +"場合があります。" -#: ../../library/zoneinfo.rst:362 msgid "" "These values are not designed to be exposed to end-users; for user facing " "elements, applications should use something like CLDR (the Unicode Common " "Locale Data Repository) to get more user-friendly strings. See also the " "cautionary note on :attr:`ZoneInfo.key`." msgstr "" +"これらの値はエンドユーザーへの表示用には設計されていません。\n" +"ユーザーに見せる部分では、CLDR (Unicode Common Locale Data Repository) などを" +"使い、より分かりやすい文字列を取得してください。\n" +":attr:`ZoneInfo.key` の注意事項も参照してください。" -#: ../../library/zoneinfo.rst:369 msgid "" "Sets or resets the time zone search path (:data:`TZPATH`) for the module. " "When called with no arguments, :data:`TZPATH` is set to the default value." msgstr "" +"モジュールのタイムゾーン検索パス (:data:`TZPATH`) を設定またはリセットしま" +"す。\n" +"引数なしで呼び出すと、:data:`TZPATH` はデフォルト値に設定されます。" -#: ../../library/zoneinfo.rst:372 msgid "" "Calling ``reset_tzpath`` will not invalidate the :class:`ZoneInfo` cache, " "and so calls to the primary ``ZoneInfo`` constructor will only use the new " "``TZPATH`` in the case of a cache miss." msgstr "" +"``reset_tzpath`` を呼び出しても :class:`ZoneInfo` のキャッシュは無効になりま" +"せん。\n" +"そのため、通常の ``ZoneInfo`` コンストラクタは、キャッシュに対象がない場合に" +"のみ新しい ``TZPATH`` を使います。" -#: ../../library/zoneinfo.rst:376 msgid "" "The ``to`` parameter must be a :term:`sequence` of strings or :class:`os." "PathLike` and not a string, all of which must be absolute paths. :exc:" "`ValueError` will be raised if something other than an absolute path is " "passed." msgstr "" +"``to`` 引数は、文字列または :class:`os.PathLike` からなる :term:`シーケンス " +"` でなければならず、単一の文字列にはできません。\n" +"各要素は絶対パスでなければなりません。\n" +"絶対パス以外を渡すと :exc:`ValueError` が送出されます。" -#: ../../library/zoneinfo.rst:382 msgid "Globals" -msgstr "" +msgstr "グローバル変数" -#: ../../library/zoneinfo.rst:386 msgid "" "A read-only sequence representing the time zone search path -- when " "constructing a ``ZoneInfo`` from a key, the key is joined to each entry in " "the ``TZPATH``, and the first file found is used." msgstr "" +"タイムゾーンの検索パスを表す読み取り専用のシーケンスです。\n" +"キーから ``ZoneInfo`` を作成するときは、``TZPATH`` の各要素にキーを結合し、最" +"初に見つかったファイルを使います。" -#: ../../library/zoneinfo.rst:390 msgid "" "``TZPATH`` may contain only absolute paths, never relative paths, regardless " "of how it is configured." msgstr "" +"``TZPATH`` は、どの方法で設定しても絶対パスのみを含み、相対パスは含みません。" -#: ../../library/zoneinfo.rst:393 msgid "" "The object that ``zoneinfo.TZPATH`` points to may change in response to a " "call to :func:`reset_tzpath`, so it is recommended to use ``zoneinfo." "TZPATH`` rather than importing ``TZPATH`` from ``zoneinfo`` or assigning a " "long-lived variable to ``zoneinfo.TZPATH``." msgstr "" +":func:`reset_tzpath` の呼び出しによって、``zoneinfo.TZPATH`` が指すオブジェク" +"トは変わる場合があります。\n" +"そのため、``zoneinfo`` から ``TZPATH`` をインポートしたり、長期間使う変数に " +"``zoneinfo.TZPATH`` の値を代入したりせず、``zoneinfo.TZPATH`` を使うことを推" +"奨します。" -#: ../../library/zoneinfo.rst:398 msgid "" "For more information on configuring the time zone search path, see :ref:" "`zoneinfo_data_configuration`." msgstr "" +"タイムゾーン検索パスの設定の詳細は、:ref:`zoneinfo_data_configuration` を参照" +"してください。" #: ../../library/zoneinfo.rst:402 msgid "Exceptions and warnings" msgstr "例外と警告" -#: ../../library/zoneinfo.rst:406 msgid "" "Raised when construction of a :class:`ZoneInfo` object fails because the " "specified key could not be found on the system. This is a subclass of :exc:" "`KeyError`." msgstr "" +"指定されたキーがシステム上に見つからず、:class:`ZoneInfo` オブジェクトの作成" +"に失敗した場合に送出されます。\n" +":exc:`KeyError` のサブクラスです。" -#: ../../library/zoneinfo.rst:412 msgid "" "Raised when :envvar:`PYTHONTZPATH` contains an invalid component that will " "be filtered out, such as a relative path." msgstr "" +":envvar:`PYTHONTZPATH` に、相対パスなど除外される無効な要素が含まれる場合に発" +"生します。" diff --git a/license.po b/license.po index 27f3e1d7b..4ed79a8ae 100644 --- a/license.po +++ b/license.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: tomo, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../license.rst:7 @@ -32,22 +32,27 @@ msgstr "歴史とライセンス" msgid "History of the software" msgstr "Python の歴史" -#: ../../license.rst:13 msgid "" "Python was created in the early 1990s by Guido van Rossum at Stichting " "Mathematisch Centrum (CWI, see https://www.cwi.nl) in the Netherlands as a " "successor of a language called ABC. Guido remains Python's principal " "author, although it includes many contributions from others." msgstr "" +"Python は 1990 年代初頭に、ABC という言語の後継として、オランダの Stichting " +"Mathematisch Centrum(CWI、https://www.cwi.nl 参照)で Guido van Rossum に" +"よって作られました。\n" +"Python にはほかの多くの人々からの貢献も含まれていますが、Guido は現在もその主" +"要な作者です。" -#: ../../license.rst:18 msgid "" "In 1995, Guido continued his work on Python at the Corporation for National " "Research Initiatives (CNRI, see https://www.cnri.reston.va.us) in Reston, " "Virginia where he released several versions of the software." msgstr "" +"1995 年、Guido はバージニア州レストンの Corporation for National Research " +"Initiatives(CNRI、https://www.cnri.reston.va.us 参照)で Python の開発を続" +"け、いくつかのバージョンをリリースしました。" -#: ../../license.rst:22 msgid "" "In May 2000, Guido and the Python core development team moved to BeOpen.com " "to form the BeOpen PythonLabs team. In October of the same year, the " @@ -57,13 +62,25 @@ msgid "" "Python-related Intellectual Property. Zope Corporation was a sponsoring " "member of the PSF." msgstr "" +"2000 年 5 月、Guido と Python のコア開発チームは BeOpen.com に移り、BeOpen " +"PythonLabs チームを結成しました。\n" +"同年 10 月、PythonLabs チームは Digital Creations に移り、同社はその後 Zope " +"Corporation となりました。\n" +"2001 年、Python に関する知的財産を保有することを目的とした非営利団体 Python " +"Software Foundation(PSF、https://www.python.org/psf/ 参照)が設立されまし" +"た。\n" +"Zope Corporation は PSF の賛助会員でした。" -#: ../../license.rst:30 msgid "" "All Python releases are Open Source (see https://opensource.org for the Open " "Source Definition). Historically, most, but not all, Python releases have " "also been GPL-compatible; the table below summarizes the various releases." msgstr "" +"Python のリリースはすべてオープンソースです(オープンソースの定義については " +"https://opensource.org を参照してください)。\n" +"歴代の Python のリリースの多くは GPL とも互換性がありますが、すべてではありま" +"せん。\n" +"さまざまなリリースを次の表にまとめます。" #: ../../license.rst:35 msgid "Release" @@ -81,9 +98,8 @@ msgstr "西暦年" msgid "Owner" msgstr "権利" -#: ../../license.rst:35 msgid "GPL-compatible? (1)" -msgstr "" +msgstr "GPL 互換? (1)" #: ../../license.rst:37 msgid "0.9.0 thru 1.2" @@ -156,9 +172,8 @@ msgstr "1.6.1" msgid "2001" msgstr "2001" -#: ../../license.rst:45 msgid "yes (2)" -msgstr "" +msgstr "yes (2)" #: ../../license.rst:47 msgid "2.1" @@ -205,7 +220,6 @@ msgstr "2.2 以降" msgid "2001-now" msgstr "2001-現在" -#: ../../license.rst:62 msgid "" "GPL-compatible doesn't mean that we're distributing Python under the GPL. " "All Python licenses, unlike the GPL, let you distribute a modified version " @@ -213,14 +227,22 @@ msgid "" "possible to combine Python with other software that is released under the " "GPL; the others don't." msgstr "" +"GPL 互換とは、Python を GPL のもとで配布しているという意味ではありません。\n" +"Python のライセンスはすべて、GPL とは異なり、変更内容をオープンソースにせずに" +"変更版を配布することを認めています。\n" +"GPL 互換のライセンスでは、GPL のもとでリリースされているほかのソフトウェアと " +"Python を組み合わせることができますが、それ以外のライセンスではできません。" -#: ../../license.rst:68 msgid "" "According to Richard Stallman, 1.6.1 is not GPL-compatible, because its " "license has a choice of law clause. According to CNRI, however, Stallman's " "lawyer has told CNRI's lawyer that 1.6.1 is \"not incompatible\" with the " "GPL." msgstr "" +"Richard Stallman によると、1.6.1 のライセンスには準拠法を選択する条項があるた" +"め、GPL 互換ではありません。\n" +"一方 CNRI によると、Stallman の弁護士は CNRI の弁護士に対し、1.6.1 は GPL と" +"「非互換ではない」と伝えたとのことです。" #: ../../license.rst:72 msgid "" @@ -230,35 +252,39 @@ msgstr "" "Guido の指示の下、これらのリリースを可能にしてくださった多くのボランティアの" "みなさんに感謝します。" -#: ../../license.rst:77 msgid "Terms and conditions for accessing or otherwise using Python" -msgstr "Terms and conditions for accessing or otherwise using Python" +msgstr "Python へのアクセスおよびその他の使用に関する条件" -#: ../../license.rst:79 msgid "" "Python software and documentation are licensed under the Python Software " "Foundation License Version 2." msgstr "" +"Python のソフトウェアとドキュメントは Python Software Foundation License " +"Version 2 のもとでライセンスされています。" -#: ../../license.rst:82 msgid "" "Starting with Python 3.8.6, examples, recipes, and other code in the " "documentation are dual licensed under the PSF License Version 2 and the :ref:" "`Zero-Clause BSD license `." msgstr "" +"Python 3.8.6 以降、ドキュメント内のサンプル、レシピ、その他のコードには、PSF " +"License Version 2 と :ref:`Zero-Clause BSD ライセンス ` のデュアルライ" +"センスが適用されます。" -#: ../../license.rst:86 msgid "" "Some software incorporated into Python is under different licenses. The " "licenses are listed with code falling under that license. See :ref:" "`OtherLicenses` for an incomplete list of these licenses." msgstr "" +"Python に組み込まれているソフトウェアの一部には、異なるライセンスが適用されま" +"す。\n" +"各ライセンスは、その適用対象となるコードとともに記載されています。\n" +"これらのライセンスの一覧は網羅的ではありませんが、:ref:`OtherLicenses` を参照" +"してください。" -#: ../../license.rst:94 msgid "PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2" -msgstr "" +msgstr "PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2" -#: ../../license.rst:98 msgid "" "1. This LICENSE AGREEMENT is between the Python Software Foundation " "(\"PSF\"), and\n" @@ -320,6 +346,59 @@ msgid "" "8. By copying, installing or otherwise using Python, Licensee agrees\n" " to be bound by the terms and conditions of this License Agreement." msgstr "" +"1. 本ライセンス契約は、Python Software Foundation(以下「PSF」)と、ソース形" +"式またはバイナリ形式の\n" +" 本ソフトウェア(以下「Python」)およびその関連ドキュメントにアクセスし、そ" +"の他の方法で使用する\n" +" 個人または組織(以下「ライセンシー」)との間で締結されるものです。\n" +"\n" +"2. 本ライセンス契約の条件に従い、PSF はライセンシーに対し、Python 単体または" +"その派生版の複製、\n" +" 解析、テスト、公の実演および/または展示、派生著作物の作成、配布、その他の" +"使用を行うための、\n" +" 非独占的で使用料不要の全世界におけるライセンスをここに付与します。\n" +" ただし、Python 単体またはライセンシーが作成した派生版には、PSF のライセン" +"ス契約と、\n" +" PSF の著作権表示、すなわち「Copyright © 2001 Python Software Foundation; " +"All Rights Reserved」を\n" +" 保持しなければなりません。\n" +"\n" +"3. ライセンシーが Python またはその一部に基づく、もしくはそれらを組み込んだ派" +"生著作物を作成し、\n" +" 本契約の定めに従ってその派生著作物を他者に提供しようとする場合、ライセン" +"シーは、\n" +" Python に加えた変更の簡単な要約をその著作物に含めることに同意するものとし" +"ます。\n" +"\n" +"4. PSF はライセンシーに対し、Python を「現状のまま」(\"AS IS\")提供しま" +"す。\n" +" PSF は、明示または黙示を問わず、いかなる表明も保証も行いません。\n" +" 例として、ただしこれらに限定されることなく、PSF は、商品性、特定の目的への" +"適合性、\n" +" または Python の使用が第三者の権利を侵害しないことについて、いかなる表明も" +"保証も行わず、\n" +" それらをすべて否認します。\n" +"\n" +"5. PSF は、Python またはその派生物の変更、配布、その他の使用に起因する付随的" +"損害、特別損害、\n" +" 結果的損害または損失について、その可能性を知らされていた場合であっても、\n" +" ライセンシーまたは Python のその他の利用者に対して責任を負わないものとしま" +"す。\n" +"\n" +"6. 本ライセンス契約の条件に重大な違反があった場合、本ライセンス契約は自動的に" +"終了します。\n" +"\n" +"7. 本ライセンス契約のいかなる規定も、PSF とライセンシーとの間に、代理、パート" +"ナーシップ、\n" +" または共同事業の関係を成立させるものとはみなされません。\n" +" 本ライセンス契約は、ライセンシーまたは第三者の製品やサービスを推奨または宣" +"伝するために、\n" +" PSF の商標または商号を商標として使用することを許可するものではありませ" +"ん。\n" +"\n" +"8. ライセンシーは、Python を複製、インストール、またはその他の方法で使用する" +"ことにより、\n" +" 本ライセンス契約の条件に拘束されることに同意するものとします。" #: ../../license.rst:141 msgid "BEOPEN.COM LICENSE AGREEMENT FOR PYTHON 2.0" @@ -329,7 +408,6 @@ msgstr "BEOPEN.COM LICENSE AGREEMENT FOR PYTHON 2.0" msgid "BEOPEN PYTHON OPEN SOURCE LICENSE AGREEMENT VERSION 1" msgstr "BEOPEN PYTHON OPEN SOURCE LICENSE AGREEMENT VERSION 1" -#: ../../license.rst:147 msgid "" "1. This LICENSE AGREEMENT is between BeOpen.com (\"BeOpen\"), having an " "office at\n" @@ -394,12 +472,63 @@ msgid "" "to be\n" " bound by the terms and conditions of this License Agreement." msgstr "" +"1. 本ライセンス契約は、160 Saratoga Avenue, Santa Clara, CA 95051 に事業所を" +"置く\n" +" BeOpen.com(以下「BeOpen」)と、ソース形式またはバイナリ形式の本ソフトウェ" +"アおよびその関連\n" +" ドキュメント(以下「本ソフトウェア」)にアクセスし、その他の方法で使用する" +"個人または組織\n" +" (以下「ライセンシー」)との間で締結されるものです。\n" +"\n" +"2. 本 BeOpen Python ライセンス契約の条件に従い、BeOpen はライセンシーに対し、" +"本ソフトウェア\n" +" 単体またはその派生版の複製、解析、テスト、公の実演および/または展示、派生" +"著作物の作成、\n" +" 配布、その他の使用を行うための、非独占的で使用料不要の全世界におけるライセ" +"ンスをここに付与します。\n" +" ただし、本ソフトウェア単体またはライセンシーが作成した派生版には、\n" +" BeOpen Python ライセンスを保持しなければなりません。\n" +"\n" +"3. BeOpen はライセンシーに対し、本ソフトウェアを「現状のまま」(\"AS IS\")提" +"供します。\n" +" BEOPEN は、明示または黙示を問わず、いかなる表明も保証も行いません。\n" +" 例として、ただしこれらに限定されることなく、BEOPEN は、商品性、特定の目的" +"への適合性、\n" +" または本ソフトウェアの使用が第三者の権利を侵害しないことについて、いかなる" +"表明も保証も行わず、\n" +" それらをすべて否認します。\n" +"\n" +"4. BEOPEN は、本ソフトウェアまたはその派生物の使用、変更、配布に起因する付随" +"的損害、特別損害、\n" +" 結果的損害または損失について、その可能性を知らされていた場合であっても、\n" +" ライセンシーまたは本ソフトウェアのその他の利用者に対して責任を負わないもの" +"とします。\n" +"\n" +"5. 本ライセンス契約の条件に重大な違反があった場合、本ライセンス契約は自動的に" +"終了します。\n" +"\n" +"6. 本ライセンス契約は、抵触法の規定を除くカリフォルニア州法に準拠し、すべての" +"点で同法に従って\n" +" 解釈されるものとします。\n" +" 本ライセンス契約のいかなる規定も、BeOpen とライセンシーとの間に、代理、" +"パートナーシップ、\n" +" または共同事業の関係を成立させるものとはみなされません。\n" +" 本ライセンス契約は、ライセンシーまたは第三者の製品やサービスを推奨または宣" +"伝するために、\n" +" BeOpen の商標または商号を商標として使用することを許可するものではありませ" +"ん。\n" +" 例外として、http://www.pythonlabs.com/logos.html で入手できる「BeOpen " +"Python」ロゴは、\n" +" 同ページで付与される許可に従って使用できます。\n" +"\n" +"7. ライセンシーは、本ソフトウェアを複製、インストール、またはその他の方法で使" +"用することにより、\n" +" 本ライセンス契約の条件に拘束されることに同意するものとします。" #: ../../license.rst:188 msgid "CNRI LICENSE AGREEMENT FOR PYTHON 1.6.1" msgstr "CNRI LICENSE AGREEMENT FOR PYTHON 1.6.1" -#: ../../license.rst:192 msgid "" "1. This LICENSE AGREEMENT is between the Corporation for National Research\n" " Initiatives, having an office at 1895 Preston White Drive, Reston, VA " @@ -498,12 +627,89 @@ msgid "" "and\n" " conditions of this License Agreement." msgstr "" +"1. 本ライセンス契約は、1895 Preston White Drive, Reston, VA 20191 に事業所を" +"置く\n" +" Corporation for National Research Initiatives(以下「CNRI」)と、ソース形" +"式またはバイナリ形式の\n" +" Python 1.6.1 ソフトウェアおよびその関連ドキュメントにアクセスし、その他の" +"方法で使用する\n" +" 個人または組織(以下「ライセンシー」)との間で締結されるものです。\n" +"\n" +"2. 本ライセンス契約の条件に従い、CNRI はライセンシーに対し、Python 1.6.1 単体" +"またはその派生版の\n" +" 複製、解析、テスト、公の実演および/または展示、派生著作物の作成、配布、そ" +"の他の使用を行うための、\n" +" 非独占的で使用料不要の全世界におけるライセンスをここに付与します。\n" +" ただし、Python 1.6.1 単体またはライセンシーが作成した派生版には、CNRI のラ" +"イセンス契約と、\n" +" CNRI の著作権表示、すなわち「Copyright © 1995-2001 Corporation for " +"National Research Initiatives;\n" +" All Rights Reserved」を保持しなければなりません。\n" +" または、ライセンシーは CNRI のライセンス契約の代わりに、次の文章(引用符を" +"除く)を使用できます:\n" +" \"Python 1.6.1 is made available subject to the terms and conditions in " +"CNRI's License\n" +" Agreement. This Agreement together with Python 1.6.1 may be located on " +"the\n" +" internet using the following unique, persistent identifier (known as a " +"handle):\n" +" 1895.22/1013. This Agreement may also be obtained from a proxy server on " +"the\n" +" internet using the following URL: http://hdl.handle.net/1895.22/1013\"。\n" +"\n" +"3. ライセンシーが Python 1.6.1 またはその一部に基づく、もしくはそれらを組み込" +"んだ派生著作物を作成し、\n" +" 本契約の定めに従ってその派生著作物を他者に提供しようとする場合、ライセン" +"シーは、\n" +" Python 1.6.1 に加えた変更の簡単な要約をその著作物に含めることに同意するも" +"のとします。\n" +"\n" +"4. CNRI はライセンシーに対し、Python 1.6.1 を「現状のまま」(\"AS IS\")提供" +"します。\n" +" CNRI は、明示または黙示を問わず、いかなる表明も保証も行いません。\n" +" 例として、ただしこれらに限定されることなく、CNRI は、商品性、特定の目的へ" +"の適合性、\n" +" または Python 1.6.1 の使用が第三者の権利を侵害しないことについて、いかなる" +"表明も保証も行わず、\n" +" それらをすべて否認します。\n" +"\n" +"5. CNRI は、Python 1.6.1 またはその派生物の変更、配布、その他の使用に起因する" +"付随的損害、特別損害、\n" +" 結果的損害または損失について、その可能性を知らされていた場合であっても、\n" +" ライセンシーまたは Python 1.6.1 のその他の利用者に対して責任を負わないもの" +"とします。\n" +"\n" +"6. 本ライセンス契約の条件に重大な違反があった場合、本ライセンス契約は自動的に" +"終了します。\n" +"\n" +"7. 本ライセンス契約は、米国連邦著作権法を含む(ただしこれに限定されない)米国" +"連邦知的財産法に準拠し、\n" +" 当該米国連邦法が適用されない範囲では、バージニア州の抵触法の規定を除くバー" +"ジニア州法に準拠します。\n" +" ただし、以前に GNU General Public License(GPL)のもとで配布された分離不能" +"な素材を組み込んだ、\n" +" Python 1.6.1 に基づく派生著作物については、本ライセンス契約の第 4 項、第 " +"5 項、および第 7 項に\n" +" 基づく、またはそれらに関する問題に限り、本ライセンス契約にバージニア州法が" +"適用されます。\n" +" 本ライセンス契約のいかなる規定も、CNRI とライセンシーとの間に、代理、パー" +"トナーシップ、\n" +" または共同事業の関係を成立させるものとはみなされません。\n" +" 本ライセンス契約は、ライセンシーまたは第三者の製品やサービスを推奨または宣" +"伝するために、\n" +" CNRI の商標または商号を商標として使用することを許可するものではありませ" +"ん。\n" +"\n" +"8. ライセンシーは、指定された箇所の「ACCEPT」ボタンをクリックするか、Python " +"1.6.1 を複製、\n" +" インストール、またはその他の方法で使用することにより、本ライセンス契約の条" +"件に拘束されることに\n" +" 同意するものとします。" #: ../../license.rst:253 msgid "CWI LICENSE AGREEMENT FOR PYTHON 0.9.0 THROUGH 1.2" msgstr "CWI LICENSE AGREEMENT FOR PYTHON 0.9.0 THROUGH 1.2" -#: ../../license.rst:257 msgid "" "Copyright © 1991 - 1995, Stichting Mathematisch Centrum Amsterdam, The\n" "Netherlands. All rights reserved.\n" @@ -533,12 +739,32 @@ msgid "" "ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS\n" "SOFTWARE." msgstr "" +"Copyright © 1991 - 1995, Stichting Mathematisch Centrum Amsterdam, The\n" +"Netherlands. All rights reserved.\n" +"\n" +"本ソフトウェアおよびそのドキュメントを、目的を問わず使用、複製、変更、配布す" +"ることを、\n" +"ここに無償で許可します。\n" +"ただし、すべての複製物に上記の著作権表示を記載し、付属ドキュメントにその著作" +"権表示と本許諾表示の\n" +"両方を記載し、明確な事前の書面による許可なく、本ソフトウェアの配布に関する広" +"告または宣伝に\n" +"Stichting Mathematisch Centrum または CWI の名称を使用しないことを条件としま" +"す。\n" +"\n" +"STICHTING MATHEMATISCH CENTRUM は、商品性および適合性についてのすべての黙示の" +"保証を含め、\n" +"本ソフトウェアに関するすべての保証を否認します。\n" +"STICHTING MATHEMATISCH CENTRUM は、契約、過失、その他の不法行為のいずれに基づ" +"く訴えであるかを問わず、\n" +"本ソフトウェアの使用もしくは動作に起因または関連する、特別損害、間接損害、結" +"果的損害、または使用機会、\n" +"データもしくは利益の喪失によるその他のいかなる損害についても、一切責任を負わ" +"ないものとします。" -#: ../../license.rst:280 msgid "ZERO-CLAUSE BSD LICENSE FOR CODE IN THE PYTHON DOCUMENTATION" -msgstr "" +msgstr "Python ドキュメント内のコードに適用される ZERO-CLAUSE BSD LICENSE" -#: ../../license.rst:284 msgid "" "Permission to use, copy, modify, and/or distribute this software for any\n" "purpose with or without fee is hereby granted.\n" @@ -554,34 +780,47 @@ msgid "" "OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\n" "PERFORMANCE OF THIS SOFTWARE." msgstr "" +"本ソフトウェアを、目的を問わず、有償または無償で使用、複製、変更、および/ま" +"たは配布することを\n" +"ここに許可します。\n" +"\n" +"本ソフトウェアは「現状のまま」(\"AS IS\")提供され、作者は、商品性および適合" +"性についてのすべての\n" +"黙示の保証を含め、本ソフトウェアに関するすべての保証を否認します。\n" +"作者は、契約、過失、その他の不法行為のいずれに基づく訴えであるかを問わず、本" +"ソフトウェアの使用\n" +"もしくは動作に起因または関連する、特別損害、直接損害、間接損害、結果的損害、" +"または使用機会、\n" +"データもしくは利益の喪失によるその他のいかなる損害についても、一切責任を負わ" +"ないものとします。" -#: ../../license.rst:299 msgid "Licenses and Acknowledgements for Incorporated Software" -msgstr "Licenses and Acknowledgements for Incorporated Software" +msgstr "組み込まれたソフトウェアのライセンスと謝辞" -#: ../../license.rst:301 msgid "" "This section is an incomplete, but growing list of licenses and " "acknowledgements for third-party software incorporated in the Python " "distribution." msgstr "" -"This section is an incomplete, but growing list of licenses and " -"acknowledgements for third-party software incorporated in the Python " -"distribution." +"この節は、Python の配布物に組み込まれたサードパーティソフトウェアのライセンス" +"と謝辞の一覧です。\n" +"網羅的ではありませんが、順次追加されています。" #: ../../license.rst:306 msgid "Mersenne Twister" msgstr "Mersenne Twister" -#: ../../license.rst:308 msgid "" "The :mod:`!_random` C extension underlying the :mod:`random` module includes " "code based on a download from http://www.math.sci.hiroshima-u.ac.jp/~m-mat/" "MT/MT2002/emt19937ar.html. The following are the verbatim comments from the " "original code::" msgstr "" +":mod:`random` モジュールの基盤となる :mod:`!_random` C 拡張には、http://www." +"math.sci.hiroshima-u.ac.jp/~m-mat/MT/MT2002/emt19937ar.html からダウンロード" +"したものに基づくコードが含まれます。\n" +"以下は元のコードのコメントをそのまま掲載したものの日本語訳です。 ::" -#: ../../license.rst:313 msgid "" "A C-program for MT19937, with initialization improved 2002/1/26.\n" "Coded by Takuji Nishimura and Makoto Matsumoto.\n" @@ -625,19 +864,59 @@ msgid "" "http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html\n" "email: m-mat @ math.sci.hiroshima-u.ac.jp (remove space)" msgstr "" +"初期化を 2002/1/26 に改良した MT19937 の C プログラム。\n" +"Takuji Nishimura と Makoto Matsumoto による実装。\n" +"\n" +"使用前に、init_genrand(seed) または init_by_array(init_key, key_length) を" +"使って状態を初期化してください。\n" +"\n" +"Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,\n" +"All rights reserved.\n" +"\n" +"変更の有無を問わず、ソース形式およびバイナリ形式での再配布と使用を、次の条件" +"を満たす場合に許可します:\n" +"1. ソースコードを再配布する場合、上記の著作権表示、この条件一覧、および次の免" +"責事項を保持しなければなりません。\n" +"2. バイナリ形式で再配布する場合、配布物に付属するドキュメントおよび/またはそ" +"の他の資料に、上記の著作権表示、この条件一覧、および次の免責事項を転載しなけ" +"ればなりません。\n" +"3. 明確な事前の書面による許可なく、本ソフトウェアから派生した製品を推奨または" +"宣伝するために、貢献者の名称を使用してはなりません。\n" +"\n" +"本ソフトウェアは著作権者および貢献者によって「現状のまま」(\"AS IS\")提供さ" +"れ、\n" +"商品性および特定の目的への適合性についての黙示の保証を含む(ただしこれらに限" +"定されない)、\n" +"明示または黙示のすべての保証を否認します。\n" +"著作権者または貢献者は、本ソフトウェアの使用に何らかの形で起因する、直接損" +"害、間接損害、\n" +"付随的損害、特別損害、懲罰的損害、または結果的損害(代替の商品もしくはサービ" +"スの調達、使用機会、\n" +"データもしくは利益の喪失、または事業の中断を含みますが、これらに限定されませ" +"ん)について、\n" +"その原因や、契約、厳格責任、または不法行為(過失その他を含む)のいずれの責任" +"理論に基づくかを問わず、\n" +"たとえ当該損害の可能性を知らされていたとしても、一切責任を負わないものとしま" +"す。\n" +"\n" +"\n" +"ご意見を歓迎します。\n" +"http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html\n" +"email: m-mat @ math.sci.hiroshima-u.ac.jp(空白を除いてください)" #: ../../license.rst:356 msgid "Sockets" msgstr "ソケット" -#: ../../license.rst:358 msgid "" "The :mod:`socket` module uses the functions, :c:func:`!getaddrinfo`, and :c:" "func:`!getnameinfo`, which are coded in separate source files from the WIDE " "Project, https://www.wide.ad.jp/. ::" msgstr "" +":mod:`socket` モジュールは、WIDE Project(https://www.wide.ad.jp/)の別々の" +"ソースファイルに記述されている :c:func:`!getaddrinfo` 関数および :c:func:`!" +"getnameinfo` 関数を使用します。 ::" -#: ../../license.rst:362 msgid "" "Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.\n" "All rights reserved.\n" @@ -666,18 +945,46 @@ msgid "" "OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n" "SUCH DAMAGE." msgstr "" +"Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.\n" +"All rights reserved.\n" +"\n" +"変更の有無を問わず、ソース形式およびバイナリ形式での再配布と使用を、次の条件" +"を満たす場合に許可します:\n" +"1. ソースコードを再配布する場合、上記の著作権表示、この条件一覧、および次の免" +"責事項を保持しなければなりません。\n" +"2. バイナリ形式で再配布する場合、配布物に付属するドキュメントおよび/またはそ" +"の他の資料に、上記の著作権表示、この条件一覧、および次の免責事項を転載しなけ" +"ればなりません。\n" +"3. 明確な事前の書面による許可なく、本ソフトウェアから派生した製品を推奨または" +"宣伝するために、本プロジェクトまたはその貢献者の名称を使用してはなりませ" +"ん。\n" +"\n" +"本ソフトウェアは本プロジェクトおよび貢献者によって「現状のまま」(\"AS IS\")" +"提供され、\n" +"商品性および特定の目的への適合性についての黙示の保証を含む(ただしこれらに限" +"定されない)、\n" +"明示または黙示のすべての保証を否認します。\n" +"本プロジェクトまたは貢献者は、本ソフトウェアの使用に何らかの形で起因する、直" +"接損害、間接損害、\n" +"付随的損害、特別損害、懲罰的損害、または結果的損害(代替の商品もしくはサービ" +"スの調達、使用機会、\n" +"データもしくは利益の喪失、または事業の中断を含みますが、これらに限定されませ" +"ん)について、\n" +"その原因や、契約、厳格責任、または不法行為(過失その他を含む)のいずれの責任" +"理論に基づくかを問わず、\n" +"たとえ当該損害の可能性を知らされていたとしても、一切責任を負わないものとしま" +"す。" -#: ../../license.rst:391 msgid "Asynchronous socket services" -msgstr "Asynchronous socket services" +msgstr "非同期ソケットサービス" -#: ../../license.rst:393 msgid "" "The :mod:`!test.support.asynchat` and :mod:`!test.support.asyncore` modules " "contain the following notice::" msgstr "" +":mod:`!test.support.asynchat` モジュールと :mod:`!test.support.asyncore` モ" +"ジュールには次の告知が含まれています。 ::" -#: ../../license.rst:396 msgid "" "Copyright 1996 by Sam Rushing\n" "\n" @@ -700,16 +1007,34 @@ msgid "" "NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN\n" "CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE." msgstr "" +"Copyright 1996 by Sam Rushing\n" +"\n" +" All Rights Reserved\n" +"\n" +"本ソフトウェアおよびそのドキュメントを、目的を問わず使用、複製、変更、配布す" +"ることを、\n" +"ここに無償で許可します。\n" +"ただし、すべての複製物に上記の著作権表示を記載し、付属ドキュメントにその著作" +"権表示と本許諾表示の\n" +"両方を記載し、明確な事前の書面による許可なく、本ソフトウェアの配布に関する広" +"告または宣伝に\n" +"Sam Rushing の名称を使用しないことを条件とします。\n" +"\n" +"SAM RUSHING は、商品性および適合性についてのすべての黙示の保証を含め、\n" +"本ソフトウェアに関するすべての保証を否認します。\n" +"SAM RUSHING は、契約、過失、その他の不法行為のいずれに基づく訴えであるかを問" +"わず、\n" +"本ソフトウェアの使用もしくは動作に起因または関連する、特別損害、間接損害、結" +"果的損害、\n" +"または使用機会、データもしくは利益の喪失によるその他のいかなる損害について" +"も、一切責任を負わないものとします。" -#: ../../license.rst:419 msgid "Cookie management" -msgstr "Cookie management" +msgstr "Cookie の管理" -#: ../../license.rst:421 msgid "The :mod:`http.cookies` module contains the following notice::" -msgstr "The :mod:`http.cookies` module contains the following notice::" +msgstr ":mod:`http.cookies` モジュールには次の告知が含まれています。 ::" -#: ../../license.rst:423 msgid "" "Copyright 2000 by Timothy O'Malley \n" "\n" @@ -733,16 +1058,34 @@ msgid "" "ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\n" "PERFORMANCE OF THIS SOFTWARE." msgstr "" +"Copyright 2000 by Timothy O'Malley \n" +"\n" +" All Rights Reserved\n" +"\n" +"本ソフトウェアおよびそのドキュメントを、目的を問わず使用、複製、変更、配布す" +"ることを、\n" +"ここに無償で許可します。\n" +"ただし、すべての複製物に上記の著作権表示を記載し、付属ドキュメントにその著作" +"権表示と本許諾表示の\n" +"両方を記載し、明確な事前の書面による許可なく、本ソフトウェアの配布に関する広" +"告または宣伝に\n" +"Timothy O'Malley の名称を使用しないことを条件とします。\n" +"\n" +"Timothy O'Malley は、商品性および適合性についてのすべての黙示の保証を含め、\n" +"本ソフトウェアに関するすべての保証を否認します。\n" +"Timothy O'Malley は、契約、過失、その他の不法行為のいずれに基づく訴えであるか" +"を問わず、\n" +"本ソフトウェアの使用もしくは動作に起因または関連する、特別損害、間接損害、結" +"果的損害、\n" +"または使用機会、データもしくは利益の喪失によるその他のいかなる損害について" +"も、一切責任を負わないものとします。" -#: ../../license.rst:447 msgid "Execution tracing" -msgstr "Execution tracing" +msgstr "実行のトレース" -#: ../../license.rst:449 msgid "The :mod:`trace` module contains the following notice::" -msgstr "The :mod:`trace` module contains the following notice::" +msgstr ":mod:`trace` モジュールには次の告知が含まれています。 ::" -#: ../../license.rst:451 msgid "" "portions copyright 2001, Autonomous Zones Industries, Inc., all rights...\n" "err... reserved and offered to the public under the terms of the\n" @@ -771,16 +1114,42 @@ msgid "" "Bioreason or Mojam Media be used in advertising or publicity pertaining to\n" "distribution of the software without specific, written prior permission." msgstr "" +"一部の著作権は 2001 年 Autonomous Zones Industries, Inc. に帰属し、すべての権" +"利を……\n" +"ええと、留保します。\n" +"また、Python 2.2 ライセンスの条件に従って一般に提供します。\n" +"作者: Zooko O'Whielacronx\n" +"http://zooko.com/\n" +"mailto:zooko@zooko.com\n" +"\n" +"Copyright 2000, Mojam Media, Inc., all rights reserved.\n" +"作者: Skip Montanaro\n" +"\n" +"Copyright 1999, Bioreason, Inc., all rights reserved.\n" +"作者: Andrew Dalke\n" +"\n" +"Copyright 1995-1997, Automatrix, Inc., all rights reserved.\n" +"作者: Skip Montanaro\n" +"\n" +"Copyright 1991-1995, Stichting Mathematisch Centrum, all rights reserved.\n" +"\n" +"\n" +"本 Python ソフトウェアおよびその関連ドキュメントを、目的を問わず使用、複製、" +"変更、配布することを、\n" +"ここに無償で許可します。\n" +"ただし、すべての複製物に上記の著作権表示を記載し、付属ドキュメントにその著作" +"権表示と本許諾表示の\n" +"両方を記載し、明確な事前の書面による許可なく、本ソフトウェアの配布に関する広" +"告または宣伝に\n" +"Automatrix、Bioreason、Mojam Media のいずれの名称も使用しないことを条件としま" +"す。" -#: ../../license.rst:480 msgid "UUencode and UUdecode functions" -msgstr "UUencode and UUdecode functions" +msgstr "UUencode 関数と UUdecode 関数" -#: ../../license.rst:482 msgid "The ``uu`` codec contains the following notice::" -msgstr "" +msgstr "``uu`` コーデックには次の告知が含まれています。 ::" -#: ../../license.rst:484 msgid "" "Copyright 1994 by Lance Ellinghouse\n" "Cathedral City, California Republic, United States of America.\n" @@ -806,16 +1175,39 @@ msgid "" " version is still 5 times faster, though.\n" "- Arguments more compliant with Python standard" msgstr "" +"Copyright 1994 by Lance Ellinghouse\n" +"Cathedral City, California Republic, United States of America.\n" +" All Rights Reserved\n" +"本ソフトウェアおよびそのドキュメントを、目的を問わず使用、複製、変更、配布す" +"ることを、\n" +"ここに無償で許可します。\n" +"ただし、すべての複製物に上記の著作権表示を記載し、付属ドキュメントにその著作" +"権表示と本許諾表示の\n" +"両方を記載し、明確な事前の書面による許可なく、本ソフトウェアの配布に関する広" +"告または宣伝に\n" +"Lance Ellinghouse の名称を使用しないことを条件とします。\n" +"LANCE ELLINGHOUSE は、商品性および適合性についてのすべての黙示の保証を含" +"め、\n" +"本ソフトウェアに関するすべての保証を否認します。\n" +"LANCE ELLINGHOUSE CENTRUM は、契約、過失、その他の不法行為のいずれに基づく訴" +"えであるかを問わず、\n" +"本ソフトウェアの使用もしくは動作に起因または関連する、特別損害、間接損害、結" +"果的損害、\n" +"または使用機会、データもしくは利益の喪失によるその他のいかなる損害について" +"も、一切責任を負わないものとします。\n" +"\n" +"Jack Jansen、CWI による 1995 年 7 月の変更:\n" +"- ascii とバイナリとの間の実際の行ごとの変換に binascii モジュールを使用。\n" +" これにより 1000 倍に高速化。\n" +" ただし、C 版はさらに 5 倍高速。\n" +"- 引数を Python の標準にさらに準拠させた" -#: ../../license.rst:510 msgid "XML Remote Procedure Calls" -msgstr "XML Remote Procedure Calls" +msgstr "XML リモート手続き呼び出し" -#: ../../license.rst:512 msgid "The :mod:`xmlrpc.client` module contains the following notice::" -msgstr "The :mod:`xmlrpc.client` module contains the following notice::" +msgstr ":mod:`xmlrpc.client` モジュールには次の告知が含まれています。 ::" -#: ../../license.rst:514 msgid "" " The XML-RPC client interface is\n" "\n" @@ -844,16 +1236,41 @@ msgid "" "ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE\n" "OF THIS SOFTWARE." msgstr "" +" XML-RPC クライアントインターフェースの著作権は次のとおりです:\n" +"\n" +"Copyright (c) 1999-2002 by Secret Labs AB\n" +"Copyright (c) 1999-2002 by Fredrik Lundh\n" +"\n" +"本ソフトウェアおよび/またはその関連ドキュメントを取得、使用、および/または" +"複製することにより、\n" +"以下の条件を読み、理解し、遵守することに同意するものとします:\n" +"\n" +"本ソフトウェアおよびそのドキュメントを、目的を問わず使用、複製、変更、配布す" +"ることを、\n" +"ここに無償で許可します。\n" +"ただし、すべての複製物に上記の著作権表示を記載し、付属ドキュメントにその著作" +"権表示と本許諾表示の\n" +"両方を記載し、明確な事前の書面による許可なく、本ソフトウェアの配布に関する広" +"告または宣伝に\n" +"Secret Labs AB または作者の名称を使用しないことを条件とします。\n" +"\n" +"SECRET LABS AB および作者は、商品性および適合性についてのすべての黙示の保証を" +"含め、\n" +"本ソフトウェアに関するすべての保証を否認します。\n" +"SECRET LABS AB または作者は、契約、過失、その他の不法行為のいずれに基づく訴え" +"であるかを問わず、\n" +"本ソフトウェアの使用もしくは動作に起因または関連する、特別損害、間接損害、結" +"果的損害、\n" +"または使用機会、データもしくは利益の喪失によるその他のいかなる損害について" +"も、一切責任を負わないものとします。" #: ../../license.rst:543 msgid "test_epoll" msgstr "test_epoll" -#: ../../license.rst:545 msgid "The :mod:`!test.test_epoll` module contains the following notice::" -msgstr "" +msgstr ":mod:`!test.test_epoll` モジュールには次の告知が含まれています。 ::" -#: ../../license.rst:547 msgid "" "Copyright (c) 2001-2006 Twisted Matrix Laboratories.\n" "\n" @@ -876,6 +1293,28 @@ msgid "" "OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\n" "WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE." msgstr "" +"Copyright (c) 2001-2006 Twisted Matrix Laboratories.\n" +"\n" +"本ソフトウェアおよび関連ドキュメントファイル(以下「本ソフトウェア」)のコ" +"ピーを取得するすべての人に、\n" +"本ソフトウェアを制限なく扱うことを、ここに無償で許可します。\n" +"これには、本ソフトウェアのコピーを使用、複製、変更、結合、公開、配布、再許" +"諾、および/または販売する権利、\n" +"ならびに本ソフトウェアの提供先に同じ行為を許可する権利が含まれますが、これら" +"に限定されません。\n" +"ただし、次の条件に従うものとします:\n" +"\n" +"上記の著作権表示および本許諾表示を、本ソフトウェアのすべてのコピーまたは重要" +"な部分に含めなければなりません。\n" +"\n" +"本ソフトウェアは「現状のまま」(\"AS IS\")提供され、商品性、特定の目的への適" +"合性、および非侵害の保証を含む\n" +"(ただしこれらに限定されない)、明示または黙示のいかなる保証もありません。\n" +"作者または著作権者は、契約、不法行為、その他のいずれに基づくかを問わず、本ソ" +"フトウェア、\n" +"または本ソフトウェアの使用その他の取り扱いに起因もしくは関連して生じるいかな" +"る請求、損害、\n" +"その他の責任についても、一切責任を負わないものとします。" #: ../../license.rst:569 msgid "Select kqueue" @@ -889,7 +1328,6 @@ msgstr "" ":mod:`select` モジュールは kqueue インターフェースについての次の告知を含んで" "います::" -#: ../../license.rst:574 msgid "" "Copyright (c) 2000 Doug White, 2006 James Knight, 2007 Christian Heimes\n" "All rights reserved.\n" @@ -915,18 +1353,45 @@ msgid "" "OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n" "SUCH DAMAGE." msgstr "" +"Copyright (c) 2000 Doug White, 2006 James Knight, 2007 Christian Heimes\n" +"All rights reserved.\n" +"\n" +"変更の有無を問わず、ソース形式およびバイナリ形式での再配布と使用を、次の条件" +"を満たす場合に許可します:\n" +"1. ソースコードを再配布する場合、上記の著作権表示、この条件一覧、および次の免" +"責事項を保持しなければなりません。\n" +"2. バイナリ形式で再配布する場合、配布物に付属するドキュメントおよび/またはそ" +"の他の資料に、上記の著作権表示、この条件一覧、および次の免責事項を転載しなけ" +"ればなりません。\n" +"\n" +"本ソフトウェアは作者および貢献者によって「現状のまま」(\"AS IS\")提供さ" +"れ、\n" +"商品性および特定の目的への適合性についての黙示の保証を含む(ただしこれらに限" +"定されない)、\n" +"明示または黙示のすべての保証を否認します。\n" +"作者または貢献者は、本ソフトウェアの使用に何らかの形で起因する、直接損害、間" +"接損害、\n" +"付随的損害、特別損害、懲罰的損害、または結果的損害(代替の商品もしくはサービ" +"スの調達、使用機会、\n" +"データもしくは利益の喪失、または事業の中断を含みますが、これらに限定されませ" +"ん)について、\n" +"その原因や、契約、厳格責任、または不法行為(過失その他を含む)のいずれの責任" +"理論に基づくかを問わず、\n" +"たとえ当該損害の可能性を知らされていたとしても、一切責任を負わないものとしま" +"す。" #: ../../license.rst:600 msgid "SipHash24" msgstr "SipHash24" -#: ../../license.rst:602 msgid "" "The file :file:`Python/pyhash.c` contains Marek Majkowski' implementation of " "Dan Bernstein's SipHash24 algorithm. It contains the following note::" msgstr "" +":file:`Python/pyhash.c` ファイルには、Dan Bernstein の SipHash24 アルゴリズム" +"を Marek Majkowski が実装したものが含まれています。\n" +"このファイルには次の注記が含まれています。 ::" -#: ../../license.rst:605 msgid "" "\n" "Copyright (c) 2013 Marek Majkowski \n" @@ -953,12 +1418,34 @@ msgid "" " djb (supercop/crypto_auth/siphash24/little2)\n" " Jean-Philippe Aumasson (https://131002.net/siphash/siphash24.c)" msgstr "" +"\n" +"Copyright (c) 2013 Marek Majkowski \n" +"\n" +"本ソフトウェアおよび関連ドキュメントファイル(以下「本ソフトウェア」)のコ" +"ピーを取得するすべての人に、\n" +"本ソフトウェアを制限なく扱うことを、ここに無償で許可します。\n" +"これには、本ソフトウェアのコピーを使用、複製、変更、結合、公開、配布、再許" +"諾、および/または販売する権利、\n" +"ならびに本ソフトウェアの提供先に同じ行為を許可する権利が含まれますが、これら" +"に限定されません。\n" +"ただし、次の条件に従うものとします:\n" +"\n" +"上記の著作権表示および本許諾表示を、本ソフトウェアのすべてのコピーまたは重要" +"な部分に含めなければなりません。\n" +"\n" +"\n" +"元の公開場所:\n" +" https://github.com/majek/csiphash/\n" +"\n" +"解決方法の着想を得たコード:\n" +" Samuel Neves (supercop/crypto_auth/siphash24/little)\n" +" djb (supercop/crypto_auth/siphash24/little2)\n" +" Jean-Philippe Aumasson (https://131002.net/siphash/siphash24.c)" #: ../../license.rst:629 msgid "strtod and dtoa" msgstr "strtod と dtoa" -#: ../../license.rst:631 msgid "" "The file :file:`Python/dtoa.c`, which supplies C functions dtoa and strtod " "for conversion of C doubles to and from strings, is derived from the file of " @@ -967,8 +1454,13 @@ msgid "" "as retrieved on March 16, 2009, contains the following copyright and " "licensing notice::" msgstr "" +"C の double と文字列との相互変換を行う C 関数 dtoa と strtod を提供する :" +"file:`Python/dtoa.c` ファイルは、David M. Gay による同名のファイル(現在は " +"https://web.archive.org/web/20220517033456/http://www.netlib.org/fp/dtoa.c で" +"入手できます)に由来します。\n" +"2009 年 3 月 16 日に取得した元のファイルには、次の著作権表示とライセンスに関" +"する告知が含まれています。 ::" -#: ../../license.rst:638 msgid "" "/****************************************************************\n" " *\n" @@ -990,12 +1482,32 @@ msgid "" " *\n" " ***************************************************************/" msgstr "" +"/****************************************************************\n" +" *\n" +" * 本ソフトウェアの作者は David M. Gay です。\n" +" *\n" +" * Copyright (c) 1991, 2000, 2001 by Lucent Technologies.\n" +" *\n" +" * 本ソフトウェアを、目的を問わず使用、複製、変更、配布することを、ここに無償" +"で許可します。\n" +" * ただし、本ソフトウェアのコピーもしくは変更版である、またはそれらを含むソフ" +"トウェアの\n" +" * すべてのコピー、およびそのようなソフトウェアの付属ドキュメントのすべてのコ" +"ピーに、\n" +" * この告知全体を含めることを条件とします。\n" +" *\n" +" * 本ソフトウェアは「現状のまま」(\"AS IS\")提供され、明示または黙示のいか" +"なる保証もありません。\n" +" * 特に、作者も LUCENT も、本ソフトウェアの商品性または特定の目的への適合性に" +"ついて、\n" +" * いかなる種類の表明も保証も行いません。\n" +" *\n" +" ***************************************************************/" #: ../../license.rst:659 msgid "OpenSSL" msgstr "OpenSSL" -#: ../../license.rst:661 msgid "" "The modules :mod:`hashlib`, :mod:`posix` and :mod:`ssl` use the OpenSSL " "library for added performance if made available by the operating system. " @@ -1004,8 +1516,15 @@ msgid "" "For the OpenSSL 3.0 release, and later releases derived from that, the " "Apache License v2 applies::" msgstr "" +":mod:`hashlib`、:mod:`posix`、:mod:`ssl` の各モジュールは、オペレーティングシ" +"ステムが OpenSSL ライブラリを提供している場合、性能向上のためにそれを使用しま" +"す。\n" +"また、Windows 用および macOS 用の Python インストーラに OpenSSL ライブラリの" +"コピーが含まれる場合があるため、ここに OpenSSL のライセンスのコピーを掲載しま" +"す。\n" +"OpenSSL 3.0 およびそれから派生した後続のリリースには、Apache License v2 が適" +"用されます。 ::" -#: ../../license.rst:669 msgid "" " Apache License\n" " Version 2.0, January 2004\n" @@ -1184,6 +1703,205 @@ msgid "" "\n" "END OF TERMS AND CONDITIONS" msgstr "" +" Apache License\n" +" Version 2.0, January 2004\n" +" https://www.apache.org/licenses/\n" +"\n" +"使用、複製、および配布に関する条件\n" +"\n" +"1. 定義。\n" +"\n" +" 「本ライセンス」とは、本書の第 1 条から第 9 条で定める使用、複製、および配" +"布に関する条件をいいます。\n" +"\n" +" 「ライセンサー」とは、本ライセンスを付与する著作権者、または著作権者から権" +"限を与えられた主体をいいます。\n" +"\n" +" 「法人」とは、行為を行う主体と、その主体を支配する、その主体に支配される、" +"またはその主体と共通の\n" +" 支配下にあるその他すべての主体の集合をいいます。\n" +" この定義において、「支配」とは、(i) 契約その他の手段によって、直接または間" +"接にその主体の指揮または\n" +" 経営を行わせる権限、(ii) 発行済株式の 50% 以上の所有、または (iii) その主" +"体の実質的な所有を意味します。\n" +"\n" +" 「あなた」とは、本ライセンスによって付与される許可を行使する個人または法人" +"をいいます。\n" +"\n" +" 「ソース」形式とは、変更を加えるのに適した形式をいい、ソフトウェアのソース" +"コード、ドキュメントの\n" +" ソース、および設定ファイルを含みますが、これらに限定されません。\n" +"\n" +" 「オブジェクト」形式とは、ソース形式の機械的な変換または翻訳によって生じる" +"あらゆる形式をいい、\n" +" コンパイルされたオブジェクトコード、生成されたドキュメント、および他のメ" +"ディア形式への変換物を\n" +" 含みますが、これらに限定されません。\n" +"\n" +" 「本著作物」とは、その著作物に含まれる、または添付される著作権表示によって" +"示される、本ライセンスの\n" +" もとで提供される著作物をいい、ソース形式かオブジェクト形式かを問いません\n" +" (下記の付録に例を示します)。\n" +"\n" +" 「派生著作物」とは、本著作物に基づく(または本著作物から派生した)著作物" +"で、編集上の改訂、注釈、\n" +" 詳細化、またはその他の変更が全体として独創的な著作物を構成するものをいい、" +"ソース形式かオブジェクト\n" +" 形式かを問いません。\n" +" 本ライセンスにおいて、派生著作物には、本著作物およびその派生著作物から分離" +"可能なままの著作物、\n" +" またはそれらのインターフェースに単にリンクする(もしくは名前でバインドす" +"る)著作物は含まれません。\n" +"\n" +" 「貢献物」とは、本著作物に組み込むために、著作権者、または著作権者に代わっ" +"て提出する権限を与えられた\n" +" 個人もしくは法人によって、意図的にライセンサーに提出される著作物をいい、本" +"著作物の元のバージョン、\n" +" 本著作物もしくはその派生著作物に対する変更または追加を含みます。\n" +" この定義において、「提出」とは、ライセンサーまたはその代理人に送られる、電" +"子的、口頭、または書面による\n" +" あらゆる形式の通信を意味します。\n" +" これには、本著作物の議論と改善を目的としてライセンサーまたはその代理で管理" +"される電子メーリングリスト、\n" +" ソースコード管理システム、および課題管理システム上の通信を含みますが、これ" +"らに限定されません。\n" +" ただし、著作権者が「貢献物ではない」(\"Not a Contribution.\")と目立つよ" +"うに表示するか、\n" +" その他の方法で書面により指定した通信は除きます。\n" +"\n" +" 「貢献者」とは、ライセンサーと、その者に代わって提出された貢献物がライセン" +"サーによって受領され、\n" +" その後、本著作物に組み込まれた個人または法人をいいます。\n" +"\n" +"2. 著作権ライセンスの付与。\n" +" 本ライセンスの条件に従い、各貢献者はあなたに対し、本著作物およびその派生著" +"作物を、ソース形式または\n" +" オブジェクト形式で、複製、派生著作物の作成、公の展示、公の実演、再許諾、お" +"よび配布するための、\n" +" 永続的、全世界的、非独占的、無償、使用料不要、かつ取消不能の著作権ライセン" +"スをここに付与します。\n" +"\n" +"3. 特許ライセンスの付与。\n" +" 本ライセンスの条件に従い、各貢献者はあなたに対し、本著作物を製造、製造委" +"託、使用、販売の申出、販売、\n" +" 輸入、およびその他の方法で移転するための、永続的、全世界的、非独占的、無" +"償、使用料不要、かつ\n" +" 取消不能(本条に定める場合を除く)の特許ライセンスをここに付与します。\n" +" このライセンスは、当該貢献者がライセンスを付与できる特許の請求項のうち、そ" +"の貢献物単体によって、\n" +" またはその貢献物と、それが提出された本著作物との組み合わせによって、必然的" +"に侵害されるものだけに\n" +" 適用されます。\n" +" 本著作物または本著作物に組み込まれた貢献物が直接的または寄与的な特許侵害を" +"構成すると主張して、\n" +" あなたがいずれかの主体に対して特許訴訟(訴訟における交差請求または反訴を含" +"む)を起こした場合、\n" +" 本ライセンスに基づいて当該本著作物についてあなたに付与された特許ライセンス" +"はすべて、\n" +" その訴訟を提起した日に終了します。\n" +"\n" +"4. 再配布。\n" +" あなたは、以下の条件を満たすことを条件として、変更の有無を問わず、ソース形" +"式またはオブジェクト形式で、\n" +" 任意の媒体において、本著作物またはその派生著作物のコピーを複製および配布で" +"きます:\n" +"\n" +" (a) 本著作物または派生著作物の他の受領者に、本ライセンスのコピーを渡さなけ" +"ればなりません。\n" +" かつ、\n" +"\n" +" (b) 変更したファイルには、あなたがそのファイルを変更した旨を示す目立つ告知" +"を付けなければなりません。\n" +" かつ、\n" +"\n" +" (c) あなたが配布する派生著作物のソース形式には、本著作物のソース形式にある" +"すべての著作権、特許、商標、\n" +" および帰属の表示を保持しなければなりません。\n" +" ただし、その派生著作物のどの部分にも関係しない表示は除きます。\n" +" かつ、\n" +"\n" +" (d) 本著作物の配布物の一部に「NOTICE」テキストファイルが含まれる場合、あな" +"たが配布する派生著作物には、\n" +" その NOTICE ファイルに含まれる帰属表示の読み取り可能なコピーを、以下の" +"場所のうち少なくとも一つに\n" +" 含めなければなりません。\n" +" ただし、その派生著作物のどの部分にも関係しない表示は除きます:\n" +" 派生著作物の一部として配布される NOTICE テキストファイル内、派生著作物" +"に付属して提供される場合は\n" +" そのソース形式またはドキュメント内、または、派生著作物が生成する表示の" +"中で、第三者のそのような\n" +" 表示が通常現れる場合にはその場所。\n" +" NOTICE ファイルの内容は情報提供のみを目的としており、本ライセンスを変" +"更するものではありません。\n" +" あなたが配布する派生著作物には、本著作物の NOTICE の文章と並べるか、そ" +"の追記として、\n" +" あなた自身の帰属表示を追加できます。\n" +" ただし、その追加の帰属表示が本ライセンスを変更するものと解釈され得ない" +"ことを条件とします。\n" +"\n" +" あなたの変更に対してあなた自身の著作権表示を追加し、あなたの変更、または派" +"生著作物の全体について、\n" +" その使用、複製、配布に追加の、または異なるライセンス条件を設けることができ" +"ます。\n" +" ただし、それ以外の点では、あなたによる本著作物の使用、複製、および配布が、" +"本ライセンスに記載された\n" +" 条件に従っていることを条件とします。\n" +"\n" +"5. 貢献物の提出。\n" +" あなたが明示的に別段の定めをした場合を除き、あなたが本著作物に組み込むため" +"に意図的にライセンサーに\n" +" 提出した貢献物には、追加の条件なしに、本ライセンスの条件が適用されます。\n" +" 上記にかかわらず、本条のいかなる規定も、その貢献物についてあなたがライセン" +"サーと締結した別の\n" +" ライセンス契約の条件に優先し、またはそれを変更するものではありません。\n" +"\n" +"6. 商標。\n" +" 本ライセンスは、本著作物の出自の記述や NOTICE ファイルの内容の転載において" +"合理的かつ慣例的な使用に\n" +" 必要とされる場合を除き、ライセンサーの商号、商標、サービスマーク、製品名の" +"使用を許可しません。\n" +"\n" +"7. 保証の否認。\n" +" 適用法により要求される場合または書面で合意される場合を除き、ライセンサーは" +"本著作物を\n" +" (また各貢献者はその貢献物を)「現状のまま」(\"AS IS\")提供し、明示また" +"は黙示を問わず、\n" +" 権原、非侵害、商品性、または特定の目的への適合性に関する保証もしくは条件を" +"含む\n" +" (ただしこれらに限定されない)、いかなる種類の保証も条件もありません。\n" +" 本著作物の使用または再配布が適切かどうかの判断は、あなたのみの責任であ" +"り、\n" +" 本ライセンスに基づく許可の行使に伴うすべてのリスクをあなたが負うものとしま" +"す。\n" +"\n" +"8. 責任の制限。\n" +" 適用法により要求される場合(故意や重過失による行為など)または書面で合意さ" +"れる場合を除き、\n" +" いかなる貢献者も、本ライセンス、または本著作物の使用もしくは使用不能に起因" +"するあらゆる種類の\n" +" 直接損害、間接損害、特別損害、付随的損害、または結果的損害(信用の喪失、業" +"務の停止、コンピュータの\n" +" 故障もしくは誤動作、その他あらゆる商業上の損害もしくは損失を含みますが、こ" +"れらに限定されません)を\n" +" 含む損害について、不法行為(過失を含む)、契約、その他のいかなる法理論に基" +"づくかを問わず、\n" +" たとえその貢献者が当該損害の可能性を知らされていたとしても、あなたに対して" +"一切責任を負いません。\n" +"\n" +"9. 保証または追加の責任の引受け。\n" +" 本著作物またはその派生著作物を再配布する際、あなたは、本ライセンスに矛盾し" +"ない範囲で、サポート、保証、\n" +" 補償、その他の責任義務および/または権利の引受けを提供し、その対価を請求す" +"ることを選択できます。\n" +" ただし、そのような義務を引き受けるにあたっては、他の貢献者のためにではな" +"く、あなた自身のために、\n" +" あなたのみの責任で行うものとします。\n" +" また、そのような保証または追加の責任を引き受けたことを理由として、各貢献者" +"が負う責任や、各貢献者に対して\n" +" 主張される請求について、あなたが各貢献者を補償し、防御し、損害を被らせない" +"ことに同意する場合に限ります。\n" +"\n" +"条件の終わり" #: ../../license.rst:848 msgid "expat" @@ -1225,14 +1943,15 @@ msgstr "" msgid "libffi" msgstr "libffi" -#: ../../license.rst:879 msgid "" "The :mod:`!_ctypes` C extension underlying the :mod:`ctypes` module is built " "using an included copy of the libffi sources unless the build is configured " "``--with-system-libffi``::" msgstr "" +"``--with-system-libffi`` を指定してビルドを構成しない限り、:mod:`ctypes` モ" +"ジュールの基盤となる :mod:`!_ctypes` C 拡張は、同梱された libffi ソースのコ" +"ピーを使ってビルドされます。 ::" -#: ../../license.rst:883 msgid "" "Copyright (c) 1996-2008 Red Hat, Inc and others.\n" "\n" @@ -1256,22 +1975,41 @@ msgid "" "OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n" "DEALINGS IN THE SOFTWARE." msgstr "" +"Copyright (c) 1996-2008 Red Hat, Inc and others.\n" +"\n" +"本ソフトウェアおよび関連ドキュメントファイル(以下「本ソフトウェア」)のコ" +"ピーを取得するすべての人に、\n" +"本ソフトウェアを制限なく扱うことを、ここに無償で許可します。\n" +"これには、本ソフトウェアのコピーを使用、複製、変更、結合、公開、配布、再許" +"諾、および/または販売する権利、\n" +"ならびに本ソフトウェアの提供先に同じ行為を許可する権利が含まれますが、これら" +"に限定されません。\n" +"ただし、次の条件に従うものとします:\n" +"\n" +"上記の著作権表示および本許諾表示を、本ソフトウェアのすべてのコピーまたは重要" +"な部分に含めなければなりません。\n" +"\n" +"本ソフトウェアは「現状のまま」(\"AS IS\")提供され、商品性、特定の目的への適" +"合性、および非侵害の保証を含む\n" +"(ただしこれらに限定されない)、明示または黙示のいかなる保証もありません。\n" +"作者または著作権者は、契約、不法行為、その他のいずれに基づくかを問わず、本ソ" +"フトウェア、\n" +"または本ソフトウェアの使用その他の取り扱いに起因もしくは関連して生じるいかな" +"る請求、損害、\n" +"その他の責任についても、一切責任を負わないものとします。" #: ../../license.rst:907 msgid "zlib" msgstr "zlib" -#: ../../license.rst:909 msgid "" "The :mod:`zlib` extension is built using an included copy of the zlib " "sources if the zlib version found on the system is too old to be used for " "the build::" msgstr "" -"The :mod:`zlib` extension is built using an included copy of the zlib " -"sources if the zlib version found on the system is too old to be used for " -"the build::" +"システム上で見つかった zlib のバージョンが古すぎてビルドに使用できない場合、:" +"mod:`zlib` 拡張は同梱された zlib ソースのコピーを使ってビルドされます。 ::" -#: ../../license.rst:913 msgid "" "Copyright (C) 1995-2011 Jean-loup Gailly and Mark Adler\n" "\n" @@ -1296,20 +2034,43 @@ msgid "" "Jean-loup Gailly Mark Adler\n" "jloup@gzip.org madler@alumni.caltech.edu" msgstr "" +"Copyright (C) 1995-2011 Jean-loup Gailly and Mark Adler\n" +"\n" +"本ソフトウェアは「現状のまま」('as-is')提供され、明示または黙示のいかなる保" +"証もありません。\n" +"作者は、本ソフトウェアの使用に起因するいかなる損害についても、一切責任を負い" +"ません。\n" +"\n" +"商用アプリケーションを含むあらゆる目的で本ソフトウェアを使用し、変更し、自由" +"に再配布することを、\n" +"次の制限に従うことを条件として、すべての人に許可します:\n" +"\n" +"1. 本ソフトウェアの出自を偽ってはなりません。\n" +" 元のソフトウェアを自分が書いたと主張してはなりません。\n" +" 製品で本ソフトウェアを使用する場合、製品のドキュメントに謝辞を記載していた" +"だければ幸いですが、\n" +" 必須ではありません。\n" +"\n" +"2. 変更されたソース版には、その旨を明確に表示しなければならず、元のソフトウェ" +"アであると偽ってはなりません。\n" +"\n" +"3. いかなるソース配布物からも、この告知を削除したり変更したりしてはなりませ" +"ん。\n" +"\n" +"Jean-loup Gailly Mark Adler\n" +"jloup@gzip.org madler@alumni.caltech.edu" #: ../../license.rst:938 msgid "cfuhash" msgstr "cfuhash" -#: ../../license.rst:940 msgid "" "The implementation of the hash table used by the :mod:`tracemalloc` is based " "on the cfuhash project::" msgstr "" -"The implementation of the hash table used by the :mod:`tracemalloc` で使用し" -"ているハッシュテーブルの実装は、cfuhashプロジェクトのものに基づきます::" +":mod:`tracemalloc` で使用されるハッシュテーブルの実装は、cfuhash プロジェクト" +"に基づいています。 ::" -#: ../../license.rst:943 msgid "" "Copyright (c) 2005 Don Owens\n" "All rights reserved.\n" @@ -1345,19 +2106,50 @@ msgid "" "ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\n" "OF THE POSSIBILITY OF SUCH DAMAGE." msgstr "" +"Copyright (c) 2005 Don Owens\n" +"All rights reserved.\n" +"\n" +"このコードは BSD ライセンスのもとでリリースされています:\n" +"\n" +"変更の有無を問わず、ソース形式およびバイナリ形式での再配布と使用を、次の条件" +"を満たす場合に許可します:\n" +"* ソースコードを再配布する場合、上記の著作権表示、この条件一覧、および次の免" +"責事項を保持しなければなりません。\n" +"* バイナリ形式で再配布する場合、配布物に付属するドキュメントおよび/またはそ" +"の他の資料に、上記の著作権表示、この条件一覧、および次の免責事項を転載しなけ" +"ればなりません。\n" +"* 明確な事前の書面による許可なく、本ソフトウェアから派生した製品を推奨または" +"宣伝するために、作者またはその貢献者の名称を使用してはなりません。\n" +"\n" +"本ソフトウェアは著作権者および貢献者によって「現状のまま」(\"AS IS\")提供さ" +"れ、\n" +"商品性および特定の目的への適合性についての黙示の保証を含む(ただしこれらに限" +"定されない)、\n" +"明示または黙示のすべての保証を否認します。\n" +"著作権者または貢献者は、本ソフトウェアの使用に何らかの形で起因する、直接損" +"害、間接損害、\n" +"付随的損害、特別損害、懲罰的損害、または結果的損害(代替の商品もしくはサービ" +"スの調達、使用機会、\n" +"データもしくは利益の喪失、または事業の中断を含みますが、これらに限定されませ" +"ん)について、\n" +"その原因や、契約、厳格責任、または不法行為(過失その他を含む)のいずれの責任" +"理論に基づくかを問わず、\n" +"たとえ当該損害の可能性を知らされていたとしても、一切責任を負わないものとしま" +"す。" #: ../../license.rst:979 msgid "libmpdec" msgstr "libmpdec" -#: ../../license.rst:981 msgid "" "The :mod:`!_decimal` C extension underlying the :mod:`decimal` module is " "built using an included copy of the libmpdec library unless the build is " "configured ``--with-system-libmpdec``::" msgstr "" +"``--with-system-libmpdec`` を指定してビルドを構成しない限り、:mod:`decimal` " +"モジュールの基盤となる :mod:`!_decimal` C 拡張は、同梱された libmpdec ライブ" +"ラリのコピーを使ってビルドされます。 ::" -#: ../../license.rst:985 msgid "" "Copyright (c) 2008-2020 Stefan Krah. All rights reserved.\n" "\n" @@ -1384,19 +2176,45 @@ msgid "" "OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n" "SUCH DAMAGE." msgstr "" +"Copyright (c) 2008-2020 Stefan Krah. All rights reserved.\n" +"\n" +"変更の有無を問わず、ソース形式およびバイナリ形式での再配布と使用を、次の条件" +"を満たす場合に許可します:\n" +"1. ソースコードを再配布する場合、上記の著作権表示、この条件一覧、および次の免" +"責事項を保持しなければなりません。\n" +"2. バイナリ形式で再配布する場合、配布物に付属するドキュメントおよび/またはそ" +"の他の資料に、上記の著作権表示、この条件一覧、および次の免責事項を転載しなけ" +"ればなりません。\n" +"\n" +"本ソフトウェアは作者および貢献者によって「現状のまま」(\"AS IS\")提供さ" +"れ、\n" +"商品性および特定の目的への適合性についての黙示の保証を含む(ただしこれらに限" +"定されない)、\n" +"明示または黙示のすべての保証を否認します。\n" +"作者または貢献者は、本ソフトウェアの使用に何らかの形で起因する、直接損害、間" +"接損害、\n" +"付随的損害、特別損害、懲罰的損害、または結果的損害(代替の商品もしくはサービ" +"スの調達、使用機会、\n" +"データもしくは利益の喪失、または事業の中断を含みますが、これらに限定されませ" +"ん)について、\n" +"その原因や、契約、厳格責任、または不法行為(過失その他を含む)のいずれの責任" +"理論に基づくかを問わず、\n" +"たとえ当該損害の可能性を知らされていたとしても、一切責任を負わないものとしま" +"す。" -#: ../../license.rst:1012 msgid "W3C C14N test suite" -msgstr "W3C C14N test suite" +msgstr "W3C C14N テストスイート" -#: ../../license.rst:1014 msgid "" "The C14N 2.0 test suite in the :mod:`test` package (``Lib/test/xmltestdata/" "c14n-20/``) was retrieved from the W3C website at https://www.w3.org/TR/xml-" "c14n2-testcases/ and is distributed under the 3-clause BSD license::" msgstr "" +":mod:`test` パッケージ内の C14N 2.0 テストスイート(``Lib/test/xmltestdata/" +"c14n-20/``)は、W3C のウェブサイト https://www.w3.org/TR/xml-c14n2-" +"testcases/ から取得したもので、3 条項 BSD ライセンスのもとで配布されていま" +"す。 ::" -#: ../../license.rst:1019 msgid "" "Copyright (c) 2013 W3C(R) (MIT, ERCIM, Keio, Beihang),\n" "All Rights Reserved.\n" @@ -1426,14 +2244,40 @@ msgid "" "(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n" "OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." msgstr "" +"Copyright (c) 2013 W3C(R) (MIT, ERCIM, Keio, Beihang),\n" +"All Rights Reserved.\n" +"\n" +"変更の有無を問わず、ソース形式およびバイナリ形式での再配布と使用を、次の条件" +"を満たす場合に許可します:\n" +"* 著作物を再配布する場合、元の著作権表示、この条件一覧、および次の免責事項を" +"保持しなければなりません。\n" +"* バイナリ形式で再配布する場合、配布物に付属するドキュメントおよび/またはそ" +"の他の資料に、元の著作権表示、この条件一覧、および次の免責事項を転載しなけれ" +"ばなりません。\n" +"* 明確な事前の書面による許可なく、本著作物から派生した製品を推奨または宣伝す" +"るために、W3C またはその貢献者の名称を使用してはなりません。\n" +"\n" +"本ソフトウェアは著作権者および貢献者によって「現状のまま」(\"AS IS\")提供さ" +"れ、\n" +"商品性および特定の目的への適合性についての黙示の保証を含む(ただしこれらに限" +"定されない)、\n" +"明示または黙示のすべての保証を否認します。\n" +"著作権者または貢献者は、本ソフトウェアの使用に何らかの形で起因する、直接損" +"害、間接損害、\n" +"付随的損害、特別損害、懲罰的損害、または結果的損害(代替の商品もしくはサービ" +"スの調達、使用機会、\n" +"データもしくは利益の喪失、または事業の中断を含みますが、これらに限定されませ" +"ん)について、\n" +"その原因や、契約、厳格責任、または不法行為(過失その他を含む)のいずれの責任" +"理論に基づくかを問わず、\n" +"たとえ当該損害の可能性を知らされていたとしても、一切責任を負わないものとしま" +"す。" -#: ../../license.rst:1051 msgid "mimalloc" -msgstr "" +msgstr "mimalloc" -#: ../../license.rst:1053 msgid "MIT License::" -msgstr "" +msgstr "MIT License::" #: ../../license.rst:1055 msgid "" @@ -1469,14 +2313,15 @@ msgstr "" msgid "asyncio" msgstr "asyncio" -#: ../../license.rst:1079 msgid "" "Parts of the :mod:`asyncio` module are incorporated from `uvloop 0.16 " "`_, which is distributed " "under the MIT license::" msgstr "" +":mod:`asyncio` モジュールの一部は、MIT ライセンスのもとで配布されている " +"`uvloop 0.16 `_ から組み込" +"まれたものです。 ::" -#: ../../license.rst:1083 msgid "" "Copyright (c) 2015-2021 MagicStack Inc. http://magic.io\n" "\n" @@ -1499,20 +2344,43 @@ msgid "" "OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\n" "WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE." msgstr "" +"Copyright (c) 2015-2021 MagicStack Inc. http://magic.io\n" +"\n" +"本ソフトウェアおよび関連ドキュメントファイル(以下「本ソフトウェア」)のコ" +"ピーを取得するすべての人に、\n" +"本ソフトウェアを制限なく扱うことを、ここに無償で許可します。\n" +"これには、本ソフトウェアのコピーを使用、複製、変更、結合、公開、配布、再許" +"諾、および/または販売する権利、\n" +"ならびに本ソフトウェアの提供先に同じ行為を許可する権利が含まれますが、これら" +"に限定されません。\n" +"ただし、次の条件に従うものとします:\n" +"\n" +"上記の著作権表示および本許諾表示を、本ソフトウェアのすべてのコピーまたは重要" +"な部分に含めなければなりません。\n" +"\n" +"本ソフトウェアは「現状のまま」(\"AS IS\")提供され、商品性、特定の目的への適" +"合性、および非侵害の保証を含む\n" +"(ただしこれらに限定されない)、明示または黙示のいかなる保証もありません。\n" +"作者または著作権者は、契約、不法行為、その他のいずれに基づくかを問わず、本ソ" +"フトウェア、\n" +"または本ソフトウェアの使用その他の取り扱いに起因もしくは関連して生じるいかな" +"る請求、損害、\n" +"その他の責任についても、一切責任を負わないものとします。" -#: ../../license.rst:1106 msgid "Global Unbounded Sequences (GUS)" -msgstr "" +msgstr "Global Unbounded Sequences (GUS)" -#: ../../license.rst:1108 msgid "" "The file :file:`Python/qsbr.c` is adapted from FreeBSD's \"Global Unbounded " "Sequences\" safe memory reclamation scheme in `subr_smr.c `_. The file is " "distributed under the 2-Clause BSD License::" msgstr "" +":file:`Python/qsbr.c` ファイルは、`subr_smr.c `_ にある FreeBSD の「Global " +"Unbounded Sequences」という安全なメモリ回収方式をもとに改変したものです。\n" +"このファイルは 2 条項 BSD ライセンスのもとで配布されています。 ::" -#: ../../license.rst:1113 msgid "" "Copyright (c) 2019,2020 Jeffrey Roberson \n" "\n" @@ -1537,20 +2405,44 @@ msgid "" "(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n" "THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." msgstr "" +"Copyright (c) 2019,2020 Jeffrey Roberson \n" +"\n" +"変更の有無を問わず、ソース形式およびバイナリ形式での再配布と使用を、次の条件" +"を満たす場合に許可します:\n" +"1. ソースコードを再配布する場合、上記の著作権表示を変更せずに、この条件一覧お" +"よび次の免責事項とともに保持しなければなりません。\n" +"2. バイナリ形式で再配布する場合、配布物に付属するドキュメントおよび/またはそ" +"の他の資料に、上記の著作権表示、この条件一覧、および次の免責事項を転載しなけ" +"ればなりません。\n" +"\n" +"本ソフトウェアは作者によって「現状のまま」(\"AS IS\")提供され、\n" +"商品性および特定の目的への適合性についての黙示の保証を含む(ただしこれらに限" +"定されない)、\n" +"明示または黙示のすべての保証を否認します。\n" +"作者は、本ソフトウェアの使用に何らかの形で起因する、直接損害、間接損害、\n" +"付随的損害、特別損害、懲罰的損害、または結果的損害(代替の商品もしくはサービ" +"スの調達、使用機会、\n" +"データもしくは利益の喪失、または事業の中断を含みますが、これらに限定されませ" +"ん)について、\n" +"その原因や、契約、厳格責任、または不法行為(過失その他を含む)のいずれの責任" +"理論に基づくかを問わず、\n" +"たとえ当該損害の可能性を知らされていたとしても、一切責任を負わないものとしま" +"す。" -#: ../../license.rst:1138 msgid "Zstandard bindings" -msgstr "" +msgstr "Zstandard バインディング" -#: ../../license.rst:1140 msgid "" "Zstandard bindings in :file:`Modules/_zstd` and :file:`Lib/compression/zstd` " "are based on code from the `pyzstd library `_, copyright Ma Lin and contributors. The pyzstd code is " "distributed under the 3-Clause BSD License::" msgstr "" +":file:`Modules/_zstd` および :file:`Lib/compression/zstd` の Zstandard バイン" +"ディングは、Ma Lin および貢献者が著作権を持つ `pyzstd ライブラリ `_ のコードに基づいています。\n" +"pyzstd のコードは 3 条項 BSD ライセンスのもとで配布されています。 ::" -#: ../../license.rst:1145 msgid "" "Copyright (c) 2020-present, Ma Lin and contributors.\n" "All rights reserved.\n" @@ -1588,3 +2480,31 @@ msgid "" "USE\n" "OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." msgstr "" +"Copyright (c) 2020-present, Ma Lin and contributors.\n" +"All rights reserved.\n" +"\n" +"変更の有無を問わず、ソース形式およびバイナリ形式での再配布と使用を、次の条件" +"を満たす場合に許可します:\n" +"1. ソースコードを再配布する場合、上記の著作権表示、この条件一覧、および次の免" +"責事項を保持しなければなりません。\n" +"2. バイナリ形式で再配布する場合、配布物に付属するドキュメントおよび/またはそ" +"の他の資料に、上記の著作権表示、この条件一覧、および次の免責事項を転載しなけ" +"ればなりません。\n" +"3. 明確な事前の書面による許可なく、本ソフトウェアから派生した製品を推奨または" +"宣伝するために、著作権者またはその貢献者の名称を使用してはなりません。\n" +"\n" +"本ソフトウェアは著作権者および貢献者によって「現状のまま」(\"AS IS\")提供さ" +"れ、\n" +"商品性および特定の目的への適合性についての黙示の保証を含む(ただしこれらに限" +"定されない)、\n" +"明示または黙示のすべての保証を否認します。\n" +"著作権者または貢献者は、本ソフトウェアの使用に何らかの形で起因する、直接損" +"害、間接損害、\n" +"付随的損害、特別損害、懲罰的損害、または結果的損害(代替の商品もしくはサービ" +"スの調達、使用機会、\n" +"データもしくは利益の喪失、または事業の中断を含みますが、これらに限定されませ" +"ん)について、\n" +"その原因や、契約、厳格責任、または不法行為(過失その他を含む)のいずれの責任" +"理論に基づくかを問わず、\n" +"たとえ当該損害の可能性を知らされていたとしても、一切責任を負わないものとしま" +"す。" diff --git a/reference/compound_stmts.po b/reference/compound_stmts.po index 94142d40b..f608c83ec 100644 --- a/reference/compound_stmts.po +++ b/reference/compound_stmts.po @@ -25,10 +25,10 @@ msgstr "" "Last-Translator: Takeshi Nakazato, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../reference/compound_stmts.rst:5 @@ -84,9 +84,8 @@ msgstr "" "に限り、さらに複合文をネストできます; 以下の文は、 :keyword:`else` 節がどちら" "の :keyword:`if` 節に属するかがはっきりしないなどの理由から不正になります::" -#: ../../reference/compound_stmts.rst:37 msgid "if test1: if test2: print(x)" -msgstr "" +msgstr "if test1: if test2: print(x)" #: ../../reference/compound_stmts.rst:39 msgid "" @@ -98,9 +97,8 @@ msgstr "" "て、以下の例では、 :func:`print` の呼び出しはは全て実行されるか、全く実行され" "ないかのどちらかです::" -#: ../../reference/compound_stmts.rst:43 msgid "if x < y < z: print(x); print(y); print(z)" -msgstr "" +msgstr "if x < y < z: print(x); print(y); print(z)" #: ../../reference/compound_stmts.rst:45 msgid "Summarizing:" @@ -147,8 +145,8 @@ msgstr "" ":keyword:`if` 文は、式を一つ一つ評価してゆき、真になるまで続けて、真になった" "節のスイートだけを選択します (真: true と偽: false の定義については、 :ref:" "`booleans` 節を参照してください); 次に、選択したスイートを実行します (そし" -"て、 :keyword:`if` 文の他の部分は、実行や評価をされません)。全ての式が偽に" -"なった場合、 :keyword:`else` 節があれば、そのスイートが実行されます。" +"て、 ``if`` 文の他の部分は、実行や評価をされません)。全ての式が偽になった場" +"合、 :keyword:`else` 節があれば、そのスイートが実行されます。" #: ../../reference/compound_stmts.rst:109 msgid "The :keyword:`!while` statement" @@ -168,9 +166,9 @@ msgid "" "the suite of the :keyword:`!else` clause, if present, is executed and the " "loop terminates." msgstr "" -":keyword:`while` 文は式を繰り返し真偽評価し、真であれば最初のスイートを実行し" -"ます。式が偽であれば (最初から偽になっていることもありえます)、 :keyword:`!" -"else` 節がある場合にはそれを実行し、ループを終了します。" +"``while`` 文は式を繰り返し真偽評価し、真であれば最初のスイートを実行します。" +"式が偽であれば (最初から偽になっていることもありえます)、 :keyword:`!else` 節" +"がある場合にはそれを実行し、ループを終了します。" #: ../../reference/compound_stmts.rst:133 msgid "" @@ -231,7 +229,6 @@ msgstr "" "for ループはターゲットリスト内の変数への代入を行います。\n" "これにより、for ループ内も含めて、それ以前の全ての代入は上書きされます::" -#: ../../reference/compound_stmts.rst:183 msgid "" "for i in range(10):\n" " print(i)\n" @@ -239,6 +236,11 @@ msgid "" " # because i will be overwritten with the next\n" " # index in the range" msgstr "" +"for i in range(10):\n" +" print(i)\n" +" i = 5 # for ループには影響しない。\n" +" # i は range の次のインデックスで\n" +" # 上書きされるため。" #: ../../reference/compound_stmts.rst:193 msgid "" @@ -280,17 +282,18 @@ msgstr "" "例外に関するその他の情報は :ref:`exceptions` 節にあります。また、 :keyword:" "`raise` 文の使用による例外の生成に関する情報は、 :ref:`raise` 節にあります。" -#: ../../reference/compound_stmts.rst:235 msgid "" "Support for optionally dropping grouping parentheses when using multiple " "exception types. See :pep:`758`." msgstr "" +"複数の例外型を指定するときに、それらをまとめる丸括弧を省略できるようになりま" +"した。\n" +":pep:`758` を参照してください。" #: ../../reference/compound_stmts.rst:241 msgid ":keyword:`!except` clause" msgstr ":keyword:`!except` 節" -#: ../../reference/compound_stmts.rst:243 msgid "" "The :keyword:`!except` clause(s) specify one or more exception handlers. " "When no exception occurs in the :keyword:`try` clause, no exception handler " @@ -300,8 +303,16 @@ msgid "" "expression-less :keyword:`!except` clause, if present, must be last; it " "matches any exception." msgstr "" +":keyword:`!except` 節は、一つ以上の例外ハンドラーを指定します。\n" +":keyword:`try` 節で例外が起きなければ、例外ハンドラーは実行されません。\n" +":keyword:`!try` スイートで例外が起きると、例外ハンドラーの検索が始まりま" +"す。\n" +"この検索では、例外に一致するものが見付かるまで :keyword:`!except` 節を順に調" +"べます。\n" +"式を持たない :keyword:`!except` 節を指定する場合、それは最後になければなりま" +"せん。\n" +"この節は、すべての例外に一致します。" -#: ../../reference/compound_stmts.rst:251 msgid "" "For an :keyword:`!except` clause with an expression, the expression must " "evaluate to an exception type or a tuple of exception types. Parentheses can " @@ -311,6 +322,12 @@ msgid "" "` of the exception object, or to a tuple that contains " "such a class." msgstr "" +"式を持つ :keyword:`!except` 節では、その式は例外型か例外型のタプルに評価され" +"なければなりません。\n" +"複数の例外型を指定し、``as`` 節を使わない場合は、丸括弧を省略できます。\n" +"送出された例外は、式の評価結果が例外オブジェクトのクラスか、その :term:`仮想" +"でない基底クラス `、またはそのようなクラスを含むタプルに" +"なる :keyword:`!except` 節に一致します。" #: ../../reference/compound_stmts.rst:258 msgid "" @@ -330,9 +347,9 @@ msgid "" "the exception)." msgstr "" ":keyword:`!except` 節のヘッダにある式を値評価するときに例外が発生すると、元々" -"のハンドラ検索はキャンセルされ、新たな例外に対する例外ハンドラの検索を現在" -"の :keyword:`except` 節の外側のコードや呼び出しスタックに対して行います (:" -"keyword:`try` 文全体が例外を発行したかのように扱われます)。" +"のハンドラ検索はキャンセルされ、新たな例外に対する例外ハンドラの検索を現在の " +"``except`` 節の外側のコードや呼び出しスタックに対して行います (:keyword:" +"`try` 文全体が例外を発行したかのように扱われます)。" #: ../../reference/compound_stmts.rst:270 msgid "" @@ -363,17 +380,17 @@ msgstr "" "例外が ``as target`` を使って代入されたとき、それは :keyword:`!except` 節の終" "わりに消去されます。これはちょうど、以下のコード::" -#: ../../reference/compound_stmts.rst:284 msgid "" "except E as N:\n" " foo" msgstr "" +"except E as N:\n" +" foo" #: ../../reference/compound_stmts.rst:287 msgid "was translated to ::" msgstr "が、以下のコードに翻訳されたかのようなものです::" -#: ../../reference/compound_stmts.rst:289 msgid "" "except E as N:\n" " try:\n" @@ -381,6 +398,11 @@ msgid "" " finally:\n" " del N" msgstr "" +"except E as N:\n" +" try:\n" +" foo\n" +" finally:\n" +" del N" #: ../../reference/compound_stmts.rst:295 msgid "" @@ -410,7 +432,6 @@ msgstr "" "例外ハンドラを抜けると、 :mod:`sys` モジュールに格納されている例外の値が、一" "つ前の値に戻ります::" -#: ../../reference/compound_stmts.rst:311 msgid "" ">>> print(sys.exception())\n" "None\n" @@ -430,6 +451,23 @@ msgid "" ">>> print(sys.exception())\n" "None" msgstr "" +">>> print(sys.exception())\n" +"None\n" +">>> try:\n" +"... raise TypeError\n" +"... except:\n" +"... print(repr(sys.exception()))\n" +"... try:\n" +"... raise ValueError\n" +"... except:\n" +"... print(repr(sys.exception()))\n" +"... print(repr(sys.exception()))\n" +"...\n" +"TypeError()\n" +"ValueError()\n" +"TypeError()\n" +">>> print(sys.exception())\n" +"None" #: ../../reference/compound_stmts.rst:336 msgid ":keyword:`!except*` clause" @@ -543,7 +581,6 @@ msgid "" "exception is discarded. For example, this function returns 42." msgstr "" -#: ../../reference/compound_stmts.rst:429 msgid "" "def f():\n" " try:\n" @@ -551,6 +588,11 @@ msgid "" " finally:\n" " return 42" msgstr "" +"def f():\n" +" try:\n" +" 1/0\n" +" finally:\n" +" return 42" #: ../../reference/compound_stmts.rst:437 msgid "" @@ -567,11 +609,10 @@ msgid "" "finally` statement, the :keyword:`!finally` clause is also executed 'on the " "way out.'" msgstr "" -":keyword:`try`...\\ :keyword:`!finally` 文の :keyword:`try` スイート内で :" +":keyword:`!try`...\\ :keyword:`!finally` 文の :keyword:`try` スイート内で :" "keyword:`return` 、 :keyword:`break` 、または :keyword:`continue` 文が実行さ" "れた場合、 :keyword:`!finally` 節も、この文を '抜け出る途中に' 実行されます。" -#: ../../reference/compound_stmts.rst:449 msgid "" "The return value of a function is determined by the last :keyword:`return` " "statement executed. Since the :keyword:`!finally` clause always executes, " @@ -579,8 +620,11 @@ msgid "" "will always be the last one executed. The following function returns " "'finally'." msgstr "" +"関数の戻り値は、最後に実行した :keyword:`return` 文で決まります。\n" +":keyword:`!finally` 節は常に実行されるため、:keyword:`!finally` 節の中で実行" +"する :keyword:`!return` 文は常に最後に実行されるものになります。\n" +"次の関数は 'finally' を返します。" -#: ../../reference/compound_stmts.rst:454 msgid "" "def foo():\n" " try:\n" @@ -588,21 +632,27 @@ msgid "" " finally:\n" " return 'finally'" msgstr "" +"def foo():\n" +" try:\n" +" return 'try'\n" +" finally:\n" +" return 'finally'" -#: ../../reference/compound_stmts.rst:462 msgid "" "Prior to Python 3.8, a :keyword:`continue` statement was illegal in the :" "keyword:`!finally` clause due to a problem with the implementation." msgstr "" -"Python3.8 以前では、実装上の問題により :keyword:`!finally` 節での :keyword:" -"`continue` 文は不正でした。" +"Python 3.8 より前は、実装上の問題により :keyword:`!finally` 節で :keyword:" +"`continue` 文を使うことはできませんでした。" -#: ../../reference/compound_stmts.rst:466 msgid "" "The compiler emits a :exc:`SyntaxWarning` when a :keyword:`return`, :keyword:" "`break` or :keyword:`continue` appears in a :keyword:`!finally` block (see :" "pep:`765`)." msgstr "" +":keyword:`!finally` ブロックに :keyword:`return`、:keyword:`break`、:keyword:" +"`continue` がある場合、コンパイラは :exc:`SyntaxWarning` を発するようになりま" +"した (:pep:`765` を参照)。" #: ../../reference/compound_stmts.rst:476 msgid "The :keyword:`!with` statement" @@ -719,11 +769,12 @@ msgstr "" msgid "The following code::" msgstr "以下のコード::" -#: ../../reference/compound_stmts.rst:535 msgid "" "with EXPRESSION as TARGET:\n" " SUITE" msgstr "" +"with EXPRESSION as TARGET:\n" +" SUITE" #: ../../reference/compound_stmts.rst:538 #: ../../reference/compound_stmts.rst:563 @@ -759,18 +810,21 @@ msgstr "" "複数の要素があるとき、コンテキストマネージャは複数の :keyword:`with` 文がネス" "トされたかのように進行します::" -#: ../../reference/compound_stmts.rst:560 msgid "" "with A() as a, B() as b:\n" " SUITE" msgstr "" +"with A() as a, B() as b:\n" +" SUITE" -#: ../../reference/compound_stmts.rst:565 msgid "" "with A() as a:\n" " with B() as b:\n" " SUITE" msgstr "" +"with A() as a:\n" +" with B() as b:\n" +" SUITE" #: ../../reference/compound_stmts.rst:569 msgid "" @@ -781,7 +835,6 @@ msgstr "" "できます。\n" "例::" -#: ../../reference/compound_stmts.rst:572 msgid "" "with (\n" " A() as a,\n" @@ -789,6 +842,11 @@ msgid "" "):\n" " SUITE" msgstr "" +"with (\n" +" A() as a,\n" +" B() as b,\n" +"):\n" +" SUITE" #: ../../reference/compound_stmts.rst:578 msgid "Support for multiple context expressions." @@ -960,7 +1018,6 @@ msgstr "" msgid "A sample match statement::" msgstr "簡単な match 文の例::" -#: ../../reference/compound_stmts.rst:680 msgid "" ">>> flag = False\n" ">>> match (100, 200):\n" @@ -975,6 +1032,18 @@ msgid "" "...\n" "Case 3, y: 200" msgstr "" +">>> flag = False\n" +">>> match (100, 200):\n" +"... case (100, 300): # 不一致: 200 != 300\n" +"... print('Case 1')\n" +"... case (100, 200) if flag: # マッチするが、ガードは失敗する\n" +"... print('Case 2')\n" +"... case (100, y): # マッチし、y を 200 に束縛する\n" +"... print(f'Case 3, y: {y}')\n" +"... case _: # このパターンは試さない\n" +"... print('Case 4, I match anything!')\n" +"...\n" +"Case 3, y: 200" #: ../../reference/compound_stmts.rst:694 msgid "" @@ -1383,116 +1452,137 @@ msgstr "" msgid "Group Patterns" msgstr "グループパターン" -#: ../../reference/compound_stmts.rst:939 msgid "" "A group pattern allows users to add parentheses around patterns to emphasize " "the intended grouping. Otherwise, it has no additional syntax. Syntax:" msgstr "" +"グループパターンでは、意図したグループ化を強調するためにパターンを丸括弧で囲" +"めます。\n" +"それ以外に追加の構文はありません。\n" +"構文:" -#: ../../reference/compound_stmts.rst:946 msgid "In simple terms ``(P)`` has the same effect as ``P``." -msgstr "" +msgstr "簡単に言うと、``(P)`` は ``P`` と同じ効果を持ちます。" #: ../../reference/compound_stmts.rst:951 msgid "Sequence Patterns" msgstr "シーケンスパターン" -#: ../../reference/compound_stmts.rst:953 msgid "" "A sequence pattern contains several subpatterns to be matched against " "sequence elements. The syntax is similar to the unpacking of a list or tuple." msgstr "" +"シーケンスパターンには、シーケンスの要素と照合する複数のサブパターンが含まれ" +"ます。\n" +"構文はリストやタプルのアンパックと似ています。" -#: ../../reference/compound_stmts.rst:964 msgid "" "There is no difference if parentheses or square brackets are used for " "sequence patterns (i.e. ``(...)`` vs ``[...]`` )." msgstr "" +"シーケンスパターンを丸括弧で囲むか角括弧で囲むか (``(...)`` と ``[...]``) に" +"よる違いはありません。" -#: ../../reference/compound_stmts.rst:968 msgid "" "A single pattern enclosed in parentheses without a trailing comma (e.g. ``(3 " "| 4)``) is a :ref:`group pattern `. While a single pattern " "enclosed in square brackets (e.g. ``[3 | 4]``) is still a sequence pattern." msgstr "" +"単一のパターンを末尾のカンマなしで丸括弧で囲んだもの (例: ``(3 | 4)``) は :" +"ref:`グループパターン ` です。\n" +"一方、単一のパターンを角括弧で囲んだもの (例: ``[3 | 4]``) はシーケンスパター" +"ンです。" -#: ../../reference/compound_stmts.rst:973 msgid "" "At most one star subpattern may be in a sequence pattern. The star " "subpattern may occur in any position. If no star subpattern is present, the " "sequence pattern is a fixed-length sequence pattern; otherwise it is a " "variable-length sequence pattern." msgstr "" +"シーケンスパターンに含められる星付きサブパターンは最大一つです。\n" +"星付きサブパターンはどの位置に置いても構いません。\n" +"星付きサブパターンがなければ固定長のシーケンスパターン、あれば可変長のシーケ" +"ンスパターンになります。" -#: ../../reference/compound_stmts.rst:978 msgid "" "The following is the logical flow for matching a sequence pattern against a " "subject value:" msgstr "" +"シーケンスパターンをサブジェクト値と照合する論理的な処理の流れは次のとおりで" +"す:" -#: ../../reference/compound_stmts.rst:981 msgid "" "If the subject value is not a sequence [#]_, the sequence pattern fails." msgstr "" +"サブジェクト値がシーケンス [#]_ でなければ、シーケンスパターンは失敗します。" -#: ../../reference/compound_stmts.rst:984 msgid "" "If the subject value is an instance of ``str``, ``bytes`` or ``bytearray`` " "the sequence pattern fails." msgstr "" +"サブジェクト値が ``str``、``bytes``、``bytearray`` のインスタンスであれば、" +"シーケンスパターンは失敗します。" -#: ../../reference/compound_stmts.rst:987 msgid "" "The subsequent steps depend on whether the sequence pattern is fixed or " "variable-length." -msgstr "" +msgstr "以降の手順は、シーケンスパターンが固定長か可変長かによって異なります。" -#: ../../reference/compound_stmts.rst:990 msgid "If the sequence pattern is fixed-length:" -msgstr "" +msgstr "シーケンスパターンが固定長の場合:" -#: ../../reference/compound_stmts.rst:992 msgid "" "If the length of the subject sequence is not equal to the number of " "subpatterns, the sequence pattern fails" msgstr "" +"サブジェクトのシーケンスの長さとサブパターンの数が等しくなければ、シーケンス" +"パターンは失敗します。" -#: ../../reference/compound_stmts.rst:995 msgid "" "Subpatterns in the sequence pattern are matched to their corresponding items " "in the subject sequence from left to right. Matching stops as soon as a " "subpattern fails. If all subpatterns succeed in matching their " "corresponding item, the sequence pattern succeeds." msgstr "" +"シーケンスパターン内のサブパターンを、サブジェクトのシーケンスの対応する要素" +"と左から右へ照合します。\n" +"サブパターンが一つでも失敗すると、照合を終了します。\n" +"すべてのサブパターンが対応する要素との照合に成功すれば、シーケンスパターンは" +"成功します。" -#: ../../reference/compound_stmts.rst:1000 msgid "Otherwise, if the sequence pattern is variable-length:" -msgstr "" +msgstr "シーケンスパターンが可変長の場合:" -#: ../../reference/compound_stmts.rst:1002 msgid "" "If the length of the subject sequence is less than the number of non-star " "subpatterns, the sequence pattern fails." msgstr "" +"サブジェクトのシーケンスの長さが、星の付いていないサブパターンの数より少なけ" +"れば、シーケンスパターンは失敗します。" -#: ../../reference/compound_stmts.rst:1005 msgid "" "The leading non-star subpatterns are matched to their corresponding items as " "for fixed-length sequences." msgstr "" +"先頭にある星の付いていないサブパターンは、固定長シーケンスと同じように対応す" +"る要素と照合します。" -#: ../../reference/compound_stmts.rst:1008 msgid "" "If the previous step succeeds, the star subpattern matches a list formed of " "the remaining subject items, excluding the remaining items corresponding to " "non-star subpatterns following the star subpattern." msgstr "" +"前の手順が成功した場合、星付きサブパターンは残りのサブジェクトの要素から作っ" +"たリストと照合します。\n" +"ただし、星付きサブパターンより後にある、星の付いていないサブパターンに対応す" +"る要素は、そのリストから除きます。" -#: ../../reference/compound_stmts.rst:1012 msgid "" "Remaining non-star subpatterns are matched to their corresponding subject " "items, as for a fixed-length sequence." msgstr "" +"残りの星の付いていないサブパターンは、固定長シーケンスと同じように対応するサ" +"ブジェクトの要素と照合します。" #: ../../reference/compound_stmts.rst:1015 msgid "" @@ -1501,11 +1591,12 @@ msgid "" "in a similar manner as :ref:`value patterns `." msgstr "" -#: ../../reference/compound_stmts.rst:1021 msgid "" "In simple terms ``[P1, P2, P3,`` ... ``, P]`` matches only if all the " "following happens:" msgstr "" +"簡単に言うと、``[P1, P2, P3,`` ... ``, P]`` は、次のすべての条件を満たす場" +"合にだけマッチします:" #: ../../reference/compound_stmts.rst:1024 msgid "check ```` is a sequence" @@ -1515,66 +1606,80 @@ msgstr "```` がシーケンスかをチェックする" msgid "``len(subject) == ``" msgstr "``len(subject) == ``" -#: ../../reference/compound_stmts.rst:1026 msgid "" "``P1`` matches ``[0]`` (note that this match can also bind names)" msgstr "" +"``P1`` が ``[0]`` にマッチする (この照合によって名前が束縛される場合" +"もあります)" -#: ../../reference/compound_stmts.rst:1027 msgid "" "``P2`` matches ``[1]`` (note that this match can also bind names)" msgstr "" +"``P2`` が ``[1]`` にマッチする (この照合によって名前が束縛される場合" +"もあります)" -#: ../../reference/compound_stmts.rst:1028 msgid "... and so on for the corresponding pattern/element." -msgstr "" +msgstr "... 以降も、対応するパターンと要素について同様です。" #: ../../reference/compound_stmts.rst:1033 msgid "Mapping Patterns" msgstr "マッピングパターン" -#: ../../reference/compound_stmts.rst:1035 msgid "" "A mapping pattern contains one or more key-value patterns. The syntax is " "similar to the construction of a dictionary. Syntax:" msgstr "" +"マッピングパターンには、キーと値のパターンのペアが一つ以上含まれます。\n" +"構文は辞書の構築と似ています。\n" +"構文:" -#: ../../reference/compound_stmts.rst:1046 msgid "" "At most one double star pattern may be in a mapping pattern. The double " "star pattern must be the last subpattern in the mapping pattern." msgstr "" +"マッピングパターンに含められる二重星付きパターンは最大一つです。\n" +"二重星付きパターンは、マッピングパターンの最後のサブパターンでなければなりま" +"せん。" -#: ../../reference/compound_stmts.rst:1049 msgid "" "Duplicate keys in mapping patterns are disallowed. Duplicate literal keys " "will raise a :exc:`SyntaxError`. Two keys that otherwise have the same value " "will raise a :exc:`ValueError` at runtime." msgstr "" +"マッピングパターンではキーの重複は認められません。\n" +"リテラルのキーが重複すると :exc:`SyntaxError` を送出します。\n" +"それ以外の二つのキーが同じ値を持つ場合は、実行時に :exc:`ValueError` を送出し" +"ます。" -#: ../../reference/compound_stmts.rst:1053 msgid "" "The following is the logical flow for matching a mapping pattern against a " "subject value:" msgstr "" +"マッピングパターンをサブジェクト値と照合する論理的な処理の流れは次のとおりで" +"す:" -#: ../../reference/compound_stmts.rst:1056 msgid "If the subject value is not a mapping [#]_,the mapping pattern fails." msgstr "" +"サブジェクト値がマッピング [#]_ でなければ、マッピングパターンは失敗します。" -#: ../../reference/compound_stmts.rst:1058 msgid "" "If every key given in the mapping pattern is present in the subject mapping, " "and the pattern for each key matches the corresponding item of the subject " "mapping, the mapping pattern succeeds." msgstr "" +"マッピングパターンに指定したすべてのキーがサブジェクトのマッピングに存在し、" +"各キーに対するパターンがサブジェクトの対応する要素にマッチすれば、マッピング" +"パターンは成功します。" -#: ../../reference/compound_stmts.rst:1062 msgid "" "If duplicate keys are detected in the mapping pattern, the pattern is " "considered invalid. A :exc:`SyntaxError` is raised for duplicate literal " "values; or a :exc:`ValueError` for named keys of the same value." msgstr "" +"マッピングパターンにキーの重複が見付かると、そのパターンは無効と見なされま" +"す。\n" +"リテラルの値が重複している場合は :exc:`SyntaxError` を、名前付きのキーが同じ" +"値を持つ場合は :exc:`ValueError` を送出します。" #: ../../reference/compound_stmts.rst:1066 msgid "" @@ -1584,11 +1689,12 @@ msgid "" "`~object.__getitem__`." msgstr "" -#: ../../reference/compound_stmts.rst:1071 msgid "" "In simple terms ``{KEY1: P1, KEY2: P2, ... }`` matches only if all the " "following happens:" msgstr "" +"簡単に言うと、``{KEY1: P1, KEY2: P2, ... }`` は、次のすべての条件を満たす場合" +"にだけマッチします:" #: ../../reference/compound_stmts.rst:1074 msgid "check ```` is a mapping" @@ -1602,125 +1708,134 @@ msgstr "``KEY1 in ``" msgid "``P1`` matches ``[KEY1]``" msgstr "``P1`` は ``[KEY1]`` にマッチする" -#: ../../reference/compound_stmts.rst:1077 msgid "... and so on for the corresponding KEY/pattern pair." -msgstr "" +msgstr "... 以降も、対応する KEY とパターンのペアについて同様です。" #: ../../reference/compound_stmts.rst:1083 msgid "Class Patterns" msgstr "クラスパターン" -#: ../../reference/compound_stmts.rst:1085 msgid "" "A class pattern represents a class and its positional and keyword arguments " "(if any). Syntax:" msgstr "" +"クラスパターンは、クラスと、位置引数やキーワード引数 (あれば) を表します。\n" +"構文:" -#: ../../reference/compound_stmts.rst:1096 msgid "The same keyword should not be repeated in class patterns." -msgstr "" +msgstr "クラスパターン内で同じキーワードを繰り返してはなりません。" -#: ../../reference/compound_stmts.rst:1098 msgid "" "The following is the logical flow for matching a class pattern against a " "subject value:" msgstr "" +"クラスパターンをサブジェクト値と照合する論理的な処理の流れは次のとおりです:" -#: ../../reference/compound_stmts.rst:1101 msgid "" "If ``name_or_attr`` is not an instance of the builtin :class:`type` , raise :" "exc:`TypeError`." msgstr "" +"``name_or_attr`` が組み込みの :class:`type` のインスタンスでなければ、:exc:" +"`TypeError` を送出します。" -#: ../../reference/compound_stmts.rst:1104 msgid "" "If the subject value is not an instance of ``name_or_attr`` (tested via :" "func:`isinstance`), the class pattern fails." msgstr "" +"サブジェクト値が ``name_or_attr`` のインスタンスでなければ (:func:" +"`isinstance` で判定します)、クラスパターンは失敗します。" -#: ../../reference/compound_stmts.rst:1107 msgid "" "If no pattern arguments are present, the pattern succeeds. Otherwise, the " "subsequent steps depend on whether keyword or positional argument patterns " "are present." msgstr "" +"パターン引数がなければ、パターンは成功します。\n" +"引数がある場合、以降の手順はキーワード引数パターンがあるか、位置引数パターン" +"があるかによって異なります。" -#: ../../reference/compound_stmts.rst:1111 msgid "" "For a number of built-in types (specified below), a single positional " "subpattern is accepted which will match the entire subject; for these types " "keyword patterns also work as for other types." msgstr "" +"一部の組み込み型 (後述) は、サブジェクト全体と照合する単一の位置サブパターン" +"を受け付けます。\n" +"これらの型でも、キーワードパターンは他の型と同様に動作します。" -#: ../../reference/compound_stmts.rst:1115 msgid "" "If only keyword patterns are present, they are processed as follows, one by " "one:" -msgstr "" +msgstr "キーワードパターンだけがある場合は、一つずつ次のように処理します:" #: ../../reference/compound_stmts.rst:1118 msgid "I. The keyword is looked up as an attribute on the subject." msgstr "" -#: ../../reference/compound_stmts.rst:1120 msgid "" "If this raises an exception other than :exc:`AttributeError`, the exception " "bubbles up." msgstr "" +"この処理で :exc:`AttributeError` 以外の例外が起きると、その例外を伝播します。" -#: ../../reference/compound_stmts.rst:1123 msgid "If this raises :exc:`AttributeError`, the class pattern has failed." msgstr "" +"この処理で :exc:`AttributeError` が起きると、クラスパターンは失敗します。" -#: ../../reference/compound_stmts.rst:1125 msgid "" "Else, the subpattern associated with the keyword pattern is matched against " "the subject's attribute value. If this fails, the class pattern fails; if " "this succeeds, the match proceeds to the next keyword." msgstr "" +"それ以外の場合、キーワードパターンに対応するサブパターンを、サブジェクトの属" +"性値と照合します。\n" +"失敗すればクラスパターンは失敗し、成功すれば次のキーワードの照合に進みます。" #: ../../reference/compound_stmts.rst:1130 msgid "II. If all keyword patterns succeed, the class pattern succeeds." msgstr "" -#: ../../reference/compound_stmts.rst:1132 msgid "" "If any positional patterns are present, they are converted to keyword " "patterns using the :data:`~object.__match_args__` attribute on the class " "``name_or_attr`` before matching:" msgstr "" +"位置パターンがある場合、照合する前に、クラス ``name_or_attr`` の :data:" +"`~object.__match_args__` 属性を使ってキーワードパターンに変換します:" #: ../../reference/compound_stmts.rst:1136 msgid "" "I. The equivalent of ``getattr(cls, \"__match_args__\", ())`` is called." msgstr "" -#: ../../reference/compound_stmts.rst:1138 msgid "If this raises an exception, the exception bubbles up." -msgstr "" +msgstr "この処理で例外が起きると、その例外を伝播します。" -#: ../../reference/compound_stmts.rst:1140 msgid "" "If the returned value is not a tuple, the conversion fails and :exc:" "`TypeError` is raised." msgstr "" +"戻り値がタプルでなければ、変換は失敗し、:exc:`TypeError` を送出します。" -#: ../../reference/compound_stmts.rst:1143 msgid "" "If there are more positional patterns than ``len(cls.__match_args__)``, :exc:" "`TypeError` is raised." msgstr "" +"位置パターンの数が ``len(cls.__match_args__)`` より多ければ、:exc:" +"`TypeError` を送出します。" -#: ../../reference/compound_stmts.rst:1146 msgid "" "Otherwise, positional pattern ``i`` is converted to a keyword pattern using " "``__match_args__[i]`` as the keyword. ``__match_args__[i]`` must be a " "string; if not :exc:`TypeError` is raised." msgstr "" +"そうでなければ、位置パターン ``i`` を、``__match_args__[i]`` をキーワードとす" +"るキーワードパターンに変換します。\n" +"``__match_args__[i]`` は文字列でなければならず、そうでなければ :exc:" +"`TypeError` を送出します。" -#: ../../reference/compound_stmts.rst:1150 msgid "If there are duplicate keywords, :exc:`TypeError` is raised." -msgstr "" +msgstr "キーワードに重複があれば、:exc:`TypeError` を送出します。" #: ../../reference/compound_stmts.rst:1152 msgid ":ref:`class-pattern-matching`" @@ -1735,11 +1850,10 @@ msgstr "" msgid "the match proceeds as if there were only keyword patterns." msgstr "" -#: ../../reference/compound_stmts.rst:1157 msgid "" "For the following built-in types the handling of positional subpatterns is " "different:" -msgstr "" +msgstr "次の組み込み型では、位置サブパターンの扱いが異なります:" #: ../../reference/compound_stmts.rst:1160 msgid ":class:`bool`" @@ -1787,29 +1901,31 @@ msgstr ":class:`str`" msgid ":class:`tuple`" msgstr ":class:`tuple`" -#: ../../reference/compound_stmts.rst:1172 msgid "" "These classes accept a single positional argument, and the pattern there is " "matched against the whole object rather than an attribute. For example " "``int(0|1)`` matches the value ``0``, but not the value ``0.0``." msgstr "" +"これらのクラスは単一の位置引数を受け付け、そこにあるパターンを属性ではなくオ" +"ブジェクト全体と照合します。\n" +"例えば ``int(0|1)`` は値 ``0`` にはマッチしますが、値 ``0.0`` にはマッチしま" +"せん。" -#: ../../reference/compound_stmts.rst:1176 msgid "" "In simple terms ``CLS(P1, attr=P2)`` matches only if the following happens:" msgstr "" +"簡単に言うと、``CLS(P1, attr=P2)`` は、次の条件を満たす場合にだけマッチしま" +"す:" #: ../../reference/compound_stmts.rst:1178 msgid "``isinstance(, CLS)``" msgstr "``isinstance(, CLS)``" -#: ../../reference/compound_stmts.rst:1179 msgid "convert ``P1`` to a keyword pattern using ``CLS.__match_args__``" -msgstr "" +msgstr "``CLS.__match_args__`` を使って ``P1`` をキーワードパターンに変換する" -#: ../../reference/compound_stmts.rst:1180 msgid "For each keyword argument ``attr=P2``:" -msgstr "" +msgstr "各キーワード引数 ``attr=P2`` について:" #: ../../reference/compound_stmts.rst:1182 msgid "``hasattr(, \"attr\")``" @@ -1819,9 +1935,8 @@ msgstr "``hasattr(, \"attr\")``" msgid "``P2`` matches ``.attr``" msgstr "``P2`` は ``.attr`` にマッチする" -#: ../../reference/compound_stmts.rst:1185 msgid "... and so on for the corresponding keyword argument/pattern pair." -msgstr "" +msgstr "... 以降も、対応するキーワード引数とパターンのペアについて同様です。" #: ../../reference/compound_stmts.rst:1200 msgid "Function definitions" @@ -1871,23 +1986,26 @@ msgstr "" "ばなりません。関数オブジェクトの代わりに、返された値が関数名に束縛されます。" "複数のデコレータはネストして適用されます。例えば、以下のようなコード::" -#: ../../reference/compound_stmts.rst:1256 msgid "" "@f1(arg)\n" "@f2\n" "def func(): pass" msgstr "" +"@f1(arg)\n" +"@f2\n" +"def func(): pass" #: ../../reference/compound_stmts.rst:1260 #: ../../reference/compound_stmts.rst:1449 msgid "is roughly equivalent to ::" msgstr "は、だいたい次と等価です ::" -#: ../../reference/compound_stmts.rst:1262 msgid "" "def func(): pass\n" "func = f1(arg)(f2(func))" msgstr "" +"def func(): pass\n" +"func = f1(arg)(f2(func))" #: ../../reference/compound_stmts.rst:1265 msgid "" @@ -1897,14 +2015,16 @@ msgstr "" "ただし、前者のコードでは元々の関数を ``func`` という名前へ一時的に束縛するこ" "とはない、というところを除きます。" -#: ../../reference/compound_stmts.rst:1267 msgid "" "Functions may be decorated with any valid :token:`~python-grammar:" "assignment_expression`. Previously, the grammar was much more restrictive; " "see :pep:`614` for details." msgstr "" +"有効な任意の :token:`~python-grammar:assignment_expression` で関数をデコレー" +"トできるようになりました。\n" +"以前の文法には、より厳しい制約がありました。\n" +"詳しくは :pep:`614` を参照してください。" -#: ../../reference/compound_stmts.rst:1272 msgid "" "A list of :ref:`type parameters ` may be given in square " "brackets between the function's name and the opening parenthesis for its " @@ -1913,11 +2033,15 @@ msgid "" "function's :attr:`~function.__type_params__` attribute. See :ref:`generic-" "functions` for more." msgstr "" +"関数名と仮引数リストの開き丸括弧の間に、角括弧で囲んだ :ref:`型パラメータ " +"` のリストを指定できます。\n" +"これは、関数がジェネリックであることを静的型チェッカーに示します。\n" +"実行時には、関数の :attr:`~function.__type_params__` 属性から型パラメータを取" +"得できます。\n" +"詳しくは :ref:`generic-functions` を参照してください。" -#: ../../reference/compound_stmts.rst:1279 -#: ../../reference/compound_stmts.rst:1468 msgid "Type parameter lists are new in Python 3.12." -msgstr "" +msgstr "型パラメータリストは Python 3.12 で追加されました。" #: ../../reference/compound_stmts.rst:1287 msgid "" @@ -1959,7 +2083,6 @@ msgstr "" "``None`` を使い、この値を関数本体の中で明示的にテストします。例えば以下のよう" "にします::" -#: ../../reference/compound_stmts.rst:1305 msgid "" "def whats_on_the_telly(penguin=None):\n" " if penguin is None:\n" @@ -1967,6 +2090,11 @@ msgid "" " penguin.append(\"property of the zoo\")\n" " return penguin" msgstr "" +"def whats_on_the_telly(penguin=None):\n" +" if penguin is None:\n" +" penguin = []\n" +" penguin.append(\"property of the zoo\")\n" +" return penguin" #: ../../reference/compound_stmts.rst:1316 msgid "" @@ -1997,13 +2125,13 @@ msgstr "" "\"``/``\" の前のパラメタは位置専用パラメータで、位置引数によってのみ渡されま" "す。" -#: ../../reference/compound_stmts.rst:1328 msgid "" "The ``/`` function parameter syntax may be used to indicate positional-only " "parameters. See :pep:`570` for details." msgstr "" +"関数の仮引数で ``/`` 構文を使い、位置専用引数を示せるようになりました。\n" +"詳しくは :pep:`570` を参照してください。" -#: ../../reference/compound_stmts.rst:1337 msgid "" "Parameters may have an :term:`annotation ` of the form " "\"``: expression``\" following the parameter name. Any parameter may have " @@ -2015,14 +2143,26 @@ msgid "" "does not change the semantics of a function. See :ref:`annotations` for more " "information on annotations." msgstr "" +"仮引数には、名前の後に ``: expression`` の形式で :term:`アノテーション " +"` を付けられます。\n" +"``*identifier`` や ``**identifier`` の形式の仮引数も含め、どの仮引数にもアノ" +"テーションを付けられます。\n" +"特例として、``*identifier`` 形式の仮引数には ``: *expression`` というアノテー" +"ションを付けられます。\n" +"関数には、仮引数リストの後に ``-> expression`` の形式で「戻り値」のアノテー" +"ションを付けられます。\n" +"これらのアノテーションには、有効な任意の Python 式を使えます。\n" +"アノテーションの有無によって、関数の意味は変わりません。\n" +"アノテーションについての詳細は :ref:`annotations` を参照してください。" -#: ../../reference/compound_stmts.rst:1345 msgid "" "Parameters of the form \"``*identifier``\" may have an annotation \"``: " "*expression``\". See :pep:`646`." msgstr "" +"``*identifier`` 形式の仮引数に ``: *expression`` というアノテーションを付けら" +"れるようになりました。\n" +":pep:`646` を参照してください。" -#: ../../reference/compound_stmts.rst:1351 msgid "" "It is also possible to create anonymous functions (functions not bound to a " "name), for immediate use in expressions. This uses lambda expressions, " @@ -2033,14 +2173,13 @@ msgid "" "keyword:`!def`\" form is actually more powerful since it allows the " "execution of multiple statements and annotations." msgstr "" -"式を即時に使用するために、無名関数 (名前に束縛されていない関数) を作成するこ" +"式の中ですぐに使うために、無名関数 (名前に束縛されていない関数) を作成するこ" "ともできます。\n" -"これは :ref:`lambda` の節で解説されているラムダ式を使います。\n" -"ラムダ式は簡略化された関数定義の簡略表現に過ぎないことに注意してください; " -"\":keyword:`def`\" 文で定義された関数もラムダ式で作成された関数のように、引数" -"として渡せたり、他の名前に割り当てることができます。\n" -"複数の式とアノテーションが実行できるので、 \":keyword:`!def`\" 形式の方がより" -"強力です。" +"これには :ref:`lambda` 節で説明するラムダ式を使います。\n" +"ラムダ式は、簡単な関数定義の省略記法にすぎません。\n" +":keyword:`def` 文で定義した関数も、ラムダ式で定義した関数と同じように、引数と" +"して渡したり別の名前に代入したりできます。\n" +"複数の文やアノテーションを使えるため、:keyword:`!def` 形式のほうが強力です。" #: ../../reference/compound_stmts.rst:1359 msgid "" @@ -2075,11 +2214,10 @@ msgstr "アノテーションの標準的な意味付けである型ヒントの msgid ":pep:`526` - Syntax for Variable Annotations" msgstr ":pep:`526` - Syntax for Variable Annotations" -#: ../../reference/compound_stmts.rst:1374 msgid "" "Ability to type hint variable declarations, including class variables and " "instance variables." -msgstr "" +msgstr "クラス変数やインスタンス変数を含め、変数宣言に型ヒントを付ける機能。" #: ../../reference/compound_stmts.rst:1377 msgid ":pep:`563` - Postponed Evaluation of Annotations" @@ -2093,15 +2231,15 @@ msgstr "" "実行時にアノテーションを貪欲評価するのではなく文字列形式で保持することによ" "る、アノテーションにおける前方参照のサポート" -#: ../../reference/compound_stmts.rst:1381 msgid ":pep:`318` - Decorators for Functions and Methods" -msgstr "" +msgstr ":pep:`318` - 関数とメソッドのデコレータ" -#: ../../reference/compound_stmts.rst:1382 msgid "" "Function and method decorators were introduced. Class decorators were " "introduced in :pep:`3129`." msgstr "" +"関数とメソッドのデコレータが導入されました。\n" +"クラスのデコレータは :pep:`3129` で導入されました。" #: ../../reference/compound_stmts.rst:1388 msgid "Class definitions" @@ -2124,21 +2262,23 @@ msgstr "" "トのそれぞれの要素の評価はサブクラス化しても良いクラスであるべきです。継承リ" "ストのないクラスは、デフォルトで、基底クラス :class:`object` を継承するので::" -#: ../../reference/compound_stmts.rst:1416 msgid "" "class Foo:\n" " pass" msgstr "" +"class Foo:\n" +" pass" #: ../../reference/compound_stmts.rst:1419 msgid "is equivalent to ::" msgstr "は、以下と同等です ::" -#: ../../reference/compound_stmts.rst:1421 msgid "" "class Foo(object):\n" " pass" msgstr "" +"class Foo(object):\n" +" pass" #: ../../reference/compound_stmts.rst:1424 msgid "" @@ -2159,13 +2299,16 @@ msgstr "" "辞書に、それぞれ使ってクラスオブジェクトが生成されます。最後に、もとのローカ" "ル名前空間において、クラス名がこのクラスオブジェクトに束縛されます。" -#: ../../reference/compound_stmts.rst:1433 msgid "" "The order in which attributes are defined in the class body is preserved in " "the new class's :attr:`~type.__dict__`. Note that this is reliable only " "right after the class is created and only for classes that were defined " "using the definition syntax." msgstr "" +"クラス本体での属性の定義順序は、新しいクラスの :attr:`~type.__dict__` に保持" +"されます。\n" +"ただし、この順序を確実に頼りにできるのは、クラス定義の構文を使って定義したク" +"ラスの、作成直後だけです。" #: ../../reference/compound_stmts.rst:1438 msgid "" @@ -2180,18 +2323,21 @@ msgid "Classes can also be decorated: just like when decorating functions, ::" msgstr "" "関数をデコレートするのと同じように、クラスもデコレートすることが出来ます、 ::" -#: ../../reference/compound_stmts.rst:1445 msgid "" "@f1(arg)\n" "@f2\n" "class Foo: pass" msgstr "" +"@f1(arg)\n" +"@f2\n" +"class Foo: pass" -#: ../../reference/compound_stmts.rst:1451 msgid "" "class Foo: pass\n" "Foo = f1(arg)(f2(Foo))" msgstr "" +"class Foo: pass\n" +"Foo = f1(arg)(f2(Foo))" #: ../../reference/compound_stmts.rst:1454 msgid "" @@ -2201,14 +2347,16 @@ msgstr "" "デコレータ式の評価規則は関数デコレータと同じです。結果はクラス名に束縛されま" "す。" -#: ../../reference/compound_stmts.rst:1457 msgid "" "Classes may be decorated with any valid :token:`~python-grammar:" "assignment_expression`. Previously, the grammar was much more restrictive; " "see :pep:`614` for details." msgstr "" +"有効な任意の :token:`~python-grammar:assignment_expression` でクラスをデコ" +"レートできるようになりました。\n" +"以前の文法には、より厳しい制約がありました。\n" +"詳しくは :pep:`614` を参照してください。" -#: ../../reference/compound_stmts.rst:1462 msgid "" "A list of :ref:`type parameters ` may be given in square " "brackets immediately after the class's name. This indicates to static type " @@ -2216,6 +2364,12 @@ msgid "" "retrieved from the class's :attr:`~type.__type_params__` attribute. See :ref:" "`generic-classes` for more." msgstr "" +"クラス名の直後に、角括弧で囲んだ :ref:`型パラメータ ` のリストを" +"指定できます。\n" +"これは、クラスがジェネリックであることを静的型チェッカーに示します。\n" +"実行時には、クラスの :attr:`~type.__type_params__` 属性から型パラメータを取得" +"できます。\n" +"詳しくは :ref:`generic-classes` を参照してください。" #: ../../reference/compound_stmts.rst:1471 msgid "" @@ -2270,16 +2424,16 @@ msgstr "コルーチン" msgid "Coroutine function definition" msgstr "コルーチン関数定義" -#: ../../reference/compound_stmts.rst:1514 msgid "" "Execution of Python coroutines can be suspended and resumed at many points " "(see :term:`coroutine`). :keyword:`await` expressions, :keyword:`async for` " "and :keyword:`async with` can only be used in the body of a coroutine " "function." msgstr "" -"Python で実行しているコルーチンは多くの時点で一時停止と再開ができます (:term:" -"`coroutine` を参照)。:keyword:`await` 式である :keyword:`async for` と :" -"keyword:`async with` はコルーチン関数の本体でしか使えません。" +"Python のコルーチンの実行は、多くの箇所で一時停止して再開できます (:term:" +"`coroutine` を参照)。\n" +":keyword:`await` 式、:keyword:`async for`、:keyword:`async with` は、コルーチ" +"ン関数の本体の中でだけ使えます。" #: ../../reference/compound_stmts.rst:1518 msgid "" @@ -2301,18 +2455,21 @@ msgstr "" msgid "An example of a coroutine function::" msgstr "コルーチン関数の例::" -#: ../../reference/compound_stmts.rst:1526 msgid "" "async def func(param1, param2):\n" " do_stuff()\n" " await some_coroutine()" msgstr "" +"async def func(param1, param2):\n" +" do_stuff()\n" +" await some_coroutine()" -#: ../../reference/compound_stmts.rst:1530 msgid "" "``await`` and ``async`` are now keywords; previously they were only treated " "as such inside the body of a coroutine function." msgstr "" +"``await`` と ``async`` がキーワードになりました。\n" +"以前は、コルーチン関数の本体の中でのみキーワードとして扱われていました。" #: ../../reference/compound_stmts.rst:1538 msgid "The :keyword:`!async for` statement" @@ -2336,13 +2493,16 @@ msgstr "" "``async for`` 文によって非同期なイテラブルを簡単にイテレーションすることがで" "きます。" -#: ../../reference/compound_stmts.rst:1552 msgid "" "async for TARGET in ITER:\n" " SUITE\n" "else:\n" " SUITE2" msgstr "" +"async for TARGET in ITER:\n" +" SUITE\n" +"else:\n" +" SUITE2" #: ../../reference/compound_stmts.rst:1557 msgid "Is semantically equivalent to::" @@ -2392,11 +2552,12 @@ msgstr "" ":term:`asynchronous context manager` は、 *enter* メソッドと *exit* メソッド" "内部で実行を一時停止できる :term:`context manager` です。" -#: ../../reference/compound_stmts.rst:1593 msgid "" "async with EXPRESSION as TARGET:\n" " SUITE" msgstr "" +"async with EXPRESSION as TARGET:\n" +" SUITE" #: ../../reference/compound_stmts.rst:1598 msgid "" @@ -2446,22 +2607,21 @@ msgstr "" "コルーチンを Python のまともな独り立ちした概念にし、サポートする構文を追加し" "た提案。" -#: ../../reference/compound_stmts.rst:1629 msgid "Type parameter lists" -msgstr "" +msgstr "型パラメータリスト" -#: ../../reference/compound_stmts.rst:1633 msgid "Support for default values was added (see :pep:`696`)." -msgstr "" +msgstr "デフォルト値をサポートしました (:pep:`696` を参照)。" -#: ../../reference/compound_stmts.rst:1646 msgid "" ":ref:`Functions ` (including :ref:`coroutines `), :ref:" "`classes ` and :ref:`type aliases ` may contain a type " "parameter list::" msgstr "" +":ref:`関数 ` (:ref:`コルーチン ` を含む)、:ref:`クラス " +"`、:ref:`型エイリアス ` には型パラメータリストを指定できま" +"す。 ::" -#: ../../reference/compound_stmts.rst:1650 msgid "" "def max[T](args: list[T]) -> T:\n" " ...\n" @@ -2478,16 +2638,32 @@ msgid "" "\n" "type ListOrSet[T] = list[T] | set[T]" msgstr "" +"def max[T](args: list[T]) -> T:\n" +" ...\n" +"\n" +"async def amax[T](args: list[T]) -> T:\n" +" ...\n" +"\n" +"class Bag[T]:\n" +" def __iter__(self) -> Iterator[T]:\n" +" ...\n" +"\n" +" def add(self, arg: T) -> None:\n" +" ...\n" +"\n" +"type ListOrSet[T] = list[T] | set[T]" -#: ../../reference/compound_stmts.rst:1665 msgid "" "Semantically, this indicates that the function, class, or type alias is " "generic over a type variable. This information is primarily used by static " "type checkers, and at runtime, generic objects behave much like their non-" "generic counterparts." msgstr "" +"これは、その関数、クラス、型エイリアスが、型変数に関してジェネリックであるこ" +"とを意味します。\n" +"この情報を主に使うのは静的型チェッカーで、実行時にはジェネリックなオブジェク" +"トは対応する非ジェネリックなものとほぼ同じように動作します。" -#: ../../reference/compound_stmts.rst:1670 msgid "" "Type parameters are declared in square brackets (``[]``) immediately after " "the name of the function, class, or type alias. The type parameters are " @@ -2498,37 +2674,51 @@ msgid "" "function (technically, an :ref:`annotation scope `) that " "wraps the creation of the generic object." msgstr "" +"型パラメータは、関数、クラス、型エイリアスの名前の直後に、角括弧 (``[]``) で" +"囲んで宣言します。\n" +"型パラメータにはジェネリックなオブジェクトのスコープ内でアクセスできますが、" +"それ以外の場所ではアクセスできません。\n" +"そのため、``def func[T](): pass`` と宣言しても、モジュールスコープでは名前 " +"``T`` を使えません。\n" +"以下では、ジェネリックなオブジェクトの意味をより正確に説明します。\n" +"型パラメータのスコープは、ジェネリックなオブジェクトの作成を包む特殊な関数 " +"(厳密には :ref:`アノテーションスコープ `) でモデル化されま" +"す。" -#: ../../reference/compound_stmts.rst:1679 msgid "" "Generic functions, classes, and type aliases have a :attr:`~definition." "__type_params__` attribute listing their type parameters." msgstr "" +"ジェネリックな関数、クラス、型エイリアスは、型パラメータを列挙した :attr:" +"`~definition.__type_params__` 属性を持ちます。" -#: ../../reference/compound_stmts.rst:1682 msgid "Type parameters come in three kinds:" -msgstr "" +msgstr "型パラメータには三つの種類があります:" -#: ../../reference/compound_stmts.rst:1684 msgid "" ":data:`typing.TypeVar`, introduced by a plain name (e.g., ``T``). " "Semantically, this represents a single type to a type checker." msgstr "" +":data:`typing.TypeVar`: 単純な名前 (例: ``T``) で導入します。\n" +"型チェッカーに対して単一の型を表します。" -#: ../../reference/compound_stmts.rst:1686 msgid "" ":data:`typing.TypeVarTuple`, introduced by a name prefixed with a single " "asterisk (e.g., ``*Ts``). Semantically, this stands for a tuple of any " "number of types." msgstr "" +":data:`typing.TypeVarTuple`: 一つのアスタリスクを前に付けた名前 (例: " +"``*Ts``) で導入します。\n" +"任意の数の型からなるタプルを表します。" -#: ../../reference/compound_stmts.rst:1689 msgid "" ":data:`typing.ParamSpec`, introduced by a name prefixed with two asterisks " "(e.g., ``**P``). Semantically, this stands for the parameters of a callable." msgstr "" +":data:`typing.ParamSpec`: 二つのアスタリスクを前に付けた名前 (例: ``**P``) で" +"導入します。\n" +"呼び出し可能オブジェクトの仮引数を表します。" -#: ../../reference/compound_stmts.rst:1692 msgid "" ":data:`typing.TypeVar` declarations can define *bounds* and *constraints* " "with a colon (``:``) followed by an expression. A single expression after " @@ -2539,8 +2729,17 @@ msgid "" "should be a type (again, this is not enforced at runtime). Constrained type " "variables can only take on one of the types in the list of constraints." msgstr "" +":data:`typing.TypeVar` の宣言では、コロン (``:``) の後に式を記述して、*上限* " +"や *制約* を定義できます。\n" +"コロンの後の単一の式は上限を表します (例: ``T: int``)。\n" +"これは、:data:`!typing.TypeVar` が、その上限のサブタイプだけを表せることを意" +"味します。\n" +"コロンの後の、丸括弧で囲んだ式のタプルは、制約の集合を表します (例: ``T: " +"(str, bytes)``)。\n" +"タプルの各要素は型でなければなりません (ただし、これも実行時には強制されませ" +"ん)。\n" +"制約付きの型変数が取れるのは、制約のリストにある型のいずれかだけです。" -#: ../../reference/compound_stmts.rst:1701 msgid "" "For :data:`!typing.TypeVar`\\ s declared using the type parameter list " "syntax, the bound and constraints are not evaluated when the generic object " @@ -2549,14 +2748,20 @@ msgid "" "bounds or constraints are evaluated in a separate :ref:`annotation scope " "`." msgstr "" +"型パラメータリストの構文で宣言した :data:`!typing.TypeVar` では、ジェネリック" +"なオブジェクトの作成時には上限と制約を評価しません。\n" +"``__bound__`` 属性や ``__constraints__`` 属性を通じて明示的に値にアクセスした" +"ときに初めて評価します。\n" +"これを実現するため、上限や制約は独立した :ref:`アノテーションスコープ " +"` 内で評価します。" -#: ../../reference/compound_stmts.rst:1707 msgid "" ":data:`typing.TypeVarTuple`\\ s and :data:`typing.ParamSpec`\\ s cannot have " "bounds or constraints." msgstr "" +":data:`typing.TypeVarTuple` と :data:`typing.ParamSpec` には、上限や制約を指" +"定できません。" -#: ../../reference/compound_stmts.rst:1710 msgid "" "All three flavors of type parameters can also have a *default value*, which " "is used when the type parameter is not explicitly provided. This is added by " @@ -2568,12 +2773,20 @@ msgid "" "default value is specified for a type parameter, the ``__default__`` " "attribute is set to the special sentinel object :data:`typing.NoDefault`." msgstr "" +"三種類すべての型パラメータに、その型パラメータを明示的に指定しなかった場合に" +"使う *デフォルト値* も指定できます。\n" +"一つの等号 (``=``) と式を後に付けて指定します。\n" +"型変数の上限や制約と同様に、デフォルト値はオブジェクトの作成時には評価せず、" +"型パラメータの ``__default__`` 属性にアクセスしたときに初めて評価します。\n" +"そのため、デフォルト値は独立した :ref:`アノテーションスコープ ` 内で評価します。\n" +"型パラメータにデフォルト値を指定しなければ、``__default__`` 属性は特別な番兵" +"オブジェクト :data:`typing.NoDefault` になります。" -#: ../../reference/compound_stmts.rst:1720 msgid "" "The following example indicates the full set of allowed type parameter " "declarations::" -msgstr "" +msgstr "次の例は、指定できる型パラメータ宣言のすべての種類を示しています。 ::" #: ../../reference/compound_stmts.rst:1722 msgid "" @@ -2593,24 +2806,18 @@ msgid "" "): ..." msgstr "" -#: ../../reference/compound_stmts.rst:1740 msgid "Generic functions" -msgstr "" +msgstr "ジェネリック関数" -#: ../../reference/compound_stmts.rst:1742 msgid "Generic functions are declared as follows::" -msgstr "" +msgstr "ジェネリック関数は次のように宣言します。 ::" -#: ../../reference/compound_stmts.rst:1744 msgid "def func[T](arg: T): ..." -msgstr "" +msgstr "def func[T](arg: T): ..." -#: ../../reference/compound_stmts.rst:1746 -#: ../../reference/compound_stmts.rst:1806 msgid "This syntax is equivalent to::" -msgstr "" +msgstr "この構文は、次のコードと等価です。 ::" -#: ../../reference/compound_stmts.rst:1748 msgid "" "annotation-def TYPE_PARAMS_OF_func():\n" " T = typing.TypeVar(\"T\")\n" @@ -2619,8 +2826,13 @@ msgid "" " return func\n" "func = TYPE_PARAMS_OF_func()" msgstr "" +"annotation-def TYPE_PARAMS_OF_func():\n" +" T = typing.TypeVar(\"T\")\n" +" def func(arg: T): ...\n" +" func.__type_params__ = (T,)\n" +" return func\n" +"func = TYPE_PARAMS_OF_func()" -#: ../../reference/compound_stmts.rst:1755 msgid "" "Here ``annotation-def`` indicates an :ref:`annotation scope `, which is not actually bound to any name at runtime. (One other " @@ -2628,34 +2840,44 @@ msgid "" "attribute access on the :mod:`typing` module, but creates an instance of :" "data:`typing.TypeVar` directly.)" msgstr "" +"ここで ``annotation-def`` は :ref:`アノテーションスコープ ` を表し、実行時には実際にはどの名前にも束縛されません。\n" +"この書き換えでは、もう一つ簡略化しています。\n" +"この構文は :mod:`typing` モジュールの属性アクセスを経由せず、:data:`typing." +"TypeVar` のインスタンスを直接作成します。" -#: ../../reference/compound_stmts.rst:1761 msgid "" "The annotations of generic functions are evaluated within the annotation " "scope used for declaring the type parameters, but the function's defaults " "and decorators are not." msgstr "" +"ジェネリック関数のアノテーションは、型パラメータの宣言に使うアノテーションス" +"コープ内で評価します。\n" +"ただし、関数のデフォルト値とデコレータは、そのスコープ内では評価しません。" -#: ../../reference/compound_stmts.rst:1765 msgid "" "The following example illustrates the scoping rules for these cases, as well " "as for additional flavors of type parameters::" msgstr "" +"次の例は、これらの場合や、その他の種類の型パラメータについて、スコープの規則" +"を示します。 ::" -#: ../../reference/compound_stmts.rst:1768 msgid "" "@decorator\n" "def func[T: int, *Ts, **P](*args: *Ts, arg: Callable[P, T] = some_default):\n" " ..." msgstr "" +"@decorator\n" +"def func[T: int, *Ts, **P](*args: *Ts, arg: Callable[P, T] = some_default):\n" +" ..." -#: ../../reference/compound_stmts.rst:1772 msgid "" "Except for the :ref:`lazy evaluation ` of the :class:" "`~typing.TypeVar` bound, this is equivalent to::" msgstr "" +":class:`~typing.TypeVar` の上限の :ref:`遅延評価 ` を除き、" +"これは次のコードと等価です。 ::" -#: ../../reference/compound_stmts.rst:1775 msgid "" "DEFAULT_OF_arg = some_default\n" "\n" @@ -2676,26 +2898,41 @@ msgid "" " return func\n" "func = decorator(TYPE_PARAMS_OF_func())" msgstr "" +"DEFAULT_OF_arg = some_default\n" +"\n" +"annotation-def TYPE_PARAMS_OF_func():\n" +"\n" +" annotation-def BOUND_OF_T():\n" +" return int\n" +" # 実際には BOUND_OF_T() は必要なときにだけ評価する。\n" +" T = typing.TypeVar(\"T\", bound=BOUND_OF_T())\n" +"\n" +" Ts = typing.TypeVarTuple(\"Ts\")\n" +" P = typing.ParamSpec(\"P\")\n" +"\n" +" def func(*args: *Ts, arg: Callable[P, T] = DEFAULT_OF_arg):\n" +" ...\n" +"\n" +" func.__type_params__ = (T, Ts, P)\n" +" return func\n" +"func = decorator(TYPE_PARAMS_OF_func())" -#: ../../reference/compound_stmts.rst:1794 msgid "" "The capitalized names like ``DEFAULT_OF_arg`` are not actually bound at " "runtime." msgstr "" +"``DEFAULT_OF_arg`` のような大文字を使った名前は、実行時には実際には束縛されま" +"せん。" -#: ../../reference/compound_stmts.rst:1800 msgid "Generic classes" -msgstr "" +msgstr "ジェネリッククラス" -#: ../../reference/compound_stmts.rst:1802 msgid "Generic classes are declared as follows::" -msgstr "" +msgstr "ジェネリッククラスは次のように宣言します。 ::" -#: ../../reference/compound_stmts.rst:1804 msgid "class Bag[T]: ..." -msgstr "" +msgstr "class Bag[T]: ..." -#: ../../reference/compound_stmts.rst:1808 msgid "" "annotation-def TYPE_PARAMS_OF_Bag():\n" " T = typing.TypeVar(\"T\")\n" @@ -2705,21 +2942,33 @@ msgid "" " return Bag\n" "Bag = TYPE_PARAMS_OF_Bag()" msgstr "" +"annotation-def TYPE_PARAMS_OF_Bag():\n" +" T = typing.TypeVar(\"T\")\n" +" class Bag(typing.Generic[T]):\n" +" __type_params__ = (T,)\n" +" ...\n" +" return Bag\n" +"Bag = TYPE_PARAMS_OF_Bag()" -#: ../../reference/compound_stmts.rst:1816 msgid "" "Here again ``annotation-def`` (not a real keyword) indicates an :ref:" "`annotation scope `, and the name ``TYPE_PARAMS_OF_Bag`` " "is not actually bound at runtime." msgstr "" +"ここでも、``annotation-def`` (実際のキーワードではありません) は :ref:`アノ" +"テーションスコープ ` を表します。\n" +"名前 ``TYPE_PARAMS_OF_Bag`` は、実行時には実際には束縛されません。" -#: ../../reference/compound_stmts.rst:1820 msgid "" "Generic classes implicitly inherit from :data:`typing.Generic`. The base " "classes and keyword arguments of generic classes are evaluated within the " "type scope for the type parameters, and decorators are evaluated outside " "that scope. This is illustrated by this example::" msgstr "" +"ジェネリッククラスは暗黙に :data:`typing.Generic` を継承します。\n" +"ジェネリッククラスの基底クラスとキーワード引数は、型パラメータの型スコープ内" +"で評価し、デコレータはそのスコープの外で評価します。\n" +"次の例で示します。 ::" #: ../../reference/compound_stmts.rst:1826 msgid "" @@ -2731,7 +2980,6 @@ msgstr "" msgid "This is equivalent to::" msgstr "これは次と等価です::" -#: ../../reference/compound_stmts.rst:1831 msgid "" "annotation-def TYPE_PARAMS_OF_Bag():\n" " T = typing.TypeVar(\"T\")\n" @@ -2741,28 +2989,33 @@ msgid "" " return Bag\n" "Bag = decorator(TYPE_PARAMS_OF_Bag())" msgstr "" +"annotation-def TYPE_PARAMS_OF_Bag():\n" +" T = typing.TypeVar(\"T\")\n" +" class Bag(Base[T], typing.Generic[T], arg=T):\n" +" __type_params__ = (T,)\n" +" ...\n" +" return Bag\n" +"Bag = decorator(TYPE_PARAMS_OF_Bag())" -#: ../../reference/compound_stmts.rst:1842 msgid "Generic type aliases" -msgstr "" +msgstr "ジェネリックな型エイリアス" -#: ../../reference/compound_stmts.rst:1844 msgid "" "The :keyword:`type` statement can also be used to create a generic type " "alias::" msgstr "" +":keyword:`type` 文は、ジェネリックな型エイリアスの作成にも使えます。 ::" -#: ../../reference/compound_stmts.rst:1846 msgid "type ListOrSet[T] = list[T] | set[T]" -msgstr "" +msgstr "type ListOrSet[T] = list[T] | set[T]" -#: ../../reference/compound_stmts.rst:1848 msgid "" "Except for the :ref:`lazy evaluation ` of the value, this " "is equivalent to::" msgstr "" +"値の :ref:`遅延評価 ` を除き、これは次のコードと等価で" +"す。 ::" -#: ../../reference/compound_stmts.rst:1851 msgid "" "annotation-def TYPE_PARAMS_OF_ListOrSet():\n" " T = typing.TypeVar(\"T\")\n" @@ -2774,42 +3027,53 @@ msgid "" "type_params=(T,))\n" "ListOrSet = TYPE_PARAMS_OF_ListOrSet()" msgstr "" +"annotation-def TYPE_PARAMS_OF_ListOrSet():\n" +" T = typing.TypeVar(\"T\")\n" +"\n" +" annotation-def VALUE_OF_ListOrSet():\n" +" return list[T] | set[T]\n" +" # 実際には値は遅延評価する\n" +" return typing.TypeAliasType(\"ListOrSet\", VALUE_OF_ListOrSet(), " +"type_params=(T,))\n" +"ListOrSet = TYPE_PARAMS_OF_ListOrSet()" -#: ../../reference/compound_stmts.rst:1860 msgid "" "Here, ``annotation-def`` (not a real keyword) indicates an :ref:`annotation " "scope `. The capitalized names like " "``TYPE_PARAMS_OF_ListOrSet`` are not actually bound at runtime." msgstr "" +"ここで ``annotation-def`` (実際のキーワードではありません) は :ref:`アノテー" +"ションスコープ ` を表します。\n" +"``TYPE_PARAMS_OF_ListOrSet`` のような大文字を使った名前は、実行時には実際には" +"束縛されません。" -#: ../../reference/compound_stmts.rst:1867 msgid "Annotations" -msgstr "" +msgstr "アノテーション" -#: ../../reference/compound_stmts.rst:1869 msgid "Annotations are now lazily evaluated by default." -msgstr "" +msgstr "アノテーションがデフォルトで遅延評価されるようになりました。" -#: ../../reference/compound_stmts.rst:1872 msgid "" "Variables and function parameters may carry :term:`annotations " "`, created by adding a colon after the name, followed by an " "expression::" msgstr "" +"変数と関数の仮引数には、名前の後にコロンと式を付けて :term:`アノテーション " +"` を指定できます。 ::" -#: ../../reference/compound_stmts.rst:1875 msgid "" "x: annotation = 1\n" "def f(param: annotation): ..." msgstr "" +"x: annotation = 1\n" +"def f(param: annotation): ..." -#: ../../reference/compound_stmts.rst:1878 msgid "Functions may also carry a return annotation following an arrow::" msgstr "" +"関数には、矢印の後に戻り値のアノテーションを指定することもできます。 ::" -#: ../../reference/compound_stmts.rst:1880 msgid "def f() -> annotation: ..." -msgstr "" +msgstr "def f() -> annotation: ..." #: ../../reference/compound_stmts.rst:1882 msgid "" @@ -2821,7 +3085,6 @@ msgid "" "`functools.singledispatch`)." msgstr "" -#: ../../reference/compound_stmts.rst:1888 msgid "" "By default, annotations are lazily evaluated in an :ref:`annotation scope " "`. This means that they are not evaluated when the code " @@ -2829,22 +3092,33 @@ msgid "" "information that can be used to evaluate the annotation later if requested. " "The :mod:`annotationlib` module provides tools for evaluating annotations." msgstr "" +"デフォルトでは、アノテーションは :ref:`アノテーションスコープ ` 内で遅延評価されます。\n" +"つまり、アノテーションを含むコードを評価するときには、アノテーションを評価し" +"ません。\n" +"代わりにインタープリタは、後で必要になったときにアノテーションを評価するため" +"の情報を保存します。\n" +":mod:`annotationlib` モジュールには、アノテーションを評価するためのツールが用" +"意されています。" -#: ../../reference/compound_stmts.rst:1893 msgid "" "If the :ref:`future statement ` ``from __future__ import " "annotations`` is present, all annotations are instead stored as strings::" msgstr "" +":ref:`future 文 ` ``from __future__ import annotations`` がある場合" +"は、代わりにすべてのアノテーションを文字列として保存します。 ::" -#: ../../reference/compound_stmts.rst:1896 msgid "" ">>> from __future__ import annotations\n" ">>> def f(param: annotation): ...\n" ">>> f.__annotations__\n" "{'param': 'annotation'}" msgstr "" +">>> from __future__ import annotations\n" +">>> def f(param: annotation): ...\n" +">>> f.__annotations__\n" +"{'param': 'annotation'}" -#: ../../reference/compound_stmts.rst:1901 msgid "" "This future statement will be deprecated and removed in a future version of " "Python, but not before Python 3.13 reaches its end of life (see :pep:`749`). " @@ -2852,6 +3126,11 @@ msgid "" "get_annotations` and :func:`typing.get_type_hints` are less likely to be " "able to resolve annotations at runtime." msgstr "" +"この future 文は将来の Python で非推奨となり、削除される予定ですが、Python " +"3.13 のサポート終了より前には行われません (:pep:`749` を参照)。\n" +"この文を使うと、:func:`annotationlib.get_annotations` や :func:`typing." +"get_type_hints` などのイントロスペクションツールが実行時にアノテーションを解" +"決できる可能性は低くなります。" #: ../../reference/compound_stmts.rst:1909 msgid "Footnotes" @@ -2866,9 +3145,9 @@ msgstr "" "例外は、別の例外を送出するような :keyword:`finally` 節が無い場合にのみ呼び出" "しスタックへ伝わります。新しい例外によって、古い例外は失われます。" -#: ../../reference/compound_stmts.rst:1914 msgid "In pattern matching, a sequence is defined as one of the following:" msgstr "" +"パターンマッチでは、次のいずれかに当てはまるものをシーケンスと定義します:" #: ../../reference/compound_stmts.rst:1916 msgid "a class that inherits from :class:`collections.abc.Sequence`" @@ -2879,19 +3158,16 @@ msgid "" "a Python class that has been registered as :class:`collections.abc.Sequence`" msgstr ":class:`collections.abc.Sequence` として登録されたPythonクラス。" -#: ../../reference/compound_stmts.rst:1918 msgid "" "a builtin class that has its (CPython) :c:macro:`Py_TPFLAGS_SEQUENCE` bit set" msgstr "" +"(CPython の) :c:macro:`Py_TPFLAGS_SEQUENCE` ビットが設定された組み込みクラス" -#: ../../reference/compound_stmts.rst:1919 -#: ../../reference/compound_stmts.rst:1938 msgid "a class that inherits from any of the above" -msgstr "" +msgstr "上記のいずれかを継承するクラス" -#: ../../reference/compound_stmts.rst:1921 msgid "The following standard library classes are sequences:" -msgstr "" +msgstr "標準ライブラリの次のクラスはシーケンスです:" #: ../../reference/compound_stmts.rst:1923 msgid ":class:`array.array`" @@ -2909,49 +3185,53 @@ msgstr ":class:`memoryview`" msgid ":class:`range`" msgstr ":class:`range`" -#: ../../reference/compound_stmts.rst:1930 msgid "" "Subject values of type ``str``, ``bytes``, and ``bytearray`` do not match " "sequence patterns." msgstr "" +"``str``、``bytes``、``bytearray`` 型のサブジェクト値は、シーケンスパターンに" +"はマッチしません。" -#: ../../reference/compound_stmts.rst:1933 msgid "In pattern matching, a mapping is defined as one of the following:" msgstr "" +"パターンマッチでは、次のいずれかに当てはまるものをマッピングと定義します:" -#: ../../reference/compound_stmts.rst:1935 msgid "a class that inherits from :class:`collections.abc.Mapping`" -msgstr "" +msgstr ":class:`collections.abc.Mapping` を継承するクラス" -#: ../../reference/compound_stmts.rst:1936 msgid "" "a Python class that has been registered as :class:`collections.abc.Mapping`" -msgstr "" +msgstr ":class:`collections.abc.Mapping` として登録された Python クラス" -#: ../../reference/compound_stmts.rst:1937 msgid "" "a builtin class that has its (CPython) :c:macro:`Py_TPFLAGS_MAPPING` bit set" msgstr "" +"(CPython の) :c:macro:`Py_TPFLAGS_MAPPING` ビットが設定された組み込みクラス" -#: ../../reference/compound_stmts.rst:1940 msgid "" "The standard library classes :class:`dict` and :class:`types." "MappingProxyType` are mappings." msgstr "" +"標準ライブラリの :class:`dict` と :class:`types.MappingProxyType` はマッピン" +"グです。" -#: ../../reference/compound_stmts.rst:1943 msgid "" "A string literal appearing as the first statement in the function body is " "transformed into the function's :attr:`~function.__doc__` attribute and " "therefore the function's :term:`docstring`." msgstr "" +"関数本体の最初の文として現れる文字列リテラルは、関数の :attr:`~function." +"__doc__` 属性となり、したがって関数の :term:`ドキュメンテーション文字列 " +"` になります。" -#: ../../reference/compound_stmts.rst:1947 msgid "" "A string literal appearing as the first statement in the class body is " "transformed into the namespace's :attr:`~type.__doc__` item and therefore " "the class's :term:`docstring`." msgstr "" +"クラス本体の最初の文として現れる文字列リテラルは、その名前空間の :attr:" +"`~type.__doc__` 要素となり、したがってクラスの :term:`ドキュメンテーション文" +"字列 ` になります。" #: ../../reference/compound_stmts.rst:7 msgid "compound" @@ -2983,9 +3263,8 @@ msgstr "clause" msgid "suite" msgstr "suite" -#: ../../reference/compound_stmts.rst:21 msgid "; (semicolon)" -msgstr "" +msgstr "; (セミコロン)" #: ../../reference/compound_stmts.rst:64 msgid "NEWLINE token" @@ -3038,15 +3317,8 @@ msgstr "elif" msgid ": (colon)" msgstr ": (コロン)" -#: ../../reference/compound_stmts.rst:86 ../../reference/compound_stmts.rst:111 -#: ../../reference/compound_stmts.rst:144 -#: ../../reference/compound_stmts.rst:207 -#: ../../reference/compound_stmts.rst:478 -#: ../../reference/compound_stmts.rst:595 -#: ../../reference/compound_stmts.rst:1202 -#: ../../reference/compound_stmts.rst:1390 msgid "compound statement" -msgstr "" +msgstr "複合文" #: ../../reference/compound_stmts.rst:111 msgid "while" @@ -3119,16 +3391,11 @@ msgstr "except" msgid "finally" msgstr "finally" -#: ../../reference/compound_stmts.rst:207 -#: ../../reference/compound_stmts.rst:268 -#: ../../reference/compound_stmts.rst:478 -#: ../../reference/compound_stmts.rst:595 msgid "as" -msgstr "" +msgstr "as" -#: ../../reference/compound_stmts.rst:268 msgid "except clause" -msgstr "" +msgstr "except 節" #: ../../reference/compound_stmts.rst:301 msgid "module" @@ -3142,9 +3409,8 @@ msgstr "sys" msgid "traceback" msgstr "traceback" -#: ../../reference/compound_stmts.rst:330 msgid "except_star" -msgstr "" +msgstr "except_star" #: ../../reference/compound_stmts.rst:393 #: ../../reference/compound_stmts.rst:440 @@ -3155,9 +3421,8 @@ msgstr "return" msgid "with" msgstr "with" -#: ../../reference/compound_stmts.rst:478 msgid "with statement" -msgstr "" +msgstr "with 文" #: ../../reference/compound_stmts.rst:478 #: ../../reference/compound_stmts.rst:1202 @@ -3165,41 +3430,32 @@ msgstr "" msgid ", (comma)" msgstr ", (comma)" -#: ../../reference/compound_stmts.rst:595 msgid "match" -msgstr "" +msgstr "match" -#: ../../reference/compound_stmts.rst:595 msgid "case" -msgstr "" +msgstr "case" -#: ../../reference/compound_stmts.rst:595 msgid "pattern matching" -msgstr "" +msgstr "パターンマッチ" -#: ../../reference/compound_stmts.rst:595 msgid "match statement" -msgstr "" +msgstr "match 文" -#: ../../reference/compound_stmts.rst:699 msgid "guard" -msgstr "" +msgstr "ガード" -#: ../../reference/compound_stmts.rst:738 msgid "irrefutable case block" -msgstr "" +msgstr "論駁不可能なケースブロック" -#: ../../reference/compound_stmts.rst:738 msgid "case block" -msgstr "" +msgstr "ケースブロック" -#: ../../reference/compound_stmts.rst:762 msgid "! patterns" -msgstr "" +msgstr "! パターン" -#: ../../reference/compound_stmts.rst:762 msgid "AS pattern, OR pattern, capture pattern, wildcard pattern" -msgstr "" +msgstr "AS パターン, OR パターン, キャプチャパターン, ワイルドカードパターン" #: ../../reference/compound_stmts.rst:1193 #: ../../reference/compound_stmts.rst:1282 @@ -3247,14 +3503,11 @@ msgstr "ユーザ定義関数" msgid "() (parentheses)" msgstr "() (丸括弧)" -#: ../../reference/compound_stmts.rst:1202 msgid "parameter list" -msgstr "" +msgstr "仮引数リスト" -#: ../../reference/compound_stmts.rst:1246 -#: ../../reference/compound_stmts.rst:1440 msgid "@ (at)" -msgstr "" +msgstr "@ (アットマーク)" #: ../../reference/compound_stmts.rst:1282 msgid "default" @@ -3324,35 +3577,26 @@ msgstr "inheritance" msgid "docstring" msgstr "docstring" -#: ../../reference/compound_stmts.rst:1390 -#: ../../reference/compound_stmts.rst:1440 msgid "class definition" -msgstr "" +msgstr "クラス定義" -#: ../../reference/compound_stmts.rst:1390 msgid "expression list" -msgstr "" +msgstr "式リスト" -#: ../../reference/compound_stmts.rst:1500 msgid "async def" -msgstr "" +msgstr "async def" -#: ../../reference/compound_stmts.rst:1510 msgid "async" -msgstr "" +msgstr "async" -#: ../../reference/compound_stmts.rst:1510 msgid "await" -msgstr "" +msgstr "await" -#: ../../reference/compound_stmts.rst:1534 msgid "async for" -msgstr "" +msgstr "async for" -#: ../../reference/compound_stmts.rst:1579 msgid "async with" -msgstr "" +msgstr "async with" -#: ../../reference/compound_stmts.rst:1636 msgid "type parameters" -msgstr "" +msgstr "型パラメータ" diff --git a/reference/datamodel.po b/reference/datamodel.po index e326c4123..ee4761b2a 100644 --- a/reference/datamodel.po +++ b/reference/datamodel.po @@ -27,10 +27,10 @@ msgstr "" "Last-Translator: tomo, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../reference/datamodel.rst:6 @@ -81,10 +81,10 @@ msgid "" "an object itself). Like its identity, an object's :dfn:`type` is also " "unchangeable. [#]_" msgstr "" -"オブジェクトの型はオブジェクトがサポートする操作 (例: :func:`len` をサポート" -"するか) と、オブジェクトが取りうる値を決定します。 :func:`type` 関数はオブ" -"ジェクトの型 (型自体もオブジェクトです) を返します。同一性と同じく、オブジェ" -"クトの型(:dfn:`type`) も変更不可能です。 [#]_" +"オブジェクトの型はオブジェクトがサポートする操作 (例: ``len()`` をサポートす" +"るか) と、オブジェクトが取りうる値を決定します。 :func:`type` 関数はオブジェ" +"クトの型 (型自体もオブジェクトです) を返します。同一性と同じく、オブジェクト" +"の型(:dfn:`type`) も変更不可能です。 [#]_" #: ../../reference/datamodel.rst:50 msgid "" @@ -144,15 +144,17 @@ msgstr "" "能になったときに即座に終了処理されることに頼らないでください (ですからファイ" "ルは必ず明示的に閉じてください)。" -#: ../../reference/datamodel.rst:82 msgid "" "Note that the use of the implementation's tracing or debugging facilities " "may keep objects alive that would normally be collectable. Also note that " "catching an exception with a :keyword:`try`...\\ :keyword:`except` statement " "may keep objects alive." msgstr "" +"実装が提供するトレース機能やデバッグ機能を使うと、通常なら回収できるオブジェ" +"クトが生存し続ける場合があります。\n" +"また、:keyword:`try`...\\ :keyword:`except` 文で例外を捕捉することによって" +"も、オブジェクトが生存し続ける場合があります。" -#: ../../reference/datamodel.rst:87 msgid "" "Some objects contain references to \"external\" resources such as open files " "or windows. It is understood that these resources are freed when the object " @@ -163,8 +165,17 @@ msgid "" "`finally` statement and the :keyword:`with` statement provide convenient " "ways to do this." msgstr "" +"開いているファイルやウィンドウなど、外部リソースへの参照を保持するオブジェク" +"トもあります。\n" +"これらのリソースはオブジェクトがガベージコレクションで回収される際に解放され" +"るものとされていますが、ガベージコレクションの実行は保証されません。\n" +"そのため、こうしたオブジェクトは通常 :meth:`!close` メソッドなど、外部リソー" +"スを明示的に解放する手段も提供します。\n" +"プログラムでは、このようなオブジェクトを明示的に閉じることを強く推奨しま" +"す。\n" +":keyword:`try`...\\ :keyword:`finally` 文や :keyword:`with` 文を使うと、これ" +"を簡単に実現できます。" -#: ../../reference/datamodel.rst:97 msgid "" "Some objects contain references to other objects; these are called " "*containers*. Examples of containers are tuples, lists and dictionaries. " @@ -175,17 +186,16 @@ msgid "" "implied. So, if an immutable container (like a tuple) contains a reference " "to a mutable object, its value changes if that mutable object is changed." msgstr "" -"他のオブジェクトに対する参照をもつオブジェクトもあります; これらは *コンテナ " -"(container)* と呼ばれます。コンテナオブジェクトの例として、タプル、リスト、お" -"よび辞書が挙げられます。オブジェクトへの参照自体がコンテナの値の一部です。ほ" -"とんどの場合、コンテナの値というと、コンテナに入っているオブジェクトの値のこ" -"とを指し、それらオブジェクトのアイデンティティではありません; しかしながら、" -"コンテナの変更可能性について述べる場合、今まさにコンテナに入っているオブジェ" -"クトのアイデンティティのことを指します。したがって、 (タプルのように) 変更不" -"能なオブジェクトが変更可能なオブジェクトへの参照を含む場合、その値が変化する" -"のは変更可能なオブジェクトが変更された時、ということになります。" +"ほかのオブジェクトへの参照を含むオブジェクトは *コンテナ* と呼ばれます。\n" +"例えばタプル、リスト、辞書です。\n" +"参照はコンテナの値の一部です。\n" +"コンテナの値というと、通常は格納されたオブジェクトの同一性ではなく値を指しま" +"す。\n" +"一方、コンテナの変更可能性については、直接格納されたオブジェクトの同一性だけ" +"を指します。\n" +"したがって、タプルのような変更不能なコンテナが変更可能なオブジェクトへの参照" +"を含む場合、参照先が変更されるとコンテナの値も変わります。" -#: ../../reference/datamodel.rst:106 msgid "" "Types affect almost all aspects of object behavior. Even the importance of " "object identity is affected in some sense: for immutable types, operations " @@ -201,6 +211,20 @@ msgid "" "newly created empty lists. (Note that ``e = f = []`` assigns the *same* " "object to both *e* and *f*.)" msgstr "" +"型は、オブジェクトの振る舞いのほぼすべてに影響します。\n" +"オブジェクトの同一性が持つ意味さえ、ある意味では型に左右されます。\n" +"変更不能な型では、新しい値を計算する操作が、実際には同じ型と値を持つ既存のオ" +"ブジェクトへの参照を返すことがありますが、変更可能なオブジェクトではこれは許" +"されません。\n" +"例えば ``a = 1; b = 1`` の後、*a* と *b* が値 1 を持つ同じオブジェクトを参照" +"するかどうかは実装によって異なります。\n" +":class:`int` は変更不能な型なので、``1`` への参照を再利用できるためです。\n" +"この動作は実装に依存するため、頼るべきではありませんが、オブジェクトの同一性" +"を調べる際には知っておく必要があります。\n" +"一方、``c = []; d = []`` の後では、*c* と *d* はそれぞれ別々に新しく作成され" +"た空リストを参照することが保証されます。\n" +"(``e = f = []`` は *e* と *f* の両方に *同じ* オブジェクトを代入することに注" +"意してください。)" #: ../../reference/datamodel.rst:124 msgid "The standard type hierarchy" @@ -254,7 +278,6 @@ msgstr "" msgid "NotImplemented" msgstr "NotImplemented" -#: ../../reference/datamodel.rst:165 msgid "" "This type has a single value. There is a single object with this value. " "This object is accessed through the built-in name :data:`NotImplemented`. " @@ -263,22 +286,33 @@ msgid "" "will then try the reflected operation, or some other fallback, depending on " "the operator.) It should not be evaluated in a boolean context." msgstr "" +"この型には値が 1 つしかなく、その値を持つオブジェクトも 1 つだけです。\n" +"このオブジェクトには組み込み名 :data:`NotImplemented` でアクセスします。\n" +"数値演算や拡張比較のメソッドは、与えられた被演算子に対する演算を実装していな" +"い場合、この値を返す必要があります。\n" +"(その場合、インタープリタは演算子に応じて、反射演算やその他の代替処理を試みま" +"す。)\n" +"ブール値を求める文脈で評価してはいけません。" #: ../../reference/datamodel.rst:172 msgid "See :ref:`implementing-the-arithmetic-operations` for more details." msgstr "" "詳細は :ref:`implementing-the-arithmetic-operations` を参照してください。" -#: ../../reference/datamodel.rst:176 msgid "Evaluating :data:`NotImplemented` in a boolean context was deprecated." msgstr "" +"ブール値を求める文脈で :data:`NotImplemented` を評価することが非推奨になりま" +"した。" -#: ../../reference/datamodel.rst:179 msgid "" "Evaluating :data:`NotImplemented` in a boolean context now raises a :exc:" "`TypeError`. It previously evaluated to :const:`True` and emitted a :exc:" "`DeprecationWarning` since Python 3.9." msgstr "" +"ブール値を求める文脈で :data:`NotImplemented` を評価すると、:exc:`TypeError` " +"が送出されるようになりました。\n" +"以前は :const:`True` と評価され、Python 3.9 以降では :exc:" +"`DeprecationWarning` も発生していました。" #: ../../reference/datamodel.rst:186 ../../reference/datamodel.rst:187 msgid "Ellipsis" @@ -349,11 +383,10 @@ msgstr "小数点の後にある 1 つのゼロを除いて、下に連なるゼ msgid "A sign is shown only when the number is negative." msgstr "符号は数値が負数のときのみ表示されます。" -#: ../../reference/datamodel.rst:225 msgid "" "Python distinguishes between integers, floating-point numbers, and complex " "numbers:" -msgstr "" +msgstr "Python は整数、浮動小数点数、複素数を区別します。" #: ../../reference/datamodel.rst:230 msgid ":class:`numbers.Integral`" @@ -420,7 +453,6 @@ msgstr "" msgid ":class:`numbers.Real` (:class:`float`)" msgstr ":class:`numbers.Real` (:class:`float`) (実数)" -#: ../../reference/datamodel.rst:274 msgid "" "These represent machine-level double precision floating-point numbers. You " "are at the mercy of the underlying machine architecture (and C or Java " @@ -430,24 +462,33 @@ msgid "" "dwarfed by the overhead of using objects in Python, so there is no reason to " "complicate the language with two kinds of floating-point numbers." msgstr "" +"マシンレベルの倍精度浮動小数点数を表します。\n" +"表現できる範囲やオーバーフローの扱いは、基盤となるマシンのアーキテクチャ (お" +"よび C や Java の実装) に依存します。\n" +"Python は単精度浮動小数点数をサポートしていません。\n" +"単精度を使う通常の理由であるプロセッサやメモリの使用量の節約は、Python のオブ" +"ジェクトを使うオーバーヘッドに比べるとわずかです。\n" +"そのため、2 種類の浮動小数点数で言語を複雑にする理由がありません。" #: ../../reference/datamodel.rst:284 msgid ":class:`numbers.Complex` (:class:`complex`)" msgstr ":class:`numbers.Complex` (:class:`complex`)" -#: ../../reference/datamodel.rst:290 msgid "" "These represent complex numbers as a pair of machine-level double precision " "floating-point numbers. The same caveats apply as for floating-point " "numbers. The real and imaginary parts of a complex number ``z`` can be " "retrieved through the read-only attributes ``z.real`` and ``z.imag``." msgstr "" +"複素数を、マシンレベルの倍精度浮動小数点数のペアとして表します。\n" +"浮動小数点数と同じ注意事項が当てはまります。\n" +"複素数 ``z`` の実部と虚部は、読み取り専用属性 ``z.real`` と ``z.imag`` で取得" +"できます。" #: ../../reference/datamodel.rst:297 msgid "Sequences" msgstr "シーケンス型 (sequence)" -#: ../../reference/datamodel.rst:306 msgid "" "These represent finite ordered sets indexed by non-negative numbers. The " "built-in function :func:`len` returns the number of items of a sequence. " @@ -457,6 +498,15 @@ msgid "" "adding the sequence length. For example, ``a[-2]`` equals ``a[n-2]``, the " "second to last item of sequence a with length ``n``." msgstr "" +"非負の数をインデックスとする、順序のある有限の集まりを表します。\n" +"組み込み関数 :func:`len` はシーケンスの要素数を返します。\n" +"シーケンスの長さが *n* の場合、インデックスには 0, 1, ..., *n*-1 を使いま" +"す。\n" +"シーケンス *a* の要素 *i* は ``a[i]`` で選択します。\n" +"組み込みシーケンスを含む一部のシーケンスは、負の添字にシーケンスの長さを加え" +"て解釈します。\n" +"例えば ``a[-2]`` は ``a[n-2]`` と等しく、長さ ``n`` のシーケンス ``a`` の末尾" +"から 2 番目の要素です。" #: ../../reference/datamodel.rst:316 msgid "" @@ -576,11 +626,12 @@ msgstr "" "ンスでは、添字表記やスライス表記を使って指定された要素に代入を行うことがで" "き、 :keyword:`del` (delete) 文を使って要素を削除することができます。" -#: ../../reference/datamodel.rst:406 msgid "" "The :mod:`collections` and :mod:`array` module provide additional examples " "of mutable sequence types." msgstr "" +":mod:`collections` モジュールと :mod:`array` モジュールも、変更可能なシーケン" +"ス型の例を提供します。" #: ../../reference/datamodel.rst:409 msgid "There are currently two intrinsic mutable sequence types:" @@ -637,17 +688,16 @@ msgstr "" "般的な使い方は、集合に属しているかの高速なテスト、シーケンスからの重複の排" "除、共通集合・和集合・差・対称差といった数学的な演算の計算です。" -#: ../../reference/datamodel.rst:441 msgid "" "For set elements, the same immutability rules apply as for dictionary keys. " "Note that numeric types obey the normal rules for numeric comparison: if two " "numbers compare equal (e.g., ``1`` and ``1.0``), only one of them can be " "contained in a set." msgstr "" -"集合の要素には、辞書のキーと同じ普遍性に関するルールが適用されます。数値型は" -"通常の数値比較のルールに従うことに注意してください。もし2つの数値の比較結果が" -"同値である(例えば、 ``1`` と ``1.0``)なら、そのうちの1つのみを集合に含めるこ" -"とができます。" +"集合の要素には、辞書のキーと同じ不変性の規則が適用されます。\n" +"数値型は通常の数値比較の規則に従います。\n" +"2 つの数値が等しいと比較される場合 (例えば ``1`` と ``1.0``)、集合にはそのう" +"ち 1 つだけを含められます。" #: ../../reference/datamodel.rst:446 msgid "There are currently two intrinsic set types:" @@ -707,7 +757,6 @@ msgstr "" msgid "Dictionaries" msgstr "辞書型 (dictionary)" -#: ../../reference/datamodel.rst:488 msgid "" "These represent finite sets of objects indexed by nearly arbitrary values. " "The only types of values not acceptable as keys are values containing lists " @@ -718,14 +767,14 @@ msgid "" "numbers compare equal (e.g., ``1`` and ``1.0``) then they can be used " "interchangeably to index the same dictionary entry." msgstr "" -"ほぼ任意の値でインデクスされたオブジェクトからなる有限の集合を表します。\n" -"キー (key) として使えない値の唯一の型は、リストや辞書、そしてオブジェクトの同" -"一性でなく値で比較されるその他の変更可能な型です。\n" -"これは、辞書型を効率的に実装する上で、キーのハッシュ値が不変である必要がある" -"ためです。\n" -"数値型をキーに使う場合、キー値は通常の数値比較における規則に従います: 二つの" -"値が等しくなる場合 (例えば ``1`` と ``1.0``)、互いに同じ辞書のエントリを表す" -"インデクスとして使うことができます。" +"ほぼ任意の値をインデックスとする、オブジェクトの有限の集まりを表します。\n" +"キーに使えないのは、リスト、辞書、またはオブジェクトの同一性ではなく値で比較" +"されるほかの変更可能な型を含む値です。\n" +"辞書を効率的に実装するには、キーのハッシュ値が変わらないことが必要だからで" +"す。\n" +"キーに使う数値型は通常の数値比較の規則に従います。\n" +"2 つの数値が等しいと比較される場合 (例えば ``1`` と ``1.0``)、どちらも同じ辞" +"書エントリーのインデックスとして使えます。" #: ../../reference/datamodel.rst:497 msgid "" @@ -738,11 +787,12 @@ msgstr "" "いきます。既存のキーを置き換えても、キーの順序は変わりません。キーを削除した" "のちに再挿入すると、元の場所ではなく辞書の最後に追加されます。" -#: ../../reference/datamodel.rst:502 msgid "" "Dictionaries are mutable; they can be created by the ``{}`` notation (see " "section :ref:`dict`)." msgstr "" +"辞書は変更可能です。\n" +"``{}`` 記法で作成できます (:ref:`dict` を参照)。" #: ../../reference/datamodel.rst:509 msgid "" @@ -752,15 +802,14 @@ msgstr "" "拡張モジュール :mod:`dbm.ndbm` 、 :mod:`dbm.gnu` は、 :mod:`collections` モ" "ジュールのように、別のマッピング型の例を提供しています。" -#: ../../reference/datamodel.rst:513 msgid "" "Dictionaries did not preserve insertion order in versions of Python before " "3.6. In CPython 3.6, insertion order was preserved, but it was considered an " "implementation detail at that time rather than a language guarantee." msgstr "" -"Pythonのバージョン3.6では、辞書は挿入順序を保持しませんでした。CPython 3.6で" -"は挿入順序は保持されましたが、それは策定された言語の仕様というより、その当時" -"の実装の細部とみなされていました。" +"Python 3.6 より前のバージョンでは、辞書は挿入順序を保持しませんでした。\n" +"CPython 3.6 では挿入順序を保持していましたが、当時は言語仕様の保証ではなく実" +"装の詳細とされていました。" #: ../../reference/datamodel.rst:520 msgid "Callable types" @@ -786,10 +835,8 @@ msgstr "" "`function` 参照)。関数は、仮引数 (formal parameter) リストと同じ数の要素が" "入った引数リストとともに呼び出されます。" -#: ../../reference/datamodel.rst:548 ../../reference/datamodel.rst:1429 -#: ../../reference/datamodel.rst:1629 msgid "Special read-only attributes" -msgstr "" +msgstr "読み取り専用の特殊属性" #: ../../reference/datamodel.rst:558 ../../reference/datamodel.rst:594 #: ../../reference/datamodel.rst:1196 @@ -801,19 +848,23 @@ msgstr "属性" msgid "Meaning" msgstr "意味" -#: ../../reference/datamodel.rst:562 msgid "" "A reference to the :class:`dictionary ` that holds the function's :ref:" "`global variables ` -- the global namespace of the module in which " "the function was defined." msgstr "" +"関数の :ref:`グローバル変数 ` を保持する :class:`辞書 ` への参" +"照です。\n" +"関数が定義されたモジュールのグローバル名前空間です。" -#: ../../reference/datamodel.rst:567 msgid "" "``None`` or a :class:`tuple` of cells that contain bindings for the names " "specified in the :attr:`~codeobject.co_freevars` attribute of the " "function's :attr:`code object `." msgstr "" +"``None``、または関数の :attr:`コードオブジェクト ` の :" +"attr:`~codeobject.co_freevars` 属性に指定された名前の束縛を保持するセルからな" +"る :class:`tuple`。" #: ../../reference/datamodel.rst:571 msgid "" @@ -823,13 +874,11 @@ msgstr "" "セルオブジェクトは属性 ``cell_contents`` を持っています。\n" "これはセルの値を設定するのに加えて、セルの値を得るのにも使えます。" -#: ../../reference/datamodel.rst:575 ../../reference/datamodel.rst:1671 msgid "Special writable attributes" -msgstr "" +msgstr "書き込み可能な特殊属性" -#: ../../reference/datamodel.rst:589 msgid "Most of these attributes check the type of the assigned value:" -msgstr "" +msgstr "これらの属性のほとんどは、代入される値の型を検査します。" #: ../../reference/datamodel.rst:598 msgid "The function's documentation string, or ``None`` if unavailable." @@ -837,17 +886,19 @@ msgstr "" "関数のドキュメンテーション文字列です。ドキュメンテーションがない場合は " "``None`` になります。" -#: ../../reference/datamodel.rst:601 msgid "" "The function's name. See also: :attr:`__name__ attributes `." msgstr "" +"関数の名前。\n" +":attr:`__name__ 属性 ` も参照してください。" -#: ../../reference/datamodel.rst:605 msgid "" "The function's :term:`qualified name`. See also: :attr:`__qualname__ " "attributes `." msgstr "" +"関数の :term:`修飾名 `。\n" +":attr:`__qualname__ 属性 ` も参照してください。" #: ../../reference/datamodel.rst:611 msgid "" @@ -857,78 +908,93 @@ msgstr "" "関数が定義されているモジュールの名前です。モジュール名がない場合は ``None`` " "になります。" -#: ../../reference/datamodel.rst:615 msgid "" "A :class:`tuple` containing default :term:`parameter` values for those " "parameters that have defaults, or ``None`` if no parameters have a default " "value." msgstr "" +"デフォルト値を持つ位置 :term:`仮引数 ` のデフォルト値を含む :" +"class:`tuple`。\n" +"該当する引数がなければ ``None`` です。" -#: ../../reference/datamodel.rst:620 msgid "" "The :ref:`code object ` representing the compiled function " "body." msgstr "" +"コンパイルされた関数本体を表す :ref:`コードオブジェクト `。" -#: ../../reference/datamodel.rst:624 msgid "" "The namespace supporting arbitrary function attributes. See also: :attr:" "`__dict__ attributes `." msgstr "" +"任意の関数属性を保持する名前空間。\n" +":attr:`__dict__ 属性 ` も参照してください。" -#: ../../reference/datamodel.rst:628 msgid "" "A :class:`dictionary ` containing annotations of :term:`parameters " "`. The keys of the dictionary are the parameter names, and " "``'return'`` for the return annotation, if provided. See also: :attr:`object." "__annotations__`." msgstr "" +":term:`引数 ` のアノテーションを含む :class:`辞書 ` です。\n" +"キーは引数名で、戻り値のアノテーションがある場合はそのキーが ``'return'`` に" +"なります。\n" +":attr:`object.__annotations__` も参照してください。" -#: ../../reference/datamodel.rst:634 ../../reference/datamodel.rst:1103 -#: ../../reference/datamodel.rst:1235 msgid "" "Annotations are now :ref:`lazily evaluated `. See :pep:" "`649`." msgstr "" +"アノテーションが :ref:`遅延評価 ` されるようになりました。\n" +":pep:`649` を参照してください。" -#: ../../reference/datamodel.rst:639 msgid "" "The :term:`annotate function` for this function, or ``None`` if the function " "has no annotations. See :attr:`object.__annotate__`." msgstr "" +"この関数の :term:`アノテーション関数 `。\n" +"アノテーションがない場合は ``None`` です。\n" +":attr:`object.__annotate__` を参照してください。" -#: ../../reference/datamodel.rst:645 msgid "" "A :class:`dictionary ` containing defaults for keyword-only :term:" "`parameters `." msgstr "" +"キーワード専用 :term:`引数 ` のデフォルト値を含む :class:`辞書 " +"`。" -#: ../../reference/datamodel.rst:649 msgid "" "A :class:`tuple` containing the :ref:`type parameters ` of a :" "ref:`generic function `." msgstr "" +":ref:`ジェネリック関数 ` の :ref:`型パラメータ ` を含む :class:`tuple`。" -#: ../../reference/datamodel.rst:654 msgid "" "Function objects also support getting and setting arbitrary attributes, " "which can be used, for example, to attach metadata to functions. Regular " "attribute dot-notation is used to get and set such attributes." msgstr "" +"関数オブジェクトでは任意の属性の取得や設定もでき、例えば関数にメタデータを付" +"加するために使えます。\n" +"このような属性の取得と設定には、通常の属性と同じドット記法を使います。" -#: ../../reference/datamodel.rst:660 msgid "" "CPython's current implementation only supports function attributes on user-" "defined functions. Function attributes on :ref:`built-in functions ` may be supported in the future." msgstr "" +"現在の CPython 実装は、ユーザー定義関数の属性だけをサポートしています。\n" +"将来は :ref:`組み込み関数 ` の属性もサポートされるかもしれ" +"ません。" -#: ../../reference/datamodel.rst:665 msgid "" "Additional information about a function's definition can be retrieved from " "its :ref:`code object ` (accessible via the :attr:`~function." "__code__` attribute)." msgstr "" +"関数の定義に関する追加情報は、その :ref:`コードオブジェクト ` " +"(:attr:`~function.__code__` 属性でアクセス可能) から取得できます。" #: ../../reference/datamodel.rst:673 msgid "Instance methods" @@ -942,53 +1008,60 @@ msgstr "" "インスタンスメソッドオブジェクトは、クラス、クラスインスタンスと任意の呼び出" "し可能オブジェクト (通常はユーザ定義関数) を結びつけます。" -#: ../../reference/datamodel.rst:690 ../../reference/datamodel.rst:1767 msgid "Special read-only attributes:" -msgstr "" +msgstr "読み取り専用の特殊属性。" -#: ../../reference/datamodel.rst:695 msgid "" "Refers to the class instance object to which the method is :ref:`bound " "`" msgstr "" +"メソッドが :ref:`束縛 ` されているクラスのインスタンスオブ" +"ジェクトを参照します。" -#: ../../reference/datamodel.rst:699 msgid "Refers to the original :ref:`function object `" -msgstr "" +msgstr "元の :ref:`関数オブジェクト ` を参照します。" -#: ../../reference/datamodel.rst:702 msgid "" "The method's documentation (same as :attr:`method.__func__.__doc__ `). A :class:`string ` if the original function had a " "docstring, else ``None``." msgstr "" +"メソッドのドキュメント (:attr:`method.__func__.__doc__ ` と" +"同じ)。\n" +"元の関数にドキュメンテーション文字列があれば :class:`文字列 `、なければ " +"``None`` です。" -#: ../../reference/datamodel.rst:708 msgid "" "The name of the method (same as :attr:`method.__func__.__name__ `)" msgstr "" +"メソッドの名前 (:attr:`method.__func__.__name__ ` と同" +"じ)。" -#: ../../reference/datamodel.rst:712 msgid "" "The name of the module the method was defined in, or ``None`` if unavailable." msgstr "" +"メソッドが定義されたモジュールの名前。\n" +"取得できない場合は ``None`` です。" -#: ../../reference/datamodel.rst:715 msgid "" "Methods also support accessing (but not setting) the arbitrary function " "attributes on the underlying :ref:`function object `." msgstr "" +"メソッドは、基となる :ref:`関数オブジェクト ` の任意の属" +"性へのアクセスもサポートしていますが、設定はできません。" -#: ../../reference/datamodel.rst:718 msgid "" "User-defined method objects may be created when getting an attribute of a " "class (perhaps via an instance of that class), if that attribute is a user-" "defined :ref:`function object ` or a :class:" "`classmethod` object." msgstr "" +"クラスの属性を (そのクラスのインスタンスを通じて取得する場合も含めて) 取得す" +"るとき、属性がユーザー定義の :ref:`関数オブジェクト ` ま" +"たは :class:`classmethod` オブジェクトであれば、ユーザー定義メソッドオブジェ" +"クトが作成される場合があります。" -#: ../../reference/datamodel.rst:725 msgid "" "When an instance method object is created by retrieving a user-defined :ref:" "`function object ` from a class via one of its " @@ -996,16 +1069,24 @@ msgid "" "method object is said to be *bound*. The new method's :attr:`~method." "__func__` attribute is the original function object." msgstr "" +"クラスのインスタンスを通じてクラスのユーザー定義 :ref:`関数オブジェクト " +"` を取得し、インスタンスメソッドオブジェクトが作成される" +"と、その :attr:`~method.__self__` 属性はそのインスタンスになります。\n" +"このメソッドオブジェクトは *束縛されている* といいます。\n" +"作成されたメソッドの :attr:`~method.__func__` 属性は元の関数オブジェクトで" +"す。" -#: ../../reference/datamodel.rst:731 msgid "" "When an instance method object is created by retrieving a :class:" "`classmethod` object from a class or instance, its :attr:`~method.__self__` " "attribute is the class itself, and its :attr:`~method.__func__` attribute is " "the function object underlying the class method." msgstr "" +"クラスまたはインスタンスから :class:`classmethod` オブジェクトを取得してイン" +"スタンスメソッドオブジェクトが作成されると、その :attr:`~method.__self__` 属" +"性はクラス自身になります。\n" +":attr:`~method.__func__` 属性はクラスメソッドの基となる関数オブジェクトです。" -#: ../../reference/datamodel.rst:736 msgid "" "When an instance method object is called, the underlying function (:attr:" "`~method.__func__`) is called, inserting the class instance (:attr:`~method." @@ -1014,8 +1095,13 @@ msgid "" "an instance of :class:`!C`, calling ``x.f(1)`` is equivalent to calling ``C." "f(x, 1)``." msgstr "" +"インスタンスメソッドオブジェクトを呼び出すと、引数リストの先頭にクラスのイン" +"スタンス (:attr:`~method.__self__`) を挿入して、基となる関数 (:attr:`~method." +"__func__`) を呼び出します。\n" +"例えば、:class:`!C` が関数 :meth:`!f` の定義を含むクラスで、``x`` が :class:" +"`!C` のインスタンスである場合、``x.f(1)`` の呼び出しは ``C.f(x, 1)`` の呼び出" +"しと同じです。" -#: ../../reference/datamodel.rst:743 msgid "" "When an instance method object is derived from a :class:`classmethod` " "object, the \"class instance\" stored in :attr:`~method.__self__` will " @@ -1023,13 +1109,20 @@ msgid "" "f(1)`` is equivalent to calling ``f(C,1)`` where ``f`` is the underlying " "function." msgstr "" +"インスタンスメソッドオブジェクトが :class:`classmethod` オブジェクトから作ら" +"れた場合、:attr:`~method.__self__` に格納される「クラスのインスタンス」は、実" +"際にはクラス自身です。\n" +"そのため、基となる関数を ``f`` とすると、``x.f(1)`` と ``C.f(1)`` のどちらの" +"呼び出しも ``f(C,1)`` の呼び出しと同じです。" -#: ../../reference/datamodel.rst:748 msgid "" "It is important to note that user-defined functions which are attributes of " "a class instance are not converted to bound methods; this *only* happens " "when the function is an attribute of the class." msgstr "" +"クラスのインスタンスの属性であるユーザー定義関数は、束縛メソッドに変換されな" +"いことに注意してください。\n" +"この変換が行われるのは、関数がクラスの属性である場合 *だけ* です。" #: ../../reference/datamodel.rst:755 msgid "Generator functions" @@ -1061,7 +1154,6 @@ msgstr "" msgid "Coroutine functions" msgstr "コルーチン関数 (coroutine function)" -#: ../../reference/datamodel.rst:778 msgid "" "A function or method which is defined using :keyword:`async def` is called " "a :dfn:`coroutine function`. Such a function, when called, returns a :term:" @@ -1070,7 +1162,7 @@ msgid "" "ref:`coroutine-objects` section." msgstr "" ":keyword:`async def` を使用して定義された関数やメソッドを :dfn:`コルーチン関" -"数 (coroutine function)` と呼びます。 \n" +"数 (coroutine function)` と呼びます。\n" "呼び出された時、そのような関数は :term:`coroutine` オブジェクトを返します。\n" "コルーチン関数は :keyword:`async with` や :keyword:`async for` 文だけでなく :" "keyword:`await` 式を持つことが出来ます。\n" @@ -1095,7 +1187,6 @@ msgstr "" "このオブジェクトは :keyword:`async for` 文で関数の本体を実行するのに使えま" "す。" -#: ../../reference/datamodel.rst:798 msgid "" "Calling the asynchronous iterator's :meth:`aiterator.__anext__ ` method will return an :term:`awaitable` which when awaited will " @@ -1106,50 +1197,59 @@ msgid "" "yielded." msgstr "" "非同期イテレータの :meth:`aiterator.__anext__ ` メソッドを" -"呼び出すと、他の処理が待たされているときに、 :keyword:`yield` 式を使い値を提" -"供するところまで処理を進める :term:`awaitable` を返します。\n" -"その関数が空の :keyword:`return` 文を実行する、もしくは処理の終わりに到達した" -"ときは、 :exc:`StopAsyncIteration` 例外が送出され、非同期イテレータは出力すべ" -"き値の最後に到達したことになります。" +"呼び出すと、:term:`awaitable` が返されます。\n" +"それを await すると、:keyword:`yield` 式で値を返すところまで関数が実行されま" +"す。\n" +"関数が値のない :keyword:`return` 文を実行するか本体の末尾に達すると、:exc:" +"`StopAsyncIteration` 例外が送出され、非同期イテレータは yield する値の終わり" +"に達します。" #: ../../reference/datamodel.rst:811 msgid "Built-in functions" msgstr "組み込み関数 (built-in function)" -#: ../../reference/datamodel.rst:818 msgid "" "A built-in function object is a wrapper around a C function. Examples of " "built-in functions are :func:`len` and :func:`math.sin` (:mod:`math` is a " "standard built-in module). The number and type of the arguments are " "determined by the C function. Special read-only attributes:" msgstr "" +"組み込み関数オブジェクトは C 関数のラッパーです。\n" +"例えば :func:`len` や :func:`math.sin` があります (:mod:`math` は標準の組み込" +"みモジュールです)。\n" +"引数の数と型は C 関数が決定します。\n" +"読み取り専用の特殊属性は次のとおりです。" -#: ../../reference/datamodel.rst:823 msgid "" ":attr:`!__doc__` is the function's documentation string, or ``None`` if " "unavailable. See :attr:`function.__doc__`." msgstr "" +":attr:`!__doc__` は関数のドキュメンテーション文字列で、ない場合は ``None`` で" +"す。\n" +":attr:`function.__doc__` を参照してください。" -#: ../../reference/datamodel.rst:825 msgid "" ":attr:`!__name__` is the function's name. See :attr:`function.__name__`." msgstr "" +":attr:`!__name__` は関数の名前です。\n" +":attr:`function.__name__` を参照してください。" #: ../../reference/datamodel.rst:826 msgid ":attr:`!__self__` is set to ``None`` (but see the next item)." msgstr "" -#: ../../reference/datamodel.rst:827 msgid "" ":attr:`!__module__` is the name of the module the function was defined in or " "``None`` if unavailable. See :attr:`function.__module__`." msgstr "" +":attr:`!__module__` は関数が定義されたモジュールの名前で、ない場合は " +"``None`` です。\n" +":attr:`function.__module__` を参照してください。" #: ../../reference/datamodel.rst:835 msgid "Built-in methods" msgstr "組み込みメソッド (built-in method)" -#: ../../reference/datamodel.rst:842 msgid "" "This is really a different disguise of a built-in function, this time " "containing an object passed to the C function as an implicit extra " @@ -1159,12 +1259,19 @@ msgid "" "the same semantics as it does with :attr:`other instance methods `.)" msgstr "" +"実際には組み込み関数の別の形で、暗黙の追加引数として C 関数に渡されるオブジェ" +"クトを保持しています。\n" +"例えば *alist* がリストオブジェクトであるとき、``alist.append()`` は組み込み" +"メソッドです。\n" +"この場合、読み取り専用の特殊属性 :attr:`!__self__` は *alist* が指すオブジェ" +"クトに設定されます。\n" +"(この属性の意味は :attr:`ほかのインスタンスメソッド ` と同じ" +"です。)" #: ../../reference/datamodel.rst:852 msgid "Classes" msgstr "クラス" -#: ../../reference/datamodel.rst:854 msgid "" "Classes are callable. These objects normally act as factories for new " "instances of themselves, but variations are possible for class types that " @@ -1172,6 +1279,12 @@ msgid "" "meth:`!__new__` and, in the typical case, to :meth:`~object.__init__` to " "initialize the new instance." msgstr "" +"クラスは呼び出し可能です。\n" +"通常、クラスオブジェクトは自身の新しいインスタンスを作成するファクトリとして" +"動作しますが、:meth:`~object.__new__` をオーバーライドするクラス型では異なる" +"動作も可能です。\n" +"呼び出しの引数は :meth:`!__new__` に渡され、通常は新しいインスタンスを初期化" +"する :meth:`~object.__init__` にも渡されます。" #: ../../reference/datamodel.rst:862 msgid "Class Instances" @@ -1189,7 +1302,6 @@ msgstr "" msgid "Modules" msgstr "モジュール" -#: ../../reference/datamodel.rst:877 msgid "" "Modules are a basic organizational unit of Python code, and are created by " "the :ref:`import system ` as invoked either by the :keyword:" @@ -1203,6 +1315,17 @@ msgid "" "initialize the module (since it isn't needed once the initialization is " "done)." msgstr "" +"モジュールは Python コードをまとめる基本単位で、:keyword:`import` 文、:func:" +"`importlib.import_module` などの関数、または組み込み関数 :func:`__import__` " +"によって呼び出される :ref:`インポートシステム ` が作成しま" +"す。\n" +"モジュールオブジェクトには :class:`辞書 ` オブジェクトで実装された名前" +"空間があります (モジュール内で定義された関数の :attr:`~function.__globals__` " +"属性が参照する辞書です)。\n" +"属性の参照はこの辞書内の検索に変換されます。\n" +"例えば ``m.x`` は ``m.__dict__[\"x\"]`` と同じです。\n" +"モジュールオブジェクトは、初期化に使われたコードオブジェクトを保持しません " +"(初期化が終われば不要なためです)。" #: ../../reference/datamodel.rst:890 msgid "" @@ -1212,11 +1335,9 @@ msgstr "" "属性の代入を行うと、モジュールの名前空間辞書の内容を更新します。例えば、 ``m." "x = 1`` は ``m.__dict__[\"x\"] = 1`` と同じです。" -#: ../../reference/datamodel.rst:909 msgid "Import-related attributes on module objects" -msgstr "" +msgstr "モジュールオブジェクトのインポート関連属性" -#: ../../reference/datamodel.rst:911 msgid "" "Module objects have the following attributes that relate to the :ref:`import " "system `. When a module is created using the machinery " @@ -1224,8 +1345,12 @@ msgid "" "the module's :term:`spec `, before the :term:`loader` executes " "and loads the module." msgstr "" +"モジュールオブジェクトには、:ref:`インポートシステム ` に関連す" +"る次の属性があります。\n" +"インポートシステムの機構でモジュールを作成すると、:term:`ローダー ` " +"がモジュールを実行してロードする前に、モジュールの :term:`仕様 ` に基づいてこれらの属性が設定されます。" -#: ../../reference/datamodel.rst:917 msgid "" "To create a module dynamically rather than using the import system, it's " "recommended to use :func:`importlib.util.module_from_spec`, which will set " @@ -1235,8 +1360,13 @@ msgid "" "manually set on the module object after it has been created when using this " "approach." msgstr "" +"インポートシステムを使わずにモジュールを動的に作成するには、:func:`importlib." +"util.module_from_spec` を使うことを推奨します。\n" +"インポートによって管理される各属性を適切な値に設定します。\n" +":class:`types.ModuleType` コンストラクタでモジュールを直接作成することもでき" +"ますが、その場合は作成後にほとんどの属性を手動で設定する必要があるため、間違" +"いが起こりやすくなります。" -#: ../../reference/datamodel.rst:927 msgid "" "With the exception of :attr:`~module.__name__`, it is **strongly** " "recommended that you rely on :attr:`~module.__spec__` and its attributes " @@ -1244,8 +1374,11 @@ msgid "" "Note that updating an attribute on :attr:`!__spec__` will not update the " "corresponding attribute on the module itself:" msgstr "" +":attr:`~module.__name__` を除き、この節に列挙する個々の属性を使わず、:attr:" +"`~module.__spec__` とその属性を使うことを **強く** 推奨します。\n" +":attr:`!__spec__` の属性を更新しても、モジュール自身の対応する属性は更新され" +"ないことに注意してください。" -#: ../../reference/datamodel.rst:933 msgid "" ">>> import typing\n" ">>> typing.__name__, typing.__spec__.name\n" @@ -1257,35 +1390,46 @@ msgid "" ">>> typing.__name__, typing.__spec__.name\n" "('keyboard_smashing', 'spelling')" msgstr "" +">>> import typing\n" +">>> typing.__name__, typing.__spec__.name\n" +"('typing', 'typing')\n" +">>> typing.__spec__.name = 'spelling'\n" +">>> typing.__name__, typing.__spec__.name\n" +"('typing', 'spelling')\n" +">>> typing.__name__ = 'keyboard_smashing'\n" +">>> typing.__name__, typing.__spec__.name\n" +"('keyboard_smashing', 'spelling')" -#: ../../reference/datamodel.rst:947 msgid "" "The name used to uniquely identify the module in the import system. For a " "directly executed module, this will be set to ``\"__main__\"``." msgstr "" +"インポートシステム内でモジュールを一意に識別する名前です。\n" +"直接実行されたモジュールでは ``\"__main__\"`` に設定されます。" -#: ../../reference/datamodel.rst:950 msgid "" "This attribute must be set to the fully qualified name of the module. It is " "expected to match the value of :attr:`module.__spec__.name `." msgstr "" +"この属性はモジュールの完全修飾名に設定しなければなりません。\n" +":attr:`module.__spec__.name ` の値と一致" +"することが期待されます。" -#: ../../reference/datamodel.rst:956 msgid "A record of the module's import-system-related state." -msgstr "" +msgstr "モジュールのインポートシステム関連の状態を記録するもの。" -#: ../../reference/datamodel.rst:958 msgid "" "Set to the :class:`module spec ` that was " "used when importing the module. See :ref:`module-specs` for more details." msgstr "" +"モジュールのインポート時に使われた :class:`モジュール仕様 ` に設定されます。\n" +"詳細は :ref:`module-specs` を参照してください。" -#: ../../reference/datamodel.rst:965 msgid "The :term:`package` a module belongs to." -msgstr "" +msgstr "モジュールが属する :term:`パッケージ `。" -#: ../../reference/datamodel.rst:967 msgid "" "If the module is top-level (that is, not a part of any specific package) " "then the attribute should be set to ``''`` (the empty string). Otherwise, it " @@ -1293,8 +1437,12 @@ msgid "" "attr:`module.__name__` if the module itself is a package). See :pep:`366` " "for further details." msgstr "" +"モジュールが最上位にあり、どのパッケージにも属さない場合、この属性には " +"``''`` (空文字列) を設定します。\n" +"それ以外の場合はモジュールのパッケージ名を設定します (モジュール自身がパッ" +"ケージであれば :attr:`module.__name__` と同じになることがあります)。\n" +"詳細は :pep:`366` を参照してください。" -#: ../../reference/datamodel.rst:973 msgid "" "This attribute is used instead of :attr:`~module.__name__` to calculate " "explicit relative imports for main modules. It defaults to ``None`` for " @@ -1302,42 +1450,60 @@ msgid "" "use :func:`importlib.util.module_from_spec` instead to ensure the attribute " "is set to a :class:`str`." msgstr "" +"メインモジュールの明示的な相対インポートを解決するとき、:attr:`~module." +"__name__` の代わりに使われます。\n" +":class:`types.ModuleType` コンストラクタで動的に作成したモジュールでは、デ" +"フォルトは ``None`` です。\n" +"属性が :class:`str` に設定されるようにするには、代わりに :func:`importlib." +"util.module_from_spec` を使ってください。" -#: ../../reference/datamodel.rst:979 msgid "" "It is **strongly** recommended that you use :attr:`module.__spec__.parent " "` instead of :attr:`!module." "__package__`. :attr:`__package__` is now only used as a fallback if :attr:`!" "__spec__.parent` is not set, and this fallback path is deprecated." msgstr "" +":attr:`!module.__package__` の代わりに :attr:`module.__spec__.parent " +"` を使うことを **強く** 推奨します。\n" +"現在、:attr:`__package__` は :attr:`!__spec__.parent` が設定されていない場合" +"の代替としてのみ使われ、この代替処理は非推奨です。" -#: ../../reference/datamodel.rst:985 ../../reference/datamodel.rst:1026 msgid "" "This attribute now defaults to ``None`` for modules created dynamically " "using the :class:`types.ModuleType` constructor. Previously the attribute " "was optional." msgstr "" +":class:`types.ModuleType` コンストラクタで動的に作成したモジュールでは、この" +"属性のデフォルト値が ``None`` になりました。\n" +"以前は省略可能な属性でした。" -#: ../../reference/datamodel.rst:990 msgid "" "The value of :attr:`!__package__` is expected to be the same as :attr:" "`__spec__.parent `. :attr:" "`__package__` is now only used as a fallback during import resolution if :" "attr:`!__spec__.parent` is not defined." msgstr "" +":attr:`!__package__` の値は :attr:`__spec__.parent ` と同じであることが期待されます。\n" +"インポートの解決時、:attr:`__package__` は :attr:`!__spec__.parent` が定義さ" +"れていない場合の代替としてのみ使われるようになりました。" -#: ../../reference/datamodel.rst:996 msgid "" ":exc:`ImportWarning` is raised if an import resolution falls back to :attr:`!" "__package__` instead of :attr:`__spec__.parent `." msgstr "" +"インポートの解決時に :attr:`__spec__.parent ` の代わりに :attr:`!__package__` を使うと、:exc:`ImportWarning` が発" +"生するようになりました。" -#: ../../reference/datamodel.rst:1001 msgid "" "Raise :exc:`DeprecationWarning` instead of :exc:`ImportWarning` when falling " "back to :attr:`!__package__` during import resolution." msgstr "" +"インポートの解決時に :attr:`!__package__` を代わりに使うと、:exc:" +"`ImportWarning` ではなく :exc:`DeprecationWarning` が発生するようになりまし" +"た。" #: ../../reference/datamodel.rst:1005 msgid "" @@ -1345,55 +1511,70 @@ msgid "" "import system or standard library." msgstr "" -#: ../../reference/datamodel.rst:1011 msgid "" "The :term:`loader` object that the import machinery used to load the module." msgstr "" +"インポート機構がモジュールのロードに使った :term:`ローダー ` オブジェ" +"クト。" -#: ../../reference/datamodel.rst:1013 msgid "" "This attribute is mostly useful for introspection, but can be used for " "additional loader-specific functionality, for example getting data " "associated with a loader." msgstr "" +"この属性は主にイントロスペクションに役立ちますが、ローダーに関連するデータの" +"取得など、ローダー固有の追加機能にも使えます。" -#: ../../reference/datamodel.rst:1017 msgid "" ":attr:`!__loader__` defaults to ``None`` for modules created dynamically " "using the :class:`types.ModuleType` constructor; use :func:`importlib.util." "module_from_spec` instead to ensure the attribute is set to a :term:`loader` " "object." msgstr "" +":class:`types.ModuleType` コンストラクタで動的に作成したモジュールでは、:" +"attr:`!__loader__` のデフォルト値は ``None`` です。\n" +"属性が :term:`ローダー ` オブジェクトに設定されるようにするには、代わ" +"りに :func:`importlib.util.module_from_spec` を使ってください。" -#: ../../reference/datamodel.rst:1022 msgid "" "It is **strongly** recommended that you use :attr:`module.__spec__.loader " "` instead of :attr:`!module." "__loader__`." msgstr "" +":attr:`!module.__loader__` の代わりに :attr:`module.__spec__.loader " +"` を使うことを **強く** 推奨します。" -#: ../../reference/datamodel.rst:1031 msgid "" "Setting :attr:`!__loader__` on a module while failing to set :attr:`!" "__spec__.loader` is deprecated. In Python 3.16, :attr:`!__loader__` will " "cease to be set or taken into consideration by the import system or the " "standard library." msgstr "" +"モジュールの :attr:`!__loader__` だけを設定し、:attr:`!__spec__.loader` を設" +"定しないことは非推奨です。\n" +"Python 3.16 では、:attr:`!__loader__` はインポートシステムや標準ライブラリに" +"よって設定も参照もされなくなります。" -#: ../../reference/datamodel.rst:1039 msgid "" "A (possibly empty) :term:`sequence` of strings enumerating the locations " "where the package's submodules will be found. Non-package modules should not " "have a :attr:`!__path__` attribute. See :ref:`package-path-rules` for more " "details." msgstr "" +"パッケージのサブモジュールを探す場所を列挙した、文字列の :term:`シーケンス " +"` です (空の場合もあります)。\n" +"パッケージでないモジュールに :attr:`!__path__` 属性を持たせるべきではありませ" +"ん。\n" +"詳細は :ref:`package-path-rules` を参照してください。" -#: ../../reference/datamodel.rst:1044 msgid "" "It is **strongly** recommended that you use :attr:`module.__spec__." "submodule_search_locations ` instead of :attr:`!module.__path__`." msgstr "" +":attr:`!module.__path__` の代わりに :attr:`module.__spec__." +"submodule_search_locations ` を使うことを **強く** 推奨します。" #: ../../reference/datamodel.rst:1051 msgid "" @@ -1447,49 +1628,57 @@ msgid "" "library." msgstr "" -#: ../../reference/datamodel.rst:1087 msgid "Other writable attributes on module objects" -msgstr "" +msgstr "モジュールオブジェクトのその他の書き込み可能な属性" -#: ../../reference/datamodel.rst:1089 msgid "" "As well as the import-related attributes listed above, module objects also " "have the following writable attributes:" msgstr "" +"上記のインポート関連属性に加え、モジュールオブジェクトには次の書き込み可能な" +"属性もあります。" -#: ../../reference/datamodel.rst:1094 msgid "" "The module's documentation string, or ``None`` if unavailable. See also: :" "attr:`__doc__ attributes `." msgstr "" +"モジュールのドキュメンテーション文字列。\n" +"存在しない場合は ``None`` です。\n" +":attr:`__doc__ 属性 ` も参照してください。" -#: ../../reference/datamodel.rst:1099 msgid "" "A dictionary containing :term:`variable annotations ` " "collected during module body execution. For best practices on working with :" "attr:`!__annotations__`, see :mod:`annotationlib`." msgstr "" +"モジュール本体の実行中に収集された :term:`変数アノテーション ` を含む辞書です。\n" +":attr:`!__annotations__` を扱う際の推奨事項は :mod:`annotationlib` を参照して" +"ください。" -#: ../../reference/datamodel.rst:1109 msgid "" "The :term:`annotate function` for this module, or ``None`` if the module has " "no annotations. See also: :attr:`~object.__annotate__` attributes." msgstr "" +"このモジュールの :term:`アノテーション関数 `。\n" +"アノテーションがない場合は ``None`` です。\n" +":attr:`~object.__annotate__` 属性も参照してください。" -#: ../../reference/datamodel.rst:1115 msgid "Module dictionaries" -msgstr "" +msgstr "モジュール辞書" -#: ../../reference/datamodel.rst:1117 msgid "Module objects also have the following special read-only attribute:" -msgstr "" +msgstr "モジュールオブジェクトには、次の読み取り専用の特殊属性もあります。" -#: ../../reference/datamodel.rst:1122 msgid "" "The module's namespace as a dictionary object. Uniquely among the attributes " "listed here, :attr:`!__dict__` cannot be accessed as a global variable from " "within a module; it can only be accessed as an attribute on module objects." msgstr "" +"モジュールの名前空間を表す辞書オブジェクトです。\n" +"ここに挙げた属性の中で唯一、:attr:`!__dict__` はモジュール内からグローバル変" +"数としてアクセスできません。\n" +"モジュールオブジェクトの属性としてのみアクセスできます。" #: ../../reference/datamodel.rst:1128 msgid "" @@ -1507,7 +1696,6 @@ msgstr "" msgid "Custom classes" msgstr "カスタムクラス型" -#: ../../reference/datamodel.rst:1139 msgid "" "Custom class types are typically created by class definitions (see section :" "ref:`class`). A class has a namespace implemented by a dictionary object. " @@ -1521,8 +1709,18 @@ msgid "" "common ancestor. Additional details on the C3 MRO used by Python can be " "found at :ref:`python_2.3_mro`." msgstr "" +"カスタムクラス型は、通常はクラス定義によって作成されます (:ref:`class` を参" +"照)。\n" +"クラスは辞書オブジェクトで実装された名前空間を持ちます。\n" +"クラス属性の参照はこの辞書内の検索に変換され、例えば ``C.x`` は ``C." +"__dict__[\"x\"]`` に変換されます (ただし、属性を別の方法で探すためのフックが" +"いくつかあります)。\n" +"属性名が見つからない場合は、基底クラスでの検索に進みます。\n" +"基底クラスの検索には C3 メソッド解決順序を使います。\n" +"これは、共通の祖先へと至る継承経路が複数ある「ダイヤモンド」型の継承構造でも" +"正しく動作します。\n" +"Python が使う C3 MRO の詳細は :ref:`python_2.3_mro` を参照してください。" -#: ../../reference/datamodel.rst:1160 msgid "" "When a class attribute reference (for class :class:`!C`, say) would yield a " "class method object, it is transformed into an instance method object whose :" @@ -1532,6 +1730,13 @@ msgid "" "which attributes retrieved from a class may differ from those actually " "contained in its :attr:`~object.__dict__`." msgstr "" +"クラス (例えば :class:`!C`) の属性参照の結果がクラスメソッドオブジェクトであ" +"る場合、:attr:`~method.__self__` 属性が :class:`!C` であるインスタンスメソッ" +"ドオブジェクトに変換されます。\n" +":class:`staticmethod` オブジェクトである場合は、その静的メソッドオブジェクト" +"がラップしているオブジェクトに変換されます。\n" +"クラスから取得した属性が、実際に :attr:`~object.__dict__` に格納されているも" +"のと異なる場合については、:ref:`descriptors` も参照してください。" #: ../../reference/datamodel.rst:1171 msgid "" @@ -1549,52 +1754,61 @@ msgstr "" "クラスオブジェクトを呼び出す (上記を参照) と、クラスインスタンスを生成します " "(下記を参照)。" -#: ../../reference/datamodel.rst:1179 ../../reference/datamodel.rst:1335 msgid "Special attributes" -msgstr "" +msgstr "特殊属性" -#: ../../reference/datamodel.rst:1200 msgid "" "The class's name. See also: :attr:`__name__ attributes `." msgstr "" +"クラスの名前。\n" +":attr:`__name__ 属性 ` も参照してください。" -#: ../../reference/datamodel.rst:1204 msgid "" "The class's :term:`qualified name`. See also: :attr:`__qualname__ attributes " "`." msgstr "" +"クラスの :term:`修飾名 `。\n" +":attr:`__qualname__ 属性 ` も参照してください。" #: ../../reference/datamodel.rst:1208 msgid "The name of the module in which the class was defined." msgstr "クラスが定義されているモジュールの名前。" -#: ../../reference/datamodel.rst:1211 msgid "" "A :class:`mapping proxy ` providing a read-only view " "of the class's namespace. See also: :attr:`__dict__ attributes `." msgstr "" +"クラスの名前空間の読み取り専用ビューを提供する :class:`マッピングプロキシ " +"`。\n" +":attr:`__dict__ 属性 ` も参照してください。" -#: ../../reference/datamodel.rst:1216 msgid "" "A :class:`tuple` containing the class's bases. In most cases, for a class " "defined as ``class X(A, B, C)``, ``X.__bases__`` will be exactly equal to " "``(A, B, C)``." msgstr "" +"クラスの基底クラスを含む :class:`tuple` です。\n" +"ほとんどの場合、``class X(A, B, C)`` と定義したクラスの ``X.__bases__`` は " +"``(A, B, C)`` と完全に等しくなります。" -#: ../../reference/datamodel.rst:1221 msgid "" "The class's documentation string, or ``None`` if undefined. Not inherited by " "subclasses." msgstr "" +"クラスのドキュメンテーション文字列。\n" +"未定義の場合は ``None`` です。\n" +"サブクラスには継承されません。" -#: ../../reference/datamodel.rst:1225 msgid "" "A dictionary containing :term:`variable annotations ` " "collected during class body execution. See also: :attr:`__annotations__ " "attributes `." msgstr "" +"クラス本体の実行中に収集された :term:`変数アノテーション ` を含む辞書です。\n" +":attr:`__annotations__ 属性 ` も参照してください。" #: ../../reference/datamodel.rst:1230 msgid "" @@ -1603,24 +1817,28 @@ msgid "" "get_annotations` instead of accessing this attribute directly." msgstr "" -#: ../../reference/datamodel.rst:1240 msgid "" "The :term:`annotate function` for this class, or ``None`` if the class has " "no annotations. See also: :attr:`__annotate__ attributes `." msgstr "" +"このクラスの :term:`アノテーション関数 `。\n" +"アノテーションがない場合は ``None`` です。\n" +":attr:`__annotate__ 属性 ` も参照してください。" -#: ../../reference/datamodel.rst:1247 msgid "" "A :class:`tuple` containing the :ref:`type parameters ` of a :" "ref:`generic class `." msgstr "" +":ref:`ジェネリッククラス ` の :ref:`型パラメータ ` を含む :class:`tuple`。" -#: ../../reference/datamodel.rst:1253 msgid "" "A :class:`tuple` containing names of attributes of this class which are " "assigned through ``self.X`` from any function in its body." msgstr "" +"クラス本体内のいずれかの関数で ``self.X`` を通じて代入される、このクラスの属" +"性の名前を含む :class:`tuple`。" #: ../../reference/datamodel.rst:1259 msgid "" @@ -1629,28 +1847,31 @@ msgid "" "__firstlineno__` item from the type's dictionary." msgstr "" -#: ../../reference/datamodel.rst:1267 msgid "" "The :class:`tuple` of classes that are considered when looking for base " "classes during method resolution." msgstr "" +"メソッド解決時に基底クラスを探す際の対象となるクラスの :class:`tuple`。" -#: ../../reference/datamodel.rst:1272 msgid "Special methods" -msgstr "" +msgstr "特殊メソッド" -#: ../../reference/datamodel.rst:1274 msgid "" "In addition to the special attributes described above, all Python classes " "also have the following two methods available:" msgstr "" +"上記の特殊属性に加え、すべての Python クラスで次の 2 つのメソッドを利用できま" +"す。" -#: ../../reference/datamodel.rst:1279 msgid "" "This method can be overridden by a metaclass to customize the method " "resolution order for its instances. It is called at class instantiation, " "and its result is stored in :attr:`~type.__mro__`." msgstr "" +"メタクラスはこのメソッドをオーバーライドし、そのインスタンスのメソッド解決順" +"序をカスタマイズできます。\n" +"クラスのインスタンス化の際に呼び出され、結果は :attr:`~type.__mro__` に格納さ" +"れます。" #: ../../reference/datamodel.rst:1285 msgid "" @@ -1671,7 +1892,6 @@ msgstr "" msgid "Class instances" msgstr "クラスインスタンス (class instance)" -#: ../../reference/datamodel.rst:1305 msgid "" "A class instance is created by calling a class object (see above). A class " "instance has a namespace implemented as a dictionary which is the first " @@ -1687,6 +1907,22 @@ msgid "" "class attribute is found, and the object's class has a :meth:`~object." "__getattr__` method, that is called to satisfy the lookup." msgstr "" +"クラスインスタンスはクラスオブジェクトを呼び出すことで作成されます (上記を参" +"照)。\n" +"クラスインスタンスは辞書で実装された名前空間を持ち、属性の参照はまずそこで検" +"索されます。\n" +"見つからず、インスタンスのクラスにその名前の属性があれば、クラス属性での検索" +"に進みます。\n" +"見つかったクラス属性がユーザー定義関数オブジェクトであれば、:attr:`~method." +"__self__` 属性がそのインスタンスであるインスタンスメソッドオブジェクトに変換" +"されます。\n" +"静的メソッドやクラスメソッドのオブジェクトも変換されます。\n" +"上記の「クラス」を参照してください。\n" +"インスタンスを通じて取得したクラスの属性が、クラスの :attr:`~object." +"__dict__` に実際に格納されているオブジェクトと異なる場合については、:ref:" +"`descriptors` も参照してください。\n" +"クラス属性が見つからず、オブジェクトのクラスに :meth:`~object.__getattr__` メ" +"ソッドがあれば、属性を取得するためにそのメソッドが呼び出されます。" #: ../../reference/datamodel.rst:1321 msgid "" @@ -1713,12 +1949,15 @@ msgstr "" msgid "The class to which a class instance belongs." msgstr "クラスインスタンスが属しているクラスです。" -#: ../../reference/datamodel.rst:1347 msgid "" "A dictionary or other mapping object used to store an object's (writable) " "attributes. Not all instances have a :attr:`!__dict__` attribute; see the " "section on :ref:`slots` for more details." msgstr "" +"オブジェクトの書き込み可能な属性を格納する辞書、またはその他のマッピングオブ" +"ジェクトです。\n" +"すべてのインスタンスが :attr:`!__dict__` 属性を持つわけではありません。\n" +"詳細は :ref:`slots` を参照してください。" #: ../../reference/datamodel.rst:1353 msgid "I/O objects (also known as file objects)" @@ -1789,88 +2028,85 @@ msgstr "" "ジェクトは変更不可能で、変更可能なオブジェクトへの参照を (直接、間接に関わら" "ず) 含みません。" -#: ../../reference/datamodel.rst:1434 msgid "The function name" -msgstr "" +msgstr "関数名" -#: ../../reference/datamodel.rst:1437 msgid "The fully qualified function name" -msgstr "" +msgstr "関数の完全修飾名" -#: ../../reference/datamodel.rst:1442 msgid "" "The total number of positional :term:`parameters ` (including " "positional-only parameters and parameters with default values) that the " "function has" msgstr "" +"関数の位置 :term:`引数 ` の総数 (位置専用引数とデフォルト値を持つ" +"引数を含む)" -#: ../../reference/datamodel.rst:1447 msgid "" "The number of positional-only :term:`parameters ` (including " "arguments with default values) that the function has" msgstr "" +"関数の位置専用 :term:`引数 ` の数 (デフォルト値を持つ引数を含む)" -#: ../../reference/datamodel.rst:1451 msgid "" "The number of keyword-only :term:`parameters ` (including " "arguments with default values) that the function has" msgstr "" +"関数のキーワード専用 :term:`引数 ` の数 (デフォルト値を持つ引数を" +"含む)" -#: ../../reference/datamodel.rst:1455 msgid "" "The number of :ref:`local variables ` used by the function " "(including parameters)" -msgstr "" +msgstr "関数で使う :ref:`ローカル変数 ` の数 (引数を含む)" -#: ../../reference/datamodel.rst:1459 msgid "" "A :class:`tuple` containing the names of the local variables in the function " "(starting with the parameter names)" -msgstr "" +msgstr "関数のローカル変数名を含む :class:`tuple` (引数名から始まる)" -#: ../../reference/datamodel.rst:1463 msgid "" "A :class:`tuple` containing the names of :ref:`local variables ` " "that are referenced from at least one :term:`nested scope` inside the " "function" msgstr "" +"関数内の少なくとも 1 つの :term:`入れ子のスコープ ` から参照さ" +"れる :ref:`ローカル変数 ` の名前を含む :class:`tuple`" -#: ../../reference/datamodel.rst:1467 msgid "" "A :class:`tuple` containing the names of :term:`free (closure) variables " "` that a :term:`nested scope` references in an outer " "scope. See also :attr:`function.__closure__`." msgstr "" +":term:`入れ子のスコープ ` が外側のスコープから参照する :term:`" +"自由 (クロージャー) 変数 ` の名前を含む :class:`tuple`。\n" +":attr:`function.__closure__` も参照してください。" -#: ../../reference/datamodel.rst:1471 msgid "Note: references to global and builtin names are *not* included." -msgstr "" +msgstr "グローバル名や組み込み名への参照は *含まれません*。" -#: ../../reference/datamodel.rst:1474 msgid "" "A string representing the sequence of :term:`bytecode` instructions in the " "function" -msgstr "" +msgstr "関数内の :term:`バイトコード ` 命令列を表すバイト列" -#: ../../reference/datamodel.rst:1478 msgid "" "A :class:`tuple` containing the literals used by the :term:`bytecode` in the " "function" msgstr "" +"関数内の :term:`バイトコード ` で使うリテラルを含む :class:`tuple`" -#: ../../reference/datamodel.rst:1482 msgid "" "A :class:`tuple` containing the names used by the :term:`bytecode` in the " "function" msgstr "" +"関数内の :term:`バイトコード ` で使う名前を含む :class:`tuple`" -#: ../../reference/datamodel.rst:1486 msgid "The name of the file from which the code was compiled" -msgstr "" +msgstr "コードのコンパイル元となったファイルの名前" -#: ../../reference/datamodel.rst:1489 msgid "The line number of the first line of the function" -msgstr "" +msgstr "関数の最初の行の行番号" #: ../../reference/datamodel.rst:1492 msgid "" @@ -1884,16 +2120,13 @@ msgid "" "3.15." msgstr "" -#: ../../reference/datamodel.rst:1500 msgid "The required stack size of the code object" -msgstr "" +msgstr "コードオブジェクトに必要なスタックサイズ" -#: ../../reference/datamodel.rst:1503 msgid "" "An :class:`integer ` encoding a number of flags for the interpreter." -msgstr "" +msgstr "インタープリタ用の複数のフラグを符号化した :class:`整数 `。" -#: ../../reference/datamodel.rst:1508 msgid "" "The following flag bits are defined for :attr:`~codeobject.co_flags`: bit " "``0x04`` is set if the function uses the ``*arguments`` syntax to accept an " @@ -1903,77 +2136,94 @@ msgid "" "`inspect-module-co-flags` for details on the semantics of each flags that " "might be present." msgstr "" +":attr:`~codeobject.co_flags` には次のフラグビットが定義されています。\n" +"関数が ``*arguments`` 構文で任意個数の位置引数を受け付ける場合はビット " +"``0x04``、``**keywords`` 構文で任意のキーワード引数を受け付ける場合はビット " +"``0x08``、関数がジェネレータの場合はビット ``0x20`` が設定されます。\n" +"設定されうる各フラグの意味の詳細は :ref:`inspect-module-co-flags` を参照して" +"ください。" -#: ../../reference/datamodel.rst:1516 msgid "" "Future feature declarations (for example, ``from __future__ import " "division``) also use bits in :attr:`~codeobject.co_flags` to indicate " "whether a code object was compiled with a particular feature enabled. See :" "attr:`~__future__._Feature.compiler_flag`." msgstr "" +"``from __future__ import division`` のような future 機能の宣言も、:attr:" +"`~codeobject.co_flags` のビットを使って、その機能を有効にしてコードオブジェク" +"トをコンパイルしたかどうかを示します。\n" +":attr:`~__future__._Feature.compiler_flag` を参照してください。" -#: ../../reference/datamodel.rst:1520 msgid "" "Other bits in :attr:`~codeobject.co_flags` are reserved for internal use." msgstr "" +":attr:`~codeobject.co_flags` のほかのビットは、内部用に予約されています。" -#: ../../reference/datamodel.rst:1524 msgid "" "If a code object represents a function and has a docstring, the :data:" "`~inspect.CO_HAS_DOCSTRING` bit is set in :attr:`~codeobject.co_flags` and " "the first item in :attr:`~codeobject.co_consts` is the docstring of the " "function." msgstr "" +"コードオブジェクトが関数を表し、ドキュメンテーション文字列を持つ場合、:attr:" +"`~codeobject.co_flags` の :data:`~inspect.CO_HAS_DOCSTRING` ビットが設定さ" +"れ、:attr:`~codeobject.co_consts` の最初の要素が関数のドキュメンテーション文" +"字列になります。" -#: ../../reference/datamodel.rst:1530 msgid "Methods on code objects" -msgstr "" +msgstr "コードオブジェクトのメソッド" -#: ../../reference/datamodel.rst:1534 msgid "" "Returns an iterable over the source code positions of each :term:`bytecode` " "instruction in the code object." msgstr "" +"コードオブジェクト内の各 :term:`バイトコード ` 命令のソースコード上" +"の位置を反復するイテラブルを返します。" -#: ../../reference/datamodel.rst:1537 msgid "" "The iterator returns :class:`tuple`\\s containing the ``(start_line, " "end_line, start_column, end_column)``. The *i-th* tuple corresponds to the " "position of the source code that compiled to the *i-th* code unit. Column " "information is 0-indexed utf-8 byte offsets on the given source line." msgstr "" +"イテレータは ``(start_line, end_line, start_column, end_column)`` を含む :" +"class:`tuple` を返します。\n" +"*i* 番目のタプルは、*i* 番目のコード単位にコンパイルされたソースコードの位置" +"に対応します。\n" +"列の情報は、そのソース行を UTF-8 で表したときの 0 始まりのバイトオフセットで" +"す。" -#: ../../reference/datamodel.rst:1543 msgid "" "This positional information can be missing. A non-exhaustive lists of cases " "where this may happen:" msgstr "" +"位置情報がない場合もあります。\n" +"例えば次の場合が該当しますが、これらに限りません。" -#: ../../reference/datamodel.rst:1546 msgid "Running the interpreter with :option:`-X` ``no_debug_ranges``." msgstr "" +":option:`-X` ``no_debug_ranges`` を指定してインタープリタを実行した場合。" -#: ../../reference/datamodel.rst:1547 msgid "" "Loading a pyc file compiled while using :option:`-X` ``no_debug_ranges``." msgstr "" +":option:`-X` ``no_debug_ranges`` を指定してコンパイルされた pyc ファイルを読" +"み込んだ場合。" -#: ../../reference/datamodel.rst:1548 msgid "Position tuples corresponding to artificial instructions." -msgstr "" +msgstr "コンパイラが生成した補助的な命令に対応する位置のタプル。" -#: ../../reference/datamodel.rst:1549 msgid "" "Line and column numbers that can't be represented due to implementation " "specific limitations." -msgstr "" +msgstr "実装固有の制限によって表現できない行番号や列番号。" -#: ../../reference/datamodel.rst:1552 msgid "" "When this occurs, some or all of the tuple elements can be :const:`None`." msgstr "" +"この場合、タプルの一部またはすべての要素が :const:`None` になることがありま" +"す。" -#: ../../reference/datamodel.rst:1558 msgid "" "This feature requires storing column positions in code objects which may " "result in a small increase of disk usage of compiled Python files or " @@ -1982,172 +2232,203 @@ msgid "" "``no_debug_ranges`` command line flag or the :envvar:`PYTHONNODEBUGRANGES` " "environment variable can be used." msgstr "" +"この機能はコードオブジェクトに列位置を格納する必要があるため、コンパイルされ" +"た Python ファイルのディスク使用量やインタープリタのメモリ使用量がわずかに増" +"える場合があります。\n" +"追加情報の格納やトレースバックへの追加情報の表示を無効にするには、コマンドラ" +"インフラグ :option:`-X` ``no_debug_ranges`` または環境変数 :envvar:" +"`PYTHONNODEBUGRANGES` を使えます。" -#: ../../reference/datamodel.rst:1567 msgid "" "Returns an iterator that yields information about successive ranges of :term:" "`bytecode`\\s. Each item yielded is a ``(start, end, lineno)`` :class:" "`tuple`:" msgstr "" +"連続する :term:`バイトコード ` の範囲についての情報を yield するイ" +"テレータを返します。\n" +"各要素は ``(start, end, lineno)`` の :class:`tuple` です。" -#: ../../reference/datamodel.rst:1571 msgid "" "``start`` (an :class:`int`) represents the offset (inclusive) of the start " "of the :term:`bytecode` range" msgstr "" +"``start`` (:class:`int`) は :term:`バイトコード ` の範囲の開始オフ" +"セットを表します (この位置を含みます)。" -#: ../../reference/datamodel.rst:1573 msgid "" "``end`` (an :class:`int`) represents the offset (exclusive) of the end of " "the :term:`bytecode` range" msgstr "" +"``end`` (:class:`int`) は :term:`バイトコード ` の範囲の終了オフ" +"セットを表します (この位置は含みません)。" -#: ../../reference/datamodel.rst:1575 msgid "" "``lineno`` is an :class:`int` representing the line number of the :term:" "`bytecode` range, or ``None`` if the bytecodes in the given range have no " "line number" msgstr "" +"``lineno`` は :term:`バイトコード ` の範囲の行番号を表す :class:" +"`int` です。\n" +"その範囲のバイトコードに行番号がない場合は ``None`` です。" -#: ../../reference/datamodel.rst:1579 msgid "The items yielded will have the following properties:" -msgstr "" +msgstr "yield される要素には次の性質があります。" -#: ../../reference/datamodel.rst:1581 msgid "The first range yielded will have a ``start`` of 0." -msgstr "" +msgstr "最初の範囲の ``start`` は 0 です。" -#: ../../reference/datamodel.rst:1582 msgid "" "The ``(start, end)`` ranges will be non-decreasing and consecutive. That is, " "for any pair of :class:`tuple`\\s, the ``start`` of the second will be equal " "to the ``end`` of the first." msgstr "" +"``(start, end)`` の範囲は後戻りせず、連続しています。\n" +"つまり、隣り合う :class:`tuple` のペアでは、2 番目の ``start`` は 1 番目の " +"``end`` と等しくなります。" -#: ../../reference/datamodel.rst:1585 msgid "No range will be backwards: ``end >= start`` for all triples." msgstr "" +"逆向きの範囲はありません。\n" +"すべての 3 要素のタプルで ``end >= start`` が成り立ちます。" -#: ../../reference/datamodel.rst:1586 msgid "" "The last :class:`tuple` yielded will have ``end`` equal to the size of the :" "term:`bytecode`." msgstr "" +"最後に yield される :class:`tuple` の ``end`` は :term:`バイトコード " +"` のサイズに等しくなります。" -#: ../../reference/datamodel.rst:1589 msgid "" "Zero-width ranges, where ``start == end``, are allowed. Zero-width ranges " "are used for lines that are present in the source code, but have been " "eliminated by the :term:`bytecode` compiler." msgstr "" +"``start == end`` となる幅 0 の範囲も許されます。\n" +"幅 0 の範囲は、ソースコードには存在するものの :term:`バイトコード " +"` コンパイラによって削除された行に使われます。" -#: ../../reference/datamodel.rst:1597 msgid ":pep:`626` - Precise line numbers for debugging and other tools." -msgstr "" +msgstr ":pep:`626` - デバッグやその他のツールのための正確な行番号。" -#: ../../reference/datamodel.rst:1598 msgid "The PEP that introduced the :meth:`!co_lines` method." -msgstr "" +msgstr ":meth:`!co_lines` メソッドを導入した PEP。" -#: ../../reference/datamodel.rst:1602 msgid "" "Return a copy of the code object with new values for the specified fields." msgstr "" +"指定されたフィールドに新しい値を設定した、コードオブジェクトのコピーを返しま" +"す。" -#: ../../reference/datamodel.rst:1604 msgid "" "Code objects are also supported by the generic function :func:`copy.replace`." msgstr "" +"コードオブジェクトは、汎用関数 :func:`copy.replace` でもサポートされていま" +"す。" #: ../../reference/datamodel.rst:1612 msgid "Frame objects" msgstr "フレーム (frame) オブジェクト" -#: ../../reference/datamodel.rst:1616 msgid "" "Frame objects represent execution frames. They may occur in :ref:`traceback " "objects `, and are also passed to registered trace " "functions." msgstr "" +"フレームオブジェクトは実行フレームを表します。\n" +":ref:`トレースバックオブジェクト ` に含まれることがあるほ" +"か、登録されたトレース関数にも渡されます。" -#: ../../reference/datamodel.rst:1634 msgid "" "Points to the previous stack frame (towards the caller), or ``None`` if this " "is the bottom stack frame" msgstr "" +"前のスタックフレーム (呼び出し元の方向) を指します。\n" +"スタックの最下層のフレームであれば ``None`` です。" -#: ../../reference/datamodel.rst:1638 msgid "" "The :ref:`code object ` being executed in this frame. " "Accessing this attribute raises an :ref:`auditing event ` ``object." "__getattr__`` with arguments ``obj`` and ``\"f_code\"``." msgstr "" +"このフレームで実行している :ref:`コードオブジェクト `。\n" +"この属性にアクセスすると、引数 ``obj`` と ``\"f_code\"`` を伴う :ref:`監査イ" +"ベント ` ``object.__getattr__`` が発生します。" -#: ../../reference/datamodel.rst:1643 msgid "" "The mapping used by the frame to look up :ref:`local variables `. If " "the frame refers to an :term:`optimized scope`, this may return a write-" "through proxy object." msgstr "" +"フレームが :ref:`ローカル変数 ` の検索に使うマッピングです。\n" +"フレームが :term:`最適化されたスコープ ` を参照している場" +"合、書き込みが元のスコープに反映されるプロキシオブジェクトを返すことがありま" +"す。" -#: ../../reference/datamodel.rst:1648 msgid "Return a proxy for optimized scopes." -msgstr "" +msgstr "最適化されたスコープではプロキシを返すようになりました。" -#: ../../reference/datamodel.rst:1652 msgid "" "The dictionary used by the frame to look up :ref:`global variables `" -msgstr "" +msgstr "フレームが :ref:`グローバル変数 ` の検索に使う辞書" -#: ../../reference/datamodel.rst:1656 msgid "" "The dictionary used by the frame to look up :ref:`built-in (intrinsic) names " "`" -msgstr "" +msgstr "フレームが :ref:`組み込み名 ` の検索に使う辞書" -#: ../../reference/datamodel.rst:1660 msgid "" "The \"precise instruction\" of the frame object (this is an index into the :" "term:`bytecode` string of the :ref:`code object `)" msgstr "" +"フレームオブジェクト内の正確な命令位置 (:ref:`コードオブジェクト ` の :term:`バイトコード ` 列に対するインデックス)" -#: ../../reference/datamodel.rst:1676 msgid "" "If not ``None``, this is a function called for various events during code " "execution (this is used by debuggers). Normally an event is triggered for " "each new source line (see :attr:`~frame.f_trace_lines`)." msgstr "" +"``None`` でなければ、コード実行中のさまざまなイベントで呼び出される関数です " +"(デバッガが使います)。\n" +"通常、新しいソース行ごとにイベントが発生します (:attr:`~frame.f_trace_lines` " +"を参照)。" -#: ../../reference/datamodel.rst:1681 msgid "" "Set this attribute to :const:`False` to disable triggering a tracing event " "for each source line." msgstr "" +"この属性を :const:`False` に設定すると、ソース行ごとのトレースイベントの発生" +"を無効にします。" -#: ../../reference/datamodel.rst:1685 msgid "" "Set this attribute to :const:`True` to allow per-opcode events to be " "requested. Note that this may lead to undefined interpreter behaviour if " "exceptions raised by the trace function escape to the function being traced." msgstr "" +"この属性を :const:`True` に設定すると、オペコードごとのイベントを要求できるよ" +"うになります。\n" +"トレース関数が送出した例外がトレース対象の関数に伝わると、インタープリタの動" +"作が未定義になる可能性があることに注意してください。" -#: ../../reference/datamodel.rst:1691 msgid "" "The current line number of the frame -- writing to this from within a trace " "function jumps to the given line (only for the bottom-most frame). A " "debugger can implement a Jump command (aka Set Next Statement) by writing to " "this attribute." msgstr "" +"フレームの現在の行番号です。\n" +"トレース関数内からこの属性に書き込むと、指定した行にジャンプします (最も内側" +"のフレームでのみ可能です)。\n" +"デバッガはこの属性への書き込みによって、ジャンプコマンド (次に実行する文の設" +"定) を実装できます。" -#: ../../reference/datamodel.rst:1697 msgid "Frame object methods" -msgstr "" +msgstr "フレームオブジェクトのメソッド" #: ../../reference/datamodel.rst:1699 msgid "Frame objects support one method:" msgstr "フレームオブジェクトはメソッドを一つサポートします:" -#: ../../reference/datamodel.rst:1703 msgid "" "This method clears all references to :ref:`local variables ` held by " "the frame. Also, if the frame belonged to a :term:`generator`, the " @@ -2155,35 +2436,46 @@ msgid "" "objects (for example when catching an :ref:`exception ` " "and storing its :ref:`traceback ` for later use)." msgstr "" +"フレームが保持する :ref:`ローカル変数 ` への参照をすべてクリアしま" +"す。\n" +"フレームが :term:`ジェネレータ ` に属していた場合は、そのジェネ" +"レータの終了処理も行います。\n" +"これにより、フレームオブジェクトを含む循環参照を解消できます。\n" +"例えば :ref:`例外 ` を捕捉し、後で使うために :ref:`トレース" +"バック ` を保存した場合に役立ちます。" -#: ../../reference/datamodel.rst:1709 msgid "" ":exc:`RuntimeError` is raised if the frame is currently executing or " "suspended." msgstr "" +"フレームが実行中または中断中の場合は :exc:`RuntimeError` が送出されます。" -#: ../../reference/datamodel.rst:1714 msgid "" "Attempting to clear a suspended frame raises :exc:`RuntimeError` (as has " "always been the case for executing frames)." msgstr "" +"中断中のフレームをクリアしようとすると :exc:`RuntimeError` が送出されるように" +"なりました (実行中のフレームでは以前から送出されていました)。" #: ../../reference/datamodel.rst:1722 msgid "Traceback objects" msgstr "トレースバック (traceback) オブジェクト" -#: ../../reference/datamodel.rst:1735 msgid "" "Traceback objects represent the stack trace of an :ref:`exception `. A traceback object is implicitly created when an exception occurs, " "and may also be explicitly created by calling :class:`types.TracebackType`." msgstr "" +"トレースバックオブジェクトは :ref:`例外 ` のスタックトレースを表" +"します。\n" +"例外が発生すると暗黙的に作成されますが、:class:`types.TracebackType` を呼び出" +"して明示的に作成することもできます。" -#: ../../reference/datamodel.rst:1740 msgid "Traceback objects can now be explicitly instantiated from Python code." msgstr "" +"Python コードからトレースバックオブジェクトを明示的にインスタンス化できるよう" +"になりました。" -#: ../../reference/datamodel.rst:1743 msgid "" "For implicitly created tracebacks, when the search for an exception handler " "unwinds the execution stack, at each unwound level a traceback object is " @@ -2193,59 +2485,71 @@ msgid "" "`sys.exc_info`, and as the :attr:`~BaseException.__traceback__` attribute of " "the caught exception." msgstr "" +"暗黙的に作成されるトレースバックでは、例外ハンドラを探して実行スタックを巻き" +"戻す際、各段階で現在のトレースバックの先頭にトレースバックオブジェクトが挿入" +"されます。\n" +"例外ハンドラに入ると、プログラムからスタックトレースを利用できるようになりま" +"す (:ref:`try` を参照)。\n" +":func:`sys.exc_info` が返すタプルの第 3 要素、または捕捉した例外の :attr:" +"`~BaseException.__traceback__` 属性としてアクセスできます。" -#: ../../reference/datamodel.rst:1752 msgid "" "When the program contains no suitable handler, the stack trace is written " "(nicely formatted) to the standard error stream; if the interpreter is " "interactive, it is also made available to the user as :data:`sys." "last_traceback`." msgstr "" +"プログラムに適切なハンドラがない場合、スタックトレースは読みやすく整形されて" +"標準エラーストリームに書き出されます。\n" +"対話型インタープリタでは、:data:`sys.last_traceback` としてユーザーからもアク" +"セスできます。" -#: ../../reference/datamodel.rst:1757 msgid "" "For explicitly created tracebacks, it is up to the creator of the traceback " "to determine how the :attr:`~traceback.tb_next` attributes should be linked " "to form a full stack trace." msgstr "" +"明示的に作成するトレースバックでは、:attr:`~traceback.tb_next` 属性をどのよう" +"につないで完全なスタックトレースを構成するかは、作成者が決めます。" -#: ../../reference/datamodel.rst:1772 msgid "" "Points to the execution :ref:`frame ` of the current level." -msgstr "" +msgstr "現在の階層の実行 :ref:`フレーム ` を指します。" -#: ../../reference/datamodel.rst:1775 msgid "" "Accessing this attribute raises an :ref:`auditing event ` ``object." "__getattr__`` with arguments ``obj`` and ``\"tb_frame\"``." msgstr "" +"この属性にアクセスすると、引数 ``obj`` と ``\"tb_frame\"`` を伴う :ref:`監査" +"イベント ` ``object.__getattr__`` が発生します。" -#: ../../reference/datamodel.rst:1780 msgid "Gives the line number where the exception occurred" -msgstr "" +msgstr "例外が発生した行番号を示します。" -#: ../../reference/datamodel.rst:1783 msgid "Indicates the \"precise instruction\"." -msgstr "" +msgstr "正確な命令位置を示します。" -#: ../../reference/datamodel.rst:1785 msgid "" "The line number and last instruction in the traceback may differ from the " "line number of its :ref:`frame object ` if the exception " "occurred in a :keyword:`try` statement with no matching except clause or " "with a :keyword:`finally` clause." msgstr "" +"一致する except 節がない :keyword:`try` 文や、:keyword:`finally` 節を持つ " +"try 文で例外が発生した場合、トレースバックの行番号と最後の命令は、その :ref:`" +"フレームオブジェクト ` の行番号とは異なることがあります。" -#: ../../reference/datamodel.rst:1796 msgid "" "The special writable attribute :attr:`!tb_next` is the next level in the " "stack trace (towards the frame where the exception occurred), or ``None`` if " "there is no next level." msgstr "" +"書き込み可能な特殊属性 :attr:`!tb_next` は、スタックトレースの次の階層 (例外" +"が発生したフレームの方向) を指します。\n" +"次の階層がなければ ``None`` です。" -#: ../../reference/datamodel.rst:1800 msgid "This attribute is now writable" -msgstr "" +msgstr "この属性に書き込めるようになりました。" #: ../../reference/datamodel.rst:1805 msgid "Slice objects" @@ -2317,7 +2621,6 @@ msgstr "" msgid "Class method objects" msgstr "クラスメソッドオブジェクト" -#: ../../reference/datamodel.rst:1849 msgid "" "A class method object, like a static method object, is a wrapper around " "another object that alters the way in which that object is retrieved from " @@ -2326,6 +2629,13 @@ msgid "" "methods>`. Class method objects are created by the built-in :func:" "`classmethod` constructor." msgstr "" +"クラスメソッドオブジェクトは、静的メソッドオブジェクトと同様に、別のオブジェ" +"クトをラップして、そのオブジェクトをクラスやクラスインスタンスから取得する方" +"法を変えます。\n" +"取得時のクラスメソッドオブジェクトの動作については、上記の :ref:`インスタンス" +"メソッド ` で説明しています。\n" +"クラスメソッドオブジェクトは、組み込みの :func:`classmethod` コンストラクタで" +"作成します。" #: ../../reference/datamodel.rst:1859 msgid "Special method names" @@ -2388,7 +2698,6 @@ msgstr "" msgid "Basic customization" msgstr "基本的なカスタマイズ" -#: ../../reference/datamodel.rst:1899 msgid "" "Called to create a new instance of class *cls*. :meth:`__new__` is a static " "method (special-cased so you need not declare it as such) that takes the " @@ -2397,12 +2706,15 @@ msgid "" "(the call to the class). The return value of :meth:`__new__` should be the " "new object instance (usually an instance of *cls*)." msgstr "" -"クラス *cls* の新しいインスタンスを作るために呼び出されます。 :meth:" -"`__new__` は静的メソッドで (このメソッドは特別扱いされているので、明示的に静" -"的メソッドと宣言する必要はありません)、インスタンスを生成するよう要求されてい" -"るクラスを第一引数にとります。残りの引数はオブジェクトのコンストラクタの式 " -"(クラスの呼び出し文) に渡されます。 :meth:`__new__` の戻り値は新しいオブジェ" -"クトのインスタンス (通常は *cls* のインスタンス) でなければなりません。" +"クラス ``cls`` の新しいインスタンスを作るために呼び出されます。\n" +":meth:`__new__` は静的メソッドで、インスタンスを生成する対象のクラスを最初の" +"引数に取ります\n" +"(特別扱いされるため、静的メソッドであると明示的に宣言する必要はありませ" +"ん)。\n" +"残りの引数は、オブジェクトのコンストラクタ式 (クラスの呼び出し) に渡されたも" +"のです。\n" +":meth:`__new__` は新しいオブジェクトのインスタンス (通常は ``cls`` のインスタ" +"ンス) を返す必要があります。" #: ../../reference/datamodel.rst:1906 msgid "" @@ -2461,9 +2773,9 @@ msgstr "" "インスタンスが (:meth:`__new__` によって) 生成された後、それが呼び出し元に返" "される前に呼び出されます。引数はクラスのコンストラクタ式に渡したものです。基" "底クラスとその派生クラスがともに :meth:`__init__` メソッドを持つ場合、派生ク" -"ラスの :meth:`__init__` メソッドは基底クラスの :meth:`__init__` メソッドを明" -"示的に呼び出して、インスタンスの基底クラス部分が適切に初期化されること保証し" -"なければなりません。例えば、 ``super().__init__([args...])`` 。" +"ラスの :meth:`__init__` メソッドは基底クラスの ``__init__()`` メソッドを明示" +"的に呼び出して、インスタンスの基底クラス部分が適切に初期化されること保証しな" +"ければなりません。例えば、 ``super().__init__([args...])`` 。" #: ../../reference/datamodel.rst:1935 msgid "" @@ -2488,9 +2800,9 @@ msgstr "" "インスタンスが破棄されるときに呼び出されます。\n" "これはファイナライザや (適切ではありませんが) デストラクタとも呼ばれます。\n" "基底クラスが :meth:`__del__` メソッドを持っている場合は、派生クラスの :meth:" -"`__del__` メソッドは何であれ、基底クラスの :meth:`__del__` メソッドを明示的" -"に呼び出して、インスタンスの基底クラス部分をきちんと確実に削除しなければなり" -"ません。" +"`__del__` メソッドは何であれ、基底クラスの ``__del__()`` メソッドを明示的に" +"呼び出して、インスタンスの基底クラス部分をきちんと確実に削除しなければなりま" +"せん。" #: ../../reference/datamodel.rst:1954 msgid "" @@ -2508,13 +2820,16 @@ msgstr "" "うかは実装依存です;\n" "現在の :term:`CPython` の実装では最初の一回しか呼び出されません。" -#: ../../reference/datamodel.rst:1961 msgid "" "It is not guaranteed that :meth:`__del__` methods are called for objects " "that still exist when the interpreter exits. :class:`weakref.finalize` " "provides a straightforward way to register a cleanup function to be called " "when an object is garbage collected." msgstr "" +"インタープリタの終了時にまだ存在するオブジェクトについては、:meth:`__del__` " +"メソッドが呼び出される保証はありません。\n" +":class:`weakref.finalize` を使うと、オブジェクトがガベージコレクションで回収" +"されたときに呼び出す後処理の関数を簡単に登録できます。" #: ../../reference/datamodel.rst:1968 msgid "" @@ -2526,7 +2841,6 @@ msgstr "" "ントを 1 つ減らし、後者は ``x`` の参照カウントが 0 まで落ちたときのみ呼び出さ" "れます。" -#: ../../reference/datamodel.rst:1973 msgid "" "It is possible for a reference cycle to prevent the reference count of an " "object from going to zero. In this case, the cycle will be later detected " @@ -2536,6 +2850,12 @@ msgid "" "references its own traceback, which references the locals of all frames " "caught in the traceback." msgstr "" +"循環参照によって、オブジェクトの参照カウントが 0 にならない場合があります。\n" +"その場合、循環参照は後で :term:`循環ガベージコレクタ ` に" +"よって検出され、削除されます。\n" +"よくある原因の 1 つは、捕捉した例外をローカル変数に保持することです。\n" +"フレームのローカル変数が例外を参照し、例外が自身のトレースバックを参照し、ト" +"レースバックがそこに含まれる全フレームのローカル変数を参照するためです。" #: ../../reference/datamodel.rst:1983 msgid "Documentation for the :mod:`gc` module." @@ -2603,20 +2923,25 @@ msgstr "" "スのインスタンスの「非公式の (informal)」文字列表現が要求されたときにも :" "meth:`__repr__` が使われます。" -#: ../../reference/datamodel.rst:2021 msgid "" "This is typically used for debugging, so it is important that the " "representation is information-rich and unambiguous. A default implementation " "is provided by the :class:`object` class itself." msgstr "" +"通常はデバッグに使うため、情報が豊富で曖昧さのない表現にすることが重要で" +"す。\n" +":class:`object` クラス自身がデフォルトの実装を提供します。" -#: ../../reference/datamodel.rst:2033 msgid "" "Called by :func:`str(object) `, the default :meth:`__format__` " "implementation, and the built-in function :func:`print`, to compute the " "\"informal\" or nicely printable string representation of an object. The " "return value must be a :ref:`str ` object." msgstr "" +":func:`str(object) `、デフォルトの :meth:`__format__` 実装、および組み込" +"み関数 :func:`print` から呼び出され、オブジェクトの「非公式な」、または表示に" +"適した文字列表現を生成します。\n" +"戻り値は :ref:`str ` オブジェクトでなければなりません。" #: ../../reference/datamodel.rst:2038 msgid "" @@ -2636,12 +2961,15 @@ msgstr "" "組み込み型 :class:`object` によって定義されたデフォルト実装は、 :meth:" "`object.__repr__` を呼び出します。" -#: ../../reference/datamodel.rst:2052 msgid "" "Called by :ref:`bytes ` to compute a byte-string representation " "of an object. This should return a :class:`bytes` object. The :class:" "`object` class itself does not provide this method." msgstr "" +":ref:`bytes ` から呼び出され、オブジェクトのバイト列による表現を" +"生成します。\n" +":class:`bytes` オブジェクトを返す必要があります。\n" +":class:`object` クラス自身はこのメソッドを提供しません。" #: ../../reference/datamodel.rst:2064 msgid "" @@ -2672,11 +3000,13 @@ msgstr "" msgid "The return value must be a string object." msgstr "戻り値は文字列オブジェクトでなければなりません。" -#: ../../reference/datamodel.rst:2078 msgid "" "The default implementation by the :class:`object` class should be given an " "empty *format_spec* string. It delegates to :meth:`__str__`." msgstr "" +":class:`object` クラスのデフォルト実装には、空文字列の *format_spec* を渡す必" +"要があります。\n" +"この実装は :meth:`__str__` に処理を委譲します。" #: ../../reference/datamodel.rst:2081 msgid "" @@ -2708,7 +3038,6 @@ msgstr "" "を呼び出します; ``x!=y`` は ``x.__ne__(y)`` を呼び出します; ``x>y`` は ``x." "__gt__(y)`` を呼び出します; ``x>=y`` は ``x.__ge__(y)`` を呼び出します。" -#: ../../reference/datamodel.rst:2107 msgid "" "A rich comparison method may return the singleton :data:`NotImplemented` if " "it does not implement the operation for a given pair of arguments. By " @@ -2718,6 +3047,12 @@ msgid "" "statement), Python will call :func:`bool` on the value to determine if the " "result is true or false." msgstr "" +"拡張比較メソッドは、与えられた引数のペアに対する演算を実装していない場合、シ" +"ングルトン :data:`NotImplemented` を返せます。\n" +"慣例として、比較できた場合は ``False`` または ``True`` を返します。\n" +"ただし、これらのメソッドは任意の値を返せます。\n" +"そのため、比較演算子を ``if`` 文の条件などブール値を求める文脈で使うと、" +"Python は返された値に :func:`bool` を適用して真偽を判定します。" #: ../../reference/datamodel.rst:2114 msgid "" @@ -2731,7 +3066,6 @@ msgid "" "operation, see :func:`functools.total_ordering`." msgstr "" -#: ../../reference/datamodel.rst:2123 msgid "" "By default, the :class:`object` class provides implementations consistent " "with :ref:`expressions-value-comparisons`: equality compares according to " @@ -2739,6 +3073,12 @@ msgid "" "method may generate these results directly, but may also return :data:" "`NotImplemented`." msgstr "" +":class:`object` クラスはデフォルトで :ref:`expressions-value-comparisons` に" +"沿う実装を提供します。\n" +"等値比較ではオブジェクトの同一性を比較し、順序比較では :exc:`TypeError` が送" +"出されます。\n" +"各デフォルトメソッドはこれらの結果を直接返す場合も、:data:`NotImplemented` を" +"返す場合もあります。" #: ../../reference/datamodel.rst:2129 msgid "" @@ -2750,7 +3090,6 @@ msgstr "" "ハッシュ可能 ` オブジェクトを作るときの重要な注意点について、 :" "meth:`__hash__` のドキュメント内に書かれているので参照してください。" -#: ../../reference/datamodel.rst:2133 msgid "" "There are no swapped-argument versions of these methods (to be used when the " "left argument does not support the operation but the right argument does); " @@ -2762,13 +3101,23 @@ msgid "" "operand has priority, otherwise the left operand's method has priority. " "Virtual subclassing is not considered." msgstr "" +"これらのメソッドには、左右の引数を入れ替えた版 (左の引数が演算をサポートせ" +"ず、右の引数がサポートする場合に使うもの) はありません。\n" +"代わりに、:meth:`__lt__` と :meth:`__gt__`、:meth:`__le__` と :meth:`__ge__` " +"はそれぞれ互いの反射演算であり、:meth:`__eq__` と :meth:`__ne__` はそれぞれ自" +"身の反射演算です。\n" +"被演算子の型が異なり、右の被演算子の型が左の被演算子の型の直接または間接のサ" +"ブクラスである場合、右の被演算子の反射メソッドが優先されます。\n" +"それ以外の場合は左の被演算子のメソッドが優先されます。\n" +"仮想サブクラスの関係は考慮されません。" -#: ../../reference/datamodel.rst:2144 msgid "" "When no appropriate method returns any value other than :data:" "`NotImplemented`, the ``==`` and ``!=`` operators will fall back to ``is`` " "and ``is not``, respectively." msgstr "" +"適切なメソッドがどれも :data:`NotImplemented` 以外の値を返さない場合、``==`` " +"と ``!=`` 演算子はそれぞれ ``is`` と ``is not`` による比較を行います。" #: ../../reference/datamodel.rst:2153 msgid "" @@ -2789,11 +3138,12 @@ msgstr "" "オブジェクトを比較するときでも利用される要素をタプルに詰めてハッシュ値を計算" "することで、それぞれの要素のハッシュ値を混合することをおすすめします。" -#: ../../reference/datamodel.rst:2161 msgid "" "def __hash__(self):\n" " return hash((self.name, self.nick, self.color))" msgstr "" +"def __hash__(self):\n" +" return hash((self.name, self.nick, self.color))" #: ../../reference/datamodel.rst:2166 msgid "" @@ -2834,7 +3184,6 @@ msgstr "" "クトのハッシュ値が変化すると、誤ったハッシュバケツ: hash bucket に入ってしま" "います)。" -#: ../../reference/datamodel.rst:2183 msgid "" "User-defined classes have :meth:`__eq__` and :meth:`__hash__` methods by " "default (inherited from the :class:`object` class); with them, all objects " @@ -2842,6 +3191,11 @@ msgid "" "appropriate value such that ``x == y`` implies both that ``x is y`` and " "``hash(x) == hash(y)``." msgstr "" +"ユーザー定義クラスはデフォルトで、:class:`object` クラスから継承した :meth:" +"`__eq__` メソッドと :meth:`__hash__` メソッドを持ちます。\n" +"これらを使うと、どのオブジェクトも自身以外とは等しくないと比較されます。\n" +"また、``x.__hash__()`` は、``x == y`` なら ``x is y`` と ``hash(x) == " +"hash(y)`` の両方が成り立つような適切な値を返します。" #: ../../reference/datamodel.rst:2188 msgid "" @@ -2919,7 +3273,6 @@ msgstr ":envvar:`PYTHONHASHSEED` も参照してください。" msgid "Hash randomization is enabled by default." msgstr "ハッシュのランダム化がデフォルトで有効になりました。" -#: ../../reference/datamodel.rst:2232 msgid "" "Called to implement truth value testing and the built-in operation " "``bool()``; should return ``False`` or ``True``. When this method is not " @@ -2928,6 +3281,12 @@ msgid "" "meth:`!__len__` nor :meth:`!__bool__` (which is true of the :class:`object` " "class itself), all its instances are considered true." msgstr "" +"真偽値の判定と組み込み操作 ``bool()`` を実装するために呼び出されます。\n" +"``False`` または ``True`` を返す必要があります。\n" +"このメソッドが定義されていなければ、:meth:`~object.__len__` が定義されている" +"場合はそれを呼び出し、結果が 0 でなければオブジェクトを真とみなします。\n" +":class:`object` クラス自身のように、クラスが :meth:`!__len__` も :meth:`!" +"__bool__` も定義していない場合、そのすべてのインスタンスを真とみなします。" #: ../../reference/datamodel.rst:2243 msgid "Customizing attribute access" @@ -2943,7 +3302,6 @@ msgstr "" "使用、 ``x.name`` への代入、 ``x.name`` の削除) の意味をカスタマイズすること" "ができます。" -#: ../../reference/datamodel.rst:2253 msgid "" "Called when the default attribute access fails with an :exc:`AttributeError` " "(either :meth:`__getattribute__` raises an :exc:`AttributeError` because " @@ -2953,8 +3311,16 @@ msgid "" "attribute value or raise an :exc:`AttributeError` exception. The :class:" "`object` class itself does not provide this method." msgstr "" +"デフォルトの属性アクセスが :exc:`AttributeError` で失敗したときに呼び出されま" +"す。\n" +"これは、*name* が ``self`` のインスタンス属性でもクラス階層内の属性でもないた" +"めに :meth:`__getattribute__` が :exc:`AttributeError` を送出した場合や、" +"*name* プロパティの :meth:`__get__` が :exc:`AttributeError` を送出した場合で" +"す。\n" +"このメソッドは計算した属性値を返すか、:exc:`AttributeError` 例外を送出する必" +"要があります。\n" +":class:`object` クラス自身はこのメソッドを提供しません。" -#: ../../reference/datamodel.rst:2261 msgid "" "Note that if the attribute is found through the normal mechanism, :meth:" "`__getattr__` is not called. (This is an intentional asymmetry between :" @@ -2966,8 +3332,17 @@ msgid "" "object). See the :meth:`__getattribute__` method below for a way to " "actually get total control over attribute access." msgstr "" +"通常の仕組みで属性が見つかった場合、:meth:`__getattr__` は呼び出されませ" +"ん。\n" +"(:meth:`__getattr__` と :meth:`__setattr__` のこの非対称性は意図的なもので" +"す。)\n" +"これは効率のためであると同時に、そうしなければ :meth:`__getattr__` からインス" +"タンスのほかの属性にアクセスする手段がなくなるためです。\n" +"少なくともインスタンス変数については、インスタンスの属性辞書に値を入れず、代" +"わりに別のオブジェクトに入れることで、完全に制御できます。\n" +"属性アクセスを実際に完全に制御する方法は、次の :meth:`__getattribute__` メ" +"ソッドを参照してください。" -#: ../../reference/datamodel.rst:2274 msgid "" "Called unconditionally to implement attribute accesses for instances of the " "class. If the class also defines :meth:`__getattr__`, the latter will not be " @@ -2979,29 +3354,32 @@ msgid "" "example, ``object.__getattribute__(self, name)``." msgstr "" "クラスのインスタンスに対する属性アクセスを実装するために、無条件に呼び出され" -"ます。クラスが :meth:`__getattr__` も定義している場合、 :meth:`__getattr__` " -"は、 :meth:`__getattribute__` で明示的に呼び出すか、 :exc:`AttributeError` 例" -"外を送出しない限り呼ばれません。このメソッドは (計算された) 属性値を返す" -"か、 :exc:`AttributeError` 例外を送出します。このメソッドが再帰的に際限なく呼" -"び出されてしまうのを防ぐため、実装の際には常に、必要な属性全てへのアクセス" -"で、例えば ``object.__getattribute__(self, name)`` のように基底クラスのメソッ" -"ドを同じ属性名を使って呼び出さなければなりません。" +"ます。\n" +"クラスが :meth:`__getattr__` も定義している場合、それは :meth:" +"`__getattribute__` が明示的に呼び出すか、:exc:`AttributeError` を送出しない限" +"り呼び出されません。\n" +"このメソッドは計算した属性値を返すか、:exc:`AttributeError` 例外を送出する必" +"要があります。\n" +"無限再帰を避けるため、必要な属性へのアクセスには、常に基底クラスの同名のメ" +"ソッドを呼び出してください。\n" +"例えば ``object.__getattribute__(self, name)`` とします。" -#: ../../reference/datamodel.rst:2285 msgid "" "This method may still be bypassed when looking up special methods as the " "result of implicit invocation via language syntax or :ref:`built-in " "functions `. See :ref:`special-lookup`." msgstr "" +"ただし、言語の構文や :ref:`組み込み関数 ` による暗黙的な呼" +"び出しで特殊メソッドを検索する場合、このメソッドを経由しないことがありま" +"す。\n" +":ref:`special-lookup` を参照してください。" -#: ../../reference/datamodel.rst:2290 ../../reference/datamodel.rst:2292 msgid "" "For certain sensitive attribute accesses, raises an :ref:`auditing event " "` ``object.__getattr__`` with arguments ``obj`` and ``name``." msgstr "" -"セキュリティに関わるような ``obj`` と ``name`` を渡しての ``object." -"__getattr__`` を使った属性アクセスは :ref:`監査イベント ` を送出し" -"ます。" +"セキュリティ上注意が必要な一部の属性アクセスでは、引数 ``obj`` と ``name`` を" +"伴う :ref:`監査イベント ` ``object.__getattr__`` が発生します。" #: ../../reference/datamodel.rst:2299 msgid "" @@ -3023,15 +3401,14 @@ msgstr "" "れと同じ名前のメソッドを呼び出さなければなりません。例えば、 ``object." "__setattr__(self, name, value)`` とします。" -#: ../../reference/datamodel.rst:2307 ../../reference/datamodel.rst:2309 msgid "" "For certain sensitive attribute assignments, raises an :ref:`auditing event " "` ``object.__setattr__`` with arguments ``obj``, ``name``, " "``value``." msgstr "" -"セキュリティに関わるような ``obj`` と ``name`` と ``value`` を渡しての " -"``object.__setattr__`` を使った属性のアサインは :ref:`監査イベント " -"` を送出します。" +"セキュリティ上注意が必要な一部の属性への代入では、引数 ``obj``、``name``、" +"``value`` を伴う :ref:`監査イベント ` ``object.__setattr__`` が発生" +"します。" #: ../../reference/datamodel.rst:2316 msgid "" @@ -3043,20 +3420,20 @@ msgstr "" "ソッドを実装するのは、オブジェクトにとって ``del obj.name`` が意味がある場合" "だけにしなければなりません。" -#: ../../reference/datamodel.rst:2319 ../../reference/datamodel.rst:2321 msgid "" "For certain sensitive attribute deletions, raises an :ref:`auditing event " "` ``object.__delattr__`` with arguments ``obj`` and ``name``." msgstr "" -"セキュリティに関わるような ``obj`` と ``name`` を渡しての ``object." -"__getattr__`` を使った属性の削除は :ref:`監査イベント ` を送出しま" -"す。" +"セキュリティ上注意が必要な一部の属性の削除では、引数 ``obj`` と ``name`` を伴" +"う :ref:`監査イベント ` ``object.__delattr__`` が発生します。" -#: ../../reference/datamodel.rst:2328 msgid "" "Called when :func:`dir` is called on the object. An iterable must be " "returned. :func:`dir` converts the returned iterable to a list and sorts it." msgstr "" +"オブジェクトに対して :func:`dir` が呼び出されたときに呼び出されます。\n" +"イテラブルを返さなければなりません。\n" +":func:`dir` は返されたイテラブルをリストに変換してソートします。" #: ../../reference/datamodel.rst:2333 msgid "Customizing module attribute access" @@ -3082,12 +3459,15 @@ msgstr "" "前に、モジュールの ``__dict__`` から ``__getattr__`` が検索されます。\n" "見付かった場合は、その属性名で呼び出され、結果が返されます。" -#: ../../reference/datamodel.rst:2349 msgid "" "The ``__dir__`` function should accept no arguments, and return an iterable " "of strings that represents the names accessible on module. If present, this " "function overrides the standard :func:`dir` search on a module." msgstr "" +"``__dir__`` 関数は引数を受け取らず、モジュールからアクセス可能な名前を表す文" +"字列のイテラブルを返す必要があります。\n" +"この関数がある場合、モジュールに対する :func:`dir` の標準の検索を置き換えま" +"す。" #: ../../reference/datamodel.rst:2353 msgid "" @@ -3100,7 +3480,6 @@ msgstr "" "ModuleType` のサブクラスが設定できます。\n" "例えば次のようになります::" -#: ../../reference/datamodel.rst:2357 msgid "" "import sys\n" "from types import ModuleType\n" @@ -3115,18 +3494,29 @@ msgid "" "\n" "sys.modules[__name__].__class__ = VerboseModule" msgstr "" +"import sys\n" +"from types import ModuleType\n" +"\n" +"class VerboseModule(ModuleType):\n" +" def __repr__(self):\n" +" return f'Verbose {self.__name__}'\n" +"\n" +" def __setattr__(self, attr, value):\n" +" print(f'Setting {attr}...')\n" +" super().__setattr__(attr, value)\n" +"\n" +"sys.modules[__name__].__class__ = VerboseModule" -#: ../../reference/datamodel.rst:2371 msgid "" "Defining module ``__getattr__`` and setting module ``__class__`` only affect " "lookups made using the attribute access syntax -- directly accessing the " "module globals (whether by code within the module, or via a reference to the " "module's globals dictionary) is unaffected." msgstr "" -"モジュールの ``__getattr__`` を定義したり ``__class__`` を設定したりしても、" -"影響があるのは属性アクセスの構文が使われる検索だけです -- モジュールの " -"globals への直接アクセスは (モジュール内のコードからとモジュールの globals の" -"どちらでも) 影響を受けません。" +"モジュールの ``__getattr__`` の定義や ``__class__`` の設定が影響するのは、属" +"性アクセス構文による検索だけです。\n" +"モジュール内のコードからのアクセスでも、モジュールのグローバル辞書への参照を" +"通じたアクセスでも、グローバル変数への直接アクセスには影響しません。" #: ../../reference/datamodel.rst:2376 msgid "``__class__`` module attribute is now writable." @@ -3148,7 +3538,6 @@ msgstr "モジュールの ``__getattr__`` 関数および ``__dir__`` 関数の msgid "Implementing Descriptors" msgstr "デスクリプタ (descriptor) の実装" -#: ../../reference/datamodel.rst:2393 msgid "" "The following methods only apply when an instance of the class containing " "the method (a so-called *descriptor* class) appears in an *owner* class (the " @@ -3158,8 +3547,14 @@ msgid "" "the owner class' :attr:`~object.__dict__`. The :class:`object` class itself " "does not implement any of these protocols." msgstr "" +"以下のメソッドが適用されるのは、そのメソッドを含むクラス (いわゆる *デスクリ" +"プタ* クラス) のインスタンスが、*オーナー* クラス内にある場合だけです。\n" +"デスクリプタは、オーナークラスまたはその親クラスのクラス辞書に入っている必要" +"があります。\n" +"以下の例で「属性」とは、オーナークラスの :attr:`~object.__dict__` 内でそのプ" +"ロパティに対応するキーを名前とする属性を指します。\n" +":class:`object` クラス自身は、これらのプロトコルを実装しません。" -#: ../../reference/datamodel.rst:2403 msgid "" "Called to get the attribute of the owner class (class attribute access) or " "of an instance of that class (instance attribute access). The optional " @@ -3167,10 +3562,12 @@ msgid "" "the attribute was accessed through, or ``None`` when the attribute is " "accessed through the *owner*." msgstr "" -"オーナークラス(クラス属性アクセスの場合)や、クラスのインスタンス(インスタ" -"ンス属性アクセスの場合)の属性取得時に呼び出されます。 *instance* を通じて属" -"性をアクセスする時に、オプションの *owner* 引数はオーナークラスです。 " -"*owner* を通じて属性アクセスするときは ``None`` です。" +"オーナークラスの属性 (クラス属性アクセス) またはそのクラスのインスタンスの属" +"性 (インスタンス属性アクセス) を取得するために呼び出されます。\n" +"オプション引数 ``owner`` はオーナークラスです。\n" +"``instance`` は、インスタンスを通じて属性にアクセスした場合はそのインスタン" +"ス、\n" +"``owner`` を通じてアクセスした場合は ``None`` です。" #: ../../reference/datamodel.rst:2409 msgid "" @@ -3220,13 +3617,13 @@ msgstr "" "オーナークラスのインスタンス *instance* 上の属性を削除する際に呼び出されま" "す。" -#: ../../reference/datamodel.rst:2432 msgid "" "Instances of descriptors may also have the :attr:`!__objclass__` attribute " "present:" msgstr "" +"デスクリプタのインスタンスには :attr:`!__objclass__` 属性がある場合もありま" +"す。" -#: ../../reference/datamodel.rst:2437 msgid "" "The attribute :attr:`!__objclass__` is interpreted by the :mod:`inspect` " "module as specifying the class where this object was defined (setting this " @@ -3236,6 +3633,13 @@ msgid "" "argument (for example, CPython sets this attribute for unbound methods that " "are implemented in C)." msgstr "" +":mod:`inspect` モジュールは :attr:`!__objclass__` 属性を、このオブジェクトが" +"定義されたクラスを指定するものとして解釈します。\n" +"適切に設定すると、動的なクラス属性の実行時イントロスペクションに役立ちま" +"す。\n" +"呼び出し可能オブジェクトでは、最初の位置引数に、その型またはサブクラスのイン" +"スタンスが期待される、あるいは必要であることを示す場合があります。\n" +"例えば CPython は、C で実装された非束縛メソッドにこの属性を設定します。" #: ../../reference/datamodel.rst:2448 msgid "Invoking Descriptors" @@ -3331,18 +3735,16 @@ msgstr "" msgid "Super Binding" msgstr "super 束縛 (Super Binding)" -#: ../../reference/datamodel.rst:2482 msgid "" "A dotted lookup such as ``super(A, a).x`` searches ``a.__class__.__mro__`` " "for a base class ``B`` following ``A`` and then returns ``B.__dict__['x']." "__get__(a, A)``. If not a descriptor, ``x`` is returned unchanged." msgstr "" -"``super(A, a).x`` のようなドットを使ったルックアップは ``a.__class__." -"__mro__`` を探索して、 ``A`` の前のクラス ``B`` をまず探し、 ``B." -"__dict__['x'].__get__(a, A)`` を返します。もしデスクリプタでなければ ``x`` を" -"変更せずに返します。" +"``super(A, a).x`` のようにドット記法で属性を検索すると、``a.__class__." +"__mro__`` の中で ``A`` の後にある基底クラス ``B`` を探し、\n" +"``B.__dict__['x'].__get__(a, A)`` を返します。\n" +"``x`` がデスクリプタでなければ、そのまま返します。" -#: ../../reference/datamodel.rst:2519 msgid "" "For instance bindings, the precedence of descriptor invocation depends on " "which descriptor methods are defined. A descriptor can define any " @@ -3359,6 +3761,19 @@ msgid "" "dictionary. In contrast, non-data descriptors can be overridden by " "instances." msgstr "" +"インスタンスへの束縛では、デスクリプタ呼び出しの優先順位は定義されたデスクリ" +"プタメソッドによって決まります。\n" +"デスクリプタは :meth:`~object.__get__`、:meth:`~object.__set__`、:meth:" +"`~object.__delete__` を任意に組み合わせて定義できます。\n" +":meth:`!__get__` が定義されていなければ、オブジェクトのインスタンス辞書に値が" +"ある場合を除き、属性へのアクセスはデスクリプタオブジェクト自身を返します。\n" +":meth:`!__set__` または :meth:`!__delete__` が定義されていればデータデスクリ" +"プタ、どちらも定義されていなければ非データデスクリプタです。\n" +"通常、データデスクリプタは :meth:`!__get__` と :meth:`!__set__` の両方を定義" +"し、非データデスクリプタは :meth:`!__get__` メソッドだけを持ちます。\n" +":meth:`!__get__` と、:meth:`!__set__` または :meth:`!__delete__` を定義した" +"データデスクリプタは、インスタンス辞書での再定義よりも常に優先されます。\n" +"一方、非データデスクリプタはインスタンスでオーバーライドできます。" #: ../../reference/datamodel.rst:2534 msgid "" @@ -3417,9 +3832,8 @@ msgstr "" "宣言された変数に必要な記憶領域を確保し、:attr:`~object.__dict__` と " "*__weakref__* が自動的に生成されないようにします。" -#: ../../reference/datamodel.rst:2567 msgid "Notes on using *__slots__*:" -msgstr "" +msgstr "*__slots__* を使う際の注意点。" #: ../../reference/datamodel.rst:2569 msgid "" @@ -3468,7 +3882,6 @@ msgstr "" "インスタンス変数のデフォルト値はクラス属性を使って設定できなくなっています; " "そうしないと、デスクリプタによる代入をクラス属性が上書きしてしまうからです。" -#: ../../reference/datamodel.rst:2592 msgid "" "The action of a *__slots__* declaration is not limited to the class where it " "is defined. *__slots__* declared in parents are available in child classes. " @@ -3476,6 +3889,12 @@ msgid "" "and *__weakref__* unless the subclass also defines *__slots__* (which should " "only contain names of any *additional* slots)." msgstr "" +"*__slots__* 宣言の効果は、定義されたクラスだけに限りません。\n" +"親クラスで宣言した *__slots__* は子クラスでも使えます。\n" +"ただし、サブクラスも *__slots__* を定義しない限り、そのインスタンスには :" +"attr:`~object.__dict__` と *__weakref__* が作られます。\n" +"サブクラスの *__slots__* には、*追加する* スロットの名前だけを含めてくださ" +"い。" #: ../../reference/datamodel.rst:2598 msgid "" @@ -3499,23 +3918,29 @@ msgid "" "`tuple`." msgstr "" -#: ../../reference/datamodel.rst:2608 msgid "Any non-string :term:`iterable` may be assigned to *__slots__*." msgstr "" +"*__slots__* には、文字列以外の任意の :term:`イテラブル ` を代入でき" +"ます。" -#: ../../reference/datamodel.rst:2610 msgid "" "If a :class:`dictionary ` is used to assign *__slots__*, the " "dictionary keys will be used as the slot names. The values of the dictionary " "can be used to provide per-attribute docstrings that will be recognised by :" "func:`inspect.getdoc` and displayed in the output of :func:`help`." msgstr "" +"*__slots__* に :class:`辞書 ` を代入すると、そのキーがスロット名として" +"使われます。\n" +"辞書の値で属性ごとのドキュメンテーション文字列を指定できます。\n" +"これらは :func:`inspect.getdoc` に認識され、:func:`help` の出力に表示されま" +"す。" -#: ../../reference/datamodel.rst:2615 msgid "" ":attr:`~object.__class__` assignment works only if both classes have the " "same *__slots__*." msgstr "" +":attr:`~object.__class__` への代入は、両方のクラスが同じ *__slots__* を持つ場" +"合にのみ機能します。" #: ../../reference/datamodel.rst:2618 msgid "" @@ -3569,15 +3994,18 @@ msgstr "" "*cls* は新しいサブクラスです。もし、このメソッドがインスタンスメソッドとして" "定義されると、暗黙的にクラスメソッドに変換されます。" -#: ../../reference/datamodel.rst:2647 msgid "" "Keyword arguments which are given to a new class are passed to the parent " "class's ``__init_subclass__``. For compatibility with other classes using " "``__init_subclass__``, one should take out the needed keyword arguments and " "pass the others over to the base class, as in::" msgstr "" +"新しいクラスに指定したキーワード引数は、親クラスの ``__init_subclass__`` に渡" +"されます。\n" +"``__init_subclass__`` を使うほかのクラスと互換性を保つには、必要なキーワード" +"引数だけを取り出し、残りを基底クラスに渡してください。\n" +"例えば次のようにします。 ::" -#: ../../reference/datamodel.rst:2653 msgid "" "class Philosopher:\n" " def __init_subclass__(cls, /, default_name, **kwargs):\n" @@ -3587,6 +4015,13 @@ msgid "" "class AustralianPhilosopher(Philosopher, default_name=\"Bruce\"):\n" " pass" msgstr "" +"class Philosopher:\n" +" def __init_subclass__(cls, /, default_name, **kwargs):\n" +" super().__init_subclass__(**kwargs)\n" +" cls.default_name = default_name\n" +"\n" +"class AustralianPhilosopher(Philosopher, default_name=\"Bruce\"):\n" +" pass" #: ../../reference/datamodel.rst:2661 msgid "" @@ -3614,28 +4049,29 @@ msgid "" "makes callbacks to those with a :meth:`~object.__set_name__` hook." msgstr "" -#: ../../reference/datamodel.rst:2679 msgid "" "Automatically called at the time the owning class *owner* is created. The " "object has been assigned to *name* in that class::" msgstr "" -"オーナーとなるクラス *owner* が作成された時点で自動的に呼び出されます。\n" -"オブジェクトはそのクラスの *name* に割り当てられます。" +"オーナークラス *owner* が作成される際に自動的に呼び出されます。\n" +"オブジェクトは、そのクラス内で *name* に代入されています。 ::" -#: ../../reference/datamodel.rst:2682 msgid "" "class A:\n" " x = C() # Automatically calls: x.__set_name__(A, 'x')" msgstr "" +"class A:\n" +" x = C() # 自動的に x.__set_name__(A, 'x') が呼び出される" -#: ../../reference/datamodel.rst:2685 msgid "" "If the class variable is assigned after the class is created, :meth:" "`__set_name__` will not be called automatically. If needed, :meth:" "`__set_name__` can be called directly::" msgstr "" +"クラスを作成した後でクラス変数を代入した場合、:meth:`__set_name__` は自動的に" +"は呼び出されません。\n" +"必要であれば :meth:`__set_name__` を直接呼び出せます。 ::" -#: ../../reference/datamodel.rst:2689 msgid "" "class A:\n" " pass\n" @@ -3644,6 +4080,12 @@ msgid "" "A.x = c # The hook is not called\n" "c.__set_name__(A, 'x') # Manually invoke the hook" msgstr "" +"class A:\n" +" pass\n" +"\n" +"c = C()\n" +"A.x = c # フックは呼び出されない\n" +"c.__set_name__(A, 'x') # フックを手動で呼び出す" #: ../../reference/datamodel.rst:2696 msgid "See :ref:`class-object-creation` for more details." @@ -3676,7 +4118,6 @@ msgstr "" "次の例で ``MyClass`` と ``MySubclass`` は両方とも ``Meta`` のインスタンスで" "す::" -#: ../../reference/datamodel.rst:2720 msgid "" "class Meta(type):\n" " pass\n" @@ -3687,6 +4128,14 @@ msgid "" "class MySubclass(MyClass):\n" " pass" msgstr "" +"class Meta(type):\n" +" pass\n" +"\n" +"class MyClass(metaclass=Meta):\n" +" pass\n" +"\n" +"class MySubclass(MyClass):\n" +" pass" #: ../../reference/datamodel.rst:2729 msgid "" @@ -3724,7 +4173,6 @@ msgstr "クラスオブジェクトが作られる。" msgid "Resolving MRO entries" msgstr "MRO エントリの解決" -#: ../../reference/datamodel.rst:2746 msgid "" "If a base that appears in a class definition is not an instance of :class:" "`type`, then an :meth:`!__mro_entries__` method is searched on the base. If " @@ -3735,32 +4183,36 @@ msgid "" "the base. The returned tuple may be empty: in these cases, the original base " "is ignored." msgstr "" +"クラス定義に現れる基底が :class:`type` のインスタンスではない場合、その基底" +"の :meth:`!__mro_entries__` メソッドが検索されます。\n" +":meth:`!__mro_entries__` メソッドが見つかれば、クラス作成時に、その基底は :" +"meth:`!__mro_entries__` を呼び出した結果に置き換えられます。\n" +"このメソッドの *bases* 引数には元の基底のタプルが渡され、その基底の代わりに使" +"うクラスのタプルを返す必要があります。\n" +"空のタプルを返しても構いません。\n" +"その場合、元の基底は無視されます。" -#: ../../reference/datamodel.rst:2757 msgid ":func:`types.resolve_bases`" -msgstr "" +msgstr ":func:`types.resolve_bases`" -#: ../../reference/datamodel.rst:2758 msgid "Dynamically resolve bases that are not instances of :class:`type`." -msgstr "" +msgstr ":class:`type` のインスタンスではない基底を動的に解決します。" -#: ../../reference/datamodel.rst:2760 msgid ":func:`types.get_original_bases`" -msgstr "" +msgstr ":func:`types.get_original_bases`" -#: ../../reference/datamodel.rst:2761 msgid "" "Retrieve a class's \"original bases\" prior to modifications by :meth:" "`~object.__mro_entries__`." msgstr "" +":meth:`~object.__mro_entries__` による変更前の、クラスの「元の基底」を取得し" +"ます。" -#: ../../reference/datamodel.rst:2764 msgid ":pep:`560`" -msgstr "" +msgstr ":pep:`560`" -#: ../../reference/datamodel.rst:2765 msgid "Core support for typing module and generic types." -msgstr "" +msgstr "typing モジュールとジェネリック型のための中核的なサポート。" #: ../../reference/datamodel.rst:2769 msgid "Determining the appropriate metaclass" @@ -3812,7 +4264,6 @@ msgstr "" msgid "Preparing the class namespace" msgstr "クラスの名前空間の準備" -#: ../../reference/datamodel.rst:2796 msgid "" "Once the appropriate metaclass has been identified, then the class namespace " "is prepared. If the metaclass has a ``__prepare__`` attribute, it is called " @@ -3823,13 +4274,14 @@ msgid "" "``__new__``, but when the final class object is created the namespace is " "copied into a new ``dict``." msgstr "" -"適切なメタクラスが指定されると、クラスの名前空間が用意されます。もしメタクラ" -"スが ``__prepare__`` 属性を持っている場合、 ``namespace = metaclass." -"__prepare__(name, bases, **kwds)`` が呼ばれます。追加のキーワード引数は、もし" -"クラス定義にあれば設定されます。 ``__prepare__`` メソッドは :func:`クラスメ" -"ソッド ` として実装する必要があります。 ``__prepare__`` が作成し" -"て返した名前空間は ``__new__`` に渡されますが、最終的なクラスオブジェクトは新" -"しい ``dict`` にコピーして作成されます。" +"適切なメタクラスが決まると、クラスの名前空間が準備されます。\n" +"メタクラスに ``__prepare__`` 属性があれば、``namespace = metaclass." +"__prepare__(name, bases, **kwds)`` として呼び出されます。\n" +"追加のキーワード引数は、クラス定義で指定されたものです。\n" +"``__prepare__`` メソッドは :func:`クラスメソッド ` として実装す" +"る必要があります。\n" +"返された名前空間は ``__new__`` に渡されますが、最終的なクラスオブジェクトが作" +"成される際には、その名前空間が新しい ``dict`` にコピーされます。" #: ../../reference/datamodel.rst:2805 msgid "" @@ -3911,7 +4363,6 @@ msgstr "" "`super` の無引数形式がレキシカルスコープに基づいて定義されているクラスを正確" "に識別することを可能にします。" -#: ../../reference/datamodel.rst:2857 msgid "" "In CPython 3.6 and later, the ``__class__`` cell is passed to the metaclass " "as a ``__classcell__`` entry in the class namespace. If present, this must " @@ -3919,11 +4370,11 @@ msgid "" "initialised correctly. Failing to do so will result in a :exc:`RuntimeError` " "in Python 3.8." msgstr "" -"CPython 3.6 以降では、 ``__class__`` セルは、クラス名前空間にある " +"CPython 3.6 以降では、``__class__`` セルはクラスの名前空間の " "``__classcell__`` エントリーとしてメタクラスに渡されます。\n" -"``__class__`` セルが存在していた場合は、そのクラスが正しく初期化されるため" -"に、 ``type.__new__`` の呼び出しに到達するまで上に伝搬されます。\n" -"失敗した場合は、Python 3.8 では :exc:`RuntimeError` になります。" +"このエントリーがある場合、クラスを正しく初期化するには ``type.__new__`` の呼" +"び出しまで引き継がなければなりません。\n" +"引き継がないと、Python 3.8 では :exc:`RuntimeError` が発生します。" #: ../../reference/datamodel.rst:2863 msgid "" @@ -3935,21 +4386,19 @@ msgstr "" "メタクラスを使っているときは、クラスオブジェクトを作成した後に次のカスタム化" "の手順が起動されます:" -#: ../../reference/datamodel.rst:2867 msgid "" "The ``type.__new__`` method collects all of the attributes in the class " "namespace that define a :meth:`~object.__set_name__` method;" msgstr "" -"``type.__new__`` メソッドが :meth:`~object.__set_name__` が定義されているクラ" -"スの名前空間にある全ての属性を収集します;" +"``type.__new__`` メソッドが、クラスの名前空間にある属性のうち :meth:`~object." +"__set_name__` メソッドを定義しているものをすべて集めます。" -#: ../../reference/datamodel.rst:2869 msgid "" "Those ``__set_name__`` methods are called with the class being defined and " "the assigned name of that particular attribute;" msgstr "" -"それらの ``__set_name__`` メソッドが、そのメソッドが定義されているクラス、お" -"よびそこに属する属性に割り当てられている名前を引数として呼び出されます;" +"それらの ``__set_name__`` メソッドが、作成中のクラスと、それぞれの属性に割り" +"当てられた名前を引数として呼び出されます。" #: ../../reference/datamodel.rst:2871 msgid "" @@ -3969,13 +4418,17 @@ msgstr "" "タ (もしあれば) にクラスオブジェクトが渡され、デコレータが返すオブジェクトが" "ここで定義されたクラスとしてローカルの名前空間に束縛されます。" -#: ../../reference/datamodel.rst:2878 msgid "" "When a new class is created by ``type.__new__``, the object provided as the " "namespace parameter is copied to a new ordered mapping and the original " "object is discarded. The new copy is wrapped in a read-only proxy, which " "becomes the :attr:`~type.__dict__` attribute of the class object." msgstr "" +"``type.__new__`` で新しいクラスを作成すると、``namespace`` 引数に渡したオブ" +"ジェクトは新しい順序付きマッピングにコピーされ、元のオブジェクトは破棄されま" +"す。\n" +"コピーは読み取り専用のプロキシでラップされ、クラスオブジェクトの :attr:" +"`~type.__dict__` 属性になります。" #: ../../reference/datamodel.rst:2885 msgid ":pep:`3135` - New super" @@ -4001,9 +4454,8 @@ msgstr "" "動プロパティ生成、プロキシ、フレームワーク、そして自動リソースロック/同期と" "いったものがあります。" -#: ../../reference/datamodel.rst:2899 msgid "Customizing instance and subclass checks" -msgstr "インスタンスのカスタマイズとサブクラスチェック" +msgstr "インスタンス判定とサブクラス判定のカスタマイズ" #: ../../reference/datamodel.rst:2901 msgid "" @@ -4044,23 +4496,21 @@ msgstr "" "true を返します。定義されていれば、 ``issubclass(subclass, class)`` の実装の" "ために呼び出されます。" -#: ../../reference/datamodel.rst:2923 msgid "" "Note that these methods are looked up on the type (metaclass) of a class. " "They cannot be defined as class methods in the actual class. This is " "consistent with the lookup of special methods that are called on instances, " "only in this case the instance is itself a class." msgstr "" -"なお、これらのメソッドは、クラスの型 (メタクラス) 上で検索されます。実際のク" -"ラスにクラスメソッドとして定義することはできません。これは、インスタンスそれ" -"自体がクラスであるこの場合にのみ、インスタンスに呼び出される特殊メソッドの検" -"索と一貫しています。" +"これらのメソッドはクラスの型、つまりメタクラスで検索されます。\n" +"対象のクラス自身にクラスメソッドとして定義することはできません。\n" +"これはインスタンスに対して呼び出される特殊メソッドの検索と同じ規則であり、こ" +"の場合はインスタンス自身がクラスであるという違いだけです。" #: ../../reference/datamodel.rst:2930 msgid ":pep:`3119` - Introducing Abstract Base Classes" msgstr ":pep:`3119` - 抽象基底クラスの導入" -#: ../../reference/datamodel.rst:2931 msgid "" "Includes the specification for customizing :func:`isinstance` and :func:" "`issubclass` behavior through :meth:`~type.__instancecheck__` and :meth:" @@ -4068,40 +4518,47 @@ msgid "" "context of adding Abstract Base Classes (see the :mod:`abc` module) to the " "language." msgstr "" +":meth:`~type.__instancecheck__` と :meth:`~type.__subclasscheck__` を通じ" +"て、:func:`isinstance` と :func:`issubclass` の動作をカスタマイズするための仕" +"様を含みます。\n" +"また、言語に抽象基底クラスを追加するにあたり、この機能を導入する動機も説明し" +"ています (:mod:`abc` モジュールを参照)。" #: ../../reference/datamodel.rst:2939 msgid "Emulating generic types" msgstr "ジェネリック型をエミュレートする" -#: ../../reference/datamodel.rst:2941 msgid "" "When using :term:`type annotations`, it is often useful to " "*parameterize* a :term:`generic type` using Python's square-brackets " "notation. For example, the annotation ``list[int]`` might be used to signify " "a :class:`list` in which all the elements are of type :class:`int`." msgstr "" +":term:`型アノテーション ` を使うときは、角括弧の記法で :term:`" +"ジェネリック型 ` を *パラメータ化* すると便利なことがありま" +"す。\n" +"例えば ``list[int]`` というアノテーションは、すべての要素が :class:`int` 型で" +"ある :class:`list` を表すために使えます。" #: ../../reference/datamodel.rst:2948 msgid ":pep:`484` - Type Hints" msgstr ":pep:`484` - 型ヒント" -#: ../../reference/datamodel.rst:2949 msgid "Introducing Python's framework for type annotations" -msgstr "" +msgstr "Python の型アノテーションの枠組みの導入" -#: ../../reference/datamodel.rst:2951 msgid ":ref:`Generic Alias Types`" -msgstr "" +msgstr ":ref:`ジェネリックエイリアス型 `" -#: ../../reference/datamodel.rst:2952 msgid "Documentation for objects representing parameterized generic classes" -msgstr "" +msgstr "パラメータ化されたジェネリッククラスを表すオブジェクトのドキュメント" -#: ../../reference/datamodel.rst:2954 msgid "" ":ref:`Generics`, :ref:`user-defined generics` and :" "class:`typing.Generic`" msgstr "" +":ref:`Generics`、:ref:`ユーザー定義ジェネリック型 `、:" +"class:`typing.Generic`" #: ../../reference/datamodel.rst:2955 msgid "" @@ -4111,11 +4568,12 @@ msgstr "" "実行時にパラメータ設定が可能であり、かつ静的な型チェッカーが理解できるジェネ" "リッククラスを実装する方法のドキュメントです。" -#: ../../reference/datamodel.rst:2958 msgid "" "A class can *generally* only be parameterized if it defines the special " "class method ``__class_getitem__()``." msgstr "" +"*一般に*、クラスをパラメータ化できるのは、特殊クラスメソッド " +"``__class_getitem__()`` を定義している場合だけです。" #: ../../reference/datamodel.rst:2963 msgid "" @@ -4132,18 +4590,18 @@ msgid "" "`@classmethod` when it is defined." msgstr "" -#: ../../reference/datamodel.rst:2972 msgid "The purpose of *__class_getitem__*" -msgstr "" +msgstr "*__class_getitem__* の目的" -#: ../../reference/datamodel.rst:2974 msgid "" "The purpose of :meth:`~object.__class_getitem__` is to allow runtime " "parameterization of standard-library generic classes in order to more easily " "apply :term:`type hints` to these classes." msgstr "" +":meth:`~object.__class_getitem__` の目的は、標準ライブラリのジェネリッククラ" +"スを実行時にパラメータ化できるようにして、それらのクラスに :term:`型ヒント " +"` を簡単に適用できるようにすることです。" -#: ../../reference/datamodel.rst:2978 msgid "" "To implement custom generic classes that can be parameterized at runtime and " "understood by static type-checkers, users should either inherit from a " @@ -4151,20 +4609,26 @@ msgid "" "__class_getitem__`, or inherit from :class:`typing.Generic`, which has its " "own implementation of ``__class_getitem__()``." msgstr "" +"実行時にパラメータ化でき、静的型チェッカーが理解できる独自のジェネリッククラ" +"スを実装するには、:meth:`~object.__class_getitem__` を実装済みの標準ライブラ" +"リのクラスを継承するか、独自の ``__class_getitem__()`` 実装を持つ :class:" +"`typing.Generic` を継承してください。" -#: ../../reference/datamodel.rst:2984 msgid "" "Custom implementations of :meth:`~object.__class_getitem__` on classes " "defined outside of the standard library may not be understood by third-party " "type-checkers such as mypy. Using ``__class_getitem__()`` on any class for " "purposes other than type hinting is discouraged." msgstr "" +"標準ライブラリ以外で定義されたクラスで :meth:`~object.__class_getitem__` を独" +"自に実装すると、mypy などのサードパーティの型チェッカーが理解できない場合があ" +"ります。\n" +"どのクラスでも、型ヒント以外の目的で ``__class_getitem__()`` を使うことは推奨" +"されません。" -#: ../../reference/datamodel.rst:2994 msgid "*__class_getitem__* versus *__getitem__*" -msgstr "" +msgstr "*__class_getitem__* と *__getitem__* の違い" -#: ../../reference/datamodel.rst:2996 msgid "" "Usually, the :ref:`subscription` of an object using square " "brackets will call the :meth:`~object.__getitem__` instance method defined " @@ -4173,15 +4637,23 @@ msgid "" "instead. ``__class_getitem__()`` should return a :ref:`GenericAlias` object if it is properly defined." msgstr "" +"通常、角括弧を使ってオブジェクトに :ref:`添字を指定 ` すると、" +"そのオブジェクトのクラスで定義されたインスタンスメソッド :meth:`~object." +"__getitem__` が呼び出されます。\n" +"ただし、添字を指定するオブジェクト自体がクラスの場合は、代わりにクラスメソッ" +"ド :meth:`~object.__class_getitem__` が呼び出されることがあります。\n" +"``__class_getitem__()`` を適切に定義するには、:ref:`GenericAlias ` オブジェクトを返すようにします。" -#: ../../reference/datamodel.rst:3003 msgid "" "Presented with the :term:`expression` ``obj[x]``, the Python interpreter " "follows something like the following process to decide whether :meth:" "`~object.__getitem__` or :meth:`~object.__class_getitem__` should be called::" msgstr "" +":term:`式 ` ``obj[x]`` を処理するとき、Python インタープリタはお" +"おむね次の手順で :meth:`~object.__getitem__` と :meth:`~object." +"__class_getitem__` のどちらを呼び出すかを決めます。 ::" -#: ../../reference/datamodel.rst:3008 msgid "" "from inspect import isclass\n" "\n" @@ -4206,8 +4678,29 @@ msgid "" " f\"'{class_of_obj.__name__}' object is not subscriptable\"\n" " )" msgstr "" +"from inspect import isclass\n" +"\n" +"def subscribe(obj, x):\n" +" \"\"\"式 'obj[x]' の結果を返す\"\"\"\n" +"\n" +" class_of_obj = type(obj)\n" +"\n" +" # obj のクラスが __getitem__ を定義していれば、\n" +" # class_of_obj.__getitem__(obj, x) を呼び出す\n" +" if hasattr(class_of_obj, '__getitem__'):\n" +" return class_of_obj.__getitem__(obj, x)\n" +"\n" +" # そうでなく、obj がクラスで __class_getitem__ を定義していれば、\n" +" # obj.__class_getitem__(x) を呼び出す\n" +" elif isclass(obj) and hasattr(obj, '__class_getitem__'):\n" +" return obj.__class_getitem__(x)\n" +"\n" +" # それ以外の場合は例外を送出する\n" +" else:\n" +" raise TypeError(\n" +" f\"'{class_of_obj.__name__}' object is not subscriptable\"\n" +" )" -#: ../../reference/datamodel.rst:3031 msgid "" "In Python, all classes are themselves instances of other classes. The class " "of a class is known as that class's :term:`metaclass`, and most classes have " @@ -4216,8 +4709,13 @@ msgid "" "``dict[str, float]`` and ``tuple[str, bytes]`` all result in :meth:`~object." "__class_getitem__` being called::" msgstr "" +"Python ではすべてのクラス自体が別のクラスのインスタンスです。\n" +"クラスのクラスは :term:`メタクラス ` と呼ばれ、ほとんどのクラスの" +"メタクラスは :class:`type` クラスです。\n" +":class:`type` は :meth:`~object.__getitem__` を定義していないので、" +"``list[int]``、``dict[str, float]``、``tuple[str, bytes]`` といった式ではいず" +"れも :meth:`~object.__class_getitem__` が呼び出されます。 ::" -#: ../../reference/datamodel.rst:3038 msgid "" ">>> # list has class \"type\" as its metaclass, like most classes:\n" ">>> type(list)\n" @@ -4231,13 +4729,26 @@ msgid "" ">>> type(list[int])\n" "" msgstr "" +">>> # 他のほとんどのクラスと同様、list のメタクラスは \"type\":\n" +">>> type(list)\n" +"\n" +">>> type(dict) == type(list) == type(tuple) == type(str) == type(bytes)\n" +"True\n" +">>> # \"list[int]\" は \"list.__class_getitem__(int)\" を呼び出す\n" +">>> list[int]\n" +"list[int]\n" +">>> # list.__class_getitem__ は GenericAlias オブジェクトを返す:\n" +">>> type(list[int])\n" +"" -#: ../../reference/datamodel.rst:3050 msgid "" "However, if a class has a custom metaclass that defines :meth:`~object." "__getitem__`, subscribing the class may result in different behaviour. An " "example of this can be found in the :mod:`enum` module::" msgstr "" +"ただし、クラスのメタクラスが独自に :meth:`~object.__getitem__` を定義している" +"場合、そのクラスへの添字指定は異なる動作をすることがあります。\n" +":mod:`enum` モジュールにその例があります。 ::" #: ../../reference/datamodel.rst:3054 msgid "" @@ -4264,23 +4775,28 @@ msgid ":pep:`560` - Core Support for typing module and generic types" msgstr "" ":pep:`560` - typing モジュールとジェネリック型に対する言語コアによるサポート" -#: ../../reference/datamodel.rst:3074 msgid "" "Introducing :meth:`~object.__class_getitem__`, and outlining when a :ref:" "`subscription` results in ``__class_getitem__()`` being " "called instead of :meth:`~object.__getitem__`" msgstr "" +":meth:`~object.__class_getitem__` を導入し、:ref:`添字指定 ` " +"で :meth:`~object.__getitem__` の代わりに ``__class_getitem__()`` が呼び出さ" +"れる条件を説明しています。" #: ../../reference/datamodel.rst:3082 msgid "Emulating callable objects" msgstr "呼び出し可能オブジェクトをエミュレートする" -#: ../../reference/datamodel.rst:3089 msgid "" "Called when the instance is \"called\" as a function; if this method is " "defined, ``x(arg1, arg2, ...)`` roughly translates to ``type(x).__call__(x, " "arg1, ...)``. The :class:`object` class itself does not provide this method." msgstr "" +"インスタンスが関数として「呼び出された」ときに呼び出されます。\n" +"このメソッドが定義されている場合、``x(arg1, arg2, ...)`` はおおむね " +"``type(x).__call__(x, arg1, ...)`` に置き換えられます。\n" +":class:`object` クラス自体はこのメソッドを提供しません。" #: ../../reference/datamodel.rst:3097 msgid "Emulating container types" @@ -4323,15 +4839,17 @@ msgid "" "should iterate through the values." msgstr "" -#: ../../reference/datamodel.rst:3141 msgid "" "Called to implement the built-in function :func:`len`. Should return the " "length of the object, an integer ``>=`` 0. Also, an object that doesn't " "define a :meth:`~object.__bool__` method and whose :meth:`!__len__` method " "returns zero is considered to be false in a Boolean context." msgstr "" +"組み込み関数 :func:`len` を実装するために呼び出されます。\n" +"オブジェクトの長さを ``>=`` 0 の整数で返す必要があります。\n" +"また、:meth:`~object.__bool__` メソッドを定義しておらず、:meth:`!__len__` メ" +"ソッドがゼロを返すオブジェクトは、真偽値を求める文脈では偽とみなされます。" -#: ../../reference/datamodel.rst:3148 msgid "" "In CPython, the length is required to be at most :data:`sys.maxsize`. If the " "length is larger than :data:`!sys.maxsize` some features (such as :func:" @@ -4339,8 +4857,12 @@ msgid "" "OverflowError` by truth value testing, an object must define a :meth:" "`~object.__bool__` method." msgstr "" +"CPython では長さは :data:`sys.maxsize` 以下でなければなりません。\n" +"長さが :data:`!sys.maxsize` より大きいと、:func:`len` などの機能が :exc:" +"`OverflowError` を送出する場合があります。\n" +"真偽値の判定で :exc:`!OverflowError` が送出されるのを防ぐには、オブジェクト" +"に :meth:`~object.__bool__` メソッドを定義する必要があります。" -#: ../../reference/datamodel.rst:3157 msgid "" "Called to implement :func:`operator.length_hint`. Should return an estimated " "length for the object (which may be greater or less than the actual length). " @@ -4349,6 +4871,14 @@ msgid "" "method didn't exist at all. This method is purely an optimization and is " "never required for correctness." msgstr "" +":func:`operator.length_hint` を実装するために呼び出されます。\n" +"オブジェクトの推定の長さを返す必要があります (実際の長さより大きくても小さく" +"ても構いません)。\n" +"長さは ``>=`` 0 の整数でなければなりません。\n" +":data:`NotImplemented` を返すこともでき、その場合は ``__length_hint__`` メ" +"ソッドが存在しない場合と同じように扱われます。\n" +"このメソッドは最適化のためだけのもので、正しく動作するために必要になることは" +"ありません。" #: ../../reference/datamodel.rst:3171 msgid "" @@ -4357,17 +4887,15 @@ msgstr "" "スライシングは、以下の 3 メソッドによって排他的に行われます。次のような呼び出" "しは ::" -#: ../../reference/datamodel.rst:3173 msgid "a[1:2] = b" -msgstr "" +msgstr "a[1:2] = b" #: ../../reference/datamodel.rst:3175 msgid "is translated to ::" msgstr "次のように翻訳され ::" -#: ../../reference/datamodel.rst:3177 msgid "a[slice(1, 2, None)] = b" -msgstr "" +msgstr "a[slice(1, 2, None)] = b" #: ../../reference/datamodel.rst:3179 msgid "and so forth. Missing slice items are always filled in with ``None``." @@ -4526,7 +5054,6 @@ msgstr "" "(非整数の数値に対するビット単位演算など) は、未定義のままにしておかなければな" "りません。" -#: ../../reference/datamodel.rst:3300 msgid "" "These methods are called to implement the binary arithmetic operations " "(``+``, ``-``, ``*``, ``@``, ``/``, ``//``, ``%``, :func:`divmod`, :func:" @@ -4539,14 +5066,24 @@ msgid "" "optional third argument if the three-argument version of the built-in :func:" "`pow` function is to be supported." msgstr "" +"これらのメソッドは二項算術演算 (``+``、``-``、``*``、``@``、``/``、``//``、" +"``%``、:func:`divmod`、:func:`pow`、``**``、``<<``、``>>``、``&``、``^``、``|" +"``) を実装するために呼び出されます。\n" +"例えば *x* が :meth:`__add__` メソッドを持つクラスのインスタンスの場合、式 " +"``x + y`` を評価するために ``type(x).__add__(x, y)`` が呼び出されます。\n" +":meth:`__divmod__` メソッドは :meth:`__floordiv__` と :meth:`__mod__` を使う" +"のと同等の動作をするべきで、:meth:`__truediv__` とは関係づけるべきではありま" +"せん。\n" +"組み込みの :func:`pow` 関数の 3 引数形式をサポートするには、:meth:`__pow__` " +"が省略可能な第 3 引数を受け取るように定義する必要があります。" -#: ../../reference/datamodel.rst:3311 msgid "" "If one of those methods does not support the operation with the supplied " "arguments, it should return :data:`NotImplemented`." msgstr "" +"これらのメソッドが、渡された引数に対する演算をサポートしていない場合は、:" +"data:`NotImplemented` を返す必要があります。" -#: ../../reference/datamodel.rst:3334 msgid "" "These methods are called to implement the binary arithmetic operations " "(``+``, ``-``, ``*``, ``@``, ``/``, ``//``, ``%``, :func:`divmod`, :func:" @@ -4559,22 +5096,35 @@ msgid "" "__rsub__(y, x)`` is called if ``type(x).__sub__(x, y)`` returns :data:" "`NotImplemented` or ``type(y)`` is a subclass of ``type(x)``. [#]_" msgstr "" +"これらのメソッドは、被演算子を反射 (交換) した二項算術演算 (``+``、``-``、" +"``*``、``@``、``/``、``//``、``%``、:func:`divmod`、:func:`pow`、``**``、" +"``<<``、``>>``、``&``、``^``、``|``) を実装するために呼び出されます。\n" +"呼び出されるのは被演算子の型が異なり、左側の被演算子が対応する演算をサポート" +"していない場合 [#]_、または右側の被演算子のクラスが左側の被演算子のクラスから" +"派生している場合だけです。[#]_\n" +"例えば *y* が :meth:`__rsub__` メソッドを持つクラスのインスタンスの場合、式 " +"``x - y`` の評価では、``type(x).__sub__(x, y)`` が :data:`NotImplemented` を" +"返すか、``type(y)`` が ``type(x)`` のサブクラスであれば、``type(y)." +"__rsub__(y, x)`` が呼び出されます。[#]_" -#: ../../reference/datamodel.rst:3345 msgid "" "Note that :meth:`__rpow__` should be defined to accept an optional third " "argument if the three-argument version of the built-in :func:`pow` function " "is to be supported." msgstr "" +"組み込みの :func:`pow` 関数の 3 引数形式をサポートするには、:meth:`__rpow__` " +"が省略可能な第 3 引数を受け取るように定義する必要があります。" -#: ../../reference/datamodel.rst:3351 msgid "" "Three-argument :func:`pow` now try calling :meth:`~object.__rpow__` if " "necessary. Previously it was only called in two-argument :func:`!pow` and " "the binary power operator." msgstr "" +"3 引数形式の :func:`pow` でも、必要に応じて :meth:`~object.__rpow__` の呼び出" +"しを試みるようになりました。\n" +"以前は 2 引数形式の :func:`!pow` と二項の累乗演算子でのみ呼び出されていまし" +"た。" -#: ../../reference/datamodel.rst:3357 msgid "" "If the right operand's type is a subclass of the left operand's type and " "that subclass provides a different implementation of the reflected method " @@ -4582,12 +5132,11 @@ msgid "" "reflected method. This behavior allows subclasses to override their " "ancestors' operations." msgstr "" -"右側の被演算子の型が左側の被演算子の型のサブクラスであり、このサブクラスであ" -"るメソッドに対する反射メソッドと異なる実装が定義されている場合には、左側の被" -"演算子の非反射メソッドが呼ばれる前に、このメソッドが呼ばれます。この振る舞い" -"により、サブクラスが親の演算をオーバーライドすることが可能になります。" +"右側の被演算子の型が左側の被演算子の型のサブクラスで、そのサブクラスが演算の" +"反射メソッドを異なる実装で定義している場合は、左側の被演算子の非反射メソッド" +"より先に、その反射メソッドが呼び出されます。\n" +"この動作によってサブクラスは親クラスの演算をオーバーライドできます。" -#: ../../reference/datamodel.rst:3377 msgid "" "These methods are called to implement the augmented arithmetic assignments " "(``+=``, ``-=``, ``*=``, ``@=``, ``/=``, ``//=``, ``%=``, ``**=``, ``<<=``, " @@ -4604,6 +5153,20 @@ msgid "" "augmented-assignment-tuple-error`), but this behavior is in fact part of the " "data model." msgstr "" +"これらのメソッドは累算算術代入 (``+=``、``-=``、``*=``、``@=``、``/=``、``//" +"=``、``%=``、``**=``、``<<=``、``>>=``、``&=``、``^=``、``|=``) を実装するた" +"めに呼び出されます。\n" +"これらのメソッドはインプレースで演算 (*self* の変更) を試み、その結果を返す必" +"要があります (結果は *self* でも構いませんが、そうでなくても構いません)。\n" +"対応するメソッドが定義されていないか、そのメソッドが :data:`NotImplemented` " +"を返す場合、累算代入は通常のメソッドにフォールバックします。\n" +"例えば *x* が :meth:`__iadd__` メソッドを持つクラスのインスタンスなら、``x " +"+= y`` は ``x = x.__iadd__(y)`` と同等です。\n" +":meth:`__iadd__` が存在しないか、``x.__iadd__(y)`` が :data:`!" +"NotImplemented` を返す場合は、``x + y`` の評価と同様に ``x.__add__(y)`` と " +"``y.__radd__(x)`` の使用が検討されます。\n" +"状況によっては累算代入で予想外のエラーが起こることもありますが (:ref:`faq-" +"augmented-assignment-tuple-error` を参照)、この動作もデータモデルの一部です。" #: ../../reference/datamodel.rst:3400 msgid "" @@ -4661,10 +5224,11 @@ msgstr "" "は :class:`~numbers.Integral` (たいていは :class:`int`) に切り詰められたオブ" "ジェクトの値を返すべきです。" -#: ../../reference/datamodel.rst:3444 msgid "" ":func:`int` no longer delegates to the :meth:`~object.__trunc__` method." msgstr "" +":func:`int` は :meth:`~object.__trunc__` メソッドに処理を委譲しなくなりまし" +"た。" #: ../../reference/datamodel.rst:3451 msgid "With Statement Context Managers" @@ -4686,30 +5250,31 @@ msgstr "" "照)により起動されますが、これらのメソッドを直接呼び出すことで起動することも" "できます。" -#: ../../reference/datamodel.rst:3464 msgid "" "Typical uses of context managers include saving and restoring various kinds " "of global state, locking and unlocking resources, closing opened files, etc." msgstr "" -"コンテキストマネージャの代表的な使い方としては、様々なグローバル情報の保存お" -"よび更新、リソースのロックとアンロック、ファイルのオープンとクローズなどが挙" -"げられます。" +"コンテキストマネージャの代表的な用途には、さまざまなグローバル状態の保存と復" +"元、リソースのロックとアンロック、開いているファイルのクローズなどがありま" +"す。" -#: ../../reference/datamodel.rst:3467 msgid "" "For more information on context managers, see :ref:`typecontextmanager`. " "The :class:`object` class itself does not provide the context manager " "methods." msgstr "" +"コンテキストマネージャの詳細は :ref:`typecontextmanager` を参照してくださ" +"い。\n" +":class:`object` クラス自体はコンテキストマネージャのメソッドを提供しません。" -#: ../../reference/datamodel.rst:3473 msgid "" "Enter the runtime context related to this object. The :keyword:`with` " "statement will bind this method's return value to the target(s) specified in " "the :keyword:`!as` clause of the statement, if any." msgstr "" -"コンテキストマネージャのの入り口で実行される処理です。 :keyword:`with` 文は、" -"文の :keyword:`!as` 節で規定された値を返すこのメソッドを呼び出します。" +"このオブジェクトに関連する実行時コンテキストに入ります。\n" +":keyword:`with` 文に :keyword:`!as` 節がある場合、その節で指定された代入先に" +"このメソッドの戻り値が束縛されます。" #: ../../reference/datamodel.rst:3480 msgid "" @@ -4721,22 +5286,23 @@ msgstr "" "が終了した原因となった例外について説明しています。コンテキストが例外を送出せ" "ず終了した場合は、全ての引き数に :const:`None` が設定されます。" -#: ../../reference/datamodel.rst:3484 msgid "" "If an exception is supplied, and the method wishes to suppress the exception " "(i.e., prevent it from being propagated), it should return a true value. " "Otherwise, the exception will be processed normally upon exit from this " "method." msgstr "" -"もし、例外が送出され、かつメソッドが例外を抑制したい場合(すなわち、例外が伝" -"播されるのを防ぎたい場合)、このメソッドは True を返す必要があります。そうで" -"なければ、このメソッドの終了後、例外は通常通り伝播することになります。" +"例外が渡された場合に、その例外を抑制する (伝播を防ぐ) には、真となる値を返し" +"ます。\n" +"そうしなければ、このメソッドから抜ける際に例外が通常どおり処理されます。" -#: ../../reference/datamodel.rst:3488 msgid "" "Note that :meth:`~object.__exit__` methods should not reraise the passed-in " "exception; this is the caller's responsibility." msgstr "" +":meth:`~object.__exit__` メソッドでは、渡された例外を再送出してはいけませ" +"ん。\n" +"再送出は呼び出し側が行います。" #: ../../reference/datamodel.rst:3494 msgid ":pep:`343` - The \"with\" statement" @@ -4764,7 +5330,6 @@ msgstr "" "です。このようなパターンを利用するには、 *__match_args__* 属性をクラスに定義" "する必要があります。" -#: ../../reference/datamodel.rst:3511 msgid "" "This class variable can be assigned a tuple of strings. When this class is " "used in a class pattern with positional arguments, each positional argument " @@ -4772,10 +5337,10 @@ msgid "" "*__match_args__* as the keyword. The absence of this attribute is equivalent " "to setting it to ``()``." msgstr "" -"このクラス変数には文字列のタプルがアサイン可能です。このクラスがクラスパター" -"ンの位置引数の中で利用されると、それぞれの位置引数は対応する " -"*__match_args__* の中の値をキーワードとする、キーワード引数に変換されます。こ" -"の属性がない時は、 ``()`` が設定されているのと同義です。" +"このクラス変数には文字列のタプルを代入できます。\n" +"このクラスを位置引数付きのクラスパターンで使うと、各位置引数は、対応する " +"*__match_args__* の値をキーワードとするキーワード引数に変換されます。\n" +"この属性がない場合は ``()`` を設定した場合と同じです。" #: ../../reference/datamodel.rst:3517 msgid "" @@ -4800,25 +5365,27 @@ msgstr ":pep:`634` - 構造的パターンマッチ" msgid "The specification for the Python ``match`` statement." msgstr "``match`` 文の詳細。" -#: ../../reference/datamodel.rst:3534 msgid "Emulating buffer types" -msgstr "" +msgstr "バッファ型をエミュレートする" -#: ../../reference/datamodel.rst:3536 msgid "" "The :ref:`buffer protocol ` provides a way for Python objects " "to expose efficient access to a low-level memory array. This protocol is " "implemented by builtin types such as :class:`bytes` and :class:`memoryview`, " "and third-party libraries may define additional buffer types." msgstr "" +":ref:`バッファプロトコル ` は、Python オブジェクトが低レベルの" +"メモリ配列への効率的なアクセスを提供するための仕組みです。\n" +":class:`bytes` や :class:`memoryview` などの組み込み型がこのプロトコルを実装" +"しており、サードパーティのライブラリでも独自のバッファ型を定義できます。" -#: ../../reference/datamodel.rst:3541 msgid "" "While buffer types are usually implemented in C, it is also possible to " "implement the protocol in Python." msgstr "" +"バッファ型は通常 C で実装されますが、Python でもこのプロトコルを実装できま" +"す。" -#: ../../reference/datamodel.rst:3546 msgid "" "Called when a buffer is requested from *self* (for example, by the :class:" "`memoryview` constructor). The *flags* argument is an integer representing " @@ -4827,6 +5394,12 @@ msgid "" "convenient way to interpret the flags. The method must return a :class:" "`memoryview` object." msgstr "" +"*self* に対してバッファが要求されたとき (例えば :class:`memoryview` コンスト" +"ラクタから) に呼び出されます。\n" +"*flags* 引数は要求するバッファの種類を表す整数で、例えば返されるバッファを読" +"み取り専用にするか、書き込み可能にするかを指定します。\n" +"フラグを解釈するには :class:`inspect.BufferFlags` が便利です。\n" +"このメソッドは :class:`memoryview` オブジェクトを返さなければなりません。" #: ../../reference/datamodel.rst:3555 msgid "" @@ -4837,89 +5410,102 @@ msgid "" "to perform any cleanup are not required to implement this method." msgstr "" -#: ../../reference/datamodel.rst:3566 msgid ":pep:`688` - Making the buffer protocol accessible in Python" -msgstr "" +msgstr ":pep:`688` - バッファプロトコルを Python から利用可能にする" -#: ../../reference/datamodel.rst:3567 msgid "" "Introduces the Python ``__buffer__`` and ``__release_buffer__`` methods." msgstr "" +"Python の ``__buffer__`` メソッドと ``__release_buffer__`` メソッドを導入して" +"います。" -#: ../../reference/datamodel.rst:3569 msgid ":class:`collections.abc.Buffer`" -msgstr "" +msgstr ":class:`collections.abc.Buffer`" -#: ../../reference/datamodel.rst:3570 msgid "ABC for buffer types." -msgstr "" +msgstr "バッファ型の抽象基底クラス。" -#: ../../reference/datamodel.rst:3573 msgid "Annotations" -msgstr "" +msgstr "アノテーション" -#: ../../reference/datamodel.rst:3575 msgid "" "Functions, classes, and modules may contain :term:`annotations " "`, which are a way to associate information (usually :term:`type " "hints `) with a symbol." msgstr "" +"関数、クラス、モジュールは :term:`アノテーション ` を持つことがで" +"きます。\n" +"アノテーションは、シンボルに情報 (通常は :term:`型ヒント `) を関連" +"付ける仕組みです。" -#: ../../reference/datamodel.rst:3581 msgid "" "This attribute contains the annotations for an object. It is :ref:`lazily " "evaluated `, so accessing the attribute may execute " "arbitrary code and raise exceptions. If evaluation is successful, the " "attribute is set to a dictionary mapping from variable names to annotations." msgstr "" +"この属性はオブジェクトのアノテーションを保持します。\n" +":ref:`遅延評価 ` されるので、属性にアクセスすると任意のコー" +"ドが実行され、例外が送出される可能性があります。\n" +"評価が成功すると、変数名をアノテーションに対応付ける辞書がこの属性に設定され" +"ます。" -#: ../../reference/datamodel.rst:3586 msgid "Annotations are now lazily evaluated." -msgstr "" +msgstr "アノテーションが遅延評価されるようになりました。" -#: ../../reference/datamodel.rst:3591 msgid "" "An :term:`annotate function`. Returns a new dictionary object mapping " "attribute/parameter names to their annotation values." msgstr "" +":term:`アノテーション関数 `。\n" +"属性名や引数名をアノテーションの値に対応付ける新しい辞書オブジェクトを返しま" +"す。" -#: ../../reference/datamodel.rst:3594 msgid "" "Takes a format parameter specifying the format in which annotations values " "should be provided. It must be a member of the :class:`annotationlib.Format` " "enum, or an integer with a value corresponding to a member of the enum." msgstr "" +"アノテーションの値を提供する形式を指定する ``format`` 引数を受け取ります。\n" +"この引数は :class:`annotationlib.Format` 列挙型のメンバーか、そのメンバーに対" +"応する値の整数でなければなりません。" -#: ../../reference/datamodel.rst:3598 msgid "" "If an annotate function doesn't support the requested format, it must raise :" "exc:`NotImplementedError`. Annotate functions must always support :attr:" "`~annotationlib.Format.VALUE` format; they must not raise :exc:" "`NotImplementedError()` when called with this format." msgstr "" +"アノテーション関数が要求された形式をサポートしていない場合は、:exc:" +"`NotImplementedError` を送出しなければなりません。\n" +"アノテーション関数は常に :attr:`~annotationlib.Format.VALUE` 形式をサポート" +"し、この形式で呼び出されたときに :exc:`NotImplementedError()` を送出してはい" +"けません。" -#: ../../reference/datamodel.rst:3603 msgid "" "When called with :attr:`~annotationlib.Format.VALUE` format, an annotate " "function may raise :exc:`NameError`; it must not raise :exc:`!NameError` " "when called requesting any other format." msgstr "" +":attr:`~annotationlib.Format.VALUE` 形式で呼び出されたアノテーション関数は :" +"exc:`NameError` を送出することがありますが、それ以外の形式を要求されたときに" +"は :exc:`!NameError` を送出してはいけません。" -#: ../../reference/datamodel.rst:3606 msgid "" "If an object does not have any annotations, :attr:`~object.__annotate__` " "should preferably be set to ``None`` (it can’t be deleted), rather than set " "to a function that returns an empty dict." msgstr "" +"オブジェクトにアノテーションがない場合、:attr:`~object.__annotate__` には空の" +"辞書を返す関数よりも ``None`` を設定することが推奨されます (この属性は削除で" +"きません)。" -#: ../../reference/datamodel.rst:3613 msgid ":pep:`649` --- Deferred evaluation of annotation using descriptors" -msgstr "" +msgstr ":pep:`649` --- デスクリプタを使ったアノテーションの遅延評価" -#: ../../reference/datamodel.rst:3614 msgid "" "Introduces lazy evaluation of annotations and the ``__annotate__`` function." -msgstr "" +msgstr "アノテーションの遅延評価と ``__annotate__`` 関数を導入しています。" #: ../../reference/datamodel.rst:3620 msgid "Special method lookup" @@ -4936,7 +5522,6 @@ msgstr "" "ス辞書ではなく、オブジェクトの型で定義されているときにのみ正しく動作すること" "が保証されます。この動作のため、以下のコードは例外を送出します::" -#: ../../reference/datamodel.rst:3627 msgid "" ">>> class C:\n" "... pass\n" @@ -4948,6 +5533,15 @@ msgid "" " File \"\", line 1, in \n" "TypeError: object of type 'C' has no len()" msgstr "" +">>> class C:\n" +"... pass\n" +"...\n" +">>> c = C()\n" +">>> c.__len__ = lambda: 5\n" +">>> len(c)\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"TypeError: object of type 'C' has no len()" #: ../../reference/datamodel.rst:3637 msgid "" @@ -4963,7 +5557,6 @@ msgstr "" "使った場合、 type オブジェクト自体に対して実行されたときに失敗してしまいま" "す::" -#: ../../reference/datamodel.rst:3644 msgid "" ">>> 1 .__hash__() == hash(1)\n" "True\n" @@ -4972,6 +5565,12 @@ msgid "" " File \"\", line 1, in \n" "TypeError: descriptor '__hash__' of 'int' object needs an argument" msgstr "" +">>> 1 .__hash__() == hash(1)\n" +"True\n" +">>> int.__hash__() == hash(int)\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"TypeError: descriptor '__hash__' of 'int' object needs an argument" #: ../../reference/datamodel.rst:3651 msgid "" @@ -4983,13 +5582,16 @@ msgstr "" "confusion' と呼ばれることもあり、特殊メソッドを検索するときはインスタンスをバ" "イパスすることで回避されます::" -#: ../../reference/datamodel.rst:3655 msgid "" ">>> type(1).__hash__(1) == hash(1)\n" "True\n" ">>> type(int).__hash__(int) == hash(int)\n" "True" msgstr "" +">>> type(1).__hash__(1) == hash(1)\n" +"True\n" +">>> type(int).__hash__(int) == hash(int)\n" +"True" #: ../../reference/datamodel.rst:3660 msgid "" @@ -5001,7 +5603,6 @@ msgstr "" "ブジェクトのメタクラスを含めて、 :meth:`~object.__getattribute__` メソッドも" "バイパスします::" -#: ../../reference/datamodel.rst:3664 msgid "" ">>> class Meta(type):\n" "... def __getattribute__(*args):\n" @@ -5025,6 +5626,27 @@ msgid "" ">>> len(c) # Implicit lookup\n" "10" msgstr "" +">>> class Meta(type):\n" +"... def __getattribute__(*args):\n" +"... print(\"Metaclass getattribute invoked\")\n" +"... return type.__getattribute__(*args)\n" +"...\n" +">>> class C(object, metaclass=Meta):\n" +"... def __len__(self):\n" +"... return 10\n" +"... def __getattribute__(*args):\n" +"... print(\"Class getattribute invoked\")\n" +"... return object.__getattribute__(*args)\n" +"...\n" +">>> c = C()\n" +">>> c.__len__() # インスタンスを介した明示的な検索\n" +"Class getattribute invoked\n" +"10\n" +">>> type(c).__len__(c) # 型を介した明示的な検索\n" +"Metaclass getattribute invoked\n" +"10\n" +">>> len(c) # 暗黙の検索\n" +"10" #: ../../reference/datamodel.rst:3686 msgid "" @@ -5067,21 +5689,28 @@ msgstr "" "される :term:`generator iterator` オブジェクトも待機可能ですが、 :meth:" "`~object.__await__` は実装されていません。" -#: ../../reference/datamodel.rst:3715 msgid "" "Must return an :term:`iterator`. Should be used to implement :term:" "`awaitable` objects. For instance, :class:`asyncio.Future` implements this " "method to be compatible with the :keyword:`await` expression. The :class:" "`object` class itself is not awaitable and does not provide this method." msgstr "" +":term:`イテレータ ` を返さなければなりません。\n" +":term:`待機可能 ` オブジェクトを実装するために使います。\n" +"例えば :class:`asyncio.Future` は、:keyword:`await` 式に対応するためにこのメ" +"ソッドを実装しています。\n" +":class:`object` クラス自体は待機可能ではなく、このメソッドを提供しません。" -#: ../../reference/datamodel.rst:3723 msgid "" "The language doesn't place any restriction on the type or value of the " "objects yielded by the iterator returned by ``__await__``, as this is " "specific to the implementation of the asynchronous execution framework (e." "g. :mod:`asyncio`) that will be managing the :term:`awaitable` object." msgstr "" +"``__await__`` が返すイテレータが yield するオブジェクトの型や値について、言語" +"としての制約はありません。\n" +"これらは :term:`待機可能 ` オブジェクトを管理する非同期実行フレー" +"ムワーク (例えば :mod:`asyncio`) の実装に依存するためです。" #: ../../reference/datamodel.rst:3731 msgid ":pep:`492` for additional information about awaitable objects." @@ -5126,7 +5755,6 @@ msgid "It is a :exc:`RuntimeError` to await on a coroutine more than once." msgstr "" "コルーチンで2回以上待機 (await) すると :exc:`RuntimeError` となります。" -#: ../../reference/datamodel.rst:3757 msgid "" "Starts or resumes execution of the coroutine. If *value* is ``None``, this " "is equivalent to advancing the iterator returned by :meth:`~object." @@ -5136,8 +5764,14 @@ msgid "" "exception) is the same as when iterating over the :meth:`!__await__` return " "value, described above." msgstr "" +"コルーチンの実行を開始または再開します。\n" +"*value* が ``None`` の場合は、:meth:`~object.__await__` が返すイテレータを進" +"めるのと同じです。\n" +"*value* が ``None`` でない場合は、コルーチンを一時停止させたイテレータの :" +"meth:`~generator.send` メソッドに処理を委譲します。\n" +"結果 (戻り値、:exc:`StopIteration`、またはその他の例外) は、上で説明した :" +"meth:`!__await__` の戻り値に対して反復処理をした場合と同じです。" -#: ../../reference/datamodel.rst:3768 msgid "" "Raises the specified exception in the coroutine. This method delegates to " "the :meth:`~generator.throw` method of the iterator that caused the " @@ -5147,19 +5781,20 @@ msgid "" "meth:`~object.__await__` return value, described above. If the exception is " "not caught in the coroutine, it propagates back to the caller." msgstr "" -"コルーチンで指定された例外を送出します。\n" -"このメソッドは、イテレータにコルーチンを一時停止する :meth:`~generator." -"throw` メソッドがある場合に処理を委任します。\n" -"そうでない場合には、中断した地点から例外が送出されます。\n" -"結果 (返り値か :exc:`StopIteration` かその他の例外) は、上で解説したような :" -"meth:`~object.__await__` の返り値に対して反復処理を行ったときと同じです。\n" -"例外がコルーチンの中で捕捉されなかった場合、呼び出し元へ伝搬されます。" +"コルーチン内で指定された例外を送出します。\n" +"コルーチンを一時停止させたイテレータに :meth:`~generator.throw` メソッドがあ" +"る場合は、そのメソッドに処理を委譲します。\n" +"そうでなければ、一時停止した地点で例外を送出します。\n" +"結果 (戻り値、:exc:`StopIteration`、またはその他の例外) は、上で説明した :" +"meth:`~object.__await__` の戻り値に対して反復処理をした場合と同じです。\n" +"例外がコルーチン内で捕捉されなければ、呼び出し元に伝播します。" -#: ../../reference/datamodel.rst:3779 msgid "" "The second signature \\(type\\[, value\\[, traceback\\]\\]\\) is deprecated " "and may be removed in a future version of Python." msgstr "" +"2番目のシグネチャ \\(type\\[, value\\[, traceback\\]\\]\\) は非推奨となり、将" +"来のバージョンの Python で削除される可能性があります。" #: ../../reference/datamodel.rst:3784 msgid "" @@ -5202,9 +5837,8 @@ msgid "" "Asynchronous iterators can be used in an :keyword:`async for` statement." msgstr "非同期イテレータは :keyword:`async for` 文の中で使えます。" -#: ../../reference/datamodel.rst:3805 ../../reference/datamodel.rst:3854 msgid "The :class:`object` class itself does not provide these methods." -msgstr "" +msgstr ":class:`object` クラス自体はこれらのメソッドを提供しません。" #: ../../reference/datamodel.rst:3810 msgid "Must return an *asynchronous iterator* object." @@ -5222,7 +5856,6 @@ msgstr "" msgid "An example of an asynchronous iterable object::" msgstr "非同期イテラブルオブジェクトの例::" -#: ../../reference/datamodel.rst:3819 msgid "" "class Reader:\n" " async def readline(self):\n" @@ -5237,6 +5870,18 @@ msgid "" " raise StopAsyncIteration\n" " return val" msgstr "" +"class Reader:\n" +" async def readline(self):\n" +" ...\n" +"\n" +" def __aiter__(self):\n" +" return self\n" +"\n" +" async def __anext__(self):\n" +" val = await self.readline()\n" +" if val == b'':\n" +" raise StopAsyncIteration\n" +" return val" #: ../../reference/datamodel.rst:3834 msgid "" @@ -5276,23 +5921,24 @@ msgid "" msgstr "" "非同期コンテキストマネージャは :keyword:`async with` 文の中で使えます。" -#: ../../reference/datamodel.rst:3858 msgid "" "Semantically similar to :meth:`~object.__enter__`, the only difference being " "that it must return an *awaitable*." msgstr "" +"意味は :meth:`~object.__enter__` と同じですが、*待機可能オブジェクト* を返さ" +"なければならない点だけが異なります。" -#: ../../reference/datamodel.rst:3863 msgid "" "Semantically similar to :meth:`~object.__exit__`, the only difference being " "that it must return an *awaitable*." msgstr "" +"意味は :meth:`~object.__exit__` と同じですが、*待機可能オブジェクト* を返さな" +"ければならない点だけが異なります。" #: ../../reference/datamodel.rst:3866 msgid "An example of an asynchronous context manager class::" msgstr "非同期コンテキストマネージャクラスの例::" -#: ../../reference/datamodel.rst:3868 msgid "" "class AsyncContextManager:\n" " async def __aenter__(self):\n" @@ -5301,6 +5947,12 @@ msgid "" " async def __aexit__(self, exc_type, exc, tb):\n" " await log('exiting context')" msgstr "" +"class AsyncContextManager:\n" +" async def __aenter__(self):\n" +" await log('entering context')\n" +"\n" +" async def __aexit__(self, exc_type, exc, tb):\n" +" await log('exiting context')" #: ../../reference/datamodel.rst:3879 msgid "Footnotes" @@ -5316,7 +5968,6 @@ msgstr "" "* 。これは、正しく扱われなかった場合にとても奇妙な動作を引き起こすので、一般" "的には良い考えではありません。" -#: ../../reference/datamodel.rst:3884 msgid "" "The :meth:`~object.__hash__`, :meth:`~object.__iter__`, :meth:`~object." "__reversed__`, :meth:`~object.__contains__`, :meth:`~object." @@ -5324,28 +5975,41 @@ msgid "" "handling for this. Others will still raise a :exc:`TypeError`, but may do so " "by relying on the behavior that ``None`` is not callable." msgstr "" +":meth:`~object.__hash__`、:meth:`~object.__iter__`、:meth:`~object." +"__reversed__`、:meth:`~object.__contains__`、:meth:`~object." +"__class_getitem__`、:meth:`~os.PathLike.__fspath__` メソッドには、このための" +"特別な処理があります。\n" +"他のメソッドでも :exc:`TypeError` は送出されますが、``None`` が呼び出し可能で" +"ないという動作に依存して送出される場合があります。" -#: ../../reference/datamodel.rst:3891 msgid "" "\"Does not support\" here means that the class has no such method, or the " "method returns :data:`NotImplemented`. Do not set the method to ``None`` if " "you want to force fallback to the right operand's reflected method—that will " "instead have the opposite effect of explicitly *blocking* such fallback." msgstr "" +"ここで「サポートしていない」とは、クラスにそのメソッドがないか、メソッドが :" +"data:`NotImplemented` を返すことを意味します。\n" +"右側の被演算子の反射メソッドにフォールバックさせたい場合、メソッドを " +"``None`` に設定してはいけません。\n" +"そうすると逆に、そのフォールバックを明示的に *阻止* することになります。" -#: ../../reference/datamodel.rst:3897 msgid "" "For operands of the same type, it is assumed that if the non-reflected " "method (such as :meth:`~object.__add__`) fails then the operation is not " "supported, which is why the reflected method is not called." msgstr "" +"被演算子が同じ型の場合、:meth:`~object.__add__` などの非反射メソッドが失敗す" +"ると、その演算はサポートされていないとみなされます。\n" +"このため、反射メソッドは呼び出されません。" -#: ../../reference/datamodel.rst:3901 msgid "" "If the right operand's type is a subclass of the left operand's type, the " "reflected method having precedence allows subclasses to override their " "ancestors' operations." msgstr "" +"右側の被演算子の型が左側の被演算子の型のサブクラスの場合、反射メソッドが優先" +"されることで、サブクラスが親クラスの演算をオーバーライドできます。" #: ../../reference/datamodel.rst:14 ../../reference/datamodel.rst:152 #: ../../reference/datamodel.rst:163 ../../reference/datamodel.rst:187 @@ -5734,17 +6398,15 @@ msgstr "__code__ (関数属性)" msgid "__annotations__ (function attribute)" msgstr "__annotations__ (関数属性)" -#: ../../reference/datamodel.rst:577 msgid "__annotate__ (function attribute)" -msgstr "" +msgstr "__annotate__ (関数属性)" #: ../../reference/datamodel.rst:577 msgid "__kwdefaults__ (function attribute)" msgstr "__kwdefaults__ (関数属性)" -#: ../../reference/datamodel.rst:577 msgid "__type_params__ (function attribute)" -msgstr "" +msgstr "__type_params__ (関数属性)" #: ../../reference/datamodel.rst:675 ../../reference/datamodel.rst:837 msgid "method" @@ -5810,21 +6472,17 @@ msgstr "import" msgid "__name__ (module attribute)" msgstr "__name__ (モジュール属性)" -#: ../../reference/datamodel.rst:893 msgid "__spec__ (module attribute)" -msgstr "" +msgstr "__spec__ (モジュール属性)" -#: ../../reference/datamodel.rst:893 msgid "__package__ (module attribute)" -msgstr "" +msgstr "__package__ (モジュール属性)" -#: ../../reference/datamodel.rst:893 msgid "__loader__ (module attribute)" -msgstr "" +msgstr "__loader__ (モジュール属性)" -#: ../../reference/datamodel.rst:893 msgid "__path__ (module attribute)" -msgstr "" +msgstr "__path__ (モジュール属性)" #: ../../reference/datamodel.rst:893 msgid "__file__ (module attribute)" @@ -5838,13 +6496,11 @@ msgstr "" msgid "__doc__ (module attribute)" msgstr "__doc__ (モジュール属性)" -#: ../../reference/datamodel.rst:893 msgid "__annotations__ (module attribute)" -msgstr "" +msgstr "__annotations__ (モジュール属性)" -#: ../../reference/datamodel.rst:893 msgid "__annotate__ (module attribute)" -msgstr "" +msgstr "__annotate__ (モジュール属性)" #: ../../reference/datamodel.rst:1119 msgid "__dict__ (module attribute)" @@ -5890,25 +6546,20 @@ msgstr "__bases__ (クラス属性)" msgid "__doc__ (class attribute)" msgstr "__doc__ (クラス属性)" -#: ../../reference/datamodel.rst:1181 msgid "__annotations__ (class attribute)" -msgstr "" +msgstr "__annotations__ (クラス属性)" -#: ../../reference/datamodel.rst:1181 msgid "__annotate__ (class attribute)" -msgstr "" +msgstr "__annotate__ (クラス属性)" -#: ../../reference/datamodel.rst:1181 msgid "__type_params__ (class attribute)" -msgstr "" +msgstr "__type_params__ (クラス属性)" -#: ../../reference/datamodel.rst:1181 msgid "__static_attributes__ (class attribute)" -msgstr "" +msgstr "__static_attributes__ (クラス属性)" -#: ../../reference/datamodel.rst:1181 msgid "__firstlineno__ (class attribute)" -msgstr "" +msgstr "__firstlineno__ (クラス属性)" #: ../../reference/datamodel.rst:1337 msgid "__dict__ (instance attribute)" @@ -5986,13 +6637,11 @@ msgstr "コードオブジェクト" msgid "co_argcount (code object attribute)" msgstr "co_argcount (コードオブジェクトの属性)" -#: ../../reference/datamodel.rst:1409 msgid "co_posonlyargcount (code object attribute)" -msgstr "" +msgstr "co_posonlyargcount (コードオブジェクトの属性)" -#: ../../reference/datamodel.rst:1409 msgid "co_kwonlyargcount (code object attribute)" -msgstr "" +msgstr "co_kwonlyargcount (コードオブジェクトの属性)" #: ../../reference/datamodel.rst:1409 msgid "co_code (code object attribute)" @@ -6046,9 +6695,8 @@ msgstr "co_cellvars (コードオブジェクトの属性)" msgid "co_freevars (code object attribute)" msgstr "co_freevars (コードオブジェクトの属性)" -#: ../../reference/datamodel.rst:1409 msgid "co_qualname (code object attribute)" -msgstr "" +msgstr "co_qualname (コードオブジェクトの属性)" #: ../../reference/datamodel.rst:1522 msgid "documentation string" @@ -6086,13 +6734,11 @@ msgstr "f_builtins (フレーム属性)" msgid "f_trace (frame attribute)" msgstr "f_trace (フレーム属性)" -#: ../../reference/datamodel.rst:1664 msgid "f_trace_lines (frame attribute)" -msgstr "" +msgstr "f_trace_lines (フレーム属性)" -#: ../../reference/datamodel.rst:1664 msgid "f_trace_opcodes (frame attribute)" -msgstr "" +msgstr "f_trace_opcodes (フレーム属性)" #: ../../reference/datamodel.rst:1664 msgid "f_lineno (frame attribute)" @@ -6134,9 +6780,8 @@ msgstr "last_traceback (sys モジュール)" msgid "sys.exc_info" msgstr "sys.exc_info" -#: ../../reference/datamodel.rst:1724 msgid "sys.exception" -msgstr "" +msgstr "sys.exception" #: ../../reference/datamodel.rst:1724 msgid "sys.last_traceback" @@ -6206,9 +6851,8 @@ msgstr "コンストラクタ" msgid "destructor" msgstr "デストラクタ" -#: ../../reference/datamodel.rst:1943 msgid "finalizer" -msgstr "" +msgstr "ファイナライザ" #: ../../reference/datamodel.rst:1943 msgid "del" @@ -6258,17 +6902,14 @@ msgstr "hash" msgid "__len__() (mapping object method)" msgstr "__len__() (マップオブジェクトのメソッド)" -#: ../../reference/datamodel.rst:2335 msgid "__getattr__ (module attribute)" -msgstr "" +msgstr "__getattr__ (モジュール属性)" -#: ../../reference/datamodel.rst:2335 msgid "__dir__ (module attribute)" -msgstr "" +msgstr "__dir__ (モジュール属性)" -#: ../../reference/datamodel.rst:2335 msgid "__class__ (module attribute)" -msgstr "" +msgstr "__class__ (モジュール属性)" #: ../../reference/datamodel.rst:2706 msgid "metaclass" @@ -6278,29 +6919,23 @@ msgstr "metaclass" msgid "= (equals)" msgstr "= (等号)" -#: ../../reference/datamodel.rst:2706 msgid "class definition" -msgstr "" +msgstr "クラス定義" -#: ../../reference/datamodel.rst:2770 msgid "metaclass hint" -msgstr "" +msgstr "メタクラスのヒント" -#: ../../reference/datamodel.rst:2793 msgid "__prepare__ (metaclass method)" -msgstr "" +msgstr "__prepare__ (メタクラスのメソッド)" -#: ../../reference/datamodel.rst:2817 msgid "body" -msgstr "" +msgstr "本体" -#: ../../reference/datamodel.rst:2837 msgid "__class__ (method cell)" -msgstr "" +msgstr "__class__ (メソッドのセル)" -#: ../../reference/datamodel.rst:2837 msgid "__classcell__ (class namespace entry)" -msgstr "" +msgstr "__classcell__ (クラス名前空間のエントリー)" #: ../../reference/datamodel.rst:3137 msgid "__bool__() (object method)" diff --git a/reference/executionmodel.po b/reference/executionmodel.po index 0dd3d70a1..859d2ea47 100644 --- a/reference/executionmodel.po +++ b/reference/executionmodel.po @@ -19,10 +19,10 @@ msgstr "" "Last-Translator: tomo, 2023\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../reference/executionmodel.rst:6 @@ -91,9 +91,8 @@ msgstr "" msgid "The following constructs bind names:" msgstr "以下の構文が名前を束縛します:" -#: ../../reference/executionmodel.rst:61 msgid "formal parameters to functions," -msgstr "" +msgstr "関数の仮引数。" #: ../../reference/executionmodel.rst:62 msgid "class definitions," @@ -107,38 +106,35 @@ msgstr "関数定義," msgid "assignment expressions," msgstr "代入式," -#: ../../reference/executionmodel.rst:65 msgid "" ":ref:`targets ` that are identifiers if occurring in an " "assignment:" msgstr "" +":ref:`代入先 ` が識別子で、次の代入が行われる箇所にある場合。" -#: ../../reference/executionmodel.rst:68 msgid ":keyword:`for` loop header," -msgstr "" +msgstr ":keyword:`for` ループのヘッダー。" -#: ../../reference/executionmodel.rst:69 msgid "" "after :keyword:`!as` in a :keyword:`with` statement, :keyword:`except` " "clause, :keyword:`except* ` clause, or in the as-pattern in " "structural pattern matching," msgstr "" +":keyword:`with` 文、:keyword:`except` 節、:keyword:`except* ` 節" +"の :keyword:`!as` の後、または構造的パターンマッチングの as パターン内。" -#: ../../reference/executionmodel.rst:71 msgid "in a capture pattern in structural pattern matching" -msgstr "" +msgstr "構造的パターンマッチングのキャプチャパターン内。" #: ../../reference/executionmodel.rst:73 msgid ":keyword:`import` statements." msgstr ":keyword:`import` 文." -#: ../../reference/executionmodel.rst:74 msgid ":keyword:`type` statements." -msgstr "" +msgstr ":keyword:`type` 文。" -#: ../../reference/executionmodel.rst:75 msgid ":ref:`type parameter lists `." -msgstr "" +msgstr ":ref:`型パラメータのリスト `。" #: ../../reference/executionmodel.rst:77 msgid "" @@ -152,8 +148,8 @@ msgid "" "A target occurring in a :keyword:`del` statement is also considered bound " "for this purpose (though the actual semantics are to unbind the name)." msgstr "" -":keyword:`del` 文で指定される対象は、(:keyword:`del` の意味付けは、実際は名前" -"の解放 (unbind) ですが) 文の目的上、束縛済みのものとみなされます。" +":keyword:`del` 文で指定される対象は、(``del`` の意味付けは、実際は名前の解放 " +"(unbind) ですが) 文の目的上、束縛済みのものとみなされます。" #: ../../reference/executionmodel.rst:84 msgid "" @@ -163,7 +159,6 @@ msgstr "" "代入文や import 文はいずれも、クラスや関数定義、モジュールレベル (トップレベ" "ルのコードブロック) 内で起こります。" -#: ../../reference/executionmodel.rst:89 msgid "" "If a name is bound in a block, it is a local variable of that block, unless " "declared as :keyword:`nonlocal` or :keyword:`global`. If a name is bound at " @@ -171,15 +166,19 @@ msgid "" "code block are local and global.) If a variable is used in a code block but " "not defined there, it is a :term:`free variable`." msgstr "" +"名前がブロック内で束縛される場合、:keyword:`nonlocal` または :keyword:" +"`global` で宣言されていなければ、そのブロックのローカル変数です。\n" +"名前がモジュールレベルで束縛される場合はグローバル変数です (モジュールのコー" +"ドブロックの変数は、ローカル変数であると同時にグローバル変数でもあります)。\n" +"コードブロック内で使われていても、そこで定義されていない変数は :term:`自由変" +"数 ` です。" -#: ../../reference/executionmodel.rst:95 msgid "" "Each occurrence of a name in the program text refers to the :dfn:`binding` " "of that name established by the following name resolution rules." msgstr "" -"プログラムテキスト中に名前が出現するたびに、その名前が使われている最も内側の" -"関数ブロック中で作成された :dfn:`束縛 (binding)` を使って名前の参照が行われま" -"す。" +"プログラムのテキスト中に現れる各名前は、以下の名前解決規則によって定まる、そ" +"の名前の :dfn:`束縛 (binding)` を参照します。" #: ../../reference/executionmodel.rst:101 msgid "Resolution of names" @@ -224,7 +223,6 @@ msgstr "" "されていない場合、 :exc:`UnboundLocalError` 例外が送出されます。\n" ":exc:`UnboundLocalError` は :exc:`NameError` の子クラスです。" -#: ../../reference/executionmodel.rst:127 msgid "" "If a name binding operation occurs anywhere within a code block, all uses of " "the name within the block are treated as references to the current block. " @@ -235,13 +233,17 @@ msgid "" "the block for name binding operations. See :ref:`the FAQ entry on " "UnboundLocalError ` for examples." msgstr "" -"ある名前がコードブロック内のどこかで束縛操作されていたら、そのブロック内で使" -"われるその名前はすべて、現在のブロックへの参照として扱われます。このため、あ" -"る名前がそのブロック内で束縛される前に使われるとエラーにつながります。この規" -"則は敏感です。Python には宣言がなく、コードブロックのどこでも名前束縛操作がで" -"きます。あるコードブロックにおけるローカル変数は、ブロックのテキスト全体から" -"名前束縛操作を走査することで決定されます。例は :ref:`UnboundLocalError につい" -"ての FAQ 項目 ` を参照してください。" +"コードブロック内のどこかに名前の束縛操作があると、そのブロック内でのその名前" +"の使用はすべて、現在のブロックへの参照として扱われます。\n" +"そのため、束縛する前にその名前をブロック内で使うと、エラーにつながる場合があ" +"ります。\n" +"この規則は分かりにくい点に注意が必要です。\n" +"Python では変数の宣言は不要で、コードブロック内のどこでも名前を束縛できま" +"す。\n" +"ブロックのテキスト全体から名前の束縛操作を探すことで、そのブロックのローカル" +"変数を判断できます。\n" +"例は :ref:`UnboundLocalError についての FAQ 項目 ` を" +"参照してください。" #: ../../reference/executionmodel.rst:136 msgid "" @@ -267,7 +269,6 @@ msgstr "" "自由変数の最内スコープに global 文がある場合、その自由変数はグローバル変数と" "みなされます。" -#: ../../reference/executionmodel.rst:152 msgid "" "The :keyword:`nonlocal` statement causes corresponding names to refer to " "previously bound variables in the nearest enclosing function scope. :exc:" @@ -275,6 +276,12 @@ msgid "" "any enclosing function scope. :ref:`Type parameters ` cannot be " "rebound with the :keyword:`!nonlocal` statement." msgstr "" +":keyword:`nonlocal` 文は、指定された名前が、最も近い外側の関数スコープで以前" +"に束縛された変数を参照するようにします。\n" +"外側のどの関数スコープにもその名前がなければ、コンパイル時に :exc:" +"`SyntaxError` を送出します。\n" +":ref:`型パラメータ ` は :keyword:`!nonlocal` 文で再束縛できませ" +"ん。" #: ../../reference/executionmodel.rst:160 msgid "" @@ -285,7 +292,6 @@ msgstr "" "作成されます。スクリプトの主モジュール (main module) は常に :mod:`__main__` " "と呼ばれます。" -#: ../../reference/executionmodel.rst:163 msgid "" "Class definition blocks and arguments to :func:`exec` and :func:`eval` are " "special in the context of name resolution. A class definition is an " @@ -299,17 +305,29 @@ msgid "" "scopes>`, which have access to their enclosing class scopes. This means that " "the following will fail::" msgstr "" +"クラス定義のブロックと、:func:`exec` や :func:`eval` に渡す引数では、名前解決" +"に特別な規則があります。\n" +"クラス定義は実行可能な文で、名前を使ったり定義したりできます。\n" +"これらの参照は通常の名前解決規則に従いますが、束縛されていないローカル変数を" +"グローバル名前空間で探す点は例外です。\n" +"クラス定義の名前空間は、クラスの属性辞書になります。\n" +"クラスブロックで定義した名前のスコープはそのブロックに限られ、メソッドのコー" +"ドブロックには及びません。\n" +"内包表記やジェネレータ式も同様ですが、:ref:`アノテーションスコープ " +"` は例外で、外側のクラススコープにアクセスできます。\n" +"このため、次のコードは失敗します。 ::" -#: ../../reference/executionmodel.rst:176 msgid "" "class A:\n" " a = 42\n" " b = list(a + i for i in range(10))" msgstr "" +"class A:\n" +" a = 42\n" +" b = list(a + i for i in range(10))" -#: ../../reference/executionmodel.rst:180 msgid "However, the following will succeed::" -msgstr "" +msgstr "一方、次のコードは成功します。 ::" #: ../../reference/executionmodel.rst:182 msgid "" @@ -320,63 +338,63 @@ msgid "" "print(A.Alias.__value__) # " msgstr "" -#: ../../reference/executionmodel.rst:191 msgid "Annotation scopes" -msgstr "" +msgstr "アノテーションスコープ" -#: ../../reference/executionmodel.rst:193 msgid "" ":term:`Annotations `, :ref:`type parameter lists ` " "and :keyword:`type` statements introduce *annotation scopes*, which behave " "mostly like function scopes, but with some exceptions discussed below." msgstr "" +":term:`アノテーション `、:ref:`型パラメータのリスト `、:keyword:`type` 文は *アノテーションスコープ* を導入します。\n" +"その動作はおおむね関数スコープと同じですが、後述する例外があります。" -#: ../../reference/executionmodel.rst:198 msgid "Annotation scopes are used in the following contexts:" -msgstr "" +msgstr "アノテーションスコープは次の文脈で使われます。" -#: ../../reference/executionmodel.rst:200 msgid ":term:`Function annotations `." -msgstr "" +msgstr ":term:`関数アノテーション `。" -#: ../../reference/executionmodel.rst:201 msgid ":term:`Variable annotations `." -msgstr "" +msgstr ":term:`変数アノテーション `。" -#: ../../reference/executionmodel.rst:202 msgid "" "Type parameter lists for :ref:`generic type aliases `." msgstr "" +":ref:`ジェネリック型エイリアス ` の型パラメータのリス" +"ト。" -#: ../../reference/executionmodel.rst:203 msgid "" "Type parameter lists for :ref:`generic functions `. A " "generic function's annotations are executed within the annotation scope, but " "its defaults and decorators are not." msgstr "" +":ref:`ジェネリック関数 ` の型パラメータのリスト。\n" +"ジェネリック関数のアノテーションはアノテーションスコープ内で実行されますが、" +"デフォルト値やデコレータはその外で実行されます。" -#: ../../reference/executionmodel.rst:206 msgid "" "Type parameter lists for :ref:`generic classes `. A generic " "class's base classes and keyword arguments are executed within the " "annotation scope, but its decorators are not." msgstr "" +":ref:`ジェネリッククラス ` の型パラメータのリスト。\n" +"ジェネリッククラスの基底クラスとキーワード引数はアノテーションスコープ内で実" +"行されますが、デコレータはその外で実行されます。" -#: ../../reference/executionmodel.rst:209 msgid "" "The bounds, constraints, and default values for type parameters (:ref:" "`lazily evaluated `)." msgstr "" +"型パラメータの上限、制約、デフォルト値 (:ref:`遅延評価 `)。" -#: ../../reference/executionmodel.rst:211 msgid "The value of type aliases (:ref:`lazily evaluated `)." -msgstr "" +msgstr "型エイリアスの値 (:ref:`遅延評価 `)。" -#: ../../reference/executionmodel.rst:213 msgid "Annotation scopes differ from function scopes in the following ways:" -msgstr "" +msgstr "アノテーションスコープは、次の点で関数スコープと異なります。" -#: ../../reference/executionmodel.rst:215 msgid "" "Annotation scopes have access to their enclosing class namespace. If an " "annotation scope is immediately within a class scope, or within another " @@ -386,52 +404,66 @@ msgid "" "functions defined within classes, which cannot access names defined in the " "class scope." msgstr "" +"アノテーションスコープは、外側のクラスの名前空間にアクセスできます。\n" +"クラススコープの直下、またはクラススコープの直下にある別のアノテーションス" +"コープ内にアノテーションスコープがある場合、その中のコードは、クラス本体で直" +"接実行する場合と同様にクラススコープで定義された名前を使えます。\n" +"これは、クラス内で定義された通常の関数が、クラススコープで定義された名前にア" +"クセスできないこととは対照的です。" -#: ../../reference/executionmodel.rst:221 msgid "" "Expressions in annotation scopes cannot contain :keyword:`yield`, ``yield " "from``, :keyword:`await`, or :token:`:= ` expressions. (These expressions are allowed in other " "scopes contained within the annotation scope.)" msgstr "" +"アノテーションスコープ内の式には、:keyword:`yield`、``yield from``、:keyword:" +"`await`、:token:`:= ` の式を含められま" +"せん (アノテーションスコープ内にある別のスコープでは使えます)。" -#: ../../reference/executionmodel.rst:225 msgid "" "Names defined in annotation scopes cannot be rebound with :keyword:" "`nonlocal` statements in inner scopes. This includes only type parameters, " "as no other syntactic elements that can appear within annotation scopes can " "introduce new names." msgstr "" +"アノテーションスコープで定義された名前は、内側のスコープの :keyword:" +"`nonlocal` 文では再束縛できません。\n" +"アノテーションスコープ内に現れ得る構文要素のうち、新しい名前を導入できるのは" +"型パラメータだけなので、この制限の対象も型パラメータだけです。" -#: ../../reference/executionmodel.rst:228 msgid "" "While annotation scopes have an internal name, that name is not reflected in " "the :term:`qualified name` of objects defined within the scope. Instead, " "the :attr:`~definition.__qualname__` of such objects is as if the object " "were defined in the enclosing scope." msgstr "" +"アノテーションスコープには内部的な名前がありますが、その名前はスコープ内で定" +"義したオブジェクトの :term:`修飾名 ` には反映されません。\n" +"オブジェクトの :attr:`~definition.__qualname__` は、その外側のスコープで定義" +"した場合と同じになります。" -#: ../../reference/executionmodel.rst:233 msgid "Annotation scopes were introduced in Python 3.12 as part of :pep:`695`." msgstr "" +":pep:`695` の一部として、Python 3.12 でアノテーションスコープを導入しました。" -#: ../../reference/executionmodel.rst:236 msgid "" "Annotation scopes are also used for type parameter defaults, as introduced " "by :pep:`696`." msgstr "" +":pep:`696` で導入された型パラメータのデフォルト値にも、アノテーションスコープ" +"を使うようになりました。" -#: ../../reference/executionmodel.rst:240 msgid "" "Annotation scopes are now also used for annotations, as specified in :pep:" "`649` and :pep:`749`." msgstr "" +":pep:`649` と :pep:`749` の規定に従い、アノテーションにもアノテーションスコー" +"プを使うようになりました。" -#: ../../reference/executionmodel.rst:247 msgid "Lazy evaluation" -msgstr "" +msgstr "遅延評価" -#: ../../reference/executionmodel.rst:249 msgid "" "Most annotation scopes are *lazily evaluated*. This includes annotations, " "the values of type aliases created through the :keyword:`type` statement, " @@ -442,12 +474,19 @@ msgid "" "when necessary, for example when the ``__value__`` attribute on a type alias " "is accessed." msgstr "" +"ほとんどのアノテーションスコープは *遅延評価* されます。\n" +"これにはアノテーション、:keyword:`type` 文で作成した型エイリアスの値、:ref:`" +"型パラメータの構文 ` で作成した型変数の上限、制約、デフォルト値" +"が含まれます。\n" +"つまり、型エイリアスや型変数、またはアノテーションを持つオブジェクトを作成し" +"た時点では評価されません。\n" +"型エイリアスの ``__value__`` 属性にアクセスしたときなど、必要になった時点で初" +"めて評価されます。" #: ../../reference/executionmodel.rst:258 msgid "Example:" msgstr "例:" -#: ../../reference/executionmodel.rst:260 msgid "" ">>> type Alias = 1/0\n" ">>> Alias.__value__\n" @@ -461,21 +500,34 @@ msgid "" " ...\n" "ZeroDivisionError: division by zero" msgstr "" +">>> type Alias = 1/0\n" +">>> Alias.__value__\n" +"Traceback (most recent call last):\n" +" ...\n" +"ZeroDivisionError: division by zero\n" +">>> def func[T: 1/0](): pass\n" +">>> T = func.__type_params__[0]\n" +">>> T.__bound__\n" +"Traceback (most recent call last):\n" +" ...\n" +"ZeroDivisionError: division by zero" -#: ../../reference/executionmodel.rst:274 msgid "" "Here the exception is raised only when the ``__value__`` attribute of the " "type alias or the ``__bound__`` attribute of the type variable is accessed." msgstr "" +"この例では、型エイリアスの ``__value__`` 属性または型変数の ``__bound__`` 属" +"性にアクセスした時点で初めて例外を送出します。" -#: ../../reference/executionmodel.rst:278 msgid "" "This behavior is primarily useful for references to types that have not yet " "been defined when the type alias or type variable is created. For example, " "lazy evaluation enables creation of mutually recursive type aliases::" msgstr "" +"この動作は主に、型エイリアスや型変数の作成時点ではまだ定義されていない型を参" +"照する場合に役立ちます。\n" +"例えば、遅延評価によって相互に再帰する型エイリアスを作成できます。 ::" -#: ../../reference/executionmodel.rst:282 msgid "" "from typing import Literal\n" "\n" @@ -483,13 +535,21 @@ msgid "" "type Parenthesized = tuple[Literal[\"(\"], Expr, Literal[\")\"]]\n" "type Expr = SimpleExpr | tuple[SimpleExpr, Literal[\"+\", \"-\"], Expr]" msgstr "" +"from typing import Literal\n" +"\n" +"type SimpleExpr = int | Parenthesized\n" +"type Parenthesized = tuple[Literal[\"(\"], Expr, Literal[\")\"]]\n" +"type Expr = SimpleExpr | tuple[SimpleExpr, Literal[\"+\", \"-\"], Expr]" -#: ../../reference/executionmodel.rst:288 msgid "" "Lazily evaluated values are evaluated in :ref:`annotation scope `, which means that names that appear inside the lazily evaluated " "value are looked up as if they were used in the immediately enclosing scope." msgstr "" +"遅延評価される値は :ref:`アノテーションスコープ ` 内で評価" +"されます。\n" +"そのため、その値の中に現れる名前は、直近の外側のスコープで使われた場合と同じ" +"ように検索されます。" #: ../../reference/executionmodel.rst:297 msgid "Builtins and restricted execution" @@ -537,7 +597,6 @@ msgstr "" "自由変数の名前解決はコンパイル時でなく実行時に行われます。つまり、以下のコー" "ドは42を出力します::" -#: ../../reference/executionmodel.rst:325 msgid "" "i = 10\n" "def f():\n" @@ -545,6 +604,11 @@ msgid "" "i = 42\n" "f()" msgstr "" +"i = 10\n" +"def f():\n" +" print(i)\n" +"i = 42\n" +"f()" #: ../../reference/executionmodel.rst:333 msgid "" @@ -594,23 +658,21 @@ msgstr "" "Python インタプリタは、ランタイムエラー (ゼロ除算など) が検出されると例外を送" "出します。Python プログラムから、 :keyword:`raise` 文を使って明示的に例外を送" "出することもできます。例外ハンドラ (exception handler) は、 :keyword:" -"`try` ... :keyword:`except` 文で指定することができます。 :keyword:`try` 文" -"の :keyword:`finally` 節を使うとクリーンアップコード (cleanup code) を指定で" -"きます。このコードは例外は処理しませんが、先行するコードブロックで例外が起き" -"ても起きなくても実行されます。" +"`try` ... :keyword:`except` 文で指定することができます。 ``try`` 文の :" +"keyword:`finally` 節を使うとクリーンアップコード (cleanup code) を指定できま" +"す。このコードは例外は処理しませんが、先行するコードブロックで例外が起きても" +"起きなくても実行されます。" -#: ../../reference/executionmodel.rst:374 msgid "" "Python uses the \"termination\" model of error handling: an exception " "handler can find out what happened and continue execution at an outer level, " "but it cannot repair the cause of the error and retry the failing operation " "(except by re-entering the offending piece of code from the top)." msgstr "" -"Python は、エラー処理に \"プログラムの終了 (termination)\" モデルを用いていま" -"す: 例外ハンドラは、プログラムに何が発生したかを把握することができ、ハンドラ" -"の外側のレベルに処理を継続することはできますが、(問題のあったコード部分を最初" -"から実行しなおすのでない限り) エラーの原因を修復したり、実行に失敗した操作を" -"やり直すことはできません。" +"Python のエラー処理は「終了 (termination)」モデルを採用しています。\n" +"例外ハンドラは、何が起きたかを調べ、外側のレベルで実行を続けられます。\n" +"しかし、エラーの原因を修復して失敗した操作を再試行することはできません (問題" +"のあるコード部分に先頭から入り直す場合を除きます)。" #: ../../reference/executionmodel.rst:381 msgid "" @@ -710,9 +772,8 @@ msgstr "束縛" msgid "from" msgstr "from" -#: ../../reference/executionmodel.rst:57 msgid "import statement" -msgstr "" +msgstr "import 文" #: ../../reference/executionmodel.rst:87 msgid "free" diff --git a/reference/expressions.po b/reference/expressions.po index 9218f926a..c3a2a9c1d 100644 --- a/reference/expressions.po +++ b/reference/expressions.po @@ -28,10 +28,10 @@ msgstr "" "Last-Translator: Nozomu Kaneko , 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../reference/expressions.rst:6 @@ -73,15 +73,15 @@ msgid "" "operator implementation for built-in types works as follows:" msgstr "" -#: ../../reference/expressions.rst:34 msgid "If both arguments are complex numbers, no conversion is performed;" -msgstr "" +msgstr "両方の引数が複素数の場合、変換は行われません。" -#: ../../reference/expressions.rst:36 msgid "" "if either argument is a complex or a floating-point number, the other is " "converted to a floating-point number;" msgstr "" +"それ以外で、一方の引数が複素数または浮動小数点数の場合、もう一方は浮動小数点" +"数に変換されます。" #: ../../reference/expressions.rst:38 msgid "otherwise, both must be integers and no conversion is necessary." @@ -135,76 +135,86 @@ msgstr "" "ジェクトになります。名前が束縛されていない場合、 atom を評価しようとすると :" "exc:`NameError` 例外を送出します。" -#: ../../reference/expressions.rst:86 msgid "Private name mangling" -msgstr "" +msgstr "プライベート名のマングリング" -#: ../../reference/expressions.rst:88 msgid "" "When an identifier that textually occurs in a class definition begins with " "two or more underscore characters and does not end in two or more " "underscores, it is considered a :dfn:`private name` of that class." msgstr "" +"クラス定義のテキスト内に現れる識別子が、2 個以上のアンダースコアで始まり、2 " +"個以上のアンダースコアで終わらない場合、そのクラスの :dfn:`プライベート名` と" +"みなされます。" -#: ../../reference/expressions.rst:94 msgid "The :ref:`class specifications `." -msgstr "" +msgstr ":ref:`クラスの仕様 `。" -#: ../../reference/expressions.rst:96 msgid "" "More precisely, private names are transformed to a longer form before code " "is generated for them. If the transformed name is longer than 255 " "characters, implementation-defined truncation may happen." msgstr "" +"より正確には、プライベート名はコードを生成する前に、より長い形式に変換されま" +"す。\n" +"変換後の名前が 255 文字を超える場合は、実装で定めた方法で切り詰められることが" +"あります。" -#: ../../reference/expressions.rst:100 msgid "" "The transformation is independent of the syntactical context in which the " "identifier is used but only the following private identifiers are mangled:" msgstr "" +"変換は識別子を使う構文上の文脈によらず行われますが、マングリングの対象は次の" +"プライベートな識別子だけです。" -#: ../../reference/expressions.rst:103 msgid "" "Any name used as the name of a variable that is assigned or read or any name " "of an attribute being accessed." -msgstr "" +msgstr "代入または読み取りを行う変数の名前と、アクセスする属性の名前。" -#: ../../reference/expressions.rst:106 msgid "" "The :attr:`~definition.__name__` attribute of nested functions, classes, and " "type aliases is however not mangled." msgstr "" +"ただし、入れ子の関数、クラス、型エイリアスの :attr:`~definition.__name__` 属" +"性はマングリングされません。" -#: ../../reference/expressions.rst:109 msgid "" "The name of imported modules, e.g., ``__spam`` in ``import __spam``. If the " "module is part of a package (i.e., its name contains a dot), the name is " "*not* mangled, e.g., the ``__foo`` in ``import __foo.bar`` is not mangled." msgstr "" +"``import __spam`` の ``__spam`` など、インポートするモジュールの名前。\n" +"モジュールがパッケージの一部である場合 (名前にドットを含む場合) はマングリン" +"グ *されません*。\n" +"例えば ``import __foo.bar`` の ``__foo`` はマングリングされません。" -#: ../../reference/expressions.rst:114 msgid "" "The name of an imported member, e.g., ``__f`` in ``from spam import __f``." -msgstr "" +msgstr "``from spam import __f`` の ``__f`` など、インポートするメンバの名前。" -#: ../../reference/expressions.rst:116 msgid "The transformation rule is defined as follows:" -msgstr "" +msgstr "変換規則は次のとおりです。" -#: ../../reference/expressions.rst:118 msgid "" "The class name, with leading underscores removed and a single leading " "underscore inserted, is inserted in front of the identifier, e.g., the " "identifier ``__spam`` occurring in a class named ``Foo``, ``_Foo`` or " "``__Foo`` is transformed to ``_Foo__spam``." msgstr "" +"クラス名から先頭のアンダースコアを取り除き、先頭にアンダースコアを 1 個付けた" +"ものを、識別子の前に挿入します。\n" +"例えば ``Foo``、``_Foo``、``__Foo`` という名前のクラス内の識別子 ``__spam`` " +"は、``_Foo__spam`` に変換されます。" -#: ../../reference/expressions.rst:123 msgid "" "If the class name consists only of underscores, the transformation is the " "identity, e.g., the identifier ``__spam`` occurring in a class named ``_`` " "or ``__`` is left as is." msgstr "" +"クラス名がアンダースコアだけからなる場合、変換しても名前は変わりません。\n" +"例えば ``_`` や ``__`` という名前のクラス内の識別子 ``__spam`` はそのままで" +"す。" #: ../../reference/expressions.rst:130 msgid "Literals" @@ -391,11 +401,12 @@ msgstr "" "``yield`` および ``yield from`` は暗黙的な入れ子のスコープでは禁止となりまし" "た。" -#: ../../reference/expressions.rst:263 msgid "" "Asynchronous comprehensions are now allowed inside comprehensions in " "asynchronous functions. Outer comprehensions implicitly become asynchronous." msgstr "" +"非同期関数の内包表記の中でも、非同期内包表記を使えるようになりました。\n" +"外側の内包表記も暗黙的に非同期になります。" #: ../../reference/expressions.rst:272 msgid "List displays" @@ -633,7 +644,6 @@ msgstr "" "レータ関数になります。\n" "例えば次のようになります::" -#: ../../reference/expressions.rst:465 msgid "" "def gen(): # defines a generator function\n" " yield 123\n" @@ -641,16 +651,20 @@ msgid "" "async def agen(): # defines an asynchronous generator function\n" " yield 123" msgstr "" +"def gen(): # ジェネレータ関数を定義\n" +" yield 123\n" +"\n" +"async def agen(): # 非同期ジェネレータ関数を定義\n" +" yield 123" -#: ../../reference/expressions.rst:471 msgid "" "Due to their side effects on the containing scope, ``yield`` expressions are " "not permitted as part of the implicitly defined scopes used to implement " "comprehensions and generator expressions." msgstr "" -"含まれているスコープの副作用のため、 ``yield`` 式は暗黙的に定義されたスコープ" -"の一部として内包表記やジェネレータ式を実装するのに使うことは許可されていませ" -"ん。 " +"内包表記やジェネレータ式を実装するために暗黙的に定義されるスコープ内では、" +"``yield`` 式を使えません。\n" +"これは、それを含むスコープに副作用を及ぼすためです。" #: ../../reference/expressions.rst:475 msgid "" @@ -669,7 +683,6 @@ msgstr "" "ジェネレータ関数についてはすぐ下で説明されています。非同期ジェネレータ関数" "は、 :ref:`asynchronous-generator-functions` 節に分けて説明されています。" -#: ../../reference/expressions.rst:483 msgid "" "When a generator function is called, it returns an iterator known as a " "generator. That generator then controls the execution of the generator " @@ -689,8 +702,23 @@ msgid "" "`None`. Otherwise, if :meth:`~generator.send` is used, then the result will " "be the value passed in to that method." msgstr "" +"ジェネレータ関数を呼び出すと、ジェネレータと呼ばれるイテレータを返します。\n" +"このジェネレータが、その後のジェネレータ関数の実行を制御します。\n" +"ジェネレータのメソッドのいずれかを呼ぶと実行が始まり、最初の yield 式まで進ん" +"で再び一時停止します。\n" +"このとき :token:`~python-grammar:yield_list` の値をジェネレータの呼び出し元に" +"返します。\n" +":token:`~python-grammar:yield_list` が省略されていれば ``None`` を返しま" +"す。\n" +"一時停止とは、ローカル変数の現在の束縛、命令ポインタ、内部の評価スタック、例" +"外処理の状態を含む、すべてのローカルな状態を保持することを意味します。\n" +"ジェネレータのメソッドを呼んで実行を再開すると、yield 式が通常の外部呼び出し" +"であったかのように関数を続行できます。\n" +"再開後の yield 式の値は、実行を再開させたメソッドによって決まります。\n" +":meth:`~generator.__next__` を使った場合 (通常は :keyword:`for` や組み込み関" +"数 :func:`next` を通じて使います) は :const:`None` になります。\n" +":meth:`~generator.send` を使った場合は、そのメソッドに渡した値になります。" -#: ../../reference/expressions.rst:503 msgid "" "All of this makes generator functions quite similar to coroutines; they " "yield multiple times, they have more than one entry point and their " @@ -698,10 +726,11 @@ msgid "" "function cannot control where the execution should continue after it yields; " "the control is always transferred to the generator's caller." msgstr "" -"これまで説明した内容から、ジェネレータ関数はコルーチンにとてもよく似ていま" -"す。ジェネレータ関数は何度も生成し、1つ以上のエントリポイントを持ち、その実行" -"は一時停止されます。ジェネレータ関数は yield した後で実行の継続を制御できない" -"ことが唯一の違いです。その制御は常にジェネレータの呼び出し元へ移されます。" +"このように、ジェネレータ関数はコルーチンとよく似ています。\n" +"何度も yield し、複数のエントリポイントを持ち、実行を一時停止できます。\n" +"唯一の違いは、ジェネレータ関数は yield した後にどこで実行を続けるかを制御でき" +"ないことです。\n" +"制御は常にジェネレータの呼び出し元へ移ります。" #: ../../reference/expressions.rst:509 msgid "" @@ -882,7 +911,6 @@ msgid "" "the way the :keyword:`raise` keyword is used." msgstr "" -#: ../../reference/expressions.rst:609 msgid "" "For backwards compatibility, however, the second signature is supported, " "following a convention from older versions of Python. The *type* argument " @@ -892,12 +920,22 @@ msgid "" "any existing :attr:`~BaseException.__traceback__` attribute stored in " "*value* may be cleared." msgstr "" +"ただし、後方互換性のため、以前のバージョンの Python の慣例に従った2番目のシグ" +"ネチャもサポートされています。\n" +"``type`` 引数には例外クラスを、``value`` には例外インスタンスを指定してくださ" +"い。\n" +"``value`` を指定しない場合は、``type`` のコンストラクタを呼び出してインスタン" +"スを取得します。\n" +"``traceback`` を指定した場合は例外に設定されます。\n" +"指定しない場合は、``value`` に格納されている既存の :attr:`~BaseException." +"__traceback__` 属性がクリアされることがあります。" -#: ../../reference/expressions.rst:620 ../../reference/expressions.rst:804 msgid "" "The second signature \\(type\\[, value\\[, traceback\\]\\]\\) is deprecated " "and may be removed in a future version of Python." msgstr "" +"2番目のシグネチャ \\(type\\[, value\\[, traceback\\]\\]\\) は非推奨となり、将" +"来のバージョンの Python で削除される可能性があります。" #: ../../reference/expressions.rst:628 msgid "" @@ -996,7 +1034,6 @@ msgstr "" "for` 文で使われ、これはジェネレータオブジェクトが :keyword:`for` 文で使われる" "様子に類似します。" -#: ../../reference/expressions.rst:694 msgid "" "Calling one of the asynchronous generator's methods returns an :term:" "`awaitable` object, and the execution starts when this object is awaited on. " @@ -1013,8 +1050,18 @@ msgid "" "then the result is :const:`None`. Otherwise, if :meth:`~agen.asend` is used, " "then the result will be the value passed in to that method." msgstr "" +"非同期ジェネレータのメソッドのいずれかを呼ぶと :term:`awaitable` オブジェクト" +"を返し、このオブジェクトを await すると実行が始まります。\n" +"最初の yield 式まで進んで再び一時停止し、:token:`~python-grammar:yield_list` " +"の値を、await しているコルーチンに返します。\n" +"ジェネレータと同様、一時停止中はローカル変数の現在の束縛、命令ポインタ、内部" +"の評価スタック、例外処理の状態を含む、すべてのローカルな状態を保持します。\n" +"非同期ジェネレータのメソッドが次に返すオブジェクトを await して実行を再開する" +"と、yield 式が通常の外部呼び出しであったかのように関数を続行できます。\n" +"再開後の yield 式の値は、実行を再開させたメソッドによって決まります。\n" +":meth:`~agen.__anext__` を使った場合は :const:`None` になります。\n" +":meth:`~agen.asend` を使った場合は、そのメソッドに渡した値になります。" -#: ../../reference/expressions.rst:709 msgid "" "If an asynchronous generator happens to exit early by :keyword:`break`, the " "caller task being cancelled, or other exceptions, the generator's async " @@ -1025,8 +1072,17 @@ msgid "" "the async generator by calling :meth:`~agen.aclose` method to finalize the " "generator and ultimately detach it from the event loop." msgstr "" +":keyword:`break`、呼び出し元のタスクのキャンセル、その他の例外によって非同期" +"ジェネレータの処理を途中で終了すると、\n" +"ジェネレータの非同期の後始末コードが予期しない文脈で実行され、例外を送出した" +"りコンテキスト変数にアクセスしたりする場合があります。\n" +"例えば、依存するタスクの存続期間が終わった後や、イベントループの終了時に非同" +"期ジェネレータのガベージコレクションフックが呼ばれたときに実行される可能性が" +"あります。\n" +"これを防ぐため、呼び出し元は :meth:`~agen.aclose` メソッドで非同期ジェネレー" +"タを明示的に閉じ、終了処理を行って、最終的にイベントループから切り離す必要が" +"あります。" -#: ../../reference/expressions.rst:719 msgid "" "In an asynchronous generator function, yield expressions are allowed " "anywhere in a :keyword:`try` construct. However, if an asynchronous " @@ -1039,15 +1095,16 @@ msgid "" "the resulting coroutine object, thus allowing any pending :keyword:`!" "finally` clauses to execute." msgstr "" -"非同期ジェネレータ関数では、 :keyword:`try` 構造内の任意の場所で yield 式が使" -"用できます。\n" -"ただし、非同期ジェネレータが、(参照カウントがゼロに達するか、ガベージコレク" -"ションによる) 終了処理より前に再開されない場合、 :keyword:`!try` 構造内の " -"yield 式は失敗となり、実行待ちだった :keyword:`finally` 節が実行されます。\n" -"このケースでは、非同期ジェネレータが作動しているイベントループやスケジューラ" -"の責務は、非同期ジェネレータの :meth:`~agen.aclose` メソッドを呼び出し、残り" -"のコルーチンオブジェクトを実行し、それによって実行待ちだった :keyword:`!" -"finally` 節が実行できるようにします。" +"非同期ジェネレータ関数では、:keyword:`try` 構造内のどこでも yield 式を使えま" +"す。\n" +"ただし、非同期ジェネレータが再開されないまま終了処理を迎えた場合 (参照カウン" +"トが 0 に達した場合やガベージコレクションされた場合)、\n" +":keyword:`!try` 構造内の yield 式による一時停止のため、実行待ちの :keyword:" +"`finally` 節が実行されない可能性があります。\n" +"この場合、非同期ジェネレータを実行するイベントループやスケジューラが、\n" +"非同期ジェネレータイテレータの :meth:`~agen.aclose` メソッドを呼び、返された" +"コルーチンオブジェクトを実行して、実行待ちの :keyword:`!finally` 節が実行され" +"るようにする責任を持ちます。" #: ../../reference/expressions.rst:730 msgid "" @@ -1166,7 +1223,6 @@ msgstr "属性参照" msgid "An attribute reference is a primary followed by a period and a name:" msgstr "属性参照は、プライマリの後ろにピリオドと名前を連ねたものです:" -#: ../../reference/expressions.rst:859 msgid "" "The primary must evaluate to an object of a type that supports attribute " "references, which most objects do. This object is then asked to produce the " @@ -1174,20 +1230,31 @@ msgid "" "determined by the object. Multiple evaluations of the same attribute " "reference may yield different objects." msgstr "" +"プライマリの評価結果は、属性参照をサポートする型のオブジェクトでなければなり" +"ません。\n" +"ほとんどのオブジェクトはこれをサポートします。\n" +"次に、このオブジェクトに対して、識別子を名前とする属性を取得するよう求めま" +"す。\n" +"得られる型と値はオブジェクトによって決まります。\n" +"同じ属性参照を複数回評価しても、別のオブジェクトが得られる場合があります。" -#: ../../reference/expressions.rst:865 msgid "" "This production can be customized by overriding the :meth:`~object." "__getattribute__` method or the :meth:`~object.__getattr__` method. The :" "meth:`!__getattribute__` method is called first and either returns a value " "or raises :exc:`AttributeError` if the attribute is not available." msgstr "" +"この取得動作は、:meth:`~object.__getattribute__` メソッドや :meth:`~object." +"__getattr__` メソッドをオーバーライドしてカスタマイズできます。\n" +"最初に :meth:`!__getattribute__` メソッドが呼ばれ、値を返すか、属性がなけれ" +"ば :exc:`AttributeError` を送出します。" -#: ../../reference/expressions.rst:871 msgid "" "If an :exc:`AttributeError` is raised and the object has a :meth:`!" "__getattr__` method, that method is called as a fallback." msgstr "" +":exc:`AttributeError` が送出され、そのオブジェクトが :meth:`!__getattr__` メ" +"ソッドを持っていれば、代わりにそのメソッドが呼ばれます。" #: ../../reference/expressions.rst:877 msgid "Subscriptions" @@ -1350,7 +1417,6 @@ msgstr "" "最後の位置引数やキーワード引数の後にカンマをつけてもかまいません。構文の意味" "付けに影響を及ぼすことはありません。" -#: ../../reference/expressions.rst:1040 msgid "" "The primary must evaluate to a callable object (user-defined functions, " "built-in functions, methods of built-in objects, class objects, methods of " @@ -1359,8 +1425,15 @@ msgid "" "attempted. Please refer to section :ref:`function` for the syntax of " "formal :term:`parameter` lists." msgstr "" +"プライマリの評価結果は、呼び出し可能オブジェクトでなければなりません。\n" +"ユーザー定義関数、組み込み関数、組み込みオブジェクトのメソッド、クラスオブ" +"ジェクト、クラスインスタンスのメソッド、\n" +":meth:`~object.__call__` メソッドを持つすべてのオブジェクトは呼び出し可能で" +"す。\n" +"すべての引数の式は、呼び出しを試みる前に評価されます。\n" +"仮引数 (:term:`parameter`) リストの構文は :ref:`function` を参照してくださ" +"い。" -#: ../../reference/expressions.rst:1048 msgid "" "If keyword arguments are present, they are first converted to positional " "arguments, as follows. First, a list of unfilled slots is created for the " @@ -1380,24 +1453,25 @@ msgid "" "specified, a :exc:`TypeError` exception is raised. Otherwise, the list of " "filled slots is used as the argument list for the call." msgstr "" -"キーワード引数が存在する場合、以下のようにして最初に位置引数 (positional " -"argument) に変換されます。まず、値の入っていないスロットが仮引数に対して生成" -"されます。N 個の位置引数がある場合、位置引数は先頭の N スロットに配置されま" -"す。次に、各キーワード引数について、識別子を使って対応するスロットを決定しま" -"す (識別子が最初の仮引数名と同じなら、最初のスロットを使う、といった具合で" -"す)。スロットがすでにすべて埋まっていたなら :exc:`TypeError` 例外が送出されま" -"す。それ以外の場合、引数をスロットに埋めていきます。 (式が ``None`` であって" -"も、その式でスロットを埋めます)。全ての引数が処理されたら、まだ埋められていな" -"いスロットをそれぞれに対応する関数定義時のデフォルト値で埋めます。(デフォルト" -"値は、関数が定義されたときに一度だけ計算されます; 従って、リストや辞書のよう" -"な変更可能なオブジェクトがデフォルト値として使われると、対応するスロットに引" -"数を指定しない限り、このオブジェクトが全ての呼び出しから共有されます; このよ" -"うな状況は通常避けるべきです。) デフォルト値が指定されていない、値の埋められ" -"ていないスロットが残っている場合 :exc:`TypeError` 例外が送出されます。そうで" -"ない場合、値の埋められたスロットからなるリストが呼び出しの引数として使われま" +"キーワード引数がある場合は、まず次のように位置引数に変換します。\n" +"最初に、仮引数に対応する空のスロットのリストを作成します。\n" +"位置引数が N 個あれば、先頭の N 個のスロットに配置します。\n" +"次に各キーワード引数について、識別子から対応するスロットを決めます (識別子が" +"最初の仮引数名と同じなら最初のスロットを使う、といった具合です)。\n" +"そのスロットがすでに埋まっていれば :exc:`TypeError` 例外を送出します。\n" +"そうでなければ、引数をそのスロットに入れます (式が ``None`` でもスロットは埋" +"まります)。\n" +"すべての引数を処理した後、まだ空のスロットを関数定義の対応するデフォルト値で" +"埋めます。\n" +"(デフォルト値は関数の定義時に一度だけ計算されます。\n" +"そのため、リストや辞書などの可変オブジェクトをデフォルト値にすると、対応する" +"引数の値を指定しないすべての呼び出しが同じオブジェクトを共有します。\n" +"通常は避けるべきです。)\n" +"デフォルト値も指定されていない空のスロットが残れば、:exc:`TypeError` 例外を送" +"出します。\n" +"そうでなければ、値を入れたスロットのリストを呼び出しの引数リストとして使いま" "す。" -#: ../../reference/expressions.rst:1068 msgid "" "An implementation may provide built-in functions whose positional parameters " "do not have names, even if they are 'named' for the purpose of " @@ -1405,11 +1479,11 @@ msgid "" "CPython, this is the case for functions implemented in C that use :c:func:" "`PyArg_ParseTuple` to parse their arguments." msgstr "" -"実装では、名前を持たない位置引数を受け取る組み込み関数を提供されるかもしれま" -"せん。そういった引数がドキュメント化のために '名付けられて' いたとしても、実" -"際には名付けられていないのでキーワードでは提供されません。 CPython では、C 言" -"語で実装された関数の、名前を持たない位置引数をパースするために :c:func:" -"`PyArg_ParseTuple` を使用します。" +"実装によっては、位置引数の仮引数に名前がない組み込み関数を提供する場合があり" +"ます。\n" +"ドキュメントのために「名前を付けて」いても、キーワードでは指定できません。\n" +"CPython では、引数の解析に :c:func:`PyArg_ParseTuple` を使う C 実装の関数がこ" +"れに当たります。" #: ../../reference/expressions.rst:1074 msgid "" @@ -1503,7 +1577,6 @@ msgstr "" "キーにマッチする引数が (明示的なキーワード引数によって、あるいは他のアンパッ" "クの中で) 既に値を与えられていたなら、 :exc:`TypeError` 例外が送出されます。" -#: ../../reference/expressions.rst:1126 msgid "" "When ``**expression`` is used, each key in this mapping must be a string. " "Each value from the mapping is assigned to the first formal parameter " @@ -1514,6 +1587,14 @@ msgid "" "parameter, if there is one, or if there is not, a :exc:`TypeError` exception " "is raised." msgstr "" +"``**expression`` を使う場合、マッピングのキーはすべて文字列でなければなりませ" +"ん。\n" +"各値は、キーワードで値を指定でき、名前がキーと等しい最初の仮引数に代入されま" +"す。\n" +"キーが Python の識別子である必要はありません (例えば ``\"max-temp °F\"`` も使" +"えますが、宣言可能な仮引数とは一致しません)。\n" +"一致する仮引数がなければ、``**`` の仮引数がある場合はそこにキーと値のペアが集" +"められ、ない場合は :exc:`TypeError` 例外を送出します。" #: ../../reference/expressions.rst:1136 msgid "" @@ -1552,7 +1633,6 @@ msgstr "各形態では---" msgid "a user-defined function:" msgstr "ユーザ定義関数:" -#: ../../reference/expressions.rst:1158 msgid "" "The code block for the function is executed, passing it the argument list. " "The first thing the code block will do is bind the formal parameters to the " @@ -1562,6 +1642,13 @@ msgid "" "without executing a :keyword:`return` statement, the return value is " "``None``." msgstr "" +"引数リストを渡して、関数のコードブロックを実行します。\n" +"コードブロックは最初に、渡された引数を仮引数に束縛します。\n" +"この処理は :ref:`function` で説明しています。\n" +"コードブロック内で :keyword:`return` 文を実行すると、それが関数呼び出しの戻り" +"値を指定します。\n" +":keyword:`return` 文を実行せずにコードブロックの末尾に達した場合、戻り値は " +"``None`` です。" #: ../../reference/expressions.rst:1165 msgid "a built-in function or method:" @@ -1601,11 +1688,12 @@ msgstr "" msgid "a class instance:" msgstr "クラスインスタンス:" -#: ../../reference/expressions.rst:1201 msgid "" "The class must define a :meth:`~object.__call__` method; the effect is then " "the same as if that method was called." msgstr "" +"クラスは :meth:`~object.__call__` メソッドを定義していなければなりません。\n" +"そのメソッドを呼び出したのと同じ動作になります。" #: ../../reference/expressions.rst:1209 ../../reference/expressions.rst:2022 msgid "Await expression" @@ -1632,15 +1720,14 @@ msgstr "" "側にある単項演算子よりは弱い結合優先順位になっています。構文は以下のようにな" "ります:" -#: ../../reference/expressions.rst:1235 msgid "" "Thus, in an unparenthesized sequence of power and unary operators, the " "operators are evaluated from right to left (this does not constrain the " "evaluation order for the operands): ``-1**2`` results in ``-1``." msgstr "" -"従って、べき乗演算子と単項演算子からなる演算列が丸括弧で囲われていない場合、" -"演算子は右から左へと評価されます (この場合は演算子の評価順序を強制しません。" -"つまり ``-1**2`` は ``-1`` になります)。" +"従って、べき乗演算子と単項演算子の並びを丸括弧で囲まなければ、演算子は右から" +"左へ評価されます (これはオペランドの評価順序を制限するものではありません)。\n" +"``-1**2`` の結果は ``-1`` です。" #: ../../reference/expressions.rst:1239 msgid "" @@ -1675,11 +1762,12 @@ msgstr "" "を小数でべき乗した結果は複素数 (:class:`complex` number) になります。 (以前の" "バージョンでは :exc:`ValueError` を送出していました)" -#: ../../reference/expressions.rst:1253 msgid "" "This operation can be customized using the special :meth:`~object.__pow__` " "and :meth:`~object.__rpow__` methods." msgstr "" +"この演算は、特殊メソッド :meth:`~object.__pow__` と :meth:`~object.__rpow__` " +"でカスタマイズできます。" #: ../../reference/expressions.rst:1259 msgid "Unary arithmetic and bitwise operations" @@ -1689,26 +1777,32 @@ msgstr "単項算術演算とビット単位演算 (unary arithmetic and bitwise msgid "All unary arithmetic and bitwise operations have the same priority:" msgstr "全ての単項算術演算とビット単位演算は、同じ優先順位を持っています:" -#: ../../reference/expressions.rst:1276 msgid "" "The unary ``-`` (minus) operator yields the negation of its numeric " "argument; the operation can be overridden with the :meth:`~object.__neg__` " "special method." msgstr "" +"単項の ``-`` (マイナス) 演算子は、数値の引数の符号を反転した値を返します。\n" +"この演算は特殊メソッド :meth:`~object.__neg__` でオーバーライドできます。" -#: ../../reference/expressions.rst:1284 msgid "" "The unary ``+`` (plus) operator yields its numeric argument unchanged; the " "operation can be overridden with the :meth:`~object.__pos__` special method." msgstr "" +"単項の ``+`` (プラス) 演算子は、数値の引数をそのまま返します。\n" +"この演算は特殊メソッド :meth:`~object.__pos__` でオーバーライドできます。" -#: ../../reference/expressions.rst:1291 msgid "" "The unary ``~`` (invert) operator yields the bitwise inversion of its " "integer argument. The bitwise inversion of ``x`` is defined as ``-(x+1)``. " "It only applies to integral numbers or to custom objects that override the :" "meth:`~object.__invert__` special method." msgstr "" +"単項の ``~`` (反転) 演算子は、整数の引数をビット単位で反転した値を返しま" +"す。\n" +"``x`` のビット単位の反転は ``-(x+1)`` と定義されます。\n" +"整数、または特殊メソッド :meth:`~object.__invert__` をオーバーライドした独自" +"のオブジェクトだけに適用できます。" #: ../../reference/expressions.rst:1300 msgid "" @@ -1744,18 +1838,19 @@ msgid "" "yields an empty sequence." msgstr "" -#: ../../reference/expressions.rst:1332 msgid "" "This operation can be customized using the special :meth:`~object.__mul__` " "and :meth:`~object.__rmul__` methods." msgstr "" +"この演算は、特殊メソッド :meth:`~object.__mul__` と :meth:`~object.__rmul__` " +"でカスタマイズできます。" -#: ../../reference/expressions.rst:1335 ../../reference/expressions.rst:1412 -#: ../../reference/expressions.rst:1427 msgid "" "If only one operand is a complex number, the other operand is converted to a " "floating-point number." msgstr "" +"片方のオペランドだけが複素数の場合、もう一方のオペランドは浮動小数点数に変換" +"されます。" #: ../../reference/expressions.rst:1343 msgid "" @@ -1765,11 +1860,12 @@ msgstr "" "``@`` (at) 演算子は行列の乗算に対し使用されます。\n" "Python の組み込み型はこの演算子を実装していません。" -#: ../../reference/expressions.rst:1346 msgid "" "This operation can be customized using the special :meth:`~object." "__matmul__` and :meth:`~object.__rmatmul__` methods." msgstr "" +"この演算は、特殊メソッド :meth:`~object.__matmul__` と :meth:`~object." +"__rmatmul__` でカスタマイズできます。" #: ../../reference/expressions.rst:1357 msgid "" @@ -1786,13 +1882,16 @@ msgstr "" "は数学的な除算に 'floor' 関数 を適用したものになります。ゼロによる除算を行う" "と :exc:`ZeroDivisionError` 例外を送出します。" -#: ../../reference/expressions.rst:1364 msgid "" "The division operation can be customized using the special :meth:`~object." "__truediv__` and :meth:`~object.__rtruediv__` methods. The floor division " "operation can be customized using the special :meth:`~object.__floordiv__` " "and :meth:`~object.__rfloordiv__` methods." msgstr "" +"除算は特殊メソッド :meth:`~object.__truediv__` と :meth:`~object." +"__rtruediv__` でカスタマイズできます。\n" +"切り捨て除算は特殊メソッド :meth:`~object.__floordiv__` と :meth:`~object." +"__rfloordiv__` でカスタマイズできます。" #: ../../reference/expressions.rst:1373 msgid "" @@ -1830,18 +1929,21 @@ msgstr "" "す。文字列の書式化の構文は Python ライブラリリファレンス :ref:`old-string-" "formatting` 節を参照してください。" -#: ../../reference/expressions.rst:1392 msgid "" "The *modulo* operation can be customized using the special :meth:`~object." "__mod__` and :meth:`~object.__rmod__` methods." msgstr "" +"*剰余* 演算は、特殊メソッド :meth:`~object.__mod__` と :meth:`~object." +"__rmod__` でカスタマイズできます。" -#: ../../reference/expressions.rst:1395 msgid "" "The floor division operator, the modulo operator, and the :func:`divmod` " "function are not defined for complex numbers. Instead, convert to a " "floating-point number using the :func:`abs` function if appropriate." msgstr "" +"複素数には、切り捨て除算演算子、剰余演算子、:func:`divmod` 関数は定義されてい" +"ません。\n" +"適切であれば、代わりに :func:`abs` 関数で浮動小数点数に変換してください。" #: ../../reference/expressions.rst:1404 msgid "" @@ -1851,11 +1953,12 @@ msgid "" "and then added together. In the latter case, the sequences are concatenated." msgstr "" -#: ../../reference/expressions.rst:1409 msgid "" "This operation can be customized using the special :meth:`~object.__add__` " "and :meth:`~object.__radd__` methods." msgstr "" +"この演算は、特殊メソッド :meth:`~object.__add__` と :meth:`~object.__radd__` " +"でカスタマイズできます。" #: ../../reference/expressions.rst:1421 msgid "" @@ -1863,11 +1966,12 @@ msgid "" "The numeric arguments are first converted to a common real type." msgstr "" -#: ../../reference/expressions.rst:1424 msgid "" "This operation can be customized using the special :meth:`~object.__sub__` " "and :meth:`~object.__rsub__` methods." msgstr "" +"この演算は、特殊メソッド :meth:`~object.__sub__` と :meth:`~object.__rsub__` " +"でカスタマイズできます。" #: ../../reference/expressions.rst:1435 msgid "Shifting operations" @@ -1878,29 +1982,30 @@ msgid "" "The shifting operations have lower priority than the arithmetic operations:" msgstr "シフト演算は、算術演算よりも低い優先順位を持っています:" -#: ../../reference/expressions.rst:1447 msgid "" "These operators accept integers as arguments. They shift the first argument " "to the left or right by the number of bits given by the second argument." msgstr "" -"これらは整数を引数にとります。引数は共通の型に変換されます。シフト演算は第一" -"引数を、第二引数で与えられたビット数だけ、左または右にビットシフトします。" +"これらの演算子は整数を引数に取ります。\n" +"第 1 引数を、第 2 引数で指定したビット数だけ左または右にシフトします。" -#: ../../reference/expressions.rst:1450 msgid "" "The left shift operation can be customized using the special :meth:`~object." "__lshift__` and :meth:`~object.__rlshift__` methods. The right shift " "operation can be customized using the special :meth:`~object.__rshift__` " "and :meth:`~object.__rrshift__` methods." msgstr "" +"左シフト演算は特殊メソッド :meth:`~object.__lshift__` と :meth:`~object." +"__rlshift__` でカスタマイズできます。\n" +"右シフト演算は特殊メソッド :meth:`~object.__rshift__` と :meth:`~object." +"__rrshift__` でカスタマイズできます。" -#: ../../reference/expressions.rst:1457 msgid "" "A right shift by *n* bits is defined as floor division by ``pow(2,n)``. A " "left shift by *n* bits is defined as multiplication with ``pow(2,n)``." msgstr "" -"*n* ビットの右シフトは ``pow(2,n)`` による除算として定義されます。*n* ビット" -"の左シフトは ``pow(2,n)`` による乗算として定義されます。" +"*n* ビットの右シフトは、``pow(2,n)`` による切り捨て除算として定義されます。\n" +"*n* ビットの左シフトは、``pow(2,n)`` による乗算として定義されます。" #: ../../reference/expressions.rst:1464 msgid "Binary bitwise operations" @@ -1911,26 +2016,35 @@ msgid "Each of the three bitwise operations has a different priority level:" msgstr "" "以下の三つのビット単位演算には、それぞれ異なる優先順位レベルがあります:" -#: ../../reference/expressions.rst:1479 msgid "" "The ``&`` operator yields the bitwise AND of its arguments, which must be " "integers or one of them must be a custom object overriding :meth:`~object." "__and__` or :meth:`~object.__rand__` special methods." msgstr "" +"``&`` 演算子は、引数のビット単位の AND を返します。\n" +"引数は整数であるか、少なくとも一方が特殊メソッド :meth:`~object.__and__` また" +"は :meth:`~object.__rand__` をオーバーライドした独自のオブジェクトでなければ" +"なりません。" -#: ../../reference/expressions.rst:1488 msgid "" "The ``^`` operator yields the bitwise XOR (exclusive OR) of its arguments, " "which must be integers or one of them must be a custom object overriding :" "meth:`~object.__xor__` or :meth:`~object.__rxor__` special methods." msgstr "" +"``^`` 演算子は、引数のビット単位の XOR (排他的 OR) を返します。\n" +"引数は整数であるか、少なくとも一方が特殊メソッド :meth:`~object.__xor__` また" +"は :meth:`~object.__rxor__` をオーバーライドした独自のオブジェクトでなければ" +"なりません。" -#: ../../reference/expressions.rst:1497 msgid "" "The ``|`` operator yields the bitwise (inclusive) OR of its arguments, which " "must be integers or one of them must be a custom object overriding :meth:" "`~object.__or__` or :meth:`~object.__ror__` special methods." msgstr "" +"``|`` 演算子は、引数のビット単位の (包含的) OR を返します。\n" +"引数は整数であるか、少なくとも一方が特殊メソッド :meth:`~object.__or__` また" +"は :meth:`~object.__ror__` をオーバーライドした独自のオブジェクトでなければな" +"りません。" #: ../../reference/expressions.rst:1505 msgid "Comparisons" @@ -1947,12 +2061,15 @@ msgstr "" "術演算子、シフト演算子、ビット単位演算子よりも低くなっています。また ``a < b " "< c`` が数学で伝統的に用いられているのと同じ解釈になる点も C 言語と違います:" -#: ../../reference/expressions.rst:1527 msgid "" "Comparisons yield boolean values: ``True`` or ``False``. Custom :dfn:`rich " "comparison methods` may return non-boolean values. In this case Python will " "call :func:`bool` on such value in boolean contexts." msgstr "" +"比較はブール値 ``True`` または ``False`` を返します。\n" +"独自の :dfn:`拡張比較メソッド` は、ブール値以外を返す場合があります。\n" +"この場合、真偽値が必要な文脈では、Python はその値に :func:`bool` を呼び出しま" +"す。" #: ../../reference/expressions.rst:1533 msgid "" @@ -1978,15 +2095,15 @@ msgstr "" "c and ... y opN z`` と等価になります。ただし、前者では各式は多くても一度しか" "評価されません。" -#: ../../reference/expressions.rst:1542 msgid "" "Note that ``a op1 b op2 c`` doesn't imply any kind of comparison between *a* " "and *c*, so that, e.g., ``x < y > z`` is perfectly legal (though perhaps not " "pretty)." msgstr "" -"``a op1 b op2 c`` と書いた場合、 *a* から *c* までの範囲にあるかどうかのテス" -"トを指すのではないことに注意してください。例えば ``x < y > z`` は (きれいな書" -"き方ではありませんが) 完全に正しい文法です。" +"``a op1 b op2 c`` は、*a* と *c* の間の比較を意味しないことに注意してくださ" +"い。\n" +"そのため、例えば ``x < y > z`` も (読みやすいとは限りませんが) 完全に有効で" +"す。" #: ../../reference/expressions.rst:1549 msgid "Value comparisons" @@ -2023,13 +2140,16 @@ msgstr "" "この比較の実装によって、間接的にオブジェクトの値を定義していると考えることも" "できます。" -#: ../../reference/expressions.rst:1563 msgid "" "Because all types are (direct or indirect) subtypes of :class:`object`, they " "inherit the default comparison behavior from :class:`object`. Types can " "customize their comparison behavior by implementing :dfn:`rich comparison " "methods` like :meth:`~object.__lt__`, described in :ref:`customization`." msgstr "" +"すべての型は :class:`object` の直接または間接のサブタイプなので、:class:" +"`object` からデフォルトの比較動作を継承します。\n" +"型は :ref:`customization` で説明する :meth:`~object.__lt__` などの :dfn:`拡張" +"比較メソッド` を実装して、比較動作をカスタマイズできます。" #: ../../reference/expressions.rst:1569 msgid "" @@ -2110,12 +2230,14 @@ msgstr "" "偽で、``x != x`` は真です。\n" "この振る舞いは IEEE 754 に従ったものです。" -#: ../../reference/expressions.rst:1603 msgid "" "``None`` and :data:`NotImplemented` are singletons. :PEP:`8` advises that " "comparisons for singletons should always be done with ``is`` or ``is not``, " "never the equality operators." msgstr "" +"``None`` と :data:`NotImplemented` はシングルトンです。\n" +":PEP:`8` は、シングルトンの比較には等価演算子を使わず、常に ``is`` または " +"``is not`` を使うことを推奨しています。" #: ../../reference/expressions.rst:1607 msgid "" @@ -2155,13 +2277,16 @@ msgstr "" "異なる型どうしの等価比較の結果は等価でないとなり、異なる型どうしの順序比較" "は :exc:`TypeError` を送出します。" -#: ../../reference/expressions.rst:1623 msgid "" "Sequences compare lexicographically using comparison of corresponding " "elements. The built-in containers typically assume identical objects are " "equal to themselves. That lets them bypass equality tests for identical " "objects to improve performance and to maintain their internal invariants." msgstr "" +"シーケンスは、対応する要素を比較して辞書式に比較します。\n" +"組み込みコンテナは通常、同一のオブジェクトはそれ自身と等しいとみなします。\n" +"これにより、同一のオブジェクトに対する等価性の検査を省いて性能を高め、内部の" +"不変条件を保てます。" #: ../../reference/expressions.rst:1628 msgid "" @@ -2388,14 +2513,15 @@ msgstr "" "です。空文字列は、他の任意の文字列の部分文字列とみなされます。従って ``\"\" " "in \"abc\"`` は ``True`` を返すことになります。" -#: ../../reference/expressions.rst:1730 msgid "" "For user-defined classes which define the :meth:`~object.__contains__` " "method, ``x in y`` returns ``True`` if ``y.__contains__(x)`` returns a true " "value, and ``False`` otherwise." msgstr "" +":meth:`~object.__contains__` メソッドを定義したユーザー定義クラスでは、``y." +"__contains__(x)`` が真の値を返せば ``x in y`` は ``True`` を返し、それ以外で" +"は ``False`` を返します。" -#: ../../reference/expressions.rst:1734 msgid "" "For user-defined classes which do not define :meth:`~object.__contains__` " "but do define :meth:`~object.__iter__`, ``x in y`` is ``True`` if some value " @@ -2403,8 +2529,13 @@ msgid "" "while iterating over ``y``. If an exception is raised during the iteration, " "it is as if :keyword:`in` raised that exception." msgstr "" +":meth:`~object.__contains__` を定義せず :meth:`~object.__iter__` を定義した" +"ユーザー定義クラスでは、\n" +"``y`` をイテレートしたときに ``x is z or x == z`` が真になる値 ``z`` が得られ" +"れば、``x in y`` は ``True`` です。\n" +"イテレート中に例外が送出された場合は、:keyword:`in` がその例外を送出したのと" +"同じになります。" -#: ../../reference/expressions.rst:1740 msgid "" "Lastly, the old-style iteration protocol is tried: if a class defines :meth:" "`~object.__getitem__`, ``x in y`` is ``True`` if and only if there is a non-" @@ -2412,6 +2543,13 @@ msgid "" "lower integer index raises the :exc:`IndexError` exception. (If any other " "exception is raised, it is as if :keyword:`in` raised that exception)." msgstr "" +"最後に、旧式のイテレーションプロトコルを試します。\n" +"クラスが :meth:`~object.__getitem__` を定義している場合、\n" +"``x is y[i] or x == y[i]`` となる非負整数のインデックス *i* があり、それより" +"小さいインデックスで :exc:`IndexError` 例外が送出されなければ、そのときに限" +"り ``x in y`` は ``True`` です。\n" +"(その他の例外が送出された場合は、:keyword:`in` がその例外を送出したのと同じに" +"なります。)" #: ../../reference/expressions.rst:1752 msgid "" @@ -2436,13 +2574,12 @@ msgstr "" "るテストを行います: ``x is y`` は、 *x* と *y* が同じオブジェクトを指すとき、" "かつそのときに限り真になります。\n" "オブジェクトの同一性は :meth:`id` 関数を使って判定されます。\n" -"``x is not y`` は :keyword:`is` の真値を反転したものになります。 [#]_" +"``x is not y`` は ``is`` の真値を反転したものになります。 [#]_" #: ../../reference/expressions.rst:1779 msgid "Boolean operations" msgstr "ブール演算 (boolean operation)" -#: ../../reference/expressions.rst:1790 msgid "" "In the context of Boolean operations, and also when expressions are used by " "control flow statements, the following values are interpreted as false: " @@ -2452,6 +2589,12 @@ msgid "" "objects can customize their truth value by providing a :meth:`~object." "__bool__` method." msgstr "" +"ブール演算や制御フロー文で式を使う場合、``False``、``None``、すべての数値型" +"の 0、空の文字列とコンテナ (文字列、タプル、リスト、辞書、集合、凍結集合を含" +"む) は偽と解釈されます。\n" +"その他の値はすべて真と解釈されます。\n" +"ユーザー定義オブジェクトは :meth:`~object.__bool__` メソッドを提供して、真偽" +"値をカスタマイズできます。" #: ../../reference/expressions.rst:1799 msgid "" @@ -2498,35 +2641,36 @@ msgstr "" msgid "Assignment expressions" msgstr "代入式" -#: ../../reference/expressions.rst:1836 msgid "" "An assignment expression (sometimes also called a \"named expression\" or " "\"walrus\") assigns an :token:`~python-grammar:expression` to an :token:" "`~python-grammar:identifier`, while also returning the value of the :token:" "`~python-grammar:expression`." msgstr "" +"代入式 (「名前付き式」や「セイウチ」とも呼ばれます) は、:token:`~python-" +"grammar:expression` を :token:`~python-grammar:identifier` に代入すると同時" +"に、その :token:`~python-grammar:expression` の値を返します。" -#: ../../reference/expressions.rst:1841 msgid "One common use case is when handling matched regular expressions:" -msgstr "" +msgstr "よくある用途の 1 つは、正規表現にマッチした結果の処理です。" -#: ../../reference/expressions.rst:1843 msgid "" "if matching := pattern.search(data):\n" " do_something(matching)" msgstr "" +"if matching := pattern.search(data):\n" +" do_something(matching)" -#: ../../reference/expressions.rst:1848 msgid "Or, when processing a file stream in chunks:" -msgstr "" +msgstr "ファイルストリームを一定量ずつ処理する場合にも使えます。" -#: ../../reference/expressions.rst:1850 msgid "" "while chunk := file.read(9000):\n" " process(chunk)" msgstr "" +"while chunk := file.read(9000):\n" +" process(chunk)" -#: ../../reference/expressions.rst:1855 msgid "" "Assignment expressions must be surrounded by parentheses when used as " "expression statements and when used as sub-expressions in slicing, " @@ -2535,6 +2679,12 @@ msgid "" "where they can be used, parentheses are not required, including in ``if`` " "and ``while`` statements." msgstr "" +"代入式を式文として使う場合や、スライス、条件式、ラムダ式、キーワード引数、内" +"包表記の if 条件の部分式として使う場合、\n" +"また ``assert`` 文、``with`` 文、代入文の中で使う場合は、丸括弧で囲む必要があ" +"ります。\n" +"使用できるその他の場所では、``if`` 文や ``while`` 文を含め、丸括弧は不要で" +"す。" #: ../../reference/expressions.rst:1863 msgid "See :pep:`572` for more details about assignment expressions." @@ -2581,11 +2731,12 @@ msgstr "" "式 ``lambda parameters: expression`` は関数オブジェクトになります。\n" "この無名オブジェクトは以下に定義されている関数オブジェクト同様に動作します:" -#: ../../reference/expressions.rst:1911 msgid "" "def (parameters):\n" " return expression" msgstr "" +"def (parameters):\n" +" return expression" #: ../../reference/expressions.rst:1916 msgid "" @@ -2600,15 +2751,14 @@ msgstr "" msgid "Expression lists" msgstr "式のリスト" -#: ../../reference/expressions.rst:1940 msgid "" "Except when part of a list or set display, an expression list containing at " "least one comma yields a tuple. The length of the tuple is the number of " "expressions in the list. The expressions are evaluated from left to right." msgstr "" -"リスト表示や辞書表示の一部になっているものを除き、少なくとも一つのカンマを含" -"む式のリストはタプルになります。\n" -"タプルの長さは、リストにある式の数に等しくなります。\n" +"リスト表示や集合表示の一部である場合を除き、少なくとも 1 個のカンマを含む式リ" +"ストはタプルになります。\n" +"タプルの長さは式リストに含まれる式の数です。\n" "式は左から右へ評価されます。" #: ../../reference/expressions.rst:1949 @@ -2629,11 +2779,11 @@ msgid "" msgstr "" "式リストでのイテラブルのアンパックは最初に :pep:`448` で提案されました。" -#: ../../reference/expressions.rst:1957 msgid "Any item in an expression list may be starred. See :pep:`646`." msgstr "" +"式リストのどの項目にもアスタリスクを付けられるようになりました。\n" +":pep:`646` を参照してください。" -#: ../../reference/expressions.rst:1962 msgid "" "A trailing comma is required only to create a one-item tuple, such as ``1," "``; it is optional in all other cases. A single expression without a " @@ -2641,19 +2791,24 @@ msgid "" "expression. (To create an empty tuple, use an empty pair of parentheses: " "``()``.)" msgstr "" +"末尾のカンマが必須なのは、``1,`` のような要素が 1 個のタプルを作る場合だけで" +"す。\n" +"その他の場合は省略できます。\n" +"1 個の式に末尾のカンマを付けなければ、タプルではなく、その式の値になりま" +"す。\n" +"(空のタプルを作るには、空の丸括弧の組 ``()`` を使います。)" #: ../../reference/expressions.rst:1973 msgid "Evaluation order" msgstr "評価順序" -#: ../../reference/expressions.rst:1977 msgid "" "Python evaluates expressions from left to right. Notice that while " "evaluating an assignment, the right-hand side is evaluated before the left-" "hand side." msgstr "" -"Python は、式を左から右へと順に評価します。\n" -"ただし、代入式を評価するときは、右辺が左辺よりも先に評価されます。" +"Python は式を左から右へ評価します。\n" +"ただし、代入を評価する際は、右辺を左辺より先に評価します。" #: ../../reference/expressions.rst:1980 msgid "" @@ -2662,7 +2817,6 @@ msgid "" msgstr "" "以下に示す実行文の各行での評価順序は、添え字の数字順序と同じになります::" -#: ../../reference/expressions.rst:1983 msgid "" "expr1, expr2, expr3, expr4\n" "(expr1, expr2, expr3, expr4)\n" @@ -2671,6 +2825,12 @@ msgid "" "expr1(expr2, expr3, *expr4, **expr5)\n" "expr3, expr4 = expr1, expr2" msgstr "" +"expr1, expr2, expr3, expr4\n" +"(expr1, expr2, expr3, expr4)\n" +"{expr1: expr2, expr3: expr4}\n" +"expr1 + expr2 * (expr3 - expr4)\n" +"expr1(expr2, expr3, *expr4, **expr5)\n" +"expr3, expr4 = expr1, expr2" #: ../../reference/expressions.rst:1994 msgid "Operator precedence" @@ -2865,7 +3025,6 @@ msgstr "代入式" msgid "Footnotes" msgstr "脚注" -#: ../../reference/expressions.rst:2062 msgid "" "While ``abs(x%y) < abs(y)`` is true mathematically, for floats it may not be " "true numerically due to roundoff. For example, and assuming a platform on " @@ -2876,14 +3035,15 @@ msgid "" "the first argument instead, and so returns ``-1e-100`` in this case. Which " "approach is more appropriate depends on the application." msgstr "" -"``abs(x%y) < abs(y)`` は数学的には真となりますが、浮動小数点に対する演算の場" -"合には、値丸め (roundoff) のために数値計算的に真にならない場合があります。例" -"えば、Python の浮動小数点型が IEEE754 倍精度数型になっているプラットフォーム" -"を仮定すると、 ``-1e-100 % 1e100`` は ``1e100`` と同じ符号になるはずなのに、" -"計算結果は ``-1e-100 + 1e100`` となります。これは数値計算的には厳密に " -"``1e100`` と等価です。関数 :func:`math.fmod` は、最初の引数と符号が一致するよ" -"うな値を返すので、上記の場合には ``-1e-100`` を返します。どちらのアプローチが" -"適切かは、アプリケーションに依存します。" +"``abs(x%y) < abs(y)`` は数学的には真ですが、浮動小数点数では丸めのために数値" +"的には成り立たない場合があります。\n" +"例えば、Python の float が IEEE 754 の倍精度数であるプラットフォームでは、\n" +"``-1e-100 % 1e100`` の符号を ``1e100`` と同じにするため、``-1e-100 + 1e100`` " +"を計算します。\n" +"これは数値的には ``1e100`` と厳密に等しくなります。\n" +"一方、:func:`math.fmod` は第 1 引数と同じ符号の結果を返すため、この場合は " +"``-1e-100`` を返します。\n" +"どちらが適切かはアプリケーションによります。" #: ../../reference/expressions.rst:2071 msgid "" @@ -3015,9 +3175,8 @@ msgstr "例外" msgid "NameError" msgstr "NameError" -#: ../../reference/expressions.rst:81 msgid "mangling" -msgstr "難号化" +msgstr "マングリング" #: ../../reference/expressions.rst:81 msgid "private" @@ -3064,9 +3223,8 @@ msgstr "丸括弧形式" msgid "() (parentheses)" msgstr "() (丸括弧)" -#: ../../reference/expressions.rst:161 msgid "tuple display" -msgstr "" +msgstr "タプル表示" #: ../../reference/expressions.rst:174 ../../reference/expressions.rst:274 msgid "empty" @@ -3097,21 +3255,18 @@ msgstr "内包表記" msgid "for" msgstr "for" -#: ../../reference/expressions.rst:205 ../../reference/expressions.rst:240 msgid "in comprehensions" -msgstr "" +msgstr "内包表記内" #: ../../reference/expressions.rst:205 ../../reference/expressions.rst:1872 msgid "if" msgstr "if" -#: ../../reference/expressions.rst:205 msgid "async for" -msgstr "" +msgstr "async for" -#: ../../reference/expressions.rst:240 ../../reference/expressions.rst:1205 msgid "await" -msgstr "" +msgstr "await" #: ../../reference/expressions.rst:274 ../../reference/expressions.rst:854 #: ../../reference/expressions.rst:883 ../../reference/expressions.rst:960 @@ -3128,14 +3283,11 @@ msgstr "表示" msgid "[] (square brackets)" msgstr "[] (角カッコ)" -#: ../../reference/expressions.rst:274 msgid "list expression" -msgstr "" +msgstr "リスト式" -#: ../../reference/expressions.rst:274 ../../reference/expressions.rst:300 -#: ../../reference/expressions.rst:1926 msgid "expression list" -msgstr "" +msgstr "式リスト" #: ../../reference/expressions.rst:300 msgid "set" @@ -3145,9 +3297,8 @@ msgstr "集合" msgid "{} (curly brackets)" msgstr "{} (波括弧)" -#: ../../reference/expressions.rst:300 msgid "set expression" -msgstr "" +msgstr "集合式" #: ../../reference/expressions.rst:328 ../../reference/expressions.rst:354 #: ../../reference/expressions.rst:883 @@ -3162,31 +3313,25 @@ msgstr "キー" msgid "value" msgstr "value" -#: ../../reference/expressions.rst:328 msgid "key/value pair" -msgstr "" +msgstr "キーと値のペア" -#: ../../reference/expressions.rst:328 msgid "dictionary expression" -msgstr "" +msgstr "辞書式" #: ../../reference/expressions.rst:328 ../../reference/expressions.rst:954 #: ../../reference/expressions.rst:1898 msgid ": (colon)" msgstr ": (コロン)" -#: ../../reference/expressions.rst:328 msgid "in dictionary expressions" -msgstr "" +msgstr "辞書式内" -#: ../../reference/expressions.rst:328 ../../reference/expressions.rst:354 msgid "in dictionary displays" -msgstr "" +msgstr "辞書表示内" -#: ../../reference/expressions.rst:354 ../../reference/expressions.rst:1087 -#: ../../reference/expressions.rst:1945 msgid "unpacking" -msgstr "" +msgstr "アンパック" #: ../../reference/expressions.rst:354 ../../reference/expressions.rst:1117 #: ../../reference/expressions.rst:1225 @@ -3227,9 +3372,8 @@ msgstr "関数" msgid "coroutine" msgstr "コルーチン" -#: ../../reference/expressions.rst:515 msgid "yield from expression" -msgstr "" +msgstr "yield from 式" #: ../../reference/expressions.rst:568 msgid "StopIteration" @@ -3243,13 +3387,11 @@ msgstr "GeneratorExit" msgid "examples" msgstr "例" -#: ../../reference/expressions.rst:742 msgid "asynchronous-generator" -msgstr "" +msgstr "非同期ジェネレータ" -#: ../../reference/expressions.rst:752 msgid "StopAsyncIteration" -msgstr "" +msgstr "StopAsyncIteration" #: ../../reference/expressions.rst:831 msgid "primary" @@ -3267,9 +3409,8 @@ msgstr "参照" msgid ". (dot)" msgstr ". (ドット)" -#: ../../reference/expressions.rst:845 msgid "attribute reference" -msgstr "" +msgstr "属性参照" #: ../../reference/expressions.rst:854 msgid "AttributeError" @@ -3343,9 +3484,8 @@ msgstr "引数 (argument)" msgid "call semantics" msgstr "call の意味付け" -#: ../../reference/expressions.rst:1004 msgid "argument list" -msgstr "" +msgstr "引数リスト" #: ../../reference/expressions.rst:1004 msgid "= (equals)" @@ -3405,9 +3545,8 @@ msgstr "instance" msgid "__call__() (object method)" msgstr "__call__() (オブジェクトメソッド)" -#: ../../reference/expressions.rst:1225 msgid "power" -msgstr "" +msgstr "べき乗" #: ../../reference/expressions.rst:1225 ../../reference/expressions.rst:1261 #: ../../reference/expressions.rst:1309 ../../reference/expressions.rst:1437 @@ -3475,21 +3614,18 @@ msgstr "~ (チルダ)" msgid "TypeError" msgstr "TypeError" -#: ../../reference/expressions.rst:1309 ../../reference/expressions.rst:1466 msgid "binary" -msgstr "2進数" +msgstr "二項" #: ../../reference/expressions.rst:1322 msgid "multiplication" msgstr "乗算" -#: ../../reference/expressions.rst:1339 msgid "matrix multiplication" -msgstr "" +msgstr "行列乗算" -#: ../../reference/expressions.rst:1339 msgid "@ (at)" -msgstr "" +msgstr "@ (アットマーク)" #: ../../reference/expressions.rst:1351 msgid "ZeroDivisionError" @@ -3660,21 +3796,17 @@ msgstr "Boolean" msgid "not" msgstr "not" -#: ../../reference/expressions.rst:1821 msgid ":= (colon equals)" -msgstr "" +msgstr ":= (コロンと等号)" -#: ../../reference/expressions.rst:1821 msgid "assignment expression" -msgstr "" +msgstr "代入式" -#: ../../reference/expressions.rst:1821 msgid "walrus operator" -msgstr "" +msgstr "walrus operator" -#: ../../reference/expressions.rst:1821 msgid "named expression" -msgstr "" +msgstr "名前付き式" #: ../../reference/expressions.rst:1821 msgid "assignment" @@ -3688,9 +3820,8 @@ msgstr "条件" msgid "ternary" msgstr "三項" -#: ../../reference/expressions.rst:1872 msgid "conditional expression" -msgstr "" +msgstr "条件式" #: ../../reference/expressions.rst:1872 msgid "else" @@ -3708,17 +3839,15 @@ msgstr "形式" msgid "anonymous" msgstr "無名" -#: ../../reference/expressions.rst:1898 msgid "lambda expression" -msgstr "" +msgstr "ラムダ式" #: ../../reference/expressions.rst:1945 msgid "iterable" msgstr "iterable" -#: ../../reference/expressions.rst:1945 msgid "in expression lists" -msgstr "" +msgstr "式リスト内" #: ../../reference/expressions.rst:1960 msgid "trailing" diff --git a/reference/grammar.po b/reference/grammar.po index 0619de0e7..a313af2de 100644 --- a/reference/grammar.po +++ b/reference/grammar.po @@ -18,26 +18,24 @@ msgstr "" "Last-Translator: Arihiro TAKASE, 2023\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../reference/grammar.rst:4 msgid "Full Grammar specification" msgstr "完全な文法仕様" -#: ../../reference/grammar.rst:6 msgid "" "This is the full Python grammar, derived directly from the grammar used to " "generate the CPython parser (see :source:`Grammar/python.gram`). The version " "here omits details related to code generation and error recovery." msgstr "" -"以下に示すのは Python の完全な文法です。CPython のパーサを生成するための文法" -"定義から直接導かれたものです (:source:`Grammar/python.gram` を参照のこと)。こ" -"こに示すのは、コード生成およびエラー処理に関係する部分を省略したバージョンで" -"す。" +"以下は Python の完全な文法で、CPython のパーサを生成するための文法から直接得" +"たものです (:source:`Grammar/python.gram` を参照)。\n" +"ここでは、コード生成とエラー回復に関する詳細を省略しています。" #: ../../reference/grammar.rst:11 msgid "" diff --git a/reference/import.po b/reference/import.po index feb4a6aef..7dc78cd14 100644 --- a/reference/import.po +++ b/reference/import.po @@ -19,10 +19,10 @@ msgstr "" "Last-Translator: tomo, 2023\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../reference/import.rst:6 @@ -227,7 +227,6 @@ msgstr "" "例えば、以下のようなファイルシステム配置は、3 つのサブパッケージを持つ最上位" "の ``parent`` パッケージを定義します::" -#: ../../reference/import.rst:111 msgid "" "parent/\n" " __init__.py\n" @@ -238,6 +237,14 @@ msgid "" " three/\n" " __init__.py" msgstr "" +"parent/\n" +" __init__.py\n" +" one/\n" +" __init__.py\n" +" two/\n" +" __init__.py\n" +" three/\n" +" __init__.py" #: ../../reference/import.rst:120 msgid "" @@ -255,7 +262,6 @@ msgstr "" msgid "Namespace packages" msgstr "名前空間パッケージ" -#: ../../reference/import.rst:135 msgid "" "A namespace package is a composite of various :term:`portions `, " "where each portion contributes a subpackage to the parent package. Portions " @@ -265,13 +271,13 @@ msgid "" "objects on the file system; they may be virtual modules that have no " "concrete representation." msgstr "" -"名前空間パッケージは様々な :term:`ポーション ` を寄せ集めたもので、" -"それぞれのポーションはサブパッケージを親パッケージに提供します。ポーションは" -"ファイルシステムの別々の場所にあることもあります。ポーションは、 zip ファイル" -"の中やネットワーク上や、それ以外のインポート時に Python が探すどこかの場所で" -"見つかることもあります。名前空間パッケージはファイルシステム上のオブジェクト" -"に対応することもあるし、そうでないこともあります; それらは実際の実体のない仮" -"想モジュールです。" +"名前空間パッケージはさまざまな :term:`ポーション ` を組み合わせたも" +"ので、それぞれのポーションが親パッケージにサブパッケージを提供します。\n" +"ポーションはファイルシステム上の別々の場所にあることもあります。\n" +"zip ファイル内、ネットワーク上など、インポート時に Python が検索する場所であ" +"れば、どこにあることも可能です。\n" +"名前空間パッケージはファイルシステム上のオブジェクトに直接対応するとは限ら" +"ず、具体的な実体を持たない仮想モジュールの場合もあります。" #: ../../reference/import.rst:143 msgid "" @@ -437,13 +443,13 @@ msgid "" msgstr "" "Python にはデフォルトのファインダーとインポーターがいくつかあります。 1 つ目" "のものは組み込みモジュールの見つけ方を知っていて、 2 つ目のものは凍結されたモ" -"ジュール (訳注: freeze ツールで処理されたモジュールのこと。 :doc:`プログラミ" -"ング FAQ <../faq/programming>` の「どうしたら Python スクリプトからスタンドア" -"ロンバイナリを作れますか?」の項目を参照) の見つけ方を知っています。 3 つ目の" -"ものは :term:`インポートパス ` からモジュールを探します。 :term:" -"`インポートパス ` はファイルシステムのパスや zip ファイルの位置" -"を示すリストです。このリストは、 URL で特定できるもののような、位置を示すこと" -"のできる任意のリソースの検索にまで拡張することもできます。" +"ジュール (訳注: freeze ツールで処理されたモジュールのこと。プログラミング " +"FAQ の「どうしたら Python スクリプトからスタンドアロンバイナリを作れます" +"か?」の項目を参照) の見つけ方を知っています。 3 つ目のものは :term:`インポー" +"トパス ` からモジュールを探します。 :term:`インポートパス " +"` はファイルシステムのパスや zip ファイルの位置を示すリストで" +"す。このリストは、 URL で特定できるもののような、位置を示すことのできる任意の" +"リソースの検索にまで拡張することもできます。" #: ../../reference/import.rst:232 msgid "" @@ -529,7 +535,6 @@ msgstr "" msgid "The meta path" msgstr "メタパス" -#: ../../reference/import.rst:282 msgid "" "When the named module is not found in :data:`sys.modules`, Python next " "searches :data:`sys.meta_path`, which contains a list of meta path finder " @@ -540,6 +545,16 @@ msgid "" "finder can use any strategy it wants to determine whether it can handle the " "named module or not." msgstr "" +"指定されたモジュールが :data:`sys.modules` に見つからない場合、Python は次に" +"メタパス・ファインダーのリスト :data:`sys.meta_path` を検索します。\n" +"各ファインダーに順番に問い合わせ、指定されたモジュールを扱えるかを調べま" +"す。\n" +"メタパス・ファインダーには :meth:`~importlib.abc.MetaPathFinder.find_spec` メ" +"ソッドが必要です。\n" +"このメソッドは、名前、インポートパス、および省略可能な対象モジュールという三" +"つの引数を取ります。\n" +"指定されたモジュールを扱えるかどうかの判断方法は、各メタパス・ファインダーが" +"自由に決められます。" #: ../../reference/import.rst:291 msgid "" @@ -556,7 +571,6 @@ msgstr "" "す。その他の送出された例外はそのまま呼び出し元に伝播され、インポート処理を異" "常終了させます。" -#: ../../reference/import.rst:297 msgid "" "The :meth:`~importlib.abc.MetaPathFinder.find_spec` method of meta path " "finders is called with two or three arguments. The first is the fully " @@ -569,6 +583,17 @@ msgid "" "existing module object that will be the target of loading later. The import " "system passes in a target module only during reload." msgstr "" +"メタパス・ファインダーの :meth:`~importlib.abc.MetaPathFinder.find_spec` メ" +"ソッドは、二つまたは三つの引数で呼び出されます。\n" +"最初の引数は、インポートするモジュールの完全修飾名 (例えば ``foo.bar.baz``) " +"です。\n" +"二番目の引数は、モジュールの検索に使うパスエントリです。\n" +"最上位のモジュールでは ``None`` ですが、サブモジュールやサブパッケージでは親" +"パッケージの ``__path__`` 属性の値になります。\n" +"必要な ``__path__`` 属性にアクセスできない場合は :exc:`ModuleNotFoundError` " +"が送出されます。\n" +"三番目の引数は、後でロードの対象となる既存のモジュールオブジェクトです。\n" +"インポートシステムが対象モジュールを渡すのは、リロード時だけです。" #: ../../reference/import.rst:308 msgid "" @@ -601,20 +626,18 @@ msgstr "" "のインポーターは、2 つ目の引数に ``None`` 以外のものが渡されたとき、常に " "``None`` を返します。" -#: ../../reference/import.rst:322 msgid "" "Python's default :data:`sys.meta_path` has three meta path finders, one that " "knows how to import built-in modules, one that knows how to import frozen " "modules, and one that knows how to import modules from an :term:`import " "path` (i.e. the :term:`path based finder`)." msgstr "" -"Python のデフォルトの :data:`sys.meta_path` は 3 つのパスファインダーを持って" -"います。組み込みモジュールのインポートの方法を知っているもの、凍結されたモ" -"ジュールのインポートの方法を知っているもの、 :term:`インポートパス ` からのモジュールのインポートの方法を知っているもの (つまり :term:`パス" -"ベース・ファインダー `) があります。" +"Python のデフォルトの :data:`sys.meta_path` には、三つのメタパス・ファイン" +"ダーがあります。\n" +"組み込みモジュール用、凍結されたモジュール用、および :term:`インポートパス " +"` からモジュールをインポートするためのもの (つまり :term:`パス" +"ベース・ファインダー `) です。" -#: ../../reference/import.rst:327 msgid "" "The :meth:`~importlib.abc.MetaPathFinder.find_spec` method of meta path " "finders replaced :meth:`!find_module`, which is now deprecated. While it " @@ -622,18 +645,25 @@ msgid "" "if the finder does not implement :meth:`~importlib.abc.MetaPathFinder." "find_spec`." msgstr "" +"メタパス・ファインダーの :meth:`~importlib.abc.MetaPathFinder.find_spec` メ" +"ソッドが :meth:`!find_module` に代わり、後者は非推奨になりました。\n" +"従来のメソッドは変更せずに使えますが、インポート機構が呼び出すのは、ファイン" +"ダーに :meth:`~importlib.abc.MetaPathFinder.find_spec` が実装されていない場合" +"だけです。" -#: ../../reference/import.rst:334 msgid "" "Use of :meth:`!find_module` by the import system now raises :exc:" "`ImportWarning`." msgstr "" +"インポートシステムが :meth:`!find_module` を使うと :exc:`ImportWarning` が発" +"生するようになりました。" -#: ../../reference/import.rst:338 msgid "" ":meth:`!find_module` has been removed. Use :meth:`~importlib.abc." "MetaPathFinder.find_spec` instead." msgstr "" +":meth:`!find_module` は削除されました。\n" +"代わりに :meth:`~importlib.abc.MetaPathFinder.find_spec` を使ってください。" #: ../../reference/import.rst:344 msgid "Loading" @@ -789,25 +819,24 @@ msgstr "" "て) Python モジュールだった場合、ローダーはモジュールのグローバル名前空間 " "(``module.__dict__``) で、モジュールのコードを実行すべきです。" -#: ../../reference/import.rst:427 msgid "" "If the loader cannot execute the module, it should raise an :exc:" "`ImportError`, although any other exception raised during :meth:`~importlib." "abc.Loader.exec_module` will be propagated." msgstr "" -":meth:`~importlib.abc.Loader.exec_module` の呼び出し中に :exc:`ImportError` " -"以外の例外が送出され、伝播されてきたとしても、モジュールをロードできない場合" -"は :exc:`ImportError` を送出すべきです。" +"ローダーがモジュールを実行できない場合は :exc:`ImportError` を送出すべきで" +"す。\n" +"ただし、:meth:`~importlib.abc.Loader.exec_module` の実行中にそれ以外の例外が" +"送出された場合も、その例外はそのまま伝播します。" -#: ../../reference/import.rst:431 msgid "" "In many cases, the finder and loader can be the same object; in such cases " "the :meth:`~importlib.abc.MetaPathFinder.find_spec` method would just return " "a spec with the loader set to ``self``." msgstr "" -"多くの場合、ファインダーとローダーは同じオブジェクトで構いません; そのような" -"場合では :meth:`~importlib.abc.MetaPathFinder.find_spec` メソッドは単に " -"``self`` (訳注: オブジェクト自身) を返すだけです。" +"多くの場合、ファインダーとローダーは同じオブジェクトで構いません。\n" +"その場合、:meth:`~importlib.abc.MetaPathFinder.find_spec` メソッドは、ロー" +"ダーに ``self`` を設定したモジュール仕様を返すだけです。" #: ../../reference/import.rst:435 msgid "" @@ -936,20 +965,21 @@ msgstr "" "``spam`` は値がサブモジュールに束縛された属性 ``foo`` を持ちます。以下のディ" "レクトリ構造を持っているとしましょう::" -#: ../../reference/import.rst:495 msgid "" "spam/\n" " __init__.py\n" " foo.py" msgstr "" +"spam/\n" +" __init__.py\n" +" foo.py" #: ../../reference/import.rst:499 msgid "and ``spam/__init__.py`` has the following line in it::" msgstr "そして ``spam/__init__.py`` は以下のようになっているとします::" -#: ../../reference/import.rst:501 msgid "from .foo import Foo" -msgstr "" +msgstr "from .foo import Foo" #: ../../reference/import.rst:503 msgid "" @@ -959,7 +989,6 @@ msgstr "" "このとき、以下を実行することにより ``spam`` モジュールの中に ``foo`` と " "``Foo`` に束縛された名前が置かれます::" -#: ../../reference/import.rst:506 msgid "" ">>> import spam\n" ">>> spam.foo\n" @@ -967,6 +996,11 @@ msgid "" ">>> spam.Foo\n" "" msgstr "" +">>> import spam\n" +">>> spam.foo\n" +"\n" +">>> spam.Foo\n" +"" #: ../../reference/import.rst:512 msgid "" @@ -982,9 +1016,8 @@ msgstr "" "foo']`` が存在する場合、後者が前者の ``foo`` 属性として存在しなければならない" "ということです。" -#: ../../reference/import.rst:521 msgid "Module specs" -msgstr "" +msgstr "モジュール仕様" #: ../../reference/import.rst:523 msgid "" @@ -1012,33 +1045,40 @@ msgstr "" "がロードの定型的な作業を実行できるようになるということです。これに対して、モ" "ジュール仕様なしではローダがその責任を担っていました。" -#: ../../reference/import.rst:534 msgid "" "The module's spec is exposed as :attr:`module.__spec__`. Setting :attr:`!" "__spec__` appropriately applies equally to :ref:`modules initialized during " "interpreter startup `. The one exception is ``__main__``, where :" "attr:`!__spec__` is :ref:`set to None in some cases `." msgstr "" +"モジュール仕様は :attr:`module.__spec__` で公開されます。\n" +":ref:`インタープリタの起動時に初期化されるモジュール ` でも、同様" +"に :attr:`!__spec__` を適切に設定します。\n" +"例外は ``__main__`` で、このモジュールの :attr:`!__spec__` は :ref:`場合に" +"よって None に設定されます `。" -#: ../../reference/import.rst:540 msgid "" "See :class:`~importlib.machinery.ModuleSpec` for details on the contents of " "the module spec." msgstr "" +"モジュール仕様の内容については :class:`~importlib.machinery.ModuleSpec` を参" +"照してください。" -#: ../../reference/import.rst:548 msgid "__path__ attributes on modules" -msgstr "" +msgstr "モジュールの __path__ 属性" -#: ../../reference/import.rst:550 msgid "" "The :attr:`~module.__path__` attribute should be a (possibly empty) :term:" "`sequence` of strings enumerating the locations where the package's " "submodules will be found. By definition, if a module has a :attr:`!__path__` " "attribute, it is a :term:`package`." msgstr "" +":attr:`~module.__path__` 属性は、パッケージのサブモジュールを探す場所を列挙し" +"た文字列の :term:`シーケンス ` (空でも構いません) である必要があり" +"ます。\n" +"定義上、:attr:`!__path__` 属性を持つモジュールは :term:`パッケージ " +"` です。" -#: ../../reference/import.rst:555 msgid "" "A package's :attr:`~module.__path__` attribute is used during imports of its " "subpackages. Within the import machinery, it functions much the same as :" @@ -1046,15 +1086,23 @@ msgid "" "during import. However, :attr:`!__path__` is typically much more constrained " "than :data:`!sys.path`." msgstr "" +"パッケージの :attr:`~module.__path__` 属性は、そのサブパッケージをインポート" +"するときに使われます。\n" +"インポート機構では :data:`sys.path` とほぼ同じ働きをし、インポート時にモ" +"ジュールを探す場所のリストを提供します。\n" +"ただし通常、:attr:`!__path__` に指定する場所は :data:`!sys.path` よりもはるか" +"に限定されています。" -#: ../../reference/import.rst:562 msgid "" "The same rules used for :data:`sys.path` also apply to a package's :attr:`!" "__path__`. :data:`sys.path_hooks` (described below) are consulted when " "traversing a package's :attr:`!__path__`." msgstr "" +":data:`sys.path` に適用される規則は、パッケージの :attr:`!__path__` にも適用" +"されます。\n" +"パッケージの :attr:`!__path__` を走査するときには、後述する :data:`sys." +"path_hooks` が参照されます。" -#: ../../reference/import.rst:566 msgid "" "A package's ``__init__.py`` file may set or alter the package's :attr:" "`~module.__path__` attribute, and this was typically the way namespace " @@ -1063,6 +1111,13 @@ msgid "" "containing only :attr:`!__path__` manipulation code; the import machinery " "automatically sets :attr:`!__path__` correctly for the namespace package." msgstr "" +"パッケージの ``__init__.py`` ファイルでは、パッケージの :attr:`~module." +"__path__` 属性を設定したり変更したりできます。\n" +":pep:`420` より前は、通常この方法で名前空間パッケージを実装していました。\n" +":pep:`420` の採用により、名前空間パッケージには :attr:`!__path__` を操作する" +"だけの ``__init__.py`` ファイルを用意する必要がなくなりました。\n" +"インポート機構が、名前空間パッケージの :attr:`!__path__` を自動的に正しく設定" +"します。" #: ../../reference/import.rst:575 msgid "Module reprs" @@ -1128,18 +1183,19 @@ msgstr "" msgid "Otherwise, just use the module's ``__name__`` in the repr." msgstr "そうでなければ、単にモジュールの ``__name__`` を repr の中で使います。" -#: ../../reference/import.rst:602 msgid "" "Use of :meth:`!module_repr`, having been deprecated since Python 3.4, was " "removed in Python 3.12 and is no longer called during the resolution of a " "module's repr." msgstr "" +"Python 3.4 から非推奨だった :meth:`!module_repr` の使用は Python 3.12 で廃止" +"されました。\n" +"モジュールの ``repr()`` 結果を決める際に呼び出されることはなくなりました。" #: ../../reference/import.rst:610 msgid "Cached bytecode invalidation" msgstr "キャッシュされたバイトコードの無効化" -#: ../../reference/import.rst:612 msgid "" "Before Python loads cached bytecode from a ``.pyc`` file, it checks whether " "the cache is up-to-date with the source ``.py`` file. By default, Python " @@ -1148,8 +1204,13 @@ msgid "" "cache file by checking the stored metadata in the cache file against the " "source's metadata." msgstr "" +"Python は ``.pyc`` ファイルからキャッシュ済みのバイトコードをロードする前に、" +"そのキャッシュがソースの ``.py`` ファイルに対して最新かどうかを確認します。\n" +"デフォルトでは、キャッシュファイルを書き込む際にソースの最終更新タイムスタン" +"プとサイズを記録することで、この確認を可能にしています。\n" +"実行時には、インポートシステムがキャッシュファイルに記録されたメタデータと" +"ソースのメタデータを照合して、キャッシュファイルが有効かどうかを判断します。" -#: ../../reference/import.rst:619 msgid "" "Python also supports \"hash-based\" cache files, which store a hash of the " "source file's contents rather than its metadata. There are two variants of " @@ -1162,12 +1223,27 @@ msgid "" "Hash-based ``.pyc`` files validation behavior may be overridden with the :" "option:`--check-hash-based-pycs` flag." msgstr "" +"Python は、ソースファイルのメタデータの代わりに内容のハッシュ値を記録する" +"「ハッシュベース」のキャッシュファイルもサポートしています。\n" +"ハッシュベースの ``.pyc`` ファイルには、チェックありとチェックなしの二種類が" +"あります。\n" +"チェックありの場合、Python はソースファイルのハッシュ値を計算し、キャッシュ" +"ファイル内のハッシュ値と比較して、キャッシュファイルが有効かどうかを確認しま" +"す。\n" +"無効と判断された場合はキャッシュを再生成し、新しいチェックありのハッシュベー" +"スのキャッシュファイルを書き込みます。\n" +"チェックなしの場合、Python は ``.pyc`` ファイルが存在すれば有効とみなしま" +"す。\n" +"ハッシュベースの ``.pyc`` ファイルを検証する動作は、:option:`--check-hash-" +"based-pycs` フラグで変更できます。" -#: ../../reference/import.rst:630 msgid "" "Added hash-based ``.pyc`` files. Previously, Python only supported timestamp-" "based invalidation of bytecode caches." msgstr "" +"ハッシュベースの ``.pyc`` ファイルを追加しました。\n" +"以前の Python は、タイムスタンプに基づくバイトコードキャッシュの無効化だけを" +"サポートしていました。" #: ../../reference/import.rst:636 msgid "The Path Based Finder" @@ -1224,7 +1300,6 @@ msgstr "" "パスエントリはファイルシステム上の場所に限定される必要はありません。URL や" "データベースクエリやその他文字列で指定できる場所を参照することも可能です。" -#: ../../reference/import.rst:662 msgid "" "The path based finder provides additional hooks and protocols so that you " "can extend and customize the types of searchable path entries. For example, " @@ -1234,13 +1309,13 @@ msgid "" "protocol described below, which was then used to get a loader for the module " "from the web." msgstr "" -"パスベース・ファインダーにはフックやプロトコルを追加することができ、それに" -"よって検索可能なパスエントリの種類を拡張し、カスタマイズすることができます。" -"例えば、ネットワーク上の URL をパスエントリとしてサポートしたい場合、 web 上" -"のモジュールを見つけるために HTTP の取り扱い方を実装したフックを書くことがで" -"きます。この (呼び出し可能オブジェクトである) フックは、下で解説するプロトコ" -"ルをサポートする :term:`パスエントリ・ファインダー ` を返" -"します。このプロトコルは web からモジュールのローダーを取得するのに使われま" +"パスベース・ファインダーは、検索できるパスエントリの種類を拡張・カスタマイズ" +"するための追加のフックやプロトコルを提供します。\n" +"例えば、ネットワーク上の URL をパスエントリとしてサポートするには、HTTP の処" +"理を実装してウェブ上のモジュールを探すフックを書けます。\n" +"このフック (呼び出し可能オブジェクト) は、後述するプロトコルをサポートした :" +"term:`パスエントリ・ファインダー ` を返します。\n" +"そのファインダーを使って、ウェブからモジュールをロードするローダーを取得しま" "す。" #: ../../reference/import.rst:670 @@ -1314,7 +1389,6 @@ msgstr "" "使います。さらにパッケージオブジェクトの ``__path__`` 属性も使います。これら" "によって、インポート処理をカスタマイズする方法が提供されます。" -#: ../../reference/import.rst:708 msgid "" ":data:`sys.path` contains a list of strings providing search locations for " "modules and packages. It is initialized from the :envvar:`PYTHONPATH` " @@ -1325,6 +1399,15 @@ msgid "" "database queries. Only strings should be present on :data:`sys.path`; all " "other data types are ignored." msgstr "" +":data:`sys.path` は、モジュールやパッケージの検索場所を示す文字列のリストで" +"す。\n" +"環境変数 :envvar:`PYTHONPATH` と、インストール環境や実装に固有のデフォルト値" +"から初期化されます。\n" +":data:`sys.path` の各エントリには、ファイルシステム上のディレクトリ、zip ファ" +"イルのほか、URL やデータベースクエリなど、モジュールを検索する別の「場所」を" +"指定することもできます (:mod:`site` モジュールを参照)。\n" +":data:`sys.path` に含めるのは文字列だけにしてください。\n" +"それ以外の型の値は無視されます。" #: ../../reference/import.rst:717 msgid "" @@ -1347,7 +1430,6 @@ msgstr "" "``None`` だった場合、それは最上位のインポートであることを示していて、 :data:" "`sys.path` が使われます。" -#: ../../reference/import.rst:726 msgid "" "The path based finder iterates over every entry in the search path, and for " "each of these, looks for an appropriate :term:`path entry finder` (:class:" @@ -1362,8 +1444,22 @@ msgid "" "cache entries from :data:`sys.path_importer_cache` forcing the path based " "finder to perform the path entry search again." msgstr "" +"パスベース・ファインダーは検索パスの各エントリを順に調べ、それぞれに適した :" +"term:`パスエントリ・ファインダー ` (:class:`~importlib." +"abc.PathEntryFinder`) を探します。\n" +"この処理には時間がかかる場合があります (例えば、検索のための ``stat()`` 呼び" +"出しにオーバーヘッドが生じます)。\n" +"そのため、パスベース・ファインダーはパスエントリとパスエントリ・ファインダー" +"の対応をキャッシュします。\n" +"このキャッシュは :data:`sys.path_importer_cache` に保存されます (名前に反し" +"て、保存するオブジェクトは :term:`インポーター ` に限らず、実際には" +"ファインダーです)。\n" +"これにより、特定の :term:`パスエントリ ` に対応する :term:`パスエ" +"ントリ・ファインダー ` を探す、コストの高い処理を一度だけ" +"にできます。\n" +"ユーザーコードは :data:`sys.path_importer_cache` のエントリを自由に削除して、" +"パスベース・ファインダーに再検索させることができます。" -#: ../../reference/import.rst:739 msgid "" "If the path entry is not present in the cache, the path based finder " "iterates over every callable in :data:`sys.path_hooks`. Each of the :term:" @@ -1378,19 +1474,20 @@ msgid "" "file system encoding, UTF-8, or something else), and if the hook cannot " "decode the argument, it should raise :exc:`ImportError`." msgstr "" -"path entry がキャッシュの中に無かった場合、 path based finder は :data:`sys." -"path_hooks` の中の呼び出し可能オブジェクトを全て辿ります。\n" -"このリストのそれぞれの :term:`path entry フック ` は、検索す" -"る path entry という引数 1 つを渡して呼び出されます。\n" -"その呼び出し可能オブジェクトは path entry を扱える :term:`path entry finder` " -"を返すか、 :exc:`ImportError` を送出します。\n" -":exc:`ImportError` は、フックが :term:`path entry` のための :term:`path " -"entry finder` を探せないことを報せるために path based finder が使います。\n" -"この例外は処理されず、 :term:`import path` を辿っていく処理が続けられます。\n" -"フックは引数として文字列またはバイト列オブジェクトを期待します;\n" -"バイト列オブジェクトのエンコーディングはフックに任されていて (例えば、ファイ" -"ルシステムのエンコーディングの UTF-8 やそれ以外などです) 、フックが引数をデ" -"コードできなかった場合は :exc:`ImportError` を送出すべきです。" +"パスエントリがキャッシュにない場合、パスベース・ファインダーは :data:`sys." +"path_hooks` にある呼び出し可能オブジェクトを順に調べます。\n" +"リスト内の各 :term:`パスエントリフック ` は、検索対象のパス" +"エントリを一つの引数として呼び出されます。\n" +"フックは、そのパスエントリを扱える :term:`パスエントリ・ファインダー ` を返すか、:exc:`ImportError` を送出します。\n" +"パスベース・ファインダーは、:exc:`ImportError` を、そのフックでは対象の :" +"term:`パスエントリ ` に対応する :term:`パスエントリ・ファイン" +"ダー ` が見つからないことを示すものとして扱います。\n" +"この例外は無視され、:term:`インポートパス ` の走査が続きます。\n" +"フックは文字列または bytes オブジェクトを受け取れるようにしてください。\n" +"bytes オブジェクトのエンコーディングはフックが決めます (ファイルシステムのエ" +"ンコーディング、UTF-8、またはそれ以外でも構いません)。\n" +"引数をデコードできない場合は :exc:`ImportError` を送出すべきです。" #: ../../reference/import.rst:753 msgid "" @@ -1409,17 +1506,16 @@ msgstr "" "finder>` はモジュールが見つからなかったことを伝えるために ``None`` を返しま" "す。" -#: ../../reference/import.rst:760 msgid "" "If a :term:`path entry finder` *is* returned by one of the :term:`path entry " "hook` callables on :data:`sys.path_hooks`, then the following protocol is " "used to ask the finder for a module spec, which is then used when loading " "the module." msgstr "" -":data:`sys.path_hooks` 上の :term:`パスエントリフック ` 呼び" -"出し可能オブジェクトの戻り値のいずれかが :term:`パスエントリ・ファインダー " -"` *であった* 場合、後で出てくるモジュール仕様を探すための" -"プロトコルが使われ、それがモジュールをロードするために使われます。" +":data:`sys.path_hooks` にある :term:`パスエントリフック ` の" +"いずれかが :term:`パスエントリ・ファインダー ` を *返した" +"* 場合、後述するプロトコルでそのファインダーにモジュール仕様を要求します。\n" +"得られたモジュール仕様を使って、モジュールをロードします。" #: ../../reference/import.rst:765 msgid "" @@ -1448,32 +1544,34 @@ msgstr "" "は :meth:`~importlib.abc.PathEntryFinder.find_spec` メソッドを実装しなければ" "いけません。" -#: ../../reference/import.rst:781 msgid "" ":meth:`~importlib.abc.PathEntryFinder.find_spec` takes two arguments: the " "fully qualified name of the module being imported, and the (optional) target " "module. ``find_spec()`` returns a fully populated spec for the module. This " "spec will always have \"loader\" set (with one exception)." msgstr "" -":meth:`~importlib.abc.PathEntryFinder.find_spec` は 2 つの引数を取ります。イ" -"ンポートしようとしているモジュールの完全修飾名と、 (オプションの) 対象モ" -"ジュールです。 `find_spec()` はモジュールに対応する完全に初期化 (populated) " -"された仕様を返します。この仕様は (1つの例外を除いて) 常に \"loader\" セットを" -"持っています。" +":meth:`~importlib.abc.PathEntryFinder.find_spec` は二つの引数を取ります。\n" +"インポートするモジュールの完全修飾名と、省略可能な対象モジュールです。\n" +"``find_spec()`` は、必要な情報をすべて設定したモジュール仕様を返します。\n" +"この仕様には、一つの例外を除き、必ず ``loader`` が設定されています。" -#: ../../reference/import.rst:786 msgid "" "To indicate to the import machinery that the spec represents a namespace :" "term:`portion`, the path entry finder sets ``submodule_search_locations`` to " "a list containing the portion." msgstr "" +"モジュール仕様が名前空間の :term:`ポーション ` を表すことをインポー" +"ト機構に伝えるには、パスエントリ・ファインダーが " +"``submodule_search_locations`` にそのポーションを含むリストを設定します。" -#: ../../reference/import.rst:790 msgid "" ":meth:`~importlib.abc.PathEntryFinder.find_spec` replaced :meth:`!" "find_loader` and :meth:`!find_module`, both of which are now deprecated, but " "will be used if ``find_spec()`` is not defined." msgstr "" +":meth:`~importlib.abc.PathEntryFinder.find_spec` が :meth:`!find_loader` と :" +"meth:`!find_module` に代わり、後者二つは非推奨になりました。\n" +"ただし、``find_spec()`` が定義されていない場合は引き続き使われます。" #: ../../reference/import.rst:796 msgid "" @@ -1488,12 +1586,16 @@ msgstr "" "エントリ・ファインダーに ``find_spec()`` が実装されていれば、古いメソッドは無" "視されます。" -#: ../../reference/import.rst:801 msgid "" ":meth:`!find_loader` takes one argument, the fully qualified name of the " "module being imported. ``find_loader()`` returns a 2-tuple where the first " "item is the loader and the second item is a namespace :term:`portion`." msgstr "" +":meth:`!find_loader` は、インポートするモジュールの完全修飾名を一つの引数とし" +"て取ります。\n" +"``find_loader()`` は二要素のタプルを返します。\n" +"最初の要素はローダー、二番目の要素は名前空間の :term:`ポーション ` " +"です。" #: ../../reference/import.rst:806 msgid "" @@ -1526,15 +1628,15 @@ msgstr "" "システムは常に ``find_module()`` よりも ``find_loader()`` を優先して呼び出し" "ます。" -#: ../../reference/import.rst:819 msgid "" "Calls to :meth:`!find_module` and :meth:`!find_loader` by the import system " "will raise :exc:`ImportWarning`." msgstr "" +"インポートシステムによる :meth:`!find_module` と :meth:`!find_loader` の呼び" +"出しで、:exc:`ImportWarning` が発生するようになりました。" -#: ../../reference/import.rst:824 msgid "``find_module()`` and ``find_loader()`` have been removed." -msgstr "" +msgstr "``find_module()`` と ``find_loader()`` は削除されました。" #: ../../reference/import.rst:829 msgid "Replacing the standard import system" @@ -1563,7 +1665,6 @@ msgstr "" "るだけで十分です。この手法は、ある 1 つのモジュール内だけで import 文の動作を" "変更するのにも用いられます。" -#: ../../reference/import.rst:841 msgid "" "To selectively prevent the import of some modules from a hook early on the " "meta path (rather than disabling the standard import system entirely), it is " @@ -1572,26 +1673,28 @@ msgid "" "latter indicates that the meta path search should continue, while raising an " "exception terminates it immediately." msgstr "" -"(標準のインポートシステム全体を停止するのではなく) すでにメタパスにいるフック" -"からあるモジュールのインポートを選択的に防ぐためには、 :meth:`~importlib.abc." -"MetaPathFinder.find_spec` から ``None`` を返す代わりに、直接 :exc:" -"`ModuleNotFoundError` を送出するだけで十分です。 ``None`` を返すのはメタパス" -"の走査を続けるべきであることを意味しますが、例外を送出するとすぐに走査を打ち" -"切ります。" +"標準のインポートシステム全体を無効にせず、一部のモジュールのインポートだけを" +"防ぐには、メタパスの先頭に近い位置にあるフックで処理します。\n" +":meth:`~importlib.abc.MetaPathFinder.find_spec` から ``None`` を返す代わり" +"に、直接 :exc:`ModuleNotFoundError` を送出すれば十分です。\n" +"``None`` はメタパスの検索を続けることを意味しますが、例外を送出すると検索は直" +"ちに終了します。" -#: ../../reference/import.rst:851 msgid "Package Relative Imports" -msgstr "" +msgstr "パッケージの相対インポート" -#: ../../reference/import.rst:853 msgid "" "Relative imports use leading dots. A single leading dot indicates a relative " "import, starting with the current package. Two or more leading dots indicate " "a relative import to the parent(s) of the current package, one level per dot " "after the first. For example, given the following package layout::" msgstr "" +"相対インポートでは先頭にドットを付けます。\n" +"ドット一つは、現在のパッケージを起点とする相対インポートを表します。\n" +"ドットが二つ以上の場合は、最初のドットを除くドット一つにつき一階層ずつ、現在" +"のパッケージの上位を起点にします。\n" +"例えば、次のようなパッケージ構成があるとします。 ::" -#: ../../reference/import.rst:858 msgid "" "package/\n" " __init__.py\n" @@ -1604,14 +1707,24 @@ msgid "" " moduleZ.py\n" " moduleA.py" msgstr "" +"package/\n" +" __init__.py\n" +" subpackage1/\n" +" __init__.py\n" +" moduleX.py\n" +" moduleY.py\n" +" subpackage2/\n" +" __init__.py\n" +" moduleZ.py\n" +" moduleA.py" -#: ../../reference/import.rst:869 msgid "" "In either ``subpackage1/moduleX.py`` or ``subpackage1/__init__.py``, the " "following are valid relative imports::" msgstr "" +"``subpackage1/moduleX.py`` と ``subpackage1/__init__.py`` のどちらでも、次の" +"相対インポートは有効です。 ::" -#: ../../reference/import.rst:872 msgid "" "from .moduleY import spam\n" "from .moduleY import spam as ham\n" @@ -1620,23 +1733,32 @@ msgid "" "from ..subpackage2.moduleZ import eggs\n" "from ..moduleA import foo" msgstr "" +"from .moduleY import spam\n" +"from .moduleY import spam as ham\n" +"from . import moduleY\n" +"from ..subpackage1 import moduleY\n" +"from ..subpackage2.moduleZ import eggs\n" +"from ..moduleA import foo" -#: ../../reference/import.rst:879 msgid "" "Absolute imports may use either the ``import <>`` or ``from <> import <>`` " "syntax, but relative imports may only use the second form; the reason for " "this is that::" msgstr "" +"絶対インポートには ``import <>`` と ``from <> import <>`` のどちらの構文も使" +"えますが、相対インポートに使えるのは後者だけです。\n" +"この理由を、次の文で考えてみます。 ::" -#: ../../reference/import.rst:883 msgid "import XXX.YYY.ZZZ" -msgstr "" +msgstr "import XXX.YYY.ZZZ" -#: ../../reference/import.rst:885 msgid "" "should expose ``XXX.YYY.ZZZ`` as a usable expression, but .moduleY is not a " "valid expression." msgstr "" +"この文を実行すると、``XXX.YYY.ZZZ`` を式として使えるようになる必要がありま" +"す。\n" +"一方、``.moduleY`` は有効な式ではありません。" #: ../../reference/import.rst:892 msgid "Special considerations for __main__" @@ -1763,12 +1885,15 @@ msgstr "" "オリジナルの :data:`sys.meta_path` の仕様は :pep:`302` で、その後継となる拡張" "が :pep:`420` です。" -#: ../../reference/import.rst:947 msgid "" ":pep:`420` introduced :term:`namespace packages ` for " "Python 3.3. :pep:`420` also introduced the :meth:`!find_loader` protocol as " "an alternative to :meth:`!find_module`." msgstr "" +":pep:`420` は Python 3.3 に :term:`名前空間パッケージ ` を" +"導入しました。\n" +"また、:pep:`420` は :meth:`!find_module` の代替として :meth:`!find_loader` プ" +"ロトコルも導入しました。" #: ../../reference/import.rst:951 msgid "" @@ -1898,9 +2023,8 @@ msgstr "パス" msgid "sys.meta_path" msgstr "sys.meta_path" -#: ../../reference/import.rst:278 msgid "find_spec" -msgstr "" +msgstr "find_spec" #: ../../reference/import.rst:638 msgid "path based finder" diff --git a/reference/index.po b/reference/index.po index a70c452cc..ff539ad1f 100644 --- a/reference/index.po +++ b/reference/index.po @@ -17,10 +17,10 @@ msgstr "" "Last-Translator: Osamu NAKAMURA, 2021\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../reference/index.rst:5 diff --git a/reference/introduction.po b/reference/introduction.po index 97e0ff7bb..559576cef 100644 --- a/reference/introduction.po +++ b/reference/introduction.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: Arihiro TAKASE, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../reference/introduction.rst:6 @@ -144,23 +144,22 @@ msgstr "" msgid "Python for .NET" msgstr "Python for .NET" -#: ../../reference/introduction.rst:60 msgid "" "This implementation actually uses the CPython implementation, but is a " "managed .NET application and makes .NET libraries available. It was created " "by Brian Lloyd. For more information, see the `Python for .NET home page " "`_." msgstr "" -"この実装は内部ではCPythonを使用していますが、 .NETアプリケーションによって管" -"理されているので、 .NETライブラリを参照することが可能です。この実装はBrian " -"Lloydによって作成されました。さらなる情報については、 `Python for .NET home " -"page `_ を参照してください。" +"この実装は内部では CPython を使いますが、それ自体がマネージド .NET アプリケー" +"ションであり、.NET ライブラリを利用できます。\n" +"Brian Lloyd が作成しました。\n" +"詳しくは `Python for .NET home page `_ を参照し" +"てください。" #: ../../reference/introduction.rst:65 msgid "IronPython" msgstr "IronPython" -#: ../../reference/introduction.rst:66 msgid "" "An alternate Python for .NET. Unlike Python.NET, this is a complete Python " "implementation that generates IL, and compiles Python code directly to .NET " @@ -168,11 +167,12 @@ msgid "" "For more information, see `the IronPython website `_." msgstr "" -".NETでPythonを使用するためのもう一つの実装です。Python.NETとは異なり、完全に" -"ILを生成することができるPythonの実装あり、直接Pythonコードを.NETアセンブリに" -"コンパイルします。これはJythonの初代の開発者であるJim Huguninによって作られま" -"した。さらなる情報については `the IronPython website `_ を参照してください。" +".NET 向けのもう一つの Python 実装です。\n" +"Python.NET とは異なり、IL を生成して Python コードを直接 .NET アセンブリにコ" +"ンパイルする、完全な Python 実装です。\n" +"Jython の最初の開発者である Jim Hugunin が作成しました。\n" +"詳しくは `the IronPython website `_ を参照してくださ" +"い。" #: ../../reference/introduction.rst:71 msgid "PyPy" @@ -195,7 +195,6 @@ msgstr "" "ことです。さらなる情報は `the PyPy project's home page `_ " "にあります。" -#: ../../reference/introduction.rst:79 msgid "" "Each of these implementations varies in some way from the language as " "documented in this manual, or introduces specific information beyond what's " @@ -203,10 +202,10 @@ msgid "" "implementation-specific documentation to determine what else you need to " "know about the specific implementation you're using." msgstr "" -"これらの各実装はこのマニュアルで文書化された言語とは多少異なっている、もしく" -"は、標準のPythonドキュメントと何処が異なっているかを定めた情報が公開されてい" -"るでしょう。あなたが使用している実装上で、代替手段を使う必要があるかどうかを" -"判断するためには、各実装の仕様書を参照してください。" +"これらの実装はそれぞれ、このマニュアルに記載された言語と何らかの違いがある" +"か、Python の標準ドキュメントの範囲を超える固有の情報があります。\n" +"使用する実装についてほかに知っておくべきことは、その実装固有のドキュメントを" +"参照してください。" #: ../../reference/introduction.rst:89 msgid "Notation" @@ -306,9 +305,8 @@ msgstr "構文" msgid "notation" msgstr "記法" -#: ../../reference/introduction.rst:118 msgid "lexical definitions" -msgstr "字句解析" +msgstr "字句定義" #: ../../reference/introduction.rst:118 msgid "ASCII" diff --git a/reference/lexical_analysis.po b/reference/lexical_analysis.po index 78ccf6885..1c309804a 100644 --- a/reference/lexical_analysis.po +++ b/reference/lexical_analysis.po @@ -24,10 +24,10 @@ msgstr "" "Last-Translator: Takeshi Nakazato, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../reference/lexical_analysis.rst:6 @@ -146,29 +146,31 @@ msgstr "" "行目もコメントのみの行でなければなりません。エンコード宣言式として推奨する形" "式は ::" -#: ../../reference/lexical_analysis.rst:92 msgid "# -*- coding: -*-" -msgstr "" +msgstr "# -*- coding: -*-" #: ../../reference/lexical_analysis.rst:94 msgid "which is recognized also by GNU Emacs, and ::" msgstr "これは GNU Emacs で認識できます。または ::" -#: ../../reference/lexical_analysis.rst:96 msgid "# vim:fileencoding=" -msgstr "" +msgstr "# vim:fileencoding=" #: ../../reference/lexical_analysis.rst:98 msgid "which is recognized by Bram Moolenaar's VIM." msgstr "これは、Bram Moolenar による VIM が認識できる形式です。" -#: ../../reference/lexical_analysis.rst:100 msgid "" "If no encoding declaration is found, the default encoding is UTF-8. If the " "implicit or explicit encoding of a file is UTF-8, an initial UTF-8 byte-" "order mark (``b'\\xef\\xbb\\xbf'``) is ignored rather than being a syntax " "error." msgstr "" +"エンコード宣言が見つからなければ、デフォルトのエンコーディングは UTF-8 で" +"す。\n" +"ファイルのエンコーディングが暗黙的または明示的に UTF-8 となっている場合、先頭" +"の UTF-8 バイトオーダーマーク (``b'\\xef\\xbb\\xbf'``) は構文エラーにならず、" +"無視されます。" #: ../../reference/lexical_analysis.rst:104 msgid "" @@ -199,13 +201,16 @@ msgstr "" "行を構成し、バックスラッシュおよびバックスラッシュの後ろにある行末文字を削除" "します。例えば::" -#: ../../reference/lexical_analysis.rst:123 msgid "" "if 1900 < year < 2100 and 1 <= month <= 12 \\\n" " and 1 <= day <= 31 and 0 <= hour < 24 \\\n" " and 0 <= minute < 60 and 0 <= second < 60: # Looks like a valid date\n" " return 1" msgstr "" +"if 1900 < year < 2100 and 1 <= month <= 12 \\\n" +" and 1 <= day <= 31 and 0 <= hour < 24 \\\n" +" and 0 <= minute < 60 and 0 <= second < 60: # 有効な日時のように見える\n" +" return 1" #: ../../reference/lexical_analysis.rst:128 msgid "" @@ -226,22 +231,24 @@ msgstr "" msgid "Implicit line joining" msgstr "非明示的な行継続" -#: ../../reference/lexical_analysis.rst:140 msgid "" "Expressions in parentheses, square brackets or curly braces can be split " "over more than one physical line without using backslashes. For example::" msgstr "" -"丸括弧 (parentheses)、角括弧 (square bracket) 、および波括弧 (curly brace) 内" -"の式は、バックスラッシュを使わずに一行以上の物理行に分割することができます。" -"例えば::" +"丸括弧、角括弧、波括弧の中の式は、バックスラッシュを使わずに複数の物理行に分" +"割できます。\n" +"例えば次のように書きます。 ::" -#: ../../reference/lexical_analysis.rst:143 msgid "" "month_names = ['Januari', 'Februari', 'Maart', # These are the\n" " 'April', 'Mei', 'Juni', # Dutch names\n" " 'Juli', 'Augustus', 'September', # for the months\n" " 'Oktober', 'November', 'December'] # of the year" msgstr "" +"month_names = ['Januari', 'Februari', 'Maart', # これらは\n" +" 'April', 'Mei', 'Juni', # オランダ語の\n" +" 'Juli', 'Augustus', 'September', # 各月の\n" +" 'Oktober', 'November', 'December'] # 名前" #: ../../reference/lexical_analysis.rst:148 msgid "" @@ -261,7 +268,6 @@ msgstr "" msgid "Blank lines" msgstr "空行" -#: ../../reference/lexical_analysis.rst:162 msgid "" "A logical line that contains only spaces, tabs, formfeeds and possibly a " "comment, is ignored (i.e., no :data:`~token.NEWLINE` token is generated). " @@ -271,6 +277,12 @@ msgid "" "containing not even whitespace or a comment) terminates a multi-line " "statement." msgstr "" +"スペース、タブ、フォームフィードと、省略可能なコメントだけを含む論理行は無視" +"されます (つまり :data:`~token.NEWLINE` トークンは生成されません)。\n" +"対話的に文を入力する場合、空行の扱いは読み込み・評価・表示ループの実装によっ" +"て異なる場合があります。\n" +"標準の対話型インタープリタでは、完全に空の論理行 (空白もコメントも含まない" +"行) が複数行の文を終端させます。" #: ../../reference/lexical_analysis.rst:174 msgid "Indentation" @@ -286,7 +298,6 @@ msgstr "" "デントレベルを計算するために使われます。インデントレベルは、実行文のグループ" "化方法を決定するために用いられます。" -#: ../../reference/lexical_analysis.rst:182 msgid "" "Tabs are replaced (from left to right) by one to eight spaces such that the " "total number of characters up to and including the replacement is a multiple " @@ -296,11 +307,12 @@ msgid "" "lines using backslashes; the whitespace up to the first backslash determines " "the indentation." msgstr "" -"タブは (左から右の方向に) 1 つにつき 8 つのスペースで置き換えられ、置き換え後" -"の文字数は 8 の倍数になります (Unix で使われている規則と同じになるよう意図さ" -"れています)。そして、最初の非空白文字までのスペースの総数が、その行のインデン" -"トを決定します。インデントは、バックスラッシュで複数の物理行に分割できませ" -"ん; 最初のバックスラッシュまでの空白がインデントを決定します。" +"タブは左から右へ、置き換えた部分までの文字数が 8 の倍数になるように、1 個か" +"ら 8 個のスペースに置き換えられます (Unix と同じ規則を意図しています)。\n" +"最初の非空白文字より前にあるスペースの総数で、その行のインデントが決まりま" +"す。\n" +"インデントをバックスラッシュで複数の物理行に分割することはできません。\n" +"最初のバックスラッシュまでの空白がインデントを決めます。" #: ../../reference/lexical_analysis.rst:190 msgid "" @@ -312,17 +324,17 @@ msgstr "" "に依存するようなら、インデントは不合理なものとして却下されます。その場合は :" "exc:`TabError` が送出されます。" -#: ../../reference/lexical_analysis.rst:194 msgid "" "**Cross-platform compatibility note:** because of the nature of text editors " "on non-UNIX platforms, it is unwise to use a mixture of spaces and tabs for " "the indentation in a single source file. It should also be noted that " "different platforms may explicitly limit the maximum indentation level." msgstr "" -"**プラットフォーム間の互換性に関する注意:** 非 UNIX プラットフォームにおける" -"テキストエディタの性質上、一つのソースファイル内でタブとインデントを混在させ" -"て使うのは賢明ではありません。また、プラットフォームによっては、最大インデン" -"トレベルを明示的に制限しているかもしれません。" +"**プラットフォーム間の互換性に関する注意:** 非 UNIX プラットフォームのテキス" +"トエディタの性質上、1 つのソースファイルのインデントにスペースとタブを混在さ" +"せるのは避けるべきです。\n" +"また、プラットフォームによっては最大インデントレベルを明示的に制限している場" +"合があります。" #: ../../reference/lexical_analysis.rst:199 msgid "" @@ -336,13 +348,13 @@ msgstr "" "の他の場所にある場合、その影響は未定義です (例えば、スペースの数を 0 にリセッ" "トするかもしれません)。" -#: ../../reference/lexical_analysis.rst:206 msgid "" "The indentation levels of consecutive lines are used to generate :data:" "`~token.INDENT` and :data:`~token.DEDENT` tokens, using a stack, as follows." msgstr "" +"連続する行のインデントレベルから、スタックを使って :data:`~token.INDENT` トー" +"クンと :data:`~token.DEDENT` トークンを次のように生成します。" -#: ../../reference/lexical_analysis.rst:210 msgid "" "Before the first line of the file is read, a single zero is pushed on the " "stack; this will never be popped off again. The numbers pushed on the stack " @@ -356,6 +368,19 @@ msgid "" "token is generated for each number remaining on the stack that is larger " "than zero." msgstr "" +"ファイルの最初の行を読む前に、スタックに 0 を 1 個積みます。\n" +"この 0 を取り除くことはありません。\n" +"スタックに積まれた数値は、常に下から上へ厳密に増加します。\n" +"各論理行の先頭で、その行のインデントレベルをスタックの最上部と比較します。\n" +"等しければ何もしません。\n" +"大きければその値をスタックに積み、:data:`!INDENT` トークンを 1 個生成しま" +"す。\n" +"小さければ、その値はスタック内のいずれかの数値と一致しなければ *なりません" +"*。\n" +"その値より大きい数値をすべてスタックから取り除き、取り除いた数値ごとに :data:" +"`!DEDENT` トークンを 1 個生成します。\n" +"ファイルの終端では、スタックに残っている 0 より大きい数値ごとに :data:`!" +"DEDENT` トークンを 1 個生成します。" #: ../../reference/lexical_analysis.rst:221 msgid "" @@ -365,7 +390,6 @@ msgstr "" "以下の例に正しく (しかし当惑させるように) インデントされた Python コードの一" "部を示します::" -#: ../../reference/lexical_analysis.rst:224 msgid "" "def perm(l):\n" " # Compute the list of all permutations of l\n" @@ -379,12 +403,22 @@ msgid "" " r.append(l[i:i+1] + x)\n" " return r" msgstr "" +"def perm(l):\n" +" # l のすべての順列のリストを計算する\n" +" if len(l) <= 1:\n" +" return [l]\n" +" r = []\n" +" for i in range(len(l)):\n" +" s = l[:i] + l[i+1:]\n" +" p = perm(s)\n" +" for x in p:\n" +" r.append(l[i:i+1] + x)\n" +" return r" #: ../../reference/lexical_analysis.rst:236 msgid "The following example shows various indentation errors::" msgstr "以下の例は、様々なインデントエラーになります::" -#: ../../reference/lexical_analysis.rst:238 msgid "" " def perm(l): # error: first line indented\n" "for i in range(len(l)): # error: not indented\n" @@ -394,6 +428,14 @@ msgid "" " r.append(l[i:i+1] + x)\n" " return r # error: inconsistent dedent" msgstr "" +" def perm(l): # エラー: 最初の行がインデントされてい" +"る\n" +"for i in range(len(l)): # エラー: インデントされていない\n" +" s = l[:i] + l[i+1:]\n" +" p = perm(l[:i] + l[i+1:]) # エラー: 予期しないインデント\n" +" for x in p:\n" +" r.append(l[i:i+1] + x)\n" +" return r # エラー: インデントの戻し方が不整合" #: ../../reference/lexical_analysis.rst:246 msgid "" @@ -420,21 +462,20 @@ msgid "" "token." msgstr "" -#: ../../reference/lexical_analysis.rst:267 msgid "End marker" -msgstr "" +msgstr "終端マーカー" -#: ../../reference/lexical_analysis.rst:269 msgid "" "At the end of non-interactive input, the lexical analyzer generates an :data:" "`~token.ENDMARKER` token." msgstr "" +"非対話的な入力の終端で、字句解析器は :data:`~token.ENDMARKER` トークンを生成" +"します。" #: ../../reference/lexical_analysis.rst:276 msgid "Other tokens" msgstr "その他のトークン" -#: ../../reference/lexical_analysis.rst:278 msgid "" "Besides :data:`~token.NEWLINE`, :data:`~token.INDENT` and :data:`~token." "DEDENT`, the following categories of tokens exist: *identifiers* and " @@ -445,6 +486,14 @@ msgid "" "tokens. Where ambiguity exists, a token comprises the longest possible " "string that forms a legal token, when read from left to right." msgstr "" +":data:`~token.NEWLINE`、:data:`~token.INDENT`、:data:`~token.DEDENT` のほか" +"に、*識別子* と *キーワード* (:data:`~token.NAME`)、*リテラル* (:data:" +"`~token.NUMBER` や :data:`~token.STRING` など)、その他の記号 (*演算子* と *デ" +"リミタ*、:data:`~token.OP`) という種類のトークンがあります。\n" +"空白文字は、前述の論理行の終端を除いてトークンではなく、トークンを区切る役割" +"を持ちます。\n" +"曖昧さがある場合は、左から右に読んだときに有効なトークンとなる最長の文字列を " +"1 個のトークンとします。" #: ../../reference/lexical_analysis.rst:292 msgid "Identifiers and keywords" @@ -564,7 +613,6 @@ msgstr "" "して使われ、通常の識別子として使うことはできません。キーワードは厳密に下記の" "通りに綴らなければなりません:" -#: ../../reference/lexical_analysis.rst:358 msgid "" "False await else import pass\n" "None break except in raise\n" @@ -574,6 +622,13 @@ msgid "" "assert del global not with\n" "async elif if or yield" msgstr "" +"False await else import pass\n" +"None break except in raise\n" +"True class finally is return\n" +"and continue for lambda try\n" +"as def from nonlocal while\n" +"assert del global not with\n" +"async elif if or yield" #: ../../reference/lexical_analysis.rst:372 msgid "Soft Keywords" @@ -587,12 +642,13 @@ msgid "" "is done at the parser level, not when tokenizing." msgstr "" -#: ../../reference/lexical_analysis.rst:383 msgid "" "As soft keywords, their use in the grammar is possible while still " "preserving compatibility with existing code that uses these names as " "identifier names." msgstr "" +"ソフトキーワードにすることで、これらの名前を識別子として使う既存のコードとの" +"互換性を保ちながら、文法の一部として使えます。" #: ../../reference/lexical_analysis.rst:387 msgid "" @@ -600,9 +656,8 @@ msgid "" "``type`` is used in the :keyword:`type` statement." msgstr "" -#: ../../reference/lexical_analysis.rst:390 msgid "``type`` is now a soft keyword." -msgstr "" +msgstr "``type`` がソフトキーワードになりました。" #: ../../reference/lexical_analysis.rst:399 msgid "Reserved classes of identifiers" @@ -625,29 +680,34 @@ msgstr "``_*``" msgid "Not imported by ``from module import *``." msgstr "" -#: ../../reference/lexical_analysis.rst:408 msgid "``_``" -msgstr "" +msgstr "``_``" -#: ../../reference/lexical_analysis.rst:409 msgid "" "In a ``case`` pattern within a :keyword:`match` statement, ``_`` is a :ref:" "`soft keyword ` that denotes a :ref:`wildcard `." msgstr "" +":keyword:`match` 文の ``case`` パターンの中で、``_`` は :ref:`ワイルドカード " +"` を表す :ref:`ソフトキーワード ` です。" -#: ../../reference/lexical_analysis.rst:413 msgid "" "Separately, the interactive interpreter makes the result of the last " "evaluation available in the variable ``_``. (It is stored in the :mod:" "`builtins` module, alongside built-in functions like ``print``.)" msgstr "" +"これとは別に、対話型インタープリタでは最後の評価結果を変数 ``_`` で参照できま" +"す。\n" +"(``print`` などの組み込み関数と同じく、:mod:`builtins` モジュールに格納されま" +"す。)" -#: ../../reference/lexical_analysis.rst:418 msgid "" "Elsewhere, ``_`` is a regular identifier. It is often used to name " "\"special\" items, but it is not special to Python itself." msgstr "" +"それ以外の場所では、``_`` は通常の識別子です。\n" +"「特別な」ものの名前によく使われますが、Python 自体が特別に扱うわけではありま" +"せん。" #: ../../reference/lexical_analysis.rst:423 msgid "" @@ -658,15 +718,13 @@ msgstr "" "名前 ``_`` は、しばしば国際化 (internationalization) と共に用いられます; この" "慣習についての詳しい情報は、 :mod:`gettext` を参照してください。" -#: ../../reference/lexical_analysis.rst:427 msgid "It is also commonly used for unused variables." -msgstr "" +msgstr "使わない変数の名前にもよく使われます。" #: ../../reference/lexical_analysis.rst:429 msgid "``__*__``" msgstr "``__*__``" -#: ../../reference/lexical_analysis.rst:430 msgid "" "System-defined names, informally known as \"dunder\" names. These names are " "defined by the interpreter and its implementation (including the standard " @@ -675,13 +733,15 @@ msgid "" "Python. *Any* use of ``__*__`` names, in any context, that does not follow " "explicitly documented use, is subject to breakage without warning." msgstr "" -"システムで定義された (system-defined) 名前です。非公式には\"dunder\"な名前と" -"呼ばれます(訳注: double underscoresの略)。これらの名前はインタープリタと (標" -"準ライブラリを含む) 実装上で定義されています。 現行のシステムでの名前は :ref:" -"`specialnames` などで話題に挙げられています。 Python の将来のバージョンではよ" -"り多くの名前が定義されることになります。このドキュメントで明記されている用法" -"に従わない、 *あらゆる* ``__*__`` の名前は、いかなるコンテキストにおける利用" -"でも、警告無く損害を引き起こすことがあります。 " +"システムで定義された名前で、非公式には \"dunder\" 名と呼ばれます (double " +"underscores の略)。\n" +"これらはインタープリタとその実装 (標準ライブラリを含む) が定義します。\n" +"現在のシステム定義の名前については :ref:`specialnames` などで説明していま" +"す。\n" +"Python の将来のバージョンでは、さらに多くの名前が定義される可能性がありま" +"す。\n" +"明示的に文書化された用法に従わない ``__*__`` 名の *あらゆる* 使用は、どの文脈" +"であっても、予告なく動作しなくなる可能性があります。" #: ../../reference/lexical_analysis.rst:437 msgid "``__*``" @@ -810,9 +870,8 @@ msgstr "" "\" とは、文字列の囲みを開始するときに使った文字を示し、``'`` か ``\"`` のいず" "れかです。)" -#: ../../reference/lexical_analysis.rst:567 msgid "Escape sequences" -msgstr "" +msgstr "エスケープシーケンス" #: ../../reference/lexical_analysis.rst:569 msgid "" @@ -839,9 +898,8 @@ msgstr "意味" msgid "Notes" msgstr "注釈" -#: ../../reference/lexical_analysis.rst:576 msgid "``\\``\\ " -msgstr "" +msgstr "``\\``\\ " #: ../../reference/lexical_analysis.rst:576 msgid "Backslash and newline ignored" @@ -931,9 +989,8 @@ msgstr "``\\v``" msgid "ASCII Vertical Tab (VT)" msgstr "ASCII 垂直タブ (VT)" -#: ../../reference/lexical_analysis.rst:598 msgid ":samp:`\\\\\\\\{ooo}`" -msgstr "" +msgstr ":samp:`\\\\\\\\{ooo}`" #: ../../reference/lexical_analysis.rst:598 msgid "Character with octal value *ooo*" @@ -943,9 +1000,8 @@ msgstr "8 進数値 *ooo* を持つ文字" msgid "(2,4)" msgstr "" -#: ../../reference/lexical_analysis.rst:601 msgid ":samp:`\\\\x{hh}`" -msgstr "" +msgstr ":samp:`\\\\x{hh}`" #: ../../reference/lexical_analysis.rst:601 msgid "Character with hex value *hh*" @@ -959,9 +1015,8 @@ msgstr "" msgid "Escape sequences only recognized in string literals are:" msgstr "文字列でのみ認識されるエスケープシーケンスは以下のとおりです:" -#: ../../reference/lexical_analysis.rst:609 msgid ":samp:`\\\\N\\\\{{name}\\\\}`" -msgstr "" +msgstr ":samp:`\\\\N\\\\{{name}\\\\}`" #: ../../reference/lexical_analysis.rst:609 msgid "Character named *name* in the Unicode database" @@ -971,9 +1026,8 @@ msgstr "Unicode データベース中で *name* という名前の文字" msgid "\\(5)" msgstr "\\(5)" -#: ../../reference/lexical_analysis.rst:612 msgid ":samp:`\\\\u{xxxx}`" -msgstr "" +msgstr ":samp:`\\\\u{xxxx}`" #: ../../reference/lexical_analysis.rst:612 msgid "Character with 16-bit hex value *xxxx*" @@ -983,9 +1037,8 @@ msgstr "16-bit の十六進値 *xxxx* を持つ文字" msgid "\\(6)" msgstr "\\(6)" -#: ../../reference/lexical_analysis.rst:615 msgid ":samp:`\\\\U{xxxxxxxx}`" -msgstr "" +msgstr ":samp:`\\\\U{xxxxxxxx}`" #: ../../reference/lexical_analysis.rst:615 msgid "Character with 32-bit hex value *xxxxxxxx*" @@ -999,23 +1052,25 @@ msgstr "\\(7)" msgid "Notes:" msgstr "注釈:" -#: ../../reference/lexical_analysis.rst:622 msgid "A backslash can be added at the end of a line to ignore the newline::" -msgstr "" +msgstr "行末にバックスラッシュを付けると、改行を無視できます。 ::" -#: ../../reference/lexical_analysis.rst:624 msgid "" ">>> 'This string will not include \\\n" "... backslashes or newline characters.'\n" "'This string will not include backslashes or newline characters.'" msgstr "" +">>> 'This string will not include \\\n" +"... backslashes or newline characters.'\n" +"'This string will not include backslashes or newline characters.'" -#: ../../reference/lexical_analysis.rst:628 msgid "" "The same result can be achieved using :ref:`triple-quoted strings " "`, or parentheses and :ref:`string literal concatenation `." msgstr "" +":ref:`三重クォート文字列 ` や、丸括弧と :ref:`文字列リテラルの連結 " +"` を使っても同じ結果を得られます。" #: ../../reference/lexical_analysis.rst:633 msgid "As in Standard C, up to three octal digits are accepted." @@ -1080,9 +1135,9 @@ msgstr "" "ケンスは、バイト列リテラルには、認識されないエスケープシーケンスとして分類さ" "れるので注意してください。" -#: ../../reference/lexical_analysis.rst:673 msgid "Unrecognized escape sequences produce a :exc:`DeprecationWarning`." msgstr "" +"認識されないエスケープシーケンスは :exc:`DeprecationWarning` を出します。" #: ../../reference/lexical_analysis.rst:676 msgid "" @@ -1131,12 +1186,14 @@ msgstr "" "離して複数行にまたがらせたり、あるいは部分文字列ごとにコメントを追加すること" "さえできます。例えば::" -#: ../../reference/lexical_analysis.rst:702 msgid "" "re.compile(\"[A-Za-z_]\" # letter or underscore\n" " \"[A-Za-z0-9_]*\" # letter, digit or underscore\n" " )" msgstr "" +"re.compile(\"[A-Za-z_]\" # 英字またはアンダースコア\n" +" \"[A-Za-z0-9_]*\" # 英字、数字またはアンダースコア\n" +" )" #: ../../reference/lexical_analysis.rst:706 msgid "" @@ -1154,9 +1211,8 @@ msgstr "" "きます) 、フォーマット済み文字列リテラルと通常の文字列リテラルを結合したりす" "ることもできますので注意してください。" -#: ../../reference/lexical_analysis.rst:729 msgid "f-strings" -msgstr "" +msgstr "f-strings" #: ../../reference/lexical_analysis.rst:733 msgid "" @@ -1332,18 +1388,20 @@ msgid "" "'line = \"The mill\\'s closed\" '" msgstr "" -#: ../../reference/lexical_analysis.rst:851 msgid "" "Reusing the outer f-string quoting type inside a replacement field is " "permitted::" msgstr "" +"置換フィールドの中で、外側の f-string と同じ種類の引用符を使えます。 ::" -#: ../../reference/lexical_analysis.rst:854 msgid "" ">>> a = dict(x=2)\n" ">>> f\"abc {a[\"x\"]} def\"\n" "'abc 2 def'" msgstr "" +">>> a = dict(x=2)\n" +">>> f\"abc {a[\"x\"]} def\"\n" +"'abc 2 def'" #: ../../reference/lexical_analysis.rst:858 msgid "" @@ -1351,13 +1409,13 @@ msgid "" "inside a replacement field was not possible." msgstr "" -#: ../../reference/lexical_analysis.rst:862 msgid "" "Backslashes are also allowed in replacement fields and are evaluated the " "same way as in any other context::" msgstr "" +"置換フィールドの中ではバックスラッシュも使え、他の文脈と同じように評価されま" +"す。 ::" -#: ../../reference/lexical_analysis.rst:865 msgid "" ">>> a = [\"a\", \"b\", \"c\"]\n" ">>> print(f\"List a contains:\\n{\"\\n\".join(a)}\")\n" @@ -1366,6 +1424,12 @@ msgid "" "b\n" "c" msgstr "" +">>> a = [\"a\", \"b\", \"c\"]\n" +">>> print(f\"List a contains:\\n{\"\\n\".join(a)}\")\n" +"List a contains:\n" +"a\n" +"b\n" +"c" #: ../../reference/lexical_analysis.rst:872 msgid "" @@ -1473,9 +1537,8 @@ msgid "Underscores are now allowed for grouping purposes in literals." msgstr "" "グループ化を目的としたリテラル中のアンダースコアが許されるようになりました。" -#: ../../reference/lexical_analysis.rst:962 msgid "Floating-point literals" -msgstr "" +msgstr "浮動小数点数リテラル" #: ../../reference/lexical_analysis.rst:964 msgid "" @@ -1599,9 +1662,8 @@ msgstr "" msgid "lexical analysis" msgstr "字句解析" -#: ../../reference/lexical_analysis.rst:8 msgid "parser" -msgstr "``parser``" +msgstr "パーザ" #: ../../reference/lexical_analysis.rst:8 msgid "token" @@ -1651,9 +1713,8 @@ msgstr "ソースコード文字セット" msgid "encoding declarations (source file)" msgstr "encoding declarations (source file)" -#: ../../reference/lexical_analysis.rst:82 msgid "source encoding declaration" -msgstr "" +msgstr "ソースのエンコード宣言" #: ../../reference/lexical_analysis.rst:115 msgid "line continuation" @@ -1716,17 +1777,14 @@ msgstr "キーワード" msgid "reserved word" msgstr "予約語" -#: ../../reference/lexical_analysis.rst:374 msgid "soft keyword" -msgstr "" +msgstr "ソフトキーワード" -#: ../../reference/lexical_analysis.rst:393 msgid "_, identifiers" -msgstr "" +msgstr "_, 識別子" -#: ../../reference/lexical_analysis.rst:393 msgid "__, identifiers" -msgstr "" +msgstr "__, 識別子" #: ../../reference/lexical_analysis.rst:449 msgid "literal" @@ -1750,21 +1808,17 @@ msgstr "バイト列リテラル" msgid "ASCII" msgstr "ASCII" -#: ../../reference/lexical_analysis.rst:454 msgid "' (single quote)" -msgstr "" +msgstr "' (シングルクォート)" -#: ../../reference/lexical_analysis.rst:454 msgid "\" (double quote)" -msgstr "" +msgstr "\" (ダブルクォート)" -#: ../../reference/lexical_analysis.rst:454 msgid "u'" -msgstr "" +msgstr "u'" -#: ../../reference/lexical_analysis.rst:454 msgid "u\"" -msgstr "" +msgstr "u\"" #: ../../reference/lexical_analysis.rst:495 msgid "triple-quoted string" @@ -1778,46 +1832,35 @@ msgstr "Unicode コンソーシアム" msgid "raw string" msgstr "raw 文字列" -#: ../../reference/lexical_analysis.rst:495 msgid "\"\"\"" -msgstr "" +msgstr "\"\"\"" -#: ../../reference/lexical_analysis.rst:495 msgid "'''" -msgstr "" +msgstr "'''" -#: ../../reference/lexical_analysis.rst:508 msgid "b'" -msgstr "" +msgstr "b'" -#: ../../reference/lexical_analysis.rst:508 msgid "b\"" -msgstr "" +msgstr "b\"" -#: ../../reference/lexical_analysis.rst:517 msgid "r'" -msgstr "" +msgstr "r'" -#: ../../reference/lexical_analysis.rst:517 msgid "raw string literal" -msgstr "" +msgstr "raw 文字列リテラル" -#: ../../reference/lexical_analysis.rst:517 msgid "r\"" -msgstr "" +msgstr "r\"" -#: ../../reference/lexical_analysis.rst:535 msgid "f'" -msgstr "" +msgstr "f'" -#: ../../reference/lexical_analysis.rst:535 -#: ../../reference/lexical_analysis.rst:713 msgid "formatted string literal" -msgstr "" +msgstr "フォーマット済み文字列リテラル" -#: ../../reference/lexical_analysis.rst:535 msgid "f\"" -msgstr "" +msgstr "f\"" #: ../../reference/lexical_analysis.rst:548 msgid "escape sequence" @@ -1831,9 +1874,8 @@ msgstr "標準 C" msgid "C" msgstr "C" -#: ../../reference/lexical_analysis.rst:548 msgid "\\ (backslash)" -msgstr "" +msgstr "\\ (バックスラッシュ)" #: ../../reference/lexical_analysis.rst:548 msgid "\\\\" @@ -1883,37 +1925,32 @@ msgstr "\\U" msgid "unrecognized escape sequence" msgstr "認識されなかったエスケープシーケンス" -#: ../../reference/lexical_analysis.rst:713 msgid "interpolated string literal" -msgstr "" +msgstr "補間文字列リテラル" #: ../../reference/lexical_analysis.rst:713 msgid "string" msgstr "string" -#: ../../reference/lexical_analysis.rst:713 msgid "formatted literal" -msgstr "" +msgstr "フォーマット済みリテラル" -#: ../../reference/lexical_analysis.rst:713 msgid "interpolated literal" -msgstr "" +msgstr "補間リテラル" #: ../../reference/lexical_analysis.rst:713 msgid "f-string" msgstr "f-string" -#: ../../reference/lexical_analysis.rst:713 msgid "fstring" -msgstr "" +msgstr "fstring" #: ../../reference/lexical_analysis.rst:713 msgid "{} (curly brackets)" msgstr "{} (波括弧)" -#: ../../reference/lexical_analysis.rst:713 msgid "in formatted string literal" -msgstr "" +msgstr "フォーマット済み文字列リテラル内" #: ../../reference/lexical_analysis.rst:713 msgid "! (exclamation)" @@ -1927,9 +1964,8 @@ msgstr ": (コロン)" msgid "= (equals)" msgstr "= (等号)" -#: ../../reference/lexical_analysis.rst:713 msgid "for help in debugging using string literals" -msgstr "" +msgstr "文字列リテラルを使ったデバッグの補助" #: ../../reference/lexical_analysis.rst:896 msgid "number" @@ -1944,9 +1980,8 @@ msgstr "数値リテラル" msgid "integer literal" msgstr "整数リテラル" -#: ../../reference/lexical_analysis.rst:896 msgid "floating-point literal" -msgstr "" +msgstr "浮動小数点数リテラル" #: ../../reference/lexical_analysis.rst:896 msgid "hexadecimal literal" @@ -1972,40 +2007,32 @@ msgstr "虚数リテラル" msgid "complex literal" msgstr "複素数リテラル" -#: ../../reference/lexical_analysis.rst:909 msgid "0b" -msgstr "" +msgstr "0b" -#: ../../reference/lexical_analysis.rst:909 msgid "0o" -msgstr "" +msgstr "0o" -#: ../../reference/lexical_analysis.rst:909 msgid "0x" -msgstr "" +msgstr "0x" #: ../../reference/lexical_analysis.rst:909 #: ../../reference/lexical_analysis.rst:955 msgid "_ (underscore)" msgstr "_ (下線)" -#: ../../reference/lexical_analysis.rst:909 -#: ../../reference/lexical_analysis.rst:955 -#: ../../reference/lexical_analysis.rst:987 msgid "in numeric literal" -msgstr "" +msgstr "数値リテラル内" #: ../../reference/lexical_analysis.rst:955 msgid ". (dot)" msgstr ". (ドット)" -#: ../../reference/lexical_analysis.rst:955 msgid "e" -msgstr "" +msgstr "e" -#: ../../reference/lexical_analysis.rst:987 msgid "j" -msgstr "" +msgstr "j" #: ../../reference/lexical_analysis.rst:1013 msgid "operators" diff --git a/reference/simple_stmts.po b/reference/simple_stmts.po index 79feb5d74..a2484d54e 100644 --- a/reference/simple_stmts.po +++ b/reference/simple_stmts.po @@ -25,10 +25,10 @@ msgstr "" "Last-Translator: Takeshi Nakazato, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../reference/simple_stmts.rst:6 @@ -100,16 +100,16 @@ msgstr "" "(*attributeref*, *subscription*, *slicing* の構文については :ref:`primaries` " "節を参照してください。)" -#: ../../reference/simple_stmts.rst:100 msgid "" "An assignment statement evaluates the expression list (remember that this " "can be a single expression or a comma-separated list, the latter yielding a " "tuple) and assigns the single resulting object to each of the target lists, " "from left to right." msgstr "" -"代入文は式のリスト (これは単一の式でも、カンマで区切られた式リストでもよく、" -"後者はタプルになることを思い出してください) を評価し、得られたそれぞれのオブ" -"ジェクトをターゲット (target) のリストに対して左から右へと代入してゆきます。" +"代入文は式リストを評価し、結果として得られた一つのオブジェクトを、各ターゲッ" +"トリストに左から右へ代入します。\n" +"式リストは単一の式の場合も、カンマで区切った式のリストの場合もあり、後者はタ" +"プルになります。" #: ../../reference/simple_stmts.rst:109 msgid "" @@ -253,13 +253,16 @@ msgstr "" "属性を参照し、左辺は新しいインスタンス属性を代入のターゲットとして生成するよ" "うなとき::" -#: ../../reference/simple_stmts.rst:179 msgid "" "class Cls:\n" " x = 3 # class variable\n" "inst = Cls()\n" "inst.x = inst.x + 1 # writes inst.x as 4 leaving Cls.x as 3" msgstr "" +"class Cls:\n" +" x = 3 # クラス変数\n" +"inst = Cls()\n" +"inst.x = inst.x + 1 # Cls.x は 3 のままで、inst.x を 4 にする" #: ../../reference/simple_stmts.rst:184 msgid "" @@ -299,7 +302,6 @@ msgstr "" "す (添字指定されたシーケンスに代入を行っても、リスト要素の新たな追加はできま" "せん)。" -#: ../../reference/simple_stmts.rst:211 msgid "" "If the primary is a mapping object (such as a dictionary), the subscript " "must have a type compatible with the mapping's key type, and the mapping is " @@ -308,6 +310,12 @@ msgid "" "the same key value, or insert a new key/value pair (if no key with the same " "value existed)." msgstr "" +"一次語が辞書などのマッピングオブジェクトの場合、添字の型はマッピングのキーの" +"型と互換性がなければなりません。\n" +"次に、その添字を代入するオブジェクトに対応付けるキーと値のペアを作るよう、" +"マッピングに要求します。\n" +"同じキーの値を持つ既存のペアを置き換えるか、同じ値のキーがなければ新しいペア" +"を挿入します。" #: ../../reference/simple_stmts.rst:217 msgid "" @@ -362,13 +370,16 @@ msgstr "" "*どうし* のオーバーラップは左から右へ起こり、混乱の元です。例えば、以下のプロ" "グラムは ``[0, 2]`` を出力してしまいます::" -#: ../../reference/simple_stmts.rst:246 msgid "" "x = [0, 1]\n" "i = 0\n" "i, x[i] = 1, 2 # i is updated, then x[i] is updated\n" "print(x)" msgstr "" +"x = [0, 1]\n" +"i = 0\n" +"i, x[i] = 1, 2 # i を更新し、その後 x[i] を更新する\n" +"print(x)" #: ../../reference/simple_stmts.rst:254 msgid ":pep:`3132` - Extended Iterable Unpacking" @@ -406,7 +417,6 @@ msgstr "" "式リストを評価し、それら二つの被演算子間で特定の累算代入型の二項演算を行い、" "結果をもとのターゲットに代入します。ターゲットは一度しか評価されません。" -#: ../../reference/simple_stmts.rst:296 msgid "" "An augmented assignment statement like ``x += 1`` can be rewritten as ``x = " "x + 1`` to achieve a similar, but not exactly equal effect. In the augmented " @@ -414,6 +424,12 @@ msgid "" "operation is performed *in-place*, meaning that rather than creating a new " "object and assigning that to the target, the old object is modified instead." msgstr "" +"``x += 1`` のような累算代入文は、``x = x + 1`` と書き換えて似た効果を得られま" +"すが、まったく同じではありません。\n" +"累算代入では ``x`` を一度しか評価しません。\n" +"また、可能な場合は *インプレース* で演算を行います。\n" +"つまり、新しいオブジェクトを作成してターゲットに代入する代わりに、既存のオブ" +"ジェクトを変更します。" #: ../../reference/simple_stmts.rst:302 msgid "" @@ -439,14 +455,13 @@ msgstr "" "二項演算は、場合によって *インプレース演算* が行われることを除き、通常の二項" "演算と同じです。" -#: ../../reference/simple_stmts.rst:313 msgid "" "For targets which are attribute references, the same :ref:`caveat about " "class and instance attributes ` applies as for regular " "assignments." msgstr "" -"属性参照のターゲットの場合、 :ref:`クラス属性とインスタンス属性についての注" -"意 ` と同様に通常の代入が適用されます。" +"ターゲットが属性参照の場合、通常の代入と同じ :ref:`クラス属性とインスタンス属" +"性に関する注意点 ` が当てはまります。" #: ../../reference/simple_stmts.rst:320 msgid "Annotated assignment statements" @@ -468,7 +483,6 @@ msgid "" msgstr "" "通常の :ref:`assignment` との違いは、代入先が 1 つに限定されることだけです。" -#: ../../reference/simple_stmts.rst:336 msgid "" "The assignment target is considered \"simple\" if it consists of a single " "name that is not enclosed in parentheses. For simple assignment targets, if " @@ -477,12 +491,20 @@ msgid "" "be evaluated using the :attr:`~object.__annotations__` attribute of a class " "or module, or using the facilities in the :mod:`annotationlib` module." msgstr "" +"代入先が、丸括弧で囲まれていない単一の名前である場合、その代入先は「単純」と" +"見なされます。\n" +"クラスまたはモジュールのスコープにある単純な代入先については、アノテーション" +"が遅延評価される :ref:`アノテーションスコープ ` に集められ" +"ます。\n" +"アノテーションは、クラスやモジュールの :attr:`~object.__annotations__` 属性、" +"または :mod:`annotationlib` モジュールの機能を使って評価できます。" -#: ../../reference/simple_stmts.rst:345 msgid "" "If the assignment target is not simple (an attribute, subscript node, or " "parenthesized name), the annotation is never evaluated." msgstr "" +"代入先が単純でない場合 (属性、添字ノード、丸括弧で囲まれた名前の場合)、アノ" +"テーションは評価されません。" #: ../../reference/simple_stmts.rst:348 msgid "" @@ -493,7 +515,6 @@ msgstr "" "カルなものになります。\n" "注釈は絶対に評価されず、関数スコープにも格納されません。" -#: ../../reference/simple_stmts.rst:351 msgid "" "If the right hand side is present, an annotated assignment performs the " "actual assignment as if there was no annotation present. If the right hand " @@ -501,6 +522,11 @@ msgid "" "the target except for the last :meth:`~object.__setitem__` or :meth:`~object." "__setattr__` call." msgstr "" +"右辺がある場合、注釈付き代入はアノテーションがない場合と同じように実際の代入" +"を行います。\n" +"式を代入先とし、右辺がない場合、インタープリタは最後の :meth:`~object." +"__setitem__` または :meth:`~object.__setattr__` の呼び出しを除いて代入先を評" +"価します。" #: ../../reference/simple_stmts.rst:359 msgid ":pep:`526` - Syntax for Variable Annotations" @@ -528,19 +554,22 @@ msgstr "" ":mod:`typing` モジュールを追加し、静的解析ツールや IDE で使える型アノテーショ" "ンの標準的な文法を提供する提案。" -#: ../../reference/simple_stmts.rst:369 msgid "" "Now annotated assignments allow the same expressions in the right hand side " "as regular assignments. Previously, some expressions (like un-parenthesized " "tuple expressions) caused a syntax error." msgstr "" +"注釈付き代入の右辺で、通常の代入と同じ式を使えるようになりました。\n" +"以前は、丸括弧で囲まないタプル式など、一部の式が構文エラーになっていました。" -#: ../../reference/simple_stmts.rst:374 msgid "" "Annotations are now lazily evaluated in a separate :ref:`annotation scope " "`. If the assignment target is not simple, annotations " "are never evaluated." msgstr "" +"アノテーションを、独立した :ref:`アノテーションスコープ ` " +"で遅延評価するようになりました。\n" +"代入先が単純でない場合、アノテーションは評価されません。" #: ../../reference/simple_stmts.rst:382 msgid "The :keyword:`!assert` statement" @@ -554,30 +583,28 @@ msgstr "" "assert 文は、プログラム内にデバッグ用アサーション (debugging assertion) を仕" "掛けるための便利な方法です:" -#: ../../reference/simple_stmts.rst:395 msgid "The simple form, ``assert expression``, is equivalent to ::" -msgstr "単純な形式 ``assert expression`` は ::" +msgstr "単純な形式 ``assert expression`` は、次のコードと等価です。 ::" -#: ../../reference/simple_stmts.rst:397 msgid "" "if __debug__:\n" " if not expression: raise AssertionError" msgstr "" +"if __debug__:\n" +" if not expression: raise AssertionError" -#: ../../reference/simple_stmts.rst:400 msgid "" "The extended form, ``assert expression1, expression2``, is equivalent to ::" msgstr "" -"と等価です。拡張形式 ``assert expression1, expression2`` は、これと等価で" -"す ::" +"拡張形式 ``assert expression1, expression2`` は、次のコードと等価です。 ::" -#: ../../reference/simple_stmts.rst:402 msgid "" "if __debug__:\n" " if not expression1: raise AssertionError(expression2)" msgstr "" +"if __debug__:\n" +" if not expression1: raise AssertionError(expression2)" -#: ../../reference/simple_stmts.rst:409 msgid "" "These equivalences assume that :const:`__debug__` and :exc:`AssertionError` " "refer to the built-in variables with those names. In the current " @@ -589,6 +616,14 @@ msgid "" "that failed in the error message; it will be displayed as part of the stack " "trace." msgstr "" +"これらの等価性は、:const:`__debug__` と :exc:`AssertionError` が、それぞれ同" +"名の組み込み変数を参照していることを前提としています。\n" +"現在の実装では、組み込み変数 ``__debug__`` は通常 ``True`` で、最適化を要求し" +"た場合 (コマンドラインオプション :option:`-O`) は ``False`` です。\n" +"現在のコード生成器は、コンパイル時に最適化を要求すると :keyword:`assert` 文に" +"対してコードを生成しません。\n" +"失敗した式のソースコードはスタックトレースの一部として表示されるため、エラー" +"メッセージに含める必要はありません。" #: ../../reference/simple_stmts.rst:418 msgid "" @@ -608,16 +643,18 @@ msgid "" "happens. It is useful as a placeholder when a statement is required " "syntactically, but no code needs to be executed, for example::" msgstr "" -":keyword:`pass` はヌル操作 (null operation) です --- :keyword:`pass` が実行さ" -"れても、何も起きません。 :keyword:`pass` は、構文法的には文が必要だが、コード" -"としては何も実行したくない場合のプレースホルダとして有用です。例えば::" +":keyword:`pass` はヌル操作 (null operation) です --- ``pass`` が実行されて" +"も、何も起きません。 ``pass`` は、構文法的には文が必要だが、コードとしては何" +"も実行したくない場合のプレースホルダとして有用です。例えば::" -#: ../../reference/simple_stmts.rst:439 msgid "" "def f(arg): pass # a function that does nothing (yet)\n" "\n" "class C: pass # a class with no methods (yet)" msgstr "" +"def f(arg): pass # (今のところ) 何もしない関数\n" +"\n" +"class C: pass # (今のところ) メソッドを持たないクラス" #: ../../reference/simple_stmts.rst:447 msgid "The :keyword:`!del` statement" @@ -737,31 +774,34 @@ msgstr "" msgid "The :keyword:`!yield` statement" msgstr ":keyword:`!yield` 文" -#: ../../reference/simple_stmts.rst:535 msgid "" "A :keyword:`yield` statement is semantically equivalent to a :ref:`yield " "expression `. The ``yield`` statement can be used to omit the " "parentheses that would otherwise be required in the equivalent yield " "expression statement. For example, the yield statements ::" msgstr "" +":keyword:`yield` 文は、意味的には :ref:`yield 式 ` と等価です。\n" +"``yield`` 文を使うと、等価な yield 式の式文で必要になる丸括弧を省けます。\n" +"例えば、次の yield 文について考えます。 ::" -#: ../../reference/simple_stmts.rst:540 msgid "" "yield \n" "yield from " msgstr "" +"yield \n" +"yield from " #: ../../reference/simple_stmts.rst:543 msgid "are equivalent to the yield expression statements ::" msgstr "は以下の yield 式文と等価です ::" -#: ../../reference/simple_stmts.rst:545 msgid "" "(yield )\n" "(yield from )" msgstr "" +"(yield )\n" +"(yield from )" -#: ../../reference/simple_stmts.rst:548 msgid "" "Yield expressions and statements are only used when defining a :term:" "`generator` function, and are only used in the body of the generator " @@ -769,6 +809,10 @@ msgid "" "cause that definition to create a generator function instead of a normal " "function." msgstr "" +"yield 式と yield 文は :term:`ジェネレータ ` 関数を定義するときだけ" +"使い、ジェネレータ関数の本体の中にだけ記述します。\n" +"関数定義で :keyword:`yield` を使うだけで、その定義は通常の関数ではなくジェネ" +"レータ関数を作成するようになります。" #: ../../reference/simple_stmts.rst:553 msgid "" @@ -782,13 +826,16 @@ msgstr "" msgid "The :keyword:`!raise` statement" msgstr ":keyword:`!raise` 文" -#: ../../reference/simple_stmts.rst:570 msgid "" "If no expressions are present, :keyword:`raise` re-raises the exception that " "is currently being handled, which is also known as the *active exception*. " "If there isn't currently an active exception, a :exc:`RuntimeError` " "exception is raised indicating that this is an error." msgstr "" +"式がない場合、:keyword:`raise` は現在処理中の例外を再送出します。\n" +"この例外は *アクティブな例外* とも呼ばれます。\n" +"現在アクティブな例外がない場合は、それがエラーであることを示す :exc:" +"`RuntimeError` を送出します。" #: ../../reference/simple_stmts.rst:575 msgid "" @@ -810,7 +857,6 @@ msgstr "" "例外の :dfn:`型` は例外インスタンスのクラスで、 :dfn:`値` はインスタンスその" "ものです。" -#: ../../reference/simple_stmts.rst:585 msgid "" "A traceback object is normally created automatically when an exception is " "raised and attached to it as the :attr:`~BaseException.__traceback__` " @@ -819,12 +865,17 @@ msgid "" "returns the same exception instance, with its traceback set to its " "argument), like so::" msgstr "" +"通常、例外を送出するとトレースバックオブジェクトが自動的に作られ、例外の :" +"attr:`~BaseException.__traceback__` 属性に設定されます。\n" +"例外の :meth:`~BaseException.with_traceback` メソッドを使うと、例外の作成と独" +"自のトレースバックの設定を一度に行えます。\n" +"このメソッドは、引数の値をトレースバックとして設定した、同じ例外インスタンス" +"を返します。\n" +"次のように使います。 ::" -#: ../../reference/simple_stmts.rst:591 msgid "raise Exception(\"foo occurred\").with_traceback(tracebackobj)" -msgstr "" +msgstr "raise Exception(\"foo occurred\").with_traceback(tracebackobj)" -#: ../../reference/simple_stmts.rst:597 msgid "" "The ``from`` clause is used for exception chaining: if given, the second " "*expression* must be another exception class or instance. If the second " @@ -835,8 +886,15 @@ msgid "" "raised exception as the :attr:`!__cause__` attribute. If the raised " "exception is not handled, both exceptions will be printed:" msgstr "" +"``from`` 節は例外の連鎖に使います。\n" +"指定する場合、二つ目の *expression* は別の例外クラスか例外インスタンスでなけ" +"ればなりません。\n" +"二つ目の式が例外インスタンスの場合、送出する例外の :attr:`~BaseException." +"__cause__` 属性 (書き換え可能) に設定されます。\n" +"式が例外クラスの場合、そのクラスをインスタンス化し、得られた例外インスタンス" +"を送出する例外の :attr:`!__cause__` 属性に設定します。\n" +"送出した例外を処理しなければ、両方の例外が表示されます:" -#: ../../reference/simple_stmts.rst:606 msgid "" ">>> try:\n" "... print(1 / 0)\n" @@ -856,8 +914,24 @@ msgid "" " raise RuntimeError(\"Something bad happened\") from exc\n" "RuntimeError: Something bad happened" msgstr "" +">>> try:\n" +"... print(1 / 0)\n" +"... except Exception as exc:\n" +"... raise RuntimeError(\"Something bad happened\") from exc\n" +"...\n" +"Traceback (most recent call last):\n" +" File \"\", line 2, in \n" +" print(1 / 0)\n" +" ~~^~~\n" +"ZeroDivisionError: division by zero\n" +"\n" +"The above exception was the direct cause of the following exception:\n" +"\n" +"Traceback (most recent call last):\n" +" File \"\", line 4, in \n" +" raise RuntimeError(\"Something bad happened\") from exc\n" +"RuntimeError: Something bad happened" -#: ../../reference/simple_stmts.rst:626 msgid "" "A similar mechanism works implicitly if a new exception is raised when an " "exception is already being handled. An exception may be handled when an :" @@ -865,8 +939,13 @@ msgid "" "statement, is used. The previous exception is then attached as the new " "exception's :attr:`~BaseException.__context__` attribute:" msgstr "" +"すでに例外を処理している最中に新たな例外を送出した場合も、同様の仕組みが暗黙" +"に働きます。\n" +":keyword:`except` 節、:keyword:`finally` 節、:keyword:`with` 文を使うと、例外" +"を処理することがあります。\n" +"このとき、元の例外は新たな例外の :attr:`~BaseException.__context__` 属性に設" +"定されます:" -#: ../../reference/simple_stmts.rst:632 msgid "" ">>> try:\n" "... print(1 / 0)\n" @@ -886,14 +965,30 @@ msgid "" " raise RuntimeError(\"Something bad happened\")\n" "RuntimeError: Something bad happened" msgstr "" +">>> try:\n" +"... print(1 / 0)\n" +"... except:\n" +"... raise RuntimeError(\"Something bad happened\")\n" +"...\n" +"Traceback (most recent call last):\n" +" File \"\", line 2, in \n" +" print(1 / 0)\n" +" ~~^~~\n" +"ZeroDivisionError: division by zero\n" +"\n" +"During handling of the above exception, another exception occurred:\n" +"\n" +"Traceback (most recent call last):\n" +" File \"\", line 4, in \n" +" raise RuntimeError(\"Something bad happened\")\n" +"RuntimeError: Something bad happened" -#: ../../reference/simple_stmts.rst:652 msgid "" "Exception chaining can be explicitly suppressed by specifying :const:`None` " "in the ``from`` clause:" msgstr "" +"``from`` 節に :const:`None` を指定すると、例外の連鎖を明示的に抑制できます:" -#: ../../reference/simple_stmts.rst:655 msgid "" ">>> try:\n" "... print(1 / 0)\n" @@ -904,6 +999,14 @@ msgid "" " File \"\", line 4, in \n" "RuntimeError: Something bad happened" msgstr "" +">>> try:\n" +"... print(1 / 0)\n" +"... except:\n" +"... raise RuntimeError(\"Something bad happened\") from None\n" +"...\n" +"Traceback (most recent call last):\n" +" File \"\", line 4, in \n" +"RuntimeError: Something bad happened" #: ../../reference/simple_stmts.rst:666 msgid "" @@ -919,19 +1022,22 @@ msgid ":const:`None` is now permitted as ``Y`` in ``raise X from Y``." msgstr "" ":const:`None` が ``raise X from Y`` の ``Y`` として使えるようになりました。" -#: ../../reference/simple_stmts.rst:672 msgid "" "Added the :attr:`~BaseException.__suppress_context__` attribute to suppress " "automatic display of the exception context." msgstr "" +"例外のコンテキストの自動表示を抑制する :attr:`~BaseException." +"__suppress_context__` 属性が追加されました。" -#: ../../reference/simple_stmts.rst:675 msgid "" "If the traceback of the active exception is modified in an :keyword:`except` " "clause, a subsequent ``raise`` statement re-raises the exception with the " "modified traceback. Previously, the exception was re-raised with the " "traceback it had when it was caught." msgstr "" +":keyword:`except` 節でアクティブな例外のトレースバックを変更した場合、その後" +"の ``raise`` 文は変更後のトレースバックで例外を再送出するようになりました。\n" +"以前は、捕捉した時点のトレースバックで例外を再送出していました。" #: ../../reference/simple_stmts.rst:684 msgid "The :keyword:`!break` statement" @@ -952,8 +1058,8 @@ msgid "" "It terminates the nearest enclosing loop, skipping the optional :keyword:`!" "else` clause if the loop has one." msgstr "" -":keyword:`break` 文は、文を囲う最も内側のループを終了させ、ループにオプション" -"の :keyword:`!else` 節がある場合にはそれをスキップします。" +"``break`` 文は、文を囲う最も内側のループを終了させ、ループにオプションの :" +"keyword:`!else` 節がある場合にはそれをスキップします。" #: ../../reference/simple_stmts.rst:705 msgid "" @@ -986,8 +1092,8 @@ msgid "" msgstr "" ":keyword:`continue` 文は :keyword:`for` ループや :keyword:`while` ループ内の" "ネストで構文法的にのみ現れますが、ループ内の関数定義やクラス定義の中には現れ" -"ません。 :keyword:`continue` 文は、文を囲う最も内側のループの次の周期に処理を" -"継続します。" +"ません。 ``continue`` 文は、文を囲う最も内側のループの次の周期に処理を継続し" +"ます。" #: ../../reference/simple_stmts.rst:734 msgid "" @@ -1056,13 +1162,12 @@ msgstr "" "要求したモジュールが無事に取得できた場合、次の 3 つのうちの 1 つの方法でロー" "カル名前空間で使えるようになります:" -#: ../../reference/simple_stmts.rst:789 msgid "" "If the module name is followed by :keyword:`!as`, then the name following :" "keyword:`!as` is bound directly to the imported module." msgstr "" -"モジュール名の後に :keyword:`!as` が続いていた場合は、 :keyword:`!as` の後ろ" -"の名前を直接、インポートされたモジュールが束縛します。" +"モジュール名の後に :keyword:`!as` を続けると、\n" +":keyword:`!as` の後ろの名前がインポートしたモジュールに直接束縛されます。" #: ../../reference/simple_stmts.rst:791 msgid "" @@ -1132,7 +1237,6 @@ msgstr "" msgid "Examples::" msgstr "例::" -#: ../../reference/simple_stmts.rst:820 msgid "" "import foo # foo imported and bound locally\n" "import foo.bar.baz # foo, foo.bar, and foo.bar.baz imported, foo " @@ -1143,6 +1247,14 @@ msgid "" "baz bound as baz\n" "from foo import attr # foo imported and foo.attr bound as attr" msgstr "" +"import foo # foo をインポートし、ローカルに束縛する\n" +"import foo.bar.baz # foo、foo.bar、foo.bar.baz をインポートし、foo を" +"ローカルに束縛する\n" +"import foo.bar.baz as fbb # foo、foo.bar、foo.bar.baz をインポートし、foo." +"bar.baz を fbb に束縛する\n" +"from foo.bar import baz # foo、foo.bar、foo.bar.baz をインポートし、foo." +"bar.baz を baz に束縛する\n" +"from foo import attr # foo をインポートし、foo.attr を attr に束縛する" #: ../../reference/simple_stmts.rst:828 msgid "" @@ -1187,7 +1299,6 @@ msgstr "" "ルレベルでのみ許されます。クラスや関数定義でこの形式を使おうとすると、 :exc:" "`SyntaxError` が送出されます。" -#: ../../reference/simple_stmts.rst:851 msgid "" "When specifying what module to import you do not have to specify the " "absolute name of the module. When a module or package is contained within " @@ -1203,33 +1314,36 @@ msgid "" "``pkg.subpkg2.mod``. The specification for relative imports is contained in " "the :ref:`relativeimports` section." msgstr "" -"インポートするモジュールを指定するとき、そのモジュールの絶対名 (absolute " -"name) を指定する必要はありません。モジュールやパッケージが他のパッケージに含" -"まれている場合、共通のトップパッケージからそのパッケージ名を記述することなく" -"相対インポートすることができます。 :keyword:`from` の後に指定されるモジュール" -"やパッケージの先頭に複数個のドットを付けることで、正確な名前を指定することな" -"しに現在のパッケージ階層からいくつ上の階層へ行くかを指定することができます。" -"先頭のドットが 1 つの場合、 import をおこなっているモジュールが存在する現在の" -"パッケージを示します。 3 つのドットは 2 つ上のレベルを示します。なので、 " -"``pkg`` パッケージの中のモジュールで ``from . import mod`` を実行すると、 " -"``pkg.mod`` をインポートすることになります。 ``pkg.subpkg1`` の中から " -"``from ..subpkg2 import mod`` を実行すると、 ``pkg.subpkg2.mod`` をインポート" -"します。相対インポートの仕様は :ref:`relativeimports` の節に含まれています。" - -#: ../../reference/simple_stmts.rst:865 +"インポートするモジュールは、必ずしも絶対名で指定する必要はありません。\n" +"モジュールやパッケージが他のパッケージに含まれている場合、同じ最上位パッケー" +"ジ内では、パッケージ名を明記せずに相対インポートできます。\n" +":keyword:`from` の後に指定するモジュール名やパッケージ名の先頭にドットを付け" +"ることで、正確な名前を指定せずに、現在のパッケージ階層からいくつ上に移るかを" +"指定できます。\n" +"ドット一つは、インポートを行うモジュールが属する現在のパッケージを表しま" +"す。\n" +"ドット二つなら一階層上、三つなら二階層上を表し、以降も同様です。\n" +"例えば、``pkg`` パッケージ内のモジュールで ``from . import mod`` を実行する" +"と ``pkg.mod`` をインポートします。\n" +"``pkg.subpkg1`` 内で ``from ..subpkg2 import mod`` を実行すると ``pkg." +"subpkg2.mod`` をインポートします。\n" +"相対インポートの仕様は :ref:`relativeimports` 節を参照してください。" + msgid "" ":func:`importlib.import_module` is provided to support applications that " "determine dynamically the modules to be loaded." msgstr "" -"どのモジュールがロードされるべきかを動的に決めたいアプリケーションのために、" -"組み込み関数 :func:`importlib.import_module` が提供されています。" +"読み込むモジュールを動的に決めるアプリケーションのために、:func:`importlib." +"import_module` が用意されています。" -#: ../../reference/simple_stmts.rst:868 msgid "" "Raises an :ref:`auditing event ` ``import`` with arguments " "``module``, ``filename``, ``sys.path``, ``sys.meta_path``, ``sys." "path_hooks``." msgstr "" +"引数 ``module``、``filename``、``sys.path``、``sys.meta_path``、``sys." +"path_hooks`` とともに、:ref:`監査イベント ` ``import`` を発生させま" +"す。" #: ../../reference/simple_stmts.rst:873 msgid "Future statements" @@ -1337,8 +1451,8 @@ msgid "" "imported in the usual way at the time the future statement is executed." msgstr "" "future 文の実行時における直接的な意味付けは、 import 文と同じです。標準モ" -"ジュール :mod:`__future__` があり、これについては後で述べます。 :mod:" -"`__future__` は、 future 文が実行される際に通常の方法で import されます。" +"ジュール :mod:`__future__` があり、これについては後で述べます。 " +"``__future__`` は、 future 文が実行される際に通常の方法で import されます。" #: ../../reference/simple_stmts.rst:928 msgid "" @@ -1352,9 +1466,8 @@ msgstr "" msgid "Note that there is nothing special about the statement::" msgstr "以下の文には、何ら特殊な意味はないので注意してください::" -#: ../../reference/simple_stmts.rst:933 msgid "import __future__ [as name]" -msgstr "" +msgstr "import __future__ [as name]" #: ../../reference/simple_stmts.rst:935 msgid "" @@ -1364,7 +1477,6 @@ msgstr "" "これは future 文ではありません; この文は通常の import 文であり、その他の特殊" "な意味付けや構文的な制限はありません。" -#: ../../reference/simple_stmts.rst:938 msgid "" "Code compiled by calls to the built-in functions :func:`exec` and :func:" "`compile` that occur in a module :mod:`!M` containing a future statement " @@ -1372,6 +1484,11 @@ msgid "" "statement. This can be controlled by optional arguments to :func:`compile` " "--- see the documentation of that function for details." msgstr "" +"future 文を含むモジュール :mod:`!M` 内で組み込み関数 :func:`exec` や :func:" +"`compile` を呼び出してコンパイルしたコードは、デフォルトで、その future 文に" +"対応する新しい構文や意味を使います。\n" +"この動作は :func:`compile` の省略可能な引数で制御できます。\n" +"詳しくは、その関数のドキュメントを参照してください。" #: ../../reference/simple_stmts.rst:944 msgid "" @@ -1399,13 +1516,15 @@ msgstr "__future__ 機構の原案" msgid "The :keyword:`!global` statement" msgstr ":keyword:`!global` 文" -#: ../../reference/simple_stmts.rst:969 msgid "" "The :keyword:`global` statement causes the listed identifiers to be " "interpreted as globals. It would be impossible to assign to a global " "variable without :keyword:`!global`, although free variables may refer to " "globals without being declared global." msgstr "" +":keyword:`global` 文は、列挙した識別子をグローバルとして解釈させます。\n" +"自由変数はグローバル宣言がなくてもグローバル変数を参照できますが、グローバル" +"変数に代入するには :keyword:`!global` が必要です。" #: ../../reference/simple_stmts.rst:974 msgid "" @@ -1414,7 +1533,6 @@ msgid "" "to prior to its global declaration in the scope." msgstr "" -#: ../../reference/simple_stmts.rst:983 msgid "" "**Programmer's note:** :keyword:`global` is a directive to the parser. It " "applies only to code parsed at the same time as the :keyword:`!global` " @@ -1425,19 +1543,20 @@ msgid "" "containing the function call. The same applies to the :func:`eval` and :" "func:`compile` functions." msgstr "" -"**プログラマのための注意点:** :keyword:`global` はパーザに対する指示句 " -"(directive) です。この指示句は、 :keyword:`!global` 文と同時に読み込まれた" -"コードに対してのみ適用されます。特に、組み込みの :func:`exec` 関数内に入って" -"いる :keyword:`!global` 文は、関数の呼び出しを *含んでいる* コードブロック内" -"に効果を及ぼすことはなく、そのような文字列に含まれているコードは、関数の呼び" -"出しを含むコード内の :keyword:`!global` 文に影響を受けません。同様のことが、" -"関数 :func:`eval` および :func:`compile` にも当てはまります。" +"**プログラマのための注意点:** :keyword:`global` はパーサーに対する指示で" +"す。\n" +":keyword:`!global` 文と同時に解析するコードにだけ適用されます。\n" +"特に、組み込み関数 :func:`exec` に渡す文字列やコードオブジェクトに含まれる :" +"keyword:`!global` 文は、その関数呼び出しを *含む* コードブロックには影響しま" +"せん。\n" +"また、その文字列内のコードも、関数呼び出しを含むコード内の :keyword:`!" +"global` 文の影響を受けません。\n" +":func:`eval` 関数と :func:`compile` 関数についても同様です。" #: ../../reference/simple_stmts.rst:995 msgid "The :keyword:`!nonlocal` statement" msgstr ":keyword:`!nonlocal` 文" -#: ../../reference/simple_stmts.rst:1003 msgid "" "When the definition of a function or class is nested (enclosed) within the " "definitions of other functions, its nonlocal scopes are the local scopes of " @@ -1448,13 +1567,25 @@ msgid "" "not bound in any nonlocal scope, or if there is no nonlocal scope, a :exc:" "`SyntaxError` is raised." msgstr "" +"関数やクラスの定義が他の関数の定義の内側にネストしている場合、そのノンローカ" +"ルスコープは、外側の関数のローカルスコープです。\n" +":keyword:`nonlocal` 文は、列挙した識別子がノンローカルスコープですでに束縛さ" +"れた名前を参照するようにします。\n" +"これにより、内側のコードから、そのようなノンローカルの識別子を再束縛できま" +"す。\n" +"複数のノンローカルスコープに同じ名前の束縛がある場合は、最も近い束縛を使いま" +"す。\n" +"どのノンローカルスコープにも名前が束縛されていない場合や、ノンローカルスコー" +"プがない場合は、:exc:`SyntaxError` を送出します。" -#: ../../reference/simple_stmts.rst:1012 msgid "" "The :keyword:`nonlocal` statement applies to the entire scope of a function " "or class body. A :exc:`SyntaxError` is raised if a variable is used or " "assigned to prior to its nonlocal declaration in the scope." msgstr "" +":keyword:`nonlocal` 文は、関数やクラス本体のスコープ全体に適用されます。\n" +"同じスコープ内で、ある変数を nonlocal 宣言より前に使用したり、その変数に代入" +"したりすると、:exc:`SyntaxError` を送出します。" #: ../../reference/simple_stmts.rst:1018 msgid ":pep:`3104` - Access to Names in Outer Scopes" @@ -1464,49 +1595,51 @@ msgstr ":pep:`3104` - Access to Names in Outer Scopes" msgid "The specification for the :keyword:`nonlocal` statement." msgstr ":keyword:`nonlocal` 文の詳細。" -#: ../../reference/simple_stmts.rst:1021 msgid "" "**Programmer's note:** :keyword:`nonlocal` is a directive to the parser and " "applies only to code parsed along with it. See the note for the :keyword:" "`global` statement." msgstr "" +"**プログラマのための注意点:** :keyword:`nonlocal` はパーサーに対する指示で、" +"同時に解析するコードにだけ適用されます。\n" +":keyword:`global` 文の注意点を参照してください。" -#: ../../reference/simple_stmts.rst:1029 msgid "The :keyword:`!type` statement" -msgstr "" +msgstr ":keyword:`!type` 文" -#: ../../reference/simple_stmts.rst:1036 msgid "" "The :keyword:`!type` statement declares a type alias, which is an instance " "of :class:`typing.TypeAliasType`." msgstr "" +":keyword:`!type` 文は、:class:`typing.TypeAliasType` のインスタンスである型エ" +"イリアスを宣言します。" -#: ../../reference/simple_stmts.rst:1039 msgid "For example, the following statement creates a type alias::" -msgstr "" +msgstr "例えば、次の文は型エイリアスを作成します。 ::" -#: ../../reference/simple_stmts.rst:1041 msgid "type Point = tuple[float, float]" -msgstr "" +msgstr "type Point = tuple[float, float]" -#: ../../reference/simple_stmts.rst:1043 msgid "This code is roughly equivalent to::" -msgstr "" +msgstr "このコードは、おおむね次のコードと等価です。 ::" -#: ../../reference/simple_stmts.rst:1045 msgid "" "annotation-def VALUE_OF_Point():\n" " return tuple[float, float]\n" "Point = typing.TypeAliasType(\"Point\", VALUE_OF_Point())" msgstr "" +"annotation-def VALUE_OF_Point():\n" +" return tuple[float, float]\n" +"Point = typing.TypeAliasType(\"Point\", VALUE_OF_Point())" -#: ../../reference/simple_stmts.rst:1049 msgid "" "``annotation-def`` indicates an :ref:`annotation scope `, " "which behaves mostly like a function, but with several small differences." msgstr "" +"``annotation-def`` は :ref:`アノテーションスコープ ` を表" +"します。\n" +"これはほぼ関数のように動作しますが、細かな違いがいくつかあります。" -#: ../../reference/simple_stmts.rst:1052 msgid "" "The value of the type alias is evaluated in the annotation scope. It is not " "evaluated when the type alias is created, but only when the value is " @@ -1514,26 +1647,31 @@ msgid "" "`lazy-evaluation`). This allows the type alias to refer to names that are " "not yet defined." msgstr "" +"型エイリアスの値はアノテーションスコープ内で評価されます。\n" +"型エイリアスの作成時には評価されず、型エイリアスの :attr:`!__value__` 属性を" +"通じて値にアクセスしたときに初めて評価されます (:ref:`lazy-evaluation` を参" +"照)。\n" +"これにより、型エイリアスはまだ定義されていない名前を参照できます。" -#: ../../reference/simple_stmts.rst:1058 msgid "" "Type aliases may be made generic by adding a :ref:`type parameter list ` after the name. See :ref:`generic-type-aliases` for more." msgstr "" +"名前の後に :ref:`型パラメータリスト ` を追加すると、型エイリアス" +"をジェネリックにできます。\n" +"詳しくは :ref:`generic-type-aliases` を参照してください。" -#: ../../reference/simple_stmts.rst:1061 msgid ":keyword:`!type` is a :ref:`soft keyword `." -msgstr "" +msgstr ":keyword:`!type` は :ref:`ソフトキーワード ` です。" -#: ../../reference/simple_stmts.rst:1067 msgid ":pep:`695` - Type Parameter Syntax" -msgstr "" +msgstr ":pep:`695` - 型パラメータの構文" -#: ../../reference/simple_stmts.rst:1068 msgid "" "Introduced the :keyword:`!type` statement and syntax for generic classes and " "functions." msgstr "" +":keyword:`!type` 文と、ジェネリックなクラスおよび関数の構文が導入されました。" #: ../../reference/simple_stmts.rst:8 msgid "simple" @@ -1616,9 +1754,8 @@ msgstr "call" msgid "= (equals)" msgstr "= (等号)" -#: ../../reference/simple_stmts.rst:75 msgid "assignment statement" -msgstr "" +msgstr "代入文" #: ../../reference/simple_stmts.rst:75 ../../reference/simple_stmts.rst:116 #: ../../reference/simple_stmts.rst:159 ../../reference/simple_stmts.rst:187 @@ -1662,17 +1799,15 @@ msgstr "target" msgid ", (comma)" msgstr ", (comma)" -#: ../../reference/simple_stmts.rst:116 msgid "in target list" -msgstr "" +msgstr "ターゲットリスト内" #: ../../reference/simple_stmts.rst:116 ../../reference/simple_stmts.rst:826 msgid "* (asterisk)" msgstr "* (アスタリスク)" -#: ../../reference/simple_stmts.rst:116 msgid "in assignment target list" -msgstr "" +msgstr "代入先のリスト内" #: ../../reference/simple_stmts.rst:116 msgid "[] (square brackets)" @@ -1718,9 +1853,8 @@ msgstr "assignment, augmented" msgid "+=" msgstr "+=" -#: ../../reference/simple_stmts.rst:263 msgid "augmented assignment" -msgstr "" +msgstr "累算代入" #: ../../reference/simple_stmts.rst:263 msgid "-=" @@ -1766,21 +1900,18 @@ msgstr ">>=" msgid "<<=" msgstr "<<=" -#: ../../reference/simple_stmts.rst:322 msgid "annotated" -msgstr "" +msgstr "注釈付き" -#: ../../reference/simple_stmts.rst:322 msgid "assignment, annotated" -msgstr "" +msgstr "代入, 注釈付き" #: ../../reference/simple_stmts.rst:322 msgid ": (colon)" msgstr ": (コロン)" -#: ../../reference/simple_stmts.rst:322 msgid "annotated variable" -msgstr "" +msgstr "注釈付き変数" #: ../../reference/simple_stmts.rst:384 msgid "assert" @@ -1794,9 +1925,8 @@ msgstr "デバッグ" msgid "assertions" msgstr "assertions" -#: ../../reference/simple_stmts.rst:384 msgid "expression list" -msgstr "" +msgstr "式リスト" #: ../../reference/simple_stmts.rst:405 msgid "__debug__" @@ -1955,18 +2085,15 @@ msgstr "importing" msgid "from" msgstr "from" -#: ../../reference/simple_stmts.rst:745 ../../reference/simple_stmts.rst:787 msgid "as" -msgstr "" +msgstr "as" #: ../../reference/simple_stmts.rst:745 msgid "ImportError" msgstr "ImportError" -#: ../../reference/simple_stmts.rst:745 ../../reference/simple_stmts.rst:787 -#: ../../reference/simple_stmts.rst:800 ../../reference/simple_stmts.rst:826 msgid "import statement" -msgstr "" +msgstr "import 文" #: ../../reference/simple_stmts.rst:832 msgid "__all__ (optional module attribute)" @@ -1984,13 +2111,11 @@ msgstr "future" msgid "__future__" msgstr "__future__" -#: ../../reference/simple_stmts.rst:875 msgid "future statement" -msgstr "" +msgstr "future 文" -#: ../../reference/simple_stmts.rst:961 ../../reference/simple_stmts.rst:997 msgid "identifier list" -msgstr "" +msgstr "識別子リスト" #: ../../reference/simple_stmts.rst:978 msgid "exec" diff --git a/reference/toplevel_components.po b/reference/toplevel_components.po index 00a7539c3..307b3ef45 100644 --- a/reference/toplevel_components.po +++ b/reference/toplevel_components.po @@ -20,10 +20,10 @@ msgstr "" "Last-Translator: tomo, 2023\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../reference/toplevel_components.rst:6 @@ -46,7 +46,6 @@ msgstr "" msgid "Complete Python programs" msgstr "完全な Python プログラム" -#: ../../reference/toplevel_components.rst:28 msgid "" "While a language specification need not prescribe how the language " "interpreter is invoked, it is useful to have a notion of a complete Python " @@ -57,14 +56,14 @@ msgid "" "`__main__`. The latter is used to provide the local and global namespace " "for execution of the complete program." msgstr "" -"言語仕様の中では、その言語を処理するインタプリタがどのように起動されるかまで" -"規定する必要はないのですが、完全な Python プログラムの概念を知っておくと役に" -"立ちます。完全な Python プログラムは、最小限に初期化された環境: 全ての組み込" -"み変数と標準モジュールが利用可能で、かつ :mod:`sys` (様々なシステムサービ" -"ス)、 :mod:`builtins` (組み込み関数、例外、および ``None``)、 :mod:" -"`__main__` の 3 つを除く全てのモジュールが初期化されていない状態で動作しま" -"す。 :mod:`__main__` は、完全なプログラムを実行する際に、ローカルおよびグロー" -"バルな名前空間を提供するために用いられます。" +"言語仕様でインタープリタの起動方法まで規定する必要はありませんが、完全な " +"Python プログラムという概念を持っておくと役立ちます。\n" +"完全な Python プログラムは、最小限に初期化された環境で実行されます。\n" +"すべての組み込みモジュールと標準モジュールを利用できますが、:mod:`sys` (各種" +"システムサービス)、:mod:`builtins` (組み込み関数、例外、``None``)、:mod:" +"`__main__` 以外は初期化されていません。\n" +"最後のモジュールは、完全なプログラムの実行に使うローカルとグローバルの名前空" +"間を提供します。" #: ../../reference/toplevel_components.rst:36 msgid "" @@ -123,9 +122,8 @@ msgstr "(ファイルや文字列内の) 完全な Python プログラムを構 msgid "when parsing a module;" msgstr "モジュールを構文解析するとき;" -#: ../../reference/toplevel_components.rst:80 msgid "when parsing a string passed to the :func:`exec` function;" -msgstr ":func:`exec` で渡された文字列を構文解析するとき;" +msgstr ":func:`exec` 関数に渡された文字列を構文解析するとき。" #: ../../reference/toplevel_components.rst:86 msgid "Interactive input" diff --git a/sphinx.po b/sphinx.po index 4d98b5b16..2c8c23a7a 100644 --- a/sphinx.po +++ b/sphinx.po @@ -21,10 +21,10 @@ msgstr "" "Last-Translator: TENMYO Masakazu, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../tools/templates/_docs_by_version.html:10 @@ -35,26 +35,22 @@ msgstr "安定" msgid "In development" msgstr "開発中" -#: ../../tools/templates/customsourcelink.html:3 msgid "This page" -msgstr "" +msgstr "このページ" -#: ../../tools/templates/customsourcelink.html:5 msgid "Report a bug" -msgstr "" +msgstr "バグを報告する" -#: ../../tools/templates/customsourcelink.html:8 msgid "Show source" -msgstr "" +msgstr "ソースを表示する" #: ../../tools/templates/download.html:2 #: ../../tools/templates/indexsidebar.html:1 msgid "Download" msgstr "ダウンロード" -#: ../../tools/templates/download.html:30 msgid "Download Python %(dl_version)s documentation" -msgstr "" +msgstr "Python %(dl_version)s のドキュメントをダウンロード" #: ../../tools/templates/download.html:32 msgid "Last updated on: %(last_updated)s." @@ -202,9 +198,8 @@ msgstr "" "(訳注: 日本語訳へのコメントや提案は GitHub の issue tracker へ報告してください。)" -#: ../../tools/templates/dummy.html:6 msgid "Availability" -msgstr "" +msgstr "利用可能な環境" #: ../../tools/templates/dummy.html:10 msgid "Part of the" @@ -339,9 +334,8 @@ msgstr "構文と言語要素" msgid "Python setup and usage" msgstr "Pythonのセットアップと使い方" -#: ../../tools/templates/indexcontent.html:35 msgid "How to install, configure, and use Python" -msgstr "Pythonのインストール方法、configure方法、使い方" +msgstr "Python のインストール方法、設定方法、使い方" #: ../../tools/templates/indexcontent.html:36 msgid "Python HOWTOs" @@ -453,7 +447,7 @@ msgstr "問題の報告" #: ../../tools/templates/indexcontent.html:75 msgid "Contributing to docs" -msgstr "" +msgstr "ドキュメントへの貢献" #: ../../tools/templates/indexcontent.html:76 msgid "Download the documentation" @@ -499,9 +493,8 @@ msgstr "" msgid "Book list" msgstr "" -#: ../../tools/templates/indexsidebar.html:15 msgid "Audio/visual talks" -msgstr "" +msgstr "音声・映像による講演" #: ../../tools/templates/indexsidebar.html:16 msgid "Python developer’s guide" @@ -519,15 +512,14 @@ msgstr "" msgid "Python documentation for the current stable release" msgstr "現在の安定リリース用の Python ドキュメント" -#: ../../tools/templates/layout.html:14 msgid "" "This is a deploy preview created from a pull request.\n" " For authoritative documentation, see" msgstr "" -"これは pull request により" -"作成されたデプロイプレビューです。\n" -" より信頼できるドキュメントはこちら:" +"これは pull request から作" +"成されたデプロイプレビューです。\n" +"正式なドキュメントはこちら:" #: ../../tools/templates/layout.html:16 msgid "the current stable release" diff --git a/tutorial/appendix.po b/tutorial/appendix.po index 376f54821..bbb97a35f 100644 --- a/tutorial/appendix.po +++ b/tutorial/appendix.po @@ -17,10 +17,10 @@ msgstr "" "Last-Translator: TENMYO Masakazu, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../tutorial/appendix.rst:5 @@ -31,14 +31,14 @@ msgstr "付録" msgid "Interactive Mode" msgstr "対話モード" -#: ../../tutorial/appendix.rst:13 msgid "" "There are two variants of the interactive :term:`REPL`. The classic basic " "interpreter is supported on all platforms with minimal line control " "capabilities." msgstr "" -"対話型の :term:`REPL` は2種類あります。 クラシックな基本インタープリタは最低" -"限の行制御機能を持つ全プラットフォームでサポートされています。" +"対話型の :term:`REPL` には 2 種類あります。\n" +"従来の基本インタープリタはすべてのプラットフォームで使え、入力行を操作するた" +"めの最小限の機能を備えています。" #: ../../tutorial/appendix.rst:17 msgid "" @@ -185,7 +185,6 @@ msgstr "" "が入ったファイル名に設定します。この機能は Unix シェルの :file:`.profile` に" "似ています。" -#: ../../tutorial/appendix.rst:99 msgid "" "This file is only read in interactive sessions, not when Python reads " "commands from a script, and not when :file:`/dev/tty` is given as the " @@ -195,14 +194,15 @@ msgid "" "qualification in the interactive session. You can also change the prompts " "``sys.ps1`` and ``sys.ps2`` in this file." msgstr "" -"このファイルは対話セッションのときだけ読み出されます。 Python がコマンドをス" -"クリプトから読み出しているときや、 :file:`/dev/tty` がコマンドの入力元として" -"明示的に指定されている(この場合対話的セッションのように動作します) *わけでは" -"ない* 場合にはこのファイルは読み出されません。ファイル内のコマンドは、対話的" -"コマンドが実行される名前空間と同じ名前空間内で実行されます。このため、ファイ" -"ル内で定義されていたり import されたオブジェクトは、そのまま対話セッション内" -"で使うことができます。また、このファイル内で ``sys.ps1`` や ``sys.ps2`` を変" -"更して、プロンプトを変更することもできます。" +"このファイルが読み込まれるのは対話セッションだけです。\n" +"Python がスクリプトからコマンドを読み込む場合や、:file:`/dev/tty` をコマンド" +"の入力元として明示的に指定した場合には読み込まれません。\n" +"後者は、この点を除けば対話セッションと同じように動作します。\n" +"このファイルは対話コマンドと同じ名前空間で実行されます。\n" +"そのため、ファイル内で定義またはインポートしたオブジェクトは、対話セッション" +"で名前を修飾せずに使えます。\n" +"このファイルで ``sys.ps1`` と ``sys.ps2`` を設定すれば、プロンプトも変更でき" +"ます。" #: ../../tutorial/appendix.rst:107 msgid "" diff --git a/tutorial/appetite.po b/tutorial/appetite.po index d8a79bf9c..8b1c2480a 100644 --- a/tutorial/appetite.po +++ b/tutorial/appetite.po @@ -19,10 +19,10 @@ msgstr "" "Last-Translator: Takanori Suzuki , 2023\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../tutorial/appetite.rst:5 @@ -37,11 +37,11 @@ msgid "" "of photo files in a complicated way. Perhaps you'd like to write a small " "custom database, or a specialized GUI application, or a simple game." msgstr "" -"コンピュータを使っていろいろな作業をしていると、自動化したい作業が出てくるで" -"しょう。たとえば、たくさんのテキストファイルで検索-置換操作を行いたい、大量の" -"写真ファイルを込み入ったやりかたでファイル名を整理して変更したり、などです。" -"ちょっとした専用のデータベースや、何か専用のGUIアプリケーション、シンプルな" -"ゲームを作りたいかもしれません。" +"コンピュータでさまざまな作業をしていると、いずれ自動化したい作業が出てくるで" +"しょう。例えば、多数のテキストファイルをまとめて検索・置換したり、大量の写真" +"ファイルの名前や配置を複雑な手順で変更したりする作業です。用途に合わせた小さ" +"なデータベースや専用の GUI アプリケーション、簡単なゲームを作りたくなることも" +"あるでしょう。" #: ../../tutorial/appetite.rst:13 msgid "" @@ -52,15 +52,16 @@ msgid "" "written a program that could use an extension language, and you don't want " "to design and implement a whole new language for your application." msgstr "" -"あなたがプロのソフト開発者として、C/C++/Java ライブラリを扱う必要があるけど" -"も、通常の編集/コンパイル/テスト/再コンパイルのサイクルを遅すぎると感じている" -"かもしれません。上記ライブラリのためのテストを書くことにうんざりしているかも" -"しれません。または、拡張言語を持つアプリケーションを書いているなら、そのため" -"に新しい言語一式の設計と実装をしたくないでしょう。" +"ソフトウェア開発の仕事で複数の C/C++/Java ライブラリを使っていると、コードの" +"作成・コンパイル・テスト・再コンパイルという一連の作業に時間がかかりすぎると" +"感じるかもしれません。そうしたライブラリのテストスイートを書いていて、テスト" +"コードの作成が面倒だと感じることもあるでしょう。あるいは、作成したプログラム" +"に拡張言語を導入したくても、そのためだけにまったく新しい言語を設計・実装した" +"くはないかもしれません。" #: ../../tutorial/appetite.rst:20 msgid "Python is just the language for you." -msgstr "Pythonはそんなあなたのための言語です。" +msgstr "Python はそんなあなたにぴったりの言語です。" #: ../../tutorial/appetite.rst:22 msgid "" @@ -71,12 +72,12 @@ msgid "" "draft program. Python is simpler to use, available on Windows, macOS, and " "Unix operating systems, and will help you get the job done more quickly." msgstr "" -"そういった処理は、Unix シェルスクリプトや Windows バッチファイルで書くことも" -"できます。しかし、シェルスクリプトはファイル操作やテキストデータの操作には向" -"いていますが、GUIアプリケーションやゲームにはむいていません。C/C++/Java プロ" -"グラムを書くこともできますが、最初の試し書きだけでもかなりの時間がかかってし" -"まいます。Pythonはもっと簡単に利用でき、Windows、macOS、そして Unix オペレー" -"ティングシステムで動作し、あなたの仕事をすばやく片付ける助けになるでしょう。" +"こうした作業の一部は Unix シェルスクリプトや Windows バッチファイルで処理でき" +"ます。シェルスクリプトはファイルの移動やテキストデータの変更が得意です。しか" +"し、GUI アプリケーションやゲームにはあまり向いていません。C/C++/Java でプログ" +"ラムを書くこともできますが、最初の試作品を作るだけでもかなりの開発時間がかか" +"ることがあります。Python はもっと手軽に使え、Windows、macOS、Unix で動作しま" +"す。作業をより早く終える助けになるでしょう。" #: ../../tutorial/appetite.rst:29 msgid "" @@ -89,13 +90,13 @@ msgid "" "problem domain than Awk or even Perl, yet many things are at least as easy " "in Python as in those languages." msgstr "" -"Python は簡単に利用できますが、本物のプログラミング言語であり、シェルスクリプ" -"トやバッチファイルよりも多くの機構があり、大きなプログラムの開発にも適してい" -"ます。一方では、Python は C よりたくさんのエラーチェックを実行時に行ってお" -"り、また可変長配列や辞書などの高級な型を組込みで持つ *超高級言語(very-high-" -"level language)* です。Python は Awk や Perl などよりも汎用的なデータ型を備え" -"ており、より多くの領域で利用できます。また、Pythonはこれらの言語と比べても、" -"少なくとも同じぐらいには簡単です。" +"Python は手軽に使える一方で、本格的なプログラミング言語でもあります。シェルス" +"クリプトやバッチファイルに比べ、プログラムを構造化する仕組みや大規模なプログ" +"ラムの開発を支える機能が充実しています。また、C よりも多くのエラーチェックを" +"行います。*超高水準言語* である Python には、柔軟な配列や辞書といった高レベル" +"のデータ型が組み込まれています。汎用性の高いデータ型を備えているため、Awk や " +"Perl よりも幅広い問題に対応できます。それでいて、多くの処理はこれらの言語に劣" +"らず簡単に書けます。" #: ../../tutorial/appetite.rst:37 msgid "" @@ -106,12 +107,11 @@ msgid "" "file I/O, system calls, sockets, and even interfaces to graphical user " "interface toolkits like Tk." msgstr "" -"Python では、プログラムをモジュールに分割して、他の Python プログラムで再利用" -"できます。Python には膨大な標準モジュールが付属していて、プログラムを作る上で" -"の基盤として、あるいは Python プログラミングを学ぶためのサンプルとして利用で" -"きます。標準モジュールには、ファイル I/O、システムコール、ソケットといった機" -"能や、Tk のようなグラフィカルユーザインターフェースツールキットを使うためのイ" -"ンターフェイスなども提供しています。" +"Python ではプログラムをモジュールに分割し、他の Python プログラムで再利用でき" +"ます。豊富な標準モジュールも付属しており、プログラムを作る際の土台としても、" +"Python プログラミングを学び始める際の例としても利用できます。ファイル I/O、シ" +"ステムコール、ソケットなどの機能や、Tk のような GUI ツールキットへのインター" +"フェースを提供するモジュールもあります。" #: ../../tutorial/appetite.rst:44 msgid "" @@ -122,11 +122,10 @@ msgid "" "functions during bottom-up program development. It is also a handy desk " "calculator." msgstr "" -"Python はインタプリタ言語です。コンパイルやリンクの必要がないので、プログラム" -"を開発する際にかなりの時間を節約できます。インタプリタは対話的にも使えるの" -"で、言語の様々な機能について実験してみたり、書き捨てのプログラムを書いたり、" -"ボトムアップでプログラムを開発する際に、関数をテストしたりといったことが簡単" -"にできます。便利な電卓にもなります。" +"Python はインタープリタ言語です。コンパイルやリンクが不要なので、プログラム開" +"発の時間を大幅に節約できます。インタープリタは対話的にも使えるため、言語の機" +"能を試したり、書き捨てのプログラムを書いたり、ボトムアップでのプログラム開発" +"中に関数をテストしたりするのも簡単です。手軽な卓上電卓としても使えます。" #: ../../tutorial/appetite.rst:50 msgid "" @@ -134,23 +133,21 @@ msgid "" "written in Python are typically much shorter than equivalent C, C++, or " "Java programs, for several reasons:" msgstr "" -"Python では、とてもコンパクトで読みやすいプログラムを書けます。Python で書か" -"れたプログラムは大抵、同じ機能の C 言語, C++ 言語や Java のプログラムよりもは" -"るかに短くなります。これには以下のようないくつかの理由があります:" +"Python ではコンパクトで読みやすいプログラムを書けます。Python のプログラムは" +"通常、同じ処理を行う C/C++/Java のプログラムよりもずっと短くなります。その理" +"由は次のとおりです:" #: ../../tutorial/appetite.rst:54 msgid "" "the high-level data types allow you to express complex operations in a " "single statement;" -msgstr "高レベルのデータ型によって、複雑な操作を一つの実行文で表現できます。" +msgstr "高レベルのデータ型を使えば複雑な操作を1つの文で表現できます。" #: ../../tutorial/appetite.rst:57 msgid "" "statement grouping is done by indentation instead of beginning and ending " "brackets;" -msgstr "" -"実行文のグループ化を、グループの開始や終了の括弧ではなくインデントで行えま" -"す。" +msgstr "文は開始と終了を表す括弧ではなくインデントでまとめます。" #: ../../tutorial/appetite.rst:60 msgid "no variable or argument declarations are necessary." @@ -166,13 +163,13 @@ msgid "" "Python interpreter into an application written in C and use it as an " "extension or command language for that application." msgstr "" -"Python には *拡張性* があります: C 言語でプログラムを書く方法を知っているな" -"ら、簡単に新たな組み込み関数やモジュールを、簡単にインタプリタに追加できま" -"す。これによって、いちばん時間のかかる処理を高速化したり、ベンダ特有のグラ" -"フィクスライブラリなどの、 バイナリ形式でしか手に入らないライブラリを Python " -"にリンクしたりできます。その気になれば、Python インタプリタを C で書かれたア" -"プリケーションにリンクして、アプリケーションに対する拡張言語や命令言語として" -"も使えます。" +"Python には *拡張性* があります。C でプログラムを書く方法を知っていれば、新し" +"い組み込み関数やモジュールをインタープリタに簡単に追加できます。これにより、" +"重要な処理を最大限に高速化したり、ベンダー独自のグラフィックスライブラリのよ" +"うにバイナリ形式でしか提供されていないライブラリを Python プログラムにリンク" +"したりできます。Python にすっかり夢中になったら、C で書かれたアプリケーション" +"に Python インタープリタをリンクし、そのアプリケーションの拡張言語や命令言語" +"として使うこともできます。" #: ../../tutorial/appetite.rst:70 msgid "" @@ -180,10 +177,9 @@ msgid "" "Circus\" and has nothing to do with reptiles. Making references to Monty " "Python skits in documentation is not only allowed, it is encouraged!" msgstr "" -"ところで、この言語は BBC のショー番組、\"モンティパイソンの空飛ぶサーカス " -"(Monty Python's Flying Circus)\" から取ったもので、爬虫類とは関係ありません。" -"このドキュメントでは、モンティパイソンの寸劇への参照が許可されているだけでな" -"く、むしろ推奨されています!" +"ちなみに Python という名前は BBC の番組「Monty Python's Flying Circus」に由来" +"し、爬虫類とは関係ありません。ドキュメントでモンティ・パイソンの寸劇に触れる" +"ことは、許されているだけでなく推奨されています!" #: ../../tutorial/appetite.rst:74 msgid "" @@ -191,10 +187,9 @@ msgid "" "more detail. Since the best way to learn a language is to use it, the " "tutorial invites you to play with the Python interpreter as you read." msgstr "" -"さて、皆さんはもう Python にワクワクして、もうちょっと詳しく調べてみたくなっ" -"たはずです。プログラミング言語を習得する最良の方法は使ってみることですから、" -"このチュートリアルではみなさんが読んだ内容を Python インタプリタで試してみる" -"ことをおすすめします。" +"Python に興味が湧いてきて、もっと詳しく知りたくなったのではないでしょうか。言" +"語を学ぶには実際に使ってみるのが一番です。このチュートリアルを読みながら " +"Python インタープリタでいろいろ試してみてください。" #: ../../tutorial/appetite.rst:78 msgid "" @@ -202,8 +197,8 @@ msgid "" "This is rather mundane information, but essential for trying out the " "examples shown later." msgstr "" -"次の章では、まずインタプリタの使い方を説明します。これはわかりきった内容かも" -"しれませんが、後に説明する例題を試してみる上で不可欠なことです。" +"次の章ではインタープリタの使い方を説明します。地味な内容ですが、この先に出て" +"くる例を試すために欠かせません。" #: ../../tutorial/appetite.rst:82 msgid "" @@ -212,7 +207,6 @@ msgid "" "and data types, through functions and modules, and finally touching upon " "advanced concepts like exceptions and user-defined classes." msgstr "" -"チュートリアルの残りの部分では、Python プログラム言語と実行システムの様々な機" -"能を例題を交えて紹介します。単純な式、実行文、データ型から始めて、関数とモ" -"ジュールを経て、最後には例外処理やユーザ定義クラスといったやや高度な概念にも" -"触れます。" +"以降の章では Python 言語とシステムのさまざまな機能を例とともに紹介します。簡" +"単な式や文、データ型から始めて関数やモジュールへと進み、最後には例外やユー" +"ザー定義クラスといった高度な概念にも触れます。" diff --git a/tutorial/classes.po b/tutorial/classes.po index 870a7ce38..f0938c2d0 100644 --- a/tutorial/classes.po +++ b/tutorial/classes.po @@ -22,10 +22,10 @@ msgstr "" "Last-Translator: TENMYO Masakazu, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../tutorial/classes.rst:5 @@ -47,7 +47,6 @@ msgstr "" "クラスのインスタンスは、その状態を変更するための (そのクラスが定義する) メ" "ソッドも持てます。" -#: ../../tutorial/classes.rst:13 msgid "" "Compared with other programming languages, Python's class mechanism adds " "classes with a minimum of new syntax and semantics. It is a mixture of the " @@ -60,17 +59,18 @@ msgid "" "nature of Python: they are created at runtime, and can be modified further " "after creation." msgstr "" -"Python は、他のプログラミング言語と比較して、最小限の構文と意味付けを使ってク" -"ラスを言語に追加しています。Python のクラスは、C++ と Modula-3 のクラスメカニ" -"ズムを混ぜたものです。Python のクラス機構はオブジェクト指向プログラミングの標" -"準的な機能を全て提供しています。クラスの継承メカニズムは、複数の基底クラスを" -"持つことができ、派生クラスで基底クラスの任意のメソッドをオーバライドすること" -"ができます。メソッドでは、基底クラスのメソッドを同じ名前で呼び出すことができ" -"ます。オブジェクトには任意の種類と数のデータを格納することができます。モ" -"ジュールと同じく、クラス機構も Python の動的な性質に従うように設計されていま" -"す。クラスは実行時に生成され、生成後に変更することができます。" +"Python のクラス機構は、ほかのプログラミング言語に比べて、新しく覚える構文や規" +"則を最小限に抑えています。\n" +"その仕組みは C++ と Modula-3 のクラス機構を組み合わせたものです。\n" +"Python のクラスは、オブジェクト指向プログラミングの標準的な機能をすべて備えて" +"います。\n" +"複数の基底クラスを継承でき、派生クラスでは基底クラスのどのメソッドもオーバー" +"ライドできます。\n" +"また、メソッドから基底クラスの同名のメソッドを呼び出せます。\n" +"オブジェクトに格納するデータの種類や数も自由です。\n" +"モジュールと同様に、クラスも Python の動的な性質を持っています。\n" +"クラスは実行時に作られ、作成後に変更することもできます。" -#: ../../tutorial/classes.rst:23 msgid "" "In C++ terminology, normally class members (including the data members) are " "*public* (except see below :ref:`tut-private`), and all member functions are " @@ -84,17 +84,20 @@ msgid "" "(arithmetic operators, subscripting etc.) can be redefined for class " "instances." msgstr "" -"C++ の用語で言えば、通常のクラスメンバ (データメンバも含む) は (:ref:`tut-" -"private` に書かれている例外を除いて) *public* であり、メンバ関数はすべて *仮" -"想関数(virtual)* です。 Modula-3 にあるような、オブジェクトのメンバをメソッド" -"から参照するための短縮した記法は使えません: メソッド関数の宣言では、オブジェ" -"クト自体を表す第一引数を明示しなければなりません。第一引数のオブジェクトはメ" -"ソッド呼び出しの際に暗黙の引数として渡されます。 Smalltalk に似て、クラスはそ" -"れ自体がオブジェクトです。そのため、 import や名前変更といった操作が可能で" -"す。 C++ や Modula-3 と違って、ユーザーは組込み型を基底クラスにして拡張を行え" -"ます。また、C++ とは同じで Modula-3 とは違う点として、特別な構文を伴うほとん" -"どの組み込み演算子 (算術演算子 (arithmetic operator) や添字表記) はクラスイン" -"スタンスで使うために再定義できます。" +"C++ の用語で言うと、クラスメンバはデータメンバも含めて通常 *public* です\n" +"(例外については :ref:`tut-private` を参照してください)。\n" +"メンバ関数はすべて *仮想関数 (virtual)* です。\n" +"Modula-3 と同様に、メソッド内からオブジェクトのメンバを参照するための短縮記法" +"はありません。\n" +"メソッド関数の宣言では、オブジェクト自体を表す引数を最初に明示します。\n" +"メソッドを呼び出すと、この引数にオブジェクトが暗黙的に渡されます。\n" +"Smalltalk と同様に、クラス自体もオブジェクトなので、インポートしたり別の名前" +"を付けたりできます。\n" +"C++ や Modula-3 と違って、組み込み型を基底クラスにして拡張することもできま" +"す。\n" +"また、C++ と同様に、算術演算子や添字表記など特別な構文を使う組み込み演算子の" +"多くは、\n" +"クラスインスタンスに対する動作を再定義できます。" #: ../../tutorial/classes.rst:34 msgid "" @@ -112,7 +115,6 @@ msgstr "" msgid "A Word About Names and Objects" msgstr "名前とオブジェクトについて" -#: ../../tutorial/classes.rst:45 msgid "" "Objects have individuality, and multiple names (in multiple scopes) can be " "bound to the same object. This is known as aliasing in other languages. " @@ -127,23 +129,28 @@ msgid "" "the caller will see the change --- this eliminates the need for two " "different argument passing mechanisms as in Pascal." msgstr "" -"オブジェクトには個体性があり、同一のオブジェクトに(複数のスコープから) 複数の" -"名前を割り当てることができます。この機能は他の言語では別名づけ(alias) として" -"知られています。 Python を一見しただけでは、別名づけの重要性は分からないこと" -"が多く、変更不能な基本型 (数値、文字列、タプル)を扱うときには無視して差し支え" -"ありません。しかしながら、別名付けは、リストや辞書や他の多くの型など、変更可" -"能な型を扱う Python コード上で驚くべき効果があります。別名付けはいくつかの点" -"でポインタのように振舞い、このことは通常はプログラムに利するように使われま" -"す。例えば、オブジェクトの受け渡しは、実装上はポインタが渡されるだけなのでコ" -"ストの低い操作になります。また、関数があるオブジェクトを引数として渡されたと" -"き、関数の呼び出し側からオブジェクトに対する変更を見ることができます --- これ" -"により、 Pascal にあるような二つの引数渡し機構をもつ必要をなくしています。" +"オブジェクトはそれぞれ固有の存在ですが、同じオブジェクトに複数のスコープから" +"複数の名前を束縛できます。\n" +"ほかの言語では、これをエイリアス (別名) と呼びます。\n" +"Python を学び始めたばかりでは、この仕組みの重要性は分かりにくいかもしれませ" +"ん。\n" +"数値、文字列、タプルのようなイミュータブル (変更できない) な基本型を扱うとき" +"は、気にしなくても問題ありません。\n" +"一方、リストや辞書など多くの型のミュータブル (変更できる) なオブジェクトを扱" +"うコードでは、\n" +"エイリアスによって意外な動作が起こることがあります。\n" +"エイリアスはいくつかの点でポインタのように振る舞うため、通常はその性質をプロ" +"グラムに役立てられます。\n" +"例えば、オブジェクトを渡す際に実装上渡されるのはポインタだけなので、処理の負" +"担は小さくなります。\n" +"また、関数が引数として受け取ったオブジェクトを変更すると、呼び出し側からもそ" +"の変更が見えます。\n" +"このため、Pascal のように引数の渡し方を 2 種類用意する必要がありません。" #: ../../tutorial/classes.rst:61 msgid "Python Scopes and Namespaces" msgstr "Python のスコープと名前空間" -#: ../../tutorial/classes.rst:63 msgid "" "Before introducing classes, I first have to tell you something about " "Python's scope rules. Class definitions play some neat tricks with " @@ -151,11 +158,12 @@ msgid "" "understand what's going on. Incidentally, knowledge about this subject is " "useful for any advanced Python programmer." msgstr "" -"クラスを紹介する前に、Python のスコープのルールについてあることを話しておかな" -"ければなりません。クラス定義は巧みなトリックを名前空間に施すので、何が起こっ" -"ているのかを完全に理解するには、スコープと名前空間がどのように動作するかを理" -"解する必要があります。ちなみに、この問題に関する知識は全ての Python プログラ" -"マにとって有用です。" +"クラスを紹介する前に、Python のスコープの規則について説明する必要がありま" +"す。\n" +"クラス定義は名前空間を巧みに利用するので、その動作を十分に理解するには、ス" +"コープと名前空間の仕組みを知っておく必要があります。\n" +"なお、この知識は高度なプログラミングを行う Python プログラマーなら誰にとって" +"も役立ちます。" #: ../../tutorial/classes.rst:69 msgid "Let's begin with some definitions." @@ -288,9 +296,9 @@ msgstr "" "外側の(enclosing)関数のスコープは、近いほうから順に探され、ローカルでもグロー" "バルでもない名前を持っています。" -#: ../../tutorial/classes.rst:123 msgid "the next-to-last scope contains the current module's global names" -msgstr "次のスコープは、現在のモジュールのグローバルな名前を持っています。" +msgstr "" +"最後から 2 番目のスコープは現在のモジュールのグローバルな名前を持っています。" #: ../../tutorial/classes.rst:124 msgid "" @@ -298,7 +306,6 @@ msgid "" "names" msgstr "一番外側の(最後に検索される)スコープはビルトイン名を持っています。" -#: ../../tutorial/classes.rst:126 msgid "" "If a name is declared global, then all references and assignments go " "directly to the next-to-last scope containing the module's global names. To " @@ -308,12 +315,13 @@ msgid "" "*new* local variable in the innermost scope, leaving the identically named " "outer variable unchanged)." msgstr "" -"名前が global と宣言されている場合、その名前に対する参照や代入は全て、モ" -"ジュールのグローバルな名前の入った最後から2番目のスコープに対して直接行われま" -"す。最内スコープの外側にある変数に再束縛するには、 :keyword:`nonlocal` 文が使" -"えます。nonlocal と宣言されなかった変数は、全て読み出し専用となります (そのよ" -"うな変数に対する書き込みは、単に *新しい* ローカル変数をもっとも内側のスコー" -"プで作成し、外部のスコープの値は変化しません)。" +"名前を global と宣言すると、その名前への参照と代入はすべて、モジュールのグ" +"ローバル名を持つ最後から 2 番目のスコープで直接行われます。\n" +"最も内側のスコープより外側にある変数を再束縛するには、:keyword:`nonlocal` 文" +"を使えます。\n" +"こうした外側の変数は、nonlocal と宣言しない限り読み出し専用です。\n" +"代入しようとすると、最も内側のスコープに同名の *新しい* ローカル変数が作ら" +"れ、外側の変数は変わりません。" #: ../../tutorial/classes.rst:133 msgid "" @@ -344,7 +352,6 @@ msgstr "" "ル\" 時の静的な名前解決の方向に進化しているので、動的な名前解決に頼ってはいけ" "ません! (事実、ローカルな変数は既に静的に決定されています。)" -#: ../../tutorial/classes.rst:146 msgid "" "A special quirk of Python is that -- if no :keyword:`global` or :keyword:" "`nonlocal` statement is in effect -- assignments to names always go into the " @@ -355,14 +362,14 @@ msgid "" "particular, :keyword:`import` statements and function definitions bind the " "module or function name in the local scope." msgstr "" -"Python の特徴として、:keyword:`global` や :keyword:`nonlocal` 文が有効でない" -"場合は、名前に対する参照は常に最も内側のスコープに対して有効になります。\n" -"代入はデータをコピーしません。オブジェクトを名前に束縛するだけです。削除も同" -"様で、``del x`` は、ローカルスコープの名前空間から ``x`` に対する拘束を取り" -"除きます。\n" -"つまるところ、新しい名前を与えるようなすべての操作は、ローカルスコープを使っ" -"て行われます。 :keyword:`import` 文、関数の定義は、モジュールや関数名をローカ" -"ルスコープの名前に拘束します。" +":keyword:`global` 文や :keyword:`nonlocal` 文が有効でない場合、\n" +"Python では名前への代入は常に最も内側のスコープで行われます。\n" +"代入はデータをコピーせず、名前をオブジェクトに束縛するだけです。\n" +"削除も同様で、``del x`` はローカルスコープの名前空間から ``x`` の束縛を削除し" +"ます。\n" +"新しい名前を導入する操作はすべてローカルスコープを使います。\n" +"例えば :keyword:`import` 文や関数定義は、モジュール名や関数名をローカルスコー" +"プで束縛します。" #: ../../tutorial/classes.rst:154 msgid "" @@ -464,13 +471,12 @@ msgstr "" "*spam* への束縛を変更し、 :keyword:`global` 代入はモジュールレベルの束縛を変" "更しました。" -#: ../../tutorial/classes.rst:205 msgid "" "You can also see that there was no previous binding for *spam* before the :" "keyword:`global` assignment." msgstr "" -"またここから、 :keyword:`global` 代入の前には *spam* に何も束縛されていなかっ" -"たことも分かります。" +"また、:keyword:`global` による代入の前には、グローバルスコープで *spam* がま" +"だ束縛されていなかったことも分かります。" #: ../../tutorial/classes.rst:212 msgid "A First Look at Classes" @@ -532,17 +538,17 @@ msgstr "" "ラス内の関数定義は通常、メソッドの呼び出し規約で決められた独特の形式の引数リ" "ストを持ちます --- これについても後で述べます。" -#: ../../tutorial/classes.rst:242 msgid "" "When a class definition is entered, a new namespace is created, and used as " "the local scope --- thus, all assignments to local variables go into this " "new namespace. In particular, function definitions bind the name of the new " "function here." msgstr "" -"クラス定義に入ると、新たな名前空間が作成され、ローカルな名前空間として使われ" -"ます --- 従って、ローカルな変数に対する全ての代入はこの新たな名前空間に入りま" -"す。特に、関数定義を行うと、新たな関数の名前はこの名前空間に結び付けられま" -"す。" +"クラス定義に入ると、新しい名前空間が作られ、ローカルスコープとして使われま" +"す。\n" +"したがって、ローカル変数への代入はすべてこの新しい名前空間に対して行われま" +"す。\n" +"特に、関数定義では新しい関数の名前がここに束縛されます。" #: ../../tutorial/classes.rst:247 msgid "" @@ -610,6 +616,11 @@ msgid "" "assignment. :attr:`~type.__doc__` is also a valid attribute, returning the " "docstring belonging to the class: ``\"A simple example class\"``." msgstr "" +"``MyClass.i`` と ``MyClass.f`` は有効な属性参照であり、それぞれ整数と関数オブ" +"ジェクトを返します。クラス属性も代入できるため、代入により ``MyClass.i`` の値" +"を変えられます。 :attr:`~type.__doc__` も有効な属性で、そのクラスに属している" +"ドキュメンテーション文字列(docstring) 、この場合は ``\"A simple example " +"class\"`` を返します。" #: ../../tutorial/classes.rst:282 msgid "" @@ -709,7 +720,6 @@ msgstr "" "スオブジェクトが理解できる唯一の操作は、属性の参照です。有効な属性名には " "(データ属性およびメソッドの) 二種類あります。" -#: ../../tutorial/classes.rst:328 msgid "" "*Data attributes* correspond to \"instance variables\" in Smalltalk, and to " "\"data members\" in C++. Data attributes need not be declared; like local " @@ -718,6 +728,13 @@ msgid "" "following piece of code will print the value ``16``, without leaving a " "trace::" msgstr "" +"*データ属性 (data attribute)* は Smalltalk の「インスタンス変数」や C++ の" +"「データメンバ」に相当します。\n" +"データ属性を宣言する必要はありません。\n" +"ローカル変数と同様に、初めて値を代入したときに作られます。\n" +"例えば、``x`` が上で作成した :class:`!MyClass` のインスタンスなら、\n" +"次のコードは値 ``16`` を表示した後、追加した ``counter`` 属性を削除しま" +"す。 ::" #: ../../tutorial/classes.rst:334 msgid "" @@ -741,7 +758,6 @@ msgstr "" "もう一つのインスタンス属性の参照は、 *メソッド* です。メソッドとは、オブジェ" "クトに \"属する\" 関数のことです。" -#: ../../tutorial/classes.rst:345 msgid "" "Valid method names of an instance object depend on its class. By " "definition, all attributes of a class that are function objects define " @@ -750,13 +766,16 @@ msgid "" "not, since ``MyClass.i`` is not. But ``x.f`` is not the same thing as " "``MyClass.f`` --- it is a *method object*, not a function object." msgstr "" -"インスタンスオブジェクトで有効なメソッド名は、そのクラスによります。定義によ" -"り、クラスの全ての関数オブジェクトである属性がインスタンスオブジェクトの妥当" -"なメソッド名に決まります。従って、例では、``MyClass.f`` は関数なので、``x." -"f`` はメソッドの参照として有効です。しかし、``MyClass.i`` は関数ではないの" -"で、``x.i`` はメソッドの参照として有効ではありません。``x.f`` は ``MyClass." -"f`` と同じものではありません --- 関数オブジェクトではなく、*メソッドオブジェ" -"クト (method object)* です。" +"インスタンスオブジェクトで有効なメソッド名は、そのクラスによって決まりま" +"す。\n" +"定義上、クラス属性が関数オブジェクトであれば、そのクラスのインスタンスに対応" +"するメソッドが定義されます。\n" +"この例では ``MyClass.f`` が関数なので、``x.f`` は有効なメソッド参照です。\n" +"一方、``MyClass.i`` は関数ではないので、``x.i`` はメソッド参照ではありませ" +"ん。\n" +"ただし、``x.f`` は ``MyClass.f`` と同じものではありません。\n" +"``x.f`` は関数オブジェクトではなく、*メソッドオブジェクト (method object)* で" +"す。" #: ../../tutorial/classes.rst:356 msgid "Method Objects" @@ -830,7 +849,6 @@ msgstr "" "スオブジェクトを最初の引数の前に挿入した引数リストで、メソッドに対応する関数" "を呼び出すことと等価です。" -#: ../../tutorial/classes.rst:385 msgid "" "In general, methods work as follows. When a non-data attribute of an " "instance is referenced, the instance's class is searched. If the name " @@ -840,17 +858,17 @@ msgid "" "argument list is constructed from the instance object and the argument list, " "and the function object is called with this new argument list." msgstr "" -"一般的に、メソッドは以下のように動作します。インスタンスの非データ属性が参照" -"されたときは、そのインスタンスのクラスが検索されます。その名前が有効なクラス" -"属性を表している関数オブジェクトなら、インスタンスオブジェクトと関数オブジェ" -"クトの両方への参照がメソッドオブジェクトにパックされます。メソッドオブジェク" -"トが引数リストと共に呼び出されるとき、インスタンスオブジェクトと渡された引数" -"リストから新しい引数リストを作成して、元の関数オブジェクトを新しい引数リスト" -"で呼び出します。" +"メソッドは一般に次のように動作します。\n" +"インスタンスの非データ属性を参照すると、そのインスタンスのクラスから属性を探" +"します。\n" +"見つかった属性が関数オブジェクトなら、インスタンスと関数の両方への参照をまと" +"めてメソッドオブジェクトにします。\n" +"そのメソッドを呼び出すと、渡された引数の先頭にインスタンスを加えた新しい引数" +"リストが作られます。\n" +"そして、その引数リストで関数を呼び出します。" -#: ../../tutorial/classes.rst:398 msgid "Class and Instance Variables" -msgstr "クラスとインスタンス変数" +msgstr "クラス変数とインスタンス変数" #: ../../tutorial/classes.rst:400 msgid "" @@ -996,13 +1014,12 @@ msgstr "" msgid "Random Remarks" msgstr "いろいろな注意点" -#: ../../tutorial/classes.rst:473 msgid "" "If the same attribute name occurs in both an instance and in a class, then " "attribute lookup prioritizes the instance::" msgstr "" -"インスタンスとクラスの両方で同じ属性名が使用されている場合、属性検索はインス" -"タンスが優先されます。" +"インスタンスとクラスに同じ名前の属性がある場合、属性の検索ではインスタンス側" +"が優先されます。 ::" #: ../../tutorial/classes.rst:476 msgid "" @@ -1030,7 +1047,6 @@ msgstr "" ">>> print(w2.purpose, w2.region)\n" "storage east" -#: ../../tutorial/classes.rst:488 msgid "" "Data attributes may be referenced by methods as well as by ordinary users " "(\"clients\") of an object. In other words, classes are not usable to " @@ -1040,15 +1056,15 @@ msgid "" "implementation details and control access to an object if necessary; this " "can be used by extensions to Python written in C.)" msgstr "" -"データ属性は、メソッドから参照できると同時に、通常のオブジェクトのユーザ " -"(\"クライアント\") からも参照できます。言い換えると、クラスは純粋な抽象データ" -"型として使うことができません。実際、 Python では、データ隠蔽を補強するための" -"機構はなにもありません --- データの隠蔽はすべて規約に基づいています。 (逆に、" -"C 言語で書かれた Python の実装では実装の詳細を完全に隠蔽し、必要に応じてオブ" -"ジェクトへのアクセスを制御できます。この機構は C 言語で書かれた Python 拡張で" -"使うことができます。)" +"データ属性は、メソッドからも、オブジェクトの通常の利用者 (「クライアント」) " +"からも参照できます。\n" +"つまり、クラスを使って純粋な抽象データ型を実装することはできません。\n" +"実際、Python にはデータの隠蔽を強制する仕組みがなく、すべて規約に基づいていま" +"す。\n" +"(一方、C で書かれた Python の実装では、必要に応じて実装の詳細を完全に隠し、オ" +"ブジェクトへのアクセスを制御できます。\n" +"C で書く Python の拡張ではこの仕組みを使えます。)" -#: ../../tutorial/classes.rst:496 msgid "" "Clients should use data attributes with care --- clients may mess up " "invariants maintained by the methods by stamping on their data attributes. " @@ -1056,11 +1072,12 @@ msgid "" "without affecting the validity of the methods, as long as name conflicts are " "avoided --- again, a naming convention can save a lot of headaches here." msgstr "" -"クライアントはデータ属性を注意深く扱うべきです --- クライアントは、メソッドが" -"維持しているデータ属性の不変式を踏みにじり、台無しにするかもしれません。クラ" -"イアントは、名前の衝突が回避されている限り、メソッドの有効性に影響を及ぼすこ" -"となくインスタンスに独自の属性を追加することができる、ということに注意してく" -"ださい --- ここでも、名前付けの規約は頭痛の種を無くしてくれます。" +"クライアントはデータ属性を注意して使うべきです。\n" +"データ属性を書き換えると、メソッドが維持する不変条件を壊す可能性がありま" +"す。\n" +"ただし、名前の衝突を避ければ、クライアントはメソッドの正常な動作に影響を与え" +"ずに、インスタンスオブジェクトへ独自のデータ属性を追加できます。\n" +"ここでも、名前付けの規約を使うと多くの問題を避けられます。" #: ../../tutorial/classes.rst:502 msgid "" @@ -1074,7 +1091,6 @@ msgstr "" "ます。あるメソッドを眺めているときにローカルな変数とインスタンス変数をはっき" "り区別できるからです。" -#: ../../tutorial/classes.rst:507 msgid "" "Often, the first argument of a method is called ``self``. This is nothing " "more than a convention: the name ``self`` has absolutely no special meaning " @@ -1083,11 +1099,13 @@ msgid "" "that a *class browser* program might be written that relies upon such a " "convention." msgstr "" -"よく、メソッドの最初の引数を ``self`` と呼びます。この名前付けは単なる慣習で" -"しかありません。 ``self`` という名前は、 Python では何ら特殊な意味を持ちませ" -"ん。とはいえ、この慣行に従わないと、コードは他の Python プログラマにとってや" -"や読みにくいものとなります。また、 *クラスブラウザ (class browser)* プログラ" -"ムがこの慣行をあてにして書かれているかもしれません。" +"メソッドの最初の引数は ``self`` と呼ぶことが多いです。\n" +"これは単なる慣習であり、``self`` という名前自体は Python にとって特別な意味を" +"持ちません。\n" +"ただし、この慣習に従わないと、他の Python プログラマーにとってコードが読みに" +"くくなる可能性があります。\n" +"また、この慣習に依存する *クラスブラウザ (class browser)* プログラムが書かれ" +"ることも考えられます。" #: ../../tutorial/classes.rst:513 msgid "" @@ -1171,7 +1189,6 @@ msgstr "" " self.add(x)\n" " self.add(x)" -#: ../../tutorial/classes.rst:549 msgid "" "Methods may reference global names in the same way as ordinary functions. " "The global scope associated with a method is the module containing its " @@ -1183,15 +1200,16 @@ msgid "" "itself defined in this global scope, and in the next section we'll find some " "good reasons why a method would want to reference its own class." msgstr "" -"メソッドは、通常の関数と同じようにしてグローバルな名前を参照します。あるメ" -"ソッドに関するグローバルスコープは、その定義を含むモジュールです。(クラスはグ" -"ローバルなスコープとして用いられることはありません。) メソッドでグローバルな" -"データを使う良い理由はほとんどありませんが、グローバルなスコープを使うべき場" -"面は多々あります。一つ挙げると、メソッド内から、グローバルなスコープに " -"import された関数やモジュールや、そのモジュール中で定義された関数やクラスを使" -"うことができます。通常、メソッドの入っているクラス自体はグローバルなスコープ" -"内で定義されています。次の節では、メソッドが自分のクラスを参照する理由として" -"正当なものを見てみましょう。" +"メソッドは通常の関数と同様にグローバル名を参照できます。\n" +"メソッドのグローバルスコープは、その定義を含むモジュールです (クラスがグロー" +"バルスコープになることはありません)。\n" +"メソッドでグローバルデータを使う適切な理由はまれですが、グローバルスコープに" +"は妥当な用途が数多くあります。\n" +"例えば、グローバルスコープにインポートした関数やモジュール、そのスコープで定" +"義した関数やクラスは、メソッドからも使えます。\n" +"通常、そのメソッドを含むクラス自体もこのグローバルスコープで定義されていま" +"す。\n" +"次の節では、メソッドが自身のクラスを参照したくなる理由を見ていきます。" #: ../../tutorial/classes.rst:559 msgid "" @@ -1391,7 +1409,6 @@ msgstr "" "る言語で call-next-method として知られており、単一継承しかない言語の super 呼" "び出しよりも強力です。" -#: ../../tutorial/classes.rst:653 msgid "" "Dynamic ordering is necessary because all cases of multiple inheritance " "exhibit one or more diamond relationships (where at least one of the parent " @@ -1406,16 +1423,21 @@ msgid "" "properties make it possible to design reliable and extensible classes with " "multiple inheritance. For more detail, see :ref:`python_2.3_mro`." msgstr "" -"動的順序付けが必要なのは、すべての多重継承で1つ以上のダイヤモンド継承 (少な" -"くとも 1 つの祖先クラスに対して最下位クラスから到達する経路が複数ある状態) が" -"見られるためです。例えば、全ての新形式のクラスは :class:`object` を継承してい" -"るので、どの多重継承でも :class:`object` への到達経路が複数あります。基底クラ" -"スが複数回アクセスされないようにするために、動的アルゴリズムで検索順序を線形" -"化します。それは、各クラスで指定されている左から右への順序は崩さず、各々の祖" -"先クラスを一度だけ呼び出し、かつ単調になる (つまり祖先クラスの検索順序に影響" -"を与えずにクラスをサブクラス化できる) ように行います。まとめると、これらの特" -"徴のおかげで信頼性と拡張性のある多重継承したクラスを設計することができるので" -"す。詳細は、 :ref:`python_2.3_mro` を見てください。" +"検索順序を動的に決める必要があるのは、どの多重継承にも 1 つ以上のダイヤモンド" +"関係があるためです。\n" +"これは、最も下位のクラスから同じ祖先クラスに複数の経路でたどり着ける関係を指" +"します。\n" +"例えば、すべてのクラスは :class:`object` を継承するので、多重継承では :class:" +"`object` に至る経路が複数あります。\n" +"同じ基底クラスを何度もたどらないように、動的なアルゴリズムで検索順序を一列に" +"並べます。\n" +"この順序は、各クラスで指定した基底クラスの左から右への順序を保ち、各祖先クラ" +"スを一度だけたどるように決まります。\n" +"さらに、サブクラスを作っても祖先クラス同士の優先順位が変わらない「単調性」を" +"保ちます。\n" +"こうした性質により、信頼性が高く拡張しやすい多重継承のクラスを設計できま" +"す。\n" +"詳しくは :ref:`python_2.3_mro` を参照してください。" #: ../../tutorial/classes.rst:670 msgid "Private Variables" @@ -1436,7 +1458,6 @@ msgstr "" "ソッドであれデータメンバであれ) 非 public なAPIとして扱います。これらは、予告" "なく変更されるかもしれない実装の詳細として扱われるべきです。" -#: ../../tutorial/classes.rst:682 msgid "" "Since there is a valid use-case for class-private members (namely to avoid " "name clashes of names with names defined by subclasses), there is limited " @@ -1447,14 +1468,17 @@ msgid "" "stripped. This mangling is done without regard to the syntactic position of " "the identifier, as long as it occurs within the definition of a class." msgstr "" -"クラスのプライベートメンバについて適切なユースケース(特にサブクラスで定義され" -"た名前との衝突を避ける場合)があるので、名前マングリング (:dfn:`name " -"mangling`) と呼ばれる、限定されたサポート機構があります。 ``__spam`` (先頭に" -"二個以上の下線文字、末尾に一個以下の下線文字) という形式の識別子は、 " -"``_classname__spam`` へとテキスト置換されるようになりました。ここで " -"``classname`` は、現在のクラス名から先頭の下線文字をはぎとった名前になりま" -"す。このような難号化 (mangle) は、識別子の文法的な位置にかかわらず行われるの" -"で、クラス定義内に現れた識別子全てに対して実行されます。" +"クラスのプライベートメンバは、サブクラスで定義された名前との衝突を避けるのに" +"役立ちます。\n" +"この用途のために、Python は名前マングリング (:dfn:`name mangling`) という限定" +"的な仕組みを備えています。\n" +"``__spam`` のように、先頭に 2 個以上、末尾に 1 個以下のアンダースコアを持つ識" +"別子は、\n" +"テキスト上で ``_classname__spam`` に置き換えられます。\n" +"``classname`` は現在のクラス名から先頭のアンダースコアを取り除いたもので" +"す。\n" +"対象の識別子がクラス定義内にあれば、構文上の位置に関係なくこの変換が行われま" +"す。" #: ../../tutorial/classes.rst:693 msgid "" @@ -1525,19 +1549,17 @@ msgstr "" "``MappingSubclass`` クラスでは ``_MappingSubclass__update`` にそれぞれ置き換" "えるからです。" -#: ../../tutorial/classes.rst:723 msgid "" "Note that the mangling rules are designed mostly to avoid accidents; it " "still is possible to access or modify a variable that is considered " "private. This can even be useful in special circumstances, such as in the " "debugger." msgstr "" -"難号化の規則は主に不慮の事故を防ぐためのものだということに注意してください; " -"確信犯的な方法で、プライベートとされている変数にアクセスしたり変更することは" -"依然として可能なのです。デバッガのような特殊な状況では、この仕様は便利ですら" -"あります。" +"名前マングリングの主な目的は、名前の衝突などの事故を防ぐことです。\n" +"プライベートとされている変数にも、アクセスしたり値を変更したりすることはでき" +"ます。\n" +"デバッガなどでは、この性質が役立つこともあります。" -#: ../../tutorial/classes.rst:727 msgid "" "Notice that code passed to ``exec()`` or ``eval()`` does not consider the " "classname of the invoking class to be the current class; this is similar to " @@ -1546,25 +1568,25 @@ msgid "" "applies to ``getattr()``, ``setattr()`` and ``delattr()``, as well as when " "referencing ``__dict__`` directly." msgstr "" -"``exec()`` や ``eval()`` へ渡されたコードでは、呼出し元のクラス名を現在のクラ" -"スと見なさないことに注意してください。この仕様は ``global`` 文の効果と似てお" -"り、その効果もまた同様に、バイトコンパイルされたコードに制限されています。同" -"じ制約が ``getattr()`` と ``setattr()`` と ``delattr()`` にも適用されます。ま" -"た、``__dict__`` を直接参照するときにも適用されます。" +"``exec()`` や ``eval()`` に渡したコードでは、呼び出し元のクラスは名前マングリ" +"ングに使う現在のクラスとして扱われません。\n" +"これは ``global`` 文と同様で、効果が及ぶのは一緒にバイトコンパイルされるコー" +"ドの範囲だけです。\n" +"``getattr()``、``setattr()``、``delattr()`` を使う場合や、``__dict__`` を直接" +"参照する場合も同じ制約があります。" #: ../../tutorial/classes.rst:738 msgid "Odds and Ends" msgstr "残りのはしばし" -#: ../../tutorial/classes.rst:740 msgid "" "Sometimes it is useful to have a data type similar to the Pascal \"record\" " "or C \"struct\", bundling together a few named data items. The idiomatic " "approach is to use :mod:`dataclasses` for this purpose::" msgstr "" -"Pascal の \"レコード (record)\" や、C 言語の \"構造体 (struct)\" のような、名" -"前つきのデータ要素を一まとめにするデータ型があると便利なことがあります。慣用" -"的な手法として、この目的のために :mod:`dataclasses` を使用します。" +"Pascal のレコードや C の構造体のように、名前付きのデータ項目をまとめる型があ" +"ると便利なことがあります。\n" +"Python では、この用途に :mod:`dataclasses` を使うのが一般的です。 ::" #: ../../tutorial/classes.rst:744 msgid "" @@ -1598,7 +1620,6 @@ msgstr "" ">>> john.salary\n" "1000" -#: ../../tutorial/classes.rst:760 msgid "" "A piece of Python code that expects a particular abstract data type can " "often be passed a class that emulates the methods of that data type " @@ -1607,12 +1628,14 @@ msgid "" "and :meth:`~io.TextIOBase.readline` that get the data from a string buffer " "instead, and pass it as an argument." msgstr "" -"ある特定の抽象データ型を要求する Python コードの断片に、そのデータ型のメソッ" -"ドをエミュレーションするクラスを代わりに渡すことができます。例えば、ファイル" -"オブジェクトから何らかのデータを構築する関数がある場合、 :meth:`~io." -"TextIOBase.read` と :meth:`~io.TextIOBase.readline` を持つクラスを定義して、" -"ファイルではなく文字列バッファからデータを取得するようにしておき、引数として" -"渡すことができます。" +"特定の抽象データ型を想定した Python コードには、その型と同じように動くメソッ" +"ドを備えたクラスを代わりに使えることがよくあります。\n" +"例えば、ファイルオブジェクトから読み取ったデータをフォーマットする関数がある" +"とします。\n" +"ファイルの代わりに文字列バッファからデータを読み取る\n" +":meth:`~io.TextIOBase.read` と :meth:`~io.TextIOBase.readline` メソッドを持つ" +"クラスを定義すれば、\n" +"そのインスタンスをこの関数の引数として渡せます。" #: ../../tutorial/classes.rst:772 msgid "" @@ -1848,17 +1871,16 @@ msgstr "" "__iter__` メソッドと :meth:`~generator.__next__` メソッドが自動で作成されるか" "らです。" -#: ../../tutorial/classes.rst:888 msgid "" "Another key feature is that the local variables and execution state are " "automatically saved between calls. This made the function easier to write " "and much more clear than an approach using instance variables like ``self." "index`` and ``self.data``." msgstr "" -"ジェネレータのもう一つの重要な機能は、呼び出しごとにローカル変数と実行状態が" -"自動的に保存されるということです。これにより、 ``self.index`` や ``self." -"data`` といったインスタンス変数を使ったアプローチよりも簡単に関数を書くことが" -"できるようになります。" +"もう一つの重要な機能は、呼び出しと呼び出しの間にローカル変数と実行状態が自動" +"的に保存されることです。\n" +"このため、``self.index`` や ``self.data`` のようなインスタンス変数を使う方法" +"よりも、関数を簡単に書け、コードもずっと明確になります。" #: ../../tutorial/classes.rst:893 msgid "" @@ -1875,7 +1897,6 @@ msgstr "" msgid "Generator Expressions" msgstr "ジェネレータ式" -#: ../../tutorial/classes.rst:904 msgid "" "Some simple generators can be coded succinctly as expressions using a syntax " "similar to list comprehensions but with parentheses instead of square " @@ -1884,14 +1905,12 @@ msgid "" "compact but less versatile than full generator definitions and tend to be " "more memory friendly than equivalent list comprehensions." msgstr "" -"単純なジェネレータなら式として簡潔にコーディングできます。\n" -"その式はリスト内包表記に似た構文を使いますが、角括弧ではなく丸括弧で囲いま" -"す。\n" -"ジェネレータ式は、関数の中でジェネレータをすぐに使いたいような状況のために用" -"意されています。\n" -"ジェネレータ式は完全なジェネレータの定義よりコンパクトですが、ちょっと融通の" -"効かないところがあります。\n" -"同じ内容を返すリスト内包表記よりはメモリに優しいことが多いという利点がありま" +"単純なジェネレータは、リスト内包表記の角括弧を丸括弧に替えたような構文で、短" +"い式として書けます。\n" +"このジェネレータ式は、ジェネレータを関数の引数として渡し、その関数ですぐに使" +"う場合に適しています。\n" +"ジェネレータを関数として定義するより用途は限られますが、短く書けます。\n" +"また、同じ内容のリスト内包表記よりメモリ使用量を抑えられることが多くなりま" "す。" #: ../../tutorial/classes.rst:911 @@ -1947,6 +1966,11 @@ msgid "" "namespace implementation, and should be restricted to things like post-" "mortem debuggers." msgstr "" +"例外が一つあります。モジュールオブジェクトには、秘密の読取り専用の属性 :attr:" +"`~object.__dict__` があり、モジュールの名前空間を実装するために使われている辞" +"書を返します; ``__dict__`` という名前は属性ですが、グローバルな名前ではありま" +"せん。この属性を利用すると名前空間の実装に対する抽象化を侵すことになるので、" +"プログラムを検死するデバッガのような用途に限るべきです。" #: ../../tutorial/classes.rst:343 msgid "object" @@ -1960,6 +1984,5 @@ msgstr "メソッド" msgid "name" msgstr "name" -#: ../../tutorial/classes.rst:679 msgid "mangling" -msgstr "難号化" +msgstr "マングリング" diff --git a/tutorial/controlflow.po b/tutorial/controlflow.po index b319f2881..43b6d92ee 100644 --- a/tutorial/controlflow.po +++ b/tutorial/controlflow.po @@ -25,10 +25,10 @@ msgstr "" "Last-Translator: Takanori Suzuki , 2025\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../tutorial/controlflow.rst:5 @@ -97,21 +97,18 @@ msgstr "" "elif` ... :keyword:`!elif` ... は、他の言語における ``switch`` 文や " "``case`` 文の代用となります。" -#: ../../tutorial/controlflow.rst:39 msgid "" "If you're comparing the same value to several constants, or checking for " "specific types or attributes, you may also find the :keyword:`!match` " "statement useful. For more details see :ref:`tut-match`." msgstr "" -"いくつかの定数と同じ値かを比較する場合や、特定の型や属性かを確認する場合に" -"は、:keyword:`!match` 文が便利です。詳細は :ref:`tut-match` を参照してくださ" -"い。" +"同じ値を複数の定数と比較する場合や、特定の型や属性を確認する場合には、:" +"keyword:`!match` 文も便利です。詳細は :ref:`tut-match` を参照してください。" #: ../../tutorial/controlflow.rst:46 msgid ":keyword:`!for` Statements" msgstr ":keyword:`!for` 文" -#: ../../tutorial/controlflow.rst:51 msgid "" "The :keyword:`for` statement in Python differs a bit from what you may be " "used to in C or Pascal. Rather than always iterating over an arithmetic " @@ -122,11 +119,11 @@ msgid "" "pun intended):" msgstr "" "Python の :keyword:`for` 文は、読者が C 言語や Pascal 言語で使いなれているか" -"もしれない :keyword:`for` 文とは少し違います。 (Pascal のように) 常に算術型の" -"数列にわたる反復を行ったり、 (C のように) 繰返しステップと停止条件を両方とも" -"ユーザが定義できるようにするのとは違い、Python の :keyword:`!for` 文は、任意" -"のシーケンス型 (リストまたは文字列) にわたって反復を行います。反復の順番は" -"シーケンス中に要素が現れる順番です。例えば:" +"もしれない ``for`` 文とは少し違います。 (Pascal のように) 常に等差数列にわた" +"る反復を行ったり、 (C のように) 繰返しステップと停止条件を両方ともユーザが定" +"義できるようにするのとは違い、Python の :keyword:`!for` 文は、任意のシーケン" +"ス型 (リストまたは文字列) にわたって反復を行います。反復の順番はシーケンス中" +"に要素が現れる順番です。例えば:" #: ../../tutorial/controlflow.rst:63 msgid "" @@ -148,16 +145,14 @@ msgstr "" "window 6\n" "defenestrate 12" -#: ../../tutorial/controlflow.rst:72 msgid "" "Code that modifies a collection while iterating over that same collection " "can be tricky to get right. Instead, it is usually more straight-forward to " "loop over a copy of the collection or to create a new collection::" msgstr "" -"コレクションオブジェクトの値を反復処理をしているときに、そのコレクションオブ" -"ジェクトを変更するコードは理解するのが面倒になり得ます。\n" -"そうするよりも、コレクションオブジェクトのコピーに対して反復処理をするか、新" -"しいコレクションオブジェクトを作成する方が通常は理解しやすいです::" +"コレクションを反復処理しながらそのコレクションを変更するコードを正しく書くの" +"は難しいことがあります。通常は、コレクションのコピーを反復処理するか、新しい" +"コレクションを作成する方が簡単です。 ::" #: ../../tutorial/controlflow.rst:76 msgid "" @@ -193,13 +188,12 @@ msgstr "" msgid "The :func:`range` Function" msgstr ":func:`range` 関数" -#: ../../tutorial/controlflow.rst:96 msgid "" "If you do need to iterate over a sequence of numbers, the built-in function :" "func:`range` comes in handy. It generates arithmetic progressions::" msgstr "" "数列にわたって反復を行う必要がある場合、組み込み関数 :func:`range` が便利で" -"す。この関数は算術型の数列を生成します::" +"す。この関数は等差数列を生成します。 ::" #: ../../tutorial/controlflow.rst:99 msgid "" @@ -351,13 +345,12 @@ msgstr "" msgid ":keyword:`!break` and :keyword:`!continue` Statements" msgstr ":keyword:`!break` 文と :keyword:`!continue` 文" -#: ../../tutorial/controlflow.rst:166 msgid "" "The :keyword:`break` statement breaks out of the innermost enclosing :" "keyword:`for` or :keyword:`while` loop::" msgstr "" -":keyword:`break` 文は、その `break` 文を内包している最も内側にある :keyword:" -"`for` 文または :keyword:`while` 文から抜け出すことができます::" +":keyword:`break` 文は、その文を囲む最も内側の :keyword:`for` ループまたは :" +"keyword:`while` ループを抜けます。 ::" #: ../../tutorial/controlflow.rst:169 msgid "" @@ -469,7 +462,6 @@ msgid "" "for prime numbers::" msgstr "その例として、素数を探索する :keyword:`!for` 文を以下に示します::" -#: ../../tutorial/controlflow.rst:221 msgid "" ">>> for n in range(2, 10):\n" "... for x in range(2, n):\n" @@ -492,11 +484,11 @@ msgstr "" ">>> for n in range(2, 10):\n" "... for x in range(2, n):\n" "... if n % x == 0:\n" -"... print(n, 'は', x, '*', n//x, 'と等しい')\n" +"... print(n, 'equals', x, '*', n//x)\n" "... break\n" "... else:\n" "... # 因数が見つからないとループは最後まで実行される\n" -"... print(n, 'は素数です')\n" +"... print(n, 'is a prime number')\n" "...\n" "2 is a prime number\n" "3 is a prime number\n" @@ -515,7 +507,6 @@ msgstr "" "(そう、これは正しいコードです。よく見てください: ``else`` 節は ``if`` 文 **で" "はなく** 、 ``for`` ループに属しています。)" -#: ../../tutorial/controlflow.rst:242 msgid "" "One way to think of the else clause is to imagine it paired with the ``if`` " "inside the loop. As the loop executes, it will run a sequence like if/if/if/" @@ -523,8 +514,12 @@ msgid "" "condition is ever true, a ``break`` will happen. If the condition is never " "true, the ``else`` clause outside the loop will execute." msgstr "" +"else 節を理解するには、ループ内の ``if`` と対になると考える方法があります。" +"ループが実行されるにつれて if/if/if/else のように処理が進みます。 ``if`` は" +"ループの内側にあり、何度も実行されます。条件が一度でも真になれば ``break`` が" +"実行されます。一度も真にならなければ、ループの外側にある ``else`` 節が実行さ" +"れます。" -#: ../../tutorial/controlflow.rst:248 msgid "" "When used with a loop, the ``else`` clause has more in common with the " "``else`` clause of a :keyword:`try` statement than it does with that of " @@ -534,9 +529,9 @@ msgid "" "handling`." msgstr "" "ループの ``else`` 句は、 ``if`` 文の ``else`` よりも :keyword:`try` 文の " -"``else`` に似ています。 文の ``else`` 句は例外が発生しなかった時に実行され、" -"ループの ``else`` 句は ``break`` されなかった場合に実行されます。 ``try`` 文" -"と例外についての詳細は :ref:`tut-handling` を参照してください。" +"``else`` に似ています。 ``try`` 文の ``else`` 句は例外が発生しなかった時に実" +"行され、ループの ``else`` 句は ``break`` されなかった場合に実行されます。 " +"``try`` 文と例外についての詳細は :ref:`tut-handling` を参照してください。" #: ../../tutorial/controlflow.rst:257 msgid ":keyword:`!pass` Statements" @@ -547,8 +542,8 @@ msgid "" "The :keyword:`pass` statement does nothing. It can be used when a statement " "is required syntactically but the program requires no action. For example::" msgstr "" -":keyword:`pass` 文は何もしません。 :keyword:`pass` は、文を書くことが構文上要" -"求されているが、プログラム上何の動作もする必要がない時に使われます::" +":keyword:`pass` 文は何もしません。 ``pass`` は、文を書くことが構文上要求され" +"ているが、プログラム上何の動作もする必要がない時に使われます::" #: ../../tutorial/controlflow.rst:262 msgid "" @@ -600,7 +595,6 @@ msgstr "" msgid ":keyword:`!match` Statements" msgstr ":keyword:`!match` 文" -#: ../../tutorial/controlflow.rst:286 msgid "" "A :keyword:`match` statement takes an expression and compares its value to " "successive patterns given as one or more case blocks. This is superficially " @@ -610,11 +604,16 @@ msgid "" "also extract components (sequence elements or object attributes) from the " "value into variables. If no case matches, none of the branches is executed." msgstr "" +":keyword:`match` 文は式を受け取り、その値を1つ以上の case ブロックに指定され" +"たパターンと順に比較します。表面的には C、Java、JavaScript などの switch 文に" +"似ていますが、Rust や Haskell などのパターンマッチングにより近いものです。最" +"初にマッチしたパターンのブロックだけが実行されます。また、値から構成要素 " +"(シーケンスの要素やオブジェクトの属性) を取り出して変数に代入することもできま" +"す。どの case にもマッチしなければ、どの分岐も実行されません。" -#: ../../tutorial/controlflow.rst:295 msgid "" "The simplest form compares a subject value against one or more literals::" -msgstr "最も単純な形式は、対象の値に対して1つ以上のリテラルです::" +msgstr "最も単純な形式では、対象の値を1つ以上のリテラルと比較します。 ::" #: ../../tutorial/controlflow.rst:297 msgid "" @@ -645,13 +644,15 @@ msgid "" "Note the last block: the \"variable name\" ``_`` acts as a *wildcard* and " "never fails to match." msgstr "" +"最後のブロックについて: 変数名 ``_`` は *ワイルドカード* の働きをし、マッチに" +"絶対失敗しません。" #: ../../tutorial/controlflow.rst:311 msgid "" "You can combine several literals in a single pattern using ``|`` (\"or\")::" msgstr "" "複数のリテラルを ``|`` (\"or\")を使用して組み合わせて1つのパターンにできま" -"す::" +"す。" #: ../../tutorial/controlflow.rst:313 msgid "" @@ -661,11 +662,12 @@ msgstr "" "case 401 | 403 | 404:\n" " return \"Not allowed\"" -#: ../../tutorial/controlflow.rst:316 msgid "" "Patterns can look like unpacking assignments, and can be used to bind " "variables::" -msgstr "パターンはアンパック代入ができ、変数に結びつけられます::" +msgstr "" +"パターンはアンパック代入に似た形で書くことができ、変数に値を結びつけるために" +"使えます。 ::" #: ../../tutorial/controlflow.rst:319 msgid "" @@ -682,10 +684,10 @@ msgid "" " case _:\n" " raise ValueError(\"Not a point\")" msgstr "" -"# point(座標) は (x, y) のタプル\n" +"# point は (x, y) のタプル\n" "match point:\n" " case (0, 0):\n" -" print(\"原点\")\n" +" print(\"Origin\")\n" " case (0, y):\n" " print(f\"Y={y}\")\n" " case (x, 0):\n" @@ -693,7 +695,7 @@ msgstr "" " case (x, y):\n" " print(f\"X={x}, Y={y}\")\n" " case _:\n" -" raise ValueError(\"座標ではない\")" +" raise ValueError(\"Not a point\")" #: ../../tutorial/controlflow.rst:332 msgid "" @@ -712,14 +714,14 @@ msgstr "" "4番目のパターンは2つの値を取り込みます。\n" "これは、アンパック代入 ``(x, y) = point`` と概念的に似ています。" -#: ../../tutorial/controlflow.rst:339 msgid "" "If you are using classes to structure your data you can use the class name " "followed by an argument list resembling a constructor, but with the ability " "to capture attributes into variables::" msgstr "" -"データを構造化するためにクラスを使っている場合は、クラス名の後ろにコンストラ" -"クターのように引数のリストを指定できます。属性の値は変数に取り込まれます。" +"データを構造化するためにクラスを使っている場合は、クラス名の後にコンストラク" +"ターに似た引数リストを指定できます。これにより属性の値を変数に取り込めま" +"す。 ::" #: ../../tutorial/controlflow.rst:343 msgid "" @@ -759,7 +761,6 @@ msgstr "" " case _:\n" " print(\"座標ではない\")" -#: ../../tutorial/controlflow.rst:361 msgid "" "You can use positional parameters with some builtin classes that provide an " "ordering for their attributes (e.g. dataclasses). You can also define a " @@ -768,11 +769,12 @@ msgid "" "\"y\"), the following patterns are all equivalent (and all bind the ``y`` " "attribute to the ``var`` variable)::" msgstr "" -"いくつかの組み込みクラスでは位置引数が使用でき、属性の順番を提供します(例: " -"データクラス)。クラスの ``__match_args__`` 特殊属性によって、パターンの中で属" -"性の明確な位置を定義することもできます。(\"x\", \"y\")が設定された場合、以下" -"のすべてのパターンは等価です(すべて属性 ``y`` が ``var`` 変数に結びつけられま" -"す)::" +"属性の順序を定めている一部の組み込みクラス (例えばデータクラス) では、位置パ" +"ラメータを使えます。\n" +"また、クラスの特殊属性 ``__match_args__`` を設定して、パターン内で各属性が占" +"める位置を定義することもできます。\n" +"これを (\"x\", \"y\") に設定した場合、次のパターンはすべて等価で、いずれも属" +"性 ``y`` の値を変数 ``var`` に束縛します。 ::" #: ../../tutorial/controlflow.rst:367 msgid "" @@ -804,14 +806,13 @@ msgstr "" "(名前の後ろの \"(...)\" によって判別される。上記の ``Point`` など)には値は" "代入されません。" -#: ../../tutorial/controlflow.rst:379 msgid "" "Patterns can be arbitrarily nested. For example, if we have a short list of " "Points, with ``__match_args__`` added, we could match it like this::" msgstr "" -"パターンはいくらでも入れ子 (ネスト) にすることができます。例えば、 " -"``__match_args__`` を追加した Point クラスのリストに対して次のようにマッチを" -"行うことができます::" +"パターンは任意にネストできます。\n" +"例えば、``__match_args__`` を追加した ``Point`` クラスのインスタンスからなる" +"短いリストがある場合、次のようにマッチできます。 ::" #: ../../tutorial/controlflow.rst:382 msgid "" @@ -851,15 +852,14 @@ msgstr "" " case _:\n" " print(\"それ以外のどこか\")" -#: ../../tutorial/controlflow.rst:400 msgid "" "We can add an ``if`` clause to a pattern, known as a \"guard\". If the " "guard is false, ``match`` goes on to try the next case block. Note that " "value capture happens before the guard is evaluated::" msgstr "" -"パターンに ``if`` 節を追加できます。これは \"ガード\" と呼ばれます。ガードが" -"falseの場合、``match`` は次のcaseブロックの処理に移動します。ガードを評価する" -"前に値が取り込まれることに注意してください::" +"パターンには「ガード」と呼ばれる ``if`` 節を追加できます。\n" +"ガードが偽の場合、``match`` は次の case ブロックとのマッチを試みます。\n" +"値の取り込みは、ガードの評価より前に行われます。 ::" #: ../../tutorial/controlflow.rst:404 msgid "" @@ -875,9 +875,8 @@ msgstr "" " case Point(x, y):\n" " print(f\"対角線上ではない\")" -#: ../../tutorial/controlflow.rst:410 msgid "Several other key features of this statement:" -msgstr "この文のその他のいくつか重要な特徴::" +msgstr "この文には、ほかにも次のような重要な特徴があります:" #: ../../tutorial/controlflow.rst:412 msgid "" @@ -929,13 +928,12 @@ msgstr "" "この例では入力から2番目の要素を ``p2`` として取り込みます(入力が2つのポイン" "トのシーケンスである場合)" -#: ../../tutorial/controlflow.rst:433 msgid "" "Most literals are compared by equality, however the singletons ``True``, " "``False`` and ``None`` are compared by identity." msgstr "" -"ほとんどのリテラルは同一性を比較しますが、シングルトンの ``True``、" -"``False``、``None`` では識別値を比較します。" +"ほとんどのリテラルは値が等しいかどうかで比較しますが、シングルトンの " +"``True``、``False``、``None`` は同一のオブジェクトかどうかで比較します。" #: ../../tutorial/controlflow.rst:436 msgid "" @@ -999,7 +997,6 @@ msgstr "" "フィボナッチ数列 (Fibonacci series) を任意の上限値まで書き出すような関数を作" "成できます::" -#: ../../tutorial/controlflow.rst:466 msgid "" ">>> def fib(n): # write Fibonacci series less than n\n" "... \"\"\"Print a Fibonacci series less than n.\"\"\"\n" @@ -1013,8 +1010,8 @@ msgid "" ">>> fib(2000)\n" "0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597" msgstr "" -">>> def fib(n): # nまでのフィボナッチ数を出力する\n" -"... \"\"\"nまでのフィボナッチ数をprintする。\"\"\"\n" +">>> def fib(n): # n 未満のフィボナッチ数列を出力する\n" +"... \"\"\"n 未満のフィボナッチ数列を出力する。\"\"\"\n" "... a, b = 0, 1\n" "... while a < n:\n" "... print(a, end=' ')\n" @@ -1032,12 +1029,10 @@ msgid "" "parameters. The statements that form the body of the function start at the " "next line, and must be indented." msgstr "" -":keyword:`def` は関数の *定義 (definition)* を導くキーワードです。 :keyword:" -"`def` の後には、関数名と仮引数を丸括弧で囲んだリストを続けなければなりませ" -"ん。関数の実体を構成する実行文は次の行から始め、インデントされていなければな" -"りません。" +":keyword:`def` は関数の *定義 (definition)* を導くキーワードです。 ``def`` の" +"後には、関数名と仮引数を丸括弧で囲んだリストを続けなければなりません。関数の" +"実体を構成する実行文は次の行から始め、インデントされていなければなりません。" -#: ../../tutorial/controlflow.rst:488 msgid "" "The first statement of the function body can optionally be a string literal; " "this string literal is the function's documentation string, or :dfn:" @@ -1047,15 +1042,14 @@ msgid "" "through code; it's good practice to include docstrings in code that you " "write, so make a habit of it." msgstr "" -"関数の本体の記述する文の最初の行は文字列リテラルにすることもできます。その場" -"合、この文字列は関数のドキュメンテーション文字列 (documentation string)、また" -"は :dfn:`docstring` と呼ばれます。 (docstring については :ref:`tut-" -"docstrings` でさらに扱っています。) ドキュメンテーション文字列を使ったツール" -"には、オンライン文書や印刷文書を自動的に生成したり、ユーザが対話的にコードか" -"ら直接閲覧できるようにするものがあります。自分が書くコードにドキュメンテー" -"ション文字列を入れるのはよい習慣です。書く癖をつけてください。" +"関数本体の最初の文は文字列リテラルにすることもできます。その場合、この文字列" +"は関数のドキュメンテーション文字列 (documentation string)、または :dfn:" +"`docstring` と呼ばれます。 (docstring については :ref:`tut-docstrings` でさら" +"に扱っています。) ドキュメンテーション文字列を使ったツールには、オンライン文" +"書や印刷文書を自動的に生成したり、ユーザが対話的にコードから直接閲覧できるよ" +"うにするものがあります。自分が書くコードにドキュメンテーション文字列を入れる" +"のはよい習慣です。書く癖をつけてください。" -#: ../../tutorial/controlflow.rst:495 msgid "" "The *execution* of a function introduces a new symbol table used for the " "local variables of the function. More precisely, all variable assignments " @@ -1068,16 +1062,17 @@ msgid "" "for variables of enclosing functions, named in a :keyword:`nonlocal` " "statement), although they may be referenced." msgstr "" -"関数を *実行 (execution)* するとき、関数のローカル変数のために使われる新たな" -"シンボルテーブル (symbol table) が用意されます。\n" -"もっと正確にいうと、関数内で変数への代入を行うと、その値はすべてこのローカル" -"なシンボルテーブルに記憶されます。\n" -"一方、変数の参照を行うと、まずローカルなシンボルテーブルが検索され、次にさら" -"に外側の関数のローカルなシンボルテーブルを検索し、その後グローバルなシンボル" -"テーブルを調べ、最後に組み込みの名前テーブルを調べます。\n" -"従って、関数の中では (グローバル変数が :keyword:`global` 文で指定されていた" -"り、外側の関数の変数が :keyword:`nonlocal` 文で指定されていない限り) グローバ" -"ル変数や外側の関数の変数に直接値を代入できませんが、参照することはできます。" +"関数を *実行 (execution)* すると、その関数のローカル変数に使う新しいシンボル" +"テーブル (symbol table) が作られます。\n" +"より正確には、関数内で変数に値を代入すると、その値はローカルなシンボルテーブ" +"ルに格納されます。\n" +"変数を参照するときは、まずローカルなシンボルテーブル、次に外側の関数のローカ" +"ルなシンボルテーブル、その次にグローバルなシンボルテーブル、最後に組み込み名" +"のテーブルを検索します。\n" +"したがって、関数内からグローバル変数や外側の関数の変数を参照することはできま" +"すが、直接値を代入することはできません。\n" +"ただし、グローバル変数を :keyword:`global` 文で指定した場合や、外側の関数の変" +"数を :keyword:`nonlocal` 文で指定した場合は例外です。" #: ../../tutorial/controlflow.rst:506 msgid "" @@ -1096,17 +1091,18 @@ msgstr "" "きには、新たな呼び出しのためにローカルなシンボルテーブルが新たに作成されま" "す。" -#: ../../tutorial/controlflow.rst:513 msgid "" "A function definition associates the function name with the function object " "in the current symbol table. The interpreter recognizes the object pointed " "to by that name as a user-defined function. Other names can also point to " "that same function object and can also be used to access the function::" msgstr "" -"関数の定義を行うと、関数名は関数オブジェクトとともに現在のシンボルテーブル内" -"に取り入れられます。インタープリタはその名前が指すオブジェクトをユーザ定義関" -"数 (user-defined function) として認識します。他の名前も同じ関数オブジェクトを" -"指すことができ、またその関数にアクセスするために使用することができます::" +"関数定義は、現在のシンボルテーブルで関数名と関数オブジェクトを関連付けま" +"す。\n" +"インタープリタは、その名前が指すオブジェクトをユーザー定義関数 (user-defined " +"function) として認識します。\n" +"他の名前も同じ関数オブジェクトを指すことができ、その名前を使って関数にアクセ" +"スできます。 ::" #: ../../tutorial/controlflow.rst:518 msgid "" @@ -1149,15 +1145,13 @@ msgstr "" ">>> print(fib(0))\n" "None" -#: ../../tutorial/controlflow.rst:535 msgid "" "It is simple to write a function that returns a list of the numbers of the " "Fibonacci series, instead of printing it::" msgstr "" -"フィボナッチ数列の数からなるリストを出力する代わりに、値を返すような関数を書" -"くのは簡単です::" +"フィボナッチ数列を出力する代わりに、数列の値を含むリストを返す関数も簡単に書" +"けます。 ::" -#: ../../tutorial/controlflow.rst:538 msgid "" ">>> def fib2(n): # return Fibonacci series up to n\n" "... \"\"\"Return a list containing the Fibonacci series up to n.\"\"\"\n" @@ -1172,8 +1166,8 @@ msgid "" ">>> f100 # write the result\n" "[0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]" msgstr "" -">>> def fib2(n): # nまでのフィボナッチ数を返す\n" -"... \"\"\"nまでのフィボナッチ数を含むリストを返す。\"\"\"\n" +">>> def fib2(n): # n 未満のフィボナッチ数列を返す\n" +"... \"\"\"n 未満のフィボナッチ数列を含むリストを返す。\"\"\"\n" "... result = []\n" "... a, b = 0, 1\n" "... while a < n:\n" @@ -1189,15 +1183,14 @@ msgstr "" msgid "This example, as usual, demonstrates some new Python features:" msgstr "この例は Python の新しい機能を示しています:" -#: ../../tutorial/controlflow.rst:553 msgid "" "The :keyword:`return` statement returns with a value from a function. :" "keyword:`!return` without an expression argument returns ``None``. Falling " "off the end of a function also returns ``None``." msgstr "" -":keyword:`return` 文では、関数から一つ値を返します。 :keyword:`!return` の引" -"数となる式がない場合、 ``None`` が返ります。関数が終了したときにも ``None`` " -"が返ります。" +":keyword:`return` 文は値を返して関数を終了します。式を指定しない :keyword:`!" +"return` は ``None`` を返します。関数本体の末尾に到達した場合も ``None`` を返" +"します。" #: ../../tutorial/controlflow.rst:557 msgid "" @@ -1339,16 +1332,16 @@ msgstr "" msgid "will print ``5``." msgstr "は ``5`` を出力します。" -#: ../../tutorial/controlflow.rst:624 msgid "" "**Important warning:** The default value is evaluated only once. This makes " "a difference when the default is a mutable object such as a list, " "dictionary, or instances of most classes. For example, the following " "function accumulates the arguments passed to it on subsequent calls::" msgstr "" -"**重要な警告:** デフォルト値は 1 度だけしか評価されません。デフォルト値がリ" -"ストや辞書のような変更可能なオブジェクトの時にはその影響がでます。例えば以下" -"の関数は、後に続く関数呼び出しで関数に渡されている引数を累積します::" +"**重要な警告:** デフォルト値は1度しか評価されません。このことは、デフォルト値" +"がリスト、辞書、多くのクラスのインスタンスなどのミュータブルなオブジェクトで" +"ある場合に影響します。例えば、次の関数は呼び出されるたびに渡された引数を蓄積" +"します。 ::" #: ../../tutorial/controlflow.rst:629 msgid "" @@ -1431,16 +1424,15 @@ msgstr "" " print(\"-- Lovely plumage, the\", type)\n" " print(\"-- It's\", state, \"!\")" -#: ../../tutorial/controlflow.rst:667 msgid "" "accepts one required argument (``voltage``) and three optional arguments " "(``state``, ``action``, and ``type``). This function can be called in any " "of the following ways::" msgstr "" -"は、必須引数 (``voltage``) とオプション引数 (``state``、``action``、" -"``type``) を受け付けます。この関数は以下のいずれかの方法で呼び出せます::" +"は、1つの必須引数 (``voltage``) と3つのオプション引数 (``state``、" +"``action``、``type``) を受け付けます。この関数は以下のいずれかの方法で呼び出" +"せます。 ::" -#: ../../tutorial/controlflow.rst:671 msgid "" "parrot(1000) # 1 positional " "argument\n" @@ -1455,10 +1447,9 @@ msgstr "" "parrot(1000) # 1つの位置引数\n" "parrot(voltage=1000) # 1つのキーワード引数\n" "parrot(voltage=1000000, action='VOOOOOM') # 2つのキーワード引数\n" -"parrot(action='VOOOOOM', voltage=1000000) # 2つのキーワード引" -"数 \n" +"parrot(action='VOOOOOM', voltage=1000000) # 2つのキーワード引数\n" "parrot('a million', 'bereft of life', 'jump') # 3つの位置引数\n" -"parrot('a thousand', state='pushing up the daisies') # 1との位置引数と1つの" +"parrot('a thousand', state='pushing up the daisies') # 1つの位置引数と1つの" "キーワード引数" #: ../../tutorial/controlflow.rst:678 @@ -1640,17 +1631,16 @@ msgstr "" " | - キーワード専用\n" " -- 位置専用" -#: ../../tutorial/controlflow.rst:762 msgid "" "where ``/`` and ``*`` are optional. If used, these symbols indicate the kind " "of parameter by how the arguments may be passed to the function: positional-" "only, positional-or-keyword, and keyword-only. Keyword parameters are also " "referred to as named parameters." msgstr "" -"ここで、``/`` と ``*`` はオプションです。使用された場合、これらの記号は、引数" -"が関数に渡される方法、すなわち、位置専用、位置またはキーワード、キーワード専" -"用、といった引数の種類を示します。キーワード引数は、名前付き引数とも呼ばれま" -"す。" +"ここで ``/`` と ``*`` は省略できます。\n" +"これらの記号を使うと、実引数を関数に渡せる方法に応じて、仮引数が位置専用、位" +"置またはキーワード、キーワード専用のどれであるかを示せます。\n" +"キーワードパラメータは、名前付きパラメータとも呼ばれます。" #: ../../tutorial/controlflow.rst:769 msgid "Positional-or-Keyword Arguments" @@ -1865,14 +1855,13 @@ msgstr "" "TypeError: combined_example() got some positional-only arguments passed as " "keyword arguments: 'pos_only'" -#: ../../tutorial/controlflow.rst:868 msgid "" "Finally, consider this function definition which has a potential collision " "between the positional argument ``name`` and ``**kwds`` which has ``name`` " "as a key::" msgstr "" "最後に、位置引数 ``name`` と ``name`` をキーとして持つ ``**kwds`` の間に潜在" -"的な衝突がある関数定義を考えてみましょう。" +"的な衝突がある関数定義を考えてみましょう。 ::" #: ../../tutorial/controlflow.rst:870 msgid "" @@ -1882,14 +1871,12 @@ msgstr "" "def foo(name, **kwds):\n" " return 'name' in kwds" -#: ../../tutorial/controlflow.rst:873 msgid "" "There is no possible call that will make it return ``True`` as the keyword " "``'name'`` will always bind to the first parameter. For example::" msgstr "" -"キーワードに ``'name'`` を入れても、先頭の引数と同じになってしまうため、この" -"関数が ``True`` を返すような呼び出しの方法はありません。例えば、次のように" -"なってしまいます::" +"キーワード引数 ``'name'`` は常に最初の引数に結びつけられるため、この関数が " +"``True`` を返す呼び出し方はありません。例えば次のようになります。 ::" #: ../../tutorial/controlflow.rst:876 msgid "" @@ -1941,11 +1928,10 @@ msgstr "" msgid "Recap" msgstr "要約" -#: ../../tutorial/controlflow.rst:897 msgid "" "The use case will determine which parameters to use in the function " "definition::" -msgstr "使用例で、関数定義でどの種類の引数を使うかべきかがわかると思います::" +msgstr "関数定義でどの種類の引数を使うかは、用途に応じて決めます。 ::" #: ../../tutorial/controlflow.rst:899 msgid "def f(pos1, pos2, /, pos_or_kwd, *, kwd1, kwd2):" @@ -1955,7 +1941,6 @@ msgstr "def f(pos1, pos2, /, pos_or_kwd, *, kwd1, kwd2):" msgid "As guidance:" msgstr "ガイドとしては、" -#: ../../tutorial/controlflow.rst:903 msgid "" "Use positional-only if you want the name of the parameters to not be " "available to the user. This is useful when parameter names have no real " @@ -1963,34 +1948,27 @@ msgid "" "is called or if you need to take some positional parameters and arbitrary " "keywords." msgstr "" -"もし引数の名前をユーザーに知らせる必要がないなら、位置専用引数を使用しましょ" -"う。これは引数の名前がユーザーにとって意味がなく、関数が呼ばれたときの引数の" -"順序が問題であり、または、位置引数と任意のキーワードを使用する必要がある場合" -"に便利です。" +"呼び出し側が引数名を使って指定できないようにしたい場合は、位置専用引数を使い" +"ます。引数名に特に意味がない場合や、呼び出し時の引数の順序を固定したい場合、" +"いくつかの位置引数と任意のキーワード引数を受け取りたい場合に便利です。" -#: ../../tutorial/controlflow.rst:908 msgid "" "Use keyword-only when names have meaning and the function definition is more " "understandable by being explicit with names or you want to prevent users " "relying on the position of the argument being passed." msgstr "" -"引数の名前に意味があり、それにより関数の定義がより明らかになる、または、ユー" -"ザーが引数の順番に縛られることを避けたほうがいいと考えるのなら、キーワード専" -"用引数を使用しましょう。" +"引数名に意味があり、名前を明示した方が関数定義を理解しやすい場合や、呼び出し" +"側が引数の位置に依存するのを防ぎたい場合は、キーワード専用引数を使います。" -#: ../../tutorial/controlflow.rst:911 msgid "" "For an API, use positional-only to prevent breaking API changes if the " "parameter's name is modified in the future." -msgstr "" -"APIの場合、将来引数の名前が変更された場合にAPIの変更ができなくなることを防ぐ" -"ために、位置専用引数を使用しましょう。" +msgstr "API では位置専用引数を使うと、将来引数名を変更しても互換性を保てます。" #: ../../tutorial/controlflow.rst:917 msgid "Arbitrary Argument Lists" msgstr "任意引数リスト" -#: ../../tutorial/controlflow.rst:922 msgid "" "Finally, the least frequently used option is to specify that a function can " "be called with an arbitrary number of arguments. These arguments will be " @@ -1999,8 +1977,8 @@ msgid "" msgstr "" "最後に、最も使うことの少ない選択肢として、関数が任意の個数の引数で呼び出せる" "よう指定する方法があります。これらの引数はタプル (:ref:`tut-tuples` を参照) " -"に格納されます。可変個の引数の前に、ゼロ個かそれ以上の引数があっても構いませ" -"ん。 ::" +"に格納されます。可変個の引数の前に、ゼロ個かそれ以上の通常の引数があっても構" +"いません。 ::" #: ../../tutorial/controlflow.rst:927 msgid "" @@ -2155,6 +2133,9 @@ msgid "" "use is to pass a small function as an argument. For instance, :meth:`list." "sort` takes a sorting key function *key* which can be a lambda function::" msgstr "" +"上記の例ではラムダ式を使って関数を返しています。 別の使い方としては、小さな" +"関数を引数として渡すこともできます。 たとえば、 :meth:`list.sort` はソート" +"キー関数 *key* を受け取りますが、これにはラムダ関数を渡せます::" #: ../../tutorial/controlflow.rst:1005 msgid "" @@ -2180,7 +2161,6 @@ msgstr "" "ドキュメンテーション文字列については、その内容と書式に関する慣習をいくつか挙" "げます。" -#: ../../tutorial/controlflow.rst:1024 msgid "" "The first line should always be a short, concise summary of the object's " "purpose. For brevity, it should not explicitly state the object's name or " @@ -2188,11 +2168,11 @@ msgid "" "to be a verb describing a function's operation). This line should begin " "with a capital letter and end with a period." msgstr "" -"最初の行は、常に対象物の目的を短く簡潔にまとめたものでなくてはなりません。簡" -"潔に書くために、対象物の名前や型を明示する必要はありません。名前や型は他の方" -"法でも得られるからです (名前がたまたま関数の演算内容を記述する動詞である場合" -"は例外です)。最初の行は大文字で始まり、ピリオドで終わっていなければなりませ" -"ん。" +"最初の行には、オブジェクトの目的を短く簡潔にまとめます。\n" +"簡潔にするため、オブジェクトの名前や型は明記しないようにします。\n" +"これらは他の方法で分かるためです (ただし、名前が関数の動作を表す動詞である場" +"合は例外です)。\n" +"この行は大文字で始め、ピリオドで終えます。" #: ../../tutorial/controlflow.rst:1030 msgid "" @@ -2248,6 +2228,17 @@ msgid "" "\n" "No, really, it doesn't do anything." msgstr "" +">>> def my_function():\n" +"... \"\"\"なにもしないがドキュメントは書く。\n" +"...\n" +"... 本当になにもしない。\n" +"... \"\"\"\n" +"... pass\n" +"...\n" +">>> print(my_function.__doc__)\n" +"なにもしないがドキュメントは書く。\n" +"\n" +"本当になにもしない。" #: ../../tutorial/controlflow.rst:1065 msgid "Function Annotations" @@ -2282,7 +2273,6 @@ msgstr "" "ロンの間で、 ``->`` の後ろに式を書くことで定義されます。\n" "次の例では、必須引数と任意引数、戻り値にアノテーションが付与されています::" -#: ../../tutorial/controlflow.rst:1086 msgid "" ">>> def f(ham: str, eggs: str = 'eggs') -> str:\n" "... print(\"Annotations:\", f.__annotations__)\n" @@ -2301,9 +2291,9 @@ msgstr "" "... return ham + ' and ' + eggs\n" "...\n" ">>> f('spam')\n" -"アノテーション: {'ham': , 'return': , 'eggs': " -"}\n" -"引数: spam eggs\n" +"Annotations: {'ham': , 'return': , 'eggs': }\n" +"Arguments: spam eggs\n" "'spam and eggs'" #: ../../tutorial/controlflow.rst:1099 diff --git a/tutorial/datastructures.po b/tutorial/datastructures.po index c50ac9c23..a99c0d34f 100644 --- a/tutorial/datastructures.po +++ b/tutorial/datastructures.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: Takanori Suzuki , 2025\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../tutorial/datastructures.rst:5 @@ -52,12 +52,11 @@ msgstr "" msgid "Add an item to the end of the list. Similar to ``a[len(a):] = [x]``." msgstr "リストの末尾に要素を一つ追加します。``a[len(a):] = [x]`` と同様です。" -#: ../../tutorial/datastructures.rst:28 msgid "" "Extend the list by appending all the items from the iterable. Similar to " "``a[len(a):] = iterable``." msgstr "" -"イテラブルのすべての要素を対象のリストに追加し、リストを拡張します。" +"``iterable`` のすべての要素をリストの末尾に追加します。\n" "``a[len(a):] = iterable`` と同様です。" #: ../../tutorial/datastructures.rst:35 @@ -185,17 +184,17 @@ msgstr "" ">>> fruits.pop()\n" "'pear'" -#: ../../tutorial/datastructures.rst:122 msgid "" "You might have noticed that methods like ``insert``, ``remove`` or ``sort`` " "that only modify the list have no return value printed -- they return the " "default ``None``. [#]_ This is a design principle for all mutable data " "structures in Python." msgstr "" -"``insert``, ``remove``, ``sort`` などのリストを操作するメソッドの戻り値が表示" -"されていないことに気が付いたかもしれません。これらのメソッドは ``None`` を返" -"しています。[#]_ これは Python の変更可能なデータ構造全てについての設計上の原" -"則となっています。" +"``insert``、``remove``、``sort`` など、リストの変更だけを行うメソッドの戻り値" +"が表示されていないことに気が付いたかもしれません。\n" +"これらのメソッドはデフォルトの ``None`` を返しています。\n" +"[#]_ これは Python の変更可能なデータ構造全てについての設計上の原則となってい" +"ます。" #: ../../tutorial/datastructures.rst:127 msgid "" @@ -287,9 +286,9 @@ msgid "" "To implement a queue, use :class:`collections.deque` which was designed to " "have fast appends and pops from both ends. For example::" msgstr "" -"キューの実装には、 :class:`collections.deque` を使うと良いでしょう。このクラ" -"スは良く設計されていて、高速な追加(append)と取り出し(pop)を両端に対して実" -"現しています。例えば以下のようにします::" +"キューの実装には :class:`collections.deque` を使います。このクラスは両端で要" +"素を高速に追加・取り出しできるように設計されています。例えば次のように使いま" +"す::" #: ../../tutorial/datastructures.rst:181 msgid "" @@ -308,11 +307,11 @@ msgstr "" ">>> queue = deque([\"Eric\", \"John\", \"Michael\"])\n" ">>> queue.append(\"Terry\") # Terry が到着\n" ">>> queue.append(\"Graham\") # Graham が到着\n" -">>> queue.popleft() # 最初に到着した人が去って行った\n" +">>> queue.popleft() # 最初に到着した人が去る\n" "'Eric'\n" -">>> queue.popleft() # 2番目の人も去って行った\n" +">>> queue.popleft() # 2番目に到着した人が去る\n" "'John'\n" -">>> queue # キューに残っているものは到着順\n" +">>> queue # 残っている人を到着順に表示\n" "deque(['Michael', 'Terry', 'Graham'])" #: ../../tutorial/datastructures.rst:196 @@ -326,10 +325,9 @@ msgid "" "operations applied to each member of another sequence or iterable, or to " "create a subsequence of those elements that satisfy a certain condition." msgstr "" -"リスト内包表記はリストを生成する簡潔な手段を提供しています。主な利用場面は、" -"あるシーケンスや iterable (イテレート可能オブジェクト) のそれぞれの要素に対し" -"てある操作を行った結果を要素にしたリストを作ったり、ある条件を満たす要素だけ" -"からなる部分シーケンスを作成することです。" +"リスト内包表記を使うとリストを簡潔に作れます。シーケンスやイテラブルの各要素" +"に操作を適用した結果から新しいリストを作るときによく使います。また、特定の条" +"件を満たす要素だけを取り出して部分シーケンスを作ることもできます。" #: ../../tutorial/datastructures.rst:203 msgid "For example, assume we want to create a list of squares, like::" @@ -357,9 +355,9 @@ msgid "" "exists after the loop completes. We can calculate the list of squares " "without any side effects using::" msgstr "" -"これはループが終了した後にも存在する ``x`` という名前の変数を作る (または上書" -"きする) ことに注意してください。以下のようにして平方のリストをいかなる副作用" -"もなく計算することができます::" +"このコードは ``x`` という名前の変数を作るか、既存の変数を上書きします。この変" +"数がループ終了後も残ることに注意してください。次のように書けば、副作用なしで" +"平方のリストを計算できます::" #: ../../tutorial/datastructures.rst:216 msgid "squares = list(map(lambda x: x**2, range(10)))" @@ -386,12 +384,11 @@ msgid "" "which follow it. For example, this listcomp combines the elements of two " "lists if they are not equal::" msgstr "" -"リスト内包表記は、括弧の中の 式、 :keyword:`!for` 句、そして0個以上の :" -"keyword:`!for` か :keyword:`!if` 句で構成されます。\n" -"リスト内包表記の実行結果は、 :keyword:`!for` と :keyword:`!if` 句のコンテキス" -"ト中で式を評価した結果からなる新しいリストです。\n" -"例えば、次のリスト内包表記は2つのリストの要素から、違うもの同士をペアにしま" -"す。" +"リスト内包表記は、式とそれに続く :keyword:`!for` 句、さらに0個以上の :" +"keyword:`!for` 句または :keyword:`!if` 句を角括弧で囲んだものです。式に続く :" +"keyword:`!for` 句と :keyword:`!if` 句に従って式を評価し、その結果を要素とする" +"新しいリストを作ります。例えば次のリスト内包表記は、2つのリストから等しくない" +"要素同士を組み合わせてペアを作ります::" #: ../../tutorial/datastructures.rst:231 msgid "" @@ -430,16 +427,15 @@ msgid "" "Note how the order of the :keyword:`for` and :keyword:`if` statements is the " "same in both these snippets." msgstr "" -":keyword:`for` と :keyword:`if` 文が両方のコードで同じ順序になっていることに" -"注目してください。" +"どちらのコードでも :keyword:`for` 文と :keyword:`if` 文の順序が同じであること" +"に注目してください。" #: ../../tutorial/datastructures.rst:248 msgid "" "If the expression is a tuple (e.g. the ``(x, y)`` in the previous example), " "it must be parenthesized. ::" msgstr "" -"式がタプルの場合 (例: 上の例で式が ``(x, y)`` の場合) は、タプルに円括弧が必" -"要です。 ::" +"式がタプルの場合は前の例の ``(x, y)`` のように丸括弧で囲む必要があります。 ::" #: ../../tutorial/datastructures.rst:251 msgid "" @@ -472,29 +468,29 @@ msgid "" "[1, 2, 3, 4, 5, 6, 7, 8, 9]" msgstr "" ">>> vec = [-4, -2, 0, 2, 4]\n" -">>> # 値を2倍にした新しいリストを作成\n" +">>> # 値を2倍にした新しいリストを作る\n" ">>> [x*2 for x in vec]\n" "[-8, -4, 0, 4, 8]\n" -">>> # フィルターでリストから負の数値を除外\n" +">>> # リストから負の数を除く\n" ">>> [x for x in vec if x >= 0]\n" "[0, 2, 4]\n" -">>> # 全ての要素に関数を適用\n" +">>> # すべての要素に関数を適用する\n" ">>> [abs(x) for x in vec]\n" "[4, 2, 0, 2, 4]\n" -">>> # 各要素に対してメソッド呼び出し\n" +">>> # 各要素のメソッドを呼び出す\n" ">>> freshfruit = [' banana', ' loganberry ', 'passion fruit ']\n" ">>> [weapon.strip() for weapon in freshfruit]\n" "['banana', 'loganberry', 'passion fruit']\n" -">>> # (number, square) という2要素のタプルのリストを作成\n" +">>> # (number, square) のような2要素のタプルのリストを作る\n" ">>> [(x, x**2) for x in range(6)]\n" "[(0, 0), (1, 1), (2, 4), (3, 9), (4, 16), (5, 25)]\n" -">>> # タプルは丸括弧で囲まないといけない、そうでなければエラーが発生する\n" +">>> # タプルを丸括弧で囲まないとエラーになる\n" ">>> [x, x**2 for x in range(6)]\n" " File \"\", line 1\n" " [x, x**2 for x in range(6)]\n" " ^^^^^^^\n" "SyntaxError: did you forget parentheses around the comprehension target?\n" -">>> # リスト内包表記で2つの 'for' を使って、リストをフラットにする\n" +">>> # 2つの 'for' を持つリスト内包表記でリストをフラットにする\n" ">>> vec = [[1,2,3], [4,5,6], [7,8,9]]\n" ">>> [num for elem in vec for num in elem]\n" "[1, 2, 3, 4, 5, 6, 7, 8, 9]" @@ -502,7 +498,7 @@ msgstr "" #: ../../tutorial/datastructures.rst:279 msgid "" "List comprehensions can contain complex expressions and nested functions::" -msgstr "リスト内包表記の式には、複雑な式や関数呼び出しのネストができます::" +msgstr "リスト内包表記では複雑な式や入れ子になった関数呼び出しも使えます::" #: ../../tutorial/datastructures.rst:281 msgid "" @@ -526,11 +522,12 @@ msgstr "" "リスト内包表記中の最初の式は任意の式なので、そこに他のリスト内包表記を書くこ" "ともできます。" -#: ../../tutorial/datastructures.rst:291 msgid "" "Consider the following example of a 3x4 matrix implemented as a list of 3 " "lists of length 4::" -msgstr "次の、長さ4のリスト3つからなる、3x4 の matrix について考えます::" +msgstr "" +"長さ 4 のリスト 3 つからなるリストで実装した、次の 3x4 の行列について考えま" +"す。 ::" #: ../../tutorial/datastructures.rst:294 msgid "" @@ -611,13 +608,12 @@ msgstr "" ">>> transposed\n" "[[1, 5, 9], [2, 6, 10], [3, 7, 11], [4, 8, 12]]" -#: ../../tutorial/datastructures.rst:329 msgid "" "In the real world, you should prefer built-in functions to complex flow " "statements. The :func:`zip` function would do a great job for this use case::" msgstr "" -"実際には複雑な流れの式よりも組み込み関数を使う方が良いです。この場合 :func:" -"`zip` 関数が良い仕事をしてくれるでしょう::" +"実際のコードでは、複雑な制御フローの文よりも組み込み関数を優先すべきです。\n" +"この用途には :func:`zip` 関数が適しています。 ::" #: ../../tutorial/datastructures.rst:332 msgid "" @@ -757,7 +753,6 @@ msgstr "" ">>> v\n" "([1, 2, 3], [3, 2, 1])" -#: ../../tutorial/datastructures.rst:400 msgid "" "As you see, on output tuples are always enclosed in parentheses, so that " "nested tuples are interpreted correctly; they may be input with or without " @@ -767,12 +762,12 @@ msgid "" "which contain mutable objects, such as lists." msgstr "" "ご覧のとおり、タプルの表示には常に丸括弧がついていて、タプルのネストが正しく" -"解釈されるようになっています。タプルを書くときは必ずしも丸括弧で囲まなくても" -"いいですが、(タプルが大きな式の一部だった場合は) 丸括弧が必要な場合もありま" -"す。タプルの要素を代入することはできません。しかし、タプルにリストのような変" -"更可能型を含めることはできます。" +"解釈されるようになっています。\n" +"タプルを書くときは必ずしも丸括弧で囲まなくてもいいですが、(タプルが大きな式の" +"一部だった場合は) 丸括弧が必要な場合もあります。\n" +"タプルの各要素に代入することはできません。\n" +"しかし、タプルにリストのような変更可能なオブジェクトを含めることはできます。" -#: ../../tutorial/datastructures.rst:407 msgid "" "Though tuples may seem similar to lists, they are often used in different " "situations and for different purposes. Tuples are :term:`immutable`, and " @@ -782,12 +777,13 @@ msgid "" "`mutable`, and their elements are usually homogeneous and are accessed by " "iterating over the list." msgstr "" -"タプルはリストと似ていますが、たいてい異なる場面と異なる目的で利用されます。" -"タプルは :term:`不変 ` で、複数の型の要素からなることもあり、要素" -"はアンパック(この節の後半に出てきます)操作やインデックス (あるいは :func:" -"`namedtuples ` の場合は属性)でアクセスすることが多い" -"です。一方、リストは :term:`可変 ` で、要素はたいてい同じ型のオブ" -"ジェクトであり、たいていイテレートによってアクセスします。" +"タプルはリストと似て見えますが、使う場面や目的は異なることが多いです。\n" +"タプルは :term:`不変 ` で、通常は異なる型の要素が並びます。\n" +"要素には、アンパック (この節の後半で説明します) やインデックスを使ってアクセ" +"スします (:func:`namedtuples ` では属性でもアクセスで" +"きます)。\n" +"リストは :term:`可変 ` で、要素は通常同じ型であり、リストを反復処理" +"してアクセスします。" #: ../../tutorial/datastructures.rst:415 msgid "" @@ -815,7 +811,8 @@ msgid "" "('hello',)" msgstr "" ">>> empty = ()\n" -">>> singleton = 'hello', # <-- 末尾のカンマに注意\n" +">>> singleton = 'hello', # <-- 末尾にカンマがあることに注意\n" +">>> len(empty)\n" "0\n" ">>> len(singleton)\n" "1\n" @@ -883,7 +880,6 @@ msgstr "" msgid "Here is a brief demonstration::" msgstr "簡単なデモンストレーションを示します::" -#: ../../tutorial/datastructures.rst:459 msgid "" ">>> basket = {'apple', 'orange', 'apple', 'pear', 'orange', 'banana'}\n" ">>> print(basket) # show that duplicates have been " @@ -929,8 +925,7 @@ msgstr "" "{'a', 'c', 'r', 'd', 'b', 'm', 'z', 'l'}\n" ">>> a & b # aとbの両方に存在する文字\n" "{'a', 'c'}\n" -">>> a ^ b # aまたはbにあるが、両方にはない文" -"字 \n" +">>> a ^ b # aまたはbにあるが、両方にはない文字\n" "{'r', 'd', 'b', 'm', 'z', 'l'}" #: ../../tutorial/datastructures.rst:482 @@ -1063,13 +1058,12 @@ msgstr "" ">>> 'jack' not in tel\n" "False" -#: ../../tutorial/datastructures.rst:544 msgid "" "The :func:`dict` constructor builds dictionaries directly from sequences of " "key-value pairs::" msgstr "" -":func:`dict` コンストラクタは、キーと値のペアのタプルを含むリストから辞書を生" -"成します::" +":func:`dict` コンストラクタは、キーと値のペアからなるシーケンスから直接辞書を" +"生成します。 ::" #: ../../tutorial/datastructures.rst:547 msgid "" @@ -1079,11 +1073,10 @@ msgstr "" ">>> dict([('sape', 4139), ('guido', 4127), ('jack', 4098)])\n" "{'sape': 4139, 'guido': 4127, 'jack': 4098}" -#: ../../tutorial/datastructures.rst:550 msgid "" "In addition, dict comprehensions can be used to create dictionaries from " "arbitrary key and value expressions::" -msgstr "さらに、辞書内包表現を使って、任意のキーと値のペアから辞書を作れます::" +msgstr "さらに、辞書内包表記ではキーと値に任意の式を使って辞書を作れます。 ::" #: ../../tutorial/datastructures.rst:553 msgid "" @@ -1189,13 +1182,12 @@ msgstr "" "What is your quest? It is the holy grail.\n" "What is your favorite color? It is blue." -#: ../../tutorial/datastructures.rst:600 msgid "" "To loop over a sequence in reverse, first specify the sequence in a forward " "direction and then call the :func:`reversed` function. ::" msgstr "" -"シーケンスを逆方向に渡ってループするには、まずシーケンスの範囲を順方向に指定" -"し、次いで関数 :func:`reversed` を呼び出します。 ::" +"シーケンスを逆順にループするには、まずシーケンスを順方向で指定し、それから :" +"func:`reversed` 関数を呼び出します。 ::" #: ../../tutorial/datastructures.rst:603 msgid "" @@ -1217,13 +1209,13 @@ msgstr "" "3\n" "1" -#: ../../tutorial/datastructures.rst:612 msgid "" "To loop over a sequence in sorted order, use the :func:`sorted` function " "which returns a new sorted list while leaving the source unaltered. ::" msgstr "" "シーケンスをソートされた順序でループするには、 :func:`sorted` 関数を使いま" -"す。この関数は元の配列を変更せず、ソート済みの新たな配列を返します。 ::" +"す。\n" +"この関数は元のシーケンスを変更せず、ソート済みの新たなリストを返します。 ::" #: ../../tutorial/datastructures.rst:615 msgid "" @@ -1249,17 +1241,17 @@ msgstr "" "orange\n" "pear" -#: ../../tutorial/datastructures.rst:626 msgid "" "Using :func:`set` on a sequence eliminates duplicate elements. The use of :" "func:`sorted` in combination with :func:`set` over a sequence is an " "idiomatic way to loop over unique elements of the sequence in sorted " "order. ::" msgstr "" -"シーケンスに :func:`set` を使うと、重複要素が除去されます。\n" -"シーケンスに :func:`set` を使った上で、 :func:`sorted` を使うという組み合わせ" -"方は、順番が整列されているシーケンスで、同一要素に 1 度のみループでアクセスす" -"る慣用的な方法です。" +"シーケンスに :func:`set` を使うと、重複する要素を取り除けます。\n" +":func:`sorted` と :func:`set` を組み合わせると、シーケンスの要素から重複を除" +"き、\n" +"ソート順にループできます。\n" +"これはよく使われる書き方です。 ::" #: ../../tutorial/datastructures.rst:630 msgid "" @@ -1281,13 +1273,12 @@ msgstr "" "orange\n" "pear" -#: ../../tutorial/datastructures.rst:639 msgid "" "It is sometimes tempting to change a list while you are looping over it; " "however, it is often simpler and safer to create a new list instead. ::" msgstr "" -"ときどきループ内でリストを変更したい誘惑に駆られるでしょうが、代わりに新しい" -"リストを作ってしまうほうがより簡単で安全なことが、ままあります ::" +"リストを反復処理しながらそのリストを変更したくなることもありますが、代わりに" +"新しいリストを作る方が簡単で安全なことがよくあります。 ::" #: ../../tutorial/datastructures.rst:642 msgid "" @@ -1411,7 +1402,6 @@ msgstr "" msgid "Comparing Sequences and Other Types" msgstr "シーケンスとその他の型の比較" -#: ../../tutorial/datastructures.rst:704 msgid "" "Sequence objects typically may be compared to other objects with the same " "sequence type. The comparison uses *lexicographical* ordering: first the " @@ -1427,16 +1417,21 @@ msgid "" "of the same type::" msgstr "" "概して、シーケンスオブジェクトは、同じシーケンス型の他のオブジェクトと比較で" -"きます。比較には *辞書的な (lexicographical)* 順序が用いられます。まず、最初" -"の二つの要素を比較し、その値が等しくなければその時点で比較結果が決まります。" -"等しければ次の二つの要素を比較し、以降シーケンスの要素が尽きるまで続けます。" +"きます。\n" +"比較には *辞書的な (lexicographical)* 順序が用いられます。\n" +"まず、二つのシーケンスの先頭要素同士を比較し、その値が等しくなければその時点" +"で比較結果が決まります。\n" +"等しければ次の二つの要素を比較し、以降シーケンスの要素が尽きるまで続けま" +"す。\n" "比較しようとする二つの要素がいずれも同じシーケンス型であれば、そのシーケンス" -"間での辞書比較を再帰的に行います。二つのシーケンスの全ての要素の比較結果が等" -"しくなれば、シーケンスは等しいとみなされます。片方のシーケンスがもう一方の先" -"頭部分にあたる部分シーケンスならば、短い方のシーケンスが小さいシーケンスとみ" -"なされます。文字列に対する辞書的な順序づけには、個々の文字ごとに ASCII 順序を" -"用います。以下に、同じ型のオブジェクトを持つシーケンス間での比較を行った例を" -"示します:: " +"間での辞書比較を再帰的に行います。\n" +"二つのシーケンスの全ての要素の比較結果が等しくなれば、シーケンスは等しいとみ" +"なされます。\n" +"片方のシーケンスがもう一方の先頭部分にあたる部分シーケンスならば、短い方の" +"シーケンスが小さいシーケンスとみなされます。\n" +"文字列に対する辞書的な順序づけには、個々の文字ごとに Unicode コードポイントの" +"数値による順序を用います。\n" +"以下に、同じ型のシーケンス間での比較を行った例を示します。 ::" #: ../../tutorial/datastructures.rst:716 msgid "" @@ -1456,7 +1451,6 @@ msgstr "" "(1, 2, 3) == (1.0, 2.0, 3.0)\n" "(1, 2, ('aa', 'ab')) < (1, 2, ('abc', 'a'), 4)" -#: ../../tutorial/datastructures.rst:724 msgid "" "Note that comparing objects of different types with ``<`` or ``>`` is legal " "provided that the objects have appropriate comparison methods. For example, " @@ -1464,21 +1458,20 @@ msgid "" "equals 0.0, etc. Otherwise, rather than providing an arbitrary ordering, " "the interpreter will raise a :exc:`TypeError` exception." msgstr "" -"違う型のオブジェクト同士を ``<`` や ``>`` で比較することも、それらのオブジェ" -"クトが適切な比較メソッドを提供しているのであれば許可されます。例えば、異なる" -"数値型同士の比較では、その数値によって比較が行われます。例えば、 0 と 0.0 は" -"等価です。一方、適切な比較順序がない場合は、インタープリターは :exc:" -"`TypeError` 例外を発生させます。" +"異なる型のオブジェクト同士も、適切な比較メソッドがあれば ``<`` や ``>`` で比" +"較できます。\n" +"例えば、異なる数値型は数値としての値に従って比較されるので、0 と 0.0 は等しい" +"とみなされます。\n" +"適切な比較メソッドがない場合、インタープリタは恣意的な順序を付ける代わりに :" +"exc:`TypeError` 例外を送出します。" #: ../../tutorial/datastructures.rst:732 msgid "Footnotes" msgstr "脚注" -#: ../../tutorial/datastructures.rst:733 msgid "" "Other languages may return the mutated object, which allows method chaining, " "such as ``d->insert(\"a\")->remove(\"b\")->sort();``." msgstr "" -"他の言語では変更可能なオブジェクトを返して、``d->insert(\"a\")-" -">remove(\"b\")->sort();`` のようなメソッドチェインを許している場合もありま" -"す。" +"他の言語では変更後のオブジェクトを返して、``d->insert(\"a\")->remove(\"b\")-" +">sort();`` のようなメソッドチェインを許している場合もあります。" diff --git a/tutorial/errors.po b/tutorial/errors.po index fdbcafb63..fd1ffa632 100644 --- a/tutorial/errors.po +++ b/tutorial/errors.po @@ -23,10 +23,10 @@ msgstr "" "Last-Translator: righteous, 2025\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../tutorial/errors.rst:5 @@ -168,11 +168,10 @@ msgstr "" "意義な慣習ですが) 必ずしも成り立ちません。標準例外の名前は組み込みの識別子で" "す (予約語ではありません)。" -#: ../../tutorial/errors.rst:73 msgid "" "The rest of the line provides detail based on the type of exception and what " "caused it." -msgstr "残りの行は例外の詳細で、その例外の型と何が起きたかに依存します。" +msgstr "その行の残りの部分には、例外の型と原因に応じた詳細が表示されます。" #: ../../tutorial/errors.rst:76 msgid "" @@ -196,7 +195,6 @@ msgstr "" msgid "Handling Exceptions" msgstr "例外を処理する" -#: ../../tutorial/errors.rst:89 msgid "" "It is possible to write programs that handle selected exceptions. Look at " "the following example, which asks the user for input until a valid integer " @@ -205,13 +203,12 @@ msgid "" "generated interruption is signalled by raising the :exc:`KeyboardInterrupt` " "exception. ::" msgstr "" -"例外を選別して処理するようなプログラムを書くことができます。以下の例を見てく" -"ださい。この例では、有効な文字列が入力されるまでユーザに入力を促しますが、" -"ユーザがプログラムに (:kbd:`Control-C` か、またはオペレーティングシステムがサ" -"ポートしている何らかのキーを使って) 割り込みをかけてプログラムを中断させるこ" -"とができるようにしています。ユーザが生成した割り込みは、 :exc:" -"`KeyboardInterrupt` 例外が送出されることで通知されるということに注意してくだ" -"さい。 ::" +"特定の例外を処理するプログラムを書くことができます。\n" +"次の例は有効な整数が入力されるまでユーザに入力を求めますが、\n" +"ユーザは :kbd:`Control-C` などオペレーティングシステムがサポートする操作でプ" +"ログラムを中断できます。\n" +"ユーザによる割り込みは :exc:`KeyboardInterrupt` 例外の送出によって通知されま" +"す。 ::" #: ../../tutorial/errors.rst:95 msgid "" @@ -223,6 +220,14 @@ msgid "" "... print(\"Oops! That was no valid number. Try again...\")\n" "..." msgstr "" +">>> while True:\n" +"... try:\n" +"... x = int(input(\"数字を入力してください: \"))\n" +"... break\n" +"... except ValueError:\n" +"... print(\"おっと!それは数字ではないようです。もう一度入力してくださ" +"い...\")\n" +"..." #: ../../tutorial/errors.rst:103 msgid "The :keyword:`try` statement works as follows." @@ -289,6 +294,8 @@ msgid "" "... except (RuntimeError, TypeError, NameError):\n" "... pass" msgstr "" +"... except (RuntimeError, TypeError, NameError):\n" +"... pass" #: ../../tutorial/errors.rst:129 msgid "" @@ -324,6 +331,24 @@ msgid "" " except B:\n" " print(\"B\")" msgstr "" +"class B(Exception):\n" +" pass\n" +"\n" +"class C(B):\n" +" pass\n" +"\n" +"class D(C):\n" +" pass\n" +"\n" +"for cls in [B, C, D]:\n" +" try:\n" +" raise cls()\n" +" except D:\n" +" print(\"D\")\n" +" except C:\n" +" print(\"C\")\n" +" except B:\n" +" print(\"B\")" #: ../../tutorial/errors.rst:153 msgid "" @@ -345,7 +370,6 @@ msgstr "" "の *引数 (arguments)* とも呼ばれます。引数の有無および引数の型は、例外の型に" "依存します。" -#: ../../tutorial/errors.rst:160 msgid "" "The *except clause* may specify a variable after the exception name. The " "variable is bound to the exception instance which typically has an ``args`` " @@ -353,10 +377,11 @@ msgid "" "types define :meth:`~object.__str__` to print all the arguments without " "explicitly accessing ``.args``. ::" msgstr "" -"except節は例外名の後に変数を指定できます。その変数は例外インスタンスに紐付け" -"られ、一般的には引数を保持する ``args`` 属性を持ちます。利便性のため、組み込" -"み例外型には :meth:`~object.__str__` が定義されており、明示的に ``.args`` を" -"参照せずとも すべての引数を表示できます。" +"*except 節* では例外名の後に変数を指定できます。\n" +"その変数は例外インスタンスに束縛されます。\n" +"例外インスタンスは通常、引数を保持する ``args`` 属性を持ちます。\n" +"組み込み例外型は利便性のために :meth:`~object.__str__` を定義しており、\n" +"明示的に ``.args`` を参照しなくてもすべての引数を表示できます。 ::" #: ../../tutorial/errors.rst:166 msgid "" @@ -378,6 +403,22 @@ msgid "" "x = spam\n" "y = eggs" msgstr "" +">>> try:\n" +"... raise Exception('spam', 'eggs')\n" +"... except Exception as inst:\n" +"... print(type(inst)) # 例外の型\n" +"... print(inst.args) # 引数は .args に格納される\n" +"... print(inst) # __str__ は args を直接出力しますが、\n" +"... # 例外のサブクラスで上書きされる場合もあります\n" +"... x, y = inst.args # args をアンパックする\n" +"... print('x =', x)\n" +"... print('y =', y)\n" +"...\n" +"\n" +"('spam', 'eggs')\n" +"('spam', 'eggs')\n" +"x = spam\n" +"y = eggs" #: ../../tutorial/errors.rst:183 msgid "" @@ -387,7 +428,6 @@ msgstr "" "例外の :meth:`~object.__str__` 出力は、処理されない例外のメッセージ末尾 ('詳" "細') として表示されます。" -#: ../../tutorial/errors.rst:186 msgid "" ":exc:`BaseException` is the common base class of all exceptions. One of its " "subclasses, :exc:`Exception`, is the base class of all the non-fatal " @@ -397,12 +437,14 @@ msgid "" "exit` and :exc:`KeyboardInterrupt` which is raised when a user wishes to " "interrupt the program." msgstr "" -":exc:`BaseException` はすべての例外に共通する基底クラスです。そのサブクラスの" -"一つである :exc:`Exception` は、致命的でない例外すべての基底クラスです。 :" -"exc:`Exception` のサブクラスではない例外は、一般的にプログラムが終了すること" -"を示すために使われているため処理されません。例えば、:meth:`sys.exit` によって" -"送出される :exc:`SystemExit` や、ユーザーがプログラムを中断させたいときに送出" -"される :exc:`KeyboardInterrupt` があります。" +":exc:`BaseException` は、すべての例外に共通する基底クラスです。\n" +"そのサブクラスの一つである :exc:`Exception` は、致命的でない例外すべての基底" +"クラスです。\n" +":exc:`Exception` のサブクラスではない例外は、プログラムを終了すべきことを示す" +"ために使われるので、通常は処理しません。\n" +"これには、:meth:`sys.exit` によって送出される :exc:`SystemExit` や、ユーザー" +"がプログラムを中断したいときに送出される :exc:`KeyboardInterrupt` が含まれま" +"す。" #: ../../tutorial/errors.rst:194 msgid "" @@ -415,14 +457,14 @@ msgstr "" "かし良い例外処理の手法とは、処理対象の例外の型をできる限り詳細に書き、予期し" "ない例外はそのまま伝わるようにすることです。" -#: ../../tutorial/errors.rst:199 msgid "" "The most common pattern for handling :exc:`Exception` is to print or log the " "exception and then re-raise it (allowing a caller to handle the exception as " "well)::" msgstr "" -":exc:`Exception` に対する最も一般的な例外処理のパターンでは、例外を表示あるい" -"はログ出力してから再度送出します(呼び出し側でも例外を処理できるようにします):" +":exc:`Exception` に対する最も一般的な処理のパターンは、例外を表示またはログに" +"記録してから再送出し、\n" +"呼び出し側でも処理できるようにすることです。 ::" #: ../../tutorial/errors.rst:203 msgid "" @@ -440,6 +482,19 @@ msgid "" " print(f\"Unexpected {err=}, {type(err)=}\")\n" " raise" msgstr "" +"import sys\n" +"\n" +"try:\n" +" f = open('myfile.txt')\n" +" s = f.readline()\n" +" i = int(s.strip())\n" +"except OSError as err:\n" +" print(\"OSエラー:\", err)\n" +"except ValueError:\n" +" print(\"データを整数に変換できません。\")\n" +"except Exception as err:\n" +" print(f\"予期せぬエラー {err=}, {type(err)=}\")\n" +" raise" #: ../../tutorial/errors.rst:217 msgid "" @@ -449,10 +504,10 @@ msgid "" "exception. For example::" msgstr "" ":keyword:`try` ... :keyword:`except` 文には、オプションで *else 節 (else " -"clause)* を設けることができます。 :keyword:`else` 節を設ける場合、全ての :" -"keyword:`except` 節よりも後ろに置かなければなりません。 :keyword:`else` 節は " -"*try 節* で全く例外が送出されなかったときに実行されるコードを書くのに役立ちま" -"す。例えば次のようにします::" +"clause)* を設けることができます。 ``else`` 節を設ける場合、全ての ``except`` " +"節よりも後ろに置かなければなりません。 ``else`` 節は *try 節* で全く例外が送" +"出されなかったときに実行されるコードを書くのに役立ちます。例えば次のようにし" +"ます::" #: ../../tutorial/errors.rst:222 msgid "" @@ -465,6 +520,14 @@ msgid "" " print(arg, 'has', len(f.readlines()), 'lines')\n" " f.close()" msgstr "" +"for arg in sys.argv[1:]:\n" +" try:\n" +" f = open(arg, 'r')\n" +" except OSError:\n" +" print(arg, 'が開けません')\n" +" else:\n" +" print(arg, 'は', len(f.readlines()), '行です')\n" +" f.close()" #: ../../tutorial/errors.rst:231 msgid "" @@ -501,6 +564,15 @@ msgid "" "...\n" "Handling run-time error: division by zero" msgstr "" +">>> def this_fails():\n" +"... x = 1/0\n" +"...\n" +">>> try:\n" +"... this_fails()\n" +"... except ZeroDivisionError as err:\n" +"... print('実行時エラーを処理:', err)\n" +"...\n" +"実行時エラーを処理: division by zero" #: ../../tutorial/errors.rst:254 msgid "Raising Exceptions" @@ -521,6 +593,11 @@ msgid "" " raise NameError('HiThere')\n" "NameError: HiThere" msgstr "" +">>> raise NameError('HiThere')\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +" raise NameError('HiThere')\n" +"NameError: HiThere" #: ../../tutorial/errors.rst:265 msgid "" @@ -538,7 +615,7 @@ msgstr "" #: ../../tutorial/errors.rst:271 msgid "raise ValueError # shorthand for 'raise ValueError()'" -msgstr "" +msgstr "raise ValueError # 'raise ValueError()' の省略記法" #: ../../tutorial/errors.rst:273 msgid "" @@ -564,21 +641,31 @@ msgid "" " raise NameError('HiThere')\n" "NameError: HiThere" msgstr "" +">>> try:\n" +"... raise NameError('HiThere')\n" +"... except NameError:\n" +"... print('例外が通り過ぎました!')\n" +"... raise\n" +"...\n" +"例外が通り過ぎました!\n" +"Traceback (most recent call last):\n" +" File \"\", line 2, in \n" +" raise NameError('HiThere')\n" +"NameError: HiThere" #: ../../tutorial/errors.rst:293 msgid "Exception Chaining" msgstr "例外の連鎖" -#: ../../tutorial/errors.rst:295 msgid "" "If an unhandled exception occurs inside an :keyword:`except` section, it " "will have the exception being handled attached to it and included in the " "error message::" msgstr "" -":keyword:`except` 節の中で未処理の例外が発生した場合、その未処理の例外は処理" -"された例外のエラーメッセージに含まれます::" +":keyword:`except` 節の中で未処理の例外が発生すると、\n" +"その例外には処理中だった例外が関連付けられ、エラーメッセージにも含まれま" +"す。 ::" -#: ../../tutorial/errors.rst:299 msgid "" ">>> try:\n" "... open(\"database.sqlite\")\n" @@ -598,26 +685,42 @@ msgid "" " raise RuntimeError(\"unable to handle error\")\n" "RuntimeError: unable to handle error" msgstr "" +">>> try:\n" +"... open(\"database.sqlite\")\n" +"... except OSError:\n" +"... raise RuntimeError(\"unable to handle error\")\n" +"...\n" +"Traceback (most recent call last):\n" +" File \"\", line 2, in \n" +" open(\"database.sqlite\")\n" +" ~~~~^^^^^^^^^^^^^^^^^^^\n" +"FileNotFoundError: [Errno 2] No such file or directory: 'database.sqlite'\n" +"\n" +"During handling of the above exception, another exception occurred:\n" +"\n" +"Traceback (most recent call last):\n" +" File \"\", line 4, in \n" +" raise RuntimeError(\"unable to handle error\")\n" +"RuntimeError: unable to handle error" -#: ../../tutorial/errors.rst:317 msgid "" "To indicate that an exception is a direct consequence of another, the :" "keyword:`raise` statement allows an optional :keyword:`from` clause::" msgstr "" -"ある例外が他の例外から直接影響されていることを示すために、:keyword:`raise` 文" -"にオプションの :keyword:`from` 句を指定します::" +"ある例外が別の例外の直接の結果であることを示すために、:keyword:`raise` 文には" +"オプションの :keyword:`from` 節を指定できます。 ::" -#: ../../tutorial/errors.rst:320 msgid "" "# exc must be exception instance or None.\n" "raise RuntimeError from exc" msgstr "" +"# exc は例外インスタンスか None でなければならない。\n" +"raise RuntimeError from exc" #: ../../tutorial/errors.rst:323 msgid "This can be useful when you are transforming exceptions. For example::" msgstr "これは例外を変換するときに便利です。例えば::" -#: ../../tutorial/errors.rst:325 msgid "" ">>> def func():\n" "... raise ConnectionError\n" @@ -641,14 +744,34 @@ msgid "" " raise RuntimeError('Failed to open database') from exc\n" "RuntimeError: Failed to open database" msgstr "" +">>> def func():\n" +"... raise ConnectionError\n" +"...\n" +">>> try:\n" +"... func()\n" +"... except ConnectionError as exc:\n" +"... raise RuntimeError('Failed to open database') from exc\n" +"...\n" +"Traceback (most recent call last):\n" +" File \"\", line 2, in \n" +" func()\n" +" ~~~~^^\n" +" File \"\", line 2, in func\n" +"ConnectionError\n" +"\n" +"The above exception was the direct cause of the following exception:\n" +"\n" +"Traceback (most recent call last):\n" +" File \"\", line 4, in \n" +" raise RuntimeError('Failed to open database') from exc\n" +"RuntimeError: Failed to open database" -#: ../../tutorial/errors.rst:347 msgid "" "It also allows disabling automatic exception chaining using the ``from " "None`` idiom::" -msgstr "また、自動的な例外の連鎖を無効にするには ``from None`` を指定します。" +msgstr "" +"また、自動的な例外の連鎖を無効にするには ``from None`` を指定します。 ::" -#: ../../tutorial/errors.rst:350 msgid "" ">>> try:\n" "... open('database.sqlite')\n" @@ -660,6 +783,15 @@ msgid "" " raise RuntimeError from None\n" "RuntimeError" msgstr "" +">>> try:\n" +"... open('database.sqlite')\n" +"... except OSError:\n" +"... raise RuntimeError from None\n" +"...\n" +"Traceback (most recent call last):\n" +" File \"\", line 4, in \n" +" raise RuntimeError from None\n" +"RuntimeError" #: ../../tutorial/errors.rst:360 msgid "" @@ -672,16 +804,16 @@ msgstr "" msgid "User-defined Exceptions" msgstr "ユーザー定義例外" -#: ../../tutorial/errors.rst:368 msgid "" "Programs may name their own exceptions by creating a new exception class " "(see :ref:`tut-classes` for more about Python classes). Exceptions should " "typically be derived from the :exc:`Exception` class, either directly or " "indirectly." msgstr "" -"プログラム上で新しい例外クラスを作成することで、独自の例外を指定することがで" -"きます (Python のクラスについては :ref:`tut-classes` 参照)。例外は、典型的" -"に :exc:`Exception` クラスから、直接または間接的に派生したものです。" +"新しい例外クラスを作成すると、プログラム独自の例外に名前を付けられます\n" +"(Python のクラスについては :ref:`tut-classes` を参照してください)。\n" +"通常、例外クラスは :exc:`Exception` クラスから直接または間接的に派生させるべ" +"きです。" #: ../../tutorial/errors.rst:372 msgid "" @@ -724,7 +856,6 @@ msgstr "" ":keyword:`try` 文にはもう一つオプションの節があります。この節はクリーンアップ" "動作を定義するためのもので、どんな状況でも必ず実行されます。例を示します::" -#: ../../tutorial/errors.rst:392 msgid "" ">>> try:\n" "... raise KeyboardInterrupt\n" @@ -737,6 +868,16 @@ msgid "" " raise KeyboardInterrupt\n" "KeyboardInterrupt" msgstr "" +">>> try:\n" +"... raise KeyboardInterrupt\n" +"... finally:\n" +"... print('Goodbye, world!')\n" +"...\n" +"Goodbye, world!\n" +"Traceback (most recent call last):\n" +" File \"\", line 2, in \n" +" raise KeyboardInterrupt\n" +"KeyboardInterrupt" #: ../../tutorial/errors.rst:403 msgid "" @@ -751,17 +892,16 @@ msgstr "" "せるか否かに関わらず、 :keyword:`!finally` 節は実行されます。以下では、例外が" "発生するという更に複雑なケースを議論します:" -#: ../../tutorial/errors.rst:409 msgid "" "If an exception occurs during execution of the :keyword:`!try` clause, the " "exception may be handled by an :keyword:`except` clause. If the exception is " "not handled by an :keyword:`!except` clause, the exception is re-raised " "after the :keyword:`!finally` clause has been executed." msgstr "" -"もし :keyword:`!try` 文の実行中に例外が発生したら、その例外は :keyword:" -"`except` 節によって処理されるでしょう。もしその例外が :keyword:`!except` 節に" -"よって処理されなければ、 :keyword:`!finally` 節が実行された後に、その例外が再" -"送出されます。" +":keyword:`!try` 節の実行中に発生した例外は、:keyword:`except` 節で処理される" +"ことがあります。\n" +":keyword:`!except` 節で処理されなかった例外は、:keyword:`!finally` 節の実行後" +"に再送出されます。" #: ../../tutorial/errors.rst:415 msgid "" @@ -773,13 +913,17 @@ msgstr "" "あり得ます。その場合も、 :keyword:`!finally` 節が実行された後に例外が再送出さ" "れます。" -#: ../../tutorial/errors.rst:419 msgid "" "If the :keyword:`!finally` clause executes a :keyword:`break`, :keyword:" "`continue` or :keyword:`return` statement, exceptions are not re-raised. " "This can be confusing and is therefore discouraged. From version 3.14 the " "compiler emits a :exc:`SyntaxWarning` for it (see :pep:`765`)." msgstr "" +":keyword:`!finally` 節が :keyword:`break`、:keyword:`continue`、:keyword:" +"`return` 文を実行すると、例外は再送出されません。\n" +"これは混乱を招く可能性があるため、推奨されません。\n" +"バージョン 3.14 から、コンパイラはこのようなコードに対して :exc:" +"`SyntaxWarning` を出します (:pep:`765` を参照)。" #: ../../tutorial/errors.rst:425 msgid "" @@ -793,7 +937,6 @@ msgstr "" "keyword:`!continue` 文または :keyword:`!return` 文の実行の直前に :keyword:`!" "finally` 節が実行されます。" -#: ../../tutorial/errors.rst:431 msgid "" "If a :keyword:`!finally` clause includes a :keyword:`!return` statement, the " "returned value will be the one from the :keyword:`!finally` clause's :" @@ -802,12 +945,17 @@ msgid "" "therefore discouraged. From version 3.14 the compiler emits a :exc:" "`SyntaxWarning` for it (see :pep:`765`)." msgstr "" +":keyword:`!finally` 節に :keyword:`!return` 文がある場合、:keyword:`!try` 節" +"の :keyword:`!return` 文の値ではなく、:keyword:`!finally` 節の :keyword:`!" +"return` 文の値が返されます。\n" +"これは混乱を招く可能性があるため、推奨されません。\n" +"バージョン 3.14 から、コンパイラはこのようなコードに対して :exc:" +"`SyntaxWarning` を出します (:pep:`765` を参照)。" #: ../../tutorial/errors.rst:439 msgid "For example::" msgstr "例えば::" -#: ../../tutorial/errors.rst:441 msgid "" ">>> def bool_return():\n" "... try:\n" @@ -818,12 +966,19 @@ msgid "" ">>> bool_return()\n" "False" msgstr "" +">>> def bool_return():\n" +"... try:\n" +"... return True\n" +"... finally:\n" +"... return False\n" +"...\n" +">>> bool_return()\n" +"False" #: ../../tutorial/errors.rst:450 msgid "A more complicated example::" msgstr "より複雑な例::" -#: ../../tutorial/errors.rst:452 msgid "" ">>> def divide(x, y):\n" "... try:\n" @@ -852,6 +1007,32 @@ msgid "" " ~~^~~\n" "TypeError: unsupported operand type(s) for /: 'str' and 'str'" msgstr "" +">>> def divide(x, y):\n" +"... try:\n" +"... result = x / y\n" +"... except ZeroDivisionError:\n" +"... print(\"division by zero!\")\n" +"... else:\n" +"... print(\"result is\", result)\n" +"... finally:\n" +"... print(\"executing finally clause\")\n" +"...\n" +">>> divide(2, 1)\n" +"result is 2.0\n" +"executing finally clause\n" +">>> divide(2, 0)\n" +"division by zero!\n" +"executing finally clause\n" +">>> divide(\"2\", \"1\")\n" +"executing finally clause\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +" divide(\"2\", \"1\")\n" +" ~~~~~~^^^^^^^^^^\n" +" File \"\", line 3, in divide\n" +" result = x / y\n" +" ~~^~~\n" +"TypeError: unsupported operand type(s) for /: 'str' and 'str'" #: ../../tutorial/errors.rst:479 msgid "" @@ -889,11 +1070,12 @@ msgstr "" "る標準的なクリーンアップ処理が定義されているものがあります。以下の、ファイル" "をオープンして内容を画面に表示する例をみてください。 ::" -#: ../../tutorial/errors.rst:499 msgid "" "for line in open(\"myfile.txt\"):\n" " print(line, end=\"\")" msgstr "" +"for line in open(\"myfile.txt\"):\n" +" print(line, end=\"\")" #: ../../tutorial/errors.rst:502 msgid "" @@ -909,12 +1091,14 @@ msgstr "" "ケーションでは問題になりえます。 :keyword:`with` 文はファイルのようなオブジェ" "クトが常に、即座に正しくクリーンアップされることを保証します。 ::" -#: ../../tutorial/errors.rst:508 msgid "" "with open(\"myfile.txt\") as f:\n" " for line in f:\n" " print(line, end=\"\")" msgstr "" +"with open(\"myfile.txt\") as f:\n" +" for line in f:\n" +" print(line, end=\"\")" #: ../../tutorial/errors.rst:512 msgid "" @@ -931,7 +1115,6 @@ msgstr "" msgid "Raising and Handling Multiple Unrelated Exceptions" msgstr "複数の関連しない例外の送出と処理" -#: ../../tutorial/errors.rst:522 msgid "" "There are situations where it is necessary to report several exceptions that " "have occurred. This is often the case in concurrency frameworks, when " @@ -939,10 +1122,11 @@ msgid "" "cases where it is desirable to continue execution and collect multiple " "errors rather than raise the first exception." msgstr "" -"いくつか発生した例外の報告が必要な状況があります。並列処理のフレームワークで" -"は、複数のタスクが平行して失敗することがたびたびあります。他にも最初の例外を" -"送出するよりも、処理を継続して複数の例外を集約した方が望ましいユースケースも" -"あります。" +"発生した複数の例外を報告する必要がある状況があります。\n" +"並行処理のフレームワークでは、複数のタスクが並行して失敗した場合によく必要に" +"なります。\n" +"また、最初の例外を送出するよりも、実行を続けて複数のエラーを集める方が望まし" +"い用途もあります。" #: ../../tutorial/errors.rst:528 msgid "" @@ -995,7 +1179,6 @@ msgstr "" "に対して各 ``except*`` 節で特定の型の例外を取り出し、それ以外の例外は他の節に" "伝えられ、最終的に例外が送出されます。::" -#: ../../tutorial/errors.rst:564 msgid "" ">>> def f():\n" "... raise ExceptionGroup(\n" @@ -1038,19 +1221,57 @@ msgid "" " +------------------------------------\n" ">>>" msgstr "" +">>> def f():\n" +"... raise ExceptionGroup(\n" +"... \"group1\",\n" +"... [\n" +"... OSError(1),\n" +"... SystemError(2),\n" +"... ExceptionGroup(\n" +"... \"group2\",\n" +"... [\n" +"... OSError(3),\n" +"... RecursionError(4)\n" +"... ]\n" +"... )\n" +"... ]\n" +"... )\n" +"...\n" +">>> try:\n" +"... f()\n" +"... except* OSError as e:\n" +"... print(\"There were OSErrors\")\n" +"... except* SystemError as e:\n" +"... print(\"There were SystemErrors\")\n" +"...\n" +"There were OSErrors\n" +"There were SystemErrors\n" +" + Exception Group Traceback (most recent call last):\n" +" | File \"\", line 2, in \n" +" | f()\n" +" | ~^^\n" +" | File \"\", line 2, in f\n" +" | raise ExceptionGroup(\n" +" | ...<12 lines>...\n" +" | )\n" +" | ExceptionGroup: group1 (1 sub-exception)\n" +" +-+---------------- 1 ----------------\n" +" | ExceptionGroup: group2 (1 sub-exception)\n" +" +-+---------------- 1 ----------------\n" +" | RecursionError: 4\n" +" +------------------------------------\n" +">>>" -#: ../../tutorial/errors.rst:605 msgid "" "Note that the exceptions nested in an exception group must be instances, not " "types. This is because in practice the exceptions would typically be ones " "that have already been raised and caught by the program, along the following " "pattern::" msgstr "" -"例外グループの中に含める例外は、型ではなくインスタンスである必要があることに" -"注意してください。これは一般的に、以下のパターンようにプログラムで送出された" -"複数の例外を捕捉することが多いためです。::" +"例外グループに含める例外は、型ではなくインスタンスでなければなりません。\n" +"実際には、次のパターンのようにプログラムがすでに送出して捕捉した例外をまとめ" +"ることが多いためです。 ::" -#: ../../tutorial/errors.rst:610 msgid "" ">>> excs = []\n" "... for test in tests:\n" @@ -1063,6 +1284,16 @@ msgid "" "... raise ExceptionGroup(\"Test Failures\", excs)\n" "..." msgstr "" +">>> excs = []\n" +"... for test in tests:\n" +"... try:\n" +"... test.run()\n" +"... except Exception as e:\n" +"... excs.append(e)\n" +"...\n" +">>> if excs:\n" +"... raise ExceptionGroup(\"Test Failures\", excs)\n" +"..." #: ../../tutorial/errors.rst:625 msgid "Enriching Exceptions with Notes" @@ -1084,7 +1315,6 @@ msgstr "" "字列を受け取り、例外のノートのリストに追加します。標準のトレースバックでは例" "外の後に、全てのノートが追加した順番に出力されます。::" -#: ../../tutorial/errors.rst:634 msgid "" ">>> try:\n" "... raise TypeError('bad type')\n" @@ -1101,6 +1331,20 @@ msgid "" "Add some more information\n" ">>>" msgstr "" +">>> try:\n" +"... raise TypeError('bad type')\n" +"... except Exception as e:\n" +"... e.add_note('Add some information')\n" +"... e.add_note('Add some more information')\n" +"... raise\n" +"...\n" +"Traceback (most recent call last):\n" +" File \"\", line 2, in \n" +" raise TypeError('bad type')\n" +"TypeError: bad type\n" +"Add some information\n" +"Add some more information\n" +">>>" #: ../../tutorial/errors.rst:649 msgid "" @@ -1112,7 +1356,6 @@ msgstr "" "ト情報を追加したい場合があります。以下のグループ内の各例外が持つノートは、エ" "ラーがいつ発生したかを示しています。::" -#: ../../tutorial/errors.rst:653 msgid "" ">>> def f():\n" "... raise OSError('operation failed')\n" @@ -1160,3 +1403,48 @@ msgid "" " +------------------------------------\n" ">>>" msgstr "" +">>> def f():\n" +"... raise OSError('operation failed')\n" +"...\n" +">>> excs = []\n" +">>> for i in range(3):\n" +"... try:\n" +"... f()\n" +"... except Exception as e:\n" +"... e.add_note(f'Happened in Iteration {i+1}')\n" +"... excs.append(e)\n" +"...\n" +">>> raise ExceptionGroup('We have some problems', excs)\n" +" + Exception Group Traceback (most recent call last):\n" +" | File \"\", line 1, in \n" +" | raise ExceptionGroup('We have some problems', excs)\n" +" | ExceptionGroup: We have some problems (3 sub-exceptions)\n" +" +-+---------------- 1 ----------------\n" +" | Traceback (most recent call last):\n" +" | File \"\", line 3, in \n" +" | f()\n" +" | ~^^\n" +" | File \"\", line 2, in f\n" +" | raise OSError('operation failed')\n" +" | OSError: operation failed\n" +" | Happened in Iteration 1\n" +" +---------------- 2 ----------------\n" +" | Traceback (most recent call last):\n" +" | File \"\", line 3, in \n" +" | f()\n" +" | ~^^\n" +" | File \"\", line 2, in f\n" +" | raise OSError('operation failed')\n" +" | OSError: operation failed\n" +" | Happened in Iteration 2\n" +" +---------------- 3 ----------------\n" +" | Traceback (most recent call last):\n" +" | File \"\", line 3, in \n" +" | f()\n" +" | ~^^\n" +" | File \"\", line 2, in f\n" +" | raise OSError('operation failed')\n" +" | OSError: operation failed\n" +" | Happened in Iteration 3\n" +" +------------------------------------\n" +">>>" diff --git a/tutorial/floatingpoint.po b/tutorial/floatingpoint.po index 9ca854233..ce46ba5a3 100644 --- a/tutorial/floatingpoint.po +++ b/tutorial/floatingpoint.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: Takanori Suzuki , 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../tutorial/floatingpoint.rst:10 @@ -37,13 +37,11 @@ msgid "" "values, the only real difference being that the first is written in base 10 " "fractional notation, and the second in base 2." msgstr "" -"浮動小数点数はコンピューターのハードウェア上は2進数(binary)の分数で表されま" -"す。\n" -"たとえば、**10進数** の分数では ``0.625`` は 6/10 + 2/100 + 5/1000 という値を" -"持ち、**2進数** の分数では ``0.101`` は 1/2 + 0/4 + 1/8 という値を持ちま" -"す。\n" -"この2つの分数はまったく同じ値を持ち、唯一異なる点は1つ目が10進数の分数で書か" -"れており、2つ目は2進数の分数で書かれているということです。" +"浮動小数点数は、コンピューターのハードウェア上では 2 進小数で表されます。\n" +"例えば、 **10 進小数** の ``0.625`` は 6/10 + 2/100 + 5/1000 という値を持ち、" +"同様に **2 進小数** の ``0.101`` は 1/2 + 0/4 + 1/8 という値を持ちます。\n" +"この二つの小数は同じ値を表しています。違いは、前者が 10 進法、後者が 2 進法の" +"小数表記で書かれていることだけです。" #: ../../tutorial/floatingpoint.rst:23 msgid "" @@ -52,21 +50,21 @@ msgid "" "point numbers you enter are only approximated by the binary floating-point " "numbers actually stored in the machine." msgstr "" -"残念なことに、ほとんどの小数は 2 進法の分数として正確に表わすことができませ" -"ん。その結果、一般に、入力した 10 進の浮動小数点数は、 2 進法の浮動小数点数で" -"近似された後、実際にマシンに記憶されます。" +"残念ながら、ほとんどの 10 進小数は 2 進小数として正確に表せません。そのため、" +"入力した 10 進の浮動小数点数に対して、実際にコンピューターに格納される 2 進の" +"浮動小数点数は、一般に近似値にすぎません。" #: ../../tutorial/floatingpoint.rst:28 msgid "" "The problem is easier to understand at first in base 10. Consider the " "fraction 1/3. You can approximate that as a base 10 fraction::" msgstr "" -"最初は基数 10 を使うと問題を簡単に理解できます。分数 1/3 を考えてみましょう。" -"分数 1/3 は、基数 10 の分数として、以下のように近似することができます::" +"まず 10 進法で考えると、この問題を理解しやすくなります。分数 1/3 を考えてみま" +"しょう。これは 10 進小数で次のように近似できます::" #: ../../tutorial/floatingpoint.rst:31 msgid "0.3" -msgstr "" +msgstr "0.3" #: ../../tutorial/floatingpoint.rst:33 ../../tutorial/floatingpoint.rst:37 msgid "or, better, ::" @@ -74,11 +72,11 @@ msgstr "さらに正確な近似は、 ::" #: ../../tutorial/floatingpoint.rst:35 msgid "0.33" -msgstr "" +msgstr "0.33" #: ../../tutorial/floatingpoint.rst:39 msgid "0.333" -msgstr "" +msgstr "0.333" #: ../../tutorial/floatingpoint.rst:41 msgid "" @@ -86,8 +84,8 @@ msgid "" "result will never be exactly 1/3, but will be an increasingly better " "approximation of 1/3." msgstr "" -"となり、以後同様です。何個桁数を増やして書こうが、結果は決して厳密な 1/3 には" -"なりません。しかし、少しづつ正確な近似にはなっていくでしょう。" +"というように続きます。何桁まで書いても、結果が正確に 1/3 になることはありませ" +"んが、桁数を増やすほど 1/3 に近い近似値になります。" #: ../../tutorial/floatingpoint.rst:45 msgid "" @@ -95,13 +93,12 @@ msgid "" "decimal value 0.1 cannot be represented exactly as a base 2 fraction. In " "base 2, 1/10 is the infinitely repeating fraction ::" msgstr "" -"同様に、基数を 2 とした表現で何桁使おうとも、10 進数の 0.1 は基数を 2 とした" -"小数で正確に表現することはできません。基数 2 では、1/10 は循環小数 " -"(repeating fraction) となります ::" +"同様に、2 進法で何桁使っても、10 進数の 0.1 を 2 進小数として正確に表すことは" +"できません。2 進法では、1/10 は次のように無限に繰り返す循環小数になります::" #: ../../tutorial/floatingpoint.rst:49 msgid "0.0001100110011001100110011001100110011001100110011..." -msgstr "" +msgstr "0.0001100110011001100110011001100110011001100110011..." #: ../../tutorial/floatingpoint.rst:51 msgid "" @@ -112,11 +109,11 @@ msgid "" "fraction is ``3602879701896397 / 2 ** 55`` which is close to but not exactly " "equal to the true value of 1/10." msgstr "" -"どこか有限の桁で止めると、近似値を得ることになります。近年の殆どのコンピュー" -"タでは float 型は、最上位ビットから数えて最初の 53 ビットを分子、2 の冪乗を分" -"母とした、二進小数で近似されます。1/10 の場合は、二進小数は " -"``3602879701896397 / 2 ** 55`` となります。これは、1/10 に近いですが、厳密に" -"同じ値ではありません。" +"有限のビット数で打ち切ると、得られるのは近似値です。現在のほとんどのコン" +"ピューターでは、浮動小数点数は、最上位ビットから数えて最初の 53 ビットを分子" +"に使い、2 の冪乗を分母とする分数で近似されます。1/10 の場合、この分数は " +"``3602879701896397 / 2 ** 55`` です。これは 1/10 に近い値ですが、正確に等しい" +"わけではありません。" #: ../../tutorial/floatingpoint.rst:58 msgid "" @@ -126,17 +123,19 @@ msgid "" "if Python were to print the true decimal value of the binary approximation " "stored for 0.1, it would have to display::" msgstr "" -"値が表示される方法のために、ほとんどのユーザは、近似に気づきません。Python は" -"マシンに格納されている二進近似値の10進小数での近似値を表示するので、格納され" -"ている値が元の10進小数の近似値でしか無いことを忘れがちです。ほとんどのマシン" -"で、もし Python が2進数で近似された 0.1 の近似値をそのまま10進数で表示してい" -"たら、その結果は次のようになったでしょう::" +"値の表示方式によって、ほとんどのユーザーはこの近似に気づきません。Python が表" +"示するのは、コンピューターに格納された 2 進の近似値を正確に 10 進数で表した値" +"ではなく、それをさらに 10 進数で近似した値です。ほとんどのコンピューターで、" +"0.1 に対して格納された 2 進の近似値を Python が正確に 10 進数で表示するとすれ" +"ば、次のように表示する必要があります::" #: ../../tutorial/floatingpoint.rst:64 msgid "" ">>> 0.1\n" "0.1000000000000000055511151231257827021181583404541015625" msgstr "" +">>> 0.1\n" +"0.1000000000000000055511151231257827021181583404541015625" #: ../../tutorial/floatingpoint.rst:67 msgid "" @@ -151,14 +150,17 @@ msgid "" ">>> 1 / 10\n" "0.1" msgstr "" +">>> 1 / 10\n" +"0.1" #: ../../tutorial/floatingpoint.rst:75 msgid "" "Just remember, even though the printed result looks like the exact value of " "1/10, the actual stored value is the nearest representable binary fraction." msgstr "" -"表示された結果が正確に 1/10 であるように見えたとしても、実際に格納されている" -"値は最も近く表現できる二進小数であるということだけは覚えておいてください。" +"表示された結果が正確に 1/10 であるように見えても、実際に格納されている値は、" +"表現可能な 2 進小数のうち 1/10 に最も近い値だということを覚えておいてくださ" +"い。" #: ../../tutorial/floatingpoint.rst:78 msgid "" @@ -170,12 +172,12 @@ msgid "" "values share the same approximation, any one of them could be displayed " "while still preserving the invariant ``eval(repr(x)) == x``." msgstr "" -"幾つかの異なる10進数の値が、同じ2進有理数の近似値を共有しています。例えば、" -"``0.1`` と ``0.10000000000000001`` と " +"興味深いことに、異なる多くの 10 進数が、最も近い近似値として同じ 2 進小数に対" +"応します。例えば、``0.1`` と ``0.10000000000000001`` と " "``0.1000000000000000055511151231257827021181583404541015625`` はどれも " -"``3602879701896397 / 2 ** 55`` に近似されます。同じ近似値を共有しているので、" -"どの10進数の値も ``eval(repr(x)) == x`` という条件を満たしたまま同じように表" -"示されます。" +"``3602879701896397 / 2 ** 55`` で近似されます。これらの 10 進数は同じ近似値に" +"対応するため、どれを選んで表示しても、 ``eval(repr(x)) == x`` という条件を保" +"てます。" #: ../../tutorial/floatingpoint.rst:86 msgid "" @@ -184,10 +186,10 @@ msgid "" "Starting with Python 3.1, Python (on most systems) is now able to choose the " "shortest of these and simply display ``0.1``." msgstr "" -"昔の Python は、プロンプトと :func:`repr` ビルトイン関数は 17 桁の有効数字を" -"持つ ``0.10000000000000001`` のような10進数の値を選んで表示していました。 " -"Python 3.1 からは、ほとんどの場面で ``0.1`` のような最も短い桁数の10進数の値" -"を選ぶようになりました。" +"以前は、Python のプロンプトと組み込み関数 :func:`repr` は、有効数字 17 桁の " +"``0.10000000000000001`` を選んで表示していました。Python 3.1 以降は、ほとんど" +"のシステムで、これらのうち最も短い表現を選び、単に ``0.1`` と表示できるように" +"なりました。" #: ../../tutorial/floatingpoint.rst:91 msgid "" @@ -222,6 +224,14 @@ msgid "" ">>> repr(math.pi)\n" "'3.141592653589793'" msgstr "" +">>> format(math.pi, '.12g') # 有効数字 12 桁で表示\n" +"'3.14159265359'\n" +"\n" +">>> format(math.pi, '.2f') # 小数点以下 2 桁で表示\n" +"'3.14'\n" +"\n" +">>> repr(math.pi)\n" +"'3.141592653589793'" #: ../../tutorial/floatingpoint.rst:111 msgid "" @@ -236,14 +246,16 @@ msgid "" "One illusion may beget another. For example, since 0.1 is not exactly 1/10, " "summing three values of 0.1 may not yield exactly 0.3, either:" msgstr "" -"もう一つの錯覚を紹介します。例えば、0.1 が正確には 1/10 ではないために、それ" -"を3回足した値もまた正確には 0.3 ではありません:" +"一つの錯覚が別の錯覚を生むこともあります。例えば、0.1 は正確には 1/10 ではな" +"いため、0.1 を三つ足した結果も正確に 0.3 になるとは限りません:" #: ../../tutorial/floatingpoint.rst:117 msgid "" ">>> 0.1 + 0.1 + 0.1 == 0.3\n" "False" msgstr "" +">>> 0.1 + 0.1 + 0.1 == 0.3\n" +"False" #: ../../tutorial/floatingpoint.rst:122 msgid "" @@ -260,20 +272,24 @@ msgid "" ">>> round(0.1, 1) + round(0.1, 1) + round(0.1, 1) == round(0.3, 1)\n" "False" msgstr "" +">>> round(0.1, 1) + round(0.1, 1) + round(0.1, 1) == round(0.3, 1)\n" +"False" #: ../../tutorial/floatingpoint.rst:131 msgid "" "Though the numbers cannot be made closer to their intended exact values, " "the :func:`math.isclose` function can be useful for comparing inexact values:" msgstr "" -"数値を意図した正確な値に近づけることはできませんが、 :func:`math.isclose` 関" -"数は不正確な値を比べるのに便利です: " +"これらの数値を意図した正確な値にさらに近づけることはできませんが、誤差を含む" +"値を比較するには :func:`math.isclose` 関数が役立ちます:" #: ../../tutorial/floatingpoint.rst:134 msgid "" ">>> math.isclose(0.1 + 0.1 + 0.1, 0.3)\n" "True" msgstr "" +">>> math.isclose(0.1 + 0.1 + 0.1, 0.3)\n" +"True" #: ../../tutorial/floatingpoint.rst:139 msgid "" @@ -286,6 +302,8 @@ msgid "" ">>> round(math.pi, ndigits=2) == round(22 / 7, ndigits=2)\n" "True" msgstr "" +">>> round(math.pi, ndigits=2) == round(22 / 7, ndigits=2)\n" +"True" #: ../../tutorial/floatingpoint.rst:147 msgid "" @@ -298,13 +316,13 @@ msgid "" "Point `_ for a more complete " "account of other common surprises." msgstr "" -"このように2進数の浮動小数点の演算には多くの驚きがあります。「0.1」の問題につ" -"いて詳しい説明は、「表現エラー」セクションで行います。2進数の浮動小数点の仕組" +"2 進浮動小数点演算には、このような意外な挙動が数多くあります。「0.1」の問題に" +"ついて詳しい説明は、「表現誤差」セクションで行います。2進数の浮動小数点の仕組" "みと、実際によく遭遇する問題各種についての分かりやすい概要は、 `Examples of " "Floating Point Problems `_ を参照してください。その他よくある驚きの より詳細" -"な説明は `The Perils of Floating Point `_ も参照してください。" +"floating-point-problems/>`_ を参照してください。その他のよく見られる意外な挙" +"動について、より詳しくは `The Perils of Floating Point `_ も参照してください。" #: ../../tutorial/floatingpoint.rst:156 msgid "" @@ -316,12 +334,12 @@ msgid "" "decimal arithmetic and that every float operation can suffer a new rounding " "error." msgstr "" -"究極的にいうと、\"容易な答えはありません\"。ですが、浮動小数点数のことを過度" -"に警戒しないでください! Python の float 型操作におけるエラーは浮動小数点処理" -"ハードウェアから受けついたものであり、ほとんどのマシン上では一つの演算あたり" -"高々 2\\*\\*53 分の 1 です。この誤差はほとんどの作業で充分以上のものですが、" -"浮動小数点演算は 10 進の演算ではなく、浮動小数点の演算を新たに行うと、新たな" -"丸め誤差の影響を受けることを心にとどめておいてください。" +"その記事の終わり近くにもあるように、「簡単な答えはありません」。とはいえ、浮" +"動小数点数を過度に警戒しないでください。Python の浮動小数点演算の誤差は浮動小" +"数点演算を行うハードウェアに由来し、ほとんどのコンピューターでは演算ごとに" +"高々 2\\*\\*53 分の 1 程度です。これはほとんどの用途で十分な精度です。ただ" +"し、10 進の演算ではないこと、そして浮動小数点演算のたびに新たな丸め誤差が生じ" +"る可能性があることを覚えておく必要があります。" #: ../../tutorial/floatingpoint.rst:163 msgid "" @@ -331,11 +349,10 @@ msgid "" "expect. :func:`str` usually suffices, and for finer control see the :meth:" "`str.format` method's format specifiers in :ref:`formatstrings`." msgstr "" -"異常なケースが存在する一方で、普段の浮動小数点演算の利用では、単に最終的な結" -"果の値を必要な 10 進の桁数に丸めて表示するのなら、最終的には期待通りの結果を" -"得ることになるでしょう。たいては :func:`str` で十分ですが、きめ細かな制御をし" -"たければ、 :ref:`formatstrings` にある :meth:`str.format` メソッドのフォー" -"マット仕様を参照してください。" +"極端なケースはあるものの、普段の浮動小数点演算では最終結果の表示を必要な 10 " +"進の桁数に丸めるだけで、たいていは期待する結果が得られます。通常は :func:" +"`str` で十分ですが、より細かく制御するには、 :ref:`formatstrings` にある :" +"meth:`str.format` メソッドの書式指定子を参照してください。" #: ../../tutorial/floatingpoint.rst:169 msgid "" @@ -363,9 +380,9 @@ msgid "" "statistical operations supplied by the SciPy project. See ." msgstr "" -"あなたが浮動小数点演算のヘビーユーザーなら、SciPy プロジェクトが提供している " -"NumPy パッケージやその他の数学用パッケージを調べてみるべきです。 を参照してください。" +"浮動小数点演算を頻繁に使う場合は、NumPy パッケージや、SciPy プロジェクトが提" +"供するその他の数学・統計演算用の多くのパッケージを調べてみてください。 " +" を参照してください。" #: ../../tutorial/floatingpoint.rst:181 msgid "" @@ -373,9 +390,9 @@ msgid "" "*do* want to know the exact value of a float. The :meth:`float." "as_integer_ratio` method expresses the value of a float as a fraction:" msgstr "" -"Python は *本当に* float の正確な値が必要なレアケースに対応するためのツールを" -"提供しています。 :meth:`float.as_integer_ratio` メソッドは float の値を有理数" -"として表現します:" +"浮動小数点数の正確な値を *本当に* 知りたいというまれな場合に役立つツールも、" +"Python は提供しています。 :meth:`float.as_integer_ratio` メソッドは、浮動小数" +"点数の値を分数として表します:" #: ../../tutorial/floatingpoint.rst:186 msgid "" @@ -383,6 +400,9 @@ msgid "" ">>> x.as_integer_ratio()\n" "(3537115888337719, 1125899906842624)" msgstr "" +">>> x = 3.14159\n" +">>> x.as_integer_ratio()\n" +"(3537115888337719, 1125899906842624)" #: ../../tutorial/floatingpoint.rst:192 msgid "" @@ -395,6 +415,8 @@ msgid "" ">>> x == 3537115888337719 / 1125899906842624\n" "True" msgstr "" +">>> x == 3537115888337719 / 1125899906842624\n" +"True" #: ../../tutorial/floatingpoint.rst:200 msgid "" @@ -409,6 +431,8 @@ msgid "" ">>> x.hex()\n" "'0x1.921f9f01b866ep+1'" msgstr "" +">>> x.hex()\n" +"'0x1.921f9f01b866ep+1'" #: ../../tutorial/floatingpoint.rst:208 msgid "" @@ -423,6 +447,8 @@ msgid "" ">>> x == float.fromhex('0x1.921f9f01b866ep+1')\n" "True" msgstr "" +">>> x == float.fromhex('0x1.921f9f01b866ep+1')\n" +"True" #: ../../tutorial/floatingpoint.rst:216 msgid "" @@ -443,10 +469,9 @@ msgid "" "difference in overall accuracy so that the errors do not accumulate to the " "point where they affect the final total:" msgstr "" -"別の便利なツールとして、合計処理における精度のロスを緩和してくれる :func:" -"`sum` 関数があります。これは累計加算中の丸めに拡張精度を使います。これによ" -"り、誤差が最終的な合計値に影響を与えるまで蓄積されなくなり、結果が改善されま" -"す:" +"もう一つ便利なのが、合計を求める際の精度の低下を抑える :func:`sum` 関数です。" +"累計に値を加えていく途中の丸め処理に拡張精度を使います。これにより、誤差が蓄" +"積して最終的な合計値に影響するのを抑え、結果の精度を改善できる場合があります:" #: ../../tutorial/floatingpoint.rst:226 msgid "" @@ -455,6 +480,10 @@ msgid "" ">>> sum([0.1] * 10) == 1.0\n" "True" msgstr "" +">>> 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 == 1.0\n" +"False\n" +">>> sum([0.1] * 10) == 1.0\n" +"True" #: ../../tutorial/floatingpoint.rst:233 msgid "" @@ -464,6 +493,10 @@ msgid "" "uncommon cases where large magnitude inputs mostly cancel each other out " "leaving a final sum near zero:" msgstr "" +":func:`math.fsum` はさらに進んで、累計に値を加える際に「失われた桁」を全て追" +"跡し、結果を得るまでの丸めを一度だけに抑えます。これは :func:`sum` より低速で" +"すが、絶対値の大きい入力値が互いにほぼ打ち消し合い、最終的な合計がゼロに近く" +"なるようなまれな場合には、より正確な結果が得られます:" #: ../../tutorial/floatingpoint.rst:239 msgid "" @@ -485,20 +518,33 @@ msgid "" "digits!\n" "-0.0051575902860057365" msgstr "" +">>> arr = [-0.10430216751806065, -266310978.67179024, 143401161448607.16,\n" +"... -143401161400469.7, 266262841.31058735, -0.003244936839808227]\n" +">>> float(sum(map(Fraction, arr))) # 正確に合計し、一度だけ丸める\n" +"8.042173697819788e-13\n" +">>> math.fsum(arr) # 一度だけ丸める\n" +"8.042173697819788e-13\n" +">>> sum(arr) # 拡張精度で複数回丸める\n" +"8.042178034628478e-13\n" +">>> total = 0.0\n" +">>> for x in arr:\n" +"... total += x # 標準精度で複数回丸める\n" +"...\n" +">>> total # 単純な加算では正しい桁が一つもない!\n" +"-0.0051575902860057365" #: ../../tutorial/floatingpoint.rst:260 msgid "Representation Error" -msgstr "表現エラー" +msgstr "表現誤差" -#: ../../tutorial/floatingpoint.rst:262 msgid "" "This section explains the \"0.1\" example in detail, and shows how you can " "perform an exact analysis of cases like this yourself. Basic familiarity " "with binary floating-point representation is assumed." msgstr "" -"この章では、\"0.1\" の例について詳細に説明し、このようなケースに対してどのよ" -"うにすれば正確な分析を自分で行えるかを示します。ここでは、 2 進法表現の浮動小" -"数点数についての基礎的な知識があるものとして話を進めます。" +"この節では「0.1」の例を詳しく説明し、このような場合に正確な分析を自分で行う方" +"法を示します。\n" +"2 進浮動小数点表現についての基本的な知識があることを前提としています。" #: ../../tutorial/floatingpoint.rst:266 msgid "" @@ -508,10 +554,10 @@ msgid "" "Fortran, and many others) often won't display the exact decimal number you " "expect." msgstr "" -"表現エラー(:dfn:`Representation error`)は、いくつかの (実際にはほとんどの) " -"10 進の小数が 2 進法 (基数 2)の分数として表現できないという事実に関係していま" -"す。これは Python (あるいは Perl, C, C++, Java, Fortran. およびその他多く) が" -"期待通りの正確な 10 進数を表示できない主要な理由です。" +"表現誤差 (:dfn:`Representation error`) とは、一部の (実際にはほとんどの) 10 " +"進小数を 2 進小数として正確に表せないことを指します。これが、Python (あるい" +"は Perl、C、C++、Java、Fortran など多くの言語) で、期待した正確な 10 進数が表" +"示されないことがよくある主な理由です。" #: ../../tutorial/floatingpoint.rst:271 msgid "" @@ -523,17 +569,16 @@ msgid "" "fraction it can of the form *J*/2**\\ *N* where *J* is an integer containing " "exactly 53 bits. Rewriting ::" msgstr "" -"なぜそうなるのでしょう? 1/10 は2進法の小数で厳密に表現できません。少なくと" -"も2000年以降、ほぼすべてのマシンは IEEE 754 2進数の浮動小数点演算を用いてお" -"り、ほぼすべてのプラットフォームでは Python の浮動小数点を IEEE 754 binary64 " -"\"倍精度 (double precision)\" 値に対応付けます。 IEEE 754 binary64 値は 53 " -"ビットの精度を持つため、計算機に入力を行おうとすると、可能な限り 0.1 を最も近" -"い値の分数に変換し、*J*/2**\\ *N* の形式にしようと努力します。*J* はちょうど " -"53 ビットの精度の整数です。 ::" +"なぜそうなるのでしょうか。1/10 は 2 進小数として正確に表せません。少なくとも " +"2000 年以降、ほぼ全てのコンピューターは IEEE 754 の 2 進浮動小数点演算を使" +"い、ほぼ全てのプラットフォームで Python の浮動小数点数は IEEE 754 binary64 の" +"「倍精度」値に対応しています。IEEE 754 binary64 の値は 53 ビットの精度を持つ" +"ため、0.1 を入力すると、コンピューターは *J*/2**\\ *N* の形で表せる分数のうち" +"最も近い値に変換します。ここで *J* はちょうど 53 ビットの整数です。次の式::" #: ../../tutorial/floatingpoint.rst:280 msgid "1 / 10 ~= J / (2**N)" -msgstr "" +msgstr "1 / 10 ~= J / (2**N)" #: ../../tutorial/floatingpoint.rst:282 msgid "as ::" @@ -541,29 +586,31 @@ msgstr "を書き直すと ::" #: ../../tutorial/floatingpoint.rst:284 msgid "J ~= 2**N / 10" -msgstr "" +msgstr "J ~= 2**N / 10" #: ../../tutorial/floatingpoint.rst:286 msgid "" "and recalling that *J* has exactly 53 bits (is ``>= 2**52`` but ``< " "2**53``), the best value for *N* is 56:" msgstr "" -"となります。 *J* は厳密に 53 ビットの精度を持っている (``>= 2**52`` だが ``< " -"2**53`` ) ことを思い出すと、 *N* として最適な値は 56 になります:" +"となります。 *J* がちょうど 53 ビットの整数である (``>= 2**52`` かつ ``< " +"2**53``) ことを思い出すと、 *N* として最適な値は 56 になります:" #: ../../tutorial/floatingpoint.rst:289 msgid "" ">>> 2**52 <= 2**56 // 10 < 2**53\n" "True" msgstr "" +">>> 2**52 <= 2**56 // 10 < 2**53\n" +"True" #: ../../tutorial/floatingpoint.rst:294 msgid "" "That is, 56 is the only value for *N* that leaves *J* with exactly 53 bits. " "The best possible value for *J* is then that quotient rounded:" msgstr "" -"すなわち、56 は *J* をちょうど 53 ビットの精度のままに保つ *N* の唯一の値で" -"す。*J* の取りえる値はその商を丸めたものです:" +"つまり、 *J* がちょうど 53 ビットになる *N* の値は 56 だけです。このとき、 " +"*J* として最適な値は、その商を丸めたものになります:" #: ../../tutorial/floatingpoint.rst:297 msgid "" @@ -571,19 +618,23 @@ msgid "" ">>> r\n" "6" msgstr "" +">>> q, r = divmod(2**56, 10)\n" +">>> r\n" +"6" #: ../../tutorial/floatingpoint.rst:303 msgid "" "Since the remainder is more than half of 10, the best approximation is " "obtained by rounding up:" -msgstr "" -"剰余が 10 の半分以上なので、最良の近似は切り上げて丸めたものになります。:" +msgstr "余りが 10 の半分より大きいため、切り上げると最もよい近似が得られます:" #: ../../tutorial/floatingpoint.rst:306 msgid "" ">>> q+1\n" "7205759403792794" msgstr "" +">>> q+1\n" +"7205759403792794" #: ../../tutorial/floatingpoint.rst:313 msgid "" @@ -593,16 +644,16 @@ msgstr "従って、IEEE 754の倍精度における 1/10 の取りえる最良 #: ../../tutorial/floatingpoint.rst:316 msgid "7205759403792794 / 2 ** 56" -msgstr "" +msgstr "7205759403792794 / 2 ** 56" #: ../../tutorial/floatingpoint.rst:318 msgid "" "Dividing both the numerator and denominator by two reduces the fraction to::" -msgstr "分子と分母を2で割って分数を小さくします::" +msgstr "分子と分母を 2 で割って約分すると、次のようになります::" #: ../../tutorial/floatingpoint.rst:320 msgid "3602879701896397 / 2 ** 55" -msgstr "" +msgstr "3602879701896397 / 2 ** 55" #: ../../tutorial/floatingpoint.rst:322 msgid "" @@ -620,15 +671,16 @@ msgid "" "So the computer never \"sees\" 1/10: what it sees is the exact fraction " "given above, the best IEEE 754 double approximation it can get:" msgstr "" -"つまり、計算機は 1/10 を \"理解する\" ことは決してありません。計算機が理解で" -"きるのは、上記のような厳密な分数であり、IEEE 754 の倍精度浮動小数点数で得られ" -"るもっともよい近似は以下になります::" +"つまり、コンピューターが扱っている値は 1/10 そのものではなく、上に示した分数" +"の正確な値です。これは、IEEE 754 の倍精度で表せる、1/10 の最もよい近似値です:" #: ../../tutorial/floatingpoint.rst:329 msgid "" ">>> 0.1 * 2 ** 55\n" "3602879701896397.0" msgstr "" +">>> 0.1 * 2 ** 55\n" +"3602879701896397.0" #: ../../tutorial/floatingpoint.rst:334 msgid "" @@ -642,6 +694,8 @@ msgid "" ">>> 3602879701896397 * 10 ** 55 // 2 ** 55\n" "1000000000000000055511151231257827021181583404541015625" msgstr "" +">>> 3602879701896397 * 10 ** 55 // 2 ** 55\n" +"1000000000000000055511151231257827021181583404541015625" #: ../../tutorial/floatingpoint.rst:342 msgid "" @@ -650,16 +704,18 @@ msgid "" "displaying the full decimal value, many languages (including older versions " "of Python), round the result to 17 significant digits:" msgstr "" -"これは、計算機が記憶している正確な数値が、10 進数値 " -"0.1000000000000000055511151231257827021181583404541015625 にほぼ等しいという" -"ことです。多くの言語 (古いバージョンの Python を含む) では、完全な 10 進値を" -"表示するのではなく、結果を有効数字 17 桁に丸めます:" +"これは、コンピューターに格納されている数値が、10 進数の " +"0.1000000000000000055511151231257827021181583404541015625 と正確に等しいこと" +"を意味します。多くの言語 (古いバージョンの Python を含む) では、全ての桁を " +"10 進数で表示する代わりに、結果を有効数字 17 桁に丸めます:" #: ../../tutorial/floatingpoint.rst:347 msgid "" ">>> format(0.1, '.17f')\n" "'0.10000000000000001'" msgstr "" +">>> format(0.1, '.17f')\n" +"'0.10000000000000001'" #: ../../tutorial/floatingpoint.rst:352 msgid "" @@ -685,3 +741,17 @@ msgid "" ">>> format(Decimal.from_float(0.1), '.17')\n" "'0.10000000000000001'" msgstr "" +">>> from decimal import Decimal\n" +">>> from fractions import Fraction\n" +"\n" +">>> Fraction.from_float(0.1)\n" +"Fraction(3602879701896397, 36028797018963968)\n" +"\n" +">>> (0.1).as_integer_ratio()\n" +"(3602879701896397, 36028797018963968)\n" +"\n" +">>> Decimal.from_float(0.1)\n" +"Decimal('0.1000000000000000055511151231257827021181583404541015625')\n" +"\n" +">>> format(Decimal.from_float(0.1), '.17')\n" +"'0.10000000000000001'" diff --git a/tutorial/index.po b/tutorial/index.po index a171ec4b0..6bdef56cb 100644 --- a/tutorial/index.po +++ b/tutorial/index.po @@ -17,10 +17,10 @@ msgstr "" "Last-Translator: Takanori Suzuki , 2021\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../tutorial/index.rst:5 @@ -32,6 +32,8 @@ msgid "" "This tutorial is designed for *programmers* that are new to the Python " "language, **not** *beginners* who are new to programming." msgstr "" +"このチュートリアルは Python を初めて学ぶ *プログラマー* 向けです。プログラミ" +"ングを初めて学ぶ *初心者* 向け **ではありません** 。" #: ../../tutorial/index.rst:11 msgid "" @@ -41,11 +43,11 @@ msgid "" "with its interpreted nature, make it an ideal language for scripting and " "rapid application development in many areas on most platforms." msgstr "" -"Python は強力で、学びやすいプログラミング言語です。効率的な高レベルデータ構造" -"と、シンプルで効果的なオブジェクト指向プログラミング機構を備えています。\n" -"Python は、洗練された文法・動的なデータ型付け・インタープリタであることなどか" -"ら、スクリプティングや高速アプリケーション開発(Rapid Application " -"Development: RAD)に理想的なプログラミング言語となっています。" +"Python は学びやすく強力なプログラミング言語です。効率的な高レベルのデータ構造" +"と、シンプルながら効果的なオブジェクト指向プログラミングの仕組みを備えていま" +"す。洗練された構文と動的型付けを持つインタープリタ言語でもあります。こうした" +"特徴から、ほとんどのプラットフォームで幅広い分野のスクリプト作成や迅速なアプ" +"リケーション開発に理想的な言語です。" #: ../../tutorial/index.rst:17 msgid "" @@ -66,9 +68,9 @@ msgid "" "implemented in C or C++ (or other languages callable from C). Python is also " "suitable as an extension language for customizable applications." msgstr "" -"Python インタプリタは、簡単に C/C++ 言語などで実装された関数やデータ型を組み" -"込み、拡張できます。また、アプリケーションのカスタマイズを行う、拡張言語とし" -"ても適しています。" +"C や C++ (または C から呼び出せる他の言語) で実装した新しい関数やデータ型を追" +"加して、Python インタープリタを簡単に拡張できます。Python はカスタマイズ可能" +"なアプリケーションの拡張言語にも適しています。" #: ../../tutorial/index.rst:27 msgid "" @@ -78,6 +80,10 @@ msgid "" "Python interpreter handy for hands-on experience, but all examples are self-" "contained, so the tutorial can be read off-line as well." msgstr "" +"このチュートリアルでは Python 言語とシステムの基本的な概念や機能を形式ばらず" +"に紹介します。一般的なプログラミングの基礎知識があることを前提としています。" +"実際に試せるように Python インタープリタを用意しておくと役立ちます。ただし、" +"例はそれぞれ単独で理解できるので、オフラインで読むこともできます。" #: ../../tutorial/index.rst:33 msgid "" @@ -100,13 +106,12 @@ msgid "" "write Python modules and programs, and you will be ready to learn more about " "the various Python library modules described in :ref:`library-index`." msgstr "" -"このチュートリアルは、Python全体を対象とした、包括的な解説書ではありません。" -"よく使われる機能に限っても、全ては紹介していません。その代わり、このチュート" -"リアルでは、Pythonのもっとも特徴的な機能を中心に紹介して、この言語の持ち味" -"や、スタイルを感じられるようにしています。このチュートリアルを読み終えると、" -"Python のモジュールやプログラムを読み書きできるようになっているでしょう。ま" -"た、:ref:`library-index` のさまざまな Python ライブラリモジュールを、詳しく調" -"べられるようになっているはずです。" +"このチュートリアルはすべての機能を網羅するものではなく、よく使われる機能に" +"限ってもすべてを扱うわけではありません。その代わりに Python の特に注目すべき" +"機能を数多く紹介し、言語の持ち味やスタイルをつかめるようにしています。読み終" +"えるころには Python のモジュールやプログラムを読み書きできるようになり、 :" +"ref:`library-index` で説明されているさまざまな Python ライブラリモジュールに" +"ついてさらに学ぶ準備も整うでしょう。" #: ../../tutorial/index.rst:45 msgid "The :ref:`glossary` is also worth going through." diff --git a/tutorial/inputoutput.po b/tutorial/inputoutput.po index 9be69f7d8..b857d9c03 100644 --- a/tutorial/inputoutput.po +++ b/tutorial/inputoutput.po @@ -23,10 +23,10 @@ msgstr "" "Last-Translator: digdugdog, 2025\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../tutorial/inputoutput.rst:5 @@ -90,8 +90,11 @@ msgid "" ">>> f'Results of the {year} {event}'\n" "'Results of the 2016 Referendum'" msgstr "" +">>> year = 2016\n" +">>> event = '国民投票'\n" +">>> f'{year}年の{event}の結果'\n" +"'2016年の国民投票の結果'" -#: ../../tutorial/inputoutput.rst:37 msgid "" "The :meth:`str.format` method of strings requires more manual effort. " "You'll still use ``{`` and ``}`` to mark where a variable will be " @@ -100,9 +103,9 @@ msgid "" "there are two examples of how to format variables:" msgstr "" "文字列の :meth:`str.format` メソッドは、もう少し手間がかかります。\n" -"ここでも ``{`` と ``}`` を使って変数に代入する場所の印を付けて、細かいフォー" -"マットの指示を出せますが、フォーマットされる対象の情報を与える必要がありま" -"す。次のコードには、変数をフォーマットする方法の例が二つあります:" +"ここでも ``{`` と ``}`` で変数の値を埋め込む位置を示し、細かなフォーマットの" +"指示を出せますが、フォーマットする対象の情報も渡す必要があります。\n" +"次のコードには、変数の値をフォーマットする例が 2 つあります:" #: ../../tutorial/inputoutput.rst:46 msgid "" @@ -112,6 +115,11 @@ msgid "" ">>> '{:-9} YES votes {:2.2%}'.format(yes_votes, percentage)\n" "' 42572654 YES votes 49.67%'" msgstr "" +">>> yes_votes = 42_572_654\n" +">>> total_votes = 85_705_149\n" +">>> percentage = yes_votes / total_votes\n" +">>> '{:-9} 賛成票 {:2.2%}'.format(yes_votes, percentage)\n" +"' 42572654 賛成票 49.67%'" #: ../../tutorial/inputoutput.rst:52 msgid "" @@ -229,16 +237,16 @@ msgstr "" msgid "Formatted String Literals" msgstr "フォーマット済み文字列リテラル" -#: ../../tutorial/inputoutput.rst:116 msgid "" ":ref:`Formatted string literals ` (also called f-strings for " "short) let you include the value of Python expressions inside a string by " "prefixing the string with ``f`` or ``F`` and writing expressions as " "``{expression}``." msgstr "" -":ref:`フォーマット済み文字リテラル ` (短くして f-string とも呼びま" -"す) では、文字列の頭に ``f`` か ``F`` を付け、式を ``{expression}`` と書くこ" -"とで、 Python の式の値を文字列の中に入れ込めます。" +"文字列の先頭に ``f`` または ``F`` を付け、文字列の中に ``{expression}`` の形" +"式で式を書くと、\n" +":ref:`フォーマット済み文字列リテラル ` (略して f-string) を使って " +"Python の式の値を文字列に埋め込めます。" #: ../../tutorial/inputoutput.rst:121 msgid "" @@ -256,6 +264,9 @@ msgid "" ">>> print(f'The value of pi is approximately {math.pi:.3f}.')\n" "The value of pi is approximately 3.142." msgstr "" +">>> import math\n" +">>> print(f'πの値はだいたい {math.pi:.3f} です。')\n" +"πの値はだいたい 3.142 です。" #: ../../tutorial/inputoutput.rst:129 msgid "" @@ -276,6 +287,13 @@ msgid "" "Jack ==> 4098\n" "Dcab ==> 7678" msgstr "" +">>> table = {'Sjoerd': 4127, 'Jack': 4098, 'Dcab': 7678}\n" +">>> for name, phone in table.items():\n" +"... print(f'{name:10} ==> {phone:10d}')\n" +"...\n" +"Sjoerd ==> 4127\n" +"Jack ==> 4098\n" +"Dcab ==> 7678" #: ../../tutorial/inputoutput.rst:140 msgid "" @@ -295,15 +313,19 @@ msgid "" ">>> print(f'My hovercraft is full of {animals!r}.')\n" "My hovercraft is full of 'eels'." msgstr "" +">>> animals = 'ウナギ'\n" +">>> print(f'私のホバークラフトは {animals} でいっぱいです。')\n" +"私のホバークラフトは ウナギ でいっぱいです。\n" +">>> print(f'私のホバークラフトは {animals!r} でいっぱいです。')\n" +"私のホバークラフトは 'ウナギ' でいっぱいです。" -#: ../../tutorial/inputoutput.rst:150 msgid "" "The ``=`` specifier can be used to expand an expression to the text of the " "expression, an equal sign, then the representation of the evaluated " "expression:" msgstr "" -"``=`` 指定子を使用すると式を展開して、式、イコール記、式を評価した文字列表" -"現、の形式で表示されます。" +"``=`` 指定子を使うと、式のテキスト、``=``、式を評価した値の ``repr()`` 結果を" +"順に表示できます。" #: ../../tutorial/inputoutput.rst:159 msgid "" @@ -328,6 +350,8 @@ msgid "" ">>> print('We are the {} who say \"{}!\"'.format('knights', 'Ni'))\n" "We are the knights who say \"Ni!\"" msgstr "" +">>> print('We are the {} who say \"{}!\"'.format('knights', 'Ni'))\n" +"We are the knights who say \"Ni!\"" #: ../../tutorial/inputoutput.rst:173 msgid "" @@ -347,6 +371,10 @@ msgid "" ">>> print('{1} and {0}'.format('spam', 'eggs'))\n" "eggs and spam" msgstr "" +">>> print('{0} and {1}'.format('spam', 'eggs'))\n" +"spam and eggs\n" +">>> print('{1} and {0}'.format('spam', 'eggs'))\n" +"eggs and spam" #: ../../tutorial/inputoutput.rst:183 msgid "" @@ -362,6 +390,9 @@ msgid "" "... food='spam', adjective='absolutely horrible'))\n" "This spam is absolutely horrible." msgstr "" +">>> print('This {food} is {adjective}.'.format(\n" +"... food='spam', adjective='absolutely horrible'))\n" +"This spam is absolutely horrible." #: ../../tutorial/inputoutput.rst:190 msgid "Positional and keyword arguments can be arbitrarily combined::" @@ -373,6 +404,9 @@ msgid "" "... other='Georg'))\n" "The story of Bill, Manfred, and Georg." msgstr "" +">>> print('The story of {0}, {1}, and {other}.'.format('Bill', 'Manfred',\n" +"... other='Georg'))\n" +"The story of Bill, Manfred, and Georg." #: ../../tutorial/inputoutput.rst:196 msgid "" @@ -392,6 +426,10 @@ msgid "" "... 'Dcab: {0[Dcab]:d}'.format(table))\n" "Jack: 4098; Sjoerd: 4127; Dcab: 8637678" msgstr "" +">>> table = {'Sjoerd': 4127, 'Jack': 4098, 'Dcab': 8637678}\n" +">>> print('Jack: {0[Jack]:d}; Sjoerd: {0[Sjoerd]:d}; '\n" +"... 'Dcab: {0[Dcab]:d}'.format(table))\n" +"Jack: 4098; Sjoerd: 4127; Dcab: 8637678" #: ../../tutorial/inputoutput.rst:206 msgid "" @@ -408,14 +446,17 @@ msgid "" "format(**table))\n" "Jack: 4098; Sjoerd: 4127; Dcab: 8637678" msgstr "" +">>> table = {'Sjoerd': 4127, 'Jack': 4098, 'Dcab': 8637678}\n" +">>> print('Jack: {Jack:d}; Sjoerd: {Sjoerd:d}; Dcab: {Dcab:d}'." +"format(**table))\n" +"Jack: 4098; Sjoerd: 4127; Dcab: 8637678" -#: ../../tutorial/inputoutput.rst:213 msgid "" "This is particularly useful in combination with the built-in function :func:" "`vars`, which returns a dictionary containing all local variables::" msgstr "" -"全てのローカルな変数が入った辞書を返す組み込み関数 :func:`vars` と組み合わせ" -"ると特に便利です。" +"すべてのローカル変数が入った辞書を返す組み込み関数 :func:`vars` と組み合わせ" +"ると、特に便利です。 ::" #: ../../tutorial/inputoutput.rst:216 msgid "" @@ -424,6 +465,10 @@ msgid "" ">>> print(message.format(**table))\n" "__name__: __main__; __doc__: None; __package__: None; __loader__: ..." msgstr "" +">>> table = {k: str(v) for k, v in vars().items()}\n" +">>> message = \" \".join([f'{k}: ' + '{' + k +'};' for k in table.keys()])\n" +">>> print(message.format(**table))\n" +"__name__: __main__; __doc__: None; __package__: None; __loader__: ..." #: ../../tutorial/inputoutput.rst:221 msgid "" @@ -449,6 +494,19 @@ msgid "" " 9 81 729\n" "10 100 1000" msgstr "" +">>> for x in range(1, 11):\n" +"... print('{0:2d} {1:3d} {2:4d}'.format(x, x*x, x*x*x))\n" +"...\n" +" 1 1 1\n" +" 2 4 8\n" +" 3 9 27\n" +" 4 16 64\n" +" 5 25 125\n" +" 6 36 216\n" +" 7 49 343\n" +" 8 64 512\n" +" 9 81 729\n" +"10 100 1000" #: ../../tutorial/inputoutput.rst:238 msgid "" @@ -506,9 +564,8 @@ msgid "" "`print` works: it always adds spaces between its arguments.)" msgstr "" "(各カラムの間のスペース一個分は :func:`print` の動作で追加されていることに注" -"意してください。 :func:`print` は常に引数間に空白を追加します。)" +"意してください。 ``print()`` は常に引数間に空白を追加します。)" -#: ../../tutorial/inputoutput.rst:266 msgid "" "The :meth:`str.rjust` method of string objects right-justifies a string in a " "field of a given width by padding it with spaces on the left. There are " @@ -519,15 +576,15 @@ msgid "" "would be lying about a value. (If you really want truncation you can always " "add a slice operation, as in ``x.ljust(n)[:n]``.)" msgstr "" -"文字列オブジェクトの :meth:`str.rjust` メソッドは、指定された幅のフィールド内" -"に文字列が右寄せで入るように左側に空白を追加します。\n" -"同様のメソッドとして、 :meth:`str.ljust` と :meth:`str.center` があります。\n" -"これらのメソッドは何か出力を行うわけではなく、ただ新しい文字列を返します。\n" -"入力文字列が長すぎる場合、文字列を切り詰めることはせず、値をそのまま返しま" -"す。この仕様のためにカラムのレイアウトが滅茶苦茶になるかもしれませんが、嘘の" -"値が代わりに書き出されるよりはましです。\n" -"(本当に切り詰めを行いたいのなら、全てのカラムに ``x.ljust(n)[:n]`` のようにス" -"ライス表記を加えることもできます。)" +"文字列オブジェクトの :meth:`str.rjust` メソッドは、左側に空白を追加して、指定" +"した幅のフィールド内で文字列を右寄せします。\n" +"同様のメソッドとして :meth:`str.ljust` と :meth:`str.center` があります。\n" +"これらのメソッドは何も出力せず、新しい文字列を返すだけです。\n" +"入力文字列が長すぎる場合は、切り詰めずにそのまま返します。\n" +"これでは列の配置が崩れますが、値を切り詰めて誤った値を示すよりは通常ましで" +"す。\n" +"(本当に切り詰めたい場合は、``x.ljust(n)[:n]`` のようにスライス操作を追加でき" +"ます。)" #: ../../tutorial/inputoutput.rst:275 msgid "" @@ -546,12 +603,17 @@ msgid "" ">>> '3.14159265359'.zfill(5)\n" "'3.14159265359'" msgstr "" +">>> '12'.zfill(5)\n" +"'00012'\n" +">>> '-3.14'.zfill(7)\n" +"'-003.14'\n" +">>> '3.14159265359'.zfill(5)\n" +"'3.14159265359'" #: ../../tutorial/inputoutput.rst:287 msgid "Old string formatting" msgstr "古い文字列書式設定方法" -#: ../../tutorial/inputoutput.rst:289 msgid "" "The % operator (modulo) can also be used for string formatting. Given " "``format % values`` (where *format* is a string), ``%`` conversion " @@ -559,10 +621,11 @@ msgid "" "*values*. This operation is commonly known as string interpolation. For " "example::" msgstr "" -"% 演算子 (剰余) は文字列のフォーマットでも使えます。 ``format % values`` " -"(*format* は文字列) という文字列が与えられた場合、 *format* 中の ``%`` 変換指" -"定はゼロあるいは *values* の余りの要素に置換えられます。この操作は文字列補間" -"として知られています。例えば::" +"剰余を求める ``%`` 演算子は、文字列の書式化にも使えます。\n" +"``format % values`` (``format`` は文字列) と書くと、``format`` 内の ``%`` 変" +"換指定が ``values`` の 0 個以上の要素で置き換えられます。\n" +"この操作は一般に文字列補間と呼ばれます。\n" +"例えば、次のように使います。 ::" #: ../../tutorial/inputoutput.rst:296 msgid "" @@ -570,6 +633,9 @@ msgid "" ">>> print('The value of pi is approximately %5.3f.' % math.pi)\n" "The value of pi is approximately 3.142." msgstr "" +">>> import math\n" +">>> print('πの値はだいたい %5.3f です。' % math.pi)\n" +"πの値はだいたい 3.142 です。" #: ../../tutorial/inputoutput.rst:300 msgid "" @@ -592,7 +658,7 @@ msgstr "" #: ../../tutorial/inputoutput.rst:318 msgid ">>> f = open('workfile', 'w', encoding=\"utf-8\")" -msgstr "" +msgstr ">>> f = open('workfile', 'w', encoding=\"utf-8\")" #: ../../tutorial/inputoutput.rst:325 msgid "" @@ -720,6 +786,11 @@ msgid "" " File \"\", line 1, in \n" "ValueError: I/O operation on closed file." msgstr "" +">>> f.close()\n" +">>> f.read()\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"ValueError: I/O operation on closed file." #: ../../tutorial/inputoutput.rst:392 msgid "Methods of File Objects" @@ -761,6 +832,10 @@ msgid "" ">>> f.read()\n" "''" msgstr "" +">>> f.read()\n" +"'これがファイル全体です。\\n'\n" +">>> f.read()\n" +"''" #: ../../tutorial/inputoutput.rst:411 msgid "" @@ -787,6 +862,12 @@ msgid "" ">>> f.readline()\n" "''" msgstr "" +">>> f.readline()\n" +"'これがファイルの最初の行です。\\n'\n" +">>> f.readline()\n" +"'ファイルの2行目です。\\n'\n" +">>> f.readline()\n" +"''" #: ../../tutorial/inputoutput.rst:425 msgid "" @@ -805,6 +886,11 @@ msgid "" "This is the first line of the file.\n" "Second line of the file" msgstr "" +">>> for line in f:\n" +"... print(line, end='')\n" +"...\n" +"これがファイルの最初の行です。\n" +"ファイルの2行目です。" #: ../../tutorial/inputoutput.rst:434 msgid "" @@ -827,14 +913,15 @@ msgid "" ">>> f.write('This is a test\\n')\n" "15" msgstr "" +">>> f.write('This is a test\\n')\n" +"15" -#: ../../tutorial/inputoutput.rst:443 msgid "" "Other types of objects need to be converted -- either to a string (in text " "mode) or a bytes object (in binary mode) -- before writing them::" msgstr "" -"オブジェクトの他の型は、書き込む前に変換しなければなりません -- 文字列 (テキ" -"ストモード) と bytes オブジェクト (バイナリーモード) のいずれかです::" +"他の型のオブジェクトは、書き込む前に文字列 (テキストモード) または bytes オブ" +"ジェクト (バイナリモード) に変換する必要があります。 ::" #: ../../tutorial/inputoutput.rst:446 msgid "" @@ -848,15 +935,15 @@ msgstr "" ">>> f.write(s)\n" "18" -#: ../../tutorial/inputoutput.rst:451 msgid "" "``f.tell()`` returns an integer giving the file object's current position in " "the file represented as number of bytes from the beginning of the file when " "in binary mode and an opaque number when in text mode." msgstr "" -"``f.tell()`` は、ファイルオブジェクトのファイル中における現在の位置を示す整数" -"を返します。ファイル中の現在の位置は、バイナリモードではファイルの先頭からの" -"バイト数で、テキストモードでは不明瞭な値で表されます。" +"``f.tell()`` は、ファイル内でのファイルオブジェクトの現在位置を示す整数を返し" +"ます。\n" +"バイナリモードではファイルの先頭からのバイト数、テキストモードでは内部構造を" +"解釈できない数値で表されます。" #: ../../tutorial/inputoutput.rst:455 msgid "" @@ -992,6 +1079,10 @@ msgid "" ">>> json.dumps(x)\n" "'[1, \"simple\", \"list\"]'" msgstr "" +">>> import json\n" +">>> x = [1, 'simple', 'list']\n" +">>> json.dumps(x)\n" +"'[1, \"simple\", \"list\"]'" #: ../../tutorial/inputoutput.rst:522 msgid "" @@ -1005,7 +1096,7 @@ msgstr "" #: ../../tutorial/inputoutput.rst:526 msgid "json.dump(x, f)" -msgstr "" +msgstr "json.dump(x, f)" #: ../../tutorial/inputoutput.rst:528 msgid "" @@ -1017,7 +1108,7 @@ msgstr "" #: ../../tutorial/inputoutput.rst:531 msgid "x = json.load(f)" -msgstr "" +msgstr "x = json.load(f)" #: ../../tutorial/inputoutput.rst:534 msgid "" @@ -1044,7 +1135,6 @@ msgstr "" msgid ":mod:`pickle` - the pickle module" msgstr ":mod:`pickle` - pickle モジュール" -#: ../../tutorial/inputoutput.rst:545 msgid "" "Contrary to :ref:`JSON `, *pickle* is a protocol which allows the " "serialization of arbitrarily complex Python objects. As such, it is " @@ -1053,40 +1143,36 @@ msgid "" "pickle data coming from an untrusted source can execute arbitrary code, if " "the data was crafted by a skilled attacker." msgstr "" -":ref:`JSON ` とは対照的に、 *pickle* は任意の複雑な Python オブジェ" -"クトをシリアライズ可能なプロトコルです。しかし、Python に特有のプロトコルで、" -"他の言語で記述されたアプリケーションと通信するのには使えません。さらに、デ" -"フォルトでは安全でなく、信頼できない送信元から送られてきた、スキルのある攻撃" -"者によって生成された pickle データをデシリアライズすると、攻撃者により任意の" -"コードが実行されてしまいます。" +":ref:`JSON ` とは対照的に、*pickle* は、複雑な構造の Python オブ" +"ジェクトもシリアライズできるプロトコルです。\n" +"そのため Python に固有であり、他の言語で書かれたアプリケーションとの通信には" +"使えません。\n" +"また、デフォルトでは安全ではありません。\n" +"信頼できない入手元の pickle データをデシリアライズすると、熟練した攻撃者が細" +"工したデータであれば、任意のコードが実行される可能性があります。" -#: ../../tutorial/inputoutput.rst:103 msgid "formatted string literal" -msgstr "" +msgstr "フォーマット済み文字列リテラル" -#: ../../tutorial/inputoutput.rst:103 msgid "interpolated string literal" -msgstr "" +msgstr "補間文字列リテラル" #: ../../tutorial/inputoutput.rst:103 msgid "string" msgstr "string" -#: ../../tutorial/inputoutput.rst:103 msgid "formatted literal" -msgstr "" +msgstr "フォーマット済みリテラル" -#: ../../tutorial/inputoutput.rst:103 msgid "interpolated literal" -msgstr "" +msgstr "補間リテラル" #: ../../tutorial/inputoutput.rst:103 msgid "f-string" msgstr "f-string" -#: ../../tutorial/inputoutput.rst:103 msgid "fstring" -msgstr "" +msgstr "fstring" #: ../../tutorial/inputoutput.rst:308 msgid "built-in function" diff --git a/tutorial/interactive.po b/tutorial/interactive.po index 2b8a055db..9f03d8793 100644 --- a/tutorial/interactive.po +++ b/tutorial/interactive.po @@ -17,10 +17,10 @@ msgstr "" "Last-Translator: TENMYO Masakazu, 2023\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../tutorial/interactive.rst:5 @@ -65,10 +65,10 @@ msgstr "" "す。 ``string.a`` のようなドットで区切られた式については、最後の ``'.'`` まで" "の式を評価し、結果として得られたオブジェクトの属性から補完候補を示します。 :" "meth:`~object.__getattr__` メソッドを持ったオブジェクトが式に含まれている場" -"合、 :meth:`~object.__getattr__` がアプリケーション定義のコードを実行するかも" -"しれないので注意してください。デフォルトの設定ではあなたのユーザーディレクト" -"リの :file:`.python_history` という名前のファイルに履歴を保存します。 履歴は" -"次回の対話的なインタプリタのセッションで再び利用することができます。" +"合、 ``__getattr__()`` がアプリケーション定義のコードを実行するかもしれないの" +"で注意してください。デフォルトの設定ではあなたのユーザーディレクトリの :file:" +"`.python_history` という名前のファイルに履歴を保存します。 履歴は次回の対話的" +"なインタプリタのセッションで再び利用することができます。" #: ../../tutorial/interactive.rst:36 msgid "Alternatives to the Interactive Interpreter" @@ -83,8 +83,13 @@ msgid "" "might use the interpreter's symbol table. A command to check (or even " "suggest) matching parentheses, quotes, etc., would also be useful." msgstr "" +"この機能は、初期の版のインタープリタに比べれば大きな進歩です。とはいえ、まだ" +"いくつかの要望が残されています。例えば、行を継続するときに正しいインデントが" +"提示されたら快適でしょう (パーサは次の行で :data:`~token.INDENT` トークンが必" +"要かどうかを知っています)。補完機構がインタープリタのシンボルテーブルを使って" +"もよいかもしれません。括弧やクォートなどの対応をチェックする (あるいは指示す" +"る) コマンドも有用でしょう。" -#: ../../tutorial/interactive.rst:45 msgid "" "One alternative enhanced interactive interpreter that has been around for " "quite some time is IPython_, which features tab completion, object " @@ -92,8 +97,8 @@ msgid "" "customized and embedded into other applications. Another similar enhanced " "interactive environment is bpython_." msgstr "" -"より優れた対話的インタープリタの代替の一つに IPython_ があります。このイン" -"タープリタは、様々なところで使われていて、タブ補完、オブジェクト探索や先進的" -"な履歴管理といった機能を持っています。他のアプリケーションにカスタマイズされ" -"たり、組込まれこともあります。別の優れたインタラクティブ環境としては " -"bpython_ があります。" +"機能を強化した対話的インタープリタの一つに、以前からある IPython_ がありま" +"す。\n" +"タブ補完、オブジェクトの調査、高度な履歴管理などの機能を備えています。\n" +"柔軟にカスタマイズでき、他のアプリケーションに組み込むこともできます。\n" +"同様に機能を強化した対話的環境として bpython_ もあります。" diff --git a/tutorial/interpreter.po b/tutorial/interpreter.po index 0248ed32b..2e86d0461 100644 --- a/tutorial/interpreter.po +++ b/tutorial/interpreter.po @@ -18,19 +18,19 @@ msgstr "" "Last-Translator: Takanori Suzuki , 2025\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../tutorial/interpreter.rst:5 msgid "Using the Python Interpreter" -msgstr "Python インタプリタを使う" +msgstr "Python インタープリタを使う" #: ../../tutorial/interpreter.rst:11 msgid "Invoking the Interpreter" -msgstr "インタプリタを起動する" +msgstr "インタープリタを起動する" #: ../../tutorial/interpreter.rst:13 msgid "" @@ -39,14 +39,14 @@ msgid "" "available; putting :file:`/usr/local/bin` in your Unix shell's search path " "makes it possible to start it by typing the command:" msgstr "" -"Python が使用可能な環境では、インタプリタは一般的に |" +"Python が使用可能な環境では、インタープリタは一般的に |" "usr_local_bin_python_x_dot_y_literal| にインストールされています。使用してい" "る Unix シェルの検索パスに :file:`/usr/local/bin` を追加すると、次のコマンド" -"でインタプリタを開始できます:" +"をシェルに入力してインタープリタを起動できます:" #: ../../tutorial/interpreter.rst:17 msgid "python3.14" -msgstr "" +msgstr "python3.14" #: ../../tutorial/interpreter.rst:21 msgid "" @@ -55,10 +55,9 @@ msgid "" "local Python guru or system administrator. (E.g., :file:`/usr/local/python` " "is a popular alternative location.)" msgstr "" -"[#]_ どのディレクトリに Python インタプリタをインストールするかはインストール" -"時に選択できるので、インタプリタは他のディレクトリにあるかもしれません; 身近" -"な Python に詳しい人か、システム管理者に聞いてみてください。 (例えば、その他" -"の場所としては :file:`/usr/local/python` が一般的です。)" +"[#]_ インストール先ディレクトリはインストール時に選択できるため、インタープリ" +"タが別の場所にある場合もあります。身近な Python に詳しい人やシステム管理者に" +"確認してください。(例えば :file:`/usr/local/python` もよく使われる場所です。)" #: ../../tutorial/interpreter.rst:26 msgid "" @@ -68,7 +67,7 @@ msgid "" "can use the :file:`py` command. See :ref:`setting-envvars` for other ways to " "launch Python." msgstr "" -":ref:`Microsoft ストア ` からPythonのインストールを行った " +":ref:`Microsoft ストア ` から Python をインストールした " "Windows マシンでは、 |python_x_dot_y_literal| コマンドが利用できます。\n" ":ref:`py.exe ランチャ ` をインストールした場合、 :file:`py` コマン" "ドが使えます。\n" @@ -82,10 +81,10 @@ msgid "" "exit status. If that doesn't work, you can exit the interpreter by typing " "the following command: ``quit()``." msgstr "" -"ファイル終端文字 (Unixでは :kbd:`Control-D` 、DOS や Windows では :kbd:" -"`Control-Z`) を一次プロンプト (訳注: '>>>' のこと) に入力すると、インタプリタ" -"が終了ステータス 0 で終了します。もしこの操作がうまく働かないなら、コマンド: " -"``quit()`` と入力すればインタプリタを終了できます。" +"ファイル終端文字 (Unix では :kbd:`Control-D` 、Windows では :kbd:`Control-" +"Z`) を一次プロンプトに入力すると、インタープリタは終了ステータス 0 で終了しま" +"す。この操作で終了できない場合は ``quit()`` と入力してインタープリタを終了で" +"きます。" #: ../../tutorial/interpreter.rst:36 msgid "" @@ -116,10 +115,10 @@ msgid "" "interactively; when called with a file name argument or with a file as " "standard input, it reads and executes a *script* from that file." msgstr "" -"インタプリタは Unix シェルと同じように使えます。標準入力が端末に接続された状" -"態では、コマンドを対話的に読み込んで実行します。ファイル名を引数に指定する" -"か、``python3 < filename`` のように標準入力ファイルとして指定すると、インタプ" -"リタはファイルから *スクリプト* を読み込んで実行します。" +"インタープリタは Unix シェルに似た動作をします。標準入力が端末 (tty) に接続さ" +"れた状態で起動すると、コマンドを対話的に読み込んで実行します。ファイル名を引" +"数に指定するか、ファイルを標準入力として起動すると、そのファイルから *スクリ" +"プト* を読み込んで実行します。" #: ../../tutorial/interpreter.rst:51 msgid "" @@ -129,11 +128,11 @@ msgid "" "characters that are special to the shell, it is usually advised to quote " "*command* in its entirety." msgstr "" -"インタプリタを ``python -c command [arg] ...`` のように起動する方法もありま" -"す。この形式では、シェルの :option:`-c` オプションと同じように、 *command* に" -"指定した文を実行します。 Python 文には、スペースなどのシェルにとって特殊な意" -"味をもつ文字がしばしば含まれるので、 *command* 全体をクォート(訳注: ``'``)で" -"囲っておいたほうが良いでしょう。" +"インタープリタを ``python -c command [arg] ...`` のように起動する方法もありま" +"す。シェルの :option:`-c` オプションと同じように、この形式では *command* に指" +"定した文を実行します。Python の文には空白やシェルにとって特殊な意味を持つ文字" +"が含まれることが多いため、通常は *command* 全体を引用符で囲むことをお勧めしま" +"す。" #: ../../tutorial/interpreter.rst:57 msgid "" @@ -141,9 +140,9 @@ msgid "" "``python -m module [arg] ...``, which executes the source file for *module* " "as if you had spelled out its full name on the command line." msgstr "" -"Python のモジュールには、スクリプトとしても便利に使えるものがあります。 " -"``python -m module [arg] ...`` のように起動すると、 *module* のソースファイル" -"を、フルパスを指定して起動したかのように実行できます。" +"Python のモジュールにはスクリプトとしても便利に使えるものがあります。 " +"``python -m module [arg] ...`` のように起動すると、コマンドラインでフルパスを" +"指定した場合と同じように *module* のソースファイルを実行できます。" #: ../../tutorial/interpreter.rst:61 msgid "" @@ -151,9 +150,8 @@ msgid "" "script and enter interactive mode afterwards. This can be done by passing :" "option:`-i` before the script." msgstr "" -"スクリプトファイルを使用する場合、スクリプトの実行が完了した後、そのまま対話" -"モードに入れると便利なことがあります。これには :option:`-i` をスクリプト名の" -"前に追加します。" +"スクリプトの実行後にそのまま対話モードに入れると便利なことがあります。これに" +"は :option:`-i` をスクリプトファイル名の前に指定します。" #: ../../tutorial/interpreter.rst:65 msgid "All command line options are described in :ref:`using-on-general`." @@ -179,19 +177,19 @@ msgid "" "interpreter's option processing but left in ``sys.argv`` for the command or " "module to handle." msgstr "" -"スクリプト名と引数を指定してインタプリタを起動した場合、スクリプト名やスクリ" -"プト名以後に指定した引数は、文字列のリストに変換されて ``sys`` モジュールの " -"``argv`` 変数に格納されます。 ``import sys`` とすることでこのリストにアクセス" -"できます。 \n" -"``sys.argv`` には少なくとも一つ要素が入っています。スクリプト名も引数も指定し" -"なければ、 ``sys.argv[0]`` は空の文字列になります。\n" -"スクリプト名の代わりに ``'-'`` (標準入力を意味します) を指定すると、 ``sys." +"インタープリタに渡したスクリプト名とその後に続く引数は、文字列のリストに変換" +"されて ``sys`` モジュールの ``argv`` 変数に代入されます。 ``import sys`` を実" +"行するとこのリストにアクセスできます。\n" +"リストには少なくとも1つの要素があります。スクリプト名も引数も指定しない場合" +"は ``sys.argv[0]`` が空文字列になります。\n" +"スクリプト名の代わりに標準入力を意味する ``'-'`` を指定すると、 ``sys." "argv[0]`` は ``'-'`` になります。\n" -":option:`-c` *command* を使うと、 ``sys.argv[0]`` は ``'-c'`` になります。 :" -"option:`-m` *module* を使った場合、 ``sys.argv[0]`` はモジュールのフルパスに" -"なります。 Python インタープリタは、:option:`-c` *command* や :option:`-m` " -"*module* の後ろに指定したオプションは無視します。無視された引数は、``sys." -"argv`` を使って *command* や *module* から参照できます。" +":option:`-c` *command* を使うと ``sys.argv[0]`` は ``'-c'`` になります。 :" +"option:`-m` *module* を使うと ``sys.argv[0]`` は見つかったモジュールのフルパ" +"スになります。\n" +":option:`-c` *command* や :option:`-m` *module* の後に指定したオプションは、" +"Python インタープリタのオプションとしては処理されません。コマンドやモジュール" +"が処理できるように ``sys.argv`` に残されます。" #: ../../tutorial/interpreter.rst:89 msgid "Interactive Mode" @@ -206,15 +204,14 @@ msgid "" "dots (``...``). The interpreter prints a welcome message stating its version " "number and a copyright notice before printing the first prompt:" msgstr "" -"インタプリタが命令を端末 (tty) やコマンドプロンプトから読み取っている場合、イ" -"ンタプリタは *対話モード (interactive mode)* で動作しているといいます。\n" -"このモードでは、インタプリタは *一次プロンプト (primary prompt)* を表示して、" -"ユーザにコマンドを入力するよう促します。一次プロンプトは普通、三つの「大なり" -"記号」 (``>>>``) です。継続行では、インタプリタは *二次プロンプト (secondary " -"prompt)* を表示します。二次プロンプトは、デフォルトでは三つのドット (``..." -"``) です。\n" -"インタプリタは、最初のプロンプトを出す前にバージョン番号と著作権表示から始ま" -"る起動メッセージを出力します:" +"端末 (tty) からコマンドを読み込んでいるとき、インタープリタは *対話モード " +"(interactive mode)* で動作しているといいます。\n" +"このモードでは *一次プロンプト (primary prompt)* を表示して次のコマンドの入力" +"を促します。一次プロンプトは通常、3つの大なり記号 (``>>>``) です。継続行では " +"*二次プロンプト (secondary prompt)* を表示します。二次プロンプトはデフォルト" +"で3つのドット (``...``) です。\n" +"最初のプロンプトを表示する前に、インタープリタはバージョン番号と著作権表示を" +"含む起動メッセージを出力します:" #: ../../tutorial/interpreter.rst:98 msgid "" @@ -225,14 +222,20 @@ msgid "" "information.\n" ">>>" msgstr "" +"$ python3.14\n" +"Python 3.14 (default, April 4 2024, 09:25:04)\n" +"[GCC 10.2.0] on linux\n" +"Type \"help\", \"copyright\", \"credits\" or \"license\" for more " +"information.\n" +">>>" #: ../../tutorial/interpreter.rst:108 msgid "" "Continuation lines are needed when entering a multi-line construct. As an " "example, take a look at this :keyword:`if` statement::" msgstr "" -"継続行は、複数行の構文を入力するときに使います。例えば、 :keyword:`if` 文は継" -"続行を使用します ::" +"複数行にわたる構文を入力するには継続行が必要です。例として次の :keyword:`if` " +"文を見てみましょう::" #: ../../tutorial/interpreter.rst:111 msgid "" @@ -254,7 +257,7 @@ msgstr "対話モードについての詳細は :ref:`tut-interac` を参照し #: ../../tutorial/interpreter.rst:124 msgid "The Interpreter and Its Environment" -msgstr "インタプリタとその環境" +msgstr "インタープリタとその環境" #: ../../tutorial/interpreter.rst:130 msgid "Source Code Encoding" @@ -270,21 +273,21 @@ msgid "" "properly, your editor must recognize that the file is UTF-8, and it must use " "a font that supports all the characters in the file." msgstr "" -"デフォルトでは、Python のソースコードは UTF-8 でエンコードされているものとし" -"て扱われます。UTF-8 では、世界中のほとんどの言語の文字を、同時に文字列リテラ" -"ル、識別子、コメントなどに書けます。--- ただし、標準ライブラリは識別子に " -"ASCII 文字のみを利用していて、その他のポータブルなコードもその慣習に従うべき" -"です。それらの文字を正しく表示するためには、エディターはそのファイルが UTF-8 " -"である事を識別して、そのファイルに含まれている文字を全てサポートしたフォント" -"を使わなければなりません。" +"デフォルトでは Python のソースファイルは UTF-8 でエンコードされているものとし" +"て扱われます。このエンコーディングでは、文字列リテラル、識別子、コメントに世" +"界中のほとんどの言語の文字を同時に使えます。ただし、標準ライブラリの識別子に" +"使われるのは ASCII 文字だけです。移植性が必要なコードもこの慣習に従うべきで" +"す。これらの文字をすべて正しく表示するには、エディタがファイルのエンコーディ" +"ングを UTF-8 と認識し、ファイル内のすべての文字に対応したフォントを使う必要が" +"あります。" #: ../../tutorial/interpreter.rst:140 msgid "" "To declare an encoding other than the default one, a special comment line " "should be added as the *first* line of the file. The syntax is as follows::" msgstr "" -"デフォルトエンコーディング以外のエンコーディングを使用するには、ファイルの *" -"先頭* の行に特別なコメントを追加しなければなりません。書式は以下の通りです::" +"デフォルト以外のエンコーディングを宣言するには、ファイルの *先頭* 行に特別な" +"コメントを追加します。書式は次のとおりです::" #: ../../tutorial/interpreter.rst:143 msgid "# -*- coding: encoding -*-" @@ -293,16 +296,16 @@ msgstr "# -*- coding: encoding -*-" #: ../../tutorial/interpreter.rst:145 msgid "where *encoding* is one of the valid :mod:`codecs` supported by Python." msgstr "" -"*encoding* には、Python が :mod:`codecs` でサポートしている有効なエンコーディ" -"ングを指定します。" +"*encoding* には Python が :mod:`codecs` でサポートする有効なエンコーディング" +"を指定します。" #: ../../tutorial/interpreter.rst:147 msgid "" "For example, to declare that Windows-1252 encoding is to be used, the first " "line of your source code file should be::" msgstr "" -"例えば、Windows-1252 エンコーディングを使用するには、ソースコードファイルの先" -"頭行は下記のようにします::" +"例えば Windows-1252 エンコーディングを使うことを宣言するには、ソースコード" +"ファイルの先頭行を次のようにします::" #: ../../tutorial/interpreter.rst:150 msgid "# -*- coding: cp1252 -*-" @@ -314,10 +317,9 @@ msgid "" "a :ref:`UNIX \"shebang\" line `. In this case, the encoding " "declaration should be added as the second line of the file. For example::" msgstr "" -"ソースコードが :ref:`UNIX \"shebang\" 行 ` で始まる場合には、*先" -"頭行* のルールは当てはまりません。\n" -"この場合には、エンコーディングの宣言はファイルの2行目に追加します。\n" -"例えば以下のようになります::" +"ソースコードが :ref:`UNIX \"shebang\" 行 ` で始まる場合は、*先頭" +"行* に宣言するというルールの例外です。この場合はファイルの2行目にエンコーディ" +"ングの宣言を追加します。例えば次のようにします::" #: ../../tutorial/interpreter.rst:156 msgid "" @@ -337,6 +339,6 @@ msgid "" "executable named ``python``, so that it does not conflict with a " "simultaneously installed Python 2.x executable." msgstr "" -"Unixでは、Python 3.x インタープリタの実行ファイルはデフォルトでは ``python`` " -"という名前ではインストールされません。同時にインストールされた Python 2.x 実" -"行ファイルと衝突させないためです。" +"同時にインストールされた Python 2.x の実行ファイルとの衝突を避けるため、Unix " +"では Python 3.x インタープリタの実行ファイルはデフォルトで ``python`` 以外の" +"名前でインストールされます。" diff --git a/tutorial/introduction.po b/tutorial/introduction.po index fad75c75b..a0529de06 100644 --- a/tutorial/introduction.po +++ b/tutorial/introduction.po @@ -23,10 +23,10 @@ msgstr "" "Last-Translator: Takanori Suzuki , 2025\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../tutorial/introduction.rst:5 @@ -42,16 +42,11 @@ msgid "" "that a secondary prompt on a line by itself in an example means you must " "type a blank line; this is used to end a multi-line command." msgstr "" -"以下のサンプルでは、入力と出力はプロンプト (:term:`>>>` や :term:`...`) の有" -"無で区別します: 例を実際に試す場合は、プロンプトが表示されているときに、サン" -"プル中のプロンプトから後ろの内容全てを入力します。 \n" -"\n" -"プロンプトが先頭にない行は、インタプリタからの出力です。サンプル中には二次プ" -"ロンプト (:term:`...`) だけが表示されている行がありますが、これは空行を入力し" -"なければならないことを意味しています\n" -"\n" -" 空行の入力は、複数の行からなる命令の終わりを、インタプリタに教えるために使わ" -"れます。" +"以下の例ではプロンプト (:term:`>>>` と :term:`...`) の有無で入力と出力を区別" +"します。例を試すには、プロンプトが表示されているときに例のプロンプトより後ろ" +"の内容をすべて入力してください。プロンプトで始まらない行はインタープリタの出" +"力です。例の中で二次プロンプトだけがある行は、空行を入力することを意味しま" +"す。この空行で複数行にわたるコマンドの入力を終えます。" #: ../../tutorial/introduction.rst:16 msgid "" @@ -74,13 +69,12 @@ msgid "" "Since comments are to clarify code and are not interpreted by Python, they " "may be omitted when typing in examples." msgstr "" -"このマニュアルにあるサンプルの多くは、対話プロンプトで入力されるものでもコメ" -"ントを含んでいます。 Python におけるコメント文は、ハッシュ文字 ``#`` で始ま" -"り、物理行の終わりまで続きます。コメントは行の先頭にも、空白やコードの後にも" -"書くことができますが、文字列リテラルの内部に置くことはできません。文字列リテ" -"ラル中のハッシュ文字はただのハッシュ文字です。コメントはコードを明快にするた" -"めのものであり、Pythonはコメントを解釈しません。なので、サンプルコードを実際" -"に入力して試して見るときは、コメントを省いても大丈夫です。" +"対話プロンプトで入力する例も含め、このマニュアルの多くの例にはコメントが付い" +"ています。Python のコメントはハッシュ文字 ``#`` で始まり、物理行の末尾まで続" +"きます。コメントは行の先頭や空白・コードの後に書けますが、文字列リテラルの中" +"には書けません。文字列リテラル内のハッシュ文字は単なるハッシュ文字です。コメ" +"ントはコードをわかりやすくするためのもので、Python は解釈しません。そのため、" +"例を入力するときには省略できます。" #: ../../tutorial/introduction.rst:31 msgid "Some examples::" @@ -107,9 +101,8 @@ msgid "" "Let's try some simple Python commands. Start the interpreter and wait for " "the primary prompt, ``>>>``. (It shouldn't take long.)" msgstr "" -"それでは、簡単な Python コマンドをいくつか試してみましょう。インタプリタを起" -"動して、一次プロンプト、 ``>>>`` が現れるのを待ちます。 (そう長くはかからない" -"はずです)" +"簡単な Python コマンドをいくつか試してみましょう。インタープリタを起動し、一" +"次プロンプト ``>>>`` が表示されるのを待ちます。(すぐに表示されるはずです。)" #: ../../tutorial/introduction.rst:51 msgid "Numbers" @@ -145,7 +138,7 @@ msgstr "" "20\n" ">>> (50 - 5*6) / 4\n" "5.0\n" -">>> 8 / 5 # 除算は常に浮動小数点数(float)を返す\n" +">>> 8 / 5 # 除算は常に浮動小数点数を返す\n" "1.6" #: ../../tutorial/introduction.rst:68 @@ -154,9 +147,9 @@ msgid "" "ones with a fractional part (e.g. ``5.0``, ``1.6``) have type :class:" "`float`. We will see more about numeric types later in the tutorial." msgstr "" -"整数 (例えば、 ``2`` 、 ``4`` 、 ``20``) は :class:`int` 型であり、小数部を持" -"つ数 (例えば、 ``5.0`` 、 ``1.6``) は :class:`float` 型です。数値型については" -"後のチュートリアルでさらに見ていきます。" +"整数 (例えば ``2`` 、 ``4`` 、 ``20``) は :class:`int` 型で、小数部を持つ数 " +"(例えば ``5.0`` 、 ``1.6``) は :class:`float` 型です。数値型についてはこの" +"チュートリアルの後の節で詳しく説明します。" #: ../../tutorial/introduction.rst:72 msgid "" @@ -164,8 +157,9 @@ msgid "" "get an integer result you can use the ``//`` operator; to calculate the " "remainder you can use ``%``::" msgstr "" -"除算 (``/``) は常に浮動小数点数を返します。 ``//`` 演算子は :term:`整数除算 " -"` を行い、整数値を返します; 剰余は、``%`` で求めます。::" +"除算 (``/``) は常に浮動小数点数を返します。 :term:`切り捨て除算 ` で整数の結果を得るには ``//`` 演算子を使います。剰余は ``%`` で求" +"められます::" #: ../../tutorial/introduction.rst:76 msgid "" @@ -182,7 +176,7 @@ msgstr "" ">>> 17 / 3 # 除算は浮動小数点数を返す\n" "5.666666666666667\n" ">>>\n" -">>> 17 // 3 # 整数除算は小数部を破棄する\n" +">>> 17 // 3 # 切り捨て除算は小数部を切り捨てる\n" "5\n" ">>> 17 % 3 # % 演算子は剰余を返す\n" "2\n" @@ -193,7 +187,7 @@ msgstr "" msgid "" "With Python, it is possible to use the ``**`` operator to calculate powers " "[#]_::" -msgstr "Python では、冪乗を計算するのに ``**`` 演算子が使えます [#]_::" +msgstr "Python では ``**`` 演算子で冪乗を計算できます [#]_::" #: ../../tutorial/introduction.rst:88 msgid "" @@ -212,8 +206,8 @@ msgid "" "The equal sign (``=``) is used to assign a value to a variable. Afterwards, " "no result is displayed before the next interactive prompt::" msgstr "" -"等号 (``=``) は変数に値を代入するときに使います。代入を行っても、結果は出力さ" -"れず、次の入力プロンプトが表示されます。::" +"等号 (``=``) は変数に値を代入するときに使います。代入後は結果を表示せずに次の" +"対話プロンプトに進みます::" #: ../../tutorial/introduction.rst:96 msgid "" @@ -232,8 +226,8 @@ msgid "" "If a variable is not \"defined\" (assigned a value), trying to use it will " "give you an error::" msgstr "" -"変数が \"定義\" されていない (つまり値が代入されていない) 場合、その変数を使" -"おうとするとエラーが発生します::" +"「定義」されていない (値が代入されていない) 変数を使おうとするとエラーになり" +"ます::" #: ../../tutorial/introduction.rst:104 msgid "" @@ -252,8 +246,8 @@ msgid "" "There is full support for floating point; operators with mixed type operands " "convert the integer operand to floating point::" msgstr "" -"浮動小数点を完全にサポートしています。演算対象の値(オペランド)に複数の型が入" -"り混じっている場合、演算子は整数のオペランドを浮動小数点型に変換します::" +"浮動小数点数も全面的にサポートしています。整数と浮動小数点数が混在する演算で" +"は、演算子が整数のオペランドを浮動小数点数に変換します::" #: ../../tutorial/introduction.rst:112 msgid "" @@ -269,9 +263,9 @@ msgid "" "``_``. This means that when you are using Python as a desk calculator, it " "is somewhat easier to continue calculations, for example::" msgstr "" -"対話モードでは、最後に表示された結果は変数 ``_`` に代入されます。このことを利" -"用すると、Python を電卓として使うときに、計算を連続して行う作業が多少楽になり" -"ます。以下に例を示します::" +"対話モードでは最後に表示された式の値が変数 ``_`` に代入されます。この変数を使" +"うと、Python を電卓として使うときに続きの計算が少し楽になります。例えば次のよ" +"うに使います::" #: ../../tutorial/introduction.rst:119 msgid "" @@ -299,9 +293,9 @@ msgid "" "assign a value to it --- you would create an independent local variable with " "the same name masking the built-in variable with its magic behavior." msgstr "" -"この変数には読取りだけを行い、明示的な代入を行ってはいけません --- そんなこと" -"をすれば、同じ名前で別のローカル変数が生成され、元の特別な動作をする組み込み" -"変数を覆い隠してしておかしなことになってしまうかもしれません。" +"この変数は読み取り専用として扱い、明示的に値を代入しないでください。代入する" +"と同じ名前の別のローカル変数が作られ、特別な動作をする組み込み変数が隠されて" +"しまいます。" #: ../../tutorial/introduction.rst:132 msgid "" @@ -311,10 +305,10 @@ msgid "" "`, and uses the ``j`` or ``J`` suffix to indicate the " "imaginary part (e.g. ``3+5j``)." msgstr "" -":class:`int` と :class:`float` に加え、 Python は :class:`~decimal.Decimal` " -"や :class:`~fractions.Fraction` などの他の数値型もサポートしています。 :ref:`" -"複素数 ` も組み込み型としてサポートしており、 ``j`` もしくは " -"``J`` 接尾辞を使って虚部を示します (例: ``3+5j``)。" +"Python は :class:`int` と :class:`float` のほかに、 :class:`~decimal." +"Decimal` や :class:`~fractions.Fraction` などの数値型もサポートしています。 :" +"ref:`複素数 ` も組み込みでサポートしており、接尾辞 ``j`` また" +"は ``J`` で虚部を表します (例: ``3+5j``)。" #: ../../tutorial/introduction.rst:142 msgid "Text" @@ -328,12 +322,12 @@ msgid "" "\"``Yay! :)``\". They can be enclosed in single quotes (``'...'``) or double " "quotes (``\"...\"``) with the same result [#]_." msgstr "" -"Python は数値だけでなくテキスト (いわゆる「文字列」である :class:`str` 型に" -"よって表現されます) を扱うことができます。\n" -"``!`` のような文字や ``rabbit`` のような単語、 ``Paris`` のような名前、 " -"``Got your back.`` ような文もすべて文字列です。\n" -"文字列はシングルクォート (``'...'``) またはダブルクォート (``\"...\"``) で囲" -"み、どちらを使っても違いはありません [#]_ 。" +"Python は数値だけでなくテキストも扱えます。テキストは :class:`str` 型で表さ" +"れ、一般に「文字列」と呼ばれます。 \"``!``\" のような文字、 \"``rabbit``\" の" +"ような単語、 \"``Paris``\" のような名前、 \"``Got your back.``\" や " +"\"``Yay! :)``\" のような文や表現などです。文字列はシングルクォート " +"(``'...'``) またはダブルクォート (``\"...\"``) で囲み、どちらを使っても同じ結" +"果になります [#]_ 。" #: ../../tutorial/introduction.rst:150 msgid "" @@ -344,16 +338,20 @@ msgid "" ">>> '1975' # digits and numerals enclosed in quotes are also strings\n" "'1975'" msgstr "" +">>> 'spam eggs' # シングルクォート\n" +"'spam eggs'\n" +">>> \"Paris rabbit got your back :)! Yay!\" # ダブルクォート\n" +"'Paris rabbit got your back :)! Yay!'\n" +">>> '1975' # クォートに囲まれた数字も文字列\n" +"'1975'" #: ../../tutorial/introduction.rst:159 msgid "" "To quote a quote, we need to \"escape\" it, by preceding it with ``\\``. " "Alternatively, we can use the other type of quotation marks::" msgstr "" -"クォートの中でクォートを使いたい場合、 ``\\`` を前に付け加えることで「エス" -"ケープ」をする必要があります。\n" -"もしくは、文字列で使用したいクォートとは別の方のクォートで囲むこともできま" -"す。" +"文字列を囲むクォートと同じクォートを文字列の中に書くには、直前に ``\\`` を付" +"けて「エスケープ」します。別の種類のクォートで文字列を囲む方法もあります::" #: ../../tutorial/introduction.rst:162 msgid "" @@ -386,10 +384,9 @@ msgid "" "omitting the enclosing quotes and by printing escaped and special " "characters::" msgstr "" -"Python シェルでは、文字列を定義するときと文字列が出力されるときでは見え方が異" -"なることがあります。\n" -":func:`print` 関数を使うと、両端のクォートがなくなり、エスケープされた文字や" -"特殊文字が表示されるため、より読みやすい形で出力できます。" +"Python シェルでは文字列を定義するときと出力するときで見た目が異なることがあり" +"ます。 :func:`print` 関数は文字列を囲むクォートを省き、エスケープされた文字や" +"特殊文字を表示して読みやすく出力します::" #: ../../tutorial/introduction.rst:177 msgid "" @@ -414,8 +411,8 @@ msgid "" "characters, you can use *raw strings* by adding an ``r`` before the first " "quote::" msgstr "" -"``\\`` に続く文字を特殊文字として解釈されたくない場合は、最初の引用符の前に " -"``r`` を付けた *raw strings* が使えます::" +"``\\`` に続く文字を特殊文字として解釈させたくない場合は、最初のクォートの前" +"に ``r`` を付けて *raw string* (生の文字列) にできます::" #: ../../tutorial/introduction.rst:188 msgid "" @@ -437,9 +434,9 @@ msgid "" "odd number of ``\\`` characters; see :ref:`the FAQ entry ` for more information and workarounds." msgstr "" -"raw文字列には微妙な面があります: raw文字列は奇数個の``\\`` 文字では終了できま" -"せん。詳細と解決方法については :ref:`the FAQ entry ` を参照してください。 " +"raw string には注意点が1つあります。末尾に奇数個の ``\\`` を連続して置くこと" +"はできません。詳しい説明と回避方法は :ref:`FAQ の該当項目 ` を参照してください。" #: ../../tutorial/introduction.rst:199 msgid "" @@ -449,10 +446,10 @@ msgid "" "adding a ``\\`` at the end of the line. In the following example, the " "initial newline is not included::" msgstr "" -"文字列リテラルは複数行にまたがって書けます。1 つの方法は三連引用符 " +"文字列リテラルは複数行にまたがって書けます。1つの方法は三重引用符 " "(``\"\"\"...\"\"\"`` や ``'''...'''``) を使うことです。改行文字は自動的に文字" -"列に含まれますが、行末に ``\\`` を付けることで含めないようにすることもできま" -"す。次の例では最初の改行は含まれません::" +"列に含まれますが、行末に ``\\`` を付けると改行文字を含めずに済みます。次の例" +"では最初の改行は含まれません::" #: ../../tutorial/introduction.rst:205 msgid "" @@ -482,9 +479,7 @@ msgstr "" msgid "" "Strings can be concatenated (glued together) with the ``+`` operator, and " "repeated with ``*``::" -msgstr "" -"文字列は ``+`` 演算子で連結させる (くっつけて一つにする) ことができ、``*`` 演" -"算子で反復させることができます::" +msgstr "文字列は ``+`` 演算子で連結し、 ``*`` 演算子で繰り返せます::" #: ../../tutorial/introduction.rst:219 msgid "" @@ -501,8 +496,8 @@ msgid "" "Two or more *string literals* (i.e. the ones enclosed between quotes) next " "to each other are automatically concatenated. ::" msgstr "" -"連続して並んでいる複数の *文字列リテラル* (つまり、引用符に囲われた文字列) " -"は、自動的に連結されます。 ::" +"2つ以上の *文字列リテラル* (クォートで囲んだもの) を隣り合わせに書くと、自動" +"的に連結されます::" #: ../../tutorial/introduction.rst:226 msgid "" @@ -515,7 +510,7 @@ msgstr "" #: ../../tutorial/introduction.rst:229 msgid "" "This feature is particularly useful when you want to break long strings::" -msgstr "この機能は、長い文字列を改行したいときにとても役に立ちます::" +msgstr "この機能は長い文字列を複数行に分けて書きたいときに特に便利です::" #: ../../tutorial/introduction.rst:231 msgid "" @@ -529,10 +524,11 @@ msgstr "" ">>> text\n" "'複数の文字列を丸括弧で囲むと連結される。'" -#: ../../tutorial/introduction.rst:236 msgid "" "This only works with two literals though, not with variables or expressions::" -msgstr "これは 2 つのリテラルどうしに対してのみ働き、変数や式には働きません::" +msgstr "" +"ただし、この方法で連結できるのはリテラルどうしだけです。\n" +"変数や式には使えません。 ::" #: ../../tutorial/introduction.rst:238 msgid "" @@ -563,7 +559,7 @@ msgstr "" #: ../../tutorial/introduction.rst:250 msgid "" "If you want to concatenate variables or a variable and a literal, use ``+``::" -msgstr "変数どうしや変数とリテラルを連結したい場合は、``+`` を使ってください::" +msgstr "変数どうしや変数とリテラルを連結するには ``+`` を使います::" #: ../../tutorial/introduction.rst:252 msgid "" @@ -579,9 +575,8 @@ msgid "" "index 0. There is no separate character type; a character is simply a string " "of size one::" msgstr "" -"文字列は *インデックス* (添字) を指定して文字を取得できます。最初の文字のイン" -"デックスは 0 になります。文字を表す、専用のデータ型は用意されていません; 文字" -"とは、単に長さが 1 の文字列です::" +"文字列では *インデックス* (添字) を指定して文字を取得できます。最初の文字のイ" +"ンデックスは 0 です。文字専用の型はなく、1文字も長さ1の文字列として扱います::" #: ../../tutorial/introduction.rst:259 msgid "" @@ -600,8 +595,7 @@ msgstr "" #: ../../tutorial/introduction.rst:265 msgid "" "Indices may also be negative numbers, to start counting from the right::" -msgstr "" -"インデックスには、負の値も指定できまます。この場合、右から数えていきます::" +msgstr "インデックスに負の数を指定すると、右から数えて文字を取得できます::" #: ../../tutorial/introduction.rst:267 msgid "" @@ -629,9 +623,8 @@ msgid "" "used to obtain individual characters, *slicing* allows you to obtain a " "substring::" msgstr "" -"インデクス表記に加え、 *スライス* もサポートされています。インデクス表記は" -"個々の文字を取得するのに使いますが、 *スライス* を使うと部分文字列を取得する" -"ことができます::" +"インデックス指定に加えて *スライス* も使えます。インデックス指定では個々の文" +"字を取得し、 *スライス* では部分文字列を取得できます::" #: ../../tutorial/introduction.rst:279 msgid "" @@ -650,9 +643,8 @@ msgid "" "Slice indices have useful defaults; an omitted first index defaults to zero, " "an omitted second index defaults to the size of the string being sliced. ::" msgstr "" -"スライスのインデックスには、便利なデフォルト値があります; 最初のインデックス" -"を省略すると、0 と見なされます。二番め のインデックスを省略すると、スライスす" -"る文字列のサイズとみなされます。 ::" +"スライスのインデックスには便利なデフォルト値があります。最初のインデックスを" +"省略すると 0 になり、2つ目を省略すると対象の文字列の長さになります::" #: ../../tutorial/introduction.rst:287 msgid "" @@ -675,8 +667,8 @@ msgid "" "Note how the start is always included, and the end always excluded. This " "makes sure that ``s[:i] + s[i:]`` is always equal to ``s``::" msgstr "" -"開始値は常に含まれ、終了値は常に含まれないことに注意してください。なので " -"``s[:i] + s[i:]`` は常に ``s`` と等しくなります::" +"開始位置の文字は常に含まれ、終了位置の文字は常に含まれません。このため ``s[:" +"i] + s[i:]`` は常に ``s`` と等しくなります::" #: ../../tutorial/introduction.rst:297 msgid "" @@ -697,10 +689,9 @@ msgid "" "Then the right edge of the last character of a string of *n* characters has " "index *n*, for example::" msgstr "" -"スライスの使い方をおぼえる良い方法は、インデックスが文字と文字の *あいだ " -"(between)* を指しており、最初の文字の左端が 0 になっていると考えることです。" -"そうすると、 *n* 文字からなる文字列中の最後の文字の右端はインデックス *n* と" -"なります。例えばこうです::" +"スライスの仕組みを覚えるには、インデックスが文字と文字の *間* を指し、最初の" +"文字の左端を 0 と考えるとよいでしょう。すると、長さ *n* の文字列では最後の文" +"字の右端のインデックスが *n* になります。例えば次のようになります::" #: ../../tutorial/introduction.rst:307 msgid "" @@ -723,9 +714,9 @@ msgid "" "from *i* to *j* consists of all characters between the edges labeled *i* and " "*j*, respectively." msgstr "" -"1行目の数字は文字列の 0 から 6 までのインデックスの位置を示しています; 2行目" -"は対応する負のインデックスを示しています。*i* から *j* までのスライスは、それ" -"ぞれ *i* と付いた境界から *j* と付いた境界までの全ての文字から成っています。" +"数字の1行目は文字列内のインデックス 0 から 6 の位置を示し、2行目は対応する負" +"のインデックスを示しています。*i* から *j* までのスライスには、*i* と *j* の" +"印を付けた境界の間にあるすべての文字が含まれます。" #: ../../tutorial/introduction.rst:318 msgid "" @@ -733,9 +724,8 @@ msgid "" "indices, if both are within bounds. For example, the length of " "``word[1:3]`` is 2." msgstr "" -"正のインデックスの場合、スライスされたシーケンスの長さは、スライスの両端のイ" -"ンデックスが範囲内にあるかぎり、インデックス間の差になります。例えば、 " -"``word[1:3]`` の長さは 2 になります。" +"両端のインデックスが非負で文字列の範囲内にある場合、スライスの長さは2つのイン" +"デックスの差になります。例えば ``word[1:3]`` の長さは 2 です。" #: ../../tutorial/introduction.rst:322 msgid "Attempting to use an index that is too large will result in an error::" @@ -748,7 +738,7 @@ msgid "" " File \"\", line 1, in \n" "IndexError: string index out of range" msgstr "" -">>> word[42] # the word only has 6 characters\n" +">>> word[42] # 文字列は6文字しかない\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" "IndexError: string index out of range" @@ -757,9 +747,7 @@ msgstr "" msgid "" "However, out of range slice indexes are handled gracefully when used for " "slicing::" -msgstr "" -"しかし、スライスで範囲外のインデックスを使ったときは、上手く対応して扱ってく" -"れます::" +msgstr "一方、スライスではインデックスが範囲外でもエラーになりません::" #: ../../tutorial/introduction.rst:332 msgid "" @@ -778,8 +766,8 @@ msgid "" "Python strings cannot be changed --- they are :term:`immutable`. Therefore, " "assigning to an indexed position in the string results in an error::" msgstr "" -"Python の文字列は変更できません -- つまり :term:`不変 ` です。従っ" -"て、文字列のインデックスで指定したある場所に代入を行うとエラーが発生します::" +"Python の文字列は :term:`不変 ` で、内容を変更できません。そのた" +"め、文字列のインデックスで指定した位置に代入するとエラーになります::" #: ../../tutorial/introduction.rst:340 msgid "" @@ -803,7 +791,7 @@ msgstr "" #: ../../tutorial/introduction.rst:349 msgid "If you need a different string, you should create a new one::" -msgstr "元の文字列と別の文字列が必要な場合は、新しく文字列を作成してください::" +msgstr "別の文字列が必要な場合は新しく作成します::" #: ../../tutorial/introduction.rst:351 msgid "" @@ -819,7 +807,7 @@ msgstr "" #: ../../tutorial/introduction.rst:356 msgid "The built-in function :func:`len` returns the length of a string::" -msgstr "組込み関数 :func:`len` は文字列の長さ (length) を返します::" +msgstr "組み込み関数 :func:`len` は文字列の長さを返します::" #: ../../tutorial/introduction.rst:358 msgid "" @@ -840,8 +828,7 @@ msgid "" "Strings are examples of *sequence types*, and support the common operations " "supported by such types." msgstr "" -"文字列は代表的な *シーケンス型* で、シーケンス型でサポートされている共通の操" -"作をサポートしています。" +"文字列は *シーケンス型* の一種で、シーケンス型に共通する操作を使えます。" #: ../../tutorial/introduction.rst:369 msgid ":ref:`string-methods`" @@ -851,9 +838,7 @@ msgstr ":ref:`string-methods`" msgid "" "Strings support a large number of methods for basic transformations and " "searching." -msgstr "" -"文字列は、基本的な変換や検索を行うための数多くのメソッドをサポートしていま" -"す。" +msgstr "文字列には基本的な変換や検索を行うためのメソッドが数多くあります。" #: ../../tutorial/introduction.rst:373 msgid ":ref:`f-strings`" @@ -870,7 +855,7 @@ msgstr ":ref:`formatstrings`" #: ../../tutorial/introduction.rst:377 msgid "Information about string formatting with :meth:`str.format`." msgstr "" -":meth:`str.format` を使った文字列のフォーマットについての情報があります。" +":meth:`str.format` を使った文字列のフォーマットについて説明しています。" #: ../../tutorial/introduction.rst:379 msgid ":ref:`old-string-formatting`" @@ -881,8 +866,8 @@ msgid "" "The old formatting operations invoked when strings are the left operand of " "the ``%`` operator are described in more detail here." msgstr "" -"文字列が ``%`` 演算子の左オペランドである場合に呼び出される古いフォーマット操" -"作について、詳しく記述されています。" +"文字列を ``%`` 演算子の左オペランドに指定して行う従来のフォーマット操作につい" +"て、詳しく説明しています。" #: ../../tutorial/introduction.rst:387 msgid "Lists" @@ -952,7 +937,7 @@ msgid "" "type, i.e. it is possible to change their content::" msgstr "" ":term:`不変 ` な文字列とは違って、リストは :term:`可変 ` " -"型ですので、要素を入れ替えられます::" +"型ですので、内容を変更できます::" #: ../../tutorial/introduction.rst:416 msgid "" @@ -999,7 +984,8 @@ msgid "" msgstr "" "単純な代入ではPythonは決してデータをコピーしません。リストを変数に代入する" "と、その変数は *既存のリスト* を参照します。ある変数を通してリストに任意の変" -"更を行うと、そのリストを参照したすべての他の変数を通して確認できます。::" +"更を行うと、同じリストを参照している他のすべての変数からもその変更を確認でき" +"ます。::" #: ../../tutorial/introduction.rst:436 msgid "" @@ -1141,7 +1127,7 @@ msgid "" "follows::" msgstr "" "もちろん、2 たす 2 よりももっと複雑な課題にも Python を使えます。\n" -"例えば、`Fibonacci series `_ の先頭の部分列は次のように書けます::" #: ../../tutorial/introduction.rst:503 @@ -1204,14 +1190,14 @@ msgid "" "than), ``>`` (greater than), ``==`` (equal to), ``<=`` (less than or equal " "to), ``>=`` (greater than or equal to) and ``!=`` (not equal to)." msgstr "" -":keyword:`while` は、条件 (ここでは `` a < 10``) が真である限り実行を繰り返" -"し (ループし) ます。Python では、C 言語と同様に、ゼロでない整数値は真となり、" -"ゼロは偽です。条件式には、文字列値やリスト値なども使えます。それ以外のシーケ" -"ンスも、条件式として使用できます。長さが 1 以上のシーケンスは真で、空のシーケ" -"ンスは偽になります。サンプルで使われている条件テストはシンプルな比較です。標" -"準的な比較演算子は C 言語と同様です: すなわち、 ``<`` (より小さい)、 ``>`` " -"(より大きい)、 ``==`` (等しい)、 ``<=`` (より小さいか等しい)、 ``>=`` (より大" -"きいか等しい)、および ``!=`` (等しくない)、です。" +":keyword:`while` は、条件 (ここでは ``a < 10``) が真である限り実行を繰り返し " +"(ループし) ます。Python では、C 言語と同様に、ゼロでない整数値は真となり、ゼ" +"ロは偽です。条件式には、文字列値やリスト値なども使えます。それ以外のシーケン" +"スも、条件式として使用できます。長さが 1 以上のシーケンスは真で、空のシーケン" +"スは偽になります。サンプルで使われている条件テストはシンプルな比較です。標準" +"的な比較演算子は C 言語と同様です: すなわち、 ``<`` (より小さい)、 ``>`` (よ" +"り大きい)、 ``==`` (等しい)、 ``<=`` (より小さいか等しい)、 ``>=`` (より大き" +"いか等しい)、および ``!=`` (等しくない)、です。" #: ../../tutorial/introduction.rst:535 msgid "" @@ -1225,14 +1211,14 @@ msgid "" "that each line within a basic block must be indented by the same amount." msgstr "" "ループの *本体 (body)* は、 *インデント (indent, 字下げ)* されています: イン" -"デントは Python において、実行文をグループにまとめる方法です。対話的プロンプ" -"トでは、インデントされた各行を入力するにはタブや (複数個の) スペースを使わな" -"ければなりません。実用的には、もっと複雑な処理を入力する場合はテキストエディ" -"タを使うことになるでしょう。 ほとんどのテキストエディタは、自動インデント機能" -"を持っています。複合文を対話的に入力するときには、入力完了のしるしとして最後" -"に空行を入力します。これは、パーザはどれが最後の行を入力なのか、判断できない" -"ためです。基本的なブロック内では、全ての行は同じだけインデントされていなけれ" -"ばならないので注意してください。" +"デントは Python において、文をグループにまとめる方法です。対話的プロンプトで" +"は、インデントされた各行を入力するにはタブや (複数個の) スペースを使わなけれ" +"ばなりません。実用的には、もっと複雑な処理を入力する場合はテキストエディタを" +"使うことになるでしょう。 ほとんどのテキストエディタは、自動インデント機能を" +"持っています。複合文を対話的に入力するときには、入力完了のしるしとして最後に" +"空行を入力します。パーザには最後の行の入力が終わったかどうかを判断できないた" +"めです。基本的なブロック内では、全ての行は同じだけインデントされていなければ" +"ならないので注意してください。" #: ../../tutorial/introduction.rst:544 msgid "" @@ -1245,8 +1231,8 @@ msgid "" msgstr "" ":func:`print` 関数は、与えられた引数の値を書き出します。これは (前に電卓の例" "でやったような) 単に出力したい式を書くのとは、複数の引数や浮動小数点量や文字" -"列に対する扱い方が違います。:func:`print` 関数では、文字列は引用符無しで出力" -"され、要素の間に空白が挿入されて、このように出力の書式が整えられます::" +"列に対する扱い方が違います。 ``print()`` 関数では、文字列は引用符無しで出力さ" +"れ、要素の間に空白が挿入されて、このように出力の書式が整えられます::" #: ../../tutorial/introduction.rst:551 msgid "" diff --git a/tutorial/modules.po b/tutorial/modules.po index a942a1982..76e9598fa 100644 --- a/tutorial/modules.po +++ b/tutorial/modules.po @@ -20,17 +20,16 @@ msgstr "" "Last-Translator: Takanori Suzuki , 2025\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../tutorial/modules.rst:5 msgid "Modules" msgstr "モジュール" -#: ../../tutorial/modules.rst:7 msgid "" "If you quit from the Python interpreter and enter it again, the definitions " "you have made (functions and variables) are lost. Therefore, if you want to " @@ -42,13 +41,15 @@ msgid "" "programs without copying its definition into each program." msgstr "" "Python インタプリタを終了させ、再び起動すると、これまでに行ってきた定義 (関数" -"や変数) は失われています。ですから、より長いプログラムを書きたいなら、テキス" -"トエディタを使ってインタプリタへの入力を用意しておき、手作業の代わりにファイ" -"ルを入力に使って動作させるとよいでしょう。この作業を *スクリプト (script)* の" -"作成と言います。プログラムが長くなるにつれ、メンテナンスを楽にするために、ス" -"クリプトをいくつかのファイルに分割したくなるかもしれません。また、いくつかの" -"プログラムで書いてきた便利な関数について、その定義をコピーすることなく個々の" -"プログラムで使いたいと思うかもしれません。" +"や変数) は失われています。\n" +"ですから、より長いプログラムを書きたいなら、\n" +"テキストエディタを使ってインタプリタへの入力を用意しておき、手作業の代わりに" +"ファイルを入力に使って動作させるとよいでしょう。\n" +"この作業を *スクリプト (script)* の作成と言います。\n" +"プログラムが長くなるにつれ、メンテナンスを楽にするために、スクリプトをいくつ" +"かのファイルに分割したくなるかもしれません。\n" +"また、自分で書いた便利な関数を、定義を各プログラムにコピーせずに複数のプログ" +"ラムで使いたいと思うかもしれません。" #: ../../tutorial/modules.rst:16 msgid "" @@ -279,13 +280,12 @@ msgstr "" "からです。しかし、対話セッションでキータイプの量を減らすために使うのは構わな" "いでしょう。" -#: ../../tutorial/modules.rst:116 msgid "" "If the module name is followed by :keyword:`!as`, then the name following :" "keyword:`!as` is bound directly to the imported module." msgstr "" -"モジュール名の後に :keyword:`!as` が続いていた場合は、 :keyword:`!as` の後ろ" -"の名前を直接、インポートされたモジュールが束縛します。" +"モジュール名の後に :keyword:`!as` を続けると、\n" +":keyword:`!as` の後ろの名前がインポートしたモジュールに直接束縛されます。" #: ../../tutorial/modules.rst:121 msgid "" @@ -349,15 +349,15 @@ msgstr "Python モジュールを ::" msgid "python fibo.py " msgstr "python fibo.py " -#: ../../tutorial/modules.rst:153 msgid "" "the code in the module will be executed, just as if you imported it, but " "with the ``__name__`` set to ``\"__main__\"``. That means that by adding " "this code at the end of your module::" msgstr "" -"と実行すると、``__name__`` に ``__main__`` が設定されている点を除いて import " -"したときと同じようにモジュール内のコードが実行されます。つまりモジュールの末" -"尾に::" +"と実行すると、モジュール内のコードは import したときと同じように実行されます" +"が、\n" +"``__name__`` には文字列 ``\"__main__\"`` が設定されます。\n" +"この違いを利用するために、モジュールの末尾に次のコードを追加します。 ::" #: ../../tutorial/modules.rst:157 msgid "" @@ -400,20 +400,20 @@ msgstr "" ">>> import fibo\n" ">>>" -#: ../../tutorial/modules.rst:175 msgid "" "This is often used either to provide a convenient user interface to a " "module, or for testing purposes (running the module as a script executes a " "test suite)." msgstr "" -"この方法はモジュールに便利なユーザインターフェースを提供したり、テストのため" -"に (スクリプトをモジュールとして起動しテストスイートを実行して) 使われます。" +"この方法はモジュールに便利なユーザインターフェースを提供したり、テストを行っ" +"たりするためによく使われます。\n" +"後者では、モジュールをスクリプトとして実行するとテストスイートが実行されま" +"す。" #: ../../tutorial/modules.rst:182 msgid "The Module Search Path" msgstr "モジュール検索パス" -#: ../../tutorial/modules.rst:186 msgid "" "When a module named :mod:`!spam` is imported, the interpreter first searches " "for a built-in module with that name. These module names are listed in :data:" @@ -423,9 +423,11 @@ msgid "" msgstr "" ":mod:`!spam` という名前のモジュールをインポートするとき、インタープリタはまず" "その名前の組み込みモジュールを探します。モジュール名の一覧は :data:`sys." -"builtin_module_names` にあります。見つからなかった場合は、 :file:`spam.py` と" -"いう名前のファイルを :data:`sys.path` にあるディレクトリのリストから探しま" -"す。 :data:`sys.path` は以下の場所に初期化されます:" +"builtin_module_names` にあります。\n" +"見つからなかった場合は、\n" +":file:`spam.py` という名前のファイルを :data:`sys.path` にあるディレクトリの" +"リストから探します。\n" +":data:`sys.path` は次の場所を基に初期化されます。" #: ../../tutorial/modules.rst:192 msgid "" @@ -557,15 +559,14 @@ msgstr "" "を持ち、通常のコンパイル済みモジュールよりサイズが小さくなります。将来のリ" "リースでは最適化の影響が変わる可能性があります。" -#: ../../tutorial/modules.rst:251 msgid "" "A program doesn't run any faster when it is read from a ``.pyc`` file than " "when it is read from a ``.py`` file; the only thing that's faster about ``." "pyc`` files is the speed with which they are loaded." msgstr "" -"``.pyc`` ファイルや ``.pyo`` ファイルから読み出されたとしても、プログラムは " -"``.py`` ファイルから読み出されたときより何ら高速に動作するわけではありませ" -"ん。``.pyc`` ファイルで高速化されるのは、読み込みにかかる時間だけです。" +"``.pyc`` ファイルから読み出されたとしても、プログラムは ``.py`` ファイルから" +"読み出されたときより何ら高速に動作するわけではありません。\n" +"``.pyc`` ファイルで高速化されるのは、読み込みにかかる時間だけです。" #: ../../tutorial/modules.rst:255 msgid "" @@ -587,7 +588,6 @@ msgstr "" msgid "Standard Modules" msgstr "標準モジュール" -#: ../../tutorial/modules.rst:269 msgid "" "Python comes with a library of standard modules, described in a separate " "document, the Python Library Reference (\"Library Reference\" hereafter). " @@ -601,15 +601,20 @@ msgid "" "into every Python interpreter. The variables ``sys.ps1`` and ``sys.ps2`` " "define the strings used as primary and secondary prompts::" msgstr "" -"Python は標準モジュールライブラリを同梱していて、別の Python ライブラリリファ" -"レンスというドキュメントで解説しています。幾つかのモジュールは言語のコアには" -"アクセスしないものの、効率や、システムコールなどOSの機能を利用するために、イ" -"ンタープリター内部にビルトインされています。そういったモジュールセットはまた" -"プラットフォームに依存した構成オプションです。例えば、 :mod:`winreg` モジュー" -"ルは Windows システムでのみ提供されています。 1つ注目に値するモジュールとし" -"て、 :mod:`sys` モジュールは、全ての Python インタープリターにビルトインされ" -"ています。 ``sys.ps1`` と ``sys.ps2`` という変数は一次プロンプトと二次プロン" -"プトに表示する文字列を定義しています::" +"Python は標準モジュールのライブラリを同梱していて、別のドキュメント「Python " +"ライブラリリファレンス」(以下「ライブラリリファレンス」) で解説しています。\n" +"一部のモジュールはインタープリターに組み込まれていて、言語の中核には含まれな" +"い操作を提供します。\n" +"これらが組み込まれているのは、効率を高めたり、\n" +"システムコールなどのオペレーティングシステムの基本機能を利用できるようにした" +"りするためです。\n" +"どのモジュールを組み込むかは構成オプションで指定し、動作するプラットフォーム" +"にも依存します。\n" +"例えば、:mod:`winreg` モジュールは Windows システムでのみ提供されています。\n" +"特に注目したいのが、すべての Python インタープリターに組み込まれている :mod:" +"`sys` モジュールです。\n" +"``sys.ps1`` と ``sys.ps2`` という変数は、一次プロンプトと二次プロンプトに使わ" +"れる文字列を定義しています。 ::" #: ../../tutorial/modules.rst:281 msgid "" @@ -672,7 +677,7 @@ msgid "" "defines. It returns a sorted list of strings::" msgstr "" "組込み関数 :func:`dir` は、あるモジュールがどんな名前を定義しているか調べるた" -"めに使われます。 :func:`dir` はソートされた文字列のリストを返します::" +"めに使われます。 ``dir()`` はソートされた文字列のリストを返します::" #: ../../tutorial/modules.rst:312 msgid "" @@ -768,14 +773,14 @@ msgstr "" "変数、モジュール、関数、その他の、すべての種類の名前をリストすることに注意し" "てください。" -#: ../../tutorial/modules.rst:350 msgid "" ":func:`dir` does not list the names of built-in functions and variables. If " "you want a list of those, they are defined in the standard module :mod:" "`builtins`::" msgstr "" -":func:`dir` は、組込みの関数や変数の名前はリストしません。これらの名前からな" -"るリストが必要なら、標準モジュール :mod:`builtins` で定義されています::" +":func:`dir` は組込みの関数や変数の名前を列挙しません。\n" +"その名前の一覧が必要な場合は、定義元の標準モジュール :mod:`builtins` を調べま" +"す。 ::" #: ../../tutorial/modules.rst:354 msgid "" @@ -867,7 +872,6 @@ msgstr "" "Pillow のように複数モジュールからなるパッケージの著者が、互いのモジュール名に" "ついて心配しなくても済むようになります。" -#: ../../tutorial/modules.rst:399 msgid "" "Suppose you want to design a collection of modules (a \"package\") for the " "uniform handling of sound files and sound data. There are many different " @@ -881,15 +885,17 @@ msgid "" "operations. Here's a possible structure for your package (expressed in " "terms of a hierarchical filesystem):" msgstr "" -"音声ファイルや音声データを一様に扱うためのモジュールのコレクション (\"パッ" -"ケージ\") を設計したいと仮定しましょう。 音声ファイルには多くの異なった形式が" -"ある (通常は拡張子、 例えば :file:`.wav`, :file:`.aiff`, :file:`.au` などで認" -"識されます) ので、増え続ける様々なファイル形式を相互変換するモジュールを、 作" -"成したりメンテナンスしたりする必要があるかもしれません。 また、 音声データに" -"対して実行したい様々な独自の操作 (ミキシング、 エコーの追加、 イコライザ関数" -"の適用、 人工的なステレオ効果の作成など) があるかもしれません。 そうなると、 " -"こうした操作を実行するモジュールを果てしなく書くことになるでしょう。 以下に " -"(階層的なファイルシステムで表現した) パッケージの構造案を示します:" +"音声ファイルや音声データを統一的に扱うためのモジュールの集まり (「パッケー" +"ジ」) を設計したいとします。\n" +"音声ファイルには多くの形式があり、通常は :file:`.wav`、:file:`.aiff`、:file:" +"`.au` などの拡張子で見分けます。\n" +"そのため、形式を相互変換するモジュールを作成・保守し、その数を増やしていく必" +"要があるかもしれません。\n" +"また、ミキシング、エコーの追加、イコライザ機能の適用、人工的なステレオ効果の" +"作成など、音声データに行いたい操作もさまざまです。\n" +"こうした操作を実行するためのモジュールも、次々に書くことになるでしょう。\n" +"パッケージの構造は、例えば次のようにできます (階層的なファイルシステムで表し" +"ています):" #: ../../tutorial/modules.rst:410 msgid "" @@ -941,13 +947,13 @@ msgstr "" " karaoke.py\n" " ..." -#: ../../tutorial/modules.rst:436 msgid "" "When importing the package, Python searches through the directories on ``sys." "path`` looking for the package subdirectory." msgstr "" -"パッケージを import する際、 Python は ``sys.path`` 上のディレクトリを検索し" -"て、トップレベルのパッケージの入ったサブディレクトリを探します。" +"パッケージを import する際、Python は ``sys.path`` 上のディレクトリを検索" +"し、\n" +"パッケージに対応するサブディレクトリを探します。" #: ../../tutorial/modules.rst:439 msgid "" @@ -1147,6 +1153,15 @@ msgid "" "def reverse(msg: str): # <-- this name shadows the 'reverse.py' submodule\n" " return msg[::-1] # in the case of a 'from sound.effects import *'" msgstr "" +"__all__ = [\n" +" \"echo\", # 'echo.py' ファイルを参照する\n" +" \"surround\", # 'surround.py' ファイルを参照する\n" +" \"reverse\", # !!! 'reverse' 関数を参照する !!!\n" +"]\n" +"\n" +"def reverse(msg: str): # <-- この名前は 'from sound.effects import *' を実行" +"したときに\n" +" return msg[::-1] # サブモジュールの 'reverse.py' を隠してしまう" #: ../../tutorial/modules.rst:532 msgid "" @@ -1202,23 +1217,21 @@ msgstr "" "のみを公開 (export) するように設計されてはいますが、それでもやはり製品のコー" "ドでは良いことではないと考えます。" -#: ../../tutorial/modules.rst:554 msgid "" "Remember, there is nothing wrong with using ``from package import " "specific_submodule``! In fact, this is the recommended notation unless the " "importing module needs to use submodules with the same name from different " "packages." msgstr "" -"``from package import specific_submodule`` を使っても何も問題はないことに留意" -"してください!実際この表記法は、import を行うモジュールが他のパッケージと同じ" -"名前を持つサブモジュールを使わなければならない場合を除いて推奨される方式で" -"す。" +"``from package import specific_submodule`` を使っても問題はありません。\n" +"実際には、import を行うモジュールで異なるパッケージの同名のサブモジュールを使" +"う必要がある場合を除き、\n" +"この書き方が推奨されます。" #: ../../tutorial/modules.rst:563 msgid "Intra-package References" msgstr "パッケージ内参照" -#: ../../tutorial/modules.rst:565 msgid "" "When packages are structured into subpackages (as with the :mod:`!sound` " "package in the example), you can use absolute imports to refer to submodules " @@ -1227,10 +1240,12 @@ msgid "" "package, it can use ``from sound.effects import echo``." msgstr "" "パッケージが (前述の例の :mod:`!sound` パッケージのように) サブパッケージの集" -"まりに構造化されている場合、絶対 import を使って兄弟関係にあるパッケージを参" -"照できます。例えば、モジュール :mod:`!sound.filters.vocoder` で :mod:`!sound." -"effects` パッケージの :mod:`!echo` モジュールが必要な場合、 ``from sound." -"effects import echo`` が使えます。" +"まりに構造化されている場合、\n" +"絶対 import を使って兄弟関係にあるパッケージのサブモジュールを参照できま" +"す。\n" +"例えば、モジュール :mod:`!sound.filters.vocoder` で :mod:`!sound.effects` " +"パッケージの :mod:`!echo` モジュールが必要な場合、\n" +"``from sound.effects import echo`` が使えます。" #: ../../tutorial/modules.rst:571 msgid "" @@ -1278,6 +1293,12 @@ msgid "" "that file is executed. This variable can be modified; doing so affects " "future searches for modules and subpackages contained in the package." msgstr "" +"パッケージはもう一つ特別な属性として :attr:`~module.__path__` をサポートして" +"います。この属性は、パッケージの :file:`__init__.py` 中のコードが実行されるよ" +"りも前に、 :file:`__init__.py` の収められているディレクトリ名の文字列を含ん" +"だ 入った :term:`sequence` になるよう初期化されます。この変数は変更することが" +"できます。変更を加えると、以降そのパッケージに入っているモジュールやサブパッ" +"ケージの検索に影響します。" #: ../../tutorial/modules.rst:595 msgid "" diff --git a/tutorial/stdlib.po b/tutorial/stdlib.po index 1ae9db029..ecf91a5d6 100644 --- a/tutorial/stdlib.po +++ b/tutorial/stdlib.po @@ -20,10 +20,10 @@ msgstr "" "Last-Translator: righteous, 2025\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../tutorial/stdlib.rst:5 @@ -92,7 +92,6 @@ msgstr "" "ファイルやディレクトリの日常的な管理作業のために、より簡単に使える高水準のイ" "ンターフェースが :mod:`shutil` モジュールで提供されています::" -#: ../../tutorial/stdlib.rst:41 msgid "" ">>> import shutil\n" ">>> shutil.copyfile('data.db', 'archive.db')\n" @@ -100,6 +99,11 @@ msgid "" ">>> shutil.move('/build/executables', 'installdir')\n" "'installdir'" msgstr "" +">>> import shutil\n" +">>> shutil.copyfile('data.db', 'archive.db')\n" +"'archive.db'\n" +">>> shutil.move('/build/executables', 'installdir')\n" +"'installdir'" #: ../../tutorial/stdlib.rst:51 msgid "File Wildcards" @@ -113,12 +117,14 @@ msgstr "" ":mod:`glob` モジュールでは、ディレクトリのワイルドカード検索からファイルのリ" "ストを生成するための関数を提供しています::" -#: ../../tutorial/stdlib.rst:56 msgid "" ">>> import glob\n" ">>> glob.glob('*.py')\n" "['primes.py', 'random.py', 'quote.py']" msgstr "" +">>> import glob\n" +">>> glob.glob('*.py')\n" +"['primes.py', 'random.py', 'quote.py']" #: ../../tutorial/stdlib.rst:64 msgid "Command Line Arguments" @@ -134,12 +140,14 @@ msgstr "" "ます。コマンドライン引数は モジュールの *argv* 属性にリストとして保存されてい" "ます。例として以下の :file:`demo.py` ファイルを見てみましょう::" -#: ../../tutorial/stdlib.rst:70 msgid "" "# File demo.py\n" "import sys\n" "print(sys.argv)" msgstr "" +"# ファイル demo.py\n" +"import sys\n" +"print(sys.argv)" #: ../../tutorial/stdlib.rst:74 msgid "" @@ -149,9 +157,8 @@ msgstr "" "以下は、コマンドライン上で ``python demo.py one two three`` と実行した時の出" "力です::" -#: ../../tutorial/stdlib.rst:77 msgid "['demo.py', 'one', 'two', 'three']" -msgstr "" +msgstr "['demo.py', 'one', 'two', 'three']" #: ../../tutorial/stdlib.rst:79 msgid "" @@ -163,7 +170,6 @@ msgstr "" "た仕組みを提供します。次のスクリプトは1つ以上のファイル名を抽出し、オプション" "で行数を表示します。" -#: ../../tutorial/stdlib.rst:83 msgid "" "import argparse\n" "\n" @@ -175,6 +181,15 @@ msgid "" "args = parser.parse_args()\n" "print(args)" msgstr "" +"import argparse\n" +"\n" +"parser = argparse.ArgumentParser(\n" +" prog='top',\n" +" description='Show top lines from each file')\n" +"parser.add_argument('filenames', nargs='+')\n" +"parser.add_argument('-l', '--lines', type=int, default=10)\n" +"args = parser.parse_args()\n" +"print(args)" #: ../../tutorial/stdlib.rst:93 msgid "" @@ -200,11 +215,12 @@ msgstr "" "す。 *stderr* は、警告やエラーメッセージを出力して、 *stdout* がリダイレクト" "された場合でも読めるようにするために便利です::" -#: ../../tutorial/stdlib.rst:107 msgid "" ">>> sys.stderr.write('Warning, log file not found starting a new one\\n')\n" "Warning, log file not found starting a new one" msgstr "" +">>> sys.stderr.write('Warning, log file not found starting a new one\\n')\n" +"Warning, log file not found starting a new one" #: ../../tutorial/stdlib.rst:110 msgid "The most direct way to terminate a script is to use ``sys.exit()``." @@ -224,7 +240,6 @@ msgstr "" "す。正規表現は複雑な一致検索や操作に対して簡潔で最適化された解決策を提供しま" "す::" -#: ../../tutorial/stdlib.rst:122 msgid "" ">>> import re\n" ">>> re.findall(r'\\bf[a-z]*', 'which foot or hand fell fastest')\n" @@ -232,6 +247,11 @@ msgid "" ">>> re.sub(r'(\\b[a-z]+) \\1', r'\\1', 'cat in the the hat')\n" "'cat in the hat'" msgstr "" +">>> import re\n" +">>> re.findall(r'\\bf[a-z]*', 'which foot or hand fell fastest')\n" +"['foot', 'fell', 'fastest']\n" +">>> re.sub(r'(\\b[a-z]+) \\1', r'\\1', 'cat in the the hat')\n" +"'cat in the hat'" #: ../../tutorial/stdlib.rst:128 msgid "" @@ -241,11 +261,12 @@ msgstr "" "最小限の機能だけが必要なら、読みやすくデバッグしやすい文字列メソッドの方がお" "勧めです::" -#: ../../tutorial/stdlib.rst:131 msgid "" ">>> 'tea for too'.replace('too', 'two')\n" "'tea for two'" msgstr "" +">>> 'tea for too'.replace('too', 'two')\n" +"'tea for two'" #: ../../tutorial/stdlib.rst:138 msgid "Mathematics" @@ -259,7 +280,6 @@ msgstr "" ":mod:`math` モジュールは、浮動小数点演算のための C 言語ライブラリ関数にアクセ" "スする手段を提供しています::" -#: ../../tutorial/stdlib.rst:143 msgid "" ">>> import math\n" ">>> math.cos(math.pi / 4)\n" @@ -267,6 +287,11 @@ msgid "" ">>> math.log(1024, 2)\n" "10.0" msgstr "" +">>> import math\n" +">>> math.cos(math.pi / 4)\n" +"0.70710678118654757\n" +">>> math.log(1024, 2)\n" +"10.0" #: ../../tutorial/stdlib.rst:149 msgid "The :mod:`random` module provides tools for making random selections::" @@ -304,7 +329,6 @@ msgstr "" ":mod:`statistics` モジュールは数値データの基礎的な統計的特性(平均、中央値、" "分散等)を計算します::" -#: ../../tutorial/stdlib.rst:164 msgid "" ">>> import statistics\n" ">>> data = [2.75, 1.75, 1.25, 0.25, 0.5, 1.25, 3.5]\n" @@ -315,6 +339,14 @@ msgid "" ">>> statistics.variance(data)\n" "1.3720238095238095" msgstr "" +">>> import statistics\n" +">>> data = [2.75, 1.75, 1.25, 0.25, 0.5, 1.25, 3.5]\n" +">>> statistics.mean(data)\n" +"1.6071428571428572\n" +">>> statistics.median(data)\n" +"1.25\n" +">>> statistics.variance(data)\n" +"1.3720238095238095" #: ../../tutorial/stdlib.rst:173 msgid "" @@ -391,7 +423,6 @@ msgstr "" msgid "Dates and Times" msgstr "日付と時刻" -#: ../../tutorial/stdlib.rst:212 msgid "" "The :mod:`datetime` module supplies classes for manipulating dates and times " "in both simple and complex ways. While date and time arithmetic is " @@ -399,11 +430,11 @@ msgid "" "for output formatting and manipulation. The module also supports objects " "that are timezone aware. ::" msgstr "" -":mod:`datetime` モジュールは、日付や時刻を操作するためのクラスを、単純な方法" -"と複雑な方法の両方で提供しています。日付や時刻に対する算術がサポートされてい" -"る一方、実装では出力のフォーマットや操作のための効率的なデータメンバ抽出に重" -"点を置いています。このモジュールでは、タイムゾーンに対応したオブジェクトもサ" -"ポートしています。 ::" +":mod:`datetime` モジュールは、日付や時刻の単純な操作から複雑な操作まで行える" +"クラスを提供します。\n" +"日付や時刻の算術演算にも対応していますが、出力のフォーマットや各種操作に必要" +"な属性を効率よく取り出すことに重点を置いています。\n" +"タイムゾーンを扱えるオブジェクトもサポートしています。 ::" #: ../../tutorial/stdlib.rst:218 msgid "" @@ -449,7 +480,6 @@ msgstr "" "サポートされます: :mod:`zlib`, :mod:`gzip`, :mod:`bz2`, :mod:`lzma`, :mod:" "`zipfile`, :mod:`tarfile`。 ::" -#: ../../tutorial/stdlib.rst:242 msgid "" ">>> import zlib\n" ">>> s = b'witch which has which witches wrist watch'\n" @@ -463,6 +493,17 @@ msgid "" ">>> zlib.crc32(s)\n" "226805979" msgstr "" +">>> import zlib\n" +">>> s = b'witch which has which witches wrist watch'\n" +">>> len(s)\n" +"41\n" +">>> t = zlib.compress(s)\n" +">>> len(t)\n" +"37\n" +">>> zlib.decompress(t)\n" +"b'witch which has which witches wrist watch'\n" +">>> zlib.crc32(s)\n" +"226805979" #: ../../tutorial/stdlib.rst:258 msgid "Performance Measurement" @@ -488,7 +529,6 @@ msgstr "" "クやアンパックを使ってみたいと思うかもしれません。 :mod:`timeit` モジュールを" "使えば、パフォーマンスがほんの少し良いことがすぐに分かります::" -#: ../../tutorial/stdlib.rst:268 msgid "" ">>> from timeit import Timer\n" ">>> Timer('t=a; a=b; b=t', 'a=1; b=2').timeit()\n" @@ -496,6 +536,11 @@ msgid "" ">>> Timer('a,b = b,a', 'a=1; b=2').timeit()\n" "0.54962537085770791" msgstr "" +">>> from timeit import Timer\n" +">>> Timer('t=a; a=b; b=t', 'a=1; b=2').timeit()\n" +"0.57535828626024577\n" +">>> Timer('a,b = b,a', 'a=1; b=2').timeit()\n" +"0.54962537085770791" #: ../../tutorial/stdlib.rst:274 msgid "" @@ -520,7 +565,6 @@ msgstr "" "高い品質のソフトウェアを開発するための一つのアプローチは、各関数に対して開発" "と同時にテストを書き、開発の過程で頻繁にテストを走らせるというものです。" -#: ../../tutorial/stdlib.rst:288 msgid "" "The :mod:`doctest` module provides a tool for scanning a module and " "validating tests embedded in a program's docstrings. Test construction is " @@ -529,12 +573,12 @@ msgid "" "example and it allows the doctest module to make sure the code remains true " "to the documentation::" msgstr "" -":mod:`doctest` モジュールでは、モジュールを検索してプログラムの docstring に" -"埋め込まれたテストの評価を行うためのツールを提供しています。テストの作り方は" -"単純で、典型的な呼び出し例とその結果を docstring にカット&ペーストするだけで" -"す。この作業は、ユーザに使用例を与えるという意味でドキュメントの情報を増やす" -"と同時に、ドキュメントに書かれているコードが正しい事を確認できるようになりま" -"す::" +":mod:`doctest` モジュールは、モジュールの docstring に埋め込まれたテストを探" +"し、実行結果を検証します。\n" +"テストを作るには、典型的な呼び出し例とその結果を docstring に貼り付けるだけで" +"す。\n" +"これにより、利用者に使用例を示すと同時に、コードがドキュメントに書かれたとお" +"りに動き続けていることを確認できます。 ::" #: ../../tutorial/stdlib.rst:295 msgid "" @@ -604,25 +648,25 @@ msgstr "" msgid "Batteries Included" msgstr "バッテリー同梱" -#: ../../tutorial/stdlib.rst:330 msgid "" "Python has a \"batteries included\" philosophy. This is best seen through " "the sophisticated and robust capabilities of its larger packages. For " "example:" msgstr "" -"Python には \"バッテリー同梱 (batteries included)\" 哲学があります。この哲学" -"は、洗練され、安定した機能を持つ Python の膨大なパッケージ群に如実に表れてい" -"ます。例えば:" +"Python には「バッテリー同梱 (batteries included)」という哲学があります。\n" +"この哲学が特によく表れているのは、規模の大きなパッケージが備える洗練された堅" +"牢な機能です。\n" +"例えば:" -#: ../../tutorial/stdlib.rst:333 msgid "" "The :mod:`xmlrpc.client` and :mod:`xmlrpc.server` modules make implementing " "remote procedure calls into an almost trivial task. Despite the modules' " "names, no direct knowledge or handling of XML is needed." msgstr "" -":mod:`xmlrpc.client` および :mod:`xmlrpc.server` モジュールは、遠隔手続き呼" -"び出し (remote procedure call) を全く大したことのない作業に変えてしまいます。" -"モジュール名とは違い、XML を扱うための直接的な知識は必要ありません。" +":mod:`xmlrpc.client` と :mod:`xmlrpc.server` モジュールを使うと、遠隔手続き呼" +"び出しを簡単に実装できます。\n" +"名前に XML が含まれていますが、XML の知識や XML を直接扱う作業は必要ありませ" +"ん。" #: ../../tutorial/stdlib.rst:337 msgid "" @@ -657,14 +701,14 @@ msgstr "" "の処理をサポートしています。総合すると、これらのモジュールによって Python ア" "プリケーションと他のツールの間でとても簡単にデータを受け渡すことが出来ます。" -#: ../../tutorial/stdlib.rst:353 msgid "" "The :mod:`sqlite3` module is a wrapper for the SQLite database library, " "providing a persistent database that can be updated and accessed using " "slightly nonstandard SQL syntax." msgstr "" -":mod:`sqlite3` モジュールは SQLite データベースライブラリのラッパーです。若干" -"非標準の SQL シンタックスを用いて更新や接続出来る永続的なデータベースを提供し" +":mod:`sqlite3` モジュールは、SQLite データベースライブラリを Python から使う" +"ためのラッパーです。\n" +"データを永続的に保存でき、標準とは少し異なる SQL の構文で更新やアクセスができ" "ます。" #: ../../tutorial/stdlib.rst:357 diff --git a/tutorial/stdlib2.po b/tutorial/stdlib2.po index e5c409092..42820067d 100644 --- a/tutorial/stdlib2.po +++ b/tutorial/stdlib2.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: Takanori Suzuki , 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../tutorial/stdlib2.rst:5 @@ -49,26 +49,26 @@ msgstr "" ":mod:`reprlib` モジュールは、大きなコンテナや、深くネストしたコンテナを省略し" "て表示するバージョンの :func:`repr` を提供しています::" -#: ../../tutorial/stdlib2.rst:19 msgid "" ">>> import reprlib\n" ">>> reprlib.repr(set('supercalifragilisticexpialidocious'))\n" "\"{'a', 'c', 'd', 'e', 'f', 'g', ...}\"" msgstr "" +">>> import reprlib\n" +">>> reprlib.repr(set('supercalifragilisticexpialidocious'))\n" +"\"{'a', 'c', 'd', 'e', 'f', 'g', ...}\"" -#: ../../tutorial/stdlib2.rst:23 msgid "" "The :mod:`pprint` module offers more sophisticated control over printing " "both built-in and user defined objects in a way that is readable by the " "interpreter. When the result is longer than one line, the \"pretty printer\" " "adds line breaks and indentation to more clearly reveal data structure::" msgstr "" -":mod:`pprint` モジュールは、組み込み型やユーザ定義型をわかりやすく表示するた" -"めの洗練された制御手段を提供しています。表示結果が複数行にわたる場合は、 " -"\"pretty printer\" と呼ばれるものが改行やインデントを追加して、データ構造がよ" -"り明確になるように印字します::" +":mod:`pprint` モジュールは、組み込みオブジェクトやユーザー定義オブジェクトを" +"わかりやすく表示するための、より細かな制御手段を提供しています。\n" +"表示結果が複数行にわたる場合、「pretty printer」が改行やインデントを追加し、" +"データ構造をより明確に示します。 ::" -#: ../../tutorial/stdlib2.rst:28 msgid "" ">>> import pprint\n" ">>> t = [[[['black', 'cyan'], 'white', ['green', 'red']], [['magenta',\n" @@ -81,6 +81,16 @@ msgid "" " [['magenta', 'yellow'],\n" " 'blue']]]" msgstr "" +">>> import pprint\n" +">>> t = [[[['black', 'cyan'], 'white', ['green', 'red']], [['magenta',\n" +"... 'yellow'], 'blue']]]\n" +"...\n" +">>> pprint.pprint(t, width=30)\n" +"[[[['black', 'cyan'],\n" +" 'white',\n" +" ['green', 'red']],\n" +" [['magenta', 'yellow'],\n" +" 'blue']]]" #: ../../tutorial/stdlib2.rst:39 msgid "" @@ -90,7 +100,6 @@ msgstr "" ":mod:`textwrap` モジュールは、段落で構成された文章を、指定したスクリーン幅に" "ぴったり収まるように調整します::" -#: ../../tutorial/stdlib2.rst:42 msgid "" ">>> import textwrap\n" ">>> doc = \"\"\"The wrap() method is just like fill() except that it " @@ -104,18 +113,28 @@ msgid "" "instead of one big string with newlines\n" "to separate the wrapped lines." msgstr "" +">>> import textwrap\n" +">>> doc = \"\"\"The wrap() method is just like fill() except that it " +"returns\n" +"... a list of strings instead of one big string with newlines to separate\n" +"... the wrapped lines.\"\"\"\n" +"...\n" +">>> print(textwrap.fill(doc, width=40))\n" +"The wrap() method is just like fill()\n" +"except that it returns a list of strings\n" +"instead of one big string with newlines\n" +"to separate the wrapped lines." -#: ../../tutorial/stdlib2.rst:53 msgid "" "The :mod:`locale` module accesses a database of culture specific data " "formats. The grouping attribute of locale's format function provides a " "direct way of formatting numbers with group separators::" msgstr "" -":mod:`locale` モジュールは、文化により異なるデータ表現形式のデータベースにア" -"クセスします。 :mod:`locale` の :func:`format` 関数の grouping 属性を使えば、" -"数値を適切な桁区切り文字によりグループ化された形式に変換できます::" +":mod:`locale` モジュールは、文化によって異なるデータ形式のデータベースにアク" +"セスします。\n" +"``locale`` の ``format_string()`` 関数で ``grouping`` 引数を使うと、桁区切り" +"文字を入れて数値をフォーマットできます。 ::" -#: ../../tutorial/stdlib2.rst:57 msgid "" ">>> import locale\n" ">>> locale.setlocale(locale.LC_ALL, 'English_United States.1252')\n" @@ -128,22 +147,31 @@ msgid "" "... conv['frac_digits'], x), grouping=True)\n" "'$1,234,567.80'" msgstr "" +">>> import locale\n" +">>> locale.setlocale(locale.LC_ALL, 'English_United States.1252')\n" +"'English_United States.1252'\n" +">>> conv = locale.localeconv() # 表記規則のマッピングを取得する\n" +">>> x = 1234567.8\n" +">>> locale.format_string(\"%d\", x, grouping=True)\n" +"'1,234,567'\n" +">>> locale.format_string(\"%s%.*f\", (conv['currency_symbol'],\n" +"... conv['frac_digits'], x), grouping=True)\n" +"'$1,234,567.80'" #: ../../tutorial/stdlib2.rst:72 msgid "Templating" msgstr "文字列テンプレート" -#: ../../tutorial/stdlib2.rst:74 msgid "" "The :mod:`string` module includes a versatile :class:`~string.Template` " "class with a simplified syntax suitable for editing by end-users. This " "allows users to customize their applications without having to alter the " "application." msgstr "" -":mod:`string` モジュールには、柔軟で、エンドユーザが簡単に編集できる簡単な構" -"文を備えた :class:`~string.Template` クラスが入っています。このクラスを使う" -"と、ユーザがアプリケーションを修正することなしにアプリケーションの出力をカス" -"タマイズできるようになります。" +":mod:`string` モジュールには、エンドユーザーが編集しやすい簡潔な構文を備え" +"た、汎用的な :class:`~string.Template` クラスが含まれています。\n" +"ユーザーはこれを使って、アプリケーション本体を変更せずにアプリケーションをカ" +"スタマイズできます。" #: ../../tutorial/stdlib2.rst:78 msgid "" @@ -158,13 +186,16 @@ msgstr "" "スホルダの後ろにスペースを挟まず、英数文字を続けることができます。``$$`` のよ" "うにすると、``$`` 自体をエスケープできます::" -#: ../../tutorial/stdlib2.rst:83 msgid "" ">>> from string import Template\n" ">>> t = Template('${village}folk send $$10 to $cause.')\n" ">>> t.substitute(village='Nottingham', cause='the ditch fund')\n" "'Nottinghamfolk send $10 to the ditch fund.'" msgstr "" +">>> from string import Template\n" +">>> t = Template('${village}folk send $$10 to $cause.')\n" +">>> t.substitute(village='Nottingham', cause='the ditch fund')\n" +"'Nottinghamfolk send $10 to the ditch fund.'" #: ../../tutorial/stdlib2.rst:88 msgid "" @@ -180,7 +211,6 @@ msgstr "" "ので、欠落したデータがあるとプレースホルダをそのままにして出力する :meth:" "`~string.Template.safe_substitute` メソッドを使う方が適切かもしれません::" -#: ../../tutorial/stdlib2.rst:94 msgid "" ">>> t = Template('Return the $item to $owner.')\n" ">>> d = dict(item='unladen swallow')\n" @@ -191,6 +221,14 @@ msgid "" ">>> t.safe_substitute(d)\n" "'Return the unladen swallow to $owner.'" msgstr "" +">>> t = Template('Return the $item to $owner.')\n" +">>> d = dict(item='unladen swallow')\n" +">>> t.substitute(d)\n" +"Traceback (most recent call last):\n" +" ...\n" +"KeyError: 'owner'\n" +">>> t.safe_substitute(d)\n" +"'Return the unladen swallow to $owner.'" #: ../../tutorial/stdlib2.rst:103 msgid "" @@ -199,13 +237,11 @@ msgid "" "placeholders such as the current date, image sequence number, or file " "format::" msgstr "" -"区切り文字はデフォルトは ``$`` ですが、:class:`~string.Template` のサブクラス" -"を派生すると変更することができます。例えば、画像ブラウザ用に一括で名前を変更" -"するユーティリティを作っていたとして、現在の日付や画像のシーケンス番号、ファ" -"イル形式といったプレースホルダにパーセント記号を使うことにしたら、次のように" -"なります::" +"区切り文字はデフォルトは ``$`` ですが、 ``Template`` のサブクラスを派生すると" +"変更することができます。例えば、画像ブラウザ用に一括で名前を変更するユーティ" +"リティを作っていたとして、現在の日付や画像のシーケンス番号、ファイル形式と" +"いったプレースホルダにパーセント記号を使うことにしたら、次のようになります::" -#: ../../tutorial/stdlib2.rst:107 msgid "" ">>> import time, os.path\n" ">>> photofiles = ['img_1074.jpg', 'img_1076.jpg', 'img_1077.jpg']\n" @@ -226,17 +262,34 @@ msgid "" "img_1076.jpg --> Ashley_1.jpg\n" "img_1077.jpg --> Ashley_2.jpg" msgstr "" +">>> import time, os.path\n" +">>> photofiles = ['img_1074.jpg', 'img_1076.jpg', 'img_1077.jpg']\n" +">>> class BatchRename(Template):\n" +"... delimiter = '%'\n" +"...\n" +">>> fmt = input('Enter rename style (%d-date %n-seqnum %f-format): ')\n" +"Enter rename style (%d-date %n-seqnum %f-format): Ashley_%n%f\n" +"\n" +">>> t = BatchRename(fmt)\n" +">>> date = time.strftime('%d%b%y')\n" +">>> for i, filename in enumerate(photofiles):\n" +"... base, ext = os.path.splitext(filename)\n" +"... newname = t.substitute(d=date, n=i, f=ext)\n" +"... print('{0} --> {1}'.format(filename, newname))\n" +"\n" +"img_1074.jpg --> Ashley_0.jpg\n" +"img_1076.jpg --> Ashley_1.jpg\n" +"img_1077.jpg --> Ashley_2.jpg" -#: ../../tutorial/stdlib2.rst:126 msgid "" "Another application for templating is separating program logic from the " "details of multiple output formats. This makes it possible to substitute " "custom templates for XML files, plain text reports, and HTML web reports." msgstr "" -"テンプレートのもう一つの用途は、複数ある出力フォーマットからのプログラムロ" -"ジックの分離です。これにより、XMLファイル用、プレーンテキストのレポート用、" -"HTMLのwebレポート用のテンプレートに、同じプログラムロジックから値を埋め込むこ" -"とができます。" +"テンプレートのもう一つの用途は、複数の出力形式の細かな違いからプログラムのロ" +"ジックを分離することです。\n" +"これにより、XML ファイル、プレーンテキストのレポート、HTML のウェブレポートに" +"合わせたテンプレートを差し替えて使えます。" #: ../../tutorial/stdlib2.rst:134 msgid "Working with Binary Data Record Layouts" @@ -260,7 +313,6 @@ msgstr "" "ク符号が standard サイズであり、バイトオーダーがリトルエンディアンであること" "を示しています::" -#: ../../tutorial/stdlib2.rst:144 msgid "" "import struct\n" "\n" @@ -281,12 +333,30 @@ msgid "" "\n" " start += extra_size + comp_size # skip to the next header" msgstr "" +"import struct\n" +"\n" +"with open('myfile.zip', 'rb') as f:\n" +" data = f.read()\n" +"\n" +"start = 0\n" +"for i in range(3): # 最初の 3 つのファイルヘッダを表示す" +"る\n" +" start += 14\n" +" fields = struct.unpack('>> from array import array\n" ">>> a = array('H', [4000, 10, 700, 22222])\n" @@ -520,6 +595,12 @@ msgid "" ">>> a[1:3]\n" "array('H', [10, 700])" msgstr "" +">>> from array import array\n" +">>> a = array('H', [4000, 10, 700, 22222])\n" +">>> sum(a)\n" +"26932\n" +">>> a[1:3]\n" +"array('H', [10, 700])" #: ../../tutorial/stdlib2.rst:309 msgid "" @@ -533,7 +614,6 @@ msgstr "" "速く、その一方で中間にある値の参照は遅くなります。こうしたオブジェクトは" "キューや木構造の幅優先探索の実装に向いています::" -#: ../../tutorial/stdlib2.rst:314 msgid "" ">>> from collections import deque\n" ">>> d = deque([\"task1\", \"task2\", \"task3\"])\n" @@ -541,8 +621,12 @@ msgid "" ">>> print(\"Handling\", d.popleft())\n" "Handling task1" msgstr "" +">>> from collections import deque\n" +">>> d = deque([\"task1\", \"task2\", \"task3\"])\n" +">>> d.append(\"task4\")\n" +">>> print(\"Handling\", d.popleft())\n" +"Handling task1" -#: ../../tutorial/stdlib2.rst:322 msgid "" "unsearched = deque([starting_node])\n" "def breadth_first_search(unsearched):\n" @@ -552,6 +636,13 @@ msgid "" " return m\n" " unsearched.append(m)" msgstr "" +"unsearched = deque([starting_node])\n" +"def breadth_first_search(unsearched):\n" +" node = unsearched.popleft()\n" +" for m in gen_moves(node):\n" +" if is_goal(m):\n" +" return m\n" +" unsearched.append(m)" #: ../../tutorial/stdlib2.rst:330 msgid "" @@ -562,7 +653,6 @@ msgstr "" "リストの代わりの実装以外にも、標準ライブラリにはソート済みのリストを操作する" "ための関数を備えた :mod:`bisect` のようなツールも提供しています::" -#: ../../tutorial/stdlib2.rst:334 msgid "" ">>> import bisect\n" ">>> scores = [(100, 'perl'), (200, 'tcl'), (400, 'lua'), (500, 'python')]\n" @@ -570,6 +660,11 @@ msgid "" ">>> scores\n" "[(100, 'perl'), (200, 'tcl'), (300, 'ruby'), (400, 'lua'), (500, 'python')]" msgstr "" +">>> import bisect\n" +">>> scores = [(100, 'perl'), (200, 'tcl'), (400, 'lua'), (500, 'python')]\n" +">>> bisect.insort(scores, (300, 'ruby'))\n" +">>> scores\n" +"[(100, 'perl'), (200, 'tcl'), (300, 'ruby'), (400, 'lua'), (500, 'python')]" #: ../../tutorial/stdlib2.rst:340 msgid "" @@ -583,7 +678,6 @@ msgstr "" "す。ヒープは、毎回リストをソートすることなく、最小の値をもつ要素に繰り返しア" "クセスするようなアプリケーションで便利です::" -#: ../../tutorial/stdlib2.rst:345 msgid "" ">>> from heapq import heapify, heappop, heappush\n" ">>> data = [1, 3, 5, 7, 9, 2, 4, 6, 8, 0]\n" @@ -592,6 +686,12 @@ msgid "" ">>> [heappop(data) for i in range(3)] # fetch the three smallest entries\n" "[-5, 0, 1]" msgstr "" +">>> from heapq import heapify, heappop, heappush\n" +">>> data = [1, 3, 5, 7, 9, 2, 4, 6, 8, 0]\n" +">>> heapify(data) # リストをヒープの順序に並べ替える\n" +">>> heappush(data, -5) # 新しい項目を追加する\n" +">>> [heappop(data) for i in range(3)] # 小さい方から 3 つの項目を取り出す\n" +"[-5, 0, 1]" #: ../../tutorial/stdlib2.rst:356 msgid "Decimal Floating-Point Arithmetic" @@ -631,17 +731,15 @@ msgid "" "by hand." msgstr "ユーザが手計算の結果と同じ演算結果を期待するようなアプリケーション。" -#: ../../tutorial/stdlib2.rst:370 msgid "" "For example, calculating a 5% tax on a 70 cent phone charge gives different " "results in decimal floating point and binary floating point. The difference " "becomes significant if the results are rounded to the nearest cent::" msgstr "" -"例えば、70 セントの電話代にかかる 5% の税金を計算しようとすると、10 進の浮動" -"小数点値と 2 進の浮動小数点値では違う結果になってしまいます。計算結果を四捨五" -"入してセント単位にしようとすると、以下のように違いがはっきり現れます::" +"例えば、70 セントの電話代に 5% の税金を加える計算では、10 進浮動小数点と 2 進" +"浮動小数点で結果が異なります。\n" +"結果を最も近いセント単位に丸めると、その違いがはっきり現れます。 ::" -#: ../../tutorial/stdlib2.rst:374 msgid "" ">>> from decimal import *\n" ">>> round(Decimal('0.70') * Decimal('1.05'), 2)\n" @@ -649,8 +747,12 @@ msgid "" ">>> round(.70 * 1.05, 2)\n" "0.73" msgstr "" +">>> from decimal import *\n" +">>> round(Decimal('0.70') * Decimal('1.05'), 2)\n" +"Decimal('0.74')\n" +">>> round(.70 * 1.05, 2)\n" +"0.73" -#: ../../tutorial/stdlib2.rst:380 msgid "" "The :class:`~decimal.Decimal` result keeps a trailing zero, automatically " "inferring four place significance from multiplicands with two place " @@ -658,10 +760,11 @@ msgid "" "issues that can arise when binary floating point cannot exactly represent " "decimal quantities." msgstr "" -"上の例で、:class:`~decimal.Decimal` を使った計算では、末尾桁のゼロが保存され" -"ており、有効数字2桁の被乗数から自動的に有効数字を 4 桁と判断しています。:" -"class:`~decimal.Decimal` は手計算と 同じ方法で計算を行い、2 進浮動小数が 10 " -"進小数成分を正確に表現できないことに よって起きる問題を回避しています。" +":class:`~decimal.Decimal` の計算結果は末尾のゼロを保持します。\n" +"掛け合わせる数がどちらも小数点以下 2 桁であることから、結果を小数点以下 4 桁" +"まで保持すると自動的に判断します。\n" +"``Decimal`` は手計算と同じ計算を再現し、2 進浮動小数点数では 10 進数の値を正" +"確に表せない場合に起こり得る問題を回避します。" #: ../../tutorial/stdlib2.rst:386 msgid "" @@ -672,7 +775,6 @@ msgstr "" ":class:`~decimal.Decimal` クラスは厳密な値を表現できるため、2 進浮動小数点数" "では 期待通りに計算できないような剰余の計算や等値テストも実現できます::" -#: ../../tutorial/stdlib2.rst:390 msgid "" ">>> Decimal('1.00') % Decimal('.10')\n" "Decimal('0.00')\n" @@ -684,6 +786,15 @@ msgid "" ">>> 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 == 1.0\n" "False" msgstr "" +">>> Decimal('1.00') % Decimal('.10')\n" +"Decimal('0.00')\n" +">>> 1.00 % 0.10\n" +"0.09999999999999995\n" +"\n" +">>> sum([Decimal('0.1')]*10) == Decimal('1.0')\n" +"True\n" +">>> 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 == 1.0\n" +"False" #: ../../tutorial/stdlib2.rst:400 msgid "" @@ -692,9 +803,11 @@ msgid "" msgstr "" ":mod:`decimal` モジュールを使うと、必要なだけの精度で算術演算を行えます::" -#: ../../tutorial/stdlib2.rst:402 msgid "" ">>> getcontext().prec = 36\n" ">>> Decimal(1) / Decimal(7)\n" "Decimal('0.142857142857142857142857142857142857')" msgstr "" +">>> getcontext().prec = 36\n" +">>> Decimal(1) / Decimal(7)\n" +"Decimal('0.142857142857142857142857142857142857')" diff --git a/tutorial/venv.po b/tutorial/venv.po index 276401e3b..bdf497c89 100644 --- a/tutorial/venv.po +++ b/tutorial/venv.po @@ -20,10 +20,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../tutorial/venv.rst:6 @@ -42,10 +42,10 @@ msgid "" "bug has been fixed or the application may be written using an obsolete " "version of the library's interface." msgstr "" -"Python アプリケーションはよく標準ライブラリ以外のパッケージやモジュールを利用" -"します。またアプリケーションがあるバグ修正を必要としていたり、過去のバージョ" -"ンのインターフェイスに依存しているために、ライブラリの特定のバージョンを必要" -"とすることもあります。" +"Python アプリケーションは、標準ライブラリに含まれないパッケージやモジュールを" +"よく使います。特定のバグの修正が必要だったり、古いバージョンのライブラリのイ" +"ンターフェイスに依存していたりするため、ライブラリの特定のバージョンが必要に" +"なることもあります。" #: ../../tutorial/venv.rst:17 msgid "" @@ -55,11 +55,11 @@ msgid "" "are in conflict and installing either version 1.0 or 2.0 will leave one " "application unable to run." msgstr "" -"そのため、1つのインストールされたPythonが全てのアプリケーションの要求に対応す" -"ることは不可能です。もしアプリケーションAがあるモジュールのバージョン 1.0 を" -"要求していて、別のアプリケーションBが同じモジュールのバージョン 2.0 を要求し" -"ている場合、2つの要求は衝突していて、1.0 と 2.0 のどちらかのバージョンをイン" -"ストールしても片方のアプリケーションが動きません。" +"このため、1つの Python 環境ですべてのアプリケーションの要求を満たせるとは限り" +"ません。アプリケーション A があるモジュールのバージョン 1.0 を必要とし、アプ" +"リケーション B がバージョン 2.0 を必要とする場合、両者の要求は衝突します。" +"1.0 と 2.0 のどちらをインストールしても、片方のアプリケーションは動作しませ" +"ん。" #: ../../tutorial/venv.rst:23 msgid "" @@ -67,9 +67,9 @@ msgid "" "self-contained directory tree that contains a Python installation for a " "particular version of Python, plus a number of additional packages." msgstr "" -"この問題の解決策は :term:`仮想環境` を作ることです。仮想" -"環境とは、特定のバージョンの Python と幾つかの追加パッケージを含んだ Python " -"インストールを構成するディレクトリです。" +"この問題は :term:`仮想環境 ` を作ることで解決できます。" +"仮想環境とは、特定のバージョンの Python といくつかの追加パッケージを含む自己" +"完結したディレクトリ構造です。" #: ../../tutorial/venv.rst:27 msgid "" @@ -80,12 +80,11 @@ msgid "" "application B requires a library be upgraded to version 3.0, this will not " "affect application A's environment." msgstr "" -"別のアプリケーションはそれぞれ別の仮想環境を使うことができます。先の例にあっ" -"た要求の衝突を解決する場合、アプリケーションAが固有の仮想環境を持ってそこにラ" -"イブラリのバージョン 1.0 をインストールし、アプリケーションBが持つ別の仮想環" -"境にライブラリのバージョン 2.0 をインストールすることができます。そしてアプリ" -"ケーションBがライブラリのバージョンを 3.0 に更新することを要求する場合も、ア" -"プリケーションAに影響しません。" +"アプリケーションごとに異なる仮想環境を使うことができます。先ほどの例では、ア" +"プリケーション A 専用の仮想環境にバージョン 1.0 をインストールし、アプリケー" +"ション B 用の仮想環境にバージョン 2.0 をインストールすれば要求の衝突を解決で" +"きます。アプリケーション B のためにライブラリをバージョン 3.0 に更新する必要" +"があっても、アプリケーション A の環境には影響しません。" #: ../../tutorial/venv.rst:36 msgid "Creating Virtual Environments" @@ -98,10 +97,10 @@ msgid "" "was run (as reported by the :option:`--version` option). For instance, " "executing the command with ``python3.12`` will install version 3.12." msgstr "" -"仮想環境の作成・管理に使われるモジュールは、 :mod:`venv` と呼ばれます。 :mod:" -"`venv` は、コマンドが実行された Python のバージョン (:option:`--version` オプ" -"ションで表示される) をインストールします。例えば、 ``python3.12`` でコマンド" -"を実行すると、バージョン 3.12 がインストールされます。" +"仮想環境の作成と管理には :mod:`venv` モジュールを使います。:mod:`venv` はその" +"コマンドを実行したバージョンの Python をインストールします。このバージョン" +"は :option:`--version` オプションで確認できます。例えば ``python3.12`` でコマ" +"ンドを実行すると、バージョン 3.12 がインストールされます。" #: ../../tutorial/venv.rst:44 msgid "" @@ -109,12 +108,12 @@ msgid "" "place it, and run the :mod:`venv` module as a script with the directory " "path::" msgstr "" -"仮想環境を作るには、仮想環境を置くディレクトリを決めて、 そのディレクトリのパ" -"スを指定して、 :mod:`venv` をスクリプトとして実行します::" +"仮想環境を作るには、配置先のディレクトリを決めます。そのパスを指定して :mod:" +"`venv` モジュールをスクリプトとして実行してください::" #: ../../tutorial/venv.rst:47 msgid "python -m venv tutorial-env" -msgstr "" +msgstr "python -m venv tutorial-env" #: ../../tutorial/venv.rst:49 msgid "" @@ -122,8 +121,8 @@ msgid "" "also create directories inside it containing a copy of the Python " "interpreter and various supporting files." msgstr "" -"これは ``tutorial-env`` ディレクトリがなければ作成して、その中に Python イン" -"タプリタ、その他関連するファイルのコピーを含むサブディレクトリを作ります。" +"``tutorial-env`` ディレクトリがなければ作成されます。その中にサブディレクトリ" +"も作られ、Python インタープリタのコピーや各種の補助ファイルが配置されます。" #: ../../tutorial/venv.rst:53 msgid "" @@ -133,30 +132,30 @@ msgid "" "prevents clashing with ``.env`` environment variable definition files that " "some tooling supports." msgstr "" -"仮想環境の一般的なディレクトリの場所は ``.venv`` です。この名前は、通常はシェ" -"ルで隠されているため、ディレクトリが存在する理由を説明する名前を付けても、邪" -"魔にはなりません。また、一部のツールでサポートされている ``.env`` 環境変数定" -"義ファイルによるクラッシュも防止します。" +"仮想環境のディレクトリには ``.venv`` という名前がよく使われます。この名前なら" +"ディレクトリの用途が分かり、通常はシェルで非表示になるため邪魔になりません。" +"また、一部のツールが使う環境変数定義ファイル ``.env`` との名前の衝突も避けら" +"れます。" #: ../../tutorial/venv.rst:59 msgid "Once you've created a virtual environment, you may activate it." -msgstr "仮想環境を作ったら、それを有効化する必要があります。" +msgstr "仮想環境を作ったら、有効化することができます。" #: ../../tutorial/venv.rst:61 msgid "On Windows, run::" -msgstr "Windows の場合::" +msgstr "Windows では次を実行します::" #: ../../tutorial/venv.rst:63 msgid "tutorial-env\\Scripts\\activate" -msgstr "" +msgstr "tutorial-env\\Scripts\\activate" #: ../../tutorial/venv.rst:65 msgid "On Unix or MacOS, run::" -msgstr "Unix や Mac OS の場合::" +msgstr "Unix や macOS では次を実行します::" #: ../../tutorial/venv.rst:67 msgid "source tutorial-env/bin/activate" -msgstr "" +msgstr "source tutorial-env/bin/activate" #: ../../tutorial/venv.rst:69 msgid "" @@ -164,9 +163,9 @@ msgid "" "or :program:`fish` shells, there are alternate ``activate.csh`` and " "``activate.fish`` scripts you should use instead.)" msgstr "" -"(このスクリプトは bash shell で書かれています。 :program:`csh` や :program:" -"`fish` を利用している場合、代わりに利用できる ``activate.csh`` と ``activate." -"fish`` スクリプトがあります。)" +"(このスクリプトは bash シェル用です。:program:`csh` や :program:`fish` を使っ" +"ている場合は、代わりに ``activate.csh`` や ``activate.fish`` スクリプトを使っ" +"てください。)" #: ../../tutorial/venv.rst:74 msgid "" @@ -175,9 +174,9 @@ msgid "" "running ``python`` will get you that particular version and installation of " "Python. For example:" msgstr "" -"仮想環境を有効化すると、シェルのプロンプトに利用中の仮想環境が表示されるよう" -"になり、``python`` を実行するとその仮想環境の Python を実行するようになりま" -"す::" +"仮想環境を有効化すると、使用中の仮想環境がシェルのプロンプトに表示されます。" +"また、``python`` を実行するとその仮想環境の Python が起動するように環境が変更" +"されます。例えば次のようになります:" #: ../../tutorial/venv.rst:79 msgid "" @@ -191,6 +190,15 @@ msgid "" "'~/envs/tutorial-env/lib/python3.5/site-packages']\n" ">>>" msgstr "" +"$ source ~/envs/tutorial-env/bin/activate\n" +"(tutorial-env) $ python\n" +"Python 3.5.1 (default, May 6 2016, 10:59:36)\n" +" ...\n" +">>> import sys\n" +">>> sys.path\n" +"['', '/usr/local/lib/python35.zip', ...,\n" +"'~/envs/tutorial-env/lib/python3.5/site-packages']\n" +">>>" #: ../../tutorial/venv.rst:91 msgid "To deactivate a virtual environment, type::" @@ -198,7 +206,7 @@ msgstr "仮想環境を無効化するには、ターミナルに::" #: ../../tutorial/venv.rst:93 msgid "deactivate" -msgstr "" +msgstr "deactivate" #: ../../tutorial/venv.rst:95 msgid "into the terminal." @@ -215,10 +223,10 @@ msgid "" "Package Index `_. You can browse the Python Package Index " "by going to it in your web browser." msgstr "" -" :program:`pip` と呼ばれるプログラムでパッケージをインストール、アップグレー" -"ド、削除することができます。デフォルトでは ``pip`` は `Python Package Index " -"`_ からパッケージをインストールします。ブラウザを使って " -"Python Package Index を閲覧することができます。" +":program:`pip` というプログラムを使って、パッケージのインストール、アップグ" +"レード、削除ができます。デフォルトでは ``pip`` は `Python Package Index " +"`_ からパッケージをインストールします。Python Package " +"Index はウェブブラウザで閲覧できます。" #: ../../tutorial/venv.rst:105 msgid "" @@ -226,17 +234,16 @@ msgid "" "etc. (Consult the :ref:`installing-index` guide for complete documentation " "for ``pip``.)" msgstr "" -"``pip`` は \"install\" 、 \"uninstall\" 、 \"freeze\" など、いくつかのサブコ" -"マンドを持っています。 (``pip`` の完全なドキュメントは :ref:`installing-" -"index` ガイドを参照してください。)" +"``pip`` には \"install\"、\"uninstall\"、\"freeze\" などのサブコマンドがあり" +"ます。(``pip`` の詳しいドキュメントについては :ref:`installing-index` ガイド" +"を参照してください。)" #: ../../tutorial/venv.rst:109 msgid "" "You can install the latest version of a package by specifying a package's " "name:" msgstr "" -"パッケージ名を指定してそのパッケージの最新版をインストールすることができま" -"す::" +"パッケージ名を指定すると、そのパッケージの最新版をインストールできます:" #: ../../tutorial/venv.rst:111 msgid "" @@ -247,14 +254,20 @@ msgid "" " Running setup.py install for novas\n" "Successfully installed novas-3.1.1.3" msgstr "" +"(tutorial-env) $ python -m pip install novas\n" +"Collecting novas\n" +" Downloading novas-3.1.1.3.tar.gz (136kB)\n" +"Installing collected packages: novas\n" +" Running setup.py install for novas\n" +"Successfully installed novas-3.1.1.3" #: ../../tutorial/venv.rst:120 msgid "" "You can also install a specific version of a package by giving the package " "name followed by ``==`` and the version number:" msgstr "" -"パッケージ名のあとに ``==`` とバージョン番号を付けることで、特定のバージョン" -"のパッケージをインストールすることもできます::" +"パッケージ名の後に ``==`` とバージョン番号を付けると、特定のバージョンをイン" +"ストールすることもできます:" #: ../../tutorial/venv.rst:123 msgid "" @@ -264,6 +277,11 @@ msgid "" "Installing collected packages: requests\n" "Successfully installed requests-2.6.0" msgstr "" +"(tutorial-env) $ python -m pip install requests==2.6.0\n" +"Collecting requests==2.6.0\n" +" Using cached requests-2.6.0-py2.py3-none-any.whl\n" +"Installing collected packages: requests\n" +"Successfully installed requests-2.6.0" #: ../../tutorial/venv.rst:131 msgid "" @@ -272,10 +290,10 @@ msgid "" "number to get that version, or you can run ``python -m pip install --" "upgrade`` to upgrade the package to the latest version:" msgstr "" -"同じコマンドを再び実行した場合、``pip`` は要求されたバージョンがインストール" -"済みだと表示して何もしません。別のバージョン番号を指定すればそのバージョンを" -"インストールしますし、``python -m pip install --upgrade`` を実行すればその" -"パッケージを最新版に更新します::" +"このコマンドを再実行しても、``pip`` は指定されたバージョンがインストール済み" +"であることを確認して何もしません。別のバージョン番号を指定すれば、そのバー" +"ジョンをインストールできます。また、``python -m pip install --upgrade`` を実" +"行すればパッケージを最新版に更新できます:" #: ../../tutorial/venv.rst:136 msgid "" @@ -287,19 +305,26 @@ msgid "" " Successfully uninstalled requests-2.6.0\n" "Successfully installed requests-2.7.0" msgstr "" +"(tutorial-env) $ python -m pip install --upgrade requests\n" +"Collecting requests\n" +"Installing collected packages: requests\n" +" Found existing installation: requests 2.6.0\n" +" Uninstalling requests-2.6.0:\n" +" Successfully uninstalled requests-2.6.0\n" +"Successfully installed requests-2.7.0" #: ../../tutorial/venv.rst:146 msgid "" "``python -m pip uninstall`` followed by one or more package names will " "remove the packages from the virtual environment." msgstr "" -"``python -m pip uninstall`` コマンドに削除するパッケージ名を1つ以上指定しま" -"す。" +"``python -m pip uninstall`` の後に1つ以上のパッケージ名を指定すると、それらの" +"パッケージが仮想環境から削除されます。" #: ../../tutorial/venv.rst:149 msgid "" "``python -m pip show`` will display information about a particular package:" -msgstr "``python -m pip show`` は指定されたパッケージの情報を表示します::" +msgstr "``python -m pip show`` は指定したパッケージの情報を表示します:" #: ../../tutorial/venv.rst:151 msgid "" @@ -316,14 +341,26 @@ msgid "" "Location: /Users/akuchling/envs/tutorial-env/lib/python3.4/site-packages\n" "Requires:" msgstr "" +"(tutorial-env) $ python -m pip show requests\n" +"---\n" +"Metadata-Version: 2.0\n" +"Name: requests\n" +"Version: 2.7.0\n" +"Summary: Python HTTP for Humans.\n" +"Home-page: http://python-requests.org\n" +"Author: Kenneth Reitz\n" +"Author-email: me@kennethreitz.com\n" +"License: Apache 2.0\n" +"Location: /Users/akuchling/envs/tutorial-env/lib/python3.4/site-packages\n" +"Requires:" #: ../../tutorial/venv.rst:166 msgid "" "``python -m pip list`` will display all of the packages installed in the " "virtual environment:" msgstr "" -"``python -m pip list`` は仮想環境にインストールされた全てのパッケージを表示し" -"ます::" +"``python -m pip list`` は仮想環境にインストールされているすべてのパッケージを" +"表示します:" #: ../../tutorial/venv.rst:169 msgid "" @@ -334,6 +371,12 @@ msgid "" "requests (2.7.0)\n" "setuptools (16.0)" msgstr "" +"(tutorial-env) $ python -m pip list\n" +"novas (3.1.1.3)\n" +"numpy (1.9.2)\n" +"pip (7.0.3)\n" +"requests (2.7.0)\n" +"setuptools (16.0)" #: ../../tutorial/venv.rst:178 msgid "" @@ -342,9 +385,9 @@ msgid "" "expects. A common convention is to put this list in a ``requirements.txt`` " "file:" msgstr "" -"``python -m pip freeze`` はインストールされたパッケージ一覧を、``python -m " -"pip install`` が解釈するフォーマットで生成します。一般的な慣習として、このリ" -"ストを ``requirements.txt`` というファイルに保存します:" +"``python -m pip freeze`` もインストール済みのパッケージ一覧を出力しますが、こ" +"ちらは ``python -m pip install`` が受け付ける形式を使います。この一覧は通常、" +"``requirements.txt`` というファイルに保存します:" #: ../../tutorial/venv.rst:182 msgid "" @@ -354,6 +397,11 @@ msgid "" "numpy==1.9.2\n" "requests==2.7.0" msgstr "" +"(tutorial-env) $ python -m pip freeze > requirements.txt\n" +"(tutorial-env) $ cat requirements.txt\n" +"novas==3.1.1.3\n" +"numpy==1.9.2\n" +"requests==2.7.0" #: ../../tutorial/venv.rst:190 msgid "" @@ -361,9 +409,9 @@ msgid "" "shipped as part of an application. Users can then install all the necessary " "packages with ``install -r``:" msgstr "" -"``requirements.txt`` をバージョン管理システムにコミットして、アプリケーション" -"の一部として配布することができます。ユーザーは必要なパッケージを ``install -" -"r`` でインストールできます::" +"``requirements.txt`` はバージョン管理システムにコミットし、アプリケーションの" +"一部として配布できます。ユーザーは ``install -r`` で必要なパッケージをすべて" +"インストールできます:" #: ../../tutorial/venv.rst:194 msgid "" @@ -378,6 +426,16 @@ msgid "" " Running setup.py install for novas\n" "Successfully installed novas-3.1.1.3 numpy-1.9.2 requests-2.7.0" msgstr "" +"(tutorial-env) $ python -m pip install -r requirements.txt\n" +"Collecting novas==3.1.1.3 (from -r requirements.txt (line 1))\n" +" ...\n" +"Collecting numpy==1.9.2 (from -r requirements.txt (line 2))\n" +" ...\n" +"Collecting requests==2.7.0 (from -r requirements.txt (line 3))\n" +" ...\n" +"Installing collected packages: novas, numpy, requests\n" +" Running setup.py install for novas\n" +"Successfully installed novas-3.1.1.3 numpy-1.9.2 requests-2.7.0" #: ../../tutorial/venv.rst:207 msgid "" @@ -386,7 +444,7 @@ msgid "" "want to make it available on the Python Package Index, consult the `Python " "packaging user guide`_." msgstr "" -"``pip`` にはたくさんのオプションがあります。 ``pip`` の完全なドキュメントは :" -"ref:`installing-index` を参照してください。パッケージを作成してそれを Python " -"Package Index で公開したい場合、 `Python packaging user guide`_ を参照してく" -"ださい。" +"``pip`` にはほかにも多くのオプションがあります。``pip`` の詳しいドキュメント" +"については :ref:`installing-index` ガイドを参照してください。作成したパッケー" +"ジを Python Package Index で公開するには、`Python packaging user guide`_ を参" +"照してください。" diff --git a/tutorial/whatnow.po b/tutorial/whatnow.po index ad6948ea3..61248851f 100644 --- a/tutorial/whatnow.po +++ b/tutorial/whatnow.po @@ -17,10 +17,10 @@ msgstr "" "Last-Translator: Takanori Suzuki , 2023\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../tutorial/whatnow.rst:5 @@ -125,13 +125,12 @@ msgstr "" "名の本Python Cookbook (O'Reilly & Associates, ISBN 0-596-00797-3)に収録されて" "います。" -#: ../../tutorial/whatnow.rst:48 msgid "" "https://pyvideo.org collects links to Python-related videos from conferences " "and user-group meetings." msgstr "" -"https://pyvideo.org は学会やユーザグループの会合から Python 関連のビデオのリ" -"ンクを集めています。" +"https://pyvideo.org には、カンファレンスやユーザグループの会合で行われた " +"Python 関連の発表などの動画へのリンクが集められています。" #: ../../tutorial/whatnow.rst:51 msgid "" diff --git a/using/cmdline.po b/using/cmdline.po index d3df55a1e..1848c7fd1 100644 --- a/using/cmdline.po +++ b/using/cmdline.po @@ -21,10 +21,10 @@ msgstr "" "Last-Translator: Takuya Futatsugi, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../using/cmdline.rst:9 @@ -39,13 +39,12 @@ msgstr "" "CPython インタプリタはコマンドラインと環境を読み取って様々な設定を行ないま" "す。" -#: ../../using/cmdline.rst:16 msgid "" "Other implementations' command line schemes may differ. See :ref:" "`implementations` for further resources." msgstr "" -"他の実装のコマンドラインスキームは CPython とは異なります。さらなる情報は :" -"ref:`implementations` を参照してください。" +"ほかの実装では、コマンドラインの形式が異なる場合があります。\n" +"関連情報は :ref:`implementations` を参照してください。" #: ../../using/cmdline.rst:23 msgid "Command line" @@ -55,11 +54,12 @@ msgstr "コマンドライン" msgid "When invoking Python, you may specify any of these options::" msgstr "Python を起動するとき、以下のうち任意のオプションを指定できます::" -#: ../../using/cmdline.rst:27 msgid "" "python [-bBdEhiIOPqRsSuvVWx?] [-c command | -m module-name | script | - ] " "[args]" msgstr "" +"python [-bBdEhiIOPqRsSuvVWx?] [-c command | -m module-name | script | - ] " +"[args]" #: ../../using/cmdline.rst:29 msgid "" @@ -67,9 +67,8 @@ msgid "" msgstr "" "もちろん、もっとも一般的な利用方法は、単純にスクリプトを起動することです::" -#: ../../using/cmdline.rst:31 msgid "python myscript.py" -msgstr "" +msgstr "python myscript.py" #: ../../using/cmdline.rst:37 msgid "Interface options" @@ -83,13 +82,17 @@ msgstr "" "インタプリタのインターフェイスは UNIX シェルのものに似ていますが、より多くの" "起動方法を提供しています:" -#: ../../using/cmdline.rst:42 msgid "" "When called with standard input connected to a tty device, it prompts for " "commands and executes them until an EOF (an end-of-file character, you can " "produce that with :kbd:`Ctrl-D` on UNIX or :kbd:`Ctrl-Z, Enter` on Windows) " "is read. For more on interactive mode, see :ref:`tut-interac`." msgstr "" +"標準入力が tty デバイスに接続された状態で起動すると、EOF (ファイル終端文字) " +"を読み込むまで、コマンドの入力を促して実行する処理を繰り返します。\n" +"EOF は UNIX では :kbd:`Ctrl-D`、Windows では :kbd:`Ctrl-Z, Enter` で入力でき" +"ます。\n" +"対話モードについて詳しくは、:ref:`tut-interac` を参照してください。" #: ../../using/cmdline.rst:46 msgid "" @@ -130,26 +133,26 @@ msgid "" "In non-interactive mode, the entire input is parsed before it is executed." msgstr "非インタラクティブモードでは、入力の全体が実行前にパースされます。" -#: ../../using/cmdline.rst:58 msgid "" "An interface option terminates the list of options consumed by the " "interpreter, all consecutive arguments will end up in :data:`sys.argv` -- " "note that the first element, subscript zero (``sys.argv[0]``), is a string " "reflecting the program's source." msgstr "" -"インタプリタによって消費されるオプションリストが終了したあと、継続する全ての" -"引数は :data:`sys.argv` に渡ります。 -- ただし、添字 0 の先頭要素(``sys." -"argv[0]``) はプログラムのソース自体を示す文字列です。" +"インターフェイスオプションは、インタープリタが処理するオプションのリストを終" +"了させます。\n" +"それ以降の引数はすべて :data:`sys.argv` に格納されます。\n" +"ただし、添字がゼロの最初の要素 (``sys.argv[0]``) は、プログラムのソースを表す" +"文字列になります。" -#: ../../using/cmdline.rst:65 msgid "" "Execute the Python code in *command*. *command* can be one or more " "statements separated by newlines, with significant leading whitespace as in " "normal module code." msgstr "" -"*command* 内の Python コードを実行します。 *command* は改行によって区切られた" -"1行以上の文です。通常のモジュールのコードと同じく、行頭の空白文字は意味を持ち" -"ます。" +"*command* 内の Python コードを実行します。\n" +"*command* には、改行で区切って 1 つ以上の文を指定できます。\n" +"通常のモジュールのコードと同様に、行頭の空白文字は意味を持ちます。" #: ../../using/cmdline.rst:69 msgid "" @@ -163,17 +166,15 @@ msgstr "" "ディレクトリにあるモジュールをトップレベルモジュールとして import 出来るよう" "になります)。" -#: ../../using/cmdline.rst:74 msgid "" "Raises an :ref:`auditing event ` ``cpython.run_command`` with " "argument ``command``." msgstr "" "引数 ``command`` を指定して :ref:`監査イベント ` ``cpython." -"run_command`` を送出します。 " +"run_command`` を送出します。" -#: ../../using/cmdline.rst:76 msgid "*command* is automatically dedented before execution." -msgstr "" +msgstr "*command* は実行前に自動で共通のインデントが取り除かれます。" #: ../../using/cmdline.rst:81 msgid "" @@ -231,12 +232,15 @@ msgstr "" "は ``\"-m\"`` に設定されます)。 :option:`-c` オプションと同様に、カレントディ" "レクトリが :data:`sys.path` の先頭に追加されます。" -#: ../../using/cmdline.rst:108 msgid "" ":option:`-I` option can be used to run the script in isolated mode where :" "data:`sys.path` contains neither the current directory nor the user's site-" "packages directory. All ``PYTHON*`` environment variables are ignored, too." msgstr "" +":option:`-I` オプションを使うと、:data:`sys.path` にカレントディレクトリも" +"ユーザーの site-packages ディレクトリも含まれない隔離モードで、スクリプトを実" +"行できます。\n" +"すべての ``PYTHON*`` 環境変数も無視されます。" #: ../../using/cmdline.rst:113 msgid "" @@ -246,19 +250,19 @@ msgstr "" "多くの標準ライブラリモジュールにはスクリプトとして実行された時のためのコード" "があります。例えば、 :mod:`timeit` モジュールは次のように実行可能です::" -#: ../../using/cmdline.rst:116 msgid "" "python -m timeit -s \"setup here\" \"benchmarked code here\"\n" "python -m timeit -h # for details" msgstr "" +"python -m timeit -s \"setup here\" \"benchmarked code here\"\n" +"python -m timeit -h # 詳細を表示" -#: ../../using/cmdline.rst:119 msgid "" "Raises an :ref:`auditing event ` ``cpython.run_module`` with " "argument ``module-name``." msgstr "" "引数 ``module-name`` を指定して :ref:`監査イベント ` ``cpython." -"run_module`` を送出します。 " +"run_module`` を送出します。" #: ../../using/cmdline.rst:122 msgid ":func:`runpy.run_module`" @@ -272,9 +276,10 @@ msgstr "Python コードで直接使える等価な機能" msgid ":pep:`338` -- Executing modules as scripts" msgstr ":pep:`338` - モジュールをスクリプトとして実行する" -#: ../../using/cmdline.rst:127 msgid "Supply the package name to run a ``__main__`` submodule." -msgstr "``__main__`` サブモジュールを実行するパッケージ名が提供されました。" +msgstr "" +"パッケージ名を指定して ``__main__`` サブモジュールを実行できるようになりまし" +"た。" #: ../../using/cmdline.rst:130 msgid "namespace packages are also supported" @@ -297,13 +302,12 @@ msgstr "" "このオプションが指定された場合、 :data:`sys.argv` の最初の要素は ``\"-\"`` " "で、カレントディレクトリが :data:`sys.path` の先頭に追加されます。" -#: ../../using/cmdline.rst:144 ../../using/cmdline.rst:827 msgid "" "Raises an :ref:`auditing event ` ``cpython.run_stdin`` with no " "arguments." msgstr "" "引数無しで :ref:`監査イベント ` ``cpython.run_stdin`` を送出しま" -"す。 " +"す。" #: ../../using/cmdline.rst:150 msgid "" @@ -335,30 +339,31 @@ msgstr "" "レクトリが :data:`sys.path` の先頭に追加され、そのファイルは :mod:`__main__` " "モジュールとして実行されます。" -#: ../../using/cmdline.rst:162 msgid "" "If the script name refers to a directory or zipfile, the script name is " "added to the start of :data:`sys.path` and the ``__main__.py`` file in that " "location is executed as the :mod:`__main__` module." msgstr "" -"スクリプト名がディレクトリか zip ファイルを指定していた場合、スクリプト名が :" -"data:`sys.path` に追加され、その中の ``__main__.py`` ファイルが :mod:" -"`__main__` モジュールとして実行されます。" +"スクリプト名がディレクトリまたは zip ファイルを指す場合、スクリプト名が :" +"data:`sys.path` の先頭に追加され、その場所にある ``__main__.py`` ファイルが :" +"mod:`__main__` モジュールとして実行されます。" -#: ../../using/cmdline.rst:166 msgid "" ":option:`-I` option can be used to run the script in isolated mode where :" "data:`sys.path` contains neither the script's directory nor the user's site-" "packages directory. All ``PYTHON*`` environment variables are ignored, too." msgstr "" +":option:`-I` オプションを使うと、:data:`sys.path` にスクリプトのディレクトリ" +"もユーザーの site-packages ディレクトリも含まれない隔離モードで、スクリプトを" +"実行できます。\n" +"すべての ``PYTHON*`` 環境変数も無視されます。" -#: ../../using/cmdline.rst:171 msgid "" "Raises an :ref:`auditing event ` ``cpython.run_file`` with " "argument ``filename``." msgstr "" "引数 ``filename`` を指定して :ref:`監査イベント ` ``cpython." -"run_file`` を送出します。 " +"run_file`` を送出します。" #: ../../using/cmdline.rst:174 msgid ":func:`runpy.run_path`" @@ -389,43 +394,41 @@ msgstr "タブ補完と履歴の編集が自動的に有効化されます。" msgid "Generic options" msgstr "一般オプション" -#: ../../using/cmdline.rst:199 msgid "" "Print a short description of all command line options and corresponding " "environment variables and exit." msgstr "" +"すべてのコマンドラインオプションと、それぞれに対応する環境変数の短い説明を表" +"示して終了します。" -#: ../../using/cmdline.rst:204 msgid "" "Print a short description of Python-specific environment variables and exit." -msgstr "" +msgstr "Python 固有の環境変数の短い説明を表示して終了します。" -#: ../../using/cmdline.rst:211 msgid "" "Print a description of implementation-specific :option:`-X` options and exit." -msgstr "" +msgstr "実装固有の :option:`-X` オプションの説明を表示して終了します。" -#: ../../using/cmdline.rst:218 msgid "Print complete usage information and exit." -msgstr "" +msgstr "使用方法のすべての情報を表示して終了します。" #: ../../using/cmdline.rst:225 msgid "Print the Python version number and exit. Example output could be:" msgstr "Python のバージョン番号を表示して終了します。出力の例:" -#: ../../using/cmdline.rst:227 msgid "Python 3.8.0b2+" -msgstr "" +msgstr "Python 3.8.0b2+" #: ../../using/cmdline.rst:231 msgid "When given twice, print more information about the build, like:" msgstr "2つ指定すると、次のようにより多くのビルドの情報を表示します:" -#: ../../using/cmdline.rst:233 msgid "" "Python 3.8.0b2+ (3.8:0c076caaa8, Apr 20 2019, 21:55:00)\n" "[GCC 6.2.0 20161005]" msgstr "" +"Python 3.8.0b2+ (3.8:0c076caaa8, Apr 20 2019, 21:55:00)\n" +"[GCC 6.2.0 20161005]" #: ../../using/cmdline.rst:238 msgid "The ``-VV`` option." @@ -435,17 +438,20 @@ msgstr "``-VV`` オプション。" msgid "Miscellaneous options" msgstr "その他のオプション" -#: ../../using/cmdline.rst:249 msgid "" "Issue a warning when converting :class:`bytes` or :class:`bytearray` to :" "class:`str` without specifying encoding or comparing :class:`!bytes` or :" "class:`!bytearray` with :class:`!str` or :class:`!bytes` with :class:`int`. " "Issue an error when the option is given twice (:option:`!-bb`)." msgstr "" +"エンコーディングを指定せずに :class:`bytes` または :class:`bytearray` を :" +"class:`str` に変換した場合、:class:`!bytes` または :class:`!bytearray` を :" +"class:`!str` と比較した場合、あるいは :class:`!bytes` を :class:`int` と比較" +"した場合に、警告を出します。\n" +"オプションを 2 回指定した場合 (:option:`!-bb`) は、エラーを発生させます。" -#: ../../using/cmdline.rst:254 msgid "Affects also comparisons of :class:`bytes` with :class:`int`." -msgstr "" +msgstr ":class:`bytes` と :class:`int` の比較にも影響するようになりました。" #: ../../using/cmdline.rst:259 msgid "" @@ -456,7 +462,6 @@ msgstr "" "作成を試みません。 :envvar:`PYTHONDONTWRITEBYTECODE` 環境変数も参照してくださ" "い。" -#: ../../using/cmdline.rst:265 msgid "" "Control the validation behavior of hash-based ``.pyc`` files. See :ref:`pyc-" "invalidation`. When set to ``default``, checked and unchecked hash-based " @@ -466,62 +471,72 @@ msgid "" "to ``never``, hash-based ``.pyc`` files are not validated against their " "corresponding source files." msgstr "" +"ハッシュベースの ``.pyc`` ファイルの検証方法を制御します。\n" +":ref:`pyc-invalidation` を参照してください。\n" +"``default`` に設定した場合、検証付きと検証なしのハッシュベースのバイトコード" +"キャッシュファイルは、それぞれのデフォルトの意味に従って検証されます。\n" +"``always`` に設定した場合、すべてのハッシュベースの ``.pyc`` ファイルが、検証" +"付きか検証なしかにかかわらず、対応するソースファイルと照合されます。\n" +"``never`` に設定した場合、ハッシュベースの ``.pyc`` ファイルは、対応するソー" +"スファイルと照合されません。" -#: ../../using/cmdline.rst:273 msgid "" "The semantics of timestamp-based ``.pyc`` files are unaffected by this " "option." msgstr "" +"タイムスタンプベースの ``.pyc`` ファイルの扱いは、このオプションの影響を受け" +"ません。" -#: ../../using/cmdline.rst:279 msgid "" "Turn on parser debugging output (for expert only). See also the :envvar:" "`PYTHONDEBUG` environment variable." msgstr "" +"パーサのデバッグ出力を有効にします (上級者向け)。\n" +":envvar:`PYTHONDEBUG` 環境変数も参照してください。" -#: ../../using/cmdline.rst:282 msgid "" "This option requires a :ref:`debug build of Python `, otherwise " "it's ignored." msgstr "" +"このオプションには :ref:`Python のデバッグビルド ` が必要で、そ" +"れ以外では無視されます。" -#: ../../using/cmdline.rst:288 msgid "" "Ignore all ``PYTHON*`` environment variables, e.g. :envvar:`PYTHONPATH` and :" "envvar:`PYTHONHOME`, that might be set." msgstr "" +":envvar:`PYTHONPATH` や :envvar:`PYTHONHOME` など、設定されているすべての " +"``PYTHON*`` 環境変数を無視します。" -#: ../../using/cmdline.rst:291 msgid "See also the :option:`-P` and :option:`-I` (isolated) options." msgstr "" +":option:`-P` および :option:`-I` (隔離モード) オプションも参照してください。" -#: ../../using/cmdline.rst:296 msgid "Enter interactive mode after execution." -msgstr "" +msgstr "実行後に対話モードに入ります。" -#: ../../using/cmdline.rst:298 msgid "" "Using the :option:`-i` option will enter interactive mode in any of the " "following circumstances\\:" msgstr "" +":option:`-i` オプションを使うと、次のいずれの場合にも対話モードに入ります\\:" -#: ../../using/cmdline.rst:300 msgid "When a script is passed as first argument" -msgstr "" +msgstr "最初の引数としてスクリプトが渡された場合" -#: ../../using/cmdline.rst:301 msgid "When the :option:`-c` option is used" -msgstr "" +msgstr ":option:`-c` オプションを使用した場合" -#: ../../using/cmdline.rst:302 msgid "When the :option:`-m` option is used" -msgstr "" +msgstr ":option:`-m` オプションを使用した場合" -#: ../../using/cmdline.rst:304 msgid "" "Interactive mode will start even when :data:`sys.stdin` does not appear to " "be a terminal. The :envvar:`PYTHONSTARTUP` file is not read." msgstr "" +":data:`sys.stdin` がターミナルでないと判断された場合でも、対話モードが開始し" +"ます。\n" +":envvar:`PYTHONSTARTUP` ファイルは読み込まれません。" #: ../../using/cmdline.rst:307 msgid "" @@ -540,60 +555,73 @@ msgstr "" "Python を隔離モードで実行します。:option:`-E`、:option:`-P`、および :option:" "`-s` オプションも暗黙的に指定されます。" -#: ../../using/cmdline.rst:316 msgid "" "In isolated mode :data:`sys.path` contains neither the script's directory " "nor the user's site-packages directory. All ``PYTHON*`` environment " "variables are ignored, too. Further restrictions may be imposed to prevent " "the user from injecting malicious code." msgstr "" +"隔離モードでは、:data:`sys.path` にスクリプトのディレクトリもユーザーの site-" +"packages ディレクトリも含まれません。\n" +"すべての ``PYTHON*`` 環境変数も無視されます。\n" +"ユーザーによる悪意のあるコードの注入を防ぐため、さらに制限が課される場合もあ" +"ります。" -#: ../../using/cmdline.rst:326 msgid "" "Remove assert statements and any code conditional on the value of :const:" "`__debug__`. Augment the filename for compiled (:term:`bytecode`) files by " "adding ``.opt-1`` before the ``.pyc`` extension (see :pep:`488`). See also :" "envvar:`PYTHONOPTIMIZE`." msgstr "" +"assert 文と、:const:`__debug__` の値を条件とするコードを取り除きます。\n" +"コンパイル済み (:term:`バイトコード `) ファイルの名前は、``.pyc`` " +"拡張子の前に ``.opt-1`` を追加したものになります (:pep:`488` を参照)。\n" +":envvar:`PYTHONOPTIMIZE` も参照してください。" #: ../../using/cmdline.rst:331 ../../using/cmdline.rst:341 msgid "Modify ``.pyc`` filenames according to :pep:`488`." msgstr ":pep:`488` に従って ``.pyc`` ファイル名を変更します。" -#: ../../using/cmdline.rst:337 msgid "" "Do :option:`-O` and also discard docstrings. Augment the filename for " "compiled (:term:`bytecode`) files by adding ``.opt-2`` before the ``.pyc`` " "extension (see :pep:`488`)." msgstr "" +":option:`-O` の処理に加えて、ドキュメンテーション文字列も取り除きます。\n" +"コンパイル済み (:term:`バイトコード `) ファイルの名前は、``.pyc`` " +"拡張子の前に ``.opt-2`` を追加したものになります (:pep:`488` を参照)。" -#: ../../using/cmdline.rst:347 msgid "Don't prepend a potentially unsafe path to :data:`sys.path`:" -msgstr "" +msgstr "安全でない可能性のあるパスを :data:`sys.path` の先頭に追加しません:" -#: ../../using/cmdline.rst:349 msgid "" "``python -m module`` command line: Don't prepend the current working " "directory." msgstr "" +"コマンドラインが ``python -m module`` の場合、カレント作業ディレクトリを先頭" +"に追加しません。" -#: ../../using/cmdline.rst:351 msgid "" "``python script.py`` command line: Don't prepend the script's directory. If " "it's a symbolic link, resolve symbolic links." msgstr "" +"コマンドラインが ``python script.py`` の場合、スクリプトのディレクトリを先頭" +"に追加しません。\n" +"スクリプトがシンボリックリンクの場合は、シンボリックリンクを解決します。" -#: ../../using/cmdline.rst:353 msgid "" "``python -c code`` and ``python`` (REPL) command lines: Don't prepend an " "empty string, which means the current working directory." msgstr "" +"コマンドラインが ``python -c code`` または ``python`` (REPL) の場合、カレント" +"作業ディレクトリを意味する空文字列を先頭に追加しません。" -#: ../../using/cmdline.rst:356 msgid "" "See also the :envvar:`PYTHONSAFEPATH` environment variable, and :option:`-E` " "and :option:`-I` (isolated) options." msgstr "" +":envvar:`PYTHONSAFEPATH` 環境変数と、:option:`-E` および :option:`-I` (隔離" +"モード) オプションも参照してください。" #: ../../using/cmdline.rst:364 msgid "" @@ -608,7 +636,6 @@ msgid "" "randomization is enabled by default." msgstr "" -#: ../../using/cmdline.rst:375 msgid "" "On previous versions of Python, this option turns on hash randomization, so " "that the :meth:`~object.__hash__` values of str and bytes objects are " @@ -616,6 +643,11 @@ msgid "" "constant within an individual Python process, they are not predictable " "between repeated invocations of Python." msgstr "" +"以前のバージョンの Python では、このオプションはハッシュのランダム化を有効に" +"し、str オブジェクトと bytes オブジェクトの :meth:`~object.__hash__` の値に、" +"予測不能なランダムな値による「ソルト」を加えます。\n" +"ハッシュ値は、個々の Python プロセス内では一定ですが、Python を起動し直した場" +"合の値を予測することはできません。" #: ../../using/cmdline.rst:381 msgid "" @@ -625,13 +657,12 @@ msgid "" "http://ocert.org/advisories/ocert-2011-003.html for details." msgstr "" -#: ../../using/cmdline.rst:386 msgid "" ":envvar:`PYTHONHASHSEED` allows you to set a fixed value for the hash seed " "secret." msgstr "" -":envvar:`PYTHONHASHSEED` によってハッシュシードの固定値を秘密にすることが出来" -"ます。" +":envvar:`PYTHONHASHSEED` を使うと、ハッシュのシードに使う秘密の値を固定値に設" +"定できます。" #: ../../using/cmdline.rst:391 msgid "The option is no longer ignored." @@ -645,9 +676,8 @@ msgstr "" ":data:`ユーザのサイトパッケージのディレクトリ ` を :data:" "`sys.path` に追加しません。" -#: ../../using/cmdline.rst:400 msgid "See also :envvar:`PYTHONNOUSERSITE`." -msgstr "" +msgstr ":envvar:`PYTHONNOUSERSITE` も参照してください。" #: ../../using/cmdline.rst:404 ../../using/cmdline.rst:924 #: ../../using/cmdline.rst:936 @@ -666,19 +696,21 @@ msgstr "" "import しても、これらの操作は実行されません (実行したい場合は、 :func:`site." "main` を呼び出してください)。" -#: ../../using/cmdline.rst:417 msgid "" "Force the stdout and stderr streams to be unbuffered. This option has no " "effect on the stdin stream." msgstr "" +"stdout と stderr のストリームでバッファリングを行わないように強制します。\n" +"このオプションは stdin ストリームには影響しません。" #: ../../using/cmdline.rst:420 msgid "See also :envvar:`PYTHONUNBUFFERED`." msgstr ":envvar:`PYTHONUNBUFFERED` も参照してください。" -#: ../../using/cmdline.rst:422 msgid "The text layer of the stdout and stderr streams now is unbuffered." msgstr "" +"stdout と stderr のストリームのテキスト層で、バッファリングを行わなくなりまし" +"た。" #: ../../using/cmdline.rst:428 msgid "" @@ -693,11 +725,12 @@ msgstr "" "たファイルごとにメッセージを出力します。また、終了時のモジュールクリーンアッ" "プに関する情報も提供します。" -#: ../../using/cmdline.rst:433 msgid "" "The :mod:`site` module reports the site-specific paths and :file:`.pth` " "files being processed." msgstr "" +":mod:`site` モジュールが、処理中のサイト固有のパスと :file:`.pth` ファイルを" +"報告するようになりました。" #: ../../using/cmdline.rst:437 msgid "See also :envvar:`PYTHONVERBOSE`." @@ -711,14 +744,14 @@ msgstr "" "警告制御。 Python の警告機構はデフォルトでは警告メッセージを :data:`sys." "stderr` に表示します。" -#: ../../using/cmdline.rst:446 ../../using/cmdline.rst:952 msgid "" "The simplest settings apply a particular action unconditionally to all " "warnings emitted by a process (even those that are otherwise ignored by " "default)::" msgstr "" +"最も単純な設定では、プロセスが出すすべての警告に、特定のアクションを無条件で" +"適用します (通常はデフォルトで無視される警告も対象です)。 ::" -#: ../../using/cmdline.rst:450 msgid "" "-Wdefault # Warn once per call location\n" "-Werror # Convert to exceptions\n" @@ -728,34 +761,46 @@ msgid "" "-Wonce # Warn once per Python process\n" "-Wignore # Never warn" msgstr "" +"-Wdefault # 呼び出し箇所ごとに一度警告\n" +"-Werror # 例外に変換\n" +"-Walways # 毎回警告\n" +"-Wall # -Walways と同じ\n" +"-Wmodule # 呼び出し元モジュールごとに一度警告\n" +"-Wonce # Python プロセスごとに一度警告\n" +"-Wignore # 警告しない" -#: ../../using/cmdline.rst:458 msgid "" "The action names can be abbreviated as desired and the interpreter will " "resolve them to the appropriate action name. For example, ``-Wi`` is the " "same as ``-Wignore``." msgstr "" +"アクション名は任意の長さに省略でき、インタープリタが適切なアクション名に解決" +"します。\n" +"例えば、``-Wi`` は ``-Wignore`` と同じです。" #: ../../using/cmdline.rst:462 msgid "The full form of argument is::" msgstr "引数の完全形は次のようになります::" -#: ../../using/cmdline.rst:464 msgid "action:message:category:module:lineno" -msgstr "" +msgstr "action:message:category:module:lineno" -#: ../../using/cmdline.rst:466 msgid "" "Empty fields match all values; trailing empty fields may be omitted. For " "example ``-W ignore::DeprecationWarning`` ignores all DeprecationWarning " "warnings." msgstr "" +"空のフィールドはすべての値にマッチします。\n" +"末尾の空のフィールドは省略できます。\n" +"例えば、``-W ignore::DeprecationWarning`` はすべての DeprecationWarning 警告" +"を無視します。" -#: ../../using/cmdline.rst:470 msgid "" "The *action* field is as explained above but only applies to warnings that " "match the remaining fields." msgstr "" +"*action* フィールドは前述のとおりですが、残りのフィールドにマッチする警告にだ" +"け適用されます。" #: ../../using/cmdline.rst:473 msgid "" @@ -763,13 +808,17 @@ msgid "" "insensitive." msgstr "" -#: ../../using/cmdline.rst:476 msgid "" "The *category* field matches the warning category (ex: " "``DeprecationWarning``). This must be a class name; the match test whether " "the actual warning category of the message is a subclass of the specified " "warning category." msgstr "" +"*category* フィールドは警告カテゴリ (例: ``DeprecationWarning``) とマッチしま" +"す。\n" +"このフィールドにはクラス名を指定する必要があります。\n" +"メッセージの実際の警告カテゴリが、指定した警告カテゴリのサブクラスかどうかが" +"調べられます。" #: ../../using/cmdline.rst:481 msgid "" @@ -777,31 +826,35 @@ msgid "" "case-sensitive." msgstr "" -#: ../../using/cmdline.rst:484 msgid "" "The *lineno* field matches the line number, where zero matches all line " "numbers and is thus equivalent to an omitted line number." msgstr "" +"*lineno* フィールドは行番号とマッチします。\n" +"ゼロはすべての行番号にマッチするため、行番号を省略した場合と同じです。" -#: ../../using/cmdline.rst:487 msgid "" "Multiple :option:`-W` options can be given; when a warning matches more than " "one option, the action for the last matching option is performed. Invalid :" "option:`-W` options are ignored (though, a warning message is printed about " "invalid options when the first warning is issued)." msgstr "" -"複数の :option:`-W` オプションを指定することができます。警告が1つ以上のオプ" -"ションとマッチしたときは、最後にマッチしたオプションのアクションが有効になり" -"ます。不正な :option:`-W` オプションは無視されます (最初の警告が発生したとき" -"に、不正なオプションに対する警告メッセージが表示されます)。" +"複数の :option:`-W` オプションを指定できます。\n" +"警告が複数のオプションにマッチした場合は、最後にマッチしたオプションのアク" +"ションが実行されます。\n" +"不正な :option:`-W` オプションは無視されます (ただし、最初の警告が出される際" +"に、不正なオプションについての警告メッセージが表示されます)。" -#: ../../using/cmdline.rst:492 msgid "" "Warnings can also be controlled using the :envvar:`PYTHONWARNINGS` " "environment variable and from within a Python program using the :mod:" "`warnings` module. For example, the :func:`warnings.filterwarnings` function " "can be used to use a regular expression on the warning message." msgstr "" +"警告は :envvar:`PYTHONWARNINGS` 環境変数や、Python プログラム内から :mod:" +"`warnings` モジュールを使って制御することもできます。\n" +"例えば、:func:`warnings.filterwarnings` 関数を使うと、警告メッセージに対して" +"正規表現を使用できます。" #: ../../using/cmdline.rst:497 ../../using/cmdline.rst:964 msgid "" @@ -827,21 +880,23 @@ msgstr "" "様々な実装固有のオプションのために予約されています。現在のところ CPython は以" "下の値を定義しています:" -#: ../../using/cmdline.rst:512 msgid "" "``-X faulthandler`` to enable :mod:`faulthandler`. See also :envvar:" "`PYTHONFAULTHANDLER`." msgstr "" +"``-X faulthandler`` は :mod:`faulthandler` を有効にします。\n" +":envvar:`PYTHONFAULTHANDLER` も参照してください。" -#: ../../using/cmdline.rst:517 msgid "" "``-X showrefcount`` to output the total reference count and number of used " "memory blocks when the program finishes or after each statement in the " "interactive interpreter. This only works on :ref:`debug builds `." msgstr "" +"``-X showrefcount`` は、プログラムの終了時、または対話的インタープリタでの各" +"文の実行後に、参照カウントの合計と使用中のメモリブロック数を出力します。\n" +":ref:`デバッグビルド ` でのみ動作します。" -#: ../../using/cmdline.rst:524 msgid "" "``-X tracemalloc`` to start tracing Python memory allocations using the :mod:" "`tracemalloc` module. By default, only the most recent frame is stored in a " @@ -849,68 +904,94 @@ msgid "" "traceback limit of *NFRAME* frames. See :func:`tracemalloc.start` and :" "envvar:`PYTHONTRACEMALLOC` for more information." msgstr "" +"``-X tracemalloc`` は、:mod:`tracemalloc` モジュールを使って Python のメモリ" +"割り当ての追跡を開始します。\n" +"デフォルトでは、追跡結果のトレースバックには最新のフレームのみが保存されま" +"す。\n" +"トレースバックを最大 *NFRAME* フレームに制限して追跡を開始するには、``-X " +"tracemalloc=NFRAME`` を使います。\n" +"詳細は :func:`tracemalloc.start` と :envvar:`PYTHONTRACEMALLOC` を参照してく" +"ださい。" -#: ../../using/cmdline.rst:533 msgid "" "``-X int_max_str_digits`` configures the :ref:`integer string conversion " "length limitation `. See also :envvar:" "`PYTHONINTMAXSTRDIGITS`." msgstr "" +"``-X int_max_str_digits`` は :ref:`整数と文字列の間の変換の長さ制限 " +"` を設定します。\n" +":envvar:`PYTHONINTMAXSTRDIGITS` も参照してください。" -#: ../../using/cmdline.rst:539 msgid "" "``-X importtime`` to show how long each import takes. It shows module name, " "cumulative time (including nested imports) and self time (excluding nested " "imports). Note that its output may be broken in multi-threaded " "application. Typical usage is ``python -X importtime -c 'import asyncio'``." msgstr "" +"``-X importtime`` は、各インポートにかかる時間を表示します。\n" +"モジュール名、累積時間 (ネストされたインポートを含む)、自身の処理時間 (ネスト" +"されたインポートを除く) を表示します。\n" +"マルチスレッドのアプリケーションでは、出力が崩れる場合があります。\n" +"典型的な使い方は ``python -X importtime -c 'import asyncio'`` です。" -#: ../../using/cmdline.rst:544 msgid "" "``-X importtime=2`` enables additional output that indicates when an " "imported module has already been loaded. In such cases, the string " "``cached`` will be printed in both time columns." msgstr "" +"``-X importtime=2`` は、インポートされたモジュールがすでに読み込まれている場" +"合に、そのことを示す追加の出力を有効にします。\n" +"この場合、両方の時間の列に文字列 ``cached`` が表示されます。" -#: ../../using/cmdline.rst:548 msgid "See also :envvar:`PYTHONPROFILEIMPORTTIME`." -msgstr "" +msgstr ":envvar:`PYTHONPROFILEIMPORTTIME` も参照してください。" -#: ../../using/cmdline.rst:554 msgid "" "Added ``-X importtime=2`` to also trace imports of loaded modules, and " "reserved values other than ``1`` and ``2`` for future use." msgstr "" +"読み込み済みのモジュールのインポートも追跡する ``-X importtime=2`` を追加し、" +"``1`` と ``2`` 以外の値を将来のために予約しました。" -#: ../../using/cmdline.rst:557 msgid "" "``-X dev``: enable :ref:`Python Development Mode `, introducing " "additional runtime checks that are too expensive to be enabled by default. " "See also :envvar:`PYTHONDEVMODE`." msgstr "" +"``-X dev`` は :ref:`Python 開発モード ` を有効にします。\n" +"このモードでは、負荷が大きいためデフォルトでは有効にできない追加の実行時" +"チェックを行います。\n" +":envvar:`PYTHONDEVMODE` も参照してください。" -#: ../../using/cmdline.rst:563 msgid "" "``-X utf8`` enables the :ref:`Python UTF-8 Mode `. ``-X utf8=0`` " "explicitly disables :ref:`Python UTF-8 Mode ` (even when it would " "otherwise activate automatically). See also :envvar:`PYTHONUTF8`." msgstr "" +"``-X utf8`` は :ref:`Python UTF-8 モード ` を有効にします。\n" +"``-X utf8=0`` は、通常なら自動で有効になる場合でも、:ref:`Python UTF-8 モー" +"ド ` を明示的に無効にします。\n" +":envvar:`PYTHONUTF8` も参照してください。" -#: ../../using/cmdline.rst:570 msgid "" "``-X pycache_prefix=PATH`` enables writing ``.pyc`` files to a parallel tree " "rooted at the given directory instead of to the code tree. See also :envvar:" "`PYTHONPYCACHEPREFIX`." msgstr "" +"``-X pycache_prefix=PATH`` は、コードツリー内ではなく、指定したディレクトリを" +"ルートとする対応する別のツリー内に ``.pyc`` ファイルを書き込むようにしま" +"す。\n" +":envvar:`PYTHONPYCACHEPREFIX` も参照してください。" -#: ../../using/cmdline.rst:576 msgid "" "``-X warn_default_encoding`` issues a :class:`EncodingWarning` when the " "locale-specific default encoding is used for opening files. See also :envvar:" "`PYTHONWARNDEFAULTENCODING`." msgstr "" +"``-X warn_default_encoding`` は、ファイルを開く際にロケール固有のデフォルトの" +"エンコーディングが使われると、:class:`EncodingWarning` を発生させます。\n" +":envvar:`PYTHONWARNDEFAULTENCODING` も参照してください。" -#: ../../using/cmdline.rst:582 msgid "" "``-X no_debug_ranges`` disables the inclusion of the tables mapping extra " "location information (end line, start column offset and end column offset) " @@ -919,6 +1000,13 @@ msgid "" "location indicators when the interpreter displays tracebacks. See also :" "envvar:`PYTHONNODEBUGRANGES`." msgstr "" +"``-X no_debug_ranges`` は、コードオブジェクトの各命令に追加の位置情報 (終了" +"行、開始列のオフセット、終了列のオフセット) を対応付けるテーブルを含めないよ" +"うにします。\n" +"これは、コードオブジェクトや pyc ファイルを小さくしたい場合や、インタープリタ" +"がトレースバックを表示する際に追加の位置を示す表示を抑制したい場合に役立ちま" +"す。\n" +":envvar:`PYTHONNODEBUGRANGES` も参照してください。" #: ../../using/cmdline.rst:591 msgid "" @@ -932,7 +1020,6 @@ msgid "" "`PYTHON_FROZEN_MODULES`." msgstr "" -#: ../../using/cmdline.rst:602 msgid "" "``-X perf`` enables support for the Linux ``perf`` profiler. When this " "option is provided, the ``perf`` profiler will be able to report Python " @@ -940,8 +1027,14 @@ msgid "" "if is not supported on the current system. The default value is \"off\". See " "also :envvar:`PYTHONPERFSUPPORT` and :ref:`perf_profiling`." msgstr "" +"``-X perf`` は、Linux の ``perf`` プロファイラのサポートを有効にします。\n" +"このオプションを指定すると、``perf`` プロファイラが Python の呼び出しを報告で" +"きるようになります。\n" +"このオプションは一部のプラットフォームでのみ利用でき、現在のシステムでサポー" +"トされていない場合は何も行いません。\n" +"デフォルトの値は \"off\" です。\n" +":envvar:`PYTHONPERFSUPPORT` と :ref:`perf_profiling` も参照してください。" -#: ../../using/cmdline.rst:610 msgid "" "``-X perf_jit`` enables support for the Linux ``perf`` profiler with DWARF " "support. When this option is provided, the ``perf`` profiler will be able to " @@ -950,6 +1043,15 @@ msgid "" "system. The default value is \"off\". See also :envvar:" "`PYTHON_PERF_JIT_SUPPORT` and :ref:`perf_profiling`." msgstr "" +"``-X perf_jit`` は、DWARF に対応した Linux の ``perf`` プロファイラのサポート" +"を有効にします。\n" +"このオプションを指定すると、``perf`` プロファイラが DWARF 情報を使って " +"Python の呼び出しを報告できるようになります。\n" +"このオプションは一部のプラットフォームでのみ利用でき、現在のシステムでサポー" +"トされていない場合は何も行いません。\n" +"デフォルトの値は \"off\" です。\n" +":envvar:`PYTHON_PERF_JIT_SUPPORT` と :ref:`perf_profiling` も参照してくださ" +"い。" #: ../../using/cmdline.rst:619 msgid "" @@ -959,14 +1061,15 @@ msgid "" "for execution in the current process." msgstr "" -#: ../../using/cmdline.rst:624 msgid "" "This option is only available on some platforms and will do nothing if is " "not supported on the current system. See also :envvar:" "`PYTHON_DISABLE_REMOTE_DEBUG` and :pep:`768`." msgstr "" +"このオプションは一部のプラットフォームでのみ利用でき、現在のシステムでサポー" +"トされていない場合は何も行いません。\n" +":envvar:`PYTHON_DISABLE_REMOTE_DEBUG` と :pep:`768` も参照してください。" -#: ../../using/cmdline.rst:630 msgid "" ":samp:`-X cpu_count={n}` overrides :func:`os.cpu_count`, :func:`os." "process_cpu_count`, and :func:`multiprocessing.cpu_count`. *n* must be " @@ -974,6 +1077,13 @@ msgid "" "limit CPU resources of a container system. See also :envvar:" "`PYTHON_CPU_COUNT`. If *n* is ``default``, nothing is overridden." msgstr "" +":samp:`-X cpu_count={n}` は :func:`os.cpu_count`、:func:`os." +"process_cpu_count`、:func:`multiprocessing.cpu_count` を上書きします。\n" +"*n* は 1 以上でなければなりません。\n" +"このオプションは、コンテナシステムの CPU リソースを制限する必要がある場合に役" +"立つことがあります。\n" +":envvar:`PYTHON_CPU_COUNT` も参照してください。\n" +"*n* が ``default`` の場合、上書きは行われません。" #: ../../using/cmdline.rst:639 msgid "" @@ -985,13 +1095,17 @@ msgid "" "for this option to exist. See also :envvar:`PYTHON_PRESITE`." msgstr "" -#: ../../using/cmdline.rst:648 msgid "" ":samp:`-X gil={0,1}` forces the GIL to be disabled or enabled, respectively. " "Setting to ``0`` is only available in builds configured with :option:`--" "disable-gil`. See also :envvar:`PYTHON_GIL` and :ref:`whatsnew313-free-" "threaded-cpython`." msgstr "" +":samp:`-X gil={0,1}` は、それぞれ GIL を強制的に無効または有効にします。\n" +"``0`` への設定は、:option:`--disable-gil` を指定して構成したビルドでのみ利用" +"できます。\n" +":envvar:`PYTHON_GIL` と :ref:`whatsnew313-free-threaded-cpython` も参照してく" +"ださい。" #: ../../using/cmdline.rst:655 msgid "" @@ -1002,7 +1116,6 @@ msgid "" "and to ``0`` otherwise. See also :envvar:`PYTHON_THREAD_INHERIT_CONTEXT`." msgstr "" -#: ../../using/cmdline.rst:664 msgid "" ":samp:`-X context_aware_warnings={0,1}` causes the :class:`warnings." "catch_warnings` context manager to use a :class:`~contextvars.ContextVar` to " @@ -1010,6 +1123,12 @@ msgid "" "``1`` on free-threaded builds and to ``0`` otherwise. See also :envvar:" "`PYTHON_CONTEXT_AWARE_WARNINGS`." msgstr "" +":samp:`-X context_aware_warnings={0,1}` を ``1`` に設定すると、:class:" +"`warnings.catch_warnings` コンテキストマネージャは、警告フィルタの状態の保存" +"に :class:`~contextvars.ContextVar` を使います。\n" +"未設定の場合、このオプションのデフォルト値は、フリースレッドビルドでは " +"``1``、それ以外では ``0`` です。\n" +":envvar:`PYTHON_CONTEXT_AWARE_WARNINGS` も参照してください。" #: ../../using/cmdline.rst:672 msgid "" @@ -1018,19 +1137,18 @@ msgid "" msgstr "" "任意の値を渡し、 :data:`sys._xoptions` 辞書から取り出すことも出来ます。" -#: ../../using/cmdline.rst:677 msgid "Removed the ``-X showalloccount`` option." -msgstr "" +msgstr "``-X showalloccount`` オプションは削除されました。" -#: ../../using/cmdline.rst:680 msgid "Removed the ``-X oldparser`` option." -msgstr "" +msgstr "``-X oldparser`` オプションは削除されました。" -#: ../../using/cmdline.rst:685 msgid "" ":option:`!-J` is no longer reserved for use by Jython_, and now has no " "special meaning." msgstr "" +":option:`!-J` は Jython_ 用に予約されなくなり、特別な意味を持たなくなりまし" +"た。" #: ../../using/cmdline.rst:693 msgid "Controlling color" @@ -1166,17 +1284,19 @@ msgstr "" "ディレクトリが :envvar:`PYTHONPATH` の手前に追加されます。検索パスは Python " "プログラムから :data:`sys.path` 変数として操作することができます。" -#: ../../using/cmdline.rst:761 msgid "" "If this is set to a non-empty string, don't prepend a potentially unsafe " "path to :data:`sys.path`: see the :option:`-P` option for details." msgstr "" +"空でない文字列を設定すると、安全でない可能性のあるパスを :data:`sys.path` の" +"先頭に追加しなくなります。\n" +"詳細は :option:`-P` オプションを参照してください。" -#: ../../using/cmdline.rst:769 msgid "" "If this is set to a non-empty string, it overrides the :data:`sys." "platlibdir` value." msgstr "" +"空でない文字列を設定すると、:data:`sys.platlibdir` の値を上書きします。" #: ../../using/cmdline.rst:777 msgid "" @@ -1196,11 +1316,12 @@ msgstr "" "このファイルの中で、プロンプト :data:`sys.ps1` や :data:`sys.ps2`、ならびに" "フック :data:`sys.__interactivehook__` も変更できます。" -#: ../../using/cmdline.rst:784 ../../using/cmdline.rst:786 msgid "" "Raises an :ref:`auditing event ` ``cpython.run_startup`` with the " "filename as the argument when called on startup." msgstr "" +"起動時に呼び出されると、ファイル名を引数として :ref:`監査イベント " +"` ``cpython.run_startup`` を送出します。" #: ../../using/cmdline.rst:792 msgid "" @@ -1212,7 +1333,6 @@ msgstr "" "等価です。整数を設定した場合、 :option:`-O` を複数回指定したのと同じになりま" "す。" -#: ../../using/cmdline.rst:799 msgid "" "If this is set, it names a callable using dotted-path notation. The module " "containing the callable will be imported and then the callable will be run " @@ -1222,6 +1342,15 @@ msgid "" "the string \"0\" causes the default implementation of :func:`sys." "breakpointhook` to do nothing but return immediately." msgstr "" +"設定する場合は、ドット区切りのパス表記で呼び出し可能オブジェクトを指定しま" +"す。\n" +"そのオブジェクトを含むモジュールがインポートされ、続いて :func:`sys." +"breakpointhook` のデフォルト実装によってそのオブジェクトが呼び出されます。\n" +"このフック自体は、組み込みの :func:`breakpoint` から呼び出されます。\n" +"未設定の場合、または空文字列に設定した場合は、値 \"pdb.set_trace\" を指定した" +"場合と同じです。\n" +"文字列 \"0\" を設定すると、:func:`sys.breakpointhook` のデフォルト実装は何も" +"行わず、直ちに戻ります。" #: ../../using/cmdline.rst:811 msgid "" @@ -1233,11 +1362,12 @@ msgstr "" "等価です。整数を指定した場合、 :option:`-d` を複数回指定したのと同じになりま" "す。" -#: ../../using/cmdline.rst:815 msgid "" "This environment variable requires a :ref:`debug build of Python `, otherwise it's ignored." msgstr "" +"この環境変数には :ref:`Python のデバッグビルド ` が必要で、それ" +"以外では無視されます。" #: ../../using/cmdline.rst:821 msgid "" @@ -1255,15 +1385,18 @@ msgstr "" "この変数は Python コードから :data:`os.environ` を使って変更して、プログラム" "終了時のインスペクトモードを強制することができます。" -#: ../../using/cmdline.rst:829 msgid "(also 3.11.10, 3.10.15, 3.9.20, and 3.8.20) Emits audit events." msgstr "" +"(3.11.10、3.10.15、3.9.20、3.8.20 も同様) 監査イベントを送出するようになりま" +"した。" -#: ../../using/cmdline.rst:832 msgid "" "Uses PyREPL if possible, in which case :envvar:`PYTHONSTARTUP` is also " "executed. Emits audit events." msgstr "" +"可能な場合は PyREPL を使用するようになり、その場合は :envvar:`PYTHONSTARTUP` " +"も実行されます。\n" +"監査イベントを送出するようになりました。" #: ../../using/cmdline.rst:839 msgid "" @@ -1301,13 +1434,16 @@ msgstr "" "ト時に ``.pyc`` ファイルを作成しようとはしなくなります。\n" ":option:`-B` オプションを指定するのと等価です。" -#: ../../using/cmdline.rst:865 msgid "" "If this is set, Python will write ``.pyc`` files in a mirror directory tree " "at this path, instead of in ``__pycache__`` directories within the source " "tree. This is equivalent to specifying the :option:`-X` " "``pycache_prefix=PATH`` option." msgstr "" +"設定すると、Python はソースツリー内の ``__pycache__`` ディレクトリではなく、" +"このパスを起点としてソースツリーに対応するディレクトリツリー内に ``.pyc`` " +"ファイルを書き込みます。\n" +":option:`-X` ``pycache_prefix=PATH`` オプションの指定と同じです。" #: ../../using/cmdline.rst:875 msgid "" @@ -1343,12 +1479,13 @@ msgstr "" "整数は [0,4294967295] の十進数でなければなりません。0 を指定するとハッシュラ" "ンダム化は無効化されます。" -#: ../../using/cmdline.rst:893 msgid "" "If this variable is set to an integer, it is used to configure the " "interpreter's global :ref:`integer string conversion length limitation " "`." msgstr "" +"整数を設定すると、インタープリタ全体の :ref:`整数と文字列の間の変換の長さ制" +"限 ` を設定するために使われます。" #: ../../using/cmdline.rst:901 msgid "" @@ -1374,13 +1511,17 @@ msgstr "" msgid "The ``encodingname`` part is now optional." msgstr "``encodingname`` の部分が任意になりました。" -#: ../../using/cmdline.rst:912 msgid "" "On Windows, the encoding specified by this variable is ignored for " "interactive console buffers unless :envvar:`PYTHONLEGACYWINDOWSSTDIO` is " "also specified. Files and pipes redirected through the standard streams are " "not affected." msgstr "" +"Windows では、:envvar:`PYTHONLEGACYWINDOWSSTDIO` も指定しない限り、この変数で" +"指定したエンコーディングは対話型コンソールのバッファに対しては無視されま" +"す。\n" +"標準ストリームでリダイレクトされたファイルやパイプは、この制限の影響を受けま" +"せん。" #: ../../using/cmdline.rst:919 msgid "" @@ -1390,13 +1531,16 @@ msgstr "" "この環境変数が設定されている場合、 Python は :data:`ユーザ site-packages ディ" "レクトリ ` を :data:`sys.path` に追加しません。" -#: ../../using/cmdline.rst:929 msgid "" "Defines the :data:`user base directory `, which is used to " "compute the path of the :data:`user site-packages directory ` and :ref:`installation paths ` for " "``python -m pip install --user``." msgstr "" +":data:`ユーザーベースディレクトリ ` を定義します。\n" +"このディレクトリは、:data:`ユーザーの site-packages ディレクトリ ` のパスと、``python -m pip install --user`` の :ref:`インストール" +"先のパス ` を求めるために使われます。" #: ../../using/cmdline.rst:941 msgid "" @@ -1406,14 +1550,15 @@ msgstr "" "この環境変数が設定された場合、 ``sys.argv[0]`` に、C ランタイムから取得した値" "の代わりにこの環境変数の値が設定されます。macOS でのみ動作します。" -#: ../../using/cmdline.rst:947 msgid "" "This is equivalent to the :option:`-W` option. If set to a comma separated " "string, it is equivalent to specifying :option:`-W` multiple times, with " "filters later in the list taking precedence over those earlier in the list." msgstr "" +":option:`-W` オプションと同じです。\n" +"コンマで区切った文字列を設定すると、:option:`-W` を複数回指定した場合と同じに" +"なり、リストの後ろにあるフィルタが前にあるフィルタより優先されます。" -#: ../../using/cmdline.rst:956 msgid "" "PYTHONWARNINGS=default # Warn once per call location\n" "PYTHONWARNINGS=error # Convert to exceptions\n" @@ -1423,8 +1568,14 @@ msgid "" "PYTHONWARNINGS=once # Warn once per Python process\n" "PYTHONWARNINGS=ignore # Never warn" msgstr "" +"PYTHONWARNINGS=default # 呼び出し箇所ごとに一度警告\n" +"PYTHONWARNINGS=error # 例外に変換\n" +"PYTHONWARNINGS=always # 毎回警告\n" +"PYTHONWARNINGS=all # PYTHONWARNINGS=always と同じ\n" +"PYTHONWARNINGS=module # 呼び出し元モジュールごとに一度警告\n" +"PYTHONWARNINGS=once # Python プロセスごとに一度警告\n" +"PYTHONWARNINGS=ignore # 警告しない" -#: ../../using/cmdline.rst:970 msgid "" "If this environment variable is set to a non-empty string, :func:" "`faulthandler.enable` is called at startup: install a handler for :const:" @@ -1432,8 +1583,12 @@ msgid "" "`~signal.SIGBUS` and :const:`~signal.SIGILL` signals to dump the Python " "traceback. This is equivalent to :option:`-X` ``faulthandler`` option." msgstr "" +"空でない文字列を設定すると、起動時に :func:`faulthandler.enable` を呼び出し、" +"Python のトレースバックをダンプするハンドラを :const:`~signal.SIGSEGV`、:" +"const:`~signal.SIGFPE`、:const:`~signal.SIGABRT`、:const:`~signal.SIGBUS`、:" +"const:`~signal.SIGILL` の各シグナルに設定します。\n" +":option:`-X` ``faulthandler`` オプションの指定と同じです。" -#: ../../using/cmdline.rst:982 msgid "" "If this environment variable is set to a non-empty string, start tracing " "Python memory allocations using the :mod:`tracemalloc` module. The value of " @@ -1442,19 +1597,29 @@ msgid "" "frame. See the :func:`tracemalloc.start` function for more information. This " "is equivalent to setting the :option:`-X` ``tracemalloc`` option." msgstr "" +"空でない文字列を設定すると、:mod:`tracemalloc` モジュールを使って Python のメ" +"モリ割り当ての追跡を開始します。\n" +"この変数の値は、追跡結果のトレースバックに保存するフレーム数の上限です。\n" +"例えば、``PYTHONTRACEMALLOC=1`` は最新のフレームだけを保存します。\n" +"詳細は :func:`tracemalloc.start` 関数を参照してください。\n" +":option:`-X` ``tracemalloc`` オプションの設定と同じです。" -#: ../../using/cmdline.rst:995 msgid "" "If this environment variable is set to ``1``, Python will show how long each " "import takes. If set to ``2``, Python will include output for imported " "modules that have already been loaded. This is equivalent to setting the :" "option:`-X` ``importtime`` option." msgstr "" +"``1`` を設定すると、Python は各インポートにかかる時間を表示します。\n" +"``2`` を設定すると、インポートしたモジュールがすでに読み込まれている場合の出" +"力も含まれます。\n" +":option:`-X` ``importtime`` オプションの設定と同じです。" -#: ../../using/cmdline.rst:1004 msgid "" "Added ``PYTHONPROFILEIMPORTTIME=2`` to also trace imports of loaded modules." msgstr "" +"読み込み済みのモジュールのインポートも追跡する ``PYTHONPROFILEIMPORTTIME=2`` " +"を追加しました。" #: ../../using/cmdline.rst:1009 msgid "" @@ -1464,66 +1629,74 @@ msgstr "" "この環境変数が空でない文字列に設定された場合、:mod:`asyncio` モジュールの :" "ref:`デバッグモード ` が有効化されます。" -#: ../../using/cmdline.rst:1017 msgid "Set the Python memory allocators and/or install debug hooks." msgstr "" +"Python のメモリアロケータの設定や、デバッグフックのインストールを行います。" -#: ../../using/cmdline.rst:1019 msgid "Set the family of memory allocators used by Python:" -msgstr "" +msgstr "Python が使うメモリアロケータの種類を設定します:" -#: ../../using/cmdline.rst:1021 msgid "" "``default``: use the :ref:`default memory allocators `." msgstr "" +"``default``: :ref:`デフォルトのメモリアロケータ ` " +"を使います。" -#: ../../using/cmdline.rst:1023 msgid "" "``malloc``: use the :c:func:`malloc` function of the C library for all " "domains (:c:macro:`PYMEM_DOMAIN_RAW`, :c:macro:`PYMEM_DOMAIN_MEM`, :c:macro:" "`PYMEM_DOMAIN_OBJ`)." msgstr "" +"``malloc``: すべてのドメイン (:c:macro:`PYMEM_DOMAIN_RAW`、:c:macro:" +"`PYMEM_DOMAIN_MEM`、:c:macro:`PYMEM_DOMAIN_OBJ`) に C ライブラリの :c:func:" +"`malloc` 関数を使います。" -#: ../../using/cmdline.rst:1026 msgid "" "``pymalloc``: use the :ref:`pymalloc allocator ` for :c:macro:" "`PYMEM_DOMAIN_MEM` and :c:macro:`PYMEM_DOMAIN_OBJ` domains and use the :c:" "func:`malloc` function for the :c:macro:`PYMEM_DOMAIN_RAW` domain." msgstr "" +"``pymalloc``: :c:macro:`PYMEM_DOMAIN_MEM` および :c:macro:`PYMEM_DOMAIN_OBJ` " +"ドメインには :ref:`pymalloc アロケータ ` を使い、:c:macro:" +"`PYMEM_DOMAIN_RAW` ドメインには :c:func:`malloc` 関数を使います。" -#: ../../using/cmdline.rst:1029 msgid "" "``mimalloc``: use the :ref:`mimalloc allocator ` for :c:macro:" "`PYMEM_DOMAIN_MEM` and :c:macro:`PYMEM_DOMAIN_OBJ` domains and use the :c:" "func:`malloc` function for the :c:macro:`PYMEM_DOMAIN_RAW` domain." msgstr "" +"``mimalloc``: :c:macro:`PYMEM_DOMAIN_MEM` および :c:macro:`PYMEM_DOMAIN_OBJ` " +"ドメインには :ref:`mimalloc アロケータ ` を使い、:c:macro:" +"`PYMEM_DOMAIN_RAW` ドメインには :c:func:`malloc` 関数を使います。" -#: ../../using/cmdline.rst:1033 msgid "Install :ref:`debug hooks `:" -msgstr "" +msgstr ":ref:`デバッグフック ` をインストールします:" -#: ../../using/cmdline.rst:1035 msgid "" "``debug``: install debug hooks on top of the :ref:`default memory allocators " "`." msgstr "" +"``debug``: :ref:`デフォルトのメモリアロケータ ` に" +"デバッグフックを追加します。" -#: ../../using/cmdline.rst:1037 msgid "``malloc_debug``: same as ``malloc`` but also install debug hooks." msgstr "" +"``malloc_debug``: ``malloc`` と同じですが、デバッグフックもインストールしま" +"す。" -#: ../../using/cmdline.rst:1038 msgid "``pymalloc_debug``: same as ``pymalloc`` but also install debug hooks." msgstr "" +"``pymalloc_debug``: ``pymalloc`` と同じですが、デバッグフックもインストールし" +"ます。" -#: ../../using/cmdline.rst:1039 msgid "``mimalloc_debug``: same as ``mimalloc`` but also install debug hooks." msgstr "" +"``mimalloc_debug``: ``mimalloc`` と同じですが、デバッグフックもインストールし" +"ます。" -#: ../../using/cmdline.rst:1043 msgid "Added the ``\"default\"`` allocator." -msgstr "" +msgstr "``\"default\"`` アロケータを追加しました。" #: ../../using/cmdline.rst:1049 msgid "" @@ -1542,56 +1715,66 @@ msgid "" "Python is configured without ``pymalloc`` support." msgstr "" -#: ../../using/cmdline.rst:1057 msgid "" "This variable can now also be used on Python compiled in release mode. It " "now has no effect if set to an empty string." msgstr "" +"リリースモードでコンパイルされた Python でも、この変数を使用できるようになり" +"ました。\n" +"空文字列に設定した場合は、効果がなくなりました。" -#: ../../using/cmdline.rst:1064 msgid "" "If set to a non-empty string, the default :term:`filesystem encoding and " "error handler` mode will revert to their pre-3.6 values of 'mbcs' and " "'replace', respectively. Otherwise, the new defaults 'utf-8' and " "'surrogatepass' are used." msgstr "" +"空でない文字列を設定すると、デフォルトの :term:`ファイルシステムのエンコー" +"ディングとエラーハンドラ ` のモード" +"が、3.6 より前の値である、それぞれ 'mbcs' と 'replace' に戻ります。\n" +"それ以外の場合は、新しいデフォルト値の 'utf-8' と 'surrogatepass' が使われま" +"す。" -#: ../../using/cmdline.rst:1069 msgid "" "This may also be enabled at runtime with :func:`sys." "_enablelegacywindowsfsencoding`." msgstr "" +":func:`sys._enablelegacywindowsfsencoding` を使うと、実行時に有効にすることも" +"できます。" -#: ../../using/cmdline.rst:1072 ../../using/cmdline.rst:1086 -#: ../../using/cmdline.rst:1137 msgid "Availability" -msgstr "" +msgstr "利用可能な環境" #: ../../using/cmdline.rst:1074 msgid "See :pep:`529` for more details." msgstr "より詳しくは :pep:`529` を参照してください。" -#: ../../using/cmdline.rst:1079 msgid "" "If set to a non-empty string, does not use the new console reader and " "writer. This means that Unicode characters will be encoded according to the " "active console code page, rather than using utf-8." msgstr "" +"空でない文字列を設定すると、新しいコンソールの読み書き処理を使わなくなりま" +"す。\n" +"つまり、Unicode 文字は utf-8 ではなく、有効なコンソールコードページに従ってエ" +"ンコードされます。" -#: ../../using/cmdline.rst:1083 msgid "" "This variable is ignored if the standard streams are redirected (to files or " "pipes) rather than referring to console buffers." msgstr "" +"標準ストリームがコンソールバッファを参照せず、ファイルやパイプにリダイレクト" +"されている場合は、この変数は無視されます。" -#: ../../using/cmdline.rst:1093 msgid "" "If set to the value ``0``, causes the main Python command line application " "to skip coercing the legacy ASCII-based C and POSIX locales to a more " "capable UTF-8 based alternative." msgstr "" +"値を ``0`` に設定すると、Python のメインのコマンドラインアプリケーションは、" +"従来の ASCII ベースの C および POSIX ロケールを、より機能の豊富な UTF-8 ベー" +"スのロケールに強制変換しなくなります。" -#: ../../using/cmdline.rst:1097 msgid "" "If this variable is *not* set (or is set to a value other than ``0``), the " "``LC_ALL`` locale override environment variable is also not set, and the " @@ -1601,6 +1784,11 @@ msgid "" "``LC_CTYPE`` category in the order listed before loading the interpreter " "runtime:" msgstr "" +"この変数が *未設定* (または ``0`` 以外の値に設定されている) で、ロケールを上" +"書きする ``LC_ALL`` 環境変数も未設定であり、``LC_CTYPE`` カテゴリの現在のロ" +"ケールがデフォルトの ``C`` ロケールまたは明示的に ASCII ベースとされた " +"``POSIX`` ロケールの場合、Python CLI はインタープリタのランタイムを読み込む前" +"に、次のロケールを記載順に ``LC_CTYPE`` カテゴリに設定しようとします:" #: ../../using/cmdline.rst:1105 msgid "``C.UTF-8``" @@ -1614,7 +1802,6 @@ msgstr "``C.utf8``" msgid "``UTF-8``" msgstr "``UTF-8``" -#: ../../using/cmdline.rst:1109 msgid "" "If setting one of these locale categories succeeds, then the ``LC_CTYPE`` " "environment variable will also be set accordingly in the current process " @@ -1626,8 +1813,16 @@ msgid "" "in operations that query the environment rather than the current C locale " "(such as Python's own :func:`locale.getdefaultlocale`)." msgstr "" +"これらのロケールカテゴリのいずれかの設定に成功すると、Python ランタイムの初期" +"化前に、現在のプロセスの環境内の ``LC_CTYPE`` 環境変数にも同じ設定を適用しま" +"す。\n" +"これにより、更新された設定は、インタープリタ自体と、同じプロセス内で動作する" +"ロケールに対応したほかの構成要素 (GNU の ``readline`` ライブラリなど) の両方" +"に加えて、サブプロセスにも伝わります (そのプロセスが Python インタープリタを" +"実行しているかどうかは問いません)。\n" +"また、現在の C ロケールではなく環境を照会する操作 (Python 自体の :func:" +"`locale.getdefaultlocale` など) にも伝わります。" -#: ../../using/cmdline.rst:1119 msgid "" "Configuring one of these locales (either explicitly or via the above " "implicit locale coercion) automatically enables the ``surrogateescape`` :ref:" @@ -1636,16 +1831,25 @@ msgid "" "in any other locale). This stream handling behavior can be overridden using :" "envvar:`PYTHONIOENCODING` as usual." msgstr "" +"これらのロケールのいずれかを、明示的に、または上記の暗黙的なロケールの強制変" +"換によって設定すると、:data:`sys.stdin` と :data:`sys.stdout` に対して " +"``surrogateescape`` :ref:`エラーハンドラ ` が自動的に有効にな" +"ります (:data:`sys.stderr` は、ほかのロケールと同じく ``backslashreplace`` を" +"使い続けます)。\n" +"このストリームの処理方法は、通常と同様に :envvar:`PYTHONIOENCODING` で上書き" +"できます。" -#: ../../using/cmdline.rst:1126 msgid "" "For debugging purposes, setting ``PYTHONCOERCECLOCALE=warn`` will cause " "Python to emit warning messages on ``stderr`` if either the locale coercion " "activates, or else if a locale that *would* have triggered coercion is still " "active when the Python runtime is initialized." msgstr "" +"デバッグのために ``PYTHONCOERCECLOCALE=warn`` を設定すると、ロケールの強制変" +"換が行われた場合、または強制変換の対象 *となるはずの* ロケールが Python ラン" +"タイムの初期化時にまだ有効だった場合に、Python は ``stderr`` に警告メッセージ" +"を出力します。" -#: ../../using/cmdline.rst:1131 msgid "" "Also note that even when locale coercion is disabled, or when it fails to " "find a suitable target locale, :envvar:`PYTHONUTF8` will still activate by " @@ -1653,44 +1857,53 @@ msgid "" "order to force the interpreter to use ``ASCII`` instead of ``UTF-8`` for " "system interfaces." msgstr "" +"ロケールの強制変換を無効にした場合や、適切な変換先のロケールが見つからなかっ" +"た場合でも、従来の ASCII ベースのロケールでは :envvar:`PYTHONUTF8` がデフォル" +"トで有効になる点にも注意してください。\n" +"システムインターフェースでインタープリタに ``UTF-8`` の代わりに ``ASCII`` を" +"使わせるには、両方の機能を無効にする必要があります。" #: ../../using/cmdline.rst:1139 msgid "See :pep:`538` for more details." msgstr "より詳しくは :pep:`538` を参照をしてください。" -#: ../../using/cmdline.rst:1145 msgid "" "If this environment variable is set to a non-empty string, enable :ref:" "`Python Development Mode `, introducing additional runtime checks " "that are too expensive to be enabled by default. This is equivalent to " "setting the :option:`-X` ``dev`` option." msgstr "" +"空でない文字列を設定すると、:ref:`Python 開発モード ` が有効になり、" +"負荷が大きいためデフォルトでは有効にできない追加の実行時チェックを行いま" +"す。\n" +":option:`-X` ``dev`` オプションの設定と同じです。" -#: ../../using/cmdline.rst:1154 msgid "If set to ``1``, enable the :ref:`Python UTF-8 Mode `." msgstr "" +"``1`` を設定すると、:ref:`Python UTF-8 モード ` を有効にします。" -#: ../../using/cmdline.rst:1156 msgid "If set to ``0``, disable the :ref:`Python UTF-8 Mode `." msgstr "" +"``0`` を設定すると、:ref:`Python UTF-8 モード ` を無効にします。" -#: ../../using/cmdline.rst:1158 msgid "" "Setting any other non-empty string causes an error during interpreter " "initialisation." msgstr "" +"それ以外の空でない文字列を設定すると、インタープリタの初期化中にエラーが発生" +"します。" -#: ../../using/cmdline.rst:1165 msgid "" "If this environment variable is set to a non-empty string, issue a :class:" "`EncodingWarning` when the locale-specific default encoding is used." msgstr "" +"空でない文字列を設定すると、ロケール固有のデフォルトのエンコーディングを使用" +"した場合に :class:`EncodingWarning` が発生します。" #: ../../using/cmdline.rst:1168 msgid "See :ref:`io-encoding-warning` for details." msgstr "詳細は :ref:`io-encoding-warning` を参照してください。" -#: ../../using/cmdline.rst:1174 msgid "" "If this variable is set, it disables the inclusion of the tables mapping " "extra location information (end line, start column offset and end column " @@ -1698,57 +1911,70 @@ msgid "" "code objects and pyc files are desired as well as suppressing the extra " "visual location indicators when the interpreter displays tracebacks." msgstr "" +"設定すると、コードオブジェクトの各命令に追加の位置情報 (終了行、開始列のオフ" +"セット、終了列のオフセット) を対応付けるテーブルを含めないようにします。\n" +"これは、コードオブジェクトや pyc ファイルを小さくしたい場合や、インタープリタ" +"がトレースバックを表示する際に追加の位置を示す表示を抑制したい場合に役立ちま" +"す。" -#: ../../using/cmdline.rst:1184 msgid "" "If this variable is set to a nonzero value, it enables support for the Linux " "``perf`` profiler so Python calls can be detected by it." msgstr "" +"ゼロ以外の値を設定すると、Linux の ``perf`` プロファイラのサポートが有効にな" +"り、Python の呼び出しを検出できるようになります。" -#: ../../using/cmdline.rst:1187 ../../using/cmdline.rst:1200 msgid "If set to ``0``, disable Linux ``perf`` profiler support." msgstr "" +"``0`` を設定すると、Linux の ``perf`` プロファイラのサポートを無効にします。" -#: ../../using/cmdline.rst:1189 msgid "" "See also the :option:`-X perf <-X>` command-line option and :ref:" "`perf_profiling`." msgstr "" +":option:`-X perf <-X>` コマンドラインオプションと :ref:`perf_profiling` も参" +"照してください。" -#: ../../using/cmdline.rst:1196 msgid "" "If this variable is set to a nonzero value, it enables support for the Linux " "``perf`` profiler so Python calls can be detected by it using DWARF " "information." msgstr "" +"ゼロ以外の値を設定すると、Linux の ``perf`` プロファイラのサポートが有効にな" +"り、DWARF 情報を使って Python の呼び出しを検出できるようになります。" -#: ../../using/cmdline.rst:1202 msgid "" "See also the :option:`-X perf_jit <-X>` command-line option and :ref:" "`perf_profiling`." msgstr "" +":option:`-X perf_jit <-X>` コマンドラインオプションと :ref:`perf_profiling` " +"も参照してください。" -#: ../../using/cmdline.rst:1209 msgid "" "If this variable is set to a non-empty string, it disables the remote " "debugging feature described in :pep:`768`. This includes both the " "functionality to schedule code for execution in another process and the " "functionality to receive code for execution in the current process." msgstr "" +"空でない文字列を設定すると、:pep:`768` で説明されているリモートデバッグ機能を" +"無効にします。\n" +"これには、別のプロセスでのコード実行を予約する機能と、現在のプロセスで実行す" +"るコードを受け取る機能の両方が含まれます。" #: ../../using/cmdline.rst:1214 msgid "See also the :option:`-X disable_remote_debug` command-line option." msgstr "" -#: ../../using/cmdline.rst:1220 msgid "" "If this variable is set to a positive integer, it overrides the return " "values of :func:`os.cpu_count` and :func:`os.process_cpu_count`." msgstr "" +"正の整数を設定すると、:func:`os.cpu_count` と :func:`os.process_cpu_count` の" +"戻り値を上書きします。" -#: ../../using/cmdline.rst:1223 msgid "See also the :option:`-X cpu_count <-X>` command-line option." msgstr "" +":option:`-X cpu_count <-X>` コマンドラインオプションも参照してください。" #: ../../using/cmdline.rst:1229 msgid "" @@ -1761,16 +1987,18 @@ msgid "" "flag is set to ``off``." msgstr "" -#: ../../using/cmdline.rst:1237 msgid "See also the :option:`-X frozen_modules <-X>` command-line option." msgstr "" +":option:`-X frozen_modules <-X>` コマンドラインオプションも参照してください。" -#: ../../using/cmdline.rst:1243 msgid "" "If this variable is set to ``1``, the interpreter will colorize various " "kinds of output. Setting it to ``0`` deactivates this behavior. See also :" "ref:`using-on-controlling-color`." msgstr "" +"``1`` を設定すると、インタープリタはさまざまな出力に色を付けます。\n" +"``0`` を設定すると、この動作を無効にします。\n" +":ref:`using-on-controlling-color` も参照してください。" #: ../../using/cmdline.rst:1251 msgid "" @@ -1779,25 +2007,30 @@ msgid "" "`readline`, and will instead use the traditional parser-based :term:`REPL`." msgstr "" -#: ../../using/cmdline.rst:1260 msgid "" "This environment variable can be used to set the location of a ``." "python_history`` file (by default, it is ``.python_history`` in the user's " "home directory)." msgstr "" +"この環境変数を使うと、``.python_history`` ファイルの場所を設定できます (デ" +"フォルトは、ユーザーのホームディレクトリ内の ``.python_history`` です)。" -#: ../../using/cmdline.rst:1268 msgid "" "If this variable is set to ``1``, the global interpreter lock (GIL) will be " "forced on. Setting it to ``0`` forces the GIL off (needs Python configured " "with the :option:`--disable-gil` build option)." msgstr "" +"``1`` を設定すると、グローバルインタープリタロック (GIL) を強制的に有効にしま" +"す。\n" +"``0`` を設定すると GIL を強制的に無効にします (:option:`--disable-gil` ビルド" +"オプションを指定して構成した Python が必要です)。" -#: ../../using/cmdline.rst:1272 msgid "" "See also the :option:`-X gil <-X>` command-line option, which takes " "precedence over this variable, and :ref:`whatsnew313-free-threaded-cpython`." msgstr "" +"この変数よりも優先される :option:`-X gil <-X>` コマンドラインオプションと、:" +"ref:`whatsnew313-free-threaded-cpython` も参照してください。" #: ../../using/cmdline.rst:1279 msgid "" @@ -1808,20 +2041,26 @@ msgid "" "otherwise. See also :option:`-X thread_inherit_context<-X>`." msgstr "" -#: ../../using/cmdline.rst:1289 msgid "" "If set to ``1`` then the :class:`warnings.catch_warnings` context manager " "will use a :class:`~contextvars.ContextVar` to store warnings filter state. " "If unset, this variable defaults to ``1`` on free-threaded builds and to " "``0`` otherwise. See :option:`-X context_aware_warnings<-X>`." msgstr "" +"``1`` を設定すると、:class:`warnings.catch_warnings` コンテキストマネージャ" +"は、警告フィルタの状態の保存に :class:`~contextvars.ContextVar` を使いま" +"す。\n" +"未設定の場合、この変数のデフォルト値は、フリースレッドビルドでは ``1``、それ" +"以外では ``0`` です。\n" +":option:`-X context_aware_warnings<-X>` を参照してください。" -#: ../../using/cmdline.rst:1299 msgid "" "On builds where experimental just-in-time compilation is available, this " "variable can force the JIT to be disabled (``0``) or enabled (``1``) at " "interpreter startup." msgstr "" +"実験的な実行時コンパイルを利用できるビルドでは、この変数によってインタープリ" +"タの起動時に JIT を強制的に無効 (``0``) または有効 (``1``) にできます。" #: ../../using/cmdline.rst:1306 msgid "Debug-mode variables" @@ -1835,42 +2074,50 @@ msgstr "" "設定された場合、 Python はインタプリタのシャットダウン後に残っているオブジェ" "クトと参照カウントをダンプします。" -#: ../../using/cmdline.rst:1313 ../../using/cmdline.rst:1321 msgid "" "Needs Python configured with the :option:`--with-trace-refs` build option." msgstr "" +":option:`--with-trace-refs` ビルドオプションを指定して構成した Python が必要" +"です。" -#: ../../using/cmdline.rst:1317 msgid "" "If set, Python will dump objects and reference counts still alive after " "shutting down the interpreter into a file under the path given as the value " "to this environment variable." msgstr "" +"設定すると、Python はインタープリタのシャットダウン後にも残っているオブジェク" +"トと参照カウントを、この環境変数の値で指定したパスのファイルにダンプします。" -#: ../../using/cmdline.rst:1327 msgid "" "If this variable is set to a module, that module will be imported early in " "the interpreter lifecycle, before the :mod:`site` module is executed, and " "before the :mod:`__main__` module is created. Therefore, the imported module " "is not treated as :mod:`__main__`." msgstr "" +"モジュールを設定すると、インタープリタのライフサイクルの早い段階、つまり :" +"mod:`site` モジュールの実行前、かつ :mod:`__main__` モジュールの作成前に、そ" +"のモジュールをインポートします。\n" +"したがって、インポートされたモジュールは :mod:`__main__` として扱われません。" -#: ../../using/cmdline.rst:1332 msgid "This can be used to execute code early during Python initialization." msgstr "" +"これは、Python の初期化の早い段階でコードを実行するために使用できます。" -#: ../../using/cmdline.rst:1334 msgid "" "To import a submodule, use ``package.module`` as the value, like in an " "import statement." msgstr "" +"サブモジュールをインポートするには、import 文と同様に、値として ``package." +"module`` を指定します。" -#: ../../using/cmdline.rst:1337 msgid "" "See also the :option:`-X presite <-X>` command-line option, which takes " "precedence over this variable." msgstr "" +"この変数よりも優先される :option:`-X presite <-X>` コマンドラインオプションも" +"参照してください。" -#: ../../using/cmdline.rst:1340 msgid "Needs Python configured with the :option:`--with-pydebug` build option." msgstr "" +":option:`--with-pydebug` ビルドオプションを指定して構成した Python が必要で" +"す。" diff --git a/using/configure.po b/using/configure.po index 83bf5e3f0..4d5c7a611 100644 --- a/using/configure.po +++ b/using/configure.po @@ -20,10 +20,10 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../using/configure.rst:3 @@ -58,10 +58,13 @@ msgid "" "point numbers and `floating-point Not-a-Number (NaN) `_." msgstr "" +"`IEEE 754 `_ 浮動小数点数と `浮動小数" +"点 Not-a-Number (NaN) `_ の" +"サポート。" #: ../../using/configure.rst:23 msgid "Support for threads." -msgstr "" +msgstr "スレッドのサポート。" #: ../../using/configure.rst:25 msgid "" @@ -122,21 +125,24 @@ msgstr "" msgid "Autoconf 2.72 is now required." msgstr "" -#: ../../using/configure.rst:64 msgid "" "See also :pep:`7` \"Style Guide for C Code\" and :pep:`11` \"CPython " "platform support\"." msgstr "" +":pep:`7` 「Style Guide for C Code」と :pep:`11` 「CPython platform support」" +"も参照してください。" #: ../../using/configure.rst:69 msgid "Generated files" msgstr "生成されるファイル" -#: ../../using/configure.rst:71 msgid "" "To reduce build dependencies, Python source code contains multiple generated " "files. Commands to regenerate all generated files::" msgstr "" +"ビルドの依存関係を減らすため、Python のソースコードには生成済みのファイルが複" +"数含まれています。\n" +"生成済みファイルをすべて再生成するコマンドは次のとおりです。 ::" #: ../../using/configure.rst:74 msgid "" @@ -145,32 +151,43 @@ msgid "" "make regen-limited-abi\n" "make regen-configure" msgstr "" +"make regen-all\n" +"make regen-stdlib-module-names\n" +"make regen-limited-abi\n" +"make regen-configure" -#: ../../using/configure.rst:79 msgid "" "The ``Makefile.pre.in`` file documents generated files, their inputs, and " "tools used to regenerate them. Search for ``regen-*`` make targets." msgstr "" +"``Makefile.pre.in`` ファイルには、生成されるファイル、その入力、および再生成" +"に使用するツールが記載されています。\n" +"``regen-*`` という make ターゲットを検索してください。" #: ../../using/configure.rst:83 msgid "configure script" msgstr "構成スクリプト" -#: ../../using/configure.rst:85 msgid "" "The ``make regen-configure`` command regenerates the ``aclocal.m4`` file and " "the ``configure`` script using the ``Tools/build/regen-configure.sh`` shell " "script which uses an Ubuntu container to get the same tools versions and " "have a reproducible output." msgstr "" +"``make regen-configure`` コマンドは、``Tools/build/regen-configure.sh`` シェ" +"ルスクリプトを使って ``aclocal.m4`` ファイルと ``configure`` スクリプトを再生" +"成します。\n" +"このシェルスクリプトは、ツールのバージョンを揃えて再現可能な出力を得るために " +"Ubuntu コンテナを使用します。" -#: ../../using/configure.rst:90 msgid "The container is optional, the following command can be run locally::" msgstr "" +"コンテナの使用は必須ではなく、次のコマンドをローカルで実行することもできま" +"す。 ::" #: ../../using/configure.rst:92 msgid "autoreconf -ivf -Werror" -msgstr "" +msgstr "autoreconf -ivf -Werror" #: ../../using/configure.rst:94 msgid "" @@ -185,10 +202,12 @@ msgstr "Configureオプション" #: ../../using/configure.rst:103 msgid "List all :file:`configure` script options using::" msgstr "" +"次のコマンドを使用して、全ての :file:`configure` スクリプトのオプションを表示" +"できます::" #: ../../using/configure.rst:105 msgid "./configure --help" -msgstr "" +msgstr "./configure --help" #: ../../using/configure.rst:107 msgid "" @@ -201,11 +220,12 @@ msgstr "" msgid "General Options" msgstr "一般的なオプション" -#: ../../using/configure.rst:114 msgid "" "Support loadable extensions in the :mod:`!_sqlite` extension module (default " "is no) of the :mod:`sqlite3` module." msgstr "" +":mod:`sqlite3` モジュールの :mod:`!_sqlite` 拡張モジュールで、ロード可能な拡" +"張機能をサポートします (デフォルトでは無効)。" #: ../../using/configure.rst:117 msgid "" @@ -258,22 +278,20 @@ msgstr "" "html`` 、 WASI では ``.wasm`` 、その他のプラットフォームでは空文字列になりま" "す ( ``python`` 実行ファイル)。" -#: ../../using/configure.rst:146 msgid "" "The default suffix on WASM platform is one of ``.js``, ``.html`` or ``." "wasm``." msgstr "" -"WASM プラットフォームのデフォルトの接頭辞は、 ``.js`` 、 ``.html`` 、 ``." -"wasm`` のうちの1つです。" +"WASM プラットフォームのデフォルトの接尾辞は、``.js``、``.html``、``.wasm`` の" +"いずれかです。" -#: ../../using/configure.rst:152 msgid "" "Select the default time zone search path for :const:`zoneinfo.TZPATH`. See " "the :ref:`Compile-time configuration ` of " "the :mod:`zoneinfo` module." msgstr "" -"デフォルトのタイムゾーン検索パスを :const:`zoneinfo.TZPATH` に設定します。:" -"mod:`zoneinfo` モジュールの :ref:`Compile-time configuration " +":const:`zoneinfo.TZPATH` のデフォルトのタイムゾーン検索パスを選択します。\n" +":mod:`zoneinfo` モジュールの :ref:`コンパイル時の構成 " "` を参照してください。" #: ../../using/configure.rst:156 @@ -331,9 +349,8 @@ msgid "Disable C locale coercion to a UTF-8 based locale (enabled by default)." msgstr "" "UTF-8 ベースのロケールへの C ロケールの強制を無効にします(デフォルトで有効)。" -#: ../../using/configure.rst:185 msgid "Don't define the ``PY_COERCE_C_LOCALE`` macro." -msgstr "``PY_COERCE_C_LOCALE`` マクロは定義しないでください。" +msgstr "``PY_COERCE_C_LOCALE`` マクロを定義しません。" #: ../../using/configure.rst:187 msgid "See :envvar:`PYTHONCOERCECLOCALE` and the :pep:`538`." @@ -359,17 +376,17 @@ msgstr "" ":mod:`ensurepip` モジュールが使用する wheel パッケージのディレクトリです(デ" "フォルトはなし)。" -#: ../../using/configure.rst:204 msgid "" "Some Linux distribution packaging policies recommend against bundling " "dependencies. For example, Fedora installs wheel packages in the ``/usr/" "share/python-wheels/`` directory and don't install the :mod:`!ensurepip." "_bundled` package." msgstr "" -"Linux ディストリビューションのパッケージングポリシーの中には、依存関係をバン" -"ドルすることを推奨しているものがあります。例えば、 Fedora は wheel パッケージ" -"を ``/usr/share/python-wheels/`` ディレクトリにインストールし、 :mod:`!" -"ensurepip._bundled` パッケージはインストールしません。" +"Linux ディストリビューションのパッケージングポリシーの中には、依存関係を同梱" +"しないことを推奨するものがあります。\n" +"例えば、Fedora は wheel パッケージを ``/usr/share/python-wheels/`` ディレクト" +"リにインストールし、:mod:`!ensurepip._bundled` パッケージはインストールしませ" +"ん。" #: ../../using/configure.rst:213 msgid "" @@ -392,66 +409,61 @@ msgid "``no``: configure does not use :program:`pkg-config` even when present" msgstr "" "``no`` : :program:`pkg-config` が存在しても、 configure は使用しません。" -#: ../../using/configure.rst:224 msgid "Turn on internal Python performance statistics gathering." -msgstr "" +msgstr "Python 内部のパフォーマンス統計の収集を有効にします。" -#: ../../using/configure.rst:226 msgid "" "By default, statistics gathering is off. Use ``python3 -X pystats`` command " "or set ``PYTHONSTATS=1`` environment variable to turn on statistics " "gathering at Python startup." msgstr "" +"デフォルトでは統計の収集は無効です。\n" +"Python 起動時に統計の収集を有効にするには、``python3 -X pystats`` コマンドを" +"使用するか、環境変数 ``PYTHONSTATS=1`` を設定してください。" -#: ../../using/configure.rst:230 msgid "" "At Python exit, dump statistics if statistics gathering was on and not " "cleared." msgstr "" +"統計の収集が有効で、統計がクリアされていなければ、Python の終了時に統計を出力" +"します。" -#: ../../using/configure.rst:233 ../../using/configure.rst:741 msgid "Effects:" -msgstr "" +msgstr "効果:" -#: ../../using/configure.rst:235 msgid "Add :option:`-X pystats <-X>` command line option." -msgstr "" +msgstr ":option:`-X pystats <-X>` コマンドラインオプションを追加します。" -#: ../../using/configure.rst:236 msgid "Add :envvar:`!PYTHONSTATS` environment variable." -msgstr "" +msgstr ":envvar:`!PYTHONSTATS` 環境変数を追加します。" -#: ../../using/configure.rst:237 msgid "Define the ``Py_STATS`` macro." -msgstr "" +msgstr "``Py_STATS`` マクロを定義します。" -#: ../../using/configure.rst:238 msgid "Add functions to the :mod:`sys` module:" -msgstr "" +msgstr ":mod:`sys` モジュールに関数を追加します:" -#: ../../using/configure.rst:240 msgid ":func:`!sys._stats_on`: Turns on statistics gathering." -msgstr "" +msgstr ":func:`!sys._stats_on`: 統計の収集を有効にします。" -#: ../../using/configure.rst:241 msgid ":func:`!sys._stats_off`: Turns off statistics gathering." -msgstr "" +msgstr ":func:`!sys._stats_off`: 統計の収集を無効にします。" -#: ../../using/configure.rst:242 msgid ":func:`!sys._stats_clear`: Clears the statistics." -msgstr "" +msgstr ":func:`!sys._stats_clear`: 統計をクリアします。" -#: ../../using/configure.rst:243 msgid "" ":func:`!sys._stats_dump`: Dump statistics to file, and clears the statistics." -msgstr "" +msgstr ":func:`!sys._stats_dump`: 統計をファイルに出力し、統計をクリアします。" -#: ../../using/configure.rst:245 msgid "" "The statistics will be dumped to a arbitrary (probably unique) file in ``/" "tmp/py_stats/`` (Unix) or ``C:\\temp\\py_stats\\`` (Windows). If that " "directory does not exist, results will be printed on stderr." msgstr "" +"統計は、``/tmp/py_stats/`` (Unix) または ``C:\\temp\\py_stats\\`` (Windows) " +"の任意の (おそらく一意な) ファイルに出力されます。\n" +"このディレクトリが存在しない場合、結果は標準エラー出力に出力されます。" #: ../../using/configure.rst:249 msgid "Use ``Tools/scripts/summarize_stats.py`` to read the stats." @@ -460,109 +472,86 @@ msgstr "" #: ../../using/configure.rst:251 msgid "Statistics:" -msgstr "" +msgstr "統計:" -#: ../../using/configure.rst:253 msgid "Opcode:" -msgstr "" +msgstr "命令コード:" -#: ../../using/configure.rst:255 msgid "Specialization: success, failure, hit, deferred, miss, deopt, failures;" -msgstr "" +msgstr "特殊化: 成功、失敗、ヒット、延期、ミス、特殊化解除、失敗の内訳;" -#: ../../using/configure.rst:256 msgid "Execution count;" -msgstr "" +msgstr "実行回数;" -#: ../../using/configure.rst:257 msgid "Pair count." -msgstr "" +msgstr "命令コードのペアの実行回数。" -#: ../../using/configure.rst:259 msgid "Call:" -msgstr "" +msgstr "呼び出し:" -#: ../../using/configure.rst:261 msgid "Inlined Python calls;" -msgstr "" +msgstr "インライン化された Python 呼び出し;" -#: ../../using/configure.rst:262 msgid "PyEval calls;" -msgstr "" +msgstr "PyEval 呼び出し;" -#: ../../using/configure.rst:263 msgid "Frames pushed;" -msgstr "" +msgstr "プッシュされたフレーム;" -#: ../../using/configure.rst:264 msgid "Frame object created;" -msgstr "" +msgstr "作成されたフレームオブジェクト;" -#: ../../using/configure.rst:265 msgid "" "Eval calls: vector, generator, legacy, function VECTORCALL, build class, " "slot, function \"ex\", API, method." msgstr "" +"評価呼び出し: vector、generator、legacy、function VECTORCALL、build class、" +"slot、function \"ex\"、API、method。" -#: ../../using/configure.rst:268 msgid "Object:" -msgstr "" +msgstr "オブジェクト:" -#: ../../using/configure.rst:270 msgid "incref and decref;" -msgstr "" +msgstr "incref と decref;" -#: ../../using/configure.rst:271 msgid "interpreter incref and decref;" -msgstr "" +msgstr "インタープリタによる incref と decref;" -#: ../../using/configure.rst:272 msgid "allocations: all, 512 bytes, 4 kiB, big;" -msgstr "" +msgstr "割り当て: すべて、512 バイト、4 kiB、大容量;" -#: ../../using/configure.rst:273 msgid "free;" -msgstr "" +msgstr "解放;" -#: ../../using/configure.rst:274 msgid "to/from free lists;" -msgstr "" +msgstr "フリーリストへの追加とフリーリストからの取得;" -#: ../../using/configure.rst:275 msgid "dictionary materialized/dematerialized;" -msgstr "" +msgstr "辞書の実体化と実体化の解除;" -#: ../../using/configure.rst:276 msgid "type cache;" -msgstr "" +msgstr "型キャッシュ;" -#: ../../using/configure.rst:277 msgid "optimization attempts;" -msgstr "" +msgstr "最適化の試行;" -#: ../../using/configure.rst:278 msgid "optimization traces created/executed;" -msgstr "" +msgstr "作成された最適化トレースと実行された最適化トレース;" -#: ../../using/configure.rst:279 msgid "uops executed." -msgstr "" +msgstr "実行された uop。" -#: ../../using/configure.rst:281 msgid "Garbage collector:" -msgstr "" +msgstr "ガベージコレクタ:" -#: ../../using/configure.rst:283 msgid "Garbage collections;" -msgstr "" +msgstr "ガベージコレクション;" -#: ../../using/configure.rst:284 msgid "Objects visited;" -msgstr "" +msgstr "走査したオブジェクト;" -#: ../../using/configure.rst:285 msgid "Objects collected." -msgstr "" +msgstr "回収したオブジェクト。" #: ../../using/configure.rst:293 msgid "" @@ -570,66 +559,76 @@ msgid "" "`global interpreter lock` (GIL): free threading build." msgstr "" -#: ../../using/configure.rst:296 msgid "" "Defines the ``Py_GIL_DISABLED`` macro and adds ``\"t\"`` to :data:`sys." "abiflags`." msgstr "" +"``Py_GIL_DISABLED`` マクロを定義し、:data:`sys.abiflags` に ``\"t\"`` を追加" +"します。" -#: ../../using/configure.rst:299 msgid "See :ref:`whatsnew313-free-threaded-cpython` for more detail." -msgstr "" +msgstr "詳しくは :ref:`whatsnew313-free-threaded-cpython` を参照してください。" -#: ../../using/configure.rst:305 msgid "" "Indicate how to integrate the :ref:`experimental just-in-time compiler " "`." msgstr "" +":ref:`実験的なジャストインタイムコンパイラ ` の組み" +"込み方法を指定します。" -#: ../../using/configure.rst:307 msgid "``no``: Don't build the JIT." -msgstr "" +msgstr "``no``: JIT をビルドしません。" -#: ../../using/configure.rst:308 msgid "" "``yes``: Enable the JIT. To disable it at runtime, set the environment " "variable :envvar:`PYTHON_JIT=0 `." msgstr "" +"``yes``: JIT を有効にします。\n" +"実行時に無効にするには、環境変数 :envvar:`PYTHON_JIT=0 ` を設定し" +"てください。" -#: ../../using/configure.rst:310 msgid "" "``yes-off``: Build the JIT, but disable it by default. To enable it at " "runtime, set the environment variable :envvar:`PYTHON_JIT=1 `." msgstr "" +"``yes-off``: JIT をビルドしますが、デフォルトでは無効にします。\n" +"実行時に有効にするには、環境変数 :envvar:`PYTHON_JIT=1 ` を設定し" +"てください。" -#: ../../using/configure.rst:312 msgid "" "``interpreter``: Enable the \"JIT interpreter\" (only useful for those " "debugging the JIT itself). To disable it at runtime, set the environment " "variable :envvar:`PYTHON_JIT=0 `." msgstr "" +"``interpreter``: 「JIT インタープリタ」を有効にします (JIT 自体をデバッグする" +"場合にのみ有用です)。\n" +"実行時に無効にするには、環境変数 :envvar:`PYTHON_JIT=0 ` を設定し" +"てください。" -#: ../../using/configure.rst:316 msgid "" "``--enable-experimental-jit=no`` is the default behavior if the option is " "not provided, and ``--enable-experimental-jit`` is shorthand for ``--enable-" "experimental-jit=yes``. See :file:`Tools/jit/README.md` for more " "information, including how to install the necessary build-time dependencies." msgstr "" +"オプションを指定しない場合のデフォルトの動作は ``--enable-experimental-" +"jit=no`` で、``--enable-experimental-jit`` は ``--enable-experimental-" +"jit=yes`` の省略形です。\n" +"ビルド時に必要な依存関係のインストール方法など、詳しくは :file:`Tools/jit/" +"README.md` を参照してください。" -#: ../../using/configure.rst:323 msgid "" "When building CPython with JIT enabled, ensure that your system has Python " "3.11 or later installed." msgstr "" +"JIT を有効にして CPython をビルドする場合は、システムに Python 3.11 以降がイ" +"ンストールされていることを確認してください。" -#: ../../using/configure.rst:329 msgid "Path to ``pkg-config`` utility." -msgstr "" +msgstr "``pkg-config`` ユーティリティへのパス。" -#: ../../using/configure.rst:334 msgid "``pkg-config`` options." -msgstr "" +msgstr "``pkg-config`` のオプション。" #: ../../using/configure.rst:338 msgid "C compiler options" @@ -671,21 +670,24 @@ msgstr "マシン依存のライブラリファイルの名前。" msgid "Options for third-party dependencies" msgstr "サードパーティ依存関係のオプション" -#: ../../using/configure.rst:381 msgid "" "C compiler and linker flags to link Python to ``libbz2``, used by :mod:`bz2` " "module, overriding ``pkg-config``." msgstr "" +":mod:`bz2` モジュールで使用する ``libbz2`` に Python をリンクするための C コ" +"ンパイラとリンカのフラグ。\n" +"``pkg-config`` の設定をオーバーライドします。" -#: ../../using/configure.rst:387 msgid "" "C compiler and linker flags for ``libncurses`` or ``libncursesw``, used by :" "mod:`curses` module, overriding ``pkg-config``." msgstr "" +":mod:`curses` モジュールで使用する ``libncurses`` または ``libncursesw`` 用" +"の C コンパイラとリンカのフラグ。\n" +"``pkg-config`` の設定をオーバーライドします。" -#: ../../using/configure.rst:393 msgid "C compiler and linker flags for ``gdbm``." -msgstr "" +msgstr "``gdbm`` 用の C コンパイラとリンカのフラグ。" #: ../../using/configure.rst:398 msgid "" @@ -693,73 +695,94 @@ msgid "" "used by :mod:`hashlib` module, overriding ``pkg-config``." msgstr "" -#: ../../using/configure.rst:404 msgid "" "C compiler and linker flags for ``libedit``, used by :mod:`readline` module, " "overriding ``pkg-config``." msgstr "" +":mod:`readline` モジュールで使用する ``libedit`` 用の C コンパイラとリンカの" +"フラグ。\n" +"``pkg-config`` の設定をオーバーライドします。" -#: ../../using/configure.rst:410 msgid "" "C compiler and linker flags for ``libffi``, used by :mod:`ctypes` module, " "overriding ``pkg-config``." msgstr "" +":mod:`ctypes` モジュールで使用する ``libffi`` 用の C コンパイラとリンカのフラ" +"グ。\n" +"``pkg-config`` の設定をオーバーライドします。" -#: ../../using/configure.rst:416 msgid "" "C compiler and linker flags for ``libmpdec``, used by :mod:`decimal` module, " "overriding ``pkg-config``." msgstr "" +":mod:`decimal` モジュールで使用する ``libmpdec`` 用の C コンパイラとリンカの" +"フラグ。\n" +"``pkg-config`` の設定をオーバーライドします。" -#: ../../using/configure.rst:421 msgid "" "These environment variables have no effect unless :option:`--with-system-" "libmpdec` is specified." msgstr "" +":option:`--with-system-libmpdec` を指定しない限り、これらの環境変数は効果があ" +"りません。" -#: ../../using/configure.rst:427 msgid "" "C compiler and linker flags for ``liblzma``, used by :mod:`lzma` module, " "overriding ``pkg-config``." msgstr "" +":mod:`lzma` モジュールで使用する ``liblzma`` 用の C コンパイラとリンカのフラ" +"グ。\n" +"``pkg-config`` の設定をオーバーライドします。" -#: ../../using/configure.rst:433 msgid "" "C compiler and linker flags for ``libreadline``, used by :mod:`readline` " "module, overriding ``pkg-config``." msgstr "" +":mod:`readline` モジュールで使用する ``libreadline`` 用の C コンパイラとリン" +"カのフラグ。\n" +"``pkg-config`` の設定をオーバーライドします。" -#: ../../using/configure.rst:439 msgid "" "C compiler and linker flags for ``libsqlite3``, used by :mod:`sqlite3` " "module, overriding ``pkg-config``." msgstr "" +":mod:`sqlite3` モジュールで使用する ``libsqlite3`` 用の C コンパイラとリンカ" +"のフラグ。\n" +"``pkg-config`` の設定をオーバーライドします。" -#: ../../using/configure.rst:445 msgid "" "C compiler and linker flags for ``libuuid``, used by :mod:`uuid` module, " "overriding ``pkg-config``." msgstr "" +":mod:`uuid` モジュールで使用する ``libuuid`` 用の C コンパイラとリンカのフラ" +"グ。\n" +"``pkg-config`` の設定をオーバーライドします。" -#: ../../using/configure.rst:451 msgid "C compiler and linker flags for PANEL, overriding ``pkg-config``." msgstr "" +"PANEL 用の C コンパイラとリンカのフラグ。\n" +"``pkg-config`` の設定をオーバーライドします。" -#: ../../using/configure.rst:453 msgid "" "C compiler and linker flags for ``libpanel`` or ``libpanelw``, used by :mod:" "`curses.panel` module, overriding ``pkg-config``." msgstr "" +":mod:`curses.panel` モジュールで使用する ``libpanel`` または ``libpanelw`` 用" +"の C コンパイラとリンカのフラグ。\n" +"``pkg-config`` の設定をオーバーライドします。" -#: ../../using/configure.rst:459 msgid "C compiler and linker flags for TCLTK, overriding ``pkg-config``." msgstr "" +"TCLTK 用の C コンパイラとリンカのフラグ。\n" +"``pkg-config`` の設定をオーバーライドします。" -#: ../../using/configure.rst:464 msgid "" "C compiler and linker flags for ``libzlib``, used by :mod:`gzip` module, " "overriding ``pkg-config``." msgstr "" +":mod:`gzip` モジュールで使用する ``libzlib`` 用の C コンパイラとリンカのフラ" +"グ。\n" +"``pkg-config`` の設定をオーバーライドします。" #: ../../using/configure.rst:469 msgid "WebAssembly Options" @@ -769,13 +792,13 @@ msgstr "WebAssembly オプション" msgid "Turn on dynamic linking support for WASM." msgstr "WASM のダイナミックリンクサポートをオンにします。" -#: ../../using/configure.rst:475 msgid "" "Dynamic linking enables ``dlopen``. File size of the executable increases " "due to limited dead code elimination and additional features." msgstr "" -"ダイナミックリンクにより ``dlopen`` が可能になります。デッドコードの排除や機" -"能追加に制限があるため、実行ファイルのファイルサイズが大きくなります。" +"ダイナミックリンクにより ``dlopen`` が使用可能になります。\n" +"デッドコードの除去が制限されることと、機能が追加されることにより、実行ファイ" +"ルのサイズが大きくなります。" #: ../../using/configure.rst:482 msgid "Turn on pthreads support for WASM." @@ -797,13 +820,12 @@ msgstr "" msgid "This value can be retrieved at runtime using :data:`sys.prefix`." msgstr "この値は、実行時に :data:`sys.prefix` を使って取得することができます。" -#: ../../using/configure.rst:497 msgid "" "As an example, one can use ``--prefix=\"$HOME/.local/\"`` to install a " "Python in its home directory." msgstr "" -"例として、 ``--prefix=\"$HOME/.local/\"`` を使用すると、 Python をそのホーム" -"ディレクトリにインストールすることができます。" +"例えば、``--prefix=\"$HOME/.local/\"`` を使用すると、自分のホームディレクトリ" +"に Python をインストールできます。" #: ../../using/configure.rst:502 msgid "" @@ -853,12 +875,14 @@ msgstr "``no``: ensurepip を実行しない;" msgid "Performance options" msgstr "パフォーマンスに関するオプション" -#: ../../using/configure.rst:528 msgid "" "Configuring Python using ``--enable-optimizations --with-lto`` (PGO + LTO) " "is recommended for best performance. The experimental ``--enable-bolt`` flag " "can also be used to improve performance." msgstr "" +"最良のパフォーマンスを得るには、``--enable-optimizations --with-lto`` (PGO + " +"LTO) を指定して Python を構成することを推奨します。\n" +"実験的な ``--enable-bolt`` フラグも、パフォーマンスの向上に使用できます。" #: ../../using/configure.rst:534 msgid "" @@ -877,14 +901,15 @@ msgstr "" "す。macOS では、 GCC もこれを必要とします: GCC は macOS の Clang のエイリアス" "にすぎません。" -#: ../../using/configure.rst:540 msgid "" "Disable also semantic interposition in libpython if ``--enable-shared`` and " "GCC is used: add ``-fno-semantic-interposition`` to the compiler and linker " "flags." msgstr "" +"``--enable-shared`` と GCC を使用する場合は、libpython のセマンティックイン" +"ターポジションも無効にします。\n" +"コンパイラとリンカのフラグに ``-fno-semantic-interposition`` を追加します。" -#: ../../using/configure.rst:546 msgid "" "During the build, you may encounter compiler warnings about profile data not " "being available for some source files. These warnings are harmless, as only " @@ -892,59 +917,70 @@ msgid "" "disable these warnings on Clang, manually suppress them by adding ``-Wno-" "profile-instr-unprofiled`` to :envvar:`CFLAGS`." msgstr "" +"ビルド中に、一部のソースファイルのプロファイルデータが利用できないというコン" +"パイラの警告が表示されることがあります。\n" +"プロファイルデータの取得時にはコードの一部だけが実行されるため、この警告に問" +"題はありません。\n" +"Clang でこの警告を無効にするには、:envvar:`CFLAGS` に ``-Wno-profile-instr-" +"unprofiled`` を追加して明示的に抑制してください。" #: ../../using/configure.rst:555 msgid "Use ``-fno-semantic-interposition`` on GCC." msgstr "GCC で ``-fno-semantic-interposition`` を使用する。" -#: ../../using/configure.rst:560 msgid "" "Environment variable used in the Makefile: Python command line arguments for " "the PGO generation task." msgstr "" +"Makefile で使用する環境変数。\n" +"PGO 生成タスクに使用する Python のコマンドライン引数。" #: ../../using/configure.rst:563 msgid "Default: ``-m test --pgo --timeout=$(TESTTIMEOUT)``." msgstr "デフォルト: ``-m test --pgo --timeout=$(TESTTIMEOUT)``" -#: ../../using/configure.rst:567 msgid "Task failure is no longer ignored silently." -msgstr "" +msgstr "タスクの失敗が通知されずに無視されることはなくなりました。" -#: ../../using/configure.rst:572 msgid "Enable Link Time Optimization (LTO) in any build (disabled by default)." msgstr "" +"どのビルドでもリンク時最適化 (LTO) を有効にします (デフォルトでは無効)。" -#: ../../using/configure.rst:574 msgid "" "The C compiler Clang requires ``llvm-ar`` for LTO (``ar`` on macOS), as well " "as an LTO-aware linker (``ld.gold`` or ``lld``)." msgstr "" +"C コンパイラの Clang で LTO を使用するには、``llvm-ar`` (macOS では ``ar``) " +"と、LTO に対応したリンカ (``ld.gold`` または ``lld``) が必要です。" -#: ../../using/configure.rst:579 msgid "To use ThinLTO feature, use ``--with-lto=thin`` on Clang." msgstr "" +"ThinLTO 機能を使用するには、Clang で ``--with-lto=thin`` を指定してください。" -#: ../../using/configure.rst:582 msgid "" "Use ThinLTO as the default optimization policy on Clang if the compiler " "accepts the flag." msgstr "" +"コンパイラがフラグを受け付ける場合、Clang では ThinLTO をデフォルトの最適化方" +"針として使用します。" -#: ../../using/configure.rst:587 msgid "" "Enable usage of the `BOLT post-link binary optimizer `_ (disabled by default)." msgstr "" +"`リンク後のバイナリを最適化する BOLT `_ の使用を有効にします (デフォルトでは無効)。" -#: ../../using/configure.rst:591 msgid "" "BOLT is part of the LLVM project but is not always included in their binary " "distributions. This flag requires that ``llvm-bolt`` and ``merge-fdata`` are " "available." msgstr "" +"BOLT は LLVM プロジェクトの一部ですが、LLVM のバイナリ配布に必ず含まれている" +"とは限りません。\n" +"このフラグを使用するには、``llvm-bolt`` と ``merge-fdata`` が利用可能である必" +"要があります。" -#: ../../using/configure.rst:595 msgid "" "BOLT is still a fairly new project so this flag should be considered " "experimental for now. Because this tool operates on machine code its success " @@ -954,32 +990,43 @@ msgid "" "some scenarios. Use of LLVM 16 or newer for BOLT optimization is strongly " "encouraged." msgstr "" +"BOLT はまだ比較的新しいプロジェクトであるため、現時点ではこのフラグを実験的な" +"ものと考えてください。\n" +"このツールは機械語を処理するため、処理が成功するかどうかは、ビルド環境、ほか" +"の最適化用 configure 引数、CPU アーキテクチャの組み合わせに依存し、すべての組" +"み合わせがサポートされているわけではありません。\n" +"LLVM 16 より前の BOLT は、状況によってクラッシュすることが知られています。\n" +"BOLT による最適化には LLVM 16 以降の使用を強く推奨します。" -#: ../../using/configure.rst:603 msgid "" "The :envvar:`!BOLT_INSTRUMENT_FLAGS` and :envvar:`!BOLT_APPLY_FLAGS` :" "program:`configure` variables can be defined to override the default set of " "arguments for :program:`llvm-bolt` to instrument and apply BOLT data to " "binaries, respectively." msgstr "" +":program:`configure` 変数 :envvar:`!BOLT_INSTRUMENT_FLAGS` と :envvar:`!" +"BOLT_APPLY_FLAGS` を定義すると、:program:`llvm-bolt` に渡すデフォルトの引数を" +"オーバーライドできます。\n" +"前者はバイナリへの計測処理の挿入、後者はバイナリへの BOLT データの適用に使用" +"します。" -#: ../../using/configure.rst:612 msgid "" "Arguments to ``llvm-bolt`` when creating a `BOLT optimized binary `_." msgstr "" +"`BOLT で最適化したバイナリ `_ を作成" +"するときに ``llvm-bolt`` に渡す引数。" -#: ../../using/configure.rst:619 msgid "Arguments to ``llvm-bolt`` when instrumenting binaries." -msgstr "" +msgstr "バイナリに計測処理を挿入するときに ``llvm-bolt`` に渡す引数。" -#: ../../using/configure.rst:625 msgid "" "Enable computed gotos in evaluation loop (enabled by default on supported " "compilers)." msgstr "" +"評価ループで計算型 goto を有効にします (対応するコンパイラではデフォルトで有" +"効)。" -#: ../../using/configure.rst:630 msgid "" "Enable interpreters using tail calls in CPython. If enabled, enabling PGO (:" "option:`--enable-optimizations`) is highly recommended. This option " @@ -988,47 +1035,57 @@ msgid "" "none>`_ calling convention. For example, Clang 19 and newer supports this " "feature." msgstr "" +"CPython で末尾呼び出しを使用するインタープリタを有効にします。\n" +"有効にする場合は、PGO (:option:`--enable-optimizations`) も有効にすることを強" +"く推奨します。\n" +"このオプションには、適切な末尾呼び出しのサポートと `preserve_none `_ 呼び出し規約を備" +"えた C コンパイラが必要です。\n" +"例えば、Clang 19 以降はこの機能をサポートしています。" -#: ../../using/configure.rst:640 msgid "" "Disable the fast :ref:`mimalloc ` allocator (enabled by default)." msgstr "" +"高速な :ref:`mimalloc ` アロケータを無効にします (デフォルトでは有" +"効)。" -#: ../../using/configure.rst:643 ../../using/configure.rst:650 msgid "See also :envvar:`PYTHONMALLOC` environment variable." -msgstr "" +msgstr ":envvar:`PYTHONMALLOC` 環境変数も参照してください。" -#: ../../using/configure.rst:647 msgid "" "Disable the specialized Python memory allocator :ref:`pymalloc ` " "(enabled by default)." msgstr "" +"Python 専用のメモリアロケータ :ref:`pymalloc ` を無効にします (デ" +"フォルトでは有効)。" -#: ../../using/configure.rst:654 msgid "" "Disable static documentation strings to reduce the memory footprint (enabled " "by default). Documentation strings defined in Python are not affected." msgstr "" +"メモリ使用量を減らすため、静的なドキュメンテーション文字列を無効にします (デ" +"フォルトでは有効)。\n" +"Python で定義されたドキュメンテーション文字列には影響しません。" #: ../../using/configure.rst:657 msgid "Don't define the ``WITH_DOC_STRINGS`` macro." msgstr "" -#: ../../using/configure.rst:659 msgid "See the ``PyDoc_STRVAR()`` macro." -msgstr "" +msgstr "``PyDoc_STRVAR()`` マクロを参照してください。" -#: ../../using/configure.rst:663 msgid "Enable C-level code profiling with ``gprof`` (disabled by default)." msgstr "" +"``gprof`` による C レベルのコードのプロファイリングを有効にします (デフォルト" +"では無効)。" -#: ../../using/configure.rst:667 msgid "" "Add ``-fstrict-overflow`` to the C compiler flags (by default we add ``-fno-" "strict-overflow`` instead)." msgstr "" +"C コンパイラのフラグに ``-fstrict-overflow`` を追加します (デフォルトでは代わ" +"りに ``-fno-strict-overflow`` を追加します)。" -#: ../../using/configure.rst:672 msgid "" "Deactivate remote debugging support described in :pep:`768` (enabled by " "default). When this flag is provided the code that allows the interpreter to " @@ -1037,106 +1094,124 @@ msgid "" "schedule code to be executed and the functionality to receive code to be " "executed." msgstr "" +":pep:`768` で説明されているリモートデバッグのサポートを無効にします (デフォル" +"トでは有効)。\n" +"このフラグを指定すると、:pep:`768` にあるように、インタープリタが別のプロセス" +"で Python ファイルの実行をスケジュールできるようにするコードをコンパイルしま" +"せん。\n" +"これには、実行するコードをスケジュールする機能と、実行するコードを受信する機" +"能の両方が含まれます。" #: ../../using/configure.rst:685 msgid "Python Debug Build" -msgstr "" +msgstr "Python デバッグビルド" #: ../../using/configure.rst:687 msgid "" "A debug build is Python built with the :option:`--with-pydebug` configure " "option." msgstr "" +"デバッグビルドは、 :option:`--with-pydebug` 構成オプション付きでビルドされた " +"Python です。" #: ../../using/configure.rst:690 msgid "Effects of a debug build:" -msgstr "" +msgstr "デバッグビルドの影響:" -#: ../../using/configure.rst:692 msgid "" "Display all warnings by default: the list of default warning filters is " "empty in the :mod:`warnings` module." msgstr "" +"デフォルトですべての警告を表示します。\n" +":mod:`warnings` モジュールのデフォルトの警告フィルタのリストが空になります。" -#: ../../using/configure.rst:694 msgid "Add ``d`` to :data:`sys.abiflags`." -msgstr "" +msgstr ":data:`sys.abiflags` に ``d`` を追加します。" -#: ../../using/configure.rst:695 msgid "Add :func:`!sys.gettotalrefcount` function." -msgstr "" +msgstr ":func:`!sys.gettotalrefcount` 関数を追加します。" -#: ../../using/configure.rst:696 msgid "Add :option:`-X showrefcount <-X>` command line option." -msgstr "" +msgstr ":option:`-X showrefcount <-X>` コマンドラインオプションを追加します。" -#: ../../using/configure.rst:697 msgid "" "Add :option:`-d` command line option and :envvar:`PYTHONDEBUG` environment " "variable to debug the parser." msgstr "" +"パーサをデバッグするための :option:`-d` コマンドラインオプションと :envvar:" +"`PYTHONDEBUG` 環境変数を追加します。" -#: ../../using/configure.rst:699 msgid "" "Add support for the ``__lltrace__`` variable: enable low-level tracing in " "the bytecode evaluation loop if the variable is defined." msgstr "" +"``__lltrace__`` 変数のサポートを追加します。\n" +"この変数が定義されている場合、バイトコード評価ループの低レベルのトレースを有" +"効にします。" -#: ../../using/configure.rst:701 msgid "" "Install :ref:`debug hooks on memory allocators ` " "to detect buffer overflow and other memory errors." msgstr "" +"バッファオーバーフローやその他のメモリエラーを検出するために、:ref:`メモリア" +"ロケータにデバッグフック ` を設定します。" -#: ../../using/configure.rst:703 msgid "Define ``Py_DEBUG`` and ``Py_REF_DEBUG`` macros." -msgstr "" +msgstr "``Py_DEBUG`` と ``Py_REF_DEBUG`` マクロを定義します。" -#: ../../using/configure.rst:704 msgid "" "Add runtime checks: code surrounded by ``#ifdef Py_DEBUG`` and ``#endif``. " "Enable ``assert(...)`` and ``_PyObject_ASSERT(...)`` assertions: don't set " "the ``NDEBUG`` macro (see also the :option:`--with-assertions` configure " "option). Main runtime checks:" msgstr "" +"実行時のチェックを追加します。\n" +"これは ``#ifdef Py_DEBUG`` と ``#endif`` で囲まれたコードです。\n" +"``assert(...)`` と ``_PyObject_ASSERT(...)`` によるアサーションを有効にし、" +"``NDEBUG`` マクロを設定しません (:option:`--with-assertions` configure オプ" +"ションも参照してください)。\n" +"実行時の主なチェックは次のとおりです:" -#: ../../using/configure.rst:709 msgid "Add sanity checks on the function arguments." -msgstr "" +msgstr "関数の引数が妥当かどうかのチェックを追加します。" -#: ../../using/configure.rst:710 msgid "" "Unicode and int objects are created with their memory filled with a pattern " "to detect usage of uninitialized objects." msgstr "" +"未初期化のオブジェクトの使用を検出するため、Unicode オブジェクトと int オブ" +"ジェクトの作成時に、そのメモリを特定のパターンで埋めます。" -#: ../../using/configure.rst:712 msgid "" "Ensure that functions which can clear or replace the current exception are " "not called with an exception raised." msgstr "" +"現在の例外をクリアまたは置換する可能性のある関数が、例外が発生している状態で" +"呼び出されていないことを確認します。" -#: ../../using/configure.rst:714 msgid "Check that deallocator functions don't change the current exception." -msgstr "" +msgstr "メモリ解放関数が現在の例外を変更しないことをチェックします。" -#: ../../using/configure.rst:715 msgid "" "The garbage collector (:func:`gc.collect` function) runs some basic checks " "on objects consistency." msgstr "" +"ガベージコレクタ (:func:`gc.collect` 関数) は、オブジェクトの整合性に関する基" +"本的なチェックをいくつか実行します。" -#: ../../using/configure.rst:717 msgid "" "The :c:macro:`!Py_SAFE_DOWNCAST()` macro checks for integer underflow and " "overflow when downcasting from wide types to narrow types." msgstr "" +":c:macro:`!Py_SAFE_DOWNCAST()` マクロは、幅の広い型から狭い型へダウンキャスト" +"するときに、整数のアンダーフローとオーバーフローをチェックします。" -#: ../../using/configure.rst:720 msgid "" "See also the :ref:`Python Development Mode ` and the :option:`--" "with-trace-refs` configure option." msgstr "" +":ref:`Python 開発モード ` と :option:`--with-trace-refs` configure " +"オプションも参照してください。" #: ../../using/configure.rst:723 msgid "" @@ -1145,132 +1220,139 @@ msgid "" "option:`--with-trace-refs` option)." msgstr "" -#: ../../using/configure.rst:730 msgid "Debug options" -msgstr "" +msgstr "デバッグオプション" -#: ../../using/configure.rst:734 msgid "" ":ref:`Build Python in debug mode `: define the ``Py_DEBUG`` " "macro (disabled by default)." msgstr "" +":ref:`Python をデバッグモードでビルド ` します。\n" +"``Py_DEBUG`` マクロを定義します (デフォルトでは無効)。" -#: ../../using/configure.rst:739 msgid "Enable tracing references for debugging purpose (disabled by default)." -msgstr "" +msgstr "デバッグのために参照の追跡を有効にします (デフォルトでは無効)。" -#: ../../using/configure.rst:743 msgid "Define the ``Py_TRACE_REFS`` macro." -msgstr "" +msgstr "``Py_TRACE_REFS`` マクロを定義します。" -#: ../../using/configure.rst:744 msgid "Add :func:`sys.getobjects` function." -msgstr "" +msgstr ":func:`sys.getobjects` 関数を追加します。" -#: ../../using/configure.rst:745 msgid "Add :envvar:`PYTHONDUMPREFS` environment variable." -msgstr "" +msgstr ":envvar:`PYTHONDUMPREFS` 環境変数を追加します。" -#: ../../using/configure.rst:747 msgid "" "The :envvar:`PYTHONDUMPREFS` environment variable can be used to dump " "objects and reference counts still alive at Python exit." msgstr "" +":envvar:`PYTHONDUMPREFS` 環境変数を使うと、Python の終了時にまだ生存している" +"オブジェクトとその参照カウントを出力できます。" -#: ../../using/configure.rst:750 msgid ":ref:`Statically allocated objects ` are not traced." msgstr "" +":ref:`静的に割り当てられたオブジェクト ` は追跡しません。" -#: ../../using/configure.rst:754 msgid "" "This build is now ABI compatible with release build and :ref:`debug build " "`." msgstr "" +"このビルドがリリースビルドおよび :ref:`デバッグビルド ` と ABI " +"互換になりました。" -#: ../../using/configure.rst:760 msgid "" "Build with C assertions enabled (default is no): ``assert(...);`` and " "``_PyObject_ASSERT(...);``." msgstr "" +"C のアサーション ``assert(...);`` と ``_PyObject_ASSERT(...);`` を有効にして" +"ビルドします (デフォルトでは無効)。" -#: ../../using/configure.rst:763 msgid "" "If set, the ``NDEBUG`` macro is not defined in the :envvar:`OPT` compiler " "variable." msgstr "" +"設定した場合、:envvar:`OPT` コンパイラ変数に ``NDEBUG`` マクロを定義しませ" +"ん。" -#: ../../using/configure.rst:766 msgid "" "See also the :option:`--with-pydebug` option (:ref:`debug build `) which also enables assertions." msgstr "" +"アサーションも有効にする :option:`--with-pydebug` オプション (:ref:`デバッグ" +"ビルド `) も参照してください。" -#: ../../using/configure.rst:773 msgid "Enable Valgrind support (default is no)." -msgstr "" +msgstr "Valgrind のサポートを有効にします (デフォルトでは無効)。" -#: ../../using/configure.rst:777 msgid "Enable DTrace support (default is no)." -msgstr "" +msgstr "DTrace のサポートを有効にします (デフォルトでは無効)。" -#: ../../using/configure.rst:779 msgid "" "See :ref:`Instrumenting CPython with DTrace and SystemTap `." msgstr "" +":ref:`DTrace と SystemTap による CPython の計測 ` を参照して" +"ください。" #: ../../using/configure.rst:786 msgid "" "Enable AddressSanitizer memory error detector, ``asan`` (default is no)." msgstr "" -#: ../../using/configure.rst:792 msgid "" "Enable MemorySanitizer allocation error detector, ``msan`` (default is no)." msgstr "" +"メモリ割り当てエラー検出ツール MemorySanitizer (``msan``) を有効にします (デ" +"フォルトでは無効)。" -#: ../../using/configure.rst:798 msgid "" "Enable UndefinedBehaviorSanitizer undefined behaviour detector, ``ubsan`` " "(default is no)." msgstr "" +"未定義動作検出ツール UndefinedBehaviorSanitizer (``ubsan``) を有効にします " +"(デフォルトでは無効)。" -#: ../../using/configure.rst:805 msgid "Enable ThreadSanitizer data race detector, ``tsan`` (default is no)." msgstr "" +"データ競合検出ツール ThreadSanitizer (``tsan``) を有効にします (デフォルトで" +"は無効)。" -#: ../../using/configure.rst:816 msgid "Enable building a shared Python library: ``libpython`` (default is no)." msgstr "" +"Python の共有ライブラリ ``libpython`` のビルドを有効にします (デフォルトでは" +"無効)。" -#: ../../using/configure.rst:820 msgid "" "Do not build ``libpythonMAJOR.MINOR.a`` and do not install ``python.o`` " "(built and enabled by default)." msgstr "" +"``libpythonMAJOR.MINOR.a`` をビルドせず、``python.o`` をインストールしません " +"(デフォルトではビルドされ、有効です)。" -#: ../../using/configure.rst:827 msgid "Libraries options" -msgstr "" +msgstr "ライブラリのオプション" -#: ../../using/configure.rst:831 msgid "Link against additional libraries (default is no)." -msgstr "" +msgstr "追加のライブラリにリンクします (デフォルトでは無効)。" -#: ../../using/configure.rst:835 msgid "" "Build the :mod:`!pyexpat` module using an installed ``expat`` library " "(default is no)." msgstr "" +"インストール済みの ``expat`` ライブラリを使用して :mod:`!pyexpat` モジュール" +"をビルドします (デフォルトでは無効)。" -#: ../../using/configure.rst:840 msgid "" "Build the ``_decimal`` extension module using an installed ``mpdecimal`` " "library, see the :mod:`decimal` module (default is yes)." msgstr "" +"インストール済みの ``mpdecimal`` ライブラリを使用して ``_decimal`` 拡張モ" +"ジュールをビルドします (デフォルトでは有効)。\n" +":mod:`decimal` モジュールを参照してください。" -#: ../../using/configure.rst:845 msgid "Default to using the installed ``mpdecimal`` library." msgstr "" +"デフォルトでインストール済みの ``mpdecimal`` ライブラリを使用するようになりま" +"した。" #: ../../using/configure.rst:848 msgid "" @@ -1278,139 +1360,119 @@ msgid "" "with Python 3.15." msgstr "" -#: ../../using/configure.rst:852 msgid ":option:`LIBMPDEC_CFLAGS` and :option:`LIBMPDEC_LIBS`." -msgstr "" +msgstr ":option:`LIBMPDEC_CFLAGS` と :option:`LIBMPDEC_LIBS`。" -#: ../../using/configure.rst:856 msgid "Designate a backend library for the :mod:`readline` module." -msgstr "" +msgstr ":mod:`readline` モジュールのバックエンドライブラリを指定します。" -#: ../../using/configure.rst:858 msgid "readline: Use readline as the backend." -msgstr "" +msgstr "readline: バックエンドに readline を使用します。" -#: ../../using/configure.rst:859 msgid "editline: Use editline as the backend." -msgstr "" +msgstr "editline: バックエンドに editline を使用します。" -#: ../../using/configure.rst:865 msgid "Don't build the :mod:`readline` module (built by default)." msgstr "" +":mod:`readline` モジュールをビルドしません (デフォルトではビルドします)。" -#: ../../using/configure.rst:867 msgid "Don't define the ``HAVE_LIBREADLINE`` macro." -msgstr "" +msgstr "``HAVE_LIBREADLINE`` マクロを定義しません。" -#: ../../using/configure.rst:873 msgid "" "Override ``libm`` math library to *STRING* (default is system-dependent)." msgstr "" +"数学ライブラリ ``libm`` を *STRING* に変更します (デフォルトはシステムに依" +"存)。" -#: ../../using/configure.rst:877 msgid "Override ``libc`` C library to *STRING* (default is system-dependent)." msgstr "" +"C ライブラリ ``libc`` を *STRING* に変更します (デフォルトはシステムに依存)。" -#: ../../using/configure.rst:881 msgid "Root of the OpenSSL directory." -msgstr "" +msgstr "OpenSSL ディレクトリのルート。" -#: ../../using/configure.rst:887 msgid "Set runtime library directory (rpath) for OpenSSL libraries:" -msgstr "" +msgstr "OpenSSL ライブラリの実行時ライブラリディレクトリ (rpath) を設定します:" -#: ../../using/configure.rst:889 msgid "``no`` (default): don't set rpath;" -msgstr "" +msgstr "``no`` (デフォルト): rpath を設定しません;" -#: ../../using/configure.rst:890 msgid "" "``auto``: auto-detect rpath from :option:`--with-openssl` and ``pkg-config``;" msgstr "" +"``auto``: :option:`--with-openssl` と ``pkg-config`` から rpath を自動検出し" +"ます;" -#: ../../using/configure.rst:892 msgid "*DIR*: set an explicit rpath." -msgstr "" +msgstr "*DIR*: rpath を明示的に設定します。" -#: ../../using/configure.rst:898 msgid "Security Options" -msgstr "" +msgstr "セキュリティのオプション" -#: ../../using/configure.rst:902 msgid "Select hash algorithm for use in ``Python/pyhash.c``:" -msgstr "" +msgstr "``Python/pyhash.c`` で使用するハッシュアルゴリズムを選択します:" -#: ../../using/configure.rst:904 msgid "``siphash13`` (default);" -msgstr "" +msgstr "``siphash13`` (デフォルト);" -#: ../../using/configure.rst:905 msgid "``siphash24``;" -msgstr "" +msgstr "``siphash24``;" -#: ../../using/configure.rst:906 msgid "``fnv``." -msgstr "" +msgstr "``fnv``。" -#: ../../using/configure.rst:910 msgid "``siphash13`` is added and it is the new default." -msgstr "" +msgstr "``siphash13`` が追加され、新たなデフォルトになりました。" -#: ../../using/configure.rst:915 msgid "Built-in hash modules:" -msgstr "" +msgstr "組み込みのハッシュモジュール:" #: ../../using/configure.rst:917 msgid "``md5``;" -msgstr "" +msgstr "``md5``;" #: ../../using/configure.rst:918 msgid "``sha1``;" -msgstr "" +msgstr "``sha1``;" #: ../../using/configure.rst:919 msgid "``sha256``;" -msgstr "" +msgstr "``sha256``;" #: ../../using/configure.rst:920 msgid "``sha512``;" msgstr "``sha512``;" -#: ../../using/configure.rst:921 msgid "``sha3`` (with shake);" -msgstr "" +msgstr "``sha3`` (shake を含む);" #: ../../using/configure.rst:922 msgid "``blake2``." -msgstr "" +msgstr "``blake2``." -#: ../../using/configure.rst:928 msgid "Override the OpenSSL default cipher suites string:" -msgstr "" +msgstr "OpenSSL のデフォルトの暗号スイート文字列をオーバーライドします:" -#: ../../using/configure.rst:930 msgid "``python`` (default): use Python's preferred selection;" -msgstr "" +msgstr "``python`` (デフォルト): Python が推奨する選択を使用します;" -#: ../../using/configure.rst:931 msgid "``openssl``: leave OpenSSL's defaults untouched;" -msgstr "" +msgstr "``openssl``: OpenSSL のデフォルトをそのまま使用します;" -#: ../../using/configure.rst:932 msgid "*STRING*: use a custom string" -msgstr "" +msgstr "*STRING*: カスタムの文字列を使用します" -#: ../../using/configure.rst:934 msgid "See the :mod:`ssl` module." -msgstr "" +msgstr ":mod:`ssl` モジュールを参照してください。" -#: ../../using/configure.rst:940 msgid "" "The settings ``python`` and *STRING* also set TLS 1.2 as minimum protocol " "version." msgstr "" +"``python`` と *STRING* の設定では、プロトコルの最小バージョンも TLS 1.2 に設" +"定します。" -#: ../../using/configure.rst:945 msgid "" "Disable compiler options that are `recommended by OpenSSF`_ for security " "reasons with no performance overhead. If this option is not enabled, CPython " @@ -1418,25 +1480,33 @@ msgid "" "option is enabled, CPython will not be built with the compiler options " "listed below." msgstr "" +"セキュリティ上の理由で `OpenSSF が推奨する `_、パ" +"フォーマンスのオーバーヘッドを伴わないコンパイラオプションを無効にします。\n" +"このオプションを有効にしなければ、CPython は速度の低下を伴わない安全性のため" +"のコンパイラオプションを使用してビルドされます。\n" +"このオプションを有効にすると、以下のコンパイラオプションを使用せずに CPython " +"をビルドします。" -#: ../../using/configure.rst:949 msgid "" "The following compiler options are disabled with :option:`!--disable-safety`:" msgstr "" +":option:`!--disable-safety` を指定すると、次のコンパイラオプションを無効にし" +"ます:" -#: ../../using/configure.rst:951 msgid "" "`-fstack-protector-strong`_: Enable run-time checks for stack-based buffer " "overflows." msgstr "" +"`-fstack-protector-strong`_: スタック上のバッファオーバーフローに対する実行時" +"のチェックを有効にします。" -#: ../../using/configure.rst:952 msgid "" "`-Wtrampolines`_: Enable warnings about trampolines that require executable " "stacks." msgstr "" +"`-Wtrampolines`_: 実行可能スタックを必要とするトランポリンに関する警告を有効" +"にします。" -#: ../../using/configure.rst:962 msgid "" "Enable compiler options that are `recommended by OpenSSF`_ for security " "reasons which require overhead. If this option is not enabled, CPython will " @@ -1444,18 +1514,26 @@ msgid "" "this option is enabled, CPython will be built with the compiler options " "listed below." msgstr "" +"セキュリティ上の理由で `OpenSSF が推奨する `_、オー" +"バーヘッドを伴うコンパイラオプションを有効にします。\n" +"このオプションを有効にしなければ、CPython はパフォーマンスに影響する安全性の" +"ためのコンパイラオプションを使用せずにビルドされます。\n" +"このオプションを有効にすると、以下のコンパイラオプションを使用して CPython を" +"ビルドします。" -#: ../../using/configure.rst:966 msgid "" "The following compiler options are enabled with :option:`!--enable-slower-" "safety`:" msgstr "" +":option:`!--enable-slower-safety` を指定すると、次のコンパイラオプションを有" +"効にします:" -#: ../../using/configure.rst:968 msgid "" "`-D_FORTIFY_SOURCE=3`_: Fortify sources with compile- and run-time checks " "for unsafe libc usage and buffer overflows." msgstr "" +"`-D_FORTIFY_SOURCE=3`_: libc の安全でない使用とバッファオーバーフローに対し" +"て、コンパイル時および実行時のチェックを行い、ソースコードを強化します。" #: ../../using/configure.rst:976 msgid "macOS Options" @@ -1465,22 +1543,20 @@ msgstr "macOS のオプション" msgid "See :source:`Mac/README.rst`." msgstr ":source:`Mac/README.rst` を参照。" -#: ../../using/configure.rst:983 msgid "" "Create a universal binary build. *SDKDIR* specifies which macOS SDK should " "be used to perform the build (default is no)." msgstr "" -"ユニバーサルバイナリビルドを作成します。 *SDKDIR* はビルドの実行にどの macOS " -"SDK が使用されるべきかを指定します (デフォルトでは指定しません) 。" +"ユニバーサルバイナリのビルドを作成します (デフォルトでは無効)。\n" +"*SDKDIR* は、ビルドに使用する macOS SDK を指定します。" -#: ../../using/configure.rst:989 msgid "" "Create a Python.framework rather than a traditional Unix install. Optional " "*INSTALLDIR* specifies the installation path (default is no)." msgstr "" -"従来の Unix インストールではなく、 Python.framework を作成します。オプション" -"の *INSTALLDIR* はインストール先のパスを指定します (デフォルトでは指定しませ" -"ん) 。" +"従来の Unix 形式でのインストールに代えて、Python.framework を作成します (デ" +"フォルトでは無効)。\n" +"オプションの *INSTALLDIR* はインストール先のパスを指定します。" #: ../../using/configure.rst:994 msgid "" @@ -1494,39 +1570,30 @@ msgstr "" msgid "Options:" msgstr "オプション:" -#: ../../using/configure.rst:999 msgid "``universal2`` (x86-64 and arm64);" -msgstr "" +msgstr "``universal2`` (x86-64 と arm64);" -#: ../../using/configure.rst:1000 msgid "``32-bit`` (PPC and i386);" -msgstr "" +msgstr "``32-bit`` (PPC と i386);" -#: ../../using/configure.rst:1001 msgid "``64-bit`` (PPC64 and x86-64);" -msgstr "" +msgstr "``64-bit`` (PPC64 と x86-64);" -#: ../../using/configure.rst:1002 msgid "``3-way`` (i386, PPC and x86-64);" -msgstr "" +msgstr "``3-way`` (i386、PPC、x86-64);" -#: ../../using/configure.rst:1003 msgid "``intel`` (i386 and x86-64);" -msgstr "" +msgstr "``intel`` (i386 と x86-64);" -#: ../../using/configure.rst:1004 msgid "``intel-32`` (i386);" -msgstr "" +msgstr "``intel-32`` (i386);" -#: ../../using/configure.rst:1005 msgid "``intel-64`` (x86-64);" -msgstr "" +msgstr "``intel-64`` (x86-64);" -#: ../../using/configure.rst:1006 msgid "``all`` (PPC, i386, PPC64 and x86-64)." -msgstr "" +msgstr "``all`` (PPC、i386、PPC64、x86-64)。" -#: ../../using/configure.rst:1008 msgid "" "Note that values for this configuration item are *not* the same as the " "identifiers used for universal binary wheels on macOS. See the Python " @@ -1534,6 +1601,11 @@ msgid "" "tags used on macOS `_" msgstr "" +"この構成項目の値は、macOS のユニバーサルバイナリ wheel で使用する識別子と同じ" +"では *ない* ことに注意してください。\n" +"詳しくは、Python Packaging User Guide の `macOS で使用するパッケージングのプ" +"ラットフォーム互換性タグ `_ を参照してください。" #: ../../using/configure.rst:1016 msgid "" @@ -1581,18 +1653,18 @@ msgstr "フレームワークの名前を指定します (デフォルト: ``Pyt msgid "Cross Compiling Options" msgstr "クロスコンパイルのオプション" -#: ../../using/configure.rst:1048 msgid "" "Cross compiling, also known as cross building, can be used to build Python " "for another CPU architecture or platform. Cross compiling requires a Python " "interpreter for the build platform. The version of the build Python must " "match the version of the cross compiled host Python." msgstr "" -"クロスコンパイル、またはクロスビルドは、異なる CPU アーキテクチャやプラット" -"フォーム用に Python をビルドするために使用できます。クロスコンパイルには、ビ" -"ルドプラットフォーム用の Python インタープリターが必要です。ビルドする " -"Python のバージョンは、クロスコンパイルされたホスト Python のバージョンと一致" -"する必要があります。" +"クロスコンパイル (クロスビルドとも呼ばれます) を使用すると、異なる CPU アーキ" +"テクチャやプラットフォーム向けの Python をビルドできます。\n" +"クロスコンパイルには、ビルドプラットフォーム用の Python インタープリタが必要" +"です。\n" +"ビルドに使用する Python のバージョンは、クロスコンパイルするホスト用 Python " +"のバージョンと一致していなければなりません。" #: ../../using/configure.rst:1055 msgid "" @@ -1607,9 +1679,8 @@ msgstr "" "HOST (ターゲットプラットフォーム) で動作するプログラムをビルドするためのクロ" "スコンパイル。" -#: ../../using/configure.rst:1063 msgid "path to build ``python`` binary for cross compiling" -msgstr "クロスコンパイル用のビルド ``python`` バイナリへのパス。" +msgstr "クロスコンパイルのビルド時に使用する ``python`` バイナリへのパス。" #: ../../using/configure.rst:1069 msgid "An environment variable that points to a file with configure overrides." @@ -1619,13 +1690,16 @@ msgstr "構成をオーバーライドするファイルを指す環境変数。 msgid "Example *config.site* file:" msgstr "*config.site* ファイルの例:" -#: ../../using/configure.rst:1073 msgid "" "# config.site-aarch64\n" "ac_cv_buggy_getaddrinfo=no\n" "ac_cv_file__dev_ptmx=yes\n" "ac_cv_file__dev_ptc=no" msgstr "" +"# config.site-aarch64\n" +"ac_cv_buggy_getaddrinfo=no\n" +"ac_cv_file__dev_ptmx=yes\n" +"ac_cv_file__dev_ptc=no" #: ../../using/configure.rst:1082 msgid "Program to run CPython for the host platform for cross-compilation." @@ -1636,13 +1710,16 @@ msgstr "" msgid "Cross compiling example::" msgstr "クロスコンパイルの例::" -#: ../../using/configure.rst:1089 msgid "" "CONFIG_SITE=config.site-aarch64 ../configure \\\n" " --build=x86_64-pc-linux-gnu \\\n" " --host=aarch64-unknown-linux-gnu \\\n" " --with-build-python=../x86_64/python" msgstr "" +"CONFIG_SITE=config.site-aarch64 ../configure \\\n" +" --build=x86_64-pc-linux-gnu \\\n" +" --host=aarch64-unknown-linux-gnu \\\n" +" --with-build-python=../x86_64/python" #: ../../using/configure.rst:1096 msgid "Python Build System" @@ -1679,33 +1756,31 @@ msgstr "" msgid "Main build steps" msgstr "主要なビルドステップ" -#: ../../using/configure.rst:1110 msgid "C files (``.c``) are built as object files (``.o``)." -msgstr "" +msgstr "C ファイル (``.c``) をオブジェクトファイル (``.o``) にビルドします。" -#: ../../using/configure.rst:1111 msgid "A static ``libpython`` library (``.a``) is created from objects files." msgstr "" +"オブジェクトファイルから静的な ``libpython`` ライブラリ (``.a``) を作成しま" +"す。" -#: ../../using/configure.rst:1112 msgid "" "``python.o`` and the static ``libpython`` library are linked into the final " "``python`` program." msgstr "" +"``python.o`` と静的な ``libpython`` ライブラリをリンクして、最終的な " +"``python`` プログラムを作成します。" -#: ../../using/configure.rst:1114 msgid "C extensions are built by the Makefile (see :file:`Modules/Setup`)." msgstr "" +"Makefile によって C 拡張をビルドします (:file:`Modules/Setup` を参照)。" -#: ../../using/configure.rst:1117 msgid "Main Makefile targets" -msgstr "" +msgstr "主な Makefile ターゲット" -#: ../../using/configure.rst:1120 msgid "make" -msgstr "" +msgstr "make" -#: ../../using/configure.rst:1122 msgid "" "For the most part, when rebuilding after editing some code or refreshing " "your checkout from upstream, all you need to do is execute ``make``, which " @@ -1715,23 +1790,30 @@ msgid "" "variable, ``@DEF_MAKE_ALL_RULE@`` to describe precisely which targets ``make " "all`` will build. The three choices are:" msgstr "" +"コードの一部を編集した後や、上流の変更を取り込んでチェックアウトを更新した後" +"に再ビルドする場合、たいていは ``make`` を実行するだけで済みます。\n" +"Make の動作に従い、Makefile で最初に定義されたターゲットであるデフォルトの" +"ターゲットがビルドされます。\n" +"慣例として (CPython プロジェクトでも)、通常は ``all`` がそのターゲットで" +"す。\n" +"``configure`` スクリプトは ``autoconf`` 変数 ``@DEF_MAKE_ALL_RULE@`` を展開し" +"て、``make all`` がビルドするターゲットを正確に指定します。\n" +"選択肢は次の三つです:" -#: ../../using/configure.rst:1131 msgid "``profile-opt`` (configured with ``--enable-optimizations``)" -msgstr "" +msgstr "``profile-opt`` (``--enable-optimizations`` で構成した場合)" -#: ../../using/configure.rst:1132 msgid "" "``build_wasm`` (chosen if the host platform matches ``wasm32-wasi*`` or " "``wasm32-emscripten``)" msgstr "" +"``build_wasm`` (ホストプラットフォームが ``wasm32-wasi*`` または ``wasm32-" +"emscripten`` に一致する場合に選択)" -#: ../../using/configure.rst:1134 msgid "" "``build_all`` (configured without explicitly using either of the others)" -msgstr "" +msgstr "``build_all`` (ほかの二つを明示的に使用せずに構成した場合)" -#: ../../using/configure.rst:1136 msgid "" "Depending on the most recent source file changes, Make will rebuild any " "targets (object files and executables) deemed out-of-date, including running " @@ -1743,123 +1825,136 @@ msgid "" "otherwise explain, ``make clean && make`` should work around most dependency " "problems, at the expense of longer build times." msgstr "" +"Make は、直近のソースファイルの変更に応じて、古くなったと判断したターゲット " +"(オブジェクトファイルと実行ファイル) を再ビルドし、必要であれば " +"``configure`` も再実行します。\n" +"ただし、ソースとターゲットの依存関係は多く、手作業で管理されているため、Make " +"が再ビルドの必要なターゲットをすべて正しく検出するための情報を持っていないこ" +"とがあります。\n" +"再ビルドされなかったターゲットによっては、さまざまな問題が発生する可能性があ" +"ります。\n" +"ほかに原因の説明がつかないビルドやテストの問題がある場合は、``make clean && " +"make`` を実行すると、ビルド時間は長くなりますが、依存関係の問題の大半を回避で" +"きるはずです。" -#: ../../using/configure.rst:1149 msgid "make platform" -msgstr "" +msgstr "make platform" -#: ../../using/configure.rst:1151 msgid "" "Build the ``python`` program, but don't build the standard library extension " "modules. This generates a file named ``platform`` which contains a single " "line describing the details of the build platform, e.g., ``macosx-14.3-" "arm64-3.12`` or ``linux-x86_64-3.13``." msgstr "" +"``python`` プログラムをビルドしますが、標準ライブラリの拡張モジュールはビルド" +"しません。\n" +"ビルドプラットフォームの詳細を表す 1 行 (例えば ``macosx-14.3-arm64-3.12`` " +"や ``linux-x86_64-3.13``) を含む、``platform`` という名前のファイルを生成しま" +"す。" -#: ../../using/configure.rst:1158 msgid "make profile-opt" -msgstr "" +msgstr "make profile-opt" -#: ../../using/configure.rst:1160 msgid "" "Build Python using profile-guided optimization (PGO). You can use the " "configure :option:`--enable-optimizations` option to make this the default " "target of the ``make`` command (``make all`` or just ``make``)." msgstr "" +"プロファイルに基づく最適化 (PGO) を使用して Python をビルドします。\n" +"configure の :option:`--enable-optimizations` オプションを使用すると、この" +"ターゲットを ``make`` コマンド (``make all`` または単に ``make``) のデフォル" +"トにできます。" -#: ../../using/configure.rst:1168 msgid "make clean" -msgstr "" +msgstr "make clean" -#: ../../using/configure.rst:1170 msgid "Remove built files." -msgstr "" +msgstr "ビルドしたファイルを削除します。" -#: ../../using/configure.rst:1174 msgid "make distclean" -msgstr "" +msgstr "make distclean" -#: ../../using/configure.rst:1176 msgid "" "In addition to the work done by ``make clean``, remove files created by the " "configure script. ``configure`` will have to be run before building again. " "[#]_" msgstr "" +"``make clean`` の処理に加え、configure スクリプトが作成したファイルを削除しま" +"す。\n" +"再びビルドする前に、``configure`` を実行する必要があります。 [#]_" -#: ../../using/configure.rst:1182 msgid "make install" -msgstr "" +msgstr "make install" -#: ../../using/configure.rst:1184 msgid "Build the ``all`` target and install Python." -msgstr "" +msgstr "``all`` ターゲットをビルドし、Python をインストールします。" -#: ../../using/configure.rst:1188 msgid "make test" -msgstr "" +msgstr "make test" -#: ../../using/configure.rst:1190 msgid "" "Build the ``all`` target and run the Python test suite with the ``--fast-" "ci`` option without GUI tests. Variables:" msgstr "" +"``all`` ターゲットをビルドし、``--fast-ci`` オプションを指定して、GUI テスト" +"を除いた Python のテストスイートを実行します。\n" +"変数:" -#: ../../using/configure.rst:1193 msgid "``TESTOPTS``: additional regrtest command-line options." -msgstr "" +msgstr "``TESTOPTS``: regrtest の追加のコマンドラインオプション。" -#: ../../using/configure.rst:1194 msgid "``TESTPYTHONOPTS``: additional Python command-line options." -msgstr "" +msgstr "``TESTPYTHONOPTS``: Python の追加のコマンドラインオプション。" -#: ../../using/configure.rst:1195 msgid "``TESTTIMEOUT``: timeout in seconds (default: 10 minutes)." -msgstr "" +msgstr "``TESTTIMEOUT``: タイムアウトの秒数 (デフォルト: 10 分)。" -#: ../../using/configure.rst:1199 msgid "make ci" -msgstr "" +msgstr "make ci" -#: ../../using/configure.rst:1201 msgid "" "This is similar to ``make test``, but uses the ``-ugui`` to also run GUI " "tests." msgstr "" +"``make test`` と似ていますが、``-ugui`` を指定して GUI テストも実行します。" -#: ../../using/configure.rst:1207 msgid "make buildbottest" -msgstr "" +msgstr "make buildbottest" -#: ../../using/configure.rst:1209 msgid "" "This is similar to ``make test``, but uses the ``--slow-ci`` option and " "default timeout of 20 minutes, instead of ``--fast-ci`` option." msgstr "" +"``make test`` と似ていますが、``--fast-ci`` オプションの代わりに ``--slow-" +"ci`` オプションを使用し、デフォルトのタイムアウトを 20 分にします。" -#: ../../using/configure.rst:1214 msgid "make regen-all" -msgstr "" +msgstr "make regen-all" -#: ../../using/configure.rst:1216 msgid "" "Regenerate (almost) all generated files. These include (but are not limited " "to) bytecode cases, and parser generator file. ``make regen-stdlib-module-" "names`` and ``autoconf`` must be run separately for the remaining `generated " "files <#generated-files>`_." msgstr "" +"生成済みファイルの (ほぼ) すべてを再生成します。\n" +"これには、バイトコードのケースやパーサ生成用ファイルなどが含まれます。\n" +"残りの `生成済みファイル <#generated-files>`_ については、``make regen-" +"stdlib-module-names`` と ``autoconf`` を別途実行する必要があります。" -#: ../../using/configure.rst:1223 msgid "C extensions" -msgstr "" +msgstr "C 拡張" -#: ../../using/configure.rst:1225 msgid "" "Some C extensions are built as built-in modules, like the ``sys`` module. " "They are built with the ``Py_BUILD_CORE_BUILTIN`` macro defined. Built-in " "modules have no ``__file__`` attribute:" msgstr "" +"``sys`` モジュールのように、組み込みモジュールとしてビルドする C 拡張がありま" +"す。\n" +"これらは ``Py_BUILD_CORE_BUILTIN`` マクロを定義してビルドします。\n" +"組み込みモジュールには ``__file__`` 属性がありません:" -#: ../../using/configure.rst:1229 msgid "" ">>> import sys\n" ">>> sys\n" @@ -1869,15 +1964,24 @@ msgid "" " File \"\", line 1, in \n" "AttributeError: module 'sys' has no attribute '__file__'" msgstr "" +">>> import sys\n" +">>> sys\n" +"\n" +">>> sys.__file__\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"AttributeError: module 'sys' has no attribute '__file__'" -#: ../../using/configure.rst:1239 msgid "" "Other C extensions are built as dynamic libraries, like the ``_asyncio`` " "module. They are built with the ``Py_BUILD_CORE_MODULE`` macro defined. " "Example on Linux x86-64:" msgstr "" +"``_asyncio`` モジュールのように、動的ライブラリとしてビルドする C 拡張もあり" +"ます。\n" +"これらは ``Py_BUILD_CORE_MODULE`` マクロを定義してビルドします。\n" +"Linux x86-64 での例:" -#: ../../using/configure.rst:1243 msgid "" ">>> import _asyncio\n" ">>> _asyncio\n" @@ -1886,14 +1990,23 @@ msgid "" ">>> _asyncio.__file__\n" "'/usr/lib64/python3.9/lib-dynload/_asyncio.cpython-39-x86_64-linux-gnu.so'" msgstr "" +">>> import _asyncio\n" +">>> _asyncio\n" +"\n" +">>> _asyncio.__file__\n" +"'/usr/lib64/python3.9/lib-dynload/_asyncio.cpython-39-x86_64-linux-gnu.so'" -#: ../../using/configure.rst:1251 msgid "" ":file:`Modules/Setup` is used to generate Makefile targets to build C " "extensions. At the beginning of the files, C extensions are built as built-" "in modules. Extensions defined after the ``*shared*`` marker are built as " "dynamic libraries." msgstr "" +":file:`Modules/Setup` は、C 拡張をビルドする Makefile ターゲットの生成に使用" +"します。\n" +"ファイルの先頭では、C 拡張を組み込みモジュールとしてビルドします。\n" +"``*shared*`` マーカーの後で定義した拡張は、動的ライブラリとしてビルドします。" #: ../../using/configure.rst:1255 msgid "" @@ -1910,37 +2023,39 @@ msgstr "" msgid "Use ``Py_IMPORTED_SYMBOL`` otherwise." msgstr "" -#: ../../using/configure.rst:1262 msgid "" "If the ``Py_BUILD_CORE_BUILTIN`` macro is used by mistake on a C extension " "built as a shared library, its :samp:`PyInit_{xxx}()` function is not " "exported, causing an :exc:`ImportError` on import." msgstr "" +"共有ライブラリとしてビルドする C 拡張に誤って ``Py_BUILD_CORE_BUILTIN`` マク" +"ロを使用すると、:samp:`PyInit_{xxx}()` 関数がエクスポートされず、インポート時" +"に :exc:`ImportError` が発生します。" -#: ../../using/configure.rst:1268 msgid "Compiler and linker flags" -msgstr "" +msgstr "コンパイラとリンカのフラグ" -#: ../../using/configure.rst:1270 msgid "" "Options set by the ``./configure`` script and environment variables and used " "by ``Makefile``." msgstr "" +"``./configure`` スクリプトと環境変数によって設定され、``Makefile`` で使用され" +"るオプション。" -#: ../../using/configure.rst:1274 msgid "Preprocessor flags" -msgstr "" +msgstr "プリプロセッサのフラグ" -#: ../../using/configure.rst:1278 msgid "" "Value of :envvar:`CPPFLAGS` variable passed to the ``./configure`` script." -msgstr "" +msgstr "``./configure`` スクリプトに渡された :envvar:`CPPFLAGS` 変数の値。" -#: ../../using/configure.rst:1284 msgid "" "(Objective) C/C++ preprocessor flags, e.g. :samp:`-I{include_dir}` if you " "have headers in a nonstandard directory *include_dir*." msgstr "" +"(Objective) C/C++ プリプロセッサのフラグ。\n" +"例えば、標準以外のディレクトリ *include_dir* にヘッダーファイルがある場合の :" +"samp:`-I{include_dir}`。" #: ../../using/configure.rst:1287 ../../using/configure.rst:1477 msgid "" @@ -1949,50 +2064,52 @@ msgid "" "in the environment variables." msgstr "" -#: ../../using/configure.rst:1297 msgid "" "Extra preprocessor flags added for building the interpreter object files." msgstr "" +"インタープリタのオブジェクトファイルをビルドするために追加するプリプロセッサ" +"のフラグ。" -#: ../../using/configure.rst:1299 msgid "" "Default: ``$(BASECPPFLAGS) -I. -I$(srcdir)/Include $(CONFIGURE_CPPFLAGS) " "$(CPPFLAGS)``." msgstr "" +"デフォルト: ``$(BASECPPFLAGS) -I. -I$(srcdir)/Include $(CONFIGURE_CPPFLAGS) " +"$(CPPFLAGS)``。" -#: ../../using/configure.rst:1304 msgid "Compiler flags" -msgstr "" +msgstr "コンパイラのフラグ" -#: ../../using/configure.rst:1310 msgid "Example: ``gcc -pthread``." -msgstr "" +msgstr "例: ``gcc -pthread``。" -#: ../../using/configure.rst:1314 msgid "C++ compiler command." -msgstr "" +msgstr "C++ コンパイラのコマンド。" -#: ../../using/configure.rst:1316 msgid "Example: ``g++ -pthread``." -msgstr "" +msgstr "例: ``g++ -pthread``。" -#: ../../using/configure.rst:1324 msgid "" ":envvar:`CFLAGS_NODIST` is used for building the interpreter and stdlib C " "extensions. Use it when a compiler flag should *not* be part of :envvar:" "`CFLAGS` once Python is installed (:gh:`65320`)." msgstr "" +":envvar:`CFLAGS_NODIST` は、インタープリタと標準ライブラリの C 拡張のビルドに" +"使用します。\n" +"Python のインストール後に :envvar:`CFLAGS` に *含めるべきでない* コンパイラフ" +"ラグには、この変数を使用してください (:gh:`65320`)。" -#: ../../using/configure.rst:1328 msgid "In particular, :envvar:`CFLAGS` should not contain:" -msgstr "" +msgstr "特に、:envvar:`CFLAGS` には次のものを含めないようにしてください:" -#: ../../using/configure.rst:1330 msgid "" "the compiler flag ``-I`` (for setting the search path for include files). " "The ``-I`` flags are processed from left to right, and any flags in :envvar:" "`CFLAGS` would take precedence over user- and package-supplied ``-I`` flags." msgstr "" +"コンパイラフラグ ``-I`` (インクルードファイルの検索パスの設定用)。\n" +"``-I`` フラグは左から右へ処理されるため、:envvar:`CFLAGS` にあるフラグは、" +"ユーザーやパッケージが指定する ``-I`` フラグよりも優先されてしまいます。" #: ../../using/configure.rst:1335 msgid "" @@ -2000,199 +2117,195 @@ msgid "" "whether packages installed by users conform to such heightened standards." msgstr "" -#: ../../using/configure.rst:1343 msgid "" "Options passed to the :mod:`compileall` command line when building PYC files " "in ``make install``. Default: ``-j0``." msgstr "" +"``make install`` で PYC ファイルをビルドするときに、:mod:`compileall` のコマ" +"ンドラインに渡すオプション。\n" +"デフォルト: ``-j0``。" -#: ../../using/configure.rst:1350 msgid "Extra C compiler flags." -msgstr "" +msgstr "追加の C コンパイラのフラグ。" -#: ../../using/configure.rst:1354 msgid "" "Value of :envvar:`CFLAGS` variable passed to the ``./configure`` script." -msgstr "" +msgstr "``./configure`` スクリプトに渡された :envvar:`CFLAGS` 変数の値。" -#: ../../using/configure.rst:1361 msgid "" "Value of :envvar:`CFLAGS_NODIST` variable passed to the ``./configure`` " "script." msgstr "" +"``./configure`` スクリプトに渡された :envvar:`CFLAGS_NODIST` 変数の値。" -#: ../../using/configure.rst:1368 msgid "Base compiler flags." -msgstr "" +msgstr "基本のコンパイラフラグ。" -#: ../../using/configure.rst:1372 msgid "Optimization flags." -msgstr "" +msgstr "最適化フラグ。" -#: ../../using/configure.rst:1376 msgid "Strict or non-strict aliasing flags used to compile ``Python/dtoa.c``." msgstr "" +"``Python/dtoa.c`` のコンパイルに使用する、厳密なエイリアシングまたは非厳密な" +"エイリアシングのフラグ。" -#: ../../using/configure.rst:1382 msgid "Compiler flags used to build a shared library." -msgstr "" +msgstr "共有ライブラリのビルドに使用するコンパイラフラグ。" -#: ../../using/configure.rst:1384 msgid "For example, ``-fPIC`` is used on Linux and on BSD." -msgstr "" +msgstr "例えば、Linux と BSD では ``-fPIC`` を使用します。" -#: ../../using/configure.rst:1388 msgid "Extra C flags added for building the interpreter object files." msgstr "" +"インタープリタのオブジェクトファイルをビルドするために追加する C フラグ。" -#: ../../using/configure.rst:1390 msgid "" "Default: ``$(CCSHARED)`` when :option:`--enable-shared` is used, or an empty " "string otherwise." msgstr "" +"デフォルト: :option:`--enable-shared` を使用する場合は ``$(CCSHARED)``、それ" +"以外の場合は空文字列。" -#: ../../using/configure.rst:1395 msgid "" "Default: ``$(BASECFLAGS) $(OPT) $(CONFIGURE_CFLAGS) $(CFLAGS) " "$(EXTRA_CFLAGS)``." msgstr "" +"デフォルト: ``$(BASECFLAGS) $(OPT) $(CONFIGURE_CFLAGS) $(CFLAGS) " +"$(EXTRA_CFLAGS)``。" -#: ../../using/configure.rst:1399 msgid "" "Default: ``$(CONFIGURE_CFLAGS_NODIST) $(CFLAGS_NODIST) -I$(srcdir)/Include/" "internal``." msgstr "" +"デフォルト: ``$(CONFIGURE_CFLAGS_NODIST) $(CFLAGS_NODIST) -I$(srcdir)/" +"Include/internal``。" -#: ../../using/configure.rst:1405 msgid "C flags used for building the interpreter object files." -msgstr "" +msgstr "インタープリタのオブジェクトファイルのビルドに使用する C フラグ。" -#: ../../using/configure.rst:1407 msgid "" "Default: ``$(PY_CFLAGS) $(PY_CFLAGS_NODIST) $(PY_CPPFLAGS) " "$(CFLAGSFORSHARED)``." msgstr "" +"デフォルト: ``$(PY_CFLAGS) $(PY_CFLAGS_NODIST) $(PY_CPPFLAGS) " +"$(CFLAGSFORSHARED)``。" -#: ../../using/configure.rst:1413 msgid "Default: ``$(PY_STDMODULE_CFLAGS) -DPy_BUILD_CORE``." -msgstr "" +msgstr "デフォルト: ``$(PY_STDMODULE_CFLAGS) -DPy_BUILD_CORE``。" -#: ../../using/configure.rst:1419 msgid "" "Compiler flags to build a standard library extension module as a built-in " "module, like the :mod:`posix` module." msgstr "" +":mod:`posix` モジュールのように、標準ライブラリの拡張モジュールを組み込みモ" +"ジュールとしてビルドするためのコンパイラフラグ。" -#: ../../using/configure.rst:1422 msgid "Default: ``$(PY_STDMODULE_CFLAGS) -DPy_BUILD_CORE_BUILTIN``." -msgstr "" +msgstr "デフォルト: ``$(PY_STDMODULE_CFLAGS) -DPy_BUILD_CORE_BUILTIN``。" -#: ../../using/configure.rst:1428 msgid "Purify command. Purify is a memory debugger program." msgstr "" +"Purify のコマンド。\n" +"Purify はメモリデバッガプログラムです。" -#: ../../using/configure.rst:1430 msgid "Default: empty string (not used)." -msgstr "" +msgstr "デフォルト: 空文字列 (使用しません)。" -#: ../../using/configure.rst:1434 msgid "Linker flags" -msgstr "" +msgstr "リンカのフラグ" -#: ../../using/configure.rst:1438 msgid "" "Linker command used to build programs like ``python`` and ``_testembed``." msgstr "" +"``python`` や ``_testembed`` のようなプログラムをビルドするためのリンカコマン" +"ド。" -#: ../../using/configure.rst:1440 msgid "Default: ``$(PURIFY) $(CC)``." -msgstr "" +msgstr "デフォルト: ``$(PURIFY) $(CC)``。" -#: ../../using/configure.rst:1444 msgid "" "Value of :envvar:`LDFLAGS` variable passed to the ``./configure`` script." -msgstr "" +msgstr "``./configure`` スクリプトに渡された :envvar:`LDFLAGS` 変数の値。" -#: ../../using/configure.rst:1446 msgid "" "Avoid assigning :envvar:`CFLAGS`, :envvar:`LDFLAGS`, etc. so users can use " "them on the command line to append to these values without stomping the pre-" "set values." msgstr "" +":envvar:`CFLAGS` や :envvar:`LDFLAGS` などへの代入は避けてください。\n" +"そうすることで、ユーザーはあらかじめ設定された値を上書きせずに、コマンドライ" +"ンでこれらの変数の値に追加できます。" -#: ../../using/configure.rst:1454 msgid "" ":envvar:`LDFLAGS_NODIST` is used in the same manner as :envvar:" "`CFLAGS_NODIST`. Use it when a linker flag should *not* be part of :envvar:" "`LDFLAGS` once Python is installed (:gh:`65320`)." msgstr "" +":envvar:`LDFLAGS_NODIST` は :envvar:`CFLAGS_NODIST` と同じように使用しま" +"す。\n" +"Python のインストール後に :envvar:`LDFLAGS` に *含めるべきでない* リンカフラ" +"グには、この変数を使用してください (:gh:`65320`)。" -#: ../../using/configure.rst:1458 msgid "In particular, :envvar:`LDFLAGS` should not contain:" -msgstr "" +msgstr "特に、:envvar:`LDFLAGS` には次のものを含めないようにしてください:" -#: ../../using/configure.rst:1460 msgid "" "the compiler flag ``-L`` (for setting the search path for libraries). The ``-" "L`` flags are processed from left to right, and any flags in :envvar:" "`LDFLAGS` would take precedence over user- and package-supplied ``-L`` flags." msgstr "" +"コンパイラフラグ ``-L`` (ライブラリの検索パスの設定用)。\n" +"``-L`` フラグは左から右へ処理されるため、:envvar:`LDFLAGS` にあるフラグは、" +"ユーザーやパッケージが指定する ``-L`` フラグよりも優先されてしまいます。" -#: ../../using/configure.rst:1467 msgid "" "Value of :envvar:`LDFLAGS_NODIST` variable passed to the ``./configure`` " "script." msgstr "" +"``./configure`` スクリプトに渡された :envvar:`LDFLAGS_NODIST` 変数の値。" -#: ../../using/configure.rst:1474 msgid "" "Linker flags, e.g. :samp:`-L{lib_dir}` if you have libraries in a " "nonstandard directory *lib_dir*." msgstr "" +"リンカのフラグ。\n" +"例えば、標準以外のディレクトリ *lib_dir* にライブラリがある場合の :samp:`-" +"L{lib_dir}`。" -#: ../../using/configure.rst:1483 msgid "" "Linker flags to pass libraries to the linker when linking the Python " "executable." msgstr "" +"Python 実行ファイルのリンク時に、ライブラリをリンカに渡すためのリンカフラグ。" -#: ../../using/configure.rst:1486 msgid "Example: ``-lrt``." -msgstr "" +msgstr "例: ``-lrt``。" -#: ../../using/configure.rst:1490 msgid "Command to build a shared library." -msgstr "" +msgstr "共有ライブラリをビルドするコマンド。" -#: ../../using/configure.rst:1492 msgid "Default: ``@LDSHARED@ $(PY_LDFLAGS)``." -msgstr "" +msgstr "デフォルト: ``@LDSHARED@ $(PY_LDFLAGS)``。" -#: ../../using/configure.rst:1496 msgid "Command to build ``libpython`` shared library." -msgstr "" +msgstr "``libpython`` 共有ライブラリをビルドするコマンド。" -#: ../../using/configure.rst:1498 msgid "Default: ``@BLDSHARED@ $(PY_CORE_LDFLAGS)``." -msgstr "" +msgstr "デフォルト: ``@BLDSHARED@ $(PY_CORE_LDFLAGS)``。" -#: ../../using/configure.rst:1502 msgid "Default: ``$(CONFIGURE_LDFLAGS) $(LDFLAGS)``." -msgstr "" +msgstr "デフォルト: ``$(CONFIGURE_LDFLAGS) $(LDFLAGS)``。" -#: ../../using/configure.rst:1506 msgid "Default: ``$(CONFIGURE_LDFLAGS_NODIST) $(LDFLAGS_NODIST)``." -msgstr "" +msgstr "デフォルト: ``$(CONFIGURE_LDFLAGS_NODIST) $(LDFLAGS_NODIST)``。" -#: ../../using/configure.rst:1512 msgid "Linker flags used for building the interpreter object files." -msgstr "" +msgstr "インタープリタのオブジェクトファイルのビルドに使用するリンカフラグ。" #: ../../using/configure.rst:1518 msgid "Footnotes" msgstr "脚注" -#: ../../using/configure.rst:1519 msgid "" "``git clean -fdx`` is an even more extreme way to \"clean\" your checkout. " "It removes all files not known to Git. When bug hunting using ``git " @@ -2201,3 +2314,11 @@ msgid "" "clean build. **Use with care**, as it will delete all files not checked into " "Git, including your new, uncommitted work." msgstr "" +"チェックアウトを「クリーン」にするさらに徹底した方法は、``git clean -fdx`` で" +"す。\n" +"このコマンドは Git が認識していないファイルをすべて削除します。\n" +"``git bisect`` でバグを調査するときは、完全にクリーンなビルドを保証するため、" +"`各調査の間での実行が推奨されています `_。\n" +"新しく作成した未コミットの作業を含め、Git にチェックインされていないすべての" +"ファイルを削除するため、**注意して使用してください**。" diff --git a/using/editors.po b/using/editors.po index 63ffb3f28..52b6dd418 100644 --- a/using/editors.po +++ b/using/editors.po @@ -16,10 +16,10 @@ msgstr "" "Last-Translator: tomo, 2021\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../using/editors.rst:7 @@ -38,9 +38,8 @@ msgstr "" #: ../../using/editors.rst:14 msgid "IDLE --- Python editor and shell" -msgstr "" +msgstr "IDLE --- Python のエディタとシェル" -#: ../../using/editors.rst:16 msgid "" "IDLE is Python’s Integrated Development and Learning Environment and is " "generally bundled with Python installs. If you are on Linux and do not have " @@ -48,12 +47,15 @@ msgid "" "`. For more information see the :ref:`IDLE docs " "`." msgstr "" +"IDLE は Python の統合開発学習環境で、通常は Python のインストールに含まれてい" +"ます。\n" +"Linux を使用していて IDLE がインストールされていない場合は、:ref:`Linux への " +"IDLE のインストール ` を参照してください。\n" +"詳しくは :ref:`IDLE のドキュメント ` を参照してください。" -#: ../../using/editors.rst:22 msgid "Other Editors and IDEs" -msgstr "" +msgstr "その他のエディタと IDE" -#: ../../using/editors.rst:24 msgid "" "Python's community wiki has information submitted by the community on " "Editors and IDEs. Please go to `Python Editors `_ for a comprehensive " "list." msgstr "" +"Python のコミュニティ wiki には、エディタや IDE についてコミュニティから寄せ" +"られた情報があります。\n" +"網羅的な一覧については、`Python Editors `_ と `Integrated Development Environments `_ を参照してください。" diff --git a/using/index.po b/using/index.po index b8afd38ea..4e452f709 100644 --- a/using/index.po +++ b/using/index.po @@ -16,10 +16,10 @@ msgstr "" "Last-Translator: tomo, 2021\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../using/index.rst:5 diff --git a/using/mac.po b/using/mac.po index 9a5b8109e..85b89e790 100644 --- a/using/mac.po +++ b/using/mac.po @@ -19,25 +19,28 @@ msgstr "" "Last-Translator: 石井明久, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../using/mac.rst:6 msgid "Using Python on macOS" -msgstr "" +msgstr "macOS で Python を使う" -#: ../../using/mac.rst:11 msgid "" "This document aims to give an overview of macOS-specific behavior you should " "know about to get started with Python on Mac computers. Python on a Mac " "running macOS is very similar to Python on other Unix-derived platforms, but " "there are some differences in installation and some features." msgstr "" +"このドキュメントでは、Mac コンピュータで Python を使い始める際に知っておくべ" +"き、macOS 固有の挙動を概説します。\n" +"macOS を実行する Mac 上の Python は、ほかの Unix 派生プラットフォーム上の " +"Python と非常によく似ていますが、インストール方法や一部の機能には違いがありま" +"す。" -#: ../../using/mac.rst:16 msgid "" "There are various ways to obtain and install Python for macOS. Pre-built " "versions of the most recent versions of Python are available from a number " @@ -46,10 +49,16 @@ msgid "" "`_. See :ref:`alternative_bundles` for " "some other options." msgstr "" +"macOS 用の Python を入手してインストールする方法はいくつかあります。\n" +"最近の Python のバージョンは、複数の配布元からビルド済みのものを入手できま" +"す。\n" +"このドキュメントの大部分では、CPython リリースチームが `python.org のウェブサ" +"イト `_ でダウンロード用に提供している " +"Python の使い方を説明します。\n" +"ほかの選択肢については :ref:`alternative_bundles` を参照してください。" -#: ../../using/mac.rst:34 msgid "Using Python for macOS from ``python.org``" -msgstr "" +msgstr "``python.org`` の macOS 用 Python を使う" #: ../../using/mac.rst:37 msgid "Installation steps" @@ -95,20 +104,24 @@ msgid "" "usemac_applications_folder_version| and available to read anytime." msgstr "" -#: ../../using/mac.rst:71 msgid "" "Clicking on **Continue** proceeds to display the license for Python and for " "other included software. You will then need to **Agree** to the license " "terms before proceeding to the next step. This license file will also be " "installed and available to be read later." msgstr "" +"**Continue** をクリックすると、Python および同梱されるほかのソフトウェアのラ" +"イセンスが表示されます。\n" +"次の手順に進むには、ライセンス条項に **Agree** で同意する必要があります。\n" +"このライセンスファイルもインストールされ、後で読むことができます。" -#: ../../using/mac.rst:78 msgid "" "After the license terms are accepted, the next step is the **Installation " "Type** display. For most uses, the standard set of installation operations " "is appropriate." msgstr "" +"ライセンス条項に同意すると、次に **Installation Type** 画面が表示されます。\n" +"ほとんどの用途では、標準のインストール内容が適切です。" #: ../../using/mac.rst:83 msgid "" @@ -119,17 +132,19 @@ msgid "" "macos`." msgstr "" -#: ../../using/mac.rst:91 msgid "" "In either case, clicking **Install** will begin the install process by " "asking permission to install new software. A macOS user name with " "``Administrator`` privilege is needed as the installed Python will be " "available to all users of the Mac." msgstr "" +"どちらの場合も、**Install** をクリックすると、新しいソフトウェアをインストー" +"ルするための許可を求めてインストール処理が始まります。\n" +"インストールした Python はその Mac のすべてのユーザーが利用できるため、" +"``Administrator`` 権限のある macOS ユーザー名が必要です。" -#: ../../using/mac.rst:95 msgid "When the installation is complete, the **Summary** window will appear." -msgstr "" +msgstr "インストールが完了すると、**Summary** ウィンドウが表示されます。" #: ../../using/mac.rst:99 msgid "" @@ -137,11 +152,12 @@ msgid "" "the |usemac_applications_folder_version| window to complete the installation." msgstr "" -#: ../../using/mac.rst:105 msgid "" "This will open a temporary :program:`Terminal` shell window that will use " "the new Python to download and install SSL root certificates for its use." msgstr "" +"一時的な :program:`Terminal` シェルウィンドウが開き、新しい Python を使って、" +"その Python 用の SSL ルート証明書をダウンロードしてインストールします。" #: ../../using/mac.rst:111 msgid "" @@ -150,9 +166,8 @@ msgid "" "and the installer window." msgstr "" -#: ../../using/mac.rst:115 msgid "A default install will include:" -msgstr "" +msgstr "デフォルトのインストールには、次のものが含まれます:" #: ../../using/mac.rst:117 msgid "" @@ -171,7 +186,6 @@ msgid "" "to the Python executable are placed in :file:`/usr/local/bin/`." msgstr "" -#: ../../using/mac.rst:129 msgid "" "Recent versions of macOS include a :command:`python3` command in :file:`/usr/" "bin/python3` that links to a usually older and incomplete version of Python " @@ -184,6 +198,18 @@ msgid "" "default installer options should ensure that its :command:`python3` will be " "used instead of the system :command:`python3`." msgstr "" +"最近の macOS には、:file:`/usr/bin/python3` に :command:`python3` コマンドが" +"含まれています。\n" +"これは、Apple の開発ツールである :program:`Xcode` または :program:`Command " +"Line Tools for Xcode` によって、それらのツールで使用するために提供される " +"Python にリンクしており、通常は古く、不完全なバージョンです。\n" +"この Python は Apple が管理し、Apple 製やサードパーティのソフトウェアが使用す" +"るため、決して変更したり、削除しようとしたりしないでください。\n" +"``python.org`` から新しいバージョンの Python をインストールすると、コンピュー" +"タには異なる 2 つの Python 環境が存在することになりますが、両方とも動作し、共" +"存できます。\n" +"インストーラのデフォルトのオプションでは、システムの :command:`python3` に代" +"わって、インストールした :command:`python3` が使用されるはずです。" #: ../../using/mac.rst:140 msgid "How to run a Python script" @@ -199,7 +225,6 @@ msgid "" "a shell `." msgstr "" -#: ../../using/mac.rst:149 msgid "" "You can also invoke the interpreter through an integrated development " "environment. :ref:`idle` is a basic editor and interpreter environment which " @@ -208,32 +233,37 @@ msgid "" "are completely new to Python, you can read the tutorial introduction in that " "document." msgstr "" +"統合開発環境からインタープリタを起動することもできます。\n" +":ref:`idle` は、Python の標準配布物に含まれる基本的なエディタとインタープリタ" +"の環境です。\n" +":program:`IDLE` の Help メニューから Python のドキュメントを参照できます。\n" +"Python を初めて使う場合は、そのドキュメントにあるチュートリアルの導入部分を読" +"むとよいでしょう。" -#: ../../using/mac.rst:157 msgid "" "There are many other editors and IDEs available, see :ref:`editors` for more " "information." msgstr "" +"ほかにも多くのエディタや IDE を利用できます。\n" +"詳細は :ref:`editors` を参照してください。" -#: ../../using/mac.rst:160 msgid "" "To run a Python script file from the terminal window, you can invoke the " "interpreter with the name of the script file:" msgstr "" +"ターミナルウィンドウから Python スクリプトファイルを実行するには、スクリプト" +"ファイル名を指定してインタープリタを起動します:" #: ../../using/mac.rst:163 msgid "|usemac_python_x_dot_y_literal| ``myscript.py``" msgstr "" -#: ../../using/mac.rst:165 msgid "To run your script from the Finder, you can either:" -msgstr "" +msgstr "Finder からスクリプトを実行するには、次のいずれかの方法を使います:" -#: ../../using/mac.rst:167 msgid "Drag it to :program:`Python Launcher`." -msgstr "" +msgstr "スクリプトを :program:`Python Launcher` にドラッグします。" -#: ../../using/mac.rst:169 msgid "" "Select :program:`Python Launcher` as the default application to open your " "script (or any ``.py`` script) through the Finder Info window and double-" @@ -241,8 +271,15 @@ msgid "" "your script is launched. Option-dragging allows you to change these for one " "invocation, or use its ``Preferences`` menu to change things globally." msgstr "" +"Finder の情報ウィンドウで、スクリプト (または任意の ``.py`` スクリプト) を開" +"くデフォルトのアプリケーションとして :program:`Python Launcher` を選択し、ス" +"クリプトをダブルクリックします。\n" +":program:`Python Launcher` には、スクリプトの起動方法を制御するさまざまな環境" +"設定があります。\n" +"Option キーを押しながらドラッグすると、今回の起動に限って設定を変更できま" +"す。\n" +"全体の設定を変更するには、``Preferences`` メニューを使います。" -#: ../../using/mac.rst:175 msgid "" "Be aware that running the script directly from the macOS Finder might " "produce different results than when running from a terminal window as the " @@ -250,70 +287,81 @@ msgid "" "of environment variables in shell profiles. And, as with any other script or " "program, be certain of what you are about to run." msgstr "" +"macOS の Finder から直接スクリプトを実行すると、ターミナルウィンドウから実行" +"した場合と結果が異なることがあります。\n" +"シェルのプロファイルでの環境変数の設定など、通常のシェル環境でスクリプトが実" +"行されるわけではないためです。\n" +"また、ほかのスクリプトやプログラムを実行するときと同様に、何を実行しようとし" +"ているかを確認してください。" #: ../../using/mac.rst:185 msgid "Alternative Distributions" msgstr "" -#: ../../using/mac.rst:187 msgid "" "Besides the standard ``python.org`` for macOS installer, there are third-" "party distributions for macOS that may include additional functionality. " "Some popular distributions and their key features:" msgstr "" +"macOS 用の標準の ``python.org`` インストーラに加えて、追加の機能を含む場合が" +"あるサードパーティの macOS 用配布物もあります。\n" +"よく使われる配布物とその主な特徴を紹介します:" #: ../../using/mac.rst:191 msgid "`ActivePython `_" msgstr "`ActivePython `_" -#: ../../using/mac.rst:192 msgid "Installer with multi-platform compatibility, documentation" -msgstr "" +msgstr "複数のプラットフォームに対応するインストーラ、ドキュメント" #: ../../using/mac.rst:194 msgid "`Anaconda `_" msgstr "`Anaconda `_" -#: ../../using/mac.rst:195 msgid "" "Popular scientific modules (such as numpy, scipy, and pandas) and the " "``conda`` package manager." msgstr "" +"よく使われる科学計算モジュール (numpy、scipy、pandas など) と ``conda`` パッ" +"ケージマネージャ。" -#: ../../using/mac.rst:198 msgid "`Homebrew `_" -msgstr "" +msgstr "`Homebrew `_" -#: ../../using/mac.rst:199 msgid "" "Package manager for macOS including multiple versions of Python and many " "third-party Python-based packages (including numpy, scipy, and pandas)." msgstr "" +"複数バージョンの Python と、Python に基づく多くのサードパーティパッケージ " +"(numpy、scipy、pandas など) を含む macOS 用パッケージマネージャ。" -#: ../../using/mac.rst:202 msgid "`MacPorts `_" -msgstr "" +msgstr "`MacPorts `_" -#: ../../using/mac.rst:203 msgid "" "Another package manager for macOS including multiple versions of Python and " "many third-party Python-based packages. May include pre-built versions of " "Python and many packages for older versions of macOS." msgstr "" +"複数バージョンの Python と、Python に基づく多くのサードパーティパッケージを含" +"む、もう一つの macOS 用パッケージマネージャ。\n" +"古い macOS バージョン用にビルドされた Python や多くのパッケージを含む場合があ" +"ります。" -#: ../../using/mac.rst:207 msgid "" "Note that distributions might not include the latest versions of Python or " "other libraries, and are not maintained or supported by the core Python team." msgstr "" +"これらの配布物には最新バージョンの Python やほかのライブラリが含まれていない" +"ことがあり、Python のコアチームによる保守やサポートも行われていない点に注意し" +"てください。" #: ../../using/mac.rst:213 msgid "Installing Additional Python Packages" msgstr "追加の Python パッケージのインストール" -#: ../../using/mac.rst:215 msgid "Refer to the `Python Packaging User Guide`_ for more information." -msgstr "" +msgstr "詳細は `Python Packaging User Guide`_ を参照してください。" #: ../../using/mac.rst:225 msgid "GUI Programming" @@ -326,52 +374,62 @@ msgid "" msgstr "" "Python で Mac 上の GUI アプリケーションをビルドする方法がいくつかあります。" -#: ../../using/mac.rst:229 msgid "" "The standard Python GUI toolkit is :mod:`tkinter`, based on the cross-" "platform Tk toolkit (https://www.tcl.tk). A macOS-native version of Tk is " "included with the installer." msgstr "" +"Python の標準 GUI ツールキットは、複数のプラットフォームに対応する Tk ツール" +"キット (https://www.tcl.tk) を基にした :mod:`tkinter` です。\n" +"インストーラには、macOS でネイティブに動作するバージョンの Tk が含まれていま" +"す。" -#: ../../using/mac.rst:233 msgid "" "*PyObjC* is a Python binding to Apple's Objective-C/Cocoa framework. " "Information on PyObjC is available from :pypi:`pyobjc`." msgstr "" +"*PyObjC* は、Apple の Objective-C/Cocoa フレームワークの Python バインディン" +"グです。\n" +"PyObjC についての情報は :pypi:`pyobjc` を参照してください。" -#: ../../using/mac.rst:236 msgid "A number of alternative macOS GUI toolkits are available including:" -msgstr "" +msgstr "macOS 用の GUI ツールキットには、次のようなほかの選択肢もあります:" -#: ../../using/mac.rst:238 msgid "" "`PySide `_: Official Python bindings to the " "`Qt GUI toolkit `_." msgstr "" +"`PySide `_: `Qt GUI ツールキット `_ の公式 Python バインディング。" -#: ../../using/mac.rst:241 msgid "" "`PyQt `_: Alternative Python " "bindings to Qt." msgstr "" +"`PyQt `_: Qt 用の別の Python " +"バインディング。" -#: ../../using/mac.rst:244 msgid "" "`Kivy `_: A cross-platform GUI toolkit that supports " "desktop and mobile platforms." msgstr "" +"`Kivy `_: デスクトップとモバイルのプラットフォームに対応す" +"る GUI ツールキット。" -#: ../../using/mac.rst:247 msgid "" "`Toga `_: Part of the `BeeWare Project `_; supports desktop, mobile, web and console apps." msgstr "" +"`Toga `_: `BeeWare Project `_ の一部で、デスクトップ、モバイル、ウェブ、コンソールのアプリに対応しま" +"す。" -#: ../../using/mac.rst:250 msgid "" "`wxPython `_: A cross-platform toolkit that supports " "desktop operating systems." msgstr "" +"`wxPython `_: 複数のデスクトップ OS に対応するツール" +"キット。" #: ../../using/mac.rst:255 msgid "Advanced Topics" @@ -422,9 +480,8 @@ msgid "" "layout is itself experimental and is subject to change in future releases." msgstr "" -#: ../../using/mac.rst:290 msgid "Known cautions and limitations:" -msgstr "" +msgstr "既知の注意点と制限:" #: ../../using/mac.rst:292 msgid "" @@ -454,39 +511,40 @@ msgid "" "use with |usemac_python_x_dot_y_t_literal|." msgstr "" -#: ../../using/mac.rst:310 msgid "To install a package using :command:`pip` without a :command:`venv`:" msgstr "" +":command:`venv` を使わずに :command:`pip` でパッケージをインストールするに" +"は、次のようにします:" #: ../../using/mac.rst:312 msgid "|usemac_python_x_dot_y_t_literal| ``-m pip install ``" msgstr "" -#: ../../using/mac.rst:314 msgid "" "When working with multiple Python environments, it is usually safest and " "easiest to :ref:`create and use virtual environments `. This can " "avoid possible command name conflicts and confusion about which Python is in " "use:" msgstr "" +"複数の Python 環境を使用する場合は、通常、:ref:`仮想環境を作成して使用する " +"` のが最も安全で簡単です。\n" +"これにより、コマンド名が衝突したり、どの Python を使用しているか分からなく" +"なったりするのを避けられます:" #: ../../using/mac.rst:318 msgid "|usemac_python_x_dot_y_t_literal| ``-m venv ``" msgstr "" -#: ../../using/mac.rst:320 msgid "then :command:`activate`." -msgstr "" +msgstr "続いて :command:`activate` を実行します。" -#: ../../using/mac.rst:322 msgid "To run a free-threaded version of IDLE:" -msgstr "" +msgstr "フリースレッド版の IDLE を実行するには、次のようにします:" #: ../../using/mac.rst:324 msgid "|usemac_python_x_dot_y_t_literal| ``-m idlelib``" msgstr "" -#: ../../using/mac.rst:326 msgid "" "The interpreters in both builds respond to the same :ref:`PYTHON environment " "variables ` which may have unexpected results, for " @@ -494,8 +552,12 @@ msgid "" "there are :ref:`command line options ` like ``-" "E`` to ignore these environment variables." msgstr "" +"どちらのビルドのインタープリタも同じ :ref:`PYTHON 環境変数 ` を参照するため、例えばシェルのプロファイルで ``PYTHONPATH`` を設定" +"していると、予期しない結果になる場合があります。\n" +"必要に応じて、``-E`` のような :ref:`コマンドラインオプション ` を使い、これらの環境変数を無視できます。" -#: ../../using/mac.rst:333 msgid "" "The free-threaded build links to the third-party shared libraries, such as " "``OpenSSL`` and ``Tk``, installed in the traditional framework. This means " @@ -503,6 +565,11 @@ msgid "" "the :command:`Install Certificates.command` script, thus it only needs to be " "run once." msgstr "" +"フリースレッドビルドは、従来のフレームワークにインストールされた ``OpenSSL`` " +"や ``Tk`` などのサードパーティの共有ライブラリにリンクします。\n" +"そのため、両方のビルドは :command:`Install Certificates.command` スクリプトで" +"インストールした信頼証明書も共有するので、このスクリプトは一度実行するだけで" +"済みます。" #: ../../using/mac.rst:339 msgid "" @@ -539,9 +606,8 @@ msgid "" "python3.13t\"" msgstr "" -#: ../../using/mac.rst:364 msgid "Installing using the command line" -msgstr "" +msgstr "コマンドラインからのインストール" #: ../../using/mac.rst:366 msgid "" @@ -614,13 +680,17 @@ msgid "" "(clang-1500.3.9.4)]" msgstr "" -#: ../../using/mac.rst:423 msgid "" "Current ``python.org`` installers only install to fixed locations like :file:" "`/Library/Frameworks/`, :file:`/Applications`, and :file:`/usr/local/bin`. " "You cannot use the :command:`installer` ``-domain`` option to install to " "other locations." msgstr "" +"現在の ``python.org`` インストーラは、:file:`/Library/Frameworks/`、:file:`/" +"Applications`、:file:`/usr/local/bin` などの決められた場所にのみインストール" +"します。\n" +":command:`installer` の ``-domain`` オプションを使って、ほかの場所にインス" +"トールすることはできません。" #: ../../using/mac.rst:431 msgid "Distributing Python Applications" @@ -634,47 +704,60 @@ msgstr "" "Python コードをスタンドアローンな配布アプリケーションに変換するツールには様々" "なものがあります:" -#: ../../using/mac.rst:436 msgid "" ":pypi:`py2app`: Supports creating macOS ``.app`` bundles from a Python " "project." msgstr "" +":pypi:`py2app`: Python プロジェクトから macOS の ``.app`` バンドルを作成でき" +"ます。" -#: ../../using/mac.rst:439 msgid "" "`Briefcase `_: Part of the `BeeWare " "Project `_; a cross-platform packaging tool that " "supports creation of ``.app`` bundles on macOS, as well as managing signing " "and notarization." msgstr "" +"`Briefcase `_: `BeeWare Project `_ の一部で、複数のプラットフォームに対応するパッケージングツール" +"です。\n" +"macOS 上での ``.app`` バンドルの作成や、署名と公証の管理に対応します。" -#: ../../using/mac.rst:444 msgid "" "`PyInstaller `_: A cross-platform packaging tool " "that creates a single file or folder as a distributable artifact." msgstr "" +"`PyInstaller `_: 複数のプラットフォームに対応する" +"パッケージングツールで、配布物として単一のファイルまたはフォルダを作成しま" +"す。" #: ../../using/mac.rst:448 msgid "App Store Compliance" msgstr "App Store コンプライアンス" -#: ../../using/mac.rst:450 msgid "" "Apps submitted for distribution through the macOS App Store must pass " "Apple's app review process. This process includes a set of automated " "validation rules that inspect the submitted application bundle for " "problematic code." msgstr "" +"macOS App Store を通じて配布するために提出するアプリは、Apple のアプリ審査に" +"合格する必要があります。\n" +"この審査には、提出されたアプリケーションバンドル内に問題のあるコードがないか" +"を調べる、一連の自動検証ルールが含まれています。" -#: ../../using/mac.rst:454 msgid "" "The Python standard library contains some code that is known to violate " "these automated rules. While these violations appear to be false positives, " "Apple's review rules cannot be challenged. Therefore, it is necessary to " "modify the Python standard library for an app to pass App Store review." msgstr "" +"Python 標準ライブラリには、これらの自動ルールに違反することが分かっているコー" +"ドが含まれています。\n" +"これらの違反は誤検出と思われますが、Apple の審査ルールに異議を唱えることはで" +"きません。\n" +"そのため、アプリが App Store の審査に合格するには、Python 標準ライブラリを変" +"更する必要があります。" -#: ../../using/mac.rst:459 msgid "" "The Python source tree contains :source:`a patch file ` that will remove all code that is known to cause " @@ -682,23 +765,35 @@ msgid "" "automatically when CPython is configured with the :option:`--with-app-store-" "compliance` option." msgstr "" +"Python ソースツリーには、App Store の審査で問題を引き起こすことが分かっている" +"コードをすべて削除する :source:`パッチファイル ` が含まれています。\n" +"このパッチは、CPython の configure に :option:`--with-app-store-compliance` " +"オプションを指定した場合に自動で適用されます。" -#: ../../using/mac.rst:465 msgid "" "This patch is not normally required to use CPython on a Mac; nor is it " "required if you are distributing an app *outside* the macOS App Store. It is " "*only* required if you are using the macOS App Store as a distribution " "channel." msgstr "" +"Mac 上で CPython を使用するために、通常このパッチは必要ありません。\n" +"macOS App Store の *外* でアプリを配布する場合にも必要ありません。\n" +"このパッチが必要になるのは、macOS App Store を配布経路として使用する場合 *だ" +"け* です。" #: ../../using/mac.rst:470 msgid "Other Resources" msgstr "他のリソース" -#: ../../using/mac.rst:472 msgid "" "The `python.org Help page `_ has links " "to many useful resources. The `Pythonmac-SIG mailing list `_ is another support " "resource specifically for Python users and developers on the Mac." msgstr "" +"`python.org のヘルプページ `_ には、多く" +"の役立つリソースへのリンクがあります。\n" +"`Pythonmac-SIG メーリングリスト `_ も、Mac 上で Python を使うユーザーや開発者に特化し" +"たサポートリソースです。" diff --git a/using/unix.po b/using/unix.po index 1ec394365..f74c9dda1 100644 --- a/using/unix.po +++ b/using/unix.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: TENMYO Masakazu, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../using/unix.rst:7 @@ -36,20 +36,27 @@ msgstr "最新バージョンの Python の取得とインストール" msgid "On Linux" msgstr "Linux" -#: ../../using/unix.rst:18 msgid "" "Python comes preinstalled on most Linux distributions, and is available as a " "package on all others. However there are certain features you might want to " "use that are not available on your distro's package. You can compile the " "latest version of Python from source." msgstr "" +"ほとんどの Linux ディストリビューションには Python があらかじめインストールさ" +"れており、それ以外のディストリビューションでもパッケージとして利用できま" +"す。\n" +"ただし、使いたい機能がディストリビューションのパッケージでは利用できないこと" +"もあります。\n" +"最新バージョンの Python はソースからコンパイルできます。" -#: ../../using/unix.rst:23 msgid "" "In the event that the latest version of Python doesn't come preinstalled and " "isn't in the repositories as well, you can make packages for your own " "distro. Have a look at the following links:" msgstr "" +"最新バージョンの Python があらかじめインストールされておらず、リポジトリにも" +"ない場合は、自分のディストリビューション向けにパッケージを作成できます。\n" +"次のリンクを参照してください:" #: ../../using/unix.rst:29 msgid "https://www.debian.org/doc/manuals/maint-guide/first.en.html" @@ -72,6 +79,8 @@ msgid "" "https://docs.fedoraproject.org/en-US/package-maintainers/" "Packaging_Tutorial_GNU_Hello/" msgstr "" +"https://docs.fedoraproject.org/en-US/package-maintainers/" +"Packaging_Tutorial_GNU_Hello/" #: ../../using/unix.rst:34 msgid "for Fedora users" @@ -79,7 +88,7 @@ msgstr "Fedora ユーザー向け" #: ../../using/unix.rst:35 msgid "https://slackbook.org/html/package-management-making-packages.html" -msgstr "" +msgstr "https://slackbook.org/html/package-management-making-packages.html" #: ../../using/unix.rst:36 msgid "for Slackware users" @@ -87,45 +96,49 @@ msgstr "Slackware ユーザー向け" #: ../../using/unix.rst:41 msgid "Installing IDLE" -msgstr "" +msgstr "IDLE のインストール" #: ../../using/unix.rst:43 msgid "In some cases, IDLE might not be included in your Python installation." msgstr "" +"場合によっては、 IDLE は Python インストールに含まれていない可能性がありま" +"す。" #: ../../using/unix.rst:45 msgid "For Debian and Ubuntu users::" -msgstr "" +msgstr "Debian と Ubuntu ユーザー::" #: ../../using/unix.rst:47 msgid "" "sudo apt update\n" "sudo apt install idle" msgstr "" +"sudo apt update\n" +"sudo apt install idle" #: ../../using/unix.rst:50 msgid "For Fedora, RHEL, and CentOS users::" -msgstr "" +msgstr "Fedora や RHEL 、 CentOS ユーザーは::" #: ../../using/unix.rst:52 msgid "sudo dnf install python3-idle" -msgstr "" +msgstr "sudo dnf install python3-idle" #: ../../using/unix.rst:54 msgid "For SUSE and OpenSUSE users::" -msgstr "" +msgstr "SUSE と OpenSUSE ユーザーは::" #: ../../using/unix.rst:56 msgid "sudo zypper install python3-idle" -msgstr "" +msgstr "sudo zypper install python3-idle" #: ../../using/unix.rst:58 msgid "For Alpine Linux users::" -msgstr "" +msgstr "Alpine Linux ユーザーは::" #: ../../using/unix.rst:60 msgid "sudo apk add python3-idle" -msgstr "" +msgstr "sudo apk add python3-idle" #: ../../using/unix.rst:65 msgid "On FreeBSD and OpenBSD" @@ -138,7 +151,7 @@ msgstr "" #: ../../using/unix.rst:69 msgid "pkg install python3" -msgstr "" +msgstr "pkg install python3" #: ../../using/unix.rst:71 msgid "OpenBSD users, to add the package use::" @@ -152,6 +165,10 @@ msgid "" "pkg_add ftp://ftp.openbsd.org/pub/OpenBSD/4.2/packages//python-.tgz" msgstr "" +"pkg_add -r python\n" +"\n" +"pkg_add ftp://ftp.openbsd.org/pub/OpenBSD/4.2/packages/<ここにアーキテクチャ" +"を挿入>/python-<バージョン>.tgz" #: ../../using/unix.rst:77 msgid "For example i386 users get the 2.5.1 version of Python using::" @@ -162,6 +179,8 @@ msgid "" "pkg_add ftp://ftp.openbsd.org/pub/OpenBSD/4.2/packages/i386/python-2.5.1p2." "tgz" msgstr "" +"pkg_add ftp://ftp.openbsd.org/pub/OpenBSD/4.2/packages/i386/python-2.5.1p2." +"tgz" #: ../../using/unix.rst:85 msgid "Building Python" @@ -191,6 +210,9 @@ msgid "" "make\n" "make install" msgstr "" +"./configure\n" +"make\n" +"make install" #: ../../using/unix.rst:99 msgid "" @@ -202,32 +224,30 @@ msgstr "" "フォームにおける注意点は Python ソースツリーのルートにある :source:`README." "rst` に細かく記載されています。" -#: ../../using/unix.rst:105 msgid "" "``make install`` can overwrite or masquerade the :file:`python3` binary. " "``make altinstall`` is therefore recommended instead of ``make install`` " "since it only installs :file:`{exec_prefix}/bin/python{version}`." msgstr "" -"``make install`` は :file:`python3` バイナリを上書きまたはリンクを破壊してし" -"まうかもしれません。そのため、``make install`` の代わりに :file:" -"`{exec_prefix}/bin/python{version}` のみインストールする ``make altinstall`` " -"が推奨されています。" +"``make install`` は :file:`python3` バイナリを上書きしたり、既存のバイナリに" +"代わって使われるようにしたりする可能性があります。\n" +"そのため、``make install`` の代わりに、:file:`{exec_prefix}/bin/" +"python{version}` のみをインストールする ``make altinstall`` を推奨します。" #: ../../using/unix.rst:111 msgid "Python-related paths and files" msgstr "Python に関係するパスとファイル" -#: ../../using/unix.rst:113 msgid "" "These are subject to difference depending on local installation " "conventions; :option:`prefix <--prefix>` and :option:`exec_prefix <--exec-" "prefix>` are installation-dependent and should be interpreted as for GNU " "software; they may be the same." msgstr "" -"これらはローカルインストールの慣例に応じて変化します; :option:`prefix <--" -"prefix>` と :option:`exec_prefix <--exec-prefix>` はインストール状況に依存し" -"ていて、GNU ソフトウェアによって解釈されます; この二つは同じである場合があり" -"ます。" +"これらは、インストール先での慣例に応じて異なります。\n" +":option:`prefix <--prefix>` と :option:`exec_prefix <--exec-prefix>` はインス" +"トール方法に依存し、GNU ソフトウェアの場合と同じ意味で解釈してください。\n" +"両者が同じ値になることもあります。" #: ../../using/unix.rst:118 msgid "" @@ -294,7 +314,7 @@ msgstr "" #: ../../using/unix.rst:141 msgid "$ chmod +x script" -msgstr "" +msgstr "$ chmod +x script" #: ../../using/unix.rst:145 msgid "" @@ -327,9 +347,8 @@ msgstr "" #: ../../using/unix.rst:159 msgid "Custom OpenSSL" -msgstr "" +msgstr "カスタムの OpenSSL" -#: ../../using/unix.rst:161 msgid "" "To use your vendor's OpenSSL configuration and system trust store, locate " "the directory with ``openssl.cnf`` file or symlink in ``/etc``. On most " @@ -337,18 +356,29 @@ msgid "" "directory should also contain a ``cert.pem`` file and/or a ``certs`` " "directory." msgstr "" +"ベンダーの OpenSSL 設定とシステムの信頼ストアを使用するには、``/etc`` 内で " +"``openssl.cnf`` ファイルまたはそのシンボリックリンクを含むディレクトリを探し" +"てください。\n" +"ほとんどのディストリビューションでは、ファイルは ``/etc/ssl`` または ``/etc/" +"pki/tls`` にあります。\n" +"そのディレクトリには ``cert.pem`` ファイル、``certs`` ディレクトリ、またはそ" +"の両方もあるはずです。" #: ../../using/unix.rst:167 msgid "" "$ find /etc/ -name openssl.cnf -printf \"%h\\n\"\n" "/etc/ssl" msgstr "" +"$ find /etc/ -name openssl.cnf -printf \"%h\\n\"\n" +"/etc/ssl" -#: ../../using/unix.rst:172 msgid "" "Download, build, and install OpenSSL. Make sure you use ``install_sw`` and " "not ``install``. The ``install_sw`` target does not override ``openssl.cnf``." msgstr "" +"OpenSSL をダウンロードし、ビルドしてインストールします。\n" +"``install`` ではなく、必ず ``install_sw`` を使用してください。\n" +"``install_sw`` ターゲットは ``openssl.cnf`` を上書きしません。" #: ../../using/unix.rst:176 msgid "" @@ -364,12 +394,24 @@ msgid "" "$ make install_sw\n" "$ popd" msgstr "" +"$ curl -O https://www.openssl.org/source/openssl-VERSION.tar.gz\n" +"$ tar xzf openssl-VERSION\n" +"$ pushd openssl-VERSION\n" +"$ ./config \\\n" +" --prefix=/usr/local/custom-openssl \\\n" +" --libdir=lib \\\n" +" --openssldir=/etc/ssl\n" +"$ make -j1 depend\n" +"$ make -j8\n" +"$ make install_sw\n" +"$ popd" -#: ../../using/unix.rst:190 msgid "" "Build Python with custom OpenSSL (see the configure ``--with-openssl`` and " "``--with-openssl-rpath`` options)" msgstr "" +"カスタムの OpenSSL を使って Python をビルドします (configure の ``--with-" +"openssl`` および ``--with-openssl-rpath`` オプションを参照してください)" #: ../../using/unix.rst:193 msgid "" @@ -381,10 +423,20 @@ msgid "" "$ make -j8\n" "$ make altinstall" msgstr "" +"$ pushd python-3.x.x\n" +"$ ./configure -C \\\n" +" --with-openssl=/usr/local/custom-openssl \\\n" +" --with-openssl-rpath=auto \\\n" +" --prefix=/usr/local/python-3.x.x\n" +"$ make -j8\n" +"$ make altinstall" -#: ../../using/unix.rst:205 msgid "" "Patch releases of OpenSSL have a backwards compatible ABI. You don't need to " "recompile Python to update OpenSSL. It's sufficient to replace the custom " "OpenSSL installation with a newer version." msgstr "" +"OpenSSL のパッチリリースでは、ABI の後方互換性が保たれます。\n" +"OpenSSL を更新するために Python を再コンパイルする必要はありません。\n" +"インストール済みのカスタム OpenSSL を新しいバージョンで置き換えるだけで十分で" +"す。" diff --git a/using/windows.po b/using/windows.po index a0009792a..58d59413f 100644 --- a/using/windows.po +++ b/using/windows.po @@ -19,10 +19,10 @@ msgstr "" "Last-Translator: tomo, 2025\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../using/windows.rst:11 @@ -37,7 +37,6 @@ msgstr "" "このドキュメントは、 Python を Microsoft Windows で使うときに知っておくべ" "き、 Windows 固有の動作についての概要を伝えることを目的としています。" -#: ../../using/windows.rst:18 msgid "" "Unlike most Unix systems and services, Windows does not include a system " "supported installation of Python. Instead, Python can be obtained from a " @@ -47,6 +46,14 @@ msgid "" "benefit. Before committing to the process described here, we recommend " "investigating your existing tools to see if they can provide Python directly." msgstr "" +"多くの Unix システムやサービスと異なり、Windows にはシステムでサポートされる " +"Python のインストールが含まれていません。\n" +"その代わり、Python は CPython チームを含むさまざまな配布元から入手できま" +"す。\n" +"Python の各ディストリビューションにはそれぞれ長所と短所がありますが、一般に、" +"使用しているほかのツールと一貫して使えることは大きな利点です。\n" +"ここで説明する手順に進む前に、既存のツールから Python を直接入手できるか調べ" +"ることをお勧めします。" #: ../../using/windows.rst:26 msgid "" @@ -65,7 +72,6 @@ msgid "" "versions, and the ``py list`` command will show which is current." msgstr "" -#: ../../using/windows.rst:37 msgid "" "In general, we recommend that you create a :ref:`virtual environment ` for each project and run ``\\Scripts\\Activate`` in your " @@ -74,6 +80,11 @@ msgid "" "available in your session. Create a virtual environment using ``python -m " "venv ``." msgstr "" +"一般に、プロジェクトごとに :ref:`仮想環境 ` を作成し、ターミナルで " +"``\\Scripts\\Activate`` を実行して使うことをお勧めします。\n" +"これにより、プロジェクト同士を分離し、時間が経っても一貫した環境を保ち、パッ" +"ケージが追加したコマンドもセッション内で使えるようにできます。\n" +"仮想環境は ``python -m venv `` で作成してください。" #: ../../using/windows.rst:43 msgid "" @@ -82,28 +93,34 @@ msgid "" "sometimes additional manual steps required to configure your PC." msgstr "" -#: ../../using/windows.rst:47 msgid "" "Apart from using the Python install manager, Python can also be obtained as " "NuGet packages. See :ref:`windows-nuget` below for more information on these " "packages." msgstr "" +"Python インストールマネージャを使う以外に、Python を NuGet パッケージとして入" +"手することもできます。\n" +"これらのパッケージの詳細については、後述の :ref:`windows-nuget` を参照してく" +"ださい。" -#: ../../using/windows.rst:51 msgid "" "The embeddable distros are minimal packages of Python suitable for embedding " "into larger applications. They can be installed using the Python install " "manager. See :ref:`windows-embeddable` below for more information on these " "packages." msgstr "" +"埋め込み用ディストリビューションは、より大きなアプリケーションに埋め込むのに" +"適した、Python の最小限のパッケージです。\n" +"Python インストールマネージャを使ってインストールできます。\n" +"これらのパッケージの詳細については、後述の :ref:`windows-embeddable` を参照し" +"てください。" #: ../../using/windows.rst:64 msgid "Python Install Manager" msgstr "" -#: ../../using/windows.rst:67 msgid "Installation" -msgstr "" +msgstr "インストール" #: ../../using/windows.rst:69 msgid "" @@ -112,11 +129,12 @@ msgid "" "are identical." msgstr "" -#: ../../using/windows.rst:73 msgid "" "To install through the Store, simply click \"Install\". After it has " "completed, open a terminal and type ``python`` to get started." msgstr "" +"Store からインストールするには、\"Install\" をクリックするだけです。\n" +"完了したら、ターミナルを開いて ``python`` と入力すると使い始められます。" #: ../../using/windows.rst:76 msgid "" @@ -125,7 +143,6 @@ msgid "" "Powershell." msgstr "" -#: ../../using/windows.rst:79 msgid "" "After installation, the ``python``, ``py``, and ``pymanager`` commands " "should be available. If you have existing installations of Python, or you " @@ -133,6 +150,12 @@ msgid "" "undo the modifications. See :ref:`pymanager-troubleshoot` for more help with " "fixing non-working commands." msgstr "" +"インストール後は、``python``、``py``、``pymanager`` コマンドが使えるはずで" +"す。\n" +"既に Python がインストールされていたり、:envvar:`PATH` 変数を変更していたりす" +"る場合は、それらを削除するか、変更を元に戻す必要があるかもしれません。\n" +"動作しないコマンドへの対処については、:ref:`pymanager-troubleshoot` を参照し" +"てください。" #: ../../using/windows.rst:85 msgid "" @@ -145,18 +168,24 @@ msgid "" "for your account\" for the system settings page to add the path." msgstr "" -#: ../../using/windows.rst:93 msgid "" "Each Python runtime you install will have its own directory for scripts. " "These also need to be added to :envvar:`PATH` if you want to use them." msgstr "" +"インストールした Python ランタイムには、それぞれ専用のスクリプト用ディレクト" +"リがあります。\n" +"スクリプトを使いたい場合は、これらも :envvar:`PATH` に追加する必要がありま" +"す。" -#: ../../using/windows.rst:96 msgid "" "The Python install manager will be automatically updated to new releases. " "This does not affect any installs of Python runtimes. Uninstalling the " "Python install manager does not uninstall any Python runtimes." msgstr "" +"Python インストールマネージャは新しいリリースに自動的に更新されます。\n" +"これは、インストール済みの Python ランタイムには影響しません。\n" +"Python インストールマネージャをアンインストールしても、Python ランタイムはア" +"ンインストールされません。" #: ../../using/windows.rst:100 msgid "" @@ -170,7 +199,6 @@ msgstr "" msgid "Basic Use" msgstr "" -#: ../../using/windows.rst:109 msgid "" "The recommended command for launching Python is ``python``, which will " "either launch the version requested by the script being launched, an active " @@ -179,8 +207,13 @@ msgid "" "specifically requested and no runtimes are installed at all, the current " "latest release will be installed automatically." msgstr "" +"Python の起動には ``python`` コマンドを推奨します。\n" +"このコマンドは、起動するスクリプトが要求するバージョン、アクティブな仮想環" +"境、またはインストール済みのデフォルトのバージョンを起動します。\n" +"別途設定しない限り、デフォルトは最新の安定版です。\n" +"バージョンが明示的に要求されておらず、ランタイムがまったくインストールされて" +"いない場合は、現在の最新リリースが自動的にインストールされます。" -#: ../../using/windows.rst:116 msgid "" "For all scenarios involving multiple runtime versions, the recommended " "command is ``py``. This may be used anywhere in place of ``python`` or the " @@ -189,6 +222,13 @@ msgid "" "version as well as subcommands to manage installations. These are detailed " "below." msgstr "" +"複数のランタイムバージョンを扱う場合は、どの場面でも ``py`` コマンドを推奨し" +"ます。\n" +"``python`` や従来の ``py.exe`` ランチャの代わりに、どこでも使えます。\n" +"デフォルトでは ``py`` は ``python`` と同じように動作しますが、コマンドライン" +"オプションで特定のバージョンを選択したり、サブコマンドでインストールを管理し" +"たりすることもできます。\n" +"これらについては後述します。" #: ../../using/windows.rst:122 msgid "" @@ -211,14 +251,15 @@ msgid "" "Windows, but is not meant to be widely used or recommended." msgstr "" -#: ../../using/windows.rst:137 msgid "" "To launch your default runtime, run ``python`` or ``py`` with the arguments " "you want to be passed to the runtime (such as script files or the module to " "launch):" msgstr "" +"デフォルトのランタイムを起動するには、ランタイムに渡したい引数 (スクリプト" +"ファイルや起動するモジュールなど) を付けて ``python`` または ``py`` を実行し" +"てください:" -#: ../../using/windows.rst:140 msgid "" "$> py\n" "...\n" @@ -227,15 +268,22 @@ msgid "" "$> py -m this\n" "..." msgstr "" +"$> py\n" +"...\n" +"$> python my-script.py\n" +"...\n" +"$> py -m this\n" +"..." -#: ../../using/windows.rst:149 msgid "" "The default runtime can be overridden with the :envvar:" "`PYTHON_MANAGER_DEFAULT` environment variable, or a configuration file. See :" "ref:`pymanager-config` for information about configuration settings." msgstr "" +"デフォルトのランタイムは、環境変数 :envvar:`PYTHON_MANAGER_DEFAULT` または設" +"定ファイルで上書きできます。\n" +"設定の詳細については、:ref:`pymanager-config` を参照してください。" -#: ../../using/windows.rst:153 msgid "" "To launch a specific runtime, the ``py`` command accepts a ``-V:`` " "option. This option must be specified before any others. The tag is part or " @@ -244,6 +292,15 @@ msgid "" "the ``V:`` may be omitted in cases where the tag refers to an official " "release and starts with ``3``." msgstr "" +"特定のランタイムを起動するため、``py`` コマンドは ``-V:`` オプションを受" +"け付けます。\n" +"このオプションは、ほかのすべてのオプションより先に指定しなければなりませ" +"ん。\n" +"タグはランタイムの識別子の一部または全体です。\n" +"CPython チームが提供するランタイムではバージョンのような形で、プラットフォー" +"ムが付くこともあります。\n" +"互換性のため、タグが公式リリースを指していて ``3`` で始まる場合は、``V:`` を" +"省略できます。" #: ../../using/windows.rst:160 msgid "" @@ -260,13 +317,13 @@ msgid "" "from a specific company." msgstr "" -#: ../../using/windows.rst:171 msgid "" "$> py -V:Distributor\\1.0 ...\n" "$> py -V:distrib/ ..." msgstr "" +"$> py -V:Distributor\\1.0 ...\n" +"$> py -V:distrib/ ..." -#: ../../using/windows.rst:176 msgid "" "If no version is specified, but a script file is passed, the script will be " "inspected for a *shebang line*. This is a special format for the first line " @@ -274,8 +331,13 @@ msgid "" "for more information. When there is no shebang line, or it cannot be " "resolved, the script will be launched with the default runtime." msgstr "" +"バージョンが指定されておらず、スクリプトファイルが渡された場合、スクリプトに " +"*シェバン行* があるか調べます。\n" +"これはファイルの先頭行に記述する特別な形式で、コマンドを上書きできます。\n" +"詳しくは :ref:`pymanager-shebang` を参照してください。\n" +"シェバン行がない場合や解決できない場合は、デフォルトのランタイムでスクリプト" +"を起動します。" -#: ../../using/windows.rst:182 msgid "" "If you are running in an active virtual environment, have not requested a " "particular version, and there is no shebang line, the default runtime will " @@ -283,6 +345,11 @@ msgid "" "likely already overridden and none of these checks occurred. However, this " "behaviour ensures that the ``py`` command can be used interchangeably." msgstr "" +"アクティブな仮想環境で実行していて、特定のバージョンを要求しておらず、シェバ" +"ン行もない場合、デフォルトのランタイムはその仮想環境になります。\n" +"この場合、``python`` コマンドは既に上書きされていて、これらの確認は行われない" +"ことが多いでしょう。\n" +"ただし、この動作によって ``py`` コマンドも同じように使えます。" #: ../../using/windows.rst:188 msgid "" @@ -298,21 +365,25 @@ msgstr "" msgid "Command Help" msgstr "" -#: ../../using/windows.rst:199 msgid "" "The ``py help`` command will display the full list of supported commands, " "along with their options. Any command may be passed the ``-?`` option to " "display its help, or its name passed to ``py help``." msgstr "" +"``py help`` コマンドは、サポートされているすべてのコマンドとそのオプションを" +"表示します。\n" +"どのコマンドでも、``-?`` オプションを渡すか、``py help`` にそのコマンド名を渡" +"すとヘルプを表示できます。" -#: ../../using/windows.rst:203 msgid "" "$> py help\n" "$> py help install\n" "$> py install /?" msgstr "" +"$> py help\n" +"$> py help install\n" +"$> py install /?" -#: ../../using/windows.rst:210 msgid "" "All commands support some common options, which will be shown by ``py " "help``. These options must be specified after any subcommand. Specifying ``-" @@ -320,31 +391,43 @@ msgid "" "will increase it further for debugging purposes. Passing ``-q`` or ``--" "quiet`` will reduce output, and ``-qq`` will reduce it further." msgstr "" +"すべてのコマンドで、``py help`` に表示される共通のオプションを使えます。\n" +"これらのオプションはサブコマンドの後に指定しなければなりません。\n" +"``-v`` または ``--verbose`` を指定すると出力が増え、``-vv`` を指定するとデ" +"バッグ用にさらに増えます。\n" +"``-q`` または ``--quiet`` を渡すと出力が減り、``-qq`` を渡すとさらに減りま" +"す。" -#: ../../using/windows.rst:216 msgid "" "The ``--config=`` option allows specifying a configuration file to " "override multiple settings at once. See :ref:`pymanager-config` below for " "more information about these files." msgstr "" +"``--config=`` オプションでは、複数の設定をまとめて上書きする設定ファイ" +"ルを指定できます。\n" +"これらのファイルの詳細については、後述の :ref:`pymanager-config` を参照してく" +"ださい。" #: ../../using/windows.rst:222 msgid "Listing Runtimes" msgstr "" -#: ../../using/windows.rst:224 msgid "" "$> py list [-f=|--format=] [-1|--one] [--online|-s=|--source=] " "[...]" msgstr "" +"$> py list [-f=|--format=] [-1|--one] [--online|-s=|--source=] " +"[...]" -#: ../../using/windows.rst:228 msgid "" "The list of installed runtimes can be seen using ``py list``. A filter may " "be added in the form of one or more tags (with or without company " "specifier), and each may include a ``<``, ``<=``, ``>=`` or ``>`` prefix to " "restrict to a range." msgstr "" +"``py list`` を使うと、インストール済みのランタイムの一覧を表示できます。\n" +"1 つ以上のタグ (company の指定は任意) をフィルタとして追加でき、それぞれに接" +"頭辞 ``<``、``<=``、``>=``、``>`` を付けて範囲を制限できます。" #: ../../using/windows.rst:232 msgid "" @@ -355,7 +438,6 @@ msgid "" "executable path), ``prefix`` (just the prefix path)." msgstr "" -#: ../../using/windows.rst:238 msgid "" "The ``--one`` or ``-1`` option only displays a single result. If the default " "runtime is included, it will be the one. Otherwise, the \"best\" result is " @@ -363,15 +445,23 @@ msgid "" "most recent version). The result shown by ``py list --one `` will match " "the runtime that would be launched by ``py -V:``." msgstr "" +"``--one`` または ``-1`` オプションは、結果を 1 つだけ表示します。\n" +"デフォルトのランタイムが含まれている場合は、それを表示します。\n" +"そうでなければ、\"最良\" の結果を表示します (\"最良\" の定義は意図的に曖昧に" +"していますが、通常は最新のバージョンです)。\n" +"``py list --one `` が表示する結果は、``py -V:`` が起動するランタイ" +"ムと一致します。" -#: ../../using/windows.rst:244 msgid "" "The ``--only-managed`` option excludes results that were not installed by " "the Python install manager. This is useful when determining which runtimes " "may be updated or uninstalled through the ``py`` command." msgstr "" +"``--only-managed`` オプションは、Python インストールマネージャでインストール" +"されていないランタイムを結果から除外します。\n" +"これは、``py`` コマンドで更新やアンインストールができるランタイムを調べるとき" +"に役立ちます。" -#: ../../using/windows.rst:248 msgid "" "The ``--online`` option is short for passing ``--source=`` with the " "default source. Passing either of these options will search the online index " @@ -379,6 +469,12 @@ msgid "" "one `` will match the runtime that would be installed by ``py install " "``." msgstr "" +"``--online`` オプションは、デフォルトの取得元を指定して ``--source=`` を" +"渡すための短縮形です。\n" +"どちらかのオプションを渡すと、オンラインインデックスでインストール可能なラン" +"タイムを検索します。\n" +"``py list --online --one `` が表示する結果は、``py install `` がイ" +"ンストールするランタイムと一致します。" #: ../../using/windows.rst:253 msgid "$> py list --online 3.14" @@ -395,31 +491,38 @@ msgstr "" msgid "Installing Runtimes" msgstr "" -#: ../../using/windows.rst:265 msgid "" "$> py install [-s=|--source=] [-f|--force] [-u|--update] [--dry-run] " "[...]" msgstr "" +"$> py install [-s=|--source=] [-f|--force] [-u|--update] [--dry-run] " +"[...]" -#: ../../using/windows.rst:269 msgid "" "New runtime versions may be added using ``py install``. One or more tags may " "be specified, and the special tag ``default`` may be used to select the " "default. Ranges are not supported for installation." msgstr "" +"``py install`` を使うと、新しいバージョンのランタイムを追加できます。\n" +"1 つ以上のタグを指定でき、特別なタグ ``default`` でデフォルトを選択できま" +"す。\n" +"インストールでは範囲指定をサポートしていません。" -#: ../../using/windows.rst:273 msgid "" "The ``--source=`` option allows overriding the online index that is " "used to obtain runtimes. This may be used with an offline index, as shown " "in :ref:`pymanager-offline`." msgstr "" +"``--source=`` オプションでは、ランタイムの取得に使うオンラインインデック" +"スを上書きできます。\n" +":ref:`pymanager-offline` に示すように、オフラインインデックスにも使えます。" -#: ../../using/windows.rst:277 msgid "" "Passing ``--force`` will ignore any cached files and remove any existing " "install to replace it with the specified one." msgstr "" +"``--force`` を渡すと、キャッシュされたファイルをすべて無視し、既存のインス" +"トールを削除して、指定されたものに置き換えます。" #: ../../using/windows.rst:280 msgid "" @@ -431,11 +534,12 @@ msgid "" "environments will continue to work." msgstr "" -#: ../../using/windows.rst:287 msgid "" "Passing ``--dry-run`` will generate output and logs, but will not modify any " "installs." msgstr "" +"``--dry-run`` を渡すと、出力とログを生成しますが、インストールは一切変更しま" +"せん。" #: ../../using/windows.rst:290 msgid "" @@ -444,43 +548,45 @@ msgid "" "is useful for embedding runtimes into larger applications." msgstr "" -#: ../../using/windows.rst:294 msgid "$> py install ... [-t=|--target=] " -msgstr "" +msgstr "$> py install ... [-t=|--target=] " #: ../../using/windows.rst:302 msgid "Offline Installs" msgstr "" -#: ../../using/windows.rst:304 msgid "" "To perform offline installs of Python, you will need to first create an " "offline index on a machine that has network access." msgstr "" +"Python をオフラインでインストールするには、まずネットワークにアクセスできるマ" +"シン上でオフラインインデックスを作成する必要があります。" -#: ../../using/windows.rst:307 msgid "$> py install --download= ... ..." -msgstr "" +msgstr "$> py install --download= ... ..." -#: ../../using/windows.rst:311 msgid "" "The ``--download=`` option will download the packages for the listed " "tags and create a directory containing them and an ``index.json`` file " "suitable for later installation. This entire directory can be moved to the " "offline machine and used to install one or more of the bundled runtimes:" msgstr "" +"``--download=`` オプションは、列挙したタグのパッケージをダウンロード" +"し、それらのパッケージと後のインストールに使える ``index.json`` ファイルを含" +"むディレクトリを作成します。\n" +"このディレクトリ全体をオフラインのマシンに移し、同梱したランタイムを 1 つ以上" +"インストールできます:" -#: ../../using/windows.rst:316 msgid "$> py install --source=\"\\index.json\" ..." -msgstr "" +msgstr "$> py install --source=\"\\index.json\" ..." -#: ../../using/windows.rst:320 msgid "" "The Python install manager can be installed by downloading its installer and " "moving it to another machine before installing." msgstr "" +"Python インストールマネージャは、インストーラをダウンロードして別のマシンに移" +"してからインストールできます。" -#: ../../using/windows.rst:323 msgid "" "Alternatively, the ZIP files in an offline index directory can simply be " "transferred to another machine and extracted. This will not register the " @@ -489,33 +595,40 @@ msgid "" "approach in cases where installing the Python install manager is not " "possible or convenient." msgstr "" +"あるいは、オフラインインデックスのディレクトリ内にある ZIP ファイルを別のマシ" +"ンに転送して展開するだけでも構いません。\n" +"この方法ではインストールは一切登録されないため、展開したディレクトリ内の実行" +"ファイルを直接指定して起動する必要がありますが、Python インストールマネージャ" +"をインストールできない場合や不便な場合には、こちらの方が適していることもあり" +"ます。" -#: ../../using/windows.rst:329 msgid "" "In this way, Python runtimes can be installed and managed on a machine " "without access to the internet." msgstr "" +"このようにして、インターネットにアクセスできないマシンでも Python ランタイム" +"をインストールし、管理できます。" #: ../../using/windows.rst:334 msgid "Uninstalling Runtimes" msgstr "" -#: ../../using/windows.rst:336 msgid "$> py uninstall [-y|--yes] ..." -msgstr "" +msgstr "$> py uninstall [-y|--yes] ..." -#: ../../using/windows.rst:340 msgid "" "Runtimes may be removed using the ``py uninstall`` command. One or more tags " "must be specified. Ranges are not supported here." msgstr "" +"``py uninstall`` コマンドを使うと、ランタイムを削除できます。\n" +"1 つ以上のタグを指定しなければなりません。\n" +"ここでは範囲指定をサポートしていません。" -#: ../../using/windows.rst:343 msgid "" "The ``--yes`` option bypasses the confirmation prompt before uninstalling." msgstr "" +"``--yes`` オプションは、アンインストール前の確認プロンプトを省略します。" -#: ../../using/windows.rst:345 msgid "" "Instead of passing tags individually, the ``--purge`` option may be " "specified. This will remove all runtimes managed by the Python install " @@ -523,12 +636,16 @@ msgid "" "caches. Runtimes that were not installed by the Python install manager will " "not be impacted, and neither will manually created configuration files." msgstr "" +"タグを個別に渡す代わりに、``--purge`` オプションを指定できます。\n" +"これは、スタートメニュー、レジストリ、ダウンロードキャッシュのクリーンアップ" +"を含め、Python インストールマネージャで管理しているすべてのランタイムを削除し" +"ます。\n" +"Python インストールマネージャでインストールされていないランタイムや、手動で作" +"成した設定ファイルには影響しません。" -#: ../../using/windows.rst:351 msgid "$> py uninstall [-y|--yes] --purge" -msgstr "" +msgstr "$> py uninstall [-y|--yes] --purge" -#: ../../using/windows.rst:355 msgid "" "The Python install manager can be uninstalled through the Windows " "\"Installed apps\" settings page. This does not remove any runtimes, and " @@ -537,12 +654,18 @@ msgid "" "manage these runtimes again. To completely clean up all Python runtimes, run " "with ``--purge`` before uninstalling the Python install manager." msgstr "" +"Python インストールマネージャは、Windows の \"Installed apps\" 設定ページから" +"アンインストールできます。\n" +"グローバルな ``python`` と ``py`` コマンドは削除されますが、ランタイムは一切" +"削除されず、引き続き使えます。\n" +"Python インストールマネージャを再インストールすると、これらのランタイムを再び" +"管理できるようになります。\n" +"すべての Python ランタイムを完全に削除するには、Python インストールマネージャ" +"をアンインストールする前に ``--purge`` を付けて実行してください。" -#: ../../using/windows.rst:365 msgid "Configuration" -msgstr "Configuration" +msgstr "設定" -#: ../../using/windows.rst:367 msgid "" "Python install manager is configured with a hierarchy of configuration " "files, environment variables, command-line options, and registry settings. " @@ -551,12 +674,20 @@ msgid "" "are administrator-only and will override configuration files. Command-line " "options override all other settings, but not every option is available." msgstr "" +"Python インストールマネージャは、設定ファイル、環境変数、コマンドラインオプ" +"ション、レジストリ設定の階層によって設定します。\n" +"一般に、設定ファイルでは、ほかの設定ファイルの場所を含めてすべてを設定できま" +"す。\n" +"レジストリ設定は管理者だけが使用でき、設定ファイルを上書きします。\n" +"コマンドラインオプションはほかのすべての設定を上書きしますが、すべての設定項" +"目に対応するオプションがあるわけではありません。" -#: ../../using/windows.rst:374 msgid "" "This section will describe the defaults, but be aware that modified or " "overridden installs may resolve settings differently." msgstr "" +"この節ではデフォルトの設定を説明しますが、インストールが変更されたり設定が上" +"書きされたりしている場合は、設定の決定方法が異なることがあります。" #: ../../using/windows.rst:377 msgid "" @@ -568,51 +699,48 @@ msgid "" "config`` command line option (but not both)." msgstr "" -#: ../../using/windows.rst:384 msgid "" "The following settings are those that are considered likely to be modified " "in normal use. Later sections list those that are intended for " "administrative customization." msgstr "" +"以下の設定は、通常の使用で変更する可能性が高いと考えられるものです。\n" +"管理者によるカスタマイズを目的とした設定は、後の節に記載します。" -#: ../../using/windows.rst:388 msgid "Standard configuration options" -msgstr "" +msgstr "標準の設定オプション" -#: ../../using/windows.rst:1 msgid "Config Key" -msgstr "" +msgstr "設定キー" -#: ../../using/windows.rst:1 msgid "Environment Variable" -msgstr "" +msgstr "環境変数" #: ../../using/windows.rst:1 ../../using/windows.rst:1301 #: ../../using/windows.rst:1321 ../../using/windows.rst:1916 msgid "Description" msgstr "説明" -#: ../../using/windows.rst:1 msgid "``default_tag``" -msgstr "" +msgstr "``default_tag``" #: ../../using/windows.rst:1 msgid "``PYTHON_MANAGER_DEFAULT``" msgstr "" -#: ../../using/windows.rst:1 msgid "" "The preferred default version to launch or install. By default, this is " "interpreted as the most recent non-prerelease version from the CPython team." msgstr "" +"起動またはインストールする際の、優先するデフォルトのバージョンです。\n" +"デフォルトでは、CPython チームが提供するプレリリース版以外の最新バージョンと" +"解釈します。" -#: ../../using/windows.rst:1 msgid "``default_platform``" -msgstr "" +msgstr "``default_platform``" -#: ../../using/windows.rst:1 msgid "``PYTHON_MANAGER_DEFAULT_PLATFORM``" -msgstr "" +msgstr "``PYTHON_MANAGER_DEFAULT_PLATFORM``" #: ../../using/windows.rst:1 msgid "" @@ -622,21 +750,19 @@ msgid "" "but will use ``3.14`` if no tagged install exists." msgstr "" -#: ../../using/windows.rst:1 msgid "``logs_dir``" -msgstr "" +msgstr "``logs_dir``" -#: ../../using/windows.rst:1 msgid "``PYTHON_MANAGER_LOGS``" -msgstr "" +msgstr "``PYTHON_MANAGER_LOGS``" -#: ../../using/windows.rst:1 msgid "The location where log files are written. By default, :file:`%TEMP%`." msgstr "" +"ログファイルを書き込む場所です。\n" +"デフォルトは :file:`%TEMP%` です。" -#: ../../using/windows.rst:1 msgid "``automatic_install``" -msgstr "" +msgstr "``automatic_install``" #: ../../using/windows.rst:1 msgid "``PYTHON_MANAGER_AUTOMATIC_INSTALL``" @@ -648,41 +774,39 @@ msgid "" "launch. By default, true." msgstr "" -#: ../../using/windows.rst:1 msgid "``include_unmanaged``" -msgstr "" +msgstr "``include_unmanaged``" -#: ../../using/windows.rst:1 msgid "``PYTHON_MANAGER_INCLUDE_UNMANAGED``" -msgstr "" +msgstr "``PYTHON_MANAGER_INCLUDE_UNMANAGED``" -#: ../../using/windows.rst:1 msgid "" "True to allow listing and launching runtimes that were not installed by the " "Python install manager, or false to exclude them. By default, true." msgstr "" +"true にすると、Python インストールマネージャでインストールされていないランタ" +"イムの一覧表示や起動を許可し、false にするとそれらを除外します。\n" +"デフォルトは true です。" -#: ../../using/windows.rst:1 msgid "``shebang_can_run_anything``" -msgstr "" +msgstr "``shebang_can_run_anything``" -#: ../../using/windows.rst:1 msgid "``PYTHON_MANAGER_SHEBANG_CAN_RUN_ANYTHING``" -msgstr "" +msgstr "``PYTHON_MANAGER_SHEBANG_CAN_RUN_ANYTHING``" -#: ../../using/windows.rst:1 msgid "" "True to allow shebangs in ``.py`` files to launch applications other than " "Python runtimes, or false to prevent it. By default, true." msgstr "" +"true にすると、``.py`` ファイルのシェバンによる Python ランタイム以外のアプリ" +"ケーションの起動を許可し、false にすると禁止します。\n" +"デフォルトは true です。" -#: ../../using/windows.rst:1 msgid "``log_level``" -msgstr "" +msgstr "``log_level``" -#: ../../using/windows.rst:1 msgid "``PYMANAGER_VERBOSE``, ``PYMANAGER_DEBUG``" -msgstr "" +msgstr "``PYMANAGER_VERBOSE``, ``PYMANAGER_DEBUG``" #: ../../using/windows.rst:1 msgid "" @@ -692,55 +816,54 @@ msgid "" "configuration." msgstr "" -#: ../../using/windows.rst:1 msgid "``confirm``" -msgstr "" +msgstr "``confirm``" -#: ../../using/windows.rst:1 msgid "``PYTHON_MANAGER_CONFIRM``" -msgstr "" +msgstr "``PYTHON_MANAGER_CONFIRM``" -#: ../../using/windows.rst:1 msgid "" "True to confirm certain actions before taking them (such as uninstall), or " "false to skip the confirmation. By default, true." msgstr "" +"true にすると、アンインストールなどの特定の操作を実行する前に確認し、false に" +"すると確認を省略します。\n" +"デフォルトは true です。" -#: ../../using/windows.rst:1 msgid "``install.source``" -msgstr "" +msgstr "``install.source``" -#: ../../using/windows.rst:1 msgid "``PYTHON_MANAGER_SOURCE_URL``" -msgstr "" +msgstr "``PYTHON_MANAGER_SOURCE_URL``" -#: ../../using/windows.rst:1 msgid "Override the index feed to obtain new installs from." msgstr "" +"新たにインストールするランタイムの取得元となるインデックスフィードを上書きし" +"ます。" -#: ../../using/windows.rst:1 msgid "``list.format``" -msgstr "" +msgstr "``list.format``" -#: ../../using/windows.rst:1 msgid "``PYTHON_MANAGER_LIST_FORMAT``" -msgstr "" +msgstr "``PYTHON_MANAGER_LIST_FORMAT``" -#: ../../using/windows.rst:1 msgid "" "Specify the default format used by the ``py list`` command. By default, " "``table``." msgstr "" +"``py list`` コマンドで使うデフォルトの形式を指定します。\n" +"デフォルトは ``table`` です。" -#: ../../using/windows.rst:433 msgid "" "Dotted names should be nested inside JSON objects, for example, ``list." "format`` would be specified as ``{\"list\": {\"format\": \"table\"}}``." msgstr "" +"ドット区切りの名前は JSON オブジェクト内で入れ子にしてください。\n" +"たとえば ``list.format`` は ``{\"list\": {\"format\": \"table\"}}`` と指定し" +"ます。" -#: ../../using/windows.rst:439 msgid "Shebang lines" -msgstr "" +msgstr "シェバン行" #: ../../using/windows.rst:441 msgid "" @@ -751,40 +874,37 @@ msgid "" "allow the same facilities to be used with Python scripts on Windows." msgstr "" -#: ../../using/windows.rst:447 msgid "" "To allow shebang lines in Python scripts to be portable between Unix and " "Windows, a number of 'virtual' commands are supported to specify which " "interpreter to use. The supported virtual commands are:" msgstr "" +"Python スクリプトのシェバン行を Unix と Windows の間で移植できるように、使用" +"するインタープリタを指定するためのいくつかの「仮想」コマンドをサポートしてい" +"ます。\n" +"サポートする仮想コマンドは次のとおりです:" -#: ../../using/windows.rst:451 msgid "``/usr/bin/env ``" -msgstr "" +msgstr "``/usr/bin/env ``" -#: ../../using/windows.rst:452 msgid "``/usr/bin/env -S ``" -msgstr "" +msgstr "``/usr/bin/env -S ``" -#: ../../using/windows.rst:453 msgid "``/usr/bin/``" -msgstr "" +msgstr "``/usr/bin/``" -#: ../../using/windows.rst:454 msgid "``/usr/local/bin/``" -msgstr "" +msgstr "``/usr/local/bin/``" -#: ../../using/windows.rst:455 msgid "````" -msgstr "" +msgstr "````" #: ../../using/windows.rst:457 ../../using/windows.rst:1690 msgid "For example, if the first line of your script starts with" msgstr "具体的に、もしスクリプトの1行目が" -#: ../../using/windows.rst:459 ../../using/windows.rst:1692 msgid "#! /usr/bin/python" -msgstr "" +msgstr "#! /usr/bin/python" #: ../../using/windows.rst:463 ../../using/windows.rst:1696 msgid "" @@ -802,7 +922,6 @@ msgstr "" "Unix 上でも有用であってほしいと思うなら、シェバン行のうち ``/usr`` で始まるも" "のを使用すべきです。" -#: ../../using/windows.rst:469 msgid "" "Any of the above virtual commands can have ```` replaced by an alias " "from an installed runtime. That is, any command generated in the global " @@ -811,15 +930,23 @@ msgid "" "envvar:`PATH`. This allows the use of shebangs like ``/usr/bin/python3.12`` " "to select a particular runtime." msgstr "" +"上記のどの仮想コマンドでも、```` をインストール済みランタイムのエイリ" +"アスに置き換えられます。\n" +"つまり、グローバルなエイリアス用ディレクトリ (:envvar:`PATH` 環境変数に追加し" +"ているかもしれません) に生成されるコマンドは、:envvar:`PATH` 上になくてもすべ" +"てシェバンで使えます。\n" +"これにより、``/usr/bin/python3.12`` のようなシェバンを使って特定のランタイム" +"を選択できます。" -#: ../../using/windows.rst:475 msgid "" "If no runtimes are installed, or if automatic installation is enabled, the " "requested runtime will be installed if necessary. See :ref:`pymanager-" "config` for information about configuration settings." msgstr "" +"ランタイムがまったくインストールされていない場合や、自動インストールが有効な" +"場合は、必要に応じて要求されたランタイムをインストールします。\n" +"設定の詳細については、:ref:`pymanager-config` を参照してください。" -#: ../../using/windows.rst:479 msgid "" "The ``/usr/bin/env`` form of shebang line will also search the :envvar:" "`PATH` environment variable for unrecognized commands. This corresponds to " @@ -828,6 +955,12 @@ msgid "" "searching for arbitrary executables, and this search may be disabled by the " "``shebang_can_run_anything`` configuration option." msgstr "" +"``/usr/bin/env`` 形式のシェバン行では、認識されないコマンドについて :envvar:" +"`PATH` 環境変数も検索します。\n" +"これは同じ検索を行う Unix の ``env`` プログラムの動作に対応していますが、既知" +"の Python コマンドの起動を優先します。\n" +"任意の実行ファイルを検索する際には警告が表示されることがあり、この検索は " +"``shebang_can_run_anything`` 設定オプションで無効にできます。" #: ../../using/windows.rst:486 msgid "" @@ -845,7 +978,6 @@ msgstr "" msgid "Advanced Installation" msgstr "" -#: ../../using/windows.rst:520 msgid "" "For situations where an MSIX cannot be installed, such as some older " "administrative distribution platforms, there is an MSI available from the " @@ -855,22 +987,33 @@ msgid "" "include this install location, but be sure to validate this on your " "configuration." msgstr "" +"古い管理者向け配布プラットフォームなど、MSIX をインストールできない場合のため" +"に、python.org のダウンロードページでは MSI を提供しています。\n" +"この MSI にはユーザインターフェースがなく、Program Files 内のデフォルトの場所" +"へのマシン単位のインストールだけを行えます。\n" +"システムの :envvar:`PATH` 環境変数にこのインストール先を含めるよう変更を試み" +"ますが、使用する構成で必ず検証してください。" -#: ../../using/windows.rst:529 msgid "" "Windows Server 2019 is the only version of Windows that CPython supports " "that does not support MSIX. For Windows Server 2019, you should use the MSI." msgstr "" +"CPython がサポートしている Windows のうち、MSIX をサポートしていないのは " +"Windows Server 2019 だけです。\n" +"Windows Server 2019 では MSI を使ってください。" -#: ../../using/windows.rst:532 msgid "" "Be aware that the MSI package does not bundle any runtimes, and so is not " "suitable for installs into offline environments without also creating an " "offline install index. See :ref:`pymanager-offline` and :ref:`pymanager-" "admin-config` for information on handling these scenarios." msgstr "" +"MSI パッケージにはランタイムが同梱されていないため、オフラインインストール用" +"のインデックスも作成しなければ、オフライン環境へのインストールには適しませ" +"ん。\n" +"このような場合への対処については、:ref:`pymanager-offline` と :ref:" +"`pymanager-admin-config` を参照してください。" -#: ../../using/windows.rst:537 msgid "" "Runtimes installed by the MSI are shared with those installed by the MSIX, " "and are all per-user only. The Python install manager does not support " @@ -879,8 +1022,14 @@ msgid "" "own system-wide modifications to :envvar:`PATH`, the registry, or the Start " "menu." msgstr "" +"MSI によってインストールしたランタイムは MSIX によってインストールしたものと" +"共有され、すべてユーザ単位に限られます。\n" +"Python インストールマネージャは、マシン単位のランタイムのインストールをサポー" +"トしていません。\n" +"マシン単位のインストールを模倣するには、管理者として ``py install --" +"target=`` を実行し、:envvar:`PATH`、レジストリ、スタートメ" +"ニューにシステム全体への変更を自分で追加できます。" -#: ../../using/windows.rst:543 msgid "" "When the MSIX is installed, but commands are not available in the :envvar:" "`PATH` environment variable, they can be found under :file:`%LocalAppData%\\" @@ -891,14 +1040,22 @@ msgid "" "Store. Attempting to run the executable directly from Program Files is not " "recommended." msgstr "" +"MSIX がインストールされていても :envvar:`PATH` 環境変数からコマンドを使えない" +"場合は、python.org と Windows Store のどちらからインストールしたかに応じて、:" +"file:`%LocalAppData%\\\\Microsoft\\\\WindowsApps\\\\PythonSoftwareFoundation." +"PythonManager_3847v3x7pw1km` または :file:`%LocalAppData%\\\\Microsoft\\" +"\\WindowsApps\\\\PythonSoftwareFoundation.PythonManager_qbz5n2kfra8p0` にあり" +"ます。\n" +"Program Files から実行ファイルを直接実行しようとすることは推奨しません。" -#: ../../using/windows.rst:552 msgid "" "To programmatically install the Python install manager, it is easiest to use " "WinGet, which is included with all supported versions of Windows:" msgstr "" +"Python インストールマネージャをプログラムからインストールする最も簡単な方法" +"は、サポート対象のすべての Windows バージョンに含まれている WinGet を使うこと" +"です:" -#: ../../using/windows.rst:555 msgid "" "$> winget install 9NQ7512CXL7T -e --accept-package-agreements --disable-" "interactivity\n" @@ -906,8 +1063,12 @@ msgid "" "# Optionally run the configuration checker and accept all changes\n" "$> py install --configure -y" msgstr "" +"$> winget install 9NQ7512CXL7T -e --accept-package-agreements --disable-" +"interactivity\n" +"\n" +"# 必要なら設定チェッカーを実行し、すべての変更を受け入れる\n" +"$> py install --configure -y" -#: ../../using/windows.rst:562 msgid "" "To download the Python install manager and install on another machine, the " "following WinGet command will download the required files from the Store to " @@ -916,43 +1077,60 @@ msgid "" "as the downloaded MSIX can be installed by launching or using the commands " "below." msgstr "" +"Python インストールマネージャをダウンロードして別のマシンにインストールするに" +"は、次の WinGet コマンドで、必要なファイルを Store からダウンロードディレクト" +"リにダウンロードします (出力先を変更するには ``-d `` を追加してくだ" +"さい)。\n" +"このコマンドは YAML ファイルも生成しますが、ダウンロードした MSIX は起動する" +"か、以下のコマンドを使ってインストールできるため、このファイルは不要のようで" +"す。" -#: ../../using/windows.rst:568 msgid "" "$> winget download 9NQ7512CXL7T -e --skip-license --accept-package-" "agreements --accept-source-agreements" msgstr "" +"$> winget download 9NQ7512CXL7T -e --skip-license --accept-package-" +"agreements --accept-source-agreements" -#: ../../using/windows.rst:572 msgid "" "To programmatically install or uninstall an MSIX using only PowerShell, the " "`Add-AppxPackage`_ and `Remove-AppxPackage`_ PowerShell cmdlets are " "recommended:" msgstr "" +"PowerShell だけを使ってプログラムから MSIX をインストールまたはアンインストー" +"ルするには、PowerShell コマンドレットの `Add-AppxPackage`_ と `Remove-" +"AppxPackage`_ を推奨します:" -#: ../../using/windows.rst:575 msgid "" "$> Add-AppxPackage C:\\Downloads\\python-manager-25.0.msix\n" "...\n" "$> Get-AppxPackage PythonSoftwareFoundation.PythonManager | Remove-" "AppxPackage" msgstr "" +"$> Add-AppxPackage C:\\Downloads\\python-manager-25.0.msix\n" +"...\n" +"$> Get-AppxPackage PythonSoftwareFoundation.PythonManager | Remove-" +"AppxPackage" -#: ../../using/windows.rst:581 msgid "" "The latest release can be downloaded and installed by Windows by passing the " "AppInstaller file to the Add-AppxPackage command. This installs using the " "MSIX on python.org, and is only recommended for cases where installing via " "the Store (interactively or using WinGet) is not possible." msgstr "" +"AppInstaller ファイルを Add-AppxPackage コマンドに渡すと、Windows が最新リ" +"リースをダウンロードしてインストールできます。\n" +"これは python.org 上の MSIX を使ってインストールする方法で、Store からのイン" +"ストール (対話的な操作や WinGet によるもの) ができない場合に限って推奨しま" +"す。" -#: ../../using/windows.rst:586 msgid "" "$> Add-AppxPackage -AppInstallerFile https://www.python.org/ftp/python/" "pymanager/pymanager.appinstaller" msgstr "" +"$> Add-AppxPackage -AppInstallerFile https://www.python.org/ftp/python/" +"pymanager/pymanager.appinstaller" -#: ../../using/windows.rst:590 msgid "" "Other tools and APIs may also be used to provision an MSIX package for all " "users on a machine, but Python does not consider this a supported scenario. " @@ -960,6 +1138,12 @@ msgid "" "the native Windows `PackageManager`_ class, or the documentation and support " "for your deployment tool." msgstr "" +"ほかのツールや API を使って、マシン上のすべてのユーザ向けに MSIX パッケージを" +"プロビジョニングすることもできますが、Python はこの利用方法をサポート対象とし" +"ていません。\n" +"PowerShell の `Add-AppxProvisionedPackage`_ コマンドレット、Windows ネイティ" +"ブの `PackageManager`_ クラス、または使用している展開ツールのドキュメントやサ" +"ポートを調べることをお勧めします。" #: ../../using/windows.rst:596 msgid "" @@ -983,7 +1167,6 @@ msgstr "" msgid "Administrative Configuration" msgstr "" -#: ../../using/windows.rst:614 msgid "" "There are a number of options that may be useful for administrators to " "override configuration of the Python install manager. These can be used to " @@ -991,8 +1174,12 @@ msgid "" "content. All of the above configuration options may be set, as well as those " "below." msgstr "" +"Python インストールマネージャの設定を管理者が上書きする際に役立つオプションが" +"いくつかあります。\n" +"これらを使うと、ローカルキャッシュの提供、特定の種類のショートカットの無効" +"化、同梱コンテンツの上書きができます。\n" +"上記の設定オプションはすべて設定でき、以下の設定も使えます。" -#: ../../using/windows.rst:619 msgid "" "Configuration options may be overridden in the registry by setting values " "under :file:`HKEY_LOCAL_MACHINE\\\\Software\\\\Policies\\\\Python\\" @@ -1004,8 +1191,16 @@ msgid "" "Registry key overrides will replace any other configured setting, while " "``base_config`` allows users to further modify settings they may need." msgstr "" +"レジストリの :file:`HKEY_LOCAL_MACHINE\\\\Software\\\\Policies\\\\Python\\" +"\\PyManager` の下に、設定キーと一致する値名、``REG_SZ`` 型の値を設定すると、" +"設定オプションを上書きできます。\n" +"このキー自体もカスタマイズできますが、Python インストールマネージャに付属する" +"コア設定ファイルを変更する方法に限られます。\n" +"ただし、レジストリの値は、上書きする設定一式を含む JSON ファイルを " +"``base_config`` に指定するためだけに使うことをお勧めします。\n" +"レジストリキーによる上書きは、ほかの方法で指定した設定をすべて置き換えます" +"が、``base_config`` を使えば、ユーザが必要な設定をさらに変更できます。" -#: ../../using/windows.rst:629 msgid "" "Note that most settings with environment variables support those variables " "because their default setting specifies the variable. If you override them, " @@ -1016,73 +1211,75 @@ msgid "" "longer be used. If you override the value to ``%CONFIRM%``, then that " "environment variable will be used instead." msgstr "" +"環境変数を使える設定のほとんどは、デフォルト値にその変数を指定することで対応" +"している点に注意してください。\n" +"これらの設定を上書きすると、別の環境変数で上書きしない限り、環境変数は使われ" +"なくなります。\n" +"たとえば、``confirm`` のデフォルト値は文字どおり " +"``%PYTHON_MANAGER_CONFIRM%`` で、読み込み時にこの変数を解決します。\n" +"値を ``yes`` に上書きすると、その環境変数は使われなくなります。\n" +"値を ``%CONFIRM%`` に上書きすると、代わりにそちらの環境変数を使います。" -#: ../../using/windows.rst:638 msgid "" "Configuration settings that are paths are interpreted as relative to the " "directory containing the configuration file that specified them." msgstr "" +"パスを指定する設定は、そのパスを指定した設定ファイルがあるディレクトリからの" +"相対パスとして解釈します。" -#: ../../using/windows.rst:641 msgid "Administrative configuration options" -msgstr "" +msgstr "管理者向けの設定オプション" -#: ../../using/windows.rst:1 msgid "``base_config``" -msgstr "" +msgstr "``base_config``" -#: ../../using/windows.rst:1 msgid "" "The highest priority configuration file to read. Note that only the built-in " "configuration file and the registry can modify this setting." msgstr "" +"最優先で読み込む設定ファイルです。\n" +"この設定は、組み込みの設定ファイルとレジストリだけが変更できます。" -#: ../../using/windows.rst:1 msgid "``user_config``" -msgstr "" +msgstr "``user_config``" -#: ../../using/windows.rst:1 msgid "The second configuration file to read." -msgstr "" +msgstr "2 番目に読み込む設定ファイルです。" -#: ../../using/windows.rst:1 msgid "``additional_config``" -msgstr "" +msgstr "``additional_config``" -#: ../../using/windows.rst:1 msgid "The third configuration file to read." -msgstr "" +msgstr "3 番目に読み込む設定ファイルです。" -#: ../../using/windows.rst:1 msgid "``registry_override_key``" -msgstr "" +msgstr "``registry_override_key``" -#: ../../using/windows.rst:1 msgid "" "Registry location to check for overrides. Note that only the built-in " "configuration file can modify this setting." msgstr "" +"設定の上書きを確認するレジストリ内の場所です。\n" +"この設定は、組み込みの設定ファイルだけが変更できます。" -#: ../../using/windows.rst:1 msgid "``bundled_dir``" -msgstr "" +msgstr "``bundled_dir``" -#: ../../using/windows.rst:1 msgid "Read-only directory containing locally cached files." msgstr "" +"ローカルにキャッシュしたファイルを含む、読み出し専用のディレクトリです。" -#: ../../using/windows.rst:1 msgid "``install.fallback_source``" -msgstr "" +msgstr "``install.fallback_source``" -#: ../../using/windows.rst:1 msgid "" "Path or URL to an index to consult when the main index cannot be accessed." msgstr "" +"メインのインデックスにアクセスできない場合に参照する、インデックスのパスまた" +"は URL です。" -#: ../../using/windows.rst:1 msgid "``install.enable_shortcut_kinds``" -msgstr "" +msgstr "``install.enable_shortcut_kinds``" #: ../../using/windows.rst:1 msgid "" @@ -1090,9 +1287,8 @@ msgid "" "Enabled shortcuts may still be disabled by ``disable_shortcut_kinds``." msgstr "" -#: ../../using/windows.rst:1 msgid "``install.disable_shortcut_kinds``" -msgstr "" +msgstr "``install.disable_shortcut_kinds``" #: ../../using/windows.rst:1 msgid "" @@ -1101,45 +1297,47 @@ msgid "" "``enable_shortcut_kinds``." msgstr "" -#: ../../using/windows.rst:1 msgid "``pep514_root``" -msgstr "" +msgstr "``pep514_root``" -#: ../../using/windows.rst:1 msgid "" "Registry location to read and write PEP 514 entries into. By default, :file:" "`HKEY_CURRENT_USER\\\\Software\\\\Python`." msgstr "" +"PEP 514 のエントリを読み書きする、レジストリ内の場所です。\n" +"デフォルトは :file:`HKEY_CURRENT_USER\\\\Software\\\\Python` です。" -#: ../../using/windows.rst:1 msgid "``start_folder``" -msgstr "" +msgstr "``start_folder``" -#: ../../using/windows.rst:1 msgid "" "Start menu folder to write shortcuts into. By default, ``Python``. This path " "is relative to the user's Programs folder." msgstr "" +"ショートカットを書き込むスタートメニューのフォルダです。\n" +"デフォルトは ``Python`` です。\n" +"このパスは、ユーザの Programs フォルダからの相対パスです。" -#: ../../using/windows.rst:1 msgid "``virtual_env``" -msgstr "" +msgstr "``virtual_env``" -#: ../../using/windows.rst:1 msgid "" "Path to the active virtual environment. By default, this is " "``%VIRTUAL_ENV%``, but may be set empty to disable venv detection." msgstr "" +"アクティブな仮想環境へのパスです。\n" +"デフォルトは ``%VIRTUAL_ENV%`` ですが、空にすると venv の検出を無効にできま" +"す。" -#: ../../using/windows.rst:1 msgid "``shebang_can_run_anything_silently``" -msgstr "" +msgstr "``shebang_can_run_anything_silently``" -#: ../../using/windows.rst:1 msgid "" "True to suppress visible warnings when a shebang launches an application " "other than a Python runtime." msgstr "" +"true にすると、シェバンが Python ランタイム以外のアプリケーションを起動すると" +"きに表示する警告を抑制します。" #: ../../using/windows.rst:685 ../../using/windows.rst:1480 msgid "Installing Free-threaded Binaries" @@ -1181,9 +1379,8 @@ msgid "" "commands." msgstr "" -#: ../../using/windows.rst:711 ../../using/windows.rst:719 msgid "Troubleshooting" -msgstr "" +msgstr "トラブルシューティング" #: ../../using/windows.rst:713 msgid "" @@ -1194,40 +1391,42 @@ msgid "" "by default)." msgstr "" -#: ../../using/windows.rst:1 msgid "Symptom" -msgstr "" +msgstr "症状" -#: ../../using/windows.rst:1 msgid "Things to try" -msgstr "" +msgstr "試すこと" -#: ../../using/windows.rst:1 msgid "" "``python`` gives me a \"command not found\" error or opens the Store app " "when I type it in my terminal." msgstr "" +"ターミナルに ``python`` と入力すると、\"command not found\" エラーが出るか、" +"Store アプリが開く。" -#: ../../using/windows.rst:1 msgid "Did you :ref:`install the Python install manager `?" msgstr "" +":ref:`Python インストールマネージャをインストールしましたか `?" -#: ../../using/windows.rst:1 msgid "" "Click Start, open \"Manage app execution aliases\", and check that the " "aliases for \"Python (default)\" are enabled. If they already are, try " "disabling and re-enabling to refresh the command. The \"Python (default " "windowed)\" and \"Python install manager\" commands may also need refreshing." msgstr "" +"スタートをクリックして \"Manage app execution aliases\" を開き、\"Python " +"(default)\" のエイリアスが有効であることを確認してください。\n" +"既に有効であれば、無効にしてから再度有効にし、コマンドを更新してみてくださ" +"い。\n" +"\"Python (default windowed)\" と \"Python install manager\" のコマンドも更新" +"が必要かもしれません。" -#: ../../using/windows.rst:1 msgid "Check that the ``py`` and ``pymanager`` commands work." -msgstr "" +msgstr "``py`` と ``pymanager`` コマンドが動作することを確認してください。" -#: ../../using/windows.rst:1 msgid "" "``py`` gives me a \"command not found\" error when I type it in my terminal." -msgstr "" +msgstr "ターミナルに ``py`` と入力すると、\"command not found\" エラーが出る。" #: ../../using/windows.rst:1 msgid "" @@ -1237,38 +1436,43 @@ msgid "" "windowed)\" and \"Python install manager\" commands may also need refreshing." msgstr "" -#: ../../using/windows.rst:1 msgid "" "``py`` gives me a \"can't open file\" error when I type commands in my " "terminal." msgstr "" +"ターミナルに ``py`` コマンドを入力すると、\"can't open file\" エラーが出る。" -#: ../../using/windows.rst:1 msgid "" "This usually means you have the legacy launcher installed and it has " "priority over the Python install manager. To remove, click Start, open " "\"Installed apps\", search for \"Python launcher\" and uninstall it." msgstr "" +"通常これは、旧ランチャがインストールされていて、Python インストールマネージャ" +"よりも優先されていることを意味します。\n" +"削除するには、スタートをクリックして \"Installed apps\" を開き、\"Python " +"launcher\" を検索してアンインストールしてください。" -#: ../../using/windows.rst:1 msgid "``python`` doesn't launch the same runtime as ``py``" -msgstr "" +msgstr "``python`` と ``py`` が異なるランタイムを起動する" -#: ../../using/windows.rst:1 msgid "" "Click Start, open \"Installed apps\", look for any existing Python runtimes, " "and either remove them or Modify and disable the :envvar:`PATH` options." msgstr "" +"スタートをクリックして \"Installed apps\" を開き、既存の Python ランタイムを" +"探して、削除するか、Modify を選んで :envvar:`PATH` のオプションを無効にしてく" +"ださい。" -#: ../../using/windows.rst:1 msgid "" "Click Start, open \"Manage app execution aliases\", and check that your " "``python.exe`` alias is set to \"Python (default)\"" msgstr "" +"スタートをクリックして \"Manage app execution aliases\" を開き、``python." +"exe`` エイリアスが \"Python (default)\" に設定されていることを確認してくださ" +"い" -#: ../../using/windows.rst:1 msgid "``python`` and ``py`` don't launch the runtime I expect" -msgstr "" +msgstr "``python`` と ``py`` が期待したランタイムを起動しない" #: ../../using/windows.rst:1 msgid "" @@ -1277,12 +1481,15 @@ msgid "" "default based on these settings." msgstr "" -#: ../../using/windows.rst:1 msgid "" "Installs that are managed by the Python install manager will be chosen ahead " "of unmanaged installs. Use ``py install`` to install the runtime you expect, " "or configure your default tag." msgstr "" +"Python インストールマネージャで管理しているインストールは、管理していないイン" +"ストールよりも優先して選択されます。\n" +"``py install`` で目的のランタイムをインストールするか、デフォルトのタグを設定" +"してください。" #: ../../using/windows.rst:1 msgid "" @@ -1292,27 +1499,31 @@ msgid "" "install``." msgstr "" -#: ../../using/windows.rst:1 msgid "" "``pythonw`` or ``pyw`` don't launch the same runtime as ``python`` or ``py``" msgstr "" +"``pythonw`` や ``pyw`` が、``python`` や ``py`` と異なるランタイムを起動する" -#: ../../using/windows.rst:1 msgid "" "Click Start, open \"Manage app execution aliases\", and check that your " "``pythonw.exe`` and ``pyw.exe`` aliases are consistent with your others." msgstr "" +"スタートをクリックして \"Manage app execution aliases\" を開き、``pythonw." +"exe`` と ``pyw.exe`` のエイリアスがほかのエイリアスと整合していることを確認し" +"てください。" -#: ../../using/windows.rst:1 msgid "" "``pip`` gives me a \"command not found\" error when I type it in my terminal." msgstr "" +"ターミナルに ``pip`` と入力すると、\"command not found\" エラーが出る。" -#: ../../using/windows.rst:1 msgid "" "Have you activated a virtual environment? Run the ``." "venv\\Scripts\\activate`` script in your terminal to activate." msgstr "" +"仮想環境をアクティブにしていますか?\n" +"ターミナルで ``.venv\\Scripts\\activate`` スクリプトを実行してアクティブにし" +"てください。" #: ../../using/windows.rst:1 msgid "" @@ -1337,11 +1548,12 @@ msgstr "" "ZIP ファイルです。これは、エンドユーザから直接的にアクセスされるのではなく何" "かアプリケーションの一部として動作することを意図したものです。" -#: ../../using/windows.rst:796 msgid "" "To install an embedded distribution, we recommend using ``py install`` with " "the ``--target`` option:" msgstr "" +"埋め込み用の配布をインストールするには、``py install`` に ``--target`` オプ" +"ションを付けて使うことをお勧めします:" #: ../../using/windows.rst:799 msgid "$> py install 3.14-embed --target=runtime" @@ -1358,12 +1570,14 @@ msgid "" "documentation are not included." msgstr "" -#: ../../using/windows.rst:810 msgid "" "A default ``._pth`` file is included, which further restricts the default " "search paths (as described below in :ref:`windows_finding_modules`). This " "file is intended for embedders to modify as necessary." msgstr "" +"デフォルトの ``._pth`` ファイルが含まれており、デフォルトの検索パスをさらに制" +"限します (後述の :ref:`windows_finding_modules` で説明します)。\n" +"このファイルは、埋め込む側が必要に応じて変更することを意図しています。" #: ../../using/windows.rst:814 msgid "" @@ -1392,7 +1606,6 @@ msgstr "この配布の 2 つのお勧めできるユースケースを、以下 msgid "Python Application" msgstr "Python アプリケーション" -#: ../../using/windows.rst:827 msgid "" "An application written in Python does not necessarily require users to be " "aware of that fact. The embedded distribution may be used in this case to " @@ -1400,13 +1613,14 @@ msgid "" "transparent it should be (or conversely, how professional it should appear), " "there are two options." msgstr "" -"Python で記述された、必ずしもユーザにその事実を意識させる必要のないアプリケー" -"ションです。埋め込み用配布はこのケースで、インストールパッケージ内に Python " -"のプライベートバージョンを含めるのに使えるでしょう。その事実がどのように透過" -"的であるべきかに依存して (あるいは逆に、どのようにプロフェッショナルにみえる" -"べきか)、2 つの選択肢があります。" +"Python で書かれたアプリケーションでも、必ずしもユーザにその事実を意識させる必" +"要はありません。\n" +"この場合は、埋め込み用の配布を使って、インストールパッケージに専用の Python " +"を含めることができます。\n" +"ユーザに Python の存在をどの程度意識させずに使ってもらいたいか (あるいは逆" +"に、どの程度本格的なアプリケーションに見せたいか) に応じて、2 つの選択肢があ" +"ります。" -#: ../../using/windows.rst:833 msgid "" "Using a specialized executable as a launcher requires some coding, but " "provides the most transparent experience for users. With a customized " @@ -1416,13 +1630,14 @@ msgid "" "launcher should simply be able to call ``Py_Main`` with a hard-coded command " "line." msgstr "" -"ランチャとなる特別な実行ファイルを使うことはちょっとしたコーディングを必要と" -"しますが、ユーザにとっては最も透過的なユーザ体験となります。カスタマイズされ" -"たランチャでは、何もしなければ Python で実行されるプログラムの明白な目印はあ" -"りません; アイコンはカスタマイズし、会社名やバージョン情報を指定し、ファイル" -"の関連付けがそれに相応しく振舞うようにできます。ほとんどのケースではカスタム" -"ランチャは、ハードコードされたコマンドライン文字列で単純に ``Py_Main`` を呼び" -"出すので済むはずです。" +"専用の実行ファイルをランチャとして使うには多少のコーディングが必要ですが、" +"ユーザが Python の存在を最も意識せずに使える方法です。\n" +"カスタマイズしたランチャでは、プログラムが Python 上で動いていることを示す明" +"白な目印はありません。\n" +"アイコンをカスタマイズでき、会社名やバージョン情報を指定でき、ファイルの関連" +"付けも適切に動作します。\n" +"ほとんどの場合、カスタムランチャは、ハードコードしたコマンドラインで " +"``Py_Main`` を呼び出すだけで済むはずです。" #: ../../using/windows.rst:840 msgid "" @@ -1455,7 +1670,6 @@ msgstr "" msgid "Embedding Python" msgstr "Python の埋め込み" -#: ../../using/windows.rst:854 msgid "" "Applications written in native code often require some form of scripting " "language, and the embedded Python distribution can be used for this purpose. " @@ -1465,12 +1679,12 @@ msgid "" "application installation is sufficient to provide a loadable Python " "interpreter." msgstr "" -"ネイティブコードで書かれ、時々スクリプト言語のようなものを必要とするようなア" -"プリケーションです。Python 埋め込み用の配布はこの目的に使えます。一般的に、ア" -"プリケーションの大半がネイティブコード内にあり、一部が ``python.exe`` を呼び" -"出すか、直接的に ``python3.dll`` を使います。どちらのケースでも、ロード可能" -"な Python インタプリタを提供するのには、埋め込み用の配布を展開してアプリケー" -"ションのインストレーションのサブディレクトリに置くことで十分です。" +"ネイティブコードで書かれたアプリケーションでは、何らかのスクリプト言語が必要" +"になることがよくあり、Python の埋め込み用の配布をこの目的に使えます。\n" +"一般に、アプリケーションの大半はネイティブコードで書かれ、一部が ``python." +"exe`` を呼び出すか、``python3.dll`` を直接使います。\n" +"どちらの場合も、埋め込み用の配布をアプリケーションのインストール先のサブディ" +"レクトリに展開すれば、読み込み可能な Python インタープリタを提供できます。" #: ../../using/windows.rst:861 msgid "" @@ -1522,13 +1736,13 @@ msgstr "" "このツールを次のように使って、 64 bit あるいは 32 bit のマシン向けの最新バー" "ジョンの Python がインストールできます::" -#: ../../using/windows.rst:888 msgid "" "nuget.exe install python -ExcludeVersion -OutputDirectory .\n" "nuget.exe install pythonx86 -ExcludeVersion -OutputDirectory ." msgstr "" +"nuget.exe install python -ExcludeVersion -OutputDirectory .\n" +"nuget.exe install pythonx86 -ExcludeVersion -OutputDirectory ." -#: ../../using/windows.rst:891 msgid "" "To select a particular version, add a ``-Version 3.x.y``. The output " "directory may be changed from ``.``, and the package will be installed into " @@ -1537,16 +1751,15 @@ msgid "" "the specific version installed. Inside the subdirectory is a ``tools`` " "directory that contains the Python installation:" msgstr "" -"特定のバージョンを選択するには、 ``-Version 3.x.y`` を追加してください。\n" -"出力ディレクトリは ``.`` から変更されることがあり、パッケージはサブディレクト" -"リにインストールされます。\n" -"デフォルトではサブディレクトリはパッケージと同じ名前になり、 ``-" -"ExcludeVersion`` オプションを付けないとこの名前はインストールされたバージョン" -"を含みます。\n" -"サブディレクトリの中にはインストールされた Python を含んでいる ``tools`` ディ" -"レクトリがあります:" +"特定のバージョンを選択するには、``-Version 3.x.y`` を追加してください。\n" +"出力ディレクトリは ``.`` から変更でき、パッケージはそのサブディレクトリにイン" +"ストールされます。\n" +"デフォルトではサブディレクトリはパッケージと同じ名前になり、``-" +"ExcludeVersion`` オプションを付けないと、インストールしたバージョンも名前に含" +"まれます。\n" +"そのサブディレクトリの中に、Python のインストールを含む ``tools`` ディレクト" +"リがあります:" -#: ../../using/windows.rst:898 msgid "" "# Without -ExcludeVersion\n" "> .\\python.3.5.2\\tools\\python.exe -V\n" @@ -1556,20 +1769,26 @@ msgid "" "> .\\python\\tools\\python.exe -V\n" "Python 3.5.2" msgstr "" +"# -ExcludeVersion を付けない場合\n" +"> .\\python.3.5.2\\tools\\python.exe -V\n" +"Python 3.5.2\n" +"\n" +"# -ExcludeVersion を付けた場合\n" +"> .\\python\\tools\\python.exe -V\n" +"Python 3.5.2" -#: ../../using/windows.rst:908 msgid "" "In general, nuget packages are not upgradeable, and newer versions should be " "installed side-by-side and referenced using the full path. Alternatively, " "delete the package directory manually and install it again. Many CI systems " "will do this automatically if they do not preserve files between builds." msgstr "" -"一般的には、 nuget パッケージはアップグレードできず、より新しいバージョンは横" -"並びにインストールされ、フルパスで参照されます。\n" -"そうする代わりに、手動で直接パッケージを削除し、再度インストールすることもで" -"きます。\n" -"多くの CI システムは、ビルド間でファイルを保存しておかない場合、この作業を自" -"動的に行います。" +"一般に、nuget パッケージはアップグレードできないため、新しいバージョンは既存" +"のものと並べてインストールし、フルパスで参照してください。\n" +"あるいは、パッケージのディレクトリを手動で削除して、再度インストールしてくだ" +"さい。\n" +"多くの CI システムでは、ビルド間でファイルを保持しない場合、この作業を自動的" +"に行います。" #: ../../using/windows.rst:913 msgid "" @@ -1649,10 +1868,10 @@ msgstr "" "人気のある (numpy, scipy や pandas のような) 科学系モジュールと、パッケージマ" "ネージャ ``conda`` 。" -#: ../../using/windows.rst:959 msgid "" "`Enthought Deployment Manager `_" msgstr "" +"`Enthought Deployment Manager `_" #: ../../using/windows.rst:960 msgid "\"The Next Generation Python Environment and Package Manager\"." @@ -1693,9 +1912,8 @@ msgstr "" "ませんし、コア Python チームはこれらを保守もしませんしサポートもしませんので" "ご理解ください。" -#: ../../using/windows.rst:974 msgid "Supported Windows versions" -msgstr "" +msgstr "サポートする Windows のバージョン" #: ../../using/windows.rst:976 msgid "" @@ -1718,7 +1936,6 @@ msgstr "" "Windows は歴史的にパスの長さが 260 文字に制限されています。\n" "つまり、これより長いパスは解決できず結果としてエラーになるということです。" -#: ../../using/windows.rst:991 msgid "" "In the latest versions of Windows, this limitation can be expanded to over " "32,000 characters. Your administrator will need to activate the \"Enable " @@ -1726,6 +1943,12 @@ msgid "" "registry key " "``HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\FileSystem``." msgstr "" +"最新バージョンの Windows では、この制限を 32,000 文字を超える長さに拡張できま" +"す。\n" +"管理者が \"Enable Win32 long paths\" グループポリシーを有効にするか、レジスト" +"リキー " +"``HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\FileSystem`` の " +"``LongPathsEnabled`` を ``1`` に設定する必要があります。" #: ../../using/windows.rst:996 ../../using/windows.rst:1278 msgid "" @@ -1735,11 +1958,11 @@ msgstr "" "これにより、 :func:`open` 関数や :mod:`os` モジュール、他のほとんどのパスの機" "能が 260 文字より長いパスを受け入れ、返すことができるようになります。" -#: ../../using/windows.rst:999 msgid "" "After changing the above option and rebooting, no further configuration is " "required." msgstr "" +"上記のオプションを変更して再起動すると、それ以上の設定は必要ありません。" #: ../../using/windows.rst:1006 msgid "UTF-8 mode" @@ -1752,11 +1975,13 @@ msgid "" "`locale.getencoding`)." msgstr "" -#: ../../using/windows.rst:1014 msgid "" "This may cause issues because UTF-8 is widely used on the internet and most " "Unix systems, including WSL (Windows Subsystem for Linux)." msgstr "" +"インターネットや、WSL (Windows Subsystem for Linux) を含むほとんどの Unix シ" +"ステムでは UTF-8 が広く使われているため、これが問題を引き起こすことがありま" +"す。" #: ../../using/windows.rst:1017 msgid "" @@ -1782,31 +2007,33 @@ msgid "" "utf8`` command line option." msgstr "" -#: ../../using/windows.rst:1033 msgid "" "Even when UTF-8 mode is disabled, Python uses UTF-8 by default on Windows " "for:" msgstr "" +"UTF-8 モードが無効でも、Windows 上では Python は次の用途にデフォルトで UTF-8 " +"を使います:" -#: ../../using/windows.rst:1036 msgid "Console I/O including standard I/O (see :pep:`528` for details)." -msgstr "" +msgstr "標準入出力を含むコンソール入出力 (詳細は :pep:`528` を参照)。" -#: ../../using/windows.rst:1037 msgid "" "The :term:`filesystem encoding ` " "(see :pep:`529` for details)." msgstr "" +":term:`ファイルシステムのエンコーディング ` (詳細は :pep:`529` を参照)。" #: ../../using/windows.rst:1044 msgid "Finding modules" msgstr "モジュールの検索" -#: ../../using/windows.rst:1046 msgid "" "These notes supplement the description at :ref:`sys-path-init` with detailed " "Windows notes." msgstr "" +"以下では、:ref:`sys-path-init` の説明を補足する、Windows 固有の詳細を説明しま" +"す。" #: ../../using/windows.rst:1049 msgid "" @@ -1835,7 +2062,6 @@ msgstr "" "(``C:\\`` など)と区別するために、この環境変数に含まれるパスの区切り文字はセミ" "コロンでなければならない事に注意してください。" -#: ../../using/windows.rst:1060 msgid "" "Additional \"application paths\" can be added in the registry as subkeys of :" "samp:`\\\\SOFTWARE\\\\Python\\\\PythonCore\\\\{version}\\\\PythonPath` under " @@ -1844,12 +2070,12 @@ msgid "" "cause each path to be added to :data:`sys.path`. (Note that all known " "installers only use HKLM, so HKCU is typically empty.)" msgstr "" -"追加で \"アプリケーションのパス\" を ``HKEY_CURRENT_USER`` か " -"``HKEY_LOCAL_MACHINE`` の中の :samp:`\\\\SOFTWARE\\\\Python\\\\PythonCore\\" -"\\{version}\\\\PythonPath` のサブキーとして登録することができます。サブキーは" -"デフォルト値としてセミコロンで区切られたパス文字列を持つことができ、書くパス" -"が :data:`sys.path` に追加されます。 (既存のインストーラーはすべて HKLM しか" -"利用しないので、 HKCU は通常空です)" +"追加の「アプリケーションパス」は、レジストリの ``HKEY_CURRENT_USER`` と " +"``HKEY_LOCAL_MACHINE`` の両ハイブの下にある :samp:`\\\\SOFTWARE\\\\Python\\" +"\\PythonCore\\\\{version}\\\\PythonPath` のサブキーとして追加できます。\n" +"デフォルト値がセミコロン区切りのパス文字列であるサブキーがあると、各パスを :" +"data:`sys.path` に追加します。\n" +"(既知のインストーラはすべて HKLM だけを使うため、HKCU は通常空です。)" #: ../../using/windows.rst:1067 msgid "" @@ -1902,17 +2128,16 @@ msgstr "" msgid "The end result of all this is:" msgstr "結果としてこうなります:" -#: ../../using/windows.rst:1088 msgid "" "When running :file:`python.exe`, or any other .exe in the main Python " "directory (either an installed version, or directly from the PCbuild " "directory), the core path is deduced, and the core paths in the registry are " "ignored. Other \"application paths\" in the registry are always read." msgstr "" -":file:`python.exe` かそれ以外の Python ディレクトリにある .exe ファイルを実行" -"したとき (インストールされている場合でも PCbuild から直接実行されている場合で" -"も) core path が利用され、レジストリ内の core path は無視されます。それ以外の" -"レジストリの \"application paths\" は常に読み込まれます。" +":file:`python.exe` または Python のメインディレクトリにあるほかの .exe を実行" +"する場合 (インストール済みのバージョンでも、PCbuild ディレクトリから直接実行" +"する場合でも)、コアパスを推定し、レジストリ内のコアパスは無視します。\n" +"レジストリ内のほかの「アプリケーションパス」は常に読み込みます。" #: ../../using/windows.rst:1093 msgid "" @@ -1945,13 +2170,16 @@ msgstr "" "(のいずれかまたは組合せ) によりほかのインストレーションとの衝突を避けることが" "できます:" -#: ../../using/windows.rst:1104 msgid "" "Include a ``._pth`` file alongside your executable containing the " "directories to include. This will ignore paths listed in the registry and " "environment variables, and also ignore :mod:`site` unless ``import site`` is " "listed." msgstr "" +"実行ファイルと同じ場所に、含めたいディレクトリを列挙した ``._pth`` ファイルを" +"置いてください。\n" +"これにより、レジストリや環境変数に記載されたパスを無視し、``import site`` を" +"列挙していない限り :mod:`site` も無視します。" #: ../../using/windows.rst:1109 msgid "" @@ -1969,7 +2197,6 @@ msgstr "" "`PYTHONPATH` をクリアしたり上書きし、 :envvar:`PYTHONHOME` をセットしてくださ" "い。" -#: ../../using/windows.rst:1116 msgid "" "If you cannot use the previous suggestions (for example, you are a " "distribution that allows people to run :file:`python.exe` directly), ensure " @@ -1977,6 +2204,11 @@ msgid "" "directory. (Note that it will not be detected inside a ZIP file, but a " "correctly named ZIP file will be detected instead.)" msgstr "" +"上記の方法を使えない場合 (たとえば、:file:`python.exe` の直接実行を利用者に許" +"可するディストリビューションの場合)、インストールディレクトリ内に目印となる" +"ファイル (:file:`Lib\\\\os.py`) があることを確認してください。\n" +"(ZIP ファイル内にあるものは検出されませんが、代わりに、正しい名前の ZIP ファ" +"イルが検出されます。)" #: ../../using/windows.rst:1122 msgid "" @@ -1999,19 +2231,24 @@ msgid "" "cfg``." msgstr "" -#: ../../using/windows.rst:1135 msgid "" "Add :file:`python{XX}.zip` as a potential landmark when directly adjacent to " "the executable." msgstr "" +"実行ファイルと同じディレクトリにある :file:`python{XX}.zip` を、目印となる" +"ファイルの候補として追加しました。" -#: ../../using/windows.rst:1140 msgid "" "Modules specified in the registry under ``Modules`` (not ``PythonPath``) may " "be imported by :class:`importlib.machinery.WindowsRegistryFinder`. This " "finder is enabled on Windows in 3.6.0 and earlier, but may need to be " "explicitly added to :data:`sys.meta_path` in the future." msgstr "" +"レジストリの ``Modules`` (``PythonPath`` ではありません) に指定されたモジュー" +"ルは、:class:`importlib.machinery.WindowsRegistryFinder` がインポートすること" +"があります。\n" +"このファインダーは、Windows 上の 3.6.0 以前では有効ですが、将来は :data:`sys." +"meta_path` への明示的な追加が必要になるかもしれません。" #: ../../using/windows.rst:1146 msgid "Additional modules" @@ -2039,17 +2276,20 @@ msgstr "" msgid "PyWin32" msgstr "PyWin32" -#: ../../using/windows.rst:1158 msgid "" "The :pypi:`PyWin32` module by Mark Hammond is a collection of modules for " "advanced Windows-specific support. This includes utilities for:" msgstr "" +"Mark Hammond による :pypi:`PyWin32` モジュールは、Windows 固有の高度なサポー" +"トを提供するモジュール群です。\n" +"次のものに対応するユーティリティを含んでいます:" -#: ../../using/windows.rst:1162 msgid "" "`Component Object Model `_ (COM)" msgstr "" +"`Component Object Model `_ (COM)" #: ../../using/windows.rst:1165 msgid "Win32 API calls" @@ -2063,11 +2303,12 @@ msgstr "レジストリ" msgid "Event log" msgstr "イベントログ" -#: ../../using/windows.rst:1168 msgid "" "`Microsoft Foundation Classes `_ (MFC) user interfaces" msgstr "" +"`Microsoft Foundation Classes `_ (MFC) のユーザインターフェース" #: ../../using/windows.rst:1172 msgid "" @@ -2079,10 +2320,10 @@ msgstr "" "org/windows/pythonwin/>`_ は PyWin32 に付属している、サンプルのMFCアプリケー" "ションです。これはビルトインのデバッガを含む、組み込み可能なIDEです。" -#: ../../using/windows.rst:1178 msgid "" "`Win32 How Do I...? `_" msgstr "" +"`Win32 How Do I...? `_" #: ../../using/windows.rst:1179 msgid "by Tim Golden" @@ -2100,13 +2341,17 @@ msgstr "by David and Paul Boddie" msgid "cx_Freeze" msgstr "cx_Freeze" -#: ../../using/windows.rst:1188 msgid "" "`cx_Freeze `_ wraps Python " "scripts into executable Windows programs (:file:`{*}.exe` files). When you " "have done this, you can distribute your application without requiring your " "users to install Python." msgstr "" +"`cx_Freeze `_ は、Python スクリ" +"プトを Windows の実行可能なプログラム (:file:`{*}.exe` ファイル) にまとめま" +"す。\n" +"これを使うと、ユーザに Python のインストールを求めずにアプリケーションを配布" +"できます。" #: ../../using/windows.rst:1195 msgid "Compiling Python on Windows" @@ -2147,15 +2392,15 @@ msgid "For extension modules, consult :ref:`building-on-windows`." msgstr "" "拡張モジュールについては、 :ref:`building-on-windows` を参照してください。" -#: ../../using/windows.rst:1215 msgid "The full installer (deprecated)" -msgstr "" +msgstr "完全版インストーラ (非推奨)" -#: ../../using/windows.rst:1219 msgid "" "This installer is deprecated since 3.14 and will not be produced for Python " "3.16 or later. See :ref:`pymanager` for the modern installer." msgstr "" +"このインストーラは 3.14 から非推奨で、Python 3.16 以降では作成されません。\n" +"現在のインストーラについては :ref:`pymanager` を参照してください。" #: ../../using/windows.rst:1224 msgid "Installation steps" @@ -2224,17 +2469,16 @@ msgstr "" msgid "Shortcuts will only be visible for the current user" msgstr "ショートカットはカレントユーザだけに可視になります。" -#: ../../using/windows.rst:1250 msgid "" "Selecting \"Customize installation\" will allow you to select the features " "to install, the installation location and other options or post-install " "actions. To install debugging symbols or binaries, you will need to use this " "option." msgstr "" -"\"Customize installation\" を選択すると、インストール場所、その他オプションや" -"インストール後のアクションの変更などのインストールの有りようを選べます。デ" -"バッグシンボルやデバッグバイナリをインストールするならこちらを選択する必要が" -"あるでしょう。" +"\"Customize installation\" を選択すると、インストールする機能やインストール" +"先、ほかのオプション、インストール後の操作を選べます。\n" +"デバッグシンボルやデバッグバイナリをインストールするには、このオプションを使" +"う必要があります。" #: ../../using/windows.rst:1254 msgid "" @@ -2505,13 +2749,12 @@ msgstr "" msgid "AppendPath" msgstr "AppendPath" -#: ../../using/windows.rst:1356 msgid "" "Append install and Scripts directories to :envvar:`PATH` and add ``.PY`` " "to :envvar:`PATHEXT`" msgstr "" -":envvar:`PATH` にインストールディレクトリと Scripts ディレクトリを追加し、 :" -"envvar:`PATHEXT` に ``.PY`` を追加する。" +":envvar:`PATH` の末尾にインストールディレクトリと Scripts ディレクトリを追加" +"し、:envvar:`PATHEXT` に ``.PY`` を追加する。" #: ../../using/windows.rst:1360 msgid "Shortcuts" @@ -2649,9 +2892,8 @@ msgstr "" msgid "SimpleInstall" msgstr "SimpleInstall" -#: ../../using/windows.rst:1398 msgid "Disable most install UI" -msgstr "最大限のインストーラ GUI を無効にする。" +msgstr "インストール UI の大部分を無効にする。" #: ../../using/windows.rst:1400 msgid "SimpleInstallDescription" @@ -2661,17 +2903,15 @@ msgstr "SimpleInstallDescription" msgid "A custom message to display when the simplified install UI is used." msgstr "単純化されたインストーラ GUI を使う際に表示するカスタムメッセージ。" -#: ../../using/windows.rst:1404 msgid "" "For example, to silently install a default, system-wide Python installation, " "you could use the following command (from an elevated command prompt)::" msgstr "" -"例えばデフォルトでシステムワイドな Python インストレーションを静かに行うに" -"は、以下コマンドを使えます (コマンドプロンプトより)::" +"たとえば、デフォルトのシステム全体向けの Python をユーザの操作なしでインス" +"トールするには、管理者権限のコマンドプロンプトから次のコマンドを使えます。 ::" -#: ../../using/windows.rst:1407 msgid "python-3.9.0.exe /quiet InstallAllUsers=1 PrependPath=1 Include_test=0" -msgstr "" +msgstr "python-3.9.0.exe /quiet InstallAllUsers=1 PrependPath=1 Include_test=0" #: ../../using/windows.rst:1409 msgid "" @@ -2684,11 +2924,12 @@ msgstr "" "トーラの最初のページを単純化して表示し、また、カスタマイズできないようにしま" "す::" -#: ../../using/windows.rst:1413 msgid "" "python-3.9.0.exe InstallAllUsers=0 Include_launcher=0 Include_test=0\n" " SimpleInstall=1 SimpleInstallDescription=\"Just for me, no test suite.\"" msgstr "" +"python-3.9.0.exe InstallAllUsers=0 Include_launcher=0 Include_test=0\n" +" SimpleInstall=1 SimpleInstallDescription=\"Just for me, no test suite.\"" #: ../../using/windows.rst:1416 msgid "" @@ -2714,7 +2955,6 @@ msgstr "" "数値に変換されます。エレメントテキストで与える場合は常に文字列のままです。以" "下は、先の例と同じオプションをセットするファイルの実例です::" -#: ../../using/windows.rst:1426 msgid "" "\n" " " msgstr "" +"\n" +" " #: ../../using/windows.rst:1439 msgid "Installing Without Downloading" msgstr "ダウンロード不要なインストール" -#: ../../using/windows.rst:1441 msgid "" "As some features of Python are not included in the initial installer " "download, selecting those features may require an internet connection. To " @@ -2740,32 +2987,28 @@ msgid "" "be bigger than required, but where a large number of installations are going " "to be performed it is very useful to have a locally cached copy." msgstr "" -"Python のいくつかの機能は最初にダウンロードしたインストーラには含まれていない" -"ため、それらの機能をインストールしようと選択するとインターネット接続が必要に" -"なります。\n" -"インターネット接続が必要にならないように、全てのコンポーネントをすぐにできる" -"限りダウンロードして、完全な *配置構成 (layout)* を作成し、どんな機能が選択さ" -"れたかに関わらず、それ以上インターネット接続を必要がないようにします。\n" -"この方法のダウンロードサイズは必要以上に大きくなるかもしれませんが、たくさん" -"の回数インストールしようとする場合には、ローカルにキャッシュされたコピーを持" -"つことはとても有用です。" +"Python の一部の機能は最初にダウンロードするインストーラに含まれていないため、" +"それらを選択するとインターネット接続が必要になることがあります。\n" +"この接続を不要にするには、必要に応じて利用可能なすべてのコンポーネントをダウ" +"ンロードし、完全な *配置構成 (layout)* を作成できます。\n" +"これにより、選択した機能に関係なく、以後のインターネット接続が不要になりま" +"す。\n" +"このダウンロードは必要以上に大きくなるかもしれませんが、大量のインストールを" +"行う場合には、ローカルにキャッシュしたコピーがあると非常に便利です。" -#: ../../using/windows.rst:1449 msgid "" "Execute the following command from Command Prompt to download all possible " "required files. Remember to substitute ``python-3.9.0.exe`` for the actual " "name of your installer, and to create layouts in their own directories to " "avoid collisions between files with the same name." msgstr "" -"コマンドプロンプトから以下のコマンドを実行して、必要なファイルをできる限り全" -"てダウンロードします。\n" -"``python-3.9.0.exe`` 部分は実際のインストーラの名前に置き換え、同名のファイル" -"どうしの衝突が起こらないように、個別のディレクトリ内に配置構成を作るのを忘れ" -"ないようにしてください。" +"必要になる可能性のあるファイルをすべてダウンロードするには、コマンドプロンプ" +"トから次のコマンドを実行してください。\n" +"``python-3.9.0.exe`` は実際のインストーラの名前に置き換え、同名ファイルの衝突" +"を避けるため、配置構成はそれぞれ専用のディレクトリに作成してください。" -#: ../../using/windows.rst:1456 msgid "python-3.9.0.exe /layout [optional target directory]" -msgstr "" +msgstr "python-3.9.0.exe /layout [optional target directory]" #: ../../using/windows.rst:1458 msgid "" @@ -2808,22 +3051,23 @@ msgstr "" "\"Repair\" では、現在の設定で本来インストールされるべきすべてのファイルを検証" "し、削除されていたり更新されていたりするファイルを修正します。" -#: ../../using/windows.rst:1475 msgid "" "\"Uninstall\" will remove Python entirely, with the exception of the :ref:" "`launcher`, which has its own entry in Programs and Features." msgstr "" -"\"Uninstall\" は Python を完全に削除します。「プログラムと機能」内の自身のエ" -"ントリを持つ :ref:`launcher` の例外が起こります。" +"\"Uninstall\" は、:ref:`launcher` を除いて Python を完全に削除します。\n" +"ランチャには、「プログラムと機能」に独立したエントリがあります。" -#: ../../using/windows.rst:1489 msgid "" "To install pre-built binaries with free-threading enabled (see :pep:`703`), " "you should select \"Customize installation\". The second page of options " "includes the \"Download free-threaded binaries\" checkbox." msgstr "" +"フリースレッドが有効なビルド済みバイナリ (:pep:`703` を参照) をインストールす" +"るには、\"Customize installation\" を選択してください。\n" +"オプションの 2 ページ目に \"Download free-threaded binaries\" チェックボック" +"スがあります。" -#: ../../using/windows.rst:1495 msgid "" "Selecting this option will download and install additional binaries to the " "same location as the main Python install. The main executable is called " @@ -2831,8 +3075,13 @@ msgid "" "full ABI suffix. Python source files and bundled third-party dependencies " "are shared with the main install." msgstr "" +"このオプションを選択すると、メインの Python のインストールと同じ場所に追加の" +"バイナリをダウンロードしてインストールします。\n" +"メインの実行ファイルは ``python3.13t.exe`` という名前で、ほかのバイナリには " +"``t`` 接尾辞または完全な ABI 接尾辞が付きます。\n" +"Python のソースファイルや同梱のサードパーティの依存ライブラリは、メインのイン" +"ストールと共有します。" -#: ../../using/windows.rst:1501 msgid "" "The free-threaded version is registered as a regular Python install with the " "tag ``3.13t`` (with a ``-32`` or ``-arm64`` suffix as normal for those " @@ -2843,8 +3092,17 @@ msgid "" "-3.13`` will not. If you use the short style of option, you may prefer to " "not install the free-threaded binaries at this time." msgstr "" +"フリースレッド版は、タグ ``3.13t`` を持つ通常の Python インストールとして登録" +"されます (32 ビットや ARM64 のプラットフォームでは、通常どおり ``-32`` また" +"は ``-arm64`` 接尾辞が付きます)。\n" +"これにより、ツールがこのインストールを検出でき、:ref:`launcher` が ``py.exe " +"-3.13t`` をサポートできます。\n" +"ランチャは ``py.exe -3`` (または ``python3`` のシェバン) を「最新の 3.x のイ" +"ンストール」と解釈するため、通常のバイナリよりもフリースレッドバイナリを優先" +"しますが、``py.exe -3.13`` ではそうならない点に注意してください。\n" +"短い形式のオプションを使う場合は、現時点ではフリースレッドバイナリをインス" +"トールしない方がよいかもしれません。" -#: ../../using/windows.rst:1510 msgid "" "To specify the install option at the command line, use " "``Include_freethreaded=1``. See :ref:`install-layout-option` for " @@ -2852,23 +3110,31 @@ msgid "" "offline install. The options to include debug symbols and binaries also " "apply to the free-threaded builds." msgstr "" +"コマンドラインでインストールオプションを指定するには、" +"``Include_freethreaded=1`` を使ってください。\n" +"オフラインインストールに備えて追加のバイナリを事前にダウンロードする手順につ" +"いては、:ref:`install-layout-option` を参照してください。\n" +"デバッグシンボルやデバッグバイナリを含めるオプションは、フリースレッドビルド" +"にも適用されます。" -#: ../../using/windows.rst:1516 msgid "" "Free-threaded binaries are also available :ref:`on nuget.org `." msgstr "" +"フリースレッドバイナリは :ref:`nuget.org でも入手できます `。" #: ../../using/windows.rst:1520 msgid "Python Launcher for Windows (Deprecated)" msgstr "" -#: ../../using/windows.rst:1524 msgid "" "The launcher and this documentation have been superseded by the Python " "Install Manager described above. This is preserved temporarily for " "historical interest." msgstr "" +"このランチャとそのドキュメントは、前述の Python インストールマネージャに置き" +"換えられました。\n" +"歴史的な資料として、一時的に残しています。" #: ../../using/windows.rst:1530 msgid "" @@ -2918,9 +3184,8 @@ msgstr "" "いるのかは重要ではありません。ランチャーが使えるかを確認するには以下のコマン" "ドをコマンドプロンプトで実行してください::" -#: ../../using/windows.rst:1555 msgid "py" -msgstr "" +msgstr "py" #: ../../using/windows.rst:1557 msgid "" @@ -2942,9 +3207,8 @@ msgstr "" "る場合は、Python |version| が起動することになります。Python 3.7 を起動したい" "なら、次のコマンドを実行してみてください::" -#: ../../using/windows.rst:1565 msgid "py -3.7" -msgstr "" +msgstr "py -3.7" #: ../../using/windows.rst:1567 msgid "" @@ -2954,9 +3218,8 @@ msgstr "" "インストールしてある Python 2 の最新バージョンを起動したい場合は、次のコマン" "ドを実行してみてください::" -#: ../../using/windows.rst:1570 msgid "py -2" -msgstr "" +msgstr "py -2" #: ../../using/windows.rst:1572 msgid "" @@ -2964,25 +3227,24 @@ msgid "" msgstr "" "以下のようなエラーが出るようであれば、ランチャはインストールされていません::" -#: ../../using/windows.rst:1574 msgid "" "'py' is not recognized as an internal or external command,\n" "operable program or batch file." msgstr "" +"'py' is not recognized as an internal or external command,\n" +"operable program or batch file." #: ../../using/windows.rst:1577 msgid "The command::" msgstr "このコマンド::" -#: ../../using/windows.rst:1579 msgid "py --list" -msgstr "" +msgstr "py --list" #: ../../using/windows.rst:1581 msgid "displays the currently installed version(s) of Python." msgstr "これは、現在インストールされている Python のバージョンを表示します。" -#: ../../using/windows.rst:1583 msgid "" "The ``-x.y`` argument is the short form of the ``-V:Company/Tag`` argument, " "which allows selecting a specific Python runtime, including those that may " @@ -2990,15 +3252,22 @@ msgid "" "following :pep:`514` will be discoverable. The ``--list`` command lists all " "available runtimes using the ``-V:`` format." msgstr "" +"``-x.y`` 引数は ``-V:Company/Tag`` 引数の短縮形です。\n" +"後者の引数では、python.org 以外から入手したものも含め、特定の Python ランタイ" +"ムを選択できます。\n" +":pep:`514` に従って登録されたランタイムはすべて検出できます。\n" +"``--list`` コマンドは、利用可能なすべてのランタイムを ``-V:`` 形式で一覧表示" +"します。" -#: ../../using/windows.rst:1589 msgid "" "When using the ``-V:`` argument, specifying the Company will limit selection " "to runtimes from that provider, while specifying only the Tag will select " "from all providers. Note that omitting the slash implies a tag::" msgstr "" +"``-V:`` 引数を使う場合、Company を指定すると、その提供元のランタイムだけが選" +"択対象になり、Tag だけを指定するとすべての提供元から選択します。\n" +"スラッシュを省略するとタグとして解釈される点に注意してください。 ::" -#: ../../using/windows.rst:1593 msgid "" "# Select any '3.*' tagged runtime\n" "py -V:3\n" @@ -3009,15 +3278,24 @@ msgid "" "# Select PythonCore's latest Python 3 runtime\n" "py -V:PythonCore/3" msgstr "" +"# タグが '3.*' の任意のランタイムを選択\n" +"py -V:3\n" +"\n" +"# 'PythonCore' がリリースした任意のランタイムを選択\n" +"py -V:PythonCore/\n" +"\n" +"# PythonCore の最新の Python 3 ランタイムを選択\n" +"py -V:PythonCore/3" -#: ../../using/windows.rst:1602 msgid "" "The short form of the argument (``-3``) only ever selects from core Python " "releases, and not other distributions. However, the longer form (``-V:3``) " "will select from any." msgstr "" +"引数の短縮形 (``-3``) は、常にコア Python のリリースだけを選択対象とし、ほか" +"のディストリビューションからは選択しません。\n" +"一方、長い形式 (``-V:3``) はすべてを選択対象とします。" -#: ../../using/windows.rst:1606 msgid "" "The Company is matched on the full string, case-insensitive. The Tag is " "matched on either the full string, or a prefix, provided the next character " @@ -3025,12 +3303,18 @@ msgid "" "``3.10``. Tags are sorted using numerical ordering (``3.10`` is newer than " "``3.1``), but are compared using text (``-V:3.01`` does not match ``3.1``)." msgstr "" +"Company は、大文字・小文字を区別せずに文字列全体を照合します。\n" +"Tag は、文字列全体、またはその次の文字がドットかハイフンである接頭辞と照合し" +"ます。\n" +"これにより ``-V:3.1`` は ``3.1-32`` に一致しますが、``3.10`` には一致しませ" +"ん。\n" +"タグの並べ替えは数値順 (``3.10`` は ``3.1`` より新しい) で行いますが、比較は" +"文字列として行います (``-V:3.01`` は ``3.1`` に一致しません)。" #: ../../using/windows.rst:1614 msgid "Virtual environments" msgstr "仮想環境 (Virtual environments)" -#: ../../using/windows.rst:1618 msgid "" "If the launcher is run with no explicit Python version specification, and a " "virtual environment (created with the standard library :mod:`venv` module or " @@ -3039,12 +3323,12 @@ msgid "" "interpreter, either deactivate the virtual environment, or explicitly " "specify the global Python version." msgstr "" -"(標準ライブラリの :mod:`venv` モジュールか外部ツール ``virtualenv`` で作っ" -"た) 仮想環境がアクティブな状態で Python の明示的なバージョンを指定せずにラン" -"チャを起動すると、ランチャはグローバルなインタプリタではなくその仮想環境のも" -"のを実行します。グローバルなほうのインタプリタを実行するには、仮想環境の動作" -"を停止するか、または明示的にグローバルな Python バージョンを指定してくださ" -"い。" +"Python のバージョンを明示的に指定せずにランチャを実行し、仮想環境 (標準ライブ" +"ラリの :mod:`venv` モジュールや外部ツール ``virtualenv`` で作成したもの) がア" +"クティブな場合は、グローバルなインタープリタではなく、その仮想環境のインター" +"プリタを実行します。\n" +"グローバルなインタープリタを実行するには、仮想環境を非アクティブにするか、グ" +"ローバルな Python のバージョンを明示的に指定してください。" #: ../../using/windows.rst:1626 msgid "From a script" @@ -3058,20 +3342,21 @@ msgstr "" "テスト用の Python スクリプトを作成しましょう。``hello.py`` という名前で以下の" "内容のファイルを作成してください" -#: ../../using/windows.rst:1631 msgid "" "#! python\n" "import sys\n" "sys.stdout.write(\"hello from Python %s\\n\" % (sys.version,))" msgstr "" +"#! python\n" +"import sys\n" +"sys.stdout.write(\"hello from Python %s\\n\" % (sys.version,))" #: ../../using/windows.rst:1637 msgid "From the directory in which hello.py lives, execute the command::" msgstr "hello.py が存在するディレクトリで、下記コマンドを実行してください::" -#: ../../using/windows.rst:1639 msgid "py hello.py" -msgstr "" +msgstr "py hello.py" #: ../../using/windows.rst:1641 msgid "" @@ -3081,9 +3366,8 @@ msgstr "" "インストールされている最新の Python 2.x のバージョン番号が表示されるはずで" "す。では、1行目を以下のように変更してみてください:" -#: ../../using/windows.rst:1644 msgid "#! python3" -msgstr "" +msgstr "#! python3" #: ../../using/windows.rst:1648 msgid "" @@ -3157,15 +3441,15 @@ msgstr "" "Windows の Python ランチャは、Windows 上の Python スクリプトが同じ機能を使用" "できるようにし、上の例ではそれらの機能の使用法を示しています。" -#: ../../using/windows.rst:1681 msgid "" "To allow shebang lines in Python scripts to be portable between Unix and " "Windows, this launcher supports a number of 'virtual' commands to specify " "which interpreter to use. The supported virtual commands are:" msgstr "" -"Python スクリプトのシェバン行を Unix-Windows 間で移植可能にするため、このラン" -"チャは、どのインタプリタが使われるかを指定するための大量の '仮想' コマンドを" -"サポートしています。サポートされる仮想コマンドには以下のものがあります:" +"Python スクリプトのシェバン行を Unix と Windows の間で移植できるように、この" +"ランチャは、使用するインタープリタを指定するためのいくつかの「仮想」コマンド" +"をサポートしています。\n" +"サポートする仮想コマンドは次のとおりです:" #: ../../using/windows.rst:1685 msgid "``/usr/bin/env``" @@ -3211,20 +3495,26 @@ msgstr "" "さらに、マイナーバージョン無しのメジャーバージョンとアーキテクチャだけ (例え" "ば、 ``/usr/bin/python3-64``) で指定できます。" -#: ../../using/windows.rst:1717 msgid "" "The \"-64\" suffix is deprecated, and now implies \"any architecture that is " "not provably i386/32-bit\". To request a specific environment, use the new :" "samp:`-V:{TAG}` argument with the complete tag." msgstr "" +"\"-64\" 接尾辞は非推奨で、現在は「i386/32 ビットであると確認できない任意の" +"アーキテクチャ」を意味します。\n" +"特定の環境を要求するには、新しい :samp:`-V:{TAG}` 引数に完全なタグを指定して" +"ください。" -#: ../../using/windows.rst:1723 msgid "" "Virtual commands referencing ``python`` now prefer an active virtual " "environment rather than searching :envvar:`PATH`. This handles cases where " "the shebang specifies ``/usr/bin/env python3`` but :file:`python3.exe` is " "not present in the active environment." msgstr "" +"``python`` を参照する仮想コマンドは、:envvar:`PATH` を検索するよりも、アク" +"ティブな仮想環境を優先するようになりました。\n" +"これは、シェバンで ``/usr/bin/env python3`` を指定しているのに、アクティブな" +"環境に :file:`python3.exe` がない場合に対応するためです。" #: ../../using/windows.rst:1728 msgid "" @@ -3240,7 +3530,6 @@ msgid "" "of :envvar:`PATH`." msgstr "" -#: ../../using/windows.rst:1739 msgid "" "Shebang lines that do not match any of these patterns are looked up in the " "``[commands]`` section of the launcher's :ref:`.INI file `. " @@ -3250,14 +3539,20 @@ msgid "" "executable (additional arguments specified in the .INI will be quoted as " "part of the filename)." msgstr "" +"これらのどのパターンにも一致しないシェバン行は、ランチャの :ref:`.INI ファイ" +"ル ` の ``[commands]`` 節で検索します。\n" +"これを使うと、特定のコマンドをシステムに適した方法で処理できます。\n" +"コマンド名は 1 つの引数でなければならず (シェバン内の実行ファイル名にスペース" +"は使えません)、置換する値は実行ファイルのフルパスです (.INI 内に追加の引数を" +"指定すると、ファイル名の一部として引用符で囲まれます)。" -#: ../../using/windows.rst:1747 msgid "" "[commands]\n" "/bin/xpython=C:\\Program Files\\XPython\\python.exe" msgstr "" +"[commands]\n" +"/bin/xpython=C:\\Program Files\\XPython\\python.exe" -#: ../../using/windows.rst:1752 msgid "" "Any commands not found in the .INI file are treated as **Windows** " "executable paths that are absolute or relative to the directory containing " @@ -3267,6 +3562,13 @@ msgid "" "arguments, after which the path to the script and any additional arguments " "will be appended." msgstr "" +".INI ファイルに見つからないコマンドは、絶対パス、またはスクリプトファイルがあ" +"るディレクトリからの相対パスで表した **Windows** 実行ファイルのパスとして扱い" +"ます。\n" +"この動作は Unix 形式のシェルとは互換性がないため、インストーラが生成するスク" +"リプトなど、Windows 専用のスクリプトのための便宜的な機能です。\n" +"これらのパスは引用符で囲むことができ、複数の引数を含めることもできます。\n" +"その後ろにスクリプトのパスと追加の引数を付け加えます。" #: ../../using/windows.rst:1761 msgid "Arguments in shebang lines" @@ -3280,9 +3582,8 @@ msgstr "" "シェバン行では Python インタプリタに渡される追加の引数を指定することもできま" "す。たとえば、シェバン行に以下のように書かれているとしましょう:" -#: ../../using/windows.rst:1766 msgid "#! /usr/bin/python -v" -msgstr "" +msgstr "#! /usr/bin/python -v" #: ../../using/windows.rst:1770 msgid "Then Python will be started with the ``-v`` option" @@ -3482,11 +3783,12 @@ msgstr "" "``PY_PYTHON=3.7`` と設定することは、INI ファイルに下記が含まれることと等価で" "す:" -#: ../../using/windows.rst:1859 msgid "" "[defaults]\n" "python=3.7" msgstr "" +"[defaults]\n" +"python=3.7" #: ../../using/windows.rst:1864 msgid "" @@ -3496,12 +3798,14 @@ msgstr "" "``PY_PYTHON=3`` と ``PY_PYTHON3=3.7`` を設定することは、INI ファイルに下記が" "含まれることと等価です:" -#: ../../using/windows.rst:1867 msgid "" "[defaults]\n" "python=3\n" "python3=3.7" msgstr "" +"[defaults]\n" +"python=3\n" +"python3=3.7" #: ../../using/windows.rst:1874 msgid "Diagnostics" @@ -3537,9 +3841,8 @@ msgid "" "correctly in the console." msgstr "" -#: ../../using/windows.rst:1894 msgid "Install on demand" -msgstr "" +msgstr "必要に応じたインストール" #: ../../using/windows.rst:1896 msgid "" @@ -3558,23 +3861,26 @@ msgid "" "`PYLAUNCHER_DRYRUN`)." msgstr "" -#: ../../using/windows.rst:1906 msgid "Return codes" -msgstr "" +msgstr "戻りコード" -#: ../../using/windows.rst:1908 msgid "" "The following exit codes may be returned by the Python launcher. " "Unfortunately, there is no way to distinguish these from the exit code of " "Python itself." msgstr "" +"Python ランチャは、次の終了コードを返すことがあります。\n" +"残念ながら、これらを Python 自体の終了コードと区別する方法はありません。" -#: ../../using/windows.rst:1911 msgid "" "The names of codes are as used in the sources, and are only for reference. " "There is no way to access or resolve them apart from reading this page. " "Entries are listed in alphabetical order of names." msgstr "" +"コードの名前はソース内で使われているもので、参考として記載しています。\n" +"このページを読む以外に、これらの名前にアクセスしたり、対応する値を取得したり" +"する方法はありません。\n" +"エントリは名前のアルファベット順に記載しています。" #: ../../using/windows.rst:1916 msgid "Value" @@ -3588,9 +3894,8 @@ msgstr "RC_BAD_VENV_CFG" msgid "107" msgstr "107" -#: ../../using/windows.rst:1918 msgid "A :file:`pyvenv.cfg` was found but is corrupt." -msgstr "" +msgstr ":file:`pyvenv.cfg` が見つかりましたが、壊れています。" #: ../../using/windows.rst:1920 msgid "RC_CREATE_PROCESS" @@ -3600,9 +3905,8 @@ msgstr "RC_CREATE_PROCESS" msgid "101" msgstr "101" -#: ../../using/windows.rst:1920 msgid "Failed to launch Python." -msgstr "" +msgstr "Python の起動に失敗しました。" #: ../../using/windows.rst:1922 msgid "RC_INSTALLING" @@ -3612,11 +3916,11 @@ msgstr "RC_INSTALLING" msgid "111" msgstr "111" -#: ../../using/windows.rst:1922 msgid "" "An install was started, but the command will need to be re-run after it " "completes." msgstr "" +"インストールが開始されましたが、完了後にコマンドを再実行する必要があります。" #: ../../using/windows.rst:1925 msgid "RC_INTERNAL_ERROR" @@ -3626,9 +3930,10 @@ msgstr "RC_INTERNAL_ERROR" msgid "109" msgstr "109" -#: ../../using/windows.rst:1925 msgid "Unexpected error. Please report a bug." msgstr "" +"予期しないエラーです。\n" +"バグを報告してください。" #: ../../using/windows.rst:1927 msgid "RC_NO_COMMANDLINE" @@ -3638,9 +3943,8 @@ msgstr "RC_NO_COMMANDLINE" msgid "108" msgstr "108" -#: ../../using/windows.rst:1927 msgid "Unable to obtain command line from the operating system." -msgstr "" +msgstr "オペレーティングシステムからコマンドラインを取得できません。" #: ../../using/windows.rst:1930 msgid "RC_NO_PYTHON" @@ -3650,9 +3954,8 @@ msgstr "RC_NO_PYTHON" msgid "103" msgstr "103" -#: ../../using/windows.rst:1930 msgid "Unable to locate the requested version." -msgstr "" +msgstr "要求されたバージョンが見つかりません。" #: ../../using/windows.rst:1932 msgid "RC_NO_VENV_CFG" @@ -3662,6 +3965,5 @@ msgstr "RC_NO_VENV_CFG" msgid "106" msgstr "106" -#: ../../using/windows.rst:1932 msgid "A :file:`pyvenv.cfg` was required but not found." -msgstr "" +msgstr ":file:`pyvenv.cfg` が必要ですが、見つかりませんでした。" diff --git a/whatsnew/2.0.po b/whatsnew/2.0.po index b1e6fc34d..89ffe4207 100644 --- a/whatsnew/2.0.po +++ b/whatsnew/2.0.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: Taichi Haradaguchi, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../whatsnew/2.0.rst:3 @@ -351,11 +351,11 @@ msgid "" "installation by calling the ``sys.setdefaultencoding(encoding)`` function in " "a customized version of :file:`site.py`." msgstr "" -"Unicode 文字列は普通の文字列と全く似ていて、 :term:`immutable` なシーケンス型" -"です。添え字でアクセス出来、スライス出来ますが、インプレイスに変更することは" -"出来ません。Unicode 文字列は ``encode( [encoding] )`` メソッドを持っていて、" -"これは望みのエンコーディングでエンコードした 8 ビット文字列を返します。エン" -"コーディングは文字列で名前付けられていて、例えば ``'ascii'``, ``'utf-8'``, " +"Unicode 文字列は普通の文字列と全く似ていて、 immutable なシーケンス型です。添" +"え字でアクセス出来、スライス出来ますが、インプレイスに変更することは出来ませ" +"ん。Unicode 文字列は ``encode( [encoding] )`` メソッドを持っていて、これは望" +"みのエンコーディングでエンコードした 8 ビット文字列を返します。エンコーディン" +"グは文字列で名前付けられていて、例えば ``'ascii'``, ``'utf-8'``, " "``'iso-8859-1'`` のようなものです。コーデック API は、新しいエンコーディング" "を実装し、Python プログラム全体を通して利用可能となるよう登録するために定義さ" "れています。エンコーディングが指定されない場合はデフォルトのエンコーディング" @@ -643,7 +643,7 @@ msgstr "" "シーケンス群は同じ長さである必要はありません。それらは並列でイテレートされる " "*のではなく* 左から右の順で周ります。続くパラグラフでもっとわかりやすく説明し" "ます。生成されるリストの要素は一連の *expression* の値となります。最後の :" -"keyword:`if` 節はオプショナルです。これがあれば *expression* は *condition* " +"keyword:`!if` 節はオプショナルです。これがあれば *expression* は *condition* " "が真の場合にのみ評価・追加されます。" #: ../../whatsnew/2.0.rst:307 @@ -819,8 +819,8 @@ msgid "" "operate." msgstr "" "変わらない一つのこと、華やかなエイプリルフールのジョークではありませんが、そ" -"れは Python 文字列が :term:`immutable` だということです。ですので文字列メソッ" -"ドは新しい文字列を返し、それが操作する文字列を変更しません。" +"れは Python 文字列が immutable だということです。ですので文字列メソッドは新し" +"い文字列を返し、それが操作する文字列を変更しません。" #: ../../whatsnew/2.0.rst:415 msgid "" @@ -2060,9 +2060,9 @@ msgid "" "M. Kuchling.)" msgstr "" ":mod:`mmap`: Windows、Unix 両方でのメモリマップドファイルへのインターフェイス" -"です。ファイル内容をメモリに直接マッピング出来、それは :term:`mutable` な文字" -"列であるかのように振る舞い、これにより読み書き出来ます。それらは例えば :mod:" -"`re` モジュールのような普通は文字列を期待するような関数にさえも渡せます。" +"です。ファイル内容をメモリに直接マッピング出来、それは mutable な文字列である" +"かのように振る舞い、これにより読み書き出来ます。それらは例えば :mod:`re` モ" +"ジュールのような普通は文字列を期待するような関数にさえも渡せます。" "(Contributed by Sam Rushing, with some extensions by A.M. Kuchling.)" #: ../../whatsnew/2.0.rst:1109 diff --git a/whatsnew/2.1.po b/whatsnew/2.1.po index ce73012b9..383901f5d 100644 --- a/whatsnew/2.1.po +++ b/whatsnew/2.1.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: souma987, 2023\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../whatsnew/2.1.rst:3 @@ -297,9 +297,8 @@ msgstr "" "を生成する方法に影響しますので、生成されるバイトコードとなるステートメントの" "前になくてはならないのです。" -#: ../../whatsnew/2.1.rst:153 msgid ":pep:`236` - Back to the :mod:`__future__`" -msgstr ":pep:`236` - バック・トゥ・ザ・ :mod:`__future__` " +msgstr ":pep:`236` - バック・トゥ・ザ・ :mod:`__future__`" #: ../../whatsnew/2.1.rst:154 msgid "Written by Tim Peters, and primarily implemented by Jeremy Hylton." @@ -988,7 +987,6 @@ msgstr "" msgid "PEP 241: Metadata in Python Packages" msgstr "PEP 241: Pythonソフトウェアパッケージのためのメタデータ" -#: ../../whatsnew/2.1.rst:544 msgid "" "A common complaint from Python users is that there's no single catalog of " "all the Python modules in existence. T. Middleton's Vaults of Parnassus at " @@ -1000,7 +998,7 @@ msgid "" msgstr "" "Python ユーザーからのよくある苦情としては、存在するすべての Python モジュール" "の一覧がないということです。T. Middleton's の ``www.vex.net/parnassus/`` に" -"あった Vaults of Parnassus (2009年2月に停止、Internet Archive Wayback " +"あった Vaults of Parnassus (2009年2月に停止、`Internet Archive Wayback " "Machine `_ で閲覧可) が最大のものでしたが、ソフトウェアの登録は任意だった" "ため、多くの人は登録しませんでした。" diff --git a/whatsnew/2.2.po b/whatsnew/2.2.po index 2d3c23904..d08254793 100644 --- a/whatsnew/2.2.po +++ b/whatsnew/2.2.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: Taichi Haradaguchi, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../whatsnew/2.2.rst:3 @@ -895,12 +895,14 @@ msgstr "" "で :meth:`readline` を呼び出すもので、つまりファイルを行ごとに読み出すのにこ" "のように書けるわけです::" -#: ../../whatsnew/2.2.rst:523 msgid "" "for line in file:\n" " # do something for each line\n" " ..." msgstr "" +"for line in file:\n" +" # 各行について処理する\n" +" ..." #: ../../whatsnew/2.2.rst:527 msgid "" @@ -1004,20 +1006,19 @@ msgid "" "explanation of the interaction between :keyword:`!yield` and exceptions.)" msgstr "" "ジェネレータ関数を呼び出すと、単一の値の代わりにイテレータプロトコルに対応し" -"たオブジェクトを返します。上の例で :keyword:`!yield` を実行したとき、ジェネ" -"レータは :keyword:`!return` 文のようにして ``i`` の値を生成します。 " -"``yield`` と ``return`` 文の大きな違いは、 ``yield`` に到達した段階でジェネ" -"レータの実行状態が一時停止になって、ローカル変数が保存される点です。次回その" -"ジェネレータの ``.next()`` メソッドを呼ぶと、 :keyword:`!yield` の直後から関" -"数が実行を再開します。(複雑な理由により、 :keyword:`!yield` は :keyword:`!" -"try`...\\ :keyword:`finally` の :keyword:`!try` ブロック内に含めることは許さ" -"れていません; :pep:`255` に :keyword:`!yield` と例外の相互作用についての詳細" -"説明がありますので参照して下さい。) --- (---訳注: Python 2.5 の PEP 342 で :" -"keyword:`try`...\\ :keyword:`finally` 内に置けないという制約はなくなりまし" -"た。また、 :keyword:`try`...\\ :keyword:`finally` の :keyword:`try` 、とここ" -"であえて特定しているのは、同じく 2.5 の PEP 341 によって try/except/finally " -"の一体化されるまでは、 ``finally`` の ``try`` と ``except`` の ``try`` が別物" -"だったからです。---)" +"たオブジェクトを返します。上の例で :keyword:`yield` を実行したとき、ジェネ" +"レータは :keyword:`return` 文のようにして ``i`` の値を生成します。 ``yield`` " +"と ``return`` 文の大きな違いは、 ``yield`` に到達した段階でジェネレータの実行" +"状態が一時停止になって、ローカル変数が保存される点です。次回そのジェネレータ" +"の ``.next()`` メソッドを呼ぶと、 :keyword:`!yield` の直後から関数が実行を再" +"開します。(複雑な理由により、 :keyword:`!yield` は :keyword:`!try`...\\ :" +"keyword:`finally` の :keyword:`!try` ブロック内に含めることは許されていませ" +"ん; :pep:`255` に :keyword:`!yield` と例外の相互作用についての詳細説明があり" +"ますので参照して下さい。) --- (---訳注: Python 2.5 の PEP 342 で :keyword:" +"`try`...\\ ``finally`` 内に置けないという制約はなくなりました。また、 " +"``try``...\\ ``finally`` の ``try`` 、とここであえて特定しているのは、同じく " +"2.5 の PEP 341 によって try/except/finally の一体化されるまでは、 " +"``finally`` の ``try`` と ``except`` の ``try`` が別物だったからです。---)" #: ../../whatsnew/2.2.rst:584 msgid "Here's a sample usage of the :func:`!generate_ints` generator::" diff --git a/whatsnew/2.3.po b/whatsnew/2.3.po index 86b8a7ba9..f2b9f22fd 100644 --- a/whatsnew/2.3.po +++ b/whatsnew/2.3.po @@ -20,10 +20,10 @@ msgstr "" "Last-Translator: Taichi Haradaguchi, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../whatsnew/2.3.rst:3 @@ -115,11 +115,10 @@ msgstr "" "えられ、2.6 では非推奨となり、3.0 では削除されています。ので、集合型について" "知りたければここよりも 2.4 のビルトインの方から読んだ方が良いです。---) --- " "新しいモジュール :mod:`!sets` には、集合データ型の実装が含まれています。 :" -"class:`Set` クラスは :term:`mutable` の集合のためのクラスで、メンバの追加と削" -"除が出来ます。 :class:`!ImmutableSet` は変更できない集合のためのクラスなの" -"で、:class:`!ImmutableSet` のインスタンスを辞書のキーとして利用出来ます。集合" -"型は辞書の上に構築されているので、集合内の要素はハッシュ可能でなければなりま" -"せん。" +"class:`Set` クラスは mutable の集合のためのクラスで、メンバの追加と削除が出来" +"ます。 :class:`!ImmutableSet` は変更できない集合のためのクラスなので、:class:" +"`!ImmutableSet` のインスタンスを辞書のキーとして利用出来ます。集合型は辞書の" +"上に構築されているので、集合内の要素はハッシュ可能でなければなりません。" #: ../../whatsnew/2.3.rst:50 msgid "Here's a simple example::" @@ -316,20 +315,19 @@ msgid "" "explanation of the interaction between :keyword:`!yield` and exceptions.)" msgstr "" "ジェネレータ関数を呼び出すと、単一の値の代わりにイテレータプロトコルに対応し" -"たオブジェクトを返します。上の例で :keyword:`!yield` を実行したとき、ジェネ" -"レータは :keyword:`!return` 文のようにして ``i`` の値を生成します。 " -"``yield`` と ``return`` 文の大きな違いは、 ``yield`` に到達した段階でジェネ" -"レータの実行状態が一時停止になって、ローカル変数が保存される点です。次回その" -"ジェネレータの ``.next()`` メソッドを呼ぶと、 :keyword:`!yield` の直後から関" -"数が実行を再開します。(複雑な理由により、 :keyword:`!yield` は :keyword:`!" -"try`...\\ :keyword:`finally` の :keyword:`!try` ブロック内に含めることは許さ" -"れていません; :pep:`255` に :keyword:`!yield` と例外の相互作用についての詳細" -"説明がありますので参照して下さい。) --- (---訳注: Python 2.5 の PEP 342 で :" -"keyword:`try`...\\ :keyword:`finally` 内に置けないという制約はなくなりまし" -"た。また、 :keyword:`try`...\\ :keyword:`finally` の :keyword:`try` 、とここ" -"であえて特定しているのは、同じく 2.5 の PEP 341 によって try/except/finally " -"の一体化されるまでは、 ``finally`` の ``try`` と ``except`` の ``try`` が別物" -"だったからです。---)" +"たオブジェクトを返します。上の例で :keyword:`yield` を実行したとき、ジェネ" +"レータは :keyword:`return` 文のようにして ``i`` の値を生成します。 ``yield`` " +"と ``return`` 文の大きな違いは、 ``yield`` に到達した段階でジェネレータの実行" +"状態が一時停止になって、ローカル変数が保存される点です。次回そのジェネレータ" +"の ``.next()`` メソッドを呼ぶと、 :keyword:`!yield` の直後から関数が実行を再" +"開します。(複雑な理由により、 :keyword:`!yield` は :keyword:`!try`...\\ " +"``finally`` の :keyword:`!try` ブロック内に含めることは許されていません; :" +"pep:`255` に :keyword:`!yield` と例外の相互作用についての詳細説明がありますの" +"で参照して下さい。) --- (---訳注: Python 2.5 の PEP 342 で :keyword:`try`..." +"\\ ``finally`` 内に置けないという制約はなくなりました。また、 ``try``...\\ " +"``finally`` の ``try`` 、とここであえて特定しているのは、同じく 2.5 の PEP " +"341 によって try/except/finally の一体化されるまでは、 ``finally`` の " +"``try`` と ``except`` の ``try`` が別物だったからです。---)" #: ../../whatsnew/2.3.rst:169 msgid "Here's a sample usage of the :func:`!generate_ints` generator::" @@ -575,9 +573,9 @@ msgid "" "path``. For example:" msgstr "" "新たなモジュール :mod:`zipimport` が、ZIP フォーマットの書庫からモジュールの" -"インポートをサポートします。 :mod:`zipimport` を明示的にインポートする必要は" -"ありません; ``sys.path`` に ZIP 形式書庫が追加されるとそれは自動的にインポー" -"トされます。例えば::" +"インポートをサポートします。 ``zipimport`` を明示的にインポートする必要はあり" +"ません; ``sys.path`` に ZIP 形式書庫が追加されるとそれは自動的にインポートさ" +"れます。例えば::" #: ../../whatsnew/2.3.rst:296 msgid "" @@ -668,11 +666,11 @@ msgstr "" "Python はいまや (ファイルシステムの制約の範囲内での) 任意の Unicode 文字列" "を :func:`open` 組み込み関数をはじめとするファイル名が期待される全ての関数で" "許容します。 :func:`os.listdir` に Unicode 文字列が渡されれば、Python は今で" -"は Unicode 文字列のリストを返します。新しい関数 :func:`os.getcwdu` は " +"は Unicode 文字列のリストを返します。新しい関数 :func:`!os.getcwdu` は " "Unicode 文字列でカレントディレクトリを返します(訳注: ちなみに Python 3 での " "Unicode 周りの大改造に伴いこの関数はなくなり、代わりに「あえてバイト列のほう" -"を返す」 が追加されています(:func:`!os.getcwdu` がもはや Unicode を返すの" -"で)。)。" +"を返す」 ``os.getcwdb()`` が追加されています(``os.getcwd()`` が Unicode を返" +"すので)。)。" #: ../../whatsnew/2.3.rst:350 msgid "" @@ -892,12 +890,14 @@ msgstr "" msgid "This produces the following output::" msgstr "これは以下のような出力をします::" -#: ../../whatsnew/2.3.rst:477 msgid "" "WARNING:root:Warning:config file server.conf not found\n" "ERROR:root:Error occurred\n" "CRITICAL:root:Critical error -- shutting down" msgstr "" +"WARNING:root:Warning:config file server.conf not found\n" +"ERROR:root:Error occurred\n" +"CRITICAL:root:Critical error -- shutting down" #: ../../whatsnew/2.3.rst:481 msgid "" @@ -1527,9 +1527,8 @@ msgstr "" msgid ":pep:`307` - Extensions to the pickle protocol" msgstr ":pep:`307` - pickle プロトコルの拡張" -#: ../../whatsnew/2.3.rst:850 msgid "Written and implemented by Guido van Rossum and Tim Peters." -msgstr "著、実装: Guido van Rossum と Tim Peters " +msgstr "著、実装: Guido van Rossum と Tim Peters" #: ../../whatsnew/2.3.rst:858 msgid "Extended Slices" @@ -1598,12 +1597,11 @@ msgid "" "assignment to extended and regular slices. Assignment to a regular slice " "can be used to change the length of the sequence::" msgstr "" -"リストや配列のような :term:`mutable` なシーケンスに対して、拡張スライスを代入" -"や削除に使えますが、拡張スライスと普通のスライスではいくつかの違いがありま" -"す。普通のスライスで代入を行えば、シーケンスの長さを変更出来ます (---訳注: 念" -"のため。Python 3 の range は list を直接返す関数ではなくジェネレータなので、" -"以下例は ``a = list(range(3))`` などとしないと動作しません。続く例でも同じで" -"す。---)::" +"リストや配列のような mutable なシーケンスに対して、拡張スライスを代入や削除に" +"使えますが、拡張スライスと普通のスライスではいくつかの違いがあります。普通の" +"スライスで代入を行えば、シーケンスの長さを変更出来ます (---訳注: 念のため。" +"Python 3 の range は list を直接返す関数ではなくジェネレータなので、以下例は " +"``a = list(range(3))`` などとしないと動作しません。続く例でも同じです。---)::" #: ../../whatsnew/2.3.rst:893 msgid "" @@ -3056,8 +3054,8 @@ msgid "" "Once created, instances of the date/time classes are all immutable. There " "are a number of methods for producing formatted strings from objects::" msgstr "" -"構築後の日付時刻クラスのインスタンスは全て :term:`immutable` です。オブジェク" -"トから書式文字列を生成する数多くのメソッドがあります::" +"構築後の日付時刻クラスのインスタンスは全て immutable です。オブジェクトから書" +"式文字列を生成する数多くのメソッドがあります::" #: ../../whatsnew/2.3.rst:1701 msgid "" @@ -3099,15 +3097,14 @@ msgid "" "`~datetime.datetime`." msgstr "" "インスタンスは比較可能で、ハッシュ出来、文字列に変換出来ます (結果は :meth:" -"`~datetime.datetime.isoformat` メソッドのものと同じです)。 と :class:" -"`~datetime.datetime` はお互いに減算演算が可能で、 :class:`~datetime." -"timedelta` インスタンスを加算することも出来ます。最も大きな不足機能としては、" -"文字列を解析して :class:`~datetime.date` や :class:`~datetime.datetime` へ戻" -"すための標準ライブラリサポートはありません。(---訳注: 2 点。「比較可能」の意" -"味は 2.3 から 2.4 で意味が変わっています。2.4 で :class:`~datetime.date` と :" -"class:`~datetime.datetime` の比較は出来なくなりました。2.3 では出来ていまし" -"た。文字列からの :class:`~datetime.datetime` 構築は 2.5 で :meth:`~datetime." -"strptime` が追加されています。---)" +"`~datetime.datetime.isoformat` メソッドのものと同じです)。 :class:`~datetime." +"date` と :class:`~datetime.datetime` はお互いに減算演算が可能で、 :class:" +"`~datetime.timedelta` インスタンスを加算することも出来ます。最も大きな不足機" +"能としては、文字列を解析して :class:`~datetime.date` や :class:`~datetime." +"datetime` へ戻すための標準ライブラリサポートはありません。(---訳注: 2 点。" +"「比較可能」の意味は 2.3 から 2.4 で意味が変わっています。2.4 で ``date`` と " +"``datetime`` の比較は出来なくなりました。2.3 では出来ていました。文字列から" +"の ``datetime`` 構築は 2.5 で ``strptime()`` が追加されています。---)" #: ../../whatsnew/2.3.rst:1727 msgid "" @@ -3133,8 +3130,8 @@ msgstr "" "規に追加された :mod:`optparse` モジュール (元々 Optik と呼ばれていたもので" "す) は Unix の慣習に従ったもっと念入りなコマンドライン解析を行い、自動的に :" "option:`!--help` のための出力をし、異なったオプションに対して異なったアクショ" -"ンを実行出来ます。 (---訳注: 2.7 以降は :mod:`optparse` よりも新しい :mod:" -"`argparse` を使ってください。---)" +"ンを実行出来ます。 (---訳注: 2.7 以降は ``optparse`` よりも新しい " +"``argparse`` を使ってください。---)" #: ../../whatsnew/2.3.rst:1742 msgid "" diff --git a/whatsnew/2.4.po b/whatsnew/2.4.po index ded9ae059..4eebd8bb3 100644 --- a/whatsnew/2.4.po +++ b/whatsnew/2.4.po @@ -17,10 +17,10 @@ msgstr "" "Last-Translator: tomo, 2023\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../whatsnew/2.4.rst:3 @@ -35,13 +35,12 @@ msgstr "著者" msgid "A.M. Kuchling" msgstr "A.M. Kuchling" -#: ../../whatsnew/2.4.rst:14 msgid "" "This article explains the new features in Python 2.4.1, released on March " "30, 2005." msgstr "" "この文書は 2005 年 3 月 30 日にリリースされた Python 2.4.1 の新機能について解" -"説します。 " +"説します。" #: ../../whatsnew/2.4.rst:17 msgid "" @@ -135,8 +134,8 @@ msgid "" "is immutable and hashable, it may be used as a dictionary key or as a member " "of another set." msgstr "" -":func:`frozenset` 型は :func:`set` の :term:`immutable` 版です。 immutable か" -"つハッシュ可能なので、辞書のキーやほかの set のメンバとして使えるでしょう。" +":func:`frozenset` 型は :func:`set` の immutable 版です。 immutable かつハッ" +"シュ可能なので、辞書のキーやほかの set のメンバとして使えるでしょう。" #: ../../whatsnew/2.4.rst:75 msgid "" diff --git a/whatsnew/2.5.po b/whatsnew/2.5.po index 868f77dcb..eea357d47 100644 --- a/whatsnew/2.5.po +++ b/whatsnew/2.5.po @@ -20,10 +20,10 @@ msgstr "" "Last-Translator: tomo, 2023\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../whatsnew/2.5.rst:3 @@ -660,7 +660,7 @@ msgstr "PEP 著 Aahz; 実装 Thomas Wouters。" #: ../../whatsnew/2.5.rst:333 msgid "https://pylib.readthedocs.io/" -msgstr "" +msgstr "https://pylib.readthedocs.io/" #: ../../whatsnew/2.5.rst:334 msgid "" @@ -837,9 +837,8 @@ msgid "" "that can be assigned to a variable or otherwise operated on::" msgstr "" -#: ../../whatsnew/2.5.rst:444 msgid "val = (yield i)" -msgstr "" +msgstr "val = (yield i)" #: ../../whatsnew/2.5.rst:446 msgid "" @@ -1053,6 +1052,8 @@ msgid "" "https://web.archive.org/web/20160321211320/http://www.sidhe.org/~dan/blog/" "archives/000178.html" msgstr "" +"https://web.archive.org/web/20160321211320/http://www.sidhe.org/~dan/blog/" +"archives/000178.html" #: ../../whatsnew/2.5.rst:555 msgid "" @@ -1598,11 +1599,11 @@ msgstr "" "`Exception` 派生にするのが肝要です。捕捉例外を特定しない ``except:`` は " "Python 3.0 から取り除かれるべきであることが提案されていますが、Guido van " "Rossum はこれをどうするかまだ決めていません。 (---訳注: 2.7 では raise は「新" -"スタイルクラスであれば」 :exc:`BaseException` 派生であることを要求されます" -"が、旧スタイルクラスであればなんでも許されてしまう点ではあまり変わっていませ" -"ん。これについての警告は :option:`!-3` などで受けることが出来ます。Python " -"3.0 でようやく全ての例外が :exc:`BaseException` 派生であることが強制されるよ" -"うになりました。 また、 ``except:`` は 3.4 でも残っています。---)" +"スタイルクラスであれば」 ``BaseException`` 派生であることを要求されますが、旧" +"スタイルクラスであればなんでも許されてしまう点ではあまり変わっていません。こ" +"れについての警告は :option:`!-3` などで受けることが出来ます。Python 3.0 でよ" +"うやく全ての例外が ``BaseException`` 派生であることが強制されるようになりまし" +"た。 また、 ``except:`` は 3.4 でも残っています。---)" #: ../../whatsnew/2.5.rst:856 msgid "" @@ -2019,11 +2020,11 @@ msgstr "" "``unichr(128)`` や ``chr(128)`` を探そうとすると :class:`UnicodeDecodeError` " "例外が起こっていたでしょう。2.5 での、 辞書を実装している :file:`dictobject." "c` のほかの変更により、これは揉み消すのではなく、引き続き例外を起こします(訳" -"注: 原文では this exception といっているので :class:`UnicodeDecodeError` が起" -"こるように読めるのですが、2.5 時点での振る舞いは確認出来ていませんが 2.7 で" -"は :class:`UnicodeWarning` とともに :exc:`KeyError` が発生する、のようになる" -"はずです。2.6 以降の What's New でのこれに関する言及はありませんが変更があっ" -"たのかもしれません)。" +"注: 原文では this exception といっているので ``UnicodeDecodeError`` が起こる" +"ように読めるのですが、2.5 時点での振る舞いは確認出来ていませんが 2.7 では " +"``UnicodeWarning`` とともに ``KeyError`` が発生する、のようになるはずです。" +"2.6 以降の What's New でのこれに関する言及はありませんが変更があったのかもし" +"れません)。" #: ../../whatsnew/2.5.rst:1088 msgid "" @@ -3251,6 +3252,8 @@ msgid "" "https://web.archive.org/web/20180410025338/http://starship.python.net/crew/" "theller/ctypes/" msgstr "" +"https://web.archive.org/web/20180410025338/http://starship.python.net/crew/" +"theller/ctypes/" #: ../../whatsnew/2.5.rst:1750 msgid "The pre-stdlib ctypes web page, with a tutorial, reference, and FAQ." @@ -3528,6 +3531,8 @@ msgid "" "https://web.archive.org/web/20201124024954/http://effbot.org/zone/element-" "index.htm" msgstr "" +"https://web.archive.org/web/20201124024954/http://effbot.org/zone/element-" +"index.htm" #: ../../whatsnew/2.5.rst:1869 msgid "Official documentation for ElementTree." @@ -3776,7 +3781,7 @@ msgstr "" #: ../../whatsnew/2.5.rst:2022 msgid "https://www.pysqlite.org" -msgstr "" +msgstr "https://www.pysqlite.org" #: ../../whatsnew/2.5.rst:2023 msgid "The pysqlite web page." @@ -3848,6 +3853,8 @@ msgid "" "https://web.archive.org/web/20160331090247/http://wsgi.readthedocs.org/en/" "latest/" msgstr "" +"https://web.archive.org/web/20160331090247/http://wsgi.readthedocs.org/en/" +"latest/" #: ../../whatsnew/2.5.rst:2069 msgid "A central web site for WSGI-related resources." diff --git a/whatsnew/2.6.po b/whatsnew/2.6.po index b1908076b..fdc051ca0 100644 --- a/whatsnew/2.6.po +++ b/whatsnew/2.6.po @@ -16,10 +16,10 @@ msgstr "" "Last-Translator: tomo, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../whatsnew/2.6.rst:5 @@ -260,7 +260,7 @@ msgstr "Python のバグトラッカー。" #: ../../whatsnew/2.6.rst:185 msgid "https://bugs.jython.org:" -msgstr "" +msgstr "https://bugs.jython.org:" #: ../../whatsnew/2.6.rst:186 msgid "The Jython bug tracker." @@ -268,7 +268,7 @@ msgstr "Jython のバグトラッカー。" #: ../../whatsnew/2.6.rst:188 msgid "https://roundup.sourceforge.io/" -msgstr "" +msgstr "https://roundup.sourceforge.io/" #: ../../whatsnew/2.6.rst:189 msgid "Roundup downloads and documentation." @@ -276,16 +276,15 @@ msgstr "Roundup のダウンロードとドキュメント。" #: ../../whatsnew/2.6.rst:191 msgid "https://svn.python.org/view/tracker/importer/" -msgstr "" +msgstr "https://svn.python.org/view/tracker/importer/" #: ../../whatsnew/2.6.rst:192 msgid "Martin von Löwis's conversion scripts." msgstr "Martin von Löwis の変換スクリプト。" -#: ../../whatsnew/2.6.rst:195 msgid "New Documentation Format: reStructuredText Using Sphinx" msgstr "" -"新しいドキュメンテーションフォーマット: Sphinx を使っての reStructuredText " +"新しいドキュメンテーションフォーマット: Sphinx を使っての reStructuredText" #: ../../whatsnew/2.6.rst:197 msgid "" @@ -1710,9 +1709,9 @@ msgid "" "Instances of the :class:`bytes` type are immutable just as strings are. A " "new :class:`bytearray` type stores a mutable sequence of bytes::" msgstr "" -":class:`bytes` 型のインスタンスは単に文字列と同じで :term:`immutable` で" -"す。 :class:`bytearray` 型が、バイト列を :term:`mutable` シーケンスとして格納" -"するものとして新しく追加されました::" +":class:`bytes` 型のインスタンスは単に文字列と同じで immutable です。 :class:" +"`bytearray` 型が、バイト列を mutable シーケンスとして格納するものとして新しく" +"追加されました::" #: ../../whatsnew/2.6.rst:988 msgid "" diff --git a/whatsnew/2.7.po b/whatsnew/2.7.po index 3e3d82254..ff5dd046d 100644 --- a/whatsnew/2.7.po +++ b/whatsnew/2.7.po @@ -19,10 +19,10 @@ msgstr "" "Last-Translator: Taichi Haradaguchi, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../whatsnew/2.7.rst:3 @@ -3519,6 +3519,8 @@ msgid "" "https://web.archive.org/web/20210619163128/http://www.voidspace.org.uk/" "python/articles/unittest2.shtml" msgstr "" +"https://web.archive.org/web/20210619163128/http://www.voidspace.org.uk/" +"python/articles/unittest2.shtml" #: ../../whatsnew/2.7.rst:2009 msgid "" @@ -4732,9 +4734,8 @@ msgid "" "pre.in` for details." msgstr "" -#: ../../whatsnew/2.7.rst:2775 ../../whatsnew/2.7.rst:2788 msgid "(Contributed by Victor Stinner in :issue:`23404`.)" -msgstr "(Victor Stinner の貢献による :issue:`23404`) " +msgstr "(Victor Stinner の貢献による :issue:`23404`)" #: ../../whatsnew/2.7.rst:2781 msgid "Removal of ``make touch`` build target" diff --git a/whatsnew/3.0.po b/whatsnew/3.0.po index 3745df5fb..cd799d2f3 100644 --- a/whatsnew/3.0.po +++ b/whatsnew/3.0.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: Taichi Haradaguchi, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../whatsnew/3.0.rst:3 @@ -1269,7 +1269,7 @@ msgstr "" "組み込みの新しい文字列書式化操作で、文字列の ``%`` 演算子を置き換えるもので" "す。(しかしながら ``%`` 演算子はまだサポートされます; Python 3.1 で非推奨とな" "り、将来のいつかの時点で削除されます。) 完全な詳細は :pep:`3101` をお読み下さ" -"い。 (--- 訳注: `Python 2.6 で既にあった変更`_ での対応する記述に書いた訳注を" +"い。 (--- 訳注: 「Python 2.6 で既にあった変更」での対応する記述に書いた訳注を" "参照。---)" #: ../../whatsnew/3.0.rst:685 @@ -1294,8 +1294,8 @@ msgstr "" ":pep:`352`: 全ての例外は (直接的にまたは間接的に) :exc:`BaseException` を継承" "しなければなりません。\n" ":exc:`BaseException` は例外階層の根です。\n" -"これは勧告としては新しくありませんが、:exc:`BaseException` 継承の *要求* は新" -"しいです。\n" +"これは勧告としては新しくありませんが、 ``BaseException`` 継承の *要求* は新し" +"いです。\n" "(Python 2.6 は依然として昔のクラスを送出するのを許容しており、捕捉するものに" "ついての制限はありません。)\n" "結果として文字列例外は終に本当の意味で、完全になくなりました。" @@ -1654,9 +1654,9 @@ msgid "" "For porting existing Python 2.5 or 2.6 source code to Python 3.0, the best " "strategy is the following:" msgstr "" -"(---訳注: 今では独立したクックブック :ref:`pyporting-howto` があるのでそちら" -"をご覧下さい。---) 既存の Python 2.5 や 2.6 のソースコードを Python 3.0 に移" -"植する最良の策は以下の通りです:" +"(---訳注: 今では独立したクックブック How to port Python 2 Code to Python 3 が" +"あるのでそちらをご覧下さい。---) 既存の Python 2.5 や 2.6 のソースコードを " +"Python 3.0 に移植する最良の策は以下の通りです:" #: ../../whatsnew/3.0.rst:903 msgid "(Prerequisite:) Start with excellent test coverage." @@ -1710,8 +1710,8 @@ msgstr "" "生成します。2016 時点でも Python 2.7 はかなり元気 (予定では 2020 年までは公式" "にサポートされる) ですので両バージョン (ただし今だと 2.7 と 3.2 以降) で変更" "なしで動作するものを必要とすることは、残念ながらまだ多いでしょう (あなたが" -"作っているのがライブラリであるならば)。これについては :ref:`pyporting-howto` " -"に少し書かれています。 ---)" +"作っているのがライブラリであるならば)。これについては How to port Python 2 " +"Code to Python 3 に少し書かれています。 ---)" #: ../../whatsnew/3.0.rst:929 msgid "" diff --git a/whatsnew/3.1.po b/whatsnew/3.1.po index 96f030619..36b125f4a 100644 --- a/whatsnew/3.1.po +++ b/whatsnew/3.1.po @@ -18,10 +18,10 @@ msgstr "" "Last-Translator: tomo, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../whatsnew/3.1.rst:3 @@ -89,9 +89,9 @@ msgstr "" "定ファイルを読み込み、編集した後、元の順序で書きなおすことができます。:func:" "`collections.namedtuple` の *_asdict()* メソッドは、タプルの順序と同じ順序の" "順序付き辞書を返すようになりました。:mod:`json` モジュールのデコーダーが " -"OrderedDict をビルドするのをサポートするために、 :class:`~json.JSONDecoder` " -"クラスのコンストラクタに *object_pairs_hook* 引数が追加されました。 `PyYAML " -"`_ などの外部のライブラリでもサポートされています。" +"OrderedDict をビルドするのをサポートするために、 ``JSONDecoder`` クラスのコン" +"ストラクタに *object_pairs_hook* 引数が追加されました。 `PyYAML `_ などの外部のライブラリでもサポートされています。" #: ../../whatsnew/3.1.rst:79 msgid ":pep:`372` - Ordered Dictionaries" @@ -431,9 +431,9 @@ msgid "" "implementing a widget's behavior from the code implementing its appearance." msgstr "" "Tk のテーマ付きウィジェットへのアクセスを提供する、新しい :mod:`tkinter.ttk` " -"モジュールが追加されました。 :mod:`tkinter.ttk` の基本的なアイディアは、拡張" -"可能性のためにウィジェットの動作を実装するコードと見た目を記述するコードを分" -"離することです。" +"モジュールが追加されました。 ``tkinter.ttk`` の基本的なアイディアは、拡張可能" +"性のためにウィジェットの動作を実装するコードと見た目を記述するコードを分離す" +"ることです。" #: ../../whatsnew/3.1.rst:261 msgid "(Contributed by Guilherme Polo; :issue:`2983`.)" @@ -652,8 +652,8 @@ msgid "" msgstr "" ":mod:`unittest` に特定のテストメソッドやテストクラス全体をスキップする仕組み" "のサポートが追加されました。さらに、この機能はテスト結果を「意図的な失敗」と" -"することができ、テストが失敗しても :class:`TestResult` の失敗数にはカウントさ" -"れなくなります::" +"することができ、テストが失敗しても ``TestResult`` の失敗数にはカウントされな" +"くなります::" #: ../../whatsnew/3.1.rst:366 msgid "" diff --git a/whatsnew/3.10.po b/whatsnew/3.10.po index b6bf3ffcf..c3022024e 100644 --- a/whatsnew/3.10.po +++ b/whatsnew/3.10.po @@ -19,10 +19,10 @@ msgstr "" "Last-Translator: Takanori Suzuki , 2025\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../whatsnew/3.10.rst:3 @@ -86,27 +86,26 @@ msgstr "インタプリタの改善:" #: ../../whatsnew/3.10.rst:73 msgid ":pep:`626`, Precise line numbers for debugging and other tools." -msgstr "" +msgstr ":pep:`626`, デバッグおよびその他のツール用の正確な行番号。" #: ../../whatsnew/3.10.rst:75 msgid "New typing features:" msgstr "新しい型ヒントの機能:" -#: ../../whatsnew/3.10.rst:77 msgid ":pep:`604`, Allow writing union types as X | Y" -msgstr "" +msgstr ":pep:`604`、ユニオン型を X | Y と書けるように" #: ../../whatsnew/3.10.rst:78 msgid ":pep:`612`, Parameter Specification Variables" -msgstr "" +msgstr ":pep:`612`, パラメータ指定変数" #: ../../whatsnew/3.10.rst:79 msgid ":pep:`613`, Explicit Type Aliases" -msgstr "" +msgstr ":pep:`613`, 明示的型エイリアス" #: ../../whatsnew/3.10.rst:80 msgid ":pep:`647`, User-Defined Type Guards" -msgstr "" +msgstr ":pep:`647`, ユーザ定義型ガード" #: ../../whatsnew/3.10.rst:82 msgid "Important deprecations, removals or restrictions:" @@ -114,25 +113,25 @@ msgstr "重要な非推奨化、削除または制限:" #: ../../whatsnew/3.10.rst:84 msgid ":pep:`644`, Require OpenSSL 1.1.1 or newer" -msgstr "" +msgstr ":pep:`644`, OpenSSL 1.1.1 以降の必須化" #: ../../whatsnew/3.10.rst:85 msgid ":pep:`632`, Deprecate distutils module." -msgstr "" +msgstr ":pep:`632`, distutilsモジュールが非推奨に" #: ../../whatsnew/3.10.rst:86 msgid "" ":pep:`623`, Deprecate and prepare for the removal of the wstr member in " "PyUnicodeObject." -msgstr "" +msgstr ":pep:`623`, PyUnicodeObject の wstr メンバーの非推奨・削除への準備" #: ../../whatsnew/3.10.rst:87 msgid ":pep:`624`, Remove Py_UNICODE encoder APIs" -msgstr "" +msgstr ":pep:`624`, Py_UNICODE エンコーダAPIの削除" #: ../../whatsnew/3.10.rst:88 msgid ":pep:`597`, Add optional EncodingWarning" -msgstr "" +msgstr ":pep:`597`, 任意のEncodingWarningを追加" #: ../../whatsnew/3.10.rst:92 ../../whatsnew/3.10.rst:2054 msgid "New Features" @@ -155,7 +154,6 @@ msgstr "" "ときに、従来のimport文と同じようにフォーマットできます。たとえば、以下のすべ" "ての例は有効です::" -#: ../../whatsnew/3.10.rst:105 msgid "" "with (CtxManager() as example):\n" " ...\n" @@ -180,6 +178,28 @@ msgid "" "):\n" " ..." msgstr "" +"with (CtxManager() as example):\n" +" ...\n" +"\n" +"with (\n" +" CtxManager1(),\n" +" CtxManager2()\n" +"):\n" +" ...\n" +"\n" +"with (CtxManager1() as example,\n" +" CtxManager2()):\n" +" ...\n" +"\n" +"with (CtxManager1(),\n" +" CtxManager2() as example):\n" +" ...\n" +"\n" +"with (\n" +" CtxManager1() as example1,\n" +" CtxManager2() as example2\n" +"):\n" +" ..." #: ../../whatsnew/3.10.rst:130 msgid "" @@ -187,7 +207,6 @@ msgid "" msgstr "" "カッコに囲まれたグループの最後の要素に対する、末尾のカンマも指定可能です。" -#: ../../whatsnew/3.10.rst:133 msgid "" "with (\n" " CtxManager1() as example1,\n" @@ -196,6 +215,12 @@ msgid "" "):\n" " ..." msgstr "" +"with (\n" +" CtxManager1() as example1,\n" +" CtxManager2() as example2,\n" +" CtxManager3() as example3,\n" +"):\n" +" ..." #: ../../whatsnew/3.10.rst:142 msgid "" @@ -229,13 +254,20 @@ msgid "" "pointing to some incorrect location. For instance, consider the following " "code (notice the unclosed '{'):" msgstr "" +"閉じられていない括弧やブラケットを含むコードを解析する際、インタープリタはこ" +"れまでのように *SyntaxError: unexpected EOF while parsing* を表示したり、誤っ" +"た位置を指したりするのではなく、未閉鎖の括弧やブラケットの位置を示すようにな" +"りました。たとえば、次のコードを考えてみましょう(未閉鎖の '{' に注目してくだ" +"さい):" -#: ../../whatsnew/3.10.rst:160 msgid "" "expected = {9: 1, 18: 2, 19: 2, 27: 3, 28: 3, 29: 3, 36: 4, 37: 4,\n" " 38: 4, 39: 4, 45: 5, 46: 5, 47: 5, 48: 5, 49: 5, 54: 6,\n" "some_other_code = foo()" msgstr "" +"expected = {9: 1, 18: 2, 19: 2, 27: 3, 28: 3, 29: 3, 36: 4, 37: 4,\n" +" 38: 4, 39: 4, 45: 5, 46: 5, 47: 5, 48: 5, 49: 5, 54: 6,\n" +"some_other_code = foo()" #: ../../whatsnew/3.10.rst:166 msgid "" @@ -245,25 +277,31 @@ msgstr "" "以前のバージョンのインタープリタは、構文エラーの位置として混乱する場所を報告" "していました:" -#: ../../whatsnew/3.10.rst:169 msgid "" "File \"example.py\", line 3\n" " some_other_code = foo()\n" " ^\n" "SyntaxError: invalid syntax" msgstr "" +"File \"example.py\", line 3\n" +" some_other_code = foo()\n" +" ^\n" +"SyntaxError: invalid syntax" #: ../../whatsnew/3.10.rst:176 msgid "but in Python 3.10 a more informative error is emitted:" msgstr "しかしPython 3.10ではより有益なエラーが出力されます:" -#: ../../whatsnew/3.10.rst:178 msgid "" "File \"example.py\", line 1\n" " expected = {9: 1, 18: 2, 19: 2, 27: 3, 28: 3, 29: 3, 36: 4, 37: 4,\n" " ^\n" "SyntaxError: '{' was never closed" msgstr "" +"File \"example.py\", line 1\n" +" expected = {9: 1, 18: 2, 19: 2, 27: 3, 28: 3, 29: 3, 36: 4, 37: 4,\n" +" ^\n" +"SyntaxError: '{' was never closed" #: ../../whatsnew/3.10.rst:186 msgid "" @@ -271,11 +309,14 @@ msgid "" "triple quoted) now point to the start of the string instead of reporting EOF/" "EOL." msgstr "" +"同様に、閉じられていない文字列リテラル(シングルクォートおよびトリプルクォー" +"ト)に関するエラーも、これまでのように EOF/EOL を報告するのではなく、文字列の" +"開始位置を指すようになりました。" #: ../../whatsnew/3.10.rst:189 msgid "" "These improvements are inspired by previous work in the PyPy interpreter." -msgstr "" +msgstr "これらの改善は PyPy インタプリタのこれまでの取組から着想を得ました。" #: ../../whatsnew/3.10.rst:191 msgid "" @@ -285,15 +326,16 @@ msgstr "" "(Pablo Galindoの貢献による :issue:`42864`、Batuhan Taskayaの貢献による :" "issue:`40176`)" -#: ../../whatsnew/3.10.rst:194 msgid "" ":exc:`SyntaxError` exceptions raised by the interpreter will now highlight " "the full error range of the expression that constitutes the syntax error " "itself, instead of just where the problem is detected. In this way, instead " "of displaying (before Python 3.10):" msgstr "" +"インタープリタが送出する :exc:`SyntaxError` 例外は、問題を検出した箇所だけで" +"なく、構文エラーを構成する式の範囲全体を強調表示するようになりました。\n" +"Python 3.10 より前では、次のように表示されていました:" -#: ../../whatsnew/3.10.rst:199 msgid "" ">>> foo(x, z for z in range(10), t, w)\n" " File \"\", line 1\n" @@ -301,12 +343,16 @@ msgid "" " ^\n" "SyntaxError: Generator expression must be parenthesized" msgstr "" +">>> foo(x, z for z in range(10), t, w)\n" +" File \"\", line 1\n" +" foo(x, z for z in range(10), t, w)\n" +" ^\n" +"SyntaxError: Generator expression must be parenthesized" #: ../../whatsnew/3.10.rst:207 msgid "now Python 3.10 will display the exception as:" -msgstr "" +msgstr "Python 3.10 では例外は次のように表示されるようになります:" -#: ../../whatsnew/3.10.rst:209 msgid "" ">>> foo(x, z for z in range(10), t, w)\n" " File \"\", line 1\n" @@ -314,23 +360,29 @@ msgid "" " ^^^^^^^^^^^^^^^^^^^^\n" "SyntaxError: Generator expression must be parenthesized" msgstr "" +">>> foo(x, z for z in range(10), t, w)\n" +" File \"\", line 1\n" +" foo(x, z for z in range(10), t, w)\n" +" ^^^^^^^^^^^^^^^^^^^^\n" +"SyntaxError: Generator expression must be parenthesized" #: ../../whatsnew/3.10.rst:217 msgid "This improvement was contributed by Pablo Galindo in :issue:`43914`." -msgstr "" +msgstr "この改善は Pablo Galindo の貢献で実現しました :issue:`43914`。" -#: ../../whatsnew/3.10.rst:219 msgid "" "A considerable amount of new specialized messages for :exc:`SyntaxError` " "exceptions have been incorporated. Some of the most notable ones are as " "follows:" msgstr "" +":exc:`SyntaxError` 例外の状況に応じた具体的なメッセージが多数追加されまし" +"た。\n" +"特に注目すべきものを以下に示します。" #: ../../whatsnew/3.10.rst:222 msgid "Missing ``:`` before blocks:" msgstr "ブロックの前の ``:`` が存在しない:" -#: ../../whatsnew/3.10.rst:224 msgid "" ">>> if rocket.position > event_horizon\n" " File \"\", line 1\n" @@ -338,6 +390,11 @@ msgid "" " ^\n" "SyntaxError: expected ':'" msgstr "" +">>> if rocket.position > event_horizon\n" +" File \"\", line 1\n" +" if rocket.position > event_horizon\n" +" ^\n" +"SyntaxError: expected ':'" #: ../../whatsnew/3.10.rst:232 msgid "(Contributed by Pablo Galindo in :issue:`42997`.)" @@ -347,7 +404,6 @@ msgstr "(Pablo Galindo の貢献による :issue:`42997`)" msgid "Unparenthesised tuples in comprehensions targets:" msgstr "内包表記のターゲットにカッコのないタプルを使用:" -#: ../../whatsnew/3.10.rst:236 msgid "" ">>> {x,y for x,y in zip('abcd', '1234')}\n" " File \"\", line 1\n" @@ -355,6 +411,11 @@ msgid "" " ^\n" "SyntaxError: did you forget parentheses around the comprehension target?" msgstr "" +">>> {x,y for x,y in zip('abcd', '1234')}\n" +" File \"\", line 1\n" +" {x,y for x,y in zip('abcd', '1234')}\n" +" ^\n" +"SyntaxError: did you forget parentheses around the comprehension target?" #: ../../whatsnew/3.10.rst:244 msgid "(Contributed by Pablo Galindo in :issue:`43017`.)" @@ -364,7 +425,6 @@ msgstr "(Pablo Galindo の貢献による :issue:`43017`)" msgid "Missing commas in collection literals and between expressions:" msgstr "コレクションリテラルや式の間のカンマが存在しない:" -#: ../../whatsnew/3.10.rst:248 msgid "" ">>> items = {\n" "... x: 1,\n" @@ -375,6 +435,14 @@ msgid "" " ^\n" "SyntaxError: invalid syntax. Perhaps you forgot a comma?" msgstr "" +">>> items = {\n" +"... x: 1,\n" +"... y: 2\n" +"... z: 3,\n" +" File \"\", line 3\n" +" y: 2\n" +" ^\n" +"SyntaxError: invalid syntax. Perhaps you forgot a comma?" #: ../../whatsnew/3.10.rst:259 msgid "(Contributed by Pablo Galindo in :issue:`43822`.)" @@ -384,7 +452,6 @@ msgstr "(Pablo Galindo の貢献による :issue:`43822`)" msgid "Multiple Exception types without parentheses:" msgstr "複数の例外の型をカッコで囲んでいない:" -#: ../../whatsnew/3.10.rst:263 msgid "" ">>> try:\n" "... build_dyson_sphere()\n" @@ -394,6 +461,13 @@ msgid "" " ^\n" "SyntaxError: multiple exception types must be parenthesized" msgstr "" +">>> try:\n" +"... build_dyson_sphere()\n" +"... except NotEnoughScienceError, NotEnoughResourcesError:\n" +" File \"\", line 3\n" +" except NotEnoughScienceError, NotEnoughResourcesError:\n" +" ^\n" +"SyntaxError: multiple exception types must be parenthesized" #: ../../whatsnew/3.10.rst:273 msgid "(Contributed by Pablo Galindo in :issue:`43149`.)" @@ -403,7 +477,6 @@ msgstr "(Pablo Galindo の貢献による :issue:`43149`)" msgid "Missing ``:`` and values in dictionary literals:" msgstr "辞書のリテラルで ``:`` と値が存在しない:" -#: ../../whatsnew/3.10.rst:277 msgid "" ">>> values = {\n" "... x: 1,\n" @@ -421,6 +494,21 @@ msgid "" " ^\n" "SyntaxError: ':' expected after dictionary key" msgstr "" +">>> values = {\n" +"... x: 1,\n" +"... y: 2,\n" +"... z:\n" +"... }\n" +" File \"\", line 4\n" +" z:\n" +" ^\n" +"SyntaxError: expression expected after dictionary key and ':'\n" +"\n" +">>> values = {x:1, y:2, z w:3}\n" +" File \"\", line 1\n" +" values = {x:1, y:2, z w:3}\n" +" ^\n" +"SyntaxError: ':' expected after dictionary key" #: ../../whatsnew/3.10.rst:295 msgid "(Contributed by Pablo Galindo in :issue:`43823`.)" @@ -430,7 +518,6 @@ msgstr "(Pablo Galindo の貢献による :issue:`43823`)" msgid "``try`` blocks without ``except`` or ``finally`` blocks:" msgstr "``try`` ブロックに ``except`` または ``finally`` ブロックが存在しない:" -#: ../../whatsnew/3.10.rst:299 msgid "" ">>> try:\n" "... x = 2\n" @@ -440,6 +527,13 @@ msgid "" " ^^^^^^^^^\n" "SyntaxError: expected 'except' or 'finally' block" msgstr "" +">>> try:\n" +"... x = 2\n" +"... something = 3\n" +" File \"\", line 3\n" +" something = 3\n" +" ^^^^^^^^^\n" +"SyntaxError: expected 'except' or 'finally' block" #: ../../whatsnew/3.10.rst:309 msgid "(Contributed by Pablo Galindo in :issue:`44305`.)" @@ -449,7 +543,6 @@ msgstr "(Pablo Galindo の貢献による :issue:`44305`)" msgid "Usage of ``=`` instead of ``==`` in comparisons:" msgstr "比較で ``==`` の代わりに ``=`` を使用している:" -#: ../../whatsnew/3.10.rst:313 msgid "" ">>> if rocket.position = event_horizon:\n" " File \"\", line 1\n" @@ -458,6 +551,12 @@ msgid "" "SyntaxError: cannot assign to attribute here. Maybe you meant '==' instead " "of '='?" msgstr "" +">>> if rocket.position = event_horizon:\n" +" File \"\", line 1\n" +" if rocket.position = event_horizon:\n" +" ^\n" +"SyntaxError: cannot assign to attribute here. Maybe you meant '==' instead " +"of '='?" #: ../../whatsnew/3.10.rst:321 msgid "(Contributed by Pablo Galindo in :issue:`43797`.)" @@ -467,7 +566,6 @@ msgstr "(Pablo Galindo の貢献による :issue:`43797`)" msgid "Usage of ``*`` in f-strings:" msgstr "f-stringで ``*`` を使用している:" -#: ../../whatsnew/3.10.rst:325 msgid "" ">>> f\"Black holes {*all_black_holes} and revelations\"\n" " File \"\", line 1\n" @@ -475,6 +573,11 @@ msgid "" " ^\n" "SyntaxError: f-string: cannot use starred expression here" msgstr "" +">>> f\"Black holes {*all_black_holes} and revelations\"\n" +" File \"\", line 1\n" +" (*all_black_holes)\n" +" ^\n" +"SyntaxError: f-string: cannot use starred expression here" #: ../../whatsnew/3.10.rst:333 msgid "(Contributed by Pablo Galindo in :issue:`41064`.)" @@ -490,8 +593,9 @@ msgid "" "kind of block was expecting an indentation, including the location of the " "statement:" msgstr "" +"多くの :exc:`IndentationError` 例外において、どの種類のブロックでインデントが" +"期待されていたのか、その文の位置に関する情報が追加されるようになりました。" -#: ../../whatsnew/3.10.rst:341 msgid "" ">>> def foo():\n" "... if lel:\n" @@ -501,19 +605,26 @@ msgid "" " ^\n" "IndentationError: expected an indented block after 'if' statement in line 2" msgstr "" +">>> def foo():\n" +"... if lel:\n" +"... x = 2\n" +" File \"\", line 3\n" +" x = 2\n" +" ^\n" +"IndentationError: expected an indented block after 'if' statement in line 2" #: ../../whatsnew/3.10.rst:353 msgid "AttributeErrors" msgstr "AttributeErrors" -#: ../../whatsnew/3.10.rst:355 msgid "" "When printing :exc:`AttributeError`, :c:func:`!PyErr_Display` will offer " "suggestions of similar attribute names in the object that the exception was " "raised from:" msgstr "" +":exc:`AttributeError` を表示するとき、:c:func:`!PyErr_Display` は例外の発生元" +"のオブジェクトにある似た属性名を候補として提示するようになりました:" -#: ../../whatsnew/3.10.rst:359 msgid "" ">>> collections.namedtoplo\n" "Traceback (most recent call last):\n" @@ -521,30 +632,39 @@ msgid "" "AttributeError: module 'collections' has no attribute 'namedtoplo'. Did you " "mean: namedtuple?" msgstr "" +">>> collections.namedtoplo\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"AttributeError: module 'collections' has no attribute 'namedtoplo'. Did you " +"mean: namedtuple?" #: ../../whatsnew/3.10.rst:366 ../../whatsnew/3.10.rst:388 msgid "(Contributed by Pablo Galindo in :issue:`38530`.)" msgstr "(Pablo Galindo の貢献による :issue:`38530`)" -#: ../../whatsnew/3.10.rst:369 msgid "" "Notice this won't work if :c:func:`!PyErr_Display` is not called to display " "the error which can happen if some other custom error display function is " "used. This is a common scenario in some REPLs like IPython." msgstr "" +"エラーの表示に :c:func:`!PyErr_Display` が呼び出されない場合、この機能は働き" +"ません。\n" +"独自のエラー表示関数を使う場合などが該当します。\n" +"IPython などの REPL ではよくある状況です。" #: ../../whatsnew/3.10.rst:374 msgid "NameErrors" msgstr "NameErrors" -#: ../../whatsnew/3.10.rst:376 msgid "" "When printing :exc:`NameError` raised by the interpreter, :c:func:`!" "PyErr_Display` will offer suggestions of similar variable names in the " "function that the exception was raised from:" msgstr "" +"インタープリタが送出した :exc:`NameError` を表示するとき、:c:func:`!" +"PyErr_Display` は例外が発生した関数にある似た変数名を候補として提示するように" +"なりました:" -#: ../../whatsnew/3.10.rst:380 msgid "" ">>> schwarzschild_black_hole = None\n" ">>> schwarschild_black_hole\n" @@ -553,31 +673,45 @@ msgid "" "NameError: name 'schwarschild_black_hole' is not defined. Did you mean: " "schwarzschild_black_hole?" msgstr "" +">>> schwarzschild_black_hole = None\n" +">>> schwarschild_black_hole\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"NameError: name 'schwarschild_black_hole' is not defined. Did you mean: " +"schwarzschild_black_hole?" -#: ../../whatsnew/3.10.rst:391 msgid "" "Notice this won't work if :c:func:`!PyErr_Display` is not called to display " "the error, which can happen if some other custom error display function is " "used. This is a common scenario in some REPLs like IPython." msgstr "" +"エラーの表示に :c:func:`!PyErr_Display` が呼び出されない場合、この機能は働き" +"ません。\n" +"独自のエラー表示関数を使う場合などが該当します。\n" +"IPython などの REPL ではよくある状況です。" #: ../../whatsnew/3.10.rst:397 msgid "PEP 626: Precise line numbers for debugging and other tools" -msgstr "" +msgstr "PEP 626: デバッグおよびその他のツール用の正確な行番号。" -#: ../../whatsnew/3.10.rst:399 msgid "" "PEP 626 brings more precise and reliable line numbers for debugging, " "profiling and coverage tools. Tracing events, with the correct line number, " "are generated for all lines of code executed and only for lines of code that " "are executed." msgstr "" +"PEP 626 により、デバッグ、プロファイリング、カバレッジのツールで使う行番号が" +"より正確で信頼できるものになりました。\n" +"実行されたコードのすべての行について、正しい行番号を持つトレースイベントが生" +"成されます。\n" +"実行されていない行では生成されません。" -#: ../../whatsnew/3.10.rst:402 msgid "" "The :attr:`~frame.f_lineno` attribute of frame objects will always contain " "the expected line number." msgstr "" +"フレームオブジェクトの :attr:`~frame.f_lineno` 属性には、常に期待どおりの行番" +"号が格納されるようになります。" #: ../../whatsnew/3.10.rst:405 msgid "" @@ -600,14 +734,19 @@ msgid "" "from complex data types, branch on the structure of data, and apply specific " "actions based on different forms of data." msgstr "" +" *match文* と *case文* とそこに関連付けられたアクションという形式の構造的なパ" +"ターンマッチが追加されました。パターンはシーケンス 、マッピング 、単純なデー" +"タ型やクラスのインスタンスで構成されます。パターンマッチによって、プログラム" +"は複雑なデータ型からの情報の抽出、データ構造による分岐、データのさまざまな形" +"式に基づいて特定のアクションを適用などが可能になります。" #: ../../whatsnew/3.10.rst:422 msgid "Syntax and operations" -msgstr "" +msgstr "構文と演算" #: ../../whatsnew/3.10.rst:424 msgid "The generic syntax of pattern matching is::" -msgstr "" +msgstr "パターンマッチングの一般的な構文は次のとおりです:" #: ../../whatsnew/3.10.rst:426 msgid "" @@ -621,6 +760,15 @@ msgid "" " case _:\n" " " msgstr "" +"match subject:\n" +" case :\n" +" \n" +" case :\n" +" \n" +" case :\n" +" \n" +" case _:\n" +" " #: ../../whatsnew/3.10.rst:436 msgid "" @@ -628,24 +776,26 @@ msgid "" "patterns given as one or more case blocks. Specifically, pattern matching " "operates by:" msgstr "" +"match 文は式を取り、その値を 1 つ以上の case ブロックで指定されたパターンと順" +"に比較します。具体的には、パターンマッチングは次の手順で動作します:" #: ../../whatsnew/3.10.rst:440 msgid "using data with type and shape (the ``subject``)" -msgstr "" +msgstr "型と構造を持つデータ(``subject``)を使用する" #: ../../whatsnew/3.10.rst:441 msgid "evaluating the ``subject`` in the ``match`` statement" -msgstr "" +msgstr "``match`` 文内で ``subject`` を評価する" #: ../../whatsnew/3.10.rst:442 msgid "" "comparing the subject with each pattern in a ``case`` statement from top to " "bottom until a match is confirmed." -msgstr "" +msgstr "``case`` 文の各パターンと上から順に比較し、一致が確認されるまで進める" #: ../../whatsnew/3.10.rst:444 msgid "executing the action associated with the pattern of the confirmed match" -msgstr "" +msgstr "一致が確認されたパターンに関連付けられた処理を実行する" #: ../../whatsnew/3.10.rst:446 msgid "" @@ -654,10 +804,13 @@ msgid "" "confirmed and a wildcard case does not exist, the entire match block is a no-" "op." msgstr "" +"完全一致するパターンがない場合、最後にワイルドカード ``_`` が指定されていれ" +"ば、それが一致ケースとして使用されます。完全一致もワイルドカードも存在しない" +"場合、 match ブロック全体は何も実行されません(no-op となります)。" #: ../../whatsnew/3.10.rst:452 msgid "Declarative approach" -msgstr "" +msgstr "宣言的なアプローチ" #: ../../whatsnew/3.10.rst:454 msgid "" @@ -667,6 +820,11 @@ msgid "" "the switch statement is used for comparison of an object/expression with " "case statements containing literals." msgstr "" +"読者の中には、C、Java、JavaScript(およびその他多くの言語)における switch 文" +"を通じて、対象(データオブジェクト)をリテラル(パターン)と照合する単純な例" +"として、パターンマッチングに馴染みがある方もいるでしょう。多くの場合、 " +"switch 文はオブジェクトや式を、リテラルを含む複数の case 文と比較するために使" +"用されます。" #: ../../whatsnew/3.10.rst:460 msgid "" @@ -675,6 +833,9 @@ msgid "" "\"declarative\" and explicitly states the conditions (the patterns) for data " "to match." msgstr "" +"より強力なパターンマッチングの例は、Scala や Elixir のような言語で見られま" +"す。構造的パターンマッチングでは、アプローチは「宣言的」であり、データが一致" +"するための条件(パターン)を明示的に記述します。" #: ../../whatsnew/3.10.rst:464 msgid "" @@ -687,10 +848,16 @@ msgid "" "literal in a case statement, its true value for Python lies in its handling " "of the subject's type and shape." msgstr "" +"これに対して、「命令的」なアプローチでは、入れ子になった if 文を用いて構造的" +"パターンマッチングと同様の処理を実現することも可能ですが、「宣言的」な方法ほ" +"ど明確ではありません。宣言的アプローチでは、一致のために満たすべき条件を明示" +"的なパターンとして記述するため、より読みやすくなります。構造的パターンマッチ" +"ングは、最も単純な形では case 文で変数とリテラルを比較するものとして使用でき" +"ますが、 Python における真の価値は、対象の型や構造を扱える点にあります。" #: ../../whatsnew/3.10.rst:473 msgid "Simple pattern: match to a literal" -msgstr "" +msgstr "単純パターン: リテラルとのマッチ" #: ../../whatsnew/3.10.rst:475 msgid "" @@ -700,6 +867,11 @@ msgid "" "patterns are each of the case statements, where literals represent request " "status codes. The associated action to the case is executed after a match::" msgstr "" +"最も基本的な形のパターンマッチングの例を見てみましょう。ここでは、値(=対" +"象、subject)が複数のリテラル、すなわちパターンと照合されます。以下の例では、" +"``status`` が match 文の対象です。\n" +"各 case 文のパターンは、リクエストのステータスコードを表すリテラルです。一致" +"が見つかると、その case に対応する処理が実行されます。" #: ../../whatsnew/3.10.rst:481 msgid "" @@ -734,12 +906,19 @@ msgid "" "acts as a *wildcard* and insures the subject will always match. The use of " "``_`` is optional." msgstr "" +"上記の関数に ``status`` として 418 が渡された場合は、 \"I'm a teapot\" が返さ" +"れます。一方、 500 が渡された場合には、ワイルドカードとして機能する ``_`` を" +"使用した case 文が一致し、 \"Something's wrong with the internet\" が返されま" +"す。ここで、最後のブロックに注目してください。変数名 ``_`` はワイルドカードと" +"して機能し、対象と必ず一致することを保証します。なお、 ``_`` の使用は任意で" +"す。" #: ../../whatsnew/3.10.rst:499 msgid "" "You can combine several literals in a single pattern using ``|`` (\"or\")::" msgstr "" -"複数のリテラルを``|`` (\"or\")を使用して組み合わせて1つのパターンにできます。" +"複数のリテラルを ``|`` (\"or\")を使用して組み合わせて1つのパターンにできま" +"す。" #: ../../whatsnew/3.10.rst:501 msgid "" @@ -751,13 +930,13 @@ msgstr "" #: ../../whatsnew/3.10.rst:505 msgid "Behavior without the wildcard" -msgstr "" +msgstr "ワイルドカードがないときの振る舞い" #: ../../whatsnew/3.10.rst:507 msgid "" "If we modify the above example by removing the last case block, the example " "becomes::" -msgstr "" +msgstr "上記の例から最後の case ブロックを削除すると、次のようになります:" #: ../../whatsnew/3.10.rst:510 msgid "" @@ -770,6 +949,14 @@ msgid "" " case 418:\n" " return \"I'm a teapot\"" msgstr "" +"def http_error(status):\n" +" match status:\n" +" case 400:\n" +" return \"Bad request\"\n" +" case 404:\n" +" return \"Not found\"\n" +" case 418:\n" +" return \"I'm a teapot\"" #: ../../whatsnew/3.10.rst:519 msgid "" @@ -777,10 +964,13 @@ msgid "" "match exists, the behavior is a no-op. For example, if ``status`` of 500 is " "passed, a no-op occurs." msgstr "" +"case 文で ``_`` を使用しない場合、一致するパターンが存在しない可能性がありま" +"す。一致するパターンがない場合、その処理は何も実行されずスキップされます。た" +"とえば、 ``status`` に 500 が渡された場合、この例では何も起こりません。" #: ../../whatsnew/3.10.rst:524 msgid "Patterns with a literal and variable" -msgstr "" +msgstr "リテラルと変数を組み合わせたパターン" #: ../../whatsnew/3.10.rst:526 msgid "" @@ -788,6 +978,9 @@ msgid "" "bind variables. In this example, a data point can be unpacked to its x-" "coordinate and y-coordinate::" msgstr "" +"パターンはアンパック代入のように記述することで、変数をバインドするために使用" +"することもできます。次の例では、データポイントを展開して、その x 座標と y 座" +"標を取得しています:" #: ../../whatsnew/3.10.rst:530 msgid "" @@ -825,10 +1018,15 @@ msgid "" "(``point``). The fourth pattern captures two values, which makes it " "conceptually similar to the unpacking assignment ``(x, y) = point``." msgstr "" +"最初のパターン ``(0, 0)`` は 2 つのリテラルから構成されており、上で示したリテ" +"ラルパターン拡張と考えることができます。次の 2 つのパターンでは、リテラルと変" +"数が組み合わされており、変数は対象(``point``)から値を取り出して変数にバイン" +"ドします。4 番目のパターンは 2 つの値を同時に取得しており、これはアンパック代" +"入 ``(x, y) = point`` と概念的に似ています。" #: ../../whatsnew/3.10.rst:550 msgid "Patterns and classes" -msgstr "" +msgstr "パターンとクラス" #: ../../whatsnew/3.10.rst:552 msgid "" @@ -836,6 +1034,9 @@ msgid "" "the class name followed by an argument list resembling a constructor. This " "pattern has the ability to capture instance attributes into variables::" msgstr "" +"データを構造化するためにクラスを使用している場合は、クラス名の後ろにコンスト" +"ラクタのように引数リストを指定することで、クラスをパターンとして使用できま" +"す。このパターンでは、インスタンスの属性を変数にバインドすることが可能です:" #: ../../whatsnew/3.10.rst:556 msgid "" @@ -857,12 +1058,28 @@ msgid "" " case _:\n" " print(\"Not a point\")" msgstr "" +"class Point:\n" +" def __init__(self, x, y):\n" +" self.x = x\n" +" self.y = y\n" +"\n" +"def location(point):\n" +" match point:\n" +" case Point(x=0, y=0):\n" +" print(\"原点\")\n" +" case Point(x=0, y=y):\n" +" print(f\"Y座標は {y} で点はY軸上にある\")\n" +" case Point(x=x, y=0):\n" +" print(f\"X座標は {x} で点はX軸上にある\")\n" +" case Point():\n" +" print(\"点は平面上のそれ以外のどこかにある\")\n" +" case _:\n" +" print(\"座標ではない\")" #: ../../whatsnew/3.10.rst:575 msgid "Patterns with positional parameters" -msgstr "" +msgstr "位置パラメータを用いたパターン" -#: ../../whatsnew/3.10.rst:577 msgid "" "You can use positional parameters with some builtin classes that provide an " "ordering for their attributes (e.g. dataclasses). You can also define a " @@ -871,11 +1088,12 @@ msgid "" "\"y\"), the following patterns are all equivalent (and all bind the ``y`` " "attribute to the ``var`` variable)::" msgstr "" -"いくつかの組み込みクラスでは位置引数が使用でき、属性の順番を提供します(例: " -"データクラス)。クラスの ``__match_args__`` 特殊属性でによって、パターンの中で" -"属性の明確な位置を定義することもできます。(\"x\", \"y\")が設定された場合、以" -"下のすべてのパターンは等価です(すべて属性 ``y`` が ``var`` 変数に関連づけられ" -"ます)::" +"属性の順序を定めている一部の組み込みクラス (例えばデータクラス) では、位置パ" +"ラメータを使えます。\n" +"また、クラスの特殊属性 ``__match_args__`` を設定して、パターン内で各属性が占" +"める位置を定義することもできます。\n" +"これを (\"x\", \"y\") に設定した場合、次のパターンはすべて等価で、いずれも属" +"性 ``y`` の値を変数 ``var`` に束縛します。 ::" #: ../../whatsnew/3.10.rst:583 msgid "" @@ -891,13 +1109,15 @@ msgstr "" #: ../../whatsnew/3.10.rst:589 msgid "Nested patterns" -msgstr "" +msgstr "ネストしたパターン" #: ../../whatsnew/3.10.rst:591 msgid "" "Patterns can be arbitrarily nested. For example, if our data is a short " "list of points, it could be matched like this::" msgstr "" +"パターンは任意に入れ子にすることができます。たとえば、データが複数のポイント" +"を含む短いリストである場合、次のようにマッチさせることができます:" #: ../../whatsnew/3.10.rst:594 msgid "" @@ -913,10 +1133,21 @@ msgid "" " case _:\n" " print(\"Something else is found in the list.\")" msgstr "" +"match points:\n" +" case []:\n" +" print(\"リストに座標がない\")\n" +" case [Point(0, 0)]:\n" +" print(\"リスト中には原点が1つのみある\")\n" +" case [Point(x, y)]:\n" +" print(f\"リスト中に {x}, {y} の点が1つある\")\n" +" case [Point(0, y1), Point(0, y2)]:\n" +" print(f\"リスト中にY軸上の2つの点 {y1}、{y2} がある\")\n" +" case _:\n" +" print(\"リスト中にそれ以外のデータが見つかった\")" #: ../../whatsnew/3.10.rst:607 msgid "Complex patterns and the wildcard" -msgstr "" +msgstr "複雑なパターンとワイルドカード" #: ../../whatsnew/3.10.rst:609 msgid "" @@ -924,6 +1155,9 @@ msgid "" "statement. A wildcard can be used in more complex patterns, such as " "``('error', code, _)``. For example::" msgstr "" +"ここまでの例では、最後の case 文で ``_`` を単独のワイルドカードとして使用して" +"きました。しかし、ワイルドカードはより複雑なパターン内でも使用できます。たと" +"えば、 ``('error', code, _)`` のように使用することができます。" #: ../../whatsnew/3.10.rst:613 msgid "" @@ -933,26 +1167,32 @@ msgid "" " case ('error', code, _):\n" " print(f\"An error {code} occurred.\")" msgstr "" +"match test_variable:\n" +" case ('warning', code, 40):\n" +" print(\"警告を受け取った\")\n" +" case ('error', code, _):\n" +" print(f\"エラー {code} が発生した\")" #: ../../whatsnew/3.10.rst:619 msgid "" "In the above case, ``test_variable`` will match for ('error', code, 100) and " "('error', code, 800)." msgstr "" +"上記のケースでは、 ``test_variable`` は ('error', code, 100) と ('error', " +"code, 800) にマッチします。" #: ../../whatsnew/3.10.rst:623 msgid "Guard" -msgstr "" +msgstr "ガード" -#: ../../whatsnew/3.10.rst:625 msgid "" "We can add an ``if`` clause to a pattern, known as a \"guard\". If the " "guard is false, ``match`` goes on to try the next case block. Note that " "value capture happens before the guard is evaluated::" msgstr "" -"パターンに ``if`` 節を追加できます。これは \"ガード\" と呼ばれます。ガードが" -"falseの場合、``match`` は次のcaseブロックの処理に移動します。ガードを評価する" -"前に値が取り出されることに注意してください::" +"パターンには「ガード」と呼ばれる ``if`` 節を追加できます。\n" +"ガードが偽の場合、``match`` は次の case ブロックとのマッチを試みます。\n" +"値の取り込みは、ガードの評価より前に行われます。 ::" #: ../../whatsnew/3.10.rst:629 msgid "" @@ -962,14 +1202,19 @@ msgid "" " case Point(x, y):\n" " print(f\"Point is not on the diagonal.\")" msgstr "" +"match point:\n" +" case Point(x, y) if x == y:\n" +" print(f\"座標は対角線 Y=X 上の {x} の位置にある\")\n" +" case Point(x, y):\n" +" print(f\"座標の位置は対角線上ではない\")" #: ../../whatsnew/3.10.rst:636 msgid "Other Key Features" -msgstr "" +msgstr "その他の主要な機能" #: ../../whatsnew/3.10.rst:638 msgid "Several other key features:" -msgstr "" +msgstr "その他のいくつかの主要な機能:" #: ../../whatsnew/3.10.rst:640 msgid "" @@ -979,6 +1224,11 @@ msgid "" "match iterators. Also, to prevent a common mistake, sequence patterns don't " "match strings." msgstr "" +"アンパック代入と同様に、タプルおよびリストのパターンはまったく同じ意味を持" +"ち、任意のシーケンスにマッチします。技術的には、対象はシーケンスである必要が" +"あります。そのため、重要な例外として、パターンはイテレータにはマッチしませ" +"ん。また、よくある誤りを防ぐために、シーケンスパターンは文字列にもマッチしま" +"せん。" #: ../../whatsnew/3.10.rst:646 msgid "" @@ -987,6 +1237,11 @@ msgid "" "may also be ``_``, so ``(x, y, *_)`` matches a sequence of at least two " "items without binding the remaining items." msgstr "" +"シーケンスパターンではワイルドカードをサポートしています。たとえば、``[x, y, " +"*rest]`` や ``(x, y, *rest)`` は、アンパック代入におけるワイルドカードと同様" +"に動作します。``*`` の後の名前を ``_`` にすることもでき、``(x, y, *_)`` は少" +"なくとも 2 つの要素を持つシーケンスにマッチしますが、残りの要素は変数に束縛さ" +"れません。" #: ../../whatsnew/3.10.rst:651 msgid "" @@ -995,6 +1250,10 @@ msgid "" "patterns, extra keys are ignored. A wildcard ``**rest`` is also supported. " "(But ``**_`` would be redundant, so is not allowed.)" msgstr "" +"マッピングパターン: ``{\"bandwidth\": b, \"latency\": l}`` では、辞書から " +"``\"bandwidth\"`` と ``\"latency\"`` の値を取得します。シーケンスパターンとは" +"異なり、余分なキーは無視されます。また、ワイルドカード ``**rest`` もサポート" +"されています。(ただし、``**_`` は冗長になるため使用できません。)" #: ../../whatsnew/3.10.rst:656 msgid "Subpatterns may be captured using the ``as`` keyword::" @@ -1009,12 +1268,15 @@ msgid "" "This binds x1, y1, x2, y2 like you would expect without the ``as`` clause, " "and p2 to the entire second item of the subject." msgstr "" +"このように書くと x1、y1、x2、y2 は ``as`` 節を使わないときと同様に、さらにp2" +"に対象の2番目の要素全体がバインドされます。" -#: ../../whatsnew/3.10.rst:663 msgid "" "Most literals are compared by equality. However, the singletons ``True``, " "``False`` and ``None`` are compared by identity." msgstr "" +"ほとんどのリテラルは等価性を比較します。\n" +"ただし、シングルトンの ``True``、``False``、``None`` は同一性を比較します。" #: ../../whatsnew/3.10.rst:666 msgid "" @@ -1022,8 +1284,9 @@ msgid "" "dotted names to prevent the constant from being interpreted as a capture " "variable::" msgstr "" +"名前を付けた定数をパターンに使用できます。名前を付けた定数を、値を取り込む変" +"数として解釈することを防ぐために、ドット付きの変数名にする必要があります。" -#: ../../whatsnew/3.10.rst:670 msgid "" "from enum import Enum\n" "class Color(Enum):\n" @@ -1040,125 +1303,156 @@ msgid "" " case Color.BLUE:\n" " print(\"I'm feeling the blues :(\")" msgstr "" +"from enum import Enum\n" +"class Color(Enum):\n" +" RED = 0\n" +" GREEN = 1\n" +" BLUE = 2\n" +"\n" +"color = Color.GREEN\n" +"match color:\n" +" case Color.RED:\n" +" print(\"I see red!\")\n" +" case Color.GREEN:\n" +" print(\"Grass is green\")\n" +" case Color.BLUE:\n" +" print(\"I'm feeling the blues :(\")" #: ../../whatsnew/3.10.rst:685 msgid "" "For the full specification see :pep:`634`. Motivation and rationale are in :" "pep:`635`, and a longer tutorial is in :pep:`636`." msgstr "" +"完全な仕様については :pep:`634` を参照してください。モチベーションと理論的根" +"拠は :pep:`635` に、より詳細なチュートリアルは :pep:`636` にあります。" -#: ../../whatsnew/3.10.rst:692 msgid "Optional ``EncodingWarning`` and ``encoding=\"locale\"`` option" msgstr "" +"任意で有効にする ``EncodingWarning`` と ``encoding=\"locale\"`` オプション" -#: ../../whatsnew/3.10.rst:694 msgid "" "The default encoding of :class:`~io.TextIOWrapper` and :func:`open` is " "platform and locale dependent. Since UTF-8 is used on most Unix platforms, " "omitting ``encoding`` option when opening UTF-8 files (e.g. JSON, YAML, " "TOML, Markdown) is a very common bug. For example::" msgstr "" +":class:`~io.TextIOWrapper` と :func:`open` のデフォルトのエンコーディングは、" +"プラットフォームとロケールに依存します。\n" +"ほとんどの Unix プラットフォームでは UTF-8 を使うため、UTF-8 ファイル (JSON、" +"YAML、TOML、Markdown など) を開くときに ``encoding`` オプションを省略するバグ" +"が非常によく見られます。\n" +"次に例を示します。 ::" -#: ../../whatsnew/3.10.rst:699 msgid "" "# BUG: \"rb\" mode or encoding=\"utf-8\" should be used.\n" "with open(\"data.json\") as f:\n" " data = json.load(f)" msgstr "" +"# バグ: \"rb\" モードまたは encoding=\"utf-8\" を使う必要があります。\n" +"with open(\"data.json\") as f:\n" +" data = json.load(f)" -#: ../../whatsnew/3.10.rst:703 msgid "" "To find this type of bug, an optional ``EncodingWarning`` is added. It is " "emitted when :data:`sys.flags.warn_default_encoding ` is true and " "locale-specific default encoding is used." msgstr "" +"この種のバグを見つけるために、任意で有効にできる ``EncodingWarning`` を追加し" +"ました。\n" +":data:`sys.flags.warn_default_encoding ` が真で、ロケールに依存す" +"るデフォルトのエンコーディングを使った場合に警告されます。" -#: ../../whatsnew/3.10.rst:707 msgid "" "``-X warn_default_encoding`` option and :envvar:`PYTHONWARNDEFAULTENCODING` " "are added to enable the warning." msgstr "" +"警告を有効にする ``-X warn_default_encoding`` オプションと :envvar:" +"`PYTHONWARNDEFAULTENCODING` を追加しました。" -#: ../../whatsnew/3.10.rst:710 msgid "See :ref:`io-text-encoding` for more information." -msgstr "" +msgstr "詳しくは :ref:`io-text-encoding` を参照してください。" #: ../../whatsnew/3.10.rst:715 msgid "New Features Related to Type Hints" msgstr "型ヒントに関連する新しい機能" -#: ../../whatsnew/3.10.rst:717 msgid "" "This section covers major changes affecting :pep:`484` type hints and the :" "mod:`typing` module." msgstr "" +"この節では、:pep:`484` の型ヒントと :mod:`typing` モジュールに関する主な変更" +"を説明します。" -#: ../../whatsnew/3.10.rst:722 msgid "PEP 604: New Type Union Operator" -msgstr "" +msgstr "PEP 604: 新しいユニオン型演算子" -#: ../../whatsnew/3.10.rst:724 msgid "" "A new type union operator was introduced which enables the syntax ``X | Y``. " "This provides a cleaner way of expressing 'either type X or type Y' instead " "of using :class:`typing.Union`, especially in type hints." msgstr "" +"新しいユニオン型演算子を導入し、``X | Y`` 構文を使えるようになりました。\n" +"特に型ヒントで「型 X または型 Y」を表す際に、:class:`typing.Union` よりも簡潔" +"に書けます。" -#: ../../whatsnew/3.10.rst:728 msgid "" "In previous versions of Python, to apply a type hint for functions accepting " "arguments of multiple types, :class:`typing.Union` was used::" msgstr "" +"以前のバージョンの Python では、複数の型の引数を受け取る関数に型ヒントを付け" +"るために :class:`typing.Union` を使っていました。 ::" -#: ../../whatsnew/3.10.rst:731 msgid "" "def square(number: Union[int, float]) -> Union[int, float]:\n" " return number ** 2" msgstr "" +"def square(number: Union[int, float]) -> Union[int, float]:\n" +" return number ** 2" -#: ../../whatsnew/3.10.rst:735 msgid "Type hints can now be written in a more succinct manner::" -msgstr "" +msgstr "型ヒントをより簡潔に書けるようになりました。 ::" -#: ../../whatsnew/3.10.rst:737 msgid "" "def square(number: int | float) -> int | float:\n" " return number ** 2" msgstr "" +"def square(number: int | float) -> int | float:\n" +" return number ** 2" -#: ../../whatsnew/3.10.rst:741 msgid "" "This new syntax is also accepted as the second argument to :func:" "`isinstance` and :func:`issubclass`::" msgstr "" +"この新しい構文は :func:`isinstance` と :func:`issubclass` の第 2 引数でも使え" +"ます。 ::" -#: ../../whatsnew/3.10.rst:744 msgid "" ">>> isinstance(1, int | str)\n" "True" msgstr "" +">>> isinstance(1, int | str)\n" +"True" -#: ../../whatsnew/3.10.rst:747 msgid "See :ref:`types-union` and :pep:`604` for more details." -msgstr "" +msgstr "詳しくは :ref:`types-union` と :pep:`604` を参照してください。" -#: ../../whatsnew/3.10.rst:749 msgid "" "(Contributed by Maggie Moss and Philippe Prados in :issue:`41428`, with " "additions by Yurii Karabas and Serhiy Storchaka in :issue:`44490`.)" msgstr "" +"(Maggie Moss と Philippe Prados による貢献、:issue:`41428`。\n" +"Yurii Karabas と Serhiy Storchaka による追加、:issue:`44490`。)" -#: ../../whatsnew/3.10.rst:754 msgid "PEP 612: Parameter Specification Variables" -msgstr "" +msgstr "PEP 612: パラメータ指定変数" -#: ../../whatsnew/3.10.rst:756 msgid "" "Two new options to improve the information provided to static type checkers " "for :pep:`484`\\ 's ``Callable`` have been added to the :mod:`typing` module." msgstr "" +":pep:`484` の ``Callable`` について静的型チェッカーに提供する情報を改善するた" +"めに、:mod:`typing` モジュールに 2 つの新しい機能を追加しました。" -#: ../../whatsnew/3.10.rst:759 msgid "" "The first is the parameter specification variable. They are used to forward " "the parameter types of one callable to another callable -- a pattern " @@ -1166,33 +1460,46 @@ msgid "" "can be found in :class:`typing.ParamSpec`. Previously, there was no easy way " "to type annotate dependency of parameter types in such a precise manner." msgstr "" +"1 つ目はパラメータ指定変数です。\n" +"ある呼び出し可能オブジェクトのパラメータの型を別の呼び出し可能オブジェクトに" +"引き継ぐために使います。\n" +"これは高階関数やデコレータでよく見られるパターンです。\n" +"使用例は :class:`typing.ParamSpec` にあります。\n" +"以前は、パラメータの型の依存関係をこのように正確に型アノテーションで表す簡単" +"な方法がありませんでした。" -#: ../../whatsnew/3.10.rst:765 msgid "" "The second option is the new ``Concatenate`` operator. It's used in " "conjunction with parameter specification variables to type annotate a higher " "order callable which adds or removes parameters of another callable. " "Examples of usage can be found in :class:`typing.Concatenate`." msgstr "" +"2 つ目は新しい ``Concatenate`` 演算子です。\n" +"パラメータ指定変数と組み合わせて、別の呼び出し可能オブジェクトのパラメータを" +"追加または削除する高階の呼び出し可能オブジェクトに型アノテーションを付けま" +"す。\n" +"使用例は :class:`typing.Concatenate` にあります。" -#: ../../whatsnew/3.10.rst:770 msgid "" "See :class:`typing.Callable`, :class:`typing.ParamSpec`, :class:`typing." "Concatenate`, :class:`typing.ParamSpecArgs`, :class:`typing." "ParamSpecKwargs`, and :pep:`612` for more details." msgstr "" +"詳しくは :class:`typing.Callable`、:class:`typing.ParamSpec`、:class:`typing." +"Concatenate`、:class:`typing.ParamSpecArgs`、:class:`typing." +"ParamSpecKwargs`、:pep:`612` を参照してください。" -#: ../../whatsnew/3.10.rst:774 msgid "" "(Contributed by Ken Jin in :issue:`41559`, with minor enhancements by Jelle " "Zijlstra in :issue:`43783`. PEP written by Mark Mendoza.)" msgstr "" +"(Ken Jin による貢献、:issue:`41559`。\n" +"Jelle Zijlstra による小規模な改善、:issue:`43783`。\n" +"PEP は Mark Mendoza が執筆しました。)" -#: ../../whatsnew/3.10.rst:779 msgid "PEP 613: TypeAlias" -msgstr "" +msgstr "PEP 613: TypeAlias" -#: ../../whatsnew/3.10.rst:781 msgid "" ":pep:`484` introduced the concept of type aliases, only requiring them to be " "top-level unannotated assignments. This simplicity sometimes made it " @@ -1200,77 +1507,96 @@ msgid "" "assignments, especially when forward references or invalid types were " "involved. Compare::" msgstr "" +":pep:`484` では型エイリアスという概念を導入し、トップレベルのアノテーションの" +"ない代入であることだけを要件としていました。\n" +"この単純さのため、特に前方参照や無効な型が含まれる場合、型チェッカーが型エイ" +"リアスと通常の代入を区別しにくいことがありました。\n" +"次の例を比較してください。 ::" -#: ../../whatsnew/3.10.rst:786 msgid "" "StrCache = 'Cache[str]' # a type alias\n" "LOG_PREFIX = 'LOG[DEBUG]' # a module constant" msgstr "" +"StrCache = 'Cache[str]' # 型エイリアス\n" +"LOG_PREFIX = 'LOG[DEBUG]' # モジュールの定数" -#: ../../whatsnew/3.10.rst:789 msgid "" "Now the :mod:`typing` module has a special value :data:`~typing.TypeAlias` " "which lets you declare type aliases more explicitly::" msgstr "" +":mod:`typing` モジュールに特殊な値 :data:`~typing.TypeAlias` を追加し、型エイ" +"リアスをより明示的に宣言できるようにしました。 ::" -#: ../../whatsnew/3.10.rst:792 msgid "" "StrCache: TypeAlias = 'Cache[str]' # a type alias\n" "LOG_PREFIX = 'LOG[DEBUG]' # a module constant" msgstr "" +"StrCache: TypeAlias = 'Cache[str]' # 型エイリアス\n" +"LOG_PREFIX = 'LOG[DEBUG]' # モジュールの定数" #: ../../whatsnew/3.10.rst:795 msgid "See :pep:`613` for more details." msgstr "より詳しくは、 :pep:`613` をご覧ください。" -#: ../../whatsnew/3.10.rst:797 msgid "(Contributed by Mikhail Golubev in :issue:`41923`.)" -msgstr "" +msgstr "(Mikhail Golubev による貢献、:issue:`41923`。)" -#: ../../whatsnew/3.10.rst:800 msgid "PEP 647: User-Defined Type Guards" -msgstr "" +msgstr "PEP 647: ユーザー定義の型ガード" -#: ../../whatsnew/3.10.rst:802 msgid "" ":data:`~typing.TypeGuard` has been added to the :mod:`typing` module to " "annotate type guard functions and improve information provided to static " "type checkers during type narrowing. For more information, please see :data:" "`~typing.TypeGuard`\\ 's documentation, and :pep:`647`." msgstr "" +":mod:`typing` モジュールに :data:`~typing.TypeGuard` を追加しました。\n" +"型ガード関数にアノテーションを付け、型の絞り込み時に静的型チェッカーに提供す" +"る情報を改善できます。\n" +"詳しくは :data:`~typing.TypeGuard` のドキュメントと :pep:`647` を参照してくだ" +"さい。" -#: ../../whatsnew/3.10.rst:807 msgid "" "(Contributed by Ken Jin and Guido van Rossum in :issue:`43766`. PEP written " "by Eric Traut.)" msgstr "" +"(Ken Jin と Guido van Rossum による貢献、:issue:`43766`。\n" +"PEP は Eric Traut が執筆しました。)" #: ../../whatsnew/3.10.rst:811 msgid "Other Language Changes" msgstr "その他の言語変更" -#: ../../whatsnew/3.10.rst:813 msgid "" "The :class:`int` type has a new method :meth:`int.bit_count`, returning the " "number of ones in the binary expansion of a given integer, also known as the " "population count. (Contributed by Niklas Fiekas in :issue:`29882`.)" msgstr "" +":class:`int` 型に新しいメソッド :meth:`int.bit_count` を追加しました。\n" +"整数を 2 進数で表したときの 1 の個数 (population count とも呼ばれます) を返し" +"ます。\n" +"(Niklas Fiekas による貢献、:issue:`29882`。)" -#: ../../whatsnew/3.10.rst:817 msgid "" "The views returned by :meth:`dict.keys`, :meth:`dict.values` and :meth:`dict." "items` now all have a ``mapping`` attribute that gives a :class:`types." "MappingProxyType` object wrapping the original dictionary. (Contributed by " "Dennis Sweeney in :issue:`40890`.)" msgstr "" +":meth:`dict.keys`、:meth:`dict.values`、:meth:`dict.items` が返すビューのすべ" +"てに、``mapping`` 属性を追加しました。\n" +"元の辞書をラップした :class:`types.MappingProxyType` オブジェクトを返しま" +"す。\n" +"(Dennis Sweeney による貢献、:issue:`40890`。)" -#: ../../whatsnew/3.10.rst:822 msgid "" ":pep:`618`: The :func:`zip` function now has an optional ``strict`` flag, " "used to require that all the iterables have an equal length." msgstr "" +":pep:`618`: :func:`zip` 関数にオプションの ``strict`` フラグを追加しまし" +"た。\n" +"すべてのイテラブルの長さが等しいことを要求できます。" -#: ../../whatsnew/3.10.rst:825 msgid "" "Builtin and extension functions that take integer arguments no longer " "accept :class:`~decimal.Decimal`\\ s, :class:`~fractions.Fraction`\\ s and " @@ -1278,21 +1604,30 @@ msgid "" "have the :meth:`~object.__int__` method but do not have the :meth:`~object." "__index__` method). (Contributed by Serhiy Storchaka in :issue:`37999`.)" msgstr "" +"整数の引数を取る組み込み関数や拡張関数は、:class:`~decimal.Decimal`、:class:" +"`~fractions.Fraction` など、情報を失わずに整数に変換できないオブジェクトを受" +"け付けなくなりました。\n" +"例えば :meth:`~object.__int__` メソッドはあっても :meth:`~object.__index__` " +"メソッドがないオブジェクトです。\n" +"(Serhiy Storchaka による貢献、:issue:`37999`。)" -#: ../../whatsnew/3.10.rst:832 msgid "" "If :func:`object.__ipow__` returns :data:`NotImplemented`, the operator will " "correctly fall back to :func:`object.__pow__` and :func:`object.__rpow__` as " "expected. (Contributed by Alex Shkop in :issue:`38302`.)" msgstr "" +":func:`object.__ipow__` が :data:`NotImplemented` を返した場合、演算子は期待" +"どおり :func:`object.__pow__` と :func:`object.__rpow__` に正しくフォールバッ" +"クするようになりました。\n" +"(Alex Shkop による貢献、:issue:`38302`。)" -#: ../../whatsnew/3.10.rst:836 msgid "" "Assignment expressions can now be used unparenthesized within set literals " "and set comprehensions, as well as in sequence indexes (but not slices)." msgstr "" +"集合リテラル、集合内包表記、シーケンスのインデックス (スライスを除く) で、代" +"入式を括弧で囲まずに使えるようになりました。" -#: ../../whatsnew/3.10.rst:839 msgid "" "Functions have a new ``__builtins__`` attribute which is used to look for " "builtin symbols when a function is executed, instead of looking into " @@ -1300,14 +1635,22 @@ msgid "" "``__globals__[\"__builtins__\"]`` if it exists, else from the current " "builtins. (Contributed by Mark Shannon in :issue:`42990`.)" msgstr "" +"関数に新しい ``__builtins__`` 属性を追加しました。\n" +"関数の実行時に組み込みの名前を探す際、``__globals__['__builtins__']`` を調べ" +"る代わりに、この属性を使います。\n" +"``__globals__[\"__builtins__\"]`` が存在する場合はその値で、存在しない場合は" +"現在の組み込みの名前空間で初期化されます。\n" +"(Mark Shannon による貢献、:issue:`42990`。)" -#: ../../whatsnew/3.10.rst:845 msgid "" "Two new builtin functions -- :func:`aiter` and :func:`anext` have been added " "to provide asynchronous counterparts to :func:`iter` and :func:`next`, " "respectively. (Contributed by Joshua Bronson, Daniel Pope, and Justin Wang " "in :issue:`31861`.)" msgstr "" +"組み込み関数 :func:`aiter` と :func:`anext` を追加しました。\n" +"それぞれ :func:`iter` と :func:`next` に対応する非同期版です。\n" +"(Joshua Bronson, Daniel Pope、Justin Wang による貢献、:issue:`31861`。)" #: ../../whatsnew/3.10.rst:850 msgid "" @@ -1319,15 +1662,17 @@ msgid "" "Stinner in :issue:`43682`.)" msgstr "" -#: ../../whatsnew/3.10.rst:857 msgid "" "Annotations for complex targets (everything beside ``simple name`` targets " "defined by :pep:`526`) no longer cause any runtime effects with ``from " "__future__ import annotations``. (Contributed by Batuhan Taskaya in :issue:" "`42737`.)" msgstr "" +"``from __future__ import annotations`` を使った場合、複雑な代入先 (:pep:" +"`526` で定義された ``simple name`` 以外のすべての代入先) のアノテーションは、" +"実行時に何も影響を及ぼさなくなりました。\n" +"(Batuhan Taskaya による貢献、:issue:`42737`。)" -#: ../../whatsnew/3.10.rst:861 msgid "" "Class and module objects now lazy-create empty annotations dicts on demand. " "The annotations dicts are stored in the object’s ``__dict__`` for backwards " @@ -1335,24 +1680,36 @@ msgid "" "``__annotations__``; for more information, please see :ref:`annotations-" "howto`. (Contributed by Larry Hastings in :issue:`43901`.)" msgstr "" +"クラスオブジェクトとモジュールオブジェクトは、必要になった時点で空のアノテー" +"ション辞書を作成するようになりました。\n" +"後方互換性のため、アノテーション辞書はオブジェクトの ``__dict__`` に格納しま" +"す。\n" +"これにより ``__annotations__`` を扱う際のベストプラクティスが改善されます。\n" +"詳しくは :ref:`annotations-howto` を参照してください。\n" +"(Larry Hastings による貢献、:issue:`43901`。)" -#: ../../whatsnew/3.10.rst:868 msgid "" "Annotations consist of ``yield``, ``yield from``, ``await`` or named " "expressions are now forbidden under ``from __future__ import annotations`` " "due to their side effects. (Contributed by Batuhan Taskaya in :issue:" "`42725`.)" msgstr "" +"``from __future__ import annotations`` を使った場合、``yield``、``yield " +"from``、``await``、代入式を含むアノテーションは、副作用があるため禁止されるよ" +"うになりました。\n" +"(Batuhan Taskaya による貢献、:issue:`42725`。)" -#: ../../whatsnew/3.10.rst:873 msgid "" "Usage of unbound variables, ``super()`` and other expressions that might " "alter the processing of symbol table as annotations are now rendered " "effectless under ``from __future__ import annotations``. (Contributed by " "Batuhan Taskaya in :issue:`42725`.)" msgstr "" +"``from __future__ import annotations`` を使った場合、アノテーションでの未束縛" +"の変数、``super()``、その他シンボルテーブルの処理に影響を与えうる式の使用は、" +"影響を与えなくなりました。\n" +"(Batuhan Taskaya による貢献、:issue:`42725`。)" -#: ../../whatsnew/3.10.rst:878 msgid "" "Hashes of NaN values of both :class:`float` type and :class:`decimal." "Decimal` type now depend on object identity. Formerly, they always hashed to " @@ -1361,28 +1718,39 @@ msgid "" "creating dictionaries and sets containing multiple NaNs. (Contributed by " "Raymond Hettinger in :issue:`43475`.)" msgstr "" +":class:`float` 型と :class:`decimal.Decimal` 型の NaN 値のハッシュが、オブ" +"ジェクトの同一性に依存するようになりました。\n" +"以前は NaN 値どうしは等しくないにもかかわらず、ハッシュは常に ``0`` でし" +"た。\n" +"そのため、複数の NaN を含む辞書や集合を作るとハッシュの衝突が多発し、実行時間" +"が要素数の 2 乗に比例する場合がありました。\n" +"(Raymond Hettinger による貢献、:issue:`43475`。)" -#: ../../whatsnew/3.10.rst:885 msgid "" "A :exc:`SyntaxError` (instead of a :exc:`NameError`) will be raised when " "deleting the :const:`__debug__` constant. (Contributed by Donghee Na in :" "issue:`45000`.)" msgstr "" +":const:`__debug__` 定数を削除しようとすると、:exc:`NameError` ではなく :exc:" +"`SyntaxError` が送出されるようになりました。\n" +"(Donghee Na による貢献、:issue:`45000`。)" -#: ../../whatsnew/3.10.rst:888 msgid "" ":exc:`SyntaxError` exceptions now have ``end_lineno`` and ``end_offset`` " "attributes. They will be ``None`` if not determined. (Contributed by Pablo " "Galindo in :issue:`43914`.)" msgstr "" +":exc:`SyntaxError` 例外に ``end_lineno`` 属性と ``end_offset`` 属性を追加しま" +"した。\n" +"値が特定できなかった場合は ``None`` になります。\n" +"(Pablo Galindo による貢献、:issue:`43914`。)" #: ../../whatsnew/3.10.rst:893 msgid "New Modules" msgstr "新たなモジュール" -#: ../../whatsnew/3.10.rst:895 msgid "None." -msgstr "" +msgstr "ありません。" #: ../../whatsnew/3.10.rst:899 msgid "Improved Modules" @@ -1403,48 +1771,55 @@ msgstr "" msgid "argparse" msgstr "argparse" -#: ../../whatsnew/3.10.rst:911 msgid "" "Misleading phrase \"optional arguments\" was replaced with \"options\" in " "argparse help. Some tests might require adaptation if they rely on exact " "output match. (Contributed by Raymond Hettinger in :issue:`9694`.)" msgstr "" +"argparse のヘルプで、誤解を招く \"optional arguments\" という表現を " +"\"options\" に置き換えました。\n" +"出力の完全一致に依存するテストでは、修正が必要になる場合があります。\n" +"(Raymond Hettinger による貢献、:issue:`9694`。)" #: ../../whatsnew/3.10.rst:915 msgid "array" msgstr "array" -#: ../../whatsnew/3.10.rst:917 msgid "" "The :meth:`~array.array.index` method of :class:`array.array` now has " "optional *start* and *stop* parameters. (Contributed by Anders Lorentsen and " "Zackery Spytz in :issue:`31956`.)" msgstr "" +":class:`array.array` の :meth:`~array.array.index` メソッドに、オプションの " +"*start* パラメータと *stop* パラメータを追加しました。\n" +"(Anders Lorentsen と Zackery Spytz による貢献、:issue:`31956`。)" -#: ../../whatsnew/3.10.rst:922 msgid "asynchat, asyncore, smtpd" -msgstr "" +msgstr "asynchat, asyncore, smtpd" -#: ../../whatsnew/3.10.rst:923 msgid "" "These modules have been marked as deprecated in their module documentation " "since Python 3.6. An import-time :class:`DeprecationWarning` has now been " "added to all three of these modules." msgstr "" +"これらのモジュールは Python 3.6 以降、ドキュメントで非推奨とされていまし" +"た。\n" +"3 つのモジュールすべてに、インポート時の :class:`DeprecationWarning` を追加し" +"ました。" #: ../../whatsnew/3.10.rst:928 msgid "base64" msgstr "base64" -#: ../../whatsnew/3.10.rst:930 msgid "" "Add :func:`base64.b32hexencode` and :func:`base64.b32hexdecode` to support " "the Base32 Encoding with Extended Hex Alphabet." msgstr "" +"拡張 16 進アルファベットによる Base32 エンコーディングに対応する :func:" +"`base64.b32hexencode` と :func:`base64.b32hexdecode` を追加しました。" -#: ../../whatsnew/3.10.rst:934 msgid "bdb" -msgstr "" +msgstr "bdb" #: ../../whatsnew/3.10.rst:936 msgid "" @@ -1452,31 +1827,32 @@ msgid "" "(Contributed by Irit Katriel in :issue:`24160`.)" msgstr "" -#: ../../whatsnew/3.10.rst:940 msgid "bisect" -msgstr "" +msgstr "bisect" -#: ../../whatsnew/3.10.rst:942 msgid "" "Added the possibility of providing a *key* function to the APIs in the :mod:" "`bisect` module. (Contributed by Raymond Hettinger in :issue:`4356`.)" msgstr "" +":mod:`bisect` モジュールの API に *key* 関数を渡せるようになりました。\n" +"(Raymond Hettinger による貢献、:issue:`4356`。)" #: ../../whatsnew/3.10.rst:946 msgid "codecs" msgstr "codecs" -#: ../../whatsnew/3.10.rst:948 msgid "" "Add a :func:`codecs.unregister` function to unregister a codec search " "function. (Contributed by Hai Shi in :issue:`41842`.)" msgstr "" +"コーデック検索関数の登録を解除する :func:`codecs.unregister` 関数を追加しまし" +"た。\n" +"(Hai Shi による貢献、:issue:`41842`。)" #: ../../whatsnew/3.10.rst:952 msgid "collections.abc" msgstr "collections.abc" -#: ../../whatsnew/3.10.rst:954 msgid "" "The ``__args__`` of the :ref:`parameterized generic ` " "for :class:`collections.abc.Callable` are now consistent with :data:`typing." @@ -1491,35 +1867,55 @@ msgid "" "may have passed silently in Python 3.9. (Contributed by Ken Jin in :issue:" "`42195`.)" msgstr "" +":class:`collections.abc.Callable` の :ref:`パラメータ化されたジェネリック " +"` の ``__args__`` が、:data:`typing.Callable` と一致する" +"ようになりました。\n" +"ジェネリックの :class:`collections.abc.Callable` は、:data:`typing.Callable` " +"と同様に型引数を平坦化するようになりました。\n" +"つまり、``collections.abc.Callable[[int, str], str]`` の ``__args__`` は " +"``(int, str, str)`` になります。\n" +"以前は ``([int, str], str)`` でした。\n" +"この変更のため、:class:`types.GenericAlias` をサブクラス化できるようにし、:" +"class:`collections.abc.Callable` 型に添字を指定するとサブクラスを返すようにし" +"ました。\n" +"Python 3.9 ではエラーにならなかった :class:`collections.abc.Callable` の無効" +"なパラメータ化で、:exc:`TypeError` が送出される場合があることに注意してくださ" +"い。\n" +"(Ken Jin による貢献、:issue:`42195`。)" #: ../../whatsnew/3.10.rst:967 msgid "contextlib" msgstr "contextlib" -#: ../../whatsnew/3.10.rst:969 msgid "" "Add a :func:`contextlib.aclosing` context manager to safely close async " "generators and objects representing asynchronously released resources. " "(Contributed by Joongi Kim and John Belmonte in :issue:`41229`.)" msgstr "" +"非同期ジェネレータや、非同期に解放するリソースを表すオブジェクトを安全に閉じ" +"るための :func:`contextlib.aclosing` コンテキストマネージャーを追加しまし" +"た。\n" +"(Joongi Kim と John Belmonte による貢献、:issue:`41229`。)" -#: ../../whatsnew/3.10.rst:973 msgid "" "Add asynchronous context manager support to :func:`contextlib.nullcontext`. " "(Contributed by Tom Gringauz in :issue:`41543`.)" msgstr "" +":func:`contextlib.nullcontext` が非同期コンテキストマネージャーに対応しまし" +"た。\n" +"(Tom Gringauz による貢献、:issue:`41543`。)" -#: ../../whatsnew/3.10.rst:976 msgid "" "Add :class:`~contextlib.AsyncContextDecorator`, for supporting usage of " "async context managers as decorators." msgstr "" +"非同期コンテキストマネージャーをデコレータとして使うための :class:" +"`~contextlib.AsyncContextDecorator` を追加しました。" #: ../../whatsnew/3.10.rst:980 msgid "curses" msgstr "curses" -#: ../../whatsnew/3.10.rst:982 msgid "" "The extended color functions added in ncurses 6.1 will be used transparently " "by :func:`curses.color_content`, :func:`curses.init_color`, :func:`curses." @@ -1528,13 +1924,21 @@ msgid "" "provided by the underlying ncurses library. (Contributed by Jeffrey " "Kintscher and Hans Petter Jansson in :issue:`36982`.)" msgstr "" +"ncurses 6.1 で追加された拡張カラー関数を、:func:`curses.color_content`、:" +"func:`curses.init_color`、:func:`curses.init_pair`、:func:`curses." +"pair_content` が透過的に使うようになりました。\n" +"新しい関数 :func:`curses.has_extended_color_support` は、基盤となる ncurses " +"ライブラリが拡張カラーに対応しているかを示します。\n" +"(Jeffrey Kintscher と Hans Petter Jansson による貢献、:issue:`36982`。)" -#: ../../whatsnew/3.10.rst:989 msgid "" "The ``BUTTON5_*`` constants are now exposed in the :mod:`curses` module if " "they are provided by the underlying curses library. (Contributed by Zackery " "Spytz in :issue:`39273`.)" msgstr "" +"基盤となる curses ライブラリが提供している場合、:mod:`curses` モジュールで " +"``BUTTON5_*`` 定数を利用できるようになりました。\n" +"(Zackery Spytz による貢献、:issue:`39273`。)" #: ../../whatsnew/3.10.rst:994 msgid "dataclasses" @@ -1550,22 +1954,21 @@ msgid "" "(Contributed by Yurii Karabas in :issue:`42269`)" msgstr "" -#: ../../whatsnew/3.10.rst:1003 msgid "Keyword-only fields" -msgstr "" +msgstr "キーワード専用フィールド" -#: ../../whatsnew/3.10.rst:1005 msgid "" "dataclasses now supports fields that are keyword-only in the generated " "__init__ method. There are a number of ways of specifying keyword-only " "fields." msgstr "" +"dataclasses が、生成する __init__ メソッドでキーワード専用になるフィールドに" +"対応しました。\n" +"キーワード専用フィールドを指定する方法はいくつかあります。" -#: ../../whatsnew/3.10.rst:1009 msgid "You can say that every field is keyword-only:" -msgstr "" +msgstr "すべてのフィールドをキーワード専用に指定できます:" -#: ../../whatsnew/3.10.rst:1011 msgid "" "from dataclasses import dataclass\n" "\n" @@ -1574,18 +1977,23 @@ msgid "" " name: str\n" " birthday: datetime.date" msgstr "" +"from dataclasses import dataclass\n" +"\n" +"@dataclass(kw_only=True)\n" +"class Birthday:\n" +" name: str\n" +" birthday: datetime.date" -#: ../../whatsnew/3.10.rst:1020 msgid "" "Both ``name`` and ``birthday`` are keyword-only parameters to the generated " "__init__ method." msgstr "" +"生成される __init__ メソッドでは、``name`` と ``birthday`` の両方がキーワード" +"専用パラメータになります。" -#: ../../whatsnew/3.10.rst:1023 msgid "You can specify keyword-only on a per-field basis:" -msgstr "" +msgstr "フィールドごとにキーワード専用を指定することもできます:" -#: ../../whatsnew/3.10.rst:1025 msgid "" "from dataclasses import dataclass, field\n" "\n" @@ -1594,22 +2002,33 @@ msgid "" " name: str\n" " birthday: datetime.date = field(kw_only=True)" msgstr "" +"from dataclasses import dataclass, field\n" +"\n" +"@dataclass\n" +"class Birthday:\n" +" name: str\n" +" birthday: datetime.date = field(kw_only=True)" -#: ../../whatsnew/3.10.rst:1034 msgid "" "Here only ``birthday`` is keyword-only. If you set ``kw_only`` on " "individual fields, be aware that there are rules about re-ordering fields " "due to keyword-only fields needing to follow non-keyword-only fields. See " "the full dataclasses documentation for details." msgstr "" +"この例では ``birthday`` だけがキーワード専用です。\n" +"個々のフィールドで ``kw_only`` を設定する場合、キーワード専用フィールドをそれ" +"以外のフィールドより後に置く必要があるため、フィールドの並べ替えの規則がある" +"ことに注意してください。\n" +"詳しくは dataclasses のドキュメントを参照してください。" -#: ../../whatsnew/3.10.rst:1039 msgid "" "You can also specify that all fields following a KW_ONLY marker are keyword-" "only. This will probably be the most common usage:" msgstr "" +"KW_ONLY マーカー以降のすべてのフィールドをキーワード専用にすることもできま" +"す。\n" +"おそらくこれが最も一般的な使い方になるでしょう:" -#: ../../whatsnew/3.10.rst:1042 msgid "" "from dataclasses import dataclass, KW_ONLY\n" "\n" @@ -1621,18 +2040,28 @@ msgid "" " z: float = 0.0\n" " t: float = 0.0" msgstr "" +"from dataclasses import dataclass, KW_ONLY\n" +"\n" +"@dataclass\n" +"class Point:\n" +" x: float\n" +" y: float\n" +" _: KW_ONLY\n" +" z: float = 0.0\n" +" t: float = 0.0" -#: ../../whatsnew/3.10.rst:1054 msgid "" "Here, ``z`` and ``t`` are keyword-only parameters, while ``x`` and ``y`` are " "not. (Contributed by Eric V. Smith in :issue:`43532`.)" msgstr "" +"この例では ``z`` と ``t`` がキーワード専用パラメータになり、``x`` と ``y`` は" +"そうなりません。\n" +"(Eric V. Smith による貢献、:issue:`43532`。)" #: ../../whatsnew/3.10.rst:1061 msgid "distutils" msgstr "distutils" -#: ../../whatsnew/3.10.rst:1063 msgid "" "The entire ``distutils`` package is deprecated, to be removed in Python " "3.12. Its functionality for specifying package builds has already been " @@ -1644,34 +2073,50 @@ msgid "" "functions should plan to make private copies of the code. Refer to :pep:" "`632` for discussion." msgstr "" +"``distutils`` パッケージ全体を非推奨とし、Python 3.12 で削除する予定です。\n" +"パッケージのビルドを指定する機能は、サードパーティーのパッケージ " +"``setuptools`` と ``packaging`` によってすでに完全に置き換えられています。\n" +"その他のよく使われる API の大半も、標準ライブラリの別の場所 (:mod:" +"`platform`、:mod:`shutil`、:mod:`subprocess`、:mod:`sysconfig` など) で利用で" +"きます。\n" +"``distutils`` のそれ以外の機能を移行する計画はありません。\n" +"それらの機能を使っているアプリケーションでは、コードを独自にコピーして保持す" +"ることを検討してください。\n" +"議論については :pep:`632` を参照してください。" -#: ../../whatsnew/3.10.rst:1073 msgid "" "The ``bdist_wininst`` command deprecated in Python 3.8 has been removed. The " "``bdist_wheel`` command is now recommended to distribute binary packages on " "Windows. (Contributed by Victor Stinner in :issue:`42802`.)" msgstr "" +"Python 3.8 で非推奨となった ``bdist_wininst`` コマンドを削除しました。\n" +"Windows でバイナリパッケージを配布するには、``bdist_wheel`` コマンドを推奨し" +"ます。\n" +"(Victor Stinner による貢献、:issue:`42802`。)" #: ../../whatsnew/3.10.rst:1079 msgid "doctest" msgstr "doctest" -#: ../../whatsnew/3.10.rst:1081 ../../whatsnew/3.10.rst:1216 -#: ../../whatsnew/3.10.rst:1243 ../../whatsnew/3.10.rst:1342 msgid "" "When a module does not define ``__loader__``, fall back to ``__spec__." "loader``. (Contributed by Brett Cannon in :issue:`42133`.)" msgstr "" +"モジュールに ``__loader__`` が定義されていない場合、``__spec__.loader`` に" +"フォールバックします。\n" +"(Brett Cannon による貢献、:issue:`42133`。)" #: ../../whatsnew/3.10.rst:1085 msgid "encodings" msgstr "エンコーディング" -#: ../../whatsnew/3.10.rst:1087 msgid "" ":func:`encodings.normalize_encoding` now ignores non-ASCII characters. " "(Contributed by Hai Shi in :issue:`39337`.)" msgstr "" +":func:`encodings.normalize_encoding` が非 ASCII 文字を無視するようになりまし" +"た。\n" +"(Hai Shi による貢献、:issue:`39337`。)" #: ../../whatsnew/3.10.rst:1091 msgid "enum" @@ -1695,96 +2140,117 @@ msgstr "" msgid "fileinput" msgstr "fileinput" -#: ../../whatsnew/3.10.rst:1104 msgid "" "Add *encoding* and *errors* parameters in :func:`fileinput.input` and :class:" "`fileinput.FileInput`. (Contributed by Inada Naoki in :issue:`43712`.)" msgstr "" +":func:`fileinput.input` と :class:`fileinput.FileInput` に *encoding* パラ" +"メータと *errors* パラメータを追加しました。\n" +"(Inada Naoki による貢献、:issue:`43712`。)" -#: ../../whatsnew/3.10.rst:1108 msgid "" ":func:`fileinput.hook_compressed` now returns :class:`~io.TextIOWrapper` " "object when *mode* is \"r\" and file is compressed, like uncompressed files. " "(Contributed by Inada Naoki in :issue:`5758`.)" msgstr "" +"*mode* が \"r\" でファイルが圧縮されている場合、:func:`fileinput." +"hook_compressed` は非圧縮ファイルの場合と同様に :class:`~io.TextIOWrapper` オ" +"ブジェクトを返すようになりました。\n" +"(Inada Naoki による貢献、:issue:`5758`。)" #: ../../whatsnew/3.10.rst:1113 msgid "faulthandler" msgstr "faulthandler" -#: ../../whatsnew/3.10.rst:1115 msgid "" "The :mod:`faulthandler` module now detects if a fatal error occurs during a " "garbage collector collection. (Contributed by Victor Stinner in :issue:" "`44466`.)" msgstr "" +":mod:`faulthandler` モジュールが、ガベージコレクション中に致命的なエラーが発" +"生したかどうかを検出するようになりました。\n" +"(Victor Stinner による貢献、:issue:`44466`。)" #: ../../whatsnew/3.10.rst:1120 msgid "gc" msgstr "gc" -#: ../../whatsnew/3.10.rst:1122 msgid "" "Add audit hooks for :func:`gc.get_objects`, :func:`gc.get_referrers` and :" "func:`gc.get_referents`. (Contributed by Pablo Galindo in :issue:`43439`.)" msgstr "" +":func:`gc.get_objects`、:func:`gc.get_referrers`、:func:`gc.get_referents` に" +"監査フックを追加しました。\n" +"(Pablo Galindo による貢献、:issue:`43439`。)" #: ../../whatsnew/3.10.rst:1126 msgid "glob" msgstr "glob" -#: ../../whatsnew/3.10.rst:1128 msgid "" "Add the *root_dir* and *dir_fd* parameters in :func:`~glob.glob` and :func:" "`~glob.iglob` which allow to specify the root directory for searching. " "(Contributed by Serhiy Storchaka in :issue:`38144`.)" msgstr "" +":func:`~glob.glob` と :func:`~glob.iglob` に *root_dir* パラメータと " +"*dir_fd* パラメータを追加しました。\n" +"検索の起点となるディレクトリを指定できます。\n" +"(Serhiy Storchaka による貢献、:issue:`38144`。)" #: ../../whatsnew/3.10.rst:1133 msgid "hashlib" msgstr "hashlib" -#: ../../whatsnew/3.10.rst:1135 msgid "" "The hashlib module requires OpenSSL 1.1.1 or newer. (Contributed by " "Christian Heimes in :pep:`644` and :issue:`43669`.)" msgstr "" +"hashlib モジュールには OpenSSL 1.1.1 以降が必要になりました。\n" +"(Christian Heimes による貢献、:pep:`644` と :issue:`43669`。)" -#: ../../whatsnew/3.10.rst:1138 msgid "" "The hashlib module has preliminary support for OpenSSL 3.0.0. (Contributed " "by Christian Heimes in :issue:`38820` and other issues.)" msgstr "" +"hashlib モジュールに OpenSSL 3.0.0 の予備的なサポートを追加しました。\n" +"(Christian Heimes による貢献、:issue:`38820` など。)" -#: ../../whatsnew/3.10.rst:1141 msgid "" "The pure-Python fallback of :func:`~hashlib.pbkdf2_hmac` is deprecated. In " "the future PBKDF2-HMAC will only be available when Python has been built " "with OpenSSL support. (Contributed by Christian Heimes in :issue:`43880`.)" msgstr "" +":func:`~hashlib.pbkdf2_hmac` の Python のみで書かれたフォールバック実装を非推" +"奨としました。\n" +"将来、PBKDF2-HMAC は OpenSSL をサポートする構成でビルドした Python でのみ利用" +"できるようになります。\n" +"(Christian Heimes による貢献、:issue:`43880`。)" #: ../../whatsnew/3.10.rst:1147 msgid "hmac" msgstr "hmac" -#: ../../whatsnew/3.10.rst:1149 msgid "" "The hmac module now uses OpenSSL's HMAC implementation internally. " "(Contributed by Christian Heimes in :issue:`40645`.)" msgstr "" +"hmac モジュールが内部で OpenSSL の HMAC 実装を使うようになりました。\n" +"(Christian Heimes による貢献、:issue:`40645`。)" #: ../../whatsnew/3.10.rst:1153 msgid "IDLE and idlelib" msgstr "IDLE と idelelib" -#: ../../whatsnew/3.10.rst:1155 msgid "" "Make IDLE invoke :func:`sys.excepthook` (when started without '-n'). User " "hooks were previously ignored. (Contributed by Ken Hilton in :issue:" "`43008`.)" msgstr "" +"IDLE が ('-n' なしで起動した場合に) :func:`sys.excepthook` を呼び出すようにし" +"ました。\n" +"以前はユーザーのフックを無視していました。\n" +"(Ken Hilton による貢献、:issue:`43008`。)" -#: ../../whatsnew/3.10.rst:1159 msgid "" "Rearrange the settings dialog. Split the General tab into Windows and Shell/" "Ed tabs. Move help sources, which extend the Help menu, to the Extensions " @@ -1794,12 +2260,19 @@ msgid "" "Windows tab. (Contributed by Mark Roseman and Terry Jan Reedy in :issue:" "`33962`.)" msgstr "" +"設定ダイアログを再配置しました。\n" +"General タブを Windows タブと Shell/Ed タブに分け、Help メニューを拡張するヘ" +"ルプの参照先を Extensions タブに移動しました。\n" +"新しいオプション用のスペースを確保するとともにダイアログを短くし、小さな画面" +"にも収まりやすくしました。\n" +"(Terry Jan Reedy による貢献、:issue:`40468`。)\n" +"インデントのスペース数の設定を Font タブから新しい Windows タブに移動しまし" +"た。\n" +"(Mark Roseman と Terry Jan Reedy による貢献、:issue:`33962`。)" -#: ../../whatsnew/3.10.rst:1167 msgid "The changes above were backported to a 3.9 maintenance release." -msgstr "" +msgstr "上記の変更は 3.9 のメンテナンスリリースにバックポートされました。" -#: ../../whatsnew/3.10.rst:1169 msgid "" "Add a Shell sidebar. Move the primary prompt ('>>>') to the sidebar. Add " "secondary prompts ('...') to the sidebar. Left click and optional drag " @@ -1809,16 +2282,29 @@ msgid "" "the selected text. This option also appears on the context menu for the " "text. (Contributed by Tal Einat in :issue:`37903`.)" msgstr "" +"シェルのサイドバーを追加しました。\n" +"プライマリプロンプト ('>>>') をサイドバーに移動し、セカンダリプロンプト " +"('...') もサイドバーに追加しました。\n" +"エディタの行番号のサイドバーと同様に、左クリックやドラッグで 1 行以上のテキス" +"トを選択できます。\n" +"行を選択してから右クリックすると、コンテキストメニューに 'copy with prompts' " +"が表示されます。\n" +"これはサイドバーのプロンプトと選択したテキストの各行を組み合わせてコピーしま" +"す。\n" +"このオプションはテキストのコンテキストメニューにも表示されます。\n" +"(Tal Einat による貢献、:issue:`37903`。)" -#: ../../whatsnew/3.10.rst:1178 msgid "" "Use spaces instead of tabs to indent interactive code. This makes " "interactive code entries 'look right'. Making this feasible was a major " "motivation for adding the shell sidebar. (Contributed by Terry Jan Reedy " "in :issue:`37892`.)" msgstr "" +"対話的なコードのインデントにタブではなくスペースを使うようにしました。\n" +"これにより、入力した対話的なコードの表示が適切になります。\n" +"これを実現することが、シェルのサイドバーを追加した主な動機でした。\n" +"(Terry Jan Reedy による貢献、:issue:`37892`。)" -#: ../../whatsnew/3.10.rst:1183 msgid "" "Highlight the new :ref:`soft keywords ` :keyword:`match`, :" "keyword:`case `, and :keyword:`_ ` in pattern-" @@ -1826,53 +2312,66 @@ msgid "" "incorrect in some rare cases, including some ``_``-s in ``case`` patterns. " "(Contributed by Tal Einat in :issue:`44010`.)" msgstr "" +"パターンマッチ文で新しい :ref:`ソフトキーワード ` :keyword:" +"`match`、:keyword:`case `、:keyword:`_ ` を強調表示" +"するようにしました。\n" +"ただし、この強調表示は完全ではなく、``case`` パターン内の一部の ``_`` など、" +"まれな場合に誤った表示になります。\n" +"(Tal Einat による貢献、:issue:`44010`。)" -#: ../../whatsnew/3.10.rst:1189 msgid "New in 3.10 maintenance releases." -msgstr "" +msgstr "3.10 のメンテナンスリリースで追加した変更です。" -#: ../../whatsnew/3.10.rst:1191 msgid "" "Apply syntax highlighting to ``.pyi`` files. (Contributed by Alex Waygood " "and Terry Jan Reedy in :issue:`45447`.)" msgstr "" +"``.pyi`` ファイルに構文強調表示を適用するようになりました。\n" +"(Alex Waygood and Terry Jan Reedy による :issue:`45447` での貢献。)" -#: ../../whatsnew/3.10.rst:1194 msgid "" "Include prompts when saving Shell with inputs and outputs. (Contributed by " "Terry Jan Reedy in :gh:`95191`.)" msgstr "" +"入力と出力を含む Shell の内容を保存する際、プロンプトも含めるようになりまし" +"た。\n" +"(Terry Jan Reedy による :gh:`95191` での貢献。)" -#: ../../whatsnew/3.10.rst:1198 msgid "importlib.metadata" -msgstr "" +msgstr "importlib.metadata" -#: ../../whatsnew/3.10.rst:1200 msgid "" "Feature parity with ``importlib_metadata`` 4.6 (`history `_)." msgstr "" +"``importlib_metadata`` 4.6 と同等の機能になりました (`履歴 `_)。" -#: ../../whatsnew/3.10.rst:1203 msgid "" ":ref:`importlib.metadata entry points ` now provide a nicer " "experience for selecting entry points by group and name through a new :ref:" "`importlib.metadata.EntryPoints ` class. See the Compatibility " "Note in the docs for more info on the deprecation and usage." msgstr "" +":ref:`importlib.metadata のエントリーポイント ` が、新しい :" +"ref:`importlib.metadata.EntryPoints ` クラスを通じて、グループ" +"や名前でエントリーポイントを選びやすくなりました。\n" +"非推奨化と使い方の詳細は、ドキュメントの互換性に関する注記を参照してくださ" +"い。" -#: ../../whatsnew/3.10.rst:1209 msgid "" "Added :ref:`importlib.metadata.packages_distributions() ` for resolving top-level Python modules and packages to " "their :ref:`importlib.metadata.Distribution `." msgstr "" +"トップレベルの Python モジュールやパッケージに対応する :ref:`importlib." +"metadata.Distribution ` を調べるための、:ref:`importlib." +"metadata.packages_distributions() ` を追加しました。" #: ../../whatsnew/3.10.rst:1214 msgid "inspect" msgstr "inspect" -#: ../../whatsnew/3.10.rst:1219 msgid "" "Add :func:`inspect.get_annotations`, which safely computes the annotations " "defined on an object. It works around the quirks of accessing the " @@ -1889,16 +2388,33 @@ msgid "" "stringize stringized annotations. (Contributed by Larry Hastings in :issue:" "`43817`.)" msgstr "" +"オブジェクトに定義されたアノテーションを安全に取得する :func:`inspect." +"get_annotations` を追加しました。\n" +"さまざまな種類のオブジェクトのアノテーションにアクセスする際の特殊な挙動に対" +"処し、調べるオブジェクトについてほとんど仮定を置きません。\n" +":func:`inspect.get_annotations` は文字列化されたアノテーションを正しく元に戻" +"すこともできます。\n" +"任意の Python オブジェクトに定義されたアノテーション辞書にアクセスするには、:" +"func:`inspect.get_annotations` を使うのがベストプラクティスになりました。\n" +"アノテーションを扱う際のベストプラクティスについては :ref:`annotations-" +"howto` を参照してください。\n" +"関連する変更として、:func:`inspect.signature`、:func:`inspect.Signature." +"from_callable`、:func:`!inspect.Signature.from_function` が :func:`inspect." +"get_annotations` を呼び出してアノテーションを取得するようになりました。\n" +"このため :func:`inspect.signature` と :func:`inspect.Signature." +"from_callable` も文字列化されたアノテーションを元に戻せるようになりました。\n" +"(Larry Hastings による貢献、:issue:`43817`。)" #: ../../whatsnew/3.10.rst:1235 msgid "itertools" msgstr "itertools" -#: ../../whatsnew/3.10.rst:1237 msgid "" "Add :func:`itertools.pairwise`. (Contributed by Raymond Hettinger in :issue:" "`38200`.)" msgstr "" +":func:`itertools.pairwise` を追加しました。\n" +"(Raymond Hettinger による貢献、:issue:`38200`。)" #: ../../whatsnew/3.10.rst:1241 msgid "linecache" @@ -1908,148 +2424,186 @@ msgstr "linecache" msgid "os" msgstr "os" -#: ../../whatsnew/3.10.rst:1249 msgid "" "Add :func:`os.cpu_count` support for VxWorks RTOS. (Contributed by Peixing " "Xin in :issue:`41440`.)" msgstr "" +"VxWorks RTOS で :func:`os.cpu_count` を使えるようにしました。\n" +"(Peixing Xin による貢献、:issue:`41440`。)" -#: ../../whatsnew/3.10.rst:1252 msgid "" "Add a new function :func:`os.eventfd` and related helpers to wrap the " "``eventfd2`` syscall on Linux. (Contributed by Christian Heimes in :issue:" "`41001`.)" msgstr "" +"Linux の ``eventfd2`` システムコールをラップする、新しい関数 :func:`os." +"eventfd` と関連する補助関数を追加しました。\n" +"(Christian Heimes による貢献、:issue:`41001`。)" -#: ../../whatsnew/3.10.rst:1256 msgid "" "Add :func:`os.splice` that allows to move data between two file descriptors " "without copying between kernel address space and user address space, where " "one of the file descriptors must refer to a pipe. (Contributed by Pablo " "Galindo in :issue:`41625`.)" msgstr "" +"カーネル空間とユーザー空間の間でコピーせずに、2 つのファイル記述子の間でデー" +"タを移動する :func:`os.splice` を追加しました。\n" +"いずれかのファイル記述子がパイプを参照している必要があります。\n" +"(Pablo Galindo による貢献、:issue:`41625`。)" -#: ../../whatsnew/3.10.rst:1261 msgid "" "Add :const:`~os.O_EVTONLY`, :const:`~os.O_FSYNC`, :const:`~os.O_SYMLINK` " "and :const:`~os.O_NOFOLLOW_ANY` for macOS. (Contributed by Donghee Na in :" "issue:`43106`.)" msgstr "" +"macOS 向けに :const:`~os.O_EVTONLY`、:const:`~os.O_FSYNC`、:const:`~os." +"O_SYMLINK`、:const:`~os.O_NOFOLLOW_ANY` を追加しました。\n" +"(Donghee Na による貢献、:issue:`43106`。)" #: ../../whatsnew/3.10.rst:1266 msgid "os.path" msgstr "os.path" -#: ../../whatsnew/3.10.rst:1268 msgid "" ":func:`os.path.realpath` now accepts a *strict* keyword-only argument. When " "set to ``True``, :exc:`OSError` is raised if a path doesn't exist or a " "symlink loop is encountered. (Contributed by Barney Gale in :issue:`43757`.)" msgstr "" +":func:`os.path.realpath` にキーワード専用引数 *strict* を追加しました。\n" +"``True`` を指定すると、パスが存在しない場合やシンボリックリンクの循環が見つ" +"かった場合に :exc:`OSError` を送出します。\n" +"(Barney Gale による貢献、:issue:`43757`。)" #: ../../whatsnew/3.10.rst:1274 msgid "pathlib" msgstr "pathlib" -#: ../../whatsnew/3.10.rst:1276 msgid "" "Add slice support to :attr:`PurePath.parents `. " "(Contributed by Joshua Cannon in :issue:`35498`.)" msgstr "" +":attr:`PurePath.parents ` がスライスに対応しまし" +"た。\n" +"(Joshua Cannon による貢献、:issue:`35498`。)" -#: ../../whatsnew/3.10.rst:1279 msgid "" "Add negative indexing support to :attr:`PurePath.parents `. (Contributed by Yaroslav Pankovych in :issue:`21041`.)" msgstr "" +":attr:`PurePath.parents ` が負のインデックスに対応" +"しました。\n" +"(Yaroslav Pankovych による貢献、:issue:`21041`。)" -#: ../../whatsnew/3.10.rst:1283 msgid "" "Add :meth:`Path.hardlink_to ` method that " "supersedes :meth:`!link_to`. The new method has the same argument order as :" "meth:`~pathlib.Path.symlink_to`. (Contributed by Barney Gale in :issue:" "`39950`.)" msgstr "" +":meth:`!link_to` に代わる :meth:`Path.hardlink_to ` メソッドを追加しました。\n" +"新しいメソッドの引数の順序は :meth:`~pathlib.Path.symlink_to` と同じです。\n" +"(Barney Gale による貢献、:issue:`39950`。)" -#: ../../whatsnew/3.10.rst:1288 msgid "" ":meth:`pathlib.Path.stat` and :meth:`~pathlib.Path.chmod` now accept a " "*follow_symlinks* keyword-only argument for consistency with corresponding " "functions in the :mod:`os` module. (Contributed by Barney Gale in :issue:" "`39906`.)" msgstr "" +":mod:`os` モジュールの対応する関数と一致させるため、:meth:`pathlib.Path." +"stat` と :meth:`~pathlib.Path.chmod` にキーワード専用引数 *follow_symlinks* " +"を追加しました。\n" +"(Barney Gale による貢献、:issue:`39906`。)" -#: ../../whatsnew/3.10.rst:1294 msgid "platform" -msgstr "プラットフォーム" +msgstr "platform" -#: ../../whatsnew/3.10.rst:1296 msgid "" "Add :func:`platform.freedesktop_os_release` to retrieve operation system " "identification from `freedesktop.org os-release `_ standard file. (Contributed by " "Christian Heimes in :issue:`28468`.)" msgstr "" +"`freedesktop.org os-release `_ 規格のファイルからオペレーティングシステムの識別情報を" +"取得する :func:`platform.freedesktop_os_release` を追加しました。\n" +"(Christian Heimes による貢献、:issue:`28468`。)" #: ../../whatsnew/3.10.rst:1302 msgid "pprint" msgstr "pprint" -#: ../../whatsnew/3.10.rst:1304 msgid "" ":func:`pprint.pprint` now accepts a new ``underscore_numbers`` keyword " "argument. (Contributed by sblondon in :issue:`42914`.)" msgstr "" +":func:`pprint.pprint` に新しいキーワード引数 ``underscore_numbers`` を追加し" +"ました。\n" +"(sblondon による貢献、:issue:`42914`。)" -#: ../../whatsnew/3.10.rst:1307 msgid "" ":mod:`pprint` can now pretty-print :class:`dataclasses.dataclass` instances. " "(Contributed by Lewis Gaul in :issue:`43080`.)" msgstr "" +":mod:`pprint` が :class:`dataclasses.dataclass` のインスタンスを整形して表示" +"できるようになりました。\n" +"(Lewis Gaul による貢献、:issue:`43080`。)" #: ../../whatsnew/3.10.rst:1311 msgid "py_compile" msgstr "py_compile" -#: ../../whatsnew/3.10.rst:1313 msgid "" "Add ``--quiet`` option to command-line interface of :mod:`py_compile`. " "(Contributed by Gregory Schevchenko in :issue:`38731`.)" msgstr "" +":mod:`py_compile` のコマンドラインインターフェースに ``--quiet`` オプションを" +"追加しました。\n" +"(Gregory Schevchenko による貢献、:issue:`38731`。)" -#: ../../whatsnew/3.10.rst:1317 msgid "pyclbr" -msgstr "" +msgstr "pyclbr" -#: ../../whatsnew/3.10.rst:1319 msgid "" "Add an ``end_lineno`` attribute to the ``Function`` and ``Class`` objects in " "the tree returned by :func:`pyclbr.readmodule` and :func:`pyclbr." "readmodule_ex`. It matches the existing (start) ``lineno``. (Contributed by " "Aviral Srivastava in :issue:`38307`.)" msgstr "" +":func:`pyclbr.readmodule` と :func:`pyclbr.readmodule_ex` が返すツリー内の " +"``Function`` オブジェクトと ``Class`` オブジェクトに、``end_lineno`` 属性を追" +"加しました。\n" +"既存の (開始行を表す) ``lineno`` に対応します。\n" +"(Aviral Srivastava による貢献、:issue:`38307`。)" #: ../../whatsnew/3.10.rst:1325 msgid "shelve" msgstr "shelve" -#: ../../whatsnew/3.10.rst:1327 msgid "" "The :mod:`shelve` module now uses :const:`pickle.DEFAULT_PROTOCOL` by " "default instead of :mod:`pickle` protocol ``3`` when creating shelves. " "(Contributed by Zackery Spytz in :issue:`34204`.)" msgstr "" +":mod:`shelve` モジュールが棚を作成するとき、デフォルトで :mod:`pickle` のプロ" +"トコル ``3`` の代わりに :const:`pickle.DEFAULT_PROTOCOL` を使うようになりまし" +"た。\n" +"(Zackery Spytz による貢献、:issue:`34204`。)" #: ../../whatsnew/3.10.rst:1332 msgid "statistics" msgstr "statistics" -#: ../../whatsnew/3.10.rst:1334 msgid "" "Add :func:`~statistics.covariance`, Pearson's :func:`~statistics." "correlation`, and simple :func:`~statistics.linear_regression` functions. " "(Contributed by Tymoteusz Wołodźko in :issue:`38490`.)" msgstr "" +"共分散を求める :func:`~statistics.covariance`、ピアソンの相関係数を求める :" +"func:`~statistics.correlation`、単回帰を行う :func:`~statistics." +"linear_regression` を追加しました。\n" +"(Tymoteusz Wołodźko による貢献、:issue:`38490`。)" #: ../../whatsnew/3.10.rst:1340 msgid "site" @@ -2059,43 +2613,52 @@ msgstr "site" msgid "socket" msgstr "socket" -#: ../../whatsnew/3.10.rst:1348 msgid "" "The exception :exc:`socket.timeout` is now an alias of :exc:`TimeoutError`. " "(Contributed by Christian Heimes in :issue:`42413`.)" msgstr "" +":exc:`socket.timeout` 例外が :exc:`TimeoutError` の別名になりました。\n" +"(Christian Heimes による貢献、:issue:`42413`。)" -#: ../../whatsnew/3.10.rst:1351 msgid "" "Add option to create MPTCP sockets with ``IPPROTO_MPTCP`` (Contributed by " "Rui Cunha in :issue:`43571`.)" msgstr "" +"``IPPROTO_MPTCP`` を使って MPTCP ソケットを作成するオプションを追加しまし" +"た。\n" +"(Rui Cunha による貢献、:issue:`43571`。)" -#: ../../whatsnew/3.10.rst:1354 msgid "" "Add ``IP_RECVTOS`` option to receive the type of service (ToS) or DSCP/ECN " "fields (Contributed by Georg Sauthoff in :issue:`44077`.)" msgstr "" +"サービスタイプ (ToS) または DSCP/ECN フィールドを受信する ``IP_RECVTOS`` オプ" +"ションを追加しました。\n" +"(Georg Sauthoff による貢献、:issue:`44077`。)" #: ../../whatsnew/3.10.rst:1358 msgid "ssl" msgstr "ssl" -#: ../../whatsnew/3.10.rst:1360 msgid "" "The ssl module requires OpenSSL 1.1.1 or newer. (Contributed by Christian " "Heimes in :pep:`644` and :issue:`43669`.)" msgstr "" +"ssl モジュールには OpenSSL 1.1.1 以降が必要になりました。\n" +"(Christian Heimes による貢献、:pep:`644` と :issue:`43669`。)" -#: ../../whatsnew/3.10.rst:1363 msgid "" "The ssl module has preliminary support for OpenSSL 3.0.0 and new option :" "const:`~ssl.OP_IGNORE_UNEXPECTED_EOF`. (Contributed by Christian Heimes in :" "issue:`38820`, :issue:`43794`, :issue:`43788`, :issue:`43791`, :issue:" "`43799`, :issue:`43920`, :issue:`43789`, and :issue:`43811`.)" msgstr "" +"ssl モジュールに OpenSSL 3.0.0 の予備的なサポートと、新しいオプション :const:" +"`~ssl.OP_IGNORE_UNEXPECTED_EOF` を追加しました。\n" +"(Christian Heimes による貢献、:issue:`38820`、:issue:`43794`、:issue:" +"`43788`、:issue:`43791`、:issue:`43799`、:issue:`43920`、:issue:`43789`、:" +"issue:`43811`。)" -#: ../../whatsnew/3.10.rst:1369 msgid "" "Deprecated function and use of deprecated constants now result in a :exc:" "`DeprecationWarning`. :attr:`ssl.SSLContext.options` has :data:`~ssl." @@ -2104,6 +2667,14 @@ msgid "" "` has a list of deprecated features. (Contributed by " "Christian Heimes in :issue:`43880`.)" msgstr "" +"非推奨の関数や定数を使うと :exc:`DeprecationWarning` が発生するようになりまし" +"た。\n" +":attr:`ssl.SSLContext.options` ではデフォルトで :data:`~ssl.OP_NO_SSLv2` と :" +"data:`~ssl.OP_NO_SSLv3` が設定されているため、これらのフラグを再設定しても警" +"告できません。\n" +"非推奨の機能の一覧は :ref:`非推奨の節 ` にありま" +"す。\n" +"(Christian Heimes による貢献、:issue:`43880`。)" #: ../../whatsnew/3.10.rst:1377 msgid "" @@ -2115,31 +2686,39 @@ msgid "" "`43998`.)" msgstr "" -#: ../../whatsnew/3.10.rst:1384 msgid "" "The deprecated protocols SSL 3.0, TLS 1.0, and TLS 1.1 are no longer " "officially supported. Python does not block them actively. However OpenSSL " "build options, distro configurations, vendor patches, and cipher suites may " "prevent a successful handshake." msgstr "" +"非推奨のプロトコル SSL 3.0、TLS 1.0、TLS 1.1 は、公式にはサポートされなくなり" +"ました。\n" +"Python 自体がこれらを積極的にブロックするわけではありません。\n" +"ただし、OpenSSL のビルドオプション、ディストリビューションの設定、ベンダーの" +"パッチ、暗号スイートによっては、ハンドシェイクが成功しない場合があります。" -#: ../../whatsnew/3.10.rst:1389 msgid "" "Add a *timeout* parameter to the :func:`ssl.get_server_certificate` " "function. (Contributed by Zackery Spytz in :issue:`31870`.)" msgstr "" +":func:`ssl.get_server_certificate` 関数に *timeout* パラメータを追加しまし" +"た。\n" +"(Zackery Spytz による貢献、:issue:`31870`。)" -#: ../../whatsnew/3.10.rst:1392 msgid "" "The ssl module uses heap-types and multi-phase initialization. (Contributed " "by Christian Heimes in :issue:`42333`.)" msgstr "" +"ssl モジュールがヒープ型と複数フェーズの初期化を使うようになりました。\n" +"(Christian Heimes による貢献、:issue:`42333`。)" -#: ../../whatsnew/3.10.rst:1395 msgid "" "A new verify flag :const:`~ssl.VERIFY_X509_PARTIAL_CHAIN` has been added. " "(Contributed by l0x in :issue:`40849`.)" msgstr "" +"新しい検証フラグ :const:`~ssl.VERIFY_X509_PARTIAL_CHAIN` を追加しました。\n" +"(l0x による貢献、:issue:`40849`。)" #: ../../whatsnew/3.10.rst:1399 msgid "sqlite3" @@ -2156,59 +2735,74 @@ msgstr "" msgid "sys" msgstr "sys" -#: ../../whatsnew/3.10.rst:1409 msgid "" "Add :data:`sys.orig_argv` attribute: the list of the original command line " "arguments passed to the Python executable. (Contributed by Victor Stinner " "in :issue:`23427`.)" msgstr "" +":data:`sys.orig_argv` 属性を追加しました。\n" +"Python 実行ファイルに渡された元のコマンドライン引数のリストです。\n" +"(Victor Stinner による貢献、:issue:`23427`。)" -#: ../../whatsnew/3.10.rst:1413 msgid "" "Add :data:`sys.stdlib_module_names`, containing the list of the standard " "library module names. (Contributed by Victor Stinner in :issue:`42955`.)" msgstr "" +"標準ライブラリのモジュール名の一覧を格納する :data:`sys.stdlib_module_names` " +"を追加しました。\n" +"(Victor Stinner による貢献、:issue:`42955`。)" #: ../../whatsnew/3.10.rst:1418 msgid "_thread" msgstr "_thread" -#: ../../whatsnew/3.10.rst:1420 msgid "" ":func:`_thread.interrupt_main` now takes an optional signal number to " "simulate (the default is still :const:`signal.SIGINT`). (Contributed by " "Antoine Pitrou in :issue:`43356`.)" msgstr "" +":func:`_thread.interrupt_main` に、模擬的に発生させるシグナルの番号をオプショ" +"ンで指定できるようになりました。\n" +"デフォルトは従来どおり :const:`signal.SIGINT` です。\n" +"(Antoine Pitrou による貢献、:issue:`43356`。)" #: ../../whatsnew/3.10.rst:1425 msgid "threading" msgstr "threading" -#: ../../whatsnew/3.10.rst:1427 msgid "" "Add :func:`threading.gettrace` and :func:`threading.getprofile` to retrieve " "the functions set by :func:`threading.settrace` and :func:`threading." "setprofile` respectively. (Contributed by Mario Corchero in :issue:`42251`.)" msgstr "" +":func:`threading.settrace` と :func:`threading.setprofile` で設定した関数をそ" +"れぞれ取得する、:func:`threading.gettrace` と :func:`threading.getprofile` を" +"追加しました。\n" +"(Mario Corchero による貢献、:issue:`42251`。)" -#: ../../whatsnew/3.10.rst:1432 msgid "" "Add :data:`threading.__excepthook__` to allow retrieving the original value " "of :func:`threading.excepthook` in case it is set to a broken or a different " "value. (Contributed by Mario Corchero in :issue:`42308`.)" msgstr "" +":func:`threading.excepthook` が動作しない値や別の値に設定された場合に元の値を" +"取得できるよう、:data:`threading.__excepthook__` を追加しました。\n" +"(Mario Corchero による貢献、:issue:`42308`。)" #: ../../whatsnew/3.10.rst:1438 msgid "traceback" msgstr "traceback" -#: ../../whatsnew/3.10.rst:1440 msgid "" "The :func:`~traceback.format_exception`, :func:`~traceback." "format_exception_only`, and :func:`~traceback.print_exception` functions can " "now take an exception object as a positional-only argument. (Contributed by " "Zackery Spytz and Matthias Bussonnier in :issue:`26389`.)" msgstr "" +":func:`~traceback.format_exception`、:func:`~traceback." +"format_exception_only`、:func:`~traceback.print_exception` 関数に、位置専用引" +"数として例外オブジェクトを渡せるようになりました。\n" +"(Zackery Spytz と Matthias Bussonnier による貢献、:issue:`26389`。)" #: ../../whatsnew/3.10.rst:1447 msgid "types" @@ -2226,42 +2820,46 @@ msgstr "" msgid "typing" msgstr "typing" -#: ../../whatsnew/3.10.rst:1457 msgid "For major changes, see :ref:`new-feat-related-type-hints`." msgstr "" +"主な変更については :ref:`new-feat-related-type-hints` を参照してください。" -#: ../../whatsnew/3.10.rst:1459 msgid "" "The behavior of :class:`typing.Literal` was changed to conform with :pep:" "`586` and to match the behavior of static type checkers specified in the PEP." msgstr "" +":class:`typing.Literal` の動作を変更し、:pep:`586` に準拠するとともに、PEP で" +"指定されている静的型チェッカーの動作に合わせました。" -#: ../../whatsnew/3.10.rst:1462 msgid "``Literal`` now de-duplicates parameters." -msgstr "" +msgstr "``Literal`` がパラメータの重複を取り除くようになりました。" -#: ../../whatsnew/3.10.rst:1463 msgid "" "Equality comparisons between ``Literal`` objects are now order independent." -msgstr "" +msgstr "``Literal`` オブジェクト間の等価性比較が、順序に依存しなくなりました。" -#: ../../whatsnew/3.10.rst:1464 msgid "" "``Literal`` comparisons now respect types. For example, ``Literal[0] == " "Literal[False]`` previously evaluated to ``True``. It is now ``False``. To " "support this change, the internally used type cache now supports " "differentiating types." msgstr "" +"``Literal`` の比較が型を区別するようになりました。\n" +"例えば ``Literal[0] == Literal[False]`` は以前 ``True`` でしたが、今は " +"``False`` になります。\n" +"この変更を実現するため、内部の型キャッシュも型を区別するようになりました。" -#: ../../whatsnew/3.10.rst:1468 msgid "" "``Literal`` objects will now raise a :exc:`TypeError` exception during " "equality comparisons if any of their parameters are not :term:`hashable`. " "Note that declaring ``Literal`` with unhashable parameters will not throw an " "error::" msgstr "" +"``Literal`` オブジェクトの等価性比較では、いずれかのパラメータが :term:" +"`hashable` でない場合に :exc:`TypeError` 例外を送出するようになりました。\n" +"ハッシュ不可能なパラメータで ``Literal`` を宣言するだけならエラーにはなりませ" +"ん。 ::" -#: ../../whatsnew/3.10.rst:1473 msgid "" ">>> from typing import Literal\n" ">>> Literal[{0}]\n" @@ -2270,17 +2868,25 @@ msgid "" " File \"\", line 1, in \n" "TypeError: unhashable type: 'set'" msgstr "" +">>> from typing import Literal\n" +">>> Literal[{0}]\n" +">>> Literal[{0}] == Literal[{False}]\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"TypeError: unhashable type: 'set'" #: ../../whatsnew/3.10.rst:1480 msgid "(Contributed by Yurii Karabas in :issue:`42345`.)" msgstr "(:issue:`42345` でのYurii Karabasの貢献による)" -#: ../../whatsnew/3.10.rst:1482 msgid "" "Add new function :func:`typing.is_typeddict` to introspect if an annotation " "is a :class:`typing.TypedDict`. (Contributed by Patrick Reader in :issue:" "`41792`.)" msgstr "" +"アノテーションが :class:`typing.TypedDict` かどうかを調べる新しい関数 :func:" +"`typing.is_typeddict` を追加しました。\n" +"(Patrick Reader による貢献、:issue:`41792`。)" #: ../../whatsnew/3.10.rst:1486 msgid "" @@ -2292,7 +2898,6 @@ msgid "" "(Contributed by Yurii Karabas in :issue:`38908`.)" msgstr "" -#: ../../whatsnew/3.10.rst:1494 msgid "" "Importing from the ``typing.io`` and ``typing.re`` submodules will now emit :" "exc:`DeprecationWarning`. These submodules have been deprecated since " @@ -2300,23 +2905,31 @@ msgid "" "belonging to those submodules should be imported directly from :mod:`typing` " "instead. (Contributed by Sebastian Rittau in :issue:`38291`.)" msgstr "" +"``typing.io`` と ``typing.re`` サブモジュールからインポートすると、:exc:" +"`DeprecationWarning` が発生するようになりました。\n" +"これらのサブモジュールは Python 3.8 以降非推奨で、将来の Python で削除される" +"予定です。\n" +"これらに属するものは、代わりに :mod:`typing` から直接インポートしてくださ" +"い。\n" +"(Sebastian Rittau による貢献、:issue:`38291`。)" #: ../../whatsnew/3.10.rst:1502 msgid "unittest" msgstr "unittest" -#: ../../whatsnew/3.10.rst:1504 msgid "" "Add new method :meth:`~unittest.TestCase.assertNoLogs` to complement the " "existing :meth:`~unittest.TestCase.assertLogs`. (Contributed by Kit Yan Choi " "in :issue:`39385`.)" msgstr "" +"既存の :meth:`~unittest.TestCase.assertLogs` を補完する、新しいメソッド :" +"meth:`~unittest.TestCase.assertNoLogs` を追加しました。\n" +"(Kit Yan Choi による貢献、:issue:`39385`。)" #: ../../whatsnew/3.10.rst:1509 msgid "urllib.parse" msgstr "urllib.parse" -#: ../../whatsnew/3.10.rst:1511 msgid "" "Python versions earlier than Python 3.10 allowed using both ``;`` and ``&`` " "as query parameter separators in :func:`urllib.parse.parse_qs` and :func:" @@ -2328,8 +2941,16 @@ msgid "" "documentation. (Contributed by Adam Goldschmidt, Senthil Kumaran and Ken Jin " "in :issue:`42967`.)" msgstr "" +"Python 3.10 より前のバージョンでは、:func:`urllib.parse.parse_qs` と :func:" +"`urllib.parse.parse_qsl` のクエリパラメータの区切り文字として ``;`` と ``&`` " +"の両方を使えました。\n" +"セキュリティ上の懸念と新しい W3C の勧告に合わせるため、区切り文字を 1 種類だ" +"け受け付けるように変更し、デフォルトを ``&`` としました。\n" +"内部でこれらの関数を使っている :func:`!cgi.parse` と :func:`!cgi." +"parse_multipart` にも、この変更は影響します。\n" +"詳しくは各関数のドキュメントを参照してください。\n" +"(Adam Goldschmidt, Senthil Kumaran と Ken Jin による貢献、:issue:`42967`。)" -#: ../../whatsnew/3.10.rst:1521 msgid "" "The presence of newline or tab characters in parts of a URL allows for some " "forms of attacks. Following the WHATWG specification that updates :rfc:" @@ -2338,48 +2959,62 @@ msgid "" "attacks. The removal characters are controlled by a new module level " "variable ``urllib.parse._UNSAFE_URL_BYTES_TO_REMOVE``. (See :gh:`88048`)" msgstr "" +"URL の一部に改行文字やタブ文字があると、特定の種類の攻撃が可能になります。\n" +":rfc:`3986` を更新する WHATWG の仕様に従い、:mod:`urllib.parse` のパーサーは " +"ASCII の改行文字 ``\\n``、``\\r`` とタブ文字 ``\\t`` を URL から取り除き、こ" +"の種の攻撃を防ぎます。\n" +"除去する文字は、新しいモジュール変数 ``urllib.parse." +"_UNSAFE_URL_BYTES_TO_REMOVE`` で制御します。\n" +"(:gh:`88048` を参照)" #: ../../whatsnew/3.10.rst:1529 msgid "xml" msgstr "xml" -#: ../../whatsnew/3.10.rst:1531 msgid "" "Add a :class:`~xml.sax.handler.LexicalHandler` class to the :mod:`xml.sax." "handler` module. (Contributed by Jonathan Gossage and Zackery Spytz in :" "issue:`35018`.)" msgstr "" +":mod:`xml.sax.handler` モジュールに :class:`~xml.sax.handler.LexicalHandler` " +"クラスを追加しました。\n" +"(Jonathan Gossage と Zackery Spytz による貢献、:issue:`35018`。)" #: ../../whatsnew/3.10.rst:1536 msgid "zipimport" -msgstr "" +msgstr "zipimport" -#: ../../whatsnew/3.10.rst:1537 msgid "" "Add methods related to :pep:`451`: :meth:`~zipimport.zipimporter." "find_spec`, :meth:`zipimport.zipimporter.create_module`, and :meth:" "`zipimport.zipimporter.exec_module`. (Contributed by Brett Cannon in :issue:" "`42131`.)" msgstr "" +":pep:`451` に関連するメソッド :meth:`~zipimport.zipimporter.find_spec`、:" +"meth:`zipimport.zipimporter.create_module`、:meth:`zipimport.zipimporter." +"exec_module` を追加しました。\n" +"(Brett Cannon による貢献、:issue:`42131`。)" -#: ../../whatsnew/3.10.rst:1542 msgid "" "Add :meth:`~zipimport.zipimporter.invalidate_caches` method. (Contributed by " "Desmond Cheong in :issue:`14678`.)" msgstr "" +":meth:`~zipimport.zipimporter.invalidate_caches` メソッドを追加しました。\n" +"(Desmond Cheong による貢献、:issue:`14678`。)" #: ../../whatsnew/3.10.rst:1547 msgid "Optimizations" msgstr "最適化" -#: ../../whatsnew/3.10.rst:1549 msgid "" "Constructors :func:`str`, :func:`bytes` and :func:`bytearray` are now faster " "(around 30--40% for small objects). (Contributed by Serhiy Storchaka in :" "issue:`41334`.)" msgstr "" +"コンストラクタ :func:`str`、:func:`bytes`、:func:`bytearray` が高速化しまし" +"た (小さいオブジェクトでは約 30~40%)。\n" +"(Serhiy Storchaka による貢献、:issue:`41334`。)" -#: ../../whatsnew/3.10.rst:1553 msgid "" "The :mod:`runpy` module now imports fewer modules. The ``python3 -m module-" "name`` command startup time is 1.4x faster in average. On Linux, ``python3 -" @@ -2387,8 +3022,12 @@ msgid "" "51 modules (-18) on Python 3.10. (Contributed by Victor Stinner in :issue:" "`41006` and :issue:`41718`.)" msgstr "" +":mod:`runpy` モジュールがインポートするモジュール数を減らしました。\n" +"``python3 -m module-name`` コマンドの起動は平均で 1.4 倍高速になりました。\n" +"Linux では ``python3 -I -m module-name`` が Python 3.9 で 69 個のモジュールを" +"インポートするのに対し、Python 3.10 では 51 個だけになります (18 個減)。\n" +"(Victor Stinner による貢献、:issue:`41006` と :issue:`41718`。)" -#: ../../whatsnew/3.10.rst:1559 msgid "" "The ``LOAD_ATTR`` instruction now uses new \"per opcode cache\" mechanism. " "It is about 36% faster now for regular attributes and 44% faster for slots. " @@ -2396,8 +3035,13 @@ msgid "" "van Rossum in :issue:`42927`, based on ideas implemented originally in PyPy " "and MicroPython.)" msgstr "" +"``LOAD_ATTR`` 命令が、新しい「オペコードごとのキャッシュ」の仕組みを使うよう" +"になりました。\n" +"通常の属性では約 36%、スロットでは約 44% 高速になります。\n" +"(PyPy と MicroPython で最初に実装されたアイデアに基づき、Pablo Galindo と " +"Yury Selivanov が :issue:`42093`、Guido van Rossum が :issue:`42927` で貢献し" +"ました。)" -#: ../../whatsnew/3.10.rst:1565 msgid "" "When building Python with :option:`--enable-optimizations` now ``-fno-" "semantic-interposition`` is added to both the compile and link line. This " @@ -2407,8 +3051,16 @@ msgid "" "python-3-8-run-speeds/>`_ for more details. (Contributed by Victor Stinner " "and Pablo Galindo in :issue:`38980`.)" msgstr "" +":option:`--enable-optimizations` を指定して Python をビルドすると、コンパイル" +"時とリンク時の両方のコマンドラインに ``-fno-semantic-interposition`` が追加さ" +"れるようになりました。\n" +"これにより、``gcc`` で :option:`--enable-shared` を指定してビルドした Python " +"インタープリタが最大 30% 高速になります。\n" +"詳しくは `この記事 `_ を参照してくださ" +"い。\n" +"(Victor Stinner と Pablo Galindo による貢献、:issue:`38980`。)" -#: ../../whatsnew/3.10.rst:1573 msgid "" "Use a new output buffer management code for :mod:`bz2` / :mod:`lzma` / :mod:" "`zlib` modules, and add ``.readall()`` function to ``_compression." @@ -2417,8 +3069,13 @@ msgid "" "faster. (Contributed by Ma Lin, reviewed by Gregory P. Smith, in :issue:" "`41486`)" msgstr "" +":mod:`bz2` / :mod:`lzma` / :mod:`zlib` モジュールで新しい出力バッファ管理の" +"コードを使い、``_compression.DecompressReader`` クラスに ``.readall()`` 関数" +"を追加しました。\n" +"bz2 の展開は 1.09~1.17 倍、lzma の展開は 1.20~1.32 倍、``GzipFile." +"read(-1)`` は 1.11~1.18 倍高速になります。\n" +"(Ma Lin による貢献、Gregory P. Smith によるレビュー、:issue:`41486`。)" -#: ../../whatsnew/3.10.rst:1579 msgid "" "When using stringized annotations, annotations dicts for functions are no " "longer created when the function is created. Instead, they are stored as a " @@ -2427,24 +3084,36 @@ msgid "" "define an annotated function by half. (Contributed by Yurii Karabas and " "Inada Naoki in :issue:`42202`.)" msgstr "" +"文字列化されたアノテーションを使う場合、関数の作成時にはアノテーション辞書を" +"作成しなくなりました。\n" +"代わりに文字列のタプルとして保持し、必要になった時点で関数オブジェクトがアノ" +"テーション辞書に変換します。\n" +"この最適化により、アノテーション付きの関数を定義するために必要な CPU 時間が半" +"減します。\n" +"(Yurii Karabas と Inada Naoki による貢献、:issue:`42202`。)" -#: ../../whatsnew/3.10.rst:1586 msgid "" "Substring search functions such as ``str1 in str2`` and ``str2.find(str1)`` " "now sometimes use Crochemore & Perrin's \"Two-Way\" string searching " "algorithm to avoid quadratic behavior on long strings. (Contributed by " "Dennis Sweeney in :issue:`41972`)" msgstr "" +"``str1 in str2`` や ``str2.find(str1)`` などの部分文字列検索で、長い文字列で" +"の処理時間が 2 乗に比例することを避けるため、Crochemore と Perrin の \"Two-" +"Way\" 文字列検索アルゴリズムを使う場合があるようになりました。\n" +"(Dennis Sweeney による貢献、:issue:`41972`。)" -#: ../../whatsnew/3.10.rst:1591 msgid "" "Add micro-optimizations to ``_PyType_Lookup()`` to improve type attribute " "cache lookup performance in the common case of cache hits. This makes the " "interpreter 1.04 times faster on average. (Contributed by Dino Viehland in :" "issue:`43452`.)" msgstr "" +"``_PyType_Lookup()`` に小規模な最適化を加え、キャッシュにヒットする一般的な場" +"合での型属性キャッシュの検索を高速化しました。\n" +"これにより、インタープリタは平均で 1.04 倍高速になります。\n" +"(Dino Viehland による貢献、:issue:`43452`。)" -#: ../../whatsnew/3.10.rst:1595 msgid "" "The following built-in functions now support the faster :pep:`590` " "vectorcall calling convention: :func:`map`, :func:`filter`, :func:" @@ -2452,8 +3121,12 @@ msgid "" "Jeroen Demeyer in :issue:`43575`, :issue:`43287`, :issue:`41922`, :issue:" "`41873` and :issue:`41870`.)" msgstr "" +"次の組み込み関数が、より高速な :pep:`590` の vectorcall 呼び出し規約に対応し" +"ました: :func:`map`、:func:`filter`、:func:`reversed`、:func:`bool`、:func:" +"`float`。\n" +"(Donghee Na と Jeroen Demeyer による貢献、:issue:`43575`、:issue:`43287`、:" +"issue:`41922`、:issue:`41873` と :issue:`41870`。)" -#: ../../whatsnew/3.10.rst:1599 msgid "" ":class:`~bz2.BZ2File` performance is improved by removing internal " "``RLock``. This makes :class:`!BZ2File` thread unsafe in the face of " @@ -2461,12 +3134,16 @@ msgid "" "in :mod:`gzip` and :mod:`lzma` have always been. (Contributed by Inada " "Naoki in :issue:`43785`.)" msgstr "" +"内部の ``RLock`` を削除して :class:`~bz2.BZ2File` の性能を改善しました。\n" +"このため、複数のスレッドが同時に読み書きする場合、:class:`!BZ2File` はスレッ" +"ドセーフではなくなります。\n" +":mod:`gzip` と :mod:`lzma` の対応するクラスは以前から同様の動作でした。\n" +"(Inada Naoki による貢献、:issue:`43785`。)" #: ../../whatsnew/3.10.rst:1607 ../../whatsnew/3.10.rst:2213 msgid "Deprecated" msgstr "非推奨" -#: ../../whatsnew/3.10.rst:1609 msgid "" "Currently Python accepts numeric literals immediately followed by keywords, " "for example ``0in x``, ``1or x``, ``0if 1else 2``. It allows confusing and " @@ -2478,6 +3155,15 @@ msgid "" "will be changed to syntax warning, and finally to syntax error. (Contributed " "by Serhiy Storchaka in :issue:`43833`.)" msgstr "" +"現在の Python では、``0in x``、``1or x``、``0if 1else 2`` のように、数値リテ" +"ラルの直後にキーワードを書くことができます。\n" +"このため ``[0x1for x in y]`` のような分かりにくく曖昧な式が許されます " +"(``[0x1 for x in y]`` とも ``[0x1f or x in y]`` とも解釈できます)。\n" +"このリリースから、数値リテラルの直後にキーワード :keyword:`and`、:keyword:" +"`else`、:keyword:`for`、:keyword:`if`、:keyword:`in`、:keyword:`is`、:" +"keyword:`or` のいずれかが続く場合、非推奨の警告が発生します。\n" +"将来のリリースでは構文の警告に変わり、最終的には構文エラーになります。\n" +"(Serhiy Storchaka による貢献、:issue:`43833`。)" #: ../../whatsnew/3.10.rst:1620 msgid "" @@ -2496,27 +3182,36 @@ msgid "" "transition." msgstr "" -#: ../../whatsnew/3.10.rst:1637 msgid "" "The entire ``distutils`` namespace is deprecated, to be removed in Python " "3.12. Refer to the :ref:`module changes ` section for " "more information." msgstr "" +"``distutils`` 名前空間全体を非推奨とし、Python 3.12 で削除する予定です。\n" +"詳しくは :ref:`モジュールの変更 ` の節を参照してくださ" +"い。" -#: ../../whatsnew/3.10.rst:1641 msgid "" "Non-integer arguments to :func:`random.randrange` are deprecated. The :exc:" "`ValueError` is deprecated in favor of a :exc:`TypeError`. (Contributed by " "Serhiy Storchaka and Raymond Hettinger in :issue:`37319`.)" msgstr "" +":func:`random.randrange` に整数以外の引数を渡すことを非推奨としました。\n" +":exc:`ValueError` の送出も非推奨とし、代わりに :exc:`TypeError` を送出するよ" +"うにします。\n" +"(Serhiy Storchaka と Raymond Hettinger による貢献、:issue:`37319`。)" -#: ../../whatsnew/3.10.rst:1645 msgid "" "The various ``load_module()`` methods of :mod:`importlib` have been " "documented as deprecated since Python 3.6, but will now also trigger a :exc:" "`DeprecationWarning`. Use :meth:`~importlib.abc.Loader.exec_module` instead. " "(Contributed by Brett Cannon in :issue:`26131`.)" msgstr "" +":mod:`importlib` の各種 ``load_module()`` メソッドは Python 3.6 からドキュメ" +"ントで非推奨とされていましたが、:exc:`DeprecationWarning` も発生するようにな" +"りました。\n" +"代わりに :meth:`~importlib.abc.Loader.exec_module` を使ってください。\n" +"(Brett Cannon による貢献、:issue:`26131`。)" #: ../../whatsnew/3.10.rst:1651 msgid "" @@ -2532,7 +3227,6 @@ msgid "" "exec_module` is preferred. (Contributed by Brett Cannon in :issue:`26131`.)" msgstr "" -#: ../../whatsnew/3.10.rst:1660 msgid "" "The use of :meth:`!importlib.abc.MetaPathFinder.find_module` and :meth:`!" "importlib.abc.PathEntryFinder.find_module` by the import system now trigger " @@ -2541,8 +3235,14 @@ msgid "" "respectively. You can use :func:`importlib.util.spec_from_loader` to help in " "porting. (Contributed by Brett Cannon in :issue:`42134`.)" msgstr "" +"インポートシステムが :meth:`!importlib.abc.MetaPathFinder.find_module` と :" +"meth:`!importlib.abc.PathEntryFinder.find_module` を使うと、:exc:" +"`ImportWarning` が発生するようになりました。\n" +"それぞれ :meth:`importlib.abc.MetaPathFinder.find_spec` と :meth:`importlib." +"abc.PathEntryFinder.find_spec` の使用が推奨されます。\n" +"移行には :func:`importlib.util.spec_from_loader` が役立ちます。\n" +"(Brett Cannon による貢献、:issue:`42134`。)" -#: ../../whatsnew/3.10.rst:1669 msgid "" "The use of :meth:`!importlib.abc.PathEntryFinder.find_loader` by the import " "system now triggers an :exc:`ImportWarning` as :meth:`importlib.abc." @@ -2550,8 +3250,12 @@ msgid "" "spec_from_loader` to help in porting. (Contributed by Brett Cannon in :issue:" "`43672`.)" msgstr "" +"インポートシステムが :meth:`!importlib.abc.PathEntryFinder.find_loader` を使" +"うと、:exc:`ImportWarning` が発生するようになりました。\n" +":meth:`importlib.abc.PathEntryFinder.find_spec` の使用が推奨されます。\n" +"移行には :func:`importlib.util.spec_from_loader` が役立ちます。\n" +"(Brett Cannon による貢献、:issue:`43672`。)" -#: ../../whatsnew/3.10.rst:1675 msgid "" "The various implementations of :meth:`!importlib.abc.MetaPathFinder." "find_module` ( :meth:`!importlib.machinery.BuiltinImporter.find_module`, :" @@ -2565,8 +3269,19 @@ msgid "" "removal in Python 3.12 (previously they were documented as deprecated in " "Python 3.4). (Contributed by Brett Cannon in :issue:`42135`.)" msgstr "" +":meth:`!importlib.abc.MetaPathFinder.find_module` の各実装 (:meth:`!" +"importlib.machinery.BuiltinImporter.find_module`、:meth:`!importlib." +"machinery.FrozenImporter.find_module`、:meth:`!importlib.machinery." +"WindowsRegistryFinder.find_module`、:meth:`!importlib.machinery.PathFinder." +"find_module`、:meth:`!importlib.abc.MetaPathFinder.find_module`)、:meth:`!" +"importlib.abc.PathEntryFinder.find_module` の実装 (:meth:`!importlib." +"machinery.FileFinder.find_module`)、:meth:`!importlib.abc.PathEntryFinder." +"find_loader` の実装 (:meth:`!importlib.machinery.FileFinder.find_loader`) " +"が :exc:`DeprecationWarning` を発生させるようになりました。\n" +"Python 3.12 で削除する予定です (以前は Python 3.4 でドキュメント上非推奨とさ" +"れていました)。\n" +"(Brett Cannon による貢献、:issue:`42135`。)" -#: ../../whatsnew/3.10.rst:1690 msgid "" ":class:`!importlib.abc.Finder` is deprecated (including its sole method, :" "meth:`!find_module`). Both :class:`importlib.abc.MetaPathFinder` and :class:" @@ -2574,8 +3289,13 @@ msgid "" "should inherit from one of these two classes as appropriate instead. " "(Contributed by Brett Cannon in :issue:`42135`.)" msgstr "" +":class:`!importlib.abc.Finder` と、その唯一のメソッド :meth:`!find_module` を" +"非推奨としました。\n" +":class:`importlib.abc.MetaPathFinder` と :class:`importlib.abc." +"PathEntryFinder` は、このクラスを継承しなくなりました。\n" +"代わりに、この 2 つのクラスのうち適切な方を継承してください。\n" +"(Brett Cannon による貢献、:issue:`42135`。)" -#: ../../whatsnew/3.10.rst:1697 msgid "" "The deprecations of :mod:`!imp`, :func:`!importlib.find_loader`, :func:`!" "importlib.util.set_package_wrapper`, :func:`!importlib.util." @@ -2585,14 +3305,26 @@ msgid "" "exc:`DeprecationWarning` in previous versions of Python). (Contributed by " "Brett Cannon in :issue:`43720`.)" msgstr "" +":mod:`!imp`、:func:`!importlib.find_loader`、:func:`!importlib.util." +"set_package_wrapper`、:func:`!importlib.util.set_loader_wrapper`、:func:`!" +"importlib.util.module_for_loader`、:class:`!pkgutil.ImpImporter`、:class:`!" +"pkgutil.ImpLoader` の非推奨の記載を更新し、削除予定のバージョンを Python " +"3.12 と明記しました。\n" +"これらは以前の Python バージョンから :exc:`DeprecationWarning` を発生させてい" +"ます。\n" +"(Brett Cannon による貢献、:issue:`43720`。)" -#: ../../whatsnew/3.10.rst:1707 msgid "" "The import system now uses the ``__spec__`` attribute on modules before " "falling back on :meth:`!module_repr` for a module's ``__repr__()`` method. " "Removal of the use of ``module_repr()`` is scheduled for Python 3.12. " "(Contributed by Brett Cannon in :issue:`42137`.)" msgstr "" +"モジュールの ``__repr__()`` メソッドについて、インポートシステムは :meth:`!" +"module_repr` にフォールバックする前に、モジュールの ``__spec__`` 属性を使うよ" +"うになりました。\n" +"``module_repr()`` の使用は Python 3.12 で削除する予定です。\n" +"(Brett Cannon による貢献、:issue:`42137`。)" #: ../../whatsnew/3.10.rst:1713 msgid "" @@ -2602,15 +3334,17 @@ msgid "" "(Contributed by Brett Cannon in :issue:`42136`.)" msgstr "" -#: ../../whatsnew/3.10.rst:1719 msgid "" "``sqlite3.OptimizedUnicode`` has been undocumented and obsolete since Python " "3.3, when it was made an alias to :class:`str`. It is now deprecated, " "scheduled for removal in Python 3.12. (Contributed by Erlend E. Aasland in :" "issue:`42264`.)" msgstr "" +"``sqlite3.OptimizedUnicode`` は、:class:`str` の別名となった Python 3.3 以" +"降、ドキュメントに記載されず、使われなくなっていました。\n" +"今回非推奨となり、Python 3.12 で削除する予定です。\n" +"(Erlend E. Aasland による貢献、:issue:`42264`。)" -#: ../../whatsnew/3.10.rst:1724 msgid "" "The undocumented built-in function ``sqlite3.enable_shared_cache`` is now " "deprecated, scheduled for removal in Python 3.12. Its use is strongly " @@ -2619,110 +3353,132 @@ msgid "" "cache must be used, open the database in URI mode using the ``cache=shared`` " "query parameter. (Contributed by Erlend E. Aasland in :issue:`24464`.)" msgstr "" +"ドキュメントに記載されていない組み込み関数 ``sqlite3.enable_shared_cache`` を" +"非推奨とし、Python 3.12 で削除する予定です。\n" +"SQLite3 のドキュメントでは、その使用を強く非推奨としています。\n" +"詳しくは `SQLite3 のドキュメント `_ を参照してください。\n" +"共有キャッシュを使う必要がある場合は、``cache=shared`` クエリパラメータを指定" +"し、URI モードでデータベースを開いてください。\n" +"(Erlend E. Aasland による貢献、:issue:`24464`。)" #: ../../whatsnew/3.10.rst:1732 msgid "The following ``threading`` methods are now deprecated:" -msgstr "" +msgstr "以下の ``threading`` メソッドは非推奨になりました:" #: ../../whatsnew/3.10.rst:1734 msgid "``threading.currentThread`` => :func:`threading.current_thread`" -msgstr "" +msgstr "``threading.currentThread`` => :func:`threading.current_thread`" #: ../../whatsnew/3.10.rst:1736 msgid "``threading.activeCount`` => :func:`threading.active_count`" -msgstr "" +msgstr "``threading.activeCount`` => :func:`threading.active_count`" #: ../../whatsnew/3.10.rst:1738 msgid "" "``threading.Condition.notifyAll`` => :meth:`threading.Condition.notify_all`" msgstr "" +"``threading.Condition.notifyAll`` => :meth:`threading.Condition.notify_all`" #: ../../whatsnew/3.10.rst:1741 msgid "``threading.Event.isSet`` => :meth:`threading.Event.is_set`" -msgstr "" +msgstr "``threading.Event.isSet`` => :meth:`threading.Event.is_set`" #: ../../whatsnew/3.10.rst:1743 msgid "``threading.Thread.setName`` => :attr:`threading.Thread.name`" -msgstr "" +msgstr "``threading.Thread.setName`` => :attr:`threading.Thread.name`" #: ../../whatsnew/3.10.rst:1745 msgid "``threading.thread.getName`` => :attr:`threading.Thread.name`" -msgstr "" +msgstr "``threading.thread.getName`` => :attr:`threading.Thread.name`" #: ../../whatsnew/3.10.rst:1747 msgid "``threading.Thread.isDaemon`` => :attr:`threading.Thread.daemon`" -msgstr "" +msgstr "``threading.Thread.isDaemon`` => :attr:`threading.Thread.daemon`" #: ../../whatsnew/3.10.rst:1749 msgid "``threading.Thread.setDaemon`` => :attr:`threading.Thread.daemon`" -msgstr "" +msgstr "``threading.Thread.setDaemon`` => :attr:`threading.Thread.daemon`" -#: ../../whatsnew/3.10.rst:1751 msgid "(Contributed by Jelle Zijlstra in :gh:`87889`.)" -msgstr "" +msgstr "(Jelle Zijlstra による貢献、:gh:`87889`。)" -#: ../../whatsnew/3.10.rst:1753 msgid "" ":meth:`!pathlib.Path.link_to` is deprecated and slated for removal in Python " "3.12. Use :meth:`pathlib.Path.hardlink_to` instead. (Contributed by Barney " "Gale in :issue:`39950`.)" msgstr "" +":meth:`!pathlib.Path.link_to` を非推奨とし、Python 3.12 で削除する予定で" +"す。\n" +"代わりに :meth:`pathlib.Path.hardlink_to` を使ってください。\n" +"(Barney Gale による貢献、:issue:`39950`。)" -#: ../../whatsnew/3.10.rst:1757 msgid "" "``cgi.log()`` is deprecated and slated for removal in Python 3.12. " "(Contributed by Inada Naoki in :issue:`41139`.)" msgstr "" +"``cgi.log()`` を非推奨とし、Python 3.12 で削除する予定です。\n" +"(Inada Naoki による貢献、:issue:`41139`。)" -#: ../../whatsnew/3.10.rst:1760 msgid "" "The following :mod:`ssl` features have been deprecated since Python 3.6, " "Python 3.7, or OpenSSL 1.1.0 and will be removed in 3.11:" msgstr "" +"次の :mod:`ssl` の機能は Python 3.6、Python 3.7、または OpenSSL 1.1.0 から非" +"推奨となっており、3.11 で削除する予定です:" -#: ../../whatsnew/3.10.rst:1763 msgid "" ":data:`!OP_NO_SSLv2`, :data:`!OP_NO_SSLv3`, :data:`!OP_NO_TLSv1`, :data:`!" "OP_NO_TLSv1_1`, :data:`!OP_NO_TLSv1_2`, and :data:`!OP_NO_TLSv1_3` are " "replaced by :attr:`~ssl.SSLContext.minimum_version` and :attr:`~ssl." "SSLContext.maximum_version`." msgstr "" +":data:`!OP_NO_SSLv2`、:data:`!OP_NO_SSLv3`、:data:`!OP_NO_TLSv1`、:data:`!" +"OP_NO_TLSv1_1`、:data:`!OP_NO_TLSv1_2`、:data:`!OP_NO_TLSv1_3` は、:attr:" +"`~ssl.SSLContext.minimum_version` と :attr:`~ssl.SSLContext.maximum_version` " +"に置き換えられます。" -#: ../../whatsnew/3.10.rst:1769 msgid "" ":data:`!PROTOCOL_SSLv2`, :data:`!PROTOCOL_SSLv3`, :data:`!PROTOCOL_SSLv23`, :" "data:`!PROTOCOL_TLSv1`, :data:`!PROTOCOL_TLSv1_1`, :data:`!" "PROTOCOL_TLSv1_2`, and :const:`!PROTOCOL_TLS` are deprecated in favor of :" "const:`~ssl.PROTOCOL_TLS_CLIENT` and :const:`~ssl.PROTOCOL_TLS_SERVER`" msgstr "" +":data:`!PROTOCOL_SSLv2`、:data:`!PROTOCOL_SSLv3`、:data:`!PROTOCOL_SSLv23`、:" +"data:`!PROTOCOL_TLSv1`、:data:`!PROTOCOL_TLSv1_1`、:data:`!" +"PROTOCOL_TLSv1_2`、:const:`!PROTOCOL_TLS` を非推奨とし、代わりに :const:" +"`~ssl.PROTOCOL_TLS_CLIENT` と :const:`~ssl.PROTOCOL_TLS_SERVER` を推奨しま" +"す。" -#: ../../whatsnew/3.10.rst:1775 msgid ":func:`!wrap_socket` is replaced by :meth:`ssl.SSLContext.wrap_socket`" msgstr "" +":func:`!wrap_socket` は :meth:`ssl.SSLContext.wrap_socket` に置き換えられま" +"す。" -#: ../../whatsnew/3.10.rst:1777 msgid ":func:`!match_hostname`" -msgstr "" +msgstr ":func:`!match_hostname`" -#: ../../whatsnew/3.10.rst:1779 msgid ":func:`!RAND_pseudo_bytes`, :func:`!RAND_egd`" -msgstr "" +msgstr ":func:`!RAND_pseudo_bytes`, :func:`!RAND_egd`" -#: ../../whatsnew/3.10.rst:1781 msgid "" "NPN features like :meth:`ssl.SSLSocket.selected_npn_protocol` and :meth:`ssl." "SSLContext.set_npn_protocols` are replaced by ALPN." msgstr "" +":meth:`ssl.SSLSocket.selected_npn_protocol` や :meth:`ssl.SSLContext." +"set_npn_protocols` などの NPN の機能は、ALPN に置き換えられます。" -#: ../../whatsnew/3.10.rst:1784 msgid "" "The threading debug (:envvar:`!PYTHONTHREADDEBUG` environment variable) is " "deprecated in Python 3.10 and will be removed in Python 3.12. This feature " "requires a :ref:`debug build of Python `. (Contributed by " "Victor Stinner in :issue:`44584`.)" msgstr "" +"スレッドのデバッグ機能 (:envvar:`!PYTHONTHREADDEBUG` 環境変数) は Python " +"3.10 で非推奨となり、Python 3.12 で削除する予定です。\n" +"この機能には :ref:`Python のデバッグビルド ` が必要です。\n" +"(Victor Stinner による貢献、:issue:`44584`。)" -#: ../../whatsnew/3.10.rst:1789 msgid "" "Importing from the ``typing.io`` and ``typing.re`` submodules will now emit :" "exc:`DeprecationWarning`. These submodules will be removed in a future " @@ -2730,20 +3486,29 @@ msgid "" "imported directly from :mod:`typing` instead. (Contributed by Sebastian " "Rittau in :issue:`38291`.)" msgstr "" +"``typing.io`` と ``typing.re`` サブモジュールからインポートすると、:exc:" +"`DeprecationWarning` が発生するようになりました。\n" +"これらのサブモジュールは将来の Python で削除される予定です。\n" +"これらに属するものは、代わりに :mod:`typing` から直接インポートしてくださ" +"い。\n" +"(Sebastian Rittau による貢献、:issue:`38291`。)" #: ../../whatsnew/3.10.rst:1798 ../../whatsnew/3.10.rst:2221 msgid "Removed" msgstr "削除" -#: ../../whatsnew/3.10.rst:1800 msgid "" "Removed special methods ``__int__``, ``__float__``, ``__floordiv__``, " "``__mod__``, ``__divmod__``, ``__rfloordiv__``, ``__rmod__`` and " "``__rdivmod__`` of the :class:`complex` class. They always raised a :exc:" "`TypeError`. (Contributed by Serhiy Storchaka in :issue:`41974`.)" msgstr "" +":class:`complex` クラスの特殊メソッド ``__int__``、``__float__``、" +"``__floordiv__``、``__mod__``、``__divmod__``、``__rfloordiv__``、" +"``__rmod__``、``__rdivmod__`` を削除しました。\n" +"これらは常に :exc:`TypeError` を送出していました。\n" +"(Serhiy Storchaka による貢献、:issue:`41974`。)" -#: ../../whatsnew/3.10.rst:1806 msgid "" "The ``ParserBase.error()`` method from the private and undocumented " "``_markupbase`` module has been removed. :class:`html.parser.HTMLParser` is " @@ -2751,32 +3516,46 @@ msgid "" "already removed in Python 3.5. (Contributed by Berker Peksag in :issue:" "`31844`.)" msgstr "" +"非公開でドキュメントに記載されていない ``_markupbase`` モジュールの " +"``ParserBase.error()`` メソッドを削除しました。\n" +":class:`html.parser.HTMLParser` が ``ParserBase`` の唯一のサブクラスで、その " +"``error()`` の実装は Python 3.5 ですでに削除されています。\n" +"(Berker Peksag による貢献、:issue:`31844`。)" -#: ../../whatsnew/3.10.rst:1812 msgid "" "Removed the ``unicodedata.ucnhash_CAPI`` attribute which was an internal " "PyCapsule object. The related private ``_PyUnicode_Name_CAPI`` structure was " "moved to the internal C API. (Contributed by Victor Stinner in :issue:" "`42157`.)" msgstr "" +"内部の PyCapsule オブジェクトだった ``unicodedata.ucnhash_CAPI`` 属性を削除し" +"ました。\n" +"関連する非公開の ``_PyUnicode_Name_CAPI`` 構造体は内部 C API に移動しまし" +"た。\n" +"(Victor Stinner による貢献、:issue:`42157`。)" -#: ../../whatsnew/3.10.rst:1817 msgid "" "Removed the ``parser`` module, which was deprecated in 3.9 due to the switch " "to the new PEG parser, as well as all the C source and header files that " "were only being used by the old parser, including ``node.h``, ``parser.h``, " "``graminit.h`` and ``grammar.h``." msgstr "" +"新しい PEG パーサーへの移行により 3.9 で非推奨となった ``parser`` モジュール" +"を削除しました。\n" +"``node.h``、``parser.h``、``graminit.h``、``grammar.h`` など、古いパーサーだ" +"けが使っていた C ソースファイルとヘッダーファイルもすべて削除しました。" -#: ../../whatsnew/3.10.rst:1822 msgid "" "Removed the Public C API functions ``PyParser_SimpleParseStringFlags``, " "``PyParser_SimpleParseStringFlagsFilename``, " "``PyParser_SimpleParseFileFlags`` and ``PyNode_Compile`` that were " "deprecated in 3.9 due to the switch to the new PEG parser." msgstr "" +"新しい PEG パーサーへの移行により 3.9 で非推奨となった公開 C API 関数 " +"``PyParser_SimpleParseStringFlags``、" +"``PyParser_SimpleParseStringFlagsFilename``、" +"``PyParser_SimpleParseFileFlags``、``PyNode_Compile`` を削除しました。" -#: ../../whatsnew/3.10.rst:1827 msgid "" "Removed the ``formatter`` module, which was deprecated in Python 3.4. It is " "somewhat obsolete, little used, and not tested. It was originally scheduled " @@ -2784,60 +3563,76 @@ msgid "" "Python 2.7 EOL. Existing users should copy whatever classes they use into " "their code. (Contributed by Donghee Na and Terry J. Reedy in :issue:`42299`.)" msgstr "" +"Python 3.4 で非推奨となった ``formatter`` モジュールを削除しました。\n" +"やや時代遅れで、ほとんど使われておらず、テストもありません。\n" +"当初は Python 3.6 で削除する予定でしたが、この種の削除は Python 2.7 のサポー" +"ト終了後まで延期されていました。\n" +"使っている場合は、必要なクラスを自分のコードにコピーしてください。\n" +"(Donghee Na と Terry J. Reedy による貢献、:issue:`42299`。)" -#: ../../whatsnew/3.10.rst:1834 msgid "" "Removed the :c:func:`!PyModule_GetWarningsModule` function that was useless " "now due to the :mod:`!_warnings` module was converted to a builtin module in " "2.6. (Contributed by Hai Shi in :issue:`42599`.)" msgstr "" +":c:func:`!PyModule_GetWarningsModule` 関数を削除しました。\n" +":mod:`!_warnings` モジュールは 2.6 で組み込みモジュールに変わったため、この関" +"数は不要になっていました。\n" +"(Hai Shi による貢献、:issue:`42599`。)" -#: ../../whatsnew/3.10.rst:1838 msgid "" "Remove deprecated aliases to :ref:`collections-abstract-base-classes` from " "the :mod:`collections` module. (Contributed by Victor Stinner in :issue:" "`37324`.)" msgstr "" +":mod:`collections` モジュールから、:ref:`collections-abstract-base-classes` " +"への非推奨の別名を削除しました。\n" +"(Victor Stinner による貢献、:issue:`37324`。)" -#: ../../whatsnew/3.10.rst:1842 msgid "" "The ``loop`` parameter has been removed from most of :mod:`asyncio`\\ 's :" "doc:`high-level API <../library/asyncio-api-index>` following deprecation in " "Python 3.8. The motivation behind this change is multifold:" msgstr "" +"Python 3.8 での非推奨化に続き、:mod:`asyncio` の :doc:`高水準 API <../" +"library/asyncio-api-index>` の大半から ``loop`` パラメータを削除しました。\n" +"この変更にはいくつかの理由があります:" -#: ../../whatsnew/3.10.rst:1846 msgid "This simplifies the high-level API." -msgstr "" +msgstr "高水準 API が単純になります。" -#: ../../whatsnew/3.10.rst:1847 msgid "" "The functions in the high-level API have been implicitly getting the current " "thread's running event loop since Python 3.7. There isn't a need to pass " "the event loop to the API in most normal use cases." msgstr "" +"高水準 API の関数は、Python 3.7 以降、現在のスレッドで実行中のイベントループ" +"を暗黙に取得しています。\n" +"通常の使用例の大半では、API にイベントループを渡す必要はありません。" -#: ../../whatsnew/3.10.rst:1850 msgid "" "Event loop passing is error-prone especially when dealing with loops running " "in different threads." msgstr "" +"特に異なるスレッドで実行するループを扱う場合、イベントループを渡す方法は誤り" +"を招きやすくなります。" -#: ../../whatsnew/3.10.rst:1853 msgid "" "Note that the low-level API will still accept ``loop``. See :ref:`changes-" "python-api` for examples of how to replace existing code." msgstr "" +"低水準 API は引き続き ``loop`` を受け付けます。\n" +"既存のコードを置き換える例は :ref:`changes-python-api` を参照してください。" -#: ../../whatsnew/3.10.rst:1856 ../../whatsnew/3.10.rst:1928 msgid "" "(Contributed by Yurii Karabas, Andrew Svetlov, Yury Selivanov and Kyle " "Stanley in :issue:`42392`.)" msgstr "" +"(Yurii Karabas、Andrew Svetlov、Yury Selivanov、Kyle Stanley による貢献、:" +"issue:`42392`。)" -#: ../../whatsnew/3.10.rst:1861 ../../whatsnew/3.10.rst:2148 msgid "Porting to Python 3.10" -msgstr "" +msgstr "Python 3.10 への移行" #: ../../whatsnew/3.10.rst:1863 msgid "" @@ -2847,11 +3642,9 @@ msgstr "" "このセクションでは前述の変更とバグフィックスにより必要となるかもしれないコー" "ドの変更を列挙します:" -#: ../../whatsnew/3.10.rst:1868 msgid "Changes in the Python syntax" -msgstr "" +msgstr "Python の構文の変更" -#: ../../whatsnew/3.10.rst:1870 msgid "" "Deprecation warning is now emitted when compiling previously valid syntax if " "the numeric literal is immediately followed by a keyword (like in ``0in " @@ -2860,28 +3653,39 @@ msgid "" "with future releases just add a space between the numeric literal and the " "following keyword. (Contributed by Serhiy Storchaka in :issue:`43833`.)" msgstr "" +"数値リテラルの直後にキーワードが続く、以前は有効だった構文 (``0in x`` など) " +"をコンパイルすると、非推奨の警告が発生するようになりました。\n" +"将来のリリースでは構文の警告に変わり、最終的には構文エラーになります。\n" +"警告をなくし、将来のリリースと互換性のあるコードにするには、数値リテラルとそ" +"の後のキーワードの間にスペースを追加してください。\n" +"(Serhiy Storchaka による貢献、:issue:`43833`。)" #: ../../whatsnew/3.10.rst:1881 msgid "Changes in the Python API" msgstr "Python API の変更" -#: ../../whatsnew/3.10.rst:1883 msgid "" "The *etype* parameters of the :func:`~traceback.format_exception`, :func:" "`~traceback.format_exception_only`, and :func:`~traceback.print_exception` " "functions in the :mod:`traceback` module have been renamed to *exc*. " "(Contributed by Zackery Spytz and Matthias Bussonnier in :issue:`26389`.)" msgstr "" +":mod:`traceback` モジュールの :func:`~traceback.format_exception`、:func:" +"`~traceback.format_exception_only`、:func:`~traceback.print_exception` 関数" +"の *etype* パラメータを *exc* に改名しました。\n" +"(Zackery Spytz と Matthias Bussonnier による貢献、:issue:`26389`。)" -#: ../../whatsnew/3.10.rst:1889 msgid "" ":mod:`atexit`: At Python exit, if a callback registered with :func:`atexit." "register` fails, its exception is now logged. Previously, only some " "exceptions were logged, and the last exception was always silently ignored. " "(Contributed by Victor Stinner in :issue:`42639`.)" msgstr "" +":mod:`atexit`: Python の終了時に :func:`atexit.register` で登録したコールバッ" +"クが失敗すると、その例外がログに記録されるようになりました。\n" +"以前は一部の例外しか記録されず、最後の例外は常に黙って無視されていました。\n" +"(Victor Stinner による貢献、:issue:`42639`。)" -#: ../../whatsnew/3.10.rst:1895 msgid "" ":class:`collections.abc.Callable` generic now flattens type parameters, " "similar to what :data:`typing.Callable` currently does. This means that " @@ -2893,48 +3697,65 @@ msgid "" "have passed silently in Python 3.9. (Contributed by Ken Jin in :issue:" "`42195`.)" msgstr "" +"ジェネリックの :class:`collections.abc.Callable` は、:data:`typing.Callable` " +"と同様に型引数を平坦化するようになりました。\n" +"つまり、``collections.abc.Callable[[int, str], str]`` の ``__args__`` は " +"``(int, str, str)`` になります。\n" +"以前は ``([int, str], str)`` でした。\n" +":func:`typing.get_args` や ``__args__`` で引数にアクセスするコードでは、この" +"変更に対応する必要があります。\n" +"さらに、Python 3.9 ではエラーにならなかった :class:`collections.abc." +"Callable` の無効なパラメータ化で、:exc:`TypeError` が送出される場合がありま" +"す。\n" +"(Ken Jin による貢献、:issue:`42195`。)" -#: ../../whatsnew/3.10.rst:1905 msgid "" ":meth:`socket.htons` and :meth:`socket.ntohs` now raise :exc:`OverflowError` " "instead of :exc:`DeprecationWarning` if the given parameter will not fit in " "a 16-bit unsigned integer. (Contributed by Erlend E. Aasland in :issue:" "`42393`.)" msgstr "" +":meth:`socket.htons` と :meth:`socket.ntohs` に渡した値が 16 ビット符号なし整" +"数に収まらない場合、:exc:`DeprecationWarning` ではなく :exc:`OverflowError` " +"を送出するようになりました。\n" +"(Erlend E. Aasland による貢献、:issue:`42393`。)" -#: ../../whatsnew/3.10.rst:1910 msgid "" "The ``loop`` parameter has been removed from most of :mod:`asyncio`\\ 's :" "doc:`high-level API <../library/asyncio-api-index>` following deprecation in " "Python 3.8." msgstr "" +"Python 3.8 での非推奨化に続き、:mod:`asyncio` の :doc:`高水準 API <../" +"library/asyncio-api-index>` の大半から ``loop`` パラメータを削除しました。" -#: ../../whatsnew/3.10.rst:1914 msgid "A coroutine that currently looks like this::" -msgstr "" +msgstr "現在次のようになっているコルーチンは、 ::" -#: ../../whatsnew/3.10.rst:1916 msgid "" "async def foo(loop):\n" " await asyncio.sleep(1, loop=loop)" msgstr "" +"async def foo(loop):\n" +" await asyncio.sleep(1, loop=loop)" -#: ../../whatsnew/3.10.rst:1919 msgid "Should be replaced with this::" -msgstr "" +msgstr "次のように置き換えてください。 ::" -#: ../../whatsnew/3.10.rst:1921 msgid "" "async def foo():\n" " await asyncio.sleep(1)" msgstr "" +"async def foo():\n" +" await asyncio.sleep(1)" -#: ../../whatsnew/3.10.rst:1924 msgid "" "If ``foo()`` was specifically designed *not* to run in the current thread's " "running event loop (e.g. running in another thread's event loop), consider " "using :func:`asyncio.run_coroutine_threadsafe` instead." msgstr "" +"``foo()`` を、現在のスレッドで実行中のイベントループで *実行しない* よう意図" +"的に設計している場合 (例えば別のスレッドのイベントループで実行する場合) は、" +"代わりに :func:`asyncio.run_coroutine_threadsafe` の使用を検討してください。" #: ../../whatsnew/3.10.rst:1931 msgid "" @@ -2951,7 +3772,6 @@ msgstr "" msgid "Changes in the C API" msgstr "C API の変更" -#: ../../whatsnew/3.10.rst:1942 msgid "" "The C API functions ``PyParser_SimpleParseStringFlags``, " "``PyParser_SimpleParseStringFlagsFilename``, " @@ -2959,32 +3779,41 @@ msgid "" "these functions, ``struct _node``, were removed due to the switch to the new " "PEG parser." msgstr "" +"新しい PEG パーサーへの移行に伴い、C API 関数 " +"``PyParser_SimpleParseStringFlags``、" +"``PyParser_SimpleParseStringFlagsFilename``、" +"``PyParser_SimpleParseFileFlags``、``PyNode_Compile`` と、これらの関数が使う" +"型 ``struct _node`` を削除しました。" -#: ../../whatsnew/3.10.rst:1948 msgid "" "Source should be now be compiled directly to a code object using, for " "example, :c:func:`Py_CompileString`. The resulting code object can then be " "evaluated using, for example, :c:func:`PyEval_EvalCode`." msgstr "" +"ソースコードは、例えば :c:func:`Py_CompileString` を使って、直接コードオブ" +"ジェクトにコンパイルしてください。\n" +"得られたコードオブジェクトは、例えば :c:func:`PyEval_EvalCode` を使って評価で" +"きます。" -#: ../../whatsnew/3.10.rst:1952 msgid "Specifically:" -msgstr "" +msgstr "具体的には次のようになります:" -#: ../../whatsnew/3.10.rst:1954 msgid "" "A call to ``PyParser_SimpleParseStringFlags`` followed by ``PyNode_Compile`` " "can be replaced by calling :c:func:`Py_CompileString`." msgstr "" +"``PyParser_SimpleParseStringFlags`` に続けて ``PyNode_Compile`` を呼び出す" +"コードは、:c:func:`Py_CompileString` の呼び出しに置き換えられます。" -#: ../../whatsnew/3.10.rst:1957 msgid "" "There is no direct replacement for ``PyParser_SimpleParseFileFlags``. To " "compile code from a ``FILE *`` argument, you will need to read the file in C " "and pass the resulting buffer to :c:func:`Py_CompileString`." msgstr "" +"``PyParser_SimpleParseFileFlags`` を直接置き換える関数はありません。\n" +"``FILE *`` 引数からコードをコンパイルするには、C でファイルを読み込み、その" +"バッファを :c:func:`Py_CompileString` に渡す必要があります。" -#: ../../whatsnew/3.10.rst:1961 msgid "" "To compile a file given a ``char *`` filename, explicitly open the file, " "read it and compile the result. One way to do this is using the :py:mod:`io` " @@ -2992,6 +3821,13 @@ msgid "" "c:func:`PyBytes_AsString` and :c:func:`Py_CompileString`, as sketched below. " "(Declarations and error handling are omitted.) ::" msgstr "" +"``char *`` のファイル名からファイルをコンパイルするには、ファイルを明示的に開" +"いて読み込み、その内容をコンパイルします。\n" +"例えば、次のように :py:mod:`io` モジュールを :c:func:" +"`PyImport_ImportModule`、:c:func:`PyObject_CallMethod`、:c:func:" +"`PyBytes_AsString`、:c:func:`Py_CompileString` と組み合わせて使う方法がありま" +"す。\n" +"(宣言とエラー処理は省略しています。) ::" #: ../../whatsnew/3.10.rst:1967 msgid "" @@ -3019,49 +3855,61 @@ msgstr "" msgid "CPython bytecode changes" msgstr "CPython バイトコードの変更" -#: ../../whatsnew/3.10.rst:1984 msgid "" "The ``MAKE_FUNCTION`` instruction now accepts either a dict or a tuple of " "strings as the function's annotations. (Contributed by Yurii Karabas and " "Inada Naoki in :issue:`42202`.)" msgstr "" +"``MAKE_FUNCTION`` 命令が、関数のアノテーションとして辞書と文字列のタプルのど" +"ちらも受け付けるようになりました。\n" +"(Yurii Karabas と Inada Naoki による貢献、:issue:`42202`。)" -#: ../../whatsnew/3.10.rst:1989 msgid "Build Changes" -msgstr "" +msgstr "ビルドの変更" -#: ../../whatsnew/3.10.rst:1991 msgid "" ":pep:`644`: Python now requires OpenSSL 1.1.1 or newer. OpenSSL 1.0.2 is no " "longer supported. (Contributed by Christian Heimes in :issue:`43669`.)" msgstr "" +":pep:`644`: Python には OpenSSL 1.1.1 以降が必要になりました。\n" +"OpenSSL 1.0.2 はサポートされなくなりました。\n" +"(Christian Heimes による貢献、:issue:`43669`。)" -#: ../../whatsnew/3.10.rst:1995 msgid "" "The C99 functions :c:func:`snprintf` and :c:func:`vsnprintf` are now " "required to build Python. (Contributed by Victor Stinner in :issue:`36020`.)" msgstr "" +"Python のビルドに C99 の関数 :c:func:`snprintf` と :c:func:`vsnprintf` が必要" +"になりました。\n" +"(Victor Stinner による貢献、:issue:`36020`。)" -#: ../../whatsnew/3.10.rst:1999 msgid "" ":mod:`sqlite3` requires SQLite 3.7.15 or higher. (Contributed by Sergey " "Fedoseev and Erlend E. Aasland in :issue:`40744` and :issue:`40810`.)" msgstr "" +":mod:`sqlite3` には SQLite 3.7.15 以降が必要です。\n" +"(Sergey Fedoseev と Erlend E. Aasland による貢献、:issue:`40744` と :issue:" +"`40810`。)" -#: ../../whatsnew/3.10.rst:2002 msgid "" "The :mod:`atexit` module must now always be built as a built-in module. " "(Contributed by Victor Stinner in :issue:`42639`.)" msgstr "" +":mod:`atexit` モジュールは、常に組み込みモジュールとしてビルドする必要があり" +"ます。\n" +"(Victor Stinner による貢献、:issue:`42639`。)" -#: ../../whatsnew/3.10.rst:2005 msgid "" "Add :option:`--disable-test-modules` option to the ``configure`` script: " "don't build nor install test modules. (Contributed by Xavier de Gaye, Thomas " "Petazzoni and Peixing Xin in :issue:`27640`.)" msgstr "" +"``configure`` スクリプトに :option:`--disable-test-modules` オプションを追加" +"しました。\n" +"テスト用モジュールをビルドもインストールもしないようにできます。\n" +"(Xavier de Gaye, Thomas Petazzoni と Peixing Xin による貢献、:issue:" +"`27640`。)" -#: ../../whatsnew/3.10.rst:2009 msgid "" "Add :option:`--with-wheel-pkg-dir=PATH option <--with-wheel-pkg-dir>` to the " "``./configure`` script. If specified, the :mod:`ensurepip` module looks for " @@ -3069,31 +3917,38 @@ msgid "" "present, these wheel packages are used instead of ensurepip bundled wheel " "packages." msgstr "" +"``./configure`` スクリプトに :option:`--with-wheel-pkg-dir=PATH オプション " +"<--with-wheel-pkg-dir>` を追加しました。\n" +"指定すると、:mod:`ensurepip` モジュールはそのディレクトリで ``setuptools`` " +"と ``pip`` の wheel パッケージを探します。\n" +"両方が見つかれば、ensurepip に同梱された wheel パッケージの代わりに使います。" -#: ../../whatsnew/3.10.rst:2015 msgid "" "Some Linux distribution packaging policies recommend against bundling " "dependencies. For example, Fedora installs wheel packages in the ``/usr/" "share/python-wheels/`` directory and don't install the ``ensurepip." "_bundled`` package." msgstr "" +"Linux ディストリビューションによっては、パッケージングの方針で依存パッケージ" +"の同梱を推奨していません。\n" +"例えば Fedora は wheel パッケージを ``/usr/share/python-wheels/`` ディレクト" +"リにインストールし、``ensurepip._bundled`` パッケージはインストールしません。" -#: ../../whatsnew/3.10.rst:2020 msgid "(Contributed by Victor Stinner in :issue:`42856`.)" -msgstr "" +msgstr "(Victor Stinner による貢献、:issue:`42856`。)" -#: ../../whatsnew/3.10.rst:2022 msgid "" "Add a new :option:`configure --without-static-libpython option <--without-" "static-libpython>` to not build the ``libpythonMAJOR.MINOR.a`` static " "library and not install the ``python.o`` object file." msgstr "" +"``libpythonMAJOR.MINOR.a`` 静的ライブラリのビルドと ``python.o`` オブジェクト" +"ファイルのインストールを行わない、新しい :option:`configure --without-static-" +"libpython オプション <--without-static-libpython>` を追加しました。" -#: ../../whatsnew/3.10.rst:2026 msgid "(Contributed by Victor Stinner in :issue:`43103`.)" -msgstr "" +msgstr "(Victor Stinner による貢献、:issue:`43103`。)" -#: ../../whatsnew/3.10.rst:2028 msgid "" "The ``configure`` script now uses the ``pkg-config`` utility, if available, " "to detect the location of Tcl/Tk headers and libraries. As before, those " @@ -3101,123 +3956,163 @@ msgid "" "``--with-tcltk-libs`` configuration options. (Contributed by Manolis " "Stamatogiannakis in :issue:`42603`.)" msgstr "" +"``configure`` スクリプトは、``pkg-config`` ユーティリティが利用できる場合、そ" +"れを使って Tcl/Tk のヘッダーとライブラリの場所を検出するようになりました。\n" +"従来どおり、``--with-tcltk-includes`` と ``--with-tcltk-libs`` の構成オプショ" +"ンで場所を明示的に指定することもできます。\n" +"(Manolis Stamatogiannakis による貢献、:issue:`42603`。)" -#: ../../whatsnew/3.10.rst:2034 msgid "" "Add :option:`--with-openssl-rpath` option to ``configure`` script. The " "option simplifies building Python with a custom OpenSSL installation, e.g. " "``./configure --with-openssl=/path/to/openssl --with-openssl-rpath=auto``. " "(Contributed by Christian Heimes in :issue:`43466`.)" msgstr "" +"``configure`` スクリプトに :option:`--with-openssl-rpath` オプションを追加し" +"ました。\n" +"``./configure --with-openssl=/path/to/openssl --with-openssl-rpath=auto`` の" +"ように、独自にインストールした OpenSSL を使って Python を簡単にビルドできま" +"す。\n" +"(Christian Heimes による貢献、:issue:`43466`。)" #: ../../whatsnew/3.10.rst:2041 msgid "C API Changes" msgstr "C API の変更" -#: ../../whatsnew/3.10.rst:2044 msgid "PEP 652: Maintaining the Stable ABI" -msgstr "" +msgstr "PEP 652: 安定 ABI の保守" -#: ../../whatsnew/3.10.rst:2046 msgid "" "The Stable ABI (Application Binary Interface) for extension modules or " "embedding Python is now explicitly defined. :ref:`stable` describes C API " "and ABI stability guarantees along with best practices for using the Stable " "ABI." msgstr "" +"拡張モジュールや Python の埋め込み向けの安定 ABI (アプリケーションバイナリイ" +"ンターフェース) を明示的に定義しました。\n" +":ref:`stable` では、C API と ABI の安定性の保証と、安定 ABI を使う際のベスト" +"プラクティスを説明しています。" -#: ../../whatsnew/3.10.rst:2051 msgid "(Contributed by Petr Viktorin in :pep:`652` and :issue:`43795`.)" -msgstr "" +msgstr "(Petr Viktorin による貢献、:pep:`652` と :issue:`43795`。)" -#: ../../whatsnew/3.10.rst:2056 msgid "" "The result of :c:func:`PyNumber_Index` now always has exact type :class:" "`int`. Previously, the result could have been an instance of a subclass of " "``int``. (Contributed by Serhiy Storchaka in :issue:`40792`.)" msgstr "" +":c:func:`PyNumber_Index` の結果の型は、常に厳密に :class:`int` になりまし" +"た。\n" +"以前は ``int`` のサブクラスのインスタンスになる場合がありました。\n" +"(Serhiy Storchaka による貢献、:issue:`40792`。)" -#: ../../whatsnew/3.10.rst:2060 msgid "" "Add a new :c:member:`~PyConfig.orig_argv` member to the :c:type:`PyConfig` " "structure: the list of the original command line arguments passed to the " "Python executable. (Contributed by Victor Stinner in :issue:`23427`.)" msgstr "" +":c:type:`PyConfig` 構造体に新しいメンバー :c:member:`~PyConfig.orig_argv` を" +"追加しました。\n" +"Python 実行ファイルに渡された元のコマンドライン引数のリストです。\n" +"(Victor Stinner による貢献、:issue:`23427`。)" -#: ../../whatsnew/3.10.rst:2065 msgid "" "The :c:func:`PyDateTime_DATE_GET_TZINFO` and :c:func:" "`PyDateTime_TIME_GET_TZINFO` macros have been added for accessing the " "``tzinfo`` attributes of :class:`datetime.datetime` and :class:`datetime." "time` objects. (Contributed by Zackery Spytz in :issue:`30155`.)" msgstr "" +":class:`datetime.datetime` オブジェクトと :class:`datetime.time` オブジェクト" +"の ``tzinfo`` 属性にアクセスするための、:c:func:`PyDateTime_DATE_GET_TZINFO` " +"マクロと :c:func:`PyDateTime_TIME_GET_TZINFO` マクロを追加しました。\n" +"(Zackery Spytz による貢献、:issue:`30155`。)" -#: ../../whatsnew/3.10.rst:2071 msgid "" "Add a :c:func:`PyCodec_Unregister` function to unregister a codec search " "function. (Contributed by Hai Shi in :issue:`41842`.)" msgstr "" +"コーデック検索関数の登録を解除する :c:func:`PyCodec_Unregister` 関数を追加し" +"ました。\n" +"(Hai Shi による貢献、:issue:`41842`。)" -#: ../../whatsnew/3.10.rst:2075 msgid "" "The :c:func:`PyIter_Send` function was added to allow sending value into " "iterator without raising ``StopIteration`` exception. (Contributed by " "Vladimir Matveev in :issue:`41756`.)" msgstr "" +"``StopIteration`` 例外を送出せずにイテレータに値を送れるよう、:c:func:" +"`PyIter_Send` 関数を追加しました。\n" +"(Vladimir Matveev による貢献、:issue:`41756`。)" -#: ../../whatsnew/3.10.rst:2079 msgid "" "Add :c:func:`PyUnicode_AsUTF8AndSize` to the limited C API. (Contributed by " "Alex Gaynor in :issue:`41784`.)" msgstr "" +"制限付き C API に :c:func:`PyUnicode_AsUTF8AndSize` を追加しました。\n" +"(Alex Gaynor による貢献、:issue:`41784`。)" -#: ../../whatsnew/3.10.rst:2082 msgid "" "Add :c:func:`PyModule_AddObjectRef` function: similar to :c:func:" "`PyModule_AddObject` but don't steal a reference to the value on success. " "(Contributed by Victor Stinner in :issue:`1635741`.)" msgstr "" +":c:func:`PyModule_AddObjectRef` 関数を追加しました。\n" +":c:func:`PyModule_AddObject` と似ていますが、成功時に値への参照を奪いませ" +"ん。\n" +"(Victor Stinner による貢献、:issue:`1635741`。)" -#: ../../whatsnew/3.10.rst:2087 msgid "" "Add :c:func:`Py_NewRef` and :c:func:`Py_XNewRef` functions to increment the " "reference count of an object and return the object. (Contributed by Victor " "Stinner in :issue:`42262`.)" msgstr "" +"オブジェクトの参照カウントを増やしてそのオブジェクトを返す、:c:func:" +"`Py_NewRef` 関数と :c:func:`Py_XNewRef` 関数を追加しました。\n" +"(Victor Stinner による貢献、:issue:`42262`。)" -#: ../../whatsnew/3.10.rst:2091 msgid "" "The :c:func:`PyType_FromSpecWithBases` and :c:func:" "`PyType_FromModuleAndSpec` functions now accept a single class as the " "*bases* argument. (Contributed by Serhiy Storchaka in :issue:`42423`.)" msgstr "" +":c:func:`PyType_FromSpecWithBases` 関数と :c:func:`PyType_FromModuleAndSpec` " +"関数の *bases* 引数に、単一のクラスを渡せるようになりました。\n" +"(Serhiy Storchaka による貢献、:issue:`42423`。)" -#: ../../whatsnew/3.10.rst:2095 msgid "" "The :c:func:`PyType_FromModuleAndSpec` function now accepts NULL ``tp_doc`` " "slot. (Contributed by Hai Shi in :issue:`41832`.)" msgstr "" +":c:func:`PyType_FromModuleAndSpec` 関数が、``tp_doc`` スロットの NULL を受け" +"付けるようになりました。\n" +"(Hai Shi による貢献、:issue:`41832`。)" -#: ../../whatsnew/3.10.rst:2099 msgid "" "The :c:func:`PyType_GetSlot` function can accept :ref:`static types `. (Contributed by Hai Shi and Petr Viktorin in :issue:`41073`.)" msgstr "" +":c:func:`PyType_GetSlot` 関数が :ref:`静的な型 ` を受け付けるよ" +"うになりました。\n" +"(Hai Shi と Petr Viktorin による貢献、:issue:`41073`。)" -#: ../../whatsnew/3.10.rst:2103 msgid "" "Add a new :c:func:`PySet_CheckExact` function to the C-API to check if an " "object is an instance of :class:`set` but not an instance of a subtype. " "(Contributed by Pablo Galindo in :issue:`43277`.)" msgstr "" +"オブジェクトが :class:`set` のインスタンスで、サブタイプのインスタンスではな" +"いことを調べる、新しい :c:func:`PySet_CheckExact` 関数を C API に追加しまし" +"た。\n" +"(Pablo Galindo による貢献、:issue:`43277`。)" -#: ../../whatsnew/3.10.rst:2107 msgid "" "Add :c:func:`PyErr_SetInterruptEx` which allows passing a signal number to " "simulate. (Contributed by Antoine Pitrou in :issue:`43356`.)" msgstr "" +"模擬的に発生させるシグナルの番号を渡せる :c:func:`PyErr_SetInterruptEx` を追" +"加しました。\n" +"(Antoine Pitrou による貢献、:issue:`43356`。)" -#: ../../whatsnew/3.10.rst:2111 msgid "" "The limited C API is now supported if :ref:`Python is built in debug mode " "` (if the ``Py_DEBUG`` macro is defined). In the limited C API, " @@ -3229,15 +4124,26 @@ msgid "" "structure is the same in release and debug mode since Python 3.8 (see :issue:" "`36465`)." msgstr "" +":ref:`Python をデバッグモードでビルド ` した場合 (``Py_DEBUG`` " +"マクロが定義されている場合) も、制限付き C API をサポートするようになりまし" +"た。\n" +"Python がデバッグモードでビルドされ、``Py_LIMITED_API`` マクロが Python 3.10 " +"以降を対象とする場合、制限付き C API の :c:func:`Py_INCREF` 関数と :c:func:" +"`Py_DECREF` 関数は :c:member:`PyObject.ob_refcnt` メンバーに直接アクセスせ" +"ず、内部を隠した関数呼び出しとして実装されます。\n" +"Python 3.8 以降、リリースモードとデバッグモードで :c:type:`PyObject` 構造体が" +"同一になったため、デバッグモードでも制限付き C API をサポートできるようになり" +"ました (:issue:`36465` を参照)。" -#: ../../whatsnew/3.10.rst:2121 msgid "" "The limited C API is still not supported in the :option:`--with-trace-refs` " "special build (``Py_TRACE_REFS`` macro). (Contributed by Victor Stinner in :" "issue:`43688`.)" msgstr "" +":option:`--with-trace-refs` を使った特殊なビルド (``Py_TRACE_REFS`` マクロ) " +"では、引き続き制限付き C API はサポートされません。\n" +"(Victor Stinner による貢献、:issue:`43688`。)" -#: ../../whatsnew/3.10.rst:2125 msgid "" "Add the :c:func:`Py_Is(x, y) ` function to test if the *x* object is " "the *y* object, the same as ``x is y`` in Python. Add also the :c:func:" @@ -3246,29 +4152,42 @@ msgid "" "or the ``False`` singleton. (Contributed by Victor Stinner in :issue:" "`43753`.)" msgstr "" +"Python の ``x is y`` と同様に、オブジェクト *x* とオブジェクト *y* が同一か調" +"べる :c:func:`Py_Is(x, y) ` 関数を追加しました。\n" +"また、オブジェクトがそれぞれ ``None``、``True``、``False`` のシングルトンかを" +"調べる :c:func:`Py_IsNone` 関数、:c:func:`Py_IsTrue` 関数、:c:func:" +"`Py_IsFalse` 関数も追加しました。\n" +"(Victor Stinner による貢献、:issue:`43753`。)" -#: ../../whatsnew/3.10.rst:2132 msgid "" "Add new functions to control the garbage collector from C code: :c:func:" "`PyGC_Enable()`, :c:func:`PyGC_Disable()`, :c:func:`PyGC_IsEnabled()`. These " "functions allow to activate, deactivate and query the state of the garbage " "collector from C code without having to import the :mod:`gc` module." msgstr "" +"C コードからガベージコレクタを制御する新しい関数 :c:func:`PyGC_Enable()`、:c:" +"func:`PyGC_Disable()`、:c:func:`PyGC_IsEnabled()` を追加しました。\n" +":mod:`gc` モジュールをインポートせずに、C コードからガベージコレクタを有効" +"化、無効化したり、状態を調べたりできます。" -#: ../../whatsnew/3.10.rst:2139 msgid "" "Add a new :c:macro:`Py_TPFLAGS_DISALLOW_INSTANTIATION` type flag to disallow " "creating type instances. (Contributed by Victor Stinner in :issue:`43916`.)" msgstr "" +"型のインスタンスの作成を禁止する、新しい型フラグ :c:macro:" +"`Py_TPFLAGS_DISALLOW_INSTANTIATION` を追加しました。\n" +"(Victor Stinner による貢献、:issue:`43916`。)" -#: ../../whatsnew/3.10.rst:2143 msgid "" "Add a new :c:macro:`Py_TPFLAGS_IMMUTABLETYPE` type flag for creating " "immutable type objects: type attributes cannot be set nor deleted. " "(Contributed by Victor Stinner and Erlend E. Aasland in :issue:`43908`.)" msgstr "" +"イミュータブルな型オブジェクトを作成するための新しい型フラグ :c:macro:" +"`Py_TPFLAGS_IMMUTABLETYPE` を追加しました。\n" +"この型の属性は設定も削除もできません。\n" +"(Victor Stinner と Erlend E. Aasland による貢献、:issue:`43908`。)" -#: ../../whatsnew/3.10.rst:2150 msgid "" "The ``PY_SSIZE_T_CLEAN`` macro must now be defined to use :c:func:" "`PyArg_ParseTuple` and :c:func:`Py_BuildValue` formats which use ``#``: " @@ -3276,47 +4195,65 @@ msgid "" "ref:`arg-parsing` and :pep:`353`. (Contributed by Victor Stinner in :issue:" "`40943`.)" msgstr "" +":c:func:`PyArg_ParseTuple` と :c:func:`Py_BuildValue` の ``#`` を使う書式 " +"(``es#``、``et#``、``s#``、``u#``、``y#``、``z#``、``U#``、``Z#``) を使うに" +"は、``PY_SSIZE_T_CLEAN`` マクロの定義が必要になりました。\n" +":ref:`arg-parsing` と :pep:`353` を参照してください。\n" +"(Victor Stinner による貢献、:issue:`40943`。)" -#: ../../whatsnew/3.10.rst:2156 msgid "" "Since :c:func:`Py_REFCNT()` is changed to the inline static function, " "``Py_REFCNT(obj) = new_refcnt`` must be replaced with ``Py_SET_REFCNT(obj, " "new_refcnt)``: see :c:func:`Py_SET_REFCNT()` (available since Python 3.9). " "For backward compatibility, this macro can be used::" msgstr "" +":c:func:`Py_REFCNT()` を static インライン関数に変更したため、" +"``Py_REFCNT(obj) = new_refcnt`` を ``Py_SET_REFCNT(obj, new_refcnt)`` に置き" +"換える必要があります。\n" +":c:func:`Py_SET_REFCNT()` (Python 3.9 以降で利用可能) を参照してください。\n" +"後方互換性のため、次のマクロを使えます。 ::" -#: ../../whatsnew/3.10.rst:2161 msgid "" "#if PY_VERSION_HEX < 0x030900A4\n" "# define Py_SET_REFCNT(obj, refcnt) ((Py_REFCNT(obj) = (refcnt)), (void)0)\n" "#endif" msgstr "" +"#if PY_VERSION_HEX < 0x030900A4\n" +"# define Py_SET_REFCNT(obj, refcnt) ((Py_REFCNT(obj) = (refcnt)), (void)0)\n" +"#endif" -#: ../../whatsnew/3.10.rst:2165 msgid "(Contributed by Victor Stinner in :issue:`39573`.)" -msgstr "" +msgstr "(Victor Stinner による :issue:`39573` での貢献。)" -#: ../../whatsnew/3.10.rst:2167 msgid "" "Calling :c:func:`PyDict_GetItem` without :term:`GIL` held had been allowed " "for historical reason. It is no longer allowed. (Contributed by Victor " "Stinner in :issue:`40839`.)" msgstr "" +"歴史的な理由で許されていた、:term:`GIL` を保持せずに :c:func:" +"`PyDict_GetItem` を呼び出すことは、許されなくなりました。\n" +"(Victor Stinner による貢献、:issue:`40839`。)" -#: ../../whatsnew/3.10.rst:2171 msgid "" "``PyUnicode_FromUnicode(NULL, size)`` and " "``PyUnicode_FromStringAndSize(NULL, size)`` raise ``DeprecationWarning`` " "now. Use :c:func:`PyUnicode_New` to allocate Unicode object without initial " "data. (Contributed by Inada Naoki in :issue:`36346`.)" msgstr "" +"``PyUnicode_FromUnicode(NULL, size)`` と ``PyUnicode_FromStringAndSize(NULL, " +"size)`` が ``DeprecationWarning`` を発生させるようになりました。\n" +"初期データなしで Unicode オブジェクトを確保するには、:c:func:`PyUnicode_New` " +"を使ってください。\n" +"(Inada Naoki による貢献、:issue:`36346`。)" -#: ../../whatsnew/3.10.rst:2176 msgid "" "The private ``_PyUnicode_Name_CAPI`` structure of the PyCapsule API " "``unicodedata.ucnhash_CAPI`` has been moved to the internal C API. " "(Contributed by Victor Stinner in :issue:`42157`.)" msgstr "" +"PyCapsule API ``unicodedata.ucnhash_CAPI`` の非公開構造体 " +"``_PyUnicode_Name_CAPI`` を、内部 C API に移動しました。\n" +"(Victor Stinner による貢献、:issue:`42157`。)" #: ../../whatsnew/3.10.rst:2180 msgid "" @@ -3328,7 +4265,6 @@ msgid "" "Stinner in :issue:`42260`.)" msgstr "" -#: ../../whatsnew/3.10.rst:2187 msgid "" ":c:func:`PyList_SET_ITEM`, :c:func:`PyTuple_SET_ITEM` and :c:func:" "`PyCell_SET` macros can no longer be used as l-value or r-value. For " @@ -3337,8 +4273,14 @@ msgid "" "(PyList_SET_ITEM (a, b, c) < 0) ...`` test. (Contributed by Zackery Spytz " "and Victor Stinner in :issue:`30459`.)" msgstr "" +":c:func:`PyList_SET_ITEM`、:c:func:`PyTuple_SET_ITEM`、:c:func:`PyCell_SET` " +"マクロを左辺値や右辺値として使えなくなりました。\n" +"例えば ``x = PyList_SET_ITEM(a, b, c)`` や ``PyList_SET_ITEM(a, b, c) = x`` " +"はコンパイルエラーになります。\n" +"これにより ``if (PyList_SET_ITEM (a, b, c) < 0) ...`` のような検査によるバグ" +"を防ぎます。\n" +"(Zackery Spytz と Victor Stinner による貢献、:issue:`30459`。)" -#: ../../whatsnew/3.10.rst:2194 msgid "" "The non-limited API files ``odictobject.h``, ``parser_interface.h``, " "``picklebufobject.h``, ``pyarena.h``, ``pyctype.h``, ``pydebug.h``, ``pyfpe." @@ -3348,8 +4290,16 @@ msgid "" "consider including ``Python.h`` instead. (Contributed by Nicholas Sim in :" "issue:`35134`.)" msgstr "" +"制限付き API に含まれないファイル ``odictobject.h``、``parser_interface.h``、" +"``picklebufobject.h``、``pyarena.h``、``pyctype.h``、``pydebug.h``、``pyfpe." +"h``、``pytime.h`` を ``Include/cpython`` ディレクトリに移動しました。\n" +"これらは ``Python.h`` にすでに含まれているため、直接インクルードしないでくだ" +"さい。\n" +":ref:`api-includes` を参照してください。\n" +"直接インクルードしている場合は、代わりに ``Python.h`` をインクルードすること" +"を検討してください。\n" +"(Nicholas Sim による貢献、:issue:`35134`。)" -#: ../../whatsnew/3.10.rst:2202 msgid "" "Use the :c:macro:`Py_TPFLAGS_IMMUTABLETYPE` type flag to create immutable " "type objects. Do not rely on :c:macro:`Py_TPFLAGS_HEAPTYPE` to decide if a " @@ -3357,158 +4307,203 @@ msgid "" "is set instead. (Contributed by Victor Stinner and Erlend E. Aasland in :" "issue:`43908`.)" msgstr "" +"イミュータブルな型オブジェクトを作成するには、型フラグ :c:macro:" +"`Py_TPFLAGS_IMMUTABLETYPE` を使ってください。\n" +"型オブジェクトがミュータブルかどうかを判断するために :c:macro:" +"`Py_TPFLAGS_HEAPTYPE` に頼らず、代わりに :c:macro:`Py_TPFLAGS_IMMUTABLETYPE` " +"が設定されているかを調べてください。\n" +"(Victor Stinner と Erlend E. Aasland による貢献、:issue:`43908`。)" -#: ../../whatsnew/3.10.rst:2208 msgid "" "The undocumented function ``Py_FrozenMain`` has been removed from the " "limited API. The function is mainly useful for custom builds of Python. " "(Contributed by Petr Viktorin in :issue:`26241`.)" msgstr "" +"ドキュメントに記載されていない関数 ``Py_FrozenMain`` を制限付き API から削除" +"しました。\n" +"この関数は主に Python のカスタムビルドで役立つものです。\n" +"(Petr Viktorin による貢献、:issue:`26241`。)" -#: ../../whatsnew/3.10.rst:2215 msgid "" "The ``PyUnicode_InternImmortal()`` function is now deprecated and will be " "removed in Python 3.12: use :c:func:`PyUnicode_InternInPlace` instead. " "(Contributed by Victor Stinner in :issue:`41692`.)" msgstr "" +"``PyUnicode_InternImmortal()`` 関数は非推奨となり、Python 3.12 で削除する予定" +"です。\n" +"代わりに :c:func:`PyUnicode_InternInPlace` を使ってください。\n" +"(Victor Stinner による貢献、:issue:`41692`。)" -#: ../../whatsnew/3.10.rst:2223 msgid "" "Removed ``Py_UNICODE_str*`` functions manipulating ``Py_UNICODE*`` strings. " "(Contributed by Inada Naoki in :issue:`41123`.)" msgstr "" +"``Py_UNICODE*`` 文字列を操作する ``Py_UNICODE_str*`` 関数を削除しました。\n" +"(Inada Naoki による貢献、:issue:`41123`。)" -#: ../../whatsnew/3.10.rst:2226 msgid "" "``Py_UNICODE_strlen``: use :c:func:`PyUnicode_GetLength` or :c:macro:" "`PyUnicode_GET_LENGTH`" msgstr "" +"``Py_UNICODE_strlen``: :c:func:`PyUnicode_GetLength` または :c:macro:" +"`PyUnicode_GET_LENGTH` を使ってください。" -#: ../../whatsnew/3.10.rst:2228 msgid "" "``Py_UNICODE_strcat``: use :c:func:`PyUnicode_CopyCharacters` or :c:func:" "`PyUnicode_FromFormat`" msgstr "" +"``Py_UNICODE_strcat``: :c:func:`PyUnicode_CopyCharacters` または :c:func:" +"`PyUnicode_FromFormat` を使ってください。" -#: ../../whatsnew/3.10.rst:2230 msgid "" "``Py_UNICODE_strcpy``, ``Py_UNICODE_strncpy``: use :c:func:" "`PyUnicode_CopyCharacters` or :c:func:`PyUnicode_Substring`" msgstr "" +"``Py_UNICODE_strcpy``、``Py_UNICODE_strncpy``: :c:func:" +"`PyUnicode_CopyCharacters` または :c:func:`PyUnicode_Substring` を使ってくだ" +"さい。" -#: ../../whatsnew/3.10.rst:2232 msgid "``Py_UNICODE_strcmp``: use :c:func:`PyUnicode_Compare`" -msgstr "" +msgstr "``Py_UNICODE_strcmp``: :c:func:`PyUnicode_Compare` を使ってください。" -#: ../../whatsnew/3.10.rst:2233 msgid "``Py_UNICODE_strncmp``: use :c:func:`PyUnicode_Tailmatch`" msgstr "" +"``Py_UNICODE_strncmp``: :c:func:`PyUnicode_Tailmatch` を使ってください。" -#: ../../whatsnew/3.10.rst:2234 msgid "" "``Py_UNICODE_strchr``, ``Py_UNICODE_strrchr``: use :c:func:" "`PyUnicode_FindChar`" msgstr "" +"``Py_UNICODE_strchr``、``Py_UNICODE_strrchr``: :c:func:`PyUnicode_FindChar` " +"を使ってください。" -#: ../../whatsnew/3.10.rst:2237 msgid "" "Removed ``PyUnicode_GetMax()``. Please migrate to new (:pep:`393`) APIs. " "(Contributed by Inada Naoki in :issue:`41103`.)" msgstr "" +"``PyUnicode_GetMax()`` を削除しました。\n" +"新しい API (:pep:`393`) に移行してください。\n" +"(Inada Naoki による貢献、:issue:`41103`。)" -#: ../../whatsnew/3.10.rst:2240 msgid "" "Removed ``PyLong_FromUnicode()``. Please migrate to :c:func:" "`PyLong_FromUnicodeObject`. (Contributed by Inada Naoki in :issue:`41103`.)" msgstr "" +"``PyLong_FromUnicode()`` を削除しました。\n" +":c:func:`PyLong_FromUnicodeObject` に移行してください。\n" +"(Inada Naoki による貢献、:issue:`41103`。)" -#: ../../whatsnew/3.10.rst:2243 msgid "" "Removed ``PyUnicode_AsUnicodeCopy()``. Please use :c:func:" "`PyUnicode_AsUCS4Copy` or :c:func:`PyUnicode_AsWideCharString` (Contributed " "by Inada Naoki in :issue:`41103`.)" msgstr "" +"``PyUnicode_AsUnicodeCopy()`` を削除しました。\n" +":c:func:`PyUnicode_AsUCS4Copy` または :c:func:`PyUnicode_AsWideCharString` を" +"使ってください。\n" +"(Inada Naoki による貢献、:issue:`41103`。)" -#: ../../whatsnew/3.10.rst:2247 msgid "" "Removed ``_Py_CheckRecursionLimit`` variable: it has been replaced by " "``ceval.recursion_limit`` of the :c:type:`PyInterpreterState` structure. " "(Contributed by Victor Stinner in :issue:`41834`.)" msgstr "" +"``_Py_CheckRecursionLimit`` 変数を削除しました。\n" +":c:type:`PyInterpreterState` 構造体の ``ceval.recursion_limit`` に置き換えら" +"れています。\n" +"(Victor Stinner による貢献、:issue:`41834`。)" -#: ../../whatsnew/3.10.rst:2251 msgid "" "Removed undocumented macros ``Py_ALLOW_RECURSION`` and " "``Py_END_ALLOW_RECURSION`` and the ``recursion_critical`` field of the :c:" "type:`PyInterpreterState` structure. (Contributed by Serhiy Storchaka in :" "issue:`41936`.)" msgstr "" +"ドキュメントに記載されていないマクロ ``Py_ALLOW_RECURSION`` と " +"``Py_END_ALLOW_RECURSION``、および :c:type:`PyInterpreterState` 構造体の " +"``recursion_critical`` フィールドを削除しました。\n" +"(Serhiy Storchaka による貢献、:issue:`41936`。)" -#: ../../whatsnew/3.10.rst:2256 msgid "" "Removed the undocumented ``PyOS_InitInterrupts()`` function. Initializing " "Python already implicitly installs signal handlers: see :c:member:`PyConfig." "install_signal_handlers`. (Contributed by Victor Stinner in :issue:`41713`.)" msgstr "" +"ドキュメントに記載されていない ``PyOS_InitInterrupts()`` 関数を削除しまし" +"た。\n" +"Python の初期化時にシグナルハンドラーは暗黙に設定されます。\n" +":c:member:`PyConfig.install_signal_handlers` を参照してください。\n" +"(Victor Stinner による貢献、:issue:`41713`。)" -#: ../../whatsnew/3.10.rst:2261 msgid "" "Remove the ``PyAST_Validate()`` function. It is no longer possible to build " "a AST object (``mod_ty`` type) with the public C API. The function was " "already excluded from the limited C API (:pep:`384`). (Contributed by Victor " "Stinner in :issue:`43244`.)" msgstr "" +"``PyAST_Validate()`` 関数を削除しました。\n" +"公開 C API で AST オブジェクト (``mod_ty`` 型) を構築することはできなくなりま" +"した。\n" +"この関数はすでに制限付き C API (:pep:`384`) の対象外でした。\n" +"(Victor Stinner による貢献、:issue:`43244`。)" -#: ../../whatsnew/3.10.rst:2266 msgid "Remove the ``symtable.h`` header file and the undocumented functions:" msgstr "" +"``symtable.h`` ヘッダーファイルと、ドキュメントに記載されていない次の関数を削" +"除しました:" #: ../../whatsnew/3.10.rst:2268 msgid "``PyST_GetScope()``" -msgstr "" +msgstr "``PyST_GetScope()``" #: ../../whatsnew/3.10.rst:2269 msgid "``PySymtable_Build()``" -msgstr "" +msgstr "``PySymtable_Build()``" #: ../../whatsnew/3.10.rst:2270 msgid "``PySymtable_BuildObject()``" -msgstr "" +msgstr "``PySymtable_BuildObject()``" #: ../../whatsnew/3.10.rst:2271 msgid "``PySymtable_Free()``" -msgstr "" +msgstr "``PySymtable_Free()``" #: ../../whatsnew/3.10.rst:2272 msgid "``Py_SymtableString()``" -msgstr "" +msgstr "``Py_SymtableString()``" #: ../../whatsnew/3.10.rst:2273 msgid "``Py_SymtableStringObject()``" -msgstr "" +msgstr "``Py_SymtableStringObject()``" -#: ../../whatsnew/3.10.rst:2275 msgid "" "The ``Py_SymtableString()`` function was part the stable ABI by mistake but " "it could not be used, because the ``symtable.h`` header file was excluded " "from the limited C API." msgstr "" +"``Py_SymtableString()`` 関数は誤って安定 ABI に含まれていましたが、" +"``symtable.h`` ヘッダーファイルが制限付き C API の対象外だったため使えません" +"でした。" -#: ../../whatsnew/3.10.rst:2279 msgid "" "Use Python :mod:`symtable` module instead. (Contributed by Victor Stinner " "in :issue:`43244`.)" msgstr "" +"代わりに Python の :mod:`symtable` モジュールを使ってください。\n" +"(Victor Stinner による貢献、:issue:`43244`。)" -#: ../../whatsnew/3.10.rst:2282 msgid "" "Remove :c:func:`PyOS_ReadlineFunctionPointer` from the limited C API headers " "and from ``python3.dll``, the library that provides the stable ABI on " "Windows. Since the function takes a ``FILE*`` argument, its ABI stability " "cannot be guaranteed. (Contributed by Petr Viktorin in :issue:`43868`.)" msgstr "" +"制限付き C API のヘッダーと、Windows で安定 ABI を提供するライブラリ " +"``python3.dll`` から、:c:func:`PyOS_ReadlineFunctionPointer` を削除しまし" +"た。\n" +"この関数は ``FILE*`` 引数を取るため、ABI の安定性を保証できません。\n" +"(Petr Viktorin による貢献、:issue:`43868`。)" -#: ../../whatsnew/3.10.rst:2288 msgid "" "Remove ``ast.h``, ``asdl.h``, and ``Python-ast.h`` header files. These " "functions were undocumented and excluded from the limited C API. Most names " @@ -3518,97 +4513,110 @@ msgid "" "```` header. Use the Python :mod:`ast` module instead. " "(Contributed by Victor Stinner in :issue:`43244`.)" msgstr "" +"``ast.h``、``asdl.h``、``Python-ast.h`` ヘッダーファイルを削除しました。\n" +"これらの関数はドキュメントに記載されておらず、制限付き C API にも含まれていま" +"せんでした。\n" +"これらのヘッダーファイルで定義される名前の大半は ``Py`` で始まっていないた" +"め、名前の衝突を起こす可能性がありました。\n" +"例えば ``Python-ast.h`` の ``Yield`` マクロは、Windows の ```` " +"ヘッダーが使う名前 ``Yield`` と衝突していました。\n" +"代わりに Python の :mod:`ast` モジュールを使ってください。\n" +"(Victor Stinner による貢献、:issue:`43244`。)" -#: ../../whatsnew/3.10.rst:2296 msgid "" "Remove the compiler and parser functions using ``struct _mod`` type, because " "the public AST C API was removed:" msgstr "" +"公開 AST C API の削除に伴い、``struct _mod`` 型を使う次のコンパイラ関数とパー" +"サー関数を削除しました:" #: ../../whatsnew/3.10.rst:2299 msgid "``PyAST_Compile()``" -msgstr "" +msgstr "``PyAST_Compile()``" #: ../../whatsnew/3.10.rst:2300 msgid "``PyAST_CompileEx()``" -msgstr "" +msgstr "``PyAST_CompileEx()``" #: ../../whatsnew/3.10.rst:2301 msgid "``PyAST_CompileObject()``" -msgstr "" +msgstr "``PyAST_CompileObject()``" #: ../../whatsnew/3.10.rst:2302 msgid "``PyFuture_FromAST()``" -msgstr "" +msgstr "``PyFuture_FromAST()``" #: ../../whatsnew/3.10.rst:2303 msgid "``PyFuture_FromASTObject()``" -msgstr "" +msgstr "``PyFuture_FromASTObject()``" #: ../../whatsnew/3.10.rst:2304 msgid "``PyParser_ASTFromFile()``" -msgstr "" +msgstr "``PyParser_ASTFromFile()``" #: ../../whatsnew/3.10.rst:2305 msgid "``PyParser_ASTFromFileObject()``" -msgstr "" +msgstr "``PyParser_ASTFromFileObject()``" #: ../../whatsnew/3.10.rst:2306 msgid "``PyParser_ASTFromFilename()``" -msgstr "" +msgstr "``PyParser_ASTFromFilename()``" #: ../../whatsnew/3.10.rst:2307 msgid "``PyParser_ASTFromString()``" -msgstr "" +msgstr "``PyParser_ASTFromString()``" #: ../../whatsnew/3.10.rst:2308 msgid "``PyParser_ASTFromStringObject()``" -msgstr "" +msgstr "``PyParser_ASTFromStringObject()``" -#: ../../whatsnew/3.10.rst:2310 msgid "" "These functions were undocumented and excluded from the limited C API. " "(Contributed by Victor Stinner in :issue:`43244`.)" msgstr "" +"これらの関数はドキュメントに記載されておらず、制限付き C API にも含まれていま" +"せんでした。\n" +"(Victor Stinner による貢献、:issue:`43244`。)" -#: ../../whatsnew/3.10.rst:2313 msgid "Remove the ``pyarena.h`` header file with functions:" -msgstr "" +msgstr "``pyarena.h`` ヘッダーファイルと次の関数を削除しました:" #: ../../whatsnew/3.10.rst:2315 msgid "``PyArena_New()``" -msgstr "" +msgstr "``PyArena_New()``" #: ../../whatsnew/3.10.rst:2316 msgid "``PyArena_Free()``" -msgstr "" +msgstr "``PyArena_Free()``" #: ../../whatsnew/3.10.rst:2317 msgid "``PyArena_Malloc()``" -msgstr "" +msgstr "``PyArena_Malloc()``" #: ../../whatsnew/3.10.rst:2318 msgid "``PyArena_AddPyObject()``" -msgstr "" +msgstr "``PyArena_AddPyObject()``" -#: ../../whatsnew/3.10.rst:2320 msgid "" "These functions were undocumented, excluded from the limited C API, and were " "only used internally by the compiler. (Contributed by Victor Stinner in :" "issue:`43244`.)" msgstr "" +"これらの関数はドキュメントに記載されておらず、制限付き C API にも含まれず、コ" +"ンパイラの内部でしか使われていませんでした。\n" +"(Victor Stinner による貢献、:issue:`43244`。)" -#: ../../whatsnew/3.10.rst:2324 msgid "" "The ``PyThreadState.use_tracing`` member has been removed to optimize " "Python. (Contributed by Mark Shannon in :issue:`43760`.)" msgstr "" +"Python を最適化するために ``PyThreadState.use_tracing`` メンバーを削除しまし" +"た。\n" +"(Mark Shannon による貢献、:issue:`43760`。)" -#: ../../whatsnew/3.10.rst:2329 msgid "Notable security feature in 3.10.7" -msgstr "" +msgstr "3.10.7 の注目すべきセキュリティ機能" -#: ../../whatsnew/3.10.rst:2331 msgid "" "Converting between :class:`int` and :class:`str` in bases other than 2 " "(binary), 4, 8 (octal), 16 (hexadecimal), or 32 such as base 10 (decimal) " @@ -3620,12 +4628,20 @@ msgid "" "limitation ` documentation. The default limit is 4300 " "digits in string form." msgstr "" +"2 (2 進数)、4、8 (8 進数)、16 (16 進数)、32 以外の基数、例えば 10 (10 進数) " +"で :class:`int` と :class:`str` を相互変換する際、文字列表記の桁数が上限を超" +"えると :exc:`ValueError` を送出するようになりました。\n" +"アルゴリズムの計算量を悪用したサービス拒否攻撃を防ぐためで、:cve:" +"`2020-10735` の緩和策です。\n" +"この上限は、環境変数、コマンドラインフラグ、:mod:`sys` の API で設定または無" +"効化できます。\n" +":ref:`整数の文字列変換の長さ制限 ` のドキュメントを参照し" +"てください。\n" +"デフォルトの上限は文字列表記で 4300 桁です。" -#: ../../whatsnew/3.10.rst:2342 msgid "Notable security feature in 3.10.8" -msgstr "" +msgstr "3.10.8 の注目すべきセキュリティ機能" -#: ../../whatsnew/3.10.rst:2344 msgid "" "The deprecated :mod:`!mailcap` module now refuses to inject unsafe text " "(filenames, MIME types, parameters) into shell commands. Instead of using " @@ -3633,16 +4649,21 @@ msgid "" "commands, as if the test failed). (Contributed by Petr Viktorin in :gh:" "`98966`.)" msgstr "" +"非推奨の :mod:`!mailcap` モジュールは、安全でないテキスト (ファイル名、MIME " +"タイプ、パラメータ) をシェルコマンドに埋め込むことを拒否するようになりまし" +"た。\n" +"そのようなテキストを使う代わりに、警告を出して一致する項目が見つからなかった" +"かのように動作します (テストコマンドの場合は、テストが失敗したかのように動作" +"します)。\n" +"(Petr Viktorin による貢献、:gh:`98966`。)" -#: ../../whatsnew/3.10.rst:2351 msgid "Notable changes in 3.10.12" -msgstr "" +msgstr "3.10.12 の注目すべき変更" #: ../../whatsnew/3.10.rst:2354 msgid "tarfile" msgstr "tarfile" -#: ../../whatsnew/3.10.rst:2356 msgid "" "The extraction methods in :mod:`tarfile`, and :func:`shutil.unpack_archive`, " "have a new a *filter* argument that allows limiting tar features than may be " @@ -3652,3 +4673,12 @@ msgid "" "Python 3.14, the default will switch to ``'data'``. (Contributed by Petr " "Viktorin in :pep:`706`.)" msgstr "" +":mod:`tarfile` の展開メソッドと :func:`shutil.unpack_archive` に *filter* 引" +"数が追加されました。\n" +"これにより、展開先ディレクトリの外にファイルを作成するなど、予想外の動作や危" +"険な動作を招く tar の機能を制限できます。\n" +"詳しくは :ref:`tarfile-extraction-filter` を参照してください。\n" +"Python 3.12 では *filter* 引数を指定せずに使うと :exc:`DeprecationWarning` が" +"表示されます。\n" +"Python 3.14 ではデフォルトが ``'data'`` に変わります。\n" +"(Petr Viktorin による :pep:`706` での貢献。)" diff --git a/whatsnew/3.11.po b/whatsnew/3.11.po index 3d2319fd8..802b5f795 100644 --- a/whatsnew/3.11.po +++ b/whatsnew/3.11.po @@ -23,10 +23,10 @@ msgstr "" "Last-Translator: Arihiro TAKASE, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../whatsnew/3.11.rst:3 @@ -95,7 +95,7 @@ msgstr "" #: ../../whatsnew/3.11.rst:79 msgid "Interpreter improvements:" -msgstr "インタープリタの改善:" +msgstr "インタプリタの改善:" #: ../../whatsnew/3.11.rst:81 msgid ":ref:`whatsnew311-pep657`" @@ -178,7 +178,6 @@ msgstr "" "トレースバックの出力時に、インタープリタはエラーを送出した行だけでなく正確な" "式を指し示すようになりました。たとえば::" -#: ../../whatsnew/3.11.rst:118 msgid "" "Traceback (most recent call last):\n" " File \"distance.py\", line 11, in \n" @@ -189,6 +188,14 @@ msgid "" " ^^^^^^^^^\n" "AttributeError: 'NoneType' object has no attribute 'x'" msgstr "" +"Traceback (most recent call last):\n" +" File \"distance.py\", line 11, in \n" +" print(manhattan_distance(p1, p2))\n" +" ^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +" File \"distance.py\", line 6, in manhattan_distance\n" +" return abs(point_1.x - point_2.x) + abs(point_1.y - point_2.y)\n" +" ^^^^^^^^^\n" +"AttributeError: 'NoneType' object has no attribute 'x'" #: ../../whatsnew/3.11.rst:129 msgid "" @@ -202,7 +209,6 @@ msgstr "" "れた :class:`dict` オブジェクトや複数の関数呼び出しを処理するときにも役立ちま" "す:" -#: ../../whatsnew/3.11.rst:133 msgid "" "Traceback (most recent call last):\n" " File \"query.py\", line 37, in \n" @@ -218,12 +224,23 @@ msgid "" " ~~~~~~~~~~~~~~~~~~^^^^^\n" "TypeError: 'NoneType' object is not subscriptable" msgstr "" +"Traceback (most recent call last):\n" +" File \"query.py\", line 37, in \n" +" magic_arithmetic('foo')\n" +" File \"query.py\", line 18, in magic_arithmetic\n" +" return add_counts(x) / 25\n" +" ^^^^^^^^^^^^^\n" +" File \"query.py\", line 24, in add_counts\n" +" return 25 + query_user(user1) + query_user(user2)\n" +" ^^^^^^^^^^^^^^^^^\n" +" File \"query.py\", line 32, in query_user\n" +" return 1 + query_count(db, response['a']['b']['c']['user'], retry=True)\n" +" ~~~~~~~~~~~~~~~~~~^^^^^\n" +"TypeError: 'NoneType' object is not subscriptable" -#: ../../whatsnew/3.11.rst:149 msgid "As well as complex arithmetic expressions:" -msgstr "複雑な算術式と同様に:" +msgstr "複雑な算術式でも役立ちます。" -#: ../../whatsnew/3.11.rst:151 msgid "" "Traceback (most recent call last):\n" " File \"calculation.py\", line 54, in \n" @@ -231,6 +248,11 @@ msgid "" " ~~~~~~^~~\n" "ZeroDivisionError: division by zero" msgstr "" +"Traceback (most recent call last):\n" +" File \"calculation.py\", line 54, in \n" +" result = (x / y / z) * (a / b / c)\n" +" ~~~~~~^~~\n" +"ZeroDivisionError: division by zero" #: ../../whatsnew/3.11.rst:159 msgid "" @@ -259,7 +281,6 @@ msgstr "" "詳細は :pep:`657` を参照してください。(Pablo Galindo, Batuhan Taskaya, Ammar " "Askar の貢献による :issue:`43950`)" -#: ../../whatsnew/3.11.rst:171 msgid "" "This feature requires storing column positions in :ref:`codeobjects`, which " "may result in a small increase in interpreter memory usage and disk usage " @@ -268,11 +289,12 @@ msgid "" "no_debug_ranges <-X>` command line option or the :envvar:" "`PYTHONNODEBUGRANGES` environment variable." msgstr "" -"この機能は :ref:`codeobjects` に列の位置を保存する必要があり、その結果コンパ" -"イルされた Pthon ファイルのインタープリタのメモリ使用量とディスク使用量がわず" -"かに増加する可能性があります。余分な情報を保存せず、余分なトレースバック情報" -"を表示しないようにするには :option:`-X no_debug_ranges <-X>` コマンドライン引" -"数または :envvar:`PYTHONNODEBUGRANGES` 環境変数を使用してください。" +"この機能は :ref:`codeobjects` に桁位置を保存するため、インタープリタのメモリ" +"使用量と、コンパイル済み Python ファイルのディスク使用量が少し増える可能性が" +"あります。\n" +"追加情報を保存せず、トレースバックにも表示しないようにするには、コマンドライ" +"ンオプション :option:`-X no_debug_ranges <-X>` または環境変数 :envvar:" +"`PYTHONNODEBUGRANGES` を使ってください。" #: ../../whatsnew/3.11.rst:183 msgid "PEP 654: Exception Groups and ``except*``" @@ -353,15 +375,18 @@ msgstr "" "ホストされている ``PythonCore`` 以外のディストリビューションを起動できるよう" "になります。" -#: ../../whatsnew/3.11.rst:225 msgid "" "When using ``-V:`` selectors, either company or tag can be omitted, but all " "installs will be searched. For example, ``-V:OtherPython/`` will select the " "\"best\" tag registered for ``OtherPython``, while ``-V:3.11`` or ``-" "V:/3.11`` will select the \"best\" distribution with tag ``3.11``." msgstr "" +"``-V:`` 形式で選択する場合、company と tag のどちらかを省略できますが、インス" +"トール済みのすべての Python が検索対象になります。\n" +"例えば ``-V:OtherPython/`` は、``OtherPython`` に登録された「最適な」タグを選" +"び、``-V:3.11`` または ``-V:/3.11`` は、タグ ``3.11`` を持つ「最適な」ディス" +"トリビューションを選びます。" -#: ../../whatsnew/3.11.rst:230 msgid "" "When using the legacy :samp:`-{}`, :samp:`-{}.{}`, :" "samp:`-{}-{}` or :samp:`-{}.{}-{}` " @@ -372,22 +397,30 @@ msgid "" "checking the runtime's tag for a ``-32`` suffix. All releases of Python " "since 3.5 have included this in their 32-bit builds." msgstr "" +"従来の :samp:`-{}`、:samp:`-{}.{}`、:samp:`-{}-" +"{}`、:samp:`-{}.{}-{}` 引数を使う場合は、以前" +"のバージョンの動作が維持され、``PythonCore`` のリリースだけが選ばれます。\n" +"ただし、サポートする 64 ビットプラットフォームが複数あるため、接尾辞 ``-64`` " +"は「32 ビットではない」という意味になりました (必ずしも x86-64 ではありませ" +"ん)。\n" +"32 ビットのランタイムは、タグの接尾辞 ``-32`` で判別されます。\n" +"Python 3.5 以降のすべてのリリースでは、32 ビットビルドにこの接尾辞が含まれて" +"います。" #: ../../whatsnew/3.11.rst:244 msgid "New Features Related to Type Hints" msgstr "型ヒントに関連する新しい機能" -#: ../../whatsnew/3.11.rst:246 msgid "" "This section covers major changes affecting :pep:`484` type hints and the :" "mod:`typing` module." msgstr "" +"この節では、:pep:`484` の型ヒントと :mod:`typing` モジュールに関する主な変更" +"を説明します。" -#: ../../whatsnew/3.11.rst:253 msgid "PEP 646: Variadic generics" -msgstr "" +msgstr "PEP 646: 可変長ジェネリック" -#: ../../whatsnew/3.11.rst:255 msgid "" ":pep:`484` previously introduced :data:`~typing.TypeVar`, enabling creation " "of generics parameterised with a single type. :pep:`646` adds :data:`~typing." @@ -395,8 +428,13 @@ msgid "" "types. In other words, a :data:`~typing.TypeVarTuple` is a *variadic* type " "variable, enabling *variadic* generics." msgstr "" +"従来の :pep:`484` では :data:`~typing.TypeVar` が導入され、単一の型をパラメー" +"ターとするジェネリックを作れるようになりました。\n" +":pep:`646` では :data:`~typing.TypeVarTuple` が追加され、*任意の個数* の型を" +"パラメーターにできます。\n" +"つまり、:data:`~typing.TypeVarTuple` は *可変長* の型変数であり、*可変長* " +"ジェネリックを可能にします。" -#: ../../whatsnew/3.11.rst:262 msgid "" "This enables a wide variety of use cases. In particular, it allows the type " "of array-like structures in numerical computing libraries such as NumPy and " @@ -404,40 +442,53 @@ msgid "" "will now be able to catch shape-related bugs in code that uses these " "libraries." msgstr "" +"これにより、様々な用途に対応できます。\n" +"特に、NumPy や TensorFlow などの数値計算ライブラリの配列に似た構造の型を、配" +"列の *形状* でパラメーター化できます。\n" +"静的型チェッカーが、これらのライブラリを使うコードの形状に関する不具合を検出" +"できるようになります。" #: ../../whatsnew/3.11.rst:268 msgid "See :pep:`646` for more details." msgstr "より詳しくは :pep:`646` を参照してください。" -#: ../../whatsnew/3.11.rst:270 msgid "" "(Contributed by Matthew Rahtz in :issue:`43224`, with contributions by " "Serhiy Storchaka and Jelle Zijlstra. PEP written by Mark Mendoza, Matthew " "Rahtz, Pradeep Kumar Srinivasan, and Vincent Siles.)" msgstr "" +"(Matthew Rahtz による :issue:`43224` での貢献。\n" +"Serhiy Storchaka と Jelle Zijlstra も貢献。\n" +"PEP は Mark Mendoza、Matthew Rahtz、Pradeep Kumar Srinivasan、Vincent Siles " +"が執筆。)" -#: ../../whatsnew/3.11.rst:278 msgid "" "PEP 655: Marking individual ``TypedDict`` items as required or not-required" -msgstr "" +msgstr "PEP 655: ``TypedDict`` の各項目を必須または省略可能と指定" -#: ../../whatsnew/3.11.rst:280 msgid "" ":data:`~typing.Required` and :data:`~typing.NotRequired` provide a " "straightforward way to mark whether individual items in a :class:`~typing." "TypedDict` must be present. Previously, this was only possible using " "inheritance." msgstr "" +":data:`~typing.Required` と :data:`~typing.NotRequired` により、:class:" +"`~typing.TypedDict` の個々の項目が必須かどうかを簡単に指定できるようになりま" +"した。\n" +"以前は、継承を使わないと指定できませんでした。" -#: ../../whatsnew/3.11.rst:285 msgid "" "All fields are still required by default, unless the *total* parameter is " "set to ``False``, in which case all fields are still not-required by " "default. For example, the following specifies a :class:`!TypedDict` with one " "required and one not-required key::" msgstr "" +"デフォルトでは、引き続きすべてのフィールドが必須です。\n" +"ただし、*total* 引数を ``False`` に設定した場合は、引き続きすべてのフィールド" +"がデフォルトで省略可能になります。\n" +"例えば、次のコードは、必須のキーと省略可能なキーを 1 個ずつ持つ :class:`!" +"TypedDict` を指定します。 ::" -#: ../../whatsnew/3.11.rst:291 msgid "" "class Movie(TypedDict):\n" " title: str\n" @@ -447,33 +498,41 @@ msgid "" "m2: Movie = {\"title\": \"Star Wars\"} # OK (year is not required)\n" "m3: Movie = {\"year\": 2022} # ERROR (missing required field title)" msgstr "" +"class Movie(TypedDict):\n" +" title: str\n" +" year: NotRequired[int]\n" +"\n" +"m1: Movie = {\"title\": \"Black Panther\", \"year\": 2018} # OK\n" +"m2: Movie = {\"title\": \"Star Wars\"} # OK (year は省略可能)\n" +"m3: Movie = {\"year\": 2022} # エラー (必須フィールド title がない)" -#: ../../whatsnew/3.11.rst:299 msgid "The following definition is equivalent::" -msgstr "" +msgstr "次の定義も同等です。 ::" -#: ../../whatsnew/3.11.rst:301 msgid "" "class Movie(TypedDict, total=False):\n" " title: Required[str]\n" " year: int" msgstr "" +"class Movie(TypedDict, total=False):\n" +" title: Required[str]\n" +" year: int" #: ../../whatsnew/3.11.rst:305 msgid "See :pep:`655` for more details." msgstr "より詳しくは :pep:`655` を参照してください。" -#: ../../whatsnew/3.11.rst:307 msgid "" "(Contributed by David Foster and Jelle Zijlstra in :issue:`47087`. PEP " "written by David Foster.)" msgstr "" +"(David Foster と Jelle Zijlstra による :issue:`47087` での貢献。\n" +"PEP は David Foster が執筆。)" #: ../../whatsnew/3.11.rst:314 msgid "PEP 673: ``Self`` type" msgstr "PEP 673: ``Self`` 型" -#: ../../whatsnew/3.11.rst:316 msgid "" "The new :data:`~typing.Self` annotation provides a simple and intuitive way " "to annotate methods that return an instance of their class. This behaves the " @@ -481,15 +540,20 @@ msgid "" "484 <484#annotating-instance-and-class-methods>`, but is more concise and " "easier to follow." msgstr "" +"新しいアノテーション :data:`~typing.Self` は、自身のクラスのインスタンスを返" +"すメソッドに、簡潔で直感的に型を注釈する方法です。\n" +":pep:`PEP 484 で規定された <484#annotating-instance-and-class-methods>` :" +"class:`~typing.TypeVar` を使う方法と同じ動作ですが、より簡潔で理解しやすく" +"なっています。" -#: ../../whatsnew/3.11.rst:322 msgid "" "Common use cases include alternative constructors provided as :func:" "`classmethod `\\s, and :meth:`~object.__enter__` methods that " "return ``self``::" msgstr "" +"よくある用途として、:func:`classmethod ` で提供する別のコンスト" +"ラクターや、``self`` を返す :meth:`~object.__enter__` メソッドがあります。 ::" -#: ../../whatsnew/3.11.rst:326 msgid "" "class MyLock:\n" " def __enter__(self) -> Self:\n" @@ -505,28 +569,41 @@ msgid "" "\n" " ..." msgstr "" +"class MyLock:\n" +" def __enter__(self) -> Self:\n" +" self.lock()\n" +" return self\n" +"\n" +" ...\n" +"\n" +"class MyInt:\n" +" @classmethod\n" +" def fromhex(cls, s: str) -> Self:\n" +" return cls(int(s, 16))\n" +"\n" +" ..." -#: ../../whatsnew/3.11.rst:340 msgid "" ":data:`~typing.Self` can also be used to annotate method parameters or " "attributes of the same type as their enclosing class." msgstr "" +":data:`~typing.Self` は、メソッドの引数や属性が、それを含むクラスと同じ型であ" +"ることを注釈するためにも使えます。" #: ../../whatsnew/3.11.rst:343 msgid "See :pep:`673` for more details." msgstr "より詳しくは :pep:`673` を参照してください。" -#: ../../whatsnew/3.11.rst:345 msgid "" "(Contributed by James Hilton-Balfe in :issue:`46534`. PEP written by Pradeep " "Kumar Srinivasan and James Hilton-Balfe.)" msgstr "" +"(James Hilton-Balfe による :issue:`46534` での貢献。\n" +"PEP は Pradeep Kumar Srinivasan と James Hilton-Balfe が執筆。)" -#: ../../whatsnew/3.11.rst:352 msgid "PEP 675: Arbitrary literal string type" -msgstr "" +msgstr "PEP 675: 任意のリテラル文字列の型" -#: ../../whatsnew/3.11.rst:354 msgid "" "The new :data:`~typing.LiteralString` annotation may be used to indicate " "that a function parameter can be of any literal string type. This allows a " @@ -536,10 +613,15 @@ msgid "" "commands, are called only with static arguments, providing protection " "against injection attacks." msgstr "" +"新しいアノテーション :data:`~typing.LiteralString` を使うと、関数の引数が任意" +"のリテラル文字列型でよいことを示せます。\n" +"これにより、任意のリテラル文字列や、ほかのリテラル文字列から作られた文字列を" +"関数が受け取れます。\n" +"型チェッカーは、SQL 文やシェルコマンドを実行する関数など、注意を要する関数が" +"静的な引数だけで呼び出されることを検査し、インジェクション攻撃を防げます。" -#: ../../whatsnew/3.11.rst:362 msgid "For example, a SQL query function could be annotated as follows::" -msgstr "" +msgstr "例えば、SQL クエリを実行する関数には、次のように注釈できます。 ::" #: ../../whatsnew/3.11.rst:364 msgid "" @@ -564,15 +646,15 @@ msgstr "" msgid "See :pep:`675` for more details." msgstr "より詳しくは :pep:`675` を参照してください。" -#: ../../whatsnew/3.11.rst:382 msgid "" "(Contributed by Jelle Zijlstra in :issue:`47088`. PEP written by Pradeep " "Kumar Srinivasan and Graham Bleaney.)" msgstr "" +"(Jelle Zijlstra による :issue:`47088` での貢献。\n" +"PEP は Pradeep Kumar Srinivasan と Graham Bleaney が執筆。)" -#: ../../whatsnew/3.11.rst:389 msgid "PEP 681: Data class transforms" -msgstr "" +msgstr "PEP 681: データクラス変換" #: ../../whatsnew/3.11.rst:391 msgid "" @@ -587,7 +669,6 @@ msgstr "" msgid "For example::" msgstr "例えば::" -#: ../../whatsnew/3.11.rst:399 msgid "" "# The create_model decorator is defined by a library.\n" "@typing.dataclass_transform()\n" @@ -605,20 +686,35 @@ msgid "" "\n" "c = CustomerModel(id=327, name=\"Eric Idle\")" msgstr "" +"# create_model デコレーターはライブラリで定義される。\n" +"@typing.dataclass_transform()\n" +"def create_model(cls: Type[T]) -> Type[T]:\n" +" cls.__init__ = ...\n" +" cls.__eq__ = ...\n" +" cls.__ne__ = ...\n" +" return cls\n" +"\n" +"# create_model デコレーターを使って新しいモデルクラスを作成できる。\n" +"@create_model\n" +"class CustomerModel:\n" +" id: int\n" +" name: str\n" +"\n" +"c = CustomerModel(id=327, name=\"Eric Idle\")" #: ../../whatsnew/3.11.rst:415 msgid "See :pep:`681` for more details." msgstr "より詳しくは :pep:`681` を参照してください。" -#: ../../whatsnew/3.11.rst:417 msgid "" "(Contributed by Jelle Zijlstra in :gh:`91860`. PEP written by Erik De Bonte " "and Eric Traut.)" msgstr "" +"(Jelle Zijlstra による :gh:`91860` での貢献。\n" +"PEP は Erik De Bonte と Eric Traut が執筆。)" -#: ../../whatsnew/3.11.rst:424 msgid "PEP 563 may not be the future" -msgstr "" +msgstr "PEP 563 は将来の標準にならないかもしれない" #: ../../whatsnew/3.11.rst:426 msgid "" @@ -634,21 +730,25 @@ msgstr "" msgid "Other Language Changes" msgstr "その他の言語変更" -#: ../../whatsnew/3.11.rst:439 msgid "" "Starred unpacking expressions can now be used in :keyword:`for` statements. " "(See :issue:`46725` for more details.)" msgstr "" +":keyword:`for` 文で、アスタリスク付きのアンパック式を使えるようになりまし" +"た。\n" +"(詳しくは :issue:`46725` を参照してください。)" -#: ../../whatsnew/3.11.rst:442 msgid "" "Asynchronous :ref:`comprehensions ` are now allowed inside " "comprehensions in :ref:`asynchronous functions `. Outer " "comprehensions implicitly become asynchronous in this case. (Contributed by " "Serhiy Storchaka in :issue:`33346`.)" msgstr "" +":ref:`非同期関数 ` 内の内包表記で、非同期の :ref:`内包表記 " +"` を使えるようになりました。\n" +"この場合、外側の内包表記も暗黙的に非同期になります。\n" +"(Serhiy Storchaka による :issue:`33346` での貢献。)" -#: ../../whatsnew/3.11.rst:447 msgid "" "A :exc:`TypeError` is now raised instead of an :exc:`AttributeError` in :" "keyword:`with` statements and :meth:`contextlib.ExitStack.enter_context` for " @@ -658,8 +758,14 @@ msgid "" "context manager` protocol. (Contributed by Serhiy Storchaka in :issue:" "`12022` and :issue:`44471`.)" msgstr "" +":term:`context manager` プロトコルをサポートしないオブジェクトを :keyword:" +"`with` 文や :meth:`contextlib.ExitStack.enter_context` で使った場合、:exc:" +"`AttributeError` の代わりに :exc:`TypeError` を送出するようになりました。\n" +":term:`asynchronous context manager` プロトコルをサポートしないオブジェクト" +"を :keyword:`async with` 文や :meth:`contextlib.AsyncExitStack." +"enter_async_context` で使った場合も同様です。\n" +"(Serhiy Storchaka による :issue:`12022` and :issue:`44471` での貢献。)" -#: ../../whatsnew/3.11.rst:455 msgid "" "Added :meth:`object.__getstate__`, which provides the default implementation " "of the :meth:`!__getstate__` method. :mod:`copy`\\ing and :mod:`pickle`\\ing " @@ -672,6 +778,19 @@ msgid "" "See the later comments on :gh:`70766` for discussions of what workarounds " "such code may need. (Contributed by Serhiy Storchaka in :issue:`26579`.)" msgstr "" +":meth:`!__getstate__` メソッドのデフォルト実装を提供する :meth:`object." +"__getstate__` が追加されました。\n" +"組み込み型 :class:`bytearray`、:class:`set`、:class:`frozenset`、:class:" +"`collections.OrderedDict`、:class:`collections.deque`、:class:`weakref." +"WeakSet`、:class:`datetime.tzinfo` のサブクラスのインスタンスを :mod:`copy` " +"や :mod:`pickle` で処理すると、:term:`スロット <__slots__>` として実装された" +"インスタンス属性もコピーや pickle 化の対象になりました。\n" +"この変更には、意図しない副作用があります。\n" +":meth:`object.__getstate__` が存在しないことを前提とする少数の既存の Python " +"プロジェクトで、問題を引き起こします。\n" +"そのようなコードで必要になる回避策については、:gh:`70766` の後半のコメントを" +"参照してください。\n" +"(Serhiy Storchaka による :issue:`26579` での貢献。)" #: ../../whatsnew/3.11.rst:470 msgid "" @@ -685,14 +804,16 @@ msgid "" "`57684`.)" msgstr "" -#: ../../whatsnew/3.11.rst:481 msgid "" "A ``\"z\"`` option was added to the :ref:`formatspec` that coerces negative " "to positive zero after rounding to the format precision. See :pep:`682` for " "more details. (Contributed by John Belmonte in :gh:`90153`.)" msgstr "" +":ref:`formatspec` に ``\"z\"`` オプションが追加されました。\n" +"指定した精度に丸めた後、負のゼロを正のゼロに変換します。\n" +"詳しくは :pep:`682` を参照してください。\n" +"(John Belmonte による :gh:`90153` での貢献。)" -#: ../../whatsnew/3.11.rst:486 msgid "" "Bytes are no longer accepted on :data:`sys.path`. Support broke sometime " "between Python 3.2 and 3.6, with no one noticing until after Python 3.10.0 " @@ -701,20 +822,29 @@ msgid "" "there is a mixture of :class:`str` and :class:`bytes` keys. (Contributed by " "Thomas Grainger in :gh:`91181`.)" msgstr "" +":data:`sys.path` に bytes を指定することはサポートされなくなりました。\n" +"この機能は Python 3.2 から 3.6 の間に動かなくなっていましたが、Python 3.10.0 " +"のリリース後まで誰も気付きませんでした。\n" +"また、:class:`str` と :class:`bytes` のキーが混在する場合の :option:`-b` と :" +"data:`sys.path_importer_cache` の相互作用に問題があるため、サポートを復活させ" +"ることも困難です。\n" +"(Thomas Grainger による :gh:`91181` での貢献。)" #: ../../whatsnew/3.11.rst:497 msgid "Other CPython Implementation Changes" msgstr "その他の CPython の実装の変更" -#: ../../whatsnew/3.11.rst:499 msgid "" "The special methods :meth:`~object.__complex__` for :class:`complex` and :" "meth:`~object.__bytes__` for :class:`bytes` are implemented to support the :" "class:`typing.SupportsComplex` and :class:`typing.SupportsBytes` protocols. " "(Contributed by Mark Dickinson and Donghee Na in :issue:`24234`.)" msgstr "" +":class:`typing.SupportsComplex` と :class:`typing.SupportsBytes` プロトコルに" +"対応するため、:class:`complex` に特殊メソッド :meth:`~object.__complex__`、:" +"class:`bytes` に :meth:`~object.__bytes__` が実装されました。\n" +"(Mark Dickinson and Donghee Na による :issue:`24234` での貢献。)" -#: ../../whatsnew/3.11.rst:504 msgid "" "``siphash13`` is added as a new internal hashing algorithm. It has similar " "security properties as ``siphash24``, but it is slightly faster for long " @@ -723,8 +853,14 @@ msgid "" "` now use ``siphash13`` too. (Contributed by Inada Naoki " "in :issue:`29410`.)" msgstr "" +"内部のハッシュアルゴリズムに ``siphash13`` が追加されました。\n" +"``siphash24`` と似た安全性を持ち、長い入力では少し高速です。\n" +":class:`str`、:class:`bytes` などの型は、:func:`hash` のデフォルトのアルゴリ" +"ズムとしてこれを使うようになりました。\n" +":pep:`552` の :ref:`ハッシュベースの .pyc ファイル ` も " +"``siphash13`` を使うようになりました。\n" +"(Inada Naoki による :issue:`29410` での貢献。)" -#: ../../whatsnew/3.11.rst:513 msgid "" "When an active exception is re-raised by a :keyword:`raise` statement with " "no parameters, the traceback attached to this exception is now always ``sys." @@ -732,32 +868,49 @@ msgid "" "in the current :keyword:`except` clause are reflected in the re-raised " "exception. (Contributed by Irit Katriel in :issue:`45711`.)" msgstr "" +"引数のない :keyword:`raise` 文で処理中の例外を再送出すると、その例外に付随す" +"るトレースバックは常に ``sys.exc_info()[1].__traceback__`` になりました。\n" +"つまり、現在の :keyword:`except` 節でトレースバックを変更すると、再送出された" +"例外にその変更が反映されます。\n" +"(Irit Katriel による :issue:`45711` での貢献。)" -#: ../../whatsnew/3.11.rst:519 msgid "" "The interpreter state's representation of handled exceptions (aka " "``exc_info`` or ``_PyErr_StackItem``) now only has the ``exc_value`` field; " "``exc_type`` and ``exc_traceback`` have been removed, as they can be derived " "from ``exc_value``. (Contributed by Irit Katriel in :issue:`45711`.)" msgstr "" +"インタープリタ状態内で、処理中の例外を表す構造 (``exc_info`` または " +"``_PyErr_StackItem``) は、``exc_value`` フィールドだけを持つようになりまし" +"た。\n" +"``exc_type`` と ``exc_traceback`` は ``exc_value`` から求められるため、削除さ" +"れました。\n" +"(Irit Katriel による :issue:`45711` での貢献。)" -#: ../../whatsnew/3.11.rst:525 msgid "" "A new :ref:`command line option `, ``AppendPath``, has " "been added for the Windows installer. It behaves similarly to " "``PrependPath``, but appends the install and scripts directories instead of " "prepending them. (Contributed by Bastian Neuburger in :issue:`44934`.)" msgstr "" +"Windows インストーラーに、新しい :ref:`コマンドラインオプション ` ``AppendPath`` が追加されました。\n" +"``PrependPath`` と似ていますが、インストールディレクトリとスクリプトディレク" +"トリを先頭ではなく末尾に追加します。\n" +"(Bastian Neuburger による :issue:`44934` での貢献。)" -#: ../../whatsnew/3.11.rst:531 msgid "" "The :c:member:`PyConfig.module_search_paths_set` field must now be set to " "``1`` for initialization to use :c:member:`PyConfig.module_search_paths` to " "initialize :data:`sys.path`. Otherwise, initialization will recalculate the " "path and replace any values added to ``module_search_paths``." msgstr "" +"初期化時に :c:member:`PyConfig.module_search_paths` を使って :data:`sys." +"path` を初期化するには、:c:member:`PyConfig.module_search_paths_set` フィール" +"ドを ``1`` に設定する必要があります。\n" +"そうしないと、初期化処理はパスを再計算し、``module_search_paths`` に追加した" +"値を置き換えます。" -#: ../../whatsnew/3.11.rst:536 msgid "" "The output of the :option:`--help` option now fits in 50 lines/80 columns. " "Information about :ref:`Python environment variables ` " @@ -765,8 +918,12 @@ msgid "" "help-env` and :option:`--help-xoptions` flags, and with the new :option:`--" "help-all`. (Contributed by Éric Araujo in :issue:`46142`.)" msgstr "" +":option:`--help` オプションの出力が、50 行、80 桁に収まるようになりました。\n" +":ref:`Python の環境変数 ` と :option:`-X` オプションの情報" +"は、それぞれ :option:`--help-env` と :option:`--help-xoptions`、および新し" +"い :option:`--help-all` フラグで取得できます。\n" +"(Éric Araujo による :issue:`46142` での貢献。)" -#: ../../whatsnew/3.11.rst:543 msgid "" "Converting between :class:`int` and :class:`str` in bases other than 2 " "(binary), 4, 8 (octal), 16 (hexadecimal), or 32 such as base 10 (decimal) " @@ -778,22 +935,35 @@ msgid "" "limitation ` documentation. The default limit is 4300 " "digits in string form." msgstr "" +"2 (2 進数)、4、8 (8 進数)、16 (16 進数)、32 以外の基数、例えば 10 (10 進数) " +"で :class:`int` と :class:`str` を相互変換する際、文字列表記の桁数が上限を超" +"えると :exc:`ValueError` を送出するようになりました。\n" +"アルゴリズムの計算量を悪用したサービス拒否攻撃を防ぐためで、:cve:" +"`2020-10735` の緩和策です。\n" +"この上限は、環境変数、コマンドラインフラグ、:mod:`sys` の API で設定または無" +"効化できます。\n" +":ref:`整数の文字列変換の長さ制限 ` のドキュメントを参照し" +"てください。\n" +"デフォルトの上限は文字列表記で 4300 桁です。" #: ../../whatsnew/3.11.rst:557 msgid "New Modules" msgstr "新たなモジュール" -#: ../../whatsnew/3.11.rst:559 msgid "" ":mod:`tomllib`: For parsing `TOML `_. See :pep:`680` for " "more details. (Contributed by Taneli Hukkinen in :issue:`40059`.)" msgstr "" +":mod:`tomllib`: `TOML `_ を解析するためのモジュールです。\n" +"詳しくは :pep:`680` を参照してください。\n" +"(Taneli Hukkinen による :issue:`40059` での貢献。)" -#: ../../whatsnew/3.11.rst:563 msgid "" ":mod:`wsgiref.types`: :pep:`WSGI <3333>`-specific types for static type " "checking. (Contributed by Sebastian Rittau in :issue:`42012`.)" msgstr "" +":mod:`wsgiref.types`: 静的型チェック用の :pep:`WSGI <3333>` 固有の型です。\n" +"(Sebastian Rittau による :issue:`42012` での貢献。)" #: ../../whatsnew/3.11.rst:571 msgid "Improved Modules" @@ -803,7 +973,6 @@ msgstr "改良されたモジュール" msgid "asyncio" msgstr "asyncio" -#: ../../whatsnew/3.11.rst:578 msgid "" "Added the :class:`~asyncio.TaskGroup` class, an :ref:`asynchronous context " "manager ` holding a group of tasks that will wait " @@ -811,43 +980,60 @@ msgid "" "`~asyncio.create_task` and :func:`~asyncio.gather` directly. (Contributed by " "Yury Selivanov and others in :gh:`90908`.)" msgstr "" +":class:`~asyncio.TaskGroup` クラスが追加されました。\n" +"タスクのグループを保持し、終了時にすべてのタスクを待つ :ref:`非同期コンテキス" +"トマネージャー ` です。\n" +"新しいコードでは、:func:`~asyncio.create_task` や :func:`~asyncio.gather` を" +"直接使うよりも、こちらを推奨します。\n" +"(Yury Selivanov and others による :gh:`90908` での貢献。)" -#: ../../whatsnew/3.11.rst:585 msgid "" "Added :func:`~asyncio.timeout`, an asynchronous context manager for setting " "a timeout on asynchronous operations. For new code this is recommended over " "using :func:`~asyncio.wait_for` directly. (Contributed by Andrew Svetlov in :" "gh:`90927`.)" msgstr "" +"非同期処理にタイムアウトを設定する非同期コンテキストマネージャー :func:" +"`~asyncio.timeout` が追加されました。\n" +"新しいコードでは、:func:`~asyncio.wait_for` を直接使うよりも、こちらを推奨し" +"ます。\n" +"(Andrew Svetlov による :gh:`90927` での貢献。)" -#: ../../whatsnew/3.11.rst:590 msgid "" "Added the :class:`~asyncio.Runner` class, which exposes the machinery used " "by :func:`~asyncio.run`. (Contributed by Andrew Svetlov in :gh:`91218`.)" msgstr "" +":func:`~asyncio.run` で使う仕組みを公開する :class:`~asyncio.Runner` クラスが" +"追加されました。\n" +"(Andrew Svetlov による :gh:`91218` での貢献。)" -#: ../../whatsnew/3.11.rst:594 msgid "" "Added the :class:`~asyncio.Barrier` class to the synchronization primitives " "in the asyncio library, and the related :exc:`~asyncio.BrokenBarrierError` " "exception. (Contributed by Yves Duprat and Andrew Svetlov in :gh:`87518`.)" msgstr "" +"asyncio ライブラリの同期プリミティブに :class:`~asyncio.Barrier` クラスと、関" +"連する例外 :exc:`~asyncio.BrokenBarrierError` が追加されました。\n" +"(Yves Duprat and Andrew Svetlov による :gh:`87518` での貢献。)" -#: ../../whatsnew/3.11.rst:599 msgid "" "Added keyword argument *all_errors* to :meth:`asyncio.loop." "create_connection` so that multiple connection errors can be raised as an :" "exc:`ExceptionGroup`." msgstr "" +":meth:`asyncio.loop.create_connection` にキーワード引数 *all_errors* が追加さ" +"れ、複数の接続エラーを :exc:`ExceptionGroup` として送出できるようになりまし" +"た。" -#: ../../whatsnew/3.11.rst:602 msgid "" "Added the :meth:`asyncio.StreamWriter.start_tls` method for upgrading " "existing stream-based connections to TLS. (Contributed by Ian Good in :issue:" "`34975`.)" msgstr "" +"既存のストリームベースの接続を TLS にアップグレードする :meth:`asyncio." +"StreamWriter.start_tls` メソッドが追加されました。\n" +"(Ian Good による :issue:`34975` での貢献。)" -#: ../../whatsnew/3.11.rst:606 msgid "" "Added raw datagram socket functions to the event loop: :meth:`~asyncio.loop." "sock_sendto`, :meth:`~asyncio.loop.sock_recvfrom` and :meth:`~asyncio.loop." @@ -855,46 +1041,64 @@ msgid "" "SelectorEventLoop` and :class:`~asyncio.ProactorEventLoop`. (Contributed by " "Alex Grönholm in :issue:`46805`.)" msgstr "" +"生のデータグラムソケットを扱う関数 :meth:`~asyncio.loop.sock_sendto`、:meth:" +"`~asyncio.loop.sock_recvfrom`、:meth:`~asyncio.loop.sock_recvfrom_into` がイ" +"ベントループに追加されました。\n" +":class:`~asyncio.SelectorEventLoop` と :class:`~asyncio.ProactorEventLoop` に" +"実装されています。\n" +"(Alex Grönholm による :issue:`46805` での貢献。)" -#: ../../whatsnew/3.11.rst:614 msgid "" "Added :meth:`~asyncio.Task.cancelling` and :meth:`~asyncio.Task.uncancel` " "methods to :class:`~asyncio.Task`. These are primarily intended for internal " "use, notably by :class:`~asyncio.TaskGroup`." msgstr "" +":class:`~asyncio.Task` に :meth:`~asyncio.Task.cancelling` メソッドと :meth:" +"`~asyncio.Task.uncancel` メソッドが追加されました。\n" +"主に内部での使用、特に :class:`~asyncio.TaskGroup` での使用を意図しています。" #: ../../whatsnew/3.11.rst:623 msgid "contextlib" msgstr "contextlib" -#: ../../whatsnew/3.11.rst:625 msgid "" "Added non parallel-safe :func:`~contextlib.chdir` context manager to change " "the current working directory and then restore it on exit. Simple wrapper " "around :func:`~os.chdir`. (Contributed by Filipe Laíns in :issue:`25625`)" msgstr "" +"カレントワーキングディレクトリを変更し、終了時に元に戻すコンテキストマネー" +"ジャー :func:`~contextlib.chdir` が追加されました。\n" +"並列実行時に安全に使えるものではありません。\n" +":func:`~os.chdir` の単純なラッパーです。\n" +"(Filipe Laíns による :issue:`25625` での貢献。)" #: ../../whatsnew/3.11.rst:633 msgid "dataclasses" msgstr "データクラス" -#: ../../whatsnew/3.11.rst:635 msgid "" "Change field default mutability check, allowing only defaults which are :" "term:`hashable` instead of any object which is not an instance of :class:" "`dict`, :class:`list` or :class:`set`. (Contributed by Eric V. Smith in :" "issue:`44674`.)" msgstr "" +"フィールドのデフォルト値のミュータビリティーの検査が変更されました。\n" +"従来は :class:`dict`、:class:`list`、:class:`set` のインスタンスでなければ許" +"されていましたが、:term:`hashable` なデフォルト値だけを許すようになりまし" +"た。\n" +"(Eric V. Smith による :issue:`44674` での貢献。)" #: ../../whatsnew/3.11.rst:644 msgid "datetime" msgstr "datetime" -#: ../../whatsnew/3.11.rst:646 msgid "" "Add :const:`datetime.UTC`, a convenience alias for :attr:`datetime.timezone." "utc`. (Contributed by Kabir Kwatra in :gh:`91973`.)" msgstr "" +":attr:`datetime.timezone.utc` の便利な別名として :const:`datetime.UTC` が追加" +"されました。\n" +"(Kabir Kwatra による :gh:`91973` での貢献。)" #: ../../whatsnew/3.11.rst:649 msgid "" @@ -908,27 +1112,31 @@ msgstr "" msgid "enum" msgstr "enum" -#: ../../whatsnew/3.11.rst:660 msgid "" "Renamed :class:`!EnumMeta` to :class:`~enum.EnumType` (:class:`!EnumMeta` " "kept as an alias)." msgstr "" +":class:`!EnumMeta` の名前が :class:`~enum.EnumType` に変わりました (:class:`!" +"EnumMeta` は別名として残されています)。" -#: ../../whatsnew/3.11.rst:663 msgid "" "Added :class:`~enum.StrEnum`, with members that can be used as (and must be) " "strings." msgstr "" +"メンバーを文字列として使える (かつ文字列でなければならない) :class:`~enum." +"StrEnum` が追加されました。" -#: ../../whatsnew/3.11.rst:666 msgid "" "Added :class:`~enum.ReprEnum`, which only modifies the :meth:`~object." "__repr__` of members while returning their literal values (rather than " "names) for :meth:`~object.__str__` and :meth:`~object.__format__` (used by :" "func:`str`, :func:`format` and :term:`f-string`\\s)." msgstr "" +":class:`~enum.ReprEnum` が追加されました。\n" +"メンバーの :meth:`~object.__repr__` だけを変更し、:meth:`~object.__str__` " +"と :meth:`~object.__format__` (:func:`str`、:func:`format`、:term:`f-string` " +"で使用) には、名前ではなく元の値の表現を返します。" -#: ../../whatsnew/3.11.rst:672 msgid "" "Changed :meth:`Enum.__format__() ` (the default for :" "func:`format`, :meth:`str.format` and :term:`f-string`\\s) to always produce " @@ -936,26 +1144,37 @@ msgid "" "inheriting from :class:`~enum.ReprEnum` it will be the member's value; for " "all other enums it will be the enum and member name (e.g. ``Color.RED``)." msgstr "" +":meth:`Enum.__format__() ` (:func:`format`、:meth:`str." +"format`、:term:`f-string` のデフォルト) は、常に :meth:`Enum.__str__() ` と同じ結果を返すようになりました。\n" +":class:`~enum.ReprEnum` を継承する列挙型ではメンバーの値、それ以外では列挙型" +"とメンバーの名前 (例えば ``Color.RED``) になります。" -#: ../../whatsnew/3.11.rst:678 msgid "" "Added a new *boundary* class parameter to :class:`~enum.Flag` enums and the :" "class:`~enum.FlagBoundary` enum with its options, to control how to handle " "out-of-range flag values." msgstr "" +"範囲外のフラグ値の扱いを制御するため、:class:`~enum.Flag` 列挙型にクラス引数 " +"*boundary* が追加され、その選択肢を持つ :class:`~enum.FlagBoundary` 列挙型も" +"追加されました。" -#: ../../whatsnew/3.11.rst:682 msgid "" "Added the :func:`~enum.verify` enum decorator and the :class:`~enum." "EnumCheck` enum with its options, to check enum classes against several " "specific constraints." msgstr "" +"列挙型クラスが特定の制約を満たすか検査するため、:func:`~enum.verify` 列挙型デ" +"コレーターと、その選択肢を持つ :class:`~enum.EnumCheck` 列挙型が追加されまし" +"た。" -#: ../../whatsnew/3.11.rst:686 msgid "" "Added the :func:`~enum.member` and :func:`~enum.nonmember` decorators, to " "ensure the decorated object is/is not converted to an enum member." msgstr "" +"デコレートしたオブジェクトを列挙型のメンバーにするかどうかを明示する :func:" +"`~enum.member` デコレーターと :func:`~enum.nonmember` デコレーターが追加され" +"ました。" #: ../../whatsnew/3.11.rst:689 msgid "" @@ -964,7 +1183,6 @@ msgid "" "DynamicClassAttribute`." msgstr "" -#: ../../whatsnew/3.11.rst:693 msgid "" "Added the :func:`~enum.global_enum` enum decorator, which adjusts :meth:" "`~object.__repr__` and :meth:`~object.__str__` to show values as members of " @@ -972,6 +1190,11 @@ msgid "" "the :const:`~re.ASCII` member of :class:`re.RegexFlag` rather than " "``'RegexFlag.ASCII'``." msgstr "" +":func:`~enum.global_enum` 列挙型デコレーターが追加されました。\n" +":meth:`~object.__repr__` と :meth:`~object.__str__` を調整し、値を列挙型クラ" +"スではなくモジュールのメンバーとして表示します。\n" +"例えば、:class:`re.RegexFlag` の :const:`~re.ASCII` メンバーは ``'RegexFlag." +"ASCII'`` ではなく ``'re.ASCII'`` になります。" #: ../../whatsnew/3.11.rst:699 msgid "" @@ -980,47 +1203,59 @@ msgid "" "``len(AFlag(3)) == 2 and list(AFlag(3)) == (AFlag.ONE, AFlag.TWO)``" msgstr "" -#: ../../whatsnew/3.11.rst:704 msgid "" "Changed :class:`~enum.Enum` and :class:`~enum.Flag` so that members are now " "defined before :meth:`~object.__init_subclass__` is called; :func:`dir` now " "includes methods, etc., from mixed-in data types." msgstr "" +":class:`~enum.Enum` と :class:`~enum.Flag` で、:meth:`~object." +"__init_subclass__` の呼び出し前にメンバーが定義されるようになりました。\n" +":func:`dir` の結果には、ミックスインしたデータ型のメソッドなども含まれるよう" +"になりました。" -#: ../../whatsnew/3.11.rst:709 msgid "" "Changed :class:`~enum.Flag` to only consider primary values (power of two) " "canonical while composite values (``3``, ``6``, ``10``, etc.) are considered " "aliases; inverted flags are coerced to their positive equivalent." msgstr "" +":class:`~enum.Flag` は、基本の値 (2 の累乗) だけを正規のメンバーとし、合成さ" +"れた値 (``3``、``6``、``10`` など) は別名として扱うようになりました。\n" +"反転したフラグは、同等の正の値に変換されます。" #: ../../whatsnew/3.11.rst:718 msgid "fcntl" msgstr "fcntl" -#: ../../whatsnew/3.11.rst:720 msgid "" "On FreeBSD, the :data:`!F_DUP2FD` and :data:`!F_DUP2FD_CLOEXEC` flags " "respectively are supported, the former equals to ``dup2`` usage while the " "latter set the ``FD_CLOEXEC`` flag in addition." msgstr "" +"FreeBSD で :data:`!F_DUP2FD` と :data:`!F_DUP2FD_CLOEXEC` フラグがサポートさ" +"れました。\n" +"前者は ``dup2`` と同等で、後者はさらに ``FD_CLOEXEC`` フラグを設定します。" #: ../../whatsnew/3.11.rst:728 msgid "fractions" msgstr "fractions" -#: ../../whatsnew/3.11.rst:730 msgid "" "Support :PEP:`515`-style initialization of :class:`~fractions.Fraction` from " "string. (Contributed by Sergey B Kirpichev in :issue:`44258`.)" msgstr "" +"文字列からの :class:`~fractions.Fraction` の初期化で、:PEP:`515` の形式がサ" +"ポートされました。\n" +"(Sergey B Kirpichev による :issue:`44258` での貢献。)" -#: ../../whatsnew/3.11.rst:733 msgid "" ":class:`~fractions.Fraction` now implements an ``__int__`` method, so that " "an ``isinstance(some_fraction, typing.SupportsInt)`` check passes. " "(Contributed by Mark Dickinson in :issue:`44547`.)" msgstr "" +":class:`~fractions.Fraction` に ``__int__`` メソッドが実装され、" +"``isinstance(some_fraction, typing.SupportsInt)`` による検査が真になるように" +"なりました。\n" +"(Mark Dickinson による :issue:`44547` での貢献。)" #: ../../whatsnew/3.11.rst:741 msgid "functools" @@ -1032,7 +1267,6 @@ msgid "" "class:`typing.Union` as annotations to the dispatch argument.::" msgstr "" -#: ../../whatsnew/3.11.rst:746 msgid "" ">>> from functools import singledispatch\n" ">>> @singledispatch\n" @@ -1056,16 +1290,35 @@ msgid "" "... print(i, elem)\n" "..." msgstr "" +">>> from functools import singledispatch\n" +">>> @singledispatch\n" +"... def fun(arg, verbose=False):\n" +"... if verbose:\n" +"... print(\"Let me just say,\", end=\" \")\n" +"... print(arg)\n" +"...\n" +">>> @fun.register\n" +"... def _(arg: int | float, verbose=False):\n" +"... if verbose:\n" +"... print(\"Strength in numbers, eh?\", end=\" \")\n" +"... print(arg)\n" +"...\n" +">>> from typing import Union\n" +">>> @fun.register\n" +"... def _(arg: Union[list, set], verbose=False):\n" +"... if verbose:\n" +"... print(\"Enumerate this:\")\n" +"... for i, elem in enumerate(arg):\n" +"... print(i, elem)\n" +"..." -#: ../../whatsnew/3.11.rst:768 msgid "(Contributed by Yurii Karabas in :issue:`46014`.)" -msgstr "" +msgstr "(Yurii Karabas による :issue:`46014` での貢献。)" #: ../../whatsnew/3.11.rst:774 msgid "gzip" msgstr "gzip" -#: ../../whatsnew/3.11.rst:776 msgid "" "The :func:`gzip.compress` function is now faster when used with the " "**mtime=0** argument as it delegates the compression entirely to a single :" @@ -1076,18 +1329,28 @@ msgid "" "it may be set to a different value by the underlying zlib C library Python " "was linked against. (See :gh:`112346` for details on the side effect.)" msgstr "" +":func:`gzip.compress` は **mtime=0** を指定した場合、圧縮全体を :func:`zlib." +"compress` の 1 回の処理に委ねることで高速になりました。\n" +"この変更には副作用が 1 つあります。\n" +"gzip ファイルのヘッダーには \"OS\" バイトがあり、従来 :mod:`gzip` は常に「不" +"明」を表す 255 を設定していました。\n" +"今後は **mtime=0** を指定して :func:`~gzip.compress` を使うと、Python がリン" +"クされた基盤の zlib C ライブラリによって、別の値が設定されることがありま" +"す。\n" +"(この副作用の詳細は :gh:`112346` を参照してください。)" #: ../../whatsnew/3.11.rst:789 msgid "hashlib" msgstr "hashlib" -#: ../../whatsnew/3.11.rst:791 msgid "" ":func:`hashlib.blake2b` and :func:`hashlib.blake2s` now prefer `libb2`_ over " "Python's vendored copy. (Contributed by Christian Heimes in :issue:`47095`.)" msgstr "" +":func:`hashlib.blake2b` と :func:`hashlib.blake2s` は、Python に同梱された実" +"装よりも `libb2`_ を優先するようになりました。\n" +"(Christian Heimes による :issue:`47095` での貢献。)" -#: ../../whatsnew/3.11.rst:795 msgid "" "The internal ``_sha3`` module with SHA3 and SHAKE algorithms now uses " "*tiny_sha3* instead of the *Keccak Code Package* to reduce code and binary " @@ -1095,48 +1358,63 @@ msgid "" "implementations from OpenSSL. The change affects only installations without " "OpenSSL support. (Contributed by Christian Heimes in :issue:`47098`.)" msgstr "" +"SHA3 と SHAKE のアルゴリズムを実装する内部モジュール ``_sha3`` は、コードとバ" +"イナリのサイズを削減するため、*Keccak Code Package* の代わりに *tiny_sha3* を" +"使うようになりました。\n" +":mod:`hashlib` モジュールは、OpenSSL の最適化された SHA3 と SHAKE の実装を優" +"先します。\n" +"この変更の影響を受けるのは、OpenSSL をサポートしないインストールだけです。\n" +"(Christian Heimes による :issue:`47098` での貢献。)" -#: ../../whatsnew/3.11.rst:802 msgid "" "Add :func:`hashlib.file_digest`, a helper function for efficient hashing of " "files or file-like objects. (Contributed by Christian Heimes in :gh:`89313`.)" msgstr "" +"ファイルやファイルライクオブジェクトのハッシュを効率よく計算する補助関数 :" +"func:`hashlib.file_digest` が追加されました。\n" +"(Christian Heimes による :gh:`89313` での貢献。)" #: ../../whatsnew/3.11.rst:810 msgid "IDLE and idlelib" msgstr "IDLE と idelelib" -#: ../../whatsnew/3.11.rst:812 msgid "" "Apply syntax highlighting to ``.pyi`` files. (Contributed by Alex Waygood " "and Terry Jan Reedy in :issue:`45447`.)" msgstr "" +"``.pyi`` ファイルに構文強調表示を適用するようになりました。\n" +"(Alex Waygood and Terry Jan Reedy による :issue:`45447` での貢献。)" -#: ../../whatsnew/3.11.rst:815 msgid "" "Include prompts when saving Shell with inputs and outputs. (Contributed by " "Terry Jan Reedy in :gh:`95191`.)" msgstr "" +"入力と出力を含む Shell の内容を保存する際、プロンプトも含めるようになりまし" +"た。\n" +"(Terry Jan Reedy による :gh:`95191` での貢献。)" #: ../../whatsnew/3.11.rst:822 msgid "inspect" msgstr "inspect" -#: ../../whatsnew/3.11.rst:824 msgid "" "Add :func:`~inspect.getmembers_static` to return all members without " "triggering dynamic lookup via the descriptor protocol. (Contributed by " "Weipeng Hong in :issue:`30533`.)" msgstr "" +"デスクリプタープロトコルによる動的な属性検索を発生させずに、すべてのメンバー" +"を返す :func:`~inspect.getmembers_static` が追加されました。\n" +"(Weipeng Hong による :issue:`30533` での貢献。)" -#: ../../whatsnew/3.11.rst:828 msgid "" "Add :func:`~inspect.ismethodwrapper` for checking if the type of an object " "is a :class:`~types.MethodWrapperType`. (Contributed by Hakan Çelik in :" "issue:`29418`.)" msgstr "" +"オブジェクトの型が :class:`~types.MethodWrapperType` かどうかを調べる :func:" +"`~inspect.ismethodwrapper` が追加されました。\n" +"(Hakan Çelik による :issue:`29418` での貢献。)" -#: ../../whatsnew/3.11.rst:832 msgid "" "Change the frame-related functions in the :mod:`inspect` module to return " "new :class:`~inspect.FrameInfo` and :class:`~inspect.Traceback` class " @@ -1144,55 +1422,61 @@ msgid "" "interfaces) that includes the extended :pep:`657` position information (end " "line number, column and end column). The affected functions are:" msgstr "" +":mod:`inspect` モジュールのフレーム関連の関数は、新しい :class:`~inspect." +"FrameInfo` と :class:`~inspect.Traceback` のインスタンスを返すようになりまし" +"た。\n" +"これらは従来の :term:`named tuple` のようなインターフェースと後方互換性があ" +"り、:pep:`657` で拡張された位置情報 (終了行番号、開始桁、終了桁) を含みま" +"す。\n" +"対象の関数は次のとおりです。" -#: ../../whatsnew/3.11.rst:838 msgid ":func:`inspect.getframeinfo`" -msgstr "" +msgstr ":func:`inspect.getframeinfo`" -#: ../../whatsnew/3.11.rst:839 msgid ":func:`inspect.getouterframes`" -msgstr "" +msgstr ":func:`inspect.getouterframes`" -#: ../../whatsnew/3.11.rst:840 msgid ":func:`inspect.getinnerframes`," -msgstr "" +msgstr ":func:`inspect.getinnerframes`," -#: ../../whatsnew/3.11.rst:841 msgid ":func:`inspect.stack`" -msgstr "" +msgstr ":func:`inspect.stack`" -#: ../../whatsnew/3.11.rst:842 msgid ":func:`inspect.trace`" -msgstr "" +msgstr ":func:`inspect.trace`" -#: ../../whatsnew/3.11.rst:844 msgid "(Contributed by Pablo Galindo in :gh:`88116`.)" -msgstr "" +msgstr "(Pablo Galindo による :gh:`88116` での貢献。)" #: ../../whatsnew/3.11.rst:850 msgid "locale" msgstr "locale" -#: ../../whatsnew/3.11.rst:852 msgid "" "Add :func:`locale.getencoding` to get the current locale encoding. It is " "similar to ``locale.getpreferredencoding(False)`` but ignores the :ref:" "`Python UTF-8 Mode `." msgstr "" +"現在のロケールのエンコーディングを取得する :func:`locale.getencoding` が追加" +"されました。\n" +"``locale.getpreferredencoding(False)`` と似ていますが、:ref:`Python UTF-8 " +"モード ` を無視します。" #: ../../whatsnew/3.11.rst:860 msgid "logging" msgstr "logging" -#: ../../whatsnew/3.11.rst:862 msgid "" "Added :func:`~logging.getLevelNamesMapping` to return a mapping from logging " "level names (e.g. ``'CRITICAL'``) to the values of their corresponding :ref:" "`levels` (e.g. ``50``, by default). (Contributed by Andrei Kulakovin in :gh:" "`88024`.)" msgstr "" +"ログレベル名 (例えば ``'CRITICAL'``) から、対応する :ref:`レベル ` の" +"値 (デフォルトでは例えば ``50``) へのマッピングを返す :func:`~logging." +"getLevelNamesMapping` が追加されました。\n" +"(Andrei Kulakovin による :gh:`88024` での貢献。)" -#: ../../whatsnew/3.11.rst:867 msgid "" "Added a :meth:`~logging.handlers.SysLogHandler.createSocket` method to :" "class:`~logging.handlers.SysLogHandler`, to match :meth:`SocketHandler." @@ -1200,24 +1484,31 @@ msgid "" "automatically during handler initialization and when emitting an event, if " "there is no active socket. (Contributed by Kirill Pinchuk in :gh:`88457`.)" msgstr "" +":meth:`SocketHandler.createSocket() ` に合わせて、:class:`~logging.handlers.SysLogHandler` に :meth:" +"`~logging.handlers.SysLogHandler.createSocket` メソッドが追加されました。\n" +"ハンドラーの初期化時と、イベントを送出する際に有効なソケットがない場合に、自" +"動的に呼び出されます。\n" +"(Kirill Pinchuk による :gh:`88457` での貢献。)" #: ../../whatsnew/3.11.rst:879 msgid "math" msgstr "math" -#: ../../whatsnew/3.11.rst:881 msgid "" "Add :func:`math.exp2`: return 2 raised to the power of x. (Contributed by " "Gideon Mitchell in :issue:`45917`.)" msgstr "" +"2 の ``x`` 乗を返す :func:`math.exp2` が追加されました。\n" +"(Gideon Mitchell による :issue:`45917` での貢献。)" -#: ../../whatsnew/3.11.rst:884 msgid "" "Add :func:`math.cbrt`: return the cube root of x. (Contributed by Ajith " "Ramachandran in :issue:`44357`.)" msgstr "" +"``x`` の立方根を返す :func:`math.cbrt` が追加されました。\n" +"(Ajith Ramachandran による :issue:`44357` での貢献。)" -#: ../../whatsnew/3.11.rst:887 msgid "" "The behaviour of two :func:`math.pow` corner cases was changed, for " "consistency with the IEEE 754 specification. The operations ``math.pow(0.0, -" @@ -1225,181 +1516,236 @@ msgid "" "they raised :exc:`ValueError`. (Contributed by Mark Dickinson in :issue:" "`44339`.)" msgstr "" +"IEEE 754 の仕様と整合させるため、:func:`math.pow` の特殊な 2 つのケースの動作" +"が変わりました。\n" +"``math.pow(0.0, -math.inf)`` と ``math.pow(-0.0, -math.inf)`` は、``inf`` を" +"返すようになりました。\n" +"以前は :exc:`ValueError` を送出していました。\n" +"(Mark Dickinson による :issue:`44339` での貢献。)" -#: ../../whatsnew/3.11.rst:893 msgid "" "The :data:`math.nan` value is now always available. (Contributed by Victor " "Stinner in :issue:`46917`.)" msgstr "" +":data:`math.nan` の値が常に利用できるようになりました。\n" +"(Victor Stinner による :issue:`46917` での貢献。)" #: ../../whatsnew/3.11.rst:900 msgid "operator" msgstr "operator" -#: ../../whatsnew/3.11.rst:902 msgid "" "A new function ``operator.call`` has been added, such that ``operator." "call(obj, *args, **kwargs) == obj(*args, **kwargs)``. (Contributed by Antony " "Lee in :issue:`44019`.)" msgstr "" +"``operator.call(obj, *args, **kwargs) == obj(*args, **kwargs)`` となる、新し" +"い関数 ``operator.call`` が追加されました。\n" +"(Antony Lee による :issue:`44019` での貢献。)" #: ../../whatsnew/3.11.rst:910 msgid "os" msgstr "os" -#: ../../whatsnew/3.11.rst:912 msgid "" "On Windows, :func:`os.urandom` now uses ``BCryptGenRandom()``, instead of " "``CryptGenRandom()`` which is deprecated. (Contributed by Donghee Na in :" "issue:`44611`.)" msgstr "" +"Windows の :func:`os.urandom` は、非推奨の ``CryptGenRandom()`` の代わりに " +"``BCryptGenRandom()`` を使うようになりました。\n" +"(Donghee Na による :issue:`44611` での貢献。)" #: ../../whatsnew/3.11.rst:920 msgid "pathlib" msgstr "pathlib" -#: ../../whatsnew/3.11.rst:922 msgid "" ":meth:`~pathlib.Path.glob` and :meth:`~pathlib.Path.rglob` return only " "directories if *pattern* ends with a pathname components separator: :data:" "`~os.sep` or :data:`~os.altsep`. (Contributed by Eisuke Kawasima in :issue:" "`22276` and :issue:`33392`.)" msgstr "" +":meth:`~pathlib.Path.glob` と :meth:`~pathlib.Path.rglob` は、*pattern* がパ" +"ス要素の区切り文字 (:data:`~os.sep` または :data:`~os.altsep`) で終わる場合、" +"ディレクトリだけを返すようになりました。\n" +"(Eisuke Kawasima による :issue:`22276` and :issue:`33392` での貢献。)" #: ../../whatsnew/3.11.rst:931 msgid "re" msgstr "re" -#: ../../whatsnew/3.11.rst:933 msgid "" "Atomic grouping (``(?>...)``) and possessive quantifiers (``*+``, ``++``, ``?" "+``, ``{m,n}+``) are now supported in regular expressions. (Contributed by " "Jeffrey C. Jacobs and Serhiy Storchaka in :issue:`433030`.)" msgstr "" +"正規表現で、アトミックグループ (``(?>...)``) と所有型の数量詞 (``*+``、``+" +"+``、``?+``、``{m,n}+``) がサポートされました。\n" +"(Jeffrey C. Jacobs and Serhiy Storchaka による :issue:`433030` での貢献。)" #: ../../whatsnew/3.11.rst:941 msgid "shutil" msgstr "shutil" -#: ../../whatsnew/3.11.rst:943 msgid "" "Add optional parameter *dir_fd* in :func:`shutil.rmtree`. (Contributed by " "Serhiy Storchaka in :issue:`46245`.)" msgstr "" +":func:`shutil.rmtree` に省略可能な引数 *dir_fd* が追加されました。\n" +"(Serhiy Storchaka による :issue:`46245` での貢献。)" #: ../../whatsnew/3.11.rst:950 msgid "socket" msgstr "socket" -#: ../../whatsnew/3.11.rst:952 msgid "" "Add CAN Socket support for NetBSD. (Contributed by Thomas Klausner in :issue:" "`30512`.)" msgstr "" +"NetBSD で CAN ソケットがサポートされました。\n" +"(Thomas Klausner による :issue:`30512` での貢献。)" -#: ../../whatsnew/3.11.rst:955 msgid "" ":meth:`~socket.create_connection` has an option to raise, in case of failure " "to connect, an :exc:`ExceptionGroup` containing all errors instead of only " "raising the last error. (Contributed by Irit Katriel in :issue:`29980`.)" msgstr "" +":meth:`~socket.create_connection` に、接続失敗時に最後のエラーだけを送出する" +"代わりに、すべてのエラーを含む :exc:`ExceptionGroup` を送出するオプションが追" +"加されました。\n" +"(Irit Katriel による :issue:`29980` での貢献。)" #: ../../whatsnew/3.11.rst:964 msgid "sqlite3" msgstr "sqlite3" -#: ../../whatsnew/3.11.rst:966 msgid "" "You can now disable the authorizer by passing :const:`None` to :meth:" "`~sqlite3.Connection.set_authorizer`. (Contributed by Erlend E. Aasland in :" "issue:`44491`.)" msgstr "" +":meth:`~sqlite3.Connection.set_authorizer` に :const:`None` を渡すことで、認" +"可処理を無効にできるようになりました。\n" +"(Erlend E. Aasland による :issue:`44491` での貢献。)" -#: ../../whatsnew/3.11.rst:970 msgid "" "Collation name :meth:`~sqlite3.Connection.create_collation` can now contain " "any Unicode character. Collation names with invalid characters now raise :" "exc:`UnicodeEncodeError` instead of :exc:`sqlite3.ProgrammingError`. " "(Contributed by Erlend E. Aasland in :issue:`44688`.)" msgstr "" +":meth:`~sqlite3.Connection.create_collation` の照合順序名に、任意の Unicode " +"文字を含められるようになりました。\n" +"不正な文字を含む照合順序名は、:exc:`sqlite3.ProgrammingError` の代わりに :" +"exc:`UnicodeEncodeError` を送出するようになりました。\n" +"(Erlend E. Aasland による :issue:`44688` での貢献。)" -#: ../../whatsnew/3.11.rst:975 msgid "" ":mod:`sqlite3` exceptions now include the SQLite extended error code as :" "attr:`~sqlite3.Error.sqlite_errorcode` and the SQLite error name as :attr:" "`~sqlite3.Error.sqlite_errorname`. (Contributed by Aviv Palivoda, Daniel " "Shahaf, and Erlend E. Aasland in :issue:`16379` and :issue:`24139`.)" msgstr "" +":mod:`sqlite3` の例外に、SQLite の拡張エラーコードを格納する :attr:`~sqlite3." +"Error.sqlite_errorcode` と、SQLite のエラー名を格納する :attr:`~sqlite3." +"Error.sqlite_errorname` が追加されました。\n" +"(Aviv Palivoda, Daniel Shahaf, and Erlend E. Aasland による :issue:`16379` " +"and :issue:`24139` での貢献。)" -#: ../../whatsnew/3.11.rst:981 msgid "" "Add :meth:`~sqlite3.Connection.setlimit` and :meth:`~sqlite3.Connection." "getlimit` to :class:`sqlite3.Connection` for setting and getting SQLite " "limits by connection basis. (Contributed by Erlend E. Aasland in :issue:" "`45243`.)" msgstr "" +":class:`sqlite3.Connection` に :meth:`~sqlite3.Connection.setlimit` と :meth:" +"`~sqlite3.Connection.getlimit` が追加され、接続ごとに SQLite の上限値を設定・" +"取得できるようになりました。\n" +"(Erlend E. Aasland による :issue:`45243` での貢献。)" -#: ../../whatsnew/3.11.rst:986 msgid "" ":mod:`sqlite3` now sets :attr:`sqlite3.threadsafety` based on the default " "threading mode the underlying SQLite library has been compiled with. " "(Contributed by Erlend E. Aasland in :issue:`45613`.)" msgstr "" +":mod:`sqlite3` は、基盤の SQLite ライブラリがコンパイルされたときのデフォルト" +"のスレッドモードに基づいて、:attr:`sqlite3.threadsafety` を設定するようになり" +"ました。\n" +"(Erlend E. Aasland による :issue:`45613` での貢献。)" -#: ../../whatsnew/3.11.rst:990 msgid "" ":mod:`sqlite3` C callbacks now use unraisable exceptions if callback " "tracebacks are enabled. Users can now register an :func:`unraisable hook " "handler ` to improve their debug experience. " "(Contributed by Erlend E. Aasland in :issue:`45828`.)" msgstr "" +":mod:`sqlite3` の C コールバックでは、コールバックのトレースバックを有効にし" +"ている場合、送出できない例外として処理するようになりました。\n" +":func:`送出できない例外のフックハンドラー ` を登録し、デ" +"バッグに役立てられるようになりました。\n" +"(Erlend E. Aasland による :issue:`45828` での貢献。)" -#: ../../whatsnew/3.11.rst:996 msgid "" "Fetch across rollback no longer raises :exc:`~sqlite3.InterfaceError`. " "Instead we leave it to the SQLite library to handle these cases. " "(Contributed by Erlend E. Aasland in :issue:`44092`.)" msgstr "" +"ロールバックをまたいで行を取得しても、:exc:`~sqlite3.InterfaceError` を送出し" +"なくなりました。\n" +"代わりに、こうしたケースの処理を SQLite ライブラリに委ねます。\n" +"(Erlend E. Aasland による :issue:`44092` での貢献。)" -#: ../../whatsnew/3.11.rst:1000 msgid "" "Add :meth:`~sqlite3.Connection.serialize` and :meth:`~sqlite3.Connection." "deserialize` to :class:`sqlite3.Connection` for serializing and " "deserializing databases. (Contributed by Erlend E. Aasland in :issue:" "`41930`.)" msgstr "" +"データベースを直列化・逆直列化するため、:class:`sqlite3.Connection` に :meth:" +"`~sqlite3.Connection.serialize` と :meth:`~sqlite3.Connection.deserialize` が" +"追加されました。\n" +"(Erlend E. Aasland による :issue:`41930` での貢献。)" -#: ../../whatsnew/3.11.rst:1005 msgid "" "Add :meth:`~sqlite3.Connection.create_window_function` to :class:`sqlite3." "Connection` for creating aggregate window functions. (Contributed by Erlend " "E. Aasland in :issue:`34916`.)" msgstr "" +"集約ウィンドウ関数を作成するため、:class:`sqlite3.Connection` に :meth:" +"`~sqlite3.Connection.create_window_function` が追加されました。\n" +"(Erlend E. Aasland による :issue:`34916` での貢献。)" -#: ../../whatsnew/3.11.rst:1009 msgid "" "Add :meth:`~sqlite3.Connection.blobopen` to :class:`sqlite3.Connection`. :" "class:`sqlite3.Blob` allows incremental I/O operations on blobs. " "(Contributed by Aviv Palivoda and Erlend E. Aasland in :issue:`24905`.)" msgstr "" +":class:`sqlite3.Connection` に :meth:`~sqlite3.Connection.blobopen` が追加さ" +"れました。\n" +":class:`sqlite3.Blob` により、BLOB を少しずつ読み書きできます。\n" +"(Aviv Palivoda and Erlend E. Aasland による :issue:`24905` での貢献。)" #: ../../whatsnew/3.11.rst:1017 msgid "string" msgstr "string" -#: ../../whatsnew/3.11.rst:1019 msgid "" "Add :meth:`~string.Template.get_identifiers` and :meth:`~string.Template." "is_valid` to :class:`string.Template`, which respectively return all valid " "placeholders, and whether any invalid placeholders are present. (Contributed " "by Ben Kehoe in :gh:`90465`.)" msgstr "" +":class:`string.Template` に :meth:`~string.Template.get_identifiers` と :" +"meth:`~string.Template.is_valid` が追加されました。\n" +"それぞれ、有効なプレースホルダーをすべて返し、不正なプレースホルダーが含まれ" +"ているかどうかを判定します。\n" +"(Ben Kehoe による :gh:`90465` での貢献。)" #: ../../whatsnew/3.11.rst:1029 msgid "sys" msgstr "sys" -#: ../../whatsnew/3.11.rst:1031 msgid "" ":func:`sys.exc_info` now derives the ``type`` and ``traceback`` fields from " "the ``value`` (the exception instance), so when an exception is modified " @@ -1407,25 +1753,32 @@ msgid "" "subsequent calls to :func:`!exc_info`. (Contributed by Irit Katriel in :" "issue:`45711`.)" msgstr "" +":func:`sys.exc_info` は、``value`` (例外インスタンス) から ``type`` と " +"``traceback`` フィールドを求めるようになりました。\n" +"そのため、例外の処理中に例外を変更すると、その後の :func:`!exc_info` の結果に" +"も変更が反映されます。\n" +"(Irit Katriel による :issue:`45711` での貢献。)" -#: ../../whatsnew/3.11.rst:1037 msgid "" "Add :func:`sys.exception` which returns the active exception instance " "(equivalent to ``sys.exc_info()[1]``). (Contributed by Irit Katriel in :" "issue:`46328`.)" msgstr "" +"処理中の例外インスタンスを返す :func:`sys.exception` が追加されました (``sys." +"exc_info()[1]`` と同等です)。\n" +"(Irit Katriel による :issue:`46328` での貢献。)" -#: ../../whatsnew/3.11.rst:1041 msgid "" "Add the :data:`sys.flags.safe_path ` flag. (Contributed by Victor " "Stinner in :gh:`57684`.)" msgstr "" +":data:`sys.flags.safe_path ` フラグが追加されました。\n" +"(Victor Stinner による :gh:`57684` での貢献。)" #: ../../whatsnew/3.11.rst:1048 msgid "sysconfig" msgstr "sysconfig" -#: ../../whatsnew/3.11.rst:1050 msgid "" "Three new :ref:`installation schemes ` (*posix_venv*, " "*nt_venv* and *venv*) were added and are used when Python creates new " @@ -1438,12 +1791,23 @@ msgid "" "installation scheme to determine the paths, as does :mod:`venv`. " "(Contributed by Miro Hrončok in :issue:`45413`.)" msgstr "" +"新しい :ref:`インストールスキーム ` *posix_venv*、" +"*nt_venv*、*venv* が追加されました。\n" +"Python が新しい仮想環境を作成するときや、仮想環境内で実行されているときに使わ" +"れます。\n" +"最初の 2 つ (*posix_venv* と *nt_venv*) は、それぞれ Windows 以外と Windows " +"用の OS 固有のスキームです。\n" +"*venv* は実質的に、Python が動作する OS に応じたどちらかの別名です。\n" +"これは :func:`sysconfig.get_preferred_scheme` を変更する配布者に役立ちま" +"す。\n" +"新しい仮想環境を作成するサードパーティーのコードは、:mod:`venv` と同様に、新" +"しい *venv* インストールスキームを使ってパスを決めるべきです。\n" +"(Miro Hrončok による :issue:`45413` での貢献。)" #: ../../whatsnew/3.11.rst:1067 msgid "tempfile" msgstr "tempfile" -#: ../../whatsnew/3.11.rst:1069 msgid "" ":class:`~tempfile.SpooledTemporaryFile` objects now fully implement the " "methods of :class:`io.BufferedIOBase` or :class:`io.TextIOBase` (depending " @@ -1451,12 +1815,17 @@ msgid "" "objects, such as compression modules. (Contributed by Carey Metcalfe in :gh:" "`70363`.)" msgstr "" +":class:`~tempfile.SpooledTemporaryFile` オブジェクトが、ファイルモードに応じ" +"て :class:`io.BufferedIOBase` または :class:`io.TextIOBase` のメソッドを完全" +"に実装するようになりました。\n" +"これにより、圧縮モジュールなど、ファイルライクオブジェクトを想定する API で正" +"しく動作します。\n" +"(Carey Metcalfe による :gh:`70363` での貢献。)" #: ../../whatsnew/3.11.rst:1080 msgid "threading" msgstr "threading" -#: ../../whatsnew/3.11.rst:1082 msgid "" "On Unix, if the ``sem_clockwait()`` function is available in the C library " "(glibc 2.30 and newer), the :meth:`threading.Lock.acquire` method now uses " @@ -1465,12 +1834,17 @@ msgid "" "affected by system clock changes. (Contributed by Victor Stinner in :issue:" "`41710`.)" msgstr "" +"Unix では、C ライブラリに ``sem_clockwait()`` 関数がある場合 (glibc 2.30 以" +"降)、:meth:`threading.Lock.acquire` はタイムアウトにシステムクロック (:const:" +"`time.CLOCK_REALTIME`) ではなく単調増加クロック (:const:`time." +"CLOCK_MONOTONIC`) を使うようになりました。\n" +"システムクロックの変更の影響を受けないようにするためです。\n" +"(Victor Stinner による :issue:`41710` での貢献。)" #: ../../whatsnew/3.11.rst:1093 msgid "time" msgstr "time" -#: ../../whatsnew/3.11.rst:1095 msgid "" "On Unix, :func:`time.sleep` now uses the ``clock_nanosleep()`` or " "``nanosleep()`` function, if available, which has a resolution of 1 " @@ -1478,8 +1852,12 @@ msgid "" "has a resolution of 1 microsecond (10\\ :sup:`-6` seconds). (Contributed by " "Benjamin Szőke and Victor Stinner in :issue:`21302`.)" msgstr "" +"Unix の :func:`time.sleep` は、利用可能なら ``clock_nanosleep()`` または " +"``nanosleep()`` を使うようになりました。\n" +"これらの分解能は 1 ナノ秒 (10\\ :sup:`-9` 秒) で、従来使っていた " +"``select()`` の 1 マイクロ秒 (10\\ :sup:`-6` 秒) より細かくなっています。\n" +"(Benjamin Szőke and Victor Stinner による :issue:`21302` での貢献。)" -#: ../../whatsnew/3.11.rst:1101 msgid "" "On Windows 8.1 and newer, :func:`time.sleep` now uses a waitable timer based " "on `high-resolution timers `_ に基づく待機可能タイマーを使うようになりました。\n" +"その分解能は 100 ナノ秒 (10\\ :sup:`-7` 秒) です。\n" +"以前の分解能は 1 ミリ秒 (10\\ :sup:`-3` 秒) でした。\n" +"(Benjamin Szőke, Donghee Na, Eryk Sun and Victor Stinner による :issue:" +"`21302` and :issue:`45429` での貢献。)" #: ../../whatsnew/3.11.rst:1112 msgid "tkinter" msgstr "tkinter" -#: ../../whatsnew/3.11.rst:1114 msgid "" "Added method ``info_patchlevel()`` which returns the exact version of the " "Tcl library as a named tuple similar to :data:`sys.version_info`. " "(Contributed by Serhiy Storchaka in :gh:`91827`.)" msgstr "" +"Tcl ライブラリの正確なバージョンを、:data:`sys.version_info` に似た名前付きタ" +"プルで返す ``info_patchlevel()`` メソッドが追加されました。\n" +"(Serhiy Storchaka による :gh:`91827` での貢献。)" #: ../../whatsnew/3.11.rst:1122 msgid "traceback" msgstr "traceback" -#: ../../whatsnew/3.11.rst:1124 msgid "" "Add :func:`traceback.StackSummary.format_frame_summary` to allow users to " "override which frames appear in the traceback, and how they are formatted. " "(Contributed by Ammar Askar in :issue:`44569`.)" msgstr "" +"トレースバックに表示するフレームとその書式を上書きできるようにする :func:" +"`traceback.StackSummary.format_frame_summary` が追加されました。\n" +"(Ammar Askar による :issue:`44569` での貢献。)" -#: ../../whatsnew/3.11.rst:1129 msgid "" "Add :func:`traceback.TracebackException.print`, which prints the formatted :" "exc:`~traceback.TracebackException` instance to a file. (Contributed by Irit " "Katriel in :issue:`33809`.)" msgstr "" +"書式化した :exc:`~traceback.TracebackException` インスタンスをファイルに出力" +"する :func:`traceback.TracebackException.print` が追加されました。\n" +"(Irit Katriel による :issue:`33809` での貢献。)" #: ../../whatsnew/3.11.rst:1137 msgid "typing" msgstr "typing" -#: ../../whatsnew/3.11.rst:1139 msgid "For major changes, see :ref:`new-feat-related-type-hints-311`." msgstr "" +"主な変更については :ref:`new-feat-related-type-hints-311` を参照してくださ" +"い。" -#: ../../whatsnew/3.11.rst:1141 msgid "" "Add :func:`typing.assert_never` and :class:`typing.Never`. :func:`typing." "assert_never` is useful for asking a type checker to confirm that a line of " "code is not reachable. At runtime, it raises an :exc:`AssertionError`. " "(Contributed by Jelle Zijlstra in :gh:`90633`.)" msgstr "" +":func:`typing.assert_never` と :class:`typing.Never` が追加されました。\n" +":func:`typing.assert_never` は、あるコード行に到達し得ないことを型チェッカー" +"に確認させるために役立ちます。\n" +"実行時には :exc:`AssertionError` を送出します。\n" +"(Jelle Zijlstra による :gh:`90633` での貢献。)" -#: ../../whatsnew/3.11.rst:1147 msgid "" "Add :func:`typing.reveal_type`. This is useful for asking a type checker " "what type it has inferred for a given expression. At runtime it prints the " "type of the received value. (Contributed by Jelle Zijlstra in :gh:`90572`.)" msgstr "" +":func:`typing.reveal_type` が追加されました。\n" +"指定した式の型をどう推論したか、型チェッカーに尋ねるために役立ちます。\n" +"実行時には、受け取った値の型を表示します。\n" +"(Jelle Zijlstra による :gh:`90572` での貢献。)" -#: ../../whatsnew/3.11.rst:1152 msgid "" "Add :func:`typing.assert_type`. This is useful for asking a type checker to " "confirm that the type it has inferred for a given expression matches the " "given type. At runtime it simply returns the received value. (Contributed by " "Jelle Zijlstra in :gh:`90638`.)" msgstr "" +":func:`typing.assert_type` が追加されました。\n" +"指定した式について推論した型が指定した型と一致することを、型チェッカーに確認" +"させるために役立ちます。\n" +"実行時には、受け取った値をそのまま返します。\n" +"(Jelle Zijlstra による :gh:`90638` での貢献。)" -#: ../../whatsnew/3.11.rst:1157 msgid "" ":data:`typing.TypedDict` types can now be generic. (Contributed by Samodya " "Abeysiriwardane in :gh:`89026`.)" msgstr "" +":data:`typing.TypedDict` 型をジェネリックにできるようになりました。\n" +"(Samodya Abeysiriwardane による :gh:`89026` での貢献。)" -#: ../../whatsnew/3.11.rst:1160 msgid "" ":class:`~typing.NamedTuple` types can now be generic. (Contributed by Serhiy " "Storchaka in :issue:`43923`.)" msgstr "" +":class:`~typing.NamedTuple` 型をジェネリックにできるようになりました。\n" +"(Serhiy Storchaka による :issue:`43923` での貢献。)" -#: ../../whatsnew/3.11.rst:1163 msgid "" "Allow subclassing of :class:`typing.Any`. This is useful for avoiding type " "checker errors related to highly dynamic class, such as mocks. (Contributed " "by Shantanu Jain in :gh:`91154`.)" msgstr "" +":class:`typing.Any` をサブクラス化できるようになりました。\n" +"モックなど、動的に振る舞うクラスに関する型チェッカーのエラーを避けるために役" +"立ちます。\n" +"(Shantanu Jain による :gh:`91154` での貢献。)" #: ../../whatsnew/3.11.rst:1167 msgid "" @@ -1583,46 +1991,60 @@ msgid "" "gh:`89263`.)" msgstr "" -#: ../../whatsnew/3.11.rst:1176 msgid "" "The :meth:`~object.__init__` method of :class:`~typing.Protocol` subclasses " "is now preserved. (Contributed by Adrian Garcia Badarasco in :gh:`88970`.)" msgstr "" +":class:`~typing.Protocol` のサブクラスの :meth:`~object.__init__` メソッドが" +"保持されるようになりました。\n" +"(Adrian Garcia Badarasco による :gh:`88970` での貢献。)" -#: ../../whatsnew/3.11.rst:1179 msgid "" "The representation of empty tuple types (``Tuple[()]``) is simplified. This " "affects introspection, e.g. ``get_args(Tuple[()])`` now evaluates to ``()`` " "instead of ``((),)``. (Contributed by Serhiy Storchaka in :gh:`91137`.)" msgstr "" +"空のタプル型 (``Tuple[()]``) の表現が単純化されました。\n" +"イントロスペクションに影響し、例えば ``get_args(Tuple[()])`` は ``((),)`` で" +"はなく ``()`` と評価されるようになりました。\n" +"(Serhiy Storchaka による :gh:`91137` での貢献。)" -#: ../../whatsnew/3.11.rst:1184 msgid "" "Loosen runtime requirements for type annotations by removing the callable " "check in the private ``typing._type_check`` function. (Contributed by " "Gregory Beauregard in :gh:`90802`.)" msgstr "" +"非公開関数 ``typing._type_check`` から呼び出し可能かどうかの検査を取り除き、" +"型アノテーションの実行時の要件を緩和しました。\n" +"(Gregory Beauregard による :gh:`90802` での貢献。)" -#: ../../whatsnew/3.11.rst:1188 msgid "" ":func:`typing.get_type_hints` now supports evaluating strings as forward " "references in :ref:`PEP 585 generic aliases `. " "(Contributed by Niklas Rosenstein in :gh:`85542`.)" msgstr "" +":func:`typing.get_type_hints` が、:ref:`PEP 585 のジェネリックエイリアス " +"` 内の文字列を前方参照として評価できるようになりまし" +"た。\n" +"(Niklas Rosenstein による :gh:`85542` での貢献。)" -#: ../../whatsnew/3.11.rst:1192 msgid "" ":func:`typing.get_type_hints` no longer adds :data:`~typing.Optional` to " "parameters with ``None`` as a default. (Contributed by Nikita Sobolev in :gh:" "`90353`.)" msgstr "" +":func:`typing.get_type_hints` は、デフォルト値が ``None`` の引数に :data:" +"`~typing.Optional` を追加しなくなりました。\n" +"(Nikita Sobolev による :gh:`90353` での貢献。)" -#: ../../whatsnew/3.11.rst:1196 msgid "" ":func:`typing.get_type_hints` now supports evaluating bare stringified :data:" "`~typing.ClassVar` annotations. (Contributed by Gregory Beauregard in :gh:" "`90711`.)" msgstr "" +":func:`typing.get_type_hints` が、型引数を指定せずに文字列化された :data:" +"`~typing.ClassVar` アノテーションを評価できるようになりました。\n" +"(Gregory Beauregard による :gh:`90711` での貢献。)" #: ../../whatsnew/3.11.rst:1200 msgid "" @@ -1635,17 +2057,17 @@ msgstr "" msgid "unicodedata" msgstr "unicodedata" -#: ../../whatsnew/3.11.rst:1210 msgid "" "The Unicode database has been updated to version 14.0.0. (Contributed by " "Benjamin Peterson in :issue:`45190`)." msgstr "" +"Unicode データベースがバージョン 14.0.0 に更新されました。\n" +"(Benjamin Peterson による :issue:`45190` での貢献。)" #: ../../whatsnew/3.11.rst:1217 msgid "unittest" msgstr "unittest" -#: ../../whatsnew/3.11.rst:1219 msgid "" "Added methods :meth:`~unittest.TestCase.enterContext` and :meth:`~unittest." "TestCase.enterClassContext` of class :class:`~unittest.TestCase`, method :" @@ -1653,12 +2075,17 @@ msgid "" "`~unittest.IsolatedAsyncioTestCase` and function :func:`unittest." "enterModuleContext`. (Contributed by Serhiy Storchaka in :issue:`45046`.)" msgstr "" +":class:`~unittest.TestCase` に :meth:`~unittest.TestCase.enterContext` と :" +"meth:`~unittest.TestCase.enterClassContext`、:class:`~unittest." +"IsolatedAsyncioTestCase` に :meth:`~unittest.IsolatedAsyncioTestCase." +"enterAsyncContext`、および :func:`unittest.enterModuleContext` 関数が追加され" +"ました。\n" +"(Serhiy Storchaka による :issue:`45046` での貢献。)" #: ../../whatsnew/3.11.rst:1231 msgid "venv" msgstr "venv" -#: ../../whatsnew/3.11.rst:1233 msgid "" "When new Python virtual environments are created, the *venv* :ref:`sysconfig " "installation scheme ` is used to determine the paths " @@ -1669,105 +2096,144 @@ msgid "" "environments should do the same. (Contributed by Miro Hrončok in :issue:" "`45413`.)" msgstr "" +"新しい Python 仮想環境を作成する際、環境内のパスを決めるために *venv* :ref:" +"`sysconfig インストールスキーム ` を使うようになりまし" +"た。\n" +"Python を仮想環境内で実行する際も、同じインストールスキームがデフォルトになり" +"ます。\n" +"これにより、配布者は仮想環境の動作を変えずに、sysconfig のデフォルトのインス" +"トールスキームを変更できます。\n" +"新しい仮想環境を作成するサードパーティーのコードも、同じようにするべきで" +"す。\n" +"(Miro Hrončok による :issue:`45413` での貢献。)" #: ../../whatsnew/3.11.rst:1247 msgid "warnings" msgstr "warnings" -#: ../../whatsnew/3.11.rst:1249 msgid "" ":func:`warnings.catch_warnings` now accepts arguments for :func:`warnings." "simplefilter`, providing a more concise way to locally ignore warnings or " "convert them to errors. (Contributed by Zac Hatfield-Dodds in :issue:" "`47074`.)" msgstr "" +":func:`warnings.catch_warnings` が :func:`warnings.simplefilter` 用の引数を受" +"け取るようになり、特定の範囲だけで警告を無視したり、エラーに変えたりする処理" +"を簡潔に書けるようになりました。\n" +"(Zac Hatfield-Dodds による :issue:`47074` での貢献。)" #: ../../whatsnew/3.11.rst:1257 msgid "zipfile" msgstr "zipfile" -#: ../../whatsnew/3.11.rst:1259 msgid "" "Added support for specifying member name encoding for reading metadata in a :" "class:`~zipfile.ZipFile`'s directory and file headers. (Contributed by " "Stephen J. Turnbull and Serhiy Storchaka in :issue:`28080`.)" msgstr "" +":class:`~zipfile.ZipFile` のディレクトリヘッダーやファイルヘッダーのメタデー" +"タを読み取る際、メンバー名のエンコーディングを指定できるようになりました。\n" +"(Stephen J. Turnbull and Serhiy Storchaka による :issue:`28080` での貢献。)" -#: ../../whatsnew/3.11.rst:1263 msgid "" "Added :meth:`ZipFile.mkdir() ` for creating new " "directories inside ZIP archives. (Contributed by Sam Ezeh in :gh:`49083`.)" msgstr "" +"ZIP アーカイブ内に新しいディレクトリを作成する :meth:`ZipFile.mkdir() " +"` が追加されました。\n" +"(Sam Ezeh による :gh:`49083` での貢献。)" -#: ../../whatsnew/3.11.rst:1267 msgid "" "Added :attr:`~zipfile.Path.stem`, :attr:`~zipfile.Path.suffix` and :attr:" "`~zipfile.Path.suffixes` to :class:`zipfile.Path`. (Contributed by Miguel " "Brito in :gh:`88261`.)" msgstr "" +":class:`zipfile.Path` に :attr:`~zipfile.Path.stem`、:attr:`~zipfile.Path." +"suffix`、:attr:`~zipfile.Path.suffixes` が追加されました。\n" +"(Miguel Brito による :gh:`88261` での貢献。)" #: ../../whatsnew/3.11.rst:1275 msgid "Optimizations" msgstr "最適化" -#: ../../whatsnew/3.11.rst:1277 msgid "" "This section covers specific optimizations independent of the :ref:" "`whatsnew311-faster-cpython` project, which is covered in its own section." msgstr "" +"この節では、別の節で説明する :ref:`whatsnew311-faster-cpython` プロジェクトと" +"は独立した、個別の最適化を扱います。" -#: ../../whatsnew/3.11.rst:1280 msgid "" "The compiler now optimizes simple :ref:`printf-style % formatting ` on string literals containing only the format codes " "``%s``, ``%r`` and ``%a`` and makes it as fast as a corresponding :term:`f-" "string` expression. (Contributed by Serhiy Storchaka in :issue:`28307`.)" msgstr "" +"コンパイラは、書式コード ``%s``、``%r``、``%a`` だけを含む文字列リテラルの単" +"純な :ref:`printf 形式の % 書式化 ` を最適化し、対応す" +"る :term:`f-string` 式と同じ速さで実行するようになりました。\n" +"(Serhiy Storchaka による :issue:`28307` での貢献。)" -#: ../../whatsnew/3.11.rst:1286 msgid "" "Integer division (``//``) is better tuned for optimization by compilers. It " "is now around 20% faster on x86-64 when dividing an :class:`int` by a value " "smaller than ``2**30``. (Contributed by Gregory P. Smith and Tim Peters in :" "gh:`90564`.)" msgstr "" +"整数の除算 (``//``) をコンパイラが最適化しやすいように調整しました。\n" +"x86-64 で :class:`int` を ``2**30`` 未満の値で割る場合、約 20% 高速になりまし" +"た。\n" +"(Gregory P. Smith and Tim Peters による :gh:`90564` での貢献。)" -#: ../../whatsnew/3.11.rst:1291 msgid "" ":func:`sum` is now nearly 30% faster for integers smaller than ``2**30``. " "(Contributed by Stefan Behnel in :gh:`68264`.)" msgstr "" +"``2**30`` 未満の整数に対する :func:`sum` が、約 30% 高速になりました。\n" +"(Stefan Behnel による :gh:`68264` での貢献。)" -#: ../../whatsnew/3.11.rst:1294 msgid "" "Resizing lists is streamlined for the common case, speeding up :meth:`list." "append` by ≈15% and simple :term:`list comprehension`\\s by up to 20-30% " "(Contributed by Dennis Sweeney in :gh:`91165`.)" msgstr "" +"よくある場合のリストのサイズ変更を効率化し、:meth:`list.append` が約 15%、単" +"純な :term:`list comprehension` が最大 20~30% 高速になりました。\n" +"(Dennis Sweeney による :gh:`91165` での貢献。)" -#: ../../whatsnew/3.11.rst:1299 msgid "" "Dictionaries don't store hash values when all keys are Unicode objects, " "decreasing :class:`dict` size. For example, ``sys.getsizeof(dict." "fromkeys(\"abcdefg\"))`` is reduced from 352 bytes to 272 bytes (23% " "smaller) on 64-bit platforms. (Contributed by Inada Naoki in :issue:`46845`.)" msgstr "" +"キーがすべて Unicode オブジェクトである辞書はハッシュ値を保存しなくなり、:" +"class:`dict` のサイズが小さくなりました。\n" +"例えば、64 ビットプラットフォームでの ``sys.getsizeof(dict." +"fromkeys(\"abcdefg\"))`` は、352 バイトから 272 バイトに減りました (23% 削" +"減)。\n" +"(Inada Naoki による :issue:`46845` での貢献。)" -#: ../../whatsnew/3.11.rst:1305 msgid "" "Using :class:`asyncio.DatagramProtocol` is now orders of magnitude faster " "when transferring large files over UDP, with speeds over 100 times higher " "for a ≈60 MiB file. (Contributed by msoxzw in :gh:`91487`.)" msgstr "" +":class:`asyncio.DatagramProtocol` を使った UDP による大きなファイルの転送が、" +"桁違いに高速になりました。\n" +"約 60 MiB のファイルでは、100 倍を超える速度になりました。\n" +"(msoxzw による :gh:`91487` での貢献。)" -#: ../../whatsnew/3.11.rst:1310 msgid "" ":mod:`math` functions :func:`~math.comb` and :func:`~math.perm` are now ≈10 " "times faster for large arguments (with a larger speedup for larger *k*). " "(Contributed by Serhiy Storchaka in :issue:`37295`.)" msgstr "" +":mod:`math` の :func:`~math.comb` と :func:`~math.perm` が、大きな引数に対し" +"て約 10 倍高速になりました (*k* が大きいほど高速化の度合いも大きくなりま" +"す)。\n" +"(Serhiy Storchaka による :issue:`37295` での貢献。)" -#: ../../whatsnew/3.11.rst:1314 msgid "" "The :mod:`statistics` functions :func:`~statistics.mean`, :func:`~statistics." "variance` and :func:`~statistics.stdev` now consume iterators in one pass " @@ -1775,18 +2241,23 @@ msgid "" "and can save substantial memory. (Contributed by Raymond Hettinger in :gh:" "`90415`.)" msgstr "" +":mod:`statistics` の :func:`~statistics.mean`、:func:`~statistics." +"variance`、:func:`~statistics.stdev` は、イテレーターを最初に :class:`list` " +"に変換する代わりに、1 回の走査で消費するようになりました。\n" +"これにより、2 倍高速になり、メモリ使用量も大幅に削減できます。\n" +"(Raymond Hettinger による :gh:`90415` での貢献。)" -#: ../../whatsnew/3.11.rst:1320 msgid "" ":func:`unicodedata.normalize` now normalizes pure-ASCII strings in constant " "time. (Contributed by Donghee Na in :issue:`44987`.)" msgstr "" +":func:`unicodedata.normalize` が、ASCII 文字だけを含む文字列を定数時間で正規" +"化するようになりました。\n" +"(Donghee Na による :issue:`44987` での貢献。)" -#: ../../whatsnew/3.11.rst:1328 msgid "Faster CPython" -msgstr "" +msgstr "Faster CPython" -#: ../../whatsnew/3.11.rst:1330 msgid "" "CPython 3.11 is an average of `25% faster `_ than CPython 3.10 as measured with the " @@ -1794,89 +2265,99 @@ msgid "" "when compiled with GCC on Ubuntu Linux. Depending on your workload, the " "overall speedup could be 10-60%." msgstr "" +"Ubuntu Linux 上で GCC を使ってコンパイルし、`pyperformance `_ ベンチマークスイートで計測したところ、CPython " +"3.11 は CPython 3.10 より平均 `25% 高速 `_ になりました。\n" +"処理内容によって、全体で 10~60% の高速化が見込まれます。" -#: ../../whatsnew/3.11.rst:1337 msgid "" "This project focuses on two major areas in Python: :ref:`whatsnew311-faster-" "startup` and :ref:`whatsnew311-faster-runtime`. Optimizations not covered by " "this project are listed separately under :ref:`whatsnew311-optimizations`." msgstr "" +"このプロジェクトは、Python の主な 2 つの領域、:ref:`whatsnew311-faster-" +"startup` と :ref:`whatsnew311-faster-runtime` に重点を置いています。\n" +"このプロジェクト以外の最適化は、:ref:`whatsnew311-optimizations` に別途記載し" +"ています。" -#: ../../whatsnew/3.11.rst:1346 msgid "Faster Startup" -msgstr "" +msgstr "起動の高速化" -#: ../../whatsnew/3.11.rst:1351 msgid "Frozen imports / Static code objects" -msgstr "" +msgstr "凍結インポート / 静的コードオブジェクト" -#: ../../whatsnew/3.11.rst:1353 msgid "" "Python caches :term:`bytecode` in the :ref:`__pycache__ ` " "directory to speed up module loading." msgstr "" +"Python はモジュールの読み込みを高速化するため、:ref:`__pycache__ ` ディレクトリに :term:`bytecode` をキャッシュします。" -#: ../../whatsnew/3.11.rst:1356 msgid "Previously in 3.10, Python module execution looked like this:" -msgstr "" +msgstr "以前の Python 3.10 では、モジュールの実行は次の手順でした。" -#: ../../whatsnew/3.11.rst:1358 msgid "Read __pycache__ -> Unmarshal -> Heap allocated code object -> Evaluate" msgstr "" +"__pycache__ を読み込む -> marshal 形式から復元する -> ヒープに確保したコード" +"オブジェクト -> 評価する" -#: ../../whatsnew/3.11.rst:1362 msgid "" "In Python 3.11, the core modules essential for Python startup are " "\"frozen\". This means that their :ref:`codeobjects` (and bytecode) are " "statically allocated by the interpreter. This reduces the steps in module " "execution process to:" msgstr "" +"Python 3.11 では、起動に欠かせない中核のモジュールが「凍結」されています。\n" +"つまり、それらの :ref:`codeobjects` (とバイトコード) は、インタープリタによっ" +"て静的に確保されます。\n" +"これにより、モジュールの実行手順は次のように短くなります。" -#: ../../whatsnew/3.11.rst:1367 msgid "Statically allocated code object -> Evaluate" -msgstr "" +msgstr "静的に確保したコードオブジェクト -> 評価する" -#: ../../whatsnew/3.11.rst:1371 msgid "" "Interpreter startup is now 10-15% faster in Python 3.11. This has a big " "impact for short-running programs using Python." msgstr "" +"Python 3.11 では、インタープリタの起動が 10~15% 高速になりました。\n" +"これは、短時間で終了する Python プログラムに大きな効果があります。" -#: ../../whatsnew/3.11.rst:1374 msgid "" "(Contributed by Eric Snow, Guido van Rossum and Kumar Aditya in many issues.)" msgstr "" +"(多数の課題における Eric Snow、Guido van Rossum、Kumar Aditya の貢献。)\n" +"(Eric Snow, Guido van Rossum and Kumar Aditya による many issues での貢献。)" -#: ../../whatsnew/3.11.rst:1380 msgid "Faster Runtime" -msgstr "" +msgstr "実行の高速化" -#: ../../whatsnew/3.11.rst:1385 msgid "Cheaper, lazy Python frames" -msgstr "" +msgstr "低コストで必要時に生成する Python フレーム" -#: ../../whatsnew/3.11.rst:1387 msgid "" "Python frames, holding execution information, are created whenever Python " "calls a Python function. The following are new frame optimizations:" msgstr "" +"Python が Python 関数を呼び出すたびに、実行情報を保持する Python フレームが作" +"成されます。\n" +"フレームに次の最適化が加わりました。" -#: ../../whatsnew/3.11.rst:1391 msgid "Streamlined the frame creation process." -msgstr "" +msgstr "フレームの作成処理を効率化しました。" #: ../../whatsnew/3.11.rst:1392 msgid "" "Avoided memory allocation by generously re-using frame space on the C stack." msgstr "" -#: ../../whatsnew/3.11.rst:1393 msgid "" "Streamlined the internal frame struct to contain only essential information. " "Frames previously held extra debugging and memory management information." msgstr "" +"内部のフレーム構造体を簡素化し、必須の情報だけを保持するようにしました。\n" +"以前のフレームには、デバッグやメモリ管理のための追加情報が含まれていました。" -#: ../../whatsnew/3.11.rst:1396 msgid "" "Old-style :ref:`frame objects ` are now created only when " "requested by debuggers or by Python introspection functions such as :func:" @@ -1885,30 +2366,38 @@ msgid "" "calls have sped up significantly. We measured a 3-7% speedup in " "pyperformance." msgstr "" +"従来の :ref:`フレームオブジェクト ` は、デバッガーや :func:" +"`sys._getframe`、:func:`inspect.currentframe` などのイントロスペクション関数" +"から要求されたときだけ、作成されるようになりました。\n" +"ほとんどのユーザーコードでは、フレームオブジェクトは一切作成されません。\n" +"その結果、ほぼすべての Python 関数呼び出しが大幅に高速になりました。\n" +"pyperformance では 3~7% の高速化が計測されました。" -#: ../../whatsnew/3.11.rst:1403 msgid "(Contributed by Mark Shannon in :issue:`44590`.)" -msgstr "" +msgstr "(Mark Shannon による :issue:`44590` での貢献。)" -#: ../../whatsnew/3.11.rst:1410 msgid "Inlined Python function calls" -msgstr "" +msgstr "Python 関数呼び出しのインライン化" -#: ../../whatsnew/3.11.rst:1412 msgid "" "During a Python function call, Python will call an evaluating C function to " "interpret that function's code. This effectively limits pure Python " "recursion to what's safe for the C stack." msgstr "" +"Python 関数の呼び出しでは、その関数のコードを解釈する C の評価関数を呼び出し" +"ます。\n" +"そのため、純粋な Python の再帰でも、実質的に C スタックにとって安全な範囲に制" +"限されます。" -#: ../../whatsnew/3.11.rst:1416 msgid "" "In 3.11, when CPython detects Python code calling another Python function, " "it sets up a new frame, and \"jumps\" to the new code inside the new frame. " "This avoids calling the C interpreting function altogether." msgstr "" +"3.11 では、Python コードが別の Python 関数を呼び出すのを CPython が検出する" +"と、新しいフレームを準備し、その中の新しいコードへ「ジャンプ」します。\n" +"これにより、C の解釈実行関数を呼び出さずに済みます。" -#: ../../whatsnew/3.11.rst:1420 msgid "" "Most Python function calls now consume no C stack space, speeding them up. " "In simple recursive functions like fibonacci or factorial, we observed a " @@ -1916,24 +2405,31 @@ msgid "" "deeper (if the user increases the recursion limit with :func:`sys." "setrecursionlimit`). We measured a 1-3% improvement in pyperformance." msgstr "" +"ほとんどの Python 関数呼び出しは C スタックの領域を消費しなくなり、高速になり" +"ました。\n" +"フィボナッチ数や階乗を計算する単純な再帰関数では、1.7 倍の高速化が確認されま" +"した。\n" +"また、:func:`sys.setrecursionlimit` で再帰の上限を増やせば、再帰関数をはるか" +"に深く再帰させられるようになりました。\n" +"pyperformance では 1~3% の改善が計測されました。" -#: ../../whatsnew/3.11.rst:1427 msgid "(Contributed by Pablo Galindo and Mark Shannon in :issue:`45256`.)" -msgstr "" +msgstr "(Pablo Galindo and Mark Shannon による :issue:`45256` での貢献。)" -#: ../../whatsnew/3.11.rst:1433 msgid "PEP 659: Specializing Adaptive Interpreter" -msgstr "" +msgstr "PEP 659: 特殊化を行う適応型インタープリタ" -#: ../../whatsnew/3.11.rst:1435 msgid "" ":pep:`659` is one of the key parts of the Faster CPython project. The " "general idea is that while Python is a dynamic language, most code has " "regions where objects and types rarely change. This concept is known as " "*type stability*." msgstr "" +":pep:`659` は Faster CPython プロジェクトの重要な構成要素の 1 つです。\n" +"基本的な考え方は、Python は動的な言語でも、ほとんどのコードにはオブジェクトや" +"型がめったに変わらない部分がある、というものです。\n" +"この性質を *型の安定性* と呼びます。" -#: ../../whatsnew/3.11.rst:1439 msgid "" "At runtime, Python will try to look for common patterns and type stability " "in the executing code. Python will then replace the current operation with a " @@ -1943,14 +2439,21 @@ msgid "" "where Python caches the results of expensive operations directly in the :" "term:`bytecode`." msgstr "" +"実行時に Python は、実行中のコードによくあるパターンや型の安定性を探しま" +"す。\n" +"そして、現在の操作を、より特殊化した操作に置き換えます。\n" +"特殊化した操作は、その用途や型だけで使える高速な処理経路を利用し、一般に汎用" +"的な操作より高速です。\n" +"ここでは *インラインキャッシュ* という考え方も使われ、コストの高い操作の結果" +"を :term:`bytecode` 内に直接キャッシュします。" -#: ../../whatsnew/3.11.rst:1447 msgid "" "The specializer will also combine certain common instruction pairs into one " "superinstruction, reducing the overhead during execution." msgstr "" +"特殊化の処理は、よく現れる特定の命令のペアを 1 つのスーパー命令にまとめ、実行" +"時のオーバーヘッドも減らします。" -#: ../../whatsnew/3.11.rst:1450 msgid "" "Python will only specialize when it sees code that is \"hot\" (executed " "multiple times). This prevents Python from wasting time on run-once code. " @@ -1959,13 +2462,23 @@ msgid "" "attempts are not too expensive, allowing specialization to adapt to new " "circumstances." msgstr "" +"Python が特殊化を行うのは、「ホット」なコード (複数回実行されるコード) だけで" +"す。\n" +"これにより、1 回しか実行しないコードに時間を浪費するのを防ぎます。\n" +"コードが動的すぎる場合や使われ方が変わった場合は、特殊化を解除することもでき" +"ます。\n" +"特殊化は定期的に試みられ、そのコストも高くないため、新しい状況に適応できま" +"す。" -#: ../../whatsnew/3.11.rst:1457 msgid "" "(PEP written by Mark Shannon, with ideas inspired by Stefan Brunthaler. See :" "pep:`659` for more information. Implementation by Mark Shannon and Brandt " "Bucher, with additional help from Irit Katriel and Dennis Sweeney.)" msgstr "" +"(Stefan Brunthaler の着想を参考に、Mark Shannon が PEP を執筆。\n" +"詳しくは :pep:`659` を参照してください。\n" +"実装は Mark Shannon と Brandt Bucher によるもので、Irit Katriel と Dennis " +"Sweeney も協力。)" #: ../../whatsnew/3.11.rst:1465 msgid "Operation" @@ -1975,265 +2488,244 @@ msgstr "演算" msgid "Form" msgstr "形式" -#: ../../whatsnew/3.11.rst:1465 msgid "Specialization" -msgstr "" +msgstr "特殊化" -#: ../../whatsnew/3.11.rst:1465 msgid "Operation speedup (up to)" -msgstr "" +msgstr "操作の高速化率 (最大)" -#: ../../whatsnew/3.11.rst:1465 msgid "Contributor(s)" -msgstr "" +msgstr "貢献者" -#: ../../whatsnew/3.11.rst:1468 msgid "Binary operations" -msgstr "" +msgstr "二項演算" -#: ../../whatsnew/3.11.rst:1468 msgid "``x + x``" -msgstr "" +msgstr "``x + x``" -#: ../../whatsnew/3.11.rst:1470 msgid "``x - x``" -msgstr "" +msgstr "``x - x``" -#: ../../whatsnew/3.11.rst:1472 msgid "``x * x``" -msgstr "" +msgstr "``x * x``" -#: ../../whatsnew/3.11.rst:1468 msgid "" "Binary add, multiply and subtract for common types such as :class:`int`, :" "class:`float` and :class:`str` take custom fast paths for their underlying " "types." msgstr "" +":class:`int`、:class:`float`、:class:`str` などのよく使う型に対する加算、乗" +"算、減算は、それぞれの型に合わせた高速な処理経路を使います。" -#: ../../whatsnew/3.11.rst:1468 msgid "10%" -msgstr "" +msgstr "10%" -#: ../../whatsnew/3.11.rst:1468 msgid "Mark Shannon, Donghee Na, Brandt Bucher, Dennis Sweeney" -msgstr "" +msgstr "Mark Shannon, Donghee Na, Brandt Bucher, Dennis Sweeney" -#: ../../whatsnew/3.11.rst:1474 msgid "Subscript" -msgstr "" +msgstr "添字によるアクセス" -#: ../../whatsnew/3.11.rst:1474 msgid "``a[i]``" -msgstr "" +msgstr "``a[i]``" -#: ../../whatsnew/3.11.rst:1474 msgid "" "Subscripting container types such as :class:`list`, :class:`tuple` and :" "class:`dict` directly index the underlying data structures." msgstr "" +":class:`list`、:class:`tuple`、:class:`dict` などのコンテナ型への添字アクセス" +"では、内部のデータ構造を直接参照します。" -#: ../../whatsnew/3.11.rst:1478 msgid "" "Subscripting custom :meth:`~object.__getitem__` is also inlined similar to :" "ref:`inline-calls`." msgstr "" +"独自の :meth:`~object.__getitem__` を使う添字アクセスも、:ref:`inline-calls` " +"と同様にインライン化されます。" -#: ../../whatsnew/3.11.rst:1474 ../../whatsnew/3.11.rst:1481 msgid "10-25%" -msgstr "" +msgstr "10-25%" -#: ../../whatsnew/3.11.rst:1474 msgid "Irit Katriel, Mark Shannon" -msgstr "" +msgstr "Irit Katriel, Mark Shannon" -#: ../../whatsnew/3.11.rst:1481 msgid "Store subscript" -msgstr "" +msgstr "添字による代入" -#: ../../whatsnew/3.11.rst:1481 msgid "``a[i] = z``" -msgstr "" +msgstr "``a[i] = z``" -#: ../../whatsnew/3.11.rst:1481 msgid "Similar to subscripting specialization above." -msgstr "" +msgstr "上の添字アクセスの特殊化と同様です。" -#: ../../whatsnew/3.11.rst:1481 msgid "Dennis Sweeney" -msgstr "" +msgstr "Dennis Sweeney" #: ../../whatsnew/3.11.rst:1484 msgid "Calls" msgstr "呼び出し (call)" -#: ../../whatsnew/3.11.rst:1484 msgid "``f(arg)``" -msgstr "" +msgstr "``f(arg)``" -#: ../../whatsnew/3.11.rst:1486 msgid "``C(arg)``" -msgstr "" +msgstr "``C(arg)``" -#: ../../whatsnew/3.11.rst:1484 msgid "" "Calls to common builtin (C) functions and types such as :func:`len` and :" "class:`str` directly call their underlying C version. This avoids going " "through the internal calling convention." msgstr "" +":func:`len` や :class:`str` など、よく使う組み込みの C 関数や型を呼び出す際" +"は、内部の呼び出し規約を経由せず、対応する C の実装を直接呼び出します。" -#: ../../whatsnew/3.11.rst:1484 msgid "20%" -msgstr "" +msgstr "20%" -#: ../../whatsnew/3.11.rst:1484 msgid "Mark Shannon, Ken Jin" -msgstr "" +msgstr "Mark Shannon, Ken Jin" -#: ../../whatsnew/3.11.rst:1489 msgid "Load global variable" -msgstr "" +msgstr "グローバル変数の読み込み" -#: ../../whatsnew/3.11.rst:1489 msgid "``print``" -msgstr "" +msgstr "``print``" -#: ../../whatsnew/3.11.rst:1491 msgid "``len``" -msgstr "" +msgstr "``len``" -#: ../../whatsnew/3.11.rst:1489 msgid "" "The object's index in the globals/builtins namespace is cached. Loading " "globals and builtins require zero namespace lookups." msgstr "" +"globals/builtins 名前空間内でのオブジェクトのインデックスをキャッシュしま" +"す。\n" +"グローバル変数や組み込みの名前を読み込む際、名前空間を検索する必要がなくなり" +"ます。" -#: ../../whatsnew/3.11.rst:1489 msgid "[#load-global]_" -msgstr "" +msgstr "[#load-global]_" -#: ../../whatsnew/3.11.rst:1489 ../../whatsnew/3.11.rst:1493 -#: ../../whatsnew/3.11.rst:1502 msgid "Mark Shannon" -msgstr "" +msgstr "Mark Shannon" -#: ../../whatsnew/3.11.rst:1493 msgid "Load attribute" -msgstr "" +msgstr "属性の読み込み" -#: ../../whatsnew/3.11.rst:1493 msgid "``o.attr``" -msgstr "" +msgstr "``o.attr``" -#: ../../whatsnew/3.11.rst:1493 msgid "" "Similar to loading global variables. The attribute's index inside the class/" "object's namespace is cached. In most cases, attribute loading will require " "zero namespace lookups." msgstr "" +"グローバル変数の読み込みと同様に、クラスやオブジェクトの名前空間内での属性の" +"インデックスをキャッシュします。\n" +"ほとんどの場合、属性の読み込み時に名前空間を検索する必要がなくなります。" -#: ../../whatsnew/3.11.rst:1493 msgid "[#load-attr]_" -msgstr "" +msgstr "[#load-attr]_" -#: ../../whatsnew/3.11.rst:1498 msgid "Load methods for call" -msgstr "" +msgstr "呼び出すメソッドの読み込み" -#: ../../whatsnew/3.11.rst:1498 msgid "``o.meth()``" -msgstr "" +msgstr "``o.meth()``" -#: ../../whatsnew/3.11.rst:1498 msgid "" "The actual address of the method is cached. Method loading now has no " "namespace lookups -- even for classes with long inheritance chains." msgstr "" +"メソッドの実際のアドレスをキャッシュします。\n" +"継承の連鎖が長いクラスでも、メソッドの読み込み時に名前空間を検索する必要がな" +"くなります。" -#: ../../whatsnew/3.11.rst:1498 msgid "10-20%" -msgstr "" +msgstr "10-20%" -#: ../../whatsnew/3.11.rst:1498 msgid "Ken Jin, Mark Shannon" -msgstr "" +msgstr "Ken Jin, Mark Shannon" -#: ../../whatsnew/3.11.rst:1502 msgid "Store attribute" -msgstr "" +msgstr "属性への代入" -#: ../../whatsnew/3.11.rst:1502 msgid "``o.attr = z``" -msgstr "" +msgstr "``o.attr = z``" -#: ../../whatsnew/3.11.rst:1502 msgid "Similar to load attribute optimization." -msgstr "" +msgstr "属性の読み込みの最適化と同様です。" -#: ../../whatsnew/3.11.rst:1502 msgid "2% in pyperformance" -msgstr "" +msgstr "pyperformance で 2%" -#: ../../whatsnew/3.11.rst:1505 msgid "Unpack Sequence" -msgstr "" +msgstr "シーケンスのアンパック" -#: ../../whatsnew/3.11.rst:1505 msgid "``*seq``" -msgstr "" +msgstr "``*seq``" -#: ../../whatsnew/3.11.rst:1505 msgid "" "Specialized for common containers such as :class:`list` and :class:`tuple`. " "Avoids internal calling convention." msgstr "" +":class:`list` や :class:`tuple` など、よく使うコンテナに特殊化し、内部の呼び" +"出し規約を経由しないようにします。" -#: ../../whatsnew/3.11.rst:1505 msgid "8%" -msgstr "" +msgstr "8%" -#: ../../whatsnew/3.11.rst:1505 msgid "Brandt Bucher" -msgstr "" +msgstr "Brandt Bucher" -#: ../../whatsnew/3.11.rst:1510 msgid "" "A similar optimization already existed since Python 3.8. 3.11 specializes " "for more forms and reduces some overhead." msgstr "" +"同様の最適化は Python 3.8 から存在していました。\n" +"3.11 では、より多くの形式に特殊化し、一部のオーバーヘッドも削減しています。" -#: ../../whatsnew/3.11.rst:1513 msgid "" "A similar optimization already existed since Python 3.10. 3.11 specializes " "for more forms. Furthermore, all attribute loads should be sped up by :issue:" "`45947`." msgstr "" +"同様の最適化は Python 3.10 から存在していました。\n" +"3.11 では、より多くの形式に特殊化します。\n" +"さらに、:issue:`45947` により、すべての属性の読み込みが高速化すると見込まれま" +"す。" -#: ../../whatsnew/3.11.rst:1521 msgid "Misc" -msgstr "" +msgstr "その他" -#: ../../whatsnew/3.11.rst:1523 msgid "" "Objects now require less memory due to lazily created object namespaces. " "Their namespace dictionaries now also share keys more freely. (Contributed " "Mark Shannon in :issue:`45340` and :issue:`40116`.)" msgstr "" +"オブジェクトの名前空間を必要時に作成することで、オブジェクトに必要なメモリが" +"減りました。\n" +"名前空間の辞書は、より多くの場合にキーを共有するようにもなりました。\n" +"(Mark Shannon による :issue:`45340` と :issue:`40116` での貢献。)" -#: ../../whatsnew/3.11.rst:1527 msgid "" "\"Zero-cost\" exceptions are implemented, eliminating the cost of :keyword:" "`try` statements when no exception is raised. (Contributed by Mark Shannon " "in :issue:`40222`.)" msgstr "" +"「ゼロコスト」の例外が実装され、例外が送出されない場合の :keyword:`try` 文の" +"コストがなくなりました。\n" +"(Mark Shannon による :issue:`40222` での貢献。)" -#: ../../whatsnew/3.11.rst:1531 msgid "" "A more concise representation of exceptions in the interpreter reduced the " "time required for catching an exception by about 10%. (Contributed by Irit " "Katriel in :issue:`45711`.)" msgstr "" +"インタープリタ内部の例外の表現を簡素化したことで、例外の捕捉にかかる時間が約 " +"10% 短くなりました。\n" +"(Irit Katriel による :issue:`45711` での貢献。)" -#: ../../whatsnew/3.11.rst:1535 msgid "" ":mod:`re`'s regular expression matching engine has been partially " "refactored, and now uses computed gotos (or \"threaded code\") on supported " @@ -2242,77 +2734,94 @@ msgid "" "html#regex-dna>`_ up to 10% faster than Python 3.10. (Contributed by Brandt " "Bucher in :gh:`91404`.)" msgstr "" +":mod:`re` の正規表現照合エンジンが一部リファクタリングされ、対応するプラット" +"フォームでは計算型 goto (または「スレッデッドコード」) を使うようになりまし" +"た。\n" +"その結果、Python 3.11 は Python 3.10 よりも `pyperformance の正規表現ベンチ" +"マーク `_ を" +"最大 10% 高速に実行します。\n" +"(Brandt Bucher による :gh:`91404` での貢献。)" -#: ../../whatsnew/3.11.rst:1546 msgid "FAQ" -msgstr "" +msgstr "よくある質問" -#: ../../whatsnew/3.11.rst:1551 msgid "How should I write my code to utilize these speedups?" -msgstr "" +msgstr "この高速化を活用するには、コードをどのように書けばよいですか?" -#: ../../whatsnew/3.11.rst:1553 msgid "" "Write Pythonic code that follows common best practices; you don't have to " "change your code. The Faster CPython project optimizes for common code " "patterns we observe." msgstr "" +"一般的なベストプラクティスに従って Python らしいコードを書いてください。\n" +"既存のコードを変更する必要はありません。\n" +"Faster CPython プロジェクトは、よく見られるコードのパターンを最適化します。" -#: ../../whatsnew/3.11.rst:1561 msgid "Will CPython 3.11 use more memory?" -msgstr "" +msgstr "CPython 3.11 は、より多くのメモリを使いますか?" -#: ../../whatsnew/3.11.rst:1563 msgid "" "Maybe not; we don't expect memory use to exceed 20% higher than 3.10. This " "is offset by memory optimizations for frame objects and object dictionaries " "as mentioned above." msgstr "" +"そうとは限りません。\n" +"3.10 と比べたメモリ使用量の増加は 20% を超えないと見込んでいます。\n" +"この増加は、前述のフレームオブジェクトやオブジェクトの辞書のメモリ最適化に" +"よって相殺されます。" -#: ../../whatsnew/3.11.rst:1571 msgid "I don't see any speedups in my workload. Why?" msgstr "" +"自分の処理では高速化が見られません。\n" +"なぜですか?" -#: ../../whatsnew/3.11.rst:1573 msgid "" "Certain code won't have noticeable benefits. If your code spends most of its " "time on I/O operations, or already does most of its computation in a C " "extension library like NumPy, there won't be significant speedups. This " "project currently benefits pure-Python workloads the most." msgstr "" +"コードによっては、目立った効果が得られません。\n" +"大部分の時間を I/O に費やしている場合や、NumPy のような C 拡張ライブラリです" +"でに計算の大半を行っている場合は、大きな高速化はありません。\n" +"現時点では、純粋な Python の処理に最も効果があります。" -#: ../../whatsnew/3.11.rst:1578 msgid "" "Furthermore, the pyperformance figures are a geometric mean. Even within the " "pyperformance benchmarks, certain benchmarks have slowed down slightly, " "while others have sped up by nearly 2x!" msgstr "" +"また、pyperformance の数値は幾何平均です。\n" +"pyperformance のベンチマークの中でも、少し遅くなったものもあれば、ほぼ 2 倍速" +"くなったものもあります。" -#: ../../whatsnew/3.11.rst:1586 msgid "Is there a JIT compiler?" -msgstr "" +msgstr "JIT コンパイラーはありますか?" -#: ../../whatsnew/3.11.rst:1588 msgid "No. We're still exploring other optimizations." msgstr "" +"ありません。\n" +"まだ、ほかの最適化を検討している段階です。" -#: ../../whatsnew/3.11.rst:1594 msgid "About" -msgstr "" +msgstr "プロジェクトについて" -#: ../../whatsnew/3.11.rst:1596 msgid "" "Faster CPython explores optimizations for :term:`CPython`. The main team is " "funded by Microsoft to work on this full-time. Pablo Galindo Salgado is also " "funded by Bloomberg LP to work on the project part-time. Finally, many " "contributors are volunteers from the community." msgstr "" +"Faster CPython は :term:`CPython` の最適化を探求しています。\n" +"主なチームは Microsoft の資金援助により、フルタイムで取り組んでいます。\n" +"Pablo Galindo Salgado も Bloomberg LP の資金援助により、パートタイムでプロ" +"ジェクトに取り組んでいます。\n" +"また、多くの貢献者はコミュニティのボランティアです。" #: ../../whatsnew/3.11.rst:1605 msgid "CPython bytecode changes" msgstr "CPython バイトコードの変更" -#: ../../whatsnew/3.11.rst:1607 msgid "" "The bytecode now contains inline cache entries, which take the form of the " "newly-added :opcode:`CACHE` instructions. Many opcodes expect to be followed " @@ -2321,258 +2830,240 @@ msgid "" "care should be taken when reading or modifying raw, adaptive bytecode " "containing quickened data." msgstr "" +"バイトコードに、新しい :opcode:`CACHE` 命令の形式でインラインキャッシュエント" +"リーが含まれるようになりました。\n" +"多くのオペコードは、直後に決まった個数のキャッシュが続くことを前提とし、実行" +"時にはインタープリタにそれらを飛ばさせます。\n" +"値を格納したキャッシュは任意の命令に見えることがあるため、高速化用のデータを" +"含む適応型バイトコードを直接読み取ったり変更したりする際は、十分注意する必要" +"があります。" -#: ../../whatsnew/3.11.rst:1619 msgid "New opcodes" -msgstr "" +msgstr "新しいオペコード" -#: ../../whatsnew/3.11.rst:1621 msgid "" ":opcode:`!ASYNC_GEN_WRAP`, :opcode:`RETURN_GENERATOR` and :opcode:`SEND`, " "used in generators and co-routines." msgstr "" +"ジェネレーターやコルーチンで使う :opcode:`!ASYNC_GEN_WRAP`、:opcode:" +"`RETURN_GENERATOR`、:opcode:`SEND`。" -#: ../../whatsnew/3.11.rst:1624 msgid "" ":opcode:`COPY_FREE_VARS`, which avoids needing special caller-side code for " "closures." msgstr "" +"クロージャーの呼び出し元に特別なコードが不要になる :opcode:`COPY_FREE_VARS`。" -#: ../../whatsnew/3.11.rst:1627 msgid "" ":opcode:`JUMP_BACKWARD_NO_INTERRUPT`, for use in certain loops where " "handling interrupts is undesirable." msgstr "" +"割り込みの処理が望ましくない特定のループで使う :opcode:" +"`JUMP_BACKWARD_NO_INTERRUPT`。" -#: ../../whatsnew/3.11.rst:1630 msgid ":opcode:`MAKE_CELL`, to create :ref:`cell-objects`." -msgstr "" +msgstr ":ref:`cell-objects` を作成する :opcode:`MAKE_CELL`。" -#: ../../whatsnew/3.11.rst:1632 msgid "" ":opcode:`CHECK_EG_MATCH` and :opcode:`!PREP_RERAISE_STAR`, to handle the :" "ref:`new exception groups and except* ` added in :pep:" "`654`." msgstr "" +":pep:`654` で追加された :ref:`新しい例外グループと except* ` を処理する :opcode:`CHECK_EG_MATCH` と :opcode:`!" +"PREP_RERAISE_STAR`。" -#: ../../whatsnew/3.11.rst:1636 msgid ":opcode:`PUSH_EXC_INFO`, for use in exception handlers." -msgstr "" +msgstr "例外ハンドラーで使う :opcode:`PUSH_EXC_INFO`。" -#: ../../whatsnew/3.11.rst:1638 msgid "" ":opcode:`RESUME`, a no-op, for internal tracing, debugging and optimization " "checks." msgstr "" +"内部のトレース、デバッグ、最適化の検査に使う、何も操作しない命令 :opcode:" +"`RESUME`。" -#: ../../whatsnew/3.11.rst:1645 msgid "Replaced opcodes" -msgstr "" +msgstr "置き換えられたオペコード" -#: ../../whatsnew/3.11.rst:1648 msgid "Replaced Opcode(s)" -msgstr "" +msgstr "置換前のオペコード" -#: ../../whatsnew/3.11.rst:1648 msgid "New Opcode(s)" -msgstr "" +msgstr "新しいオペコード" #: ../../whatsnew/3.11.rst:1648 msgid "Notes" msgstr "注釈" -#: ../../whatsnew/3.11.rst:0 msgid ":opcode:`!BINARY_*`" -msgstr "" +msgstr ":opcode:`!BINARY_*`" -#: ../../whatsnew/3.11.rst:0 msgid ":opcode:`!INPLACE_*`" -msgstr "" +msgstr ":opcode:`!INPLACE_*`" -#: ../../whatsnew/3.11.rst:1650 msgid ":opcode:`BINARY_OP`" -msgstr "" +msgstr ":opcode:`BINARY_OP`" -#: ../../whatsnew/3.11.rst:1650 msgid "Replaced all numeric binary/in-place opcodes with a single opcode" msgstr "" +"数値の二項演算とインプレース演算のオペコードを、すべて単一のオペコードに置き" +"換えました" -#: ../../whatsnew/3.11.rst:0 msgid ":opcode:`!CALL_FUNCTION`" -msgstr "" +msgstr ":opcode:`!CALL_FUNCTION`" -#: ../../whatsnew/3.11.rst:0 msgid ":opcode:`!CALL_FUNCTION_KW`" -msgstr "" +msgstr ":opcode:`!CALL_FUNCTION_KW`" -#: ../../whatsnew/3.11.rst:0 msgid ":opcode:`!CALL_METHOD`" -msgstr "" +msgstr ":opcode:`!CALL_METHOD`" -#: ../../whatsnew/3.11.rst:0 msgid ":opcode:`CALL`" -msgstr "" +msgstr ":opcode:`CALL`" -#: ../../whatsnew/3.11.rst:0 msgid ":opcode:`!KW_NAMES`" -msgstr "" +msgstr ":opcode:`!KW_NAMES`" -#: ../../whatsnew/3.11.rst:0 msgid ":opcode:`!PRECALL`" -msgstr "" +msgstr ":opcode:`!PRECALL`" -#: ../../whatsnew/3.11.rst:0 msgid ":opcode:`PUSH_NULL`" -msgstr "" +msgstr ":opcode:`PUSH_NULL`" -#: ../../whatsnew/3.11.rst:1653 msgid "" "Decouples argument shifting for methods from handling of keyword arguments; " "allows better specialization of calls" msgstr "" +"メソッド呼び出しの引数の移動と、キーワード引数の処理を切り離し、呼び出しをよ" +"り適切に特殊化できるようにします" -#: ../../whatsnew/3.11.rst:0 msgid ":opcode:`!DUP_TOP`" -msgstr "" +msgstr ":opcode:`!DUP_TOP`" -#: ../../whatsnew/3.11.rst:0 msgid ":opcode:`!DUP_TOP_TWO`" -msgstr "" +msgstr ":opcode:`!DUP_TOP_TWO`" -#: ../../whatsnew/3.11.rst:0 msgid ":opcode:`!ROT_TWO`" -msgstr "" +msgstr ":opcode:`!ROT_TWO`" -#: ../../whatsnew/3.11.rst:0 msgid ":opcode:`!ROT_THREE`" -msgstr "" +msgstr ":opcode:`!ROT_THREE`" -#: ../../whatsnew/3.11.rst:0 msgid ":opcode:`!ROT_FOUR`" -msgstr "" +msgstr ":opcode:`!ROT_FOUR`" -#: ../../whatsnew/3.11.rst:0 msgid ":opcode:`!ROT_N`" -msgstr "" +msgstr ":opcode:`!ROT_N`" -#: ../../whatsnew/3.11.rst:0 msgid ":opcode:`COPY`" -msgstr "" +msgstr ":opcode:`COPY`" -#: ../../whatsnew/3.11.rst:0 msgid ":opcode:`SWAP`" -msgstr "" +msgstr ":opcode:`SWAP`" -#: ../../whatsnew/3.11.rst:1658 msgid "Stack manipulation instructions" -msgstr "" +msgstr "スタックを操作する命令" -#: ../../whatsnew/3.11.rst:0 msgid ":opcode:`!JUMP_IF_NOT_EXC_MATCH`" -msgstr "" +msgstr ":opcode:`!JUMP_IF_NOT_EXC_MATCH`" -#: ../../whatsnew/3.11.rst:0 msgid ":opcode:`CHECK_EXC_MATCH`" -msgstr "" +msgstr ":opcode:`CHECK_EXC_MATCH`" -#: ../../whatsnew/3.11.rst:1665 msgid "Now performs check but doesn't jump" -msgstr "" +msgstr "検査だけを行い、ジャンプしなくなりました" -#: ../../whatsnew/3.11.rst:0 msgid ":opcode:`!JUMP_ABSOLUTE`" -msgstr "" +msgstr ":opcode:`!JUMP_ABSOLUTE`" -#: ../../whatsnew/3.11.rst:0 msgid ":opcode:`!POP_JUMP_IF_FALSE`" -msgstr "" +msgstr ":opcode:`!POP_JUMP_IF_FALSE`" -#: ../../whatsnew/3.11.rst:0 msgid ":opcode:`!POP_JUMP_IF_TRUE`" -msgstr "" +msgstr ":opcode:`!POP_JUMP_IF_TRUE`" -#: ../../whatsnew/3.11.rst:0 msgid ":opcode:`JUMP_BACKWARD`" -msgstr "" +msgstr ":opcode:`JUMP_BACKWARD`" -#: ../../whatsnew/3.11.rst:0 msgid ":opcode:`!POP_JUMP_BACKWARD_IF_*`" -msgstr "" +msgstr ":opcode:`!POP_JUMP_BACKWARD_IF_*`" -#: ../../whatsnew/3.11.rst:0 msgid ":opcode:`!POP_JUMP_FORWARD_IF_*`" -msgstr "" +msgstr ":opcode:`!POP_JUMP_FORWARD_IF_*`" -#: ../../whatsnew/3.11.rst:1667 msgid "" "See [#bytecode-jump]_; ``TRUE``, ``FALSE``, ``NONE`` and ``NOT_NONE`` " "variants for each direction" msgstr "" +"[#bytecode-jump]_ を参照。\n" +"各方向について ``TRUE``、``FALSE``、``NONE``、``NOT_NONE`` の種類があります" -#: ../../whatsnew/3.11.rst:0 msgid ":opcode:`!SETUP_WITH`" -msgstr "" +msgstr ":opcode:`!SETUP_WITH`" -#: ../../whatsnew/3.11.rst:0 msgid ":opcode:`!SETUP_ASYNC_WITH`" -msgstr "" +msgstr ":opcode:`!SETUP_ASYNC_WITH`" -#: ../../whatsnew/3.11.rst:1673 msgid ":opcode:`!BEFORE_WITH`" -msgstr "" +msgstr ":opcode:`!BEFORE_WITH`" -#: ../../whatsnew/3.11.rst:1673 msgid ":keyword:`with` block setup" -msgstr "" +msgstr ":keyword:`with` ブロックの準備" -#: ../../whatsnew/3.11.rst:1677 msgid "" "All jump opcodes are now relative, including the existing :opcode:`!" "JUMP_IF_TRUE_OR_POP` and :opcode:`!JUMP_IF_FALSE_OR_POP`. The argument is " "now an offset from the current instruction rather than an absolute location." msgstr "" +"既存の :opcode:`!JUMP_IF_TRUE_OR_POP` と :opcode:`!JUMP_IF_FALSE_OR_POP` を含" +"め、すべてのジャンプオペコードが相対ジャンプになりました。\n" +"引数は、絶対位置ではなく現在の命令からのオフセットです。" -#: ../../whatsnew/3.11.rst:1688 msgid "Changed/removed opcodes" -msgstr "" +msgstr "変更・削除されたオペコード" -#: ../../whatsnew/3.11.rst:1690 msgid "" "Changed :opcode:`MATCH_CLASS` and :opcode:`MATCH_KEYS` to no longer push an " "additional boolean value to indicate success/failure. Instead, ``None`` is " "pushed on failure in place of the tuple of extracted values." msgstr "" +":opcode:`MATCH_CLASS` と :opcode:`MATCH_KEYS` は、成功や失敗を示す追加のブー" +"ル値をプッシュしなくなりました。\n" +"代わりに、失敗時には取り出した値のタプルではなく ``None`` をプッシュします。" -#: ../../whatsnew/3.11.rst:1695 msgid "" "Changed opcodes that work with exceptions to reflect them now being " "represented as one item on the stack instead of three (see :gh:`89874`)." msgstr "" +"例外を扱うオペコードが、スタック上の例外の表現が 3 項目から 1 項目になったこ" +"とに合わせて変更されました (:gh:`89874` を参照)。" -#: ../../whatsnew/3.11.rst:1699 msgid "" "Removed :opcode:`!COPY_DICT_WITHOUT_KEYS`, :opcode:`!GEN_START`, :opcode:`!" "POP_BLOCK`, :opcode:`!SETUP_FINALLY` and :opcode:`!YIELD_FROM`." msgstr "" +":opcode:`!COPY_DICT_WITHOUT_KEYS`、:opcode:`!GEN_START`、:opcode:`!" +"POP_BLOCK`、:opcode:`!SETUP_FINALLY`、:opcode:`!YIELD_FROM` が削除されまし" +"た。" #: ../../whatsnew/3.11.rst:1707 ../../whatsnew/3.11.rst:2580 msgid "Deprecated" msgstr "非推奨" -#: ../../whatsnew/3.11.rst:1709 msgid "" "This section lists Python APIs that have been deprecated in Python 3.11." -msgstr "" +msgstr "この節では、Python 3.11 で非推奨となった Python API を挙げます。" -#: ../../whatsnew/3.11.rst:1711 msgid "" "Deprecated C APIs are :ref:`listed separately `." msgstr "" +"非推奨の C API は :ref:`別の節に記載しています `。" -#: ../../whatsnew/3.11.rst:1718 msgid "Language/Builtins" -msgstr "" +msgstr "言語と組み込み機能" #: ../../whatsnew/3.11.rst:1720 msgid "" @@ -2584,15 +3075,18 @@ msgid "" "3.10. (Contributed by Raymond Hettinger in :gh:`89519`.)" msgstr "" -#: ../../whatsnew/3.11.rst:1728 msgid "" "Octal escapes in string and bytes literals with values larger than ``0o377`` " "(255 in decimal) now produce a :exc:`DeprecationWarning`. In a future Python " "version, they will raise a :exc:`SyntaxWarning` and eventually a :exc:" "`SyntaxError`. (Contributed by Serhiy Storchaka in :gh:`81548`.)" msgstr "" +"文字列リテラルや bytes リテラルの 8 進エスケープの値が ``0o377`` (10 進数で " +"255) を超えると、:exc:`DeprecationWarning` が出るようになりました。\n" +"将来の Python では :exc:`SyntaxWarning`、最終的には :exc:`SyntaxError` になり" +"ます。\n" +"(Serhiy Storchaka による :gh:`81548` での貢献。)" -#: ../../whatsnew/3.11.rst:1734 msgid "" "The delegation of :func:`int` to :meth:`~object.__trunc__` is now " "deprecated. Calling ``int(a)`` when ``type(a)`` implements :meth:`!" @@ -2600,149 +3094,142 @@ msgid "" "raises a :exc:`DeprecationWarning`. (Contributed by Zackery Spytz in :issue:" "`44977`.)" msgstr "" +":func:`int` が :meth:`~object.__trunc__` に処理を委ねることが非推奨になりまし" +"た。\n" +"``type(a)`` が :meth:`!__trunc__` を実装していても、:meth:`~object.__int__` " +"や :meth:`~object.__index__` を実装していない場合、``int(a)`` を呼び出すと :" +"exc:`DeprecationWarning` が出るようになりました。\n" +"(Zackery Spytz による :issue:`44977` での貢献。)" #: ../../whatsnew/3.11.rst:1744 msgid "Modules" msgstr "モジュール" -#: ../../whatsnew/3.11.rst:1748 msgid "" ":pep:`594` led to the deprecations of the following modules slated for " "removal in Python 3.13:" msgstr "" +":pep:`594` により、Python 3.13 で削除予定の次のモジュールが非推奨になりまし" +"た。" -#: ../../whatsnew/3.11.rst:1752 msgid ":mod:`!aifc`" -msgstr "" +msgstr ":mod:`!aifc`" -#: ../../whatsnew/3.11.rst:1752 msgid ":mod:`!chunk`" -msgstr "" +msgstr ":mod:`!chunk`" -#: ../../whatsnew/3.11.rst:1752 msgid ":mod:`!msilib`" -msgstr "" +msgstr ":mod:`!msilib`" -#: ../../whatsnew/3.11.rst:1752 msgid ":mod:`!pipes`" -msgstr "" +msgstr ":mod:`!pipes`" -#: ../../whatsnew/3.11.rst:1752 msgid ":mod:`!telnetlib`" -msgstr "" +msgstr ":mod:`!telnetlib`" -#: ../../whatsnew/3.11.rst:1754 msgid ":mod:`!audioop`" -msgstr "" +msgstr ":mod:`!audioop`" -#: ../../whatsnew/3.11.rst:1754 msgid ":mod:`!crypt`" -msgstr "" +msgstr ":mod:`!crypt`" -#: ../../whatsnew/3.11.rst:1754 msgid ":mod:`!nis`" -msgstr "" +msgstr ":mod:`!nis`" -#: ../../whatsnew/3.11.rst:1754 msgid ":mod:`!sndhdr`" -msgstr "" +msgstr ":mod:`!sndhdr`" -#: ../../whatsnew/3.11.rst:1754 msgid ":mod:`!uu`" -msgstr "" +msgstr ":mod:`!uu`" -#: ../../whatsnew/3.11.rst:1756 msgid ":mod:`!cgi`" -msgstr "" +msgstr ":mod:`!cgi`" -#: ../../whatsnew/3.11.rst:1756 msgid ":mod:`!imghdr`" -msgstr "" +msgstr ":mod:`!imghdr`" -#: ../../whatsnew/3.11.rst:1756 msgid ":mod:`!nntplib`" -msgstr "" +msgstr ":mod:`!nntplib`" -#: ../../whatsnew/3.11.rst:1756 msgid ":mod:`!spwd`" -msgstr "" +msgstr ":mod:`!spwd`" -#: ../../whatsnew/3.11.rst:1756 msgid ":mod:`!xdrlib`" -msgstr "" +msgstr ":mod:`!xdrlib`" -#: ../../whatsnew/3.11.rst:1758 msgid ":mod:`!cgitb`" -msgstr "" +msgstr ":mod:`!cgitb`" -#: ../../whatsnew/3.11.rst:1758 msgid ":mod:`!mailcap`" -msgstr "" +msgstr ":mod:`!mailcap`" -#: ../../whatsnew/3.11.rst:1758 msgid ":mod:`!ossaudiodev`" -msgstr "" +msgstr ":mod:`!ossaudiodev`" -#: ../../whatsnew/3.11.rst:1758 msgid ":mod:`!sunau`" -msgstr "" +msgstr ":mod:`!sunau`" -#: ../../whatsnew/3.11.rst:1761 msgid "" "(Contributed by Brett Cannon in :issue:`47061` and Victor Stinner in :gh:" "`68966`.)" msgstr "" +"(Brett Cannon による :issue:`47061` and Victor Stinner in :gh:`68966` での貢" +"献。)" -#: ../../whatsnew/3.11.rst:1764 msgid "" "The :mod:`!asynchat`, :mod:`!asyncore` and :mod:`!smtpd` modules have been " "deprecated since at least Python 3.6. Their documentation and deprecation " "warnings have now been updated to note they will be removed in Python 3.12. " "(Contributed by Hugo van Kemenade in :issue:`47022`.)" msgstr "" +":mod:`!asynchat`、:mod:`!asyncore`、:mod:`!smtpd` は、遅くとも Python 3.6 か" +"ら非推奨となっています。\n" +"ドキュメントと非推奨の警告が更新され、Python 3.12 で削除されることが明記され" +"ました。\n" +"(Hugo van Kemenade による :issue:`47022` での貢献。)" -#: ../../whatsnew/3.11.rst:1769 msgid "" "The :mod:`!lib2to3` package and ``2to3`` tool are now deprecated and may not " "be able to parse Python 3.10 or newer. See :pep:`617`, introducing the new " "PEG parser, for details. (Contributed by Victor Stinner in :issue:`40360`.)" msgstr "" +":mod:`!lib2to3` パッケージと ``2to3`` ツールが非推奨になりました。\n" +"Python 3.10 以降のコードを解析できない場合があります。\n" +"詳しくは、新しい PEG パーサーを導入した :pep:`617` を参照してください。\n" +"(Victor Stinner による :issue:`40360` での貢献。)" -#: ../../whatsnew/3.11.rst:1774 msgid "" "Undocumented modules :mod:`!sre_compile`, :mod:`!sre_constants` and :mod:`!" "sre_parse` are now deprecated. (Contributed by Serhiy Storchaka in :issue:" "`47152`.)" msgstr "" +"非公開のモジュール :mod:`!sre_compile`、:mod:`!sre_constants`、:mod:`!" +"sre_parse` が非推奨になりました。\n" +"(Serhiy Storchaka による :issue:`47152` での貢献。)" -#: ../../whatsnew/3.11.rst:1782 msgid "Standard Library" -msgstr "" +msgstr "標準ライブラリ" -#: ../../whatsnew/3.11.rst:1784 msgid "" "The following have been deprecated in :mod:`configparser` since Python 3.2. " "Their deprecation warnings have now been updated to note they will be " "removed in Python 3.12:" msgstr "" +":mod:`configparser` の次の機能は Python 3.2 から非推奨となっています。\n" +"非推奨の警告が更新され、Python 3.12 で削除されることが明記されました。" -#: ../../whatsnew/3.11.rst:1788 msgid "the :class:`!configparser.SafeConfigParser` class" -msgstr "" +msgstr ":class:`!configparser.SafeConfigParser` クラス" -#: ../../whatsnew/3.11.rst:1789 msgid "the :attr:`!configparser.ParsingError.filename` property" -msgstr "" +msgstr ":attr:`!configparser.ParsingError.filename` プロパティ" -#: ../../whatsnew/3.11.rst:1790 msgid "the :meth:`!configparser.RawConfigParser.readfp` method" -msgstr "" +msgstr ":meth:`!configparser.RawConfigParser.readfp` メソッド" -#: ../../whatsnew/3.11.rst:1792 msgid "(Contributed by Hugo van Kemenade in :issue:`45173`.)" -msgstr "" +msgstr "(Hugo van Kemenade による :issue:`45173` での貢献。)" -#: ../../whatsnew/3.11.rst:1794 msgid "" ":class:`!configparser.LegacyInterpolation` has been deprecated in the " "docstring since Python 3.2, and is not listed in the :mod:`configparser` " @@ -2751,59 +3238,68 @@ msgid "" "`configparser.ExtendedInterpolation` instead. (Contributed by Hugo van " "Kemenade in :issue:`46607`.)" msgstr "" +":class:`!configparser.LegacyInterpolation` は Python 3.2 から docstring で非" +"推奨とされ、:mod:`configparser` のドキュメントにも記載されていません。\n" +"今回から :exc:`DeprecationWarning` を出すようになり、Python 3.13 で削除されま" +"す。\n" +"代わりに :class:`configparser.BasicInterpolation` または :class:" +"`configparser.ExtendedInterpolation` を使ってください。\n" +"(Hugo van Kemenade による :issue:`46607` での貢献。)" -#: ../../whatsnew/3.11.rst:1801 msgid "" "The older set of :mod:`importlib.resources` functions were deprecated in " "favor of the replacements added in Python 3.9 and will be removed in a " "future Python version, due to not supporting resources located within " "package subdirectories:" msgstr "" +":mod:`importlib.resources` の従来の関数は、パッケージのサブディレクトリ内にあ" +"るリソースに対応していないため、Python 3.9 で追加された代替の機能を推奨する形" +"で非推奨になりました。\n" +"将来の Python で削除されます。" -#: ../../whatsnew/3.11.rst:1806 msgid ":func:`!importlib.resources.contents`" -msgstr "" +msgstr ":func:`!importlib.resources.contents`" -#: ../../whatsnew/3.11.rst:1807 msgid ":func:`!importlib.resources.is_resource`" -msgstr "" +msgstr ":func:`!importlib.resources.is_resource`" -#: ../../whatsnew/3.11.rst:1808 msgid ":func:`!importlib.resources.open_binary`" -msgstr "" +msgstr ":func:`!importlib.resources.open_binary`" -#: ../../whatsnew/3.11.rst:1809 msgid ":func:`!importlib.resources.open_text`" -msgstr "" +msgstr ":func:`!importlib.resources.open_text`" -#: ../../whatsnew/3.11.rst:1810 msgid ":func:`!importlib.resources.read_binary`" -msgstr "" +msgstr ":func:`!importlib.resources.read_binary`" -#: ../../whatsnew/3.11.rst:1811 msgid ":func:`!importlib.resources.read_text`" -msgstr "" +msgstr ":func:`!importlib.resources.read_text`" -#: ../../whatsnew/3.11.rst:1812 msgid ":func:`!importlib.resources.path`" -msgstr "" +msgstr ":func:`!importlib.resources.path`" -#: ../../whatsnew/3.11.rst:1814 msgid "" "The :func:`locale.getdefaultlocale` function is deprecated and will be " "removed in Python 3.15. Use :func:`locale.setlocale`, :func:`locale." "getpreferredencoding(False) ` and :func:`locale." "getlocale` functions instead. (Contributed by Victor Stinner in :gh:`90817`.)" msgstr "" +":func:`locale.getdefaultlocale` 関数が非推奨になりました。\n" +"Python 3.15 で削除されます。\n" +"代わりに :func:`locale.setlocale`、:func:`locale.getpreferredencoding(False) " +"`、:func:`locale.getlocale` を使ってください。\n" +"(Victor Stinner による :gh:`90817` での貢献。)" -#: ../../whatsnew/3.11.rst:1820 msgid "" "The :func:`!locale.resetlocale` function is deprecated and will be removed " "in Python 3.13. Use ``locale.setlocale(locale.LC_ALL, \"\")`` instead. " "(Contributed by Victor Stinner in :gh:`90817`.)" msgstr "" +":func:`!locale.resetlocale` 関数が非推奨になりました。\n" +"Python 3.13 で削除されます。\n" +"代わりに ``locale.setlocale(locale.LC_ALL, \"\")`` を使ってください。\n" +"(Victor Stinner による :gh:`90817` での貢献。)" -#: ../../whatsnew/3.11.rst:1824 msgid "" "Stricter rules will now be applied for numerical group references and group " "names in :ref:`regular expressions `. Only sequences of ASCII " @@ -2813,8 +3309,14 @@ msgid "" "for syntax violating these rules. (Contributed by Serhiy Storchaka in :gh:" "`91760`.)" msgstr "" +":ref:`正規表現 ` の番号によるグループ参照とグループ名に、より厳密" +"な規則が適用されるようになりました。\n" +"番号による参照には ASCII の数字の並びだけを使えます。\n" +":class:`bytes` パターンと置換文字列のグループ名に使えるのは、ASCII の英字、数" +"字、アンダースコアだけです。\n" +"現時点では、これらの規則に違反する構文に対して非推奨の警告が出ます。\n" +"(Serhiy Storchaka による :gh:`91760` での貢献。)" -#: ../../whatsnew/3.11.rst:1832 msgid "" "In the :mod:`re` module, the :func:`!re.template` function and the " "corresponding :const:`!re.TEMPLATE` and :const:`!re.T` flags are deprecated, " @@ -2822,8 +3324,12 @@ msgid "" "removed in Python 3.13. (Contributed by Serhiy Storchaka and Miro Hrončok " "in :gh:`92728`.)" msgstr "" +":mod:`re` モジュールの :func:`!re.template` 関数と、対応する :const:`!re." +"TEMPLATE` および :const:`!re.T` フラグが非推奨になりました。\n" +"文書化されておらず、用途も明確でなかったためです。\n" +"Python 3.13 で削除されます。\n" +"(Serhiy Storchaka and Miro Hrončok による :gh:`92728` での貢献。)" -#: ../../whatsnew/3.11.rst:1838 msgid "" ":func:`!turtle.settiltangle` has been deprecated since Python 3.1; it now " "emits a deprecation warning and will be removed in Python 3.13. Use :func:" @@ -2831,179 +3337,173 @@ msgid "" "and its docstring is now corrected). (Contributed by Hugo van Kemenade in :" "issue:`45837`.)" msgstr "" +":func:`!turtle.settiltangle` は Python 3.1 から非推奨となっています。\n" +"今回から非推奨の警告を出すようになり、Python 3.13 で削除されます。\n" +"代わりに :func:`turtle.tiltangle` を使ってください (以前は誤って非推奨と記載" +"されていましたが、docstring を訂正しました)。\n" +"(Hugo van Kemenade による :issue:`45837` での貢献。)" -#: ../../whatsnew/3.11.rst:1844 msgid "" ":class:`typing.Text`, which exists solely to provide compatibility support " "between Python 2 and Python 3 code, is now deprecated. Its removal is " "currently unplanned, but users are encouraged to use :class:`str` instead " "wherever possible. (Contributed by Alex Waygood in :gh:`92332`.)" msgstr "" +"Python 2 と Python 3 のコードの互換性のためだけに存在していた :class:`typing." +"Text` が非推奨になりました。\n" +"現時点で削除の予定はありませんが、可能な場合は代わりに :class:`str` を使うこ" +"とを推奨します。\n" +"(Alex Waygood による :gh:`92332` での貢献。)" -#: ../../whatsnew/3.11.rst:1850 msgid "" "The keyword argument syntax for constructing :data:`typing.TypedDict` types " "is now deprecated. Support will be removed in Python 3.13. (Contributed by " "Jingchen Ye in :gh:`90224`.)" msgstr "" +"キーワード引数の構文で :data:`typing.TypedDict` 型を作成することが非推奨にな" +"りました。\n" +"Python 3.13 でサポートが削除されます。\n" +"(Jingchen Ye による :gh:`90224` での貢献。)" -#: ../../whatsnew/3.11.rst:1854 msgid "" ":class:`!webbrowser.MacOSX` is deprecated and will be removed in Python " "3.13. It is untested, undocumented, and not used by :mod:`webbrowser` " "itself. (Contributed by Donghee Na in :issue:`42255`.)" msgstr "" +":class:`!webbrowser.MacOSX` が非推奨になりました。\n" +"Python 3.13 で削除されます。\n" +"テストも文書化もされておらず、:mod:`webbrowser` 自体も使っていません。\n" +"(Donghee Na による :issue:`42255` での貢献。)" -#: ../../whatsnew/3.11.rst:1858 msgid "" "The behavior of returning a value from a :class:`~unittest.TestCase` and :" "class:`~unittest.IsolatedAsyncioTestCase` test methods (other than the " "default ``None`` value) is now deprecated." msgstr "" +":class:`~unittest.TestCase` と :class:`~unittest.IsolatedAsyncioTestCase` の" +"テストメソッドから、デフォルトの ``None`` 以外の値を返すことが非推奨になりま" +"した。" -#: ../../whatsnew/3.11.rst:1862 msgid "" "Deprecated the following not-formally-documented :mod:`unittest` functions, " "scheduled for removal in Python 3.13:" msgstr "" +"正式には文書化されていない以下の :mod:`unittest` 関数が非推奨となり、Python " +"3.13 で削除される予定です。" -#: ../../whatsnew/3.11.rst:1865 msgid ":func:`!unittest.findTestCases`" -msgstr "" +msgstr ":func:`!unittest.findTestCases`" -#: ../../whatsnew/3.11.rst:1866 msgid ":func:`!unittest.makeSuite`" -msgstr "" +msgstr ":func:`!unittest.makeSuite`" -#: ../../whatsnew/3.11.rst:1867 msgid ":func:`!unittest.getTestCaseNames`" -msgstr "" +msgstr ":func:`!unittest.getTestCaseNames`" -#: ../../whatsnew/3.11.rst:1869 msgid "Use :class:`~unittest.TestLoader` methods instead:" -msgstr "" +msgstr "代わりに :class:`~unittest.TestLoader` のメソッドを使ってください。" -#: ../../whatsnew/3.11.rst:1871 msgid ":meth:`unittest.TestLoader.loadTestsFromModule`" -msgstr "" +msgstr ":meth:`unittest.TestLoader.loadTestsFromModule`" -#: ../../whatsnew/3.11.rst:1872 msgid ":meth:`unittest.TestLoader.loadTestsFromTestCase`" -msgstr "" +msgstr ":meth:`unittest.TestLoader.loadTestsFromTestCase`" -#: ../../whatsnew/3.11.rst:1873 msgid ":meth:`unittest.TestLoader.getTestCaseNames`" -msgstr "" +msgstr ":meth:`unittest.TestLoader.getTestCaseNames`" -#: ../../whatsnew/3.11.rst:1875 msgid "(Contributed by Erlend E. Aasland in :issue:`5846`.)" -msgstr "" +msgstr "(Erlend E. Aasland による :issue:`5846` での貢献。)" -#: ../../whatsnew/3.11.rst:1877 msgid "" ":meth:`!unittest.TestProgram.usageExit` is marked deprecated, to be removed " "in 3.13. (Contributed by Carlos Damázio in :gh:`67048`.)" msgstr "" +":meth:`!unittest.TestProgram.usageExit` が非推奨となり、3.13 で削除される予定" +"です。\n" +"(Carlos Damázio による :gh:`67048` での貢献。)" -#: ../../whatsnew/3.11.rst:1886 ../../whatsnew/3.11.rst:2608 msgid "Pending Removal in Python 3.12" -msgstr "" +msgstr "Python 3.12 で削除予定" -#: ../../whatsnew/3.11.rst:1888 msgid "" "The following Python APIs have been deprecated in earlier Python releases, " "and will be removed in Python 3.12." msgstr "" +"以下の Python API は以前の Python リリースで非推奨となっており、Python 3.12 " +"で削除される予定です。" -#: ../../whatsnew/3.11.rst:1891 msgid "" "C APIs pending removal are :ref:`listed separately `." msgstr "" +"削除予定の C API は :ref:`別にまとめています `。" -#: ../../whatsnew/3.11.rst:1894 msgid "The :mod:`!asynchat` module" -msgstr "" +msgstr ":mod:`!asynchat` モジュール" -#: ../../whatsnew/3.11.rst:1895 msgid "The :mod:`!asyncore` module" -msgstr "" +msgstr ":mod:`!asyncore` モジュール" -#: ../../whatsnew/3.11.rst:1896 msgid "The :ref:`entire distutils package `" -msgstr "" +msgstr ":ref:`distutils パッケージ全体 `" -#: ../../whatsnew/3.11.rst:1897 msgid "The :mod:`!imp` module" -msgstr "" +msgstr ":mod:`!imp` モジュール" -#: ../../whatsnew/3.11.rst:1898 msgid "The :class:`typing.io ` namespace" -msgstr "" +msgstr ":class:`typing.io ` 名前空間" -#: ../../whatsnew/3.11.rst:1899 msgid "The :class:`typing.re ` namespace" -msgstr "" +msgstr ":class:`typing.re ` 名前空間" -#: ../../whatsnew/3.11.rst:1900 msgid ":func:`!cgi.log`" -msgstr "" +msgstr ":func:`!cgi.log`" -#: ../../whatsnew/3.11.rst:1901 msgid ":func:`!importlib.find_loader`" -msgstr "" +msgstr ":func:`!importlib.find_loader`" -#: ../../whatsnew/3.11.rst:1902 msgid ":meth:`!importlib.abc.Loader.module_repr`" -msgstr "" +msgstr ":meth:`!importlib.abc.Loader.module_repr`" -#: ../../whatsnew/3.11.rst:1903 msgid ":meth:`!importlib.abc.MetaPathFinder.find_module`" -msgstr "" +msgstr ":meth:`!importlib.abc.MetaPathFinder.find_module`" -#: ../../whatsnew/3.11.rst:1904 msgid ":meth:`!importlib.abc.PathEntryFinder.find_loader`" -msgstr "" +msgstr ":meth:`!importlib.abc.PathEntryFinder.find_loader`" -#: ../../whatsnew/3.11.rst:1905 msgid ":meth:`!importlib.abc.PathEntryFinder.find_module`" -msgstr "" +msgstr ":meth:`!importlib.abc.PathEntryFinder.find_module`" -#: ../../whatsnew/3.11.rst:1906 msgid ":meth:`!importlib.machinery.BuiltinImporter.find_module`" -msgstr "" +msgstr ":meth:`!importlib.machinery.BuiltinImporter.find_module`" #: ../../whatsnew/3.11.rst:1907 msgid ":meth:`!importlib.machinery.BuiltinLoader.module_repr`" msgstr "" -#: ../../whatsnew/3.11.rst:1908 msgid ":meth:`!importlib.machinery.FileFinder.find_loader`" -msgstr "" +msgstr ":meth:`!importlib.machinery.FileFinder.find_loader`" -#: ../../whatsnew/3.11.rst:1909 msgid ":meth:`!importlib.machinery.FileFinder.find_module`" -msgstr "" +msgstr ":meth:`!importlib.machinery.FileFinder.find_module`" -#: ../../whatsnew/3.11.rst:1910 msgid ":meth:`!importlib.machinery.FrozenImporter.find_module`" -msgstr "" +msgstr ":meth:`!importlib.machinery.FrozenImporter.find_module`" #: ../../whatsnew/3.11.rst:1911 msgid ":meth:`!importlib.machinery.FrozenLoader.module_repr`" msgstr "" -#: ../../whatsnew/3.11.rst:1912 msgid ":meth:`!importlib.machinery.PathFinder.find_module`" -msgstr "" +msgstr ":meth:`!importlib.machinery.PathFinder.find_module`" -#: ../../whatsnew/3.11.rst:1913 msgid ":meth:`!importlib.machinery.WindowsRegistryFinder.find_module`" -msgstr "" +msgstr ":meth:`!importlib.machinery.WindowsRegistryFinder.find_module`" -#: ../../whatsnew/3.11.rst:1914 msgid ":func:`!importlib.util.module_for_loader`" -msgstr "" +msgstr ":func:`!importlib.util.module_for_loader`" #: ../../whatsnew/3.11.rst:1915 msgid ":func:`!importlib.util.set_loader_wrapper`" @@ -3013,33 +3513,26 @@ msgstr "" msgid ":func:`!importlib.util.set_package_wrapper`" msgstr "" -#: ../../whatsnew/3.11.rst:1917 msgid ":class:`!pkgutil.ImpImporter`" -msgstr "" +msgstr ":class:`!pkgutil.ImpImporter`" -#: ../../whatsnew/3.11.rst:1918 msgid ":class:`!pkgutil.ImpLoader`" -msgstr "" +msgstr ":class:`!pkgutil.ImpLoader`" -#: ../../whatsnew/3.11.rst:1919 msgid ":meth:`!pathlib.Path.link_to`" -msgstr "" +msgstr ":meth:`!pathlib.Path.link_to`" -#: ../../whatsnew/3.11.rst:1920 msgid ":func:`!sqlite3.enable_shared_cache`" -msgstr "" +msgstr ":func:`!sqlite3.enable_shared_cache`" -#: ../../whatsnew/3.11.rst:1921 msgid ":func:`!sqlite3.OptimizedUnicode`" -msgstr "" +msgstr ":func:`!sqlite3.OptimizedUnicode`" -#: ../../whatsnew/3.11.rst:1922 msgid ":envvar:`!PYTHONTHREADDEBUG` environment variable" -msgstr "" +msgstr ":envvar:`!PYTHONTHREADDEBUG` 環境変数" -#: ../../whatsnew/3.11.rst:1923 msgid "The following deprecated aliases in :mod:`unittest`:" -msgstr "" +msgstr ":mod:`unittest` の以下の非推奨エイリアス。" #: ../../whatsnew/3.11.rst:1926 msgid "Deprecated alias" @@ -3175,16 +3668,14 @@ msgstr "3.5" msgid "Removed" msgstr "削除" -#: ../../whatsnew/3.11.rst:1951 msgid "This section lists Python APIs that have been removed in Python 3.11." -msgstr "" +msgstr "この節では Python 3.11 で削除された Python API をまとめています。" -#: ../../whatsnew/3.11.rst:1953 msgid "" "Removed C APIs are :ref:`listed separately `." msgstr "" +"削除された C API は :ref:`別にまとめています `。" -#: ../../whatsnew/3.11.rst:1955 msgid "" "Removed the :func:`!@asyncio.coroutine` :term:`decorator` enabling legacy " "generator-based coroutines to be compatible with :keyword:`async` / :keyword:" @@ -3192,15 +3683,23 @@ msgid "" "removal was initially scheduled for Python 3.10. Use :keyword:`async def` " "instead. (Contributed by Illia Volochii in :issue:`43216`.)" msgstr "" +"従来のジェネレータベースのコルーチンを :keyword:`async` / :keyword:`await` " +"コードと組み合わせて使えるようにする :func:`!@asyncio.coroutine` :term:" +"`decorator` が削除されました。\n" +"この関数は Python 3.8 から非推奨となっており、当初は Python 3.10 で削除される" +"予定でした。\n" +"代わりに :keyword:`async def` を使ってください。\n" +"(Illia Volochii による :issue:`43216` での貢献。)" -#: ../../whatsnew/3.11.rst:1962 msgid "" "Removed :class:`!asyncio.coroutines.CoroWrapper` used for wrapping legacy " "generator-based coroutine objects in the debug mode. (Contributed by Illia " "Volochii in :issue:`43216`.)" msgstr "" +"デバッグモードで従来のジェネレータベースのコルーチンオブジェクトをラップす" +"る :class:`!asyncio.coroutines.CoroWrapper` が削除されました。\n" +"(Illia Volochii による :issue:`43216` での貢献。)" -#: ../../whatsnew/3.11.rst:1966 msgid "" "Due to significant security concerns, the *reuse_address* parameter of :meth:" "`asyncio.loop.create_datagram_endpoint`, disabled in Python 3.9, is now " @@ -3208,53 +3707,59 @@ msgid "" "``SO_REUSEADDR`` in UDP. (Contributed by Hugo van Kemenade in :issue:" "`45129`.)" msgstr "" +"重大なセキュリティ上の懸念により、Python 3.9 で無効化された :meth:`asyncio." +"loop.create_datagram_endpoint` の *reuse_address* 引数が完全に削除されまし" +"た。\n" +"これは UDP におけるソケットオプション ``SO_REUSEADDR`` の動作が原因です。\n" +"(Hugo van Kemenade による :issue:`45129` での貢献。)" -#: ../../whatsnew/3.11.rst:1972 msgid "" "Removed the :mod:`!binhex` module, deprecated in Python 3.9. Also removed " "the related, similarly-deprecated :mod:`binascii` functions:" msgstr "" +"Python 3.9 で非推奨となった :mod:`!binhex` モジュールが削除されました。\n" +"これに関連する以下の :mod:`binascii` 関数も、同様に非推奨となっていたため削除" +"されました。" -#: ../../whatsnew/3.11.rst:1975 msgid ":func:`!binascii.a2b_hqx`" -msgstr "" +msgstr ":func:`!binascii.a2b_hqx`" -#: ../../whatsnew/3.11.rst:1976 msgid ":func:`!binascii.b2a_hqx`" -msgstr "" +msgstr ":func:`!binascii.b2a_hqx`" -#: ../../whatsnew/3.11.rst:1977 msgid ":func:`!binascii.rlecode_hqx`" -msgstr "" +msgstr ":func:`!binascii.rlecode_hqx`" -#: ../../whatsnew/3.11.rst:1978 msgid ":func:`!binascii.rldecode_hqx`" -msgstr "" +msgstr ":func:`!binascii.rldecode_hqx`" -#: ../../whatsnew/3.11.rst:1980 msgid "The :func:`binascii.crc_hqx` function remains available." -msgstr "" +msgstr ":func:`binascii.crc_hqx` 関数は引き続き利用できます。" -#: ../../whatsnew/3.11.rst:1982 msgid "(Contributed by Victor Stinner in :issue:`45085`.)" -msgstr "" +msgstr "(Victor Stinner による :issue:`45085` での貢献。)" -#: ../../whatsnew/3.11.rst:1984 msgid "" "Removed the :mod:`!distutils` ``bdist_msi`` command deprecated in Python " "3.9. Use ``bdist_wheel`` (wheel packages) instead. (Contributed by Hugo van " "Kemenade in :issue:`45124`.)" msgstr "" +"Python 3.9 で非推奨となった :mod:`!distutils` の ``bdist_msi`` コマンドが削除" +"されました。\n" +"代わりに ``bdist_wheel`` (wheel パッケージ) を使ってください。\n" +"(Hugo van Kemenade による :issue:`45124` での貢献。)" -#: ../../whatsnew/3.11.rst:1988 msgid "" "Removed the :meth:`~object.__getitem__` methods of :class:`xml.dom.pulldom." "DOMEventStream`, :class:`wsgiref.util.FileWrapper` and :class:`fileinput." "FileInput`, deprecated since Python 3.9. (Contributed by Hugo van Kemenade " "in :issue:`45132`.)" msgstr "" +"Python 3.9 から非推奨となっていた :class:`xml.dom.pulldom.DOMEventStream`、:" +"class:`wsgiref.util.FileWrapper`、:class:`fileinput.FileInput` の :meth:" +"`~object.__getitem__` メソッドが削除されました。\n" +"(Hugo van Kemenade による :issue:`45132` での貢献。)" -#: ../../whatsnew/3.11.rst:1993 msgid "" "Removed the deprecated :mod:`gettext` functions :func:`!lgettext`, :func:`!" "ldgettext`, :func:`!lngettext` and :func:`!ldngettext`. Also removed the :" @@ -3264,63 +3769,84 @@ msgid "" "since they are only used for the :func:`!l*gettext` functions. (Contributed " "by Donghee Na and Serhiy Storchaka in :issue:`44235`.)" msgstr "" +":mod:`gettext` の非推奨関数 :func:`!lgettext`、:func:`!ldgettext`、:func:`!" +"lngettext`、:func:`!ldngettext` が削除されました。\n" +"また、:func:`!l*gettext` 関数でしか使われていないため、:func:`!" +"bind_textdomain_codeset` 関数、:meth:`!NullTranslations.output_charset` と :" +"meth:`!NullTranslations.set_output_charset` メソッド、:func:`!translation` " +"と :func:`!install` の *codeset* 引数も削除されました。\n" +"(Donghee Na and Serhiy Storchaka による :issue:`44235` での貢献。)" -#: ../../whatsnew/3.11.rst:2003 msgid "Removed from the :mod:`inspect` module:" -msgstr "" +msgstr ":mod:`inspect` モジュールから以下が削除されました。" -#: ../../whatsnew/3.11.rst:2005 msgid "" "The :func:`!getargspec` function, deprecated since Python 3.0; use :func:" "`inspect.signature` or :func:`inspect.getfullargspec` instead." msgstr "" +"Python 3.0 から非推奨となっていた :func:`!getargspec` 関数。\n" +"代わりに :func:`inspect.signature` または :func:`inspect.getfullargspec` を" +"使ってください。" -#: ../../whatsnew/3.11.rst:2008 msgid "" "The :func:`!formatargspec` function, deprecated since Python 3.5; use the :" "func:`inspect.signature` function or the :class:`inspect.Signature` object " "directly." msgstr "" +"Python 3.5 から非推奨となっていた :func:`!formatargspec` 関数。\n" +":func:`inspect.signature` 関数または :class:`inspect.Signature` オブジェクト" +"を直接使ってください。" -#: ../../whatsnew/3.11.rst:2012 msgid "" "The undocumented :meth:`!Signature.from_builtin` and :meth:`!Signature." "from_function` methods, deprecated since Python 3.5; use the :meth:" "`Signature.from_callable() ` method instead." msgstr "" +"Python 3.5 から非推奨となっていた、文書化されていない :meth:`!Signature." +"from_builtin` と :meth:`!Signature.from_function` メソッド。\n" +"代わりに :meth:`Signature.from_callable() ` " +"メソッドを使ってください。" -#: ../../whatsnew/3.11.rst:2017 msgid "(Contributed by Hugo van Kemenade in :issue:`45320`.)" -msgstr "" +msgstr "(Hugo van Kemenade による :issue:`45320` での貢献。)" -#: ../../whatsnew/3.11.rst:2019 msgid "" "Removed the :meth:`~object.__class_getitem__` method from :class:`pathlib." "PurePath`, because it was not used and added by mistake in previous " "versions. (Contributed by Nikita Sobolev in :issue:`46483`.)" msgstr "" +":class:`pathlib.PurePath` の :meth:`~object.__class_getitem__` メソッドが削除" +"されました。\n" +"これは以前のバージョンで誤って追加され、使われていませんでした。\n" +"(Nikita Sobolev による :issue:`46483` での貢献。)" -#: ../../whatsnew/3.11.rst:2024 msgid "" "Removed the :class:`!MailmanProxy` class in the :mod:`!smtpd` module, as it " "is unusable without the external :mod:`!mailman` package. (Contributed by " "Donghee Na in :issue:`35800`.)" msgstr "" +"外部の :mod:`!mailman` パッケージなしでは使えないため、:mod:`!smtpd` モジュー" +"ルの :class:`!MailmanProxy` クラスが削除されました。\n" +"(Donghee Na による :issue:`35800` での貢献。)" -#: ../../whatsnew/3.11.rst:2028 msgid "" "Removed the deprecated :meth:`!split` method of :class:`!_tkinter." "TkappType`. (Contributed by Erlend E. Aasland in :issue:`38371`.)" msgstr "" +":class:`!_tkinter.TkappType` の非推奨の :meth:`!split` メソッドが削除されまし" +"た。\n" +"(Erlend E. Aasland による :issue:`38371` での貢献。)" -#: ../../whatsnew/3.11.rst:2031 msgid "" "Removed namespace package support from :mod:`unittest` discovery. It was " "introduced in Python 3.4 but has been broken since Python 3.7. (Contributed " "by Inada Naoki in :issue:`23882`.)" msgstr "" +":mod:`unittest` のテストディスカバリで名前空間パッケージのサポートが削除され" +"ました。\n" +"この機能は Python 3.4 で導入されましたが、Python 3.7 以降は壊れていました。\n" +"(Inada Naoki による :issue:`23882` での貢献。)" -#: ../../whatsnew/3.11.rst:2035 msgid "" "Removed the undocumented private :meth:`!float.__set_format__` method, " "previously known as :meth:`!float.__setformat__` in Python 3.7. Its " @@ -3328,38 +3854,48 @@ msgid "" "mainly to be used in Python's test suite.\" (Contributed by Victor Stinner " "in :issue:`46852`.)" msgstr "" +"文書化されていない非公開の :meth:`!float.__set_format__` メソッド (Python " +"3.7 では :meth:`!float.__setformat__` という名前でした) が削除されました。\n" +"その docstring には「おそらくこの関数を使う必要はありません。\n" +"主に Python のテストスイートで使うために存在しています」と書かれていまし" +"た。\n" +"(Victor Stinner による :issue:`46852` での貢献。)" -#: ../../whatsnew/3.11.rst:2041 msgid "" "The :option:`!--experimental-isolated-subinterpreters` configure flag (and " "corresponding :c:macro:`!EXPERIMENTAL_ISOLATED_SUBINTERPRETERS` macro) have " "been removed." msgstr "" +"configure フラグ :option:`!--experimental-isolated-subinterpreters` (および対" +"応する :c:macro:`!EXPERIMENTAL_ISOLATED_SUBINTERPRETERS` マクロ) が削除されま" +"した。" -#: ../../whatsnew/3.11.rst:2045 msgid "" ":pypi:`Pynche` --- The Pythonically Natural Color and Hue Editor --- has " "been moved out of ``Tools/scripts`` and is `being developed independently " "`_ from the Python source tree." msgstr "" +":pypi:`Pynche` (The Pythonically Natural Color and Hue Editor) が ``Tools/" +"scripts`` から移動し、Python のソースツリーとは `独立して開発されるようになり" +"ました `_。" -#: ../../whatsnew/3.11.rst:2055 ../../whatsnew/3.11.rst:2277 msgid "Porting to Python 3.11" -msgstr "" +msgstr "Python 3.11 への移植" -#: ../../whatsnew/3.11.rst:2057 msgid "" "This section lists previously described changes and other bugfixes in the " "Python API that may require changes to your Python code." msgstr "" +"この節では、これまでに説明した変更やその他の Python API のバグ修正のうち、" +"Python コードの変更が必要になる可能性のあるものをまとめています。" -#: ../../whatsnew/3.11.rst:2060 msgid "" "Porting notes for the C API are :ref:`listed separately `." msgstr "" +"C API の移植に関する注意点は :ref:`別にまとめています `。" -#: ../../whatsnew/3.11.rst:2063 msgid "" ":func:`open`, :func:`io.open`, :func:`codecs.open` and :class:`fileinput." "FileInput` no longer accept ``'U'`` (\"universal newline\") in the file " @@ -3369,38 +3905,58 @@ msgid "" "functions controls how universal newlines work. (Contributed by Victor " "Stinner in :issue:`37330`.)" msgstr "" +":func:`open`、:func:`io.open`、:func:`codecs.open`、:class:`fileinput." +"FileInput` のファイルモードに ``'U'`` (「ユニバーサル改行」) を指定できなくな" +"りました。\n" +"Python 3 ではテキストモードでファイルを開くと、デフォルトで「ユニバーサル改" +"行」モードになり、``'U'`` フラグは Python 3.3 から非推奨となっていました。\n" +"これらの関数の :ref:`newline 引数 ` でユニバーサル改" +"行の動作を制御できます。\n" +"(Victor Stinner による :issue:`37330` での貢献。)" -#: ../../whatsnew/3.11.rst:2072 msgid "" ":class:`ast.AST` node positions are now validated when provided to :func:" "`compile` and other related functions. If invalid positions are detected, a :" "exc:`ValueError` will be raised. (Contributed by Pablo Galindo in :gh:" "`93351`)" msgstr "" +":func:`compile` や関連する関数に渡された :class:`ast.AST` ノードの位置情報が" +"検証されるようになりました。\n" +"不正な位置情報が検出されると :exc:`ValueError` が送出されます。\n" +"(Pablo Galindo による :gh:`93351` での貢献。)" -#: ../../whatsnew/3.11.rst:2076 msgid "" "Prohibited passing non-:class:`concurrent.futures.ThreadPoolExecutor` " "executors to :meth:`asyncio.loop.set_default_executor` following a " "deprecation in Python 3.8. (Contributed by Illia Volochii in :issue:`43234`.)" msgstr "" +"Python 3.8 での非推奨化を経て、:meth:`asyncio.loop.set_default_executor` に :" +"class:`concurrent.futures.ThreadPoolExecutor` 以外の executor を渡すことが禁" +"止されました。\n" +"(Illia Volochii による :issue:`43234` での貢献。)" -#: ../../whatsnew/3.11.rst:2081 msgid "" ":mod:`calendar`: The :class:`calendar.LocaleTextCalendar` and :class:" "`calendar.LocaleHTMLCalendar` classes now use :func:`locale.getlocale`, " "instead of using :func:`locale.getdefaultlocale`, if no locale is specified. " "(Contributed by Victor Stinner in :issue:`46659`.)" msgstr "" +":mod:`calendar`: :class:`calendar.LocaleTextCalendar` と :class:`calendar." +"LocaleHTMLCalendar` は、ロケールが指定されていない場合に :func:`locale." +"getdefaultlocale` の代わりに :func:`locale.getlocale` を使うようになりまし" +"た。\n" +"(Victor Stinner による :issue:`46659` での貢献。)" -#: ../../whatsnew/3.11.rst:2087 msgid "" "The :mod:`pdb` module now reads the :file:`.pdbrc` configuration file with " "the ``'UTF-8'`` encoding. (Contributed by Srinivas Reddy Thatiparthy (శ్రీనివాస్ " "రెడ్డి తాటిపర్తి) in :issue:`41137`.)" msgstr "" +":mod:`pdb` モジュールが :file:`.pdbrc` 設定ファイルを ``'UTF-8'`` エンコー" +"ディングで読み込むようになりました。\n" +"(Srinivas Reddy Thatiparthy (శ్రీనివాస్ రెడ్డి తాటిపర్తి) による :issue:`41137` での貢" +"献。)" -#: ../../whatsnew/3.11.rst:2091 msgid "" "The *population* parameter of :func:`random.sample` must be a sequence, and " "automatic conversion of :class:`set`\\s to :class:`list`\\s is no longer " @@ -3408,6 +3964,11 @@ msgid "" "exc:`ValueError` is raised. (Contributed by Raymond Hettinger in :issue:" "`40465`.)" msgstr "" +":func:`random.sample` の *population* 引数はシーケンスでなければならず、:" +"class:`set` から :class:`list` への自動変換はサポートされなくなりました。\n" +"また、標本のサイズが母集団のサイズより大きい場合は :exc:`ValueError` が送出さ" +"れます。\n" +"(Raymond Hettinger による :issue:`40465` での貢献。)" #: ../../whatsnew/3.11.rst:2097 msgid "" @@ -3416,27 +3977,31 @@ msgid "" "func:`random.random` (its previous default) will always be used." msgstr "" -#: ../../whatsnew/3.11.rst:2101 msgid "" "In :mod:`re` :ref:`re-syntax`, global inline flags (e.g. ``(?i)``) can now " "only be used at the start of regular expressions. Using them elsewhere has " "been deprecated since Python 3.6. (Contributed by Serhiy Storchaka in :issue:" "`47066`.)" msgstr "" +":mod:`re` の :ref:`re-syntax` で、グローバルなインラインフラグ (例えば ``(?" +"i)``) を使えるのは正規表現の先頭だけになりました。\n" +"それ以外の位置で使うことは Python 3.6 から非推奨となっていました。\n" +"(Serhiy Storchaka による :issue:`47066` での貢献。)" -#: ../../whatsnew/3.11.rst:2106 msgid "" "In the :mod:`re` module, several long-standing bugs where fixed that, in " "rare cases, could cause capture groups to get the wrong result. Therefore, " "this could change the captured output in these cases. (Contributed by Ma Lin " "in :issue:`35859`.)" msgstr "" +":mod:`re` モジュールで、まれにキャプチャグループの結果が誤る原因となっていた" +"長年のバグがいくつか修正されました。\n" +"そのため、該当する場合にはキャプチャ結果が変わる可能性があります。\n" +"(Ma Lin による :issue:`35859` での貢献。)" -#: ../../whatsnew/3.11.rst:2115 msgid "Build Changes" -msgstr "" +msgstr "ビルドの変更" -#: ../../whatsnew/3.11.rst:2117 msgid "" "CPython now has :pep:`11` :pep:`Tier 3 support <11#tier-3>` for cross " "compiling to the `WebAssembly `_ platforms " @@ -3450,12 +4015,23 @@ msgid "" "and Ethan Smith in :gh:`84461` and WASI contributed by Christian Heimes in :" "gh:`90473`; platforms promoted in :gh:`95085`)" msgstr "" +"CPython が、`WebAssembly `_ プラットフォームの " +"`Emscripten `_ (``wasm32-unknown-emscripten``、すな" +"わちブラウザー上の Python) と `WebAssembly System Interface (WASI) `_ (``wasm32-unknown-wasi``) へのクロスコンパイルを、:pep:`11` の :" +"pep:`Tier 3 サポート <11#tier-3>` として提供するようになりました。\n" +"この取り組みは `Pyodide `_ などの先行する取り組みに着想" +"を得ています。\n" +"これらのプラットフォームが提供する POSIX API は限られており、ネットワーク、プ" +"ロセス、スレッド、シグナル、mmap、ユーザーやグループに関連する Python 標準ラ" +"イブラリの機能やモジュールは利用できないか、動作しません。\n" +"(Emscripten は Christian Heimes と Ethan Smith による :gh:`84461` での貢献、" +"WASI は Christian Heimes による :gh:`90473` での貢献。\n" +":gh:`95085` でプラットフォームのサポート段階が引き上げられました。)" -#: ../../whatsnew/3.11.rst:2131 msgid "Building CPython now requires:" -msgstr "" +msgstr "CPython のビルドに以下が必要になりました。" -#: ../../whatsnew/3.11.rst:2133 msgid "" "A `C11 `_ compiler and standard library. " "`Optional C11 features `_ コンパイラと標準ライブラリ。\n" +"`C11 の省略可能な機能 `_ は必要ありません。\n" +"(Victor Stinner による :issue:`46656`, :issue:`45440` and :issue:`46640` での" +"貢献。)" -#: ../../whatsnew/3.11.rst:2140 msgid "" "Support for `IEEE 754 `_ floating-" "point numbers. (Contributed by Victor Stinner in :issue:`46917`.)" msgstr "" +"`IEEE 754 `_ 浮動小数点数のサポー" +"ト。\n" +"(Victor Stinner による :issue:`46917` での貢献。)" -#: ../../whatsnew/3.11.rst:2144 msgid "" "The :c:macro:`!Py_NO_NAN` macro has been removed. Since CPython now requires " "IEEE 754 floats, NaN values are always available. (Contributed by Victor " "Stinner in :issue:`46656`.)" msgstr "" +":c:macro:`!Py_NO_NAN` マクロが削除されました。\n" +"CPython で IEEE 754 浮動小数点数が必須になったため、NaN 値は常に利用できま" +"す。\n" +"(Victor Stinner による :issue:`46656` での貢献。)" -#: ../../whatsnew/3.11.rst:2148 msgid "" "The :mod:`tkinter` package now requires `Tcl/Tk `_ " "version 8.5.12 or newer. (Contributed by Serhiy Storchaka in :issue:`46996`.)" msgstr "" +":mod:`tkinter` パッケージに `Tcl/Tk `_ 8.5.12 以降が必要" +"になりました。\n" +"(Serhiy Storchaka による :issue:`46996` での貢献。)" -#: ../../whatsnew/3.11.rst:2152 msgid "" "Build dependencies, compiler flags, and linker flags for most stdlib " "extension modules are now detected by :program:`configure`. libffi, libnsl, " @@ -3494,29 +4081,44 @@ msgid "" "(Contributed by Christian Heimes and Erlend Egeberg Aasland in :issue:" "`45847`, :issue:`45747`, and :issue:`45763`.)" msgstr "" +"標準ライブラリのほとんどの拡張モジュールについて、ビルド依存関係、コンパイラ" +"フラグ、リンカフラグを :program:`configure` が検出するようになりました。\n" +"libffi、libnsl、libsqlite3、zlib、bzip2、liblzma、libcrypt、Tcl/Tk、uuid のフ" +"ラグは、利用可能であれば `pkg-config `_ で検出します。\n" +":mod:`tkinter` では `Tcl/Tk`_ のヘッダーとライブラリの開発用設定を検出するた" +"めに pkg-config コマンドが必要になりました。\n" +"(Christian Heimes and Erlend Egeberg Aasland による :issue:`45847`, :issue:" +"`45747`, and :issue:`45763` での貢献。)" -#: ../../whatsnew/3.11.rst:2162 msgid "" "libpython is no longer linked against libcrypt. (Contributed by Mike Gilbert " "in :issue:`45433`.)" msgstr "" +"libpython が libcrypt にリンクされなくなりました。\n" +"(Mike Gilbert による :issue:`45433` での貢献。)" -#: ../../whatsnew/3.11.rst:2165 msgid "" "CPython can now be built with the `ThinLTO `_ option via passing ``thin`` to :option:`--with-lto`, i.e. " "``--with-lto=thin``. (Contributed by Donghee Na and Brett Holman in :issue:" "`44340`.)" msgstr "" +":option:`--with-lto` に ``thin`` を渡す (``--with-lto=thin`` と指定する) と、" +"`ThinLTO `_ オプションを使って " +"CPython をビルドできるようになりました。\n" +"(Donghee Na and Brett Holman による :issue:`44340` での貢献。)" -#: ../../whatsnew/3.11.rst:2170 msgid "" "Freelists for object structs can now be disabled. A new :program:`configure` " "option ``--without-freelists`` can be used to disable all freelists except " "empty tuple singleton. (Contributed by Christian Heimes in :issue:`45522`.)" msgstr "" +"オブジェクト構造体のフリーリストを無効にできるようになりました。\n" +"新しい :program:`configure` オプション ``--without-freelists`` を使うと、空の" +"タプルのシングルトンを除くすべてのフリーリストを無効にできます。\n" +"(Christian Heimes による :issue:`45522` での貢献。)" -#: ../../whatsnew/3.11.rst:2175 msgid "" "``Modules/Setup`` and ``Modules/makesetup`` have been improved and tied up. " "Extension modules can now be built through ``makesetup``. All except some " @@ -3524,24 +4126,36 @@ msgid "" "(Contributed by Brett Cannon and Christian Heimes in :issue:`45548`, :issue:" "`45570`, :issue:`45571`, and :issue:`43974`.)" msgstr "" +"``Modules/Setup`` と ``Modules/makesetup`` が改善され、整理されました。\n" +"``makesetup`` で拡張モジュールをビルドできるようになりました。\n" +"一部のテストモジュールを除き、すべてのモジュールをメインのバイナリまたはライ" +"ブラリに静的リンクできます。\n" +"(Brett Cannon and Christian Heimes による :issue:`45548`, :issue:`45570`, :" +"issue:`45571`, and :issue:`43974` での貢献。)" -#: ../../whatsnew/3.11.rst:2182 msgid "" "Use the environment variables :envvar:`!TCLTK_CFLAGS` and :envvar:`!" "TCLTK_LIBS` to manually specify the location of Tcl/Tk headers and " "libraries. The :program:`configure` options :option:`!--with-tcltk-includes` " "and :option:`!--with-tcltk-libs` have been removed." msgstr "" +"Tcl/Tk のヘッダーとライブラリの場所を手動で指定するには、環境変数 :envvar:`!" +"TCLTK_CFLAGS` と :envvar:`!TCLTK_LIBS` を使ってください。\n" +":program:`configure` の :option:`!--with-tcltk-includes` と :option:`!--with-" +"tcltk-libs` オプションは削除されました。" -#: ../../whatsnew/3.11.rst:2188 msgid "" "On RHEL 7 and CentOS 7 the development packages do not provide ``tcl.pc`` " "and ``tk.pc``; use ``TCLTK_LIBS=\"-ltk8.5 -ltkstub8.5 -ltcl8.5\"``. The " "directory ``Misc/rhel7`` contains ``.pc`` files and instructions on how to " "build Python with RHEL 7's and CentOS 7's Tcl/Tk and OpenSSL." msgstr "" +"RHEL 7 と CentOS 7 の開発用パッケージには ``tcl.pc`` と ``tk.pc`` が含まれて" +"いないため、``TCLTK_LIBS=\"-ltk8.5 -ltkstub8.5 -ltcl8.5\"`` を使ってくださ" +"い。\n" +"``Misc/rhel7`` ディレクトリには、RHEL 7 と CentOS 7 の Tcl/Tk と OpenSSL を" +"使って Python をビルドするための ``.pc`` ファイルと手順が含まれています。" -#: ../../whatsnew/3.11.rst:2193 msgid "" "CPython will now use 30-bit digits by default for the Python :class:`int` " "implementation. Previously, the default was to use 30-bit digits on " @@ -3552,22 +4166,33 @@ msgid "" "may be removed at some point in the future. (Contributed by Mark Dickinson " "in :issue:`45569`.)" msgstr "" +"CPython の Python :class:`int` の実装では、デフォルトで 30 ビットの桁を使うよ" +"うになりました。\n" +"以前のデフォルトは、``SIZEOF_VOID_P >= 8`` のプラットフォームでは 30 ビットの" +"桁、それ以外では 15 ビットの桁でした。\n" +"configure スクリプトの :option:`--enable-big-digits` オプション、または " +"Windows では ``PC/pyconfig.h`` の ``PYLONG_BITS_IN_DIGIT`` 変数で、引き続き " +"15 ビットの桁を使うよう明示的に指定できますが、このオプションは将来削除される" +"可能性があります。\n" +"(Mark Dickinson による :issue:`45569` での貢献。)" #: ../../whatsnew/3.11.rst:2206 msgid "C API Changes" msgstr "C API の変更" -#: ../../whatsnew/3.11.rst:2213 msgid "" "Add a new :c:func:`PyType_GetName` function to get type's short name. " "(Contributed by Hai Shi in :issue:`42035`.)" msgstr "" +"型の短い名前を取得する :c:func:`PyType_GetName` 関数が追加されました。\n" +"(Hai Shi による :issue:`42035` での貢献。)" -#: ../../whatsnew/3.11.rst:2216 msgid "" "Add a new :c:func:`PyType_GetQualName` function to get type's qualified " "name. (Contributed by Hai Shi in :issue:`42035`.)" msgstr "" +"型の修飾名を取得する :c:func:`PyType_GetQualName` 関数が追加されました。\n" +"(Hai Shi による :issue:`42035` での貢献。)" #: ../../whatsnew/3.11.rst:2219 msgid "" @@ -3577,101 +4202,100 @@ msgid "" "`43760`.)" msgstr "" -#: ../../whatsnew/3.11.rst:2224 msgid "" "Added the :c:data:`Py_Version` constant which bears the same value as :c:" "macro:`PY_VERSION_HEX`. (Contributed by Gabriele N. Tornetta in :issue:" "`43931`.)" msgstr "" +":c:macro:`PY_VERSION_HEX` と同じ値を持つ :c:data:`Py_Version` 定数が追加され" +"ました。\n" +"( Gabriele N. Tornetta による :issue:`43931` での貢献。)" -#: ../../whatsnew/3.11.rst:2228 msgid "" ":c:type:`Py_buffer` and APIs are now part of the limited API and the stable " "ABI:" msgstr "" +":c:type:`Py_buffer` と以下の API が限定 API および安定 ABI に含まれるようにな" +"りました。" -#: ../../whatsnew/3.11.rst:2231 msgid ":c:func:`PyObject_CheckBuffer`" -msgstr "" +msgstr ":c:func:`PyObject_CheckBuffer`" -#: ../../whatsnew/3.11.rst:2232 msgid ":c:func:`PyObject_GetBuffer`" -msgstr "" +msgstr ":c:func:`PyObject_GetBuffer`" -#: ../../whatsnew/3.11.rst:2233 msgid ":c:func:`PyBuffer_GetPointer`" -msgstr "" +msgstr ":c:func:`PyBuffer_GetPointer`" -#: ../../whatsnew/3.11.rst:2234 msgid ":c:func:`PyBuffer_SizeFromFormat`" -msgstr "" +msgstr ":c:func:`PyBuffer_SizeFromFormat`" -#: ../../whatsnew/3.11.rst:2235 msgid ":c:func:`PyBuffer_ToContiguous`" -msgstr "" +msgstr ":c:func:`PyBuffer_ToContiguous`" -#: ../../whatsnew/3.11.rst:2236 msgid ":c:func:`PyBuffer_FromContiguous`" -msgstr "" +msgstr ":c:func:`PyBuffer_FromContiguous`" -#: ../../whatsnew/3.11.rst:2237 msgid ":c:func:`PyObject_CopyData`" -msgstr "" +msgstr ":c:func:`PyObject_CopyData`" -#: ../../whatsnew/3.11.rst:2238 msgid ":c:func:`PyBuffer_IsContiguous`" -msgstr "" +msgstr ":c:func:`PyBuffer_IsContiguous`" -#: ../../whatsnew/3.11.rst:2239 msgid ":c:func:`PyBuffer_FillContiguousStrides`" -msgstr "" +msgstr ":c:func:`PyBuffer_FillContiguousStrides`" -#: ../../whatsnew/3.11.rst:2240 msgid ":c:func:`PyBuffer_FillInfo`" -msgstr "" +msgstr ":c:func:`PyBuffer_FillInfo`" -#: ../../whatsnew/3.11.rst:2241 msgid ":c:func:`PyBuffer_Release`" -msgstr "" +msgstr ":c:func:`PyBuffer_Release`" -#: ../../whatsnew/3.11.rst:2242 msgid ":c:func:`PyMemoryView_FromBuffer`" -msgstr "" +msgstr ":c:func:`PyMemoryView_FromBuffer`" -#: ../../whatsnew/3.11.rst:2243 msgid "" ":c:member:`~PyBufferProcs.bf_getbuffer` and :c:member:`~PyBufferProcs." "bf_releasebuffer` type slots" msgstr "" +":c:member:`~PyBufferProcs.bf_getbuffer` と :c:member:`~PyBufferProcs." +"bf_releasebuffer` 型スロット" -#: ../../whatsnew/3.11.rst:2246 msgid "(Contributed by Christian Heimes in :issue:`45459`.)" -msgstr "" +msgstr "(Christian Heimes による :issue:`45459` での貢献。)" -#: ../../whatsnew/3.11.rst:2248 msgid "" "Added the :c:func:`PyType_GetModuleByDef` function, used to get the module " "in which a method was defined, in cases where this information is not " "available directly (via :c:type:`PyCMethod`). (Contributed by Petr Viktorin " "in :issue:`46613`.)" msgstr "" +"メソッドが定義されたモジュールの情報を (:c:type:`PyCMethod` 経由で) 直接取得" +"できない場合に、そのモジュールを取得する :c:func:`PyType_GetModuleByDef` 関数" +"が追加されました。\n" +"(Petr Viktorin による :issue:`46613` での貢献。)" -#: ../../whatsnew/3.11.rst:2253 msgid "" "Add new functions to pack and unpack C double (serialize and deserialize): :" "c:func:`PyFloat_Pack2`, :c:func:`PyFloat_Pack4`, :c:func:`PyFloat_Pack8`, :c:" "func:`PyFloat_Unpack2`, :c:func:`PyFloat_Unpack4` and :c:func:" "`PyFloat_Unpack8`. (Contributed by Victor Stinner in :issue:`46906`.)" msgstr "" +"C の double をパック、アンパック (直列化、逆直列化) する関数 :c:func:" +"`PyFloat_Pack2`、:c:func:`PyFloat_Pack4`、:c:func:`PyFloat_Pack8`、:c:func:" +"`PyFloat_Unpack2`、:c:func:`PyFloat_Unpack4`、:c:func:`PyFloat_Unpack8` が追" +"加されました。\n" +"(Victor Stinner による :issue:`46906` での貢献。)" -#: ../../whatsnew/3.11.rst:2259 msgid "" "Add new functions to get frame object attributes: :c:func:" "`PyFrame_GetBuiltins`, :c:func:`PyFrame_GetGenerator`, :c:func:" "`PyFrame_GetGlobals`, :c:func:`PyFrame_GetLasti`." msgstr "" +"フレームオブジェクトの属性を取得する関数 :c:func:`PyFrame_GetBuiltins`、:c:" +"func:`PyFrame_GetGenerator`、:c:func:`PyFrame_GetGlobals`、:c:func:" +"`PyFrame_GetLasti` が追加されました。" -#: ../../whatsnew/3.11.rst:2263 msgid "" "Added two new functions to get and set the active exception instance: :c:" "func:`PyErr_GetHandledException` and :c:func:`PyErr_SetHandledException`. " @@ -3679,14 +4303,20 @@ msgid "" "`PyErr_GetExcInfo()` which work with the legacy 3-tuple representation of " "exceptions. (Contributed by Irit Katriel in :issue:`46343`.)" msgstr "" +"処理中の例外インスタンスを取得、設定する 2 つの関数 :c:func:" +"`PyErr_GetHandledException` と :c:func:`PyErr_SetHandledException` が追加され" +"ました。\n" +"これらは、例外を従来の 3 要素のタプルで表す :c:func:`PyErr_SetExcInfo()` と :" +"c:func:`PyErr_GetExcInfo()` の代わりに使えます。\n" +"(Irit Katriel による :issue:`46343` での貢献。)" -#: ../../whatsnew/3.11.rst:2270 msgid "" "Added the :c:member:`PyConfig.safe_path` member. (Contributed by Victor " "Stinner in :gh:`57684`.)" msgstr "" +":c:member:`PyConfig.safe_path` メンバーが追加されました。\n" +"(Victor Stinner による :gh:`57684` での貢献。)" -#: ../../whatsnew/3.11.rst:2281 msgid "" "Some macros have been converted to static inline functions to avoid `macro " "pitfalls `_. The " @@ -3697,38 +4327,58 @@ msgid "" "expected types. See :pep:`670` for more details. (Contributed by Victor " "Stinner and Erlend E. Aasland in :gh:`89653`.)" msgstr "" +"`マクロの落とし穴 `_ " +"を避けるため、いくつかのマクロが static inline 関数に変換されました。\n" +"置き換え後の関数では、静的な型チェックによるコンパイラの警告を避けるために引" +"数を必要な型へキャストするので、ほとんどの場合、この変更を利用者が意識する必" +"要はありません。\n" +"ただし、限定 C API を 3.11 以上に設定している場合はこのキャストを行わないた" +"め、呼び出し側で引数を必要な型にキャストしなければなりません。\n" +"詳しくは :pep:`670` を参照してください。\n" +"(Victor Stinner and Erlend E. Aasland による :gh:`89653` での貢献。)" -#: ../../whatsnew/3.11.rst:2292 msgid "" ":c:func:`PyErr_SetExcInfo()` no longer uses the ``type`` and ``traceback`` " "arguments, the interpreter now derives those values from the exception " "instance (the ``value`` argument). The function still steals references of " "all three arguments. (Contributed by Irit Katriel in :issue:`45711`.)" msgstr "" +":c:func:`PyErr_SetExcInfo()` が ``type`` と ``traceback`` 引数を使わなくな" +"り、インタープリタがこれらの値を例外インスタンス (``value`` 引数) から取得す" +"るようになりました。\n" +"この関数は引き続き 3 つの引数すべての参照を盗みます。\n" +"(Irit Katriel による :issue:`45711` での貢献。)" -#: ../../whatsnew/3.11.rst:2298 msgid "" ":c:func:`PyErr_GetExcInfo()` now derives the ``type`` and ``traceback`` " "fields of the result from the exception instance (the ``value`` field). " "(Contributed by Irit Katriel in :issue:`45711`.)" msgstr "" +":c:func:`PyErr_GetExcInfo()` が、結果の ``type`` と ``traceback`` フィールド" +"を例外インスタンス (``value`` フィールド) から取得するようになりました。\n" +"(Irit Katriel による :issue:`45711` での貢献。)" -#: ../../whatsnew/3.11.rst:2302 msgid "" ":c:struct:`_frozen` has a new ``is_package`` field to indicate whether or " "not the frozen module is a package. Previously, a negative value in the " "``size`` field was the indicator. Now only non-negative values be used for " "``size``. (Contributed by Kumar Aditya in :issue:`46608`.)" msgstr "" +":c:struct:`_frozen` に、凍結モジュールがパッケージかどうかを示す " +"``is_package`` フィールドが追加されました。\n" +"以前は ``size`` フィールドが負かどうかで区別していました。\n" +"今後は ``size`` に非負の値だけを使います。\n" +"(Kumar Aditya による :issue:`46608` での貢献。)" -#: ../../whatsnew/3.11.rst:2308 msgid "" ":c:func:`_PyFrameEvalFunction` now takes ``_PyInterpreterFrame*`` as its " "second parameter, instead of ``PyFrameObject*``. See :pep:`523` for more " "details of how to use this function pointer type." msgstr "" +":c:func:`_PyFrameEvalFunction` の第 2 引数が ``PyFrameObject*`` から " +"``_PyInterpreterFrame*`` に変わりました。\n" +"この関数ポインタ型の使い方については :pep:`523` を参照してください。" -#: ../../whatsnew/3.11.rst:2312 msgid "" ":c:func:`!PyCode_New` and :c:func:`!PyCode_NewWithPosOnlyArgs` now take an " "additional ``exception_table`` argument. Using these functions should be " @@ -3736,8 +4386,12 @@ msgid "" "object using the compiler, then get a modified version with the ``replace`` " "method." msgstr "" +":c:func:`!PyCode_New` と :c:func:`!PyCode_NewWithPosOnlyArgs` に " +"``exception_table`` 引数が追加されました。\n" +"可能な限り、これらの関数は使わないでください。\n" +"カスタムのコードオブジェクトを得るには、コンパイラでコードオブジェクトを作成" +"し、``replace`` メソッドで変更したものを取得してください。" -#: ../../whatsnew/3.11.rst:2318 msgid "" ":c:type:`PyCodeObject` no longer has the ``co_code``, ``co_varnames``, " "``co_cellvars`` and ``co_freevars`` fields. Instead, use :c:func:" @@ -3746,17 +4400,26 @@ msgid "" "(Contributed by Brandt Bucher in :issue:`46841` and Ken Jin in :gh:`92154` " "and :gh:`94936`.)" msgstr "" +":c:type:`PyCodeObject` から ``co_code``、``co_varnames``、``co_cellvars``、" +"``co_freevars`` フィールドが削除されました。\n" +"C API でこれらにアクセスするには、それぞれ :c:func:`PyCode_GetCode`、:c:func:" +"`PyCode_GetVarnames`、:c:func:`PyCode_GetCellvars`、:c:func:" +"`PyCode_GetFreevars` を使ってください。\n" +"(Brandt Bucher による :issue:`46841` and Ken Jin in :gh:`92154` and :gh:" +"`94936` での貢献。)" -#: ../../whatsnew/3.11.rst:2326 msgid "" "The old trashcan macros (``Py_TRASHCAN_SAFE_BEGIN``/" "``Py_TRASHCAN_SAFE_END``) are now deprecated. They should be replaced by the " "new macros ``Py_TRASHCAN_BEGIN`` and ``Py_TRASHCAN_END``." msgstr "" +"古い trashcan マクロ (``Py_TRASHCAN_SAFE_BEGIN`` / ``Py_TRASHCAN_SAFE_END``) " +"が非推奨となりました。\n" +"新しいマクロ ``Py_TRASHCAN_BEGIN`` と ``Py_TRASHCAN_END`` に置き換えてくださ" +"い。" -#: ../../whatsnew/3.11.rst:2330 msgid "A tp_dealloc function that has the old macros, such as::" -msgstr "" +msgstr "古いマクロを使った次のような tp_dealloc 関数があるとします。 ::" #: ../../whatsnew/3.11.rst:2332 msgid "" @@ -3770,11 +4433,9 @@ msgid "" "}" msgstr "" -#: ../../whatsnew/3.11.rst:2341 msgid "should migrate to the new macros as follows::" -msgstr "" +msgstr "次のように新しいマクロに移行してください。 ::" -#: ../../whatsnew/3.11.rst:2343 msgid "" "static void\n" "mytype_dealloc(mytype *p)\n" @@ -3785,21 +4446,31 @@ msgid "" " Py_TRASHCAN_END\n" "}" msgstr "" +"static void\n" +"mytype_dealloc(mytype *p)\n" +"{\n" +" PyObject_GC_UnTrack(p);\n" +" Py_TRASHCAN_BEGIN(p, mytype_dealloc)\n" +" ...\n" +" Py_TRASHCAN_END\n" +"}" -#: ../../whatsnew/3.11.rst:2352 msgid "" "Note that ``Py_TRASHCAN_BEGIN`` has a second argument which should be the " "deallocation function it is in." msgstr "" +"``Py_TRASHCAN_BEGIN`` の第 2 引数には、そのマクロを使っている解放関数を指定す" +"る必要があることに注意してください。" -#: ../../whatsnew/3.11.rst:2355 msgid "" "To support older Python versions in the same codebase, you can define the " "following macros and use them throughout the code (credit: these were copied " "from the ``mypy`` codebase)::" msgstr "" +"同じコードベースで古い Python バージョンにも対応するには、以下のマクロを定義" +"してコード全体で使うことができます (これらは ``mypy`` のコードベースから転載" +"したものです)。 ::" -#: ../../whatsnew/3.11.rst:2359 msgid "" "#if PY_VERSION_HEX >= 0x03080000\n" "# define CPy_TRASHCAN_BEGIN(op, dealloc) Py_TRASHCAN_BEGIN(op, dealloc)\n" @@ -3809,32 +4480,47 @@ msgid "" "# define CPy_TRASHCAN_END(op) Py_TRASHCAN_SAFE_END(op)\n" "#endif" msgstr "" +"#if PY_VERSION_HEX >= 0x03080000\n" +"# define CPy_TRASHCAN_BEGIN(op, dealloc) Py_TRASHCAN_BEGIN(op, dealloc)\n" +"# define CPy_TRASHCAN_END(op) Py_TRASHCAN_END\n" +"#else\n" +"# define CPy_TRASHCAN_BEGIN(op, dealloc) Py_TRASHCAN_SAFE_BEGIN(op)\n" +"# define CPy_TRASHCAN_END(op) Py_TRASHCAN_SAFE_END(op)\n" +"#endif" -#: ../../whatsnew/3.11.rst:2367 msgid "" "The :c:func:`PyType_Ready` function now raises an error if a type is defined " "with the :c:macro:`Py_TPFLAGS_HAVE_GC` flag set but has no traverse function " "(:c:member:`PyTypeObject.tp_traverse`). (Contributed by Victor Stinner in :" "issue:`44263`.)" msgstr "" +":c:macro:`Py_TPFLAGS_HAVE_GC` フラグを設定しているのに巡回関数 (:c:member:" +"`PyTypeObject.tp_traverse`) がない型を定義すると、:c:func:`PyType_Ready` 関数" +"がエラーを送出するようになりました。\n" +"(Victor Stinner による :issue:`44263` での貢献。)" -#: ../../whatsnew/3.11.rst:2372 msgid "" "Heap types with the :c:macro:`Py_TPFLAGS_IMMUTABLETYPE` flag can now inherit " "the :pep:`590` vectorcall protocol. Previously, this was only possible for :" "ref:`static types `. (Contributed by Erlend E. Aasland in :" "issue:`43908`)" msgstr "" +":c:macro:`Py_TPFLAGS_IMMUTABLETYPE` フラグを持つヒープ型が :pep:`590` の " +"vectorcall プロトコルを継承できるようになりました。\n" +"以前は :ref:`静的な型 ` でしか継承できませんでした。\n" +"(Erlend E. Aasland による :issue:`43908` での貢献。)" -#: ../../whatsnew/3.11.rst:2377 msgid "" "Since :c:func:`Py_TYPE()` is changed to a inline static function, " "``Py_TYPE(obj) = new_type`` must be replaced with ``Py_SET_TYPE(obj, " "new_type)``: see the :c:func:`Py_SET_TYPE()` function (available since " "Python 3.9). For backward compatibility, this macro can be used::" msgstr "" +":c:func:`Py_TYPE()` が static inline 関数に変わったため、``Py_TYPE(obj) = " +"new_type`` は ``Py_SET_TYPE(obj, new_type)`` に置き換える必要があります。\n" +"Python 3.9 から利用できる :c:func:`Py_SET_TYPE()` 関数を参照してください。\n" +"後方互換性のために、以下のマクロを使うことができます。 ::" -#: ../../whatsnew/3.11.rst:2383 msgid "" "#if PY_VERSION_HEX < 0x030900A4 && !defined(Py_SET_TYPE)\n" "static inline void _Py_SET_TYPE(PyObject *ob, PyTypeObject *type)\n" @@ -3842,20 +4528,26 @@ msgid "" "#define Py_SET_TYPE(ob, type) _Py_SET_TYPE((PyObject*)(ob), type)\n" "#endif" msgstr "" +"#if PY_VERSION_HEX < 0x030900A4 && !defined(Py_SET_TYPE)\n" +"static inline void _Py_SET_TYPE(PyObject *ob, PyTypeObject *type)\n" +"{ ob->ob_type = type; }\n" +"#define Py_SET_TYPE(ob, type) _Py_SET_TYPE((PyObject*)(ob), type)\n" +"#endif" -#: ../../whatsnew/3.11.rst:2389 ../../whatsnew/3.11.rst:2403 msgid "(Contributed by Victor Stinner in :issue:`39573`.)" -msgstr "" +msgstr "(Victor Stinner による :issue:`39573` での貢献。)" -#: ../../whatsnew/3.11.rst:2391 msgid "" "Since :c:func:`Py_SIZE()` is changed to a inline static function, " "``Py_SIZE(obj) = new_size`` must be replaced with ``Py_SET_SIZE(obj, " "new_size)``: see the :c:func:`Py_SET_SIZE()` function (available since " "Python 3.9). For backward compatibility, this macro can be used::" msgstr "" +":c:func:`Py_SIZE()` が static inline 関数に変わったため、``Py_SIZE(obj) = " +"new_size`` は ``Py_SET_SIZE(obj, new_size)`` に置き換える必要があります。\n" +"Python 3.9 から利用できる :c:func:`Py_SET_SIZE()` 関数を参照してください。\n" +"後方互換性のために、以下のマクロを使うことができます。 ::" -#: ../../whatsnew/3.11.rst:2397 msgid "" "#if PY_VERSION_HEX < 0x030900A4 && !defined(Py_SET_SIZE)\n" "static inline void _Py_SET_SIZE(PyVarObject *ob, Py_ssize_t size)\n" @@ -3863,8 +4555,12 @@ msgid "" "#define Py_SET_SIZE(ob, size) _Py_SET_SIZE((PyVarObject*)(ob), size)\n" "#endif" msgstr "" +"#if PY_VERSION_HEX < 0x030900A4 && !defined(Py_SET_SIZE)\n" +"static inline void _Py_SET_SIZE(PyVarObject *ob, Py_ssize_t size)\n" +"{ ob->ob_size = size; }\n" +"#define Py_SET_SIZE(ob, size) _Py_SET_SIZE((PyVarObject*)(ob), size)\n" +"#endif" -#: ../../whatsnew/3.11.rst:2405 msgid "" "```` no longer includes the header files ````, ````, ```` and ```` when the ``Py_LIMITED_API`` macro is " @@ -3872,8 +4568,13 @@ msgid "" "explicitly include the header files after ``#include ``. " "(Contributed by Victor Stinner in :issue:`45434`.)" msgstr "" +"``Py_LIMITED_API`` マクロが ``0x030b0000`` (Python 3.11) 以上の場合、" +"```` がヘッダーファイル ````、````、````、```` をインクルードしなくなりました。\n" +"C 拡張は ``#include `` の後にこれらのヘッダーファイルを明示的にイン" +"クルードする必要があります。\n" +"(Victor Stinner による :issue:`45434` での貢献。)" -#: ../../whatsnew/3.11.rst:2411 msgid "" "The non-limited API files ``cellobject.h``, ``classobject.h``, ``code.h``, " "``context.h``, ``funcobject.h``, ``genobject.h`` and ``longintrepr.h`` have " @@ -3883,166 +4584,169 @@ msgid "" "If they have been included directly, consider including ``Python.h`` " "instead. (Contributed by Victor Stinner in :issue:`35134`.)" msgstr "" +"限定 API に含まれないファイル ``cellobject.h``、``classobject.h``、``code." +"h``、``context.h``、``funcobject.h``、``genobject.h``、``longintrepr.h`` が " +"``Include/cpython`` ディレクトリに移動しました。\n" +"また、``eval.h`` ヘッダーファイルが削除されました。\n" +"これらのファイルは ``Python.h`` に含まれているので、直接インクルードしてはい" +"けません (:ref:`インクルードファイル ` を参照)。\n" +"直接インクルードしている場合は、代わりに ``Python.h`` をインクルードすること" +"を検討してください。\n" +"(Victor Stinner による :issue:`35134` での貢献。)" -#: ../../whatsnew/3.11.rst:2419 msgid "" "The :c:func:`!PyUnicode_CHECK_INTERNED` macro has been excluded from the " "limited C API. It was never usable there, because it used internal " "structures which are not available in the limited C API. (Contributed by " "Victor Stinner in :issue:`46007`.)" msgstr "" +":c:func:`!PyUnicode_CHECK_INTERNED` マクロが限定 C API から除外されました。\n" +"このマクロは限定 C API では利用できない内部構造体を使っていたため、限定 C " +"API ではもともと使えませんでした。\n" +"(Victor Stinner による :issue:`46007` での貢献。)" -#: ../../whatsnew/3.11.rst:2424 msgid "" "The following frame functions and type are now directly available with " "``#include ``, it's no longer needed to add ``#include " "``:" msgstr "" +"以下のフレーム関連の関数と型が ``#include `` だけで利用できるように" +"なり、``#include `` を追加する必要がなくなりました。" -#: ../../whatsnew/3.11.rst:2428 msgid ":c:func:`PyFrame_Check`" -msgstr "" +msgstr ":c:func:`PyFrame_Check`" -#: ../../whatsnew/3.11.rst:2429 msgid ":c:func:`PyFrame_GetBack`" -msgstr "" +msgstr ":c:func:`PyFrame_GetBack`" -#: ../../whatsnew/3.11.rst:2430 msgid ":c:func:`PyFrame_GetBuiltins`" -msgstr "" +msgstr ":c:func:`PyFrame_GetBuiltins`" -#: ../../whatsnew/3.11.rst:2431 msgid ":c:func:`PyFrame_GetGenerator`" -msgstr "" +msgstr ":c:func:`PyFrame_GetGenerator`" -#: ../../whatsnew/3.11.rst:2432 msgid ":c:func:`PyFrame_GetGlobals`" -msgstr "" +msgstr ":c:func:`PyFrame_GetGlobals`" -#: ../../whatsnew/3.11.rst:2433 msgid ":c:func:`PyFrame_GetLasti`" -msgstr "" +msgstr ":c:func:`PyFrame_GetLasti`" -#: ../../whatsnew/3.11.rst:2434 msgid ":c:func:`PyFrame_GetLocals`" -msgstr "" +msgstr ":c:func:`PyFrame_GetLocals`" -#: ../../whatsnew/3.11.rst:2435 msgid ":c:type:`PyFrame_Type`" -msgstr "" +msgstr ":c:type:`PyFrame_Type`" -#: ../../whatsnew/3.11.rst:2437 msgid "(Contributed by Victor Stinner in :gh:`93937`.)" -msgstr "" +msgstr "(Victor Stinner による :gh:`93937` での貢献。)" -#: ../../whatsnew/3.11.rst:2441 msgid "" "The :c:type:`PyFrameObject` structure members have been removed from the " "public C API." msgstr "" +":c:type:`PyFrameObject` 構造体のメンバーが公開 C API から削除されました。" -#: ../../whatsnew/3.11.rst:2444 msgid "" "While the documentation notes that the :c:type:`PyFrameObject` fields are " "subject to change at any time, they have been stable for a long time and " "were used in several popular extensions." msgstr "" +":c:type:`PyFrameObject` のフィールドはいつ変更されてもおかしくないとドキュメ" +"ントには記載されていましたが、長い間安定しており、いくつかの広く使われている" +"拡張でも利用されていました。" -#: ../../whatsnew/3.11.rst:2448 msgid "" "In Python 3.11, the frame struct was reorganized to allow performance " "optimizations. Some fields were removed entirely, as they were details of " "the old implementation." msgstr "" +"Python 3.11 ではパフォーマンスを最適化できるようにフレーム構造体を再編しまし" +"た。\n" +"古い実装の詳細にすぎなかった一部のフィールドは完全に削除されました。" -#: ../../whatsnew/3.11.rst:2452 msgid ":c:type:`PyFrameObject` fields:" -msgstr "" +msgstr ":c:type:`PyFrameObject` のフィールド。" -#: ../../whatsnew/3.11.rst:2454 msgid "``f_back``: use :c:func:`PyFrame_GetBack`." -msgstr "" +msgstr "``f_back``: :c:func:`PyFrame_GetBack` を使ってください。" -#: ../../whatsnew/3.11.rst:2455 msgid "``f_blockstack``: removed." -msgstr "" +msgstr "``f_blockstack``: 削除されました。" -#: ../../whatsnew/3.11.rst:2456 msgid "``f_builtins``: use :c:func:`PyFrame_GetBuiltins`." -msgstr "" +msgstr "``f_builtins``: :c:func:`PyFrame_GetBuiltins` を使ってください。" -#: ../../whatsnew/3.11.rst:2457 msgid "``f_code``: use :c:func:`PyFrame_GetCode`." -msgstr "" +msgstr "``f_code``: :c:func:`PyFrame_GetCode` を使ってください。" -#: ../../whatsnew/3.11.rst:2458 msgid "``f_gen``: use :c:func:`PyFrame_GetGenerator`." -msgstr "" +msgstr "``f_gen``: :c:func:`PyFrame_GetGenerator` を使ってください。" -#: ../../whatsnew/3.11.rst:2459 msgid "``f_globals``: use :c:func:`PyFrame_GetGlobals`." -msgstr "" +msgstr "``f_globals``: :c:func:`PyFrame_GetGlobals` を使ってください。" -#: ../../whatsnew/3.11.rst:2460 msgid "``f_iblock``: removed." -msgstr "" +msgstr "``f_iblock``: 削除されました。" -#: ../../whatsnew/3.11.rst:2461 msgid "" "``f_lasti``: use :c:func:`PyFrame_GetLasti`. Code using ``f_lasti`` with " "``PyCode_Addr2Line()`` should use :c:func:`PyFrame_GetLineNumber` instead; " "it may be faster." msgstr "" +"``f_lasti``: :c:func:`PyFrame_GetLasti` を使ってください。\n" +"``f_lasti`` と ``PyCode_Addr2Line()`` を組み合わせて使うコードでは、代わり" +"に :c:func:`PyFrame_GetLineNumber` を使ってください。\n" +"こちらの方が高速な場合があります。" -#: ../../whatsnew/3.11.rst:2464 msgid "``f_lineno``: use :c:func:`PyFrame_GetLineNumber`" -msgstr "" +msgstr "``f_lineno``: :c:func:`PyFrame_GetLineNumber` を使ってください。" -#: ../../whatsnew/3.11.rst:2465 msgid "``f_locals``: use :c:func:`PyFrame_GetLocals`." -msgstr "" +msgstr "``f_locals``: :c:func:`PyFrame_GetLocals` を使ってください。" -#: ../../whatsnew/3.11.rst:2466 msgid "``f_stackdepth``: removed." -msgstr "" +msgstr "``f_stackdepth``: 削除されました。" #: ../../whatsnew/3.11.rst:2467 msgid "``f_state``: no public API (renamed to ``f_frame.f_state``)." msgstr "" -#: ../../whatsnew/3.11.rst:2468 msgid "``f_trace``: no public API." -msgstr "" +msgstr "``f_trace``: 公開 API はありません。" -#: ../../whatsnew/3.11.rst:2469 msgid "" "``f_trace_lines``: use ``PyObject_GetAttrString((PyObject*)frame, " "\"f_trace_lines\")``." msgstr "" +"``f_trace_lines``: ``PyObject_GetAttrString((PyObject*)frame, " +"\"f_trace_lines\")`` を使ってください。" -#: ../../whatsnew/3.11.rst:2470 msgid "" "``f_trace_opcodes``: use ``PyObject_GetAttrString((PyObject*)frame, " "\"f_trace_opcodes\")``." msgstr "" +"``f_trace_opcodes``: ``PyObject_GetAttrString((PyObject*)frame, " +"\"f_trace_opcodes\")`` を使ってください。" -#: ../../whatsnew/3.11.rst:2471 msgid "``f_localsplus``: no public API (renamed to ``f_frame.localsplus``)." msgstr "" +"``f_localsplus``: 公開 API はありません (``f_frame.localsplus`` に改名されま" +"した)。" -#: ../../whatsnew/3.11.rst:2472 msgid "``f_valuestack``: removed." -msgstr "" +msgstr "``f_valuestack``: 削除されました。" -#: ../../whatsnew/3.11.rst:2474 msgid "" "The Python frame object is now created lazily. A side effect is that the :" "attr:`~frame.f_back` member must not be accessed directly, since its value " "is now also computed lazily. The :c:func:`PyFrame_GetBack` function must be " "called instead." msgstr "" +"Python のフレームオブジェクトは必要になるまで生成されなくなりました。\n" +"これに伴い :attr:`~frame.f_back` メンバーの値も必要になるまで計算されなくなっ" +"たため、直接アクセスしてはいけません。\n" +"代わりに :c:func:`PyFrame_GetBack` 関数を呼び出す必要があります。" -#: ../../whatsnew/3.11.rst:2480 msgid "" "Debuggers that accessed the :attr:`~frame.f_locals` directly *must* call :c:" "func:`PyFrame_GetLocals` instead. They no longer need to call :c:func:`!" @@ -4050,12 +4754,15 @@ msgid "" "they should not call those functions. The necessary updating of the frame is " "now managed by the virtual machine." msgstr "" +":attr:`~frame.f_locals` に直接アクセスしていたデバッガは、代わりに :c:func:" +"`PyFrame_GetLocals` を呼び出す *必要があります*。\n" +":c:func:`!PyFrame_FastToLocalsWithError` や :c:func:`!PyFrame_LocalsToFast` " +"を呼び出す必要はなくなり、むしろこれらの関数を呼び出してはいけません。\n" +"必要なフレームの更新は仮想マシンが管理するようになりました。" -#: ../../whatsnew/3.11.rst:2486 msgid "Code defining ``PyFrame_GetCode()`` on Python 3.8 and older::" -msgstr "" +msgstr "Python 3.8 以前で ``PyFrame_GetCode()`` を定義するコードです。 ::" -#: ../../whatsnew/3.11.rst:2488 msgid "" "#if PY_VERSION_HEX < 0x030900B1\n" "static inline PyCodeObject* PyFrame_GetCode(PyFrameObject *frame)\n" @@ -4065,12 +4772,17 @@ msgid "" "}\n" "#endif" msgstr "" +"#if PY_VERSION_HEX < 0x030900B1\n" +"static inline PyCodeObject* PyFrame_GetCode(PyFrameObject *frame)\n" +"{\n" +" Py_INCREF(frame->f_code);\n" +" return frame->f_code;\n" +"}\n" +"#endif" -#: ../../whatsnew/3.11.rst:2496 msgid "Code defining ``PyFrame_GetBack()`` on Python 3.8 and older::" -msgstr "" +msgstr "Python 3.8 以前で ``PyFrame_GetBack()`` を定義するコードです。 ::" -#: ../../whatsnew/3.11.rst:2498 msgid "" "#if PY_VERSION_HEX < 0x030900B1\n" "static inline PyFrameObject* PyFrame_GetBack(PyFrameObject *frame)\n" @@ -4080,46 +4792,60 @@ msgid "" "}\n" "#endif" msgstr "" +"#if PY_VERSION_HEX < 0x030900B1\n" +"static inline PyFrameObject* PyFrame_GetBack(PyFrameObject *frame)\n" +"{\n" +" Py_XINCREF(frame->f_back);\n" +" return frame->f_back;\n" +"}\n" +"#endif" -#: ../../whatsnew/3.11.rst:2506 msgid "" "Or use the `pythoncapi_compat project `__ to get these two functions on older Python versions." msgstr "" +"または、`pythoncapi_compat プロジェクト `__ を使うと、古い Python バージョンでもこれら 2 つの関数を" +"利用できます。" -#: ../../whatsnew/3.11.rst:2510 msgid "Changes of the :c:type:`PyThreadState` structure members:" -msgstr "" +msgstr ":c:type:`PyThreadState` 構造体のメンバーの変更。" -#: ../../whatsnew/3.11.rst:2512 msgid "" "``frame``: removed, use :c:func:`PyThreadState_GetFrame` (function added to " "Python 3.9 by :issue:`40429`). Warning: the function returns a :term:`strong " "reference`, need to call :c:func:`Py_XDECREF`." msgstr "" +"``frame``: 削除されました。\n" +":c:func:`PyThreadState_GetFrame` を使ってください (Python 3.9 で :issue:" +"`40429` により追加された関数です)。\n" +"この関数は :term:`strong reference` を返すので、:c:func:`Py_XDECREF` を呼び出" +"す必要があることに注意してください。" -#: ../../whatsnew/3.11.rst:2516 msgid "" "``tracing``: changed, use :c:func:`PyThreadState_EnterTracing` and :c:func:" "`PyThreadState_LeaveTracing` (functions added to Python 3.11 by :issue:" "`43760`)." msgstr "" +"``tracing``: 変更されました。\n" +":c:func:`PyThreadState_EnterTracing` と :c:func:`PyThreadState_LeaveTracing` " +"を使ってください (Python 3.11 で :issue:`43760` により追加された関数です)。" -#: ../../whatsnew/3.11.rst:2519 msgid "" "``recursion_depth``: removed, use ``(tstate->recursion_limit - tstate-" ">recursion_remaining)`` instead." msgstr "" +"``recursion_depth``: 削除されました。\n" +"代わりに ``(tstate->recursion_limit - tstate->recursion_remaining)`` を使って" +"ください。" -#: ../../whatsnew/3.11.rst:2521 msgid "``stackcheck_counter``: removed." -msgstr "" +msgstr "``stackcheck_counter``: 削除されました。" -#: ../../whatsnew/3.11.rst:2523 msgid "Code defining ``PyThreadState_GetFrame()`` on Python 3.8 and older::" msgstr "" +"Python 3.8 以前で ``PyThreadState_GetFrame()`` を定義するコードです。 ::" -#: ../../whatsnew/3.11.rst:2525 msgid "" "#if PY_VERSION_HEX < 0x030900B1\n" "static inline PyFrameObject* PyThreadState_GetFrame(PyThreadState *tstate)\n" @@ -4129,14 +4855,21 @@ msgid "" "}\n" "#endif" msgstr "" +"#if PY_VERSION_HEX < 0x030900B1\n" +"static inline PyFrameObject* PyThreadState_GetFrame(PyThreadState *tstate)\n" +"{\n" +" Py_XINCREF(tstate->frame);\n" +" return tstate->frame;\n" +"}\n" +"#endif" -#: ../../whatsnew/3.11.rst:2533 msgid "" "Code defining ``PyThreadState_EnterTracing()`` and " "``PyThreadState_LeaveTracing()`` on Python 3.10 and older::" msgstr "" +"Python 3.10 以前で ``PyThreadState_EnterTracing()`` と " +"``PyThreadState_LeaveTracing()`` を定義するコードです。 ::" -#: ../../whatsnew/3.11.rst:2536 msgid "" "#if PY_VERSION_HEX < 0x030B00A2\n" "static inline void PyThreadState_EnterTracing(PyThreadState *tstate)\n" @@ -4162,28 +4895,57 @@ msgid "" "}\n" "#endif" msgstr "" +"#if PY_VERSION_HEX < 0x030B00A2\n" +"static inline void PyThreadState_EnterTracing(PyThreadState *tstate)\n" +"{\n" +" tstate->tracing++;\n" +"#if PY_VERSION_HEX >= 0x030A00A1\n" +" tstate->cframe->use_tracing = 0;\n" +"#else\n" +" tstate->use_tracing = 0;\n" +"#endif\n" +"}\n" +"\n" +"static inline void PyThreadState_LeaveTracing(PyThreadState *tstate)\n" +"{\n" +" int use_tracing = (tstate->c_tracefunc != NULL || tstate->c_profilefunc !" +"= NULL);\n" +" tstate->tracing--;\n" +"#if PY_VERSION_HEX >= 0x030A00A1\n" +" tstate->cframe->use_tracing = use_tracing;\n" +"#else\n" +" tstate->use_tracing = use_tracing;\n" +"#endif\n" +"}\n" +"#endif" -#: ../../whatsnew/3.11.rst:2559 msgid "" "Or use `the pythoncapi-compat project `__ to get these functions on old Python functions." msgstr "" +"または、`pythoncapi-compat プロジェクト `__ を使うと、古い Python バージョンでもこれらの関数を利用" +"できます。" -#: ../../whatsnew/3.11.rst:2563 msgid "" "Distributors are encouraged to build Python with the optimized Blake2 " "library `libb2`_." msgstr "" +"配布者には、最適化された Blake2 ライブラリ `libb2`_ を使って Python をビルド" +"することを推奨します。" -#: ../../whatsnew/3.11.rst:2566 msgid "" "The :c:member:`PyConfig.module_search_paths_set` field must now be set to 1 " "for initialization to use :c:member:`PyConfig.module_search_paths` to " "initialize :data:`sys.path`. Otherwise, initialization will recalculate the " "path and replace any values added to ``module_search_paths``." msgstr "" +"初期化時に :c:member:`PyConfig.module_search_paths` を使って :data:`sys." +"path` を初期化するには、:c:member:`PyConfig.module_search_paths_set` フィール" +"ドを 1 に設定する必要があります。\n" +"そうしないと、初期化時にパスを再計算し、``module_search_paths`` に追加した値" +"がすべて置き換えられます。" -#: ../../whatsnew/3.11.rst:2571 msgid "" ":c:func:`PyConfig_Read` no longer calculates the initial search path, and " "will not fill any values into :c:member:`PyConfig.module_search_paths`. To " @@ -4191,78 +4953,75 @@ msgid "" "c:func:`PySys_GetObject` to retrieve :data:`sys.path` as a Python list " "object and modify it directly." msgstr "" +":c:func:`PyConfig_Read` は初期の検索パスを計算しなくなり、:c:member:" +"`PyConfig.module_search_paths` に値を設定しなくなりました。\n" +"デフォルトのパスを計算してから変更するには、初期化を完了した後に :c:func:" +"`PySys_GetObject` で :data:`sys.path` を Python のリストオブジェクトとして取" +"得し、直接変更してください。" -#: ../../whatsnew/3.11.rst:2582 msgid "" "Deprecate the following functions to configure the Python initialization:" -msgstr "" +msgstr "Python の初期化を設定する以下の関数が非推奨となりました。" -#: ../../whatsnew/3.11.rst:2584 msgid ":c:func:`!PySys_AddWarnOptionUnicode`" -msgstr "" +msgstr ":c:func:`!PySys_AddWarnOptionUnicode`" -#: ../../whatsnew/3.11.rst:2585 msgid ":c:func:`!PySys_AddWarnOption`" -msgstr "" +msgstr ":c:func:`!PySys_AddWarnOption`" -#: ../../whatsnew/3.11.rst:2586 msgid ":c:func:`!PySys_AddXOption`" -msgstr "" +msgstr ":c:func:`!PySys_AddXOption`" -#: ../../whatsnew/3.11.rst:2587 msgid ":c:func:`!PySys_HasWarnOptions`" -msgstr "" +msgstr ":c:func:`!PySys_HasWarnOptions`" -#: ../../whatsnew/3.11.rst:2588 msgid ":c:func:`!PySys_SetArgvEx`" -msgstr "" +msgstr ":c:func:`!PySys_SetArgvEx`" -#: ../../whatsnew/3.11.rst:2589 msgid ":c:func:`!PySys_SetArgv`" -msgstr "" +msgstr ":c:func:`!PySys_SetArgv`" -#: ../../whatsnew/3.11.rst:2590 msgid ":c:func:`!PySys_SetPath`" -msgstr "" +msgstr ":c:func:`!PySys_SetPath`" -#: ../../whatsnew/3.11.rst:2591 msgid ":c:func:`!Py_SetPath`" -msgstr "" +msgstr ":c:func:`!Py_SetPath`" -#: ../../whatsnew/3.11.rst:2592 msgid ":c:func:`!Py_SetProgramName`" -msgstr "" +msgstr ":c:func:`!Py_SetProgramName`" -#: ../../whatsnew/3.11.rst:2593 msgid ":c:func:`!Py_SetPythonHome`" -msgstr "" +msgstr ":c:func:`!Py_SetPythonHome`" -#: ../../whatsnew/3.11.rst:2594 msgid ":c:func:`!Py_SetStandardStreamEncoding`" -msgstr "" +msgstr ":c:func:`!Py_SetStandardStreamEncoding`" -#: ../../whatsnew/3.11.rst:2595 msgid ":c:func:`!_Py_SetProgramFullPath`" -msgstr "" +msgstr ":c:func:`!_Py_SetProgramFullPath`" -#: ../../whatsnew/3.11.rst:2597 msgid "" "Use the new :c:type:`PyConfig` API of the :ref:`Python Initialization " "Configuration ` instead (:pep:`587`). (Contributed by Victor " "Stinner in :gh:`88279`.)" msgstr "" +"代わりに :ref:`Python 初期化設定 ` の新しい :c:type:`PyConfig` " +"API を使ってください (:pep:`587`)。\n" +"(Victor Stinner による :gh:`88279` での貢献。)" -#: ../../whatsnew/3.11.rst:2601 msgid "" "Deprecate the ``ob_shash`` member of the :c:type:`PyBytesObject`. Use :c:" "func:`PyObject_Hash` instead. (Contributed by Inada Naoki in :issue:`46864`.)" msgstr "" +":c:type:`PyBytesObject` の ``ob_shash`` メンバーが非推奨となりました。\n" +"代わりに :c:func:`PyObject_Hash` を使ってください。\n" +"(Inada Naoki による :issue:`46864` での貢献。)" -#: ../../whatsnew/3.11.rst:2610 msgid "" "The following C APIs have been deprecated in earlier Python releases, and " "will be removed in Python 3.12." msgstr "" +"以下の C API は以前の Python リリースで非推奨となっており、Python 3.12 で削除" +"される予定です。" #: ../../whatsnew/3.11.rst:2613 msgid ":c:func:`!PyUnicode_AS_DATA`" @@ -4328,15 +5087,16 @@ msgstr ":c:type:`PyUnicodeObject`" msgid ":c:func:`!PyUnicode_InternImmortal`" msgstr ":c:func:`!PyUnicode_InternImmortal`" -#: ../../whatsnew/3.11.rst:2636 msgid "" ":c:func:`!PyFrame_BlockSetup` and :c:func:`!PyFrame_BlockPop` have been " "removed. (Contributed by Mark Shannon in :issue:`40222`.)" msgstr "" +":c:func:`!PyFrame_BlockSetup` と :c:func:`!PyFrame_BlockPop` が削除されまし" +"た。\n" +"(Mark Shannon による :issue:`40222` での貢献。)" -#: ../../whatsnew/3.11.rst:2640 msgid "Remove the following math macros using the ``errno`` variable:" -msgstr "" +msgstr "``errno`` 変数を使う以下の数学マクロが削除されました。" #: ../../whatsnew/3.11.rst:2642 msgid "``Py_ADJUST_ERANGE1()``" @@ -4358,37 +5118,47 @@ msgstr "``Py_SET_ERANGE_IF_OVERFLOW()``" msgid "``Py_SET_ERRNO_ON_MATH_ERROR()``" msgstr "``Py_SET_ERRNO_ON_MATH_ERROR()``" -#: ../../whatsnew/3.11.rst:2648 msgid "(Contributed by Victor Stinner in :issue:`45412`.)" -msgstr "(Victor Stinner の貢献による :issue:`45412`) " +msgstr "(Victor Stinner の貢献による :issue:`45412`)" -#: ../../whatsnew/3.11.rst:2650 msgid "" "Remove ``Py_UNICODE_COPY()`` and ``Py_UNICODE_FILL()`` macros, deprecated " "since Python 3.3. Use ``PyUnicode_CopyCharacters()`` or ``memcpy()`` " "(``wchar_t*`` string), and ``PyUnicode_Fill()`` functions instead. " "(Contributed by Victor Stinner in :issue:`41123`.)" msgstr "" +"Python 3.3 から非推奨となっていた ``Py_UNICODE_COPY()`` と " +"``Py_UNICODE_FILL()`` マクロが削除されました。\n" +"代わりに、前者には ``PyUnicode_CopyCharacters()`` または ``memcpy()`` " +"(``wchar_t*`` 文字列の場合)、後者には ``PyUnicode_Fill()`` 関数を使ってくださ" +"い。\n" +"(Victor Stinner による :issue:`41123` での貢献。)" -#: ../../whatsnew/3.11.rst:2655 msgid "" "Remove the ``pystrhex.h`` header file. It only contains private functions. C " "extensions should only include the main ```` header file. " "(Contributed by Victor Stinner in :issue:`45434`.)" msgstr "" +"``pystrhex.h`` ヘッダーファイルが削除されました。\n" +"このファイルには非公開関数しか含まれていません。\n" +"C 拡張はメインの ```` ヘッダーファイルだけをインクルードする必要が" +"あります。\n" +"(Victor Stinner による :issue:`45434` での貢献。)" -#: ../../whatsnew/3.11.rst:2659 msgid "" "Remove the ``Py_FORCE_DOUBLE()`` macro. It was used by the " "``Py_IS_INFINITY()`` macro. (Contributed by Victor Stinner in :issue:" "`45440`.)" msgstr "" +"``Py_FORCE_DOUBLE()`` マクロが削除されました。\n" +"このマクロは ``Py_IS_INFINITY()`` マクロで使われていました。\n" +"(Victor Stinner による :issue:`45440` での貢献。)" -#: ../../whatsnew/3.11.rst:2663 msgid "" "The following items are no longer available when :c:macro:`Py_LIMITED_API` " "is defined:" msgstr "" +":c:macro:`Py_LIMITED_API` を定義している場合、以下は利用できなくなりました。" #: ../../whatsnew/3.11.rst:2666 msgid ":c:func:`PyMarshal_WriteLongToFile`" @@ -4410,13 +5180,11 @@ msgstr ":c:func:`PyMarshal_WriteObjectToString`" msgid "the ``Py_MARSHAL_VERSION`` macro" msgstr "``Py_MARSHAL_VERSION`` マクロ" -#: ../../whatsnew/3.11.rst:2672 msgid "These are not part of the :ref:`limited API `." -msgstr "" +msgstr "これらは :ref:`限定 API ` に含まれていません。" -#: ../../whatsnew/3.11.rst:2674 msgid "(Contributed by Victor Stinner in :issue:`45474`.)" -msgstr "" +msgstr "(Victor Stinner による :issue:`45474` での貢献。)" #: ../../whatsnew/3.11.rst:2676 msgid "" @@ -4425,26 +5193,34 @@ msgid "" "limited C API. (Contributed by Victor Stinner in :issue:`35134`.)" msgstr "" -#: ../../whatsnew/3.11.rst:2681 msgid "" "Remove the ``PyHeapType_GET_MEMBERS()`` macro. It was exposed in the public " "C API by mistake, it must only be used by Python internally. Use the " "``PyTypeObject.tp_members`` member instead. (Contributed by Victor Stinner " "in :issue:`40170`.)" msgstr "" +"``PyHeapType_GET_MEMBERS()`` マクロが削除されました。\n" +"このマクロは誤って公開 C API に含まれていましたが、Python 内部でしか使っては" +"いけません。\n" +"代わりに ``PyTypeObject.tp_members`` メンバーを使ってください。\n" +"(Victor Stinner による :issue:`40170` での貢献。)" -#: ../../whatsnew/3.11.rst:2686 msgid "" "Remove the ``HAVE_PY_SET_53BIT_PRECISION`` macro (moved to the internal C " "API). (Contributed by Victor Stinner in :issue:`45412`.)" msgstr "" +"``HAVE_PY_SET_53BIT_PRECISION`` マクロが削除されました (内部 C API に移動しま" +"した)。\n" +"(Victor Stinner による :issue:`45412` での貢献。)" -#: ../../whatsnew/3.11.rst:2692 msgid "" "Remove the :c:type:`Py_UNICODE` encoder APIs, as they have been deprecated " "since Python 3.3, are little used and are inefficient relative to the " "recommended alternatives." msgstr "" +":c:type:`Py_UNICODE` のエンコーダー API が削除されました。\n" +"これらは Python 3.3 から非推奨となっており、ほとんど使われていないうえ、推奨" +"される代替 API より非効率なためです。" #: ../../whatsnew/3.11.rst:2697 msgid "The removed functions are:" @@ -4502,11 +5278,13 @@ msgstr ":func:`!PyUnicode_EncodeDecimal`" msgid ":func:`!PyUnicode_TransformDecimalToASCII`" msgstr ":func:`!PyUnicode_TransformDecimalToASCII`" -#: ../../whatsnew/3.11.rst:2713 msgid "" "See :pep:`624` for details and :pep:`migration guidance <624#alternative-" "apis>`. (Contributed by Inada Naoki in :issue:`44029`.)" msgstr "" +":pep:`624` で詳細と :pep:`移行ガイド <624#alternative-apis>` を参照してくださ" +"い。\n" +"(Inada Naoki による :issue:`44029` での貢献。)" #: ../../whatsnew/3.11.rst:2719 msgid "Notable changes in 3.11.4" @@ -4516,7 +5294,6 @@ msgstr "Python 3.11.4での重要な変更点" msgid "tarfile" msgstr "tarfile" -#: ../../whatsnew/3.11.rst:2724 msgid "" "The extraction methods in :mod:`tarfile`, and :func:`shutil.unpack_archive`, " "have a new a *filter* argument that allows limiting tar features than may be " @@ -4526,6 +5303,15 @@ msgid "" "Python 3.14, the default will switch to ``'data'``. (Contributed by Petr " "Viktorin in :pep:`706`.)" msgstr "" +":mod:`tarfile` の展開メソッドと :func:`shutil.unpack_archive` に *filter* 引" +"数が追加されました。\n" +"これにより、展開先ディレクトリの外にファイルを作成するなど、予想外の動作や危" +"険な動作を招く tar の機能を制限できます。\n" +"詳しくは :ref:`tarfile-extraction-filter` を参照してください。\n" +"Python 3.12 では *filter* 引数を指定せずに使うと :exc:`DeprecationWarning` が" +"表示されます。\n" +"Python 3.14 ではデフォルトが ``'data'`` に変わります。\n" +"(Petr Viktorin による :pep:`706` での貢献。)" #: ../../whatsnew/3.11.rst:2736 msgid "Notable changes in 3.11.5" @@ -4535,7 +5321,8 @@ msgstr "Python 3.11.5での重要な変更点" msgid "OpenSSL" msgstr "OpenSSL" -#: ../../whatsnew/3.11.rst:2741 msgid "" "Windows builds and macOS installers from python.org now use OpenSSL 3.0." msgstr "" +"python.org で配布する Windows ビルドと macOS インストーラーが OpenSSL 3.0 を" +"使うようになりました。" diff --git a/whatsnew/3.2.po b/whatsnew/3.2.po index aae1392b6..376c4987e 100644 --- a/whatsnew/3.2.po +++ b/whatsnew/3.2.po @@ -17,10 +17,10 @@ msgstr "" "Last-Translator: Tetsuo Koyama , 2021\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../whatsnew/3.2.rst:3 @@ -77,11 +77,11 @@ msgid "" "memory structures can still be built, but will need to be recompiled for " "every feature release." msgstr "" -"Python 3.2 より、このことに関する別のアプローチが利用可能になりました。(:c:" -"macro:`Py_LIMITED_API` を定義することで) 制限された API のみ使うようにする拡" -"張モジュールは、数多くの内部実装を利用出来ない代わりに将来のいくつものリリー" -"スで安定であることを約束された API 集合だけ使うことになります。結果として、こ" -"のモードで 3.2 のためにビルドされた拡張モジュールは 3.3、3.4、…でも動作するで" +"Python 3.2 より、このことに関する別のアプローチが利用可能になりました。" +"(``Py_LIMITED_API`` を定義することで) 制限された API のみ使うようにする拡張モ" +"ジュールは、数多くの内部実装を利用出来ない代わりに将来のいくつものリリースで" +"安定であることを約束された API 集合だけ使うことになります。結果として、この" +"モードで 3.2 のためにビルドされた拡張モジュールは 3.3、3.4、…でも動作するで" "しょう。なお、メモリ構造の詳細を曝すような拡張モジュールでは、相変わらず全て" "の Python 公式リリースごとに再ビルドする必要があるでしょう。" @@ -851,8 +851,8 @@ msgstr "" "浮動小数点数または複素数に対する :func:`str` は :func:`repr` 表現と同じになり" "ました。以前は :func:`str` 形式のほうが短い表現になっていましたがこれは単に困" "惑させるものでした。 :func:`repr` がデフォルトで可能ななかでの一番短い表現を" -"するようになったので、 :func:`str` があえて短い表現を取ろうとする必要性がなく" -"なりました。" +"するようになったので、 ``str()`` があえて短い表現を取ろうとする必要性がなくな" +"りました。" #: ../../whatsnew/3.2.rst:532 msgid "(Proposed and implemented by Mark Dickinson; :issue:`9337`.)" @@ -964,8 +964,8 @@ msgstr "" "新たな警告カテゴリ :exc:`ResourceWarning` が追加されました。これはリソース消" "費やクリーンアップについての潜在的な問題が検出されると発行されます。これは通" "常のリリースビルドではデフォルトでは黙殺しますが、 :mod:`warnings` モジュール" -"で意味付けを変更 (訳注: :ref:`warning-filter` 参照) するかコマンドラインオプ" -"ションで有効に出来ます。" +"で意味付けを変更 (訳注: 警告フィルタ参照) するかコマンドラインオプションで有" +"効に出来ます。" #: ../../whatsnew/3.2.rst:600 msgid "" @@ -1439,7 +1439,8 @@ msgid "" "For sorting examples and a brief sorting tutorial, see the `Sorting HowTo " "`_ tutorial." msgstr "" -"ソートの例と簡単なチュートリアルは :ref:`sortinghowto` を参照して下さい。" +"ソートの例と簡単なチュートリアルは `ソートの HowTo `_ を参照して下さい。" #: ../../whatsnew/3.2.rst:842 msgid "itertools" @@ -1697,8 +1698,8 @@ msgid "" msgstr "" "さらに、 :class:`~datetime.timedelta` オブジェクトは今では :class:`float` を" "掛けることができ、 :class:`float` や :class:`int` で割ることができます。ま" -"た、 :class:`~datetime.timedelta` オブジェクトは別の :class:`~datetime." -"timedelta` で割ることが出来ます。" +"た、 :class:`~datetime.timedelta` オブジェクトは別の ``timedelta`` で割ること" +"が出来ます。" #: ../../whatsnew/3.2.rst:1007 msgid "" @@ -2146,27 +2147,32 @@ msgstr "" #: ../../whatsnew/3.2.rst:1270 msgid "Formerly, this would have only been usable as a context manager::" msgstr "" -"ContextDecorator が使われる前の 3.1 までの :func:`~contextlib." -"contextmanager` では、これはコンテキストマネージャとして使えるだけでした::" +"ContextDecorator が使われる前の 3.1 までの ``contextmanager()`` では、これは" +"コンテキストマネージャとして使えるだけでした::" -#: ../../whatsnew/3.2.rst:1272 msgid "" "with track_entry_and_exit('widget loader'):\n" " print('Some time consuming activity goes here')\n" " load_widget()" msgstr "" +"with track_entry_and_exit('widget loader'):\n" +" print('Some time consuming activity goes here')\n" +" load_widget()" #: ../../whatsnew/3.2.rst:1276 msgid "Now, it can be used as a decorator as well::" msgstr "今ではこれはデコレータとしても使えます::" -#: ../../whatsnew/3.2.rst:1278 msgid "" "@track_entry_and_exit('widget loader')\n" "def activity():\n" " print('Some time consuming activity goes here')\n" " load_widget()" msgstr "" +"@track_entry_and_exit('widget loader')\n" +"def activity():\n" +" print('Some time consuming activity goes here')\n" +" load_widget()" #: ../../whatsnew/3.2.rst:1283 msgid "" @@ -2754,10 +2760,10 @@ msgstr "" "うになりました。with ブロックを抜ける際に無条件にソケットをクローズします (ク" "ローズ処理で発生する :exc:`socket.error` は無視されます)。 (Contributed by " "Giampaolo Rodolà; :issue:`9794`.) (---訳注: リファレンスもそうなのですが、" -"「 :func:`socket.create_connection` が with をサポート」というのは実態とは違" -"うんじゃないかと思います(この関数のユーザからは同じにみえたとしても)。実際に" -"は :class:`socket.socket` がコンテキストマネージャをサポートしています。 " -"`socket.py `_ 参照。--)" +"「 ``socket.create_connection()`` が with をサポート」というのは実態とは違う" +"んじゃないかと思います(この関数のユーザからは同じにみえたとしても)。実際には " +"``socket.socket`` がコンテキストマネージャをサポートしています。 `socket.py " +"`_ 参照。--)" #: ../../whatsnew/3.2.rst:1636 msgid "ssl" @@ -3274,9 +3280,9 @@ msgstr "" ":mod:`inspect` モジュールに新たな関数 :func:`~inspect.getgeneratorstate` が追" "加されました。これで簡単にジェネレータイテレータの現在状態を識別出来ます (---" "訳注: generator-iterator という用語を使っている箇所は Python ドキュメント全体" -"通して多くはないのですが 2.x の :ref:`yield` 説明中に登場します。ジェネレータ" -"と同じ意味です。なお getgeneratorstate はジェネレータでないイテレータには使え" -"ません。---)::" +"通して多くはないのですが 2.x の yield 文説明中に登場します。ジェネレータと同" +"じ意味です。なお getgeneratorstate はジェネレータでないイテレータには使えませ" +"ん。---)::" #: ../../whatsnew/3.2.rst:1889 msgid "" @@ -3925,9 +3931,8 @@ msgid "" "API changes." msgstr "" "解決のためには任意の email メッセージをパースするために、 :mod:`email` パッ" -"ケージのバイナリサポートが利用されました (---訳注: :class:`~email.generator." -"BytesGenerator` や :func:`~email.message_from_bytes` など)。また、API の変更" -"も必要となりました。" +"ケージのバイナリサポートが利用されました (---訳注: ``BytesGenerator`` や " +"``message_from_bytes()`` など)。また、API の変更も必要となりました。" #: ../../whatsnew/3.2.rst:2280 msgid "" diff --git a/whatsnew/3.3.po b/whatsnew/3.3.po index a08ce6cdf..aad2ad872 100644 --- a/whatsnew/3.3.po +++ b/whatsnew/3.3.po @@ -19,10 +19,10 @@ msgstr "" "Last-Translator: Taichi Haradaguchi, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../whatsnew/3.3.rst:3 @@ -247,9 +247,9 @@ msgid "" msgstr "" "memoryview オブジェクトに、 PEP-3118 準拠の getbufferproc() が追加されていま" "す\n" -"(訳注: :ref:`buffer-structs` 参照)。これはコンシューマの要求型をチェックしま" -"す。多くの新機能が追加されており、これらのほとんどが不連続配列とサブオフセッ" -"トを持つ配列に完全な一般化をもたらすものです。" +"(訳注: バッファオブジェクト構造体 (buffer object structure) 参照)。これはコン" +"シューマの要求型をチェックします。多くの新機能が追加されており、これらのほと" +"んどが不連続配列とサブオフセットを持つ配列に完全な一般化をもたらすものです。" #: ../../whatsnew/3.3.rst:155 msgid "" @@ -258,11 +258,10 @@ msgid "" "basic and compound flags. The memory layout of non-contiguous and multi-" "dimensional NumPy-style arrays is explained." msgstr "" -":ref:`ドキュメント ` が更新され、エキスポータ(提供側)とコン" -"シューマ(利用側)両方についての責務をより明確に詳細化しています。 :ref:`バッ" -"ファ要求のフラグ ` が、基本フラグと組合せフラグでグルー" -"プ分けされています。不連続配列と多次元の NumPy スタイル行列のメモリレイアウト" -"について説明されています。" +"ドキュメントが更新され、エキスポータ(提供側)とコンシューマ(利用側)両方につい" +"ての責務をより明確に詳細化しています。バッファ要求のフラグが、基本フラグと組" +"合せフラグでグループ分けされています。不連続配列と多次元の NumPy スタイル行列" +"のメモリレイアウトについて説明されています。" #: ../../whatsnew/3.3.rst:161 ../../whatsnew/3.3.rst:1125 msgid "Features" @@ -273,17 +272,16 @@ msgid "" "All native single character format specifiers in struct module syntax " "(optionally prefixed with '@') are now supported." msgstr "" -"struct モジュールの構文の全ての native :ref:`format-characters` をサポートす" -"るようになりました ('@' プレフィクスが付いていても良いです)。 (訳注: :attr:" -"`~memoryview.format` 参照。)" +"struct モジュールの構文の全ての native 書式指定文字をサポートするようになりま" +"した ('@' プレフィクスが付いていても良いです)。 (訳注: ``format`` 参照。)" #: ../../whatsnew/3.3.rst:166 msgid "" "With some restrictions, the cast() method allows changing of format and " "shape of C-contiguous arrays." msgstr "" -"いくつかの制限はありますが、 :meth:`~memoryview.cast` メソッドでフォーマット" -"変更と C-:term:`contiguous` 配列の形状 (shape) の変更を行うことが出来ます。" +"いくつかの制限はありますが、 ``cast()`` メソッドでフォーマット変更と C-" +"contiguous 配列の形状 (shape) の変更を行うことが出来ます。" #: ../../whatsnew/3.3.rst:169 msgid "" @@ -299,9 +297,9 @@ msgid "" "One-dimensional memoryviews of hashable (read-only) types with formats B, b " "or c are now hashable. (Contributed by Antoine Pitrou in :issue:`13411`.)" msgstr "" -"'B', 'b', 'c' いずれかのフォーマットの :term:`hashable` な (読み出し専用の) " -"型の1次元メモリビューもまた、 hashable です。 (Contributed by Antoine Pitrou " -"in :issue:`13411`.)" +"'B', 'b', 'c' いずれかのフォーマットの hashable な (読み出し専用の) 型の1次元" +"メモリビューもまた、 hashable です。 (Contributed by Antoine Pitrou in :" +"issue:`13411`.)" #: ../../whatsnew/3.3.rst:176 msgid "" @@ -315,16 +313,15 @@ msgstr "API の変更" #: ../../whatsnew/3.3.rst:182 msgid "The maximum number of dimensions is officially limited to 64." -msgstr "最大 :attr:`次元 ` は公式に 64 に制限されています。" +msgstr "最大 ``次元`` は公式に 64 に制限されています。" #: ../../whatsnew/3.3.rst:184 msgid "" "The representation of empty shape, strides and suboffsets is now an empty " "tuple instead of ``None``." msgstr "" -"空の :attr:`~memoryview.shape`, 空の :attr:`~memoryview.strides`, 空の :attr:" -"`~memoryview.suboffsets` を表現するのに以前は ``None`` を用いていましたが今で" -"はこれは空のタプルです。" +"空の ``shape``, 空の ``strides``, 空の ``suboffsets`` を表現するのに以前は " +"``None`` を用いていましたが今ではこれは空のタプルです。" #: ../../whatsnew/3.3.rst:187 msgid "" @@ -334,8 +331,7 @@ msgid "" msgstr "" "フォーマット 'B' (unsigned bytes) での memoryview 要素へのアクセスは整数を返" "すようになりました (struct モジュールでの構文に従っています)。bytes オブジェ" -"クトが欲しければまずビューを 'c' で :meth:`~memoryview.cast` しなければなりま" -"せん。" +"クトが欲しければまずビューを 'c' で ``cast()`` しなければなりません。" #: ../../whatsnew/3.3.rst:191 msgid "" @@ -821,9 +817,8 @@ msgid "" "final value to the outer generator::" msgstr "" "ですが普通のループとは違って ``yield from`` ではサブジェネレータは、呼び出し" -"側スコープから :meth:`~generator.send` されたり :meth:`~generator.throw` され" -"た値を直接受け取ることができ、また、外側のジェネレータに最終的な値を返せま" -"す::" +"側スコープから ``send()`` されたり ``throw()`` された値を直接受け取ることがで" +"き、また、外側のジェネレータに最終的な値を返せます::" #: ../../whatsnew/3.3.rst:428 msgid "" @@ -2069,9 +2064,9 @@ msgid "" "instances now return :const:`False` instead of raising :exc:`TypeError` (:" "issue:`15006`)." msgstr "" -"naive な :class:`~datetime.datetime` インスタンスと aware な :class:" -"`~datetime.datetime` インスタンスの等価比較で、 :exc:`TypeError` を投げずに :" -"const:`False` を返すようになりました。 (:issue:`15006`)." +"naive な :class:`~datetime.datetime` インスタンスと aware な ``datetime`` イ" +"ンスタンスの等価比較で、 :exc:`TypeError` を投げずに :const:`False` を返すよ" +"うになりました。 (:issue:`15006`)." #: ../../whatsnew/3.3.rst:1084 msgid "" @@ -2198,9 +2193,9 @@ msgid "" "The :exc:`~decimal.FloatOperation` signal optionally enables stricter " "semantics for mixing floats and Decimals." msgstr "" -":exc:`~decimal.FloatOperation` :ref:`シグナル ` により、" -"float と Decimal の混合の厳密なセマンティクスを有効に出来ます。(---訳注: 使用" -"例が :ref:`decimal-tutorial` にあります。---)" +":exc:`~decimal.FloatOperation` シグナルにより、float と Decimal の混合の厳密" +"なセマンティクスを有効に出来ます。(---訳注: 使用例が Quick-start tutorial に" +"あります。---)" #: ../../whatsnew/3.3.rst:1130 msgid "" @@ -2489,9 +2484,9 @@ msgid "" "The new policies are instances of :class:`~email.policy.EmailPolicy`, and " "add the following additional controls:" msgstr "" -"その新規ポリシーは :class:`~email.policy.EmailPolicy` のインスタンス (訳注: :" -"data:`email.policy.default` や :data:`email.policy.SMTP` など) です。これには" -"以下の制御が追加されています:" +"その新規ポリシーは :class:`~email.policy.EmailPolicy` のインスタンス (訳注: " +"``email.policy.default`` や ``email.policy.SMTP`` など) です。これには以下の" +"制御が追加されています:" #: ../../whatsnew/3.3.rst:1271 msgid "refold_source" @@ -2675,9 +2670,9 @@ msgid "" "email header, convert it into an aware :class:`~datetime.datetime`, or a " "naive :class:`~datetime.datetime` if the offset is ``-0000``." msgstr "" -":func:`~email.utils.parsedate_to_datetime`: email ヘッダからの日付文字列を渡" -"すと、 aware な、または naive な :class:`~datetime.datetime` に変換します。オ" -"フセットが ``-0000`` の場合に naive で返します。" +":func:`~email.utils.parsedate_to_datetime`: email ヘッダの日付文字列を aware " +"な :class:`~datetime.datetime` に変換します。オフセットが ``-0000`` の場合" +"は、naive な :class:`~datetime.datetime` に変換します。" #: ../../whatsnew/3.3.rst:1364 msgid "" @@ -2705,9 +2700,9 @@ msgid "" "issue:`8594`.)" msgstr "" ":class:`ftplib.FTP` に新しいキーワード引数 ``source_address`` が追加されまし" -"た。 ``(host, port)`` の形で指定し、これは外に向かうソケットを作成する際に :" -"meth:`~socket.socket.bind` 呼び出し内でのソースアドレスとして用いられます。 " -"(Contributed by Giampaolo Rodolà in :issue:`8594`.)" +"た。 ``(host, port)`` の形で指定し、これは外に向かうソケットを作成する際に " +"``bind()`` 呼び出し内でのソースアドレスとして用いられます。 (Contributed by " +"Giampaolo Rodolà in :issue:`8594`.)" #: ../../whatsnew/3.3.rst:1379 msgid "" @@ -2962,8 +2957,8 @@ msgid "" "logger." msgstr "" ":func:`~logging.basicConfig` 関数がオプショナルな ``handlers`` 引数をサポート" -"するようになりました。これはルートロガーに追加するハンドラ群の :term:`イテラ" -"ブル ` です。" +"するようになりました。これはルートロガーに追加するハンドラ群のイテラブルで" +"す。" #: ../../whatsnew/3.3.rst:1507 msgid "" @@ -3064,7 +3059,7 @@ msgid "" "`~multiprocessing.pool.Pool.map_async` functions. (Contributed by Hynek " "Schlawack in :issue:`12708`.)" msgstr "" -":func:`map` と :func:`itertools.starmap` との関係と同じ、既存の :meth:" +"``map()`` と :func:`itertools.starmap` との関係と同じ、既存の :meth:" "`multiprocessing.pool.Pool.map` と :meth:`~multiprocessing.pool.Pool." "map_async` に対応する :meth:`multiprocessing.pool.Pool.starmap` と :meth:" "`~multiprocessing.pool.Pool.starmap_async` が追加されました。 (Contributed " @@ -3716,7 +3711,7 @@ msgid "" "instead of a RuntimeError: OSError has an errno attribute." msgstr "" ":func:`signal.signal` と :func:`signal.siginterrupt` は RuntimeError ではな" -"く :exc:`OSError` を投げるようになりました: OSError は errno 属性を持っていま" +"く ``OSError`` を投げるようになりました: OSError は errno 属性を持っていま" "す。" #: ../../whatsnew/3.3.rst:1848 @@ -3754,9 +3749,9 @@ msgid "" msgstr "" "クラス :class:`~smtplib.SMTP`, :class:`~smtplib.SMTP_SSL`, :class:`~smtplib." "LMTP` に新しいキーワード引数 ``source_address`` が追加されました。 ``(host, " -"port)`` の形で指定し、これは外に向かうソケットを作成する際に :meth:`~socket." -"socket.bind` 呼び出し内でのソースアドレスとして用いられます。(Contributed by " -"Paulo Scardine in :issue:`11281`.)" +"port)`` の形で指定し、これは外に向かうソケットを作成する際に ``bind()`` 呼び" +"出し内でのソースアドレスとして用いられます。(Contributed by Paulo Scardine " +"in :issue:`11281`.)" #: ../../whatsnew/3.3.rst:1868 msgid "" @@ -4816,10 +4811,10 @@ msgid "" "with sys.platform.startswith('linux'), or directly sys.platform == 'linux' " "if you don't need to support older Python versions." msgstr "" -":issue:`12326`: Linux では、 :attr:`sys.platform` はもはやメジャーバージョン" -"番号を含みません。 これは今では常に 'linux' です。以前はこれは Python のビル" -"ドに使われた Linux バージョンに依存した ``'linux2'`` や ``'linux3'`` でし" -"た。 ``sys.platform == 'linux2'`` などとするのではなく、 ``sys.platform." +":issue:`12326`: Linux では、 ``sys.platform`` はもはやメジャーバージョン番号" +"を含みません。 これは今では常に 'linux' です。以前はこれは Python のビルドに" +"使われた Linux バージョンに依存した ``'linux2'`` や ``'linux3'`` でした。 " +"``sys.platform == 'linux2'`` などとするのではなく、 ``sys.platform." "startswith('linux')`` とするか、古い Python バージョンのサポートが不要であれ" "ば直接的に ``sys.platform == 'linux'`` として下さい。" diff --git a/whatsnew/3.4.po b/whatsnew/3.4.po index e65895e40..22073b19a 100644 --- a/whatsnew/3.4.po +++ b/whatsnew/3.4.po @@ -17,10 +17,10 @@ msgstr "" "Last-Translator: Takanori Suzuki , 2021\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../whatsnew/3.4.rst:3 @@ -739,8 +739,7 @@ msgstr "" ":pep:`451` は、インポート機構がロードに使うモジュールに関する情報 (つまりモ" "ジュールの仕様) のカプセル化を提供します。これはインポートの実装とインポート" "関連 API の両方を単純化するのに役立ちます。この変更は、 `いくつかの将来のイン" -"ポート関連の改善 `_ の足掛かりでもあります。" +"ポート関連の改善`__ の足掛かりでもあります。" #: ../../whatsnew/3.4.rst:390 msgid "" @@ -848,8 +847,8 @@ msgid "" msgstr "" ":class:`int` コンストラクタの *base* 引数に、 ``__index__`` メソッドを持つ任" "意のオブジェクトを渡せるようになりました。(Contributed by Mark Dickinson in :" -"issue:`16772`.) (---訳注: `Python API の変更`_ に同じ :issue:`16772` を発端と" -"する変更が書かれているのでそちらも参照して下さい。 ---)" +"issue:`16772`.) (---訳注: 「Python API の変更」に同じ issue 16772 を発端とす" +"る変更が書かれているのでそちらも参照して下さい。 ---)" #: ../../whatsnew/3.4.rst:439 msgid "" @@ -1437,9 +1436,9 @@ msgid "" "``distb(tb)``)." msgstr "" ":class:`~dis.Bytecode` にはクラスメソッド :meth:`~dis.Bytecode." -"from_traceback` もあります。トレースバックから :class:`~dis.Bytecode` を構築" -"します。(``print(Bytecode.from_traceback(tb).dis())`` は :func:`~dis.distb` " -"を使って ``distb(tb)`` とするのと同じです。)" +"from_traceback` もあります。トレースバックから ``Bytecode`` を構築します。" +"(``print(Bytecode.from_traceback(tb).dis())`` は ``distb()`` を使って " +"``distb(tb)`` とするのと同じです。)" #: ../../whatsnew/3.4.rst:766 msgid "" @@ -1486,9 +1485,8 @@ msgstr "" "なりました。2 つの新オプション ``-o`` と ``-f`` が追加されています。 ``-o`` " "によりコマンドラインから :ref:`doctest オプション ` を指定す" "ることが出来ます。 ``-f`` は ``-o FAIL_FAST`` の速記法です (:mod:`unittest` " -"CLI でサポートされる似たオプション :ref:`サポートされる同じオプション " -"` に似せるためです)。 (Contributed by R. " -"David Murray in :issue:`11390`.)" +"CLI でサポートされる似たオプションサポートされる同じオプションに似せるためで" +"す)。 (Contributed by R. David Murray in :issue:`11390`.)" #: ../../whatsnew/3.4.rst:787 msgid "" @@ -1513,10 +1511,10 @@ msgid "" msgstr "" ":meth:`~email.message.Message.as_string` メソッドが、その文字列表現を生成する" "のに使うデフォルトポリシーを上書き出来る *policy* 引数を取るようになりまし" -"た。つまり :class:`~email.message.Message` を作り直したり ``flattern`` メソッ" -"ドの書式化パラメータのためだけに :mod:`~email.generator` を使うことなしに、 " -"``as_string`` をより多くの状況で使えるということになります。(Contributed by " -"R. David Murray in :issue:`18600`.)" +"た。つまり ``Message`` を作り直したり ``flattern`` メソッドの書式化パラメータ" +"のためだけに :mod:`~email.generator` を使うことなしに、 ``as_string`` をより" +"多くの状況で使えるということになります。(Contributed by R. David Murray in :" +"issue:`18600`.)" #: ../../whatsnew/3.4.rst:801 msgid "" @@ -1920,7 +1918,6 @@ msgid "" "Brett Cannon in :issue:`18194`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1007 msgid "" "The :mod:`importlib` bootstrap :class:`.NamespaceLoader` now conforms to " "the :class:`.InspectLoader` ABC, which means that ``runpy`` and ``python -" @@ -1931,7 +1928,7 @@ msgstr "" "InspectLoader` ABC に従うようになりました。つまりこれにより ``runpy`` と " "``python -m`` が名前空間パッケージに対して使えるようになりました。" "(Contributed by Brett Cannon in :issue:`18058`.) (訳注: 3.3 以降の名前空間" -"パッケージについては What's New In Python 3.3 (:pep:`420`) 参照。) " +"パッケージについては What's New In Python 3.3 (:pep:`420`) 参照。)" #: ../../whatsnew/3.4.rst:1012 msgid "" @@ -1941,8 +1938,8 @@ msgid "" "get_source` methods." msgstr "" ":mod:`importlib.util` に :func:`~importlib.util.decode_source` 関数が追加され" -"ました。 :term:`universal newlines` 処理を使って bytes からソースをデコードし" -"ます。 :meth:`.InspectLoader.get_source` メソッドを実装するのに便利です。" +"ました。 universal newlines 処理を使って bytes からソースをデコードします。 :" +"meth:`.InspectLoader.get_source` メソッドを実装するのに便利です。" #: ../../whatsnew/3.4.rst:1016 msgid "" @@ -2597,7 +2594,7 @@ msgid "" "with` block. (Contributed by Filip Gruszczyński in :issue:`13896`.)" msgstr "" ":class:`~shelve.Shelf` がコンテキスト管理プロトコルをサポートするようになりま" -"した: :keyword:`!with` ブロックで使うとブロックの終了時に自動的にクローズされ" +"した: :keyword:`with` ブロックで使うとブロックの終了時に自動的にクローズされ" "ます。 (Contributed by Filip Gruszczyński in :issue:`13896`.)" #: ../../whatsnew/3.4.rst:1359 @@ -2756,8 +2753,8 @@ msgstr "" ":class:`~ssl.SSLContext` のメソッド :meth:`~ssl.SSLContext." "load_verify_locations` にオプショナル引数 *cadata* が追加されました。これに" "は PEM あるいは DER エンコードの証明書を直接指定できます。前者の場合は文字列" -"で、後者では :term:`bytes-like object` で指定します。(Contributed by " -"Christian Heimes in :issue:`18138`.)" +"で、後者では bytes-like object で指定します。(Contributed by Christian " +"Heimes in :issue:`18138`.)" #: ../../whatsnew/3.4.rst:1445 msgid "" @@ -2898,8 +2895,8 @@ msgid "" msgstr "" ":func:`~subprocess.check_output` が *input* 引数を受け付けるようになりまし" "た。これは実行するコマンドにとっての ``stdin`` を供給するのに使われます (訳" -"注: :func:`~subprocess.run` のドキュメント参照)。 (Contributed by Zack " -"Weinberg in :issue:`16624`.)" +"注: ``run()`` のドキュメント参照)。 (Contributed by Zack Weinberg in :issue:" +"`16624`.)" #: ../../whatsnew/3.4.rst:1522 msgid "" @@ -3106,8 +3103,8 @@ msgstr "" ":class:`~urllib.request.Request` クラスで使われる HTTP メソッドを、サブクラス" "で :class:`~urllib.request.Request.method` 属性をセットすることにより指定出来" "るようになりました。 (Contributed by Jason R Coombs in :issue:`18978`.) (---" -"訳注: :class:`~urllib.request.Request.method` は 3.3 で追加されたが、コンスト" -"ラクタに渡されたものが設定されるだけだった。---)" +"訳注: ``method`` は 3.3 で追加されたが、コンストラクタに渡されたものが設定さ" +"れるだけだった。---)" #: ../../whatsnew/3.4.rst:1634 msgid "" @@ -4121,7 +4118,7 @@ msgid "" "The site module adding a \"site-python\" directory to sys.path, if it " "exists, is deprecated (:issue:`19375`)." msgstr "" -":mod:`site` モジュールは \"site-python\" ディレクトリが存在すればこれを sys." +"``site`` モジュールは \"site-python\" ディレクトリが存在すればこれを sys." "path に加えていましたが、これは非推奨となりました。 (:issue:`19375`)" #: ../../whatsnew/3.4.rst:2156 @@ -4516,7 +4513,7 @@ msgid "" msgstr "" ":func:`inspect.getfullargspec` は、 :func:`inspect.signature` を前提とした再" "実装がなされました。これにより、かつて扱えていたよりも遥かに広い種類の呼び出" -"し可能 (callable) を扱うようになりました (訳注: 例えば :func:`open` などは " +"し可能 (callable) を扱うようになりました (訳注: 例えば ``open()`` などは " "Python 3.3 までは扱えなかった)。Python 3.4 系列の経過のなかで、追加で組み込み" "や拡張モジュールの callable がシグニチャのメタデータを持つことが期待されてい" "ます。 :func:`inspect.getfullargspec` が非 Python callable で失敗することを前" diff --git a/whatsnew/3.5.po b/whatsnew/3.5.po index cc346ba4f..ffa77efc2 100644 --- a/whatsnew/3.5.po +++ b/whatsnew/3.5.po @@ -19,10 +19,10 @@ msgstr "" "Last-Translator: Arihiro TAKASE, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../whatsnew/3.5.rst:3 @@ -1052,7 +1052,6 @@ msgstr "" msgid "PEP 485: A function for testing approximate equality" msgstr "PEP 485: 近似的に等しいことを調べる関数" -#: ../../whatsnew/3.5.rst:610 msgid "" ":pep:`485` adds the :func:`math.isclose` and :func:`cmath.isclose` functions " "which tell whether two values are approximately equal or \"close\" to each " @@ -1063,7 +1062,7 @@ msgid "" msgstr "" ":pep:`485` により、2値が互いに近似的に等しいか \"近い\" ことを調べる関数 :" "func:`math.isclose` 及び :func:`cmath.isclose` が追加されました。\n" -"2値が近いと判断されるかどうかは与えられた絶対及び相対許容差で決まります。 \n" +"2値が近いと判断されるかどうかは与えられた絶対及び相対許容差で決まります。\n" "相対許容差は ``isclose`` 引数間で許される、絶対値の大きい方に対する最大の差で" "す::" @@ -2537,7 +2536,6 @@ msgid "" "commonprefix` function, it always returns a valid path::" msgstr "" -#: ../../whatsnew/3.5.rst:1512 msgid "" ">>> os.path.commonprefix(['/usr/lib', '/usr/local/lib'])\n" "'/usr/l'\n" @@ -2545,6 +2543,11 @@ msgid "" ">>> os.path.commonpath(['/usr/lib', '/usr/local/lib'])\n" "'/usr'" msgstr "" +">>> os.path.commonprefix(['/usr/lib', '/usr/local/lib'])\n" +"'/usr/l'\n" +"\n" +">>> os.path.commonpath(['/usr/lib', '/usr/local/lib'])\n" +"'/usr'" #: ../../whatsnew/3.5.rst:1518 msgid "(Contributed by Rafik Draoui and Serhiy Storchaka in :issue:`10395`.)" @@ -3579,7 +3582,7 @@ msgstr ":c:func:`PyMem_Calloc`," #: ../../whatsnew/3.5.rst:2180 msgid ":c:func:`PyObject_Calloc`." -msgstr "" +msgstr ":c:func:`PyObject_Calloc`." #: ../../whatsnew/3.5.rst:2182 msgid "(Contributed by Victor Stinner in :issue:`21233`.)" @@ -4350,9 +4353,8 @@ msgid "" "pre.in` for details." msgstr "" -#: ../../whatsnew/3.5.rst:2559 ../../whatsnew/3.5.rst:2572 msgid "(Contributed by Victor Stinner in :issue:`23404`.)" -msgstr "(Victor Stinner の貢献による :issue:`23404`) " +msgstr "(Victor Stinner の貢献による :issue:`23404`)" #: ../../whatsnew/3.5.rst:2565 msgid "Removal of ``make touch`` build target" diff --git a/whatsnew/3.6.po b/whatsnew/3.6.po index 721a5dadf..bd0eb8730 100644 --- a/whatsnew/3.6.po +++ b/whatsnew/3.6.po @@ -22,10 +22,10 @@ msgstr "" "Last-Translator: Yosuke Miyashita, 2025\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../whatsnew/3.6.rst:3 @@ -209,6 +209,9 @@ msgid "" "cryptographically strong pseudo-random numbers suitable for managing secrets " "such as account authentication, tokens, and similar." msgstr "" +"The new :mod:`secrets` module has been added to simplify the generation of " +"cryptographically strong pseudo-random numbers suitable for managing secrets " +"such as account authentication, tokens, and similar." #: ../../whatsnew/3.6.rst:136 ../../whatsnew/3.6.rst:1283 msgid "" @@ -1493,11 +1496,12 @@ msgid "" "positive denominator::" msgstr "" -#: ../../whatsnew/3.6.rst:1004 msgid "" ">>> Decimal('-3.14').as_integer_ratio()\n" "(-157, 50)" msgstr "" +">>> Decimal('-3.14').as_integer_ratio()\n" +"(-157, 50)" #: ../../whatsnew/3.6.rst:1007 msgid "(Contributed by Stefan Krah amd Mark Dickinson in :issue:`25928`.)" @@ -3557,9 +3561,8 @@ msgid "" "pre.in` for details." msgstr "" -#: ../../whatsnew/3.6.rst:2412 ../../whatsnew/3.6.rst:2425 msgid "(Contributed by Victor Stinner in :issue:`23404`.)" -msgstr "(Victor Stinner の貢献による :issue:`23404`) " +msgstr "(Victor Stinner の貢献による :issue:`23404`)" #: ../../whatsnew/3.6.rst:2418 msgid "Removal of ``make touch`` build target" @@ -3621,7 +3624,6 @@ msgstr "" msgid "Notable changes in Python 3.6.10" msgstr "" -#: ../../whatsnew/3.6.rst:2461 msgid "" "Due to significant security concerns, the *reuse_address* parameter of :meth:" "`asyncio.loop.create_datagram_endpoint` is no longer supported. This is " @@ -3632,7 +3634,7 @@ msgid "" msgstr "" "セキュリティ上の重大な懸念により、:meth:`asyncio.loop." "create_datagram_endpoint` での *reuse_address* 引数は無効になりました。これは" -"ソケットオプション `SO_REUSEADDR`` のUDP における挙動が原因です。詳しくは、" +"ソケットオプション ``SO_REUSEADDR`` のUDP における挙動が原因です。詳しくは、" "``loop.create_datagram_endpoint()`` のドキュメントを参照してください。(Kyle " "Stanley, Antoine Pitrou, Yury Selivanov による貢献 :issue:`37228`)" diff --git a/whatsnew/3.7.po b/whatsnew/3.7.po index 4e2860369..7e8bc041e 100644 --- a/whatsnew/3.7.po +++ b/whatsnew/3.7.po @@ -20,10 +20,10 @@ msgstr "" "Last-Translator: Takuya Futatsugi, 2025\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../whatsnew/3.7.rst:3 @@ -124,7 +124,7 @@ msgid "" "spec." msgstr "" ":ref:`dict ` オブジェクトの挿入順序を保存するという性質が、公" -"式に Python 言語仕様の一部であると `宣言されました `_ 。" +"式に Python 言語仕様の一部であると `宣言されました `_ 。" #: ../../whatsnew/3.7.rst:90 msgid "Significant improvements in the standard library:" @@ -1126,7 +1126,6 @@ msgid "" "managers::" msgstr "" -#: ../../whatsnew/3.7.rst:716 msgid "" "srv = await loop.create_server(...)\n" "\n" @@ -1135,6 +1134,12 @@ msgid "" "\n" "# At this point, srv is closed and no longer accepts new connections." msgstr "" +"srv = await loop.create_server(...)\n" +"\n" +"async with srv:\n" +" # 何らかの処理\n" +"\n" +"# この時点で srv は閉じられており、新しい接続を受け付けない。" #: ../../whatsnew/3.7.rst:723 msgid "(Contributed by Yury Selivanov in :issue:`32662`.)" @@ -2660,9 +2665,8 @@ msgid "" "`28822`.)" msgstr "" -#: ../../whatsnew/3.7.rst:1758 msgid "Build Changes" -msgstr "" +msgstr "ビルドの変更" #: ../../whatsnew/3.7.rst:1760 msgid "" @@ -3790,7 +3794,6 @@ msgstr "" msgid "Notable changes in Python 3.7.6" msgstr "Python 3.7.6 での重要な変更点" -#: ../../whatsnew/3.7.rst:2568 msgid "" "Due to significant security concerns, the *reuse_address* parameter of :meth:" "`asyncio.loop.create_datagram_endpoint` is no longer supported. This is " @@ -3801,7 +3804,7 @@ msgid "" msgstr "" "セキュリティ上の重大な懸念により、:meth:`asyncio.loop." "create_datagram_endpoint` での *reuse_address* 引数は無効になりました。これは" -"ソケットオプション `SO_REUSEADDR`` のUDP における挙動が原因です。詳しくは、" +"ソケットオプション ``SO_REUSEADDR`` のUDP における挙動が原因です。詳しくは、" "``loop.create_datagram_endpoint()`` のドキュメントを参照してください。(Kyle " "Stanley, Antoine Pitrou, Yury Selivanov による貢献 :issue:`37228`)" @@ -3848,7 +3851,6 @@ msgstr "" msgid "Notable security feature in 3.7.14" msgstr "" -#: ../../whatsnew/3.7.rst:2608 msgid "" "Converting between :class:`int` and :class:`str` in bases other than 2 " "(binary), 4, 8 (octal), 16 (hexadecimal), or 32 such as base 10 (decimal) " @@ -3860,3 +3862,13 @@ msgid "" "limitation ` documentation. The default limit is 4300 " "digits in string form." msgstr "" +"2 (2 進数)、4、8 (8 進数)、16 (16 進数)、32 以外の基数、例えば 10 (10 進数) " +"で :class:`int` と :class:`str` を相互変換する際、文字列表記の桁数が上限を超" +"えると :exc:`ValueError` を送出するようになりました。\n" +"アルゴリズムの計算量を悪用したサービス拒否攻撃を防ぐためで、:cve:" +"`2020-10735` の緩和策です。\n" +"この上限は、環境変数、コマンドラインフラグ、:mod:`sys` の API で設定または無" +"効化できます。\n" +":ref:`整数の文字列変換の長さ制限 ` のドキュメントを参照し" +"てください。\n" +"デフォルトの上限は文字列表記で 4300 桁です。" diff --git a/whatsnew/3.8.po b/whatsnew/3.8.po index 374d97fed..7c99a2fae 100644 --- a/whatsnew/3.8.po +++ b/whatsnew/3.8.po @@ -19,10 +19,10 @@ msgstr "" "Last-Translator: tomo, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../whatsnew/3.8.rst:3 @@ -238,12 +238,11 @@ msgid "" " ..." msgstr "" -#: ../../whatsnew/3.8.rst:167 msgid "" "Since the parameters to the left of ``/`` are not exposed as possible " "keywords, the parameters names remain available for use in ``**kwargs``::" msgstr "" -" ``/`` の左に置かれた引数はキーワード引数には使用されませんが、それゆえに同じ" +"``/`` の左に置かれた引数はキーワード引数には使用されませんが、それゆえに同じ" "名前が ``**kwargs`` に出現することがあり得ます::" #: ../../whatsnew/3.8.rst:170 @@ -466,9 +465,8 @@ msgstr "" "テム管理者や埋め込みでの利用者は Python のビルドを常に監査が有効な状態で利用" "できます。" -#: ../../whatsnew/3.8.rst:292 msgid "See :pep:`578` for full details." -msgstr "詳細は :pep:`578` を参照してください。 " +msgstr "詳細は :pep:`578` を参照してください。" #: ../../whatsnew/3.8.rst:296 msgid "PEP 587: Python Initialization Configuration" @@ -630,9 +628,8 @@ msgid "" "documentation." msgstr ":ref:`Python 初期化設定 ` も参照してください。" -#: ../../whatsnew/3.8.rst:346 msgid "See :pep:`587` for a full description." -msgstr "詳細は :pep:`587` を参照してください。 " +msgstr "詳細は :pep:`587` を参照してください。" #: ../../whatsnew/3.8.rst:348 msgid "(Contributed by Victor Stinner in :issue:`36763`.)" @@ -656,9 +653,8 @@ msgid "" msgstr "" "これは現在、暫定版です。Python3.9 から公開で使われることを目ざしています。" -#: ../../whatsnew/3.8.rst:363 msgid "See :pep:`590` for a full description." -msgstr "詳細は :pep:`590` を参照してください。 " +msgstr "詳細は :pep:`590` を参照してください。" #: ../../whatsnew/3.8.rst:365 msgid "" @@ -691,9 +687,8 @@ msgstr "" "が、メインのpickle ストリームとは別の独立した通信レイヤで転送されるような、帯" "域外バッファを提供します。" -#: ../../whatsnew/3.8.rst:380 msgid "See :pep:`574` for a full description." -msgstr "詳細は :pep:`574` を参照してください。 " +msgstr "詳細は :pep:`574` を参照してください。" #: ../../whatsnew/3.8.rst:382 msgid "(Contributed by Antoine Pitrou in :issue:`36785`.)" @@ -804,9 +799,8 @@ msgid "" "('SIMPSONS', 'homer', 'marge', 'bart', 'lisa', 'maggie')" msgstr "" -#: ../../whatsnew/3.8.rst:437 msgid "(Contributed by David Cuthbert and Jordan Chapman in :issue:`32117`.)" -msgstr "(David Cuthbert, Jordan Chapman の貢献による :issue:`32117`) " +msgstr "(David Cuthbert, Jordan Chapman の貢献による :issue:`32117`)" #: ../../whatsnew/3.8.rst:439 msgid "" @@ -889,9 +883,8 @@ msgid "" "arguments: 'data'" msgstr "" -#: ../../whatsnew/3.8.rst:479 msgid "(Contributed by Victor Stinner in :issue:`37032`.)" -msgstr "(Victor Stinner の貢献による :issue:`37032`) " +msgstr "(Victor Stinner の貢献による :issue:`37032`)" #: ../../whatsnew/3.8.rst:481 msgid "" @@ -1104,9 +1097,8 @@ msgid "" "asyncio.run(main())" msgstr "" -#: ../../whatsnew/3.8.rst:612 msgid "This is *roughly* equivalent to::" -msgstr "これは、だいたい次と等価です :: " +msgstr "これは、だいたい次と等価です ::" #: ../../whatsnew/3.8.rst:614 msgid "" @@ -3393,7 +3385,7 @@ msgstr "" #: ../../whatsnew/3.8.rst:2109 msgid "Py_DEPRECATED(3.8) PyAPI_FUNC(int) Py_OldFunction(void);" -msgstr "" +msgstr "Py_DEPRECATED(3.8) PyAPI_FUNC(int) Py_OldFunction(void);" #: ../../whatsnew/3.8.rst:2113 msgid "(Contributed by Zackery Spytz in :issue:`33407`.)" @@ -3490,9 +3482,8 @@ msgid "" "by :pep:`572`. (Contributed by Jörn Heissler in :issue:`35224`.)" msgstr "" -#: ../../whatsnew/3.8.rst:2175 msgid "Demos and Tools" -msgstr "" +msgstr "デモとツール" #: ../../whatsnew/3.8.rst:2177 msgid "" @@ -3594,7 +3585,6 @@ msgstr "" msgid "Notable changes in Python 3.8.1" msgstr "Python3.8.1 での重要な変更点" -#: ../../whatsnew/3.8.rst:2239 msgid "" "Due to significant security concerns, the *reuse_address* parameter of :meth:" "`asyncio.loop.create_datagram_endpoint` is no longer supported. This is " @@ -3605,7 +3595,7 @@ msgid "" msgstr "" "セキュリティ上の重大な懸念により、:meth:`asyncio.loop." "create_datagram_endpoint` での *reuse_address* 引数は無効になりました。これは" -"ソケットオプション `SO_REUSEADDR`` のUDP における挙動が原因です。詳しくは、" +"ソケットオプション ``SO_REUSEADDR`` のUDP における挙動が原因です。詳しくは、" "``loop.create_datagram_endpoint()`` のドキュメントを参照してください。(Kyle " "Stanley, Antoine Pitrou, Yury Selivanov による貢献 :issue:`37228`)" @@ -3727,7 +3717,6 @@ msgstr "" msgid "Notable security feature in 3.8.14" msgstr "" -#: ../../whatsnew/3.8.rst:2336 msgid "" "Converting between :class:`int` and :class:`str` in bases other than 2 " "(binary), 4, 8 (octal), 16 (hexadecimal), or 32 such as base 10 (decimal) " @@ -3739,12 +3728,21 @@ msgid "" "limitation ` documentation. The default limit is 4300 " "digits in string form." msgstr "" +"2 (2 進数)、4、8 (8 進数)、16 (16 進数)、32 以外の基数、例えば 10 (10 進数) " +"で :class:`int` と :class:`str` を相互変換する際、文字列表記の桁数が上限を超" +"えると :exc:`ValueError` を送出するようになりました。\n" +"アルゴリズムの計算量を悪用したサービス拒否攻撃を防ぐためで、:cve:" +"`2020-10735` の緩和策です。\n" +"この上限は、環境変数、コマンドラインフラグ、:mod:`sys` の API で設定または無" +"効化できます。\n" +":ref:`整数の文字列変換の長さ制限 ` のドキュメントを参照し" +"てください。\n" +"デフォルトの上限は文字列表記で 4300 桁です。" #: ../../whatsnew/3.8.rst:2347 msgid "Notable changes in 3.8.17" msgstr "" -#: ../../whatsnew/3.8.rst:2352 msgid "" "The extraction methods in :mod:`tarfile`, and :func:`shutil.unpack_archive`, " "have a new a *filter* argument that allows limiting tar features than may be " @@ -3754,3 +3752,12 @@ msgid "" "Python 3.14, the default will switch to ``'data'``. (Contributed by Petr " "Viktorin in :pep:`706`.)" msgstr "" +":mod:`tarfile` の展開メソッドと :func:`shutil.unpack_archive` に *filter* 引" +"数が追加されました。\n" +"これにより、展開先ディレクトリの外にファイルを作成するなど、予想外の動作や危" +"険な動作を招く tar の機能を制限できます。\n" +"詳しくは :ref:`tarfile-extraction-filter` を参照してください。\n" +"Python 3.12 では *filter* 引数を指定せずに使うと :exc:`DeprecationWarning` が" +"表示されます。\n" +"Python 3.14 ではデフォルトが ``'data'`` に変わります。\n" +"(Petr Viktorin による :pep:`706` での貢献。)" diff --git a/whatsnew/3.9.po b/whatsnew/3.9.po index 5976bd252..f2a67b081 100644 --- a/whatsnew/3.9.po +++ b/whatsnew/3.9.po @@ -22,10 +22,10 @@ msgstr "" "Last-Translator: Yasuyuki ARAKI, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../whatsnew/3.9.rst:3 @@ -562,7 +562,6 @@ msgstr "" msgid "asyncio" msgstr "asyncio" -#: ../../whatsnew/3.9.rst:342 msgid "" "Due to significant security concerns, the *reuse_address* parameter of :meth:" "`asyncio.loop.create_datagram_endpoint` is no longer supported. This is " @@ -573,7 +572,7 @@ msgid "" msgstr "" "セキュリティ上の重大な懸念により、:meth:`asyncio.loop." "create_datagram_endpoint` での *reuse_address* 引数は無効になりました。これは" -"ソケットオプション `SO_REUSEADDR`` のUDP における挙動が原因です。詳しくは、" +"ソケットオプション ``SO_REUSEADDR`` のUDP における挙動が原因です。詳しくは、" "``loop.create_datagram_endpoint()`` のドキュメントを参照してください。(Kyle " "Stanley, Antoine Pitrou, Yury Selivanov による貢献 :issue:`37228`)" @@ -799,18 +798,20 @@ msgstr "" msgid "New in 3.9 maintenance releases" msgstr "" -#: ../../whatsnew/3.9.rst:483 msgid "" "Make IDLE invoke :func:`sys.excepthook` (when started without '-n'). User " "hooks were previously ignored. (Contributed by Ken Hilton in :issue:" "`43008`.)" msgstr "" +"IDLE が ('-n' なしで起動した場合に) :func:`sys.excepthook` を呼び出すようにし" +"ました。\n" +"以前はユーザーのフックを無視していました。\n" +"(Ken Hilton による貢献、:issue:`43008`。)" #: ../../whatsnew/3.9.rst:487 msgid "The changes above have been backported to 3.8 maintenance releases." msgstr "" -#: ../../whatsnew/3.9.rst:489 msgid "" "Rearrange the settings dialog. Split the General tab into Windows and Shell/" "Ed tabs. Move help sources, which extend the Help menu, to the Extensions " @@ -820,12 +821,22 @@ msgid "" "Windows tab. (Contributed by Mark Roseman and Terry Jan Reedy in :issue:" "`33962`.)" msgstr "" +"設定ダイアログを再配置しました。\n" +"General タブを Windows タブと Shell/Ed タブに分け、Help メニューを拡張するヘ" +"ルプの参照先を Extensions タブに移動しました。\n" +"新しいオプション用のスペースを確保するとともにダイアログを短くし、小さな画面" +"にも収まりやすくしました。\n" +"(Terry Jan Reedy による貢献、:issue:`40468`。)\n" +"インデントのスペース数の設定を Font タブから新しい Windows タブに移動しまし" +"た。\n" +"(Mark Roseman と Terry Jan Reedy による貢献、:issue:`33962`。)" -#: ../../whatsnew/3.9.rst:497 msgid "" "Apply syntax highlighting to ``.pyi`` files. (Contributed by Alex Waygood " "and Terry Jan Reedy in :issue:`45447`.)" msgstr "" +"``.pyi`` ファイルに構文強調表示を適用するようになりました。\n" +"(Alex Waygood and Terry Jan Reedy による :issue:`45447` での貢献。)" #: ../../whatsnew/3.9.rst:501 msgid "imaplib" @@ -1903,9 +1914,8 @@ msgstr "" msgid "For example, if your ``tp_traverse`` function includes:" msgstr "" -#: ../../whatsnew/3.9.rst:1180 msgid "base->tp_traverse(self, visit, arg)" -msgstr "" +msgstr "base->tp_traverse(self, visit, arg)" #: ../../whatsnew/3.9.rst:1184 msgid "then add:" @@ -1973,9 +1983,8 @@ msgstr "" msgid "(Contributed by Mark Shannon in :issue:`39156`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1224 msgid "Build Changes" -msgstr "" +msgstr "ビルドの変更" #: ../../whatsnew/3.9.rst:1226 msgid "" @@ -2438,28 +2447,30 @@ msgstr "" msgid "Notable changes in Python 3.9.1" msgstr "Python 3.9.1 での重要な変更点" -#: ../../whatsnew/3.9.rst:1496 msgid "" "The behavior of :class:`typing.Literal` was changed to conform with :pep:" "`586` and to match the behavior of static type checkers specified in the PEP." msgstr "" +":class:`typing.Literal` の動作を変更し、:pep:`586` に準拠するとともに、PEP で" +"指定されている静的型チェッカーの動作に合わせました。" -#: ../../whatsnew/3.9.rst:1499 msgid "``Literal`` now de-duplicates parameters." -msgstr "" +msgstr "``Literal`` がパラメータの重複を取り除くようになりました。" -#: ../../whatsnew/3.9.rst:1500 msgid "" "Equality comparisons between ``Literal`` objects are now order independent." -msgstr "" +msgstr "``Literal`` オブジェクト間の等価性比較が、順序に依存しなくなりました。" -#: ../../whatsnew/3.9.rst:1501 msgid "" "``Literal`` comparisons now respect types. For example, ``Literal[0] == " "Literal[False]`` previously evaluated to ``True``. It is now ``False``. To " "support this change, the internally used type cache now supports " "differentiating types." msgstr "" +"``Literal`` の比較が型を区別するようになりました。\n" +"例えば ``Literal[0] == Literal[False]`` は以前 ``True`` でしたが、今は " +"``False`` になります。\n" +"この変更を実現するため、内部の型キャッシュも型を区別するようになりました。" #: ../../whatsnew/3.9.rst:1505 msgid "" @@ -2469,7 +2480,6 @@ msgid "" "error::" msgstr "" -#: ../../whatsnew/3.9.rst:1510 msgid "" ">>> from typing import Literal\n" ">>> Literal[{0}]\n" @@ -2478,6 +2488,12 @@ msgid "" " File \"\", line 1, in \n" "TypeError: unhashable type: 'set'" msgstr "" +">>> from typing import Literal\n" +">>> Literal[{0}]\n" +">>> Literal[{0}] == Literal[{False}]\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"TypeError: unhashable type: 'set'" #: ../../whatsnew/3.9.rst:1517 msgid "(Contributed by Yurii Karabas in :issue:`42345`.)" @@ -2560,7 +2576,6 @@ msgstr "" msgid "Notable changes in Python 3.9.5" msgstr "Python 3.9.5での重要な変更点" -#: ../../whatsnew/3.9.rst:1580 msgid "" "The presence of newline or tab characters in parts of a URL allows for some " "forms of attacks. Following the WHATWG specification that updates :rfc:" @@ -2569,12 +2584,18 @@ msgid "" "attacks. The removal characters are controlled by a new module level " "variable ``urllib.parse._UNSAFE_URL_BYTES_TO_REMOVE``. (See :gh:`88048`)" msgstr "" +"URL の一部に改行文字やタブ文字があると、特定の種類の攻撃が可能になります。\n" +":rfc:`3986` を更新する WHATWG の仕様に従い、:mod:`urllib.parse` のパーサーは " +"ASCII の改行文字 ``\\n``、``\\r`` とタブ文字 ``\\t`` を URL から取り除き、こ" +"の種の攻撃を防ぎます。\n" +"除去する文字は、新しいモジュール変数 ``urllib.parse." +"_UNSAFE_URL_BYTES_TO_REMOVE`` で制御します。\n" +"(:gh:`88048` を参照)" #: ../../whatsnew/3.9.rst:1588 msgid "Notable security feature in 3.9.14" msgstr "" -#: ../../whatsnew/3.9.rst:1590 msgid "" "Converting between :class:`int` and :class:`str` in bases other than 2 " "(binary), 4, 8 (octal), 16 (hexadecimal), or 32 such as base 10 (decimal) " @@ -2586,6 +2607,16 @@ msgid "" "limitation ` documentation. The default limit is 4300 " "digits in string form." msgstr "" +"2 (2 進数)、4、8 (8 進数)、16 (16 進数)、32 以外の基数、例えば 10 (10 進数) " +"で :class:`int` と :class:`str` を相互変換する際、文字列表記の桁数が上限を超" +"えると :exc:`ValueError` を送出するようになりました。\n" +"アルゴリズムの計算量を悪用したサービス拒否攻撃を防ぐためで、:cve:" +"`2020-10735` の緩和策です。\n" +"この上限は、環境変数、コマンドラインフラグ、:mod:`sys` の API で設定または無" +"効化できます。\n" +":ref:`整数の文字列変換の長さ制限 ` のドキュメントを参照し" +"てください。\n" +"デフォルトの上限は文字列表記で 4300 桁です。" #: ../../whatsnew/3.9.rst:1601 msgid "Notable changes in 3.9.17" @@ -2595,7 +2626,6 @@ msgstr "" msgid "tarfile" msgstr "tarfile" -#: ../../whatsnew/3.9.rst:1606 msgid "" "The extraction methods in :mod:`tarfile`, and :func:`shutil.unpack_archive`, " "have a new a *filter* argument that allows limiting tar features than may be " @@ -2605,3 +2635,12 @@ msgid "" "Python 3.14, the default will switch to ``'data'``. (Contributed by Petr " "Viktorin in :pep:`706`.)" msgstr "" +":mod:`tarfile` の展開メソッドと :func:`shutil.unpack_archive` に *filter* 引" +"数が追加されました。\n" +"これにより、展開先ディレクトリの外にファイルを作成するなど、予想外の動作や危" +"険な動作を招く tar の機能を制限できます。\n" +"詳しくは :ref:`tarfile-extraction-filter` を参照してください。\n" +"Python 3.12 では *filter* 引数を指定せずに使うと :exc:`DeprecationWarning` が" +"表示されます。\n" +"Python 3.14 ではデフォルトが ``'data'`` に変わります。\n" +"(Petr Viktorin による :pep:`706` での貢献。)" diff --git a/whatsnew/changelog.po b/whatsnew/changelog.po index 305cbb9e9..39ec26ffa 100644 --- a/whatsnew/changelog.po +++ b/whatsnew/changelog.po @@ -19,10 +19,10 @@ msgstr "" "Last-Translator: tomo, 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../whatsnew/changelog.rst:7 @@ -1328,11 +1328,12 @@ msgid "" "generating a new browser command." msgstr "" -#: ../NEWS:686 msgid "" "This makes it possible to set :envvar:`BROWSER` to the value of one of the " "supported browsers on macOS." msgstr "" +"これにより、macOS でサポートされるブラウザのいずれかの名前を :envvar:" +"`BROWSER` に設定できます。" #: ../NEWS:689 msgid "" @@ -1967,7 +1968,7 @@ msgstr "" #: ../NEWS:1037 msgid "*Release date: 2025-04-08*" -msgstr "" +msgstr "*リリース日: 2025-04-08*" #: ../NEWS:1040 ../NEWS:1413 ../NEWS:1986 ../NEWS:2522 ../NEWS:3940 #: ../NEWS:6891 ../NEWS:7849 ../NEWS:8360 ../NEWS:9238 ../NEWS:9790 @@ -3472,47 +3473,60 @@ msgid "" "removal in Python 3.18:" msgstr "" -#: ../NEWS:1916 msgid "" ":c:func:`!_PyUnicodeWriter_Init`: replace ``_PyUnicodeWriter_Init(&writer)`` " "with :c:func:`writer = PyUnicodeWriter_Create(0) `." msgstr "" +":c:func:`!_PyUnicodeWriter_Init`:``_PyUnicodeWriter_Init(&writer)`` を :c:" +"func:`writer = PyUnicodeWriter_Create(0) ` に置き換え" +"てください。" -#: ../NEWS:1919 msgid "" ":c:func:`!_PyUnicodeWriter_Finish`: replace " "``_PyUnicodeWriter_Finish(&writer)`` with :c:func:" "`PyUnicodeWriter_Finish(writer) `." msgstr "" +":c:func:`!_PyUnicodeWriter_Finish`:``_PyUnicodeWriter_Finish(&writer)`` を :" +"c:func:`PyUnicodeWriter_Finish(writer) ` に置き換えて" +"ください。" -#: ../NEWS:1922 msgid "" ":c:func:`!_PyUnicodeWriter_Dealloc`: replace " "``_PyUnicodeWriter_Dealloc(&writer)`` with :c:func:" "`PyUnicodeWriter_Discard(writer) `." msgstr "" +":c:func:`!_PyUnicodeWriter_Dealloc`:``_PyUnicodeWriter_Dealloc(&writer)`` " +"を :c:func:`PyUnicodeWriter_Discard(writer) ` に置き" +"換えてください。" -#: ../NEWS:1925 msgid "" ":c:func:`!_PyUnicodeWriter_WriteChar`: replace " "``_PyUnicodeWriter_WriteChar(&writer, ch)`` with :c:func:" "`PyUnicodeWriter_WriteChar(writer, ch) `." msgstr "" +":c:func:`!_PyUnicodeWriter_WriteChar`:``_PyUnicodeWriter_WriteChar(&writer, " +"ch)`` を :c:func:`PyUnicodeWriter_WriteChar(writer, ch) " +"` に置き換えてください。" -#: ../NEWS:1928 msgid "" ":c:func:`!_PyUnicodeWriter_WriteStr`: replace " "``_PyUnicodeWriter_WriteStr(&writer, str)`` with :c:func:" "`PyUnicodeWriter_WriteStr(writer, str) `." msgstr "" +":c:func:`!_PyUnicodeWriter_WriteStr`:``_PyUnicodeWriter_WriteStr(&writer, " +"str)`` を :c:func:`PyUnicodeWriter_WriteStr(writer, str) " +"` に置き換えてください。" -#: ../NEWS:1931 msgid "" ":c:func:`!_PyUnicodeWriter_WriteSubstring`: replace " "``_PyUnicodeWriter_WriteSubstring(&writer, str, start, end)`` with :c:func:" "`PyUnicodeWriter_WriteSubstring(writer, str, start, end) " "`." msgstr "" +":c:func:`!_PyUnicodeWriter_WriteSubstring`:" +"``_PyUnicodeWriter_WriteSubstring(&writer, str, start, end)`` を :c:func:" +"`PyUnicodeWriter_WriteSubstring(writer, str, start, end) " +"` に置き換えてください。" #: ../NEWS:1934 msgid "" @@ -3528,13 +3542,11 @@ msgid "" "`PyUnicodeWriter_WriteUTF8(writer, str) `." msgstr "" -#: ../NEWS:1940 msgid ":c:func:`!_PyUnicodeWriter_Prepare`: (no replacement)." -msgstr "" +msgstr ":c:func:`!_PyUnicodeWriter_Prepare`:(代替なし)。" -#: ../NEWS:1941 msgid ":c:func:`!_PyUnicodeWriter_PrepareKind`: (no replacement)." -msgstr "" +msgstr ":c:func:`!_PyUnicodeWriter_PrepareKind`:(代替なし)。" #: ../NEWS:1943 ../NEWS:2492 msgid "" @@ -4434,47 +4446,46 @@ msgid "" "get an attribute of the module. Patch by Victor Stinner." msgstr "" -#: ../NEWS:2481 msgid ":c:func:`!_PyBytes_Join`: use :c:func:`PyBytes_Join`." -msgstr "" +msgstr ":c:func:`!_PyBytes_Join`::c:func:`PyBytes_Join` を使ってください。" -#: ../NEWS:2482 msgid "" ":c:func:`!_PyDict_GetItemStringWithError`: use :c:func:" "`PyDict_GetItemStringRef`." msgstr "" +":c:func:`!_PyDict_GetItemStringWithError`::c:func:`PyDict_GetItemStringRef` " +"を使ってください。" -#: ../NEWS:2483 msgid ":c:func:`!_PyDict_Pop()`: use :c:func:`PyDict_Pop`." -msgstr "" +msgstr ":c:func:`!_PyDict_Pop()`::c:func:`PyDict_Pop` を使ってください。" -#: ../NEWS:2484 msgid ":c:func:`!_PyLong_Sign()`: use :c:func:`PyLong_GetSign`." -msgstr "" +msgstr ":c:func:`!_PyLong_Sign()`::c:func:`PyLong_GetSign` を使ってください。" -#: ../NEWS:2485 msgid "" ":c:func:`!_PyLong_FromDigits` and :c:func:`!_PyLong_New`: use :c:func:" "`PyLongWriter_Create`." msgstr "" +":c:func:`!_PyLong_FromDigits` と :c:func:`!_PyLong_New`::c:func:" +"`PyLongWriter_Create` を使ってください。" -#: ../NEWS:2487 msgid "" ":c:func:`!_PyThreadState_UncheckedGet`: use :c:func:" "`PyThreadState_GetUnchecked`." msgstr "" +":c:func:`!_PyThreadState_UncheckedGet`::c:func:`PyThreadState_GetUnchecked` " +"を使ってください。" -#: ../NEWS:2488 msgid ":c:func:`!_PyUnicode_AsString`: use :c:func:`PyUnicode_AsUTF8`." msgstr "" +":c:func:`!_PyUnicode_AsString`::c:func:`PyUnicode_AsUTF8` を使ってください。" -#: ../NEWS:2489 msgid ":c:func:`!_Py_HashPointer`: use :c:func:`Py_HashPointer`." msgstr "" +":c:func:`!_Py_HashPointer`::c:func:`Py_HashPointer` を使ってください。" -#: ../NEWS:2490 msgid ":c:func:`!_Py_fopen_obj`: use :c:func:`Py_fopen`." -msgstr "" +msgstr ":c:func:`!_Py_fopen_obj`::c:func:`Py_fopen` を使ってください。" #: ../NEWS:2498 msgid "" @@ -9283,15 +9294,15 @@ msgid "" "proxy_objects>` in the :mod:`!multiprocessing` module:" msgstr "" -#: ../NEWS:5246 msgid ":meth:`!clear` and :meth:`!copy` for proxies of :class:`list`" -msgstr "" +msgstr ":class:`list` のプロキシに :meth:`!clear` と :meth:`!copy`" -#: ../NEWS:5247 msgid "" ":meth:`~dict.fromkeys`, ``reversed(d)``, ``d | {}``, ``{} | d``, ``d |= " "{'b': 2}`` for proxies of :class:`dict`" msgstr "" +":class:`dict` のプロキシに :meth:`~dict.fromkeys`、``reversed(d)``、``d | {}" +"``、``{} | d``、``d |= {'b': 2}``" #: ../NEWS:5250 msgid "" @@ -10619,61 +10630,47 @@ msgid "" "`741`):" msgstr "" -#: ../NEWS:5975 msgid ":c:func:`PyInitConfig_Create`" -msgstr "" +msgstr ":c:func:`PyInitConfig_Create`" -#: ../NEWS:5976 msgid ":c:func:`PyInitConfig_Free`" -msgstr "" +msgstr ":c:func:`PyInitConfig_Free`" -#: ../NEWS:5977 msgid ":c:func:`PyInitConfig_GetError`" -msgstr "" +msgstr ":c:func:`PyInitConfig_GetError`" -#: ../NEWS:5978 msgid ":c:func:`PyInitConfig_GetExitCode`" -msgstr "" +msgstr ":c:func:`PyInitConfig_GetExitCode`" -#: ../NEWS:5979 msgid ":c:func:`PyInitConfig_HasOption`" -msgstr "" +msgstr ":c:func:`PyInitConfig_HasOption`" -#: ../NEWS:5980 msgid ":c:func:`PyInitConfig_GetInt`" -msgstr "" +msgstr ":c:func:`PyInitConfig_GetInt`" -#: ../NEWS:5981 msgid ":c:func:`PyInitConfig_GetStr`" -msgstr "" +msgstr ":c:func:`PyInitConfig_GetStr`" -#: ../NEWS:5982 msgid ":c:func:`PyInitConfig_GetStrList`" -msgstr "" +msgstr ":c:func:`PyInitConfig_GetStrList`" -#: ../NEWS:5983 msgid ":c:func:`PyInitConfig_FreeStrList`" -msgstr "" +msgstr ":c:func:`PyInitConfig_FreeStrList`" -#: ../NEWS:5984 msgid ":c:func:`PyInitConfig_SetInt`" -msgstr "" +msgstr ":c:func:`PyInitConfig_SetInt`" -#: ../NEWS:5985 msgid ":c:func:`PyInitConfig_SetStr`" -msgstr "" +msgstr ":c:func:`PyInitConfig_SetStr`" -#: ../NEWS:5986 msgid ":c:func:`PyInitConfig_SetStrList`" -msgstr "" +msgstr ":c:func:`PyInitConfig_SetStrList`" -#: ../NEWS:5987 msgid ":c:func:`PyInitConfig_AddModule`" -msgstr "" +msgstr ":c:func:`PyInitConfig_AddModule`" -#: ../NEWS:5988 msgid ":c:func:`Py_InitializeFromInitConfig`" -msgstr "" +msgstr ":c:func:`Py_InitializeFromInitConfig`" #: ../NEWS:5992 msgid "" @@ -10681,21 +10678,17 @@ msgid "" "configuration:" msgstr "" -#: ../NEWS:5995 msgid ":c:func:`PyConfig_Get`" -msgstr "" +msgstr ":c:func:`PyConfig_Get`" -#: ../NEWS:5996 msgid ":c:func:`PyConfig_GetInt`" -msgstr "" +msgstr ":c:func:`PyConfig_GetInt`" -#: ../NEWS:5997 msgid ":c:func:`PyConfig_Set`" -msgstr "" +msgstr ":c:func:`PyConfig_Set`" -#: ../NEWS:5998 msgid ":c:func:`PyConfig_Names`" -msgstr "" +msgstr ":c:func:`PyConfig_Names`" #: ../NEWS:6002 msgid "" @@ -10834,37 +10827,29 @@ msgid "" "Python :class:`int`:" msgstr "" -#: ../NEWS:6076 msgid ":c:func:`PyLong_FromInt32`" -msgstr "" +msgstr ":c:func:`PyLong_FromInt32`" -#: ../NEWS:6077 msgid ":c:func:`PyLong_FromUInt32`" -msgstr "" +msgstr ":c:func:`PyLong_FromUInt32`" -#: ../NEWS:6078 msgid ":c:func:`PyLong_FromInt64`" -msgstr "" +msgstr ":c:func:`PyLong_FromInt64`" -#: ../NEWS:6079 msgid ":c:func:`PyLong_FromUInt64`" -msgstr "" +msgstr ":c:func:`PyLong_FromUInt64`" -#: ../NEWS:6080 msgid ":c:func:`PyLong_AsInt32`" -msgstr "" +msgstr ":c:func:`PyLong_AsInt32`" -#: ../NEWS:6081 msgid ":c:func:`PyLong_AsUInt32`" -msgstr "" +msgstr ":c:func:`PyLong_AsUInt32`" -#: ../NEWS:6082 msgid ":c:func:`PyLong_AsInt64`" -msgstr "" +msgstr ":c:func:`PyLong_AsInt64`" -#: ../NEWS:6083 msgid ":c:func:`PyLong_AsUInt64`" -msgstr "" +msgstr ":c:func:`PyLong_AsUInt64`" #: ../NEWS:6087 msgid "" @@ -12820,15 +12805,15 @@ msgstr "" #: ../NEWS:7190 msgid ":attr:`ipaddress.IPv4Address.is_global`" -msgstr "" +msgstr ":attr:`ipaddress.IPv4Address.is_global`" #: ../NEWS:7191 msgid ":attr:`ipaddress.IPv6Address.is_private`" -msgstr "" +msgstr ":attr:`ipaddress.IPv6Address.is_private`" #: ../NEWS:7192 msgid ":attr:`ipaddress.IPv6Address.is_global`" -msgstr "" +msgstr ":attr:`ipaddress.IPv6Address.is_global`" #: ../NEWS:7194 msgid "" @@ -13243,23 +13228,23 @@ msgstr "" #: ../NEWS:7448 msgid ":meth:`xml.etree.ElementTree.XMLParser.flush`" -msgstr "" +msgstr ":meth:`xml.etree.ElementTree.XMLParser.flush`" #: ../NEWS:7449 msgid ":meth:`xml.etree.ElementTree.XMLPullParser.flush`" -msgstr "" +msgstr ":meth:`xml.etree.ElementTree.XMLPullParser.flush`" #: ../NEWS:7450 msgid ":meth:`xml.parsers.expat.xmlparser.GetReparseDeferralEnabled`" -msgstr "" +msgstr ":meth:`xml.parsers.expat.xmlparser.GetReparseDeferralEnabled`" #: ../NEWS:7451 msgid ":meth:`xml.parsers.expat.xmlparser.SetReparseDeferralEnabled`" -msgstr "" +msgstr ":meth:`xml.parsers.expat.xmlparser.SetReparseDeferralEnabled`" #: ../NEWS:7452 msgid ":meth:`xml.sax.expatreader.ExpatParser.flush`" -msgstr "" +msgstr ":meth:`xml.sax.expatreader.ExpatParser.flush`" #: ../NEWS:7454 msgid "" @@ -20334,33 +20319,26 @@ msgid "" "Python 3.11:" msgstr "" -#: ../NEWS:11473 msgid ":func:`!unittest.findTestCases`" -msgstr "" +msgstr ":func:`!unittest.findTestCases`" -#: ../NEWS:11474 msgid ":func:`!unittest.makeSuite`" -msgstr "" +msgstr ":func:`!unittest.makeSuite`" -#: ../NEWS:11475 msgid ":func:`!unittest.getTestCaseNames`" -msgstr "" +msgstr ":func:`!unittest.getTestCaseNames`" -#: ../NEWS:11477 ../NEWS:22557 msgid "Use :class:`~unittest.TestLoader` methods instead:" -msgstr "" +msgstr "代わりに :class:`~unittest.TestLoader` のメソッドを使ってください。" -#: ../NEWS:11479 ../NEWS:22559 msgid ":meth:`unittest.TestLoader.loadTestsFromModule`" -msgstr "" +msgstr ":meth:`unittest.TestLoader.loadTestsFromModule`" -#: ../NEWS:11480 ../NEWS:22560 msgid ":meth:`unittest.TestLoader.loadTestsFromTestCase`" -msgstr "" +msgstr ":meth:`unittest.TestLoader.loadTestsFromTestCase`" -#: ../NEWS:11481 ../NEWS:22561 msgid ":meth:`unittest.TestLoader.getTestCaseNames`" -msgstr "" +msgstr ":meth:`unittest.TestLoader.getTestCaseNames`" #: ../NEWS:11483 ../NEWS:20412 ../NEWS:20965 ../NEWS:21860 ../NEWS:21881 #: ../NEWS:21910 ../NEWS:21917 ../NEWS:21924 @@ -23376,17 +23354,14 @@ msgstr "" msgid ":gh:`90656`: Add platform triplets for 64-bit LoongArch:" msgstr "" -#: ../NEWS:13228 msgid "loongarch64-linux-gnusf" -msgstr "" +msgstr "loongarch64-linux-gnusf" -#: ../NEWS:13229 msgid "loongarch64-linux-gnuf32" -msgstr "" +msgstr "loongarch64-linux-gnuf32" -#: ../NEWS:13230 msgid "loongarch64-linux-gnu" -msgstr "" +msgstr "loongarch64-linux-gnu" #: ../NEWS:13232 msgid "Patch by Zhang Na." @@ -25717,7 +25692,7 @@ msgstr "" #: ../NEWS:14638 msgid "*Release date: 2022-12-06*" -msgstr "" +msgstr "*リリース日: 2022-12-06*" #: ../NEWS:14643 msgid "" @@ -29497,13 +29472,11 @@ msgid "" "Python 3.10:" msgstr "" -#: ../NEWS:16809 msgid "``sqlite3.enable_shared_cache()``" -msgstr "" +msgstr "``sqlite3.enable_shared_cache()``" -#: ../NEWS:16810 msgid "``sqlite3.OptimizedUnicode``" -msgstr "" +msgstr "``sqlite3.OptimizedUnicode``" #: ../NEWS:16814 msgid "" @@ -30791,37 +30764,29 @@ msgid "" "``#include ``:" msgstr "" -#: ../NEWS:17542 msgid ":c:func:`PyFrame_Check`" -msgstr "" +msgstr ":c:func:`PyFrame_Check`" -#: ../NEWS:17543 msgid ":c:func:`PyFrame_GetBack`" -msgstr "" +msgstr ":c:func:`PyFrame_GetBack`" -#: ../NEWS:17544 msgid ":c:func:`PyFrame_GetBuiltins`" -msgstr "" +msgstr ":c:func:`PyFrame_GetBuiltins`" -#: ../NEWS:17545 msgid ":c:func:`PyFrame_GetGenerator`" -msgstr "" +msgstr ":c:func:`PyFrame_GetGenerator`" -#: ../NEWS:17546 msgid ":c:func:`PyFrame_GetGlobals`" -msgstr "" +msgstr ":c:func:`PyFrame_GetGlobals`" -#: ../NEWS:17547 msgid ":c:func:`PyFrame_GetLasti`" -msgstr "" +msgstr ":c:func:`PyFrame_GetLasti`" -#: ../NEWS:17548 msgid ":c:func:`PyFrame_GetLocals`" -msgstr "" +msgstr ":c:func:`PyFrame_GetLocals`" -#: ../NEWS:17549 msgid ":c:type:`PyFrame_Type`" -msgstr "" +msgstr ":c:type:`PyFrame_Type`" #: ../NEWS:17553 msgid "" @@ -34731,7 +34696,7 @@ msgstr "" #: ../NEWS:19806 msgid "*Release date: 2022-01-13*" -msgstr "" +msgstr "*リリース日: 2022-01-13*" #: ../NEWS:19811 msgid "" @@ -36333,7 +36298,7 @@ msgstr "" #: ../NEWS:20722 msgid "*Release date: 2021-11-05*" -msgstr "" +msgstr "*リリース日: 2021-11-05*" #: ../NEWS:20727 msgid "" @@ -37163,9 +37128,8 @@ msgstr ":c:func:`PyMarshal_WriteObjectToString`" msgid "the ``Py_MARSHAL_VERSION`` macro" msgstr "``Py_MARSHAL_VERSION`` マクロ" -#: ../NEWS:21200 msgid "These are not part of the :ref:`limited API `." -msgstr "" +msgstr "これらは :ref:`限定 API ` に含まれていません。" #: ../NEWS:21204 msgid "" @@ -38533,9 +38497,8 @@ msgstr "" msgid "``rlecode_hqx()``, ``rledecode_hqx()``." msgstr "" -#: ../NEWS:21954 msgid "The :func:`binascii.crc_hqx` function remains available." -msgstr "" +msgstr ":func:`binascii.crc_hqx` 関数は引き続き利用できます。" #: ../NEWS:21958 msgid "" @@ -40663,41 +40626,32 @@ msgid "" "initialization:" msgstr "" -#: ../NEWS:23114 msgid ":c:func:`!PySys_AddWarnOptionUnicode`" -msgstr "" +msgstr ":c:func:`!PySys_AddWarnOptionUnicode`" -#: ../NEWS:23115 msgid ":c:func:`!PySys_AddWarnOption`" -msgstr "" +msgstr ":c:func:`!PySys_AddWarnOption`" -#: ../NEWS:23116 msgid ":c:func:`!PySys_AddXOption`" -msgstr "" +msgstr ":c:func:`!PySys_AddXOption`" -#: ../NEWS:23117 msgid ":c:func:`!PySys_HasWarnOptions`" -msgstr "" +msgstr ":c:func:`!PySys_HasWarnOptions`" -#: ../NEWS:23118 msgid ":c:func:`!Py_SetPath`" -msgstr "" +msgstr ":c:func:`!Py_SetPath`" -#: ../NEWS:23119 msgid ":c:func:`!Py_SetProgramName`" -msgstr "" +msgstr ":c:func:`!Py_SetProgramName`" -#: ../NEWS:23120 msgid ":c:func:`!Py_SetPythonHome`" -msgstr "" +msgstr ":c:func:`!Py_SetPythonHome`" -#: ../NEWS:23121 msgid ":c:func:`!Py_SetStandardStreamEncoding`" -msgstr "" +msgstr ":c:func:`!Py_SetStandardStreamEncoding`" -#: ../NEWS:23122 msgid ":c:func:`!_Py_SetProgramFullPath`" -msgstr "" +msgstr ":c:func:`!_Py_SetProgramFullPath`" #: ../NEWS:23124 msgid "" @@ -40744,7 +40698,7 @@ msgstr "" #: ../NEWS:23152 msgid "*Release date: 2021-05-03*" -msgstr "" +msgstr "*リリース日: 2021-05-03*" #: ../NEWS:23157 msgid "" @@ -42541,19 +42495,19 @@ msgstr "" #: ../NEWS:24219 msgid "``PyArena_New()``" -msgstr "" +msgstr "``PyArena_New()``" #: ../NEWS:24220 msgid "``PyArena_Free()``" -msgstr "" +msgstr "``PyArena_Free()``" #: ../NEWS:24221 msgid "``PyArena_Malloc()``" -msgstr "" +msgstr "``PyArena_Malloc()``" #: ../NEWS:24222 msgid "``PyArena_AddPyObject()``" -msgstr "" +msgstr "``PyArena_AddPyObject()``" #: ../NEWS:24224 msgid "" @@ -42569,43 +42523,43 @@ msgstr "" #: ../NEWS:24230 msgid "``PyAST_Compile()``" -msgstr "" +msgstr "``PyAST_Compile()``" #: ../NEWS:24231 msgid "``PyAST_CompileEx()``" -msgstr "" +msgstr "``PyAST_CompileEx()``" #: ../NEWS:24232 msgid "``PyAST_CompileObject()``" -msgstr "" +msgstr "``PyAST_CompileObject()``" #: ../NEWS:24233 msgid "``PyFuture_FromAST()``" -msgstr "" +msgstr "``PyFuture_FromAST()``" #: ../NEWS:24234 msgid "``PyFuture_FromASTObject()``" -msgstr "" +msgstr "``PyFuture_FromASTObject()``" #: ../NEWS:24235 msgid "``PyParser_ASTFromFile()``" -msgstr "" +msgstr "``PyParser_ASTFromFile()``" #: ../NEWS:24236 msgid "``PyParser_ASTFromFileObject()``" -msgstr "" +msgstr "``PyParser_ASTFromFileObject()``" #: ../NEWS:24237 msgid "``PyParser_ASTFromFilename()``" -msgstr "" +msgstr "``PyParser_ASTFromFilename()``" #: ../NEWS:24238 msgid "``PyParser_ASTFromString()``" -msgstr "" +msgstr "``PyParser_ASTFromString()``" #: ../NEWS:24239 msgid "``PyParser_ASTFromStringObject()``" -msgstr "" +msgstr "``PyParser_ASTFromStringObject()``" #: ../NEWS:24241 msgid "" @@ -42638,34 +42592,36 @@ msgstr "" #: ../NEWS:24258 msgid "``PyST_GetScope()``" -msgstr "" +msgstr "``PyST_GetScope()``" #: ../NEWS:24259 msgid "``PySymtable_Build()``" -msgstr "" +msgstr "``PySymtable_Build()``" #: ../NEWS:24260 msgid "``PySymtable_BuildObject()``" -msgstr "" +msgstr "``PySymtable_BuildObject()``" #: ../NEWS:24261 msgid "``PySymtable_Free()``" -msgstr "" +msgstr "``PySymtable_Free()``" #: ../NEWS:24262 msgid "``Py_SymtableString()``" -msgstr "" +msgstr "``Py_SymtableString()``" #: ../NEWS:24263 msgid "``Py_SymtableStringObject()``" -msgstr "" +msgstr "``Py_SymtableStringObject()``" -#: ../NEWS:24265 msgid "" "The ``Py_SymtableString()`` function was part the stable ABI by mistake but " "it could not be used, because the ``symtable.h`` header file was excluded " "from the limited C API." msgstr "" +"``Py_SymtableString()`` 関数は誤って安定 ABI に含まれていましたが、" +"``symtable.h`` ヘッダーファイルが制限付き C API の対象外だったため使えません" +"でした。" #: ../NEWS:24269 msgid "The Python :mod:`symtable` module remains available and is unchanged." @@ -43420,13 +43376,16 @@ msgid "" "packages." msgstr "" -#: ../NEWS:24730 msgid "" "Some Linux distribution packaging policies recommend against bundling " "dependencies. For example, Fedora installs wheel packages in the ``/usr/" "share/python-wheels/`` directory and don't install the ``ensurepip." "_bundled`` package." msgstr "" +"Linux ディストリビューションによっては、パッケージングの方針で依存パッケージ" +"の同梱を推奨していません。\n" +"例えば Fedora は wheel パッケージを ``/usr/share/python-wheels/`` ディレクト" +"リにインストールし、``ensurepip._bundled`` パッケージはインストールしません。" #: ../NEWS:24738 msgid ":issue:`41837`: Updated Windows installer to include OpenSSL 1.1.1i" @@ -44114,7 +44073,7 @@ msgstr "" #: ../NEWS:25140 msgid "*Release date: 2020-12-07*" -msgstr "" +msgstr "*リリース日: 2020-12-07*" #: ../NEWS:25145 msgid "" @@ -44144,7 +44103,7 @@ msgstr "" #: ../NEWS:25164 msgid ":meth:`dict.items`" -msgstr "" +msgstr ":meth:`dict.items`" #: ../NEWS:25166 msgid ":func:`enumerate`" @@ -44152,27 +44111,27 @@ msgstr ":func:`enumerate`" #: ../NEWS:25168 msgid ":func:`functools.reduce`" -msgstr "" +msgstr ":func:`functools.reduce`" #: ../NEWS:25170 msgid ":func:`itertools.combinations`" -msgstr "" +msgstr ":func:`itertools.combinations`" #: ../NEWS:25172 msgid ":func:`itertools.combinations_with_replacement`" -msgstr "" +msgstr ":func:`itertools.combinations_with_replacement`" #: ../NEWS:25174 msgid ":func:`itertools.permutations`" -msgstr "" +msgstr ":func:`itertools.permutations`" #: ../NEWS:25176 msgid ":func:`itertools.product`" -msgstr "" +msgstr ":func:`itertools.product`" #: ../NEWS:25178 msgid ":func:`itertools.zip_longest`" -msgstr "" +msgstr ":func:`itertools.zip_longest`" #: ../NEWS:25180 msgid ":func:`zip`" @@ -47836,7 +47795,7 @@ msgstr "Python 3.9.0 beta 1" #: ../NEWS:27232 msgid "*Release date: 2020-05-19*" -msgstr "" +msgstr "*リリース日: 2020-05-19*" #: ../NEWS:27237 msgid "" @@ -48463,7 +48422,7 @@ msgstr "Python 3.9.0 alpha 6" #: ../NEWS:27585 msgid "*Release date: 2020-04-27*" -msgstr "" +msgstr "*リリース日: 2020-04-27*" #: ../NEWS:27590 msgid ":issue:`40121`: Fixes audit events raised on creating a new socket." @@ -49226,7 +49185,7 @@ msgstr "Python 3.9.0 alpha 5" #: ../NEWS:28037 msgid "*Release date: 2020-03-23*" -msgstr "" +msgstr "*リリース日: 2020-03-23*" #: ../NEWS:28042 msgid "" diff --git a/whatsnew/index.po b/whatsnew/index.po index 5fda07a34..3661428ac 100644 --- a/whatsnew/index.po +++ b/whatsnew/index.po @@ -17,10 +17,10 @@ msgstr "" "Last-Translator: Takanori Suzuki , 2024\n" "Language-Team: Japanese (https://app.transifex.com/python-doc/teams/5390/" "ja/)\n" +"Language: 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" #: ../../whatsnew/index.rst:5